@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, g as X, t as V, a as h, f as ie, M as ue, h as C, i as Y, j as fe, C as H, k as x, l as me, m as ye, n as ke, o as Se, p as J, q as _, E as N, s as j, u as $, v as we, w as ae, x as ne, T as ee, y as te, z as ve, A as ce, G as le, B as se, F as Te, H as z, V as oe, S as Ie } from "./index-CYV4mPpp.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, g as X, t as V, a as h, f as ie, M as ue, h as D, i as Y, j as fe, C as H, k as P, l as me, m as ye, n as ke, o as Se, p as J, q as _, E as N, s as j, u as $, v as we, w as ae, x as ne, T as ee, y as te, z as ve, A as ce, G as le, B as se, F as Te, H as z, V as oe, S as Ie } from "./index-GpA_9BZu.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";
@@ -266,7 +266,7 @@ class Le {
266
266
  async updateSelector(t) {
267
267
  var S;
268
268
  const e = this.workShapes.get(
269
- C
269
+ D
270
270
  );
271
271
  if (!((S = e == null ? void 0 : e.selectIds) != null && S.length)) return;
272
272
  const { callback: s, ...o } = t, { updateSelectorOpt: r, willSerializeData: i, smoothSync: c } = o, a = await (e == null ? void 0 : e.updateSelector({
@@ -312,7 +312,7 @@ class Le {
312
312
  this.thread.localLayer,
313
313
  this.thread.localLayer.parent
314
314
  )), this.workShapes.get(
315
- C
315
+ D
316
316
  )) {
317
317
  const e = [];
318
318
  e.push({
@@ -369,7 +369,7 @@ class Le {
369
369
  updateFullSelectWork(t) {
370
370
  var o, r, i, c, a;
371
371
  const e = this.workShapes.get(
372
- C
372
+ D
373
373
  ), { selectIds: s } = t;
374
374
  if (!(s != null && s.length)) {
375
375
  this.blurSelector(t);
@@ -415,7 +415,7 @@ class Le {
415
415
  }
416
416
  async removeSelector(t) {
417
417
  const { willSyncService: e, needUndoTicker: s } = t, o = [], r = [], i = this.workShapes.get(
418
- C
418
+ D
419
419
  );
420
420
  if (!i)
421
421
  return;
@@ -478,9 +478,9 @@ class Le {
478
478
  }
479
479
  ]
480
480
  }), (o = this.thread.fullLayer) == null || o.getElementsByName(t).forEach((r) => {
481
- r.remove(), x(r, this.thread.fullLayer.parent);
481
+ r.remove(), P(r, this.thread.fullLayer.parent);
482
482
  }), this.vNodes.delete(t)), this.workShapes.has(t) && (this.thread.localLayer.getElementsByName(t).forEach((r) => {
483
- r.remove(), x(r, this.thread.localLayer.parent);
483
+ r.remove(), P(r, this.thread.localLayer.parent);
484
484
  }), this.clearWorkShapeNodeCache(t));
485
485
  }
486
486
  setFullWork(t) {
@@ -518,7 +518,7 @@ class Le {
518
518
  const o = this.setFullWork(t), r = t.ops && V(t.ops);
519
519
  if (o) {
520
520
  e && t.clearPreviewLocalWork && this.thread.localLayer.getElementsByName(e).forEach((n) => {
521
- n.remove(), x(n, this.thread.localLayer.parent);
521
+ n.remove(), P(n, this.thread.localLayer.parent);
522
522
  }), o.toolsType === y.BackgroundSVG ? o.consumeService({
523
523
  isFullWork: !0,
524
524
  replaceId: e
@@ -563,7 +563,7 @@ class Le {
563
563
  }
564
564
  async colloctEffectSelectWork(t) {
565
565
  const e = this.workShapes.get(
566
- C
566
+ D
567
567
  ), { workId: s, msgType: o } = t;
568
568
  if (e && s && e.selectIds && e.selectIds.includes(s.toString())) {
569
569
  o === h.RemoveNode ? e.selectIds = e.selectIds.filter(
@@ -611,15 +611,15 @@ class Le {
611
611
  this.reRenderSelector(t);
612
612
  }
613
613
  hasSelector() {
614
- return this.workShapes.has(C);
614
+ return this.workShapes.has(D);
615
615
  }
616
616
  getSelector() {
617
- return this.workShapes.get(C);
617
+ return this.workShapes.get(D);
618
618
  }
619
619
  reRenderSelector(t = !1) {
620
620
  var o;
621
621
  const e = this.workShapes.get(
622
- C
622
+ D
623
623
  );
624
624
  if (!e) return;
625
625
  if (e && !((o = e.selectIds) != null && o.length))
@@ -656,10 +656,10 @@ class Le {
656
656
  async blurSelector(t) {
657
657
  var o;
658
658
  const e = this.workShapes.get(
659
- C
659
+ D
660
660
  ), s = e == null ? void 0 : e.blurSelector();
661
- if (this.clearWorkShapeNodeCache(C), ((o = this.thread.fullLayer) == null ? void 0 : o.parent).children.forEach((r) => {
662
- r.name === C && r.remove();
661
+ if (this.clearWorkShapeNodeCache(D), ((o = this.thread.fullLayer) == null ? void 0 : o.parent).children.forEach((r) => {
662
+ r.name === D && r.remove();
663
663
  }), s) {
664
664
  const r = [];
665
665
  r.push({
@@ -810,7 +810,7 @@ class Le {
810
810
  dataType: g.Local
811
811
  },
812
812
  e
813
- ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== C && (this.drawWorkActiveId = a), G(i) && (this.consumeCount = i), d) {
813
+ ), this.drawWorkActiveId = void 0), !this.drawWorkActiveId && a !== D && (this.drawWorkActiveId = a), G(i) && (this.consumeCount = i), d) {
814
814
  case y.Selector: {
815
815
  const l = n.consume({
816
816
  data: t,
@@ -1149,7 +1149,7 @@ class Ne {
1149
1149
  );
1150
1150
  }
1151
1151
  async animationDraw() {
1152
- var o, r, i, c, a, n, d, l, k, S, p, f, u, v, I, L, T, E, R, F, U;
1152
+ var o, r, i, c, a, n, d, l, k, S, p, f, u, v, I, L, T, E, R, B, F;
1153
1153
  this.animationId = void 0;
1154
1154
  let t = !1;
1155
1155
  const e = /* @__PURE__ */ new Map(), s = [];
@@ -1204,9 +1204,9 @@ class Ne {
1204
1204
  (n = w.node) == null || n.consumeService({
1205
1205
  op: w.animationWorkData,
1206
1206
  isFullWork: M
1207
- }), M && (this.selectorWorkShapes.forEach((A, P) => {
1207
+ }), M && (this.selectorWorkShapes.forEach((A, U) => {
1208
1208
  var Q;
1209
- (Q = A.selectIds) != null && Q.includes(b) && (this.willRunEffectSelectorIds.add(P), this.runEffect());
1209
+ (Q = A.selectIds) != null && Q.includes(b) && (this.willRunEffectSelectorIds.add(U), this.runEffect());
1210
1210
  }), (d = w.node) == null || d.clearTmpPoints(), this.workShapes.delete(b)), w.isEnableCursor ? e.set(b, {
1211
1211
  cursorTool: _(w.toolsType),
1212
1212
  workState: O ? w.ops ? W.Done : W.Doing : W.Start,
@@ -1230,30 +1230,30 @@ class Ne {
1230
1230
  const M = 3, O = this.computNextAnimationIndex(
1231
1231
  w,
1232
1232
  M
1233
- ), A = w.isDiff ? 0 : Math.max(0, (w.animationIndex || 0) - M), P = (w.animationWorkData || []).slice(
1233
+ ), A = w.isDiff ? 0 : Math.max(0, (w.animationIndex || 0) - M), U = (w.animationWorkData || []).slice(
1234
1234
  A,
1235
1235
  O
1236
1236
  ), Q = (E = (T = w.node) == null ? void 0 : T.getWorkId()) == null ? void 0 : E.toString();
1237
1237
  if ((w.animationIndex || 0) < O || w.isDiff) {
1238
1238
  if ((R = w.node) == null || R.consumeService({
1239
- op: P,
1239
+ op: U,
1240
1240
  isFullWork: !1
1241
- }), w.animationIndex = O, w.isDiff && (w.isDiff = !1), P.length && w.isEnableCursor) {
1242
- const he = P.slice(-3, -1);
1241
+ }), w.animationIndex = O, w.isDiff && (w.isDiff = !1), U.length && w.isEnableCursor) {
1242
+ const he = U.slice(-3, -1);
1243
1243
  e.set(b, {
1244
1244
  cursorTool: _(w.toolsType),
1245
- workState: A === 0 ? W.Start : O === ((F = w.animationWorkData) == null ? void 0 : F.length) ? W.Done : W.Doing,
1245
+ workState: A === 0 ? W.Start : O === ((B = w.animationWorkData) == null ? void 0 : B.length) ? W.Done : W.Doing,
1246
1246
  op: he
1247
1247
  });
1248
1248
  }
1249
- } else w.ops && ((U = w.node) == null || U.consumeService({
1249
+ } else w.ops && ((F = w.node) == null || F.consumeService({
1250
1250
  op: w.animationWorkData || [],
1251
1251
  isFullWork: !0,
1252
1252
  replaceId: Q
1253
1253
  }), w.isDel = !0, w.isEnableCursor && e.set(b, {
1254
1254
  cursorTool: _(w.toolsType),
1255
1255
  workState: W.Done,
1256
- op: P.slice(-3, -1)
1256
+ op: U.slice(-3, -1)
1257
1257
  }));
1258
1258
  t = !0;
1259
1259
  break;
@@ -1275,8 +1275,8 @@ class Ne {
1275
1275
  });
1276
1276
  }
1277
1277
  this.selectorWorkShapes.forEach((O, A) => {
1278
- var P;
1279
- (P = O.selectIds) != null && P.includes(b) && (this.willRunEffectSelectorIds.add(A), this.runEffect());
1278
+ var U;
1279
+ (U = O.selectIds) != null && U.includes(b) && (this.willRunEffectSelectorIds.add(A), this.runEffect());
1280
1280
  }), (I = w.node) == null || I.clearTmpPoints(), this.workShapes.delete(b);
1281
1281
  }
1282
1282
  }
@@ -1360,10 +1360,10 @@ class Ne {
1360
1360
  ), 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);
1361
1361
  }
1362
1362
  removeNode(t, e) {
1363
- t.indexOf(C) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((o) => {
1364
- o.remove(), x(o, this.thread.fullLayer.parent);
1363
+ t.indexOf(D) > -1 && this.removeSelectWork(e), this.thread.fullLayer.getElementsByName(t).forEach((o) => {
1364
+ o.remove(), P(o, this.thread.fullLayer.parent);
1365
1365
  }), this.thread.serviceLayer.getElementsByName(t).forEach((o) => {
1366
- o.remove(), x(o, this.thread.serviceLayer.parent);
1366
+ o.remove(), P(o, this.thread.serviceLayer.parent);
1367
1367
  });
1368
1368
  const s = this.vNodes.get(t);
1369
1369
  s && s.toolsType === y.BackgroundSVG && this.thread.post({
@@ -1414,7 +1414,7 @@ class Ne {
1414
1414
  ), e;
1415
1415
  }
1416
1416
  }
1417
- class B {
1417
+ class x {
1418
1418
  constructor() {
1419
1419
  m(this, "localWork");
1420
1420
  m(this, "serviceWork");
@@ -1424,7 +1424,7 @@ class B {
1424
1424
  return this.threadEngine = t, this.localWork = t.localWork, this.serviceWork = t.serviceWork, this;
1425
1425
  }
1426
1426
  }
1427
- class Ee extends B {
1427
+ class Ee extends x {
1428
1428
  constructor() {
1429
1429
  super(...arguments);
1430
1430
  m(this, "emitEventType", N.CopyNode);
@@ -1440,7 +1440,7 @@ class Ee extends B {
1440
1440
  s && await ((o = this.localWork) == null ? void 0 : o.consumeFull(e));
1441
1441
  }
1442
1442
  }
1443
- class be extends B {
1443
+ class be extends x {
1444
1444
  constructor() {
1445
1445
  super(...arguments);
1446
1446
  m(this, "emitEventType", N.SetColorNode);
@@ -1462,7 +1462,7 @@ class be extends B {
1462
1462
  needUndoTicker: n,
1463
1463
  requestId: d
1464
1464
  } = e;
1465
- s === C && o && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1465
+ s === D && o && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1466
1466
  updateSelectorOpt: o,
1467
1467
  willRefreshSelector: r,
1468
1468
  willSyncService: i,
@@ -1514,7 +1514,7 @@ class be extends B {
1514
1514
  };
1515
1515
  }
1516
1516
  }
1517
- class Ce extends B {
1517
+ class Ce extends x {
1518
1518
  constructor() {
1519
1519
  super(...arguments);
1520
1520
  m(this, "emitEventType", N.ZIndexNode);
@@ -1535,7 +1535,7 @@ class Ce extends B {
1535
1535
  needUndoTicker: a,
1536
1536
  requestId: n
1537
1537
  } = e;
1538
- s === C && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1538
+ s === D && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1539
1539
  updateSelectorOpt: o,
1540
1540
  willRefreshSelector: r,
1541
1541
  willSyncService: i,
@@ -1587,7 +1587,7 @@ class Ce extends B {
1587
1587
  };
1588
1588
  }
1589
1589
  }
1590
- class De extends B {
1590
+ class De extends x {
1591
1591
  constructor() {
1592
1592
  super(...arguments);
1593
1593
  m(this, "emitEventType", N.TranslateNode);
@@ -1691,7 +1691,7 @@ class De extends B {
1691
1691
  smoothSync: d,
1692
1692
  needUndoTicker: l
1693
1693
  } = e;
1694
- 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({
1694
+ 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({
1695
1695
  updateSelectorOpt: o,
1696
1696
  willRefreshSelector: r,
1697
1697
  willSyncService: i,
@@ -1705,7 +1705,7 @@ class De extends B {
1705
1705
  })) : o.workState === W.Done && ((S = this.localWork) == null || S.vNodes.deleteLastTarget()));
1706
1706
  }
1707
1707
  }
1708
- class Re extends B {
1708
+ class Re extends x {
1709
1709
  constructor() {
1710
1710
  super(...arguments);
1711
1711
  m(this, "emitEventType", N.ScaleNode);
@@ -1795,7 +1795,7 @@ class Re extends B {
1795
1795
  smoothSync: c,
1796
1796
  needUndoTicker: a
1797
1797
  } = e;
1798
- s === C && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1798
+ s === D && o && await ((n = this.localWork) == null ? void 0 : n.updateSelector({
1799
1799
  updateSelectorOpt: o,
1800
1800
  willSyncService: r,
1801
1801
  willSerializeData: i,
@@ -1806,7 +1806,7 @@ class Re extends B {
1806
1806
  }));
1807
1807
  }
1808
1808
  }
1809
- class Oe extends B {
1809
+ class Oe extends x {
1810
1810
  constructor() {
1811
1811
  super(...arguments);
1812
1812
  m(this, "emitEventType", N.RotateNode);
@@ -1874,7 +1874,7 @@ class Oe extends B {
1874
1874
  smoothSync: n,
1875
1875
  needUndoTicker: d
1876
1876
  } = e;
1877
- s === C && o && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1877
+ s === D && o && await ((l = this.localWork) == null ? void 0 : l.updateSelector({
1878
1878
  updateSelectorOpt: o,
1879
1879
  willRefreshSelector: r,
1880
1880
  willSyncService: i,
@@ -1887,7 +1887,7 @@ class Oe extends B {
1887
1887
  }));
1888
1888
  }
1889
1889
  }
1890
- class Me extends B {
1890
+ class Me extends x {
1891
1891
  constructor() {
1892
1892
  super(...arguments);
1893
1893
  m(this, "emitEventType", N.SetFontStyle);
@@ -1908,7 +1908,7 @@ class Me extends B {
1908
1908
  textUpdateForWoker: a,
1909
1909
  requestId: n
1910
1910
  } = e;
1911
- s === C && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1911
+ s === D && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
1912
1912
  updateSelectorOpt: o,
1913
1913
  willRefreshSelector: r,
1914
1914
  willSyncService: i,
@@ -1963,7 +1963,7 @@ class Me extends B {
1963
1963
  };
1964
1964
  }
1965
1965
  }
1966
- class Ae extends B {
1966
+ class Ae extends x {
1967
1967
  constructor() {
1968
1968
  super(...arguments);
1969
1969
  m(this, "emitEventType", N.SetPoint);
@@ -2019,7 +2019,7 @@ class Ae extends B {
2019
2019
  textUpdateForWoker: a,
2020
2020
  needUndoTicker: n
2021
2021
  } = e;
2022
- s === C && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2022
+ s === D && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2023
2023
  updateSelectorOpt: o,
2024
2024
  willRefreshSelector: r,
2025
2025
  willSyncService: i,
@@ -2032,7 +2032,7 @@ class Ae extends B {
2032
2032
  }));
2033
2033
  }
2034
2034
  }
2035
- class xe extends B {
2035
+ class xe extends x {
2036
2036
  constructor() {
2037
2037
  super(...arguments);
2038
2038
  m(this, "emitEventType", N.SetLock);
@@ -2053,7 +2053,7 @@ class xe extends B {
2053
2053
  needUndoTicker: a,
2054
2054
  requestId: n
2055
2055
  } = e;
2056
- s === C && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2056
+ s === D && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2057
2057
  updateSelectorOpt: o,
2058
2058
  willRefreshSelector: r,
2059
2059
  willSyncService: i,
@@ -2106,7 +2106,7 @@ class xe extends B {
2106
2106
  };
2107
2107
  }
2108
2108
  }
2109
- class Be extends B {
2109
+ class Be extends x {
2110
2110
  constructor() {
2111
2111
  super(...arguments);
2112
2112
  m(this, "emitEventType", N.SetShapeOpt);
@@ -2127,7 +2127,7 @@ class Be extends B {
2127
2127
  needUndoTicker: a,
2128
2128
  requestId: n
2129
2129
  } = e;
2130
- s === C && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2130
+ s === D && o && await ((d = this.localWork) == null ? void 0 : d.updateSelector({
2131
2131
  updateSelectorOpt: o,
2132
2132
  willRefreshSelector: r,
2133
2133
  willSyncService: i,
@@ -2208,7 +2208,21 @@ class Fe {
2208
2208
  return !1;
2209
2209
  }
2210
2210
  }
2211
- class Ue {
2211
+ function Ue({
2212
+ subThreads: C,
2213
+ layers: t,
2214
+ scene: e,
2215
+ removeLayerTexture: s
2216
+ }) {
2217
+ for (const o of C)
2218
+ o.destroy();
2219
+ for (const o of t) {
2220
+ const r = o.parent;
2221
+ r && s(o, r), o.remove();
2222
+ }
2223
+ e.remove();
2224
+ }
2225
+ class Pe {
2212
2226
  constructor(t, e) {
2213
2227
  m(this, "viewId");
2214
2228
  m(this, "fullLayer");
@@ -2229,6 +2243,7 @@ class Ue {
2229
2243
  m(this, "debounceUpdateCameraId");
2230
2244
  m(this, "debounceUpdateCache", /* @__PURE__ */ new Set());
2231
2245
  m(this, "mainThreadPostId");
2246
+ m(this, "destroyed", !1);
2232
2247
  m(this, "combinePostMsg", /* @__PURE__ */ new Set());
2233
2248
  m(this, "methodBuilder");
2234
2249
  m(this, "cacheImages", /* @__PURE__ */ new Map());
@@ -2380,7 +2395,7 @@ class Ue {
2380
2395
  await this.removeNode(t);
2381
2396
  return;
2382
2397
  case h.Select:
2383
- r === g.Service && (i === C ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
2398
+ r === g.Service && (i === D ? this.localWork.updateFullSelectWork(t) : this.serviceWork.runSelectWork(t));
2384
2399
  break;
2385
2400
  case h.CursorBlur:
2386
2401
  this.localWork.cursorBlur();
@@ -2476,7 +2491,7 @@ class Ue {
2476
2491
  const { dataType: e, workId: s, removeIds: o } = t, r = o || [];
2477
2492
  if (s && r.push(s.toString()), r.length)
2478
2493
  for (const i of r) {
2479
- if (i === C) {
2494
+ if (i === D) {
2480
2495
  await this.localWork.removeSelector(t);
2481
2496
  continue;
2482
2497
  }
@@ -2583,7 +2598,7 @@ class Ue {
2583
2598
  case y.LaserPen:
2584
2599
  break;
2585
2600
  default:
2586
- f !== H && f !== C && p.push(`${f}:${u.toolsType}`);
2601
+ f !== H && f !== D && p.push(`${f}:${u.toolsType}`);
2587
2602
  break;
2588
2603
  }
2589
2604
  if (p.length) {
@@ -2630,8 +2645,8 @@ class Ue {
2630
2645
  const v = f, I = u.rect, L = this.getSceneRect(), T = te(v, L), E = te(I, L);
2631
2646
  let R = !1;
2632
2647
  (T !== E || v.w !== I.w || v.h !== I.h || E === ve.intersect) && (R = !0);
2633
- const { toolsType: F, opt: U } = u, b = U.eraserlines && U.eraserlines.length > 0 || !!U.eraserFaces;
2634
- (R || n && b) && (F === y.Text || b) && this.debounceUpdateCache.add(p);
2648
+ const { toolsType: B, opt: F } = u, b = F.eraserlines && F.eraserlines.length > 0 || !!F.eraserFaces;
2649
+ (R || n && b) && (B === y.Text || b) && this.debounceUpdateCache.add(p);
2635
2650
  }
2636
2651
  }
2637
2652
  if (k && this.localWork.reRenderSelector(), S)
@@ -2745,10 +2760,20 @@ class Ue {
2745
2760
  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]);
2746
2761
  }
2747
2762
  destroy() {
2748
- 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();
2763
+ this.destroyed || (this.destroyed = !0, this.clearCacheImages(), this.clearImageResolveMap(), this.vNodes.clear(), Ue({
2764
+ subThreads: [this.localWork, this.serviceWork, this.topWork],
2765
+ layers: [
2766
+ this.fullLayer,
2767
+ this.topLayer,
2768
+ this.localLayer,
2769
+ this.serviceLayer
2770
+ ],
2771
+ scene: this.scene,
2772
+ removeLayerTexture: (t, e) => P(t, e)
2773
+ }));
2749
2774
  }
2750
2775
  }
2751
- class Pe {
2776
+ class ze {
2752
2777
  constructor(t, e) {
2753
2778
  m(this, "viewId");
2754
2779
  m(this, "fullLayer");
@@ -3095,10 +3120,10 @@ class Pe {
3095
3120
  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]);
3096
3121
  }
3097
3122
  destroy() {
3098
- this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), x(this.fullLayer, this.fullLayer.parent), this.scene.remove();
3123
+ this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), P(this.fullLayer, this.fullLayer.parent), this.scene.remove();
3099
3124
  }
3100
3125
  }
3101
- class Ye {
3126
+ class Ze {
3102
3127
  constructor(t) {
3103
3128
  m(this, "mainThreadMap", /* @__PURE__ */ new Map());
3104
3129
  m(this, "cameraRenderQueueByView", /* @__PURE__ */ new Map());
@@ -3132,10 +3157,10 @@ class Ye {
3132
3157
  this.mainThreadMap.clear();
3133
3158
  }
3134
3159
  createMainThread(t, e) {
3135
- return new Ue(t, e);
3160
+ return new Pe(t, e);
3136
3161
  }
3137
3162
  createSnapshotThread(t, e) {
3138
- return new Pe(t, e);
3163
+ return new ze(t, e);
3139
3164
  }
3140
3165
  async consume(t) {
3141
3166
  var e, s, o, r;
@@ -3158,14 +3183,14 @@ class Ye {
3158
3183
  if (c === h.Init) {
3159
3184
  const L = i.viewGeneration ?? (this.viewGenerationById.get(a) || 0) + 1;
3160
3185
  await this.enqueueViewTask(a, async () => {
3161
- var U;
3186
+ var F;
3162
3187
  this.viewGenerationById.set(a, L);
3163
- const T = (U = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : U.displayer, E = T == null ? void 0 : T.canvasContainerRef.current;
3188
+ const T = (F = this.master.control.viewContainerManager.getView(a)) == null ? void 0 : F.displayer, E = T == null ? void 0 : T.canvasContainerRef.current;
3164
3189
  if (!T || !E || !k || !S) return;
3165
3190
  const R = this.mainThreadMap.get(a);
3166
3191
  R == null || R.destroy();
3167
- const F = this.createMainThread(a, { displayer: T, container: E, layerOpt: k, master: this.master, canvasOpt: S, post: this.post });
3168
- this.mainThreadMap.set(a, F), F && p && F.setCameraOpt(p), this.post({ sp: [{ type: h.Init, viewId: a, viewGeneration: L }] });
3192
+ const B = this.createMainThread(a, { displayer: T, container: E, layerOpt: k, master: this.master, canvasOpt: S, post: this.post });
3193
+ this.mainThreadMap.set(a, B), B && p && B.setCameraOpt(p), this.post({ sp: [{ type: h.Init, viewId: a, viewGeneration: L }] });
3169
3194
  });
3170
3195
  continue;
3171
3196
  }
@@ -3238,5 +3263,5 @@ class Ye {
3238
3263
  }
3239
3264
  }
3240
3265
  export {
3241
- Ye as MainThreadManagerImpl
3266
+ Ze as MainThreadManagerImpl
3242
3267
  };