@netless/appliance-plugin 1.1.22-beta.8 → 1.1.22-beta.9

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.
@@ -1,22 +1,22 @@
1
- var Xe = Object.defineProperty;
2
- var Ye = (k, i, t) => i in k ? Xe(k, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : k[i] = t;
3
- var m = (k, i, t) => Ye(k, typeof i != "symbol" ? i + "" : i, t);
4
- import { g as Zt, _ as Se, i as Kt, p as kt, a as St, D as J, c as E, b as Rt, E as Bt, d as Q, P as M, V as P, s as Vt, e as Jt, f as Nt, h as ve, r as $e, j as _e, k as S, l as _t, m as U, n as g, o as x, q as O, t as F, u as tt, v as $, w as qt, x as Ge, y as He, z as qe, A as je, B as Ze, C as Ke, F as Ve, G as Je, S as X, H as Qe, I as ne, J as Wt, K as Te, L as yt, M as ts, N as Pe, O as es, Q as ss, R as ct, T as _, U as ut, W as os, X as is, Y as rs, Z as ns, $ as bt, a0 as as, a1 as z, a2 as ae, a3 as ce, a4 as cs } from "./index-CoEv9lC2.mjs";
5
- import { Group as j, Path as wt, Sprite as Ie, Rect as le, Polyline as ht, Ellipse as ls, Label as hs, Scene as Qt, Layer as ps } from "spritejs";
1
+ var Ye = Object.defineProperty;
2
+ var _e = (k, i, t) => i in k ? Ye(k, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : k[i] = t;
3
+ var m = (k, i, t) => _e(k, typeof i != "symbol" ? i + "" : i, t);
4
+ import { g as Zt, _ as Se, i as Kt, p as kt, a as St, D as J, c as E, b as Rt, E as Bt, d as et, P as M, V as P, s as Vt, e as Jt, f as Nt, h as ve, r as $e, j as Ge, k as S, l as $t, m as U, n as g, o as x, q as O, t as F, u as Q, v as _, w as qt, x as He, y as qe, z as je, A as Ze, B as Ke, C as Ve, F as Je, G as Qe, S as X, H as ts, I as ne, J as Wt, K as Te, L as yt, M as es, N as Pe, O as ss, Q as os, R as ct, T as $, U as ut, W as is, X as rs, Y as ns, Z as as, $ as bt, a0 as cs, a1 as z, a2 as ae, a3 as ce, a4 as ls } from "./index-JJlKXT7X.mjs";
5
+ import { Group as j, Path as wt, Sprite as Ie, Rect as le, Polyline as ht, Ellipse as hs, Label as ps, Scene as Qt, Layer as ds } from "spritejs";
6
6
  import it from "clipper-lib";
7
7
  import te from "lineclip";
8
8
  import "lz-string";
9
- import { cloneDeep as We, xor as ds, isNumber as Et, isEqual as he } from "lodash";
9
+ import { cloneDeep as We, xor as us, isNumber as Et, isEqual as he } from "lodash";
10
10
  import "white-web-sdk";
11
11
  import "react-dom";
12
12
  import "react";
13
13
  import "eventemitter2";
14
- var us = Se, fs = Kt, ms = "[object Number]";
15
- function ys(k) {
16
- return typeof k == "number" || fs(k) && us(k) == ms;
14
+ var fs = Se, ms = Kt, ys = "[object Number]";
15
+ function ws(k) {
16
+ return typeof k == "number" || ms(k) && fs(k) == ys;
17
17
  }
18
- var ws = ys;
19
- const q = /* @__PURE__ */ Zt(ws);
18
+ var gs = ws;
19
+ const q = /* @__PURE__ */ Zt(gs);
20
20
  function mt(k, i = !0) {
21
21
  const t = k.length;
22
22
  if (t < 2)
@@ -32,7 +32,7 @@ function mt(k, i = !0) {
32
32
  k[2]
33
33
  )}T${o}${St(k[t - 1], k[0])}${St(k[0], k[1])}Z` : `M${kt(k[0])}Q${kt(k[1])}${St(k[1], k[2])}${k.length > 3 ? "T" : ""}${o}L${kt(k[t - 1])}`;
34
34
  }
35
- const et = class et {
35
+ const tt = class tt {
36
36
  constructor(i) {
37
37
  m(this, "maxImageWidth", J.pencilEraser.maxImageWidth);
38
38
  m(this, "maxImageHeight", J.pencilEraser.maxImageHeight);
@@ -89,10 +89,10 @@ const et = class et {
89
89
  q(c) && (d.zIndex = c), a && (d.pos = [a[0], a[1]]), h && (d.scale = h), l && (d.rotate = l), p && (d.translate = p), n.attr(d);
90
90
  const u = n == null ? void 0 : n.getBoundingClientRect();
91
91
  return u && (t = E(t, {
92
- x: Math.floor(u.x - et.SafeBorderPadding),
93
- y: Math.floor(u.y - et.SafeBorderPadding),
94
- w: Math.floor(u.width + et.SafeBorderPadding * 2),
95
- h: Math.floor(u.height + et.SafeBorderPadding * 2)
92
+ x: Math.floor(u.x - tt.SafeBorderPadding),
93
+ y: Math.floor(u.y - tt.SafeBorderPadding),
94
+ w: Math.floor(u.width + tt.SafeBorderPadding * 2),
95
+ h: Math.floor(u.height + tt.SafeBorderPadding * 2)
96
96
  })), (o = this.vNodes) == null || o.setInfo(e, {
97
97
  rect: t,
98
98
  centerPos: a
@@ -145,25 +145,25 @@ const et = class et {
145
145
  h: y.height
146
146
  };
147
147
  if (Rt(L, N) === Bt.outside) {
148
- Z(v, T), y.removeChild(T), this.isDelete = !0;
148
+ V(v, T), y.removeChild(T), this.isDelete = !0;
149
149
  return;
150
150
  }
151
- const D = Q(L);
151
+ const D = et(L);
152
152
  D.x = Math.floor(Math.max(L.x, 0)), D.y = Math.floor(Math.max(L.y, 0)), D.w = Math.min(L.x + L.w, y.width) - D.x, D.h = Math.min(L.y + L.h, y.height) - D.y;
153
- const B = this.getGroupRect(D, I), Y = B.x, G = B.y, rt = B.w, K = B.h;
154
- let V = W.getImageData(Y, G, rt, K);
155
- if (this.isTransparentRectByCanvas(V)) {
156
- Z(v, T), y.removeChild(T), this.isDelete = !0, V = null;
153
+ const B = this.getGroupRect(D, I), Y = B.x, G = B.y, rt = B.w, Z = B.h;
154
+ let K = W.getImageData(Y, G, rt, Z);
155
+ if (this.isTransparentRectByCanvas(K)) {
156
+ V(v, T), y.removeChild(T), this.isDelete = !0, K = null;
157
157
  return;
158
158
  }
159
- Z(e, n);
159
+ V(e, n);
160
160
  const gt = this.createSpriteNode({
161
- imageData: V,
161
+ imageData: K,
162
162
  safariRect: D,
163
163
  originRect: L,
164
164
  worldScaling: w.worldScaling
165
165
  });
166
- gt && e.append(gt), Z(v, T), y.removeChild(T), n.deleteTexture(V), V = null;
166
+ gt && e.append(gt), V(v, T), y.removeChild(T), n.deleteTexture(K), K = null;
167
167
  } catch (a) {
168
168
  console.error("[BaseShapeTool] drawEraserlines error:", a);
169
169
  return;
@@ -335,7 +335,7 @@ const et = class et {
335
335
  thickness: u
336
336
  } = e;
337
337
  let y;
338
- const f = r && Q(r) || s.get(t.name);
338
+ const f = r && et(r) || s.get(t.name);
339
339
  if (!f) return;
340
340
  q(n) && (t.setAttribute("zIndex", n), f.opt.zIndex = n);
341
341
  const w = t.parent;
@@ -367,14 +367,14 @@ const et = class et {
367
367
  ];
368
368
  y = Nt(f.rect, T), f.rect = y;
369
369
  } else {
370
- const T = et.getRectFromLayer(w, t.name);
370
+ const T = tt.getRectFromLayer(w, t.name);
371
371
  f.rect = T || f.rect;
372
372
  }
373
373
  else if (q(c))
374
374
  if (t.setAttribute("rotate", c), f.opt.rotate = c, r)
375
375
  y = ve(f.rect, c), f.rect = y;
376
376
  else {
377
- const T = et.getRectFromLayer(w, t.name);
377
+ const T = tt.getRectFromLayer(w, t.name);
378
378
  f.rect = T || f.rect;
379
379
  }
380
380
  if (d) {
@@ -406,7 +406,7 @@ const et = class et {
406
406
  for (let C = 0; C < f.opt.eraserlines.length; C++) {
407
407
  const { op: W } = f.opt.eraserlines[C];
408
408
  for (let I = 0; I < W.length; I++)
409
- _e(W[I], f.centerPos, c);
409
+ Ge(W[I], f.centerPos, c);
410
410
  }
411
411
  }
412
412
  }
@@ -425,20 +425,20 @@ const et = class et {
425
425
  if (e) {
426
426
  const s = e.getBoundingClientRect();
427
427
  return {
428
- x: Math.floor(s.x - et.SafeBorderPadding),
429
- y: Math.floor(s.y - et.SafeBorderPadding),
430
- w: Math.floor(s.width + et.SafeBorderPadding * 2),
431
- h: Math.floor(s.height + et.SafeBorderPadding * 2)
428
+ x: Math.floor(s.x - tt.SafeBorderPadding),
429
+ y: Math.floor(s.y - tt.SafeBorderPadding),
430
+ w: Math.floor(s.width + tt.SafeBorderPadding * 2),
431
+ h: Math.floor(s.height + tt.SafeBorderPadding * 2)
432
432
  };
433
433
  }
434
434
  }
435
435
  static isWillRefresh(i) {
436
436
  const { toolsType: t, opt: e, node: s, updateOpt: o, willSerializeData: r } = i;
437
- return !!(r && (o.angle || o.translate) || o.thickness && e.thickness && e.thickness !== o.thickness || o.strokeType && e.strokeType && e.strokeType !== o.strokeType || o.originPoint && o.scenePoint && o.scale || o.pointMap && o.pointMap.has(s.name) || t === S.Text && (o.fontSize || o.translate || o.textInfos && o.textInfos.get(s.name)) || t === S.Image && (o.angle || o.translate || o.scale || o.strokeColor && o.type === _t.Iconify) || t === o.toolsType && o.willRefresh || e.eraserlines && e.eraserlines.length && (o.strokeColor || o.fillColor));
437
+ return !!(r && (o.angle || o.translate) || o.thickness && e.thickness && e.thickness !== o.thickness || o.strokeType && e.strokeType && e.strokeType !== o.strokeType || o.originPoint && o.scenePoint && o.scale || o.pointMap && o.pointMap.has(s.name) || t === S.Text && (o.fontSize || o.translate || o.textInfos && o.textInfos.get(s.name)) || t === S.Image && (o.angle || o.translate || o.scale || o.strokeColor && o.type === $t.Iconify) || t === o.toolsType && o.willRefresh || e.eraserlines && e.eraserlines.length && (o.strokeColor || o.fillColor));
438
438
  }
439
439
  };
440
- m(et, "SafeBorderPadding", 10);
441
- let b = et;
440
+ m(tt, "SafeBorderPadding", 10);
441
+ let b = tt;
442
442
  const ee = Object.freeze([
443
443
  Object.freeze({ width: 18, height: 26 }),
444
444
  Object.freeze({ width: 26, height: 34 }),
@@ -448,39 +448,39 @@ const ee = Object.freeze([
448
448
  function Le(k, i, t = 0.01) {
449
449
  return Math.abs(k[0] - i[0]) < t && Math.abs(k[1] - i[1]) < t;
450
450
  }
451
- function gs(k, i = 0.01) {
451
+ function ks(k, i = 0.01) {
452
452
  if (k.length === 0) return [];
453
453
  const t = [[k[0][0], k[0][1]]];
454
454
  for (let e = 1; e < k.length; e++)
455
455
  Le([k[e][0], k[e][1]], t[t.length - 1], i) || t.push([k[e][0], k[e][1]]);
456
456
  return t;
457
457
  }
458
- function ks(k, i = 0.01) {
458
+ function Ss(k, i = 0.01) {
459
459
  if (k.length <= 2) return k;
460
460
  const t = k[0], e = k[k.length - 1];
461
461
  return Le(t, e, i) ? k.slice(0, -1) : k;
462
462
  }
463
- function Ss(k) {
463
+ function vs(k) {
464
464
  const i = k.reduce((e, s) => e + s[0], 0) / k.length, t = k.reduce((e, s) => e + s[1], 0) / k.length;
465
465
  return [i, t];
466
466
  }
467
467
  function pe(k, i) {
468
468
  return Math.atan2(i[1] - k[1], i[0] - k[0]);
469
469
  }
470
- function vs(k, i = 0.01) {
470
+ function Ts(k, i = 0.01) {
471
471
  if (k.length <= 2) return k;
472
472
  const t = [];
473
473
  for (const s of k)
474
474
  t.some(
475
475
  (r) => Math.abs(r[0] - s[0]) < i && Math.abs(r[1] - s[1]) < i
476
476
  ) || t.push([s[0], s[1]]);
477
- const e = Ss(t);
477
+ const e = vs(t);
478
478
  return t.sort((s, o) => {
479
479
  const r = pe(e, s), n = pe(e, o);
480
480
  return r - n;
481
481
  });
482
482
  }
483
- function Ts(k, i) {
483
+ function Ps(k, i) {
484
484
  const t = i[0].x < i[i.length - 1].x;
485
485
  return k.map((s) => {
486
486
  const r = s.map((n) => {
@@ -499,7 +499,7 @@ function Ts(k, i) {
499
499
  return t ? r - n : n - r;
500
500
  });
501
501
  }
502
- function Ps(k, i, t = 0.01) {
502
+ function Is(k, i, t = 0.01) {
503
503
  const s = k.map((l) => [l.x, l.y]), o = (l, p) => l.map(([d, u]) => ({
504
504
  X: Math.round(d * p),
505
505
  Y: Math.round(u * p)
@@ -527,9 +527,9 @@ function Ps(k, i, t = 0.01) {
527
527
  it.PolyFillType.pftNonZero
528
528
  );
529
529
  const h = c.map(
530
- (l) => ks(
531
- vs(
532
- gs(
530
+ (l) => Ss(
531
+ Ts(
532
+ ks(
533
533
  l.map(
534
534
  (p) => [p.X / 1e3, p.Y / 1e3]
535
535
  ),
@@ -540,7 +540,7 @@ function Ps(k, i, t = 0.01) {
540
540
  t
541
541
  )
542
542
  ).filter((l) => l.length >= 2);
543
- return Ts(h, k);
543
+ return Ps(h, k);
544
544
  }
545
545
  class Ce extends b {
546
546
  constructor(t) {
@@ -617,6 +617,7 @@ class Ce extends b {
617
617
  dataType: x.Local,
618
618
  op: w ? C : void 0,
619
619
  index: w ? v * 3 : void 0,
620
+ rect: f,
620
621
  updateNodeOpt: {
621
622
  useAnimation: !0
622
623
  }
@@ -665,7 +666,7 @@ class Ce extends b {
665
666
  this.tmpPoints.map((l) => {
666
667
  a.push(l.x, l.y, l.z);
667
668
  }), this.syncTimestamp = 0, delete this.workOptions.syncUnitTime;
668
- const c = tt(a);
669
+ const c = Q(a);
669
670
  return (h = this.vNodes) == null || h.setInfo(e, {
670
671
  rect: r,
671
672
  op: a,
@@ -765,7 +766,7 @@ class Ce extends b {
765
766
  const { ps: f } = this.computStroke(y, !1);
766
767
  p.push(f.map((w) => w.XY));
767
768
  }
768
- Ps(
769
+ Is(
769
770
  l,
770
771
  p,
771
772
  0.01
@@ -883,7 +884,7 @@ class Ce extends b {
883
884
  computNomal(t) {
884
885
  let e = this.workOptions.thickness;
885
886
  const s = t.map((o) => (e = Math.max(e, o.radius), o.point));
886
- return { ps: s, rect: $(s, e) };
887
+ return { ps: s, rect: _(s, e) };
887
888
  }
888
889
  computStroke(t, e = !0) {
889
890
  return t.length === 1 ? this.computDotStroke(t[0]) : this.computLineStroke(t, e);
@@ -910,10 +911,10 @@ class Ce extends b {
910
911
  -1,
911
912
  8
912
913
  ), h = s.concat(a, o.reverse(), c);
913
- return { ps: h, rect: $(h) };
914
+ return { ps: h, rect: _(h) };
914
915
  }
915
916
  const n = s.concat(o.reverse());
916
- return { ps: n, rect: $(n) };
917
+ return { ps: n, rect: _(n) };
917
918
  }
918
919
  computDotStroke(t) {
919
920
  const { point: e, radius: s } = t, o = {
@@ -1152,7 +1153,7 @@ class be extends b {
1152
1153
  return { type: g.None };
1153
1154
  if (n && (this.syncUnitTime = n), this.updateTempPoints(r || []), this.consumeIndex > this.tmpPoints.length - 4)
1154
1155
  return { type: g.None };
1155
- const { strokeColor: a, thickness: c, strokeType: h } = this.workOptions, l = $(this.tmpPoints, c);
1156
+ const { strokeColor: a, thickness: c, strokeType: h } = this.workOptions, l = _(this.tmpPoints, c);
1156
1157
  let p = !1;
1157
1158
  const d = this.syncIndex, u = this.tmpPoints.slice(this.consumeIndex);
1158
1159
  this.consumeIndex = this.tmpPoints.length - 1, this.syncTimestamp === 0 && (this.syncTimestamp = Date.now());
@@ -1205,7 +1206,7 @@ class be extends b {
1205
1206
  });
1206
1207
  n = u.ps, e = u.rect;
1207
1208
  } else
1208
- e = $(this.tmpPoints, h);
1209
+ e = _(this.tmpPoints, h);
1209
1210
  const p = {
1210
1211
  name: t == null ? void 0 : t.toString(),
1211
1212
  fillColor: a ? c : void 0,
@@ -1227,7 +1228,7 @@ class be extends b {
1227
1228
  this.tmpPoints.forEach((n) => {
1228
1229
  s.push(n.x, n.y);
1229
1230
  });
1230
- const o = tt(s);
1231
+ const o = Q(s);
1231
1232
  return {
1232
1233
  rect: e && {
1233
1234
  x: e.x * this.fullLayer.worldScaling[0] + this.fullLayer.worldPosition[0],
@@ -1249,7 +1250,7 @@ class be extends b {
1249
1250
  var y;
1250
1251
  const { op: e, replaceId: s, isFullWork: o } = t, { strokeColor: r, thickness: n, strokeType: a } = this.workOptions;
1251
1252
  if (!e.length) {
1252
- const f = $(this.tmpPoints, n);
1253
+ const f = _(this.tmpPoints, n);
1253
1254
  return {
1254
1255
  x: f.x * this.fullLayer.worldScaling[0] + this.fullLayer.worldPosition[0],
1255
1256
  y: f.y * this.fullLayer.worldScaling[1] + this.fullLayer.worldPosition[1],
@@ -1268,7 +1269,7 @@ class be extends b {
1268
1269
  });
1269
1270
  l = f.ps, h = f.rect;
1270
1271
  } else
1271
- h = $(this.tmpPoints, n);
1272
+ h = _(this.tmpPoints, n);
1272
1273
  const d = {
1273
1274
  name: (y = this.workId) == null ? void 0 : y.toString(),
1274
1275
  fillColor: p ? r : void 0,
@@ -1454,7 +1455,7 @@ const Tt = class Tt extends b {
1454
1455
  );
1455
1456
  c.push(p), a.push(new M(p.x, p.y));
1456
1457
  }
1457
- const h = a.length && $(a) || r.rect;
1458
+ const h = a.length && _(a) || r.rect;
1458
1459
  qt(h, this.eraserRect) && (c.length > 1 ? te.polyline(
1459
1460
  c.map((p) => p.XY),
1460
1461
  this.eraserPolyline
@@ -1537,14 +1538,14 @@ const Tt = class Tt extends b {
1537
1538
  // 来源于white-sdk
1538
1539
  m(Tt, "eraserSizes", ee);
1539
1540
  let Ft = Tt;
1540
- var de = Ge, Is = 1, Ws = Object.prototype, Ls = Ws.hasOwnProperty;
1541
- function Cs(k, i, t, e, s, o) {
1542
- var r = t & Is, n = de(k), a = n.length, c = de(i), h = c.length;
1541
+ var de = He, Ws = 1, Ls = Object.prototype, Cs = Ls.hasOwnProperty;
1542
+ function bs(k, i, t, e, s, o) {
1543
+ var r = t & Ws, n = de(k), a = n.length, c = de(i), h = c.length;
1543
1544
  if (a != h && !r)
1544
1545
  return !1;
1545
1546
  for (var l = a; l--; ) {
1546
1547
  var p = n[l];
1547
- if (!(r ? p in i : Ls.call(i, p)))
1548
+ if (!(r ? p in i : Cs.call(i, p)))
1548
1549
  return !1;
1549
1550
  }
1550
1551
  var d = o.get(k), u = o.get(i);
@@ -1569,8 +1570,8 @@ function Cs(k, i, t, e, s, o) {
1569
1570
  }
1570
1571
  return o.delete(k), o.delete(i), y;
1571
1572
  }
1572
- var bs = Cs, Ht = He, Rs = qe, Ns = je, xs = bs, ue = Ze, fe = Je, me = Ke, Ds = Ve, Ms = 1, ye = "[object Arguments]", we = "[object Array]", At = "[object Object]", Os = Object.prototype, ge = Os.hasOwnProperty;
1573
- function As(k, i, t, e, s, o) {
1573
+ var Rs = bs, Ht = qe, Ns = je, xs = Ze, Ds = Rs, ue = Ke, fe = Qe, me = Ve, Ms = Je, Os = 1, ye = "[object Arguments]", we = "[object Array]", At = "[object Object]", As = Object.prototype, ge = As.hasOwnProperty;
1574
+ function Es(k, i, t, e, s, o) {
1574
1575
  var r = fe(k), n = fe(i), a = r ? we : ue(k), c = n ? we : ue(i);
1575
1576
  a = a == ye ? At : a, c = c == ye ? At : c;
1576
1577
  var h = a == At, l = c == At, p = a == c;
@@ -1580,26 +1581,26 @@ function As(k, i, t, e, s, o) {
1580
1581
  r = !0, h = !1;
1581
1582
  }
1582
1583
  if (p && !h)
1583
- return o || (o = new Ht()), r || Ds(k) ? Rs(k, i, t, e, s, o) : Ns(k, i, a, t, e, s, o);
1584
- if (!(t & Ms)) {
1584
+ return o || (o = new Ht()), r || Ms(k) ? Ns(k, i, t, e, s, o) : xs(k, i, a, t, e, s, o);
1585
+ if (!(t & Os)) {
1585
1586
  var d = h && ge.call(k, "__wrapped__"), u = l && ge.call(i, "__wrapped__");
1586
1587
  if (d || u) {
1587
1588
  var y = d ? k.value() : k, f = u ? i.value() : i;
1588
1589
  return o || (o = new Ht()), s(y, f, t, e, o);
1589
1590
  }
1590
1591
  }
1591
- return p ? (o || (o = new Ht()), xs(k, i, t, e, s, o)) : !1;
1592
+ return p ? (o || (o = new Ht()), Ds(k, i, t, e, s, o)) : !1;
1592
1593
  }
1593
- var Es = As, Bs = Es, ke = Kt;
1594
+ var Bs = Es, Fs = Bs, ke = Kt;
1594
1595
  function Re(k, i, t, e, s) {
1595
- return k === i ? !0 : k == null || i == null || !ke(k) && !ke(i) ? k !== k && i !== i : Bs(k, i, t, e, Re, s);
1596
+ return k === i ? !0 : k == null || i == null || !ke(k) && !ke(i) ? k !== k && i !== i : Fs(k, i, t, e, Re, s);
1596
1597
  }
1597
- var Fs = Re, zs = Fs;
1598
- function Us(k, i) {
1599
- return zs(k, i);
1598
+ var zs = Re, Us = zs;
1599
+ function Xs(k, i) {
1600
+ return Us(k, i);
1600
1601
  }
1601
- var Xs = Us;
1602
- const lt = /* @__PURE__ */ Zt(Xs), $t = class $t extends b {
1602
+ var Ys = Xs;
1603
+ const lt = /* @__PURE__ */ Zt(Ys), _t = class _t extends b {
1603
1604
  constructor(t) {
1604
1605
  super(t);
1605
1606
  m(this, "toolsType", S.Selector);
@@ -1627,7 +1628,7 @@ const lt = /* @__PURE__ */ Zt(Xs), $t = class $t extends b {
1627
1628
  this.workOptions = t.toolsOpt, this.vNodes = t.vNodes;
1628
1629
  }
1629
1630
  computSelector(t = !0) {
1630
- const e = $(this.tmpPoints);
1631
+ const e = _(this.tmpPoints);
1631
1632
  if (e.w === 0 || e.h === 0)
1632
1633
  return {
1633
1634
  selectIds: [],
@@ -1671,7 +1672,7 @@ const lt = /* @__PURE__ */ Zt(Xs), $t = class $t extends b {
1671
1672
  strokeColor: this.selectorColor || this.workOptions.strokeColor,
1672
1673
  width: e.w,
1673
1674
  height: e.h,
1674
- name: $t.selectorBorderId
1675
+ name: _t.selectorBorderId
1675
1676
  });
1676
1677
  c.push(h);
1677
1678
  }
@@ -1822,7 +1823,7 @@ const lt = /* @__PURE__ */ Zt(Xs), $t = class $t extends b {
1822
1823
  const { thickness: e } = this.workOptions, s = [];
1823
1824
  for (const n of t)
1824
1825
  s.push(new P(...n));
1825
- const o = $(s, e), r = [
1826
+ const o = _(s, e), r = [
1826
1827
  o.x + o.w / 2,
1827
1828
  o.y + o.h / 2
1828
1829
  ];
@@ -1833,7 +1834,7 @@ const lt = /* @__PURE__ */ Zt(Xs), $t = class $t extends b {
1833
1834
  };
1834
1835
  }
1835
1836
  drawForSubWorker(t) {
1836
- const { workId: e, layer: s, ps: o } = t, { strokeColor: r, scale: n, rotate: a, translate: c } = this.workOptions, h = s.worldPosition, l = s.worldScaling, { points: p, rect: d, pos: u } = this.computDrawPoints(o), y = 1 / s.worldScaling[0], f = r && Qe(r) || [0, 0, 0, 0], w = {
1837
+ const { workId: e, layer: s, ps: o } = t, { strokeColor: r, scale: n, rotate: a, translate: c } = this.workOptions, h = s.worldPosition, l = s.worldScaling, { points: p, rect: d, pos: u } = this.computDrawPoints(o), y = 1 / s.worldScaling[0], f = r && ts(r) || [0, 0, 0, 0], w = {
1837
1838
  close: !0,
1838
1839
  normalize: !0,
1839
1840
  points: p,
@@ -1882,7 +1883,7 @@ const lt = /* @__PURE__ */ Zt(Xs), $t = class $t extends b {
1882
1883
  return v;
1883
1884
  }
1884
1885
  transformData(t) {
1885
- const e = $(t);
1886
+ const e = _(t);
1886
1887
  return [
1887
1888
  [e.x, e.y, 0],
1888
1889
  [e.x + e.w, e.y, 0],
@@ -2089,8 +2090,8 @@ const lt = /* @__PURE__ */ Zt(Xs), $t = class $t extends b {
2089
2090
  replaceId: W,
2090
2091
  workState: d
2091
2092
  });
2092
- } catch (K) {
2093
- console.error("consumeService error", K);
2093
+ } catch (Z) {
2094
+ console.error("consumeService error", Z);
2094
2095
  continue;
2095
2096
  }
2096
2097
  rt && (I.rect = rt);
@@ -2252,8 +2253,8 @@ const lt = /* @__PURE__ */ Zt(Xs), $t = class $t extends b {
2252
2253
  });
2253
2254
  }
2254
2255
  };
2255
- m($t, "selectorBorderId", "selector-border");
2256
- let zt = $t;
2256
+ m(_t, "selectorBorderId", "selector-border");
2257
+ let zt = _t;
2257
2258
  class Ne extends b {
2258
2259
  constructor(t) {
2259
2260
  super(t);
@@ -2332,7 +2333,7 @@ class Ne extends b {
2332
2333
  };
2333
2334
  const e = this.fullLayer, s = this.draw({ workId: t, layer: e });
2334
2335
  this.oldRect = s;
2335
- const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = tt(o);
2336
+ const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = Q(o);
2336
2337
  return (n = this.vNodes) == null || n.setInfo(t, {
2337
2338
  rect: s,
2338
2339
  op: o,
@@ -2451,7 +2452,7 @@ class Ne extends b {
2451
2452
  trianglePoints: y.map((w) => M.Sub(w, this.tmpPoints[1]).XY).flat(1),
2452
2453
  trianglePos: this.tmpPoints[1].XY,
2453
2454
  points: u.map((w) => M.Sub(w, this.tmpPoints[0]).XY).flat(1),
2454
- rect: $(f),
2455
+ rect: _(f),
2455
2456
  isTriangle: !1,
2456
2457
  pos: this.tmpPoints[0].XY
2457
2458
  };
@@ -2466,7 +2467,7 @@ class Ne extends b {
2466
2467
  return {
2467
2468
  trianglePoints: n.map((a) => M.Sub(a, this.tmpPoints[1]).XY).flat(1),
2468
2469
  trianglePos: this.tmpPoints[1].XY,
2469
- rect: $(n),
2470
+ rect: _(n),
2470
2471
  isTriangle: !0
2471
2472
  };
2472
2473
  }
@@ -2596,7 +2597,7 @@ class xe extends b {
2596
2597
  isDrawing: !1
2597
2598
  });
2598
2599
  this.oldRect = s;
2599
- const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = tt(o);
2600
+ const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = Q(o);
2600
2601
  return (n = this.vNodes) == null || n.setInfo(t, {
2601
2602
  rect: s,
2602
2603
  op: o,
@@ -2659,7 +2660,7 @@ class xe extends b {
2659
2660
  });
2660
2661
  I.append(N);
2661
2662
  }
2662
- const R = new ls({
2663
+ const R = new hs({
2663
2664
  ...C,
2664
2665
  pos: [0, 0]
2665
2666
  });
@@ -2681,7 +2682,7 @@ class xe extends b {
2681
2682
  };
2682
2683
  }
2683
2684
  computDrawPoints(t) {
2684
- const e = $(this.tmpPoints), s = $(this.tmpPoints, t), o = [
2685
+ const e = _(this.tmpPoints), s = _(this.tmpPoints, t), o = [
2685
2686
  Math.floor(e.x + e.w / 2),
2686
2687
  Math.floor(e.y + e.h / 2)
2687
2688
  ];
@@ -2750,7 +2751,7 @@ class De extends b {
2750
2751
  this.workOptions = t.toolsOpt, this.syncTimestamp = 0, this.syncUnitTime = 50;
2751
2752
  }
2752
2753
  transformData() {
2753
- const t = $(this.tmpPoints);
2754
+ const t = _(this.tmpPoints);
2754
2755
  return [
2755
2756
  [t.x, t.y, 0],
2756
2757
  [t.x + t.w, t.y, 0],
@@ -2762,7 +2763,7 @@ class De extends b {
2762
2763
  const { thickness: e } = this.workOptions, s = [];
2763
2764
  for (const n of t)
2764
2765
  s.push(new P(...n));
2765
- const o = $(s, e), r = [
2766
+ const o = _(s, e), r = [
2766
2767
  o.x + o.w / 2,
2767
2768
  o.y + o.h / 2
2768
2769
  ];
@@ -2841,7 +2842,7 @@ class De extends b {
2841
2842
  isDrawing: !1
2842
2843
  });
2843
2844
  this.oldRect = o;
2844
- const r = e.flat(1), n = tt(r);
2845
+ const r = e.flat(1), n = Q(r);
2845
2846
  return (a = this.vNodes) == null || a.setInfo(t, {
2846
2847
  rect: o,
2847
2848
  op: r,
@@ -3082,7 +3083,7 @@ class Me extends b {
3082
3083
  isDrawing: !1
3083
3084
  });
3084
3085
  this.oldRect = s;
3085
- const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = tt(o);
3086
+ const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = Q(o);
3086
3087
  return (n = this.vNodes) == null || n.setInfo(t, {
3087
3088
  rect: s,
3088
3089
  op: o,
@@ -3175,7 +3176,7 @@ class Me extends b {
3175
3176
  };
3176
3177
  }
3177
3178
  computDrawPoints(t, e, s, o) {
3178
- const r = $(this.tmpPoints), n = [
3179
+ const r = _(this.tmpPoints), n = [
3179
3180
  Math.floor(r.x + r.w / 2),
3180
3181
  Math.floor(r.y + r.h / 2)
3181
3182
  ], a = Te(r.w, r.h), c = Math.floor(Math.min(r.w, r.h) / 2), h = o * c, l = [], p = 2 * Math.PI / e;
@@ -3185,7 +3186,7 @@ class Me extends b {
3185
3186
  u % s === 1 ? (f = h * a[0] * Math.cos(y), w = h * a[1] * Math.sin(y)) : (f = c * a[0] * Math.cos(y), w = c * a[1] * Math.sin(y), l.push(f, w)), l.push(f, w);
3186
3187
  }
3187
3188
  return {
3188
- rect: $(this.tmpPoints, t),
3189
+ rect: _(this.tmpPoints, t),
3189
3190
  pos: n,
3190
3191
  points: l
3191
3192
  };
@@ -3325,7 +3326,7 @@ class Oe extends b {
3325
3326
  isDrawing: !1
3326
3327
  });
3327
3328
  this.oldRect = s;
3328
- const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = tt(o);
3329
+ const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = Q(o);
3329
3330
  return (n = this.vNodes) == null || n.setInfo(t, {
3330
3331
  rect: s,
3331
3332
  op: o,
@@ -3411,7 +3412,7 @@ class Oe extends b {
3411
3412
  };
3412
3413
  }
3413
3414
  computDrawPoints(t, e) {
3414
- const s = $(this.tmpPoints), o = [
3415
+ const s = _(this.tmpPoints), o = [
3415
3416
  Math.floor(s.x + s.w / 2),
3416
3417
  Math.floor(s.y + s.h / 2)
3417
3418
  ], r = Te(s.w, s.h), n = Math.floor(Math.min(s.w, s.h) / 2), a = [], c = 2 * Math.PI / e;
@@ -3420,7 +3421,7 @@ class Oe extends b {
3420
3421
  a.push(d, u);
3421
3422
  }
3422
3423
  return {
3423
- rect: $(this.tmpPoints, t),
3424
+ rect: _(this.tmpPoints, t),
3424
3425
  pos: o,
3425
3426
  points: a
3426
3427
  };
@@ -3617,7 +3618,7 @@ class Ae extends b {
3617
3618
  isDrawing: !1
3618
3619
  });
3619
3620
  this.oldRect = s;
3620
- const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = tt(o);
3621
+ const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = Q(o);
3621
3622
  return (n = this.vNodes) == null || n.setInfo(t, {
3622
3623
  rect: s,
3623
3624
  op: o,
@@ -3692,7 +3693,7 @@ class Ae extends b {
3692
3693
  };
3693
3694
  }
3694
3695
  transformControlPoints(t) {
3695
- const e = $(this.tmpPoints);
3696
+ const e = _(this.tmpPoints);
3696
3697
  switch (t) {
3697
3698
  case "bottom":
3698
3699
  case "bottomLeft":
@@ -3741,7 +3742,7 @@ class Ae extends b {
3741
3742
  }
3742
3743
  }
3743
3744
  computDrawPoints(t, e) {
3744
- const s = $(this.tmpPoints), o = this.transformControlPoints(e), r = Math.floor(s.w * 0.1), n = Math.floor(s.h * 0.1), a = [], c = P.Add(o[0], new P(0, n, 0)), h = P.Add(o[0], new P(r, 0, 0)), l = st.getBezierPoints(
3745
+ const s = _(this.tmpPoints), o = this.transformControlPoints(e), r = Math.floor(s.w * 0.1), n = Math.floor(s.h * 0.1), a = [], c = P.Add(o[0], new P(0, n, 0)), h = P.Add(o[0], new P(r, 0, 0)), l = st.getBezierPoints(
3745
3746
  10,
3746
3747
  c,
3747
3748
  o[0],
@@ -4040,7 +4041,7 @@ class Ae extends b {
4040
4041
  break;
4041
4042
  }
4042
4043
  }
4043
- const R = $(this.tmpPoints, t), L = [
4044
+ const R = _(this.tmpPoints, t), L = [
4044
4045
  Math.floor(R.x + R.w / 2),
4045
4046
  Math.floor(R.y + R.h / 2)
4046
4047
  ];
@@ -4096,12 +4097,12 @@ class Ae extends b {
4096
4097
  return e.tagName === "GROUP" && (d = e.children[0]), r && (d.setAttribute("strokeColor", r), p != null && p.strokeColor && (p.strokeColor = r)), n && (n === "transparent" ? d.setAttribute("fillColor", "rgba(0,0,0,0)") : d.setAttribute("fillColor", n), p != null && p.fillColor && (p.fillColor = n)), a === S.SpeechBalloon && c && (p.placement = c), h && (l != null && l.opt) && ((u = l.opt) != null && u.strokeType) && (l.opt.strokeType = h), l && o.setInfo(e.name, { ...l, opt: p }), b.updateNodeOpt(t);
4097
4098
  }
4098
4099
  }
4099
- var Ys = Se, $s = Kt, _s = "[object Boolean]";
4100
- function Gs(k) {
4101
- return k === !0 || k === !1 || $s(k) && Ys(k) == _s;
4100
+ var _s = Se, $s = Kt, Gs = "[object Boolean]";
4101
+ function Hs(k) {
4102
+ return k === !0 || k === !1 || $s(k) && _s(k) == Gs;
4102
4103
  }
4103
- var Hs = Gs;
4104
- const vt = /* @__PURE__ */ Zt(Hs);
4104
+ var qs = Hs;
4105
+ const vt = /* @__PURE__ */ Zt(qs);
4105
4106
  class Ee extends b {
4106
4107
  constructor(t) {
4107
4108
  super(t);
@@ -4179,7 +4180,7 @@ class Ee extends b {
4179
4180
  };
4180
4181
  const e = this.fullLayer, s = this.draw({ workId: t, layer: e });
4181
4182
  this.oldRect = s;
4182
- const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = tt(o);
4183
+ const o = this.tmpPoints.map((a) => [...a.XY, 0]).flat(1), r = Q(o);
4183
4184
  return (n = this.vNodes) == null || n.setInfo(t, {
4184
4185
  rect: s,
4185
4186
  op: o,
@@ -4304,7 +4305,7 @@ class Ee extends b {
4304
4305
  let d;
4305
4306
  return e !== F.Normal ? d = mt(this.tmpPoints, !1) : d = mt(p, !0), {
4306
4307
  d,
4307
- rect: $(p),
4308
+ rect: _(p),
4308
4309
  isDot: !1,
4309
4310
  pos: this.tmpPoints[0].XY
4310
4311
  };
@@ -4317,7 +4318,7 @@ class Ee extends b {
4317
4318
  );
4318
4319
  return {
4319
4320
  d: mt(e, !0),
4320
- rect: $(e),
4321
+ rect: _(e),
4321
4322
  isDot: !0,
4322
4323
  pos: this.tmpPoints[0].XY
4323
4324
  };
@@ -4504,10 +4505,10 @@ const ft = class ft extends b {
4504
4505
  for (let B = 0; B < l; B++) {
4505
4506
  const Y = h[B], G = d || L * 1.5;
4506
4507
  if (Y) {
4507
- const rt = ts(Y), K = [0, 0], V = [0, p * 1.2];
4508
- v === "middle" && (K[1] = B * p * 1.2 + 5);
4508
+ const rt = es(Y), Z = [0, 0], K = [0, p * 1.2];
4509
+ v === "middle" && (Z[1] = B * p * 1.2 + 5);
4509
4510
  const nt = [0, -p * 0.15];
4510
- K[0] = 5;
4511
+ Z[0] = 5;
4511
4512
  const gt = Math.sin(Math.PI / 180 * 20);
4512
4513
  let pt = 0;
4513
4514
  const Dt = [];
@@ -4527,26 +4528,26 @@ const ft = class ft extends b {
4527
4528
  textAlign: y,
4528
4529
  fontStyle: f,
4529
4530
  scale: [1 / R, 1 / R]
4530
- }, dt = new hs(Mt), at = await dt.textImageReady;
4531
+ }, dt = new ps(Mt), at = await dt.textImageReady;
4531
4532
  let Ot = !0;
4532
4533
  if (at) {
4533
4534
  const oe = at.rect && at.rect[2], ie = at.rect && at.rect[3];
4534
4535
  if (oe && ie) {
4535
- const re = oe / R, Ue = ie / R;
4536
- pt = re + pt, f === "italic" && (u === "bold" ? pt = pt - gt * p * 1.2 : pt = pt - gt * p), ((nt[0] + K[0] + re) * e.worldScaling[0] + r <= 0 || (nt[0] + K[0]) * e.worldScaling[0] + r >= a || (nt[1] + K[1] + Ue) * e.worldScaling[1] + n <= 0 || (nt[1] + K[1]) * e.worldScaling[1] + n >= c) && (dt.disconnect(), Ot = !1), Ot && Dt.push(dt);
4536
+ const re = oe / R, Xe = ie / R;
4537
+ pt = re + pt, f === "italic" && (u === "bold" ? pt = pt - gt * p * 1.2 : pt = pt - gt * p), ((nt[0] + Z[0] + re) * e.worldScaling[0] + r <= 0 || (nt[0] + Z[0]) * e.worldScaling[0] + r >= a || (nt[1] + Z[1] + Xe) * e.worldScaling[1] + n <= 0 || (nt[1] + Z[1]) * e.worldScaling[1] + n >= c) && (dt.disconnect(), Ot = !1), Ot && Dt.push(dt);
4537
4538
  }
4538
4539
  }
4539
4540
  Ct += N;
4540
4541
  }
4541
- V[0] = pt, f === "italic" && (V[0] = V[0] + gt * p), A = Math.max(A, V[0]);
4542
+ K[0] = pt, f === "italic" && (K[0] = K[0] + gt * p), A = Math.max(A, K[0]);
4542
4543
  let se = !0;
4543
- if (((K[0] + V[0]) * e.worldScaling[0] + r <= 0 || K[0] * e.worldScaling[0] + r >= a || (K[1] + V[1]) * e.worldScaling[0] + n <= 0 || K[1] * e.worldScaling[1] + n >= c) && (se = !1), se) {
4544
+ if (((Z[0] + K[0]) * e.worldScaling[0] + r <= 0 || Z[0] * e.worldScaling[0] + r >= a || (Z[1] + K[1]) * e.worldScaling[0] + n <= 0 || Z[1] * e.worldScaling[1] + n >= c) && (se = !1), se) {
4544
4545
  if (W) {
4545
4546
  const dt = Math.floor(p / 10), at = {
4546
4547
  normalize: !1,
4547
4548
  pos: [0, p * 1.1 + dt / 2],
4548
4549
  lineWidth: dt,
4549
- points: [0, 0, Math.ceil(V[0]), 0],
4550
+ points: [0, 0, Math.ceil(K[0]), 0],
4550
4551
  strokeColor: T,
4551
4552
  className: "underline"
4552
4553
  }, Ot = new ht(at);
@@ -4557,16 +4558,16 @@ const ft = class ft extends b {
4557
4558
  normalize: !1,
4558
4559
  pos: [0, p * 1.2 / 2],
4559
4560
  lineWidth: Math.floor(p / 10),
4560
- points: [0, 0, Math.ceil(V[0]), 0],
4561
+ points: [0, 0, Math.ceil(K[0]), 0],
4561
4562
  strokeColor: T,
4562
4563
  className: "lineThrough"
4563
4564
  }, at = new ht(dt);
4564
4565
  Dt.push(at);
4565
4566
  }
4566
4567
  const Gt = {
4567
- pos: K,
4568
+ pos: Z,
4568
4569
  anchor: [0, 0],
4569
- size: V,
4570
+ size: K,
4570
4571
  bgcolor: C
4571
4572
  }, Mt = new j(Gt);
4572
4573
  Mt.append(...Dt), o.push(Mt);
@@ -4590,7 +4591,7 @@ const ft = class ft extends b {
4590
4591
  fontSize: w,
4591
4592
  textInfos: v,
4592
4593
  zIndex: T
4593
- } = s, C = r && Q(r) || o.get(e.name);
4594
+ } = s, C = r && et(r) || o.get(e.name);
4594
4595
  if (!C || !e.parent) return;
4595
4596
  const I = C.opt;
4596
4597
  if (q(T) && (e.setAttribute("zIndex", T), C.opt.zIndex = T), a && I.fontColor && (I.fontColor = a, e.children.forEach((R) => {
@@ -4719,7 +4720,7 @@ const Pt = class Pt extends b {
4719
4720
  if (!this.vNodes)
4720
4721
  return { willDeleteNodes: o, willNewNodes: s, rect: r };
4721
4722
  const n = this.worldPosition;
4722
- let a = $(this.tmpPoints, t);
4723
+ let a = _(this.tmpPoints, t);
4723
4724
  a = Nt(a, n), a = Pe(a, this.worldScaling, n);
4724
4725
  const { nodeRange: c } = this.vNodes.getRectIntersectRange(a);
4725
4726
  if (!c.size)
@@ -4832,7 +4833,7 @@ const Pt = class Pt extends b {
4832
4833
  this.tmpPoints.map((d) => {
4833
4834
  l.push(d.x, d.y, n / 2);
4834
4835
  });
4835
- const p = tt(l);
4836
+ const p = Q(l);
4836
4837
  return {
4837
4838
  ...this.baseConsumeResult,
4838
4839
  type: g.FullWork,
@@ -4905,7 +4906,7 @@ const It = class It extends b {
4905
4906
  if (!this.vNodes)
4906
4907
  return { willDeleteNodes: o, willUpdateNodes: s, rect: r };
4907
4908
  const n = this.worldPosition;
4908
- let a = $(this.tmpPoints, t);
4909
+ let a = _(this.tmpPoints, t);
4909
4910
  a = Nt(a, n), a = Pe(a, this.worldScaling, n);
4910
4911
  const { nodeRange: c } = this.vNodes.getRectIntersectRange(a);
4911
4912
  if (!c.size)
@@ -5014,7 +5015,7 @@ const It = class It extends b {
5014
5015
  this.tmpPoints.map((d) => {
5015
5016
  l.push(d.x, d.y, n / 2);
5016
5017
  });
5017
- const p = tt(l);
5018
+ const p = Q(l);
5018
5019
  return {
5019
5020
  ...this.baseConsumeResult,
5020
5021
  type: g.FullWork,
@@ -5189,7 +5190,7 @@ class ze {
5189
5190
  name: i,
5190
5191
  rect: t.rect
5191
5192
  };
5192
- t.rect && (e.rect = Q(t.rect)), t.op && es(t.op) && (e.op = Q(t.op)), t.canRotate && (e.canRotate = t.canRotate), t.scaleType && (e.scaleType = t.scaleType), t.opt && (e.opt = Q(t.opt)), t.toolsType && (e.toolsType = t.toolsType), t.centerPos && (e.centerPos = Q(t.centerPos)), vt(t.isSelected) && (e.isSelected = t.isSelected), e.rect ? this.curNodeMap.set(i, e) : this.curNodeMap.delete(i);
5193
+ t.rect && (e.rect = et(t.rect)), t.op && ss(t.op) && (e.op = et(t.op)), t.canRotate && (e.canRotate = t.canRotate), t.scaleType && (e.scaleType = t.scaleType), t.opt && (e.opt = et(t.opt)), t.toolsType && (e.toolsType = t.toolsType), t.centerPos && (e.centerPos = et(t.centerPos)), vt(t.isSelected) && (e.isSelected = t.isSelected), e.rect ? this.curNodeMap.set(i, e) : this.curNodeMap.delete(i);
5193
5194
  }
5194
5195
  selected(i) {
5195
5196
  this.setInfo(i, { isSelected: !0 });
@@ -5249,12 +5250,12 @@ class ze {
5249
5250
  const t = /* @__PURE__ */ new Map();
5250
5251
  for (const e of i) {
5251
5252
  const s = this.curNodeMap.get(e);
5252
- s && t.set(e, Q(s));
5253
+ s && t.set(e, et(s));
5253
5254
  }
5254
- return this.targetNodeMap.push(Q(t)), this.targetNodeMap.length - 1;
5255
+ return this.targetNodeMap.push(et(t)), this.targetNodeMap.length - 1;
5255
5256
  }
5256
5257
  setTarget() {
5257
- return this.targetNodeMap.push(Q(this.curNodeMap)), this.targetNodeMap.length - 1;
5258
+ return this.targetNodeMap.push(et(this.curNodeMap)), this.targetNodeMap.length - 1;
5258
5259
  }
5259
5260
  getLastTarget() {
5260
5261
  return this.targetNodeMap[this.targetNodeMap.length - 1];
@@ -5277,7 +5278,7 @@ class ze {
5277
5278
  isCanClearWorkId(i) {
5278
5279
  if (this.canClearUids === void 0 || this.canClearUids === !0)
5279
5280
  return !0;
5280
- if (ss(this.canClearUids)) {
5281
+ if (os(this.canClearUids)) {
5281
5282
  const t = i.split(Wt);
5282
5283
  if (t.length === 1)
5283
5284
  return this.canClearUids.has("localSelf") || this.localUid && this.canClearUids.has(this.localUid);
@@ -5287,7 +5288,7 @@ class ze {
5287
5288
  return !1;
5288
5289
  }
5289
5290
  }
5290
- class qs {
5291
+ class js {
5291
5292
  constructor(i, t, e) {
5292
5293
  m(this, "viewId");
5293
5294
  m(this, "type");
@@ -5414,7 +5415,7 @@ class qs {
5414
5415
  if (!n || !a || !c || !h)
5415
5416
  return;
5416
5417
  let p = n;
5417
- if (a === _t.Iconify) {
5418
+ if (a === $t.Iconify) {
5418
5419
  const [f, w] = this.getIconSize(c, h, this.dpr);
5419
5420
  p = `${n}?width=${f}&height=${w}&color=${l}`;
5420
5421
  }
@@ -5514,7 +5515,7 @@ class qs {
5514
5515
  var i;
5515
5516
  this.fullLayer && (this.fullLayer.parent.children.forEach((t) => {
5516
5517
  t.name !== "viewport" && t.remove();
5517
- }), Z(this.fullLayer, this.fullLayer.parent)), this.taskUpdateCameraId && (clearTimeout(this.taskUpdateCameraId), this.taskUpdateCameraId = void 0), this.debounceUpdateCameraId && (clearTimeout(this.debounceUpdateCameraId), this.debounceUpdateCameraId = void 0), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.destroy(), (i = this.serviceWork) == null || i.destroy();
5518
+ }), V(this.fullLayer, this.fullLayer.parent)), this.taskUpdateCameraId && (clearTimeout(this.taskUpdateCameraId), this.taskUpdateCameraId = void 0), this.debounceUpdateCameraId && (clearTimeout(this.debounceUpdateCameraId), this.debounceUpdateCameraId = void 0), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.destroy(), (i = this.serviceWork) == null || i.destroy();
5518
5519
  }
5519
5520
  setToolsOpt(i) {
5520
5521
  this.localWork.setToolsOpt(i);
@@ -5549,7 +5550,7 @@ class qs {
5549
5550
  let l = !1;
5550
5551
  if (h.workId && r.add(h.workId), h.isClearAll && (h.rect = this.getSceneRect(), h.isClear = !0, delete h.isClearAll), h.drawCanvas) {
5551
5552
  const p = this.getLayer(h.drawCanvas);
5552
- if (!p || !(p.parent instanceof ps))
5553
+ if (!p || !(p.parent instanceof ds))
5553
5554
  continue;
5554
5555
  if (p.parent.render(), h.isDrawAll) {
5555
5556
  const d = this.getSceneRect();
@@ -5601,7 +5602,7 @@ class qs {
5601
5602
  };
5602
5603
  }
5603
5604
  }
5604
- class js {
5605
+ class Ue {
5605
5606
  constructor(i) {
5606
5607
  m(this, "viewId");
5607
5608
  m(this, "vNodes");
@@ -5688,148 +5689,7 @@ class js {
5688
5689
  }
5689
5690
  }
5690
5691
  }
5691
- class Zs {
5692
- constructor(i) {
5693
- m(this, "snapshotFullLayer");
5694
- m(this, "opt");
5695
- this.opt = i;
5696
- }
5697
- getRectImageBitmap(i, t = !1, e) {
5698
- const { rect: s, drawCanvas: o } = i, r = this.opt.getDpr(), n = Math.floor(s.x * r), a = Math.floor(s.y * r), c = Math.floor(s.w * r), h = Math.floor(s.h * r);
5699
- return createImageBitmap(
5700
- this.opt.getOffscreen(o, t),
5701
- n,
5702
- a,
5703
- c,
5704
- h,
5705
- e
5706
- );
5707
- }
5708
- createSnapshotFullLayer(i, t) {
5709
- this.snapshotFullLayer = this.opt.createLayer(
5710
- "snapshotFullLayer",
5711
- i,
5712
- t
5713
- );
5714
- }
5715
- destroySnapshotFullLayer() {
5716
- var i, t;
5717
- (i = this.snapshotFullLayer) == null || i.disconnect(), (t = this.snapshotFullLayer) == null || t.remove(), this.snapshotFullLayer = void 0;
5718
- }
5719
- async getSnapshot(i) {
5720
- const { scenePath: t, scenes: e, cameraOpt: s, w: o, h: r } = i;
5721
- if (t && e && s && this.snapshotFullLayer) {
5722
- const n = Q(this.opt.getCameraOpt());
5723
- this.opt.setCameraOpt(s, this.snapshotFullLayer), this.opt.localWork.fullLayer = this.snapshotFullLayer, this.opt.localWork.drawLayer = void 0;
5724
- let a;
5725
- for (const [h, l] of Object.entries(e))
5726
- if (l != null && l.type)
5727
- switch (l == null ? void 0 : l.type) {
5728
- case g.UpdateNode:
5729
- case g.FullWork: {
5730
- const { opt: p } = l, d = {
5731
- ...l,
5732
- opt: p,
5733
- workId: h,
5734
- msgType: g.FullWork,
5735
- dataType: x.Service,
5736
- viewId: this.opt.viewId
5737
- }, u = await this.runFullWork(d);
5738
- a = E(a, u);
5739
- break;
5740
- }
5741
- }
5742
- let c;
5743
- o && r && (c = {
5744
- resizeWidth: o,
5745
- resizeHeight: r
5746
- }), await this.getSnapshotRender({ scenePath: t, curCameraOpt: n, options: c }), this.opt.localWork.fullLayer = this.opt.fullLayer, this.opt.localWork.drawLayer = void 0;
5747
- }
5748
- }
5749
- async runFullWork(i) {
5750
- var s;
5751
- const t = this.opt.localWork.setFullWork(i), e = i.ops && yt(i.ops);
5752
- if (t) {
5753
- let o, r;
5754
- const n = (s = t.getWorkId()) == null ? void 0 : s.toString();
5755
- return t.toolsType === S.Image ? o = await t.consumeServiceAsync({
5756
- isFullWork: !0,
5757
- worker: this.opt.thread
5758
- }) : t.toolsType === S.Text ? o = await t.consumeServiceAsync({
5759
- isFullWork: !0,
5760
- replaceId: n,
5761
- isDrawLabel: !0
5762
- }) : (o = t.consumeService({
5763
- op: e,
5764
- isFullWork: !0,
5765
- replaceId: n
5766
- }), r = (i == null ? void 0 : i.updateNodeOpt) && t.updataOptService(i.updateNodeOpt)), i.workId && this.opt.localWork.workShapes.delete(i.workId.toString()), E(o, r);
5767
- }
5768
- }
5769
- async getSnapshotRender(i) {
5770
- var r;
5771
- const { scenePath: t, curCameraOpt: e, options: s } = i;
5772
- ((r = this.snapshotFullLayer) == null ? void 0 : r.parent).render();
5773
- const o = await this.getRectImageBitmap(
5774
- { rect: this.opt.getSceneRect(), drawCanvas: _.None },
5775
- !0,
5776
- s
5777
- );
5778
- o && (this.opt.post(
5779
- {
5780
- sp: [
5781
- {
5782
- type: g.Snapshot,
5783
- scenePath: t,
5784
- imageBitmap: o,
5785
- viewId: this.opt.viewId
5786
- }
5787
- ]
5788
- },
5789
- [o]
5790
- ), o.close(), this.snapshotFullLayer && Z(
5791
- this.snapshotFullLayer,
5792
- this.snapshotFullLayer.parent
5793
- ), this.opt.setCameraOpt(e, this.opt.fullLayer));
5794
- }
5795
- async getBoundingRect(i) {
5796
- const { scenePath: t, scenes: e, cameraOpt: s } = i;
5797
- if (t && e && s && this.snapshotFullLayer) {
5798
- const o = Q(this.opt.getCameraOpt());
5799
- this.opt.setCameraOpt(s, this.snapshotFullLayer), this.opt.localWork.fullLayer = this.snapshotFullLayer, this.opt.localWork.drawLayer = void 0;
5800
- let r;
5801
- for (const [n, a] of Object.entries(e))
5802
- if (a != null && a.type)
5803
- switch (a == null ? void 0 : a.type) {
5804
- case g.UpdateNode:
5805
- case g.FullWork: {
5806
- const c = await this.runFullWork({
5807
- ...a,
5808
- workId: n,
5809
- msgType: g.FullWork,
5810
- dataType: x.Service,
5811
- viewId: this.opt.viewId
5812
- });
5813
- r = E(r, c);
5814
- break;
5815
- }
5816
- }
5817
- r && await this.opt.post({
5818
- sp: [
5819
- {
5820
- type: g.BoundingBox,
5821
- scenePath: t,
5822
- rect: r
5823
- }
5824
- ]
5825
- }), this.opt.localWork.fullLayer = this.opt.fullLayer, this.opt.localWork.drawLayer = void 0, Z(
5826
- this.snapshotFullLayer,
5827
- this.snapshotFullLayer.parent
5828
- ), this.opt.setCameraOpt(o, this.opt.fullLayer);
5829
- }
5830
- }
5831
- }
5832
- class Ks extends js {
5692
+ class Zs extends Ue {
5833
5693
  constructor(t) {
5834
5694
  super(t);
5835
5695
  m(this, "drawWorkActiveId");
@@ -5877,7 +5737,7 @@ class Ks extends js {
5877
5737
  workShapesDone() {
5878
5738
  for (const t of this.workShapes.keys())
5879
5739
  this.clearWorkShapeNodeCache(t);
5880
- Z(this.fullLayer, this.fullLayer.parent);
5740
+ V(this.fullLayer, this.fullLayer.parent);
5881
5741
  }
5882
5742
  async consumeDraw(t) {
5883
5743
  const { workId: e, fullWorkerDrawCount: s, postCount: o } = t, r = e == null ? void 0 : e.toString(), n = r && this.workShapes.get(r);
@@ -5936,11 +5796,11 @@ class Ks extends js {
5936
5796
  return;
5937
5797
  switch (o.toolsType) {
5938
5798
  case S.Selector:
5939
- this.drawCount = 0, Z(this.fullLayer, this.fullLayer.parent), this.clearWorkShapeNodeCache(s), this._post({
5799
+ this.drawCount = 0, V(this.fullLayer, this.fullLayer.parent), this.clearWorkShapeNodeCache(s), this._post({
5940
5800
  render: [
5941
5801
  {
5942
5802
  isClearAll: !0,
5943
- clearCanvas: _.Float,
5803
+ clearCanvas: $.Float,
5944
5804
  viewId: this.viewId
5945
5805
  }
5946
5806
  ]
@@ -5956,7 +5816,7 @@ class Ks extends js {
5956
5816
  case S.SpeechBalloon:
5957
5817
  case S.BitMapEraser:
5958
5818
  case S.PencilEraser:
5959
- this.drawCount = 0, Z(this.fullLayer, this.fullLayer.parent), this.clearWorkShapeNodeCache(s);
5819
+ this.drawCount = 0, V(this.fullLayer, this.fullLayer.parent), this.clearWorkShapeNodeCache(s);
5960
5820
  break;
5961
5821
  }
5962
5822
  }
@@ -5970,13 +5830,13 @@ class Ks extends js {
5970
5830
  r.push(
5971
5831
  {
5972
5832
  rect: ut(o),
5973
- clearCanvas: _.Float,
5833
+ clearCanvas: $.Float,
5974
5834
  isClear: !0,
5975
5835
  viewId: this.viewId
5976
5836
  },
5977
5837
  {
5978
5838
  rect: ut(o),
5979
- drawCanvas: _.Float,
5839
+ drawCanvas: $.Float,
5980
5840
  viewId: this.viewId
5981
5841
  }
5982
5842
  ), await this._post({
@@ -6006,7 +5866,7 @@ class Ks extends js {
6006
5866
  {
6007
5867
  rect: t == null ? void 0 : t.rect,
6008
5868
  workId: e,
6009
- drawCanvas: _.Float,
5869
+ drawCanvas: $.Float,
6010
5870
  viewId: this.viewId
6011
5871
  }
6012
5872
  ],
@@ -6021,12 +5881,12 @@ class Ks extends js {
6021
5881
  {
6022
5882
  rect: (t == null ? void 0 : t.rect) && ut(t.rect),
6023
5883
  isClear: !0,
6024
- clearCanvas: _.Float,
5884
+ clearCanvas: $.Float,
6025
5885
  viewId: this.viewId
6026
5886
  },
6027
5887
  {
6028
5888
  rect: (t == null ? void 0 : t.rect) && ut(t.rect),
6029
- drawCanvas: _.Float,
5889
+ drawCanvas: $.Float,
6030
5890
  viewId: this.viewId
6031
5891
  }
6032
5892
  ]
@@ -6040,19 +5900,19 @@ class Ks extends js {
6040
5900
  {
6041
5901
  rect: (t == null ? void 0 : t.rect) && ut(t.rect),
6042
5902
  isClear: !0,
6043
- clearCanvas: _.Float,
5903
+ clearCanvas: $.Float,
6044
5904
  viewId: this.viewId
6045
5905
  },
6046
5906
  {
6047
5907
  rect: (t == null ? void 0 : t.rect) && ut(t.rect),
6048
- drawCanvas: _.Float,
5908
+ drawCanvas: $.Float,
6049
5909
  viewId: this.viewId
6050
5910
  }
6051
5911
  ]
6052
5912
  });
6053
5913
  }
6054
5914
  }
6055
- class Vs {
5915
+ class Ks {
6056
5916
  constructor(i) {
6057
5917
  m(this, "viewId");
6058
5918
  m(this, "vNodes");
@@ -6217,11 +6077,11 @@ class Vs {
6217
6077
  if (s.push({
6218
6078
  isClear: !0,
6219
6079
  rect: l.totalRect,
6220
- clearCanvas: _.TopFloat,
6080
+ clearCanvas: $.TopFloat,
6221
6081
  viewId: this.viewId
6222
6082
  }), e.push({
6223
6083
  rect: l.totalRect,
6224
- drawCanvas: _.TopFloat,
6084
+ drawCanvas: $.TopFloat,
6225
6085
  viewId: this.viewId
6226
6086
  }), l.isDel) {
6227
6087
  (a = l.node) == null || a.clearTmpPoints(), this.serviceWorkShapes.delete(h);
@@ -6238,11 +6098,11 @@ class Vs {
6238
6098
  if (u && (s.push({
6239
6099
  isClear: !0,
6240
6100
  rect: u,
6241
- clearCanvas: _.TopFloat,
6101
+ clearCanvas: $.TopFloat,
6242
6102
  viewId: this.viewId
6243
6103
  }), e.push({
6244
6104
  rect: u,
6245
- drawCanvas: _.TopFloat,
6105
+ drawCanvas: $.TopFloat,
6246
6106
  viewId: this.viewId
6247
6107
  })), y) {
6248
6108
  l.node.clearTmpPoints(), this.localWorkShapes.delete(h), o.push({
@@ -6276,8 +6136,170 @@ class Vs {
6276
6136
  }, 16));
6277
6137
  }
6278
6138
  }
6139
+ class Vs extends Ue {
6140
+ constructor(t) {
6141
+ super(t);
6142
+ m(this, "opt");
6143
+ m(this, "scene");
6144
+ m(this, "cameraOpt");
6145
+ m(this, "vNodes");
6146
+ this.opt = t, this.vNodes = void 0;
6147
+ }
6148
+ createSnapshotFullLayer(t, e) {
6149
+ this.scene = this.opt.createScene(t), this.fullLayer = this.opt.createLayer("snapshotFullLayer", this.scene, e);
6150
+ }
6151
+ destroySnapshotFullLayer() {
6152
+ var t, e, s;
6153
+ V(this.fullLayer, this.fullLayer.parent), (t = this.fullLayer) == null || t.disconnect(), (e = this.fullLayer) == null || e.remove(), (s = this.scene) == null || s.remove(), this.scene = void 0;
6154
+ }
6155
+ updateScene(t) {
6156
+ if (!this.scene)
6157
+ throw new Error("SnapshotWork scene is not initialized");
6158
+ this.scene.attr({ ...t });
6159
+ const { width: e, height: s } = t;
6160
+ this.scene.width = e, this.scene.height = s, this.updateLayer({ width: e, height: s });
6161
+ }
6162
+ updateLayer(t) {
6163
+ if (!this.fullLayer)
6164
+ throw new Error("SnapshotWork snapshotFullLayer is not initialized");
6165
+ const { width: e, height: s } = t;
6166
+ this.fullLayer.parent.setAttribute("width", e), this.fullLayer.parent.setAttribute("height", s), this.fullLayer.setAttribute("size", [e, s]), this.fullLayer.setAttribute("pos", [e * 0.5, s * 0.5]);
6167
+ }
6168
+ setCameraOpt(t) {
6169
+ this.cameraOpt = t;
6170
+ const { scale: e, centerX: s, centerY: o, width: r, height: n } = t;
6171
+ if (!this.scene)
6172
+ throw new Error("SnapshotWork scene is not initialized");
6173
+ if (!this.fullLayer)
6174
+ throw new Error("SnapshotWork snapshotFullLayer is not initialized");
6175
+ (r !== this.scene.width || n !== this.scene.height) && this.updateScene({ width: r, height: n }), this.fullLayer.setAttribute("scale", [e, e]), this.fullLayer.setAttribute("translate", [-s, -o]);
6176
+ }
6177
+ getOffscreen() {
6178
+ var e;
6179
+ return ((e = this.fullLayer) == null ? void 0 : e.parent).canvas;
6180
+ }
6181
+ getRectImageBitmap(t, e) {
6182
+ const { rect: s } = t, o = this.thread.dpr, r = Math.floor(s.x * o), n = Math.floor(s.y * o), a = Math.floor(s.w * o), c = Math.floor(s.h * o);
6183
+ return createImageBitmap(this.getOffscreen(), r, n, a, c, e);
6184
+ }
6185
+ async getSnapshot(t) {
6186
+ const { scenePath: e, scenes: s, cameraOpt: o, w: r, h: n } = t;
6187
+ if (e && s && o && this.fullLayer) {
6188
+ this.setCameraOpt(o);
6189
+ let a;
6190
+ for (const [h, l] of Object.entries(s))
6191
+ if (l != null && l.type)
6192
+ switch (l == null ? void 0 : l.type) {
6193
+ case g.UpdateNode:
6194
+ case g.FullWork: {
6195
+ const { opt: p } = l, d = {
6196
+ ...l,
6197
+ opt: p,
6198
+ workId: h,
6199
+ msgType: g.FullWork,
6200
+ dataType: x.Service,
6201
+ viewId: this.viewId
6202
+ }, u = await this.runFullWork(d);
6203
+ a = E(a, u);
6204
+ break;
6205
+ }
6206
+ }
6207
+ let c;
6208
+ r && n && (c = {
6209
+ resizeWidth: r,
6210
+ resizeHeight: n
6211
+ }), await this.getSnapshotRender({ scenePath: e, options: c });
6212
+ }
6213
+ }
6214
+ async runFullWork(t) {
6215
+ var o;
6216
+ const e = this.setFullWork(t), s = t.ops && yt(t.ops);
6217
+ if (e) {
6218
+ let r, n;
6219
+ const a = (o = e.getWorkId()) == null ? void 0 : o.toString();
6220
+ return e.toolsType === S.Image ? r = await e.consumeServiceAsync({
6221
+ isFullWork: !0,
6222
+ worker: this.thread
6223
+ }) : e.toolsType === S.Text ? r = await e.consumeServiceAsync({
6224
+ isFullWork: !0,
6225
+ replaceId: a,
6226
+ isDrawLabel: !0
6227
+ }) : (r = e.consumeService({
6228
+ op: s,
6229
+ isFullWork: !0,
6230
+ replaceId: a
6231
+ }), n = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)), t.workId && this.workShapes.delete(t.workId.toString()), E(r, n);
6232
+ }
6233
+ }
6234
+ getSceneRect() {
6235
+ if (!this.scene)
6236
+ throw new Error("SnapshotWork scene is not initialized");
6237
+ const { width: t, height: e } = this.scene;
6238
+ return {
6239
+ x: 0,
6240
+ y: 0,
6241
+ w: Math.floor(t),
6242
+ h: Math.floor(e)
6243
+ };
6244
+ }
6245
+ async getSnapshotRender(t) {
6246
+ var r;
6247
+ const { scenePath: e, options: s } = t;
6248
+ ((r = this.fullLayer) == null ? void 0 : r.parent).render();
6249
+ const o = await this.getRectImageBitmap(
6250
+ { rect: this.getSceneRect(), drawCanvas: $.None },
6251
+ s
6252
+ );
6253
+ o && (this.thread._post(
6254
+ {
6255
+ sp: [
6256
+ {
6257
+ type: g.Snapshot,
6258
+ scenePath: e,
6259
+ imageBitmap: o,
6260
+ viewId: this.viewId
6261
+ }
6262
+ ]
6263
+ },
6264
+ [o]
6265
+ ), o.close());
6266
+ }
6267
+ async getBoundingRect(t) {
6268
+ const { scenePath: e, scenes: s, cameraOpt: o } = t;
6269
+ if (e && s && o && this.fullLayer) {
6270
+ this.setCameraOpt(o);
6271
+ let r;
6272
+ for (const [n, a] of Object.entries(s))
6273
+ if (a != null && a.type)
6274
+ switch (a == null ? void 0 : a.type) {
6275
+ case g.UpdateNode:
6276
+ case g.FullWork: {
6277
+ const c = await this.runFullWork({
6278
+ ...a,
6279
+ workId: n,
6280
+ msgType: g.FullWork,
6281
+ dataType: x.Service,
6282
+ viewId: this.viewId
6283
+ });
6284
+ r = E(r, c);
6285
+ break;
6286
+ }
6287
+ }
6288
+ r && this.thread._post({
6289
+ sp: [
6290
+ {
6291
+ type: g.BoundingBox,
6292
+ scenePath: e,
6293
+ rect: r,
6294
+ viewId: this.viewId
6295
+ }
6296
+ ]
6297
+ });
6298
+ }
6299
+ }
6300
+ }
6279
6301
  var jt = /* @__PURE__ */ ((k) => (k.Full = "full", k.Sub = "sub", k))(jt || {});
6280
- class Js extends qs {
6302
+ class Js extends js {
6281
6303
  constructor(t, e, s) {
6282
6304
  super(
6283
6305
  t,
@@ -6288,7 +6310,6 @@ class Js extends qs {
6288
6310
  m(this, "type", "sub");
6289
6311
  m(this, "_post");
6290
6312
  m(this, "topLayer");
6291
- m(this, "snapshotFullLayer");
6292
6313
  m(this, "serviceWork");
6293
6314
  m(this, "localWork");
6294
6315
  m(this, "topLayerWork");
@@ -6308,19 +6329,11 @@ class Js extends qs {
6308
6329
  topLayer: this.topLayer,
6309
6330
  isUseSimple: e.isUseSimple
6310
6331
  };
6311
- this.localWork = new Ks(r), e.isUseSimple || (this.topLayerWork = new Vs(r)), this.vNodes.init(this.fullLayer), this.snapshotWork = new Zs({
6312
- post: s,
6313
- fullLayer: this.fullLayer,
6314
- localWork: this.localWork,
6315
- thread: this,
6316
- viewId: t,
6317
- getDpr: () => this.dpr,
6318
- getCameraOpt: () => this.cameraOpt,
6319
- getOffscreen: this.getOffscreen,
6320
- setCameraOpt: this.setCameraOpt,
6321
- getSceneRect: this.getSceneRect,
6322
- createLayer: this.createLayer
6323
- });
6332
+ this.localWork = new Zs(r), e.isUseSimple || (this.topLayerWork = new Ks(r)), this.snapshotWork = new Vs({
6333
+ ...r,
6334
+ createScene: this.createScene.bind(this),
6335
+ createLayer: this.createLayer.bind(this)
6336
+ }), this.vNodes.init(this.fullLayer);
6324
6337
  }
6325
6338
  async combinePost() {
6326
6339
  var r, n;
@@ -6331,7 +6344,7 @@ class Js extends qs {
6331
6344
  for (const c of t)
6332
6345
  if (c.rect) {
6333
6346
  if (c.rect = eo(
6334
- Q(c.rect),
6347
+ et(c.rect),
6335
6348
  this.scene,
6336
6349
  this.dpr
6337
6350
  ), !c.rect)
@@ -6351,16 +6364,6 @@ class Js extends qs {
6351
6364
  );
6352
6365
  o != null && o.length ? e.sp = o.map((a) => ({ ...a, viewId: this.viewId })) : delete e.sp, e.consumeCount === void 0 && delete e.consumeCount, e.subWorkerDrawCount === void 0 && delete e.subWorkerDrawCount, (o != null && o.length || e.consumeCount || e.subWorkerDrawCount || (n = e == null ? void 0 : e.render) != null && n.length) && this._post(e, s), this.delayPostDoneResolve && this.delayPostDoneResolve(!0);
6353
6366
  }
6354
- getLayer(t, e) {
6355
- if (e && this.snapshotFullLayer)
6356
- return this.snapshotFullLayer;
6357
- switch (t) {
6358
- case _.TopFloat:
6359
- return this.topLayer || this.fullLayer;
6360
- default:
6361
- return this.fullLayer;
6362
- }
6363
- }
6364
6367
  async on(t) {
6365
6368
  var c, h;
6366
6369
  const {
@@ -6402,14 +6405,14 @@ class Js extends qs {
6402
6405
  s && ((h = this.topLayerWork) != null && h.canUseTopLayer(s)) && await this.consumeDrawAll(r, t);
6403
6406
  return;
6404
6407
  case g.Snapshot:
6405
- this.snapshotWork.createSnapshotFullLayer(this.scene, {
6408
+ this.snapshotWork.createSnapshotFullLayer(this.opt, {
6406
6409
  ...this.opt.layerOpt,
6407
6410
  bufferSize: this.viewId === ct ? 6e3 : 3e3,
6408
6411
  contextType: "2d"
6409
6412
  }), await this.snapshotWork.getSnapshot(t), this.snapshotWork.destroySnapshotFullLayer();
6410
6413
  return;
6411
6414
  case g.BoundingBox:
6412
- this.snapshotWork.createSnapshotFullLayer(this.scene, {
6415
+ this.snapshotWork.createSnapshotFullLayer(this.opt, {
6413
6416
  ...this.opt.layerOpt,
6414
6417
  bufferSize: this.viewId === ct ? 6e3 : 3e3,
6415
6418
  contextType: "2d"
@@ -6434,9 +6437,17 @@ class Js extends qs {
6434
6437
  const { dataType: e } = t;
6435
6438
  e === x.Local && await this.localWork.removeWork(t);
6436
6439
  }
6437
- getOffscreen(t, e) {
6438
- var o;
6439
- return ((o = this.getLayer(t, e)) == null ? void 0 : o.parent).canvas;
6440
+ getLayer(t) {
6441
+ switch (t) {
6442
+ case $.TopFloat:
6443
+ return this.topLayer || this.fullLayer;
6444
+ default:
6445
+ return this.fullLayer;
6446
+ }
6447
+ }
6448
+ getOffscreen(t) {
6449
+ var s;
6450
+ return ((s = this.getLayer(t)) == null ? void 0 : s.parent).canvas;
6440
6451
  }
6441
6452
  async consumeDraw(t, e) {
6442
6453
  var r;
@@ -6468,11 +6479,11 @@ class Js extends qs {
6468
6479
  async clearAll() {
6469
6480
  this.vNodes.clear(), super.clearAll(), this.topLayer && (this.topLayer.parent.children.forEach((t) => {
6470
6481
  t.name !== "viewport" && t.remove();
6471
- }), Z(this.topLayer, this.topLayer.parent)), await this.post({
6482
+ }), V(this.topLayer, this.topLayer.parent)), await this.post({
6472
6483
  render: [
6473
6484
  {
6474
6485
  isClearAll: !0,
6475
- clearCanvas: _.TopFloat,
6486
+ clearCanvas: $.TopFloat,
6476
6487
  viewId: this.viewId
6477
6488
  }
6478
6489
  ],
@@ -6483,31 +6494,31 @@ class Js extends qs {
6483
6494
  ]
6484
6495
  });
6485
6496
  }
6486
- getRectImageBitmap(t, e = !1, s) {
6487
- const { rect: o, drawCanvas: r } = t, n = Math.floor(o.x * this.dpr), a = Math.floor(o.y * this.dpr), c = Math.floor(o.w * this.dpr || 1), h = Math.floor(o.h * this.dpr || 1);
6497
+ getRectImageBitmap(t, e) {
6498
+ const { rect: s, drawCanvas: o } = t, r = Math.floor(s.x * this.dpr), n = Math.floor(s.y * this.dpr), a = Math.floor(s.w * this.dpr || 1), c = Math.floor(s.h * this.dpr || 1);
6488
6499
  return createImageBitmap(
6489
- this.getOffscreen(r, e),
6500
+ this.getOffscreen(o),
6501
+ r,
6490
6502
  n,
6491
6503
  a,
6492
6504
  c,
6493
- h,
6494
- s
6505
+ e
6495
6506
  );
6496
6507
  }
6497
6508
  updateLayer(t) {
6498
6509
  const { width: e, height: s } = t;
6499
- super.updateLayer(t), this.topLayer && (this.topLayer.parent.setAttribute("width", e), this.topLayer.parent.setAttribute("height", s), this.topLayer.setAttribute("size", [e, s]), this.topLayer.setAttribute("pos", [e * 0.5, s * 0.5])), this.snapshotFullLayer && (this.snapshotFullLayer.parent.setAttribute("width", e), this.snapshotFullLayer.parent.setAttribute("height", s), this.snapshotFullLayer.setAttribute("size", [e, s]), this.snapshotFullLayer.setAttribute("pos", [e * 0.5, s * 0.5]));
6510
+ super.updateLayer(t), this.topLayer && (this.topLayer.parent.setAttribute("width", e), this.topLayer.parent.setAttribute("height", s), this.topLayer.setAttribute("size", [e, s]), this.topLayer.setAttribute("pos", [e * 0.5, s * 0.5]));
6500
6511
  }
6501
6512
  async updateDpr(t) {
6502
6513
  super.updateDpr(t);
6503
6514
  const e = this.topLayerWork && !!this.topLayerWork.localWorkShapes.size || !1, s = !!this.localWork.getWorkShapes().size, o = [];
6504
6515
  s && o.push({
6505
6516
  isClearAll: !0,
6506
- clearCanvas: _.Float,
6517
+ clearCanvas: $.Float,
6507
6518
  viewId: this.viewId
6508
6519
  }), e && o.push({
6509
6520
  isClearAll: !0,
6510
- clearCanvas: _.TopFloat,
6521
+ clearCanvas: $.TopFloat,
6511
6522
  viewId: this.viewId
6512
6523
  }), o.length && await this.post({ render: o });
6513
6524
  }
@@ -6518,12 +6529,12 @@ class Js extends qs {
6518
6529
  const r = this.topLayerWork && !!this.topLayerWork.localWorkShapes.size || !1, n = !!this.localWork.getWorkShapes().size;
6519
6530
  if (n && this.localWork.workShapesDone(), this.setCameraOpt(s), n && e.push({
6520
6531
  isClearAll: !0,
6521
- clearCanvas: _.Float,
6532
+ clearCanvas: $.Float,
6522
6533
  viewId: this.viewId
6523
6534
  }), r && this.topLayerWork) {
6524
6535
  e.push({
6525
6536
  isClearAll: !0,
6526
- clearCanvas: _.TopFloat,
6537
+ clearCanvas: $.TopFloat,
6527
6538
  viewId: this.viewId
6528
6539
  });
6529
6540
  for (const [
@@ -6644,7 +6655,7 @@ class xt extends b {
6644
6655
  isLocked: p,
6645
6656
  zIndex: d,
6646
6657
  strokeColor: u
6647
- } = s, y = r && Q(r) || o.get(e.name);
6658
+ } = s, y = r && et(r) || o.get(e.name);
6648
6659
  if (!y) return;
6649
6660
  const f = e.parent;
6650
6661
  if (f) {
@@ -6705,7 +6716,7 @@ const Qs = (k) => {
6705
6716
  } else if (k.tagName === "GROUP" && k && k.children)
6706
6717
  for (const t of k.children)
6707
6718
  H(t, i);
6708
- }, Z = (k, i) => {
6719
+ }, V = (k, i) => {
6709
6720
  H(k, i), k.removeAllChildren();
6710
6721
  }, to = (k, i, t) => {
6711
6722
  const e = t.parent;
@@ -6728,8 +6739,8 @@ const Qs = (k) => {
6728
6739
  w: Math.floor(Math.min(e, k.w)),
6729
6740
  h: Math.floor(Math.min(s, k.h))
6730
6741
  };
6731
- if (o.x + o.w > e && (o.w = Math.floor(e - o.x)), o.y + o.h > s && (o.h = Math.floor(s - o.y)), os(t)) {
6732
- const r = is(t), n = Math.pow(10, r), a = rs(n, t * n), c = o.x % a, h = o.x - c;
6742
+ if (o.x + o.w > e && (o.w = Math.floor(e - o.x)), o.y + o.h > s && (o.h = Math.floor(s - o.y)), is(t)) {
6743
+ const r = rs(t), n = Math.pow(10, r), a = ns(n, t * n), c = o.x % a, h = o.x - c;
6733
6744
  h >= 0 ? (o.x = h, o.w = o.w + c) : (o.x = 0, o.w = o.w + c - h);
6734
6745
  const l = o.y % a, p = o.y - l;
6735
6746
  p >= 0 ? (o.y = p, o.h = o.h + l) : (o.y = 0, o.h = o.h + l - p);
@@ -6782,7 +6793,7 @@ class so {
6782
6793
  clearAll() {
6783
6794
  this.thread.topLayer.children.length && (this.thread.topLayer.parent.children.forEach((i) => {
6784
6795
  i.name !== "viewport" && i.remove();
6785
- }), Z(
6796
+ }), V(
6786
6797
  this.thread.serviceLayer,
6787
6798
  this.thread.serviceLayer.parent
6788
6799
  )), this.serviceWorkShapes.clear(), this.localWorkShapes.clear();
@@ -7004,14 +7015,14 @@ class oo {
7004
7015
  worker: this
7005
7016
  })), c = /* @__PURE__ */ new Map();
7006
7017
  let h;
7007
- a != null && a.selectIds && (h = ds(t.selectIds, a.selectIds), a.selectIds.forEach((u) => {
7018
+ a != null && a.selectIds && (h = us(t.selectIds, a.selectIds), a.selectIds.forEach((u) => {
7008
7019
  const y = this.vNodes.get(u);
7009
7020
  if (y) {
7010
7021
  const { toolsType: f, op: w, opt: v } = y;
7011
7022
  c.set(u, {
7012
7023
  opt: v,
7013
7024
  toolsType: f,
7014
- ops: (w == null ? void 0 : w.length) && tt(w) || void 0
7025
+ ops: (w == null ? void 0 : w.length) && Q(w) || void 0
7015
7026
  });
7016
7027
  }
7017
7028
  }), t.selectIds = a.selectIds);
@@ -7035,7 +7046,7 @@ class oo {
7035
7046
  clearAll() {
7036
7047
  if (this.thread.localLayer.children.length && (this.thread.topLayer.parent.children.forEach((t) => {
7037
7048
  t.name !== "viewport" && t.remove();
7038
- }), Z(
7049
+ }), V(
7039
7050
  this.thread.localLayer,
7040
7051
  this.thread.localLayer.parent
7041
7052
  )), this.workShapes.get(
@@ -7057,7 +7068,7 @@ class oo {
7057
7068
  let o;
7058
7069
  for (const r of this.vNodes.curNodeMap.values()) {
7059
7070
  const { rect: n, name: a, toolsType: c, opt: h } = r, l = t[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0], p = t[1] * this.thread.fullLayer.worldScaling[1] + this.thread.fullLayer.worldPosition[1];
7060
- if (c === S.Text && ns([l, p], n) && h.workState === O.Done) {
7071
+ if (c === S.Text && as([l, p], n) && h.workState === O.Done) {
7061
7072
  o = a;
7062
7073
  break;
7063
7074
  }
@@ -7384,7 +7395,7 @@ class oo {
7384
7395
  type: g.FullWork,
7385
7396
  dataType: x.Local,
7386
7397
  toolsType: c.toolsType,
7387
- ops: tt(c.op),
7398
+ ops: Q(c.op),
7388
7399
  opt: c.opt,
7389
7400
  workId: a,
7390
7401
  updateNodeOpt: {
@@ -7466,7 +7477,7 @@ class oo {
7466
7477
  consumeCount: this.consumeCount,
7467
7478
  fullWorkerDrawCount: this.fullWorkerDrawCount
7468
7479
  }), this.combineTimerId || new Promise((l) => {
7469
- this.combineDrawActiveId = a, this.combineDrawResolve = l, this.combineTimerId = as(
7480
+ this.combineDrawActiveId = a, this.combineDrawResolve = l, this.combineTimerId = cs(
7470
7481
  () => {
7471
7482
  this.combineTimerId = void 0, this.combineDrawResolve && this.combineDrawResolve(!0);
7472
7483
  },
@@ -7528,12 +7539,12 @@ class oo {
7528
7539
  {
7529
7540
  rect: h,
7530
7541
  isClear: !0,
7531
- clearCanvas: _.Bg,
7542
+ clearCanvas: $.Bg,
7532
7543
  viewId: this.thread.viewId
7533
7544
  },
7534
7545
  {
7535
7546
  rect: h,
7536
- drawCanvas: _.Bg,
7547
+ drawCanvas: $.Bg,
7537
7548
  viewId: this.thread.viewId
7538
7549
  }
7539
7550
  );
@@ -7548,7 +7559,7 @@ class oo {
7548
7559
  type: g.FullWork,
7549
7560
  dataType: x.Local,
7550
7561
  toolsType: l.toolsType,
7551
- ops: tt(l.op),
7562
+ ops: Q(l.op),
7552
7563
  opt: l.opt,
7553
7564
  workId: h,
7554
7565
  updateNodeOpt: {
@@ -7669,7 +7680,7 @@ class io {
7669
7680
  clearAll() {
7670
7681
  this.thread.serviceLayer.children.length && (this.thread.serviceLayer.parent.children.forEach((i) => {
7671
7682
  i.name !== "viewport" && i.remove();
7672
- }), Z(
7683
+ }), V(
7673
7684
  this.thread.serviceLayer,
7674
7685
  this.thread.serviceLayer.parent
7675
7686
  )), this.workShapes.clear(), this.selectorWorkShapes.clear(), this.willRunEffectSelectorIds.clear();
@@ -8793,7 +8804,7 @@ class go {
8793
8804
  if (!r || !n || !a || !c)
8794
8805
  return;
8795
8806
  let l = r;
8796
- if (n === _t.Iconify) {
8807
+ if (n === $t.Iconify) {
8797
8808
  const [y, f] = this.getIconSize(a, c, this.opt.displayer.dpr);
8798
8809
  l = `${r}?width=${y}&height=${f}&color=${h}`;
8799
8810
  }
@@ -8890,7 +8901,7 @@ class go {
8890
8901
  clearAll() {
8891
8902
  this.fullLayer.children.length && (this.fullLayer.parent.children.forEach((i) => {
8892
8903
  i.name !== "viewport" && i.remove();
8893
- }), Z(this.fullLayer, this.fullLayer.parent)), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
8904
+ }), V(this.fullLayer, this.fullLayer.parent)), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
8894
8905
  sp: [
8895
8906
  {
8896
8907
  type: g.Clear
@@ -9155,7 +9166,7 @@ class ko {
9155
9166
  if (!r || !n || !a || !c)
9156
9167
  return;
9157
9168
  let l = r;
9158
- if (n === _t.Iconify) {
9169
+ if (n === $t.Iconify) {
9159
9170
  const [y, f] = this.getIconSize(a, c, this.opt.displayer.dpr);
9160
9171
  l = `${r}?width=${y}&height=${f}&color=${h}`;
9161
9172
  }
@@ -9298,7 +9309,7 @@ class ko {
9298
9309
  viewId: this.viewId
9299
9310
  }
9300
9311
  ]
9301
- }), this.fullLayer && Z(this.fullLayer, this.fullLayer.parent));
9312
+ }), this.fullLayer && V(this.fullLayer, this.fullLayer.parent));
9302
9313
  }
9303
9314
  async getBoundingRect(i) {
9304
9315
  const { scenePath: t, scenes: e, cameraOpt: s } = i;
@@ -9490,7 +9501,7 @@ class xo {
9490
9501
  }
9491
9502
  continue;
9492
9503
  }
9493
- if (a === cs) {
9504
+ if (a === ls) {
9494
9505
  for (const f of this.mainThreadMap.values())
9495
9506
  f.on(r), n === g.Destroy && this.mainThreadMap.delete(a);
9496
9507
  continue;