@kopjra/pdf-sentinel 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
var kp = Object.defineProperty;
|
|
2
|
-
var zf = (h,
|
|
2
|
+
var zf = (h, g) => (g = Symbol[h]) ? g : Symbol.for("Symbol." + h), Hf = (h) => {
|
|
3
3
|
throw TypeError(h);
|
|
4
4
|
};
|
|
5
|
-
var Yp = (h,
|
|
6
|
-
var $f = (h,
|
|
7
|
-
var Qi = (h,
|
|
8
|
-
if (
|
|
9
|
-
typeof
|
|
5
|
+
var Yp = (h, g, o) => g in h ? kp(h, g, { enumerable: !0, configurable: !0, writable: !0, value: o }) : h[g] = o;
|
|
6
|
+
var $f = (h, g, o) => Yp(h, typeof g != "symbol" ? g + "" : g, o);
|
|
7
|
+
var Qi = (h, g, o) => {
|
|
8
|
+
if (g != null) {
|
|
9
|
+
typeof g != "object" && typeof g != "function" && Hf("Object expected");
|
|
10
10
|
var I;
|
|
11
|
-
o && (I =
|
|
11
|
+
o && (I = g[zf("asyncDispose")]), I === void 0 && (I = g[zf("dispose")]), typeof I != "function" && Hf("Object not disposable"), h.push([o, I, g]);
|
|
12
12
|
} else o && h.push([o]);
|
|
13
|
-
return
|
|
14
|
-
}, ji = (h,
|
|
15
|
-
var I = typeof SuppressedError == "function" ? SuppressedError : function(_,
|
|
16
|
-
return O = Error(b), O.name = "SuppressedError", O.error = _, O.suppressed =
|
|
17
|
-
}, x = (_) =>
|
|
13
|
+
return g;
|
|
14
|
+
}, ji = (h, g, o) => {
|
|
15
|
+
var I = typeof SuppressedError == "function" ? SuppressedError : function(_, d, b, O) {
|
|
16
|
+
return O = Error(b), O.name = "SuppressedError", O.error = _, O.suppressed = d, O;
|
|
17
|
+
}, x = (_) => g = o ? new I(_, g, "An error was suppressed during disposal") : (o = !0, _), T = (_) => {
|
|
18
18
|
for (; _ = h.pop(); )
|
|
19
19
|
try {
|
|
20
|
-
var
|
|
21
|
-
if (_[0]) return Promise.resolve(
|
|
20
|
+
var d = _[1] && _[1].call(_[2]);
|
|
21
|
+
if (_[0]) return Promise.resolve(d).then(T, (b) => (x(b), T()));
|
|
22
22
|
} catch (b) {
|
|
23
23
|
x(b);
|
|
24
24
|
}
|
|
25
|
-
if (o) throw
|
|
25
|
+
if (o) throw g;
|
|
26
26
|
};
|
|
27
27
|
return T();
|
|
28
28
|
};
|
|
@@ -44,25 +44,25 @@ import { useAnnotation as S0, AnnotationLayer as R0, useAnnotationCapability as
|
|
|
44
44
|
import { PDF_FORM_FIELD_TYPE as Wn, PdfAnnotationSubtype as Ke, PDF_FORM_FIELD_FLAG as qf, PdfPageFlattenFlag as N0 } from "@embedpdf/models";
|
|
45
45
|
import { readString as bt } from "@embedpdf/engines";
|
|
46
46
|
import { createPluginRegistration as ae } from "@embedpdf/core";
|
|
47
|
-
function F0(h,
|
|
47
|
+
function F0(h, g) {
|
|
48
48
|
try {
|
|
49
|
-
return h.FPDFAnnot_HasKey(
|
|
49
|
+
return h.FPDFAnnot_HasKey(g, "V") === !0;
|
|
50
50
|
} catch (o) {
|
|
51
51
|
return console.warn("Error checking signature V key:", o), !1;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
function b0(h) {
|
|
55
|
-
h.executor && (h.executor.readPdfWidgetAnnoField = function(
|
|
55
|
+
h.executor && (h.executor.readPdfWidgetAnnoField = function(g, o) {
|
|
56
56
|
const I = this.pdfiumModule.FPDFAnnot_GetFormFieldFlags(
|
|
57
|
-
|
|
57
|
+
g,
|
|
58
58
|
o
|
|
59
59
|
), x = this.pdfiumModule.FPDFAnnot_GetFormFieldType(
|
|
60
|
-
|
|
60
|
+
g,
|
|
61
61
|
o
|
|
62
62
|
), T = bt(
|
|
63
63
|
this.pdfiumModule.pdfium,
|
|
64
64
|
(P, M) => this.pdfiumModule.FPDFAnnot_GetFormFieldName(
|
|
65
|
-
|
|
65
|
+
g,
|
|
66
66
|
o,
|
|
67
67
|
P,
|
|
68
68
|
M
|
|
@@ -71,16 +71,16 @@ function b0(h) {
|
|
|
71
71
|
), _ = bt(
|
|
72
72
|
this.pdfiumModule.pdfium,
|
|
73
73
|
(P, M) => this.pdfiumModule.FPDFAnnot_GetFormFieldAlternateName(
|
|
74
|
-
|
|
74
|
+
g,
|
|
75
75
|
o,
|
|
76
76
|
P,
|
|
77
77
|
M
|
|
78
78
|
),
|
|
79
79
|
this.pdfiumModule.pdfium.UTF16ToString
|
|
80
|
-
),
|
|
80
|
+
), d = bt(
|
|
81
81
|
this.pdfiumModule.pdfium,
|
|
82
82
|
(P, M) => this.pdfiumModule.FPDFAnnot_GetFormFieldValue(
|
|
83
|
-
|
|
83
|
+
g,
|
|
84
84
|
o,
|
|
85
85
|
P,
|
|
86
86
|
M
|
|
@@ -88,12 +88,12 @@ function b0(h) {
|
|
|
88
88
|
this.pdfiumModule.pdfium.UTF16ToString
|
|
89
89
|
), b = [];
|
|
90
90
|
if (x === Wn.COMBOBOX || x === Wn.LISTBOX) {
|
|
91
|
-
const P = this.pdfiumModule.FPDFAnnot_GetOptionCount(
|
|
91
|
+
const P = this.pdfiumModule.FPDFAnnot_GetOptionCount(g, o);
|
|
92
92
|
for (let M = 0; M < P; M++) {
|
|
93
93
|
const on = bt(
|
|
94
94
|
this.pdfiumModule.pdfium,
|
|
95
95
|
(Z, fn) => this.pdfiumModule.FPDFAnnot_GetOptionLabel(
|
|
96
|
-
|
|
96
|
+
g,
|
|
97
97
|
o,
|
|
98
98
|
M,
|
|
99
99
|
Z,
|
|
@@ -101,7 +101,7 @@ function b0(h) {
|
|
|
101
101
|
),
|
|
102
102
|
this.pdfiumModule.pdfium.UTF16ToString
|
|
103
103
|
), q = this.pdfiumModule.FPDFAnnot_IsOptionSelected(
|
|
104
|
-
|
|
104
|
+
g,
|
|
105
105
|
o,
|
|
106
106
|
M
|
|
107
107
|
);
|
|
@@ -112,10 +112,10 @@ function b0(h) {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
let O = !1, N = "";
|
|
115
|
-
(x === Wn.CHECKBOX || x === Wn.RADIOBUTTON) && (O = this.pdfiumModule.FPDFAnnot_IsChecked(
|
|
115
|
+
(x === Wn.CHECKBOX || x === Wn.RADIOBUTTON) && (O = this.pdfiumModule.FPDFAnnot_IsChecked(g, o), N = bt(
|
|
116
116
|
this.pdfiumModule.pdfium,
|
|
117
117
|
(P, M) => this.pdfiumModule.FPDFAnnot_GetFormFieldExportValue(
|
|
118
|
-
|
|
118
|
+
g,
|
|
119
119
|
o,
|
|
120
120
|
P,
|
|
121
121
|
M
|
|
@@ -128,7 +128,7 @@ function b0(h) {
|
|
|
128
128
|
type: x,
|
|
129
129
|
name: T,
|
|
130
130
|
alternateName: _,
|
|
131
|
-
value:
|
|
131
|
+
value: d,
|
|
132
132
|
isChecked: O,
|
|
133
133
|
options: b,
|
|
134
134
|
exportValue: N,
|
|
@@ -140,31 +140,31 @@ function nu() {
|
|
|
140
140
|
return /* @__PURE__ */ S("div", { className: "pdf-spinner", children: /* @__PURE__ */ S("div", { className: "pdf-spinner__circle" }) });
|
|
141
141
|
}
|
|
142
142
|
class Lr {
|
|
143
|
-
constructor(
|
|
143
|
+
constructor(g) {
|
|
144
144
|
$f(this, "field");
|
|
145
|
-
this.field =
|
|
145
|
+
this.field = g;
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
function C0(h,
|
|
148
|
+
function C0(h, g, o, I = 30, x = 1) {
|
|
149
149
|
const T = document.createElement("canvas"), _ = T.getContext("2d");
|
|
150
|
-
let
|
|
150
|
+
let d = I, b = 1;
|
|
151
151
|
if (!_) return 18;
|
|
152
|
-
for (;
|
|
153
|
-
_.font = `bold ${
|
|
152
|
+
for (; d > x; ) {
|
|
153
|
+
_.font = `bold ${d}px Lato, sans-serif`;
|
|
154
154
|
const O = _.measureText(h), N = O.width, R = O.actualBoundingBoxAscent + O.actualBoundingBoxDescent, P = R * 1.4;
|
|
155
|
-
if (b = Math.min(
|
|
156
|
-
|
|
155
|
+
if (b = Math.min(g / N, o / P), N <= g && R <= o) break;
|
|
156
|
+
d -= 1;
|
|
157
157
|
}
|
|
158
|
-
return T.remove(),
|
|
158
|
+
return T.remove(), d * b;
|
|
159
159
|
}
|
|
160
160
|
class y0 extends Lr {
|
|
161
|
-
constructor(
|
|
162
|
-
super(
|
|
161
|
+
constructor(g) {
|
|
162
|
+
super(g);
|
|
163
163
|
}
|
|
164
|
-
render({ value:
|
|
164
|
+
render({ value: g, onChange: o, style: I, key: x, hasError: T, readonly: _ }) {
|
|
165
165
|
if (_) {
|
|
166
|
-
const
|
|
167
|
-
return /* @__PURE__ */ S("div", { className: "pdf-form-input-ro", style: { ...I, fontSize:
|
|
166
|
+
const d = C0(String(g) || "", Number(I.width), Number(I.height));
|
|
167
|
+
return /* @__PURE__ */ S("div", { className: "pdf-form-input-ro", style: { ...I, fontSize: d }, children: g }, x);
|
|
168
168
|
} else
|
|
169
169
|
return /* @__PURE__ */ S(
|
|
170
170
|
"input",
|
|
@@ -172,21 +172,21 @@ class y0 extends Lr {
|
|
|
172
172
|
name: this.field.name,
|
|
173
173
|
className: `pdf-form-input ${T ? "error" : ""}`,
|
|
174
174
|
style: { ...I, lineHeight: I.height, fontSize: Math.min(Number(I.height) * 0.6, 18) },
|
|
175
|
-
value: String(
|
|
176
|
-
onChange: (
|
|
175
|
+
value: String(g || ""),
|
|
176
|
+
onChange: (d) => o(this.handleChange(d.target.value))
|
|
177
177
|
},
|
|
178
178
|
x
|
|
179
179
|
);
|
|
180
180
|
}
|
|
181
|
-
handleChange(
|
|
182
|
-
return String(
|
|
181
|
+
handleChange(g) {
|
|
182
|
+
return String(g);
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
class M0 extends Lr {
|
|
186
|
-
constructor(
|
|
187
|
-
super(
|
|
186
|
+
constructor(g) {
|
|
187
|
+
super(g);
|
|
188
188
|
}
|
|
189
|
-
render({ value:
|
|
189
|
+
render({ value: g, onChange: o, style: I, key: x, hasError: T, readonly: _ }) {
|
|
190
190
|
return /* @__PURE__ */ S(
|
|
191
191
|
"input",
|
|
192
192
|
{
|
|
@@ -195,22 +195,22 @@ class M0 extends Lr {
|
|
|
195
195
|
disabled: _,
|
|
196
196
|
className: `pdf-form-checkbox ${T ? "error" : ""}`,
|
|
197
197
|
style: { ...I },
|
|
198
|
-
checked: !!
|
|
199
|
-
onChange: (
|
|
198
|
+
checked: !!g,
|
|
199
|
+
onChange: (d) => o(this.handleChange(d.target.checked))
|
|
200
200
|
},
|
|
201
201
|
x
|
|
202
202
|
);
|
|
203
203
|
}
|
|
204
|
-
handleChange(
|
|
205
|
-
return !!
|
|
204
|
+
handleChange(g) {
|
|
205
|
+
return !!g;
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
class D0 extends Lr {
|
|
209
|
-
constructor(
|
|
210
|
-
super(
|
|
209
|
+
constructor(g) {
|
|
210
|
+
super(g);
|
|
211
211
|
}
|
|
212
|
-
render({ value:
|
|
213
|
-
const
|
|
212
|
+
render({ value: g, onChange: o, style: I, key: x, hasError: T, readonly: _ }) {
|
|
213
|
+
const d = this.field.radioValue || "";
|
|
214
214
|
return /* @__PURE__ */ S(
|
|
215
215
|
"input",
|
|
216
216
|
{
|
|
@@ -219,15 +219,15 @@ class D0 extends Lr {
|
|
|
219
219
|
disabled: _,
|
|
220
220
|
className: `pdf-form-radio ${T ? "error" : ""}`,
|
|
221
221
|
style: { ...I },
|
|
222
|
-
value:
|
|
223
|
-
checked:
|
|
224
|
-
onChange: () => o(this.handleChange(
|
|
222
|
+
value: d,
|
|
223
|
+
checked: g === d,
|
|
224
|
+
onChange: () => o(this.handleChange(d))
|
|
225
225
|
},
|
|
226
226
|
x
|
|
227
227
|
);
|
|
228
228
|
}
|
|
229
|
-
handleChange(
|
|
230
|
-
return String(
|
|
229
|
+
handleChange(g) {
|
|
230
|
+
return String(g);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
var z = /* @__PURE__ */ ((h) => (h.EMAIL = "EMAIL", h.FULLNAME = "FULLNAME", h.PHONE = "PHONE", h.DATE = "DATE", h.SIGNATURE = "SIGNATURE", h.CONDITIONAL_SIGNATURE = "CONDITIONAL_SIGNATURE", h.CUSTOM = "CUSTOM", h))(z || {});
|
|
@@ -319,16 +319,16 @@ const Kf = {
|
|
|
319
319
|
}
|
|
320
320
|
}, rs = ou(null);
|
|
321
321
|
let iu;
|
|
322
|
-
const is = ({ locale: h = "en", translations:
|
|
322
|
+
const is = ({ locale: h = "en", translations: g = {}, children: o }) => {
|
|
323
323
|
const I = yt(() => {
|
|
324
324
|
const T = {};
|
|
325
|
-
return (/* @__PURE__ */ new Set([...Object.keys(Kf), ...Object.keys(
|
|
326
|
-
T[
|
|
327
|
-
...Kf[
|
|
328
|
-
...d
|
|
325
|
+
return (/* @__PURE__ */ new Set([...Object.keys(Kf), ...Object.keys(g)])).forEach((d) => {
|
|
326
|
+
T[d] = {
|
|
327
|
+
...Kf[d] || {},
|
|
328
|
+
...g[d] || {}
|
|
329
329
|
};
|
|
330
330
|
}), T;
|
|
331
|
-
}, [
|
|
331
|
+
}, [g]), x = (T, ..._) => {
|
|
332
332
|
const b = (I[h] || I.en || {})[T] ?? T;
|
|
333
333
|
return _.length ? _.reduce((O, N) => O.replace(new RegExp("%s"), N), b) : b;
|
|
334
334
|
};
|
|
@@ -336,13 +336,13 @@ const is = ({ locale: h = "en", translations: d = {}, children: o }) => {
|
|
|
336
336
|
};
|
|
337
337
|
function fu() {
|
|
338
338
|
const h = Jf(rs);
|
|
339
|
-
return h || (iu ? { t: iu } : { t: (
|
|
339
|
+
return h || (iu ? { t: iu } : { t: (g) => g });
|
|
340
340
|
}
|
|
341
341
|
function U0(h) {
|
|
342
342
|
const o = h.length;
|
|
343
343
|
return [...h.toLowerCase()].reduce((I, x, T) => {
|
|
344
|
-
const _ = x.charCodeAt(0) - 96,
|
|
345
|
-
return I + _ *
|
|
344
|
+
const _ = x.charCodeAt(0) - 96, d = Math.pow(26, o - T - 1);
|
|
345
|
+
return I + _ * d;
|
|
346
346
|
}, 0);
|
|
347
347
|
}
|
|
348
348
|
function W0(h) {
|
|
@@ -352,7 +352,7 @@ function W0(h) {
|
|
|
352
352
|
border: "rgba(65, 158, 216, 1)",
|
|
353
353
|
text: "rgba(65, 158, 216, 1)"
|
|
354
354
|
};
|
|
355
|
-
const
|
|
355
|
+
const g = [
|
|
356
356
|
// Group 4: Cyan-Green
|
|
357
357
|
{ background: "rgba(75, 170, 220, 0.2)", border: "rgba(60, 177, 195, 1)", text: "rgba(60, 177, 195, 1)" },
|
|
358
358
|
// Group 5: Sky Blue
|
|
@@ -363,17 +363,17 @@ function W0(h) {
|
|
|
363
363
|
{ background: "rgba(145, 125, 235, 0.2)", border: "rgba(130, 130, 211, 1)", text: "rgba(130, 130, 211, 1)" },
|
|
364
364
|
// Group 14: Steel-Amber (yellow-tinted)
|
|
365
365
|
{ background: "rgba(135, 150, 200, 0.2)", border: "rgba(120, 157, 175, 1)", text: "rgba(120, 157, 175, 1)" }
|
|
366
|
-
], I = U0(h) %
|
|
367
|
-
return
|
|
366
|
+
], I = U0(h) % g.length;
|
|
367
|
+
return g[I];
|
|
368
368
|
}
|
|
369
369
|
class B0 extends Lr {
|
|
370
|
-
constructor(
|
|
371
|
-
super(
|
|
370
|
+
constructor(g) {
|
|
371
|
+
super(g);
|
|
372
372
|
}
|
|
373
|
-
render({ value:
|
|
374
|
-
const { t: T } = fu(), _ = W0(this.field.conditionalIndex),
|
|
373
|
+
render({ value: g, onChange: o, style: I, key: x }) {
|
|
374
|
+
const { t: T } = fu(), _ = W0(this.field.conditionalIndex), d = this.field.conditionalIndex, b = Number(I.width), O = Number(I.height);
|
|
375
375
|
let N;
|
|
376
|
-
if (
|
|
376
|
+
if (d) {
|
|
377
377
|
const R = O * 0.13, P = b * 0.06;
|
|
378
378
|
N = Math.min(R, P, 16);
|
|
379
379
|
} else {
|
|
@@ -387,7 +387,7 @@ class B0 extends Lr {
|
|
|
387
387
|
style: {
|
|
388
388
|
...I,
|
|
389
389
|
fontSize: N,
|
|
390
|
-
lineHeight:
|
|
390
|
+
lineHeight: d ? 1.5 : 1,
|
|
391
391
|
backgroundColor: _.background,
|
|
392
392
|
borderColor: _.border,
|
|
393
393
|
color: _.text
|
|
@@ -402,15 +402,15 @@ class B0 extends Lr {
|
|
|
402
402
|
x
|
|
403
403
|
);
|
|
404
404
|
}
|
|
405
|
-
handleChange(
|
|
406
|
-
return String(
|
|
405
|
+
handleChange(g) {
|
|
406
|
+
return String(g || "");
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
async function* us(h,
|
|
409
|
+
async function* us(h, g, o = {}, I = [], x, T = !1) {
|
|
410
410
|
var _;
|
|
411
411
|
try {
|
|
412
|
-
for (const
|
|
413
|
-
const b = await
|
|
412
|
+
for (const d of h.pages) {
|
|
413
|
+
const b = await g.getPageAnnotations(h, d).toPromise(), O = d.index;
|
|
414
414
|
let N = 0;
|
|
415
415
|
for (const R of b) {
|
|
416
416
|
if (R.type === Ke.WIDGET) {
|
|
@@ -449,32 +449,32 @@ async function* us(h, d, o = {}, I = [], x, T = !1) {
|
|
|
449
449
|
N++;
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
} catch (
|
|
453
|
-
console.error(
|
|
452
|
+
} catch (d) {
|
|
453
|
+
console.error(d);
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
456
|
function G0(h) {
|
|
457
457
|
return h.type === Ke.WIDGET ? h.field.type === Wn.CHECKBOX || h.field.type === Wn.XFA_CHECKBOX ? h.field.isChecked : h.field.value !== void 0 && h.field.value !== "" : !1;
|
|
458
458
|
}
|
|
459
|
-
async function z0(h,
|
|
459
|
+
async function z0(h, g, o, I, x, T) {
|
|
460
460
|
var O;
|
|
461
|
-
const _ = [],
|
|
462
|
-
if (!x || !T) return { fields: _, values:
|
|
461
|
+
const _ = [], d = {};
|
|
462
|
+
if (!x || !T) return { fields: _, values: d };
|
|
463
463
|
const b = T.getDocument(h);
|
|
464
|
-
if (!b) return { fields: _, values:
|
|
464
|
+
if (!b) return { fields: _, values: d };
|
|
465
465
|
try {
|
|
466
466
|
for await (const {
|
|
467
467
|
field: N,
|
|
468
468
|
annotation: R
|
|
469
|
-
} of us(b, x,
|
|
469
|
+
} of us(b, x, g, o, I))
|
|
470
470
|
if (_.push(N), R.type === Ke.WIDGET && R.field.value !== void 0) {
|
|
471
|
-
const P = (O =
|
|
472
|
-
N.type === "checkbox" ?
|
|
471
|
+
const P = (O = g[N.name]) == null ? void 0 : O.value;
|
|
472
|
+
N.type === "checkbox" ? d[N.name] = P !== void 0 ? P : R.field.isChecked : N.type === "radiobutton" ? (P === N.radioValue && N.radioValue !== void 0 || R.field.isChecked && N.radioValue !== void 0) && (d[N.name] = N.radioValue) : d[N.name] = P !== void 0 ? P : R.field.value;
|
|
473
473
|
}
|
|
474
474
|
} catch (N) {
|
|
475
475
|
console.error(N);
|
|
476
476
|
}
|
|
477
|
-
return { fields: _, values:
|
|
477
|
+
return { fields: _, values: d };
|
|
478
478
|
}
|
|
479
479
|
function H0(h) {
|
|
480
480
|
switch (h) {
|
|
@@ -493,7 +493,7 @@ function H0(h) {
|
|
|
493
493
|
return;
|
|
494
494
|
}
|
|
495
495
|
}
|
|
496
|
-
function $0(h,
|
|
496
|
+
function $0(h, g, o = [], I, x, T, _, d) {
|
|
497
497
|
const b = Me([]), [O, N] = mn(b.current), R = Me({}), [P, M] = mn(R.current), [on, q] = mn({}), [Z, fn] = mn(!1), y = es(h), W = Tn(async () => {
|
|
498
498
|
if (!x || !T) {
|
|
499
499
|
N([]);
|
|
@@ -501,12 +501,12 @@ function $0(h, d, o = [], I, x, T, _, g) {
|
|
|
501
501
|
}
|
|
502
502
|
if (T.getDocument(h))
|
|
503
503
|
try {
|
|
504
|
-
const { fields: Y, values: F } = await z0(h,
|
|
504
|
+
const { fields: Y, values: F } = await z0(h, g, o, I, x, T);
|
|
505
505
|
b.current = Y, N(b.current), R.current = { ...R.current, ...F }, M(R.current);
|
|
506
506
|
} catch {
|
|
507
507
|
N([]);
|
|
508
508
|
}
|
|
509
|
-
}, [
|
|
509
|
+
}, [g, x]);
|
|
510
510
|
Ln(() => {
|
|
511
511
|
W();
|
|
512
512
|
const tn = T == null ? void 0 : T.onDocumentOpened(() => {
|
|
@@ -528,11 +528,11 @@ function $0(h, d, o = [], I, x, T, _, g) {
|
|
|
528
528
|
if (nn) {
|
|
529
529
|
_.scrollToPage({ pageNumber: nn.pageIndex + 1, behavior: "smooth" });
|
|
530
530
|
const ln = (y == null ? void 0 : y.scale) || 1, Nn = nn.pageIndex * (((cn = (F = y == null ? void 0 : y.document) == null ? void 0 : F.pages[nn.pageIndex]) == null ? void 0 : cn.size.height) || 0);
|
|
531
|
-
|
|
531
|
+
d == null || d.scrollTo({ x: nn.bbox.x * ln, y: nn.bbox.y * ln + Nn * ln, behavior: "smooth" });
|
|
532
532
|
}
|
|
533
533
|
}
|
|
534
534
|
return { valid: Object.keys(Y).length === 0, errors: Y };
|
|
535
|
-
}, [_,
|
|
535
|
+
}, [_, d, q, y]), j = Tn((tn, Y) => {
|
|
536
536
|
R.current = { ...R.current, [tn]: Y }, M(R.current), Z && J(!0);
|
|
537
537
|
}, [M, J, Z]), gn = Tn(() => {
|
|
538
538
|
W();
|
|
@@ -540,14 +540,14 @@ function $0(h, d, o = [], I, x, T, _, g) {
|
|
|
540
540
|
var Y, F;
|
|
541
541
|
for (; ; )
|
|
542
542
|
for (const cn of b.current.filter((nn) => nn.type === "signature" && nn.conditionalIndex === tn)) {
|
|
543
|
-
if (_ &&
|
|
543
|
+
if (_ && d) {
|
|
544
544
|
_.scrollToPage({ pageNumber: cn.pageIndex + 1, behavior: "smooth" });
|
|
545
545
|
const nn = (y == null ? void 0 : y.scale) || 1, ln = cn.pageIndex * (((F = (Y = y == null ? void 0 : y.document) == null ? void 0 : Y.pages[cn.pageIndex]) == null ? void 0 : F.size.height) || 0);
|
|
546
|
-
|
|
546
|
+
d == null || d.scrollTo({ x: cn.bbox.x * nn, y: cn.bbox.y * nn + ln * nn, behavior: "smooth" });
|
|
547
547
|
}
|
|
548
548
|
yield cn;
|
|
549
549
|
}
|
|
550
|
-
}, [_,
|
|
550
|
+
}, [_, d, y == null ? void 0 : y.scale]);
|
|
551
551
|
return yt(() => ({
|
|
552
552
|
fields: O,
|
|
553
553
|
values: P,
|
|
@@ -557,22 +557,22 @@ function $0(h, d, o = [], I, x, T, _, g) {
|
|
|
557
557
|
errors: on,
|
|
558
558
|
showErrors: Z,
|
|
559
559
|
scrollToConditionalSignature: D
|
|
560
|
-
}), [P, O, j, J, gn, on, _,
|
|
560
|
+
}), [P, O, j, J, gn, on, _, d, Z]);
|
|
561
561
|
}
|
|
562
562
|
const os = ou(null), q0 = (h) => {
|
|
563
|
-
const { children:
|
|
563
|
+
const { children: g, setForm: o, initialValues: I, documentId: x, conditionalSignatures: T, signatureFieldNames: _ } = h, { engine: d } = ns(), { provides: b } = f0(), { provides: O } = r0(), { provides: N } = jp(), R = $0(x, I, T, _, d, b, O, N);
|
|
564
564
|
return Ln(() => {
|
|
565
565
|
o(R);
|
|
566
|
-
}, [R]), /* @__PURE__ */ S(os.Provider, { value: R, children:
|
|
566
|
+
}, [R]), /* @__PURE__ */ S(os.Provider, { value: R, children: g });
|
|
567
567
|
};
|
|
568
568
|
function K0() {
|
|
569
569
|
return Jf(os);
|
|
570
570
|
}
|
|
571
|
-
const Z0 = ({ documentId: h, pageIndex:
|
|
571
|
+
const Z0 = ({ documentId: h, pageIndex: g }) => {
|
|
572
572
|
const [, o] = mn(0), I = K0();
|
|
573
573
|
if (!I)
|
|
574
574
|
return null;
|
|
575
|
-
const x = es(h), { values: T, errors: _, fields:
|
|
575
|
+
const x = es(h), { values: T, errors: _, fields: d, setValue: b, showErrors: O } = I, N = Tn((P) => ({
|
|
576
576
|
left: P.bbox.x * ((x == null ? void 0 : x.scale) || 1),
|
|
577
577
|
top: P.bbox.y * ((x == null ? void 0 : x.scale) || 1),
|
|
578
578
|
width: P.bbox.width * ((x == null ? void 0 : x.scale) || 1),
|
|
@@ -580,7 +580,7 @@ const Z0 = ({ documentId: h, pageIndex: d }) => {
|
|
|
580
580
|
}), [x == null ? void 0 : x.scale]), R = Tn((P, M) => {
|
|
581
581
|
b(P, M), o((on) => on + 1);
|
|
582
582
|
}, [b]);
|
|
583
|
-
return
|
|
583
|
+
return d.length ? /* @__PURE__ */ S("div", { className: `pdf-forms-layer${O && _ && Object.keys(_).length > 0 ? " pdf-forms-error" : ""}`, style: { position: "absolute", top: 0, left: 0, width: "100%", height: "100%" }, children: d.filter((P) => P.pageIndex === g).map((P) => {
|
|
584
584
|
const M = N(P);
|
|
585
585
|
if (!M) return null;
|
|
586
586
|
const on = T[P.name], q = `${P.pageIndex}-${P.name}-${P.radioValue || ""}`, Z = O && _ && _[P.name], fn = {
|
|
@@ -626,9 +626,9 @@ var Ct = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
626
626
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
627
627
|
*/
|
|
628
628
|
Or.exports;
|
|
629
|
-
(function(h,
|
|
629
|
+
(function(h, g) {
|
|
630
630
|
(function() {
|
|
631
|
-
var o, I = "4.17.21", x = 200, T = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", _ = "Expected a function",
|
|
631
|
+
var o, I = "4.17.21", x = 200, T = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", _ = "Expected a function", d = "Invalid `variable` option passed into `_.template`", b = "__lodash_hash_undefined__", O = 500, N = "__lodash_placeholder__", R = 1, P = 2, M = 4, on = 1, q = 2, Z = 1, fn = 2, y = 4, W = 8, J = 16, j = 32, gn = 64, D = 128, tn = 256, Y = 512, F = 30, cn = "...", nn = 800, ln = 16, Nn = 1, Ze = 2, Xe = 3, Bn = 1 / 0, Gn = 9007199254740991, zn = 17976931348623157e292, Se = NaN, Hn = 4294967295, ce = Hn - 1, Nr = Hn >>> 1, ss = [
|
|
632
632
|
["ary", D],
|
|
633
633
|
["bind", Z],
|
|
634
634
|
["bindKey", fn],
|
|
@@ -894,7 +894,7 @@ Or.exports;
|
|
|
894
894
|
"\r": "r",
|
|
895
895
|
"\u2028": "u2028",
|
|
896
896
|
"\u2029": "u2029"
|
|
897
|
-
}, gl = parseFloat, pl = parseInt, bu = typeof Ct == "object" && Ct && Ct.Object === Object && Ct, _l = typeof self == "object" && self && self.Object === Object && self, Sn = bu || _l || Function("return this")(), Xr =
|
|
897
|
+
}, gl = parseFloat, pl = parseInt, bu = typeof Ct == "object" && Ct && Ct.Object === Object && Ct, _l = typeof self == "object" && self && self.Object === Object && self, Sn = bu || _l || Function("return this")(), Xr = g && !g.nodeType && g, De = Xr && !0 && h && !h.nodeType && h, Cu = De && De.exports === Xr, kr = Cu && bu.process, Vn = function() {
|
|
898
898
|
try {
|
|
899
899
|
var a = De && De.require && De.require("util").types;
|
|
900
900
|
return a || kr && kr.binding && kr.binding("util");
|
|
@@ -3942,7 +3942,7 @@ __p += '`), en && (A += `' +
|
|
|
3942
3942
|
}
|
|
3943
3943
|
`;
|
|
3944
3944
|
else if (Fs.test(B))
|
|
3945
|
-
throw new H(
|
|
3945
|
+
throw new H(d);
|
|
3946
3946
|
A = (c ? A.replace(ps, "") : A).replace(_s, "$1").replace(vs, "$1;"), A = "function(" + (B || "obj") + `) {
|
|
3947
3947
|
` + (B ? "" : `obj || (obj = {});
|
|
3948
3948
|
`) + "var __t, __p = ''" + (l ? ", __e = _.escape" : "") + (c ? `, __j = Array.prototype.join;
|
|
@@ -4289,22 +4289,22 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
4289
4289
|
})(Or, Or.exports);
|
|
4290
4290
|
Or.exports;
|
|
4291
4291
|
function X0(h) {
|
|
4292
|
-
const
|
|
4293
|
-
return crypto.getRandomValues(
|
|
4292
|
+
const g = new Uint8Array(h);
|
|
4293
|
+
return crypto.getRandomValues(g), g;
|
|
4294
4294
|
}
|
|
4295
4295
|
function k0() {
|
|
4296
4296
|
return crypto.randomUUID();
|
|
4297
4297
|
}
|
|
4298
4298
|
function Zf(h = 10) {
|
|
4299
|
-
const
|
|
4300
|
-
return Array.from(
|
|
4299
|
+
const g = X0(Math.ceil(h / 2));
|
|
4300
|
+
return Array.from(g).map((o) => o.toString(16).padStart(2, "0")).join("").slice(0, h);
|
|
4301
4301
|
}
|
|
4302
4302
|
const Y0 = {
|
|
4303
4303
|
text: z.CUSTOM,
|
|
4304
4304
|
signature: z.SIGNATURE
|
|
4305
4305
|
};
|
|
4306
|
-
async function Xf(h,
|
|
4307
|
-
const I = await o.openDocumentBuffer({ id: h, content:
|
|
4306
|
+
async function Xf(h, g, o) {
|
|
4307
|
+
const I = await o.openDocumentBuffer({ id: h, content: g }).toPromise();
|
|
4308
4308
|
return {
|
|
4309
4309
|
resource: I,
|
|
4310
4310
|
async [Symbol.asyncDispose]() {
|
|
@@ -4313,43 +4313,43 @@ async function Xf(h, d, o) {
|
|
|
4313
4313
|
};
|
|
4314
4314
|
}
|
|
4315
4315
|
async function V0(h) {
|
|
4316
|
-
const
|
|
4317
|
-
if (!
|
|
4318
|
-
throw new Error(`Failed to fetch file from URL: ${
|
|
4319
|
-
return await
|
|
4316
|
+
const g = await fetch(h);
|
|
4317
|
+
if (!g.ok)
|
|
4318
|
+
throw new Error(`Failed to fetch file from URL: ${g.status} ${g.statusText}`);
|
|
4319
|
+
return await g.arrayBuffer();
|
|
4320
4320
|
}
|
|
4321
|
-
async function J0(h,
|
|
4321
|
+
async function J0(h, g) {
|
|
4322
4322
|
var b;
|
|
4323
|
-
const o =
|
|
4323
|
+
const o = g.executor;
|
|
4324
4324
|
if (!o || !o.pdfiumModule)
|
|
4325
4325
|
throw new Error("Cannot access PDFium module from engine");
|
|
4326
4326
|
const I = o.pdfiumModule, x = (b = o.cache) == null ? void 0 : b.docs, T = x == null ? void 0 : x.get(h.id);
|
|
4327
4327
|
if (!T)
|
|
4328
4328
|
throw new Error("Document context not found");
|
|
4329
|
-
const _ = T.docPtr,
|
|
4330
|
-
if (!
|
|
4329
|
+
const _ = T.docPtr, d = I.FPDF_CreateNewDocument();
|
|
4330
|
+
if (!d)
|
|
4331
4331
|
throw new Error("Failed to create new PDF document");
|
|
4332
4332
|
try {
|
|
4333
4333
|
const O = h.pageCount, N = O > 0 ? `1-${O}` : "";
|
|
4334
|
-
if (!I.FPDF_ImportPages(
|
|
4334
|
+
if (!I.FPDF_ImportPages(d, _, N, 0))
|
|
4335
4335
|
throw new Error("Failed to import pages to new document");
|
|
4336
|
-
return await o.saveDocument(
|
|
4336
|
+
return await o.saveDocument(d);
|
|
4337
4337
|
} finally {
|
|
4338
|
-
I.FPDF_CloseDocument(
|
|
4338
|
+
I.FPDF_CloseDocument(d);
|
|
4339
4339
|
}
|
|
4340
4340
|
}
|
|
4341
|
-
async function Q0(h,
|
|
4341
|
+
async function Q0(h, g) {
|
|
4342
4342
|
typeof h == "string" && (h = await V0(h));
|
|
4343
4343
|
try {
|
|
4344
|
-
var
|
|
4344
|
+
var d = [];
|
|
4345
4345
|
try {
|
|
4346
4346
|
const P = [];
|
|
4347
4347
|
const M = Zf();
|
|
4348
|
-
const on = Qi(
|
|
4348
|
+
const on = Qi(d, await Xf(M, h, g), !0);
|
|
4349
4349
|
const q = on.resource;
|
|
4350
4350
|
const Z = /* @__PURE__ */ new Set();
|
|
4351
4351
|
let fn = !1;
|
|
4352
|
-
for await (const { field: y, annotation: W } of us(q,
|
|
4352
|
+
for await (const { field: y, annotation: W } of us(q, g, void 0, void 0, void 0, !0)) {
|
|
4353
4353
|
const J = Y0[y.type];
|
|
4354
4354
|
if (y.type === "signature" && (fn = !0), J && !G0(W)) {
|
|
4355
4355
|
const gn = {
|
|
@@ -4362,22 +4362,22 @@ async function Q0(h, d) {
|
|
|
4362
4362
|
};
|
|
4363
4363
|
P.push(gn);
|
|
4364
4364
|
let D = q.pages[W.pageIndex];
|
|
4365
|
-
D && await
|
|
4365
|
+
D && await g.removePageAnnotation(q, D, W).toPromise();
|
|
4366
4366
|
} else
|
|
4367
4367
|
Z.add(W.pageIndex);
|
|
4368
4368
|
}
|
|
4369
4369
|
for (const y of Z) {
|
|
4370
4370
|
const W = q.pages[y];
|
|
4371
|
-
W && await
|
|
4371
|
+
W && await g.flattenPage(q, W, { flag: N0.Display }).toPromise();
|
|
4372
4372
|
}
|
|
4373
4373
|
if (fn) {
|
|
4374
4374
|
var o = [];
|
|
4375
4375
|
try {
|
|
4376
|
-
const y = await
|
|
4376
|
+
const y = await g.saveAsCopy(q).toPromise();
|
|
4377
4377
|
const W = Zf();
|
|
4378
|
-
const J = Qi(o, await Xf(W, y,
|
|
4378
|
+
const J = Qi(o, await Xf(W, y, g), !0);
|
|
4379
4379
|
const j = J.resource;
|
|
4380
|
-
const gn = await J0(j,
|
|
4380
|
+
const gn = await J0(j, g);
|
|
4381
4381
|
return { file: gn, annotations: P };
|
|
4382
4382
|
} catch (I) {
|
|
4383
4383
|
var x = I, T = !0;
|
|
@@ -4386,11 +4386,11 @@ async function Q0(h, d) {
|
|
|
4386
4386
|
_ && await _;
|
|
4387
4387
|
}
|
|
4388
4388
|
}
|
|
4389
|
-
return { file: await
|
|
4389
|
+
return { file: await g.saveAsCopy(q).toPromise(), annotations: P };
|
|
4390
4390
|
} catch (b) {
|
|
4391
4391
|
var O = b, N = !0;
|
|
4392
4392
|
} finally {
|
|
4393
|
-
var R = ji(
|
|
4393
|
+
var R = ji(d, O, N);
|
|
4394
4394
|
R && await R;
|
|
4395
4395
|
}
|
|
4396
4396
|
} catch (P) {
|
|
@@ -4405,7 +4405,7 @@ function j0(h) {
|
|
|
4405
4405
|
behavior: {
|
|
4406
4406
|
selectAfterCreate: !0
|
|
4407
4407
|
},
|
|
4408
|
-
matchScore: (
|
|
4408
|
+
matchScore: (g) => g.type === Ke.FREETEXT ? 1 : 0,
|
|
4409
4409
|
defaults: {
|
|
4410
4410
|
type: Ke.FREETEXT,
|
|
4411
4411
|
contents: "SIGNATURE",
|
|
@@ -4456,13 +4456,13 @@ function eu(h) {
|
|
|
4456
4456
|
};
|
|
4457
4457
|
}
|
|
4458
4458
|
const n_ = ou(null);
|
|
4459
|
-
function e_(h,
|
|
4459
|
+
function e_(h, g, o, I, x, T) {
|
|
4460
4460
|
return {
|
|
4461
4461
|
getAnnotations: async () => {
|
|
4462
4462
|
if (h.current) {
|
|
4463
4463
|
const _ = [];
|
|
4464
|
-
for (let
|
|
4465
|
-
const b = await h.current.getPageAnnotations({ pageIndex:
|
|
4464
|
+
for (let d = 0; d < o; d++) {
|
|
4465
|
+
const b = await h.current.getPageAnnotations({ pageIndex: d }).toPromise();
|
|
4466
4466
|
for (const O of b) {
|
|
4467
4467
|
const N = O.custom ? void 0 : h.current.getAnnotationById(O.id);
|
|
4468
4468
|
_.push(eu((N == null ? void 0 : N.object) || O));
|
|
@@ -4474,9 +4474,9 @@ function e_(h, d, o, I, x, T) {
|
|
|
4474
4474
|
},
|
|
4475
4475
|
getAnnotationById: (_) => {
|
|
4476
4476
|
if (h.current) {
|
|
4477
|
-
const
|
|
4478
|
-
if (
|
|
4479
|
-
return eu(
|
|
4477
|
+
const d = h.current.getAnnotationById(_);
|
|
4478
|
+
if (d)
|
|
4479
|
+
return eu(d.object);
|
|
4480
4480
|
}
|
|
4481
4481
|
},
|
|
4482
4482
|
addAnnotation: (_) => {
|
|
@@ -4487,22 +4487,22 @@ function e_(h, d, o, I, x, T) {
|
|
|
4487
4487
|
width: x.width,
|
|
4488
4488
|
height: x.height
|
|
4489
4489
|
}, T.current.scrollToPage({ pageNumber: _.page || 1, behavior: "smooth" }));
|
|
4490
|
-
const
|
|
4491
|
-
h.current.createAnnotation(
|
|
4490
|
+
const d = uu(_);
|
|
4491
|
+
h.current.createAnnotation(d.pageIndex, d), h.current.selectAnnotation(_.page - 1, _.id);
|
|
4492
4492
|
}
|
|
4493
4493
|
},
|
|
4494
4494
|
updateAnnotation: (_) => {
|
|
4495
4495
|
if (h.current) {
|
|
4496
|
-
const
|
|
4497
|
-
h.current.updateAnnotation(
|
|
4496
|
+
const d = uu(_);
|
|
4497
|
+
h.current.updateAnnotation(d.pageIndex, d.id, { custom: d.custom });
|
|
4498
4498
|
}
|
|
4499
4499
|
},
|
|
4500
4500
|
removeAnnotations: (_) => {
|
|
4501
|
-
h.current && h.current.deleteAnnotations(_.map((
|
|
4501
|
+
h.current && h.current.deleteAnnotations(_.map((d) => ({ pageIndex: d.page - 1, id: d.id })));
|
|
4502
4502
|
},
|
|
4503
|
-
getAnnotationsByPage: async (_) => h.current ? (await h.current.getPageAnnotations({ pageIndex: _ - 1 }).toPromise()).map((
|
|
4504
|
-
subscribe: (_) => (
|
|
4505
|
-
|
|
4503
|
+
getAnnotationsByPage: async (_) => h.current ? (await h.current.getPageAnnotations({ pageIndex: _ - 1 }).toPromise()).map((d) => eu(d)) : [],
|
|
4504
|
+
subscribe: (_) => (g.current.add(_), () => {
|
|
4505
|
+
g.current.delete(_);
|
|
4506
4506
|
}),
|
|
4507
4507
|
selectAnnotations: (_) => {
|
|
4508
4508
|
h.current && h.current.setSelection(_ || []);
|
|
@@ -4511,15 +4511,15 @@ function e_(h, d, o, I, x, T) {
|
|
|
4511
4511
|
}
|
|
4512
4512
|
const t_ = Qf(({
|
|
4513
4513
|
children: h,
|
|
4514
|
-
initialAnnotations:
|
|
4514
|
+
initialAnnotations: g = [],
|
|
4515
4515
|
initialLocale: o = "en",
|
|
4516
4516
|
setAnnotationsApi: I,
|
|
4517
4517
|
documentId: x,
|
|
4518
4518
|
defaultSize: T,
|
|
4519
4519
|
defaultType: _
|
|
4520
|
-
},
|
|
4520
|
+
}, d) => {
|
|
4521
4521
|
const b = Me(/* @__PURE__ */ new Set()), [O, N] = mn(o), { provides: R, state: { selectedUids: P, pages: M } } = S0(x), [on, q] = mn(!1), { provides: Z } = ts(x), fn = Me(Z), y = Me(R), W = Me(!1);
|
|
4522
|
-
jf(
|
|
4522
|
+
jf(d, () => ({
|
|
4523
4523
|
setLocale: (D) => N(D)
|
|
4524
4524
|
})), Ln(() => {
|
|
4525
4525
|
y.current = R;
|
|
@@ -4534,8 +4534,8 @@ const t_ = Qf(({
|
|
|
4534
4534
|
Ln(() => (I && I(j), () => {
|
|
4535
4535
|
I && I(null);
|
|
4536
4536
|
}), [j, I]), Ln(() => {
|
|
4537
|
-
if (R &&
|
|
4538
|
-
const D =
|
|
4537
|
+
if (R && g.length > 0) {
|
|
4538
|
+
const D = g.map((tn) => ({
|
|
4539
4539
|
annotation: uu(tn)
|
|
4540
4540
|
}));
|
|
4541
4541
|
R.importAnnotations(D), R.setActiveTool(fs), q(!0);
|
|
@@ -4600,14 +4600,14 @@ const t_ = Qf(({
|
|
|
4600
4600
|
CUSTOM: "#f5922f"
|
|
4601
4601
|
}, r_ = ({
|
|
4602
4602
|
selected: h,
|
|
4603
|
-
context:
|
|
4603
|
+
context: g,
|
|
4604
4604
|
documentId: o,
|
|
4605
4605
|
menuWrapperProps: I,
|
|
4606
4606
|
rect: x
|
|
4607
4607
|
}) => {
|
|
4608
|
-
const { provides: T } = P0(), _ = T == null ? void 0 : T.forDocument(o),
|
|
4608
|
+
const { provides: T } = P0(), _ = T == null ? void 0 : T.forDocument(o), d = () => {
|
|
4609
4609
|
if (!_) return;
|
|
4610
|
-
const { pageIndex: O, id: N } =
|
|
4610
|
+
const { pageIndex: O, id: N } = g.annotation.object;
|
|
4611
4611
|
_.deleteAnnotation(O, N);
|
|
4612
4612
|
};
|
|
4613
4613
|
if (!h) return null;
|
|
@@ -4622,7 +4622,7 @@ const t_ = Qf(({
|
|
|
4622
4622
|
children: /* @__PURE__ */ S(
|
|
4623
4623
|
"span",
|
|
4624
4624
|
{
|
|
4625
|
-
onClick:
|
|
4625
|
+
onClick: d,
|
|
4626
4626
|
className: "menu-action danger",
|
|
4627
4627
|
"aria-label": "Delete annotation",
|
|
4628
4628
|
title: "Delete annotation",
|
|
@@ -4641,21 +4641,23 @@ const t_ = Qf(({
|
|
|
4641
4641
|
CUSTOM: "fa-pen-circle"
|
|
4642
4642
|
}, tu = 2, u_ = ({
|
|
4643
4643
|
pageIndex: h,
|
|
4644
|
-
documentId:
|
|
4644
|
+
documentId: g
|
|
4645
4645
|
}) => {
|
|
4646
4646
|
const { t: o } = fu();
|
|
4647
4647
|
return /* @__PURE__ */ S(
|
|
4648
4648
|
R0,
|
|
4649
4649
|
{
|
|
4650
|
-
documentId:
|
|
4650
|
+
documentId: g,
|
|
4651
4651
|
pageIndex: h,
|
|
4652
|
-
selectionMenu: (I) => /* @__PURE__ */ S(r_, { ...I, documentId:
|
|
4653
|
-
|
|
4652
|
+
selectionMenu: (I) => /* @__PURE__ */ S(r_, { ...I, documentId: g }),
|
|
4653
|
+
selectionOutline: { color: "#5198F488" },
|
|
4654
4654
|
resizeUI: {
|
|
4655
4655
|
color: "#5198F488"
|
|
4656
4656
|
},
|
|
4657
4657
|
customAnnotationRenderer: ({ annotation: I, scale: x, isSelected: T, onSelect: _ }) => {
|
|
4658
|
-
const
|
|
4658
|
+
const d = I.custom;
|
|
4659
|
+
if (!d) return null;
|
|
4660
|
+
const b = d.type === z.CUSTOM ? d.name || o(z.CUSTOM) : o(d.type), O = d.assignedEmail;
|
|
4659
4661
|
return I.type === Ke.FREETEXT ? /* @__PURE__ */ Yn(
|
|
4660
4662
|
"div",
|
|
4661
4663
|
{
|
|
@@ -4664,7 +4666,7 @@ const t_ = Qf(({
|
|
|
4664
4666
|
width: (I.rect.size.width - 2 * tu) * x,
|
|
4665
4667
|
height: (I.rect.size.height - 2 * tu) * x,
|
|
4666
4668
|
borderWidth: tu * x,
|
|
4667
|
-
borderColor: Pr[
|
|
4669
|
+
borderColor: Pr[d.type] || z.SIGNATURE,
|
|
4668
4670
|
borderStyle: "solid",
|
|
4669
4671
|
cursor: T ? "move" : "pointer",
|
|
4670
4672
|
pointerEvents: T ? "none" : "auto",
|
|
@@ -4673,7 +4675,7 @@ const t_ = Qf(({
|
|
|
4673
4675
|
onPointerDown: _,
|
|
4674
4676
|
onTouchStart: _,
|
|
4675
4677
|
children: [
|
|
4676
|
-
|
|
4678
|
+
d.required && /* @__PURE__ */ S(
|
|
4677
4679
|
"i",
|
|
4678
4680
|
{
|
|
4679
4681
|
className: "fal fa-asterisk",
|
|
@@ -4684,7 +4686,7 @@ const t_ = Qf(({
|
|
|
4684
4686
|
fontSize: 10 * x,
|
|
4685
4687
|
fontWeight: "bold",
|
|
4686
4688
|
zIndex: 1e3,
|
|
4687
|
-
color: Pr[
|
|
4689
|
+
color: Pr[d.type] || z.SIGNATURE
|
|
4688
4690
|
}
|
|
4689
4691
|
}
|
|
4690
4692
|
),
|
|
@@ -4707,7 +4709,7 @@ const t_ = Qf(({
|
|
|
4707
4709
|
textWrap: "nowrap",
|
|
4708
4710
|
fontSize: 11 * x,
|
|
4709
4711
|
textTransform: "uppercase",
|
|
4710
|
-
color: Pr[
|
|
4712
|
+
color: Pr[d.type] || z.SIGNATURE,
|
|
4711
4713
|
marginTop: 5 * x,
|
|
4712
4714
|
top: 2 * x,
|
|
4713
4715
|
marginLeft: 5 * x,
|
|
@@ -4715,7 +4717,7 @@ const t_ = Qf(({
|
|
|
4715
4717
|
letterSpacing: 0.7 * x
|
|
4716
4718
|
},
|
|
4717
4719
|
children: [
|
|
4718
|
-
/* @__PURE__ */ S("i", { className: `fa ${i_[
|
|
4720
|
+
/* @__PURE__ */ S("i", { className: `fa ${i_[d.type] || "fa-signature"}` }),
|
|
4719
4721
|
" ",
|
|
4720
4722
|
b
|
|
4721
4723
|
]
|
|
@@ -4732,7 +4734,7 @@ const t_ = Qf(({
|
|
|
4732
4734
|
textOverflow: "ellipsis",
|
|
4733
4735
|
fontSize: 7 * x,
|
|
4734
4736
|
color: "#FFF",
|
|
4735
|
-
backgroundColor: Pr[
|
|
4737
|
+
backgroundColor: Pr[d.type] || z.SIGNATURE,
|
|
4736
4738
|
bottom: 0,
|
|
4737
4739
|
letterSpacing: 0.5 * x,
|
|
4738
4740
|
right: 0,
|
|
@@ -4755,10 +4757,10 @@ const t_ = Qf(({
|
|
|
4755
4757
|
);
|
|
4756
4758
|
}, o_ = ({
|
|
4757
4759
|
setCurrentPage: h,
|
|
4758
|
-
documentId:
|
|
4760
|
+
documentId: g,
|
|
4759
4761
|
setHistoryCapability: o
|
|
4760
4762
|
}) => {
|
|
4761
|
-
const { state: I } = ts(
|
|
4763
|
+
const { state: I } = ts(g);
|
|
4762
4764
|
Ln(() => {
|
|
4763
4765
|
h(I.currentPage);
|
|
4764
4766
|
}, [I.currentPage]);
|
|
@@ -4768,13 +4770,13 @@ const t_ = Qf(({
|
|
|
4768
4770
|
}, [x]), null;
|
|
4769
4771
|
}, f_ = Qf(({
|
|
4770
4772
|
plugins: h,
|
|
4771
|
-
setForm:
|
|
4773
|
+
setForm: g,
|
|
4772
4774
|
setAnnotationsApi: o,
|
|
4773
4775
|
hideToolbar: I,
|
|
4774
4776
|
setZoomCapability: x,
|
|
4775
4777
|
setExportCapability: T,
|
|
4776
4778
|
setScrollCapability: _,
|
|
4777
|
-
setCurrentPage:
|
|
4779
|
+
setCurrentPage: d,
|
|
4778
4780
|
setTotalPages: b,
|
|
4779
4781
|
documentId: O,
|
|
4780
4782
|
pdf: N,
|
|
@@ -4823,7 +4825,7 @@ const t_ = Qf(({
|
|
|
4823
4825
|
}
|
|
4824
4826
|
q.type === "annotation" && j0((Gn = Y.getPlugin(O0.id)) == null ? void 0 : Gn.provides());
|
|
4825
4827
|
}, children: ({ pluginsReady: Y, activeDocumentId: F }) => Y ? /* @__PURE__ */ Yn(Vf, { children: [
|
|
4826
|
-
/* @__PURE__ */ S(o_, { setCurrentPage:
|
|
4828
|
+
/* @__PURE__ */ S(o_, { setCurrentPage: d, documentId: O, setHistoryCapability: fn }),
|
|
4827
4829
|
/* @__PURE__ */ S("div", { style: { height: I ? "100%" : "calc(100% - 40px)", width: "100%" }, children: F && /* @__PURE__ */ S(s0, { documentId: F, children: ({ isLoading: cn, isError: nn }) => {
|
|
4828
4830
|
Ln(() => {
|
|
4829
4831
|
M(nn), P(cn), !cn && !nn && on && on();
|
|
@@ -4892,7 +4894,7 @@ const t_ = Qf(({
|
|
|
4892
4894
|
q0,
|
|
4893
4895
|
{
|
|
4894
4896
|
documentId: F,
|
|
4895
|
-
setForm:
|
|
4897
|
+
setForm: g,
|
|
4896
4898
|
initialValues: q.initialValues || {},
|
|
4897
4899
|
conditionalSignatures: q.conditionalSignatures,
|
|
4898
4900
|
signatureFieldNames: q.signatureFieldNames,
|
|
@@ -4925,25 +4927,25 @@ function Yf(h) {
|
|
|
4925
4927
|
}
|
|
4926
4928
|
function s_({
|
|
4927
4929
|
buttons: h = [],
|
|
4928
|
-
currentPage:
|
|
4930
|
+
currentPage: g,
|
|
4929
4931
|
zoomCapability: o,
|
|
4930
4932
|
scrollCapability: I,
|
|
4931
4933
|
exportCapability: x,
|
|
4932
4934
|
totalPages: T,
|
|
4933
4935
|
removeButtons: _,
|
|
4934
|
-
historyCapability:
|
|
4936
|
+
historyCapability: d,
|
|
4935
4937
|
annotationsApi: b
|
|
4936
4938
|
}) {
|
|
4937
4939
|
const { t: O } = fu(), [N, R] = mn(!1), [P, M] = mn(!1);
|
|
4938
4940
|
Ln(() => b == null ? void 0 : b.subscribe(() => {
|
|
4939
|
-
R((
|
|
4940
|
-
}), [b,
|
|
4941
|
+
R((d == null ? void 0 : d.canUndo()) || !1), M((d == null ? void 0 : d.canRedo()) || !1);
|
|
4942
|
+
}), [b, d]);
|
|
4941
4943
|
const on = h.filter((F) => F.area === "left"), q = h.filter((F) => F.area === "right"), [Z, fn] = mn(
|
|
4942
|
-
() =>
|
|
4944
|
+
() => g ? String(g) : "1"
|
|
4943
4945
|
);
|
|
4944
4946
|
Ln(() => {
|
|
4945
|
-
String(
|
|
4946
|
-
}, [
|
|
4947
|
+
String(g) !== Z && fn(String(g));
|
|
4948
|
+
}, [g]);
|
|
4947
4949
|
const y = Tn(() => {
|
|
4948
4950
|
o == null || o.zoomIn();
|
|
4949
4951
|
}, [o]), W = Tn(() => {
|
|
@@ -4953,10 +4955,10 @@ function s_({
|
|
|
4953
4955
|
}, [o]), j = Tn(() => {
|
|
4954
4956
|
x == null || x.download();
|
|
4955
4957
|
}, [x]), gn = Tn(() => {
|
|
4956
|
-
|
|
4957
|
-
}, [
|
|
4958
|
-
|
|
4959
|
-
}, [
|
|
4958
|
+
d == null || d.undo(), R((d == null ? void 0 : d.canUndo()) || !1), M((d == null ? void 0 : d.canRedo()) || !1);
|
|
4959
|
+
}, [d]), D = Tn(() => {
|
|
4960
|
+
d == null || d.redo(), M((d == null ? void 0 : d.canRedo()) || !1), M((d == null ? void 0 : d.canRedo()) || !1);
|
|
4961
|
+
}, [d]), tn = Tn(
|
|
4960
4962
|
(F) => {
|
|
4961
4963
|
fn(F.target.value);
|
|
4962
4964
|
},
|
|
@@ -4966,14 +4968,14 @@ function s_({
|
|
|
4966
4968
|
return;
|
|
4967
4969
|
const F = Number.parseInt(Z, 10);
|
|
4968
4970
|
if (Number.isNaN(F)) {
|
|
4969
|
-
fn(String(
|
|
4971
|
+
fn(String(g));
|
|
4970
4972
|
return;
|
|
4971
4973
|
}
|
|
4972
4974
|
const cn = Math.min(Math.max(F, 1), T || 0);
|
|
4973
4975
|
fn(String(cn)), I.scrollToPage({
|
|
4974
4976
|
pageNumber: cn
|
|
4975
4977
|
});
|
|
4976
|
-
}, [
|
|
4978
|
+
}, [g, Z, I, T]);
|
|
4977
4979
|
return /* @__PURE__ */ Yn("div", { className: "toolbar", children: [
|
|
4978
4980
|
/* @__PURE__ */ Yn("div", { className: "leftButtonSet", children: [
|
|
4979
4981
|
!(_ != null && _.includes("zoomOut")) && /* @__PURE__ */ S(
|
|
@@ -5043,7 +5045,7 @@ function s_({
|
|
|
5043
5045
|
!(_ != null && _.includes("undo")) && /* @__PURE__ */ S(
|
|
5044
5046
|
"span",
|
|
5045
5047
|
{
|
|
5046
|
-
className: `tbButton ${!
|
|
5048
|
+
className: `tbButton ${!d || !N ? "disabled" : ""}`,
|
|
5047
5049
|
title: O("undo"),
|
|
5048
5050
|
onClick: gn,
|
|
5049
5051
|
children: /* @__PURE__ */ S("i", { className: "fal fa-arrow-turn-left" })
|
|
@@ -5052,7 +5054,7 @@ function s_({
|
|
|
5052
5054
|
!(_ != null && _.includes("redo")) && /* @__PURE__ */ S(
|
|
5053
5055
|
"span",
|
|
5054
5056
|
{
|
|
5055
|
-
className: `tbButton ${!
|
|
5057
|
+
className: `tbButton ${!d || !P ? "disabled" : ""}`,
|
|
5056
5058
|
title: O("redo"),
|
|
5057
5059
|
onClick: D,
|
|
5058
5060
|
children: /* @__PURE__ */ S("i", { className: "fal fa-arrow-turn-right" })
|
|
@@ -5082,20 +5084,20 @@ const l_ = {
|
|
|
5082
5084
|
};
|
|
5083
5085
|
function N_({
|
|
5084
5086
|
pdf: h,
|
|
5085
|
-
name:
|
|
5087
|
+
name: g,
|
|
5086
5088
|
hideToolbar: o = !1,
|
|
5087
5089
|
onDocumentLoaded: I,
|
|
5088
5090
|
locale: x,
|
|
5089
5091
|
translations: T,
|
|
5090
5092
|
usage: _
|
|
5091
5093
|
}) {
|
|
5092
|
-
const { engine:
|
|
5094
|
+
const { engine: d, isLoading: b, error: O } = Vp({
|
|
5093
5095
|
worker: !1,
|
|
5094
5096
|
wasmUrl: `https://kopjra-public.s3.eu-west-1.amazonaws.com/wias/pdfium/pdfium-${a_.config.embedpdf}.wasm`
|
|
5095
5097
|
}), [N, R] = mn(!1), [P, M] = mn(!1), [on, q] = mn(!1), Z = Me(null);
|
|
5096
5098
|
Ln(() => {
|
|
5097
|
-
|
|
5098
|
-
}, [
|
|
5099
|
+
d && b0(d);
|
|
5100
|
+
}, [d]);
|
|
5099
5101
|
const fn = yt(() => [
|
|
5100
5102
|
ae(a0),
|
|
5101
5103
|
ae(t0),
|
|
@@ -5134,7 +5136,7 @@ function N_({
|
|
|
5134
5136
|
historyCapability: Y,
|
|
5135
5137
|
annotationsApi: Bn
|
|
5136
5138
|
}
|
|
5137
|
-
) }), [x, T, cn, ln, o, W, j, D, Y]), Se = Tn(() => /* @__PURE__ */ S(Jp, { engine:
|
|
5139
|
+
) }), [x, T, cn, ln, o, W, j, D, Y]), Se = Tn(() => /* @__PURE__ */ S(Jp, { engine: d, isLoading: b, error: O, children: /* @__PURE__ */ S(
|
|
5138
5140
|
f_,
|
|
5139
5141
|
{
|
|
5140
5142
|
setZoomCapability: J,
|
|
@@ -5149,7 +5151,7 @@ function N_({
|
|
|
5149
5151
|
hideToolbar: o,
|
|
5150
5152
|
documentId: y,
|
|
5151
5153
|
pdf: h,
|
|
5152
|
-
name:
|
|
5154
|
+
name: g,
|
|
5153
5155
|
setLoadingPdf: M,
|
|
5154
5156
|
setLoadingError: R,
|
|
5155
5157
|
setClosedPdf: q,
|
|
@@ -5158,7 +5160,7 @@ function N_({
|
|
|
5158
5160
|
initialLocale: x,
|
|
5159
5161
|
ref: Z
|
|
5160
5162
|
}
|
|
5161
|
-
) }), [
|
|
5163
|
+
) }), [d, b, O, o, h]);
|
|
5162
5164
|
return {
|
|
5163
5165
|
PdfSentinelContainer: Tn(({ children: ce }) => /* @__PURE__ */ S("div", { className: "pdf-sentinel-root", children: ce }), []),
|
|
5164
5166
|
Toolbar: zn,
|
|
@@ -5168,7 +5170,7 @@ function N_({
|
|
|
5168
5170
|
totalPages: ln,
|
|
5169
5171
|
loadingPdf: P,
|
|
5170
5172
|
loadingError: N,
|
|
5171
|
-
engine:
|
|
5173
|
+
engine: d,
|
|
5172
5174
|
closedPdf: on,
|
|
5173
5175
|
helpers: {
|
|
5174
5176
|
zoomIn: () => {
|