@netless/appliance-plugin 1.1.43 → 1.1.44

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 (34) hide show
  1. package/dist/appliance-plugin.js +1 -1
  2. package/dist/appliance-plugin.mjs +3 -3
  3. package/dist/{bridge-GmRa7-tp.js → bridge-B7BW1lpB.js} +1 -1
  4. package/dist/{bridge-D30E9dr6.mjs → bridge-DQud78k4.mjs} +1 -1
  5. package/dist/bridge.js +1 -1
  6. package/dist/bridge.mjs +1 -1
  7. package/dist/core/mainEngine.d.ts +10 -2
  8. package/dist/core/mainThread/base.d.ts +5 -1
  9. package/dist/core/mainThread/subServiceThread.d.ts +2 -0
  10. package/dist/core/tools/image.d.ts +1 -0
  11. package/dist/core/utils/serviceImageRecovery.d.ts +9 -0
  12. package/dist/core/worker/base.d.ts +5 -1
  13. package/dist/core/worker/fullWorkerService.d.ts +3 -0
  14. package/dist/core/worker/simpleWorker.d.ts +2 -2
  15. package/dist/fullWorker.js +98 -98
  16. package/dist/{index-CatWUcZt.mjs → index-4ZI3GxVI.mjs} +1 -1
  17. package/dist/{index-DGdruTPt.js → index-AJCkfnUu.js} +1 -1
  18. package/dist/{index-rDe1jjPM.mjs → index-B8Ls8sf_.mjs} +1 -1
  19. package/dist/{index-CQuJ6lL1.mjs → index-BBtV40zU.mjs} +597 -493
  20. package/dist/{index-Ct5ShjRI.js → index-BOzOWS7h.js} +1 -1
  21. package/dist/index-BQiBrpib.js +1 -0
  22. package/dist/index-BYriQtGa.js +1 -0
  23. package/dist/{index-CrJWLjuD.mjs → index-C2tUvh2a.mjs} +12105 -12033
  24. package/dist/{index-C-pO2InQ.mjs → index-DSFxl2wM.mjs} +8068 -7982
  25. package/dist/index-DnJkIouU.js +570 -0
  26. package/dist/index-DptnZ-h8.js +570 -0
  27. package/dist/{index-DYDy0dd5.mjs → index-ZUpKkvbD.mjs} +597 -493
  28. package/dist/plugin/baseApplianceManager.d.ts +2 -2
  29. package/dist/subWorker.js +74 -74
  30. package/package.json +57 -56
  31. package/dist/index-B44Av4kp.js +0 -1
  32. package/dist/index-CKtpWZ9L.js +0 -1
  33. package/dist/index-DLzvL8jo.js +0 -570
  34. package/dist/index-LmgcnMI8.js +0 -570
