@shznet/pdf-sign-standalone 0.2.3 → 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.
Files changed (2) hide show
  1. package/dist/index.js +392 -319
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var yi = (d) => {
2
2
  throw TypeError(d);
3
- }, Ps = (d, t, e) => t.has(d) || yi("Cannot " + e), Y = (d, t, e) => (Ps(d, t, "read from private field"), e ? e.call(d) : t.get(d)), Ft = (d, t, e) => t.has(d) ? yi("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(d) : t.set(d, e), mt = (d, t, e, s) => (Ps(d, t, "write to private field"), t.set(d, e), e), Rt = (d, t, e) => (Ps(d, t, "access private method"), e), nn = (d, t, e, s) => ({
3
+ }, Ms = (d, t, e) => t.has(d) || yi("Cannot " + e), Y = (d, t, e) => (Ms(d, t, "read from private field"), e ? e.call(d) : t.get(d)), Ft = (d, t, e) => t.has(d) ? yi("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(d) : t.set(d, e), mt = (d, t, e, s) => (Ms(d, t, "write to private field"), t.set(d, e), e), Rt = (d, t, e) => (Ms(d, t, "access private method"), e), nn = (d, t, e, s) => ({
4
4
  set _(i) {
5
5
  mt(d, t, i);
6
6
  },
@@ -114,7 +114,7 @@ const dt = typeof process == "object" && process + "" == "[object process]" && !
114
114
  ANNOTATIONS_DISABLE: 64,
115
115
  IS_EDITING: 128,
116
116
  OPLIST: 256
117
- }, Bt = {
117
+ }, Ot = {
118
118
  DISABLE: 0,
119
119
  ENABLE: 1,
120
120
  ENABLE_FORMS: 2,
@@ -129,7 +129,7 @@ const dt = typeof process == "object" && process + "" == "[object process]" && !
129
129
  POPUP: 16,
130
130
  SIGNATURE: 101,
131
131
  COMMENT: 102
132
- }, O = {
132
+ }, B = {
133
133
  RESIZE: 1,
134
134
  CREATE: 2,
135
135
  FREETEXT_SIZE: 11,
@@ -321,7 +321,7 @@ function R(d) {
321
321
  function j(d) {
322
322
  throw new Error(d);
323
323
  }
324
- function B(d, t) {
324
+ function O(d, t) {
325
325
  d || j(t);
326
326
  }
327
327
  function dn(d) {
@@ -802,7 +802,7 @@ class le {
802
802
  static PDF = 72;
803
803
  static PDF_TO_CSS_UNITS = this.CSS / this.PDF;
804
804
  }
805
- async function Me(d, t = "text") {
805
+ async function Pe(d, t = "text") {
806
806
  if (ye(d, document.baseURI)) {
807
807
  const e = await fetch(d);
808
808
  if (!e.ok)
@@ -837,7 +837,7 @@ async function Me(d, t = "text") {
837
837
  }, i.send(null);
838
838
  });
839
839
  }
840
- class Pe {
840
+ class Me {
841
841
  constructor({
842
842
  viewBox: t,
843
843
  userUnit: e,
@@ -886,7 +886,7 @@ class Pe {
886
886
  offsetY: i = this.offsetY,
887
887
  dontFlip: n = !1
888
888
  } = {}) {
889
- return new Pe({
889
+ return new Me({
890
890
  viewBox: this.viewBox.slice(),
891
891
  userUnit: this.userUnit,
892
892
  scale: t,
@@ -1062,7 +1062,7 @@ function _n(d, {
1062
1062
  width: s,
1063
1063
  height: i
1064
1064
  } = d.attributes.style, n = [0, 0, parseInt(s), parseInt(i)];
1065
- return new Pe({
1065
+ return new Me({
1066
1066
  viewBox: n,
1067
1067
  userUnit: 1,
1068
1068
  scale: t,
@@ -1109,7 +1109,7 @@ function St(d) {
1109
1109
  return [t, e, s, i, n, r];
1110
1110
  }
1111
1111
  function jt(d, t, e = !1, s = !0) {
1112
- if (t instanceof Pe) {
1112
+ if (t instanceof Me) {
1113
1113
  const {
1114
1114
  pageWidth: i,
1115
1115
  pageHeight: n
@@ -1230,7 +1230,7 @@ function Qs(d, t, e) {
1230
1230
  return s > i ? (s + 0.05) / (i + 0.05) : (i + 0.05) / (s + 0.05);
1231
1231
  }
1232
1232
  const Js = /* @__PURE__ */ new Map();
1233
- function Mn(d, t) {
1233
+ function Pn(d, t) {
1234
1234
  const e = d[0] + d[1] * 256 + d[2] * 65536 + t[0] * 16777216 + t[1] * 4294967296 + t[2] * 1099511627776;
1235
1235
  let s = Js.get(e);
1236
1236
  if (s)
@@ -1446,7 +1446,7 @@ class Ae {
1446
1446
  this.#t.remove(), this.#e?.destroy(), this.#e = null;
1447
1447
  }
1448
1448
  }
1449
- class Pn {
1449
+ class Mn {
1450
1450
  #t = null;
1451
1451
  #e = null;
1452
1452
  #i;
@@ -1583,7 +1583,7 @@ class Is {
1583
1583
  isSvg: !1
1584
1584
  };
1585
1585
  let i;
1586
- if (typeof e == "string" ? (s.url = e, i = await Me(e, "blob")) : e instanceof File ? i = s.file = e : e instanceof Blob && (i = e), i.type === "image/svg+xml") {
1586
+ if (typeof e == "string" ? (s.url = e, i = await Pe(e, "blob")) : e instanceof File ? i = s.file = e : e instanceof Blob && (i = e), i.type === "image/svg+xml") {
1587
1587
  const n = Is._isSVGFittingCanvas, r = new FileReader(), a = new Image(), o = new Promise((h, l) => {
1588
1588
  a.onload = () => {
1589
1589
  s.bitmap = a, s.isSvg = !0, h();
@@ -1834,12 +1834,12 @@ class zt {
1834
1834
  #v = !1;
1835
1835
  #E = null;
1836
1836
  #k = new kn();
1837
- #M = !1;
1838
1837
  #P = !1;
1839
- #O = !1;
1838
+ #M = !1;
1839
+ #B = !1;
1840
1840
  #I = null;
1841
1841
  #L = null;
1842
- #B = null;
1842
+ #O = null;
1843
1843
  #F = null;
1844
1844
  #G = null;
1845
1845
  #C = F.NONE;
@@ -1934,12 +1934,12 @@ class zt {
1934
1934
  }), a._on("switchannotationeditorparams", (w) => this.updateParams(w.type, w.value), {
1935
1935
  signal: m
1936
1936
  }), window.addEventListener("pointerdown", () => {
1937
- this.#P = !0;
1937
+ this.#M = !0;
1938
1938
  }, {
1939
1939
  capture: !0,
1940
1940
  signal: m
1941
1941
  }), window.addEventListener("pointerup", () => {
1942
- this.#P = !1;
1942
+ this.#M = !1;
1943
1943
  }, {
1944
1944
  capture: !0,
1945
1945
  signal: m
@@ -1952,7 +1952,7 @@ class zt {
1952
1952
  this.#$?.resolve(), this.#$ = null, this.#t?.abort(), this.#t = null, this._signal = null;
1953
1953
  for (const t of this.#a.values())
1954
1954
  t.destroy();
1955
- 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;
1955
+ 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;
1956
1956
  }
1957
1957
  combinedSignal(t) {
1958
1958
  return AbortSignal.any([this._signal, t.signal]);
@@ -2008,7 +2008,7 @@ class zt {
2008
2008
  t ? (this.unselectAll(), this.disableUserSelect(!0)) : this.disableUserSelect(!1), this.#d = t;
2009
2009
  }
2010
2010
  setMainHighlightColorPicker(t) {
2011
- this.#B = t;
2011
+ this.#O = t;
2012
2012
  }
2013
2013
  editAltText(t, e = !1) {
2014
2014
  this.#r?.editAltText(this, t, e);
@@ -2183,7 +2183,7 @@ class zt {
2183
2183
  if (!t || t.isCollapsed)
2184
2184
  return;
2185
2185
  const e = this.#Q(t).closest(".textLayer"), s = this.getSelectionBoxes(e);
2186
- s && (this.#E ||= new Pn(this), this.#E.show(e, s, this.direction === "ltr"));
2186
+ s && (this.#E ||= new Mn(this), this.#E.show(e, s, this.direction === "ltr"));
2187
2187
  }
2188
2188
  getAndRemoveDataFromAnnotationStorage(t) {
2189
2189
  if (!this.#n)
@@ -2222,7 +2222,7 @@ class zt {
2222
2222
  hasSelectedText: !0
2223
2223
  }), !(this.#C !== F.HIGHLIGHT && this.#C !== F.NONE) && (this.#C === F.HIGHLIGHT && this.showAllEditors("highlight", !0, !0), this.#v = this.isShiftKeyDown, !this.isShiftKeyDown)) {
2224
2224
  const i = this.#C === F.HIGHLIGHT ? this.#tt(s) : null;
2225
- if (i?.toggleDrawing(), this.#P) {
2225
+ if (i?.toggleDrawing(), this.#M) {
2226
2226
  const n = new AbortController(), r = this.combinedSignal(n), a = (o) => {
2227
2227
  o.type === "pointerup" && o.button !== 0 || (n.abort(), i?.toggleDrawing(!0), o.type === "pointerup" && this.#Y("main_toolbar"));
2228
2228
  };
@@ -2432,7 +2432,7 @@ class zt {
2432
2432
  Object.entries(t).some(([e, s]) => this.#X[e] !== s) && (this._eventBus.dispatch("annotationeditorstateschanged", {
2433
2433
  source: this,
2434
2434
  details: Object.assign(this.#X, t)
2435
- }), this.#C === F.HIGHLIGHT && t.hasSelectedEditor === !1 && this.#V([[O.HIGHLIGHT_FREE, !0]]));
2435
+ }), this.#C === F.HIGHLIGHT && t.hasSelectedEditor === !1 && this.#V([[B.HIGHLIGHT_FREE, !0]]));
2436
2436
  }
2437
2437
  #V(t) {
2438
2438
  this._eventBus.dispatch("annotationeditorparamschanged", {
@@ -2471,7 +2471,7 @@ class zt {
2471
2471
  return this.#p;
2472
2472
  }
2473
2473
  addLayer(t) {
2474
- this.#a.set(t.pageIndex, t), this.#M ? t.enable() : t.disable();
2474
+ this.#a.set(t.pageIndex, t), this.#P ? t.enable() : t.disable();
2475
2475
  }
2476
2476
  removeLayer(t) {
2477
2477
  this.#a.delete(t.pageIndex);
@@ -2532,10 +2532,10 @@ class zt {
2532
2532
  updateParams(t, e) {
2533
2533
  if (this.#c) {
2534
2534
  switch (t) {
2535
- case O.CREATE:
2535
+ case B.CREATE:
2536
2536
  this.currentLayer.addNewEditor(e);
2537
2537
  return;
2538
- case O.HIGHLIGHT_SHOW_ALL:
2538
+ case B.HIGHLIGHT_SHOW_ALL:
2539
2539
  this._eventBus.dispatch("reporttelemetry", {
2540
2540
  source: this,
2541
2541
  details: {
@@ -2559,18 +2559,18 @@ class zt {
2559
2559
  showAllEditors(t, e, s = !1) {
2560
2560
  for (const i of this.#s.values())
2561
2561
  i.editorType === t && i.show(e);
2562
- (this.#q?.get(O.HIGHLIGHT_SHOW_ALL) ?? !0) !== e && this.#V([[O.HIGHLIGHT_SHOW_ALL, e]]);
2562
+ (this.#q?.get(B.HIGHLIGHT_SHOW_ALL) ?? !0) !== e && this.#V([[B.HIGHLIGHT_SHOW_ALL, e]]);
2563
2563
  }
2564
2564
  enableWaiting(t = !1) {
2565
- if (this.#O !== t) {
2566
- this.#O = t;
2565
+ if (this.#B !== t) {
2566
+ this.#B = t;
2567
2567
  for (const e of this.#a.values())
2568
2568
  t ? e.disableClick() : e.enableClick(), e.div.classList.toggle("waiting", t);
2569
2569
  }
2570
2570
  }
2571
2571
  async #pt() {
2572
- if (!this.#M) {
2573
- this.#M = !0;
2572
+ if (!this.#P) {
2573
+ this.#P = !0;
2574
2574
  const t = [];
2575
2575
  for (const e of this.#a.values())
2576
2576
  t.push(e.enable());
@@ -2580,8 +2580,8 @@ class zt {
2580
2580
  }
2581
2581
  }
2582
2582
  #gt() {
2583
- if (this.unselectAll(), this.#M) {
2584
- this.#M = !1;
2583
+ if (this.unselectAll(), this.#P) {
2584
+ this.#P = !1;
2585
2585
  for (const t of this.#a.values())
2586
2586
  t.disable();
2587
2587
  for (const t of this.#s.values())
@@ -2945,7 +2945,7 @@ class zt {
2945
2945
  (this.#F ||= /* @__PURE__ */ new Map()).set(t, e);
2946
2946
  }
2947
2947
  }
2948
- class Mt {
2948
+ class Pt {
2949
2949
  #t = null;
2950
2950
  #e = !1;
2951
2951
  #i = null;
@@ -2961,7 +2961,7 @@ class Mt {
2961
2961
  static #p = null;
2962
2962
  static _l10n = null;
2963
2963
  constructor(t) {
2964
- this.#l = t, this.#d = t._uiManager.useNewAltTextFlow, Mt.#p ||= Object.freeze({
2964
+ this.#l = t, this.#d = t._uiManager.useNewAltTextFlow, Pt.#p ||= Object.freeze({
2965
2965
  added: "pdfjs-editor-new-alt-text-added-button",
2966
2966
  "added-label": "pdfjs-editor-new-alt-text-added-button-label",
2967
2967
  missing: "pdfjs-editor-new-alt-text-missing-button",
@@ -2971,13 +2971,13 @@ class Mt {
2971
2971
  });
2972
2972
  }
2973
2973
  static initialize(t) {
2974
- Mt._l10n ??= t;
2974
+ Pt._l10n ??= t;
2975
2975
  }
2976
2976
  async render() {
2977
2977
  const t = this.#i = document.createElement("button");
2978
2978
  t.className = "altText", t.tabIndex = "0";
2979
2979
  const e = this.#s = document.createElement("span");
2980
- t.append(e), this.#d ? (t.classList.add("new"), t.setAttribute("data-l10n-id", Mt.#p.missing), e.setAttribute("data-l10n-id", Mt.#p["missing-label"])) : (t.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-button"), e.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-button-label"));
2980
+ t.append(e), this.#d ? (t.classList.add("new"), t.setAttribute("data-l10n-id", Pt.#p.missing), e.setAttribute("data-l10n-id", Pt.#p["missing-label"])) : (t.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-button"), e.setAttribute("data-l10n-id", "pdfjs-editor-alt-text-button-label"));
2981
2981
  const s = this.#l._uiManager._signal;
2982
2982
  t.addEventListener("contextmenu", _t, {
2983
2983
  signal: s
@@ -3019,7 +3019,7 @@ class Mt {
3019
3019
  return this.#h;
3020
3020
  }
3021
3021
  async setGuessedText(t) {
3022
- this.#t === null && (this.#h = t, this.#u = await Mt._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer", {
3022
+ this.#t === null && (this.#h = t, this.#u = await Pt._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer", {
3023
3023
  generatedAltText: t
3024
3024
  }), this.#f());
3025
3025
  }
@@ -3077,7 +3077,7 @@ class Mt {
3077
3077
  if (!t)
3078
3078
  return;
3079
3079
  if (this.#d) {
3080
- if (t.classList.toggle("done", !!this.#t), t.setAttribute("data-l10n-id", Mt.#p[this.#m]), this.#s?.setAttribute("data-l10n-id", Mt.#p[`${this.#m}-label`]), !this.#t) {
3080
+ if (t.classList.toggle("done", !!this.#t), t.setAttribute("data-l10n-id", Pt.#p[this.#m]), this.#s?.setAttribute("data-l10n-id", Pt.#p[`${this.#m}-label`]), !this.#t) {
3081
3081
  this.#a?.remove();
3082
3082
  return;
3083
3083
  }
@@ -3701,7 +3701,7 @@ class D {
3701
3701
  const [h, l] = this.getBaseTranslation();
3702
3702
  n += h, r += l, e.left = `${(100 * n).toFixed(2)}%`, e.top = `${(100 * r).toFixed(2)}%`, this.moveInDOM();
3703
3703
  }
3704
- static #M(t, e, s) {
3704
+ static #P(t, e, s) {
3705
3705
  switch (s) {
3706
3706
  case 90:
3707
3707
  return [e, -t];
@@ -3714,12 +3714,12 @@ class D {
3714
3714
  }
3715
3715
  }
3716
3716
  screenToPageTranslation(t, e) {
3717
- return D.#M(t, e, this.parentRotation);
3717
+ return D.#P(t, e, this.parentRotation);
3718
3718
  }
3719
3719
  pageTranslationToScreen(t, e) {
3720
- return D.#M(t, e, 360 - this.parentRotation);
3720
+ return D.#P(t, e, 360 - this.parentRotation);
3721
3721
  }
3722
- #P(t) {
3722
+ #M(t) {
3723
3723
  switch (t) {
3724
3724
  case 90: {
3725
3725
  const [e, s] = this.pageDimensions;
@@ -3761,7 +3761,7 @@ class D {
3761
3761
  getInitialTranslation() {
3762
3762
  return [0, 0];
3763
3763
  }
3764
- #O() {
3764
+ #B() {
3765
3765
  if (this.#l)
3766
3766
  return;
3767
3767
  this.#l = document.createElement("div"), this.#l.classList.add("resizers");
@@ -3805,7 +3805,7 @@ class D {
3805
3805
  const a = this.parent.div.style.cursor, o = this.div.style.cursor;
3806
3806
  this.div.style.cursor = this.parent.div.style.cursor = window.getComputedStyle(e.target).cursor;
3807
3807
  const h = () => {
3808
- 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();
3808
+ 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();
3809
3809
  };
3810
3810
  window.addEventListener("pointerup", h, {
3811
3811
  signal: r
@@ -3818,7 +3818,7 @@ class D {
3818
3818
  }
3819
3819
  _onResized() {
3820
3820
  }
3821
- #B() {
3821
+ #O() {
3822
3822
  if (!this.#u)
3823
3823
  return;
3824
3824
  const {
@@ -3839,7 +3839,7 @@ class D {
3839
3839
  return Math.round(t * 1e4) / 1e4;
3840
3840
  }
3841
3841
  #F(t, e) {
3842
- 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, c = this.#P(this.rotation), u = (k, I) => [c[0] * k + c[2] * I, c[1] * k + c[3] * I], p = this.#P(360 - this.rotation), f = (k, I) => [p[0] * k + p[2] * I, p[1] * k + p[3] * I];
3842
+ 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, c = this.#M(this.rotation), u = (k, I) => [c[0] * k + c[2] * I, c[1] * k + c[3] * I], p = this.#M(360 - this.rotation), f = (k, I) => [p[0] * k + p[2] * I, p[1] * k + p[3] * I];
3843
3843
  let g, b, m = !1, w = !1;
3844
3844
  switch (t) {
3845
3845
  case "topLeft":
@@ -3870,10 +3870,10 @@ class D {
3870
3870
  const y = g(a, o), v = b(a, o);
3871
3871
  let A = u(...v);
3872
3872
  const x = D._round(n + A[0]), _ = D._round(r + A[1]);
3873
- let E = 1, S = 1, P, C;
3873
+ let E = 1, S = 1, M, C;
3874
3874
  if (e.fromKeyboard)
3875
3875
  ({
3876
- deltaX: P,
3876
+ deltaX: M,
3877
3877
  deltaY: C
3878
3878
  } = e);
3879
3879
  else {
@@ -3881,12 +3881,12 @@ class D {
3881
3881
  screenX: k,
3882
3882
  screenY: I
3883
3883
  } = e, [U, ft] = this.#h;
3884
- [P, C] = this.screenToPageTranslation(k - U, I - ft), this.#h[0] = k, this.#h[1] = I;
3884
+ [M, C] = this.screenToPageTranslation(k - U, I - ft), this.#h[0] = k, this.#h[1] = I;
3885
3885
  }
3886
- if ([P, C] = f(P / s, C / i), m) {
3886
+ if ([M, C] = f(M / s, C / i), m) {
3887
3887
  const k = Math.hypot(a, o);
3888
- E = S = Math.max(Math.min(Math.hypot(v[0] - y[0] - P, v[1] - y[1] - C) / k, 1 / a, 1 / o), h / a, l / o);
3889
- } else w ? E = ut(Math.abs(v[0] - y[0] - P), h, 1) / a : S = ut(Math.abs(v[1] - y[1] - C), l, 1) / o;
3888
+ E = S = Math.max(Math.min(Math.hypot(v[0] - y[0] - M, v[1] - y[1] - C) / k, 1 / a, 1 / o), h / a, l / o);
3889
+ } else w ? E = ut(Math.abs(v[0] - y[0] - M), h, 1) / a : S = ut(Math.abs(v[1] - y[1] - C), l, 1) / o;
3890
3890
  const H = D._round(a * E), V = D._round(o * S);
3891
3891
  A = u(...b(H, V));
3892
3892
  const N = x - A[0], Z = _ - A[1];
@@ -3929,7 +3929,7 @@ class D {
3929
3929
  return this.div.getBoundingClientRect();
3930
3930
  }
3931
3931
  createAltText() {
3932
- return this.#i || (Mt.initialize(D._l10n), this.#i = new Mt(this), this.#t && (this.#i.data = this.#t, this.#t = null)), this.#i;
3932
+ return this.#i || (Pt.initialize(D._l10n), this.#i = new Pt(this), this.#t && (this.#i.data = this.#t, this.#t = null)), this.#i;
3933
3933
  }
3934
3934
  get altTextData() {
3935
3935
  return this.#i?.data;
@@ -4070,7 +4070,7 @@ class D {
4070
4070
  let i = 0.7 * (s / e) + 1 - 0.7;
4071
4071
  if (i === 1)
4072
4072
  return;
4073
- const n = this.#P(this.rotation), r = (A, x) => [n[0] * A + n[2] * x, n[1] * A + n[3] * x], [a, o] = this.parentDimensions, h = this.x, l = this.y, c = this.width, u = this.height, p = D.MIN_SIZE / a, f = D.MIN_SIZE / o;
4073
+ const n = this.#M(this.rotation), r = (A, x) => [n[0] * A + n[2] * x, n[1] * A + n[3] * x], [a, o] = this.parentDimensions, h = this.x, l = this.y, c = this.width, u = this.height, p = D.MIN_SIZE / a, f = D.MIN_SIZE / o;
4074
4074
  i = Math.max(Math.min(i, 1 / c, 1 / u), p / c, f / u);
4075
4075
  const g = D._round(c * i), b = D._round(u * i);
4076
4076
  if (g === c && b === u)
@@ -4080,7 +4080,7 @@ class D {
4080
4080
  this.x = w - v[0], this.y = y - v[1], this.width = g, this.height = b, this.setDims(), this.fixAndSetPosition(), this._onResizing();
4081
4081
  }
4082
4082
  #x() {
4083
- this.#i?.toggle(!0), this.parent.togglePointerEvents(!0), this.#B();
4083
+ this.#i?.toggle(!0), this.parent.togglePointerEvents(!0), this.#O();
4084
4084
  }
4085
4085
  pointerdown(t) {
4086
4086
  const {
@@ -4321,7 +4321,7 @@ class D {
4321
4321
  return !1;
4322
4322
  }
4323
4323
  makeResizable() {
4324
- this.isResizable && (this.#O(), this.#l.classList.remove("hidden"));
4324
+ this.isResizable && (this.#B(), this.#l.classList.remove("hidden"));
4325
4325
  }
4326
4326
  get toolbarPosition() {
4327
4327
  return null;
@@ -4427,7 +4427,7 @@ class D {
4427
4427
  });
4428
4428
  }
4429
4429
  #N() {
4430
- this.#w = !1, this.#U(-1), this.#B();
4430
+ this.#w = !1, this.#U(-1), this.#O();
4431
4431
  }
4432
4432
  _stopResizingWithKeyboard() {
4433
4433
  this.#N(), this.div.focus();
@@ -4573,7 +4573,7 @@ class In extends D {
4573
4573
  }
4574
4574
  }
4575
4575
  const Zs = 3285377520, vt = 4294901760, Ct = 65535;
4576
- class Mi {
4576
+ class Pi {
4577
4577
  constructor(t) {
4578
4578
  this.h1 = t ? t & 4294967295 : Zs, this.h2 = t ? t & 4294967295 : Zs;
4579
4579
  }
@@ -4661,12 +4661,12 @@ class Ls {
4661
4661
  this.#t && (this.#t = !1, typeof this.onResetModified == "function" && this.onResetModified());
4662
4662
  }
4663
4663
  get print() {
4664
- return new Pi(this);
4664
+ return new Mi(this);
4665
4665
  }
4666
4666
  get serializable() {
4667
4667
  if (this.#s.size === 0)
4668
4668
  return vs;
4669
- const t = /* @__PURE__ */ new Map(), e = new Mi(), s = [], i = /* @__PURE__ */ Object.create(null);
4669
+ const t = /* @__PURE__ */ new Map(), e = new Pi(), s = [], i = /* @__PURE__ */ Object.create(null);
4670
4670
  let n = !1;
4671
4671
  for (const [r, a] of this.#s) {
4672
4672
  const o = a instanceof D ? a.serialize(!1, i) : a;
@@ -4743,7 +4743,7 @@ class Ls {
4743
4743
  return this.#s.entries();
4744
4744
  }
4745
4745
  }
4746
- class Pi extends Ls {
4746
+ class Mi extends Ls {
4747
4747
  #t;
4748
4748
  constructor(t) {
4749
4749
  super();
@@ -4803,7 +4803,7 @@ class Rn {
4803
4803
  _inspectFont: s
4804
4804
  }) {
4805
4805
  if (!(!t || this.#t.has(t.loadedName))) {
4806
- if (B(!e, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
4806
+ if (O(!e, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
4807
4807
  const {
4808
4808
  loadedName: i,
4809
4809
  src: n,
@@ -4858,7 +4858,7 @@ class Rn {
4858
4858
  }
4859
4859
  _queueLoadingCallback(t) {
4860
4860
  function e() {
4861
- for (B(!i.done, "completeRequest() cannot be called twice."), i.done = !0; s.length > 0 && s[0].done; ) {
4861
+ for (O(!i.done, "completeRequest() cannot be called twice."), i.done = !0; s.length > 0 && s[0].done; ) {
4862
4862
  const n = s.shift();
4863
4863
  setTimeout(n.callback, 0);
4864
4864
  }
@@ -5063,13 +5063,13 @@ class re {
5063
5063
  const l = s[h], c = l.length;
5064
5064
  a.setUint32(o, c), r.set(l, o + 4), o += 4 + c;
5065
5065
  }
5066
- return B(o === n.byteLength, "CssFontInfo.write: Buffer overflow"), n;
5066
+ return O(o === n.byteLength, "CssFontInfo.write: Buffer overflow"), n;
5067
5067
  }
5068
5068
  constructor(t) {
5069
5069
  this.#t = t, this.#e = new DataView(this.#t), this.#i = new TextDecoder();
5070
5070
  }
5071
5071
  #s(t) {
5072
- B(t < re.strings.length, "Invalid string index");
5072
+ O(t < re.strings.length, "Invalid string index");
5073
5073
  let e = 0;
5074
5074
  for (let i = 0; i < t; i++)
5075
5075
  e += this.#e.getUint32(e) + 4;
@@ -5108,7 +5108,7 @@ class ae {
5108
5108
  const p = s[u], f = p.length;
5109
5109
  i += 4 + f, l.setUint32(c, f), h.set(p, c + 4), c += 4 + f;
5110
5110
  }
5111
- return l.setUint32(c - i - 4, i), t.style && (l.setUint32(c, n.length), h.set(n, c + 4), c += 4 + n.length, l.setUint32(c, r.length), h.set(r, c + 4), c += 4 + r.length), B(c <= o.byteLength, "SubstitionInfo.write: Buffer overflow"), o.transferToFixedLength(c);
5111
+ return l.setUint32(c - i - 4, i), t.style && (l.setUint32(c, n.length), h.set(n, c + 4), c += 4 + n.length, l.setUint32(c, r.length), h.set(r, c + 4), c += 4 + r.length), O(c <= o.byteLength, "SubstitionInfo.write: Buffer overflow"), o.transferToFixedLength(c);
5112
5112
  }
5113
5113
  constructor(t) {
5114
5114
  this.#t = t, this.#e = new DataView(this.#t), this.#i = new TextDecoder();
@@ -5117,7 +5117,7 @@ class ae {
5117
5117
  return this.#e.getUint8(0) !== 0;
5118
5118
  }
5119
5119
  #s(t) {
5120
- B(t < ae.strings.length, "Invalid string index");
5120
+ O(t < ae.strings.length, "Invalid string index");
5121
5121
  let e = 5;
5122
5122
  for (let i = 0; i < t; i++)
5123
5123
  e += this.#e.getUint32(e) + 4;
@@ -5167,7 +5167,7 @@ class G {
5167
5167
  this.#r = t, this.#n = new TextDecoder(), this.#o = new DataView(this.#r), e && Object.assign(this, e);
5168
5168
  }
5169
5169
  #l(t) {
5170
- B(t < G.bools.length, "Invalid boolean index");
5170
+ O(t < G.bools.length, "Invalid boolean index");
5171
5171
  const e = Math.floor(t / 4), s = t * 2 % 8, i = this.#o.getUint8(e) >> s & 3;
5172
5172
  return i === 0 ? void 0 : i === 2;
5173
5173
  }
@@ -5202,7 +5202,7 @@ class G {
5202
5202
  return this.#l(9);
5203
5203
  }
5204
5204
  #h(t) {
5205
- return B(t < G.numbers.length, "Invalid number index"), this.#o.getFloat64(G.#t + t * 8);
5205
+ return O(t < G.numbers.length, "Invalid number index"), this.#o.getFloat64(G.#t + t * 8);
5206
5206
  }
5207
5207
  get ascent() {
5208
5208
  return this.#h(0);
@@ -5244,7 +5244,7 @@ class G {
5244
5244
  return e;
5245
5245
  }
5246
5246
  #u(t) {
5247
- B(t < G.strings.length, "Invalid string index");
5247
+ O(t < G.strings.length, "Invalid string index");
5248
5248
  let e = G.#a + 4;
5249
5249
  for (let n = 0; n < t; n++)
5250
5250
  e += this.#o.getUint32(e) + 4;
@@ -5321,28 +5321,28 @@ class G {
5321
5321
  const b = t[G.bools[g]];
5322
5322
  p |= (b === void 0 ? 0 : b ? 2 : 1) << f, f += 2, (f === 8 || g === u - 1) && (l.setUint8(c++, p), p = 0, f = 0);
5323
5323
  }
5324
- B(c === G.#t, "FontInfo.write: Boolean properties offset mismatch");
5324
+ O(c === G.#t, "FontInfo.write: Boolean properties offset mismatch");
5325
5325
  for (const g of G.numbers)
5326
5326
  l.setFloat64(c, t[g]), c += 8;
5327
- if (B(c === G.#e, "FontInfo.write: Number properties offset mismatch"), t.bbox) {
5327
+ if (O(c === G.#e, "FontInfo.write: Number properties offset mismatch"), t.bbox) {
5328
5328
  l.setUint8(c++, 4);
5329
5329
  for (const g of t.bbox)
5330
5330
  l.setInt16(c, g, !0), c += 2;
5331
5331
  } else
5332
5332
  l.setUint8(c++, 0), c += 8;
5333
- if (B(c === G.#i, "FontInfo.write: BBox properties offset mismatch"), t.fontMatrix) {
5333
+ if (O(c === G.#i, "FontInfo.write: BBox properties offset mismatch"), t.fontMatrix) {
5334
5334
  l.setUint8(c++, 6);
5335
5335
  for (const g of t.fontMatrix)
5336
5336
  l.setFloat64(c, g, !0), c += 8;
5337
5337
  } else
5338
5338
  l.setUint8(c++, 0), c += 48;
5339
- if (B(c === G.#s, "FontInfo.write: FontMatrix properties offset mismatch"), t.defaultVMetrics) {
5339
+ if (O(c === G.#s, "FontInfo.write: FontMatrix properties offset mismatch"), t.defaultVMetrics) {
5340
5340
  l.setUint8(c++, 1);
5341
5341
  for (const g of t.defaultVMetrics)
5342
5342
  l.setInt16(c, g, !0), c += 2;
5343
5343
  } else
5344
5344
  l.setUint8(c++, 0), c += 6;
5345
- B(c === G.#a, "FontInfo.write: DefaultVMetrics properties offset mismatch"), l.setUint32(G.#a, 0), c += 4;
5345
+ O(c === G.#a, "FontInfo.write: DefaultVMetrics properties offset mismatch"), l.setUint32(G.#a, 0), c += 4;
5346
5346
  for (const g of G.strings) {
5347
5347
  const b = n[g], m = b.length;
5348
5348
  l.setUint32(c, m), h.set(b, c + 4), c += 4 + m;
@@ -5351,15 +5351,15 @@ class G {
5351
5351
  l.setUint32(c, 0), c += 4;
5352
5352
  else {
5353
5353
  const g = e.byteLength;
5354
- l.setUint32(c, g), B(c + 4 + g <= o.byteLength, "FontInfo.write: Buffer overflow at systemFontInfo"), h.set(new Uint8Array(e), c + 4), c += 4 + g;
5354
+ l.setUint32(c, g), O(c + 4 + g <= o.byteLength, "FontInfo.write: Buffer overflow at systemFontInfo"), h.set(new Uint8Array(e), c + 4), c += 4 + g;
5355
5355
  }
5356
5356
  if (!s)
5357
5357
  l.setUint32(c, 0), c += 4;
5358
5358
  else {
5359
5359
  const g = s.byteLength;
5360
- l.setUint32(c, g), B(c + 4 + g <= o.byteLength, "FontInfo.write: Buffer overflow at cssFontInfo"), h.set(new Uint8Array(s), c + 4), c += 4 + g;
5360
+ l.setUint32(c, g), O(c + 4 + g <= o.byteLength, "FontInfo.write: Buffer overflow at cssFontInfo"), h.set(new Uint8Array(s), c + 4), c += 4 + g;
5361
5361
  }
5362
- return t.data === void 0 ? (l.setUint32(c, 0), c += 4) : (l.setUint32(c, t.data.length), h.set(t.data, c + 4), c += 4 + t.data.length), B(c <= o.byteLength, "FontInfo.write: Buffer overflow"), o.transferToFixedLength(c);
5362
+ return t.data === void 0 ? (l.setUint32(c, 0), c += 4) : (l.setUint32(c, t.data.length), h.set(t.data, c + 4), c += 4 + t.data.length), O(c <= o.byteLength, "FontInfo.write: Buffer overflow"), o.transferToFixedLength(c);
5363
5363
  }
5364
5364
  }
5365
5365
  class ot {
@@ -5492,7 +5492,7 @@ function Nn(d) {
5492
5492
  }
5493
5493
  throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");
5494
5494
  }
5495
- function On(d) {
5495
+ function Bn(d) {
5496
5496
  if (dt && typeof Buffer < "u" && d instanceof Buffer)
5497
5497
  throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");
5498
5498
  if (d instanceof Uint8Array && d.byteLength === d.buffer.byteLength)
@@ -5510,7 +5510,7 @@ function Fe(d) {
5510
5510
  return d;
5511
5511
  throw new Error(`Invalid factory url: "${d}" must include trailing slash.`);
5512
5512
  }
5513
- const As = (d) => typeof d == "object" && Number.isInteger(d?.num) && d.num >= 0 && Number.isInteger(d?.gen) && d.gen >= 0, Bn = (d) => typeof d == "object" && typeof d?.name == "string", Hn = yn.bind(null, As, Bn);
5513
+ const As = (d) => typeof d == "object" && Number.isInteger(d?.num) && d.num >= 0 && Number.isInteger(d?.gen) && d.gen >= 0, On = (d) => typeof d == "object" && typeof d?.name == "string", Hn = yn.bind(null, As, On);
5514
5514
  class $n {
5515
5515
  #t = /* @__PURE__ */ new Map();
5516
5516
  #e = Promise.resolve();
@@ -5700,7 +5700,7 @@ class we {
5700
5700
  }), l.promise;
5701
5701
  },
5702
5702
  cancel: (h) => {
5703
- B(h instanceof Error, "cancel must have a valid reason");
5703
+ O(h instanceof Error, "cancel must have a valid reason");
5704
5704
  const l = Promise.withResolvers();
5705
5705
  return this.streamControllers[n].cancelCall = l, this.streamControllers[n].isClosed = !0, o.postMessage({
5706
5706
  sourceName: r,
@@ -5735,7 +5735,7 @@ class we {
5735
5735
  }), delete r.streamSinks[e]);
5736
5736
  },
5737
5737
  error(h) {
5738
- B(h instanceof Error, "error must have a valid reason"), !this.isCancelled && (this.isCancelled = !0, n.postMessage({
5738
+ O(h instanceof Error, "error must have a valid reason"), !this.isCancelled && (this.isCancelled = !0, n.postMessage({
5739
5739
  sourceName: s,
5740
5740
  targetName: i,
5741
5741
  stream: st.ERROR,
@@ -5807,17 +5807,17 @@ class we {
5807
5807
  });
5808
5808
  break;
5809
5809
  case st.ENQUEUE:
5810
- if (B(r, "enqueue should have stream controller"), r.isClosed)
5810
+ if (O(r, "enqueue should have stream controller"), r.isClosed)
5811
5811
  break;
5812
5812
  r.controller.enqueue(t.chunk);
5813
5813
  break;
5814
5814
  case st.CLOSE:
5815
- if (B(r, "close should have stream controller"), r.isClosed)
5815
+ if (O(r, "close should have stream controller"), r.isClosed)
5816
5816
  break;
5817
5817
  r.isClosed = !0, r.controller.close(), this.#a(r, e);
5818
5818
  break;
5819
5819
  case st.ERROR:
5820
- B(r, "error should have stream controller"), r.controller.error(pt(t.reason)), this.#a(r, e);
5820
+ O(r, "error should have stream controller"), r.controller.error(pt(t.reason)), this.#a(r, e);
5821
5821
  break;
5822
5822
  case st.CANCEL_COMPLETE:
5823
5823
  t.success ? r.cancelCall.resolve() : r.cancelCall.reject(pt(t.reason)), this.#a(r, e);
@@ -5931,7 +5931,7 @@ class Di {
5931
5931
  }
5932
5932
  class ei extends Di {
5933
5933
  async _fetch(t) {
5934
- const e = await Me(t, this.isCompressed ? "arraybuffer" : "text");
5934
+ const e = await Pe(t, this.isCompressed ? "arraybuffer" : "text");
5935
5935
  return e instanceof ArrayBuffer ? new Uint8Array(e) : Te(e);
5936
5936
  }
5937
5937
  }
@@ -6089,10 +6089,10 @@ class Un extends Ii {
6089
6089
  const v = new Array(256), A = (c - l) / y, x = m / 255, _ = (w - m) / (255 * y);
6090
6090
  let E = 0;
6091
6091
  for (let S = 0; S <= y; S++) {
6092
- const P = Math.round(l + S * A), C = x + S * _;
6093
- for (let H = E; H <= P; H++)
6092
+ const M = Math.round(l + S * A), C = x + S * _;
6093
+ for (let H = E; H <= M; H++)
6094
6094
  v[H] = C;
6095
- E = P + 1;
6095
+ E = M + 1;
6096
6096
  }
6097
6097
  for (let S = E; S < 256; S++)
6098
6098
  v[S] = v[E - 1];
@@ -6155,7 +6155,7 @@ class Ri {
6155
6155
  }
6156
6156
  class si extends Ri {
6157
6157
  async _fetch(t) {
6158
- const e = await Me(t, "arraybuffer");
6158
+ const e = await Pe(t, "arraybuffer");
6159
6159
  return new Uint8Array(e);
6160
6160
  }
6161
6161
  }
@@ -6183,7 +6183,7 @@ class Li {
6183
6183
  }
6184
6184
  class ii extends Li {
6185
6185
  async _fetch(t) {
6186
- const e = await Me(t, "arraybuffer");
6186
+ const e = await Pe(t, "arraybuffer");
6187
6187
  return new Uint8Array(e);
6188
6188
  }
6189
6189
  }
@@ -6218,7 +6218,7 @@ const Kt = "__forcedDependency", {
6218
6218
  floor: ni,
6219
6219
  ceil: ri
6220
6220
  } = Math;
6221
- function Oe(d, t, e, s, i, n) {
6221
+ function Be(d, t, e, s, i, n) {
6222
6222
  d[t * 4 + 0] = Math.min(d[t * 4 + 0], e), d[t * 4 + 1] = Math.min(d[t * 4 + 1], s), d[t * 4 + 2] = Math.max(d[t * 4 + 2], i), d[t * 4 + 3] = Math.max(d[t * 4 + 3], n);
6223
6223
  }
6224
6224
  const xs = new Uint32Array(new Uint8Array([255, 255, 0, 0]).buffer)[0];
@@ -6247,7 +6247,7 @@ class Xn {
6247
6247
  return (this.#e[t * 4 + 3] + 1) / 256;
6248
6248
  }
6249
6249
  }
6250
- const Be = (d, t) => {
6250
+ const Oe = (d, t) => {
6251
6251
  if (!d)
6252
6252
  return;
6253
6253
  let e = d.get(t);
@@ -6319,7 +6319,7 @@ class Yn {
6319
6319
  return this;
6320
6320
  this.#t = e, this.#e = Object.getPrototypeOf(this.#e), this.#n = Object.getPrototypeOf(this.#n);
6321
6321
  const s = this.#s.pop();
6322
- return s !== void 0 && (Be(this.#g, t)?.dependencies.add(s), this.#c[t] = this.#c[s]), this;
6322
+ return s !== void 0 && (Oe(this.#g, t)?.dependencies.add(s), this.#c[t] = this.#c[s]), this;
6323
6323
  }
6324
6324
  recordOpenMarker(t) {
6325
6325
  return this.#s.push(t), this;
@@ -6329,14 +6329,14 @@ class Yn {
6329
6329
  }
6330
6330
  recordCloseMarker(t) {
6331
6331
  const e = this.#s.pop();
6332
- return e !== void 0 && (Be(this.#g, t)?.dependencies.add(e), this.#c[t] = this.#c[e]), this;
6332
+ return e !== void 0 && (Oe(this.#g, t)?.dependencies.add(e), this.#c[t] = this.#c[e]), this;
6333
6333
  }
6334
6334
  beginMarkedContent(t) {
6335
6335
  return this.#a.push(t), this;
6336
6336
  }
6337
6337
  endMarkedContent(t) {
6338
6338
  const e = this.#a.pop();
6339
- return e !== void 0 && (Be(this.#g, t)?.dependencies.add(e), this.#c[t] = this.#c[e]), this;
6339
+ return e !== void 0 && (Oe(this.#g, t)?.dependencies.add(e), this.#c[t] = this.#c[e]), this;
6340
6340
  }
6341
6341
  pushBaseTransform(t) {
6342
6342
  return this.#r.push(T.multiplyByDOMMatrix(this.#r.at(-1), t.getTransform())), this;
@@ -6418,20 +6418,20 @@ class Yn {
6418
6418
  }
6419
6419
  recordOperation(t, e = !1) {
6420
6420
  if (this.recordDependencies(t, [Kt]), this.#g) {
6421
- const s = Be(this.#g, t), {
6421
+ const s = Oe(this.#g, t), {
6422
6422
  dependencies: i
6423
6423
  } = s;
6424
6424
  this.#h.forEach(i.add, i), this.#s.forEach(i.add, i), this.#a.forEach(i.add, i), i.delete(t), s.isRenderingOperation = !0;
6425
6425
  }
6426
6426
  if (this.#l === t) {
6427
6427
  const s = ni(this.#o[0] * 256 / this.#p), i = ni(this.#o[1] * 256 / this.#m), n = ri(this.#o[2] * 256 / this.#p), r = ri(this.#o[3] * 256 / this.#m);
6428
- Oe(this.#f, t, s, i, n, r);
6428
+ Be(this.#f, t, s, i, n, r);
6429
6429
  for (const a of this.#h)
6430
- a !== t && Oe(this.#f, a, s, i, n, r);
6430
+ a !== t && Be(this.#f, a, s, i, n, r);
6431
6431
  for (const a of this.#s)
6432
- a !== t && Oe(this.#f, a, s, i, n, r);
6432
+ a !== t && Be(this.#f, a, s, i, n, r);
6433
6433
  for (const a of this.#a)
6434
- a !== t && Oe(this.#f, a, s, i, n, r);
6434
+ a !== t && Be(this.#f, a, s, i, n, r);
6435
6435
  e || (this.#h.clear(), this.#l = -1);
6436
6436
  }
6437
6437
  return this;
@@ -6653,7 +6653,7 @@ function hs(d, t, e, s, i, n, r, a) {
6653
6653
  const p = (o[e] + t.offsetX) * t.scaleX, f = (o[e + 1] + t.offsetY) * t.scaleY, g = (o[s] + t.offsetX) * t.scaleX, b = (o[s + 1] + t.offsetY) * t.scaleY, m = (o[i] + t.offsetX) * t.scaleX, w = (o[i + 1] + t.offsetY) * t.scaleY;
6654
6654
  if (f >= w)
6655
6655
  return;
6656
- 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], P = h[a + 1], C = h[a + 2], H = Math.round(f), V = Math.round(w);
6656
+ 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);
6657
6657
  let N, Z, k, I, U, ft, Dt, tt;
6658
6658
  for (let W = H; W <= V; W++) {
6659
6659
  if (W < b) {
@@ -6661,14 +6661,14 @@ function hs(d, t, e, s, i, n, r, a) {
6661
6661
  N = p - (p - g) * et, Z = y - (y - x) * et, k = v - (v - _) * et, I = A - (A - E) * et;
6662
6662
  } else {
6663
6663
  let et;
6664
- W > w ? et = 1 : b === w ? et = 0 : et = (b - W) / (b - w), N = g - (g - m) * et, Z = x - (x - S) * et, k = _ - (_ - P) * et, I = E - (E - C) * et;
6664
+ 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;
6665
6665
  }
6666
6666
  let q;
6667
- 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 - P) * q, tt = A - (A - C) * q;
6667
+ 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;
6668
6668
  const Ut = Math.round(Math.min(N, U)), Nt = Math.round(Math.max(N, U));
6669
- let Ot = c * W + Ut * 4;
6669
+ let Bt = c * W + Ut * 4;
6670
6670
  for (let et = Ut; et <= Nt; et++)
6671
- 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++] = I - (I - tt) * q | 0, l[Ot++] = 255;
6671
+ 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;
6672
6672
  }
6673
6673
  }
6674
6674
  function Qn(d, t, e) {
@@ -6757,7 +6757,7 @@ const ai = {
6757
6757
  COLORED: 1,
6758
6758
  UNCOLORED: 2
6759
6759
  };
6760
- class Os {
6760
+ class Bs {
6761
6761
  static MAX_PATTERN_SIZE = 3e3;
6762
6762
  constructor(t, e, s, i) {
6763
6763
  this.color = t[1], this.operatorList = t[2], this.matrix = t[3], this.bbox = t[4], this.xstep = t[5], this.ystep = t[6], this.paintType = t[7], this.tilingType = t[8], this.ctx = e, this.canvasGraphicsFactory = s, this.baseTransform = i;
@@ -6782,14 +6782,14 @@ class Os {
6782
6782
  T.singularValueDecompose2dScale(this.baseTransform, m);
6783
6783
  const v = w * m[0], A = y * m[1];
6784
6784
  let x = g, _ = b, E = !1, S = !1;
6785
- const P = Math.ceil(h * v), C = Math.ceil(l * A), H = Math.ceil(g * v), V = Math.ceil(b * A);
6786
- P >= H ? x = h : E = !0, C >= V ? _ = l : S = !0;
6785
+ const M = Math.ceil(h * v), C = Math.ceil(l * A), H = Math.ceil(g * v), V = Math.ceil(b * A);
6786
+ M >= H ? x = h : E = !0, C >= V ? _ = l : S = !0;
6787
6787
  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);
6788
6788
  if (U.groupLevel = t.groupLevel, this.setFillAndStrokeStyleToContext(U, n, a), I.translate(-N.scale * c, -Z.scale * u), U.transform(0, N.scale, 0, 0, Z.scale, 0, 0), I.save(), U.dependencyTracker?.save(), this.clipBbox(U, c, u, p, f), U.baseTransform = X(U.ctx), U.executeOperatorList(i), U.endDrawing(), U.dependencyTracker?.restore(), I.restore(), E || S) {
6789
6789
  const ft = k.canvas;
6790
6790
  E && (x = h), S && (_ = l);
6791
- 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;
6792
- for (let ce = 0; ce <= Ot; ce++)
6791
+ 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;
6792
+ for (let ce = 0; ce <= Bt; ce++)
6793
6793
  for (let de = 0; de <= et; de++)
6794
6794
  Nt.drawImage(ft, W * ce, q * de, W, q, 0, 0, W, q);
6795
6795
  return {
@@ -6809,7 +6809,7 @@ class Os {
6809
6809
  };
6810
6810
  }
6811
6811
  getSizeAndScale(t, e, s) {
6812
- const i = Math.max(Os.MAX_PATTERN_SIZE, e);
6812
+ const i = Math.max(Bs.MAX_PATTERN_SIZE, e);
6813
6813
  let n = Math.ceil(t * s);
6814
6814
  return n >= i ? n = i : s = n / t, {
6815
6815
  scale: s,
@@ -7020,11 +7020,11 @@ function di(d, t) {
7020
7020
  const x = b - o;
7021
7021
  let _ = 0;
7022
7022
  const E = x > y ? s : x * 8 - 7, S = E & -8;
7023
- let P = 0, C = 0;
7023
+ let M = 0, C = 0;
7024
7024
  for (; _ < S; _ += 8)
7025
7025
  C = l[o++], m[h++] = C & 128 ? v : A, m[h++] = C & 64 ? v : A, m[h++] = C & 32 ? v : A, m[h++] = C & 16 ? v : A, m[h++] = C & 8 ? v : A, m[h++] = C & 4 ? v : A, m[h++] = C & 2 ? v : A, m[h++] = C & 1 ? v : A;
7026
7026
  for (; _ < E; _++)
7027
- P === 0 && (C = l[o++], P = 128), m[h++] = C & P ? v : A, P >>= 1;
7027
+ M === 0 && (C = l[o++], M = 128), m[h++] = C & M ? v : A, M >>= 1;
7028
7028
  }
7029
7029
  for (; h < w; )
7030
7030
  m[h++] = 0;
@@ -7184,8 +7184,8 @@ class oe {
7184
7184
  } = e, r = this.current.fillColor, a = this.current.patternFill, o = X(s);
7185
7185
  let h, l, c, u;
7186
7186
  if ((e.bitmap || e.data) && e.count > 1) {
7187
- const P = e.bitmap || e.data.buffer;
7188
- l = JSON.stringify(a ? o : [o.slice(0, 4), r]), h = this._cachedBitmapsMap.get(P), h || (h = /* @__PURE__ */ new Map(), this._cachedBitmapsMap.set(P, h));
7187
+ const M = e.bitmap || e.data.buffer;
7188
+ l = JSON.stringify(a ? o : [o.slice(0, 4), r]), h = this._cachedBitmapsMap.get(M), h || (h = /* @__PURE__ */ new Map(), this._cachedBitmapsMap.set(M, h));
7189
7189
  const C = h.get(l);
7190
7190
  if (C && !a) {
7191
7191
  const H = Math.round(Math.min(o[0], o[2]) + o[4]), V = Math.round(Math.min(o[1], o[3]) + o[5]);
@@ -7578,9 +7578,9 @@ class oe {
7578
7578
  s.x += H * b * c, r.restore(), this.compose();
7579
7579
  return;
7580
7580
  }
7581
- let S = 0, P;
7582
- for (P = 0; P < u; ++P) {
7583
- const C = e[P];
7581
+ let S = 0, M;
7582
+ for (M = 0; M < u; ++M) {
7583
+ const C = e[M];
7584
7584
  if (typeof C == "number") {
7585
7585
  S += f * C * n / 1e3;
7586
7586
  continue;
@@ -7651,7 +7651,7 @@ class oe {
7651
7651
  markedContentStack: this.markedContentStack
7652
7652
  }, void 0, void 0, this.dependencyTracker ? new We(this.dependencyTracker, a, !0) : null)
7653
7653
  };
7654
- s = new Os(e, this.ctx, n, i);
7654
+ s = new Bs(e, this.ctx, n, i);
7655
7655
  } else
7656
7656
  s = this._getPattern(t, e[1], e[2]);
7657
7657
  return s;
@@ -8242,7 +8242,7 @@ class cr {
8242
8242
  getHash() {
8243
8243
  if (this.#t !== null)
8244
8244
  return this.#t;
8245
- const t = new Mi();
8245
+ const t = new Pi();
8246
8246
  for (const [e, s] of this.#e)
8247
8247
  t.update(`${e}:${s.visible}`);
8248
8248
  return this.#t = t.hexdigest();
@@ -8256,7 +8256,7 @@ class dr {
8256
8256
  disableRange: e = !1,
8257
8257
  disableStream: s = !1
8258
8258
  }) {
8259
- B(t, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
8259
+ O(t, 'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');
8260
8260
  const {
8261
8261
  length: i,
8262
8262
  initialData: n,
@@ -8296,7 +8296,7 @@ class dr {
8296
8296
  const i = this._rangeReaders.some(function(n) {
8297
8297
  return n._begin !== t ? !1 : (n._enqueue(s), !0);
8298
8298
  });
8299
- B(i, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
8299
+ O(i, "_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.");
8300
8300
  }
8301
8301
  }
8302
8302
  get _progressiveDataLength() {
@@ -8318,7 +8318,7 @@ class dr {
8318
8318
  e >= 0 && this._rangeReaders.splice(e, 1);
8319
8319
  }
8320
8320
  getFullReader() {
8321
- B(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
8321
+ O(!this._fullRequestReader, "PDFDataTransportStream.getFullReader can only be called once.");
8322
8322
  const t = this._queuedChunks;
8323
8323
  return this._queuedChunks = null, new ur(this, t, this._progressiveDone, this._contentDispositionFilename);
8324
8324
  }
@@ -8556,7 +8556,7 @@ function Ni({
8556
8556
  }, n = parseInt(d.get("Content-Length"), 10);
8557
8557
  return !Number.isInteger(n) || (i.suggestedLength = n, n <= 2 * e) || s || !t || d.get("Accept-Ranges") !== "bytes" || (d.get("Content-Encoding") || "identity") !== "identity" || (i.allowRangeRequests = !0), i;
8558
8558
  }
8559
- function Oi(d) {
8559
+ function Bi(d) {
8560
8560
  const t = d.get("Content-Disposition");
8561
8561
  if (t) {
8562
8562
  let e = gr(t);
@@ -8573,7 +8573,7 @@ function Oi(d) {
8573
8573
  function Ie(d, t) {
8574
8574
  return new je(`Unexpected server response (${d}) while retrieving PDF "${t}".`, d, d === 404 || d === 0 && t.startsWith("file:"));
8575
8575
  }
8576
- function Bi(d) {
8576
+ function Oi(d) {
8577
8577
  return d === 200 || d === 206;
8578
8578
  }
8579
8579
  function Hi(d, t, e) {
@@ -8598,7 +8598,7 @@ class fr {
8598
8598
  return this._fullRequestReader?._loaded ?? 0;
8599
8599
  }
8600
8600
  getFullReader() {
8601
- return B(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."), this._fullRequestReader = new mr(this), this._fullRequestReader;
8601
+ return O(!this._fullRequestReader, "PDFFetchStream.getFullReader can only be called once."), this._fullRequestReader = new mr(this), this._fullRequestReader;
8602
8602
  }
8603
8603
  getRangeReader(t, e) {
8604
8604
  if (e <= this._progressiveDataLength)
@@ -8619,7 +8619,7 @@ class mr {
8619
8619
  this._withCredentials = e.withCredentials || !1, this._contentLength = e.length, this._headersCapability = Promise.withResolvers(), this._disableRange = e.disableRange || !1, this._rangeChunkSize = e.rangeChunkSize, !this._rangeChunkSize && !this._disableRange && (this._disableRange = !0), this._abortController = new AbortController(), this._isStreamingSupported = !e.disableStream, this._isRangeSupported = !e.disableRange;
8620
8620
  const s = new Headers(t.headers), i = e.url;
8621
8621
  fetch(i, Hi(s, this._withCredentials, this._abortController)).then((n) => {
8622
- if (t._responseOrigin = ts(n.url), !Bi(n.status))
8622
+ if (t._responseOrigin = ts(n.url), !Oi(n.status))
8623
8623
  throw Ie(n.status, i);
8624
8624
  this._reader = n.body.getReader(), this._headersCapability.resolve();
8625
8625
  const r = n.headers, {
@@ -8631,7 +8631,7 @@ class mr {
8631
8631
  rangeChunkSize: this._rangeChunkSize,
8632
8632
  disableRange: this._disableRange
8633
8633
  });
8634
- this._isRangeSupported = a, this._contentLength = o || this._contentLength, this._filename = Oi(r), !this._isStreamingSupported && this._isRangeSupported && this.cancel(new $t("Streaming is disabled."));
8634
+ this._isRangeSupported = a, this._contentLength = o || this._contentLength, this._filename = Bi(r), !this._isStreamingSupported && this._isRangeSupported && this.cancel(new $t("Streaming is disabled."));
8635
8635
  }).catch(this._headersCapability.reject), this.onProgress = null;
8636
8636
  }
8637
8637
  get headersReady() {
@@ -8682,7 +8682,7 @@ class br {
8682
8682
  const o = ts(a.url);
8683
8683
  if (o !== t._responseOrigin)
8684
8684
  throw new Error(`Expected range response-origin "${o}" to match "${t._responseOrigin}".`);
8685
- if (!Bi(a.status))
8685
+ if (!Oi(a.status))
8686
8686
  throw Ie(a.status, r);
8687
8687
  this._readCapability.resolve(), this._reader = a.body.getReader();
8688
8688
  }).catch(this._readCapability.reject), this.onProgress = null;
@@ -8731,7 +8731,7 @@ class wr {
8731
8731
  e.open("GET", this.url), e.withCredentials = this.withCredentials;
8732
8732
  for (const [n, r] of this.headers)
8733
8733
  e.setRequestHeader(n, r);
8734
- return this.isHttp && "begin" in t && "end" in t ? (e.setRequestHeader("Range", `bytes=${t.begin}-${t.end - 1}`), i.expectedStatus = ds) : i.expectedStatus = cs, e.responseType = "arraybuffer", B(t.onError, "Expected `onError` callback to be provided."), e.onerror = () => {
8734
+ return this.isHttp && "begin" in t && "end" in t ? (e.setRequestHeader("Range", `bytes=${t.begin}-${t.end - 1}`), i.expectedStatus = ds) : i.expectedStatus = cs, e.responseType = "arraybuffer", O(t.onError, "Expected `onError` callback to be provided."), e.onerror = () => {
8735
8735
  t.onError(e.status);
8736
8736
  }, 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;
8737
8737
  }
@@ -8787,7 +8787,7 @@ class vr {
8787
8787
  e >= 0 && this._rangeRequestReaders.splice(e, 1);
8788
8788
  }
8789
8789
  getFullReader() {
8790
- return B(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."), this._fullRequestReader = new Ar(this._manager, this._source), this._fullRequestReader;
8790
+ return O(!this._fullRequestReader, "PDFNetworkStream.getFullReader can only be called once."), this._fullRequestReader = new Ar(this._manager, this._source), this._fullRequestReader;
8791
8791
  }
8792
8792
  getRangeReader(t, e) {
8793
8793
  const s = new xr(this._manager, t, e);
@@ -8823,7 +8823,7 @@ class Ar {
8823
8823
  rangeChunkSize: this._rangeChunkSize,
8824
8824
  disableRange: this._disableRange
8825
8825
  });
8826
- n && (this._isRangeSupported = !0), this._contentLength = r || this._contentLength, this._filename = Oi(i), this._isRangeSupported && this._manager.abortRequest(t), this._headersCapability.resolve();
8826
+ n && (this._isRangeSupported = !0), this._contentLength = r || this._contentLength, this._filename = Bi(i), this._isRangeSupported && this._manager.abortRequest(t), this._headersCapability.resolve();
8827
8827
  }
8828
8828
  _onDone(t) {
8829
8829
  if (t && (this._requests.length > 0 ? this._requests.shift().resolve({
@@ -8973,13 +8973,13 @@ function Er(d) {
8973
8973
  }
8974
8974
  class Sr {
8975
8975
  constructor(t) {
8976
- this.source = t, this.url = Er(t.url), B(this.url.protocol === "file:", "PDFNodeStream only supports file:// URLs."), this._fullRequestReader = null, this._rangeRequestReaders = [];
8976
+ this.source = t, this.url = Er(t.url), O(this.url.protocol === "file:", "PDFNodeStream only supports file:// URLs."), this._fullRequestReader = null, this._rangeRequestReaders = [];
8977
8977
  }
8978
8978
  get _progressiveDataLength() {
8979
8979
  return this._fullRequestReader?._loaded ?? 0;
8980
8980
  }
8981
8981
  getFullReader() {
8982
- return B(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."), this._fullRequestReader = new Cr(this), this._fullRequestReader;
8982
+ return O(!this._fullRequestReader, "PDFNodeStream.getFullReader can only be called once."), this._fullRequestReader = new Cr(this), this._fullRequestReader;
8983
8983
  }
8984
8984
  getRangeReader(t, e) {
8985
8985
  if (e <= this._progressiveDataLength)
@@ -9156,7 +9156,7 @@ class zi {
9156
9156
  }
9157
9157
  }
9158
9158
  }
9159
- const Mr = 1e5, fi = 30;
9159
+ const Pr = 1e5, fi = 30;
9160
9160
  class yt {
9161
9161
  #t = Promise.withResolvers();
9162
9162
  #e = null;
@@ -9207,7 +9207,7 @@ class yt {
9207
9207
  pageX: r,
9208
9208
  pageY: a
9209
9209
  } = s.rawDims;
9210
- this.#b = [1, 0, 0, -1, -r, a + n], this.#o = i, this.#n = n, yt.#P(), e.style.setProperty("--min-font-size", yt.#_), jt(e, s), this.#t.promise.finally(() => {
9210
+ this.#b = [1, 0, 0, -1, -r, a + n], this.#o = i, this.#n = n, yt.#M(), e.style.setProperty("--min-font-size", yt.#_), jt(e, s), this.#t.promise.finally(() => {
9211
9211
  yt.#A.delete(this), this.#r = null, this.#p = null;
9212
9212
  }).catch(() => {
9213
9213
  });
@@ -9269,7 +9269,7 @@ class yt {
9269
9269
  this.#r.ctx ??= yt.#k(this.#a);
9270
9270
  const e = this.#c, s = this.#m;
9271
9271
  for (const i of t) {
9272
- if (e.length > Mr) {
9272
+ if (e.length > Pr) {
9273
9273
  R("Ignoring additional textDivs for performance reasons."), this.#i = !0;
9274
9274
  return;
9275
9275
  }
@@ -9298,7 +9298,7 @@ class yt {
9298
9298
  r.vertical && (n += Math.PI / 2);
9299
9299
  let a = this.#s && r.fontSubstitution || r.fontFamily;
9300
9300
  a = yt.fontFamilyMap.get(a) || a;
9301
- const o = Math.hypot(i[2], i[3]), h = o * yt.#O(a, r, this.#a);
9301
+ const o = Math.hypot(i[2], i[3]), h = o * yt.#B(a, r, this.#a);
9302
9302
  let l, c;
9303
9303
  n === 0 ? (l = i[4], c = i[5] - h) : (l = i[4] + h * Math.sin(n), c = i[5] - h * Math.cos(n));
9304
9304
  const u = e.style;
@@ -9330,7 +9330,7 @@ class yt {
9330
9330
  canvasWidth: a,
9331
9331
  fontSize: o
9332
9332
  } = s;
9333
- yt.#M(i, o * this.#d, r);
9333
+ yt.#P(i, o * this.#d, r);
9334
9334
  const {
9335
9335
  width: h
9336
9336
  } = i.measureText(e.textContent);
@@ -9362,40 +9362,40 @@ class yt {
9362
9362
  }
9363
9363
  return e;
9364
9364
  }
9365
- static #M(t, e, s) {
9365
+ static #P(t, e, s) {
9366
9366
  const i = this.#S.get(t);
9367
9367
  e === i.size && s === i.family || (t.font = `${e}px ${s}`, i.size = e, i.family = s);
9368
9368
  }
9369
- static #P() {
9369
+ static #M() {
9370
9370
  if (this.#_ !== null)
9371
9371
  return;
9372
9372
  const t = document.createElement("div");
9373
9373
  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();
9374
9374
  }
9375
- static #O(t, e, s) {
9375
+ static #B(t, e, s) {
9376
9376
  const i = this.#w.get(t);
9377
9377
  if (i)
9378
9378
  return i;
9379
9379
  const n = this.#k(s);
9380
- n.canvas.width = n.canvas.height = fi, this.#M(n, fi, t);
9380
+ n.canvas.width = n.canvas.height = fi, this.#P(n, fi, t);
9381
9381
  const r = n.measureText(""), a = r.fontBoundingBoxAscent, o = Math.abs(r.fontBoundingBoxDescent);
9382
9382
  n.canvas.width = n.canvas.height = 0;
9383
9383
  let h = 0.8;
9384
9384
  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;
9385
9385
  }
9386
9386
  }
9387
- const Pr = 100;
9387
+ const Mr = 100;
9388
9388
  function Ui(d = {}) {
9389
9389
  typeof d == "string" || d instanceof URL ? d = {
9390
9390
  url: d
9391
9391
  } : (d instanceof ArrayBuffer || ArrayBuffer.isView(d)) && (d = {
9392
9392
  data: d
9393
9393
  });
9394
- const t = new Bs(), {
9394
+ const t = new Os(), {
9395
9395
  docId: e
9396
- } = t, s = d.url ? Nn(d.url) : null, i = d.data ? On(d.data) : null, n = d.httpHeaders || null, r = d.withCredentials === !0, a = d.password ?? null, o = d.range instanceof Vi ? d.range : null, h = Number.isInteger(d.rangeChunkSize) && d.rangeChunkSize > 0 ? d.rangeChunkSize : 2 ** 16;
9396
+ } = t, s = d.url ? Nn(d.url) : null, i = d.data ? Bn(d.data) : null, n = d.httpHeaders || null, r = d.withCredentials === !0, a = d.password ?? null, o = d.range instanceof Vi ? d.range : null, h = Number.isInteger(d.rangeChunkSize) && d.rangeChunkSize > 0 ? d.rangeChunkSize : 2 ** 16;
9397
9397
  let l = d.worker instanceof Es ? d.worker : null;
9398
- const c = d.verbosity, u = typeof d.docBaseUrl == "string" && !Je(d.docBaseUrl) ? d.docBaseUrl : null, p = Fe(d.cMapUrl), f = d.cMapPacked !== !1, g = d.CMapReaderFactory || (dt ? jn : ei), b = Fe(d.iccUrl), m = Fe(d.standardFontDataUrl), w = d.StandardFontDataFactory || (dt ? Wn : si), y = Fe(d.wasmUrl), v = d.WasmFactory || (dt ? qn : ii), A = d.stopAtErrors !== !0, x = Number.isInteger(d.maxImageSize) && d.maxImageSize > -1 ? d.maxImageSize : -1, _ = d.isEvalSupported !== !1, E = typeof d.isOffscreenCanvasSupported == "boolean" ? d.isOffscreenCanvasSupported : !dt, S = typeof d.isImageDecoderSupported == "boolean" ? d.isImageDecoderSupported : !dt && (at.platform.isFirefox || !globalThis.chrome), P = Number.isInteger(d.canvasMaxAreaInBytes) ? d.canvasMaxAreaInBytes : -1, C = typeof d.disableFontFace == "boolean" ? d.disableFontFace : dt, H = d.fontExtraProperties === !0, V = d.enableXfa === !0, N = d.ownerDocument || globalThis.document, Z = d.disableRange === !0, k = d.disableStream === !0, I = d.disableAutoFetch === !0, U = d.pdfBug === !0, ft = d.CanvasFactory || (dt ? Gn : zn), Dt = d.FilterFactory || (dt ? Vn : Un), tt = d.enableHWA === !0, W = d.useWasm !== !1, q = o ? o.length : d.length ?? NaN, Ut = typeof d.useSystemFonts == "boolean" ? d.useSystemFonts : !dt && !C, Nt = typeof d.useWorkerFetch == "boolean" ? d.useWorkerFetch : !!(g === ei && w === si && v === ii && p && m && y && ye(p, document.baseURI) && ye(m, document.baseURI) && ye(y, document.baseURI)), Ot = null;
9398
+ const c = d.verbosity, u = typeof d.docBaseUrl == "string" && !Je(d.docBaseUrl) ? d.docBaseUrl : null, p = Fe(d.cMapUrl), f = d.cMapPacked !== !1, g = d.CMapReaderFactory || (dt ? jn : ei), b = Fe(d.iccUrl), m = Fe(d.standardFontDataUrl), w = d.StandardFontDataFactory || (dt ? Wn : si), y = Fe(d.wasmUrl), v = d.WasmFactory || (dt ? qn : ii), A = d.stopAtErrors !== !0, x = Number.isInteger(d.maxImageSize) && d.maxImageSize > -1 ? d.maxImageSize : -1, _ = d.isEvalSupported !== !1, E = typeof d.isOffscreenCanvasSupported == "boolean" ? d.isOffscreenCanvasSupported : !dt, S = typeof d.isImageDecoderSupported == "boolean" ? d.isImageDecoderSupported : !dt && (at.platform.isFirefox || !globalThis.chrome), M = Number.isInteger(d.canvasMaxAreaInBytes) ? d.canvasMaxAreaInBytes : -1, C = typeof d.disableFontFace == "boolean" ? d.disableFontFace : dt, H = d.fontExtraProperties === !0, V = d.enableXfa === !0, N = d.ownerDocument || globalThis.document, Z = d.disableRange === !0, k = d.disableStream === !0, I = d.disableAutoFetch === !0, U = d.pdfBug === !0, ft = d.CanvasFactory || (dt ? Gn : zn), Dt = d.FilterFactory || (dt ? Vn : Un), tt = d.enableHWA === !0, W = d.useWasm !== !1, q = o ? o.length : d.length ?? NaN, Ut = typeof d.useSystemFonts == "boolean" ? d.useSystemFonts : !dt && !C, Nt = typeof d.useWorkerFetch == "boolean" ? d.useWorkerFetch : !!(g === ei && w === si && v === ii && p && m && y && ye(p, document.baseURI) && ye(m, document.baseURI) && ye(y, document.baseURI)), Bt = null;
9399
9399
  ln(c);
9400
9400
  const et = {
9401
9401
  canvasFactory: new ft({
@@ -9438,7 +9438,7 @@ function Ui(d = {}) {
9438
9438
  isEvalSupported: _,
9439
9439
  isOffscreenCanvasSupported: E,
9440
9440
  isImageDecoderSupported: S,
9441
- canvasMaxAreaInBytes: P,
9441
+ canvasMaxAreaInBytes: M,
9442
9442
  fontExtraProperties: H,
9443
9443
  useSystemFonts: Ut,
9444
9444
  useWasm: W,
@@ -9451,7 +9451,7 @@ function Ui(d = {}) {
9451
9451
  }, de = {
9452
9452
  ownerDocument: N,
9453
9453
  pdfBug: U,
9454
- styleElement: Ot,
9454
+ styleElement: Bt,
9455
9455
  loadingParams: {
9456
9456
  disableAutoFetch: I,
9457
9457
  enableXfa: V
@@ -9493,12 +9493,12 @@ function Ui(d = {}) {
9493
9493
  });
9494
9494
  }).catch(t._capability.reject), t;
9495
9495
  }
9496
- class Bs {
9496
+ class Os {
9497
9497
  static #t = 0;
9498
9498
  _capability = Promise.withResolvers();
9499
9499
  _transport = null;
9500
9500
  _worker = null;
9501
- docId = `d${Bs.#t++}`;
9501
+ docId = `d${Os.#t++}`;
9502
9502
  destroyed = !1;
9503
9503
  onPassword = null;
9504
9504
  onProgress = null;
@@ -9715,7 +9715,7 @@ class Dr {
9715
9715
  offsetY: i = 0,
9716
9716
  dontFlip: n = !1
9717
9717
  } = {}) {
9718
- return new Pe({
9718
+ return new Me({
9719
9719
  viewBox: this.view,
9720
9720
  userUnit: this.userUnit,
9721
9721
  scale: t,
@@ -9750,7 +9750,7 @@ class Dr {
9750
9750
  canvas: e = t.canvas,
9751
9751
  viewport: s,
9752
9752
  intent: i = "display",
9753
- annotationMode: n = Bt.ENABLE,
9753
+ annotationMode: n = Ot.ENABLE,
9754
9754
  transform: r = null,
9755
9755
  background: a = null,
9756
9756
  optionalContentConfigPromise: o = null,
@@ -9778,8 +9778,8 @@ class Dr {
9778
9778
  }, this._stats?.time("Page Request"), this._pumpOperatorList(g));
9779
9779
  const v = !!(this._pdfBug && globalThis.StepperManager?.enabled), A = !this.recordedBBoxes && (p || v), x = (S) => {
9780
9780
  if (w.renderTasks.delete(_), A) {
9781
- const P = _.gfx?.dependencyTracker.take();
9782
- P && (_.stepper && _.stepper.setOperatorBBoxes(P, _.gfx.dependencyTracker.takeDebugMetadata()), p && (this.recordedBBoxes = P));
9781
+ const M = _.gfx?.dependencyTracker.take();
9782
+ M && (_.stepper && _.stepper.setOperatorBBoxes(M, _.gfx.dependencyTracker.takeDebugMetadata()), p && (this.recordedBBoxes = M));
9783
9783
  }
9784
9784
  y && (this.#t = !0), this.#e(), S ? (_.capability.reject(S), this._abortOperatorList({
9785
9785
  intentState: w,
@@ -9810,22 +9810,22 @@ class Dr {
9810
9810
  });
9811
9811
  (w.renderTasks ||= /* @__PURE__ */ new Set()).add(_);
9812
9812
  const E = _.task;
9813
- return Promise.all([w.displayReadyCapability.promise, o]).then(([S, P]) => {
9813
+ return Promise.all([w.displayReadyCapability.promise, o]).then(([S, M]) => {
9814
9814
  if (this.destroyed) {
9815
9815
  x();
9816
9816
  return;
9817
9817
  }
9818
- if (this._stats?.time("Rendering"), !(P.renderingIntent & b))
9818
+ if (this._stats?.time("Rendering"), !(M.renderingIntent & b))
9819
9819
  throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");
9820
9820
  _.initializeGraphics({
9821
9821
  transparency: S,
9822
- optionalContentConfig: P
9822
+ optionalContentConfig: M
9823
9823
  }), _.operatorListChanged();
9824
9824
  }).catch(x), E;
9825
9825
  }
9826
9826
  getOperatorList({
9827
9827
  intent: t = "display",
9828
- annotationMode: e = Bt.ENABLE,
9828
+ annotationMode: e = Ot.ENABLE,
9829
9829
  printAnnotationStorage: s = null,
9830
9830
  isEditing: i = !1
9831
9831
  } = {}) {
@@ -9983,7 +9983,7 @@ class Dr {
9983
9983
  if (t.renderTasks.size > 0)
9984
9984
  return;
9985
9985
  if (e instanceof ks) {
9986
- let i = Pr;
9986
+ let i = Mr;
9987
9987
  e.extraDelay > 0 && e.extraDelay < 1e3 && (i += e.extraDelay), t.streamReaderCancelTimeout = setTimeout(() => {
9988
9988
  t.streamReaderCancelTimeout = null, this._abortOperatorList({
9989
9989
  intentState: t,
@@ -10009,14 +10009,14 @@ class Dr {
10009
10009
  return this._stats;
10010
10010
  }
10011
10011
  }
10012
- var Vt, Pt, Ht, he, us, Qt, ie, Et, ze, Gi, ji, fe, xe, qe;
10012
+ var Vt, Mt, Ht, he, us, Qt, ie, Et, ze, Gi, ji, fe, xe, qe;
10013
10013
  const rt = class ve {
10014
10014
  constructor({
10015
10015
  name: t = null,
10016
10016
  port: e = null,
10017
10017
  verbosity: s = cn()
10018
10018
  } = {}) {
10019
- if (Ft(this, Et), Ft(this, Vt, Promise.withResolvers()), Ft(this, Pt, null), Ft(this, Ht, null), Ft(this, he, null), this.name = t, this.destroyed = !1, this.verbosity = s, e) {
10019
+ if (Ft(this, Et), Ft(this, Vt, Promise.withResolvers()), Ft(this, Mt, null), Ft(this, Ht, null), Ft(this, he, null), this.name = t, this.destroyed = !1, this.verbosity = s, e) {
10020
10020
  if (Y(ve, ie).has(e))
10021
10021
  throw new Error("Cannot use more than one PDFWorker per port.");
10022
10022
  Y(ve, ie).set(e, this), Rt(this, Et, Gi).call(this, e);
@@ -10030,10 +10030,10 @@ const rt = class ve {
10030
10030
  return Y(this, Ht);
10031
10031
  }
10032
10032
  get messageHandler() {
10033
- return Y(this, Pt);
10033
+ return Y(this, Mt);
10034
10034
  }
10035
10035
  destroy() {
10036
- this.destroyed = !0, Y(this, he)?.terminate(), mt(this, he, null), Y(ve, ie).delete(Y(this, Ht)), mt(this, Ht, null), Y(this, Pt)?.destroy(), mt(this, Pt, null);
10036
+ this.destroyed = !0, Y(this, he)?.terminate(), mt(this, he, null), Y(ve, ie).delete(Y(this, Ht)), mt(this, Ht, null), Y(this, Mt)?.destroy(), mt(this, Mt, null);
10037
10037
  }
10038
10038
  static create(t) {
10039
10039
  const e = Y(this, ie).get(t?.port);
@@ -10057,12 +10057,12 @@ const rt = class ve {
10057
10057
  )).WorkerMessageHandler)());
10058
10058
  }
10059
10059
  };
10060
- Vt = /* @__PURE__ */ new WeakMap(), Pt = /* @__PURE__ */ new WeakMap(), Ht = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), us = /* @__PURE__ */ new WeakMap(), Qt = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakSet(), ze = function() {
10061
- Y(this, Vt).resolve(), Y(this, Pt).send("configure", {
10060
+ Vt = /* @__PURE__ */ new WeakMap(), Mt = /* @__PURE__ */ new WeakMap(), Ht = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), us = /* @__PURE__ */ new WeakMap(), Qt = /* @__PURE__ */ new WeakMap(), ie = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakSet(), ze = function() {
10061
+ Y(this, Vt).resolve(), Y(this, Mt).send("configure", {
10062
10062
  verbosity: this.verbosity
10063
10063
  });
10064
10064
  }, Gi = function(d) {
10065
- mt(this, Ht, d), mt(this, Pt, new we("main", "worker", d)), Y(this, Pt).on("ready", () => {
10065
+ mt(this, Ht, d), mt(this, Mt, new we("main", "worker", d)), Y(this, Mt).on("ready", () => {
10066
10066
  }), Rt(this, Et, ze).call(this);
10067
10067
  }, ji = function() {
10068
10068
  if (Y(rt, Qt) || Y(rt, xe, qe)) {
@@ -10088,7 +10088,7 @@ Vt = /* @__PURE__ */ new WeakMap(), Pt = /* @__PURE__ */ new WeakMap(), Ht = /*
10088
10088
  s();
10089
10089
  return;
10090
10090
  }
10091
- mt(this, Pt, e), mt(this, Ht, t), mt(this, he, t), Rt(this, Et, ze).call(this);
10091
+ mt(this, Mt, e), mt(this, Ht, t), mt(this, he, t), Rt(this, Et, ze).call(this);
10092
10092
  }), e.on("ready", (r) => {
10093
10093
  if (i.abort(), this.destroyed) {
10094
10094
  s();
@@ -10119,7 +10119,7 @@ Vt = /* @__PURE__ */ new WeakMap(), Pt = /* @__PURE__ */ new WeakMap(), Ht = /*
10119
10119
  const t = new $n();
10120
10120
  mt(this, Ht, t);
10121
10121
  const e = `fake${nn(rt, us)._++}`, s = new we(e + "_worker", e, t);
10122
- d.setup(s, t), mt(this, Pt, new we(e, e + "_worker", t)), Rt(this, Et, ze).call(this);
10122
+ d.setup(s, t), mt(this, Mt, new we(e, e + "_worker", t)), Rt(this, Et, ze).call(this);
10123
10123
  }).catch((d) => {
10124
10124
  Y(this, Vt).reject(new Error(`Setting up fake worker failed: "${d.message}".`));
10125
10125
  });
@@ -10168,7 +10168,7 @@ class Ir {
10168
10168
  get annotationStorage() {
10169
10169
  return L(this, "annotationStorage", new Ls());
10170
10170
  }
10171
- getRenderingIntent(t, e = Bt.ENABLE, s = null, i = !1, n = !1) {
10171
+ getRenderingIntent(t, e = Ot.ENABLE, s = null, i = !1, n = !1) {
10172
10172
  let r = bt.DISPLAY, a = vs;
10173
10173
  switch (t) {
10174
10174
  case "any":
@@ -10182,17 +10182,17 @@ class Ir {
10182
10182
  default:
10183
10183
  R(`getRenderingIntent - invalid intent: ${t}`);
10184
10184
  }
10185
- const o = r & bt.PRINT && s instanceof Pi ? s : this.annotationStorage;
10185
+ const o = r & bt.PRINT && s instanceof Mi ? s : this.annotationStorage;
10186
10186
  switch (e) {
10187
- case Bt.DISABLE:
10187
+ case Ot.DISABLE:
10188
10188
  r += bt.ANNOTATIONS_DISABLE;
10189
10189
  break;
10190
- case Bt.ENABLE:
10190
+ case Ot.ENABLE:
10191
10191
  break;
10192
- case Bt.ENABLE_FORMS:
10192
+ case Ot.ENABLE_FORMS:
10193
10193
  r += bt.ANNOTATIONS_FORMS;
10194
10194
  break;
10195
- case Bt.ENABLE_STORAGE:
10195
+ case Ot.ENABLE_STORAGE:
10196
10196
  r += bt.ANNOTATIONS_STORAGE, a = o.serializable;
10197
10197
  break;
10198
10198
  default:
@@ -10229,7 +10229,7 @@ class Ir {
10229
10229
  loadingTask: e
10230
10230
  } = this;
10231
10231
  t.on("GetReader", (s, i) => {
10232
- B(this._networkStream, "GetReader - no `IPDFStream` instance available."), this._fullReader = this._networkStream.getFullReader(), this._fullReader.onProgress = (n) => {
10232
+ O(this._networkStream, "GetReader - no `IPDFStream` instance available."), this._fullReader = this._networkStream.getFullReader(), this._fullReader.onProgress = (n) => {
10233
10233
  this._lastProgress = {
10234
10234
  loaded: n.loaded,
10235
10235
  total: n.total
@@ -10243,7 +10243,7 @@ class Ir {
10243
10243
  i.close();
10244
10244
  return;
10245
10245
  }
10246
- B(n instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer."), i.enqueue(new Uint8Array(n), 1, [n]);
10246
+ O(n instanceof ArrayBuffer, "GetReader - expected an ArrayBuffer."), i.enqueue(new Uint8Array(n), 1, [n]);
10247
10247
  }).catch((n) => {
10248
10248
  i.error(n);
10249
10249
  });
@@ -10271,7 +10271,7 @@ class Ir {
10271
10271
  contentLength: r
10272
10272
  };
10273
10273
  }), t.on("GetRangeReader", (s, i) => {
10274
- B(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
10274
+ O(this._networkStream, "GetRangeReader - no `IPDFStream` instance available.");
10275
10275
  const n = this._networkStream.getRangeReader(s.begin, s.end);
10276
10276
  if (!n) {
10277
10277
  i.close();
@@ -10286,7 +10286,7 @@ class Ir {
10286
10286
  i.close();
10287
10287
  return;
10288
10288
  }
10289
- B(r instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer."), i.enqueue(new Uint8Array(r), 1, [r]);
10289
+ O(r instanceof ArrayBuffer, "GetRangeReader - expected an ArrayBuffer."), i.enqueue(new Uint8Array(r), 1, [r]);
10290
10290
  }).catch((r) => {
10291
10291
  i.error(r);
10292
10292
  });
@@ -10345,7 +10345,7 @@ class Ir {
10345
10345
  const {
10346
10346
  imageRef: h
10347
10347
  } = n;
10348
- B(h, "The imageRef must be defined.");
10348
+ O(h, "The imageRef must be defined.");
10349
10349
  for (const c of this.#e.values())
10350
10350
  for (const [, u] of c.objs)
10351
10351
  if (u?.ref === h)
@@ -10710,7 +10710,7 @@ class xt {
10710
10710
  #p(t, e) {
10711
10711
  e.stopPropagation(), this.#o.dispatch("switchannotationeditorparams", {
10712
10712
  source: this,
10713
- type: O.HIGHLIGHT_COLOR,
10713
+ type: B.HIGHLIGHT_COLOR,
10714
10714
  value: t
10715
10715
  }), this.updateColor(t);
10716
10716
  }
@@ -10911,7 +10911,7 @@ class Xe extends Fr {
10911
10911
  return document.createElementNS(It, t);
10912
10912
  }
10913
10913
  }
10914
- const Nr = 9, qt = /* @__PURE__ */ new WeakSet(), Or = (/* @__PURE__ */ new Date()).getTimezoneOffset() * 60 * 1e3;
10914
+ const Nr = 9, qt = /* @__PURE__ */ new WeakSet(), Br = (/* @__PURE__ */ new Date()).getTimezoneOffset() * 60 * 1e3;
10915
10915
  class ps {
10916
10916
  static create(t) {
10917
10917
  switch (t.data.annotationType) {
@@ -11429,7 +11429,7 @@ class K {
11429
11429
  return this.data.rect[3] - this.data.rect[1];
11430
11430
  }
11431
11431
  }
11432
- class Br extends K {
11432
+ class Or extends K {
11433
11433
  constructor(t) {
11434
11434
  super(t, {
11435
11435
  isRenderable: !0,
@@ -11747,7 +11747,7 @@ class $r extends Yt {
11747
11747
  const w = new Date(m), y = [w.getHours(), w.getMinutes(), w.getSeconds()];
11748
11748
  b.value = y.map((v) => v.toString().padStart(2, "0")).join(":");
11749
11749
  } else
11750
- b.value = new Date(m - Or).toISOString().split(l === "date" ? "T" : ".", 1)[0];
11750
+ b.value = new Date(m - Br).toISOString().split(l === "date" ? "T" : ".", 1)[0];
11751
11751
  else
11752
11752
  b.value = m;
11753
11753
  }
@@ -12272,7 +12272,7 @@ class jr {
12272
12272
  signal: t
12273
12273
  });
12274
12274
  }
12275
- #M() {
12275
+ #P() {
12276
12276
  const t = this.#h.find((e) => e.hasCommentButton);
12277
12277
  t && (this.#b = t._normalizePoint(t.commentButtonPosition));
12278
12278
  }
@@ -12281,7 +12281,7 @@ class jr {
12281
12281
  this.#g.parentNode || this.#v.container.after(this.#g);
12282
12282
  return;
12283
12283
  }
12284
- if (this.#b || this.#M(), !this.#b)
12284
+ if (this.#b || this.#P(), !this.#b)
12285
12285
  return;
12286
12286
  const {
12287
12287
  signal: t
@@ -12308,7 +12308,7 @@ class jr {
12308
12308
  const r = this.#g = document.createElement("button");
12309
12309
  r.className = "annotationCommentButton";
12310
12310
  const a = this.#v.container;
12311
- 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.#P(), r.addEventListener("keydown", this.#e, {
12311
+ 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, {
12312
12312
  signal: t
12313
12313
  }), r.addEventListener("click", s, {
12314
12314
  signal: t
@@ -12319,7 +12319,7 @@ class jr {
12319
12319
  }), a.after(r);
12320
12320
  }
12321
12321
  }
12322
- #P() {
12322
+ #M() {
12323
12323
  if (this.#v.extraPopupElement && !this.#v.editor)
12324
12324
  return;
12325
12325
  this.#g || this.renderCommentButton();
@@ -12328,7 +12328,7 @@ class jr {
12328
12328
  } = this.#g;
12329
12329
  s.left = `calc(${t}%)`, s.top = `calc(${e}% - var(--comment-button-dim))`;
12330
12330
  }
12331
- #O() {
12331
+ #B() {
12332
12332
  this.#v.extraPopupElement || (this.#g || this.renderCommentButton(), this.#g.style.backgroundColor = this.commentButtonColor || "");
12333
12333
  }
12334
12334
  get commentButtonColor() {
@@ -12460,7 +12460,7 @@ class jr {
12460
12460
  get #L() {
12461
12461
  return this.#I?.attributes?.style?.fontSize || 0;
12462
12462
  }
12463
- get #B() {
12463
+ get #O() {
12464
12464
  return this.#I?.attributes?.style?.color || null;
12465
12465
  }
12466
12466
  #F(t) {
@@ -12478,7 +12478,7 @@ class jr {
12478
12478
  }
12479
12479
  }, i = {
12480
12480
  style: {
12481
- color: this.#B,
12481
+ color: this.#O,
12482
12482
  fontSize: this.#L ? `calc(${this.#L}px * var(--total-scale-factor))` : ""
12483
12483
  }
12484
12484
  };
@@ -12500,7 +12500,7 @@ class jr {
12500
12500
  deleted: s
12501
12501
  }) {
12502
12502
  if (this.#t) {
12503
- s ? (this.remove(), this.#E = null) : e && (e.deleted ? this.remove() : (this.#O(), this.#E = e.text)), t && (this.#b = null, this.#M(), this.#P());
12503
+ 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());
12504
12504
  return;
12505
12505
  }
12506
12506
  if (s || e?.deleted) {
@@ -13132,7 +13132,7 @@ class zs {
13132
13132
  } = this, {
13133
13133
  id: s,
13134
13134
  rotation: i
13135
- } = t, n = new Br({
13135
+ } = t, n = new Or({
13136
13136
  data: {
13137
13137
  id: s,
13138
13138
  rect: t.getPDFRect(),
@@ -13231,35 +13231,35 @@ class ht extends D {
13231
13231
  }
13232
13232
  static updateDefaultParams(t, e) {
13233
13233
  switch (t) {
13234
- case O.FREETEXT_SIZE:
13234
+ case B.FREETEXT_SIZE:
13235
13235
  ht._defaultFontSize = e;
13236
13236
  break;
13237
- case O.FREETEXT_COLOR:
13237
+ case B.FREETEXT_COLOR:
13238
13238
  ht._defaultColor = e;
13239
13239
  break;
13240
13240
  }
13241
13241
  }
13242
13242
  updateParams(t, e) {
13243
13243
  switch (t) {
13244
- case O.FREETEXT_SIZE:
13244
+ case B.FREETEXT_SIZE:
13245
13245
  this.#a(e);
13246
13246
  break;
13247
- case O.FREETEXT_COLOR:
13247
+ case B.FREETEXT_COLOR:
13248
13248
  this.#r(e);
13249
13249
  break;
13250
13250
  }
13251
13251
  }
13252
13252
  static get defaultPropertiesToUpdate() {
13253
- return [[O.FREETEXT_SIZE, ht._defaultFontSize], [O.FREETEXT_COLOR, ht._defaultColor || D._defaultLineColor]];
13253
+ return [[B.FREETEXT_SIZE, ht._defaultFontSize], [B.FREETEXT_COLOR, ht._defaultColor || D._defaultLineColor]];
13254
13254
  }
13255
13255
  get propertiesToUpdate() {
13256
- return [[O.FREETEXT_SIZE, this.#s], [O.FREETEXT_COLOR, this.color]];
13256
+ return [[B.FREETEXT_SIZE, this.#s], [B.FREETEXT_COLOR, this.color]];
13257
13257
  }
13258
13258
  get toolbarButtons() {
13259
13259
  return this._colorPicker ||= new Ce(this), [["colorPicker", this._colorPicker]];
13260
13260
  }
13261
13261
  get colorType() {
13262
- return O.FREETEXT_COLOR;
13262
+ return B.FREETEXT_COLOR;
13263
13263
  }
13264
13264
  #a(t) {
13265
13265
  const e = (i) => {
@@ -13270,7 +13270,7 @@ class ht extends D {
13270
13270
  undo: e.bind(this, s),
13271
13271
  post: this._uiManager.updateUI.bind(this._uiManager, this),
13272
13272
  mustExec: !0,
13273
- type: O.FREETEXT_SIZE,
13273
+ type: B.FREETEXT_SIZE,
13274
13274
  overwriteIfSameType: !0,
13275
13275
  keepUndo: !0
13276
13276
  });
@@ -13287,7 +13287,7 @@ class ht extends D {
13287
13287
  undo: e.bind(this, s),
13288
13288
  post: this._uiManager.updateUI.bind(this._uiManager, this),
13289
13289
  mustExec: !0,
13290
- type: O.FREETEXT_COLOR,
13290
+ type: B.FREETEXT_COLOR,
13291
13291
  overwriteIfSameType: !0,
13292
13292
  keepUndo: !0
13293
13293
  });
@@ -13634,7 +13634,7 @@ class ht extends D {
13634
13634
  super.resetAnnotationElement(t), t.resetEdited();
13635
13635
  }
13636
13636
  }
13637
- class M {
13637
+ class P {
13638
13638
  static PRECISION = 1e-4;
13639
13639
  toSVGPath() {
13640
13640
  j("Abstract method `toSVGPath` must be implemented.");
@@ -13809,7 +13809,7 @@ class Gt {
13809
13809
  return t.set([NaN, NaN, NaN, NaN, (s[0] - n) / a, (s[1] - r) / o, NaN, NaN, NaN, NaN, h, l, NaN, NaN, NaN, NaN, c, u, NaN, NaN, NaN, NaN, (i[0] - n) / a, (i[1] - r) / o], e), e += 24;
13810
13810
  }
13811
13811
  }
13812
- class Ji extends M {
13812
+ class Ji extends P {
13813
13813
  #t;
13814
13814
  #e = new Float32Array(4);
13815
13815
  #i;
@@ -13841,16 +13841,16 @@ class Ji extends M {
13841
13841
  let o, h;
13842
13842
  switch (n) {
13843
13843
  case 0:
13844
- o = M._rescale(this.#n, t, i, r, -a), h = M._rescale(this.#a, t, i, r, -a);
13844
+ o = P._rescale(this.#n, t, i, r, -a), h = P._rescale(this.#a, t, i, r, -a);
13845
13845
  break;
13846
13846
  case 90:
13847
- o = M._rescaleAndSwap(this.#n, t, e, r, a), h = M._rescaleAndSwap(this.#a, t, e, r, a);
13847
+ o = P._rescaleAndSwap(this.#n, t, e, r, a), h = P._rescaleAndSwap(this.#a, t, e, r, a);
13848
13848
  break;
13849
13849
  case 180:
13850
- o = M._rescale(this.#n, s, e, -r, a), h = M._rescale(this.#a, s, e, -r, a);
13850
+ o = P._rescale(this.#n, s, e, -r, a), h = P._rescale(this.#a, s, e, -r, a);
13851
13851
  break;
13852
13852
  case 270:
13853
- o = M._rescaleAndSwap(this.#n, s, i, -r, -a), h = M._rescaleAndSwap(this.#a, s, i, -r, -a);
13853
+ o = P._rescaleAndSwap(this.#n, s, i, -r, -a), h = P._rescaleAndSwap(this.#a, s, i, -r, -a);
13854
13854
  break;
13855
13855
  }
13856
13856
  return {
@@ -14015,7 +14015,7 @@ class Cs {
14015
14015
  return n;
14016
14016
  }
14017
14017
  }
14018
- class ea extends M {
14018
+ class ea extends P {
14019
14019
  #t;
14020
14020
  #e;
14021
14021
  constructor(t, e, s, i) {
@@ -14210,10 +14210,10 @@ class J extends D {
14210
14210
  }
14211
14211
  static updateDefaultParams(t, e) {
14212
14212
  switch (t) {
14213
- case O.HIGHLIGHT_COLOR:
14213
+ case B.HIGHLIGHT_COLOR:
14214
14214
  J._defaultColor = e;
14215
14215
  break;
14216
- case O.HIGHLIGHT_THICKNESS:
14216
+ case B.HIGHLIGHT_THICKNESS:
14217
14217
  J._defaultThickness = e;
14218
14218
  break;
14219
14219
  }
@@ -14228,19 +14228,19 @@ class J extends D {
14228
14228
  }
14229
14229
  updateParams(t, e) {
14230
14230
  switch (t) {
14231
- case O.HIGHLIGHT_COLOR:
14231
+ case B.HIGHLIGHT_COLOR:
14232
14232
  this.#S(e);
14233
14233
  break;
14234
- case O.HIGHLIGHT_THICKNESS:
14234
+ case B.HIGHLIGHT_THICKNESS:
14235
14235
  this.#_(e);
14236
14236
  break;
14237
14237
  }
14238
14238
  }
14239
14239
  static get defaultPropertiesToUpdate() {
14240
- return [[O.HIGHLIGHT_COLOR, J._defaultColor], [O.HIGHLIGHT_THICKNESS, J._defaultThickness]];
14240
+ return [[B.HIGHLIGHT_COLOR, J._defaultColor], [B.HIGHLIGHT_THICKNESS, J._defaultThickness]];
14241
14241
  }
14242
14242
  get propertiesToUpdate() {
14243
- return [[O.HIGHLIGHT_COLOR, this.color || J._defaultColor], [O.HIGHLIGHT_THICKNESS, this.#g || J._defaultThickness], [O.HIGHLIGHT_FREE, this.#d]];
14243
+ return [[B.HIGHLIGHT_COLOR, this.color || J._defaultColor], [B.HIGHLIGHT_THICKNESS, this.#g || J._defaultThickness], [B.HIGHLIGHT_FREE, this.#d]];
14244
14244
  }
14245
14245
  onUpdatedColor() {
14246
14246
  this.parent?.drawLayer.updateProperties(this.#u, {
@@ -14259,7 +14259,7 @@ class J extends D {
14259
14259
  undo: e.bind(this, s, i),
14260
14260
  post: this._uiManager.updateUI.bind(this._uiManager, this),
14261
14261
  mustExec: !0,
14262
- type: O.HIGHLIGHT_COLOR,
14262
+ type: B.HIGHLIGHT_COLOR,
14263
14263
  overwriteIfSameType: !0,
14264
14264
  keepUndo: !0
14265
14265
  }), this._reportTelemetry({
@@ -14276,7 +14276,7 @@ class J extends D {
14276
14276
  undo: s.bind(this, e),
14277
14277
  post: this._uiManager.updateUI.bind(this._uiManager, this),
14278
14278
  mustExec: !0,
14279
- type: O.INK_THICKNESS,
14279
+ type: B.INK_THICKNESS,
14280
14280
  overwriteIfSameType: !0,
14281
14281
  keepUndo: !0
14282
14282
  }), this._reportTelemetry({
@@ -14296,13 +14296,13 @@ class J extends D {
14296
14296
  super.enableEditing(), this.div.classList.toggle("disabled", !1);
14297
14297
  }
14298
14298
  fixAndSetPosition() {
14299
- return super.fixAndSetPosition(this.#P());
14299
+ return super.fixAndSetPosition(this.#M());
14300
14300
  }
14301
14301
  getBaseTranslation() {
14302
14302
  return [0, 0];
14303
14303
  }
14304
14304
  getRect(t, e) {
14305
- return super.getRect(t, e, this.#P());
14305
+ return super.getRect(t, e, this.#M());
14306
14306
  }
14307
14307
  onceAdded(t) {
14308
14308
  this.annotationElementId || this.parent.addUndoableEditor(this), t && this.div.focus();
@@ -14415,15 +14415,15 @@ class J extends D {
14415
14415
  switch (this.parent.unselect(this), t) {
14416
14416
  case 0:
14417
14417
  case 2:
14418
- this.#M(!0);
14418
+ this.#P(!0);
14419
14419
  break;
14420
14420
  case 1:
14421
14421
  case 3:
14422
- this.#M(!1);
14422
+ this.#P(!1);
14423
14423
  break;
14424
14424
  }
14425
14425
  }
14426
- #M(t) {
14426
+ #P(t) {
14427
14427
  if (!this.#t)
14428
14428
  return;
14429
14429
  const e = window.getSelection();
@@ -14442,7 +14442,7 @@ class J extends D {
14442
14442
  rootClass: {
14443
14443
  selected: !1
14444
14444
  }
14445
- }), this.#d || this.#M(!1));
14445
+ }), this.#d || this.#P(!1));
14446
14446
  }
14447
14447
  get _mustFixPosition() {
14448
14448
  return !this.#d;
@@ -14458,10 +14458,10 @@ class J extends D {
14458
14458
  }
14459
14459
  }));
14460
14460
  }
14461
- #P() {
14461
+ #M() {
14462
14462
  return this.#d ? this.rotation : 0;
14463
14463
  }
14464
- #O() {
14464
+ #B() {
14465
14465
  if (this.#d)
14466
14466
  return null;
14467
14467
  const [t, e] = this.pageDimensions, [s, i] = this.pageTranslation, n = this.#i, r = new Float32Array(n.length * 8);
@@ -14478,7 +14478,7 @@ class J extends D {
14478
14478
  return r;
14479
14479
  }
14480
14480
  #I(t) {
14481
- return this.#h.serialize(t, this.#P());
14481
+ return this.#h.serialize(t, this.#M());
14482
14482
  }
14483
14483
  static startHighlighting(t, e, {
14484
14484
  target: s,
@@ -14491,7 +14491,7 @@ class J extends D {
14491
14491
  width: o,
14492
14492
  height: h
14493
14493
  } = s.getBoundingClientRect(), l = new AbortController(), c = t.combinedSignal(l), u = (p) => {
14494
- l.abort(), this.#B(t, p);
14494
+ l.abort(), this.#O(t, p);
14495
14495
  };
14496
14496
  window.addEventListener("blur", u, {
14497
14497
  signal: c
@@ -14534,7 +14534,7 @@ class J extends D {
14534
14534
  }
14535
14535
  });
14536
14536
  }
14537
- static #B(t, e) {
14537
+ static #O(t, e) {
14538
14538
  this._freeHighlight.isEmpty() ? t.drawLayer.remove(this._freeHighlightId) : t.createAndAddNewEditor(e, !1, {
14539
14539
  highlightId: this._freeHighlightId,
14540
14540
  highlightOutlines: this._freeHighlight.getOutlines(),
@@ -14687,7 +14687,7 @@ class J extends D {
14687
14687
  color: e,
14688
14688
  opacity: this.opacity,
14689
14689
  thickness: this.#g,
14690
- quadPoints: this.#O(),
14690
+ quadPoints: this.#B(),
14691
14691
  outlines: this.#I(s.rect)
14692
14692
  }), this.addComment(s), this.annotationElementId && !this.#F(s) ? null : (s.id = this.annotationElementId, s);
14693
14693
  }
@@ -15086,7 +15086,7 @@ class $ extends D {
15086
15086
  e.drawLayer.updateProperties(i, s.removeLastElement());
15087
15087
  },
15088
15088
  mustExec: !1,
15089
- type: O.DRAW_STEP
15089
+ type: B.DRAW_STEP
15090
15090
  });
15091
15091
  return;
15092
15092
  }
@@ -15097,7 +15097,7 @@ class $ extends D {
15097
15097
  const e = this._currentParent;
15098
15098
  if (!e)
15099
15099
  return null;
15100
- if (e.toggleDrawing(!0), e.cleanUndoStack(O.DRAW_STEP), !$.#i.isEmpty()) {
15100
+ if (e.toggleDrawing(!0), e.cleanUndoStack(B.DRAW_STEP), !$.#i.isEmpty()) {
15101
15101
  const {
15102
15102
  pageDimensions: [s, i],
15103
15103
  scale: n
@@ -15169,7 +15169,7 @@ class ia {
15169
15169
  t === "stroke-width" && (this.#a = e);
15170
15170
  }
15171
15171
  #d(t, e) {
15172
- return M._normalizePoint(t, e, this.#h, this.#u, this.#s);
15172
+ return P._normalizePoint(t, e, this.#h, this.#u, this.#s);
15173
15173
  }
15174
15174
  isEmpty() {
15175
15175
  return !this.#i || this.#i.length === 0;
@@ -15184,7 +15184,7 @@ class ia {
15184
15184
  path: {
15185
15185
  d: this.toSVGPath()
15186
15186
  }
15187
- }) : (isNaN(this.#t[0]) && this.#e.splice(6, 6), this.#t.set([s, i, n, r, t, e], 0), this.#e.push(...M.createBezierPoints(s, i, n, r, t, e)), {
15187
+ }) : (isNaN(this.#t[0]) && this.#e.splice(6, 6), this.#t.set([s, i, n, r, t, e], 0), this.#e.push(...P.createBezierPoints(s, i, n, r, t, e)), {
15188
15188
  path: {
15189
15189
  d: this.toSVGPath()
15190
15190
  }
@@ -15235,7 +15235,7 @@ class ia {
15235
15235
  };
15236
15236
  }
15237
15237
  toSVGPath() {
15238
- const t = M.svgRound(this.#e[4]), e = M.svgRound(this.#e[5]);
15238
+ const t = P.svgRound(this.#e[4]), e = P.svgRound(this.#e[5]);
15239
15239
  if (this.#r.length === 2)
15240
15240
  return this.#n = `${this.#n} M ${t} ${e} Z`, this.#n;
15241
15241
  if (this.#r.length <= 6) {
@@ -15243,13 +15243,13 @@ class ia {
15243
15243
  this.#n = `${this.#n.slice(0, i)} M ${t} ${e}`, this.#o = 6;
15244
15244
  }
15245
15245
  if (this.#r.length === 4) {
15246
- const i = M.svgRound(this.#e[10]), n = M.svgRound(this.#e[11]);
15246
+ const i = P.svgRound(this.#e[10]), n = P.svgRound(this.#e[11]);
15247
15247
  return this.#n = `${this.#n} L ${i} ${n}`, this.#o = 12, this.#n;
15248
15248
  }
15249
15249
  const s = [];
15250
15250
  this.#o === 0 && (s.push(`M ${t} ${e}`), this.#o = 6);
15251
15251
  for (let i = this.#o, n = this.#e.length; i < n; i += 6) {
15252
- const [r, a, o, h, l, c] = this.#e.slice(i, i + 6).map(M.svgRound);
15252
+ const [r, a, o, h, l, c] = this.#e.slice(i, i + 6).map(P.svgRound);
15253
15253
  s.push(`C${r} ${a} ${o} ${h} ${l} ${c}`);
15254
15254
  }
15255
15255
  return this.#n += s.join(" "), this.#o = this.#e.length, this.#n;
@@ -15270,7 +15270,7 @@ class ia {
15270
15270
  };
15271
15271
  }
15272
15272
  }
15273
- class Re extends M {
15273
+ class Re extends P {
15274
15274
  #t;
15275
15275
  #e = 0;
15276
15276
  #i;
@@ -15305,16 +15305,16 @@ class Re extends M {
15305
15305
  for (const {
15306
15306
  line: e
15307
15307
  } of this.#s) {
15308
- if (t.push(`M${M.svgRound(e[4])} ${M.svgRound(e[5])}`), e.length === 6) {
15308
+ if (t.push(`M${P.svgRound(e[4])} ${P.svgRound(e[5])}`), e.length === 6) {
15309
15309
  t.push("Z");
15310
15310
  continue;
15311
15311
  }
15312
15312
  if (e.length === 12 && isNaN(e[6])) {
15313
- t.push(`L${M.svgRound(e[10])} ${M.svgRound(e[11])}`);
15313
+ t.push(`L${P.svgRound(e[10])} ${P.svgRound(e[11])}`);
15314
15314
  continue;
15315
15315
  }
15316
15316
  for (let s = 6, i = e.length; s < i; s += 6) {
15317
- const [n, r, a, o, h, l] = e.subarray(s, s + 6).map(M.svgRound);
15317
+ const [n, r, a, o, h, l] = e.subarray(s, s + 6).map(P.svgRound);
15318
15318
  t.push(`C${n} ${r} ${a} ${o} ${h} ${l}`);
15319
15319
  }
15320
15320
  }
@@ -15325,16 +15325,16 @@ class Re extends M {
15325
15325
  let u, p, f, g, b, m, w, y, v;
15326
15326
  switch (this.#o) {
15327
15327
  case 0:
15328
- v = M._rescale, u = t, p = e + i, f = s, g = -i, b = t + o * s, m = e + (1 - h - c) * i, w = t + (o + l) * s, y = e + (1 - h) * i;
15328
+ v = P._rescale, u = t, p = e + i, f = s, g = -i, b = t + o * s, m = e + (1 - h - c) * i, w = t + (o + l) * s, y = e + (1 - h) * i;
15329
15329
  break;
15330
15330
  case 90:
15331
- v = M._rescaleAndSwap, u = t, p = e, f = s, g = i, b = t + h * s, m = e + o * i, w = t + (h + c) * s, y = e + (o + l) * i;
15331
+ v = P._rescaleAndSwap, u = t, p = e, f = s, g = i, b = t + h * s, m = e + o * i, w = t + (h + c) * s, y = e + (o + l) * i;
15332
15332
  break;
15333
15333
  case 180:
15334
- v = M._rescale, u = t + s, p = e, f = -s, g = i, b = t + (1 - o - l) * s, m = e + h * i, w = t + (1 - o) * s, y = e + (h + c) * i;
15334
+ v = P._rescale, u = t + s, p = e, f = -s, g = i, b = t + (1 - o - l) * s, m = e + h * i, w = t + (1 - o) * s, y = e + (h + c) * i;
15335
15335
  break;
15336
15336
  case 270:
15337
- v = M._rescaleAndSwap, u = t + s, p = e + i, f = -s, g = -i, b = t + (1 - h - c) * s, m = e + (1 - o - l) * i, w = t + (1 - h) * s, y = e + (1 - o) * i;
15337
+ v = P._rescaleAndSwap, u = t + s, p = e + i, f = -s, g = -i, b = t + (1 - h - c) * s, m = e + (1 - o - l) * i, w = t + (1 - h) * s, y = e + (1 - o) * i;
15338
15338
  break;
15339
15339
  }
15340
15340
  for (const {
@@ -15360,16 +15360,16 @@ class Re extends M {
15360
15360
  let c, u, p, f, g;
15361
15361
  switch (o) {
15362
15362
  case 0:
15363
- g = M._rescale, c = -t / s, u = e / i + 1, p = 1 / s, f = -1 / i;
15363
+ g = P._rescale, c = -t / s, u = e / i + 1, p = 1 / s, f = -1 / i;
15364
15364
  break;
15365
15365
  case 90:
15366
- g = M._rescaleAndSwap, c = -e / i, u = -t / s, p = 1 / i, f = 1 / s;
15366
+ g = P._rescaleAndSwap, c = -e / i, u = -t / s, p = 1 / i, f = 1 / s;
15367
15367
  break;
15368
15368
  case 180:
15369
- g = M._rescale, c = t / s + 1, u = -e / i, p = -1 / s, f = 1 / i;
15369
+ g = P._rescale, c = t / s + 1, u = -e / i, p = -1 / s, f = 1 / i;
15370
15370
  break;
15371
15371
  case 270:
15372
- g = M._rescaleAndSwap, c = e / i + 1, u = t / s + 1, p = -1 / i, f = -1 / s;
15372
+ g = P._rescaleAndSwap, c = e / i + 1, u = t / s + 1, p = -1 / i, f = -1 / s;
15373
15373
  break;
15374
15374
  }
15375
15375
  if (!r) {
@@ -15389,8 +15389,8 @@ class Re extends M {
15389
15389
  let [v, A, x, _] = m.subarray(0, 4);
15390
15390
  y.set([NaN, NaN, NaN, NaN, v, A], 0);
15391
15391
  for (let E = 4; E < w; E += 2) {
15392
- const S = m[E], P = m[E + 1];
15393
- y.set(M.createBezierPoints(v, A, x, _, S, P), (E - 2) * 3), [v, A, x, _] = [x, _, S, P];
15392
+ const S = m[E], M = m[E + 1];
15393
+ y.set(P.createBezierPoints(v, A, x, _, S, M), (E - 2) * 3), [v, A, x, _] = [x, _, S, M];
15394
15394
  }
15395
15395
  }
15396
15396
  }
@@ -15455,7 +15455,7 @@ class Re extends M {
15455
15455
  };
15456
15456
  }
15457
15457
  get viewBox() {
15458
- return this.#t.map(M.svgRound).join(" ");
15458
+ return this.#t.map(P.svgRound).join(" ");
15459
15459
  }
15460
15460
  get defaultProperties() {
15461
15461
  const [t, e] = this.#t;
@@ -15464,7 +15464,7 @@ class Re extends M {
15464
15464
  viewBox: this.viewBox
15465
15465
  },
15466
15466
  path: {
15467
- "transform-origin": `${M.svgRound(t)} ${M.svgRound(e)}`
15467
+ "transform-origin": `${P.svgRound(t)} ${P.svgRound(e)}`
15468
15468
  }
15469
15469
  };
15470
15470
  }
@@ -15484,15 +15484,15 @@ class Re extends M {
15484
15484
  default:
15485
15485
  return "";
15486
15486
  }
15487
- return `matrix(${s} ${i} ${n} ${r} ${M.svgRound(a)} ${M.svgRound(o)})`;
15487
+ return `matrix(${s} ${i} ${n} ${r} ${P.svgRound(a)} ${P.svgRound(o)})`;
15488
15488
  }
15489
15489
  getPathResizingSVGProperties([t, e, s, i]) {
15490
15490
  const [n, r] = this.#h(), [a, o, h, l] = this.#t;
15491
- if (Math.abs(h - n) <= M.PRECISION || Math.abs(l - r) <= M.PRECISION) {
15491
+ if (Math.abs(h - n) <= P.PRECISION || Math.abs(l - r) <= P.PRECISION) {
15492
15492
  const g = t + s / 2 - (a + h / 2), b = e + i / 2 - (o + l / 2);
15493
15493
  return {
15494
15494
  path: {
15495
- "transform-origin": `${M.svgRound(t)} ${M.svgRound(e)}`,
15495
+ "transform-origin": `${P.svgRound(t)} ${P.svgRound(e)}`,
15496
15496
  transform: `${this.rotationTransform} translate(${g} ${b})`
15497
15497
  }
15498
15498
  };
@@ -15500,26 +15500,26 @@ class Re extends M {
15500
15500
  const c = (s - 2 * n) / (h - 2 * n), u = (i - 2 * r) / (l - 2 * r), p = h / s, f = l / i;
15501
15501
  return {
15502
15502
  path: {
15503
- "transform-origin": `${M.svgRound(a)} ${M.svgRound(o)}`,
15504
- transform: `${this.rotationTransform} scale(${p} ${f}) translate(${M.svgRound(n)} ${M.svgRound(r)}) scale(${c} ${u}) translate(${M.svgRound(-n)} ${M.svgRound(-r)})`
15503
+ "transform-origin": `${P.svgRound(a)} ${P.svgRound(o)}`,
15504
+ transform: `${this.rotationTransform} scale(${p} ${f}) translate(${P.svgRound(n)} ${P.svgRound(r)}) scale(${c} ${u}) translate(${P.svgRound(-n)} ${P.svgRound(-r)})`
15505
15505
  }
15506
15506
  };
15507
15507
  }
15508
15508
  getPathResizedSVGProperties([t, e, s, i]) {
15509
15509
  const [n, r] = this.#h(), a = this.#t, [o, h, l, c] = a;
15510
- if (a[0] = t, a[1] = e, a[2] = s, a[3] = i, Math.abs(l - n) <= M.PRECISION || Math.abs(c - r) <= M.PRECISION) {
15510
+ if (a[0] = t, a[1] = e, a[2] = s, a[3] = i, Math.abs(l - n) <= P.PRECISION || Math.abs(c - r) <= P.PRECISION) {
15511
15511
  const b = t + s / 2 - (o + l / 2), m = e + i / 2 - (h + c / 2);
15512
15512
  for (const {
15513
15513
  line: w,
15514
15514
  points: y
15515
15515
  } of this.#s)
15516
- M._translate(w, b, m, w), M._translate(y, b, m, y);
15516
+ P._translate(w, b, m, w), P._translate(y, b, m, y);
15517
15517
  return {
15518
15518
  root: {
15519
15519
  viewBox: this.viewBox
15520
15520
  },
15521
15521
  path: {
15522
- "transform-origin": `${M.svgRound(t)} ${M.svgRound(e)}`,
15522
+ "transform-origin": `${P.svgRound(t)} ${P.svgRound(e)}`,
15523
15523
  transform: this.rotationTransform || null,
15524
15524
  d: this.toSVGPath()
15525
15525
  }
@@ -15531,13 +15531,13 @@ class Re extends M {
15531
15531
  line: b,
15532
15532
  points: m
15533
15533
  } of this.#s)
15534
- M._rescale(b, f, g, u, p, b), M._rescale(m, f, g, u, p, m);
15534
+ P._rescale(b, f, g, u, p, b), P._rescale(m, f, g, u, p, m);
15535
15535
  return {
15536
15536
  root: {
15537
15537
  viewBox: this.viewBox
15538
15538
  },
15539
15539
  path: {
15540
- "transform-origin": `${M.svgRound(t)} ${M.svgRound(e)}`,
15540
+ "transform-origin": `${P.svgRound(t)} ${P.svgRound(e)}`,
15541
15541
  transform: this.rotationTransform || null,
15542
15542
  d: this.toSVGPath()
15543
15543
  }
@@ -15550,7 +15550,7 @@ class Re extends M {
15550
15550
  line: h,
15551
15551
  points: l
15552
15552
  } of this.#s)
15553
- M._translate(h, a, o, h), M._translate(l, a, o, l);
15553
+ P._translate(h, a, o, h), P._translate(l, a, o, l);
15554
15554
  else {
15555
15555
  const h = this.#a / i, l = this.#r / n;
15556
15556
  this.#a = i, this.#r = n;
@@ -15558,7 +15558,7 @@ class Re extends M {
15558
15558
  line: c,
15559
15559
  points: u
15560
15560
  } of this.#s)
15561
- M._rescale(c, a, o, h, l, c), M._rescale(u, a, o, h, l, u);
15561
+ P._rescale(c, a, o, h, l, c), P._rescale(u, a, o, h, l, u);
15562
15562
  r[2] *= h, r[3] *= l;
15563
15563
  }
15564
15564
  return r[0] = t, r[1] = e, {
@@ -15567,7 +15567,7 @@ class Re extends M {
15567
15567
  },
15568
15568
  path: {
15569
15569
  d: this.toSVGPath(),
15570
- "transform-origin": `${M.svgRound(t)} ${M.svgRound(e)}`
15570
+ "transform-origin": `${P.svgRound(t)} ${P.svgRound(e)}`
15571
15571
  }
15572
15572
  };
15573
15573
  }
@@ -15582,7 +15582,7 @@ class Re extends M {
15582
15582
  },
15583
15583
  path: {
15584
15584
  d: this.toSVGPath(),
15585
- "transform-origin": `${M.svgRound(t[0])} ${M.svgRound(t[1])}`,
15585
+ "transform-origin": `${P.svgRound(t[0])} ${P.svgRound(t[1])}`,
15586
15586
  transform: this.rotationTransform || null
15587
15587
  },
15588
15588
  bbox: t
@@ -15630,7 +15630,7 @@ class Us extends $ {
15630
15630
  return !0;
15631
15631
  }
15632
15632
  static get typesMap() {
15633
- return L(this, "typesMap", /* @__PURE__ */ new Map([[O.INK_THICKNESS, "stroke-width"], [O.INK_COLOR, "stroke"], [O.INK_OPACITY, "stroke-opacity"]]));
15633
+ return L(this, "typesMap", /* @__PURE__ */ new Map([[B.INK_THICKNESS, "stroke-width"], [B.INK_COLOR, "stroke"], [B.INK_OPACITY, "stroke-opacity"]]));
15634
15634
  }
15635
15635
  static createDrawerInstance(t, e, s, i, n) {
15636
15636
  return new ia(t, e, s, i, n, this._defaultDrawingOptions["stroke-width"]);
@@ -15693,7 +15693,7 @@ class Us extends $ {
15693
15693
  return this._colorPicker ||= new Ce(this), [["colorPicker", this._colorPicker]];
15694
15694
  }
15695
15695
  get colorType() {
15696
- return O.INK_COLOR;
15696
+ return B.INK_COLOR;
15697
15697
  }
15698
15698
  get color() {
15699
15699
  return this._drawingOptions.stroke;
@@ -15776,7 +15776,7 @@ class Us extends $ {
15776
15776
  }), null;
15777
15777
  }
15778
15778
  }
15779
- class Ms extends Re {
15779
+ class Ps extends Re {
15780
15780
  toSVGPath() {
15781
15781
  let t = super.toSVGPath();
15782
15782
  return t.endsWith("Z") || (t += "Z"), t;
@@ -15859,18 +15859,18 @@ class te {
15859
15859
  let A = this.#i[2 * v], x = this.#i[2 * v + 1];
15860
15860
  const _ = l + A, E = c + x;
15861
15861
  f = _, g = E;
15862
- let S = l, P = c;
15862
+ let S = l, M = c;
15863
15863
  for (; ; ) {
15864
- const C = this.#a(r, e, S, P, f, g, 1);
15864
+ const C = this.#a(r, e, S, M, f, g, 1);
15865
15865
  A = this.#i[2 * C], x = this.#i[2 * C + 1];
15866
- const H = S + A, V = P + x;
15866
+ const H = S + A, V = M + x;
15867
15867
  b.push(V, H);
15868
- const N = S * e + P;
15869
- if (r[N + 1] === 0 ? r[N] = -a : r[N] === 1 && (r[N] = a), H === l && V === c && S === _ && P === E) {
15868
+ const N = S * e + M;
15869
+ if (r[N + 1] === 0 ? r[N] = -a : r[N] === 1 && (r[N] = a), H === l && V === c && S === _ && M === E) {
15870
15870
  r[u] !== 1 && (o = Math.abs(r[u]));
15871
15871
  break;
15872
15872
  } else
15873
- f = S, g = P, S = H, P = V;
15873
+ f = S, g = M, S = H, M = V;
15874
15874
  }
15875
15875
  }
15876
15876
  }
@@ -15916,8 +15916,8 @@ class te {
15916
15916
  const S = b + E - h;
15917
15917
  if (S < 0 || S >= e)
15918
15918
  continue;
15919
- const P = t[_ * e + S], C = a[x * r + E] * l[Math.abs(P - w)];
15920
- y += P * C, v += C;
15919
+ const M = t[_ * e + S], C = a[x * r + E] * l[Math.abs(M - w)];
15920
+ y += M * C, v += C;
15921
15921
  }
15922
15922
  }
15923
15923
  const A = p[m] = Math.round(y / v);
@@ -16003,10 +16003,10 @@ class te {
16003
16003
  alpha: !0,
16004
16004
  willReadFrequently: !0
16005
16005
  }), l.font = u, l.filter = "grayscale(1)", l.fillStyle = "white", l.fillRect(0, 0, A, x), l.fillStyle = "black", l.fillText(t, A * (v - 1) / 2, x * (3 - v) / 2);
16006
- const _ = this.#u(l.getImageData(0, 0, A, x).data), E = this.#h(_), S = this.#d(E), P = this.#r(_, A, x, S);
16006
+ const _ = this.#u(l.getImageData(0, 0, A, x).data), E = this.#h(_), S = this.#d(E), M = this.#r(_, A, x, S);
16007
16007
  return this.processDrawnLines({
16008
16008
  lines: {
16009
- curves: P,
16009
+ curves: M,
16010
16010
  width: A,
16011
16011
  height: x
16012
16012
  },
@@ -16064,16 +16064,16 @@ class te {
16064
16064
  A[0] = y[0] * f, A[1] = y[1] * g, x.set([NaN, NaN, NaN, NaN, A[0], A[1]], 0);
16065
16065
  continue;
16066
16066
  }
16067
- let [_, E, S, P] = y;
16068
- _ *= f, E *= g, S *= f, P *= g, A.set([_, E, S, P], 0), x.set([NaN, NaN, NaN, NaN, _, E], 0);
16067
+ let [_, E, S, M] = y;
16068
+ _ *= f, E *= g, S *= f, M *= g, A.set([_, E, S, M], 0), x.set([NaN, NaN, NaN, NaN, _, E], 0);
16069
16069
  for (let C = 4; C < v; C += 2) {
16070
16070
  const H = A[C] = y[C] * f, V = A[C + 1] = y[C + 1] * g;
16071
- x.set(M.createBezierPoints(_, E, S, P, H, V), (C - 2) * 3), [_, E, S, P] = [S, P, H, V];
16071
+ x.set(P.createBezierPoints(_, E, S, M, H, V), (C - 2) * 3), [_, E, S, M] = [S, M, H, V];
16072
16072
  }
16073
16073
  }
16074
16074
  if (u.length === 0)
16075
16075
  return null;
16076
- const m = a ? new Ms() : new Re();
16076
+ const m = a ? new Ps() : new Re();
16077
16077
  return m.build(u, e, s, 1, i, a ? 0 : c, n), {
16078
16078
  outline: m,
16079
16079
  newCurves: b,
@@ -16338,7 +16338,7 @@ class Tt extends $ {
16338
16338
  } = this, {
16339
16339
  outline: a
16340
16340
  } = this.#i = t;
16341
- this.#t = a instanceof Ms, this.description = s;
16341
+ this.#t = a instanceof Ps, this.description = s;
16342
16342
  let o;
16343
16343
  this.#t ? o = Tt.getDefaultDrawingOptions() : (o = Tt._defaultDrawnSignatureOptions.clone(), o.updateProperties({
16344
16344
  "stroke-width": a.thickness
@@ -16427,7 +16427,7 @@ class Tt extends $ {
16427
16427
  }), n;
16428
16428
  }
16429
16429
  static deserializeDraw(t, e, s, i, n, r) {
16430
- return r.areContours ? Ms.deserialize(t, e, s, i, n, r) : Re.deserialize(t, e, s, i, n, r);
16430
+ return r.areContours ? Ps.deserialize(t, e, s, i, n, r) : Re.deserialize(t, e, s, i, n, r);
16431
16431
  }
16432
16432
  static async deserialize(t, e, s) {
16433
16433
  const i = await super.deserialize(t, e, s);
@@ -16773,13 +16773,13 @@ class na extends D {
16773
16773
  pageNumber: S
16774
16774
  }
16775
16775
  },
16776
- canvas: P
16776
+ canvas: M
16777
16777
  } = t;
16778
16778
  let C, H;
16779
- P ? (delete t.canvas, {
16779
+ M ? (delete t.canvas, {
16780
16780
  id: C,
16781
16781
  bitmap: H
16782
- } = s.imageManager.getFromCanvas(E.id, P), P.remove()) : (n = !0, t._hasNoCanvas = !0);
16782
+ } = s.imageManager.getFromCanvas(E.id, M), M.remove()) : (n = !0, t._hasNoCanvas = !0);
16783
16783
  const V = (await e._structTree.getAriaAttributes(`${ee}${m}`))?.get("aria-label") || "";
16784
16784
  i = t = {
16785
16785
  annotationType: F.STAMP,
@@ -17506,11 +17506,11 @@ globalThis._pdfjsTestingUtils = {
17506
17506
  globalThis.pdfjsLib = {
17507
17507
  AbortException: $t,
17508
17508
  AnnotationEditorLayer: Lt,
17509
- AnnotationEditorParamsType: O,
17509
+ AnnotationEditorParamsType: B,
17510
17510
  AnnotationEditorType: F,
17511
17511
  AnnotationEditorUIManager: zt,
17512
17512
  AnnotationLayer: zs,
17513
- AnnotationMode: Bt,
17513
+ AnnotationMode: Ot,
17514
17514
  AnnotationType: it,
17515
17515
  applyOpacity: Tn,
17516
17516
  build: Lr,
@@ -17520,8 +17520,8 @@ globalThis.pdfjsLib = {
17520
17520
  DOMSVGFactory: Xe,
17521
17521
  DrawLayer: lt,
17522
17522
  FeatureTest: at,
17523
- fetchData: Me,
17524
- findContrastColor: Mn,
17523
+ fetchData: Pe,
17524
+ findContrastColor: Pn,
17525
17525
  getDocument: Ui,
17526
17526
  getFilenameFromUrl: vn,
17527
17527
  getPdfFilenameFromUrl: An,
@@ -17876,9 +17876,10 @@ class ca {
17876
17876
  this.element.appendChild(e), this.fieldElements.set(t.id, e);
17877
17877
  });
17878
17878
  }
17879
+ selectedFieldId = null;
17879
17880
  createFieldElement(t) {
17880
17881
  const e = document.createElement("div");
17881
- 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);
17882
+ 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);
17882
17883
  const s = document.createElement("div");
17883
17884
  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")
17884
17885
  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";
@@ -17891,12 +17892,20 @@ class ca {
17891
17892
  const i = document.createElement("img");
17892
17893
  i.src = t.content || "", i.style.maxWidth = "100%", i.style.maxHeight = "100%", i.style.pointerEvents = "none", s.appendChild(i);
17893
17894
  }
17894
- return e.appendChild(s), t.resizable !== !1 && this.addResizeHandles(e), t.deletable !== !1 && this.addDeleteButton(e, t.id), this.updateElementPosition(e, t), e;
17895
+ return e.addEventListener("mousedown", (i) => {
17896
+ this.eventBus.emit("field:focus", { fieldId: t.id });
17897
+ }), e.addEventListener("touchstart", (i) => {
17898
+ this.eventBus.emit("field:focus", { fieldId: t.id });
17899
+ }, { passive: !1 }), e.appendChild(s), t.resizable !== !1 && this.addResizeHandles(e), t.deletable !== !1 && this.addDeleteButton(e, t.id), e.addEventListener("mouseenter", () => {
17900
+ this.selectedFieldId !== t.id && this.updateVisuals(e, t, !0, !1);
17901
+ }), e.addEventListener("mouseleave", () => {
17902
+ this.selectedFieldId !== t.id && this.updateVisuals(e, t, !1, !1);
17903
+ }), this.updateElementPosition(e, t), this.selectedFieldId === t.id && this.updateVisuals(e, t, !0, !0), e;
17895
17904
  }
17896
17905
  addResizeHandles(t) {
17897
17906
  ["nw", "ne", "sw", "se", "n", "e", "s", "w"].forEach((e) => {
17898
17907
  const s = document.createElement("div");
17899
- 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";
17908
+ 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";
17900
17909
  const i = "8px", n = "6px", r = "14px";
17901
17910
  switch (e) {
17902
17911
  // Corners
@@ -17931,12 +17940,25 @@ class ca {
17931
17940
  }
17932
17941
  addDeleteButton(t, e) {
17933
17942
  const s = document.createElement("div");
17934
- 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) => {
17943
+ 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) => {
17935
17944
  i.preventDefault(), i.stopPropagation(), this.eventBus.emit("field:delete", { fieldId: e });
17936
17945
  }), s.addEventListener("touchstart", (i) => {
17937
17946
  i.preventDefault(), i.stopPropagation(), this.eventBus.emit("field:delete", { fieldId: e });
17938
17947
  }, { passive: !1 }), t.appendChild(s);
17939
17948
  }
17949
+ select(t) {
17950
+ this.selectedFieldId = t, this.fields.forEach((e) => {
17951
+ const s = this.fieldElements.get(e.id);
17952
+ if (!s) return;
17953
+ const i = e.id === t;
17954
+ this.updateVisuals(s, e, i, i);
17955
+ });
17956
+ }
17957
+ updateVisuals(t, e, s, i) {
17958
+ t.querySelectorAll(".sc-resize-handle").forEach((r) => r.style.display = s ? "block" : "none");
17959
+ const n = t.querySelector(".sc-delete-btn");
17960
+ 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)");
17961
+ }
17940
17962
  updatePositions() {
17941
17963
  this.pageHeight !== 0 && this.fields.forEach((t) => {
17942
17964
  const e = this.fieldElements.get(t.id);
@@ -17971,7 +17993,7 @@ class tn {
17971
17993
  eventBus;
17972
17994
  element;
17973
17995
  constructor(t) {
17974
- 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 aa(), this.element.appendChild(this.canvasLayer.getElement()), this.signatureLayer = new ca(this.eventBus), this.element.appendChild(this.signatureLayer.getElement()), t.pageDimensions && this.signatureLayer.setPageDimensions(
17996
+ 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 aa(), this.element.appendChild(this.canvasLayer.getElement()), this.signatureLayer = new ca(this.eventBus), this.element.appendChild(this.signatureLayer.getElement()), t.pageDimensions && this.signatureLayer.setPageDimensions(
17975
17997
  t.pageDimensions.width,
17976
17998
  t.pageDimensions.height,
17977
17999
  this.scale
@@ -17985,6 +18007,9 @@ class tn {
17985
18007
  setFields(t) {
17986
18008
  this.signatureLayer.setFields(t);
17987
18009
  }
18010
+ selectField(t) {
18011
+ this.signatureLayer.select(t);
18012
+ }
17988
18013
  async render() {
17989
18014
  if (!this.pdfPage) return;
17990
18015
  const t = this.pdfPage.getViewport({ scale: this.scale });
@@ -18047,7 +18072,7 @@ class da {
18047
18072
  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();
18048
18073
  }
18049
18074
  initContainer() {
18050
- 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);
18075
+ 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);
18051
18076
  }
18052
18077
  async renderCurrentPage() {
18053
18078
  this.pageView && (this.pageView.destroy(), this.pageView = null), this.pageContainer.innerHTML = "";
@@ -18059,7 +18084,7 @@ class da {
18059
18084
  eventBus: this.eventBus,
18060
18085
  pageDimensions: e
18061
18086
  });
18062
- const s = this.fields.filter((i) => i.pageIndex === t);
18087
+ const s = this.fields.filter((i) => i.pageNumber === t + 1);
18063
18088
  this.pageView.setFields(s), this.pdfDocument.getPage(this.currentPage).then((i) => {
18064
18089
  this.pageView && this.pageView.pageIndex === i.pageNumber - 1 && this.pageView.setPdfPage(i);
18065
18090
  }).catch((i) => {
@@ -18085,7 +18110,10 @@ class da {
18085
18110
  return this.totalPages;
18086
18111
  }
18087
18112
  setScale(t) {
18088
- this.scale = t, this.pageView && this.pageView.updateScalePreview(t), this.eventBus.emit("scale:change", { scale: t }), this.zoomTimeout && clearTimeout(this.zoomTimeout), this.zoomTimeout = setTimeout(() => {
18113
+ 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, c = s / e;
18114
+ this.scale = t, this.pageView && this.pageView.updateScalePreview(t), this.eventBus.emit("scale:change", { scale: t });
18115
+ const u = h * c - n / 2, p = l * c - r / 2;
18116
+ i.scrollLeft = u, i.scrollTop = p, this.zoomTimeout && clearTimeout(this.zoomTimeout), this.zoomTimeout = setTimeout(() => {
18089
18117
  this.pageView && this.pageView.updateScaleFull(t), this.zoomTimeout = null;
18090
18118
  }, 150);
18091
18119
  }
@@ -18094,10 +18122,13 @@ class da {
18094
18122
  }
18095
18123
  setFields(t) {
18096
18124
  if (this.fields = t, this.pageView) {
18097
- const e = this.fields.filter((s) => s.pageIndex === this.currentPage - 1);
18125
+ const e = this.fields.filter((s) => s.pageNumber === this.currentPage);
18098
18126
  this.pageView.setFields(e);
18099
18127
  }
18100
18128
  }
18129
+ selectField(t) {
18130
+ this.pageView?.selectField(t);
18131
+ }
18101
18132
  destroy() {
18102
18133
  this.zoomTimeout && (clearTimeout(this.zoomTimeout), this.zoomTimeout = null), this.pageView && (this.pageView.destroy(), this.pageView = null), this.container.innerHTML = "";
18103
18134
  }
@@ -18119,7 +18150,7 @@ class ua {
18119
18150
  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();
18120
18151
  }
18121
18152
  initContainer() {
18122
- 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;
18153
+ 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;
18123
18154
  }
18124
18155
  async renderAllPages() {
18125
18156
  this.pageViews.forEach((t) => t.destroy()), this.pageViews = [];
@@ -18131,7 +18162,7 @@ class ua {
18131
18162
  eventBus: this.eventBus,
18132
18163
  pageDimensions: e
18133
18164
  // Pass dimensions immediately
18134
- }), i = this.fields.filter((n) => n.pageIndex === t - 1);
18165
+ }), i = this.fields.filter((n) => n.pageNumber === t);
18135
18166
  s.setFields(i), this.pageViews.push(s);
18136
18167
  }
18137
18168
  this.pageViews.forEach(async (t, e) => {
@@ -18195,8 +18226,28 @@ class ua {
18195
18226
  return this.totalPages;
18196
18227
  }
18197
18228
  setScale(t) {
18198
- 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(() => {
18199
- this.pageViews.forEach((e) => e.updateScaleFull(t)), this.zoomTimeout = null;
18229
+ const e = this.scale, s = this.container, i = s.clientHeight, n = s.scrollTop + i / 2;
18230
+ let r = -1, a = 0;
18231
+ for (let o = 0; o < this.pageViews.length; o++) {
18232
+ const h = this.pageViews[o], l = h.element.offsetTop, c = h.element.offsetHeight, u = l + c;
18233
+ if (n < u) {
18234
+ r = o, a = (n - l) / c;
18235
+ break;
18236
+ }
18237
+ }
18238
+ if (r === -1 && this.pageViews.length > 0) {
18239
+ r = this.pageViews.length - 1;
18240
+ const o = this.pageViews[r];
18241
+ a = (n - o.element.offsetTop) / o.element.offsetHeight;
18242
+ }
18243
+ if (this.scale = t, this.pageViews.forEach((o) => o.updateScalePreview(t)), this.eventBus.emit("scale:change", { scale: t }), r !== -1) {
18244
+ const o = this.pageViews[r], h = o.element.offsetTop, l = o.element.offsetHeight, c = h + a * l;
18245
+ s.scrollTop = c - i / 2;
18246
+ const u = s.clientWidth, p = s.scrollLeft + u / 2, f = t / e;
18247
+ s.scrollLeft = p * f - u / 2;
18248
+ }
18249
+ this.zoomTimeout && clearTimeout(this.zoomTimeout), this.zoomTimeout = setTimeout(() => {
18250
+ this.pageViews.forEach((o) => o.updateScaleFull(t)), this.zoomTimeout = null;
18200
18251
  }, 150);
18201
18252
  }
18202
18253
  getScale() {
@@ -18204,10 +18255,13 @@ class ua {
18204
18255
  }
18205
18256
  setFields(t) {
18206
18257
  this.fields = t, this.pageViews.forEach((e) => {
18207
- const s = this.fields.filter((i) => i.pageIndex === e.pageIndex);
18258
+ const s = this.fields.filter((i) => i.pageNumber === e.pageIndex + 1);
18208
18259
  e.setFields(s);
18209
18260
  });
18210
18261
  }
18262
+ selectField(t) {
18263
+ this.pageViews.forEach((e) => e.selectField(t));
18264
+ }
18211
18265
  destroy() {
18212
18266
  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 = "";
18213
18267
  }
@@ -18224,6 +18278,7 @@ class pa {
18224
18278
  readyPromise = null;
18225
18279
  currentScale = 1;
18226
18280
  isDestroyed = !1;
18281
+ selectedFieldId = null;
18227
18282
  constructor(t) {
18228
18283
  this.container = t.container, this.eventBus = new rn(), this.loader = new ra(t.pdfLoaderOptions), this.currentViewMode = t.viewMode ?? "scroll", t.fields && (this.fields = [...t.fields]), this.zoomHandler = new an({
18229
18284
  container: this.container,
@@ -18235,6 +18290,11 @@ class pa {
18235
18290
  this.handleFieldDrop(e.fieldId, e.clientX, e.clientY, e.elementX, e.elementY);
18236
18291
  }), this.eventBus.on("field:ui:resize", (e) => {
18237
18292
  this.updateField(e.fieldId, e.updates);
18293
+ }), this.eventBus.on("field:focus", (e) => {
18294
+ this.selectField(e.fieldId);
18295
+ }), this.container.addEventListener("mousedown", (e) => {
18296
+ const s = e.target;
18297
+ s.closest(".sc-signature-field") || s.closest(".sc-resize-handle") || s.closest(".sc-delete-btn") || this.selectField(null);
18238
18298
  });
18239
18299
  }
18240
18300
  async load(t) {
@@ -18261,7 +18321,7 @@ class pa {
18261
18321
  this.strategy.destroy();
18262
18322
  return;
18263
18323
  }
18264
- this.fields.length > 0 && this.strategy.setFields(this.fields);
18324
+ this.fields.length > 0 && this.strategy.setFields(this.fields), this.selectedFieldId && this.strategy.selectField(this.selectedFieldId);
18265
18325
  }
18266
18326
  }
18267
18327
  createStrategy(t) {
@@ -18330,15 +18390,15 @@ class pa {
18330
18390
  throw new Error("PDF document not loaded");
18331
18391
  if (!this.strategy)
18332
18392
  throw new Error("PDF viewer not ready. Please wait for PDF to fully load.");
18333
- if (this.readyPromise && await this.readyPromise, t.pageIndex < 0 || t.pageIndex >= this.pdfDocument.numPages)
18334
- throw new Error(`Invalid page index: ${t.pageIndex}. Document has ${this.pdfDocument.numPages} pages.`);
18393
+ if (this.readyPromise && await this.readyPromise, typeof t.pageNumber != "number" || isNaN(t.pageNumber) || t.pageNumber < 1 || t.pageNumber > this.pdfDocument.numPages)
18394
+ throw new Error(`Invalid page number: ${t.pageNumber}. Document has ${this.pdfDocument.numPages} pages.`);
18335
18395
  if (t.rect.width <= 0 || t.rect.height <= 0)
18336
18396
  throw new Error("Field width and height must be greater than 0");
18337
18397
  try {
18338
- let e = this.pageInfo.get(t.pageIndex);
18398
+ let e = this.pageInfo.get(t.pageNumber - 1);
18339
18399
  if (!e) {
18340
- const s = (await this.pdfDocument.getPage(t.pageIndex + 1)).getViewport({ scale: 1 });
18341
- this.pageInfo.set(t.pageIndex, { width: s.width, height: s.height }), e = { width: s.width, height: s.height };
18400
+ const s = (await this.pdfDocument.getPage(t.pageNumber)).getViewport({ scale: 1 });
18401
+ this.pageInfo.set(t.pageNumber - 1, { width: s.width, height: s.height }), e = { width: s.width, height: s.height };
18342
18402
  }
18343
18403
  if (t.rect.x < 0 || t.rect.y < 0)
18344
18404
  throw new Error("Field position out of bounds (negative coordinates).");
@@ -18352,12 +18412,22 @@ class pa {
18352
18412
  this.fields.push(t), this.strategy?.setFields(this.fields), this.eventBus.emit("field:add", t), this.eventBus.emit("fields:change", this.fields);
18353
18413
  }
18354
18414
  removeField(t) {
18355
- 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);
18415
+ 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);
18356
18416
  }
18357
18417
  updateField(t, e) {
18358
18418
  const s = this.fields.findIndex((i) => i.id === t);
18359
18419
  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));
18360
18420
  }
18421
+ selectField(t) {
18422
+ if (this.selectedFieldId === t)
18423
+ return;
18424
+ this.selectedFieldId = t, this.strategy?.selectField(t);
18425
+ let e = null;
18426
+ 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 });
18427
+ }
18428
+ clearFields() {
18429
+ this.selectField(null), this.fields = [], this.strategy?.setFields(this.fields), this.eventBus.emit("fields:change", this.fields);
18430
+ }
18361
18431
  handleFieldDrop(t, e, s, i, n) {
18362
18432
  const r = this.fields.find((v) => v.id === t);
18363
18433
  if (!r) return;
@@ -18366,7 +18436,7 @@ class pa {
18366
18436
  const v = Array.from(this.container.querySelectorAll(".page-view"));
18367
18437
  let A = 1 / 0, x = null;
18368
18438
  if (v.forEach((_) => {
18369
- const E = _.getBoundingClientRect(), S = Math.max(E.left, Math.min(i, E.right)), P = Math.max(E.top, Math.min(n, E.bottom)), C = i - S, H = n - P, V = Math.sqrt(C * C + H * H);
18439
+ const E = _.getBoundingClientRect(), S = Math.max(E.left, Math.min(i, E.right)), M = Math.max(E.top, Math.min(n, E.bottom)), C = i - S, H = n - M, V = Math.sqrt(C * C + H * H);
18370
18440
  V < A && (A = V, x = _);
18371
18441
  }), x)
18372
18442
  a = x;
@@ -18380,10 +18450,10 @@ class pa {
18380
18450
  this.strategy?.setFields(this.fields);
18381
18451
  return;
18382
18452
  }
18383
- const h = parseInt(o, 10), l = a.getBoundingClientRect(), c = this.currentScale, u = i - l.left, p = n - l.top, f = l.height / c, g = l.width / c, b = r.rect.width, m = r.rect.height;
18453
+ const h = parseInt(o, 10) + 1, l = a.getBoundingClientRect(), c = this.currentScale, u = i - l.left, p = n - l.top, f = l.height / c, g = l.width / c, b = r.rect.width, m = r.rect.height;
18384
18454
  let w = u / c, y = f - p / c - m;
18385
18455
  w = Math.max(0, Math.min(w, g - b)), y = Math.max(0, Math.min(y, f - m)), this.updateField(t, {
18386
- pageIndex: h,
18456
+ pageNumber: h,
18387
18457
  rect: {
18388
18458
  ...r.rect,
18389
18459
  x: w,
@@ -18467,7 +18537,7 @@ class pa {
18467
18537
  const u = document.createElement("div");
18468
18538
  u.className = "print-page";
18469
18539
  const p = document.createElement("img");
18470
- p.src = l.toDataURL("image/jpeg", 0.8), u.appendChild(p), t?.withSignatures && this.fields.filter((f) => f.pageIndex === a - 1).forEach((f) => {
18540
+ p.src = l.toDataURL("image/jpeg", 0.8), u.appendChild(p), t?.withSignatures && this.fields.filter((f) => f.pageNumber === a).forEach((f) => {
18471
18541
  const g = document.createElement("div");
18472
18542
  g.className = "print-field select-none";
18473
18543
  const b = o.getViewport({ scale: 1 }), m = f.rect.x / b.width * 100, w = (b.height - f.rect.y - f.rect.height) / b.height * 100, y = f.rect.width / b.width * 100, v = f.rect.height / b.height * 100;
@@ -18538,7 +18608,7 @@ class ga {
18538
18608
  return this.viewer.getScale();
18539
18609
  }
18540
18610
  async getPageDimensions(t) {
18541
- return this.viewer.getPageDimensions(t);
18611
+ return this.viewer.getPageDimensions(t - 1);
18542
18612
  }
18543
18613
  // Event handling
18544
18614
  on(t, e) {
@@ -18563,6 +18633,9 @@ class ga {
18563
18633
  updateField(t, e) {
18564
18634
  this.viewer.updateField(t, e);
18565
18635
  }
18636
+ clearFields() {
18637
+ this.viewer.clearFields();
18638
+ }
18566
18639
  async print(t) {
18567
18640
  return this.viewer.print(t);
18568
18641
  }