epochs-pdf 0.1.6 → 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 +25 -25
- package/dist/epochs-pdf.cjs.map +1 -1
- package/dist/epochs-pdf.js +1310 -1302
- 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
|
|
6
|
-
import * as
|
|
7
|
-
import { TextLayer as
|
|
8
|
-
const
|
|
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
|
+
import { TextLayer as Oi } from "pdfjs-dist";
|
|
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 oe(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,14 +76,14 @@ 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);
|
|
@@ -93,7 +93,7 @@ function En(t, e, n) {
|
|
|
93
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
98
|
const r = await Gi(i.imageDataUrl);
|
|
99
99
|
t.drawImage(
|
|
@@ -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;
|
|
@@ -128,14 +128,14 @@ 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
|
|
@@ -148,8 +148,8 @@ function Vi(t, e, n, 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,58 +157,58 @@ 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
|
|
191
|
-
return
|
|
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
|
-
|
|
206
|
-
const
|
|
207
|
-
return Math.abs(
|
|
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
213
|
function Yi(t, e, n) {
|
|
214
214
|
var o;
|
|
@@ -257,7 +257,7 @@ function Ki(t, e, n) {
|
|
|
257
257
|
}
|
|
258
258
|
function Zi(t, e, n) {
|
|
259
259
|
const i = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement;
|
|
260
|
-
return i ? Qi(i, e, n) :
|
|
260
|
+
return i ? Qi(i, e, n) : we;
|
|
261
261
|
}
|
|
262
262
|
function Qi(t, e, n) {
|
|
263
263
|
const i = t.getBoundingClientRect().height;
|
|
@@ -273,7 +273,7 @@ function Qi(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
278
|
function Ji(t, e, n, i) {
|
|
279
279
|
for (const r of n)
|
|
@@ -282,26 +282,26 @@ function Ji(t, e, n, i) {
|
|
|
282
282
|
return null;
|
|
283
283
|
}
|
|
284
284
|
function tr(t, e, n) {
|
|
285
|
-
var
|
|
285
|
+
var x;
|
|
286
286
|
if (!n) return null;
|
|
287
|
-
const i = document, r = (
|
|
287
|
+
const i = document, r = (x = i.caretRangeFromPoint) == null ? void 0 : x.call(i, t, e);
|
|
288
288
|
if (!r || !n.contains(r.startContainer)) return null;
|
|
289
289
|
const o = r.startContainer;
|
|
290
290
|
if (o.nodeType !== Node.TEXT_NODE || !o.textContent) return null;
|
|
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
|
-
|
|
301
|
-
const
|
|
302
|
-
return
|
|
299
|
+
const y = document.createRange();
|
|
300
|
+
y.setStart(o, g), y.setEnd(o, _);
|
|
301
|
+
const b = window.getSelection();
|
|
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;
|
|
@@ -323,7 +323,7 @@ function er(t, e, n, i) {
|
|
|
323
323
|
}
|
|
324
324
|
t.restore();
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function Bt({
|
|
327
327
|
size: t = 14,
|
|
328
328
|
className: e,
|
|
329
329
|
children: n
|
|
@@ -347,27 +347,27 @@ function Ut({
|
|
|
347
347
|
);
|
|
348
348
|
}
|
|
349
349
|
function nr(t) {
|
|
350
|
-
return /* @__PURE__ */ s(
|
|
350
|
+
return /* @__PURE__ */ s(Bt, { ...t, children: /* @__PURE__ */ s("polyline", { points: "15 18 9 12 15 6" }) });
|
|
351
351
|
}
|
|
352
352
|
function ir(t) {
|
|
353
|
-
return /* @__PURE__ */ s(
|
|
353
|
+
return /* @__PURE__ */ s(Bt, { ...t, children: /* @__PURE__ */ s("polyline", { points: "9 18 15 12 9 6" }) });
|
|
354
354
|
}
|
|
355
355
|
function rr(t) {
|
|
356
|
-
return /* @__PURE__ */
|
|
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
362
|
function or(t) {
|
|
363
|
-
return /* @__PURE__ */
|
|
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
369
|
function sr(t) {
|
|
370
|
-
return /* @__PURE__ */
|
|
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" }),
|
|
373
373
|
/* @__PURE__ */ s("rect", { x: "14", y: "14", width: "7", height: "7" }),
|
|
@@ -375,48 +375,48 @@ function sr(t) {
|
|
|
375
375
|
] });
|
|
376
376
|
}
|
|
377
377
|
function ar(t) {
|
|
378
|
-
return /* @__PURE__ */ s(
|
|
378
|
+
return /* @__PURE__ */ s(Bt, { ...t, children: /* @__PURE__ */ s("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
379
379
|
}
|
|
380
380
|
function cr(t) {
|
|
381
|
-
return /* @__PURE__ */
|
|
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
386
|
function lr(t) {
|
|
387
|
-
return /* @__PURE__ */
|
|
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
393
|
function dr(t) {
|
|
394
|
-
return /* @__PURE__ */
|
|
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
400
|
function hr(t) {
|
|
401
|
-
return /* @__PURE__ */
|
|
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
406
|
function ur(t) {
|
|
407
|
-
return /* @__PURE__ */
|
|
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
412
|
function fr(t) {
|
|
413
|
-
return /* @__PURE__ */
|
|
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
418
|
function pr(t) {
|
|
419
|
-
return /* @__PURE__ */
|
|
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" })
|
|
@@ -441,13 +441,13 @@ function gr({ size: t = 16, className: e }) {
|
|
|
441
441
|
);
|
|
442
442
|
}
|
|
443
443
|
function mr(t) {
|
|
444
|
-
return /* @__PURE__ */
|
|
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
449
|
function wr(t) {
|
|
450
|
-
return /* @__PURE__ */
|
|
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" })
|
|
@@ -465,142 +465,142 @@ function yr({
|
|
|
465
465
|
annotations: m = [],
|
|
466
466
|
onAddAnnotation: g,
|
|
467
467
|
onRemoveAnnotation: _,
|
|
468
|
-
signatures:
|
|
469
|
-
pendingSignature:
|
|
470
|
-
onAddSignature:
|
|
471
|
-
onUpdateSignature:
|
|
468
|
+
signatures: y = [],
|
|
469
|
+
pendingSignature: b = null,
|
|
470
|
+
onAddSignature: x,
|
|
471
|
+
onUpdateSignature: I,
|
|
472
472
|
onRemoveSignature: S,
|
|
473
473
|
onEditSignature: H,
|
|
474
|
-
onDuplicateSignature:
|
|
475
|
-
selectedSignatureId:
|
|
476
|
-
onSelectSignature:
|
|
477
|
-
signatureFields:
|
|
478
|
-
selectedSignatureFieldId:
|
|
479
|
-
onSelectSignatureField:
|
|
480
|
-
hasFixedSignatureFields:
|
|
481
|
-
onOpenSignaturePad:
|
|
474
|
+
onDuplicateSignature: W,
|
|
475
|
+
selectedSignatureId: A = null,
|
|
476
|
+
onSelectSignature: C,
|
|
477
|
+
signatureFields: nt = [],
|
|
478
|
+
selectedSignatureFieldId: at = null,
|
|
479
|
+
onSelectSignatureField: q,
|
|
480
|
+
hasFixedSignatureFields: pt = !1,
|
|
481
|
+
onOpenSignaturePad: J,
|
|
482
482
|
fieldValues: Mt = {},
|
|
483
|
-
onFieldValueChange:
|
|
484
|
-
onFieldValueCommit:
|
|
485
|
-
pendingFieldValue:
|
|
486
|
-
onPlaceFieldValue:
|
|
487
|
-
texts:
|
|
488
|
-
onAddText:
|
|
489
|
-
onUpdateText:
|
|
490
|
-
onRemoveText:
|
|
491
|
-
selectedTextId:
|
|
492
|
-
onSelectText:
|
|
493
|
-
textFields:
|
|
494
|
-
selectedTextFieldId:
|
|
495
|
-
onSelectTextField:
|
|
496
|
-
hasFixedTextFields:
|
|
497
|
-
editingTextId:
|
|
498
|
-
onEditingTextIdChange:
|
|
483
|
+
onFieldValueChange: K,
|
|
484
|
+
onFieldValueCommit: Et,
|
|
485
|
+
pendingFieldValue: vt = null,
|
|
486
|
+
onPlaceFieldValue: E,
|
|
487
|
+
texts: ct = [],
|
|
488
|
+
onAddText: ut,
|
|
489
|
+
onUpdateText: gt,
|
|
490
|
+
onRemoveText: tt,
|
|
491
|
+
selectedTextId: kt = null,
|
|
492
|
+
onSelectText: dt,
|
|
493
|
+
textFields: te = [],
|
|
494
|
+
selectedTextFieldId: ye = null,
|
|
495
|
+
onSelectTextField: Vt,
|
|
496
|
+
hasFixedTextFields: qt = !1,
|
|
497
|
+
editingTextId: Kt = null,
|
|
498
|
+
onEditingTextIdChange: G
|
|
499
499
|
}) {
|
|
500
|
-
const $t = xt(null),
|
|
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 w =
|
|
506
|
-
return
|
|
505
|
+
const w = yt.current, v = bt.current, M = it.current, D = w.getContext("2d");
|
|
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 N =
|
|
525
|
-
w.width =
|
|
526
|
-
const
|
|
527
|
-
if (
|
|
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
528
|
v.replaceChildren(), v.style.setProperty("--scale-factor", String(N.scale));
|
|
529
|
-
const
|
|
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
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
559
|
const w = (P) => {
|
|
560
|
-
var
|
|
560
|
+
var Z;
|
|
561
561
|
if (!g) return !1;
|
|
562
|
-
const
|
|
563
|
-
if (!
|
|
564
|
-
const N =
|
|
562
|
+
const F = P === "redact" ? He : u;
|
|
563
|
+
if (!F) return !1;
|
|
564
|
+
const N = an(a, n);
|
|
565
565
|
if (!N) return !1;
|
|
566
|
-
const
|
|
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:
|
|
571
|
+
color: F,
|
|
572
|
+
rects: j,
|
|
573
573
|
text: N.text
|
|
574
|
-
}), (
|
|
574
|
+
}), (Z = window.getSelection()) == null || Z.removeAllRanges(), !0;
|
|
575
575
|
}, v = (P) => {
|
|
576
|
-
var
|
|
577
|
-
if (!g || !
|
|
578
|
-
const
|
|
579
|
-
if (!
|
|
580
|
-
const N =
|
|
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:
|
|
585
|
+
color: He,
|
|
586
586
|
rects: N,
|
|
587
|
-
text:
|
|
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;
|
|
@@ -613,12 +613,12 @@ function yr({
|
|
|
613
613
|
const P = window.getSelection();
|
|
614
614
|
P && !P.isCollapsed && P.toString().trim() && P.anchorNode && a.contains(P.anchorNode) && v(P.toString());
|
|
615
615
|
}
|
|
616
|
-
},
|
|
617
|
-
const
|
|
618
|
-
if (
|
|
616
|
+
}, D = (P) => {
|
|
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 N = window.getSelection(),
|
|
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
623
|
P.preventDefault(), v(N.toString());
|
|
624
624
|
return;
|
|
@@ -628,245 +628,245 @@ function yr({
|
|
|
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
|
-
return a.addEventListener("mouseup",
|
|
634
|
-
a.removeEventListener("mouseup",
|
|
633
|
+
return a.addEventListener("mouseup", M), window.addEventListener("keydown", D), () => {
|
|
634
|
+
a.removeEventListener("mouseup", M), window.removeEventListener("keydown", D);
|
|
635
635
|
};
|
|
636
636
|
}, [
|
|
637
637
|
d,
|
|
638
638
|
u,
|
|
639
639
|
g,
|
|
640
|
-
it,
|
|
641
|
-
O,
|
|
642
640
|
ut,
|
|
641
|
+
G,
|
|
642
|
+
dt,
|
|
643
643
|
e,
|
|
644
644
|
n
|
|
645
|
-
]),
|
|
646
|
-
if (!
|
|
647
|
-
let a = 0, w = 0, v = 0,
|
|
648
|
-
const
|
|
649
|
-
var
|
|
650
|
-
return (
|
|
651
|
-
}, P = (
|
|
652
|
-
if (
|
|
653
|
-
const
|
|
654
|
-
if (!
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
645
|
+
]), Dt(() => {
|
|
646
|
+
if (!mt) return;
|
|
647
|
+
let a = 0, w = 0, v = 0, M = 0;
|
|
648
|
+
const D = () => {
|
|
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
|
-
).find((
|
|
671
|
-
const
|
|
672
|
-
return
|
|
673
|
-
}) ?? null),
|
|
674
|
-
const
|
|
670
|
+
).find((Gt) => {
|
|
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
|
-
if (a = 0, !
|
|
691
|
-
const
|
|
692
|
-
if (!
|
|
693
|
-
const
|
|
694
|
-
if (
|
|
695
|
-
const
|
|
696
|
-
let
|
|
697
|
-
if (
|
|
698
|
-
|
|
699
|
-
else if (
|
|
700
|
-
|
|
690
|
+
if (a = 0, !M) return;
|
|
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
|
-
w =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
723
|
-
|
|
724
|
-
|
|
722
|
+
mt,
|
|
723
|
+
pt,
|
|
724
|
+
I,
|
|
725
725
|
n,
|
|
726
|
-
|
|
727
|
-
]),
|
|
728
|
-
if (!
|
|
729
|
-
const a =
|
|
726
|
+
y
|
|
727
|
+
]), Dt(() => {
|
|
728
|
+
if (!Kt || !ee.current) return;
|
|
729
|
+
const a = ee.current, w = ct.find((D) => D.id === Kt);
|
|
730
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
|
-
const
|
|
734
|
-
|
|
735
|
-
}, [
|
|
736
|
-
const
|
|
733
|
+
const M = window.getSelection();
|
|
734
|
+
M == null || M.removeAllRanges(), M == null || M.addRange(v);
|
|
735
|
+
}, [Kt]);
|
|
736
|
+
const ne = (a) => {
|
|
737
737
|
$t.current = a, r == null || r(a);
|
|
738
|
-
},
|
|
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
739
|
const v = w.trim();
|
|
740
740
|
if (!v) {
|
|
741
|
-
|
|
741
|
+
tt == null || tt(a.id), G == null || G(null);
|
|
742
742
|
return;
|
|
743
743
|
}
|
|
744
|
-
const
|
|
745
|
-
|
|
744
|
+
const M = Re(v, a.fontSize);
|
|
745
|
+
gt == null || gt(a.id, {
|
|
746
746
|
value: v,
|
|
747
|
-
width:
|
|
748
|
-
height:
|
|
749
|
-
}),
|
|
750
|
-
},
|
|
751
|
-
if (!
|
|
752
|
-
const v =
|
|
753
|
-
if (!v || !
|
|
754
|
-
let
|
|
747
|
+
width: M.width,
|
|
748
|
+
height: M.height
|
|
749
|
+
}), G == null || G(null);
|
|
750
|
+
}, rt = (a, w) => {
|
|
751
|
+
if (!ut) return;
|
|
752
|
+
const v = it.current, M = bt.current;
|
|
753
|
+
if (!v || !M) return;
|
|
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
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
760
|
+
), P, F = me;
|
|
761
|
+
if (qt) {
|
|
762
|
+
const Z = Ji(
|
|
763
|
+
D.x,
|
|
764
|
+
D.y,
|
|
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 N =
|
|
781
|
-
id:
|
|
780
|
+
const N = Re("", D.fontSize), j = {
|
|
781
|
+
id: Ge(),
|
|
782
782
|
fieldId: P,
|
|
783
783
|
pageNumber: e,
|
|
784
|
-
x:
|
|
785
|
-
y:
|
|
784
|
+
x: D.x,
|
|
785
|
+
y: D.y,
|
|
786
786
|
width: N.width,
|
|
787
787
|
height: N.height,
|
|
788
788
|
value: "",
|
|
789
|
-
fontSize:
|
|
790
|
-
color:
|
|
789
|
+
fontSize: D.fontSize,
|
|
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
801
|
const w = window.getSelection();
|
|
802
802
|
if (!(w && !w.isCollapsed && w.toString().trim())) {
|
|
803
|
-
if (a.detail >= 2 && tr(a.clientX, a.clientY,
|
|
804
|
-
const
|
|
805
|
-
if (
|
|
806
|
-
const P =
|
|
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:
|
|
819
|
+
x: F.x,
|
|
820
|
+
y: F.y,
|
|
821
821
|
width: N.width,
|
|
822
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
|
-
},
|
|
834
|
+
}, Zt = (a) => {
|
|
835
835
|
const w = a.target;
|
|
836
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 (!
|
|
842
|
-
const v =
|
|
841
|
+
if (!pt && d === "sign" && vt && E) {
|
|
842
|
+
const v = it.current;
|
|
843
843
|
if (!v) return;
|
|
844
|
-
const
|
|
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
|
-
if (!
|
|
849
|
-
const v =
|
|
848
|
+
if (!pt && d === "sign" && b && x) {
|
|
849
|
+
const v = it.current;
|
|
850
850
|
if (!v) return;
|
|
851
|
-
const
|
|
852
|
-
let P =
|
|
853
|
-
const N = Math.max(0,
|
|
854
|
-
P = Math.min(Math.max(0, P), N),
|
|
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
855
|
id: Se(),
|
|
856
856
|
pageNumber: e,
|
|
857
857
|
x: P,
|
|
858
|
-
y:
|
|
859
|
-
width:
|
|
860
|
-
height:
|
|
861
|
-
imageDataUrl:
|
|
858
|
+
y: F,
|
|
859
|
+
width: b.width,
|
|
860
|
+
height: b.height,
|
|
861
|
+
imageDataUrl: b.imageDataUrl
|
|
862
862
|
});
|
|
863
863
|
return;
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
}, ie = (a) =>
|
|
866
|
+
}, ie = (a) => Kt === a.id ? /* @__PURE__ */ s(
|
|
867
867
|
"span",
|
|
868
868
|
{
|
|
869
|
-
ref:
|
|
869
|
+
ref: ee,
|
|
870
870
|
contentEditable: !0,
|
|
871
871
|
suppressContentEditableWarning: !0,
|
|
872
872
|
role: "textbox",
|
|
@@ -883,15 +883,15 @@ function yr({
|
|
|
883
883
|
onClick: (v) => v.stopPropagation(),
|
|
884
884
|
onPointerDown: (v) => v.stopPropagation(),
|
|
885
885
|
onInput: (v) => {
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
value:
|
|
889
|
-
width:
|
|
890
|
-
height:
|
|
886
|
+
const M = v.currentTarget.textContent ?? "", D = Re(M || " ", a.fontSize);
|
|
887
|
+
gt == null || gt(a.id, {
|
|
888
|
+
value: M,
|
|
889
|
+
width: D.width,
|
|
890
|
+
height: D.height
|
|
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());
|
|
@@ -901,7 +901,7 @@ function yr({
|
|
|
901
901
|
) : a.value.trim() ? /* @__PURE__ */ s(
|
|
902
902
|
"span",
|
|
903
903
|
{
|
|
904
|
-
className:
|
|
904
|
+
className: kt === a.id ? "epochs-pdf-viewer__inline-text epochs-pdf-viewer__inline-text--selected" : "epochs-pdf-viewer__inline-text",
|
|
905
905
|
style: {
|
|
906
906
|
left: a.x * n,
|
|
907
907
|
top: a.y * n,
|
|
@@ -910,10 +910,10 @@ function yr({
|
|
|
910
910
|
},
|
|
911
911
|
onClick: (v) => {
|
|
912
912
|
if (v.stopPropagation(), d === "erase") {
|
|
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,18 +922,18 @@ function yr({
|
|
|
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
|
-
children: /* @__PURE__ */
|
|
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:
|
|
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
937
|
(a) => a.kind === "redact" ? null : a.rects.map((w, v) => a.kind === "highlight" ? /* @__PURE__ */ s(
|
|
938
938
|
"div",
|
|
939
939
|
{
|
|
@@ -945,8 +945,8 @@ function yr({
|
|
|
945
945
|
height: w.h * n,
|
|
946
946
|
background: a.color
|
|
947
947
|
},
|
|
948
|
-
onClick: (
|
|
949
|
-
d === "erase" && (
|
|
948
|
+
onClick: (M) => {
|
|
949
|
+
d === "erase" && (M.stopPropagation(), _ == null || _(a.id));
|
|
950
950
|
}
|
|
951
951
|
},
|
|
952
952
|
`${a.id}_${v}`
|
|
@@ -961,46 +961,46 @@ function yr({
|
|
|
961
961
|
height: Math.max(2, n * 1.5),
|
|
962
962
|
background: a.color
|
|
963
963
|
},
|
|
964
|
-
onClick: (
|
|
965
|
-
d === "erase" && (
|
|
964
|
+
onClick: (M) => {
|
|
965
|
+
d === "erase" && (M.stopPropagation(), _ == null || _(a.id));
|
|
966
966
|
}
|
|
967
967
|
},
|
|
968
968
|
`${a.id}_${v}`
|
|
969
969
|
))
|
|
970
970
|
) }),
|
|
971
|
-
/* @__PURE__ */
|
|
972
|
-
|
|
973
|
-
const w = a.type ?? "sign", v = Mt[a.id] ?? a.value ?? "",
|
|
971
|
+
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__signature-layer", children: [
|
|
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
|
{
|
|
977
977
|
type: "button",
|
|
978
978
|
"data-signature-field-id": a.id,
|
|
979
|
-
className:
|
|
979
|
+
className: at === a.id ? "epochs-pdf-viewer__signature-field epochs-pdf-viewer__signature-field--selected" : M ? "epochs-pdf-viewer__signature-field epochs-pdf-viewer__signature-field--filled" : "epochs-pdf-viewer__signature-field",
|
|
980
980
|
style: {
|
|
981
981
|
left: a.x * n,
|
|
982
982
|
top: a.y * n,
|
|
983
983
|
width: a.width * n,
|
|
984
984
|
height: a.height * n
|
|
985
985
|
},
|
|
986
|
-
onClick: (
|
|
987
|
-
if (
|
|
988
|
-
|
|
986
|
+
onClick: (D) => {
|
|
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:
|
|
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" }) :
|
|
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,
|
|
@@ -1008,22 +1008,22 @@ function yr({
|
|
|
1008
1008
|
height: a.height * n
|
|
1009
1009
|
},
|
|
1010
1010
|
onPointerDown: (w) => {
|
|
1011
|
-
if (w.stopPropagation(), w.preventDefault(),
|
|
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
|
-
if (
|
|
1016
|
-
|
|
1015
|
+
if (pt) {
|
|
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
|
|
1021
|
+
const M = We(w.clientX, w.clientY, v, n);
|
|
1022
1022
|
It({
|
|
1023
1023
|
kind: "signature",
|
|
1024
1024
|
id: a.id,
|
|
1025
|
-
offsetX:
|
|
1026
|
-
offsetY:
|
|
1025
|
+
offsetX: M.x - a.x,
|
|
1026
|
+
offsetY: M.y - a.y
|
|
1027
1027
|
});
|
|
1028
1028
|
},
|
|
1029
1029
|
children: [
|
|
@@ -1038,12 +1038,12 @@ function yr({
|
|
|
1038
1038
|
w.stopPropagation();
|
|
1039
1039
|
},
|
|
1040
1040
|
onClick: (w) => {
|
|
1041
|
-
w.stopPropagation(),
|
|
1041
|
+
w.stopPropagation(), C == null || C(a.id), H == null || H(a.id);
|
|
1042
1042
|
},
|
|
1043
1043
|
children: /* @__PURE__ */ s(mr, { size: 12 })
|
|
1044
1044
|
}
|
|
1045
1045
|
),
|
|
1046
|
-
|
|
1046
|
+
pt ? null : /* @__PURE__ */ T(je, { children: [
|
|
1047
1047
|
/* @__PURE__ */ s(
|
|
1048
1048
|
"button",
|
|
1049
1049
|
{
|
|
@@ -1055,7 +1055,7 @@ function yr({
|
|
|
1055
1055
|
w.stopPropagation();
|
|
1056
1056
|
},
|
|
1057
1057
|
onClick: (w) => {
|
|
1058
|
-
w.stopPropagation(),
|
|
1058
|
+
w.stopPropagation(), C == null || C(a.id), W == null || W(a.id);
|
|
1059
1059
|
},
|
|
1060
1060
|
children: "⧉"
|
|
1061
1061
|
}
|
|
@@ -1078,13 +1078,13 @@ function yr({
|
|
|
1078
1078
|
)
|
|
1079
1079
|
] }),
|
|
1080
1080
|
/* @__PURE__ */ s("img", { src: a.imageDataUrl, alt: "Signature", draggable: !1 }),
|
|
1081
|
-
|
|
1081
|
+
pt ? null : /* @__PURE__ */ s(
|
|
1082
1082
|
"div",
|
|
1083
1083
|
{
|
|
1084
1084
|
className: "epochs-pdf-viewer__signature-resize",
|
|
1085
1085
|
title: "Resize",
|
|
1086
1086
|
onPointerDown: (w) => {
|
|
1087
|
-
w.stopPropagation(), w.preventDefault(),
|
|
1087
|
+
w.stopPropagation(), w.preventDefault(), C == null || C(a.id), It({
|
|
1088
1088
|
kind: "resize",
|
|
1089
1089
|
id: a.id,
|
|
1090
1090
|
startX: w.clientX,
|
|
@@ -1101,16 +1101,16 @@ function yr({
|
|
|
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:
|
|
1113
|
+
/* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__redact-layer", "aria-hidden": "true", children: Nt.map(
|
|
1114
1114
|
(a) => a.kind === "redact" ? a.rects.map((w, v) => /* @__PURE__ */ s(
|
|
1115
1115
|
"div",
|
|
1116
1116
|
{
|
|
@@ -1120,10 +1120,10 @@ function yr({
|
|
|
1120
1120
|
top: w.y * n,
|
|
1121
1121
|
width: w.w * n,
|
|
1122
1122
|
height: w.h * n,
|
|
1123
|
-
background: a.color ||
|
|
1123
|
+
background: a.color || He
|
|
1124
1124
|
},
|
|
1125
|
-
onClick: (
|
|
1126
|
-
d === "erase" && (
|
|
1125
|
+
onClick: (M) => {
|
|
1126
|
+
d === "erase" && (M.stopPropagation(), _ == null || _(a.id));
|
|
1127
1127
|
}
|
|
1128
1128
|
},
|
|
1129
1129
|
`${a.id}_${v}`
|
|
@@ -1148,45 +1148,45 @@ function br({
|
|
|
1148
1148
|
texts: g = [],
|
|
1149
1149
|
textFields: _ = []
|
|
1150
1150
|
}) {
|
|
1151
|
-
const
|
|
1152
|
-
return
|
|
1153
|
-
if (!t || !
|
|
1154
|
-
let
|
|
1155
|
-
const
|
|
1156
|
-
if (
|
|
1151
|
+
const y = xt(null);
|
|
1152
|
+
return Dt(() => {
|
|
1153
|
+
if (!t || !y.current) return;
|
|
1154
|
+
let b = !1;
|
|
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
|
|
1161
|
-
if (
|
|
1162
|
-
const
|
|
1163
|
-
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1166
|
-
const
|
|
1167
|
-
(
|
|
1160
|
+
const W = await t.getPage(e);
|
|
1161
|
+
if (b) return;
|
|
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
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
new Set(
|
|
1173
|
-
|
|
1174
|
-
),
|
|
1175
|
-
const
|
|
1176
|
-
(
|
|
1169
|
+
pt.length > 0 && Si(
|
|
1170
|
+
I,
|
|
1171
|
+
pt,
|
|
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
1178
|
Mt.length > 0 && er(
|
|
1179
|
-
|
|
1179
|
+
I,
|
|
1180
1180
|
Mt,
|
|
1181
1181
|
new Set(
|
|
1182
|
-
|
|
1182
|
+
J.filter((K) => K.fieldId && K.value.trim()).map((K) => K.fieldId)
|
|
1183
1183
|
),
|
|
1184
|
-
|
|
1185
|
-
),
|
|
1184
|
+
C
|
|
1185
|
+
), J.length > 0 && Wn(I, J, C);
|
|
1186
1186
|
} catch {
|
|
1187
1187
|
}
|
|
1188
1188
|
})(), () => {
|
|
1189
|
-
if (
|
|
1189
|
+
if (b = !0, S)
|
|
1190
1190
|
try {
|
|
1191
1191
|
S.cancel();
|
|
1192
1192
|
} catch {
|
|
@@ -1202,7 +1202,7 @@ function br({
|
|
|
1202
1202
|
_,
|
|
1203
1203
|
g,
|
|
1204
1204
|
o
|
|
1205
|
-
]), /* @__PURE__ */
|
|
1205
|
+
]), /* @__PURE__ */ T(
|
|
1206
1206
|
"button",
|
|
1207
1207
|
{
|
|
1208
1208
|
type: "button",
|
|
@@ -1210,24 +1210,24 @@ function br({
|
|
|
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
1219
|
const _r = /^(blob:|https?:|data:)/i;
|
|
1220
|
-
let
|
|
1221
|
-
function
|
|
1222
|
-
|
|
1220
|
+
let On = !1;
|
|
1221
|
+
function $n(t) {
|
|
1222
|
+
Ie.GlobalWorkerOptions.workerSrc = t, On = !0;
|
|
1223
1223
|
}
|
|
1224
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
1233
|
function xr(t, e, n = "") {
|
|
@@ -1243,7 +1243,7 @@ async function Mr(t, e) {
|
|
|
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
1248
|
return Mr(t, e);
|
|
1249
1249
|
if (t instanceof ArrayBuffer) return t.slice(0);
|
|
@@ -1262,29 +1262,29 @@ async function kr(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
|
-
|
|
1270
|
-
const
|
|
1271
|
-
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1276
|
-
const
|
|
1277
|
-
return
|
|
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
|
+
return x.width = 0, x.height = 0, {
|
|
1278
1278
|
pageNumber: e,
|
|
1279
1279
|
width: S,
|
|
1280
1280
|
height: H,
|
|
1281
|
-
pageWidth:
|
|
1282
|
-
pageHeight:
|
|
1283
|
-
dataUrl:
|
|
1284
|
-
jpegBytes:
|
|
1281
|
+
pageWidth: b.width,
|
|
1282
|
+
pageHeight: b.height,
|
|
1283
|
+
dataUrl: nt,
|
|
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
1290
|
n.push(await kr(t, i, e));
|
|
@@ -1296,10 +1296,10 @@ function Nr(t) {
|
|
|
1296
1296
|
i[r] = n.charCodeAt(r);
|
|
1297
1297
|
return i;
|
|
1298
1298
|
}
|
|
1299
|
-
function
|
|
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)
|
|
@@ -1307,81 +1307,81 @@ function $n(...t) {
|
|
|
1307
1307
|
return n;
|
|
1308
1308
|
}
|
|
1309
1309
|
function Pr(t) {
|
|
1310
|
-
const e = [], n = (
|
|
1311
|
-
for (const
|
|
1312
|
-
const
|
|
1313
|
-
|
|
1314
|
-
`<< /Type /XObject /Subtype /Image /Width ${
|
|
1310
|
+
const e = [], n = (b) => (e.push(b), e.length), i = [];
|
|
1311
|
+
for (const b of t) {
|
|
1312
|
+
const x = Tn(
|
|
1313
|
+
Jt(
|
|
1314
|
+
`<< /Type /XObject /Subtype /Image /Width ${b.width} /Height ${b.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${b.jpegBytes.byteLength} >>
|
|
1315
1315
|
stream
|
|
1316
1316
|
`
|
|
1317
1317
|
),
|
|
1318
|
-
|
|
1319
|
-
|
|
1318
|
+
b.jpegBytes,
|
|
1319
|
+
Jt(`
|
|
1320
1320
|
endstream`)
|
|
1321
|
-
),
|
|
1322
|
-
${
|
|
1321
|
+
), I = n(x), S = `q
|
|
1322
|
+
${b.pageWidth.toFixed(2)} 0 0 ${b.pageHeight.toFixed(2)} 0 0 cm
|
|
1323
1323
|
/Im0 Do
|
|
1324
1324
|
Q`, H = n(
|
|
1325
|
-
|
|
1325
|
+
Jt(`<< /Length ${S.length} >>
|
|
1326
1326
|
stream
|
|
1327
1327
|
${S}
|
|
1328
1328
|
endstream`)
|
|
1329
|
-
),
|
|
1330
|
-
|
|
1331
|
-
`<< /Type /Page /Parent __PAGES__ 0 R /MediaBox [0 0 ${
|
|
1329
|
+
), W = n(
|
|
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 ${I} 0 R >> >> >>`
|
|
1332
1332
|
)
|
|
1333
1333
|
);
|
|
1334
|
-
i.push(
|
|
1334
|
+
i.push(W);
|
|
1335
1335
|
}
|
|
1336
|
-
const r = i.map((
|
|
1337
|
-
|
|
1336
|
+
const r = i.map((b) => `${b} 0 R`).join(" "), o = n(
|
|
1337
|
+
Jt(`<< /Type /Pages /Kids [${r}] /Count ${i.length} >>`)
|
|
1338
1338
|
);
|
|
1339
|
-
for (const
|
|
1340
|
-
const
|
|
1341
|
-
e[
|
|
1342
|
-
|
|
1339
|
+
for (const b of i) {
|
|
1340
|
+
const x = new TextDecoder().decode(e[b - 1]);
|
|
1341
|
+
e[b - 1] = Jt(
|
|
1342
|
+
x.replace("/Parent __PAGES__ 0 R", `/Parent ${o} 0 R`)
|
|
1343
1343
|
);
|
|
1344
1344
|
}
|
|
1345
|
-
const d = n(
|
|
1345
|
+
const d = n(Jt(`<< /Type /Catalog /Pages ${o} 0 R >>`)), u = [Jt(`%PDF-1.4
|
|
1346
1346
|
`)], m = [0];
|
|
1347
1347
|
let g = u[0].byteLength;
|
|
1348
|
-
for (let
|
|
1348
|
+
for (let b = 0; b < e.length; b += 1) {
|
|
1349
1349
|
m.push(g);
|
|
1350
|
-
const
|
|
1351
|
-
`),
|
|
1350
|
+
const x = Jt(`${b + 1} 0 obj
|
|
1351
|
+
`), I = Jt(`
|
|
1352
1352
|
endobj
|
|
1353
1353
|
`);
|
|
1354
|
-
u.push(
|
|
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
|
-
for (let
|
|
1363
|
-
|
|
1362
|
+
for (let b = 1; b <= e.length; b += 1)
|
|
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(
|
|
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
|
|
1375
|
+
const Ue = [
|
|
1376
1376
|
{ id: "dancing-script", label: "Dancing Script", family: "Dancing Script" },
|
|
1377
1377
|
{ id: "great-vibes", label: "Great Vibes", family: "Great Vibes" },
|
|
1378
1378
|
{ id: "pacifico", label: "Pacifico", family: "Pacifico" },
|
|
1379
1379
|
{ id: "satisfy", label: "Satisfy", family: "Satisfy" },
|
|
1380
1380
|
{ id: "allura", label: "Allura", family: "Allura" }
|
|
1381
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
|
|
1382
|
+
let Oe = null;
|
|
1383
1383
|
function Ir() {
|
|
1384
|
-
return typeof document > "u" ? Promise.resolve() :
|
|
1384
|
+
return typeof document > "u" ? Promise.resolve() : Oe || (Oe = new Promise((t) => {
|
|
1385
1385
|
var i;
|
|
1386
1386
|
if (!document.querySelector(
|
|
1387
1387
|
'link[data-epochs-signature-fonts="true"]'
|
|
@@ -1390,7 +1390,7 @@ function Ir() {
|
|
|
1390
1390
|
r.rel = "stylesheet", r.href = $r, r.dataset.epochsSignatureFonts = "true", document.head.appendChild(r);
|
|
1391
1391
|
}
|
|
1392
1392
|
const n = () => Promise.all(
|
|
1393
|
-
|
|
1393
|
+
Ue.map(
|
|
1394
1394
|
(r) => document.fonts.load(`48px "${r.family}"`)
|
|
1395
1395
|
)
|
|
1396
1396
|
).then(() => {
|
|
@@ -1398,9 +1398,9 @@ function Ir() {
|
|
|
1398
1398
|
(i = document.fonts) != null && i.ready ? document.fonts.ready.then(n).then(t).catch(() => t()) : window.setTimeout(() => {
|
|
1399
1399
|
n().then(t).catch(() => t());
|
|
1400
1400
|
}, 300);
|
|
1401
|
-
}),
|
|
1401
|
+
}), Oe);
|
|
1402
1402
|
}
|
|
1403
|
-
function
|
|
1403
|
+
function Dn(t, e) {
|
|
1404
1404
|
return t === "initials" ? 72 : e === "Great Vibes" || e === "Allura" ? 56 : e === "Pacifico" ? 44 : 48;
|
|
1405
1405
|
}
|
|
1406
1406
|
function Cr({
|
|
@@ -1412,166 +1412,167 @@ function Cr({
|
|
|
1412
1412
|
showFieldTypeTabs: o = !1,
|
|
1413
1413
|
textPlaceholder: d,
|
|
1414
1414
|
initialFieldValue: u,
|
|
1415
|
-
|
|
1416
|
-
|
|
1415
|
+
targetSize: m,
|
|
1416
|
+
rememberedByType: g,
|
|
1417
|
+
onRememberFill: _
|
|
1417
1418
|
}) {
|
|
1418
|
-
const
|
|
1419
|
-
if (
|
|
1420
|
-
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;
|
|
1421
1422
|
if (!t) return;
|
|
1422
|
-
if (
|
|
1423
|
+
if (C(W), W === "date") {
|
|
1423
1424
|
at(
|
|
1424
|
-
u || ((
|
|
1425
|
+
u || ((U = g == null ? void 0 : g.date) == null ? void 0 : U.value) || (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
|
|
1425
1426
|
);
|
|
1426
1427
|
return;
|
|
1427
1428
|
}
|
|
1428
|
-
if (
|
|
1429
|
-
|
|
1429
|
+
if (W === "text") {
|
|
1430
|
+
pt(u || ((rt = g == null ? void 0 : g.text) == null ? void 0 : rt.value) || "");
|
|
1430
1431
|
return;
|
|
1431
1432
|
}
|
|
1432
|
-
const f =
|
|
1433
|
+
const f = g == null ? void 0 : g.sign;
|
|
1433
1434
|
if (!f) {
|
|
1434
|
-
|
|
1435
|
+
Mt("draw"), Et(""), E(""), ut(!1), tt("signature"), dt("#111827"), ye("dancing-script"), H.current = null, G(!1);
|
|
1435
1436
|
return;
|
|
1436
1437
|
}
|
|
1437
|
-
|
|
1438
|
-
const
|
|
1439
|
-
|
|
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 = {
|
|
1440
1441
|
imageDataUrl: f.imageDataUrl,
|
|
1441
1442
|
width: f.width,
|
|
1442
1443
|
height: f.height
|
|
1443
|
-
},
|
|
1444
|
-
}, [t,
|
|
1445
|
-
if (!t ||
|
|
1446
|
-
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;
|
|
1447
1448
|
if (!f) return;
|
|
1448
|
-
const
|
|
1449
|
-
if (!
|
|
1450
|
-
const
|
|
1451
|
-
if (!(
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1454
|
-
const
|
|
1455
|
-
f.width / Math.max(1,
|
|
1456
|
-
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),
|
|
1457
1458
|
1
|
|
1458
|
-
),
|
|
1459
|
-
|
|
1460
|
-
},
|
|
1461
|
-
}, [t,
|
|
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(() => {
|
|
1462
1463
|
if (!t) return;
|
|
1463
1464
|
let f = !1;
|
|
1464
|
-
return
|
|
1465
|
-
f ||
|
|
1465
|
+
return qt(!1), Ir().then(() => {
|
|
1466
|
+
f || qt(!0);
|
|
1466
1467
|
}), () => {
|
|
1467
1468
|
f = !0;
|
|
1468
1469
|
};
|
|
1469
|
-
}, [t]),
|
|
1470
|
-
const f =
|
|
1471
|
-
|
|
1472
|
-
}, [
|
|
1473
|
-
if (!t ||
|
|
1474
|
-
const f =
|
|
1475
|
-
if (!f || !
|
|
1476
|
-
const
|
|
1477
|
-
|
|
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(() => {
|
|
1474
|
+
if (!t || J !== "type") return;
|
|
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);
|
|
1478
1479
|
}, [
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1480
|
+
yt,
|
|
1481
|
+
gt,
|
|
1482
|
+
J,
|
|
1483
|
+
kt,
|
|
1483
1484
|
t,
|
|
1484
|
-
|
|
1485
|
-
|
|
1485
|
+
$t,
|
|
1486
|
+
Vt
|
|
1486
1487
|
]), !t) return null;
|
|
1487
|
-
const
|
|
1488
|
-
const
|
|
1488
|
+
const it = (f) => {
|
|
1489
|
+
const L = y.current, U = L.getBoundingClientRect();
|
|
1489
1490
|
return {
|
|
1490
|
-
x: (f.clientX -
|
|
1491
|
-
y: (f.clientY -
|
|
1491
|
+
x: (f.clientX - U.left) / U.width * L.width,
|
|
1492
|
+
y: (f.clientY - U.top) / U.height * L.height
|
|
1492
1493
|
};
|
|
1493
|
-
},
|
|
1494
|
-
if (
|
|
1495
|
-
if (
|
|
1496
|
-
|
|
1497
|
-
const
|
|
1498
|
-
|
|
1494
|
+
}, Wt = (f) => {
|
|
1495
|
+
if (J !== "draw") return;
|
|
1496
|
+
if (H.current) {
|
|
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 = [];
|
|
1499
1500
|
}
|
|
1500
1501
|
f.currentTarget.setPointerCapture(f.pointerId), b.current = !0;
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1503
|
-
},
|
|
1504
|
-
if (!b.current ||
|
|
1505
|
-
const
|
|
1506
|
-
if (!
|
|
1507
|
-
const
|
|
1508
|
-
|
|
1509
|
-
},
|
|
1510
|
-
|
|
1511
|
-
},
|
|
1512
|
-
const f =
|
|
1513
|
-
!f || !
|
|
1514
|
-
},
|
|
1515
|
-
|
|
1516
|
-
},
|
|
1517
|
-
if (
|
|
1518
|
-
const
|
|
1519
|
-
if (
|
|
1520
|
-
if (!
|
|
1521
|
-
|
|
1502
|
+
const L = it(f);
|
|
1503
|
+
x.current = L, S.current = [L];
|
|
1504
|
+
}, st = (f) => {
|
|
1505
|
+
if (!b.current || J !== "draw") return;
|
|
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 = () => {
|
|
1518
|
+
if (J === "draw") {
|
|
1519
|
+
const X = I.current, et = H.current;
|
|
1520
|
+
if (X.length === 0) {
|
|
1521
|
+
if (!et) return;
|
|
1522
|
+
_ == null || _("sign", {
|
|
1522
1523
|
mode: "draw",
|
|
1523
|
-
imageDataUrl:
|
|
1524
|
-
width:
|
|
1525
|
-
height:
|
|
1526
|
-
inkColor:
|
|
1527
|
-
}), n(
|
|
1524
|
+
imageDataUrl: et.imageDataUrl,
|
|
1525
|
+
width: et.width,
|
|
1526
|
+
height: et.height,
|
|
1527
|
+
inkColor: kt
|
|
1528
|
+
}), n(et.imageDataUrl, et.width, et.height);
|
|
1528
1529
|
return;
|
|
1529
1530
|
}
|
|
1530
|
-
let
|
|
1531
|
-
for (const
|
|
1532
|
-
for (const
|
|
1533
|
-
|
|
1534
|
-
const
|
|
1535
|
-
|
|
1536
|
-
const
|
|
1537
|
-
|
|
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)}`;
|
|
1538
|
+
_ == null || _("sign", {
|
|
1538
1539
|
mode: "draw",
|
|
1539
|
-
imageDataUrl:
|
|
1540
|
-
width:
|
|
1541
|
-
height:
|
|
1542
|
-
inkColor:
|
|
1543
|
-
}), n(
|
|
1540
|
+
imageDataUrl: he,
|
|
1541
|
+
width: Ut,
|
|
1542
|
+
height: Yt,
|
|
1543
|
+
inkColor: kt
|
|
1544
|
+
}), n(he, Ut, Yt);
|
|
1544
1545
|
return;
|
|
1545
1546
|
}
|
|
1546
|
-
if (
|
|
1547
|
-
const f = 3,
|
|
1548
|
-
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1551
|
-
const
|
|
1552
|
-
|
|
1553
|
-
const
|
|
1554
|
-
|
|
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)}`;
|
|
1555
|
+
_ == null || _("sign", {
|
|
1555
1556
|
mode: "type",
|
|
1556
|
-
imageDataUrl:
|
|
1557
|
-
width:
|
|
1558
|
-
height:
|
|
1559
|
-
typedName:
|
|
1560
|
-
typedInitials:
|
|
1561
|
-
fontId:
|
|
1562
|
-
inkColor:
|
|
1563
|
-
typeKind:
|
|
1564
|
-
}), n(
|
|
1565
|
-
},
|
|
1566
|
-
if (
|
|
1567
|
-
const f =
|
|
1568
|
-
f && (
|
|
1569
|
-
},
|
|
1570
|
-
return /* @__PURE__ */
|
|
1557
|
+
imageDataUrl: lt,
|
|
1558
|
+
width: w,
|
|
1559
|
+
height: v,
|
|
1560
|
+
typedName: K,
|
|
1561
|
+
typedInitials: vt,
|
|
1562
|
+
fontId: te,
|
|
1563
|
+
inkColor: kt,
|
|
1564
|
+
typeKind: gt
|
|
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";
|
|
1571
|
+
return /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal", role: "dialog", "aria-modal": "true", children: [
|
|
1571
1572
|
/* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__modal-backdrop", onClick: e }),
|
|
1572
|
-
/* @__PURE__ */
|
|
1573
|
-
/* @__PURE__ */
|
|
1574
|
-
/* @__PURE__ */ s("h3", { children:
|
|
1573
|
+
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal-card", children: [
|
|
1574
|
+
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal-header", children: [
|
|
1575
|
+
/* @__PURE__ */ s("h3", { children: A === "date" ? "Pick a date" : A === "text" ? "Enter text" : "Create e-signature" }),
|
|
1575
1576
|
/* @__PURE__ */ s(
|
|
1576
1577
|
"button",
|
|
1577
1578
|
{
|
|
@@ -1588,22 +1589,22 @@ function Cr({
|
|
|
1588
1589
|
{
|
|
1589
1590
|
type: "button",
|
|
1590
1591
|
role: "tab",
|
|
1591
|
-
"aria-selected":
|
|
1592
|
-
className:
|
|
1593
|
-
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),
|
|
1594
1595
|
children: f === "sign" ? "Sign" : f === "date" ? "Date" : "Text"
|
|
1595
1596
|
},
|
|
1596
1597
|
f
|
|
1597
1598
|
)) }) : null,
|
|
1598
|
-
|
|
1599
|
-
/* @__PURE__ */
|
|
1599
|
+
Nt ? /* @__PURE__ */ T(je, { children: [
|
|
1600
|
+
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__sign-modes", children: [
|
|
1600
1601
|
/* @__PURE__ */ s(
|
|
1601
1602
|
"button",
|
|
1602
1603
|
{
|
|
1603
1604
|
type: "button",
|
|
1604
|
-
className:
|
|
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",
|
|
1605
1606
|
onClick: () => {
|
|
1606
|
-
|
|
1607
|
+
Mt("draw"), It();
|
|
1607
1608
|
},
|
|
1608
1609
|
children: "Draw"
|
|
1609
1610
|
}
|
|
@@ -1612,81 +1613,81 @@ function Cr({
|
|
|
1612
1613
|
"button",
|
|
1613
1614
|
{
|
|
1614
1615
|
type: "button",
|
|
1615
|
-
className:
|
|
1616
|
-
onClick: () =>
|
|
1616
|
+
className: J === "type" ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
|
|
1617
|
+
onClick: () => Mt("type"),
|
|
1617
1618
|
children: "Type"
|
|
1618
1619
|
}
|
|
1619
1620
|
),
|
|
1620
|
-
/* @__PURE__ */
|
|
1621
|
+
/* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-ink", children: [
|
|
1621
1622
|
"Ink",
|
|
1622
1623
|
/* @__PURE__ */ s(
|
|
1623
1624
|
"input",
|
|
1624
1625
|
{
|
|
1625
1626
|
type: "color",
|
|
1626
|
-
value:
|
|
1627
|
-
onChange: (f) =>
|
|
1627
|
+
value: kt,
|
|
1628
|
+
onChange: (f) => dt(f.target.value)
|
|
1628
1629
|
}
|
|
1629
1630
|
)
|
|
1630
1631
|
] })
|
|
1631
1632
|
] }),
|
|
1632
|
-
|
|
1633
|
+
J === "type" ? /* @__PURE__ */ T(je, { children: [
|
|
1633
1634
|
/* @__PURE__ */ s(
|
|
1634
1635
|
"div",
|
|
1635
1636
|
{
|
|
1636
1637
|
className: "epochs-pdf-viewer__sign-fonts",
|
|
1637
1638
|
role: "group",
|
|
1638
1639
|
"aria-label": "Handwriting style",
|
|
1639
|
-
children:
|
|
1640
|
+
children: Ue.map((f) => /* @__PURE__ */ s(
|
|
1640
1641
|
"button",
|
|
1641
1642
|
{
|
|
1642
1643
|
type: "button",
|
|
1643
|
-
className:
|
|
1644
|
+
className: te === f.id ? "epochs-pdf-viewer__sign-font epochs-pdf-viewer__sign-font--active" : "epochs-pdf-viewer__sign-font",
|
|
1644
1645
|
style: { fontFamily: `"${f.family}", cursive` },
|
|
1645
|
-
onClick: () =>
|
|
1646
|
+
onClick: () => ye(f.id),
|
|
1646
1647
|
title: f.label,
|
|
1647
|
-
children:
|
|
1648
|
+
children: bt
|
|
1648
1649
|
},
|
|
1649
1650
|
f.id
|
|
1650
1651
|
))
|
|
1651
1652
|
}
|
|
1652
1653
|
),
|
|
1653
|
-
/* @__PURE__ */
|
|
1654
|
-
/* @__PURE__ */
|
|
1654
|
+
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__sign-type-fields", children: [
|
|
1655
|
+
/* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-type-field", children: [
|
|
1655
1656
|
/* @__PURE__ */ s("span", { children: "Full name" }),
|
|
1656
1657
|
/* @__PURE__ */ s(
|
|
1657
1658
|
"input",
|
|
1658
1659
|
{
|
|
1659
1660
|
className: "epochs-pdf-viewer__sign-type-input",
|
|
1660
1661
|
type: "text",
|
|
1661
|
-
value:
|
|
1662
|
-
onChange: (f) =>
|
|
1663
|
-
onFocus: () =>
|
|
1662
|
+
value: K,
|
|
1663
|
+
onChange: (f) => ee(f.target.value),
|
|
1664
|
+
onFocus: () => tt("signature"),
|
|
1664
1665
|
placeholder: "Type your full name",
|
|
1665
|
-
style: { fontFamily: `"${
|
|
1666
|
+
style: { fontFamily: `"${$t.family}", cursive` },
|
|
1666
1667
|
autoFocus: !0
|
|
1667
1668
|
}
|
|
1668
1669
|
)
|
|
1669
1670
|
] }),
|
|
1670
|
-
/* @__PURE__ */
|
|
1671
|
+
/* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-type-field", children: [
|
|
1671
1672
|
/* @__PURE__ */ s("span", { children: "Initials" }),
|
|
1672
1673
|
/* @__PURE__ */ s(
|
|
1673
1674
|
"input",
|
|
1674
1675
|
{
|
|
1675
1676
|
className: "epochs-pdf-viewer__sign-type-input",
|
|
1676
1677
|
type: "text",
|
|
1677
|
-
value:
|
|
1678
|
+
value: vt,
|
|
1678
1679
|
onChange: (f) => {
|
|
1679
|
-
|
|
1680
|
+
ut(!0), E(f.target.value.toUpperCase());
|
|
1680
1681
|
},
|
|
1681
|
-
onFocus: () =>
|
|
1682
|
+
onFocus: () => tt("initials"),
|
|
1682
1683
|
placeholder: "e.g. JD",
|
|
1683
1684
|
maxLength: 4,
|
|
1684
|
-
style: { fontFamily: `"${
|
|
1685
|
+
style: { fontFamily: `"${$t.family}", cursive` }
|
|
1685
1686
|
}
|
|
1686
1687
|
)
|
|
1687
1688
|
] })
|
|
1688
1689
|
] }),
|
|
1689
|
-
/* @__PURE__ */
|
|
1690
|
+
/* @__PURE__ */ T(
|
|
1690
1691
|
"div",
|
|
1691
1692
|
{
|
|
1692
1693
|
className: "epochs-pdf-viewer__sign-type-kind",
|
|
@@ -1697,8 +1698,8 @@ function Cr({
|
|
|
1697
1698
|
"button",
|
|
1698
1699
|
{
|
|
1699
1700
|
type: "button",
|
|
1700
|
-
className:
|
|
1701
|
-
onClick: () =>
|
|
1701
|
+
className: gt === "signature" ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
|
|
1702
|
+
onClick: () => tt("signature"),
|
|
1702
1703
|
children: "Use full name"
|
|
1703
1704
|
}
|
|
1704
1705
|
),
|
|
@@ -1706,59 +1707,59 @@ function Cr({
|
|
|
1706
1707
|
"button",
|
|
1707
1708
|
{
|
|
1708
1709
|
type: "button",
|
|
1709
|
-
className:
|
|
1710
|
-
onClick: () =>
|
|
1710
|
+
className: gt === "initials" ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
|
|
1711
|
+
onClick: () => tt("initials"),
|
|
1711
1712
|
children: "Use initials"
|
|
1712
1713
|
}
|
|
1713
1714
|
)
|
|
1714
1715
|
]
|
|
1715
1716
|
}
|
|
1716
1717
|
)
|
|
1717
|
-
] }) : /* @__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" }),
|
|
1718
1719
|
/* @__PURE__ */ s(
|
|
1719
1720
|
"canvas",
|
|
1720
1721
|
{
|
|
1721
|
-
ref:
|
|
1722
|
-
className:
|
|
1723
|
-
onPointerDown:
|
|
1724
|
-
onPointerMove:
|
|
1725
|
-
onPointerUp:
|
|
1726
|
-
onPointerLeave:
|
|
1722
|
+
ref: y,
|
|
1723
|
+
className: J === "draw" ? "epochs-pdf-viewer__sign-canvas" : "epochs-pdf-viewer__sign-canvas epochs-pdf-viewer__sign-canvas--preview",
|
|
1724
|
+
onPointerDown: Wt,
|
|
1725
|
+
onPointerMove: st,
|
|
1726
|
+
onPointerUp: mt,
|
|
1727
|
+
onPointerLeave: mt
|
|
1727
1728
|
}
|
|
1728
1729
|
)
|
|
1729
|
-
] }) :
|
|
1730
|
+
] }) : A === "date" ? /* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-type-field", style: { padding: "1rem" }, children: [
|
|
1730
1731
|
/* @__PURE__ */ s("span", { children: "Date" }),
|
|
1731
1732
|
/* @__PURE__ */ s(
|
|
1732
1733
|
"input",
|
|
1733
1734
|
{
|
|
1734
1735
|
className: "epochs-pdf-viewer__sign-type-input",
|
|
1735
1736
|
type: "date",
|
|
1736
|
-
value:
|
|
1737
|
+
value: nt,
|
|
1737
1738
|
onChange: (f) => at(f.target.value),
|
|
1738
1739
|
autoFocus: !0
|
|
1739
1740
|
}
|
|
1740
1741
|
)
|
|
1741
|
-
] }) : /* @__PURE__ */
|
|
1742
|
+
] }) : /* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-type-field", style: { padding: "1rem" }, children: [
|
|
1742
1743
|
/* @__PURE__ */ s("span", { children: "Text" }),
|
|
1743
1744
|
/* @__PURE__ */ s(
|
|
1744
1745
|
"input",
|
|
1745
1746
|
{
|
|
1746
1747
|
className: "epochs-pdf-viewer__sign-type-input",
|
|
1747
1748
|
type: "text",
|
|
1748
|
-
value:
|
|
1749
|
-
onChange: (f) =>
|
|
1749
|
+
value: q,
|
|
1750
|
+
onChange: (f) => pt(f.target.value),
|
|
1750
1751
|
placeholder: d ?? "Enter text",
|
|
1751
1752
|
autoFocus: !0
|
|
1752
1753
|
}
|
|
1753
1754
|
)
|
|
1754
1755
|
] }),
|
|
1755
|
-
/* @__PURE__ */
|
|
1756
|
-
|
|
1756
|
+
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal-actions", children: [
|
|
1757
|
+
Nt ? /* @__PURE__ */ s(
|
|
1757
1758
|
"button",
|
|
1758
1759
|
{
|
|
1759
1760
|
type: "button",
|
|
1760
1761
|
className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
|
|
1761
|
-
onClick:
|
|
1762
|
+
onClick: It,
|
|
1762
1763
|
children: "Clear"
|
|
1763
1764
|
}
|
|
1764
1765
|
) : null,
|
|
@@ -1776,9 +1777,9 @@ function Cr({
|
|
|
1776
1777
|
{
|
|
1777
1778
|
type: "button",
|
|
1778
1779
|
className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--primary",
|
|
1779
|
-
onClick:
|
|
1780
|
-
disabled:
|
|
1781
|
-
children:
|
|
1780
|
+
onClick: Nt ? ht : ne,
|
|
1781
|
+
disabled: A === "date" ? !nt : A === "text" ? !q.trim() : !1,
|
|
1782
|
+
children: Nt ? "Use signature" : "Place on page"
|
|
1782
1783
|
}
|
|
1783
1784
|
)
|
|
1784
1785
|
] })
|
|
@@ -1792,50 +1793,50 @@ function Tr(t) {
|
|
|
1792
1793
|
return ((i = n[0]) == null ? void 0 : i.toUpperCase()) ?? "";
|
|
1793
1794
|
}).join("");
|
|
1794
1795
|
}
|
|
1795
|
-
const
|
|
1796
|
-
function
|
|
1796
|
+
const Xe = "__epochsToolbarToolId";
|
|
1797
|
+
function zt(t, e) {
|
|
1797
1798
|
const n = (() => null);
|
|
1798
|
-
return n.displayName = e, Object.defineProperty(n,
|
|
1799
|
+
return n.displayName = e, Object.defineProperty(n, Xe, {
|
|
1799
1800
|
value: t,
|
|
1800
1801
|
enumerable: !0
|
|
1801
1802
|
}), n;
|
|
1802
1803
|
}
|
|
1803
|
-
function
|
|
1804
|
-
return t[
|
|
1804
|
+
function Ln(t) {
|
|
1805
|
+
return t[Xe];
|
|
1805
1806
|
}
|
|
1806
1807
|
function Dr(t) {
|
|
1807
|
-
return typeof t == "function" &&
|
|
1808
|
+
return typeof t == "function" && Xe in t && typeof t[Xe] == "string";
|
|
1808
1809
|
}
|
|
1809
|
-
const
|
|
1810
|
-
|
|
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 = [
|
|
1811
|
+
zn,
|
|
1811
1812
|
Sn,
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
qn,
|
|
1815
|
-
Yn,
|
|
1816
|
-
Kn,
|
|
1813
|
+
Gn,
|
|
1814
|
+
Xn,
|
|
1817
1815
|
Zn,
|
|
1818
1816
|
Qn,
|
|
1819
1817
|
Jn,
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
Vn
|
|
1824
|
-
|
|
1825
|
-
|
|
1818
|
+
ti,
|
|
1819
|
+
ei,
|
|
1820
|
+
ni,
|
|
1821
|
+
Vn,
|
|
1822
|
+
qn,
|
|
1823
|
+
Yn,
|
|
1824
|
+
Kn
|
|
1825
|
+
], Fn = [
|
|
1826
|
+
[zn, Sn],
|
|
1826
1827
|
[
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
qn,
|
|
1830
|
-
Yn,
|
|
1831
|
-
Kn,
|
|
1828
|
+
Gn,
|
|
1829
|
+
Xn,
|
|
1832
1830
|
Zn,
|
|
1833
1831
|
Qn,
|
|
1834
1832
|
Jn,
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
Vn
|
|
1833
|
+
ti,
|
|
1834
|
+
ei,
|
|
1835
|
+
ni,
|
|
1836
|
+
Vn,
|
|
1837
|
+
qn,
|
|
1838
|
+
Yn,
|
|
1839
|
+
Kn
|
|
1839
1840
|
]
|
|
1840
1841
|
], Lr = [
|
|
1841
1842
|
"highlight",
|
|
@@ -1845,7 +1846,7 @@ const jn = St("thumbnail", "Thumbnail"), Sn = St("navigation", "Navigation"), Bn
|
|
|
1845
1846
|
"erase",
|
|
1846
1847
|
"clear"
|
|
1847
1848
|
];
|
|
1848
|
-
function
|
|
1849
|
+
function Rn(t) {
|
|
1849
1850
|
return Lr.includes(t);
|
|
1850
1851
|
}
|
|
1851
1852
|
function Fr(t, e, n) {
|
|
@@ -1889,7 +1890,7 @@ function Fr(t, e, n) {
|
|
|
1889
1890
|
},
|
|
1890
1891
|
"nav-prev"
|
|
1891
1892
|
),
|
|
1892
|
-
/* @__PURE__ */
|
|
1893
|
+
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__page-input", children: [
|
|
1893
1894
|
/* @__PURE__ */ s(
|
|
1894
1895
|
"input",
|
|
1895
1896
|
{
|
|
@@ -1907,7 +1908,7 @@ function Fr(t, e, n) {
|
|
|
1907
1908
|
"aria-label": "Page number"
|
|
1908
1909
|
}
|
|
1909
1910
|
),
|
|
1910
|
-
/* @__PURE__ */
|
|
1911
|
+
/* @__PURE__ */ T("span", { children: [
|
|
1911
1912
|
"/ ",
|
|
1912
1913
|
e.numPages || "-"
|
|
1913
1914
|
] })
|
|
@@ -1940,7 +1941,7 @@ function Fr(t, e, n) {
|
|
|
1940
1941
|
},
|
|
1941
1942
|
"zoom-out"
|
|
1942
1943
|
),
|
|
1943
|
-
/* @__PURE__ */
|
|
1944
|
+
/* @__PURE__ */ T("span", { className: "epochs-pdf-viewer__zoom-label", children: [
|
|
1944
1945
|
Math.round(e.scale * 100),
|
|
1945
1946
|
"%"
|
|
1946
1947
|
] }, "zoom-label"),
|
|
@@ -2163,9 +2164,9 @@ function Rr(t, e) {
|
|
|
2163
2164
|
), t.markupTool === "erase" && e.has("erase") && n.push(
|
|
2164
2165
|
/* @__PURE__ */ s("span", { className: "epochs-pdf-viewer__markup-hint", children: "Select PDF words to remove · click added text/markup to erase" }, "erase-hint")
|
|
2165
2166
|
), t.markupTool === "highlight" && e.has("highlight") || t.markupTool === "underline" && e.has("underline")) {
|
|
2166
|
-
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;
|
|
2167
2168
|
n.push(
|
|
2168
|
-
/* @__PURE__ */
|
|
2169
|
+
/* @__PURE__ */ T(
|
|
2169
2170
|
"div",
|
|
2170
2171
|
{
|
|
2171
2172
|
className: "epochs-pdf-viewer__color-picker",
|
|
@@ -2176,16 +2177,16 @@ function Rr(t, e) {
|
|
|
2176
2177
|
"button",
|
|
2177
2178
|
{
|
|
2178
2179
|
type: "button",
|
|
2179
|
-
className:
|
|
2180
|
+
className: le(i) === le(d.hex) ? "epochs-pdf-viewer__swatch epochs-pdf-viewer__swatch--active" : "epochs-pdf-viewer__swatch",
|
|
2180
2181
|
style: { background: d.hex },
|
|
2181
2182
|
title: d.label,
|
|
2182
2183
|
"aria-label": d.label,
|
|
2183
|
-
"aria-pressed":
|
|
2184
|
-
onClick: () => r(
|
|
2184
|
+
"aria-pressed": le(i) === le(d.hex),
|
|
2185
|
+
onClick: () => r(le(d.hex))
|
|
2185
2186
|
},
|
|
2186
2187
|
d.id
|
|
2187
2188
|
)),
|
|
2188
|
-
/* @__PURE__ */
|
|
2189
|
+
/* @__PURE__ */ T(
|
|
2189
2190
|
"label",
|
|
2190
2191
|
{
|
|
2191
2192
|
className: "epochs-pdf-viewer__custom-color",
|
|
@@ -2202,8 +2203,8 @@ function Rr(t, e) {
|
|
|
2202
2203
|
"input",
|
|
2203
2204
|
{
|
|
2204
2205
|
type: "color",
|
|
2205
|
-
value:
|
|
2206
|
-
onChange: (d) => r(
|
|
2206
|
+
value: le(i),
|
|
2207
|
+
onChange: (d) => r(le(d.target.value)),
|
|
2207
2208
|
"aria-label": "Custom color"
|
|
2208
2209
|
}
|
|
2209
2210
|
)
|
|
@@ -2221,13 +2222,13 @@ function Rr(t, e) {
|
|
|
2221
2222
|
function Ar(t, e) {
|
|
2222
2223
|
if (!t) return null;
|
|
2223
2224
|
if (Array.isArray(t)) {
|
|
2224
|
-
const o = (d) => (d ?? []).filter(Dr).map(
|
|
2225
|
+
const o = (d) => (d ?? []).filter(Dr).map(Ln);
|
|
2225
2226
|
return {
|
|
2226
2227
|
left: o(t[0]),
|
|
2227
2228
|
right: o(t[1])
|
|
2228
2229
|
};
|
|
2229
2230
|
}
|
|
2230
|
-
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 = {
|
|
2231
2232
|
thumbnail: n,
|
|
2232
2233
|
navigation: e.enableNavigation,
|
|
2233
2234
|
zoom: e.enableZoom,
|
|
@@ -2244,8 +2245,8 @@ function Ar(t, e) {
|
|
|
2244
2245
|
clear: e.enableClear
|
|
2245
2246
|
};
|
|
2246
2247
|
return {
|
|
2247
|
-
left: i(
|
|
2248
|
-
right: i(
|
|
2248
|
+
left: i(Fn[0], r),
|
|
2249
|
+
right: i(Fn[1], r)
|
|
2249
2250
|
};
|
|
2250
2251
|
}
|
|
2251
2252
|
function oo({
|
|
@@ -2260,76 +2261,76 @@ function oo({
|
|
|
2260
2261
|
thumbnailWidth: m = 140,
|
|
2261
2262
|
maxThumbnails: g = 60,
|
|
2262
2263
|
className: _,
|
|
2263
|
-
workerSrc:
|
|
2264
|
-
enableToolbar:
|
|
2265
|
-
enableThumbnails:
|
|
2266
|
-
enableNavigation:
|
|
2264
|
+
workerSrc: y,
|
|
2265
|
+
enableToolbar: b = !1,
|
|
2266
|
+
enableThumbnails: x,
|
|
2267
|
+
enableNavigation: I = !0,
|
|
2267
2268
|
enableZoom: S = !0,
|
|
2268
2269
|
enableRotate: H = !0,
|
|
2269
|
-
enableReload:
|
|
2270
|
-
enablePrint:
|
|
2271
|
-
enableOpen:
|
|
2272
|
-
enableDownload:
|
|
2273
|
-
enableMarkup:
|
|
2274
|
-
enableHighlight:
|
|
2275
|
-
enableUnderline:
|
|
2276
|
-
enableSignature:
|
|
2270
|
+
enableReload: W = !0,
|
|
2271
|
+
enablePrint: A = !0,
|
|
2272
|
+
enableOpen: C = !0,
|
|
2273
|
+
enableDownload: nt = !0,
|
|
2274
|
+
enableMarkup: at = !0,
|
|
2275
|
+
enableHighlight: q = !0,
|
|
2276
|
+
enableUnderline: pt = !0,
|
|
2277
|
+
enableSignature: J = !0,
|
|
2277
2278
|
enableText: Mt = !0,
|
|
2278
|
-
enableErase:
|
|
2279
|
-
enableClear:
|
|
2280
|
-
signatureFields:
|
|
2281
|
-
textFields:
|
|
2282
|
-
onSignatureComplete:
|
|
2283
|
-
onSignatureFieldsChange:
|
|
2284
|
-
applySignatureToSameTag:
|
|
2285
|
-
onFieldValueComplete:
|
|
2286
|
-
openSignaturePad:
|
|
2287
|
-
onSignaturePadClose:
|
|
2288
|
-
onSubmit:
|
|
2289
|
-
submitLabel:
|
|
2290
|
-
submitLoading:
|
|
2279
|
+
enableErase: K = !0,
|
|
2280
|
+
enableClear: Et = !0,
|
|
2281
|
+
signatureFields: vt = [],
|
|
2282
|
+
textFields: E = [],
|
|
2283
|
+
onSignatureComplete: ct,
|
|
2284
|
+
onSignatureFieldsChange: ut,
|
|
2285
|
+
applySignatureToSameTag: gt = !1,
|
|
2286
|
+
onFieldValueComplete: tt,
|
|
2287
|
+
openSignaturePad: kt = !1,
|
|
2288
|
+
onSignaturePadClose: dt,
|
|
2289
|
+
onSubmit: te,
|
|
2290
|
+
submitLabel: ye = "Submit",
|
|
2291
|
+
submitLoading: Vt = !1
|
|
2291
2292
|
}) {
|
|
2292
|
-
var
|
|
2293
|
-
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(
|
|
2294
2295
|
null
|
|
2295
|
-
), [
|
|
2296
|
+
), [_t, Ut] = O(
|
|
2296
2297
|
null
|
|
2297
|
-
), [
|
|
2298
|
-
|
|
2299
|
-
|
|
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) => {
|
|
2300
2301
|
const h = { ...c };
|
|
2301
|
-
for (const l of
|
|
2302
|
+
for (const l of vt) {
|
|
2302
2303
|
const p = l.type ?? "sign";
|
|
2303
2304
|
(p === "date" || p === "text") && l.value != null && l.value !== "" && (h[l.id] = l.value);
|
|
2304
2305
|
}
|
|
2305
2306
|
return h;
|
|
2306
2307
|
});
|
|
2307
|
-
}, [
|
|
2308
|
-
const
|
|
2308
|
+
}, [vt]);
|
|
2309
|
+
const jt = B.length > 0, De = Y(
|
|
2309
2310
|
(c, h, l) => {
|
|
2310
2311
|
var k;
|
|
2311
2312
|
const p = c.type ?? "sign";
|
|
2312
|
-
return p === "date" || p === "text" ? !!((k = l[c.id] ?? c.value) != null && k.trim()) : h.some((
|
|
2313
|
+
return p === "date" || p === "text" ? !!((k = l[c.id] ?? c.value) != null && k.trim()) : h.some(($) => $.fieldId === c.id) || !!c.signatureDataUrl;
|
|
2313
2314
|
},
|
|
2314
2315
|
[]
|
|
2315
|
-
),
|
|
2316
|
+
), pn = Y(
|
|
2316
2317
|
(c, h) => {
|
|
2317
|
-
const l = new Set(c), k =
|
|
2318
|
-
(
|
|
2318
|
+
const l = new Set(c), k = ve.current.map(
|
|
2319
|
+
($) => l.has($.id) ? { ...$, value: h } : $
|
|
2319
2320
|
);
|
|
2320
|
-
|
|
2321
|
-
const
|
|
2322
|
-
for (const
|
|
2323
|
-
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;
|
|
2324
2325
|
});
|
|
2325
|
-
for (const
|
|
2326
|
-
|
|
2326
|
+
for (const $ of c)
|
|
2327
|
+
tt == null || tt($, h);
|
|
2327
2328
|
},
|
|
2328
|
-
[
|
|
2329
|
-
),
|
|
2329
|
+
[tt, ut]
|
|
2330
|
+
), Le = Y(
|
|
2330
2331
|
(c, h, l) => {
|
|
2331
|
-
const p =
|
|
2332
|
-
(
|
|
2332
|
+
const p = ve.current, k = c == null ? null : Array.isArray(c) ? c : [c], $ = k ? new Set(k) : null, z = $ ? p.map(
|
|
2333
|
+
(ot) => $.has(ot.id) ? { ...ot, signatureDataUrl: h.imageDataUrl } : ot
|
|
2333
2334
|
) : [
|
|
2334
2335
|
...p,
|
|
2335
2336
|
{
|
|
@@ -2343,122 +2344,122 @@ function oo({
|
|
|
2343
2344
|
signatureDataUrl: h.imageDataUrl
|
|
2344
2345
|
}
|
|
2345
2346
|
];
|
|
2346
|
-
if (
|
|
2347
|
-
|
|
2347
|
+
if (ve.current = z, Ke(z), ut == null || ut(z), !k || k.length === 0) {
|
|
2348
|
+
ct == null || ct(void 0, h);
|
|
2348
2349
|
return;
|
|
2349
2350
|
}
|
|
2350
|
-
for (const
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
(l == null ? void 0 : l.get(
|
|
2351
|
+
for (const ot of k)
|
|
2352
|
+
ct == null || ct(
|
|
2353
|
+
ot,
|
|
2354
|
+
(l == null ? void 0 : l.get(ot)) ?? h
|
|
2354
2355
|
);
|
|
2355
2356
|
},
|
|
2356
|
-
[
|
|
2357
|
+
[ct, ut]
|
|
2357
2358
|
);
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
}, [
|
|
2361
|
-
const
|
|
2362
|
-
() => Ar(
|
|
2363
|
-
enableThumbnails:
|
|
2364
|
-
enableNavigation:
|
|
2359
|
+
Dt(() => {
|
|
2360
|
+
kt && X(!0);
|
|
2361
|
+
}, [kt]);
|
|
2362
|
+
const ue = Pe(
|
|
2363
|
+
() => Ar(b, {
|
|
2364
|
+
enableThumbnails: x,
|
|
2365
|
+
enableNavigation: I,
|
|
2365
2366
|
enableZoom: S,
|
|
2366
2367
|
enableRotate: H,
|
|
2367
|
-
enableReload:
|
|
2368
|
-
enablePrint:
|
|
2369
|
-
enableOpen:
|
|
2370
|
-
enableDownload:
|
|
2371
|
-
enableHighlight:
|
|
2372
|
-
enableUnderline:
|
|
2373
|
-
enableSignature:
|
|
2368
|
+
enableReload: W,
|
|
2369
|
+
enablePrint: A,
|
|
2370
|
+
enableOpen: C,
|
|
2371
|
+
enableDownload: nt,
|
|
2372
|
+
enableHighlight: q,
|
|
2373
|
+
enableUnderline: pt,
|
|
2374
|
+
enableSignature: J,
|
|
2374
2375
|
enableText: Mt,
|
|
2375
|
-
enableErase:
|
|
2376
|
-
enableClear:
|
|
2376
|
+
enableErase: K,
|
|
2377
|
+
enableClear: Et
|
|
2377
2378
|
}),
|
|
2378
2379
|
[
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2380
|
+
b,
|
|
2381
|
+
x,
|
|
2382
|
+
I,
|
|
2382
2383
|
S,
|
|
2383
2384
|
H,
|
|
2384
|
-
|
|
2385
|
+
W,
|
|
2386
|
+
A,
|
|
2387
|
+
C,
|
|
2388
|
+
nt,
|
|
2389
|
+
q,
|
|
2390
|
+
pt,
|
|
2385
2391
|
J,
|
|
2386
|
-
T,
|
|
2387
|
-
at,
|
|
2388
|
-
Z,
|
|
2389
|
-
tt,
|
|
2390
|
-
bt,
|
|
2391
2392
|
Mt,
|
|
2392
|
-
|
|
2393
|
-
|
|
2393
|
+
K,
|
|
2394
|
+
Et
|
|
2394
2395
|
]
|
|
2395
|
-
),
|
|
2396
|
-
|
|
2397
|
-
if (!
|
|
2398
|
-
|
|
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);
|
|
2399
2400
|
return;
|
|
2400
2401
|
}
|
|
2401
2402
|
const h = window.matchMedia("(max-width: 720px)"), l = () => {
|
|
2402
|
-
|
|
2403
|
+
Zt(h.matches ? !1 : u);
|
|
2403
2404
|
};
|
|
2404
2405
|
return l(), h.addEventListener("change", l), () => h.removeEventListener("change", l);
|
|
2405
|
-
}, [
|
|
2406
|
-
const
|
|
2407
|
-
|
|
2408
|
-
}, []),
|
|
2409
|
-
if (!(!
|
|
2410
|
-
vr(
|
|
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");
|
|
2411
2412
|
try {
|
|
2412
|
-
const c =
|
|
2413
|
-
|
|
2414
|
-
const k = await
|
|
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({
|
|
2415
2416
|
data: c,
|
|
2416
|
-
cMapUrl: `https://unpkg.com/pdfjs-dist@${
|
|
2417
|
+
cMapUrl: `https://unpkg.com/pdfjs-dist@${Ie.version}/cmaps/`,
|
|
2417
2418
|
cMapPacked: !0,
|
|
2418
|
-
standardFontDataUrl: `https://unpkg.com/pdfjs-dist@${
|
|
2419
|
+
standardFontDataUrl: `https://unpkg.com/pdfjs-dist@${Ie.version}/standard_fonts/`
|
|
2419
2420
|
}).promise;
|
|
2420
|
-
|
|
2421
|
+
mt(k), ee(k.numPages), Wt("ready");
|
|
2421
2422
|
} catch {
|
|
2422
|
-
|
|
2423
|
+
Wt("error");
|
|
2423
2424
|
}
|
|
2424
2425
|
}
|
|
2425
2426
|
}, [
|
|
2426
|
-
|
|
2427
|
-
|
|
2427
|
+
yt,
|
|
2428
|
+
bt,
|
|
2428
2429
|
i,
|
|
2429
|
-
|
|
2430
|
-
|
|
2430
|
+
Fe,
|
|
2431
|
+
y
|
|
2431
2432
|
]);
|
|
2432
|
-
|
|
2433
|
-
if (!
|
|
2434
|
-
|
|
2433
|
+
Dt(() => {
|
|
2434
|
+
if (!yt && !bt) {
|
|
2435
|
+
Wt("idle"), mt(null), ee(0), rt(null), Fe();
|
|
2435
2436
|
return;
|
|
2436
2437
|
}
|
|
2437
|
-
return
|
|
2438
|
-
|
|
2438
|
+
return Qe(), () => {
|
|
2439
|
+
Fe();
|
|
2439
2440
|
};
|
|
2440
|
-
}, [
|
|
2441
|
-
(
|
|
2442
|
-
}, [
|
|
2443
|
-
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(
|
|
2444
2445
|
(c) => {
|
|
2445
|
-
const h = Math.max(1, Math.min(It || 1, c)), l =
|
|
2446
|
+
const h = Math.max(1, Math.min(It || 1, c)), l = G.current.get(h);
|
|
2446
2447
|
if (!l) {
|
|
2447
|
-
|
|
2448
|
+
ne(h);
|
|
2448
2449
|
return;
|
|
2449
2450
|
}
|
|
2450
|
-
$t.current = !0, l.scrollIntoView({ behavior: "smooth", block: "start" }),
|
|
2451
|
+
$t.current = !0, l.scrollIntoView({ behavior: "smooth", block: "start" }), ne(h), window.setTimeout(() => {
|
|
2451
2452
|
$t.current = !1;
|
|
2452
2453
|
}, 500);
|
|
2453
2454
|
},
|
|
2454
2455
|
[It]
|
|
2455
|
-
),
|
|
2456
|
+
), Me = Y(
|
|
2456
2457
|
(c) => {
|
|
2457
|
-
const h =
|
|
2458
|
-
h && ($t.current = !0,
|
|
2458
|
+
const h = G.current.get(c.pageNumber);
|
|
2459
|
+
h && ($t.current = !0, ne(c.pageNumber));
|
|
2459
2460
|
const l = () => {
|
|
2460
2461
|
var k;
|
|
2461
|
-
const p = (k =
|
|
2462
|
+
const p = (k = qt.current) == null ? void 0 : k.querySelector(
|
|
2462
2463
|
`[data-signature-field-id="${CSS.escape(c.id)}"]`
|
|
2463
2464
|
);
|
|
2464
2465
|
p ? p.scrollIntoView({ behavior: "smooth", block: "center" }) : h && h.scrollIntoView({ behavior: "smooth", block: "start" }), window.setTimeout(() => {
|
|
@@ -2471,21 +2472,21 @@ function oo({
|
|
|
2471
2472
|
},
|
|
2472
2473
|
[]
|
|
2473
2474
|
);
|
|
2474
|
-
|
|
2475
|
-
if (
|
|
2476
|
-
const c =
|
|
2475
|
+
Dt(() => {
|
|
2476
|
+
if (it !== "ready" || !qt.current || !It) return;
|
|
2477
|
+
const c = qt.current, h = new IntersectionObserver(
|
|
2477
2478
|
(l) => {
|
|
2478
2479
|
if ($t.current) return;
|
|
2479
2480
|
let p = null;
|
|
2480
2481
|
for (const k of l) {
|
|
2481
2482
|
if (!k.isIntersecting) continue;
|
|
2482
|
-
const
|
|
2483
|
+
const $ = Number.parseInt(
|
|
2483
2484
|
k.target.dataset.pageNumber || "0",
|
|
2484
2485
|
10
|
|
2485
2486
|
);
|
|
2486
|
-
|
|
2487
|
+
$ && (!p || k.intersectionRatio > p.ratio) && (p = { page: $, ratio: k.intersectionRatio });
|
|
2487
2488
|
}
|
|
2488
|
-
p &&
|
|
2489
|
+
p && ne(p.page);
|
|
2489
2490
|
},
|
|
2490
2491
|
{
|
|
2491
2492
|
root: c,
|
|
@@ -2493,56 +2494,56 @@ function oo({
|
|
|
2493
2494
|
}
|
|
2494
2495
|
);
|
|
2495
2496
|
for (let l = 1; l <= It; l += 1) {
|
|
2496
|
-
const p =
|
|
2497
|
+
const p = G.current.get(l);
|
|
2497
2498
|
p && h.observe(p);
|
|
2498
2499
|
}
|
|
2499
2500
|
return () => h.disconnect();
|
|
2500
|
-
}, [
|
|
2501
|
-
const
|
|
2502
|
-
|
|
2503
|
-
}, [
|
|
2504
|
-
|
|
2505
|
-
}, [
|
|
2506
|
-
|
|
2507
|
-
}, []), pi =
|
|
2508
|
-
|
|
2509
|
-
}, []), gi =
|
|
2510
|
-
|
|
2511
|
-
}, []),
|
|
2512
|
-
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))
|
|
2513
2514
|
try {
|
|
2514
|
-
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(
|
|
2515
2516
|
0,
|
|
2516
|
-
|
|
2517
|
+
qt.current.clientWidth - p
|
|
2517
2518
|
) / h.width;
|
|
2518
|
-
|
|
2519
|
+
oe(Math.max(0.25, Math.min(5, Math.round($ * 100) / 100)));
|
|
2519
2520
|
} catch {
|
|
2520
2521
|
}
|
|
2521
|
-
}, [
|
|
2522
|
-
|
|
2523
|
-
if (
|
|
2522
|
+
}, [st, ht, f]);
|
|
2523
|
+
Dt(() => {
|
|
2524
|
+
if (it !== "ready" || !st || !window.matchMedia("(max-width: 720px)").matches) return;
|
|
2524
2525
|
let c = !1;
|
|
2525
2526
|
const h = () => {
|
|
2526
|
-
c ||
|
|
2527
|
+
c || en();
|
|
2527
2528
|
};
|
|
2528
2529
|
h();
|
|
2529
|
-
const l =
|
|
2530
|
+
const l = qt.current, p = typeof ResizeObserver < "u" && l ? new ResizeObserver(() => h()) : null;
|
|
2530
2531
|
p == null || p.observe(l);
|
|
2531
|
-
const k = window.matchMedia("(max-width: 720px)"),
|
|
2532
|
+
const k = window.matchMedia("(max-width: 720px)"), $ = () => {
|
|
2532
2533
|
k.matches && h();
|
|
2533
2534
|
};
|
|
2534
|
-
return k.addEventListener("change",
|
|
2535
|
-
c = !0, p == null || p.disconnect(), k.removeEventListener("change",
|
|
2535
|
+
return k.addEventListener("change", $), () => {
|
|
2536
|
+
c = !0, p == null || p.disconnect(), k.removeEventListener("change", $);
|
|
2536
2537
|
};
|
|
2537
|
-
}, [
|
|
2538
|
-
const
|
|
2538
|
+
}, [it, st, Lt, f, en]);
|
|
2539
|
+
const bn = Pe(() => B.flatMap((c) => {
|
|
2539
2540
|
const h = c.type ?? "sign";
|
|
2540
2541
|
if (h !== "date" && h !== "text") return [];
|
|
2541
|
-
const l = (
|
|
2542
|
+
const l = (Xt[c.id] ?? c.value ?? "").trim();
|
|
2542
2543
|
if (!l) return [];
|
|
2543
2544
|
const p = Math.max(
|
|
2544
2545
|
10,
|
|
2545
|
-
Math.min(
|
|
2546
|
+
Math.min(we, c.height * 0.55)
|
|
2546
2547
|
);
|
|
2547
2548
|
return [
|
|
2548
2549
|
{
|
|
@@ -2555,23 +2556,23 @@ function oo({
|
|
|
2555
2556
|
height: Math.max(p * 1.2, c.height - 4),
|
|
2556
2557
|
value: l,
|
|
2557
2558
|
fontSize: p,
|
|
2558
|
-
color:
|
|
2559
|
+
color: me
|
|
2559
2560
|
}
|
|
2560
2561
|
];
|
|
2561
|
-
}), [
|
|
2562
|
-
() => [...
|
|
2563
|
-
[
|
|
2564
|
-
), mi =
|
|
2562
|
+
}), [B, Xt]), ke = Pe(
|
|
2563
|
+
() => [...Z, ...bn],
|
|
2564
|
+
[Z, bn]
|
|
2565
|
+
), mi = Y(async () => {
|
|
2565
2566
|
var c;
|
|
2566
|
-
if (!(!
|
|
2567
|
+
if (!(!st || it !== "ready")) {
|
|
2567
2568
|
a(!0);
|
|
2568
2569
|
try {
|
|
2569
|
-
const h = await
|
|
2570
|
+
const h = await Cn(st, {
|
|
2570
2571
|
scale: 1.5,
|
|
2571
|
-
rotation:
|
|
2572
|
+
rotation: f,
|
|
2572
2573
|
annotations: P,
|
|
2573
2574
|
signatures: N,
|
|
2574
|
-
texts:
|
|
2575
|
+
texts: ke,
|
|
2575
2576
|
mimeType: "image/png"
|
|
2576
2577
|
}), l = document.createElement("iframe");
|
|
2577
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);
|
|
@@ -2593,24 +2594,24 @@ function oo({
|
|
|
2593
2594
|
<body></body>
|
|
2594
2595
|
</html>`), p.close();
|
|
2595
2596
|
const k = p.body;
|
|
2596
|
-
for (const
|
|
2597
|
-
const
|
|
2598
|
-
|
|
2599
|
-
const
|
|
2600
|
-
|
|
2597
|
+
for (const $ of h) {
|
|
2598
|
+
const z = p.createElement("img");
|
|
2599
|
+
z.src = $.dataUrl;
|
|
2600
|
+
const ot = p.createElement("div");
|
|
2601
|
+
ot.className = "page", ot.appendChild(z), k.appendChild(ot);
|
|
2601
2602
|
}
|
|
2602
2603
|
await Promise.all(
|
|
2603
2604
|
Array.from(k.querySelectorAll("img")).map(
|
|
2604
|
-
(
|
|
2605
|
-
var
|
|
2606
|
-
return ((
|
|
2605
|
+
($) => {
|
|
2606
|
+
var z;
|
|
2607
|
+
return ((z = $.decode) == null ? void 0 : z.call($).catch(() => {
|
|
2607
2608
|
})) ?? Promise.resolve();
|
|
2608
2609
|
}
|
|
2609
2610
|
)
|
|
2610
2611
|
), setTimeout(() => {
|
|
2611
|
-
var
|
|
2612
|
+
var $, z;
|
|
2612
2613
|
try {
|
|
2613
|
-
(
|
|
2614
|
+
($ = l.contentWindow) == null || $.focus(), (z = l.contentWindow) == null || z.print();
|
|
2614
2615
|
} finally {
|
|
2615
2616
|
setTimeout(() => {
|
|
2616
2617
|
try {
|
|
@@ -2622,124 +2623,124 @@ function oo({
|
|
|
2622
2623
|
}, 50);
|
|
2623
2624
|
} catch {
|
|
2624
2625
|
try {
|
|
2625
|
-
|
|
2626
|
+
U ? window.open(U, "_blank", "noopener,noreferrer") : bt && window.open(bt, "_blank", "noopener,noreferrer");
|
|
2626
2627
|
} catch {
|
|
2627
2628
|
}
|
|
2628
2629
|
} finally {
|
|
2629
2630
|
a(!1);
|
|
2630
2631
|
}
|
|
2631
2632
|
}
|
|
2632
|
-
}, [
|
|
2633
|
-
if (!
|
|
2633
|
+
}, [st, it, f, o, U, bt, P, N, ke]), wi = Y(async () => {
|
|
2634
|
+
if (!st || it !== "ready") return;
|
|
2634
2635
|
const c = `${o.replace(/[^\w.-]+/g, "_") || "document"}.pdf`;
|
|
2635
|
-
if (!(P.length > 0 || N.length > 0 ||
|
|
2636
|
-
|
|
2637
|
-
await fetch(
|
|
2636
|
+
if (!(P.length > 0 || N.length > 0 || ke.length > 0) && U) {
|
|
2637
|
+
hn(
|
|
2638
|
+
await fetch(U).then((l) => l.blob()),
|
|
2638
2639
|
c
|
|
2639
2640
|
);
|
|
2640
2641
|
return;
|
|
2641
2642
|
}
|
|
2642
2643
|
v(!0);
|
|
2643
2644
|
try {
|
|
2644
|
-
const l = await
|
|
2645
|
+
const l = await Cn(st, {
|
|
2645
2646
|
scale: 2,
|
|
2646
|
-
rotation:
|
|
2647
|
+
rotation: f,
|
|
2647
2648
|
annotations: P,
|
|
2648
2649
|
signatures: N,
|
|
2649
|
-
texts:
|
|
2650
|
+
texts: ke,
|
|
2650
2651
|
mimeType: "image/jpeg",
|
|
2651
2652
|
quality: 0.92
|
|
2652
2653
|
}), p = Pr(l), k = new Uint8Array(p.byteLength);
|
|
2653
|
-
k.set(p),
|
|
2654
|
+
k.set(p), hn(
|
|
2654
2655
|
new Blob([k], { type: "application/pdf" }),
|
|
2655
2656
|
c
|
|
2656
2657
|
);
|
|
2657
2658
|
} catch {
|
|
2658
|
-
|
|
2659
|
-
await fetch(
|
|
2659
|
+
U && hn(
|
|
2660
|
+
await fetch(U).then((l) => l.blob()),
|
|
2660
2661
|
c
|
|
2661
2662
|
);
|
|
2662
2663
|
} finally {
|
|
2663
2664
|
v(!1);
|
|
2664
2665
|
}
|
|
2665
|
-
}, [
|
|
2666
|
-
|
|
2667
|
-
}, []), bi =
|
|
2668
|
-
|
|
2669
|
-
}, []), vi =
|
|
2670
|
-
|
|
2671
|
-
}, []), xi =
|
|
2672
|
-
|
|
2673
|
-
}, []),
|
|
2666
|
+
}, [st, it, f, o, U, P, N, ke]), yi = Y((c) => {
|
|
2667
|
+
D((h) => h === c ? "none" : c);
|
|
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(
|
|
2674
2675
|
(c, h) => {
|
|
2675
|
-
const l =
|
|
2676
|
+
const l = B.findIndex(
|
|
2676
2677
|
(k) => k.id === c
|
|
2677
|
-
), p =
|
|
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));
|
|
2678
2679
|
if (!p) {
|
|
2679
|
-
|
|
2680
|
+
X(!1), Gt(null);
|
|
2680
2681
|
return;
|
|
2681
2682
|
}
|
|
2682
|
-
|
|
2683
|
-
|
|
2683
|
+
Ut(p.id), Pt(null), Gt(null), ft(p.type ?? "sign"), Me(p), window.setTimeout(() => {
|
|
2684
|
+
X(!0);
|
|
2684
2685
|
}, 350);
|
|
2685
2686
|
},
|
|
2686
|
-
[
|
|
2687
|
-
), Mi =
|
|
2687
|
+
[Me, B]
|
|
2688
|
+
), Mi = Y(
|
|
2688
2689
|
(c) => {
|
|
2689
|
-
|
|
2690
|
+
ft(c), X(!0);
|
|
2690
2691
|
},
|
|
2691
2692
|
[]
|
|
2692
|
-
), ki =
|
|
2693
|
-
|
|
2694
|
-
}, []), Ni =
|
|
2693
|
+
), ki = Y((c, h) => {
|
|
2694
|
+
Ye((l) => ({ ...l, [c]: h }));
|
|
2695
|
+
}, []), Ni = Y(
|
|
2695
2696
|
(c) => {
|
|
2696
|
-
const h =
|
|
2697
|
-
h && (
|
|
2698
|
-
const l =
|
|
2699
|
-
Object.keys(
|
|
2700
|
-
var
|
|
2701
|
-
return (
|
|
2697
|
+
const h = Xt[c];
|
|
2698
|
+
h && (tt == null || tt(c, h));
|
|
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();
|
|
2702
2703
|
})
|
|
2703
2704
|
);
|
|
2704
2705
|
p.add(c);
|
|
2705
|
-
const k =
|
|
2706
|
-
(
|
|
2707
|
-
) ??
|
|
2708
|
-
(
|
|
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)
|
|
2709
2710
|
);
|
|
2710
|
-
k && (
|
|
2711
|
+
k && (Ut(k.id), Me(k));
|
|
2711
2712
|
},
|
|
2712
|
-
[
|
|
2713
|
-
), Pi =
|
|
2713
|
+
[B, Xt, N, Me, tt]
|
|
2714
|
+
), Pi = Y(
|
|
2714
2715
|
(c, h, l) => {
|
|
2715
|
-
var
|
|
2716
|
+
var pe;
|
|
2716
2717
|
const p = Xi(h, l);
|
|
2717
|
-
if (
|
|
2718
|
-
|
|
2719
|
-
(
|
|
2720
|
-
(
|
|
2721
|
-
...
|
|
2718
|
+
if (Yt) {
|
|
2719
|
+
j(
|
|
2720
|
+
(Q) => Q.map(
|
|
2721
|
+
(Ct) => Ct.id === Yt ? {
|
|
2722
|
+
...Ct,
|
|
2722
2723
|
imageDataUrl: c,
|
|
2723
|
-
width:
|
|
2724
|
-
height:
|
|
2725
|
-
} :
|
|
2724
|
+
width: Ct.fieldId ? Ct.width : p.width,
|
|
2725
|
+
height: Ct.fieldId ? Ct.height : p.height
|
|
2726
|
+
} : Ct
|
|
2726
2727
|
)
|
|
2727
|
-
), At(null),
|
|
2728
|
+
), At(null), D("none"), X(!1), Gt(null);
|
|
2728
2729
|
return;
|
|
2729
2730
|
}
|
|
2730
|
-
if (
|
|
2731
|
-
const
|
|
2732
|
-
(V) => V.id ===
|
|
2733
|
-
) ??
|
|
2734
|
-
(V) => (V.type ?? "sign") === "sign" && !N.some((
|
|
2731
|
+
if (jt) {
|
|
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)
|
|
2735
2736
|
);
|
|
2736
|
-
if (!
|
|
2737
|
-
|
|
2737
|
+
if (!Q) {
|
|
2738
|
+
X(!1);
|
|
2738
2739
|
return;
|
|
2739
2740
|
}
|
|
2740
|
-
const
|
|
2741
|
-
(V) => (V.type ?? "sign") === "sign" && V.signature_tag ===
|
|
2742
|
-
) : [
|
|
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) => ({
|
|
2743
2744
|
id: Se(),
|
|
2744
2745
|
fieldId: V.id,
|
|
2745
2746
|
pageNumber: V.pageNumber,
|
|
@@ -2748,200 +2749,200 @@ function oo({
|
|
|
2748
2749
|
width: V.width,
|
|
2749
2750
|
height: V.height,
|
|
2750
2751
|
imageDataUrl: c
|
|
2751
|
-
})),
|
|
2752
|
-
|
|
2753
|
-
...V.filter((
|
|
2754
|
-
...
|
|
2752
|
+
})), re = new Set(Ct.map((V) => V.id));
|
|
2753
|
+
j((V) => [
|
|
2754
|
+
...V.filter((ce) => !ce.fieldId || !re.has(ce.fieldId)),
|
|
2755
|
+
...Tt
|
|
2755
2756
|
]);
|
|
2756
|
-
const
|
|
2757
|
-
|
|
2757
|
+
const ge = new Map(
|
|
2758
|
+
Tt.map((V) => [V.fieldId, V])
|
|
2758
2759
|
);
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
), At(null),
|
|
2764
|
-
const
|
|
2765
|
-
|
|
2766
|
-
(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(
|
|
2767
2768
|
V,
|
|
2768
|
-
[...N, ...
|
|
2769
|
-
|
|
2769
|
+
[...N, ...Tt],
|
|
2770
|
+
Xt
|
|
2770
2771
|
)
|
|
2771
2772
|
).map((V) => V.id)
|
|
2772
2773
|
);
|
|
2773
|
-
for (const V of
|
|
2774
|
-
|
|
2774
|
+
for (const V of re) wt.add(V);
|
|
2775
|
+
Be(Q.id, wt);
|
|
2775
2776
|
return;
|
|
2776
2777
|
}
|
|
2777
|
-
const k =
|
|
2778
|
+
const k = G.current.get(ht), $ = k == null ? void 0 : k.querySelector(
|
|
2778
2779
|
".epochs-pdf-viewer__surface"
|
|
2779
2780
|
);
|
|
2780
|
-
let
|
|
2781
|
-
if (
|
|
2782
|
-
const
|
|
2783
|
-
if (
|
|
2784
|
-
const
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
),
|
|
2789
|
-
|
|
2781
|
+
let z = 24, ot = 24;
|
|
2782
|
+
if ($) {
|
|
2783
|
+
const Q = Ce($, Nt), Ct = $.closest(".epochs-pdf-viewer__body");
|
|
2784
|
+
if (Ct) {
|
|
2785
|
+
const Tt = Pn(
|
|
2786
|
+
Ct.getBoundingClientRect(),
|
|
2787
|
+
$,
|
|
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));
|
|
2790
2791
|
} else
|
|
2791
|
-
|
|
2792
|
+
z = Math.max(0, (Q.width - p.width) / 2), ot = Math.max(0, (Q.height - p.height) / 2);
|
|
2792
2793
|
}
|
|
2793
|
-
const
|
|
2794
|
+
const Ot = {
|
|
2794
2795
|
id: Se(),
|
|
2795
|
-
pageNumber:
|
|
2796
|
-
x:
|
|
2797
|
-
y:
|
|
2796
|
+
pageNumber: ht,
|
|
2797
|
+
x: z,
|
|
2798
|
+
y: ot,
|
|
2798
2799
|
width: p.width,
|
|
2799
2800
|
height: p.height,
|
|
2800
2801
|
imageDataUrl: c
|
|
2801
2802
|
};
|
|
2802
|
-
|
|
2803
|
+
j((Q) => [...Q, Ot]), Le(void 0, Ot), Pt(Ot.id), At(null), D("none"), X(!1), Gt(null);
|
|
2803
2804
|
},
|
|
2804
2805
|
[
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2806
|
+
Be,
|
|
2807
|
+
gt,
|
|
2808
|
+
Yt,
|
|
2809
|
+
Xt,
|
|
2810
|
+
jt,
|
|
2811
|
+
De,
|
|
2812
|
+
ht,
|
|
2813
|
+
Nt,
|
|
2814
|
+
_t,
|
|
2815
|
+
B,
|
|
2815
2816
|
N,
|
|
2816
|
-
|
|
2817
|
+
Le
|
|
2817
2818
|
]
|
|
2818
|
-
), $i =
|
|
2819
|
+
), $i = Y(
|
|
2819
2820
|
(c, h) => {
|
|
2820
|
-
if (
|
|
2821
|
-
const
|
|
2822
|
-
(
|
|
2823
|
-
) ??
|
|
2824
|
-
if (!
|
|
2825
|
-
|
|
2821
|
+
if (jt) {
|
|
2822
|
+
const Q = B.find(
|
|
2823
|
+
(wt) => wt.id === _t && (wt.type ?? "sign") === h
|
|
2824
|
+
) ?? B.find((wt) => (wt.type ?? "sign") === h);
|
|
2825
|
+
if (!Q) {
|
|
2826
|
+
X(!1);
|
|
2826
2827
|
return;
|
|
2827
2828
|
}
|
|
2828
|
-
const
|
|
2829
|
-
(
|
|
2830
|
-
) : [
|
|
2831
|
-
|
|
2832
|
-
const
|
|
2833
|
-
for (const
|
|
2834
|
-
const
|
|
2835
|
-
|
|
2836
|
-
(
|
|
2837
|
-
).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)
|
|
2838
2839
|
);
|
|
2839
|
-
|
|
2840
|
+
Be(Q.id, ge);
|
|
2840
2841
|
return;
|
|
2841
2842
|
}
|
|
2842
|
-
const l =
|
|
2843
|
-
let
|
|
2844
|
-
const
|
|
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(
|
|
2845
2846
|
".epochs-pdf-viewer__surface"
|
|
2846
2847
|
);
|
|
2847
|
-
if (
|
|
2848
|
-
const
|
|
2848
|
+
if (Ot) {
|
|
2849
|
+
const Q = Ce(Ot, Nt), Ct = Ot.closest(
|
|
2849
2850
|
".epochs-pdf-viewer__body"
|
|
2850
2851
|
);
|
|
2851
|
-
if (
|
|
2852
|
-
const
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
),
|
|
2857
|
-
|
|
2852
|
+
if (Ct) {
|
|
2853
|
+
const Tt = Pn(
|
|
2854
|
+
Ct.getBoundingClientRect(),
|
|
2855
|
+
Ot,
|
|
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));
|
|
2858
2859
|
}
|
|
2859
2860
|
}
|
|
2860
|
-
const
|
|
2861
|
-
id:
|
|
2862
|
-
pageNumber:
|
|
2863
|
-
x:
|
|
2864
|
-
y:
|
|
2861
|
+
const pe = {
|
|
2862
|
+
id: Ge(),
|
|
2863
|
+
pageNumber: ht,
|
|
2864
|
+
x: $,
|
|
2865
|
+
y: z,
|
|
2865
2866
|
width: p,
|
|
2866
2867
|
height: k,
|
|
2867
2868
|
value: c,
|
|
2868
2869
|
fontSize: l,
|
|
2869
|
-
color:
|
|
2870
|
+
color: me
|
|
2870
2871
|
};
|
|
2871
|
-
|
|
2872
|
+
R((Q) => [...Q, pe]), se(pe.id), X(!1), D("none");
|
|
2872
2873
|
},
|
|
2873
2874
|
[
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2875
|
+
Be,
|
|
2876
|
+
gt,
|
|
2877
|
+
Xt,
|
|
2878
|
+
jt,
|
|
2879
|
+
De,
|
|
2880
|
+
ht,
|
|
2881
|
+
Nt,
|
|
2882
|
+
_t,
|
|
2883
|
+
B,
|
|
2883
2884
|
N,
|
|
2884
|
-
|
|
2885
|
+
pn
|
|
2885
2886
|
]
|
|
2886
|
-
), Ii =
|
|
2887
|
-
|
|
2888
|
-
}, [
|
|
2887
|
+
), Ii = Y((c) => {
|
|
2888
|
+
j((h) => [...h, c]), Le(void 0, c), Pt(c.id), At(null), D("none");
|
|
2889
|
+
}, [Le]), Ci = Y(
|
|
2889
2890
|
(c, h) => {
|
|
2890
|
-
|
|
2891
|
+
j(
|
|
2891
2892
|
(l) => l.map((p) => p.id === c ? { ...p, ...h } : p)
|
|
2892
2893
|
);
|
|
2893
2894
|
},
|
|
2894
2895
|
[]
|
|
2895
|
-
), Ti =
|
|
2896
|
+
), Ti = Y((c) => {
|
|
2896
2897
|
const h = N.find((l) => l.id === c);
|
|
2897
|
-
|
|
2898
|
-
}, [N]), Di =
|
|
2899
|
-
const h = c ? N.find((
|
|
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;
|
|
2900
2901
|
if (!h) return;
|
|
2901
|
-
const l =
|
|
2902
|
+
const l = G.current.get(h.pageNumber), p = l == null ? void 0 : l.querySelector(
|
|
2902
2903
|
".epochs-pdf-viewer__surface"
|
|
2903
2904
|
), k = 18;
|
|
2904
|
-
let
|
|
2905
|
+
let $ = h.x + k, z = h.y + k;
|
|
2905
2906
|
if (p) {
|
|
2906
|
-
const
|
|
2907
|
-
|
|
2908
|
-
Math.max(0,
|
|
2909
|
-
Math.max(0,
|
|
2910
|
-
),
|
|
2911
|
-
Math.max(0,
|
|
2912
|
-
Math.max(0,
|
|
2907
|
+
const Ot = p.clientWidth / Nt, pe = p.clientHeight / Nt;
|
|
2908
|
+
$ = Math.min(
|
|
2909
|
+
Math.max(0, $),
|
|
2910
|
+
Math.max(0, Ot - h.width)
|
|
2911
|
+
), z = Math.min(
|
|
2912
|
+
Math.max(0, z),
|
|
2913
|
+
Math.max(0, pe - h.height)
|
|
2913
2914
|
);
|
|
2914
2915
|
}
|
|
2915
|
-
const
|
|
2916
|
+
const ot = {
|
|
2916
2917
|
...h,
|
|
2917
2918
|
id: Se(),
|
|
2918
|
-
x:
|
|
2919
|
-
y:
|
|
2919
|
+
x: $,
|
|
2920
|
+
y: z
|
|
2920
2921
|
};
|
|
2921
|
-
|
|
2922
|
-
}, [
|
|
2923
|
-
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);
|
|
2924
2925
|
if (!h) return;
|
|
2925
|
-
const l = N.find((k) => k.id === h), p = l != null && l.fieldId ?
|
|
2926
|
-
|
|
2927
|
-
}, [
|
|
2928
|
-
|
|
2929
|
-
}, []), Ri =
|
|
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(
|
|
2930
2931
|
(c, h) => {
|
|
2931
|
-
|
|
2932
|
+
R(
|
|
2932
2933
|
(l) => l.map((p) => p.id === c ? { ...p, ...h } : p)
|
|
2933
2934
|
);
|
|
2934
2935
|
},
|
|
2935
2936
|
[]
|
|
2936
|
-
), Ai =
|
|
2937
|
-
const h =
|
|
2938
|
-
|
|
2939
|
-
}, [
|
|
2940
|
-
|
|
2941
|
-
|
|
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(
|
|
2942
2943
|
(c) => c.map((h) => {
|
|
2943
2944
|
if (!h.fieldId) return h;
|
|
2944
|
-
const l =
|
|
2945
|
+
const l = E.find((p) => p.id === h.fieldId);
|
|
2945
2946
|
return l ? {
|
|
2946
2947
|
...h,
|
|
2947
2948
|
pageNumber: l.pageNumber,
|
|
@@ -2949,32 +2950,32 @@ function oo({
|
|
|
2949
2950
|
y: l.y,
|
|
2950
2951
|
width: l.width,
|
|
2951
2952
|
height: l.height,
|
|
2952
|
-
fontSize: l.fontSize ?? h.fontSize ??
|
|
2953
|
-
color: l.color ?? h.color ??
|
|
2953
|
+
fontSize: l.fontSize ?? h.fontSize ?? we,
|
|
2954
|
+
color: l.color ?? h.color ?? me
|
|
2954
2955
|
} : h;
|
|
2955
2956
|
})
|
|
2956
2957
|
);
|
|
2957
|
-
}, [
|
|
2958
|
-
const
|
|
2958
|
+
}, [Te, E]);
|
|
2959
|
+
const _n = Y(
|
|
2959
2960
|
(c) => {
|
|
2960
2961
|
var k;
|
|
2961
|
-
if (!
|
|
2962
|
-
const h =
|
|
2963
|
-
|
|
2962
|
+
if (!B.length) return;
|
|
2963
|
+
const h = _t != null ? B.findIndex(($) => $.id === _t) : -1, l = Math.min(
|
|
2964
|
+
B.length - 1,
|
|
2964
2965
|
Math.max(0, (h < 0 ? 0 : h) + c)
|
|
2965
|
-
), p =
|
|
2966
|
-
p && (
|
|
2967
|
-
((k = N.find((
|
|
2968
|
-
),
|
|
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));
|
|
2969
2970
|
},
|
|
2970
2971
|
[
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2972
|
+
Me,
|
|
2973
|
+
_t,
|
|
2974
|
+
B,
|
|
2974
2975
|
N
|
|
2975
2976
|
]
|
|
2976
2977
|
);
|
|
2977
|
-
if (!
|
|
2978
|
+
if (!yt && !bt)
|
|
2978
2979
|
return /* @__PURE__ */ s(
|
|
2979
2980
|
"div",
|
|
2980
2981
|
{
|
|
@@ -2985,106 +2986,113 @@ function oo({
|
|
|
2985
2986
|
);
|
|
2986
2987
|
const Ei = {
|
|
2987
2988
|
height: r
|
|
2988
|
-
},
|
|
2989
|
-
status:
|
|
2990
|
-
showThumbnails:
|
|
2991
|
-
setShowThumbnails:
|
|
2992
|
-
canGoPrev:
|
|
2993
|
-
canGoNext:
|
|
2989
|
+
}, vn = {
|
|
2990
|
+
status: it,
|
|
2991
|
+
showThumbnails: Lt,
|
|
2992
|
+
setShowThumbnails: Zt,
|
|
2993
|
+
canGoPrev: Je,
|
|
2994
|
+
canGoNext: tn,
|
|
2994
2995
|
handlePrev: hi,
|
|
2995
2996
|
handleNext: ui,
|
|
2996
|
-
pageNumber:
|
|
2997
|
+
pageNumber: ht,
|
|
2997
2998
|
numPages: It,
|
|
2998
|
-
scrollToPage:
|
|
2999
|
-
scale:
|
|
2999
|
+
scrollToPage: xe,
|
|
3000
|
+
scale: Nt,
|
|
3000
3001
|
handleZoomOut: pi,
|
|
3001
3002
|
handleZoomIn: gi,
|
|
3002
|
-
handleFitWidth:
|
|
3003
|
+
handleFitWidth: en,
|
|
3003
3004
|
handleRotate: fi,
|
|
3004
|
-
markupTool:
|
|
3005
|
+
markupTool: M,
|
|
3005
3006
|
toggleMarkupTool: (c) => yi(c),
|
|
3006
|
-
hasFixedSignatureFields:
|
|
3007
|
-
hasFixedTextFields:
|
|
3008
|
-
pendingSignature:
|
|
3009
|
-
setMarkupTool:
|
|
3010
|
-
setSignaturePadOpen:
|
|
3007
|
+
hasFixedSignatureFields: jt,
|
|
3008
|
+
hasFixedTextFields: Te,
|
|
3009
|
+
pendingSignature: Ht,
|
|
3010
|
+
setMarkupTool: D,
|
|
3011
|
+
setSignaturePadOpen: X,
|
|
3011
3012
|
annotationsLength: P.length,
|
|
3012
3013
|
signaturesLength: N.length,
|
|
3013
|
-
textsLength:
|
|
3014
|
+
textsLength: Z.length,
|
|
3014
3015
|
handleClearAnnotations: xi,
|
|
3015
|
-
highlightHex:
|
|
3016
|
-
underlineHex:
|
|
3017
|
-
setHighlightHex:
|
|
3016
|
+
highlightHex: _e,
|
|
3017
|
+
underlineHex: ae,
|
|
3018
|
+
setHighlightHex: Qt,
|
|
3018
3019
|
setUnderlineHex: di,
|
|
3019
|
-
loadDocument:
|
|
3020
|
+
loadDocument: Qe,
|
|
3020
3021
|
handlePrint: mi,
|
|
3021
3022
|
isPrinting: ie,
|
|
3022
|
-
pdfDoc:
|
|
3023
|
-
displayUrl:
|
|
3024
|
-
resolvedUrl:
|
|
3023
|
+
pdfDoc: st,
|
|
3024
|
+
displayUrl: U,
|
|
3025
|
+
resolvedUrl: bt,
|
|
3025
3026
|
handleDownload: wi,
|
|
3026
3027
|
isDownloading: w
|
|
3027
|
-
},
|
|
3028
|
-
(c) =>
|
|
3029
|
-
).length,
|
|
3030
|
-
const l =
|
|
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);
|
|
3031
3032
|
if (l.length === 0 && !h)
|
|
3032
3033
|
return /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__toolbar-group" });
|
|
3033
3034
|
if (l.length === 0)
|
|
3034
3035
|
return /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__toolbar-group epochs-pdf-viewer__toolbar-group--end" });
|
|
3035
|
-
const p = l.map((k,
|
|
3036
|
-
const
|
|
3037
|
-
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);
|
|
3038
3039
|
});
|
|
3039
|
-
return /* @__PURE__ */
|
|
3040
|
+
return /* @__PURE__ */ T(
|
|
3040
3041
|
"div",
|
|
3041
3042
|
{
|
|
3042
3043
|
className: h ? "epochs-pdf-viewer__toolbar-group epochs-pdf-viewer__toolbar-group--end" : "epochs-pdf-viewer__toolbar-group",
|
|
3043
3044
|
children: [
|
|
3044
3045
|
p,
|
|
3045
|
-
Rr(
|
|
3046
|
+
Rr(vn, new Set(l))
|
|
3046
3047
|
]
|
|
3047
3048
|
}
|
|
3048
3049
|
);
|
|
3049
3050
|
};
|
|
3050
|
-
return /* @__PURE__ */
|
|
3051
|
+
return /* @__PURE__ */ T(
|
|
3051
3052
|
"div",
|
|
3052
3053
|
{
|
|
3053
3054
|
"data-testid": "pdf-viewer",
|
|
3054
|
-
"data-file-url":
|
|
3055
|
+
"data-file-url": bt || void 0,
|
|
3055
3056
|
className: `epochs-pdf-viewer ${_ ?? ""}`.trim(),
|
|
3056
3057
|
style: Ei,
|
|
3057
3058
|
children: [
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3059
|
+
ue ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__toolbar", children: [
|
|
3060
|
+
xn(ue.left),
|
|
3061
|
+
xn(ue.right, !0)
|
|
3061
3062
|
] }) : null,
|
|
3062
|
-
|
|
3063
|
+
Ze || kt || jt ? /* @__PURE__ */ s(
|
|
3063
3064
|
Cr,
|
|
3064
3065
|
{
|
|
3065
|
-
open:
|
|
3066
|
+
open: lt,
|
|
3066
3067
|
onClose: () => {
|
|
3067
|
-
|
|
3068
|
+
X(!1), Gt(null), ft(void 0), dt == null || dt();
|
|
3068
3069
|
},
|
|
3069
3070
|
onSave: Pi,
|
|
3070
3071
|
onSaveFieldValue: $i,
|
|
3071
|
-
fieldType:
|
|
3072
|
-
showFieldTypeTabs: !
|
|
3073
|
-
textPlaceholder: (
|
|
3074
|
-
initialFieldValue:
|
|
3075
|
-
|
|
3072
|
+
fieldType: et,
|
|
3073
|
+
showFieldTypeTabs: !jt,
|
|
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,
|
|
3076
|
+
targetSize: (() => {
|
|
3077
|
+
const c = B.find(
|
|
3078
|
+
(h) => h.id === _t
|
|
3079
|
+
);
|
|
3080
|
+
if (!(!c || (c.type ?? "sign") !== "sign"))
|
|
3081
|
+
return { width: c.width, height: c.height };
|
|
3082
|
+
})(),
|
|
3083
|
+
rememberedByType: Ft,
|
|
3076
3084
|
onRememberFill: (c, h) => {
|
|
3077
|
-
|
|
3085
|
+
Rt((l) => c === "sign" ? { ...l, sign: h } : c === "date" ? { ...l, date: h } : { ...l, text: h });
|
|
3078
3086
|
}
|
|
3079
3087
|
}
|
|
3080
3088
|
) : null,
|
|
3081
|
-
/* @__PURE__ */
|
|
3082
|
-
|
|
3089
|
+
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__content", children: [
|
|
3090
|
+
Lt ? /* @__PURE__ */ s(
|
|
3083
3091
|
"div",
|
|
3084
3092
|
{
|
|
3085
3093
|
className: "epochs-pdf-viewer__thumbnails",
|
|
3086
3094
|
style: { width: m + 24 },
|
|
3087
|
-
children:
|
|
3095
|
+
children: it === "ready" && st ? /* @__PURE__ */ T(je, { children: [
|
|
3088
3096
|
Array.from({
|
|
3089
3097
|
length: Math.min(It || 0, g)
|
|
3090
3098
|
}).map((c, h) => {
|
|
@@ -3092,21 +3100,21 @@ function oo({
|
|
|
3092
3100
|
return /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__thumb-wrap", children: /* @__PURE__ */ s(
|
|
3093
3101
|
br,
|
|
3094
3102
|
{
|
|
3095
|
-
pdfDoc:
|
|
3103
|
+
pdfDoc: st,
|
|
3096
3104
|
pageNumber: l,
|
|
3097
|
-
isActive: l ===
|
|
3098
|
-
rotation:
|
|
3099
|
-
onSelect:
|
|
3105
|
+
isActive: l === ht,
|
|
3106
|
+
rotation: f,
|
|
3107
|
+
onSelect: xe,
|
|
3100
3108
|
width: m,
|
|
3101
3109
|
annotations: P,
|
|
3102
3110
|
signatures: N,
|
|
3103
|
-
signatureFields:
|
|
3104
|
-
texts:
|
|
3105
|
-
textFields:
|
|
3111
|
+
signatureFields: B,
|
|
3112
|
+
texts: ke,
|
|
3113
|
+
textFields: E
|
|
3106
3114
|
}
|
|
3107
3115
|
) }, l);
|
|
3108
3116
|
}),
|
|
3109
|
-
It > g ? /* @__PURE__ */
|
|
3117
|
+
It > g ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__thumb-more", children: [
|
|
3110
3118
|
"Showing first ",
|
|
3111
3119
|
g,
|
|
3112
3120
|
" pages"
|
|
@@ -3114,69 +3122,69 @@ function oo({
|
|
|
3114
3122
|
] }) : /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__muted", children: "Thumbnails" })
|
|
3115
3123
|
}
|
|
3116
3124
|
) : null,
|
|
3117
|
-
/* @__PURE__ */
|
|
3118
|
-
|
|
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: [
|
|
3119
3127
|
"Loading PDF…",
|
|
3120
3128
|
/* @__PURE__ */ s("span", { className: "epochs-pdf-viewer__spinner" })
|
|
3121
3129
|
] }) : null,
|
|
3122
|
-
|
|
3130
|
+
it === "error" ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__overlay epochs-pdf-viewer__error", children: [
|
|
3123
3131
|
"Unable to load PDF.",
|
|
3124
|
-
|
|
3132
|
+
bt ? /* @__PURE__ */ s(
|
|
3125
3133
|
"a",
|
|
3126
3134
|
{
|
|
3127
3135
|
className: "epochs-pdf-viewer__open-link",
|
|
3128
|
-
href:
|
|
3136
|
+
href: bt,
|
|
3129
3137
|
target: "_blank",
|
|
3130
3138
|
rel: "noopener noreferrer",
|
|
3131
3139
|
children: "Open file"
|
|
3132
3140
|
}
|
|
3133
3141
|
) : null
|
|
3134
3142
|
] }) : null,
|
|
3135
|
-
|
|
3143
|
+
it === "ready" && st ? /* @__PURE__ */ s("div", { children: Array.from({ length: It }).map((c, h) => {
|
|
3136
3144
|
const l = h + 1;
|
|
3137
3145
|
return /* @__PURE__ */ s(
|
|
3138
3146
|
yr,
|
|
3139
3147
|
{
|
|
3140
|
-
pdfDoc:
|
|
3148
|
+
pdfDoc: st,
|
|
3141
3149
|
pageNumber: l,
|
|
3142
|
-
scale:
|
|
3143
|
-
rotation:
|
|
3144
|
-
markupTool:
|
|
3150
|
+
scale: Nt,
|
|
3151
|
+
rotation: f,
|
|
3152
|
+
markupTool: at ? M : "none",
|
|
3145
3153
|
markupColor: bi,
|
|
3146
3154
|
annotations: P,
|
|
3147
3155
|
onAddAnnotation: _i,
|
|
3148
3156
|
onRemoveAnnotation: vi,
|
|
3149
3157
|
signatures: N,
|
|
3150
|
-
pendingSignature:
|
|
3158
|
+
pendingSignature: Ht,
|
|
3151
3159
|
onAddSignature: Ii,
|
|
3152
3160
|
onUpdateSignature: Ci,
|
|
3153
3161
|
onRemoveSignature: Ti,
|
|
3154
3162
|
onEditSignature: Li,
|
|
3155
3163
|
onDuplicateSignature: Di,
|
|
3156
|
-
selectedSignatureId:
|
|
3157
|
-
onSelectSignature:
|
|
3158
|
-
signatureFields:
|
|
3159
|
-
selectedSignatureFieldId:
|
|
3160
|
-
onSelectSignatureField:
|
|
3161
|
-
hasFixedSignatureFields:
|
|
3164
|
+
selectedSignatureId: St,
|
|
3165
|
+
onSelectSignature: Pt,
|
|
3166
|
+
signatureFields: B,
|
|
3167
|
+
selectedSignatureFieldId: _t,
|
|
3168
|
+
onSelectSignatureField: Ut,
|
|
3169
|
+
hasFixedSignatureFields: jt,
|
|
3162
3170
|
onOpenSignaturePad: Mi,
|
|
3163
|
-
fieldValues:
|
|
3171
|
+
fieldValues: Xt,
|
|
3164
3172
|
onFieldValueChange: ki,
|
|
3165
3173
|
onFieldValueCommit: Ni,
|
|
3166
|
-
texts:
|
|
3174
|
+
texts: Z,
|
|
3167
3175
|
onAddText: Fi,
|
|
3168
3176
|
onUpdateText: Ri,
|
|
3169
3177
|
onRemoveText: Ai,
|
|
3170
|
-
selectedTextId:
|
|
3171
|
-
onSelectText:
|
|
3172
|
-
textFields:
|
|
3173
|
-
selectedTextFieldId:
|
|
3174
|
-
onSelectTextField:
|
|
3175
|
-
hasFixedTextFields:
|
|
3176
|
-
editingTextId:
|
|
3177
|
-
onEditingTextIdChange:
|
|
3178
|
+
selectedTextId: be,
|
|
3179
|
+
onSelectText: se,
|
|
3180
|
+
textFields: E,
|
|
3181
|
+
selectedTextFieldId: Ve,
|
|
3182
|
+
onSelectTextField: de,
|
|
3183
|
+
hasFixedTextFields: Te,
|
|
3184
|
+
editingTextId: qe,
|
|
3185
|
+
onEditingTextIdChange: he,
|
|
3178
3186
|
pageRef: (p) => {
|
|
3179
|
-
p &&
|
|
3187
|
+
p && G.current.set(l, p);
|
|
3180
3188
|
}
|
|
3181
3189
|
},
|
|
3182
3190
|
l
|
|
@@ -3184,16 +3192,16 @@ function oo({
|
|
|
3184
3192
|
}) }) : null
|
|
3185
3193
|
] })
|
|
3186
3194
|
] }),
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
/* @__PURE__ */
|
|
3195
|
+
jt || te ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__footer", role: "navigation", "aria-label": "Viewer actions", children: [
|
|
3196
|
+
jt ? /* @__PURE__ */ T(je, { children: [
|
|
3197
|
+
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__footer-nav", children: [
|
|
3190
3198
|
/* @__PURE__ */ s(
|
|
3191
3199
|
"button",
|
|
3192
3200
|
{
|
|
3193
3201
|
type: "button",
|
|
3194
3202
|
className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
|
|
3195
|
-
disabled:
|
|
3196
|
-
onClick: () =>
|
|
3203
|
+
disabled: B.length <= 1 || nn <= 0,
|
|
3204
|
+
onClick: () => _n(-1),
|
|
3197
3205
|
children: "Prev"
|
|
3198
3206
|
}
|
|
3199
3207
|
),
|
|
@@ -3202,18 +3210,18 @@ function oo({
|
|
|
3202
3210
|
{
|
|
3203
3211
|
type: "button",
|
|
3204
3212
|
className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
|
|
3205
|
-
disabled:
|
|
3206
|
-
onClick: () =>
|
|
3213
|
+
disabled: B.length <= 1 || nn >= B.length - 1,
|
|
3214
|
+
onClick: () => _n(1),
|
|
3207
3215
|
children: "Next"
|
|
3208
3216
|
}
|
|
3209
3217
|
)
|
|
3210
3218
|
] }),
|
|
3211
|
-
/* @__PURE__ */
|
|
3212
|
-
/* @__PURE__ */
|
|
3219
|
+
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__footer-center", children: [
|
|
3220
|
+
/* @__PURE__ */ T("span", { className: "epochs-pdf-viewer__footer-label", children: [
|
|
3213
3221
|
"Field ",
|
|
3214
|
-
Math.max(1,
|
|
3222
|
+
Math.max(1, nn + 1),
|
|
3215
3223
|
" of ",
|
|
3216
|
-
|
|
3224
|
+
B.length
|
|
3217
3225
|
] }),
|
|
3218
3226
|
/* @__PURE__ */ s(
|
|
3219
3227
|
"div",
|
|
@@ -3222,40 +3230,40 @@ function oo({
|
|
|
3222
3230
|
role: "progressbar",
|
|
3223
3231
|
"aria-valuemin": 0,
|
|
3224
3232
|
"aria-valuemax": 100,
|
|
3225
|
-
"aria-valuenow":
|
|
3233
|
+
"aria-valuenow": rn,
|
|
3226
3234
|
"aria-label": "Signature progress",
|
|
3227
3235
|
children: /* @__PURE__ */ s(
|
|
3228
3236
|
"div",
|
|
3229
3237
|
{
|
|
3230
3238
|
className: "epochs-pdf-viewer__footer-progress-bar",
|
|
3231
|
-
style: { width: `${
|
|
3239
|
+
style: { width: `${rn}%` }
|
|
3232
3240
|
}
|
|
3233
3241
|
)
|
|
3234
3242
|
}
|
|
3235
3243
|
),
|
|
3236
|
-
/* @__PURE__ */
|
|
3237
|
-
|
|
3244
|
+
/* @__PURE__ */ T("span", { className: "epochs-pdf-viewer__footer-percent", children: [
|
|
3245
|
+
rn,
|
|
3238
3246
|
"%"
|
|
3239
3247
|
] })
|
|
3240
3248
|
] })
|
|
3241
3249
|
] }) : /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__footer-center" }),
|
|
3242
|
-
|
|
3250
|
+
te ? /* @__PURE__ */ T(
|
|
3243
3251
|
"button",
|
|
3244
3252
|
{
|
|
3245
3253
|
type: "button",
|
|
3246
3254
|
className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--primary",
|
|
3247
|
-
onClick:
|
|
3248
|
-
disabled:
|
|
3249
|
-
"aria-busy":
|
|
3255
|
+
onClick: te,
|
|
3256
|
+
disabled: Vt,
|
|
3257
|
+
"aria-busy": Vt || void 0,
|
|
3250
3258
|
children: [
|
|
3251
|
-
|
|
3259
|
+
Vt ? /* @__PURE__ */ s(
|
|
3252
3260
|
"span",
|
|
3253
3261
|
{
|
|
3254
3262
|
className: "epochs-pdf-viewer__spinner epochs-pdf-viewer__spinner--btn",
|
|
3255
3263
|
"aria-hidden": "true"
|
|
3256
3264
|
}
|
|
3257
3265
|
) : null,
|
|
3258
|
-
|
|
3266
|
+
ye
|
|
3259
3267
|
]
|
|
3260
3268
|
}
|
|
3261
3269
|
) : null
|
|
@@ -3268,27 +3276,27 @@ function Er(t) {
|
|
|
3268
3276
|
return null;
|
|
3269
3277
|
}
|
|
3270
3278
|
Er.displayName = "Document";
|
|
3271
|
-
function Ur(t) {
|
|
3272
|
-
return null;
|
|
3273
|
-
}
|
|
3274
|
-
Ur.displayName = "Page";
|
|
3275
3279
|
function Hr(t) {
|
|
3276
3280
|
return null;
|
|
3277
3281
|
}
|
|
3278
|
-
Hr.displayName = "
|
|
3279
|
-
function
|
|
3282
|
+
Hr.displayName = "Page";
|
|
3283
|
+
function Ur(t) {
|
|
3280
3284
|
return null;
|
|
3281
3285
|
}
|
|
3282
|
-
|
|
3286
|
+
Ur.displayName = "View";
|
|
3283
3287
|
function jr(t) {
|
|
3284
3288
|
return null;
|
|
3285
3289
|
}
|
|
3286
|
-
jr.displayName = "
|
|
3287
|
-
function
|
|
3290
|
+
jr.displayName = "Text";
|
|
3291
|
+
function Br(t) {
|
|
3288
3292
|
return null;
|
|
3289
3293
|
}
|
|
3290
|
-
|
|
3291
|
-
|
|
3294
|
+
Br.displayName = "Image";
|
|
3295
|
+
function Wr(t) {
|
|
3296
|
+
return null;
|
|
3297
|
+
}
|
|
3298
|
+
Wr.displayName = "Link";
|
|
3299
|
+
const Or = {
|
|
3292
3300
|
Document: "DOCUMENT",
|
|
3293
3301
|
Page: "PAGE",
|
|
3294
3302
|
View: "VIEW",
|
|
@@ -3296,7 +3304,7 @@ const Br = {
|
|
|
3296
3304
|
Image: "IMAGE",
|
|
3297
3305
|
Link: "LINK"
|
|
3298
3306
|
};
|
|
3299
|
-
function
|
|
3307
|
+
function zr(t) {
|
|
3300
3308
|
if (typeof t == "string") return t;
|
|
3301
3309
|
if (typeof t == "function") {
|
|
3302
3310
|
const e = t;
|
|
@@ -3304,7 +3312,7 @@ function Or(t) {
|
|
|
3304
3312
|
}
|
|
3305
3313
|
return null;
|
|
3306
3314
|
}
|
|
3307
|
-
function
|
|
3315
|
+
function ii(t) {
|
|
3308
3316
|
const e = [], n = (i) => {
|
|
3309
3317
|
if (!(i == null || typeof i == "boolean")) {
|
|
3310
3318
|
if (Array.isArray(i)) {
|
|
@@ -3316,11 +3324,11 @@ function ti(t) {
|
|
|
3316
3324
|
};
|
|
3317
3325
|
return n(t), e;
|
|
3318
3326
|
}
|
|
3319
|
-
function
|
|
3320
|
-
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("");
|
|
3321
3329
|
}
|
|
3322
|
-
function
|
|
3323
|
-
const e =
|
|
3330
|
+
function oi(t) {
|
|
3331
|
+
const e = zr(t.type), n = e ? Or[e] : void 0;
|
|
3324
3332
|
if (!n)
|
|
3325
3333
|
throw new Error(
|
|
3326
3334
|
`[epochs-pdf] Unsupported element "${e ?? "unknown"}". Use Document, Page, View, Text, Image, or Link.`
|
|
@@ -3331,27 +3339,27 @@ function ni(t) {
|
|
|
3331
3339
|
type: n,
|
|
3332
3340
|
props: i,
|
|
3333
3341
|
children: [],
|
|
3334
|
-
text:
|
|
3342
|
+
text: ri(r)
|
|
3335
3343
|
};
|
|
3336
|
-
const o =
|
|
3344
|
+
const o = ii(r).filter(
|
|
3337
3345
|
(d) => !!d && typeof d == "object" && "type" in d
|
|
3338
|
-
).map(
|
|
3346
|
+
).map(oi);
|
|
3339
3347
|
return {
|
|
3340
3348
|
type: n,
|
|
3341
3349
|
props: i,
|
|
3342
3350
|
children: o
|
|
3343
3351
|
};
|
|
3344
3352
|
}
|
|
3345
|
-
const
|
|
3353
|
+
const Sr = {
|
|
3346
3354
|
A4: [595.28, 841.89],
|
|
3347
3355
|
LETTER: [612, 792],
|
|
3348
3356
|
LEGAL: [612, 1008]
|
|
3349
3357
|
};
|
|
3350
3358
|
function Gr(t = "A4", e = "portrait") {
|
|
3351
|
-
const [n, i] = Array.isArray(t) ? t :
|
|
3359
|
+
const [n, i] = Array.isArray(t) ? t : Sr[t];
|
|
3352
3360
|
return e === "landscape" ? [i, n] : [n, i];
|
|
3353
3361
|
}
|
|
3354
|
-
function
|
|
3362
|
+
function si(t = {}) {
|
|
3355
3363
|
const e = t.padding ?? 0;
|
|
3356
3364
|
return {
|
|
3357
3365
|
top: t.paddingTop ?? e,
|
|
@@ -3360,7 +3368,7 @@ function ii(t = {}) {
|
|
|
3360
3368
|
left: t.paddingLeft ?? e
|
|
3361
3369
|
};
|
|
3362
3370
|
}
|
|
3363
|
-
function
|
|
3371
|
+
function Ae(t = {}) {
|
|
3364
3372
|
const e = t.margin ?? 0;
|
|
3365
3373
|
return {
|
|
3366
3374
|
top: t.marginTop ?? e,
|
|
@@ -3369,7 +3377,7 @@ function Ce(t = {}) {
|
|
|
3369
3377
|
left: t.marginLeft ?? e
|
|
3370
3378
|
};
|
|
3371
3379
|
}
|
|
3372
|
-
function
|
|
3380
|
+
function ze(t) {
|
|
3373
3381
|
if (!t) return null;
|
|
3374
3382
|
const e = t.trim();
|
|
3375
3383
|
if (e.startsWith("#")) {
|
|
@@ -3392,7 +3400,7 @@ function je(t) {
|
|
|
3392
3400
|
Math.min(1, Number(n[3]) / 255)
|
|
3393
3401
|
] : null;
|
|
3394
3402
|
}
|
|
3395
|
-
function
|
|
3403
|
+
function $e(t, e, n = 0) {
|
|
3396
3404
|
if (t == null) return n;
|
|
3397
3405
|
if (typeof t == "number") return t;
|
|
3398
3406
|
if (t.endsWith("%")) {
|
|
@@ -3402,19 +3410,19 @@ function _e(t, e, n = 0) {
|
|
|
3402
3410
|
const i = Number.parseFloat(t);
|
|
3403
3411
|
return Number.isFinite(i) ? i : n;
|
|
3404
3412
|
}
|
|
3405
|
-
function
|
|
3413
|
+
function un(t) {
|
|
3406
3414
|
return t === "bold" ? !0 : typeof t == "number" ? t >= 600 : !1;
|
|
3407
3415
|
}
|
|
3408
3416
|
const Xr = 12, Vr = 1.4, qr = 0.5;
|
|
3409
|
-
function
|
|
3410
|
-
const i = e.fontSize ?? Xr, r = (e.lineHeight ?? Vr) * i, o = i * (
|
|
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);
|
|
3411
3419
|
if (!t)
|
|
3412
3420
|
return { width: 0, height: r, lines: [""] };
|
|
3413
3421
|
const d = t.split(/\s+/), u = [];
|
|
3414
3422
|
let m = "";
|
|
3415
3423
|
for (const _ of d) {
|
|
3416
|
-
const
|
|
3417
|
-
|
|
3424
|
+
const y = m ? `${m} ${_}` : _;
|
|
3425
|
+
y.length * o <= n || !m ? m = y : (u.push(m), m = _);
|
|
3418
3426
|
}
|
|
3419
3427
|
m && u.push(m);
|
|
3420
3428
|
const g = Math.max(...u.map((_) => _.length * o), 0);
|
|
@@ -3424,18 +3432,18 @@ function ri(t, e, n) {
|
|
|
3424
3432
|
lines: u
|
|
3425
3433
|
};
|
|
3426
3434
|
}
|
|
3427
|
-
function
|
|
3428
|
-
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(
|
|
3429
3437
|
0,
|
|
3430
|
-
|
|
3431
|
-
),
|
|
3438
|
+
$e(o.width, i, i) - d.left - d.right
|
|
3439
|
+
), y = Math.max(0, _ - u.left - u.right);
|
|
3432
3440
|
if (t.type === "TEXT" || t.type === "LINK") {
|
|
3433
|
-
const
|
|
3441
|
+
const E = ai(t.text ?? "", o, y), ct = $e(o.height, r, E.height + u.top + u.bottom);
|
|
3434
3442
|
return {
|
|
3435
3443
|
x: m,
|
|
3436
3444
|
y: g,
|
|
3437
3445
|
width: _,
|
|
3438
|
-
height:
|
|
3446
|
+
height: ct,
|
|
3439
3447
|
node: t,
|
|
3440
3448
|
children: [],
|
|
3441
3449
|
style: o,
|
|
@@ -3443,40 +3451,40 @@ function oi(t, e, n, i, r) {
|
|
|
3443
3451
|
};
|
|
3444
3452
|
}
|
|
3445
3453
|
if (t.type === "IMAGE") {
|
|
3446
|
-
const
|
|
3454
|
+
const E = $e(o.width, i, Math.min(200, i)), ct = $e(o.height, r, 120);
|
|
3447
3455
|
return {
|
|
3448
3456
|
x: m,
|
|
3449
3457
|
y: g,
|
|
3450
|
-
width:
|
|
3451
|
-
height:
|
|
3458
|
+
width: E - d.left - d.right,
|
|
3459
|
+
height: ct,
|
|
3452
3460
|
node: t,
|
|
3453
3461
|
children: [],
|
|
3454
3462
|
style: o
|
|
3455
3463
|
};
|
|
3456
3464
|
}
|
|
3457
|
-
const
|
|
3458
|
-
let S = m + u.left, H = g + u.top,
|
|
3459
|
-
for (let
|
|
3460
|
-
const
|
|
3461
|
-
|
|
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));
|
|
3462
3470
|
}
|
|
3463
|
-
const
|
|
3471
|
+
const C = $e(
|
|
3464
3472
|
o.height,
|
|
3465
3473
|
r,
|
|
3466
|
-
|
|
3467
|
-
),
|
|
3468
|
-
let
|
|
3469
|
-
|
|
3470
|
-
let
|
|
3471
|
-
for (const
|
|
3472
|
-
|
|
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);
|
|
3473
3481
|
return {
|
|
3474
3482
|
x: m,
|
|
3475
3483
|
y: g,
|
|
3476
|
-
width:
|
|
3477
|
-
height:
|
|
3484
|
+
width: nt,
|
|
3485
|
+
height: C,
|
|
3478
3486
|
node: t,
|
|
3479
|
-
children:
|
|
3487
|
+
children: I,
|
|
3480
3488
|
style: o
|
|
3481
3489
|
};
|
|
3482
3490
|
}
|
|
@@ -3487,7 +3495,7 @@ function Yr(t) {
|
|
|
3487
3495
|
for (const n of t.children) {
|
|
3488
3496
|
if (n.type !== "PAGE")
|
|
3489
3497
|
throw new Error("[epochs-pdf] Direct children of <Document> must be <Page>.");
|
|
3490
|
-
const i = n.props.size, r = n.props.orientation ?? "portrait", [o, d] = Gr(i, r), u = n.props.style ?? {}, m =
|
|
3498
|
+
const i = n.props.size, r = n.props.orientation ?? "portrait", [o, d] = Gr(i, r), u = n.props.style ?? {}, m = si(u), g = {
|
|
3491
3499
|
type: "VIEW",
|
|
3492
3500
|
props: {
|
|
3493
3501
|
style: {
|
|
@@ -3501,7 +3509,7 @@ function Yr(t) {
|
|
|
3501
3509
|
}
|
|
3502
3510
|
},
|
|
3503
3511
|
children: n.children
|
|
3504
|
-
}, _ =
|
|
3512
|
+
}, _ = ci(g, 0, 0, o, d);
|
|
3505
3513
|
e.push({
|
|
3506
3514
|
width: o,
|
|
3507
3515
|
height: d,
|
|
@@ -3519,44 +3527,44 @@ function Yr(t) {
|
|
|
3519
3527
|
pages: e
|
|
3520
3528
|
};
|
|
3521
3529
|
}
|
|
3522
|
-
function
|
|
3530
|
+
function Ee(t) {
|
|
3523
3531
|
return t.replace(/\\/g, "\\\\").replace(/\(/g, "\\(").replace(/\)/g, "\\)").replace(/\r/g, "\\r").replace(/\n/g, "\\n");
|
|
3524
3532
|
}
|
|
3525
3533
|
class Kr {
|
|
3526
3534
|
constructor() {
|
|
3527
|
-
|
|
3528
|
-
|
|
3535
|
+
on(this, "objects", [null]);
|
|
3536
|
+
on(this, "offsets", [0]);
|
|
3529
3537
|
}
|
|
3530
3538
|
addObject(e) {
|
|
3531
3539
|
return this.objects.push(e), this.objects.length - 1;
|
|
3532
3540
|
}
|
|
3533
3541
|
build(e) {
|
|
3534
3542
|
const n = this.addObject(
|
|
3535
|
-
`<< /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) >>`
|
|
3536
3544
|
), i = this.addObject(
|
|
3537
3545
|
"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>"
|
|
3538
3546
|
), r = this.addObject(
|
|
3539
3547
|
"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold >>"
|
|
3540
3548
|
), o = [];
|
|
3541
|
-
for (const
|
|
3542
|
-
const
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
),
|
|
3548
|
-
`<< /Length ${
|
|
3549
|
+
for (const y of e.pages) {
|
|
3550
|
+
const b = this.renderPageContent(
|
|
3551
|
+
y.boxes,
|
|
3552
|
+
y.width,
|
|
3553
|
+
y.height,
|
|
3554
|
+
y.style
|
|
3555
|
+
), x = this.addObject(
|
|
3556
|
+
`<< /Length ${b.length} >>
|
|
3549
3557
|
stream
|
|
3550
|
-
${
|
|
3558
|
+
${b}
|
|
3551
3559
|
endstream`
|
|
3552
|
-
),
|
|
3553
|
-
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 >> >> >>`;
|
|
3554
3562
|
}
|
|
3555
|
-
const d = o.map((
|
|
3563
|
+
const d = o.map((y) => `${y} 0 R`).join(" "), u = this.addObject(
|
|
3556
3564
|
`<< /Type /Pages /Kids [${d}] /Count ${o.length} >>`
|
|
3557
3565
|
);
|
|
3558
|
-
for (const
|
|
3559
|
-
this.objects[
|
|
3566
|
+
for (const y of o)
|
|
3567
|
+
this.objects[y] = this.objects[y].replace(
|
|
3560
3568
|
"/Parent 0 0 R",
|
|
3561
3569
|
`/Parent ${u} 0 R`
|
|
3562
3570
|
);
|
|
@@ -3566,9 +3574,9 @@ endstream`
|
|
|
3566
3574
|
let g = `%PDF-1.4
|
|
3567
3575
|
`;
|
|
3568
3576
|
this.offsets = [0];
|
|
3569
|
-
for (let
|
|
3570
|
-
this.offsets[
|
|
3571
|
-
${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]}
|
|
3572
3580
|
endobj
|
|
3573
3581
|
`;
|
|
3574
3582
|
const _ = g.length;
|
|
@@ -3576,8 +3584,8 @@ endobj
|
|
|
3576
3584
|
0 ${this.objects.length}
|
|
3577
3585
|
`, g += `0000000000 65535 f
|
|
3578
3586
|
`;
|
|
3579
|
-
for (let
|
|
3580
|
-
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
|
|
3581
3589
|
`;
|
|
3582
3590
|
return g += `trailer
|
|
3583
3591
|
<< /Size ${this.objects.length} /Root ${m} 0 R /Info ${n} 0 R >>
|
|
@@ -3586,33 +3594,33 @@ ${_}
|
|
|
3586
3594
|
%%EOF`, new TextEncoder().encode(g);
|
|
3587
3595
|
}
|
|
3588
3596
|
renderPageContent(e, n, i, r) {
|
|
3589
|
-
const o = [], d =
|
|
3597
|
+
const o = [], d = ze(r.backgroundColor);
|
|
3590
3598
|
d && (o.push("q"), o.push(
|
|
3591
3599
|
`${d[0].toFixed(3)} ${d[1].toFixed(3)} ${d[2].toFixed(3)} rg`
|
|
3592
3600
|
), o.push(
|
|
3593
3601
|
`0 0 ${n.toFixed(2)} ${i.toFixed(2)} re f`
|
|
3594
3602
|
), o.push("Q"));
|
|
3595
3603
|
const u = (m) => {
|
|
3596
|
-
const { x: g, y: _, width:
|
|
3597
|
-
if (
|
|
3598
|
-
const
|
|
3599
|
-
o.push("q"), 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");
|
|
3600
3608
|
}
|
|
3601
|
-
if ((
|
|
3602
|
-
const
|
|
3603
|
-
o.push("q"), o.push("BT"), o.push(`/${
|
|
3604
|
-
let
|
|
3605
|
-
const
|
|
3606
|
-
|
|
3607
|
-
const
|
|
3608
|
-
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`);
|
|
3609
3617
|
}), o.push("ET"), o.push("Q");
|
|
3610
3618
|
}
|
|
3611
|
-
|
|
3612
|
-
`BT /F1 10 Tf 0.4 0.4 0.4 rg 1 0 0 1 ${(g + 8).toFixed(2)} ${(H +
|
|
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(
|
|
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`
|
|
3613
3621
|
), o.push("Q"));
|
|
3614
|
-
for (const
|
|
3615
|
-
u(
|
|
3622
|
+
for (const A of m.children)
|
|
3623
|
+
u(A);
|
|
3616
3624
|
};
|
|
3617
3625
|
for (const m of e)
|
|
3618
3626
|
u(m);
|
|
@@ -3623,66 +3631,66 @@ ${_}
|
|
|
3623
3631
|
function Zr(t) {
|
|
3624
3632
|
return new Kr().build(t);
|
|
3625
3633
|
}
|
|
3626
|
-
function
|
|
3627
|
-
const e =
|
|
3634
|
+
function fn(t) {
|
|
3635
|
+
const e = oi(t), n = Yr(e);
|
|
3628
3636
|
return Zr(n);
|
|
3629
3637
|
}
|
|
3630
3638
|
function so(t) {
|
|
3631
|
-
return
|
|
3639
|
+
return fn(t);
|
|
3632
3640
|
}
|
|
3633
|
-
function
|
|
3634
|
-
const e =
|
|
3641
|
+
function li(t) {
|
|
3642
|
+
const e = fn(t), n = new Uint8Array(e.byteLength);
|
|
3635
3643
|
return n.set(e), new Blob([n], { type: "application/pdf" });
|
|
3636
3644
|
}
|
|
3637
3645
|
function Qr(t) {
|
|
3638
|
-
return URL.createObjectURL(
|
|
3646
|
+
return URL.createObjectURL(li(t));
|
|
3639
3647
|
}
|
|
3640
3648
|
function ao(t, e = "document.pdf") {
|
|
3641
3649
|
const n = Qr(t), i = document.createElement("a");
|
|
3642
3650
|
i.href = n, i.download = e, i.click(), URL.revokeObjectURL(n);
|
|
3643
3651
|
}
|
|
3644
3652
|
async function co(t) {
|
|
3645
|
-
return
|
|
3653
|
+
return fn(t);
|
|
3646
3654
|
}
|
|
3647
3655
|
async function lo(t) {
|
|
3648
|
-
return
|
|
3656
|
+
return li(t);
|
|
3649
3657
|
}
|
|
3650
3658
|
export {
|
|
3651
3659
|
ro as ALL_TOOLBAR_TOOLS,
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3660
|
+
ti as AddText,
|
|
3661
|
+
ni as Clear,
|
|
3662
|
+
Fn as DEFAULT_TOOLBAR_LAYOUT,
|
|
3655
3663
|
Er as Document,
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
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,
|
|
3662
3670
|
Sn as Navigation,
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3671
|
+
Yn as Open,
|
|
3672
|
+
Sr as PAGE_SIZES,
|
|
3673
|
+
Hr as Page,
|
|
3666
3674
|
oo as PdfViewer,
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
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,
|
|
3683
|
+
Ur as View,
|
|
3684
|
+
Gn as Zoom,
|
|
3677
3685
|
oo as default,
|
|
3678
3686
|
ao as download,
|
|
3679
|
-
|
|
3687
|
+
Un as hexToMarkupColor,
|
|
3680
3688
|
so as pdf,
|
|
3681
3689
|
lo as renderToBlob,
|
|
3682
3690
|
co as renderToBuffer,
|
|
3683
3691
|
Gr as resolvePageSize,
|
|
3684
|
-
|
|
3685
|
-
|
|
3692
|
+
$n as setPdfWorkerSrc,
|
|
3693
|
+
li as toBlob,
|
|
3686
3694
|
Qr as toUrl
|
|
3687
3695
|
};
|
|
3688
3696
|
//# sourceMappingURL=epochs-pdf.js.map
|