@netless/appliance-plugin 1.1.43 → 1.1.44-beta.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.
Files changed (63) hide show
  1. package/dist/appliance-plugin.js +1 -1
  2. package/dist/appliance-plugin.mjs +12 -12
  3. package/dist/{bridge-GmRa7-tp.js → bridge-CskJoX5M.js} +1 -1
  4. package/dist/{bridge-D30E9dr6.mjs → bridge-rKHCYJ6m.mjs} +1 -1
  5. package/dist/bridge.js +1 -1
  6. package/dist/bridge.mjs +1 -1
  7. package/dist/collector/types.d.ts +3 -0
  8. package/dist/component/textEditor/types.d.ts +5 -0
  9. package/dist/core/mainEngine.d.ts +10 -2
  10. package/dist/core/mainThread/snapshotThread.d.ts +3 -2
  11. package/dist/core/mainThread/subLocalThread.d.ts +5 -2
  12. package/dist/core/mainThread/subServiceThread.d.ts +1 -0
  13. package/dist/core/mainThread/subTopThread.d.ts +2 -2
  14. package/dist/core/tools/arrow.d.ts +423 -1
  15. package/dist/core/tools/base.d.ts +444 -2
  16. package/dist/core/tools/ellipse.d.ts +423 -1
  17. package/dist/core/tools/eraser.d.ts +846 -2
  18. package/dist/core/tools/eraserFaces.d.ts +2 -0
  19. package/dist/core/tools/laserPen.d.ts +846 -2
  20. package/dist/core/tools/pencil.d.ts +848 -2
  21. package/dist/core/tools/pencilEraser.d.ts +1692 -4
  22. package/dist/core/tools/pencilEraserBitMap.d.ts +2115 -5
  23. package/dist/core/tools/polygon.d.ts +423 -1
  24. package/dist/core/tools/rectangle.d.ts +423 -1
  25. package/dist/core/tools/selector.d.ts +2121 -7
  26. package/dist/core/tools/speechBalloon.d.ts +423 -1
  27. package/dist/core/tools/star.d.ts +423 -1
  28. package/dist/core/tools/straight.d.ts +423 -1
  29. package/dist/core/tools/text.d.ts +3 -3
  30. package/dist/core/tools/utils.d.ts +2 -2
  31. package/dist/core/types.d.ts +9 -0
  32. package/dist/core/utils/affineMatrix.d.ts +33 -0
  33. package/dist/core/utils/fontFamily.d.ts +8 -0
  34. package/dist/core/utils/index.d.ts +2 -0
  35. package/dist/core/utils/selectorMatrix.d.ts +4 -0
  36. package/dist/core/utils/selectorRefresh.d.ts +8 -0
  37. package/dist/core/utils/textRaster.d.ts +2 -0
  38. package/dist/core/vNodeManager.d.ts +1 -1
  39. package/dist/core/worker/base.d.ts +1 -1
  40. package/dist/core/worker/fullWorkerLocal.d.ts +1 -0
  41. package/dist/core/worker/fullWorkerService.d.ts +2 -1
  42. package/dist/core/worker/simpleWorker.d.ts +1 -1
  43. package/dist/core/worker/subWorkerTopLayer.d.ts +2 -2
  44. package/dist/fullWorker.js +148 -147
  45. package/dist/index-B0SB7Efu.js +570 -0
  46. package/dist/index-BIVRfc_x.js +570 -0
  47. package/dist/{index-CQuJ6lL1.mjs → index-BbBSxLGe.mjs} +473 -442
  48. package/dist/index-Bzg5OMdP.js +1 -0
  49. package/dist/{index-Ct5ShjRI.js → index-C-tBYq0K.js} +1 -1
  50. package/dist/{index-CatWUcZt.mjs → index-Ca2t53R7.mjs} +1 -1
  51. package/dist/{index-rDe1jjPM.mjs → index-ConirzkM.mjs} +1 -1
  52. package/dist/index-CsNG_bzI.js +1 -0
  53. package/dist/{index-C-pO2InQ.mjs → index-DWevrjrE.mjs} +12001 -11664
  54. package/dist/{index-DYDy0dd5.mjs → index-LcCU1tMV.mjs} +473 -442
  55. package/dist/{index-DGdruTPt.js → index-ZMuKk-bl.js} +1 -1
  56. package/dist/{index-CrJWLjuD.mjs → index-_3yxgNoj.mjs} +19490 -19158
  57. package/dist/plugin/baseApplianceManager.d.ts +2 -2
  58. package/dist/subWorker.js +133 -132
  59. package/package.json +58 -56
  60. package/dist/index-B44Av4kp.js +0 -1
  61. package/dist/index-CKtpWZ9L.js +0 -1
  62. package/dist/index-DLzvL8jo.js +0 -570
  63. package/dist/index-LmgcnMI8.js +0 -570
