@netless/appliance-plugin 1.1.12 → 1.1.13

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,15 +1,15 @@
1
- var te = Object.defineProperty;
2
- var se = (L, t, e) => t in L ? te(L, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : L[t] = e;
3
- var u = (L, t, e) => se(L, typeof t != "symbol" ? t + "" : t, e);
4
- import { D as R, E as W, a as f, b as g, g as F, t as A, c as h, S as j, d as N, e as $, i as oe, C as U, f as re, h as T, M, V as ie, j as X, T as H, k as P, l as q, m as B, n as ae, o as G, p as V, q as ce } from "./index-DKv5OrcQ.mjs";
5
- import { Scene as Y, Group as Q } from "spritejs";
6
- import { cloneDeep as J, xor as ne, isNumber as K, isEqual as Z } from "lodash";
1
+ var ie = Object.defineProperty;
2
+ var ae = (N, t, e) => t in N ? ie(N, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : N[t] = e;
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";
5
+ import { Scene as te, Group as se } from "spritejs";
6
+ import { cloneDeep as oe, xor as de, isNumber as U, isEqual as Q } from "lodash";
7
7
  import "lineclip";
8
8
  import "white-web-sdk";
9
9
  import "react-dom";
10
10
  import "react";
11
11
  import "eventemitter2";
12
- class le {
12
+ class ue {
13
13
  constructor(t) {
14
14
  u(this, "vNodes");
15
15
  u(this, "thread");
@@ -17,7 +17,7 @@ class le {
17
17
  u(this, "localWorkShapes", /* @__PURE__ */ new Map());
18
18
  u(this, "tmpOpt");
19
19
  u(this, "animationId");
20
- u(this, "syncUnitTime", R.syncOpt.interval);
20
+ u(this, "syncUnitTime", F.syncOpt.interval);
21
21
  this.vNodes = t.vNodes, this.thread = t.thread;
22
22
  }
23
23
  createLocalWork(t) {
@@ -42,7 +42,7 @@ class le {
42
42
  return o && this.localWorkShapes.set(t, {
43
43
  node: o,
44
44
  toolsType: o.toolsType,
45
- workState: W.Start
45
+ workState: T.Start
46
46
  }), o;
47
47
  }
48
48
  }
@@ -66,7 +66,7 @@ class le {
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 = W.Doing, o && this.localWorkShapes.set(o, r));
69
+ i.rect && (r.result = i, r.workState = T.Doing, o && this.localWorkShapes.set(o, r));
70
70
  }
71
71
  this.runAnimation();
72
72
  }
@@ -80,31 +80,31 @@ class le {
80
80
  createWorkShapeNode(t) {
81
81
  const { toolsType: e } = t;
82
82
  if (e === f.LaserPen)
83
- return F({ ...t, vNodes: this.vNodes, fullLayer: this.thread.topLayer, drawLayer: this.thread.topLayer });
83
+ return z({ ...t, vNodes: this.vNodes, fullLayer: this.thread.topLayer, drawLayer: this.thread.topLayer });
84
84
  }
85
85
  setNodeKey(t, e, s, o) {
86
86
  return e.toolsType = s, e.node = this.createWorkShapeNode({ workId: t, toolsType: s, toolsOpt: o }), e;
87
87
  }
88
88
  activeServiceWorkShape(t) {
89
89
  var m, d;
90
- const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: c, op: n } = t;
90
+ const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: a, op: n } = t;
91
91
  if (!e)
92
92
  return;
93
- const a = e.toString(), p = (m = this.vNodes.get(a)) == null ? void 0 : m.rect;
94
- if (!((d = this.serviceWorkShapes) != null && d.has(a))) {
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
95
  let w = {
96
96
  toolsType: o,
97
97
  animationWorkData: n || [],
98
98
  animationIndex: 0,
99
99
  type: r,
100
100
  updateNodeOpt: i,
101
- ops: c,
102
- oldRect: p
101
+ ops: a,
102
+ oldRect: h
103
103
  };
104
- o && s && (w = this.setNodeKey(a, w, o, s)), this.serviceWorkShapes.set(a, w);
104
+ o && s && (w = this.setNodeKey(c, w, o, s)), this.serviceWorkShapes.set(c, w);
105
105
  }
106
- const l = this.serviceWorkShapes.get(a);
107
- r && (l.type = r), c && (l.animationWorkData = A(c), l.ops = c), i && (l.updateNodeOpt = i), n && (l.animationWorkData = n), l.node && l.node.getWorkId() !== a && l.node.setWorkId(a), p && (l.oldRect = p), o && s && (l.toolsType !== o && o && s && this.setNodeKey(a, l, o, s), l.node && l.node.setWorkOptions(s));
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));
108
108
  }
