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

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-DFl78uPi.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,21 @@ 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
+ consumeCount: this.consumeCount,
672
+ fullWorkerDrawCount: this.fullWorkerDrawCount,
673
+ sp: h.op && [{ ...h, scenePath: r }] || void 0
676
674
  });
677
- this.drawBitMapEraser(h);
678
675
  break;
679
676
  }
680
677
  case f.Eraser:
681
678
  {
682
- const h = n.consume({
679
+ const h = c.consume({
683
680
  data: t,
684
681
  isFullWork: !0
685
682
  });
@@ -695,13 +692,14 @@ class fe {
695
692
  case f.SpeechBalloon:
696
693
  case f.Pencil:
697
694
  {
698
- const h = n.consume({
695
+ const h = c.consume({
699
696
  data: t,
700
697
  isFullWork: !1,
701
698
  isMainThread: !0
702
699
  });
703
- h && (this.drawCount++, this.thread.post({
704
- drawCount: this.drawCount,
700
+ h && (this.fullWorkerDrawCount++, this.thread.post({
701
+ consumeCount: this.consumeCount,
702
+ fullWorkerDrawCount: this.fullWorkerDrawCount,
705
703
  sp: h.op && [{ ...h, scenePath: r }] || void 0
706
704
  }));
707
705
  }
@@ -710,30 +708,30 @@ class fe {
710
708
  }
711
709
  }
712
710
  consumeDrawAll(t, e) {
713
- var i, a, n, c;
711
+ var i, a, c;
714
712
  const { workId: s, scenePath: o, isLockSentEventCursor: r } = t;
715
713
  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)
714
+ const n = s.toString();
715
+ this.drawWorkActiveId === n && (this.drawWorkActiveId = void 0);
716
+ const h = this.workShapes.get(n);
717
+ if (!h)
720
718
  return;
721
- const m = l.toolsType;
722
- if (m === f.LaserPen)
719
+ const l = h.toolsType;
720
+ if (l === f.LaserPen)
723
721
  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) {
722
+ 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 });
723
+ switch (l) {
726
724
  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);
725
+ 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
726
  break;
729
727
  case f.PencilEraser:
730
- this.drawPencilEraser({ ...S, scenePath: o }, r), l.clearTmpPoints();
728
+ this.drawPencilEraser({ ...S, scenePath: o }, r), h.clearTmpPoints();
731
729
  break;
732
730
  case f.BitMapEraser:
733
- (S.rect || (c = S.newWorkDatas) != null && c.size) && this.drawBitMapEraserFull(l, S, r);
731
+ this.drawBitMapEraserFull(h, S, r), this.fullWorkerDrawCount = 0, this.clearWorkShapeNodeCache(n);
734
732
  break;
735
733
  case f.Eraser:
736
- this.drawEraser({ ...S, scenePath: o }, r), l.clearTmpPoints();
734
+ this.drawEraser({ ...S, scenePath: o }, r), h.clearTmpPoints();
737
735
  break;
738
736
  case f.Arrow:
739
737
  case f.Straight:
@@ -743,14 +741,14 @@ class fe {
743
741
  case f.Polygon:
744
742
  case f.SpeechBalloon:
745
743
  case f.Pencil: {
746
- const y = [];
747
- r && y.push({
744
+ const w = [];
745
+ r && w.push({
748
746
  type: p.None,
749
747
  isLockSentEventCursor: r
750
- }), S && (y.push(S), this.drawCount = 0, this.thread.post({
751
- drawCount: this.drawCount,
752
- sp: y
753
- })), this.clearWorkShapeNodeCache(h);
748
+ }), S && (w.push(S), this.fullWorkerDrawCount = 0, this.thread.post({
749
+ fullWorkerDrawCount: this.fullWorkerDrawCount,
750
+ sp: w
751
+ })), this.clearWorkShapeNodeCache(n);
754
752
  break;
755
753
  }
756
754
  }
@@ -845,7 +843,7 @@ class me {
845
843
  return Math.min((t.animationIndex || 0) + (s || e), (t.animationWorkData || []).length);
846
844
  }
847
845
  async animationDraw() {
848
- var s, o, r, i, a, n, c, h, l, m, d, w, S, y, v, C, R, V, K;
846
+ var s, o, r, i, a, c, n, h, l, m, d, S, w, y, v, D, R, V, K;
849
847
  this.animationId = void 0;
850
848
  let t = !1;
851
849
  const e = /* @__PURE__ */ new Map();
@@ -855,9 +853,9 @@ class me {
855
853
  await ((s = k.node) == null ? void 0 : s.consumeServiceAsync({
856
854
  isFullWork: !0,
857
855
  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());
856
+ })), this.selectorWorkShapes.forEach((b, C) => {
857
+ var O;
858
+ (O = b.selectIds) != null && O.includes(L) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
861
859
  }), this.workShapes.delete(L);
862
860
  break;
863
861
  }
@@ -865,9 +863,9 @@ class me {
865
863
  k.node && (await ((o = k.node) == null ? void 0 : o.consumeServiceAsync({
866
864
  isFullWork: !0,
867
865
  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());
866
+ })), this.selectorWorkShapes.forEach((b, C) => {
867
+ var O;
868
+ (O = b.selectIds) != null && O.includes(L) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
871
869
  }), (r = k.node) == null || r.clearTmpPoints(), this.workShapes.delete(L));
872
870
  break;
873
871
  }
@@ -880,17 +878,17 @@ class me {
880
878
  case f.SpeechBalloon: {
881
879
  const b = !!k.ops;
882
880
  if ((i = k.animationWorkData) != null && i.length) {
883
- const O = k.oldRect;
881
+ const C = k.oldRect;
884
882
  (a = k.node) == null || a.consumeService({
885
883
  op: k.animationWorkData,
886
884
  isFullWork: b
887
- }), b && (this.selectorWorkShapes.forEach((E, D) => {
885
+ }), b && (this.selectorWorkShapes.forEach((O, E) => {
888
886
  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)
887
+ (x = O.selectIds) != null && x.includes(L) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
888
+ }), (c = k.node) == null || c.clearTmpPoints(), this.workShapes.delete(L)), e.set(L, {
889
+ workState: C ? k.ops ? W.Done : W.Doing : W.Start,
890
+ op: k.animationWorkData.filter((O, E) => {
891
+ if (E % 3 !== 2)
894
892
  return !0;
895
893
  }).slice(-2)
896
894
  }), k.animationWorkData.length = 0;
@@ -899,31 +897,31 @@ class me {
899
897
  }
900
898
  case f.Pencil: {
901
899
  if (!k.useAnimation && k.ops)
902
- (c = k.node) == null || c.consumeService({
900
+ (n = k.node) == null || n.consumeService({
903
901
  op: k.animationWorkData || [],
904
902
  isFullWork: !0,
905
903
  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());
904
+ }), (h = k.node) == null || h.updataOptService(k.updateNodeOpt), this.selectorWorkShapes.forEach((b, C) => {
905
+ var O;
906
+ (O = b.selectIds) != null && O.includes(L) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
909
907
  }), (l = k.node) == null || l.clearTmpPoints(), this.workShapes.delete(L);
910
908
  else if (k.useAnimation) {
911
909
  if (k.isDel) {
912
910
  (m = k.node) == null || m.clearTmpPoints(), this.workShapes.delete(L);
913
911
  break;
914
912
  }
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,
913
+ 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();
914
+ if ((k.animationIndex || 0) < C || k.isDiff) {
915
+ if ((w = k.node) == null || w.consumeService({
916
+ op: E,
919
917
  isFullWork: !1
920
- }), k.animationIndex = O, k.isDiff && (k.isDiff = !1), D.length) {
921
- const _ = D.filter((B, re) => {
918
+ }), k.animationIndex = C, k.isDiff && (k.isDiff = !1), E.length) {
919
+ const _ = E.filter((B, re) => {
922
920
  if (re % b !== b - 1)
923
921
  return !0;
924
922
  }).slice(-2);
925
923
  e.set(L, {
926
- workState: E === 0 ? T.Start : O === ((y = k.animationWorkData) == null ? void 0 : y.length) ? T.Done : T.Doing,
924
+ workState: O === 0 ? W.Start : C === ((y = k.animationWorkData) == null ? void 0 : y.length) ? W.Done : W.Doing,
927
925
  op: _
928
926
  });
929
927
  }
@@ -932,8 +930,8 @@ class me {
932
930
  isFullWork: !0,
933
931
  replaceId: x
934
932
  }), k.isDel = !0, e.set(L, {
935
- workState: T.Done,
936
- op: D.filter((_, B) => {
933
+ workState: W.Done,
934
+ op: E.filter((_, B) => {
937
935
  if (B % b !== b - 1)
938
936
  return !0;
939
937
  }).slice(-2)
@@ -946,29 +944,29 @@ class me {
946
944
  case f.BitMapEraser:
947
945
  case f.PencilEraser: {
948
946
  if (k.isDel) {
949
- (C = k.node) == null || C.clearTmpPoints(), this.workShapes.delete(L);
947
+ (D = k.node) == null || D.clearTmpPoints(), this.workShapes.delete(L);
950
948
  break;
951
949
  }
952
950
  if (k.ops && ((R = k.animationWorkData) != null && R.length)) {
953
951
  const b = k.animationWorkData.slice(-3, -1);
954
952
  e.set(L, {
955
- workState: T.Done,
953
+ workState: W.Done,
956
954
  op: b
957
955
  }), k.isDel = !0;
958
956
  break;
959
957
  }
960
958
  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,
959
+ const C = this.computNextAnimationIndex(k, 3), O = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - 3), E = (k.animationWorkData || []).slice(O, C);
960
+ if (((k.animationIndex || 0) < C || k.isDiff) && ((V = k.node) == null || V.consumeService({
961
+ op: E,
964
962
  isFullWork: k.toolsType !== f.BitMapEraser
965
- }), k.animationIndex = O, k.isDiff && (k.isDiff = !1), D.length)) {
966
- const x = D.filter((_, B) => {
963
+ }), k.animationIndex = C, k.isDiff && (k.isDiff = !1), E.length)) {
964
+ const x = E.filter((_, B) => {
967
965
  if (B % 3 !== 2)
968
966
  return !0;
969
967
  }).slice(-2);
970
968
  e.set(L, {
971
- workState: E === 0 ? T.Start : O === ((K = k.animationWorkData) == null ? void 0 : K.length) ? T.Done : T.Doing,
969
+ workState: O === 0 ? W.Start : C === ((K = k.animationWorkData) == null ? void 0 : K.length) ? W.Done : W.Doing,
972
970
  op: x
973
971
  });
974
972
  }
@@ -1015,31 +1013,31 @@ class me {
1015
1013
  return !1;
1016
1014
  }
1017
1015
  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;
1016
+ var S, w, y, v;
1017
+ const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: c, useAnimation: n, imageBitmap: h } = t;
1020
1018
  if (!e)
1021
1019
  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 = {
1020
+ const l = e.toString(), m = (S = this.vNodes.get(l)) == null ? void 0 : S.rect;
1021
+ if (!((w = this.workShapes) != null && w.has(l))) {
1022
+ let D = {
1025
1023
  toolsType: o,
1026
- animationWorkData: n || [],
1024
+ animationWorkData: c || [],
1027
1025
  animationIndex: 0,
1028
1026
  type: r,
1029
1027
  updateNodeOpt: i,
1030
1028
  ops: a,
1031
- useAnimation: typeof c < "u" ? c : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
1029
+ useAnimation: typeof n < "u" ? n : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
1032
1030
  oldRect: m,
1033
1031
  isDiff: !1,
1034
1032
  imageBitmap: h
1035
1033
  };
1036
- o && s && (C = this.setNodeKey(l, C, o, s)), (y = this.workShapes) == null || y.set(l, C);
1034
+ o && s && (D = this.setNodeKey(l, D, o, s)), (y = this.workShapes) == null || y.set(l, D);
1037
1035
  }
1038
1036
  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);
1037
+ 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
1038
  }
1041
1039
  removeNode(t, e) {
1042
- t.indexOf(W) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
1040
+ t.indexOf(T) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
1043
1041
  s.remove();
1044
1042
  }), this.thread.serviceLayer.getElementsByName(t).forEach((s) => {
1045
1043
  s.remove();
@@ -1050,12 +1048,12 @@ class me {
1050
1048
  s && (this.activeSelectorShape(t), this.willRunEffectSelectorIds.add(s)), this.runEffect();
1051
1049
  }
1052
1050
  activeSelectorShape(t) {
1053
- var c, h, l;
1051
+ var n, h, l;
1054
1052
  const { workId: e, opt: s, toolsType: o, type: r, selectIds: i } = t;
1055
1053
  if (!e)
1056
1054
  return;
1057
1055
  const a = e.toString();
1058
- if (!((c = this.selectorWorkShapes) != null && c.has(a))) {
1056
+ if (!((n = this.selectorWorkShapes) != null && n.has(a))) {
1059
1057
  let m = {
1060
1058
  toolsType: o,
1061
1059
  selectIds: i,
@@ -1064,8 +1062,8 @@ class me {
1064
1062
  };
1065
1063
  o && s && (m = this.setNodeKey(a, m, o, s)), (h = this.selectorWorkShapes) == null || h.set(a, m);
1066
1064
  }
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 || [];
1065
+ const c = (l = this.selectorWorkShapes) == null ? void 0 : l.get(a);
1066
+ r && (c.type = r), c.node && c.node.getWorkId() !== a && c.node.setWorkId(a), c.selectIds = i || [];
1069
1067
  }
1070
1068
  setNodeKey(t, e, s, o) {
1071
1069
  return e.toolsType = s, e.node = z({
@@ -1115,28 +1113,28 @@ class Se extends M {
1115
1113
  return this.consumeForLocalWorker(e), !0;
1116
1114
  }
1117
1115
  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({
1116
+ var n;
1117
+ const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c } = e;
1118
+ s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1121
1119
  updateSelectorOpt: o,
1122
1120
  willRefreshSelector: r,
1123
1121
  willSyncService: i,
1124
1122
  willSerializeData: a,
1125
- textUpdateForWoker: n,
1123
+ textUpdateForWoker: c,
1126
1124
  callback: this.updateSelectorCallback
1127
1125
  }));
1128
1126
  }
1129
1127
  updateSelectorCallback(e) {
1130
- const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a, textUpdateForWoker: n } = s, c = o.sp || [];
1128
+ const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a, textUpdateForWoker: c } = s, n = o.sp || [];
1131
1129
  if (i)
1132
1130
  for (const [h, l] of r.entries())
1133
- n && l.toolsType === f.Text ? c.push({
1131
+ c && l.toolsType === f.Text ? n.push({
1134
1132
  ...l,
1135
1133
  workId: h,
1136
1134
  type: p.TextUpdate,
1137
1135
  dataType: g.Local,
1138
1136
  willSyncService: !0
1139
- }) : c.push(
1137
+ }) : n.push(
1140
1138
  {
1141
1139
  ...l,
1142
1140
  workId: h,
@@ -1148,7 +1146,7 @@ class Se extends M {
1148
1146
  }
1149
1147
  );
1150
1148
  return {
1151
- sp: c
1149
+ sp: n
1152
1150
  };
1153
1151
  }
1154
1152
  }
@@ -1163,9 +1161,9 @@ class ye extends M {
1163
1161
  return this.consumeForLocalWorker(e), !0;
1164
1162
  }
1165
1163
  async consumeForLocalWorker(e) {
1166
- var n;
1164
+ var c;
1167
1165
  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({
1166
+ s === T && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1169
1167
  updateSelectorOpt: o,
1170
1168
  willRefreshSelector: r,
1171
1169
  willSyncService: i,
@@ -1174,13 +1172,13 @@ class ye extends M {
1174
1172
  }));
1175
1173
  }
1176
1174
  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(
1175
+ const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, c = o.sp || [];
1176
+ if (i && c)
1177
+ for (const [n, h] of r.entries())
1178
+ c.push(
1181
1179
  {
1182
1180
  ...h,
1183
- workId: c,
1181
+ workId: n,
1184
1182
  type: p.UpdateNode,
1185
1183
  updateNodeOpt: {
1186
1184
  useAnimation: !1
@@ -1189,7 +1187,7 @@ class ye extends M {
1189
1187
  }
1190
1188
  );
1191
1189
  return {
1192
- sp: n
1190
+ sp: c
1193
1191
  };
1194
1192
  }
1195
1193
  }
@@ -1205,52 +1203,52 @@ class we extends M {
1205
1203
  }
1206
1204
  async consumeForLocalWorker(e) {
1207
1205
  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({
1206
+ const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c, emitEventType: n } = e;
1207
+ 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
1208
  updateSelectorOpt: o,
1211
1209
  willRefreshSelector: r,
1212
1210
  willSyncService: i,
1213
1211
  willSerializeData: a,
1214
1212
  isSync: !0,
1215
- textUpdateForWoker: n,
1216
- emitEventType: c,
1213
+ textUpdateForWoker: c,
1214
+ emitEventType: n,
1217
1215
  callback: this.updateSelectorCallback
1218
- })) : o.workState === T.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
1216
+ })) : o.workState === W.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
1219
1217
  }
1220
1218
  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)
1219
+ 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 || [];
1220
+ if (m === W.Start)
1223
1221
  return {
1224
1222
  sp: [],
1225
1223
  render: []
1226
1224
  };
1227
- const w = a == null ? void 0 : a.selectRect;
1228
- if (n) {
1229
- m === T.Doing && d.push({
1225
+ const S = a == null ? void 0 : a.selectRect;
1226
+ if (c) {
1227
+ m === W.Doing && d.push({
1230
1228
  type: p.Select,
1231
1229
  selectIds: i.selectIds,
1232
- selectRect: w,
1230
+ selectRect: S,
1233
1231
  willSyncService: !0,
1234
1232
  isSync: !0,
1235
1233
  points: i.getChildrenPoints(),
1236
1234
  textOpt: i.textOpt
1237
1235
  });
1238
- for (const [S, y] of r.entries())
1236
+ for (const [w, y] of r.entries())
1239
1237
  l && y.toolsType === f.Text ? d.push({
1240
1238
  ...y,
1241
- workId: S,
1239
+ workId: w,
1242
1240
  type: p.TextUpdate,
1243
1241
  dataType: g.Local,
1244
1242
  willSyncService: !0
1245
1243
  }) : d.push(
1246
1244
  {
1247
1245
  ...y,
1248
- workId: S,
1246
+ workId: w,
1249
1247
  type: p.UpdateNode,
1250
1248
  updateNodeOpt: {
1251
1249
  useAnimation: !1
1252
1250
  },
1253
- isSync: c
1251
+ isSync: n
1254
1252
  }
1255
1253
  );
1256
1254
  }
@@ -1281,7 +1279,7 @@ class ge extends M {
1281
1279
  async consumeForLocalWorker(e) {
1282
1280
  var a;
1283
1281
  const { workId: s, updateNodeOpt: o, willSyncService: r, willSerializeData: i } = e;
1284
- s === W && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
1282
+ s === T && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
1285
1283
  updateSelectorOpt: o,
1286
1284
  willSyncService: r,
1287
1285
  willSerializeData: i,
@@ -1290,32 +1288,32 @@ class ge extends M {
1290
1288
  }));
1291
1289
  }
1292
1290
  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)
1291
+ 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;
1292
+ if (h === W.Start)
1295
1293
  return {
1296
1294
  sp: [],
1297
1295
  render: []
1298
1296
  };
1299
- if (c) {
1297
+ if (n) {
1300
1298
  l.push({
1301
1299
  type: p.Select,
1302
1300
  selectIds: r.selectIds,
1303
1301
  selectRect: m,
1304
1302
  willSyncService: !0,
1305
1303
  isSync: !0,
1306
- points: h === T.Done && r.getChildrenPoints() || void 0,
1304
+ points: h === W.Done && r.getChildrenPoints() || void 0,
1307
1305
  textOpt: r.textOpt
1308
1306
  });
1309
- for (const [d, w] of a.entries())
1310
- w.toolsType === f.Text ? l.push({
1311
- ...w,
1307
+ for (const [d, S] of a.entries())
1308
+ S.toolsType === f.Text ? l.push({
1309
+ ...S,
1312
1310
  workId: d,
1313
1311
  type: p.TextUpdate,
1314
1312
  dataType: g.Local,
1315
1313
  willSyncService: !0
1316
1314
  }) : l.push(
1317
1315
  {
1318
- ...w,
1316
+ ...S,
1319
1317
  workId: d,
1320
1318
  type: p.UpdateNode,
1321
1319
  updateNodeOpt: {
@@ -1341,34 +1339,34 @@ class Ie extends M {
1341
1339
  return await this.consumeForLocalWorker(e), !0;
1342
1340
  }
1343
1341
  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({
1342
+ var n;
1343
+ const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, emitEventType: c } = e;
1344
+ s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1347
1345
  updateSelectorOpt: o,
1348
1346
  willRefreshSelector: r,
1349
1347
  willSyncService: i,
1350
1348
  willSerializeData: a,
1351
- emitEventType: n,
1349
+ emitEventType: c,
1352
1350
  isSync: !0,
1353
1351
  callback: this.updateSelectorCallback
1354
1352
  }));
1355
1353
  }
1356
1354
  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({
1355
+ 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;
1356
+ if (n) {
1357
+ h && m === W.Done && d.push({
1360
1358
  type: p.Select,
1361
1359
  selectIds: r.selectIds,
1362
- selectRect: w,
1360
+ selectRect: S,
1363
1361
  willSyncService: !0,
1364
1362
  isSync: l,
1365
1363
  points: r.getChildrenPoints()
1366
1364
  });
1367
- for (const [S, y] of a.entries())
1365
+ for (const [w, y] of a.entries())
1368
1366
  d.push(
1369
1367
  {
1370
1368
  ...y,
1371
- workId: S,
1369
+ workId: w,
1372
1370
  type: p.UpdateNode,
1373
1371
  updateNodeOpt: {
1374
1372
  useAnimation: !1
@@ -1382,7 +1380,7 @@ class Ie extends M {
1382
1380
  };
1383
1381
  }
1384
1382
  }
1385
- class Te extends M {
1383
+ class We extends M {
1386
1384
  constructor() {
1387
1385
  super(...arguments);
1388
1386
  u(this, "emitEventType", I.SetFontStyle);
@@ -1393,44 +1391,44 @@ class Te extends M {
1393
1391
  return await this.consumeForLocalWorker(e), !0;
1394
1392
  }
1395
1393
  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({
1394
+ var n;
1395
+ const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c } = e;
1396
+ s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1399
1397
  updateSelectorOpt: o,
1400
1398
  willRefreshSelector: r,
1401
1399
  willSyncService: i,
1402
1400
  willSerializeData: a,
1403
- textUpdateForWoker: n,
1401
+ textUpdateForWoker: c,
1404
1402
  callback: this.updateSelectorCallback
1405
1403
  }));
1406
1404
  }
1407
1405
  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) {
1406
+ 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;
1407
+ if (c && m) {
1410
1408
  h.fontSize && m.push({
1411
1409
  type: p.Select,
1412
1410
  selectIds: i.selectIds,
1413
1411
  selectRect: d,
1414
- willSyncService: n,
1415
- isSync: c,
1412
+ willSyncService: c,
1413
+ isSync: n,
1416
1414
  points: i.getChildrenPoints()
1417
1415
  });
1418
- for (const [w, S] of r.entries())
1419
- l && S.toolsType === f.Text ? m.push({
1420
- ...S,
1421
- workId: w,
1416
+ for (const [S, w] of r.entries())
1417
+ l && w.toolsType === f.Text ? m.push({
1418
+ ...w,
1419
+ workId: S,
1422
1420
  type: p.TextUpdate,
1423
1421
  dataType: g.Local,
1424
1422
  willSyncService: !0
1425
1423
  }) : m.push(
1426
1424
  {
1427
- ...S,
1428
- workId: w,
1425
+ ...w,
1426
+ workId: S,
1429
1427
  type: p.UpdateNode,
1430
1428
  updateNodeOpt: {
1431
1429
  useAnimation: !1
1432
1430
  },
1433
- isSync: c
1431
+ isSync: n
1434
1432
  }
1435
1433
  );
1436
1434
  }
@@ -1439,7 +1437,7 @@ class Te extends M {
1439
1437
  };
1440
1438
  }
1441
1439
  }
1442
- class We extends M {
1440
+ class Te extends M {
1443
1441
  constructor() {
1444
1442
  super(...arguments);
1445
1443
  u(this, "emitEventType", I.SetPoint);
@@ -1450,22 +1448,22 @@ class We extends M {
1450
1448
  return this.consumeForLocalWorker(e), !0;
1451
1449
  }
1452
1450
  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({
1451
+ var n;
1452
+ const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: a, textUpdateForWoker: c } = e;
1453
+ s === T && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1456
1454
  updateSelectorOpt: o,
1457
1455
  willRefreshSelector: r,
1458
1456
  willSyncService: i,
1459
1457
  emitEventType: this.emitEventType,
1460
1458
  willSerializeData: a,
1461
1459
  isSync: !0,
1462
- textUpdateForWoker: n,
1460
+ textUpdateForWoker: c,
1463
1461
  callback: this.updateSelectorCallback
1464
1462
  }));
1465
1463
  }
1466
1464
  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) {
1465
+ 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;
1466
+ if (c && h) {
1469
1467
  for (const [m, d] of r.entries())
1470
1468
  h.push(
1471
1469
  {
@@ -1475,15 +1473,15 @@ class We extends M {
1475
1473
  updateNodeOpt: {
1476
1474
  useAnimation: !1
1477
1475
  },
1478
- isSync: c
1476
+ isSync: n
1479
1477
  }
1480
1478
  );
1481
1479
  h.push({
1482
1480
  type: p.Select,
1483
1481
  selectIds: i.selectIds,
1484
1482
  selectRect: l,
1485
- willSyncService: n,
1486
- isSync: c,
1483
+ willSyncService: c,
1484
+ isSync: n,
1487
1485
  points: i.getChildrenPoints()
1488
1486
  });
1489
1487
  }
@@ -1503,9 +1501,9 @@ class Ne extends M {
1503
1501
  return this.consumeForLocalWorker(e), !0;
1504
1502
  }
1505
1503
  async consumeForLocalWorker(e) {
1506
- var n;
1504
+ var c;
1507
1505
  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({
1506
+ s === T && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1509
1507
  updateSelectorOpt: o,
1510
1508
  willRefreshSelector: r,
1511
1509
  willSyncService: i,
@@ -1514,18 +1512,18 @@ class Ne extends M {
1514
1512
  }));
1515
1513
  }
1516
1514
  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())
1515
+ 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;
1516
+ if (c && l) {
1517
+ for (const [d, S] of r.entries())
1520
1518
  l.push(
1521
1519
  {
1522
- ...w,
1520
+ ...S,
1523
1521
  workId: d,
1524
1522
  type: p.UpdateNode,
1525
1523
  updateNodeOpt: {
1526
1524
  useAnimation: !1
1527
1525
  },
1528
- isSync: c
1526
+ isSync: n
1529
1527
  }
1530
1528
  );
1531
1529
  l.push({
@@ -1536,8 +1534,8 @@ class Ne extends M {
1536
1534
  type: p.Select,
1537
1535
  selectIds: i.selectIds,
1538
1536
  selectRect: m,
1539
- willSyncService: n,
1540
- isSync: c
1537
+ willSyncService: c,
1538
+ isSync: n
1541
1539
  });
1542
1540
  }
1543
1541
  return {
@@ -1556,9 +1554,9 @@ class Le extends M {
1556
1554
  return this.consumeForLocalWorker(e), !0;
1557
1555
  }
1558
1556
  async consumeForLocalWorker(e) {
1559
- var n;
1557
+ var c;
1560
1558
  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({
1559
+ s === T && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1562
1560
  updateSelectorOpt: o,
1563
1561
  willRefreshSelector: r,
1564
1562
  willSyncService: i,
@@ -1567,13 +1565,13 @@ class Le extends M {
1567
1565
  }));
1568
1566
  }
1569
1567
  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(
1568
+ const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, c = o.sp || [];
1569
+ if (i && c)
1570
+ for (const [n, h] of r.entries())
1571
+ c.push(
1574
1572
  {
1575
1573
  ...h,
1576
- workId: c,
1574
+ workId: n,
1577
1575
  type: p.UpdateNode,
1578
1576
  updateNodeOpt: {
1579
1577
  useAnimation: !1
@@ -1582,7 +1580,7 @@ class Le extends M {
1582
1580
  }
1583
1581
  );
1584
1582
  return {
1585
- sp: n
1583
+ sp: c
1586
1584
  };
1587
1585
  }
1588
1586
  }
@@ -1608,9 +1606,9 @@ class be {
1608
1606
  case I.RotateNode:
1609
1607
  return new Ie();
1610
1608
  case I.SetFontStyle:
1611
- return new Te();
1612
- case I.SetPoint:
1613
1609
  return new We();
1610
+ case I.SetPoint:
1611
+ return new Te();
1614
1612
  case I.SetLock:
1615
1613
  return new Ne();
1616
1614
  case I.SetShapeOpt:
@@ -1629,7 +1627,7 @@ class be {
1629
1627
  return !1;
1630
1628
  }
1631
1629
  }
1632
- class Ce {
1630
+ class De {
1633
1631
  constructor(t, e) {
1634
1632
  u(this, "viewId");
1635
1633
  u(this, "fullLayer");
@@ -1703,7 +1701,7 @@ class Ce {
1703
1701
  }
1704
1702
  async on(t) {
1705
1703
  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();
1704
+ 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
1705
  switch (e) {
1708
1706
  case p.UpdateDpr:
1709
1707
  U(t.dpr) && this.updateDpr(t.dpr);
@@ -1747,7 +1745,7 @@ class Ce {
1747
1745
  }
1748
1746
  break;
1749
1747
  case p.DrawWork:
1750
- a === T.Done && r === g.Local ? this.consumeDrawAll(r, t) : this.consumeDraw(r, t);
1748
+ a === W.Done && r === g.Local ? this.consumeDrawAll(r, t) : this.consumeDraw(r, t);
1751
1749
  break;
1752
1750
  case p.UpdateNode:
1753
1751
  case p.FullWork:
@@ -1761,7 +1759,7 @@ class Ce {
1761
1759
  await this.removeNode(t);
1762
1760
  return;
1763
1761
  case p.Select:
1764
- r === g.Service && (i === W ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
1762
+ r === g.Service && (i === T ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
1765
1763
  break;
1766
1764
  case p.CursorHover:
1767
1765
  this.localWork.cursorHover(t);
@@ -1770,16 +1768,16 @@ class Ce {
1770
1768
  r === g.Local && this.localWork.checkTextActive(t);
1771
1769
  break;
1772
1770
  case p.GetImageBitMap:
1773
- if (n && c && i) {
1771
+ if (c && n && i) {
1774
1772
  const m = i.toString();
1775
- this.deleteCachedImagesByWorkId(m), this.cacheImages.set(n, {
1776
- imageBitmap: c,
1773
+ this.deleteCachedImagesByWorkId(m), this.cacheImages.set(c, {
1774
+ imageBitmap: n,
1777
1775
  workId: m
1778
1776
  });
1779
- const d = this.imageResolveMap.get(n);
1777
+ const d = this.imageResolveMap.get(c);
1780
1778
  if (d) {
1781
- const { resolve: w, timer: S } = d;
1782
- S && clearTimeout(S), w && w(n);
1779
+ const { resolve: S, timer: w } = d;
1780
+ w && clearTimeout(w), S && S(c);
1783
1781
  }
1784
1782
  }
1785
1783
  break;
@@ -1808,30 +1806,30 @@ class Ce {
1808
1806
  async loadImageBitMap(t) {
1809
1807
  const { toolsType: e, opt: s, workId: o } = t;
1810
1808
  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)
1809
+ const r = o.toString(), { src: i, type: a, width: c, height: n, strokeColor: h } = s;
1810
+ if (!i || !a || !c || !n)
1813
1811
  return;
1814
1812
  let l = i;
1815
1813
  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}`;
1814
+ const [w, y] = this.getIconSize(c, n, this.opt.displayer.dpr);
1815
+ l = `${i}?width=${w}&height=${y}&color=${h}`;
1818
1816
  }
1819
1817
  if (this.cacheImages.has(l)) {
1820
- const S = this.getCachedImages(l);
1821
- if (S)
1822
- return S;
1818
+ const w = this.getCachedImages(l);
1819
+ if (w)
1820
+ return w;
1823
1821
  }
1824
1822
  if (this.imageResolveMap.has(l)) {
1825
- const S = this.getCachedImagesByWorkId(r);
1826
- if (S)
1827
- return S;
1823
+ const w = this.getCachedImagesByWorkId(r);
1824
+ if (w)
1825
+ return w;
1828
1826
  }
1829
- const w = await new Promise((S) => {
1827
+ const S = await new Promise((w) => {
1830
1828
  const y = this.imageResolveMap.get(l) || {
1831
1829
  resolve: void 0,
1832
1830
  timer: void 0
1833
1831
  };
1834
- y.timer && clearTimeout(y.timer), y.resolve = S, y.timer = setTimeout(() => {
1832
+ y.timer && clearTimeout(y.timer), y.resolve = w, y.timer = setTimeout(() => {
1835
1833
  const v = this.imageResolveMap.get(l);
1836
1834
  v != null && v.resolve && v.resolve(l);
1837
1835
  }, 5e3), this.imageResolveMap.set(l, y), this.opt.post({
@@ -1845,14 +1843,14 @@ class Ce {
1845
1843
  }]
1846
1844
  });
1847
1845
  });
1848
- return this.imageResolveMap.delete(w), this.getCachedImages(l);
1846
+ return this.imageResolveMap.delete(S), this.getCachedImages(l);
1849
1847
  }
1850
1848
  }
1851
1849
  async removeNode(t) {
1852
1850
  const { dataType: e, workId: s, removeIds: o } = t, r = o || [];
1853
1851
  if (s && r.push(s.toString()), r.length)
1854
1852
  for (const i of r) {
1855
- if (i === W) {
1853
+ if (i === T) {
1856
1854
  await this.localWork.removeSelector(t);
1857
1855
  continue;
1858
1856
  }
@@ -1880,25 +1878,25 @@ class Ce {
1880
1878
  if ((o = r.sp) != null && o.length)
1881
1879
  for (const i of r.sp) {
1882
1880
  let a = !1;
1883
- for (const n of t)
1884
- if (Q(i, n)) {
1881
+ for (const c of t)
1882
+ if (Q(i, c)) {
1885
1883
  a = !0;
1886
1884
  break;
1887
1885
  }
1888
1886
  a || t.push(i);
1889
1887
  }
1890
- U(r.drawCount) && (e = r.drawCount), U(r.consumeCount) && (s = r.consumeCount);
1888
+ U(r.fullWorkerDrawCount) && (e = r.fullWorkerDrawCount), U(r.consumeCount) && (s = r.consumeCount);
1891
1889
  }
1892
1890
  return this.combinePostMsg.clear(), {
1893
1891
  sp: t,
1894
- drawCount: e,
1892
+ fullWorkerDrawCount: e,
1895
1893
  consumeCount: s
1896
1894
  };
1897
1895
  }
1898
1896
  combinePost() {
1899
1897
  var s, o;
1900
1898
  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);
1899
+ 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
1900
  }
1903
1901
  clearAll() {
1904
1902
  this.fullLayer.children.length && (this.fullLayer.parent.children.forEach((t) => {
@@ -1937,7 +1935,7 @@ class Ce {
1937
1935
  const { cameraOpt: e, scenePath: s } = t;
1938
1936
  if (e && !Q(this.cameraOpt, e)) {
1939
1937
  if (this.taskUpdateCameraId && (clearTimeout(this.taskUpdateCameraId), this.taskUpdateCameraId = void 0), s) {
1940
- let c = !1;
1938
+ let n = !1;
1941
1939
  for (const [h, l] of this.localWork.getWorkShapes().entries())
1942
1940
  switch (l.toolsType) {
1943
1941
  case f.Text:
@@ -1948,10 +1946,10 @@ class Ce {
1948
1946
  case f.LaserPen:
1949
1947
  break;
1950
1948
  default:
1951
- h !== G && h !== W && (c = !0);
1949
+ h !== G && h !== T && (n = !0);
1952
1950
  break;
1953
1951
  }
1954
- if (c) {
1952
+ if (n) {
1955
1953
  this.taskUpdateCameraId = setTimeout(() => {
1956
1954
  this.taskUpdateCameraId = void 0, this.updateCamera(t);
1957
1955
  }, j);
@@ -1959,47 +1957,47 @@ class Ce {
1959
1957
  }
1960
1958
  }
1961
1959
  const r = /* @__PURE__ */ new Map();
1962
- for (const [c, h] of this.vNodes.getNodesByType(f.Text).entries()) {
1960
+ for (const [n, h] of this.vNodes.getNodesByType(f.Text).entries()) {
1963
1961
  const l = h.rect;
1964
- r.set(c, oe(l));
1962
+ r.set(n, oe(l));
1965
1963
  }
1966
1964
  const i = new Set(r.keys());
1967
1965
  let a = !1;
1968
1966
  if (this.localWork.hasSelector()) {
1969
- const c = (o = this.localWork.getSelector()) == null ? void 0 : o.selectIds;
1970
- if (c) {
1967
+ const n = (o = this.localWork.getSelector()) == null ? void 0 : o.selectIds;
1968
+ if (n) {
1971
1969
  a = !0;
1972
- for (const h of c)
1970
+ for (const h of n)
1973
1971
  i.add(h);
1974
1972
  }
1975
1973
  }
1976
- let n = !1;
1974
+ let c = !1;
1977
1975
  if (this.serviceWork.selectorWorkShapes.size)
1978
- for (const c of this.serviceWork.selectorWorkShapes.values()) {
1979
- const h = c.selectIds;
1976
+ for (const n of this.serviceWork.selectorWorkShapes.values()) {
1977
+ const h = n.selectIds;
1980
1978
  if (h) {
1981
- n = !0;
1979
+ c = !0;
1982
1980
  for (const l of h)
1983
1981
  i.add(l);
1984
1982
  }
1985
1983
  }
1986
1984
  if (this.setCameraOpt(e), this.vNodes.curNodeMap.size) {
1987
1985
  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);
1986
+ for (const [n, h] of r.entries()) {
1987
+ const l = this.vNodes.get(n);
1990
1988
  if (l) {
1991
- const m = h, d = l.rect, w = this.getSceneRect(), S = $(m, w), y = $(d, w);
1989
+ const m = h, d = l.rect, S = this.getSceneRect(), w = $(m, S), y = $(d, S);
1992
1990
  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);
1991
+ if ((w !== y || m.w !== d.w || m.h !== d.h || y === X.intersect) && (v = !0), v) {
1992
+ const { toolsType: D, opt: R } = l;
1993
+ D === f.Text && R.workState === W.Done && this.debounceUpdateCache.add(n);
1996
1994
  }
1997
1995
  }
1998
1996
  }
1999
- if (a && this.localWork.reRenderSelector(), n)
2000
- for (const [c, h] of this.serviceWork.selectorWorkShapes.entries())
1997
+ if (a && this.localWork.reRenderSelector(), c)
1998
+ for (const [n, h] of this.serviceWork.selectorWorkShapes.entries())
2001
1999
  this.serviceWork.runSelectWork({
2002
- workId: c,
2000
+ workId: n,
2003
2001
  selectIds: h.selectIds,
2004
2002
  msgType: p.Select,
2005
2003
  dataType: g.Service,
@@ -2008,19 +2006,19 @@ class Ce {
2008
2006
  this.debounceUpdateCameraId = setTimeout(() => {
2009
2007
  var h;
2010
2008
  this.debounceUpdateCameraId = void 0;
2011
- const c = [];
2009
+ const n = [];
2012
2010
  for (const l of this.debounceUpdateCache.values()) {
2013
2011
  if ((h = this.fullLayer) == null ? void 0 : h.getElementsByName(l)[0]) {
2014
2012
  const d = this.vNodes.get(l);
2015
2013
  if (d) {
2016
- const { toolsType: w, opt: S, rect: y } = d, v = this.localWork.setFullWork({
2017
- toolsType: w,
2018
- opt: S,
2014
+ const { toolsType: S, opt: w, rect: y } = d, v = this.localWork.setFullWork({
2015
+ toolsType: S,
2016
+ opt: w,
2019
2017
  workId: l
2020
2018
  });
2021
2019
  if (v) {
2022
- const C = this.getSceneRect(), R = $(y, C);
2023
- c.push(v.consumeServiceAsync({
2020
+ const D = this.getSceneRect(), R = $(y, D);
2021
+ n.push(v.consumeServiceAsync({
2024
2022
  isFullWork: !0,
2025
2023
  replaceId: l,
2026
2024
  isDrawLabel: R !== X.outside
@@ -2056,14 +2054,14 @@ class Ce {
2056
2054
  });
2057
2055
  }
2058
2056
  createLayer(t, e, s) {
2059
- const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), n = new se({
2057
+ const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), c = new se({
2060
2058
  anchor: [0.5, 0.5],
2061
2059
  pos: [o * 0.5, r * 0.5],
2062
2060
  size: [o, r],
2063
2061
  name: "viewport",
2064
2062
  id: t
2065
2063
  });
2066
- return a.append(n), n;
2064
+ return a.append(c), c;
2067
2065
  }
2068
2066
  updateScene(t) {
2069
2067
  this.scene.attr({ ...t });
@@ -2078,7 +2076,7 @@ class Ce {
2078
2076
  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
2077
  }
2080
2078
  }
2081
- class Oe {
2079
+ class Ce {
2082
2080
  constructor(t, e) {
2083
2081
  u(this, "viewId");
2084
2082
  u(this, "fullLayer");
@@ -2134,8 +2132,8 @@ class Oe {
2134
2132
  });
2135
2133
  const a = this.imageResolveMap.get(s);
2136
2134
  if (a) {
2137
- const { resolve: n, timer: c } = a;
2138
- c && clearTimeout(c), n && n(s);
2135
+ const { resolve: c, timer: n } = a;
2136
+ n && clearTimeout(n), c && c(s);
2139
2137
  }
2140
2138
  }
2141
2139
  break;
@@ -2148,30 +2146,30 @@ class Oe {
2148
2146
  async loadImageBitMap(t) {
2149
2147
  const { toolsType: e, opt: s, workId: o } = t;
2150
2148
  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)
2149
+ const r = o.toString(), { src: i, type: a, width: c, height: n, strokeColor: h } = s;
2150
+ if (!i || !a || !c || !n)
2153
2151
  return;
2154
2152
  let l = i;
2155
2153
  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}`;
2154
+ const [w, y] = this.getIconSize(c, n, this.opt.displayer.dpr);
2155
+ l = `${i}?width=${w}&height=${y}&color=${h}`;
2158
2156
  }
2159
2157
  if (this.cacheImages.has(l)) {
2160
- const S = this.getCachedImages(l);
2161
- if (S)
2162
- return S;
2158
+ const w = this.getCachedImages(l);
2159
+ if (w)
2160
+ return w;
2163
2161
  }
2164
2162
  if (this.imageResolveMap.has(l)) {
2165
- const S = this.getCachedImagesByWorkId(r);
2166
- if (S)
2167
- return S;
2163
+ const w = this.getCachedImagesByWorkId(r);
2164
+ if (w)
2165
+ return w;
2168
2166
  }
2169
- const w = await new Promise((S) => {
2167
+ const S = await new Promise((w) => {
2170
2168
  const y = this.imageResolveMap.get(l) || {
2171
2169
  resolve: void 0,
2172
2170
  timer: void 0
2173
2171
  };
2174
- y.timer && clearTimeout(y.timer), y.resolve = S, y.timer = setTimeout(() => {
2172
+ y.timer && clearTimeout(y.timer), y.resolve = w, y.timer = setTimeout(() => {
2175
2173
  const v = this.imageResolveMap.get(l);
2176
2174
  v != null && v.resolve && v.resolve(l);
2177
2175
  }, 5e3), this.imageResolveMap.set(l, y), this.opt.post({
@@ -2185,7 +2183,7 @@ class Oe {
2185
2183
  }]
2186
2184
  });
2187
2185
  });
2188
- return this.imageResolveMap.delete(w), this.getCachedImages(l);
2186
+ return this.imageResolveMap.delete(S), this.getCachedImages(l);
2189
2187
  }
2190
2188
  }
2191
2189
  createWorkShapeNode(t) {
@@ -2228,7 +2226,7 @@ class Oe {
2228
2226
  if (e && s && o) {
2229
2227
  this.setCameraOpt(o);
2230
2228
  let a;
2231
- for (const [c, h] of Object.entries(s))
2229
+ for (const [n, h] of Object.entries(s))
2232
2230
  if (h != null && h.type)
2233
2231
  switch (h == null ? void 0 : h.type) {
2234
2232
  case p.UpdateNode:
@@ -2236,7 +2234,7 @@ class Oe {
2236
2234
  const { opt: l } = h, m = {
2237
2235
  ...h,
2238
2236
  opt: l,
2239
- workId: c,
2237
+ workId: n,
2240
2238
  msgType: p.FullWork,
2241
2239
  dataType: g.Service,
2242
2240
  viewId: this.viewId
@@ -2245,11 +2243,11 @@ class Oe {
2245
2243
  break;
2246
2244
  }
2247
2245
  }
2248
- let n;
2249
- r && i && (n = {
2246
+ let c;
2247
+ r && i && (c = {
2250
2248
  resizeWidth: r,
2251
2249
  resizeHeight: i
2252
- }), await this.getSnapshotRender({ scenePath: e, options: n });
2250
+ }), await this.getSnapshotRender({ scenePath: e, options: c });
2253
2251
  }
2254
2252
  }
2255
2253
  getSceneRect() {
@@ -2289,14 +2287,14 @@ class Oe {
2289
2287
  switch (a == null ? void 0 : a.type) {
2290
2288
  case p.UpdateNode:
2291
2289
  case p.FullWork: {
2292
- const n = await this.runFullWork({
2290
+ const c = await this.runFullWork({
2293
2291
  ...a,
2294
2292
  workId: i,
2295
2293
  msgType: p.FullWork,
2296
2294
  dataType: g.Service,
2297
2295
  viewId: this.viewId
2298
2296
  });
2299
- r = H(r, n);
2297
+ r = H(r, c);
2300
2298
  break;
2301
2299
  }
2302
2300
  }
@@ -2338,7 +2336,7 @@ class Oe {
2338
2336
  combinePost() {
2339
2337
  var s, o;
2340
2338
  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);
2339
+ 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
2340
  }
2343
2341
  createScene(t) {
2344
2342
  return new te({
@@ -2351,14 +2349,14 @@ class Oe {
2351
2349
  });
2352
2350
  }
2353
2351
  createLayer(t, e, s) {
2354
- const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), n = new se({
2352
+ const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), c = new se({
2355
2353
  anchor: [0.5, 0.5],
2356
2354
  pos: [o * 0.5, r * 0.5],
2357
2355
  size: [o, r],
2358
2356
  name: "viewport",
2359
2357
  id: t
2360
2358
  });
2361
- return a.append(n), n;
2359
+ return a.append(c), c;
2362
2360
  }
2363
2361
  updateScene(t) {
2364
2362
  this.scene.attr({ ...t });
@@ -2381,30 +2379,30 @@ class Ue {
2381
2379
  this.master = t;
2382
2380
  }
2383
2381
  post(t) {
2384
- const { drawCount: e, sp: s, workerTasksqueueCount: o, consumeCount: r } = t;
2382
+ const { fullWorkerDrawCount: e, sp: s, workerTasksqueueCount: o, consumeCount: r } = t;
2385
2383
  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
2384
  }
2387
2385
  destroy() {
2388
2386
  this.mainThreadMap.clear();
2389
2387
  }
2390
2388
  createMainThread(t, e) {
2391
- return new Ce(t, e);
2389
+ return new De(t, e);
2392
2390
  }
2393
2391
  createSnapshotThread(t, e) {
2394
- return new Oe(t, e);
2392
+ return new Ce(t, e);
2395
2393
  }
2396
2394
  async consume(t) {
2397
2395
  var e, s, o, r;
2398
2396
  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;
2397
+ const { msgType: a, viewId: c, tasksqueue: n, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt: m, cameraOpt: d, isSubWorker: S } = i;
2400
2398
  if (a === p.Console) {
2401
2399
  console.log(this);
2402
2400
  continue;
2403
2401
  }
2404
2402
  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;
2403
+ const y = (e = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : e.displayer, v = y == null ? void 0 : y.canvasContainerRef.current;
2406
2404
  if (y && v && l && m) {
2407
- const C = this.createMainThread(n, {
2405
+ const D = this.createMainThread(c, {
2408
2406
  displayer: y,
2409
2407
  container: v,
2410
2408
  layerOpt: l,
@@ -2412,15 +2410,15 @@ class Ue {
2412
2410
  canvasOpt: m,
2413
2411
  post: this.post.bind(this)
2414
2412
  });
2415
- this.mainThreadMap.set(n, C), C && d && C.setCameraOpt(d);
2413
+ this.mainThreadMap.set(c, D), D && d && D.setCameraOpt(d);
2416
2414
  }
2417
2415
  continue;
2418
2416
  }
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;
2417
+ if ((a === p.Snapshot || a === p.BoundingBox) && c === ((s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.id)) {
2418
+ const y = (o = this.master.control.viewContainerManager.getView(c)) == null ? void 0 : o.displayer, v = (r = y.snapshotContainerRef) == null ? void 0 : r.current;
2421
2419
  if (y && v && d) {
2422
2420
  v.style.width = `${d.width}px`, v.style.height = `${d.height}px`;
2423
- const C = {
2421
+ const D = {
2424
2422
  ...Y.defaultLayerOpt,
2425
2423
  offscreen: !1,
2426
2424
  width: d.width,
@@ -2430,10 +2428,10 @@ class Ue {
2430
2428
  width: d.width,
2431
2429
  height: d.height
2432
2430
  };
2433
- this.snapshotThread = this.createSnapshotThread(n, {
2431
+ this.snapshotThread = this.createSnapshotThread(c, {
2434
2432
  displayer: y,
2435
2433
  container: v,
2436
- layerOpt: C,
2434
+ layerOpt: D,
2437
2435
  master: this.master,
2438
2436
  canvasOpt: R,
2439
2437
  post: this.post.bind(this)
@@ -2443,24 +2441,24 @@ class Ue {
2443
2441
  continue;
2444
2442
  }
2445
2443
  }
2446
- if (a === p.GetImageBitMap && w && this.snapshotThread) {
2444
+ if (a === p.GetImageBitMap && S && this.snapshotThread) {
2447
2445
  this.snapshotThread.on(i);
2448
2446
  continue;
2449
2447
  }
2450
- if (a === p.TasksQueue && (c != null && c.size)) {
2448
+ if (a === p.TasksQueue && (n != null && n.size)) {
2451
2449
  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 }));
2450
+ const D = n.get(y);
2451
+ D && (await v.on(D), h && this.post({ workerTasksqueueCount: h }));
2454
2452
  }
2455
2453
  continue;
2456
2454
  }
2457
- if (n === pe) {
2455
+ if (c === pe) {
2458
2456
  for (const y of this.mainThreadMap.values())
2459
- y.on(i), a === p.Destroy && this.mainThreadMap.delete(n);
2457
+ y.on(i), a === p.Destroy && this.mainThreadMap.delete(c);
2460
2458
  continue;
2461
2459
  }
2462
- const S = this.mainThreadMap.get(n);
2463
- S && (S.on(i), a === p.Destroy && this.mainThreadMap.delete(n));
2460
+ const w = this.mainThreadMap.get(c);
2461
+ w && (w.on(i), a === p.Destroy && this.mainThreadMap.delete(c));
2464
2462
  }
2465
2463
  }
2466
2464
  }