@component-hook/pdf-canvas 1.5.1 → 1.6.0

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.
@@ -6518,8 +6518,8 @@ var xs, Ss = class e extends _s {
6518
6518
  return 1;
6519
6519
  }
6520
6520
  get2DCursorLocation(e, t) {
6521
- let n = t ? this._unwrappedTextLines : this._textLines, r;
6522
- for (r = 0; r < n.length; r++) {
6521
+ let n = t ? this._unwrappedTextLines : this._textLines, r = 0;
6522
+ for (; r < n.length; r++) {
6523
6523
  if (e <= n[r].length) return {
6524
6524
  lineIndex: r,
6525
6525
  charIndex: e
@@ -7935,8 +7935,8 @@ var Ls = class e extends Is {
7935
7935
  _wrapLine(e, t, { largestWordWidth: n, wordsData: r }, i = 0) {
7936
7936
  let a = this._getWidthOfCharSpacing(), o = this.splitByGrapheme, s = [], c = o ? "" : " ", l = 0, u = [], d = 0, f = 0, p = !0;
7937
7937
  t -= i;
7938
- let m = Math.max(t, n, this.dynamicMinWidth), h = r[e], g;
7939
- for (g = 0; g < h.length; g++) {
7938
+ let m = Math.max(t, n, this.dynamicMinWidth), h = r[e], g = 0;
7939
+ for (; g < h.length; g++) {
7940
7940
  let { word: t, width: n } = h[g];
7941
7941
  d += t.length, l += f + n - a, l > m && !p ? (s.push(u), u = [], l = n, p = !0) : l += a, p || o || u.push(c), u = u.concat(t), f = o ? 0 : this._measureWord([c], e, d), d++, p = !1;
7942
7942
  }
@@ -10803,7 +10803,7 @@ var ou = class {
10803
10803
  let n = this.callbacks.get(this.#e(t));
10804
10804
  if (!n) return;
10805
10805
  let { callback: r, options: { bubbles: i = !1, args: a = [], checker: o = null } } = n;
10806
- o && !o(e, t) || (r.bind(e, ...a, t)(), i || Yl(t));
10806
+ (!o || o(e, t)) && (r.bind(e, ...a, t)(), i || Yl(t));
10807
10807
  }
10808
10808
  }, uu = class e {
10809
10809
  static _colorsMapping = /* @__PURE__ */ new Map([["CanvasText", [
@@ -11696,7 +11696,7 @@ var ou = class {
11696
11696
  let t = this.#o?.get(e.data.id);
11697
11697
  if (!t) return;
11698
11698
  let n = this.#a.getRawValue(t);
11699
- n && (this.#j === H.NONE && !n.hasBeenModified || n.renderAnnotationElement(e));
11699
+ n && (this.#j !== H.NONE || n.hasBeenModified) && n.renderAnnotationElement(e);
11700
11700
  }
11701
11701
  }, fu = class e {
11702
11702
  #e = null;
@@ -12893,7 +12893,7 @@ var ou = class {
12893
12893
  get modifiedIds() {
12894
12894
  if (this.#t) return this.#t;
12895
12895
  let e = [];
12896
- for (let t of this.#n.values()) !(t instanceof Z) || !t.annotationElementId || !t.serialize() || e.push(t.annotationElementId);
12896
+ for (let t of this.#n.values()) t instanceof Z && t.annotationElementId && t.serialize() && e.push(t.annotationElementId);
12897
12897
  return this.#t = {
12898
12898
  ids: new Set(e),
12899
12899
  hash: e.join(",")
@@ -12943,7 +12943,7 @@ var ou = class {
12943
12943
  this.nativeFontFaces.clear(), this.#e.clear(), this.styleElement &&= (this.styleElement.remove(), null);
12944
12944
  }
12945
12945
  async loadSystemFont({ systemFontInfo: e, _inspectFont: t }) {
12946
- if (!(!e || this.#e.has(e.loadedName))) {
12946
+ if (e && !this.#e.has(e.loadedName)) {
12947
12947
  if (q(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
12948
12948
  let { loadedName: n, src: r, style: i } = e, a = new FontFace(n, r, i);
12949
12949
  this.addNativeFontFace(a);
@@ -14593,8 +14593,8 @@ var hd = [
14593
14593
  i.fillText(n.join(""), 0, 0), t.x += r * m * l, i.restore(), this.compose();
14594
14594
  return;
14595
14595
  }
14596
- let b = 0, x;
14597
- for (x = 0; x < u; ++x) {
14596
+ let b = 0, x = 0;
14597
+ for (; x < u; ++x) {
14598
14598
  let t = e[x];
14599
14599
  if (typeof t == "number") {
14600
14600
  b += f * t * r / 1e3;
@@ -20085,7 +20085,7 @@ var Rf = class {
20085
20085
  this.setDims(this.width * t, this.height * n);
20086
20086
  }
20087
20087
  #C() {
20088
- this.#u === null || !this.parent || (this.parent.drawLayer.remove(this.#u), this.#u = null, this.parent.drawLayer.remove(this.#m), this.#m = null);
20088
+ this.#u !== null && this.parent && (this.parent.drawLayer.remove(this.#u), this.#u = null, this.parent.drawLayer.remove(this.#m), this.#m = null);
20089
20089
  }
20090
20090
  #w(e = this.parent) {
20091
20091
  this.#u === null && ({id: this.#u, clipPathId: this.#r} = e.drawLayer.draw({
@@ -20517,7 +20517,7 @@ var Rf = class {
20517
20517
  this.parent && !e ? (this._uiManager.removeShouldRescale(this), this.#d()) : e && (this._uiManager.addShouldRescale(this), this.#f(e), t = !this.parent && this.div?.classList.contains("selectedEditor")), super.setParent(e), t && this.select();
20518
20518
  }
20519
20519
  #d() {
20520
- this._drawId === null || !this.parent || (this.parent.drawLayer.remove(this._drawId), this._drawId = null, this._drawingOptions.reset());
20520
+ this._drawId !== null && this.parent && (this.parent.drawLayer.remove(this._drawId), this._drawId = null, this._drawingOptions.reset());
20521
20521
  }
20522
20522
  #f(e = this.parent) {
20523
20523
  if (this._drawId === null || this.parent !== e) {
@@ -22208,7 +22208,7 @@ function Rp(e) {
22208
22208
  //#region src/shared/utils/pdf-js.ts
22209
22209
  Bp() || (jp.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${Np}/pdf.worker.min.mjs`);
22210
22210
  function zp() {
22211
- if (typeof window > "u") return !0;
22211
+ if (globalThis.window === void 0) return !0;
22212
22212
  try {
22213
22213
  return window.self === window.top;
22214
22214
  } catch {
@@ -22233,7 +22233,7 @@ function Vp(e, t) {
22233
22233
  async function Hp({ data: e, password: t, id: n, page: r, units: i, scale: a }) {
22234
22234
  let o = new Worker(new URL(
22235
22235
  /* @vite-ignore */
22236
- "" + new URL("assets/pdfjs.worker-QHzJtIzr.js", import.meta.url).href,
22236
+ new URL("assets/pdfjs.worker-C9mOuiOj.js", import.meta.url).href,
22237
22237
  "" + import.meta.url
22238
22238
  ), { type: "module" });
22239
22239
  try {
@@ -22369,7 +22369,7 @@ function Qp(e, t) {
22369
22369
  t.top = i - a * s / 2, t.left = r - o * c / 2, t.setCoords();
22370
22370
  }
22371
22371
  function $p(e, t, n) {
22372
- !n || !e || (n.scale(1 / t), Qp(e, n));
22372
+ n && e && (n.scale(1 / t), Qp(e, n));
22373
22373
  }
22374
22374
  function em(e, t) {
22375
22375
  if (!e) return;
@@ -22545,7 +22545,7 @@ function fm(e) {
22545
22545
  ...e
22546
22546
  };
22547
22547
  let n = Wp.get(t);
22548
- !c || !l || !n || S({
22548
+ c && l && n && S({
22549
22549
  target: l,
22550
22550
  canvas: n
22551
22551
  });