teamsync-pdf-viewer 1.3.4 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import e, { createContext as t, useCallback as n, useContext as r, useEffect as i, useImperativeHandle as a, useMemo as o, useRef as s, useState as c, useSyncExternalStore as l } from "react";
3
3
  import u from "react-dom/client";
4
- import { AlertCircle as d, ArrowUpRight as f, Bookmark as p, Brush as m, Check as h, CheckCircle2 as g, CheckSquare as _, ChevronDown as v, ChevronLeft as y, ChevronRight as b, ChevronUp as x, Circle as ee, Columns as S, Copy as C, Download as te, Edit2 as ne, Eraser as re, Expand as ie, EyeOff as w, File as T, FileCode2 as ae, FileText as oe, FolderOpen as E, GripVertical as D, Hand as O, Highlighter as k, Info as se, Layers as A, Link as ce, List as le, Maximize as ue, Maximize2 as de, Menu as fe, MessageCircle as pe, MessageSquare as me, MessageSquareQuote as he, Minus as ge, MinusCircle as _e, MoreHorizontal as ve, MoveHorizontal as j, PanelLeft as ye, Pen as be, Plus as M, PlusCircle as xe, Printer as Se, RotateCcw as Ce, RotateCw as N, Save as we, ScanSearch as Te, Search as Ee, Settings as De, ShieldCheck as Oe, SlidersHorizontal as ke, Square as Ae, Trash2 as je, Type as Me, X as P } from "lucide-react";
5
- import { Fragment as Ne, jsx as F, jsxs as I } from "react/jsx-runtime";
4
+ import { AlertCircle as d, ArrowUpRight as f, Bookmark as p, Brush as m, Check as h, CheckCircle2 as g, CheckSquare as _, ChevronDown as v, ChevronLeft as y, ChevronRight as b, ChevronUp as x, Circle as ee, Columns as S, Copy as te, Download as ne, Edit2 as re, Eraser as ie, Expand as ae, EyeOff as oe, File as C, FileCode2 as se, FileText as ce, FolderOpen as le, GripVertical as w, Hand as ue, Highlighter as T, Info as E, Layers as D, Link as O, List as k, Maximize as de, Maximize2 as fe, Menu as pe, MessageCircle as me, MessageSquare as he, MessageSquareQuote as ge, Minus as _e, MinusCircle as ve, MoreHorizontal as ye, MoveHorizontal as be, PanelLeft as xe, Pen as Se, Plus as A, PlusCircle as Ce, Printer as j, RotateCcw as we, RotateCw as Te, Save as Ee, ScanSearch as M, Search as De, Settings as Oe, ShieldCheck as ke, SlidersHorizontal as Ae, Square as je, Trash2 as Me, Type as Ne, X as N } from "lucide-react";
5
+ import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
6
6
  import * as L from "pdfjs-dist";
7
- import { BlendMode as R, PDFDocument as z, StandardFonts as Pe, degrees as Fe, rgb as B } from "pdf-lib";
7
+ import { BlendMode as Pe, PDFDocument as Fe, StandardFonts as R, degrees as z, rgb as B } from "pdf-lib";
8
8
  //#region src/core/busContext.ts
9
9
  var Ie = t(null);
10
10
  //#endregion
@@ -19,13 +19,46 @@ function Re(e, t) {
19
19
  r.current = t, i(() => n.on(e, (e) => r.current(e)), [n, e]);
20
20
  }
21
21
  //#endregion
22
+ //#region src/utils/zoomUtils.ts
23
+ var ze = .1, Be = 8, Ve = () => typeof navigator < "u" && (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|Tablet/i.test(navigator.userAgent) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), He = 4096, Ue = 2048, We = 8388608, Ge = 4194304;
24
+ function Ke(e, t = 8) {
25
+ return Math.min(t, Math.round((e + (e < 2 ? .25 : e < 5 ? .5 : 1)) * 100) / 100);
26
+ }
27
+ function qe(e, t = ze) {
28
+ return Math.max(t, Math.round((e - (e <= 2 ? .25 : e <= 5 ? .5 : 1)) * 100) / 100);
29
+ }
30
+ function Je(e, t = ze, n = 8) {
31
+ return Math.min(n, Math.max(t, Math.round(e * 100) / 100));
32
+ }
33
+ function Ye(e, t, n, r, i = Ve() ? Ue : He, a = Ve() ? Ge : We) {
34
+ let o = e * t;
35
+ return n * o > i && (o = i / n), r * o > i && (o = i / r), n * o * (r * o) > a && (o = Math.sqrt(a / (n * r))), o;
36
+ }
37
+ function Xe(e) {
38
+ let { prevScale: t, newScale: n, containerWidth: r, containerHeight: i, currentScrollLeft: a, currentScrollTop: o, basePageWidth: s, focusPoint: c, isProgrammatic: l = !1 } = e;
39
+ if (l) return {
40
+ scrollLeft: 0,
41
+ scrollTop: o <= 1 ? 0 : o
42
+ };
43
+ let u = c?.vx != null && c?.vy != null;
44
+ if (!u && o <= 0) return {
45
+ scrollLeft: 0,
46
+ scrollTop: 0
47
+ };
48
+ let d = u ? c.vx : r / 2, f = u ? c.vy : i / 2, p = d + a, m = f + o, h = Math.max(0, r / 2 - s * t / 2), g = Math.max(0, r / 2 - s * n / 2) + (p - h) * (n / t);
49
+ return {
50
+ scrollLeft: Math.max(0, g - d),
51
+ scrollTop: Math.max(0, n / t * m - f)
52
+ };
53
+ }
54
+ //#endregion
22
55
  //#region src/components/Header.tsx
