epochs-pdf 0.1.3 → 0.1.4

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,27 +1,27 @@
1
- var yi = Object.defineProperty;
2
- var bi = (e, t, n) => t in e ? yi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var Ht = (e, t, n) => bi(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { useRef as _e, useState as U, useEffect as xe, useMemo as Mt, useCallback as q, Fragment as _i } from "react";
5
- import { jsxs as T, jsx as a, Fragment as bt } from "react/jsx-runtime";
1
+ var ki = Object.defineProperty;
2
+ var Mi = (e, t, n) => t in e ? ki(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var Ut = (e, t, n) => Mi(e, typeof t != "symbol" ? t + "" : t, n);
4
+ import { useRef as me, useState as H, useEffect as xe, useMemo as Tt, useCallback as q, Fragment as Pi } from "react";
5
+ import { jsxs as $, jsx as a, Fragment as vt } from "react/jsx-runtime";
6
6
  import * as ct from "pdfjs-dist";
7
- import { TextLayer as vi } from "pdfjs-dist";
8
- const mt = "#ffffff", un = [
7
+ import { TextLayer as Ni } from "pdfjs-dist";
8
+ const yt = "#ffffff", yn = [
9
9
  { id: "yellow", label: "Yellow", hex: "#facc15" },
10
10
  { id: "green", label: "Green", hex: "#4ade80" },
11
11
  { id: "pink", label: "Pink", hex: "#f472b6" },
12
12
  { id: "blue", label: "Blue", hex: "#60a5fa" },
13
13
  { id: "orange", label: "Orange", hex: "#fb923c" },
14
14
  { id: "purple", label: "Purple", hex: "#c084fc" }
15
- ], fn = [
15
+ ], bn = [
16
16
  { id: "blue", label: "Blue", hex: "#2563eb" },
17
17
  { id: "red", label: "Red", hex: "#dc2626" },
18
18
  { id: "green", label: "Green", hex: "#16a34a" },
19
19
  { id: "orange", label: "Orange", hex: "#ea580c" },
20
20
  { id: "purple", label: "Purple", hex: "#7c3aed" },
21
21
  { id: "black", label: "Black", hex: "#111827" }
22
- ], gn = un[0].hex, xi = fn[0].hex;
23
- mn(gn, "highlight");
24
- function zt() {
22
+ ], _n = yn[0].hex, $i = bn[0].hex;
23
+ vn(_n, "highlight");
24
+ function Wt() {
25
25
  return `m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
26
26
  }
27
27
  function Qe(e) {
@@ -33,34 +33,34 @@ function Qe(e) {
33
33
  }
34
34
  return t;
35
35
  }
36
- function mn(e, t, n = 0.45) {
36
+ function vn(e, t, n = 0.45) {
37
37
  const i = Qe(e);
38
38
  if (t === "underline" || t === "redact") return i;
39
39
  const r = /^#([0-9a-f]{6})$/i.exec(i);
40
40
  if (!r) return `rgba(250, 204, 21, ${n})`;
41
- const s = Number.parseInt(r[1], 16), c = s >> 16 & 255, l = s >> 8 & 255, y = s & 255;
42
- return `rgba(${c}, ${l}, ${y}, ${n})`;
41
+ const o = Number.parseInt(r[1], 16), c = o >> 16 & 255, l = o >> 8 & 255, b = o & 255;
42
+ return `rgba(${c}, ${l}, ${b}, ${n})`;
43
43
  }
44
- function jt(e, t) {
44
+ function Gt(e, t) {
45
45
  const n = window.getSelection();
46
46
  if (!n || n.isCollapsed || n.rangeCount === 0)
47
47
  return null;
48
48
  const i = n.getRangeAt(0);
49
49
  if (!e.contains(i.commonAncestorContainer))
50
50
  return null;
51
- const r = e.getBoundingClientRect(), s = Array.from(i.getClientRects()).filter(
52
- (x) => x.width > 0 && x.height > 0
51
+ const r = e.getBoundingClientRect(), o = Array.from(i.getClientRects()).filter(
52
+ (M) => M.width > 0 && M.height > 0
53
53
  );
54
- if (!s.length) return null;
55
- const c = t || 1, l = e.clientWidth || r.width, y = e.clientHeight || r.height;
56
- return { rects: s.map((x) => ({
57
- x: r.width > 0 ? (x.left - r.left) / r.width * (l / c) : 0,
58
- y: r.height > 0 ? (x.top - r.top) / r.height * (y / c) : 0,
59
- w: r.width > 0 ? x.width / r.width * (l / c) : 0,
60
- h: r.height > 0 ? x.height / r.height * (y / c) : 0
54
+ if (!o.length) return null;
55
+ const c = t || 1, l = e.clientWidth || r.width, b = e.clientHeight || r.height;
56
+ return { rects: o.map((M) => ({
57
+ x: r.width > 0 ? (M.left - r.left) / r.width * (l / c) : 0,
58
+ y: r.height > 0 ? (M.top - r.top) / r.height * (b / c) : 0,
59
+ w: r.width > 0 ? M.width / r.width * (l / c) : 0,
60
+ h: r.height > 0 ? M.height / r.height * (b / c) : 0
61
61
  })), text: n.toString() };
62
62
  }
63
- function on(e) {
63
+ function dn(e) {
64
64
  const n = [...e].sort((i, r) => i.y - r.y || i.x - r.x)[0] ?? { x: 0, y: 0, h: 14 };
65
65
  return {
66
66
  x: n.x,
@@ -68,7 +68,7 @@ function on(e) {
68
68
  fontSize: Math.max(8, Math.round(n.h * 0.9) || 14)
69
69
  };
70
70
  }
71
- function Ot(e, t = 2) {
71
+ function Xt(e, t = 2) {
72
72
  return e.map((n) => ({
73
73
  x: Math.max(0, n.x - t),
74
74
  y: Math.max(0, n.y - t),
@@ -76,26 +76,26 @@ function Ot(e, t = 2) {
76
76
  h: n.h + t * 2
77
77
  }));
78
78
  }
79
- function wn(e, t, n) {
79
+ function xn(e, t, n) {
80
80
  for (const i of t)
81
81
  for (const r of i.rects) {
82
- const s = r.x * n, c = r.y * n, l = r.w * n, y = r.h * n;
82
+ const o = r.x * n, c = r.y * n, l = r.w * n, b = r.h * n;
83
83
  if (i.kind === "highlight")
84
- e.save(), e.globalCompositeOperation = "multiply", e.fillStyle = i.color, e.fillRect(s, c, l, y), e.restore();
84
+ e.save(), e.globalCompositeOperation = "multiply", e.fillStyle = i.color, e.fillRect(o, c, l, b), e.restore();
85
85
  else if (i.kind === "redact")
86
- e.fillStyle = i.color || mt, e.fillRect(s, c, l, y);
86
+ e.fillStyle = i.color || yt, e.fillRect(o, c, l, b);
87
87
  else {
88
88
  const f = Math.max(2, n * 1.5);
89
- e.fillStyle = i.color, e.fillRect(s, c + y - f, l, f);
89
+ e.fillStyle = i.color, e.fillRect(o, c + b - f, l, f);
90
90
  }
91
91
  }
92
92
  }
93
- function Tt() {
93
+ function Lt() {
94
94
  return `s_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
95
95
  }
96
- async function yn(e, t, n) {
96
+ async function kn(e, t, n) {
97
97
  for (const i of t) {
98
- const r = await Mi(i.imageDataUrl);
98
+ const r = await Ii(i.imageDataUrl);
99
99
  e.drawImage(
100
100
  r,
101
101
  i.x * n,
@@ -105,21 +105,21 @@ async function yn(e, t, n) {
105
105
  );
106
106
  }
107
107
  }
108
- function ki(e, t, n, i) {
108
+ function Ti(e, t, n, i) {
109
109
  e.save();
110
110
  for (const r of t) {
111
- const s = n.has(r.id), c = r.x * i, l = r.y * i, y = r.width * i, f = r.height * i;
112
- e.fillStyle = s ? "rgba(29, 78, 216, 0.08)" : "rgba(29, 78, 216, 0.18)", e.strokeStyle = s ? "rgba(29, 78, 216, 0.45)" : "#1d4ed8", e.lineWidth = 1.5, e.setLineDash(s ? [] : [4, 3]), e.fillRect(c, l, y, f), e.strokeRect(c, l, y, f);
111
+ const o = n.has(r.id), c = r.x * i, l = r.y * i, b = r.width * i, f = r.height * i;
112
+ e.fillStyle = o ? "rgba(29, 78, 216, 0.08)" : "rgba(29, 78, 216, 0.18)", e.strokeStyle = o ? "rgba(29, 78, 216, 0.45)" : "#1d4ed8", e.lineWidth = 1.5, e.setLineDash(o ? [] : [4, 3]), e.fillRect(c, l, b, f), e.strokeRect(c, l, b, f);
113
113
  }
114
114
  e.restore();
115
115
  }
116
- function Mi(e) {
116
+ function Ii(e) {
117
117
  return new Promise((t, n) => {
118
118
  const i = new Image();
119
119
  i.onload = () => t(i), i.onerror = () => n(new Error("Failed to load signature image")), i.src = e;
120
120
  });
121
121
  }
122
- function Pi(e, t, n = 180, i = 64) {
122
+ function Ci(e, t, n = 180, i = 64) {
123
123
  if (e <= 0 || t <= 0)
124
124
  return { width: n, height: i };
125
125
  const r = Math.min(n / e, i / t);
@@ -128,97 +128,97 @@ function Pi(e, t, n = 180, i = 64) {
128
128
  height: Math.max(20, t * r)
129
129
  };
130
130
  }
131
- function Pt(e, t, n, i) {
132
- const r = n.getBoundingClientRect(), s = n.clientWidth || r.width, c = n.clientHeight || r.height;
131
+ function It(e, t, n, i) {
132
+ const r = n.getBoundingClientRect(), o = n.clientWidth || r.width, c = n.clientHeight || r.height;
133
133
  return r.width <= 0 || r.height <= 0 || i <= 0 ? { x: 0, y: 0 } : {
134
- x: (e - r.left) / r.width * (s / i),
134
+ x: (e - r.left) / r.width * (o / i),
135
135
  y: (t - r.top) / r.height * (c / i)
136
136
  };
137
137
  }
138
- function yt(e, t) {
138
+ function _t(e, t) {
139
139
  return {
140
140
  width: e.clientWidth / t,
141
141
  height: e.clientHeight / t
142
142
  };
143
143
  }
144
- function Ni(e, t, n, i) {
145
- const r = n.getBoundingClientRect(), s = n.clientWidth || r.width, c = n.clientHeight || r.height;
144
+ function Ri(e, t, n, i) {
145
+ const r = n.getBoundingClientRect(), o = n.clientWidth || r.width, c = n.clientHeight || r.height;
146
146
  return r.width <= 0 || r.height <= 0 || i <= 0 ? { dx: 0, dy: 0 } : {
147
- dx: e / r.width * (s / i),
147
+ dx: e / r.width * (o / i),
148
148
  dy: t / r.height * (c / i)
149
149
  };
150
150
  }
151
- function $i(e, t, n) {
152
- const i = t.getBoundingClientRect(), { width: r, height: s } = yt(t, n);
153
- return i.width <= 0 || i.height <= 0 ? { left: 0, top: 0, right: r, bottom: s } : {
151
+ function Li(e, t, n) {
152
+ const i = t.getBoundingClientRect(), { width: r, height: o } = _t(t, n);
153
+ return i.width <= 0 || i.height <= 0 ? { left: 0, top: 0, right: r, bottom: o } : {
154
154
  left: (e.left - i.left) / i.width * r,
155
- top: (e.top - i.top) / i.height * s,
155
+ top: (e.top - i.top) / i.height * o,
156
156
  right: (e.right - i.left) / i.width * r,
157
- bottom: (e.bottom - i.top) / i.height * s
157
+ bottom: (e.bottom - i.top) / i.height * o
158
158
  };
159
159
  }
160
- const _t = 14, wt = "#111827", Ut = 24, Wt = 20;
161
- function Gt() {
160
+ const xt = 14, bt = "#111827", qt = 24, Yt = 20;
161
+ function Kt() {
162
162
  return `t_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
163
163
  }
164
- function ut(e, t) {
164
+ function gt(e, t) {
165
165
  if (typeof document > "u")
166
166
  return {
167
- width: Math.max(Ut, e.length * t * 0.55),
168
- height: Math.max(Wt, t * 1.25)
167
+ width: Math.max(qt, e.length * t * 0.55),
168
+ height: Math.max(Yt, t * 1.25)
169
169
  };
170
170
  const i = document.createElement("canvas").getContext("2d");
171
171
  if (!i)
172
172
  return {
173
- width: Math.max(Ut, e.length * t * 0.55),
174
- height: Math.max(Wt, t * 1.25)
173
+ width: Math.max(qt, e.length * t * 0.55),
174
+ height: Math.max(Yt, t * 1.25)
175
175
  };
176
176
  i.font = `${t}px sans-serif`;
177
177
  const r = e.split(`
178
- `), s = t * 1.25;
179
- let c = Ut;
178
+ `), o = t * 1.25;
179
+ let c = qt;
180
180
  for (const l of r)
181
181
  c = Math.max(c, i.measureText(l || " ").width + 4);
182
182
  return {
183
183
  width: c,
184
- height: Math.max(Wt, r.length * s)
184
+ height: Math.max(Yt, r.length * o)
185
185
  };
186
186
  }
187
- function Ti(e, t, n, i, r) {
188
- var E;
189
- const s = n.getBoundingClientRect(), c = n.clientWidth || s.width, l = n.clientHeight || s.height, y = (I) => s.width > 0 ? (I - s.left) / s.width * (c / r) : 0, f = (I) => s.height > 0 ? (I - s.top) / s.height * (l / r) : 0, x = (I, V) => {
190
- const te = V === "x" ? s.width : s.height, X = V === "x" ? c : l;
191
- return te > 0 ? I / te * (X / r) : 0;
187
+ function Fi(e, t, n, i, r) {
188
+ var B;
189
+ const o = n.getBoundingClientRect(), c = n.clientWidth || o.width, l = n.clientHeight || o.height, b = (T) => o.width > 0 ? (T - o.left) / o.width * (c / r) : 0, f = (T) => o.height > 0 ? (T - o.top) / o.height * (l / r) : 0, M = (T, Q) => {
190
+ const ee = Q === "x" ? o.width : o.height, W = Q === "x" ? c : l;
191
+ return ee > 0 ? T / ee * (W / r) : 0;
192
192
  };
193
- let v = y(e), m = f(t), M = _t;
194
- const $ = Ii(e, t, i);
195
- if ($)
193
+ let v = b(e), g = f(t), P = xt;
194
+ const N = Di(e, t, i);
195
+ if (N)
196
196
  return {
197
- x: y($.x),
198
- y: f($.y),
199
- fontSize: Math.max(8, Math.round(x($.fontSize, "y") * 10) / 10)
197
+ x: b(N.x),
198
+ y: f(N.y),
199
+ fontSize: Math.max(8, Math.round(M(N.fontSize, "y") * 10) / 10)
200
200
  };
201
- const G = document, S = (E = G.caretRangeFromPoint) == null ? void 0 : E.call(G, e, t);
202
- if (S && i.contains(S.startContainer)) {
203
- const I = S.getClientRects(), V = I.length > 0 ? I[0] : S.getBoundingClientRect();
204
- if (V.height > 0) {
205
- m = f(V.top), M = Li(S.startContainer, r, n);
206
- const te = y(V.left);
207
- return Math.abs(te - v) < x(8, "x") && (v = te), { x: v, y: m, fontSize: M };
201
+ const U = document, E = (B = U.caretRangeFromPoint) == null ? void 0 : B.call(U, e, t);
202
+ if (E && i.contains(E.startContainer)) {
203
+ const T = E.getClientRects(), Q = T.length > 0 ? T[0] : E.getBoundingClientRect();
204
+ if (Q.height > 0) {
205
+ g = f(Q.top), P = Ai(E.startContainer, r, n);
206
+ const ee = b(Q.left);
207
+ return Math.abs(ee - v) < M(8, "x") && (v = ee), { x: v, y: g, fontSize: P };
208
208
  }
209
209
  }
210
- const z = Ci(e, t, i);
211
- return z && (m = f(z.top), M = Math.max(8, Math.round(x(z.height, "y") * 10) / 10)), { x: v, y: m, fontSize: M };
210
+ const z = Si(e, t, i);
211
+ return z && (g = f(z.top), P = Math.max(8, Math.round(M(z.height, "y") * 10) / 10)), { x: v, y: g, fontSize: P };
212
212
  }
213
- function Ii(e, t, n) {
214
- var s;
213
+ function Di(e, t, n) {
214
+ var o;
215
215
  const i = Array.from(
216
216
  n.querySelectorAll("span")
217
217
  );
218
218
  if (i.length < 2) return null;
219
219
  const r = [];
220
220
  for (const c of i) {
221
- if (!((s = c.textContent) != null && s.trim())) continue;
221
+ if (!((o = c.textContent) != null && o.trim())) continue;
222
222
  const l = c.getBoundingClientRect();
223
223
  l.width <= 0 || l.height <= 0 || t < l.top - 4 || t > l.bottom + 4 || r.push({
224
224
  left: l.left,
@@ -230,36 +230,36 @@ function Ii(e, t, n) {
230
230
  }
231
231
  r.sort((c, l) => c.left - l.left);
232
232
  for (let c = 0; c < r.length - 1; c += 1) {
233
- const l = r[c], y = r[c + 1], f = l.right, x = y.left;
234
- if (!(x - f < 1) && e >= f - 2 && e <= x + 2)
233
+ const l = r[c], b = r[c + 1], f = l.right, M = b.left;
234
+ if (!(M - f < 1) && e >= f - 2 && e <= M + 2)
235
235
  return {
236
236
  x: e,
237
- y: Math.min(l.top, y.top),
238
- fontSize: Math.min(l.height, y.height)
237
+ y: Math.min(l.top, b.top),
238
+ fontSize: Math.min(l.height, b.height)
239
239
  };
240
240
  }
241
241
  return null;
242
242
  }
243
- function Ci(e, t, n) {
244
- var s;
243
+ function Si(e, t, n) {
244
+ var o;
245
245
  const i = Array.from(
246
246
  n.querySelectorAll("span")
247
247
  );
248
248
  let r = null;
249
249
  for (const c of i) {
250
- if (!((s = c.textContent) != null && s.trim())) continue;
250
+ if (!((o = c.textContent) != null && o.trim())) continue;
251
251
  const l = c.getBoundingClientRect();
252
252
  if (l.width <= 0 || l.height <= 0 || t < l.top - 6 || t > l.bottom + 6) continue;
253
- const y = (l.left + l.right) / 2, f = Math.abs(e - y);
253
+ const b = (l.left + l.right) / 2, f = Math.abs(e - b);
254
254
  (!r || f < r.dist) && (r = { top: l.top, height: l.height, dist: f });
255
255
  }
256
256
  return r ? { top: r.top, height: r.height } : null;
257
257
  }
258
- function Li(e, t, n) {
258
+ function Ai(e, t, n) {
259
259
  const i = e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement;
260
- return i ? Ri(i, t, n) : _t;
260
+ return i ? Ei(i, t, n) : xt;
261
261
  }
262
- function Ri(e, t, n) {
262
+ function Ei(e, t, n) {
263
263
  const i = e.getBoundingClientRect().height;
264
264
  if (i > 0) {
265
265
  if (n) {
@@ -272,58 +272,58 @@ function Ri(e, t, n) {
272
272
  }
273
273
  return Math.max(8, Math.round(i / t * 10) / 10);
274
274
  }
275
- const r = window.getComputedStyle(e).fontSize, s = Number.parseFloat(r);
276
- return Number.isFinite(s) && s > 0 ? Math.max(8, Math.round(s / t * 10) / 10) : _t;
275
+ const r = window.getComputedStyle(e).fontSize, o = Number.parseFloat(r);
276
+ return Number.isFinite(o) && o > 0 ? Math.max(8, Math.round(o / t * 10) / 10) : xt;
277
277
  }
278
- function Di(e, t, n, i) {
278
+ function Bi(e, t, n, i) {
279
279
  for (const r of n)
280
280
  if (r.pageNumber === i && e >= r.x && e <= r.x + r.width && t >= r.y && t <= r.y + r.height)
281
281
  return r;
282
282
  return null;
283
283
  }
284
- function Fi(e, t, n) {
285
- var M;
284
+ function Hi(e, t, n) {
285
+ var P;
286
286
  if (!n) return null;
287
- const i = document, r = (M = i.caretRangeFromPoint) == null ? void 0 : M.call(i, e, t);
287
+ const i = document, r = (P = i.caretRangeFromPoint) == null ? void 0 : P.call(i, e, t);
288
288
  if (!r || !n.contains(r.startContainer)) return null;
289
- const s = r.startContainer;
290
- if (s.nodeType !== Node.TEXT_NODE || !s.textContent) return null;
291
- const c = s.textContent;
289
+ const o = r.startContainer;
290
+ if (o.nodeType !== Node.TEXT_NODE || !o.textContent) return null;
291
+ const c = o.textContent;
292
292
  let l = r.startOffset;
293
293
  l = Math.min(Math.max(0, l), c.length);
294
- const y = ($) => /[\p{L}\p{N}_'-]/u.test($);
295
- let f = l, x = l;
296
- for (; f > 0 && y(c[f - 1]); ) f -= 1;
297
- for (; x < c.length && y(c[x]); ) x += 1;
298
- if (f === x) return null;
294
+ const b = (N) => /[\p{L}\p{N}_'-]/u.test(N);
295
+ let f = l, M = l;
296
+ for (; f > 0 && b(c[f - 1]); ) f -= 1;
297
+ for (; M < c.length && b(c[M]); ) M += 1;
298
+ if (f === M) return null;
299
299
  const v = document.createRange();
300
- v.setStart(s, f), v.setEnd(s, x);
301
- const m = window.getSelection();
302
- return m == null || m.removeAllRanges(), m == null || m.addRange(v), c.slice(f, x);
300
+ v.setStart(o, f), v.setEnd(o, M);
301
+ const g = window.getSelection();
302
+ return g == null || g.removeAllRanges(), g == null || g.addRange(v), c.slice(f, M);
303
303
  }
304
- function bn(e, t, n) {
304
+ function Mn(e, t, n) {
305
305
  e.save();
306
306
  for (const i of t) {
307
307
  if (!i.value.trim()) continue;
308
- const r = i.x * n, s = i.y * n, c = Math.max(8, i.fontSize * n);
308
+ const r = i.x * n, o = i.y * n, c = Math.max(8, i.fontSize * n);
309
309
  e.fillStyle = i.color, e.font = `${c}px sans-serif`, e.textBaseline = "top";
310
- const l = c * 1.25, y = i.value.split(`
310
+ const l = c * 1.25, b = i.value.split(`
311
311
  `);
312
- let f = s;
313
- for (const x of y)
314
- e.fillText(x, r, f), f += l;
312
+ let f = o;
313
+ for (const M of b)
314
+ e.fillText(M, r, f), f += l;
315
315
  }
316
316
  e.restore();
317
317
  }
318
- function Ai(e, t, n, i) {
318
+ function zi(e, t, n, i) {
319
319
  e.save();
320
320
  for (const r of t) {
321
- const s = n.has(r.id), c = r.x * i, l = r.y * i, y = r.width * i, f = r.height * i;
322
- e.fillStyle = s ? "rgba(5, 150, 105, 0.08)" : "rgba(5, 150, 105, 0.16)", e.strokeStyle = s ? "rgba(5, 150, 105, 0.45)" : "#059669", e.lineWidth = 1.5, e.setLineDash(s ? [] : [4, 3]), e.fillRect(c, l, y, f), e.strokeRect(c, l, y, f);
321
+ const o = n.has(r.id), c = r.x * i, l = r.y * i, b = r.width * i, f = r.height * i;
322
+ e.fillStyle = o ? "rgba(5, 150, 105, 0.08)" : "rgba(5, 150, 105, 0.16)", e.strokeStyle = o ? "rgba(5, 150, 105, 0.45)" : "#059669", e.lineWidth = 1.5, e.setLineDash(o ? [] : [4, 3]), e.fillRect(c, l, b, f), e.strokeRect(c, l, b, f);
323
323
  }
324
324
  e.restore();
325
325
  }
326
- function Te({
326
+ function Ne({
327
327
  size: e = 14,
328
328
  className: t,
329
329
  children: n
@@ -346,83 +346,83 @@ function Te({
346
346
  }
347
347
  );
348
348
  }
349
- function Si(e) {
350
- return /* @__PURE__ */ a(Te, { ...e, children: /* @__PURE__ */ a("polyline", { points: "15 18 9 12 15 6" }) });
349
+ function ji(e) {
350
+ return /* @__PURE__ */ a(Ne, { ...e, children: /* @__PURE__ */ a("polyline", { points: "15 18 9 12 15 6" }) });
351
351
  }
352
- function Ei(e) {
353
- return /* @__PURE__ */ a(Te, { ...e, children: /* @__PURE__ */ a("polyline", { points: "9 18 15 12 9 6" }) });
352
+ function Oi(e) {
353
+ return /* @__PURE__ */ a(Ne, { ...e, children: /* @__PURE__ */ a("polyline", { points: "9 18 15 12 9 6" }) });
354
354
  }
355
- function Bi(e) {
356
- return /* @__PURE__ */ T(Te, { ...e, children: [
355
+ function Ui(e) {
356
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
357
357
  /* @__PURE__ */ a("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
358
358
  /* @__PURE__ */ a("polyline", { points: "7 10 12 15 17 10" }),
359
359
  /* @__PURE__ */ a("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
360
360
  ] });
361
361
  }
362
- function Hi(e) {
363
- return /* @__PURE__ */ T(Te, { ...e, children: [
362
+ function Wi(e) {
363
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
364
364
  /* @__PURE__ */ a("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
365
365
  /* @__PURE__ */ a("polyline", { points: "15 3 21 3 21 9" }),
366
366
  /* @__PURE__ */ a("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
367
367
  ] });
368
368
  }
369
- function zi(e) {
370
- return /* @__PURE__ */ T(Te, { ...e, children: [
369
+ function Gi(e) {
370
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
371
371
  /* @__PURE__ */ a("rect", { x: "3", y: "3", width: "7", height: "7" }),
372
372
  /* @__PURE__ */ a("rect", { x: "14", y: "3", width: "7", height: "7" }),
373
373
  /* @__PURE__ */ a("rect", { x: "14", y: "14", width: "7", height: "7" }),
374
374
  /* @__PURE__ */ a("rect", { x: "3", y: "14", width: "7", height: "7" })
375
375
  ] });
376
376
  }
377
- function ji(e) {
378
- return /* @__PURE__ */ a(Te, { ...e, children: /* @__PURE__ */ a("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
377
+ function Xi(e) {
378
+ return /* @__PURE__ */ a(Ne, { ...e, children: /* @__PURE__ */ a("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
379
379
  }
380
- function Oi(e) {
381
- return /* @__PURE__ */ T(Te, { ...e, children: [
380
+ function qi(e) {
381
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
382
382
  /* @__PURE__ */ a("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
383
383
  /* @__PURE__ */ a("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
384
384
  ] });
385
385
  }
386
- function Ui(e) {
387
- return /* @__PURE__ */ T(Te, { ...e, children: [
386
+ function Yi(e) {
387
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
388
388
  /* @__PURE__ */ a("polyline", { points: "6 9 6 2 18 2 18 9" }),
389
389
  /* @__PURE__ */ a("path", { d: "M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" }),
390
390
  /* @__PURE__ */ a("rect", { x: "6", y: "14", width: "12", height: "8" })
391
391
  ] });
392
392
  }
393
- function Wi(e) {
394
- return /* @__PURE__ */ T(Te, { ...e, children: [
393
+ function Ki(e) {
394
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
395
395
  /* @__PURE__ */ a("polyline", { points: "23 4 23 10 17 10" }),
396
396
  /* @__PURE__ */ a("polyline", { points: "1 20 1 14 7 14" }),
397
397
  /* @__PURE__ */ a("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" })
398
398
  ] });
399
399
  }
400
- function Gi(e) {
401
- return /* @__PURE__ */ T(Te, { ...e, children: [
400
+ function Zi(e) {
401
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
402
402
  /* @__PURE__ */ a("polyline", { points: "23 4 23 10 17 10" }),
403
403
  /* @__PURE__ */ a("path", { d: "M20.49 15a9 9 0 1 1-2.12-9.36L23 10" })
404
404
  ] });
405
405
  }
406
- function Xi(e) {
407
- return /* @__PURE__ */ T(Te, { ...e, children: [
406
+ function Vi(e) {
407
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
408
408
  /* @__PURE__ */ a("path", { d: "M12 20h9" }),
409
409
  /* @__PURE__ */ a("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" })
410
410
  ] });
411
411
  }
412
- function qi(e) {
413
- return /* @__PURE__ */ T(Te, { ...e, children: [
412
+ function Qi(e) {
413
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
414
414
  /* @__PURE__ */ a("path", { d: "M6 3v7a6 6 0 0 0 12 0V3" }),
415
415
  /* @__PURE__ */ a("line", { x1: "4", y1: "21", x2: "20", y2: "21" })
416
416
  ] });
417
417
  }
418
- function Yi(e) {
419
- return /* @__PURE__ */ T(Te, { ...e, children: [
418
+ function Ji(e) {
419
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
420
420
  /* @__PURE__ */ a("path", { d: "m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21" }),
421
421
  /* @__PURE__ */ a("path", { d: "M22 21H7" }),
422
422
  /* @__PURE__ */ a("path", { d: "m5 11 9 9" })
423
423
  ] });
424
424
  }
425
- function Ki({ size: e = 16, className: t }) {
425
+ function er({ size: e = 16, className: t }) {
426
426
  return /* @__PURE__ */ a(
427
427
  "svg",
428
428
  {
@@ -440,619 +440,619 @@ function Ki({ size: e = 16, className: t }) {
440
440
  }
441
441
  );
442
442
  }
443
- function Zi(e) {
444
- return /* @__PURE__ */ T(Te, { ...e, children: [
443
+ function tr(e) {
444
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
445
445
  /* @__PURE__ */ a("path", { d: "M12 20h9" }),
446
446
  /* @__PURE__ */ a("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" })
447
447
  ] });
448
448
  }
449
- function Vi(e) {
450
- return /* @__PURE__ */ T(Te, { ...e, children: [
449
+ function nr(e) {
450
+ return /* @__PURE__ */ $(Ne, { ...e, children: [
451
451
  /* @__PURE__ */ a("polyline", { points: "4 7 4 4 20 4 20 7" }),
452
452
  /* @__PURE__ */ a("line", { x1: "9", y1: "20", x2: "15", y2: "20" }),
453
453
  /* @__PURE__ */ a("line", { x1: "12", y1: "4", x2: "12", y2: "20" })
454
454
  ] });
455
455
  }
456
- function Qi({
456
+ function ir({
457
457
  pdfDoc: e,
458
458
  pageNumber: t,
459
459
  scale: n,
460
460
  rotation: i,
461
461
  pageRef: r,
462
- onRendered: s,
462
+ onRendered: o,
463
463
  markupTool: c = "none",
464
464
  markupColor: l,
465
- annotations: y = [],
465
+ annotations: b = [],
466
466
  onAddAnnotation: f,
467
- onRemoveAnnotation: x,
467
+ onRemoveAnnotation: M,
468
468
  signatures: v = [],
469
- pendingSignature: m = null,
470
- onAddSignature: M,
471
- onUpdateSignature: $,
472
- onRemoveSignature: G,
473
- onEditSignature: S,
469
+ pendingSignature: g = null,
470
+ onAddSignature: P,
471
+ onUpdateSignature: N,
472
+ onRemoveSignature: U,
473
+ onEditSignature: E,
474
474
  onDuplicateSignature: z,
475
- selectedSignatureId: E = null,
476
- onSelectSignature: I,
477
- signatureFields: V = [],
478
- selectedSignatureFieldId: te = null,
479
- onSelectSignatureField: X,
480
- hasFixedSignatureFields: oe = !1,
481
- onOpenSignaturePad: ke,
482
- fieldValues: ye = {},
475
+ selectedSignatureId: B = null,
476
+ onSelectSignature: T,
477
+ signatureFields: Q = [],
478
+ selectedSignatureFieldId: ee = null,
479
+ onSelectSignatureField: W,
480
+ hasFixedSignatureFields: re = !1,
481
+ onOpenSignaturePad: Pe,
482
+ fieldValues: we = {},
483
483
  onFieldValueChange: D,
484
- onFieldValueCommit: ae,
485
- pendingFieldValue: C = null,
486
- onPlaceFieldValue: F,
487
- texts: Q = [],
488
- onAddText: Me,
489
- onUpdateText: Ie,
484
+ onFieldValueCommit: se,
485
+ pendingFieldValue: te = null,
486
+ onPlaceFieldValue: A,
487
+ texts: oe = [],
488
+ onAddText: ke,
489
+ onUpdateText: $e,
490
490
  onRemoveText: ue,
491
- selectedTextId: be = null,
492
- onSelectText: J,
493
- textFields: Be = [],
494
- selectedTextFieldId: Ye = null,
495
- onSelectTextField: Pe,
496
- hasFixedTextFields: Oe = !1,
497
- editingTextId: ve = null,
498
- onEditingTextIdChange: B
491
+ selectedTextId: ye = null,
492
+ onSelectText: Y,
493
+ textFields: lt = [],
494
+ selectedTextFieldId: je = null,
495
+ onSelectTextField: Le,
496
+ hasFixedTextFields: Ue = !1,
497
+ editingTextId: Fe = null,
498
+ onEditingTextIdChange: O
499
499
  }) {
500
- const fe = _e(null), je = _e(null), ie = _e(null), ge = _e(null), he = _e(null), u = _e(null), [g, j] = U(null), Y = _e(null), se = _e(!1);
500
+ const pe = me(null), fe = me(null), Ee = me(null), G = me(null), Be = me(null), p = me(null), [_, C] = H(null), ne = me(null), K = me(!1);
501
501
  xe(() => {
502
- if (!e || !je.current || !ie.current || !ge.current)
502
+ if (!e || !fe.current || !Ee.current || !G.current)
503
503
  return;
504
- let o = !1;
505
- const w = je.current, _ = ie.current, k = ge.current, P = w.getContext("2d");
506
- return P ? ((async () => {
504
+ let s = !1;
505
+ const m = fe.current, w = Ee.current, x = G.current, j = m.getContext("2d");
506
+ return j ? ((async () => {
507
507
  try {
508
- if (he.current) {
508
+ if (Be.current) {
509
509
  try {
510
- he.current.cancel();
510
+ Be.current.cancel();
511
511
  } catch {
512
512
  }
513
- he.current = null;
513
+ Be.current = null;
514
514
  }
515
- if (u.current) {
515
+ if (p.current) {
516
516
  try {
517
- u.current.cancel();
517
+ p.current.cancel();
518
518
  } catch {
519
519
  }
520
- u.current = null;
520
+ p.current = null;
521
521
  }
522
- const L = await e.getPage(t);
523
- if (o) return;
524
- const O = L.getViewport({ scale: n, rotation: i }), Z = Math.floor(O.width), W = Math.floor(O.height);
525
- w.width = Z, w.height = W, k.style.width = `${Z}px`, k.style.height = `${W}px`;
526
- const H = L.render({ canvasContext: P, viewport: O });
527
- if (he.current = H, await H.promise, o) return;
528
- _.replaceChildren(), _.style.setProperty("--scale-factor", String(O.scale));
529
- const le = await L.getTextContent();
530
- if (o) return;
531
- const de = new vi({
532
- textContentSource: le,
533
- container: _,
534
- viewport: O
522
+ const R = await e.getPage(t);
523
+ if (s) return;
524
+ const S = R.getViewport({ scale: n, rotation: i }), X = Math.floor(S.width), ie = Math.floor(S.height);
525
+ m.width = X, m.height = ie, x.style.width = `${X}px`, x.style.height = `${ie}px`;
526
+ const I = R.render({ canvasContext: j, viewport: S });
527
+ if (Be.current = I, await I.promise, s) return;
528
+ w.replaceChildren(), w.style.setProperty("--scale-factor", String(S.scale));
529
+ const ce = await R.getTextContent();
530
+ if (s) return;
531
+ const de = new Ni({
532
+ textContentSource: ce,
533
+ container: w,
534
+ viewport: S
535
535
  });
536
- if (u.current = de, await de.render(), o) return;
537
- s == null || s(t);
536
+ if (p.current = de, await de.render(), s) return;
537
+ o == null || o(t);
538
538
  } catch {
539
539
  }
540
540
  })(), () => {
541
- if (o = !0, he.current) {
541
+ if (s = !0, Be.current) {
542
542
  try {
543
- he.current.cancel();
543
+ Be.current.cancel();
544
544
  } catch {
545
545
  }
546
- he.current = null;
546
+ Be.current = null;
547
547
  }
548
- if (u.current) {
548
+ if (p.current) {
549
549
  try {
550
- u.current.cancel();
550
+ p.current.cancel();
551
551
  } catch {
552
552
  }
553
- u.current = null;
553
+ p.current = null;
554
554
  }
555
555
  }) : void 0;
556
- }, [e, t, n, i, s]), xe(() => {
557
- const o = ge.current;
558
- if (!o) return;
559
- const w = (N) => {
560
- var W;
556
+ }, [e, t, n, i, o]), xe(() => {
557
+ const s = G.current;
558
+ if (!s) return;
559
+ const m = (k) => {
560
+ var ie;
561
561
  if (!f) return !1;
562
- const L = N === "redact" ? mt : l;
563
- if (!L) return !1;
564
- const O = jt(o, n);
565
- if (!O) return !1;
566
- const Z = N === "redact" ? Ot(O.rects) : O.rects;
562
+ const R = k === "redact" ? yt : l;
563
+ if (!R) return !1;
564
+ const S = Gt(s, n);
565
+ if (!S) return !1;
566
+ const X = k === "redact" ? Xt(S.rects) : S.rects;
567
567
  return f({
568
- id: zt(),
568
+ id: Wt(),
569
569
  pageNumber: t,
570
- kind: N,
571
- color: L,
572
- rects: Z,
573
- text: O.text
574
- }), (W = window.getSelection()) == null || W.removeAllRanges(), !0;
575
- }, _ = (N) => {
576
- var le;
577
- if (!f || !Me) return !1;
578
- const L = jt(o, n);
579
- if (!L) return !1;
580
- const O = Ot(L.rects);
570
+ kind: k,
571
+ color: R,
572
+ rects: X,
573
+ text: S.text
574
+ }), (ie = window.getSelection()) == null || ie.removeAllRanges(), !0;
575
+ }, w = (k) => {
576
+ var ce;
577
+ if (!f || !ke) return !1;
578
+ const R = Gt(s, n);
579
+ if (!R) return !1;
580
+ const S = Xt(R.rects);
581
581
  f({
582
- id: zt(),
582
+ id: Wt(),
583
583
  pageNumber: t,
584
584
  kind: "redact",
585
- color: mt,
586
- rects: O,
587
- text: L.text
585
+ color: yt,
586
+ rects: S,
587
+ text: R.text
588
588
  });
589
- const Z = on(L.rects), W = ut(N || " ", Z.fontSize), H = {
590
- id: Gt(),
589
+ const X = dn(R.rects), ie = gt(k || " ", X.fontSize), I = {
590
+ id: Kt(),
591
591
  pageNumber: t,
592
- x: Z.x,
593
- y: Z.y,
594
- width: W.width,
595
- height: W.height,
596
- value: N,
597
- fontSize: Z.fontSize,
598
- color: wt
592
+ x: X.x,
593
+ y: X.y,
594
+ width: ie.width,
595
+ height: ie.height,
596
+ value: k,
597
+ fontSize: X.fontSize,
598
+ color: bt
599
599
  };
600
- return Me(H), J == null || J(H.id), B == null || B(H.id), (le = window.getSelection()) == null || le.removeAllRanges(), se.current = !0, window.setTimeout(() => {
601
- se.current = !1;
600
+ return ke(I), Y == null || Y(I.id), O == null || O(I.id), (ce = window.getSelection()) == null || ce.removeAllRanges(), K.current = !0, window.setTimeout(() => {
601
+ K.current = !1;
602
602
  }, 0), !0;
603
- }, k = () => {
603
+ }, x = () => {
604
604
  if (c === "highlight" || c === "underline") {
605
- w(c);
605
+ m(c);
606
606
  return;
607
607
  }
608
608
  if (c === "erase") {
609
- w("redact");
609
+ m("redact");
610
610
  return;
611
611
  }
612
612
  if (c === "text") {
613
- const N = window.getSelection();
614
- N && !N.isCollapsed && N.toString().trim() && N.anchorNode && o.contains(N.anchorNode) && _(N.toString());
613
+ const k = window.getSelection();
614
+ k && !k.isCollapsed && k.toString().trim() && k.anchorNode && s.contains(k.anchorNode) && w(k.toString());
615
615
  }
616
- }, P = (N) => {
617
- const L = N.target;
618
- if (L != null && L.closest("[contenteditable='true']") || L != null && L.closest("[contenteditable='']") || L != null && L.isContentEditable)
616
+ }, j = (k) => {
617
+ const R = k.target;
618
+ if (R != null && R.closest("[contenteditable='true']") || R != null && R.closest("[contenteditable='']") || R != null && R.isContentEditable)
619
619
  return;
620
- const O = window.getSelection(), Z = O != null && !O.isCollapsed && O.toString().trim().length > 0 && O.anchorNode != null && o.contains(O.anchorNode);
621
- if (c === "text" && Z) {
622
- if (N.key === "Enter" && !N.shiftKey) {
623
- N.preventDefault(), _(O.toString());
620
+ const S = window.getSelection(), X = S != null && !S.isCollapsed && S.toString().trim().length > 0 && S.anchorNode != null && s.contains(S.anchorNode);
621
+ if (c === "text" && X) {
622
+ if (k.key === "Enter" && !k.shiftKey) {
623
+ k.preventDefault(), w(S.toString());
624
624
  return;
625
625
  }
626
- if (N.key.length === 1 && !N.ctrlKey && !N.metaKey && !N.altKey) {
627
- N.preventDefault(), _(N.key);
626
+ if (k.key.length === 1 && !k.ctrlKey && !k.metaKey && !k.altKey) {
627
+ k.preventDefault(), w(k.key);
628
628
  return;
629
629
  }
630
630
  }
631
- c !== "text" && c !== "erase" || N.key !== "Backspace" && N.key !== "Delete" || Z && (N.preventDefault(), w("redact"));
631
+ c !== "text" && c !== "erase" || k.key !== "Backspace" && k.key !== "Delete" || X && (k.preventDefault(), m("redact"));
632
632
  };
633
- return o.addEventListener("mouseup", k), window.addEventListener("keydown", P), () => {
634
- o.removeEventListener("mouseup", k), window.removeEventListener("keydown", P);
633
+ return s.addEventListener("mouseup", x), window.addEventListener("keydown", j), () => {
634
+ s.removeEventListener("mouseup", x), window.removeEventListener("keydown", j);
635
635
  };
636
636
  }, [
637
637
  c,
638
638
  l,
639
639
  f,
640
- Me,
641
- B,
642
- J,
640
+ ke,
641
+ O,
642
+ Y,
643
643
  t,
644
644
  n
645
645
  ]), xe(() => {
646
- if (!g) return;
647
- let o = 0, w = 0, _ = 0, k = 0;
648
- const P = () => {
649
- var H;
650
- return (H = fe.current) == null ? void 0 : H.closest(".epochs-pdf-viewer__body");
651
- }, N = (H, le) => {
652
- if (g.kind !== "resize" || !$ || oe) return;
653
- const de = v.find((Xe) => Xe.id === g.id);
646
+ if (!_) return;
647
+ let s = 0, m = 0, w = 0, x = 0;
648
+ const j = () => {
649
+ var I;
650
+ return (I = pe.current) == null ? void 0 : I.closest(".epochs-pdf-viewer__body");
651
+ }, k = (I, ce) => {
652
+ if (_.kind !== "resize" || !N || re) return;
653
+ const de = v.find((dt) => dt.id === _.id);
654
654
  if (!de) return;
655
- const ne = ge.current, Ne = ne ? yt(ne, n) : { width: 1 / 0, height: 1 / 0 }, { dx: pe, dy: me } = ne ? Ni(
656
- H - g.startX,
657
- le - g.startY,
658
- ne,
655
+ const he = G.current, ve = he ? _t(he, n) : { width: 1 / 0, height: 1 / 0 }, { dx: ze, dy: le } = he ? Ri(
656
+ I - _.startX,
657
+ ce - _.startY,
658
+ he,
659
659
  n
660
- ) : { dx: 0, dy: 0 }, $e = Ne.width - de.x, Ge = Ne.height - de.y, Ee = Math.min($e, Math.max(40, g.startW + pe)), lt = Math.min(Ge, Math.max(20, g.startH + me));
661
- $(g.id, { width: Ee, height: lt });
662
- }, L = (H, le) => {
663
- var xt;
664
- if (g.kind !== "signature" || !$ || oe) return;
665
- const de = v.find((Ze) => Ze.id === g.id);
660
+ ) : { dx: 0, dy: 0 }, Me = ve.width - de.x, Se = ve.height - de.y, Ye = Math.min(Me, Math.max(40, _.startW + ze)), Xe = Math.min(Se, Math.max(20, _.startH + le));
661
+ N(_.id, { width: Ye, height: Xe });
662
+ }, R = (I, ce) => {
663
+ var Ze;
664
+ if (_.kind !== "signature" || !N || re) return;
665
+ const de = v.find((kt) => kt.id === _.id);
666
666
  if (!de) return;
667
- let ne = (xt = document.elementFromPoint(H, le)) == null ? void 0 : xt.closest("[data-page-number]");
668
- if (ne || (ne = Array.from(
667
+ let he = (Ze = document.elementFromPoint(I, ce)) == null ? void 0 : Ze.closest("[data-page-number]");
668
+ if (he || (he = Array.from(
669
669
  document.querySelectorAll(".epochs-pdf-viewer__page[data-page-number]")
670
- ).find((Lt) => {
671
- const Je = Lt.getBoundingClientRect();
672
- return le >= Je.top && le <= Je.bottom;
673
- }) ?? null), ne || (ne = fe.current), !ne) return;
674
- const Ne = ne.querySelector(
670
+ ).find((Je) => {
671
+ const Mt = Je.getBoundingClientRect();
672
+ return ce >= Mt.top && ce <= Mt.bottom;
673
+ }) ?? null), he || (he = pe.current), !he) return;
674
+ const ve = he.querySelector(
675
675
  ".epochs-pdf-viewer__surface"
676
676
  );
677
- if (!Ne) return;
678
- const pe = Number.parseInt(
679
- ne.getAttribute("data-page-number") || String(de.pageNumber),
677
+ if (!ve) return;
678
+ const ze = Number.parseInt(
679
+ he.getAttribute("data-page-number") || String(de.pageNumber),
680
680
  10
681
- ), me = Pt(H, le, Ne, n), $e = yt(Ne, n);
682
- let Ge = me.x - g.offsetX, Ee = me.y - g.offsetY;
683
- const lt = Math.max(0, $e.width - de.width), Xe = Math.max(0, $e.height - de.height);
684
- Ge = Math.min(Math.max(0, Ge), lt), Ee = Math.min(Math.max(0, Ee), Xe), $(g.id, {
685
- pageNumber: pe,
686
- x: Ge,
687
- y: Ee
681
+ ), le = It(I, ce, ve, n), Me = _t(ve, n);
682
+ let Se = le.x - _.offsetX, Ye = le.y - _.offsetY;
683
+ const Xe = Math.max(0, Me.width - de.width), dt = Math.max(0, Me.height - de.height);
684
+ Se = Math.min(Math.max(0, Se), Xe), Ye = Math.min(Math.max(0, Ye), dt), N(_.id, {
685
+ pageNumber: ze,
686
+ x: Se,
687
+ y: Ye
688
688
  });
689
- }, O = () => {
690
- if (o = 0, !k) return;
691
- const H = P();
692
- if (!H) return;
693
- const le = H.scrollHeight - H.clientHeight;
694
- if (le <= 0) return;
695
- const de = 56, ne = H.getBoundingClientRect(), Ne = _ - ne.top, pe = ne.bottom - _;
696
- let me = 0;
697
- if (k < 0 && Ne < de)
698
- me = -Math.max(6, (de - Ne) / de * 28);
699
- else if (k > 0 && pe < de)
700
- me = Math.max(6, (de - pe) / de * 28);
689
+ }, S = () => {
690
+ if (s = 0, !x) return;
691
+ const I = j();
692
+ if (!I) return;
693
+ const ce = I.scrollHeight - I.clientHeight;
694
+ if (ce <= 0) return;
695
+ const de = 56, he = I.getBoundingClientRect(), ve = w - he.top, ze = he.bottom - w;
696
+ let le = 0;
697
+ if (x < 0 && ve < de)
698
+ le = -Math.max(6, (de - ve) / de * 28);
699
+ else if (x > 0 && ze < de)
700
+ le = Math.max(6, (de - ze) / de * 28);
701
701
  else {
702
- k = 0;
702
+ x = 0;
703
703
  return;
704
704
  }
705
- const $e = H.scrollTop;
706
- H.scrollTop = Math.min(le, Math.max(0, $e + me)), H.scrollTop !== $e && L(w, _), me < 0 && H.scrollTop > 0 || me > 0 && H.scrollTop < le ? o = window.requestAnimationFrame(O) : k = 0;
707
- }, Z = (H) => {
708
- w = H.clientX, _ = H.clientY;
709
- const le = P();
710
- if (le) {
711
- const ne = le.getBoundingClientRect(), Ne = H.clientY - ne.top, pe = ne.bottom - H.clientY;
712
- Ne < 56 ? (k = -1, o || (o = window.requestAnimationFrame(O))) : pe < 56 ? (k = 1, o || (o = window.requestAnimationFrame(O))) : k = 0;
705
+ const Me = I.scrollTop;
706
+ I.scrollTop = Math.min(ce, Math.max(0, Me + le)), I.scrollTop !== Me && R(m, w), le < 0 && I.scrollTop > 0 || le > 0 && I.scrollTop < ce ? s = window.requestAnimationFrame(S) : x = 0;
707
+ }, X = (I) => {
708
+ m = I.clientX, w = I.clientY;
709
+ const ce = j();
710
+ if (ce) {
711
+ const he = ce.getBoundingClientRect(), ve = I.clientY - he.top, ze = he.bottom - I.clientY;
712
+ ve < 56 ? (x = -1, s || (s = window.requestAnimationFrame(S))) : ze < 56 ? (x = 1, s || (s = window.requestAnimationFrame(S))) : x = 0;
713
713
  }
714
- g.kind === "resize" ? N(H.clientX, H.clientY) : L(H.clientX, H.clientY);
715
- }, W = () => {
716
- k = 0, o && (window.cancelAnimationFrame(o), o = 0), j(null);
714
+ _.kind === "resize" ? k(I.clientX, I.clientY) : R(I.clientX, I.clientY);
715
+ }, ie = () => {
716
+ x = 0, s && (window.cancelAnimationFrame(s), s = 0), C(null);
717
717
  };
718
- return window.addEventListener("pointermove", Z), window.addEventListener("pointerup", W), window.addEventListener("pointercancel", W), () => {
719
- k = 0, o && window.cancelAnimationFrame(o), window.removeEventListener("pointermove", Z), window.removeEventListener("pointerup", W), window.removeEventListener("pointercancel", W);
718
+ return window.addEventListener("pointermove", X), window.addEventListener("pointerup", ie), window.addEventListener("pointercancel", ie), () => {
719
+ x = 0, s && window.cancelAnimationFrame(s), window.removeEventListener("pointermove", X), window.removeEventListener("pointerup", ie), window.removeEventListener("pointercancel", ie);
720
720
  };
721
721
  }, [
722
- g,
723
- oe,
724
- $,
722
+ _,
723
+ re,
724
+ N,
725
725
  n,
726
726
  v
727
727
  ]), xe(() => {
728
- if (!ve || !Y.current) return;
729
- const o = Y.current, w = Q.find((P) => P.id === ve);
730
- o.textContent = (w == null ? void 0 : w.value) ?? "", o.focus();
731
- const _ = document.createRange();
732
- _.selectNodeContents(o), _.collapse(!1);
733
- const k = window.getSelection();
734
- k == null || k.removeAllRanges(), k == null || k.addRange(_);
735
- }, [ve]);
736
- const re = (o) => {
737
- fe.current = o, r == null || r(o);
738
- }, Ce = y.filter((o) => o.pageNumber === t), ce = v.filter((o) => o.pageNumber === t), He = V.filter((o) => o.pageNumber === t), Ae = Q.filter((o) => o.pageNumber === t), Ue = (o, w) => {
739
- const _ = w.trim();
740
- if (!_) {
741
- ue == null || ue(o.id), B == null || B(null);
728
+ if (!Fe || !ne.current) return;
729
+ const s = ne.current, m = oe.find((j) => j.id === Fe);
730
+ s.textContent = (m == null ? void 0 : m.value) ?? "", s.focus();
731
+ const w = document.createRange();
732
+ w.selectNodeContents(s), w.collapse(!1);
733
+ const x = window.getSelection();
734
+ x == null || x.removeAllRanges(), x == null || x.addRange(w);
735
+ }, [Fe]);
736
+ const be = (s) => {
737
+ pe.current = s, r == null || r(s);
738
+ }, ae = b.filter((s) => s.pageNumber === t), Te = v.filter((s) => s.pageNumber === t), _e = Q.filter((s) => s.pageNumber === t), He = oe.filter((s) => s.pageNumber === t), qe = (s, m) => {
739
+ const w = m.trim();
740
+ if (!w) {
741
+ ue == null || ue(s.id), O == null || O(null);
742
742
  return;
743
743
  }
744
- const k = ut(_, o.fontSize);
745
- Ie == null || Ie(o.id, {
746
- value: _,
747
- width: k.width,
748
- height: k.height
749
- }), B == null || B(null);
750
- }, Ke = (o, w) => {
751
- if (!Me) return;
752
- const _ = ge.current, k = ie.current;
753
- if (!_ || !k) return;
754
- let P = Ti(
755
- o,
744
+ const x = gt(w, s.fontSize);
745
+ $e == null || $e(s.id, {
746
+ value: w,
747
+ width: x.width,
748
+ height: x.height
749
+ }), O == null || O(null);
750
+ }, We = (s, m) => {
751
+ if (!ke) return;
752
+ const w = G.current, x = Ee.current;
753
+ if (!w || !x) return;
754
+ let j = Fi(
755
+ s,
756
+ m,
756
757
  w,
757
- _,
758
- k,
758
+ x,
759
759
  n
760
- ), N, L = wt;
761
- if (Oe) {
762
- const W = Di(
763
- P.x,
764
- P.y,
765
- Be,
760
+ ), k, R = bt;
761
+ if (Ue) {
762
+ const ie = Bi(
763
+ j.x,
764
+ j.y,
765
+ lt,
766
766
  t
767
767
  );
768
- if (!W) return;
769
- const H = Q.find((le) => le.fieldId === W.id);
770
- if (H) {
771
- J == null || J(H.id), Pe == null || Pe(W.id), B == null || B(H.id);
768
+ if (!ie) return;
769
+ const I = oe.find((ce) => ce.fieldId === ie.id);
770
+ if (I) {
771
+ Y == null || Y(I.id), Le == null || Le(ie.id), O == null || O(I.id);
772
772
  return;
773
773
  }
774
- N = W.id, P = {
775
- x: W.x,
776
- y: W.y,
777
- fontSize: W.fontSize ?? _t
778
- }, L = W.color ?? wt, Pe == null || Pe(W.id);
774
+ k = ie.id, j = {
775
+ x: ie.x,
776
+ y: ie.y,
777
+ fontSize: ie.fontSize ?? xt
778
+ }, R = ie.color ?? bt, Le == null || Le(ie.id);
779
779
  }
780
- const O = ut("", P.fontSize), Z = {
781
- id: Gt(),
782
- fieldId: N,
780
+ const S = gt("", j.fontSize), X = {
781
+ id: Kt(),
782
+ fieldId: k,
783
783
  pageNumber: t,
784
- x: P.x,
785
- y: P.y,
786
- width: O.width,
787
- height: O.height,
784
+ x: j.x,
785
+ y: j.y,
786
+ width: S.width,
787
+ height: S.height,
788
788
  value: "",
789
- fontSize: P.fontSize,
790
- color: L
789
+ fontSize: j.fontSize,
790
+ color: R
791
791
  };
792
- Me(Z), J == null || J(Z.id), B == null || B(Z.id);
793
- }, Le = (o) => {
794
- var _;
795
- if (c !== "text" || o.target.closest(".epochs-pdf-viewer__inline-text"))
792
+ ke(X), Y == null || Y(X.id), O == null || O(X.id);
793
+ }, De = (s) => {
794
+ var w;
795
+ if (c !== "text" || s.target.closest(".epochs-pdf-viewer__inline-text"))
796
796
  return;
797
- if (se.current) {
798
- se.current = !1;
797
+ if (K.current) {
798
+ K.current = !1;
799
799
  return;
800
800
  }
801
- const w = window.getSelection();
802
- if (!(w && !w.isCollapsed && w.toString().trim())) {
803
- if (o.detail >= 2 && Fi(o.clientX, o.clientY, ie.current)) {
804
- const P = ge.current;
805
- if (P && f && Me) {
806
- const N = jt(P, n);
807
- if (N) {
801
+ const m = window.getSelection();
802
+ if (!(m && !m.isCollapsed && m.toString().trim())) {
803
+ if (s.detail >= 2 && Hi(s.clientX, s.clientY, Ee.current)) {
804
+ const j = G.current;
805
+ if (j && f && ke) {
806
+ const k = Gt(j, n);
807
+ if (k) {
808
808
  f({
809
- id: zt(),
809
+ id: Wt(),
810
810
  pageNumber: t,
811
811
  kind: "redact",
812
- color: mt,
813
- rects: Ot(N.rects),
814
- text: N.text
812
+ color: yt,
813
+ rects: Xt(k.rects),
814
+ text: k.text
815
815
  });
816
- const L = on(N.rects), O = ut(N.text || " ", L.fontSize), Z = {
817
- id: Gt(),
816
+ const R = dn(k.rects), S = gt(k.text || " ", R.fontSize), X = {
817
+ id: Kt(),
818
818
  pageNumber: t,
819
- x: L.x,
820
- y: L.y,
821
- width: O.width,
822
- height: O.height,
823
- value: N.text,
824
- fontSize: L.fontSize,
825
- color: wt
819
+ x: R.x,
820
+ y: R.y,
821
+ width: S.width,
822
+ height: S.height,
823
+ value: k.text,
824
+ fontSize: R.fontSize,
825
+ color: bt
826
826
  };
827
- Me(Z), J == null || J(Z.id), B == null || B(Z.id), (_ = window.getSelection()) == null || _.removeAllRanges(), se.current = !0;
827
+ ke(X), Y == null || Y(X.id), O == null || O(X.id), (w = window.getSelection()) == null || w.removeAllRanges(), K.current = !0;
828
828
  }
829
829
  }
830
830
  return;
831
831
  }
832
- o.stopPropagation(), Ke(o.clientX, o.clientY);
832
+ s.stopPropagation(), We(s.clientX, s.clientY);
833
833
  }
834
- }, We = (o) => {
835
- const w = o.target;
836
- if (!(w.closest(".epochs-pdf-viewer__signature") || w.closest(".epochs-pdf-viewer__signature-field") || w.closest(".epochs-pdf-viewer__inline-text"))) {
834
+ }, Ge = (s) => {
835
+ const m = s.target;
836
+ if (!(m.closest(".epochs-pdf-viewer__signature") || m.closest(".epochs-pdf-viewer__signature-field") || m.closest(".epochs-pdf-viewer__inline-text"))) {
837
837
  if (c === "text") {
838
- Ke(o.clientX, o.clientY);
838
+ We(s.clientX, s.clientY);
839
839
  return;
840
840
  }
841
- if (!oe && c === "sign" && C && F) {
842
- const _ = ge.current;
843
- if (!_) return;
844
- const k = Pt(o.clientX, o.clientY, _, n);
845
- F(t, Math.max(0, k.x - 75), Math.max(0, k.y - 12));
841
+ if (!re && c === "sign" && te && A) {
842
+ const w = G.current;
843
+ if (!w) return;
844
+ const x = It(s.clientX, s.clientY, w, n);
845
+ A(t, Math.max(0, x.x - 75), Math.max(0, x.y - 12));
846
846
  return;
847
847
  }
848
- if (!oe && c === "sign" && m && M) {
849
- const _ = ge.current;
850
- if (!_) return;
851
- const k = yt(_, n), P = Pt(o.clientX, o.clientY, _, n);
852
- let N = P.x - m.width / 2, L = P.y - m.height / 2;
853
- const O = Math.max(0, k.width - m.width), Z = Math.max(0, k.height - m.height);
854
- N = Math.min(Math.max(0, N), O), L = Math.min(Math.max(0, L), Z), M({
855
- id: Tt(),
848
+ if (!re && c === "sign" && g && P) {
849
+ const w = G.current;
850
+ if (!w) return;
851
+ const x = _t(w, n), j = It(s.clientX, s.clientY, w, n);
852
+ let k = j.x - g.width / 2, R = j.y - g.height / 2;
853
+ const S = Math.max(0, x.width - g.width), X = Math.max(0, x.height - g.height);
854
+ k = Math.min(Math.max(0, k), S), R = Math.min(Math.max(0, R), X), P({
855
+ id: Lt(),
856
856
  pageNumber: t,
857
- x: N,
858
- y: L,
859
- width: m.width,
860
- height: m.height,
861
- imageDataUrl: m.imageDataUrl
857
+ x: k,
858
+ y: R,
859
+ width: g.width,
860
+ height: g.height,
861
+ imageDataUrl: g.imageDataUrl
862
862
  });
863
863
  return;
864
864
  }
865
865
  }
866
- }, vt = (o) => ve === o.id ? /* @__PURE__ */ a(
866
+ }, St = (s) => Fe === s.id ? /* @__PURE__ */ a(
867
867
  "span",
868
868
  {
869
- ref: Y,
869
+ ref: ne,
870
870
  contentEditable: !0,
871
871
  suppressContentEditableWarning: !0,
872
872
  role: "textbox",
873
873
  "aria-label": "Edit text",
874
874
  className: "epochs-pdf-viewer__inline-text epochs-pdf-viewer__inline-text--editing",
875
875
  style: {
876
- left: o.x * n,
877
- top: o.y * n,
878
- fontSize: o.fontSize * n,
879
- color: o.color,
880
- minWidth: Math.max(12, o.fontSize * n * 0.5),
881
- width: Math.max(o.width * n, o.fontSize * n * 0.5)
876
+ left: s.x * n,
877
+ top: s.y * n,
878
+ fontSize: s.fontSize * n,
879
+ color: s.color,
880
+ minWidth: Math.max(12, s.fontSize * n * 0.5),
881
+ width: Math.max(s.width * n, s.fontSize * n * 0.5)
882
882
  },
883
- onClick: (_) => _.stopPropagation(),
884
- onPointerDown: (_) => _.stopPropagation(),
885
- onInput: (_) => {
886
- const k = _.currentTarget.textContent ?? "", P = ut(k || " ", o.fontSize);
887
- Ie == null || Ie(o.id, {
888
- value: k,
889
- width: P.width,
890
- height: P.height
883
+ onClick: (w) => w.stopPropagation(),
884
+ onPointerDown: (w) => w.stopPropagation(),
885
+ onInput: (w) => {
886
+ const x = w.currentTarget.textContent ?? "", j = gt(x || " ", s.fontSize);
887
+ $e == null || $e(s.id, {
888
+ value: x,
889
+ width: j.width,
890
+ height: j.height
891
891
  });
892
892
  },
893
- onBlur: (_) => {
894
- Ue(o, _.currentTarget.textContent ?? "");
893
+ onBlur: (w) => {
894
+ qe(s, w.currentTarget.textContent ?? "");
895
895
  },
896
- onKeyDown: (_) => {
897
- _.stopPropagation(), _.key === "Escape" && (_.preventDefault(), _.currentTarget.blur()), _.key === "Enter" && !_.shiftKey && (_.preventDefault(), _.currentTarget.blur());
896
+ onKeyDown: (w) => {
897
+ w.stopPropagation(), w.key === "Escape" && (w.preventDefault(), w.currentTarget.blur()), w.key === "Enter" && !w.shiftKey && (w.preventDefault(), w.currentTarget.blur());
898
898
  }
899
899
  },
900
- o.id
901
- ) : o.value.trim() ? /* @__PURE__ */ a(
900
+ s.id
901
+ ) : s.value.trim() ? /* @__PURE__ */ a(
902
902
  "span",
903
903
  {
904
- className: be === o.id ? "epochs-pdf-viewer__inline-text epochs-pdf-viewer__inline-text--selected" : "epochs-pdf-viewer__inline-text",
904
+ className: ye === s.id ? "epochs-pdf-viewer__inline-text epochs-pdf-viewer__inline-text--selected" : "epochs-pdf-viewer__inline-text",
905
905
  style: {
906
- left: o.x * n,
907
- top: o.y * n,
908
- fontSize: o.fontSize * n,
909
- color: o.color
906
+ left: s.x * n,
907
+ top: s.y * n,
908
+ fontSize: s.fontSize * n,
909
+ color: s.color
910
910
  },
911
- onClick: (_) => {
912
- if (_.stopPropagation(), c === "erase") {
913
- ue == null || ue(o.id);
911
+ onClick: (w) => {
912
+ if (w.stopPropagation(), c === "erase") {
913
+ ue == null || ue(s.id);
914
914
  return;
915
915
  }
916
- c === "text" && (J == null || J(o.id), B == null || B(o.id));
916
+ c === "text" && (Y == null || Y(s.id), O == null || O(s.id));
917
917
  },
918
- children: o.value
918
+ children: s.value
919
919
  },
920
- o.id
920
+ s.id
921
921
  ) : null;
922
922
  return /* @__PURE__ */ a(
923
923
  "div",
924
924
  {
925
- ref: re,
925
+ ref: be,
926
926
  "data-page-number": t,
927
927
  className: "epochs-pdf-viewer__page",
928
- children: /* @__PURE__ */ T(
928
+ children: /* @__PURE__ */ $(
929
929
  "div",
930
930
  {
931
- ref: ge,
931
+ ref: G,
932
932
  className: `epochs-pdf-viewer__surface epochs-pdf-viewer__surface--tool-${c}`,
933
- onClick: We,
933
+ onClick: Ge,
934
934
  children: [
935
- /* @__PURE__ */ a("canvas", { ref: je, className: "epochs-pdf-viewer__canvas" }),
936
- /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__markup-layer", "aria-hidden": "true", children: Ce.map(
937
- (o) => o.kind === "redact" ? null : o.rects.map((w, _) => o.kind === "highlight" ? /* @__PURE__ */ a(
935
+ /* @__PURE__ */ a("canvas", { ref: fe, className: "epochs-pdf-viewer__canvas" }),
936
+ /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__markup-layer", "aria-hidden": "true", children: ae.map(
937
+ (s) => s.kind === "redact" ? null : s.rects.map((m, w) => s.kind === "highlight" ? /* @__PURE__ */ a(
938
938
  "div",
939
939
  {
940
940
  className: "epochs-pdf-viewer__markup epochs-pdf-viewer__markup--highlight",
941
941
  style: {
942
- left: w.x * n,
943
- top: w.y * n,
944
- width: w.w * n,
945
- height: w.h * n,
946
- background: o.color
942
+ left: m.x * n,
943
+ top: m.y * n,
944
+ width: m.w * n,
945
+ height: m.h * n,
946
+ background: s.color
947
947
  },
948
- onClick: (k) => {
949
- c === "erase" && (k.stopPropagation(), x == null || x(o.id));
948
+ onClick: (x) => {
949
+ c === "erase" && (x.stopPropagation(), M == null || M(s.id));
950
950
  }
951
951
  },
952
- `${o.id}_${_}`
952
+ `${s.id}_${w}`
953
953
  ) : /* @__PURE__ */ a(
954
954
  "div",
955
955
  {
956
956
  className: "epochs-pdf-viewer__markup epochs-pdf-viewer__markup--underline",
957
957
  style: {
958
- left: w.x * n,
959
- top: (w.y + w.h) * n - Math.max(2, n * 1.5),
960
- width: w.w * n,
958
+ left: m.x * n,
959
+ top: (m.y + m.h) * n - Math.max(2, n * 1.5),
960
+ width: m.w * n,
961
961
  height: Math.max(2, n * 1.5),
962
- background: o.color
962
+ background: s.color
963
963
  },
964
- onClick: (k) => {
965
- c === "erase" && (k.stopPropagation(), x == null || x(o.id));
964
+ onClick: (x) => {
965
+ c === "erase" && (x.stopPropagation(), M == null || M(s.id));
966
966
  }
967
967
  },
968
- `${o.id}_${_}`
968
+ `${s.id}_${w}`
969
969
  ))
970
970
  ) }),
971
- /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__signature-layer", children: [
972
- He.map((o) => {
973
- const w = ce.some((_) => _.fieldId === o.id);
971
+ /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__signature-layer", children: [
972
+ _e.map((s) => {
973
+ const m = Te.some((w) => w.fieldId === s.id);
974
974
  return /* @__PURE__ */ a(
975
975
  "button",
976
976
  {
977
977
  type: "button",
978
- "data-signature-field-id": o.id,
979
- className: te === o.id ? "epochs-pdf-viewer__signature-field epochs-pdf-viewer__signature-field--selected" : w ? "epochs-pdf-viewer__signature-field epochs-pdf-viewer__signature-field--filled" : "epochs-pdf-viewer__signature-field",
978
+ "data-signature-field-id": s.id,
979
+ className: ee === s.id ? "epochs-pdf-viewer__signature-field epochs-pdf-viewer__signature-field--selected" : m ? "epochs-pdf-viewer__signature-field epochs-pdf-viewer__signature-field--filled" : "epochs-pdf-viewer__signature-field",
980
980
  style: {
981
- left: o.x * n,
982
- top: o.y * n,
983
- width: o.width * n,
984
- height: o.height * n
981
+ left: s.x * n,
982
+ top: s.y * n,
983
+ width: s.width * n,
984
+ height: s.height * n
985
985
  },
986
- onClick: (_) => {
987
- _.stopPropagation();
988
- const k = o.type;
989
- if (k === "date" || k === "text") return;
990
- X == null || X(o.id);
991
- const P = ce.find((N) => N.fieldId === o.id);
992
- I == null || I((P == null ? void 0 : P.id) ?? null), P ? S == null || S(P.id) : ke == null || ke(o.type);
986
+ onClick: (w) => {
987
+ w.stopPropagation();
988
+ const x = s.type;
989
+ if (x === "date" || x === "text") return;
990
+ W == null || W(s.id);
991
+ const j = Te.find((k) => k.fieldId === s.id);
992
+ T == null || T((j == null ? void 0 : j.id) ?? null), j ? E == null || E(j.id) : Pe == null || Pe(s.type);
993
993
  },
994
- title: w ? "Signed field" : "Signature field",
994
+ title: m ? "Signed field" : "Signature field",
995
995
  children: (() => {
996
- const _ = o.type;
997
- return _ === "date" ? /* @__PURE__ */ a(
996
+ const w = s.type;
997
+ return w === "date" ? /* @__PURE__ */ a(
998
998
  "input",
999
999
  {
1000
1000
  type: "date",
1001
1001
  className: "epochs-pdf-viewer__signature-field-input",
1002
- value: ye[o.id] ?? "",
1003
- onClick: (k) => k.stopPropagation(),
1004
- onChange: (k) => {
1005
- k.stopPropagation(), D == null || D(o.id, k.target.value), ae == null || ae(o.id);
1002
+ value: we[s.id] ?? "",
1003
+ onClick: (x) => x.stopPropagation(),
1004
+ onChange: (x) => {
1005
+ x.stopPropagation(), D == null || D(s.id, x.target.value), se == null || se(s.id);
1006
1006
  },
1007
1007
  style: { width: "100%", height: "100%" }
1008
1008
  }
1009
- ) : _ === "text" ? /* @__PURE__ */ a(
1009
+ ) : w === "text" ? /* @__PURE__ */ a(
1010
1010
  "input",
1011
1011
  {
1012
1012
  type: "text",
1013
1013
  className: "epochs-pdf-viewer__signature-field-input",
1014
- value: ye[o.id] ?? "",
1015
- placeholder: o.placeholder ?? "Enter text",
1016
- onClick: (k) => k.stopPropagation(),
1017
- onChange: (k) => {
1018
- k.stopPropagation(), D == null || D(o.id, k.target.value);
1014
+ value: we[s.id] ?? "",
1015
+ placeholder: s.placeholder ?? "Enter text",
1016
+ onClick: (x) => x.stopPropagation(),
1017
+ onChange: (x) => {
1018
+ x.stopPropagation(), D == null || D(s.id, x.target.value);
1019
1019
  },
1020
- onBlur: () => ae == null ? void 0 : ae(o.id),
1020
+ onBlur: () => se == null ? void 0 : se(s.id),
1021
1021
  style: { width: "100%", height: "100%" }
1022
1022
  }
1023
- ) : w ? null : /* @__PURE__ */ a("span", { children: "Sign here" });
1023
+ ) : m ? null : /* @__PURE__ */ a("span", { children: "Sign here" });
1024
1024
  })()
1025
1025
  },
1026
- o.id
1026
+ s.id
1027
1027
  );
1028
1028
  }),
1029
- ce.map((o) => /* @__PURE__ */ T(
1029
+ Te.map((s) => /* @__PURE__ */ $(
1030
1030
  "div",
1031
1031
  {
1032
- className: E === o.id ? "epochs-pdf-viewer__signature epochs-pdf-viewer__signature--selected" : "epochs-pdf-viewer__signature",
1032
+ className: B === s.id ? "epochs-pdf-viewer__signature epochs-pdf-viewer__signature--selected" : "epochs-pdf-viewer__signature",
1033
1033
  style: {
1034
- left: o.x * n,
1035
- top: o.y * n,
1036
- width: o.width * n,
1037
- height: o.height * n
1034
+ left: s.x * n,
1035
+ top: s.y * n,
1036
+ width: s.width * n,
1037
+ height: s.height * n
1038
1038
  },
1039
- onPointerDown: (w) => {
1040
- if (w.stopPropagation(), w.preventDefault(), I == null || I(o.id), c === "erase" && !oe) {
1041
- G == null || G(o.id);
1039
+ onPointerDown: (m) => {
1040
+ if (m.stopPropagation(), m.preventDefault(), T == null || T(s.id), c === "erase" && !re) {
1041
+ U == null || U(s.id);
1042
1042
  return;
1043
1043
  }
1044
- if (oe) {
1045
- X == null || X(o.fieldId ?? null), S == null || S(o.id);
1044
+ if (re) {
1045
+ W == null || W(s.fieldId ?? null), E == null || E(s.id);
1046
1046
  return;
1047
1047
  }
1048
- const _ = ge.current;
1049
- if (!_) return;
1050
- const k = Pt(w.clientX, w.clientY, _, n);
1051
- j({
1048
+ const w = G.current;
1049
+ if (!w) return;
1050
+ const x = It(m.clientX, m.clientY, w, n);
1051
+ C({
1052
1052
  kind: "signature",
1053
- id: o.id,
1054
- offsetX: k.x - o.x,
1055
- offsetY: k.y - o.y
1053
+ id: s.id,
1054
+ offsetX: x.x - s.x,
1055
+ offsetY: x.y - s.y
1056
1056
  });
1057
1057
  },
1058
1058
  children: [
@@ -1063,16 +1063,16 @@ function Qi({
1063
1063
  className: "epochs-pdf-viewer__signature-edit",
1064
1064
  title: "Edit signature",
1065
1065
  "aria-label": "Edit signature",
1066
- onPointerDown: (w) => {
1067
- w.stopPropagation();
1066
+ onPointerDown: (m) => {
1067
+ m.stopPropagation();
1068
1068
  },
1069
- onClick: (w) => {
1070
- w.stopPropagation(), I == null || I(o.id), S == null || S(o.id);
1069
+ onClick: (m) => {
1070
+ m.stopPropagation(), T == null || T(s.id), E == null || E(s.id);
1071
1071
  },
1072
- children: /* @__PURE__ */ a(Zi, { size: 12 })
1072
+ children: /* @__PURE__ */ a(tr, { size: 12 })
1073
1073
  }
1074
1074
  ),
1075
- oe ? null : /* @__PURE__ */ T(bt, { children: [
1075
+ re ? null : /* @__PURE__ */ $(vt, { children: [
1076
1076
  /* @__PURE__ */ a(
1077
1077
  "button",
1078
1078
  {
@@ -1080,11 +1080,11 @@ function Qi({
1080
1080
  className: "epochs-pdf-viewer__signature-duplicate",
1081
1081
  title: "Duplicate signature",
1082
1082
  "aria-label": "Duplicate signature",
1083
- onPointerDown: (w) => {
1084
- w.stopPropagation();
1083
+ onPointerDown: (m) => {
1084
+ m.stopPropagation();
1085
1085
  },
1086
- onClick: (w) => {
1087
- w.stopPropagation(), I == null || I(o.id), z == null || z(o.id);
1086
+ onClick: (m) => {
1087
+ m.stopPropagation(), T == null || T(s.id), z == null || z(s.id);
1088
1088
  },
1089
1089
  children: "⧉"
1090
1090
  }
@@ -1096,30 +1096,30 @@ function Qi({
1096
1096
  className: "epochs-pdf-viewer__signature-remove",
1097
1097
  title: "Remove signature",
1098
1098
  "aria-label": "Remove signature",
1099
- onPointerDown: (w) => {
1100
- w.stopPropagation();
1099
+ onPointerDown: (m) => {
1100
+ m.stopPropagation();
1101
1101
  },
1102
- onClick: (w) => {
1103
- w.stopPropagation(), G == null || G(o.id);
1102
+ onClick: (m) => {
1103
+ m.stopPropagation(), U == null || U(s.id);
1104
1104
  },
1105
1105
  children: "×"
1106
1106
  }
1107
1107
  )
1108
1108
  ] }),
1109
- /* @__PURE__ */ a("img", { src: o.imageDataUrl, alt: "Signature", draggable: !1 }),
1110
- oe ? null : /* @__PURE__ */ a(
1109
+ /* @__PURE__ */ a("img", { src: s.imageDataUrl, alt: "Signature", draggable: !1 }),
1110
+ re ? null : /* @__PURE__ */ a(
1111
1111
  "div",
1112
1112
  {
1113
1113
  className: "epochs-pdf-viewer__signature-resize",
1114
1114
  title: "Resize",
1115
- onPointerDown: (w) => {
1116
- w.stopPropagation(), w.preventDefault(), I == null || I(o.id), j({
1115
+ onPointerDown: (m) => {
1116
+ m.stopPropagation(), m.preventDefault(), T == null || T(s.id), C({
1117
1117
  kind: "resize",
1118
- id: o.id,
1119
- startX: w.clientX,
1120
- startY: w.clientY,
1121
- startW: o.width,
1122
- startH: o.height
1118
+ id: s.id,
1119
+ startX: m.clientX,
1120
+ startY: m.clientY,
1121
+ startW: s.width,
1122
+ startH: s.height
1123
1123
  });
1124
1124
  },
1125
1125
  children: /* @__PURE__ */ a("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ a("path", { d: "M7 1L1 7M7 4L4 7", stroke: "white", strokeWidth: "1.2", strokeLinecap: "round" }) })
@@ -1127,35 +1127,35 @@ function Qi({
1127
1127
  )
1128
1128
  ]
1129
1129
  },
1130
- o.id
1130
+ s.id
1131
1131
  ))
1132
1132
  ] }),
1133
- /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__text-layer-overlay", children: Ae.map((o) => vt(o)) }),
1133
+ /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__text-layer-overlay", children: He.map((s) => St(s)) }),
1134
1134
  /* @__PURE__ */ a(
1135
1135
  "div",
1136
1136
  {
1137
- ref: ie,
1137
+ ref: Ee,
1138
1138
  className: "textLayer epochs-pdf-viewer__text-layer",
1139
- onClick: Le
1139
+ onClick: De
1140
1140
  }
1141
1141
  ),
1142
- /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__redact-layer", "aria-hidden": "true", children: Ce.map(
1143
- (o) => o.kind === "redact" ? o.rects.map((w, _) => /* @__PURE__ */ a(
1142
+ /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__redact-layer", "aria-hidden": "true", children: ae.map(
1143
+ (s) => s.kind === "redact" ? s.rects.map((m, w) => /* @__PURE__ */ a(
1144
1144
  "div",
1145
1145
  {
1146
1146
  className: "epochs-pdf-viewer__markup epochs-pdf-viewer__markup--redact",
1147
1147
  style: {
1148
- left: w.x * n,
1149
- top: w.y * n,
1150
- width: w.w * n,
1151
- height: w.h * n,
1152
- background: o.color || mt
1148
+ left: m.x * n,
1149
+ top: m.y * n,
1150
+ width: m.w * n,
1151
+ height: m.h * n,
1152
+ background: s.color || yt
1153
1153
  },
1154
- onClick: (k) => {
1155
- c === "erase" && (k.stopPropagation(), x == null || x(o.id));
1154
+ onClick: (x) => {
1155
+ c === "erase" && (x.stopPropagation(), M == null || M(s.id));
1156
1156
  }
1157
1157
  },
1158
- `${o.id}_${_}`
1158
+ `${s.id}_${w}`
1159
1159
  )) : null
1160
1160
  ) })
1161
1161
  ]
@@ -1164,60 +1164,60 @@ function Qi({
1164
1164
  }
1165
1165
  );
1166
1166
  }
1167
- function Ji({
1167
+ function rr({
1168
1168
  pdfDoc: e,
1169
1169
  pageNumber: t,
1170
1170
  isActive: n,
1171
1171
  rotation: i,
1172
1172
  onSelect: r,
1173
- width: s = 140,
1173
+ width: o = 140,
1174
1174
  annotations: c = [],
1175
1175
  signatures: l = [],
1176
- signatureFields: y = [],
1176
+ signatureFields: b = [],
1177
1177
  texts: f = [],
1178
- textFields: x = []
1178
+ textFields: M = []
1179
1179
  }) {
1180
- const v = _e(null);
1180
+ const v = me(null);
1181
1181
  return xe(() => {
1182
1182
  if (!e || !v.current) return;
1183
- let m = !1;
1184
- const M = v.current, $ = M.getContext("2d");
1185
- if (!$) return;
1186
- let G = null;
1183
+ let g = !1;
1184
+ const P = v.current, N = P.getContext("2d");
1185
+ if (!N) return;
1186
+ let U = null;
1187
1187
  return (async () => {
1188
1188
  try {
1189
1189
  const z = await e.getPage(t);
1190
- if (m) return;
1191
- const E = z.getViewport({ scale: 1, rotation: i }), I = s / E.width, V = z.getViewport({ scale: I, rotation: i });
1192
- M.width = Math.floor(V.width), M.height = Math.floor(V.height), G = z.render({ canvasContext: $, viewport: V }), await G.promise;
1193
- const te = c.filter((D) => D.pageNumber === t);
1194
- te.length > 0 && wn($, te, I);
1195
- const X = l.filter((D) => D.pageNumber === t), oe = y.filter(
1190
+ if (g) return;
1191
+ const B = z.getViewport({ scale: 1, rotation: i }), T = o / B.width, Q = z.getViewport({ scale: T, rotation: i });
1192
+ P.width = Math.floor(Q.width), P.height = Math.floor(Q.height), U = z.render({ canvasContext: N, viewport: Q }), await U.promise;
1193
+ const ee = c.filter((D) => D.pageNumber === t);
1194
+ ee.length > 0 && xn(N, ee, T);
1195
+ const W = l.filter((D) => D.pageNumber === t), re = b.filter(
1196
1196
  (D) => D.pageNumber === t
1197
1197
  );
1198
- oe.length > 0 && ki(
1199
- $,
1200
- oe,
1201
- new Set(X.map((D) => D.fieldId).filter(Boolean)),
1202
- I
1203
- ), X.length > 0 && await yn($, X, I);
1204
- const ke = f.filter((D) => D.pageNumber === t), ye = x.filter(
1198
+ re.length > 0 && Ti(
1199
+ N,
1200
+ re,
1201
+ new Set(W.map((D) => D.fieldId).filter(Boolean)),
1202
+ T
1203
+ ), W.length > 0 && await kn(N, W, T);
1204
+ const Pe = f.filter((D) => D.pageNumber === t), we = M.filter(
1205
1205
  (D) => D.pageNumber === t
1206
1206
  );
1207
- ye.length > 0 && Ai(
1208
- $,
1209
- ye,
1207
+ we.length > 0 && zi(
1208
+ N,
1209
+ we,
1210
1210
  new Set(
1211
- ke.filter((D) => D.fieldId && D.value.trim()).map((D) => D.fieldId)
1211
+ Pe.filter((D) => D.fieldId && D.value.trim()).map((D) => D.fieldId)
1212
1212
  ),
1213
- I
1214
- ), ke.length > 0 && bn($, ke, I);
1213
+ T
1214
+ ), Pe.length > 0 && Mn(N, Pe, T);
1215
1215
  } catch {
1216
1216
  }
1217
1217
  })(), () => {
1218
- if (m = !0, G)
1218
+ if (g = !0, U)
1219
1219
  try {
1220
- G.cancel();
1220
+ U.cancel();
1221
1221
  } catch {
1222
1222
  }
1223
1223
  };
@@ -1226,12 +1226,12 @@ function Ji({
1226
1226
  e,
1227
1227
  t,
1228
1228
  i,
1229
- y,
1229
+ b,
1230
1230
  l,
1231
- x,
1231
+ M,
1232
1232
  f,
1233
- s
1234
- ]), /* @__PURE__ */ T(
1233
+ o
1234
+ ]), /* @__PURE__ */ $(
1235
1235
  "button",
1236
1236
  {
1237
1237
  type: "button",
@@ -1245,36 +1245,36 @@ function Ji({
1245
1245
  }
1246
1246
  );
1247
1247
  }
1248
- const er = /^(blob:|https?:|data:)/i;
1249
- let _n = !1;
1250
- function sn(e) {
1251
- ct.GlobalWorkerOptions.workerSrc = e, _n = !0;
1248
+ const or = /^(blob:|https?:|data:)/i;
1249
+ let Pn = !1;
1250
+ function hn(e) {
1251
+ ct.GlobalWorkerOptions.workerSrc = e, Pn = !0;
1252
1252
  }
1253
- function tr(e) {
1253
+ function sr(e) {
1254
1254
  if (e) {
1255
- sn(e);
1255
+ hn(e);
1256
1256
  return;
1257
1257
  }
1258
- _n || ct.GlobalWorkerOptions.workerSrc || sn(
1258
+ Pn || ct.GlobalWorkerOptions.workerSrc || hn(
1259
1259
  `https://unpkg.com/pdfjs-dist@${ct.version}/build/pdf.worker.min.mjs`
1260
1260
  );
1261
1261
  }
1262
- function nr(e, t, n = "") {
1262
+ function ar(e, t, n = "") {
1263
1263
  const i = t || e;
1264
1264
  if (!i) return "";
1265
- if (er.test(i)) return i;
1265
+ if (or.test(i)) return i;
1266
1266
  const r = i.startsWith("/") ? i : `/${i}`;
1267
1267
  return n ? `${n.replace(/\/$/, "")}${r}` : r;
1268
1268
  }
1269
- async function ir(e, t) {
1269
+ async function cr(e, t) {
1270
1270
  const n = await fetch(e, t);
1271
1271
  if (!n.ok)
1272
1272
  throw new Error(`Failed to fetch PDF (${n.status})`);
1273
1273
  return n.arrayBuffer();
1274
1274
  }
1275
- async function an(e, t) {
1275
+ async function un(e, t) {
1276
1276
  if (typeof e == "string")
1277
- return ir(e, t);
1277
+ return cr(e, t);
1278
1278
  if (e instanceof ArrayBuffer) return e.slice(0);
1279
1279
  if (e instanceof Uint8Array) {
1280
1280
  const n = new Uint8Array(e.byteLength);
@@ -1282,144 +1282,144 @@ async function an(e, t) {
1282
1282
  }
1283
1283
  return e.arrayBuffer();
1284
1284
  }
1285
- async function rr(e, t, n) {
1285
+ async function lr(e, t, n) {
1286
1286
  const {
1287
1287
  scale: i,
1288
1288
  rotation: r,
1289
- annotations: s,
1289
+ annotations: o,
1290
1290
  signatures: c = [],
1291
1291
  texts: l = [],
1292
- mimeType: y = "image/jpeg",
1292
+ mimeType: b = "image/jpeg",
1293
1293
  quality: f = 0.92
1294
- } = n, x = await e.getPage(t), v = x.getViewport({ scale: i, rotation: r }), m = x.getViewport({ scale: 1, rotation: r }), M = document.createElement("canvas"), $ = M.getContext("2d", { alpha: !1 });
1295
- if (!$)
1294
+ } = n, M = await e.getPage(t), v = M.getViewport({ scale: i, rotation: r }), g = M.getViewport({ scale: 1, rotation: r }), P = document.createElement("canvas"), N = P.getContext("2d", { alpha: !1 });
1295
+ if (!N)
1296
1296
  throw new Error("Could not create canvas context");
1297
- const G = Math.floor(v.width), S = Math.floor(v.height);
1298
- M.width = G, M.height = S, $.fillStyle = "#ffffff", $.fillRect(0, 0, G, S), await x.render({ canvasContext: $, viewport: v }).promise;
1299
- const z = s.filter((X) => X.pageNumber === t);
1300
- z.length > 0 && wn($, z, i);
1301
- const E = c.filter((X) => X.pageNumber === t);
1302
- E.length > 0 && await yn($, E, i);
1303
- const I = l.filter((X) => X.pageNumber === t);
1304
- I.length > 0 && bn($, I, i);
1305
- const V = M.toDataURL(y, f), te = or(V);
1306
- return M.width = 0, M.height = 0, {
1297
+ const U = Math.floor(v.width), E = Math.floor(v.height);
1298
+ P.width = U, P.height = E, N.fillStyle = "#ffffff", N.fillRect(0, 0, U, E), await M.render({ canvasContext: N, viewport: v }).promise;
1299
+ const z = o.filter((W) => W.pageNumber === t);
1300
+ z.length > 0 && xn(N, z, i);
1301
+ const B = c.filter((W) => W.pageNumber === t);
1302
+ B.length > 0 && await kn(N, B, i);
1303
+ const T = l.filter((W) => W.pageNumber === t);
1304
+ T.length > 0 && Mn(N, T, i);
1305
+ const Q = P.toDataURL(b, f), ee = dr(Q);
1306
+ return P.width = 0, P.height = 0, {
1307
1307
  pageNumber: t,
1308
- width: G,
1309
- height: S,
1310
- pageWidth: m.width,
1311
- pageHeight: m.height,
1312
- dataUrl: V,
1313
- jpegBytes: te
1308
+ width: U,
1309
+ height: E,
1310
+ pageWidth: g.width,
1311
+ pageHeight: g.height,
1312
+ dataUrl: Q,
1313
+ jpegBytes: ee
1314
1314
  };
1315
1315
  }
1316
- async function cn(e, t) {
1316
+ async function pn(e, t) {
1317
1317
  const n = [];
1318
1318
  for (let i = 1; i <= e.numPages; i += 1)
1319
- n.push(await rr(e, i, t));
1319
+ n.push(await lr(e, i, t));
1320
1320
  return n;
1321
1321
  }
1322
- function or(e) {
1322
+ function dr(e) {
1323
1323
  const t = e.split(",")[1] ?? "", n = atob(t), i = new Uint8Array(n.length);
1324
1324
  for (let r = 0; r < n.length; r += 1)
1325
1325
  i[r] = n.charCodeAt(r);
1326
1326
  return i;
1327
1327
  }
1328
- function ze(e) {
1328
+ function Oe(e) {
1329
1329
  return new TextEncoder().encode(e);
1330
1330
  }
1331
- function ln(...e) {
1332
- const t = e.reduce((r, s) => r + s.byteLength, 0), n = new Uint8Array(t);
1331
+ function fn(...e) {
1332
+ const t = e.reduce((r, o) => r + o.byteLength, 0), n = new Uint8Array(t);
1333
1333
  let i = 0;
1334
1334
  for (const r of e)
1335
1335
  n.set(r, i), i += r.byteLength;
1336
1336
  return n;
1337
1337
  }
1338
- function sr(e) {
1339
- const t = [], n = (m) => (t.push(m), t.length), i = [];
1340
- for (const m of e) {
1341
- const M = ln(
1342
- ze(
1343
- `<< /Type /XObject /Subtype /Image /Width ${m.width} /Height ${m.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${m.jpegBytes.byteLength} >>
1338
+ function hr(e) {
1339
+ const t = [], n = (g) => (t.push(g), t.length), i = [];
1340
+ for (const g of e) {
1341
+ const P = fn(
1342
+ Oe(
1343
+ `<< /Type /XObject /Subtype /Image /Width ${g.width} /Height ${g.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${g.jpegBytes.byteLength} >>
1344
1344
  stream
1345
1345
  `
1346
1346
  ),
1347
- m.jpegBytes,
1348
- ze(`
1347
+ g.jpegBytes,
1348
+ Oe(`
1349
1349
  endstream`)
1350
- ), $ = n(M), G = `q
1351
- ${m.pageWidth.toFixed(2)} 0 0 ${m.pageHeight.toFixed(2)} 0 0 cm
1350
+ ), N = n(P), U = `q
1351
+ ${g.pageWidth.toFixed(2)} 0 0 ${g.pageHeight.toFixed(2)} 0 0 cm
1352
1352
  /Im0 Do
1353
- Q`, S = n(
1354
- ze(`<< /Length ${G.length} >>
1353
+ Q`, E = n(
1354
+ Oe(`<< /Length ${U.length} >>
1355
1355
  stream
1356
- ${G}
1356
+ ${U}
1357
1357
  endstream`)
1358
1358
  ), z = n(
1359
- ze(
1360
- `<< /Type /Page /Parent __PAGES__ 0 R /MediaBox [0 0 ${m.pageWidth.toFixed(2)} ${m.pageHeight.toFixed(2)}] /Contents ${S} 0 R /Resources << /XObject << /Im0 ${$} 0 R >> >> >>`
1359
+ Oe(
1360
+ `<< /Type /Page /Parent __PAGES__ 0 R /MediaBox [0 0 ${g.pageWidth.toFixed(2)} ${g.pageHeight.toFixed(2)}] /Contents ${E} 0 R /Resources << /XObject << /Im0 ${N} 0 R >> >> >>`
1361
1361
  )
1362
1362
  );
1363
1363
  i.push(z);
1364
1364
  }
1365
- const r = i.map((m) => `${m} 0 R`).join(" "), s = n(
1366
- ze(`<< /Type /Pages /Kids [${r}] /Count ${i.length} >>`)
1365
+ const r = i.map((g) => `${g} 0 R`).join(" "), o = n(
1366
+ Oe(`<< /Type /Pages /Kids [${r}] /Count ${i.length} >>`)
1367
1367
  );
1368
- for (const m of i) {
1369
- const M = new TextDecoder().decode(t[m - 1]);
1370
- t[m - 1] = ze(
1371
- M.replace("/Parent __PAGES__ 0 R", `/Parent ${s} 0 R`)
1368
+ for (const g of i) {
1369
+ const P = new TextDecoder().decode(t[g - 1]);
1370
+ t[g - 1] = Oe(
1371
+ P.replace("/Parent __PAGES__ 0 R", `/Parent ${o} 0 R`)
1372
1372
  );
1373
1373
  }
1374
- const c = n(ze(`<< /Type /Catalog /Pages ${s} 0 R >>`)), l = [ze(`%PDF-1.4
1375
- `)], y = [0];
1374
+ const c = n(Oe(`<< /Type /Catalog /Pages ${o} 0 R >>`)), l = [Oe(`%PDF-1.4
1375
+ `)], b = [0];
1376
1376
  let f = l[0].byteLength;
1377
- for (let m = 0; m < t.length; m += 1) {
1378
- y.push(f);
1379
- const M = ze(`${m + 1} 0 obj
1380
- `), $ = ze(`
1377
+ for (let g = 0; g < t.length; g += 1) {
1378
+ b.push(f);
1379
+ const P = Oe(`${g + 1} 0 obj
1380
+ `), N = Oe(`
1381
1381
  endobj
1382
1382
  `);
1383
- l.push(M, t[m], $), f += M.byteLength + t[m].byteLength + $.byteLength;
1383
+ l.push(P, t[g], N), f += P.byteLength + t[g].byteLength + N.byteLength;
1384
1384
  }
1385
- const x = f;
1385
+ const M = f;
1386
1386
  let v = `xref
1387
1387
  0 ${t.length + 1}
1388
1388
  `;
1389
1389
  v += `0000000000 65535 f
1390
1390
  `;
1391
- for (let m = 1; m <= t.length; m += 1)
1392
- v += `${String(y[m]).padStart(10, "0")} 00000 n
1391
+ for (let g = 1; g <= t.length; g += 1)
1392
+ v += `${String(b[g]).padStart(10, "0")} 00000 n
1393
1393
  `;
1394
1394
  return v += `trailer
1395
1395
  << /Size ${t.length + 1} /Root ${c} 0 R >>
1396
1396
  `, v += `startxref
1397
- ${x}
1398
- %%EOF`, l.push(ze(v)), ln(...l);
1397
+ ${M}
1398
+ %%EOF`, l.push(Oe(v)), fn(...l);
1399
1399
  }
1400
- function Xt(e, t) {
1400
+ function Zt(e, t) {
1401
1401
  const n = URL.createObjectURL(e), i = document.createElement("a");
1402
1402
  i.href = n, i.download = t, i.click(), URL.revokeObjectURL(n);
1403
1403
  }
1404
- const It = [
1404
+ const Ft = [
1405
1405
  { id: "dancing-script", label: "Dancing Script", family: "Dancing Script" },
1406
1406
  { id: "great-vibes", label: "Great Vibes", family: "Great Vibes" },
1407
1407
  { id: "pacifico", label: "Pacifico", family: "Pacifico" },
1408
1408
  { id: "satisfy", label: "Satisfy", family: "Satisfy" },
1409
1409
  { id: "allura", label: "Allura", family: "Allura" }
1410
- ], ar = "https://fonts.googleapis.com/css2?family=Allura&family=Dancing+Script:wght@500;600&family=Great+Vibes&family=Pacifico&family=Satisfy&display=swap";
1411
- let Nt = null;
1412
- function cr() {
1413
- return typeof document > "u" ? Promise.resolve() : Nt || (Nt = new Promise((e) => {
1410
+ ], ur = "https://fonts.googleapis.com/css2?family=Allura&family=Dancing+Script:wght@500;600&family=Great+Vibes&family=Pacifico&family=Satisfy&display=swap";
1411
+ let Ct = null;
1412
+ function pr() {
1413
+ return typeof document > "u" ? Promise.resolve() : Ct || (Ct = new Promise((e) => {
1414
1414
  var i;
1415
1415
  if (!document.querySelector(
1416
1416
  'link[data-epochs-signature-fonts="true"]'
1417
1417
  )) {
1418
1418
  const r = document.createElement("link");
1419
- r.rel = "stylesheet", r.href = ar, r.dataset.epochsSignatureFonts = "true", document.head.appendChild(r);
1419
+ r.rel = "stylesheet", r.href = ur, r.dataset.epochsSignatureFonts = "true", document.head.appendChild(r);
1420
1420
  }
1421
1421
  const n = () => Promise.all(
1422
- It.map(
1422
+ Ft.map(
1423
1423
  (r) => document.fonts.load(`48px "${r.family}"`)
1424
1424
  )
1425
1425
  ).then(() => {
@@ -1427,113 +1427,113 @@ function cr() {
1427
1427
  (i = document.fonts) != null && i.ready ? document.fonts.ready.then(n).then(e).catch(() => e()) : window.setTimeout(() => {
1428
1428
  n().then(e).catch(() => e());
1429
1429
  }, 300);
1430
- }), Nt);
1430
+ }), Ct);
1431
1431
  }
1432
- function lr({
1432
+ function fr({
1433
1433
  open: e,
1434
1434
  onClose: t,
1435
1435
  onSave: n,
1436
1436
  fieldType: i,
1437
1437
  showFieldTypeTabs: r = !1,
1438
- textPlaceholder: s
1438
+ textPlaceholder: o
1439
1439
  }) {
1440
- const c = _e(null), l = _e(!1), y = _e(null), f = _e([]), x = _e([]), v = i ?? "sign", [m, M] = U(v), [$, G] = U(""), [S, z] = U(""), [E, I] = U("draw"), [V, te] = U(""), [X, oe] = U(""), [ke, ye] = U(!1), [D, ae] = U("signature"), [C, F] = U("#111827"), [Q, Me] = U("dancing-script"), [Ie, ue] = U(!1), be = It.find((u) => u.id === Q) ?? It[0], J = D === "initials" ? X.trim() : V.trim(), Be = J || (D === "initials" ? "AB" : "Signature");
1440
+ const c = me(null), l = me(!1), b = me(null), f = me([]), M = me([]), v = i ?? "sign", [g, P] = H(v), [N, U] = H(""), [E, z] = H(""), [B, T] = H("draw"), [Q, ee] = H(""), [W, re] = H(""), [Pe, we] = H(!1), [D, se] = H("signature"), [te, A] = H("#111827"), [oe, ke] = H("dancing-script"), [$e, ue] = H(!1), ye = Ft.find((p) => p.id === oe) ?? Ft[0], Y = D === "initials" ? W.trim() : Q.trim(), lt = Y || (D === "initials" ? "AB" : "Signature");
1441
1441
  if (xe(() => {
1442
- e && (M(v), G((/* @__PURE__ */ new Date()).toISOString().slice(0, 10)), z(""));
1442
+ e && (P(v), U((/* @__PURE__ */ new Date()).toISOString().slice(0, 10)), z(""));
1443
1443
  }, [e, v]), xe(() => {
1444
- if (!e || m !== "sign") return;
1445
- const u = c.current;
1446
- if (!u) return;
1447
- const g = u.getContext("2d");
1448
- g && (u.width = 560, u.height = 200, g.fillStyle = "#ffffff", g.fillRect(0, 0, u.width, u.height), g.lineCap = "round", g.lineJoin = "round", g.strokeStyle = C, g.lineWidth = 2.5, y.current = null, l.current = !1);
1449
- }, [e, m]), xe(() => {
1444
+ if (!e || g !== "sign") return;
1445
+ const p = c.current;
1446
+ if (!p) return;
1447
+ const _ = p.getContext("2d");
1448
+ _ && (p.width = 560, p.height = 200, _.fillStyle = "#ffffff", _.fillRect(0, 0, p.width, p.height), _.lineCap = "round", _.lineJoin = "round", _.strokeStyle = te, _.lineWidth = 2.5, b.current = null, l.current = !1);
1449
+ }, [e, g]), xe(() => {
1450
1450
  if (!e) return;
1451
- let u = !1;
1452
- return ue(!1), cr().then(() => {
1453
- u || ue(!0);
1451
+ let p = !1;
1452
+ return ue(!1), pr().then(() => {
1453
+ p || ue(!0);
1454
1454
  }), () => {
1455
- u = !0;
1455
+ p = !0;
1456
1456
  };
1457
1457
  }, [e]), xe(() => {
1458
- const u = c.current, g = u == null ? void 0 : u.getContext("2d");
1459
- g && (g.strokeStyle = C, g.fillStyle = C);
1460
- }, [C]), xe(() => {
1461
- if (!e || E !== "type") return;
1462
- const u = c.current, g = u == null ? void 0 : u.getContext("2d");
1463
- if (!u || !g || (g.fillStyle = "#ffffff", g.fillRect(0, 0, u.width, u.height), !J)) return;
1464
- const j = D === "initials" ? 72 : be.family === "Great Vibes" || be.family === "Allura" ? 56 : be.family === "Pacifico" ? 44 : 48;
1465
- g.fillStyle = C, g.textAlign = "center", g.textBaseline = "middle", g.font = `${j}px "${be.family}", cursive`, g.fillText(J, u.width / 2, u.height / 2);
1458
+ const p = c.current, _ = p == null ? void 0 : p.getContext("2d");
1459
+ _ && (_.strokeStyle = te, _.fillStyle = te);
1460
+ }, [te]), xe(() => {
1461
+ if (!e || B !== "type") return;
1462
+ const p = c.current, _ = p == null ? void 0 : p.getContext("2d");
1463
+ if (!p || !_ || (_.fillStyle = "#ffffff", _.fillRect(0, 0, p.width, p.height), !Y)) return;
1464
+ const C = D === "initials" ? 72 : ye.family === "Great Vibes" || ye.family === "Allura" ? 56 : ye.family === "Pacifico" ? 44 : 48;
1465
+ _.fillStyle = te, _.textAlign = "center", _.textBaseline = "middle", _.font = `${C}px "${ye.family}", cursive`, _.fillText(Y, p.width / 2, p.height / 2);
1466
1466
  }, [
1467
- J,
1467
+ Y,
1468
1468
  D,
1469
- E,
1470
- C,
1469
+ B,
1470
+ te,
1471
1471
  e,
1472
- be,
1473
- Ie
1472
+ ye,
1473
+ $e
1474
1474
  ]), !e) return null;
1475
- const Ye = (u) => {
1476
- const g = c.current, j = g.getBoundingClientRect();
1475
+ const je = (p) => {
1476
+ const _ = c.current, C = _.getBoundingClientRect();
1477
1477
  return {
1478
- x: (u.clientX - j.left) / j.width * g.width,
1479
- y: (u.clientY - j.top) / j.height * g.height
1478
+ x: (p.clientX - C.left) / C.width * _.width,
1479
+ y: (p.clientY - C.top) / C.height * _.height
1480
1480
  };
1481
- }, Pe = (u) => {
1482
- if (E !== "draw") return;
1483
- u.currentTarget.setPointerCapture(u.pointerId), l.current = !0;
1484
- const g = Ye(u);
1485
- y.current = g, x.current = [g];
1486
- }, Oe = (u) => {
1487
- if (!l.current || E !== "draw") return;
1488
- const g = c.current, j = g == null ? void 0 : g.getContext("2d"), Y = y.current;
1489
- if (!j || !Y) return;
1490
- const se = Ye(u);
1491
- j.beginPath(), j.moveTo(Y.x, Y.y), j.lineTo(se.x, se.y), j.stroke(), y.current = se, x.current.push(se);
1492
- }, ve = () => {
1493
- x.current.length > 1 && f.current.push([...x.current]), x.current = [], l.current = !1, y.current = null;
1494
- }, B = () => {
1495
- const u = c.current, g = u == null ? void 0 : u.getContext("2d");
1496
- !u || !g || (g.fillStyle = "#ffffff", g.fillRect(0, 0, u.width, u.height), f.current = [], x.current = [], te(""), oe(""), ye(!1));
1497
- }, fe = (u) => {
1498
- te(u), ke || oe(dr(u));
1499
- }, je = () => {
1500
- if (E === "draw") {
1501
- const u = f.current;
1502
- if (u.length === 0) return;
1503
- let g = 1 / 0, j = 1 / 0, Y = -1 / 0, se = -1 / 0;
1504
- for (const Ke of u)
1505
- for (const Le of Ke)
1506
- Le.x < g && (g = Le.x), Le.y < j && (j = Le.y), Le.x > Y && (Y = Le.x), Le.y > se && (se = Le.y);
1507
- const re = 8;
1508
- g = Math.max(0, g - re), j = Math.max(0, j - re), Y += re, se += re;
1509
- const Ce = Y - g, ce = se - j, He = u.map((Ke) => "M" + Ke.map((We) => ({ x: We.x - g, y: We.y - j })).map((We) => `${We.x.toFixed(1)},${We.y.toFixed(1)}`).join("L")).join(" "), Ae = `<svg xmlns="http://www.w3.org/2000/svg" width="${Ce.toFixed(0)}" height="${ce.toFixed(0)}" viewBox="0 0 ${Ce.toFixed(0)} ${ce.toFixed(0)}"><path d="${He}" fill="none" stroke="${C}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`, Ue = `data:image/svg+xml;base64,${btoa(Ae)}`;
1510
- n(Ue, Ce, ce);
1481
+ }, Le = (p) => {
1482
+ if (B !== "draw") return;
1483
+ p.currentTarget.setPointerCapture(p.pointerId), l.current = !0;
1484
+ const _ = je(p);
1485
+ b.current = _, M.current = [_];
1486
+ }, Ue = (p) => {
1487
+ if (!l.current || B !== "draw") return;
1488
+ const _ = c.current, C = _ == null ? void 0 : _.getContext("2d"), ne = b.current;
1489
+ if (!C || !ne) return;
1490
+ const K = je(p);
1491
+ C.beginPath(), C.moveTo(ne.x, ne.y), C.lineTo(K.x, K.y), C.stroke(), b.current = K, M.current.push(K);
1492
+ }, Fe = () => {
1493
+ M.current.length > 1 && f.current.push([...M.current]), M.current = [], l.current = !1, b.current = null;
1494
+ }, O = () => {
1495
+ const p = c.current, _ = p == null ? void 0 : p.getContext("2d");
1496
+ !p || !_ || (_.fillStyle = "#ffffff", _.fillRect(0, 0, p.width, p.height), f.current = [], M.current = [], ee(""), re(""), we(!1));
1497
+ }, pe = (p) => {
1498
+ ee(p), Pe || re(gr(p));
1499
+ }, fe = () => {
1500
+ if (B === "draw") {
1501
+ const p = f.current;
1502
+ if (p.length === 0) return;
1503
+ let _ = 1 / 0, C = 1 / 0, ne = -1 / 0, K = -1 / 0;
1504
+ for (const We of p)
1505
+ for (const De of We)
1506
+ De.x < _ && (_ = De.x), De.y < C && (C = De.y), De.x > ne && (ne = De.x), De.y > K && (K = De.y);
1507
+ const be = 8;
1508
+ _ = Math.max(0, _ - be), C = Math.max(0, C - be), ne += be, K += be;
1509
+ const ae = ne - _, Te = K - C, _e = p.map((We) => "M" + We.map((Ge) => ({ x: Ge.x - _, y: Ge.y - C })).map((Ge) => `${Ge.x.toFixed(1)},${Ge.y.toFixed(1)}`).join("L")).join(" "), He = `<svg xmlns="http://www.w3.org/2000/svg" width="${ae.toFixed(0)}" height="${Te.toFixed(0)}" viewBox="0 0 ${ae.toFixed(0)} ${Te.toFixed(0)}"><path d="${_e}" fill="none" stroke="${te}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`, qe = `data:image/svg+xml;base64,${btoa(He)}`;
1510
+ n(qe, ae, Te);
1511
1511
  } else {
1512
- if (!J) return;
1513
- const u = 3, g = D === "initials" ? 72 : be.family === "Great Vibes" || be.family === "Allura" ? 56 : be.family === "Pacifico" ? 44 : 48, Y = document.createElement("canvas").getContext("2d");
1514
- Y.font = `${g * u}px "${be.family}", cursive`;
1515
- const se = Y.measureText(J), re = 12 * u, Ce = Math.ceil(se.width) + re * 2, ce = g * u + re * 2, He = document.createElement("canvas");
1516
- He.width = Ce, He.height = ce;
1517
- const Ae = He.getContext("2d");
1518
- Ae.clearRect(0, 0, Ce, ce), Ae.font = `${g * u}px "${be.family}", cursive`, Ae.fillStyle = C, Ae.textBaseline = "middle", Ae.fillText(J, re, ce / 2);
1519
- const Ue = He.toDataURL("image/png");
1520
- n(Ue, Ce / u, ce / u);
1512
+ if (!Y) return;
1513
+ const p = 3, _ = D === "initials" ? 72 : ye.family === "Great Vibes" || ye.family === "Allura" ? 56 : ye.family === "Pacifico" ? 44 : 48, ne = document.createElement("canvas").getContext("2d");
1514
+ ne.font = `${_ * p}px "${ye.family}", cursive`;
1515
+ const K = ne.measureText(Y), be = 12 * p, ae = Math.ceil(K.width) + be * 2, Te = _ * p + be * 2, _e = document.createElement("canvas");
1516
+ _e.width = ae, _e.height = Te;
1517
+ const He = _e.getContext("2d");
1518
+ He.clearRect(0, 0, ae, Te), He.font = `${_ * p}px "${ye.family}", cursive`, He.fillStyle = te, He.textBaseline = "middle", He.fillText(Y, be, Te / 2);
1519
+ const qe = _e.toDataURL("image/png");
1520
+ n(qe, ae / p, Te / p);
1521
1521
  }
1522
- }, ie = () => {
1523
- const u = m === "date" ? $ : S.trim();
1524
- if (!u) return;
1525
- const g = document.createElement("canvas"), j = g.getContext("2d"), Y = 16;
1526
- j.font = `${Y}px sans-serif`;
1527
- const se = j.measureText(u), re = 8;
1528
- g.width = Math.ceil(se.width) + re * 2, g.height = Y + re * 2, j.clearRect(0, 0, g.width, g.height), j.font = `${Y}px sans-serif`, j.fillStyle = "#111827", j.textBaseline = "middle", j.fillText(u, re, g.height / 2);
1529
- const Ce = g.toDataURL("image/png");
1530
- n(Ce, g.width, g.height);
1531
- }, ge = m === "sign";
1532
- return /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal", role: "dialog", "aria-modal": "true", children: [
1522
+ }, Ee = () => {
1523
+ const p = g === "date" ? N : E.trim();
1524
+ if (!p) return;
1525
+ const _ = document.createElement("canvas"), C = _.getContext("2d"), ne = 16;
1526
+ C.font = `${ne}px sans-serif`;
1527
+ const K = C.measureText(p), be = 8;
1528
+ _.width = Math.ceil(K.width) + be * 2, _.height = ne + be * 2, C.clearRect(0, 0, _.width, _.height), C.font = `${ne}px sans-serif`, C.fillStyle = "#111827", C.textBaseline = "middle", C.fillText(p, be, _.height / 2);
1529
+ const ae = _.toDataURL("image/png");
1530
+ n(ae, _.width, _.height);
1531
+ }, G = g === "sign";
1532
+ return /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__modal", role: "dialog", "aria-modal": "true", children: [
1533
1533
  /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__modal-backdrop", onClick: t }),
1534
- /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal-card", children: [
1535
- /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal-header", children: [
1536
- /* @__PURE__ */ a("h3", { children: m === "date" ? "Pick a date" : m === "text" ? "Enter text" : "Create e-signature" }),
1534
+ /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__modal-card", children: [
1535
+ /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__modal-header", children: [
1536
+ /* @__PURE__ */ a("h3", { children: g === "date" ? "Pick a date" : g === "text" ? "Enter text" : "Create e-signature" }),
1537
1537
  /* @__PURE__ */ a(
1538
1538
  "button",
1539
1539
  {
@@ -1545,27 +1545,27 @@ function lr({
1545
1545
  }
1546
1546
  )
1547
1547
  ] }),
1548
- r && !i ? /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__field-type-tabs", role: "tablist", children: ["sign", "date", "text"].map((u) => /* @__PURE__ */ a(
1548
+ r && !i ? /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__field-type-tabs", role: "tablist", children: ["sign", "date", "text"].map((p) => /* @__PURE__ */ a(
1549
1549
  "button",
1550
1550
  {
1551
1551
  type: "button",
1552
1552
  role: "tab",
1553
- "aria-selected": m === u,
1554
- className: m === u ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
1555
- onClick: () => M(u),
1556
- children: u === "sign" ? "Sign" : u === "date" ? "Date" : "Text"
1553
+ "aria-selected": g === p,
1554
+ className: g === p ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
1555
+ onClick: () => P(p),
1556
+ children: p === "sign" ? "Sign" : p === "date" ? "Date" : "Text"
1557
1557
  },
1558
- u
1558
+ p
1559
1559
  )) }) : null,
1560
- ge ? /* @__PURE__ */ T(bt, { children: [
1561
- /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__sign-modes", children: [
1560
+ G ? /* @__PURE__ */ $(vt, { children: [
1561
+ /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__sign-modes", children: [
1562
1562
  /* @__PURE__ */ a(
1563
1563
  "button",
1564
1564
  {
1565
1565
  type: "button",
1566
- className: E === "draw" ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
1566
+ className: B === "draw" ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
1567
1567
  onClick: () => {
1568
- I("draw"), B();
1568
+ T("draw"), O();
1569
1569
  },
1570
1570
  children: "Draw"
1571
1571
  }
@@ -1574,81 +1574,81 @@ function lr({
1574
1574
  "button",
1575
1575
  {
1576
1576
  type: "button",
1577
- className: E === "type" ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
1578
- onClick: () => I("type"),
1577
+ className: B === "type" ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
1578
+ onClick: () => T("type"),
1579
1579
  children: "Type"
1580
1580
  }
1581
1581
  ),
1582
- /* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-ink", children: [
1582
+ /* @__PURE__ */ $("label", { className: "epochs-pdf-viewer__sign-ink", children: [
1583
1583
  "Ink",
1584
1584
  /* @__PURE__ */ a(
1585
1585
  "input",
1586
1586
  {
1587
1587
  type: "color",
1588
- value: C,
1589
- onChange: (u) => F(u.target.value)
1588
+ value: te,
1589
+ onChange: (p) => A(p.target.value)
1590
1590
  }
1591
1591
  )
1592
1592
  ] })
1593
1593
  ] }),
1594
- E === "type" ? /* @__PURE__ */ T(bt, { children: [
1594
+ B === "type" ? /* @__PURE__ */ $(vt, { children: [
1595
1595
  /* @__PURE__ */ a(
1596
1596
  "div",
1597
1597
  {
1598
1598
  className: "epochs-pdf-viewer__sign-fonts",
1599
1599
  role: "group",
1600
1600
  "aria-label": "Handwriting style",
1601
- children: It.map((u) => /* @__PURE__ */ a(
1601
+ children: Ft.map((p) => /* @__PURE__ */ a(
1602
1602
  "button",
1603
1603
  {
1604
1604
  type: "button",
1605
- className: Q === u.id ? "epochs-pdf-viewer__sign-font epochs-pdf-viewer__sign-font--active" : "epochs-pdf-viewer__sign-font",
1606
- style: { fontFamily: `"${u.family}", cursive` },
1607
- onClick: () => Me(u.id),
1608
- title: u.label,
1609
- children: Be
1605
+ className: oe === p.id ? "epochs-pdf-viewer__sign-font epochs-pdf-viewer__sign-font--active" : "epochs-pdf-viewer__sign-font",
1606
+ style: { fontFamily: `"${p.family}", cursive` },
1607
+ onClick: () => ke(p.id),
1608
+ title: p.label,
1609
+ children: lt
1610
1610
  },
1611
- u.id
1611
+ p.id
1612
1612
  ))
1613
1613
  }
1614
1614
  ),
1615
- /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__sign-type-fields", children: [
1616
- /* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-type-field", children: [
1615
+ /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__sign-type-fields", children: [
1616
+ /* @__PURE__ */ $("label", { className: "epochs-pdf-viewer__sign-type-field", children: [
1617
1617
  /* @__PURE__ */ a("span", { children: "Full name" }),
1618
1618
  /* @__PURE__ */ a(
1619
1619
  "input",
1620
1620
  {
1621
1621
  className: "epochs-pdf-viewer__sign-type-input",
1622
1622
  type: "text",
1623
- value: V,
1624
- onChange: (u) => fe(u.target.value),
1625
- onFocus: () => ae("signature"),
1623
+ value: Q,
1624
+ onChange: (p) => pe(p.target.value),
1625
+ onFocus: () => se("signature"),
1626
1626
  placeholder: "Type your full name",
1627
- style: { fontFamily: `"${be.family}", cursive` },
1627
+ style: { fontFamily: `"${ye.family}", cursive` },
1628
1628
  autoFocus: !0
1629
1629
  }
1630
1630
  )
1631
1631
  ] }),
1632
- /* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-type-field", children: [
1632
+ /* @__PURE__ */ $("label", { className: "epochs-pdf-viewer__sign-type-field", children: [
1633
1633
  /* @__PURE__ */ a("span", { children: "Initials" }),
1634
1634
  /* @__PURE__ */ a(
1635
1635
  "input",
1636
1636
  {
1637
1637
  className: "epochs-pdf-viewer__sign-type-input",
1638
1638
  type: "text",
1639
- value: X,
1640
- onChange: (u) => {
1641
- ye(!0), oe(u.target.value.toUpperCase());
1639
+ value: W,
1640
+ onChange: (p) => {
1641
+ we(!0), re(p.target.value.toUpperCase());
1642
1642
  },
1643
- onFocus: () => ae("initials"),
1643
+ onFocus: () => se("initials"),
1644
1644
  placeholder: "e.g. JD",
1645
1645
  maxLength: 4,
1646
- style: { fontFamily: `"${be.family}", cursive` }
1646
+ style: { fontFamily: `"${ye.family}", cursive` }
1647
1647
  }
1648
1648
  )
1649
1649
  ] })
1650
1650
  ] }),
1651
- /* @__PURE__ */ T(
1651
+ /* @__PURE__ */ $(
1652
1652
  "div",
1653
1653
  {
1654
1654
  className: "epochs-pdf-viewer__sign-type-kind",
@@ -1660,7 +1660,7 @@ function lr({
1660
1660
  {
1661
1661
  type: "button",
1662
1662
  className: D === "signature" ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
1663
- onClick: () => ae("signature"),
1663
+ onClick: () => se("signature"),
1664
1664
  children: "Use full name"
1665
1665
  }
1666
1666
  ),
@@ -1669,7 +1669,7 @@ function lr({
1669
1669
  {
1670
1670
  type: "button",
1671
1671
  className: D === "initials" ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
1672
- onClick: () => ae("initials"),
1672
+ onClick: () => se("initials"),
1673
1673
  children: "Use initials"
1674
1674
  }
1675
1675
  )
@@ -1681,46 +1681,46 @@ function lr({
1681
1681
  "canvas",
1682
1682
  {
1683
1683
  ref: c,
1684
- className: E === "draw" ? "epochs-pdf-viewer__sign-canvas" : "epochs-pdf-viewer__sign-canvas epochs-pdf-viewer__sign-canvas--preview",
1685
- onPointerDown: Pe,
1686
- onPointerMove: Oe,
1687
- onPointerUp: ve,
1688
- onPointerLeave: ve
1684
+ className: B === "draw" ? "epochs-pdf-viewer__sign-canvas" : "epochs-pdf-viewer__sign-canvas epochs-pdf-viewer__sign-canvas--preview",
1685
+ onPointerDown: Le,
1686
+ onPointerMove: Ue,
1687
+ onPointerUp: Fe,
1688
+ onPointerLeave: Fe
1689
1689
  }
1690
1690
  )
1691
- ] }) : m === "date" ? /* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-type-field", style: { padding: "1rem" }, children: [
1691
+ ] }) : g === "date" ? /* @__PURE__ */ $("label", { className: "epochs-pdf-viewer__sign-type-field", style: { padding: "1rem" }, children: [
1692
1692
  /* @__PURE__ */ a("span", { children: "Date" }),
1693
1693
  /* @__PURE__ */ a(
1694
1694
  "input",
1695
1695
  {
1696
1696
  className: "epochs-pdf-viewer__sign-type-input",
1697
1697
  type: "date",
1698
- value: $,
1699
- onChange: (u) => G(u.target.value),
1698
+ value: N,
1699
+ onChange: (p) => U(p.target.value),
1700
1700
  autoFocus: !0
1701
1701
  }
1702
1702
  )
1703
- ] }) : /* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-type-field", style: { padding: "1rem" }, children: [
1703
+ ] }) : /* @__PURE__ */ $("label", { className: "epochs-pdf-viewer__sign-type-field", style: { padding: "1rem" }, children: [
1704
1704
  /* @__PURE__ */ a("span", { children: "Text" }),
1705
1705
  /* @__PURE__ */ a(
1706
1706
  "input",
1707
1707
  {
1708
1708
  className: "epochs-pdf-viewer__sign-type-input",
1709
1709
  type: "text",
1710
- value: S,
1711
- onChange: (u) => z(u.target.value),
1712
- placeholder: s ?? "Enter text",
1710
+ value: E,
1711
+ onChange: (p) => z(p.target.value),
1712
+ placeholder: o ?? "Enter text",
1713
1713
  autoFocus: !0
1714
1714
  }
1715
1715
  )
1716
1716
  ] }),
1717
- /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal-actions", children: [
1718
- ge ? /* @__PURE__ */ a(
1717
+ /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__modal-actions", children: [
1718
+ G ? /* @__PURE__ */ a(
1719
1719
  "button",
1720
1720
  {
1721
1721
  type: "button",
1722
1722
  className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
1723
- onClick: B,
1723
+ onClick: O,
1724
1724
  children: "Clear"
1725
1725
  }
1726
1726
  ) : null,
@@ -1738,68 +1738,68 @@ function lr({
1738
1738
  {
1739
1739
  type: "button",
1740
1740
  className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--primary",
1741
- onClick: ge ? je : ie,
1742
- disabled: m === "date" ? !$ : m === "text" ? !S.trim() : !1,
1743
- children: ge ? "Use signature" : "Place on page"
1741
+ onClick: G ? fe : Ee,
1742
+ disabled: g === "date" ? !N : g === "text" ? !E.trim() : !1,
1743
+ children: G ? "Use signature" : "Place on page"
1744
1744
  }
1745
1745
  )
1746
1746
  ] })
1747
1747
  ] })
1748
1748
  ] });
1749
1749
  }
1750
- function dr(e) {
1750
+ function gr(e) {
1751
1751
  const t = e.trim().split(/\s+/).filter(Boolean);
1752
1752
  return t.length === 0 ? "" : t.length === 1 ? t[0].slice(0, 2).toUpperCase() : t.slice(0, 3).map((n) => {
1753
1753
  var i;
1754
1754
  return ((i = n[0]) == null ? void 0 : i.toUpperCase()) ?? "";
1755
1755
  }).join("");
1756
1756
  }
1757
- const Ct = "__epochsToolbarToolId";
1758
- function Fe(e, t) {
1757
+ const Dt = "__epochsToolbarToolId";
1758
+ function Re(e, t) {
1759
1759
  const n = (() => null);
1760
- return n.displayName = t, Object.defineProperty(n, Ct, {
1760
+ return n.displayName = t, Object.defineProperty(n, Dt, {
1761
1761
  value: e,
1762
1762
  enumerable: !0
1763
1763
  }), n;
1764
1764
  }
1765
- function dn(e) {
1766
- return e[Ct];
1765
+ function gn(e) {
1766
+ return e[Dt];
1767
1767
  }
1768
- function hr(e) {
1769
- return typeof e == "function" && Ct in e && typeof e[Ct] == "string";
1768
+ function mr(e) {
1769
+ return typeof e == "function" && Dt in e && typeof e[Dt] == "string";
1770
1770
  }
1771
- const vn = Fe("thumbnail", "Thumbnail"), xn = Fe("navigation", "Navigation"), kn = Fe("zoom", "Zoom"), Mn = Fe("rotate", "Rotate"), Pn = Fe("reload", "Reload"), Nn = Fe("print", "Print"), $n = Fe("open", "Open"), Tn = Fe("download", "Download"), In = Fe("highlight", "Highlight"), Cn = Fe("underline", "Underline"), Ln = Fe("signature", "Signature"), Rn = Fe("text", "AddText"), Dn = Fe("erase", "Erase"), Fn = Fe("clear", "Clear"), Br = [
1772
- vn,
1773
- xn,
1774
- kn,
1775
- Mn,
1771
+ const Nn = Re("thumbnail", "Thumbnail"), $n = Re("navigation", "Navigation"), Tn = Re("zoom", "Zoom"), In = Re("rotate", "Rotate"), Cn = Re("reload", "Reload"), Rn = Re("print", "Print"), Ln = Re("open", "Open"), Fn = Re("download", "Download"), Dn = Re("highlight", "Highlight"), Sn = Re("underline", "Underline"), An = Re("signature", "Signature"), En = Re("text", "AddText"), Bn = Re("erase", "Erase"), Hn = Re("clear", "Clear"), Ur = [
1772
+ Nn,
1773
+ $n,
1774
+ Tn,
1776
1775
  In,
1776
+ Dn,
1777
+ Sn,
1778
+ An,
1779
+ En,
1780
+ Bn,
1781
+ Hn,
1777
1782
  Cn,
1778
- Ln,
1779
1783
  Rn,
1780
- Dn,
1781
- Fn,
1782
- Pn,
1783
- Nn,
1784
- $n,
1785
- Tn
1786
- ], hn = [
1787
- [vn, xn],
1784
+ Ln,
1785
+ Fn
1786
+ ], mn = [
1787
+ [Nn, $n],
1788
1788
  [
1789
- kn,
1790
- Mn,
1789
+ Tn,
1791
1790
  In,
1791
+ Dn,
1792
+ Sn,
1793
+ An,
1794
+ En,
1795
+ Bn,
1796
+ Hn,
1792
1797
  Cn,
1793
- Ln,
1794
1798
  Rn,
1795
- Dn,
1796
- Fn,
1797
- Pn,
1798
- Nn,
1799
- $n,
1800
- Tn
1799
+ Ln,
1800
+ Fn
1801
1801
  ]
1802
- ], pr = [
1802
+ ], wr = [
1803
1803
  "highlight",
1804
1804
  "underline",
1805
1805
  "signature",
@@ -1807,10 +1807,10 @@ const vn = Fe("thumbnail", "Thumbnail"), xn = Fe("navigation", "Navigation"), kn
1807
1807
  "erase",
1808
1808
  "clear"
1809
1809
  ];
1810
- function pn(e) {
1811
- return pr.includes(e);
1810
+ function wn(e) {
1811
+ return wr.includes(e);
1812
1812
  }
1813
- function ur(e, t, n) {
1813
+ function yr(e, t, n) {
1814
1814
  const i = [];
1815
1815
  switch (n != null && n.showMarkupSep && i.push(
1816
1816
  /* @__PURE__ */ a(
@@ -1831,7 +1831,7 @@ function ur(e, t, n) {
1831
1831
  className: "epochs-pdf-viewer__btn",
1832
1832
  onClick: () => t.setShowThumbnails((r) => !r),
1833
1833
  title: t.showThumbnails ? "Hide thumbnails" : "Show thumbnails",
1834
- children: /* @__PURE__ */ a(zi, {})
1834
+ children: /* @__PURE__ */ a(Gi, {})
1835
1835
  },
1836
1836
  "thumbnail"
1837
1837
  )
@@ -1847,11 +1847,11 @@ function ur(e, t, n) {
1847
1847
  onClick: t.handlePrev,
1848
1848
  disabled: !t.canGoPrev || t.status !== "ready",
1849
1849
  title: "Previous page",
1850
- children: /* @__PURE__ */ a(Si, {})
1850
+ children: /* @__PURE__ */ a(ji, {})
1851
1851
  },
1852
1852
  "nav-prev"
1853
1853
  ),
1854
- /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__page-input", children: [
1854
+ /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__page-input", children: [
1855
1855
  /* @__PURE__ */ a(
1856
1856
  "input",
1857
1857
  {
@@ -1860,16 +1860,16 @@ function ur(e, t, n) {
1860
1860
  min: 1,
1861
1861
  max: t.numPages || 1,
1862
1862
  onChange: (r) => {
1863
- const s = Number.parseInt(r.target.value, 10);
1864
- Number.isFinite(s) && t.scrollToPage(
1865
- Math.max(1, Math.min(t.numPages || 1, s))
1863
+ const o = Number.parseInt(r.target.value, 10);
1864
+ Number.isFinite(o) && t.scrollToPage(
1865
+ Math.max(1, Math.min(t.numPages || 1, o))
1866
1866
  );
1867
1867
  },
1868
1868
  disabled: t.status !== "ready",
1869
1869
  "aria-label": "Page number"
1870
1870
  }
1871
1871
  ),
1872
- /* @__PURE__ */ T("span", { children: [
1872
+ /* @__PURE__ */ $("span", { children: [
1873
1873
  "/ ",
1874
1874
  t.numPages || "-"
1875
1875
  ] })
@@ -1882,7 +1882,7 @@ function ur(e, t, n) {
1882
1882
  onClick: t.handleNext,
1883
1883
  disabled: !t.canGoNext || t.status !== "ready",
1884
1884
  title: "Next page",
1885
- children: /* @__PURE__ */ a(Ei, {})
1885
+ children: /* @__PURE__ */ a(Oi, {})
1886
1886
  },
1887
1887
  "nav-next"
1888
1888
  )
@@ -1898,11 +1898,11 @@ function ur(e, t, n) {
1898
1898
  onClick: t.handleZoomOut,
1899
1899
  disabled: t.status !== "ready",
1900
1900
  title: "Zoom out",
1901
- children: /* @__PURE__ */ a(ji, {})
1901
+ children: /* @__PURE__ */ a(Xi, {})
1902
1902
  },
1903
1903
  "zoom-out"
1904
1904
  ),
1905
- /* @__PURE__ */ T("span", { className: "epochs-pdf-viewer__zoom-label", children: [
1905
+ /* @__PURE__ */ $("span", { className: "epochs-pdf-viewer__zoom-label", children: [
1906
1906
  Math.round(t.scale * 100),
1907
1907
  "%"
1908
1908
  ] }, "zoom-label"),
@@ -1914,7 +1914,7 @@ function ur(e, t, n) {
1914
1914
  onClick: t.handleZoomIn,
1915
1915
  disabled: t.status !== "ready",
1916
1916
  title: "Zoom in",
1917
- children: /* @__PURE__ */ a(Oi, {})
1917
+ children: /* @__PURE__ */ a(qi, {})
1918
1918
  },
1919
1919
  "zoom-in"
1920
1920
  ),
@@ -1942,7 +1942,7 @@ function ur(e, t, n) {
1942
1942
  onClick: t.handleRotate,
1943
1943
  disabled: t.status !== "ready",
1944
1944
  title: "Rotate",
1945
- children: /* @__PURE__ */ a(Gi, {})
1945
+ children: /* @__PURE__ */ a(Zi, {})
1946
1946
  },
1947
1947
  "rotate"
1948
1948
  )
@@ -1958,7 +1958,7 @@ function ur(e, t, n) {
1958
1958
  onClick: () => t.toggleMarkupTool("highlight"),
1959
1959
  disabled: t.status !== "ready",
1960
1960
  title: "Highlight text — select text to highlight",
1961
- children: /* @__PURE__ */ a(Xi, {})
1961
+ children: /* @__PURE__ */ a(Vi, {})
1962
1962
  },
1963
1963
  "highlight"
1964
1964
  )
@@ -1974,7 +1974,7 @@ function ur(e, t, n) {
1974
1974
  onClick: () => t.toggleMarkupTool("underline"),
1975
1975
  disabled: t.status !== "ready",
1976
1976
  title: "Underline text — select text to underline",
1977
- children: /* @__PURE__ */ a(qi, {})
1977
+ children: /* @__PURE__ */ a(Qi, {})
1978
1978
  },
1979
1979
  "underline"
1980
1980
  )
@@ -1996,7 +1996,7 @@ function ur(e, t, n) {
1996
1996
  },
1997
1997
  disabled: t.status !== "ready",
1998
1998
  title: t.hasFixedSignatureFields ? "Create e-signature for a fixed field" : t.pendingSignature ? "Place signature — click on the page, then drag to move" : "Create e-signature",
1999
- children: /* @__PURE__ */ a(Ki, {})
1999
+ children: /* @__PURE__ */ a(er, {})
2000
2000
  },
2001
2001
  "signature"
2002
2002
  )
@@ -2012,7 +2012,7 @@ function ur(e, t, n) {
2012
2012
  onClick: () => t.toggleMarkupTool("text"),
2013
2013
  disabled: t.status !== "ready",
2014
2014
  title: t.hasFixedTextFields ? "Edit text in predefined areas — click to type" : "Edit PDF text — select words, then change them",
2015
- children: /* @__PURE__ */ a(Vi, {})
2015
+ children: /* @__PURE__ */ a(nr, {})
2016
2016
  },
2017
2017
  "text"
2018
2018
  )
@@ -2028,7 +2028,7 @@ function ur(e, t, n) {
2028
2028
  onClick: () => t.toggleMarkupTool("erase"),
2029
2029
  disabled: t.status !== "ready",
2030
2030
  title: "Remove text — select PDF words to cover them, or click added markup",
2031
- children: /* @__PURE__ */ a(Yi, {})
2031
+ children: /* @__PURE__ */ a(Ji, {})
2032
2032
  },
2033
2033
  "erase"
2034
2034
  )
@@ -2059,7 +2059,7 @@ function ur(e, t, n) {
2059
2059
  className: "epochs-pdf-viewer__btn",
2060
2060
  onClick: () => void t.loadDocument(),
2061
2061
  title: "Reload",
2062
- children: /* @__PURE__ */ a(Wi, {})
2062
+ children: /* @__PURE__ */ a(Ki, {})
2063
2063
  },
2064
2064
  "reload"
2065
2065
  )
@@ -2075,7 +2075,7 @@ function ur(e, t, n) {
2075
2075
  onClick: () => void t.handlePrint(),
2076
2076
  disabled: t.status !== "ready" || !t.pdfDoc || t.isPrinting,
2077
2077
  title: t.isPrinting ? "Preparing print…" : "Print (includes highlights & underlines)",
2078
- children: /* @__PURE__ */ a(Ui, {})
2078
+ children: /* @__PURE__ */ a(Yi, {})
2079
2079
  },
2080
2080
  "print"
2081
2081
  )
@@ -2091,7 +2091,7 @@ function ur(e, t, n) {
2091
2091
  target: "_blank",
2092
2092
  rel: "noopener noreferrer",
2093
2093
  title: "Open in new tab",
2094
- children: /* @__PURE__ */ a(Hi, {})
2094
+ children: /* @__PURE__ */ a(Wi, {})
2095
2095
  },
2096
2096
  "open"
2097
2097
  )
@@ -2107,7 +2107,7 @@ function ur(e, t, n) {
2107
2107
  onClick: () => void t.handleDownload(),
2108
2108
  disabled: t.status !== "ready" || !t.pdfDoc || t.isDownloading,
2109
2109
  title: t.isDownloading ? "Preparing download…" : t.annotationsLength > 0 || t.signaturesLength > 0 || t.textsLength > 0 ? "Download PDF with markup" : "Download PDF",
2110
- children: /* @__PURE__ */ a(Bi, {})
2110
+ children: /* @__PURE__ */ a(Ui, {})
2111
2111
  },
2112
2112
  "download"
2113
2113
  )
@@ -2116,7 +2116,7 @@ function ur(e, t, n) {
2116
2116
  }
2117
2117
  return i.length > 0 ? i : null;
2118
2118
  }
2119
- function fr(e, t) {
2119
+ function br(e, t) {
2120
2120
  const n = [];
2121
2121
  if (e.markupTool === "sign" && e.pendingSignature && !e.hasFixedSignatureFields && t.has("signature") && n.push(
2122
2122
  /* @__PURE__ */ a("span", { className: "epochs-pdf-viewer__markup-hint", children: "Click page to place duplicate/new signature" }, "sign-hint")
@@ -2125,16 +2125,16 @@ function fr(e, t) {
2125
2125
  ), e.markupTool === "erase" && t.has("erase") && n.push(
2126
2126
  /* @__PURE__ */ a("span", { className: "epochs-pdf-viewer__markup-hint", children: "Select PDF words to remove · click added text/markup to erase" }, "erase-hint")
2127
2127
  ), e.markupTool === "highlight" && t.has("highlight") || e.markupTool === "underline" && t.has("underline")) {
2128
- const i = e.markupTool === "highlight" ? e.highlightHex : e.underlineHex, r = e.markupTool === "highlight" ? e.setHighlightHex : e.setUnderlineHex, s = e.markupTool === "highlight" ? un : fn;
2128
+ const i = e.markupTool === "highlight" ? e.highlightHex : e.underlineHex, r = e.markupTool === "highlight" ? e.setHighlightHex : e.setUnderlineHex, o = e.markupTool === "highlight" ? yn : bn;
2129
2129
  n.push(
2130
- /* @__PURE__ */ T(
2130
+ /* @__PURE__ */ $(
2131
2131
  "div",
2132
2132
  {
2133
2133
  className: "epochs-pdf-viewer__color-picker",
2134
2134
  role: "group",
2135
2135
  "aria-label": `${e.markupTool} color`,
2136
2136
  children: [
2137
- s.map((c) => /* @__PURE__ */ a(
2137
+ o.map((c) => /* @__PURE__ */ a(
2138
2138
  "button",
2139
2139
  {
2140
2140
  type: "button",
@@ -2147,7 +2147,7 @@ function fr(e, t) {
2147
2147
  },
2148
2148
  c.id
2149
2149
  )),
2150
- /* @__PURE__ */ T(
2150
+ /* @__PURE__ */ $(
2151
2151
  "label",
2152
2152
  {
2153
2153
  className: "epochs-pdf-viewer__custom-color",
@@ -2180,16 +2180,16 @@ function fr(e, t) {
2180
2180
  }
2181
2181
  return n.length > 0 ? n : null;
2182
2182
  }
2183
- function gr(e, t) {
2183
+ function _r(e, t) {
2184
2184
  if (!e) return null;
2185
2185
  if (Array.isArray(e)) {
2186
- const s = (c) => (c ?? []).filter(hr).map(dn);
2186
+ const o = (c) => (c ?? []).filter(mr).map(gn);
2187
2187
  return {
2188
- left: s(e[0]),
2189
- right: s(e[1])
2188
+ left: o(e[0]),
2189
+ right: o(e[1])
2190
2190
  };
2191
2191
  }
2192
- const n = t.enableThumbnails, i = (s, c) => s.map(dn).filter((l) => c[l] !== !1), r = {
2192
+ const n = t.enableThumbnails, i = (o, c) => o.map(gn).filter((l) => c[l] !== !1), r = {
2193
2193
  thumbnail: n,
2194
2194
  navigation: t.enableNavigation,
2195
2195
  zoom: t.enableZoom,
@@ -2206,161 +2206,186 @@ function gr(e, t) {
2206
2206
  clear: t.enableClear
2207
2207
  };
2208
2208
  return {
2209
- left: i(hn[0], r),
2210
- right: i(hn[1], r)
2209
+ left: i(mn[0], r),
2210
+ right: i(mn[1], r)
2211
2211
  };
2212
2212
  }
2213
- function Hr({
2213
+ function Wr({
2214
2214
  file: e,
2215
2215
  fileUrl: t,
2216
2216
  baseUrl: n = "",
2217
2217
  fetchOptions: i,
2218
2218
  height: r = "80vh",
2219
- title: s = "PDF document",
2219
+ title: o = "PDF document",
2220
2220
  initialScale: c = 1,
2221
2221
  withThumbnails: l = !1,
2222
- thumbnailWidth: y = 140,
2222
+ thumbnailWidth: b = 140,
2223
2223
  maxThumbnails: f = 60,
2224
- className: x,
2224
+ className: M,
2225
2225
  workerSrc: v,
2226
- enableToolbar: m = !1,
2227
- enableThumbnails: M,
2228
- enableNavigation: $ = !0,
2229
- enableZoom: G = !0,
2230
- enableRotate: S = !0,
2226
+ enableToolbar: g = !1,
2227
+ enableThumbnails: P,
2228
+ enableNavigation: N = !0,
2229
+ enableZoom: U = !0,
2230
+ enableRotate: E = !0,
2231
2231
  enableReload: z = !0,
2232
- enablePrint: E = !0,
2233
- enableOpen: I = !0,
2234
- enableDownload: V = !0,
2235
- enableMarkup: te = !0,
2236
- enableHighlight: X = !0,
2237
- enableUnderline: oe = !0,
2238
- enableSignature: ke = !0,
2239
- enableText: ye = !0,
2232
+ enablePrint: B = !0,
2233
+ enableOpen: T = !0,
2234
+ enableDownload: Q = !0,
2235
+ enableMarkup: ee = !0,
2236
+ enableHighlight: W = !0,
2237
+ enableUnderline: re = !0,
2238
+ enableSignature: Pe = !0,
2239
+ enableText: we = !0,
2240
2240
  enableErase: D = !0,
2241
- enableClear: ae = !0,
2242
- signatureFields: C = [],
2243
- textFields: F = [],
2244
- onSignatureComplete: Q,
2245
- onFieldValueComplete: Me,
2246
- openSignaturePad: Ie = !1,
2247
- onSignaturePadClose: ue,
2248
- onSubmit: be,
2249
- submitLabel: J = "Submit"
2241
+ enableClear: se = !0,
2242
+ signatureFields: te = [],
2243
+ textFields: A = [],
2244
+ onSignatureComplete: oe,
2245
+ onSignatureFieldsChange: ke,
2246
+ onFieldValueComplete: $e,
2247
+ openSignaturePad: ue = !1,
2248
+ onSignaturePadClose: ye,
2249
+ onSubmit: Y,
2250
+ submitLabel: lt = "Submit"
2250
2251
  }) {
2251
- const Be = _e(null), Ye = _e(null), Pe = _e(/* @__PURE__ */ new Map()), Oe = _e(!1), ve = Mt(() => e && typeof e != "string" ? e : null, [e]), B = Mt(() => ve ? "" : nr(typeof e == "string" ? e : void 0, t, n), [ve, e, t, n]), [fe, je] = U("idle"), [ie, ge] = U(null), [he, u] = U(0), [g, j] = U(1), [Y, se] = U(c), [re, Ce] = U(0), [ce, He] = U(null), [Ae, Ue] = U(!1), [Ke, Le] = U(!1), [We, vt] = U(!1), [o, w] = U("none"), [_, k] = U([]), [P, N] = U([]), [L, O] = U([]), [Z, W] = U(!1), [H, le] = U(void 0), [de, ne] = U(null), [Ne, pe] = U(
2252
+ const je = me(null), Le = me(null), Ue = me(/* @__PURE__ */ new Map()), Fe = me(!1), O = Tt(() => e && typeof e != "string" ? e : null, [e]), pe = Tt(() => O ? "" : ar(typeof e == "string" ? e : void 0, t, n), [O, e, t, n]), [fe, Ee] = H("idle"), [G, Be] = H(null), [p, _] = H(0), [C, ne] = H(1), [K, be] = H(c), [ae, Te] = H(0), [_e, He] = H(null), [qe, We] = H(!1), [De, Ge] = H(!1), [St, s] = H(!1), [m, w] = H("none"), [x, j] = H([]), [k, R] = H([]), [S, X] = H([]), [ie, I] = H(!1), [ce, de] = H(void 0), [he, ve] = H(null), [ze, le] = H(
2252
2253
  null
2253
- ), [me, $e] = U(
2254
+ ), [Me, Se] = H(
2254
2255
  null
2255
- ), [Ge, Ee] = U(null), [lt, Xe] = U(null), [xt, Ze] = U(null), [Lt, Je] = U(null), [Kt, On] = U(gn), [Zt, Un] = U(xi), Se = C.length > 0, dt = F.length > 0, [it, Wn] = U({});
2256
+ ), [Ye, Xe] = H(null), [dt, Ze] = H(null), [kt, Je] = H(null), [Mt, Pt] = H(null), [Jt, qn] = H(_n), [en, Yn] = H($i), ht = A.length > 0, [it, Kn] = H({}), [Z, tn] = H(te), Nt = me(Z);
2257
+ Nt.current = Z, xe(() => {
2258
+ Nt.current = te, tn(te);
2259
+ }, [te]);
2260
+ const Ae = Z.length > 0, ut = q(
2261
+ (u, h) => {
2262
+ const d = Nt.current, y = u ? d.map(
2263
+ (L) => L.id === u ? { ...L, signatureDataUrl: h.imageDataUrl } : L
2264
+ ) : [
2265
+ ...d,
2266
+ {
2267
+ id: h.id,
2268
+ pageNumber: h.pageNumber,
2269
+ x: h.x,
2270
+ y: h.y,
2271
+ width: h.width,
2272
+ height: h.height,
2273
+ type: "sign",
2274
+ signatureDataUrl: h.imageDataUrl
2275
+ }
2276
+ ];
2277
+ Nt.current = y, tn(y), ke == null || ke(y), oe == null || oe(u, h);
2278
+ },
2279
+ [oe, ke]
2280
+ );
2256
2281
  xe(() => {
2257
- Ie && W(!0);
2258
- }, [Ie]);
2259
- const et = Mt(
2260
- () => gr(m, {
2261
- enableThumbnails: M,
2262
- enableNavigation: $,
2263
- enableZoom: G,
2264
- enableRotate: S,
2282
+ ue && I(!0);
2283
+ }, [ue]);
2284
+ const et = Tt(
2285
+ () => _r(g, {
2286
+ enableThumbnails: P,
2287
+ enableNavigation: N,
2288
+ enableZoom: U,
2289
+ enableRotate: E,
2265
2290
  enableReload: z,
2266
- enablePrint: E,
2267
- enableOpen: I,
2268
- enableDownload: V,
2269
- enableHighlight: X,
2270
- enableUnderline: oe,
2271
- enableSignature: ke,
2272
- enableText: ye,
2291
+ enablePrint: B,
2292
+ enableOpen: T,
2293
+ enableDownload: Q,
2294
+ enableHighlight: W,
2295
+ enableUnderline: re,
2296
+ enableSignature: Pe,
2297
+ enableText: we,
2273
2298
  enableErase: D,
2274
- enableClear: ae
2299
+ enableClear: se
2275
2300
  }),
2276
2301
  [
2277
- m,
2278
- M,
2279
- $,
2280
- G,
2281
- S,
2282
- z,
2302
+ g,
2303
+ P,
2304
+ N,
2305
+ U,
2283
2306
  E,
2284
- I,
2285
- V,
2286
- X,
2287
- oe,
2288
- ke,
2289
- ye,
2307
+ z,
2308
+ B,
2309
+ T,
2310
+ Q,
2311
+ W,
2312
+ re,
2313
+ Pe,
2314
+ we,
2290
2315
  D,
2291
- ae
2316
+ se
2292
2317
  ]
2293
- ), tt = Mt(() => et ? /* @__PURE__ */ new Set([...et.left, ...et.right]) : /* @__PURE__ */ new Set(), [et]);
2318
+ ), tt = Tt(() => et ? /* @__PURE__ */ new Set([...et.left, ...et.right]) : /* @__PURE__ */ new Set(), [et]);
2294
2319
  xe(() => {
2295
2320
  if (!tt.has("thumbnail")) {
2296
- Ue(!1);
2321
+ We(!1);
2297
2322
  return;
2298
2323
  }
2299
- const p = window.matchMedia("(max-width: 720px)"), d = () => {
2300
- Ue(p.matches ? !1 : l);
2324
+ const h = window.matchMedia("(max-width: 720px)"), d = () => {
2325
+ We(h.matches ? !1 : l);
2301
2326
  };
2302
- return d(), p.addEventListener("change", d), () => p.removeEventListener("change", d);
2327
+ return d(), h.addEventListener("change", d), () => h.removeEventListener("change", d);
2303
2328
  }, [tt, l]);
2304
- const Vt = !Se && tt.has("highlight"), Qt = !Se && tt.has("underline"), Rt = tt.has("signature") || Se, Jt = tt.has("text") || dt, en = !Se && tt.has("erase"), ht = q(() => {
2305
- Ye.current && (URL.revokeObjectURL(Ye.current), Ye.current = null);
2306
- }, []), Dt = q(async () => {
2307
- if (!(!ve && !B)) {
2308
- tr(v), je("loading"), ge(null), u(0), j(1), k([]), N([]), O([]), ne(null), pe(null), $e(null), Ee(null), Xe(null), Ze(null), Je(null), w("none");
2329
+ const nn = !Ae && tt.has("highlight"), rn = !Ae && tt.has("underline"), At = tt.has("signature") || Ae, on = tt.has("text") || ht, sn = !Ae && tt.has("erase"), pt = q(() => {
2330
+ Le.current && (URL.revokeObjectURL(Le.current), Le.current = null);
2331
+ }, []), Et = q(async () => {
2332
+ if (!(!O && !pe)) {
2333
+ sr(v), Ee("loading"), Be(null), _(0), ne(1), j([]), R([]), X([]), ve(null), le(null), Se(null), Xe(null), Ze(null), Je(null), Pt(null), w("none");
2309
2334
  try {
2310
- const h = ve ? await an(ve, i) : await an(B, i), p = new Blob([h], { type: "application/pdf" }), d = URL.createObjectURL(p);
2311
- ht(), Ye.current = d, He(d);
2312
- const A = await ct.getDocument({
2313
- data: h,
2335
+ const u = O ? await un(O, i) : await un(pe, i), h = new Blob([u], { type: "application/pdf" }), d = URL.createObjectURL(h);
2336
+ pt(), Le.current = d, He(d);
2337
+ const L = await ct.getDocument({
2338
+ data: u,
2314
2339
  cMapUrl: `https://unpkg.com/pdfjs-dist@${ct.version}/cmaps/`,
2315
2340
  cMapPacked: !0,
2316
2341
  standardFontDataUrl: `https://unpkg.com/pdfjs-dist@${ct.version}/standard_fonts/`
2317
2342
  }).promise;
2318
- ge(A), u(A.numPages), je("ready");
2343
+ Be(L), _(L.numPages), Ee("ready");
2319
2344
  } catch {
2320
- je("error");
2345
+ Ee("error");
2321
2346
  }
2322
2347
  }
2323
2348
  }, [
2324
- ve,
2325
- B,
2349
+ O,
2350
+ pe,
2326
2351
  i,
2327
- ht,
2352
+ pt,
2328
2353
  v
2329
2354
  ]);
2330
2355
  xe(() => {
2331
- if (!ve && !B) {
2332
- je("idle"), ge(null), u(0), He(null), ht();
2356
+ if (!O && !pe) {
2357
+ Ee("idle"), Be(null), _(0), He(null), pt();
2333
2358
  return;
2334
2359
  }
2335
- return Dt(), () => {
2336
- ht();
2360
+ return Et(), () => {
2361
+ pt();
2337
2362
  };
2338
- }, [ve, B, Dt, ht]), xe(() => {
2339
- (o === "highlight" && !Vt || o === "underline" && !Qt || o === "sign" && !Rt || o === "text" && !Jt || o === "erase" && !en) && w("none");
2340
- }, [Vt, Qt, Rt, Jt, en, o]);
2363
+ }, [O, pe, Et, pt]), xe(() => {
2364
+ (m === "highlight" && !nn || m === "underline" && !rn || m === "sign" && !At || m === "text" && !on || m === "erase" && !sn) && w("none");
2365
+ }, [nn, rn, At, on, sn, m]);
2341
2366
  const rt = q(
2342
- (h) => {
2343
- const p = Math.max(1, Math.min(he || 1, h)), d = Pe.current.get(p);
2367
+ (u) => {
2368
+ const h = Math.max(1, Math.min(p || 1, u)), d = Ue.current.get(h);
2344
2369
  if (!d) {
2345
- j(p);
2370
+ ne(h);
2346
2371
  return;
2347
2372
  }
2348
- Oe.current = !0, d.scrollIntoView({ behavior: "smooth", block: "start" }), j(p), window.setTimeout(() => {
2349
- Oe.current = !1;
2373
+ Fe.current = !0, d.scrollIntoView({ behavior: "smooth", block: "start" }), ne(h), window.setTimeout(() => {
2374
+ Fe.current = !1;
2350
2375
  }, 500);
2351
2376
  },
2352
- [he]
2377
+ [p]
2353
2378
  ), ot = q(
2354
- (h) => {
2355
- const p = Pe.current.get(h.pageNumber);
2356
- p && (Oe.current = !0, j(h.pageNumber));
2379
+ (u) => {
2380
+ const h = Ue.current.get(u.pageNumber);
2381
+ h && (Fe.current = !0, ne(u.pageNumber));
2357
2382
  const d = () => {
2358
- var A;
2359
- const b = (A = Be.current) == null ? void 0 : A.querySelector(
2360
- `[data-signature-field-id="${CSS.escape(h.id)}"]`
2383
+ var L;
2384
+ const y = (L = je.current) == null ? void 0 : L.querySelector(
2385
+ `[data-signature-field-id="${CSS.escape(u.id)}"]`
2361
2386
  );
2362
- b ? b.scrollIntoView({ behavior: "smooth", block: "center" }) : p && p.scrollIntoView({ behavior: "smooth", block: "start" }), window.setTimeout(() => {
2363
- Oe.current = !1;
2387
+ y ? y.scrollIntoView({ behavior: "smooth", block: "center" }) : h && h.scrollIntoView({ behavior: "smooth", block: "start" }), window.setTimeout(() => {
2388
+ Fe.current = !1;
2364
2389
  }, 500);
2365
2390
  };
2366
2391
  window.requestAnimationFrame(() => {
@@ -2370,90 +2395,90 @@ function Hr({
2370
2395
  []
2371
2396
  );
2372
2397
  xe(() => {
2373
- if (fe !== "ready" || !Be.current || !he) return;
2374
- const h = Be.current, p = new IntersectionObserver(
2398
+ if (fe !== "ready" || !je.current || !p) return;
2399
+ const u = je.current, h = new IntersectionObserver(
2375
2400
  (d) => {
2376
- if (Oe.current) return;
2377
- let b = null;
2378
- for (const A of d) {
2379
- if (!A.isIntersecting) continue;
2380
- const R = Number.parseInt(
2381
- A.target.dataset.pageNumber || "0",
2401
+ if (Fe.current) return;
2402
+ let y = null;
2403
+ for (const L of d) {
2404
+ if (!L.isIntersecting) continue;
2405
+ const F = Number.parseInt(
2406
+ L.target.dataset.pageNumber || "0",
2382
2407
  10
2383
2408
  );
2384
- R && (!b || A.intersectionRatio > b.ratio) && (b = { page: R, ratio: A.intersectionRatio });
2409
+ F && (!y || L.intersectionRatio > y.ratio) && (y = { page: F, ratio: L.intersectionRatio });
2385
2410
  }
2386
- b && j(b.page);
2411
+ y && ne(y.page);
2387
2412
  },
2388
2413
  {
2389
- root: h,
2414
+ root: u,
2390
2415
  threshold: [0.25, 0.5, 0.75]
2391
2416
  }
2392
2417
  );
2393
- for (let d = 1; d <= he; d += 1) {
2394
- const b = Pe.current.get(d);
2395
- b && p.observe(b);
2418
+ for (let d = 1; d <= p; d += 1) {
2419
+ const y = Ue.current.get(d);
2420
+ y && h.observe(y);
2396
2421
  }
2397
- return () => p.disconnect();
2398
- }, [fe, he]);
2399
- const Ft = g > 1, At = he ? g < he : !1, Gn = q(() => {
2400
- Ft && rt(g - 1);
2401
- }, [Ft, g, rt]), Xn = q(() => {
2402
- At && rt(g + 1);
2403
- }, [At, g, rt]), qn = q(() => {
2404
- Ce((h) => (h + 90) % 360);
2405
- }, []), Yn = q(() => {
2406
- se((h) => Math.max(0.25, Math.round((h - 0.1) * 100) / 100));
2407
- }, []), Kn = q(() => {
2408
- se((h) => Math.min(5, Math.round((h + 0.1) * 100) / 100));
2409
- }, []), St = q(async () => {
2410
- if (!(!ie || !Be.current))
2422
+ return () => h.disconnect();
2423
+ }, [fe, p]);
2424
+ const Bt = C > 1, Ht = p ? C < p : !1, Zn = q(() => {
2425
+ Bt && rt(C - 1);
2426
+ }, [Bt, C, rt]), Vn = q(() => {
2427
+ Ht && rt(C + 1);
2428
+ }, [Ht, C, rt]), Qn = q(() => {
2429
+ Te((u) => (u + 90) % 360);
2430
+ }, []), Jn = q(() => {
2431
+ be((u) => Math.max(0.25, Math.round((u - 0.1) * 100) / 100));
2432
+ }, []), ei = q(() => {
2433
+ be((u) => Math.min(5, Math.round((u + 0.1) * 100) / 100));
2434
+ }, []), zt = q(async () => {
2435
+ if (!(!G || !je.current))
2411
2436
  try {
2412
- const p = (await ie.getPage(g)).getViewport({ scale: 1, rotation: re }), b = window.matchMedia("(max-width: 720px)").matches ? 16 : 24, R = Math.max(
2437
+ const h = (await G.getPage(C)).getViewport({ scale: 1, rotation: ae }), y = window.matchMedia("(max-width: 720px)").matches ? 16 : 24, F = Math.max(
2413
2438
  0,
2414
- Be.current.clientWidth - b
2415
- ) / p.width;
2416
- se(Math.max(0.25, Math.min(5, Math.round(R * 100) / 100)));
2439
+ je.current.clientWidth - y
2440
+ ) / h.width;
2441
+ be(Math.max(0.25, Math.min(5, Math.round(F * 100) / 100)));
2417
2442
  } catch {
2418
2443
  }
2419
- }, [ie, g, re]);
2444
+ }, [G, C, ae]);
2420
2445
  xe(() => {
2421
- if (fe !== "ready" || !ie || !window.matchMedia("(max-width: 720px)").matches) return;
2422
- let h = !1;
2423
- const p = () => {
2424
- h || St();
2446
+ if (fe !== "ready" || !G || !window.matchMedia("(max-width: 720px)").matches) return;
2447
+ let u = !1;
2448
+ const h = () => {
2449
+ u || zt();
2425
2450
  };
2426
- p();
2427
- const d = Be.current, b = typeof ResizeObserver < "u" && d ? new ResizeObserver(() => p()) : null;
2428
- b == null || b.observe(d);
2429
- const A = window.matchMedia("(max-width: 720px)"), R = () => {
2430
- A.matches && p();
2451
+ h();
2452
+ const d = je.current, y = typeof ResizeObserver < "u" && d ? new ResizeObserver(() => h()) : null;
2453
+ y == null || y.observe(d);
2454
+ const L = window.matchMedia("(max-width: 720px)"), F = () => {
2455
+ L.matches && h();
2431
2456
  };
2432
- return A.addEventListener("change", R), () => {
2433
- h = !0, b == null || b.disconnect(), A.removeEventListener("change", R);
2457
+ return L.addEventListener("change", F), () => {
2458
+ u = !0, y == null || y.disconnect(), L.removeEventListener("change", F);
2434
2459
  };
2435
- }, [fe, ie, Ae, re, St]);
2436
- const Zn = q(async () => {
2437
- var h;
2438
- if (!(!ie || fe !== "ready")) {
2439
- Le(!0);
2460
+ }, [fe, G, qe, ae, zt]);
2461
+ const ti = q(async () => {
2462
+ var u;
2463
+ if (!(!G || fe !== "ready")) {
2464
+ Ge(!0);
2440
2465
  try {
2441
- const p = await cn(ie, {
2466
+ const h = await pn(G, {
2442
2467
  scale: 1.5,
2443
- rotation: re,
2444
- annotations: _,
2445
- signatures: P,
2446
- texts: L,
2468
+ rotation: ae,
2469
+ annotations: x,
2470
+ signatures: k,
2471
+ texts: S,
2447
2472
  mimeType: "image/png"
2448
2473
  }), d = document.createElement("iframe");
2449
2474
  d.style.position = "fixed", d.style.right = "0", d.style.bottom = "0", d.style.width = "0", d.style.height = "0", d.style.border = "0", d.setAttribute("aria-hidden", "true"), document.body.appendChild(d);
2450
- const b = (h = d.contentWindow) == null ? void 0 : h.document;
2451
- if (!b) throw new Error("print iframe not available");
2452
- b.open(), b.write(`<!doctype html>
2475
+ const y = (u = d.contentWindow) == null ? void 0 : u.document;
2476
+ if (!y) throw new Error("print iframe not available");
2477
+ y.open(), y.write(`<!doctype html>
2453
2478
  <html>
2454
2479
  <head>
2455
2480
  <meta charset="utf-8" />
2456
- <title>${s.replace(/</g, "&lt;")}</title>
2481
+ <title>${o.replace(/</g, "&lt;")}</title>
2457
2482
  <style>
2458
2483
  html, body { margin: 0; padding: 0; }
2459
2484
  img { width: 100%; display: block; }
@@ -2463,26 +2488,26 @@ function Hr({
2463
2488
  </style>
2464
2489
  </head>
2465
2490
  <body></body>
2466
- </html>`), b.close();
2467
- const A = b.body;
2468
- for (const R of p) {
2469
- const K = b.createElement("img");
2470
- K.src = R.dataUrl;
2471
- const Re = b.createElement("div");
2472
- Re.className = "page", Re.appendChild(K), A.appendChild(Re);
2491
+ </html>`), y.close();
2492
+ const L = y.body;
2493
+ for (const F of h) {
2494
+ const V = y.createElement("img");
2495
+ V.src = F.dataUrl;
2496
+ const Ie = y.createElement("div");
2497
+ Ie.className = "page", Ie.appendChild(V), L.appendChild(Ie);
2473
2498
  }
2474
2499
  await Promise.all(
2475
- Array.from(A.querySelectorAll("img")).map(
2476
- (R) => {
2477
- var K;
2478
- return ((K = R.decode) == null ? void 0 : K.call(R).catch(() => {
2500
+ Array.from(L.querySelectorAll("img")).map(
2501
+ (F) => {
2502
+ var V;
2503
+ return ((V = F.decode) == null ? void 0 : V.call(F).catch(() => {
2479
2504
  })) ?? Promise.resolve();
2480
2505
  }
2481
2506
  )
2482
2507
  ), setTimeout(() => {
2483
- var R, K;
2508
+ var F, V;
2484
2509
  try {
2485
- (R = d.contentWindow) == null || R.focus(), (K = d.contentWindow) == null || K.print();
2510
+ (F = d.contentWindow) == null || F.focus(), (V = d.contentWindow) == null || V.print();
2486
2511
  } finally {
2487
2512
  setTimeout(() => {
2488
2513
  try {
@@ -2494,391 +2519,391 @@ function Hr({
2494
2519
  }, 50);
2495
2520
  } catch {
2496
2521
  try {
2497
- ce ? window.open(ce, "_blank", "noopener,noreferrer") : B && window.open(B, "_blank", "noopener,noreferrer");
2522
+ _e ? window.open(_e, "_blank", "noopener,noreferrer") : pe && window.open(pe, "_blank", "noopener,noreferrer");
2498
2523
  } catch {
2499
2524
  }
2500
2525
  } finally {
2501
- Le(!1);
2526
+ Ge(!1);
2502
2527
  }
2503
2528
  }
2504
- }, [ie, fe, re, s, ce, B, _, P, L]), Vn = q(async () => {
2505
- if (!ie || fe !== "ready") return;
2506
- const h = `${s.replace(/[^\w.-]+/g, "_") || "document"}.pdf`;
2507
- if (!(_.length > 0 || P.length > 0 || L.length > 0) && ce) {
2508
- Xt(
2509
- await fetch(ce).then((d) => d.blob()),
2510
- h
2529
+ }, [G, fe, ae, o, _e, pe, x, k, S]), ni = q(async () => {
2530
+ if (!G || fe !== "ready") return;
2531
+ const u = `${o.replace(/[^\w.-]+/g, "_") || "document"}.pdf`;
2532
+ if (!(x.length > 0 || k.length > 0 || S.length > 0) && _e) {
2533
+ Zt(
2534
+ await fetch(_e).then((d) => d.blob()),
2535
+ u
2511
2536
  );
2512
2537
  return;
2513
2538
  }
2514
- vt(!0);
2539
+ s(!0);
2515
2540
  try {
2516
- const d = await cn(ie, {
2541
+ const d = await pn(G, {
2517
2542
  scale: 2,
2518
- rotation: re,
2519
- annotations: _,
2520
- signatures: P,
2521
- texts: L,
2543
+ rotation: ae,
2544
+ annotations: x,
2545
+ signatures: k,
2546
+ texts: S,
2522
2547
  mimeType: "image/jpeg",
2523
2548
  quality: 0.92
2524
- }), b = sr(d), A = new Uint8Array(b.byteLength);
2525
- A.set(b), Xt(
2526
- new Blob([A], { type: "application/pdf" }),
2527
- h
2549
+ }), y = hr(d), L = new Uint8Array(y.byteLength);
2550
+ L.set(y), Zt(
2551
+ new Blob([L], { type: "application/pdf" }),
2552
+ u
2528
2553
  );
2529
2554
  } catch {
2530
- ce && Xt(
2531
- await fetch(ce).then((d) => d.blob()),
2532
- h
2555
+ _e && Zt(
2556
+ await fetch(_e).then((d) => d.blob()),
2557
+ u
2533
2558
  );
2534
2559
  } finally {
2535
- vt(!1);
2560
+ s(!1);
2536
2561
  }
2537
- }, [ie, fe, re, s, ce, _, P, L]), Qn = q((h) => {
2538
- w((p) => p === h ? "none" : h);
2539
- }, []), Jn = o === "highlight" || o === "underline" ? mn(o === "highlight" ? Kt : o === "underline" ? Zt : null, o) : void 0, st = Ne != null ? P.find((h) => h.id === Ne) ?? null : null, ei = q((h) => {
2540
- k((p) => [...p, h]);
2541
- }, []), ti = q((h) => {
2542
- k((p) => p.filter((d) => d.id !== h));
2543
- }, []), ni = q(() => {
2544
- k([]), N([]), O([]), pe(null), Xe(null), Ze(null), Je(null);
2545
- }, []), ii = q(
2546
- (h) => {
2547
- le(h), W(!0);
2562
+ }, [G, fe, ae, o, _e, x, k, S]), ii = q((u) => {
2563
+ w((h) => h === u ? "none" : u);
2564
+ }, []), ri = m === "highlight" || m === "underline" ? vn(m === "highlight" ? Jt : m === "underline" ? en : null, m) : void 0, st = ze != null ? k.find((u) => u.id === ze) ?? null : null, oi = q((u) => {
2565
+ j((h) => [...h, u]);
2566
+ }, []), si = q((u) => {
2567
+ j((h) => h.filter((d) => d.id !== u));
2568
+ }, []), ai = q(() => {
2569
+ j([]), R([]), X([]), le(null), Ze(null), Je(null), Pt(null);
2570
+ }, []), ci = q(
2571
+ (u) => {
2572
+ de(u), I(!0);
2548
2573
  },
2549
2574
  []
2550
- ), ri = q((h, p) => {
2551
- Wn((d) => ({ ...d, [h]: p }));
2552
- }, []), oi = q(
2553
- (h) => {
2554
- const p = it[h];
2555
- p && (Me == null || Me(h, p));
2556
- const d = C.findIndex((R) => R.id === h), b = new Set(
2557
- Object.keys(it).filter((R) => {
2558
- var K;
2559
- return (K = it[R]) == null ? void 0 : K.trim();
2575
+ ), li = q((u, h) => {
2576
+ Kn((d) => ({ ...d, [u]: h }));
2577
+ }, []), di = q(
2578
+ (u) => {
2579
+ const h = it[u];
2580
+ h && ($e == null || $e(u, h));
2581
+ const d = Z.findIndex((F) => F.id === u), y = new Set(
2582
+ Object.keys(it).filter((F) => {
2583
+ var V;
2584
+ return (V = it[F]) == null ? void 0 : V.trim();
2560
2585
  })
2561
2586
  );
2562
- b.add(h);
2563
- const A = C.slice(d + 1).find(
2564
- (R) => !b.has(R.id) && !P.some((K) => K.fieldId === R.id)
2565
- ) ?? C.slice(0, Math.max(0, d)).find(
2566
- (R) => !b.has(R.id) && !P.some((K) => K.fieldId === R.id)
2587
+ y.add(u);
2588
+ const L = Z.slice(d + 1).find(
2589
+ (F) => !y.has(F.id) && !k.some((V) => V.fieldId === F.id)
2590
+ ) ?? Z.slice(0, Math.max(0, d)).find(
2591
+ (F) => !y.has(F.id) && !k.some((V) => V.fieldId === F.id)
2567
2592
  );
2568
- if (A) {
2569
- $e(A.id), ot(A);
2570
- const R = A.type;
2571
- (R === "sign" || !R) && window.setTimeout(() => W(!0), 350);
2593
+ if (L) {
2594
+ Se(L.id), ot(L);
2595
+ const F = L.type;
2596
+ (F === "sign" || !F) && window.setTimeout(() => I(!0), 350);
2572
2597
  }
2573
2598
  },
2574
- [C, it, P, ot]
2575
- ), si = q(
2576
- (h, p, d) => {
2577
- const b = Pi(p, d);
2578
- if (Ge) {
2579
- N(
2580
- (ee) => ee.map(
2581
- (De) => De.id === Ge ? {
2582
- ...De,
2583
- imageDataUrl: h,
2584
- width: De.fieldId ? De.width : b.width,
2585
- height: De.fieldId ? De.height : b.height
2586
- } : De
2599
+ [Z, it, k, ot]
2600
+ ), hi = q(
2601
+ (u, h, d) => {
2602
+ const y = Ci(h, d);
2603
+ if (Ye) {
2604
+ R(
2605
+ (J) => J.map(
2606
+ (Ce) => Ce.id === Ye ? {
2607
+ ...Ce,
2608
+ imageDataUrl: u,
2609
+ width: Ce.fieldId ? Ce.width : y.width,
2610
+ height: Ce.fieldId ? Ce.height : y.height
2611
+ } : Ce
2587
2612
  )
2588
- ), ne(null), w("none"), W(!1), Ee(null);
2613
+ ), ve(null), w("none"), I(!1), Xe(null);
2589
2614
  return;
2590
2615
  }
2591
- if (Se) {
2592
- const ee = C.find(
2593
- (we) => we.id === me && !P.some((nt) => nt.fieldId === we.id)
2594
- ) ?? C.find(
2595
- (we) => !P.some((nt) => nt.fieldId === we.id)
2616
+ if (Ae) {
2617
+ const J = Z.find(
2618
+ (ge) => ge.id === Me && !k.some((nt) => nt.fieldId === ge.id)
2619
+ ) ?? Z.find(
2620
+ (ge) => !k.some((nt) => nt.fieldId === ge.id)
2596
2621
  );
2597
- if (!ee) {
2598
- W(!1);
2622
+ if (!J) {
2623
+ I(!1);
2599
2624
  return;
2600
2625
  }
2601
- const De = {
2602
- id: Tt(),
2603
- fieldId: ee.id,
2604
- pageNumber: ee.pageNumber,
2605
- x: ee.x,
2606
- y: ee.y,
2607
- width: ee.width,
2608
- height: ee.height,
2609
- imageDataUrl: h
2626
+ const Ce = {
2627
+ id: Lt(),
2628
+ fieldId: J.id,
2629
+ pageNumber: J.pageNumber,
2630
+ x: J.x,
2631
+ y: J.y,
2632
+ width: J.width,
2633
+ height: J.height,
2634
+ imageDataUrl: u
2610
2635
  };
2611
- N((we) => [
2612
- ...we.filter((nt) => nt.fieldId !== ee.id),
2613
- De
2614
- ]), Q == null || Q(ee.id, De), ne(null), w("none"), W(!1), Ee(null);
2636
+ R((ge) => [
2637
+ ...ge.filter((nt) => nt.fieldId !== J.id),
2638
+ Ce
2639
+ ]), ut(J.id, Ce), ve(null), w("none"), I(!1), Xe(null);
2615
2640
  const Ve = new Set(
2616
- P.filter((we) => we.fieldId && we.fieldId !== ee.id).map((we) => we.fieldId)
2641
+ k.filter((ge) => ge.fieldId && ge.fieldId !== J.id).map((ge) => ge.fieldId)
2617
2642
  );
2618
- Ve.add(ee.id);
2619
- const kt = C.findIndex(
2620
- (we) => we.id === ee.id
2621
- ), pt = C.slice(kt + 1).find((we) => !Ve.has(we.id)) ?? C.slice(0, Math.max(0, kt)).find((we) => !Ve.has(we.id));
2622
- pt ? ($e(pt.id), pe(null), ot(pt), window.setTimeout(() => {
2623
- W(!0);
2624
- }, 350)) : (pe(De.id), $e(ee.id));
2643
+ Ve.add(J.id);
2644
+ const $t = Z.findIndex(
2645
+ (ge) => ge.id === J.id
2646
+ ), ft = Z.slice($t + 1).find((ge) => !Ve.has(ge.id)) ?? Z.slice(0, Math.max(0, $t)).find((ge) => !Ve.has(ge.id));
2647
+ ft ? (Se(ft.id), le(null), ot(ft), window.setTimeout(() => {
2648
+ I(!0);
2649
+ }, 350)) : (le(Ce.id), Se(J.id));
2625
2650
  return;
2626
2651
  }
2627
- const A = Pe.current.get(g), R = A == null ? void 0 : A.querySelector(
2652
+ const L = Ue.current.get(C), F = L == null ? void 0 : L.querySelector(
2628
2653
  ".epochs-pdf-viewer__surface"
2629
2654
  );
2630
- let K = 24, Re = 24;
2631
- if (R) {
2632
- const ee = yt(R, Y), De = R.closest(".epochs-pdf-viewer__body");
2633
- if (De) {
2634
- const Ve = $i(
2635
- De.getBoundingClientRect(),
2636
- R,
2637
- Y
2638
- ), kt = Math.max(0, Ve.top), pt = Math.min(ee.height, Ve.bottom), we = Math.max(0, Ve.left), nt = Math.min(ee.width, Ve.right);
2639
- K = Math.max(0, (we + nt) / 2 - b.width / 2), Re = Math.max(0, (kt + pt) / 2 - b.height / 2), K = Math.min(K, Math.max(0, ee.width - b.width)), Re = Math.min(Re, Math.max(0, ee.height - b.height));
2655
+ let V = 24, Ie = 24;
2656
+ if (F) {
2657
+ const J = _t(F, K), Ce = F.closest(".epochs-pdf-viewer__body");
2658
+ if (Ce) {
2659
+ const Ve = Li(
2660
+ Ce.getBoundingClientRect(),
2661
+ F,
2662
+ K
2663
+ ), $t = Math.max(0, Ve.top), ft = Math.min(J.height, Ve.bottom), ge = Math.max(0, Ve.left), nt = Math.min(J.width, Ve.right);
2664
+ V = Math.max(0, (ge + nt) / 2 - y.width / 2), Ie = Math.max(0, ($t + ft) / 2 - y.height / 2), V = Math.min(V, Math.max(0, J.width - y.width)), Ie = Math.min(Ie, Math.max(0, J.height - y.height));
2640
2665
  } else
2641
- K = Math.max(0, (ee.width - b.width) / 2), Re = Math.max(0, (ee.height - b.height) / 2);
2666
+ V = Math.max(0, (J.width - y.width) / 2), Ie = Math.max(0, (J.height - y.height) / 2);
2642
2667
  }
2643
- const qe = {
2644
- id: Tt(),
2645
- pageNumber: g,
2646
- x: K,
2647
- y: Re,
2648
- width: b.width,
2649
- height: b.height,
2650
- imageDataUrl: h
2668
+ const Ke = {
2669
+ id: Lt(),
2670
+ pageNumber: C,
2671
+ x: V,
2672
+ y: Ie,
2673
+ width: y.width,
2674
+ height: y.height,
2675
+ imageDataUrl: u
2651
2676
  };
2652
- N((ee) => [...ee, qe]), Q == null || Q(void 0, qe), pe(qe.id), ne(null), w("none"), W(!1), Ee(null);
2677
+ R((J) => [...J, Ke]), ut(void 0, Ke), le(Ke.id), ve(null), w("none"), I(!1), Xe(null);
2653
2678
  },
2654
2679
  [
2655
- Ge,
2656
- Se,
2657
- g,
2658
- Y,
2659
- ot,
2660
- me,
2680
+ Ye,
2681
+ Ae,
2661
2682
  C,
2662
- P,
2663
- Q
2683
+ K,
2684
+ ot,
2685
+ Me,
2686
+ Z,
2687
+ k,
2688
+ ut
2664
2689
  ]
2665
- ), ai = q((h) => {
2666
- N((p) => [...p, h]), pe(h.id), ne(null), w("none");
2667
- }, []), ci = q(
2668
- (h, p) => {
2669
- N(
2670
- (d) => d.map((b) => b.id === h ? { ...b, ...p } : b)
2690
+ ), ui = q((u) => {
2691
+ R((h) => [...h, u]), ut(void 0, u), le(u.id), ve(null), w("none");
2692
+ }, [ut]), pi = q(
2693
+ (u, h) => {
2694
+ R(
2695
+ (d) => d.map((y) => y.id === u ? { ...y, ...h } : y)
2671
2696
  );
2672
2697
  },
2673
2698
  []
2674
- ), li = q((h) => {
2675
- const p = P.find((d) => d.id === h);
2676
- N((d) => d.filter((b) => b.id !== h)), pe((d) => d === h ? null : d), p != null && p.fieldId && $e(p.fieldId);
2677
- }, [P]), di = q((h) => {
2678
- const p = h ? P.find((qe) => qe.id === h) ?? null : st;
2679
- if (!p) return;
2680
- const d = Pe.current.get(p.pageNumber), b = d == null ? void 0 : d.querySelector(
2699
+ ), fi = q((u) => {
2700
+ const h = k.find((d) => d.id === u);
2701
+ R((d) => d.filter((y) => y.id !== u)), le((d) => d === u ? null : d), h != null && h.fieldId && Se(h.fieldId);
2702
+ }, [k]), gi = q((u) => {
2703
+ const h = u ? k.find((Ke) => Ke.id === u) ?? null : st;
2704
+ if (!h) return;
2705
+ const d = Ue.current.get(h.pageNumber), y = d == null ? void 0 : d.querySelector(
2681
2706
  ".epochs-pdf-viewer__surface"
2682
- ), A = 18;
2683
- let R = p.x + A, K = p.y + A;
2684
- if (b) {
2685
- const qe = b.clientWidth / Y, ee = b.clientHeight / Y;
2686
- R = Math.min(
2687
- Math.max(0, R),
2688
- Math.max(0, qe - p.width)
2689
- ), K = Math.min(
2690
- Math.max(0, K),
2691
- Math.max(0, ee - p.height)
2707
+ ), L = 18;
2708
+ let F = h.x + L, V = h.y + L;
2709
+ if (y) {
2710
+ const Ke = y.clientWidth / K, J = y.clientHeight / K;
2711
+ F = Math.min(
2712
+ Math.max(0, F),
2713
+ Math.max(0, Ke - h.width)
2714
+ ), V = Math.min(
2715
+ Math.max(0, V),
2716
+ Math.max(0, J - h.height)
2692
2717
  );
2693
2718
  }
2694
- const Re = {
2695
- ...p,
2696
- id: Tt(),
2697
- x: R,
2698
- y: K
2719
+ const Ie = {
2720
+ ...h,
2721
+ id: Lt(),
2722
+ x: F,
2723
+ y: V
2699
2724
  };
2700
- N((qe) => [...qe, Re]), pe(Re.id), ne(null), w("none");
2701
- }, [Y, st, P]), hi = q((h) => {
2702
- const p = h ?? (st == null ? void 0 : st.id);
2703
- p && (pe(p), Ee(p), W(!0));
2704
- }, [st]), pi = q((h) => {
2705
- O((p) => h.fieldId ? [...p.filter((d) => d.fieldId !== h.fieldId), h] : [...p, h]), Xe(h.id), h.fieldId && Ze(h.fieldId);
2706
- }, []), ui = q(
2707
- (h, p) => {
2708
- O(
2709
- (d) => d.map((b) => b.id === h ? { ...b, ...p } : b)
2725
+ R((Ke) => [...Ke, Ie]), le(Ie.id), ve(null), w("none");
2726
+ }, [K, st, k]), mi = q((u) => {
2727
+ const h = u ?? (st == null ? void 0 : st.id);
2728
+ h && (le(h), Xe(h), I(!0));
2729
+ }, [st]), wi = q((u) => {
2730
+ X((h) => u.fieldId ? [...h.filter((d) => d.fieldId !== u.fieldId), u] : [...h, u]), Ze(u.id), u.fieldId && Je(u.fieldId);
2731
+ }, []), yi = q(
2732
+ (u, h) => {
2733
+ X(
2734
+ (d) => d.map((y) => y.id === u ? { ...y, ...h } : y)
2710
2735
  );
2711
2736
  },
2712
2737
  []
2713
- ), fi = q((h) => {
2714
- const p = L.find((d) => d.id === h);
2715
- O((d) => d.filter((b) => b.id !== h)), Xe((d) => d === h ? null : d), Je((d) => d === h ? null : d), p != null && p.fieldId && Ze(p.fieldId);
2716
- }, [L]);
2738
+ ), bi = q((u) => {
2739
+ const h = S.find((d) => d.id === u);
2740
+ X((d) => d.filter((y) => y.id !== u)), Ze((d) => d === u ? null : d), Pt((d) => d === u ? null : d), h != null && h.fieldId && Je(h.fieldId);
2741
+ }, [S]);
2717
2742
  xe(() => {
2718
- dt && O(
2719
- (h) => h.map((p) => {
2720
- if (!p.fieldId) return p;
2721
- const d = F.find((b) => b.id === p.fieldId);
2743
+ ht && X(
2744
+ (u) => u.map((h) => {
2745
+ if (!h.fieldId) return h;
2746
+ const d = A.find((y) => y.id === h.fieldId);
2722
2747
  return d ? {
2723
- ...p,
2748
+ ...h,
2724
2749
  pageNumber: d.pageNumber,
2725
2750
  x: d.x,
2726
2751
  y: d.y,
2727
2752
  width: d.width,
2728
2753
  height: d.height,
2729
- fontSize: d.fontSize ?? p.fontSize ?? _t,
2730
- color: d.color ?? p.color ?? wt
2731
- } : p;
2754
+ fontSize: d.fontSize ?? h.fontSize ?? xt,
2755
+ color: d.color ?? h.color ?? bt
2756
+ } : h;
2732
2757
  })
2733
2758
  );
2734
- }, [dt, F]);
2735
- const tn = q(
2736
- (h) => {
2737
- var A;
2738
- if (!C.length) return;
2739
- const p = me != null ? C.findIndex((R) => R.id === me) : -1, d = Math.min(
2740
- C.length - 1,
2741
- Math.max(0, (p < 0 ? 0 : p) + h)
2742
- ), b = C[d];
2743
- b && ($e(b.id), pe(
2744
- ((A = P.find((R) => R.fieldId === b.id)) == null ? void 0 : A.id) ?? null
2745
- ), ot(b));
2759
+ }, [ht, A]);
2760
+ const an = q(
2761
+ (u) => {
2762
+ var L;
2763
+ if (!Z.length) return;
2764
+ const h = Me != null ? Z.findIndex((F) => F.id === Me) : -1, d = Math.min(
2765
+ Z.length - 1,
2766
+ Math.max(0, (h < 0 ? 0 : h) + u)
2767
+ ), y = Z[d];
2768
+ y && (Se(y.id), le(
2769
+ ((L = k.find((F) => F.fieldId === y.id)) == null ? void 0 : L.id) ?? null
2770
+ ), ot(y));
2746
2771
  },
2747
2772
  [
2748
2773
  ot,
2749
- me,
2750
- C,
2751
- P
2774
+ Me,
2775
+ Z,
2776
+ k
2752
2777
  ]
2753
2778
  );
2754
- if (!ve && !B)
2779
+ if (!O && !pe)
2755
2780
  return /* @__PURE__ */ a(
2756
2781
  "div",
2757
2782
  {
2758
2783
  "data-testid": "pdf-viewer",
2759
- className: `epochs-pdf-viewer epochs-pdf-viewer--empty ${x ?? ""}`.trim(),
2784
+ className: `epochs-pdf-viewer epochs-pdf-viewer--empty ${M ?? ""}`.trim(),
2760
2785
  children: "No PDF file provided."
2761
2786
  }
2762
2787
  );
2763
- const gi = {
2788
+ const _i = {
2764
2789
  height: r
2765
- }, nn = {
2790
+ }, cn = {
2766
2791
  status: fe,
2767
- showThumbnails: Ae,
2768
- setShowThumbnails: Ue,
2769
- canGoPrev: Ft,
2770
- canGoNext: At,
2771
- handlePrev: Gn,
2772
- handleNext: Xn,
2773
- pageNumber: g,
2774
- numPages: he,
2792
+ showThumbnails: qe,
2793
+ setShowThumbnails: We,
2794
+ canGoPrev: Bt,
2795
+ canGoNext: Ht,
2796
+ handlePrev: Zn,
2797
+ handleNext: Vn,
2798
+ pageNumber: C,
2799
+ numPages: p,
2775
2800
  scrollToPage: rt,
2776
- scale: Y,
2777
- handleZoomOut: Yn,
2778
- handleZoomIn: Kn,
2779
- handleFitWidth: St,
2780
- handleRotate: qn,
2781
- markupTool: o,
2782
- toggleMarkupTool: (h) => Qn(h),
2783
- hasFixedSignatureFields: Se,
2784
- hasFixedTextFields: dt,
2785
- pendingSignature: de,
2801
+ scale: K,
2802
+ handleZoomOut: Jn,
2803
+ handleZoomIn: ei,
2804
+ handleFitWidth: zt,
2805
+ handleRotate: Qn,
2806
+ markupTool: m,
2807
+ toggleMarkupTool: (u) => ii(u),
2808
+ hasFixedSignatureFields: Ae,
2809
+ hasFixedTextFields: ht,
2810
+ pendingSignature: he,
2786
2811
  setMarkupTool: w,
2787
- setSignaturePadOpen: W,
2788
- annotationsLength: _.length,
2789
- signaturesLength: P.length,
2790
- textsLength: L.length,
2791
- handleClearAnnotations: ni,
2792
- highlightHex: Kt,
2793
- underlineHex: Zt,
2794
- setHighlightHex: On,
2795
- setUnderlineHex: Un,
2796
- loadDocument: Dt,
2797
- handlePrint: Zn,
2798
- isPrinting: Ke,
2799
- pdfDoc: ie,
2800
- displayUrl: ce,
2801
- resolvedUrl: B,
2802
- handleDownload: Vn,
2803
- isDownloading: We
2804
- }, mi = (h) => h.filter((p) => !(Se && (p === "highlight" || p === "underline" || p === "erase"))), Et = me ? C.findIndex((h) => h.id === me) : 0, wi = C.filter((h) => {
2812
+ setSignaturePadOpen: I,
2813
+ annotationsLength: x.length,
2814
+ signaturesLength: k.length,
2815
+ textsLength: S.length,
2816
+ handleClearAnnotations: ai,
2817
+ highlightHex: Jt,
2818
+ underlineHex: en,
2819
+ setHighlightHex: qn,
2820
+ setUnderlineHex: Yn,
2821
+ loadDocument: Et,
2822
+ handlePrint: ti,
2823
+ isPrinting: De,
2824
+ pdfDoc: G,
2825
+ displayUrl: _e,
2826
+ resolvedUrl: pe,
2827
+ handleDownload: ni,
2828
+ isDownloading: St
2829
+ }, vi = (u) => u.filter((h) => !(Ae && (h === "highlight" || h === "underline" || h === "erase"))), jt = Me ? Z.findIndex((u) => u.id === Me) : 0, xi = Z.filter((u) => {
2805
2830
  var d;
2806
- const p = h.type ?? "sign";
2807
- return p === "date" || p === "text" ? !!((d = it[h.id]) != null && d.trim()) : P.some((b) => b.fieldId === h.id);
2808
- }).length, Bt = C.length > 0 ? Math.round(wi / C.length * 100) : 0, rn = (h, p = !1) => {
2809
- const d = mi(h);
2810
- if (d.length === 0 && !p)
2831
+ const h = u.type ?? "sign";
2832
+ return h === "date" || h === "text" ? !!((d = it[u.id]) != null && d.trim()) : k.some((y) => y.fieldId === u.id);
2833
+ }).length, Ot = Z.length > 0 ? Math.round(xi / Z.length * 100) : 0, ln = (u, h = !1) => {
2834
+ const d = vi(u);
2835
+ if (d.length === 0 && !h)
2811
2836
  return /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__toolbar-group" });
2812
2837
  if (d.length === 0)
2813
2838
  return /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__toolbar-group epochs-pdf-viewer__toolbar-group--end" });
2814
- const b = d.map((A, R) => {
2815
- const K = d[R - 1], Re = pn(A) && (!K || !pn(K));
2816
- return /* @__PURE__ */ a(_i, { children: ur(A, nn, { showMarkupSep: Re }) }, A);
2839
+ const y = d.map((L, F) => {
2840
+ const V = d[F - 1], Ie = wn(L) && (!V || !wn(V));
2841
+ return /* @__PURE__ */ a(Pi, { children: yr(L, cn, { showMarkupSep: Ie }) }, L);
2817
2842
  });
2818
- return /* @__PURE__ */ T(
2843
+ return /* @__PURE__ */ $(
2819
2844
  "div",
2820
2845
  {
2821
- className: p ? "epochs-pdf-viewer__toolbar-group epochs-pdf-viewer__toolbar-group--end" : "epochs-pdf-viewer__toolbar-group",
2846
+ className: h ? "epochs-pdf-viewer__toolbar-group epochs-pdf-viewer__toolbar-group--end" : "epochs-pdf-viewer__toolbar-group",
2822
2847
  children: [
2823
- b,
2824
- fr(nn, new Set(d))
2848
+ y,
2849
+ br(cn, new Set(d))
2825
2850
  ]
2826
2851
  }
2827
2852
  );
2828
2853
  };
2829
- return /* @__PURE__ */ T(
2854
+ return /* @__PURE__ */ $(
2830
2855
  "div",
2831
2856
  {
2832
2857
  "data-testid": "pdf-viewer",
2833
- "data-file-url": B || void 0,
2834
- className: `epochs-pdf-viewer ${x ?? ""}`.trim(),
2835
- style: gi,
2858
+ "data-file-url": pe || void 0,
2859
+ className: `epochs-pdf-viewer ${M ?? ""}`.trim(),
2860
+ style: _i,
2836
2861
  children: [
2837
- et ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__toolbar", children: [
2838
- rn(et.left),
2839
- rn(et.right, !0)
2862
+ et ? /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__toolbar", children: [
2863
+ ln(et.left),
2864
+ ln(et.right, !0)
2840
2865
  ] }) : null,
2841
- Rt || Ie || Se ? /* @__PURE__ */ a(
2842
- lr,
2866
+ At || ue || Ae ? /* @__PURE__ */ a(
2867
+ fr,
2843
2868
  {
2844
- open: Z,
2869
+ open: ie,
2845
2870
  onClose: () => {
2846
- W(!1), Ee(null), ue == null || ue();
2871
+ I(!1), Xe(null), ye == null || ye();
2847
2872
  },
2848
- onSave: si,
2849
- fieldType: H,
2850
- showFieldTypeTabs: !Se
2873
+ onSave: hi,
2874
+ fieldType: ce,
2875
+ showFieldTypeTabs: !Ae
2851
2876
  }
2852
2877
  ) : null,
2853
- /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__content", children: [
2854
- Ae ? /* @__PURE__ */ a(
2878
+ /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__content", children: [
2879
+ qe ? /* @__PURE__ */ a(
2855
2880
  "div",
2856
2881
  {
2857
2882
  className: "epochs-pdf-viewer__thumbnails",
2858
- style: { width: y + 24 },
2859
- children: fe === "ready" && ie ? /* @__PURE__ */ T(bt, { children: [
2883
+ style: { width: b + 24 },
2884
+ children: fe === "ready" && G ? /* @__PURE__ */ $(vt, { children: [
2860
2885
  Array.from({
2861
- length: Math.min(he || 0, f)
2862
- }).map((h, p) => {
2863
- const d = p + 1;
2886
+ length: Math.min(p || 0, f)
2887
+ }).map((u, h) => {
2888
+ const d = h + 1;
2864
2889
  return /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__thumb-wrap", children: /* @__PURE__ */ a(
2865
- Ji,
2890
+ rr,
2866
2891
  {
2867
- pdfDoc: ie,
2892
+ pdfDoc: G,
2868
2893
  pageNumber: d,
2869
- isActive: d === g,
2870
- rotation: re,
2894
+ isActive: d === C,
2895
+ rotation: ae,
2871
2896
  onSelect: rt,
2872
- width: y,
2873
- annotations: _,
2874
- signatures: P,
2875
- signatureFields: C,
2876
- texts: L,
2877
- textFields: F
2897
+ width: b,
2898
+ annotations: x,
2899
+ signatures: k,
2900
+ signatureFields: Z,
2901
+ texts: S,
2902
+ textFields: A
2878
2903
  }
2879
2904
  ) }, d);
2880
2905
  }),
2881
- he > f ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__thumb-more", children: [
2906
+ p > f ? /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__thumb-more", children: [
2882
2907
  "Showing first ",
2883
2908
  f,
2884
2909
  " pages"
@@ -2886,69 +2911,69 @@ function Hr({
2886
2911
  ] }) : /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__muted", children: "Thumbnails" })
2887
2912
  }
2888
2913
  ) : null,
2889
- /* @__PURE__ */ T("div", { ref: Be, className: "epochs-pdf-viewer__body", children: [
2890
- fe === "loading" ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__overlay epochs-pdf-viewer__muted", children: [
2914
+ /* @__PURE__ */ $("div", { ref: je, className: "epochs-pdf-viewer__body", children: [
2915
+ fe === "loading" ? /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__overlay epochs-pdf-viewer__muted", children: [
2891
2916
  "Loading PDF…",
2892
2917
  /* @__PURE__ */ a("span", { className: "epochs-pdf-viewer__spinner" })
2893
2918
  ] }) : null,
2894
- fe === "error" ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__overlay epochs-pdf-viewer__error", children: [
2919
+ fe === "error" ? /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__overlay epochs-pdf-viewer__error", children: [
2895
2920
  "Unable to load PDF.",
2896
- B ? /* @__PURE__ */ a(
2921
+ pe ? /* @__PURE__ */ a(
2897
2922
  "a",
2898
2923
  {
2899
2924
  className: "epochs-pdf-viewer__open-link",
2900
- href: B,
2925
+ href: pe,
2901
2926
  target: "_blank",
2902
2927
  rel: "noopener noreferrer",
2903
2928
  children: "Open file"
2904
2929
  }
2905
2930
  ) : null
2906
2931
  ] }) : null,
2907
- fe === "ready" && ie ? /* @__PURE__ */ a("div", { children: Array.from({ length: he }).map((h, p) => {
2908
- const d = p + 1;
2932
+ fe === "ready" && G ? /* @__PURE__ */ a("div", { children: Array.from({ length: p }).map((u, h) => {
2933
+ const d = h + 1;
2909
2934
  return /* @__PURE__ */ a(
2910
- Qi,
2935
+ ir,
2911
2936
  {
2912
- pdfDoc: ie,
2937
+ pdfDoc: G,
2913
2938
  pageNumber: d,
2914
- scale: Y,
2915
- rotation: re,
2916
- markupTool: te ? o : "none",
2917
- markupColor: Jn,
2918
- annotations: _,
2919
- onAddAnnotation: ei,
2920
- onRemoveAnnotation: ti,
2921
- signatures: P,
2922
- pendingSignature: de,
2923
- onAddSignature: ai,
2924
- onUpdateSignature: ci,
2925
- onRemoveSignature: li,
2926
- onEditSignature: hi,
2927
- onDuplicateSignature: di,
2928
- selectedSignatureId: Ne,
2929
- onSelectSignature: pe,
2930
- signatureFields: C,
2931
- selectedSignatureFieldId: me,
2932
- onSelectSignatureField: $e,
2933
- hasFixedSignatureFields: Se,
2934
- onOpenSignaturePad: ii,
2939
+ scale: K,
2940
+ rotation: ae,
2941
+ markupTool: ee ? m : "none",
2942
+ markupColor: ri,
2943
+ annotations: x,
2944
+ onAddAnnotation: oi,
2945
+ onRemoveAnnotation: si,
2946
+ signatures: k,
2947
+ pendingSignature: he,
2948
+ onAddSignature: ui,
2949
+ onUpdateSignature: pi,
2950
+ onRemoveSignature: fi,
2951
+ onEditSignature: mi,
2952
+ onDuplicateSignature: gi,
2953
+ selectedSignatureId: ze,
2954
+ onSelectSignature: le,
2955
+ signatureFields: Z,
2956
+ selectedSignatureFieldId: Me,
2957
+ onSelectSignatureField: Se,
2958
+ hasFixedSignatureFields: Ae,
2959
+ onOpenSignaturePad: ci,
2935
2960
  fieldValues: it,
2936
- onFieldValueChange: ri,
2937
- onFieldValueCommit: oi,
2938
- texts: L,
2939
- onAddText: pi,
2940
- onUpdateText: ui,
2941
- onRemoveText: fi,
2942
- selectedTextId: lt,
2943
- onSelectText: Xe,
2944
- textFields: F,
2945
- selectedTextFieldId: xt,
2946
- onSelectTextField: Ze,
2947
- hasFixedTextFields: dt,
2948
- editingTextId: Lt,
2949
- onEditingTextIdChange: Je,
2950
- pageRef: (b) => {
2951
- b && Pe.current.set(d, b);
2961
+ onFieldValueChange: li,
2962
+ onFieldValueCommit: di,
2963
+ texts: S,
2964
+ onAddText: wi,
2965
+ onUpdateText: yi,
2966
+ onRemoveText: bi,
2967
+ selectedTextId: dt,
2968
+ onSelectText: Ze,
2969
+ textFields: A,
2970
+ selectedTextFieldId: kt,
2971
+ onSelectTextField: Je,
2972
+ hasFixedTextFields: ht,
2973
+ editingTextId: Mt,
2974
+ onEditingTextIdChange: Pt,
2975
+ pageRef: (y) => {
2976
+ y && Ue.current.set(d, y);
2952
2977
  }
2953
2978
  },
2954
2979
  d
@@ -2956,16 +2981,16 @@ function Hr({
2956
2981
  }) }) : null
2957
2982
  ] })
2958
2983
  ] }),
2959
- Se || be ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__footer", role: "navigation", "aria-label": "Viewer actions", children: [
2960
- Se ? /* @__PURE__ */ T(bt, { children: [
2961
- /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__footer-nav", children: [
2984
+ Ae || Y ? /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__footer", role: "navigation", "aria-label": "Viewer actions", children: [
2985
+ Ae ? /* @__PURE__ */ $(vt, { children: [
2986
+ /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__footer-nav", children: [
2962
2987
  /* @__PURE__ */ a(
2963
2988
  "button",
2964
2989
  {
2965
2990
  type: "button",
2966
2991
  className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
2967
- disabled: C.length <= 1 || Et <= 0,
2968
- onClick: () => tn(-1),
2992
+ disabled: Z.length <= 1 || jt <= 0,
2993
+ onClick: () => an(-1),
2969
2994
  children: "Prev"
2970
2995
  }
2971
2996
  ),
@@ -2974,18 +2999,18 @@ function Hr({
2974
2999
  {
2975
3000
  type: "button",
2976
3001
  className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
2977
- disabled: C.length <= 1 || Et >= C.length - 1,
2978
- onClick: () => tn(1),
3002
+ disabled: Z.length <= 1 || jt >= Z.length - 1,
3003
+ onClick: () => an(1),
2979
3004
  children: "Next"
2980
3005
  }
2981
3006
  )
2982
3007
  ] }),
2983
- /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__footer-center", children: [
2984
- /* @__PURE__ */ T("span", { className: "epochs-pdf-viewer__footer-label", children: [
3008
+ /* @__PURE__ */ $("div", { className: "epochs-pdf-viewer__footer-center", children: [
3009
+ /* @__PURE__ */ $("span", { className: "epochs-pdf-viewer__footer-label", children: [
2985
3010
  "Field ",
2986
- Math.max(1, Et + 1),
3011
+ Math.max(1, jt + 1),
2987
3012
  " of ",
2988
- C.length
3013
+ Z.length
2989
3014
  ] }),
2990
3015
  /* @__PURE__ */ a(
2991
3016
  "div",
@@ -2994,30 +3019,30 @@ function Hr({
2994
3019
  role: "progressbar",
2995
3020
  "aria-valuemin": 0,
2996
3021
  "aria-valuemax": 100,
2997
- "aria-valuenow": Bt,
3022
+ "aria-valuenow": Ot,
2998
3023
  "aria-label": "Signature progress",
2999
3024
  children: /* @__PURE__ */ a(
3000
3025
  "div",
3001
3026
  {
3002
3027
  className: "epochs-pdf-viewer__footer-progress-bar",
3003
- style: { width: `${Bt}%` }
3028
+ style: { width: `${Ot}%` }
3004
3029
  }
3005
3030
  )
3006
3031
  }
3007
3032
  ),
3008
- /* @__PURE__ */ T("span", { className: "epochs-pdf-viewer__footer-percent", children: [
3009
- Bt,
3033
+ /* @__PURE__ */ $("span", { className: "epochs-pdf-viewer__footer-percent", children: [
3034
+ Ot,
3010
3035
  "%"
3011
3036
  ] })
3012
3037
  ] })
3013
3038
  ] }) : /* @__PURE__ */ a("div", { className: "epochs-pdf-viewer__footer-center" }),
3014
- be ? /* @__PURE__ */ a(
3039
+ Y ? /* @__PURE__ */ a(
3015
3040
  "button",
3016
3041
  {
3017
3042
  type: "button",
3018
3043
  className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--primary",
3019
- onClick: be,
3020
- children: J
3044
+ onClick: Y,
3045
+ children: lt
3021
3046
  }
3022
3047
  ) : null
3023
3048
  ] }) : null
@@ -3025,31 +3050,31 @@ function Hr({
3025
3050
  }
3026
3051
  );
3027
3052
  }
3028
- function mr(e) {
3053
+ function vr(e) {
3029
3054
  return null;
3030
3055
  }
3031
- mr.displayName = "Document";
3032
- function wr(e) {
3056
+ vr.displayName = "Document";
3057
+ function xr(e) {
3033
3058
  return null;
3034
3059
  }
3035
- wr.displayName = "Page";
3036
- function yr(e) {
3060
+ xr.displayName = "Page";
3061
+ function kr(e) {
3037
3062
  return null;
3038
3063
  }
3039
- yr.displayName = "View";
3040
- function br(e) {
3064
+ kr.displayName = "View";
3065
+ function Mr(e) {
3041
3066
  return null;
3042
3067
  }
3043
- br.displayName = "Text";
3044
- function _r(e) {
3068
+ Mr.displayName = "Text";
3069
+ function Pr(e) {
3045
3070
  return null;
3046
3071
  }
3047
- _r.displayName = "Image";
3048
- function vr(e) {
3072
+ Pr.displayName = "Image";
3073
+ function Nr(e) {
3049
3074
  return null;
3050
3075
  }
3051
- vr.displayName = "Link";
3052
- const xr = {
3076
+ Nr.displayName = "Link";
3077
+ const $r = {
3053
3078
  Document: "DOCUMENT",
3054
3079
  Page: "PAGE",
3055
3080
  View: "VIEW",
@@ -3057,7 +3082,7 @@ const xr = {
3057
3082
  Image: "IMAGE",
3058
3083
  Link: "LINK"
3059
3084
  };
3060
- function kr(e) {
3085
+ function Tr(e) {
3061
3086
  if (typeof e == "string") return e;
3062
3087
  if (typeof e == "function") {
3063
3088
  const t = e;
@@ -3065,7 +3090,7 @@ function kr(e) {
3065
3090
  }
3066
3091
  return null;
3067
3092
  }
3068
- function An(e) {
3093
+ function zn(e) {
3069
3094
  const t = [], n = (i) => {
3070
3095
  if (!(i == null || typeof i == "boolean")) {
3071
3096
  if (Array.isArray(i)) {
@@ -3077,11 +3102,11 @@ function An(e) {
3077
3102
  };
3078
3103
  return n(e), t;
3079
3104
  }
3080
- function Sn(e) {
3081
- return An(e).map((t) => typeof t == "string" || typeof t == "number" ? String(t) : t && typeof t == "object" && "props" in t ? Sn(t.props.children) : "").join("");
3105
+ function jn(e) {
3106
+ return zn(e).map((t) => typeof t == "string" || typeof t == "number" ? String(t) : t && typeof t == "object" && "props" in t ? jn(t.props.children) : "").join("");
3082
3107
  }
3083
- function En(e) {
3084
- const t = kr(e.type), n = t ? xr[t] : void 0;
3108
+ function On(e) {
3109
+ const t = Tr(e.type), n = t ? $r[t] : void 0;
3085
3110
  if (!n)
3086
3111
  throw new Error(
3087
3112
  `[epochs-pdf] Unsupported element "${t ?? "unknown"}". Use Document, Page, View, Text, Image, or Link.`
@@ -3092,27 +3117,27 @@ function En(e) {
3092
3117
  type: n,
3093
3118
  props: i,
3094
3119
  children: [],
3095
- text: Sn(r)
3120
+ text: jn(r)
3096
3121
  };
3097
- const s = An(r).filter(
3122
+ const o = zn(r).filter(
3098
3123
  (c) => !!c && typeof c == "object" && "type" in c
3099
- ).map(En);
3124
+ ).map(On);
3100
3125
  return {
3101
3126
  type: n,
3102
3127
  props: i,
3103
- children: s
3128
+ children: o
3104
3129
  };
3105
3130
  }
3106
- const Mr = {
3131
+ const Ir = {
3107
3132
  A4: [595.28, 841.89],
3108
3133
  LETTER: [612, 792],
3109
3134
  LEGAL: [612, 1008]
3110
3135
  };
3111
- function Pr(e = "A4", t = "portrait") {
3112
- const [n, i] = Array.isArray(e) ? e : Mr[e];
3136
+ function Cr(e = "A4", t = "portrait") {
3137
+ const [n, i] = Array.isArray(e) ? e : Ir[e];
3113
3138
  return t === "landscape" ? [i, n] : [n, i];
3114
3139
  }
3115
- function Bn(e = {}) {
3140
+ function Un(e = {}) {
3116
3141
  const t = e.padding ?? 0;
3117
3142
  return {
3118
3143
  top: e.paddingTop ?? t,
@@ -3121,7 +3146,7 @@ function Bn(e = {}) {
3121
3146
  left: e.paddingLeft ?? t
3122
3147
  };
3123
3148
  }
3124
- function ft(e = {}) {
3149
+ function mt(e = {}) {
3125
3150
  const t = e.margin ?? 0;
3126
3151
  return {
3127
3152
  top: e.marginTop ?? t,
@@ -3130,18 +3155,18 @@ function ft(e = {}) {
3130
3155
  left: e.marginLeft ?? t
3131
3156
  };
3132
3157
  }
3133
- function $t(e) {
3158
+ function Rt(e) {
3134
3159
  if (!e) return null;
3135
3160
  const t = e.trim();
3136
3161
  if (t.startsWith("#")) {
3137
3162
  const i = t.slice(1);
3138
3163
  if (i.length === 3) {
3139
- const r = parseInt(i[0] + i[0], 16) / 255, s = parseInt(i[1] + i[1], 16) / 255, c = parseInt(i[2] + i[2], 16) / 255;
3140
- return [r, s, c];
3164
+ const r = parseInt(i[0] + i[0], 16) / 255, o = parseInt(i[1] + i[1], 16) / 255, c = parseInt(i[2] + i[2], 16) / 255;
3165
+ return [r, o, c];
3141
3166
  }
3142
3167
  if (i.length === 6) {
3143
- const r = parseInt(i.slice(0, 2), 16) / 255, s = parseInt(i.slice(2, 4), 16) / 255, c = parseInt(i.slice(4, 6), 16) / 255;
3144
- return [r, s, c];
3168
+ const r = parseInt(i.slice(0, 2), 16) / 255, o = parseInt(i.slice(2, 4), 16) / 255, c = parseInt(i.slice(4, 6), 16) / 255;
3169
+ return [r, o, c];
3145
3170
  }
3146
3171
  }
3147
3172
  const n = e.match(
@@ -3163,110 +3188,110 @@ function at(e, t, n = 0) {
3163
3188
  const i = Number.parseFloat(e);
3164
3189
  return Number.isFinite(i) ? i : n;
3165
3190
  }
3166
- function qt(e) {
3191
+ function Vt(e) {
3167
3192
  return e === "bold" ? !0 : typeof e == "number" ? e >= 600 : !1;
3168
3193
  }
3169
- const Nr = 12, $r = 1.4, Tr = 0.5;
3170
- function Hn(e, t, n) {
3171
- const i = t.fontSize ?? Nr, r = (t.lineHeight ?? $r) * i, s = i * (qt(t.fontWeight) ? 0.55 : Tr);
3194
+ const Rr = 12, Lr = 1.4, Fr = 0.5;
3195
+ function Wn(e, t, n) {
3196
+ const i = t.fontSize ?? Rr, r = (t.lineHeight ?? Lr) * i, o = i * (Vt(t.fontWeight) ? 0.55 : Fr);
3172
3197
  if (!e)
3173
3198
  return { width: 0, height: r, lines: [""] };
3174
3199
  const c = e.split(/\s+/), l = [];
3175
- let y = "";
3176
- for (const x of c) {
3177
- const v = y ? `${y} ${x}` : x;
3178
- v.length * s <= n || !y ? y = v : (l.push(y), y = x);
3200
+ let b = "";
3201
+ for (const M of c) {
3202
+ const v = b ? `${b} ${M}` : M;
3203
+ v.length * o <= n || !b ? b = v : (l.push(b), b = M);
3179
3204
  }
3180
- y && l.push(y);
3181
- const f = Math.max(...l.map((x) => x.length * s), 0);
3205
+ b && l.push(b);
3206
+ const f = Math.max(...l.map((M) => M.length * o), 0);
3182
3207
  return {
3183
3208
  width: Math.min(f, n),
3184
3209
  height: l.length * r,
3185
3210
  lines: l
3186
3211
  };
3187
3212
  }
3188
- function zn(e, t, n, i, r) {
3189
- const s = e.props.style ?? {}, c = ft(s), l = Bn(s), y = t + c.left, f = n + c.top, x = Math.max(
3213
+ function Gn(e, t, n, i, r) {
3214
+ const o = e.props.style ?? {}, c = mt(o), l = Un(o), b = t + c.left, f = n + c.top, M = Math.max(
3190
3215
  0,
3191
- at(s.width, i, i) - c.left - c.right
3192
- ), v = Math.max(0, x - l.left - l.right);
3216
+ at(o.width, i, i) - c.left - c.right
3217
+ ), v = Math.max(0, M - l.left - l.right);
3193
3218
  if (e.type === "TEXT" || e.type === "LINK") {
3194
- const F = Hn(e.text ?? "", s, v), Q = at(s.height, r, F.height + l.top + l.bottom);
3219
+ const A = Wn(e.text ?? "", o, v), oe = at(o.height, r, A.height + l.top + l.bottom);
3195
3220
  return {
3196
- x: y,
3221
+ x: b,
3197
3222
  y: f,
3198
- width: x,
3199
- height: Q,
3223
+ width: M,
3224
+ height: oe,
3200
3225
  node: e,
3201
3226
  children: [],
3202
- style: s,
3227
+ style: o,
3203
3228
  text: e.text
3204
3229
  };
3205
3230
  }
3206
3231
  if (e.type === "IMAGE") {
3207
- const F = at(s.width, i, Math.min(200, i)), Q = at(s.height, r, 120);
3232
+ const A = at(o.width, i, Math.min(200, i)), oe = at(o.height, r, 120);
3208
3233
  return {
3209
- x: y,
3234
+ x: b,
3210
3235
  y: f,
3211
- width: F - c.left - c.right,
3212
- height: Q,
3236
+ width: A - c.left - c.right,
3237
+ height: oe,
3213
3238
  node: e,
3214
3239
  children: [],
3215
- style: s
3240
+ style: o
3216
3241
  };
3217
3242
  }
3218
- const m = s.flexDirection ?? "column", M = s.gap ?? 0, $ = [];
3219
- let G = y + l.left, S = f + l.top, z = 0, E = 0;
3220
- for (let F = 0; F < e.children.length; F++) {
3221
- const Q = e.children[F], Me = m === "row" ? Math.max(0, v - z - (F > 0 ? M : 0)) : v, Ie = m === "column" ? Math.max(0, r - (S - n) - c.bottom) : r, ue = zn(Q, G, S, Me, Ie);
3222
- $.push(ue), m === "row" ? (z += ue.width + ft(Q.props.style ?? {}).left + ft(Q.props.style ?? {}).right, F < e.children.length - 1 && (z += M), G = y + l.left + z, E = Math.max(E, ue.height)) : (z += ue.height + ft(Q.props.style ?? {}).top + ft(Q.props.style ?? {}).bottom, F < e.children.length - 1 && (z += M), S = f + l.top + z, E = Math.max(E, ue.width));
3243
+ const g = o.flexDirection ?? "column", P = o.gap ?? 0, N = [];
3244
+ let U = b + l.left, E = f + l.top, z = 0, B = 0;
3245
+ for (let A = 0; A < e.children.length; A++) {
3246
+ const oe = e.children[A], ke = g === "row" ? Math.max(0, v - z - (A > 0 ? P : 0)) : v, $e = g === "column" ? Math.max(0, r - (E - n) - c.bottom) : r, ue = Gn(oe, U, E, ke, $e);
3247
+ N.push(ue), g === "row" ? (z += ue.width + mt(oe.props.style ?? {}).left + mt(oe.props.style ?? {}).right, A < e.children.length - 1 && (z += P), U = b + l.left + z, B = Math.max(B, ue.height)) : (z += ue.height + mt(oe.props.style ?? {}).top + mt(oe.props.style ?? {}).bottom, A < e.children.length - 1 && (z += P), E = f + l.top + z, B = Math.max(B, ue.width));
3223
3248
  }
3224
- const I = at(
3225
- s.height,
3249
+ const T = at(
3250
+ o.height,
3226
3251
  r,
3227
- m === "column" ? z + l.top + l.bottom : E + l.top + l.bottom
3228
- ), V = m === "row" ? at(s.width, i, z + l.left + l.right) : x, te = s.justifyContent ?? "flex-start", X = s.alignItems ?? "stretch", oe = m === "column" ? I - l.top - l.bottom : V - l.left - l.right, ye = Math.max(0, oe - z);
3229
- let D = 0, ae = M;
3230
- te === "center" && (D = ye / 2), te === "flex-end" && (D = ye), te === "space-between" && $.length > 1 && (ae = M + ye / ($.length - 1)), te === "space-around" && $.length > 0 && (ae = M + ye / $.length, D = ae / 2);
3231
- let C = 0;
3232
- for (const F of $)
3233
- m === "column" ? (F.y = f + l.top + D + C, X === "center" ? F.x = y + l.left + Math.max(0, (v - F.width) / 2) : X === "flex-end" ? F.x = y + l.left + Math.max(0, v - F.width) : X === "stretch" && F.style.width == null && (F.width = v), C += F.height + ae) : (F.x = y + l.left + D + C, X === "center" ? F.y = f + l.top + Math.max(0, (I - l.top - l.bottom - F.height) / 2) : X === "flex-end" ? F.y = f + l.top + Math.max(0, I - l.top - l.bottom - F.height) : X === "stretch" && F.style.height == null && (F.height = I - l.top - l.bottom), C += F.width + ae);
3252
+ g === "column" ? z + l.top + l.bottom : B + l.top + l.bottom
3253
+ ), Q = g === "row" ? at(o.width, i, z + l.left + l.right) : M, ee = o.justifyContent ?? "flex-start", W = o.alignItems ?? "stretch", re = g === "column" ? T - l.top - l.bottom : Q - l.left - l.right, we = Math.max(0, re - z);
3254
+ let D = 0, se = P;
3255
+ ee === "center" && (D = we / 2), ee === "flex-end" && (D = we), ee === "space-between" && N.length > 1 && (se = P + we / (N.length - 1)), ee === "space-around" && N.length > 0 && (se = P + we / N.length, D = se / 2);
3256
+ let te = 0;
3257
+ for (const A of N)
3258
+ g === "column" ? (A.y = f + l.top + D + te, W === "center" ? A.x = b + l.left + Math.max(0, (v - A.width) / 2) : W === "flex-end" ? A.x = b + l.left + Math.max(0, v - A.width) : W === "stretch" && A.style.width == null && (A.width = v), te += A.height + se) : (A.x = b + l.left + D + te, W === "center" ? A.y = f + l.top + Math.max(0, (T - l.top - l.bottom - A.height) / 2) : W === "flex-end" ? A.y = f + l.top + Math.max(0, T - l.top - l.bottom - A.height) : W === "stretch" && A.style.height == null && (A.height = T - l.top - l.bottom), te += A.width + se);
3234
3259
  return {
3235
- x: y,
3260
+ x: b,
3236
3261
  y: f,
3237
- width: V,
3238
- height: I,
3262
+ width: Q,
3263
+ height: T,
3239
3264
  node: e,
3240
- children: $,
3241
- style: s
3265
+ children: N,
3266
+ style: o
3242
3267
  };
3243
3268
  }
3244
- function Ir(e) {
3269
+ function Dr(e) {
3245
3270
  if (e.type !== "DOCUMENT")
3246
3271
  throw new Error("[epochs-pdf] Root element must be <Document>.");
3247
3272
  const t = [];
3248
3273
  for (const n of e.children) {
3249
3274
  if (n.type !== "PAGE")
3250
3275
  throw new Error("[epochs-pdf] Direct children of <Document> must be <Page>.");
3251
- const i = n.props.size, r = n.props.orientation ?? "portrait", [s, c] = Pr(i, r), l = n.props.style ?? {}, y = Bn(l), f = {
3276
+ const i = n.props.size, r = n.props.orientation ?? "portrait", [o, c] = Cr(i, r), l = n.props.style ?? {}, b = Un(l), f = {
3252
3277
  type: "VIEW",
3253
3278
  props: {
3254
3279
  style: {
3255
3280
  ...l,
3256
- width: s,
3281
+ width: o,
3257
3282
  height: c,
3258
- paddingTop: y.top,
3259
- paddingRight: y.right,
3260
- paddingBottom: y.bottom,
3261
- paddingLeft: y.left
3283
+ paddingTop: b.top,
3284
+ paddingRight: b.right,
3285
+ paddingBottom: b.bottom,
3286
+ paddingLeft: b.left
3262
3287
  }
3263
3288
  },
3264
3289
  children: n.children
3265
- }, x = zn(f, 0, 0, s, c);
3290
+ }, M = Gn(f, 0, 0, o, c);
3266
3291
  t.push({
3267
- width: s,
3292
+ width: o,
3268
3293
  height: c,
3269
- boxes: x.children,
3294
+ boxes: M.children,
3270
3295
  style: l
3271
3296
  });
3272
3297
  }
@@ -3280,48 +3305,48 @@ function Ir(e) {
3280
3305
  pages: t
3281
3306
  };
3282
3307
  }
3283
- function gt(e) {
3308
+ function wt(e) {
3284
3309
  return e.replace(/\\/g, "\\\\").replace(/\(/g, "\\(").replace(/\)/g, "\\)").replace(/\r/g, "\\r").replace(/\n/g, "\\n");
3285
3310
  }
3286
- class Cr {
3311
+ class Sr {
3287
3312
  constructor() {
3288
- Ht(this, "objects", [null]);
3289
- Ht(this, "offsets", [0]);
3313
+ Ut(this, "objects", [null]);
3314
+ Ut(this, "offsets", [0]);
3290
3315
  }
3291
3316
  addObject(t) {
3292
3317
  return this.objects.push(t), this.objects.length - 1;
3293
3318
  }
3294
3319
  build(t) {
3295
3320
  const n = this.addObject(
3296
- `<< /Title (${gt(t.meta.title)}) /Author (${gt(t.meta.author)}) /Subject (${gt(t.meta.subject)}) /Creator (${gt(t.meta.creator)}) /Producer (epochs-pdf) >>`
3321
+ `<< /Title (${wt(t.meta.title)}) /Author (${wt(t.meta.author)}) /Subject (${wt(t.meta.subject)}) /Creator (${wt(t.meta.creator)}) /Producer (epochs-pdf) >>`
3297
3322
  ), i = this.addObject(
3298
3323
  "<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>"
3299
3324
  ), r = this.addObject(
3300
3325
  "<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold >>"
3301
- ), s = [];
3326
+ ), o = [];
3302
3327
  for (const v of t.pages) {
3303
- const m = this.renderPageContent(
3328
+ const g = this.renderPageContent(
3304
3329
  v.boxes,
3305
3330
  v.width,
3306
3331
  v.height,
3307
3332
  v.style
3308
- ), M = this.addObject(
3309
- `<< /Length ${m.length} >>
3333
+ ), P = this.addObject(
3334
+ `<< /Length ${g.length} >>
3310
3335
  stream
3311
- ${m}
3336
+ ${g}
3312
3337
  endstream`
3313
- ), $ = this.addObject("");
3314
- s.push($), this.objects[$] = `<< /Type /Page /Parent 0 0 R /MediaBox [0 0 ${v.width.toFixed(2)} ${v.height.toFixed(2)}] /Contents ${M} 0 R /Resources << /Font << /F1 ${i} 0 R /F2 ${r} 0 R >> >> >>`;
3338
+ ), N = this.addObject("");
3339
+ o.push(N), this.objects[N] = `<< /Type /Page /Parent 0 0 R /MediaBox [0 0 ${v.width.toFixed(2)} ${v.height.toFixed(2)}] /Contents ${P} 0 R /Resources << /Font << /F1 ${i} 0 R /F2 ${r} 0 R >> >> >>`;
3315
3340
  }
3316
- const c = s.map((v) => `${v} 0 R`).join(" "), l = this.addObject(
3317
- `<< /Type /Pages /Kids [${c}] /Count ${s.length} >>`
3341
+ const c = o.map((v) => `${v} 0 R`).join(" "), l = this.addObject(
3342
+ `<< /Type /Pages /Kids [${c}] /Count ${o.length} >>`
3318
3343
  );
3319
- for (const v of s)
3344
+ for (const v of o)
3320
3345
  this.objects[v] = this.objects[v].replace(
3321
3346
  "/Parent 0 0 R",
3322
3347
  `/Parent ${l} 0 R`
3323
3348
  );
3324
- const y = this.addObject(
3349
+ const b = this.addObject(
3325
3350
  `<< /Type /Catalog /Pages ${l} 0 R >>`
3326
3351
  );
3327
3352
  let f = `%PDF-1.4
@@ -3332,7 +3357,7 @@ endstream`
3332
3357
  ${this.objects[v]}
3333
3358
  endobj
3334
3359
  `;
3335
- const x = f.length;
3360
+ const M = f.length;
3336
3361
  f += `xref
3337
3362
  0 ${this.objects.length}
3338
3363
  `, f += `0000000000 65535 f
@@ -3341,109 +3366,109 @@ endobj
3341
3366
  f += `${String(this.offsets[v]).padStart(10, "0")} 00000 n
3342
3367
  `;
3343
3368
  return f += `trailer
3344
- << /Size ${this.objects.length} /Root ${y} 0 R /Info ${n} 0 R >>
3369
+ << /Size ${this.objects.length} /Root ${b} 0 R /Info ${n} 0 R >>
3345
3370
  `, f += `startxref
3346
- ${x}
3371
+ ${M}
3347
3372
  %%EOF`, new TextEncoder().encode(f);
3348
3373
  }
3349
3374
  renderPageContent(t, n, i, r) {
3350
- const s = [], c = $t(r.backgroundColor);
3351
- c && (s.push("q"), s.push(
3375
+ const o = [], c = Rt(r.backgroundColor);
3376
+ c && (o.push("q"), o.push(
3352
3377
  `${c[0].toFixed(3)} ${c[1].toFixed(3)} ${c[2].toFixed(3)} rg`
3353
- ), s.push(
3378
+ ), o.push(
3354
3379
  `0 0 ${n.toFixed(2)} ${i.toFixed(2)} re f`
3355
- ), s.push("Q"));
3356
- const l = (y) => {
3357
- const { x: f, y: x, width: v, height: m, style: M, node: $, text: G } = y, S = i - x - m, z = $t(M.backgroundColor);
3358
- if (z && (s.push("q"), s.push(`${z[0].toFixed(3)} ${z[1].toFixed(3)} ${z[2].toFixed(3)} rg`), s.push(`${f.toFixed(2)} ${S.toFixed(2)} ${v.toFixed(2)} ${m.toFixed(2)} re f`), s.push("Q")), M.borderWidth && M.borderWidth > 0) {
3359
- const E = $t(M.borderColor) ?? [0, 0, 0];
3360
- s.push("q"), s.push(`${M.borderWidth} w`), s.push(`${E[0].toFixed(3)} ${E[1].toFixed(3)} ${E[2].toFixed(3)} RG`), s.push(`${f.toFixed(2)} ${S.toFixed(2)} ${v.toFixed(2)} ${m.toFixed(2)} re S`), s.push("Q");
3380
+ ), o.push("Q"));
3381
+ const l = (b) => {
3382
+ const { x: f, y: M, width: v, height: g, style: P, node: N, text: U } = b, E = i - M - g, z = Rt(P.backgroundColor);
3383
+ if (z && (o.push("q"), o.push(`${z[0].toFixed(3)} ${z[1].toFixed(3)} ${z[2].toFixed(3)} rg`), o.push(`${f.toFixed(2)} ${E.toFixed(2)} ${v.toFixed(2)} ${g.toFixed(2)} re f`), o.push("Q")), P.borderWidth && P.borderWidth > 0) {
3384
+ const B = Rt(P.borderColor) ?? [0, 0, 0];
3385
+ o.push("q"), o.push(`${P.borderWidth} w`), o.push(`${B[0].toFixed(3)} ${B[1].toFixed(3)} ${B[2].toFixed(3)} RG`), o.push(`${f.toFixed(2)} ${E.toFixed(2)} ${v.toFixed(2)} ${g.toFixed(2)} re S`), o.push("Q");
3361
3386
  }
3362
- if (($.type === "TEXT" || $.type === "LINK") && G != null) {
3363
- const E = M.fontSize ?? 12, I = $t(M.color) ?? [0, 0, 0], V = qt(M.fontWeight) ? "F2" : "F1", te = M.paddingLeft ?? M.padding ?? 0, X = M.paddingTop ?? M.padding ?? 0, oe = Math.max(0, v - te - (M.paddingRight ?? M.padding ?? 0)), ke = Hn(G, M, oe || v), ye = (M.lineHeight ?? 1.4) * E;
3364
- s.push("q"), s.push("BT"), s.push(`/${V} ${E} Tf`), s.push(`${I[0].toFixed(3)} ${I[1].toFixed(3)} ${I[2].toFixed(3)} rg`), ke.lines.forEach((D, ae) => {
3365
- let C = f + te;
3366
- const F = D.length * E * (qt(M.fontWeight) ? 0.55 : 0.5);
3367
- M.textAlign === "center" ? C = f + (v - F) / 2 : M.textAlign === "right" && (C = f + v - F - (M.paddingRight ?? M.padding ?? 0));
3368
- const Q = i - x - X - E - ae * ye;
3369
- s.push(`1 0 0 1 ${C.toFixed(2)} ${Q.toFixed(2)} Tm`), s.push(`(${gt(D)}) Tj`);
3370
- }), s.push("ET"), s.push("Q");
3387
+ if ((N.type === "TEXT" || N.type === "LINK") && U != null) {
3388
+ const B = P.fontSize ?? 12, T = Rt(P.color) ?? [0, 0, 0], Q = Vt(P.fontWeight) ? "F2" : "F1", ee = P.paddingLeft ?? P.padding ?? 0, W = P.paddingTop ?? P.padding ?? 0, re = Math.max(0, v - ee - (P.paddingRight ?? P.padding ?? 0)), Pe = Wn(U, P, re || v), we = (P.lineHeight ?? 1.4) * B;
3389
+ o.push("q"), o.push("BT"), o.push(`/${Q} ${B} Tf`), o.push(`${T[0].toFixed(3)} ${T[1].toFixed(3)} ${T[2].toFixed(3)} rg`), Pe.lines.forEach((D, se) => {
3390
+ let te = f + ee;
3391
+ const A = D.length * B * (Vt(P.fontWeight) ? 0.55 : 0.5);
3392
+ P.textAlign === "center" ? te = f + (v - A) / 2 : P.textAlign === "right" && (te = f + v - A - (P.paddingRight ?? P.padding ?? 0));
3393
+ const oe = i - M - W - B - se * we;
3394
+ o.push(`1 0 0 1 ${te.toFixed(2)} ${oe.toFixed(2)} Tm`), o.push(`(${wt(D)}) Tj`);
3395
+ }), o.push("ET"), o.push("Q");
3371
3396
  }
3372
- $.type === "IMAGE" && (s.push("q"), s.push("0.85 0.85 0.85 rg"), s.push(`${f.toFixed(2)} ${S.toFixed(2)} ${v.toFixed(2)} ${m.toFixed(2)} re f`), s.push("0.6 0.6 0.6 RG 1 w"), s.push(`${f.toFixed(2)} ${S.toFixed(2)} ${v.toFixed(2)} ${m.toFixed(2)} re S`), s.push(
3373
- `BT /F1 10 Tf 0.4 0.4 0.4 rg 1 0 0 1 ${(f + 8).toFixed(2)} ${(S + m / 2 - 4).toFixed(2)} Tm (Image) Tj ET`
3374
- ), s.push("Q"));
3375
- for (const E of y.children)
3376
- l(E);
3397
+ N.type === "IMAGE" && (o.push("q"), o.push("0.85 0.85 0.85 rg"), o.push(`${f.toFixed(2)} ${E.toFixed(2)} ${v.toFixed(2)} ${g.toFixed(2)} re f`), o.push("0.6 0.6 0.6 RG 1 w"), o.push(`${f.toFixed(2)} ${E.toFixed(2)} ${v.toFixed(2)} ${g.toFixed(2)} re S`), o.push(
3398
+ `BT /F1 10 Tf 0.4 0.4 0.4 rg 1 0 0 1 ${(f + 8).toFixed(2)} ${(E + g / 2 - 4).toFixed(2)} Tm (Image) Tj ET`
3399
+ ), o.push("Q"));
3400
+ for (const B of b.children)
3401
+ l(B);
3377
3402
  };
3378
- for (const y of t)
3379
- l(y);
3380
- return s.join(`
3403
+ for (const b of t)
3404
+ l(b);
3405
+ return o.join(`
3381
3406
  `);
3382
3407
  }
3383
3408
  }
3384
- function Lr(e) {
3385
- return new Cr().build(e);
3409
+ function Ar(e) {
3410
+ return new Sr().build(e);
3386
3411
  }
3387
- function Yt(e) {
3388
- const t = En(e), n = Ir(t);
3389
- return Lr(n);
3412
+ function Qt(e) {
3413
+ const t = On(e), n = Dr(t);
3414
+ return Ar(n);
3390
3415
  }
3391
- function zr(e) {
3392
- return Yt(e);
3416
+ function Gr(e) {
3417
+ return Qt(e);
3393
3418
  }
3394
- function jn(e) {
3395
- const t = Yt(e), n = new Uint8Array(t.byteLength);
3419
+ function Xn(e) {
3420
+ const t = Qt(e), n = new Uint8Array(t.byteLength);
3396
3421
  return n.set(t), new Blob([n], { type: "application/pdf" });
3397
3422
  }
3398
- function Rr(e) {
3399
- return URL.createObjectURL(jn(e));
3423
+ function Er(e) {
3424
+ return URL.createObjectURL(Xn(e));
3400
3425
  }
3401
- function jr(e, t = "document.pdf") {
3402
- const n = Rr(e), i = document.createElement("a");
3426
+ function Xr(e, t = "document.pdf") {
3427
+ const n = Er(e), i = document.createElement("a");
3403
3428
  i.href = n, i.download = t, i.click(), URL.revokeObjectURL(n);
3404
3429
  }
3405
- async function Or(e) {
3406
- return Yt(e);
3430
+ async function qr(e) {
3431
+ return Qt(e);
3407
3432
  }
3408
- async function Ur(e) {
3409
- return jn(e);
3433
+ async function Yr(e) {
3434
+ return Xn(e);
3410
3435
  }
3411
3436
  export {
3412
- Br as ALL_TOOLBAR_TOOLS,
3413
- Rn as AddText,
3414
- Fn as Clear,
3415
- hn as DEFAULT_TOOLBAR_LAYOUT,
3416
- mr as Document,
3417
- Tn as Download,
3418
- Dn as Erase,
3419
- un as HIGHLIGHT_PRESETS,
3420
- In as Highlight,
3421
- _r as Image,
3422
- vr as Link,
3423
- xn as Navigation,
3424
- $n as Open,
3425
- Mr as PAGE_SIZES,
3426
- wr as Page,
3427
- Hr as PdfViewer,
3428
- Nn as Print,
3429
- Pn as Reload,
3430
- Mn as Rotate,
3431
- Ln as Signature,
3432
- br as Text,
3433
- vn as Thumbnail,
3434
- fn as UNDERLINE_PRESETS,
3435
- Cn as Underline,
3436
- yr as View,
3437
- kn as Zoom,
3438
- Hr as default,
3439
- jr as download,
3440
- mn as hexToMarkupColor,
3441
- zr as pdf,
3442
- Ur as renderToBlob,
3443
- Or as renderToBuffer,
3444
- Pr as resolvePageSize,
3445
- sn as setPdfWorkerSrc,
3446
- jn as toBlob,
3447
- Rr as toUrl
3437
+ Ur as ALL_TOOLBAR_TOOLS,
3438
+ En as AddText,
3439
+ Hn as Clear,
3440
+ mn as DEFAULT_TOOLBAR_LAYOUT,
3441
+ vr as Document,
3442
+ Fn as Download,
3443
+ Bn as Erase,
3444
+ yn as HIGHLIGHT_PRESETS,
3445
+ Dn as Highlight,
3446
+ Pr as Image,
3447
+ Nr as Link,
3448
+ $n as Navigation,
3449
+ Ln as Open,
3450
+ Ir as PAGE_SIZES,
3451
+ xr as Page,
3452
+ Wr as PdfViewer,
3453
+ Rn as Print,
3454
+ Cn as Reload,
3455
+ In as Rotate,
3456
+ An as Signature,
3457
+ Mr as Text,
3458
+ Nn as Thumbnail,
3459
+ bn as UNDERLINE_PRESETS,
3460
+ Sn as Underline,
3461
+ kr as View,
3462
+ Tn as Zoom,
3463
+ Wr as default,
3464
+ Xr as download,
3465
+ vn as hexToMarkupColor,
3466
+ Gr as pdf,
3467
+ Yr as renderToBlob,
3468
+ qr as renderToBuffer,
3469
+ Cr as resolvePageSize,
3470
+ hn as setPdfWorkerSrc,
3471
+ Xn as toBlob,
3472
+ Er as toUrl
3448
3473
  };
3449
3474
  //# sourceMappingURL=epochs-pdf.js.map