@netless/appliance-plugin 1.1.39 → 1.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  var pe = Object.defineProperty;
2
- var de = (D, t, e) => t in D ? pe(D, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : D[t] = e;
3
- var m = (D, t, e) => de(D, typeof t != "symbol" ? t + "" : t, e);
4
- import { D as K, e as W, c as y, r as q, b as g, f as X, t as V, a as h, h as ie, M as ue, i as C, j as Y, k as fe, C as H, l as x, m as me, n as ye, o as ke, p as Se, q as J, s as _, E as N, u as j, v as $, w as we, x as ae, y as ne, T as ee, z as te, A as ve, B as ce, G as le, F as se, H as Te, I as z, V as oe, S as Ie } from "./index-cYVyBD7Q.mjs";
2
+ var de = (C, t, e) => t in C ? pe(C, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : C[t] = e;
3
+ var m = (C, t, e) => de(C, typeof t != "symbol" ? t + "" : t, e);
4
+ import { D as K, e as W, c as y, r as q, b as g, f as X, t as V, a as h, h as ie, M as ue, i as D, j as Y, k as fe, C as H, l as P, m as me, n as ye, o as ke, p as Se, q as J, s as _, E as N, u as j, v as $, w as we, x as ae, y as ne, T as ee, z as te, A as ve, B as ce, G as le, F as se, H as Te, I as z, V as oe, S as Ie } from "./index-rhSRO8Tb.mjs";
5
5
  import { cloneDeep as Z, xor as ge, isNumber as G, isEqual as re } from "lodash";
6
6
  import "clipper-lib";
7
7
  import "lineclip";
@@ -265,7 +265,7 @@ class Le {
265
265
  async updateSelector(t) {
266
266
  var S;
267
267
  const e = this.workShapes.get(
268
- C
268
+ D
269
269
  );
270
270
  if (!((S = e == null ? void 0 : e.selectIds) != null && S.length)) return;
271
271
  const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i, smoothSync: c } = o, a = await (e == null ? void 0 : e.updateSelector({
@@ -311,7 +311,7 @@ class Le {
311
311
  this.thread.localLayer,
312
312
  this.thread.localLayer.parent
313
313
  )), this.workShapes.get(
314
- C
314
+ D
315
315
  )) {
316
316
  const e = [];
317
317
  e.push({
@@ -368,7 +368,7 @@ class Le {
368
368
  updateFullSelectWork(t) {
369
369
  var o, r, i, c, a;
370
370
  const e = this.workShapes.get(
371
- C
371
+ D
372
372
  ), { selectIds: s } = t;
373
373
  if (!(s != null && s.length)) {
374
374
  this.blurSelector(t);
@@ -414,7 +414,7 @@ class Le {
414
414
  }
415
415
  async removeSelector(t) {
416
416
  const { willSyncService: e, needUndoTicker: s } = t, o = [], r = [], i = this.workShapes.get(
417
- C
417
+ D
418
418
  );
419
419
  if (!i)
420
420
  return;
@@ -477,9 +477,9 @@ class Le {
477
477
  }
478
478
  ]
479
479
  }), (o = this.thread.fullLayer) == null || o.getElementsByName(t).forEach((r) => {
480
- r.remove(), x(r, this.thread.fullLayer.parent);
480
+ r.remove(), P(r, this.thread.fullLayer.parent);
481
481
  }), this.vNodes.delete(t)), this.workShapes.has(t) && (this.thread.localLayer.getElementsByName(t).forEach((r) => {
482
- r.remove(), x(r, this.thread.localLayer.parent);
482
+ r.remove(), P(r, this.thread.localLayer.parent);
483
483
  }), this.clearWorkShapeNodeCache(t));
484
484
  }
485
485
  setFullWork(t) {
@@ -517,7 +517,7 @@ class Le {
517
517
  const o = this.setFullWork(t), r = t.ops && V(t.ops);
518
518
  if (o) {
519
519
  e && t.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(e).forEach((n) => {
520
- n.remove(), x(n, this.thread.localLayer.parent);
520
+ n.remove(), P(n, this.thread.localLayer.parent);
521
521
  }), o.toolsType === y.BackgroundSVG ? o.consumeService({
522
522
  isFullWork: !0,
523
523
  replaceId: e
@@ -562,7 +562,7 @@ class Le {
562
562
  }
563
563
  async colloctEffectSelectWork(t) {
564
564
  const e = this.workShapes.get(
565
- C
565
+ D
566
566
  ), { workId: s, msgType: o } = t;
567
567
  if (e && s && e.selectIds && e.selectIds.includes(s.toString())) {
568
568
  o === h.RemoveNode ? e.selectIds = e.selectIds.filter(
@@ -610,15 +610,15 @@ class Le {
610
610
  this.reRenderSelector(t);
611
611
  }
612
612
  hasSelector() {
613
- return this.workShapes.has(C);
613
+ return this.workShapes.has(D);
614
614
  }
615
615
  getSelector() {
616
- return this.workShapes.get(C);
616
+ return this.workShapes.get(D);
617
617
  }
618
618
  reRenderSelector(t = !1) {
619
619
  var o;
620
620
  const e = this.workShapes.get(
621
- C
621
+ D
622
622
  );
623
623
  if (!e) return;
624
624
  if (e && !((o = e.selectIds) != null && o.length))
@@ -655,10 +655,10 @@ class Le {
655
655
  async blurSelector(t) {
656
656
  var o;
657
657
  const e = this.workShapes.get(
658
- C
658
+ D
659
659
  ), s = e == null ? void 0 : e.blurSelector();
660
- if (this.clearWorkShapeNodeCache(C), ((o = this.thread.fullLayer) == null ? void 0 : o.parent).children.forEach((r) => {
661
- r.name === C && r.remove();
660
+ if (this.clearWorkShapeNodeCache(D), ((o = this.thread.fullLayer) == null ? void 0 : o.parent).children.forEach((r) => {
661
+ r.name === D && r.remove();
662
662
  }), s) {
663
663
  const r = [];
664
664
  r.push({
@@ -809,7 +809,7 @@ class Le {
809
809
  dataType: g.Local
810
810
  },
811
811
  e
812
- ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== C && (this.drawWorkActiveId = a), G(i) && (this.consumeCount = i), d) {
812
+ ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== D && (this.drawWorkActiveId = a), G(i) && (this.consumeCount = i), d) {
813
813
  case y.Selector: {
814
814
  const l = n.consume({
815
815
  data: t,
@@ -1148,7 +1148,7 @@ class Ne {
1148
1148
  );
1149
1149
  }
1150
1150
  async animationDraw() {
1151
- var o, r, i, c, a, n, d, l, k, S, p, f, u, v, I, L, T, E, R, F, U;
1151
+ var o, r, i, c, a, n, d, l, k, S, p, f, u, v, I, L, T, E, R, B, F;
1152
1152
  this.animationId = void 0;
1153
1153
  let t = !1;
1154
1154
  const e = /* @__PURE__ */ new Map(), s = [];
@@ -1203,9 +1203,9 @@ class Ne {
1203
1203
  (n = w.node) == null || n.consumeService({
1204
1204
  op: w.animationWorkData,
1205
1205
  isFullWork: M
1206
- }), M && (this.selectorWorkShapes.forEach((A, P) => {
1206
+ }), M && (this.selectorWorkShapes.forEach((A, U) => {
1207
1207
  var Q;
1208
- (Q = A.selectIds) != null && Q.includes(b) && (this.willRunEffectSelectorIds.add(P), this.runEffect());
1208
+ (Q = A.selectIds) != null && Q.includes(b) && (this.willRunEffectSelectorIds.add(U), this.runEffect());
1209
1209
  }), (d = w.node) == null || d.clearTmpPoints(), this.workShapes.delete(b)), w.isEnableCursor ? e.set(b, {
1210
1210
  cursorTool: _(w.toolsType),
1211
1211
  workState: O ? w.ops ? W.Done : W.Doing : W.Start,
@@ -1229,30 +1229,30 @@ class Ne {
1229
1229
  const M = 3, O = this.computNextAnimationIndex(
1230
1230
  w,
1231
1231
  M
1232
- ), A = w.isDiff ? 0 : Math.max(0, (w.animationIndex || 0) - M), P = (w.animationWorkData || []).slice(
1232
+ ), A = w.isDiff ? 0 : Math.max(0, (w.animationIndex || 0) - M), U = (w.animationWorkData || []).slice(
1233
1233
  A,
1234
1234
  O
1235
1235
  ), Q = (E = (T = w.node) == null ? void 0 : T.getWorkId()) == null ? void 0 : E.toString();
1236
1236
  if ((w.animationIndex || 0) < O || w.isDiff) {
1237
1237
  if ((R = w.node) == null || R.consumeService({
1238
- op: P,
1238
+ op: U,
1239
1239
  isFullWork: !1
1240
- }), w.animationIndex = O, w.isDiff && (w.isDiff = !1), P.length && w.isEnableCursor) {
1241
- const he = P.slice(-3, -1);
1240
+ }), w.animationIndex = O, w.isDiff && (w.isDiff = !1), U.length && w.isEnableCursor) {
1241
+ const he = U.slice(-3, -1);
1242
1242
  e.set(b, {
1243
1243
  cursorTool: _(w.toolsType),
1244
- workState: A === 0 ? W.Start : O === ((F = w.animationWorkData) == null ? void 0 : F.length) ? W.Done : W.Doing,
1244
+ workState: A === 0 ? W.Start : O === ((B = w.animationWorkData) == null ? void 0 : B.length) ? W.Done : W.Doing,
1245
1245
  op: he
1246
1246
  });
1247
1247
  }
1248
- } else w.ops && ((U = w.node) == null || U.consumeService({
1248
+ } else w.ops && ((F = w.node) == null || F.consumeService({
1249
1249
  op: w.animationWorkData || [],
1250
1250
  isFullWork: !0,
1251
1251
  replaceId: Q
1252
1252
  }), w.isDel = !0, w.isEnableCursor && e.set(b, {
1253
1253
  cursorTool: _(w.toolsType),
1254
1254
  workState: W.Done,
1255
- op: P.slice(-3, -1)
1255
+ op: U.slice(-3, -1)
1256
1256
  }));
1257
1257
  t = !0;
1258
1258
  break;
@@ -1274,8 +1274,8 @@ class Ne {
1274
1274
  });
1275
1275
  }
1276
1276
  this.selectorWorkShapes.forEach((O, A) => {
1277
- var P;
1278
- (P = O.selectIds) != null && P.includes(b) && (this.willRunEffectSelectorIds.add(A), this.runEffect());
1277
+ var U;
1278
+ (U = O.selectIds) != null && U.includes(b) && (this.willRunEffectSelectorIds.add(A), this.runEffect());
1279
1279
  }), (I = w.node) == null || I.clearTmpPoints(), this.workShapes.delete(b);
1280
1280
  }
1281
1281
  }
@@ -1359,10 +1359,10 @@ class Ne {
1359
1359
  ), u.toolsType, y.Pencil, u.animationWorkData = a), u.node && u.node.getWorkId() !== p && u.node.setWorkId(p), f && (u.oldRect = f), o && s && (s.syncUnitTime && (this.syncUnitTime = s.syncUnitTime), u.toolsType !== o && o && s && this.setNodeKey(p, u, o, s), u.node && u.node.setWorkOptions(s)), d && (u.imageBitmap = d);
1360
1360
  }
1361
1361
  removeNode(t, e) {
1362
- t.indexOf(C) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((o) => {
1363
- o.remove(), x(o, this.thread.fullLayer.parent);
1362
+ t.indexOf(D) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((o) => {
1363
+ o.remove(), P(o, this.thread.fullLayer.parent);
1364
1364
  }), this.thread.serviceLayer.getElementsByName(t).forEach((o) => {
1365
- o.remove(), x(o, this.thread.serviceLayer.parent);
1365
+ o.remove(), P(o, this.thread.serviceLayer.parent);
1366
1366
  });
1367
1367
  const s = this.vNodes.get(t);
1368
1368
  s && s.toolsType === y.BackgroundSVG && this.thread.post({
@@ -1413,7 +1413,7 @@ class Ne {
1413
1413
  ), e;
1414
1414
  }
1415
1415
  }
1416
- class B {
1416
+ class x {
1417
1417
  constructor() {
1418
1418
  m(this, "localWork");
1419
1419
  m(this, "serviceWork");
@@ -1423,7 +1423,7 @@ class B {
1423
1423
  return this.threadEngine = t, this.localWork = t.localWork, this.serviceWork = t.serviceWork, this;
1424
1424
  }
1425
1425
  }
1426
- class Ee extends B {
1426
+ class Ee extends x {
1427
1427
  constructor() {
1428
1428
  super(...arguments);
1429
1429
  m(this, "emitEventType", N.CopyNode);
@@ -1439,7 +1439,7 @@ class Ee extends B {
1439
1439
  s && await ((o = this.localWork) == null ? void 0 : o.consumeFull(e));
1440
1440
  }
1441
1441
  }
1442
- class be extends B {
1442
+ class be extends x {
1443
1443
  constructor() {
1444
1444
  super(...arguments);
1445
1445
  m(this, "emitEventType", N.SetColorNode);
@@ -1461,7 +1461,7 @@ class be extends B {
1461
1461
  needUndoTicker: n,
1462
1462
  requestId: d
1463
1463
  } = e;
1464
- s === C && o && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1464
+ s === D && o && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1465
1465
  updateSelectorOpt: o,
1466
1466
  willRefreshSelector: r,
1467
1467
  willSyncService: i,
@@ -1513,7 +1513,7 @@ class be extends B {
1513
1513
  };
1514
1514
  }
1515
1515
  }
1516
- class Ce extends B {
1516
+ class Ce extends x {
1517
1517
  constructor() {
1518
1518
  super(...arguments);
1519
1519
  m(this, "emitEventType", N.ZIndexNode);
@@ -1534,7 +1534,7 @@ class Ce extends B {
1534
1534
  needUndoTicker: a,
1535
1535
  requestId: n
1536
1536
  } = e;
1537
- s === C && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1537
+ s === D && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1538
1538
  updateSelectorOpt: o,
1539
1539
  willRefreshSelector: r,
1540
1540
  willSyncService: i,
@@ -1586,7 +1586,7 @@ class Ce extends B {
1586
1586
  };
1587
1587
  }
1588
1588
  }
1589
- class De extends B {
1589
+ class De extends x {
1590
1590
  constructor() {
1591
1591
  super(...arguments);
1592
1592
  m(this, "emitEventType", N.TranslateNode);
@@ -1690,7 +1690,7 @@ class De extends B {
1690
1690
  smoothSync: d,
1691
1691
  needUndoTicker: l
1692
1692
  } = e;
1693
- s === C && o && (o.workState === W.Done && (o != null && o.translate) && (o.translate[0] || o.translate[1]) || o.workState !== W.Done ? await ((k = this.localWork) == null ? void 0 : k.updateSelector({
1693
+ s === D && o && (o.workState === W.Done && (o != null && o.translate) && (o.translate[0] || o.translate[1]) || o.workState !== W.Done ? await ((k = this.localWork) == null ? void 0 : k.updateSelector({
1694
1694
  updateSelectorOpt: o,
1695
1695
  willRefreshSelector: r,
1696
1696
  willSyncService: i,
@@ -1704,7 +1704,7 @@ class De extends B {
1704
1704
  })) : o.workState === W.Done && ((S = this.localWork) == null || S.vNodes.deleteLastTarget()));
1705
1705
  }
1706
1706
  }
1707
- class Re extends B {
1707
+ class Re extends x {
1708
1708
  constructor() {
1709
1709
  super(...arguments);
1710
1710
  m(this, "emitEventType", N.ScaleNode);
@@ -1794,7 +1794,7 @@ class Re extends B {
1794
1794
  smoothSync: c,
1795
1795
  needUndoTicker: a
1796
1796
  } = e;
1797
- s === C && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1797
+ s === D && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1798
1798
  updateSelectorOpt: o,
1799
1799
  willSyncService: r,
1800
1800
  willSerializeData: i,
@@ -1805,7 +1805,7 @@ class Re extends B {
1805
1805
  }));
1806
1806
  }
1807
1807
  }
1808
- class Oe extends B {
1808
+ class Oe extends x {
1809
1809
  constructor() {
1810
1810
  super(...arguments);
1811
1811
  m(this, "emitEventType", N.RotateNode);
@@ -1873,7 +1873,7 @@ class Oe extends B {
1873
1873
  smoothSync: n,
1874
1874
  needUndoTicker: d
1875
1875
  } = e;
1876
- s === C && o && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1876
+ s === D && o && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1877
1877
  updateSelectorOpt: o,
1878
1878
  willRefreshSelector: r,
1879
1879
  willSyncService: i,
@@ -1886,7 +1886,7 @@ class Oe extends B {
1886
1886
  }));
1887
1887
  }
1888
1888
  }
1889
- class Me extends B {
1889
+ class Me extends x {
1890
1890
  constructor() {
1891
1891
  super(...arguments);
1892
1892
  m(this, "emitEventType", N.SetFontStyle);
@@ -1907,7 +1907,7 @@ class Me extends B {
1907
1907
  textUpdateForWoker: a,
1908
1908
  requestId: n
1909
1909
  } = e;
1910
- s === C && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1910
+ s === D && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1911
1911
  updateSelectorOpt: o,
1912
1912
  willRefreshSelector: r,
1913
1913
  willSyncService: i,
@@ -1962,7 +1962,7 @@ class Me extends B {
1962
1962
  };
1963
1963
  }
1964
1964
  }
1965
- class Ae extends B {
1965
+ class Ae extends x {
1966
1966
  constructor() {
1967
1967
  super(...arguments);
1968
1968
  m(this, "emitEventType", N.SetPoint);
@@ -2018,7 +2018,7 @@ class Ae extends B {
2018
2018
  textUpdateForWoker: a,
2019
2019
  needUndoTicker: n
2020
2020
  } = e;
2021
- s === C && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2021
+ s === D && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2022
2022
  updateSelectorOpt: o,
2023
2023
  willRefreshSelector: r,
2024
2024
  willSyncService: i,
@@ -2031,7 +2031,7 @@ class Ae extends B {
2031
2031
  }));
2032
2032
  }
2033
2033
  }
2034
- class xe extends B {
2034
+ class xe extends x {
2035
2035
  constructor() {
2036
2036
  super(...arguments);
2037
2037
  m(this, "emitEventType", N.SetLock);
@@ -2052,7 +2052,7 @@ class xe extends B {
2052
2052
  needUndoTicker: a,
2053
2053
  requestId: n
2054
2054
  } = e;
2055
- s === C && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2055
+ s === D && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2056
2056
  updateSelectorOpt: o,
2057
2057
  willRefreshSelector: r,
2058
2058
  willSyncService: i,
@@ -2105,7 +2105,7 @@ class xe extends B {
2105
2105
  };
2106
2106
  }
2107
2107
  }
2108
- class Be extends B {
2108
+ class Be extends x {
2109
2109
  constructor() {
2110
2110
  super(...arguments);
2111
2111
  m(this, "emitEventType", N.SetShapeOpt);
@@ -2126,7 +2126,7 @@ class Be extends B {
2126
2126
  needUndoTicker: a,
2127
2127
  requestId: n
2128
2128
  } = e;
2129
- s === C && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2129
+ s === D && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2130
2130
  updateSelectorOpt: o,
2131
2131
  willRefreshSelector: r,
2132
2132
  willSyncService: i,
@@ -2207,7 +2207,21 @@ class Fe {
2207
2207
  return !1;
2208
2208
  }
2209
2209
  }
2210
- class Ue {
2210
+ function Ue({
2211
+ subThreads: C,
2212
+ layers: t,
2213
+ scene: e,
2214
+ removeLayerTexture: s
2215
+ }) {
2216
+ for (const o of C)
2217
+ o.destroy();
2218
+ for (const o of t) {
2219
+ const r = o.parent;
2220
+ r && s(o, r), o.remove();
2221
+ }
2222
+ e.remove();
2223
+ }
2224
+ class Pe {
2211
2225
  constructor(t, e) {
2212
2226
  m(this, "viewId");
2213
2227
  m(this, "fullLayer");
@@ -2228,6 +2242,7 @@ class Ue {
2228
2242
  m(this, "debounceUpdateCameraId");
2229
2243
  m(this, "debounceUpdateCache", /* @__PURE__ */ new Set());
2230
2244
  m(this, "mainThreadPostId");
2245
+ m(this, "destroyed", !1);
2231
2246
  m(this, "combinePostMsg", /* @__PURE__ */ new Set());
2232
2247
  m(this, "methodBuilder");
2233
2248
  m(this, "cacheImages", /* @__PURE__ */ new Map());
@@ -2379,7 +2394,7 @@ class Ue {
2379
2394
  await this.removeNode(t);
2380
2395
  return;
2381
2396
  case h.Select:
2382
- r === g.Service && (i === C ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
2397
+ r === g.Service && (i === D ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
2383
2398
  break;
2384
2399
  case h.CursorBlur:
2385
2400
  this.localWork.cursorBlur();
@@ -2475,7 +2490,7 @@ class Ue {
2475
2490
  const { dataType: e, workId: s, removeIds: o } = t, r = o || [];
2476
2491
  if (s && r.push(s.toString()), r.length)
2477
2492
  for (const i of r) {
2478
- if (i === C) {
2493
+ if (i === D) {
2479
2494
  await this.localWork.removeSelector(t);
2480
2495
  continue;
2481
2496
  }
@@ -2582,7 +2597,7 @@ class Ue {
2582
2597
  case y.LaserPen:
2583
2598
  break;
2584
2599
  default:
2585
- f !== H && f !== C && p.push(`${f}:${u.toolsType}`);
2600
+ f !== H && f !== D && p.push(`${f}:${u.toolsType}`);
2586
2601
  break;
2587
2602
  }
2588
2603
  if (p.length) {
@@ -2629,8 +2644,8 @@ class Ue {
2629
2644
  const v = f, I = u.rect, L = this.getSceneRect(), T = te(v, L), E = te(I, L);
2630
2645
  let R = !1;
2631
2646
  (T !== E || v.w !== I.w || v.h !== I.h || E === ve.intersect) && (R = !0);
2632
- const { toolsType: F, opt: U } = u, b = U.eraserlines && U.eraserlines.length > 0 || !!U.eraserFaces;
2633
- (R || n && b) && (F === y.Text || b) && this.debounceUpdateCache.add(p);
2647
+ const { toolsType: B, opt: F } = u, b = F.eraserlines && F.eraserlines.length > 0 || !!F.eraserFaces;
2648
+ (R || n && b) && (B === y.Text || b) && this.debounceUpdateCache.add(p);
2634
2649
  }
2635
2650
  }
2636
2651
  if (k && this.localWork.reRenderSelector(), S)
@@ -2744,10 +2759,20 @@ class Ue {
2744
2759
  this.fullLayer.parent.setAttribute("width", e), this.fullLayer.parent.setAttribute("height", s), this.fullLayer.setAttribute("size", [e, s]), this.fullLayer.setAttribute("pos", [e * 0.5, s * 0.5]), this.topLayer.parent.setAttribute("width", e), this.topLayer.parent.setAttribute("height", s), this.topLayer.setAttribute("size", [e, s]), this.topLayer.setAttribute("pos", [e * 0.5, s * 0.5]), this.localLayer.parent.setAttribute("width", e), this.localLayer.parent.setAttribute("height", s), this.localLayer.setAttribute("size", [e, s]), this.localLayer.setAttribute("pos", [e * 0.5, s * 0.5]), this.serviceLayer.parent.setAttribute("width", e), this.serviceLayer.parent.setAttribute("height", s), this.serviceLayer.setAttribute("size", [e, s]), this.serviceLayer.setAttribute("pos", [e * 0.5, s * 0.5]);
2745
2760
  }
2746
2761
  destroy() {
2747
- this.clearCacheImages(), this.clearImageResolveMap(), this.vNodes.clear(), this.fullLayer.remove(), x(this.fullLayer, this.fullLayer.parent), this.topLayer.remove(), x(this.topLayer, this.topLayer.parent), this.localLayer.remove(), x(this.localLayer, this.localLayer.parent), this.serviceLayer.remove(), x(this.serviceLayer, this.serviceLayer.parent), this.scene.remove(), this.localWork.destroy(), this.serviceWork.destroy(), this.topWork.destroy();
2762
+ this.destroyed || (this.destroyed = !0, this.clearCacheImages(), this.clearImageResolveMap(), this.vNodes.clear(), Ue({
2763
+ subThreads: [this.localWork, this.serviceWork, this.topWork],
2764
+ layers: [
2765
+ this.fullLayer,
2766
+ this.topLayer,
2767
+ this.localLayer,
2768
+ this.serviceLayer
2769
+ ],
2770
+ scene: this.scene,
2771
+ removeLayerTexture: (t, e) => P(t, e)
2772
+ }));
2748
2773
  }
2749
2774
  }
2750
- class Pe {
2775
+ class ze {
2751
2776
  constructor(t, e) {
2752
2777
  m(this, "viewId");
2753
2778
  m(this, "fullLayer");
@@ -3094,10 +3119,10 @@ class Pe {
3094
3119
  this.fullLayer.parent.setAttribute("width", e), this.fullLayer.parent.setAttribute("height", s), this.fullLayer.setAttribute("size", [e, s]), this.fullLayer.setAttribute("pos", [e * 0.5, s * 0.5]);
3095
3120
  }
3096
3121
  destroy() {
3097
- this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), x(this.fullLayer, this.fullLayer.parent), this.scene.remove();
3122
+ this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), P(this.fullLayer, this.fullLayer.parent), this.scene.remove();
3098
3123
  }
3099
3124
  }
3100
- class Xe {
3125
+ class Ye {
3101
3126
  constructor(t) {
3102
3127
  m(this, "mainThreadMap", /* @__PURE__ */ new Map());
3103
3128
  m(this, "cameraRenderQueueByView", /* @__PURE__ */ new Map());
@@ -3131,10 +3156,10 @@ class Xe {
3131
3156
  this.mainThreadMap.clear();
3132
3157
  }
3133
3158
  createMainThread(t, e) {
3134
- return new Ue(t, e);
3159
+ return new Pe(t, e);
3135
3160
  }
3136
3161
  createSnapshotThread(t, e) {
3137
- return new Pe(t, e);
3162
+ return new ze(t, e);
3138
3163
  }
3139
3164
  async consume(t) {
3140
3165
  var e, s, o, r;
@@ -3157,14 +3182,14 @@ class Xe {
3157
3182
  if (c === h.Init) {
3158
3183
  const L = i.viewGeneration ?? (this.viewGenerationById.get(a) || 0) + 1;
3159
3184
  await this.enqueueViewTask(a, async () => {
3160
- var U;
3185
+ var F;
3161
3186
  this.viewGenerationById.set(a, L);
3162
- const T = (U = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : U.displayer, E = T == null ? void 0 : T.canvasContainerRef.current;
3187
+ const T = (F = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : F.displayer, E = T == null ? void 0 : T.canvasContainerRef.current;
3163
3188
  if (!T || !E || !k || !S) return;
3164
3189
  const R = this.mainThreadMap.get(a);
3165
3190
  R == null || R.destroy();
3166
- const F = this.createMainThread(a, { displayer: T, container: E, layerOpt: k, master: this.master, canvasOpt: S, post: this.post });
3167
- this.mainThreadMap.set(a, F), F && p && F.setCameraOpt(p), this.post({ sp: [{ type: h.Init, viewId: a, viewGeneration: L }] });
3191
+ const B = this.createMainThread(a, { displayer: T, container: E, layerOpt: k, master: this.master, canvasOpt: S, post: this.post });
3192
+ this.mainThreadMap.set(a, B), B && p && B.setCameraOpt(p), this.post({ sp: [{ type: h.Init, viewId: a, viewGeneration: L }] });
3168
3193
  });
3169
3194
  continue;
3170
3195
  }
@@ -3237,5 +3262,5 @@ class Xe {
3237
3262
  }
3238
3263
  }
3239
3264
  export {
3240
- Xe as MainThreadManagerImpl
3265
+ Ye as MainThreadManagerImpl
3241
3266
  };