@@ -1,16 +1,16 @@
1
- var ye = Object.defineProperty;
2
- var we = (M, e, t) => e in M ? ye(M, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : M[e] = t;
3
- var u = (M, e, t) => we(M, typeof e != "symbol" ? e + "" : e, t);
4
- import { D as K, e as b, c as m, r as $, b as R, g as Z, t as V, a as h, f as de, M as ve, h as D, i as j, j as ke, C as H, k as z, l as Se, m as te, n as Ie, o as se, p as ge, q as Te, s as re, u as ie, v as Y, w as _, E as N, x as ee, y as Q, z as We, A as Re, B as Ee, F as be, G as Le, H as pe, I as ue, T as oe, J as ae, K as Ce, L as Ne, N as fe, P as me, Q as ne, R as Be, S as ce, U as q, W as Oe, V as he, X as De } from "./index-C-pO2InQ.mjs";
5
- import { cloneDeep as J, xor as Me, isNumber as G, isEqual as le } from "lodash";
1
+ var we = Object.defineProperty;
2
+ var ve = (M, e, t) => e in M ? we(M, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : M[e] = t;
3
+ var u = (M, e, t) => ve(M, typeof e != "symbol" ? e + "" : e, t);
4
+ import { D as K, e as b, c as m, r as $, b as E, g as Z, t as V, a as h, f as de, M as ke, h as D, i as j, j as Se, C as H, k as z, l as Ie, m as te, n as ge, o as se, p as Te, q as We, s as re, u as ie, v as Y, w as _, x as pe, E as C, y as ee, z as Q, A as Re, B as Ee, F as be, G as Le, H as Ne, I as ue, J as fe, T as oe, K as ae, L as Ce, N as Be, P as me, Q as ye, R as ne, U as Oe, W as De, S as ce, X as q, Y as Me, V as he, Z as Pe } from "./index-DWevrjrE.mjs";
5
+ import { cloneDeep as J, xor as Ae, isNumber as G, isEqual as le } from "lodash";
6
6
  import "clipper-lib";
7
7
  import "lineclip";
8
- import "rbush";
9
8
  import "xss";
9
+ import "rbush";
10
10
  import "white-web-sdk";
11
11
  import "react-dom";
12
12
  import "react";
13
- class Pe {
13
+ class Fe {
14
14
  constructor(e) {
15
15
  u(this, "vNodes");
16
16
  u(this, "thread");
@@ -63,7 +63,7 @@ class Pe {
63
63
  }
64
64
  consumeDraw(e) {
65
65
  const { workId: t, dataType: s } = e;
66
- if (s === R.Service)
66
+ if (s === E.Service)
67
67
  this.activeServiceWorkShape(e);
68
68
  else {
69
69
  const r = t == null ? void 0 : t.toString(), i = r && this.localWorkShapes.get(r);
@@ -210,7 +210,7 @@ class Pe {
210
210
  }
211
211
  consumeDrawAll(e) {
212
212
  const { workId: t, dataType: s } = e;
213
- if (s === R.Service)
213
+ if (s === E.Service)
214
214
  this.activeServiceWorkShape(e);
215
215
  else {
216
216
  const r = t == null ? void 0 : t.toString(), i = r && this.localWorkShapes.get(r);
@@ -224,7 +224,7 @@ class Pe {
224
224
  this.runAnimation();
225
225
  }
226
226
  }
227
- class Ae {
227
+ class xe {
228
228
  constructor(e) {
229
229
  u(this, "vNodes");
230
230
  u(this, "thread");
@@ -238,7 +238,7 @@ class Ae {
238
238
  u(this, "drawWorkActiveId");
239
239
  u(this, "consumeCount", 0);
240
240
  u(this, "combineDrawActiveId");
241
- u(this, "eraserBatchScheduler", new ve());
241
+ u(this, "eraserBatchScheduler", new ke());
242
242
  u(this, "disposeVNodeRevisionObserver");
243
243
  u(this, "bitmapEraserRenderQueue", Promise.resolve());
244
244
  u(this, "bitmapEraserRevalidationQueued", !1);
@@ -296,14 +296,15 @@ class Ae {
296
296
  worker: this
297
297
  })), c = /* @__PURE__ */ new Map();
298
298
  let d;
299
- n != null && n.selectIds && (d = Me(t.selectIds, n.selectIds), n.selectIds.forEach((w) => {
300
- const S = this.vNodes.get(w);
301
- if (S) {
302
- const { toolsType: I, op: W, opt: g } = S;
299
+ n != null && n.selectIds && (d = Ae(t.selectIds, n.selectIds), n.selectIds.forEach((w) => {
300
+ const k = this.vNodes.get(w);
301
+ if (k) {
302
+ const { toolsType: I, op: R, opt: g } = k;
303
303
  c.set(w, {
304
304
  opt: g,
305
305
  toolsType: I,
306
- ops: (W == null ? void 0 : W.length) && j(W) || void 0
306
+ ops: (R == null ? void 0 : R.length) && j(R) || void 0,
307
+ previewMatrix: k.previewMatrix
307
308
  });
308
309
  }
309
310
  }), t.selectIds = n.selectIds);
@@ -337,7 +338,7 @@ class Ae {
337
338
  const t = [];
338
339
  t.push({
339
340
  type: h.Select,
340
- dataType: R.Local,
341
+ dataType: E.Local,
341
342
  selectIds: [],
342
343
  willSyncService: !1
343
344
  }), this.thread.post({ sp: t });
@@ -350,7 +351,7 @@ class Ae {
350
351
  let i;
351
352
  for (const o of this.vNodes.curNodeMap.values()) {
352
353
  const { rect: a, name: n, toolsType: c, opt: d } = o, 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];
353
- if (c === m.Text && ke([l, p], a) && d.workState === b.Done) {
354
+ if (c === m.Text && Se([l, p], a) && d.workState === b.Done) {
354
355
  i = n;
355
356
  break;
356
357
  }
@@ -415,7 +416,7 @@ class Ae {
415
416
  scaleType: t.scaleType,
416
417
  type: h.Select,
417
418
  viewId: this.thread.viewId,
418
- dataType: R.Local,
419
+ dataType: E.Local,
419
420
  selectIds: s,
420
421
  selectRect: c,
421
422
  points: t.getChildrenPoints(),
@@ -449,7 +450,7 @@ class Ae {
449
450
  type: h.TextUpdate,
450
451
  toolsType: m.Text,
451
452
  workId: n,
452
- dataType: R.Local
453
+ dataType: E.Local
453
454
  });
454
455
  break;
455
456
  }
@@ -458,7 +459,7 @@ class Ae {
458
459
  type: h.BackgroundSVGDelete,
459
460
  toolsType: m.BackgroundSVG,
460
461
  workId: n,
461
- dataType: R.Local,
462
+ dataType: E.Local,
462
463
  viewId: this.thread.viewId
463
464
  });
464
465
  break;
@@ -493,7 +494,7 @@ class Ae {
493
494
  type: h.BackgroundSVGDelete,
494
495
  toolsType: m.BackgroundSVG,
495
496
  workId: e,
496
- dataType: R.Local,
497
+ dataType: E.Local,
497
498
  viewId: this.thread.viewId
498
499
  }
499
500
  ]
@@ -520,27 +521,27 @@ class Ae {
520
521
  }
521
522
  }
522
523
  async consumeFull(e) {
523
- var o, a;
524
+ var o, a, n;
524
525
  const t = (o = e.workId) == null ? void 0 : o.toString(), s = (a = e.updateNodeOpt) == null ? void 0 : a.eraserGeometryDelta;
525
526
  if (t) {
526
- const n = this.vNodes.get(t), c = e.ops && V(e.ops) || e.op || [];
527
+ const c = this.vNodes.get(t), d = e.ops && V(e.ops) || e.op || [];
527
528
  if (s) {
528
- if (!n || !e.centerPos || !Se(
529
+ if (!c || !e.centerPos || !Ie(
529
530
  this.vNodes,
530
531
  t,
531
532
  s,
532
- n,
533
- { op: c, centerPos: e.centerPos }
533
+ c,
534
+ { op: d, centerPos: e.centerPos }
534
535
  )) {
535
536
  te(this.vNodes, t);
536
537
  return;
537
538
  }
538
- } else n && e.centerPos && Ie(this.vNodes, t) && se(n.op, n.centerPos) !== se(c, e.centerPos) && te(this.vNodes, t);
539
+ } else c && e.centerPos && ge(this.vNodes, t) && se(c.op, c.centerPos) !== se(d, e.centerPos) && te(this.vNodes, t);
539
540
  }
540
541
  const r = this.setFullWork(e), i = e.ops && V(e.ops);
541
542
  if (r) {
542
- t && e.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(t).forEach((c) => {
543
- c.remove(), z(c, this.thread.localLayer.parent);
543
+ if (t && e.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(t).forEach((d) => {
544
+ d.remove(), z(d, this.thread.localLayer.parent);
544
545
  }), r.toolsType === m.BackgroundSVG ? r.consumeService({
545
546
  isFullWork: !0,
546
547
  replaceId: t
@@ -556,9 +557,18 @@ class Ae {
556
557
  op: i,
557
558
  isFullWork: !0,
558
559
  replaceId: t
559
- }), e != null && e.updateNodeOpt && r.updataOptService(e.updateNodeOpt);
560
- const n = [];
561
- e.workId && this.workShapes.delete(e.workId.toString()), e.willSyncService && n.push({
560
+ }), t && ((n = e.opt) != null && n.matrix) && e.opt.matrix.some(
561
+ (d, l) => d !== [1, 0, 0, 1, 0, 0][l]
562
+ )) {
563
+ const d = this.vNodes.getNodeRectFormShape(
564
+ t,
565
+ this.vNodes.get(t)
566
+ );
567
+ d && this.vNodes.setInfo(t, { rect: d });
568
+ }
569
+ e != null && e.updateNodeOpt && r.updataOptService(e.updateNodeOpt);
570
+ const c = [];
571
+ e.workId && this.workShapes.delete(e.workId.toString()), e.willSyncService && c.push({
562
572
  opt: e.opt,
563
573
  toolsType: e.toolsType,
564
574
  type: h.FullWork,
@@ -570,17 +580,17 @@ class Ae {
570
580
  requestId: e.requestId,
571
581
  emitEventType: e.emitEventType,
572
582
  scenePath: e.scenePath
573
- }), e.isLockSentEventCursor && n.push({
583
+ }), e.isLockSentEventCursor && c.push({
574
584
  type: h.None,
575
585
  isLockSentEventCursor: !0,
576
586
  scenePath: e.scenePath
577
- }), e.needUndoTicker && n.push({
587
+ }), e.needUndoTicker && c.push({
578
588
  type: h.None,
579
589
  needUndoTicker: e.needUndoTicker,
580
590
  emitEventType: e.emitEventType,
581
591
  requestId: e.requestId,
582
592
  scenePath: e.scenePath
583
- }), n.length && this.thread.post({ sp: n });
593
+ }), c.length && this.thread.post({ sp: c });
584
594
  }
585
595
  }
586
596
  async colloctEffectSelectWork(e) {
@@ -746,7 +756,7 @@ class Ae {
746
756
  for (const [p, f] of i)
747
757
  l.push({
748
758
  type: h.UpdateNode,
749
- dataType: R.Local,
759
+ dataType: E.Local,
750
760
  opt: f.opt,
751
761
  workId: p,
752
762
  updateNodeOpt: {
@@ -794,7 +804,7 @@ class Ae {
794
804
  for (const [d, l] of i)
795
805
  c.push({
796
806
  type: h.FullWork,
797
- dataType: R.Local,
807
+ dataType: E.Local,
798
808
  toolsType: l.toolsType,
799
809
  ops: j(l.op),
800
810
  opt: l.opt,
@@ -852,7 +862,7 @@ class Ae {
852
862
  scenePath: i,
853
863
  viewId: this.thread.viewId,
854
864
  msgType: h.DrawWork,
855
- dataType: R.Local
865
+ dataType: E.Local
856
866
  },
857
867
  t
858
868
  );
@@ -863,7 +873,7 @@ class Ae {
863
873
  scenePath: i,
864
874
  viewId: this.thread.viewId,
865
875
  msgType: h.DrawWork,
866
- dataType: R.Local
876
+ dataType: E.Local
867
877
  },
868
878
  t
869
879
  ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && n !== D && (this.drawWorkActiveId = n), G(o) && (this.consumeCount = o), d) {
@@ -897,7 +907,7 @@ class Ae {
897
907
  e.needUndoTicker,
898
908
  e.collectUndoTicker
899
909
  );
900
- }, ge(this.thread.master.maxCombineEraserTime));
910
+ }, Te(this.thread.master.maxCombineEraserTime));
901
911
  break;
902
912
  }
903
913
  case m.BitMapEraser: {
@@ -976,14 +986,14 @@ class Ae {
976
986
  if (i || r) {
977
987
  const p = i == null ? void 0 : i.willDeleteNodes, f = i == null ? void 0 : i.willNewNodes, w = [
978
988
  ...p ? Array.from(p) : []
979
- ], S = {
989
+ ], k = {
980
990
  render: [],
981
991
  sp: [],
982
992
  ...r
983
993
  };
984
994
  if (i != null && i.rect) {
985
- const I = Te(i.rect);
986
- (a = S.render) == null || a.push(
995
+ const I = We(i.rect);
996
+ (a = k.render) == null || a.push(
987
997
  {
988
998
  rect: I,
989
999
  isClear: !0,
@@ -999,25 +1009,25 @@ class Ae {
999
1009
  }
1000
1010
  );
1001
1011
  }
1002
- if (s && w.length && ((n = this.getWorkShape(e)) == null ? void 0 : n.toolsType) === m.BitMapEraser && ((c = S.sp) == null || c.push({
1012
+ if (s && w.length && ((n = this.getWorkShape(e)) == null ? void 0 : n.toolsType) === m.BitMapEraser && ((c = k.sp) == null || c.push({
1003
1013
  type: h.None,
1004
1014
  collectUndoTicker: s,
1005
1015
  undoScopeIds: w,
1006
1016
  undoScopePhase: "collect"
1007
- })), p != null && p.size && ((d = S.sp) == null || d.push({
1017
+ })), p != null && p.size && ((d = k.sp) == null || d.push({
1008
1018
  type: h.RemoveNode,
1009
1019
  removeIds: [...p],
1010
1020
  viewId: this.thread.viewId,
1011
1021
  needUndoTicker: t,
1012
1022
  collectUndoTicker: s
1013
1023
  })), f != null && f.size)
1014
- for (const [I, W] of f)
1015
- (l = S.sp) == null || l.push({
1024
+ for (const [I, R] of f)
1025
+ (l = k.sp) == null || l.push({
1016
1026
  type: h.FullWork,
1017
- dataType: R.Local,
1018
- toolsType: W.toolsType,
1019
- ops: j(W.op),
1020
- opt: W.opt,
1027
+ dataType: E.Local,
1028
+ toolsType: R.toolsType,
1029
+ ops: j(R.op),
1030
+ opt: R.opt,
1021
1031
  workId: I,
1022
1032
  updateNodeOpt: {
1023
1033
  useAnimation: !1
@@ -1025,7 +1035,7 @@ class Ae {
1025
1035
  needUndoTicker: t,
1026
1036
  collectUndoTicker: s
1027
1037
  });
1028
- i != null && i.rect && await this.thread.fullLayer.parent.prepareRender, this.thread.post(S);
1038
+ i != null && i.rect && await this.thread.fullLayer.parent.prepareRender, this.thread.post(k);
1029
1039
  }
1030
1040
  }
1031
1041
  async consumeDrawAll(e, t) {
@@ -1043,23 +1053,23 @@ class Ae {
1043
1053
  if (p === m.LaserPen)
1044
1054
  return;
1045
1055
  p === m.BitMapEraser && await this.bitmapEraserRenderQueue;
1046
- const f = this.workShapes.get(H), w = (a = f == null ? void 0 : f.selectIds) == null ? void 0 : a[0], S = await l.consumeAll({ data: e, workerEngine: this });
1056
+ const f = this.workShapes.get(H), w = (a = f == null ? void 0 : f.selectIds) == null ? void 0 : a[0], k = await l.consumeAll({ data: e, workerEngine: this });
1047
1057
  switch (p) {
1048
1058
  case m.Selector:
1049
1059
  {
1050
- S.selectIds && w && ((n = S.selectIds) != null && n.includes(w)) && f.cursorBlur();
1060
+ k.selectIds && w && ((n = k.selectIds) != null && n.includes(w)) && f.cursorBlur();
1051
1061
  const I = [];
1052
1062
  i && I.push({
1053
1063
  type: h.None,
1054
1064
  isLockSentEventCursor: i,
1055
1065
  scenePath: r
1056
- }), S.type === h.Select && (S.selectIds && t.runReverseSelectWork(S.selectIds), I.push({ ...S, scenePath: r })), I.length && this.thread.post({ sp: I }), (c = l.selectIds) != null && c.length ? l.clearTmpPoints() : this.clearWorkShapeNodeCache(d);
1066
+ }), k.type === h.Select && (k.selectIds && t.runReverseSelectWork(k.selectIds), I.push({ ...k, scenePath: r })), I.length && this.thread.post({ sp: I }), (c = l.selectIds) != null && c.length ? l.clearTmpPoints() : this.clearWorkShapeNodeCache(d);
1057
1067
  }
1058
1068
  break;
1059
1069
  case m.PencilEraser:
1060
1070
  await this.drawPencilEraserFull(
1061
1071
  l,
1062
- S,
1072
+ k,
1063
1073
  i,
1064
1074
  o
1065
1075
  ), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(d);
@@ -1067,14 +1077,14 @@ class Ae {
1067
1077
  case m.BitMapEraser:
1068
1078
  await this.drawBitMapEraserFull(
1069
1079
  l,
1070
- S,
1080
+ k,
1071
1081
  i,
1072
1082
  o
1073
1083
  ), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(d);
1074
1084
  break;
1075
1085
  case m.Eraser:
1076
1086
  await this.drawEraser(
1077
- { ...S, scenePath: r },
1087
+ { ...k, scenePath: r },
1078
1088
  i,
1079
1089
  o,
1080
1090
  e.collectUndoTicker
@@ -1093,17 +1103,17 @@ class Ae {
1093
1103
  type: h.None,
1094
1104
  isLockSentEventCursor: i,
1095
1105
  scenePath: r
1096
- }), S) {
1097
- const g = p === m.Pencil && S.type === h.RemoveNode;
1106
+ }), k) {
1107
+ const g = p === m.Pencil && k.type === h.RemoveNode;
1098
1108
  g ? $(
1099
1109
  this.thread.localLayer,
1100
1110
  this.thread.localLayer.parent
1101
1111
  ) : I.push({
1102
- ...S,
1112
+ ...k,
1103
1113
  scenePath: r,
1104
1114
  needUndoTicker: e.needUndoTicker,
1105
- undoScopeIds: S.undoScopeIds || (S.workId !== void 0 ? [S.workId.toString()] : void 0),
1106
- undoScopePhase: S.undoScopePhase || "finalize"
1115
+ undoScopeIds: k.undoScopeIds || (k.workId !== void 0 ? [k.workId.toString()] : void 0),
1116
+ undoScopePhase: k.undoScopePhase || "finalize"
1107
1117
  }), this.fullWorkerDrawCount = 0, e.needUndoTicker && I.push({
1108
1118
  type: h.None,
1109
1119
  needUndoTicker: e.needUndoTicker,
@@ -1155,7 +1165,7 @@ class Ae {
1155
1165
  );
1156
1166
  }
1157
1167
  }
1158
- class Fe {
1168
+ class Ue {
1159
1169
  constructor(e) {
1160
1170
  u(this, "vNodes");
1161
1171
  u(this, "thread");
@@ -1275,45 +1285,45 @@ class Fe {
1275
1285
  );
1276
1286
  }
1277
1287
  async animationDraw() {
1278
- var r, i, o, a, n, c, d, l, p, f, w, S, I, W, g, y, v, T, C, L, A;
1288
+ var r, i, o, a, n, c, d, l, p, f, w, k, I, R, g, y, S, T, L, N, A;
1279
1289
  let e = !1;
1280
1290
  const t = /* @__PURE__ */ new Map(), s = [];
1281
- for (const [E, k] of this.workShapes.entries())
1282
- switch (k.toolsType) {
1291
+ for (const [W, v] of this.workShapes.entries())
1292
+ switch (v.toolsType) {
1283
1293
  case m.BackgroundSVG: {
1284
- (r = k.node) == null || r.consumeService({
1294
+ (r = v.node) == null || r.consumeService({
1285
1295
  isFullWork: !0,
1286
- replaceId: E
1287
- }), this.selectorWorkShapes.forEach((B, O) => {
1296
+ replaceId: W
1297
+ }), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1288
1298
  var P;
1289
- (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1290
- }), this.workShapes.delete(E);
1299
+ (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1300
+ }), this.workShapes.delete(W);
1291
1301
  break;
1292
1302
  }
1293
1303
  case m.Image: {
1294
- await ((i = k.node) == null ? void 0 : i.consumeServiceAsync({
1304
+ await ((i = v.node) == null ? void 0 : i.consumeServiceAsync({
1295
1305
  isFullWork: !0,
1296
1306
  worker: this
1297
- })), this.selectorWorkShapes.forEach((B, O) => {
1307
+ })), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1298
1308
  var P;
1299
- (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1300
- }), this.workShapes.delete(E);
1309
+ (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1310
+ }), this.workShapes.delete(W);
1301
1311
  break;
1302
1312
  }
1303
1313
  case m.Text: {
1304
- k.node && (await ((o = k.node) == null ? void 0 : o.consumeServiceAsync({
1314
+ v.node && (await ((o = v.node) == null ? void 0 : o.consumeServiceAsync({
1305
1315
  isFullWork: !0,
1306
- replaceId: E,
1316
+ replaceId: W,
1307
1317
  boxRect: this.thread.getSceneRect()
1308
- })), this.selectorWorkShapes.forEach((B, O) => {
1318
+ })), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1309
1319
  var P;
1310
- (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1311
- }), k.refreshTextRender && k.requestId && s.push({
1320
+ (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1321
+ }), v.refreshTextRender && v.requestId && s.push({
1312
1322
  type: h.RefreshTextRender,
1313
- requestId: k.requestId,
1314
- workId: E,
1323
+ requestId: v.requestId,
1324
+ workId: W,
1315
1325
  viewId: this.thread.viewId
1316
- }), (a = k.node) == null || a.clearTmpPoints(), this.workShapes.delete(E));
1326
+ }), (a = v.node) == null || a.clearTmpPoints(), this.workShapes.delete(W));
1317
1327
  break;
1318
1328
  }
1319
1329
  case m.Arrow:
@@ -1323,60 +1333,60 @@ class Fe {
1323
1333
  case m.Star:
1324
1334
  case m.Polygon:
1325
1335
  case m.SpeechBalloon: {
1326
- const B = !!k.ops;
1327
- if ((n = k.animationWorkData) != null && n.length) {
1328
- const O = k.oldRect;
1329
- (c = k.node) == null || c.consumeService({
1330
- op: k.animationWorkData,
1336
+ const B = !!v.ops;
1337
+ if ((n = v.animationWorkData) != null && n.length) {
1338
+ const O = v.oldRect;
1339
+ (c = v.node) == null || c.consumeService({
1340
+ op: v.animationWorkData,
1331
1341
  isFullWork: B
1332
- }), B && (this.selectorWorkShapes.forEach((P, F) => {
1333
- var U;
1334
- (U = P.selectIds) != null && U.includes(E) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1335
- }), (d = k.node) == null || d.clearTmpPoints(), this.workShapes.delete(E)), k.isEnableCursor ? t.set(E, {
1336
- cursorTool: _(k.toolsType),
1337
- workState: O ? k.ops ? b.Done : b.Doing : b.Start,
1338
- op: k.animationWorkData.slice(-3, -1)
1339
- }) : B && !k.useAnimation && ((l = k.updateNodeOpt) != null && l.useAnimation) && t.set(E, {
1340
- cursorTool: _(k.toolsType),
1342
+ }), B && this.syncMatrixRect(W, v.node), B && (this.selectorWorkShapes.forEach((P, F) => {
1343
+ var x;
1344
+ (x = P.selectIds) != null && x.includes(W) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1345
+ }), (d = v.node) == null || d.clearTmpPoints(), this.workShapes.delete(W)), v.isEnableCursor ? t.set(W, {
1346
+ cursorTool: _(v.toolsType),
1347
+ workState: O ? v.ops ? b.Done : b.Doing : b.Start,
1348
+ op: v.animationWorkData.slice(-3, -1)
1349
+ }) : B && !v.useAnimation && ((l = v.updateNodeOpt) != null && l.useAnimation) && t.set(W, {
1350
+ cursorTool: _(v.toolsType),
1341
1351
  workState: b.Done,
1342
- op: k.animationWorkData.slice(-3, -1),
1343
- uid: (p = k.updateNodeOpt) == null ? void 0 : p.uid
1344
- }), k.animationWorkData.length = 0;
1352
+ op: v.animationWorkData.slice(-3, -1),
1353
+ uid: (p = v.updateNodeOpt) == null ? void 0 : p.uid
1354
+ }), v.animationWorkData.length = 0;
1345
1355
  }
1346
1356
  break;
1347
1357
  }
1348
1358
  case m.Pencil: {
1349
- if (k.useAnimation) {
1350
- if (k.useAnimation) {
1351
- if (k.isDel) {
1352
- (y = k.node) == null || y.clearTmpPoints(), this.workShapes.delete(E);
1359
+ if (v.useAnimation) {
1360
+ if (v.useAnimation) {
1361
+ if (v.isDel) {
1362
+ (y = v.node) == null || y.clearTmpPoints(), this.workShapes.delete(W);
1353
1363
  break;
1354
1364
  }
1355
1365
  const B = 3, O = this.computNextAnimationIndex(
1356
- k,
1366
+ v,
1357
1367
  B
1358
- ), P = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - B), F = (k.animationWorkData || []).slice(
1368
+ ), P = v.isDiff ? 0 : Math.max(0, (v.animationIndex || 0) - B), F = (v.animationWorkData || []).slice(
1359
1369
  P,
1360
1370
  O
1361
- ), U = (T = (v = k.node) == null ? void 0 : v.getWorkId()) == null ? void 0 : T.toString();
1362
- if ((k.animationIndex || 0) < O || k.isDiff) {
1363
- if ((C = k.node) == null || C.consumeService({
1371
+ ), x = (T = (S = v.node) == null ? void 0 : S.getWorkId()) == null ? void 0 : T.toString();
1372
+ if ((v.animationIndex || 0) < O || v.isDiff) {
1373
+ if ((L = v.node) == null || L.consumeService({
1364
1374
  op: F,
1365
1375
  isFullWork: !1
1366
- }), k.animationIndex = O, k.isDiff && (k.isDiff = !1), F.length && k.isEnableCursor) {
1376
+ }), v.animationIndex = O, v.isDiff && (v.isDiff = !1), F.length && v.isEnableCursor) {
1367
1377
  const X = F.slice(-3, -1);
1368
- t.set(E, {
1369
- cursorTool: _(k.toolsType),
1370
- workState: P === 0 ? b.Start : O === ((L = k.animationWorkData) == null ? void 0 : L.length) ? b.Done : b.Doing,
1378
+ t.set(W, {
1379
+ cursorTool: _(v.toolsType),
1380
+ workState: P === 0 ? b.Start : O === ((N = v.animationWorkData) == null ? void 0 : N.length) ? b.Done : b.Doing,
1371
1381
  op: X
1372
1382
  });
1373
1383
  }
1374
- } else k.ops && ((A = k.node) == null || A.consumeService({
1375
- op: k.animationWorkData || [],
1384
+ } else v.ops && ((A = v.node) == null || A.consumeService({
1385
+ op: v.animationWorkData || [],
1376
1386
  isFullWork: !0,
1377
- replaceId: U
1378
- }), k.isDel = !0, k.isEnableCursor && t.set(E, {
1379
- cursorTool: _(k.toolsType),
1387
+ replaceId: x
1388
+ }), this.syncMatrixRect(x || W, v.node), v.isDel = !0, v.isEnableCursor && t.set(W, {
1389
+ cursorTool: _(v.toolsType),
1380
1390
  workState: b.Done,
1381
1391
  op: F.slice(-3, -1)
1382
1392
  }));
@@ -1384,37 +1394,37 @@ class Fe {
1384
1394
  break;
1385
1395
  }
1386
1396
  } else {
1387
- const B = !!k.ops;
1388
- if ((f = k.node) == null || f.consumeService({
1389
- op: k.animationWorkData || [],
1397
+ const B = !!v.ops;
1398
+ if ((f = v.node) == null || f.consumeService({
1399
+ op: v.animationWorkData || [],
1390
1400
  isFullWork: B,
1391
- replaceId: E
1392
- }), (w = k.node) == null || w.updataOptService(k.updateNodeOpt), B) {
1393
- if (!k.isEnableCursor && ((S = k.updateNodeOpt) != null && S.useAnimation) && ((I = k.animationWorkData) != null && I.length)) {
1394
- const O = k.animationWorkData.slice(-3, -1);
1395
- t.set(E, {
1396
- cursorTool: _(k.toolsType),
1401
+ replaceId: W
1402
+ }), (w = v.node) == null || w.updataOptService(v.updateNodeOpt), B) {
1403
+ if (this.syncMatrixRect(W, v.node), !v.isEnableCursor && ((k = v.updateNodeOpt) != null && k.useAnimation) && ((I = v.animationWorkData) != null && I.length)) {
1404
+ const O = v.animationWorkData.slice(-3, -1);
1405
+ t.set(W, {
1406
+ cursorTool: _(v.toolsType),
1397
1407
  workState: b.Done,
1398
1408
  op: O,
1399
- uid: (W = k.updateNodeOpt) == null ? void 0 : W.uid
1409
+ uid: (R = v.updateNodeOpt) == null ? void 0 : R.uid
1400
1410
  });
1401
1411
  }
1402
1412
  this.selectorWorkShapes.forEach((O, P) => {
1403
1413
  var F;
1404
- (F = O.selectIds) != null && F.includes(E) && (this.willRunEffectSelectorIds.add(P), this.runEffect());
1405
- }), (g = k.node) == null || g.clearTmpPoints(), this.workShapes.delete(E);
1414
+ (F = O.selectIds) != null && F.includes(W) && (this.willRunEffectSelectorIds.add(P), this.runEffect());
1415
+ }), (g = v.node) == null || g.clearTmpPoints(), this.workShapes.delete(W);
1406
1416
  }
1407
1417
  }
1408
1418
  break;
1409
1419
  }
1410
1420
  }
1411
- e && this.runAnimation(), t.size && t.forEach((E, k) => {
1421
+ e && this.runAnimation(), t.size && t.forEach((W, v) => {
1412
1422
  s.push({
1413
1423
  type: h.Cursor,
1414
- uid: E.uid || k.split(de)[0],
1415
- op: E.op,
1416
- workState: E.workState,
1417
- cursorTool: E.cursorTool,
1424
+ uid: W.uid || v.split(de)[0],
1425
+ op: W.op,
1426
+ workState: W.workState,
1427
+ cursorTool: W.cursorTool,
1418
1428
  viewId: this.thread.viewId
1419
1429
  });
1420
1430
  }), s.length && this.thread.post({ sp: s });
@@ -1445,8 +1455,20 @@ class Fe {
1445
1455
  }
1446
1456
  return !1;
1447
1457
  }
1458
+ syncMatrixRect(e, t) {
1459
+ const s = t == null ? void 0 : t.getWorkOptions().matrix;
1460
+ if (!s || pe(s).every(
1461
+ (i, o) => i === [1, 0, 0, 1, 0, 0][o]
1462
+ ))
1463
+ return;
1464
+ const r = this.vNodes.getNodeRectFormShape(
1465
+ e,
1466
+ this.vNodes.get(e)
1467
+ );
1468
+ r && this.vNodes.setInfo(e, { rect: r });
1469
+ }
1448
1470
  activeWorkShape(e) {
1449
- var W, g, y, v;
1471
+ var R, g, y, S;
1450
1472
  const {
1451
1473
  workId: t,
1452
1474
  opt: s,
@@ -1463,7 +1485,7 @@ class Fe {
1463
1485
  } = e;
1464
1486
  if (!t)
1465
1487
  return;
1466
- const w = t.toString(), S = (W = this.vNodes.get(w)) == null ? void 0 : W.rect;
1488
+ const w = t.toString(), k = (R = this.vNodes.get(w)) == null ? void 0 : R.rect;
1467
1489
  if (!((g = this.workShapes) != null && g.has(w))) {
1468
1490
  let T = {
1469
1491
  toolsType: r,
@@ -1473,19 +1495,19 @@ class Fe {
1473
1495
  updateNodeOpt: o,
1474
1496
  ops: a,
1475
1497
  useAnimation: typeof c < "u" ? c : typeof (o == null ? void 0 : o.useAnimation) < "u" ? o == null ? void 0 : o.useAnimation : !0,
1476
- oldRect: S,
1498
+ oldRect: k,
1477
1499
  isDiff: !1,
1478
1500
  imageBitmap: d,
1479
1501
  isEnableCursor: l
1480
1502
  };
1481
1503
  r && s && (T = this.setNodeKey(w, T, r, s)), (y = this.workShapes) == null || y.set(w, T);
1482
1504
  }
1483
- const I = (v = this.workShapes) == null ? void 0 : v.get(w);
1505
+ const I = (S = this.workShapes) == null ? void 0 : S.get(w);
1484
1506
  I.isEnableCursor = l, I.requestId = p, I.refreshTextRender = !!f, i && (I.type = i), a && (I.animationWorkData = V(a), I.ops = a), o && (I.updateNodeOpt = o), n && (I.isDiff = this.hasDiffData(
1485
1507
  I.animationWorkData || [],
1486
1508
  n,
1487
1509
  I.toolsType
1488
- ), I.toolsType, m.Pencil, I.animationWorkData = n), I.node && I.node.getWorkId() !== w && I.node.setWorkId(w), S && (I.oldRect = S), r && s && (s.syncUnitTime && (this.syncUnitTime = s.syncUnitTime), I.toolsType !== r && r && s && this.setNodeKey(w, I, r, s), I.node && I.node.setWorkOptions(s)), d && (I.imageBitmap = d);
1510
+ ), I.toolsType, m.Pencil, I.animationWorkData = n), I.node && I.node.getWorkId() !== w && I.node.setWorkId(w), k && (I.oldRect = k), r && s && (s.syncUnitTime && (this.syncUnitTime = s.syncUnitTime), I.toolsType !== r && r && s && this.setNodeKey(w, I, r, s), I.node && I.node.setWorkOptions(s)), d && (I.imageBitmap = d);
1489
1511
  }
1490
1512
  removeNode(e, t) {
1491
1513
  e.indexOf(D) > -1 && this.removeSelectWork(t), this.thread.fullLayer.getElementsByName(e).forEach((r) => {
@@ -1500,7 +1522,7 @@ class Fe {
1500
1522
  type: h.BackgroundSVGDelete,
1501
1523
  toolsType: m.BackgroundSVG,
1502
1524
  workId: e,
1503
- dataType: R.Service,
1525
+ dataType: E.Service,
1504
1526
  viewId: this.thread.viewId
1505
1527
  }
1506
1528
  ]
@@ -1542,7 +1564,7 @@ class Fe {
1542
1564
  ), t;
1543
1565
  }
1544
1566
  }
1545
- class x {
1567
+ class U {
1546
1568
  constructor() {
1547
1569
  u(this, "localWork");
1548
1570
  u(this, "serviceWork");
@@ -1552,14 +1574,14 @@ class x {
1552
1574
  return this.threadEngine = e, this.localWork = e.localWork, this.serviceWork = e.serviceWork, this;
1553
1575
  }
1554
1576
  }
1555
- class Ue extends x {
1577
+ class Ge extends U {
1556
1578
  constructor() {
1557
1579
  super(...arguments);
1558
- u(this, "emitEventType", N.CopyNode);
1580
+ u(this, "emitEventType", C.CopyNode);
1559
1581
  }
1560
1582
  async consume(t) {
1561
1583
  const { msgType: s, dataType: r, emitEventType: i } = t;
1562
- if (s === h.FullWork && r === R.Local && i === this.emitEventType)
1584
+ if (s === h.FullWork && r === E.Local && i === this.emitEventType)
1563
1585
  return await this.consumeForLocalWorker(t), !0;
1564
1586
  }
1565
1587
  async consumeForLocalWorker(t) {
@@ -1568,14 +1590,14 @@ class Ue extends x {
1568
1590
  s && await ((r = this.localWork) == null ? void 0 : r.consumeFull(t));
1569
1591
  }
1570
1592
  }
1571
- class xe extends x {
1593
+ class qe extends U {
1572
1594
  constructor() {
1573
1595
  super(...arguments);
1574
- u(this, "emitEventType", N.SetColorNode);
1596
+ u(this, "emitEventType", C.SetColorNode);
1575
1597
  }
1576
1598
  async consume(t) {
1577
1599
  const { msgType: s, dataType: r, emitEventType: i } = t;
1578
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1600
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1579
1601
  return await this.consumeForLocalWorker(t), !0;
1580
1602
  }
1581
1603
  async consumeForLocalWorker(t) {
@@ -1617,7 +1639,7 @@ class xe extends x {
1617
1639
  ...w,
1618
1640
  workId: f,
1619
1641
  type: h.TextUpdate,
1620
- dataType: R.Local,
1642
+ dataType: E.Local,
1621
1643
  willSyncService: !0,
1622
1644
  emitEventType: l,
1623
1645
  requestId: d,
@@ -1642,14 +1664,14 @@ class xe extends x {
1642
1664
  };
1643
1665
  }
1644
1666
  }
1645
- class Ge extends x {
1667
+ class ze extends U {
1646
1668
  constructor() {
1647
1669
  super(...arguments);
1648
- u(this, "emitEventType", N.ZIndexNode);
1670
+ u(this, "emitEventType", C.ZIndexNode);
1649
1671
  }
1650
1672
  async consume(t) {
1651
1673
  const { msgType: s, dataType: r, emitEventType: i } = t;
1652
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1674
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1653
1675
  return await this.consumeForLocalWorker(t), !0;
1654
1676
  }
1655
1677
  async consumeForLocalWorker(t) {
@@ -1688,7 +1710,7 @@ class Ge extends x {
1688
1710
  ...f,
1689
1711
  workId: p,
1690
1712
  type: h.BackgroundSVGUpdate,
1691
- dataType: R.Local,
1713
+ dataType: E.Local,
1692
1714
  updateNodeOpt: {
1693
1715
  useAnimation: !1
1694
1716
  },
@@ -1715,19 +1737,19 @@ class Ge extends x {
1715
1737
  };
1716
1738
  }
1717
1739
  }
1718
- class qe extends x {
1740
+ class Ve extends U {
1719
1741
  constructor() {
1720
1742
  super(...arguments);
1721
- u(this, "emitEventType", N.TranslateNode);
1743
+ u(this, "emitEventType", C.TranslateNode);
1722
1744
  u(this, "updateSelectorCallback", (t) => {
1723
- var W;
1745
+ var R;
1724
1746
  const { param: s, postData: r, newServiceStore: i, workShapeNode: o, res: a, smoothSync: n } = t, {
1725
1747
  willSyncService: c,
1726
1748
  isSync: d,
1727
1749
  updateSelectorOpt: l,
1728
1750
  textUpdateForWoker: p,
1729
1751
  needUndoTicker: f
1730
- } = s, w = l.workState, S = r.sp || [];
1752
+ } = s, w = l.workState, k = r.sp || [];
1731
1753
  if (w === b.Start)
1732
1754
  return {
1733
1755
  sp: [
@@ -1742,7 +1764,7 @@ class qe extends x {
1742
1764
  const I = a == null ? void 0 : a.selectRect;
1743
1765
  if (c) {
1744
1766
  const g = w === b.Done ? f : void 0;
1745
- S.push({
1767
+ k.push({
1746
1768
  type: h.Select,
1747
1769
  selectIds: o.selectIds,
1748
1770
  selectRect: I,
@@ -1758,34 +1780,34 @@ class qe extends x {
1758
1780
  useAnimation: l.useAnimation || !1
1759
1781
  };
1760
1782
  l.uid && (y.uid = l.uid);
1761
- for (const [v, T] of i.entries())
1762
- T.toolsType === m.BackgroundSVG && S.push({
1783
+ for (const [S, T] of i.entries())
1784
+ T.toolsType === m.BackgroundSVG && k.push({
1763
1785
  ...T,
1764
- workId: v,
1786
+ workId: S,
1765
1787
  type: h.BackgroundSVGUpdate,
1766
- dataType: R.Local,
1788
+ dataType: E.Local,
1767
1789
  willSyncService: w === b.Done ? !0 : n,
1768
1790
  updateNodeOpt: y,
1769
1791
  needUndoTicker: g,
1770
1792
  emitEventType: this.emitEventType
1771
- }), p && T.toolsType === m.Text ? S.push({
1793
+ }), p && T.toolsType === m.Text ? k.push({
1772
1794
  ...T,
1773
- workId: v,
1795
+ workId: S,
1774
1796
  type: h.TextUpdate,
1775
- dataType: R.Local,
1797
+ dataType: E.Local,
1776
1798
  willSyncService: w === b.Done ? !0 : n,
1777
1799
  updateNodeOpt: y,
1778
1800
  needUndoTicker: g,
1779
1801
  emitEventType: this.emitEventType
1780
- }) : (n || w === b.Done) && S.push({
1802
+ }) : (n || w === b.Done) && k.push({
1781
1803
  ...T,
1782
- workId: v,
1804
+ workId: S,
1783
1805
  type: h.UpdateNode,
1784
1806
  updateNodeOpt: {
1785
1807
  ...y,
1786
1808
  eraserGeometryDelta: ee(
1787
- (W = this.localWork) == null ? void 0 : W.vNodes,
1788
- v
1809
+ (R = this.localWork) == null ? void 0 : R.vNodes,
1810
+ S
1789
1811
  )
1790
1812
  },
1791
1813
  isSync: d,
@@ -1793,21 +1815,21 @@ class qe extends x {
1793
1815
  emitEventType: this.emitEventType
1794
1816
  });
1795
1817
  }
1796
- return f && S.push({
1818
+ return f && k.push({
1797
1819
  type: h.None,
1798
1820
  needUndoTicker: f
1799
- }), S.push({
1821
+ }), k.push({
1800
1822
  type: h.SelectorTransform,
1801
1823
  emitEventType: this.emitEventType,
1802
1824
  workState: w
1803
1825
  }), {
1804
- sp: S
1826
+ sp: k
1805
1827
  };
1806
1828
  });
1807
1829
  }
1808
1830
  async consume(t) {
1809
1831
  const { msgType: s, dataType: r, emitEventType: i } = t;
1810
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1832
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1811
1833
  return await this.consumeForLocalWorker(t), !0;
1812
1834
  }
1813
1835
  async consumeForLocalWorker(t) {
@@ -1837,13 +1859,13 @@ class qe extends x {
1837
1859
  })) : r.workState === b.Done && ((f = this.localWork) == null || f.vNodes.deleteLastTarget()));
1838
1860
  }
1839
1861
  }
1840
- class ze extends x {
1862
+ class $e extends U {
1841
1863
  constructor() {
1842
1864
  super(...arguments);
1843
- u(this, "emitEventType", N.ScaleNode);
1865
+ u(this, "emitEventType", C.ScaleNode);
1844
1866
  u(this, "updateSelectorCallback", (t) => {
1845
1867
  var I;
1846
- const { param: s, postData: r, workShapeNode: i, res: o, newServiceStore: a, smoothSync: n } = t, { updateSelectorOpt: c, willSyncService: d, needUndoTicker: l } = s, p = c.workState, f = r.sp || [], w = o == null ? void 0 : o.selectRect, S = p === b.Done ? l : void 0;
1868
+ const { param: s, postData: r, workShapeNode: i, res: o, newServiceStore: a, smoothSync: n } = t, { updateSelectorOpt: c, willSyncService: d, needUndoTicker: l } = s, p = c.workState, f = r.sp || [], w = o == null ? void 0 : o.selectRect, k = p === b.Done ? l : void 0;
1847
1869
  if (p === b.Start)
1848
1870
  return {
1849
1871
  sp: [
@@ -1865,42 +1887,42 @@ class ze extends x {
1865
1887
  points: p === b.Done && i.getChildrenPoints() || void 0,
1866
1888
  textOpt: i.textOpt
1867
1889
  });
1868
- const W = {
1890
+ const R = {
1869
1891
  useAnimation: c.useAnimation || !1
1870
1892
  };
1871
- c.uid && (W.uid = c.uid);
1893
+ c.uid && (R.uid = c.uid);
1872
1894
  for (const [g, y] of a.entries())
1873
1895
  y.toolsType === m.BackgroundSVG && f.push({
1874
1896
  ...y,
1875
1897
  workId: g,
1876
1898
  type: h.BackgroundSVGUpdate,
1877
- dataType: R.Local,
1899
+ dataType: E.Local,
1878
1900
  willSyncService: p === b.Done ? !0 : n,
1879
- updateNodeOpt: W,
1880
- needUndoTicker: S,
1901
+ updateNodeOpt: R,
1902
+ needUndoTicker: k,
1881
1903
  emitEventType: this.emitEventType
1882
1904
  }), y.toolsType === m.Text ? f.push({
1883
1905
  ...y,
1884
1906
  workId: g,
1885
1907
  type: h.TextUpdate,
1886
- dataType: R.Local,
1908
+ dataType: E.Local,
1887
1909
  willSyncService: p === b.Done ? !0 : n,
1888
- updateNodeOpt: W,
1889
- needUndoTicker: S,
1910
+ updateNodeOpt: R,
1911
+ needUndoTicker: k,
1890
1912
  emitEventType: this.emitEventType
1891
1913
  }) : (n || p === b.Done) && f.push({
1892
1914
  ...y,
1893
1915
  workId: g,
1894
1916
  type: h.UpdateNode,
1895
1917
  updateNodeOpt: {
1896
- ...W,
1918
+ ...R,
1897
1919
  eraserGeometryDelta: ee(
1898
1920
  (I = this.localWork) == null ? void 0 : I.vNodes,
1899
1921
  g
1900
1922
  )
1901
1923
  },
1902
1924
  isSync: !0,
1903
- needUndoTicker: S,
1925
+ needUndoTicker: k,
1904
1926
  emitEventType: this.emitEventType
1905
1927
  });
1906
1928
  }
@@ -1918,7 +1940,7 @@ class ze extends x {
1918
1940
  }
1919
1941
  async consume(t) {
1920
1942
  const { msgType: s, dataType: r, emitEventType: i } = t;
1921
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1943
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1922
1944
  return await this.consumeForLocalWorker(t), !0;
1923
1945
  }
1924
1946
  async consumeForLocalWorker(t) {
@@ -1942,10 +1964,10 @@ class ze extends x {
1942
1964
  }));
1943
1965
  }
1944
1966
  }
1945
- class Ve extends x {
1967
+ class _e extends U {
1946
1968
  constructor() {
1947
1969
  super(...arguments);
1948
- u(this, "emitEventType", N.RotateNode);
1970
+ u(this, "emitEventType", C.RotateNode);
1949
1971
  u(this, "updateSelectorCallback", (t) => {
1950
1972
  var g;
1951
1973
  const { param: s, postData: r, workShapeNode: i, res: o, newServiceStore: a, smoothSync: n } = t, {
@@ -1954,9 +1976,9 @@ class Ve extends x {
1954
1976
  willSerializeData: l,
1955
1977
  isSync: p,
1956
1978
  needUndoTicker: f
1957
- } = s, w = c.workState, S = r.sp || [], I = o == null ? void 0 : o.selectRect, W = w === b.Done ? f : void 0;
1979
+ } = s, w = c.workState, k = r.sp || [], I = o == null ? void 0 : o.selectRect, R = w === b.Done ? f : void 0;
1958
1980
  if (d) {
1959
- l && w === b.Done && S.push({
1981
+ l && w === b.Done && k.push({
1960
1982
  type: h.Select,
1961
1983
  selectIds: i.selectIds,
1962
1984
  selectRect: I,
@@ -1968,38 +1990,38 @@ class Ve extends x {
1968
1990
  useAnimation: c.useAnimation || !1
1969
1991
  };
1970
1992
  if (c.uid && (y.uid = c.uid), n || w === b.Done)
1971
- for (const [v, T] of a.entries())
1972
- S.push({
1993
+ for (const [S, T] of a.entries())
1994
+ k.push({
1973
1995
  ...T,
1974
- workId: v,
1996
+ workId: S,
1975
1997
  type: h.UpdateNode,
1976
1998
  updateNodeOpt: {
1977
1999
  ...y,
1978
2000
  eraserGeometryDelta: ee(
1979
2001
  (g = this.localWork) == null ? void 0 : g.vNodes,
1980
- v
2002
+ S
1981
2003
  )
1982
2004
  },
1983
2005
  isSync: p,
1984
- needUndoTicker: W,
2006
+ needUndoTicker: R,
1985
2007
  emitEventType: this.emitEventType
1986
2008
  });
1987
2009
  }
1988
- return f && S.push({
2010
+ return f && k.push({
1989
2011
  type: h.None,
1990
2012
  needUndoTicker: f
1991
- }), S.push({
2013
+ }), k.push({
1992
2014
  type: h.SelectorTransform,
1993
2015
  emitEventType: this.emitEventType,
1994
2016
  workState: w
1995
2017
  }), {
1996
- sp: S
2018
+ sp: k
1997
2019
  };
1998
2020
  });
1999
2021
  }
2000
2022
  async consume(t) {
2001
2023
  const { msgType: s, dataType: r, emitEventType: i } = t;
2002
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2024
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2003
2025
  return await this.consumeForLocalWorker(t), !0;
2004
2026
  }
2005
2027
  async consumeForLocalWorker(t) {
@@ -2027,14 +2049,14 @@ class Ve extends x {
2027
2049
  }));
2028
2050
  }
2029
2051
  }
2030
- class $e extends x {
2052
+ class He extends U {
2031
2053
  constructor() {
2032
2054
  super(...arguments);
2033
- u(this, "emitEventType", N.SetFontStyle);
2055
+ u(this, "emitEventType", C.SetFontStyle);
2034
2056
  }
2035
2057
  async consume(t) {
2036
2058
  const { msgType: s, dataType: r, emitEventType: i } = t;
2037
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2059
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2038
2060
  return await this.consumeForLocalWorker(t), !0;
2039
2061
  }
2040
2062
  async consumeForLocalWorker(t) {
@@ -2067,27 +2089,27 @@ class $e extends x {
2067
2089
  textUpdateForWoker: l,
2068
2090
  requestId: p,
2069
2091
  emitEventType: f
2070
- } = s, w = r.sp || [], S = a == null ? void 0 : a.selectRect;
2092
+ } = s, w = r.sp || [], k = a == null ? void 0 : a.selectRect;
2071
2093
  if (n && w) {
2072
2094
  d.fontSize && w.push({
2073
2095
  type: h.Select,
2074
2096
  selectIds: o.selectIds,
2075
- selectRect: S,
2097
+ selectRect: k,
2076
2098
  willSyncService: n,
2077
2099
  isSync: c,
2078
2100
  points: o.getChildrenPoints()
2079
2101
  });
2080
- for (const [I, W] of i.entries())
2081
- l && W.toolsType === m.Text ? w.push({
2082
- ...W,
2102
+ for (const [I, R] of i.entries())
2103
+ l && R.toolsType === m.Text ? w.push({
2104
+ ...R,
2083
2105
  workId: I,
2084
2106
  type: h.TextUpdate,
2085
- dataType: R.Local,
2107
+ dataType: E.Local,
2086
2108
  willSyncService: !0,
2087
2109
  emitEventType: f,
2088
2110
  requestId: p
2089
2111
  }) : w.push({
2090
- ...W,
2112
+ ...R,
2091
2113
  workId: I,
2092
2114
  type: h.UpdateNode,
2093
2115
  updateNodeOpt: {
@@ -2103,10 +2125,10 @@ class $e extends x {
2103
2125
  };
2104
2126
  }
2105
2127
  }
2106
- class _e extends x {
2128
+ class Qe extends U {
2107
2129
  constructor() {
2108
2130
  super(...arguments);
2109
- u(this, "emitEventType", N.SetPoint);
2131
+ u(this, "emitEventType", C.SetPoint);
2110
2132
  u(this, "updateSelectorCallback", (t) => {
2111
2133
  const { param: s, postData: r, newServiceStore: i, workShapeNode: o, res: a } = t, { willSyncService: n, isSync: c, needUndoTicker: d } = s, l = r.sp || [], p = a == null ? void 0 : a.selectRect;
2112
2134
  if (n && l) {
@@ -2145,7 +2167,7 @@ class _e extends x {
2145
2167
  }
2146
2168
  async consume(t) {
2147
2169
  const { msgType: s, dataType: r, emitEventType: i } = t;
2148
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2170
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2149
2171
  return await this.consumeForLocalWorker(t), !0;
2150
2172
  }
2151
2173
  async consumeForLocalWorker(t) {
@@ -2172,14 +2194,14 @@ class _e extends x {
2172
2194
  }));
2173
2195
  }
2174
2196
  }
2175
- class He extends x {
2197
+ class Ke extends U {
2176
2198
  constructor() {
2177
2199
  super(...arguments);
2178
- u(this, "emitEventType", N.SetLock);
2200
+ u(this, "emitEventType", C.SetLock);
2179
2201
  }
2180
2202
  async consume(t) {
2181
2203
  const { msgType: s, dataType: r, emitEventType: i } = t;
2182
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2204
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2183
2205
  return await this.consumeForLocalWorker(t), !0;
2184
2206
  }
2185
2207
  async consumeForLocalWorker(t) {
@@ -2212,11 +2234,11 @@ class He extends x {
2212
2234
  needUndoTicker: l,
2213
2235
  requestId: p,
2214
2236
  emitEventType: f
2215
- } = s, w = r.sp || [], S = a == null ? void 0 : a.selectRect;
2237
+ } = s, w = r.sp || [], k = a == null ? void 0 : a.selectRect;
2216
2238
  if (n && w) {
2217
- for (const [I, W] of i.entries())
2239
+ for (const [I, R] of i.entries())
2218
2240
  w.push({
2219
- ...W,
2241
+ ...R,
2220
2242
  workId: I,
2221
2243
  type: h.UpdateNode,
2222
2244
  updateNodeOpt: {
@@ -2233,7 +2255,7 @@ class He extends x {
2233
2255
  canRotate: o.canRotate,
2234
2256
  type: h.Select,
2235
2257
  selectIds: o.selectIds,
2236
- selectRect: S,
2258
+ selectRect: k,
2237
2259
  willSyncService: n,
2238
2260
  isSync: c
2239
2261
  });
@@ -2246,14 +2268,14 @@ class He extends x {
2246
2268
  };
2247
2269
  }
2248
2270
  }
2249
- class Qe extends x {
2271
+ class Xe extends U {
2250
2272
  constructor() {
2251
2273
  super(...arguments);
2252
- u(this, "emitEventType", N.SetShapeOpt);
2274
+ u(this, "emitEventType", C.SetShapeOpt);
2253
2275
  }
2254
2276
  async consume(t) {
2255
2277
  const { msgType: s, dataType: r, emitEventType: i } = t;
2256
- if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2278
+ if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2257
2279
  return await this.consumeForLocalWorker(t), !0;
2258
2280
  }
2259
2281
  async consumeForLocalWorker(t) {
@@ -2307,33 +2329,33 @@ class Qe extends x {
2307
2329
  };
2308
2330
  }
2309
2331
  }
2310
- class Ke {
2332
+ class Ye {
2311
2333
  constructor(e) {
2312
2334
  u(this, "builders", /* @__PURE__ */ new Map());
2313
2335
  this.builders = new Map(e.map((t) => [t, this.build(t)]));
2314
2336
  }
2315
2337
  build(e) {
2316
2338
  switch (e) {
2317
- case N.TranslateNode:
2318
- return new qe();
2319
- case N.ZIndexNode:
2320
- return new Ge();
2321
- case N.CopyNode:
2322
- return new Ue();
2323
- case N.SetColorNode:
2324
- return new xe();
2325
- case N.ScaleNode:
2326
- return new ze();
2327
- case N.RotateNode:
2339
+ case C.TranslateNode:
2328
2340
  return new Ve();
2329
- case N.SetFontStyle:
2341
+ case C.ZIndexNode:
2342
+ return new ze();
2343
+ case C.CopyNode:
2344
+ return new Ge();
2345
+ case C.SetColorNode:
2346
+ return new qe();
2347
+ case C.ScaleNode:
2330
2348
  return new $e();
2331
- case N.SetPoint:
2349
+ case C.RotateNode:
2332
2350
  return new _e();
2333
- case N.SetLock:
2351
+ case C.SetFontStyle:
2334
2352
  return new He();
2335
- case N.SetShapeOpt:
2353
+ case C.SetPoint:
2336
2354
  return new Qe();
2355
+ case C.SetLock:
2356
+ return new Ke();
2357
+ case C.SetShapeOpt:
2358
+ return new Xe();
2337
2359
  }
2338
2360
  }
2339
2361
  registerForMainThread(e) {
@@ -2348,7 +2370,7 @@ class Ke {
2348
2370
  return !1;
2349
2371
  }
2350
2372
  }
2351
- function Xe({
2373
+ function Ze({
2352
2374
  subThreads: M,
2353
2375
  layers: e,
2354
2376
  scene: t,
@@ -2383,8 +2405,8 @@ function Xe({
2383
2405
  if (r)
2384
2406
  throw r;
2385
2407
  }
2386
- const Ye = 4;
2387
- class Ze {
2408
+ const je = 4;
2409
+ class Je {
2388
2410
  constructor(e = {}) {
2389
2411
  u(this, "pendingFrames", /* @__PURE__ */ new Map());
2390
2412
  u(this, "failedCanvases", /* @__PURE__ */ new Set());
@@ -2396,7 +2418,7 @@ class Ze {
2396
2418
  u(this, "destroyed", !1);
2397
2419
  this.tailFrameCount = Math.max(
2398
2420
  1,
2399
- Math.floor(e.tailFrameCount ?? Ye)
2421
+ Math.floor(e.tailFrameCount ?? je)
2400
2422
  ), this.requestFrame = e.requestFrame ?? ((t) => requestAnimationFrame(t)), this.cancelFrame = e.cancelFrame ?? ((t) => cancelAnimationFrame(t)), this.onReadbackError = e.onReadbackError;
2401
2423
  }
2402
2424
  markRendered(e) {
@@ -2427,7 +2449,7 @@ class Ze {
2427
2449
  }
2428
2450
  }
2429
2451
  }
2430
- class je {
2452
+ class et {
2431
2453
  constructor(e, t) {
2432
2454
  u(this, "viewId");
2433
2455
  u(this, "fullLayer");
@@ -2484,23 +2506,23 @@ class je {
2484
2506
  this.topLayer.parent,
2485
2507
  this.localLayer.parent,
2486
2508
  this.serviceLayer.parent
2487
- ]), this.vNodes = new We(e, this.scene);
2509
+ ]), this.vNodes = new Re(e, this.scene);
2488
2510
  const i = {
2489
2511
  thread: this,
2490
2512
  vNodes: this.vNodes
2491
2513
  };
2492
- this.localWork = new Ae(i), this.serviceWork = new Fe(i), this.topWork = new Pe(i), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ke([
2493
- N.CopyNode,
2494
- N.SetColorNode,
2495
- N.DeleteNode,
2496
- N.RotateNode,
2497
- N.ScaleNode,
2498
- N.TranslateNode,
2499
- N.ZIndexNode,
2500
- N.SetFontStyle,
2501
- N.SetPoint,
2502
- N.SetLock,
2503
- N.SetShapeOpt
2514
+ this.localWork = new xe(i), this.serviceWork = new Ue(i), this.topWork = new Fe(i), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ye([
2515
+ C.CopyNode,
2516
+ C.SetColorNode,
2517
+ C.DeleteNode,
2518
+ C.RotateNode,
2519
+ C.ScaleNode,
2520
+ C.TranslateNode,
2521
+ C.ZIndexNode,
2522
+ C.SetFontStyle,
2523
+ C.SetPoint,
2524
+ C.SetLock,
2525
+ C.SetShapeOpt
2504
2526
  ]).registerForMainThread(this);
2505
2527
  }
2506
2528
  getCachedImages(e) {
@@ -2545,7 +2567,7 @@ class je {
2545
2567
  reportErrorCode: "RENDERER_RUNTIME_ERROR",
2546
2568
  reportStage: s.stage,
2547
2569
  reportError: s.message,
2548
- reportString: Re(s, t, {
2570
+ reportString: Ee(s, t, {
2549
2571
  viewId: this.viewId,
2550
2572
  renderer: "mainThread"
2551
2573
  })
@@ -2575,9 +2597,9 @@ class je {
2575
2597
  workState: p,
2576
2598
  imageSrc: f,
2577
2599
  imageBitmap: w,
2578
- imageElement: S,
2600
+ imageElement: k,
2579
2601
  workIds: I,
2580
- isLockSentEventCursor: W,
2602
+ isLockSentEventCursor: R,
2581
2603
  requestId: g
2582
2604
  } = e, y = l == null ? void 0 : l.toString();
2583
2605
  switch (a) {
@@ -2585,16 +2607,16 @@ class je {
2585
2607
  G(e.dpr) && this.updateDpr(e.dpr);
2586
2608
  break;
2587
2609
  case h.AuthClear: {
2588
- const { clearUids: v, localUid: T } = e;
2589
- this.vNodes.setCanClearUids(v), this.vNodes.setLocalUid(T);
2610
+ const { clearUids: S, localUid: T } = e;
2611
+ this.vNodes.setCanClearUids(S), this.vNodes.setLocalUid(T);
2590
2612
  break;
2591
2613
  }
2592
2614
  case h.Destroy:
2593
2615
  this.destroy();
2594
2616
  break;
2595
2617
  case h.CancelBitmapEraser: {
2596
- const v = y;
2597
- v && this.localWork.abortBitmapEraser(v);
2618
+ const S = y;
2619
+ S && this.localWork.abortBitmapEraser(S);
2598
2620
  break;
2599
2621
  }
2600
2622
  case h.Clear:
@@ -2602,18 +2624,18 @@ class je {
2602
2624
  break;
2603
2625
  case h.ServiceSyncCommit: {
2604
2626
  if (this.destroyed) break;
2605
- const v = [
2627
+ const S = [
2606
2628
  (s = this.fullLayer) == null ? void 0 : s.parent,
2607
2629
  (r = this.topLayer) == null ? void 0 : r.parent,
2608
2630
  (i = this.localLayer) == null ? void 0 : i.parent,
2609
2631
  (o = this.serviceLayer) == null ? void 0 : o.parent
2610
2632
  ].filter(Boolean);
2611
2633
  try {
2612
- await be(
2634
+ await Le(
2613
2635
  (async () => {
2614
- await Le(
2636
+ await Ne(
2615
2637
  this.serviceWork,
2616
- v
2638
+ S
2617
2639
  );
2618
2640
  })(),
2619
2641
  {
@@ -2645,28 +2667,28 @@ class je {
2645
2667
  }
2646
2668
  case h.UpdateCamera:
2647
2669
  try {
2648
- await Ee(
2670
+ await be(
2649
2671
  e.cameraTaskId,
2650
- async (v) => {
2651
- this.activeCameraTaskContext = v;
2672
+ async (S) => {
2673
+ this.activeCameraTaskContext = S;
2652
2674
  try {
2653
- await this.updateCamera(e, v);
2675
+ await this.updateCamera(e, S);
2654
2676
  } finally {
2655
- this.activeCameraTaskContext === v && (this.activeCameraTaskContext = void 0);
2677
+ this.activeCameraTaskContext === S && (this.activeCameraTaskContext = void 0);
2656
2678
  }
2657
2679
  }
2658
2680
  );
2659
- } catch (v) {
2660
- throw this.cameraOpt = void 0, this.cancelCameraSettledRender(), v;
2681
+ } catch (S) {
2682
+ throw this.cameraOpt = void 0, this.cancelCameraSettledRender(), S;
2661
2683
  }
2662
2684
  break;
2663
2685
  case h.UpdateTools:
2664
2686
  if (n && c) {
2665
- const v = {
2687
+ const S = {
2666
2688
  toolsType: n,
2667
2689
  toolsOpt: c
2668
2690
  };
2669
- this.topWork.canUseTopLayer(n) ? this.topWork.setToolsOpt(v) : this.localWork.setToolsOpt(v);
2691
+ this.topWork.canUseTopLayer(n) ? this.topWork.setToolsOpt(S) : this.localWork.setToolsOpt(S);
2670
2692
  }
2671
2693
  break;
2672
2694
  case h.CreateWork:
@@ -2685,11 +2707,11 @@ class je {
2685
2707
  }
2686
2708
  break;
2687
2709
  case h.DrawWork:
2688
- p === b.Done && d === R.Local ? (await this.consumeDrawAll(d, e), n === m.LaserPen && W && this.post({
2710
+ p === b.Done && d === E.Local ? (await this.consumeDrawAll(d, e), n === m.LaserPen && R && this.post({
2689
2711
  sp: [
2690
2712
  {
2691
2713
  type: h.None,
2692
- isLockSentEventCursor: W
2714
+ isLockSentEventCursor: R
2693
2715
  }
2694
2716
  ]
2695
2717
  })) : await this.consumeDraw(d, e);
@@ -2706,7 +2728,7 @@ class je {
2706
2728
  await this.removeNode(e);
2707
2729
  return;
2708
2730
  case h.Select:
2709
- d === R.Local || l === D ? await this.localWork.updateFullSelectWork(e) : d === R.Service && this.serviceWork.runSelectWork(e);
2731
+ d === E.Local || l === D ? await this.localWork.updateFullSelectWork(e) : d === E.Service && this.serviceWork.runSelectWork(e);
2710
2732
  break;
2711
2733
  case h.CursorBlur:
2712
2734
  this.localWork.cursorBlur();
@@ -2715,34 +2737,34 @@ class je {
2715
2737
  this.localWork.cursorHover(e);
2716
2738
  break;
2717
2739
  case h.GetTextActive:
2718
- d === R.Local && this.localWork.checkTextActive(e);
2740
+ d === E.Local && this.localWork.checkTextActive(e);
2719
2741
  break;
2720
2742
  case h.GetImageBitMap:
2721
- if (f && (w || S) && l) {
2722
- const v = this.imageResolveMap.get(f);
2723
- if (!v || v.requestId !== g) {
2724
- this.closeImageSource(w || S);
2743
+ if (f && (w || k) && l) {
2744
+ const S = this.imageResolveMap.get(f);
2745
+ if (!S || S.requestId !== g) {
2746
+ this.closeImageSource(w || k);
2725
2747
  break;
2726
2748
  }
2727
2749
  const T = l.toString();
2728
2750
  this.deleteCachedImagesByWorkId(T), this.cacheImages.set(f, {
2729
- imageSource: w || S,
2751
+ imageSource: w || k,
2730
2752
  workId: T
2731
2753
  });
2732
- const { resolve: C, timer: L } = v;
2733
- L && clearTimeout(L), C && C(f);
2754
+ const { resolve: L, timer: N } = S;
2755
+ N && clearTimeout(N), L && L(f);
2734
2756
  }
2735
2757
  break;
2736
2758
  case h.GetVNodeInfo:
2737
2759
  if (l && I) {
2738
- const v = I.map((T) => this.vNodes.get(T));
2760
+ const S = I.map((T) => this.vNodes.get(T));
2739
2761
  this.post({
2740
2762
  sp: [
2741
2763
  {
2742
2764
  type: h.GetVNodeInfo,
2743
- dataType: R.Local,
2765
+ dataType: E.Local,
2744
2766
  workId: l,
2745
- vInfo: v
2767
+ vInfo: S
2746
2768
  }
2747
2769
  ]
2748
2770
  });
@@ -2762,9 +2784,9 @@ class je {
2762
2784
  if (!a || !n || !c || !d)
2763
2785
  return;
2764
2786
  let p = a;
2765
- if (n === pe.Iconify) {
2766
- const [y, v] = this.getIconSize(c, d, this.opt.displayer.dpr);
2767
- p = ue(a, y, v, l);
2787
+ if (n === ue.Iconify) {
2788
+ const [y, S] = this.getIconSize(c, d, this.opt.displayer.dpr);
2789
+ p = fe(a, y, S, l);
2768
2790
  }
2769
2791
  if (this.cacheImages.has(p)) {
2770
2792
  const y = this.getCachedImages(p);
@@ -2774,18 +2796,18 @@ class je {
2774
2796
  const w = this.imageResolveMap.get(p);
2775
2797
  if (w)
2776
2798
  return await w.promise, this.getCachedImages(p);
2777
- let S, I;
2778
- const W = new Promise((y, v) => {
2779
- S = y, I = v;
2799
+ let k, I;
2800
+ const R = new Promise((y, S) => {
2801
+ k = y, I = S;
2780
2802
  }), g = {
2781
- resolve: S,
2803
+ resolve: k,
2782
2804
  reject: I,
2783
2805
  timer: void 0,
2784
2806
  requestId: i,
2785
- promise: W
2807
+ promise: R
2786
2808
  };
2787
2809
  return g.timer = setTimeout(() => {
2788
- this.imageResolveMap.get(p) === g && S(p);
2810
+ this.imageResolveMap.get(p) === g && k(p);
2789
2811
  }, 5e3), this.imageResolveMap.set(p, g), this.opt.post({
2790
2812
  sp: [
2791
2813
  {
@@ -2798,7 +2820,7 @@ class je {
2798
2820
  type: h.GetImageBitMap
2799
2821
  }
2800
2822
  ]
2801
- }), await W, this.imageResolveMap.get(p) === g && this.imageResolveMap.delete(p), this.getCachedImages(p);
2823
+ }), await R, this.imageResolveMap.get(p) === g && this.imageResolveMap.delete(p), this.getCachedImages(p);
2802
2824
  }
2803
2825
  }
2804
2826
  async removeNode(e) {
@@ -2809,12 +2831,12 @@ class je {
2809
2831
  await this.localWork.removeSelector(e);
2810
2832
  continue;
2811
2833
  }
2812
- t === R.Local ? this.localWork.removeWork(e) : t === R.Service && this.serviceWork.removeWork(e), await this.localWork.colloctEffectSelectWork(e);
2834
+ t === E.Local ? this.localWork.removeWork(e) : t === E.Service && this.serviceWork.removeWork(e), await this.localWork.colloctEffectSelectWork(e);
2813
2835
  }
2814
2836
  }
2815
2837
  async consumeFull(e, t) {
2816
2838
  const s = await this.localWork.colloctEffectSelectWork(t);
2817
- s && e === R.Local && await this.localWork.consumeFull(s), s && e === R.Service && this.serviceWork.consumeFull(s);
2839
+ s && e === E.Local && await this.localWork.consumeFull(s), s && e === E.Service && this.serviceWork.consumeFull(s);
2818
2840
  }
2819
2841
  setCameraOpt(e) {
2820
2842
  this.cameraOpt = e;
@@ -2890,12 +2912,12 @@ class je {
2890
2912
  if (r) {
2891
2913
  const i = r.toString();
2892
2914
  if (s && this.topWork.canUseTopLayer(s)) {
2893
- e === R.Local && (this.topWork.getLocalWorkShape(
2915
+ e === E.Local && (this.topWork.getLocalWorkShape(
2894
2916
  r.toString()
2895
2917
  ) || this.topWork.createLocalWork(t)), await this.topWork.consumeDrawAll(t);
2896
2918
  return;
2897
2919
  }
2898
- e === R.Local && (this.localWork.getWorkShape(i) || this.localWork.createLocalWork(t), await this.localWork.consumeDrawAll(t, this.serviceWork));
2920
+ e === E.Local && (this.localWork.getWorkShape(i) || this.localWork.createLocalWork(t), await this.localWork.consumeDrawAll(t, this.serviceWork));
2899
2921
  }
2900
2922
  }
2901
2923
  async consumeDraw(e, t) {
@@ -2903,10 +2925,10 @@ class je {
2903
2925
  if (r && i && s) {
2904
2926
  const o = r.toString();
2905
2927
  if (this.topWork.canUseTopLayer(i)) {
2906
- e === R.Local && (this.topWork.getLocalWorkShape(o) || this.topWork.createLocalWork(t)), this.topWork.consumeDraw(t);
2928
+ e === E.Local && (this.topWork.getLocalWorkShape(o) || this.topWork.createLocalWork(t)), this.topWork.consumeDraw(t);
2907
2929
  return;
2908
2930
  }
2909
- e === R.Local ? (this.localWork.getWorkShape(o) || this.localWork.createLocalWork(t), await this.localWork.consumeDraw(t, this.serviceWork)) : e === R.Service && this.serviceWork.consumeDraw(t);
2931
+ e === E.Local ? (this.localWork.getWorkShape(o) || this.localWork.createLocalWork(t), await this.localWork.consumeDraw(t, this.serviceWork)) : e === E.Service && this.serviceWork.consumeDraw(t);
2910
2932
  return;
2911
2933
  }
2912
2934
  }
@@ -2936,8 +2958,8 @@ class je {
2936
2958
  let y;
2937
2959
  do {
2938
2960
  y = [];
2939
- for (const [T, C] of this.localWork.getWorkShapes().entries())
2940
- switch (C.toolsType) {
2961
+ for (const [T, L] of this.localWork.getWorkShapes().entries())
2962
+ switch (L.toolsType) {
2941
2963
  case m.Text:
2942
2964
  case m.BitMapEraser:
2943
2965
  case m.PencilEraser:
@@ -2946,7 +2968,7 @@ class je {
2946
2968
  case m.LaserPen:
2947
2969
  break;
2948
2970
  default:
2949
- T !== H && T !== D && y.push(`${T}:${C.toolsType}`);
2971
+ T !== H && T !== D && y.push(`${T}:${L.toolsType}`);
2950
2972
  break;
2951
2973
  }
2952
2974
  if (t && (t.stage = "blocking-works", t.blockingWorks = y), !y.length) break;
@@ -2960,103 +2982,103 @@ class je {
2960
2982
  }
2961
2983
  if (t != null && t.aborted) return;
2962
2984
  const f = /* @__PURE__ */ new Map();
2963
- for (const [y, v] of this.vNodes.getNodesByType(m.Text).entries()) {
2964
- const T = v.rect;
2985
+ for (const [y, S] of this.vNodes.getNodesByType(m.Text).entries()) {
2986
+ const T = S.rect;
2965
2987
  f.set(y, J(T));
2966
2988
  }
2967
- for (const [y, v] of this.vNodes.gethasEraserNodes().entries())
2968
- f.set(y, J(v.rect));
2989
+ for (const [y, S] of this.vNodes.gethasEraserNodes().entries())
2990
+ f.set(y, J(S.rect));
2969
2991
  const w = new Set(f.keys());
2970
- let S = !1;
2992
+ let k = !1;
2971
2993
  if (this.localWork.hasSelector()) {
2972
2994
  const y = (l = this.localWork.getSelector()) == null ? void 0 : l.selectIds;
2973
2995
  if (y) {
2974
- S = !0;
2975
- for (const v of y)
2976
- w.add(v);
2996
+ k = !0;
2997
+ for (const S of y)
2998
+ w.add(S);
2977
2999
  }
2978
3000
  }
2979
3001
  let I = !1;
2980
3002
  if (this.serviceWork.selectorWorkShapes.size)
2981
3003
  for (const y of this.serviceWork.selectorWorkShapes.values()) {
2982
- const v = y.selectIds;
2983
- if (v) {
3004
+ const S = y.selectIds;
3005
+ if (S) {
2984
3006
  I = !0;
2985
- for (const T of v)
3007
+ for (const T of S)
2986
3008
  w.add(T);
2987
3009
  }
2988
3010
  }
2989
3011
  if (this.setCameraOpt(s), this.vNodes.curNodeMap.size) {
2990
3012
  this.vNodes.clearTarget(), this.vNodes.updateHighLevelNodesRect(w);
2991
- for (const [T, C] of f.entries()) {
2992
- const L = this.vNodes.get(T);
2993
- if (L) {
2994
- const A = C, E = L.rect, k = this.getSceneRect(), B = ae(A, k), O = ae(E, k);
3013
+ for (const [T, L] of f.entries()) {
3014
+ const N = this.vNodes.get(T);
3015
+ if (N) {
3016
+ const A = L, W = N.rect, v = this.getSceneRect(), B = ae(A, v), O = ae(W, v);
2995
3017
  let P = c;
2996
- (B !== O || A.w !== E.w || A.h !== E.h || O === Ce.intersect) && (P = !0);
2997
- const { toolsType: F, opt: U } = L, X = U.eraserlines && U.eraserlines.length > 0 || !!U.eraserFaces;
3018
+ (B !== O || A.w !== W.w || A.h !== W.h || O === Ce.intersect) && (P = !0);
3019
+ const { toolsType: F, opt: x } = N, X = x.eraserlines && x.eraserlines.length > 0 || !!x.eraserFaces;
2998
3020
  (P || p && X) && (F === m.Text || X) && this.debounceUpdateCache.add(T);
2999
3021
  }
3000
3022
  }
3001
- if (S && this.localWork.reRenderSelector(), I)
3023
+ if (k && this.localWork.reRenderSelector(), I)
3002
3024
  for (const [
3003
3025
  T,
3004
- C
3026
+ L
3005
3027
  ] of this.serviceWork.selectorWorkShapes.entries())
3006
3028
  this.serviceWork.runSelectWork({
3007
3029
  workId: T,
3008
- selectIds: C.selectIds,
3030
+ selectIds: L.selectIds,
3009
3031
  msgType: h.Select,
3010
- dataType: R.Service,
3032
+ dataType: E.Service,
3011
3033
  viewId: this.viewId
3012
3034
  });
3013
3035
  o = !0;
3014
3036
  const y = { cancelled: !1, cameraTaskId: i, context: t };
3015
3037
  this.activeCameraSettledRender = y;
3016
- const v = () => !this.destroyed && !y.cancelled && this.activeCameraSettledRender === y && !(t != null && t.aborted);
3038
+ const S = () => !this.destroyed && !y.cancelled && this.activeCameraSettledRender === y && !(t != null && t.aborted);
3017
3039
  this.debounceUpdateCameraId = setTimeout(async () => {
3018
3040
  var T;
3019
3041
  this.debounceUpdateCameraId = void 0;
3020
3042
  try {
3021
- if (!v()) return;
3022
- const C = [];
3023
- for (const E of this.debounceUpdateCache.values()) {
3024
- const k = (T = this.fullLayer) == null ? void 0 : T.getElementsByName(E)[0], B = this.vNodes.get(E);
3043
+ if (!S()) return;
3044
+ const L = [];
3045
+ for (const W of this.debounceUpdateCache.values()) {
3046
+ const v = (T = this.fullLayer) == null ? void 0 : T.getElementsByName(W)[0], B = this.vNodes.get(W);
3025
3047
  if (B) {
3026
3048
  const { toolsType: O, opt: P } = B;
3027
- if (k || O !== m.Text) {
3049
+ if (v || O !== m.Text) {
3028
3050
  const F = this.localWork.setFullWork({
3029
3051
  toolsType: O,
3030
3052
  opt: P,
3031
- workId: E
3053
+ workId: W
3032
3054
  });
3033
3055
  if (F) {
3034
3056
  if (O === m.Text)
3035
- C.push(
3057
+ L.push(
3036
3058
  F.consumeServiceAsync({
3037
3059
  isFullWork: !0,
3038
- replaceId: E,
3060
+ replaceId: W,
3039
3061
  boxRect: this.getSceneRect(),
3040
- isActive: v
3062
+ isActive: S
3041
3063
  })
3042
3064
  );
3043
3065
  else if (P.eraserlines && P.eraserlines.length > 0 || P.eraserFaces) {
3044
- const U = F.consumeService({
3066
+ const x = F.consumeService({
3045
3067
  op: B.op,
3046
3068
  isFullWork: !0,
3047
- replaceId: E,
3069
+ replaceId: W,
3048
3070
  workState: b.Done
3049
3071
  });
3050
- this.localWork.clearWorkShapeNodeCache(E), C.push(Promise.resolve(U));
3072
+ this.localWork.clearWorkShapeNodeCache(W), L.push(Promise.resolve(x));
3051
3073
  }
3052
3074
  }
3053
3075
  }
3054
3076
  }
3055
- this.debounceUpdateCache.delete(E);
3077
+ this.debounceUpdateCache.delete(W);
3056
3078
  }
3057
- if (await Promise.all(C), !v()) return;
3058
- this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds();
3059
- const L = [
3079
+ if (await Promise.all(L), !S()) return;
3080
+ this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds(), k && L.length && this.localWork.reRenderSelector();
3081
+ const N = [
3060
3082
  this.fullLayer.parent.prepareRender,
3061
3083
  this.topLayer.parent.prepareRender,
3062
3084
  this.localLayer.parent.prepareRender,
@@ -3067,19 +3089,19 @@ class je {
3067
3089
  this.topLayer.parent,
3068
3090
  this.localLayer.parent,
3069
3091
  this.serviceLayer.parent
3070
- ], await Promise.all(L), y.renderLayers = void 0, !v()) return;
3092
+ ], await Promise.all(N), y.renderLayers = void 0, !S()) return;
3071
3093
  const A = y.cameraTaskId;
3072
3094
  G(A) && this.opt.post({
3073
3095
  viewId: this.viewId,
3074
3096
  viewGeneration: this.viewGeneration,
3075
3097
  cameraSettledTaskId: A
3076
3098
  });
3077
- } catch (C) {
3078
- if (!v()) return;
3079
- const L = {
3099
+ } catch (L) {
3100
+ if (!S()) return;
3101
+ const N = {
3080
3102
  code: "RENDERER_BUSINESS_ERROR",
3081
3103
  business: "updateCamera",
3082
- message: C instanceof Error ? C.message : String(C),
3104
+ message: L instanceof Error ? L.message : String(L),
3083
3105
  stage: "camera-settled-render",
3084
3106
  workerType: "mainThread"
3085
3107
  }, A = y.cameraTaskId;
@@ -3090,12 +3112,12 @@ class je {
3090
3112
  viewGeneration: this.viewGeneration,
3091
3113
  cameraTaskId: A,
3092
3114
  cameraTaskStatus: "failed",
3093
- cameraTaskError: L
3115
+ cameraTaskError: N
3094
3116
  });
3095
- } catch (E) {
3117
+ } catch (W) {
3096
3118
  console.error(
3097
3119
  `[cameraSettledRender] failed ACK post failed viewId=${this.viewId} taskId=${A}`,
3098
- E
3120
+ W
3099
3121
  );
3100
3122
  }
3101
3123
  } finally {
@@ -3103,22 +3125,22 @@ class je {
3103
3125
  }
3104
3126
  }, oe);
3105
3127
  }
3106
- const W = [
3128
+ const R = [
3107
3129
  this.fullLayer.parent,
3108
3130
  this.topLayer.parent,
3109
3131
  this.localLayer.parent,
3110
3132
  this.serviceLayer.parent
3111
3133
  ], g = Promise.all(
3112
- W.map((y) => y.prepareRender)
3134
+ R.map((y) => y.prepareRender)
3113
3135
  );
3114
- if (t && !await Ne(
3136
+ if (t && !await Be(
3115
3137
  t,
3116
3138
  g,
3117
3139
  "prepare-render"
3118
3140
  )) {
3119
- W.filter(
3120
- (v) => v.cancelPendingRender()
3121
- ).forEach((v) => v.render()), g.catch(() => {
3141
+ R.filter(
3142
+ (S) => S.cancelPendingRender()
3143
+ ).forEach((S) => S.render()), g.catch(() => {
3122
3144
  });
3123
3145
  return;
3124
3146
  }
@@ -3140,7 +3162,7 @@ class je {
3140
3162
  };
3141
3163
  }
3142
3164
  createScene(e) {
3143
- return new fe({
3165
+ return new me({
3144
3166
  displayRatio: this.opt.displayer.dpr,
3145
3167
  depth: !1,
3146
3168
  desynchronized: !0,
@@ -3151,7 +3173,7 @@ class je {
3151
3173
  });
3152
3174
  }
3153
3175
  createLayer(e, t, s) {
3154
- const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, { ...s, offscreen: !1 }), n = new me({
3176
+ const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, { ...s, offscreen: !1 }), n = new ye({
3155
3177
  anchor: [0.5, 0.5],
3156
3178
  pos: [r * 0.5, i * 0.5],
3157
3179
  size: [r, i],
@@ -3161,7 +3183,7 @@ class je {
3161
3183
  return a.append(n), n;
3162
3184
  }
3163
3185
  enableCanvas2DReadback(e) {
3164
- this.readbackScheduler = new Ze({
3186
+ this.readbackScheduler = new Je({
3165
3187
  onReadbackError: (t) => this.opt.master.Logger.warn(
3166
3188
  `[Appliance]: [main-thread-readback] stage=failed viewId=${this.viewId} error=${t instanceof Error ? t.message : String(t)}`
3167
3189
  )
@@ -3212,7 +3234,7 @@ class je {
3212
3234
  var e, t;
3213
3235
  this.destroyed || (this.destroyed = !0, this.disableCanvas2DReadback(), (t = (e = this.activeCameraTaskContext) == null ? void 0 : e.abort) == null || t.call(e), this.activeCameraTaskContext = void 0, this.mainThreadPostId !== void 0 && (cancelAnimationFrame(this.mainThreadPostId), this.mainThreadPostId = void 0), this.combinePostMsg.clear(), this.cancelCameraBlockingWait(), this.cancelCameraSettledRender(), this.debounceUpdateCache.clear(), this.clearCacheImages(), this.clearImageResolveMap(
3214
3236
  new Error(`main-thread view destroyed: ${this.viewId}`)
3215
- ), this.vNodes.clear(), Xe({
3237
+ ), this.vNodes.clear(), Ze({
3216
3238
  subThreads: [this.localWork, this.serviceWork, this.topWork],
3217
3239
  layers: [
3218
3240
  this.fullLayer,
@@ -3225,7 +3247,7 @@ class je {
3225
3247
  }));
3226
3248
  }
3227
3249
  }
3228
- class Je {
3250
+ class tt {
3229
3251
  constructor(e, t) {
3230
3252
  u(this, "viewId");
3231
3253
  u(this, "fullLayer");
@@ -3400,9 +3422,9 @@ class Je {
3400
3422
  if (!a || !n || !c || !d)
3401
3423
  return;
3402
3424
  let p = a;
3403
- if (n === pe.Iconify) {
3425
+ if (n === ue.Iconify) {
3404
3426
  const [g, y] = this.getIconSize(c, d, this.opt.displayer.dpr);
3405
- p = ue(a, g, y, l);
3427
+ p = fe(a, g, y, l);
3406
3428
  }
3407
3429
  if (this.cacheImages.has(p)) {
3408
3430
  const g = this.getCachedImages(p);
@@ -3412,18 +3434,18 @@ class Je {
3412
3434
  const w = this.imageResolveMap.get(p);
3413
3435
  if (w)
3414
3436
  return await w.promise, this.getCachedImages(p);
3415
- let S;
3437
+ let k;
3416
3438
  const I = new Promise((g) => {
3417
- S = g;
3418
- }), W = {
3419
- resolve: S,
3439
+ k = g;
3440
+ }), R = {
3441
+ resolve: k,
3420
3442
  timer: void 0,
3421
3443
  requestId: i,
3422
3444
  promise: I
3423
3445
  };
3424
- return W.timer = setTimeout(() => {
3425
- this.imageResolveMap.get(p) === W && S(p);
3426
- }, 5e3), this.imageResolveMap.set(p, W), this.opt.post({
3446
+ return R.timer = setTimeout(() => {
3447
+ this.imageResolveMap.get(p) === R && k(p);
3448
+ }, 5e3), this.imageResolveMap.set(p, R), this.opt.post({
3427
3449
  viewId: this.viewId,
3428
3450
  viewGeneration: this.viewGeneration,
3429
3451
  viewOwner: this.viewOwner,
@@ -3438,7 +3460,7 @@ class Je {
3438
3460
  requestId: i
3439
3461
  }
3440
3462
  ]
3441
- }), await I, this.imageResolveMap.get(p) === W && this.imageResolveMap.delete(p), this.getCachedImages(p);
3463
+ }), await I, this.imageResolveMap.get(p) === R && this.imageResolveMap.delete(p), this.getCachedImages(p);
3442
3464
  }
3443
3465
  }
3444
3466
  createWorkShapeNode(e) {
@@ -3481,9 +3503,18 @@ class Je {
3481
3503
  op: s,
3482
3504
  isFullWork: !0,
3483
3505
  replaceId: a
3484
- }), o = (e == null ? void 0 : e.updateNodeOpt) && t.updataOptService(e.updateNodeOpt)), ne(i, o);
3506
+ }), o = (e == null ? void 0 : e.updateNodeOpt) && t.updataOptService(e.updateNodeOpt)), i = this.syncMatrixRect(a, t, i), ne(i, o);
3485
3507
  }
3486
3508
  }
3509
+ syncMatrixRect(e, t, s) {
3510
+ const r = t.getWorkOptions().matrix;
3511
+ if (!e || !r || pe(r).every(
3512
+ (o, a) => o === [1, 0, 0, 1, 0, 0][a]
3513
+ ))
3514
+ return s;
3515
+ const i = Oe.getRectFromLayer(this.fullLayer, e);
3516
+ return i || s;
3517
+ }
3487
3518
  async getSnapshot(e) {
3488
3519
  const { scenePath: t, scenes: s, cameraOpt: r, w: i, h: o, requestId: a } = e;
3489
3520
  if (!(t && s && r))
@@ -3499,7 +3530,7 @@ class Je {
3499
3530
  opt: l,
3500
3531
  workId: c,
3501
3532
  msgType: h.FullWork,
3502
- dataType: R.Service,
3533
+ dataType: E.Service,
3503
3534
  viewId: this.viewId,
3504
3535
  requestId: a
3505
3536
  };
@@ -3575,7 +3606,7 @@ class Je {
3575
3606
  ...n,
3576
3607
  workId: a,
3577
3608
  msgType: h.FullWork,
3578
- dataType: R.Service,
3609
+ dataType: E.Service,
3579
3610
  viewId: this.viewId,
3580
3611
  requestId: i
3581
3612
  });
@@ -3616,7 +3647,7 @@ class Je {
3616
3647
  for (const r of s.sp) {
3617
3648
  let i = !1;
3618
3649
  for (const o of e)
3619
- if (Be(r, o)) {
3650
+ if (De(r, o)) {
3620
3651
  i = !0;
3621
3652
  break;
3622
3653
  }
@@ -3656,7 +3687,7 @@ class Je {
3656
3687
  this.releaseBatchImageBitmaps(e);
3657
3688
  }
3658
3689
  createScene(e) {
3659
- return new fe({
3690
+ return new me({
3660
3691
  displayRatio: this.opt.displayer.dpr,
3661
3692
  depth: !1,
3662
3693
  desynchronized: !0,
@@ -3666,7 +3697,7 @@ class Je {
3666
3697
  });
3667
3698
  }
3668
3699
  createLayer(e, t, s) {
3669
- const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, s), n = new me({
3700
+ const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, s), n = new ye({
3670
3701
  anchor: [0.5, 0.5],
3671
3702
  pos: [r * 0.5, i * 0.5],
3672
3703
  size: [r, i],
@@ -3733,7 +3764,7 @@ class Je {
3733
3764
  throw t[0];
3734
3765
  }
3735
3766
  }
3736
- class lt {
3767
+ class pt {
3737
3768
  constructor(e) {
3738
3769
  u(this, "mainThreadMap", /* @__PURE__ */ new Map());
3739
3770
  u(this, "cameraRenderQueueByView", /* @__PURE__ */ new Map());
@@ -3769,7 +3800,7 @@ class lt {
3769
3800
  consumeWorkId: p
3770
3801
  } = e;
3771
3802
  if (c && q(i)) {
3772
- const f = Oe(
3803
+ const f = Me(
3773
3804
  o,
3774
3805
  a,
3775
3806
  "mainThread"
@@ -3854,10 +3885,10 @@ class lt {
3854
3885
  );
3855
3886
  }
3856
3887
  createMainThread(e, t) {
3857
- return new je(e, t);
3888
+ return new et(e, t);
3858
3889
  }
3859
3890
  createSnapshotThread(e, t) {
3860
- return new Je(e, t);
3891
+ return new tt(e, t);
3861
3892
  }
3862
3893
  getSnapshotRequestKey(e) {
3863
3894
  return e.requestId || `${e.viewId}\0${e.scenePath || ""}\0${e.msgType}`;
@@ -3924,33 +3955,33 @@ class lt {
3924
3955
  if (o === h.Init) {
3925
3956
  const g = i.viewGeneration ?? (this.viewGenerationById.get(a) || 0) + 1;
3926
3957
  await this.enqueueViewTask(a, async () => {
3927
- var E, k, B;
3958
+ var W, v, B;
3928
3959
  const y = this.viewGenerationById.get(a);
3929
3960
  if (y !== void 0 && g < y)
3930
3961
  return;
3931
3962
  this.viewGenerationById.set(a, g);
3932
- const v = i.viewOwner || `${a}:${g}:${++this.ownerSequence}`, T = (E = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : E.displayer, C = T == null ? void 0 : T.canvasContainerRef.current;
3933
- if (!T || !C || !l || !p) {
3963
+ const S = i.viewOwner || `${a}:${g}:${++this.ownerSequence}`, T = (W = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : W.displayer, L = T == null ? void 0 : T.canvasContainerRef.current;
3964
+ if (!T || !L || !l || !p) {
3934
3965
  this.viewOwnerById.delete(a);
3935
3966
  return;
3936
3967
  }
3937
- this.viewOwnerById.set(a, v);
3938
- const L = this.mainThreadMap.get(a);
3939
- L == null || L.destroy();
3968
+ this.viewOwnerById.set(a, S);
3969
+ const N = this.mainThreadMap.get(a);
3970
+ N == null || N.destroy();
3940
3971
  const A = this.createMainThread(a, {
3941
3972
  displayer: T,
3942
- container: C,
3973
+ container: L,
3943
3974
  layerOpt: l,
3944
3975
  master: this.master,
3945
3976
  canvasOpt: p,
3946
- viewOwner: v,
3977
+ viewOwner: S,
3947
3978
  viewGeneration: g,
3948
- mainThreadRenderMode: ((B = (k = this.master.control) == null ? void 0 : k.renderingCompatibilityDecision) == null ? void 0 : B.mainThreadRenderMode) ?? "normal",
3979
+ mainThreadRenderMode: ((B = (v = this.master.control) == null ? void 0 : v.renderingCompatibilityDecision) == null ? void 0 : B.mainThreadRenderMode) ?? "normal",
3949
3980
  post: (O) => this.post({
3950
3981
  ...O,
3951
3982
  viewId: O.viewId || a,
3952
3983
  viewGeneration: O.viewGeneration ?? g,
3953
- viewOwner: v
3984
+ viewOwner: S
3954
3985
  })
3955
3986
  });
3956
3987
  this.mainThreadMap.set(a, A), A && f && A.setCameraOpt(f), this.post({
@@ -3966,40 +3997,40 @@ class lt {
3966
3997
  continue;
3967
3998
  }
3968
3999
  if (o === h.Snapshot || o === h.BoundingBox) {
3969
- const g = (t = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : t.displayer, y = (s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.displayer, v = (r = y == null ? void 0 : y.snapshotContainerRef) == null ? void 0 : r.current;
3970
- if (g && v && f) {
3971
- const T = this.getSnapshotRequestKey(i), C = this.snapshotThreadsByRequest.get(T);
3972
- C && this.disposeSnapshotThread(T, C.thread, "replaced");
3973
- const L = document.createElement("div");
3974
- L.style.width = `${f.width}px`, L.style.height = `${f.height}px`, v.append(L);
4000
+ const g = (t = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : t.displayer, y = (s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.displayer, S = (r = y == null ? void 0 : y.snapshotContainerRef) == null ? void 0 : r.current;
4001
+ if (g && S && f) {
4002
+ const T = this.getSnapshotRequestKey(i), L = this.snapshotThreadsByRequest.get(T);
4003
+ L && this.disposeSnapshotThread(T, L.thread, "replaced");
4004
+ const N = document.createElement("div");
4005
+ N.style.width = `${f.width}px`, N.style.height = `${f.height}px`, S.append(N);
3975
4006
  const A = {
3976
4007
  ...he.defaultLayerOpt,
3977
4008
  offscreen: !1,
3978
4009
  width: f.width,
3979
4010
  height: f.height
3980
- }, E = {
4011
+ }, W = {
3981
4012
  ...he.defaultScreenCanvasOpt,
3982
4013
  width: f.width,
3983
4014
  height: f.height
3984
- }, k = this.createSnapshotThread(a, {
4015
+ }, v = this.createSnapshotThread(a, {
3985
4016
  displayer: g,
3986
- container: L,
4017
+ container: N,
3987
4018
  layerOpt: A,
3988
4019
  master: this.master,
3989
- canvasOpt: E,
4020
+ canvasOpt: W,
3990
4021
  post: this.post,
3991
4022
  viewOwner: this.viewOwnerById.get(a),
3992
4023
  viewGeneration: this.viewGenerationById.get(a)
3993
4024
  });
3994
4025
  this.snapshotThreadsByRequest.set(T, {
3995
- thread: k,
3996
- surface: L
3997
- }), k.on(i).then(() => {
3998
- this.disposeSnapshotThread(T, k);
4026
+ thread: v,
4027
+ surface: N
4028
+ }), v.on(i).then(() => {
4029
+ this.disposeSnapshotThread(T, v);
3999
4030
  }).catch((B) => {
4000
4031
  this.master.Logger.error(
4001
4032
  `[Appliance]: snapshot render failed; viewId=${a}; error=${B instanceof Error ? B.message : String(B)}`
4002
- ), this.disposeSnapshotThread(T, k);
4033
+ ), this.disposeSnapshotThread(T, v);
4003
4034
  });
4004
4035
  continue;
4005
4036
  }
@@ -4030,8 +4061,8 @@ class lt {
4030
4061
  continue;
4031
4062
  }
4032
4063
  if (o === h.GetImageBitMap) {
4033
- const g = this.mainThreadMap.get(a), y = this.viewGenerationById.get(a), v = this.viewOwnerById.get(a);
4034
- if (!g || i.viewGeneration !== void 0 && i.viewGeneration !== y || i.viewOwner !== void 0 && i.viewOwner !== v || this.mainThreadMap.get(a) !== g) {
4064
+ const g = this.mainThreadMap.get(a), y = this.viewGenerationById.get(a), S = this.viewOwnerById.get(a);
4065
+ if (!g || i.viewGeneration !== void 0 && i.viewGeneration !== y || i.viewOwner !== void 0 && i.viewOwner !== S || this.mainThreadMap.get(a) !== g) {
4035
4066
  this.releaseMessageBitmap(i);
4036
4067
  continue;
4037
4068
  }
@@ -4039,34 +4070,34 @@ class lt {
4039
4070
  continue;
4040
4071
  }
4041
4072
  if (o === h.TasksQueue && (n != null && n.size)) {
4042
- const g = n.get(a), y = this.mainThreadMap.get(a), v = this.viewGenerationById.get(a), T = this.viewOwnerById.get(a);
4043
- let C;
4073
+ const g = n.get(a), y = this.mainThreadMap.get(a), S = this.viewGenerationById.get(a), T = this.viewOwnerById.get(a);
4074
+ let L;
4044
4075
  if (g && y)
4045
4076
  try {
4046
4077
  await this.enqueueViewTask(a, async () => {
4047
- this.viewGenerationById.get(a) !== v || this.viewOwnerById.get(a) !== T || this.mainThreadMap.get(a) !== y || await y.on(g);
4078
+ this.viewGenerationById.get(a) !== S || this.viewOwnerById.get(a) !== T || this.mainThreadMap.get(a) !== y || await y.on(g);
4048
4079
  });
4049
- } catch (L) {
4050
- if (g.msgType !== h.UpdateCamera) throw L;
4051
- const A = De(L);
4052
- C = {
4080
+ } catch (N) {
4081
+ if (g.msgType !== h.UpdateCamera) throw N;
4082
+ const A = Pe(N);
4083
+ L = {
4053
4084
  code: A ? "RENDERER_BUSINESS_TIMEOUT" : "RENDERER_BUSINESS_ERROR",
4054
4085
  business: "updateCamera",
4055
- message: L instanceof Error ? L.message : String(L),
4056
- elapsedMs: A ? L.elapsedMs : void 0,
4057
- stage: A ? L.stage : "update-camera",
4058
- blockingWorks: A ? L.blockingWorks : void 0,
4086
+ message: N instanceof Error ? N.message : String(N),
4087
+ elapsedMs: A ? N.elapsedMs : void 0,
4088
+ stage: A ? N.stage : "update-camera",
4089
+ blockingWorks: A ? N.blockingWorks : void 0,
4059
4090
  workerType: "mainThread"
4060
4091
  };
4061
4092
  }
4062
- if (C && q(d)) {
4093
+ if (L && q(d)) {
4063
4094
  this.post({
4064
4095
  viewId: a,
4065
- viewGeneration: v,
4096
+ viewGeneration: S,
4066
4097
  viewOwner: T,
4067
4098
  cameraTaskId: d,
4068
- cameraTaskStatus: C.code === "RENDERER_BUSINESS_TIMEOUT" ? "timeout" : "failed",
4069
- cameraTaskError: C
4099
+ cameraTaskStatus: L.code === "RENDERER_BUSINESS_TIMEOUT" ? "timeout" : "failed",
4100
+ cameraTaskError: L
4070
4101
  });
4071
4102
  continue;
4072
4103
  }
@@ -4074,26 +4105,26 @@ class lt {
4074
4105
  workerTasksqueueCount: c,
4075
4106
  cameraTaskId: d,
4076
4107
  viewId: a,
4077
- viewGeneration: v,
4108
+ viewGeneration: S,
4078
4109
  viewOwner: T
4079
4110
  });
4080
4111
  continue;
4081
4112
  }
4082
4113
  if (a === ce) {
4083
4114
  const g = [...this.mainThreadMap.entries()];
4084
- for (const [y, v] of g) {
4115
+ for (const [y, S] of g) {
4085
4116
  const T = this.enqueueViewTask(y, async () => {
4086
- this.mainThreadMap.get(y) === v && (o === h.Destroy ? (v.destroy(), this.mainThreadMap.delete(y), this.viewOwnerById.delete(y), this.viewGenerationById.set(
4117
+ this.mainThreadMap.get(y) === S && (o === h.Destroy ? (S.destroy(), this.mainThreadMap.delete(y), this.viewOwnerById.delete(y), this.viewGenerationById.set(
4087
4118
  y,
4088
4119
  (this.viewGenerationById.get(y) || 0) + 1
4089
- )) : await v.on(i));
4120
+ )) : await S.on(i));
4090
4121
  });
4091
4122
  await T, this.cameraRenderQueueByView.get(y) === T && this.cameraRenderQueueByView.delete(y);
4092
4123
  }
4093
4124
  continue;
4094
4125
  }
4095
- const S = this.mainThreadMap.get(a);
4096
- if (o === h.Destroy && !S) {
4126
+ const k = this.mainThreadMap.get(a);
4127
+ if (o === h.Destroy && !k) {
4097
4128
  await this.enqueueViewTask(a, async () => {
4098
4129
  this.viewGenerationById.set(
4099
4130
  a,
@@ -4102,12 +4133,12 @@ class lt {
4102
4133
  });
4103
4134
  continue;
4104
4135
  }
4105
- if (!S)
4136
+ if (!k)
4106
4137
  continue;
4107
- const I = this.viewGenerationById.get(a), W = this.enqueueViewTask(a, async () => {
4108
- this.viewGenerationById.get(a) !== I || this.mainThreadMap.get(a) !== S || await S.on(i);
4138
+ const I = this.viewGenerationById.get(a), R = this.enqueueViewTask(a, async () => {
4139
+ this.viewGenerationById.get(a) !== I || this.mainThreadMap.get(a) !== k || await k.on(i);
4109
4140
  });
4110
- o === h.Destroy && (await W, this.mainThreadMap.get(a) === S && this.mainThreadMap.delete(a), this.viewOwnerById.delete(a), this.cameraRenderQueueByView.get(a) === W && this.cameraRenderQueueByView.delete(a), this.viewGenerationById.set(
4141
+ o === h.Destroy && (await R, this.mainThreadMap.get(a) === k && this.mainThreadMap.delete(a), this.viewOwnerById.delete(a), this.cameraRenderQueueByView.get(a) === R && this.cameraRenderQueueByView.delete(a), this.viewGenerationById.set(
4111
4142
  a,
4112
4143
  i.viewGeneration ?? (I || 0) + 1
4113
4144
  ));
@@ -4115,5 +4146,5 @@ class lt {
4115
4146
  }
4116
4147
  }
4117
4148
  export {
4118
- lt as MainThreadManagerImpl
4149
+ pt as MainThreadManagerImpl
4119
4150
  };