@@ -1,8 +1,8 @@
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 ke = Object.defineProperty;
2
+ var Se = (D, e, t) => e in D ? ke(D, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : D[e] = t;
3
+ var u = (D, e, t) => Se(D, typeof e != "symbol" ? e + "" : e, t);
4
+ import { D as Y, e as b, c as m, r as K, b as R, g as J, t as H, a as h, f as fe, M as Ie, h as P, i as ee, j as ge, C as j, k as _, l as Te, m as ie, n as We, o as oe, p as Re, q as Ee, s as ae, u as ne, v as Z, w as Q, E as N, x as se, y as X, z as be, A as me, B as ye, F as Le, G as Ce, H as Ne, I as Be, T as ce, J as he, K as Oe, L as De, N as we, P as ve, Q as le, R as Me, S as de, U as $, W as Pe, V as pe, X as Ae } from "./index-DSFxl2wM.mjs";
5
+ import { cloneDeep as te, xor as Fe, isNumber as z, isEqual as ue } from "lodash";
6
6
  import "clipper-lib";
7
7
  import "lineclip";
8
8
  import "rbush";
@@ -10,7 +10,43 @@ import "xss";
10
10
  import "white-web-sdk";
11
11
  import "react-dom";
12
12
  import "react";
13
- class Pe {
13
+ class Ue {
14
+ constructor() {
15
+ u(this, "jobs", /* @__PURE__ */ new Map());
16
+ }
17
+ request(e, t, s, r, i) {
18
+ const o = this.jobs.get(e);
19
+ if ((o == null ? void 0 : o.src) === t) return;
20
+ this.cancel(e);
21
+ const a = { src: t };
22
+ this.jobs.set(e, a), (async () => {
23
+ if (this.jobs.get(e) !== a) return;
24
+ if (!r()) {
25
+ this.cancel(e);
26
+ return;
27
+ }
28
+ let c;
29
+ try {
30
+ c = await s();
31
+ } catch {
32
+ }
33
+ if (this.jobs.get(e) === a) {
34
+ if (!r()) {
35
+ this.cancel(e);
36
+ return;
37
+ }
38
+ c && (this.jobs.delete(e), i(c));
39
+ }
40
+ })();
41
+ }
42
+ cancel(e) {
43
+ this.jobs.delete(e);
44
+ }
45
+ clear() {
46
+ for (const e of this.jobs.keys()) this.cancel(e);
47
+ }
48
+ }
49
+ class xe {
14
50
  constructor(e) {
15
51
  u(this, "vNodes");
16
52
  u(this, "thread");
@@ -18,7 +54,7 @@ class Pe {
18
54
  u(this, "localWorkShapes", /* @__PURE__ */ new Map());
19
55
  u(this, "tmpOpt");
20
56
  u(this, "animationId");
21
- u(this, "syncUnitTime", K.syncOpt.interval);
57
+ u(this, "syncUnitTime", Y.syncOpt.interval);
22
58
  this.vNodes = e.vNodes, this.thread = e.thread;
23
59
  }
24
60
  createLocalWork(e) {
@@ -56,7 +92,7 @@ class Pe {
56
92
  clearAll() {
57
93
  this.thread.topLayer.children.length && (this.thread.topLayer.parent.children.forEach((e) => {
58
94
  e.name !== "viewport" && e.remove();
59
- }), $(
95
+ }), K(
60
96
  this.thread.serviceLayer,
61
97
  this.thread.serviceLayer.parent
62
98
  )), this.serviceWorkShapes.clear(), this.localWorkShapes.clear();
@@ -88,7 +124,7 @@ class Pe {
88
124
  createWorkShapeNode(e) {
89
125
  const { toolsType: t } = e;
90
126
  if (t === m.LaserPen)
91
- return Z({
127
+ return J({
92
128
  ...e,
93
129
  vNodes: this.vNodes,
94
130
  fullLayer: this.thread.topLayer,
@@ -121,7 +157,7 @@ class Pe {
121
157
  r && s && (w = this.setNodeKey(c, w, r, s)), this.serviceWorkShapes.set(c, w);
122
158
  }
123
159
  const l = this.serviceWorkShapes.get(c);
124
- i && (l.type = i), a && (l.animationWorkData = V(a), l.ops = a), o && (l.updateNodeOpt = o), n && (l.animationWorkData = n), l.node && l.node.getWorkId() !== c && l.node.setWorkId(c), d && (l.oldRect = d), r && s && (l.toolsType !== r && r && s && this.setNodeKey(c, l, r, s), l.node && l.node.setWorkOptions(s));
160
+ i && (l.type = i), a && (l.animationWorkData = H(a), l.ops = a), o && (l.updateNodeOpt = o), n && (l.animationWorkData = n), l.node && l.node.getWorkId() !== c && l.node.setWorkId(c), d && (l.oldRect = d), r && s && (l.toolsType !== r && r && s && this.setNodeKey(c, l, r, s), l.node && l.node.setWorkOptions(s));
125
161
  }
126
162
  computNextAnimationIndex(e, t) {
127
163
  var i;
@@ -185,7 +221,7 @@ class Pe {
185
221
  e && this.runAnimation(), t.size && t.forEach((n, c) => {
186
222
  s.push({
187
223
  type: h.Cursor,
188
- uid: c.split(de)[0],
224
+ uid: c.split(fe)[0],
189
225
  op: n.op,
190
226
  workState: n.workState,
191
227
  viewId: this.thread.viewId
@@ -224,7 +260,7 @@ class Pe {
224
260
  this.runAnimation();
225
261
  }
226
262
  }
227
- class Ae {
263
+ class Ge {
228
264
  constructor(e) {
229
265
  u(this, "vNodes");
230
266
  u(this, "thread");
@@ -233,12 +269,12 @@ class Ae {
233
269
  u(this, "batchEraserRemoveNodes", /* @__PURE__ */ new Set());
234
270
  u(this, "batchEraserWorks", /* @__PURE__ */ new Set());
235
271
  u(this, "tmpOpt");
236
- u(this, "syncUnitTime", K.syncOpt.interval);
272
+ u(this, "syncUnitTime", Y.syncOpt.interval);
237
273
  u(this, "fullWorkerDrawCount", 0);
238
274
  u(this, "drawWorkActiveId");
239
275
  u(this, "consumeCount", 0);
240
276
  u(this, "combineDrawActiveId");
241
- u(this, "eraserBatchScheduler", new ve());
277
+ u(this, "eraserBatchScheduler", new Ie());
242
278
  u(this, "disposeVNodeRevisionObserver");
243
279
  u(this, "bitmapEraserRenderQueue", Promise.resolve());
244
280
  u(this, "bitmapEraserRevalidationQueued", !1);
@@ -285,25 +321,25 @@ class Ae {
285
321
  async updateSelector(e) {
286
322
  var f;
287
323
  const t = this.workShapes.get(
288
- D
324
+ P
289
325
  );
290
326
  if (!((f = t == null ? void 0 : t.selectIds) != null && f.length)) return;
291
327
  const { callback: s, ...r } = e, { updateSelectorOpt: i, willSerializeData: o, smoothSync: a } = r, n = await (t == null ? void 0 : t.updateSelector({
292
328
  updateSelectorOpt: i,
293
- selectIds: J(t.selectIds),
329
+ selectIds: te(t.selectIds),
294
330
  vNodes: this.vNodes,
295
331
  willSerializeData: o,
296
332
  worker: this
297
333
  })), c = /* @__PURE__ */ new Map();
298
334
  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;
335
+ n != null && n.selectIds && (d = Fe(t.selectIds, n.selectIds), n.selectIds.forEach((w) => {
336
+ const k = this.vNodes.get(w);
337
+ if (k) {
338
+ const { toolsType: I, op: E, opt: g } = k;
303
339
  c.set(w, {
304
340
  opt: g,
305
341
  toolsType: I,
306
- ops: (W == null ? void 0 : W.length) && j(W) || void 0
342
+ ops: (E == null ? void 0 : E.length) && ee(E) || void 0
307
343
  });
308
344
  }
309
345
  }), t.selectIds = n.selectIds);
@@ -328,11 +364,11 @@ class Ae {
328
364
  clearAll() {
329
365
  if (this.eraserBatchScheduler.cancel(), this.thread.localLayer.children.length && (this.thread.topLayer.parent.children.forEach((t) => {
330
366
  t.name !== "viewport" && t.remove();
331
- }), $(
367
+ }), K(
332
368
  this.thread.localLayer,
333
369
  this.thread.localLayer.parent
334
370
  )), this.workShapes.get(
335
- D
371
+ P
336
372
  )) {
337
373
  const t = [];
338
374
  t.push({
@@ -350,7 +386,7 @@ class Ae {
350
386
  let i;
351
387
  for (const o of this.vNodes.curNodeMap.values()) {
352
388
  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) {
389
+ if (c === m.Text && ge([l, p], a) && d.workState === b.Done) {
354
390
  i = n;
355
391
  break;
356
392
  }
@@ -373,7 +409,7 @@ class Ae {
373
409
  }
374
410
  cursorHover(e) {
375
411
  const { opt: t, toolsType: s, point: r } = e, i = this.setFullWork({
376
- workId: H,
412
+ workId: j,
377
413
  toolsType: s,
378
414
  opt: t
379
415
  });
@@ -381,15 +417,15 @@ class Ae {
381
417
  }
382
418
  cursorBlur() {
383
419
  var t;
384
- const e = this.getWorkShape(H);
385
- e && ((t = e.selectIds) != null && t.length) && (e.cursorBlur(), this.clearWorkShapeNodeCache(H)), this.thread.fullLayer.parent.children.forEach((s) => {
420
+ const e = this.getWorkShape(j);
421
+ e && ((t = e.selectIds) != null && t.length) && (e.cursorBlur(), this.clearWorkShapeNodeCache(j)), this.thread.fullLayer.parent.children.forEach((s) => {
386
422
  s.name === "Cursor_Hover_Id" && s.remove();
387
423
  });
388
424
  }
389
425
  async updateFullSelectWork(e) {
390
426
  var r, i, o, a, n;
391
427
  const t = this.workShapes.get(
392
- D
428
+ P
393
429
  ), { selectIds: s } = e;
394
430
  if (!(s != null && s.length)) {
395
431
  await this.blurSelector(e);
@@ -397,7 +433,7 @@ class Ae {
397
433
  }
398
434
  if (!t) {
399
435
  this.setFullWork({
400
- workId: D,
436
+ workId: P,
401
437
  toolsType: m.Selector,
402
438
  opt: e.opt || (((r = this.tmpOpt) == null ? void 0 : r.toolsType) === m.Selector ? this.tmpOpt.toolsOpt : {})
403
439
  }) && await this.updateFullSelectWork(e);
@@ -435,7 +471,7 @@ class Ae {
435
471
  }
436
472
  async removeSelector(e) {
437
473
  const { willSyncService: t, needUndoTicker: s } = e, r = [], i = [], o = this.workShapes.get(
438
- D
474
+ P
439
475
  );
440
476
  if (!o)
441
477
  return;
@@ -498,9 +534,9 @@ class Ae {
498
534
  }
499
535
  ]
500
536
  }), (r = this.thread.fullLayer) == null || r.getElementsByName(e).forEach((i) => {
501
- i.remove(), z(i, this.thread.fullLayer.parent);
537
+ i.remove(), _(i, this.thread.fullLayer.parent);
502
538
  }), this.vNodes.delete(e)), this.workShapes.has(e) && (this.thread.localLayer.getElementsByName(e).forEach((i) => {
503
- i.remove(), z(i, this.thread.localLayer.parent);
539
+ i.remove(), _(i, this.thread.localLayer.parent);
504
540
  }), this.clearWorkShapeNodeCache(e));
505
541
  }
506
542
  setFullWork(e) {
@@ -523,24 +559,24 @@ class Ae {
523
559
  var o, a;
524
560
  const t = (o = e.workId) == null ? void 0 : o.toString(), s = (a = e.updateNodeOpt) == null ? void 0 : a.eraserGeometryDelta;
525
561
  if (t) {
526
- const n = this.vNodes.get(t), c = e.ops && V(e.ops) || e.op || [];
562
+ const n = this.vNodes.get(t), c = e.ops && H(e.ops) || e.op || [];
527
563
  if (s) {
528
- if (!n || !e.centerPos || !Se(
564
+ if (!n || !e.centerPos || !Te(
529
565
  this.vNodes,
530
566
  t,
531
567
  s,
532
568
  n,
533
569
  { op: c, centerPos: e.centerPos }
534
570
  )) {
535
- te(this.vNodes, t);
571
+ ie(this.vNodes, t);
536
572
  return;
537
573
  }
538
- } else n && e.centerPos && Ie(this.vNodes, t) && se(n.op, n.centerPos) !== se(c, e.centerPos) && te(this.vNodes, t);
574
+ } else n && e.centerPos && We(this.vNodes, t) && oe(n.op, n.centerPos) !== oe(c, e.centerPos) && ie(this.vNodes, t);
539
575
  }
540
- const r = this.setFullWork(e), i = e.ops && V(e.ops);
576
+ const r = this.setFullWork(e), i = e.ops && H(e.ops);
541
577
  if (r) {
542
578
  t && e.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(t).forEach((c) => {
543
- c.remove(), z(c, this.thread.localLayer.parent);
579
+ c.remove(), _(c, this.thread.localLayer.parent);
544
580
  }), r.toolsType === m.BackgroundSVG ? r.consumeService({
545
581
  isFullWork: !0,
546
582
  replaceId: t
@@ -585,7 +621,7 @@ class Ae {
585
621
  }
586
622
  async colloctEffectSelectWork(e) {
587
623
  const t = this.workShapes.get(
588
- D
624
+ P
589
625
  ), { workId: s, msgType: r } = e;
590
626
  if (t && s && t.selectIds && t.selectIds.includes(s.toString())) {
591
627
  r === h.RemoveNode ? t.selectIds = t.selectIds.filter(
@@ -619,7 +655,7 @@ class Ae {
619
655
  boxRect: this.thread.getSceneRect()
620
656
  });
621
657
  else {
622
- const o = s.ops && V(s.ops);
658
+ const o = s.ops && H(s.ops);
623
659
  r.consumeService({
624
660
  op: o,
625
661
  isFullWork: !0,
@@ -633,15 +669,15 @@ class Ae {
633
669
  this.reRenderSelector(e);
634
670
  }
635
671
  hasSelector() {
636
- return this.workShapes.has(D);
672
+ return this.workShapes.has(P);
637
673
  }
638
674
  getSelector() {
639
- return this.workShapes.get(D);
675
+ return this.workShapes.get(P);
640
676
  }
641
677
  reRenderSelector(e = !1) {
642
678
  var r;
643
679
  const t = this.workShapes.get(
644
- D
680
+ P
645
681
  );
646
682
  if (!t) return;
647
683
  if (t && !((r = t.selectIds) != null && r.length))
@@ -678,10 +714,10 @@ class Ae {
678
714
  async blurSelector(e) {
679
715
  var r;
680
716
  const t = this.workShapes.get(
681
- D
717
+ P
682
718
  ), s = t == null ? void 0 : t.blurSelector();
683
- if (this.clearWorkShapeNodeCache(D), ((r = this.thread.fullLayer) == null ? void 0 : r.parent).children.forEach((i) => {
684
- i.name === D && i.remove();
719
+ if (this.clearWorkShapeNodeCache(P), ((r = this.thread.fullLayer) == null ? void 0 : r.parent).children.forEach((i) => {
720
+ i.name === P && i.remove();
685
721
  }), s) {
686
722
  const i = [];
687
723
  i.push({
@@ -796,7 +832,7 @@ class Ae {
796
832
  type: h.FullWork,
797
833
  dataType: R.Local,
798
834
  toolsType: l.toolsType,
799
- ops: j(l.op),
835
+ ops: ee(l.op),
800
836
  opt: l.opt,
801
837
  workId: d,
802
838
  updateNodeOpt: {
@@ -866,7 +902,7 @@ class Ae {
866
902
  dataType: R.Local
867
903
  },
868
904
  t
869
- ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && n !== D && (this.drawWorkActiveId = n), G(o) && (this.consumeCount = o), d) {
905
+ ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && n !== P && (this.drawWorkActiveId = n), z(o) && (this.consumeCount = o), d) {
870
906
  case m.Selector: {
871
907
  const l = c.consume({
872
908
  data: e,
@@ -897,7 +933,7 @@ class Ae {
897
933
  e.needUndoTicker,
898
934
  e.collectUndoTicker
899
935
  );
900
- }, ge(this.thread.master.maxCombineEraserTime));
936
+ }, Re(this.thread.master.maxCombineEraserTime));
901
937
  break;
902
938
  }
903
939
  case m.BitMapEraser: {
@@ -976,48 +1012,48 @@ class Ae {
976
1012
  if (i || r) {
977
1013
  const p = i == null ? void 0 : i.willDeleteNodes, f = i == null ? void 0 : i.willNewNodes, w = [
978
1014
  ...p ? Array.from(p) : []
979
- ], S = {
1015
+ ], k = {
980
1016
  render: [],
981
1017
  sp: [],
982
1018
  ...r
983
1019
  };
984
1020
  if (i != null && i.rect) {
985
- const I = Te(i.rect);
986
- (a = S.render) == null || a.push(
1021
+ const I = Ee(i.rect);
1022
+ (a = k.render) == null || a.push(
987
1023
  {
988
1024
  rect: I,
989
1025
  isClear: !0,
990
- clearCanvas: re.Bg,
1026
+ clearCanvas: ae.Bg,
991
1027
  viewId: this.thread.viewId,
992
1028
  eraseTxnId: e
993
1029
  },
994
1030
  {
995
1031
  rect: I,
996
- drawCanvas: re.Bg,
1032
+ drawCanvas: ae.Bg,
997
1033
  viewId: this.thread.viewId,
998
1034
  eraseTxnId: e
999
1035
  }
1000
1036
  );
1001
1037
  }
1002
- if (s && w.length && ((n = this.getWorkShape(e)) == null ? void 0 : n.toolsType) === m.BitMapEraser && ((c = S.sp) == null || c.push({
1038
+ if (s && w.length && ((n = this.getWorkShape(e)) == null ? void 0 : n.toolsType) === m.BitMapEraser && ((c = k.sp) == null || c.push({
1003
1039
  type: h.None,
1004
1040
  collectUndoTicker: s,
1005
1041
  undoScopeIds: w,
1006
1042
  undoScopePhase: "collect"
1007
- })), p != null && p.size && ((d = S.sp) == null || d.push({
1043
+ })), p != null && p.size && ((d = k.sp) == null || d.push({
1008
1044
  type: h.RemoveNode,
1009
1045
  removeIds: [...p],
1010
1046
  viewId: this.thread.viewId,
1011
1047
  needUndoTicker: t,
1012
1048
  collectUndoTicker: s
1013
1049
  })), f != null && f.size)
1014
- for (const [I, W] of f)
1015
- (l = S.sp) == null || l.push({
1050
+ for (const [I, E] of f)
1051
+ (l = k.sp) == null || l.push({
1016
1052
  type: h.FullWork,
1017
1053
  dataType: R.Local,
1018
- toolsType: W.toolsType,
1019
- ops: j(W.op),
1020
- opt: W.opt,
1054
+ toolsType: E.toolsType,
1055
+ ops: ee(E.op),
1056
+ opt: E.opt,
1021
1057
  workId: I,
1022
1058
  updateNodeOpt: {
1023
1059
  useAnimation: !1
@@ -1025,7 +1061,7 @@ class Ae {
1025
1061
  needUndoTicker: t,
1026
1062
  collectUndoTicker: s
1027
1063
  });
1028
- i != null && i.rect && await this.thread.fullLayer.parent.prepareRender, this.thread.post(S);
1064
+ i != null && i.rect && await this.thread.fullLayer.parent.prepareRender, this.thread.post(k);
1029
1065
  }
1030
1066
  }
1031
1067
  async consumeDrawAll(e, t) {
@@ -1043,23 +1079,23 @@ class Ae {
1043
1079
  if (p === m.LaserPen)
1044
1080
  return;
1045
1081
  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 });
1082
+ const f = this.workShapes.get(j), w = (a = f == null ? void 0 : f.selectIds) == null ? void 0 : a[0], k = await l.consumeAll({ data: e, workerEngine: this });
1047
1083
  switch (p) {
1048
1084
  case m.Selector:
1049
1085
  {
1050
- S.selectIds && w && ((n = S.selectIds) != null && n.includes(w)) && f.cursorBlur();
1086
+ k.selectIds && w && ((n = k.selectIds) != null && n.includes(w)) && f.cursorBlur();
1051
1087
  const I = [];
1052
1088
  i && I.push({
1053
1089
  type: h.None,
1054
1090
  isLockSentEventCursor: i,
1055
1091
  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);
1092
+ }), 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
1093
  }
1058
1094
  break;
1059
1095
  case m.PencilEraser:
1060
1096
  await this.drawPencilEraserFull(
1061
1097
  l,
1062
- S,
1098
+ k,
1063
1099
  i,
1064
1100
  o
1065
1101
  ), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(d);
@@ -1067,14 +1103,14 @@ class Ae {
1067
1103
  case m.BitMapEraser:
1068
1104
  await this.drawBitMapEraserFull(
1069
1105
  l,
1070
- S,
1106
+ k,
1071
1107
  i,
1072
1108
  o
1073
1109
  ), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(d);
1074
1110
  break;
1075
1111
  case m.Eraser:
1076
1112
  await this.drawEraser(
1077
- { ...S, scenePath: r },
1113
+ { ...k, scenePath: r },
1078
1114
  i,
1079
1115
  o,
1080
1116
  e.collectUndoTicker
@@ -1093,17 +1129,17 @@ class Ae {
1093
1129
  type: h.None,
1094
1130
  isLockSentEventCursor: i,
1095
1131
  scenePath: r
1096
- }), S) {
1097
- const g = p === m.Pencil && S.type === h.RemoveNode;
1098
- g ? $(
1132
+ }), k) {
1133
+ const g = p === m.Pencil && k.type === h.RemoveNode;
1134
+ g ? K(
1099
1135
  this.thread.localLayer,
1100
1136
  this.thread.localLayer.parent
1101
1137
  ) : I.push({
1102
- ...S,
1138
+ ...k,
1103
1139
  scenePath: r,
1104
1140
  needUndoTicker: e.needUndoTicker,
1105
- undoScopeIds: S.undoScopeIds || (S.workId !== void 0 ? [S.workId.toString()] : void 0),
1106
- undoScopePhase: S.undoScopePhase || "finalize"
1141
+ undoScopeIds: k.undoScopeIds || (k.workId !== void 0 ? [k.workId.toString()] : void 0),
1142
+ undoScopePhase: k.undoScopePhase || "finalize"
1107
1143
  }), this.fullWorkerDrawCount = 0, e.needUndoTicker && I.push({
1108
1144
  type: h.None,
1109
1145
  needUndoTicker: e.needUndoTicker,
@@ -1131,7 +1167,7 @@ class Ae {
1131
1167
  if ((t = this.tmpOpt) != null && t.toolsType && this.tmpOpt.toolsType !== e.toolsType) {
1132
1168
  this.eraserBatchScheduler.cancel();
1133
1169
  for (const [r, i] of this.workShapes)
1134
- r !== D && (i.clearTmpPoints(), this.workShapes.delete(r));
1170
+ r !== P && (i.clearTmpPoints(), this.workShapes.delete(r));
1135
1171
  }
1136
1172
  this.tmpOpt = e, (s = e.toolsOpt) != null && s.syncUnitTime && (this.syncUnitTime = e.toolsOpt.syncUnitTime);
1137
1173
  }
@@ -1144,7 +1180,7 @@ class Ae {
1144
1180
  t.syncUnitTime || (t.syncUnitTime = this.syncUnitTime), s == null || s.setWorkOptions(t);
1145
1181
  }
1146
1182
  createWorkShapeNode(e) {
1147
- return Z(
1183
+ return J(
1148
1184
  {
1149
1185
  ...e,
1150
1186
  vNodes: this.vNodes,
@@ -1155,22 +1191,24 @@ class Ae {
1155
1191
  );
1156
1192
  }
1157
1193
  }
1158
- class Fe {
1194
+ class qe {
1159
1195
  constructor(e) {
1160
1196
  u(this, "vNodes");
1161
1197
  u(this, "thread");
1162
1198
  u(this, "workShapes", /* @__PURE__ */ new Map());
1163
1199
  u(this, "selectorWorkShapes", /* @__PURE__ */ new Map());
1164
1200
  u(this, "willRunEffectSelectorIds", /* @__PURE__ */ new Set());
1165
- u(this, "syncUnitTime", K.syncOpt.interval);
1201
+ u(this, "syncUnitTime", Y.syncOpt.interval);
1166
1202
  u(this, "animationScheduler");
1167
1203
  u(this, "effectScheduler");
1168
- this.vNodes = e.vNodes, this.thread = e.thread, this.animationScheduler = new ie({
1204
+ u(this, "imageRecovery", new Ue());
1205
+ u(this, "readyImages", /* @__PURE__ */ new Map());
1206
+ this.vNodes = e.vNodes, this.thread = e.thread, this.animationScheduler = new ne({
1169
1207
  run: async () => {
1170
1208
  try {
1171
1209
  await this.animationDraw();
1172
1210
  } catch (t) {
1173
- throw Y(t, {
1211
+ throw Z(t, {
1174
1212
  business: "service-render",
1175
1213
  stage: "animation-draw"
1176
1214
  });
@@ -1182,12 +1220,12 @@ class Fe {
1182
1220
  business: "service-render",
1183
1221
  stage: "animation-draw"
1184
1222
  })
1185
- }), this.effectScheduler = new ie({
1223
+ }), this.effectScheduler = new ne({
1186
1224
  run: async () => {
1187
1225
  try {
1188
1226
  await this.effectRunSelector();
1189
1227
  } catch (t) {
1190
- throw Y(t, {
1228
+ throw Z(t, {
1191
1229
  business: "service-render",
1192
1230
  stage: "selector-effect"
1193
1231
  });
@@ -1208,9 +1246,9 @@ class Fe {
1208
1246
  this.animationScheduler.destroy(), this.effectScheduler.destroy(), this.clearAll();
1209
1247
  }
1210
1248
  clearAll() {
1211
- this.thread.serviceLayer.children.length && (this.thread.serviceLayer.parent.children.forEach((e) => {
1249
+ this.imageRecovery.clear(), this.readyImages.clear(), this.thread.serviceLayer.children.length && (this.thread.serviceLayer.parent.children.forEach((e) => {
1212
1250
  e.name !== "viewport" && e.remove();
1213
- }), $(
1251
+ }), K(
1214
1252
  this.thread.serviceLayer,
1215
1253
  this.thread.serviceLayer.parent
1216
1254
  )), this.workShapes.clear(), this.selectorWorkShapes.clear(), this.willRunEffectSelectorIds.clear();
@@ -1237,7 +1275,7 @@ class Fe {
1237
1275
  removeWork(e) {
1238
1276
  const { workId: t } = e, s = t == null ? void 0 : t.toString();
1239
1277
  if (s) {
1240
- if (this.workShapes.get(s)) {
1278
+ if (this.imageRecovery.cancel(s), this.readyImages.delete(s), this.workShapes.get(s)) {
1241
1279
  this.workShapes.delete(s), this.removeNode(s, e);
1242
1280
  return;
1243
1281
  }
@@ -1275,45 +1313,75 @@ class Fe {
1275
1313
  );
1276
1314
  }
1277
1315
  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;
1316
+ var r, i, o, a, n, c, d, l, p, f, w, k, I, E, g, y, S, T, C, L, O, A;
1279
1317
  let e = !1;
1280
1318
  const t = /* @__PURE__ */ new Map(), s = [];
1281
- for (const [E, k] of this.workShapes.entries())
1282
- switch (k.toolsType) {
1319
+ for (const [W, v] of this.workShapes.entries())
1320
+ switch (v.toolsType) {
1283
1321
  case m.BackgroundSVG: {
1284
- (r = k.node) == null || r.consumeService({
1322
+ (r = v.node) == null || r.consumeService({
1285
1323
  isFullWork: !0,
1286
- replaceId: E
1287
- }), this.selectorWorkShapes.forEach((B, O) => {
1288
- var P;
1289
- (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1290
- }), this.workShapes.delete(E);
1324
+ replaceId: W
1325
+ }), this.selectorWorkShapes.forEach((B, F) => {
1326
+ var M;
1327
+ (M = B.selectIds) != null && M.includes(W) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1328
+ }), this.workShapes.delete(W);
1291
1329
  break;
1292
1330
  }
1293
1331
  case m.Image: {
1294
- await ((i = k.node) == null ? void 0 : i.consumeServiceAsync({
1332
+ const B = (i = v.node) == null ? void 0 : i.getWorkOptions(), M = (B == null ? void 0 : B.src) && this.thread.getImageSourceKey(B), U = this.readyImages.get(W);
1333
+ this.readyImages.delete(W);
1334
+ const x = U && U.src === M && U.image || M && this.thread.getCachedImages(M) || null;
1335
+ await ((o = v.node) == null ? void 0 : o.consumeServiceAsync({
1295
1336
  isFullWork: !0,
1296
- worker: this
1297
- })), this.selectorWorkShapes.forEach((B, O) => {
1298
- var P;
1299
- (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1300
- }), this.workShapes.delete(E);
1337
+ worker: this,
1338
+ imageSourceOverride: x
1339
+ })), M && !x ? this.imageRecovery.request(
1340
+ W,
1341
+ M,
1342
+ () => this.thread.loadImageBitMap({
1343
+ toolsType: m.Image,
1344
+ opt: B,
1345
+ workId: W,
1346
+ timeoutMs: 15e3
1347
+ }),
1348
+ () => {
1349
+ const G = this.vNodes.get(W), V = this.workShapes.get(W);
1350
+ return (G == null ? void 0 : G.toolsType) === m.Image && this.thread.getImageSourceKey(G.opt) === M && (!V || !!V.node && this.thread.getImageSourceKey(
1351
+ V.node.getWorkOptions()
1352
+ ) === M);
1353
+ },
1354
+ (G) => {
1355
+ const V = this.vNodes.get(W);
1356
+ V && (this.readyImages.set(W, { src: M, image: G }), this.consumeFull({
1357
+ msgType: h.FullWork,
1358
+ dataType: R.Service,
1359
+ viewId: this.thread.viewId,
1360
+ workId: W,
1361
+ toolsType: m.Image,
1362
+ opt: V.opt
1363
+ }));
1364
+ }
1365
+ ) : this.imageRecovery.cancel(W), this.selectorWorkShapes.forEach((G, V) => {
1366
+ var re;
1367
+ (re = G.selectIds) != null && re.includes(W) && (this.willRunEffectSelectorIds.add(V), this.runEffect());
1368
+ }), this.workShapes.delete(W);
1301
1369
  break;
1302
1370
  }
1303
1371
  case m.Text: {
1304
- k.node && (await ((o = k.node) == null ? void 0 : o.consumeServiceAsync({
1372
+ v.node && (await ((a = v.node) == null ? void 0 : a.consumeServiceAsync({
1305
1373
  isFullWork: !0,
1306
- replaceId: E,
1374
+ replaceId: W,
1307
1375
  boxRect: this.thread.getSceneRect()
1308
- })), this.selectorWorkShapes.forEach((B, O) => {
1309
- var P;
1310
- (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1311
- }), k.refreshTextRender && k.requestId && s.push({
1376
+ })), this.selectorWorkShapes.forEach((B, F) => {
1377
+ var M;
1378
+ (M = B.selectIds) != null && M.includes(W) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1379
+ }), v.refreshTextRender && v.requestId && s.push({
1312
1380
  type: h.RefreshTextRender,
1313
- requestId: k.requestId,
1314
- workId: E,
1381
+ requestId: v.requestId,
1382
+ workId: W,
1315
1383
  viewId: this.thread.viewId
1316
- }), (a = k.node) == null || a.clearTmpPoints(), this.workShapes.delete(E));
1384
+ }), (n = v.node) == null || n.clearTmpPoints(), this.workShapes.delete(W));
1317
1385
  break;
1318
1386
  }
1319
1387
  case m.Arrow:
@@ -1323,98 +1391,98 @@ class Fe {
1323
1391
  case m.Star:
1324
1392
  case m.Polygon:
1325
1393
  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,
1394
+ const B = !!v.ops;
1395
+ if ((c = v.animationWorkData) != null && c.length) {
1396
+ const F = v.oldRect;
1397
+ (d = v.node) == null || d.consumeService({
1398
+ op: v.animationWorkData,
1331
1399
  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),
1400
+ }), B && (this.selectorWorkShapes.forEach((M, U) => {
1401
+ var x;
1402
+ (x = M.selectIds) != null && x.includes(W) && (this.willRunEffectSelectorIds.add(U), this.runEffect());
1403
+ }), (l = v.node) == null || l.clearTmpPoints(), this.workShapes.delete(W)), v.isEnableCursor ? t.set(W, {
1404
+ cursorTool: Q(v.toolsType),
1405
+ workState: F ? v.ops ? b.Done : b.Doing : b.Start,
1406
+ op: v.animationWorkData.slice(-3, -1)
1407
+ }) : B && !v.useAnimation && ((p = v.updateNodeOpt) != null && p.useAnimation) && t.set(W, {
1408
+ cursorTool: Q(v.toolsType),
1341
1409
  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;
1410
+ op: v.animationWorkData.slice(-3, -1),
1411
+ uid: (f = v.updateNodeOpt) == null ? void 0 : f.uid
1412
+ }), v.animationWorkData.length = 0;
1345
1413
  }
1346
1414
  break;
1347
1415
  }
1348
1416
  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);
1417
+ if (v.useAnimation) {
1418
+ if (v.useAnimation) {
1419
+ if (v.isDel) {
1420
+ (S = v.node) == null || S.clearTmpPoints(), this.workShapes.delete(W);
1353
1421
  break;
1354
1422
  }
1355
- const B = 3, O = this.computNextAnimationIndex(
1356
- k,
1423
+ const B = 3, F = this.computNextAnimationIndex(
1424
+ v,
1357
1425
  B
1358
- ), P = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - B), F = (k.animationWorkData || []).slice(
1359
- P,
1360
- 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({
1364
- op: F,
1426
+ ), M = v.isDiff ? 0 : Math.max(0, (v.animationIndex || 0) - B), U = (v.animationWorkData || []).slice(
1427
+ M,
1428
+ F
1429
+ ), x = (C = (T = v.node) == null ? void 0 : T.getWorkId()) == null ? void 0 : C.toString();
1430
+ if ((v.animationIndex || 0) < F || v.isDiff) {
1431
+ if ((L = v.node) == null || L.consumeService({
1432
+ op: U,
1365
1433
  isFullWork: !1
1366
- }), k.animationIndex = O, k.isDiff && (k.isDiff = !1), F.length && k.isEnableCursor) {
1367
- 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,
1371
- op: X
1434
+ }), v.animationIndex = F, v.isDiff && (v.isDiff = !1), U.length && v.isEnableCursor) {
1435
+ const G = U.slice(-3, -1);
1436
+ t.set(W, {
1437
+ cursorTool: Q(v.toolsType),
1438
+ workState: M === 0 ? b.Start : F === ((O = v.animationWorkData) == null ? void 0 : O.length) ? b.Done : b.Doing,
1439
+ op: G
1372
1440
  });
1373
1441
  }
1374
- } else k.ops && ((A = k.node) == null || A.consumeService({
1375
- op: k.animationWorkData || [],
1442
+ } else v.ops && ((A = v.node) == null || A.consumeService({
1443
+ op: v.animationWorkData || [],
1376
1444
  isFullWork: !0,
1377
- replaceId: U
1378
- }), k.isDel = !0, k.isEnableCursor && t.set(E, {
1379
- cursorTool: _(k.toolsType),
1445
+ replaceId: x
1446
+ }), v.isDel = !0, v.isEnableCursor && t.set(W, {
1447
+ cursorTool: Q(v.toolsType),
1380
1448
  workState: b.Done,
1381
- op: F.slice(-3, -1)
1449
+ op: U.slice(-3, -1)
1382
1450
  }));
1383
1451
  e = !0;
1384
1452
  break;
1385
1453
  }
1386
1454
  } else {
1387
- const B = !!k.ops;
1388
- if ((f = k.node) == null || f.consumeService({
1389
- op: k.animationWorkData || [],
1455
+ const B = !!v.ops;
1456
+ if ((w = v.node) == null || w.consumeService({
1457
+ op: v.animationWorkData || [],
1390
1458
  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),
1459
+ replaceId: W
1460
+ }), (k = v.node) == null || k.updataOptService(v.updateNodeOpt), B) {
1461
+ if (!v.isEnableCursor && ((I = v.updateNodeOpt) != null && I.useAnimation) && ((E = v.animationWorkData) != null && E.length)) {
1462
+ const F = v.animationWorkData.slice(-3, -1);
1463
+ t.set(W, {
1464
+ cursorTool: Q(v.toolsType),
1397
1465
  workState: b.Done,
1398
- op: O,
1399
- uid: (W = k.updateNodeOpt) == null ? void 0 : W.uid
1466
+ op: F,
1467
+ uid: (g = v.updateNodeOpt) == null ? void 0 : g.uid
1400
1468
  });
1401
1469
  }
1402
- this.selectorWorkShapes.forEach((O, P) => {
1403
- 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);
1470
+ this.selectorWorkShapes.forEach((F, M) => {
1471
+ var U;
1472
+ (U = F.selectIds) != null && U.includes(W) && (this.willRunEffectSelectorIds.add(M), this.runEffect());
1473
+ }), (y = v.node) == null || y.clearTmpPoints(), this.workShapes.delete(W);
1406
1474
  }
1407
1475
  }
1408
1476
  break;
1409
1477
  }
1410
1478
  }
1411
- e && this.runAnimation(), t.size && t.forEach((E, k) => {
1479
+ e && this.runAnimation(), t.size && t.forEach((W, v) => {
1412
1480
  s.push({
1413
1481
  type: h.Cursor,
1414
- uid: E.uid || k.split(de)[0],
1415
- op: E.op,
1416
- workState: E.workState,
1417
- cursorTool: E.cursorTool,
1482
+ uid: W.uid || v.split(fe)[0],
1483
+ op: W.op,
1484
+ workState: W.workState,
1485
+ cursorTool: W.cursorTool,
1418
1486
  viewId: this.thread.viewId
1419
1487
  });
1420
1488
  }), s.length && this.thread.post({ sp: s });
@@ -1446,7 +1514,7 @@ class Fe {
1446
1514
  return !1;
1447
1515
  }
1448
1516
  activeWorkShape(e) {
1449
- var W, g, y, v;
1517
+ var E, g, y, S;
1450
1518
  const {
1451
1519
  workId: t,
1452
1520
  opt: s,
@@ -1463,7 +1531,7 @@ class Fe {
1463
1531
  } = e;
1464
1532
  if (!t)
1465
1533
  return;
1466
- const w = t.toString(), S = (W = this.vNodes.get(w)) == null ? void 0 : W.rect;
1534
+ const w = t.toString(), k = (E = this.vNodes.get(w)) == null ? void 0 : E.rect;
1467
1535
  if (!((g = this.workShapes) != null && g.has(w))) {
1468
1536
  let T = {
1469
1537
  toolsType: r,
@@ -1473,25 +1541,25 @@ class Fe {
1473
1541
  updateNodeOpt: o,
1474
1542
  ops: a,
1475
1543
  useAnimation: typeof c < "u" ? c : typeof (o == null ? void 0 : o.useAnimation) < "u" ? o == null ? void 0 : o.useAnimation : !0,
1476
- oldRect: S,
1544
+ oldRect: k,
1477
1545
  isDiff: !1,
1478
1546
  imageBitmap: d,
1479
1547
  isEnableCursor: l
1480
1548
  };
1481
1549
  r && s && (T = this.setNodeKey(w, T, r, s)), (y = this.workShapes) == null || y.set(w, T);
1482
1550
  }
1483
- const I = (v = this.workShapes) == null ? void 0 : v.get(w);
1484
- 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(
1551
+ const I = (S = this.workShapes) == null ? void 0 : S.get(w);
1552
+ I.isEnableCursor = l, I.requestId = p, I.refreshTextRender = !!f, i && (I.type = i), a && (I.animationWorkData = H(a), I.ops = a), o && (I.updateNodeOpt = o), n && (I.isDiff = this.hasDiffData(
1485
1553
  I.animationWorkData || [],
1486
1554
  n,
1487
1555
  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);
1556
+ ), 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
1557
  }
1490
1558
  removeNode(e, t) {
1491
- e.indexOf(D) > -1 && this.removeSelectWork(t), this.thread.fullLayer.getElementsByName(e).forEach((r) => {
1492
- r.remove(), z(r, this.thread.fullLayer.parent);
1559
+ e.indexOf(P) > -1 && this.removeSelectWork(t), this.thread.fullLayer.getElementsByName(e).forEach((r) => {
1560
+ r.remove(), _(r, this.thread.fullLayer.parent);
1493
1561
  }), this.thread.serviceLayer.getElementsByName(e).forEach((r) => {
1494
- r.remove(), z(r, this.thread.serviceLayer.parent);
1562
+ r.remove(), _(r, this.thread.serviceLayer.parent);
1495
1563
  });
1496
1564
  const s = this.vNodes.get(e);
1497
1565
  s && s.toolsType === m.BackgroundSVG && this.thread.post({
@@ -1529,7 +1597,7 @@ class Fe {
1529
1597
  i && (n.type = i), n.node && n.node.getWorkId() !== a && n.node.setWorkId(a), n.selectIds = o || [];
1530
1598
  }
1531
1599
  setNodeKey(e, t, s, r) {
1532
- return t.toolsType = s, t.node = Z(
1600
+ return t.toolsType = s, t.node = J(
1533
1601
  {
1534
1602
  toolsType: s,
1535
1603
  toolsOpt: r,
@@ -1542,7 +1610,7 @@ class Fe {
1542
1610
  ), t;
1543
1611
  }
1544
1612
  }
1545
- class x {
1613
+ class q {
1546
1614
  constructor() {
1547
1615
  u(this, "localWork");
1548
1616
  u(this, "serviceWork");
@@ -1552,7 +1620,7 @@ class x {
1552
1620
  return this.threadEngine = e, this.localWork = e.localWork, this.serviceWork = e.serviceWork, this;
1553
1621
  }
1554
1622
  }
1555
- class Ue extends x {
1623
+ class ze extends q {
1556
1624
  constructor() {
1557
1625
  super(...arguments);
1558
1626
  u(this, "emitEventType", N.CopyNode);
@@ -1568,7 +1636,7 @@ class Ue extends x {
1568
1636
  s && await ((r = this.localWork) == null ? void 0 : r.consumeFull(t));
1569
1637
  }
1570
1638
  }
1571
- class xe extends x {
1639
+ class Ve extends q {
1572
1640
  constructor() {
1573
1641
  super(...arguments);
1574
1642
  u(this, "emitEventType", N.SetColorNode);
@@ -1590,7 +1658,7 @@ class xe extends x {
1590
1658
  needUndoTicker: c,
1591
1659
  requestId: d
1592
1660
  } = t;
1593
- s === D && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1661
+ s === P && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1594
1662
  updateSelectorOpt: r,
1595
1663
  willRefreshSelector: i,
1596
1664
  willSyncService: o,
@@ -1642,7 +1710,7 @@ class xe extends x {
1642
1710
  };
1643
1711
  }
1644
1712
  }
1645
- class Ge extends x {
1713
+ class $e extends q {
1646
1714
  constructor() {
1647
1715
  super(...arguments);
1648
1716
  u(this, "emitEventType", N.ZIndexNode);
@@ -1663,7 +1731,7 @@ class Ge extends x {
1663
1731
  needUndoTicker: n,
1664
1732
  requestId: c
1665
1733
  } = t;
1666
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1734
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1667
1735
  updateSelectorOpt: r,
1668
1736
  willRefreshSelector: i,
1669
1737
  willSyncService: o,
@@ -1715,19 +1783,19 @@ class Ge extends x {
1715
1783
  };
1716
1784
  }
1717
1785
  }
1718
- class qe extends x {
1786
+ class _e extends q {
1719
1787
  constructor() {
1720
1788
  super(...arguments);
1721
1789
  u(this, "emitEventType", N.TranslateNode);
1722
1790
  u(this, "updateSelectorCallback", (t) => {
1723
- var W;
1791
+ var E;
1724
1792
  const { param: s, postData: r, newServiceStore: i, workShapeNode: o, res: a, smoothSync: n } = t, {
1725
1793
  willSyncService: c,
1726
1794
  isSync: d,
1727
1795
  updateSelectorOpt: l,
1728
1796
  textUpdateForWoker: p,
1729
1797
  needUndoTicker: f
1730
- } = s, w = l.workState, S = r.sp || [];
1798
+ } = s, w = l.workState, k = r.sp || [];
1731
1799
  if (w === b.Start)
1732
1800
  return {
1733
1801
  sp: [
@@ -1742,7 +1810,7 @@ class qe extends x {
1742
1810
  const I = a == null ? void 0 : a.selectRect;
1743
1811
  if (c) {
1744
1812
  const g = w === b.Done ? f : void 0;
1745
- S.push({
1813
+ k.push({
1746
1814
  type: h.Select,
1747
1815
  selectIds: o.selectIds,
1748
1816
  selectRect: I,
@@ -1758,34 +1826,34 @@ class qe extends x {
1758
1826
  useAnimation: l.useAnimation || !1
1759
1827
  };
1760
1828
  l.uid && (y.uid = l.uid);
1761
- for (const [v, T] of i.entries())
1762
- T.toolsType === m.BackgroundSVG && S.push({
1829
+ for (const [S, T] of i.entries())
1830
+ T.toolsType === m.BackgroundSVG && k.push({
1763
1831
  ...T,
1764
- workId: v,
1832
+ workId: S,
1765
1833
  type: h.BackgroundSVGUpdate,
1766
1834
  dataType: R.Local,
1767
1835
  willSyncService: w === b.Done ? !0 : n,
1768
1836
  updateNodeOpt: y,
1769
1837
  needUndoTicker: g,
1770
1838
  emitEventType: this.emitEventType
1771
- }), p && T.toolsType === m.Text ? S.push({
1839
+ }), p && T.toolsType === m.Text ? k.push({
1772
1840
  ...T,
1773
- workId: v,
1841
+ workId: S,
1774
1842
  type: h.TextUpdate,
1775
1843
  dataType: R.Local,
1776
1844
  willSyncService: w === b.Done ? !0 : n,
1777
1845
  updateNodeOpt: y,
1778
1846
  needUndoTicker: g,
1779
1847
  emitEventType: this.emitEventType
1780
- }) : (n || w === b.Done) && S.push({
1848
+ }) : (n || w === b.Done) && k.push({
1781
1849
  ...T,
1782
- workId: v,
1850
+ workId: S,
1783
1851
  type: h.UpdateNode,
1784
1852
  updateNodeOpt: {
1785
1853
  ...y,
1786
- eraserGeometryDelta: ee(
1787
- (W = this.localWork) == null ? void 0 : W.vNodes,
1788
- v
1854
+ eraserGeometryDelta: se(
1855
+ (E = this.localWork) == null ? void 0 : E.vNodes,
1856
+ S
1789
1857
  )
1790
1858
  },
1791
1859
  isSync: d,
@@ -1793,15 +1861,15 @@ class qe extends x {
1793
1861
  emitEventType: this.emitEventType
1794
1862
  });
1795
1863
  }
1796
- return f && S.push({
1864
+ return f && k.push({
1797
1865
  type: h.None,
1798
1866
  needUndoTicker: f
1799
- }), S.push({
1867
+ }), k.push({
1800
1868
  type: h.SelectorTransform,
1801
1869
  emitEventType: this.emitEventType,
1802
1870
  workState: w
1803
1871
  }), {
1804
- sp: S
1872
+ sp: k
1805
1873
  };
1806
1874
  });
1807
1875
  }
@@ -1823,7 +1891,7 @@ class qe extends x {
1823
1891
  smoothSync: d,
1824
1892
  needUndoTicker: l
1825
1893
  } = t;
1826
- s === D && r && (r.workState === b.Done && (r != null && r.translate) && (r.translate[0] || r.translate[1]) || r.workState !== b.Done ? await ((p = this.localWork) == null ? void 0 : p.updateSelector({
1894
+ s === P && r && (r.workState === b.Done && (r != null && r.translate) && (r.translate[0] || r.translate[1]) || r.workState !== b.Done ? await ((p = this.localWork) == null ? void 0 : p.updateSelector({
1827
1895
  updateSelectorOpt: r,
1828
1896
  willRefreshSelector: i,
1829
1897
  willSyncService: o,
@@ -1837,13 +1905,13 @@ class qe extends x {
1837
1905
  })) : r.workState === b.Done && ((f = this.localWork) == null || f.vNodes.deleteLastTarget()));
1838
1906
  }
1839
1907
  }
1840
- class ze extends x {
1908
+ class He extends q {
1841
1909
  constructor() {
1842
1910
  super(...arguments);
1843
1911
  u(this, "emitEventType", N.ScaleNode);
1844
1912
  u(this, "updateSelectorCallback", (t) => {
1845
1913
  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;
1914
+ 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
1915
  if (p === b.Start)
1848
1916
  return {
1849
1917
  sp: [
@@ -1865,10 +1933,10 @@ class ze extends x {
1865
1933
  points: p === b.Done && i.getChildrenPoints() || void 0,
1866
1934
  textOpt: i.textOpt
1867
1935
  });
1868
- const W = {
1936
+ const E = {
1869
1937
  useAnimation: c.useAnimation || !1
1870
1938
  };
1871
- c.uid && (W.uid = c.uid);
1939
+ c.uid && (E.uid = c.uid);
1872
1940
  for (const [g, y] of a.entries())
1873
1941
  y.toolsType === m.BackgroundSVG && f.push({
1874
1942
  ...y,
@@ -1876,8 +1944,8 @@ class ze extends x {
1876
1944
  type: h.BackgroundSVGUpdate,
1877
1945
  dataType: R.Local,
1878
1946
  willSyncService: p === b.Done ? !0 : n,
1879
- updateNodeOpt: W,
1880
- needUndoTicker: S,
1947
+ updateNodeOpt: E,
1948
+ needUndoTicker: k,
1881
1949
  emitEventType: this.emitEventType
1882
1950
  }), y.toolsType === m.Text ? f.push({
1883
1951
  ...y,
@@ -1885,22 +1953,22 @@ class ze extends x {
1885
1953
  type: h.TextUpdate,
1886
1954
  dataType: R.Local,
1887
1955
  willSyncService: p === b.Done ? !0 : n,
1888
- updateNodeOpt: W,
1889
- needUndoTicker: S,
1956
+ updateNodeOpt: E,
1957
+ needUndoTicker: k,
1890
1958
  emitEventType: this.emitEventType
1891
1959
  }) : (n || p === b.Done) && f.push({
1892
1960
  ...y,
1893
1961
  workId: g,
1894
1962
  type: h.UpdateNode,
1895
1963
  updateNodeOpt: {
1896
- ...W,
1897
- eraserGeometryDelta: ee(
1964
+ ...E,
1965
+ eraserGeometryDelta: se(
1898
1966
  (I = this.localWork) == null ? void 0 : I.vNodes,
1899
1967
  g
1900
1968
  )
1901
1969
  },
1902
1970
  isSync: !0,
1903
- needUndoTicker: S,
1971
+ needUndoTicker: k,
1904
1972
  emitEventType: this.emitEventType
1905
1973
  });
1906
1974
  }
@@ -1931,7 +1999,7 @@ class ze extends x {
1931
1999
  smoothSync: a,
1932
2000
  needUndoTicker: n
1933
2001
  } = t;
1934
- s === D && r && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
2002
+ s === P && r && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1935
2003
  updateSelectorOpt: r,
1936
2004
  willSyncService: i,
1937
2005
  willSerializeData: o,
@@ -1942,7 +2010,7 @@ class ze extends x {
1942
2010
  }));
1943
2011
  }
1944
2012
  }
1945
- class Ve extends x {
2013
+ class Ke extends q {
1946
2014
  constructor() {
1947
2015
  super(...arguments);
1948
2016
  u(this, "emitEventType", N.RotateNode);
@@ -1954,9 +2022,9 @@ class Ve extends x {
1954
2022
  willSerializeData: l,
1955
2023
  isSync: p,
1956
2024
  needUndoTicker: f
1957
- } = s, w = c.workState, S = r.sp || [], I = o == null ? void 0 : o.selectRect, W = w === b.Done ? f : void 0;
2025
+ } = s, w = c.workState, k = r.sp || [], I = o == null ? void 0 : o.selectRect, E = w === b.Done ? f : void 0;
1958
2026
  if (d) {
1959
- l && w === b.Done && S.push({
2027
+ l && w === b.Done && k.push({
1960
2028
  type: h.Select,
1961
2029
  selectIds: i.selectIds,
1962
2030
  selectRect: I,
@@ -1968,32 +2036,32 @@ class Ve extends x {
1968
2036
  useAnimation: c.useAnimation || !1
1969
2037
  };
1970
2038
  if (c.uid && (y.uid = c.uid), n || w === b.Done)
1971
- for (const [v, T] of a.entries())
1972
- S.push({
2039
+ for (const [S, T] of a.entries())
2040
+ k.push({
1973
2041
  ...T,
1974
- workId: v,
2042
+ workId: S,
1975
2043
  type: h.UpdateNode,
1976
2044
  updateNodeOpt: {
1977
2045
  ...y,
1978
- eraserGeometryDelta: ee(
2046
+ eraserGeometryDelta: se(
1979
2047
  (g = this.localWork) == null ? void 0 : g.vNodes,
1980
- v
2048
+ S
1981
2049
  )
1982
2050
  },
1983
2051
  isSync: p,
1984
- needUndoTicker: W,
2052
+ needUndoTicker: E,
1985
2053
  emitEventType: this.emitEventType
1986
2054
  });
1987
2055
  }
1988
- return f && S.push({
2056
+ return f && k.push({
1989
2057
  type: h.None,
1990
2058
  needUndoTicker: f
1991
- }), S.push({
2059
+ }), k.push({
1992
2060
  type: h.SelectorTransform,
1993
2061
  emitEventType: this.emitEventType,
1994
2062
  workState: w
1995
2063
  }), {
1996
- sp: S
2064
+ sp: k
1997
2065
  };
1998
2066
  });
1999
2067
  }
@@ -2014,7 +2082,7 @@ class Ve extends x {
2014
2082
  smoothSync: c,
2015
2083
  needUndoTicker: d
2016
2084
  } = t;
2017
- s === D && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
2085
+ s === P && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
2018
2086
  updateSelectorOpt: r,
2019
2087
  willRefreshSelector: i,
2020
2088
  willSyncService: o,
@@ -2027,7 +2095,7 @@ class Ve extends x {
2027
2095
  }));
2028
2096
  }
2029
2097
  }
2030
- class $e extends x {
2098
+ class Qe extends q {
2031
2099
  constructor() {
2032
2100
  super(...arguments);
2033
2101
  u(this, "emitEventType", N.SetFontStyle);
@@ -2048,7 +2116,7 @@ class $e extends x {
2048
2116
  textUpdateForWoker: n,
2049
2117
  requestId: c
2050
2118
  } = t;
2051
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2119
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2052
2120
  updateSelectorOpt: r,
2053
2121
  willRefreshSelector: i,
2054
2122
  willSyncService: o,
@@ -2067,19 +2135,19 @@ class $e extends x {
2067
2135
  textUpdateForWoker: l,
2068
2136
  requestId: p,
2069
2137
  emitEventType: f
2070
- } = s, w = r.sp || [], S = a == null ? void 0 : a.selectRect;
2138
+ } = s, w = r.sp || [], k = a == null ? void 0 : a.selectRect;
2071
2139
  if (n && w) {
2072
2140
  d.fontSize && w.push({
2073
2141
  type: h.Select,
2074
2142
  selectIds: o.selectIds,
2075
- selectRect: S,
2143
+ selectRect: k,
2076
2144
  willSyncService: n,
2077
2145
  isSync: c,
2078
2146
  points: o.getChildrenPoints()
2079
2147
  });
2080
- for (const [I, W] of i.entries())
2081
- l && W.toolsType === m.Text ? w.push({
2082
- ...W,
2148
+ for (const [I, E] of i.entries())
2149
+ l && E.toolsType === m.Text ? w.push({
2150
+ ...E,
2083
2151
  workId: I,
2084
2152
  type: h.TextUpdate,
2085
2153
  dataType: R.Local,
@@ -2087,7 +2155,7 @@ class $e extends x {
2087
2155
  emitEventType: f,
2088
2156
  requestId: p
2089
2157
  }) : w.push({
2090
- ...W,
2158
+ ...E,
2091
2159
  workId: I,
2092
2160
  type: h.UpdateNode,
2093
2161
  updateNodeOpt: {
@@ -2103,7 +2171,7 @@ class $e extends x {
2103
2171
  };
2104
2172
  }
2105
2173
  }
2106
- class _e extends x {
2174
+ class je extends q {
2107
2175
  constructor() {
2108
2176
  super(...arguments);
2109
2177
  u(this, "emitEventType", N.SetPoint);
@@ -2159,7 +2227,7 @@ class _e extends x {
2159
2227
  textUpdateForWoker: n,
2160
2228
  needUndoTicker: c
2161
2229
  } = t;
2162
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2230
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2163
2231
  updateSelectorOpt: r,
2164
2232
  willRefreshSelector: i,
2165
2233
  willSyncService: o,
@@ -2172,7 +2240,7 @@ class _e extends x {
2172
2240
  }));
2173
2241
  }
2174
2242
  }
2175
- class He extends x {
2243
+ class Xe extends q {
2176
2244
  constructor() {
2177
2245
  super(...arguments);
2178
2246
  u(this, "emitEventType", N.SetLock);
@@ -2193,7 +2261,7 @@ class He extends x {
2193
2261
  needUndoTicker: n,
2194
2262
  requestId: c
2195
2263
  } = t;
2196
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2264
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2197
2265
  updateSelectorOpt: r,
2198
2266
  willRefreshSelector: i,
2199
2267
  willSyncService: o,
@@ -2212,11 +2280,11 @@ class He extends x {
2212
2280
  needUndoTicker: l,
2213
2281
  requestId: p,
2214
2282
  emitEventType: f
2215
- } = s, w = r.sp || [], S = a == null ? void 0 : a.selectRect;
2283
+ } = s, w = r.sp || [], k = a == null ? void 0 : a.selectRect;
2216
2284
  if (n && w) {
2217
- for (const [I, W] of i.entries())
2285
+ for (const [I, E] of i.entries())
2218
2286
  w.push({
2219
- ...W,
2287
+ ...E,
2220
2288
  workId: I,
2221
2289
  type: h.UpdateNode,
2222
2290
  updateNodeOpt: {
@@ -2233,7 +2301,7 @@ class He extends x {
2233
2301
  canRotate: o.canRotate,
2234
2302
  type: h.Select,
2235
2303
  selectIds: o.selectIds,
2236
- selectRect: S,
2304
+ selectRect: k,
2237
2305
  willSyncService: n,
2238
2306
  isSync: c
2239
2307
  });
@@ -2246,7 +2314,7 @@ class He extends x {
2246
2314
  };
2247
2315
  }
2248
2316
  }
2249
- class Qe extends x {
2317
+ class Ye extends q {
2250
2318
  constructor() {
2251
2319
  super(...arguments);
2252
2320
  u(this, "emitEventType", N.SetShapeOpt);
@@ -2267,7 +2335,7 @@ class Qe extends x {
2267
2335
  needUndoTicker: n,
2268
2336
  requestId: c
2269
2337
  } = t;
2270
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2338
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2271
2339
  updateSelectorOpt: r,
2272
2340
  willRefreshSelector: i,
2273
2341
  willSyncService: o,
@@ -2307,7 +2375,7 @@ class Qe extends x {
2307
2375
  };
2308
2376
  }
2309
2377
  }
2310
- class Ke {
2378
+ class Ze {
2311
2379
  constructor(e) {
2312
2380
  u(this, "builders", /* @__PURE__ */ new Map());
2313
2381
  this.builders = new Map(e.map((t) => [t, this.build(t)]));
@@ -2315,25 +2383,25 @@ class Ke {
2315
2383
  build(e) {
2316
2384
  switch (e) {
2317
2385
  case N.TranslateNode:
2318
- return new qe();
2386
+ return new _e();
2319
2387
  case N.ZIndexNode:
2320
- return new Ge();
2388
+ return new $e();
2321
2389
  case N.CopyNode:
2322
- return new Ue();
2390
+ return new ze();
2323
2391
  case N.SetColorNode:
2324
- return new xe();
2392
+ return new Ve();
2325
2393
  case N.ScaleNode:
2326
- return new ze();
2394
+ return new He();
2327
2395
  case N.RotateNode:
2328
- return new Ve();
2396
+ return new Ke();
2329
2397
  case N.SetFontStyle:
2330
- return new $e();
2398
+ return new Qe();
2331
2399
  case N.SetPoint:
2332
- return new _e();
2400
+ return new je();
2333
2401
  case N.SetLock:
2334
- return new He();
2402
+ return new Xe();
2335
2403
  case N.SetShapeOpt:
2336
- return new Qe();
2404
+ return new Ye();
2337
2405
  }
2338
2406
  }
2339
2407
  registerForMainThread(e) {
@@ -2348,14 +2416,14 @@ class Ke {
2348
2416
  return !1;
2349
2417
  }
2350
2418
  }
2351
- function Xe({
2352
- subThreads: M,
2419
+ function Je({
2420
+ subThreads: D,
2353
2421
  layers: e,
2354
2422
  scene: t,
2355
2423
  removeLayerTexture: s
2356
2424
  }) {
2357
2425
  let r;
2358
- for (const i of M)
2426
+ for (const i of D)
2359
2427
  try {
2360
2428
  i.destroy();
2361
2429
  } catch (o) {
@@ -2383,8 +2451,8 @@ function Xe({
2383
2451
  if (r)
2384
2452
  throw r;
2385
2453
  }
2386
- const Ye = 4;
2387
- class Ze {
2454
+ const et = 4;
2455
+ class tt {
2388
2456
  constructor(e = {}) {
2389
2457
  u(this, "pendingFrames", /* @__PURE__ */ new Map());
2390
2458
  u(this, "failedCanvases", /* @__PURE__ */ new Set());
@@ -2396,7 +2464,7 @@ class Ze {
2396
2464
  u(this, "destroyed", !1);
2397
2465
  this.tailFrameCount = Math.max(
2398
2466
  1,
2399
- Math.floor(e.tailFrameCount ?? Ye)
2467
+ Math.floor(e.tailFrameCount ?? et)
2400
2468
  ), this.requestFrame = e.requestFrame ?? ((t) => requestAnimationFrame(t)), this.cancelFrame = e.cancelFrame ?? ((t) => cancelAnimationFrame(t)), this.onReadbackError = e.onReadbackError;
2401
2469
  }
2402
2470
  markRendered(e) {
@@ -2427,7 +2495,7 @@ class Ze {
2427
2495
  }
2428
2496
  }
2429
2497
  }
2430
- class je {
2498
+ class st {
2431
2499
  constructor(e, t) {
2432
2500
  u(this, "viewId");
2433
2501
  u(this, "fullLayer");
@@ -2463,33 +2531,33 @@ class je {
2463
2531
  ...t.canvasOpt,
2464
2532
  container: t.container
2465
2533
  }), this.master = t.master;
2466
- const s = K.bufferSize.full, r = K.bufferSize.sub;
2534
+ const s = Y.bufferSize.full, r = Y.bufferSize.sub;
2467
2535
  this.fullLayer = this.createLayer("fullLayer", this.scene, {
2468
2536
  ...t.layerOpt,
2469
- bufferSize: this.viewId === Q ? s : r * 2
2537
+ bufferSize: this.viewId === X ? s : r * 2
2470
2538
  }), this.topLayer = this.createLayer("topLayer", this.scene, {
2471
2539
  ...t.layerOpt,
2472
- bufferSize: (this.viewId === Q, r),
2540
+ bufferSize: (this.viewId === X, r),
2473
2541
  contextType: "2d"
2474
2542
  }), this.localLayer = this.createLayer("localLayer", this.scene, {
2475
2543
  ...t.layerOpt,
2476
- bufferSize: (this.viewId === Q, r),
2544
+ bufferSize: (this.viewId === X, r),
2477
2545
  contextType: "2d"
2478
2546
  }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, {
2479
2547
  ...t.layerOpt,
2480
- bufferSize: (this.viewId === Q, r),
2548
+ bufferSize: (this.viewId === X, r),
2481
2549
  contextType: "2d"
2482
2550
  }), t.mainThreadRenderMode === "readback" && this.enableCanvas2DReadback([
2483
2551
  this.fullLayer.parent,
2484
2552
  this.topLayer.parent,
2485
2553
  this.localLayer.parent,
2486
2554
  this.serviceLayer.parent
2487
- ]), this.vNodes = new We(e, this.scene);
2555
+ ]), this.vNodes = new be(e, this.scene);
2488
2556
  const i = {
2489
2557
  thread: this,
2490
2558
  vNodes: this.vNodes
2491
2559
  };
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([
2560
+ this.localWork = new Ge(i), this.serviceWork = new qe(i), this.topWork = new xe(i), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ze([
2493
2561
  N.CopyNode,
2494
2562
  N.SetColorNode,
2495
2563
  N.DeleteNode,
@@ -2507,6 +2575,16 @@ class je {
2507
2575
  var t;
2508
2576
  return (t = this.cacheImages.get(e)) == null ? void 0 : t.imageSource;
2509
2577
  }
2578
+ getImageSourceKey(e) {
2579
+ if (!e.src) return;
2580
+ if (e.type !== me.Iconify) return e.src;
2581
+ const [t, s] = this.getIconSize(
2582
+ e.width,
2583
+ e.height,
2584
+ this.opt.displayer.dpr
2585
+ );
2586
+ return ye(e.src, t, s, e.strokeColor);
2587
+ }
2510
2588
  getCachedImagesByWorkId(e) {
2511
2589
  for (const [t, s] of this.cacheImages.entries())
2512
2590
  if (t === e && s.imageSource)
@@ -2535,7 +2613,7 @@ class je {
2535
2613
  this.destroyed || (this.combinePostMsg.add(e), this.runBatchPostData());
2536
2614
  }
2537
2615
  reportRendererBusinessError(e, t) {
2538
- const s = Y(e, t);
2616
+ const s = Z(e, t);
2539
2617
  s.reported || (s.reported = !0, this.post({
2540
2618
  sp: [
2541
2619
  {
@@ -2545,7 +2623,7 @@ class je {
2545
2623
  reportErrorCode: "RENDERER_RUNTIME_ERROR",
2546
2624
  reportStage: s.stage,
2547
2625
  reportError: s.message,
2548
- reportString: Re(s, t, {
2626
+ reportString: Le(s, t, {
2549
2627
  viewId: this.viewId,
2550
2628
  renderer: "mainThread"
2551
2629
  })
@@ -2575,26 +2653,26 @@ class je {
2575
2653
  workState: p,
2576
2654
  imageSrc: f,
2577
2655
  imageBitmap: w,
2578
- imageElement: S,
2656
+ imageElement: k,
2579
2657
  workIds: I,
2580
- isLockSentEventCursor: W,
2658
+ isLockSentEventCursor: E,
2581
2659
  requestId: g
2582
2660
  } = e, y = l == null ? void 0 : l.toString();
2583
2661
  switch (a) {
2584
2662
  case h.UpdateDpr:
2585
- G(e.dpr) && this.updateDpr(e.dpr);
2663
+ z(e.dpr) && this.updateDpr(e.dpr);
2586
2664
  break;
2587
2665
  case h.AuthClear: {
2588
- const { clearUids: v, localUid: T } = e;
2589
- this.vNodes.setCanClearUids(v), this.vNodes.setLocalUid(T);
2666
+ const { clearUids: S, localUid: T } = e;
2667
+ this.vNodes.setCanClearUids(S), this.vNodes.setLocalUid(T);
2590
2668
  break;
2591
2669
  }
2592
2670
  case h.Destroy:
2593
2671
  this.destroy();
2594
2672
  break;
2595
2673
  case h.CancelBitmapEraser: {
2596
- const v = y;
2597
- v && this.localWork.abortBitmapEraser(v);
2674
+ const S = y;
2675
+ S && this.localWork.abortBitmapEraser(S);
2598
2676
  break;
2599
2677
  }
2600
2678
  case h.Clear:
@@ -2602,18 +2680,18 @@ class je {
2602
2680
  break;
2603
2681
  case h.ServiceSyncCommit: {
2604
2682
  if (this.destroyed) break;
2605
- const v = [
2683
+ const S = [
2606
2684
  (s = this.fullLayer) == null ? void 0 : s.parent,
2607
2685
  (r = this.topLayer) == null ? void 0 : r.parent,
2608
2686
  (i = this.localLayer) == null ? void 0 : i.parent,
2609
2687
  (o = this.serviceLayer) == null ? void 0 : o.parent
2610
2688
  ].filter(Boolean);
2611
2689
  try {
2612
- await be(
2690
+ await Ne(
2613
2691
  (async () => {
2614
- await Le(
2692
+ await Be(
2615
2693
  this.serviceWork,
2616
- v
2694
+ S
2617
2695
  );
2618
2696
  })(),
2619
2697
  {
@@ -2623,7 +2701,7 @@ class je {
2623
2701
  }
2624
2702
  );
2625
2703
  } catch (T) {
2626
- throw Y(T, {
2704
+ throw Z(T, {
2627
2705
  business: "service-sync-commit",
2628
2706
  stage: "flush-and-prepare-render"
2629
2707
  });
@@ -2645,28 +2723,28 @@ class je {
2645
2723
  }
2646
2724
  case h.UpdateCamera:
2647
2725
  try {
2648
- await Ee(
2726
+ await Ce(
2649
2727
  e.cameraTaskId,
2650
- async (v) => {
2651
- this.activeCameraTaskContext = v;
2728
+ async (S) => {
2729
+ this.activeCameraTaskContext = S;
2652
2730
  try {
2653
- await this.updateCamera(e, v);
2731
+ await this.updateCamera(e, S);
2654
2732
  } finally {
2655
- this.activeCameraTaskContext === v && (this.activeCameraTaskContext = void 0);
2733
+ this.activeCameraTaskContext === S && (this.activeCameraTaskContext = void 0);
2656
2734
  }
2657
2735
  }
2658
2736
  );
2659
- } catch (v) {
2660
- throw this.cameraOpt = void 0, this.cancelCameraSettledRender(), v;
2737
+ } catch (S) {
2738
+ throw this.cameraOpt = void 0, this.cancelCameraSettledRender(), S;
2661
2739
  }
2662
2740
  break;
2663
2741
  case h.UpdateTools:
2664
2742
  if (n && c) {
2665
- const v = {
2743
+ const S = {
2666
2744
  toolsType: n,
2667
2745
  toolsOpt: c
2668
2746
  };
2669
- this.topWork.canUseTopLayer(n) ? this.topWork.setToolsOpt(v) : this.localWork.setToolsOpt(v);
2747
+ this.topWork.canUseTopLayer(n) ? this.topWork.setToolsOpt(S) : this.localWork.setToolsOpt(S);
2670
2748
  }
2671
2749
  break;
2672
2750
  case h.CreateWork:
@@ -2685,11 +2763,11 @@ class je {
2685
2763
  }
2686
2764
  break;
2687
2765
  case h.DrawWork:
2688
- p === b.Done && d === R.Local ? (await this.consumeDrawAll(d, e), n === m.LaserPen && W && this.post({
2766
+ p === b.Done && d === R.Local ? (await this.consumeDrawAll(d, e), n === m.LaserPen && E && this.post({
2689
2767
  sp: [
2690
2768
  {
2691
2769
  type: h.None,
2692
- isLockSentEventCursor: W
2770
+ isLockSentEventCursor: E
2693
2771
  }
2694
2772
  ]
2695
2773
  })) : await this.consumeDraw(d, e);
@@ -2706,7 +2784,7 @@ class je {
2706
2784
  await this.removeNode(e);
2707
2785
  return;
2708
2786
  case h.Select:
2709
- d === R.Local || l === D ? await this.localWork.updateFullSelectWork(e) : d === R.Service && this.serviceWork.runSelectWork(e);
2787
+ d === R.Local || l === P ? await this.localWork.updateFullSelectWork(e) : d === R.Service && this.serviceWork.runSelectWork(e);
2710
2788
  break;
2711
2789
  case h.CursorBlur:
2712
2790
  this.localWork.cursorBlur();
@@ -2718,31 +2796,57 @@ class je {
2718
2796
  d === R.Local && this.localWork.checkTextActive(e);
2719
2797
  break;
2720
2798
  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);
2799
+ if (f && l) {
2800
+ const S = this.imageResolveMap.get(f);
2801
+ if (!S || S.requestId !== g) {
2802
+ const L = w || k;
2803
+ if (L && !S && this.serviceWork) {
2804
+ const O = [
2805
+ ...this.vNodes.getNodesByType(m.Image)
2806
+ ].filter(
2807
+ ([, A]) => A.opt && this.getImageSourceKey(A.opt) === f
2808
+ );
2809
+ if (O.length && !this.cacheImages.has(f)) {
2810
+ this.cacheImages.set(f, {
2811
+ imageSource: L,
2812
+ workId: O[0][0]
2813
+ }), O.forEach(([A, W]) => {
2814
+ this.serviceWork.consumeFull({
2815
+ msgType: h.FullWork,
2816
+ dataType: R.Service,
2817
+ viewId: this.viewId,
2818
+ workId: A,
2819
+ toolsType: m.Image,
2820
+ opt: W.opt
2821
+ });
2822
+ });
2823
+ break;
2824
+ }
2825
+ }
2826
+ this.closeImageSource(L);
2725
2827
  break;
2726
2828
  }
2727
- const T = l.toString();
2728
- this.deleteCachedImagesByWorkId(T), this.cacheImages.set(f, {
2729
- imageSource: w || S,
2730
- workId: T
2731
- });
2732
- const { resolve: C, timer: L } = v;
2733
- L && clearTimeout(L), C && C(f);
2829
+ if (w || k) {
2830
+ const L = l.toString();
2831
+ this.deleteCachedImagesByWorkId(L), this.cacheImages.set(f, {
2832
+ imageSource: w || k,
2833
+ workId: L
2834
+ });
2835
+ }
2836
+ const { resolve: T, timer: C } = S;
2837
+ C && clearTimeout(C), T && T(f);
2734
2838
  }
2735
2839
  break;
2736
2840
  case h.GetVNodeInfo:
2737
2841
  if (l && I) {
2738
- const v = I.map((T) => this.vNodes.get(T));
2842
+ const S = I.map((T) => this.vNodes.get(T));
2739
2843
  this.post({
2740
2844
  sp: [
2741
2845
  {
2742
2846
  type: h.GetVNodeInfo,
2743
2847
  dataType: R.Local,
2744
2848
  workId: l,
2745
- vInfo: v
2849
+ vInfo: S
2746
2850
  }
2747
2851
  ]
2748
2852
  });
@@ -2756,16 +2860,12 @@ class je {
2756
2860
  return r <= 50 || i <= 50 ? [50, 50] : r <= 100 || i <= 100 ? [100, 100] : r <= 200 || i <= 200 ? [200, 200] : r <= 400 || i <= 400 ? [400, 400] : r <= 800 || i <= 800 ? [800, 800] : [1600, 1600];
2757
2861
  }
2758
2862
  async loadImageBitMap(e) {
2759
- const { toolsType: t, opt: s, workId: r, requestId: i } = e;
2863
+ const { toolsType: t, opt: s, workId: r, requestId: i, timeoutMs: o } = e;
2760
2864
  if (t === m.Image && s && r) {
2761
- const o = r.toString(), { src: a, type: n, width: c, height: d, strokeColor: l } = s;
2762
- if (!a || !n || !c || !d)
2865
+ const a = r.toString(), { src: n, type: c, width: d, height: l } = s;
2866
+ if (!n || !c || !d || !l)
2763
2867
  return;
2764
- 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);
2768
- }
2868
+ const p = this.getImageSourceKey(s);
2769
2869
  if (this.cacheImages.has(p)) {
2770
2870
  const y = this.getCachedImages(p);
2771
2871
  if (y)
@@ -2774,23 +2874,23 @@ class je {
2774
2874
  const w = this.imageResolveMap.get(p);
2775
2875
  if (w)
2776
2876
  return await w.promise, this.getCachedImages(p);
2777
- let S, I;
2778
- const W = new Promise((y, v) => {
2779
- S = y, I = v;
2877
+ let k, I;
2878
+ const E = new Promise((y, S) => {
2879
+ k = y, I = S;
2780
2880
  }), g = {
2781
- resolve: S,
2881
+ resolve: k,
2782
2882
  reject: I,
2783
2883
  timer: void 0,
2784
2884
  requestId: i,
2785
- promise: W
2885
+ promise: E
2786
2886
  };
2787
2887
  return g.timer = setTimeout(() => {
2788
- this.imageResolveMap.get(p) === g && S(p);
2789
- }, 5e3), this.imageResolveMap.set(p, g), this.opt.post({
2888
+ this.imageResolveMap.get(p) === g && k(p);
2889
+ }, o ?? 5e3), this.imageResolveMap.set(p, g), this.opt.post({
2790
2890
  sp: [
2791
2891
  {
2792
2892
  imageSrc: p,
2793
- workId: o,
2893
+ workId: a,
2794
2894
  viewId: this.viewId,
2795
2895
  isgl: !!this.fullLayer.parent.gl,
2796
2896
  isSubWorker: !1,
@@ -2798,14 +2898,14 @@ class je {
2798
2898
  type: h.GetImageBitMap
2799
2899
  }
2800
2900
  ]
2801
- }), await W, this.imageResolveMap.get(p) === g && this.imageResolveMap.delete(p), this.getCachedImages(p);
2901
+ }), await E, this.imageResolveMap.get(p) === g && this.imageResolveMap.delete(p), this.getCachedImages(p);
2802
2902
  }
2803
2903
  }
2804
2904
  async removeNode(e) {
2805
2905
  const { dataType: t, workId: s, removeIds: r } = e, i = r || [];
2806
2906
  if (s && i.push(s.toString()), i.length)
2807
2907
  for (const o of i) {
2808
- if (o === D) {
2908
+ if (o === P) {
2809
2909
  await this.localWork.removeSelector(e);
2810
2910
  continue;
2811
2911
  }
@@ -2841,13 +2941,13 @@ class je {
2841
2941
  };
2842
2942
  let c = !1;
2843
2943
  for (const d of e)
2844
- if (le(n, d)) {
2944
+ if (ue(n, d)) {
2845
2945
  c = !0;
2846
2946
  break;
2847
2947
  }
2848
2948
  c || e.push(n);
2849
2949
  }
2850
- G(o.fullWorkerDrawCount) && (t = o.fullWorkerDrawCount), G(o.consumeCount) && (s = o.consumeCount, r = o.consumeWorkId);
2950
+ z(o.fullWorkerDrawCount) && (t = o.fullWorkerDrawCount), z(o.consumeCount) && (s = o.consumeCount, r = o.consumeWorkId);
2851
2951
  }
2852
2952
  return this.combinePostMsg.clear(), {
2853
2953
  sp: e,
@@ -2877,7 +2977,7 @@ class je {
2877
2977
  clearAll() {
2878
2978
  this.cancelCameraSettledRender(), this.debounceUpdateCache.clear(), this.fullLayer.children.length && (this.fullLayer.parent.children.forEach((e) => {
2879
2979
  e.name !== "viewport" && e.remove();
2880
- }), $(this.fullLayer, this.fullLayer.parent)), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
2980
+ }), K(this.fullLayer, this.fullLayer.parent)), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
2881
2981
  sp: [
2882
2982
  {
2883
2983
  type: h.Clear
@@ -2914,13 +3014,13 @@ class je {
2914
3014
  var d, l;
2915
3015
  const { cameraOpt: s, scenePath: r, cameraTaskId: i } = e;
2916
3016
  let o = !1;
2917
- const a = this.cameraOpt, n = !!(s && le(a, s));
3017
+ const a = this.cameraOpt, n = !!(s && ue(a, s));
2918
3018
  let c = !1;
2919
3019
  if (s && n) {
2920
3020
  const p = !!this.activeCameraSettledRender;
2921
3021
  if (this.retargetCameraSettledRender(i)) return;
2922
3022
  if (!p) {
2923
- G(i) && this.opt.post({
3023
+ z(i) && this.opt.post({
2924
3024
  viewId: this.viewId,
2925
3025
  viewGeneration: this.viewGeneration,
2926
3026
  cameraSettledTaskId: i
@@ -2946,43 +3046,43 @@ class je {
2946
3046
  case m.LaserPen:
2947
3047
  break;
2948
3048
  default:
2949
- T !== H && T !== D && y.push(`${T}:${C.toolsType}`);
3049
+ T !== j && T !== P && y.push(`${T}:${C.toolsType}`);
2950
3050
  break;
2951
3051
  }
2952
3052
  if (t && (t.stage = "blocking-works", t.blockingWorks = y), !y.length) break;
2953
3053
  if (!await new Promise((T) => {
2954
3054
  this.taskUpdateCameraResolve = T, this.taskUpdateCameraId = setTimeout(() => {
2955
3055
  this.taskUpdateCameraId = void 0, this.taskUpdateCameraResolve = void 0, T(!0);
2956
- }, oe);
3056
+ }, ce);
2957
3057
  }) || t != null && t.aborted) return;
2958
3058
  } while (y.length);
2959
3059
  t && (t.stage = "update-camera", t.blockingWorks = void 0);
2960
3060
  }
2961
3061
  if (t != null && t.aborted) return;
2962
3062
  const f = /* @__PURE__ */ new Map();
2963
- for (const [y, v] of this.vNodes.getNodesByType(m.Text).entries()) {
2964
- const T = v.rect;
2965
- f.set(y, J(T));
3063
+ for (const [y, S] of this.vNodes.getNodesByType(m.Text).entries()) {
3064
+ const T = S.rect;
3065
+ f.set(y, te(T));
2966
3066
  }
2967
- for (const [y, v] of this.vNodes.gethasEraserNodes().entries())
2968
- f.set(y, J(v.rect));
3067
+ for (const [y, S] of this.vNodes.gethasEraserNodes().entries())
3068
+ f.set(y, te(S.rect));
2969
3069
  const w = new Set(f.keys());
2970
- let S = !1;
3070
+ let k = !1;
2971
3071
  if (this.localWork.hasSelector()) {
2972
3072
  const y = (l = this.localWork.getSelector()) == null ? void 0 : l.selectIds;
2973
3073
  if (y) {
2974
- S = !0;
2975
- for (const v of y)
2976
- w.add(v);
3074
+ k = !0;
3075
+ for (const S of y)
3076
+ w.add(S);
2977
3077
  }
2978
3078
  }
2979
3079
  let I = !1;
2980
3080
  if (this.serviceWork.selectorWorkShapes.size)
2981
3081
  for (const y of this.serviceWork.selectorWorkShapes.values()) {
2982
- const v = y.selectIds;
2983
- if (v) {
3082
+ const S = y.selectIds;
3083
+ if (S) {
2984
3084
  I = !0;
2985
- for (const T of v)
3085
+ for (const T of S)
2986
3086
  w.add(T);
2987
3087
  }
2988
3088
  }
@@ -2991,14 +3091,14 @@ class je {
2991
3091
  for (const [T, C] of f.entries()) {
2992
3092
  const L = this.vNodes.get(T);
2993
3093
  if (L) {
2994
- const A = C, E = L.rect, k = this.getSceneRect(), B = ae(A, k), O = ae(E, k);
2995
- 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;
2998
- (P || p && X) && (F === m.Text || X) && this.debounceUpdateCache.add(T);
3094
+ const O = C, A = L.rect, W = this.getSceneRect(), v = he(O, W), B = he(A, W);
3095
+ let F = c;
3096
+ (v !== B || O.w !== A.w || O.h !== A.h || B === Oe.intersect) && (F = !0);
3097
+ const { toolsType: M, opt: U } = L, x = U.eraserlines && U.eraserlines.length > 0 || !!U.eraserFaces;
3098
+ (F || p && x) && (M === m.Text || x) && this.debounceUpdateCache.add(T);
2999
3099
  }
3000
3100
  }
3001
- if (S && this.localWork.reRenderSelector(), I)
3101
+ if (k && this.localWork.reRenderSelector(), I)
3002
3102
  for (const [
3003
3103
  T,
3004
3104
  C
@@ -3013,48 +3113,48 @@ class je {
3013
3113
  o = !0;
3014
3114
  const y = { cancelled: !1, cameraTaskId: i, context: t };
3015
3115
  this.activeCameraSettledRender = y;
3016
- const v = () => !this.destroyed && !y.cancelled && this.activeCameraSettledRender === y && !(t != null && t.aborted);
3116
+ const S = () => !this.destroyed && !y.cancelled && this.activeCameraSettledRender === y && !(t != null && t.aborted);
3017
3117
  this.debounceUpdateCameraId = setTimeout(async () => {
3018
3118
  var T;
3019
3119
  this.debounceUpdateCameraId = void 0;
3020
3120
  try {
3021
- if (!v()) return;
3121
+ if (!S()) return;
3022
3122
  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);
3025
- if (B) {
3026
- const { toolsType: O, opt: P } = B;
3027
- if (k || O !== m.Text) {
3028
- const F = this.localWork.setFullWork({
3029
- toolsType: O,
3030
- opt: P,
3031
- workId: E
3123
+ for (const A of this.debounceUpdateCache.values()) {
3124
+ const W = (T = this.fullLayer) == null ? void 0 : T.getElementsByName(A)[0], v = this.vNodes.get(A);
3125
+ if (v) {
3126
+ const { toolsType: B, opt: F } = v;
3127
+ if (W || B !== m.Text) {
3128
+ const M = this.localWork.setFullWork({
3129
+ toolsType: B,
3130
+ opt: F,
3131
+ workId: A
3032
3132
  });
3033
- if (F) {
3034
- if (O === m.Text)
3133
+ if (M) {
3134
+ if (B === m.Text)
3035
3135
  C.push(
3036
- F.consumeServiceAsync({
3136
+ M.consumeServiceAsync({
3037
3137
  isFullWork: !0,
3038
- replaceId: E,
3138
+ replaceId: A,
3039
3139
  boxRect: this.getSceneRect(),
3040
- isActive: v
3140
+ isActive: S
3041
3141
  })
3042
3142
  );
3043
- else if (P.eraserlines && P.eraserlines.length > 0 || P.eraserFaces) {
3044
- const U = F.consumeService({
3045
- op: B.op,
3143
+ else if (F.eraserlines && F.eraserlines.length > 0 || F.eraserFaces) {
3144
+ const U = M.consumeService({
3145
+ op: v.op,
3046
3146
  isFullWork: !0,
3047
- replaceId: E,
3147
+ replaceId: A,
3048
3148
  workState: b.Done
3049
3149
  });
3050
- this.localWork.clearWorkShapeNodeCache(E), C.push(Promise.resolve(U));
3150
+ this.localWork.clearWorkShapeNodeCache(A), C.push(Promise.resolve(U));
3051
3151
  }
3052
3152
  }
3053
3153
  }
3054
3154
  }
3055
- this.debounceUpdateCache.delete(E);
3155
+ this.debounceUpdateCache.delete(A);
3056
3156
  }
3057
- if (await Promise.all(C), !v()) return;
3157
+ if (await Promise.all(C), !S()) return;
3058
3158
  this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds();
3059
3159
  const L = [
3060
3160
  this.fullLayer.parent.prepareRender,
@@ -3067,63 +3167,63 @@ class je {
3067
3167
  this.topLayer.parent,
3068
3168
  this.localLayer.parent,
3069
3169
  this.serviceLayer.parent
3070
- ], await Promise.all(L), y.renderLayers = void 0, !v()) return;
3071
- const A = y.cameraTaskId;
3072
- G(A) && this.opt.post({
3170
+ ], await Promise.all(L), y.renderLayers = void 0, !S()) return;
3171
+ const O = y.cameraTaskId;
3172
+ z(O) && this.opt.post({
3073
3173
  viewId: this.viewId,
3074
3174
  viewGeneration: this.viewGeneration,
3075
- cameraSettledTaskId: A
3175
+ cameraSettledTaskId: O
3076
3176
  });
3077
3177
  } catch (C) {
3078
- if (!v()) return;
3178
+ if (!S()) return;
3079
3179
  const L = {
3080
3180
  code: "RENDERER_BUSINESS_ERROR",
3081
3181
  business: "updateCamera",
3082
3182
  message: C instanceof Error ? C.message : String(C),
3083
3183
  stage: "camera-settled-render",
3084
3184
  workerType: "mainThread"
3085
- }, A = y.cameraTaskId;
3086
- if (G(A))
3185
+ }, O = y.cameraTaskId;
3186
+ if (z(O))
3087
3187
  try {
3088
3188
  this.opt.post({
3089
3189
  viewId: this.viewId,
3090
3190
  viewGeneration: this.viewGeneration,
3091
- cameraTaskId: A,
3191
+ cameraTaskId: O,
3092
3192
  cameraTaskStatus: "failed",
3093
3193
  cameraTaskError: L
3094
3194
  });
3095
- } catch (E) {
3195
+ } catch (A) {
3096
3196
  console.error(
3097
- `[cameraSettledRender] failed ACK post failed viewId=${this.viewId} taskId=${A}`,
3098
- E
3197
+ `[cameraSettledRender] failed ACK post failed viewId=${this.viewId} taskId=${O}`,
3198
+ A
3099
3199
  );
3100
3200
  }
3101
3201
  } finally {
3102
3202
  y.renderLayers = void 0, this.activeCameraSettledRender === y && (this.activeCameraSettledRender = void 0);
3103
3203
  }
3104
- }, oe);
3204
+ }, ce);
3105
3205
  }
3106
- const W = [
3206
+ const E = [
3107
3207
  this.fullLayer.parent,
3108
3208
  this.topLayer.parent,
3109
3209
  this.localLayer.parent,
3110
3210
  this.serviceLayer.parent
3111
3211
  ], g = Promise.all(
3112
- W.map((y) => y.prepareRender)
3212
+ E.map((y) => y.prepareRender)
3113
3213
  );
3114
- if (t && !await Ne(
3214
+ if (t && !await De(
3115
3215
  t,
3116
3216
  g,
3117
3217
  "prepare-render"
3118
3218
  )) {
3119
- W.filter(
3120
- (v) => v.cancelPendingRender()
3121
- ).forEach((v) => v.render()), g.catch(() => {
3219
+ E.filter(
3220
+ (S) => S.cancelPendingRender()
3221
+ ).forEach((S) => S.render()), g.catch(() => {
3122
3222
  });
3123
3223
  return;
3124
3224
  }
3125
3225
  if (t || await g, t != null && t.aborted) return;
3126
- !o && G(i) && this.opt.post({
3226
+ !o && z(i) && this.opt.post({
3127
3227
  viewId: this.viewId,
3128
3228
  viewGeneration: this.viewGeneration,
3129
3229
  cameraSettledTaskId: i
@@ -3140,7 +3240,7 @@ class je {
3140
3240
  };
3141
3241
  }
3142
3242
  createScene(e) {
3143
- return new fe({
3243
+ return new we({
3144
3244
  displayRatio: this.opt.displayer.dpr,
3145
3245
  depth: !1,
3146
3246
  desynchronized: !0,
@@ -3151,7 +3251,7 @@ class je {
3151
3251
  });
3152
3252
  }
3153
3253
  createLayer(e, t, s) {
3154
- const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, { ...s, offscreen: !1 }), n = new me({
3254
+ const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, { ...s, offscreen: !1 }), n = new ve({
3155
3255
  anchor: [0.5, 0.5],
3156
3256
  pos: [r * 0.5, i * 0.5],
3157
3257
  size: [r, i],
@@ -3161,7 +3261,7 @@ class je {
3161
3261
  return a.append(n), n;
3162
3262
  }
3163
3263
  enableCanvas2DReadback(e) {
3164
- this.readbackScheduler = new Ze({
3264
+ this.readbackScheduler = new tt({
3165
3265
  onReadbackError: (t) => this.opt.master.Logger.warn(
3166
3266
  `[Appliance]: [main-thread-readback] stage=failed viewId=${this.viewId} error=${t instanceof Error ? t.message : String(t)}`
3167
3267
  )
@@ -3199,7 +3299,7 @@ class je {
3199
3299
  }
3200
3300
  retargetCameraSettledRender(e) {
3201
3301
  var s;
3202
- if (!G(e)) return !1;
3302
+ if (!z(e)) return !1;
3203
3303
  const t = this.activeCameraSettledRender;
3204
3304
  return !t || t.cancelled || (s = t.context) != null && s.aborted ? !1 : (t.cameraTaskId = e, !0);
3205
3305
  }
@@ -3212,7 +3312,7 @@ class je {
3212
3312
  var e, t;
3213
3313
  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
3314
  new Error(`main-thread view destroyed: ${this.viewId}`)
3215
- ), this.vNodes.clear(), Xe({
3315
+ ), this.vNodes.clear(), Je({
3216
3316
  subThreads: [this.localWork, this.serviceWork, this.topWork],
3217
3317
  layers: [
3218
3318
  this.fullLayer,
@@ -3221,11 +3321,11 @@ class je {
3221
3321
  this.serviceLayer
3222
3322
  ],
3223
3323
  scene: this.scene,
3224
- removeLayerTexture: (s, r) => z(s, r)
3324
+ removeLayerTexture: (s, r) => _(s, r)
3225
3325
  }));
3226
3326
  }
3227
3327
  }
3228
- class Je {
3328
+ class rt {
3229
3329
  constructor(e, t) {
3230
3330
  u(this, "viewId");
3231
3331
  u(this, "fullLayer");
@@ -3246,7 +3346,7 @@ class Je {
3246
3346
  container: t.container
3247
3347
  }), this.master = t.master, this.fullLayer = this.createLayer("fullLayer", this.scene, {
3248
3348
  ...t.layerOpt,
3249
- bufferSize: this.viewId === Q ? 6e3 : 3e3,
3349
+ bufferSize: this.viewId === X ? 6e3 : 3e3,
3250
3350
  contextType: "2d"
3251
3351
  });
3252
3352
  }
@@ -3371,18 +3471,22 @@ class Je {
3371
3471
  return;
3372
3472
  }
3373
3473
  case h.GetImageBitMap: {
3374
- if (s && (r || i) && o) {
3375
- const n = o.toString(), c = this.imageResolveMap.get(s);
3376
- if (!c || c.requestId !== a) {
3474
+ if (s && o) {
3475
+ const n = this.imageResolveMap.get(s);
3476
+ if (!n || n.requestId !== a) {
3377
3477
  this.closeImageSource(r || i);
3378
3478
  break;
3379
3479
  }
3380
- if (this.deleteCachedImagesByWorkId(n), this.cacheImages.set(s, {
3381
- imageSource: r || i,
3382
- workId: n
3383
- }), c) {
3384
- const { resolve: d, timer: l } = c;
3385
- l && clearTimeout(l), d && d(s);
3480
+ if (r || i) {
3481
+ const c = o.toString();
3482
+ this.deleteCachedImagesByWorkId(c), this.cacheImages.set(s, {
3483
+ imageSource: r || i,
3484
+ workId: c
3485
+ });
3486
+ }
3487
+ if (n) {
3488
+ const { resolve: c, timer: d } = n;
3489
+ d && clearTimeout(d), c && c(s);
3386
3490
  }
3387
3491
  }
3388
3492
  break;
@@ -3400,9 +3504,9 @@ class Je {
3400
3504
  if (!a || !n || !c || !d)
3401
3505
  return;
3402
3506
  let p = a;
3403
- if (n === pe.Iconify) {
3507
+ if (n === me.Iconify) {
3404
3508
  const [g, y] = this.getIconSize(c, d, this.opt.displayer.dpr);
3405
- p = ue(a, g, y, l);
3509
+ p = ye(a, g, y, l);
3406
3510
  }
3407
3511
  if (this.cacheImages.has(p)) {
3408
3512
  const g = this.getCachedImages(p);
@@ -3412,18 +3516,18 @@ class Je {
3412
3516
  const w = this.imageResolveMap.get(p);
3413
3517
  if (w)
3414
3518
  return await w.promise, this.getCachedImages(p);
3415
- let S;
3519
+ let k;
3416
3520
  const I = new Promise((g) => {
3417
- S = g;
3418
- }), W = {
3419
- resolve: S,
3521
+ k = g;
3522
+ }), E = {
3523
+ resolve: k,
3420
3524
  timer: void 0,
3421
3525
  requestId: i,
3422
3526
  promise: I
3423
3527
  };
3424
- return W.timer = setTimeout(() => {
3425
- this.imageResolveMap.get(p) === W && S(p);
3426
- }, 5e3), this.imageResolveMap.set(p, W), this.opt.post({
3528
+ return E.timer = setTimeout(() => {
3529
+ this.imageResolveMap.get(p) === E && k(p);
3530
+ }, 5e3), this.imageResolveMap.set(p, E), this.opt.post({
3427
3531
  viewId: this.viewId,
3428
3532
  viewGeneration: this.viewGeneration,
3429
3533
  viewOwner: this.viewOwner,
@@ -3438,11 +3542,11 @@ class Je {
3438
3542
  requestId: i
3439
3543
  }
3440
3544
  ]
3441
- }), await I, this.imageResolveMap.get(p) === W && this.imageResolveMap.delete(p), this.getCachedImages(p);
3545
+ }), await I, this.imageResolveMap.get(p) === E && this.imageResolveMap.delete(p), this.getCachedImages(p);
3442
3546
  }
3443
3547
  }
3444
3548
  createWorkShapeNode(e) {
3445
- return Z({
3549
+ return J({
3446
3550
  ...e,
3447
3551
  fullLayer: this.fullLayer,
3448
3552
  drawLayer: void 0
@@ -3462,7 +3566,7 @@ class Je {
3462
3566
  }
3463
3567
  async runFullWork(e) {
3464
3568
  var r;
3465
- const t = this.setFullWork(e), s = e.ops && V(e.ops);
3569
+ const t = this.setFullWork(e), s = e.ops && H(e.ops);
3466
3570
  if (t) {
3467
3571
  let i, o;
3468
3572
  const a = (r = t.getWorkId()) == null ? void 0 : r.toString();
@@ -3481,7 +3585,7 @@ class Je {
3481
3585
  op: s,
3482
3586
  isFullWork: !0,
3483
3587
  replaceId: a
3484
- }), o = (e == null ? void 0 : e.updateNodeOpt) && t.updataOptService(e.updateNodeOpt)), ne(i, o);
3588
+ }), o = (e == null ? void 0 : e.updateNodeOpt) && t.updataOptService(e.updateNodeOpt)), le(i, o);
3485
3589
  }
3486
3590
  }
3487
3591
  async getSnapshot(e) {
@@ -3557,7 +3661,7 @@ class Je {
3557
3661
  requestId: r
3558
3662
  }
3559
3663
  ]
3560
- }), this.fullLayer && !this.destroyed && $(this.fullLayer, this.fullLayer.parent);
3664
+ }), this.fullLayer && !this.destroyed && K(this.fullLayer, this.fullLayer.parent);
3561
3665
  }
3562
3666
  }
3563
3667
  async getBoundingRect(e) {
@@ -3579,7 +3683,7 @@ class Je {
3579
3683
  viewId: this.viewId,
3580
3684
  requestId: i
3581
3685
  });
3582
- o = ne(o, c);
3686
+ o = le(o, c);
3583
3687
  break;
3584
3688
  }
3585
3689
  }
@@ -3616,7 +3720,7 @@ class Je {
3616
3720
  for (const r of s.sp) {
3617
3721
  let i = !1;
3618
3722
  for (const o of e)
3619
- if (Be(r, o)) {
3723
+ if (Me(r, o)) {
3620
3724
  i = !0;
3621
3725
  break;
3622
3726
  }
@@ -3656,7 +3760,7 @@ class Je {
3656
3760
  this.releaseBatchImageBitmaps(e);
3657
3761
  }
3658
3762
  createScene(e) {
3659
- return new fe({
3763
+ return new we({
3660
3764
  displayRatio: this.opt.displayer.dpr,
3661
3765
  depth: !1,
3662
3766
  desynchronized: !0,
@@ -3666,7 +3770,7 @@ class Je {
3666
3770
  });
3667
3771
  }
3668
3772
  createLayer(e, t, s) {
3669
- const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, s), n = new me({
3773
+ const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, s), n = new ve({
3670
3774
  anchor: [0.5, 0.5],
3671
3775
  pos: [r * 0.5, i * 0.5],
3672
3776
  size: [r, i],
@@ -3720,7 +3824,7 @@ class Je {
3720
3824
  t.push(r);
3721
3825
  }
3722
3826
  try {
3723
- s && z(this.fullLayer, s);
3827
+ s && _(this.fullLayer, s);
3724
3828
  } catch (r) {
3725
3829
  t.push(r);
3726
3830
  }
@@ -3733,7 +3837,7 @@ class Je {
3733
3837
  throw t[0];
3734
3838
  }
3735
3839
  }
3736
- class lt {
3840
+ class ft {
3737
3841
  constructor(e) {
3738
3842
  u(this, "mainThreadMap", /* @__PURE__ */ new Map());
3739
3843
  u(this, "cameraRenderQueueByView", /* @__PURE__ */ new Map());
@@ -3768,8 +3872,8 @@ class lt {
3768
3872
  consumeCount: l,
3769
3873
  consumeWorkId: p
3770
3874
  } = e;
3771
- if (c && q(i)) {
3772
- const f = Oe(
3875
+ if (c && $(i)) {
3876
+ const f = Pe(
3773
3877
  o,
3774
3878
  a,
3775
3879
  "mainThread"
@@ -3781,11 +3885,11 @@ class lt {
3781
3885
  d
3782
3886
  ) : this.master.ackCameraTask(c, i, d);
3783
3887
  }
3784
- c && q(n) && this.master.ackCameraSettledTask(
3888
+ c && $(n) && this.master.ackCameraSettledTask(
3785
3889
  c,
3786
3890
  n,
3787
3891
  d
3788
- ), this.master.isBusy && q(r) && this.master.setWorkerTasksqueueCount(r), q(t) && this.master.setMaxDrawCount(t), q(l) && this.master.setConsumeCount(l, p), s && this.master.collectorSyncData(
3892
+ ), this.master.isBusy && $(r) && this.master.setWorkerTasksqueueCount(r), $(t) && this.master.setMaxDrawCount(t), $(l) && this.master.setConsumeCount(l, p), s && this.master.collectorSyncData(
3789
3893
  e.viewOwner === void 0 ? s : s.map(
3790
3894
  (f) => f.type === h.GetImageBitMap && f.viewOwner === void 0 ? { ...f, viewOwner: e.viewOwner } : f
3791
3895
  )
@@ -3799,7 +3903,7 @@ class lt {
3799
3903
  return this.cameraRenderQueueByView.set(e, r), r;
3800
3904
  }
3801
3905
  isStaleViewMessage(e) {
3802
- if (!e.viewId || e.viewId === ce || e.viewGeneration === void 0)
3906
+ if (!e.viewId || e.viewId === de || e.viewGeneration === void 0)
3803
3907
  return !1;
3804
3908
  const t = this.viewGenerationById.get(e.viewId);
3805
3909
  return t !== void 0 && e.viewGeneration < t;
@@ -3854,10 +3958,10 @@ class lt {
3854
3958
  );
3855
3959
  }
3856
3960
  createMainThread(e, t) {
3857
- return new je(e, t);
3961
+ return new st(e, t);
3858
3962
  }
3859
3963
  createSnapshotThread(e, t) {
3860
- return new Je(e, t);
3964
+ return new rt(e, t);
3861
3965
  }
3862
3966
  getSnapshotRequestKey(e) {
3863
3967
  return e.requestId || `${e.viewId}\0${e.scenePath || ""}\0${e.msgType}`;
@@ -3924,36 +4028,36 @@ class lt {
3924
4028
  if (o === h.Init) {
3925
4029
  const g = i.viewGeneration ?? (this.viewGenerationById.get(a) || 0) + 1;
3926
4030
  await this.enqueueViewTask(a, async () => {
3927
- var E, k, B;
4031
+ var A, W, v;
3928
4032
  const y = this.viewGenerationById.get(a);
3929
4033
  if (y !== void 0 && g < y)
3930
4034
  return;
3931
4035
  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;
4036
+ const S = i.viewOwner || `${a}:${g}:${++this.ownerSequence}`, T = (A = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : A.displayer, C = T == null ? void 0 : T.canvasContainerRef.current;
3933
4037
  if (!T || !C || !l || !p) {
3934
4038
  this.viewOwnerById.delete(a);
3935
4039
  return;
3936
4040
  }
3937
- this.viewOwnerById.set(a, v);
4041
+ this.viewOwnerById.set(a, S);
3938
4042
  const L = this.mainThreadMap.get(a);
3939
4043
  L == null || L.destroy();
3940
- const A = this.createMainThread(a, {
4044
+ const O = this.createMainThread(a, {
3941
4045
  displayer: T,
3942
4046
  container: C,
3943
4047
  layerOpt: l,
3944
4048
  master: this.master,
3945
4049
  canvasOpt: p,
3946
- viewOwner: v,
4050
+ viewOwner: S,
3947
4051
  viewGeneration: g,
3948
- mainThreadRenderMode: ((B = (k = this.master.control) == null ? void 0 : k.renderingCompatibilityDecision) == null ? void 0 : B.mainThreadRenderMode) ?? "normal",
3949
- post: (O) => this.post({
3950
- ...O,
3951
- viewId: O.viewId || a,
3952
- viewGeneration: O.viewGeneration ?? g,
3953
- viewOwner: v
4052
+ mainThreadRenderMode: ((v = (W = this.master.control) == null ? void 0 : W.renderingCompatibilityDecision) == null ? void 0 : v.mainThreadRenderMode) ?? "normal",
4053
+ post: (B) => this.post({
4054
+ ...B,
4055
+ viewId: B.viewId || a,
4056
+ viewGeneration: B.viewGeneration ?? g,
4057
+ viewOwner: S
3954
4058
  })
3955
4059
  });
3956
- this.mainThreadMap.set(a, A), A && f && A.setCameraOpt(f), this.post({
4060
+ this.mainThreadMap.set(a, O), O && f && O.setCameraOpt(f), this.post({
3957
4061
  sp: [
3958
4062
  {
3959
4063
  type: h.Init,
@@ -3966,40 +4070,40 @@ class lt {
3966
4070
  continue;
3967
4071
  }
3968
4072
  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) {
4073
+ 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;
4074
+ if (g && S && f) {
3971
4075
  const T = this.getSnapshotRequestKey(i), C = this.snapshotThreadsByRequest.get(T);
3972
4076
  C && this.disposeSnapshotThread(T, C.thread, "replaced");
3973
4077
  const L = document.createElement("div");
3974
- L.style.width = `${f.width}px`, L.style.height = `${f.height}px`, v.append(L);
3975
- const A = {
3976
- ...he.defaultLayerOpt,
4078
+ L.style.width = `${f.width}px`, L.style.height = `${f.height}px`, S.append(L);
4079
+ const O = {
4080
+ ...pe.defaultLayerOpt,
3977
4081
  offscreen: !1,
3978
4082
  width: f.width,
3979
4083
  height: f.height
3980
- }, E = {
3981
- ...he.defaultScreenCanvasOpt,
4084
+ }, A = {
4085
+ ...pe.defaultScreenCanvasOpt,
3982
4086
  width: f.width,
3983
4087
  height: f.height
3984
- }, k = this.createSnapshotThread(a, {
4088
+ }, W = this.createSnapshotThread(a, {
3985
4089
  displayer: g,
3986
4090
  container: L,
3987
- layerOpt: A,
4091
+ layerOpt: O,
3988
4092
  master: this.master,
3989
- canvasOpt: E,
4093
+ canvasOpt: A,
3990
4094
  post: this.post,
3991
4095
  viewOwner: this.viewOwnerById.get(a),
3992
4096
  viewGeneration: this.viewGenerationById.get(a)
3993
4097
  });
3994
4098
  this.snapshotThreadsByRequest.set(T, {
3995
- thread: k,
4099
+ thread: W,
3996
4100
  surface: L
3997
- }), k.on(i).then(() => {
3998
- this.disposeSnapshotThread(T, k);
3999
- }).catch((B) => {
4101
+ }), W.on(i).then(() => {
4102
+ this.disposeSnapshotThread(T, W);
4103
+ }).catch((v) => {
4000
4104
  this.master.Logger.error(
4001
- `[Appliance]: snapshot render failed; viewId=${a}; error=${B instanceof Error ? B.message : String(B)}`
4002
- ), this.disposeSnapshotThread(T, k);
4105
+ `[Appliance]: snapshot render failed; viewId=${a}; error=${v instanceof Error ? v.message : String(v)}`
4106
+ ), this.disposeSnapshotThread(T, W);
4003
4107
  });
4004
4108
  continue;
4005
4109
  }
@@ -4030,8 +4134,8 @@ class lt {
4030
4134
  continue;
4031
4135
  }
4032
4136
  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) {
4137
+ const g = this.mainThreadMap.get(a), y = this.viewGenerationById.get(a), S = this.viewOwnerById.get(a);
4138
+ if (!g || i.viewGeneration !== void 0 && i.viewGeneration !== y || i.viewOwner !== void 0 && i.viewOwner !== S || this.mainThreadMap.get(a) !== g) {
4035
4139
  this.releaseMessageBitmap(i);
4036
4140
  continue;
4037
4141
  }
@@ -4039,30 +4143,30 @@ class lt {
4039
4143
  continue;
4040
4144
  }
4041
4145
  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);
4146
+ const g = n.get(a), y = this.mainThreadMap.get(a), S = this.viewGenerationById.get(a), T = this.viewOwnerById.get(a);
4043
4147
  let C;
4044
4148
  if (g && y)
4045
4149
  try {
4046
4150
  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);
4151
+ this.viewGenerationById.get(a) !== S || this.viewOwnerById.get(a) !== T || this.mainThreadMap.get(a) !== y || await y.on(g);
4048
4152
  });
4049
4153
  } catch (L) {
4050
4154
  if (g.msgType !== h.UpdateCamera) throw L;
4051
- const A = De(L);
4155
+ const O = Ae(L);
4052
4156
  C = {
4053
- code: A ? "RENDERER_BUSINESS_TIMEOUT" : "RENDERER_BUSINESS_ERROR",
4157
+ code: O ? "RENDERER_BUSINESS_TIMEOUT" : "RENDERER_BUSINESS_ERROR",
4054
4158
  business: "updateCamera",
4055
4159
  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,
4160
+ elapsedMs: O ? L.elapsedMs : void 0,
4161
+ stage: O ? L.stage : "update-camera",
4162
+ blockingWorks: O ? L.blockingWorks : void 0,
4059
4163
  workerType: "mainThread"
4060
4164
  };
4061
4165
  }
4062
- if (C && q(d)) {
4166
+ if (C && $(d)) {
4063
4167
  this.post({
4064
4168
  viewId: a,
4065
- viewGeneration: v,
4169
+ viewGeneration: S,
4066
4170
  viewOwner: T,
4067
4171
  cameraTaskId: d,
4068
4172
  cameraTaskStatus: C.code === "RENDERER_BUSINESS_TIMEOUT" ? "timeout" : "failed",
@@ -4070,30 +4174,30 @@ class lt {
4070
4174
  });
4071
4175
  continue;
4072
4176
  }
4073
- c && q(d) && this.post({
4177
+ c && $(d) && this.post({
4074
4178
  workerTasksqueueCount: c,
4075
4179
  cameraTaskId: d,
4076
4180
  viewId: a,
4077
- viewGeneration: v,
4181
+ viewGeneration: S,
4078
4182
  viewOwner: T
4079
4183
  });
4080
4184
  continue;
4081
4185
  }
4082
- if (a === ce) {
4186
+ if (a === de) {
4083
4187
  const g = [...this.mainThreadMap.entries()];
4084
- for (const [y, v] of g) {
4188
+ for (const [y, S] of g) {
4085
4189
  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(
4190
+ this.mainThreadMap.get(y) === S && (o === h.Destroy ? (S.destroy(), this.mainThreadMap.delete(y), this.viewOwnerById.delete(y), this.viewGenerationById.set(
4087
4191
  y,
4088
4192
  (this.viewGenerationById.get(y) || 0) + 1
4089
- )) : await v.on(i));
4193
+ )) : await S.on(i));
4090
4194
  });
4091
4195
  await T, this.cameraRenderQueueByView.get(y) === T && this.cameraRenderQueueByView.delete(y);
4092
4196
  }
4093
4197
  continue;
4094
4198
  }
4095
- const S = this.mainThreadMap.get(a);
4096
- if (o === h.Destroy && !S) {
4199
+ const k = this.mainThreadMap.get(a);
4200
+ if (o === h.Destroy && !k) {
4097
4201
  await this.enqueueViewTask(a, async () => {
4098
4202
  this.viewGenerationById.set(
4099
4203
  a,
@@ -4102,12 +4206,12 @@ class lt {
4102
4206
  });
4103
4207
  continue;
4104
4208
  }
4105
- if (!S)
4209
+ if (!k)
4106
4210
  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);
4211
+ const I = this.viewGenerationById.get(a), E = this.enqueueViewTask(a, async () => {
4212
+ this.viewGenerationById.get(a) !== I || this.mainThreadMap.get(a) !== k || await k.on(i);
4109
4213
  });
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(
4214
+ o === h.Destroy && (await E, this.mainThreadMap.get(a) === k && this.mainThreadMap.delete(a), this.viewOwnerById.delete(a), this.cameraRenderQueueByView.get(a) === E && this.cameraRenderQueueByView.delete(a), this.viewGenerationById.set(
4111
4215
  a,
4112
4216
  i.viewGeneration ?? (I || 0) + 1
4113
4217
  ));
@@ -4115,5 +4219,5 @@ class lt {
4115
4219
  }
4116
4220
  }
4117
4221
  export {
4118
- lt as MainThreadManagerImpl
4222
+ ft as MainThreadManagerImpl
4119
4223
  };