@netless/appliance-plugin 1.1.13 → 1.1.14-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  var ie = Object.defineProperty;
2
2
  var ae = (N, t, e) => t in N ? ie(N, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : N[t] = e;
3
3
  var u = (N, t, e) => ae(N, typeof t != "symbol" ? t + "" : t, e);
4
- import { D as F, E as T, a as f, b as g, g as z, t as P, c as p, S as J, d as W, e as Z, i as ne, C as G, f as ce, h as I, M as A, V as le, j as ee, T as j, k as $, l as X, m as H, n as he, o as q, p as Y, q as pe } from "./index-0fBM84zK.mjs";
4
+ import { D as F, E as W, a as f, b as g, g as z, t as P, c as p, S as J, d as T, e as Z, i as ne, C as G, f as ce, h as I, M as A, V as le, j as ee, T as j, k as $, l as X, m as H, n as he, o as q, p as Y, q as pe } from "./index-B3RMMnuz.mjs";
5
5
  import { Scene as te, Group as se } from "spritejs";
6
6
  import { cloneDeep as oe, xor as de, isNumber as U, isEqual as Q } from "lodash";
7
7
  import "lineclip";
@@ -42,7 +42,7 @@ class ue {
42
42
  return o && this.localWorkShapes.set(t, {
43
43
  node: o,
44
44
  toolsType: o.toolsType,
45
- workState: T.Start
45
+ workState: W.Start
46
46
  }), o;
47
47
  }
48
48
  }
@@ -66,7 +66,7 @@ class ue {
66
66
  if (!r)
67
67
  return;
68
68
  const i = r.node.consume({ data: t, isFullWork: !1, isSubWorker: !0 });
69
- i.rect && (r.result = i, r.workState = T.Doing, o && this.localWorkShapes.set(o, r));
69
+ i.rect && (r.result = i, r.workState = W.Doing, o && this.localWorkShapes.set(o, r));
70
70
  }
71
71
  this.runAnimation();
72
72
  }
@@ -87,24 +87,24 @@ class ue {
87
87
  }
88
88
  activeServiceWorkShape(t) {
89
89
  var m, d;
90
- const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: n } = t;
90
+ const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: c } = t;
91
91
  if (!e)
92
92
  return;
