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