@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.
@@ -6519,8 +6519,8 @@ var ps, ms = class e extends ls {
6519
6519
  return 1;
6520
6520
  }
6521
6521
  get2DCursorLocation(e, t) {
6522
- let n = t ? this._unwrappedTextLines : this._textLines, r;
6523
- for (r = 0; r < n.length; r++) {
6522
+ let n = t ? this._unwrappedTextLines : this._textLines, r = 0;
6523
+ for (; r < n.length; r++) {
6524
6524
  if (e <= n[r].length) return {
6525
6525
  lineIndex: r,
6526
6526
  charIndex: e
@@ -7936,8 +7936,8 @@ var ks = class e extends Os {
7936
7936
  _wrapLine(e, t, { largestWordWidth: n, wordsData: r }, i = 0) {
7937
7937
  let a = this._getWidthOfCharSpacing(), o = this.splitByGrapheme, s = [], c = o ? "" : " ", l = 0, u = [], d = 0, f = 0, p = !0;
7938
7938
  t -= i;
7939
- let m = Math.max(t, n, this.dynamicMinWidth), h = r[e], g;
7940
- for (g = 0; g < h.length; g++) {
7939
+ let m = Math.max(t, n, this.dynamicMinWidth), h = r[e], g = 0;
7940
+ for (; g < h.length; g++) {
7941
7941
  let { word: t, width: n } = h[g];
7942
7942
  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;
7943
7943
  }
@@ -10804,7 +10804,7 @@ var $l = class {
10804
10804
  let n = this.callbacks.get(this.#e(t));
10805
10805
  if (!n) return;
10806
10806
  let { callback: r, options: { bubbles: i = !1, args: a = [], checker: o = null } } = n;
10807
- o && !o(e, t) || (r.bind(e, ...a, t)(), i || Hl(t));
10807
+ (!o || o(e, t)) && (r.bind(e, ...a, t)(), i || Hl(t));
10808
10808
  }
10809
10809
  }, ru = class e {
10810
10810
  static _colorsMapping = /* @__PURE__ */ new Map([["CanvasText", [
@@ -11697,7 +11697,7 @@ var $l = class {
11697
11697
  let t = this.#o?.get(e.data.id);
11698
11698
  if (!t) return;
11699
11699
  let n = this.#a.getRawValue(t);
11700
- n && (this.#j === U.NONE && !n.hasBeenModified || n.renderAnnotationElement(e));
11700
+ n && (this.#j !== U.NONE || n.hasBeenModified) && n.renderAnnotationElement(e);
11701
11701
  }
11702
11702
  }, au = class e {
11703
11703
  #e = null;
@@ -12894,7 +12894,7 @@ var $l = class {
12894
12894
  get modifiedIds() {
12895
12895
  if (this.#t) return this.#t;
12896
12896
  let e = [];
12897
- for (let t of this.#n.values()) !(t instanceof Z) || !t.annotationElementId || !t.serialize() || e.push(t.annotationElementId);
12897
+ for (let t of this.#n.values()) t instanceof Z && t.annotationElementId && t.serialize() && e.push(t.annotationElementId);
12898
12898
  return this.#t = {
12899
12899
  ids: new Set(e),
12900
12900
  hash: e.join(",")
@@ -12944,7 +12944,7 @@ var $l = class {
12944
12944
  this.nativeFontFaces.clear(), this.#e.clear(), this.styleElement &&= (this.styleElement.remove(), null);
12945
12945
  }
12946
12946
  async loadSystemFont({ systemFontInfo: e, _inspectFont: t }) {
12947
- if (!(!e || this.#e.has(e.loadedName))) {
12947
+ if (e && !this.#e.has(e.loadedName)) {
12948
12948
  if (q(!this.disableFontFace, "loadSystemFont shouldn't be called when `disableFontFace` is set."), this.isFontLoadingAPISupported) {
12949
12949
  let { loadedName: n, src: r, style: i } = e, a = new FontFace(n, r, i);
12950
12950
  this.addNativeFontFace(a);
@@ -14594,8 +14594,8 @@ var cd = [
14594
14594
  i.fillText(n.join(""), 0, 0), t.x += r * m * l, i.restore(), this.compose();
14595
14595
  return;
14596
14596
  }
14597
- let b = 0, x;
14598
- for (x = 0; x < u; ++x) {
14597
+ let b = 0, x = 0;
14598
+ for (; x < u; ++x) {
14599
14599
  let t = e[x];
14600
14600
  if (typeof t == "number") {
14601
14601
  b += f * t * r / 1e3;
@@ -20086,7 +20086,7 @@ var jf = class {
20086
20086
  this.setDims(this.width * t, this.height * n);
20087
20087
  }
20088
20088
  #C() {
20089
- this.#u === null || !this.parent || (this.parent.drawLayer.remove(this.#u), this.#u = null, this.parent.drawLayer.remove(this.#m), this.#m = null);
20089
+ this.#u !== null && this.parent && (this.parent.drawLayer.remove(this.#u), this.#u = null, this.parent.drawLayer.remove(this.#m), this.#m = null);
20090
20090
  }
20091
20091
  #w(e = this.parent) {
20092
20092
  this.#u === null && ({id: this.#u, clipPathId: this.#r} = e.drawLayer.draw({
@@ -20518,7 +20518,7 @@ var jf = class {
20518
20518
  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();
20519
20519
  }
20520
20520
  #d() {
20521
- this._drawId === null || !this.parent || (this.parent.drawLayer.remove(this._drawId), this._drawId = null, this._drawingOptions.reset());
20521
+ this._drawId !== null && this.parent && (this.parent.drawLayer.remove(this._drawId), this._drawId = null, this._drawingOptions.reset());
20522
20522
  }
20523
20523
  #f(e = this.parent) {
20524
20524
  if (this._drawId === null || this.parent !== e) {
@@ -22209,7 +22209,7 @@ function jp(e) {
22209
22209
  //#region src/shared/utils/pdf-js.ts
22210
22210
  Np() || (wp.workerSrc = `https://cdnjs.cloudflare.com/ajax/libs/pdf.js/${Ep}/pdf.worker.min.mjs`);
22211
22211
  function Mp() {
22212
- if (typeof window > "u") return !0;
22212
+ if (globalThis.window === void 0) return !0;
22213
22213
  try {
22214
22214
  return window.self === window.top;
22215
22215
  } catch {
@@ -22234,7 +22234,7 @@ function Pp(e, t) {
22234
22234
  async function Fp({ data: e, password: t, id: n, page: r, units: i, scale: a }) {
22235
22235
  let o = new Worker(new URL(
22236
22236
  /* @vite-ignore */
22237
- "" + new URL("assets/pdfjs.worker-QHzJtIzr.js", import.meta.url).href,
22237
+ new URL("assets/pdfjs.worker-C9mOuiOj.js", import.meta.url).href,
22238
22238
  "" + import.meta.url
22239
22239
  ), { type: "module" });
22240
22240
  try {
@@ -22370,7 +22370,7 @@ function Gp(e, t) {
22370
22370
  t.top = i - a * s / 2, t.left = r - o * c / 2, t.setCoords();
22371
22371
  }
22372
22372
  function Kp(e, t, n) {
22373
- !n || !e || (n.scale(1 / t), Gp(e, n));
22373
+ n && e && (n.scale(1 / t), Gp(e, n));
22374
22374
  }
22375
22375
  function qp(e, t) {
22376
22376
  if (!e) return;
@@ -22546,7 +22546,7 @@ function am(e) {
22546
22546
  ...e
22547
22547
  };
22548
22548
  let n = Lp.get(t);
22549
- !f || !p.current || !n || C({
22549
+ f && p.current && n && C({
22550
22550
  target: p.current,
22551
22551
  canvas: n
22552
22552
  });