@embedpdf/models 1.0.11 → 1.0.13
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/color.d.ts +21 -0
- package/dist/date.d.ts +16 -0
- package/dist/geometry.d.ts +299 -0
- package/dist/geometry.test.d.ts +1 -0
- package/dist/index.cjs +2 -1301
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -2608
- package/dist/index.js +376 -136
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +172 -0
- package/dist/logger.test.d.ts +1 -0
- package/dist/{index.d.cts → pdf.d.ts} +365 -796
- package/dist/task.d.ts +188 -0
- package/dist/task.test.d.ts +1 -0
- package/package.json +7 -9
package/dist/index.cjs
CHANGED
|
@@ -1,1301 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
AllLogger: () => AllLogger,
|
|
24
|
-
AppearanceMode: () => AppearanceMode,
|
|
25
|
-
ConsoleLogger: () => ConsoleLogger,
|
|
26
|
-
LevelLogger: () => LevelLogger,
|
|
27
|
-
LogLevel: () => LogLevel,
|
|
28
|
-
MatchFlag: () => MatchFlag,
|
|
29
|
-
NoopLogger: () => NoopLogger,
|
|
30
|
-
PDF_FORM_FIELD_FLAG: () => PDF_FORM_FIELD_FLAG,
|
|
31
|
-
PDF_FORM_FIELD_TYPE: () => PDF_FORM_FIELD_TYPE,
|
|
32
|
-
PdfActionType: () => PdfActionType,
|
|
33
|
-
PdfAnnotationBorderStyle: () => PdfAnnotationBorderStyle,
|
|
34
|
-
PdfAnnotationColorType: () => PdfAnnotationColorType,
|
|
35
|
-
PdfAnnotationFlagName: () => PdfAnnotationFlagName,
|
|
36
|
-
PdfAnnotationFlags: () => PdfAnnotationFlags,
|
|
37
|
-
PdfAnnotationObjectStatus: () => PdfAnnotationObjectStatus,
|
|
38
|
-
PdfAnnotationState: () => PdfAnnotationState,
|
|
39
|
-
PdfAnnotationStateModel: () => PdfAnnotationStateModel,
|
|
40
|
-
PdfAnnotationSubtype: () => PdfAnnotationSubtype,
|
|
41
|
-
PdfAnnotationSubtypeName: () => PdfAnnotationSubtypeName,
|
|
42
|
-
PdfBomOrZwnbsp: () => PdfBomOrZwnbsp,
|
|
43
|
-
PdfEngineFeature: () => PdfEngineFeature,
|
|
44
|
-
PdfEngineOperation: () => PdfEngineOperation,
|
|
45
|
-
PdfErrorCode: () => PdfErrorCode,
|
|
46
|
-
PdfNonCharacterFFFE: () => PdfNonCharacterFFFE,
|
|
47
|
-
PdfNonCharacterFFFF: () => PdfNonCharacterFFFF,
|
|
48
|
-
PdfPageFlattenFlag: () => PdfPageFlattenFlag,
|
|
49
|
-
PdfPageFlattenResult: () => PdfPageFlattenResult,
|
|
50
|
-
PdfPageObjectType: () => PdfPageObjectType,
|
|
51
|
-
PdfPermission: () => PdfPermission,
|
|
52
|
-
PdfSegmentObjectType: () => PdfSegmentObjectType,
|
|
53
|
-
PdfSoftHyphenMarker: () => PdfSoftHyphenMarker,
|
|
54
|
-
PdfTaskHelper: () => PdfTaskHelper,
|
|
55
|
-
PdfUnwantedTextMarkers: () => PdfUnwantedTextMarkers,
|
|
56
|
-
PdfUnwantedTextRegex: () => PdfUnwantedTextRegex,
|
|
57
|
-
PdfWordJoiner: () => PdfWordJoiner,
|
|
58
|
-
PdfZeroWidthSpace: () => PdfZeroWidthSpace,
|
|
59
|
-
PdfZoomMode: () => PdfZoomMode,
|
|
60
|
-
PerfLogger: () => PerfLogger,
|
|
61
|
-
Rotation: () => Rotation,
|
|
62
|
-
Task: () => Task,
|
|
63
|
-
TaskAbortedError: () => TaskAbortedError,
|
|
64
|
-
TaskRejectedError: () => TaskRejectedError,
|
|
65
|
-
TaskStage: () => TaskStage,
|
|
66
|
-
boundingRect: () => boundingRect,
|
|
67
|
-
calculateAngle: () => calculateAngle,
|
|
68
|
-
calculateDegree: () => calculateDegree,
|
|
69
|
-
compareSearchTarget: () => compareSearchTarget,
|
|
70
|
-
dateToPdfDate: () => dateToPdfDate,
|
|
71
|
-
flagsToNames: () => flagsToNames,
|
|
72
|
-
ignore: () => ignore,
|
|
73
|
-
makeMatrix: () => makeMatrix,
|
|
74
|
-
namesToFlags: () => namesToFlags,
|
|
75
|
-
pdfAlphaColorToWebAlphaColor: () => pdfAlphaColorToWebAlphaColor,
|
|
76
|
-
pdfDateToDate: () => pdfDateToDate,
|
|
77
|
-
quadToRect: () => quadToRect,
|
|
78
|
-
rectToQuad: () => rectToQuad,
|
|
79
|
-
restoreOffset: () => restoreOffset,
|
|
80
|
-
restorePosition: () => restorePosition,
|
|
81
|
-
restoreRect: () => restoreRect,
|
|
82
|
-
rotatePosition: () => rotatePosition,
|
|
83
|
-
rotateRect: () => rotateRect,
|
|
84
|
-
scalePosition: () => scalePosition,
|
|
85
|
-
scaleRect: () => scaleRect,
|
|
86
|
-
stripPdfUnwantedMarkers: () => stripPdfUnwantedMarkers,
|
|
87
|
-
swap: () => swap,
|
|
88
|
-
toIntPos: () => toIntPos,
|
|
89
|
-
toIntRect: () => toIntRect,
|
|
90
|
-
toIntSize: () => toIntSize,
|
|
91
|
-
transformPosition: () => transformPosition,
|
|
92
|
-
transformRect: () => transformRect,
|
|
93
|
-
transformSize: () => transformSize,
|
|
94
|
-
unionFlags: () => unionFlags,
|
|
95
|
-
webAlphaColorToPdfAlphaColor: () => webAlphaColorToPdfAlphaColor
|
|
96
|
-
});
|
|
97
|
-
module.exports = __toCommonJS(index_exports);
|
|
98
|
-
|
|
99
|
-
// src/geometry.ts
|
|
100
|
-
var Rotation = /* @__PURE__ */ ((Rotation2) => {
|
|
101
|
-
Rotation2[Rotation2["Degree0"] = 0] = "Degree0";
|
|
102
|
-
Rotation2[Rotation2["Degree90"] = 1] = "Degree90";
|
|
103
|
-
Rotation2[Rotation2["Degree180"] = 2] = "Degree180";
|
|
104
|
-
Rotation2[Rotation2["Degree270"] = 3] = "Degree270";
|
|
105
|
-
return Rotation2;
|
|
106
|
-
})(Rotation || {});
|
|
107
|
-
function toIntPos(p) {
|
|
108
|
-
return { x: Math.floor(p.x), y: Math.floor(p.y) };
|
|
109
|
-
}
|
|
110
|
-
function toIntSize(s) {
|
|
111
|
-
return { width: Math.ceil(s.width), height: Math.ceil(s.height) };
|
|
112
|
-
}
|
|
113
|
-
function toIntRect(r) {
|
|
114
|
-
return {
|
|
115
|
-
origin: toIntPos(r.origin),
|
|
116
|
-
size: toIntSize(r.size)
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
function calculateDegree(rotation) {
|
|
120
|
-
switch (rotation) {
|
|
121
|
-
case 0 /* Degree0 */:
|
|
122
|
-
return 0;
|
|
123
|
-
case 1 /* Degree90 */:
|
|
124
|
-
return 90;
|
|
125
|
-
case 2 /* Degree180 */:
|
|
126
|
-
return 180;
|
|
127
|
-
case 3 /* Degree270 */:
|
|
128
|
-
return 270;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function calculateAngle(rotation) {
|
|
132
|
-
return calculateDegree(rotation) * Math.PI / 180;
|
|
133
|
-
}
|
|
134
|
-
function swap(size) {
|
|
135
|
-
const { width, height } = size;
|
|
136
|
-
return {
|
|
137
|
-
width: height,
|
|
138
|
-
height: width
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function transformSize(size, rotation, scaleFactor) {
|
|
142
|
-
size = rotation % 2 === 0 ? size : swap(size);
|
|
143
|
-
return {
|
|
144
|
-
width: size.width * scaleFactor,
|
|
145
|
-
height: size.height * scaleFactor
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
function quadToRect(q) {
|
|
149
|
-
const xs = [q.p1.x, q.p2.x, q.p3.x, q.p4.x];
|
|
150
|
-
const ys = [q.p1.y, q.p2.y, q.p3.y, q.p4.y];
|
|
151
|
-
return {
|
|
152
|
-
origin: { x: Math.min(...xs), y: Math.min(...ys) },
|
|
153
|
-
size: {
|
|
154
|
-
width: Math.max(...xs) - Math.min(...xs),
|
|
155
|
-
height: Math.max(...ys) - Math.min(...ys)
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
function rectToQuad(r) {
|
|
160
|
-
return {
|
|
161
|
-
p1: { x: r.origin.x, y: r.origin.y },
|
|
162
|
-
p2: { x: r.origin.x + r.size.width, y: r.origin.y },
|
|
163
|
-
p3: { x: r.origin.x + r.size.width, y: r.origin.y + r.size.height },
|
|
164
|
-
p4: { x: r.origin.x, y: r.origin.y + r.size.height }
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
function rotatePosition(containerSize, position, rotation) {
|
|
168
|
-
let x = position.x;
|
|
169
|
-
let y = position.y;
|
|
170
|
-
switch (rotation) {
|
|
171
|
-
case 0 /* Degree0 */:
|
|
172
|
-
x = position.x;
|
|
173
|
-
y = position.y;
|
|
174
|
-
break;
|
|
175
|
-
case 1 /* Degree90 */:
|
|
176
|
-
x = containerSize.height - position.y;
|
|
177
|
-
y = position.x;
|
|
178
|
-
break;
|
|
179
|
-
case 2 /* Degree180 */:
|
|
180
|
-
x = containerSize.width - position.x;
|
|
181
|
-
y = containerSize.height - position.y;
|
|
182
|
-
break;
|
|
183
|
-
case 3 /* Degree270 */:
|
|
184
|
-
x = position.y;
|
|
185
|
-
y = containerSize.width - position.x;
|
|
186
|
-
break;
|
|
187
|
-
}
|
|
188
|
-
return {
|
|
189
|
-
x,
|
|
190
|
-
y
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
function scalePosition(position, scaleFactor) {
|
|
194
|
-
return {
|
|
195
|
-
x: position.x * scaleFactor,
|
|
196
|
-
y: position.y * scaleFactor
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
function transformPosition(containerSize, position, rotation, scaleFactor) {
|
|
200
|
-
return scalePosition(rotatePosition(containerSize, position, rotation), scaleFactor);
|
|
201
|
-
}
|
|
202
|
-
function restorePosition(containerSize, position, rotation, scaleFactor) {
|
|
203
|
-
return scalePosition(
|
|
204
|
-
rotatePosition(containerSize, position, (4 - rotation) % 4),
|
|
205
|
-
1 / scaleFactor
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
function rotateRect(containerSize, rect, rotation) {
|
|
209
|
-
let x = rect.origin.x;
|
|
210
|
-
let y = rect.origin.y;
|
|
211
|
-
let size = rect.size;
|
|
212
|
-
switch (rotation) {
|
|
213
|
-
case 0 /* Degree0 */:
|
|
214
|
-
break;
|
|
215
|
-
case 1 /* Degree90 */:
|
|
216
|
-
x = containerSize.height - rect.origin.y - rect.size.height;
|
|
217
|
-
y = rect.origin.x;
|
|
218
|
-
size = swap(rect.size);
|
|
219
|
-
break;
|
|
220
|
-
case 2 /* Degree180 */:
|
|
221
|
-
x = containerSize.width - rect.origin.x - rect.size.width;
|
|
222
|
-
y = containerSize.height - rect.origin.y - rect.size.height;
|
|
223
|
-
break;
|
|
224
|
-
case 3 /* Degree270 */:
|
|
225
|
-
x = rect.origin.y;
|
|
226
|
-
y = containerSize.width - rect.origin.x - rect.size.width;
|
|
227
|
-
size = swap(rect.size);
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
return {
|
|
231
|
-
origin: {
|
|
232
|
-
x,
|
|
233
|
-
y
|
|
234
|
-
},
|
|
235
|
-
size: {
|
|
236
|
-
width: size.width,
|
|
237
|
-
height: size.height
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function scaleRect(rect, scaleFactor) {
|
|
242
|
-
return {
|
|
243
|
-
origin: {
|
|
244
|
-
x: rect.origin.x * scaleFactor,
|
|
245
|
-
y: rect.origin.y * scaleFactor
|
|
246
|
-
},
|
|
247
|
-
size: {
|
|
248
|
-
width: rect.size.width * scaleFactor,
|
|
249
|
-
height: rect.size.height * scaleFactor
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
function transformRect(containerSize, rect, rotation, scaleFactor) {
|
|
254
|
-
return scaleRect(rotateRect(containerSize, rect, rotation), scaleFactor);
|
|
255
|
-
}
|
|
256
|
-
function restoreRect(containerSize, rect, rotation, scaleFactor) {
|
|
257
|
-
return scaleRect(rotateRect(containerSize, rect, (4 - rotation) % 4), 1 / scaleFactor);
|
|
258
|
-
}
|
|
259
|
-
function restoreOffset(offset, rotation, scaleFactor) {
|
|
260
|
-
let offsetX = offset.x;
|
|
261
|
-
let offsetY = offset.y;
|
|
262
|
-
switch (rotation) {
|
|
263
|
-
case 0 /* Degree0 */:
|
|
264
|
-
offsetX = offset.x / scaleFactor;
|
|
265
|
-
offsetY = offset.y / scaleFactor;
|
|
266
|
-
break;
|
|
267
|
-
case 1 /* Degree90 */:
|
|
268
|
-
offsetX = offset.y / scaleFactor;
|
|
269
|
-
offsetY = -offset.x / scaleFactor;
|
|
270
|
-
break;
|
|
271
|
-
case 2 /* Degree180 */:
|
|
272
|
-
offsetX = -offset.x / scaleFactor;
|
|
273
|
-
offsetY = -offset.y / scaleFactor;
|
|
274
|
-
break;
|
|
275
|
-
case 3 /* Degree270 */:
|
|
276
|
-
offsetX = -offset.y / scaleFactor;
|
|
277
|
-
offsetY = offset.x / scaleFactor;
|
|
278
|
-
break;
|
|
279
|
-
}
|
|
280
|
-
return {
|
|
281
|
-
x: offsetX,
|
|
282
|
-
y: offsetY
|
|
283
|
-
};
|
|
284
|
-
}
|
|
285
|
-
function boundingRect(rects) {
|
|
286
|
-
if (rects.length === 0) return null;
|
|
287
|
-
let minX = rects[0].origin.x, minY = rects[0].origin.y, maxX = rects[0].origin.x + rects[0].size.width, maxY = rects[0].origin.y + rects[0].size.height;
|
|
288
|
-
for (const r of rects) {
|
|
289
|
-
minX = Math.min(minX, r.origin.x);
|
|
290
|
-
minY = Math.min(minY, r.origin.y);
|
|
291
|
-
maxX = Math.max(maxX, r.origin.x + r.size.width);
|
|
292
|
-
maxY = Math.max(maxY, r.origin.y + r.size.height);
|
|
293
|
-
}
|
|
294
|
-
return {
|
|
295
|
-
origin: {
|
|
296
|
-
x: minX,
|
|
297
|
-
y: minY
|
|
298
|
-
},
|
|
299
|
-
size: {
|
|
300
|
-
width: maxX - minX,
|
|
301
|
-
height: maxY - minY
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
var makeMatrix = (rectangle, rotation, scaleFactor) => {
|
|
306
|
-
const { width, height } = rectangle.size;
|
|
307
|
-
switch (rotation) {
|
|
308
|
-
case 0 /* Degree0 */:
|
|
309
|
-
return {
|
|
310
|
-
a: scaleFactor,
|
|
311
|
-
b: 0,
|
|
312
|
-
c: 0,
|
|
313
|
-
d: -scaleFactor,
|
|
314
|
-
e: 0,
|
|
315
|
-
f: height * scaleFactor
|
|
316
|
-
};
|
|
317
|
-
case 1 /* Degree90 */:
|
|
318
|
-
return {
|
|
319
|
-
a: 0,
|
|
320
|
-
b: scaleFactor,
|
|
321
|
-
c: scaleFactor,
|
|
322
|
-
d: 0,
|
|
323
|
-
e: 0,
|
|
324
|
-
f: 0
|
|
325
|
-
};
|
|
326
|
-
case 2 /* Degree180 */:
|
|
327
|
-
return {
|
|
328
|
-
a: -scaleFactor,
|
|
329
|
-
b: 0,
|
|
330
|
-
c: 0,
|
|
331
|
-
d: scaleFactor,
|
|
332
|
-
e: width * scaleFactor,
|
|
333
|
-
f: 0
|
|
334
|
-
};
|
|
335
|
-
case 3 /* Degree270 */:
|
|
336
|
-
return {
|
|
337
|
-
a: 0,
|
|
338
|
-
b: -scaleFactor,
|
|
339
|
-
c: -scaleFactor,
|
|
340
|
-
d: 0,
|
|
341
|
-
e: height * scaleFactor,
|
|
342
|
-
f: width * scaleFactor
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
// src/logger.ts
|
|
348
|
-
var NoopLogger = class {
|
|
349
|
-
/** {@inheritDoc Logger.debug} */
|
|
350
|
-
debug() {
|
|
351
|
-
}
|
|
352
|
-
/** {@inheritDoc Logger.info} */
|
|
353
|
-
info() {
|
|
354
|
-
}
|
|
355
|
-
/** {@inheritDoc Logger.warn} */
|
|
356
|
-
warn() {
|
|
357
|
-
}
|
|
358
|
-
/** {@inheritDoc Logger.error} */
|
|
359
|
-
error() {
|
|
360
|
-
}
|
|
361
|
-
/** {@inheritDoc Logger.perf} */
|
|
362
|
-
perf() {
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
var ConsoleLogger = class {
|
|
366
|
-
/** {@inheritDoc Logger.debug} */
|
|
367
|
-
debug(source, category, ...args) {
|
|
368
|
-
console.debug(`${source}.${category}`, ...args);
|
|
369
|
-
}
|
|
370
|
-
/** {@inheritDoc Logger.info} */
|
|
371
|
-
info(source, category, ...args) {
|
|
372
|
-
console.info(`${source}.${category}`, ...args);
|
|
373
|
-
}
|
|
374
|
-
/** {@inheritDoc Logger.warn} */
|
|
375
|
-
warn(source, category, ...args) {
|
|
376
|
-
console.warn(`${source}.${category}`, ...args);
|
|
377
|
-
}
|
|
378
|
-
/** {@inheritDoc Logger.error} */
|
|
379
|
-
error(source, category, ...args) {
|
|
380
|
-
console.error(`${source}.${category}`, ...args);
|
|
381
|
-
}
|
|
382
|
-
/** {@inheritDoc Logger.perf} */
|
|
383
|
-
perf(source, category, event, phase, ...args) {
|
|
384
|
-
console.info(`${source}.${category}.${event}.${phase}`, ...args);
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
388
|
-
LogLevel2[LogLevel2["Debug"] = 0] = "Debug";
|
|
389
|
-
LogLevel2[LogLevel2["Info"] = 1] = "Info";
|
|
390
|
-
LogLevel2[LogLevel2["Warn"] = 2] = "Warn";
|
|
391
|
-
LogLevel2[LogLevel2["Error"] = 3] = "Error";
|
|
392
|
-
return LogLevel2;
|
|
393
|
-
})(LogLevel || {});
|
|
394
|
-
var LevelLogger = class {
|
|
395
|
-
/**
|
|
396
|
-
* create new LevelLogger
|
|
397
|
-
* @param logger - the original logger
|
|
398
|
-
* @param level - log level that used for filtering, all logs lower than this level will be filtered out
|
|
399
|
-
*/
|
|
400
|
-
constructor(logger, level) {
|
|
401
|
-
this.logger = logger;
|
|
402
|
-
this.level = level;
|
|
403
|
-
}
|
|
404
|
-
/** {@inheritDoc Logger.debug} */
|
|
405
|
-
debug(source, category, ...args) {
|
|
406
|
-
if (this.level <= 0 /* Debug */) {
|
|
407
|
-
this.logger.debug(source, category, ...args);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
/** {@inheritDoc Logger.info} */
|
|
411
|
-
info(source, category, ...args) {
|
|
412
|
-
if (this.level <= 1 /* Info */) {
|
|
413
|
-
this.logger.info(source, category, ...args);
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
/** {@inheritDoc Logger.warn} */
|
|
417
|
-
warn(source, category, ...args) {
|
|
418
|
-
if (this.level <= 2 /* Warn */) {
|
|
419
|
-
this.logger.warn(source, category, ...args);
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
/** {@inheritDoc Logger.error} */
|
|
423
|
-
error(source, category, ...args) {
|
|
424
|
-
if (this.level <= 3 /* Error */) {
|
|
425
|
-
this.logger.error(source, category, ...args);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
/** {@inheritDoc Logger.perf} */
|
|
429
|
-
perf(source, category, event, phase, ...args) {
|
|
430
|
-
this.logger.perf(source, category, event, phase, ...args);
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
var PerfLogger = class {
|
|
434
|
-
/**
|
|
435
|
-
* create new PerfLogger
|
|
436
|
-
*/
|
|
437
|
-
constructor() {
|
|
438
|
-
}
|
|
439
|
-
/** {@inheritDoc Logger.debug} */
|
|
440
|
-
debug(source, category, ...args) {
|
|
441
|
-
}
|
|
442
|
-
/** {@inheritDoc Logger.info} */
|
|
443
|
-
info(source, category, ...args) {
|
|
444
|
-
}
|
|
445
|
-
/** {@inheritDoc Logger.warn} */
|
|
446
|
-
warn(source, category, ...args) {
|
|
447
|
-
}
|
|
448
|
-
/** {@inheritDoc Logger.error} */
|
|
449
|
-
error(source, category, ...args) {
|
|
450
|
-
}
|
|
451
|
-
/** {@inheritDoc Logger.perf} */
|
|
452
|
-
perf(source, category, event, phase, identifier, ...args) {
|
|
453
|
-
switch (phase) {
|
|
454
|
-
case "Begin":
|
|
455
|
-
window.performance.mark(`${source}.${category}.${event}.${phase}.${identifier}`, {
|
|
456
|
-
detail: args
|
|
457
|
-
});
|
|
458
|
-
break;
|
|
459
|
-
case "End":
|
|
460
|
-
window.performance.mark(`${source}.${category}.${event}.${phase}.${identifier}`, {
|
|
461
|
-
detail: args
|
|
462
|
-
});
|
|
463
|
-
window.performance.measure(
|
|
464
|
-
`${source}.${category}.${event}.Measure.${identifier}`,
|
|
465
|
-
`${source}.${category}.${event}.Begin.${identifier}`,
|
|
466
|
-
`${source}.${category}.${event}.End.${identifier}`
|
|
467
|
-
);
|
|
468
|
-
break;
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
};
|
|
472
|
-
var AllLogger = class {
|
|
473
|
-
/**
|
|
474
|
-
* create new PerfLogger
|
|
475
|
-
*/
|
|
476
|
-
constructor(loggers) {
|
|
477
|
-
this.loggers = loggers;
|
|
478
|
-
}
|
|
479
|
-
/** {@inheritDoc Logger.debug} */
|
|
480
|
-
debug(source, category, ...args) {
|
|
481
|
-
for (const logger of this.loggers) {
|
|
482
|
-
logger.debug(source, category, ...args);
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
/** {@inheritDoc Logger.info} */
|
|
486
|
-
info(source, category, ...args) {
|
|
487
|
-
for (const logger of this.loggers) {
|
|
488
|
-
logger.info(source, category, ...args);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
/** {@inheritDoc Logger.warn} */
|
|
492
|
-
warn(source, category, ...args) {
|
|
493
|
-
for (const logger of this.loggers) {
|
|
494
|
-
logger.warn(source, category, ...args);
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
/** {@inheritDoc Logger.error} */
|
|
498
|
-
error(source, category, ...args) {
|
|
499
|
-
for (const logger of this.loggers) {
|
|
500
|
-
logger.error(source, category, ...args);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
/** {@inheritDoc Logger.perf} */
|
|
504
|
-
perf(source, category, event, phase, ...args) {
|
|
505
|
-
for (const logger of this.loggers) {
|
|
506
|
-
logger.perf(source, category, event, phase, ...args);
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
|
|
511
|
-
// src/task.ts
|
|
512
|
-
var TaskStage = /* @__PURE__ */ ((TaskStage2) => {
|
|
513
|
-
TaskStage2[TaskStage2["Pending"] = 0] = "Pending";
|
|
514
|
-
TaskStage2[TaskStage2["Resolved"] = 1] = "Resolved";
|
|
515
|
-
TaskStage2[TaskStage2["Rejected"] = 2] = "Rejected";
|
|
516
|
-
TaskStage2[TaskStage2["Aborted"] = 3] = "Aborted";
|
|
517
|
-
return TaskStage2;
|
|
518
|
-
})(TaskStage || {});
|
|
519
|
-
var TaskAbortedError = class extends Error {
|
|
520
|
-
constructor(reason) {
|
|
521
|
-
super(`Task aborted: ${JSON.stringify(reason)}`);
|
|
522
|
-
this.name = "TaskAbortedError";
|
|
523
|
-
}
|
|
524
|
-
};
|
|
525
|
-
var TaskRejectedError = class extends Error {
|
|
526
|
-
constructor(reason) {
|
|
527
|
-
super(`Task rejected: ${JSON.stringify(reason)}`);
|
|
528
|
-
this.name = "TaskRejectedError";
|
|
529
|
-
}
|
|
530
|
-
};
|
|
531
|
-
var Task = class _Task {
|
|
532
|
-
constructor() {
|
|
533
|
-
this.state = {
|
|
534
|
-
stage: 0 /* Pending */
|
|
535
|
-
};
|
|
536
|
-
/**
|
|
537
|
-
* callbacks that will be executed when task is resolved
|
|
538
|
-
*/
|
|
539
|
-
this.resolvedCallbacks = [];
|
|
540
|
-
/**
|
|
541
|
-
* callbacks that will be executed when task is rejected
|
|
542
|
-
*/
|
|
543
|
-
this.rejectedCallbacks = [];
|
|
544
|
-
/**
|
|
545
|
-
* Promise that will be resolved when task is settled
|
|
546
|
-
*/
|
|
547
|
-
this._promise = null;
|
|
548
|
-
}
|
|
549
|
-
/**
|
|
550
|
-
* Convert task to promise
|
|
551
|
-
* @returns promise that will be resolved when task is settled
|
|
552
|
-
*/
|
|
553
|
-
toPromise() {
|
|
554
|
-
if (!this._promise) {
|
|
555
|
-
this._promise = new Promise((resolve, reject) => {
|
|
556
|
-
this.wait(
|
|
557
|
-
(result) => resolve(result),
|
|
558
|
-
(error) => {
|
|
559
|
-
if (error.type === "abort") {
|
|
560
|
-
reject(new TaskAbortedError(error.reason));
|
|
561
|
-
} else {
|
|
562
|
-
reject(new TaskRejectedError(error.reason));
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
);
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
return this._promise;
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* wait for task to be settled
|
|
572
|
-
* @param resolvedCallback - callback for resolved value
|
|
573
|
-
* @param rejectedCallback - callback for rejected value
|
|
574
|
-
*/
|
|
575
|
-
wait(resolvedCallback, rejectedCallback) {
|
|
576
|
-
switch (this.state.stage) {
|
|
577
|
-
case 0 /* Pending */:
|
|
578
|
-
this.resolvedCallbacks.push(resolvedCallback);
|
|
579
|
-
this.rejectedCallbacks.push(rejectedCallback);
|
|
580
|
-
break;
|
|
581
|
-
case 1 /* Resolved */:
|
|
582
|
-
resolvedCallback(this.state.result);
|
|
583
|
-
break;
|
|
584
|
-
case 2 /* Rejected */:
|
|
585
|
-
rejectedCallback({
|
|
586
|
-
type: "reject",
|
|
587
|
-
reason: this.state.reason
|
|
588
|
-
});
|
|
589
|
-
break;
|
|
590
|
-
case 3 /* Aborted */:
|
|
591
|
-
rejectedCallback({
|
|
592
|
-
type: "abort",
|
|
593
|
-
reason: this.state.reason
|
|
594
|
-
});
|
|
595
|
-
break;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
/**
|
|
599
|
-
* resolve task with specific result
|
|
600
|
-
* @param result - result value
|
|
601
|
-
*/
|
|
602
|
-
resolve(result) {
|
|
603
|
-
if (this.state.stage === 0 /* Pending */) {
|
|
604
|
-
this.state = {
|
|
605
|
-
stage: 1 /* Resolved */,
|
|
606
|
-
result
|
|
607
|
-
};
|
|
608
|
-
for (const resolvedCallback of this.resolvedCallbacks) {
|
|
609
|
-
try {
|
|
610
|
-
resolvedCallback(result);
|
|
611
|
-
} catch (e) {
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
this.resolvedCallbacks = [];
|
|
615
|
-
this.rejectedCallbacks = [];
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* reject task with specific reason
|
|
620
|
-
* @param reason - abort reason
|
|
621
|
-
*
|
|
622
|
-
*/
|
|
623
|
-
reject(reason) {
|
|
624
|
-
if (this.state.stage === 0 /* Pending */) {
|
|
625
|
-
this.state = {
|
|
626
|
-
stage: 2 /* Rejected */,
|
|
627
|
-
reason
|
|
628
|
-
};
|
|
629
|
-
for (const rejectedCallback of this.rejectedCallbacks) {
|
|
630
|
-
try {
|
|
631
|
-
rejectedCallback({
|
|
632
|
-
type: "reject",
|
|
633
|
-
reason
|
|
634
|
-
});
|
|
635
|
-
} catch (e) {
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
this.resolvedCallbacks = [];
|
|
639
|
-
this.rejectedCallbacks = [];
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* abort task with specific reason
|
|
644
|
-
* @param reason - abort reason
|
|
645
|
-
*/
|
|
646
|
-
abort(reason) {
|
|
647
|
-
if (this.state.stage === 0 /* Pending */) {
|
|
648
|
-
this.state = {
|
|
649
|
-
stage: 3 /* Aborted */,
|
|
650
|
-
reason
|
|
651
|
-
};
|
|
652
|
-
for (const rejectedCallback of this.rejectedCallbacks) {
|
|
653
|
-
try {
|
|
654
|
-
rejectedCallback({
|
|
655
|
-
type: "abort",
|
|
656
|
-
reason
|
|
657
|
-
});
|
|
658
|
-
} catch (e) {
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
this.resolvedCallbacks = [];
|
|
662
|
-
this.rejectedCallbacks = [];
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* fail task with a TaskError from another task
|
|
667
|
-
* This is a convenience method for error propagation between tasks
|
|
668
|
-
* @param error - TaskError from another task
|
|
669
|
-
*/
|
|
670
|
-
fail(error) {
|
|
671
|
-
if (error.type === "abort") {
|
|
672
|
-
this.abort(error.reason);
|
|
673
|
-
} else {
|
|
674
|
-
this.reject(error.reason);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* Static method to wait for all tasks to resolve
|
|
679
|
-
* Returns a new task that resolves with an array of all results
|
|
680
|
-
* Rejects immediately if any task fails
|
|
681
|
-
*
|
|
682
|
-
* @param tasks - array of tasks to wait for
|
|
683
|
-
* @returns new task that resolves when all input tasks resolve
|
|
684
|
-
* @public
|
|
685
|
-
*/
|
|
686
|
-
static all(tasks) {
|
|
687
|
-
const combinedTask = new _Task();
|
|
688
|
-
if (tasks.length === 0) {
|
|
689
|
-
combinedTask.resolve([]);
|
|
690
|
-
return combinedTask;
|
|
691
|
-
}
|
|
692
|
-
const results = new Array(tasks.length);
|
|
693
|
-
let resolvedCount = 0;
|
|
694
|
-
let isSettled = false;
|
|
695
|
-
tasks.forEach((task, index) => {
|
|
696
|
-
task.wait(
|
|
697
|
-
(result) => {
|
|
698
|
-
if (isSettled) return;
|
|
699
|
-
results[index] = result;
|
|
700
|
-
resolvedCount++;
|
|
701
|
-
if (resolvedCount === tasks.length) {
|
|
702
|
-
isSettled = true;
|
|
703
|
-
combinedTask.resolve(results);
|
|
704
|
-
}
|
|
705
|
-
},
|
|
706
|
-
(error) => {
|
|
707
|
-
if (isSettled) return;
|
|
708
|
-
isSettled = true;
|
|
709
|
-
if (error.type === "abort") {
|
|
710
|
-
combinedTask.abort(error.reason);
|
|
711
|
-
} else {
|
|
712
|
-
combinedTask.reject(error.reason);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
);
|
|
716
|
-
});
|
|
717
|
-
return combinedTask;
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* Static method to wait for all tasks to settle (resolve, reject, or abort)
|
|
721
|
-
* Always resolves with an array of settlement results
|
|
722
|
-
*
|
|
723
|
-
* @param tasks - array of tasks to wait for
|
|
724
|
-
* @returns new task that resolves when all input tasks settle
|
|
725
|
-
* @public
|
|
726
|
-
*/
|
|
727
|
-
static allSettled(tasks) {
|
|
728
|
-
const combinedTask = new _Task();
|
|
729
|
-
if (tasks.length === 0) {
|
|
730
|
-
combinedTask.resolve([]);
|
|
731
|
-
return combinedTask;
|
|
732
|
-
}
|
|
733
|
-
const results = new Array(tasks.length);
|
|
734
|
-
let settledCount = 0;
|
|
735
|
-
tasks.forEach((task, index) => {
|
|
736
|
-
task.wait(
|
|
737
|
-
(result) => {
|
|
738
|
-
results[index] = { status: "resolved", value: result };
|
|
739
|
-
settledCount++;
|
|
740
|
-
if (settledCount === tasks.length) {
|
|
741
|
-
combinedTask.resolve(results);
|
|
742
|
-
}
|
|
743
|
-
},
|
|
744
|
-
(error) => {
|
|
745
|
-
results[index] = {
|
|
746
|
-
status: error.type === "abort" ? "aborted" : "rejected",
|
|
747
|
-
reason: error.reason
|
|
748
|
-
};
|
|
749
|
-
settledCount++;
|
|
750
|
-
if (settledCount === tasks.length) {
|
|
751
|
-
combinedTask.resolve(results);
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
);
|
|
755
|
-
});
|
|
756
|
-
return combinedTask;
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* Static method that resolves/rejects with the first task that settles
|
|
760
|
-
*
|
|
761
|
-
* @param tasks - array of tasks to race
|
|
762
|
-
* @returns new task that settles with the first input task that settles
|
|
763
|
-
* @public
|
|
764
|
-
*/
|
|
765
|
-
static race(tasks) {
|
|
766
|
-
const combinedTask = new _Task();
|
|
767
|
-
if (tasks.length === 0) {
|
|
768
|
-
combinedTask.reject("No tasks provided");
|
|
769
|
-
return combinedTask;
|
|
770
|
-
}
|
|
771
|
-
let isSettled = false;
|
|
772
|
-
tasks.forEach((task) => {
|
|
773
|
-
task.wait(
|
|
774
|
-
(result) => {
|
|
775
|
-
if (isSettled) return;
|
|
776
|
-
isSettled = true;
|
|
777
|
-
combinedTask.resolve(result);
|
|
778
|
-
},
|
|
779
|
-
(error) => {
|
|
780
|
-
if (isSettled) return;
|
|
781
|
-
isSettled = true;
|
|
782
|
-
if (error.type === "abort") {
|
|
783
|
-
combinedTask.abort(error.reason);
|
|
784
|
-
} else {
|
|
785
|
-
combinedTask.reject(error.reason);
|
|
786
|
-
}
|
|
787
|
-
}
|
|
788
|
-
);
|
|
789
|
-
});
|
|
790
|
-
return combinedTask;
|
|
791
|
-
}
|
|
792
|
-
/**
|
|
793
|
-
* Utility to track progress of multiple tasks
|
|
794
|
-
*
|
|
795
|
-
* @param tasks - array of tasks to track
|
|
796
|
-
* @param onProgress - callback called when any task completes
|
|
797
|
-
* @returns new task that resolves when all input tasks resolve
|
|
798
|
-
* @public
|
|
799
|
-
*/
|
|
800
|
-
static withProgress(tasks, onProgress) {
|
|
801
|
-
const combinedTask = _Task.all(tasks);
|
|
802
|
-
if (onProgress) {
|
|
803
|
-
let completedCount = 0;
|
|
804
|
-
tasks.forEach((task) => {
|
|
805
|
-
task.wait(
|
|
806
|
-
() => {
|
|
807
|
-
completedCount++;
|
|
808
|
-
onProgress(completedCount, tasks.length);
|
|
809
|
-
},
|
|
810
|
-
() => {
|
|
811
|
-
completedCount++;
|
|
812
|
-
onProgress(completedCount, tasks.length);
|
|
813
|
-
}
|
|
814
|
-
);
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
return combinedTask;
|
|
818
|
-
}
|
|
819
|
-
};
|
|
820
|
-
|
|
821
|
-
// src/pdf.ts
|
|
822
|
-
var PdfSoftHyphenMarker = "\xAD";
|
|
823
|
-
var PdfZeroWidthSpace = "\u200B";
|
|
824
|
-
var PdfWordJoiner = "\u2060";
|
|
825
|
-
var PdfBomOrZwnbsp = "\uFEFF";
|
|
826
|
-
var PdfNonCharacterFFFE = "\uFFFE";
|
|
827
|
-
var PdfNonCharacterFFFF = "\uFFFF";
|
|
828
|
-
var PdfUnwantedTextMarkers = Object.freeze([
|
|
829
|
-
PdfSoftHyphenMarker,
|
|
830
|
-
PdfZeroWidthSpace,
|
|
831
|
-
PdfWordJoiner,
|
|
832
|
-
PdfBomOrZwnbsp,
|
|
833
|
-
PdfNonCharacterFFFE,
|
|
834
|
-
PdfNonCharacterFFFF
|
|
835
|
-
]);
|
|
836
|
-
var PdfUnwantedTextRegex = new RegExp(`[${PdfUnwantedTextMarkers.join("")}]`, "g");
|
|
837
|
-
function stripPdfUnwantedMarkers(text) {
|
|
838
|
-
return text.replace(PdfUnwantedTextRegex, "");
|
|
839
|
-
}
|
|
840
|
-
var PdfZoomMode = /* @__PURE__ */ ((PdfZoomMode2) => {
|
|
841
|
-
PdfZoomMode2[PdfZoomMode2["Unknown"] = 0] = "Unknown";
|
|
842
|
-
PdfZoomMode2[PdfZoomMode2["XYZ"] = 1] = "XYZ";
|
|
843
|
-
PdfZoomMode2[PdfZoomMode2["FitPage"] = 2] = "FitPage";
|
|
844
|
-
PdfZoomMode2[PdfZoomMode2["FitHorizontal"] = 3] = "FitHorizontal";
|
|
845
|
-
PdfZoomMode2[PdfZoomMode2["FitVertical"] = 4] = "FitVertical";
|
|
846
|
-
PdfZoomMode2[PdfZoomMode2["FitRectangle"] = 5] = "FitRectangle";
|
|
847
|
-
return PdfZoomMode2;
|
|
848
|
-
})(PdfZoomMode || {});
|
|
849
|
-
var PdfActionType = /* @__PURE__ */ ((PdfActionType2) => {
|
|
850
|
-
PdfActionType2[PdfActionType2["Unsupported"] = 0] = "Unsupported";
|
|
851
|
-
PdfActionType2[PdfActionType2["Goto"] = 1] = "Goto";
|
|
852
|
-
PdfActionType2[PdfActionType2["RemoteGoto"] = 2] = "RemoteGoto";
|
|
853
|
-
PdfActionType2[PdfActionType2["URI"] = 3] = "URI";
|
|
854
|
-
PdfActionType2[PdfActionType2["LaunchAppOrOpenFile"] = 4] = "LaunchAppOrOpenFile";
|
|
855
|
-
return PdfActionType2;
|
|
856
|
-
})(PdfActionType || {});
|
|
857
|
-
var PdfAnnotationSubtype = /* @__PURE__ */ ((PdfAnnotationSubtype2) => {
|
|
858
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
859
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["TEXT"] = 1] = "TEXT";
|
|
860
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["LINK"] = 2] = "LINK";
|
|
861
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["FREETEXT"] = 3] = "FREETEXT";
|
|
862
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["LINE"] = 4] = "LINE";
|
|
863
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["SQUARE"] = 5] = "SQUARE";
|
|
864
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["CIRCLE"] = 6] = "CIRCLE";
|
|
865
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["POLYGON"] = 7] = "POLYGON";
|
|
866
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["POLYLINE"] = 8] = "POLYLINE";
|
|
867
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["HIGHLIGHT"] = 9] = "HIGHLIGHT";
|
|
868
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["UNDERLINE"] = 10] = "UNDERLINE";
|
|
869
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["SQUIGGLY"] = 11] = "SQUIGGLY";
|
|
870
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["STRIKEOUT"] = 12] = "STRIKEOUT";
|
|
871
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["STAMP"] = 13] = "STAMP";
|
|
872
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["CARET"] = 14] = "CARET";
|
|
873
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["INK"] = 15] = "INK";
|
|
874
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["POPUP"] = 16] = "POPUP";
|
|
875
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["FILEATTACHMENT"] = 17] = "FILEATTACHMENT";
|
|
876
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["SOUND"] = 18] = "SOUND";
|
|
877
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["MOVIE"] = 19] = "MOVIE";
|
|
878
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["WIDGET"] = 20] = "WIDGET";
|
|
879
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["SCREEN"] = 21] = "SCREEN";
|
|
880
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["PRINTERMARK"] = 22] = "PRINTERMARK";
|
|
881
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["TRAPNET"] = 23] = "TRAPNET";
|
|
882
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["WATERMARK"] = 24] = "WATERMARK";
|
|
883
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["THREED"] = 25] = "THREED";
|
|
884
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["RICHMEDIA"] = 26] = "RICHMEDIA";
|
|
885
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["XFAWIDGET"] = 27] = "XFAWIDGET";
|
|
886
|
-
PdfAnnotationSubtype2[PdfAnnotationSubtype2["REDACT"] = 28] = "REDACT";
|
|
887
|
-
return PdfAnnotationSubtype2;
|
|
888
|
-
})(PdfAnnotationSubtype || {});
|
|
889
|
-
var PdfAnnotationSubtypeName = {
|
|
890
|
-
[0 /* UNKNOWN */]: "unknow",
|
|
891
|
-
[1 /* TEXT */]: "text",
|
|
892
|
-
[2 /* LINK */]: "link",
|
|
893
|
-
[3 /* FREETEXT */]: "freetext",
|
|
894
|
-
[4 /* LINE */]: "line",
|
|
895
|
-
[5 /* SQUARE */]: "square",
|
|
896
|
-
[6 /* CIRCLE */]: "circle",
|
|
897
|
-
[7 /* POLYGON */]: "polygon",
|
|
898
|
-
[8 /* POLYLINE */]: "polyline",
|
|
899
|
-
[9 /* HIGHLIGHT */]: "highlight",
|
|
900
|
-
[10 /* UNDERLINE */]: "underline",
|
|
901
|
-
[11 /* SQUIGGLY */]: "squiggly",
|
|
902
|
-
[12 /* STRIKEOUT */]: "strikeout",
|
|
903
|
-
[13 /* STAMP */]: "stamp",
|
|
904
|
-
[14 /* CARET */]: "caret",
|
|
905
|
-
[15 /* INK */]: "ink",
|
|
906
|
-
[16 /* POPUP */]: "popup",
|
|
907
|
-
[17 /* FILEATTACHMENT */]: "fileattachment",
|
|
908
|
-
[18 /* SOUND */]: "sound",
|
|
909
|
-
[19 /* MOVIE */]: "movie",
|
|
910
|
-
[20 /* WIDGET */]: "widget",
|
|
911
|
-
[21 /* SCREEN */]: "screen",
|
|
912
|
-
[22 /* PRINTERMARK */]: "printermark",
|
|
913
|
-
[23 /* TRAPNET */]: "trapnet",
|
|
914
|
-
[24 /* WATERMARK */]: "watermark",
|
|
915
|
-
[25 /* THREED */]: "threed",
|
|
916
|
-
[26 /* RICHMEDIA */]: "richmedia",
|
|
917
|
-
[27 /* XFAWIDGET */]: "xfawidget",
|
|
918
|
-
[28 /* REDACT */]: "redact"
|
|
919
|
-
};
|
|
920
|
-
var PdfAnnotationObjectStatus = /* @__PURE__ */ ((PdfAnnotationObjectStatus2) => {
|
|
921
|
-
PdfAnnotationObjectStatus2[PdfAnnotationObjectStatus2["Created"] = 0] = "Created";
|
|
922
|
-
PdfAnnotationObjectStatus2[PdfAnnotationObjectStatus2["Committed"] = 1] = "Committed";
|
|
923
|
-
return PdfAnnotationObjectStatus2;
|
|
924
|
-
})(PdfAnnotationObjectStatus || {});
|
|
925
|
-
var AppearanceMode = /* @__PURE__ */ ((AppearanceMode2) => {
|
|
926
|
-
AppearanceMode2[AppearanceMode2["Normal"] = 0] = "Normal";
|
|
927
|
-
AppearanceMode2[AppearanceMode2["Rollover"] = 1] = "Rollover";
|
|
928
|
-
AppearanceMode2[AppearanceMode2["Down"] = 2] = "Down";
|
|
929
|
-
return AppearanceMode2;
|
|
930
|
-
})(AppearanceMode || {});
|
|
931
|
-
var PdfAnnotationState = /* @__PURE__ */ ((PdfAnnotationState2) => {
|
|
932
|
-
PdfAnnotationState2["Marked"] = "Marked";
|
|
933
|
-
PdfAnnotationState2["Unmarked"] = "Unmarked";
|
|
934
|
-
PdfAnnotationState2["Accepted"] = "Accepted";
|
|
935
|
-
PdfAnnotationState2["Rejected"] = "Rejected";
|
|
936
|
-
PdfAnnotationState2["Complete"] = "Complete";
|
|
937
|
-
PdfAnnotationState2["Cancelled"] = "Cancelled";
|
|
938
|
-
PdfAnnotationState2["None"] = "None";
|
|
939
|
-
return PdfAnnotationState2;
|
|
940
|
-
})(PdfAnnotationState || {});
|
|
941
|
-
var PdfAnnotationStateModel = /* @__PURE__ */ ((PdfAnnotationStateModel2) => {
|
|
942
|
-
PdfAnnotationStateModel2["Marked"] = "Marked";
|
|
943
|
-
PdfAnnotationStateModel2["Reviewed"] = "Reviewed";
|
|
944
|
-
return PdfAnnotationStateModel2;
|
|
945
|
-
})(PdfAnnotationStateModel || {});
|
|
946
|
-
var PDF_FORM_FIELD_TYPE = /* @__PURE__ */ ((PDF_FORM_FIELD_TYPE2) => {
|
|
947
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
948
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["PUSHBUTTON"] = 1] = "PUSHBUTTON";
|
|
949
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["CHECKBOX"] = 2] = "CHECKBOX";
|
|
950
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["RADIOBUTTON"] = 3] = "RADIOBUTTON";
|
|
951
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["COMBOBOX"] = 4] = "COMBOBOX";
|
|
952
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["LISTBOX"] = 5] = "LISTBOX";
|
|
953
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["TEXTFIELD"] = 6] = "TEXTFIELD";
|
|
954
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["SIGNATURE"] = 7] = "SIGNATURE";
|
|
955
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["XFA"] = 8] = "XFA";
|
|
956
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["XFA_CHECKBOX"] = 9] = "XFA_CHECKBOX";
|
|
957
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["XFA_COMBOBOX"] = 10] = "XFA_COMBOBOX";
|
|
958
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["XFA_IMAGEFIELD"] = 11] = "XFA_IMAGEFIELD";
|
|
959
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["XFA_LISTBOX"] = 12] = "XFA_LISTBOX";
|
|
960
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["XFA_PUSHBUTTON"] = 13] = "XFA_PUSHBUTTON";
|
|
961
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["XFA_SIGNATURE"] = 14] = "XFA_SIGNATURE";
|
|
962
|
-
PDF_FORM_FIELD_TYPE2[PDF_FORM_FIELD_TYPE2["XFA_TEXTFIELD"] = 15] = "XFA_TEXTFIELD";
|
|
963
|
-
return PDF_FORM_FIELD_TYPE2;
|
|
964
|
-
})(PDF_FORM_FIELD_TYPE || {});
|
|
965
|
-
var PdfAnnotationColorType = /* @__PURE__ */ ((PdfAnnotationColorType2) => {
|
|
966
|
-
PdfAnnotationColorType2[PdfAnnotationColorType2["Color"] = 0] = "Color";
|
|
967
|
-
PdfAnnotationColorType2[PdfAnnotationColorType2["InteriorColor"] = 1] = "InteriorColor";
|
|
968
|
-
return PdfAnnotationColorType2;
|
|
969
|
-
})(PdfAnnotationColorType || {});
|
|
970
|
-
var PdfAnnotationBorderStyle = /* @__PURE__ */ ((PdfAnnotationBorderStyle2) => {
|
|
971
|
-
PdfAnnotationBorderStyle2[PdfAnnotationBorderStyle2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
972
|
-
PdfAnnotationBorderStyle2[PdfAnnotationBorderStyle2["SOLID"] = 1] = "SOLID";
|
|
973
|
-
PdfAnnotationBorderStyle2[PdfAnnotationBorderStyle2["DASHED"] = 2] = "DASHED";
|
|
974
|
-
PdfAnnotationBorderStyle2[PdfAnnotationBorderStyle2["BEVELED"] = 3] = "BEVELED";
|
|
975
|
-
PdfAnnotationBorderStyle2[PdfAnnotationBorderStyle2["INSET"] = 4] = "INSET";
|
|
976
|
-
PdfAnnotationBorderStyle2[PdfAnnotationBorderStyle2["UNDERLINE"] = 5] = "UNDERLINE";
|
|
977
|
-
PdfAnnotationBorderStyle2[PdfAnnotationBorderStyle2["CLOUDY"] = 6] = "CLOUDY";
|
|
978
|
-
return PdfAnnotationBorderStyle2;
|
|
979
|
-
})(PdfAnnotationBorderStyle || {});
|
|
980
|
-
var PdfAnnotationFlags = /* @__PURE__ */ ((PdfAnnotationFlags2) => {
|
|
981
|
-
PdfAnnotationFlags2[PdfAnnotationFlags2["NONE"] = 0] = "NONE";
|
|
982
|
-
PdfAnnotationFlags2[PdfAnnotationFlags2["INVISIBLE"] = 1] = "INVISIBLE";
|
|
983
|
-
PdfAnnotationFlags2[PdfAnnotationFlags2["HIDDEN"] = 2] = "HIDDEN";
|
|
984
|
-
PdfAnnotationFlags2[PdfAnnotationFlags2["PRINT"] = 4] = "PRINT";
|
|
985
|
-
PdfAnnotationFlags2[PdfAnnotationFlags2["NO_ZOOM"] = 8] = "NO_ZOOM";
|
|
986
|
-
PdfAnnotationFlags2[PdfAnnotationFlags2["NO_ROTATE"] = 16] = "NO_ROTATE";
|
|
987
|
-
PdfAnnotationFlags2[PdfAnnotationFlags2["NO_VIEW"] = 32] = "NO_VIEW";
|
|
988
|
-
PdfAnnotationFlags2[PdfAnnotationFlags2["READ_ONLY"] = 64] = "READ_ONLY";
|
|
989
|
-
PdfAnnotationFlags2[PdfAnnotationFlags2["LOCKED"] = 128] = "LOCKED";
|
|
990
|
-
PdfAnnotationFlags2[PdfAnnotationFlags2["TOGGLE_NOVIEW"] = 256] = "TOGGLE_NOVIEW";
|
|
991
|
-
return PdfAnnotationFlags2;
|
|
992
|
-
})(PdfAnnotationFlags || {});
|
|
993
|
-
var PDF_FORM_FIELD_FLAG = /* @__PURE__ */ ((PDF_FORM_FIELD_FLAG2) => {
|
|
994
|
-
PDF_FORM_FIELD_FLAG2[PDF_FORM_FIELD_FLAG2["NONE"] = 0] = "NONE";
|
|
995
|
-
PDF_FORM_FIELD_FLAG2[PDF_FORM_FIELD_FLAG2["READONLY"] = 1] = "READONLY";
|
|
996
|
-
PDF_FORM_FIELD_FLAG2[PDF_FORM_FIELD_FLAG2["REQUIRED"] = 2] = "REQUIRED";
|
|
997
|
-
PDF_FORM_FIELD_FLAG2[PDF_FORM_FIELD_FLAG2["NOEXPORT"] = 4] = "NOEXPORT";
|
|
998
|
-
PDF_FORM_FIELD_FLAG2[PDF_FORM_FIELD_FLAG2["TEXT_MULTIPLINE"] = 4096] = "TEXT_MULTIPLINE";
|
|
999
|
-
PDF_FORM_FIELD_FLAG2[PDF_FORM_FIELD_FLAG2["TEXT_PASSWORD"] = 8192] = "TEXT_PASSWORD";
|
|
1000
|
-
PDF_FORM_FIELD_FLAG2[PDF_FORM_FIELD_FLAG2["CHOICE_COMBO"] = 131072] = "CHOICE_COMBO";
|
|
1001
|
-
PDF_FORM_FIELD_FLAG2[PDF_FORM_FIELD_FLAG2["CHOICE_EDIT"] = 262144] = "CHOICE_EDIT";
|
|
1002
|
-
PDF_FORM_FIELD_FLAG2[PDF_FORM_FIELD_FLAG2["CHOICE_MULTL_SELECT"] = 2097152] = "CHOICE_MULTL_SELECT";
|
|
1003
|
-
return PDF_FORM_FIELD_FLAG2;
|
|
1004
|
-
})(PDF_FORM_FIELD_FLAG || {});
|
|
1005
|
-
var PdfPageObjectType = /* @__PURE__ */ ((PdfPageObjectType2) => {
|
|
1006
|
-
PdfPageObjectType2[PdfPageObjectType2["UNKNOWN"] = 0] = "UNKNOWN";
|
|
1007
|
-
PdfPageObjectType2[PdfPageObjectType2["TEXT"] = 1] = "TEXT";
|
|
1008
|
-
PdfPageObjectType2[PdfPageObjectType2["PATH"] = 2] = "PATH";
|
|
1009
|
-
PdfPageObjectType2[PdfPageObjectType2["IMAGE"] = 3] = "IMAGE";
|
|
1010
|
-
PdfPageObjectType2[PdfPageObjectType2["SHADING"] = 4] = "SHADING";
|
|
1011
|
-
PdfPageObjectType2[PdfPageObjectType2["FORM"] = 5] = "FORM";
|
|
1012
|
-
return PdfPageObjectType2;
|
|
1013
|
-
})(PdfPageObjectType || {});
|
|
1014
|
-
var PdfAnnotationFlagName = Object.freeze({
|
|
1015
|
-
[1 /* INVISIBLE */]: "invisible",
|
|
1016
|
-
[2 /* HIDDEN */]: "hidden",
|
|
1017
|
-
[4 /* PRINT */]: "print",
|
|
1018
|
-
[8 /* NO_ZOOM */]: "noZoom",
|
|
1019
|
-
[16 /* NO_ROTATE */]: "noRotate",
|
|
1020
|
-
[32 /* NO_VIEW */]: "noView",
|
|
1021
|
-
[64 /* READ_ONLY */]: "readOnly",
|
|
1022
|
-
[128 /* LOCKED */]: "locked",
|
|
1023
|
-
[256 /* TOGGLE_NOVIEW */]: "toggleNoView"
|
|
1024
|
-
});
|
|
1025
|
-
var PdfAnnotationFlagValue = Object.entries(
|
|
1026
|
-
PdfAnnotationFlagName
|
|
1027
|
-
).reduce(
|
|
1028
|
-
(acc, [bit, name]) => {
|
|
1029
|
-
acc[name] = Number(bit);
|
|
1030
|
-
return acc;
|
|
1031
|
-
},
|
|
1032
|
-
{}
|
|
1033
|
-
);
|
|
1034
|
-
function flagsToNames(raw) {
|
|
1035
|
-
return Object.keys(PdfAnnotationFlagName).filter((flag) => (raw & flag) !== 0).map((flag) => PdfAnnotationFlagName[flag]);
|
|
1036
|
-
}
|
|
1037
|
-
function namesToFlags(names) {
|
|
1038
|
-
return names.reduce(
|
|
1039
|
-
(mask, name) => mask | PdfAnnotationFlagValue[name],
|
|
1040
|
-
0 /* NONE */
|
|
1041
|
-
);
|
|
1042
|
-
}
|
|
1043
|
-
var PdfSegmentObjectType = /* @__PURE__ */ ((PdfSegmentObjectType2) => {
|
|
1044
|
-
PdfSegmentObjectType2[PdfSegmentObjectType2["UNKNOWN"] = -1] = "UNKNOWN";
|
|
1045
|
-
PdfSegmentObjectType2[PdfSegmentObjectType2["LINETO"] = 0] = "LINETO";
|
|
1046
|
-
PdfSegmentObjectType2[PdfSegmentObjectType2["BEZIERTO"] = 1] = "BEZIERTO";
|
|
1047
|
-
PdfSegmentObjectType2[PdfSegmentObjectType2["MOVETO"] = 2] = "MOVETO";
|
|
1048
|
-
return PdfSegmentObjectType2;
|
|
1049
|
-
})(PdfSegmentObjectType || {});
|
|
1050
|
-
var PdfEngineFeature = /* @__PURE__ */ ((PdfEngineFeature2) => {
|
|
1051
|
-
PdfEngineFeature2[PdfEngineFeature2["RenderPage"] = 0] = "RenderPage";
|
|
1052
|
-
PdfEngineFeature2[PdfEngineFeature2["RenderPageRect"] = 1] = "RenderPageRect";
|
|
1053
|
-
PdfEngineFeature2[PdfEngineFeature2["Thumbnails"] = 2] = "Thumbnails";
|
|
1054
|
-
PdfEngineFeature2[PdfEngineFeature2["Bookmarks"] = 3] = "Bookmarks";
|
|
1055
|
-
PdfEngineFeature2[PdfEngineFeature2["Annotations"] = 4] = "Annotations";
|
|
1056
|
-
return PdfEngineFeature2;
|
|
1057
|
-
})(PdfEngineFeature || {});
|
|
1058
|
-
var PdfEngineOperation = /* @__PURE__ */ ((PdfEngineOperation2) => {
|
|
1059
|
-
PdfEngineOperation2[PdfEngineOperation2["Create"] = 0] = "Create";
|
|
1060
|
-
PdfEngineOperation2[PdfEngineOperation2["Read"] = 1] = "Read";
|
|
1061
|
-
PdfEngineOperation2[PdfEngineOperation2["Update"] = 2] = "Update";
|
|
1062
|
-
PdfEngineOperation2[PdfEngineOperation2["Delete"] = 3] = "Delete";
|
|
1063
|
-
return PdfEngineOperation2;
|
|
1064
|
-
})(PdfEngineOperation || {});
|
|
1065
|
-
var MatchFlag = /* @__PURE__ */ ((MatchFlag2) => {
|
|
1066
|
-
MatchFlag2[MatchFlag2["None"] = 0] = "None";
|
|
1067
|
-
MatchFlag2[MatchFlag2["MatchCase"] = 1] = "MatchCase";
|
|
1068
|
-
MatchFlag2[MatchFlag2["MatchWholeWord"] = 2] = "MatchWholeWord";
|
|
1069
|
-
MatchFlag2[MatchFlag2["MatchConsecutive"] = 4] = "MatchConsecutive";
|
|
1070
|
-
return MatchFlag2;
|
|
1071
|
-
})(MatchFlag || {});
|
|
1072
|
-
function unionFlags(flags) {
|
|
1073
|
-
return flags.reduce((flag, currFlag) => {
|
|
1074
|
-
return flag | currFlag;
|
|
1075
|
-
}, 0 /* None */);
|
|
1076
|
-
}
|
|
1077
|
-
function compareSearchTarget(targetA, targetB) {
|
|
1078
|
-
const flagA = unionFlags(targetA.flags);
|
|
1079
|
-
const flagB = unionFlags(targetB.flags);
|
|
1080
|
-
return flagA === flagB && targetA.keyword === targetB.keyword;
|
|
1081
|
-
}
|
|
1082
|
-
var PdfPermission = /* @__PURE__ */ ((PdfPermission2) => {
|
|
1083
|
-
PdfPermission2[PdfPermission2["PrintDocument"] = 8] = "PrintDocument";
|
|
1084
|
-
PdfPermission2[PdfPermission2["ModifyContent"] = 16] = "ModifyContent";
|
|
1085
|
-
PdfPermission2[PdfPermission2["CopyOrExtract"] = 32] = "CopyOrExtract";
|
|
1086
|
-
PdfPermission2[PdfPermission2["AddOrModifyTextAnnot"] = 64] = "AddOrModifyTextAnnot";
|
|
1087
|
-
PdfPermission2[PdfPermission2["FillInExistingForm"] = 512] = "FillInExistingForm";
|
|
1088
|
-
PdfPermission2[PdfPermission2["ExtractTextOrGraphics"] = 1024] = "ExtractTextOrGraphics";
|
|
1089
|
-
PdfPermission2[PdfPermission2["AssembleDocument"] = 2048] = "AssembleDocument";
|
|
1090
|
-
PdfPermission2[PdfPermission2["PrintHighQuality"] = 4096] = "PrintHighQuality";
|
|
1091
|
-
return PdfPermission2;
|
|
1092
|
-
})(PdfPermission || {});
|
|
1093
|
-
var PdfPageFlattenFlag = /* @__PURE__ */ ((PdfPageFlattenFlag2) => {
|
|
1094
|
-
PdfPageFlattenFlag2[PdfPageFlattenFlag2["Display"] = 0] = "Display";
|
|
1095
|
-
PdfPageFlattenFlag2[PdfPageFlattenFlag2["Print"] = 1] = "Print";
|
|
1096
|
-
return PdfPageFlattenFlag2;
|
|
1097
|
-
})(PdfPageFlattenFlag || {});
|
|
1098
|
-
var PdfPageFlattenResult = /* @__PURE__ */ ((PdfPageFlattenResult2) => {
|
|
1099
|
-
PdfPageFlattenResult2[PdfPageFlattenResult2["Fail"] = 0] = "Fail";
|
|
1100
|
-
PdfPageFlattenResult2[PdfPageFlattenResult2["Success"] = 1] = "Success";
|
|
1101
|
-
PdfPageFlattenResult2[PdfPageFlattenResult2["NothingToDo"] = 2] = "NothingToDo";
|
|
1102
|
-
return PdfPageFlattenResult2;
|
|
1103
|
-
})(PdfPageFlattenResult || {});
|
|
1104
|
-
var PdfErrorCode = /* @__PURE__ */ ((PdfErrorCode2) => {
|
|
1105
|
-
PdfErrorCode2[PdfErrorCode2["Ok"] = 0] = "Ok";
|
|
1106
|
-
PdfErrorCode2[PdfErrorCode2["Unknown"] = 1] = "Unknown";
|
|
1107
|
-
PdfErrorCode2[PdfErrorCode2["NotFound"] = 2] = "NotFound";
|
|
1108
|
-
PdfErrorCode2[PdfErrorCode2["WrongFormat"] = 3] = "WrongFormat";
|
|
1109
|
-
PdfErrorCode2[PdfErrorCode2["Password"] = 4] = "Password";
|
|
1110
|
-
PdfErrorCode2[PdfErrorCode2["Security"] = 5] = "Security";
|
|
1111
|
-
PdfErrorCode2[PdfErrorCode2["PageError"] = 6] = "PageError";
|
|
1112
|
-
PdfErrorCode2[PdfErrorCode2["XFALoad"] = 7] = "XFALoad";
|
|
1113
|
-
PdfErrorCode2[PdfErrorCode2["XFALayout"] = 8] = "XFALayout";
|
|
1114
|
-
PdfErrorCode2[PdfErrorCode2["Cancelled"] = 9] = "Cancelled";
|
|
1115
|
-
PdfErrorCode2[PdfErrorCode2["Initialization"] = 10] = "Initialization";
|
|
1116
|
-
PdfErrorCode2[PdfErrorCode2["NotReady"] = 11] = "NotReady";
|
|
1117
|
-
PdfErrorCode2[PdfErrorCode2["NotSupport"] = 12] = "NotSupport";
|
|
1118
|
-
PdfErrorCode2[PdfErrorCode2["LoadDoc"] = 13] = "LoadDoc";
|
|
1119
|
-
PdfErrorCode2[PdfErrorCode2["DocNotOpen"] = 14] = "DocNotOpen";
|
|
1120
|
-
PdfErrorCode2[PdfErrorCode2["CantCloseDoc"] = 15] = "CantCloseDoc";
|
|
1121
|
-
PdfErrorCode2[PdfErrorCode2["CantCreateNewDoc"] = 16] = "CantCreateNewDoc";
|
|
1122
|
-
PdfErrorCode2[PdfErrorCode2["CantImportPages"] = 17] = "CantImportPages";
|
|
1123
|
-
PdfErrorCode2[PdfErrorCode2["CantCreateAnnot"] = 18] = "CantCreateAnnot";
|
|
1124
|
-
PdfErrorCode2[PdfErrorCode2["CantSetAnnotRect"] = 19] = "CantSetAnnotRect";
|
|
1125
|
-
PdfErrorCode2[PdfErrorCode2["CantSetAnnotContent"] = 20] = "CantSetAnnotContent";
|
|
1126
|
-
PdfErrorCode2[PdfErrorCode2["CantRemoveInkList"] = 21] = "CantRemoveInkList";
|
|
1127
|
-
PdfErrorCode2[PdfErrorCode2["CantAddInkStoke"] = 22] = "CantAddInkStoke";
|
|
1128
|
-
PdfErrorCode2[PdfErrorCode2["CantReadAttachmentSize"] = 23] = "CantReadAttachmentSize";
|
|
1129
|
-
PdfErrorCode2[PdfErrorCode2["CantReadAttachmentContent"] = 24] = "CantReadAttachmentContent";
|
|
1130
|
-
PdfErrorCode2[PdfErrorCode2["CantFocusAnnot"] = 25] = "CantFocusAnnot";
|
|
1131
|
-
PdfErrorCode2[PdfErrorCode2["CantSelectText"] = 26] = "CantSelectText";
|
|
1132
|
-
PdfErrorCode2[PdfErrorCode2["CantSelectOption"] = 27] = "CantSelectOption";
|
|
1133
|
-
PdfErrorCode2[PdfErrorCode2["CantCheckField"] = 28] = "CantCheckField";
|
|
1134
|
-
return PdfErrorCode2;
|
|
1135
|
-
})(PdfErrorCode || {});
|
|
1136
|
-
var PdfTaskHelper = class {
|
|
1137
|
-
/**
|
|
1138
|
-
* Create a task
|
|
1139
|
-
* @returns new task
|
|
1140
|
-
*/
|
|
1141
|
-
static create() {
|
|
1142
|
-
return new Task();
|
|
1143
|
-
}
|
|
1144
|
-
/**
|
|
1145
|
-
* Create a task that has been resolved with value
|
|
1146
|
-
* @param result - resolved value
|
|
1147
|
-
* @returns resolved task
|
|
1148
|
-
*/
|
|
1149
|
-
static resolve(result) {
|
|
1150
|
-
const task = new Task();
|
|
1151
|
-
task.resolve(result);
|
|
1152
|
-
return task;
|
|
1153
|
-
}
|
|
1154
|
-
/**
|
|
1155
|
-
* Create a task that has been rejected with error
|
|
1156
|
-
* @param reason - rejected error
|
|
1157
|
-
* @returns rejected task
|
|
1158
|
-
*/
|
|
1159
|
-
static reject(reason) {
|
|
1160
|
-
const task = new Task();
|
|
1161
|
-
task.reject(reason);
|
|
1162
|
-
return task;
|
|
1163
|
-
}
|
|
1164
|
-
/**
|
|
1165
|
-
* Create a task that has been aborted with error
|
|
1166
|
-
* @param reason - aborted error
|
|
1167
|
-
* @returns aborted task
|
|
1168
|
-
*/
|
|
1169
|
-
static abort(reason) {
|
|
1170
|
-
const task = new Task();
|
|
1171
|
-
task.reject(reason);
|
|
1172
|
-
return task;
|
|
1173
|
-
}
|
|
1174
|
-
};
|
|
1175
|
-
|
|
1176
|
-
// src/color.ts
|
|
1177
|
-
function pdfAlphaColorToWebAlphaColor(c) {
|
|
1178
|
-
const clamp = (n) => Math.max(0, Math.min(255, n));
|
|
1179
|
-
const toHex = (n) => clamp(n).toString(16).padStart(2, "0");
|
|
1180
|
-
const color = `#${toHex(c.red)}${toHex(c.green)}${toHex(c.blue)}`;
|
|
1181
|
-
const opacity = clamp(c.alpha) / 255;
|
|
1182
|
-
return { color, opacity };
|
|
1183
|
-
}
|
|
1184
|
-
function webAlphaColorToPdfAlphaColor({ color, opacity }) {
|
|
1185
|
-
if (/^#?[0-9a-f]{3}$/i.test(color)) {
|
|
1186
|
-
color = color.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i, "#$1$1$2$2$3$3").toLowerCase();
|
|
1187
|
-
}
|
|
1188
|
-
const [, r, g, b] = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(color) ?? (() => {
|
|
1189
|
-
throw new Error(`Invalid hex colour: \u201C${color}\u201D`);
|
|
1190
|
-
})();
|
|
1191
|
-
const clamp = (n, hi = 255) => Math.max(0, Math.min(hi, n));
|
|
1192
|
-
return {
|
|
1193
|
-
red: parseInt(r, 16),
|
|
1194
|
-
green: parseInt(g, 16),
|
|
1195
|
-
blue: parseInt(b, 16),
|
|
1196
|
-
alpha: clamp(Math.round(opacity * 255))
|
|
1197
|
-
};
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
// src/date.ts
|
|
1201
|
-
function pdfDateToDate(pdf) {
|
|
1202
|
-
if (!pdf?.startsWith("D:") || pdf.length < 16) return;
|
|
1203
|
-
const y = +pdf.slice(2, 6);
|
|
1204
|
-
const mo = +pdf.slice(6, 8) - 1;
|
|
1205
|
-
const d = +pdf.slice(8, 10);
|
|
1206
|
-
const H = +pdf.slice(10, 12);
|
|
1207
|
-
const M = +pdf.slice(12, 14);
|
|
1208
|
-
const S = +pdf.slice(14, 16);
|
|
1209
|
-
return new Date(Date.UTC(y, mo, d, H, M, S));
|
|
1210
|
-
}
|
|
1211
|
-
function dateToPdfDate(date = /* @__PURE__ */ new Date()) {
|
|
1212
|
-
const z = (n, len = 2) => n.toString().padStart(len, "0");
|
|
1213
|
-
const YYYY = date.getUTCFullYear();
|
|
1214
|
-
const MM = z(date.getUTCMonth() + 1);
|
|
1215
|
-
const DD = z(date.getUTCDate());
|
|
1216
|
-
const HH = z(date.getUTCHours());
|
|
1217
|
-
const mm = z(date.getUTCMinutes());
|
|
1218
|
-
const SS = z(date.getUTCSeconds());
|
|
1219
|
-
return `D:${YYYY}${MM}${DD}${HH}${mm}${SS}`;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
// src/index.ts
|
|
1223
|
-
function ignore() {
|
|
1224
|
-
}
|
|
1225
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1226
|
-
0 && (module.exports = {
|
|
1227
|
-
AllLogger,
|
|
1228
|
-
AppearanceMode,
|
|
1229
|
-
ConsoleLogger,
|
|
1230
|
-
LevelLogger,
|
|
1231
|
-
LogLevel,
|
|
1232
|
-
MatchFlag,
|
|
1233
|
-
NoopLogger,
|
|
1234
|
-
PDF_FORM_FIELD_FLAG,
|
|
1235
|
-
PDF_FORM_FIELD_TYPE,
|
|
1236
|
-
PdfActionType,
|
|
1237
|
-
PdfAnnotationBorderStyle,
|
|
1238
|
-
PdfAnnotationColorType,
|
|
1239
|
-
PdfAnnotationFlagName,
|
|
1240
|
-
PdfAnnotationFlags,
|
|
1241
|
-
PdfAnnotationObjectStatus,
|
|
1242
|
-
PdfAnnotationState,
|
|
1243
|
-
PdfAnnotationStateModel,
|
|
1244
|
-
PdfAnnotationSubtype,
|
|
1245
|
-
PdfAnnotationSubtypeName,
|
|
1246
|
-
PdfBomOrZwnbsp,
|
|
1247
|
-
PdfEngineFeature,
|
|
1248
|
-
PdfEngineOperation,
|
|
1249
|
-
PdfErrorCode,
|
|
1250
|
-
PdfNonCharacterFFFE,
|
|
1251
|
-
PdfNonCharacterFFFF,
|
|
1252
|
-
PdfPageFlattenFlag,
|
|
1253
|
-
PdfPageFlattenResult,
|
|
1254
|
-
PdfPageObjectType,
|
|
1255
|
-
PdfPermission,
|
|
1256
|
-
PdfSegmentObjectType,
|
|
1257
|
-
PdfSoftHyphenMarker,
|
|
1258
|
-
PdfTaskHelper,
|
|
1259
|
-
PdfUnwantedTextMarkers,
|
|
1260
|
-
PdfUnwantedTextRegex,
|
|
1261
|
-
PdfWordJoiner,
|
|
1262
|
-
PdfZeroWidthSpace,
|
|
1263
|
-
PdfZoomMode,
|
|
1264
|
-
PerfLogger,
|
|
1265
|
-
Rotation,
|
|
1266
|
-
Task,
|
|
1267
|
-
TaskAbortedError,
|
|
1268
|
-
TaskRejectedError,
|
|
1269
|
-
TaskStage,
|
|
1270
|
-
boundingRect,
|
|
1271
|
-
calculateAngle,
|
|
1272
|
-
calculateDegree,
|
|
1273
|
-
compareSearchTarget,
|
|
1274
|
-
dateToPdfDate,
|
|
1275
|
-
flagsToNames,
|
|
1276
|
-
ignore,
|
|
1277
|
-
makeMatrix,
|
|
1278
|
-
namesToFlags,
|
|
1279
|
-
pdfAlphaColorToWebAlphaColor,
|
|
1280
|
-
pdfDateToDate,
|
|
1281
|
-
quadToRect,
|
|
1282
|
-
rectToQuad,
|
|
1283
|
-
restoreOffset,
|
|
1284
|
-
restorePosition,
|
|
1285
|
-
restoreRect,
|
|
1286
|
-
rotatePosition,
|
|
1287
|
-
rotateRect,
|
|
1288
|
-
scalePosition,
|
|
1289
|
-
scaleRect,
|
|
1290
|
-
stripPdfUnwantedMarkers,
|
|
1291
|
-
swap,
|
|
1292
|
-
toIntPos,
|
|
1293
|
-
toIntRect,
|
|
1294
|
-
toIntSize,
|
|
1295
|
-
transformPosition,
|
|
1296
|
-
transformRect,
|
|
1297
|
-
transformSize,
|
|
1298
|
-
unionFlags,
|
|
1299
|
-
webAlphaColorToPdfAlphaColor
|
|
1300
|
-
});
|
|
1301
|
-
//# sourceMappingURL=index.cjs.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e=(e=>(e[e.Degree0=0]="Degree0",e[e.Degree90=1]="Degree90",e[e.Degree180=2]="Degree180",e[e.Degree270=3]="Degree270",e))(e||{});function t(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function r(e){return{width:Math.ceil(e.width),height:Math.ceil(e.height)}}function o(e){switch(e){case 0:return 0;case 1:return 90;case 2:return 180;case 3:return 270}}function n(e){const{width:t,height:r}=e;return{width:r,height:t}}function i(e,t,r){let o=t.x,n=t.y;switch(r){case 0:o=t.x,n=t.y;break;case 1:o=e.height-t.y,n=t.x;break;case 2:o=e.width-t.x,n=e.height-t.y;break;case 3:o=t.y,n=e.width-t.x}return{x:o,y:n}}function s(e,t){return{x:e.x*t,y:e.y*t}}function a(e,t,r){let o=t.origin.x,i=t.origin.y,s=t.size;switch(r){case 0:break;case 1:o=e.height-t.origin.y-t.size.height,i=t.origin.x,s=n(t.size);break;case 2:o=e.width-t.origin.x-t.size.width,i=e.height-t.origin.y-t.size.height;break;case 3:o=t.origin.y,i=e.width-t.origin.x-t.size.width,s=n(t.size)}return{origin:{x:o,y:i},size:{width:s.width,height:s.height}}}function c(e,t){return{origin:{x:e.origin.x*t,y:e.origin.y*t},size:{width:e.size.width*t,height:e.size.height*t}}}var l=(e=>(e[e.Debug=0]="Debug",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error",e))(l||{});var d=(e=>(e[e.Pending=0]="Pending",e[e.Resolved=1]="Resolved",e[e.Rejected=2]="Rejected",e[e.Aborted=3]="Aborted",e))(d||{});class h extends Error{constructor(e){super(`Task aborted: ${JSON.stringify(e)}`),this.name="TaskAbortedError"}}class g extends Error{constructor(e){super(`Task rejected: ${JSON.stringify(e)}`),this.name="TaskRejectedError"}}class u{constructor(){this.state={stage:0},this.resolvedCallbacks=[],this.rejectedCallbacks=[],this._promise=null}toPromise(){return this._promise||(this._promise=new Promise(((e,t)=>{this.wait((t=>e(t)),(e=>{"abort"===e.type?t(new h(e.reason)):t(new g(e.reason))}))}))),this._promise}wait(e,t){switch(this.state.stage){case 0:this.resolvedCallbacks.push(e),this.rejectedCallbacks.push(t);break;case 1:e(this.state.result);break;case 2:t({type:"reject",reason:this.state.reason});break;case 3:t({type:"abort",reason:this.state.reason})}}resolve(e){if(0===this.state.stage){this.state={stage:1,result:e};for(const r of this.resolvedCallbacks)try{r(e)}catch(t){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}reject(e){if(0===this.state.stage){this.state={stage:2,reason:e};for(const r of this.rejectedCallbacks)try{r({type:"reject",reason:e})}catch(t){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}abort(e){if(0===this.state.stage){this.state={stage:3,reason:e};for(const r of this.rejectedCallbacks)try{r({type:"abort",reason:e})}catch(t){}this.resolvedCallbacks=[],this.rejectedCallbacks=[]}}fail(e){"abort"===e.type?this.abort(e.reason):this.reject(e.reason)}static all(e){const t=new u;if(0===e.length)return t.resolve([]),t;const r=new Array(e.length);let o=0,n=!1;return e.forEach(((i,s)=>{i.wait((i=>{n||(r[s]=i,o++,o===e.length&&(n=!0,t.resolve(r)))}),(e=>{n||(n=!0,"abort"===e.type?t.abort(e.reason):t.reject(e.reason))}))})),t}static allSettled(e){const t=new u;if(0===e.length)return t.resolve([]),t;const r=new Array(e.length);let o=0;return e.forEach(((n,i)=>{n.wait((n=>{r[i]={status:"resolved",value:n},o++,o===e.length&&t.resolve(r)}),(n=>{r[i]={status:"abort"===n.type?"aborted":"rejected",reason:n.reason},o++,o===e.length&&t.resolve(r)}))})),t}static race(e){const t=new u;if(0===e.length)return t.reject("No tasks provided"),t;let r=!1;return e.forEach((e=>{e.wait((e=>{r||(r=!0,t.resolve(e))}),(e=>{r||(r=!0,"abort"===e.type?t.abort(e.reason):t.reject(e.reason))}))})),t}static withProgress(e,t){const r=u.all(e);if(t){let r=0;e.forEach((o=>{o.wait((()=>{r++,t(r,e.length)}),(()=>{r++,t(r,e.length)}))}))}return r}}const p=Object.freeze(["","","","\ufeff","",""]),f=new RegExp(`[${p.join("")}]`,"g");var x=(e=>(e[e.Unknown=0]="Unknown",e[e.XYZ=1]="XYZ",e[e.FitPage=2]="FitPage",e[e.FitHorizontal=3]="FitHorizontal",e[e.FitVertical=4]="FitVertical",e[e.FitRectangle=5]="FitRectangle",e))(x||{}),E=(e=>(e[e.Normal=0]="Normal",e[e.Multiply=1]="Multiply",e[e.Screen=2]="Screen",e[e.Overlay=3]="Overlay",e[e.Darken=4]="Darken",e[e.Lighten=5]="Lighten",e[e.ColorDodge=6]="ColorDodge",e[e.ColorBurn=7]="ColorBurn",e[e.HardLight=8]="HardLight",e[e.SoftLight=9]="SoftLight",e[e.Difference=10]="Difference",e[e.Exclusion=11]="Exclusion",e[e.Hue=12]="Hue",e[e.Saturation=13]="Saturation",e[e.Color=14]="Color",e[e.Luminosity=15]="Luminosity",e))(E||{});const C=Symbol("mixed"),T=Object.freeze([{id:0,label:"Normal",css:"normal"},{id:1,label:"Multiply",css:"multiply"},{id:2,label:"Screen",css:"screen"},{id:3,label:"Overlay",css:"overlay"},{id:4,label:"Darken",css:"darken"},{id:5,label:"Lighten",css:"lighten"},{id:6,label:"Color Dodge",css:"color-dodge"},{id:7,label:"Color Burn",css:"color-burn"},{id:8,label:"Hard Light",css:"hard-light"},{id:9,label:"Soft Light",css:"soft-light"},{id:10,label:"Difference",css:"difference"},{id:11,label:"Exclusion",css:"exclusion"},{id:12,label:"Hue",css:"hue"},{id:13,label:"Saturation",css:"saturation"},{id:14,label:"Color",css:"color"},{id:15,label:"Luminosity",css:"luminosity"}]),O=T.reduce(((e,t)=>(e[t.id]=t,e)),{}),N=T.reduce(((e,t)=>(e[t.css]=t.id,e)),{});function A(e){return O[e]??O[0]}function I(e){return A(e).label}const y=T.map((e=>({value:e.id,label:e.label})));var R=(e=>(e[e.Unsupported=0]="Unsupported",e[e.Goto=1]="Goto",e[e.RemoteGoto=2]="RemoteGoto",e[e.URI=3]="URI",e[e.LaunchAppOrOpenFile=4]="LaunchAppOrOpenFile",e))(R||{}),w=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.TEXT=1]="TEXT",e[e.LINK=2]="LINK",e[e.FREETEXT=3]="FREETEXT",e[e.LINE=4]="LINE",e[e.SQUARE=5]="SQUARE",e[e.CIRCLE=6]="CIRCLE",e[e.POLYGON=7]="POLYGON",e[e.POLYLINE=8]="POLYLINE",e[e.HIGHLIGHT=9]="HIGHLIGHT",e[e.UNDERLINE=10]="UNDERLINE",e[e.SQUIGGLY=11]="SQUIGGLY",e[e.STRIKEOUT=12]="STRIKEOUT",e[e.STAMP=13]="STAMP",e[e.CARET=14]="CARET",e[e.INK=15]="INK",e[e.POPUP=16]="POPUP",e[e.FILEATTACHMENT=17]="FILEATTACHMENT",e[e.SOUND=18]="SOUND",e[e.MOVIE=19]="MOVIE",e[e.WIDGET=20]="WIDGET",e[e.SCREEN=21]="SCREEN",e[e.PRINTERMARK=22]="PRINTERMARK",e[e.TRAPNET=23]="TRAPNET",e[e.WATERMARK=24]="WATERMARK",e[e.THREED=25]="THREED",e[e.RICHMEDIA=26]="RICHMEDIA",e[e.XFAWIDGET=27]="XFAWIDGET",e[e.REDACT=28]="REDACT",e))(w||{});const D={0:"unknow",1:"text",2:"link",3:"freetext",4:"line",5:"square",6:"circle",7:"polygon",8:"polyline",9:"highlight",10:"underline",11:"squiggly",12:"strikeout",13:"stamp",14:"caret",15:"ink",16:"popup",17:"fileattachment",18:"sound",19:"movie",20:"widget",21:"screen",22:"printermark",23:"trapnet",24:"watermark",25:"threed",26:"richmedia",27:"xfawidget",28:"redact"};var b=(e=>(e[e.Created=0]="Created",e[e.Committed=1]="Committed",e))(b||{}),m=(e=>(e[e.Normal=0]="Normal",e[e.Rollover=1]="Rollover",e[e.Down=2]="Down",e))(m||{}),P=(e=>(e.Marked="Marked",e.Unmarked="Unmarked",e.Accepted="Accepted",e.Rejected="Rejected",e.Complete="Complete",e.Cancelled="Cancelled",e.None="None",e))(P||{}),M=(e=>(e.Marked="Marked",e.Reviewed="Reviewed",e))(M||{}),L=(e=>(e[e.None=0]="None",e[e.Square=1]="Square",e[e.Circle=2]="Circle",e[e.Diamond=3]="Diamond",e[e.OpenArrow=4]="OpenArrow",e[e.ClosedArrow=5]="ClosedArrow",e[e.Butt=6]="Butt",e[e.ROpenArrow=7]="ROpenArrow",e[e.RClosedArrow=8]="RClosedArrow",e[e.Slash=9]="Slash",e[e.Unknown=10]="Unknown",e))(L||{}),S=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.PUSHBUTTON=1]="PUSHBUTTON",e[e.CHECKBOX=2]="CHECKBOX",e[e.RADIOBUTTON=3]="RADIOBUTTON",e[e.COMBOBOX=4]="COMBOBOX",e[e.LISTBOX=5]="LISTBOX",e[e.TEXTFIELD=6]="TEXTFIELD",e[e.SIGNATURE=7]="SIGNATURE",e[e.XFA=8]="XFA",e[e.XFA_CHECKBOX=9]="XFA_CHECKBOX",e[e.XFA_COMBOBOX=10]="XFA_COMBOBOX",e[e.XFA_IMAGEFIELD=11]="XFA_IMAGEFIELD",e[e.XFA_LISTBOX=12]="XFA_LISTBOX",e[e.XFA_PUSHBUTTON=13]="XFA_PUSHBUTTON",e[e.XFA_SIGNATURE=14]="XFA_SIGNATURE",e[e.XFA_TEXTFIELD=15]="XFA_TEXTFIELD",e))(S||{}),F=(e=>(e[e.Color=0]="Color",e[e.InteriorColor=1]="InteriorColor",e))(F||{}),k=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.SOLID=1]="SOLID",e[e.DASHED=2]="DASHED",e[e.BEVELED=3]="BEVELED",e[e.INSET=4]="INSET",e[e.UNDERLINE=5]="UNDERLINE",e[e.CLOUDY=6]="CLOUDY",e))(k||{}),U=(e=>(e[e.NONE=0]="NONE",e[e.INVISIBLE=1]="INVISIBLE",e[e.HIDDEN=2]="HIDDEN",e[e.PRINT=4]="PRINT",e[e.NO_ZOOM=8]="NO_ZOOM",e[e.NO_ROTATE=16]="NO_ROTATE",e[e.NO_VIEW=32]="NO_VIEW",e[e.READ_ONLY=64]="READ_ONLY",e[e.LOCKED=128]="LOCKED",e[e.TOGGLE_NOVIEW=256]="TOGGLE_NOVIEW",e))(U||{}),$=(e=>(e[e.NONE=0]="NONE",e[e.READONLY=1]="READONLY",e[e.REQUIRED=2]="REQUIRED",e[e.NOEXPORT=4]="NOEXPORT",e[e.TEXT_MULTIPLINE=4096]="TEXT_MULTIPLINE",e[e.TEXT_PASSWORD=8192]="TEXT_PASSWORD",e[e.CHOICE_COMBO=131072]="CHOICE_COMBO",e[e.CHOICE_EDIT=262144]="CHOICE_EDIT",e[e.CHOICE_MULTL_SELECT=2097152]="CHOICE_MULTL_SELECT",e))($||{}),v=(e=>(e[e.UNKNOWN=0]="UNKNOWN",e[e.TEXT=1]="TEXT",e[e.PATH=2]="PATH",e[e.IMAGE=3]="IMAGE",e[e.SHADING=4]="SHADING",e[e.FORM=5]="FORM",e))(v||{});const X=Object.freeze({1:"invisible",2:"hidden",4:"print",8:"noZoom",16:"noRotate",32:"noView",64:"readOnly",128:"locked",256:"toggleNoView"}),B=Object.entries(X).reduce(((e,[t,r])=>(e[r]=Number(t),e)),{});var H=(e=>(e[e.UNKNOWN=-1]="UNKNOWN",e[e.LINETO=0]="LINETO",e[e.BEZIERTO=1]="BEZIERTO",e[e.MOVETO=2]="MOVETO",e))(H||{}),_=(e=>(e[e.RenderPage=0]="RenderPage",e[e.RenderPageRect=1]="RenderPageRect",e[e.Thumbnails=2]="Thumbnails",e[e.Bookmarks=3]="Bookmarks",e[e.Annotations=4]="Annotations",e))(_||{}),z=(e=>(e[e.Create=0]="Create",e[e.Read=1]="Read",e[e.Update=2]="Update",e[e.Delete=3]="Delete",e))(z||{}),j=(e=>(e[e.None=0]="None",e[e.MatchCase=1]="MatchCase",e[e.MatchWholeWord=2]="MatchWholeWord",e[e.MatchConsecutive=4]="MatchConsecutive",e))(j||{});function G(e){return e.reduce(((e,t)=>e|t),0)}var W=(e=>(e[e.PrintDocument=8]="PrintDocument",e[e.ModifyContent=16]="ModifyContent",e[e.CopyOrExtract=32]="CopyOrExtract",e[e.AddOrModifyTextAnnot=64]="AddOrModifyTextAnnot",e[e.FillInExistingForm=512]="FillInExistingForm",e[e.ExtractTextOrGraphics=1024]="ExtractTextOrGraphics",e[e.AssembleDocument=2048]="AssembleDocument",e[e.PrintHighQuality=4096]="PrintHighQuality",e))(W||{}),K=(e=>(e[e.Display=0]="Display",e[e.Print=1]="Print",e))(K||{}),V=(e=>(e[e.Fail=0]="Fail",e[e.Success=1]="Success",e[e.NothingToDo=2]="NothingToDo",e))(V||{}),Y=(e=>(e[e.Ok=0]="Ok",e[e.Unknown=1]="Unknown",e[e.NotFound=2]="NotFound",e[e.WrongFormat=3]="WrongFormat",e[e.Password=4]="Password",e[e.Security=5]="Security",e[e.PageError=6]="PageError",e[e.XFALoad=7]="XFALoad",e[e.XFALayout=8]="XFALayout",e[e.Cancelled=9]="Cancelled",e[e.Initialization=10]="Initialization",e[e.NotReady=11]="NotReady",e[e.NotSupport=12]="NotSupport",e[e.LoadDoc=13]="LoadDoc",e[e.DocNotOpen=14]="DocNotOpen",e[e.CantCloseDoc=15]="CantCloseDoc",e[e.CantCreateNewDoc=16]="CantCreateNewDoc",e[e.CantImportPages=17]="CantImportPages",e[e.CantCreateAnnot=18]="CantCreateAnnot",e[e.CantSetAnnotRect=19]="CantSetAnnotRect",e[e.CantSetAnnotContent=20]="CantSetAnnotContent",e[e.CantRemoveInkList=21]="CantRemoveInkList",e[e.CantAddInkStoke=22]="CantAddInkStoke",e[e.CantReadAttachmentSize=23]="CantReadAttachmentSize",e[e.CantReadAttachmentContent=24]="CantReadAttachmentContent",e[e.CantFocusAnnot=25]="CantFocusAnnot",e[e.CantSelectText=26]="CantSelectText",e[e.CantSelectOption=27]="CantSelectOption",e[e.CantCheckField=28]="CantCheckField",e))(Y||{});exports.AllLogger=class{constructor(e){this.loggers=e}debug(e,t,...r){for(const o of this.loggers)o.debug(e,t,...r)}info(e,t,...r){for(const o of this.loggers)o.info(e,t,...r)}warn(e,t,...r){for(const o of this.loggers)o.warn(e,t,...r)}error(e,t,...r){for(const o of this.loggers)o.error(e,t,...r)}perf(e,t,r,o,...n){for(const i of this.loggers)i.perf(e,t,r,o,...n)}},exports.AppearanceMode=m,exports.ConsoleLogger=class{debug(e,t,...r){console.debug(`${e}.${t}`,...r)}info(e,t,...r){console.info(`${e}.${t}`,...r)}warn(e,t,...r){console.warn(`${e}.${t}`,...r)}error(e,t,...r){console.error(`${e}.${t}`,...r)}perf(e,t,r,o,...n){console.info(`${e}.${t}.${r}.${o}`,...n)}},exports.LevelLogger=class{constructor(e,t){this.logger=e,this.level=t}debug(e,t,...r){this.level<=0&&this.logger.debug(e,t,...r)}info(e,t,...r){this.level<=1&&this.logger.info(e,t,...r)}warn(e,t,...r){this.level<=2&&this.logger.warn(e,t,...r)}error(e,t,...r){this.level<=3&&this.logger.error(e,t,...r)}perf(e,t,r,o,...n){this.logger.perf(e,t,r,o,...n)}},exports.LogLevel=l,exports.MatchFlag=j,exports.MixedBlendMode=C,exports.NoopLogger=class{debug(){}info(){}warn(){}error(){}perf(){}},exports.PDF_FORM_FIELD_FLAG=$,exports.PDF_FORM_FIELD_TYPE=S,exports.PdfActionType=R,exports.PdfAnnotationBorderStyle=k,exports.PdfAnnotationColorType=F,exports.PdfAnnotationFlagName=X,exports.PdfAnnotationFlags=U,exports.PdfAnnotationLineEnding=L,exports.PdfAnnotationObjectStatus=b,exports.PdfAnnotationState=P,exports.PdfAnnotationStateModel=M,exports.PdfAnnotationSubtype=w,exports.PdfAnnotationSubtypeName=D,exports.PdfBlendMode=E,exports.PdfBomOrZwnbsp="\ufeff",exports.PdfEngineFeature=_,exports.PdfEngineOperation=z,exports.PdfErrorCode=Y,exports.PdfNonCharacterFFFE="",exports.PdfNonCharacterFFFF="",exports.PdfPageFlattenFlag=K,exports.PdfPageFlattenResult=V,exports.PdfPageObjectType=v,exports.PdfPermission=W,exports.PdfSegmentObjectType=H,exports.PdfSoftHyphenMarker="",exports.PdfTaskHelper=class{static create(){return new u}static resolve(e){const t=new u;return t.resolve(e),t}static reject(e){const t=new u;return t.reject(e),t}static abort(e){const t=new u;return t.reject(e),t}},exports.PdfUnwantedTextMarkers=p,exports.PdfUnwantedTextRegex=f,exports.PdfWordJoiner="",exports.PdfZeroWidthSpace="",exports.PdfZoomMode=x,exports.PerfLogger=class{constructor(){}debug(e,t,...r){}info(e,t,...r){}warn(e,t,...r){}error(e,t,...r){}perf(e,t,r,o,n,...i){switch(o){case"Begin":window.performance.mark(`${e}.${t}.${r}.${o}.${n}`,{detail:i});break;case"End":window.performance.mark(`${e}.${t}.${r}.${o}.${n}`,{detail:i}),window.performance.measure(`${e}.${t}.${r}.Measure.${n}`,`${e}.${t}.${r}.Begin.${n}`,`${e}.${t}.${r}.End.${n}`)}}},exports.Rotation=e,exports.Task=u,exports.TaskAbortedError=h,exports.TaskRejectedError=g,exports.TaskStage=d,exports.blendModeLabel=I,exports.blendModeSelectOptions=y,exports.blendModeToCss=function(e){return A(e).css},exports.boundingRect=function(e){if(0===e.length)return null;let t=e[0].origin.x,r=e[0].origin.y,o=e[0].origin.x+e[0].size.width,n=e[0].origin.y+e[0].size.height;for(const i of e)t=Math.min(t,i.origin.x),r=Math.min(r,i.origin.y),o=Math.max(o,i.origin.x+i.size.width),n=Math.max(n,i.origin.y+i.size.height);return{origin:{x:t,y:r},size:{width:o-t,height:n-r}}},exports.calculateAngle=function(e){return o(e)*Math.PI/180},exports.calculateDegree=o,exports.compareSearchTarget=function(e,t){return G(e.flags)===G(t.flags)&&e.keyword===t.keyword},exports.cssToBlendMode=function(e){return N[e]},exports.dateToPdfDate=function(e=new Date){const t=(e,t=2)=>e.toString().padStart(t,"0");return`D:${e.getUTCFullYear()}${t(e.getUTCMonth()+1)}${t(e.getUTCDate())}${t(e.getUTCHours())}${t(e.getUTCMinutes())}${t(e.getUTCSeconds())}`},exports.expandRect=function(e,t){return{origin:{x:e.origin.x-t,y:e.origin.y-t},size:{width:e.size.width+2*t,height:e.size.height+2*t}}},exports.flagsToNames=function(e){return Object.keys(X).filter((t=>!!(e&t))).map((e=>X[e]))},exports.getBlendModeInfo=A,exports.ignore=function(){},exports.makeMatrix=(e,t,r)=>{const{width:o,height:n}=e.size;switch(t){case 0:return{a:r,b:0,c:0,d:-r,e:0,f:n*r};case 1:return{a:0,b:r,c:r,d:0,e:0,f:0};case 2:return{a:-r,b:0,c:0,d:r,e:o*r,f:0};case 3:return{a:0,b:-r,c:-r,d:0,e:n*r,f:o*r}}},exports.namesToFlags=function(e){return e.reduce(((e,t)=>e|B[t]),0)},exports.pdfAlphaColorToWebAlphaColor=function(e){const t=e=>Math.max(0,Math.min(255,e)),r=e=>t(e).toString(16).padStart(2,"0");return{color:`#${r(e.red)}${r(e.green)}${r(e.blue)}`,opacity:t(e.alpha)/255}},exports.pdfDateToDate=function(e){if(!(null==e?void 0:e.startsWith("D:"))||e.length<16)return;const t=+e.slice(2,6),r=+e.slice(6,8)-1,o=+e.slice(8,10),n=+e.slice(10,12),i=+e.slice(12,14),s=+e.slice(14,16);return new Date(Date.UTC(t,r,o,n,i,s))},exports.quadToRect=function(e){const t=[e.p1.x,e.p2.x,e.p3.x,e.p4.x],r=[e.p1.y,e.p2.y,e.p3.y,e.p4.y];return{origin:{x:Math.min(...t),y:Math.min(...r)},size:{width:Math.max(...t)-Math.min(...t),height:Math.max(...r)-Math.min(...r)}}},exports.rectEquals=function(e,t){return e.origin.x===t.origin.x&&e.origin.y===t.origin.y&&e.size.width===t.size.width&&e.size.height===t.size.height},exports.rectFromPoints=function(e){if(0===e.length)return{origin:{x:0,y:0},size:{width:0,height:0}};const t=e.map((e=>e.x)),r=e.map((e=>e.y)),o=Math.min(...t),n=Math.min(...r);return{origin:{x:o,y:n},size:{width:Math.max(...t)-o,height:Math.max(...r)-n}}},exports.rectToQuad=function(e){return{p1:{x:e.origin.x,y:e.origin.y},p2:{x:e.origin.x+e.size.width,y:e.origin.y},p3:{x:e.origin.x+e.size.width,y:e.origin.y+e.size.height},p4:{x:e.origin.x,y:e.origin.y+e.size.height}}},exports.reduceBlendModes=function(e){if(!e.length)return 0;const t=e[0];return e.every((e=>e===t))?t:C},exports.restoreOffset=function(e,t,r){let o=e.x,n=e.y;switch(t){case 0:o=e.x/r,n=e.y/r;break;case 1:o=e.y/r,n=-e.x/r;break;case 2:o=-e.x/r,n=-e.y/r;break;case 3:o=-e.y/r,n=e.x/r}return{x:o,y:n}},exports.restorePosition=function(e,t,r,o){return s(i(e,t,(4-r)%4),1/o)},exports.restoreRect=function(e,t,r,o){return c(a(e,t,(4-r)%4),1/o)},exports.rotateAndTranslatePoint=function(e,t,r){const o=Math.cos(t),n=Math.sin(t),i=e.x*o-e.y*n,s=e.x*n+e.y*o;return{x:i+r.x,y:s+r.y}},exports.rotatePosition=i,exports.rotateRect=a,exports.scalePosition=s,exports.scaleRect=c,exports.stripPdfUnwantedMarkers=function(e){return e.replace(f,"")},exports.swap=n,exports.toIntPos=t,exports.toIntRect=function(e){return{origin:t(e.origin),size:r(e.size)}},exports.toIntSize=r,exports.transformPosition=function(e,t,r,o){return s(i(e,t,r),o)},exports.transformRect=function(e,t,r,o){return c(a(e,t,r),o)},exports.transformSize=function(e,t,r){return{width:(e=t%2==0?e:n(e)).width*r,height:e.height*r}},exports.uiBlendModeDisplay=function(e){return e===C?"(mixed)":I(e)},exports.unionFlags=G,exports.webAlphaColorToPdfAlphaColor=function({color:e,opacity:t}){/^#?[0-9a-f]{3}$/i.test(e)&&(e=e.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3").toLowerCase());const[,r,o,n]=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e)??(()=>{throw new Error(`Invalid hex colour: “${e}”`)})();return{red:parseInt(r,16),green:parseInt(o,16),blue:parseInt(n,16),alpha:((e,t=255)=>Math.max(0,Math.min(t,e)))(Math.round(255*t))}};
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|