@netless/appliance-plugin 1.1.44-beta.0 → 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 (64) hide show
  1. package/dist/appliance-plugin.js +1 -1
  2. package/dist/appliance-plugin.mjs +12 -12
  3. package/dist/{bridge-CskJoX5M.js → bridge-B7BW1lpB.js} +1 -1
  4. package/dist/{bridge-rKHCYJ6m.mjs → bridge-DQud78k4.mjs} +1 -1
  5. package/dist/bridge.js +1 -1
  6. package/dist/bridge.mjs +1 -1
  7. package/dist/collector/types.d.ts +0 -3
  8. package/dist/component/textEditor/types.d.ts +0 -5
  9. package/dist/core/mainThread/base.d.ts +5 -1
  10. package/dist/core/mainThread/snapshotThread.d.ts +2 -3
  11. package/dist/core/mainThread/subLocalThread.d.ts +2 -5
  12. package/dist/core/mainThread/subServiceThread.d.ts +2 -1
  13. package/dist/core/mainThread/subTopThread.d.ts +2 -2
  14. package/dist/core/tools/arrow.d.ts +1 -423
  15. package/dist/core/tools/base.d.ts +2 -444
  16. package/dist/core/tools/ellipse.d.ts +1 -423
  17. package/dist/core/tools/eraser.d.ts +2 -846
  18. package/dist/core/tools/eraserFaces.d.ts +0 -2
  19. package/dist/core/tools/image.d.ts +1 -0
  20. package/dist/core/tools/laserPen.d.ts +2 -846
  21. package/dist/core/tools/pencil.d.ts +2 -848
  22. package/dist/core/tools/pencilEraser.d.ts +4 -1692
  23. package/dist/core/tools/pencilEraserBitMap.d.ts +5 -2115
  24. package/dist/core/tools/polygon.d.ts +1 -423
  25. package/dist/core/tools/rectangle.d.ts +1 -423
  26. package/dist/core/tools/selector.d.ts +7 -2121
  27. package/dist/core/tools/speechBalloon.d.ts +1 -423
  28. package/dist/core/tools/star.d.ts +1 -423
  29. package/dist/core/tools/straight.d.ts +1 -423
  30. package/dist/core/tools/text.d.ts +3 -3
  31. package/dist/core/tools/utils.d.ts +2 -2
  32. package/dist/core/types.d.ts +0 -9
  33. package/dist/core/utils/index.d.ts +0 -2
  34. package/dist/core/utils/serviceImageRecovery.d.ts +9 -0
  35. package/dist/core/vNodeManager.d.ts +1 -1
  36. package/dist/core/worker/base.d.ts +6 -2
  37. package/dist/core/worker/fullWorkerLocal.d.ts +0 -1
  38. package/dist/core/worker/fullWorkerService.d.ts +4 -2
  39. package/dist/core/worker/simpleWorker.d.ts +2 -2
  40. package/dist/core/worker/subWorkerTopLayer.d.ts +2 -2
  41. package/dist/fullWorker.js +148 -149
  42. package/dist/{index-Ca2t53R7.mjs → index-4ZI3GxVI.mjs} +1 -1
  43. package/dist/{index-ZMuKk-bl.js → index-AJCkfnUu.js} +1 -1
  44. package/dist/{index-ConirzkM.mjs → index-B8Ls8sf_.mjs} +1 -1
  45. package/dist/{index-BbBSxLGe.mjs → index-BBtV40zU.mjs} +563 -490
  46. package/dist/{index-C-tBYq0K.js → index-BOzOWS7h.js} +1 -1
  47. package/dist/index-BQiBrpib.js +1 -0
  48. package/dist/index-BYriQtGa.js +1 -0
  49. package/dist/{index-_3yxgNoj.mjs → index-C2tUvh2a.mjs} +11964 -12224
  50. package/dist/{index-DWevrjrE.mjs → index-DSFxl2wM.mjs} +11917 -12168
  51. package/dist/index-DnJkIouU.js +570 -0
  52. package/dist/index-DptnZ-h8.js +570 -0
  53. package/dist/{index-LcCU1tMV.mjs → index-ZUpKkvbD.mjs} +563 -490
  54. package/dist/subWorker.js +132 -133
  55. package/package.json +3 -4
  56. package/dist/core/utils/affineMatrix.d.ts +0 -33
  57. package/dist/core/utils/fontFamily.d.ts +0 -8
  58. package/dist/core/utils/selectorMatrix.d.ts +0 -4
  59. package/dist/core/utils/selectorRefresh.d.ts +0 -8
  60. package/dist/core/utils/textRaster.d.ts +0 -2
  61. package/dist/index-B0SB7Efu.js +0 -570
  62. package/dist/index-BIVRfc_x.js +0 -570
  63. package/dist/index-Bzg5OMdP.js +0 -1
  64. package/dist/index-CsNG_bzI.js +0 -1
