@component-hook/pdf-canvas 1.3.0-alpha.4 → 1.3.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.
@@ -142,7 +142,7 @@ export declare interface PDF {
142
142
  }
143
143
 
144
144
  export declare interface RenderImageArgs {
145
- data: File;
145
+ data: Blob;
146
146
  scale?: number;
147
147
  }
148
148
 
@@ -2081,9 +2081,9 @@ let Te = class Ki extends Oc {
2081
2081
  toObject() {
2082
2082
  const t = (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : []).concat(Ki.customProperties, this.constructor.customProperties || []);
2083
2083
  let e;
2084
- const s = q.NUM_FRACTION_DIGITS, { clipPath: i, fill: n, stroke: r, shadow: o, strokeDashArray: h, left: l, top: c, originX: u, originY: d, width: f, height: g, strokeWidth: p, strokeLineCap: b, strokeDashOffset: m, strokeLineJoin: v, strokeUniform: y, strokeMiterLimit: _, scaleX: S, scaleY: A, angle: T, flipX: E, flipY: O, opacity: N, visible: D, backgroundColor: L, fillRule: k, paintFirst: P, globalCompositeOperation: j, skewX: M, skewY: R } = this;
2084
+ const s = q.NUM_FRACTION_DIGITS, { clipPath: i, fill: n, stroke: r, shadow: o, strokeDashArray: h, left: l, top: c, originX: u, originY: d, width: f, height: g, strokeWidth: p, strokeLineCap: b, strokeDashOffset: m, strokeLineJoin: v, strokeUniform: y, strokeMiterLimit: _, scaleX: S, scaleY: A, angle: T, flipX: E, flipY: O, opacity: N, visible: D, backgroundColor: L, fillRule: M, paintFirst: P, globalCompositeOperation: j, skewX: k, skewY: R } = this;
2085
2085
  i && !i.excludeFromExport && (e = i.toObject(t.concat("inverted", "absolutePositioned")));
2086
- const G = (at) => Q(at, s), it = w(w({}, fs(this, t)), {}, { type: this.constructor.type, version: mr, originX: u, originY: d, left: G(l), top: G(c), width: G(f), height: G(g), fill: Do(n) ? n.toObject() : n, stroke: Do(r) ? r.toObject() : r, strokeWidth: G(p), strokeDashArray: h && h.concat(), strokeLineCap: b, strokeDashOffset: m, strokeLineJoin: v, strokeUniform: y, strokeMiterLimit: G(_), scaleX: G(S), scaleY: G(A), angle: G(T), flipX: E, flipY: O, opacity: G(N), shadow: o && o.toObject(), visible: D, backgroundColor: L, fillRule: k, paintFirst: P, globalCompositeOperation: j, skewX: G(M), skewY: G(R) }, e ? { clipPath: e } : null);
2086
+ const G = (at) => Q(at, s), it = w(w({}, fs(this, t)), {}, { type: this.constructor.type, version: mr, originX: u, originY: d, left: G(l), top: G(c), width: G(f), height: G(g), fill: Do(n) ? n.toObject() : n, stroke: Do(r) ? r.toObject() : r, strokeWidth: G(p), strokeDashArray: h && h.concat(), strokeLineCap: b, strokeDashOffset: m, strokeLineJoin: v, strokeUniform: y, strokeMiterLimit: G(_), scaleX: G(S), scaleY: G(A), angle: G(T), flipX: E, flipY: O, opacity: G(N), shadow: o && o.toObject(), visible: D, backgroundColor: L, fillRule: M, paintFirst: P, globalCompositeOperation: j, skewX: G(k), skewY: G(R) }, e ? { clipPath: e } : null);
2087
2087
  return this.includeDefaultValues ? it : this._removeDefaultValues(it);
2088
2088
  }
2089
2089
  toDatalessObject(t) {
@@ -2240,9 +2240,9 @@ function Sh(a, t, e, s, i) {
2240
2240
  const { origin: u, flip: d } = tr[r], f = mt(e[u]) * (n[d] ? -1 : 1), g = -Math.sign(f) * (n[c] ? -1 : 1), p = 0.5 * -((n[l] === 0 && Jr(e, X, X, s, i)[a] > 0 || n[l] > 0 ? 1 : -1) * g) + 0.5;
2241
2241
  return Bs(Xa, Hs(((m, v, y, _) => (function(S, A, T) {
2242
2242
  let { target: E, ex: O, ey: N, skewingSide: D } = A, L = st(A, zc);
2243
- const { skew: k } = tr[S], P = T.subtract(new C(O, N)).divide(new C(E.scaleX, E.scaleY))[S], j = E[k], M = L[k], R = Math.tan(lt(M)), G = S === "y" ? E._getTransformedDimensions({ scaleX: 1, scaleY: 1, skewX: 0 }).x : E._getTransformedDimensions({ scaleX: 1, scaleY: 1 }).y, it = 2 * P * D / Math.max(G, 1) + R, at = Ce(Math.atan(it));
2244
- E.set(k, at);
2245
- const xt = j !== E[k];
2243
+ const { skew: M } = tr[S], P = T.subtract(new C(O, N)).divide(new C(E.scaleX, E.scaleY))[S], j = E[M], k = L[M], R = Math.tan(lt(k)), G = S === "y" ? E._getTransformedDimensions({ scaleX: 1, scaleY: 1, skewX: 0 }).x : E._getTransformedDimensions({ scaleX: 1, scaleY: 1 }).y, it = 2 * P * D / Math.max(G, 1) + R, at = Ce(Math.atan(it));
2244
+ E.set(M, at);
2245
+ const xt = j !== E[M];
2246
2246
  if (xt && S === "y") {
2247
2247
  const { skewX: gt, scaleX: et } = E, Pt = E._getTransformedDimensions({ skewY: j }), fe = E._getTransformedDimensions(), ht = gt !== 0 ? Pt.x / fe.x : 1;
2248
2248
  ht !== 1 && E.set(Ht, ht * et);
@@ -3132,12 +3132,12 @@ const Au = (a, t, e) => {
3132
3132
  const u = ((d, f, g, p, b, m, v) => {
3133
3133
  if (g === 0 || p === 0) return [];
3134
3134
  let y = 0, _ = 0, S = 0;
3135
- const A = Math.PI, T = v * Hr, E = ue(T), O = ce(T), N = 0.5 * (-O * d - E * f), D = 0.5 * (-O * f + E * d), L = g ** 2, k = p ** 2, P = D ** 2, j = N ** 2, M = L * k - L * P - k * j;
3135
+ const A = Math.PI, T = v * Hr, E = ue(T), O = ce(T), N = 0.5 * (-O * d - E * f), D = 0.5 * (-O * f + E * d), L = g ** 2, M = p ** 2, P = D ** 2, j = N ** 2, k = L * M - L * P - M * j;
3136
3136
  let R = Math.abs(g), G = Math.abs(p);
3137
- if (M < 0) {
3138
- const ge = Math.sqrt(1 - M / (L * k));
3137
+ if (k < 0) {
3138
+ const ge = Math.sqrt(1 - k / (L * M));
3139
3139
  R *= ge, G *= ge;
3140
- } else S = (b === m ? -1 : 1) * Math.sqrt(M / (L * P + k * j));
3140
+ } else S = (b === m ? -1 : 1) * Math.sqrt(k / (L * P + M * j));
3141
3141
  const it = S * R * D / G, at = -S * G * N / R, xt = O * it - E * at + 0.5 * d, gt = E * it + O * at + 0.5 * f;
3142
3142
  let et = ha(1, 0, (N - it) / R, (D - at) / G), Pt = ha((N - it) / R, (D - at) / G, (-N - it) / R, (-D - at) / G);
3143
3143
  m === 0 && Pt > 0 ? Pt -= 2 * A : m === 1 && Pt < 0 && (Pt += 2 * A);
@@ -4932,17 +4932,17 @@ class Ct extends tl {
4932
4932
  let p = 0, b = 0, m = this.getValueOfPropertyAt(l, 0, e), v = this.getValueOfPropertyAt(l, 0, vt), y = this.getValueOfPropertyAt(l, 0, hs), _ = m, S = v, A = y;
4933
4933
  const T = s + f * (1 - this._fontSizeFraction);
4934
4934
  let E = this.getHeightOfChar(l, 0), O = this.getValueOfPropertyAt(l, 0, "deltaY");
4935
- for (let L = 0, k = d.length; L < k; L++) {
4935
+ for (let L = 0, M = d.length; L < M; L++) {
4936
4936
  const P = this.__charBounds[l][L];
4937
4937
  _ = this.getValueOfPropertyAt(l, L, e), S = this.getValueOfPropertyAt(l, L, vt), A = this.getValueOfPropertyAt(l, L, hs);
4938
- const j = this.getHeightOfChar(l, L), M = this.getValueOfPropertyAt(l, L, "deltaY");
4938
+ const j = this.getHeightOfChar(l, L), k = this.getValueOfPropertyAt(l, L, "deltaY");
4939
4939
  if (n && _ && S) {
4940
4940
  const R = this.fontSize * A / 1e3;
4941
- t.save(), t.fillStyle = v, t.translate(P.renderLeft, P.renderTop), t.rotate(P.angle), t.fillRect(-P.kernedWidth / 2, h * j + M - o * R, P.kernedWidth, R), t.restore();
4942
- } else if ((_ !== m || S !== v || j !== E || A !== y || M !== O) && b > 0) {
4941
+ t.save(), t.fillStyle = v, t.translate(P.renderLeft, P.renderTop), t.rotate(P.angle), t.fillRect(-P.kernedWidth / 2, h * j + k - o * R, P.kernedWidth, R), t.restore();
4942
+ } else if ((_ !== m || S !== v || j !== E || A !== y || k !== O) && b > 0) {
4943
4943
  const R = this.fontSize * y / 1e3;
4944
4944
  let G = i + g + p;
4945
- this.direction === "rtl" && (G = this.width - G - b), m && v && y && (t.fillStyle = v, t.fillRect(G, T + h * E + O - o * R, b, R)), p = P.left, b = P.width, m = _, y = A, v = S, E = j, O = M;
4945
+ this.direction === "rtl" && (G = this.width - G - b), m && v && y && (t.fillStyle = v, t.fillRect(G, T + h * E + O - o * R, b, R)), p = P.left, b = P.width, m = _, y = A, v = S, E = j, O = k;
4946
4946
  } else b += P.kernedWidth;
4947
4947
  }
4948
4948
  let N = i + g + p;
@@ -6411,11 +6411,11 @@ async function bd(a, t) {
6411
6411
  if (!d.includes(N)) if (N === "style") {
6412
6412
  const L = {};
6413
6413
  Sr(D, L), Object.entries(_).forEach(((P) => {
6414
- let [j, M] = P;
6415
- L[j] = M;
6414
+ let [j, k] = P;
6415
+ L[j] = k;
6416
6416
  })), Sr(_.style || "", L);
6417
- const k = Object.entries(L).map(((P) => P.join(":"))).join(";");
6418
- v.setAttribute(N, k);
6417
+ const M = Object.entries(L).map(((P) => P.join(":"))).join(";");
6418
+ v.setAttribute(N, M);
6419
6419
  } else !_[N] && v.setAttribute(N, D);
6420
6420
  }
6421
6421
  v.setAttribute("transform", E), v.setAttribute("instantiated_by_use", "1"), v.removeAttribute("id"), f.parentNode.replaceChild(v, f);
@@ -7457,13 +7457,13 @@ class Gi extends wt {
7457
7457
  lanczosResize(t, e, s, i, n) {
7458
7458
  const r = t.imageData.data, o = t.ctx.createImageData(i, n), h = o.data, l = this.lanczosCreate(this.lanczosLobes), c = this.rcpScaleX, u = this.rcpScaleY, d = 2 / this.rcpScaleX, f = 2 / this.rcpScaleY, g = Math.ceil(c * this.lanczosLobes / 2), p = Math.ceil(u * this.lanczosLobes / 2), b = {}, m = { x: 0, y: 0 }, v = { x: 0, y: 0 };
7459
7459
  return (function y(_) {
7460
- let S, A, T, E, O, N, D, L, k, P, j;
7460
+ let S, A, T, E, O, N, D, L, M, P, j;
7461
7461
  for (m.x = (_ + 0.5) * c, v.x = Math.floor(m.x), S = 0; S < n; S++) {
7462
- for (m.y = (S + 0.5) * u, v.y = Math.floor(m.y), O = 0, N = 0, D = 0, L = 0, k = 0, A = v.x - g; A <= v.x + g; A++) if (!(A < 0 || A >= e)) {
7462
+ for (m.y = (S + 0.5) * u, v.y = Math.floor(m.y), O = 0, N = 0, D = 0, L = 0, M = 0, A = v.x - g; A <= v.x + g; A++) if (!(A < 0 || A >= e)) {
7463
7463
  P = Math.floor(1e3 * Math.abs(A - m.x)), b[P] || (b[P] = {});
7464
- for (let M = v.y - p; M <= v.y + p; M++) M < 0 || M >= s || (j = Math.floor(1e3 * Math.abs(M - m.y)), b[P][j] || (b[P][j] = l(Math.sqrt(Math.pow(P * d, 2) + Math.pow(j * f, 2)) / 1e3)), T = b[P][j], T > 0 && (E = 4 * (M * e + A), O += T, N += T * r[E], D += T * r[E + 1], L += T * r[E + 2], k += T * r[E + 3]));
7464
+ for (let k = v.y - p; k <= v.y + p; k++) k < 0 || k >= s || (j = Math.floor(1e3 * Math.abs(k - m.y)), b[P][j] || (b[P][j] = l(Math.sqrt(Math.pow(P * d, 2) + Math.pow(j * f, 2)) / 1e3)), T = b[P][j], T > 0 && (E = 4 * (k * e + A), O += T, N += T * r[E], D += T * r[E + 1], L += T * r[E + 2], M += T * r[E + 3]));
7465
7465
  }
7466
- E = 4 * (S * i + _), h[E] = N / O, h[E + 1] = D / O, h[E + 2] = L / O, h[E + 3] = k / O;
7466
+ E = 4 * (S * i + _), h[E] = N / O, h[E + 1] = D / O, h[E + 2] = L / O, h[E + 3] = M / O;
7467
7467
  }
7468
7468
  return ++_ < i ? y(_) : o;
7469
7469
  })(0);
@@ -7483,9 +7483,9 @@ class Gi extends wt {
7483
7483
  for (let E = Math.floor(f * o); E < (f + 1) * o; E++) {
7484
7484
  const O = Math.abs(T - (E + 0.5)) / l, N = (g + 0.5) * r, D = O * O;
7485
7485
  for (let L = Math.floor(g * r); L < (g + 1) * r; L++) {
7486
- let k = Math.abs(N - (L + 0.5)) / h;
7487
- const P = Math.sqrt(D + k * k);
7488
- P > 1 && P < -1 || (b = 2 * P * P * P - 3 * P * P + 1, b > 0 && (k = 4 * (L + E * e), A += b * c[k + 3], v += b, c[k + 3] < 255 && (b = b * c[k + 3] / 250), y += b * c[k], _ += b * c[k + 1], S += b * c[k + 2], m += b));
7486
+ let M = Math.abs(N - (L + 0.5)) / h;
7487
+ const P = Math.sqrt(D + M * M);
7488
+ P > 1 && P < -1 || (b = 2 * P * P * P - 3 * P * P + 1, b > 0 && (M = 4 * (L + E * e), A += b * c[M + 3], v += b, c[M + 3] < 255 && (b = b * c[M + 3] / 250), y += b * c[M], _ += b * c[M + 1], S += b * c[M + 2], m += b));
7489
7489
  }
7490
7490
  }
7491
7491
  d[p] = y / m, d[p + 1] = _ / m, d[p + 2] = S / m, d[p + 3] = A / v;
@@ -10560,32 +10560,32 @@ class z {
10560
10560
  return Math.round(t * 1e4) / 1e4;
10561
10561
  }
10562
10562
  #C(t, e) {
10563
- const [s, i] = this.parentDimensions, n = this.x, r = this.y, o = this.width, h = this.height, l = z.MIN_SIZE / s, c = z.MIN_SIZE / i, u = this.#k(this.rotation), d = (M, R) => [u[0] * M + u[2] * R, u[1] * M + u[3] * R], f = this.#k(360 - this.rotation), g = (M, R) => [f[0] * M + f[2] * R, f[1] * M + f[3] * R];
10563
+ const [s, i] = this.parentDimensions, n = this.x, r = this.y, o = this.width, h = this.height, l = z.MIN_SIZE / s, c = z.MIN_SIZE / i, u = this.#k(this.rotation), d = (k, R) => [u[0] * k + u[2] * R, u[1] * k + u[3] * R], f = this.#k(360 - this.rotation), g = (k, R) => [f[0] * k + f[2] * R, f[1] * k + f[3] * R];
10564
10564
  let p, b, m = !1, v = !1;
10565
10565
  switch (t) {
10566
10566
  case "topLeft":
10567
- m = !0, p = (M, R) => [0, 0], b = (M, R) => [M, R];
10567
+ m = !0, p = (k, R) => [0, 0], b = (k, R) => [k, R];
10568
10568
  break;
10569
10569
  case "topMiddle":
10570
- p = (M, R) => [M / 2, 0], b = (M, R) => [M / 2, R];
10570
+ p = (k, R) => [k / 2, 0], b = (k, R) => [k / 2, R];
10571
10571
  break;
10572
10572
  case "topRight":
10573
- m = !0, p = (M, R) => [M, 0], b = (M, R) => [0, R];
10573
+ m = !0, p = (k, R) => [k, 0], b = (k, R) => [0, R];
10574
10574
  break;
10575
10575
  case "middleRight":
10576
- v = !0, p = (M, R) => [M, R / 2], b = (M, R) => [0, R / 2];
10576
+ v = !0, p = (k, R) => [k, R / 2], b = (k, R) => [0, R / 2];
10577
10577
  break;
10578
10578
  case "bottomRight":
10579
- m = !0, p = (M, R) => [M, R], b = (M, R) => [0, 0];
10579
+ m = !0, p = (k, R) => [k, R], b = (k, R) => [0, 0];
10580
10580
  break;
10581
10581
  case "bottomMiddle":
10582
- p = (M, R) => [M / 2, R], b = (M, R) => [M / 2, 0];
10582
+ p = (k, R) => [k / 2, R], b = (k, R) => [k / 2, 0];
10583
10583
  break;
10584
10584
  case "bottomLeft":
10585
- m = !0, p = (M, R) => [0, R], b = (M, R) => [M, 0];
10585
+ m = !0, p = (k, R) => [0, R], b = (k, R) => [k, 0];
10586
10586
  break;
10587
10587
  case "middleLeft":
10588
- v = !0, p = (M, R) => [0, R / 2], b = (M, R) => [M, R / 2];
10588
+ v = !0, p = (k, R) => [0, R / 2], b = (k, R) => [k, R / 2];
10589
10589
  break;
10590
10590
  }
10591
10591
  const y = p(o, h), _ = b(o, h);
@@ -10599,19 +10599,19 @@ class z {
10599
10599
  } = e);
10600
10600
  else {
10601
10601
  const {
10602
- screenX: M,
10602
+ screenX: k,
10603
10603
  screenY: R
10604
10604
  } = e, [G, it] = this.#c;
10605
- [N, D] = this.screenToPageTranslation(M - G, R - it), this.#c[0] = M, this.#c[1] = R;
10605
+ [N, D] = this.screenToPageTranslation(k - G, R - it), this.#c[0] = k, this.#c[1] = R;
10606
10606
  }
10607
10607
  if ([N, D] = g(N / s, D / i), m) {
10608
- const M = Math.hypot(o, h);
10609
- E = O = Math.max(Math.min(Math.hypot(_[0] - y[0] - N, _[1] - y[1] - D) / M, 1 / o, 1 / h), l / o, c / h);
10608
+ const k = Math.hypot(o, h);
10609
+ E = O = Math.max(Math.min(Math.hypot(_[0] - y[0] - N, _[1] - y[1] - D) / k, 1 / o, 1 / h), l / o, c / h);
10610
10610
  } else v ? E = Math.max(l, Math.min(1, Math.abs(_[0] - y[0] - N))) / o : O = Math.max(c, Math.min(1, Math.abs(_[1] - y[1] - D))) / h;
10611
- const L = z._round(o * E), k = z._round(h * O);
10612
- S = d(...b(L, k));
10611
+ const L = z._round(o * E), M = z._round(h * O);
10612
+ S = d(...b(L, M));
10613
10613
  const P = A - S[0], j = T - S[1];
10614
- this.#o ||= [this.x, this.y, this.width, this.height], this.width = L, this.height = k, this.x = P, this.y = j, this.setDims(s * L, i * k), this.fixAndSetPosition(), this._onResizing();
10614
+ this.#o ||= [this.x, this.y, this.width, this.height], this.width = L, this.height = M, this.x = P, this.y = j, this.setDims(s * L, i * M), this.fixAndSetPosition(), this._onResizing();
10615
10615
  }
10616
10616
  _onResizing() {
10617
10617
  }
@@ -12142,22 +12142,22 @@ function fr(a, t, e, s, i, n, r, o) {
12142
12142
  const f = (h[e] + t.offsetX) * t.scaleX, g = (h[e + 1] + t.offsetY) * t.scaleY, p = (h[s] + t.offsetX) * t.scaleX, b = (h[s + 1] + t.offsetY) * t.scaleY, m = (h[i] + t.offsetX) * t.scaleX, v = (h[i + 1] + t.offsetY) * t.scaleY;
12143
12143
  if (g >= v)
12144
12144
  return;
12145
- const y = l[n], _ = l[n + 1], S = l[n + 2], A = l[r], T = l[r + 1], E = l[r + 2], O = l[o], N = l[o + 1], D = l[o + 2], L = Math.round(g), k = Math.round(v);
12146
- let P, j, M, R, G, it, at, xt;
12147
- for (let gt = L; gt <= k; gt++) {
12145
+ const y = l[n], _ = l[n + 1], S = l[n + 2], A = l[r], T = l[r + 1], E = l[r + 2], O = l[o], N = l[o + 1], D = l[o + 2], L = Math.round(g), M = Math.round(v);
12146
+ let P, j, k, R, G, it, at, xt;
12147
+ for (let gt = L; gt <= M; gt++) {
12148
12148
  if (gt < b) {
12149
12149
  const K = gt < g ? 0 : (g - gt) / (g - b);
12150
- P = f - (f - p) * K, j = y - (y - A) * K, M = _ - (_ - T) * K, R = S - (S - E) * K;
12150
+ P = f - (f - p) * K, j = y - (y - A) * K, k = _ - (_ - T) * K, R = S - (S - E) * K;
12151
12151
  } else {
12152
12152
  let K;
12153
- gt > v ? K = 1 : b === v ? K = 0 : K = (b - gt) / (b - v), P = p - (p - m) * K, j = A - (A - O) * K, M = T - (T - N) * K, R = E - (E - D) * K;
12153
+ gt > v ? K = 1 : b === v ? K = 0 : K = (b - gt) / (b - v), P = p - (p - m) * K, j = A - (A - O) * K, k = T - (T - N) * K, R = E - (E - D) * K;
12154
12154
  }
12155
12155
  let et;
12156
12156
  gt < g ? et = 0 : gt > v ? et = 1 : et = (g - gt) / (g - v), G = f - (f - m) * et, it = y - (y - O) * et, at = _ - (_ - N) * et, xt = S - (S - D) * et;
12157
12157
  const Pt = Math.round(Math.min(P, G)), fe = Math.round(Math.max(P, G));
12158
12158
  let ht = u * gt + Pt * 4;
12159
12159
  for (let K = Pt; K <= fe; K++)
12160
- et = (P - K) / (P - G), et < 0 ? et = 0 : et > 1 && (et = 1), c[ht++] = j - (j - it) * et | 0, c[ht++] = M - (M - at) * et | 0, c[ht++] = R - (R - xt) * et | 0, c[ht++] = 255;
12160
+ et = (P - K) / (P - G), et < 0 ? et = 0 : et > 1 && (et = 1), c[ht++] = j - (j - it) * et | 0, c[ht++] = k - (k - at) * et | 0, c[ht++] = R - (R - xt) * et | 0, c[ht++] = 255;
12161
12161
  }
12162
12162
  }
12163
12163
  function lf(a, t, e) {
@@ -12264,8 +12264,8 @@ class yo {
12264
12264
  let _ = g, S = p, A = !1, T = !1;
12265
12265
  const E = Math.ceil(h * v), O = Math.ceil(l * y), N = Math.ceil(g * v), D = Math.ceil(p * y);
12266
12266
  E >= N ? _ = h : A = !0, O >= D ? S = l : T = !0;
12267
- const L = this.getSizeAndScale(_, this.ctx.canvas.width, v), k = this.getSizeAndScale(S, this.ctx.canvas.height, y), P = t.cachedCanvases.getCanvas("pattern", L.size, k.size), j = P.context, M = o.createCanvasGraphics(j);
12268
- if (M.groupLevel = t.groupLevel, this.setFillAndStrokeStyleToContext(M, i, r), j.translate(-L.scale * c, -k.scale * u), M.transform(L.scale, 0, 0, k.scale, 0, 0), j.save(), this.clipBbox(M, c, u, d, f), M.baseTransform = rt(M.ctx), M.executeOperatorList(s), M.endDrawing(), j.restore(), A || T) {
12267
+ const L = this.getSizeAndScale(_, this.ctx.canvas.width, v), M = this.getSizeAndScale(S, this.ctx.canvas.height, y), P = t.cachedCanvases.getCanvas("pattern", L.size, M.size), j = P.context, k = o.createCanvasGraphics(j);
12268
+ if (k.groupLevel = t.groupLevel, this.setFillAndStrokeStyleToContext(k, i, r), j.translate(-L.scale * c, -M.scale * u), k.transform(L.scale, 0, 0, M.scale, 0, 0), j.save(), this.clipBbox(k, c, u, d, f), k.baseTransform = rt(k.ctx), k.executeOperatorList(s), k.endDrawing(), j.restore(), A || T) {
12269
12269
  const R = P.canvas;
12270
12270
  A && (_ = h), T && (S = l);
12271
12271
  const G = this.getSizeAndScale(_, this.ctx.canvas.width, v), it = this.getSizeAndScale(S, this.ctx.canvas.height, y), at = G.size, xt = it.size, gt = t.cachedCanvases.getCanvas("pattern-workaround", at, xt), et = gt.context, Pt = A ? Math.floor(g / h) : 0, fe = T ? Math.floor(p / l) : 0;
@@ -12283,7 +12283,7 @@ class yo {
12283
12283
  return {
12284
12284
  canvas: P.canvas,
12285
12285
  scaleX: L.scale,
12286
- scaleY: k.scale,
12286
+ scaleY: M.scale,
12287
12287
  offsetX: c,
12288
12288
  offsetY: u
12289
12289
  };
@@ -13080,25 +13080,25 @@ class Es {
13080
13080
  }
13081
13081
  let E = !1;
13082
13082
  const O = (T.isSpace ? h : 0) + o, N = T.fontChar, D = T.accent;
13083
- let L, k, P = T.width;
13083
+ let L, M, P = T.width;
13084
13084
  if (d) {
13085
- const M = T.vmetric || g, R = -(T.vmetric ? M[1] : P * 0.5) * p, G = M[2] * p;
13086
- P = M ? -M[0] : P, L = R / r, k = (S + G) / r;
13085
+ const k = T.vmetric || g, R = -(T.vmetric ? k[1] : P * 0.5) * p, G = k[2] * p;
13086
+ P = k ? -k[0] : P, L = R / r, M = (S + G) / r;
13087
13087
  } else
13088
- L = S / r, k = 0;
13088
+ L = S / r, M = 0;
13089
13089
  if (s.remeasure && P > 0) {
13090
- const M = n.measureText(N).width * 1e3 / i * r;
13091
- if (P < M && this.isFontSubpixelAAEnabled) {
13092
- const R = P / M;
13090
+ const k = n.measureText(N).width * 1e3 / i * r;
13091
+ if (P < k && this.isFontSubpixelAAEnabled) {
13092
+ const R = P / k;
13093
13093
  E = !0, n.save(), n.scale(R, 1), L /= R;
13094
- } else P !== M && (L += (P - M) / 2e3 * i / r);
13094
+ } else P !== k && (L += (P - k) / 2e3 * i / r);
13095
13095
  }
13096
13096
  if (this.contentVisible && (T.isInFont || s.missingFile)) {
13097
13097
  if (b && !D)
13098
- n.fillText(N, L, k);
13099
- else if (this.paintChar(N, L, k, m, v), D) {
13100
- const M = L + i * D.offset.x / r, R = k - i * D.offset.y / r;
13101
- this.paintChar(D.fontChar, M, R, m, v);
13098
+ n.fillText(N, L, M);
13099
+ else if (this.paintChar(N, L, M, m, v), D) {
13100
+ const k = L + i * D.offset.x / r, R = M - i * D.offset.y / r;
13101
+ this.paintChar(D.fontChar, k, R, m, v);
13102
13102
  }
13103
13103
  }
13104
13104
  const j = d ? P * p - O * l : P * p + O * l;
@@ -14877,10 +14877,10 @@ function qf(a = {}) {
14877
14877
  docId: e
14878
14878
  } = t, s = a.url ? Kf(a.url) : null, i = a.data ? Jf(a.data) : null, n = a.httpHeaders || null, r = a.withCredentials === !0, o = a.password ?? null, h = a.range instanceof Al ? a.range : null, l = Number.isInteger(a.rangeChunkSize) && a.rangeChunkSize > 0 ? a.rangeChunkSize : Gf;
14879
14879
  let c = a.worker instanceof ks ? a.worker : null;
14880
- const u = a.verbosity, d = typeof a.docBaseUrl == "string" && !Bn(a.docBaseUrl) ? a.docBaseUrl : null, f = typeof a.cMapUrl == "string" ? a.cMapUrl : null, g = a.cMapPacked !== !1, p = a.CMapReaderFactory || Uf, b = typeof a.standardFontDataUrl == "string" ? a.standardFontDataUrl : null, m = a.StandardFontDataFactory || $f, v = a.stopAtErrors !== !0, y = Number.isInteger(a.maxImageSize) && a.maxImageSize > -1 ? a.maxImageSize : -1, _ = a.isEvalSupported !== !1, S = typeof a.isOffscreenCanvasSupported == "boolean" ? a.isOffscreenCanvasSupported : !kt, A = typeof a.isImageDecoderSupported == "boolean" ? a.isImageDecoderSupported : !kt && (jt.platform.isFirefox || !globalThis.chrome), T = Number.isInteger(a.canvasMaxAreaInBytes) ? a.canvasMaxAreaInBytes : -1, E = typeof a.disableFontFace == "boolean" ? a.disableFontFace : kt, O = a.fontExtraProperties === !0, N = a.enableXfa === !0, D = a.ownerDocument || globalThis.document, L = a.disableRange === !0, k = a.disableStream === !0, P = a.disableAutoFetch === !0, j = a.pdfBug === !0, M = a.CanvasFactory || Wf, R = a.FilterFactory || Yf, G = a.enableHWA === !0, it = h ? h.length : a.length ?? NaN, at = typeof a.useSystemFonts == "boolean" ? a.useSystemFonts : !kt && !E, xt = typeof a.useWorkerFetch == "boolean" ? a.useWorkerFetch : p === gl && m === bl && f && b && Ks(f, document.baseURI) && Ks(b, document.baseURI), gt = null;
14880
+ const u = a.verbosity, d = typeof a.docBaseUrl == "string" && !Bn(a.docBaseUrl) ? a.docBaseUrl : null, f = typeof a.cMapUrl == "string" ? a.cMapUrl : null, g = a.cMapPacked !== !1, p = a.CMapReaderFactory || Uf, b = typeof a.standardFontDataUrl == "string" ? a.standardFontDataUrl : null, m = a.StandardFontDataFactory || $f, v = a.stopAtErrors !== !0, y = Number.isInteger(a.maxImageSize) && a.maxImageSize > -1 ? a.maxImageSize : -1, _ = a.isEvalSupported !== !1, S = typeof a.isOffscreenCanvasSupported == "boolean" ? a.isOffscreenCanvasSupported : !kt, A = typeof a.isImageDecoderSupported == "boolean" ? a.isImageDecoderSupported : !kt && (jt.platform.isFirefox || !globalThis.chrome), T = Number.isInteger(a.canvasMaxAreaInBytes) ? a.canvasMaxAreaInBytes : -1, E = typeof a.disableFontFace == "boolean" ? a.disableFontFace : kt, O = a.fontExtraProperties === !0, N = a.enableXfa === !0, D = a.ownerDocument || globalThis.document, L = a.disableRange === !0, M = a.disableStream === !0, P = a.disableAutoFetch === !0, j = a.pdfBug === !0, k = a.CanvasFactory || Wf, R = a.FilterFactory || Yf, G = a.enableHWA === !0, it = h ? h.length : a.length ?? NaN, at = typeof a.useSystemFonts == "boolean" ? a.useSystemFonts : !kt && !E, xt = typeof a.useWorkerFetch == "boolean" ? a.useWorkerFetch : p === gl && m === bl && f && b && Ks(f, document.baseURI) && Ks(b, document.baseURI), gt = null;
14881
14881
  Rd(u);
14882
14882
  const et = {
14883
- canvasFactory: new M({
14883
+ canvasFactory: new k({
14884
14884
  ownerDocument: D,
14885
14885
  enableHWA: G
14886
14886
  }),
@@ -14947,7 +14947,7 @@ function qf(a = {}) {
14947
14947
  if (h)
14948
14948
  K = new Cf(h, {
14949
14949
  disableRange: L,
14950
- disableStream: k
14950
+ disableStream: M
14951
14951
  });
14952
14952
  else if (!i) {
14953
14953
  if (!s)
@@ -14969,7 +14969,7 @@ function qf(a = {}) {
14969
14969
  withCredentials: r,
14970
14970
  rangeChunkSize: l,
14971
14971
  disableRange: L,
14972
- disableStream: k
14972
+ disableStream: M
14973
14973
  });
14974
14974
  }
14975
14975
  return ht.then((je) => {
@@ -22157,78 +22157,78 @@ function Qg(a) {
22157
22157
  let h = null, l = null, c = 1, u = { ...Zl };
22158
22158
  function d() {
22159
22159
  if (!t || Ft.has(t)) return;
22160
- const k = Ng(t);
22161
- return k.on("selection:created", (P) => {
22160
+ const M = Ng(t);
22161
+ return M.on("selection:created", (P) => {
22162
22162
  if (r?.(P), P.selected.length <= 1) return;
22163
- const j = k.getActiveObject();
22163
+ const j = M.getActiveObject();
22164
22164
  j && (l = j, e?.value && l.set(e.value), l._cornerSize = l.cornerSize, S(c));
22165
- }), k.on("selection:cleared", (P) => {
22166
- o?.(P), T(k);
22167
- }), s && k.on("mouse:down", s), i && k.on("mouse:move", i), n && k.on("mouse:up", n), k;
22165
+ }), M.on("selection:cleared", (P) => {
22166
+ o?.(P), T(M);
22167
+ }), s && M.on("mouse:down", s), i && M.on("mouse:move", i), n && M.on("mouse:up", n), M;
22168
22168
  }
22169
- function f(k, P) {
22170
- return $g(k, P, t);
22169
+ function f(M, P) {
22170
+ return $g(M, P, t);
22171
22171
  }
22172
- function g(k) {
22173
- return jl(k, t);
22172
+ function g(M) {
22173
+ return jl(M, t);
22174
22174
  }
22175
- function p({ data: k, scale: P = 0.5 }) {
22176
- return Il(t, { data: k, scale: P });
22175
+ function p({ data: M, scale: P = 0.5 }) {
22176
+ return Il(t, { data: M, scale: P });
22177
22177
  }
22178
- async function b(k, P, j) {
22179
- const M = Ft.get(t);
22180
- if (!M) return;
22181
- const R = await Tt.fromURL(k, {}, { ...ql, ...P });
22182
- jr(R, j), M.add(R), v(M, R), M.setActiveObject(R);
22178
+ async function b(M, P, j) {
22179
+ const k = Ft.get(t);
22180
+ if (!k) return;
22181
+ const R = await Tt.fromURL(M, {}, { ...ql, ...P });
22182
+ jr(R, j), k.add(R), v(k, R), k.setActiveObject(R);
22183
22183
  }
22184
- function m(k, P, j) {
22185
- const M = Ft.get(t);
22186
- if (!M) return;
22187
- const R = new Ct(k, {
22184
+ function m(M, P, j) {
22185
+ const k = Ft.get(t);
22186
+ if (!k) return;
22187
+ const R = new Ct(M, {
22188
22188
  ...Kl,
22189
22189
  ...P
22190
22190
  });
22191
- jr(R, j), M.add(R), v(M, R), M.setActiveObject(R);
22191
+ jr(R, j), k.add(R), v(k, R), k.setActiveObject(R);
22192
22192
  }
22193
- function v(k, P) {
22194
- P.on("selected", (j) => y({ canvas: k, target: j.target })), P.on("modified", (j) => y({ canvas: k, target: j.target })), P.on("scaling", () => T(k)), P.on("moving", () => T(k)), P.on("rotating", () => T(k)), P._cornerSize = P._cornerSize ?? P.cornerSize;
22193
+ function v(M, P) {
22194
+ P.on("selected", (j) => y({ canvas: M, target: j.target })), P.on("modified", (j) => y({ canvas: M, target: j.target })), P.on("scaling", () => T(M)), P.on("moving", () => T(M)), P.on("rotating", () => T(M)), P._cornerSize = P._cornerSize ?? P.cornerSize;
22195
22195
  }
22196
22196
  async function y({
22197
- canvas: k,
22197
+ canvas: M,
22198
22198
  target: P,
22199
22199
  stroke: j = u.stroke,
22200
- uuid: M = Date.now()
22200
+ uuid: k = Date.now()
22201
22201
  }) {
22202
- if (k.getActiveObjects().length > 1 || h?.stroke === `${j}-${M}`) return;
22203
- const G = await Bg(u, M, j);
22204
- T(k), h = G, l = P, _(k, P, M), S(c, !0), G && k.add(G);
22202
+ if (M.getActiveObjects().length > 1 || h?.stroke === `${j}-${k}`) return;
22203
+ const G = await Bg(u, k, j);
22204
+ T(M), h = G, l = P, _(M, P, k), S(c, !0), G && M.add(G);
22205
22205
  }
22206
- function _(k, P, j) {
22206
+ function _(M, P, j) {
22207
22207
  h && (h.on("selected", () => {
22208
- k.remove(P), T(k);
22208
+ M.remove(P), T(M);
22209
22209
  }), h.on("mouseover", () => {
22210
22210
  y({
22211
- canvas: k,
22211
+ canvas: M,
22212
22212
  target: P,
22213
22213
  stroke: u.hoverStroke,
22214
22214
  uuid: j
22215
22215
  });
22216
22216
  }), h.on("mouseout", () => {
22217
- y({ canvas: k, target: P, stroke: u.stroke, uuid: j });
22217
+ y({ canvas: M, target: P, stroke: u.stroke, uuid: j });
22218
22218
  }));
22219
22219
  }
22220
- function S(k, P = !1) {
22220
+ function S(M, P = !1) {
22221
22221
  const j = Ft.get(t);
22222
- c = k, j && (Xg(l, k), Vg(l, k, h), !P && j.renderAll());
22222
+ c = M, j && (Xg(l, M), Vg(l, M, h), !P && j.renderAll());
22223
22223
  }
22224
- function A(k) {
22225
- if (!k) return;
22226
- u = { ...u, ...k };
22224
+ function A(M) {
22225
+ if (!M) return;
22226
+ u = { ...u, ...M };
22227
22227
  const P = Ft.get(t);
22228
22228
  !h || !l || !P || y({ target: l, canvas: P });
22229
22229
  }
22230
- function T(k) {
22231
- l = null, h && (k.remove(h), h = null);
22230
+ function T(M) {
22231
+ l = null, h && (M.remove(h), h = null);
22232
22232
  }
22233
22233
  function E() {
22234
22234
  Wg(t);
@@ -22236,8 +22236,8 @@ function Qg(a) {
22236
22236
  function O() {
22237
22237
  Ug(t);
22238
22238
  }
22239
- function N(k) {
22240
- Kg(t, k);
22239
+ function N(M) {
22240
+ Kg(t, M);
22241
22241
  }
22242
22242
  function D() {
22243
22243
  return Jg(t, v);
@@ -22317,31 +22317,31 @@ const ip = /* @__PURE__ */ Hl({
22317
22317
  });
22318
22318
  A(), tp(N);
22319
22319
  async function A() {
22320
- const { file: D, page: L, fileScale: k } = s;
22320
+ const { file: D, page: L, fileScale: M } = s;
22321
22321
  globalThis.requestAnimationFrame(async () => {
22322
- if (await Gl(), c(), D.data?.type.startsWith("image/")) {
22323
- g({ data: D.data, scale: k / 3 }), i("loaded");
22322
+ if (await Gl(), c(), D.data?.type.startsWith("image/") || D.canvas) {
22323
+ const { canvas: P } = D, j = P ? 7 : 3, k = P?.length ? P[L - 1] : D.data;
22324
+ k && g({ data: k, scale: M / j }), i("loaded");
22324
22325
  return;
22325
22326
  }
22326
- const P = D.canvas?.[L - 1] ?? D.data;
22327
- P && await u({
22327
+ D.data && await u({
22328
22328
  page: L,
22329
- data: P,
22330
- scale: k,
22329
+ data: D.data,
22330
+ scale: M,
22331
22331
  password: s.password
22332
22332
  }), i("loaded");
22333
22333
  });
22334
22334
  }
22335
22335
  function T(D) {
22336
22336
  if (!s.isDrop || !D.dataTransfer) return;
22337
- const { dataTransfer: L, offsetX: k, offsetY: P } = D, j = L.getData("text/plain"), M = L.getData("text/uri-list"), R = L.getData("custom/offset"), G = R ? JSON.parse(R) : null, it = { top: P, left: k }, at = { x: G?.offsetX ?? 0, y: G?.offsetY ?? 0 };
22338
- M ? E(M, it, at) : j && O(j, it, at);
22337
+ const { dataTransfer: L, offsetX: M, offsetY: P } = D, j = L.getData("text/plain"), k = L.getData("text/uri-list"), R = L.getData("custom/offset"), G = R ? JSON.parse(R) : null, it = { top: P, left: M }, at = { x: G?.offsetX ?? 0, y: G?.offsetY ?? 0 };
22338
+ k ? E(k, it, at) : j && O(j, it, at);
22339
22339
  }
22340
- function E(D, L, k) {
22341
- d(D, { ...s.dropImageOptions, ...L }, k);
22340
+ function E(D, L, M) {
22341
+ d(D, { ...s.dropImageOptions, ...L }, M);
22342
22342
  }
22343
- function O(D, L, k) {
22344
- f(D, { ...s.dropTextOptions, ...L }, k);
22343
+ function O(D, L, M) {
22344
+ f(D, { ...s.dropTextOptions, ...L }, M);
22345
22345
  }
22346
22346
  function N() {
22347
22347
  s.manualReload || A(), i("reload");