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