@shznet/pdf-sign-react 1.0.0 → 1.0.1

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
@@ -2,7 +2,7 @@ import { jsx as an } from "react/jsx-runtime";
2
2
  import { forwardRef as on, useRef as rs, useImperativeHandle as hn, useEffect as Vt } from "react";
3
3
  var vi = (c) => {
4
4
  throw TypeError(c);
5
- }, Ds = (c, t, e) => t.has(c) || vi("Cannot " + e), Y = (c, t, e) => (Ds(c, t, "read from private field"), e ? e.call(c) : t.get(c)), Ft = (c, t, e) => t.has(c) ? vi("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(c) : t.set(c, e), mt = (c, t, e, s) => (Ds(c, t, "write to private field"), t.set(c, e), e), It = (c, t, e) => (Ds(c, t, "access private method"), e), ln = (c, t, e, s) => ({
5
+ }, Ds = (c, t, e) => t.has(c) || vi("Cannot " + e), Y = (c, t, e) => (Ds(c, t, "read from private field"), e ? e.call(c) : t.get(c)), Ft = (c, t, e) => t.has(c) ? vi("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(c) : t.set(c, e), mt = (c, t, e, s) => (Ds(c, t, "write to private field"), t.set(c, e), e), Rt = (c, t, e) => (Ds(c, t, "access private method"), e), ln = (c, t, e, s) => ({
6
6
  set _(i) {
7
7
  mt(c, t, i);
8
8
  },
@@ -116,7 +116,7 @@ const dt = typeof process == "object" && process + "" == "[object process]" && !
116
116
  ANNOTATIONS_DISABLE: 64,
117
117
  IS_EDITING: 128,
118
118
  OPLIST: 256
119
- }, Bt = {
119
+ }, Ot = {
120
120
  DISABLE: 0,
121
121
  ENABLE: 1,
122
122
  ENABLE_FORMS: 2,
@@ -131,7 +131,7 @@ const dt = typeof process == "object" && process + "" == "[object process]" && !
131
131
  POPUP: 16,
132
132
  SIGNATURE: 101,
133
133
  COMMENT: 102
134
- }, O = {
134
+ }, B = {
135
135
  RESIZE: 1,
136
136
  CREATE: 2,
137
137
  FREETEXT_SIZE: 11,
@@ -317,13 +317,13 @@ function fn() {
317
317
  function Je(c) {
318
318
  Qe >= Ke.INFOS && console.info(`Info: ${c}`);
319
319
  }
320
- function I(c) {
320
+ function R(c) {
321
321
  Qe >= Ke.WARNINGS && console.warn(`Warning: ${c}`);
322
322
  }
323
323
  function j(c) {
324
324
  throw new Error(c);
325
325
  }
326
- function B(c, t) {
326
+ function O(c, t) {
327
327
  c || j(t);
328
328
  }
329
329
  function mn(c) {
@@ -798,7 +798,7 @@ class Ci {
798
798
  t.div.style.transform = e, t.div.hidden = !1;
799
799
  }
800
800
  }
801
- const Rt = "http://www.w3.org/2000/svg";
801
+ const It = "http://www.w3.org/2000/svg";
802
802
  class ce {
803
803
  static CSS = 96;
804
804
  static PDF = 72;
@@ -913,7 +913,7 @@ class ke {
913
913
  return T.applyInverseTransform(s, this.transform), s;
914
914
  }
915
915
  }
916
- class Rs extends Yt {
916
+ class Is extends Yt {
917
917
  constructor(t, e = 0) {
918
918
  super(t, "RenderingCancelledException"), this.extraDelay = e;
919
919
  }
@@ -925,7 +925,7 @@ function Ze(c) {
925
925
  e++;
926
926
  return c.substring(e, e + 5).toLowerCase() === "data:";
927
927
  }
928
- function Is(c) {
928
+ function Rs(c) {
929
929
  return typeof c == "string" && /\.pdf$/i.test(c);
930
930
  }
931
931
  function Sn(c) {
@@ -935,7 +935,7 @@ function Cn(c, t = "document.pdf") {
935
935
  if (typeof c != "string")
936
936
  return t;
937
937
  if (Ze(c))
938
- return I('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'), t;
938
+ return R('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'), t;
939
939
  const e = ((r) => {
940
940
  try {
941
941
  return new URL(r);
@@ -988,10 +988,10 @@ class Ks {
988
988
  started = /* @__PURE__ */ Object.create(null);
989
989
  times = [];
990
990
  time(t) {
991
- t in this.started && I(`Timer is already running for ${t}`), this.started[t] = Date.now();
991
+ t in this.started && R(`Timer is already running for ${t}`), this.started[t] = Date.now();
992
992
  }
993
993
  timeEnd(t) {
994
- t in this.started || I(`Timer has not been started for ${t}`), this.times.push({
994
+ t in this.started || R(`Timer has not been started for ${t}`), this.times.push({
995
995
  name: t,
996
996
  start: this.started[t],
997
997
  end: Date.now()
@@ -1076,7 +1076,7 @@ function De(c) {
1076
1076
  const t = parseInt(c.slice(1), 16);
1077
1077
  return [(t & 16711680) >> 16, (t & 65280) >> 8, t & 255];
1078
1078
  }
1079
- return c.startsWith("rgb(") ? c.slice(4, -1).split(",").map((t) => parseInt(t)) : c.startsWith("rgba(") ? c.slice(5, -1).split(",").map((t) => parseInt(t)).slice(0, 3) : (I(`Not a valid color format: "${c}"`), [0, 0, 0]);
1079
+ return c.startsWith("rgb(") ? c.slice(4, -1).split(",").map((t) => parseInt(t)) : c.startsWith("rgba(") ? c.slice(5, -1).split(",").map((t) => parseInt(t)).slice(0, 3) : (R(`Not a valid color format: "${c}"`), [0, 0, 0]);
1080
1080
  }
1081
1081
  function Mn(c) {
1082
1082
  const t = document.createElement("span");
@@ -1172,7 +1172,7 @@ class Dn {
1172
1172
  return t.remove(), L(this, "commentForegroundColor", De(s));
1173
1173
  }
1174
1174
  }
1175
- function Rn(c, t, e, s) {
1175
+ function In(c, t, e, s) {
1176
1176
  s = Math.min(Math.max(s ?? 1, 0), 1);
1177
1177
  const i = 255 * (1 - s);
1178
1178
  return c = Math.round(c * s + i), t = Math.round(t * s + i), e = Math.round(e * s + i), [c, t, e];
@@ -1232,7 +1232,7 @@ function Zs(c, t, e) {
1232
1232
  return s > i ? (s + 0.05) / (i + 0.05) : (i + 0.05) / (s + 0.05);
1233
1233
  }
1234
1234
  const ti = /* @__PURE__ */ new Map();
1235
- function In(c, t) {
1235
+ function Rn(c, t) {
1236
1236
  const e = c[0] + c[1] * 256 + c[2] * 65536 + t[0] * 16777216 + t[1] * 4294967296 + t[2] * 1099511627776;
1237
1237
  let s = ti.get(e);
1238
1238
  if (s)
@@ -1299,7 +1299,7 @@ function Pi(c) {
1299
1299
  t.closePath();
1300
1300
  break;
1301
1301
  default:
1302
- I(`Unrecognized drawing path operator: ${c[e - 1]}`);
1302
+ R(`Unrecognized drawing path operator: ${c[e - 1]}`);
1303
1303
  break;
1304
1304
  }
1305
1305
  return t;
@@ -1599,7 +1599,7 @@ class Ls {
1599
1599
  s.bitmap = await createImageBitmap(i);
1600
1600
  s.refCounter = 1;
1601
1601
  } catch (i) {
1602
- I(i), s = null;
1602
+ R(i), s = null;
1603
1603
  }
1604
1604
  return this.#i.set(t, s), s && this.#i.set(s.id, s), s;
1605
1605
  }
@@ -1747,7 +1747,7 @@ class Nn {
1747
1747
  this.#t = null;
1748
1748
  }
1749
1749
  }
1750
- class Re {
1750
+ class Ie {
1751
1751
  constructor(t) {
1752
1752
  this.buffer = [], this.callbacks = /* @__PURE__ */ new Map(), this.allKeys = /* @__PURE__ */ new Set();
1753
1753
  const {
@@ -1838,15 +1838,15 @@ class zt {
1838
1838
  #k = new Fn();
1839
1839
  #P = !1;
1840
1840
  #M = !1;
1841
- #O = !1;
1842
- #R = null;
1841
+ #B = !1;
1842
+ #I = null;
1843
1843
  #L = null;
1844
- #B = null;
1844
+ #O = null;
1845
1845
  #F = null;
1846
1846
  #G = null;
1847
1847
  #C = F.NONE;
1848
1848
  #x = /* @__PURE__ */ new Set();
1849
- #I = null;
1849
+ #R = null;
1850
1850
  #H = null;
1851
1851
  #z = null;
1852
1852
  #q = null;
@@ -1879,7 +1879,7 @@ class zt {
1879
1879
  }
1880
1880
  return !0;
1881
1881
  }, i = this.TRANSLATE_SMALL, n = this.TRANSLATE_BIG;
1882
- return L(this, "_keyboardManager", new Re([[["ctrl+a", "mac+meta+a"], t.selectAll, {
1882
+ return L(this, "_keyboardManager", new Ie([[["ctrl+a", "mac+meta+a"], t.selectAll, {
1883
1883
  checker: s
1884
1884
  }], [["ctrl+z", "mac+meta+z"], t.undo, {
1885
1885
  checker: s
@@ -1954,7 +1954,7 @@ class zt {
1954
1954
  this.#$?.resolve(), this.#$ = null, this.#t?.abort(), this.#t = null, this._signal = null;
1955
1955
  for (const t of this.#a.values())
1956
1956
  t.destroy();
1957
- this.#a.clear(), this.#s.clear(), this.#g.clear(), this.#F?.clear(), this.#e = null, this.#x.clear(), this.#l.destroy(), this.#r?.destroy(), this.#h?.destroy(), this.#H?.destroy(), this.#E?.hide(), this.#E = null, this.#B?.destroy(), this.#B = null, this.#i = null, this.#_ && (clearTimeout(this.#_), this.#_ = null), this.#N && (clearTimeout(this.#N), this.#N = null), this._editorUndoBar?.destroy(), this.#W = null;
1957
+ this.#a.clear(), this.#s.clear(), this.#g.clear(), this.#F?.clear(), this.#e = null, this.#x.clear(), this.#l.destroy(), this.#r?.destroy(), this.#h?.destroy(), this.#H?.destroy(), this.#E?.hide(), this.#E = null, this.#O?.destroy(), this.#O = null, this.#i = null, this.#_ && (clearTimeout(this.#_), this.#_ = null), this.#N && (clearTimeout(this.#N), this.#N = null), this._editorUndoBar?.destroy(), this.#W = null;
1958
1958
  }
1959
1959
  combinedSignal(t) {
1960
1960
  return AbortSignal.any([this._signal, t.signal]);
@@ -2010,7 +2010,7 @@ class zt {
2010
2010
  t ? (this.unselectAll(), this.disableUserSelect(!0)) : this.disableUserSelect(!1), this.#d = t;
2011
2011
  }
2012
2012
  setMainHighlightColorPicker(t) {
2013
- this.#B = t;
2013
+ this.#O = t;
2014
2014
  }
2015
2015
  editAltText(t, e = !1) {
2016
2016
  this.#r?.editAltText(this, t, e);
@@ -2203,7 +2203,7 @@ class zt {
2203
2203
  #rt() {
2204
2204
  const t = document.getSelection();
2205
2205
  if (!t || t.isCollapsed) {
2206
- this.#I && (this.#E?.hide(), this.#I = null, this.#D({
2206
+ this.#R && (this.#E?.hide(), this.#R = null, this.#D({
2207
2207
  hasSelectedText: !1
2208
2208
  }));
2209
2209
  return;
@@ -2211,16 +2211,16 @@ class zt {
2211
2211
  const {
2212
2212
  anchorNode: e
2213
2213
  } = t;
2214
- if (e === this.#I)
2214
+ if (e === this.#R)
2215
2215
  return;
2216
2216
  const s = this.#Q(t).closest(".textLayer");
2217
2217
  if (!s) {
2218
- this.#I && (this.#E?.hide(), this.#I = null, this.#D({
2218
+ this.#R && (this.#E?.hide(), this.#R = null, this.#D({
2219
2219
  hasSelectedText: !1
2220
2220
  }));
2221
2221
  return;
2222
2222
  }
2223
- if (this.#E?.hide(), this.#I = e, this.#D({
2223
+ if (this.#E?.hide(), this.#R = e, this.#D({
2224
2224
  hasSelectedText: !0
2225
2225
  }), !(this.#C !== F.HIGHLIGHT && this.#C !== F.NONE) && (this.#C === F.HIGHLIGHT && this.showAllEditors("highlight", !0, !0), this.#v = this.isShiftKeyDown, !this.isShiftKeyDown)) {
2226
2226
  const i = this.#C === F.HIGHLIGHT ? this.#tt(s) : null;
@@ -2283,10 +2283,10 @@ class zt {
2283
2283
  }), e.focus();
2284
2284
  }
2285
2285
  #et() {
2286
- if (this.#R)
2286
+ if (this.#I)
2287
2287
  return;
2288
- this.#R = new AbortController();
2289
- const t = this.combinedSignal(this.#R);
2288
+ this.#I = new AbortController();
2289
+ const t = this.combinedSignal(this.#I);
2290
2290
  window.addEventListener("keydown", this.keydown.bind(this), {
2291
2291
  signal: t
2292
2292
  }), window.addEventListener("keyup", this.keyup.bind(this), {
@@ -2294,7 +2294,7 @@ class zt {
2294
2294
  });
2295
2295
  }
2296
2296
  #lt() {
2297
- this.#R?.abort(), this.#R = null;
2297
+ this.#I?.abort(), this.#I = null;
2298
2298
  }
2299
2299
  #ct() {
2300
2300
  if (this.#u)
@@ -2374,7 +2374,7 @@ class zt {
2374
2374
  try {
2375
2375
  s = JSON.parse(s);
2376
2376
  } catch (n) {
2377
- I(`paste: "${n.message}".`);
2377
+ R(`paste: "${n.message}".`);
2378
2378
  return;
2379
2379
  }
2380
2380
  if (!Array.isArray(s))
@@ -2403,7 +2403,7 @@ class zt {
2403
2403
  mustExec: !0
2404
2404
  });
2405
2405
  } catch (n) {
2406
- I(`paste: "${n.message}".`);
2406
+ R(`paste: "${n.message}".`);
2407
2407
  }
2408
2408
  }
2409
2409
  keydown(t) {
@@ -2434,7 +2434,7 @@ class zt {
2434
2434
  Object.entries(t).some(([e, s]) => this.#X[e] !== s) && (this._eventBus.dispatch("annotationeditorstateschanged", {
2435
2435
  source: this,
2436
2436
  details: Object.assign(this.#X, t)
2437
- }), this.#C === F.HIGHLIGHT && t.hasSelectedEditor === !1 && this.#V([[O.HIGHLIGHT_FREE, !0]]));
2437
+ }), this.#C === F.HIGHLIGHT && t.hasSelectedEditor === !1 && this.#V([[B.HIGHLIGHT_FREE, !0]]));
2438
2438
  }
2439
2439
  #V(t) {
2440
2440
  this._eventBus.dispatch("annotationeditorparamschanged", {
@@ -2534,10 +2534,10 @@ class zt {
2534
2534
  updateParams(t, e) {
2535
2535
  if (this.#c) {
2536
2536
  switch (t) {
2537
- case O.CREATE:
2537
+ case B.CREATE:
2538
2538
  this.currentLayer.addNewEditor(e);
2539
2539
  return;
2540
- case O.HIGHLIGHT_SHOW_ALL:
2540
+ case B.HIGHLIGHT_SHOW_ALL:
2541
2541
  this._eventBus.dispatch("reporttelemetry", {
2542
2542
  source: this,
2543
2543
  details: {
@@ -2561,11 +2561,11 @@ class zt {
2561
2561
  showAllEditors(t, e, s = !1) {
2562
2562
  for (const i of this.#s.values())
2563
2563
  i.editorType === t && i.show(e);
2564
- (this.#q?.get(O.HIGHLIGHT_SHOW_ALL) ?? !0) !== e && this.#V([[O.HIGHLIGHT_SHOW_ALL, e]]);
2564
+ (this.#q?.get(B.HIGHLIGHT_SHOW_ALL) ?? !0) !== e && this.#V([[B.HIGHLIGHT_SHOW_ALL, e]]);
2565
2565
  }
2566
2566
  enableWaiting(t = !1) {
2567
- if (this.#O !== t) {
2568
- this.#O = t;
2567
+ if (this.#B !== t) {
2568
+ this.#B = t;
2569
2569
  for (const e of this.#a.values())
2570
2570
  t ? e.disableClick() : e.enableClick(), e.div.classList.toggle("waiting", t);
2571
2571
  }
@@ -3453,7 +3453,7 @@ class D {
3453
3453
  static _telemetryTimeout = 1e3;
3454
3454
  static get _resizerKeyboardManager() {
3455
3455
  const t = D.prototype._resizeWithKeyboard, e = zt.TRANSLATE_SMALL, s = zt.TRANSLATE_BIG;
3456
- return L(this, "_resizerKeyboardManager", new Re([[["ArrowLeft", "mac+ArrowLeft"], t, {
3456
+ return L(this, "_resizerKeyboardManager", new Ie([[["ArrowLeft", "mac+ArrowLeft"], t, {
3457
3457
  args: [-e, 0]
3458
3458
  }], [["ctrl+ArrowLeft", "mac+shift+ArrowLeft"], t, {
3459
3459
  args: [-s, 0]
@@ -3499,7 +3499,7 @@ class D {
3499
3499
  return L(this, "_defaultLineColor", this._colorManager.getHexCode("CanvasText"));
3500
3500
  }
3501
3501
  static deleteAnnotationElement(t) {
3502
- const e = new On({
3502
+ const e = new Bn({
3503
3503
  id: t.parent.getNextId(),
3504
3504
  parent: t.parent,
3505
3505
  uiManager: t._uiManager
@@ -3763,14 +3763,14 @@ class D {
3763
3763
  getInitialTranslation() {
3764
3764
  return [0, 0];
3765
3765
  }
3766
- #O() {
3766
+ #B() {
3767
3767
  if (this.#l)
3768
3768
  return;
3769
3769
  this.#l = document.createElement("div"), this.#l.classList.add("resizers");
3770
3770
  const t = this._willKeepAspectRatio ? ["topLeft", "topRight", "bottomRight", "bottomLeft"] : ["topLeft", "topMiddle", "topRight", "middleRight", "bottomRight", "bottomMiddle", "bottomLeft", "middleLeft"], e = this._uiManager._signal;
3771
3771
  for (const s of t) {
3772
3772
  const i = document.createElement("div");
3773
- this.#l.append(i), i.classList.add("resizer", s), i.setAttribute("data-resizer-name", s), i.addEventListener("pointerdown", this.#R.bind(this, s), {
3773
+ this.#l.append(i), i.classList.add("resizer", s), i.setAttribute("data-resizer-name", s), i.addEventListener("pointerdown", this.#I.bind(this, s), {
3774
3774
  signal: e
3775
3775
  }), i.addEventListener("contextmenu", _t, {
3776
3776
  signal: e
@@ -3778,7 +3778,7 @@ class D {
3778
3778
  }
3779
3779
  this.div.prepend(this.#l);
3780
3780
  }
3781
- #R(t, e) {
3781
+ #I(t, e) {
3782
3782
  e.preventDefault();
3783
3783
  const {
3784
3784
  isMac: s
@@ -3807,7 +3807,7 @@ class D {
3807
3807
  const a = this.parent.div.style.cursor, o = this.div.style.cursor;
3808
3808
  this.div.style.cursor = this.parent.div.style.cursor = window.getComputedStyle(e.target).cursor;
3809
3809
  const h = () => {
3810
- n.abort(), this.parent.togglePointerEvents(!0), this.#i?.toggle(!0), this._isDraggable = i, this.parent.div.style.cursor = a, this.div.style.cursor = o, this.#B();
3810
+ n.abort(), this.parent.togglePointerEvents(!0), this.#i?.toggle(!0), this._isDraggable = i, this.parent.div.style.cursor = a, this.div.style.cursor = o, this.#O();
3811
3811
  };
3812
3812
  window.addEventListener("pointerup", h, {
3813
3813
  signal: r
@@ -3820,7 +3820,7 @@ class D {
3820
3820
  }
3821
3821
  _onResized() {
3822
3822
  }
3823
- #B() {
3823
+ #O() {
3824
3824
  if (!this.#u)
3825
3825
  return;
3826
3826
  const {
@@ -3841,32 +3841,32 @@ class D {
3841
3841
  return Math.round(t * 1e4) / 1e4;
3842
3842
  }
3843
3843
  #F(t, e) {
3844
- const [s, i] = this.parentDimensions, n = this.x, r = this.y, a = this.width, o = this.height, h = D.MIN_SIZE / s, l = D.MIN_SIZE / i, d = this.#M(this.rotation), u = (k, R) => [d[0] * k + d[2] * R, d[1] * k + d[3] * R], p = this.#M(360 - this.rotation), f = (k, R) => [p[0] * k + p[2] * R, p[1] * k + p[3] * R];
3844
+ const [s, i] = this.parentDimensions, n = this.x, r = this.y, a = this.width, o = this.height, h = D.MIN_SIZE / s, l = D.MIN_SIZE / i, d = this.#M(this.rotation), u = (k, I) => [d[0] * k + d[2] * I, d[1] * k + d[3] * I], p = this.#M(360 - this.rotation), f = (k, I) => [p[0] * k + p[2] * I, p[1] * k + p[3] * I];
3845
3845
  let g, b, m = !1, w = !1;
3846
3846
  switch (t) {
3847
3847
  case "topLeft":
3848
- m = !0, g = (k, R) => [0, 0], b = (k, R) => [k, R];
3848
+ m = !0, g = (k, I) => [0, 0], b = (k, I) => [k, I];
3849
3849
  break;
3850
3850
  case "topMiddle":
3851
- g = (k, R) => [k / 2, 0], b = (k, R) => [k / 2, R];
3851
+ g = (k, I) => [k / 2, 0], b = (k, I) => [k / 2, I];
3852
3852
  break;
3853
3853
  case "topRight":
3854
- m = !0, g = (k, R) => [k, 0], b = (k, R) => [0, R];
3854
+ m = !0, g = (k, I) => [k, 0], b = (k, I) => [0, I];
3855
3855
  break;
3856
3856
  case "middleRight":
3857
- w = !0, g = (k, R) => [k, R / 2], b = (k, R) => [0, R / 2];
3857
+ w = !0, g = (k, I) => [k, I / 2], b = (k, I) => [0, I / 2];
3858
3858
  break;
3859
3859
  case "bottomRight":
3860
- m = !0, g = (k, R) => [k, R], b = (k, R) => [0, 0];
3860
+ m = !0, g = (k, I) => [k, I], b = (k, I) => [0, 0];
3861
3861
  break;
3862
3862
  case "bottomMiddle":
3863
- g = (k, R) => [k / 2, R], b = (k, R) => [k / 2, 0];
3863
+ g = (k, I) => [k / 2, I], b = (k, I) => [k / 2, 0];
3864
3864
  break;
3865
3865
  case "bottomLeft":
3866
- m = !0, g = (k, R) => [0, R], b = (k, R) => [k, 0];
3866
+ m = !0, g = (k, I) => [0, I], b = (k, I) => [k, 0];
3867
3867
  break;
3868
3868
  case "middleLeft":
3869
- w = !0, g = (k, R) => [0, R / 2], b = (k, R) => [k, R / 2];
3869
+ w = !0, g = (k, I) => [0, I / 2], b = (k, I) => [k, I / 2];
3870
3870
  break;
3871
3871
  }
3872
3872
  const y = g(a, o), v = b(a, o);
@@ -3881,9 +3881,9 @@ class D {
3881
3881
  else {
3882
3882
  const {
3883
3883
  screenX: k,
3884
- screenY: R
3884
+ screenY: I
3885
3885
  } = e, [U, ft] = this.#h;
3886
- [M, C] = this.screenToPageTranslation(k - U, R - ft), this.#h[0] = k, this.#h[1] = R;
3886
+ [M, C] = this.screenToPageTranslation(k - U, I - ft), this.#h[0] = k, this.#h[1] = I;
3887
3887
  }
3888
3888
  if ([M, C] = f(M / s, C / i), m) {
3889
3889
  const k = Math.hypot(a, o);
@@ -4082,7 +4082,7 @@ class D {
4082
4082
  this.x = w - v[0], this.y = y - v[1], this.width = g, this.height = b, this.setDims(), this.fixAndSetPosition(), this._onResizing();
4083
4083
  }
4084
4084
  #x() {
4085
- this.#i?.toggle(!0), this.parent.togglePointerEvents(!0), this.#B();
4085
+ this.#i?.toggle(!0), this.parent.togglePointerEvents(!0), this.#O();
4086
4086
  }
4087
4087
  pointerdown(t) {
4088
4088
  const {
@@ -4096,9 +4096,9 @@ class D {
4096
4096
  this.#H(t);
4097
4097
  return;
4098
4098
  }
4099
- this.#I(t);
4099
+ this.#R(t);
4100
4100
  }
4101
- #I(t) {
4101
+ #R(t) {
4102
4102
  const {
4103
4103
  isMac: e
4104
4104
  } = at.platform;
@@ -4115,7 +4115,7 @@ class D {
4115
4115
  passive: !1,
4116
4116
  signal: n
4117
4117
  }, a = (h) => {
4118
- i.abort(), this.#n = null, this.#f = !1, this._uiManager.endDragSession() || this.#I(h), s && this._onStopDragging();
4118
+ i.abort(), this.#n = null, this.#f = !1, this._uiManager.endDragSession() || this.#R(h), s && this._onStopDragging();
4119
4119
  };
4120
4120
  e && (this.#S = t.clientX, this.#_ = t.clientY, this.#n = t.pointerId, this.#o = t.pointerType, window.addEventListener("pointermove", (h) => {
4121
4121
  s || (s = !0, this._uiManager.toggleComment(this, !0, !1), this._onStartDragging());
@@ -4323,7 +4323,7 @@ class D {
4323
4323
  return !1;
4324
4324
  }
4325
4325
  makeResizable() {
4326
- this.isResizable && (this.#O(), this.#l.classList.remove("hidden"));
4326
+ this.isResizable && (this.#B(), this.#l.classList.remove("hidden"));
4327
4327
  }
4328
4328
  get toolbarPosition() {
4329
4329
  return null;
@@ -4429,7 +4429,7 @@ class D {
4429
4429
  });
4430
4430
  }
4431
4431
  #N() {
4432
- this.#w = !1, this.#U(-1), this.#B();
4432
+ this.#w = !1, this.#U(-1), this.#O();
4433
4433
  }
4434
4434
  _stopResizingWithKeyboard() {
4435
4435
  this.#N(), this.div.focus();
@@ -4566,7 +4566,7 @@ class D {
4566
4566
  e?.nodeName === "DIV" && e.classList.contains("annotationContent") && e.remove();
4567
4567
  }
4568
4568
  }
4569
- class On extends D {
4569
+ class Bn extends D {
4570
4570
  constructor(t) {
4571
4571
  super(t), this.annotationElementId = t.annotationElementId, this.deleted = !0;
4572
4572
  }
@@ -4775,7 +4775,7 @@ class Di extends Ns {
4775
4775
  });
4776
4776
  }
4777
4777
  }
4778
- class Bn {
4778
+ class On {
4779
4779
  #t = /* @__PURE__ */ new Set();
4780
4780
  constructor({
4781
4781
  ownerDocument: t = globalThis.document,
@@ -4805,7 +4805,7 @@ class Bn {
4805
4805
  _inspectFont: s
4806
4806
  }) {
4807
4807
  if (!(!t || this.#t.has(t.loadedName))) {
4808
- if (B(!e, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
4808
+ if (O(!e, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
4809
4809
  const {
4810
4810
  loadedName: i,
4811
4811
  src: n,
@@ -4815,7 +4815,7 @@ class Bn {
4815
4815
  try {
4816
4816
  await a.load(), this.#t.add(i), s?.(t);
4817
4817
  } catch {
4818
- I(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`), this.removeNativeFontFace(a);
4818
+ R(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`), this.removeNativeFontFace(a);
4819
4819
  }
4820
4820
  return;
4821
4821
  }
@@ -4836,7 +4836,7 @@ class Bn {
4836
4836
  try {
4837
4837
  await s.loaded;
4838
4838
  } catch (i) {
4839
- throw I(`Failed to load font '${s.family}': '${i}'.`), t.disableFontFace = !0, i;
4839
+ throw R(`Failed to load font '${s.family}': '${i}'.`), t.disableFontFace = !0, i;
4840
4840
  }
4841
4841
  }
4842
4842
  return;
@@ -4860,7 +4860,7 @@ class Bn {
4860
4860
  }
4861
4861
  _queueLoadingCallback(t) {
4862
4862
  function e() {
4863
- for (B(!i.done, "completeRequest() cannot be called twice."), i.done = !0; s.length > 0 && s[0].done; ) {
4863
+ for (O(!i.done, "completeRequest() cannot be called twice."), i.done = !0; s.length > 0 && s[0].done; ) {
4864
4864
  const n = s.shift();
4865
4865
  setTimeout(n.callback, 0);
4866
4866
  }
@@ -4893,7 +4893,7 @@ class Bn {
4893
4893
  let h = 0;
4894
4894
  function l(y, v) {
4895
4895
  if (++h > 30) {
4896
- I("Load test font never loaded."), v();
4896
+ R("Load test font never loaded."), v();
4897
4897
  return;
4898
4898
  }
4899
4899
  if (o.font = "30px " + y, o.fillText(".", 0, 20), o.getImageData(0, 0, 1, 1).data[3] > 0) {
@@ -4963,7 +4963,7 @@ class Hn {
4963
4963
  try {
4964
4964
  i = t.get(s);
4965
4965
  } catch (r) {
4966
- I(`getPathGenerator - ignoring character: "${r}".`);
4966
+ R(`getPathGenerator - ignoring character: "${r}".`);
4967
4967
  }
4968
4968
  const n = Pi(i?.path);
4969
4969
  return this.fontExtraProperties || t.delete(s), this.compiledGlyphs[e] = n;
@@ -5065,13 +5065,13 @@ class ae {
5065
5065
  const l = s[h], d = l.length;
5066
5066
  a.setUint32(o, d), r.set(l, o + 4), o += 4 + d;
5067
5067
  }
5068
- return B(o === n.byteLength, "CssFontInfo.write: Buffer overflow"), n;
5068
+ return O(o === n.byteLength, "CssFontInfo.write: Buffer overflow"), n;
5069
5069
  }
5070
5070
  constructor(t) {
5071
5071
  this.#t = t, this.#e = new DataView(this.#t), this.#i = new TextDecoder();
5072
5072
  }
5073
5073
  #s(t) {
5074
- B(t < ae.strings.length, "Invalid string index");
5074
+ O(t < ae.strings.length, "Invalid string index");
5075
5075
  let e = 0;
5076
5076
  for (let i = 0; i < t; i++)
5077
5077
  e += this.#e.getUint32(e) + 4;
@@ -5110,7 +5110,7 @@ class oe {
5110
5110
  const p = s[u], f = p.length;
5111
5111
  i += 4 + f, l.setUint32(d, f), h.set(p, d + 4), d += 4 + f;
5112
5112
  }
5113
- return l.setUint32(d - i - 4, i), t.style && (l.setUint32(d, n.length), h.set(n, d + 4), d += 4 + n.length, l.setUint32(d, r.length), h.set(r, d + 4), d += 4 + r.length), B(d <= o.byteLength, "SubstitionInfo.write: Buffer overflow"), o.transferToFixedLength(d);
5113
+ return l.setUint32(d - i - 4, i), t.style && (l.setUint32(d, n.length), h.set(n, d + 4), d += 4 + n.length, l.setUint32(d, r.length), h.set(r, d + 4), d += 4 + r.length), O(d <= o.byteLength, "SubstitionInfo.write: Buffer overflow"), o.transferToFixedLength(d);
5114
5114
  }
5115
5115
  constructor(t) {
5116
5116
  this.#t = t, this.#e = new DataView(this.#t), this.#i = new TextDecoder();
@@ -5119,7 +5119,7 @@ class oe {
5119
5119
  return this.#e.getUint8(0) !== 0;
5120
5120
  }
5121
5121
  #s(t) {
5122
- B(t < oe.strings.length, "Invalid string index");
5122
+ O(t < oe.strings.length, "Invalid string index");
5123
5123
  let e = 5;
5124
5124
  for (let i = 0; i < t; i++)
5125
5125
  e += this.#e.getUint32(e) + 4;
@@ -5169,7 +5169,7 @@ class G {
5169
5169
  this.#r = t, this.#n = new TextDecoder(), this.#o = new DataView(this.#r), e && Object.assign(this, e);
5170
5170
  }
5171
5171
  #l(t) {
5172
- B(t < G.bools.length, "Invalid boolean index");
5172
+ O(t < G.bools.length, "Invalid boolean index");
5173
5173
  const e = Math.floor(t / 4), s = t * 2 % 8, i = this.#o.getUint8(e) >> s & 3;
5174
5174
  return i === 0 ? void 0 : i === 2;
5175
5175
  }
@@ -5204,7 +5204,7 @@ class G {
5204
5204
  return this.#l(9);
5205
5205
  }
5206
5206
  #h(t) {
5207
- return B(t < G.numbers.length, "Invalid number index"), this.#o.getFloat64(G.#t + t * 8);
5207
+ return O(t < G.numbers.length, "Invalid number index"), this.#o.getFloat64(G.#t + t * 8);
5208
5208
  }
5209
5209
  get ascent() {
5210
5210
  return this.#h(0);
@@ -5246,7 +5246,7 @@ class G {
5246
5246
  return e;
5247
5247
  }
5248
5248
  #u(t) {
5249
- B(t < G.strings.length, "Invalid string index");
5249
+ O(t < G.strings.length, "Invalid string index");
5250
5250
  let e = G.#a + 4;
5251
5251
  for (let n = 0; n < t; n++)
5252
5252
  e += this.#o.getUint32(e) + 4;
@@ -5323,28 +5323,28 @@ class G {
5323
5323
  const b = t[G.bools[g]];
5324
5324
  p |= (b === void 0 ? 0 : b ? 2 : 1) << f, f += 2, (f === 8 || g === u - 1) && (l.setUint8(d++, p), p = 0, f = 0);
5325
5325
  }
5326
- B(d === G.#t, "FontInfo.write: Boolean properties offset mismatch");
5326
+ O(d === G.#t, "FontInfo.write: Boolean properties offset mismatch");
5327
5327
  for (const g of G.numbers)
5328
5328
  l.setFloat64(d, t[g]), d += 8;
5329
- if (B(d === G.#e, "FontInfo.write: Number properties offset mismatch"), t.bbox) {
5329
+ if (O(d === G.#e, "FontInfo.write: Number properties offset mismatch"), t.bbox) {
5330
5330
  l.setUint8(d++, 4);
5331
5331
  for (const g of t.bbox)
5332
5332
  l.setInt16(d, g, !0), d += 2;
5333
5333
  } else
5334
5334
  l.setUint8(d++, 0), d += 8;
5335
- if (B(d === G.#i, "FontInfo.write: BBox properties offset mismatch"), t.fontMatrix) {
5335
+ if (O(d === G.#i, "FontInfo.write: BBox properties offset mismatch"), t.fontMatrix) {
5336
5336
  l.setUint8(d++, 6);
5337
5337
  for (const g of t.fontMatrix)
5338
5338
  l.setFloat64(d, g, !0), d += 8;
5339
5339
  } else
5340
5340
  l.setUint8(d++, 0), d += 48;
5341
- if (B(d === G.#s, "FontInfo.write: FontMatrix properties offset mismatch"), t.defaultVMetrics) {
5341
+ if (O(d === G.#s, "FontInfo.write: FontMatrix properties offset mismatch"), t.defaultVMetrics) {
5342
5342
  l.setUint8(d++, 1);
5343
5343
  for (const g of t.defaultVMetrics)
5344
5344
  l.setInt16(d, g, !0), d += 2;
5345
5345
  } else
5346
5346
  l.setUint8(d++, 0), d += 6;
5347
- B(d === G.#a, "FontInfo.write: DefaultVMetrics properties offset mismatch"), l.setUint32(G.#a, 0), d += 4;
5347
+ O(d === G.#a, "FontInfo.write: DefaultVMetrics properties offset mismatch"), l.setUint32(G.#a, 0), d += 4;
5348
5348
  for (const g of G.strings) {
5349
5349
  const b = n[g], m = b.length;
5350
5350
  l.setUint32(d, m), h.set(b, d + 4), d += 4 + m;
@@ -5353,15 +5353,15 @@ class G {
5353
5353
  l.setUint32(d, 0), d += 4;
5354
5354
  else {
5355
5355
  const g = e.byteLength;
5356
- l.setUint32(d, g), B(d + 4 + g <= o.byteLength, "FontInfo.write: Buffer overflow at systemFontInfo"), h.set(new Uint8Array(e), d + 4), d += 4 + g;
5356
+ l.setUint32(d, g), O(d + 4 + g <= o.byteLength, "FontInfo.write: Buffer overflow at systemFontInfo"), h.set(new Uint8Array(e), d + 4), d += 4 + g;
5357
5357
  }
5358
5358
  if (!s)
5359
5359
  l.setUint32(d, 0), d += 4;
5360
5360
  else {
5361
5361
  const g = s.byteLength;
5362
- l.setUint32(d, g), B(d + 4 + g <= o.byteLength, "FontInfo.write: Buffer overflow at cssFontInfo"), h.set(new Uint8Array(s), d + 4), d += 4 + g;
5362
+ l.setUint32(d, g), O(d + 4 + g <= o.byteLength, "FontInfo.write: Buffer overflow at cssFontInfo"), h.set(new Uint8Array(s), d + 4), d += 4 + g;
5363
5363
  }
5364
- return t.data === void 0 ? (l.setUint32(d, 0), d += 4) : (l.setUint32(d, t.data.length), h.set(t.data, d + 4), d += 4 + t.data.length), B(d <= o.byteLength, "FontInfo.write: Buffer overflow"), o.transferToFixedLength(d);
5364
+ return t.data === void 0 ? (l.setUint32(d, 0), d += 4) : (l.setUint32(d, t.data.length), h.set(t.data, d + 4), d += 4 + t.data.length), O(d <= o.byteLength, "FontInfo.write: Buffer overflow"), o.transferToFixedLength(d);
5365
5365
  }
5366
5366
  }
5367
5367
  class ot {
@@ -5534,7 +5534,7 @@ class jn {
5534
5534
  signal: n
5535
5535
  } = s;
5536
5536
  if (n.aborted) {
5537
- I("LoopbackPort - cannot use an `aborted` signal.");
5537
+ R("LoopbackPort - cannot use an `aborted` signal.");
5538
5538
  return;
5539
5539
  }
5540
5540
  const r = () => this.removeEventListener(t, e);
@@ -5551,7 +5551,7 @@ class jn {
5551
5551
  this.#t.clear();
5552
5552
  }
5553
5553
  }
5554
- const Oe = {
5554
+ const Be = {
5555
5555
  DATA: 1,
5556
5556
  ERROR: 2
5557
5557
  }, st = {
@@ -5603,9 +5603,9 @@ class ve {
5603
5603
  const s = t.callbackId, i = this.callbackCapabilities[s];
5604
5604
  if (!i)
5605
5605
  throw new Error(`Cannot resolve callback ${s}`);
5606
- if (delete this.callbackCapabilities[s], t.callback === Oe.DATA)
5606
+ if (delete this.callbackCapabilities[s], t.callback === Be.DATA)
5607
5607
  i.resolve(t.data);
5608
- else if (t.callback === Oe.ERROR)
5608
+ else if (t.callback === Be.ERROR)
5609
5609
  i.reject(pt(t.reason));
5610
5610
  else
5611
5611
  throw new Error("Unexpected callback case");
@@ -5620,7 +5620,7 @@ class ve {
5620
5620
  n.postMessage({
5621
5621
  sourceName: s,
5622
5622
  targetName: i,
5623
- callback: Oe.DATA,
5623
+ callback: Be.DATA,
5624
5624
  callbackId: t.callbackId,
5625
5625
  data: r
5626
5626
  });
@@ -5628,7 +5628,7 @@ class ve {
5628
5628
  n.postMessage({
5629
5629
  sourceName: s,
5630
5630
  targetName: i,
5631
- callback: Oe.ERROR,
5631
+ callback: Be.ERROR,
5632
5632
  callbackId: t.callbackId,
5633
5633
  reason: pt(r)
5634
5634
  });
@@ -5702,7 +5702,7 @@ class ve {
5702
5702
  }), l.promise;
5703
5703
  },
5704
5704
  cancel: (h) => {
5705
- B(h instanceof Error, "cancel must have a valid reason");
5705
+ O(h instanceof Error, "cancel must have a valid reason");
5706
5706
  const l = Promise.withResolvers();
5707
5707
  return this.streamControllers[n].cancelCall = l, this.streamControllers[n].isClosed = !0, o.postMessage({
5708
5708
  sourceName: r,
@@ -5737,7 +5737,7 @@ class ve {
5737
5737
  }), delete r.streamSinks[e]);
5738
5738
  },
5739
5739
  error(h) {
5740
- B(h instanceof Error, "error must have a valid reason"), !this.isCancelled && (this.isCancelled = !0, n.postMessage({
5740
+ O(h instanceof Error, "error must have a valid reason"), !this.isCancelled && (this.isCancelled = !0, n.postMessage({
5741
5741
  sourceName: s,
5742
5742
  targetName: i,
5743
5743
  stream: st.ERROR,
@@ -5809,17 +5809,17 @@ class ve {
5809
5809
  });
5810
5810
  break;
5811
5811
  case st.ENQUEUE:
5812
- if (B(r, "enqueue should have stream controller"), r.isClosed)
5812
+ if (O(r, "enqueue should have stream controller"), r.isClosed)
5813
5813
  break;
5814
5814
  r.controller.enqueue(t.chunk);
5815
5815
  break;
5816
5816
  case st.CLOSE:
5817
- if (B(r, "close should have stream controller"), r.isClosed)
5817
+ if (O(r, "close should have stream controller"), r.isClosed)
5818
5818
  break;
5819
5819
  r.isClosed = !0, r.controller.close(), this.#a(r, e);
5820
5820
  break;
5821
5821
  case st.ERROR:
5822
- B(r, "error should have stream controller"), r.controller.error(pt(t.reason)), this.#a(r, e);
5822
+ O(r, "error should have stream controller"), r.controller.error(pt(t.reason)), this.#a(r, e);
5823
5823
  break;
5824
5824
  case st.CANCEL_COMPLETE:
5825
5825
  t.success ? r.cancelCall.resolve() : r.cancelCall.reject(pt(t.reason)), this.#a(r, e);
@@ -5857,7 +5857,7 @@ class ve {
5857
5857
  this.#t?.abort(), this.#t = null;
5858
5858
  }
5859
5859
  }
5860
- class Ri {
5860
+ class Ii {
5861
5861
  #t = !1;
5862
5862
  constructor({
5863
5863
  enableHWA: t = !1
@@ -5891,7 +5891,7 @@ class Ri {
5891
5891
  j("Abstract method `_createCanvas` called.");
5892
5892
  }
5893
5893
  }
5894
- class Wn extends Ri {
5894
+ class Wn extends Ii {
5895
5895
  constructor({
5896
5896
  ownerDocument: t = globalThis.document,
5897
5897
  enableHWA: e = !1
@@ -5905,7 +5905,7 @@ class Wn extends Ri {
5905
5905
  return s.width = t, s.height = e, s;
5906
5906
  }
5907
5907
  }
5908
- class Ii {
5908
+ class Ri {
5909
5909
  constructor({
5910
5910
  baseUrl: t = null,
5911
5911
  isCompressed: e = !0
@@ -5931,7 +5931,7 @@ class Ii {
5931
5931
  j("Abstract method `_fetch` called.");
5932
5932
  }
5933
5933
  }
5934
- class ii extends Ii {
5934
+ class ii extends Ri {
5935
5935
  async _fetch(t) {
5936
5936
  const e = await Me(t, this.isCompressed ? "arraybuffer" : "text");
5937
5937
  return e instanceof ArrayBuffer ? new Uint8Array(e) : Pe(e);
@@ -5982,8 +5982,8 @@ class qn extends Li {
5982
5982
  style: e
5983
5983
  } = t;
5984
5984
  e.visibility = "hidden", e.contain = "strict", e.width = e.height = 0, e.position = "absolute", e.top = e.left = 0, e.zIndex = -1;
5985
- const s = this.#a.createElementNS(Rt, "svg");
5986
- s.setAttribute("width", 0), s.setAttribute("height", 0), this.#i = this.#a.createElementNS(Rt, "defs"), t.append(s), s.append(this.#i), this.#a.body.append(t);
5985
+ const s = this.#a.createElementNS(It, "svg");
5986
+ s.setAttribute("width", 0), s.setAttribute("height", 0), this.#i = this.#a.createElementNS(It, "defs"), t.append(s), s.append(this.#i), this.#a.body.append(t);
5987
5987
  }
5988
5988
  return this.#i;
5989
5989
  }
@@ -6004,7 +6004,7 @@ class qn extends Li {
6004
6004
  if (this.#t === void 0) {
6005
6005
  this.#t = "";
6006
6006
  const e = this.#a.URL;
6007
- e !== this.#a.baseURI && (Ze(e) ? I('#createUrl: ignore "data:"-URL for performance reasons.') : this.#t = xi(e, ""));
6007
+ e !== this.#a.baseURI && (Ze(e) ? R('#createUrl: ignore "data:"-URL for performance reasons.') : this.#t = xi(e, ""));
6008
6008
  }
6009
6009
  return `url(${this.#t}#${t})`;
6010
6010
  }
@@ -6106,27 +6106,27 @@ class qn extends Li {
6106
6106
  t && this.#r?.size || (this.#i?.parentNode.parentNode.remove(), this.#i = null, this.#e?.clear(), this.#e = null, this.#r?.clear(), this.#r = null, this.#n = 0);
6107
6107
  }
6108
6108
  #p(t) {
6109
- const e = this.#a.createElementNS(Rt, "feColorMatrix");
6109
+ const e = this.#a.createElementNS(It, "feColorMatrix");
6110
6110
  e.setAttribute("type", "matrix"), e.setAttribute("values", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"), t.append(e);
6111
6111
  }
6112
6112
  #m(t) {
6113
- const e = this.#a.createElementNS(Rt, "feColorMatrix");
6113
+ const e = this.#a.createElementNS(It, "feColorMatrix");
6114
6114
  e.setAttribute("type", "matrix"), e.setAttribute("values", "0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"), t.append(e);
6115
6115
  }
6116
6116
  #f(t) {
6117
- const e = this.#a.createElementNS(Rt, "filter");
6117
+ const e = this.#a.createElementNS(It, "filter");
6118
6118
  return e.setAttribute("color-interpolation-filters", "sRGB"), e.setAttribute("id", t), this.#h.append(e), e;
6119
6119
  }
6120
6120
  #c(t, e, s) {
6121
- const i = this.#a.createElementNS(Rt, e);
6121
+ const i = this.#a.createElementNS(It, e);
6122
6122
  i.setAttribute("type", "discrete"), i.setAttribute("tableValues", s), t.append(i);
6123
6123
  }
6124
6124
  #g(t, e, s, i) {
6125
- const n = this.#a.createElementNS(Rt, "feComponentTransfer");
6125
+ const n = this.#a.createElementNS(It, "feComponentTransfer");
6126
6126
  i.append(n), this.#c(n, "feFuncR", t), this.#c(n, "feFuncG", e), this.#c(n, "feFuncB", s);
6127
6127
  }
6128
6128
  #b(t, e) {
6129
- const s = this.#a.createElementNS(Rt, "feComponentTransfer");
6129
+ const s = this.#a.createElementNS(It, "feComponentTransfer");
6130
6130
  e.append(s), this.#c(s, "feFuncA", t);
6131
6131
  }
6132
6132
  #w(t) {
@@ -6189,38 +6189,38 @@ class ri extends Ni {
6189
6189
  return new Uint8Array(e);
6190
6190
  }
6191
6191
  }
6192
- dt && I("Please use the `legacy` build in Node.js environments.");
6193
- async function Os(c) {
6192
+ dt && R("Please use the `legacy` build in Node.js environments.");
6193
+ async function Bs(c) {
6194
6194
  const t = await process.getBuiltinModule("fs").promises.readFile(c);
6195
6195
  return new Uint8Array(t);
6196
6196
  }
6197
6197
  class Xn extends Li {
6198
6198
  }
6199
- class Yn extends Ri {
6199
+ class Yn extends Ii {
6200
6200
  _createCanvas(t, e) {
6201
6201
  return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(t, e);
6202
6202
  }
6203
6203
  }
6204
- class Kn extends Ii {
6204
+ class Kn extends Ri {
6205
6205
  async _fetch(t) {
6206
- return Os(t);
6206
+ return Bs(t);
6207
6207
  }
6208
6208
  }
6209
6209
  class Qn extends Fi {
6210
6210
  async _fetch(t) {
6211
- return Os(t);
6211
+ return Bs(t);
6212
6212
  }
6213
6213
  }
6214
6214
  class Jn extends Ni {
6215
6215
  async _fetch(t) {
6216
- return Os(t);
6216
+ return Bs(t);
6217
6217
  }
6218
6218
  }
6219
6219
  const Qt = "__forcedDependency", {
6220
6220
  floor: ai,
6221
6221
  ceil: oi
6222
6222
  } = Math;
6223
- function Be(c, t, e, s, i, n) {
6223
+ function Oe(c, t, e, s, i, n) {
6224
6224
  c[t * 4 + 0] = Math.min(c[t * 4 + 0], e), c[t * 4 + 1] = Math.min(c[t * 4 + 1], s), c[t * 4 + 2] = Math.max(c[t * 4 + 2], i), c[t * 4 + 3] = Math.max(c[t * 4 + 3], n);
6225
6225
  }
6226
6226
  const Es = new Uint32Array(new Uint8Array([255, 255, 0, 0]).buffer)[0];
@@ -6427,13 +6427,13 @@ class tr {
6427
6427
  }
6428
6428
  if (this.#l === t) {
6429
6429
  const s = ai(this.#o[0] * 256 / this.#p), i = ai(this.#o[1] * 256 / this.#m), n = oi(this.#o[2] * 256 / this.#p), r = oi(this.#o[3] * 256 / this.#m);
6430
- Be(this.#f, t, s, i, n, r);
6430
+ Oe(this.#f, t, s, i, n, r);
6431
6431
  for (const a of this.#h)
6432
- a !== t && Be(this.#f, a, s, i, n, r);
6432
+ a !== t && Oe(this.#f, a, s, i, n, r);
6433
6433
  for (const a of this.#s)
6434
- a !== t && Be(this.#f, a, s, i, n, r);
6434
+ a !== t && Oe(this.#f, a, s, i, n, r);
6435
6435
  for (const a of this.#a)
6436
- a !== t && Be(this.#f, a, s, i, n, r);
6436
+ a !== t && Oe(this.#f, a, s, i, n, r);
6437
6437
  e || (this.#h.clear(), this.#l = -1);
6438
6438
  }
6439
6439
  return this;
@@ -6591,7 +6591,7 @@ function Ss(c, t) {
6591
6591
  const e = t[2] - t[0], s = t[3] - t[1], i = new Path2D();
6592
6592
  i.rect(t[0], t[1], e, s), c.clip(i);
6593
6593
  }
6594
- class Bs {
6594
+ class Os {
6595
6595
  isModifyingCurrentTransform() {
6596
6596
  return !1;
6597
6597
  }
@@ -6599,7 +6599,7 @@ class Bs {
6599
6599
  j("Abstract method `getPattern` called.");
6600
6600
  }
6601
6601
  }
6602
- class er extends Bs {
6602
+ class er extends Os {
6603
6603
  constructor(t) {
6604
6604
  super(), this._type = t[1], this._bbox = t[2], this._colorStops = t[3], this._p0 = t[4], this._p1 = t[5], this._r0 = t[6], this._r1 = t[7], this.matrix = null;
6605
6605
  }
@@ -6656,21 +6656,21 @@ function cs(c, t, e, s, i, n, r, a) {
6656
6656
  if (f >= w)
6657
6657
  return;
6658
6658
  const y = h[n], v = h[n + 1], A = h[n + 2], x = h[r], _ = h[r + 1], E = h[r + 2], S = h[a], M = h[a + 1], C = h[a + 2], H = Math.round(f), V = Math.round(w);
6659
- let N, Z, k, R, U, ft, Dt, tt;
6659
+ let N, Z, k, I, U, ft, Dt, tt;
6660
6660
  for (let W = H; W <= V; W++) {
6661
6661
  if (W < b) {
6662
6662
  const et = W < f ? 0 : (f - W) / (f - b);
6663
- N = p - (p - g) * et, Z = y - (y - x) * et, k = v - (v - _) * et, R = A - (A - E) * et;
6663
+ N = p - (p - g) * et, Z = y - (y - x) * et, k = v - (v - _) * et, I = A - (A - E) * et;
6664
6664
  } else {
6665
6665
  let et;
6666
- W > w ? et = 1 : b === w ? et = 0 : et = (b - W) / (b - w), N = g - (g - m) * et, Z = x - (x - S) * et, k = _ - (_ - M) * et, R = E - (E - C) * et;
6666
+ W > w ? et = 1 : b === w ? et = 0 : et = (b - W) / (b - w), N = g - (g - m) * et, Z = x - (x - S) * et, k = _ - (_ - M) * et, I = E - (E - C) * et;
6667
6667
  }
6668
6668
  let q;
6669
6669
  W < f ? q = 0 : W > w ? q = 1 : q = (f - W) / (f - w), U = p - (p - m) * q, ft = y - (y - S) * q, Dt = v - (v - M) * q, tt = A - (A - C) * q;
6670
6670
  const Ut = Math.round(Math.min(N, U)), Nt = Math.round(Math.max(N, U));
6671
- let Ot = d * W + Ut * 4;
6671
+ let Bt = d * W + Ut * 4;
6672
6672
  for (let et = Ut; et <= Nt; et++)
6673
- q = (N - et) / (N - U), q < 0 ? q = 0 : q > 1 && (q = 1), l[Ot++] = Z - (Z - ft) * q | 0, l[Ot++] = k - (k - Dt) * q | 0, l[Ot++] = R - (R - tt) * q | 0, l[Ot++] = 255;
6673
+ q = (N - et) / (N - U), q < 0 ? q = 0 : q > 1 && (q = 1), l[Bt++] = Z - (Z - ft) * q | 0, l[Bt++] = k - (k - Dt) * q | 0, l[Bt++] = I - (I - tt) * q | 0, l[Bt++] = 255;
6674
6674
  }
6675
6675
  }
6676
6676
  function sr(c, t, e) {
@@ -6693,7 +6693,7 @@ function sr(c, t, e) {
6693
6693
  throw new Error("illegal figure");
6694
6694
  }
6695
6695
  }
6696
- class ir extends Bs {
6696
+ class ir extends Os {
6697
6697
  constructor(t) {
6698
6698
  super(), this._coords = t[2], this._colors = t[3], this._figures = t[4], this._bounds = t[5], this._bbox = t[6], this._background = t[7], this.matrix = null;
6699
6699
  }
@@ -6739,7 +6739,7 @@ class ir extends Bs {
6739
6739
  return i !== ct.SHADING && (t.setTransform(...e.baseTransform), this.matrix && t.transform(...this.matrix)), t.translate(r.offsetX, r.offsetY), t.scale(r.scaleX, r.scaleY), t.createPattern(r.canvas, "no-repeat");
6740
6740
  }
6741
6741
  }
6742
- class nr extends Bs {
6742
+ class nr extends Os {
6743
6743
  getPattern() {
6744
6744
  return "hotpink";
6745
6745
  }
@@ -6786,12 +6786,12 @@ class Hs {
6786
6786
  let x = g, _ = b, E = !1, S = !1;
6787
6787
  const M = Math.ceil(h * v), C = Math.ceil(l * A), H = Math.ceil(g * v), V = Math.ceil(b * A);
6788
6788
  M >= H ? x = h : E = !0, C >= V ? _ = l : S = !0;
6789
- const N = this.getSizeAndScale(x, this.ctx.canvas.width, v), Z = this.getSizeAndScale(_, this.ctx.canvas.height, A), k = t.cachedCanvases.getCanvas("pattern", N.size, Z.size), R = k.context, U = o.createCanvasGraphics(R, e);
6790
- if (U.groupLevel = t.groupLevel, this.setFillAndStrokeStyleToContext(U, n, a), R.translate(-N.scale * d, -Z.scale * u), U.transform(0, N.scale, 0, 0, Z.scale, 0, 0), R.save(), U.dependencyTracker?.save(), this.clipBbox(U, d, u, p, f), U.baseTransform = X(U.ctx), U.executeOperatorList(i), U.endDrawing(), U.dependencyTracker?.restore(), R.restore(), E || S) {
6789
+ const N = this.getSizeAndScale(x, this.ctx.canvas.width, v), Z = this.getSizeAndScale(_, this.ctx.canvas.height, A), k = t.cachedCanvases.getCanvas("pattern", N.size, Z.size), I = k.context, U = o.createCanvasGraphics(I, e);
6790
+ if (U.groupLevel = t.groupLevel, this.setFillAndStrokeStyleToContext(U, n, a), I.translate(-N.scale * d, -Z.scale * u), U.transform(0, N.scale, 0, 0, Z.scale, 0, 0), I.save(), U.dependencyTracker?.save(), this.clipBbox(U, d, u, p, f), U.baseTransform = X(U.ctx), U.executeOperatorList(i), U.endDrawing(), U.dependencyTracker?.restore(), I.restore(), E || S) {
6791
6791
  const ft = k.canvas;
6792
6792
  E && (x = h), S && (_ = l);
6793
- const Dt = this.getSizeAndScale(x, this.ctx.canvas.width, v), tt = this.getSizeAndScale(_, this.ctx.canvas.height, A), W = Dt.size, q = tt.size, Ut = t.cachedCanvases.getCanvas("pattern-workaround", W, q), Nt = Ut.context, Ot = E ? Math.floor(g / h) : 0, et = S ? Math.floor(b / l) : 0;
6794
- for (let de = 0; de <= Ot; de++)
6793
+ const Dt = this.getSizeAndScale(x, this.ctx.canvas.width, v), tt = this.getSizeAndScale(_, this.ctx.canvas.height, A), W = Dt.size, q = tt.size, Ut = t.cachedCanvases.getCanvas("pattern-workaround", W, q), Nt = Ut.context, Bt = E ? Math.floor(g / h) : 0, et = S ? Math.floor(b / l) : 0;
6794
+ for (let de = 0; de <= Bt; de++)
6795
6795
  for (let ue = 0; ue <= et; ue++)
6796
6796
  Nt.drawImage(ft, W * de, q * ue, W, q, 0, 0, W, q);
6797
6797
  return {
@@ -7454,7 +7454,7 @@ class he {
7454
7454
  const i = this.commonObjs.get(e), n = this.current;
7455
7455
  if (!i)
7456
7456
  throw new Error(`Can't find font for ${e}`);
7457
- if (n.fontMatrix = i.fontMatrix || ms, (n.fontMatrix[0] === 0 || n.fontMatrix[3] === 0) && I("Invalid font matrix for font " + e), s < 0 ? (s = -s, n.fontDirection = -1) : n.fontDirection = 1, this.current.font = i, this.current.fontSize = s, i.isType3Font)
7457
+ if (n.fontMatrix = i.fontMatrix || ms, (n.fontMatrix[0] === 0 || n.fontMatrix[3] === 0) && R("Invalid font matrix for font " + e), s < 0 ? (s = -s, n.fontDirection = -1) : n.fontDirection = 1, this.current.font = i, this.current.fontSize = s, i.isType3Font)
7458
7458
  return;
7459
7459
  const r = i.loadedName || "sans-serif", a = i.systemFontInfo?.css || `"${r}", ${i.fallbackName}`;
7460
7460
  let o = "normal";
@@ -7589,12 +7589,12 @@ class he {
7589
7589
  }
7590
7590
  let H = !1;
7591
7591
  const V = (C.isSpace ? h : 0) + o, N = C.fontChar, Z = C.accent;
7592
- let k, R, U = C.width;
7592
+ let k, I, U = C.width;
7593
7593
  if (p) {
7594
7594
  const tt = C.vmetric || g, W = -(C.vmetric ? tt[1] : U * 0.5) * b, q = tt[2] * b;
7595
- U = tt ? -tt[0] : U, k = W / a, R = (S + q) / a;
7595
+ U = tt ? -tt[0] : U, k = W / a, I = (S + q) / a;
7596
7596
  } else
7597
- k = S / a, R = 0;
7597
+ k = S / a, I = 0;
7598
7598
  let ft;
7599
7599
  if (i.remeasure && U > 0) {
7600
7600
  ft = r.measureText(N);
@@ -7606,11 +7606,11 @@ class he {
7606
7606
  }
7607
7607
  if (this.contentVisible && (C.isInFont || i.missingFile)) {
7608
7608
  if (m && !Z)
7609
- r.fillText(N, k, R), this.dependencyTracker?.recordCharacterBBox(t, r, ft ? {
7609
+ r.fillText(N, k, I), this.dependencyTracker?.recordCharacterBBox(t, r, ft ? {
7610
7610
  bbox: null
7611
- } : i, n / a, k, R, () => ft ?? r.measureText(N));
7612
- else if (this.paintChar(t, N, k, R, w, y), Z) {
7613
- const tt = k + n * Z.offset.x / a, W = R - n * Z.offset.y / a;
7611
+ } : i, n / a, k, I, () => ft ?? r.measureText(N));
7612
+ else if (this.paintChar(t, N, k, I, w, y), Z) {
7613
+ const tt = k + n * Z.offset.x / a, W = I - n * Z.offset.y / a;
7614
7614
  this.paintChar(t, Z.fontChar, tt, W, w, y);
7615
7615
  }
7616
7616
  }
@@ -7632,7 +7632,7 @@ class he {
7632
7632
  continue;
7633
7633
  }
7634
7634
  const v = (b.isSpace ? l : 0) + h, A = n.charProcOperatorList[b.operatorListId];
7635
- A ? this.contentVisible && (this.save(), s.scale(r, r), s.transform(...u), this.executeOperatorList(A), this.restore()) : I(`Type3 character "${b.operatorListId}" is not available.`);
7635
+ A ? this.contentVisible && (this.save(), s.scale(r, r), s.transform(...u), this.executeOperatorList(A), this.restore()) : R(`Type3 character "${b.operatorListId}" is not available.`);
7636
7636
  const x = [b.width, 0];
7637
7637
  T.applyTransform(x, u), m = x[0] * r + v, s.translate(m, 0), i.x += m * d;
7638
7638
  }
@@ -7721,7 +7721,7 @@ class he {
7721
7721
  return;
7722
7722
  this.save(t), this.inSMaskMode && (this.endSMaskMode(), this.current.activeSMask = null);
7723
7723
  const s = this.ctx;
7724
- e.isolated || Je("TODO: Support non-isolated groups."), e.knockout && I("Knockout groups not supported.");
7724
+ e.isolated || Je("TODO: Support non-isolated groups."), e.knockout && R("Knockout groups not supported.");
7725
7725
  const i = X(s);
7726
7726
  if (e.matrix && s.transform(...e.matrix), !e.bbox)
7727
7727
  throw new Error("Bounding box is required.");
@@ -7839,7 +7839,7 @@ class he {
7839
7839
  return;
7840
7840
  const s = this.getObject(t, e);
7841
7841
  if (!s) {
7842
- I("Dependent image isn't ready yet");
7842
+ R("Dependent image isn't ready yet");
7843
7843
  return;
7844
7844
  }
7845
7845
  this.paintInlineImageXObject(t, s);
@@ -7849,7 +7849,7 @@ class he {
7849
7849
  return;
7850
7850
  const r = this.getObject(t, e);
7851
7851
  if (!r) {
7852
- I("Dependent image isn't ready yet");
7852
+ R("Dependent image isn't ready yet");
7853
7853
  return;
7854
7854
  }
7855
7855
  const a = r.width, o = r.height, h = [];
@@ -8126,7 +8126,7 @@ class fr {
8126
8126
  else if (this.#e.has(n))
8127
8127
  r = this.#e.get(n).visible;
8128
8128
  else
8129
- return I(`Optional content group not found: ${n}`), !0;
8129
+ return R(`Optional content group not found: ${n}`), !0;
8130
8130
  switch (s) {
8131
8131
  case "And":
8132
8132
  if (!r)
@@ -8150,14 +8150,14 @@ class fr {
8150
8150
  if (!t)
8151
8151
  return Je("Optional content group not defined."), !0;
8152
8152
  if (t.type === "OCG")
8153
- return this.#e.has(t.id) ? this.#e.get(t.id).visible : (I(`Optional content group not found: ${t.id}`), !0);
8153
+ return this.#e.has(t.id) ? this.#e.get(t.id).visible : (R(`Optional content group not found: ${t.id}`), !0);
8154
8154
  if (t.type === "OCMD") {
8155
8155
  if (t.expression)
8156
8156
  return this.#a(t.expression);
8157
8157
  if (!t.policy || t.policy === "AnyOn") {
8158
8158
  for (const e of t.ids) {
8159
8159
  if (!this.#e.has(e))
8160
- return I(`Optional content group not found: ${e}`), !0;
8160
+ return R(`Optional content group not found: ${e}`), !0;
8161
8161
  if (this.#e.get(e).visible)
8162
8162
  return !0;
8163
8163
  }
@@ -8165,7 +8165,7 @@ class fr {
8165
8165
  } else if (t.policy === "AllOn") {
8166
8166
  for (const e of t.ids) {
8167
8167
  if (!this.#e.has(e))
8168
- return I(`Optional content group not found: ${e}`), !0;
8168
+ return R(`Optional content group not found: ${e}`), !0;
8169
8169
  if (!this.#e.get(e).visible)
8170
8170
  return !1;
8171
8171
  }
@@ -8173,7 +8173,7 @@ class fr {
8173
8173
  } else if (t.policy === "AnyOff") {
8174
8174
  for (const e of t.ids) {
8175
8175
  if (!this.#e.has(e))
8176
- return I(`Optional content group not found: ${e}`), !0;
8176
+ return R(`Optional content group not found: ${e}`), !0;
8177
8177
  if (!this.#e.get(e).visible)
8178
8178
  return !0;
8179
8179
  }
@@ -8181,20 +8181,20 @@ class fr {
8181
8181
  } else if (t.policy === "AllOff") {
8182
8182
  for (const e of t.ids) {
8183
8183
  if (!this.#e.has(e))
8184
- return I(`Optional content group not found: ${e}`), !0;
8184
+ return R(`Optional content group not found: ${e}`), !0;
8185
8185
  if (this.#e.get(e).visible)
8186
8186
  return !1;
8187
8187
  }
8188
8188
  return !0;
8189
8189
  }
8190
- return I(`Unknown optional content policy ${t.policy}.`), !0;
8190
+ return R(`Unknown optional content policy ${t.policy}.`), !0;
8191
8191
  }
8192
- return I(`Unknown group type ${t.type}.`), !0;
8192
+ return R(`Unknown group type ${t.type}.`), !0;
8193
8193
  }
8194
8194
  setVisibility(t, e = !0, s = !0) {
8195
8195
  const i = this.#e.get(t);
8196
8196
  if (!i) {
8197
- I(`Optional content group not found: ${t}`);
8197
+ R(`Optional content group not found: ${t}`);
8198
8198
  return;
8199
8199
  }
8200
8200
  if (s && e && i.rbGroups.length)
@@ -8258,7 +8258,7 @@ class mr {
8258
8258
  disableRange: e = !1,
8259
8259
  disableStream: s = !1
8260
8260
  }) {
8261
- B(t, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
8261
+ O(t, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
8262
8262
  const {
8263
8263
  length: i,
8264
8264
  initialData: n,
@@ -8298,7 +8298,7 @@ class mr {
8298
8298
  const i = this._rangeReaders.some(function(n) {
8299
8299
  return n._begin !== t ? !1 : (n._enqueue(s), !0);
8300
8300
  });
8301
- B(i, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
8301
+ O(i, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
8302
8302
  }
8303
8303
  }
8304
8304
  get _progressiveDataLength() {
@@ -8320,7 +8320,7 @@ class mr {
8320
8320
  e >= 0 && this._rangeReaders.splice(e, 1);
8321
8321
  }
8322
8322
  getFullReader() {
8323
- B(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
8323
+ O(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
8324
8324
  const t = this._queuedChunks;
8325
8325
  return this._queuedChunks = null, new br(this, t, this._progressiveDone, this._contentDispositionFilename);
8326
8326
  }
@@ -8339,7 +8339,7 @@ class mr {
8339
8339
  }
8340
8340
  class br {
8341
8341
  constructor(t, e, s = !1, i = null) {
8342
- this._stream = t, this._done = s || !1, this._filename = Is(i) ? i : null, this._queuedChunks = e || [], this._loaded = 0;
8342
+ this._stream = t, this._done = s || !1, this._filename = Rs(i) ? i : null, this._queuedChunks = e || [], this._loaded = 0;
8343
8343
  for (const n of this._queuedChunks)
8344
8344
  this._loaded += n.byteLength;
8345
8345
  this._requests = [], this._headersReady = Promise.resolve(), t._fullRequestReader = this, this.onProgress = null;
@@ -8533,7 +8533,7 @@ function wr(c) {
8533
8533
  }
8534
8534
  return "";
8535
8535
  }
8536
- function Oi(c, t) {
8536
+ function Bi(c, t) {
8537
8537
  const e = new Headers();
8538
8538
  if (!c || !t || typeof t != "object")
8539
8539
  return e;
@@ -8546,7 +8546,7 @@ function Oi(c, t) {
8546
8546
  function es(c) {
8547
8547
  return URL.parse(c)?.origin ?? null;
8548
8548
  }
8549
- function Bi({
8549
+ function Oi({
8550
8550
  responseHeaders: c,
8551
8551
  isHttp: t,
8552
8552
  rangeChunkSize: e,
@@ -8567,12 +8567,12 @@ function Hi(c) {
8567
8567
  e = decodeURIComponent(e);
8568
8568
  } catch {
8569
8569
  }
8570
- if (Is(e))
8570
+ if (Rs(e))
8571
8571
  return e;
8572
8572
  }
8573
8573
  return null;
8574
8574
  }
8575
- function Ie(c, t) {
8575
+ function Re(c, t) {
8576
8576
  return new We(`Unexpected server response (${c}) while retrieving PDF "${t}".`, c, c === 404 || c === 0 && t.startsWith("file:"));
8577
8577
  }
8578
8578
  function $i(c) {
@@ -8589,18 +8589,18 @@ function zi(c, t, e) {
8589
8589
  };
8590
8590
  }
8591
8591
  function Ui(c) {
8592
- return c instanceof Uint8Array ? c.buffer : c instanceof ArrayBuffer ? c : (I(`getArrayBuffer - unexpected data format: ${c}`), new Uint8Array(c).buffer);
8592
+ return c instanceof Uint8Array ? c.buffer : c instanceof ArrayBuffer ? c : (R(`getArrayBuffer - unexpected data format: ${c}`), new Uint8Array(c).buffer);
8593
8593
  }
8594
8594
  class vr {
8595
8595
  _responseOrigin = null;
8596
8596
  constructor(t) {
8597
- this.source = t, this.isHttp = /^https?:/i.test(t.url), this.headers = Oi(this.isHttp, t.httpHeaders), this._fullRequestReader = null, this._rangeRequestReaders = [];
8597
+ this.source = t, this.isHttp = /^https?:/i.test(t.url), this.headers = Bi(this.isHttp, t.httpHeaders), this._fullRequestReader = null, this._rangeRequestReaders = [];
8598
8598
  }
8599
8599
  get _progressiveDataLength() {
8600
8600
  return this._fullRequestReader?._loaded ?? 0;
8601
8601
  }
8602
8602
  getFullReader() {
8603
- return B(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."), this._fullRequestReader = new Ar(this), this._fullRequestReader;
8603
+ return O(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."), this._fullRequestReader = new Ar(this), this._fullRequestReader;
8604
8604
  }
8605
8605
  getRangeReader(t, e) {
8606
8606
  if (e <= this._progressiveDataLength)
@@ -8622,12 +8622,12 @@ class Ar {
8622
8622
  const s = new Headers(t.headers), i = e.url;
8623
8623
  fetch(i, zi(s, this._withCredentials, this._abortController)).then((n) => {
8624
8624
  if (t._responseOrigin = es(n.url), !$i(n.status))
8625
- throw Ie(n.status, i);
8625
+ throw Re(n.status, i);
8626
8626
  this._reader = n.body.getReader(), this._headersCapability.resolve();
8627
8627
  const r = n.headers, {
8628
8628
  allowRangeRequests: a,
8629
8629
  suggestedLength: o
8630
- } = Bi({
8630
+ } = Oi({
8631
8631
  responseHeaders: r,
8632
8632
  isHttp: t.isHttp,
8633
8633
  rangeChunkSize: this._rangeChunkSize,
@@ -8685,7 +8685,7 @@ class xr {
8685
8685
  if (o !== t._responseOrigin)
8686
8686
  throw new Error(`Expected range response-origin "${o}" to match "${t._responseOrigin}".`);
8687
8687
  if (!$i(a.status))
8688
- throw Ie(a.status, r);
8688
+ throw Re(a.status, r);
8689
8689
  this._readCapability.resolve(), this._reader = a.body.getReader();
8690
8690
  }).catch(this._readCapability.reject), this.onProgress = null;
8691
8691
  }
@@ -8724,7 +8724,7 @@ class Er {
8724
8724
  httpHeaders: e,
8725
8725
  withCredentials: s
8726
8726
  }) {
8727
- this.url = t, this.isHttp = /^https?:/i.test(t), this.headers = Oi(this.isHttp, e), this.withCredentials = s || !1, this.currXhrId = 0, this.pendingRequests = /* @__PURE__ */ Object.create(null);
8727
+ this.url = t, this.isHttp = /^https?:/i.test(t), this.headers = Bi(this.isHttp, e), this.withCredentials = s || !1, this.currXhrId = 0, this.pendingRequests = /* @__PURE__ */ Object.create(null);
8728
8728
  }
8729
8729
  request(t) {
8730
8730
  const e = new XMLHttpRequest(), s = this.currXhrId++, i = this.pendingRequests[s] = {
@@ -8733,7 +8733,7 @@ class Er {
8733
8733
  e.open("GET", this.url), e.withCredentials = this.withCredentials;
8734
8734
  for (const [n, r] of this.headers)
8735
8735
  e.setRequestHeader(n, r);
8736
- return this.isHttp && "begin" in t && "end" in t ? (e.setRequestHeader("Range", `bytes=${t.begin}-${t.end - 1}`), i.expectedStatus = ps) : i.expectedStatus = us, e.responseType = "arraybuffer", B(t.onError, "Expected `onError` callback to be provided."), e.onerror = () => {
8736
+ return this.isHttp && "begin" in t && "end" in t ? (e.setRequestHeader("Range", `bytes=${t.begin}-${t.end - 1}`), i.expectedStatus = ps) : i.expectedStatus = us, e.responseType = "arraybuffer", O(t.onError, "Expected `onError` callback to be provided."), e.onerror = () => {
8737
8737
  t.onError(e.status);
8738
8738
  }, e.onreadystatechange = this.onStateChange.bind(this, s), e.onprogress = this.onProgress.bind(this, s), i.onHeadersReceived = t.onHeadersReceived, i.onDone = t.onDone, i.onError = t.onError, i.onProgress = t.onProgress, e.send(null), s;
8739
8739
  }
@@ -8763,7 +8763,7 @@ class Er {
8763
8763
  o ? s.onDone({
8764
8764
  begin: parseInt(o[1], 10),
8765
8765
  chunk: r
8766
- }) : (I('Missing or invalid "Content-Range" header.'), s.onError(0));
8766
+ }) : (R('Missing or invalid "Content-Range" header.'), s.onError(0));
8767
8767
  } else r ? s.onDone({
8768
8768
  begin: 0,
8769
8769
  chunk: r
@@ -8789,7 +8789,7 @@ class Sr {
8789
8789
  e >= 0 && this._rangeRequestReaders.splice(e, 1);
8790
8790
  }
8791
8791
  getFullReader() {
8792
- return B(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."), this._fullRequestReader = new Cr(this._manager, this._source), this._fullRequestReader;
8792
+ return O(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."), this._fullRequestReader = new Cr(this._manager, this._source), this._fullRequestReader;
8793
8793
  }
8794
8794
  getRangeReader(t, e) {
8795
8795
  const s = new Tr(this._manager, t, e);
@@ -8819,7 +8819,7 @@ class Cr {
8819
8819
  }) : []), {
8820
8820
  allowRangeRequests: n,
8821
8821
  suggestedLength: r
8822
- } = Bi({
8822
+ } = Oi({
8823
8823
  responseHeaders: i,
8824
8824
  isHttp: this._manager.isHttp,
8825
8825
  rangeChunkSize: this._rangeChunkSize,
@@ -8841,7 +8841,7 @@ class Cr {
8841
8841
  }
8842
8842
  }
8843
8843
  _onError(t) {
8844
- this._storedError = Ie(t, this._url), this._headersCapability.reject(this._storedError);
8844
+ this._storedError = Re(t, this._url), this._headersCapability.reject(this._storedError);
8845
8845
  for (const e of this._requests)
8846
8846
  e.reject(this._storedError);
8847
8847
  this._requests.length = 0, this._cachedChunks.length = 0;
@@ -8925,7 +8925,7 @@ class Tr {
8925
8925
  this._requests.length = 0, this._close();
8926
8926
  }
8927
8927
  _onError(t) {
8928
- this._storedError ??= Ie(t, this._url);
8928
+ this._storedError ??= Re(t, this._url);
8929
8929
  for (const e of this._requests)
8930
8930
  e.reject(this._storedError);
8931
8931
  this._requests.length = 0, this._queuedChunk = null;
@@ -8975,18 +8975,18 @@ function Mr(c) {
8975
8975
  }
8976
8976
  class kr {
8977
8977
  constructor(t) {
8978
- this.source = t, this.url = Mr(t.url), B(this.url.protocol === "file:", "PDFNodeStream only supports file:// URLs."), this._fullRequestReader = null, this._rangeRequestReaders = [];
8978
+ this.source = t, this.url = Mr(t.url), O(this.url.protocol === "file:", "PDFNodeStream only supports file:// URLs."), this._fullRequestReader = null, this._rangeRequestReaders = [];
8979
8979
  }
8980
8980
  get _progressiveDataLength() {
8981
8981
  return this._fullRequestReader?._loaded ?? 0;
8982
8982
  }
8983
8983
  getFullReader() {
8984
- return B(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."), this._fullRequestReader = new Dr(this), this._fullRequestReader;
8984
+ return O(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."), this._fullRequestReader = new Dr(this), this._fullRequestReader;
8985
8985
  }
8986
8986
  getRangeReader(t, e) {
8987
8987
  if (e <= this._progressiveDataLength)
8988
8988
  return null;
8989
- const s = new Rr(this, t, e);
8989
+ const s = new Ir(this, t, e);
8990
8990
  return this._rangeRequestReaders.push(s), s;
8991
8991
  }
8992
8992
  cancelAllRequests(t) {
@@ -9004,7 +9004,7 @@ class Dr {
9004
9004
  s.promises.lstat(this._url).then((i) => {
9005
9005
  this._contentLength = i.size, this._setReadableStream(s.createReadStream(this._url)), this._headersCapability.resolve();
9006
9006
  }, (i) => {
9007
- i.code === "ENOENT" && (i = Ie(0, this._url.href)), this._storedError = i, this._headersCapability.reject(i);
9007
+ i.code === "ENOENT" && (i = Re(0, this._url.href)), this._storedError = i, this._headersCapability.reject(i);
9008
9008
  });
9009
9009
  }
9010
9010
  get headersReady() {
@@ -9059,7 +9059,7 @@ class Dr {
9059
9059
  }), !this._isStreamingSupported && this._isRangeSupported && this._error(new $t("streaming is disabled")), this._storedError && this._readableStream.destroy(this._storedError);
9060
9060
  }
9061
9061
  }
9062
- class Rr {
9062
+ class Ir {
9063
9063
  constructor(t, e, s) {
9064
9064
  this._url = t.url, this._done = !1, this._storedError = null, this.onProgress = null, this._loaded = 0, this._readableStream = null, this._readCapability = Promise.withResolvers();
9065
9065
  const i = t.source;
@@ -9158,7 +9158,7 @@ class Vi {
9158
9158
  }
9159
9159
  }
9160
9160
  }
9161
- const Ir = 1e5, bi = 30;
9161
+ const Rr = 1e5, bi = 30;
9162
9162
  class yt {
9163
9163
  #t = Promise.withResolvers();
9164
9164
  #e = null;
@@ -9271,8 +9271,8 @@ class yt {
9271
9271
  this.#r.ctx ??= yt.#k(this.#a);
9272
9272
  const e = this.#c, s = this.#m;
9273
9273
  for (const i of t) {
9274
- if (e.length > Ir) {
9275
- I("Ignoring additional textDivs for performance reasons."), this.#i = !0;
9274
+ if (e.length > Rr) {
9275
+ R("Ignoring additional textDivs for performance reasons."), this.#i = !0;
9276
9276
  return;
9277
9277
  }
9278
9278
  if (i.str === void 0) {
@@ -9300,7 +9300,7 @@ class yt {
9300
9300
  r.vertical && (n += Math.PI / 2);
9301
9301
  let a = this.#s && r.fontSubstitution || r.fontFamily;
9302
9302
  a = yt.fontFamilyMap.get(a) || a;
9303
- const o = Math.hypot(i[2], i[3]), h = o * yt.#O(a, r, this.#a);
9303
+ const o = Math.hypot(i[2], i[3]), h = o * yt.#B(a, r, this.#a);
9304
9304
  let l, d;
9305
9305
  n === 0 ? (l = i[4], d = i[5] - h) : (l = i[4] + h * Math.sin(n), d = i[5] - h * Math.cos(n));
9306
9306
  const u = e.style;
@@ -9374,7 +9374,7 @@ class yt {
9374
9374
  const t = document.createElement("div");
9375
9375
  t.style.opacity = 0, t.style.lineHeight = 1, t.style.fontSize = "1px", t.style.position = "absolute", t.textContent = "X", document.body.append(t), this.#_ = t.getBoundingClientRect().height, t.remove();
9376
9376
  }
9377
- static #O(t, e, s) {
9377
+ static #B(t, e, s) {
9378
9378
  const i = this.#w.get(t);
9379
9379
  if (i)
9380
9380
  return i;
@@ -9383,7 +9383,7 @@ class yt {
9383
9383
  const r = n.measureText(""), a = r.fontBoundingBoxAscent, o = Math.abs(r.fontBoundingBoxDescent);
9384
9384
  n.canvas.width = n.canvas.height = 0;
9385
9385
  let h = 0.8;
9386
- return a ? h = a / (a + o) : (at.platform.isFirefox && I("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."), e.ascent ? h = e.ascent : e.descent && (h = 1 + e.descent)), this.#w.set(t, h), h;
9386
+ return a ? h = a / (a + o) : (at.platform.isFirefox && R("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."), e.ascent ? h = e.ascent : e.descent && (h = 1 + e.descent)), this.#w.set(t, h), h;
9387
9387
  }
9388
9388
  }
9389
9389
  const Lr = 100;
@@ -9397,7 +9397,7 @@ function Gi(c = {}) {
9397
9397
  docId: e
9398
9398
  } = t, s = c.url ? zn(c.url) : null, i = c.data ? Un(c.data) : null, n = c.httpHeaders || null, r = c.withCredentials === !0, a = c.password ?? null, o = c.range instanceof ji ? c.range : null, h = Number.isInteger(c.rangeChunkSize) && c.rangeChunkSize > 0 ? c.rangeChunkSize : 2 ** 16;
9399
9399
  let l = c.worker instanceof Cs ? c.worker : null;
9400
- const d = c.verbosity, u = typeof c.docBaseUrl == "string" && !Ze(c.docBaseUrl) ? c.docBaseUrl : null, p = Ne(c.cMapUrl), f = c.cMapPacked !== !1, g = c.CMapReaderFactory || (dt ? Kn : ii), b = Ne(c.iccUrl), m = Ne(c.standardFontDataUrl), w = c.StandardFontDataFactory || (dt ? Qn : ni), y = Ne(c.wasmUrl), v = c.WasmFactory || (dt ? Jn : ri), A = c.stopAtErrors !== !0, x = Number.isInteger(c.maxImageSize) && c.maxImageSize > -1 ? c.maxImageSize : -1, _ = c.isEvalSupported !== !1, E = typeof c.isOffscreenCanvasSupported == "boolean" ? c.isOffscreenCanvasSupported : !dt, S = typeof c.isImageDecoderSupported == "boolean" ? c.isImageDecoderSupported : !dt && (at.platform.isFirefox || !globalThis.chrome), M = Number.isInteger(c.canvasMaxAreaInBytes) ? c.canvasMaxAreaInBytes : -1, C = typeof c.disableFontFace == "boolean" ? c.disableFontFace : dt, H = c.fontExtraProperties === !0, V = c.enableXfa === !0, N = c.ownerDocument || globalThis.document, Z = c.disableRange === !0, k = c.disableStream === !0, R = c.disableAutoFetch === !0, U = c.pdfBug === !0, ft = c.CanvasFactory || (dt ? Yn : Wn), Dt = c.FilterFactory || (dt ? Xn : qn), tt = c.enableHWA === !0, W = c.useWasm !== !1, q = o ? o.length : c.length ?? NaN, Ut = typeof c.useSystemFonts == "boolean" ? c.useSystemFonts : !dt && !C, Nt = typeof c.useWorkerFetch == "boolean" ? c.useWorkerFetch : !!(g === ii && w === ni && v === ri && p && m && y && we(p, document.baseURI) && we(m, document.baseURI) && we(y, document.baseURI)), Ot = null;
9400
+ const d = c.verbosity, u = typeof c.docBaseUrl == "string" && !Ze(c.docBaseUrl) ? c.docBaseUrl : null, p = Ne(c.cMapUrl), f = c.cMapPacked !== !1, g = c.CMapReaderFactory || (dt ? Kn : ii), b = Ne(c.iccUrl), m = Ne(c.standardFontDataUrl), w = c.StandardFontDataFactory || (dt ? Qn : ni), y = Ne(c.wasmUrl), v = c.WasmFactory || (dt ? Jn : ri), A = c.stopAtErrors !== !0, x = Number.isInteger(c.maxImageSize) && c.maxImageSize > -1 ? c.maxImageSize : -1, _ = c.isEvalSupported !== !1, E = typeof c.isOffscreenCanvasSupported == "boolean" ? c.isOffscreenCanvasSupported : !dt, S = typeof c.isImageDecoderSupported == "boolean" ? c.isImageDecoderSupported : !dt && (at.platform.isFirefox || !globalThis.chrome), M = Number.isInteger(c.canvasMaxAreaInBytes) ? c.canvasMaxAreaInBytes : -1, C = typeof c.disableFontFace == "boolean" ? c.disableFontFace : dt, H = c.fontExtraProperties === !0, V = c.enableXfa === !0, N = c.ownerDocument || globalThis.document, Z = c.disableRange === !0, k = c.disableStream === !0, I = c.disableAutoFetch === !0, U = c.pdfBug === !0, ft = c.CanvasFactory || (dt ? Yn : Wn), Dt = c.FilterFactory || (dt ? Xn : qn), tt = c.enableHWA === !0, W = c.useWasm !== !1, q = o ? o.length : c.length ?? NaN, Ut = typeof c.useSystemFonts == "boolean" ? c.useSystemFonts : !dt && !C, Nt = typeof c.useWorkerFetch == "boolean" ? c.useWorkerFetch : !!(g === ii && w === ni && v === ri && p && m && y && we(p, document.baseURI) && we(m, document.baseURI) && we(y, document.baseURI)), Bt = null;
9401
9401
  gn(d);
9402
9402
  const et = {
9403
9403
  canvasFactory: new ft({
@@ -9428,7 +9428,7 @@ function Gi(c = {}) {
9428
9428
  apiVersion: "5.4.530",
9429
9429
  data: i,
9430
9430
  password: a,
9431
- disableAutoFetch: R,
9431
+ disableAutoFetch: I,
9432
9432
  rangeChunkSize: h,
9433
9433
  length: q,
9434
9434
  docBaseUrl: u,
@@ -9453,9 +9453,9 @@ function Gi(c = {}) {
9453
9453
  }, ue = {
9454
9454
  ownerDocument: N,
9455
9455
  pdfBug: U,
9456
- styleElement: Ot,
9456
+ styleElement: Bt,
9457
9457
  loadingParams: {
9458
- disableAutoFetch: R,
9458
+ disableAutoFetch: I,
9459
9459
  enableXfa: V
9460
9460
  }
9461
9461
  };
@@ -9490,7 +9490,7 @@ function Gi(c = {}) {
9490
9490
  throw new Error("Loading aborted");
9491
9491
  if (l.destroyed)
9492
9492
  throw new Error("Worker was destroyed");
9493
- const qs = new ve(e, ns, l.port), rn = new Or(qs, t, is, ue, et, tt);
9493
+ const qs = new ve(e, ns, l.port), rn = new Br(qs, t, is, ue, et, tt);
9494
9494
  t._transport = rn, qs.send("Ready", null);
9495
9495
  });
9496
9496
  }).catch(t._capability.reject), t;
@@ -9752,7 +9752,7 @@ class Nr {
9752
9752
  canvas: e = t.canvas,
9753
9753
  viewport: s,
9754
9754
  intent: i = "display",
9755
- annotationMode: n = Bt.ENABLE,
9755
+ annotationMode: n = Ot.ENABLE,
9756
9756
  transform: r = null,
9757
9757
  background: a = null,
9758
9758
  optionalContentConfigPromise: o = null,
@@ -9827,7 +9827,7 @@ class Nr {
9827
9827
  }
9828
9828
  getOperatorList({
9829
9829
  intent: t = "display",
9830
- annotationMode: e = Bt.ENABLE,
9830
+ annotationMode: e = Ot.ENABLE,
9831
9831
  printAnnotationStorage: s = null,
9832
9832
  isEditing: i = !1
9833
9833
  } = {}) {
@@ -9984,7 +9984,7 @@ class Nr {
9984
9984
  if (t.streamReaderCancelTimeout && (clearTimeout(t.streamReaderCancelTimeout), t.streamReaderCancelTimeout = null), !s) {
9985
9985
  if (t.renderTasks.size > 0)
9986
9986
  return;
9987
- if (e instanceof Rs) {
9987
+ if (e instanceof Is) {
9988
9988
  let i = Lr;
9989
9989
  e.extraDelay > 0 && e.extraDelay < 1e3 && (i += e.extraDelay), t.streamReaderCancelTimeout = setTimeout(() => {
9990
9990
  t.streamReaderCancelTimeout = null, this._abortOperatorList({
@@ -10021,9 +10021,9 @@ const rt = class Ae {
10021
10021
  if (Ft(this, Et), Ft(this, Gt, Promise.withResolvers()), Ft(this, Mt, null), Ft(this, Ht, null), Ft(this, le, null), this.name = t, this.destroyed = !1, this.verbosity = s, e) {
10022
10022
  if (Y(Ae, ne).has(e))
10023
10023
  throw new Error("Cannot use more than one PDFWorker per port.");
10024
- Y(Ae, ne).set(e, this), It(this, Et, Wi).call(this, e);
10024
+ Y(Ae, ne).set(e, this), Rt(this, Et, Wi).call(this, e);
10025
10025
  } else
10026
- It(this, Et, qi).call(this);
10026
+ Rt(this, Et, qi).call(this);
10027
10027
  }
10028
10028
  get promise() {
10029
10029
  return Y(this, Gt).promise;
@@ -10065,10 +10065,10 @@ Gt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10065
10065
  });
10066
10066
  }, Wi = function(c) {
10067
10067
  mt(this, Ht, c), mt(this, Mt, new ve("main", "worker", c)), Y(this, Mt).on("ready", () => {
10068
- }), It(this, Et, Ue).call(this);
10068
+ }), Rt(this, Et, Ue).call(this);
10069
10069
  }, qi = function() {
10070
10070
  if (Y(rt, Jt) || Y(rt, _e, Xe)) {
10071
- It(this, Et, me).call(this);
10071
+ Rt(this, Et, me).call(this);
10072
10072
  return;
10073
10073
  }
10074
10074
  let {
@@ -10079,7 +10079,7 @@ Gt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10079
10079
  const t = new Worker(c, {
10080
10080
  type: "module"
10081
10081
  }), e = new ve("main", "worker", t), s = () => {
10082
- i.abort(), e.destroy(), t.terminate(), this.destroyed ? Y(this, Gt).reject(new Error("Worker was destroyed")) : It(this, Et, me).call(this);
10082
+ i.abort(), e.destroy(), t.terminate(), this.destroyed ? Y(this, Gt).reject(new Error("Worker was destroyed")) : Rt(this, Et, me).call(this);
10083
10083
  }, i = new AbortController();
10084
10084
  t.addEventListener("error", () => {
10085
10085
  Y(this, le) || s();
@@ -10090,7 +10090,7 @@ Gt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10090
10090
  s();
10091
10091
  return;
10092
10092
  }
10093
- mt(this, Mt, e), mt(this, Ht, t), mt(this, le, t), It(this, Et, Ue).call(this);
10093
+ mt(this, Mt, e), mt(this, Ht, t), mt(this, le, t), Rt(this, Et, Ue).call(this);
10094
10094
  }), e.on("ready", (r) => {
10095
10095
  if (i.abort(), this.destroyed) {
10096
10096
  s();
@@ -10099,7 +10099,7 @@ Gt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10099
10099
  try {
10100
10100
  n();
10101
10101
  } catch {
10102
- It(this, Et, me).call(this);
10102
+ Rt(this, Et, me).call(this);
10103
10103
  }
10104
10104
  });
10105
10105
  const n = () => {
@@ -10111,9 +10111,9 @@ Gt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10111
10111
  } catch {
10112
10112
  Je("The worker has been disabled.");
10113
10113
  }
10114
- It(this, Et, me).call(this);
10114
+ Rt(this, Et, me).call(this);
10115
10115
  }, me = function() {
10116
- Y(rt, Jt) || (I("Setting up fake worker."), mt(rt, Jt, !0)), rt._setupFakeWorkerGlobal.then((c) => {
10116
+ Y(rt, Jt) || (R("Setting up fake worker."), mt(rt, Jt, !0)), rt._setupFakeWorkerGlobal.then((c) => {
10117
10117
  if (this.destroyed) {
10118
10118
  Y(this, Gt).reject(new Error("Worker was destroyed"));
10119
10119
  return;
@@ -10121,7 +10121,7 @@ Gt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10121
10121
  const t = new jn();
10122
10122
  mt(this, Ht, t);
10123
10123
  const e = `fake${ln(rt, gs)._++}`, s = new ve(e + "_worker", e, t);
10124
- c.setup(s, t), mt(this, Mt, new ve(e, e + "_worker", t)), It(this, Et, Ue).call(this);
10124
+ c.setup(s, t), mt(this, Mt, new ve(e, e + "_worker", t)), Rt(this, Et, Ue).call(this);
10125
10125
  }).catch((c) => {
10126
10126
  Y(this, Gt).reject(new Error(`Setting up fake worker failed: "${c.message}".`));
10127
10127
  });
@@ -10148,14 +10148,14 @@ Gt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /*
10148
10148
  return rt.create(c);
10149
10149
  };
10150
10150
  let Cs = rt;
10151
- class Or {
10151
+ class Br {
10152
10152
  #t = /* @__PURE__ */ new Map();
10153
10153
  #e = /* @__PURE__ */ new Map();
10154
10154
  #i = /* @__PURE__ */ new Map();
10155
10155
  #s = /* @__PURE__ */ new Map();
10156
10156
  #a = null;
10157
10157
  constructor(t, e, s, i, n, r) {
10158
- this.messageHandler = t, this.loadingTask = e, this.commonObjs = new Vi(), this.fontLoader = new Bn({
10158
+ this.messageHandler = t, this.loadingTask = e, this.commonObjs = new Vi(), this.fontLoader = new On({
10159
10159
  ownerDocument: i.ownerDocument,
10160
10160
  styleElement: i.styleElement
10161
10161
  }), this.loadingParams = i.loadingParams, this._params = i, this.canvasFactory = n.canvasFactory, this.filterFactory = n.filterFactory, this.cMapReaderFactory = n.cMapReaderFactory, this.standardFontDataFactory = n.standardFontDataFactory, this.wasmFactory = n.wasmFactory, this.destroyed = !1, this.destroyCapability = null, this._networkStream = s, this._fullReader = null, this._lastProgress = null, this.downloadInfoCapability = Promise.withResolvers(), this.enableHWA = r, this.setupMessageHandler();
@@ -10170,7 +10170,7 @@ class Or {
10170
10170
  get annotationStorage() {
10171
10171
  return L(this, "annotationStorage", new Ns());
10172
10172
  }
10173
- getRenderingIntent(t, e = Bt.ENABLE, s = null, i = !1, n = !1) {
10173
+ getRenderingIntent(t, e = Ot.ENABLE, s = null, i = !1, n = !1) {
10174
10174
  let r = bt.DISPLAY, a = xs;
10175
10175
  switch (t) {
10176
10176
  case "any":
@@ -10182,23 +10182,23 @@ class Or {
10182
10182
  r = bt.PRINT;
10183
10183
  break;
10184
10184
  default:
10185
- I(`getRenderingIntent - invalid intent: ${t}`);
10185
+ R(`getRenderingIntent - invalid intent: ${t}`);
10186
10186
  }
10187
10187
  const o = r & bt.PRINT && s instanceof Di ? s : this.annotationStorage;
10188
10188
  switch (e) {
10189
- case Bt.DISABLE:
10189
+ case Ot.DISABLE:
10190
10190
  r += bt.ANNOTATIONS_DISABLE;
10191
10191
  break;
10192
- case Bt.ENABLE:
10192
+ case Ot.ENABLE:
10193
10193
  break;
10194
- case Bt.ENABLE_FORMS:
10194
+ case Ot.ENABLE_FORMS:
10195
10195
  r += bt.ANNOTATIONS_FORMS;
10196
10196
  break;
10197
- case Bt.ENABLE_STORAGE:
10197
+ case Ot.ENABLE_STORAGE:
10198
10198
  r += bt.ANNOTATIONS_STORAGE, a = o.serializable;
10199
10199
  break;
10200
10200
  default:
10201
- I(`getRenderingIntent - invalid annotationMode: ${e}`);
10201
+ R(`getRenderingIntent - invalid annotationMode: ${e}`);
10202
10202
  }
10203
10203
  i && (r += bt.IS_EDITING), n && (r += bt.OPLIST);
10204
10204
  const {
@@ -10231,7 +10231,7 @@ class Or {
10231
10231
  loadingTask: e
10232
10232
  } = this;
10233
10233
  t.on("GetReader", (s, i) => {
10234
- B(this._networkStream, "GetReader - no `IPDFStream` instance available."), this._fullReader = this._networkStream.getFullReader(), this._fullReader.onProgress = (n) => {
10234
+ O(this._networkStream, "GetReader - no `IPDFStream` instance available."), this._fullReader = this._networkStream.getFullReader(), this._fullReader.onProgress = (n) => {
10235
10235
  this._lastProgress = {
10236
10236
  loaded: n.loaded,
10237
10237
  total: n.total
@@ -10245,7 +10245,7 @@ class Or {
10245
10245
  i.close();
10246
10246
  return;
10247
10247
  }
10248
- B(n instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer."), i.enqueue(new Uint8Array(n), 1, [n]);
10248
+ O(n instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer."), i.enqueue(new Uint8Array(n), 1, [n]);
10249
10249
  }).catch((n) => {
10250
10250
  i.error(n);
10251
10251
  });
@@ -10273,7 +10273,7 @@ class Or {
10273
10273
  contentLength: r
10274
10274
  };
10275
10275
  }), t.on("GetRangeReader", (s, i) => {
10276
- B(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
10276
+ O(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
10277
10277
  const n = this._networkStream.getRangeReader(s.begin, s.end);
10278
10278
  if (!n) {
10279
10279
  i.close();
@@ -10288,7 +10288,7 @@ class Or {
10288
10288
  i.close();
10289
10289
  return;
10290
10290
  }
10291
- B(r instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer."), i.enqueue(new Uint8Array(r), 1, [r]);
10291
+ O(r instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer."), i.enqueue(new Uint8Array(r), 1, [r]);
10292
10292
  }).catch((r) => {
10293
10293
  i.error(r);
10294
10294
  });
@@ -10333,7 +10333,7 @@ class Or {
10333
10333
  case "Font":
10334
10334
  if ("error" in n) {
10335
10335
  const d = n.error;
10336
- I(`Error during font loading: ${d}`), this.commonObjs.resolve(s, d);
10336
+ R(`Error during font loading: ${d}`), this.commonObjs.resolve(s, d);
10337
10337
  break;
10338
10338
  }
10339
10339
  const r = new G(n), a = this._params.pdfBug && globalThis.FontInspector?.enabled ? (d, u) => globalThis.FontInspector.fontAdded(d, u) : null, o = new Hn(r, a, n.extra, n.charProcOperatorList);
@@ -10347,7 +10347,7 @@ class Or {
10347
10347
  const {
10348
10348
  imageRef: h
10349
10349
  } = n;
10350
- B(h, "The imageRef must be defined.");
10350
+ O(h, "The imageRef must be defined.");
10351
10351
  for (const d of this.#e.values())
10352
10352
  for (const [, u] of d.objs)
10353
10353
  if (u?.ref === h)
@@ -10403,7 +10403,7 @@ class Or {
10403
10403
  return this.messageHandler.sendWithPromise("GetData", null);
10404
10404
  }
10405
10405
  saveDocument() {
10406
- this.annotationStorage.size <= 0 && I("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");
10406
+ this.annotationStorage.size <= 0 && R("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");
10407
10407
  const {
10408
10408
  map: t,
10409
10409
  transfer: e
@@ -10546,7 +10546,7 @@ class Or {
10546
10546
  return this.#s.get(e) ?? null;
10547
10547
  }
10548
10548
  }
10549
- class Br {
10549
+ class Or {
10550
10550
  #t = null;
10551
10551
  onContinue = null;
10552
10552
  onError = null;
@@ -10590,7 +10590,7 @@ class re {
10590
10590
  enableHWA: p = !1,
10591
10591
  operationsFilter: f = null
10592
10592
  }) {
10593
- this.callback = t, this.params = e, this.objs = s, this.commonObjs = i, this.annotationCanvasMap = n, this.operatorListIdx = null, this.operatorList = r, this._pageIndex = a, this.canvasFactory = o, this.filterFactory = h, this._pdfBug = d, this.pageColors = u, this.running = !1, this.graphicsReadyCallback = null, this.graphicsReady = !1, this._useRequestAnimationFrame = l === !0 && typeof window < "u", this.cancelled = !1, this.capability = Promise.withResolvers(), this.task = new Br(this), this._cancelBound = this.cancel.bind(this), this._continueBound = this._continue.bind(this), this._scheduleNextBound = this._scheduleNext.bind(this), this._nextBound = this._next.bind(this), this._canvas = e.canvas, this._canvasContext = e.canvas ? null : e.canvasContext, this._enableHWA = p, this._dependencyTracker = e.dependencyTracker, this._operationsFilter = f;
10593
+ this.callback = t, this.params = e, this.objs = s, this.commonObjs = i, this.annotationCanvasMap = n, this.operatorListIdx = null, this.operatorList = r, this._pageIndex = a, this.canvasFactory = o, this.filterFactory = h, this._pdfBug = d, this.pageColors = u, this.running = !1, this.graphicsReadyCallback = null, this.graphicsReady = !1, this._useRequestAnimationFrame = l === !0 && typeof window < "u", this.cancelled = !1, this.capability = Promise.withResolvers(), this.task = new Or(this), this._cancelBound = this.cancel.bind(this), this._continueBound = this._continue.bind(this), this._scheduleNextBound = this._scheduleNext.bind(this), this._nextBound = this._next.bind(this), this._canvas = e.canvas, this._canvasContext = e.canvas ? null : e.canvasContext, this._enableHWA = p, this._dependencyTracker = e.dependencyTracker, this._operationsFilter = f;
10594
10594
  }
10595
10595
  get completed() {
10596
10596
  return this.capability.promise.catch(function() {
@@ -10627,7 +10627,7 @@ class re {
10627
10627
  }), this.operatorListIdx = 0, this.graphicsReady = !0, this.graphicsReadyCallback?.();
10628
10628
  }
10629
10629
  cancel(t = null, e = 0) {
10630
- this.running = !1, this.cancelled = !0, this.gfx?.endDrawing(), this.#t && (window.cancelAnimationFrame(this.#t), this.#t = null), re.#e.delete(this._canvas), t ||= new Rs(`Rendering cancelled, page ${this._pageIndex + 1}`, e), this.callback(t), this.task.onError?.(t);
10630
+ this.running = !1, this.cancelled = !0, this.gfx?.endDrawing(), this.#t && (window.cancelAnimationFrame(this.#t), this.#t = null), re.#e.delete(this._canvas), t ||= new Is(`Rendering cancelled, page ${this._pageIndex + 1}`, e), this.callback(t), this.task.onError?.(t);
10631
10631
  }
10632
10632
  operatorListChanged() {
10633
10633
  if (!this.graphicsReady) {
@@ -10662,7 +10662,7 @@ class xt {
10662
10662
  #h = null;
10663
10663
  static #u = null;
10664
10664
  static get _keyboardManager() {
10665
- return L(this, "_keyboardManager", new Re([[["Escape", "mac+Escape"], xt.prototype._hideDropdownFromKeyboard], [[" ", "mac+ "], xt.prototype._colorSelectFromKeyboard], [["ArrowDown", "ArrowRight", "mac+ArrowDown", "mac+ArrowRight"], xt.prototype._moveToNext], [["ArrowUp", "ArrowLeft", "mac+ArrowUp", "mac+ArrowLeft"], xt.prototype._moveToPrevious], [["Home", "mac+Home"], xt.prototype._moveToBeginning], [["End", "mac+End"], xt.prototype._moveToEnd]]));
10665
+ return L(this, "_keyboardManager", new Ie([[["Escape", "mac+Escape"], xt.prototype._hideDropdownFromKeyboard], [[" ", "mac+ "], xt.prototype._colorSelectFromKeyboard], [["ArrowDown", "ArrowRight", "mac+ArrowDown", "mac+ArrowRight"], xt.prototype._moveToNext], [["ArrowUp", "ArrowLeft", "mac+ArrowUp", "mac+ArrowLeft"], xt.prototype._moveToPrevious], [["Home", "mac+Home"], xt.prototype._moveToBeginning], [["End", "mac+End"], xt.prototype._moveToEnd]]));
10666
10666
  }
10667
10667
  constructor({
10668
10668
  editor: t = null,
@@ -10712,7 +10712,7 @@ class xt {
10712
10712
  #p(t, e) {
10713
10713
  e.stopPropagation(), this.#o.dispatch("switchannotationeditorparams", {
10714
10714
  source: this,
10715
- type: O.HIGHLIGHT_COLOR,
10715
+ type: B.HIGHLIGHT_COLOR,
10716
10716
  value: t
10717
10717
  }), this.updateColor(t);
10718
10718
  }
@@ -10910,7 +10910,7 @@ class $r {
10910
10910
  }
10911
10911
  class Ye extends $r {
10912
10912
  _createSVG(t) {
10913
- return document.createElementNS(Rt, t);
10913
+ return document.createElementNS(It, t);
10914
10914
  }
10915
10915
  }
10916
10916
  const zr = 9, Xt = /* @__PURE__ */ new WeakSet(), Ur = (/* @__PURE__ */ new Date()).getTimezoneOffset() * 60 * 1e3;
@@ -11146,10 +11146,10 @@ class K {
11146
11146
  r.borderStyle = "dashed";
11147
11147
  break;
11148
11148
  case Zt.BEVELED:
11149
- I("Unimplemented border style: beveled");
11149
+ R("Unimplemented border style: beveled");
11150
11150
  break;
11151
11151
  case Zt.INSET:
11152
- I("Unimplemented border style: inset");
11152
+ R("Unimplemented border style: inset");
11153
11153
  break;
11154
11154
  case Zt.UNDERLINE:
11155
11155
  r.borderBottomStyle = "solid";
@@ -11366,7 +11366,7 @@ class K {
11366
11366
  continue;
11367
11367
  const o = typeof a == "string" ? a : null, h = document.querySelector(`[data-element-id="${r}"]`);
11368
11368
  if (h && !Xt.has(h)) {
11369
- I(`_getElementsByName - element not allowed: ${r}`);
11369
+ R(`_getElementsByName - element not allowed: ${r}`);
11370
11370
  continue;
11371
11371
  }
11372
11372
  s.push({
@@ -11516,7 +11516,7 @@ class zs extends K {
11516
11516
  _bindResetFormAction(t, e) {
11517
11517
  const s = t.onclick;
11518
11518
  if (s || (t.href = this.linkService.getAnchorUrl("")), this.#t(), !this._fieldObjects) {
11519
- I('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'), s || (t.onclick = () => !1);
11519
+ R('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'), s || (t.onclick = () => !1);
11520
11520
  return;
11521
11521
  }
11522
11522
  t.onclick = () => {
@@ -11576,7 +11576,7 @@ class zs extends K {
11576
11576
  const u = document.querySelector(`[data-element-id="${d}"]`);
11577
11577
  if (u) {
11578
11578
  if (!Xt.has(u)) {
11579
- I(`_bindResetFormAction - element not allowed: ${d}`);
11579
+ R(`_bindResetFormAction - element not allowed: ${d}`);
11580
11580
  continue;
11581
11581
  }
11582
11582
  } else continue;
@@ -12215,7 +12215,7 @@ class Kr {
12215
12215
  #t = null;
12216
12216
  #e = this.#G.bind(this);
12217
12217
  #i = this.#H.bind(this);
12218
- #s = this.#I.bind(this);
12218
+ #s = this.#R.bind(this);
12219
12219
  #a = this.#x.bind(this);
12220
12220
  #r = null;
12221
12221
  #n = null;
@@ -12310,7 +12310,7 @@ class Kr {
12310
12310
  const r = this.#g = document.createElement("button");
12311
12311
  r.className = "annotationCommentButton";
12312
12312
  const a = this.#v.container;
12313
- r.style.zIndex = a.style.zIndex + 1, r.tabIndex = 0, r.ariaHasPopup = "dialog", r.ariaControls = "commentPopup", r.setAttribute("data-l10n-id", "pdfjs-show-comment-button"), this.#O(), this.#M(), r.addEventListener("keydown", this.#e, {
12313
+ r.style.zIndex = a.style.zIndex + 1, r.tabIndex = 0, r.ariaHasPopup = "dialog", r.ariaControls = "commentPopup", r.setAttribute("data-l10n-id", "pdfjs-show-comment-button"), this.#B(), this.#M(), r.addEventListener("keydown", this.#e, {
12314
12314
  signal: t
12315
12315
  }), r.addEventListener("click", s, {
12316
12316
  signal: t
@@ -12330,7 +12330,7 @@ class Kr {
12330
12330
  } = this.#g;
12331
12331
  s.left = `calc(${t}%)`, s.top = `calc(${e}% - var(--comment-button-dim))`;
12332
12332
  }
12333
- #O() {
12333
+ #B() {
12334
12334
  this.#v.extraPopupElement || (this.#g || this.renderCommentButton(), this.#g.style.backgroundColor = this.commentButtonColor || "");
12335
12335
  }
12336
12336
  get commentButtonColor() {
@@ -12450,20 +12450,20 @@ class Kr {
12450
12450
  })), s.dateTime = this.#l.toISOString(), e.append(s);
12451
12451
  }
12452
12452
  Ti({
12453
- html: this.#R || this.#o.str,
12453
+ html: this.#I || this.#o.str,
12454
12454
  dir: this.#o?.dir,
12455
12455
  className: "popupContent"
12456
12456
  }, t), this.#n.append(t);
12457
12457
  }
12458
- get #R() {
12458
+ get #I() {
12459
12459
  const t = this.#S, e = this.#o;
12460
12460
  return t?.str && (!e?.str || e.str === t.str) && this.#S.html || null;
12461
12461
  }
12462
12462
  get #L() {
12463
- return this.#R?.attributes?.style?.fontSize || 0;
12463
+ return this.#I?.attributes?.style?.fontSize || 0;
12464
12464
  }
12465
- get #B() {
12466
- return this.#R?.attributes?.style?.color || null;
12465
+ get #O() {
12466
+ return this.#I?.attributes?.style?.color || null;
12467
12467
  }
12468
12468
  #F(t) {
12469
12469
  const e = [], s = {
@@ -12480,7 +12480,7 @@ class Kr {
12480
12480
  }
12481
12481
  }, i = {
12482
12482
  style: {
12483
- color: this.#B,
12483
+ color: this.#O,
12484
12484
  fontSize: this.#L ? `calc(${this.#L}px * var(--total-scale-factor))` : ""
12485
12485
  }
12486
12486
  };
@@ -12502,7 +12502,7 @@ class Kr {
12502
12502
  deleted: s
12503
12503
  }) {
12504
12504
  if (this.#t) {
12505
- s ? (this.remove(), this.#E = null) : e && (e.deleted ? this.remove() : (this.#O(), this.#E = e.text)), t && (this.#b = null, this.#P(), this.#M());
12505
+ s ? (this.remove(), this.#E = null) : e && (e.deleted ? this.remove() : (this.#B(), this.#E = e.text)), t && (this.#b = null, this.#P(), this.#M());
12506
12506
  return;
12507
12507
  }
12508
12508
  if (s || e?.deleted) {
@@ -12559,9 +12559,9 @@ class Kr {
12559
12559
  this.#t.toggleCommentPopup(this, !1);
12560
12560
  return;
12561
12561
  }
12562
- this.#p = !this.#p, this.#p ? (this.#I(), this.#n.addEventListener("click", this.#a), this.#n.addEventListener("keydown", this.#e)) : (this.#H(), this.#n.removeEventListener("click", this.#a), this.#n.removeEventListener("keydown", this.#e));
12562
+ this.#p = !this.#p, this.#p ? (this.#R(), this.#n.addEventListener("click", this.#a), this.#n.addEventListener("keydown", this.#e)) : (this.#H(), this.#n.removeEventListener("click", this.#a), this.#n.removeEventListener("keydown", this.#e));
12563
12563
  }
12564
- #I() {
12564
+ #R() {
12565
12565
  this.#m || this.render(), this.isVisible ? this.#p && this.#n.classList.add("focused") : (this.#C(), this.#n.hidden = !1, this.#n.style.zIndex = parseInt(this.#n.style.zIndex) + 1e3);
12566
12566
  }
12567
12567
  #H() {
@@ -12571,7 +12571,7 @@ class Kr {
12571
12571
  this.#T = this.isVisible, this.#T && (this.#n.hidden = !0);
12572
12572
  }
12573
12573
  maybeShow() {
12574
- this.#t || (this.#k(), this.#T && (this.#m || this.#I(), this.#T = !1, this.#n.hidden = !1));
12574
+ this.#t || (this.#k(), this.#T && (this.#m || this.#R(), this.#T = !1, this.#n.hidden = !1));
12575
12575
  }
12576
12576
  get isVisible() {
12577
12577
  return this.#t ? !1 : this.#n.hidden === !1;
@@ -13190,7 +13190,7 @@ class ht extends D {
13190
13190
  static _defaultFontSize = 10;
13191
13191
  static get _keyboardManager() {
13192
13192
  const t = ht.prototype, e = (n) => n.isEmpty(), s = zt.TRANSLATE_SMALL, i = zt.TRANSLATE_BIG;
13193
- return L(this, "_keyboardManager", new Re([[["ctrl+s", "mac+meta+s", "ctrl+p", "mac+meta+p"], t.commitOrRemove, {
13193
+ return L(this, "_keyboardManager", new Ie([[["ctrl+s", "mac+meta+s", "ctrl+p", "mac+meta+p"], t.commitOrRemove, {
13194
13194
  bubbles: !0
13195
13195
  }], [["ctrl+Enter", "mac+meta+Enter", "Escape", "mac+Escape"], t.commitOrRemove], [["ArrowLeft", "mac+ArrowLeft"], t._translateEmpty, {
13196
13196
  args: [-s, 0],
@@ -13233,35 +13233,35 @@ class ht extends D {
13233
13233
  }
13234
13234
  static updateDefaultParams(t, e) {
13235
13235
  switch (t) {
13236
- case O.FREETEXT_SIZE:
13236
+ case B.FREETEXT_SIZE:
13237
13237
  ht._defaultFontSize = e;
13238
13238
  break;
13239
- case O.FREETEXT_COLOR:
13239
+ case B.FREETEXT_COLOR:
13240
13240
  ht._defaultColor = e;
13241
13241
  break;
13242
13242
  }
13243
13243
  }
13244
13244
  updateParams(t, e) {
13245
13245
  switch (t) {
13246
- case O.FREETEXT_SIZE:
13246
+ case B.FREETEXT_SIZE:
13247
13247
  this.#a(e);
13248
13248
  break;
13249
- case O.FREETEXT_COLOR:
13249
+ case B.FREETEXT_COLOR:
13250
13250
  this.#r(e);
13251
13251
  break;
13252
13252
  }
13253
13253
  }
13254
13254
  static get defaultPropertiesToUpdate() {
13255
- return [[O.FREETEXT_SIZE, ht._defaultFontSize], [O.FREETEXT_COLOR, ht._defaultColor || D._defaultLineColor]];
13255
+ return [[B.FREETEXT_SIZE, ht._defaultFontSize], [B.FREETEXT_COLOR, ht._defaultColor || D._defaultLineColor]];
13256
13256
  }
13257
13257
  get propertiesToUpdate() {
13258
- return [[O.FREETEXT_SIZE, this.#s], [O.FREETEXT_COLOR, this.color]];
13258
+ return [[B.FREETEXT_SIZE, this.#s], [B.FREETEXT_COLOR, this.color]];
13259
13259
  }
13260
13260
  get toolbarButtons() {
13261
13261
  return this._colorPicker ||= new Te(this), [["colorPicker", this._colorPicker]];
13262
13262
  }
13263
13263
  get colorType() {
13264
- return O.FREETEXT_COLOR;
13264
+ return B.FREETEXT_COLOR;
13265
13265
  }
13266
13266
  #a(t) {
13267
13267
  const e = (i) => {
@@ -13272,7 +13272,7 @@ class ht extends D {
13272
13272
  undo: e.bind(this, s),
13273
13273
  post: this._uiManager.updateUI.bind(this._uiManager, this),
13274
13274
  mustExec: !0,
13275
- type: O.FREETEXT_SIZE,
13275
+ type: B.FREETEXT_SIZE,
13276
13276
  overwriteIfSameType: !0,
13277
13277
  keepUndo: !0
13278
13278
  });
@@ -13289,7 +13289,7 @@ class ht extends D {
13289
13289
  undo: e.bind(this, s),
13290
13290
  post: this._uiManager.updateUI.bind(this._uiManager, this),
13291
13291
  mustExec: !0,
13292
- type: O.FREETEXT_COLOR,
13292
+ type: B.FREETEXT_COLOR,
13293
13293
  overwriteIfSameType: !0,
13294
13294
  keepUndo: !0
13295
13295
  });
@@ -14092,7 +14092,7 @@ class J extends D {
14092
14092
  static _freeHighlightClipId = "";
14093
14093
  static get _keyboardManager() {
14094
14094
  const t = J.prototype;
14095
- return L(this, "_keyboardManager", new Re([[["ArrowLeft", "mac+ArrowLeft"], t._moveCaret, {
14095
+ return L(this, "_keyboardManager", new Ie([[["ArrowLeft", "mac+ArrowLeft"], t._moveCaret, {
14096
14096
  args: [0]
14097
14097
  }], [["ArrowRight", "mac+ArrowRight"], t._moveCaret, {
14098
14098
  args: [1]
@@ -14212,10 +14212,10 @@ class J extends D {
14212
14212
  }
14213
14213
  static updateDefaultParams(t, e) {
14214
14214
  switch (t) {
14215
- case O.HIGHLIGHT_COLOR:
14215
+ case B.HIGHLIGHT_COLOR:
14216
14216
  J._defaultColor = e;
14217
14217
  break;
14218
- case O.HIGHLIGHT_THICKNESS:
14218
+ case B.HIGHLIGHT_THICKNESS:
14219
14219
  J._defaultThickness = e;
14220
14220
  break;
14221
14221
  }
@@ -14230,19 +14230,19 @@ class J extends D {
14230
14230
  }
14231
14231
  updateParams(t, e) {
14232
14232
  switch (t) {
14233
- case O.HIGHLIGHT_COLOR:
14233
+ case B.HIGHLIGHT_COLOR:
14234
14234
  this.#S(e);
14235
14235
  break;
14236
- case O.HIGHLIGHT_THICKNESS:
14236
+ case B.HIGHLIGHT_THICKNESS:
14237
14237
  this.#_(e);
14238
14238
  break;
14239
14239
  }
14240
14240
  }
14241
14241
  static get defaultPropertiesToUpdate() {
14242
- return [[O.HIGHLIGHT_COLOR, J._defaultColor], [O.HIGHLIGHT_THICKNESS, J._defaultThickness]];
14242
+ return [[B.HIGHLIGHT_COLOR, J._defaultColor], [B.HIGHLIGHT_THICKNESS, J._defaultThickness]];
14243
14243
  }
14244
14244
  get propertiesToUpdate() {
14245
- return [[O.HIGHLIGHT_COLOR, this.color || J._defaultColor], [O.HIGHLIGHT_THICKNESS, this.#g || J._defaultThickness], [O.HIGHLIGHT_FREE, this.#d]];
14245
+ return [[B.HIGHLIGHT_COLOR, this.color || J._defaultColor], [B.HIGHLIGHT_THICKNESS, this.#g || J._defaultThickness], [B.HIGHLIGHT_FREE, this.#d]];
14246
14246
  }
14247
14247
  onUpdatedColor() {
14248
14248
  this.parent?.drawLayer.updateProperties(this.#u, {
@@ -14261,7 +14261,7 @@ class J extends D {
14261
14261
  undo: e.bind(this, s, i),
14262
14262
  post: this._uiManager.updateUI.bind(this._uiManager, this),
14263
14263
  mustExec: !0,
14264
- type: O.HIGHLIGHT_COLOR,
14264
+ type: B.HIGHLIGHT_COLOR,
14265
14265
  overwriteIfSameType: !0,
14266
14266
  keepUndo: !0
14267
14267
  }), this._reportTelemetry({
@@ -14278,7 +14278,7 @@ class J extends D {
14278
14278
  undo: s.bind(this, e),
14279
14279
  post: this._uiManager.updateUI.bind(this._uiManager, this),
14280
14280
  mustExec: !0,
14281
- type: O.INK_THICKNESS,
14281
+ type: B.INK_THICKNESS,
14282
14282
  overwriteIfSameType: !0,
14283
14283
  keepUndo: !0
14284
14284
  }), this._reportTelemetry({
@@ -14463,7 +14463,7 @@ class J extends D {
14463
14463
  #M() {
14464
14464
  return this.#d ? this.rotation : 0;
14465
14465
  }
14466
- #O() {
14466
+ #B() {
14467
14467
  if (this.#d)
14468
14468
  return null;
14469
14469
  const [t, e] = this.pageDimensions, [s, i] = this.pageTranslation, n = this.#i, r = new Float32Array(n.length * 8);
@@ -14479,7 +14479,7 @@ class J extends D {
14479
14479
  }
14480
14480
  return r;
14481
14481
  }
14482
- #R(t) {
14482
+ #I(t) {
14483
14483
  return this.#h.serialize(t, this.#M());
14484
14484
  }
14485
14485
  static startHighlighting(t, e, {
@@ -14493,7 +14493,7 @@ class J extends D {
14493
14493
  width: o,
14494
14494
  height: h
14495
14495
  } = s.getBoundingClientRect(), l = new AbortController(), d = t.combinedSignal(l), u = (p) => {
14496
- l.abort(), this.#B(t, p);
14496
+ l.abort(), this.#O(t, p);
14497
14497
  };
14498
14498
  window.addEventListener("blur", u, {
14499
14499
  signal: d
@@ -14536,7 +14536,7 @@ class J extends D {
14536
14536
  }
14537
14537
  });
14538
14538
  }
14539
- static #B(t, e) {
14539
+ static #O(t, e) {
14540
14540
  this._freeHighlight.isEmpty() ? t.drawLayer.remove(this._freeHighlightId) : t.createAndAddNewEditor(e, !1, {
14541
14541
  highlightId: this._freeHighlightId,
14542
14542
  highlightOutlines: this._freeHighlight.getOutlines(),
@@ -14689,8 +14689,8 @@ class J extends D {
14689
14689
  color: e,
14690
14690
  opacity: this.opacity,
14691
14691
  thickness: this.#g,
14692
- quadPoints: this.#O(),
14693
- outlines: this.#R(s.rect)
14692
+ quadPoints: this.#B(),
14693
+ outlines: this.#I(s.rect)
14694
14694
  }), this.addComment(s), this.annotationElementId && !this.#F(s) ? null : (s.id = this.annotationElementId, s);
14695
14695
  }
14696
14696
  #F(t) {
@@ -15088,7 +15088,7 @@ class $ extends D {
15088
15088
  e.drawLayer.updateProperties(i, s.removeLastElement());
15089
15089
  },
15090
15090
  mustExec: !1,
15091
- type: O.DRAW_STEP
15091
+ type: B.DRAW_STEP
15092
15092
  });
15093
15093
  return;
15094
15094
  }
@@ -15099,7 +15099,7 @@ class $ extends D {
15099
15099
  const e = this._currentParent;
15100
15100
  if (!e)
15101
15101
  return null;
15102
- if (e.toggleDrawing(!0), e.cleanUndoStack(O.DRAW_STEP), !$.#i.isEmpty()) {
15102
+ if (e.toggleDrawing(!0), e.cleanUndoStack(B.DRAW_STEP), !$.#i.isEmpty()) {
15103
15103
  const {
15104
15104
  pageDimensions: [s, i],
15105
15105
  scale: n
@@ -15632,7 +15632,7 @@ class Gs extends $ {
15632
15632
  return !0;
15633
15633
  }
15634
15634
  static get typesMap() {
15635
- return L(this, "typesMap", /* @__PURE__ */ new Map([[O.INK_THICKNESS, "stroke-width"], [O.INK_COLOR, "stroke"], [O.INK_OPACITY, "stroke-opacity"]]));
15635
+ return L(this, "typesMap", /* @__PURE__ */ new Map([[B.INK_THICKNESS, "stroke-width"], [B.INK_COLOR, "stroke"], [B.INK_OPACITY, "stroke-opacity"]]));
15636
15636
  }
15637
15637
  static createDrawerInstance(t, e, s, i, n) {
15638
15638
  return new ha(t, e, s, i, n, this._defaultDrawingOptions["stroke-width"]);
@@ -15695,7 +15695,7 @@ class Gs extends $ {
15695
15695
  return this._colorPicker ||= new Te(this), [["colorPicker", this._colorPicker]];
15696
15696
  }
15697
15697
  get colorType() {
15698
- return O.INK_COLOR;
15698
+ return B.INK_COLOR;
15699
15699
  }
15700
15700
  get color() {
15701
15701
  return this._drawingOptions.stroke;
@@ -16166,7 +16166,7 @@ class ee {
16166
16166
  height: d
16167
16167
  };
16168
16168
  } catch (e) {
16169
- return I(`decompressSignature: ${e}`), null;
16169
+ return R(`decompressSignature: ${e}`), null;
16170
16170
  }
16171
16171
  }
16172
16172
  }
@@ -17508,13 +17508,13 @@ globalThis._pdfjsTestingUtils = {
17508
17508
  globalThis.pdfjsLib = {
17509
17509
  AbortException: $t,
17510
17510
  AnnotationEditorLayer: Lt,
17511
- AnnotationEditorParamsType: O,
17511
+ AnnotationEditorParamsType: B,
17512
17512
  AnnotationEditorType: F,
17513
17513
  AnnotationEditorUIManager: zt,
17514
17514
  AnnotationLayer: Vs,
17515
- AnnotationMode: Bt,
17515
+ AnnotationMode: Ot,
17516
17516
  AnnotationType: it,
17517
- applyOpacity: Rn,
17517
+ applyOpacity: In,
17518
17518
  build: Hr,
17519
17519
  ColorPicker: xt,
17520
17520
  createValidAbsoluteUrl: Ai,
@@ -17523,7 +17523,7 @@ globalThis.pdfjsLib = {
17523
17523
  DrawLayer: lt,
17524
17524
  FeatureTest: at,
17525
17525
  fetchData: Me,
17526
- findContrastColor: In,
17526
+ findContrastColor: Rn,
17527
17527
  getDocument: Gi,
17528
17528
  getFilenameFromUrl: Sn,
17529
17529
  getPdfFilenameFromUrl: Cn,
@@ -17534,7 +17534,7 @@ globalThis.pdfjsLib = {
17534
17534
  ImageKind: je,
17535
17535
  InvalidPDFException: ys,
17536
17536
  isDataScheme: Ze,
17537
- isPdfFile: Is,
17537
+ isPdfFile: Rs,
17538
17538
  isValidExplicitDest: Gn,
17539
17539
  MathClamp: ut,
17540
17540
  noContextMenu: _t,
@@ -17547,7 +17547,7 @@ globalThis.pdfjsLib = {
17547
17547
  PDFWorker: Cs,
17548
17548
  PermissionFlag: un,
17549
17549
  PixelsPerInch: ce,
17550
- RenderingCancelledException: Rs,
17550
+ RenderingCancelledException: Is,
17551
17551
  renderRichText: Ti,
17552
17552
  ResponseException: We,
17553
17553
  setLayerDimensions: Wt,
@@ -17878,9 +17878,10 @@ class fa {
17878
17878
  this.element.appendChild(e), this.fieldElements.set(t.id, e);
17879
17879
  });
17880
17880
  }
17881
+ selectedFieldId = null;
17881
17882
  createFieldElement(t) {
17882
17883
  const e = document.createElement("div");
17883
- e.className = "sc-signature-field", e.dataset.id = t.id, e.dataset.moveable = String(t.draggable !== !1), e.style.position = "absolute", e.style.pointerEvents = "auto", e.style.boxSizing = "border-box", e.style.border = "1px solid #0056b3", e.style.backgroundColor = "rgba(0, 86, 179, 0.1)", e.style.cursor = t.draggable !== !1 ? "move" : "default", t.style && Object.assign(e.style, t.style);
17884
+ e.className = "sc-signature-field", e.dataset.id = t.id, e.dataset.moveable = String(t.draggable !== !1), e.style.position = "absolute", e.style.pointerEvents = "auto", e.style.boxSizing = "border-box", e.style.border = "1px solid #7FA1C3", e.style.backgroundColor = "rgba(127, 161, 195, 0.1)", e.style.cursor = t.draggable !== !1 ? "move" : "default", t.style && Object.assign(e.style, t.style);
17884
17885
  const s = document.createElement("div");
17885
17886
  if (s.className = "sc-field-content", s.style.overflow = "hidden", s.style.display = "flex", s.style.alignItems = "center", s.style.justifyContent = "center", t.type === "text")
17886
17887
  s.textContent = t.content || "", s.style.whiteSpace = "pre-wrap", s.style.fontSize = "7pt", s.style.fontFamily = "sans-serif", s.style.lineHeight = "1.2", s.style.textAlign = "center";
@@ -17893,12 +17894,20 @@ class fa {
17893
17894
  const i = document.createElement("img");
17894
17895
  i.src = t.content || "", i.style.maxWidth = "100%", i.style.maxHeight = "100%", i.style.pointerEvents = "none", s.appendChild(i);
17895
17896
  }
17896
- return e.appendChild(s), t.resizable !== !1 && this.addResizeHandles(e), t.deletable !== !1 && this.addDeleteButton(e, t.id), this.updateElementPosition(e, t), e;
17897
+ return e.addEventListener("mousedown", (i) => {
17898
+ this.eventBus.emit("field:focus", { fieldId: t.id });
17899
+ }), e.addEventListener("touchstart", (i) => {
17900
+ this.eventBus.emit("field:focus", { fieldId: t.id });
17901
+ }, { passive: !1 }), e.appendChild(s), t.resizable !== !1 && this.addResizeHandles(e), t.deletable !== !1 && this.addDeleteButton(e, t.id), e.addEventListener("mouseenter", () => {
17902
+ this.selectedFieldId !== t.id && this.updateVisuals(e, t, !0, !1);
17903
+ }), e.addEventListener("mouseleave", () => {
17904
+ this.selectedFieldId !== t.id && this.updateVisuals(e, t, !1, !1);
17905
+ }), this.updateElementPosition(e, t), this.selectedFieldId === t.id && this.updateVisuals(e, t, !0, !0), e;
17897
17906
  }
17898
17907
  addResizeHandles(t) {
17899
17908
  ["nw", "ne", "sw", "se", "n", "e", "s", "w"].forEach((e) => {
17900
17909
  const s = document.createElement("div");
17901
- s.className = `sc-resize-handle sc-resize-${e}`, s.dataset.handle = e, s.style.position = "absolute", s.style.backgroundColor = "white", s.style.border = "1px solid #0056b3", s.style.zIndex = "2", s.style.boxSizing = "border-box";
17910
+ s.className = `sc-resize-handle sc-resize-${e}`, s.dataset.handle = e, s.style.position = "absolute", s.style.backgroundColor = "white", s.style.border = "1px solid #0056b3", s.style.zIndex = "2", s.style.boxSizing = "border-box", s.style.display = "none";
17902
17911
  const i = "8px", n = "6px", r = "14px";
17903
17912
  switch (e) {
17904
17913
  // Corners
@@ -17933,12 +17942,25 @@ class fa {
17933
17942
  }
17934
17943
  addDeleteButton(t, e) {
17935
17944
  const s = document.createElement("div");
17936
- s.className = "sc-delete-btn", s.innerHTML = '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>', s.title = "Delete Field", s.style.position = "absolute", s.style.top = "0", s.style.right = "0", s.style.transform = "translate(50%, -50%)", s.style.width = "20px", s.style.height = "20px", s.style.borderRadius = "50%", s.style.backgroundColor = "#ff4d4f", s.style.color = "white", s.style.display = "flex", s.style.alignItems = "center", s.style.justifyContent = "center", s.style.cursor = "pointer", s.style.zIndex = "20", s.style.boxShadow = "0 2px 4px rgba(0,0,0,0.2)", s.style.opacity = "0", s.style.transition = "opacity 0.2s", t.addEventListener("mouseenter", () => s.style.opacity = "1"), t.addEventListener("mouseleave", () => s.style.opacity = "0"), s.addEventListener("click", (i) => {
17945
+ s.className = "sc-delete-btn", s.innerHTML = '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>', s.title = "Delete Field", s.style.position = "absolute", s.style.top = "0", s.style.right = "0", s.style.transform = "translate(50%, -50%)", s.style.width = "20px", s.style.height = "20px", s.style.borderRadius = "50%", s.style.backgroundColor = "#ff4d4f", s.style.color = "white", s.style.display = "flex", s.style.alignItems = "center", s.style.justifyContent = "center", s.style.cursor = "pointer", s.style.zIndex = "20", s.style.boxShadow = "0 2px 4px rgba(0,0,0,0.2)", s.style.display = "none", s.addEventListener("click", (i) => {
17937
17946
  i.preventDefault(), i.stopPropagation(), this.eventBus.emit("field:delete", { fieldId: e });
17938
17947
  }), s.addEventListener("touchstart", (i) => {
17939
17948
  i.preventDefault(), i.stopPropagation(), this.eventBus.emit("field:delete", { fieldId: e });
17940
17949
  }, { passive: !1 }), t.appendChild(s);
17941
17950
  }
17951
+ select(t) {
17952
+ this.selectedFieldId = t, this.fields.forEach((e) => {
17953
+ const s = this.fieldElements.get(e.id);
17954
+ if (!s) return;
17955
+ const i = e.id === t;
17956
+ this.updateVisuals(s, e, i, i);
17957
+ });
17958
+ }
17959
+ updateVisuals(t, e, s, i) {
17960
+ t.querySelectorAll(".sc-resize-handle").forEach((r) => r.style.display = s ? "block" : "none");
17961
+ const n = t.querySelector(".sc-delete-btn");
17962
+ n && (n.style.display = s ? "flex" : "none"), i ? (t.style.border = "1px solid #0056b3", t.style.backgroundColor = "rgba(0, 86, 179, 0.1)") : s ? (t.style.border = "1px solid #0056b3", t.style.backgroundColor = "rgba(0, 86, 179, 0.05)") : (t.style.border = e.style?.border || "1px solid #7FA1C3", t.style.backgroundColor = e.style?.backgroundColor || "rgba(127, 161, 195, 0.1)");
17963
+ }
17942
17964
  updatePositions() {
17943
17965
  this.pageHeight !== 0 && this.fields.forEach((t) => {
17944
17966
  const e = this.fieldElements.get(t.id);
@@ -17973,7 +17995,7 @@ class sn {
17973
17995
  eventBus;
17974
17996
  element;
17975
17997
  constructor(t) {
17976
- this.container = t.container, this.pageIndex = t.pageIndex, this.scale = t.scale, this.eventBus = t.eventBus, this.element = document.createElement("div"), this.element.className = "page-view", this.element.dataset.pageIndex = this.pageIndex.toString(), this.element.style.position = "relative", this.element.style.flexShrink = "0", this.element.style.boxShadow = "0 2px 8px rgba(0,0,0,0.15)", this.canvasLayer = new da(), this.element.appendChild(this.canvasLayer.getElement()), this.signatureLayer = new fa(this.eventBus), this.element.appendChild(this.signatureLayer.getElement()), t.pageDimensions && this.signatureLayer.setPageDimensions(
17998
+ this.container = t.container, this.pageIndex = t.pageIndex, this.scale = t.scale, this.eventBus = t.eventBus, this.element = document.createElement("div"), this.element.className = "page-view", this.element.dataset.pageIndex = this.pageIndex.toString(), this.element.style.position = "relative", this.element.style.flexShrink = "0", this.element.style.boxShadow = "0 2px 8px rgba(0,0,0,0.15)", this.element.style.margin = "0 auto", this.canvasLayer = new da(), this.element.appendChild(this.canvasLayer.getElement()), this.signatureLayer = new fa(this.eventBus), this.element.appendChild(this.signatureLayer.getElement()), t.pageDimensions && this.signatureLayer.setPageDimensions(
17977
17999
  t.pageDimensions.width,
17978
18000
  t.pageDimensions.height,
17979
18001
  this.scale
@@ -17987,6 +18009,9 @@ class sn {
17987
18009
  setFields(t) {
17988
18010
  this.signatureLayer.setFields(t);
17989
18011
  }
18012
+ selectField(t) {
18013
+ this.signatureLayer.select(t);
18014
+ }
17990
18015
  async render() {
17991
18016
  if (!this.pdfPage) return;
17992
18017
  const t = this.pdfPage.getViewport({ scale: this.scale });
@@ -18049,7 +18074,7 @@ class ma {
18049
18074
  this.container = t, this.pdfDocument = e, this.eventBus = s, this.totalPages = e.numPages, this.scale = i ?? 1, this.pageInfo = n ?? /* @__PURE__ */ new Map(), this.initContainer(), await this.renderCurrentPage();
18050
18075
  }
18051
18076
  initContainer() {
18052
- this.container.innerHTML = "", this.container.style.position = "relative", this.container.style.overflow = "auto", this.container.style.display = "flex", this.container.style.flexDirection = "column", this.container.style.alignItems = "center", this.container.style.padding = "20px", this.pageContainer = document.createElement("div"), this.pageContainer.className = "single-page-container", this.container.appendChild(this.pageContainer);
18077
+ this.container.innerHTML = "", this.container.style.position = "relative", this.container.style.overflow = "auto", this.container.style.display = "flex", this.container.style.flexDirection = "column", this.container.style.alignItems = "", this.container.style.padding = "20px", this.pageContainer = document.createElement("div"), this.pageContainer.className = "single-page-container", this.container.appendChild(this.pageContainer);
18053
18078
  }
18054
18079
  async renderCurrentPage() {
18055
18080
  this.pageView && (this.pageView.destroy(), this.pageView = null), this.pageContainer.innerHTML = "";
@@ -18087,7 +18112,10 @@ class ma {
18087
18112
  return this.totalPages;
18088
18113
  }
18089
18114
  setScale(t) {
18090
- this.scale = t, this.pageView && this.pageView.updateScalePreview(t), this.eventBus.emit("scale:change", { scale: t }), this.zoomTimeout && clearTimeout(this.zoomTimeout), this.zoomTimeout = setTimeout(() => {
18115
+ const e = this.scale, s = t, i = this.container, n = i.clientWidth, r = i.clientHeight, a = i.scrollLeft, o = i.scrollTop, h = a + n / 2, l = o + r / 2, d = s / e;
18116
+ this.scale = t, this.pageView && this.pageView.updateScalePreview(t), this.eventBus.emit("scale:change", { scale: t });
18117
+ const u = h * d - n / 2, p = l * d - r / 2;
18118
+ i.scrollLeft = u, i.scrollTop = p, this.zoomTimeout && clearTimeout(this.zoomTimeout), this.zoomTimeout = setTimeout(() => {
18091
18119
  this.pageView && this.pageView.updateScaleFull(t), this.zoomTimeout = null;
18092
18120
  }, 150);
18093
18121
  }
@@ -18100,6 +18128,9 @@ class ma {
18100
18128
  this.pageView.setFields(e);
18101
18129
  }
18102
18130
  }
18131
+ selectField(t) {
18132
+ this.pageView?.selectField(t);
18133
+ }
18103
18134
  destroy() {
18104
18135
  this.zoomTimeout && (clearTimeout(this.zoomTimeout), this.zoomTimeout = null), this.pageView && (this.pageView.destroy(), this.pageView = null), this.container.innerHTML = "";
18105
18136
  }
@@ -18121,7 +18152,7 @@ class ba {
18121
18152
  this.isDestroyed = !1, this.container = t, this.pdfDocument = e, this.eventBus = s, this.totalPages = e.numPages, this.scale = i ?? 1, this.pageInfo = n ?? /* @__PURE__ */ new Map(), this.initContainer(), await this.renderAllPages(), this.isDestroyed || this.setupIntersectionObserver();
18122
18153
  }
18123
18154
  initContainer() {
18124
- this.container.innerHTML = "", this.container.style.position = "relative", this.container.style.overflow = "auto", this.container.style.display = "flex", this.container.style.flexDirection = "column", this.container.style.gap = "20px", this.container.style.alignItems = "center", this.container.style.padding = "20px", this.container.scrollTop = 0;
18155
+ this.container.innerHTML = "", this.container.style.position = "relative", this.container.style.overflow = "auto", this.container.style.display = "flex", this.container.style.flexDirection = "column", this.container.style.gap = "20px", this.container.style.alignItems = "", this.container.style.padding = "20px", this.container.scrollTop = 0;
18125
18156
  }
18126
18157
  async renderAllPages() {
18127
18158
  this.pageViews.forEach((t) => t.destroy()), this.pageViews = [];
@@ -18197,8 +18228,28 @@ class ba {
18197
18228
  return this.totalPages;
18198
18229
  }
18199
18230
  setScale(t) {
18200
- this.scale = t, this.pageViews.forEach((e) => e.updateScalePreview(t)), this.eventBus.emit("scale:change", { scale: t }), this.zoomTimeout && clearTimeout(this.zoomTimeout), this.zoomTimeout = setTimeout(() => {
18201
- this.pageViews.forEach((e) => e.updateScaleFull(t)), this.zoomTimeout = null;
18231
+ const e = this.scale, s = this.container, i = s.clientHeight, n = s.scrollTop + i / 2;
18232
+ let r = -1, a = 0;
18233
+ for (let o = 0; o < this.pageViews.length; o++) {
18234
+ const h = this.pageViews[o], l = h.element.offsetTop, d = h.element.offsetHeight, u = l + d;
18235
+ if (n < u) {
18236
+ r = o, a = (n - l) / d;
18237
+ break;
18238
+ }
18239
+ }
18240
+ if (r === -1 && this.pageViews.length > 0) {
18241
+ r = this.pageViews.length - 1;
18242
+ const o = this.pageViews[r];
18243
+ a = (n - o.element.offsetTop) / o.element.offsetHeight;
18244
+ }
18245
+ if (this.scale = t, this.pageViews.forEach((o) => o.updateScalePreview(t)), this.eventBus.emit("scale:change", { scale: t }), r !== -1) {
18246
+ const o = this.pageViews[r], h = o.element.offsetTop, l = o.element.offsetHeight, d = h + a * l;
18247
+ s.scrollTop = d - i / 2;
18248
+ const u = s.clientWidth, p = s.scrollLeft + u / 2, f = t / e;
18249
+ s.scrollLeft = p * f - u / 2;
18250
+ }
18251
+ this.zoomTimeout && clearTimeout(this.zoomTimeout), this.zoomTimeout = setTimeout(() => {
18252
+ this.pageViews.forEach((o) => o.updateScaleFull(t)), this.zoomTimeout = null;
18202
18253
  }, 150);
18203
18254
  }
18204
18255
  getScale() {
@@ -18210,6 +18261,9 @@ class ba {
18210
18261
  e.setFields(s);
18211
18262
  });
18212
18263
  }
18264
+ selectField(t) {
18265
+ this.pageViews.forEach((e) => e.selectField(t));
18266
+ }
18213
18267
  destroy() {
18214
18268
  this.isDestroyed = !0, this.zoomTimeout && (clearTimeout(this.zoomTimeout), this.zoomTimeout = null), this.observer && (this.observer.disconnect(), this.observer = null), this.pageViews.forEach((t) => t.destroy()), this.pageViews = [], this.container.innerHTML = "";
18215
18269
  }
@@ -18226,6 +18280,7 @@ class ya {
18226
18280
  readyPromise = null;
18227
18281
  currentScale = 1;
18228
18282
  isDestroyed = !1;
18283
+ selectedFieldId = null;
18229
18284
  constructor(t) {
18230
18285
  this.container = t.container, this.eventBus = new cn(), this.loader = new ca(t.pdfLoaderOptions), this.currentViewMode = t.viewMode ?? "scroll", t.fields && (this.fields = [...t.fields]), this.zoomHandler = new dn({
18231
18286
  container: this.container,
@@ -18237,6 +18292,11 @@ class ya {
18237
18292
  this.handleFieldDrop(e.fieldId, e.clientX, e.clientY, e.elementX, e.elementY);
18238
18293
  }), this.eventBus.on("field:ui:resize", (e) => {
18239
18294
  this.updateField(e.fieldId, e.updates);
18295
+ }), this.eventBus.on("field:focus", (e) => {
18296
+ this.selectField(e.fieldId);
18297
+ }), this.container.addEventListener("mousedown", (e) => {
18298
+ const s = e.target;
18299
+ s.closest(".sc-signature-field") || s.closest(".sc-resize-handle") || s.closest(".sc-delete-btn") || this.selectField(null);
18240
18300
  });
18241
18301
  }
18242
18302
  async load(t) {
@@ -18263,7 +18323,7 @@ class ya {
18263
18323
  this.strategy.destroy();
18264
18324
  return;
18265
18325
  }
18266
- this.fields.length > 0 && this.strategy.setFields(this.fields);
18326
+ this.fields.length > 0 && this.strategy.setFields(this.fields), this.selectedFieldId && this.strategy.selectField(this.selectedFieldId);
18267
18327
  }
18268
18328
  }
18269
18329
  createStrategy(t) {
@@ -18332,7 +18392,7 @@ class ya {
18332
18392
  throw new Error("PDF document not loaded");
18333
18393
  if (!this.strategy)
18334
18394
  throw new Error("PDF viewer not ready. Please wait for PDF to fully load.");
18335
- if (this.readyPromise && await this.readyPromise, t.pageNumber < 1 || t.pageNumber > this.pdfDocument.numPages)
18395
+ if (this.readyPromise && await this.readyPromise, typeof t.pageNumber != "number" || isNaN(t.pageNumber) || t.pageNumber < 1 || t.pageNumber > this.pdfDocument.numPages)
18336
18396
  throw new Error(`Invalid page number: ${t.pageNumber}. Document has ${this.pdfDocument.numPages} pages.`);
18337
18397
  if (t.rect.width <= 0 || t.rect.height <= 0)
18338
18398
  throw new Error("Field width and height must be greater than 0");
@@ -18354,12 +18414,22 @@ class ya {
18354
18414
  this.fields.push(t), this.strategy?.setFields(this.fields), this.eventBus.emit("field:add", t), this.eventBus.emit("fields:change", this.fields);
18355
18415
  }
18356
18416
  removeField(t) {
18357
- this.fields = this.fields.filter((e) => e.id !== t), this.strategy?.setFields(this.fields), this.eventBus.emit("field:remove", { fieldId: t }), this.eventBus.emit("fields:change", this.fields);
18417
+ this.selectedFieldId === t && this.selectField(null), this.fields = this.fields.filter((e) => e.id !== t), this.strategy?.setFields(this.fields), this.eventBus.emit("field:remove", { fieldId: t }), this.eventBus.emit("fields:change", this.fields);
18358
18418
  }
18359
18419
  updateField(t, e) {
18360
18420
  const s = this.fields.findIndex((i) => i.id === t);
18361
18421
  s !== -1 && (this.fields[s] = { ...this.fields[s], ...e }, this.strategy?.setFields(this.fields), this.eventBus.emit("field:update", { fieldId: t, updates: e }), this.eventBus.emit("fields:change", this.fields));
18362
18422
  }
18423
+ selectField(t) {
18424
+ if (this.selectedFieldId === t)
18425
+ return;
18426
+ this.selectedFieldId = t, this.strategy?.selectField(t);
18427
+ let e = null;
18428
+ t && (e = this.fields.find((s) => String(s.id) === String(t)) || null, e || console.warn(`[PdfSignControl] Selection warning: Field with ID "${t}" not found in local state. Available IDs:`, this.fields.map((s) => s.id))), this.eventBus.emit("field:selection-change", { field: e });
18429
+ }
18430
+ clearFields() {
18431
+ this.selectField(null), this.fields = [], this.strategy?.setFields(this.fields), this.eventBus.emit("fields:change", this.fields);
18432
+ }
18363
18433
  handleFieldDrop(t, e, s, i, n) {
18364
18434
  const r = this.fields.find((v) => v.id === t);
18365
18435
  if (!r) return;
@@ -18565,6 +18635,9 @@ class wa {
18565
18635
  updateField(t, e) {
18566
18636
  this.viewer.updateField(t, e);
18567
18637
  }
18638
+ clearFields() {
18639
+ this.viewer.clearFields();
18640
+ }
18568
18641
  async print(t) {
18569
18642
  return this.viewer.print(t);
18570
18643
  }
@@ -18603,7 +18676,10 @@ const xa = on((c, t) => {
18603
18676
  updateField: (n, r) => {
18604
18677
  s.current?.updateField(n, r);
18605
18678
  },
18606
- getFields: () => s.current?.getFields() ?? []
18679
+ getFields: () => s.current?.getFields() ?? [],
18680
+ clearFields: () => {
18681
+ s.current?.clearFields();
18682
+ }
18607
18683
  }));
18608
18684
  const i = rs(c);
18609
18685
  return Vt(() => {
@@ -18619,7 +18695,7 @@ const xa = on((c, t) => {
18619
18695
  i.current.onPageChange?.(n.page, n.total);
18620
18696
  }), s.current.on("scale:change", (n) => {
18621
18697
  i.current.onScaleChange?.(n.scale);
18622
- }), s.current.on("field:add", (n) => i.current.onFieldAdd?.(n)), s.current.on("field:remove", (n) => i.current.onFieldRemove?.(n)), s.current.on("field:update", (n) => i.current.onFieldUpdate?.(n)), s.current.on("fields:change", (n) => i.current.onFieldsChange?.(n)), c.onReady && c.onReady(s.current), () => {
18698
+ }), s.current.on("field:add", (n) => i.current.onFieldAdd?.(n)), s.current.on("field:remove", (n) => i.current.onFieldRemove?.(n)), s.current.on("field:update", (n) => i.current.onFieldUpdate?.(n)), s.current.on("fields:change", (n) => i.current.onFieldsChange?.(n)), s.current.on("field:selection-change", (n) => i.current.onSelectionChange?.(n)), c.onReady && c.onReady(s.current), () => {
18623
18699
  s.current?.destroy(), s.current = null;
18624
18700
  };
18625
18701
  }, []), Vt(() => {