93
- const c = e.toString(), h = (m = this.vNodes.get(c)) == null ? void 0 : m.rect;
94
- if (!((d = this.serviceWorkShapes) != null && d.has(c))) {
95
- let w = {
93
+ const n = e.toString(), h = (m = this.vNodes.get(n)) == null ? void 0 : m.rect;
94
+ if (!((d = this.serviceWorkShapes) != null && d.has(n))) {
95
+ let S = {
96
96
  toolsType: o,
97
- animationWorkData: n || [],
97
+ animationWorkData: c || [],
98
98
  animationIndex: 0,
99
99
  type: r,
100
100
  updateNodeOpt: i,
101
101
  ops: a,
102
102
  oldRect: h
103
103
  };
104
- o && s && (w = this.setNodeKey(c, w, o, s)), this.serviceWorkShapes.set(c, w);
104
+ o && s && (S = this.setNodeKey(n, S, o, s)), this.serviceWorkShapes.set(n, S);
105
105
  }
106
- const l = this.serviceWorkShapes.get(c);
107
- r && (l.type = r), a && (l.animationWorkData = P(a), l.ops = a), i && (l.updateNodeOpt = i), n && (l.animationWorkData = n), l.node && l.node.getWorkId() !== c && l.node.setWorkId(c), h && (l.oldRect = h), o && s && (l.toolsType !== o && o && s && this.setNodeKey(c, l, o, s), l.node && l.node.setWorkOptions(s));
106
+ const l = this.serviceWorkShapes.get(n);
107
+ r && (l.type = r), a && (l.animationWorkData = P(a), l.ops = a), i && (l.updateNodeOpt = i), c && (l.animationWorkData = c), l.node && l.node.getWorkId() !== n && l.node.setWorkId(n), h && (l.oldRect = h), o && s && (l.toolsType !== o && o && s && this.setNodeKey(n, l, o, s), l.node && l.node.setWorkOptions(s));
108
108
  }
109
109
  computNextAnimationIndex(t, e) {
110
110
  var r;
@@ -116,46 +116,46 @@ class ue {
116
116
  this.animationId = void 0;
117
117
  let t = !1;
118
118
  const e = /* @__PURE__ */ new Map(), s = [];
119
- for (const [n, c] of this.serviceWorkShapes.entries())
120
- switch (c.toolsType) {
119
+ for (const [c, n] of this.serviceWorkShapes.entries())
120
+ switch (n.toolsType) {
121
121
  case f.LaserPen: {
122
- const l = this.computNextAnimationIndex(c, 8), m = Math.max(0, c.animationIndex || 0), d = (c.animationWorkData || []).slice(m, l);
123
- if ((c.animationIndex || 0) < l && ((o = c.node) == null || o.consumeService({
122
+ const l = this.computNextAnimationIndex(n, 8), m = Math.max(0, n.animationIndex || 0), d = (n.animationWorkData || []).slice(m, l);
123
+ if ((n.animationIndex || 0) < l && ((o = n.node) == null || o.consumeService({
124
124
  op: d,
125
125
  isFullWork: !1
126
- }), c.animationIndex = l, d.length && e.set(n, {
127
- workState: m === 0 ? T.Start : l === ((r = c.animationWorkData) == null ? void 0 : r.length) ? T.Done : T.Doing,
126
+ }), n.animationIndex = l, d.length && e.set(c, {
127
+ workState: m === 0 ? W.Start : l === ((r = n.animationWorkData) == null ? void 0 : r.length) ? W.Done : W.Doing,
128
128
  op: d.slice(-2)
129
- })), c.isDel) {
130
- (i = c.node) == null || i.clearTmpPoints(), this.serviceWorkShapes.delete(n);
129
+ })), n.isDel) {
130
+ (i = n.node) == null || i.clearTmpPoints(), this.serviceWorkShapes.delete(c);
131
131
  break;
132
132
  }
133
- c.ops && c.animationIndex === ((a = c.animationWorkData) == null ? void 0 : a.length) && !c.isDel && (this.thread.topLayer.getElementsByName(n.toString())[0] || (c.isDel = !0, this.serviceWorkShapes.set(n, c))), t = !0;
133
+ n.ops && n.animationIndex === ((a = n.animationWorkData) == null ? void 0 : a.length) && !n.isDel && (this.thread.topLayer.getElementsByName(c.toString())[0] || (n.isDel = !0, this.serviceWorkShapes.set(c, n))), t = !0;
134
134
  break;
135
135
  }
136
136
  }
137
- for (const [n, c] of this.localWorkShapes.entries()) {
138
- const { result: h, toolsType: l, isDel: m, workState: d } = c;
137
+ for (const [c, n] of this.localWorkShapes.entries()) {
138
+ const { result: h, toolsType: l, isDel: m, workState: d } = n;
139
139
  switch (l) {
140
140
  case f.LaserPen: {
141
141
  if (m) {
142
- c.node.clearTmpPoints(), this.localWorkShapes.delete(n), s.push({
143
- removeIds: [n.toString()],
142
+ n.node.clearTmpPoints(), this.localWorkShapes.delete(c), s.push({
143
+ removeIds: [c.toString()],
144
144
  type: p.RemoveNode
145
145
  });
146
146
  break;
147
147
  }
148
- h && ((h.op || h.ops) && s.push(h), c.result = void 0), !this.thread.topLayer.getElementsByName(n.toString())[0] && d === T.Done && (c.isDel = !0, this.localWorkShapes.set(n, c)), t = !0;
148
+ h && ((h.op || h.ops) && s.push(h), n.result = void 0), !this.thread.topLayer.getElementsByName(c.toString())[0] && d === W.Done && (n.isDel = !0, this.localWorkShapes.set(c, n)), t = !0;
149
149
  break;
150
150
  }
151
151
  }
152
152
  }
153
- t && this.runAnimation(), e.size && e.forEach((n, c) => {
153
+ t && this.runAnimation(), e.size && e.forEach((c, n) => {
154
154
  s.push({
155
155
  type: p.Cursor,
156
- uid: c.split(J)[0],
157
- op: n.op,
158
- workState: n.workState,
156
+ uid: n.split(J)[0],
157
+ op: c.op,
158
+ workState: c.workState,
159
159
  viewId: this.thread.viewId
160
160
  });
161
161
  }), s.length && this.thread.post({ sp: s });
@@ -171,7 +171,7 @@ class ue {
171
171
  this.tmpOpt.toolsOpt = e, s = this.createWorkShapeNode({ workId: t, toolsType: r, toolsOpt: e }), s && this.localWorkShapes.set(t, {
172
172
  node: s,
173
173
  toolsType: r,
174
- workState: T.Start
174
+ workState: W.Start
175
175
  }), this.setToolsOpt(this.tmpOpt);
176
176
  }
177
177
  e != null && e.syncUnitTime || (e.syncUnitTime = this.syncUnitTime), s && s.setWorkOptions(e);
@@ -185,7 +185,7 @@ class ue {
185
185
  if (!r)
186
186
  return;
187
187
  const i = r.node.consumeAll({ data: t });
188
- r.result = i, r.workState = T.Done, o && this.localWorkShapes.set(o, r);
188
+ r.result = i, r.workState = W.Done, o && this.localWorkShapes.set(o, r);
189
189
  }
190
190
  this.runAnimation();
191
191
  }
@@ -200,7 +200,7 @@ class fe {
200
200
  u(this, "batchEraserWorks", /* @__PURE__ */ new Set());
201
201
  u(this, "tmpOpt");
202
202
  u(this, "syncUnitTime", F.syncOpt.interval);
203
- u(this, "drawCount", 0);
203
+ u(this, "fullWorkerDrawCount", 0);
204
204
  u(this, "drawWorkActiveId");
205
205
  u(this, "consumeCount", 0);
206
206
  u(this, "batchEraserCombine", ce(() => {
@@ -234,7 +234,7 @@ class fe {
234
234
  // }
235
235
  async updateSelector(t) {
236
236
  var m;
237
- const e = this.workShapes.get(W);
237
+ const e = this.workShapes.get(T);
238
238
  if (!((m = e == null ? void 0 : e.selectIds) != null && m.length)) return;
239
239
  const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i } = o, a = await (e == null ? void 0 : e.updateSelector({
240
240
  updateSelectorOpt: r,
@@ -242,15 +242,15 @@ class fe {
242
242
  vNodes: this.vNodes,
243
243
  willSerializeData: i,
244
244
  worker: this
245
- })), n = /* @__PURE__ */ new Map();
246
- let c;
247
- a != null && a.selectIds && (c = de(e.selectIds, a.selectIds), a.selectIds.forEach((d) => {
248
- const w = this.vNodes.get(d);
249
- if (w) {
250
- const { toolsType: S, op: y, opt: v } = w;
251
- n.set(d, {
245
+ })), c = /* @__PURE__ */ new Map();
246
+ let n;
247
+ a != null && a.selectIds && (n = de(e.selectIds, a.selectIds), a.selectIds.forEach((d) => {
248
+ const S = this.vNodes.get(d);
249
+ if (S) {
250
+ const { toolsType: w, op: y, opt: v } = S;
251
+ c.set(d, {
252
252
  opt: v,
253
- toolsType: S,
253
+ toolsType: w,
254
254
  ops: (y == null ? void 0 : y.length) && Z(y) || void 0
255
255
  });
256
256
  }
@@ -260,11 +260,11 @@ class fe {
260
260
  workShapeNode: e,
261
261
  param: o,
262
262
  postData: { sp: h },
263
- newServiceStore: n
263
+ newServiceStore: c
264
264
  }) || { sp: h };
265
- c && l.sp.push({
265
+ n && l.sp.push({
266
266
  type: p.RemoveNode,
267
- removeIds: c,
267
+ removeIds: n,
268
268
  viewId: this.thread.viewId
269
269
  }), l.sp.length && this.thread.post(l);
270
270
  }
@@ -274,7 +274,7 @@ class fe {
274
274
  clearAll() {
275
275
  if (this.thread.localLayer.children.length && (this.thread.topLayer.parent.children.forEach((e) => {
276
276
  e.name !== "viewport" && e.remove();
277
- }), this.thread.localLayer.removeAllChildren()), this.workShapes.get(W)) {
277
+ }), this.thread.localLayer.removeAllChildren()), this.workShapes.get(T)) {
278
278
  const e = [];
279
279
  e.push({
280
280
  type: p.Select,
@@ -290,9 +290,9 @@ class fe {
290
290
  if (e != null && e.length) {
291
291
  let r;
292
292
  for (const i of this.vNodes.curNodeMap.values()) {
293
- const { rect: a, name: n, toolsType: c, opt: h } = i, l = e[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0], m = e[1] * this.thread.fullLayer.worldScaling[1] + this.thread.fullLayer.worldPosition[1];
294
- if (c === f.Text && ne([l, m], a) && h.workState === T.Done) {
295
- r = n;
293
+ const { rect: a, name: c, toolsType: n, opt: h } = i, l = e[0] * this.thread.fullLayer.worldScaling[0] + this.thread.fullLayer.worldPosition[0], m = e[1] * this.thread.fullLayer.worldScaling[1] + this.thread.fullLayer.worldPosition[1];
294
+ if (n === f.Text && ne([l, m], a) && h.workState === W.Done) {
295
+ r = c;
296
296
  break;
297
297
  }
298
298
  }
@@ -319,29 +319,29 @@ class fe {
319
319
  r && o && r.cursorHover(o);
320
320
  }
321
321
  updateFullSelectWork(t) {
322
- var o, r, i, a, n;
323
- const e = this.workShapes.get(W), { selectIds: s } = t;
322
+ var o, r, i, a, c;
323
+ const e = this.workShapes.get(T), { selectIds: s } = t;
324
324
  if (!(s != null && s.length)) {
325
325
  this.blurSelector(t);
326
326
  return;
327
327
  }
328
328
  if (!e) {
329
- const c = this.setFullWork(t);
330
- !c && t.workId && this.tmpOpt && ((o = this.tmpOpt) == null ? void 0 : o.toolsType) === f.Selector && this.setWorkOptions(t.workId.toString(), t.opt || this.tmpOpt.toolsOpt), c && this.updateFullSelectWork(t);
329
+ const n = this.setFullWork(t);
330
+ !n && t.workId && this.tmpOpt && ((o = this.tmpOpt) == null ? void 0 : o.toolsType) === f.Selector && this.setWorkOptions(t.workId.toString(), t.opt || this.tmpOpt.toolsOpt), n && this.updateFullSelectWork(t);
331
331
  return;
332
332
  }
333
333
  if (e && (s != null && s.length)) {
334
- const { selectRect: c } = e.updateSelectIds(s), h = [{
334
+ const { selectRect: n } = e.updateSelectIds(s), h = [{
335
335
  ...t,
336
336
  selectorColor: ((r = t.opt) == null ? void 0 : r.strokeColor) || e.selectorColor,
337
337
  strokeColor: ((i = t.opt) == null ? void 0 : i.strokeColor) || e.strokeColor,
338
338
  fillColor: ((a = t.opt) == null ? void 0 : a.fillColor) || e.fillColor,
339
- textOpt: ((n = t.opt) == null ? void 0 : n.textOpt) || e.textOpt,
339
+ textOpt: ((c = t.opt) == null ? void 0 : c.textOpt) || e.textOpt,
340
340
  canTextEdit: e.canTextEdit,
341
341
  canRotate: e.canRotate,
342
342
  scaleType: e.scaleType,
343
343
  type: p.Select,
344
- selectRect: c,
344
+ selectRect: n,
345
345
  points: e.getChildrenPoints(),
346
346
  willSyncService: (t == null ? void 0 : t.willSyncService) || !1,
347
347
  opt: (t == null ? void 0 : t.willSyncService) && e.getWorkOptions() || void 0,
@@ -367,14 +367,14 @@ class fe {
367
367
  };
368
368
  }
369
369
  async removeSelector(t) {
370
- const { willSyncService: e } = t, s = [], o = [], r = this.workShapes.get(W);
370
+ const { willSyncService: e } = t, s = [], o = [], r = this.workShapes.get(T);
371
371
  if (!r)
372
372
  return;
373
373
  const i = r.selectIds && [...r.selectIds] || [];
374
374
  for (const a of i) {
375
375
  if (this.vNodes.get(a)) {
376
- const c = this.commandDeleteText(a);
377
- c && s.push(c);
376
+ const n = this.commandDeleteText(a);
377
+ n && s.push(n);
378
378
  }
379
379
  this.removeNode(a), o.push(a);
380
380
  }
@@ -441,7 +441,7 @@ class fe {
441
441
  }
442
442
  }
443
443
  async colloctEffectSelectWork(t) {
444
- const e = this.workShapes.get(W), { workId: s, msgType: o } = t;
444
+ const e = this.workShapes.get(T), { workId: s, msgType: o } = t;
445
445
  if (e && s && e.selectIds && e.selectIds.includes(s.toString())) {
446
446
  o === p.RemoveNode ? e.selectIds = e.selectIds.filter((r) => r !== s.toString()) : this.effectSelectNodeData.add(t), await new Promise((r) => {
447
447
  setTimeout(() => {
@@ -486,14 +486,14 @@ class fe {
486
486
  this.reRenderSelector(t);
487
487
  }
488
488
  hasSelector() {
489
- return this.workShapes.has(W);
489
+ return this.workShapes.has(T);
490
490
  }
491
491
  getSelector() {
492
- return this.workShapes.get(W);
492
+ return this.workShapes.get(T);
493
493
  }
494
494
  reRenderSelector(t = !1) {
495
495
  var o;
496
- const e = this.workShapes.get(W);
496
+ const e = this.workShapes.get(T);
497
497
  if (!e) return;
498
498
  if (e && !((o = e.selectIds) != null && o.length))
499
499
  return this.blurSelector();
@@ -526,9 +526,9 @@ class fe {
526
526
  }
527
527
  async blurSelector(t) {
528
528
  var o;
529
- const e = this.workShapes.get(W), s = e == null ? void 0 : e.blurSelector();
530
- if (this.clearWorkShapeNodeCache(W), ((o = this.thread.fullLayer) == null ? void 0 : o.parent).children.forEach((r) => {
531
- r.name === W && r.remove();
529
+ const e = this.workShapes.get(T), s = e == null ? void 0 : e.blurSelector();
530
+ if (this.clearWorkShapeNodeCache(T), ((o = this.thread.fullLayer) == null ? void 0 : o.parent).children.forEach((r) => {
531
+ r.name === T && r.remove();
532
532
  }), s) {
533
533
  const r = [];
534
534
  r.push({
@@ -541,10 +541,6 @@ class fe {
541
541
  var e;
542
542
  (e = this.getWorkShape(t)) == null || e.clearTmpPoints(), this.workShapes.delete(t);
543
543
  }
544
- drawBitMapEraser(t) {
545
- const e = [];
546
- t.op && e.push(t), this.thread.post({ sp: e, consumeCount: this.consumeCount });
547
- }
548
544
  async drawBitMapEraserFull(t, e, s) {
549
545
  const { willUpdateNodes: o, willDeleteNodes: r } = e, i = t.getWorkId(), a = [
550
546
  {
@@ -557,17 +553,13 @@ class fe {
557
553
  type: p.None,
558
554
  isLockSentEventCursor: s
559
555
  }), o != null && o.size || r != null && r.size) {
560
- if (await (t == null ? void 0 : t.reRenderEffectNodes({
561
- willDeleteNodes: r,
562
- willUpdateNodes: o,
563
- worker: this
564
- })), o != null && o.size)
565
- for (const [n, c] of o)
556
+ if (o != null && o.size)
557
+ for (const [c, n] of o)
566
558
  a.push({
567
559
  type: p.UpdateNode,
568
560
  dataType: g.Local,
569
- opt: c.opt,
570
- workId: n,
561
+ opt: n.opt,
562
+ workId: c,
571
563
  updateNodeOpt: {
572
564
  useAnimation: !1
573
565
  }
@@ -638,11 +630,11 @@ class fe {
638
630
  consumeDraw(t, e) {
639
631
  const { op: s, workId: o, scenePath: r, postCount: i } = t;
640
632
  if (s != null && s.length && o) {
641
- const a = o.toString(), n = this.workShapes.get(a);
642
- if (!n)
633
+ const a = o.toString(), c = this.workShapes.get(a);
634
+ if (!c)
643
635
  return;
644
- const c = n.toolsType;
645
- if (c === f.LaserPen)
636
+ const n = c.toolsType;
637
+ if (n === f.LaserPen)
646
638
  return;
647
639
  switch (this.drawWorkActiveId && this.drawWorkActiveId !== a && (this.consumeDrawAll({
648
640
  workId: this.drawWorkActiveId,
@@ -650,10 +642,10 @@ class fe {
650
642
  viewId: this.thread.viewId,
651
643
  msgType: p.DrawWork,
652
644
  dataType: g.Local
653
- }, e), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== W && (this.drawWorkActiveId = a), U(i) && (this.consumeCount = i), c) {
645
+ }, e), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== T && (this.drawWorkActiveId = a), U(i) && (this.consumeCount = i), n) {
654
646
  case f.Selector:
655
647
  {
656
- const h = n.consume({
648
+ const h = c.consume({
657
649
  data: t,
658
650
  isFullWork: !0
659
651
  });
@@ -662,7 +654,7 @@ class fe {
662
654
  break;
663
655
  case f.PencilEraser:
664
656
  {
665
- const h = n.consume({
657
+ const h = c.consume({
666
658
  data: t,
667
659
  isFullWork: !0
668
660
  });
@@ -670,16 +662,20 @@ class fe {
670
662
  }
671
663
  break;
672
664
  case f.BitMapEraser: {
673
- const h = n.consume({
665
+ const h = c.consume({
674
666
  data: t,
675
- isFullWork: !0
667
+ isFullWork: !1,
668
+ isMainThread: !0
669
+ });
670
+ this.fullWorkerDrawCount++, this.thread.post({
671
+ fullWorkerDrawCount: this.fullWorkerDrawCount,
672
+ sp: h.op && [{ ...h, scenePath: r }] || void 0
676
673
  });
677
- this.drawBitMapEraser(h);
678
674
  break;
679
675
  }
680
676
  case f.Eraser:
681
677
  {
682
- const h = n.consume({
678
+ const h = c.consume({
683
679
  data: t,
684
680
  isFullWork: !0
685
681
  });
@@ -695,13 +691,14 @@ class fe {
695
691
  case f.SpeechBalloon:
696
692
  case f.Pencil:
697
693
  {
698
- const h = n.consume({
694
+ const h = c.consume({
699
695
  data: t,
700
696
  isFullWork: !1,
701
697
  isMainThread: !0
702
698
  });
703
- h && (this.drawCount++, this.thread.post({
704
- drawCount: this.drawCount,
699
+ h && (this.fullWorkerDrawCount++, this.thread.post({
700
+ consumeCount: this.consumeCount,
701
+ fullWorkerDrawCount: this.fullWorkerDrawCount,
705
702
  sp: h.op && [{ ...h, scenePath: r }] || void 0
706
703
  }));
707
704
  }
@@ -710,30 +707,30 @@ class fe {
710
707
  }
711
708
  }
712
709
  consumeDrawAll(t, e) {
713
- var i, a, n, c;
710
+ var i, a, c;
714
711
  const { workId: s, scenePath: o, isLockSentEventCursor: r } = t;
715
712
  if (s) {
716
- const h = s.toString();
717
- this.drawWorkActiveId === h && (this.drawWorkActiveId = void 0);
718
- const l = this.workShapes.get(h);
719
- if (!l)
713
+ const n = s.toString();
714
+ this.drawWorkActiveId === n && (this.drawWorkActiveId = void 0);
715
+ const h = this.workShapes.get(n);
716
+ if (!h)
720
717
  return;
721
- const m = l.toolsType;
722
- if (m === f.LaserPen)
718
+ const l = h.toolsType;
719
+ if (l === f.LaserPen)
723
720
  return;
724
- const d = this.workShapes.get(G), w = (i = d == null ? void 0 : d.selectIds) == null ? void 0 : i[0], S = l.consumeAll({ data: t });
725
- switch (m) {
721
+ const m = this.workShapes.get(G), d = (i = m == null ? void 0 : m.selectIds) == null ? void 0 : i[0], S = h.consumeAll({ data: t, workerEngine: this });
722
+ switch (l) {
726
723
  case f.Selector:
727
- S.selectIds && w && ((a = S.selectIds) != null && a.includes(w)) && d.cursorBlur(), S.type === p.Select && (S.selectIds && e.runReverseSelectWork(S.selectIds), this.thread.post({ sp: [{ ...S, scenePath: o }] })), (n = l.selectIds) != null && n.length ? l.clearTmpPoints() : this.clearWorkShapeNodeCache(h);
724
+ S.selectIds && d && ((a = S.selectIds) != null && a.includes(d)) && m.cursorBlur(), S.type === p.Select && (S.selectIds && e.runReverseSelectWork(S.selectIds), this.thread.post({ sp: [{ ...S, scenePath: o }] })), (c = h.selectIds) != null && c.length ? h.clearTmpPoints() : this.clearWorkShapeNodeCache(n);
728
725
  break;
729
726
  case f.PencilEraser:
730
- this.drawPencilEraser({ ...S, scenePath: o }, r), l.clearTmpPoints();
727
+ this.drawPencilEraser({ ...S, scenePath: o }, r), h.clearTmpPoints();
731
728
  break;
732
729
  case f.BitMapEraser:
733
- (S.rect || (c = S.newWorkDatas) != null && c.size) && this.drawBitMapEraserFull(l, S, r);
730
+ this.drawBitMapEraserFull(h, S, r), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(n);
734
731
  break;
735
732
  case f.Eraser:
736
- this.drawEraser({ ...S, scenePath: o }, r), l.clearTmpPoints();
733
+ this.drawEraser({ ...S, scenePath: o }, r), h.clearTmpPoints();
737
734
  break;
738
735
  case f.Arrow:
739
736
  case f.Straight:
@@ -743,14 +740,14 @@ class fe {
743
740
  case f.Polygon:
744
741
  case f.SpeechBalloon:
745
742
  case f.Pencil: {
746
- const y = [];
747
- r && y.push({
743
+ const w = [];
744
+ r && w.push({
748
745
  type: p.None,
749
746
  isLockSentEventCursor: r
750
- }), S && (y.push(S), this.drawCount = 0, this.thread.post({
751
- drawCount: this.drawCount,
752
- sp: y
753
- })), this.clearWorkShapeNodeCache(h);
747
+ }), S && (w.push(S), this.fullWorkerDrawCount = 0, this.thread.post({
748
+ fullWorkerDrawCount: this.fullWorkerDrawCount,
749
+ sp: w
750
+ })), this.clearWorkShapeNodeCache(n);
754
751
  break;
755
752
  }
756
753
  }
@@ -845,7 +842,7 @@ class me {
845
842
  return Math.min((t.animationIndex || 0) + (s || e), (t.animationWorkData || []).length);
846
843
  }
847
844
  async animationDraw() {
848
- var s, o, r, i, a, n, c, h, l, m, d, w, S, y, v, C, R, V, K;
845
+ var s, o, r, i, a, c, n, h, l, m, d, S, w, y, v, D, R, V, K;
849
846
  this.animationId = void 0;
850
847
  let t = !1;
851
848
  const e = /* @__PURE__ */ new Map();
@@ -855,9 +852,9 @@ class me {
855
852
  await ((s = k.node) == null ? void 0 : s.consumeServiceAsync({
856
853
  isFullWork: !0,
857
854
  worker: this
858
- })), this.selectorWorkShapes.forEach((b, O) => {
859
- var E;
860
- (E = b.selectIds) != null && E.includes(L) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
855
+ })), this.selectorWorkShapes.forEach((b, C) => {
856
+ var O;
857
+ (O = b.selectIds) != null && O.includes(L) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
861
858
  }), this.workShapes.delete(L);
862
859
  break;
863
860
  }
@@ -865,9 +862,9 @@ class me {
865
862
  k.node && (await ((o = k.node) == null ? void 0 : o.consumeServiceAsync({
866
863
  isFullWork: !0,
867
864
  replaceId: L
868
- })), this.selectorWorkShapes.forEach((b, O) => {
869
- var E;
870
- (E = b.selectIds) != null && E.includes(L) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
865
+ })), this.selectorWorkShapes.forEach((b, C) => {
866
+ var O;
867
+ (O = b.selectIds) != null && O.includes(L) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
871
868
  }), (r = k.node) == null || r.clearTmpPoints(), this.workShapes.delete(L));
872
869
  break;
873
870
  }
@@ -880,17 +877,17 @@ class me {
880
877
  case f.SpeechBalloon: {
881
878
  const b = !!k.ops;
882
879
  if ((i = k.animationWorkData) != null && i.length) {
883
- const O = k.oldRect;
880
+ const C = k.oldRect;
884
881
  (a = k.node) == null || a.consumeService({
885
882
  op: k.animationWorkData,
886
883
  isFullWork: b
887
- }), b && (this.selectorWorkShapes.forEach((E, D) => {
884
+ }), b && (this.selectorWorkShapes.forEach((O, E) => {
888
885
  var x;
889
- (x = E.selectIds) != null && x.includes(L) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
890
- }), (n = k.node) == null || n.clearTmpPoints(), this.workShapes.delete(L)), e.set(L, {
891
- workState: O ? k.ops ? T.Done : T.Doing : T.Start,
892
- op: k.animationWorkData.filter((E, D) => {
893
- if (D % 3 !== 2)
886
+ (x = O.selectIds) != null && x.includes(L) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
887
+ }), (c = k.node) == null || c.clearTmpPoints(), this.workShapes.delete(L)), e.set(L, {
888
+ workState: C ? k.ops ? W.Done : W.Doing : W.Start,
889
+ op: k.animationWorkData.filter((O, E) => {
890
+ if (E % 3 !== 2)
894
891
  return !0;
895
892
  }).slice(-2)
896
893
  }), k.animationWorkData.length = 0;
@@ -899,31 +896,31 @@ class me {
899
896
  }
900
897
  case f.Pencil: {
901
898
  if (!k.useAnimation && k.ops)
902
- (c = k.node) == null || c.consumeService({
899
+ (n = k.node) == null || n.consumeService({
903
900
  op: k.animationWorkData || [],
904
901
  isFullWork: !0,
905
902
  replaceId: L
906
- }), (h = k.node) == null || h.updataOptService(k.updateNodeOpt), this.selectorWorkShapes.forEach((b, O) => {
907
- var E;
908
- (E = b.selectIds) != null && E.includes(L) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
903
+ }), (h = k.node) == null || h.updataOptService(k.updateNodeOpt), this.selectorWorkShapes.forEach((b, C) => {
904
+ var O;
905
+ (O = b.selectIds) != null && O.includes(L) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
909
906
  }), (l = k.node) == null || l.clearTmpPoints(), this.workShapes.delete(L);
910
907
  else if (k.useAnimation) {
911
908
  if (k.isDel) {
912
909
  (m = k.node) == null || m.clearTmpPoints(), this.workShapes.delete(L);
913
910
  break;
914
911
  }
915
- const b = 3, O = this.computNextAnimationIndex(k, b), E = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - b), D = (k.animationWorkData || []).slice(E, O), x = (w = (d = k.node) == null ? void 0 : d.getWorkId()) == null ? void 0 : w.toString();
916
- if ((k.animationIndex || 0) < O || k.isDiff) {
917
- if ((S = k.node) == null || S.consumeService({
918
- op: D,
912
+ const b = 3, C = this.computNextAnimationIndex(k, b), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - b), E = (k.animationWorkData || []).slice(O, C), x = (S = (d = k.node) == null ? void 0 : d.getWorkId()) == null ? void 0 : S.toString();
913
+ if ((k.animationIndex || 0) < C || k.isDiff) {
914
+ if ((w = k.node) == null || w.consumeService({
915
+ op: E,
919
916
  isFullWork: !1
920
- }), k.animationIndex = O, k.isDiff && (k.isDiff = !1), D.length) {
921
- const _ = D.filter((B, re) => {
917
+ }), k.animationIndex = C, k.isDiff && (k.isDiff = !1), E.length) {
918
+ const _ = E.filter((B, re) => {
922
919
  if (re % b !== b - 1)
923
920
  return !0;
924
921
  }).slice(-2);
925
922
  e.set(L, {
926
- workState: E === 0 ? T.Start : O === ((y = k.animationWorkData) == null ? void 0 : y.length) ? T.Done : T.Doing,
923
+ workState: O === 0 ? W.Start : C === ((y = k.animationWorkData) == null ? void 0 : y.length) ? W.Done : W.Doing,
927
924
  op: _
928
925
  });
929
926
  }
@@ -932,8 +929,8 @@ class me {
932
929
  isFullWork: !0,
933
930
  replaceId: x
934
931
  }), k.isDel = !0, e.set(L, {
935
- workState: T.Done,
936
- op: D.filter((_, B) => {
932
+ workState: W.Done,
933
+ op: E.filter((_, B) => {
937
934
  if (B % b !== b - 1)
938
935
  return !0;
939
936
  }).slice(-2)
@@ -946,29 +943,29 @@ class me {
946
943
  case f.BitMapEraser:
947
944
  case f.PencilEraser: {
948
945
  if (k.isDel) {
949
- (C = k.node) == null || C.clearTmpPoints(), this.workShapes.delete(L);
946
+ (D = k.node) == null || D.clearTmpPoints(), this.workShapes.delete(L);
950
947
  break;
951
948
  }
952
949
  if (k.ops && ((R = k.animationWorkData) != null && R.length)) {
953
950
  const b = k.animationWorkData.slice(-3, -1);
954
951
  e.set(L, {
955
- workState: T.Done,
952
+ workState: W.Done,
956
953
  op: b
957
954
  }), k.isDel = !0;
958
955
  break;
959
956
  }
960
957
  if (k.useAnimation) {
961
- const O = this.computNextAnimationIndex(k, 3), E = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - 3), D = (k.animationWorkData || []).slice(E, O);
962
- if (((k.animationIndex || 0) < O || k.isDiff) && ((V = k.node) == null || V.consumeService({
963
- op: D,
958
+ const C = this.computNextAnimationIndex(k, 3), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - 3), E = (k.animationWorkData || []).slice(O, C);
959
+ if (((k.animationIndex || 0) < C || k.isDiff) && ((V = k.node) == null || V.consumeService({
960
+ op: E,
964
961
  isFullWork: k.toolsType !== f.BitMapEraser
965
- }), k.animationIndex = O, k.isDiff && (k.isDiff = !1), D.length)) {
966
- const x = D.filter((_, B) => {
962
+ }), k.animationIndex = C, k.isDiff && (k.isDiff = !1), E.length)) {
963
+ const x = E.filter((_, B) => {
967
964
  if (B % 3 !== 2)
968
965
  return !0;
969
966
  }).slice(-2);
970
967
  e.set(L, {
971
- workState: E === 0 ? T.Start : O === ((K = k.animationWorkData) == null ? void 0 : K.length) ? T.Done : T.Doing,
968
+ workState: O === 0 ? W.Start : C === ((K = k.animationWorkData) == null ? void 0 : K.length) ? W.Done : W.Doing,
972
969
  op: x
973
970
  });
974
971
  }
@@ -1015,31 +1012,31 @@ class me {
1015
1012
  return !1;
1016
1013
  }
1017
1014
  activeWorkShape(t) {
1018
- var w, S, y, v;
1019
- const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: n, useAnimation: c, imageBitmap: h } = t;
1015
+ var S, w, y, v;
1016
+ const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: c, useAnimation: n, imageBitmap: h } = t;
1020
1017
  if (!e)
1021
1018
  return;
1022
- const l = e.toString(), m = (w = this.vNodes.get(l)) == null ? void 0 : w.rect;
1023
- if (!((S = this.workShapes) != null && S.has(l))) {
1024
- let C = {
1019
+ const l = e.toString(), m = (S = this.vNodes.get(l)) == null ? void 0 : S.rect;
1020
+ if (!((w = this.workShapes) != null && w.has(l))) {
1021
+ let D = {
1025
1022
  toolsType: o,
1026
- animationWorkData: n || [],
1023
+ animationWorkData: c || [],
1027
1024
  animationIndex: 0,
1028
1025
  type: r,
1029
1026
  updateNodeOpt: i,
1030
1027
  ops: a,
1031
- useAnimation: typeof c < "u" ? c : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
1028
+ useAnimation: typeof n < "u" ? n : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
1032
1029
  oldRect: m,
1033
1030
  isDiff: !1,
1034
1031
  imageBitmap: h
1035
1032
  };
1036
- o && s && (C = this.setNodeKey(l, C, o, s)), (y = this.workShapes) == null || y.set(l, C);
1033
+ o && s && (D = this.setNodeKey(l, D, o, s)), (y = this.workShapes) == null || y.set(l, D);
1037
1034
  }
1038
1035
  const d = (v = this.workShapes) == null ? void 0 : v.get(l);
1039
- r && (d.type = r), a && (d.animationWorkData = P(a), d.ops = a), i && (d.updateNodeOpt = i), n && (d.isDiff = this.hasDiffData(d.animationWorkData || [], n, d.toolsType), d.animationWorkData = n), d.node && d.node.getWorkId() !== l && d.node.setWorkId(l), m && (d.oldRect = m), o && s && (s.syncUnitTime && (this.syncUnitTime = s.syncUnitTime), d.toolsType !== o && o && s && this.setNodeKey(l, d, o, s), d.node && d.node.setWorkOptions(s)), h && (d.imageBitmap = h);
1036
+ r && (d.type = r), a && (d.animationWorkData = P(a), d.ops = a), i && (d.updateNodeOpt = i), c && (d.isDiff = this.hasDiffData(d.animationWorkData || [], c, d.toolsType), d.animationWorkData = c), d.node && d.node.getWorkId() !== l && d.node.setWorkId(l), m && (d.oldRect = m), o && s && (s.syncUnitTime && (this.syncUnitTime = s.syncUnitTime), d.toolsType !== o && o && s && this.setNodeKey(l, d, o, s), d.node && d.node.setWorkOptions(s)), h && (d.imageBitmap = h);
1040
1037
  }
1041
1038
  removeNode(t, e) {
1042
- t.indexOf(W) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
1039
+ t.indexOf(T) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
1043
1040
  s.remove();
1044
1041
  }), this.thread.serviceLayer.getElementsByName(t).forEach((s) => {
1045
1042
  s.remove();
@@ -1050,12 +1047,12 @@ class me {
1050
1047
  s && (this.activeSelectorShape(t), this.willRunEffectSelectorIds.add(s)), this.runEffect();
1051
1048
  }
1052
1049
  activeSelectorShape(t) {
1053
- var c, h, l;
1050
+ var n, h, l;
1054
1051
  const { workId: e, opt: s, toolsType: o, type: r, selectIds: i } = t;
1055
1052
  if (!e)
1056
1053
  return;
1057
1054
  const a = e.toString();
1058
- if (!((c = this.selectorWorkShapes) != null && c.has(a))) {
1055
+ if (!((n = this.selectorWorkShapes) != null && n.has(a))) {
1059
1056
  let m = {
1060
1057
  toolsType: o,
1061
1058
  selectIds: i,
@@ -1064,8 +1061,8 @@ class me {
1064
1061
  };
1065
1062
  o && s && (m = this.setNodeKey(a, m, o, s)), (h = this.selectorWorkShapes) == null || h.set(a, m);
1066
1063
  }
1067
- const n = (l = this.selectorWorkShapes) == null ? void 0 : l.get(a);
1068
- r && (n.type = r), n.node && n.node.getWorkId() !== a && n.node.setWorkId(a), n.selectIds = i || [];
1064
+ const c = (l = this.selectorWorkShapes) == null ? void 0 : l.get(a);
1065
+ r && (c.type = r), c.node && c.node.getWorkId() !== a && c.node.setWorkId(a), c.selectIds = i || [];
1069
1066
  }
1070
1067
  setNodeKey(t, e, s, o) {
1071
1068
  return e.toolsType = s, e.node = z({
@@ -1115,28 +1112,28 @@ class Se extends M {
1115
1112
  return this.consumeForLocalWorker(e), !0;
1116
1113
  }
1117
1114
  async consumeForLocalWorker(e) {
1118
- var c;
1119
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: n } = e;
1120
- s === W && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1115
+ var n;
1116
+ const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c } = e;
1117
+ s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1121
1118
  updateSelectorOpt: o,
1122
1119
  willRefreshSelector: r,
1123
1120
  willSyncService: i,
1124
1121
  willSerializeData: a,
1125
- textUpdateForWoker: n,
1122
+ textUpdateForWoker: c,
1126
1123
  callback: this.updateSelectorCallback
1127
1124
  }));
1128
1125
  }
1129
1126
  updateSelectorCallback(e) {
1130
- const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a, textUpdateForWoker: n } = s, c = o.sp || [];
1127
+ const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a, textUpdateForWoker: c } = s, n = o.sp || [];
1131
1128
  if (i)
1132
1129
  for (const [h, l] of r.entries())
1133
- n && l.toolsType === f.Text ? c.push({
1130
+ c && l.toolsType === f.Text ? n.push({
1134
1131
  ...l,
1135
1132
  workId: h,
1136
1133
  type: p.TextUpdate,
1137
1134
  dataType: g.Local,
1138
1135
  willSyncService: !0
1139
- }) : c.push(
1136
+ }) : n.push(
1140
1137
  {
1141
1138
  ...l,
1142
1139
  workId: h,
@@ -1148,7 +1145,7 @@ class Se extends M {
1148
1145
  }
1149
1146
  );
1150
1147
  return {
1151
- sp: c
1148
+ sp: n
1152
1149
  };
1153
1150
  }
1154
1151
  }
@@ -1163,9 +1160,9 @@ class ye extends M {
1163
1160
  return this.consumeForLocalWorker(e), !0;
1164
1161
  }
1165
1162
  async consumeForLocalWorker(e) {
1166
- var n;
1163
+ var c;
1167
1164
  const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a } = e;
1168
- s === W && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1165
+ s === T && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1169
1166
  updateSelectorOpt: o,
1170
1167
  willRefreshSelector: r,
1171
1168
  willSyncService: i,
@@ -1174,13 +1171,13 @@ class ye extends M {
1174
1171
  }));
1175
1172
  }
1176
1173
  updateSelectorCallback(e) {
1177
- const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, n = o.sp || [];
1178
- if (i && n)
1179
- for (const [c, h] of r.entries())
1180
- n.push(
1174
+ const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, c = o.sp || [];
1175
+ if (i && c)
1176
+ for (const [n, h] of r.entries())
1177
+ c.push(
1181
1178
  {
1182
1179
  ...h,
1183
- workId: c,
1180
+ workId: n,
1184
1181
  type: p.UpdateNode,
1185
1182
  updateNodeOpt: {
1186
1183
  useAnimation: !1
@@ -1189,7 +1186,7 @@ class ye extends M {
1189
1186
  }
1190
1187
  );
1191
1188
  return {
1192
- sp: n
1189
+ sp: c
1193
1190
  };
1194
1191
  }
1195
1192
  }
@@ -1205,52 +1202,52 @@ class we extends M {
1205
1202
  }
1206
1203
  async consumeForLocalWorker(e) {
1207
1204
  var h, l;
1208
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: n, emitEventType: c } = e;
1209
- s === W && o && (o.workState === T.Done && (o != null && o.translate) && (o.translate[0] || o.translate[1]) || o.workState !== T.Done ? await ((h = this.localWork) == null ? void 0 : h.updateSelector({
1205
+ const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c, emitEventType: n } = e;
1206
+ s === T && o && (o.workState === W.Done && (o != null && o.translate) && (o.translate[0] || o.translate[1]) || o.workState !== W.Done ? await ((h = this.localWork) == null ? void 0 : h.updateSelector({
1210
1207
  updateSelectorOpt: o,
1211
1208
  willRefreshSelector: r,
1212
1209
  willSyncService: i,
1213
1210
  willSerializeData: a,
1214
1211
  isSync: !0,
1215
- textUpdateForWoker: n,
1216
- emitEventType: c,
1212
+ textUpdateForWoker: c,
1213
+ emitEventType: n,
1217
1214
  callback: this.updateSelectorCallback
1218
- })) : o.workState === T.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
1215
+ })) : o.workState === W.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
1219
1216
  }
1220
1217
  updateSelectorCallback(e) {
1221
- const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: n, isSync: c, updateSelectorOpt: h, textUpdateForWoker: l } = s, m = h.workState, d = o.sp || [];
1222
- if (m === T.Start)
1218
+ const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h, textUpdateForWoker: l } = s, m = h.workState, d = o.sp || [];
1219
+ if (m === W.Start)
1223
1220
  return {
1224
1221
  sp: [],
1225
1222
  render: []
1226
1223
  };
1227
- const w = a == null ? void 0 : a.selectRect;
1228
- if (n) {
1229
- m === T.Doing && d.push({
1224
+ const S = a == null ? void 0 : a.selectRect;
1225
+ if (c) {
1226
+ m === W.Doing && d.push({
1230
1227
  type: p.Select,
1231
1228
  selectIds: i.selectIds,
1232
- selectRect: w,
1229
+ selectRect: S,
1233
1230
  willSyncService: !0,
1234
1231
  isSync: !0,
1235
1232
  points: i.getChildrenPoints(),
1236
1233
  textOpt: i.textOpt
1237
1234
  });
1238
- for (const [S, y] of r.entries())
1235
+ for (const [w, y] of r.entries())
1239
1236
  l && y.toolsType === f.Text ? d.push({
1240
1237
  ...y,
1241
- workId: S,
1238
+ workId: w,
1242
1239
  type: p.TextUpdate,
1243
1240
  dataType: g.Local,
1244
1241
  willSyncService: !0
1245
1242
  }) : d.push(
1246
1243
  {
1247
1244
  ...y,
1248
- workId: S,
1245
+ workId: w,
1249
1246
  type: p.UpdateNode,
1250
1247
  updateNodeOpt: {
1251
1248
  useAnimation: !1
1252
1249
  },
1253
- isSync: c
1250
+ isSync: n
1254
1251
  }
1255
1252
  );
1256
1253
  }
@@ -1281,7 +1278,7 @@ class ge extends M {
1281
1278
  async consumeForLocalWorker(e) {
1282
1279
  var a;
1283
1280
  const { workId: s, updateNodeOpt: o, willSyncService: r, willSerializeData: i } = e;
1284
- s === W && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
1281
+ s === T && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
1285
1282
  updateSelectorOpt: o,
1286
1283
  willSyncService: r,
1287
1284
  willSerializeData: i,
@@ -1290,32 +1287,32 @@ class ge extends M {
1290
1287
  }));
1291
1288
  }
1292
1289
  updateSelectorCallback(e) {
1293
- const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: n, willSyncService: c } = s, h = n.workState, l = o.sp || [], m = i == null ? void 0 : i.selectRect;
1294
- if (h === T.Start)
1290
+ const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n } = s, h = c.workState, l = o.sp || [], m = i == null ? void 0 : i.selectRect;
1291
+ if (h === W.Start)
1295
1292
  return {
1296
1293
  sp: [],
1297
1294
  render: []
1298
1295
  };
1299
- if (c) {
1296
+ if (n) {
1300
1297
  l.push({
1301
1298
  type: p.Select,
1302
1299
  selectIds: r.selectIds,
1303
1300
  selectRect: m,
1304
1301
  willSyncService: !0,
1305
1302
  isSync: !0,
1306
- points: h === T.Done && r.getChildrenPoints() || void 0,
1303
+ points: h === W.Done && r.getChildrenPoints() || void 0,
1307
1304
  textOpt: r.textOpt
1308
1305
  });
1309
- for (const [d, w] of a.entries())
1310
- w.toolsType === f.Text ? l.push({
1311
- ...w,
1306
+ for (const [d, S] of a.entries())
1307
+ S.toolsType === f.Text ? l.push({
1308
+ ...S,
1312
1309
  workId: d,
1313
1310
  type: p.TextUpdate,
1314
1311
  dataType: g.Local,
1315
1312
  willSyncService: !0
1316
1313
  }) : l.push(
1317
1314
  {
1318
- ...w,
1315
+ ...S,
1319
1316
  workId: d,
1320
1317
  type: p.UpdateNode,
1321
1318
  updateNodeOpt: {
@@ -1341,34 +1338,34 @@ class Ie extends M {
1341
1338
  return await this.consumeForLocalWorker(e), !0;
1342
1339
  }
1343
1340
  async consumeForLocalWorker(e) {
1344
- var c;
1345
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, emitEventType: n } = e;
1346
- s === W && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1341
+ var n;
1342
+ const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, emitEventType: c } = e;
1343
+ s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1347
1344
  updateSelectorOpt: o,
1348
1345
  willRefreshSelector: r,
1349
1346
  willSyncService: i,
1350
1347
  willSerializeData: a,
1351
- emitEventType: n,
1348
+ emitEventType: c,
1352
1349
  isSync: !0,
1353
1350
  callback: this.updateSelectorCallback
1354
1351
  }));
1355
1352
  }
1356
1353
  updateSelectorCallback(e) {
1357
- const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: n, willSyncService: c, willSerializeData: h, isSync: l } = s, m = n.workState, d = o.sp || [], w = i == null ? void 0 : i.selectRect;
1358
- if (c) {
1359
- h && m === T.Done && d.push({
1354
+ const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: a } = e, { updateSelectorOpt: c, willSyncService: n, willSerializeData: h, isSync: l } = s, m = c.workState, d = o.sp || [], S = i == null ? void 0 : i.selectRect;
1355
+ if (n) {
1356
+ h && m === W.Done && d.push({
1360
1357
  type: p.Select,
1361
1358
  selectIds: r.selectIds,
1362
- selectRect: w,
1359
+ selectRect: S,
1363
1360
  willSyncService: !0,
1364
1361
  isSync: l,
1365
1362
  points: r.getChildrenPoints()
1366
1363
  });
1367
- for (const [S, y] of a.entries())
1364
+ for (const [w, y] of a.entries())
1368
1365
  d.push(
1369
1366
  {
1370
1367
  ...y,
1371
- workId: S,
1368
+ workId: w,
1372
1369
  type: p.UpdateNode,
1373
1370
  updateNodeOpt: {
1374
1371
  useAnimation: !1
@@ -1382,7 +1379,7 @@ class Ie extends M {
1382
1379
  };
1383
1380
  }
1384
1381
  }
1385
- class Te extends M {
1382
+ class We extends M {
1386
1383
  constructor() {
1387
1384
  super(...arguments);
1388
1385
  u(this, "emitEventType", I.SetFontStyle);
@@ -1393,44 +1390,44 @@ class Te extends M {
1393
1390
  return await this.consumeForLocalWorker(e), !0;
1394
1391
  }
1395
1392
  async consumeForLocalWorker(e) {
1396
- var c;
1397
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: n } = e;
1398
- s === W && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1393
+ var n;
1394
+ const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c } = e;
1395
+ s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1399
1396
  updateSelectorOpt: o,
1400
1397
  willRefreshSelector: r,
1401
1398
  willSyncService: i,
1402
1399
  willSerializeData: a,
1403
- textUpdateForWoker: n,
1400
+ textUpdateForWoker: c,
1404
1401
  callback: this.updateSelectorCallback
1405
1402
  }));
1406
1403
  }
1407
1404
  updateSelectorCallback(e) {
1408
- const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: n, isSync: c, updateSelectorOpt: h, textUpdateForWoker: l } = s, m = o.sp || [], d = a == null ? void 0 : a.selectRect;
1409
- if (n && m) {
1405
+ const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h, textUpdateForWoker: l } = s, m = o.sp || [], d = a == null ? void 0 : a.selectRect;
1406
+ if (c && m) {
1410
1407
  h.fontSize && m.push({
1411
1408
  type: p.Select,
1412
1409
  selectIds: i.selectIds,
1413
1410
  selectRect: d,
1414
- willSyncService: n,
1415
- isSync: c,
1411
+ willSyncService: c,
1412
+ isSync: n,
1416
1413
  points: i.getChildrenPoints()
1417
1414
  });
1418
- for (const [w, S] of r.entries())
1419
- l && S.toolsType === f.Text ? m.push({
1420
- ...S,
1421
- workId: w,
1415
+ for (const [S, w] of r.entries())
1416
+ l && w.toolsType === f.Text ? m.push({
1417
+ ...w,
1418
+ workId: S,
1422
1419
  type: p.TextUpdate,
1423
1420
  dataType: g.Local,
1424
1421
  willSyncService: !0
1425
1422
  }) : m.push(
1426
1423
  {
1427
- ...S,
1428
- workId: w,
1424
+ ...w,
1425
+ workId: S,
1429
1426
  type: p.UpdateNode,
1430
1427
  updateNodeOpt: {
1431
1428
  useAnimation: !1
1432
1429
  },
1433
- isSync: c
1430
+ isSync: n
1434
1431
  }
1435
1432
  );
1436
1433
  }
@@ -1439,7 +1436,7 @@ class Te extends M {
1439
1436
  };
1440
1437
  }
1441
1438
  }
1442
- class We extends M {
1439
+ class Te extends M {
1443
1440
  constructor() {
1444
1441
  super(...arguments);
1445
1442
  u(this, "emitEventType", I.SetPoint);
@@ -1450,22 +1447,22 @@ class We extends M {
1450
1447
  return this.consumeForLocalWorker(e), !0;
1451
1448
  }
1452
1449
  async consumeForLocalWorker(e) {
1453
- var c;
1454
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: n } = e;
1455
- s === W && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1450
+ var n;
1451
+ const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c } = e;
1452
+ s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1456
1453
  updateSelectorOpt: o,
1457
1454
  willRefreshSelector: r,
1458
1455
  willSyncService: i,
1459
1456
  emitEventType: this.emitEventType,
1460
1457
  willSerializeData: a,
1461
1458
  isSync: !0,
1462
- textUpdateForWoker: n,
1459
+ textUpdateForWoker: c,
1463
1460
  callback: this.updateSelectorCallback
1464
1461
  }));
1465
1462
  }
1466
1463
  updateSelectorCallback(e) {
1467
- const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: n, isSync: c } = s, h = o.sp || [], l = a == null ? void 0 : a.selectRect;
1468
- if (n && h) {
1464
+ const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n } = s, h = o.sp || [], l = a == null ? void 0 : a.selectRect;
1465
+ if (c && h) {
1469
1466
  for (const [m, d] of r.entries())
1470
1467
  h.push(
1471
1468
  {
@@ -1475,15 +1472,15 @@ class We extends M {
1475
1472
  updateNodeOpt: {
1476
1473
  useAnimation: !1
1477
1474
  },
1478
- isSync: c
1475
+ isSync: n
1479
1476
  }
1480
1477
  );
1481
1478
  h.push({
1482
1479
  type: p.Select,
1483
1480
  selectIds: i.selectIds,
1484
1481
  selectRect: l,
1485
- willSyncService: n,
1486
- isSync: c,
1482
+ willSyncService: c,
1483
+ isSync: n,
1487
1484
  points: i.getChildrenPoints()
1488
1485
  });
1489
1486
  }
@@ -1503,9 +1500,9 @@ class Ne extends M {
1503
1500
  return this.consumeForLocalWorker(e), !0;
1504
1501
  }
1505
1502
  async consumeForLocalWorker(e) {
1506
- var n;
1503
+ var c;
1507
1504
  const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a } = e;
1508
- s === W && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1505
+ s === T && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1509
1506
  updateSelectorOpt: o,
1510
1507
  willRefreshSelector: r,
1511
1508
  willSyncService: i,
@@ -1514,18 +1511,18 @@ class Ne extends M {
1514
1511
  }));
1515
1512
  }
1516
1513
  updateSelectorCallback(e) {
1517
- const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: n, isSync: c, updateSelectorOpt: h } = s, l = o.sp || [], m = a == null ? void 0 : a.selectRect;
1518
- if (n && l) {
1519
- for (const [d, w] of r.entries())
1514
+ const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: a } = e, { willSyncService: c, isSync: n, updateSelectorOpt: h } = s, l = o.sp || [], m = a == null ? void 0 : a.selectRect;
1515
+ if (c && l) {
1516
+ for (const [d, S] of r.entries())
1520
1517
  l.push(
1521
1518
  {
1522
- ...w,
1519
+ ...S,
1523
1520
  workId: d,
1524
1521
  type: p.UpdateNode,
1525
1522
  updateNodeOpt: {
1526
1523
  useAnimation: !1
1527
1524
  },
1528
- isSync: c
1525
+ isSync: n
1529
1526
  }
1530
1527
  );
1531
1528
  l.push({
@@ -1536,8 +1533,8 @@ class Ne extends M {
1536
1533
  type: p.Select,
1537
1534
  selectIds: i.selectIds,
1538
1535
  selectRect: m,
1539
- willSyncService: n,
1540
- isSync: c
1536
+ willSyncService: c,
1537
+ isSync: n
1541
1538
  });
1542
1539
  }
1543
1540
  return {
@@ -1556,9 +1553,9 @@ class Le extends M {
1556
1553
  return this.consumeForLocalWorker(e), !0;
1557
1554
  }
1558
1555
  async consumeForLocalWorker(e) {
1559
- var n;
1556
+ var c;
1560
1557
  const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a } = e;
1561
- s === W && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1558
+ s === T && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1562
1559
  updateSelectorOpt: o,
1563
1560
  willRefreshSelector: r,
1564
1561
  willSyncService: i,
@@ -1567,13 +1564,13 @@ class Le extends M {
1567
1564
  }));
1568
1565
  }
1569
1566
  updateSelectorCallback(e) {
1570
- const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, n = o.sp || [];
1571
- if (i && n)
1572
- for (const [c, h] of r.entries())
1573
- n.push(
1567
+ const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, c = o.sp || [];
1568
+ if (i && c)
1569
+ for (const [n, h] of r.entries())
1570
+ c.push(
1574
1571
  {
1575
1572
  ...h,
1576
- workId: c,
1573
+ workId: n,
1577
1574
  type: p.UpdateNode,
1578
1575
  updateNodeOpt: {
1579
1576
  useAnimation: !1
@@ -1582,7 +1579,7 @@ class Le extends M {
1582
1579
  }
1583
1580
  );
1584
1581
  return {
1585
- sp: n
1582
+ sp: c
1586
1583
  };
1587
1584
  }
1588
1585
  }
@@ -1608,9 +1605,9 @@ class be {
1608
1605
  case I.RotateNode:
1609
1606
  return new Ie();
1610
1607
  case I.SetFontStyle:
1611
- return new Te();
1612
- case I.SetPoint:
1613
1608
  return new We();
1609
+ case I.SetPoint:
1610
+ return new Te();
1614
1611
  case I.SetLock:
1615
1612
  return new Ne();
1616
1613
  case I.SetShapeOpt:
@@ -1629,7 +1626,7 @@ class be {
1629
1626
  return !1;
1630
1627
  }
1631
1628
  }
1632
- class Ce {
1629
+ class De {
1633
1630
  constructor(t, e) {
1634
1631
  u(this, "viewId");
1635
1632
  u(this, "fullLayer");
@@ -1703,7 +1700,7 @@ class Ce {
1703
1700
  }
1704
1701
  async on(t) {
1705
1702
  if (!await this.methodBuilder.consumeForMainThread(t)) {
1706
- const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: a, imageSrc: n, imageBitmap: c, workIds: h } = t, l = i == null ? void 0 : i.toString();
1703
+ const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: a, imageSrc: c, imageBitmap: n, workIds: h } = t, l = i == null ? void 0 : i.toString();
1707
1704
  switch (e) {
1708
1705
  case p.UpdateDpr:
1709
1706
  U(t.dpr) && this.updateDpr(t.dpr);
@@ -1747,7 +1744,7 @@ class Ce {
1747
1744
  }
1748
1745
  break;
1749
1746
  case p.DrawWork:
1750
- a === T.Done && r === g.Local ? this.consumeDrawAll(r, t) : this.consumeDraw(r, t);
1747
+ a === W.Done && r === g.Local ? this.consumeDrawAll(r, t) : this.consumeDraw(r, t);
1751
1748
  break;
1752
1749
  case p.UpdateNode:
1753
1750
  case p.FullWork:
@@ -1761,7 +1758,7 @@ class Ce {
1761
1758
  await this.removeNode(t);
1762
1759
  return;
1763
1760
  case p.Select:
1764
- r === g.Service && (i === W ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
1761
+ r === g.Service && (i === T ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
1765
1762
  break;
1766
1763
  case p.CursorHover:
1767
1764
  this.localWork.cursorHover(t);
@@ -1770,16 +1767,16 @@ class Ce {
1770
1767
  r === g.Local && this.localWork.checkTextActive(t);
1771
1768
  break;
1772
1769
  case p.GetImageBitMap:
1773
- if (n && c && i) {
1770
+ if (c && n && i) {
1774
1771
  const m = i.toString();
1775
- this.deleteCachedImagesByWorkId(m), this.cacheImages.set(n, {
1776
- imageBitmap: c,
1772
+ this.deleteCachedImagesByWorkId(m), this.cacheImages.set(c, {
1773
+ imageBitmap: n,
1777
1774
  workId: m
1778
1775
  });
1779
- const d = this.imageResolveMap.get(n);
1776
+ const d = this.imageResolveMap.get(c);
1780
1777
  if (d) {
1781
- const { resolve: w, timer: S } = d;
1782
- S && clearTimeout(S), w && w(n);
1778
+ const { resolve: S, timer: w } = d;
1779
+ w && clearTimeout(w), S && S(c);
1783
1780
  }
1784
1781
  }
1785
1782
  break;
@@ -1808,30 +1805,30 @@ class Ce {
1808
1805
  async loadImageBitMap(t) {
1809
1806
  const { toolsType: e, opt: s, workId: o } = t;
1810
1807
  if (e === f.Image && s && o) {
1811
- const r = o.toString(), { src: i, type: a, width: n, height: c, strokeColor: h } = s;
1812
- if (!i || !a || !n || !c)
1808
+ const r = o.toString(), { src: i, type: a, width: c, height: n, strokeColor: h } = s;
1809
+ if (!i || !a || !c || !n)
1813
1810
  return;
1814
1811
  let l = i;
1815
1812
  if (a === ee.Iconify) {
1816
- const [S, y] = this.getIconSize(n, c, this.opt.displayer.dpr);
1817
- l = `${i}?width=${S}&height=${y}&color=${h}`;
1813
+ const [w, y] = this.getIconSize(c, n, this.opt.displayer.dpr);
1814
+ l = `${i}?width=${w}&height=${y}&color=${h}`;
1818
1815
  }
1819
1816
  if (this.cacheImages.has(l)) {
1820
- const S = this.getCachedImages(l);
1821
- if (S)
1822
- return S;
1817
+ const w = this.getCachedImages(l);
1818
+ if (w)
1819
+ return w;
1823
1820
  }
1824
1821
  if (this.imageResolveMap.has(l)) {
1825
- const S = this.getCachedImagesByWorkId(r);
1826
- if (S)
1827
- return S;
1822
+ const w = this.getCachedImagesByWorkId(r);
1823
+ if (w)
1824
+ return w;
1828
1825
  }
1829
- const w = await new Promise((S) => {
1826
+ const S = await new Promise((w) => {
1830
1827
  const y = this.imageResolveMap.get(l) || {
1831
1828
  resolve: void 0,
1832
1829
  timer: void 0
1833
1830
  };
1834
- y.timer && clearTimeout(y.timer), y.resolve = S, y.timer = setTimeout(() => {
1831
+ y.timer && clearTimeout(y.timer), y.resolve = w, y.timer = setTimeout(() => {
1835
1832
  const v = this.imageResolveMap.get(l);
1836
1833
  v != null && v.resolve && v.resolve(l);
1837
1834
  }, 5e3), this.imageResolveMap.set(l, y), this.opt.post({
@@ -1845,14 +1842,14 @@ class Ce {
1845
1842
  }]
1846
1843
  });
1847
1844
  });
1848
- return this.imageResolveMap.delete(w), this.getCachedImages(l);
1845
+ return this.imageResolveMap.delete(S), this.getCachedImages(l);
1849
1846
  }
1850
1847
  }
1851
1848
  async removeNode(t) {
1852
1849
  const { dataType: e, workId: s, removeIds: o } = t, r = o || [];
1853
1850
  if (s && r.push(s.toString()), r.length)
1854
1851
  for (const i of r) {
1855
- if (i === W) {
1852
+ if (i === T) {
1856
1853
  await this.localWork.removeSelector(t);
1857
1854
  continue;
1858
1855
  }
@@ -1880,25 +1877,25 @@ class Ce {
1880
1877
  if ((o = r.sp) != null && o.length)
1881
1878
  for (const i of r.sp) {
1882
1879
  let a = !1;
1883
- for (const n of t)
1884
- if (Q(i, n)) {
1880
+ for (const c of t)
1881
+ if (Q(i, c)) {
1885
1882
  a = !0;
1886
1883
  break;
1887
1884
  }
1888
1885
  a || t.push(i);
1889
1886
  }
1890
- U(r.drawCount) && (e = r.drawCount), U(r.consumeCount) && (s = r.consumeCount);
1887
+ U(r.fullWorkerDrawCount) && (e = r.fullWorkerDrawCount), U(r.consumeCount) && (s = r.consumeCount);
1891
1888
  }
1892
1889
  return this.combinePostMsg.clear(), {
1893
1890
  sp: t,
1894
- drawCount: e,
1891
+ fullWorkerDrawCount: e,
1895
1892
  consumeCount: s
1896
1893
  };
1897
1894
  }
1898
1895
  combinePost() {
1899
1896
  var s, o;
1900
1897
  const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None || r.isLockSentEventCursor);
1901
- e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, t.consumeCount === void 0 && delete t.consumeCount, t.drawCount === void 0 && delete t.drawCount, (t != null && t.consumeCount || t != null && t.drawCount || (o = t.sp) != null && o.length) && this.opt.post(t);
1898
+ e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, t.consumeCount === void 0 && delete t.consumeCount, t.fullWorkerDrawCount === void 0 && delete t.fullWorkerDrawCount, (t != null && t.consumeCount || t != null && t.fullWorkerDrawCount || (o = t.sp) != null && o.length) && this.opt.post(t);
1902
1899
  }
1903
1900
  clearAll() {
1904
1901
  this.fullLayer.children.length && (this.fullLayer.parent.children.forEach((t) => {
@@ -1937,7 +1934,7 @@ class Ce {
1937
1934
  const { cameraOpt: e, scenePath: s } = t;
1938
1935
  if (e && !Q(this.cameraOpt, e)) {
1939
1936
  if (this.taskUpdateCameraId && (clearTimeout(this.taskUpdateCameraId), this.taskUpdateCameraId = void 0), s) {
1940
- let c = !1;
1937
+ let n = !1;
1941
1938
  for (const [h, l] of this.localWork.getWorkShapes().entries())
1942
1939
  switch (l.toolsType) {
1943
1940
  case f.Text:
@@ -1948,10 +1945,10 @@ class Ce {
1948
1945
  case f.LaserPen:
1949
1946
  break;
1950
1947
  default:
1951
- h !== G && h !== W && (c = !0);
1948
+ h !== G && h !== T && (n = !0);
1952
1949
  break;
1953
1950
  }
1954
- if (c) {
1951
+ if (n) {
1955
1952
  this.taskUpdateCameraId = setTimeout(() => {
1956
1953
  this.taskUpdateCameraId = void 0, this.updateCamera(t);
1957
1954
  }, j);
@@ -1959,47 +1956,47 @@ class Ce {
1959
1956
  }
1960
1957
  }
1961
1958
  const r = /* @__PURE__ */ new Map();
1962
- for (const [c, h] of this.vNodes.getNodesByType(f.Text).entries()) {
1959
+ for (const [n, h] of this.vNodes.getNodesByType(f.Text).entries()) {
1963
1960
  const l = h.rect;
1964
- r.set(c, oe(l));
1961
+ r.set(n, oe(l));
1965
1962
  }
1966
1963
  const i = new Set(r.keys());
1967
1964
  let a = !1;
1968
1965
  if (this.localWork.hasSelector()) {
1969
- const c = (o = this.localWork.getSelector()) == null ? void 0 : o.selectIds;
1970
- if (c) {
1966
+ const n = (o = this.localWork.getSelector()) == null ? void 0 : o.selectIds;
1967
+ if (n) {
1971
1968
  a = !0;
1972
- for (const h of c)
1969
+ for (const h of n)
1973
1970
  i.add(h);
1974
1971
  }
1975
1972
  }
1976
- let n = !1;
1973
+ let c = !1;
1977
1974
  if (this.serviceWork.selectorWorkShapes.size)
1978
- for (const c of this.serviceWork.selectorWorkShapes.values()) {
1979
- const h = c.selectIds;
1975
+ for (const n of this.serviceWork.selectorWorkShapes.values()) {
1976
+ const h = n.selectIds;
1980
1977
  if (h) {
1981
- n = !0;
1978
+ c = !0;
1982
1979
  for (const l of h)
1983
1980
  i.add(l);
1984
1981
  }
1985
1982
  }
1986
1983
  if (this.setCameraOpt(e), this.vNodes.curNodeMap.size) {
1987
1984
  this.vNodes.clearTarget(), this.vNodes.updateHighLevelNodesRect(i), this.debounceUpdateCameraId && clearTimeout(this.debounceUpdateCameraId);
1988
- for (const [c, h] of r.entries()) {
1989
- const l = this.vNodes.get(c);
1985
+ for (const [n, h] of r.entries()) {
1986
+ const l = this.vNodes.get(n);
1990
1987
  if (l) {
1991
- const m = h, d = l.rect, w = this.getSceneRect(), S = $(m, w), y = $(d, w);
1988
+ const m = h, d = l.rect, S = this.getSceneRect(), w = $(m, S), y = $(d, S);
1992
1989
  let v = !1;
1993
- if ((S !== y || m.w !== d.w || m.h !== d.h || y === X.intersect) && (v = !0), v) {
1994
- const { toolsType: C, opt: R } = l;
1995
- C === f.Text && R.workState === T.Done && this.debounceUpdateCache.add(c);
1990
+ if ((w !== y || m.w !== d.w || m.h !== d.h || y === X.intersect) && (v = !0), v) {
1991
+ const { toolsType: D, opt: R } = l;
1992
+ D === f.Text && R.workState === W.Done && this.debounceUpdateCache.add(n);
1996
1993
  }
1997
1994
  }
1998
1995
  }
1999
- if (a && this.localWork.reRenderSelector(), n)
2000
- for (const [c, h] of this.serviceWork.selectorWorkShapes.entries())
1996
+ if (a && this.localWork.reRenderSelector(), c)
1997
+ for (const [n, h] of this.serviceWork.selectorWorkShapes.entries())
2001
1998
  this.serviceWork.runSelectWork({
2002
- workId: c,
1999
+ workId: n,
2003
2000
  selectIds: h.selectIds,
2004
2001
  msgType: p.Select,
2005
2002
  dataType: g.Service,
@@ -2008,19 +2005,19 @@ class Ce {
2008
2005
  this.debounceUpdateCameraId = setTimeout(() => {
2009
2006
  var h;
2010
2007
  this.debounceUpdateCameraId = void 0;
2011
- const c = [];
2008
+ const n = [];
2012
2009
  for (const l of this.debounceUpdateCache.values()) {
2013
2010
  if ((h = this.fullLayer) == null ? void 0 : h.getElementsByName(l)[0]) {
2014
2011
  const d = this.vNodes.get(l);
2015
2012
  if (d) {
2016
- const { toolsType: w, opt: S, rect: y } = d, v = this.localWork.setFullWork({
2017
- toolsType: w,
2018
- opt: S,
2013
+ const { toolsType: S, opt: w, rect: y } = d, v = this.localWork.setFullWork({
2014
+ toolsType: S,
2015
+ opt: w,
2019
2016
  workId: l
2020
2017
  });
2021
2018
  if (v) {
2022
- const C = this.getSceneRect(), R = $(y, C);
2023
- c.push(v.consumeServiceAsync({
2019
+ const D = this.getSceneRect(), R = $(y, D);
2020
+ n.push(v.consumeServiceAsync({
2024
2021
  isFullWork: !0,
2025
2022
  replaceId: l,
2026
2023
  isDrawLabel: R !== X.outside
@@ -2056,14 +2053,14 @@ class Ce {
2056
2053
  });
2057
2054
  }
2058
2055
  createLayer(t, e, s) {
2059
- const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), n = new se({
2056
+ const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), c = new se({
2060
2057
  anchor: [0.5, 0.5],
2061
2058
  pos: [o * 0.5, r * 0.5],
2062
2059
  size: [o, r],
2063
2060
  name: "viewport",
2064
2061
  id: t
2065
2062
  });
2066
- return a.append(n), n;
2063
+ return a.append(c), c;
2067
2064
  }
2068
2065
  updateScene(t) {
2069
2066
  this.scene.attr({ ...t });
@@ -2078,7 +2075,7 @@ class Ce {
2078
2075
  this.clearCacheImages(), this.clearImageResolveMap(), this.vNodes.clear(), this.fullLayer.remove(), this.topLayer.remove(), this.localLayer.remove(), this.serviceLayer.remove(), this.scene.remove(), this.localWork.destroy(), this.serviceWork.destroy(), this.topWork.destroy();
2079
2076
  }
2080
2077
  }
2081
- class Oe {
2078
+ class Ce {
2082
2079
  constructor(t, e) {
2083
2080
  u(this, "viewId");
2084
2081
  u(this, "fullLayer");
@@ -2134,8 +2131,8 @@ class Oe {
2134
2131
  });
2135
2132
  const a = this.imageResolveMap.get(s);
2136
2133
  if (a) {
2137
- const { resolve: n, timer: c } = a;
2138
- c && clearTimeout(c), n && n(s);
2134
+ const { resolve: c, timer: n } = a;
2135
+ n && clearTimeout(n), c && c(s);
2139
2136
  }
2140
2137
  }
2141
2138
  break;
@@ -2148,30 +2145,30 @@ class Oe {
2148
2145
  async loadImageBitMap(t) {
2149
2146
  const { toolsType: e, opt: s, workId: o } = t;
2150
2147
  if (e === f.Image && s && o) {
2151
- const r = o.toString(), { src: i, type: a, width: n, height: c, strokeColor: h } = s;
2152
- if (!i || !a || !n || !c)
2148
+ const r = o.toString(), { src: i, type: a, width: c, height: n, strokeColor: h } = s;
2149
+ if (!i || !a || !c || !n)
2153
2150
  return;
2154
2151
  let l = i;
2155
2152
  if (a === ee.Iconify) {
2156
- const [S, y] = this.getIconSize(n, c, this.opt.displayer.dpr);
2157
- l = `${i}?width=${S}&height=${y}&color=${h}`;
2153
+ const [w, y] = this.getIconSize(c, n, this.opt.displayer.dpr);
2154
+ l = `${i}?width=${w}&height=${y}&color=${h}`;
2158
2155
  }
2159
2156
  if (this.cacheImages.has(l)) {
2160
- const S = this.getCachedImages(l);
2161
- if (S)
2162
- return S;
2157
+ const w = this.getCachedImages(l);
2158
+ if (w)
2159
+ return w;
2163
2160
  }
2164
2161
  if (this.imageResolveMap.has(l)) {
2165
- const S = this.getCachedImagesByWorkId(r);
2166
- if (S)
2167
- return S;
2162
+ const w = this.getCachedImagesByWorkId(r);
2163
+ if (w)
2164
+ return w;
2168
2165
  }
2169
- const w = await new Promise((S) => {
2166
+ const S = await new Promise((w) => {
2170
2167
  const y = this.imageResolveMap.get(l) || {
2171
2168
  resolve: void 0,
2172
2169
  timer: void 0
2173
2170
  };
2174
- y.timer && clearTimeout(y.timer), y.resolve = S, y.timer = setTimeout(() => {
2171
+ y.timer && clearTimeout(y.timer), y.resolve = w, y.timer = setTimeout(() => {
2175
2172
  const v = this.imageResolveMap.get(l);
2176
2173
  v != null && v.resolve && v.resolve(l);
2177
2174
  }, 5e3), this.imageResolveMap.set(l, y), this.opt.post({
@@ -2185,7 +2182,7 @@ class Oe {
2185
2182
  }]
2186
2183
  });
2187
2184
  });
2188
- return this.imageResolveMap.delete(w), this.getCachedImages(l);
2185
+ return this.imageResolveMap.delete(S), this.getCachedImages(l);
2189
2186
  }
2190
2187
  }
2191
2188
  createWorkShapeNode(t) {
@@ -2228,7 +2225,7 @@ class Oe {
2228
2225
  if (e && s && o) {
2229
2226
  this.setCameraOpt(o);
2230
2227
  let a;
2231
- for (const [c, h] of Object.entries(s))
2228
+ for (const [n, h] of Object.entries(s))
2232
2229
  if (h != null && h.type)
2233
2230
  switch (h == null ? void 0 : h.type) {
2234
2231
  case p.UpdateNode:
@@ -2236,7 +2233,7 @@ class Oe {
2236
2233
  const { opt: l } = h, m = {
2237
2234
  ...h,
2238
2235
  opt: l,
2239
- workId: c,
2236
+ workId: n,
2240
2237
  msgType: p.FullWork,
2241
2238
  dataType: g.Service,
2242
2239
  viewId: this.viewId
@@ -2245,11 +2242,11 @@ class Oe {
2245
2242
  break;
2246
2243
  }
2247
2244
  }
2248
- let n;
2249
- r && i && (n = {
2245
+ let c;
2246
+ r && i && (c = {
2250
2247
  resizeWidth: r,
2251
2248
  resizeHeight: i
2252
- }), await this.getSnapshotRender({ scenePath: e, options: n });
2249
+ }), await this.getSnapshotRender({ scenePath: e, options: c });
2253
2250
  }
2254
2251
  }
2255
2252
  getSceneRect() {
@@ -2289,14 +2286,14 @@ class Oe {
2289
2286
  switch (a == null ? void 0 : a.type) {
2290
2287
  case p.UpdateNode:
2291
2288
  case p.FullWork: {
2292
- const n = await this.runFullWork({
2289
+ const c = await this.runFullWork({
2293
2290
  ...a,
2294
2291
  workId: i,
2295
2292
  msgType: p.FullWork,
2296
2293
  dataType: g.Service,
2297
2294
  viewId: this.viewId
2298
2295
  });
2299
- r = H(r, n);
2296
+ r = H(r, c);
2300
2297
  break;
2301
2298
  }
2302
2299
  }
@@ -2338,7 +2335,7 @@ class Oe {
2338
2335
  combinePost() {
2339
2336
  var s, o;
2340
2337
  const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None || r.isLockSentEventCursor);
2341
- e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, (t != null && t.drawCount || (o = t.sp) != null && o.length) && this.opt.post(t);
2338
+ e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, (o = t.sp) != null && o.length && this.opt.post(t);
2342
2339
  }
2343
2340
  createScene(t) {
2344
2341
  return new te({
@@ -2351,14 +2348,14 @@ class Oe {
2351
2348
  });
2352
2349
  }
2353
2350
  createLayer(t, e, s) {
2354
- const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), n = new se({
2351
+ const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), c = new se({
2355
2352
  anchor: [0.5, 0.5],
2356
2353
  pos: [o * 0.5, r * 0.5],
2357
2354
  size: [o, r],
2358
2355
  name: "viewport",
2359
2356
  id: t
2360
2357
  });
2361
- return a.append(n), n;
2358
+ return a.append(c), c;
2362
2359
  }
2363
2360
  updateScene(t) {
2364
2361
  this.scene.attr({ ...t });
@@ -2381,30 +2378,30 @@ class Ue {
2381
2378
  this.master = t;
2382
2379
  }
2383
2380
  post(t) {
2384
- const { drawCount: e, sp: s, workerTasksqueueCount: o, consumeCount: r } = t;
2381
+ const { fullWorkerDrawCount: e, sp: s, workerTasksqueueCount: o, consumeCount: r } = t;
2385
2382
  this.master.isBusy && q(o) && this.master.setWorkerTasksqueueCount(o), q(e) && this.master.setMaxDrawCount(e), q(r) && this.master.setConsumeCount(r), s && this.master.collectorSyncData(s);
2386
2383
  }
2387
2384
  destroy() {
2388
2385
  this.mainThreadMap.clear();
2389
2386
  }
2390
2387
  createMainThread(t, e) {
2391
- return new Ce(t, e);
2388
+ return new De(t, e);
2392
2389
  }
2393
2390
  createSnapshotThread(t, e) {
2394
- return new Oe(t, e);
2391
+ return new Ce(t, e);
2395
2392
  }
2396
2393
  async consume(t) {
2397
2394
  var e, s, o, r;
2398
2395
  for (const i of t.values()) {
2399
- const { msgType: a, viewId: n, tasksqueue: c, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt: m, cameraOpt: d, isSubWorker: w } = i;
2396
+ const { msgType: a, viewId: c, tasksqueue: n, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt: m, cameraOpt: d, isSubWorker: S } = i;
2400
2397
  if (a === p.Console) {
2401
2398
  console.log(this);
2402
2399
  continue;
2403
2400
  }
2404
2401
  if (a === p.Init) {
2405
- const y = (e = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : e.displayer, v = y == null ? void 0 : y.canvasContainerRef.current;
2402
+ const y = (e = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : e.displayer, v = y == null ? void 0 : y.canvasContainerRef.current;
2406
2403
  if (y && v && l && m) {
2407
- const C = this.createMainThread(n, {
2404
+ const D = this.createMainThread(c, {
2408
2405
  displayer: y,
2409
2406
  container: v,
2410
2407
  layerOpt: l,
@@ -2412,15 +2409,15 @@ class Ue {
2412
2409
  canvasOpt: m,
2413
2410
  post: this.post.bind(this)
2414
2411
  });
2415
- this.mainThreadMap.set(n, C), C && d && C.setCameraOpt(d);
2412
+ this.mainThreadMap.set(c, D), D && d && D.setCameraOpt(d);
2416
2413
  }
2417
2414
  continue;
2418
2415
  }
2419
- if ((a === p.Snapshot || a === p.BoundingBox) && n === ((s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.id)) {
2420
- const y = (o = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : o.displayer, v = (r = y.snapshotContainerRef) == null ? void 0 : r.current;
2416
+ if ((a === p.Snapshot || a === p.BoundingBox) && c === ((s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.id)) {
2417
+ const y = (o = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : o.displayer, v = (r = y.snapshotContainerRef) == null ? void 0 : r.current;
2421
2418
  if (y && v && d) {
2422
2419
  v.style.width = `${d.width}px`, v.style.height = `${d.height}px`;
2423
- const C = {
2420
+ const D = {
2424
2421
  ...Y.defaultLayerOpt,
2425
2422
  offscreen: !1,
2426
2423
  width: d.width,
@@ -2430,10 +2427,10 @@ class Ue {
2430
2427
  width: d.width,
2431
2428
  height: d.height
2432
2429
  };
2433
- this.snapshotThread = this.createSnapshotThread(n, {
2430
+ this.snapshotThread = this.createSnapshotThread(c, {
2434
2431
  displayer: y,
2435
2432
  container: v,
2436
- layerOpt: C,
2433
+ layerOpt: D,
2437
2434
  master: this.master,
2438
2435
  canvasOpt: R,
2439
2436
  post: this.post.bind(this)
@@ -2443,24 +2440,24 @@ class Ue {
2443
2440
  continue;
2444
2441
  }
2445
2442
  }
2446
- if (a === p.GetImageBitMap && w && this.snapshotThread) {
2443
+ if (a === p.GetImageBitMap && S && this.snapshotThread) {
2447
2444
  this.snapshotThread.on(i);
2448
2445
  continue;
2449
2446
  }
2450
- if (a === p.TasksQueue && (c != null && c.size)) {
2447
+ if (a === p.TasksQueue && (n != null && n.size)) {
2451
2448
  for (const [y, v] of this.mainThreadMap.entries()) {
2452
- const C = c.get(y);
2453
- C && (await v.on(C), h && this.post({ workerTasksqueueCount: h }));
2449
+ const D = n.get(y);
2450
+ D && (await v.on(D), h && this.post({ workerTasksqueueCount: h }));
2454
2451
  }
2455
2452
  continue;
2456
2453
  }
2457
- if (n === pe) {
2454
+ if (c === pe) {
2458
2455
  for (const y of this.mainThreadMap.values())
2459
- y.on(i), a === p.Destroy && this.mainThreadMap.delete(n);
2456
+ y.on(i), a === p.Destroy && this.mainThreadMap.delete(c);
2460
2457
  continue;
2461
2458
  }
2462
- const S = this.mainThreadMap.get(n);
2463
- S && (S.on(i), a === p.Destroy && this.mainThreadMap.delete(n));
2459
+ const w = this.mainThreadMap.get(c);
2460
+ w && (w.on(i), a === p.Destroy && this.mainThreadMap.delete(c));
2464
2461
  }
2465
2462
  }
2466
2463
  }