109
109
  computNextAnimationIndex(t, e) {
110
110
  var r;
@@ -112,48 +112,48 @@ class le {
112
112
  return Math.min((t.animationIndex || 0) + (o || e), (t.animationWorkData || []).length);
113
113
  }
114
114
  animationDraw() {
115
- var o, r, i, c;
115
+ var o, r, i, a;
116
116
  this.animationId = void 0;
117
117
  let t = !1;
118
118
  const e = /* @__PURE__ */ new Map(), s = [];
119
- for (const [n, a] of this.serviceWorkShapes.entries())
120
- switch (a.toolsType) {
119
+ for (const [n, c] of this.serviceWorkShapes.entries())
120
+ switch (c.toolsType) {
121
121
  case f.LaserPen: {
122
- const l = this.computNextAnimationIndex(a, 8), m = Math.max(0, a.animationIndex || 0), d = (a.animationWorkData || []).slice(m, l);
123
- if ((a.animationIndex || 0) < l && ((o = a.node) == null || o.consumeService({
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({
124
124
  op: d,
125
125
  isFullWork: !1
126
- }), a.animationIndex = l, d.length && e.set(n, {
127
- workState: m === 0 ? W.Start : l === ((r = a.animationWorkData) == null ? void 0 : r.length) ? W.Done : W.Doing,
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,
128
128
  op: d.slice(-2)
129
- })), a.isDel) {
130
- (i = a.node) == null || i.clearTmpPoints(), this.serviceWorkShapes.delete(n);
129
+ })), c.isDel) {
130
+ (i = c.node) == null || i.clearTmpPoints(), this.serviceWorkShapes.delete(n);
131
131
  break;
132
132
  }
133
- a.ops && a.animationIndex === ((c = a.animationWorkData) == null ? void 0 : c.length) && !a.isDel && (this.thread.topLayer.getElementsByName(n.toString())[0] || (a.isDel = !0, this.serviceWorkShapes.set(n, a))), t = !0;
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;
134
134
  break;
135
135
  }
136
136
  }
137
- for (const [n, a] of this.localWorkShapes.entries()) {
138
- const { result: p, toolsType: l, isDel: m, workState: d } = a;
137
+ for (const [n, c] of this.localWorkShapes.entries()) {
138
+ const { result: h, toolsType: l, isDel: m, workState: d } = c;
139
139
  switch (l) {
140
140
  case f.LaserPen: {
141
141
  if (m) {
142
- a.node.clearTmpPoints(), this.localWorkShapes.delete(n), s.push({
142
+ c.node.clearTmpPoints(), this.localWorkShapes.delete(n), s.push({
143
143
  removeIds: [n.toString()],
144
- type: h.RemoveNode
144
+ type: p.RemoveNode
145
145
  });
146
146
  break;
147
147
  }
148
- p && ((p.op || p.ops) && s.push(p), a.result = void 0), !this.thread.topLayer.getElementsByName(n.toString())[0] && d === W.Done && (a.isDel = !0, this.localWorkShapes.set(n, a)), t = !0;
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;
149
149
  break;
150
150
  }
151
151
  }
152
152
  }
153
- t && this.runAnimation(), e.size && e.forEach((n, a) => {
153
+ t && this.runAnimation(), e.size && e.forEach((n, c) => {
154
154
  s.push({
155
- type: h.Cursor,
156
- uid: a.split(j)[0],
155
+ type: p.Cursor,
156
+ uid: c.split(J)[0],
157
157
  op: n.op,
158
158
  workState: n.workState,
159
159
  viewId: this.thread.viewId
@@ -171,7 +171,7 @@ class le {
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: W.Start
174
+ workState: T.Start
175
175
  }), this.setToolsOpt(this.tmpOpt);
176
176
  }
177
177
  e != null && e.syncUnitTime || (e.syncUnitTime = this.syncUnitTime), s && s.setWorkOptions(e);
@@ -185,12 +185,12 @@ class le {
185
185
  if (!r)
186
186
  return;
187
187
  const i = r.node.consumeAll({ data: t });
188
- r.result = i, r.workState = W.Done, o && this.localWorkShapes.set(o, r);
188
+ r.result = i, r.workState = T.Done, o && this.localWorkShapes.set(o, r);
189
189
  }
190
190
  this.runAnimation();
191
191
  }
192
192
  }
193
- class he {
193
+ class fe {
194
194
  constructor(t) {
195
195
  u(this, "vNodes");
196
196
  u(this, "thread");
@@ -199,10 +199,11 @@ class he {
199
199
  u(this, "batchEraserRemoveNodes", /* @__PURE__ */ new Set());
200
200
  u(this, "batchEraserWorks", /* @__PURE__ */ new Set());
201
201
  u(this, "tmpOpt");
202
- u(this, "syncUnitTime", R.syncOpt.interval);
202
+ u(this, "syncUnitTime", F.syncOpt.interval);
203
203
  u(this, "drawCount", 0);
204
204
  u(this, "drawWorkActiveId");
205
- u(this, "batchEraserCombine", re(() => {
205
+ u(this, "consumeCount", 0);
206
+ u(this, "batchEraserCombine", ce(() => {
206
207
  this.updateBatchEraserCombineNode(this.batchEraserWorks, this.batchEraserRemoveNodes), this.batchEraserWorks.clear(), this.batchEraserRemoveNodes.clear();
207
208
  }, 100, { leading: !1 }));
208
209
  this.vNodes = t.vNodes, this.thread = t.thread;
@@ -220,49 +221,50 @@ class he {
220
221
  }), this.setWorkOptions(r, s);
221
222
  }
222
223
  }
223
- workShapesDone(t, e) {
224
- for (const s of this.workShapes.keys())
225
- this.consumeDrawAll({
226
- workId: s,
227
- scenePath: t,
228
- viewId: this.thread.viewId,
229
- msgType: h.DrawWork,
230
- dataType: g.Local
231
- }, e);
232
- }
224
+ // async workShapesDone(scenePath: string, serviceWork: SubServiceThread) {
225
+ // for (const key of this.workShapes.keys()) {
226
+ // await this.consumeDrawAll({
227
+ // workId: key,
228
+ // scenePath,
229
+ // viewId: this.thread.viewId,
230
+ // msgType: EPostMessageType.DrawWork,
231
+ // dataType: EDataType.Local
232
+ // }, serviceWork)
233
+ // }
234
+ // }
233
235
  async updateSelector(t) {
234
236
  var m;
235
- const e = this.workShapes.get(N);
237
+ const e = this.workShapes.get(W);
236
238
  if (!((m = e == null ? void 0 : e.selectIds) != null && m.length)) return;
237
- const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i } = o, c = await (e == null ? void 0 : e.updateSelector({
239
+ const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i } = o, a = await (e == null ? void 0 : e.updateSelector({
238
240
  updateSelectorOpt: r,
239
- selectIds: J(e.selectIds),
241
+ selectIds: oe(e.selectIds),
240
242
  vNodes: this.vNodes,
241
243
  willSerializeData: i,
242
244
  worker: this
243
245
  })), n = /* @__PURE__ */ new Map();
244
- let a;
245
- c != null && c.selectIds && (a = ne(e.selectIds, c.selectIds), c.selectIds.forEach((d) => {
246
+ let c;
247
+ a != null && a.selectIds && (c = de(e.selectIds, a.selectIds), a.selectIds.forEach((d) => {
246
248
  const w = this.vNodes.get(d);
247
249
  if (w) {
248
- const { toolsType: k, op: S, opt: v } = w;
250
+ const { toolsType: S, op: y, opt: v } = w;
249
251
  n.set(d, {
250
252
  opt: v,
251
- toolsType: k,
252
- ops: (S == null ? void 0 : S.length) && $(S) || void 0
253
+ toolsType: S,
254
+ ops: (y == null ? void 0 : y.length) && Z(y) || void 0
253
255
  });
254
256
  }
255
- }), e.selectIds = c.selectIds);
256
- const p = [], l = s && s({
257
- res: c,
257
+ }), e.selectIds = a.selectIds);
258
+ const h = [], l = s && s({
259
+ res: a,
258
260
  workShapeNode: e,
259
261
  param: o,
260
- postData: { sp: p },
262
+ postData: { sp: h },
261
263
  newServiceStore: n
262
- }) || { sp: p };
263
- a && l.sp.push({
264
- type: h.RemoveNode,
265
- removeIds: a,
264
+ }) || { sp: h };
265
+ c && l.sp.push({
266
+ type: p.RemoveNode,
267
+ removeIds: c,
266
268
  viewId: this.thread.viewId
267
269
  }), l.sp.length && this.thread.post(l);
268
270
  }
@@ -272,10 +274,10 @@ class he {
272
274
  clearAll() {
273
275
  if (this.thread.localLayer.children.length && (this.thread.topLayer.parent.children.forEach((e) => {
274
276
  e.name !== "viewport" && e.remove();
275
- }), this.thread.localLayer.removeAllChildren()), this.workShapes.get(N)) {
277
+ }), this.thread.localLayer.removeAllChildren()), this.workShapes.get(W)) {
276
278
  const e = [];
277
279
  e.push({
278
- type: h.Select,
280
+ type: p.Select,
279
281
  dataType: g.Local,
280
282
  selectIds: [],
281
283
  willSyncService: !1
@@ -288,20 +290,20 @@ class he {
288
290
  if (e != null && e.length) {
289
291
  let r;
290
292
  for (const i of this.vNodes.curNodeMap.values()) {
291
- const { rect: c, name: n, toolsType: a, opt: p } = 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];
292
- if (a === f.Text && oe([l, m], c) && p.workState === W.Done) {
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) {
293
295
  r = n;
294
296
  break;
295
297
  }
296
298
  }
297
299
  r && (await this.blurSelector({
298
300
  viewId: s,
299
- msgType: h.Select,
301
+ msgType: p.Select,
300
302
  dataType: o,
301
303
  isSync: !0
302
304
  }), this.thread.post({
303
305
  sp: [{
304
- type: h.GetTextActive,
306
+ type: p.GetTextActive,
305
307
  toolsType: f.Text,
306
308
  workId: r
307
309
  }]
@@ -310,36 +312,36 @@ class he {
310
312
  }
311
313
  cursorHover(t) {
312
314
  const { opt: e, toolsType: s, point: o } = t, r = this.setFullWork({
313
- workId: U,
315
+ workId: G,
314
316
  toolsType: s,
315
317
  opt: e
316
318
  });
317
319
  r && o && r.cursorHover(o);
318
320
  }
319
321
  updateFullSelectWork(t) {
320
- var o, r, i, c, n;
321
- const e = this.workShapes.get(N), { selectIds: s } = t;
322
+ var o, r, i, a, n;
323
+ const e = this.workShapes.get(W), { selectIds: s } = t;
322
324
  if (!(s != null && s.length)) {
323
325
  this.blurSelector(t);
324
326
  return;
325
327
  }
326
328
  if (!e) {
327
- const a = this.setFullWork(t);
328
- !a && t.workId && this.tmpOpt && ((o = this.tmpOpt) == null ? void 0 : o.toolsType) === f.Selector && this.setWorkOptions(t.workId.toString(), t.opt || this.tmpOpt.toolsOpt), a && this.updateFullSelectWork(t);
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
331
  return;
330
332
  }
331
333
  if (e && (s != null && s.length)) {
332
- const { selectRect: a } = e.updateSelectIds(s), p = [{
334
+ const { selectRect: c } = e.updateSelectIds(s), h = [{
333
335
  ...t,
334
336
  selectorColor: ((r = t.opt) == null ? void 0 : r.strokeColor) || e.selectorColor,
335
337
  strokeColor: ((i = t.opt) == null ? void 0 : i.strokeColor) || e.strokeColor,
336
- fillColor: ((c = t.opt) == null ? void 0 : c.fillColor) || e.fillColor,
338
+ fillColor: ((a = t.opt) == null ? void 0 : a.fillColor) || e.fillColor,
337
339
  textOpt: ((n = t.opt) == null ? void 0 : n.textOpt) || e.textOpt,
338
340
  canTextEdit: e.canTextEdit,
339
341
  canRotate: e.canRotate,
340
342
  scaleType: e.scaleType,
341
- type: h.Select,
342
- selectRect: a,
343
+ type: p.Select,
344
+ selectRect: c,
343
345
  points: e.getChildrenPoints(),
344
346
  willSyncService: (t == null ? void 0 : t.willSyncService) || !1,
345
347
  opt: (t == null ? void 0 : t.willSyncService) && e.getWorkOptions() || void 0,
@@ -351,36 +353,36 @@ class he {
351
353
  useStroke: e.useStroke,
352
354
  strokeType: e.strokeType
353
355
  }];
354
- this.thread.post({ sp: p });
356
+ this.thread.post({ sp: h });
355
357
  }
356
358
  }
357
359
  commandDeleteText(t) {
358
360
  const e = this.vNodes.get(t);
359
361
  if (e && e.toolsType === f.Text)
360
362
  return {
361
- type: h.TextUpdate,
363
+ type: p.TextUpdate,
362
364
  toolsType: f.Text,
363
365
  workId: t,
364
366
  dataType: g.Local
365
367
  };
366
368
  }
367
369
  async removeSelector(t) {
368
- const { willSyncService: e } = t, s = [], o = [], r = this.workShapes.get(N);
370
+ const { willSyncService: e } = t, s = [], o = [], r = this.workShapes.get(W);
369
371
  if (!r)
370
372
  return;
371
373
  const i = r.selectIds && [...r.selectIds] || [];
372
- for (const c of i) {
373
- if (this.vNodes.get(c)) {
374
- const a = this.commandDeleteText(c);
375
- a && s.push(a);
374
+ for (const a of i) {
375
+ if (this.vNodes.get(a)) {
376
+ const c = this.commandDeleteText(a);
377
+ c && s.push(c);
376
378
  }
377
- this.removeNode(c), o.push(c);
379
+ this.removeNode(a), o.push(a);
378
380
  }
379
381
  o.length && s.push({
380
- type: h.RemoveNode,
382
+ type: p.RemoveNode,
381
383
  removeIds: o
382
384
  }), s.push({
383
- type: h.Select,
385
+ type: p.Select,
384
386
  selectIds: [],
385
387
  willSyncService: e
386
388
  }), await this.blurSelector(), s.length && this.thread.post({ sp: s });
@@ -411,7 +413,7 @@ class he {
411
413
  }
412
414
  async consumeFull(t) {
413
415
  var o;
414
- const e = this.setFullWork(t), s = t.ops && A(t.ops);
416
+ const e = this.setFullWork(t), s = t.ops && P(t.ops);
415
417
  if (e) {
416
418
  const r = (o = t.workId) == null ? void 0 : o.toString();
417
419
  e.toolsType === f.Image ? await e.consumeServiceAsync({
@@ -430,7 +432,7 @@ class he {
430
432
  t.workId && this.workShapes.delete(t.workId.toString()), t.willSyncService && i.push({
431
433
  opt: t.opt,
432
434
  toolsType: t.toolsType,
433
- type: h.FullWork,
435
+ type: p.FullWork,
434
436
  workId: t.workId,
435
437
  ops: t.ops,
436
438
  updateNodeOpt: t.updateNodeOpt,
@@ -439,9 +441,9 @@ class he {
439
441
  }
440
442
  }
441
443
  async colloctEffectSelectWork(t) {
442
- const e = this.workShapes.get(N), { workId: s, msgType: o } = t;
444
+ const e = this.workShapes.get(W), { workId: s, msgType: o } = t;
443
445
  if (e && s && e.selectIds && e.selectIds.includes(s.toString())) {
444
- o === h.RemoveNode ? e.selectIds = e.selectIds.filter((r) => r !== s.toString()) : this.effectSelectNodeData.add(t), await new Promise((r) => {
446
+ o === p.RemoveNode ? e.selectIds = e.selectIds.filter((r) => r !== s.toString()) : this.effectSelectNodeData.add(t), await new Promise((r) => {
445
447
  setTimeout(() => {
446
448
  r(!0);
447
449
  }, 0);
@@ -471,7 +473,7 @@ class he {
471
473
  replaceId: r
472
474
  });
473
475
  else {
474
- const i = s.ops && A(s.ops);
476
+ const i = s.ops && P(s.ops);
475
477
  o.consumeService({
476
478
  op: i,
477
479
  isFullWork: !0,
@@ -484,21 +486,21 @@ class he {
484
486
  this.reRenderSelector(t);
485
487
  }
486
488
  hasSelector() {
487
- return this.workShapes.has(N);
489
+ return this.workShapes.has(W);
488
490
  }
489
491
  getSelector() {
490
- return this.workShapes.get(N);
492
+ return this.workShapes.get(W);
491
493
  }
492
494
  reRenderSelector(t = !1) {
493
495
  var o;
494
- const e = this.workShapes.get(N);
496
+ const e = this.workShapes.get(W);
495
497
  if (!e) return;
496
498
  if (e && !((o = e.selectIds) != null && o.length))
497
499
  return this.blurSelector();
498
500
  const s = e.reRenderSelector();
499
501
  s && this.thread.post({
500
502
  sp: [{
501
- type: h.Select,
503
+ type: p.Select,
502
504
  selectIds: e.selectIds,
503
505
  selectRect: s,
504
506
  willSyncService: t,
@@ -524,9 +526,9 @@ class he {
524
526
  }
525
527
  async blurSelector(t) {
526
528
  var o;
527
- const e = this.workShapes.get(N), s = e == null ? void 0 : e.blurSelector();
528
- if (this.clearWorkShapeNodeCache(N), ((o = this.thread.fullLayer) == null ? void 0 : o.parent).children.forEach((r) => {
529
- r.name === N && r.remove();
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();
530
532
  }), s) {
531
533
  const r = [];
532
534
  r.push({
@@ -541,29 +543,18 @@ class he {
541
543
  }
542
544
  drawBitMapEraser(t) {
543
545
  const e = [];
544
- t.op && e.push(t), e.length && this.thread.post({ sp: e });
546
+ t.op && e.push(t), this.thread.post({ sp: e, consumeCount: this.consumeCount });
545
547
  }
546
548
  async drawBitMapEraserFull(t, e, s) {
547
- const { willUpdateNodes: o, willDeleteNodes: r, scenePath: i, ...c } = e, n = t.getWorkId(), a = [
549
+ const { willUpdateNodes: o, willDeleteNodes: r } = e, i = t.getWorkId(), a = [
548
550
  {
549
- ...c,
550
- workId: n,
551
- scenePath: i,
552
- updateNodeOpt: {
553
- useAnimation: !1
554
- },
555
- isSync: !0,
556
- nextTasks: [
557
- {
558
- type: h.RemoveNode,
559
- removeIds: [n],
560
- viewId: this.thread.viewId
561
- }
562
- ]
551
+ type: p.RemoveNode,
552
+ removeIds: [i],
553
+ viewId: this.thread.viewId
563
554
  }
564
555
  ];
565
556
  if (s && a.push({
566
- type: h.None,
557
+ type: p.None,
567
558
  isLockSentEventCursor: s
568
559
  }), o != null && o.size || r != null && r.size) {
569
560
  if (await (t == null ? void 0 : t.reRenderEffectNodes({
@@ -571,18 +562,18 @@ class he {
571
562
  willUpdateNodes: o,
572
563
  worker: this
573
564
  })), o != null && o.size)
574
- for (const [p, l] of o)
565
+ for (const [n, c] of o)
575
566
  a.push({
576
- type: h.UpdateNode,
567
+ type: p.UpdateNode,
577
568
  dataType: g.Local,
578
- opt: l.opt,
579
- workId: p,
569
+ opt: c.opt,
570
+ workId: n,
580
571
  updateNodeOpt: {
581
572
  useAnimation: !1
582
573
  }
583
574
  });
584
575
  r != null && r.size && a.push({
585
- type: h.RemoveNode,
576
+ type: p.RemoveNode,
586
577
  removeIds: [...r],
587
578
  viewId: this.thread.viewId
588
579
  });
@@ -594,11 +585,11 @@ class he {
594
585
  const s = [];
595
586
  if ((o = t.newWorkDatas) != null && o.size) {
596
587
  for (const i of t.newWorkDatas.values()) {
597
- const c = i.workId.toString();
598
- this.batchEraserWorks.add(c), s.push({
599
- type: h.FullWork,
600
- workId: c,
601
- ops: $(i.op),
588
+ const a = i.workId.toString();
589
+ this.batchEraserWorks.add(a), s.push({
590
+ type: p.FullWork,
591
+ workId: a,
592
+ ops: Z(i.op),
602
593
  opt: i.opt,
603
594
  toolsType: i.toolsType,
604
595
  updateNodeOpt: {
@@ -611,16 +602,16 @@ class he {
611
602
  (r = t.removeIds) == null || r.forEach((i) => {
612
603
  this.batchEraserRemoveNodes.add(i);
613
604
  }), e && s.push({
614
- type: h.None,
605
+ type: p.None,
615
606
  isLockSentEventCursor: e
616
- }), t.rect, this.thread.post({ sp: s }), this.batchEraserCombine();
607
+ }), t.rect, this.thread.post({ sp: s, consumeCount: this.consumeCount }), this.batchEraserCombine();
617
608
  }
618
609
  drawEraser(t, e) {
619
610
  const s = [];
620
611
  t.removeIds && s.push(t), e && s.push({
621
- type: h.None,
612
+ type: p.None,
622
613
  isLockSentEventCursor: e
623
- }), this.thread.post({ sp: s });
614
+ }), this.thread.post({ sp: s, consumeCount: this.consumeCount });
624
615
  }
625
616
  updateBatchEraserCombineNode(t, e) {
626
617
  for (const s of e.keys())
@@ -645,54 +636,54 @@ class he {
645
636
  return this.workShapes;
646
637
  }
647
638
  consumeDraw(t, e) {
648
- const { op: s, workId: o, scenePath: r } = t;
639
+ const { op: s, workId: o, scenePath: r, postCount: i } = t;
649
640
  if (s != null && s.length && o) {
650
- const i = o.toString(), c = this.workShapes.get(i);
651
- if (!c)
641
+ const a = o.toString(), n = this.workShapes.get(a);
642
+ if (!n)
652
643
  return;
653
- const n = c.toolsType;
654
- if (n === f.LaserPen)
644
+ const c = n.toolsType;
645
+ if (c === f.LaserPen)
655
646
  return;
656
- switch (this.drawWorkActiveId && this.drawWorkActiveId !== i && (this.consumeDrawAll({
647
+ switch (this.drawWorkActiveId && this.drawWorkActiveId !== a && (this.consumeDrawAll({
657
648
  workId: this.drawWorkActiveId,
658
649
  scenePath: r,
659
650
  viewId: this.thread.viewId,
660
- msgType: h.DrawWork,
651
+ msgType: p.DrawWork,
661
652
  dataType: g.Local
662
- }, e), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && i !== N && (this.drawWorkActiveId = i), n) {
653
+ }, e), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== W && (this.drawWorkActiveId = a), U(i) && (this.consumeCount = i), c) {
663
654
  case f.Selector:
664
655
  {
665
- const a = c.consume({
656
+ const h = n.consume({
666
657
  data: t,
667
658
  isFullWork: !0
668
659
  });
669
- a.type === h.Select && (a.selectIds && e.runReverseSelectWork(a.selectIds), this.thread.post({ sp: [a] }));
660
+ h.type === p.Select && (h.selectIds && e.runReverseSelectWork(h.selectIds), this.thread.post({ sp: [h] }));
670
661
  }
671
662
  break;
672
663
  case f.PencilEraser:
673
664
  {
674
- const a = c.consume({
665
+ const h = n.consume({
675
666
  data: t,
676
667
  isFullWork: !0
677
668
  });
678
- a != null && a.rect && this.drawPencilEraser(a);
669
+ this.drawPencilEraser(h);
679
670
  }
680
671
  break;
681
672
  case f.BitMapEraser: {
682
- const a = c.consume({
673
+ const h = n.consume({
683
674
  data: t,
684
675
  isFullWork: !0
685
676
  });
686
- a != null && a.rect && this.drawBitMapEraser(a);
677
+ this.drawBitMapEraser(h);
687
678
  break;
688
679
  }
689
680
  case f.Eraser:
690
681
  {
691
- const a = c.consume({
682
+ const h = n.consume({
692
683
  data: t,
693
684
  isFullWork: !0
694
685
  });
695
- a != null && a.rect && this.drawEraser(a);
686
+ this.drawEraser(h);
696
687
  }
697
688
  break;
698
689
  case f.Arrow:
@@ -704,14 +695,14 @@ class he {
704
695
  case f.SpeechBalloon:
705
696
  case f.Pencil:
706
697
  {
707
- const a = c.consume({
698
+ const h = n.consume({
708
699
  data: t,
709
700
  isFullWork: !1,
710
701
  isMainThread: !0
711
702
  });
712
- a && (this.drawCount++, this.thread.post({
703
+ h && (this.drawCount++, this.thread.post({
713
704
  drawCount: this.drawCount,
714
- sp: a.op && [{ ...a, scenePath: r }] || void 0
705
+ sp: h.op && [{ ...h, scenePath: r }] || void 0
715
706
  }));
716
707
  }
717
708
  break;
@@ -719,30 +710,30 @@ class he {
719
710
  }
720
711
  }
721
712
  consumeDrawAll(t, e) {
722
- var i, c, n, a;
713
+ var i, a, n, c;
723
714
  const { workId: s, scenePath: o, isLockSentEventCursor: r } = t;
724
715
  if (s) {
725
- const p = s.toString();
726
- this.drawWorkActiveId === p && (this.drawWorkActiveId = void 0);
727
- const l = this.workShapes.get(p);
716
+ const h = s.toString();
717
+ this.drawWorkActiveId === h && (this.drawWorkActiveId = void 0);
718
+ const l = this.workShapes.get(h);
728
719
  if (!l)
729
720
  return;
730
721
  const m = l.toolsType;
731
722
  if (m === f.LaserPen)
732
723
  return;
733
- const d = this.workShapes.get(U), w = (i = d == null ? void 0 : d.selectIds) == null ? void 0 : i[0], k = l.consumeAll({ data: t });
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 });
734
725
  switch (m) {
735
726
  case f.Selector:
736
- k.selectIds && w && ((c = k.selectIds) != null && c.includes(w)) && d.cursorBlur(), k.type === h.Select && (k.selectIds && e.runReverseSelectWork(k.selectIds), this.thread.post({ sp: [{ ...k, scenePath: o }] })), (n = l.selectIds) != null && n.length ? l.clearTmpPoints() : this.clearWorkShapeNodeCache(p);
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);
737
728
  break;
738
729
  case f.PencilEraser:
739
- this.drawPencilEraser({ ...k, scenePath: o }, r), l.clearTmpPoints();
730
+ this.drawPencilEraser({ ...S, scenePath: o }, r), l.clearTmpPoints();
740
731
  break;
741
732
  case f.BitMapEraser:
742
- (k.rect || (a = k.newWorkDatas) != null && a.size) && this.drawBitMapEraserFull(l, k, r);
733
+ (S.rect || (c = S.newWorkDatas) != null && c.size) && this.drawBitMapEraserFull(l, S, r);
743
734
  break;
744
735
  case f.Eraser:
745
- this.drawEraser({ ...k, scenePath: o }, r), l.clearTmpPoints();
736
+ this.drawEraser({ ...S, scenePath: o }, r), l.clearTmpPoints();
746
737
  break;
747
738
  case f.Arrow:
748
739
  case f.Straight:
@@ -752,14 +743,14 @@ class he {
752
743
  case f.Polygon:
753
744
  case f.SpeechBalloon:
754
745
  case f.Pencil: {
755
- const S = [];
756
- r && S.push({
757
- type: h.None,
746
+ const y = [];
747
+ r && y.push({
748
+ type: p.None,
758
749
  isLockSentEventCursor: r
759
- }), k && (S.push(k), this.drawCount = 0, this.thread.post({
750
+ }), S && (y.push(S), this.drawCount = 0, this.thread.post({
760
751
  drawCount: this.drawCount,
761
- sp: S
762
- })), this.clearWorkShapeNodeCache(p);
752
+ sp: y
753
+ })), this.clearWorkShapeNodeCache(h);
763
754
  break;
764
755
  }
765
756
  }
@@ -781,10 +772,10 @@ class he {
781
772
  e.syncUnitTime || (e.syncUnitTime = this.syncUnitTime), s == null || s.setWorkOptions(e);
782
773
  }
783
774
  createWorkShapeNode(t) {
784
- return F({ ...t, vNodes: this.vNodes, fullLayer: this.thread.fullLayer, drawLayer: this.thread.localLayer }, this.thread.serviceWork);
775
+ return z({ ...t, vNodes: this.vNodes, fullLayer: this.thread.fullLayer, drawLayer: this.thread.localLayer }, this.thread.serviceWork);
785
776
  }
786
777
  }
787
- class pe {
778
+ class me {
788
779
  constructor(t) {
789
780
  u(this, "vNodes");
790
781
  u(this, "thread");
@@ -793,7 +784,7 @@ class pe {
793
784
  u(this, "willRunEffectSelectorIds", /* @__PURE__ */ new Set());
794
785
  u(this, "runEffectId");
795
786
  u(this, "animationId");
796
- u(this, "syncUnitTime", R.syncOpt.interval);
787
+ u(this, "syncUnitTime", F.syncOpt.interval);
797
788
  this.vNodes = t.vNodes, this.thread = t.thread;
798
789
  }
799
790
  async loadImageBitMap(t) {
@@ -854,30 +845,30 @@ class pe {
854
845
  return Math.min((t.animationIndex || 0) + (s || e), (t.animationWorkData || []).length);
855
846
  }
856
847
  async animationDraw() {
857
- var s, o, r, i, c, n, a, p, l, m, d, w, k, S, v;
848
+ var s, o, r, i, a, n, c, h, l, m, d, w, S, y, v, C, R, V, K;
858
849
  this.animationId = void 0;
859
850
  let t = !1;
860
851
  const e = /* @__PURE__ */ new Map();
861
- for (const [I, y] of this.workShapes.entries())
862
- switch (y.toolsType) {
852
+ for (const [L, k] of this.workShapes.entries())
853
+ switch (k.toolsType) {
863
854
  case f.Image: {
864
- await ((s = y.node) == null ? void 0 : s.consumeServiceAsync({
855
+ await ((s = k.node) == null ? void 0 : s.consumeServiceAsync({
865
856
  isFullWork: !0,
866
857
  worker: this
867
- })), this.selectorWorkShapes.forEach((b, E) => {
868
- var O;
869
- (O = b.selectIds) != null && O.includes(I) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
870
- }), this.workShapes.delete(I);
858
+ })), this.selectorWorkShapes.forEach((b, O) => {
859
+ var E;
860
+ (E = b.selectIds) != null && E.includes(L) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
861
+ }), this.workShapes.delete(L);
871
862
  break;
872
863
  }
873
864
  case f.Text: {
874
- y.node && (await ((o = y.node) == null ? void 0 : o.consumeServiceAsync({
865
+ k.node && (await ((o = k.node) == null ? void 0 : o.consumeServiceAsync({
875
866
  isFullWork: !0,
876
- replaceId: I
877
- })), this.selectorWorkShapes.forEach((b, E) => {
878
- var O;
879
- (O = b.selectIds) != null && O.includes(I) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
880
- }), (r = y.node) == null || r.clearTmpPoints(), this.workShapes.delete(I));
867
+ 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());
871
+ }), (r = k.node) == null || r.clearTmpPoints(), this.workShapes.delete(L));
881
872
  break;
882
873
  }
883
874
  case f.Arrow:
@@ -887,63 +878,63 @@ class pe {
887
878
  case f.Star:
888
879
  case f.Polygon:
889
880
  case f.SpeechBalloon: {
890
- const b = !!y.ops;
891
- if ((i = y.animationWorkData) != null && i.length) {
892
- const E = y.oldRect;
893
- (c = y.node) == null || c.consumeService({
894
- op: y.animationWorkData,
881
+ const b = !!k.ops;
882
+ if ((i = k.animationWorkData) != null && i.length) {
883
+ const O = k.oldRect;
884
+ (a = k.node) == null || a.consumeService({
885
+ op: k.animationWorkData,
895
886
  isFullWork: b
896
- }), b && (this.selectorWorkShapes.forEach((O, D) => {
887
+ }), b && (this.selectorWorkShapes.forEach((E, D) => {
897
888
  var x;
898
- (x = O.selectIds) != null && x.includes(I) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
899
- }), (n = y.node) == null || n.clearTmpPoints(), this.workShapes.delete(I)), e.set(I, {
900
- workState: E ? y.ops ? W.Done : W.Doing : W.Start,
901
- op: y.animationWorkData.filter((O, D) => {
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) => {
902
893
  if (D % 3 !== 2)
903
894
  return !0;
904
895
  }).slice(-2)
905
- }), y.animationWorkData.length = 0;
896
+ }), k.animationWorkData.length = 0;
906
897
  }
907
898
  break;
908
899
  }
909
900
  case f.Pencil: {
910
- if (!y.useAnimation && y.ops)
911
- (a = y.node) == null || a.consumeService({
912
- op: y.animationWorkData || [],
901
+ if (!k.useAnimation && k.ops)
902
+ (c = k.node) == null || c.consumeService({
903
+ op: k.animationWorkData || [],
913
904
  isFullWork: !0,
914
- replaceId: I
915
- }), (p = y.node) == null || p.updataOptService(y.updateNodeOpt), this.selectorWorkShapes.forEach((b, E) => {
916
- var O;
917
- (O = b.selectIds) != null && O.includes(I) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
918
- }), (l = y.node) == null || l.clearTmpPoints(), this.workShapes.delete(I);
919
- else if (y.useAnimation) {
920
- if (y.isDel) {
921
- (m = y.node) == null || m.clearTmpPoints(), this.workShapes.delete(I);
905
+ 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());
909
+ }), (l = k.node) == null || l.clearTmpPoints(), this.workShapes.delete(L);
910
+ else if (k.useAnimation) {
911
+ if (k.isDel) {
912
+ (m = k.node) == null || m.clearTmpPoints(), this.workShapes.delete(L);
922
913
  break;
923
914
  }
924
- const b = 3, E = this.computNextAnimationIndex(y, b), O = y.isDiff ? 0 : Math.max(0, (y.animationIndex || 0) - b), D = (y.animationWorkData || []).slice(O, E), x = (w = (d = y.node) == null ? void 0 : d.getWorkId()) == null ? void 0 : w.toString();
925
- if ((y.animationIndex || 0) < E || y.isDiff) {
926
- if ((k = y.node) == null || k.consumeService({
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({
927
918
  op: D,
928
919
  isFullWork: !1
929
- }), y.animationIndex = E, y.isDiff && (y.isDiff = !1), D.length) {
930
- const z = D.filter((_, ee) => {
931
- if (ee % b !== b - 1)
920
+ }), k.animationIndex = O, k.isDiff && (k.isDiff = !1), D.length) {
921
+ const _ = D.filter((B, re) => {
922
+ if (re % b !== b - 1)
932
923
  return !0;
933
924
  }).slice(-2);
934
- e.set(I, {
935
- workState: O === 0 ? W.Start : E === ((S = y.animationWorkData) == null ? void 0 : S.length) ? W.Done : W.Doing,
936
- op: z
925
+ e.set(L, {
926
+ workState: E === 0 ? T.Start : O === ((y = k.animationWorkData) == null ? void 0 : y.length) ? T.Done : T.Doing,
927
+ op: _
937
928
  });
938
929
  }
939
- } else y.ops && ((v = y.node) == null || v.consumeService({
940
- op: y.animationWorkData || [],
930
+ } else k.ops && ((v = k.node) == null || v.consumeService({
931
+ op: k.animationWorkData || [],
941
932
  isFullWork: !0,
942
933
  replaceId: x
943
- }), y.isDel = !0, e.set(I, {
944
- workState: W.Done,
945
- op: D.filter((z, _) => {
946
- if (_ % b !== b - 1)
934
+ }), k.isDel = !0, e.set(L, {
935
+ workState: T.Done,
936
+ op: D.filter((_, B) => {
937
+ if (B % b !== b - 1)
947
938
  return !0;
948
939
  }).slice(-2)
949
940
  }));
@@ -952,18 +943,52 @@ class pe {
952
943
  }
953
944
  break;
954
945
  }
946
+ case f.BitMapEraser:
947
+ case f.PencilEraser: {
948
+ if (k.isDel) {
949
+ (C = k.node) == null || C.clearTmpPoints(), this.workShapes.delete(L);
950
+ break;
951
+ }
952
+ if (k.ops && ((R = k.animationWorkData) != null && R.length)) {
953
+ const b = k.animationWorkData.slice(-3, -1);
954
+ e.set(L, {
955
+ workState: T.Done,
956
+ op: b
957
+ }), k.isDel = !0;
958
+ break;
959
+ }
960
+ 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,
964
+ isFullWork: k.toolsType !== f.BitMapEraser
965
+ }), k.animationIndex = O, k.isDiff && (k.isDiff = !1), D.length)) {
966
+ const x = D.filter((_, B) => {
967
+ if (B % 3 !== 2)
968
+ return !0;
969
+ }).slice(-2);
970
+ e.set(L, {
971
+ workState: E === 0 ? T.Start : O === ((K = k.animationWorkData) == null ? void 0 : K.length) ? T.Done : T.Doing,
972
+ op: x
973
+ });
974
+ }
975
+ t = !0;
976
+ break;
977
+ }
978
+ break;
979
+ }
955
980
  }
956
981
  if (t && this.runAnimation(), e.size) {
957
- const I = [];
958
- e.forEach((y, b) => {
959
- I.push({
960
- type: h.Cursor,
961
- uid: b.split(j)[0],
962
- op: y.op,
963
- workState: y.workState,
982
+ const L = [];
983
+ e.forEach((k, b) => {
984
+ L.push({
985
+ type: p.Cursor,
986
+ uid: b.split(J)[0],
987
+ op: k.op,
988
+ workState: k.workState,
964
989
  viewId: this.thread.viewId
965
990
  });
966
- }), this.thread.post({ sp: I });
991
+ }), this.thread.post({ sp: L });
967
992
  }
968
993
  }
969
994
  runAnimation() {
@@ -990,31 +1015,31 @@ class pe {
990
1015
  return !1;
991
1016
  }
992
1017
  activeWorkShape(t) {
993
- var w, k, S, v;
994
- const { workId: e, opt: s, toolsType: o, type: r, updateNodeOpt: i, ops: c, op: n, useAnimation: a, imageBitmap: p } = 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;
995
1020
  if (!e)
996
1021
  return;
997
1022
  const l = e.toString(), m = (w = this.vNodes.get(l)) == null ? void 0 : w.rect;
998
- if (!((k = this.workShapes) != null && k.has(l))) {
999
- let I = {
1023
+ if (!((S = this.workShapes) != null && S.has(l))) {
1024
+ let C = {
1000
1025
  toolsType: o,
1001
1026
  animationWorkData: n || [],
1002
1027
  animationIndex: 0,
1003
1028
  type: r,
1004
1029
  updateNodeOpt: i,
1005
- ops: c,
1006
- useAnimation: typeof a < "u" ? a : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
1030
+ ops: a,
1031
+ useAnimation: typeof c < "u" ? c : typeof (i == null ? void 0 : i.useAnimation) < "u" ? i == null ? void 0 : i.useAnimation : !0,
1007
1032
  oldRect: m,
1008
1033
  isDiff: !1,
1009
- imageBitmap: p
1034
+ imageBitmap: h
1010
1035
  };
1011
- o && s && (I = this.setNodeKey(l, I, o, s)), (S = this.workShapes) == null || S.set(l, I);
1036
+ o && s && (C = this.setNodeKey(l, C, o, s)), (y = this.workShapes) == null || y.set(l, C);
1012
1037
  }
1013
1038
  const d = (v = this.workShapes) == null ? void 0 : v.get(l);
1014
- r && (d.type = r), c && (d.animationWorkData = A(c), d.ops = c), 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)), p && (d.imageBitmap = p);
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);
1015
1040
  }
1016
1041
  removeNode(t, e) {
1017
- t.indexOf(N) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
1042
+ t.indexOf(W) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((s) => {
1018
1043
  s.remove();
1019
1044
  }), this.thread.serviceLayer.getElementsByName(t).forEach((s) => {
1020
1045
  s.remove();
@@ -1025,25 +1050,25 @@ class pe {
1025
1050
  s && (this.activeSelectorShape(t), this.willRunEffectSelectorIds.add(s)), this.runEffect();
1026
1051
  }
1027
1052
  activeSelectorShape(t) {
1028
- var a, p, l;
1053
+ var c, h, l;
1029
1054
  const { workId: e, opt: s, toolsType: o, type: r, selectIds: i } = t;
1030
1055
  if (!e)
1031
1056
  return;
1032
- const c = e.toString();
1033
- if (!((a = this.selectorWorkShapes) != null && a.has(c))) {
1057
+ const a = e.toString();
1058
+ if (!((c = this.selectorWorkShapes) != null && c.has(a))) {
1034
1059
  let m = {
1035
1060
  toolsType: o,
1036
1061
  selectIds: i,
1037
1062
  type: r,
1038
1063
  opt: s
1039
1064
  };
1040
- o && s && (m = this.setNodeKey(c, m, o, s)), (p = this.selectorWorkShapes) == null || p.set(c, m);
1065
+ o && s && (m = this.setNodeKey(a, m, o, s)), (h = this.selectorWorkShapes) == null || h.set(a, m);
1041
1066
  }
1042
- const n = (l = this.selectorWorkShapes) == null ? void 0 : l.get(c);
1043
- r && (n.type = r), n.node && n.node.getWorkId() !== c && n.node.setWorkId(c), n.selectIds = i || [];
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 || [];
1044
1069
  }
1045
1070
  setNodeKey(t, e, s, o) {
1046
- return e.toolsType = s, e.node = F({
1071
+ return e.toolsType = s, e.node = z({
1047
1072
  toolsType: s,
1048
1073
  toolsOpt: o,
1049
1074
  vNodes: this.vNodes,
@@ -1053,7 +1078,7 @@ class pe {
1053
1078
  }, this), e;
1054
1079
  }
1055
1080
  }
1056
- class C {
1081
+ class M {
1057
1082
  constructor() {
1058
1083
  u(this, "localWork");
1059
1084
  u(this, "serviceWork");
@@ -1063,14 +1088,14 @@ class C {
1063
1088
  return this.threadEngine = t, this.localWork = t.localWork, this.serviceWork = t.serviceWork, this;
1064
1089
  }
1065
1090
  }
1066
- class de extends C {
1091
+ class ke extends M {
1067
1092
  constructor() {
1068
1093
  super(...arguments);
1069
- u(this, "emitEventType", T.CopyNode);
1094
+ u(this, "emitEventType", I.CopyNode);
1070
1095
  }
1071
1096
  async consume(e) {
1072
1097
  const { msgType: s, dataType: o, emitEventType: r } = e;
1073
- if (s === h.FullWork && o === g.Local && r === this.emitEventType)
1098
+ if (s === p.FullWork && o === g.Local && r === this.emitEventType)
1074
1099
  return this.consumeForLocalWorker(e), !0;
1075
1100
  }
1076
1101
  async consumeForLocalWorker(e) {
@@ -1079,88 +1104,88 @@ class de extends C {
1079
1104
  s && await ((o = this.localWork) == null ? void 0 : o.consumeFull(e));
1080
1105
  }
1081
1106
  }
1082
- class ue extends C {
1107
+ class Se extends M {
1083
1108
  constructor() {
1084
1109
  super(...arguments);
1085
- u(this, "emitEventType", T.SetColorNode);
1110
+ u(this, "emitEventType", I.SetColorNode);
1086
1111
  }
1087
1112
  async consume(e) {
1088
1113
  const { msgType: s, dataType: o, emitEventType: r } = e;
1089
- if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
1114
+ if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
1090
1115
  return this.consumeForLocalWorker(e), !0;
1091
1116
  }
1092
1117
  async consumeForLocalWorker(e) {
1093
- var a;
1094
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c, textUpdateForWoker: n } = e;
1095
- s === N && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
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({
1096
1121
  updateSelectorOpt: o,
1097
1122
  willRefreshSelector: r,
1098
1123
  willSyncService: i,
1099
- willSerializeData: c,
1124
+ willSerializeData: a,
1100
1125
  textUpdateForWoker: n,
1101
1126
  callback: this.updateSelectorCallback
1102
1127
  }));
1103
1128
  }
1104
1129
  updateSelectorCallback(e) {
1105
- const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: c, textUpdateForWoker: n } = s, a = o.sp || [];
1130
+ const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a, textUpdateForWoker: n } = s, c = o.sp || [];
1106
1131
  if (i)
1107
- for (const [p, l] of r.entries())
1108
- n && l.toolsType === f.Text ? a.push({
1132
+ for (const [h, l] of r.entries())
1133
+ n && l.toolsType === f.Text ? c.push({
1109
1134
  ...l,
1110
- workId: p,
1111
- type: h.TextUpdate,
1135
+ workId: h,
1136
+ type: p.TextUpdate,
1112
1137
  dataType: g.Local,
1113
1138
  willSyncService: !0
1114
- }) : a.push(
1139
+ }) : c.push(
1115
1140
  {
1116
1141
  ...l,
1117
- workId: p,
1118
- type: h.UpdateNode,
1142
+ workId: h,
1143
+ type: p.UpdateNode,
1119
1144
  updateNodeOpt: {
1120
1145
  useAnimation: !1
1121
1146
  },
1122
- isSync: c
1147
+ isSync: a
1123
1148
  }
1124
1149
  );
1125
1150
  return {
1126
- sp: a
1151
+ sp: c
1127
1152
  };
1128
1153
  }
1129
1154
  }
1130
- class fe extends C {
1155
+ class ye extends M {
1131
1156
  constructor() {
1132
1157
  super(...arguments);
1133
- u(this, "emitEventType", T.ZIndexNode);
1158
+ u(this, "emitEventType", I.ZIndexNode);
1134
1159
  }
1135
1160
  async consume(e) {
1136
1161
  const { msgType: s, dataType: o, emitEventType: r } = e;
1137
- if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
1162
+ if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
1138
1163
  return this.consumeForLocalWorker(e), !0;
1139
1164
  }
1140
1165
  async consumeForLocalWorker(e) {
1141
1166
  var n;
1142
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c } = e;
1143
- s === N && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1167
+ 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({
1144
1169
  updateSelectorOpt: o,
1145
1170
  willRefreshSelector: r,
1146
1171
  willSyncService: i,
1147
- willSerializeData: c,
1172
+ willSerializeData: a,
1148
1173
  callback: this.updateSelectorCallback
1149
1174
  }));
1150
1175
  }
1151
1176
  updateSelectorCallback(e) {
1152
- const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: c } = s, n = o.sp || [];
1177
+ const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, n = o.sp || [];
1153
1178
  if (i && n)
1154
- for (const [a, p] of r.entries())
1179
+ for (const [c, h] of r.entries())
1155
1180
  n.push(
1156
1181
  {
1157
- ...p,
1158
- workId: a,
1159
- type: h.UpdateNode,
1182
+ ...h,
1183
+ workId: c,
1184
+ type: p.UpdateNode,
1160
1185
  updateNodeOpt: {
1161
1186
  useAnimation: !1
1162
1187
  },
1163
- isSync: c
1188
+ isSync: a
1164
1189
  }
1165
1190
  );
1166
1191
  return {
@@ -1168,41 +1193,41 @@ class fe extends C {
1168
1193
  };
1169
1194
  }
1170
1195
  }
1171
- class me extends C {
1196
+ class we extends M {
1172
1197
  constructor() {
1173
1198
  super(...arguments);
1174
- u(this, "emitEventType", T.TranslateNode);
1199
+ u(this, "emitEventType", I.TranslateNode);
1175
1200
  }
1176
1201
  async consume(e) {
1177
1202
  const { msgType: s, dataType: o, emitEventType: r } = e;
1178
- if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
1203
+ if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
1179
1204
  return await this.consumeForLocalWorker(e), !0;
1180
1205
  }
1181
1206
  async consumeForLocalWorker(e) {
1182
- var p, l;
1183
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c, textUpdateForWoker: n, emitEventType: a } = e;
1184
- s === N && o && (o.workState === W.Done && (o != null && o.translate) && (o.translate[0] || o.translate[1]) || o.workState !== W.Done ? await ((p = this.localWork) == null ? void 0 : p.updateSelector({
1207
+ 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({
1185
1210
  updateSelectorOpt: o,
1186
1211
  willRefreshSelector: r,
1187
1212
  willSyncService: i,
1188
- willSerializeData: c,
1213
+ willSerializeData: a,
1189
1214
  isSync: !0,
1190
1215
  textUpdateForWoker: n,
1191
- emitEventType: a,
1216
+ emitEventType: c,
1192
1217
  callback: this.updateSelectorCallback
1193
- })) : o.workState === W.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
1218
+ })) : o.workState === T.Done && ((l = this.localWork) == null || l.vNodes.deleteLastTarget()));
1194
1219
  }
1195
1220
  updateSelectorCallback(e) {
1196
- const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt: p, textUpdateForWoker: l } = s, m = p.workState, d = o.sp || [];
1197
- if (m === W.Start)
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)
1198
1223
  return {
1199
1224
  sp: [],
1200
1225
  render: []
1201
1226
  };
1202
- const w = c == null ? void 0 : c.selectRect;
1227
+ const w = a == null ? void 0 : a.selectRect;
1203
1228
  if (n) {
1204
- m === W.Doing && d.push({
1205
- type: h.Select,
1229
+ m === T.Doing && d.push({
1230
+ type: p.Select,
1206
1231
  selectIds: i.selectIds,
1207
1232
  selectRect: w,
1208
1233
  willSyncService: !0,
@@ -1210,22 +1235,22 @@ class me extends C {
1210
1235
  points: i.getChildrenPoints(),
1211
1236
  textOpt: i.textOpt
1212
1237
  });
1213
- for (const [k, S] of r.entries())
1214
- l && S.toolsType === f.Text ? d.push({
1215
- ...S,
1216
- workId: k,
1217
- type: h.TextUpdate,
1238
+ for (const [S, y] of r.entries())
1239
+ l && y.toolsType === f.Text ? d.push({
1240
+ ...y,
1241
+ workId: S,
1242
+ type: p.TextUpdate,
1218
1243
  dataType: g.Local,
1219
1244
  willSyncService: !0
1220
1245
  }) : d.push(
1221
1246
  {
1222
- ...S,
1223
- workId: k,
1224
- type: h.UpdateNode,
1247
+ ...y,
1248
+ workId: S,
1249
+ type: p.UpdateNode,
1225
1250
  updateNodeOpt: {
1226
1251
  useAnimation: !1
1227
1252
  },
1228
- isSync: a
1253
+ isSync: c
1229
1254
  }
1230
1255
  );
1231
1256
  }
@@ -1234,29 +1259,29 @@ class me extends C {
1234
1259
  };
1235
1260
  }
1236
1261
  }
1237
- class ke extends C {
1262
+ class ve extends M {
1238
1263
  constructor() {
1239
1264
  super(...arguments);
1240
- u(this, "emitEventType", T.DeleteNode);
1265
+ u(this, "emitEventType", I.DeleteNode);
1241
1266
  }
1242
1267
  async consume() {
1243
1268
  return !1;
1244
1269
  }
1245
1270
  }
1246
- class Se extends C {
1271
+ class ge extends M {
1247
1272
  constructor() {
1248
1273
  super(...arguments);
1249
- u(this, "emitEventType", T.ScaleNode);
1274
+ u(this, "emitEventType", I.ScaleNode);
1250
1275
  }
1251
1276
  async consume(e) {
1252
1277
  const { msgType: s, dataType: o, emitEventType: r } = e;
1253
- if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
1278
+ if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
1254
1279
  return await this.consumeForLocalWorker(e), !0;
1255
1280
  }
1256
1281
  async consumeForLocalWorker(e) {
1257
- var c;
1282
+ var a;
1258
1283
  const { workId: s, updateNodeOpt: o, willSyncService: r, willSerializeData: i } = e;
1259
- s === N && o && await ((c = this.localWork) == null ? void 0 : c.updateSelector({
1284
+ s === W && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
1260
1285
  updateSelectorOpt: o,
1261
1286
  willSyncService: r,
1262
1287
  willSerializeData: i,
@@ -1265,34 +1290,34 @@ class Se extends C {
1265
1290
  }));
1266
1291
  }
1267
1292
  updateSelectorCallback(e) {
1268
- const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: c } = e, { updateSelectorOpt: n, willSyncService: a } = s, p = n.workState, l = o.sp || [], m = i == null ? void 0 : i.selectRect;
1269
- if (p === W.Start)
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)
1270
1295
  return {
1271
1296
  sp: [],
1272
1297
  render: []
1273
1298
  };
1274
- if (a) {
1299
+ if (c) {
1275
1300
  l.push({
1276
- type: h.Select,
1301
+ type: p.Select,
1277
1302
  selectIds: r.selectIds,
1278
1303
  selectRect: m,
1279
1304
  willSyncService: !0,
1280
1305
  isSync: !0,
1281
- points: p === W.Done && r.getChildrenPoints() || void 0,
1306
+ points: h === T.Done && r.getChildrenPoints() || void 0,
1282
1307
  textOpt: r.textOpt
1283
1308
  });
1284
- for (const [d, w] of c.entries())
1309
+ for (const [d, w] of a.entries())
1285
1310
  w.toolsType === f.Text ? l.push({
1286
1311
  ...w,
1287
1312
  workId: d,
1288
- type: h.TextUpdate,
1313
+ type: p.TextUpdate,
1289
1314
  dataType: g.Local,
1290
1315
  willSyncService: !0
1291
1316
  }) : l.push(
1292
1317
  {
1293
1318
  ...w,
1294
1319
  workId: d,
1295
- type: h.UpdateNode,
1320
+ type: p.UpdateNode,
1296
1321
  updateNodeOpt: {
1297
1322
  useAnimation: !1
1298
1323
  },
@@ -1305,46 +1330,46 @@ class Se extends C {
1305
1330
  };
1306
1331
  }
1307
1332
  }
1308
- class ye extends C {
1333
+ class Ie extends M {
1309
1334
  constructor() {
1310
1335
  super(...arguments);
1311
- u(this, "emitEventType", T.RotateNode);
1336
+ u(this, "emitEventType", I.RotateNode);
1312
1337
  }
1313
1338
  async consume(e) {
1314
1339
  const { msgType: s, dataType: o, emitEventType: r } = e;
1315
- if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
1340
+ if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
1316
1341
  return await this.consumeForLocalWorker(e), !0;
1317
1342
  }
1318
1343
  async consumeForLocalWorker(e) {
1319
- var a;
1320
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c, emitEventType: n } = e;
1321
- s === N && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
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({
1322
1347
  updateSelectorOpt: o,
1323
1348
  willRefreshSelector: r,
1324
1349
  willSyncService: i,
1325
- willSerializeData: c,
1350
+ willSerializeData: a,
1326
1351
  emitEventType: n,
1327
1352
  isSync: !0,
1328
1353
  callback: this.updateSelectorCallback
1329
1354
  }));
1330
1355
  }
1331
1356
  updateSelectorCallback(e) {
1332
- const { param: s, postData: o, workShapeNode: r, res: i, newServiceStore: c } = e, { updateSelectorOpt: n, willSyncService: a, willSerializeData: p, isSync: l } = s, m = n.workState, d = o.sp || [], w = i == null ? void 0 : i.selectRect;
1333
- if (a) {
1334
- p && m === W.Done && d.push({
1335
- type: h.Select,
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({
1360
+ type: p.Select,
1336
1361
  selectIds: r.selectIds,
1337
1362
  selectRect: w,
1338
1363
  willSyncService: !0,
1339
1364
  isSync: l,
1340
1365
  points: r.getChildrenPoints()
1341
1366
  });
1342
- for (const [k, S] of c.entries())
1367
+ for (const [S, y] of a.entries())
1343
1368
  d.push(
1344
1369
  {
1345
- ...S,
1346
- workId: k,
1347
- type: h.UpdateNode,
1370
+ ...y,
1371
+ workId: S,
1372
+ type: p.UpdateNode,
1348
1373
  updateNodeOpt: {
1349
1374
  useAnimation: !1
1350
1375
  },
@@ -1357,55 +1382,55 @@ class ye extends C {
1357
1382
  };
1358
1383
  }
1359
1384
  }
1360
- class we extends C {
1385
+ class Te extends M {
1361
1386
  constructor() {
1362
1387
  super(...arguments);
1363
- u(this, "emitEventType", T.SetFontStyle);
1388
+ u(this, "emitEventType", I.SetFontStyle);
1364
1389
  }
1365
1390
  async consume(e) {
1366
1391
  const { msgType: s, dataType: o, emitEventType: r } = e;
1367
- if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
1392
+ if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
1368
1393
  return await this.consumeForLocalWorker(e), !0;
1369
1394
  }
1370
1395
  async consumeForLocalWorker(e) {
1371
- var a;
1372
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c, textUpdateForWoker: n } = e;
1373
- s === N && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
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({
1374
1399
  updateSelectorOpt: o,
1375
1400
  willRefreshSelector: r,
1376
1401
  willSyncService: i,
1377
- willSerializeData: c,
1402
+ willSerializeData: a,
1378
1403
  textUpdateForWoker: n,
1379
1404
  callback: this.updateSelectorCallback
1380
1405
  }));
1381
1406
  }
1382
1407
  updateSelectorCallback(e) {
1383
- const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt: p, textUpdateForWoker: l } = s, m = o.sp || [], d = c == null ? void 0 : c.selectRect;
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;
1384
1409
  if (n && m) {
1385
- p.fontSize && m.push({
1386
- type: h.Select,
1410
+ h.fontSize && m.push({
1411
+ type: p.Select,
1387
1412
  selectIds: i.selectIds,
1388
1413
  selectRect: d,
1389
1414
  willSyncService: n,
1390
- isSync: a,
1415
+ isSync: c,
1391
1416
  points: i.getChildrenPoints()
1392
1417
  });
1393
- for (const [w, k] of r.entries())
1394
- l && k.toolsType === f.Text ? m.push({
1395
- ...k,
1418
+ for (const [w, S] of r.entries())
1419
+ l && S.toolsType === f.Text ? m.push({
1420
+ ...S,
1396
1421
  workId: w,
1397
- type: h.TextUpdate,
1422
+ type: p.TextUpdate,
1398
1423
  dataType: g.Local,
1399
1424
  willSyncService: !0
1400
1425
  }) : m.push(
1401
1426
  {
1402
- ...k,
1427
+ ...S,
1403
1428
  workId: w,
1404
- type: h.UpdateNode,
1429
+ type: p.UpdateNode,
1405
1430
  updateNodeOpt: {
1406
1431
  useAnimation: !1
1407
1432
  },
1408
- isSync: a
1433
+ isSync: c
1409
1434
  }
1410
1435
  );
1411
1436
  }
@@ -1414,105 +1439,105 @@ class we extends C {
1414
1439
  };
1415
1440
  }
1416
1441
  }
1417
- class ve extends C {
1442
+ class We extends M {
1418
1443
  constructor() {
1419
1444
  super(...arguments);
1420
- u(this, "emitEventType", T.SetPoint);
1445
+ u(this, "emitEventType", I.SetPoint);
1421
1446
  }
1422
1447
  async consume(e) {
1423
1448
  const { msgType: s, dataType: o, emitEventType: r } = e;
1424
- if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
1449
+ if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
1425
1450
  return this.consumeForLocalWorker(e), !0;
1426
1451
  }
1427
1452
  async consumeForLocalWorker(e) {
1428
- var a;
1429
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c, textUpdateForWoker: n } = e;
1430
- s === N && o && await ((a = this.localWork) == null ? void 0 : a.updateSelector({
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({
1431
1456
  updateSelectorOpt: o,
1432
1457
  willRefreshSelector: r,
1433
1458
  willSyncService: i,
1434
1459
  emitEventType: this.emitEventType,
1435
- willSerializeData: c,
1460
+ willSerializeData: a,
1436
1461
  isSync: !0,
1437
1462
  textUpdateForWoker: n,
1438
1463
  callback: this.updateSelectorCallback
1439
1464
  }));
1440
1465
  }
1441
1466
  updateSelectorCallback(e) {
1442
- const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a } = s, p = o.sp || [], l = c == null ? void 0 : c.selectRect;
1443
- if (n && p) {
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) {
1444
1469
  for (const [m, d] of r.entries())
1445
- p.push(
1470
+ h.push(
1446
1471
  {
1447
1472
  ...d,
1448
1473
  workId: m,
1449
- type: h.UpdateNode,
1474
+ type: p.UpdateNode,
1450
1475
  updateNodeOpt: {
1451
1476
  useAnimation: !1
1452
1477
  },
1453
- isSync: a
1478
+ isSync: c
1454
1479
  }
1455
1480
  );
1456
- p.push({
1457
- type: h.Select,
1481
+ h.push({
1482
+ type: p.Select,
1458
1483
  selectIds: i.selectIds,
1459
1484
  selectRect: l,
1460
1485
  willSyncService: n,
1461
- isSync: a,
1486
+ isSync: c,
1462
1487
  points: i.getChildrenPoints()
1463
1488
  });
1464
1489
  }
1465
1490
  return {
1466
- sp: p
1491
+ sp: h
1467
1492
  };
1468
1493
  }
1469
1494
  }
1470
- class ge extends C {
1495
+ class Ne extends M {
1471
1496
  constructor() {
1472
1497
  super(...arguments);
1473
- u(this, "emitEventType", T.SetLock);
1498
+ u(this, "emitEventType", I.SetLock);
1474
1499
  }
1475
1500
  async consume(e) {
1476
1501
  const { msgType: s, dataType: o, emitEventType: r } = e;
1477
- if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
1502
+ if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
1478
1503
  return this.consumeForLocalWorker(e), !0;
1479
1504
  }
1480
1505
  async consumeForLocalWorker(e) {
1481
1506
  var n;
1482
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c } = e;
1483
- s === N && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1507
+ 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({
1484
1509
  updateSelectorOpt: o,
1485
1510
  willRefreshSelector: r,
1486
1511
  willSyncService: i,
1487
- willSerializeData: c,
1512
+ willSerializeData: a,
1488
1513
  callback: this.updateSelectorCallback
1489
1514
  }));
1490
1515
  }
1491
1516
  updateSelectorCallback(e) {
1492
- const { param: s, postData: o, newServiceStore: r, workShapeNode: i, res: c } = e, { willSyncService: n, isSync: a, updateSelectorOpt: p } = s, l = o.sp || [], m = c == null ? void 0 : c.selectRect;
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;
1493
1518
  if (n && l) {
1494
1519
  for (const [d, w] of r.entries())
1495
1520
  l.push(
1496
1521
  {
1497
1522
  ...w,
1498
1523
  workId: d,
1499
- type: h.UpdateNode,
1524
+ type: p.UpdateNode,
1500
1525
  updateNodeOpt: {
1501
1526
  useAnimation: !1
1502
1527
  },
1503
- isSync: a
1528
+ isSync: c
1504
1529
  }
1505
1530
  );
1506
1531
  l.push({
1507
- isLocked: p.isLocked,
1532
+ isLocked: h.isLocked,
1508
1533
  selectorColor: i.selectorColor,
1509
1534
  scaleType: i.scaleType,
1510
1535
  canRotate: i.canRotate,
1511
- type: h.Select,
1536
+ type: p.Select,
1512
1537
  selectIds: i.selectIds,
1513
1538
  selectRect: m,
1514
1539
  willSyncService: n,
1515
- isSync: a
1540
+ isSync: c
1516
1541
  });
1517
1542
  }
1518
1543
  return {
@@ -1520,40 +1545,40 @@ class ge extends C {
1520
1545
  };
1521
1546
  }
1522
1547
  }
1523
- class Ie extends C {
1548
+ class Le extends M {
1524
1549
  constructor() {
1525
1550
  super(...arguments);
1526
- u(this, "emitEventType", T.SetShapeOpt);
1551
+ u(this, "emitEventType", I.SetShapeOpt);
1527
1552
  }
1528
1553
  async consume(e) {
1529
1554
  const { msgType: s, dataType: o, emitEventType: r } = e;
1530
- if (s === h.UpdateNode && o === g.Local && r === this.emitEventType)
1555
+ if (s === p.UpdateNode && o === g.Local && r === this.emitEventType)
1531
1556
  return this.consumeForLocalWorker(e), !0;
1532
1557
  }
1533
1558
  async consumeForLocalWorker(e) {
1534
1559
  var n;
1535
- const { workId: s, updateNodeOpt: o, willRefreshSelector: r, willSyncService: i, willSerializeData: c } = e;
1536
- s === N && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1560
+ 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({
1537
1562
  updateSelectorOpt: o,
1538
1563
  willRefreshSelector: r,
1539
1564
  willSyncService: i,
1540
- willSerializeData: c,
1565
+ willSerializeData: a,
1541
1566
  callback: this.updateSelectorCallback
1542
1567
  }));
1543
1568
  }
1544
1569
  updateSelectorCallback(e) {
1545
- const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: c } = s, n = o.sp || [];
1570
+ const { param: s, postData: o, newServiceStore: r } = e, { willSyncService: i, isSync: a } = s, n = o.sp || [];
1546
1571
  if (i && n)
1547
- for (const [a, p] of r.entries())
1572
+ for (const [c, h] of r.entries())
1548
1573
  n.push(
1549
1574
  {
1550
- ...p,
1551
- workId: a,
1552
- type: h.UpdateNode,
1575
+ ...h,
1576
+ workId: c,
1577
+ type: p.UpdateNode,
1553
1578
  updateNodeOpt: {
1554
1579
  useAnimation: !1
1555
1580
  },
1556
- isSync: c
1581
+ isSync: a
1557
1582
  }
1558
1583
  );
1559
1584
  return {
@@ -1561,35 +1586,35 @@ class Ie extends C {
1561
1586
  };
1562
1587
  }
1563
1588
  }
1564
- class Te {
1589
+ class be {
1565
1590
  constructor(t) {
1566
1591
  u(this, "builders", /* @__PURE__ */ new Map());
1567
1592
  this.builders = new Map(t.map((e) => [e, this.build(e)]));
1568
1593
  }
1569
1594
  build(t) {
1570
1595
  switch (t) {
1571
- case T.TranslateNode:
1572
- return new me();
1573
- case T.ZIndexNode:
1574
- return new fe();
1575
- case T.CopyNode:
1576
- return new de();
1577
- case T.SetColorNode:
1578
- return new ue();
1579
- case T.DeleteNode:
1596
+ case I.TranslateNode:
1597
+ return new we();
1598
+ case I.ZIndexNode:
1599
+ return new ye();
1600
+ case I.CopyNode:
1580
1601
  return new ke();
1581
- case T.ScaleNode:
1602
+ case I.SetColorNode:
1582
1603
  return new Se();
1583
- case T.RotateNode:
1584
- return new ye();
1585
- case T.SetFontStyle:
1586
- return new we();
1587
- case T.SetPoint:
1604
+ case I.DeleteNode:
1588
1605
  return new ve();
1589
- case T.SetLock:
1606
+ case I.ScaleNode:
1590
1607
  return new ge();
1591
- case T.SetShapeOpt:
1608
+ case I.RotateNode:
1592
1609
  return new Ie();
1610
+ case I.SetFontStyle:
1611
+ return new Te();
1612
+ case I.SetPoint:
1613
+ return new We();
1614
+ case I.SetLock:
1615
+ return new Ne();
1616
+ case I.SetShapeOpt:
1617
+ return new Le();
1593
1618
  }
1594
1619
  }
1595
1620
  registerForMainThread(t) {
@@ -1604,7 +1629,7 @@ class Te {
1604
1629
  return !1;
1605
1630
  }
1606
1631
  }
1607
- class We {
1632
+ class Ce {
1608
1633
  constructor(t, e) {
1609
1634
  u(this, "viewId");
1610
1635
  u(this, "fullLayer");
@@ -1629,24 +1654,24 @@ class We {
1629
1654
  u(this, "cacheImages", /* @__PURE__ */ new Map());
1630
1655
  u(this, "imageResolveMap", /* @__PURE__ */ new Map());
1631
1656
  this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master;
1632
- const s = R.bufferSize.full, o = R.bufferSize.sub;
1633
- this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === M ? s : o }), this.topLayer = this.createLayer("topLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === M, o) }), this.localLayer = this.createLayer("localLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === M, o) }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === M, o) }), this.vNodes = new ie(t, this.scene);
1657
+ const s = F.bufferSize.full, o = F.bufferSize.sub;
1658
+ this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === A ? s : o * 2 }), this.topLayer = this.createLayer("topLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === A, o), contextType: "2d" }), this.localLayer = this.createLayer("localLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === A, o), contextType: "2d" }), this.serviceLayer = this.createLayer("serviceLayer", this.scene, { ...e.layerOpt, bufferSize: (this.viewId === A, o), contextType: "2d" }), this.vNodes = new le(t, this.scene);
1634
1659
  const r = {
1635
1660
  thread: this,
1636
1661
  vNodes: this.vNodes
1637
1662
  };
1638
- this.localWork = new he(r), this.serviceWork = new pe(r), this.topWork = new le(r), this.vNodes.init(this.fullLayer), this.methodBuilder = new Te([
1639
- T.CopyNode,
1640
- T.SetColorNode,
1641
- T.DeleteNode,
1642
- T.RotateNode,
1643
- T.ScaleNode,
1644
- T.TranslateNode,
1645
- T.ZIndexNode,
1646
- T.SetFontStyle,
1647
- T.SetPoint,
1648
- T.SetLock,
1649
- T.SetShapeOpt
1663
+ this.localWork = new fe(r), this.serviceWork = new me(r), this.topWork = new ue(r), this.vNodes.init(this.fullLayer), this.methodBuilder = new be([
1664
+ I.CopyNode,
1665
+ I.SetColorNode,
1666
+ I.DeleteNode,
1667
+ I.RotateNode,
1668
+ I.ScaleNode,
1669
+ I.TranslateNode,
1670
+ I.ZIndexNode,
1671
+ I.SetFontStyle,
1672
+ I.SetPoint,
1673
+ I.SetLock,
1674
+ I.SetShapeOpt
1650
1675
  ]).registerForMainThread(this);
1651
1676
  }
1652
1677
  getCachedImages(t) {
@@ -1678,26 +1703,26 @@ class We {
1678
1703
  }
1679
1704
  async on(t) {
1680
1705
  if (!await this.methodBuilder.consumeForMainThread(t)) {
1681
- const { msgType: e, toolsType: s, opt: o, dataType: r, workId: i, workState: c, imageSrc: n, imageBitmap: a, workIds: p } = t, l = i == null ? void 0 : i.toString();
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();
1682
1707
  switch (e) {
1683
- case h.UpdateDpr:
1684
- K(t.dpr) && this.updateDpr(t.dpr);
1708
+ case p.UpdateDpr:
1709
+ U(t.dpr) && this.updateDpr(t.dpr);
1685
1710
  break;
1686
- case h.AuthClear: {
1711
+ case p.AuthClear: {
1687
1712
  const { clearUids: m, localUid: d } = t;
1688
1713
  this.vNodes.setCanClearUids(m), this.vNodes.setLocalUid(d);
1689
1714
  break;
1690
1715
  }
1691
- case h.Destroy:
1716
+ case p.Destroy:
1692
1717
  this.destroy();
1693
1718
  break;
1694
- case h.Clear:
1719
+ case p.Clear:
1695
1720
  this.clearAll();
1696
1721
  break;
1697
- case h.UpdateCamera:
1722
+ case p.UpdateCamera:
1698
1723
  await this.updateCamera(t);
1699
1724
  break;
1700
- case h.UpdateTools:
1725
+ case p.UpdateTools:
1701
1726
  if (s && o) {
1702
1727
  const m = {
1703
1728
  toolsType: s,
@@ -1706,7 +1731,7 @@ class We {
1706
1731
  this.topWork.canUseTopLayer(s) ? this.topWork.setToolsOpt(m) : this.localWork.setToolsOpt(m);
1707
1732
  }
1708
1733
  break;
1709
- case h.CreateWork:
1734
+ case p.CreateWork:
1710
1735
  if (l && o && s) {
1711
1736
  if (this.topWork.canUseTopLayer(s)) {
1712
1737
  this.topWork.getToolsOpt() || this.topWork.setToolsOpt({
@@ -1721,50 +1746,50 @@ class We {
1721
1746
  }), this.localWork.setWorkOptions(l, o);
1722
1747
  }
1723
1748
  break;
1724
- case h.DrawWork:
1725
- c === W.Done && r === g.Local ? this.consumeDrawAll(r, t) : this.consumeDraw(r, t);
1749
+ case p.DrawWork:
1750
+ a === T.Done && r === g.Local ? this.consumeDrawAll(r, t) : this.consumeDraw(r, t);
1726
1751
  break;
1727
- case h.UpdateNode:
1728
- case h.FullWork:
1752
+ case p.UpdateNode:
1753
+ case p.FullWork:
1729
1754
  if (s && this.topWork.canUseTopLayer(s)) {
1730
1755
  this.consumeDrawAll(r, t);
1731
1756
  break;
1732
1757
  }
1733
1758
  this.consumeFull(r, t);
1734
1759
  break;
1735
- case h.RemoveNode:
1760
+ case p.RemoveNode:
1736
1761
  await this.removeNode(t);
1737
1762
  return;
1738
- case h.Select:
1739
- r === g.Service && (i === N ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
1763
+ case p.Select:
1764
+ r === g.Service && (i === W ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
1740
1765
  break;
1741
- case h.CursorHover:
1766
+ case p.CursorHover:
1742
1767
  this.localWork.cursorHover(t);
1743
1768
  break;
1744
- case h.GetTextActive:
1769
+ case p.GetTextActive:
1745
1770
  r === g.Local && this.localWork.checkTextActive(t);
1746
1771
  break;
1747
- case h.GetImageBitMap:
1748
- if (n && a && i) {
1772
+ case p.GetImageBitMap:
1773
+ if (n && c && i) {
1749
1774
  const m = i.toString();
1750
1775
  this.deleteCachedImagesByWorkId(m), this.cacheImages.set(n, {
1751
- imageBitmap: a,
1776
+ imageBitmap: c,
1752
1777
  workId: m
1753
1778
  });
1754
1779
  const d = this.imageResolveMap.get(n);
1755
1780
  if (d) {
1756
- const { resolve: w, timer: k } = d;
1757
- k && clearTimeout(k), w && w(n);
1781
+ const { resolve: w, timer: S } = d;
1782
+ S && clearTimeout(S), w && w(n);
1758
1783
  }
1759
1784
  }
1760
1785
  break;
1761
- case h.GetVNodeInfo:
1762
- if (i && p) {
1763
- const m = p.map((d) => this.vNodes.get(d));
1786
+ case p.GetVNodeInfo:
1787
+ if (i && h) {
1788
+ const m = h.map((d) => this.vNodes.get(d));
1764
1789
  this.post({
1765
1790
  sp: [
1766
1791
  {
1767
- type: h.GetVNodeInfo,
1792
+ type: p.GetVNodeInfo,
1768
1793
  dataType: g.Local,
1769
1794
  workId: i,
1770
1795
  vInfo: m
@@ -1783,40 +1808,40 @@ class We {
1783
1808
  async loadImageBitMap(t) {
1784
1809
  const { toolsType: e, opt: s, workId: o } = t;
1785
1810
  if (e === f.Image && s && o) {
1786
- const r = o.toString(), { src: i, type: c, width: n, height: a, strokeColor: p } = s;
1787
- if (!i || !c || !n || !a)
1811
+ const r = o.toString(), { src: i, type: a, width: n, height: c, strokeColor: h } = s;
1812
+ if (!i || !a || !n || !c)
1788
1813
  return;
1789
1814
  let l = i;
1790
- if (c === X.Iconify) {
1791
- const [k, S] = this.getIconSize(n, a, this.opt.displayer.dpr);
1792
- l = `${i}?width=${k}&height=${S}&color=${p}`;
1815
+ 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}`;
1793
1818
  }
1794
1819
  if (this.cacheImages.has(l)) {
1795
- const k = this.getCachedImages(l);
1796
- if (k)
1797
- return k;
1820
+ const S = this.getCachedImages(l);
1821
+ if (S)
1822
+ return S;
1798
1823
  }
1799
1824
  if (this.imageResolveMap.has(l)) {
1800
- const k = this.getCachedImagesByWorkId(r);
1801
- if (k)
1802
- return k;
1825
+ const S = this.getCachedImagesByWorkId(r);
1826
+ if (S)
1827
+ return S;
1803
1828
  }
1804
- const w = await new Promise((k) => {
1805
- const S = this.imageResolveMap.get(l) || {
1829
+ const w = await new Promise((S) => {
1830
+ const y = this.imageResolveMap.get(l) || {
1806
1831
  resolve: void 0,
1807
1832
  timer: void 0
1808
1833
  };
1809
- S.timer && clearTimeout(S.timer), S.resolve = k, S.timer = setTimeout(() => {
1834
+ y.timer && clearTimeout(y.timer), y.resolve = S, y.timer = setTimeout(() => {
1810
1835
  const v = this.imageResolveMap.get(l);
1811
1836
  v != null && v.resolve && v.resolve(l);
1812
- }, 5e3), this.imageResolveMap.set(l, S), this.opt.post({
1837
+ }, 5e3), this.imageResolveMap.set(l, y), this.opt.post({
1813
1838
  sp: [{
1814
1839
  imageSrc: l,
1815
1840
  workId: r,
1816
1841
  viewId: this.viewId,
1817
1842
  isgl: !!this.fullLayer.parent.gl,
1818
1843
  isSubWorker: !1,
1819
- type: h.GetImageBitMap
1844
+ type: p.GetImageBitMap
1820
1845
  }]
1821
1846
  });
1822
1847
  });
@@ -1827,7 +1852,7 @@ class We {
1827
1852
  const { dataType: e, workId: s, removeIds: o } = t, r = o || [];
1828
1853
  if (s && r.push(s.toString()), r.length)
1829
1854
  for (const i of r) {
1830
- if (i === N) {
1855
+ if (i === W) {
1831
1856
  await this.localWork.removeSelector(t);
1832
1857
  continue;
1833
1858
  }
@@ -1847,39 +1872,40 @@ class We {
1847
1872
  this.mainThreadPostId || (this.mainThreadPostId = requestAnimationFrame(this.combinePost.bind(this)));
1848
1873
  }
1849
1874
  combinePostData() {
1850
- var s;
1875
+ var o;
1851
1876
  this.mainThreadPostId = void 0;
1852
1877
  const t = [];
1853
- let e;
1854
- for (const o of this.combinePostMsg.values()) {
1855
- if ((s = o.sp) != null && s.length)
1856
- for (const r of o.sp) {
1857
- let i = !1;
1858
- for (const c of t)
1859
- if (Z(r, c)) {
1860
- i = !0;
1878
+ let e, s;
1879
+ for (const r of this.combinePostMsg.values()) {
1880
+ if ((o = r.sp) != null && o.length)
1881
+ for (const i of r.sp) {
1882
+ let a = !1;
1883
+ for (const n of t)
1884
+ if (Q(i, n)) {
1885
+ a = !0;
1861
1886
  break;
1862
1887
  }
1863
- i || t.push(r);
1888
+ a || t.push(i);
1864
1889
  }
1865
- K(o.drawCount) && (e = o.drawCount);
1890
+ U(r.drawCount) && (e = r.drawCount), U(r.consumeCount) && (s = r.consumeCount);
1866
1891
  }
1867
1892
  return this.combinePostMsg.clear(), {
1868
1893
  sp: t,
1869
- drawCount: e
1894
+ drawCount: e,
1895
+ consumeCount: s
1870
1896
  };
1871
1897
  }
1872
1898
  combinePost() {
1873
1899
  var s, o;
1874
- const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== h.None || r.isLockSentEventCursor);
1875
- e != null && e.length ? t.sp = e.map((r) => r.viewId ? r : { ...r, viewId: this.viewId }) : delete t.sp, t.drawCount === void 0 && delete t.drawCount, (t != null && t.drawCount || (o = t.sp) != null && o.length) && this.opt.post(t);
1900
+ 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);
1876
1902
  }
1877
1903
  clearAll() {
1878
1904
  this.fullLayer.children.length && (this.fullLayer.parent.children.forEach((t) => {
1879
1905
  t.name !== "viewport" && t.remove();
1880
1906
  }), this.fullLayer.removeAllChildren()), this.clearCacheImages(), this.clearImageResolveMap(), this.localWork.clearAll(), this.topWork.clearAll(), this.serviceWork.clearAll(), this.vNodes.clear(), this.post({
1881
1907
  sp: [{
1882
- type: h.Clear
1908
+ type: p.Clear
1883
1909
  }]
1884
1910
  });
1885
1911
  }
@@ -1909,10 +1935,10 @@ class We {
1909
1935
  async updateCamera(t) {
1910
1936
  var o;
1911
1937
  const { cameraOpt: e, scenePath: s } = t;
1912
- if (e && !Z(this.cameraOpt, e)) {
1938
+ if (e && !Q(this.cameraOpt, e)) {
1913
1939
  if (this.taskUpdateCameraId && (clearTimeout(this.taskUpdateCameraId), this.taskUpdateCameraId = void 0), s) {
1914
- let a = !1;
1915
- for (const [p, l] of this.localWork.getWorkShapes().entries())
1940
+ let c = !1;
1941
+ for (const [h, l] of this.localWork.getWorkShapes().entries())
1916
1942
  switch (l.toolsType) {
1917
1943
  case f.Text:
1918
1944
  case f.BitMapEraser:
@@ -1922,82 +1948,82 @@ class We {
1922
1948
  case f.LaserPen:
1923
1949
  break;
1924
1950
  default:
1925
- p !== U && p !== N && (a = !0);
1951
+ h !== G && h !== W && (c = !0);
1926
1952
  break;
1927
1953
  }
1928
- if (a) {
1954
+ if (c) {
1929
1955
  this.taskUpdateCameraId = setTimeout(() => {
1930
1956
  this.taskUpdateCameraId = void 0, this.updateCamera(t);
1931
- }, H);
1957
+ }, j);
1932
1958
  return;
1933
1959
  }
1934
1960
  }
1935
1961
  const r = /* @__PURE__ */ new Map();
1936
- for (const [a, p] of this.vNodes.getNodesByType(f.Text).entries()) {
1937
- const l = p.rect;
1938
- r.set(a, J(l));
1962
+ for (const [c, h] of this.vNodes.getNodesByType(f.Text).entries()) {
1963
+ const l = h.rect;
1964
+ r.set(c, oe(l));
1939
1965
  }
1940
1966
  const i = new Set(r.keys());
1941
- let c = !1;
1967
+ let a = !1;
1942
1968
  if (this.localWork.hasSelector()) {
1943
- const a = (o = this.localWork.getSelector()) == null ? void 0 : o.selectIds;
1944
- if (a) {
1945
- c = !0;
1946
- for (const p of a)
1947
- i.add(p);
1969
+ const c = (o = this.localWork.getSelector()) == null ? void 0 : o.selectIds;
1970
+ if (c) {
1971
+ a = !0;
1972
+ for (const h of c)
1973
+ i.add(h);
1948
1974
  }
1949
1975
  }
1950
1976
  let n = !1;
1951
1977
  if (this.serviceWork.selectorWorkShapes.size)
1952
- for (const a of this.serviceWork.selectorWorkShapes.values()) {
1953
- const p = a.selectIds;
1954
- if (p) {
1978
+ for (const c of this.serviceWork.selectorWorkShapes.values()) {
1979
+ const h = c.selectIds;
1980
+ if (h) {
1955
1981
  n = !0;
1956
- for (const l of p)
1982
+ for (const l of h)
1957
1983
  i.add(l);
1958
1984
  }
1959
1985
  }
1960
1986
  if (this.setCameraOpt(e), this.vNodes.curNodeMap.size) {
1961
1987
  this.vNodes.clearTarget(), this.vNodes.updateHighLevelNodesRect(i), this.debounceUpdateCameraId && clearTimeout(this.debounceUpdateCameraId);
1962
- for (const [a, p] of r.entries()) {
1963
- const l = this.vNodes.get(a);
1988
+ for (const [c, h] of r.entries()) {
1989
+ const l = this.vNodes.get(c);
1964
1990
  if (l) {
1965
- const m = p, d = l.rect, w = this.getSceneRect(), k = P(m, w), S = P(d, w);
1991
+ const m = h, d = l.rect, w = this.getSceneRect(), S = $(m, w), y = $(d, w);
1966
1992
  let v = !1;
1967
- if ((k !== S || m.w !== d.w || m.h !== d.h || S === q.intersect) && (v = !0), v) {
1968
- const { toolsType: I, opt: y } = l;
1969
- I === f.Text && y.workState === W.Done && this.debounceUpdateCache.add(a);
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);
1970
1996
  }
1971
1997
  }
1972
1998
  }
1973
- if (c && this.localWork.reRenderSelector(), n)
1974
- for (const [a, p] of this.serviceWork.selectorWorkShapes.entries())
1999
+ if (a && this.localWork.reRenderSelector(), n)
2000
+ for (const [c, h] of this.serviceWork.selectorWorkShapes.entries())
1975
2001
  this.serviceWork.runSelectWork({
1976
- workId: a,
1977
- selectIds: p.selectIds,
1978
- msgType: h.Select,
2002
+ workId: c,
2003
+ selectIds: h.selectIds,
2004
+ msgType: p.Select,
1979
2005
  dataType: g.Service,
1980
2006
  viewId: this.viewId
1981
2007
  });
1982
2008
  this.debounceUpdateCameraId = setTimeout(() => {
1983
- var p;
2009
+ var h;
1984
2010
  this.debounceUpdateCameraId = void 0;
1985
- const a = [];
2011
+ const c = [];
1986
2012
  for (const l of this.debounceUpdateCache.values()) {
1987
- if ((p = this.fullLayer) == null ? void 0 : p.getElementsByName(l)[0]) {
2013
+ if ((h = this.fullLayer) == null ? void 0 : h.getElementsByName(l)[0]) {
1988
2014
  const d = this.vNodes.get(l);
1989
2015
  if (d) {
1990
- const { toolsType: w, opt: k, rect: S } = d, v = this.localWork.setFullWork({
2016
+ const { toolsType: w, opt: S, rect: y } = d, v = this.localWork.setFullWork({
1991
2017
  toolsType: w,
1992
- opt: k,
2018
+ opt: S,
1993
2019
  workId: l
1994
2020
  });
1995
2021
  if (v) {
1996
- const I = this.getSceneRect(), y = P(S, I);
1997
- a.push(v.consumeServiceAsync({
2022
+ const C = this.getSceneRect(), R = $(y, C);
2023
+ c.push(v.consumeServiceAsync({
1998
2024
  isFullWork: !0,
1999
2025
  replaceId: l,
2000
- isDrawLabel: y !== q.outside
2026
+ isDrawLabel: R !== X.outside
2001
2027
  }));
2002
2028
  }
2003
2029
  }
@@ -2005,7 +2031,7 @@ class We {
2005
2031
  this.debounceUpdateCache.delete(l);
2006
2032
  }
2007
2033
  this.vNodes.updateLowLevelNodesRect(), this.vNodes.clearHighLevelIds();
2008
- }, H);
2034
+ }, j);
2009
2035
  }
2010
2036
  }
2011
2037
  }
@@ -2019,7 +2045,7 @@ class We {
2019
2045
  };
2020
2046
  }
2021
2047
  createScene(t) {
2022
- return new Y({
2048
+ return new te({
2023
2049
  displayRatio: this.opt.displayer.dpr,
2024
2050
  depth: !1,
2025
2051
  desynchronized: !0,
@@ -2030,14 +2056,14 @@ class We {
2030
2056
  });
2031
2057
  }
2032
2058
  createLayer(t, e, s) {
2033
- const { width: o, height: r } = s, i = `canvas-${t}`, c = e.layer(i, { ...s, offscreen: !1 }), n = new Q({
2059
+ const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, { ...s, offscreen: !1 }), n = new se({
2034
2060
  anchor: [0.5, 0.5],
2035
2061
  pos: [o * 0.5, r * 0.5],
2036
2062
  size: [o, r],
2037
2063
  name: "viewport",
2038
2064
  id: t
2039
2065
  });
2040
- return c.append(n), n;
2066
+ return a.append(n), n;
2041
2067
  }
2042
2068
  updateScene(t) {
2043
2069
  this.scene.attr({ ...t });
@@ -2052,7 +2078,7 @@ class We {
2052
2078
  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();
2053
2079
  }
2054
2080
  }
2055
- class Ne {
2081
+ class Oe {
2056
2082
  constructor(t, e) {
2057
2083
  u(this, "viewId");
2058
2084
  u(this, "fullLayer");
@@ -2064,7 +2090,7 @@ class Ne {
2064
2090
  u(this, "workShapes", /* @__PURE__ */ new Map());
2065
2091
  u(this, "cacheImages", /* @__PURE__ */ new Map());
2066
2092
  u(this, "imageResolveMap", /* @__PURE__ */ new Map());
2067
- this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master, this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === M ? 6e3 : 3e3 });
2093
+ this.viewId = t, this.opt = e, this.scene = this.createScene({ ...e.canvasOpt, container: e.container }), this.master = e.master, this.fullLayer = this.createLayer("fullLayer", this.scene, { ...e.layerOpt, bufferSize: this.viewId === A ? 6e3 : 3e3, contextType: "2d" });
2068
2094
  }
2069
2095
  getCachedImages(t) {
2070
2096
  var e;
@@ -2093,23 +2119,23 @@ class Ne {
2093
2119
  async on(t) {
2094
2120
  const { msgType: e, imageSrc: s, imageBitmap: o, workId: r } = t;
2095
2121
  switch (e) {
2096
- case h.Snapshot:
2122
+ case p.Snapshot:
2097
2123
  await this.getSnapshot(t), this.destroy();
2098
2124
  return;
2099
- case h.BoundingBox:
2125
+ case p.BoundingBox:
2100
2126
  await this.getBoundingRect(t), this.destroy();
2101
2127
  return;
2102
- case h.GetImageBitMap:
2128
+ case p.GetImageBitMap:
2103
2129
  if (s && o && r) {
2104
2130
  const i = r.toString();
2105
2131
  this.deleteCachedImagesByWorkId(i), this.cacheImages.set(s, {
2106
2132
  imageBitmap: o,
2107
2133
  workId: i
2108
2134
  });
2109
- const c = this.imageResolveMap.get(s);
2110
- if (c) {
2111
- const { resolve: n, timer: a } = c;
2112
- a && clearTimeout(a), n && n(s);
2135
+ const a = this.imageResolveMap.get(s);
2136
+ if (a) {
2137
+ const { resolve: n, timer: c } = a;
2138
+ c && clearTimeout(c), n && n(s);
2113
2139
  }
2114
2140
  }
2115
2141
  break;
@@ -2122,40 +2148,40 @@ class Ne {
2122
2148
  async loadImageBitMap(t) {
2123
2149
  const { toolsType: e, opt: s, workId: o } = t;
2124
2150
  if (e === f.Image && s && o) {
2125
- const r = o.toString(), { src: i, type: c, width: n, height: a, strokeColor: p } = s;
2126
- if (!i || !c || !n || !a)
2151
+ const r = o.toString(), { src: i, type: a, width: n, height: c, strokeColor: h } = s;
2152
+ if (!i || !a || !n || !c)
2127
2153
  return;
2128
2154
  let l = i;
2129
- if (c === X.Iconify) {
2130
- const [k, S] = this.getIconSize(n, a, this.opt.displayer.dpr);
2131
- l = `${i}?width=${k}&height=${S}&color=${p}`;
2155
+ 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}`;
2132
2158
  }
2133
2159
  if (this.cacheImages.has(l)) {
2134
- const k = this.getCachedImages(l);
2135
- if (k)
2136
- return k;
2160
+ const S = this.getCachedImages(l);
2161
+ if (S)
2162
+ return S;
2137
2163
  }
2138
2164
  if (this.imageResolveMap.has(l)) {
2139
- const k = this.getCachedImagesByWorkId(r);
2140
- if (k)
2141
- return k;
2165
+ const S = this.getCachedImagesByWorkId(r);
2166
+ if (S)
2167
+ return S;
2142
2168
  }
2143
- const w = await new Promise((k) => {
2144
- const S = this.imageResolveMap.get(l) || {
2169
+ const w = await new Promise((S) => {
2170
+ const y = this.imageResolveMap.get(l) || {
2145
2171
  resolve: void 0,
2146
2172
  timer: void 0
2147
2173
  };
2148
- S.timer && clearTimeout(S.timer), S.resolve = k, S.timer = setTimeout(() => {
2174
+ y.timer && clearTimeout(y.timer), y.resolve = S, y.timer = setTimeout(() => {
2149
2175
  const v = this.imageResolveMap.get(l);
2150
2176
  v != null && v.resolve && v.resolve(l);
2151
- }, 5e3), this.imageResolveMap.set(l, S), this.opt.post({
2177
+ }, 5e3), this.imageResolveMap.set(l, y), this.opt.post({
2152
2178
  sp: [{
2153
2179
  imageSrc: l,
2154
2180
  workId: r,
2155
2181
  viewId: this.viewId,
2156
2182
  isgl: !!this.fullLayer.parent.gl,
2157
2183
  isSubWorker: !0,
2158
- type: h.GetImageBitMap
2184
+ type: p.GetImageBitMap
2159
2185
  }]
2160
2186
  });
2161
2187
  });
@@ -2163,7 +2189,7 @@ class Ne {
2163
2189
  }
2164
2190
  }
2165
2191
  createWorkShapeNode(t) {
2166
- return F({ ...t, fullLayer: this.fullLayer, drawLayer: void 0 });
2192
+ return z({ ...t, fullLayer: this.fullLayer, drawLayer: void 0 });
2167
2193
  }
2168
2194
  setFullWork(t) {
2169
2195
  const { workId: e, opt: s, toolsType: o } = t;
@@ -2179,43 +2205,43 @@ class Ne {
2179
2205
  }
2180
2206
  async runFullWork(t) {
2181
2207
  var o;
2182
- const e = this.setFullWork(t), s = t.ops && A(t.ops);
2208
+ const e = this.setFullWork(t), s = t.ops && P(t.ops);
2183
2209
  if (e) {
2184
2210
  let r, i;
2185
- const c = (o = e.getWorkId()) == null ? void 0 : o.toString();
2211
+ const a = (o = e.getWorkId()) == null ? void 0 : o.toString();
2186
2212
  return e.toolsType === f.Image ? r = await e.consumeServiceAsync({
2187
2213
  isFullWork: !0,
2188
2214
  worker: this
2189
2215
  }) : e.toolsType === f.Text ? r = await e.consumeServiceAsync({
2190
2216
  isFullWork: !0,
2191
- replaceId: c,
2217
+ replaceId: a,
2192
2218
  isDrawLabel: !0
2193
2219
  }) : (r = e.consumeService({
2194
2220
  op: s,
2195
2221
  isFullWork: !0,
2196
- replaceId: c
2197
- }), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)), B(r, i);
2222
+ replaceId: a
2223
+ }), i = (t == null ? void 0 : t.updateNodeOpt) && e.updataOptService(t.updateNodeOpt)), H(r, i);
2198
2224
  }
2199
2225
  }
2200
2226
  async getSnapshot(t) {
2201
2227
  const { scenePath: e, scenes: s, cameraOpt: o, w: r, h: i } = t;
2202
2228
  if (e && s && o) {
2203
2229
  this.setCameraOpt(o);
2204
- let c;
2205
- for (const [a, p] of Object.entries(s))
2206
- if (p != null && p.type)
2207
- switch (p == null ? void 0 : p.type) {
2208
- case h.UpdateNode:
2209
- case h.FullWork: {
2210
- const { opt: l } = p, m = {
2211
- ...p,
2230
+ let a;
2231
+ for (const [c, h] of Object.entries(s))
2232
+ if (h != null && h.type)
2233
+ switch (h == null ? void 0 : h.type) {
2234
+ case p.UpdateNode:
2235
+ case p.FullWork: {
2236
+ const { opt: l } = h, m = {
2237
+ ...h,
2212
2238
  opt: l,
2213
- workId: a,
2214
- msgType: h.FullWork,
2239
+ workId: c,
2240
+ msgType: p.FullWork,
2215
2241
  dataType: g.Service,
2216
2242
  viewId: this.viewId
2217
2243
  }, d = await this.runFullWork(m);
2218
- c = B(c, d);
2244
+ a = H(a, d);
2219
2245
  break;
2220
2246
  }
2221
2247
  }
@@ -2246,7 +2272,7 @@ class Ne {
2246
2272
  const o = await this.getRectImageBitmap(this.getSceneRect(), s);
2247
2273
  o && (this.post({
2248
2274
  sp: [{
2249
- type: h.Snapshot,
2275
+ type: p.Snapshot,
2250
2276
  scenePath: e,
2251
2277
  imageBitmap: o,
2252
2278
  viewId: this.viewId
@@ -2258,25 +2284,25 @@ class Ne {
2258
2284
  if (e && s && o) {
2259
2285
  this.setCameraOpt(o);
2260
2286
  let r;
2261
- for (const [i, c] of Object.entries(s))
2262
- if (c != null && c.type)
2263
- switch (c == null ? void 0 : c.type) {
2264
- case h.UpdateNode:
2265
- case h.FullWork: {
2287
+ for (const [i, a] of Object.entries(s))
2288
+ if (a != null && a.type)
2289
+ switch (a == null ? void 0 : a.type) {
2290
+ case p.UpdateNode:
2291
+ case p.FullWork: {
2266
2292
  const n = await this.runFullWork({
2267
- ...c,
2293
+ ...a,
2268
2294
  workId: i,
2269
- msgType: h.FullWork,
2295
+ msgType: p.FullWork,
2270
2296
  dataType: g.Service,
2271
2297
  viewId: this.viewId
2272
2298
  });
2273
- r = B(r, n);
2299
+ r = H(r, n);
2274
2300
  break;
2275
2301
  }
2276
2302
  }
2277
2303
  r && this.post({
2278
2304
  sp: [{
2279
- type: h.BoundingBox,
2305
+ type: p.BoundingBox,
2280
2306
  scenePath: e,
2281
2307
  rect: r
2282
2308
  }]
@@ -2299,7 +2325,7 @@ class Ne {
2299
2325
  for (const o of s.sp) {
2300
2326
  let r = !1;
2301
2327
  for (const i of t)
2302
- if (ae(o, i)) {
2328
+ if (he(o, i)) {
2303
2329
  r = !0;
2304
2330
  break;
2305
2331
  }
@@ -2311,11 +2337,11 @@ class Ne {
2311
2337
  }
2312
2338
  combinePost() {
2313
2339
  var s, o;
2314
- const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== h.None || r.isLockSentEventCursor);
2340
+ const t = this.combinePostData(), e = (s = t.sp) == null ? void 0 : s.filter((r) => r.type !== p.None || r.isLockSentEventCursor);
2315
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);
2316
2342
  }
2317
2343
  createScene(t) {
2318
- return new Y({
2344
+ return new te({
2319
2345
  displayRatio: this.opt.displayer.dpr,
2320
2346
  depth: !1,
2321
2347
  desynchronized: !0,
@@ -2325,14 +2351,14 @@ class Ne {
2325
2351
  });
2326
2352
  }
2327
2353
  createLayer(t, e, s) {
2328
- const { width: o, height: r } = s, i = `canvas-${t}`, c = e.layer(i, s), n = new Q({
2354
+ const { width: o, height: r } = s, i = `canvas-${t}`, a = e.layer(i, s), n = new se({
2329
2355
  anchor: [0.5, 0.5],
2330
2356
  pos: [o * 0.5, r * 0.5],
2331
2357
  size: [o, r],
2332
2358
  name: "viewport",
2333
2359
  id: t
2334
2360
  });
2335
- return c.append(n), n;
2361
+ return a.append(n), n;
2336
2362
  }
2337
2363
  updateScene(t) {
2338
2364
  this.scene.attr({ ...t });
@@ -2347,7 +2373,7 @@ class Ne {
2347
2373
  this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), this.scene.remove();
2348
2374
  }
2349
2375
  }
2350
- class xe {
2376
+ class Ue {
2351
2377
  constructor(t) {
2352
2378
  u(this, "mainThreadMap", /* @__PURE__ */ new Map());
2353
2379
  u(this, "snapshotThread");
@@ -2355,61 +2381,61 @@ class xe {
2355
2381
  this.master = t;
2356
2382
  }
2357
2383
  post(t) {
2358
- const { drawCount: e, sp: s, workerTasksqueueCount: o } = t;
2359
- this.master.isBusy && G(o) && this.master.setWorkerTasksqueueCount(o), G(e) && this.master.setMaxDrawCount(e), s && this.master.collectorSyncData(s);
2384
+ const { drawCount: e, sp: s, workerTasksqueueCount: o, consumeCount: r } = t;
2385
+ 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);
2360
2386
  }
2361
2387
  destroy() {
2362
2388
  this.mainThreadMap.clear();
2363
2389
  }
2364
2390
  createMainThread(t, e) {
2365
- return new We(t, e);
2391
+ return new Ce(t, e);
2366
2392
  }
2367
2393
  createSnapshotThread(t, e) {
2368
- return new Ne(t, e);
2394
+ return new Oe(t, e);
2369
2395
  }
2370
2396
  async consume(t) {
2371
2397
  var e, s, o, r;
2372
2398
  for (const i of t.values()) {
2373
- const { msgType: c, viewId: n, tasksqueue: a, mainTasksqueueCount: p, layerOpt: l, offscreenCanvasOpt: m, cameraOpt: d, isSubWorker: w } = i;
2374
- if (c === h.Console) {
2399
+ const { msgType: a, viewId: n, tasksqueue: c, mainTasksqueueCount: h, layerOpt: l, offscreenCanvasOpt: m, cameraOpt: d, isSubWorker: w } = i;
2400
+ if (a === p.Console) {
2375
2401
  console.log(this);
2376
2402
  continue;
2377
2403
  }
2378
- if (c === h.Init) {
2379
- const S = (e = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : e.displayer, v = S == null ? void 0 : S.canvasContainerRef.current;
2380
- if (S && v && l && m) {
2381
- const I = this.createMainThread(n, {
2382
- displayer: S,
2404
+ 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;
2406
+ if (y && v && l && m) {
2407
+ const C = this.createMainThread(n, {
2408
+ displayer: y,
2383
2409
  container: v,
2384
2410
  layerOpt: l,
2385
2411
  master: this.master,
2386
2412
  canvasOpt: m,
2387
2413
  post: this.post.bind(this)
2388
2414
  });
2389
- this.mainThreadMap.set(n, I), I && d && I.setCameraOpt(d);
2415
+ this.mainThreadMap.set(n, C), C && d && C.setCameraOpt(d);
2390
2416
  }
2391
2417
  continue;
2392
2418
  }
2393
- if ((c === h.Snapshot || c === h.BoundingBox) && n === ((s = this.master.control.viewContainerManager.mainView) == null ? void 0 : s.id)) {
2394
- const S = (o = this.master.control.viewContainerManager.getView(n)) == null ? void 0 : o.displayer, v = (r = S.snapshotContainerRef) == null ? void 0 : r.current;
2395
- if (S && v && d) {
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;
2421
+ if (y && v && d) {
2396
2422
  v.style.width = `${d.width}px`, v.style.height = `${d.height}px`;
2397
- const I = {
2398
- ...V.defaultLayerOpt,
2423
+ const C = {
2424
+ ...Y.defaultLayerOpt,
2399
2425
  offscreen: !1,
2400
2426
  width: d.width,
2401
2427
  height: d.height
2402
- }, y = {
2403
- ...V.defaultScreenCanvasOpt,
2428
+ }, R = {
2429
+ ...Y.defaultScreenCanvasOpt,
2404
2430
  width: d.width,
2405
2431
  height: d.height
2406
2432
  };
2407
2433
  this.snapshotThread = this.createSnapshotThread(n, {
2408
- displayer: S,
2434
+ displayer: y,
2409
2435
  container: v,
2410
- layerOpt: I,
2436
+ layerOpt: C,
2411
2437
  master: this.master,
2412
- canvasOpt: y,
2438
+ canvasOpt: R,
2413
2439
  post: this.post.bind(this)
2414
2440
  }), this.snapshotThread.on(i).then(() => {
2415
2441
  this.snapshotThread = void 0, v.innerHTML = "", v.style.width = "", v.style.height = "";
@@ -2417,27 +2443,27 @@ class xe {
2417
2443
  continue;
2418
2444
  }
2419
2445
  }
2420
- if (c === h.GetImageBitMap && w && this.snapshotThread) {
2446
+ if (a === p.GetImageBitMap && w && this.snapshotThread) {
2421
2447
  this.snapshotThread.on(i);
2422
2448
  continue;
2423
2449
  }
2424
- if (c === h.TasksQueue && (a != null && a.size)) {
2425
- for (const [S, v] of this.mainThreadMap.entries()) {
2426
- const I = a.get(S);
2427
- I && (await v.on(I), p && this.post({ workerTasksqueueCount: p }));
2450
+ if (a === p.TasksQueue && (c != null && c.size)) {
2451
+ 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 }));
2428
2454
  }
2429
2455
  continue;
2430
2456
  }
2431
- if (n === ce) {
2432
- for (const S of this.mainThreadMap.values())
2433
- S.on(i), c === h.Destroy && this.mainThreadMap.delete(n);
2457
+ if (n === pe) {
2458
+ for (const y of this.mainThreadMap.values())
2459
+ y.on(i), a === p.Destroy && this.mainThreadMap.delete(n);
2434
2460
  continue;
2435
2461
  }
2436
- const k = this.mainThreadMap.get(n);
2437
- k && (k.on(i), c === h.Destroy && this.mainThreadMap.delete(n));
2462
+ const S = this.mainThreadMap.get(n);
2463
+ S && (S.on(i), a === p.Destroy && this.mainThreadMap.delete(n));
2438
2464
  }
2439
2465
  }
2440
2466
  }
2441
2467
  export {
2442
- xe as MainThreadManagerImpl
2468
+ Ue as MainThreadManagerImpl
2443
2469
  };