@embedpdf/models 1.0.11 → 1.0.12

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/index.js CHANGED
@@ -1,4 +1,3 @@
1
- // src/geometry.ts
2
1
  var Rotation = /* @__PURE__ */ ((Rotation2) => {
3
2
  Rotation2[Rotation2["Degree0"] = 0] = "Degree0";
4
3
  Rotation2[Rotation2["Degree90"] = 1] = "Degree90";
@@ -20,13 +19,13 @@ function toIntRect(r) {
20
19
  }
21
20
  function calculateDegree(rotation) {
22
21
  switch (rotation) {
23
- case 0 /* Degree0 */:
22
+ case 0:
24
23
  return 0;
25
- case 1 /* Degree90 */:
24
+ case 1:
26
25
  return 90;
27
- case 2 /* Degree180 */:
26
+ case 2:
28
27
  return 180;
29
- case 3 /* Degree270 */:
28
+ case 3:
30
29
  return 270;
31
30
  }
32
31
  }
@@ -70,19 +69,19 @@ function rotatePosition(containerSize, position, rotation) {
70
69
  let x = position.x;
71
70
  let y = position.y;
72
71
  switch (rotation) {
73
- case 0 /* Degree0 */:
72
+ case 0:
74
73
  x = position.x;
75
74
  y = position.y;
76
75
  break;
77
- case 1 /* Degree90 */:
76
+ case 1:
78
77
  x = containerSize.height - position.y;
79
78
  y = position.x;
80
79
  break;
81
- case 2 /* Degree180 */:
80
+ case 2:
82
81
  x = containerSize.width - position.x;
83
82
  y = containerSize.height - position.y;
84
83
  break;
85
- case 3 /* Degree270 */:
84
+ case 3:
86
85
  x = position.y;
87
86
  y = containerSize.width - position.x;
88
87
  break;
@@ -112,18 +111,18 @@ function rotateRect(containerSize, rect, rotation) {
112
111
  let y = rect.origin.y;
113
112
  let size = rect.size;
114
113
  switch (rotation) {
115
- case 0 /* Degree0 */:
114
+ case 0:
116
115
  break;
117
- case 1 /* Degree90 */:
116
+ case 1:
118
117
  x = containerSize.height - rect.origin.y - rect.size.height;
119
118
  y = rect.origin.x;
120
119
  size = swap(rect.size);
121
120
  break;
122
- case 2 /* Degree180 */:
121
+ case 2:
123
122
  x = containerSize.width - rect.origin.x - rect.size.width;
124
123
  y = containerSize.height - rect.origin.y - rect.size.height;
125
124
  break;
126
- case 3 /* Degree270 */:
125
+ case 3:
127
126
  x = rect.origin.y;
128
127
  y = containerSize.width - rect.origin.x - rect.size.width;
129
128
  size = swap(rect.size);
@@ -162,19 +161,19 @@ function restoreOffset(offset, rotation, scaleFactor) {
162
161
  let offsetX = offset.x;
163
162
  let offsetY = offset.y;
164
163
  switch (rotation) {
165
- case 0 /* Degree0 */:
164
+ case 0:
166
165
  offsetX = offset.x / scaleFactor;
167
166
  offsetY = offset.y / scaleFactor;
168
167
  break;
169
- case 1 /* Degree90 */:
168
+ case 1:
170
169
  offsetX = offset.y / scaleFactor;
171
170
  offsetY = -offset.x / scaleFactor;
172
171
  break;
173
- case 2 /* Degree180 */:
172
+ case 2:
174
173
  offsetX = -offset.x / scaleFactor;
175
174
  offsetY = -offset.y / scaleFactor;
176
175
  break;
177
- case 3 /* Degree270 */:
176
+ case 3:
178
177
  offsetX = -offset.y / scaleFactor;
179
178
  offsetY = offset.x / scaleFactor;
180
179
  break;
@@ -204,10 +203,10 @@ function boundingRect(rects) {
204
203
  }
205
204
  };
206
205
  }
207
- var makeMatrix = (rectangle, rotation, scaleFactor) => {
206
+ const makeMatrix = (rectangle, rotation, scaleFactor) => {
208
207
  const { width, height } = rectangle.size;
209
208
  switch (rotation) {
210
- case 0 /* Degree0 */:
209
+ case 0:
211
210
  return {
212
211
  a: scaleFactor,
213
212
  b: 0,
@@ -216,7 +215,7 @@ var makeMatrix = (rectangle, rotation, scaleFactor) => {
216
215
  e: 0,
217
216
  f: height * scaleFactor
218
217
  };
219
- case 1 /* Degree90 */:
218
+ case 1:
220
219
  return {
221
220
  a: 0,
222
221
  b: scaleFactor,
@@ -225,7 +224,7 @@ var makeMatrix = (rectangle, rotation, scaleFactor) => {
225
224
  e: 0,
226
225
  f: 0
227
226
  };
228
- case 2 /* Degree180 */:
227
+ case 2:
229
228
  return {
230
229
  a: -scaleFactor,
231
230
  b: 0,
@@ -234,7 +233,7 @@ var makeMatrix = (rectangle, rotation, scaleFactor) => {
234
233
  e: width * scaleFactor,
235
234
  f: 0
236
235
  };
237
- case 3 /* Degree270 */:
236
+ case 3:
238
237
  return {
239
238
  a: 0,
240
239
  b: -scaleFactor,
@@ -245,9 +244,7 @@ var makeMatrix = (rectangle, rotation, scaleFactor) => {
245
244
  };
246
245
  }
247
246
  };
248
-
249
- // src/logger.ts
250
- var NoopLogger = class {
247
+ class NoopLogger {
251
248
  /** {@inheritDoc Logger.debug} */
252
249
  debug() {
253
250
  }
@@ -263,8 +260,8 @@ var NoopLogger = class {
263
260
  /** {@inheritDoc Logger.perf} */
264
261
  perf() {
265
262
  }
266
- };
267
- var ConsoleLogger = class {
263
+ }
264
+ class ConsoleLogger {
268
265
  /** {@inheritDoc Logger.debug} */
269
266
  debug(source, category, ...args) {
270
267
  console.debug(`${source}.${category}`, ...args);
@@ -285,7 +282,7 @@ var ConsoleLogger = class {
285
282
  perf(source, category, event, phase, ...args) {
286
283
  console.info(`${source}.${category}.${event}.${phase}`, ...args);
287
284
  }
288
- };
285
+ }
289
286
  var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
290
287
  LogLevel2[LogLevel2["Debug"] = 0] = "Debug";
291
288
  LogLevel2[LogLevel2["Info"] = 1] = "Info";
@@ -293,7 +290,7 @@ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
293
290
  LogLevel2[LogLevel2["Error"] = 3] = "Error";
294
291
  return LogLevel2;
295
292
  })(LogLevel || {});
296
- var LevelLogger = class {
293
+ class LevelLogger {
297
294
  /**
298
295
  * create new LevelLogger
299
296
  * @param logger - the original logger
@@ -305,25 +302,25 @@ var LevelLogger = class {
305
302
  }
306
303
  /** {@inheritDoc Logger.debug} */
307
304
  debug(source, category, ...args) {
308
- if (this.level <= 0 /* Debug */) {
305
+ if (this.level <= 0) {
309
306
  this.logger.debug(source, category, ...args);
310
307
  }
311
308
  }
312
309
  /** {@inheritDoc Logger.info} */
313
310
  info(source, category, ...args) {
314
- if (this.level <= 1 /* Info */) {
311
+ if (this.level <= 1) {
315
312
  this.logger.info(source, category, ...args);
316
313
  }
317
314
  }
318
315
  /** {@inheritDoc Logger.warn} */
319
316
  warn(source, category, ...args) {
320
- if (this.level <= 2 /* Warn */) {
317
+ if (this.level <= 2) {
321
318
  this.logger.warn(source, category, ...args);
322
319
  }
323
320
  }
324
321
  /** {@inheritDoc Logger.error} */
325
322
  error(source, category, ...args) {
326
- if (this.level <= 3 /* Error */) {
323
+ if (this.level <= 3) {
327
324
  this.logger.error(source, category, ...args);
328
325
  }
329
326
  }
@@ -331,8 +328,8 @@ var LevelLogger = class {
331
328
  perf(source, category, event, phase, ...args) {
332
329
  this.logger.perf(source, category, event, phase, ...args);
333
330
  }
334
- };
335
- var PerfLogger = class {
331
+ }
332
+ class PerfLogger {
336
333
  /**
337
334
  * create new PerfLogger
338
335
  */
@@ -370,8 +367,8 @@ var PerfLogger = class {
370
367
  break;
371
368
  }
372
369
  }
373
- };
374
- var AllLogger = class {
370
+ }
371
+ class AllLogger {
375
372
  /**
376
373
  * create new PerfLogger
377
374
  */
@@ -408,9 +405,7 @@ var AllLogger = class {
408
405
  logger.perf(source, category, event, phase, ...args);
409
406
  }
410
407
  }
411
- };
412
-
413
- // src/task.ts
408
+ }
414
409
  var TaskStage = /* @__PURE__ */ ((TaskStage2) => {
415
410
  TaskStage2[TaskStage2["Pending"] = 0] = "Pending";
416
411
  TaskStage2[TaskStage2["Resolved"] = 1] = "Resolved";
@@ -418,34 +413,26 @@ var TaskStage = /* @__PURE__ */ ((TaskStage2) => {
418
413
  TaskStage2[TaskStage2["Aborted"] = 3] = "Aborted";
419
414
  return TaskStage2;
420
415
  })(TaskStage || {});
421
- var TaskAbortedError = class extends Error {
416
+ class TaskAbortedError extends Error {
422
417
  constructor(reason) {
423
418
  super(`Task aborted: ${JSON.stringify(reason)}`);
424
419
  this.name = "TaskAbortedError";
425
420
  }
426
- };
427
- var TaskRejectedError = class extends Error {
421
+ }
422
+ class TaskRejectedError extends Error {
428
423
  constructor(reason) {
429
424
  super(`Task rejected: ${JSON.stringify(reason)}`);
430
425
  this.name = "TaskRejectedError";
431
426
  }
432
- };
433
- var Task = class _Task {
427
+ }
428
+ class Task {
434
429
  constructor() {
435
430
  this.state = {
436
- stage: 0 /* Pending */
431
+ stage: 0
432
+ /* Pending */
437
433
  };
438
- /**
439
- * callbacks that will be executed when task is resolved
440
- */
441
434
  this.resolvedCallbacks = [];
442
- /**
443
- * callbacks that will be executed when task is rejected
444
- */
445
435
  this.rejectedCallbacks = [];
446
- /**
447
- * Promise that will be resolved when task is settled
448
- */
449
436
  this._promise = null;
450
437
  }
451
438
  /**
@@ -476,20 +463,20 @@ var Task = class _Task {
476
463
  */
477
464
  wait(resolvedCallback, rejectedCallback) {
478
465
  switch (this.state.stage) {
479
- case 0 /* Pending */:
466
+ case 0:
480
467
  this.resolvedCallbacks.push(resolvedCallback);
481
468
  this.rejectedCallbacks.push(rejectedCallback);
482
469
  break;
483
- case 1 /* Resolved */:
470
+ case 1:
484
471
  resolvedCallback(this.state.result);
485
472
  break;
486
- case 2 /* Rejected */:
473
+ case 2:
487
474
  rejectedCallback({
488
475
  type: "reject",
489
476
  reason: this.state.reason
490
477
  });
491
478
  break;
492
- case 3 /* Aborted */:
479
+ case 3:
493
480
  rejectedCallback({
494
481
  type: "abort",
495
482
  reason: this.state.reason
@@ -502,9 +489,9 @@ var Task = class _Task {
502
489
  * @param result - result value
503
490
  */
504
491
  resolve(result) {
505
- if (this.state.stage === 0 /* Pending */) {
492
+ if (this.state.stage === 0) {
506
493
  this.state = {
507
- stage: 1 /* Resolved */,
494
+ stage: 1,
508
495
  result
509
496
  };
510
497
  for (const resolvedCallback of this.resolvedCallbacks) {
@@ -523,9 +510,9 @@ var Task = class _Task {
523
510
  *
524
511
  */
525
512
  reject(reason) {
526
- if (this.state.stage === 0 /* Pending */) {
513
+ if (this.state.stage === 0) {
527
514
  this.state = {
528
- stage: 2 /* Rejected */,
515
+ stage: 2,
529
516
  reason
530
517
  };
531
518
  for (const rejectedCallback of this.rejectedCallbacks) {
@@ -546,9 +533,9 @@ var Task = class _Task {
546
533
  * @param reason - abort reason
547
534
  */
548
535
  abort(reason) {
549
- if (this.state.stage === 0 /* Pending */) {
536
+ if (this.state.stage === 0) {
550
537
  this.state = {
551
- stage: 3 /* Aborted */,
538
+ stage: 3,
552
539
  reason
553
540
  };
554
541
  for (const rejectedCallback of this.rejectedCallbacks) {
@@ -586,7 +573,7 @@ var Task = class _Task {
586
573
  * @public
587
574
  */
588
575
  static all(tasks) {
589
- const combinedTask = new _Task();
576
+ const combinedTask = new Task();
590
577
  if (tasks.length === 0) {
591
578
  combinedTask.resolve([]);
592
579
  return combinedTask;
@@ -627,7 +614,7 @@ var Task = class _Task {
627
614
  * @public
628
615
  */
629
616
  static allSettled(tasks) {
630
- const combinedTask = new _Task();
617
+ const combinedTask = new Task();
631
618
  if (tasks.length === 0) {
632
619
  combinedTask.resolve([]);
633
620
  return combinedTask;
@@ -665,7 +652,7 @@ var Task = class _Task {
665
652
  * @public
666
653
  */
667
654
  static race(tasks) {
668
- const combinedTask = new _Task();
655
+ const combinedTask = new Task();
669
656
  if (tasks.length === 0) {
670
657
  combinedTask.reject("No tasks provided");
671
658
  return combinedTask;
@@ -700,7 +687,7 @@ var Task = class _Task {
700
687
  * @public
701
688
  */
702
689
  static withProgress(tasks, onProgress) {
703
- const combinedTask = _Task.all(tasks);
690
+ const combinedTask = Task.all(tasks);
704
691
  if (onProgress) {
705
692
  let completedCount = 0;
706
693
  tasks.forEach((task) => {
@@ -718,16 +705,14 @@ var Task = class _Task {
718
705
  }
719
706
  return combinedTask;
720
707
  }
721
- };
722
-
723
- // src/pdf.ts
724
- var PdfSoftHyphenMarker = "\xAD";
725
- var PdfZeroWidthSpace = "\u200B";
726
- var PdfWordJoiner = "\u2060";
727
- var PdfBomOrZwnbsp = "\uFEFF";
728
- var PdfNonCharacterFFFE = "\uFFFE";
729
- var PdfNonCharacterFFFF = "\uFFFF";
730
- var PdfUnwantedTextMarkers = Object.freeze([
708
+ }
709
+ const PdfSoftHyphenMarker = "­";
710
+ const PdfZeroWidthSpace = "​";
711
+ const PdfWordJoiner = "";
712
+ const PdfBomOrZwnbsp = "\uFEFF";
713
+ const PdfNonCharacterFFFE = "";
714
+ const PdfNonCharacterFFFF = "￿";
715
+ const PdfUnwantedTextMarkers = Object.freeze([
731
716
  PdfSoftHyphenMarker,
732
717
  PdfZeroWidthSpace,
733
718
  PdfWordJoiner,
@@ -735,7 +720,7 @@ var PdfUnwantedTextMarkers = Object.freeze([
735
720
  PdfNonCharacterFFFE,
736
721
  PdfNonCharacterFFFF
737
722
  ]);
738
- var PdfUnwantedTextRegex = new RegExp(`[${PdfUnwantedTextMarkers.join("")}]`, "g");
723
+ const PdfUnwantedTextRegex = new RegExp(`[${PdfUnwantedTextMarkers.join("")}]`, "g");
739
724
  function stripPdfUnwantedMarkers(text) {
740
725
  return text.replace(PdfUnwantedTextRegex, "");
741
726
  }
@@ -748,6 +733,85 @@ var PdfZoomMode = /* @__PURE__ */ ((PdfZoomMode2) => {
748
733
  PdfZoomMode2[PdfZoomMode2["FitRectangle"] = 5] = "FitRectangle";
749
734
  return PdfZoomMode2;
750
735
  })(PdfZoomMode || {});
736
+ var PdfBlendMode = /* @__PURE__ */ ((PdfBlendMode2) => {
737
+ PdfBlendMode2[PdfBlendMode2["Normal"] = 0] = "Normal";
738
+ PdfBlendMode2[PdfBlendMode2["Multiply"] = 1] = "Multiply";
739
+ PdfBlendMode2[PdfBlendMode2["Screen"] = 2] = "Screen";
740
+ PdfBlendMode2[PdfBlendMode2["Overlay"] = 3] = "Overlay";
741
+ PdfBlendMode2[PdfBlendMode2["Darken"] = 4] = "Darken";
742
+ PdfBlendMode2[PdfBlendMode2["Lighten"] = 5] = "Lighten";
743
+ PdfBlendMode2[PdfBlendMode2["ColorDodge"] = 6] = "ColorDodge";
744
+ PdfBlendMode2[PdfBlendMode2["ColorBurn"] = 7] = "ColorBurn";
745
+ PdfBlendMode2[PdfBlendMode2["HardLight"] = 8] = "HardLight";
746
+ PdfBlendMode2[PdfBlendMode2["SoftLight"] = 9] = "SoftLight";
747
+ PdfBlendMode2[PdfBlendMode2["Difference"] = 10] = "Difference";
748
+ PdfBlendMode2[PdfBlendMode2["Exclusion"] = 11] = "Exclusion";
749
+ PdfBlendMode2[PdfBlendMode2["Hue"] = 12] = "Hue";
750
+ PdfBlendMode2[PdfBlendMode2["Saturation"] = 13] = "Saturation";
751
+ PdfBlendMode2[PdfBlendMode2["Color"] = 14] = "Color";
752
+ PdfBlendMode2[PdfBlendMode2["Luminosity"] = 15] = "Luminosity";
753
+ return PdfBlendMode2;
754
+ })(PdfBlendMode || {});
755
+ const MixedBlendMode = Symbol("mixed");
756
+ const BLEND_MODE_INFOS = Object.freeze([
757
+ { id: 0, label: "Normal", css: "normal" },
758
+ { id: 1, label: "Multiply", css: "multiply" },
759
+ { id: 2, label: "Screen", css: "screen" },
760
+ { id: 3, label: "Overlay", css: "overlay" },
761
+ { id: 4, label: "Darken", css: "darken" },
762
+ { id: 5, label: "Lighten", css: "lighten" },
763
+ { id: 6, label: "Color Dodge", css: "color-dodge" },
764
+ { id: 7, label: "Color Burn", css: "color-burn" },
765
+ { id: 8, label: "Hard Light", css: "hard-light" },
766
+ { id: 9, label: "Soft Light", css: "soft-light" },
767
+ { id: 10, label: "Difference", css: "difference" },
768
+ { id: 11, label: "Exclusion", css: "exclusion" },
769
+ { id: 12, label: "Hue", css: "hue" },
770
+ { id: 13, label: "Saturation", css: "saturation" },
771
+ { id: 14, label: "Color", css: "color" },
772
+ { id: 15, label: "Luminosity", css: "luminosity" }
773
+ ]);
774
+ const enumToInfo = BLEND_MODE_INFOS.reduce(
775
+ (m, info) => {
776
+ m[info.id] = info;
777
+ return m;
778
+ },
779
+ {}
780
+ );
781
+ const cssToEnum = BLEND_MODE_INFOS.reduce(
782
+ (m, info) => {
783
+ m[info.css] = info.id;
784
+ return m;
785
+ },
786
+ {}
787
+ );
788
+ function getBlendModeInfo(mode) {
789
+ return enumToInfo[mode] ?? enumToInfo[
790
+ 0
791
+ /* Normal */
792
+ ];
793
+ }
794
+ function blendModeToCss(mode) {
795
+ return getBlendModeInfo(mode).css;
796
+ }
797
+ function cssToBlendMode(value) {
798
+ return cssToEnum[value];
799
+ }
800
+ function blendModeLabel(mode) {
801
+ return getBlendModeInfo(mode).label;
802
+ }
803
+ function reduceBlendModes(modes) {
804
+ if (!modes.length) return 0;
805
+ const first = modes[0];
806
+ return modes.every((m) => m === first) ? first : MixedBlendMode;
807
+ }
808
+ const blendModeSelectOptions = BLEND_MODE_INFOS.map((info) => ({
809
+ value: info.id,
810
+ label: info.label
811
+ }));
812
+ function uiBlendModeDisplay(value) {
813
+ return value === MixedBlendMode ? "(mixed)" : blendModeLabel(value);
814
+ }
751
815
  var PdfActionType = /* @__PURE__ */ ((PdfActionType2) => {
752
816
  PdfActionType2[PdfActionType2["Unsupported"] = 0] = "Unsupported";
753
817
  PdfActionType2[PdfActionType2["Goto"] = 1] = "Goto";
@@ -788,36 +852,123 @@ var PdfAnnotationSubtype = /* @__PURE__ */ ((PdfAnnotationSubtype2) => {
788
852
  PdfAnnotationSubtype2[PdfAnnotationSubtype2["REDACT"] = 28] = "REDACT";
789
853
  return PdfAnnotationSubtype2;
790
854
  })(PdfAnnotationSubtype || {});
791
- var PdfAnnotationSubtypeName = {
792
- [0 /* UNKNOWN */]: "unknow",
793
- [1 /* TEXT */]: "text",
794
- [2 /* LINK */]: "link",
795
- [3 /* FREETEXT */]: "freetext",
796
- [4 /* LINE */]: "line",
797
- [5 /* SQUARE */]: "square",
798
- [6 /* CIRCLE */]: "circle",
799
- [7 /* POLYGON */]: "polygon",
800
- [8 /* POLYLINE */]: "polyline",
801
- [9 /* HIGHLIGHT */]: "highlight",
802
- [10 /* UNDERLINE */]: "underline",
803
- [11 /* SQUIGGLY */]: "squiggly",
804
- [12 /* STRIKEOUT */]: "strikeout",
805
- [13 /* STAMP */]: "stamp",
806
- [14 /* CARET */]: "caret",
807
- [15 /* INK */]: "ink",
808
- [16 /* POPUP */]: "popup",
809
- [17 /* FILEATTACHMENT */]: "fileattachment",
810
- [18 /* SOUND */]: "sound",
811
- [19 /* MOVIE */]: "movie",
812
- [20 /* WIDGET */]: "widget",
813
- [21 /* SCREEN */]: "screen",
814
- [22 /* PRINTERMARK */]: "printermark",
815
- [23 /* TRAPNET */]: "trapnet",
816
- [24 /* WATERMARK */]: "watermark",
817
- [25 /* THREED */]: "threed",
818
- [26 /* RICHMEDIA */]: "richmedia",
819
- [27 /* XFAWIDGET */]: "xfawidget",
820
- [28 /* REDACT */]: "redact"
855
+ const PdfAnnotationSubtypeName = {
856
+ [
857
+ 0
858
+ /* UNKNOWN */
859
+ ]: "unknow",
860
+ [
861
+ 1
862
+ /* TEXT */
863
+ ]: "text",
864
+ [
865
+ 2
866
+ /* LINK */
867
+ ]: "link",
868
+ [
869
+ 3
870
+ /* FREETEXT */
871
+ ]: "freetext",
872
+ [
873
+ 4
874
+ /* LINE */
875
+ ]: "line",
876
+ [
877
+ 5
878
+ /* SQUARE */
879
+ ]: "square",
880
+ [
881
+ 6
882
+ /* CIRCLE */
883
+ ]: "circle",
884
+ [
885
+ 7
886
+ /* POLYGON */
887
+ ]: "polygon",
888
+ [
889
+ 8
890
+ /* POLYLINE */
891
+ ]: "polyline",
892
+ [
893
+ 9
894
+ /* HIGHLIGHT */
895
+ ]: "highlight",
896
+ [
897
+ 10
898
+ /* UNDERLINE */
899
+ ]: "underline",
900
+ [
901
+ 11
902
+ /* SQUIGGLY */
903
+ ]: "squiggly",
904
+ [
905
+ 12
906
+ /* STRIKEOUT */
907
+ ]: "strikeout",
908
+ [
909
+ 13
910
+ /* STAMP */
911
+ ]: "stamp",
912
+ [
913
+ 14
914
+ /* CARET */
915
+ ]: "caret",
916
+ [
917
+ 15
918
+ /* INK */
919
+ ]: "ink",
920
+ [
921
+ 16
922
+ /* POPUP */
923
+ ]: "popup",
924
+ [
925
+ 17
926
+ /* FILEATTACHMENT */
927
+ ]: "fileattachment",
928
+ [
929
+ 18
930
+ /* SOUND */
931
+ ]: "sound",
932
+ [
933
+ 19
934
+ /* MOVIE */
935
+ ]: "movie",
936
+ [
937
+ 20
938
+ /* WIDGET */
939
+ ]: "widget",
940
+ [
941
+ 21
942
+ /* SCREEN */
943
+ ]: "screen",
944
+ [
945
+ 22
946
+ /* PRINTERMARK */
947
+ ]: "printermark",
948
+ [
949
+ 23
950
+ /* TRAPNET */
951
+ ]: "trapnet",
952
+ [
953
+ 24
954
+ /* WATERMARK */
955
+ ]: "watermark",
956
+ [
957
+ 25
958
+ /* THREED */
959
+ ]: "threed",
960
+ [
961
+ 26
962
+ /* RICHMEDIA */
963
+ ]: "richmedia",
964
+ [
965
+ 27
966
+ /* XFAWIDGET */
967
+ ]: "xfawidget",
968
+ [
969
+ 28
970
+ /* REDACT */
971
+ ]: "redact"
821
972
  };
822
973
  var PdfAnnotationObjectStatus = /* @__PURE__ */ ((PdfAnnotationObjectStatus2) => {
823
974
  PdfAnnotationObjectStatus2[PdfAnnotationObjectStatus2["Created"] = 0] = "Created";
@@ -913,18 +1064,45 @@ var PdfPageObjectType = /* @__PURE__ */ ((PdfPageObjectType2) => {
913
1064
  PdfPageObjectType2[PdfPageObjectType2["FORM"] = 5] = "FORM";
914
1065
  return PdfPageObjectType2;
915
1066
  })(PdfPageObjectType || {});
916
- var PdfAnnotationFlagName = Object.freeze({
917
- [1 /* INVISIBLE */]: "invisible",
918
- [2 /* HIDDEN */]: "hidden",
919
- [4 /* PRINT */]: "print",
920
- [8 /* NO_ZOOM */]: "noZoom",
921
- [16 /* NO_ROTATE */]: "noRotate",
922
- [32 /* NO_VIEW */]: "noView",
923
- [64 /* READ_ONLY */]: "readOnly",
924
- [128 /* LOCKED */]: "locked",
925
- [256 /* TOGGLE_NOVIEW */]: "toggleNoView"
1067
+ const PdfAnnotationFlagName = Object.freeze({
1068
+ [
1069
+ 1
1070
+ /* INVISIBLE */
1071
+ ]: "invisible",
1072
+ [
1073
+ 2
1074
+ /* HIDDEN */
1075
+ ]: "hidden",
1076
+ [
1077
+ 4
1078
+ /* PRINT */
1079
+ ]: "print",
1080
+ [
1081
+ 8
1082
+ /* NO_ZOOM */
1083
+ ]: "noZoom",
1084
+ [
1085
+ 16
1086
+ /* NO_ROTATE */
1087
+ ]: "noRotate",
1088
+ [
1089
+ 32
1090
+ /* NO_VIEW */
1091
+ ]: "noView",
1092
+ [
1093
+ 64
1094
+ /* READ_ONLY */
1095
+ ]: "readOnly",
1096
+ [
1097
+ 128
1098
+ /* LOCKED */
1099
+ ]: "locked",
1100
+ [
1101
+ 256
1102
+ /* TOGGLE_NOVIEW */
1103
+ ]: "toggleNoView"
926
1104
  });
927
- var PdfAnnotationFlagValue = Object.entries(
1105
+ const PdfAnnotationFlagValue = Object.entries(
928
1106
  PdfAnnotationFlagName
929
1107
  ).reduce(
930
1108
  (acc, [bit, name]) => {
@@ -939,7 +1117,8 @@ function flagsToNames(raw) {
939
1117
  function namesToFlags(names) {
940
1118
  return names.reduce(
941
1119
  (mask, name) => mask | PdfAnnotationFlagValue[name],
942
- 0 /* NONE */
1120
+ 0
1121
+ /* NONE */
943
1122
  );
944
1123
  }
945
1124
  var PdfSegmentObjectType = /* @__PURE__ */ ((PdfSegmentObjectType2) => {
@@ -972,9 +1151,13 @@ var MatchFlag = /* @__PURE__ */ ((MatchFlag2) => {
972
1151
  return MatchFlag2;
973
1152
  })(MatchFlag || {});
974
1153
  function unionFlags(flags) {
975
- return flags.reduce((flag, currFlag) => {
976
- return flag | currFlag;
977
- }, 0 /* None */);
1154
+ return flags.reduce(
1155
+ (flag, currFlag) => {
1156
+ return flag | currFlag;
1157
+ },
1158
+ 0
1159
+ /* None */
1160
+ );
978
1161
  }
979
1162
  function compareSearchTarget(targetA, targetB) {
980
1163
  const flagA = unionFlags(targetA.flags);
@@ -1035,7 +1218,7 @@ var PdfErrorCode = /* @__PURE__ */ ((PdfErrorCode2) => {
1035
1218
  PdfErrorCode2[PdfErrorCode2["CantCheckField"] = 28] = "CantCheckField";
1036
1219
  return PdfErrorCode2;
1037
1220
  })(PdfErrorCode || {});
1038
- var PdfTaskHelper = class {
1221
+ class PdfTaskHelper {
1039
1222
  /**
1040
1223
  * Create a task
1041
1224
  * @returns new task
@@ -1073,9 +1256,7 @@ var PdfTaskHelper = class {
1073
1256
  task.reject(reason);
1074
1257
  return task;
1075
1258
  }
1076
- };
1077
-
1078
- // src/color.ts
1259
+ }
1079
1260
  function pdfAlphaColorToWebAlphaColor(c) {
1080
1261
  const clamp = (n) => Math.max(0, Math.min(255, n));
1081
1262
  const toHex = (n) => clamp(n).toString(16).padStart(2, "0");
@@ -1088,7 +1269,7 @@ function webAlphaColorToPdfAlphaColor({ color, opacity }) {
1088
1269
  color = color.replace(/^#?([0-9a-f])([0-9a-f])([0-9a-f])$/i, "#$1$1$2$2$3$3").toLowerCase();
1089
1270
  }
1090
1271
  const [, r, g, b] = /^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(color) ?? (() => {
1091
- throw new Error(`Invalid hex colour: \u201C${color}\u201D`);
1272
+ throw new Error(`Invalid hex colour: “${color}”`);
1092
1273
  })();
1093
1274
  const clamp = (n, hi = 255) => Math.max(0, Math.min(hi, n));
1094
1275
  return {
@@ -1098,10 +1279,8 @@ function webAlphaColorToPdfAlphaColor({ color, opacity }) {
1098
1279
  alpha: clamp(Math.round(opacity * 255))
1099
1280
  };
1100
1281
  }
1101
-
1102
- // src/date.ts
1103
1282
  function pdfDateToDate(pdf) {
1104
- if (!pdf?.startsWith("D:") || pdf.length < 16) return;
1283
+ if (!(pdf == null ? void 0 : pdf.startsWith("D:")) || pdf.length < 16) return;
1105
1284
  const y = +pdf.slice(2, 6);
1106
1285
  const mo = +pdf.slice(6, 8) - 1;
1107
1286
  const d = +pdf.slice(8, 10);
@@ -1120,8 +1299,6 @@ function dateToPdfDate(date = /* @__PURE__ */ new Date()) {
1120
1299
  const SS = z(date.getUTCSeconds());
1121
1300
  return `D:${YYYY}${MM}${DD}${HH}${mm}${SS}`;
1122
1301
  }
1123
-
1124
- // src/index.ts
1125
1302
  function ignore() {
1126
1303
  }
1127
1304
  export {
@@ -1131,6 +1308,7 @@ export {
1131
1308
  LevelLogger,
1132
1309
  LogLevel,
1133
1310
  MatchFlag,
1311
+ MixedBlendMode,
1134
1312
  NoopLogger,
1135
1313
  PDF_FORM_FIELD_FLAG,
1136
1314
  PDF_FORM_FIELD_TYPE,
@@ -1144,6 +1322,7 @@ export {
1144
1322
  PdfAnnotationStateModel,
1145
1323
  PdfAnnotationSubtype,
1146
1324
  PdfAnnotationSubtypeName,
1325
+ PdfBlendMode,
1147
1326
  PdfBomOrZwnbsp,
1148
1327
  PdfEngineFeature,
1149
1328
  PdfEngineOperation,
@@ -1168,12 +1347,17 @@ export {
1168
1347
  TaskAbortedError,
1169
1348
  TaskRejectedError,
1170
1349
  TaskStage,
1350
+ blendModeLabel,
1351
+ blendModeSelectOptions,
1352
+ blendModeToCss,
1171
1353
  boundingRect,
1172
1354
  calculateAngle,
1173
1355
  calculateDegree,
1174
1356
  compareSearchTarget,
1357
+ cssToBlendMode,
1175
1358
  dateToPdfDate,
1176
1359
  flagsToNames,
1360
+ getBlendModeInfo,
1177
1361
  ignore,
1178
1362
  makeMatrix,
1179
1363
  namesToFlags,
@@ -1181,6 +1365,7 @@ export {
1181
1365
  pdfDateToDate,
1182
1366
  quadToRect,
1183
1367
  rectToQuad,
1368
+ reduceBlendModes,
1184
1369
  restoreOffset,
1185
1370
  restorePosition,
1186
1371
  restoreRect,
@@ -1196,7 +1381,8 @@ export {
1196
1381
  transformPosition,
1197
1382
  transformRect,
1198
1383
  transformSize,
1384
+ uiBlendModeDisplay,
1199
1385
  unionFlags,
1200
1386
  webAlphaColorToPdfAlphaColor
1201
1387
  };
1202
- //# sourceMappingURL=index.js.map
1388
+ //# sourceMappingURL=index.js.map