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