23
- var ze = ["View", "Annotate"];
24
- function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarOpen: r, rightSidebarOpen: a, setRightSidebarOpen: o, sidebarTab: l, scale: u, onZoomIn: d, onZoomOut: f, onZoomSet: p, onOpenFile: m, onDownload: h, onFullScreen: g, onSaveAs: _, onPrint: y, onOpenSettings: b, onOpenAbout: ee, onOpenSidebarTab: S, pageTransition: ne, setPageTransition: re, pageLayout: w, setPageLayout: D, rotation: k, setRotation: ce, signatureCount: le = 0, enableAnnotations: pe, enableSign: he = !1, plugins: ge, permissions: ve }) {
25
- let M = ge && ge.some((e) => e.id && e.id.toLowerCase().includes("sign")), ke = he === !0 && !!M, [Ae, je] = c(!1), [Me, P] = c(!1), [Ne, L] = c(!1), [R, z] = c("pan"), Pe = s(null), Fe = s(null), B = s(null), Ie = Le();
26
- return Re("action-tool-changed", (e) => z(e?.tool ?? null)), i(() => {
56
+ var Ze = ["View", "Annotate"];
57
+ function Qe({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarOpen: r, rightSidebarOpen: a, setRightSidebarOpen: o, sidebarTab: l, scale: u, onZoomIn: d, onZoomOut: f, onZoomSet: p, onOpenFile: m, onDownload: h, onFullScreen: g, onSaveAs: _, onPrint: y, onOpenSettings: b, onOpenAbout: ee, onOpenSidebarTab: S, pageTransition: re, setPageTransition: ie, pageLayout: oe, setPageLayout: w, rotation: T, setRotation: O, signatureCount: k = 0, enableAnnotations: me, enableSign: ge = !1, plugins: _e, permissions: ye }) {
58
+ let A = _e && _e.some((e) => e.id && e.id.toLowerCase().includes("sign")), Ae = ge === !0 && !!A, [je, Me] = c(!1), [Ne, N] = c(!1), [P, L] = c(!1), [Pe, Fe] = c("pan"), R = s(null), z = s(null), B = s(null), Ie = Le();
59
+ return Re("action-tool-changed", (e) => Fe(e?.tool ?? null)), i(() => {
27
60
  function e(e) {
28
- Pe.current && !Pe.current.contains(e.target) && je(!1), Fe.current && !Fe.current.contains(e.target) && P(!1), B.current && !B.current.contains(e.target) && L(!1);
61
+ R.current && !R.current.contains(e.target) && Me(!1), z.current && !z.current.contains(e.target) && N(!1), B.current && !B.current.contains(e.target) && L(!1);
29
62
  }
30
63
  return document.addEventListener("mousedown", e), () => {
31
64
  document.removeEventListener("mousedown", e);
@@ -55,14 +88,14 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
55
88
  },
56
89
  children: [
57
90
  /* @__PURE__ */ I("div", {
58
- ref: Pe,
91
+ ref: R,
59
92
  style: { position: "relative" },
60
- children: [/* @__PURE__ */ F(Ve, {
61
- icon: /* @__PURE__ */ F(fe, { size: 18 }),
93
+ children: [/* @__PURE__ */ F($e, {
94
+ icon: /* @__PURE__ */ F(pe, { size: 18 }),
62
95
  title: "Menu",
63
- onClick: () => je(!Ae),
64
- active: Ae
65
- }), Ae && /* @__PURE__ */ I("div", {
96
+ onClick: () => Me(!je),
97
+ active: je
98
+ }), je && /* @__PURE__ */ I("div", {
66
99
  style: {
67
100
  position: "absolute",
68
101
  top: "100%",
@@ -80,39 +113,39 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
80
113
  },
81
114
  children: [
82
115
  m && /* @__PURE__ */ F(V, {
83
- icon: /* @__PURE__ */ F(E, { size: 16 }),
116
+ icon: /* @__PURE__ */ F(le, { size: 16 }),
84
117
  label: "Open PDF...",
85
118
  onClick: () => {
86
- m(), je(!1);
119
+ m(), Me(!1);
87
120
  }
88
121
  }),
89
122
  /* @__PURE__ */ F(V, {
90
- icon: /* @__PURE__ */ F(te, { size: 16 }),
123
+ icon: /* @__PURE__ */ F(ne, { size: 16 }),
91
124
  label: "Download",
92
125
  onClick: () => {
93
- h(), je(!1);
126
+ h(), Me(!1);
94
127
  }
95
128
  }),
96
129
  /* @__PURE__ */ F(V, {
97
- icon: /* @__PURE__ */ F(ue, { size: 16 }),
130
+ icon: /* @__PURE__ */ F(de, { size: 16 }),
98
131
  label: "Enter Full Screen",
99
132
  onClick: () => {
100
- g(), je(!1);
133
+ g(), Me(!1);
101
134
  }
102
135
  }),
103
136
  /* @__PURE__ */ F(V, {
104
- icon: /* @__PURE__ */ F(we, { size: 16 }),
137
+ icon: /* @__PURE__ */ F(Ee, { size: 16 }),
105
138
  label: "Save As",
106
139
  onClick: () => {
107
- _(), je(!1);
140
+ _(), Me(!1);
108
141
  }
109
142
  }),
110
143
  /* @__PURE__ */ F(V, {
111
- icon: /* @__PURE__ */ F(Se, { size: 16 }),
144
+ icon: /* @__PURE__ */ F(j, { size: 16 }),
112
145
  label: "Print",
113
146
  disabled: !y,
114
147
  onClick: () => {
115
- y?.(), je(!1);
148
+ y?.(), Me(!1);
116
149
  }
117
150
  }),
118
151
  /* @__PURE__ */ F("div", { style: {
@@ -121,7 +154,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
121
154
  margin: "4px 0"
122
155
  } }),
123
156
  /* @__PURE__ */ F(V, {
124
- icon: /* @__PURE__ */ F(A, {
157
+ icon: /* @__PURE__ */ F(D, {
125
158
  size: 16,
126
159
  color: "#0284c7"
127
160
  }),
@@ -131,21 +164,21 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
131
164
  docA: "/sample_v1.pdf",
132
165
  docB: "/sample_v2.pdf",
133
166
  options: { mode: "overlay" }
134
- } })), je(!1);
167
+ } })), Me(!1);
135
168
  }
136
169
  }),
137
170
  /* @__PURE__ */ F(V, {
138
- icon: /* @__PURE__ */ F(De, { size: 16 }),
171
+ icon: /* @__PURE__ */ F(Oe, { size: 16 }),
139
172
  label: "Settings",
140
173
  onClick: () => {
141
- b(), je(!1);
174
+ b(), Me(!1);
142
175
  }
143
176
  })
144
177
  ]
145
178
  })]
146
179
  }),
147
- /* @__PURE__ */ F(Ve, {
148
- icon: /* @__PURE__ */ F(ye, { size: 18 }),
180
+ /* @__PURE__ */ F($e, {
181
+ icon: /* @__PURE__ */ F(xe, { size: 18 }),
149
182
  title: "Toggle Left Panel",
150
183
  active: n,
151
184
  onClick: () => r(!n)
@@ -161,7 +194,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
161
194
  style: { position: "relative" },
162
195
  children: [/* @__PURE__ */ F("div", {
163
196
  style: { position: "relative" },
164
- children: /* @__PURE__ */ F(Ve, {
197
+ children: /* @__PURE__ */ F($e, {
165
198
  icon: /* @__PURE__ */ I("div", {
166
199
  style: {
167
200
  position: "relative",
@@ -169,7 +202,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
169
202
  alignItems: "center",
170
203
  justifyContent: "center"
171
204
  },
172
- children: [/* @__PURE__ */ F(oe, { size: 18 }), /* @__PURE__ */ F("div", {
205
+ children: [/* @__PURE__ */ F(ce, { size: 18 }), /* @__PURE__ */ F("div", {
173
206
  style: {
174
207
  position: "absolute",
175
208
  right: "-4px",
@@ -178,17 +211,17 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
178
211
  borderRadius: "50%",
179
212
  padding: "1px"
180
213
  },
181
- children: /* @__PURE__ */ F(De, {
214
+ children: /* @__PURE__ */ F(Oe, {
182
215
  size: 10,
183
216
  color: "var(--primary)"
184
217
  })
185
218
  })]
186
219
  }),
187
220
  title: "View Settings",
188
- active: Ne,
189
- onClick: () => L(!Ne)
221
+ active: P,
222
+ onClick: () => L(!P)
190
223
  })
191
- }), Ne && /* @__PURE__ */ I("div", {
224
+ }), P && /* @__PURE__ */ I("div", {
192
225
  style: {
193
226
  position: "absolute",
194
227
  top: "100%",
@@ -215,19 +248,19 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
215
248
  children: "Page Transition"
216
249
  }),
217
250
  /* @__PURE__ */ F(V, {
218
- icon: /* @__PURE__ */ F(ae, { size: 16 }),
251
+ icon: /* @__PURE__ */ F(se, { size: 16 }),
219
252
  label: "Continuous Page",
220
- selected: ne === "continuous",
253
+ selected: re === "continuous",
221
254
  onClick: () => {
222
- re("continuous"), L(!1);
255
+ ie("continuous"), L(!1);
223
256
  }
224
257
  }),
225
258
  /* @__PURE__ */ F(V, {
226
- icon: /* @__PURE__ */ F(T, { size: 16 }),
259
+ icon: /* @__PURE__ */ F(C, { size: 16 }),
227
260
  label: "Page By Page",
228
- selected: ne === "page-by-page",
261
+ selected: re === "page-by-page",
229
262
  onClick: () => {
230
- re("page-by-page"), L(!1);
263
+ ie("page-by-page"), L(!1);
231
264
  }
232
265
  }),
233
266
  /* @__PURE__ */ F("div", { style: {
@@ -245,17 +278,17 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
245
278
  children: "Page Orientation"
246
279
  }),
247
280
  /* @__PURE__ */ F(V, {
248
- icon: /* @__PURE__ */ F(N, { size: 16 }),
281
+ icon: /* @__PURE__ */ F(Te, { size: 16 }),
249
282
  label: "Rotate Clockwise",
250
283
  onClick: () => {
251
- ce((k + 90) % 360), L(!1);
284
+ O((T + 90) % 360), L(!1);
252
285
  }
253
286
  }),
254
287
  /* @__PURE__ */ F(V, {
255
- icon: /* @__PURE__ */ F(Ce, { size: 16 }),
288
+ icon: /* @__PURE__ */ F(we, { size: 16 }),
256
289
  label: "Rotate Counterclockwise",
257
290
  onClick: () => {
258
- ce((k - 90 + 360) % 360), L(!1);
291
+ O((T - 90 + 360) % 360), L(!1);
259
292
  }
260
293
  }),
261
294
  /* @__PURE__ */ F("div", { style: {
@@ -273,27 +306,27 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
273
306
  children: "Page Layout"
274
307
  }),
275
308
  /* @__PURE__ */ F(V, {
276
- icon: /* @__PURE__ */ F(T, { size: 16 }),
309
+ icon: /* @__PURE__ */ F(C, { size: 16 }),
277
310
  label: "Single Page",
278
- selected: w === "single",
311
+ selected: oe === "single",
279
312
  onClick: () => {
280
- D("single"), L(!1);
313
+ w("single"), L(!1);
281
314
  }
282
315
  }),
283
316
  /* @__PURE__ */ F(V, {
284
- icon: /* @__PURE__ */ F(C, { size: 16 }),
317
+ icon: /* @__PURE__ */ F(te, { size: 16 }),
285
318
  label: "Double Page",
286
- selected: w === "double",
319
+ selected: oe === "double",
287
320
  onClick: () => {
288
- D("double"), L(!1);
321
+ w("double"), L(!1);
289
322
  }
290
323
  }),
291
324
  /* @__PURE__ */ F(V, {
292
- icon: /* @__PURE__ */ F(oe, { size: 16 }),
325
+ icon: /* @__PURE__ */ F(ce, { size: 16 }),
293
326
  label: "Cover Facing Page",
294
- selected: w === "cover-facing",
327
+ selected: oe === "cover-facing",
295
328
  onClick: () => {
296
- D("cover-facing"), L(!1);
329
+ w("cover-facing"), L(!1);
297
330
  }
298
331
  }),
299
332
  /* @__PURE__ */ F("div", { style: {
@@ -302,7 +335,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
302
335
  margin: "4px 0"
303
336
  } }),
304
337
  /* @__PURE__ */ F(V, {
305
- icon: /* @__PURE__ */ F(ie, { size: 16 }),
338
+ icon: /* @__PURE__ */ F(ae, { size: 16 }),
306
339
  label: "Enter Full Screen",
307
340
  onClick: () => {
308
341
  g(), L(!1);
@@ -319,7 +352,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
319
352
  },
320
353
  children: [
321
354
  /* @__PURE__ */ I("div", {
322
- ref: Fe,
355
+ ref: z,
323
356
  style: {
324
357
  position: "relative",
325
358
  display: "flex",
@@ -331,13 +364,13 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
331
364
  alignItems: "center",
332
365
  backgroundColor: "#f3f4f6",
333
366
  borderRadius: "4px",
334
- border: Me ? "1px solid var(--primary)" : "1px solid transparent",
367
+ border: Ne ? "1px solid var(--primary)" : "1px solid transparent",
335
368
  cursor: "pointer",
336
369
  userSelect: "none",
337
370
  height: "32px"
338
371
  },
339
372
  children: [/* @__PURE__ */ I("div", {
340
- onClick: () => P(!Me),
373
+ onClick: () => N(!Ne),
341
374
  style: {
342
375
  padding: "0 8px 0 12px",
343
376
  fontSize: "13px",
@@ -348,18 +381,18 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
348
381
  },
349
382
  children: [Math.round(u * 100), "%"]
350
383
  }), /* @__PURE__ */ F("div", {
351
- onClick: () => P(!Me),
384
+ onClick: () => N(!Ne),
352
385
  style: {
353
386
  padding: "0 8px",
354
387
  display: "flex",
355
388
  alignItems: "center",
356
389
  height: "100%",
357
390
  borderLeft: "1px solid #e5e7eb",
358
- color: Me ? "var(--primary)" : "var(--text-color)"
391
+ color: Ne ? "var(--primary)" : "var(--text-color)"
359
392
  },
360
- children: F(Me ? x : v, { size: 14 })
393
+ children: F(Ne ? x : v, { size: 14 })
361
394
  })]
362
- }), Me && /* @__PURE__ */ I("div", {
395
+ }), Ne && /* @__PURE__ */ I("div", {
363
396
  style: {
364
397
  position: "absolute",
365
398
  top: "100%",
@@ -378,17 +411,17 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
378
411
  },
379
412
  children: [
380
413
  /* @__PURE__ */ F(V, {
381
- icon: /* @__PURE__ */ F(j, { size: 16 }),
414
+ icon: /* @__PURE__ */ F(be, { size: 16 }),
382
415
  label: "Fit To Width",
383
416
  onClick: () => {
384
- Ie.emit("action-fit-to-width"), P(!1);
417
+ Ie.emit("action-fit-to-width"), N(!1);
385
418
  }
386
419
  }),
387
420
  /* @__PURE__ */ F(V, {
388
- icon: /* @__PURE__ */ F(de, { size: 16 }),
421
+ icon: /* @__PURE__ */ F(fe, { size: 16 }),
389
422
  label: "Fit To Page",
390
423
  onClick: () => {
391
- Ie.emit("action-fit-to-page"), P(!1);
424
+ Ie.emit("action-fit-to-page"), N(!1);
392
425
  }
393
426
  }),
394
427
  /* @__PURE__ */ F("div", { style: {
@@ -407,11 +440,10 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
407
440
  3,
408
441
  4,
409
442
  5,
410
- 8,
411
- 10
443
+ 8
412
444
  ].map((e) => /* @__PURE__ */ I("div", {
413
445
  onClick: () => {
414
- p && p(e), P(!1);
446
+ p && p(e), N(!1);
415
447
  },
416
448
  style: {
417
449
  padding: "6px 44px",
@@ -429,30 +461,30 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
429
461
  margin: "4px 0"
430
462
  } }),
431
463
  /* @__PURE__ */ F(V, {
432
- icon: /* @__PURE__ */ F(Te, { size: 16 }),
464
+ icon: /* @__PURE__ */ F(M, { size: 16 }),
433
465
  label: "Marquee Zoom",
434
- onClick: () => P(!1)
466
+ onClick: () => N(!1)
435
467
  })
436
468
  ]
437
469
  })]
438
470
  }),
439
- /* @__PURE__ */ F(Ve, {
440
- icon: /* @__PURE__ */ F(_e, {
471
+ /* @__PURE__ */ F($e, {
472
+ icon: /* @__PURE__ */ F(ve, {
441
473
  size: 18,
442
474
  color: u <= .1 ? "var(--border-color)" : "var(--text-muted)"
443
475
  }),
444
476
  title: "Zoom Out",
445
477
  onClick: f,
446
- disabled: u <= .1
478
+ disabled: u <= ze
447
479
  }),
448
- /* @__PURE__ */ F(Ve, {
449
- icon: /* @__PURE__ */ F(xe, {
480
+ /* @__PURE__ */ F($e, {
481
+ icon: /* @__PURE__ */ F(Ce, {
450
482
  size: 18,
451
- color: u >= 10 ? "var(--border-color)" : "var(--text-muted)"
483
+ color: u >= 8 ? "var(--border-color)" : "var(--text-muted)"
452
484
  }),
453
485
  title: "Zoom In",
454
486
  onClick: d,
455
- disabled: u >= 10
487
+ disabled: u >= 8
456
488
  })
457
489
  ]
458
490
  }),
@@ -462,10 +494,10 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
462
494
  backgroundColor: "var(--border-color)",
463
495
  margin: "0 4px"
464
496
  } }),
465
- /* @__PURE__ */ F(Ve, {
466
- icon: /* @__PURE__ */ F(O, { size: 18 }),
497
+ /* @__PURE__ */ F($e, {
498
+ icon: /* @__PURE__ */ F(ue, { size: 18 }),
467
499
  title: "Pan Tool",
468
- active: R === "pan",
500
+ active: Pe === "pan",
469
501
  onClick: () => Ie.emit("action-set-tool", { tool: "pan" })
470
502
  })
471
503
  ]
@@ -477,7 +509,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
477
509
  height: "100%",
478
510
  gap: "16px"
479
511
  },
480
- children: ze.filter((e) => e !== "Annotate" || pe !== !1 && ve?.canAddAnnotations !== !1).map((n) => /* @__PURE__ */ F("div", {
512
+ children: Ze.filter((e) => e !== "Annotate" || me !== !1 && ye?.canAddAnnotations !== !1).map((n) => /* @__PURE__ */ F("div", {
481
513
  onClick: () => t(n),
482
514
  style: {
483
515
  fontSize: "13px",
@@ -500,7 +532,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
500
532
  gap: "8px"
501
533
  },
502
534
  children: [
503
- ke && /* @__PURE__ */ I("button", {
535
+ Ae && /* @__PURE__ */ I("button", {
504
536
  onClick: () => Ie.emit("action-sign"),
505
537
  style: {
506
538
  background: "#fff0f0",
@@ -517,13 +549,13 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
517
549
  fontWeight: 600,
518
550
  fontSize: "13px"
519
551
  },
520
- children: [/* @__PURE__ */ F(be, {
552
+ children: [/* @__PURE__ */ F(Se, {
521
553
  size: 14,
522
554
  color: "#d32f2f",
523
555
  fill: "#d32f2f"
524
556
  }), "Sign"]
525
557
  }),
526
- le > 0 && /* @__PURE__ */ I("div", {
558
+ k > 0 && /* @__PURE__ */ I("div", {
527
559
  onClick: () => Ie.emit("action-verify"),
528
560
  style: {
529
561
  backgroundColor: "#10b981",
@@ -539,9 +571,9 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
539
571
  },
540
572
  title: "Verify Signatures",
541
573
  children: [
542
- /* @__PURE__ */ F(Oe, { size: 16 }),
574
+ /* @__PURE__ */ F(ke, { size: 16 }),
543
575
  " Signed · ",
544
- le
576
+ k
545
577
  ]
546
578
  }),
547
579
  /* @__PURE__ */ F("div", { style: {
@@ -550,19 +582,19 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
550
582
  backgroundColor: "var(--border-color)",
551
583
  margin: "0 4px"
552
584
  } }),
553
- /* @__PURE__ */ F(Ve, {
554
- icon: /* @__PURE__ */ F(se, { size: 18 }),
585
+ /* @__PURE__ */ F($e, {
586
+ icon: /* @__PURE__ */ F(E, { size: 18 }),
555
587
  title: "About / Info",
556
588
  onClick: ee
557
589
  }),
558
- /* @__PURE__ */ F(Ve, {
559
- icon: /* @__PURE__ */ F(Ee, { size: 18 }),
590
+ /* @__PURE__ */ F($e, {
591
+ icon: /* @__PURE__ */ F(De, { size: 18 }),
560
592
  title: "Search",
561
593
  active: a && l === "Search",
562
594
  onClick: () => S("Search")
563
595
  }),
564
- /* @__PURE__ */ F(Ve, {
565
- icon: /* @__PURE__ */ F(me, { size: 18 }),
596
+ /* @__PURE__ */ F($e, {
597
+ icon: /* @__PURE__ */ F(he, { size: 18 }),
566
598
  title: "Comments",
567
599
  active: a && l === "Comments",
568
600
  onClick: () => S("Comments")
@@ -573,7 +605,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
573
605
  })
574
606
  });
575
607
  }
576
- function Ve({ icon: e, onClick: t, active: n = !1, disabled: r = !1, title: i }) {
608
+ function $e({ icon: e, onClick: t, active: n = !1, disabled: r = !1, title: i }) {
577
609
  return /* @__PURE__ */ F("button", {
578
610
  title: i,
579
611
  onClick: r ? void 0 : t,
@@ -627,7 +659,7 @@ function V({ icon: e, label: t, onClick: n, disabled: r = !1, selected: i = !1 }
627
659
  }
628
660
  //#endregion
629
661
  //#region src/components/AnnotationContextMenu.tsx
630
- function He({ annotation: e, position: t, onCopy: n, onDelete: r, onUpdateColor: i, onOpenLinkModal: a, permissions: o }) {
662
+ function et({ annotation: e, position: t, onCopy: n, onDelete: r, onUpdateColor: i, onOpenLinkModal: a, permissions: o }) {
631
663
  let s = o?.canAddAnnotations !== !1, c = o?.canEditAnnotations !== !1, l = o?.canDeleteAnnotations !== !1;
632
664
  return /* @__PURE__ */ I("div", {
633
665
  style: {
@@ -647,8 +679,8 @@ function He({ annotation: e, position: t, onCopy: n, onDelete: r, onUpdateColor:
647
679
  },
648
680
  onClick: (e) => e.stopPropagation(),
649
681
  children: [
650
- s && /* @__PURE__ */ I(Ne, { children: [/* @__PURE__ */ F(Ue, {
651
- icon: /* @__PURE__ */ F(C, { size: 16 }),
682
+ s && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(tt, {
683
+ icon: /* @__PURE__ */ F(te, { size: 16 }),
652
684
  title: "Duplicate",
653
685
  onClick: n
654
686
  }), /* @__PURE__ */ F("div", { style: {
@@ -657,7 +689,7 @@ function He({ annotation: e, position: t, onCopy: n, onDelete: r, onUpdateColor:
657
689
  backgroundColor: "#e5e7eb",
658
690
  margin: "0 4px"
659
691
  } })] }),
660
- c && /* @__PURE__ */ I(Ne, { children: [/* @__PURE__ */ F("div", {
692
+ c && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", {
661
693
  style: {
662
694
  display: "flex",
663
695
  alignItems: "center",
@@ -708,14 +740,14 @@ function He({ annotation: e, position: t, onCopy: n, onDelete: r, onUpdateColor:
708
740
  },
709
741
  onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "#e0e7ff",
710
742
  onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "#eef2ff",
711
- children: [/* @__PURE__ */ F(ne, { size: 14 }), "Edit Link"]
712
- }) : /* @__PURE__ */ F(Ue, {
713
- icon: /* @__PURE__ */ F(ce, { size: 16 }),
743
+ children: [/* @__PURE__ */ F(re, { size: 14 }), "Edit Link"]
744
+ }) : /* @__PURE__ */ F(tt, {
745
+ icon: /* @__PURE__ */ F(O, { size: 16 }),
714
746
  title: "Link URL or Page",
715
747
  onClick: a
716
748
  })),
717
- l && /* @__PURE__ */ F(Ue, {
718
- icon: /* @__PURE__ */ F(je, { size: 16 }),
749
+ l && /* @__PURE__ */ F(tt, {
750
+ icon: /* @__PURE__ */ F(Me, { size: 16 }),
719
751
  title: "Delete",
720
752
  onClick: r,
721
753
  color: "#ef4444"
@@ -723,7 +755,7 @@ function He({ annotation: e, position: t, onCopy: n, onDelete: r, onUpdateColor:
723
755
  ]
724
756
  });
725
757
  }
726
- function Ue({ icon: e, title: t, onClick: n, color: r = "#4b5563" }) {
758
+ function tt({ icon: e, title: t, onClick: n, color: r = "#4b5563" }) {
727
759
  return /* @__PURE__ */ F("button", {
728
760
  title: t,
729
761
  onClick: n,
@@ -746,7 +778,7 @@ function Ue({ icon: e, title: t, onClick: n, color: r = "#4b5563" }) {
746
778
  }
747
779
  //#endregion
748
780
  //#region src/components/InsertLinkModal.tsx
749
- function We({ initialUrl: e = "", initialText: t = "", showTextInput: n = !1, onClose: r, onSave: i }) {
781
+ function nt({ initialUrl: e = "", initialText: t = "", showTextInput: n = !1, onClose: r, onSave: i }) {
750
782
  let a = e.startsWith("#page="), [o, s] = c(a ? "page" : "url"), [l, u] = c(a ? "" : e), [d, f] = c(a ? e.replace("#page=", "") : "1"), [p, m] = c(t), h = o === "url" ? !l.trim() : !d.trim(), g = () => {
751
783
  if (h) return;
752
784
  let e = o === "page" ? `#page=${d}` : l;
@@ -801,7 +833,7 @@ function We({ initialUrl: e = "", initialText: t = "", showTextInput: n = !1, on
801
833
  cursor: "pointer",
802
834
  color: "#6b7280"
803
835
  },
804
- children: /* @__PURE__ */ F(P, { size: 20 })
836
+ children: /* @__PURE__ */ F(N, { size: 20 })
805
837
  })]
806
838
  }),
807
839
  /* @__PURE__ */ I("div", {
@@ -974,7 +1006,7 @@ function We({ initialUrl: e = "", initialText: t = "", showTextInput: n = !1, on
974
1006
  }
975
1007
  //#endregion
976
1008
  //#region src/hooks/useShortcuts.ts
977
- var Ge = [
1009
+ var rt = [
978
1010
  {
979
1011
  action: "ROTATE_CW",
980
1012
  description: "Rotate the document clockwise",
@@ -1029,14 +1061,14 @@ var Ge = [
1029
1061
  defaultCommand: "Delete",
1030
1062
  command: "Delete"
1031
1063
  }
1032
- ], Ke = "pdfviewer_shortcuts", qe = "pdfviewer-shortcuts-changed", Je = null, Ye = /* @__PURE__ */ new Set();
1033
- function Xe() {
1034
- if (typeof window > "u" || !window.localStorage) return Ge;
1064
+ ], it = "pdfviewer_shortcuts", H = "pdfviewer-shortcuts-changed", U = null, at = /* @__PURE__ */ new Set();
1065
+ function ot() {
1066
+ if (typeof window > "u" || !window.localStorage) return rt;
1035
1067
  try {
1036
- let e = window.localStorage.getItem(Ke);
1068
+ let e = window.localStorage.getItem(it);
1037
1069
  if (e) {
1038
1070
  let t = JSON.parse(e);
1039
- if (Array.isArray(t)) return Ge.map((e) => {
1071
+ if (Array.isArray(t)) return rt.map((e) => {
1040
1072
  let n = t.find((t) => t && t.action === e.action);
1041
1073
  return n && typeof n.command == "string" ? {
1042
1074
  ...e,
@@ -1045,39 +1077,39 @@ function Xe() {
1045
1077
  });
1046
1078
  }
1047
1079
  } catch {}
1048
- return Ge;
1080
+ return rt;
1049
1081
  }
1050
- function Ze() {
1051
- Ye.forEach((e) => e()), typeof window < "u" && window.dispatchEvent(new CustomEvent(qe));
1082
+ function st() {
1083
+ at.forEach((e) => e()), typeof window < "u" && window.dispatchEvent(new CustomEvent(H));
1052
1084
  }
1053
- function Qe() {
1054
- let [e, t] = c(() => (Je ||= Xe(), Je));
1085
+ function ct() {
1086
+ let [e, t] = c(() => (U ||= ot(), U));
1055
1087
  return i(() => {
1056
1088
  let e = () => {
1057
- Je = Xe(), t(Je);
1089
+ U = ot(), t(U);
1058
1090
  };
1059
- return Ye.add(e), typeof window < "u" && (window.addEventListener("storage", e), window.addEventListener(qe, e)), () => {
1060
- Ye.delete(e), typeof window < "u" && (window.removeEventListener("storage", e), window.removeEventListener(qe, e));
1091
+ return at.add(e), typeof window < "u" && (window.addEventListener("storage", e), window.addEventListener(H, e)), () => {
1092
+ at.delete(e), typeof window < "u" && (window.removeEventListener("storage", e), window.removeEventListener(H, e));
1061
1093
  };
1062
1094
  }, []), {
1063
1095
  shortcuts: e,
1064
1096
  updateShortcut: n((e, n) => {
1065
- let r = (Je || Xe()).map((t) => t.action === e ? {
1097
+ let r = (U || ot()).map((t) => t.action === e ? {
1066
1098
  ...t,
1067
1099
  command: n
1068
1100
  } : t);
1069
- Je = r, typeof window < "u" && window.localStorage && window.localStorage.setItem(Ke, JSON.stringify(r)), t(r), Ze();
1101
+ U = r, typeof window < "u" && window.localStorage && window.localStorage.setItem(it, JSON.stringify(r)), t(r), st();
1070
1102
  }, []),
1071
1103
  resetShortcuts: n(() => {
1072
- Je = Ge, typeof window < "u" && window.localStorage && window.localStorage.removeItem(Ke), t(Ge), Ze();
1104
+ U = rt, typeof window < "u" && window.localStorage && window.localStorage.removeItem(it), t(rt), st();
1073
1105
  }, []),
1074
1106
  getCommand: n((t) => {
1075
- let n = (Je || e).find((e) => e.action === t);
1107
+ let n = (U || e).find((e) => e.action === t);
1076
1108
  return n ? n.command : "";
1077
1109
  }, [e])
1078
1110
  };
1079
1111
  }
1080
- function $e(e) {
1112
+ function lt(e) {
1081
1113
  if (!e) return {
1082
1114
  meta: !1,
1083
1115
  shift: !1,
@@ -1096,16 +1128,16 @@ function $e(e) {
1096
1128
  key: a.join("+").toLowerCase()
1097
1129
  };
1098
1130
  }
1099
- function et(e, t) {
1131
+ function ut(e, t) {
1100
1132
  if (!t) return !1;
1101
- let n = $e(t), r = !!(e.metaKey || e.ctrlKey);
1133
+ let n = lt(t), r = !!(e.metaKey || e.ctrlKey);
1102
1134
  if (n.meta !== r || n.alt !== !!e.altKey) return !1;
1103
1135
  let i = (e.key || "").toLowerCase(), a = n.key.toLowerCase();
1104
1136
  return a === "delete" || a === "backspace" ? n.shift === !!e.shiftKey ? i === "delete" || i === "backspace" : !1 : a === "=" || a === "+" ? !(i !== "=" && i !== "+" && e.code !== "Equal" && e.code !== "NumpadAdd" || n.shift && !e.shiftKey || !n.shift && a === "=" && e.shiftKey) : a === "-" || a === "_" ? !(i !== "-" && i !== "_" && e.code !== "Minus" && e.code !== "NumpadSubtract" || n.shift && !e.shiftKey || !n.shift && a === "-" && e.shiftKey) : n.shift === !!e.shiftKey && !!(i === a || e.code && e.code.toLowerCase() === `key${a}` || e.code && e.code.toLowerCase() === `digit${a}`);
1105
1137
  }
1106
1138
  //#endregion
1107
1139
  //#region src/hooks/usePdfSearch.ts
1108
- async function tt(e, t, n = [], r) {
1140
+ async function dt(e, t, n = [], r) {
1109
1141
  if (!e || !t.trim()) return [];
1110
1142
  let i = [], a = t.toLowerCase(), o = e.numPages;
1111
1143
  for (let s = 1; s <= o; s += 10) {
@@ -1182,7 +1214,7 @@ async function tt(e, t, n = [], r) {
1182
1214
  }
1183
1215
  return i;
1184
1216
  }
1185
- function nt(e, t = []) {
1217
+ function ft(e, t = []) {
1186
1218
  let [r, i] = c(!1), [a, o] = c([]), [s, l] = c(0);
1187
1219
  return {
1188
1220
  search: n(async (n) => {
@@ -1192,7 +1224,7 @@ function nt(e, t = []) {
1192
1224
  }
1193
1225
  i(!0), l(0);
1194
1226
  try {
1195
- let r = await tt(e, n, t, (e) => l(e));
1227
+ let r = await dt(e, n, t, (e) => l(e));
1196
1228
  o(r);
1197
1229
  } catch (e) {
1198
1230
  console.error("Search error:", e);
@@ -1208,7 +1240,7 @@ function nt(e, t = []) {
1208
1240
  }
1209
1241
  //#endregion
1210
1242
  //#region src/components/Sidebar.tsx
1211
- function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId: r, setSelectedAnnotationId: a, onSearch: o, searchResults: l, isSearching: u, searchProgress: d, onResultClick: f, activeTab: p, setActiveTab: m }) {
1243
+ function pt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId: r, setSelectedAnnotationId: a, onSearch: o, searchResults: l, isSearching: u, searchProgress: d, onResultClick: f, activeTab: p, setActiveTab: m }) {
1212
1244
  let [h, g] = c(""), [_, v] = c(320), [y, b] = c(!1), x = s(null);
1213
1245
  i(() => {
1214
1246
  let e = (e) => {
@@ -1309,7 +1341,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
1309
1341
  marginBottom: "16px"
1310
1342
  },
1311
1343
  children: [
1312
- /* @__PURE__ */ F(Ee, {
1344
+ /* @__PURE__ */ F(De, {
1313
1345
  size: 16,
1314
1346
  color: "#64748b",
1315
1347
  style: {
@@ -1353,7 +1385,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
1353
1385
  color: "var(--text-muted)"
1354
1386
  },
1355
1387
  title: "Clear search",
1356
- children: /* @__PURE__ */ F(P, { size: 14 })
1388
+ children: /* @__PURE__ */ F(N, { size: 14 })
1357
1389
  })
1358
1390
  ]
1359
1391
  })]
@@ -1366,7 +1398,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
1366
1398
  flexDirection: "column",
1367
1399
  gap: "8px"
1368
1400
  },
1369
- children: [p === "Comments" && /* @__PURE__ */ I(Ne, { children: [ee.length === 0 && /* @__PURE__ */ F("div", {
1401
+ children: [p === "Comments" && /* @__PURE__ */ I(P, { children: [ee.length === 0 && /* @__PURE__ */ F("div", {
1370
1402
  style: {
1371
1403
  color: "var(--text-muted)",
1372
1404
  fontSize: "13px",
@@ -1399,10 +1431,10 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
1399
1431
  color: "var(--text-muted)"
1400
1432
  },
1401
1433
  children: [
1402
- e.type === "note" && /* @__PURE__ */ F(me, { size: 14 }),
1403
- e.type === "callout" && /* @__PURE__ */ F(pe, { size: 14 }),
1404
- e.type === "text" && /* @__PURE__ */ F(Me, { size: 14 }),
1405
- e.type === "link" && /* @__PURE__ */ F(ce, { size: 14 }),
1434
+ e.type === "note" && /* @__PURE__ */ F(he, { size: 14 }),
1435
+ e.type === "callout" && /* @__PURE__ */ F(me, { size: 14 }),
1436
+ e.type === "text" && /* @__PURE__ */ F(Ne, { size: 14 }),
1437
+ e.type === "link" && /* @__PURE__ */ F(O, { size: 14 }),
1406
1438
  /* @__PURE__ */ F("span", {
1407
1439
  style: {
1408
1440
  fontSize: "12px",
@@ -1430,7 +1462,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
1430
1462
  padding: "4px"
1431
1463
  },
1432
1464
  title: "Delete Comment",
1433
- children: /* @__PURE__ */ F(je, { size: 14 })
1465
+ children: /* @__PURE__ */ F(Me, { size: 14 })
1434
1466
  })]
1435
1467
  }), /* @__PURE__ */ F("div", {
1436
1468
  style: {
@@ -1462,7 +1494,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
1462
1494
  children: "Empty comment"
1463
1495
  })
1464
1496
  })]
1465
- }, e.id))] }), p === "Search" && /* @__PURE__ */ I(Ne, { children: [
1497
+ }, e.id))] }), p === "Search" && /* @__PURE__ */ I(P, { children: [
1466
1498
  u && /* @__PURE__ */ I("div", {
1467
1499
  style: {
1468
1500
  fontSize: "13px",
@@ -1589,7 +1621,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
1589
1621
  }
1590
1622
  //#endregion
1591
1623
  //#region src/components/LeftSidebar.tsx
1592
- var it = ({ pdfDoc: e, pageIndex: t, isActive: n, onClick: r, scale: a }) => {
1624
+ var mt = ({ pdfDoc: e, pageIndex: t, isActive: n, onClick: r, scale: a }) => {
1593
1625
  let o = s(null), l = s(null), [u, d] = c(!1), [f, p] = c(.77);
1594
1626
  i(() => {
1595
1627
  let e = new IntersectionObserver((e) => {
@@ -1678,7 +1710,7 @@ var it = ({ pdfDoc: e, pageIndex: t, isActive: n, onClick: r, scale: a }) => {
1678
1710
  })]
1679
1711
  });
1680
1712
  };
1681
- function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
1713
+ function ht({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
1682
1714
  let [a, o] = c("Thumbnails"), [s, l] = c(250), [u, d] = c(!1), [f, m] = c(30), h = .1 + f / 100 * .3;
1683
1715
  i(() => {
1684
1716
  let e = (e) => {
@@ -1734,7 +1766,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
1734
1766
  justifyContent: "center"
1735
1767
  },
1736
1768
  title: "Page Thumbnails",
1737
- children: /* @__PURE__ */ F(C, { size: 16 })
1769
+ children: /* @__PURE__ */ F(te, { size: 16 })
1738
1770
  }),
1739
1771
  /* @__PURE__ */ F("button", {
1740
1772
  onClick: () => o("Outline"),
@@ -1750,7 +1782,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
1750
1782
  justifyContent: "center"
1751
1783
  },
1752
1784
  title: "Document Outline",
1753
- children: /* @__PURE__ */ F(le, { size: 16 })
1785
+ children: /* @__PURE__ */ F(k, { size: 16 })
1754
1786
  }),
1755
1787
  /* @__PURE__ */ F("button", {
1756
1788
  onClick: () => o("Bookmarks"),
@@ -1781,11 +1813,11 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
1781
1813
  justifyContent: "center"
1782
1814
  },
1783
1815
  title: "More Options",
1784
- children: /* @__PURE__ */ F(ve, { size: 16 })
1816
+ children: /* @__PURE__ */ F(ye, { size: 16 })
1785
1817
  })
1786
1818
  ]
1787
1819
  }),
1788
- a === "Thumbnails" && /* @__PURE__ */ I(Ne, { children: [
1820
+ a === "Thumbnails" && /* @__PURE__ */ I(P, { children: [
1789
1821
  /* @__PURE__ */ I("div", {
1790
1822
  style: {
1791
1823
  display: "flex",
@@ -1796,7 +1828,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
1796
1828
  backgroundColor: "#fff"
1797
1829
  },
1798
1830
  children: [
1799
- /* @__PURE__ */ F(ge, {
1831
+ /* @__PURE__ */ F(_e, {
1800
1832
  size: 14,
1801
1833
  color: "var(--text-muted)",
1802
1834
  style: { cursor: "pointer" },
@@ -1814,7 +1846,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
1814
1846
  accentColor: "var(--primary)"
1815
1847
  }
1816
1848
  }),
1817
- /* @__PURE__ */ F(M, {
1849
+ /* @__PURE__ */ F(A, {
1818
1850
  size: 14,
1819
1851
  color: "var(--text-muted)",
1820
1852
  style: { cursor: "pointer" },
@@ -1829,7 +1861,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
1829
1861
  padding: "8px 0",
1830
1862
  backgroundColor: "#f1f1f1"
1831
1863
  },
1832
- children: [t && v.map((e) => /* @__PURE__ */ F(it, {
1864
+ children: [t && v.map((e) => /* @__PURE__ */ F(mt, {
1833
1865
  pdfDoc: t,
1834
1866
  pageIndex: e,
1835
1867
  isActive: e === n,
@@ -1921,7 +1953,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
1921
1953
  }
1922
1954
  //#endregion
1923
1955
  //#region src/utils/rotationUtils.ts
1924
- function ot(e, t, n, r, i) {
1956
+ function gt(e, t, n, r, i) {
1925
1957
  let a = (n % 360 + 360) % 360;
1926
1958
  return a === 90 ? {
1927
1959
  x: t,
@@ -1937,7 +1969,7 @@ function ot(e, t, n, r, i) {
1937
1969
  y: t
1938
1970
  };
1939
1971
  }
1940
- function st(e, t, n, r, i) {
1972
+ function _t(e, t, n, r, i) {
1941
1973
  let a = (n % 360 + 360) % 360;
1942
1974
  return a === 90 ? {
1943
1975
  x: i - t,
@@ -1953,7 +1985,7 @@ function st(e, t, n, r, i) {
1953
1985
  y: t
1954
1986
  };
1955
1987
  }
1956
- function H(e, t, n, r, i, a, o) {
1988
+ function vt(e, t, n, r, i, a, o) {
1957
1989
  let s = (i % 360 + 360) % 360;
1958
1990
  return s === 90 ? {
1959
1991
  x: o - (t + r),
@@ -1977,64 +2009,43 @@ function H(e, t, n, r, i, a, o) {
1977
2009
  height: r
1978
2010
  };
1979
2011
  }
1980
- function ct(e, t, n) {
2012
+ function yt(e, t, n) {
1981
2013
  let r = (e % 360 + 360) % 360;
1982
2014
  if (r === 90) return `translate(${n}, 0) rotate(90)`;
1983
2015
  if (r === 180) return `translate(${t}, ${n}) rotate(180)`;
1984
2016
  if (r === 270) return `translate(0, ${t}) rotate(270)`;
1985
2017
  }
1986
- function lt(e) {
2018
+ function bt(e) {
1987
2019
  return (e % 360 + 360) % 360;
1988
2020
  }
1989
2021
  //#endregion
1990
- //#region src/utils/zoomUtils.ts
1991
- var ut = .1, dt = 10, ft = () => typeof navigator < "u" && (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|Tablet/i.test(navigator.userAgent) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), pt = 4096, mt = 2048, ht = 8388608, gt = 4194304;
1992
- function _t(e, t = 10) {
1993
- return Math.min(t, Math.round((e + (e < 2 ? .25 : e < 5 ? .5 : 1)) * 100) / 100);
1994
- }
1995
- function vt(e, t = ut) {
1996
- return Math.max(t, Math.round((e - (e <= 2 ? .25 : e <= 5 ? .5 : 1)) * 100) / 100);
1997
- }
1998
- function yt(e, t = ut, n = 10) {
1999
- return Math.min(n, Math.max(t, Math.round(e * 100) / 100));
2000
- }
2001
- function bt(e, t, n, r, i = ft() ? mt : pt, a = ft() ? gt : ht) {
2002
- let o = e * t;
2003
- return n * o > i && (o = i / n), r * o > i && (o = i / r), n * o * (r * o) > a && (o = Math.sqrt(a / (n * r))), o;
2004
- }
2005
- function xt(e) {
2006
- let { prevScale: t, newScale: n, containerWidth: r, containerHeight: i, currentScrollLeft: a, currentScrollTop: o, basePageWidth: s, focusPoint: c, isProgrammatic: l = !1 } = e;
2007
- if (l) return {
2008
- scrollLeft: 0,
2009
- scrollTop: o <= 1 ? 0 : o
2010
- };
2011
- let u = c?.vx != null && c?.vy != null;
2012
- if (!u && o <= 0) return {
2013
- scrollLeft: 0,
2014
- scrollTop: 0
2015
- };
2016
- let d = u ? c.vx : r / 2, f = u ? c.vy : i / 2, p = d + a, m = f + o, h = Math.max(0, r / 2 - s * t / 2), g = Math.max(0, r / 2 - s * n / 2) + (p - h) * (n / t);
2017
- return {
2018
- scrollLeft: Math.max(0, g - d),
2019
- scrollTop: Math.max(0, n / t * m - f)
2020
- };
2021
- }
2022
- //#endregion
2023
2022
  //#region src/components/PageRenderer.tsx
2024
- function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, containerHeight: l, scrollTop: u, scrollLeft: d, pageTop: f, pageLeft: p = 0, basePageWidth: m, basePageHeight: h, activeTab: g, activeTool: _, annotations: v, selectedAnnotationId: y, activeSearchResult: b, transientHighlights: x, onMouseDown: ee, onMouseMove: S, onMouseUp: C, onAnnotationClick: te, onAnnotationMouseEnter: ne, onClearSelection: re, watermark: ie, watermarkText: w, redactions: T, onDiscardRedaction: ae, onRendered: oe }) {
2025
- let E = s(oe);
2026
- E.current = oe;
2027
- let D = s(null), O = s(null), k = s(null), se = s(null), A = s(!1), [ce, le] = c(null), ue = m * r, de = h * r;
2028
- i(() => {
2029
- A.current = !1;
2030
- }, [n, t]), i(() => {
2023
+ function xt({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, containerHeight: l, scrollTop: u, scrollLeft: d, pageTop: f, pageLeft: p = 0, basePageWidth: m, basePageHeight: h, activeTab: g, activeTool: _, annotations: v, selectedAnnotationId: y, activeSearchResult: b, transientHighlights: x, onMouseDown: ee, onMouseMove: S, onMouseUp: te, onAnnotationClick: ne, onAnnotationMouseEnter: re, onClearSelection: ie, watermark: ae, watermarkText: oe, redactions: C, onDiscardRedaction: se, onRendered: ce, hideAnnotationsUntilPageRendered: le = !0 }) {
2024
+ let w = s(ce);
2025
+ w.current = ce;
2026
+ let ue = s(null), T = s(null), E = s(null), D = s(null), O = s(!1), [k, de] = c(!1), [fe, pe] = c(null), me = m * r, he = h * r, [ge, _e] = c({
2027
+ pdfDoc: n,
2028
+ pageNum: t,
2029
+ rotation: a
2030
+ });
2031
+ (ge.pdfDoc !== n || ge.pageNum !== t || ge.rotation !== a) && (_e({
2032
+ pdfDoc: n,
2033
+ pageNum: t,
2034
+ rotation: a
2035
+ }), de(!1)), i(() => {
2036
+ O.current = !1;
2037
+ }, [
2038
+ n,
2039
+ t,
2040
+ a
2041
+ ]), i(() => {
2031
2042
  let e = !1, i = null, o = async () => {
2032
- if (!D.current || !n) return;
2033
- if (k.current) {
2043
+ if (!ue.current || !n) return;
2044
+ if (E.current) {
2034
2045
  try {
2035
- k.current.cancel();
2046
+ E.current.cancel();
2036
2047
  } catch {}
2037
- k.current = null;
2048
+ E.current = null;
2038
2049
  }
2039
2050
  let i = null;
2040
2051
  try {
@@ -2045,11 +2056,11 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2045
2056
  } catch {}
2046
2057
  return;
2047
2058
  }
2048
- i = o, se.current = o;
2049
- let s = Math.min(window.devicePixelRatio || 1, 2), c = lt(o.rotate + a), l = o.getViewport({
2059
+ i = o, D.current = o;
2060
+ let s = Math.min(window.devicePixelRatio || 1, 2), c = bt(o.rotate + a), l = o.getViewport({
2050
2061
  scale: 1,
2051
2062
  rotation: c
2052
- }), u = bt(r, s, l.width, l.height), d = o.getViewport({
2063
+ }), u = Ye(r, s, l.width, l.height), d = o.getViewport({
2053
2064
  scale: u,
2054
2065
  rotation: c
2055
2066
  }), f = document.createElement("canvas");
@@ -2067,17 +2078,17 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2067
2078
  canvas: f,
2068
2079
  viewport: d
2069
2080
  });
2070
- if (k.current = g, await g.promise, k.current = null, T && T.length > 0) {
2081
+ if (E.current = g, await g.promise, E.current = null, C && C.length > 0) {
2071
2082
  p.save(), p.setTransform(1, 0, 0, 1, 0, 0);
2072
2083
  let e = a % 180 == 0 ? m : h, n = a % 180 == 0 ? h : m;
2073
- for (let i of T) if (i.pageIndex === t) {
2074
- let t = H(i.x, i.y, i.width, i.height, a, e, n), o = t.x * u, s = t.y * u, c = t.width * u, l = t.height * u;
2084
+ for (let i of C) if (i.pageIndex === t) {
2085
+ let t = vt(i.x, i.y, i.width, i.height, a, e, n), o = t.x * u, s = t.y * u, c = t.width * u, l = t.height * u;
2075
2086
  i.status === "applied" || i.status === void 0 ? (p.fillStyle = "#000000", p.fillRect(Math.floor(o), Math.floor(s), Math.ceil(c), Math.ceil(l))) : (p.fillStyle = "rgba(0, 0, 0, 0.45)", p.fillRect(Math.floor(o), Math.floor(s), Math.ceil(c), Math.ceil(l)), p.lineWidth = Math.max(1, u / (r || 1) * 2), p.strokeStyle = "#dc2626", p.strokeRect(Math.floor(o), Math.floor(s), Math.ceil(c), Math.ceil(l)));
2076
2087
  }
2077
2088
  p.restore();
2078
2089
  }
2079
- let _ = ie || (w ? {
2080
- text: w,
2090
+ let _ = ae || (oe ? {
2091
+ text: oe,
2081
2092
  opacity: .15,
2082
2093
  size: 24,
2083
2094
  mode: "tiled",
@@ -2099,11 +2110,11 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2099
2110
  }
2100
2111
  p.restore();
2101
2112
  }
2102
- let v = D.current;
2113
+ let v = ue.current;
2103
2114
  if (v && !e) {
2104
2115
  v.width = f.width, v.height = f.height;
2105
2116
  let e = v.getContext("2d");
2106
- e && e.drawImage(f, 0, 0), A.current = !0, E.current?.(t);
2117
+ e && e.drawImage(f, 0, 0), O.current = !0, de(!0), w.current?.(t);
2107
2118
  }
2108
2119
  f.width = 0, f.height = 0;
2109
2120
  } catch (e) {
@@ -2112,21 +2123,21 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2112
2123
  if (i) try {
2113
2124
  i.cleanup?.();
2114
2125
  } catch {}
2115
- se.current === i && (se.current = null);
2126
+ D.current === i && (D.current = null);
2116
2127
  }
2117
- }, s = A.current ? 150 : 0;
2128
+ }, s = O.current ? 150 : 0;
2118
2129
  return i = setTimeout(o, s), () => {
2119
- if (e = !0, i && clearTimeout(i), k.current) {
2130
+ if (e = !0, i && clearTimeout(i), E.current) {
2120
2131
  try {
2121
- k.current.cancel();
2132
+ E.current.cancel();
2122
2133
  } catch {}
2123
- k.current = null;
2134
+ E.current = null;
2124
2135
  }
2125
- if (se.current) {
2136
+ if (D.current) {
2126
2137
  try {
2127
- se.current.cleanup?.();
2138
+ D.current.cleanup?.();
2128
2139
  } catch {}
2129
- se.current = null;
2140
+ D.current = null;
2130
2141
  }
2131
2142
  };
2132
2143
  }, [
@@ -2136,16 +2147,16 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2136
2147
  a,
2137
2148
  m,
2138
2149
  h,
2139
- ie,
2140
- w,
2141
- T
2150
+ ae,
2151
+ oe,
2152
+ C
2142
2153
  ]), i(() => {
2143
2154
  let e = !1;
2144
2155
  return (async () => {
2145
2156
  try {
2146
2157
  let r = await (await n.getPage(t)).getTextContent();
2147
- if (T && T.length > 0) {
2148
- let e = T.filter((e) => e.pageIndex === t);
2158
+ if (C && C.length > 0) {
2159
+ let e = C.filter((e) => e.pageIndex === t);
2149
2160
  e.length > 0 && (r.items = r.items.filter((t) => {
2150
2161
  if (t.str.trim() === "") return !0;
2151
2162
  let n = t.transform[4], r = t.transform[5], i = t.width, a = t.height;
@@ -2156,7 +2167,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2156
2167
  return !0;
2157
2168
  }));
2158
2169
  }
2159
- e || le(r);
2170
+ e || pe(r);
2160
2171
  } catch {}
2161
2172
  })(), () => {
2162
2173
  e = !0;
@@ -2164,19 +2175,19 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2164
2175
  }, [
2165
2176
  n,
2166
2177
  t,
2167
- T
2178
+ C
2168
2179
  ]), i(() => {
2169
- let e = O.current;
2170
- !ce || !e || (async () => {
2180
+ let e = T.current;
2181
+ !fe || !e || (async () => {
2171
2182
  try {
2172
2183
  let r = await n.getPage(t), i = r.getViewport({
2173
2184
  scale: 1,
2174
- rotation: lt(r.rotate + a)
2175
- }), o = ce;
2176
- if (T && T.length > 0) {
2177
- let e = T.filter((e) => e.pageIndex === t);
2185
+ rotation: bt(r.rotate + a)
2186
+ }), o = fe;
2187
+ if (C && C.length > 0) {
2188
+ let e = C.filter((e) => e.pageIndex === t);
2178
2189
  if (e.length > 0) {
2179
- let t = ce.items.filter((t) => {
2190
+ let t = fe.items.filter((t) => {
2180
2191
  if (!t.str || t.str.trim() === "") return !0;
2181
2192
  let n = t.transform[4], r = t.transform[5], a = t.width, o = t.height || Math.abs(t.transform[3]), s = i.height - r - o;
2182
2193
  for (let t of e) {
@@ -2186,7 +2197,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2186
2197
  return !0;
2187
2198
  });
2188
2199
  o = {
2189
- ...ce,
2200
+ ...fe,
2190
2201
  items: t
2191
2202
  };
2192
2203
  }
@@ -2201,32 +2212,32 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2201
2212
  }
2202
2213
  })();
2203
2214
  }, [
2204
- ce,
2215
+ fe,
2205
2216
  n,
2206
2217
  t,
2207
2218
  a,
2208
- T
2219
+ C
2209
2220
  ]);
2210
- let fe = v.filter((e) => e.pageIndex === t);
2221
+ let ve = v.filter((e) => e.pageIndex === t), ye = !le || k;
2211
2222
  return /* @__PURE__ */ I("div", {
2212
2223
  id: `pdf-page-${t}`,
2213
2224
  className: "pdf-page-container",
2214
2225
  onClick: () => {
2215
- _ === null && re();
2226
+ _ === null && ie();
2216
2227
  },
2217
2228
  style: {
2218
2229
  position: "absolute",
2219
2230
  top: `${f}px`,
2220
2231
  left: p === void 0 ? "0px" : `${p}px`,
2221
- width: `${ue}px`,
2222
- height: `${de}px`,
2232
+ width: `${me}px`,
2233
+ height: `${he}px`,
2223
2234
  backgroundColor: "#fff",
2224
2235
  boxShadow: "0 2px 10px rgba(0,0,0,0.1)",
2225
2236
  marginBottom: "16px"
2226
2237
  },
2227
2238
  children: [
2228
2239
  /* @__PURE__ */ F("canvas", {
2229
- ref: D,
2240
+ ref: ue,
2230
2241
  style: {
2231
2242
  position: "absolute",
2232
2243
  width: "100%",
@@ -2236,7 +2247,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2236
2247
  }
2237
2248
  }),
2238
2249
  /* @__PURE__ */ F("div", {
2239
- ref: O,
2250
+ ref: T,
2240
2251
  className: "textLayer",
2241
2252
  style: {
2242
2253
  position: "absolute",
@@ -2244,8 +2255,9 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2244
2255
  left: 0,
2245
2256
  transform: `scale(${r})`,
2246
2257
  transformOrigin: "top left",
2247
- pointerEvents: "auto",
2248
- opacity: 1,
2258
+ pointerEvents: ye ? "auto" : "none",
2259
+ opacity: +!!ye,
2260
+ visibility: ye ? "visible" : "hidden",
2249
2261
  width: `${m}px`,
2250
2262
  height: `${h}px`
2251
2263
  }
@@ -2260,12 +2272,14 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2260
2272
  width: "100%",
2261
2273
  height: "100%",
2262
2274
  pointerEvents: "none",
2263
- zIndex: 6
2275
+ zIndex: 6,
2276
+ visibility: ye ? "visible" : "hidden",
2277
+ opacity: +!!ye
2264
2278
  },
2265
2279
  children: [
2266
2280
  /* @__PURE__ */ F("style", { children: "\n @keyframes tspdf-transient-pulse {\n 0% {\n box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.75), 0 0 8px rgba(234, 179, 8, 0.4);\n }\n 50% {\n box-shadow: 0 0 0 6px rgba(234, 179, 8, 0.25), 0 0 18px rgba(234, 179, 8, 0.7);\n }\n 100% {\n box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.75), 0 0 8px rgba(234, 179, 8, 0.4);\n }\n }\n " }),
2267
2281
  b && b.pageIndex === t && b.bounds.map((e, t) => {
2268
- let o = H(e.x, i - e.y - e.height, e.width, e.height, a, n, i);
2282
+ let o = vt(e.x, i - e.y - e.height, e.width, e.height, a, n, i);
2269
2283
  return /* @__PURE__ */ F("div", { style: {
2270
2284
  position: "absolute",
2271
2285
  left: `${o.x * r}px`,
@@ -2279,7 +2293,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2279
2293
  } }, `search-${t}`);
2280
2294
  }),
2281
2295
  x && x.filter((e) => e.pageIndex === t).map((t, o) => /* @__PURE__ */ F(e.Fragment, { children: t.bounds.map((e, o) => {
2282
- let s = H(e.x, i - e.y - e.height, e.width, e.height, a, n, i), c = t.color || "rgba(250, 204, 21, 0.45)", l = t.borderColor || "rgba(234, 179, 8, 0.85)";
2296
+ let s = vt(e.x, i - e.y - e.height, e.width, e.height, a, n, i), c = t.color || "rgba(250, 204, 21, 0.45)", l = t.borderColor || "rgba(234, 179, 8, 0.85)";
2283
2297
  return /* @__PURE__ */ F("div", {
2284
2298
  style: {
2285
2299
  position: "absolute",
@@ -2320,7 +2334,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2320
2334
  });
2321
2335
  })(),
2322
2336
  (() => {
2323
- let n = ct(a, a % 180 == 0 ? m : h, a % 180 == 0 ? h : m);
2337
+ let n = yt(a, a % 180 == 0 ? m : h, a % 180 == 0 ? h : m);
2324
2338
  return /* @__PURE__ */ F("svg", {
2325
2339
  style: {
2326
2340
  position: "absolute",
@@ -2329,26 +2343,28 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2329
2343
  width: "100%",
2330
2344
  height: "100%",
2331
2345
  cursor: ["Annotate", "Shapes"].includes(g) && _ ? _ === "eraser" ? "cell" : "crosshair" : "default",
2332
- pointerEvents: _ === null || _ === "pan" ? "none" : "auto",
2333
- zIndex: 10
2346
+ pointerEvents: _ === null || _ === "pan" || !ye ? "none" : "auto",
2347
+ zIndex: 10,
2348
+ visibility: ye ? "visible" : "hidden",
2349
+ opacity: +!!ye
2334
2350
  },
2335
2351
  viewBox: `0 0 ${m} ${h}`,
2336
2352
  onMouseDown: (e) => ee(e, t),
2337
2353
  onMouseMove: (e) => S(e, t),
2338
- onMouseUp: (e) => C(e, t),
2339
- onMouseLeave: (e) => C(e, t),
2354
+ onMouseUp: (e) => te(e, t),
2355
+ onMouseLeave: (e) => te(e, t),
2340
2356
  children: /* @__PURE__ */ F("g", {
2341
2357
  transform: n,
2342
- children: /* @__PURE__ */ I(e.Fragment, { children: [fe.map((t) => {
2358
+ children: /* @__PURE__ */ I(e.Fragment, { children: [ve.map((t) => {
2343
2359
  let n = t.type === "text" || t.type === "callout" ? "transparent" : `${t.color}${Math.floor(t.opacity * 255).toString(16).padStart(2, "0")}`, r = t.color, i = y === t.id, a = (t.type === "highlight" || t.opacity < 1) && ![
2344
2360
  "text",
2345
2361
  "note",
2346
2362
  "callout",
2347
2363
  "signature"
2348
2364
  ].includes(t.type) ? "multiply" : "normal", o = {
2349
- onMouseEnter: () => ne(t.id),
2365
+ onMouseEnter: () => re(t.id),
2350
2366
  onClick: (e) => {
2351
- te(t.id, e);
2367
+ ne(t.id, e);
2352
2368
  },
2353
2369
  style: {
2354
2370
  pointerEvents: "all",
@@ -2667,10 +2683,10 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2667
2683
  strokeDasharray: "4"
2668
2684
  })]
2669
2685
  }, t.id);
2670
- }), T && T.filter((e) => e.pageIndex === t && e.status === "pending").map((e, t) => /* @__PURE__ */ I("g", {
2686
+ }), C && C.filter((e) => e.pageIndex === t && e.status === "pending").map((e, t) => /* @__PURE__ */ I("g", {
2671
2687
  style: { cursor: "pointer" },
2672
2688
  onClick: (t) => {
2673
- t.stopPropagation(), ae?.(e);
2689
+ t.stopPropagation(), se?.(e);
2674
2690
  },
2675
2691
  children: [
2676
2692
  /* @__PURE__ */ F("title", { children: "Click to discard this redaction" }),
@@ -2715,7 +2731,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
2715
2731
  ]
2716
2732
  });
2717
2733
  }
2718
- var St = e.memo(U, (e, t) => e.pageNum === t.pageNum && e.pdfDoc === t.pdfDoc && e.scale === t.scale && e.rotation === t.rotation && e.basePageWidth === t.basePageWidth && e.basePageHeight === t.basePageHeight && e.pageTop === t.pageTop && e.pageLeft === t.pageLeft && e.activeTab === t.activeTab && e.activeTool === t.activeTool && e.selectedAnnotationId === t.selectedAnnotationId && e.activeSearchResult === t.activeSearchResult && e.watermark === t.watermark && e.watermarkText === t.watermarkText && e.redactions === t.redactions && e.annotations === t.annotations && e.transientHighlights === t.transientHighlights);
2734
+ var St = e.memo(xt, (e, t) => e.pageNum === t.pageNum && e.pdfDoc === t.pdfDoc && e.scale === t.scale && e.rotation === t.rotation && e.basePageWidth === t.basePageWidth && e.basePageHeight === t.basePageHeight && e.pageTop === t.pageTop && e.pageLeft === t.pageLeft && e.activeTab === t.activeTab && e.activeTool === t.activeTool && e.selectedAnnotationId === t.selectedAnnotationId && e.activeSearchResult === t.activeSearchResult && e.watermark === t.watermark && e.watermarkText === t.watermarkText && e.redactions === t.redactions && e.annotations === t.annotations && e.transientHighlights === t.transientHighlights && e.hideAnnotationsUntilPageRendered === t.hideAnnotationsUntilPageRendered);
2719
2735
  //#endregion
2720
2736
  //#region src/annotations/ids.ts
2721
2737
  function Ct() {
@@ -2795,7 +2811,7 @@ function Dt(e, t, n, r = 16) {
2795
2811
  total: o
2796
2812
  };
2797
2813
  }
2798
- function W(e, t, n = .5) {
2814
+ function Ot(e, t, n = .5) {
2799
2815
  if (e.length !== t.length) return !0;
2800
2816
  for (let r = 0; r < e.length; r++) {
2801
2817
  let i = e[r], a = t[r];
@@ -2805,30 +2821,30 @@ function W(e, t, n = .5) {
2805
2821
  }
2806
2822
  //#endregion
2807
2823
  //#region src/core/pdfAssets.ts
2808
- var G = {};
2809
- function Ot(e) {
2810
- G = {
2811
- ...G,
2824
+ var W = {};
2825
+ function kt(e) {
2826
+ W = {
2827
+ ...W,
2812
2828
  ...e
2813
2829
  }, e.workerSrc && (L.GlobalWorkerOptions.workerSrc = e.workerSrc);
2814
2830
  }
2815
- function kt() {
2816
- return G;
2831
+ function G() {
2832
+ return W;
2833
+ }
2834
+ function K() {
2835
+ return !!(W.workerSrc || L.GlobalWorkerOptions.workerSrc);
2817
2836
  }
2818
2837
  function At() {
2819
- return !!(G.workerSrc || L.GlobalWorkerOptions.workerSrc);
2838
+ if (!K()) 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>.");
2820
2839
  }
2821
2840
  function jt() {
2822
- if (!At()) 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>.");
2823
- }
2824
- function Mt() {
2825
2841
  let e = {};
2826
- return G.cMapUrl && (e.cMapUrl = G.cMapUrl, e.cMapPacked = !0), G.standardFontDataUrl && (e.standardFontDataUrl = G.standardFontDataUrl), G.wasmUrl && (e.wasmUrl = G.wasmUrl), G.iccUrl && (e.iccUrl = G.iccUrl), e;
2842
+ return W.cMapUrl && (e.cMapUrl = W.cMapUrl, e.cMapPacked = !0), W.standardFontDataUrl && (e.standardFontDataUrl = W.standardFontDataUrl), W.wasmUrl && (e.wasmUrl = W.wasmUrl), W.iccUrl && (e.iccUrl = W.iccUrl), e;
2827
2843
  }
2828
- var Nt = L.version;
2844
+ var Mt = L.version;
2829
2845
  //#endregion
2830
2846
  //#region src/components/DiffHighlightOverlay.tsx
2831
- function Pt({ boxes: e, scale: t, colorScheme: n = "all", selectedDiffId: r, onSelectDiff: i }) {
2847
+ function Nt({ boxes: e, scale: t, colorScheme: n = "all", selectedDiffId: r, onSelectDiff: i }) {
2832
2848
  let [a, o] = c(null);
2833
2849
  if (!e || e.length === 0) return null;
2834
2850
  let s = e.filter((e) => n === "deletions" ? e.type === "deletion" || e.type === "modification" : n !== "additions" || e.type === "addition" || e.type === "modification");
@@ -2933,18 +2949,18 @@ function Pt({ boxes: e, scale: t, colorScheme: n = "all", selectedDiffId: r, onS
2933
2949
  }
2934
2950
  //#endregion
2935
2951
  //#region src/components/SideBySideViewer.tsx
2936
- function Ft({ 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 }) {
2937
- let y = s(null), b = s(null), x = s(!1);
2952
+ function Pt({ 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 }) {
2953
+ let b = s(null), x = s(null), ee = s(!1);
2938
2954
  i(() => {
2939
- let e = y.current, t = b.current;
2955
+ let e = b.current, t = x.current;
2940
2956
  if (!e || !t) return;
2941
2957
  let n = () => {
2942
- x.current || (x.current = !0, t.scrollTop = e.scrollTop, t.scrollLeft = e.scrollLeft, setTimeout(() => {
2943
- x.current = !1;
2958
+ ee.current || (ee.current = !0, t.scrollTop = e.scrollTop, t.scrollLeft = e.scrollLeft, setTimeout(() => {
2959
+ ee.current = !1;
2944
2960
  }, 10));
2945
2961
  }, r = () => {
2946
- x.current || (x.current = !0, e.scrollTop = t.scrollTop, e.scrollLeft = t.scrollLeft, setTimeout(() => {
2947
- x.current = !1;
2962
+ ee.current || (ee.current = !0, e.scrollTop = t.scrollTop, e.scrollLeft = t.scrollLeft, setTimeout(() => {
2963
+ ee.current = !1;
2948
2964
  }, 10));
2949
2965
  };
2950
2966
  return e.addEventListener("scroll", n), t.addEventListener("scroll", r), () => {
@@ -2953,9 +2969,9 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
2953
2969
  }, []), i(() => {
2954
2970
  if (!_) return;
2955
2971
  let e = [...h || [], ...g || []].find((e) => e.id === _);
2956
- if (e && y.current) {
2957
- let t = y.current.clientHeight || 600, n = e.y * r, i = Math.max(0, n - t / 3);
2958
- y.current.scrollTo({
2972
+ if (e && b.current) {
2973
+ let t = b.current.clientHeight || 600, n = e.y * r, i = Math.max(0, n - t / 3);
2974
+ b.current.scrollTo({
2959
2975
  top: i,
2960
2976
  behavior: "smooth"
2961
2977
  });
@@ -2966,14 +2982,14 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
2966
2982
  g,
2967
2983
  r
2968
2984
  ]);
2969
- let [ee, S] = c(o), [C, te] = c(o);
2985
+ let [S, te] = c(o), [ne, re] = c(o);
2970
2986
  i(() => {
2971
2987
  e && e.getPage(n).then((e) => {
2972
2988
  let t = e.getViewport({
2973
2989
  scale: 1,
2974
2990
  rotation: (e.rotate + a) % 360
2975
2991
  });
2976
- S({
2992
+ te({
2977
2993
  width: t.width,
2978
2994
  height: t.height
2979
2995
  });
@@ -2988,7 +3004,7 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
2988
3004
  scale: 1,
2989
3005
  rotation: (e.rotate + a) % 360
2990
3006
  });
2991
- te({
3007
+ re({
2992
3008
  width: t.width,
2993
3009
  height: t.height
2994
3010
  });
@@ -2998,7 +3014,7 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
2998
3014
  n,
2999
3015
  a
3000
3016
  ]);
3001
- let ne = (ee.width || 600) * r, re = (ee.height || 800) * r, ie = (C.width || 600) * r, w = (C.height || 800) * r;
3017
+ let ie = (S.width || 600) * r, ae = (S.height || 800) * r, oe = (ne.width || 600) * r, C = (ne.height || 800) * r;
3002
3018
  return /* @__PURE__ */ I("div", {
3003
3019
  style: {
3004
3020
  flex: 1,
@@ -3009,7 +3025,7 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3009
3025
  overflow: "hidden"
3010
3026
  },
3011
3027
  children: [/* @__PURE__ */ I("div", {
3012
- ref: y,
3028
+ ref: b,
3013
3029
  style: {
3014
3030
  flex: 1,
3015
3031
  height: "100%",
@@ -3035,8 +3051,8 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3035
3051
  }), /* @__PURE__ */ I("div", {
3036
3052
  style: {
3037
3053
  position: "relative",
3038
- width: `${ne}px`,
3039
- height: `${re}px`,
3054
+ width: `${ie}px`,
3055
+ height: `${ae}px`,
3040
3056
  boxShadow: "0 4px 12px rgba(0,0,0,0.15)"
3041
3057
  },
3042
3058
  children: [e && /* @__PURE__ */ F(St, {
@@ -3047,10 +3063,10 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3047
3063
  scrollTop: 0,
3048
3064
  scrollLeft: 0,
3049
3065
  pageTop: 0,
3050
- basePageWidth: ee.width,
3051
- basePageHeight: ee.height,
3052
- containerWidth: ne,
3053
- containerHeight: re,
3066
+ basePageWidth: S.width,
3067
+ basePageHeight: S.height,
3068
+ containerWidth: ie,
3069
+ containerHeight: ae,
3054
3070
  activeTab: l,
3055
3071
  activeTool: u,
3056
3072
  annotations: d,
@@ -3064,8 +3080,9 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3064
3080
  onClearSelection: () => {},
3065
3081
  watermark: f,
3066
3082
  watermarkText: p,
3067
- redactions: m
3068
- }), /* @__PURE__ */ F(Pt, {
3083
+ redactions: m,
3084
+ hideAnnotationsUntilPageRendered: y
3085
+ }), /* @__PURE__ */ F(Nt, {
3069
3086
  boxes: h,
3070
3087
  scale: r,
3071
3088
  colorScheme: "deletions",
@@ -3074,7 +3091,7 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3074
3091
  })]
3075
3092
  })]
3076
3093
  }), /* @__PURE__ */ I("div", {
3077
- ref: b,
3094
+ ref: x,
3078
3095
  style: {
3079
3096
  flex: 1,
3080
3097
  height: "100%",
@@ -3099,8 +3116,8 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3099
3116
  }), /* @__PURE__ */ I("div", {
3100
3117
  style: {
3101
3118
  position: "relative",
3102
- width: `${ie}px`,
3103
- height: `${w}px`,
3119
+ width: `${oe}px`,
3120
+ height: `${C}px`,
3104
3121
  boxShadow: "0 4px 12px rgba(0,0,0,0.15)"
3105
3122
  },
3106
3123
  children: [t && /* @__PURE__ */ F(St, {
@@ -3111,10 +3128,10 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3111
3128
  scrollTop: 0,
3112
3129
  scrollLeft: 0,
3113
3130
  pageTop: 0,
3114
- basePageWidth: C.width,
3115
- basePageHeight: C.height,
3116
- containerWidth: ie,
3117
- containerHeight: w,
3131
+ basePageWidth: ne.width,
3132
+ basePageHeight: ne.height,
3133
+ containerWidth: oe,
3134
+ containerHeight: C,
3118
3135
  activeTab: l,
3119
3136
  activeTool: u,
3120
3137
  annotations: d,
@@ -3128,8 +3145,9 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3128
3145
  onClearSelection: () => {},
3129
3146
  watermark: f,
3130
3147
  watermarkText: p,
3131
- redactions: m
3132
- }), /* @__PURE__ */ F(Pt, {
3148
+ redactions: m,
3149
+ hideAnnotationsUntilPageRendered: y
3150
+ }), /* @__PURE__ */ F(Nt, {
3133
3151
  boxes: g,
3134
3152
  scale: r,
3135
3153
  colorScheme: "additions",
@@ -3142,7 +3160,7 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
3142
3160
  }
3143
3161
  //#endregion
3144
3162
  //#region src/components/CompareToolbar.tsx
3145
- function It({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r, onPrevDiff: i, onNextDiff: a, onExit: o }) {
3163
+ function Ft({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r, onPrevDiff: i, onNextDiff: a, onExit: o }) {
3146
3164
  let { mode: s, colorA: c, colorB: l, showCurtain: u, diffItems: d, currentDiffIndex: f } = e;
3147
3165
  return /* @__PURE__ */ I("div", {
3148
3166
  style: {
@@ -3166,7 +3184,7 @@ function It({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r,
3166
3184
  fontWeight: 600,
3167
3185
  color: "#38bdf8"
3168
3186
  },
3169
- children: [/* @__PURE__ */ F(A, { size: 16 }), /* @__PURE__ */ F("span", { children: "Document Compare" })]
3187
+ children: [/* @__PURE__ */ F(D, { size: 16 }), /* @__PURE__ */ F("span", { children: "Document Compare" })]
3170
3188
  }),
3171
3189
  /* @__PURE__ */ F("div", { style: {
3172
3190
  width: "1px",
@@ -3197,7 +3215,7 @@ function It({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r,
3197
3215
  fontWeight: 500
3198
3216
  },
3199
3217
  title: "Overlay Color Blend Diff",
3200
- children: [/* @__PURE__ */ F(A, { size: 14 }), /* @__PURE__ */ F("span", { children: "Overlay Diff" })]
3218
+ children: [/* @__PURE__ */ F(D, { size: 14 }), /* @__PURE__ */ F("span", { children: "Overlay Diff" })]
3201
3219
  }),
3202
3220
  /* @__PURE__ */ I("button", {
3203
3221
  onClick: () => t("side-by-side"),
@@ -3233,11 +3251,11 @@ function It({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r,
3233
3251
  fontWeight: 500
3234
3252
  },
3235
3253
  title: "Semantic Text & Structured Diff",
3236
- children: [/* @__PURE__ */ F(oe, { size: 14 }), /* @__PURE__ */ F("span", { children: "Text Diff" })]
3254
+ children: [/* @__PURE__ */ F(ce, { size: 14 }), /* @__PURE__ */ F("span", { children: "Text Diff" })]
3237
3255
  })
3238
3256
  ]
3239
3257
  }),
3240
- s === "overlay" && /* @__PURE__ */ I(Ne, { children: [
3258
+ s === "overlay" && /* @__PURE__ */ I(P, { children: [
3241
3259
  /* @__PURE__ */ F("div", { style: {
3242
3260
  width: "1px",
3243
3261
  height: "20px",
@@ -3318,10 +3336,10 @@ function It({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r,
3318
3336
  fontSize: "12px"
3319
3337
  },
3320
3338
  title: "Toggle Wipe Curtain Slider",
3321
- children: [/* @__PURE__ */ F(ke, { size: 14 }), /* @__PURE__ */ F("span", { children: "Curtain Slider" })]
3339
+ children: [/* @__PURE__ */ F(Ae, { size: 14 }), /* @__PURE__ */ F("span", { children: "Curtain Slider" })]
3322
3340
  })
3323
3341
  ] }),
3324
- d.length > 0 && /* @__PURE__ */ I(Ne, { children: [/* @__PURE__ */ F("div", { style: {
3342
+ d.length > 0 && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", { style: {
3325
3343
  width: "1px",
3326
3344
  height: "20px",
3327
3345
  backgroundColor: "#475569"
@@ -3391,14 +3409,14 @@ function It({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r,
3391
3409
  fontWeight: 600
3392
3410
  },
3393
3411
  title: "Exit Compare Mode",
3394
- children: [/* @__PURE__ */ F(P, { size: 14 }), /* @__PURE__ */ F("span", { children: "Exit Compare" })]
3412
+ children: [/* @__PURE__ */ F(N, { size: 14 }), /* @__PURE__ */ F("span", { children: "Exit Compare" })]
3395
3413
  })
3396
3414
  ]
3397
3415
  });
3398
3416
  }
3399
3417
  //#endregion
3400
3418
  //#region src/components/DiffSummarySidebar.tsx
3401
- function Lt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSelectDiff: i, onJumpToPage: a }) {
3419
+ function It({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSelectDiff: i, onJumpToPage: a }) {
3402
3420
  return e ? /* @__PURE__ */ I("div", {
3403
3421
  style: {
3404
3422
  width: "320px",
@@ -3428,7 +3446,7 @@ function Lt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSele
3428
3446
  fontSize: "14px",
3429
3447
  color: "#0f172a"
3430
3448
  },
3431
- children: [/* @__PURE__ */ F(A, {
3449
+ children: [/* @__PURE__ */ F(D, {
3432
3450
  size: 18,
3433
3451
  color: "#0284c7"
3434
3452
  }), /* @__PURE__ */ F("span", { children: "Compare Summary" })]
@@ -3460,7 +3478,7 @@ function Lt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSele
3460
3478
  alignItems: "center",
3461
3479
  gap: "4px"
3462
3480
  },
3463
- children: [/* @__PURE__ */ F(A, { size: 14 }), /* @__PURE__ */ I("span", { children: [
3481
+ children: [/* @__PURE__ */ F(D, { size: 14 }), /* @__PURE__ */ I("span", { children: [
3464
3482
  "Differences on Page (",
3465
3483
  t.length,
3466
3484
  ")"
@@ -3497,11 +3515,11 @@ function Lt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSele
3497
3515
  gap: "6px"
3498
3516
  },
3499
3517
  children: [
3500
- o && /* @__PURE__ */ F(_e, {
3518
+ o && /* @__PURE__ */ F(ve, {
3501
3519
  size: 13,
3502
3520
  color: "#e11d48"
3503
3521
  }),
3504
- s && /* @__PURE__ */ F(xe, {
3522
+ s && /* @__PURE__ */ F(Ce, {
3505
3523
  size: 13,
3506
3524
  color: "#10b981"
3507
3525
  }),
@@ -3554,7 +3572,7 @@ function Lt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSele
3554
3572
  alignItems: "center",
3555
3573
  gap: "4px"
3556
3574
  },
3557
- children: [/* @__PURE__ */ F(oe, { size: 14 }), /* @__PURE__ */ F("span", { children: "Text Differences" })]
3575
+ children: [/* @__PURE__ */ F(ce, { size: 14 }), /* @__PURE__ */ F("span", { children: "Text Differences" })]
3558
3576
  }), n.filter((e) => e.type !== "equal").map((e, t) => /* @__PURE__ */ I("div", {
3559
3577
  onClick: () => a(e.pageIndex),
3560
3578
  style: {
@@ -3629,7 +3647,7 @@ function Lt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSele
3629
3647
  }
3630
3648
  //#endregion
3631
3649
  //#region src/components/CompareCurtainSlider.tsx
3632
- function Rt({ positionPercent: e, onChangePosition: t, containerRef: n }) {
3650
+ function Lt({ positionPercent: e, onChangePosition: t, containerRef: n }) {
3633
3651
  let [r, a] = c(!1), o = s(null);
3634
3652
  return i(() => {
3635
3653
  let e = (e) => {
@@ -3680,13 +3698,13 @@ function Rt({ positionPercent: e, onChangePosition: t, containerRef: n }) {
3680
3698
  boxShadow: "0 2px 8px rgba(0,0,0,0.3)",
3681
3699
  cursor: "ew-resize"
3682
3700
  },
3683
- children: /* @__PURE__ */ F(D, { size: 16 })
3701
+ children: /* @__PURE__ */ F(w, { size: 16 })
3684
3702
  })
3685
3703
  });
3686
3704
  }
3687
3705
  //#endregion
3688
3706
  //#region src/utils/pdfDiffEngine.ts
3689
- async function zt(e) {
3707
+ async function Rt(e) {
3690
3708
  let t = e.getViewport({
3691
3709
  scale: 1,
3692
3710
  rotation: e.rotate
@@ -3709,8 +3727,8 @@ async function zt(e) {
3709
3727
  }
3710
3728
  return r;
3711
3729
  }
3712
- async function Bt(e, t, n) {
3713
- let [r, i] = await Promise.all([e.getPage(n), t.getPage(Math.min(n, t.numPages))]), [a, o] = await Promise.all([zt(r), zt(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);
3730
+ async function zt(e, t, n) {
3731
+ let [r, i] = await Promise.all([e.getPage(n), t.getPage(Math.min(n, t.numPages))]), [a, o] = await Promise.all([Rt(r), Rt(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);
3714
3732
  f[1] = 0;
3715
3733
  let p = [];
3716
3734
  for (let e = 0; e <= d; e++) {
@@ -3733,7 +3751,7 @@ async function Bt(e, t, n) {
3733
3751
  e > 0 && (m === i ? (_.push(h - 1), h--) : h === a && (g.push(m - 1), m--));
3734
3752
  }
3735
3753
  g.reverse(), _.reverse();
3736
- let v = Vt(g.map((e) => a[e]), n, "deletion"), y = Vt(_.map((e) => o[e]), n, "addition"), b = [];
3754
+ let v = Bt(g.map((e) => a[e]), n, "deletion"), y = Bt(_.map((e) => o[e]), n, "addition"), b = [];
3737
3755
  for (let e of v) b.push({
3738
3756
  id: e.id,
3739
3757
  pageIndex: n,
@@ -3760,16 +3778,16 @@ async function Bt(e, t, n) {
3760
3778
  summary: b
3761
3779
  };
3762
3780
  }
3763
- function Vt(e, t, n) {
3781
+ function Bt(e, t, n) {
3764
3782
  if (e.length === 0) return [];
3765
3783
  let r = [], i = [e[0]];
3766
3784
  for (let a = 1; a < e.length; a++) {
3767
3785
  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;
3768
- c && l ? i.push(s) : (r.push(Ht(i, t, n, r.length + 1)), i = [s]);
3786
+ c && l ? i.push(s) : (r.push(Vt(i, t, n, r.length + 1)), i = [s]);
3769
3787
  }
3770
- return i.length > 0 && r.push(Ht(i, t, n, r.length + 1)), r;
3788
+ return i.length > 0 && r.push(Vt(i, t, n, r.length + 1)), r;
3771
3789
  }
3772
- function Ht(e, t, n, r) {
3790
+ function Vt(e, t, n, r) {
3773
3791
  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(" ");
3774
3792
  return {
3775
3793
  id: `diff-box-${t}-${n}-${r}-${Math.round(i)}-${Math.round(a)}`,
@@ -3782,7 +3800,7 @@ function Ht(e, t, n, r) {
3782
3800
  height: s - a + 2
3783
3801
  };
3784
3802
  }
3785
- function Ut(e, t, n) {
3803
+ function Ht(e, t, n) {
3786
3804
  let r = e.split(/(\s+)/), i = t.split(/(\s+)/), a = r.length, o = i.length, s = a + o, c = new Int32Array(2 * s + 1);
3787
3805
  c[1] = 0;
3788
3806
  let l = [];
@@ -3793,7 +3811,7 @@ function Ut(e, t, n) {
3793
3811
  u = t === -e || t !== e && c[t - 1 + s] < c[t + 1 + s] ? c[t + 1 + s] : c[t - 1 + s] + 1;
3794
3812
  let d = u - t;
3795
3813
  for (; u < a && d < o && r[u] === i[d];) u++, d++;
3796
- if (c[t + s] = u, u >= a && d >= o) return Wt(l, r, i, n);
3814
+ if (c[t + s] = u, u >= a && d >= o) return Ut(l, r, i, n);
3797
3815
  }
3798
3816
  }
3799
3817
  return [{
@@ -3806,7 +3824,7 @@ function Ut(e, t, n) {
3806
3824
  pageIndex: n
3807
3825
  }];
3808
3826
  }
3809
- function Wt(e, t, n, r) {
3827
+ function Ut(e, t, n, r) {
3810
3828
  let i = t.length, a = n.length, o = t.length + n.length, s = [];
3811
3829
  for (let r = e.length - 1; r >= 0; r--) {
3812
3830
  let c = e[r], l = i - a, u;
@@ -3832,10 +3850,10 @@ function Wt(e, t, n, r) {
3832
3850
  });
3833
3851
  return c;
3834
3852
  }
3835
- function Gt(e, t, n, r, i = .75) {
3853
+ function Wt(e, t, n, r, i = .75) {
3836
3854
  e.save(), e.globalCompositeOperation = "source-atop", e.fillStyle = r, e.globalAlpha = i, e.fillRect(0, 0, t, n), e.restore();
3837
3855
  }
3838
- function Kt(e, t, n, r) {
3856
+ function Gt(e, t, n, r) {
3839
3857
  let i = Math.min(e.width, t.width), a = Math.min(e.height, t.height);
3840
3858
  if (i === 0 || a === 0) return [];
3841
3859
  let o = e.getContext("2d"), s = t.getContext("2d");
@@ -3862,8 +3880,8 @@ function Kt(e, t, n, r) {
3862
3880
  }
3863
3881
  //#endregion
3864
3882
  //#region src/components/DocumentViewer.tsx
3865
- function qt({ 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: S, setScale: C, sidebarTab: te, setSidebarTab: ne, onAnnotationsChange: ie, onRedactionsChange: T, onDocumentLoaded: ae, onLoadError: oe, onFirstPageRendered: E, onPageChange: D, pageTransition: O, pageLayout: se, rotation: A, setRotation: le, watermark: ue, watermarkText: de, enableAnnotations: fe, initialPage: pe, page: me, transientHighlights: _e, permissions: ve }) {
3866
- let j = s(null), ye = Le(), [M, xe] = c(null), [Se, Ce] = c(null), [N, we] = c(1), [Te, Ee] = c([]), { getCommand: De } = Qe(), [ke, P] = c(null), [R, z] = c({
3883
+ function Kt({ 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: S, setScale: te, sidebarTab: ne, setSidebarTab: re, onAnnotationsChange: ae, onRedactionsChange: C, onDocumentLoaded: se, onLoadError: ce, onFirstPageRendered: le, onPageRendered: w, onPageChange: ue, pageTransition: E, pageLayout: D, rotation: k, setRotation: de, watermark: fe, watermarkText: pe, enableAnnotations: me, initialPage: he, page: ve, transientHighlights: ye, permissions: be, hideAnnotationsUntilPageRendered: xe = !0 }) {
3884
+ let A = s(null), Ce = Le(), [j, we] = c(null), [Te, Ee] = c(null), [M, De] = c(1), [Oe, Ae] = c([]), { getCommand: N } = ct(), [Pe, Fe] = c(null), [R, z] = c({
3867
3885
  isActive: !1,
3868
3886
  mode: "overlay",
3869
3887
  colorA: "#e11d48",
@@ -3875,39 +3893,41 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
3875
3893
  curtainPosition: 50,
3876
3894
  diffItems: [],
3877
3895
  currentDiffIndex: 0
3878
- }), [Pe, Fe] = c([]), [B, Ie] = c(!1), ze = s({
3879
- onRedactionsChange: T,
3880
- onDocumentLoaded: ae,
3881
- onLoadError: oe,
3882
- onFirstPageRendered: E,
3883
- onPageChange: D
3896
+ }), [B, Ie] = c([]), [ze, Be] = c(!1), Ve = s({
3897
+ onRedactionsChange: C,
3898
+ onDocumentLoaded: se,
3899
+ onLoadError: ce,
3900
+ onFirstPageRendered: le,
3901
+ onPageRendered: w,
3902
+ onPageChange: ue
3884
3903
  });
3885
- ze.current = {
3886
- onRedactionsChange: T,
3887
- onDocumentLoaded: ae,
3888
- onLoadError: oe,
3889
- onFirstPageRendered: E,
3890
- onPageChange: D
3904
+ Ve.current = {
3905
+ onRedactionsChange: C,
3906
+ onDocumentLoaded: se,
3907
+ onLoadError: ce,
3908
+ onFirstPageRendered: le,
3909
+ onPageRendered: w,
3910
+ onPageChange: ue
3891
3911
  };
3892
- let Be = s(g);
3893
- Be.current = g;
3894
- let Ve = n(async (e) => {
3912
+ let He = s(g);
3913
+ He.current = g;
3914
+ let Ue = n(async (e) => {
3895
3915
  try {
3896
- jt(), Be.current && Ot(Be.current);
3916
+ At(), He.current && kt(He.current);
3897
3917
  let t = typeof e == "string" ? { url: e } : { data: e };
3898
- h && (t.withCredentials = !0), Object.assign(t, Mt());
3918
+ h && (t.withCredentials = !0), Object.assign(t, jt());
3899
3919
  let n = await L.getDocument(t).promise;
3900
- xe(n), ze.current.onDocumentLoaded?.(n, typeof e == "string" ? e : "documentA.pdf");
3920
+ we(n), Ve.current.onDocumentLoaded?.(n, typeof e == "string" ? e : "documentA.pdf");
3901
3921
  } catch (e) {
3902
3922
  console.error("Failed to load comparison document A:", e);
3903
3923
  }
3904
- }, [h]), V = n(async (e) => {
3924
+ }, [h]), We = n(async (e) => {
3905
3925
  try {
3906
- jt(), Be.current && Ot(Be.current);
3926
+ At(), He.current && kt(He.current);
3907
3927
  let t = typeof e == "string" ? { url: e } : { data: e };
3908
- h && (t.withCredentials = !0), Object.assign(t, Mt());
3928
+ h && (t.withCredentials = !0), Object.assign(t, jt());
3909
3929
  let n = await L.getDocument(t).promise;
3910
- P(n), z((e) => ({
3930
+ Fe(n), z((e) => ({
3911
3931
  ...e,
3912
3932
  isActive: !0,
3913
3933
  diffItems: [{
@@ -3916,19 +3936,19 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
3916
3936
  type: "modification",
3917
3937
  description: "Page 1 Differences detected"
3918
3938
  }]
3919
- })), Ie(!0);
3939
+ })), Be(!0);
3920
3940
  } catch (e) {
3921
3941
  console.error("Failed to load comparison document B:", e);
3922
3942
  }
3923
3943
  }, [h]);
3924
3944
  i(() => {
3925
- if (R.isActive && M && ke) {
3945
+ if (R.isActive && j && Pe) {
3926
3946
  let e = !1;
3927
3947
  return (async () => {
3928
3948
  try {
3929
- let t = Math.min(M.numPages, ke.numPages), n = [], r = {}, i = {};
3949
+ let t = Math.min(j.numPages, Pe.numPages), n = [], r = {}, i = {};
3930
3950
  for (let a = 1; a <= t; a++) {
3931
- let { diffsA: t, diffsB: o, summary: s } = await Bt(M, ke, a);
3951
+ let { diffsA: t, diffsB: o, summary: s } = await zt(j, Pe, a);
3932
3952
  if (e) return;
3933
3953
  r[a] = t, i[a] = o, n = n.concat(s);
3934
3954
  }
@@ -3938,8 +3958,8 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
3938
3958
  pageDiffsA: r,
3939
3959
  pageDiffsB: i
3940
3960
  }));
3941
- let a = await M.getPage(N), o = await ke.getPage(Math.min(N, ke.numPages)), s = await a.getTextContent(), c = await o.getTextContent(), l = Ut(s.items.map((e) => e.str).join(" "), c.items.map((e) => e.str).join(" "), N);
3942
- e || Fe(l);
3961
+ let a = await j.getPage(M), o = await Pe.getPage(Math.min(M, Pe.numPages)), s = await a.getTextContent(), c = await o.getTextContent(), l = Ht(s.items.map((e) => e.str).join(" "), c.items.map((e) => e.str).join(" "), M);
3962
+ e || Ie(l);
3943
3963
  } catch (e) {
3944
3964
  console.error("Error computing document diffs:", e);
3945
3965
  }
@@ -3949,9 +3969,9 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
3949
3969
  }
3950
3970
  }, [
3951
3971
  R.isActive,
3952
- M,
3953
- ke,
3954
- N
3972
+ j,
3973
+ Pe,
3974
+ M
3955
3975
  ]), i(() => {
3956
3976
  let e = (e) => {
3957
3977
  let { docA: t, docB: n, options: r } = e || {};
@@ -3963,12 +3983,12 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
3963
3983
  opacityA: r.opacityA || e.opacityA,
3964
3984
  opacityB: r.opacityB || e.opacityB,
3965
3985
  blendMode: r.blendMode || e.blendMode
3966
- })), t && Ve(t), n && V(n);
3986
+ })), t && Ue(t), n && We(n);
3967
3987
  }, t = () => {
3968
3988
  z((e) => ({
3969
3989
  ...e,
3970
3990
  isActive: !1
3971
- })), P(null), Fe([]);
3991
+ })), Fe(null), Ie([]);
3972
3992
  }, n = (e) => {
3973
3993
  e && z((t) => ({
3974
3994
  ...t,
@@ -3980,46 +4000,46 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
3980
4000
  colorA: e,
3981
4001
  colorB: t
3982
4002
  }));
3983
- }, i = ye.on("action-start-compare", e), a = ye.on("action-stop-compare", t), o = ye.on("action-set-compare-mode", (e) => e && n(e.mode)), s = ye.on("action-set-compare-colors", (e) => e && r(e.colorA, e.colorB)), c = (t) => e(t.detail), l = () => t(), u = (e) => n(e.detail?.mode), d = (e) => r(e.detail?.colorA, e.detail?.colorB);
4003
+ }, i = Ce.on("action-start-compare", e), a = Ce.on("action-stop-compare", t), o = Ce.on("action-set-compare-mode", (e) => e && n(e.mode)), s = Ce.on("action-set-compare-colors", (e) => e && r(e.colorA, e.colorB)), c = (t) => e(t.detail), l = () => t(), u = (e) => n(e.detail?.mode), d = (e) => r(e.detail?.colorA, e.detail?.colorB);
3984
4004
  return window.addEventListener("action-start-compare", c), window.addEventListener("action-stop-compare", l), window.addEventListener("action-set-compare-mode", u), window.addEventListener("action-set-compare-colors", d), () => {
3985
4005
  i(), a(), o(), s(), window.removeEventListener("action-start-compare", c), window.removeEventListener("action-stop-compare", l), window.removeEventListener("action-set-compare-mode", u), window.removeEventListener("action-set-compare-colors", d);
3986
4006
  };
3987
4007
  }, [
3988
- ye,
3989
- Ve,
3990
- V
4008
+ Ce,
4009
+ Ue,
4010
+ We
3991
4011
  ]);
3992
- let [Ue, Ge] = c(null), [Ke, qe] = c([]), Je = Ke[0] ?? Tt, Ye = n((e) => Ke[e - 1] ?? Je, [
3993
- Ke,
3994
- Je.width,
3995
- Je.height
3996
- ]), [Xe, Ze] = c({
4012
+ let [Ge, Ke] = c(null), [qe, Ye] = c([]), Ze = qe[0] ?? Tt, Qe = n((e) => qe[e - 1] ?? Ze, [
4013
+ qe,
4014
+ Ze.width,
4015
+ Ze.height
4016
+ ]), [$e, V] = c({
3997
4017
  top: 0,
3998
4018
  left: 0
3999
- }), [$e, tt] = c(!1), it = s(null), H = o(() => {
4019
+ }), [tt, rt] = c(!1), it = s(null), H = o(() => {
4000
4020
  let e = [];
4001
- if (!M) return e;
4002
- if (se === "single") for (let t = 1; t <= M.numPages; t++) e.push([t]);
4003
- else if (se === "double") for (let t = 1; t <= M.numPages; t += 2) e.push([t, t + 1].filter((e) => e <= M.numPages));
4004
- else if (se === "cover-facing") {
4021
+ if (!j) return e;
4022
+ if (D === "single") for (let t = 1; t <= j.numPages; t++) e.push([t]);
4023
+ else if (D === "double") for (let t = 1; t <= j.numPages; t += 2) e.push([t, t + 1].filter((e) => e <= j.numPages));
4024
+ else if (D === "cover-facing") {
4005
4025
  e.push([1]);
4006
- for (let t = 2; t <= M.numPages; t += 2) e.push([t, t + 1].filter((e) => e <= M.numPages));
4026
+ for (let t = 2; t <= j.numPages; t += 2) e.push([t, t + 1].filter((e) => e <= j.numPages));
4007
4027
  }
4008
4028
  return e;
4009
- }, [M, se]), ct = o(() => Dt(H, Ye, S, 16), [
4029
+ }, [j, D]), U = o(() => Dt(H, Qe, S, 16), [
4010
4030
  H,
4011
4031
  S,
4012
- Ye
4013
- ]), ut = s(H);
4014
- ut.current = H;
4015
- let dt = s(S);
4016
- dt.current = S;
4017
- let ft = s(ct);
4018
- ft.current = ct;
4019
- let pt = s(O);
4020
- pt.current = O;
4021
- let mt = s(0), ht = n((e) => H.findIndex((t) => t.includes(e)), [H]), gt = n((e) => {
4022
- let t = ct.tops;
4032
+ Qe
4033
+ ]), at = s(H);
4034
+ at.current = H;
4035
+ let ot = s(S);
4036
+ ot.current = S;
4037
+ let st = s(U);
4038
+ st.current = U;
4039
+ let lt = s(E);
4040
+ lt.current = E;
4041
+ let dt = s(0), mt = n((e) => H.findIndex((t) => t.includes(e)), [H]), vt = n((e) => {
4042
+ let t = U.tops;
4023
4043
  if (t.length === 0) return 0;
4024
4044
  let n = 0, r = t.length - 1;
4025
4045
  for (; n < r;) {
@@ -4027,40 +4047,40 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4027
4047
  t[i] <= e ? n = i : r = i - 1;
4028
4048
  }
4029
4049
  return n;
4030
- }, [ct]), _t = n((e, t = {}) => {
4031
- let n = M ? Math.max(1, Math.min(e, M.numPages)) : Math.max(1, e);
4032
- we(n);
4033
- let r = ht(n);
4034
- r >= 0 && j.current && (t.smooth ? j.current.scrollTo({
4035
- top: ct.tops[r],
4050
+ }, [U]), yt = n((e, t = {}) => {
4051
+ let n = j ? Math.max(1, Math.min(e, j.numPages)) : Math.max(1, e);
4052
+ De(n);
4053
+ let r = mt(n);
4054
+ r >= 0 && A.current && (t.smooth ? A.current.scrollTo({
4055
+ top: U.tops[r],
4036
4056
  behavior: "smooth"
4037
- }) : j.current.scrollTop = ct.tops[r]);
4057
+ }) : A.current.scrollTop = U.tops[r]);
4038
4058
  }, [
4039
- M,
4040
- ht,
4041
- ct
4059
+ j,
4060
+ mt,
4061
+ U
4042
4062
  ]);
4043
4063
  i(() => {
4044
4064
  let e = (e) => {
4045
- e?.page && _t(e.page, { smooth: e.smooth ?? !0 });
4046
- }, t = ye.on("action-go-to-page", (t) => e(t)), n = (t) => e(t.detail);
4065
+ e?.page && yt(e.page, { smooth: e.smooth ?? !0 });
4066
+ }, t = Ce.on("action-go-to-page", (t) => e(t)), n = (t) => e(t.detail);
4047
4067
  return window.addEventListener("action-go-to-page", n), () => {
4048
4068
  t(), window.removeEventListener("action-go-to-page", n);
4049
4069
  };
4050
- }, [ye, _t]);
4051
- let vt = (e) => {
4052
- we(e.pageIndex), Ge(e), _t(e.pageIndex);
4053
- }, bt = n((e, t) => {
4070
+ }, [Ce, yt]);
4071
+ let xt = (e) => {
4072
+ De(e.pageIndex), Ke(e), yt(e.pageIndex);
4073
+ }, Ot = n((e, t) => {
4054
4074
  let n = t || R.diffItems[e];
4055
4075
  if (z((t) => ({
4056
4076
  ...t,
4057
4077
  currentDiffIndex: e
4058
4078
  })), !n) return;
4059
- n.pageIndex && n.pageIndex !== N && we(n.pageIndex);
4079
+ n.pageIndex && n.pageIndex !== M && De(n.pageIndex);
4060
4080
  let r = (n.y ?? 0) * S, i = (n.x ?? 0) * S;
4061
- if (j.current) {
4062
- let e = n.pageIndex || N, t = ht(e), a = O === "continuous" && t >= 0 ? ct.tops[t] ?? 0 : 0, o = j.current.clientHeight || 600, s = j.current.clientWidth || 800, c = Math.max(0, a + r - o / 3), l = Math.max(0, i - s / 4);
4063
- j.current.scrollTo({
4081
+ if (A.current) {
4082
+ let e = n.pageIndex || M, t = mt(e), a = E === "continuous" && t >= 0 ? U.tops[t] ?? 0 : 0, o = A.current.clientHeight || 600, s = A.current.clientWidth || 800, c = Math.max(0, a + r - o / 3), l = Math.max(0, i - s / 4);
4083
+ A.current.scrollTo({
4064
4084
  top: c,
4065
4085
  left: l,
4066
4086
  behavior: "smooth"
@@ -4068,68 +4088,68 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4068
4088
  }
4069
4089
  }, [
4070
4090
  R.diffItems,
4071
- N,
4091
+ M,
4072
4092
  S,
4073
- O,
4074
- ht,
4075
- ct.tops
4076
- ]), U = l(u.subscribe, u.getSnapshot, u.getSnapshot), [W, G] = c("pan");
4093
+ E,
4094
+ mt,
4095
+ U.tops
4096
+ ]), W = l(u.subscribe, u.getSnapshot, u.getSnapshot), [G, K] = c("pan");
4077
4097
  i(() => {
4078
- a === "Annotate" ? (G("highlight"), At("#fbc02d"), Ht(.5), zt(16)) : a === "Shapes" ? (G("rectangle"), Ht(1), zt(2)) : a === "Fill and Sign" ? G("signature") : a === "View" && G("pan");
4098
+ a === "Annotate" ? (K("highlight"), Rt("#fbc02d"), Wt(.5), Vt(16)) : a === "Shapes" ? (K("rectangle"), Wt(1), Vt(2)) : a === "Fill and Sign" ? K("signature") : a === "View" && K("pan");
4079
4099
  }, [a]), i(() => {
4080
- ye.emit("action-tool-changed", { tool: W });
4081
- }, [W, ye]);
4082
- let [kt, At] = c("#d32f2f"), [Nt, zt] = c(2), [Vt, Ht] = c(.8), [Wt, Gt] = c(!1), [Kt, qt] = c(null), [K, Yt] = c({
4100
+ Ce.emit("action-tool-changed", { tool: G });
4101
+ }, [G, Ce]);
4102
+ let [Mt, Rt] = c("#d32f2f"), [Bt, Vt] = c(2), [Ut, Wt] = c(.8), [Gt, Kt] = c(!1), [Jt, Yt] = c(null), [q, Xt] = c({
4083
4103
  x: 0,
4084
4104
  y: 0
4085
- }), [q, Xt] = c({
4105
+ }), [J, Zt] = c({
4086
4106
  x: 0,
4087
4107
  y: 0
4088
- }), [Zt, Qt] = c([]), [J, $t] = c(null), [en, tn] = c(""), nn = s(null), [Y, X] = c(null), [rn, an] = c(null), [on, sn] = c(!1), cn = s(!1), Z = s(null);
4089
- Re("action-set-tool", (e) => G(e?.tool ?? null));
4090
- let ln = s({
4108
+ }), [Qt, $t] = c([]), [Y, en] = c(null), [tn, nn] = c(""), rn = s(null), [X, an] = c(null), [on, sn] = c(null), [cn, Z] = c(!1), ln = s(!1), un = s(null);
4109
+ Re("action-set-tool", (e) => K(e?.tool ?? null));
4110
+ let dn = s({
4091
4111
  vx: null,
4092
4112
  vy: null
4093
- }), un = s(S), dn = s(!1), fn = s(!1);
4113
+ }), fn = s(S), pn = s(!1), mn = s(!1);
4094
4114
  i(() => {
4095
- fn.current = !1;
4096
- }, [M]), i(() => {
4097
- if (un.current !== S) {
4098
- let e = un.current, t = S;
4099
- un.current = S;
4100
- let n = j.current;
4115
+ mn.current = !1;
4116
+ }, [j]), i(() => {
4117
+ if (fn.current !== S) {
4118
+ let e = fn.current, t = S;
4119
+ fn.current = S;
4120
+ let n = A.current;
4101
4121
  if (!n) return;
4102
- let r = dn.current || !fn.current || On.current !== M;
4103
- fn.current = !0, dn.current = !1;
4104
- let i = xt({
4122
+ let r = pn.current || !mn.current || An.current !== j;
4123
+ mn.current = !0, pn.current = !1;
4124
+ let i = Xe({
4105
4125
  prevScale: e,
4106
4126
  newScale: t,
4107
4127
  containerWidth: n.clientWidth,
4108
4128
  containerHeight: n.clientHeight,
4109
4129
  currentScrollLeft: n.scrollLeft,
4110
4130
  currentScrollTop: n.scrollTop,
4111
- basePageWidth: Ye(N).width,
4112
- focusPoint: ln.current,
4131
+ basePageWidth: Qe(M).width,
4132
+ focusPoint: dn.current,
4113
4133
  isProgrammatic: r
4114
4134
  });
4115
- if (ln.current = {
4135
+ if (dn.current = {
4116
4136
  vx: null,
4117
4137
  vy: null
4118
- }, r && N > 1 && O === "continuous") {
4119
- let e = ht(N);
4120
- e >= 0 && (n.scrollTop = ct.tops[e] ?? 0), n.scrollLeft = 0;
4138
+ }, r && M > 1 && E === "continuous") {
4139
+ let e = mt(M);
4140
+ e >= 0 && (n.scrollTop = U.tops[e] ?? 0), n.scrollLeft = 0;
4121
4141
  } else n.scrollLeft = i.scrollLeft, n.scrollTop = i.scrollTop;
4122
4142
  }
4123
4143
  }, [S]), i(() => {
4124
- let e = j.current;
4144
+ let e = A.current;
4125
4145
  if (!e) return;
4126
4146
  let t = (t) => {
4127
4147
  if (t.metaKey || t.ctrlKey) {
4128
4148
  t.preventDefault();
4129
4149
  let n = e.getBoundingClientRect(), r = t.clientX, i = t.clientY, a = Math.exp(-t.deltaY * .002);
4130
- C((e) => {
4131
- let t = yt(e * a);
4132
- return t !== e && (ln.current = {
4150
+ te((e) => {
4151
+ let t = Je(e * a);
4152
+ return t !== e && (dn.current = {
4133
4153
  vx: r - n.left,
4134
4154
  vy: i - n.top
4135
4155
  }), t;
@@ -4137,56 +4157,56 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4137
4157
  }
4138
4158
  };
4139
4159
  return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
4140
- }, [C]);
4160
+ }, [te]);
4141
4161
  let Q = n((e) => {
4142
4162
  u.commit(e);
4143
4163
  }, [u]);
4144
4164
  Re("action-commit-digital-signature-local", (e) => {
4145
- e?.tempAnn && Q([...U, e.tempAnn]);
4165
+ e?.tempAnn && Q([...W, e.tempAnn]);
4146
4166
  });
4147
- let pn = n(() => {
4167
+ let hn = n(() => {
4148
4168
  u.undo();
4149
- }, [u]), mn = n(() => {
4169
+ }, [u]), gn = n(() => {
4150
4170
  u.redo();
4151
4171
  }, [u]);
4152
4172
  Re("viewer-keydown", (e) => {
4153
4173
  let t = document.activeElement?.tagName === "TEXTAREA" || document.activeElement?.tagName === "INPUT";
4154
- if (et(e, De("ROTATE_CW"))) {
4155
- e.preventDefault(), le((e) => (e + 90) % 360);
4174
+ if (ut(e, N("ROTATE_CW"))) {
4175
+ e.preventDefault(), de((e) => (e + 90) % 360);
4156
4176
  return;
4157
4177
  }
4158
- if (et(e, De("ROTATE_CCW"))) {
4159
- e.preventDefault(), le((e) => (e - 90) % 360);
4178
+ if (ut(e, N("ROTATE_CCW"))) {
4179
+ e.preventDefault(), de((e) => (e - 90) % 360);
4160
4180
  return;
4161
4181
  }
4162
- if (et(e, De("UNDO"))) {
4163
- e.preventDefault(), pn();
4182
+ if (ut(e, N("UNDO"))) {
4183
+ e.preventDefault(), hn();
4164
4184
  return;
4165
4185
  }
4166
- if (et(e, De("REDO"))) {
4167
- e.preventDefault(), mn();
4186
+ if (ut(e, N("REDO"))) {
4187
+ e.preventDefault(), gn();
4168
4188
  return;
4169
4189
  }
4170
- if (et(e, De("SEARCH"))) {
4171
- e.preventDefault(), ye.emit("action-open-search");
4190
+ if (ut(e, N("SEARCH"))) {
4191
+ e.preventDefault(), Ce.emit("action-open-search");
4172
4192
  return;
4173
4193
  }
4174
- if (et(e, De("FILE_PICKER"))) {
4175
- e.preventDefault(), ye.emit("action-open-file-picker");
4194
+ if (ut(e, N("FILE_PICKER"))) {
4195
+ e.preventDefault(), Ce.emit("action-open-file-picker");
4176
4196
  return;
4177
4197
  }
4178
- if (!t && !J) {
4179
- if (et(e, De("COPY")) && Y) {
4180
- let t = U.find((e) => e.id === Y);
4181
- t && (e.preventDefault(), Z.current = t);
4198
+ if (!t && !Y) {
4199
+ if (ut(e, N("COPY")) && X) {
4200
+ let t = W.find((e) => e.id === X);
4201
+ t && (e.preventDefault(), un.current = t);
4182
4202
  return;
4183
4203
  }
4184
- if (et(e, De("PASTE")) && Z.current) {
4204
+ if (ut(e, N("PASTE")) && un.current) {
4185
4205
  e.preventDefault();
4186
- let t = Z.current, n = {
4206
+ let t = un.current, n = {
4187
4207
  ...t,
4188
4208
  id: Ct(),
4189
- pageIndex: N,
4209
+ pageIndex: M,
4190
4210
  x: t.x + 20,
4191
4211
  y: t.y + 20,
4192
4212
  author: void 0,
@@ -4196,63 +4216,63 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4196
4216
  readOnly: void 0,
4197
4217
  xfdfExtras: void 0
4198
4218
  };
4199
- Q([...U, n]), X(n.id);
4219
+ Q([...W, n]), an(n.id);
4200
4220
  return;
4201
4221
  }
4202
- if (et(e, De("DELETE")) && Y) {
4203
- e.preventDefault(), Q(U.filter((e) => e.id !== Y)), X(null);
4222
+ if (ut(e, N("DELETE")) && X) {
4223
+ e.preventDefault(), Q(W.filter((e) => e.id !== X)), an(null);
4204
4224
  return;
4205
4225
  }
4206
4226
  }
4207
4227
  }), i(() => {
4208
- J && nn.current && setTimeout(() => {
4209
- nn.current?.focus();
4228
+ Y && rn.current && setTimeout(() => {
4229
+ rn.current?.focus();
4210
4230
  }, 10);
4211
- }, [J]), i(() => {
4212
- ie && ie(U);
4213
- }, [U, ie]);
4214
- let [hn, gn] = c([]);
4231
+ }, [Y]), i(() => {
4232
+ ae && ae(W);
4233
+ }, [W, ae]);
4234
+ let [_n, vn] = c([]);
4215
4235
  i(() => {
4216
- if (M && x && x.length > 0) {
4236
+ if (j && x && x.length > 0) {
4217
4237
  let e = !1;
4218
- return wt(M, x).then((t) => {
4219
- e || gn(t);
4238
+ return wt(j, x).then((t) => {
4239
+ e || vn(t);
4220
4240
  }), () => {
4221
4241
  e = !0;
4222
4242
  };
4223
4243
  }
4224
- gn([]);
4225
- }, [M, x]);
4226
- let [_n, vn] = c(!1), yn = o(() => [
4244
+ vn([]);
4245
+ }, [j, x]);
4246
+ let [yn, bn] = c(!1), $ = o(() => [
4227
4247
  ...v || [],
4228
- ...hn,
4229
- ...Te
4248
+ ..._n,
4249
+ ...Oe
4230
4250
  ], [
4231
4251
  v,
4232
- hn,
4233
- Te
4252
+ _n,
4253
+ Oe
4234
4254
  ]);
4235
4255
  i(() => {
4236
- ze.current.onRedactionsChange?.(yn);
4237
- }, [yn]);
4238
- let bn = o(() => yn.filter((e) => e.status === "pending").length, [yn]), $ = n(() => {
4239
- Ee((e) => e.filter((e) => e.status === "applied")), gn((e) => e.filter((e) => e.status === "applied"));
4240
- }, []), xn = n((e) => {
4241
- Ee((t) => t.filter((t) => t !== e && t.id !== e.id)), gn((t) => t.filter((t) => t !== e && t.id !== e.id));
4242
- }, []), { search: Sn, searchResults: Cn, isSearching: wn, searchProgress: Tn } = nt(M, yn);
4256
+ Ve.current.onRedactionsChange?.($);
4257
+ }, [$]);
4258
+ let xn = o(() => $.filter((e) => e.status === "pending").length, [$]), Sn = n(() => {
4259
+ Ae((e) => e.filter((e) => e.status === "applied")), vn((e) => e.filter((e) => e.status === "applied"));
4260
+ }, []), Cn = n((e) => {
4261
+ Ae((t) => t.filter((t) => t !== e && t.id !== e.id)), vn((t) => t.filter((t) => t !== e && t.id !== e.id));
4262
+ }, []), { search: wn, searchResults: Tn, isSearching: En, searchProgress: Dn } = ft(j, $);
4243
4263
  i(() => {
4244
- Cn.length === 0 && Ge(null);
4245
- }, [Cn]);
4246
- let En = s(!1);
4264
+ Tn.length === 0 && Ke(null);
4265
+ }, [Tn]);
4266
+ let On = s(!1);
4247
4267
  i(() => {
4248
- if (xe(null), Ce(null), we(1), qe([]), En.current = !1, !d) return;
4268
+ if (we(null), Ee(null), De(1), Ye([]), On.current = !1, !d) return;
4249
4269
  let e = d, t = !1, n = null;
4250
4270
  return (async () => {
4251
4271
  try {
4252
- Be.current && Ot(Be.current), jt(), n = L.getDocument({
4272
+ He.current && kt(He.current), At(), n = L.getDocument({
4253
4273
  url: e,
4254
4274
  withCredentials: h,
4255
- ...Mt()
4275
+ ...jt()
4256
4276
  });
4257
4277
  let r = await n.promise;
4258
4278
  if (t) return;
@@ -4261,20 +4281,20 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4261
4281
  if (!t) {
4262
4282
  let t = e.getViewport({
4263
4283
  scale: 1,
4264
- rotation: lt(e.rotate + A)
4284
+ rotation: bt(e.rotate + k)
4265
4285
  });
4266
- qe(Et(r.numPages, {
4286
+ Ye(Et(r.numPages, {
4267
4287
  width: t.width,
4268
4288
  height: t.height
4269
4289
  }));
4270
4290
  }
4271
4291
  } catch {}
4272
4292
  if (t) return;
4273
- xe(r), ze.current.onDocumentLoaded?.(r, e);
4293
+ we(r), Ve.current.onDocumentLoaded?.(r, e);
4274
4294
  } catch (n) {
4275
4295
  if (t) return;
4276
4296
  let r = n instanceof Error ? n : Error(String(n?.message ?? n)), i = n?.name === "PasswordException";
4277
- console.error("[teamsync-pdf-viewer] Error loading PDF:", r.message, r), Ce(r), ze.current.onLoadError?.(r, {
4297
+ console.error("[teamsync-pdf-viewer] Error loading PDF:", r.message, r), Ee(r), Ve.current.onLoadError?.(r, {
4278
4298
  url: e,
4279
4299
  passwordRequired: i
4280
4300
  });
@@ -4286,31 +4306,31 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4286
4306
  d,
4287
4307
  p,
4288
4308
  h,
4289
- A
4309
+ k
4290
4310
  ]);
4291
- let Dn = n((e) => {
4292
- En.current || (En.current = !0, ze.current.onFirstPageRendered?.(e));
4311
+ let kn = n((e) => {
4312
+ Ve.current.onPageRendered?.(e), !On.current && (On.current = !0, Ve.current.onFirstPageRendered?.(e));
4293
4313
  }, []);
4294
4314
  i(() => {
4295
- M && ze.current.onPageChange?.(N, M.numPages);
4296
- }, [N, M]);
4297
- let On = s(null), kn = s(void 0);
4315
+ j && Ve.current.onPageChange?.(M, j.numPages);
4316
+ }, [M, j]);
4317
+ let An = s(null), jn = s(void 0);
4298
4318
  i(() => {
4299
- let e = me ?? pe;
4300
- if (!M || !e || On.current === M && kn.current === e || Ke.length < Math.min(e, M.numPages)) return;
4301
- let t = On.current !== M;
4302
- On.current = M, kn.current = e;
4303
- let n = setTimeout(() => _t(e, { smooth: !t }), 50);
4319
+ let e = ve ?? he;
4320
+ if (!j || !e || An.current === j && jn.current === e || qe.length < Math.min(e, j.numPages)) return;
4321
+ let t = An.current !== j;
4322
+ An.current = j, jn.current = e;
4323
+ let n = setTimeout(() => yt(e, { smooth: !t }), 50);
4304
4324
  return () => clearTimeout(n);
4305
4325
  }, [
4306
- M,
4307
- me,
4308
- pe,
4309
- Ke.length,
4310
- _t
4326
+ j,
4327
+ ve,
4328
+ he,
4329
+ qe.length,
4330
+ yt
4311
4331
  ]), i(() => {
4312
- if (!M) return;
4313
- let e = !1, t = M;
4332
+ if (!j) return;
4333
+ let e = !1, t = j;
4314
4334
  return (async () => {
4315
4335
  let n;
4316
4336
  try {
@@ -4321,12 +4341,12 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4321
4341
  if (e) return;
4322
4342
  let r = n.getViewport({
4323
4343
  scale: 1,
4324
- rotation: lt(n.rotate + A)
4344
+ rotation: bt(n.rotate + k)
4325
4345
  }), i = {
4326
4346
  width: r.width,
4327
4347
  height: r.height
4328
4348
  };
4329
- if (qe((e) => e.length === t.numPages && Math.abs((e[0]?.width ?? 0) - i.width) <= .5 && Math.abs((e[0]?.height ?? 0) - i.height) <= .5 ? e : Et(t.numPages, i)), t.numPages <= 1) return;
4349
+ if (Ye((e) => e.length === t.numPages && Math.abs((e[0]?.width ?? 0) - i.width) <= .5 && Math.abs((e[0]?.height ?? 0) - i.height) <= .5 ? e : Et(t.numPages, i)), t.numPages <= 1) return;
4330
4350
  let a = Et(t.numPages, i), o = !1;
4331
4351
  for (let n = 2; n <= t.numPages; n += 25) {
4332
4352
  if (e) return;
@@ -4339,7 +4359,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4339
4359
  if (e) return;
4340
4360
  let s = r.getViewport({
4341
4361
  scale: 1,
4342
- rotation: lt(r.rotate + A)
4362
+ rotation: bt(r.rotate + k)
4343
4363
  });
4344
4364
  (Math.abs(s.width - i.width) > .5 || Math.abs(s.height - i.height) > .5) && (o = !0), a[n - 1] = {
4345
4365
  width: s.width,
@@ -4351,117 +4371,117 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4351
4371
  await Promise.all(s);
4352
4372
  }
4353
4373
  if (!e && o) {
4354
- let e = j.current;
4355
- if (e && e.scrollTop > 0 && pt.current === "continuous") {
4356
- let t = mt.current, n = Dt(ut.current, (e) => a[e - 1] ?? i, dt.current, 16), r = ft.current.tops[t] ?? 0, o = (n.tops[t] ?? 0) - r;
4374
+ let e = A.current;
4375
+ if (e && e.scrollTop > 0 && lt.current === "continuous") {
4376
+ let t = dt.current, n = Dt(at.current, (e) => a[e - 1] ?? i, ot.current, 16), r = st.current.tops[t] ?? 0, o = (n.tops[t] ?? 0) - r;
4357
4377
  o !== 0 && (e.scrollTop += o);
4358
4378
  }
4359
- qe(a);
4379
+ Ye(a);
4360
4380
  }
4361
4381
  })(), () => {
4362
4382
  e = !0;
4363
4383
  };
4364
- }, [M, A]);
4365
- let An = n(() => {
4366
- let e = Ye(N);
4367
- if (!j.current || !e.width) return;
4368
- let t = j.current.clientWidth - 48;
4384
+ }, [j, k]);
4385
+ let Mn = n(() => {
4386
+ let e = Qe(M);
4387
+ if (!A.current || !e.width) return;
4388
+ let t = A.current.clientWidth - 48;
4369
4389
  if (t > 0 && e.width > 0) {
4370
- let n = yt(t / e.width);
4371
- dn.current = !0, j.current && (N === 1 || j.current.scrollTop <= 1) && (j.current.scrollTop = 0, j.current.scrollLeft = 0), C(n);
4390
+ let n = Je(t / e.width);
4391
+ pn.current = !0, A.current && (M === 1 || A.current.scrollTop <= 1) && (A.current.scrollTop = 0, A.current.scrollLeft = 0), te(n);
4372
4392
  }
4373
4393
  }, [
4374
- Ye,
4375
- N,
4376
- C
4377
- ]), jn = n(() => {
4378
- let e = Ye(N);
4379
- if (!j.current || !e.width || !e.height) return;
4380
- let t = j.current.clientWidth - 48, n = j.current.clientHeight - 48;
4394
+ Qe,
4395
+ M,
4396
+ te
4397
+ ]), Nn = n(() => {
4398
+ let e = Qe(M);
4399
+ if (!A.current || !e.width || !e.height) return;
4400
+ let t = A.current.clientWidth - 48, n = A.current.clientHeight - 48;
4381
4401
  if (t > 0 && n > 0 && e.width > 0 && e.height > 0) {
4382
- let r = t / e.width, i = n / e.height, a = yt(Math.min(r, i));
4383
- dn.current = !0, j.current && (N === 1 || j.current.scrollTop <= 1) && (j.current.scrollTop = 0, j.current.scrollLeft = 0), C(a);
4402
+ let r = t / e.width, i = n / e.height, a = Je(Math.min(r, i));
4403
+ pn.current = !0, A.current && (M === 1 || A.current.scrollTop <= 1) && (A.current.scrollTop = 0, A.current.scrollLeft = 0), te(a);
4384
4404
  }
4385
4405
  }, [
4386
- Ye,
4387
- N,
4388
- C
4406
+ Qe,
4407
+ M,
4408
+ te
4389
4409
  ]);
4390
- Re("action-fit-to-width", () => An()), Re("action-fit-to-page", () => jn());
4391
- let Mn = (e, t) => {
4392
- let n = e.currentTarget.getBoundingClientRect(), r = (e.clientX - n.left) / S, i = (e.clientY - n.top) / S, a = Ye(t);
4393
- return ot(r, i, A, A % 180 == 0 ? a.width : a.height, A % 180 == 0 ? a.height : a.width);
4394
- }, Nn = (e, t) => {
4395
- if (!W) return;
4396
- let { x: n, y: r } = Mn(e, t);
4397
- if (W === "text" || W === "note") {
4410
+ Re("action-fit-to-width", () => Mn()), Re("action-fit-to-page", () => Nn());
4411
+ let Pn = (e, t) => {
4412
+ let n = e.currentTarget.getBoundingClientRect(), r = (e.clientX - n.left) / S, i = (e.clientY - n.top) / S, a = Qe(t);
4413
+ return gt(r, i, k, k % 180 == 0 ? a.width : a.height, k % 180 == 0 ? a.height : a.width);
4414
+ }, Fn = (e, t) => {
4415
+ if (!G) return;
4416
+ let { x: n, y: r } = Pn(e, t);
4417
+ if (G === "text" || G === "note") {
4398
4418
  e.preventDefault();
4399
4419
  return;
4400
4420
  }
4401
- if (W === "eraser") {
4402
- Gt(!0);
4421
+ if (G === "eraser") {
4422
+ Kt(!0);
4403
4423
  return;
4404
4424
  }
4405
- Yt({
4425
+ Xt({
4406
4426
  x: n,
4407
4427
  y: r
4408
- }), Xt({
4428
+ }), Zt({
4409
4429
  x: n,
4410
4430
  y: r
4411
- }), W === "freehand" ? (Gt(!0), Qt([{
4431
+ }), G === "freehand" ? (Kt(!0), $t([{
4412
4432
  x: n,
4413
4433
  y: r
4414
- }]), qt(t)) : ([
4434
+ }]), Yt(t)) : ([
4415
4435
  "rectangle",
4416
4436
  "ellipse",
4417
4437
  "line",
4418
4438
  "arrow",
4419
4439
  "highlight",
4420
4440
  "redaction"
4421
- ].includes(W) || ["callout", "link"].includes(W)) && (Gt(!0), qt(t));
4422
- }, Pn = () => {
4423
- if (J && en.trim()) {
4424
- if (J.annId) Q(U.map((e) => e.id === J.annId ? {
4441
+ ].includes(G) || ["callout", "link"].includes(G)) && (Kt(!0), Yt(t));
4442
+ }, In = () => {
4443
+ if (Y && tn.trim()) {
4444
+ if (Y.annId) Q(W.map((e) => e.id === Y.annId ? {
4425
4445
  ...e,
4426
- text: en
4446
+ text: tn
4427
4447
  } : e));
4428
4448
  else {
4429
4449
  let e = Ct();
4430
- Q([...U, {
4450
+ Q([...W, {
4431
4451
  id: e,
4432
- type: J.type,
4433
- pageIndex: J.pageIndex,
4434
- x: J.x,
4435
- y: J.y,
4436
- width: Math.max(100, en.length * 8 + 20),
4452
+ type: Y.type,
4453
+ pageIndex: Y.pageIndex,
4454
+ x: Y.x,
4455
+ y: Y.y,
4456
+ width: Math.max(100, tn.length * 8 + 20),
4437
4457
  height: 30,
4438
- text: en,
4439
- points: J.points,
4440
- color: kt,
4441
- strokeWidth: Nt,
4442
- opacity: Vt
4458
+ text: tn,
4459
+ points: Y.points,
4460
+ color: Mt,
4461
+ strokeWidth: Bt,
4462
+ opacity: Ut
4443
4463
  }]);
4444
4464
  }
4445
4465
  }
4446
- $t(null), tn(""), W === "text" && G(null);
4447
- }, Fn = (e, t) => {
4448
- if (!Wt) return;
4449
- let { x: n, y: r } = Mn(e, t);
4450
- Xt({
4466
+ en(null), nn(""), G === "text" && K(null);
4467
+ }, Ln = (e, t) => {
4468
+ if (!Gt) return;
4469
+ let { x: n, y: r } = Pn(e, t);
4470
+ Zt({
4451
4471
  x: n,
4452
4472
  y: r
4453
- }), W === "freehand" && Qt((e) => [...e, {
4473
+ }), G === "freehand" && $t((e) => [...e, {
4454
4474
  x: n,
4455
4475
  y: r
4456
4476
  }]);
4457
- }, In = (e, t) => {
4458
- if (W === "text" || W === "note" || W === "digital_signature" || W === "link") {
4459
- let { x: n, y: r } = Mn(e, t);
4460
- if (W === "link") {
4461
- let e = Math.abs(q.x - K.x), i = Math.abs(q.y - K.y), a = Math.min(K.x, q.x), o = Math.min(K.y, q.y);
4477
+ }, Rn = (e, t) => {
4478
+ if (G === "text" || G === "note" || G === "digital_signature" || G === "link") {
4479
+ let { x: n, y: r } = Pn(e, t);
4480
+ if (G === "link") {
4481
+ let e = Math.abs(J.x - q.x), i = Math.abs(J.y - q.y), a = Math.min(q.x, J.x), o = Math.min(q.y, J.y);
4462
4482
  (e < 5 || i < 5) && (a = n, o = r, e = 120, i = 35);
4463
4483
  let s = Ct();
4464
- Q([...U, {
4484
+ Q([...W, {
4465
4485
  id: s,
4466
4486
  type: "link",
4467
4487
  pageIndex: t,
@@ -4474,55 +4494,55 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4474
4494
  strokeWidth: 0,
4475
4495
  opacity: 1,
4476
4496
  text: ""
4477
- }]), Gt(!1), qt(null), cn.current = !0, X(s), sn(!0), G(null);
4497
+ }]), Kt(!1), Yt(null), ln.current = !0, an(s), Z(!0), K(null);
4478
4498
  return;
4479
4499
  }
4480
- (W === "text" || W === "note") && (J && Pn(), $t({
4500
+ (G === "text" || G === "note") && (Y && In(), en({
4481
4501
  x: n,
4482
4502
  y: r,
4483
- type: W,
4503
+ type: G,
4484
4504
  pageIndex: t
4485
- }), tn(""));
4505
+ }), nn(""));
4486
4506
  return;
4487
4507
  }
4488
- if (Wt && (Gt(!1), qt(null), W)) {
4489
- if (W === "freehand") {
4490
- if (Zt.length > 2) {
4491
- let e = Zt.map((e) => e.x), n = Zt.map((e) => e.y), r = Math.min(...e), i = Math.max(...e), a = Math.min(...n), o = Math.max(...n);
4492
- Q([...U, {
4508
+ if (Gt && (Kt(!1), Yt(null), G)) {
4509
+ if (G === "freehand") {
4510
+ if (Qt.length > 2) {
4511
+ let e = Qt.map((e) => e.x), n = Qt.map((e) => e.y), r = Math.min(...e), i = Math.max(...e), a = Math.min(...n), o = Math.max(...n);
4512
+ Q([...W, {
4493
4513
  id: Ct(),
4494
- type: W,
4514
+ type: G,
4495
4515
  pageIndex: t,
4496
4516
  x: r,
4497
4517
  y: a,
4498
4518
  width: i - r,
4499
4519
  height: o - a,
4500
- points: [...Zt],
4501
- strokes: [[...Zt]],
4502
- color: kt,
4503
- strokeWidth: Nt,
4504
- opacity: Vt
4520
+ points: [...Qt],
4521
+ strokes: [[...Qt]],
4522
+ color: Mt,
4523
+ strokeWidth: Bt,
4524
+ opacity: Ut
4505
4525
  }]);
4506
4526
  }
4507
- Qt([]);
4527
+ $t([]);
4508
4528
  } else {
4509
- let e = Math.abs(q.x - K.x), n = Math.abs(q.y - K.y);
4529
+ let e = Math.abs(J.x - q.x), n = Math.abs(J.y - q.y);
4510
4530
  if (e > 5 || n > 5) {
4511
- let r = Math.min(K.x, q.x), i = Math.min(K.y, q.y), a = W === "line" || W === "arrow" || W === "callout" ? [K, q] : void 0;
4512
- if ((W === "highlight" || W === "redaction") && n < 18 && (n = Math.max(18, n), i = K.y - 9), W === "callout") {
4513
- if (ve?.canAddAnnotations === !1) return;
4514
- $t({
4515
- x: q.x,
4516
- y: q.y,
4531
+ let r = Math.min(q.x, J.x), i = Math.min(q.y, J.y), a = G === "line" || G === "arrow" || G === "callout" ? [q, J] : void 0;
4532
+ if ((G === "highlight" || G === "redaction") && n < 18 && (n = Math.max(18, n), i = q.y - 9), G === "callout") {
4533
+ if (be?.canAddAnnotations === !1) return;
4534
+ en({
4535
+ x: J.x,
4536
+ y: J.y,
4517
4537
  type: "callout",
4518
4538
  points: a,
4519
4539
  pageIndex: t
4520
- }), tn("");
4540
+ }), nn("");
4521
4541
  return;
4522
4542
  }
4523
- if (W === "redaction") {
4524
- if (ve?.canRedact === !1) return;
4525
- Ee((a) => [...a, {
4543
+ if (G === "redaction") {
4544
+ if (be?.canRedact === !1) return;
4545
+ Ae((a) => [...a, {
4526
4546
  id: `manual-${Date.now()}-${Math.random().toString(36).substr(2, 6)}`,
4527
4547
  pageIndex: t,
4528
4548
  x: r,
@@ -4533,35 +4553,35 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4533
4553
  }]);
4534
4554
  return;
4535
4555
  }
4536
- if (ve?.canAddAnnotations === !1) return;
4537
- Q([...U, {
4556
+ if (be?.canAddAnnotations === !1) return;
4557
+ Q([...W, {
4538
4558
  id: Ct(),
4539
- type: W,
4559
+ type: G,
4540
4560
  pageIndex: t,
4541
4561
  x: r,
4542
4562
  y: i,
4543
4563
  width: e,
4544
4564
  height: n,
4545
4565
  points: a,
4546
- color: kt,
4547
- strokeWidth: Nt,
4548
- opacity: Vt
4566
+ color: Mt,
4567
+ strokeWidth: Bt,
4568
+ opacity: Ut
4549
4569
  }]);
4550
4570
  }
4551
4571
  }
4552
4572
  }
4553
- }, Ln = (e) => {
4554
- W === "eraser" && Wt && Q(U.filter((t) => t.id !== e));
4555
- }, Rn = (e, t) => {
4556
- if (t.stopPropagation(), W === "eraser") {
4557
- if (ve?.canDeleteAnnotations === !1) return;
4558
- Q(U.filter((t) => t.id !== e)), Y === e && (X(null), an(null));
4559
- } else if (W === null || W === "pan") {
4560
- let n = U.find((t) => t.id === e);
4573
+ }, zn = (e) => {
4574
+ G === "eraser" && Gt && Q(W.filter((t) => t.id !== e));
4575
+ }, Bn = (e, t) => {
4576
+ if (t.stopPropagation(), G === "eraser") {
4577
+ if (be?.canDeleteAnnotations === !1) return;
4578
+ Q(W.filter((t) => t.id !== e)), X === e && (an(null), sn(null));
4579
+ } else if (G === null || G === "pan") {
4580
+ let n = W.find((t) => t.id === e);
4561
4581
  if (n && n.linkUrl && a === "View") {
4562
4582
  if (n.linkUrl.startsWith("#page=")) {
4563
4583
  let e = parseInt(n.linkUrl.split("=")[1]);
4564
- _t(e);
4584
+ yt(e);
4565
4585
  } else {
4566
4586
  let e = n.linkUrl;
4567
4587
  /^https?:\/\//i.test(e) || (e = "https://" + e);
@@ -4571,45 +4591,45 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4571
4591
  return;
4572
4592
  }
4573
4593
  if (n && (n.type === "note" || n.type === "callout" || n.type === "text")) {
4574
- if (ve?.canEditAnnotations === !1 || !u.canEdit(n)) {
4575
- X(e);
4594
+ if (be?.canEditAnnotations === !1 || !u.canEdit(n)) {
4595
+ an(e);
4576
4596
  return;
4577
4597
  }
4578
- $t({
4598
+ en({
4579
4599
  x: n.x,
4580
4600
  y: n.y,
4581
4601
  type: n.type,
4582
4602
  annId: n.id,
4583
4603
  points: n.points,
4584
4604
  pageIndex: n.pageIndex
4585
- }), tn(n.text || ""), n.color && At(n.color);
4605
+ }), nn(n.text || ""), n.color && Rt(n.color);
4586
4606
  } else if (n && n.type === "link") {
4587
- if (ve?.canEditAnnotations === !1 || !u.canEdit(n)) {
4588
- X(e);
4607
+ if (be?.canEditAnnotations === !1 || !u.canEdit(n)) {
4608
+ an(e);
4589
4609
  return;
4590
4610
  }
4591
- sn(!0);
4611
+ Z(!0);
4592
4612
  }
4593
- X(e);
4594
- let r = j.current, i = r?.getBoundingClientRect();
4595
- i && r && an({
4613
+ an(e);
4614
+ let r = A.current, i = r?.getBoundingClientRect();
4615
+ i && r && sn({
4596
4616
  top: t.clientY - i.top + r.scrollTop,
4597
4617
  left: t.clientX - i.left + r.scrollLeft
4598
4618
  });
4599
4619
  }
4600
4620
  };
4601
4621
  return i(() => {
4602
- if (M && j.current && O === "continuous") {
4603
- let e = Xe.top + j.current.clientHeight / 2, t = Math.max(0, Math.min(H.length - 1, gt(e))), n = H[t] ? H[t][0] : 1;
4604
- n !== N && we(n);
4622
+ if (j && A.current && E === "continuous") {
4623
+ let e = $e.top + A.current.clientHeight / 2, t = Math.max(0, Math.min(H.length - 1, vt(e))), n = H[t] ? H[t][0] : 1;
4624
+ n !== M && De(n);
4605
4625
  }
4606
4626
  }, [
4607
- Xe.top,
4627
+ $e.top,
4608
4628
  S,
4629
+ j,
4609
4630
  M,
4610
- N,
4611
- gt,
4612
- O,
4631
+ vt,
4632
+ E,
4613
4633
  H
4614
4634
  ]), /* @__PURE__ */ I("div", {
4615
4635
  style: {
@@ -4620,11 +4640,11 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4620
4640
  overflow: "hidden"
4621
4641
  },
4622
4642
  children: [
4623
- _ && /* @__PURE__ */ F(at, {
4643
+ _ && /* @__PURE__ */ F(ht, {
4624
4644
  isOpen: t,
4625
- pdfDoc: M,
4626
- pageNum: N,
4627
- setPageNum: (e) => _t(e)
4645
+ pdfDoc: j,
4646
+ pageNum: M,
4647
+ setPageNum: (e) => yt(e)
4628
4648
  }),
4629
4649
  /* @__PURE__ */ I("div", {
4630
4650
  style: {
@@ -4637,7 +4657,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4637
4657
  overflow: "hidden"
4638
4658
  },
4639
4659
  children: [
4640
- R.isActive && /* @__PURE__ */ F(It, {
4660
+ R.isActive && /* @__PURE__ */ F(Ft, {
4641
4661
  compareState: R,
4642
4662
  onSetMode: (e) => z((t) => ({
4643
4663
  ...t,
@@ -4655,18 +4675,18 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4655
4675
  onPrevDiff: () => {
4656
4676
  if (R.diffItems.length === 0) return;
4657
4677
  let e = (R.currentDiffIndex - 1 + R.diffItems.length) % R.diffItems.length;
4658
- bt(e);
4678
+ Ot(e);
4659
4679
  },
4660
4680
  onNextDiff: () => {
4661
4681
  if (R.diffItems.length === 0) return;
4662
4682
  let e = (R.currentDiffIndex + 1) % R.diffItems.length;
4663
- bt(e);
4683
+ Ot(e);
4664
4684
  },
4665
4685
  onExit: () => {
4666
4686
  z((e) => ({
4667
4687
  ...e,
4668
4688
  isActive: !1
4669
- })), P(null), Fe([]);
4689
+ })), Fe(null), Ie([]);
4670
4690
  }
4671
4691
  }),
4672
4692
  a === "Annotate" && /* @__PURE__ */ I("div", {
@@ -4680,35 +4700,35 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4680
4700
  height: "40px"
4681
4701
  },
4682
4702
  children: [
4683
- /* @__PURE__ */ F(Jt, {
4684
- icon: /* @__PURE__ */ F(k, { size: 16 }),
4685
- active: W === "highlight",
4703
+ /* @__PURE__ */ F(qt, {
4704
+ icon: /* @__PURE__ */ F(T, { size: 16 }),
4705
+ active: G === "highlight",
4686
4706
  onClick: () => {
4687
- G("highlight"), At("#fbc02d"), Ht(.5), zt(16);
4707
+ K("highlight"), Rt("#fbc02d"), Wt(.5), Vt(16);
4688
4708
  },
4689
4709
  label: "Text Highlight"
4690
4710
  }),
4691
- /* @__PURE__ */ F(Jt, {
4711
+ /* @__PURE__ */ F(qt, {
4692
4712
  icon: /* @__PURE__ */ F(m, { size: 16 }),
4693
- active: W === "freehand",
4713
+ active: G === "freehand",
4694
4714
  onClick: () => {
4695
- G("freehand"), At("#000000"), Ht(1), zt(2);
4715
+ K("freehand"), Rt("#000000"), Wt(1), Vt(2);
4696
4716
  },
4697
4717
  label: "Marker"
4698
4718
  }),
4699
- /* @__PURE__ */ F(Jt, {
4700
- icon: /* @__PURE__ */ F(Me, { size: 16 }),
4701
- active: W === "text",
4719
+ /* @__PURE__ */ F(qt, {
4720
+ icon: /* @__PURE__ */ F(Ne, { size: 16 }),
4721
+ active: G === "text",
4702
4722
  onClick: () => {
4703
- G("text"), At("#000000"), Ht(1);
4723
+ K("text"), Rt("#000000"), Wt(1);
4704
4724
  },
4705
4725
  label: "Text"
4706
4726
  }),
4707
- ve?.canRedact !== !1 && /* @__PURE__ */ F(Jt, {
4708
- icon: /* @__PURE__ */ F(w, { size: 16 }),
4709
- active: W === "redaction",
4727
+ be?.canRedact !== !1 && /* @__PURE__ */ F(qt, {
4728
+ icon: /* @__PURE__ */ F(oe, { size: 16 }),
4729
+ active: G === "redaction",
4710
4730
  onClick: () => {
4711
- G("redaction"), At("#000000"), Ht(1);
4731
+ K("redaction"), Rt("#000000"), Wt(1);
4712
4732
  },
4713
4733
  label: "Redact"
4714
4734
  }),
@@ -4725,11 +4745,11 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4725
4745
  borderRight: "1px solid var(--border-color)",
4726
4746
  paddingRight: "8px"
4727
4747
  },
4728
- children: /* @__PURE__ */ F(Jt, {
4729
- icon: /* @__PURE__ */ F(he, { size: 16 }),
4730
- active: W === "callout",
4748
+ children: /* @__PURE__ */ F(qt, {
4749
+ icon: /* @__PURE__ */ F(ge, { size: 16 }),
4750
+ active: G === "callout",
4731
4751
  onClick: () => {
4732
- G("callout"), Ht(1), zt(2);
4752
+ K("callout"), Wt(1), Vt(2);
4733
4753
  },
4734
4754
  label: "Callout"
4735
4755
  })
@@ -4739,17 +4759,17 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4739
4759
  display: "flex",
4740
4760
  gap: "4px"
4741
4761
  },
4742
- children: [/* @__PURE__ */ F(Jt, {
4743
- icon: /* @__PURE__ */ F(be, { size: 16 }),
4744
- active: W === "freehand" && Vt === 1,
4762
+ children: [/* @__PURE__ */ F(qt, {
4763
+ icon: /* @__PURE__ */ F(Se, { size: 16 }),
4764
+ active: G === "freehand" && Ut === 1,
4745
4765
  onClick: () => {
4746
- G("freehand"), Ht(1), zt(2);
4766
+ K("freehand"), Wt(1), Vt(2);
4747
4767
  },
4748
4768
  label: "Freehand"
4749
- }), ve?.canDeleteAnnotations !== !1 && /* @__PURE__ */ F(Jt, {
4750
- icon: /* @__PURE__ */ F(re, { size: 16 }),
4751
- active: W === "eraser",
4752
- onClick: () => G("eraser"),
4769
+ }), be?.canDeleteAnnotations !== !1 && /* @__PURE__ */ F(qt, {
4770
+ icon: /* @__PURE__ */ F(ie, { size: 16 }),
4771
+ active: G === "eraser",
4772
+ onClick: () => K("eraser"),
4753
4773
  label: "Eraser"
4754
4774
  })]
4755
4775
  }),
@@ -4765,34 +4785,34 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4765
4785
  gap: "4px"
4766
4786
  },
4767
4787
  children: [
4768
- /* @__PURE__ */ F(Jt, {
4769
- icon: /* @__PURE__ */ F(ge, { size: 16 }),
4770
- active: W === "line",
4771
- onClick: () => G("line"),
4788
+ /* @__PURE__ */ F(qt, {
4789
+ icon: /* @__PURE__ */ F(_e, { size: 16 }),
4790
+ active: G === "line",
4791
+ onClick: () => K("line"),
4772
4792
  label: "Line"
4773
4793
  }),
4774
- /* @__PURE__ */ F(Jt, {
4794
+ /* @__PURE__ */ F(qt, {
4775
4795
  icon: /* @__PURE__ */ F(f, { size: 16 }),
4776
- active: W === "arrow",
4777
- onClick: () => G("arrow"),
4796
+ active: G === "arrow",
4797
+ onClick: () => K("arrow"),
4778
4798
  label: "Arrow"
4779
4799
  }),
4780
- /* @__PURE__ */ F(Jt, {
4781
- icon: /* @__PURE__ */ F(Ae, { size: 16 }),
4782
- active: W === "rectangle",
4783
- onClick: () => G("rectangle"),
4800
+ /* @__PURE__ */ F(qt, {
4801
+ icon: /* @__PURE__ */ F(je, { size: 16 }),
4802
+ active: G === "rectangle",
4803
+ onClick: () => K("rectangle"),
4784
4804
  label: "Rectangle"
4785
4805
  }),
4786
- /* @__PURE__ */ F(Jt, {
4806
+ /* @__PURE__ */ F(qt, {
4787
4807
  icon: /* @__PURE__ */ F(ee, { size: 16 }),
4788
- active: W === "ellipse",
4789
- onClick: () => G("ellipse"),
4808
+ active: G === "ellipse",
4809
+ onClick: () => K("ellipse"),
4790
4810
  label: "Ellipse"
4791
4811
  }),
4792
- /* @__PURE__ */ F(Jt, {
4793
- icon: /* @__PURE__ */ F(ce, { size: 16 }),
4794
- active: W === "link",
4795
- onClick: () => G("link"),
4812
+ /* @__PURE__ */ F(qt, {
4813
+ icon: /* @__PURE__ */ F(O, { size: 16 }),
4814
+ active: G === "link",
4815
+ onClick: () => K("link"),
4796
4816
  label: "Link"
4797
4817
  })
4798
4818
  ]
@@ -4812,7 +4832,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4812
4832
  "ellipse",
4813
4833
  "freehand",
4814
4834
  "highlight"
4815
- ].includes(W || "") && /* @__PURE__ */ I("div", {
4835
+ ].includes(G || "") && /* @__PURE__ */ I("div", {
4816
4836
  style: {
4817
4837
  display: "flex",
4818
4838
  alignItems: "center",
@@ -4826,16 +4846,16 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4826
4846
  color: "#666",
4827
4847
  minWidth: "85px"
4828
4848
  },
4829
- children: ["Thickness: ", /* @__PURE__ */ I("strong", { children: [Nt, "px"] })]
4849
+ children: ["Thickness: ", /* @__PURE__ */ I("strong", { children: [Bt, "px"] })]
4830
4850
  }), /* @__PURE__ */ F("input", {
4831
4851
  type: "range",
4832
4852
  min: "1",
4833
4853
  max: "24",
4834
- value: Math.min(24, Math.max(1, Nt)),
4854
+ value: Math.min(24, Math.max(1, Bt)),
4835
4855
  onMouseDown: (e) => e.stopPropagation(),
4836
4856
  onChange: (e) => {
4837
4857
  let t = parseInt(e.target.value, 10);
4838
- zt(t), Y && !J && Q(U.map((e) => e.id === Y ? {
4858
+ Vt(t), X && !Y && Q(W.map((e) => e.id === X ? {
4839
4859
  ...e,
4840
4860
  strokeWidth: t
4841
4861
  } : e));
@@ -4862,7 +4882,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4862
4882
  ].map((e) => /* @__PURE__ */ F("button", {
4863
4883
  onMouseDown: (e) => e.preventDefault(),
4864
4884
  onClick: () => {
4865
- At(e), Y && !J && Q(U.map((t) => t.id === Y ? {
4885
+ Rt(e), X && !Y && Q(W.map((t) => t.id === X ? {
4866
4886
  ...t,
4867
4887
  color: e
4868
4888
  } : t));
@@ -4872,14 +4892,14 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4872
4892
  height: "18px",
4873
4893
  borderRadius: "50%",
4874
4894
  backgroundColor: e,
4875
- border: kt === e ? "2px solid #000" : "1px solid transparent",
4895
+ border: Mt === e ? "2px solid #000" : "1px solid transparent",
4876
4896
  cursor: "pointer",
4877
4897
  outline: "none",
4878
4898
  padding: 0
4879
4899
  }
4880
4900
  }, e))
4881
4901
  }),
4882
- bn > 0 && /* @__PURE__ */ I("div", {
4902
+ xn > 0 && /* @__PURE__ */ I("div", {
4883
4903
  style: {
4884
4904
  display: "flex",
4885
4905
  alignItems: "center",
@@ -4887,7 +4907,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4887
4907
  marginLeft: "8px"
4888
4908
  },
4889
4909
  children: [/* @__PURE__ */ I("button", {
4890
- onClick: () => vn(!0),
4910
+ onClick: () => bn(!0),
4891
4911
  style: {
4892
4912
  display: "flex",
4893
4913
  alignItems: "center",
@@ -4904,13 +4924,13 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4904
4924
  },
4905
4925
  title: "Apply all marked redactions permanently",
4906
4926
  children: [
4907
- /* @__PURE__ */ F(Oe, { size: 16 }),
4927
+ /* @__PURE__ */ F(ke, { size: 16 }),
4908
4928
  "Apply Redactions (",
4909
- bn,
4929
+ xn,
4910
4930
  ")"
4911
4931
  ]
4912
4932
  }), /* @__PURE__ */ I("button", {
4913
- onClick: $,
4933
+ onClick: Sn,
4914
4934
  style: {
4915
4935
  display: "flex",
4916
4936
  alignItems: "center",
@@ -4925,7 +4945,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4925
4945
  cursor: "pointer"
4926
4946
  },
4927
4947
  title: "Discard all pending unapplied redactions",
4928
- children: [/* @__PURE__ */ F(je, {
4948
+ children: [/* @__PURE__ */ F(Me, {
4929
4949
  size: 14,
4930
4950
  color: "#dc2626"
4931
4951
  }), "Discard Redactions"]
@@ -4935,7 +4955,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4935
4955
  })
4936
4956
  ]
4937
4957
  }),
4938
- _n && /* @__PURE__ */ F("div", {
4958
+ yn && /* @__PURE__ */ F("div", {
4939
4959
  style: {
4940
4960
  position: "fixed",
4941
4961
  top: 0,
@@ -4976,7 +4996,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
4976
4996
  justifyContent: "center",
4977
4997
  color: "#dc2626"
4978
4998
  },
4979
- children: /* @__PURE__ */ F(Oe, { size: 24 })
4999
+ children: /* @__PURE__ */ F(ke, { size: 24 })
4980
5000
  }), /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F("h3", {
4981
5001
  style: {
4982
5002
  margin: 0,
@@ -5003,7 +5023,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5003
5023
  },
5004
5024
  children: [
5005
5025
  "You are about to permanently apply ",
5006
- /* @__PURE__ */ I("strong", { children: [bn, " redaction(s)"] }),
5026
+ /* @__PURE__ */ I("strong", { children: [xn, " redaction(s)"] }),
5007
5027
  ". Marked areas will be blacked out and underlying text will be permanently removed. This action cannot be undone."
5008
5028
  ]
5009
5029
  }),
@@ -5015,7 +5035,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5015
5035
  },
5016
5036
  children: [
5017
5037
  /* @__PURE__ */ F("button", {
5018
- onClick: () => vn(!1),
5038
+ onClick: () => bn(!1),
5019
5039
  style: {
5020
5040
  padding: "8px 14px",
5021
5041
  borderRadius: "6px",
@@ -5030,7 +5050,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5030
5050
  }),
5031
5051
  /* @__PURE__ */ F("button", {
5032
5052
  onClick: () => {
5033
- $(), vn(!1);
5053
+ Sn(), bn(!1);
5034
5054
  },
5035
5055
  style: {
5036
5056
  padding: "8px 14px",
@@ -5046,13 +5066,13 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5046
5066
  }),
5047
5067
  /* @__PURE__ */ F("button", {
5048
5068
  onClick: () => {
5049
- Ee((e) => e.map((e) => ({
5069
+ Ae((e) => e.map((e) => ({
5050
5070
  ...e,
5051
5071
  status: "applied"
5052
- }))), gn((e) => e.map((e) => ({
5072
+ }))), vn((e) => e.map((e) => ({
5053
5073
  ...e,
5054
5074
  status: "applied"
5055
- }))), vn(!1);
5075
+ }))), bn(!1);
5056
5076
  },
5057
5077
  style: {
5058
5078
  padding: "8px 14px",
@@ -5083,28 +5103,28 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5083
5103
  overflow: "hidden",
5084
5104
  position: "relative"
5085
5105
  },
5086
- children: [R.isActive && R.mode === "side-by-side" ? /* @__PURE__ */ F(Ft, {
5087
- pdfDocA: M,
5088
- pdfDocB: ke,
5089
- pageNum: N,
5106
+ children: [R.isActive && R.mode === "side-by-side" ? /* @__PURE__ */ F(Pt, {
5107
+ pdfDocA: j,
5108
+ pdfDocB: Pe,
5109
+ pageNum: M,
5090
5110
  scale: S,
5091
- rotation: A,
5092
- basePageDims: Ye(N),
5111
+ rotation: k,
5112
+ basePageDims: Qe(M),
5093
5113
  activeTab: a,
5094
- activeTool: W,
5095
- annotations: U,
5096
- permissions: ve,
5097
- watermark: ue,
5098
- watermarkText: de,
5099
- redactions: yn,
5100
- diffsA: R.pageDiffsA?.[N] || [],
5101
- diffsB: R.pageDiffsB?.[N] || [],
5114
+ activeTool: G,
5115
+ annotations: W,
5116
+ permissions: be,
5117
+ watermark: fe,
5118
+ watermarkText: pe,
5119
+ redactions: $,
5120
+ diffsA: R.pageDiffsA?.[M] || [],
5121
+ diffsB: R.pageDiffsB?.[M] || [],
5102
5122
  selectedDiffId: R.diffItems[R.currentDiffIndex]?.id,
5103
5123
  onSelectDiff: (e) => {
5104
5124
  let t = R.diffItems.findIndex((t) => t.id === e);
5105
- t !== -1 && bt(t);
5125
+ t !== -1 && Ot(t);
5106
5126
  }
5107
- }) : /* @__PURE__ */ I(Ne, { children: [W === "highlight" && /* @__PURE__ */ F("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__ */ I("div", {
5127
+ }) : /* @__PURE__ */ I(P, { children: [G === "highlight" && /* @__PURE__ */ F("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__ */ I("div", {
5108
5128
  className: "pdf-viewer-area",
5109
5129
  style: {
5110
5130
  flex: 1,
@@ -5115,28 +5135,28 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5115
5135
  overflow: "hidden",
5116
5136
  position: "relative",
5117
5137
  backgroundColor: "var(--bg-color)",
5118
- cursor: $e ? "grabbing" : W === "pan" || W === null ? "grab" : W === "eraser" ? "cell" : "crosshair"
5138
+ cursor: tt ? "grabbing" : G === "pan" || G === null ? "grab" : G === "eraser" ? "cell" : "crosshair"
5119
5139
  },
5120
5140
  onMouseMove: (e) => {
5121
- if ($e && it.current && j.current) {
5141
+ if (tt && it.current && A.current) {
5122
5142
  let t = e.clientX - it.current.x, n = e.clientY - it.current.y;
5123
- j.current.scrollLeft = it.current.scrollLeft - t, j.current.scrollTop = it.current.scrollTop - n;
5143
+ A.current.scrollLeft = it.current.scrollLeft - t, A.current.scrollTop = it.current.scrollTop - n;
5124
5144
  }
5125
5145
  },
5126
5146
  onMouseLeave: () => {
5127
- $e && (tt(!1), it.current = null);
5147
+ tt && (rt(!1), it.current = null);
5128
5148
  },
5129
5149
  children: [
5130
5150
  /* @__PURE__ */ F("div", {
5131
- ref: j,
5151
+ ref: A,
5132
5152
  onScroll: (e) => {
5133
- Ze({
5153
+ V({
5134
5154
  top: e.currentTarget.scrollTop,
5135
5155
  left: e.currentTarget.scrollLeft
5136
- }), mt.current = gt(e.currentTarget.scrollTop);
5156
+ }), dt.current = vt(e.currentTarget.scrollTop);
5137
5157
  },
5138
5158
  onMouseDown: (e) => {
5139
- (W === "pan" || W === null) && e.button === 0 && (tt(!0), it.current = {
5159
+ (G === "pan" || G === null) && e.button === 0 && (rt(!0), it.current = {
5140
5160
  x: e.clientX,
5141
5161
  y: e.clientY,
5142
5162
  scrollLeft: e.currentTarget.scrollLeft,
@@ -5144,7 +5164,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5144
5164
  });
5145
5165
  },
5146
5166
  onMouseUp: (e) => {
5147
- $e && (tt(!1), it.current = null);
5167
+ tt && (rt(!1), it.current = null);
5148
5168
  },
5149
5169
  onContextMenu: (e) => {
5150
5170
  e.preventDefault(), e.stopPropagation();
@@ -5157,46 +5177,46 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5157
5177
  },
5158
5178
  children: (() => {
5159
5179
  let t = (t, n, r) => {
5160
- let i = r ? ct.tops[n] ?? 0 : 0;
5161
- if (r && j.current) {
5180
+ let i = r ? U.tops[n] ?? 0 : 0;
5181
+ if (r && A.current) {
5162
5182
  let e = S >= 4 ? 1 : S >= 2 ? 2 : 4, t = S >= 4 ? 1 : S >= 2 ? 2 : 5;
5163
- if (n < mt.current - e || n > mt.current + t) return null;
5183
+ if (n < dt.current - e || n > dt.current + t) return null;
5164
5184
  }
5165
- let o = Wt && Kt && W && W !== "eraser" ? (() => {
5166
- if (W === "freehand") return {
5185
+ let o = Gt && Jt && G && G !== "eraser" ? (() => {
5186
+ if (G === "freehand") return {
5167
5187
  id: "temp-live-drawing",
5168
5188
  type: "freehand",
5169
- pageIndex: Kt,
5189
+ pageIndex: Jt,
5170
5190
  x: 0,
5171
5191
  y: 0,
5172
5192
  width: 0,
5173
5193
  height: 0,
5174
- points: Zt,
5175
- color: kt,
5176
- strokeWidth: Nt,
5177
- opacity: Vt
5194
+ points: Qt,
5195
+ color: Mt,
5196
+ strokeWidth: Bt,
5197
+ opacity: Ut
5178
5198
  };
5179
- if (W === "highlight") {
5180
- let e = Math.abs(q.x - K.x), t = Math.abs(q.y - K.y), n = Math.min(K.x, q.x), r = Math.min(K.y, q.y);
5181
- return t < 18 && (t = Math.max(18, t), r = K.y - 9), {
5199
+ if (G === "highlight") {
5200
+ 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);
5201
+ return t < 18 && (t = Math.max(18, t), r = q.y - 9), {
5182
5202
  id: "temp-live-drawing",
5183
5203
  type: "highlight",
5184
- pageIndex: Kt,
5204
+ pageIndex: Jt,
5185
5205
  x: n,
5186
5206
  y: r,
5187
5207
  width: e,
5188
5208
  height: t,
5189
- color: kt,
5190
- strokeWidth: Nt,
5191
- opacity: Vt
5209
+ color: Mt,
5210
+ strokeWidth: Bt,
5211
+ opacity: Ut
5192
5212
  };
5193
5213
  }
5194
- if (W === "redaction") {
5195
- let e = Math.abs(q.x - K.x), t = Math.abs(q.y - K.y), n = Math.min(K.x, q.x), r = Math.min(K.y, q.y);
5196
- return t < 18 && (t = Math.max(18, t), r = K.y - 9), {
5214
+ if (G === "redaction") {
5215
+ 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);
5216
+ return t < 18 && (t = Math.max(18, t), r = q.y - 9), {
5197
5217
  id: "temp-live-drawing",
5198
5218
  type: "rectangle",
5199
- pageIndex: Kt,
5219
+ pageIndex: Jt,
5200
5220
  x: n,
5201
5221
  y: r,
5202
5222
  width: e,
@@ -5213,66 +5233,67 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5213
5233
  "rectangle",
5214
5234
  "ellipse",
5215
5235
  "link"
5216
- ].includes(W)) {
5217
- let e = Math.abs(q.x - K.x), t = Math.abs(q.y - K.y), n = Math.min(K.x, q.x), r = Math.min(K.y, q.y);
5236
+ ].includes(G)) {
5237
+ 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);
5218
5238
  return {
5219
5239
  id: "temp-live-drawing",
5220
- type: W,
5221
- pageIndex: Kt,
5240
+ type: G,
5241
+ pageIndex: Jt,
5222
5242
  x: n,
5223
5243
  y: r,
5224
5244
  width: e,
5225
5245
  height: t,
5226
- points: W === "line" || W === "arrow" || W === "callout" ? [K, q] : void 0,
5227
- color: kt,
5228
- strokeWidth: Nt,
5229
- opacity: Vt
5246
+ points: G === "line" || G === "arrow" || G === "callout" ? [q, J] : void 0,
5247
+ color: Mt,
5248
+ strokeWidth: Bt,
5249
+ opacity: Ut
5230
5250
  };
5231
5251
  }
5232
5252
  })() : null;
5233
5253
  return t.map((n, r) => {
5234
- let s, c = j.current?.clientWidth || 0, l = Ye(n), u = Ye(t[0]).width * S, d = l.width * S;
5254
+ let s, c = A.current?.clientWidth || 0, l = Qe(n), u = Qe(t[0]).width * S, d = l.width * S;
5235
5255
  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);
5236
- let f = o && o.pageIndex === n ? [...U, o] : U;
5256
+ let f = o && o.pageIndex === n ? [...W, o] : W;
5237
5257
  return /* @__PURE__ */ I(e.Fragment, { children: [
5238
5258
  /* @__PURE__ */ F(St, {
5239
5259
  pageNum: n,
5240
- pdfDoc: M,
5260
+ pdfDoc: j,
5241
5261
  scale: S,
5242
- rotation: A,
5243
- containerWidth: j.current?.clientWidth || 0,
5244
- containerHeight: j.current?.clientHeight || 0,
5245
- scrollTop: Xe.top,
5246
- scrollLeft: Xe.left,
5262
+ rotation: k,
5263
+ containerWidth: A.current?.clientWidth || 0,
5264
+ containerHeight: A.current?.clientHeight || 0,
5265
+ scrollTop: $e.top,
5266
+ scrollLeft: $e.left,
5247
5267
  pageTop: i,
5248
5268
  pageLeft: s,
5249
5269
  basePageWidth: l.width,
5250
5270
  basePageHeight: l.height,
5251
5271
  activeTab: a,
5252
- activeTool: W,
5272
+ activeTool: G,
5253
5273
  annotations: f,
5254
- transientHighlights: _e?.filter((e) => e.pageIndex === n) || [],
5255
- selectedAnnotationId: Y,
5256
- activeSearchResult: Ue,
5257
- onMouseDown: Nn,
5258
- onMouseMove: Fn,
5259
- onMouseUp: In,
5260
- onAnnotationClick: Rn,
5261
- onAnnotationMouseEnter: Ln,
5274
+ transientHighlights: ye?.filter((e) => e.pageIndex === n) || [],
5275
+ selectedAnnotationId: X,
5276
+ activeSearchResult: Ge,
5277
+ onMouseDown: Fn,
5278
+ onMouseMove: Ln,
5279
+ onMouseUp: Rn,
5280
+ onAnnotationClick: Bn,
5281
+ onAnnotationMouseEnter: zn,
5262
5282
  onClearSelection: () => {
5263
- if (cn.current || on) {
5264
- cn.current = !1;
5283
+ if (ln.current || cn) {
5284
+ ln.current = !1;
5265
5285
  return;
5266
5286
  }
5267
- X(null), an(null);
5287
+ an(null), sn(null);
5268
5288
  },
5269
- watermark: ue,
5270
- watermarkText: de,
5271
- redactions: yn,
5272
- onDiscardRedaction: xn,
5273
- onRendered: Dn
5289
+ watermark: fe,
5290
+ watermarkText: pe,
5291
+ redactions: $,
5292
+ onDiscardRedaction: Cn,
5293
+ onRendered: kn,
5294
+ hideAnnotationsUntilPageRendered: xe
5274
5295
  }),
5275
- R.isActive && R.mode === "overlay" && ke && /* @__PURE__ */ F("div", {
5296
+ R.isActive && R.mode === "overlay" && Pe && /* @__PURE__ */ F("div", {
5276
5297
  style: {
5277
5298
  position: "absolute",
5278
5299
  top: `${i}px`,
@@ -5287,13 +5308,13 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5287
5308
  },
5288
5309
  children: /* @__PURE__ */ F(St, {
5289
5310
  pageNum: n,
5290
- pdfDoc: ke,
5311
+ pdfDoc: Pe,
5291
5312
  scale: S,
5292
- rotation: A,
5293
- containerWidth: j.current?.clientWidth || 0,
5294
- containerHeight: j.current?.clientHeight || 0,
5295
- scrollTop: Xe.top,
5296
- scrollLeft: Xe.left,
5313
+ rotation: k,
5314
+ containerWidth: A.current?.clientWidth || 0,
5315
+ containerHeight: A.current?.clientHeight || 0,
5316
+ scrollTop: $e.top,
5317
+ scrollLeft: $e.left,
5297
5318
  pageTop: 0,
5298
5319
  pageLeft: 0,
5299
5320
  basePageWidth: l.width,
@@ -5321,18 +5342,18 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5321
5342
  pointerEvents: "none",
5322
5343
  zIndex: 16
5323
5344
  },
5324
- children: /* @__PURE__ */ F(Pt, {
5345
+ children: /* @__PURE__ */ F(Nt, {
5325
5346
  boxes: [...R.pageDiffsA?.[n] || [], ...R.pageDiffsB?.[n] || []],
5326
5347
  scale: S,
5327
5348
  selectedDiffId: R.diffItems[R.currentDiffIndex]?.id,
5328
5349
  onSelectDiff: (e) => {
5329
5350
  let t = R.diffItems.findIndex((t) => t.id === e);
5330
- t !== -1 && bt(t);
5351
+ t !== -1 && Ot(t);
5331
5352
  }
5332
5353
  })
5333
5354
  }),
5334
- J && J.pageIndex === n && (() => {
5335
- let e = A % 180 == 0 ? l.width : l.height, t = A % 180 == 0 ? l.height : l.width, n = st(J.x, J.y, A, e, t);
5355
+ Y && Y.pageIndex === n && (() => {
5356
+ let e = k % 180 == 0 ? l.width : l.height, t = k % 180 == 0 ? l.height : l.width, n = _t(Y.x, Y.y, k, e, t);
5336
5357
  return /* @__PURE__ */ I("div", {
5337
5358
  style: {
5338
5359
  position: "absolute",
@@ -5346,19 +5367,19 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5346
5367
  flexDirection: "column"
5347
5368
  },
5348
5369
  children: [/* @__PURE__ */ F("textarea", {
5349
- ref: nn,
5350
- value: en,
5351
- onChange: (e) => tn(e.target.value),
5370
+ ref: rn,
5371
+ value: tn,
5372
+ onChange: (e) => nn(e.target.value),
5352
5373
  onBlur: (e) => {
5353
- e.currentTarget.parentElement?.contains(e.relatedTarget) || Pn();
5374
+ e.currentTarget.parentElement?.contains(e.relatedTarget) || In();
5354
5375
  },
5355
5376
  onKeyDown: (e) => {
5356
- e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Pn());
5377
+ e.key === "Enter" && !e.shiftKey && (e.preventDefault(), In());
5357
5378
  },
5358
5379
  style: {
5359
5380
  backgroundColor: "transparent",
5360
5381
  border: "none",
5361
- color: kt,
5382
+ color: Mt,
5362
5383
  fontSize: "16px",
5363
5384
  fontFamily: "sans-serif",
5364
5385
  minWidth: "150px",
@@ -5367,7 +5388,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5367
5388
  resize: "both",
5368
5389
  padding: "8px"
5369
5390
  },
5370
- placeholder: J.type === "note" ? "Note text..." : "Type text...",
5391
+ placeholder: Y.type === "note" ? "Note text..." : "Type text...",
5371
5392
  autoFocus: !0
5372
5393
  }), /* @__PURE__ */ F("div", {
5373
5394
  style: {
@@ -5378,7 +5399,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5378
5399
  },
5379
5400
  children: /* @__PURE__ */ F("button", {
5380
5401
  onMouseDown: (e) => {
5381
- e.preventDefault(), Pn();
5402
+ e.preventDefault(), In();
5382
5403
  },
5383
5404
  style: {
5384
5405
  padding: "4px 12px",
@@ -5397,28 +5418,28 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5397
5418
  ] }, n);
5398
5419
  });
5399
5420
  };
5400
- if (O === "continuous") return /* @__PURE__ */ F("div", {
5421
+ if (E === "continuous") return /* @__PURE__ */ F("div", {
5401
5422
  style: {
5402
5423
  position: "relative",
5403
5424
  width: "100%",
5404
- height: `${ct.total}px`
5425
+ height: `${U.total}px`
5405
5426
  },
5406
5427
  children: H.map((e, n) => t(e, n, !0))
5407
5428
  });
5408
5429
  {
5409
- let e = Math.max(0, H.findIndex((e) => e.includes(N))), n = H[e] || [];
5430
+ let e = Math.max(0, H.findIndex((e) => e.includes(M))), n = H[e] || [];
5410
5431
  return /* @__PURE__ */ F("div", {
5411
5432
  style: {
5412
5433
  position: "relative",
5413
5434
  width: "100%",
5414
- minHeight: `${ct.heights[e] ?? 0}px`
5435
+ minHeight: `${U.heights[e] ?? 0}px`
5415
5436
  },
5416
5437
  children: t(n, e, !1)
5417
5438
  });
5418
5439
  }
5419
5440
  })()
5420
5441
  }),
5421
- O === "page-by-page" && M && /* @__PURE__ */ I("div", {
5442
+ E === "page-by-page" && j && /* @__PURE__ */ I("div", {
5422
5443
  style: {
5423
5444
  position: "absolute",
5424
5445
  bottom: "16px",
@@ -5436,13 +5457,13 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5436
5457
  },
5437
5458
  children: [
5438
5459
  /* @__PURE__ */ F("button", {
5439
- onClick: () => we(Math.max(1, N - 1)),
5440
- disabled: N <= 1,
5460
+ onClick: () => De(Math.max(1, M - 1)),
5461
+ disabled: M <= 1,
5441
5462
  style: {
5442
5463
  background: "none",
5443
5464
  border: "none",
5444
- color: N <= 1 ? "#888" : "#fff",
5445
- cursor: N <= 1 ? "default" : "pointer",
5465
+ color: M <= 1 ? "#888" : "#fff",
5466
+ cursor: M <= 1 ? "default" : "pointer",
5446
5467
  display: "flex",
5447
5468
  alignItems: "center"
5448
5469
  },
@@ -5455,19 +5476,19 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5455
5476
  },
5456
5477
  children: [
5457
5478
  "Page ",
5458
- N,
5479
+ M,
5459
5480
  " of ",
5460
- M.numPages
5481
+ j.numPages
5461
5482
  ]
5462
5483
  }),
5463
5484
  /* @__PURE__ */ F("button", {
5464
- onClick: () => we(Math.min(M.numPages, N + 1)),
5465
- disabled: N >= M.numPages,
5485
+ onClick: () => De(Math.min(j.numPages, M + 1)),
5486
+ disabled: M >= j.numPages,
5466
5487
  style: {
5467
5488
  background: "none",
5468
5489
  border: "none",
5469
- color: N >= M.numPages ? "#888" : "#fff",
5470
- cursor: N >= M.numPages ? "default" : "pointer",
5490
+ color: M >= j.numPages ? "#888" : "#fff",
5491
+ cursor: M >= j.numPages ? "default" : "pointer",
5471
5492
  display: "flex",
5472
5493
  alignItems: "center"
5473
5494
  },
@@ -5475,7 +5496,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5475
5496
  })
5476
5497
  ]
5477
5498
  }),
5478
- !M && /* @__PURE__ */ F("div", {
5499
+ !j && /* @__PURE__ */ F("div", {
5479
5500
  style: {
5480
5501
  position: "absolute",
5481
5502
  top: 0,
@@ -5491,22 +5512,22 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5491
5512
  padding: "24px",
5492
5513
  textAlign: "center"
5493
5514
  },
5494
- children: Se ? /* @__PURE__ */ I(Ne, { children: [/* @__PURE__ */ F("div", {
5515
+ children: Te ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", {
5495
5516
  style: {
5496
5517
  fontWeight: 600,
5497
5518
  color: "var(--text-color)"
5498
5519
  },
5499
- children: Se.name === "PasswordException" ? "This document is password protected." : "The document could not be loaded."
5520
+ children: Te.name === "PasswordException" ? "This document is password protected." : "The document could not be loaded."
5500
5521
  }), /* @__PURE__ */ F("div", {
5501
5522
  style: {
5502
5523
  fontSize: "12px",
5503
5524
  maxWidth: "480px",
5504
5525
  wordBreak: "break-word"
5505
5526
  },
5506
- children: Se.message
5527
+ children: Te.message
5507
5528
  })] }) : d ? "Loading document…" : "No document loaded."
5508
5529
  }),
5509
- M && /* @__PURE__ */ I("div", {
5530
+ j && /* @__PURE__ */ I("div", {
5510
5531
  style: {
5511
5532
  position: "absolute",
5512
5533
  bottom: "24px",
@@ -5525,13 +5546,13 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5525
5546
  },
5526
5547
  children: [
5527
5548
  /* @__PURE__ */ F("button", {
5528
- onClick: () => _t(Math.max(1, N - 1)),
5529
- disabled: N <= 1,
5549
+ onClick: () => yt(Math.max(1, M - 1)),
5550
+ disabled: M <= 1,
5530
5551
  style: {
5531
5552
  background: "none",
5532
5553
  border: "none",
5533
- color: N <= 1 ? "rgba(255,255,255,0.3)" : "white",
5534
- cursor: N <= 1 ? "default" : "pointer",
5554
+ color: M <= 1 ? "rgba(255,255,255,0.3)" : "white",
5555
+ cursor: M <= 1 ? "default" : "pointer",
5535
5556
  display: "flex",
5536
5557
  padding: 0
5537
5558
  },
@@ -5546,19 +5567,19 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5546
5567
  },
5547
5568
  children: [
5548
5569
  "Page ",
5549
- N,
5570
+ M,
5550
5571
  " / ",
5551
- M.numPages
5572
+ j.numPages
5552
5573
  ]
5553
5574
  }),
5554
5575
  /* @__PURE__ */ F("button", {
5555
- onClick: () => _t(Math.min(M.numPages, N + 1)),
5556
- disabled: N >= M.numPages,
5576
+ onClick: () => yt(Math.min(j.numPages, M + 1)),
5577
+ disabled: M >= j.numPages,
5557
5578
  style: {
5558
5579
  background: "none",
5559
5580
  border: "none",
5560
- color: N >= M.numPages ? "rgba(255,255,255,0.3)" : "white",
5561
- cursor: N >= M.numPages ? "default" : "pointer",
5581
+ color: M >= j.numPages ? "rgba(255,255,255,0.3)" : "white",
5582
+ cursor: M >= j.numPages ? "default" : "pointer",
5562
5583
  display: "flex",
5563
5584
  padding: 0
5564
5585
  },
@@ -5566,11 +5587,11 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5566
5587
  })
5567
5588
  ]
5568
5589
  }),
5569
- Y && rn && /* @__PURE__ */ F(He, {
5570
- annotation: U.find((e) => e.id === Y),
5571
- position: rn,
5590
+ X && on && /* @__PURE__ */ F(et, {
5591
+ annotation: W.find((e) => e.id === X),
5592
+ position: on,
5572
5593
  onCopy: () => {
5573
- let e = U.find((e) => e.id === Y);
5594
+ let e = W.find((e) => e.id === X);
5574
5595
  if (e) {
5575
5596
  let t = {
5576
5597
  ...e,
@@ -5584,56 +5605,56 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5584
5605
  x: e.x + 20,
5585
5606
  y: e.y + 20
5586
5607
  };
5587
- Q([...U, t]);
5608
+ Q([...W, t]);
5588
5609
  }
5589
- X(null), an(null);
5610
+ an(null), sn(null);
5590
5611
  },
5591
5612
  onDelete: () => {
5592
- Q(U.filter((e) => e.id !== Y)), X(null), an(null);
5613
+ Q(W.filter((e) => e.id !== X)), an(null), sn(null);
5593
5614
  },
5594
5615
  onUpdateColor: (e) => {
5595
- Q(U.map((t) => t.id === Y ? {
5616
+ Q(W.map((t) => t.id === X ? {
5596
5617
  ...t,
5597
5618
  color: e
5598
5619
  } : t));
5599
5620
  },
5600
5621
  onOpenLinkModal: () => {
5601
- sn(!0), an(null);
5622
+ Z(!0), sn(null);
5602
5623
  },
5603
- permissions: ve
5624
+ permissions: be
5604
5625
  }),
5605
- R.isActive && R.showCurtain && /* @__PURE__ */ F(Rt, {
5626
+ R.isActive && R.showCurtain && /* @__PURE__ */ F(Lt, {
5606
5627
  positionPercent: R.curtainPosition,
5607
5628
  onChangePosition: (e) => z((t) => ({
5608
5629
  ...t,
5609
5630
  curtainPosition: e
5610
5631
  })),
5611
- containerRef: j
5632
+ containerRef: A
5612
5633
  })
5613
5634
  ]
5614
- })] }), R.isActive && /* @__PURE__ */ F(Lt, {
5615
- isOpen: B,
5616
- onClose: () => Ie(!1),
5635
+ })] }), R.isActive && /* @__PURE__ */ F(It, {
5636
+ isOpen: ze,
5637
+ onClose: () => Be(!1),
5617
5638
  diffItems: R.diffItems,
5618
- textDiffs: Pe,
5639
+ textDiffs: B,
5619
5640
  currentDiffIndex: R.currentDiffIndex,
5620
- onSelectDiff: (e, t) => bt(e, t),
5621
- onJumpToPage: (e) => _t(e)
5641
+ onSelectDiff: (e, t) => Ot(e, t),
5642
+ onJumpToPage: (e) => yt(e)
5622
5643
  })]
5623
5644
  })
5624
5645
  ]
5625
5646
  }),
5626
- on && Y && /* @__PURE__ */ F(We, {
5627
- initialUrl: U.find((e) => e.id === Y)?.linkUrl || "",
5628
- initialText: U.find((e) => e.id === Y)?.text || "",
5629
- showTextInput: !U.find((e) => e.id === Y)?.width || U.find((e) => e.id === Y)?.text === "" || U.find((e) => e.id === Y)?.text !== void 0,
5647
+ cn && X && /* @__PURE__ */ F(nt, {
5648
+ initialUrl: W.find((e) => e.id === X)?.linkUrl || "",
5649
+ initialText: W.find((e) => e.id === X)?.text || "",
5650
+ showTextInput: !W.find((e) => e.id === X)?.width || W.find((e) => e.id === X)?.text === "" || W.find((e) => e.id === X)?.text !== void 0,
5630
5651
  onClose: () => {
5631
- let e = U.find((e) => e.id === Y);
5632
- e && !e.linkUrl && Q(U.filter((e) => e.id !== Y)), sn(!1), X(null);
5652
+ let e = W.find((e) => e.id === X);
5653
+ e && !e.linkUrl && Q(W.filter((e) => e.id !== X)), Z(!1), an(null);
5633
5654
  },
5634
5655
  onSave: (e, t) => {
5635
- Q(U.map((n) => {
5636
- if (n.id === Y) {
5656
+ Q(W.map((n) => {
5657
+ if (n.id === X) {
5637
5658
  let r = t === void 0 ? n.text : t, i = r ? Math.max(100, r.length * 8 + 20) : n.width;
5638
5659
  return {
5639
5660
  ...n,
@@ -5643,27 +5664,27 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
5643
5664
  };
5644
5665
  }
5645
5666
  return n;
5646
- })), sn(!1), X(null);
5667
+ })), Z(!1), an(null);
5647
5668
  }
5648
5669
  }),
5649
- _ && /* @__PURE__ */ F(rt, {
5670
+ _ && /* @__PURE__ */ F(pt, {
5650
5671
  isOpen: r,
5651
- activeTab: te,
5652
- setActiveTab: ne,
5653
- annotations: U,
5672
+ activeTab: ne,
5673
+ setActiveTab: re,
5674
+ annotations: W,
5654
5675
  setAnnotations: Q,
5655
- selectedAnnotationId: Y,
5656
- setSelectedAnnotationId: X,
5657
- onSearch: Sn,
5658
- searchResults: Cn,
5659
- isSearching: wn,
5660
- searchProgress: Tn,
5661
- onResultClick: vt
5676
+ selectedAnnotationId: X,
5677
+ setSelectedAnnotationId: an,
5678
+ onSearch: wn,
5679
+ searchResults: Tn,
5680
+ isSearching: En,
5681
+ searchProgress: Dn,
5682
+ onResultClick: xt
5662
5683
  })
5663
5684
  ]
5664
5685
  });
5665
5686
  }
5666
- function Jt({ icon: e, active: t, onClick: n, label: r }) {
5687
+ function qt({ icon: e, active: t, onClick: n, label: r }) {
5667
5688
  return /* @__PURE__ */ F("button", {
5668
5689
  onClick: n,
5669
5690
  title: r,
@@ -5690,8 +5711,8 @@ function Jt({ icon: e, active: t, onClick: n, label: r }) {
5690
5711
  }
5691
5712
  //#endregion
5692
5713
  //#region src/components/SettingsModal.tsx
5693
- function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
5694
- let { shortcuts: r, updateShortcut: i, resetShortcuts: a } = Qe(), [s, l] = c("Keyboard Shortcuts"), [u, d] = c(null), [f, p] = c(""), m = (e, t) => {
5714
+ function Jt({ onClose: e, watermarkText: t, setWatermarkText: n }) {
5715
+ let { shortcuts: r, updateShortcut: i, resetShortcuts: a } = ct(), [s, l] = c("Keyboard Shortcuts"), [u, d] = c(null), [f, p] = c(""), m = (e, t) => {
5695
5716
  if (e.preventDefault(), e.stopPropagation(), e.key === "Escape") {
5696
5717
  d(null);
5697
5718
  return;
@@ -5717,7 +5738,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
5717
5738
  },
5718
5739
  children: "None"
5719
5740
  });
5720
- let t = $e(e), n = typeof navigator < "u" && /mac/i.test(navigator.platform || navigator.userAgent || ""), r = [];
5741
+ let t = lt(e), n = typeof navigator < "u" && /mac/i.test(navigator.platform || navigator.userAgent || ""), r = [];
5721
5742
  if (t.meta && r.push(n ? "⌘" : "Ctrl"), t.alt && r.push(n ? "⌥" : "Alt"), t.shift && r.push(n ? "⇧" : "Shift"), t.key) {
5722
5743
  let e = t.key.toUpperCase();
5723
5744
  e === "DELETE" && (e = n ? "⌫ Delete" : "Del"), r.push(e);
@@ -5807,7 +5828,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
5807
5828
  display: "flex",
5808
5829
  padding: "4px"
5809
5830
  },
5810
- children: /* @__PURE__ */ F(P, { size: 20 })
5831
+ children: /* @__PURE__ */ F(N, { size: 20 })
5811
5832
  })]
5812
5833
  }),
5813
5834
  /* @__PURE__ */ F("div", {
@@ -5819,7 +5840,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
5819
5840
  children: /* @__PURE__ */ I("div", {
5820
5841
  style: { position: "relative" },
5821
5842
  children: [
5822
- /* @__PURE__ */ F(Ee, {
5843
+ /* @__PURE__ */ F(De, {
5823
5844
  size: 16,
5824
5845
  color: "var(--text-muted)",
5825
5846
  style: {
@@ -5860,7 +5881,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
5860
5881
  padding: 0
5861
5882
  },
5862
5883
  title: "Clear search",
5863
- children: /* @__PURE__ */ F(P, { size: 15 })
5884
+ children: /* @__PURE__ */ F(N, { size: 15 })
5864
5885
  })
5865
5886
  ]
5866
5887
  })
@@ -5943,7 +5964,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
5943
5964
  cursor: "pointer"
5944
5965
  },
5945
5966
  title: "Reset all shortcuts to defaults",
5946
- children: [/* @__PURE__ */ F(Ce, { size: 13 }), "Reset to Defaults"]
5967
+ children: [/* @__PURE__ */ F(we, { size: 13 }), "Reset to Defaults"]
5947
5968
  })]
5948
5969
  }), v.length === 0 ? /* @__PURE__ */ I("div", {
5949
5970
  style: {
@@ -6066,7 +6087,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
6066
6087
  padding: "2px"
6067
6088
  },
6068
6089
  title: "Cancel",
6069
- children: /* @__PURE__ */ F(P, { size: 14 })
6090
+ children: /* @__PURE__ */ F(N, { size: 14 })
6070
6091
  })]
6071
6092
  }) : g(e.command)
6072
6093
  }),
@@ -6104,7 +6125,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
6104
6125
  fontSize: "12px"
6105
6126
  },
6106
6127
  title: "Edit shortcut",
6107
- children: [/* @__PURE__ */ F(ne, { size: 13 }), " Edit"]
6128
+ children: [/* @__PURE__ */ F(re, { size: 13 }), " Edit"]
6108
6129
  })
6109
6130
  })
6110
6131
  ]
@@ -6263,7 +6284,7 @@ function Yt({ onClose: e }) {
6263
6284
  alignItems: "center",
6264
6285
  gap: "8px"
6265
6286
  },
6266
- children: [/* @__PURE__ */ F(se, {
6287
+ children: [/* @__PURE__ */ F(E, {
6267
6288
  size: 20,
6268
6289
  color: "#2b76b9"
6269
6290
  }), /* @__PURE__ */ F("h2", {
@@ -6283,7 +6304,7 @@ function Yt({ onClose: e }) {
6283
6304
  cursor: "pointer",
6284
6305
  color: "#6b7280"
6285
6306
  },
6286
- children: /* @__PURE__ */ F(P, { size: 20 })
6307
+ children: /* @__PURE__ */ F(N, { size: 20 })
6287
6308
  })]
6288
6309
  }),
6289
6310
  /* @__PURE__ */ I("div", {
@@ -6483,21 +6504,21 @@ var q = class {
6483
6504
  return this.destroyed;
6484
6505
  }
6485
6506
  }, Xt = (e) => e === 0 ? 0 : e;
6486
- function Zt(e, t) {
6507
+ function J(e, t) {
6487
6508
  return {
6488
6509
  x: Xt(e.x * t[0] + e.y * t[2] + t[4]),
6489
6510
  y: Xt(e.x * t[1] + e.y * t[3] + t[5])
6490
6511
  };
6491
6512
  }
6492
- function Qt(e, t) {
6513
+ function Zt(e, t) {
6493
6514
  let n = t[0] * t[3] - t[1] * t[2];
6494
6515
  return {
6495
6516
  x: Xt((e.x * t[3] - e.y * t[2] + t[2] * t[5] - t[4] * t[3]) / n),
6496
6517
  y: Xt((-e.x * t[1] + e.y * t[0] + t[4] * t[1] - t[5] * t[0]) / n)
6497
6518
  };
6498
6519
  }
6499
- function J(e, t, n) {
6500
- let r = lt(n), [i, a, o, s] = t, c = (o + i) / 2, l = (s + a) / 2, u, d, f, p;
6520
+ function Qt(e, t, n) {
6521
+ let r = bt(n), [i, a, o, s] = t, c = (o + i) / 2, l = (s + a) / 2, u, d, f, p;
6501
6522
  switch (r) {
6502
6523
  case 180:
6503
6524
  u = -1, d = 0, f = 0, p = 1;
@@ -6536,31 +6557,31 @@ function J(e, t, n) {
6536
6557
  }
6537
6558
  function $t(e) {
6538
6559
  let t = e.view;
6539
- return J(e.pageNumber, [
6560
+ return Qt(e.pageNumber, [
6540
6561
  t[0],
6541
6562
  t[1],
6542
6563
  t[2],
6543
6564
  t[3]
6544
6565
  ], e.rotate);
6545
6566
  }
6546
- function en(e) {
6567
+ function Y(e) {
6547
6568
  let t = /* @__PURE__ */ new Map();
6548
6569
  return (n) => {
6549
6570
  let r = Math.max(1, Math.min(e.numPages, n)), i = t.get(r);
6550
6571
  return i || (i = e.getPage(r).then($t), t.set(r, i)), i;
6551
6572
  };
6552
6573
  }
6574
+ function en(e, t) {
6575
+ return Zt(t, e.transform);
6576
+ }
6553
6577
  function tn(e, t) {
6554
- return Qt(t, e.transform);
6578
+ return J(t, e.transform);
6555
6579
  }
6556
6580
  function nn(e, t) {
6557
- return Zt(t, e.transform);
6558
- }
6559
- function Y(e, t) {
6560
- let n = tn(e, {
6581
+ let n = en(e, {
6561
6582
  x: t.x,
6562
6583
  y: t.y
6563
- }), r = tn(e, {
6584
+ }), r = en(e, {
6564
6585
  x: t.x + t.width,
6565
6586
  y: t.y + t.height
6566
6587
  });
@@ -6571,11 +6592,11 @@ function Y(e, t) {
6571
6592
  Math.max(n.y, r.y)
6572
6593
  ];
6573
6594
  }
6574
- function X(e, t) {
6575
- let n = nn(e, {
6595
+ function rn(e, t) {
6596
+ let n = tn(e, {
6576
6597
  x: t[0],
6577
6598
  y: t[1]
6578
- }), r = nn(e, {
6599
+ }), r = tn(e, {
6579
6600
  x: t[2],
6580
6601
  y: t[3]
6581
6602
  });
@@ -6586,14 +6607,14 @@ function X(e, t) {
6586
6607
  height: Math.abs(r.y - n.y)
6587
6608
  };
6588
6609
  }
6589
- function rn(e, t) {
6590
- return t.map((t) => tn(e, t));
6610
+ function X(e, t) {
6611
+ return t.map((t) => en(e, t));
6591
6612
  }
6592
6613
  function an(e, t) {
6593
- return t.map((t) => nn(e, t));
6614
+ return t.map((t) => tn(e, t));
6594
6615
  }
6595
6616
  function on(e, t) {
6596
- let [n, r, i, a] = Y(e, t);
6617
+ let [n, r, i, a] = nn(e, t);
6597
6618
  return [
6598
6619
  n,
6599
6620
  a,
@@ -6619,7 +6640,7 @@ function sn(e, t) {
6619
6640
  t[r + 5],
6620
6641
  t[r + 7]
6621
6642
  ];
6622
- n.push(X(e, [
6643
+ n.push(rn(e, [
6623
6644
  Math.min(...i),
6624
6645
  Math.min(...a),
6625
6646
  Math.max(...i),
@@ -6648,12 +6669,12 @@ var Z = (e) => (Math.round(e * 1e3) / 1e3).toString(), ln = 524288e3, un = (e) =
6648
6669
  return B(n, r, i);
6649
6670
  };
6650
6671
  async function dn(e, t, n, r, i) {
6651
- let a = un(r.color), o = r.opacity ?? 1, s = r.strokeWidth || 1, [c, l, u, d] = Y(n, {
6672
+ let a = un(r.color), o = r.opacity ?? 1, s = r.strokeWidth || 1, [c, l, u, d] = nn(n, {
6652
6673
  x: r.x,
6653
6674
  y: r.y,
6654
6675
  width: r.width,
6655
6676
  height: r.height
6656
- }), f = u - c, p = d - l, m = Fe(n.rotate), h = (e, t, r) => tn(n, {
6677
+ }), f = u - c, p = d - l, m = z(n.rotate), h = (e, t, r) => en(n, {
6657
6678
  x: e,
6658
6679
  y: t + r
6659
6680
  });
@@ -6692,7 +6713,7 @@ async function dn(e, t, n, r, i) {
6692
6713
  height: r.height
6693
6714
  }];
6694
6715
  for (let r of e) {
6695
- let [e, i, s, c] = Y(n, r);
6716
+ let [e, i, s, c] = nn(n, r);
6696
6717
  t.drawRectangle({
6697
6718
  x: e,
6698
6719
  y: i,
@@ -6700,7 +6721,7 @@ async function dn(e, t, n, r, i) {
6700
6721
  height: c - i,
6701
6722
  color: a,
6702
6723
  opacity: o < 1 ? o : .5,
6703
- blendMode: R.Multiply
6724
+ blendMode: Pe.Multiply
6704
6725
  });
6705
6726
  }
6706
6727
  return;
@@ -6713,7 +6734,7 @@ async function dn(e, t, n, r, i) {
6713
6734
  }, {
6714
6735
  x: r.x + r.width,
6715
6736
  y: r.y + r.height
6716
- }], [i, c] = rn(n, [e[0], e[1]]);
6737
+ }], [i, c] = X(n, [e[0], e[1]]);
6717
6738
  if (t.drawLine({
6718
6739
  start: i,
6719
6740
  end: c,
@@ -6721,7 +6742,7 @@ async function dn(e, t, n, r, i) {
6721
6742
  opacity: o,
6722
6743
  thickness: s
6723
6744
  }), r.type === "arrow") {
6724
- let r = e[0], i = e[1], l = Math.atan2(i.y - r.y, i.x - r.x), u = 15 + s, [d, f] = rn(n, [{
6745
+ 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, [{
6725
6746
  x: i.x - u * Math.cos(l - Math.PI / 6),
6726
6747
  y: i.y - u * Math.sin(l - Math.PI / 6)
6727
6748
  }, {
@@ -6747,7 +6768,7 @@ async function dn(e, t, n, r, i) {
6747
6768
  case "freehand": {
6748
6769
  let e = r.strokes && r.strokes.length > 0 ? r.strokes : r.points ? [r.points] : [];
6749
6770
  for (let r of e) {
6750
- let e = rn(n, r);
6771
+ let e = X(n, r);
6751
6772
  for (let n = 1; n < e.length; n++) t.drawLine({
6752
6773
  start: e[n - 1],
6753
6774
  end: e[n],
@@ -6773,7 +6794,7 @@ async function dn(e, t, n, r, i) {
6773
6794
  return;
6774
6795
  }
6775
6796
  case "note": {
6776
- let [e, i, c, l] = Y(n, {
6797
+ let [e, i, c, l] = nn(n, {
6777
6798
  x: r.x,
6778
6799
  y: r.y,
6779
6800
  width: 24,
@@ -6807,7 +6828,7 @@ async function dn(e, t, n, r, i) {
6807
6828
  }, {
6808
6829
  x: r.x,
6809
6830
  y: r.y
6810
- }], [i, c] = rn(n, [e[0], e[1]]);
6831
+ }], [i, c] = X(n, [e[0], e[1]]);
6811
6832
  if (t.drawLine({
6812
6833
  start: i,
6813
6834
  end: c,
@@ -6815,7 +6836,7 @@ async function dn(e, t, n, r, i) {
6815
6836
  opacity: o,
6816
6837
  thickness: s
6817
6838
  }), r.text) {
6818
- let i = r.text.length * 8 + 20, [c, l, u, d] = Y(n, {
6839
+ let i = r.text.length * 8 + 20, [c, l, u, d] = nn(n, {
6819
6840
  x: e[1].x,
6820
6841
  y: e[1].y,
6821
6842
  width: i,
@@ -6909,7 +6930,7 @@ async function dn(e, t, n, r, i) {
6909
6930
  }
6910
6931
  }
6911
6932
  async function fn(e, t) {
6912
- let n = un(t.color || "#737373"), r = t.opacity ?? .08, i = await e.embedFont(Pe.Helvetica), a = -Math.PI / 4, o = Math.cos(a), s = Math.sin(a);
6933
+ let n = un(t.color || "#737373"), r = t.opacity ?? .08, i = await e.embedFont(R.Helvetica), a = -Math.PI / 4, o = Math.cos(a), s = Math.sin(a);
6913
6934
  for (let a of e.getPages()) {
6914
6935
  let { width: e, height: c } = a.getSize();
6915
6936
  if (t.mode === "single") {
@@ -6921,7 +6942,7 @@ async function fn(e, t) {
6921
6942
  font: i,
6922
6943
  color: n,
6923
6944
  opacity: r,
6924
- rotate: Fe(-45)
6945
+ rotate: z(-45)
6925
6946
  });
6926
6947
  } else {
6927
6948
  let l = t.size || 18, u = i.widthOfTextAtSize(t.text, l), d = u + 150, f = -u / 2, p = -l * .35, m = f * o - p * s, h = f * s + p * o;
@@ -6934,17 +6955,17 @@ async function fn(e, t) {
6934
6955
  font: i,
6935
6956
  color: n,
6936
6957
  opacity: r,
6937
- rotate: Fe(-45)
6958
+ rotate: z(-45)
6938
6959
  });
6939
6960
  }
6940
6961
  }
6941
6962
  }
6942
6963
  }
6943
- async function Q(e, t) {
6964
+ async function pn(e, t) {
6944
6965
  let n = await e.save(), r = L.getDocument({
6945
6966
  data: n,
6946
- ...Mt()
6947
- }), i = await r.promise, a = await z.create();
6967
+ ...jt()
6968
+ }), i = await r.promise, a = await Fe.create();
6948
6969
  try {
6949
6970
  for (let n = 1; n <= i.numPages; n++) {
6950
6971
  let r = t.filter((e) => e.pageIndex === n);
@@ -6980,18 +7001,18 @@ async function Q(e, t) {
6980
7001
  }
6981
7002
  return a;
6982
7003
  }
6983
- async function pn(e, t = {}) {
7004
+ async function mn(e, t = {}) {
6984
7005
  t.xfdfString && console.warn("[teamsync-pdf-viewer] getFileData({ xfdfString }) is ignored; import the XFDF through annotationManager.importAnnotations() first.");
6985
7006
  let n = await e.getSourceBytes(), r = n instanceof Uint8Array ? n : new Uint8Array(n);
6986
7007
  if (r.byteLength > 524288e3) {
6987
7008
  let e = (r.byteLength / 1048576).toFixed(2);
6988
7009
  throw Error(`File is too large (${e} MB) to save directly in the browser. Use exportAnnotations() to save annotation data and apply it on your server.`);
6989
7010
  }
6990
- let i = await z.load(r, { ignoreEncryption: !0 }), a = i.getPages(), o = t.explicitAnnotations || e.annotations, s = e.getPageGeometry, c = null;
7011
+ let i = await Fe.load(r, { ignoreEncryption: !0 }), a = i.getPages(), o = t.explicitAnnotations || e.annotations, s = e.getPageGeometry, c = null;
6991
7012
  !s && o.length > 0 && (c = L.getDocument({
6992
7013
  data: r.slice(),
6993
- ...Mt()
6994
- }), s = en(await c.promise));
7014
+ ...jt()
7015
+ }), s = Y(await c.promise));
6995
7016
  try {
6996
7017
  for (let t of o) {
6997
7018
  let n = Math.max(0, Math.min((t.pageIndex || 1) - 1, a.length - 1)), r = await s(n + 1);
@@ -7002,11 +7023,11 @@ async function pn(e, t = {}) {
7002
7023
  }
7003
7024
  e.watermark?.text && await fn(i, e.watermark);
7004
7025
  let l = e.redactions || [];
7005
- return await (l.length > 0 ? await Q(i, l) : i).save();
7026
+ return await (l.length > 0 ? await pn(i, l) : i).save();
7006
7027
  }
7007
7028
  //#endregion
7008
7029
  //#region src/annotations/xfdf.ts
7009
- var mn = "http://ns.adobe.com/xfdf/", hn = "tspdf", gn = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
7030
+ var Q = "http://ns.adobe.com/xfdf/", hn = "tspdf", gn = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
7010
7031
  function _n(e, t = 2) {
7011
7032
  return String(e).padStart(t, "0");
7012
7033
  }
@@ -7097,7 +7118,7 @@ var Dn = /* @__PURE__ */ new Set([
7097
7118
  "vertices"
7098
7119
  ]);
7099
7120
  function kn(e, t, n, r) {
7100
- let i = r ?? Y(t, {
7121
+ let i = r ?? nn(t, {
7101
7122
  x: e.x,
7102
7123
  y: e.y,
7103
7124
  width: e.width,
@@ -7134,7 +7155,7 @@ async function Fn(e, t, n = {}) {
7134
7155
  }, {
7135
7156
  x: e.x + e.width,
7136
7157
  y: e.y + e.height
7137
- }], [n, i] = rn(r, [t[0], t[1]]), a = [
7158
+ }], [n, i] = X(r, [t[0], t[1]]), a = [
7138
7159
  Math.min(n.x, i.x),
7139
7160
  Math.min(n.y, i.y),
7140
7161
  Math.max(n.x, i.x),
@@ -7143,8 +7164,8 @@ async function Fn(e, t, n = {}) {
7143
7164
  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>`;
7144
7165
  }
7145
7166
  case "freehand": {
7146
- let t = e.strokes && e.strokes.length > 0 ? e.strokes : e.points ? [e.points] : [], n = t.map((e) => `<gesture>${Cn(rn(r, e))}</gesture>`).join(""), i = t.flat();
7147
- return `<ink${s(i.length ? Y(r, In(i, e.strokeWidth)) : void 0)}${o} subject="Free Hand"><inklist>${n}</inklist>${c()}</ink>`;
7167
+ let t = e.strokes && e.strokes.length > 0 ? e.strokes : e.points ? [e.points] : [], n = t.map((e) => `<gesture>${Cn(X(r, e))}</gesture>`).join(""), i = t.flat();
7168
+ return `<ink${s(i.length ? nn(r, In(i, e.strokeWidth)) : void 0)}${o} subject="Free Hand"><inklist>${n}</inklist>${c()}</ink>`;
7148
7169
  }
7149
7170
  case "highlight": {
7150
7171
  let t = e.rects && e.rects.length > 0 ? e.rects : [{
@@ -7153,7 +7174,7 @@ async function Fn(e, t, n = {}) {
7153
7174
  width: e.width,
7154
7175
  height: e.height
7155
7176
  }], n = t.flatMap((e) => on(r, e)).map(Z).join(",");
7156
- return `<highlight${s(Y(r, cn(t)))}${$("color", a)} coords="${n}" subject="Highlight">${c()}</highlight>`;
7177
+ return `<highlight${s(nn(r, cn(t)))}${$("color", a)} coords="${n}" subject="Highlight">${c()}</highlight>`;
7157
7178
  }
7158
7179
  case "text": return `<freetext${s()}${$("color", a)} subject="Free Text">${Nn(e.text)}${Pn(e, 16)}${c()}</freetext>`;
7159
7180
  case "callout": {
@@ -7163,7 +7184,7 @@ async function Fn(e, t, n = {}) {
7163
7184
  }, {
7164
7185
  x: e.x,
7165
7186
  y: e.y
7166
- }], [n, i] = rn(r, [t[0], t[1]]), a = Y(r, {
7187
+ }], [n, i] = X(r, [t[0], t[1]]), a = nn(r, {
7167
7188
  x: t[1].x,
7168
7189
  y: t[1].y,
7169
7190
  width: e.text ? e.text.length * 8 + 20 : 100,
@@ -7176,7 +7197,7 @@ async function Fn(e, t, n = {}) {
7176
7197
  Math.max(i.y, a[3])
7177
7198
  ])}${o} IT="FreeTextCallout" callout="${Z(n.x)},${Z(n.y)},${Z(i.x)},${Z(i.y)}" subject="Callout">${Nn(e.text)}${Pn(e, 14)}${c({ box: a })}</freetext>`;
7178
7199
  }
7179
- case "note": return `<text${s(Y(r, {
7200
+ case "note": return `<text${s(nn(r, {
7180
7201
  x: e.x,
7181
7202
  y: e.y,
7182
7203
  width: 24,
@@ -7210,7 +7231,7 @@ function In(e, t = 0) {
7210
7231
  }
7211
7232
  async function Ln(e, t, n = {}) {
7212
7233
  let r = n.annotList ?? e;
7213
- return `<?xml version="1.0" encoding="UTF-8"?><xfdf xmlns="${mn}" xml:space="preserve"><annots>${(await Promise.all(r.map((e) => Fn(e, t, n)))).filter(Boolean).join("")}</annots></xfdf>`;
7234
+ return `<?xml version="1.0" encoding="UTF-8"?><xfdf xmlns="${Q}" xml:space="preserve"><annots>${(await Promise.all(r.map((e) => Fn(e, t, n)))).filter(Boolean).join("")}</annots></xfdf>`;
7214
7235
  }
7215
7236
  function Rn(e) {
7216
7237
  let t = {};
@@ -7234,7 +7255,7 @@ function zn(e, t) {
7234
7255
  return Array.from(e.children).find((e) => e.localName === t)?.textContent ?? void 0;
7235
7256
  }
7236
7257
  function Bn(e, t) {
7237
- let n = Tn(e.getAttribute("rect")), r = n.length === 4 ? X(t, [
7258
+ let n = Tn(e.getAttribute("rect")), r = n.length === 4 ? rn(t, [
7238
7259
  n[0],
7239
7260
  n[1],
7240
7261
  n[2],
@@ -7412,7 +7433,7 @@ async function Un(e, t) {
7412
7433
  let n = Hn(e).trim();
7413
7434
  if (!n) return [];
7414
7435
  if (/<!DOCTYPE|<!ENTITY/i.test(n)) throw Error("[teamsync-pdf-viewer] invalid XFDF: DOCTYPE/ENTITY declarations are not allowed");
7415
- let r = `<xfdf xmlns="${mn}"><annots>${n}</annots></xfdf>`, i = new DOMParser().parseFromString(r, "application/xml"), a = i.getElementsByTagName("parsererror")[0];
7436
+ let r = `<xfdf xmlns="${Q}"><annots>${n}</annots></xfdf>`, i = new DOMParser().parseFromString(r, "application/xml"), a = i.getElementsByTagName("parsererror")[0];
7416
7437
  if (a) throw Error(`[teamsync-pdf-viewer] invalid XFDF: ${a.textContent?.slice(0, 200)}`);
7417
7438
  let o = /* @__PURE__ */ new Set([
7418
7439
  "xfdf",
@@ -7440,7 +7461,7 @@ var Wn = 100, Gn = () => (/* @__PURE__ */ new Date()).toISOString(), Kn = class
7440
7461
  canEditOthers = !1;
7441
7462
  resolver = null;
7442
7463
  setDocument(e) {
7443
- this.resolver = e ? en(e) : null;
7464
+ this.resolver = e ? Y(e) : null;
7444
7465
  }
7445
7466
  hasDocument() {
7446
7467
  return this.resolver !== null;
@@ -7732,7 +7753,7 @@ var Wn = 100, Gn = () => (/* @__PURE__ */ new Date()).toISOString(), Kn = class
7732
7753
  let t = this.getPdfDocument();
7733
7754
  if (!t) return [];
7734
7755
  let n = this.binding;
7735
- return tt(t, e, n ? n.getRedactions() : []);
7756
+ return dt(t, e, n ? n.getRedactions() : []);
7736
7757
  }
7737
7758
  getTransientHighlights() {
7738
7759
  return this.binding?.getTransientHighlights() ?? [];
@@ -7771,14 +7792,14 @@ var Wn = 100, Gn = () => (/* @__PURE__ */ new Date()).toISOString(), Kn = class
7771
7792
  async getFileData(e = {}) {
7772
7793
  let t = this.binding ?? qn(), n = t.getPdfDocument(), r = t.getDocumentUrl();
7773
7794
  if (!n && !r) throw Error("No document loaded");
7774
- return pn({
7795
+ return mn({
7775
7796
  getSourceBytes: async () => {
7776
7797
  if (n) return n.getData();
7777
7798
  let e = await fetch(r);
7778
7799
  if (!e.ok) throw Error(`Failed to fetch document (${e.status})`);
7779
7800
  return e.arrayBuffer();
7780
7801
  },
7781
- getPageGeometry: n ? en(n) : void 0,
7802
+ getPageGeometry: n ? Y(n) : void 0,
7782
7803
  annotations: this.annotationManager.getAnnotationsList(),
7783
7804
  redactions: t.getRedactions(),
7784
7805
  watermark: t.getWatermark(),
@@ -7863,19 +7884,19 @@ async function Yn(e, t = {}) {
7863
7884
  //#endregion
7864
7885
  //#region src/components/TeamSyncViewer.tsx
7865
7886
  var Xn = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, Zn = e.forwardRef(function(e, t) {
7866
- let { fileUrl: r, initialDoc: l, initialScale: u, initialPage: d, page: f, transientHighlights: p, plugins: m, redactions: h, regexRedactions: g, enableAnnotations: _, enableSign: v = !1, watermark: y, permissions: b, enableRedactions: x, canAddAnnotations: ee, canEditAnnotations: S, canDeleteAnnotations: C, readOnly: te = !1, assets: ne, withCredentials: re = !1, toolbar: ie = !0, sidebars: w = !0, leftPanelOpen: T = !0, className: ae, style: oe } = e, E = s(e);
7867
- E.current = e;
7868
- let D = s(null), O = o(() => new q(), []), k = o(() => new Kn(), []), se = s(null);
7869
- se.current ||= new Jn(O, k);
7870
- let A = se.current;
7871
- a(t, () => A, [A]);
7872
- let ce = r ?? l, [le, ue] = c(ce), [de, fe] = c(0);
7887
+ let { fileUrl: r, initialDoc: l, initialScale: u, initialPage: d, page: f, transientHighlights: p, plugins: m, redactions: h, regexRedactions: g, enableAnnotations: _, enableSign: v = !1, watermark: y, permissions: b, enableRedactions: x, canAddAnnotations: ee, canEditAnnotations: S, canDeleteAnnotations: te, readOnly: ne = !1, assets: re, withCredentials: ie = !1, toolbar: ae = !0, sidebars: oe = !0, leftPanelOpen: C = !0, className: se, style: ce, hideAnnotationsUntilPageRendered: le = !0 } = e, w = s(e);
7888
+ w.current = e;
7889
+ let ue = s(null), T = o(() => new q(), []), E = o(() => new Kn(), []), D = s(null);
7890
+ D.current ||= new Jn(T, E);
7891
+ let O = D.current;
7892
+ a(t, () => O, [O]);
7893
+ let k = r ?? l, [de, fe] = c(k), [pe, me] = c(0);
7873
7894
  i(() => {
7874
- ue(ce);
7875
- }, [ce]);
7876
- let pe = n((e) => {
7877
- ue(e), fe((e) => e + 1);
7878
- }, []), [me, he] = c("View"), [ge, _e] = c(w && T), [ve, j] = c(!1), [ye, be] = c("Comments"), [M, xe] = c(typeof u == "number" ? u : 1), [Se, Ce] = c(!1), [N, we] = c(!1), [Te, Ee] = c("continuous"), [De, Oe] = c("single"), [ke, Ae] = c(0), [je, Me] = c(""), P = o(() => te ? {
7895
+ fe(k);
7896
+ }, [k]);
7897
+ let he = n((e) => {
7898
+ fe(e), me((e) => e + 1);
7899
+ }, []), [ge, _e] = c("View"), [ve, ye] = c(oe && C), [be, xe] = c(!1), [Se, A] = c("Comments"), [Ce, j] = c(typeof u == "number" ? u : 1), [we, Te] = c(!1), [Ee, M] = c(!1), [De, Oe] = c("continuous"), [ke, Ae] = c("single"), [je, Me] = c(0), [Ne, N] = c(""), P = o(() => ne ? {
7879
7900
  canAddAnnotations: !1,
7880
7901
  canEditAnnotations: !1,
7881
7902
  canDeleteAnnotations: !1,
@@ -7883,109 +7904,109 @@ var Xn = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID
7883
7904
  } : {
7884
7905
  canAddAnnotations: b?.canAddAnnotations ?? ee ?? _ !== !1,
7885
7906
  canEditAnnotations: b?.canEditAnnotations ?? S ?? _ !== !1,
7886
- canDeleteAnnotations: b?.canDeleteAnnotations ?? C ?? _ !== !1,
7907
+ canDeleteAnnotations: b?.canDeleteAnnotations ?? te ?? _ !== !1,
7887
7908
  canRedact: b?.canRedact ?? x ?? !0
7888
7909
  }, [
7889
- te,
7910
+ ne,
7890
7911
  b,
7891
7912
  ee,
7892
7913
  S,
7893
- C,
7914
+ te,
7894
7915
  _,
7895
7916
  x
7896
- ]), Ne = !te && _ !== !1, L = e.currentUser?.id, R = e.currentUser?.name;
7917
+ ]), L = !ne && _ !== !1, Pe = e.currentUser?.id, Fe = e.currentUser?.name;
7897
7918
  i(() => {
7898
- k.setCurrentUserInfo(L || R ? {
7899
- id: L,
7900
- name: R
7919
+ E.setCurrentUserInfo(Pe || Fe ? {
7920
+ id: Pe,
7921
+ name: Fe
7901
7922
  } : void 0);
7902
7923
  }, [
7903
- k,
7904
- L,
7905
- R
7924
+ E,
7925
+ Pe,
7926
+ Fe
7906
7927
  ]), i(() => {
7907
- k.setReadOnly(te);
7908
- }, [k, te]), i(() => {
7909
- k.setCanEditOthers(!!b?.canEditOthers);
7910
- }, [k, b?.canEditOthers]), i(() => {
7911
- k.clear(), k.setDocument(null);
7912
- }, [k, le]), i(() => k.addEventListener("annotationChanged", (e) => O.emit("annotationChanged", e)), [k, O]), i(() => {
7913
- P.canAddAnnotations === !1 && me === "Annotate" && he("View");
7914
- }, [P.canAddAnnotations, me]);
7915
- let z = s([]), Pe = s(null), Fe = s({
7928
+ E.setReadOnly(ne);
7929
+ }, [E, ne]), i(() => {
7930
+ E.setCanEditOthers(!!b?.canEditOthers);
7931
+ }, [E, b?.canEditOthers]), i(() => {
7932
+ E.clear(), E.setDocument(null);
7933
+ }, [E, de]), i(() => E.addEventListener("annotationChanged", (e) => T.emit("annotationChanged", e)), [E, T]), i(() => {
7934
+ P.canAddAnnotations === !1 && ge === "Annotate" && _e("View");
7935
+ }, [P.canAddAnnotations, ge]);
7936
+ let R = s([]), z = s(null), B = s({
7916
7937
  current: 1,
7917
7938
  count: 0
7918
- }), B = s(le);
7919
- B.current = le;
7920
- let Le = s(null), Re = s(!1), [ze, Ve] = c([]), V = o(() => p ?? ze, [p, ze]), He = s(V);
7921
- He.current = V;
7922
- let Ue = n((e) => {
7923
- Ve(e), E.current.onTransientHighlightsChange?.(e);
7939
+ }), Le = s(de);
7940
+ Le.current = de;
7941
+ let Re = s(null), ze = s(!1), [Be, Ve] = c([]), He = o(() => p ?? Be, [p, Be]), Ue = s(He);
7942
+ Ue.current = He;
7943
+ let We = n((e) => {
7944
+ Ve(e), w.current.onTransientHighlightsChange?.(e);
7924
7945
  }, []);
7925
- i(() => (A._bind({
7926
- getAnnotations: () => k.getAnnotationsList(),
7927
- getRedactions: () => z.current,
7928
- getWatermark: () => E.current.watermark,
7929
- getPdfDocument: () => Pe.current,
7930
- getDocumentUrl: () => B.current,
7931
- getFileName: () => E.current.fileName,
7932
- getCurrentUserName: () => E.current.currentUser?.name,
7933
- getCurrentPage: () => Fe.current.current,
7934
- getPageCount: () => Fe.current.count,
7935
- loadDocument: pe,
7946
+ i(() => (O._bind({
7947
+ getAnnotations: () => E.getAnnotationsList(),
7948
+ getRedactions: () => R.current,
7949
+ getWatermark: () => w.current.watermark,
7950
+ getPdfDocument: () => z.current,
7951
+ getDocumentUrl: () => Le.current,
7952
+ getFileName: () => w.current.fileName,
7953
+ getCurrentUserName: () => w.current.currentUser?.name,
7954
+ getCurrentPage: () => B.current.current,
7955
+ getPageCount: () => B.current.count,
7956
+ loadDocument: he,
7936
7957
  goToPage: (e, t) => {
7937
- O.emit("action-go-to-page", {
7958
+ T.emit("action-go-to-page", {
7938
7959
  page: e,
7939
7960
  smooth: t?.smooth
7940
7961
  });
7941
7962
  },
7942
- getTransientHighlights: () => He.current,
7943
- setTransientHighlights: Ue
7944
- }, D.current), () => A._unbind()), [
7945
- A,
7946
- k,
7947
- pe,
7963
+ getTransientHighlights: () => Ue.current,
7964
+ setTransientHighlights: We
7965
+ }, ue.current), () => O._unbind()), [
7948
7966
  O,
7949
- Ue
7967
+ E,
7968
+ he,
7969
+ T,
7970
+ We
7950
7971
  ]);
7951
- let We = s(!1);
7972
+ let Ge = s(!1);
7952
7973
  i(() => {
7953
- We.current || (We.current = !0, E.current.autoFocus && D.current?.focus({ preventScroll: !0 }), E.current.onReady?.(A));
7954
- }, [A]), i(() => {
7974
+ Ge.current || (Ge.current = !0, w.current.autoFocus && ue.current?.focus({ preventScroll: !0 }), w.current.onReady?.(O));
7975
+ }, [O]), i(() => {
7955
7976
  let e = (e) => {
7956
- j(!0), be(e);
7977
+ xe(!0), A(e);
7957
7978
  }, t = [
7958
- O.on("action-open-elements", (t) => {
7979
+ T.on("action-open-elements", (t) => {
7959
7980
  let n = t?.elements ?? [];
7960
- n.includes("leftPanel") && _e(!0), n.includes("notesPanel") && e("Comments"), n.includes("searchPanel") && e("Search");
7981
+ n.includes("leftPanel") && ye(!0), n.includes("notesPanel") && e("Comments"), n.includes("searchPanel") && e("Search");
7961
7982
  }),
7962
- O.on("action-close-elements", (e) => {
7983
+ T.on("action-close-elements", (e) => {
7963
7984
  let t = e?.elements ?? [];
7964
- t.includes("leftPanel") && _e(!1), (t.includes("notesPanel") || t.includes("searchPanel")) && j(!1);
7985
+ t.includes("leftPanel") && ye(!1), (t.includes("notesPanel") || t.includes("searchPanel")) && xe(!1);
7965
7986
  }),
7966
- O.on("action-set-active-left-panel", (t) => {
7987
+ T.on("action-set-active-left-panel", (t) => {
7967
7988
  let n = t?.panel;
7968
- n === "notesPanel" ? e("Comments") : n === "searchPanel" ? e("Search") : _e(!0);
7989
+ n === "notesPanel" ? e("Comments") : n === "searchPanel" ? e("Search") : ye(!0);
7969
7990
  }),
7970
- O.on("action-tool-changed", (e) => O.emit("toolChanged", { tool: e?.tool ?? null })),
7971
- O.on("action-print", async () => {
7991
+ T.on("action-tool-changed", (e) => T.emit("toolChanged", { tool: e?.tool ?? null })),
7992
+ T.on("action-print", async () => {
7972
7993
  try {
7973
- await Yn(await A.getFileData(), { title: E.current.fileName });
7994
+ await Yn(await O.getFileData(), { title: w.current.fileName });
7974
7995
  } catch (e) {
7975
- console.error("[teamsync-pdf-viewer] print failed", e), O.emit("action-print-error", { error: e });
7996
+ console.error("[teamsync-pdf-viewer] print failed", e), T.emit("action-print-error", { error: e });
7976
7997
  }
7977
7998
  }),
7978
- O.on("action-download", async () => {
7999
+ T.on("action-download", async () => {
7979
8000
  try {
7980
- let e = Le.current;
7981
- if (e ? Le.current = null : e = await A.getFileData(), !e) return;
8001
+ let e = Re.current;
8002
+ if (e ? Re.current = null : e = await O.getFileData(), !e) return;
7982
8003
  let t = new Blob([e], { type: "application/pdf" }), n = URL.createObjectURL(t), r = document.createElement("a");
7983
- r.href = n, r.download = E.current.fileName || "annotated_document.pdf", r.click(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
8004
+ r.href = n, r.download = w.current.fileName || "annotated_document.pdf", r.click(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
7984
8005
  } catch (e) {
7985
- console.error("[teamsync-pdf-viewer] download failed", e), O.emit("action-download-error", { error: e });
8006
+ console.error("[teamsync-pdf-viewer] download failed", e), T.emit("action-download-error", { error: e });
7986
8007
  }
7987
8008
  }),
7988
- O.on("action-process-digital-signature", async (e) => {
8009
+ T.on("action-process-digital-signature", async (e) => {
7989
8010
  try {
7990
8011
  let { pageIndex: t, x: n, y: r, width: i, height: a } = e, o = {
7991
8012
  id: Xn(),
@@ -7998,185 +8019,194 @@ var Xn = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID
7998
8019
  color: "#0f172a",
7999
8020
  strokeWidth: 1,
8000
8021
  opacity: 1,
8001
- signer: E.current.currentUser?.name ?? "Unknown signer",
8022
+ signer: w.current.currentUser?.name ?? "Unknown signer",
8002
8023
  timestamp: Date.now()
8003
- }, s = [...A.getAnnotations(), o];
8004
- O.emit("action-waiting-for-pin-start");
8005
- let c = await A.getFileData({ explicitAnnotations: s });
8006
- if (O.emit("action-waiting-for-pin-end"), !c) return;
8007
- Le.current = c, O.emit("action-commit-digital-signature", { tempAnn: o });
8024
+ }, s = [...O.getAnnotations(), o];
8025
+ T.emit("action-waiting-for-pin-start");
8026
+ let c = await O.getFileData({ explicitAnnotations: s });
8027
+ if (T.emit("action-waiting-for-pin-end"), !c) return;
8028
+ Re.current = c, T.emit("action-commit-digital-signature", { tempAnn: o });
8008
8029
  } catch (e) {
8009
- O.emit("action-waiting-for-pin-error", { error: e?.message ?? String(e) }), console.error("[teamsync-pdf-viewer] process signature failed", e);
8030
+ T.emit("action-waiting-for-pin-error", { error: e?.message ?? String(e) }), console.error("[teamsync-pdf-viewer] process signature failed", e);
8010
8031
  }
8011
8032
  }),
8012
- O.on("action-set-transient-highlights", (e) => {
8013
- Ue(e?.highlights ?? []);
8033
+ T.on("action-set-transient-highlights", (e) => {
8034
+ We(e?.highlights ?? []);
8014
8035
  }),
8015
- O.on("action-clear-transient-highlights", () => {
8016
- Ue([]);
8036
+ T.on("action-clear-transient-highlights", () => {
8037
+ We([]);
8017
8038
  }),
8018
- O.on("action-commit-digital-signature", (e) => O.emit("action-commit-digital-signature-local", e))
8039
+ T.on("action-commit-digital-signature", (e) => T.emit("action-commit-digital-signature-local", e))
8019
8040
  ];
8020
8041
  return () => t.forEach((e) => e());
8021
8042
  }, [
8043
+ T,
8022
8044
  O,
8023
- A,
8024
- Ue
8045
+ We
8025
8046
  ]);
8026
- let Ge = n((e, t) => {
8027
- Pe.current = e, k.setDocument(e), Fe.current = {
8047
+ let Ye = n((e, t) => {
8048
+ z.current = e, E.setDocument(e), B.current = {
8028
8049
  current: 1,
8029
8050
  count: e.numPages
8030
- }, Re.current = !1, O.emit("documentLoaded", {
8051
+ }, ze.current = !1, T.emit("documentLoaded", {
8031
8052
  url: t,
8032
8053
  numPages: e.numPages
8033
- }), E.current.onDocumentLoaded?.({
8054
+ }), w.current.onDocumentLoaded?.({
8034
8055
  url: t,
8035
8056
  numPages: e.numPages
8036
8057
  });
8037
- }, [O, k]), Ke = n((e, t) => {
8038
- Pe.current = null, k.setDocument(null), O.emit("documentLoadError", {
8058
+ }, [T, E]), Xe = n((e, t) => {
8059
+ z.current = null, E.setDocument(null), T.emit("documentLoadError", {
8039
8060
  url: t.url,
8040
8061
  error: e,
8041
8062
  passwordRequired: t.passwordRequired
8042
- }), t.passwordRequired && E.current.onPasswordRequired?.({ url: t.url }), E.current.onDocumentLoadError?.(e, (e) => pe(e ?? t.url), t);
8063
+ }), t.passwordRequired && w.current.onPasswordRequired?.({ url: t.url }), w.current.onDocumentLoadError?.(e, (e) => he(e ?? t.url), t);
8043
8064
  }, [
8044
- O,
8045
- pe,
8046
- k
8047
- ]), qe = n((e) => {
8048
- let t = B.current ?? "";
8049
- if (!Re.current) {
8050
- Re.current = !0;
8051
- let e = E.current.initialScale;
8052
- e === "fit-width" ? setTimeout(() => O.emit("action-fit-to-width"), 0) : e === "fit-page" && setTimeout(() => O.emit("action-fit-to-page"), 0);
8065
+ T,
8066
+ he,
8067
+ E
8068
+ ]), Ze = n((e) => {
8069
+ let t = Le.current ?? "";
8070
+ if (!ze.current) {
8071
+ ze.current = !0;
8072
+ let e = w.current.initialScale;
8073
+ e === "fit-width" ? setTimeout(() => T.emit("action-fit-to-width"), 0) : e === "fit-page" && setTimeout(() => T.emit("action-fit-to-page"), 0);
8053
8074
  }
8054
- O.emit("firstPageRendered", {
8075
+ T.emit("firstPageRendered", {
8076
+ url: t,
8077
+ pageNumber: e
8078
+ }), w.current.onFirstPageRendered?.({
8079
+ url: t,
8080
+ pageNumber: e
8081
+ });
8082
+ }, [T]), $e = n((e) => {
8083
+ let t = Le.current ?? "";
8084
+ T.emit("pageRendered", {
8055
8085
  url: t,
8056
8086
  pageNumber: e
8057
- }), E.current.onFirstPageRendered?.({
8087
+ }), w.current.onPageRendered?.({
8058
8088
  url: t,
8059
8089
  pageNumber: e
8060
8090
  });
8061
- }, [O]), Je = n((e, t) => {
8062
- Fe.current = {
8091
+ }, [T]), V = n((e, t) => {
8092
+ B.current = {
8063
8093
  current: e,
8064
8094
  count: t
8065
- }, O.emit("pageChanged", {
8095
+ }, T.emit("pageChanged", {
8066
8096
  pageNumber: e,
8067
8097
  numPages: t
8068
- }), E.current.onPageChange?.(e, t);
8069
- }, [O]), Ye = n((e) => {
8070
- O.emit("annotationsChanged", { annotations: e }), E.current.onAnnotationsChange?.(e);
8071
- }, [O]), Xe = n((e) => {
8072
- z.current = e;
8073
- }, []), { getCommand: Ze } = Qe(), $e = s(null), tt = n(() => {
8074
- w && (j(!0), be("Search"), setTimeout(() => O.emit("action-focus-search"), 50));
8075
- }, [w, O]), nt = n(() => {
8076
- $e.current?.click();
8098
+ }), w.current.onPageChange?.(e, t);
8099
+ }, [T]), et = n((e) => {
8100
+ T.emit("annotationsChanged", { annotations: e }), w.current.onAnnotationsChange?.(e);
8101
+ }, [T]), tt = n((e) => {
8102
+ R.current = e;
8103
+ }, []), { getCommand: nt } = ct(), rt = s(null), it = n(() => {
8104
+ oe && (xe(!0), A("Search"), setTimeout(() => T.emit("action-focus-search"), 50));
8105
+ }, [oe, T]), H = n(() => {
8106
+ rt.current?.click();
8077
8107
  }, []);
8078
8108
  return i(() => {
8079
- let e = O.on("action-open-search", tt), t = O.on("action-open-file-picker", nt);
8109
+ let e = T.on("action-open-search", it), t = T.on("action-open-file-picker", H);
8080
8110
  return () => {
8081
8111
  e(), t();
8082
8112
  };
8083
8113
  }, [
8084
- O,
8085
- tt,
8086
- nt
8114
+ T,
8115
+ it,
8116
+ H
8087
8117
  ]), i(() => {
8088
- D.current && (document.activeElement === document.body || !document.activeElement) && D.current.focus({ preventScroll: !0 });
8118
+ ue.current && (document.activeElement === document.body || !document.activeElement) && ue.current.focus({ preventScroll: !0 });
8089
8119
  }, []), i(() => {
8090
8120
  let e = (e) => {
8091
8121
  let t = e.target;
8092
8122
  if (t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable) return;
8093
- let n = D.current;
8123
+ let n = ue.current;
8094
8124
  if (n && (document.activeElement === document.body || document.activeElement === document.documentElement || document.activeElement === null || n.contains(document.activeElement)) && !n.contains(document.activeElement)) {
8095
- if (et(e, Ze("SEARCH"))) {
8096
- e.preventDefault(), tt();
8125
+ if (ut(e, nt("SEARCH"))) {
8126
+ e.preventDefault(), it();
8097
8127
  return;
8098
8128
  }
8099
- if (et(e, Ze("FILE_PICKER"))) {
8100
- e.preventDefault(), nt();
8129
+ if (ut(e, nt("FILE_PICKER"))) {
8130
+ e.preventDefault(), H();
8101
8131
  return;
8102
8132
  }
8103
- O.emit("viewer-keydown", e);
8133
+ T.emit("viewer-keydown", e);
8104
8134
  }
8105
8135
  };
8106
8136
  return window.addEventListener("keydown", e), () => {
8107
8137
  window.removeEventListener("keydown", e);
8108
8138
  };
8109
8139
  }, [
8110
- O,
8111
- Ze,
8112
- tt,
8113
- nt
8140
+ T,
8141
+ nt,
8142
+ it,
8143
+ H
8114
8144
  ]), /* @__PURE__ */ F(Ie.Provider, {
8115
- value: O,
8145
+ value: T,
8116
8146
  children: /* @__PURE__ */ I("div", {
8117
- ref: D,
8118
- className: ["tspdf-root", ae].filter(Boolean).join(" "),
8119
- style: oe,
8147
+ ref: ue,
8148
+ className: ["tspdf-root", se].filter(Boolean).join(" "),
8149
+ style: ce,
8120
8150
  tabIndex: -1,
8121
8151
  "data-teamsync-pdf-viewer": "",
8122
8152
  onKeyDownCapture: (e) => {
8123
- if (et(e.nativeEvent, Ze("SEARCH"))) {
8124
- e.preventDefault(), tt();
8153
+ if (ut(e.nativeEvent, nt("SEARCH"))) {
8154
+ e.preventDefault(), it();
8125
8155
  return;
8126
8156
  }
8127
- if (et(e.nativeEvent, Ze("FILE_PICKER"))) {
8128
- e.preventDefault(), nt();
8157
+ if (ut(e.nativeEvent, nt("FILE_PICKER"))) {
8158
+ e.preventDefault(), H();
8129
8159
  return;
8130
8160
  }
8131
- O.emit("viewer-keydown", e.nativeEvent);
8161
+ T.emit("viewer-keydown", e.nativeEvent);
8132
8162
  },
8133
8163
  onMouseDownCapture: () => {
8134
- let e = D.current;
8164
+ let e = ue.current;
8135
8165
  e && !e.contains(document.activeElement) && e.focus({ preventScroll: !0 });
8136
8166
  },
8137
8167
  children: [
8138
- ie && /* @__PURE__ */ F(Be, {
8139
- activeTab: me,
8168
+ ae && /* @__PURE__ */ F(Qe, {
8169
+ activeTab: ge,
8140
8170
  setActiveTab: (e) => {
8141
- (P.canAddAnnotations !== !1 || e !== "Annotate") && he(e);
8171
+ (P.canAddAnnotations !== !1 || e !== "Annotate") && _e(e);
8142
8172
  },
8143
- leftSidebarOpen: ge,
8173
+ leftSidebarOpen: ve,
8144
8174
  setLeftSidebarOpen: (e) => {
8145
- w && _e(e);
8175
+ oe && ye(e);
8146
8176
  },
8147
- rightSidebarOpen: ve,
8148
- setRightSidebarOpen: j,
8149
- sidebarTab: ye,
8150
- scale: M,
8151
- onZoomIn: () => xe((e) => _t(e)),
8152
- onZoomOut: () => xe((e) => vt(e)),
8153
- onZoomSet: (e) => xe(yt(e)),
8154
- onOpenFile: nt,
8155
- onDownload: () => O.emit("action-download"),
8177
+ rightSidebarOpen: be,
8178
+ setRightSidebarOpen: xe,
8179
+ sidebarTab: Se,
8180
+ scale: Ce,
8181
+ onZoomIn: () => j((e) => Ke(e)),
8182
+ onZoomOut: () => j((e) => qe(e)),
8183
+ onZoomSet: (e) => j(Je(e)),
8184
+ onOpenFile: H,
8185
+ onDownload: () => T.emit("action-download"),
8156
8186
  onFullScreen: () => {
8157
- let e = D.current ?? document.documentElement;
8187
+ let e = ue.current ?? document.documentElement;
8158
8188
  document.fullscreenElement ? document.exitFullscreen?.().catch(() => {}) : e.requestFullscreen?.().catch(() => {});
8159
8189
  },
8160
- onSaveAs: () => O.emit("action-download"),
8161
- onPrint: () => O.emit("action-print"),
8162
- onOpenSettings: () => Ce(!0),
8163
- onOpenAbout: () => we(!0),
8190
+ onSaveAs: () => T.emit("action-download"),
8191
+ onPrint: () => T.emit("action-print"),
8192
+ onOpenSettings: () => Te(!0),
8193
+ onOpenAbout: () => M(!0),
8164
8194
  onOpenSidebarTab: (e) => {
8165
- w && (ve && ye === e ? j(!1) : (j(!0), be(e), e === "Search" && setTimeout(() => O.emit("action-focus-search"), 50)));
8195
+ oe && (be && Se === e ? xe(!1) : (xe(!0), A(e), e === "Search" && setTimeout(() => T.emit("action-focus-search"), 50)));
8166
8196
  },
8167
- pageTransition: Te,
8168
- setPageTransition: Ee,
8169
- pageLayout: De,
8170
- setPageLayout: Oe,
8171
- rotation: ke,
8172
- setRotation: Ae,
8173
- enableAnnotations: Ne,
8197
+ pageTransition: De,
8198
+ setPageTransition: Oe,
8199
+ pageLayout: ke,
8200
+ setPageLayout: Ae,
8201
+ rotation: je,
8202
+ setRotation: Me,
8203
+ enableAnnotations: L,
8174
8204
  enableSign: v,
8175
8205
  plugins: m,
8176
8206
  permissions: P
8177
8207
  }),
8178
8208
  /* @__PURE__ */ F("input", {
8179
- ref: $e,
8209
+ ref: rt,
8180
8210
  type: "file",
8181
8211
  accept: "application/pdf",
8182
8212
  style: { display: "none" },
@@ -8184,7 +8214,7 @@ var Xn = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID
8184
8214
  let t = e.target.files?.[0];
8185
8215
  if (t) {
8186
8216
  let e = URL.createObjectURL(t);
8187
- pe(e);
8217
+ he(e);
8188
8218
  }
8189
8219
  e.target.value = "";
8190
8220
  },
@@ -8197,47 +8227,49 @@ var Xn = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID
8197
8227
  minHeight: 0,
8198
8228
  overflow: "hidden"
8199
8229
  },
8200
- children: /* @__PURE__ */ F(qt, {
8201
- leftSidebarOpen: w && ge,
8202
- rightSidebarOpen: w && ve,
8203
- sidebarTab: ye,
8204
- setSidebarTab: be,
8205
- sidebars: w,
8206
- activeTab: me,
8207
- annotationManager: k,
8208
- initialDoc: le,
8209
- loadNonce: de,
8210
- withCredentials: re,
8211
- assets: ne,
8230
+ children: /* @__PURE__ */ F(Kt, {
8231
+ leftSidebarOpen: oe && ve,
8232
+ rightSidebarOpen: oe && be,
8233
+ sidebarTab: Se,
8234
+ setSidebarTab: A,
8235
+ sidebars: oe,
8236
+ activeTab: ge,
8237
+ annotationManager: E,
8238
+ initialDoc: de,
8239
+ loadNonce: pe,
8240
+ withCredentials: ie,
8241
+ assets: re,
8212
8242
  redactions: h,
8213
8243
  regexRedactions: g,
8214
- scale: M,
8215
- setScale: xe,
8216
- onAnnotationsChange: Ye,
8217
- onRedactionsChange: Xe,
8218
- onDocumentLoaded: Ge,
8219
- onLoadError: Ke,
8220
- onFirstPageRendered: qe,
8221
- onPageChange: Je,
8222
- pageTransition: Te,
8223
- pageLayout: De,
8224
- rotation: ke,
8225
- setRotation: Ae,
8244
+ scale: Ce,
8245
+ setScale: j,
8246
+ onAnnotationsChange: et,
8247
+ onRedactionsChange: tt,
8248
+ onDocumentLoaded: Ye,
8249
+ onLoadError: Xe,
8250
+ onFirstPageRendered: Ze,
8251
+ onPageRendered: $e,
8252
+ onPageChange: V,
8253
+ pageTransition: De,
8254
+ pageLayout: ke,
8255
+ rotation: je,
8256
+ setRotation: Me,
8226
8257
  watermark: y,
8227
- watermarkText: je,
8228
- enableAnnotations: Ne,
8258
+ watermarkText: Ne,
8259
+ enableAnnotations: L,
8229
8260
  initialPage: d,
8230
8261
  page: f,
8231
- transientHighlights: V,
8232
- permissions: P
8262
+ transientHighlights: He,
8263
+ permissions: P,
8264
+ hideAnnotationsUntilPageRendered: le
8233
8265
  })
8234
8266
  }),
8235
- Se && /* @__PURE__ */ F(K, {
8236
- onClose: () => Ce(!1),
8237
- watermarkText: je,
8238
- setWatermarkText: Me
8267
+ we && /* @__PURE__ */ F(Jt, {
8268
+ onClose: () => Te(!1),
8269
+ watermarkText: Ne,
8270
+ setWatermarkText: N
8239
8271
  }),
8240
- N && /* @__PURE__ */ F(Yt, { onClose: () => we(!1) })
8272
+ Ee && /* @__PURE__ */ F(Yt, { onClose: () => M(!1) })
8241
8273
  ]
8242
8274
  })
8243
8275
  });
@@ -8261,6 +8293,6 @@ function Qn(e, t) {
8261
8293
  }
8262
8294
  var $n = Qn;
8263
8295
  //#endregion
8264
- export { Kn as AnnotationManager, Tt as DEFAULT_FALLBACK_DIMS, ln as MAX_EXPORT_BYTES, dt as MAX_SCALE, ut as MIN_SCALE, Zn as TeamSyncViewer, q as ViewerBus, $n as WebViewer, Jn as WebViewerInstance, mn as XFDF_NS, Fn as annotationToXfdfFragment, Ln as annotationsToXfdf, pn as buildPdfBytes, _t as calculateNextZoomIn, vt as calculateNextZoomOut, xt as calculateScrollCompensation, yt as clampScale, Kt as computeCanvasPixelDiff, Bt as computePageDiffBoxes, Dt as computeRowLayout, Ut as computeTextDiff, Ot as configurePdfAssets, en as createGeometryResolver, J as createPageGeometry, Qn as createWebViewer, Et as estimatePageDimensions, zt as extractWordsFromPage, yn as fromPdfDate, nn as fromPdfPoint, $t as geometryFromPage, kt as getPdfAssetPaths, W as hasDimensionMismatch, At as isWorkerConfigured, Ct as newAnnotationId, Un as parseXfdf, Nt as pdfjsVersion, Yn as printPdfBytes, sn as quadPointsToRects, X as rectFromPdf, Y as rectToPdf, on as rectToQuadPoints, tt as searchPdfText, Gt as tintCanvas, vn as toPdfDate, tn as toPdfPoint, nt as usePdfSearch };
8296
+ export { Kn as AnnotationManager, Tt as DEFAULT_FALLBACK_DIMS, ln as MAX_EXPORT_BYTES, Be as MAX_SCALE, ze as MIN_SCALE, Zn as TeamSyncViewer, q as ViewerBus, $n as WebViewer, Jn as WebViewerInstance, Q as XFDF_NS, Fn as annotationToXfdfFragment, Ln as annotationsToXfdf, mn as buildPdfBytes, Ke as calculateNextZoomIn, qe as calculateNextZoomOut, Xe as calculateScrollCompensation, Je as clampScale, Gt as computeCanvasPixelDiff, zt as computePageDiffBoxes, Dt as computeRowLayout, Ht as computeTextDiff, kt as configurePdfAssets, Y as createGeometryResolver, Qt as createPageGeometry, Qn as createWebViewer, Et as estimatePageDimensions, Rt as extractWordsFromPage, yn as fromPdfDate, tn as fromPdfPoint, $t as geometryFromPage, G as getPdfAssetPaths, Ot as hasDimensionMismatch, K as isWorkerConfigured, Ct as newAnnotationId, Un as parseXfdf, Mt as pdfjsVersion, Yn as printPdfBytes, sn as quadPointsToRects, rn as rectFromPdf, nn as rectToPdf, on as rectToQuadPoints, dt as searchPdfText, Wt as tintCanvas, vn as toPdfDate, en as toPdfPoint, ft as usePdfSearch };
8265
8297
 
8266
8298
  //# sourceMappingURL=teamsync-pdf-viewer.js.map