@@ -1,15 +1,51 @@
1
- var we = Object.defineProperty;
2
- var ve = (M, e, t) => e in M ? we(M, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : M[e] = t;
3
- var u = (M, e, t) => ve(M, typeof e != "symbol" ? e + "" : e, t);
4
- import { D as K, e as b, c as m, r as $, b as E, f as Z, t as V, a as h, h as de, M as ke, i as D, j, k as Se, C as H, l as z, m as Ie, n as te, o as ge, p as se, q as Te, s as We, u as re, v as ie, w as Y, x as _, y as pe, E as C, z as ee, A as Q, B as Re, F as Ee, G as be, H as Le, I as Ne, J as ue, K as fe, T as oe, L as ae, N as Ce, P as Be, Q as me, R as ye, U as ne, W as Oe, X as De, S as ce, Y as q, Z as Me, V as he, _ as Pe } from "./index-_3yxgNoj.mjs";
5
- import { cloneDeep as J, xor as Ae, 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, f as J, t as H, a as h, h as fe, M as Ie, i as P, j as ee, k as ge, C as j, l as _, m as Te, n as ie, o as We, p as oe, q as Re, s as Ee, u as ae, v as ne, w as Z, x as Q, E as N, y as se, z as X, A as be, B as me, F as ye, G as Le, H as Ce, I as Ne, J as Be, T as ce, K as he, L as Oe, N as De, P as we, Q as ve, R as le, U as Me, S as de, W as $, X as Pe, V as pe, Y as Ae } from "./index-C2tUvh2a.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
- import "xss";
9
8
  import "rbush";
9
+ import "xss";
10
10
  import "react-dom";
11
11
  import "react";
12
- class Fe {
12
+ class Ue {
13
+ constructor() {
14
+ u(this, "jobs", /* @__PURE__ */ new Map());
15
+ }
16
+ request(e, t, s, r, i) {
17
+ const o = this.jobs.get(e);
18
+ if ((o == null ? void 0 : o.src) === t) return;
19
+ this.cancel(e);
20
+ const a = { src: t };
21
+ this.jobs.set(e, a), (async () => {
22
+ if (this.jobs.get(e) !== a) return;
23
+ if (!r()) {
24
+ this.cancel(e);
25
+ return;
26
+ }
27
+ let c;
28
+ try {
29
+ c = await s();
30
+ } catch {
31
+ }
32
+ if (this.jobs.get(e) === a) {
33
+ if (!r()) {
34
+ this.cancel(e);
35
+ return;
36
+ }
37
+ c && (this.jobs.delete(e), i(c));
38
+ }
39
+ })();
40
+ }
41
+ cancel(e) {
42
+ this.jobs.delete(e);
43
+ }
44
+ clear() {
45
+ for (const e of this.jobs.keys()) this.cancel(e);
46
+ }
47
+ }
48
+ class xe {
13
49
  constructor(e) {
14
50
  u(this, "vNodes");
15
51
  u(this, "thread");
@@ -17,7 +53,7 @@ class Fe {
17
53
  u(this, "localWorkShapes", /* @__PURE__ */ new Map());
18
54
  u(this, "tmpOpt");
19
55
  u(this, "animationId");
20
- u(this, "syncUnitTime", K.syncOpt.interval);
56
+ u(this, "syncUnitTime", Y.syncOpt.interval);
21
57
  this.vNodes = e.vNodes, this.thread = e.thread;
22
58
  }
23
59
  createLocalWork(e) {
@@ -55,14 +91,14 @@ class Fe {
55
91
  clearAll() {
56
92
  this.thread.topLayer.children.length && (this.thread.topLayer.parent.children.forEach((e) => {
57
93
  e.name !== "viewport" && e.remove();
58
- }), $(
94
+ }), K(
59
95
  this.thread.serviceLayer,
60
96
  this.thread.serviceLayer.parent
61
97
  )), this.serviceWorkShapes.clear(), this.localWorkShapes.clear();
62
98
  }
63
99
  consumeDraw(e) {
64
100
  const { workId: t, dataType: s } = e;
65
- if (s === E.Service)
101
+ if (s === R.Service)
66
102
  this.activeServiceWorkShape(e);
67
103
  else {
68
104
  const r = t == null ? void 0 : t.toString(), i = r && this.localWorkShapes.get(r);
@@ -87,7 +123,7 @@ class Fe {
87
123
  createWorkShapeNode(e) {
88
124
  const { toolsType: t } = e;
89
125
  if (t === m.LaserPen)
90
- return Z({
126
+ return J({
91
127
  ...e,
92
128
  vNodes: this.vNodes,
93
129
  fullLayer: this.thread.topLayer,
@@ -120,7 +156,7 @@ class Fe {
120
156
  r && s && (w = this.setNodeKey(c, w, r, s)), this.serviceWorkShapes.set(c, w);
121
157
  }
122
158
  const l = this.serviceWorkShapes.get(c);
123
- 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));
159
+ 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));
124
160
  }
125
161
  computNextAnimationIndex(e, t) {
126
162
  var i;
@@ -184,7 +220,7 @@ class Fe {
184
220
  e && this.runAnimation(), t.size && t.forEach((n, c) => {
185
221
  s.push({
186
222
  type: h.Cursor,
187
- uid: c.split(de)[0],
223
+ uid: c.split(fe)[0],
188
224
  op: n.op,
189
225
  workState: n.workState,
190
226
  viewId: this.thread.viewId
@@ -209,7 +245,7 @@ class Fe {
209
245
  }
210
246
  consumeDrawAll(e) {
211
247
  const { workId: t, dataType: s } = e;
212
- if (s === E.Service)
248
+ if (s === R.Service)
213
249
  this.activeServiceWorkShape(e);
214
250
  else {
215
251
  const r = t == null ? void 0 : t.toString(), i = r && this.localWorkShapes.get(r);
@@ -223,7 +259,7 @@ class Fe {
223
259
  this.runAnimation();
224
260
  }
225
261
  }
226
- class xe {
262
+ class Ge {
227
263
  constructor(e) {
228
264
  u(this, "vNodes");
229
265
  u(this, "thread");
@@ -232,12 +268,12 @@ class xe {
232
268
  u(this, "batchEraserRemoveNodes", /* @__PURE__ */ new Set());
233
269
  u(this, "batchEraserWorks", /* @__PURE__ */ new Set());
234
270
  u(this, "tmpOpt");
235
- u(this, "syncUnitTime", K.syncOpt.interval);
271
+ u(this, "syncUnitTime", Y.syncOpt.interval);
236
272
  u(this, "fullWorkerDrawCount", 0);
237
273
  u(this, "drawWorkActiveId");
238
274
  u(this, "consumeCount", 0);
239
275
  u(this, "combineDrawActiveId");
240
- u(this, "eraserBatchScheduler", new ke());
276
+ u(this, "eraserBatchScheduler", new Ie());
241
277
  u(this, "disposeVNodeRevisionObserver");
242
278
  u(this, "bitmapEraserRenderQueue", Promise.resolve());
243
279
  u(this, "bitmapEraserRevalidationQueued", !1);
@@ -284,26 +320,25 @@ class xe {
284
320
  async updateSelector(e) {
285
321
  var f;
286
322
  const t = this.workShapes.get(
287
- D
323
+ P
288
324
  );
289
325
  if (!((f = t == null ? void 0 : t.selectIds) != null && f.length)) return;
290
326
  const { callback: s, ...r } = e, { updateSelectorOpt: i, willSerializeData: o, smoothSync: a } = r, n = await (t == null ? void 0 : t.updateSelector({
291
327
  updateSelectorOpt: i,
292
- selectIds: J(t.selectIds),
328
+ selectIds: te(t.selectIds),
293
329
  vNodes: this.vNodes,
294
330
  willSerializeData: o,
295
331
  worker: this
296
332
  })), c = /* @__PURE__ */ new Map();
297
333
  let d;
298
- n != null && n.selectIds && (d = Ae(t.selectIds, n.selectIds), n.selectIds.forEach((w) => {
334
+ n != null && n.selectIds && (d = Fe(t.selectIds, n.selectIds), n.selectIds.forEach((w) => {
299
335
  const k = this.vNodes.get(w);
300
336
  if (k) {
301
- const { toolsType: I, op: R, opt: g } = k;
337
+ const { toolsType: I, op: E, opt: g } = k;
302
338
  c.set(w, {
303
339
  opt: g,
304
340
  toolsType: I,
305
- ops: (R == null ? void 0 : R.length) && j(R) || void 0,
306
- previewMatrix: k.previewMatrix
341
+ ops: (E == null ? void 0 : E.length) && ee(E) || void 0
307
342
  });
308
343
  }
309
344
  }), t.selectIds = n.selectIds);
@@ -328,16 +363,16 @@ class xe {
328
363
  clearAll() {
329
364
  if (this.eraserBatchScheduler.cancel(), this.thread.localLayer.children.length && (this.thread.topLayer.parent.children.forEach((t) => {
330
365
  t.name !== "viewport" && t.remove();
331
- }), $(
366
+ }), K(
332
367
  this.thread.localLayer,
333
368
  this.thread.localLayer.parent
334
369
  )), this.workShapes.get(
335
- D
370
+ P
336
371
  )) {
337
372
  const t = [];
338
373
  t.push({
339
374
  type: h.Select,
340
- dataType: E.Local,
375
+ dataType: R.Local,
341
376
  selectIds: [],
342
377
  willSyncService: !1
343
378
  }), this.thread.post({ sp: t });
@@ -350,7 +385,7 @@ class xe {
350
385
  let i;
351
386
  for (const o of this.vNodes.curNodeMap.values()) {
352
387
  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 && Se([l, p], a) && d.workState === b.Done) {
388
+ if (c === m.Text && ge([l, p], a) && d.workState === b.Done) {
354
389
  i = n;
355
390
  break;
356
391
  }
@@ -373,7 +408,7 @@ class xe {
373
408
  }
374
409
  cursorHover(e) {
375
410
  const { opt: t, toolsType: s, point: r } = e, i = this.setFullWork({
376
- workId: H,
411
+ workId: j,
377
412
  toolsType: s,
378
413
  opt: t
379
414
  });
@@ -381,15 +416,15 @@ class xe {
381
416
  }
382
417
  cursorBlur() {
383
418
  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) => {
419
+ const e = this.getWorkShape(j);
420
+ e && ((t = e.selectIds) != null && t.length) && (e.cursorBlur(), this.clearWorkShapeNodeCache(j)), this.thread.fullLayer.parent.children.forEach((s) => {
386
421
  s.name === "Cursor_Hover_Id" && s.remove();
387
422
  });
388
423
  }
389
424
  async updateFullSelectWork(e) {
390
425
  var r, i, o, a, n;
391
426
  const t = this.workShapes.get(
392
- D
427
+ P
393
428
  ), { selectIds: s } = e;
394
429
  if (!(s != null && s.length)) {
395
430
  await this.blurSelector(e);
@@ -397,7 +432,7 @@ class xe {
397
432
  }
398
433
  if (!t) {
399
434
  this.setFullWork({
400
- workId: D,
435
+ workId: P,
401
436
  toolsType: m.Selector,
402
437
  opt: e.opt || (((r = this.tmpOpt) == null ? void 0 : r.toolsType) === m.Selector ? this.tmpOpt.toolsOpt : {})
403
438
  }) && await this.updateFullSelectWork(e);
@@ -415,7 +450,7 @@ class xe {
415
450
  scaleType: t.scaleType,
416
451
  type: h.Select,
417
452
  viewId: this.thread.viewId,
418
- dataType: E.Local,
453
+ dataType: R.Local,
419
454
  selectIds: s,
420
455
  selectRect: c,
421
456
  points: t.getChildrenPoints(),
@@ -435,7 +470,7 @@ class xe {
435
470
  }
436
471
  async removeSelector(e) {
437
472
  const { willSyncService: t, needUndoTicker: s } = e, r = [], i = [], o = this.workShapes.get(
438
- D
473
+ P
439
474
  );
440
475
  if (!o)
441
476
  return;
@@ -449,7 +484,7 @@ class xe {
449
484
  type: h.TextUpdate,
450
485
  toolsType: m.Text,
451
486
  workId: n,
452
- dataType: E.Local
487
+ dataType: R.Local
453
488
  });
454
489
  break;
455
490
  }
@@ -458,7 +493,7 @@ class xe {
458
493
  type: h.BackgroundSVGDelete,
459
494
  toolsType: m.BackgroundSVG,
460
495
  workId: n,
461
- dataType: E.Local,
496
+ dataType: R.Local,
462
497
  viewId: this.thread.viewId
463
498
  });
464
499
  break;
@@ -493,14 +528,14 @@ class xe {
493
528
  type: h.BackgroundSVGDelete,
494
529
  toolsType: m.BackgroundSVG,
495
530
  workId: e,
496
- dataType: E.Local,
531
+ dataType: R.Local,
497
532
  viewId: this.thread.viewId
498
533
  }
499
534
  ]
500
535
  }), (r = this.thread.fullLayer) == null || r.getElementsByName(e).forEach((i) => {
501
- i.remove(), z(i, this.thread.fullLayer.parent);
536
+ i.remove(), _(i, this.thread.fullLayer.parent);
502
537
  }), this.vNodes.delete(e)), this.workShapes.has(e) && (this.thread.localLayer.getElementsByName(e).forEach((i) => {
503
- i.remove(), z(i, this.thread.localLayer.parent);
538
+ i.remove(), _(i, this.thread.localLayer.parent);
504
539
  }), this.clearWorkShapeNodeCache(e));
505
540
  }
506
541
  setFullWork(e) {
@@ -520,27 +555,27 @@ class xe {
520
555
  }
521
556
  }
522
557
  async consumeFull(e) {
523
- var o, a, n;
558
+ var o, a;
524
559
  const t = (o = e.workId) == null ? void 0 : o.toString(), s = (a = e.updateNodeOpt) == null ? void 0 : a.eraserGeometryDelta;
525
560
  if (t) {
526
- const c = this.vNodes.get(t), d = e.ops && V(e.ops) || e.op || [];
561
+ const n = this.vNodes.get(t), c = e.ops && H(e.ops) || e.op || [];
527
562
  if (s) {
528
- if (!c || !e.centerPos || !Ie(
563
+ if (!n || !e.centerPos || !Te(
529
564
  this.vNodes,
530
565
  t,
531
566
  s,
532
- c,
533
- { op: d, centerPos: e.centerPos }
567
+ n,
568
+ { op: c, centerPos: e.centerPos }
534
569
  )) {
535
- te(this.vNodes, t);
570
+ ie(this.vNodes, t);
536
571
  return;
537
572
  }
538
- } else c && e.centerPos && ge(this.vNodes, t) && se(c.op, c.centerPos) !== se(d, e.centerPos) && te(this.vNodes, t);
573
+ } else n && e.centerPos && We(this.vNodes, t) && oe(n.op, n.centerPos) !== oe(c, e.centerPos) && ie(this.vNodes, t);
539
574
  }
540
- const r = this.setFullWork(e), i = e.ops && V(e.ops);
575
+ const r = this.setFullWork(e), i = e.ops && H(e.ops);
541
576
  if (r) {
542
- if (t && e.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(t).forEach((d) => {
543
- d.remove(), z(d, this.thread.localLayer.parent);
577
+ t && e.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(t).forEach((c) => {
578
+ c.remove(), _(c, this.thread.localLayer.parent);
544
579
  }), r.toolsType === m.BackgroundSVG ? r.consumeService({
545
580
  isFullWork: !0,
546
581
  replaceId: t
@@ -556,18 +591,9 @@ class xe {
556
591
  op: i,
557
592
  isFullWork: !0,
558
593
  replaceId: t
559
- }), t && ((n = e.opt) != null && n.matrix) && e.opt.matrix.some(
560
- (d, l) => d !== [1, 0, 0, 1, 0, 0][l]
561
- )) {
562
- const d = this.vNodes.getNodeRectFormShape(
563
- t,
564
- this.vNodes.get(t)
565
- );
566
- d && this.vNodes.setInfo(t, { rect: d });
567
- }
568
- e != null && e.updateNodeOpt && r.updataOptService(e.updateNodeOpt);
569
- const c = [];
570
- e.workId && this.workShapes.delete(e.workId.toString()), e.willSyncService && c.push({
594
+ }), e != null && e.updateNodeOpt && r.updataOptService(e.updateNodeOpt);
595
+ const n = [];
596
+ e.workId && this.workShapes.delete(e.workId.toString()), e.willSyncService && n.push({
571
597
  opt: e.opt,
572
598
  toolsType: e.toolsType,
573
599
  type: h.FullWork,
@@ -579,22 +605,22 @@ class xe {
579
605
  requestId: e.requestId,
580
606
  emitEventType: e.emitEventType,
581
607
  scenePath: e.scenePath
582
- }), e.isLockSentEventCursor && c.push({
608
+ }), e.isLockSentEventCursor && n.push({
583
609
  type: h.None,
584
610
  isLockSentEventCursor: !0,
585
611
  scenePath: e.scenePath
586
- }), e.needUndoTicker && c.push({
612
+ }), e.needUndoTicker && n.push({
587
613
  type: h.None,
588
614
  needUndoTicker: e.needUndoTicker,
589
615
  emitEventType: e.emitEventType,
590
616
  requestId: e.requestId,
591
617
  scenePath: e.scenePath
592
- }), c.length && this.thread.post({ sp: c });
618
+ }), n.length && this.thread.post({ sp: n });
593
619
  }
594
620
  }
595
621
  async colloctEffectSelectWork(e) {
596
622
  const t = this.workShapes.get(
597
- D
623
+ P
598
624
  ), { workId: s, msgType: r } = e;
599
625
  if (t && s && t.selectIds && t.selectIds.includes(s.toString())) {
600
626
  r === h.RemoveNode ? t.selectIds = t.selectIds.filter(
@@ -628,7 +654,7 @@ class xe {
628
654
  boxRect: this.thread.getSceneRect()
629
655
  });
630
656
  else {
631
- const o = s.ops && V(s.ops);
657
+ const o = s.ops && H(s.ops);
632
658
  r.consumeService({
633
659
  op: o,
634
660
  isFullWork: !0,
@@ -642,15 +668,15 @@ class xe {
642
668
  this.reRenderSelector(e);
643
669
  }
644
670
  hasSelector() {
645
- return this.workShapes.has(D);
671
+ return this.workShapes.has(P);
646
672
  }
647
673
  getSelector() {
648
- return this.workShapes.get(D);
674
+ return this.workShapes.get(P);
649
675
  }
650
676
  reRenderSelector(e = !1) {
651
677
  var r;
652
678
  const t = this.workShapes.get(
653
- D
679
+ P
654
680
  );
655
681
  if (!t) return;
656
682
  if (t && !((r = t.selectIds) != null && r.length))
@@ -687,10 +713,10 @@ class xe {
687
713
  async blurSelector(e) {
688
714
  var r;
689
715
  const t = this.workShapes.get(
690
- D
716
+ P
691
717
  ), s = t == null ? void 0 : t.blurSelector();
692
- if (this.clearWorkShapeNodeCache(D), ((r = this.thread.fullLayer) == null ? void 0 : r.parent).children.forEach((i) => {
693
- i.name === D && i.remove();
718
+ if (this.clearWorkShapeNodeCache(P), ((r = this.thread.fullLayer) == null ? void 0 : r.parent).children.forEach((i) => {
719
+ i.name === P && i.remove();
694
720
  }), s) {
695
721
  const i = [];
696
722
  i.push({
@@ -755,7 +781,7 @@ class xe {
755
781
  for (const [p, f] of i)
756
782
  l.push({
757
783
  type: h.UpdateNode,
758
- dataType: E.Local,
784
+ dataType: R.Local,
759
785
  opt: f.opt,
760
786
  workId: p,
761
787
  updateNodeOpt: {
@@ -803,9 +829,9 @@ class xe {
803
829
  for (const [d, l] of i)
804
830
  c.push({
805
831
  type: h.FullWork,
806
- dataType: E.Local,
832
+ dataType: R.Local,
807
833
  toolsType: l.toolsType,
808
- ops: j(l.op),
834
+ ops: ee(l.op),
809
835
  opt: l.opt,
810
836
  workId: d,
811
837
  updateNodeOpt: {
@@ -861,7 +887,7 @@ class xe {
861
887
  scenePath: i,
862
888
  viewId: this.thread.viewId,
863
889
  msgType: h.DrawWork,
864
- dataType: E.Local
890
+ dataType: R.Local
865
891
  },
866
892
  t
867
893
  );
@@ -872,10 +898,10 @@ class xe {
872
898
  scenePath: i,
873
899
  viewId: this.thread.viewId,
874
900
  msgType: h.DrawWork,
875
- dataType: E.Local
901
+ dataType: R.Local
876
902
  },
877
903
  t
878
- ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && n !== D && (this.drawWorkActiveId = n), G(o) && (this.consumeCount = o), d) {
904
+ ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && n !== P && (this.drawWorkActiveId = n), z(o) && (this.consumeCount = o), d) {
879
905
  case m.Selector: {
880
906
  const l = c.consume({
881
907
  data: e,
@@ -906,7 +932,7 @@ class xe {
906
932
  e.needUndoTicker,
907
933
  e.collectUndoTicker
908
934
  );
909
- }, Te(this.thread.master.maxCombineEraserTime));
935
+ }, Re(this.thread.master.maxCombineEraserTime));
910
936
  break;
911
937
  }
912
938
  case m.BitMapEraser: {
@@ -991,18 +1017,18 @@ class xe {
991
1017
  ...r
992
1018
  };
993
1019
  if (i != null && i.rect) {
994
- const I = We(i.rect);
1020
+ const I = Ee(i.rect);
995
1021
  (a = k.render) == null || a.push(
996
1022
  {
997
1023
  rect: I,
998
1024
  isClear: !0,
999
- clearCanvas: re.Bg,
1025
+ clearCanvas: ae.Bg,
1000
1026
  viewId: this.thread.viewId,
1001
1027
  eraseTxnId: e
1002
1028
  },
1003
1029
  {
1004
1030
  rect: I,
1005
- drawCanvas: re.Bg,
1031
+ drawCanvas: ae.Bg,
1006
1032
  viewId: this.thread.viewId,
1007
1033
  eraseTxnId: e
1008
1034
  }
@@ -1020,13 +1046,13 @@ class xe {
1020
1046
  needUndoTicker: t,
1021
1047
  collectUndoTicker: s
1022
1048
  })), f != null && f.size)
1023
- for (const [I, R] of f)
1049
+ for (const [I, E] of f)
1024
1050
  (l = k.sp) == null || l.push({
1025
1051
  type: h.FullWork,
1026
- dataType: E.Local,
1027
- toolsType: R.toolsType,
1028
- ops: j(R.op),
1029
- opt: R.opt,
1052
+ dataType: R.Local,
1053
+ toolsType: E.toolsType,
1054
+ ops: ee(E.op),
1055
+ opt: E.opt,
1030
1056
  workId: I,
1031
1057
  updateNodeOpt: {
1032
1058
  useAnimation: !1
@@ -1052,7 +1078,7 @@ class xe {
1052
1078
  if (p === m.LaserPen)
1053
1079
  return;
1054
1080
  p === m.BitMapEraser && await this.bitmapEraserRenderQueue;
1055
- const f = this.workShapes.get(H), w = (a = f == null ? void 0 : f.selectIds) == null ? void 0 : a[0], k = await l.consumeAll({ data: e, workerEngine: this });
1081
+ 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 });
1056
1082
  switch (p) {
1057
1083
  case m.Selector:
1058
1084
  {
@@ -1104,7 +1130,7 @@ class xe {
1104
1130
  scenePath: r
1105
1131
  }), k) {
1106
1132
  const g = p === m.Pencil && k.type === h.RemoveNode;
1107
- g ? $(
1133
+ g ? K(
1108
1134
  this.thread.localLayer,
1109
1135
  this.thread.localLayer.parent
1110
1136
  ) : I.push({
@@ -1140,7 +1166,7 @@ class xe {
1140
1166
  if ((t = this.tmpOpt) != null && t.toolsType && this.tmpOpt.toolsType !== e.toolsType) {
1141
1167
  this.eraserBatchScheduler.cancel();
1142
1168
  for (const [r, i] of this.workShapes)
1143
- r !== D && (i.clearTmpPoints(), this.workShapes.delete(r));
1169
+ r !== P && (i.clearTmpPoints(), this.workShapes.delete(r));
1144
1170
  }
1145
1171
  this.tmpOpt = e, (s = e.toolsOpt) != null && s.syncUnitTime && (this.syncUnitTime = e.toolsOpt.syncUnitTime);
1146
1172
  }
@@ -1153,7 +1179,7 @@ class xe {
1153
1179
  t.syncUnitTime || (t.syncUnitTime = this.syncUnitTime), s == null || s.setWorkOptions(t);
1154
1180
  }
1155
1181
  createWorkShapeNode(e) {
1156
- return Z(
1182
+ return J(
1157
1183
  {
1158
1184
  ...e,
1159
1185
  vNodes: this.vNodes,
@@ -1164,22 +1190,24 @@ class xe {
1164
1190
  );
1165
1191
  }
1166
1192
  }
1167
- class Ue {
1193
+ class qe {
1168
1194
  constructor(e) {
1169
1195
  u(this, "vNodes");
1170
1196
  u(this, "thread");
1171
1197
  u(this, "workShapes", /* @__PURE__ */ new Map());
1172
1198
  u(this, "selectorWorkShapes", /* @__PURE__ */ new Map());
1173
1199
  u(this, "willRunEffectSelectorIds", /* @__PURE__ */ new Set());
1174
- u(this, "syncUnitTime", K.syncOpt.interval);
1200
+ u(this, "syncUnitTime", Y.syncOpt.interval);
1175
1201
  u(this, "animationScheduler");
1176
1202
  u(this, "effectScheduler");
1177
- this.vNodes = e.vNodes, this.thread = e.thread, this.animationScheduler = new ie({
1203
+ u(this, "imageRecovery", new Ue());
1204
+ u(this, "readyImages", /* @__PURE__ */ new Map());
1205
+ this.vNodes = e.vNodes, this.thread = e.thread, this.animationScheduler = new ne({
1178
1206
  run: async () => {
1179
1207
  try {
1180
1208
  await this.animationDraw();
1181
1209
  } catch (t) {
1182
- throw Y(t, {
1210
+ throw Z(t, {
1183
1211
  business: "service-render",
1184
1212
  stage: "animation-draw"
1185
1213
  });
@@ -1191,12 +1219,12 @@ class Ue {
1191
1219
  business: "service-render",
1192
1220
  stage: "animation-draw"
1193
1221
  })
1194
- }), this.effectScheduler = new ie({
1222
+ }), this.effectScheduler = new ne({
1195
1223
  run: async () => {
1196
1224
  try {
1197
1225
  await this.effectRunSelector();
1198
1226
  } catch (t) {
1199
- throw Y(t, {
1227
+ throw Z(t, {
1200
1228
  business: "service-render",
1201
1229
  stage: "selector-effect"
1202
1230
  });
@@ -1217,9 +1245,9 @@ class Ue {
1217
1245
  this.animationScheduler.destroy(), this.effectScheduler.destroy(), this.clearAll();
1218
1246
  }
1219
1247
  clearAll() {
1220
- this.thread.serviceLayer.children.length && (this.thread.serviceLayer.parent.children.forEach((e) => {
1248
+ this.imageRecovery.clear(), this.readyImages.clear(), this.thread.serviceLayer.children.length && (this.thread.serviceLayer.parent.children.forEach((e) => {
1221
1249
  e.name !== "viewport" && e.remove();
1222
- }), $(
1250
+ }), K(
1223
1251
  this.thread.serviceLayer,
1224
1252
  this.thread.serviceLayer.parent
1225
1253
  )), this.workShapes.clear(), this.selectorWorkShapes.clear(), this.willRunEffectSelectorIds.clear();
@@ -1246,7 +1274,7 @@ class Ue {
1246
1274
  removeWork(e) {
1247
1275
  const { workId: t } = e, s = t == null ? void 0 : t.toString();
1248
1276
  if (s) {
1249
- if (this.workShapes.get(s)) {
1277
+ if (this.imageRecovery.cancel(s), this.readyImages.delete(s), this.workShapes.get(s)) {
1250
1278
  this.workShapes.delete(s), this.removeNode(s, e);
1251
1279
  return;
1252
1280
  }
@@ -1284,7 +1312,7 @@ class Ue {
1284
1312
  );
1285
1313
  }
1286
1314
  async animationDraw() {
1287
- var r, i, o, a, n, c, d, l, p, f, w, k, I, R, g, y, S, T, L, N, A;
1315
+ var r, i, o, a, n, c, d, l, p, f, w, k, I, E, g, y, S, T, C, L, O, A;
1288
1316
  let e = !1;
1289
1317
  const t = /* @__PURE__ */ new Map(), s = [];
1290
1318
  for (const [W, v] of this.workShapes.entries())
@@ -1293,36 +1321,66 @@ class Ue {
1293
1321
  (r = v.node) == null || r.consumeService({
1294
1322
  isFullWork: !0,
1295
1323
  replaceId: W
1296
- }), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1297
- var P;
1298
- (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1324
+ }), this.selectorWorkShapes.forEach((B, F) => {
1325
+ var M;
1326
+ (M = B.selectIds) != null && M.includes(W) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1299
1327
  }), this.workShapes.delete(W);
1300
1328
  break;
1301
1329
  }
1302
1330
  case m.Image: {
1303
- await ((i = v.node) == null ? void 0 : i.consumeServiceAsync({
1331
+ 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);
1332
+ this.readyImages.delete(W);
1333
+ const x = U && U.src === M && U.image || M && this.thread.getCachedImages(M) || null;
1334
+ await ((o = v.node) == null ? void 0 : o.consumeServiceAsync({
1304
1335
  isFullWork: !0,
1305
- worker: this
1306
- })), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1307
- var P;
1308
- (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1336
+ worker: this,
1337
+ imageSourceOverride: x
1338
+ })), M && !x ? this.imageRecovery.request(
1339
+ W,
1340
+ M,
1341
+ () => this.thread.loadImageBitMap({
1342
+ toolsType: m.Image,
1343
+ opt: B,
1344
+ workId: W,
1345
+ timeoutMs: 15e3
1346
+ }),
1347
+ () => {
1348
+ const G = this.vNodes.get(W), V = this.workShapes.get(W);
1349
+ return (G == null ? void 0 : G.toolsType) === m.Image && this.thread.getImageSourceKey(G.opt) === M && (!V || !!V.node && this.thread.getImageSourceKey(
1350
+ V.node.getWorkOptions()
1351
+ ) === M);
1352
+ },
1353
+ (G) => {
1354
+ const V = this.vNodes.get(W);
1355
+ V && (this.readyImages.set(W, { src: M, image: G }), this.consumeFull({
1356
+ msgType: h.FullWork,
1357
+ dataType: R.Service,
1358
+ viewId: this.thread.viewId,
1359
+ workId: W,
1360
+ toolsType: m.Image,
1361
+ opt: V.opt
1362
+ }));
1363
+ }
1364
+ ) : this.imageRecovery.cancel(W), this.selectorWorkShapes.forEach((G, V) => {
1365
+ var re;
1366
+ (re = G.selectIds) != null && re.includes(W) && (this.willRunEffectSelectorIds.add(V), this.runEffect());
1309
1367
  }), this.workShapes.delete(W);
1310
1368
  break;
1311
1369
  }
1312
1370
  case m.Text: {
1313
- v.node && (await ((o = v.node) == null ? void 0 : o.consumeServiceAsync({
1371
+ v.node && (await ((a = v.node) == null ? void 0 : a.consumeServiceAsync({
1314
1372
  isFullWork: !0,
1315
1373
  replaceId: W,
1316
1374
  boxRect: this.thread.getSceneRect()
1317
- })), this.syncMatrixRect(W, v.node), this.selectorWorkShapes.forEach((B, O) => {
1318
- var P;
1319
- (P = B.selectIds) != null && P.includes(W) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1375
+ })), this.selectorWorkShapes.forEach((B, F) => {
1376
+ var M;
1377
+ (M = B.selectIds) != null && M.includes(W) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1320
1378
  }), v.refreshTextRender && v.requestId && s.push({
1321
1379
  type: h.RefreshTextRender,
1322
1380
  requestId: v.requestId,
1323
1381
  workId: W,
1324
1382
  viewId: this.thread.viewId
1325
- }), (a = v.node) == null || a.clearTmpPoints(), this.workShapes.delete(W));
1383
+ }), (n = v.node) == null || n.clearTmpPoints(), this.workShapes.delete(W));
1326
1384
  break;
1327
1385
  }
1328
1386
  case m.Arrow:
@@ -1333,23 +1391,23 @@ class Ue {
1333
1391
  case m.Polygon:
1334
1392
  case m.SpeechBalloon: {
1335
1393
  const B = !!v.ops;
1336
- if ((n = v.animationWorkData) != null && n.length) {
1337
- const O = v.oldRect;
1338
- (c = v.node) == null || c.consumeService({
1394
+ if ((c = v.animationWorkData) != null && c.length) {
1395
+ const F = v.oldRect;
1396
+ (d = v.node) == null || d.consumeService({
1339
1397
  op: v.animationWorkData,
1340
1398
  isFullWork: B
1341
- }), B && this.syncMatrixRect(W, v.node), B && (this.selectorWorkShapes.forEach((P, F) => {
1399
+ }), B && (this.selectorWorkShapes.forEach((M, U) => {
1342
1400
  var x;
1343
- (x = P.selectIds) != null && x.includes(W) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1344
- }), (d = v.node) == null || d.clearTmpPoints(), this.workShapes.delete(W)), v.isEnableCursor ? t.set(W, {
1345
- cursorTool: _(v.toolsType),
1346
- workState: O ? v.ops ? b.Done : b.Doing : b.Start,
1401
+ (x = M.selectIds) != null && x.includes(W) && (this.willRunEffectSelectorIds.add(U), this.runEffect());
1402
+ }), (l = v.node) == null || l.clearTmpPoints(), this.workShapes.delete(W)), v.isEnableCursor ? t.set(W, {
1403
+ cursorTool: Q(v.toolsType),
1404
+ workState: F ? v.ops ? b.Done : b.Doing : b.Start,
1347
1405
  op: v.animationWorkData.slice(-3, -1)
1348
- }) : B && !v.useAnimation && ((l = v.updateNodeOpt) != null && l.useAnimation) && t.set(W, {
1349
- cursorTool: _(v.toolsType),
1406
+ }) : B && !v.useAnimation && ((p = v.updateNodeOpt) != null && p.useAnimation) && t.set(W, {
1407
+ cursorTool: Q(v.toolsType),
1350
1408
  workState: b.Done,
1351
1409
  op: v.animationWorkData.slice(-3, -1),
1352
- uid: (p = v.updateNodeOpt) == null ? void 0 : p.uid
1410
+ uid: (f = v.updateNodeOpt) == null ? void 0 : f.uid
1353
1411
  }), v.animationWorkData.length = 0;
1354
1412
  }
1355
1413
  break;
@@ -1358,60 +1416,60 @@ class Ue {
1358
1416
  if (v.useAnimation) {
1359
1417
  if (v.useAnimation) {
1360
1418
  if (v.isDel) {
1361
- (y = v.node) == null || y.clearTmpPoints(), this.workShapes.delete(W);
1419
+ (S = v.node) == null || S.clearTmpPoints(), this.workShapes.delete(W);
1362
1420
  break;
1363
1421
  }
1364
- const B = 3, O = this.computNextAnimationIndex(
1422
+ const B = 3, F = this.computNextAnimationIndex(
1365
1423
  v,
1366
1424
  B
1367
- ), P = v.isDiff ? 0 : Math.max(0, (v.animationIndex || 0) - B), F = (v.animationWorkData || []).slice(
1368
- P,
1369
- O
1370
- ), x = (T = (S = v.node) == null ? void 0 : S.getWorkId()) == null ? void 0 : T.toString();
1371
- if ((v.animationIndex || 0) < O || v.isDiff) {
1425
+ ), M = v.isDiff ? 0 : Math.max(0, (v.animationIndex || 0) - B), U = (v.animationWorkData || []).slice(
1426
+ M,
1427
+ F
1428
+ ), x = (C = (T = v.node) == null ? void 0 : T.getWorkId()) == null ? void 0 : C.toString();
1429
+ if ((v.animationIndex || 0) < F || v.isDiff) {
1372
1430
  if ((L = v.node) == null || L.consumeService({
1373
- op: F,
1431
+ op: U,
1374
1432
  isFullWork: !1
1375
- }), v.animationIndex = O, v.isDiff && (v.isDiff = !1), F.length && v.isEnableCursor) {
1376
- const X = F.slice(-3, -1);
1433
+ }), v.animationIndex = F, v.isDiff && (v.isDiff = !1), U.length && v.isEnableCursor) {
1434
+ const G = U.slice(-3, -1);
1377
1435
  t.set(W, {
1378
- cursorTool: _(v.toolsType),
1379
- workState: P === 0 ? b.Start : O === ((N = v.animationWorkData) == null ? void 0 : N.length) ? b.Done : b.Doing,
1380
- op: X
1436
+ cursorTool: Q(v.toolsType),
1437
+ workState: M === 0 ? b.Start : F === ((O = v.animationWorkData) == null ? void 0 : O.length) ? b.Done : b.Doing,
1438
+ op: G
1381
1439
  });
1382
1440
  }
1383
1441
  } else v.ops && ((A = v.node) == null || A.consumeService({
1384
1442
  op: v.animationWorkData || [],
1385
1443
  isFullWork: !0,
1386
1444
  replaceId: x
1387
- }), this.syncMatrixRect(x || W, v.node), v.isDel = !0, v.isEnableCursor && t.set(W, {
1388
- cursorTool: _(v.toolsType),
1445
+ }), v.isDel = !0, v.isEnableCursor && t.set(W, {
1446
+ cursorTool: Q(v.toolsType),
1389
1447
  workState: b.Done,
1390
- op: F.slice(-3, -1)
1448
+ op: U.slice(-3, -1)
1391
1449
  }));
1392
1450
  e = !0;
1393
1451
  break;
1394
1452
  }
1395
1453
  } else {
1396
1454
  const B = !!v.ops;
1397
- if ((f = v.node) == null || f.consumeService({
1455
+ if ((w = v.node) == null || w.consumeService({
1398
1456
  op: v.animationWorkData || [],
1399
1457
  isFullWork: B,
1400
1458
  replaceId: W
1401
- }), (w = v.node) == null || w.updataOptService(v.updateNodeOpt), B) {
1402
- if (this.syncMatrixRect(W, v.node), !v.isEnableCursor && ((k = v.updateNodeOpt) != null && k.useAnimation) && ((I = v.animationWorkData) != null && I.length)) {
1403
- const O = v.animationWorkData.slice(-3, -1);
1459
+ }), (k = v.node) == null || k.updataOptService(v.updateNodeOpt), B) {
1460
+ if (!v.isEnableCursor && ((I = v.updateNodeOpt) != null && I.useAnimation) && ((E = v.animationWorkData) != null && E.length)) {
1461
+ const F = v.animationWorkData.slice(-3, -1);
1404
1462
  t.set(W, {
1405
- cursorTool: _(v.toolsType),
1463
+ cursorTool: Q(v.toolsType),
1406
1464
  workState: b.Done,
1407
- op: O,
1408
- uid: (R = v.updateNodeOpt) == null ? void 0 : R.uid
1465
+ op: F,
1466
+ uid: (g = v.updateNodeOpt) == null ? void 0 : g.uid
1409
1467
  });
1410
1468
  }
1411
- this.selectorWorkShapes.forEach((O, P) => {
1412
- var F;
1413
- (F = O.selectIds) != null && F.includes(W) && (this.willRunEffectSelectorIds.add(P), this.runEffect());
1414
- }), (g = v.node) == null || g.clearTmpPoints(), this.workShapes.delete(W);
1469
+ this.selectorWorkShapes.forEach((F, M) => {
1470
+ var U;
1471
+ (U = F.selectIds) != null && U.includes(W) && (this.willRunEffectSelectorIds.add(M), this.runEffect());
1472
+ }), (y = v.node) == null || y.clearTmpPoints(), this.workShapes.delete(W);
1415
1473
  }
1416
1474
  }
1417
1475
  break;
@@ -1420,7 +1478,7 @@ class Ue {
1420
1478
  e && this.runAnimation(), t.size && t.forEach((W, v) => {
1421
1479
  s.push({
1422
1480
  type: h.Cursor,
1423
- uid: W.uid || v.split(de)[0],
1481
+ uid: W.uid || v.split(fe)[0],
1424
1482
  op: W.op,
1425
1483
  workState: W.workState,
1426
1484
  cursorTool: W.cursorTool,
@@ -1454,20 +1512,8 @@ class Ue {
1454
1512
  }
1455
1513
  return !1;
1456
1514
  }
1457
- syncMatrixRect(e, t) {
1458
- const s = t == null ? void 0 : t.getWorkOptions().matrix;
1459
- if (!s || pe(s).every(
1460
- (i, o) => i === [1, 0, 0, 1, 0, 0][o]
1461
- ))
1462
- return;
1463
- const r = this.vNodes.getNodeRectFormShape(
1464
- e,
1465
- this.vNodes.get(e)
1466
- );
1467
- r && this.vNodes.setInfo(e, { rect: r });
1468
- }
1469
1515
  activeWorkShape(e) {
1470
- var R, g, y, S;
1516
+ var E, g, y, S;
1471
1517
  const {
1472
1518
  workId: t,
1473
1519
  opt: s,
@@ -1484,7 +1530,7 @@ class Ue {
1484
1530
  } = e;
1485
1531
  if (!t)
1486
1532
  return;
1487
- const w = t.toString(), k = (R = this.vNodes.get(w)) == null ? void 0 : R.rect;
1533
+ const w = t.toString(), k = (E = this.vNodes.get(w)) == null ? void 0 : E.rect;
1488
1534
  if (!((g = this.workShapes) != null && g.has(w))) {
1489
1535
  let T = {
1490
1536
  toolsType: r,
@@ -1502,17 +1548,17 @@ class Ue {
1502
1548
  r && s && (T = this.setNodeKey(w, T, r, s)), (y = this.workShapes) == null || y.set(w, T);
1503
1549
  }
1504
1550
  const I = (S = this.workShapes) == null ? void 0 : S.get(w);
1505
- 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
+ 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(
1506
1552
  I.animationWorkData || [],
1507
1553
  n,
1508
1554
  I.toolsType
1509
1555
  ), 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);
1510
1556
  }
1511
1557
  removeNode(e, t) {
1512
- e.indexOf(D) > -1 && this.removeSelectWork(t), this.thread.fullLayer.getElementsByName(e).forEach((r) => {
1513
- r.remove(), z(r, this.thread.fullLayer.parent);
1558
+ e.indexOf(P) > -1 && this.removeSelectWork(t), this.thread.fullLayer.getElementsByName(e).forEach((r) => {
1559
+ r.remove(), _(r, this.thread.fullLayer.parent);
1514
1560
  }), this.thread.serviceLayer.getElementsByName(e).forEach((r) => {
1515
- r.remove(), z(r, this.thread.serviceLayer.parent);
1561
+ r.remove(), _(r, this.thread.serviceLayer.parent);
1516
1562
  });
1517
1563
  const s = this.vNodes.get(e);
1518
1564
  s && s.toolsType === m.BackgroundSVG && this.thread.post({
@@ -1521,7 +1567,7 @@ class Ue {
1521
1567
  type: h.BackgroundSVGDelete,
1522
1568
  toolsType: m.BackgroundSVG,
1523
1569
  workId: e,
1524
- dataType: E.Service,
1570
+ dataType: R.Service,
1525
1571
  viewId: this.thread.viewId
1526
1572
  }
1527
1573
  ]
@@ -1550,7 +1596,7 @@ class Ue {
1550
1596
  i && (n.type = i), n.node && n.node.getWorkId() !== a && n.node.setWorkId(a), n.selectIds = o || [];
1551
1597
  }
1552
1598
  setNodeKey(e, t, s, r) {
1553
- return t.toolsType = s, t.node = Z(
1599
+ return t.toolsType = s, t.node = J(
1554
1600
  {
1555
1601
  toolsType: s,
1556
1602
  toolsOpt: r,
@@ -1563,7 +1609,7 @@ class Ue {
1563
1609
  ), t;
1564
1610
  }
1565
1611
  }
1566
- class U {
1612
+ class q {
1567
1613
  constructor() {
1568
1614
  u(this, "localWork");
1569
1615
  u(this, "serviceWork");
@@ -1573,14 +1619,14 @@ class U {
1573
1619
  return this.threadEngine = e, this.localWork = e.localWork, this.serviceWork = e.serviceWork, this;
1574
1620
  }
1575
1621
  }
1576
- class Ge extends U {
1622
+ class ze extends q {
1577
1623
  constructor() {
1578
1624
  super(...arguments);
1579
- u(this, "emitEventType", C.CopyNode);
1625
+ u(this, "emitEventType", N.CopyNode);
1580
1626
  }
1581
1627
  async consume(t) {
1582
1628
  const { msgType: s, dataType: r, emitEventType: i } = t;
1583
- if (s === h.FullWork && r === E.Local && i === this.emitEventType)
1629
+ if (s === h.FullWork && r === R.Local && i === this.emitEventType)
1584
1630
  return await this.consumeForLocalWorker(t), !0;
1585
1631
  }
1586
1632
  async consumeForLocalWorker(t) {
@@ -1589,14 +1635,14 @@ class Ge extends U {
1589
1635
  s && await ((r = this.localWork) == null ? void 0 : r.consumeFull(t));
1590
1636
  }
1591
1637
  }
1592
- class qe extends U {
1638
+ class Ve extends q {
1593
1639
  constructor() {
1594
1640
  super(...arguments);
1595
- u(this, "emitEventType", C.SetColorNode);
1641
+ u(this, "emitEventType", N.SetColorNode);
1596
1642
  }
1597
1643
  async consume(t) {
1598
1644
  const { msgType: s, dataType: r, emitEventType: i } = t;
1599
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1645
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1600
1646
  return await this.consumeForLocalWorker(t), !0;
1601
1647
  }
1602
1648
  async consumeForLocalWorker(t) {
@@ -1611,7 +1657,7 @@ class qe extends U {
1611
1657
  needUndoTicker: c,
1612
1658
  requestId: d
1613
1659
  } = t;
1614
- s === D && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1660
+ s === P && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1615
1661
  updateSelectorOpt: r,
1616
1662
  willRefreshSelector: i,
1617
1663
  willSyncService: o,
@@ -1638,7 +1684,7 @@ class qe extends U {
1638
1684
  ...w,
1639
1685
  workId: f,
1640
1686
  type: h.TextUpdate,
1641
- dataType: E.Local,
1687
+ dataType: R.Local,
1642
1688
  willSyncService: !0,
1643
1689
  emitEventType: l,
1644
1690
  requestId: d,
@@ -1663,14 +1709,14 @@ class qe extends U {
1663
1709
  };
1664
1710
  }
1665
1711
  }
1666
- class ze extends U {
1712
+ class $e extends q {
1667
1713
  constructor() {
1668
1714
  super(...arguments);
1669
- u(this, "emitEventType", C.ZIndexNode);
1715
+ u(this, "emitEventType", N.ZIndexNode);
1670
1716
  }
1671
1717
  async consume(t) {
1672
1718
  const { msgType: s, dataType: r, emitEventType: i } = t;
1673
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1719
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1674
1720
  return await this.consumeForLocalWorker(t), !0;
1675
1721
  }
1676
1722
  async consumeForLocalWorker(t) {
@@ -1684,7 +1730,7 @@ class ze extends U {
1684
1730
  needUndoTicker: n,
1685
1731
  requestId: c
1686
1732
  } = t;
1687
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1733
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1688
1734
  updateSelectorOpt: r,
1689
1735
  willRefreshSelector: i,
1690
1736
  willSyncService: o,
@@ -1709,7 +1755,7 @@ class ze extends U {
1709
1755
  ...f,
1710
1756
  workId: p,
1711
1757
  type: h.BackgroundSVGUpdate,
1712
- dataType: E.Local,
1758
+ dataType: R.Local,
1713
1759
  updateNodeOpt: {
1714
1760
  useAnimation: !1
1715
1761
  },
@@ -1736,12 +1782,12 @@ class ze extends U {
1736
1782
  };
1737
1783
  }
1738
1784
  }
1739
- class Ve extends U {
1785
+ class _e extends q {
1740
1786
  constructor() {
1741
1787
  super(...arguments);
1742
- u(this, "emitEventType", C.TranslateNode);
1788
+ u(this, "emitEventType", N.TranslateNode);
1743
1789
  u(this, "updateSelectorCallback", (t) => {
1744
- var R;
1790
+ var E;
1745
1791
  const { param: s, postData: r, newServiceStore: i, workShapeNode: o, res: a, smoothSync: n } = t, {
1746
1792
  willSyncService: c,
1747
1793
  isSync: d,
@@ -1784,7 +1830,7 @@ class Ve extends U {
1784
1830
  ...T,
1785
1831
  workId: S,
1786
1832
  type: h.BackgroundSVGUpdate,
1787
- dataType: E.Local,
1833
+ dataType: R.Local,
1788
1834
  willSyncService: w === b.Done ? !0 : n,
1789
1835
  updateNodeOpt: y,
1790
1836
  needUndoTicker: g,
@@ -1793,7 +1839,7 @@ class Ve extends U {
1793
1839
  ...T,
1794
1840
  workId: S,
1795
1841
  type: h.TextUpdate,
1796
- dataType: E.Local,
1842
+ dataType: R.Local,
1797
1843
  willSyncService: w === b.Done ? !0 : n,
1798
1844
  updateNodeOpt: y,
1799
1845
  needUndoTicker: g,
@@ -1804,8 +1850,8 @@ class Ve extends U {
1804
1850
  type: h.UpdateNode,
1805
1851
  updateNodeOpt: {
1806
1852
  ...y,
1807
- eraserGeometryDelta: ee(
1808
- (R = this.localWork) == null ? void 0 : R.vNodes,
1853
+ eraserGeometryDelta: se(
1854
+ (E = this.localWork) == null ? void 0 : E.vNodes,
1809
1855
  S
1810
1856
  )
1811
1857
  },
@@ -1828,7 +1874,7 @@ class Ve extends U {
1828
1874
  }
1829
1875
  async consume(t) {
1830
1876
  const { msgType: s, dataType: r, emitEventType: i } = t;
1831
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1877
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1832
1878
  return await this.consumeForLocalWorker(t), !0;
1833
1879
  }
1834
1880
  async consumeForLocalWorker(t) {
@@ -1844,7 +1890,7 @@ class Ve extends U {
1844
1890
  smoothSync: d,
1845
1891
  needUndoTicker: l
1846
1892
  } = t;
1847
- 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({
1893
+ 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({
1848
1894
  updateSelectorOpt: r,
1849
1895
  willRefreshSelector: i,
1850
1896
  willSyncService: o,
@@ -1858,10 +1904,10 @@ class Ve extends U {
1858
1904
  })) : r.workState === b.Done && ((f = this.localWork) == null || f.vNodes.deleteLastTarget()));
1859
1905
  }
1860
1906
  }
1861
- class $e extends U {
1907
+ class He extends q {
1862
1908
  constructor() {
1863
1909
  super(...arguments);
1864
- u(this, "emitEventType", C.ScaleNode);
1910
+ u(this, "emitEventType", N.ScaleNode);
1865
1911
  u(this, "updateSelectorCallback", (t) => {
1866
1912
  var I;
1867
1913
  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;
@@ -1886,27 +1932,27 @@ class $e extends U {
1886
1932
  points: p === b.Done && i.getChildrenPoints() || void 0,
1887
1933
  textOpt: i.textOpt
1888
1934
  });
1889
- const R = {
1935
+ const E = {
1890
1936
  useAnimation: c.useAnimation || !1
1891
1937
  };
1892
- c.uid && (R.uid = c.uid);
1938
+ c.uid && (E.uid = c.uid);
1893
1939
  for (const [g, y] of a.entries())
1894
1940
  y.toolsType === m.BackgroundSVG && f.push({
1895
1941
  ...y,
1896
1942
  workId: g,
1897
1943
  type: h.BackgroundSVGUpdate,
1898
- dataType: E.Local,
1944
+ dataType: R.Local,
1899
1945
  willSyncService: p === b.Done ? !0 : n,
1900
- updateNodeOpt: R,
1946
+ updateNodeOpt: E,
1901
1947
  needUndoTicker: k,
1902
1948
  emitEventType: this.emitEventType
1903
1949
  }), y.toolsType === m.Text ? f.push({
1904
1950
  ...y,
1905
1951
  workId: g,
1906
1952
  type: h.TextUpdate,
1907
- dataType: E.Local,
1953
+ dataType: R.Local,
1908
1954
  willSyncService: p === b.Done ? !0 : n,
1909
- updateNodeOpt: R,
1955
+ updateNodeOpt: E,
1910
1956
  needUndoTicker: k,
1911
1957
  emitEventType: this.emitEventType
1912
1958
  }) : (n || p === b.Done) && f.push({
@@ -1914,8 +1960,8 @@ class $e extends U {
1914
1960
  workId: g,
1915
1961
  type: h.UpdateNode,
1916
1962
  updateNodeOpt: {
1917
- ...R,
1918
- eraserGeometryDelta: ee(
1963
+ ...E,
1964
+ eraserGeometryDelta: se(
1919
1965
  (I = this.localWork) == null ? void 0 : I.vNodes,
1920
1966
  g
1921
1967
  )
@@ -1939,7 +1985,7 @@ class $e extends U {
1939
1985
  }
1940
1986
  async consume(t) {
1941
1987
  const { msgType: s, dataType: r, emitEventType: i } = t;
1942
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
1988
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
1943
1989
  return await this.consumeForLocalWorker(t), !0;
1944
1990
  }
1945
1991
  async consumeForLocalWorker(t) {
@@ -1952,7 +1998,7 @@ class $e extends U {
1952
1998
  smoothSync: a,
1953
1999
  needUndoTicker: n
1954
2000
  } = t;
1955
- s === D && r && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
2001
+ s === P && r && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1956
2002
  updateSelectorOpt: r,
1957
2003
  willSyncService: i,
1958
2004
  willSerializeData: o,
@@ -1963,10 +2009,10 @@ class $e extends U {
1963
2009
  }));
1964
2010
  }
1965
2011
  }
1966
- class _e extends U {
2012
+ class Ke extends q {
1967
2013
  constructor() {
1968
2014
  super(...arguments);
1969
- u(this, "emitEventType", C.RotateNode);
2015
+ u(this, "emitEventType", N.RotateNode);
1970
2016
  u(this, "updateSelectorCallback", (t) => {
1971
2017
  var g;
1972
2018
  const { param: s, postData: r, workShapeNode: i, res: o, newServiceStore: a, smoothSync: n } = t, {
@@ -1975,7 +2021,7 @@ class _e extends U {
1975
2021
  willSerializeData: l,
1976
2022
  isSync: p,
1977
2023
  needUndoTicker: f
1978
- } = s, w = c.workState, k = r.sp || [], I = o == null ? void 0 : o.selectRect, R = w === b.Done ? f : void 0;
2024
+ } = s, w = c.workState, k = r.sp || [], I = o == null ? void 0 : o.selectRect, E = w === b.Done ? f : void 0;
1979
2025
  if (d) {
1980
2026
  l && w === b.Done && k.push({
1981
2027
  type: h.Select,
@@ -1996,13 +2042,13 @@ class _e extends U {
1996
2042
  type: h.UpdateNode,
1997
2043
  updateNodeOpt: {
1998
2044
  ...y,
1999
- eraserGeometryDelta: ee(
2045
+ eraserGeometryDelta: se(
2000
2046
  (g = this.localWork) == null ? void 0 : g.vNodes,
2001
2047
  S
2002
2048
  )
2003
2049
  },
2004
2050
  isSync: p,
2005
- needUndoTicker: R,
2051
+ needUndoTicker: E,
2006
2052
  emitEventType: this.emitEventType
2007
2053
  });
2008
2054
  }
@@ -2020,7 +2066,7 @@ class _e extends U {
2020
2066
  }
2021
2067
  async consume(t) {
2022
2068
  const { msgType: s, dataType: r, emitEventType: i } = t;
2023
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2069
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2024
2070
  return await this.consumeForLocalWorker(t), !0;
2025
2071
  }
2026
2072
  async consumeForLocalWorker(t) {
@@ -2035,7 +2081,7 @@ class _e extends U {
2035
2081
  smoothSync: c,
2036
2082
  needUndoTicker: d
2037
2083
  } = t;
2038
- s === D && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
2084
+ s === P && r && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
2039
2085
  updateSelectorOpt: r,
2040
2086
  willRefreshSelector: i,
2041
2087
  willSyncService: o,
@@ -2048,14 +2094,14 @@ class _e extends U {
2048
2094
  }));
2049
2095
  }
2050
2096
  }
2051
- class He extends U {
2097
+ class Qe extends q {
2052
2098
  constructor() {
2053
2099
  super(...arguments);
2054
- u(this, "emitEventType", C.SetFontStyle);
2100
+ u(this, "emitEventType", N.SetFontStyle);
2055
2101
  }
2056
2102
  async consume(t) {
2057
2103
  const { msgType: s, dataType: r, emitEventType: i } = t;
2058
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2104
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2059
2105
  return await this.consumeForLocalWorker(t), !0;
2060
2106
  }
2061
2107
  async consumeForLocalWorker(t) {
@@ -2069,7 +2115,7 @@ class He extends U {
2069
2115
  textUpdateForWoker: n,
2070
2116
  requestId: c
2071
2117
  } = t;
2072
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2118
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2073
2119
  updateSelectorOpt: r,
2074
2120
  willRefreshSelector: i,
2075
2121
  willSyncService: o,
@@ -2098,17 +2144,17 @@ class He extends U {
2098
2144
  isSync: c,
2099
2145
  points: o.getChildrenPoints()
2100
2146
  });
2101
- for (const [I, R] of i.entries())
2102
- l && R.toolsType === m.Text ? w.push({
2103
- ...R,
2147
+ for (const [I, E] of i.entries())
2148
+ l && E.toolsType === m.Text ? w.push({
2149
+ ...E,
2104
2150
  workId: I,
2105
2151
  type: h.TextUpdate,
2106
- dataType: E.Local,
2152
+ dataType: R.Local,
2107
2153
  willSyncService: !0,
2108
2154
  emitEventType: f,
2109
2155
  requestId: p
2110
2156
  }) : w.push({
2111
- ...R,
2157
+ ...E,
2112
2158
  workId: I,
2113
2159
  type: h.UpdateNode,
2114
2160
  updateNodeOpt: {
@@ -2124,10 +2170,10 @@ class He extends U {
2124
2170
  };
2125
2171
  }
2126
2172
  }
2127
- class Qe extends U {
2173
+ class je extends q {
2128
2174
  constructor() {
2129
2175
  super(...arguments);
2130
- u(this, "emitEventType", C.SetPoint);
2176
+ u(this, "emitEventType", N.SetPoint);
2131
2177
  u(this, "updateSelectorCallback", (t) => {
2132
2178
  const { param: s, postData: r, newServiceStore: i, workShapeNode: o, res: a } = t, { willSyncService: n, isSync: c, needUndoTicker: d } = s, l = r.sp || [], p = a == null ? void 0 : a.selectRect;
2133
2179
  if (n && l) {
@@ -2166,7 +2212,7 @@ class Qe extends U {
2166
2212
  }
2167
2213
  async consume(t) {
2168
2214
  const { msgType: s, dataType: r, emitEventType: i } = t;
2169
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2215
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2170
2216
  return await this.consumeForLocalWorker(t), !0;
2171
2217
  }
2172
2218
  async consumeForLocalWorker(t) {
@@ -2180,7 +2226,7 @@ class Qe extends U {
2180
2226
  textUpdateForWoker: n,
2181
2227
  needUndoTicker: c
2182
2228
  } = t;
2183
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2229
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2184
2230
  updateSelectorOpt: r,
2185
2231
  willRefreshSelector: i,
2186
2232
  willSyncService: o,
@@ -2193,14 +2239,14 @@ class Qe extends U {
2193
2239
  }));
2194
2240
  }
2195
2241
  }
2196
- class Ke extends U {
2242
+ class Xe extends q {
2197
2243
  constructor() {
2198
2244
  super(...arguments);
2199
- u(this, "emitEventType", C.SetLock);
2245
+ u(this, "emitEventType", N.SetLock);
2200
2246
  }
2201
2247
  async consume(t) {
2202
2248
  const { msgType: s, dataType: r, emitEventType: i } = t;
2203
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2249
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2204
2250
  return await this.consumeForLocalWorker(t), !0;
2205
2251
  }
2206
2252
  async consumeForLocalWorker(t) {
@@ -2214,7 +2260,7 @@ class Ke extends U {
2214
2260
  needUndoTicker: n,
2215
2261
  requestId: c
2216
2262
  } = t;
2217
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2263
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2218
2264
  updateSelectorOpt: r,
2219
2265
  willRefreshSelector: i,
2220
2266
  willSyncService: o,
@@ -2235,9 +2281,9 @@ class Ke extends U {
2235
2281
  emitEventType: f
2236
2282
  } = s, w = r.sp || [], k = a == null ? void 0 : a.selectRect;
2237
2283
  if (n && w) {
2238
- for (const [I, R] of i.entries())
2284
+ for (const [I, E] of i.entries())
2239
2285
  w.push({
2240
- ...R,
2286
+ ...E,
2241
2287
  workId: I,
2242
2288
  type: h.UpdateNode,
2243
2289
  updateNodeOpt: {
@@ -2267,14 +2313,14 @@ class Ke extends U {
2267
2313
  };
2268
2314
  }
2269
2315
  }
2270
- class Xe extends U {
2316
+ class Ye extends q {
2271
2317
  constructor() {
2272
2318
  super(...arguments);
2273
- u(this, "emitEventType", C.SetShapeOpt);
2319
+ u(this, "emitEventType", N.SetShapeOpt);
2274
2320
  }
2275
2321
  async consume(t) {
2276
2322
  const { msgType: s, dataType: r, emitEventType: i } = t;
2277
- if (s === h.UpdateNode && r === E.Local && i === this.emitEventType)
2323
+ if (s === h.UpdateNode && r === R.Local && i === this.emitEventType)
2278
2324
  return await this.consumeForLocalWorker(t), !0;
2279
2325
  }
2280
2326
  async consumeForLocalWorker(t) {
@@ -2288,7 +2334,7 @@ class Xe extends U {
2288
2334
  needUndoTicker: n,
2289
2335
  requestId: c
2290
2336
  } = t;
2291
- s === D && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2337
+ s === P && r && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2292
2338
  updateSelectorOpt: r,
2293
2339
  willRefreshSelector: i,
2294
2340
  willSyncService: o,
@@ -2328,33 +2374,33 @@ class Xe extends U {
2328
2374
  };
2329
2375
  }
2330
2376
  }
2331
- class Ye {
2377
+ class Ze {
2332
2378
  constructor(e) {
2333
2379
  u(this, "builders", /* @__PURE__ */ new Map());
2334
2380
  this.builders = new Map(e.map((t) => [t, this.build(t)]));
2335
2381
  }
2336
2382
  build(e) {
2337
2383
  switch (e) {
2338
- case C.TranslateNode:
2339
- return new Ve();
2340
- case C.ZIndexNode:
2341
- return new ze();
2342
- case C.CopyNode:
2343
- return new Ge();
2344
- case C.SetColorNode:
2345
- return new qe();
2346
- case C.ScaleNode:
2347
- return new $e();
2348
- case C.RotateNode:
2384
+ case N.TranslateNode:
2349
2385
  return new _e();
2350
- case C.SetFontStyle:
2386
+ case N.ZIndexNode:
2387
+ return new $e();
2388
+ case N.CopyNode:
2389
+ return new ze();
2390
+ case N.SetColorNode:
2391
+ return new Ve();
2392
+ case N.ScaleNode:
2351
2393
  return new He();
2352
- case C.SetPoint:
2353
- return new Qe();
2354
- case C.SetLock:
2394
+ case N.RotateNode:
2355
2395
  return new Ke();
2356
- case C.SetShapeOpt:
2396
+ case N.SetFontStyle:
2397
+ return new Qe();
2398
+ case N.SetPoint:
2399
+ return new je();
2400
+ case N.SetLock:
2357
2401
  return new Xe();
2402
+ case N.SetShapeOpt:
2403
+ return new Ye();
2358
2404
  }
2359
2405
  }
2360
2406
  registerForMainThread(e) {
@@ -2369,14 +2415,14 @@ class Ye {
2369
2415
  return !1;
2370
2416
  }
2371
2417
  }
2372
- function Ze({
2373
- subThreads: M,
2418
+ function Je({
2419
+ subThreads: D,
2374
2420
  layers: e,
2375
2421
  scene: t,
2376
2422
  removeLayerTexture: s
2377
2423
  }) {
2378
2424
  let r;
2379
- for (const i of M)
2425
+ for (const i of D)
2380
2426
  try {
2381
2427
  i.destroy();
2382
2428
  } catch (o) {
@@ -2404,8 +2450,8 @@ function Ze({
2404
2450
  if (r)
2405
2451
  throw r;
2406
2452
  }
2407
- const je = 4;
2408
- class Je {
2453
+ const et = 4;
2454
+ class tt {
2409
2455
  constructor(e = {}) {
2410
2456
  u(this, "pendingFrames", /* @__PURE__ */ new Map());
2411
2457
  u(this, "failedCanvases", /* @__PURE__ */ new Set());
@@ -2417,7 +2463,7 @@ class Je {
2417
2463
  u(this, "destroyed", !1);
2418
2464
  this.tailFrameCount = Math.max(
2419
2465
  1,
2420
- Math.floor(e.tailFrameCount ?? je)
2466
+ Math.floor(e.tailFrameCount ?? et)
2421
2467
  ), this.requestFrame = e.requestFrame ?? ((t) => requestAnimationFrame(t)), this.cancelFrame = e.cancelFrame ?? ((t) => cancelAnimationFrame(t)), this.onReadbackError = e.onReadbackError;
2422
2468
  }
2423
2469
  markRendered(e) {
@@ -2448,7 +2494,7 @@ class Je {
2448
2494
  }
2449
2495
  }
2450
2496
  }
2451
- class et {
2497
+ class st {
2452
2498
  constructor(e, t) {
2453
2499
  u(this, "viewId");
2454
2500
  u(this, "fullLayer");
@@ -2484,50 +2530,60 @@ class et {
2484
2530
  ...t.canvasOpt,
2485
2531
  container: t.container
2486
2532
  }), this.master = t.master;
2487
- const s = K.bufferSize.full, r = K.bufferSize.sub;
2533
+ const s = Y.bufferSize.full, r = Y.bufferSize.sub;
2488
2534
  this.fullLayer = this.createLayer("fullLayer", this.scene, {
2489
2535
  ...t.layerOpt,
2490
- bufferSize: this.viewId === Q ? s : r * 2
2536
+ bufferSize: this.viewId === X ? s : r * 2
2491
2537
  }), this.topLayer = this.createLayer("topLayer", this.scene, {
2492
2538
  ...t.layerOpt,
2493
- bufferSize: (this.viewId === Q, r),
2539
+ bufferSize: (this.viewId === X, r),
2494
2540
  contextType: "2d"
2495
2541
  }), this.localLayer = this.createLayer("localLayer", this.scene, {
2496
2542
  ...t.layerOpt,
2497
- bufferSize: (this.viewId === Q, r),
2543
+ bufferSize: (this.viewId === X, r),
2498
2544
  contextType: "2d"
2499
2545
  }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, {
2500
2546
  ...t.layerOpt,
2501
- bufferSize: (this.viewId === Q, r),
2547
+ bufferSize: (this.viewId === X, r),
2502
2548
  contextType: "2d"
2503
2549
  }), t.mainThreadRenderMode === "readback" && this.enableCanvas2DReadback([
2504
2550
  this.fullLayer.parent,
2505
2551
  this.topLayer.parent,
2506
2552
  this.localLayer.parent,
2507
2553
  this.serviceLayer.parent
2508
- ]), this.vNodes = new Re(e, this.scene);
2554
+ ]), this.vNodes = new be(e, this.scene);
2509
2555
  const i = {
2510
2556
  thread: this,
2511
2557
  vNodes: this.vNodes
2512
2558
  };
2513
- this.localWork = new xe(i), this.serviceWork = new Ue(i), this.topWork = new Fe(i), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ye([
2514
- C.CopyNode,
2515
- C.SetColorNode,
2516
- C.DeleteNode,
2517
- C.RotateNode,
2518
- C.ScaleNode,
2519
- C.TranslateNode,
2520
- C.ZIndexNode,
2521
- C.SetFontStyle,
2522
- C.SetPoint,
2523
- C.SetLock,
2524
- C.SetShapeOpt
2559
+ this.localWork = new Ge(i), this.serviceWork = new qe(i), this.topWork = new xe(i), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ze([
2560
+ N.CopyNode,
2561
+ N.SetColorNode,
2562
+ N.DeleteNode,
2563
+ N.RotateNode,
2564
+ N.ScaleNode,
2565
+ N.TranslateNode,
2566
+ N.ZIndexNode,
2567
+ N.SetFontStyle,
2568
+ N.SetPoint,
2569
+ N.SetLock,
2570
+ N.SetShapeOpt
2525
2571
  ]).registerForMainThread(this);
2526
2572
  }
2527
2573
  getCachedImages(e) {
2528
2574
  var t;
2529
2575
  return (t = this.cacheImages.get(e)) == null ? void 0 : t.imageSource;
2530
2576
  }
2577
+ getImageSourceKey(e) {
2578
+ if (!e.src) return;
2579
+ if (e.type !== me.Iconify) return e.src;
2580
+ const [t, s] = this.getIconSize(
2581
+ e.width,
2582
+ e.height,
2583
+ this.opt.displayer.dpr
2584
+ );
2585
+ return ye(e.src, t, s, e.strokeColor);
2586
+ }
2531
2587
  getCachedImagesByWorkId(e) {
2532
2588
  for (const [t, s] of this.cacheImages.entries())
2533
2589
  if (t === e && s.imageSource)
@@ -2556,7 +2612,7 @@ class et {
2556
2612
  this.destroyed || (this.combinePostMsg.add(e), this.runBatchPostData());
2557
2613
  }
2558
2614
  reportRendererBusinessError(e, t) {
2559
- const s = Y(e, t);
2615
+ const s = Z(e, t);
2560
2616
  s.reported || (s.reported = !0, this.post({
2561
2617
  sp: [
2562
2618
  {
@@ -2566,7 +2622,7 @@ class et {
2566
2622
  reportErrorCode: "RENDERER_RUNTIME_ERROR",
2567
2623
  reportStage: s.stage,
2568
2624
  reportError: s.message,
2569
- reportString: Ee(s, t, {
2625
+ reportString: Le(s, t, {
2570
2626
  viewId: this.viewId,
2571
2627
  renderer: "mainThread"
2572
2628
  })
@@ -2598,12 +2654,12 @@ class et {
2598
2654
  imageBitmap: w,
2599
2655
  imageElement: k,
2600
2656
  workIds: I,
2601
- isLockSentEventCursor: R,
2657
+ isLockSentEventCursor: E,
2602
2658
  requestId: g
2603
2659
  } = e, y = l == null ? void 0 : l.toString();
2604
2660
  switch (a) {
2605
2661
  case h.UpdateDpr:
2606
- G(e.dpr) && this.updateDpr(e.dpr);
2662
+ z(e.dpr) && this.updateDpr(e.dpr);
2607
2663
  break;
2608
2664
  case h.AuthClear: {
2609
2665
  const { clearUids: S, localUid: T } = e;
@@ -2630,9 +2686,9 @@ class et {
2630
2686
  (o = this.serviceLayer) == null ? void 0 : o.parent
2631
2687
  ].filter(Boolean);
2632
2688
  try {
2633
- await Le(
2689
+ await Ne(
2634
2690
  (async () => {
2635
- await Ne(
2691
+ await Be(
2636
2692
  this.serviceWork,
2637
2693
  S
2638
2694
  );
@@ -2644,7 +2700,7 @@ class et {
2644
2700
  }
2645
2701
  );
2646
2702
  } catch (T) {
2647
- throw Y(T, {
2703
+ throw Z(T, {
2648
2704
  business: "service-sync-commit",
2649
2705
  stage: "flush-and-prepare-render"
2650
2706
  });
@@ -2666,7 +2722,7 @@ class et {
2666
2722
  }
2667
2723
  case h.UpdateCamera:
2668
2724
  try {
2669
- await be(
2725
+ await Ce(
2670
2726
  e.cameraTaskId,
2671
2727
  async (S) => {
2672
2728
  this.activeCameraTaskContext = S;
@@ -2706,11 +2762,11 @@ class et {
2706
2762
  }
2707
2763
  break;
2708
2764
  case h.DrawWork:
2709
- p === b.Done && d === E.Local ? (await this.consumeDrawAll(d, e), n === m.LaserPen && R && this.post({
2765
+ p === b.Done && d === R.Local ? (await this.consumeDrawAll(d, e), n === m.LaserPen && E && this.post({
2710
2766
  sp: [
2711
2767
  {
2712
2768
  type: h.None,
2713
- isLockSentEventCursor: R
2769
+ isLockSentEventCursor: E
2714
2770
  }
2715
2771
  ]
2716
2772
  })) : await this.consumeDraw(d, e);
@@ -2727,7 +2783,7 @@ class et {
2727
2783
  await this.removeNode(e);
2728
2784
  return;
2729
2785
  case h.Select:
2730
- d === E.Local || l === D ? await this.localWork.updateFullSelectWork(e) : d === E.Service && this.serviceWork.runSelectWork(e);
2786
+ d === R.Local || l === P ? await this.localWork.updateFullSelectWork(e) : d === R.Service && this.serviceWork.runSelectWork(e);
2731
2787
  break;
2732
2788
  case h.CursorBlur:
2733
2789
  this.localWork.cursorBlur();
@@ -2736,22 +2792,48 @@ class et {
2736
2792
  this.localWork.cursorHover(e);
2737
2793
  break;
2738
2794
  case h.GetTextActive:
2739
- d === E.Local && this.localWork.checkTextActive(e);
2795
+ d === R.Local && this.localWork.checkTextActive(e);
2740
2796
  break;
2741
2797
  case h.GetImageBitMap:
2742
- if (f && (w || k) && l) {
2798
+ if (f && l) {
2743
2799
  const S = this.imageResolveMap.get(f);
2744
2800
  if (!S || S.requestId !== g) {
2745
- this.closeImageSource(w || k);
2801
+ const L = w || k;
2802
+ if (L && !S && this.serviceWork) {
2803
+ const O = [
2804
+ ...this.vNodes.getNodesByType(m.Image)
2805
+ ].filter(
2806
+ ([, A]) => A.opt && this.getImageSourceKey(A.opt) === f
2807
+ );
2808
+ if (O.length && !this.cacheImages.has(f)) {
2809
+ this.cacheImages.set(f, {
2810
+ imageSource: L,
2811
+ workId: O[0][0]
2812
+ }), O.forEach(([A, W]) => {
2813
+ this.serviceWork.consumeFull({
2814
+ msgType: h.FullWork,
2815
+ dataType: R.Service,
2816
+ viewId: this.viewId,
2817
+ workId: A,
2818
+ toolsType: m.Image,
2819
+ opt: W.opt
2820
+ });
2821
+ });
2822
+ break;
2823
+ }
2824
+ }
2825
+ this.closeImageSource(L);
2746
2826
  break;
2747
2827
  }
2748
- const T = l.toString();
2749
- this.deleteCachedImagesByWorkId(T), this.cacheImages.set(f, {
2750
- imageSource: w || k,
2751
- workId: T
2752
- });
2753
- const { resolve: L, timer: N } = S;
2754
- N && clearTimeout(N), L && L(f);
2828
+ if (w || k) {
2829
+ const L = l.toString();
2830
+ this.deleteCachedImagesByWorkId(L), this.cacheImages.set(f, {
2831
+ imageSource: w || k,
2832
+ workId: L
2833
+ });
2834
+ }
2835
+ const { resolve: T, timer: C } = S;
2836
+ C && clearTimeout(C), T && T(f);
2755
2837
  }
2756
2838
  break;
2757
2839
  case h.GetVNodeInfo:
@@ -2761,7 +2843,7 @@ class et {
2761
2843
  sp: [
2762
2844
  {
2763
2845
  type: h.GetVNodeInfo,
2764
- dataType: E.Local,
2846
+ dataType: R.Local,
2765
2847
  workId: l,
2766
2848
  vInfo: S
2767
2849
  }
@@ -2777,16 +2859,12 @@ class et {
2777
2859
  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];
2778
2860
  }
2779
2861
  async loadImageBitMap(e) {
2780
- const { toolsType: t, opt: s, workId: r, requestId: i } = e;
2862
+ const { toolsType: t, opt: s, workId: r, requestId: i, timeoutMs: o } = e;
2781
2863
  if (t === m.Image && s && r) {
2782
- const o = r.toString(), { src: a, type: n, width: c, height: d, strokeColor: l } = s;
2783
- if (!a || !n || !c || !d)
2864
+ const a = r.toString(), { src: n, type: c, width: d, height: l } = s;
2865
+ if (!n || !c || !d || !l)
2784
2866
  return;
2785
- let p = a;
2786
- if (n === ue.Iconify) {
2787
- const [y, S] = this.getIconSize(c, d, this.opt.displayer.dpr);
2788
- p = fe(a, y, S, l);
2789
- }
2867
+ const p = this.getImageSourceKey(s);
2790
2868
  if (this.cacheImages.has(p)) {
2791
2869
  const y = this.getCachedImages(p);
2792
2870
  if (y)
@@ -2796,22 +2874,22 @@ class et {
2796
2874
  if (w)
2797
2875
  return await w.promise, this.getCachedImages(p);
2798
2876
  let k, I;
2799
- const R = new Promise((y, S) => {
2877
+ const E = new Promise((y, S) => {
2800
2878
  k = y, I = S;
2801
2879
  }), g = {
2802
2880
  resolve: k,
2803
2881
  reject: I,
2804
2882
  timer: void 0,
2805
2883
  requestId: i,
2806
- promise: R
2884
+ promise: E
2807
2885
  };
2808
2886
  return g.timer = setTimeout(() => {
2809
2887
  this.imageResolveMap.get(p) === g && k(p);
2810
- }, 5e3), this.imageResolveMap.set(p, g), this.opt.post({
2888
+ }, o ?? 5e3), this.imageResolveMap.set(p, g), this.opt.post({
2811
2889
  sp: [
2812
2890
  {
2813
2891
  imageSrc: p,
2814
- workId: o,
2892
+ workId: a,
2815
2893
  viewId: this.viewId,
2816
2894
  isgl: !!this.fullLayer.parent.gl,
2817
2895
  isSubWorker: !1,
@@ -2819,23 +2897,23 @@ class et {
2819
2897
  type: h.GetImageBitMap
2820
2898
  }
2821
2899
  ]
2822
- }), await R, this.imageResolveMap.get(p) === g && this.imageResolveMap.delete(p), this.getCachedImages(p);
2900
+ }), await E, this.imageResolveMap.get(p) === g && this.imageResolveMap.delete(p), this.getCachedImages(p);
2823
2901
  }
2824
2902
  }
2825
2903
  async removeNode(e) {
2826
2904
  const { dataType: t, workId: s, removeIds: r } = e, i = r || [];
2827
2905
  if (s && i.push(s.toString()), i.length)
2828
2906
  for (const o of i) {
2829
- if (o === D) {
2907
+ if (o === P) {
2830
2908
  await this.localWork.removeSelector(e);
2831
2909
  continue;
2832
2910
  }
2833
- t === E.Local ? this.localWork.removeWork(e) : t === E.Service && this.serviceWork.removeWork(e), await this.localWork.colloctEffectSelectWork(e);
2911
+ t === R.Local ? this.localWork.removeWork(e) : t === R.Service && this.serviceWork.removeWork(e), await this.localWork.colloctEffectSelectWork(e);
2834
2912
  }
2835
2913
  }
2836
2914
  async consumeFull(e, t) {
2837
2915
  const s = await this.localWork.colloctEffectSelectWork(t);
2838
- s && e === E.Local && await this.localWork.consumeFull(s), s && e === E.Service && this.serviceWork.consumeFull(s);
2916
+ s && e === R.Local && await this.localWork.consumeFull(s), s && e === R.Service && this.serviceWork.consumeFull(s);
2839
2917
  }
2840
2918
  setCameraOpt(e) {
2841
2919
  this.cameraOpt = e;
@@ -2862,13 +2940,13 @@ class et {
2862
2940
  };
2863
2941
  let c = !1;
2864
2942
  for (const d of e)
2865
- if (le(n, d)) {
2943
+ if (ue(n, d)) {
2866
2944
  c = !0;
2867
2945
  break;
2868
2946
  }
2869
2947
  c || e.push(n);
2870
2948
  }
2871
- G(o.fullWorkerDrawCount) && (t = o.fullWorkerDrawCount), G(o.consumeCount) && (s = o.consumeCount, r = o.consumeWorkId);
2949
+ z(o.fullWorkerDrawCount) && (t = o.fullWorkerDrawCount), z(o.consumeCount) && (s = o.consumeCount, r = o.consumeWorkId);
2872
2950
  }
2873
2951
  return this.combinePostMsg.clear(), {
2874
2952
  sp: e,
@@ -2898,7 +2976,7 @@ class et {
2898
2976
  clearAll() {
2899
2977
  this.cancelCameraSettledRender(), this.debounceUpdateCache.clear(), this.fullLayer.children.length && (this.fullLayer.parent.children.forEach((e) => {
2900
2978
  e.name !== "viewport" && e.remove();
2901
- }), $(this.fullLayer, this.fullLayer.parent)), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
2979
+ }), K(this.fullLayer, this.fullLayer.parent)), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
2902
2980
  sp: [
2903
2981
  {
2904
2982
  type: h.Clear
@@ -2911,12 +2989,12 @@ class et {
2911
2989
  if (r) {
2912
2990
  const i = r.toString();
2913
2991
  if (s && this.topWork.canUseTopLayer(s)) {
2914
- e === E.Local && (this.topWork.getLocalWorkShape(
2992
+ e === R.Local && (this.topWork.getLocalWorkShape(
2915
2993
  r.toString()
2916
2994
  ) || this.topWork.createLocalWork(t)), await this.topWork.consumeDrawAll(t);
2917
2995
  return;
2918
2996
  }
2919
- e === E.Local && (this.localWork.getWorkShape(i) || this.localWork.createLocalWork(t), await this.localWork.consumeDrawAll(t, this.serviceWork));
2997
+ e === R.Local && (this.localWork.getWorkShape(i) || this.localWork.createLocalWork(t), await this.localWork.consumeDrawAll(t, this.serviceWork));
2920
2998
  }
2921
2999
  }
2922
3000
  async consumeDraw(e, t) {
@@ -2924,10 +3002,10 @@ class et {
2924
3002
  if (r && i && s) {
2925
3003
  const o = r.toString();
2926
3004
  if (this.topWork.canUseTopLayer(i)) {
2927
- e === E.Local && (this.topWork.getLocalWorkShape(o) || this.topWork.createLocalWork(t)), this.topWork.consumeDraw(t);
3005
+ e === R.Local && (this.topWork.getLocalWorkShape(o) || this.topWork.createLocalWork(t)), this.topWork.consumeDraw(t);
2928
3006
  return;
2929
3007
  }
2930
- e === E.Local ? (this.localWork.getWorkShape(o) || this.localWork.createLocalWork(t), await this.localWork.consumeDraw(t, this.serviceWork)) : e === E.Service && this.serviceWork.consumeDraw(t);
3008
+ e === R.Local ? (this.localWork.getWorkShape(o) || this.localWork.createLocalWork(t), await this.localWork.consumeDraw(t, this.serviceWork)) : e === R.Service && this.serviceWork.consumeDraw(t);
2931
3009
  return;
2932
3010
  }
2933
3011
  }
@@ -2935,13 +3013,13 @@ class et {
2935
3013
  var d, l;
2936
3014
  const { cameraOpt: s, scenePath: r, cameraTaskId: i } = e;
2937
3015
  let o = !1;
2938
- const a = this.cameraOpt, n = !!(s && le(a, s));
3016
+ const a = this.cameraOpt, n = !!(s && ue(a, s));
2939
3017
  let c = !1;
2940
3018
  if (s && n) {
2941
3019
  const p = !!this.activeCameraSettledRender;
2942
3020
  if (this.retargetCameraSettledRender(i)) return;
2943
3021
  if (!p) {
2944
- G(i) && this.opt.post({
3022
+ z(i) && this.opt.post({
2945
3023
  viewId: this.viewId,
2946
3024
  viewGeneration: this.viewGeneration,
2947
3025
  cameraSettledTaskId: i
@@ -2957,8 +3035,8 @@ class et {
2957
3035
  let y;
2958
3036
  do {
2959
3037
  y = [];
2960
- for (const [T, L] of this.localWork.getWorkShapes().entries())
2961
- switch (L.toolsType) {
3038
+ for (const [T, C] of this.localWork.getWorkShapes().entries())
3039
+ switch (C.toolsType) {
2962
3040
  case m.Text:
2963
3041
  case m.BitMapEraser:
2964
3042
  case m.PencilEraser:
@@ -2967,14 +3045,14 @@ class et {
2967
3045
  case m.LaserPen:
2968
3046
  break;
2969
3047
  default:
2970
- T !== H && T !== D && y.push(`${T}:${L.toolsType}`);
3048
+ T !== j && T !== P && y.push(`${T}:${C.toolsType}`);
2971
3049
  break;
2972
3050
  }
2973
3051
  if (t && (t.stage = "blocking-works", t.blockingWorks = y), !y.length) break;
2974
3052
  if (!await new Promise((T) => {
2975
3053
  this.taskUpdateCameraResolve = T, this.taskUpdateCameraId = setTimeout(() => {
2976
3054
  this.taskUpdateCameraId = void 0, this.taskUpdateCameraResolve = void 0, T(!0);
2977
- }, oe);
3055
+ }, ce);
2978
3056
  }) || t != null && t.aborted) return;
2979
3057
  } while (y.length);
2980
3058
  t && (t.stage = "update-camera", t.blockingWorks = void 0);
@@ -2983,10 +3061,10 @@ class et {
2983
3061
  const f = /* @__PURE__ */ new Map();
2984
3062
  for (const [y, S] of this.vNodes.getNodesByType(m.Text).entries()) {
2985
3063
  const T = S.rect;
2986
- f.set(y, J(T));
3064
+ f.set(y, te(T));
2987
3065
  }
2988
3066
  for (const [y, S] of this.vNodes.gethasEraserNodes().entries())
2989
- f.set(y, J(S.rect));
3067
+ f.set(y, te(S.rect));
2990
3068
  const w = new Set(f.keys());
2991
3069
  let k = !1;
2992
3070
  if (this.localWork.hasSelector()) {
@@ -3009,26 +3087,26 @@ class et {
3009
3087
  }
3010
3088
  if (this.setCameraOpt(s), this.vNodes.curNodeMap.size) {
3011
3089
  this.vNodes.clearTarget(), this.vNodes.updateHighLevelNodesRect(w);
3012
- for (const [T, L] of f.entries()) {
3013
- const N = this.vNodes.get(T);
3014
- if (N) {
3015
- const A = L, W = N.rect, v = this.getSceneRect(), B = ae(A, v), O = ae(W, v);
3016
- let P = c;
3017
- (B !== O || A.w !== W.w || A.h !== W.h || O === Ce.intersect) && (P = !0);
3018
- const { toolsType: F, opt: x } = N, X = x.eraserlines && x.eraserlines.length > 0 || !!x.eraserFaces;
3019
- (P || p && X) && (F === m.Text || X) && this.debounceUpdateCache.add(T);
3090
+ for (const [T, C] of f.entries()) {
3091
+ const L = this.vNodes.get(T);
3092
+ if (L) {
3093
+ const O = C, A = L.rect, W = this.getSceneRect(), v = he(O, W), B = he(A, W);
3094
+ let F = c;
3095
+ (v !== B || O.w !== A.w || O.h !== A.h || B === Oe.intersect) && (F = !0);
3096
+ const { toolsType: M, opt: U } = L, x = U.eraserlines && U.eraserlines.length > 0 || !!U.eraserFaces;
3097
+ (F || p && x) && (M === m.Text || x) && this.debounceUpdateCache.add(T);
3020
3098
  }
3021
3099
  }
3022
3100
  if (k && this.localWork.reRenderSelector(), I)
3023
3101
  for (const [
3024
3102
  T,
3025
- L
3103
+ C
3026
3104
  ] of this.serviceWork.selectorWorkShapes.entries())
3027
3105
  this.serviceWork.runSelectWork({
3028
3106
  workId: T,
3029
- selectIds: L.selectIds,
3107
+ selectIds: C.selectIds,
3030
3108
  msgType: h.Select,
3031
- dataType: E.Service,
3109
+ dataType: R.Service,
3032
3110
  viewId: this.viewId
3033
3111
  });
3034
3112
  o = !0;
@@ -3040,44 +3118,44 @@ class et {
3040
3118
  this.debounceUpdateCameraId = void 0;
3041
3119
  try {
3042
3120
  if (!S()) return;
3043
- const L = [];
3044
- for (const W of this.debounceUpdateCache.values()) {
3045
- const v = (T = this.fullLayer) == null ? void 0 : T.getElementsByName(W)[0], B = this.vNodes.get(W);
3046
- if (B) {
3047
- const { toolsType: O, opt: P } = B;
3048
- if (v || O !== m.Text) {
3049
- const F = this.localWork.setFullWork({
3050
- toolsType: O,
3051
- opt: P,
3052
- workId: W
3121
+ const C = [];
3122
+ for (const A of this.debounceUpdateCache.values()) {
3123
+ const W = (T = this.fullLayer) == null ? void 0 : T.getElementsByName(A)[0], v = this.vNodes.get(A);
3124
+ if (v) {
3125
+ const { toolsType: B, opt: F } = v;
3126
+ if (W || B !== m.Text) {
3127
+ const M = this.localWork.setFullWork({
3128
+ toolsType: B,
3129
+ opt: F,
3130
+ workId: A
3053
3131
  });
3054
- if (F) {
3055
- if (O === m.Text)
3056
- L.push(
3057
- F.consumeServiceAsync({
3132
+ if (M) {
3133
+ if (B === m.Text)
3134
+ C.push(
3135
+ M.consumeServiceAsync({
3058
3136
  isFullWork: !0,
3059
- replaceId: W,
3137
+ replaceId: A,
3060
3138
  boxRect: this.getSceneRect(),
3061
3139
  isActive: S
3062
3140
  })
3063
3141
  );
3064
- else if (P.eraserlines && P.eraserlines.length > 0 || P.eraserFaces) {
3065
- const x = F.consumeService({
3066
- op: B.op,
3142
+ else if (F.eraserlines && F.eraserlines.length > 0 || F.eraserFaces) {
3143
+ const U = M.consumeService({
3144
+ op: v.op,
3067
3145
  isFullWork: !0,
3068
- replaceId: W,
3146
+ replaceId: A,
3069
3147
  workState: b.Done
3070
3148
  });
3071
- this.localWork.clearWorkShapeNodeCache(W), L.push(Promise.resolve(x));
3149
+ this.localWork.clearWorkShapeNodeCache(A), C.push(Promise.resolve(U));
3072
3150
  }
3073
3151
  }
3074
3152
  }
3075
3153
  }
3076
- this.debounceUpdateCache.delete(W);
3154
+ this.debounceUpdateCache.delete(A);
3077
3155
  }
3078
- if (await Promise.all(L), !S()) return;
3079
- this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds(), k && L.length && this.localWork.reRenderSelector();
3080
- const N = [
3156
+ if (await Promise.all(C), !S()) return;
3157
+ this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds();
3158
+ const L = [
3081
3159
  this.fullLayer.parent.prepareRender,
3082
3160
  this.topLayer.parent.prepareRender,
3083
3161
  this.localLayer.parent.prepareRender,
@@ -3088,63 +3166,63 @@ class et {
3088
3166
  this.topLayer.parent,
3089
3167
  this.localLayer.parent,
3090
3168
  this.serviceLayer.parent
3091
- ], await Promise.all(N), y.renderLayers = void 0, !S()) return;
3092
- const A = y.cameraTaskId;
3093
- G(A) && this.opt.post({
3169
+ ], await Promise.all(L), y.renderLayers = void 0, !S()) return;
3170
+ const O = y.cameraTaskId;
3171
+ z(O) && this.opt.post({
3094
3172
  viewId: this.viewId,
3095
3173
  viewGeneration: this.viewGeneration,
3096
- cameraSettledTaskId: A
3174
+ cameraSettledTaskId: O
3097
3175
  });
3098
- } catch (L) {
3176
+ } catch (C) {
3099
3177
  if (!S()) return;
3100
- const N = {
3178
+ const L = {
3101
3179
  code: "RENDERER_BUSINESS_ERROR",
3102
3180
  business: "updateCamera",
3103
- message: L instanceof Error ? L.message : String(L),
3181
+ message: C instanceof Error ? C.message : String(C),
3104
3182
  stage: "camera-settled-render",
3105
3183
  workerType: "mainThread"
3106
- }, A = y.cameraTaskId;
3107
- if (G(A))
3184
+ }, O = y.cameraTaskId;
3185
+ if (z(O))
3108
3186
  try {
3109
3187
  this.opt.post({
3110
3188
  viewId: this.viewId,
3111
3189
  viewGeneration: this.viewGeneration,
3112
- cameraTaskId: A,
3190
+ cameraTaskId: O,
3113
3191
  cameraTaskStatus: "failed",
3114
- cameraTaskError: N
3192
+ cameraTaskError: L
3115
3193
  });
3116
- } catch (W) {
3194
+ } catch (A) {
3117
3195
  console.error(
3118
- `[cameraSettledRender] failed ACK post failed viewId=${this.viewId} taskId=${A}`,
3119
- W
3196
+ `[cameraSettledRender] failed ACK post failed viewId=${this.viewId} taskId=${O}`,
3197
+ A
3120
3198
  );
3121
3199
  }
3122
3200
  } finally {
3123
3201
  y.renderLayers = void 0, this.activeCameraSettledRender === y && (this.activeCameraSettledRender = void 0);
3124
3202
  }
3125
- }, oe);
3203
+ }, ce);
3126
3204
  }
3127
- const R = [
3205
+ const E = [
3128
3206
  this.fullLayer.parent,
3129
3207
  this.topLayer.parent,
3130
3208
  this.localLayer.parent,
3131
3209
  this.serviceLayer.parent
3132
3210
  ], g = Promise.all(
3133
- R.map((y) => y.prepareRender)
3211
+ E.map((y) => y.prepareRender)
3134
3212
  );
3135
- if (t && !await Be(
3213
+ if (t && !await De(
3136
3214
  t,
3137
3215
  g,
3138
3216
  "prepare-render"
3139
3217
  )) {
3140
- R.filter(
3218
+ E.filter(
3141
3219
  (S) => S.cancelPendingRender()
3142
3220
  ).forEach((S) => S.render()), g.catch(() => {
3143
3221
  });
3144
3222
  return;
3145
3223
  }
3146
3224
  if (t || await g, t != null && t.aborted) return;
3147
- !o && G(i) && this.opt.post({
3225
+ !o && z(i) && this.opt.post({
3148
3226
  viewId: this.viewId,
3149
3227
  viewGeneration: this.viewGeneration,
3150
3228
  cameraSettledTaskId: i
@@ -3161,7 +3239,7 @@ class et {
3161
3239
  };
3162
3240
  }
3163
3241
  createScene(e) {
3164
- return new me({
3242
+ return new we({
3165
3243
  displayRatio: this.opt.displayer.dpr,
3166
3244
  depth: !1,
3167
3245
  desynchronized: !0,
@@ -3172,7 +3250,7 @@ class et {
3172
3250
  });
3173
3251
  }
3174
3252
  createLayer(e, t, s) {
3175
- const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, { ...s, offscreen: !1 }), n = new ye({
3253
+ const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, { ...s, offscreen: !1 }), n = new ve({
3176
3254
  anchor: [0.5, 0.5],
3177
3255
  pos: [r * 0.5, i * 0.5],
3178
3256
  size: [r, i],
@@ -3182,7 +3260,7 @@ class et {
3182
3260
  return a.append(n), n;
3183
3261
  }
3184
3262
  enableCanvas2DReadback(e) {
3185
- this.readbackScheduler = new Je({
3263
+ this.readbackScheduler = new tt({
3186
3264
  onReadbackError: (t) => this.opt.master.Logger.warn(
3187
3265
  `[Appliance]: [main-thread-readback] stage=failed viewId=${this.viewId} error=${t instanceof Error ? t.message : String(t)}`
3188
3266
  )
@@ -3220,7 +3298,7 @@ class et {
3220
3298
  }
3221
3299
  retargetCameraSettledRender(e) {
3222
3300
  var s;
3223
- if (!G(e)) return !1;
3301
+ if (!z(e)) return !1;
3224
3302
  const t = this.activeCameraSettledRender;
3225
3303
  return !t || t.cancelled || (s = t.context) != null && s.aborted ? !1 : (t.cameraTaskId = e, !0);
3226
3304
  }
@@ -3233,7 +3311,7 @@ class et {
3233
3311
  var e, t;
3234
3312
  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(
3235
3313
  new Error(`main-thread view destroyed: ${this.viewId}`)
3236
- ), this.vNodes.clear(), Ze({
3314
+ ), this.vNodes.clear(), Je({
3237
3315
  subThreads: [this.localWork, this.serviceWork, this.topWork],
3238
3316
  layers: [
3239
3317
  this.fullLayer,
@@ -3242,11 +3320,11 @@ class et {
3242
3320
  this.serviceLayer
3243
3321
  ],
3244
3322
  scene: this.scene,
3245
- removeLayerTexture: (s, r) => z(s, r)
3323
+ removeLayerTexture: (s, r) => _(s, r)
3246
3324
  }));
3247
3325
  }
3248
3326
  }
3249
- class tt {
3327
+ class rt {
3250
3328
  constructor(e, t) {
3251
3329
  u(this, "viewId");
3252
3330
  u(this, "fullLayer");
@@ -3267,7 +3345,7 @@ class tt {
3267
3345
  container: t.container
3268
3346
  }), this.master = t.master, this.fullLayer = this.createLayer("fullLayer", this.scene, {
3269
3347
  ...t.layerOpt,
3270
- bufferSize: this.viewId === Q ? 6e3 : 3e3,
3348
+ bufferSize: this.viewId === X ? 6e3 : 3e3,
3271
3349
  contextType: "2d"
3272
3350
  });
3273
3351
  }
@@ -3392,18 +3470,22 @@ class tt {
3392
3470
  return;
3393
3471
  }
3394
3472
  case h.GetImageBitMap: {
3395
- if (s && (r || i) && o) {
3396
- const n = o.toString(), c = this.imageResolveMap.get(s);
3397
- if (!c || c.requestId !== a) {
3473
+ if (s && o) {
3474
+ const n = this.imageResolveMap.get(s);
3475
+ if (!n || n.requestId !== a) {
3398
3476
  this.closeImageSource(r || i);
3399
3477
  break;
3400
3478
  }
3401
- if (this.deleteCachedImagesByWorkId(n), this.cacheImages.set(s, {
3402
- imageSource: r || i,
3403
- workId: n
3404
- }), c) {
3405
- const { resolve: d, timer: l } = c;
3406
- l && clearTimeout(l), d && d(s);
3479
+ if (r || i) {
3480
+ const c = o.toString();
3481
+ this.deleteCachedImagesByWorkId(c), this.cacheImages.set(s, {
3482
+ imageSource: r || i,
3483
+ workId: c
3484
+ });
3485
+ }
3486
+ if (n) {
3487
+ const { resolve: c, timer: d } = n;
3488
+ d && clearTimeout(d), c && c(s);
3407
3489
  }
3408
3490
  }
3409
3491
  break;
@@ -3421,9 +3503,9 @@ class tt {
3421
3503
  if (!a || !n || !c || !d)
3422
3504
  return;
3423
3505
  let p = a;
3424
- if (n === ue.Iconify) {
3506
+ if (n === me.Iconify) {
3425
3507
  const [g, y] = this.getIconSize(c, d, this.opt.displayer.dpr);
3426
- p = fe(a, g, y, l);
3508
+ p = ye(a, g, y, l);
3427
3509
  }
3428
3510
  if (this.cacheImages.has(p)) {
3429
3511
  const g = this.getCachedImages(p);
@@ -3436,15 +3518,15 @@ class tt {
3436
3518
  let k;
3437
3519
  const I = new Promise((g) => {
3438
3520
  k = g;
3439
- }), R = {
3521
+ }), E = {
3440
3522
  resolve: k,
3441
3523
  timer: void 0,
3442
3524
  requestId: i,
3443
3525
  promise: I
3444
3526
  };
3445
- return R.timer = setTimeout(() => {
3446
- this.imageResolveMap.get(p) === R && k(p);
3447
- }, 5e3), this.imageResolveMap.set(p, R), this.opt.post({
3527
+ return E.timer = setTimeout(() => {
3528
+ this.imageResolveMap.get(p) === E && k(p);
3529
+ }, 5e3), this.imageResolveMap.set(p, E), this.opt.post({
3448
3530
  viewId: this.viewId,
3449
3531
  viewGeneration: this.viewGeneration,
3450
3532
  viewOwner: this.viewOwner,
@@ -3459,11 +3541,11 @@ class tt {
3459
3541
  requestId: i
3460
3542
  }
3461
3543
  ]
3462
- }), await I, this.imageResolveMap.get(p) === R && this.imageResolveMap.delete(p), this.getCachedImages(p);
3544
+ }), await I, this.imageResolveMap.get(p) === E && this.imageResolveMap.delete(p), this.getCachedImages(p);
3463
3545
  }
3464
3546
  }
3465
3547
  createWorkShapeNode(e) {
3466
- return Z({
3548
+ return J({
3467
3549
  ...e,
3468
3550
  fullLayer: this.fullLayer,
3469
3551
  drawLayer: void 0
@@ -3483,7 +3565,7 @@ class tt {
3483
3565
  }
3484
3566
  async runFullWork(e) {
3485
3567
  var r;
3486
- const t = this.setFullWork(e), s = e.ops && V(e.ops);
3568
+ const t = this.setFullWork(e), s = e.ops && H(e.ops);
3487
3569
  if (t) {
3488
3570
  let i, o;
3489
3571
  const a = (r = t.getWorkId()) == null ? void 0 : r.toString();
@@ -3502,18 +3584,9 @@ class tt {
3502
3584
  op: s,
3503
3585
  isFullWork: !0,
3504
3586
  replaceId: a
3505
- }), o = (e == null ? void 0 : e.updateNodeOpt) && t.updataOptService(e.updateNodeOpt)), i = this.syncMatrixRect(a, t, i), ne(i, o);
3587
+ }), o = (e == null ? void 0 : e.updateNodeOpt) && t.updataOptService(e.updateNodeOpt)), le(i, o);
3506
3588
  }
3507
3589
  }
3508
- syncMatrixRect(e, t, s) {
3509
- const r = t.getWorkOptions().matrix;
3510
- if (!e || !r || pe(r).every(
3511
- (o, a) => o === [1, 0, 0, 1, 0, 0][a]
3512
- ))
3513
- return s;
3514
- const i = Oe.getRectFromLayer(this.fullLayer, e);
3515
- return i || s;
3516
- }
3517
3590
  async getSnapshot(e) {
3518
3591
  const { scenePath: t, scenes: s, cameraOpt: r, w: i, h: o, requestId: a } = e;
3519
3592
  if (!(t && s && r))
@@ -3529,7 +3602,7 @@ class tt {
3529
3602
  opt: l,
3530
3603
  workId: c,
3531
3604
  msgType: h.FullWork,
3532
- dataType: E.Service,
3605
+ dataType: R.Service,
3533
3606
  viewId: this.viewId,
3534
3607
  requestId: a
3535
3608
  };
@@ -3587,7 +3660,7 @@ class tt {
3587
3660
  requestId: r
3588
3661
  }
3589
3662
  ]
3590
- }), this.fullLayer && !this.destroyed && $(this.fullLayer, this.fullLayer.parent);
3663
+ }), this.fullLayer && !this.destroyed && K(this.fullLayer, this.fullLayer.parent);
3591
3664
  }
3592
3665
  }
3593
3666
  async getBoundingRect(e) {
@@ -3605,11 +3678,11 @@ class tt {
3605
3678
  ...n,
3606
3679
  workId: a,
3607
3680
  msgType: h.FullWork,
3608
- dataType: E.Service,
3681
+ dataType: R.Service,
3609
3682
  viewId: this.viewId,
3610
3683
  requestId: i
3611
3684
  });
3612
- o = ne(o, c);
3685
+ o = le(o, c);
3613
3686
  break;
3614
3687
  }
3615
3688
  }
@@ -3646,7 +3719,7 @@ class tt {
3646
3719
  for (const r of s.sp) {
3647
3720
  let i = !1;
3648
3721
  for (const o of e)
3649
- if (De(r, o)) {
3722
+ if (Me(r, o)) {
3650
3723
  i = !0;
3651
3724
  break;
3652
3725
  }
@@ -3686,7 +3759,7 @@ class tt {
3686
3759
  this.releaseBatchImageBitmaps(e);
3687
3760
  }
3688
3761
  createScene(e) {
3689
- return new me({
3762
+ return new we({
3690
3763
  displayRatio: this.opt.displayer.dpr,
3691
3764
  depth: !1,
3692
3765
  desynchronized: !0,
@@ -3696,7 +3769,7 @@ class tt {
3696
3769
  });
3697
3770
  }
3698
3771
  createLayer(e, t, s) {
3699
- const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, s), n = new ye({
3772
+ const { width: r, height: i } = s, o = `canvas-${e}`, a = t.layer(o, s), n = new ve({
3700
3773
  anchor: [0.5, 0.5],
3701
3774
  pos: [r * 0.5, i * 0.5],
3702
3775
  size: [r, i],
@@ -3750,7 +3823,7 @@ class tt {
3750
3823
  t.push(r);
3751
3824
  }
3752
3825
  try {
3753
- s && z(this.fullLayer, s);
3826
+ s && _(this.fullLayer, s);
3754
3827
  } catch (r) {
3755
3828
  t.push(r);
3756
3829
  }
@@ -3763,7 +3836,7 @@ class tt {
3763
3836
  throw t[0];
3764
3837
  }
3765
3838
  }
3766
- class dt {
3839
+ class ut {
3767
3840
  constructor(e) {
3768
3841
  u(this, "mainThreadMap", /* @__PURE__ */ new Map());
3769
3842
  u(this, "cameraRenderQueueByView", /* @__PURE__ */ new Map());
@@ -3798,8 +3871,8 @@ class dt {
3798
3871
  consumeCount: l,
3799
3872
  consumeWorkId: p
3800
3873
  } = e;
3801
- if (c && q(i)) {
3802
- const f = Me(
3874
+ if (c && $(i)) {
3875
+ const f = Pe(
3803
3876
  o,
3804
3877
  a,
3805
3878
  "mainThread"
@@ -3811,11 +3884,11 @@ class dt {
3811
3884
  d
3812
3885
  ) : this.master.ackCameraTask(c, i, d);
3813
3886
  }
3814
- c && q(n) && this.master.ackCameraSettledTask(
3887
+ c && $(n) && this.master.ackCameraSettledTask(
3815
3888
  c,
3816
3889
  n,
3817
3890
  d
3818
- ), 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(
3891
+ ), this.master.isBusy && $(r) && this.master.setWorkerTasksqueueCount(r), $(t) && this.master.setMaxDrawCount(t), $(l) && this.master.setConsumeCount(l, p), s && this.master.collectorSyncData(
3819
3892
  e.viewOwner === void 0 ? s : s.map(
3820
3893
  (f) => f.type === h.GetImageBitMap && f.viewOwner === void 0 ? { ...f, viewOwner: e.viewOwner } : f
3821
3894
  )
@@ -3829,7 +3902,7 @@ class dt {
3829
3902
  return this.cameraRenderQueueByView.set(e, r), r;
3830
3903
  }
3831
3904
  isStaleViewMessage(e) {
3832
- if (!e.viewId || e.viewId === ce || e.viewGeneration === void 0)
3905
+ if (!e.viewId || e.viewId === de || e.viewGeneration === void 0)
3833
3906
  return !1;
3834
3907
  const t = this.viewGenerationById.get(e.viewId);
3835
3908
  return t !== void 0 && e.viewGeneration < t;
@@ -3884,10 +3957,10 @@ class dt {
3884
3957
  );
3885
3958
  }
3886
3959
  createMainThread(e, t) {
3887
- return new et(e, t);
3960
+ return new st(e, t);
3888
3961
  }
3889
3962
  createSnapshotThread(e, t) {
3890
- return new tt(e, t);
3963
+ return new rt(e, t);
3891
3964
  }
3892
3965
  getSnapshotRequestKey(e) {
3893
3966
  return e.requestId || `${e.viewId}\0${e.scenePath || ""}\0${e.msgType}`;
@@ -3954,36 +4027,36 @@ class dt {
3954
4027
  if (o === h.Init) {
3955
4028
  const g = i.viewGeneration ?? (this.viewGenerationById.get(a) || 0) + 1;
3956
4029
  await this.enqueueViewTask(a, async () => {
3957
- var W, v, B;
4030
+ var A, W, v;
3958
4031
  const y = this.viewGenerationById.get(a);
3959
4032
  if (y !== void 0 && g < y)
3960
4033
  return;
3961
4034
  this.viewGenerationById.set(a, g);
3962
- const S = i.viewOwner || `${a}:${g}:${++this.ownerSequence}`, T = (W = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : W.displayer, L = T == null ? void 0 : T.canvasContainerRef.current;
3963
- if (!T || !L || !l || !p) {
4035
+ 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;
4036
+ if (!T || !C || !l || !p) {
3964
4037
  this.viewOwnerById.delete(a);
3965
4038
  return;
3966
4039
  }
3967
4040
  this.viewOwnerById.set(a, S);
3968
- const N = this.mainThreadMap.get(a);
3969
- N == null || N.destroy();
3970
- const A = this.createMainThread(a, {
4041
+ const L = this.mainThreadMap.get(a);
4042
+ L == null || L.destroy();
4043
+ const O = this.createMainThread(a, {
3971
4044
  displayer: T,
3972
- container: L,
4045
+ container: C,
3973
4046
  layerOpt: l,
3974
4047
  master: this.master,
3975
4048
  canvasOpt: p,
3976
4049
  viewOwner: S,
3977
4050
  viewGeneration: g,
3978
- mainThreadRenderMode: ((B = (v = this.master.control) == null ? void 0 : v.renderingCompatibilityDecision) == null ? void 0 : B.mainThreadRenderMode) ?? "normal",
3979
- post: (O) => this.post({
3980
- ...O,
3981
- viewId: O.viewId || a,
3982
- viewGeneration: O.viewGeneration ?? g,
4051
+ mainThreadRenderMode: ((v = (W = this.master.control) == null ? void 0 : W.renderingCompatibilityDecision) == null ? void 0 : v.mainThreadRenderMode) ?? "normal",
4052
+ post: (B) => this.post({
4053
+ ...B,
4054
+ viewId: B.viewId || a,
4055
+ viewGeneration: B.viewGeneration ?? g,
3983
4056
  viewOwner: S
3984
4057
  })
3985
4058
  });
3986
- this.mainThreadMap.set(a, A), A && f && A.setCameraOpt(f), this.post({
4059
+ this.mainThreadMap.set(a, O), O && f && O.setCameraOpt(f), this.post({
3987
4060
  sp: [
3988
4061
  {
3989
4062
  type: h.Init,
@@ -3998,38 +4071,38 @@ class dt {
3998
4071
  if (o === h.Snapshot || o === h.BoundingBox) {
3999
4072
  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;
4000
4073
  if (g && S && f) {
4001
- const T = this.getSnapshotRequestKey(i), L = this.snapshotThreadsByRequest.get(T);
4002
- L && this.disposeSnapshotThread(T, L.thread, "replaced");
4003
- const N = document.createElement("div");
4004
- N.style.width = `${f.width}px`, N.style.height = `${f.height}px`, S.append(N);
4005
- const A = {
4006
- ...he.defaultLayerOpt,
4074
+ const T = this.getSnapshotRequestKey(i), C = this.snapshotThreadsByRequest.get(T);
4075
+ C && this.disposeSnapshotThread(T, C.thread, "replaced");
4076
+ const L = document.createElement("div");
4077
+ L.style.width = `${f.width}px`, L.style.height = `${f.height}px`, S.append(L);
4078
+ const O = {
4079
+ ...pe.defaultLayerOpt,
4007
4080
  offscreen: !1,
4008
4081
  width: f.width,
4009
4082
  height: f.height
4010
- }, W = {
4011
- ...he.defaultScreenCanvasOpt,
4083
+ }, A = {
4084
+ ...pe.defaultScreenCanvasOpt,
4012
4085
  width: f.width,
4013
4086
  height: f.height
4014
- }, v = this.createSnapshotThread(a, {
4087
+ }, W = this.createSnapshotThread(a, {
4015
4088
  displayer: g,
4016
- container: N,
4017
- layerOpt: A,
4089
+ container: L,
4090
+ layerOpt: O,
4018
4091
  master: this.master,
4019
- canvasOpt: W,
4092
+ canvasOpt: A,
4020
4093
  post: this.post,
4021
4094
  viewOwner: this.viewOwnerById.get(a),
4022
4095
  viewGeneration: this.viewGenerationById.get(a)
4023
4096
  });
4024
4097
  this.snapshotThreadsByRequest.set(T, {
4025
- thread: v,
4026
- surface: N
4027
- }), v.on(i).then(() => {
4028
- this.disposeSnapshotThread(T, v);
4029
- }).catch((B) => {
4098
+ thread: W,
4099
+ surface: L
4100
+ }), W.on(i).then(() => {
4101
+ this.disposeSnapshotThread(T, W);
4102
+ }).catch((v) => {
4030
4103
  this.master.Logger.error(
4031
- `[Appliance]: snapshot render failed; viewId=${a}; error=${B instanceof Error ? B.message : String(B)}`
4032
- ), this.disposeSnapshotThread(T, v);
4104
+ `[Appliance]: snapshot render failed; viewId=${a}; error=${v instanceof Error ? v.message : String(v)}`
4105
+ ), this.disposeSnapshotThread(T, W);
4033
4106
  });
4034
4107
  continue;
4035
4108
  }
@@ -4070,37 +4143,37 @@ class dt {
4070
4143
  }
4071
4144
  if (o === h.TasksQueue && (n != null && n.size)) {
4072
4145
  const g = n.get(a), y = this.mainThreadMap.get(a), S = this.viewGenerationById.get(a), T = this.viewOwnerById.get(a);
4073
- let L;
4146
+ let C;
4074
4147
  if (g && y)
4075
4148
  try {
4076
4149
  await this.enqueueViewTask(a, async () => {
4077
4150
  this.viewGenerationById.get(a) !== S || this.viewOwnerById.get(a) !== T || this.mainThreadMap.get(a) !== y || await y.on(g);
4078
4151
  });
4079
- } catch (N) {
4080
- if (g.msgType !== h.UpdateCamera) throw N;
4081
- const A = Pe(N);
4082
- L = {
4083
- code: A ? "RENDERER_BUSINESS_TIMEOUT" : "RENDERER_BUSINESS_ERROR",
4152
+ } catch (L) {
4153
+ if (g.msgType !== h.UpdateCamera) throw L;
4154
+ const O = Ae(L);
4155
+ C = {
4156
+ code: O ? "RENDERER_BUSINESS_TIMEOUT" : "RENDERER_BUSINESS_ERROR",
4084
4157
  business: "updateCamera",
4085
- message: N instanceof Error ? N.message : String(N),
4086
- elapsedMs: A ? N.elapsedMs : void 0,
4087
- stage: A ? N.stage : "update-camera",
4088
- blockingWorks: A ? N.blockingWorks : void 0,
4158
+ message: L instanceof Error ? L.message : String(L),
4159
+ elapsedMs: O ? L.elapsedMs : void 0,
4160
+ stage: O ? L.stage : "update-camera",
4161
+ blockingWorks: O ? L.blockingWorks : void 0,
4089
4162
  workerType: "mainThread"
4090
4163
  };
4091
4164
  }
4092
- if (L && q(d)) {
4165
+ if (C && $(d)) {
4093
4166
  this.post({
4094
4167
  viewId: a,
4095
4168
  viewGeneration: S,
4096
4169
  viewOwner: T,
4097
4170
  cameraTaskId: d,
4098
- cameraTaskStatus: L.code === "RENDERER_BUSINESS_TIMEOUT" ? "timeout" : "failed",
4099
- cameraTaskError: L
4171
+ cameraTaskStatus: C.code === "RENDERER_BUSINESS_TIMEOUT" ? "timeout" : "failed",
4172
+ cameraTaskError: C
4100
4173
  });
4101
4174
  continue;
4102
4175
  }
4103
- c && q(d) && this.post({
4176
+ c && $(d) && this.post({
4104
4177
  workerTasksqueueCount: c,
4105
4178
  cameraTaskId: d,
4106
4179
  viewId: a,
@@ -4109,7 +4182,7 @@ class dt {
4109
4182
  });
4110
4183
  continue;
4111
4184
  }
4112
- if (a === ce) {
4185
+ if (a === de) {
4113
4186
  const g = [...this.mainThreadMap.entries()];
4114
4187
  for (const [y, S] of g) {
4115
4188
  const T = this.enqueueViewTask(y, async () => {
@@ -4134,10 +4207,10 @@ class dt {
4134
4207
  }
4135
4208
  if (!k)
4136
4209
  continue;
4137
- const I = this.viewGenerationById.get(a), R = this.enqueueViewTask(a, async () => {
4210
+ const I = this.viewGenerationById.get(a), E = this.enqueueViewTask(a, async () => {
4138
4211
  this.viewGenerationById.get(a) !== I || this.mainThreadMap.get(a) !== k || await k.on(i);
4139
4212
  });
4140
- o === h.Destroy && (await R, this.mainThreadMap.get(a) === k && this.mainThreadMap.delete(a), this.viewOwnerById.delete(a), this.cameraRenderQueueByView.get(a) === R && this.cameraRenderQueueByView.delete(a), this.viewGenerationById.set(
4213
+ 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(
4141
4214
  a,
4142
4215
  i.viewGeneration ?? (I || 0) + 1
4143
4216
  ));
@@ -4145,5 +4218,5 @@ class dt {
4145
4218
  }
4146
4219
  }
4147
4220
  export {
4148
- dt as MainThreadManagerImpl
4221
+ ut as MainThreadManagerImpl
4149
4222
  };