@netless/appliance-plugin 1.0.4 → 1.0.6

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,14 +1,14 @@
1
1
  var Yo = Object.defineProperty;
2
2
  var Ro = (n, t, e) => t in n ? Yo(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var f = (n, t, e) => (Ro(n, typeof t != "symbol" ? t + "" : t, e), e);
4
- import { toJS as _i, autorun as Wo, isRoom as ae, isPlayer as ti, InvisiblePlugin as eo, RoomPhase as to } from "white-web-sdk";
3
+ var f = (n, t, e) => Ro(n, typeof t != "symbol" ? t + "" : t, e);
4
+ import { toJS as _i, autorun as Wo, isRoom as ne, isPlayer as ti, InvisiblePlugin as eo, RoomPhase as to } from "white-web-sdk";
5
5
  import "spritejs";
6
6
  import { decompress as Uo, compress as Ho } from "lz-string";
7
7
  import "lineclip";
8
8
  import io from "eventemitter2";
9
9
  import { cloneDeep as Ie, isEqual as ce, isNumber as G, isBoolean as ze, debounce as Qo, clone as fi, throttle as ve } from "lodash";
10
10
  import ii from "react-dom";
11
- import p, { useContext as fe, useState as K, useMemo as Q, useEffect as ne, useRef as it, useCallback as $o } from "react";
11
+ import p, { useContext as fe, useState as K, useMemo as Q, useEffect as se, useRef as it, useCallback as $o } from "react";
12
12
  import ot from "react-draggable";
13
13
  import { Resizable as Fo } from "re-resizable";
14
14
  const Wp = "/fullWorker.js", Up = "/subWorker.js";
@@ -54,14 +54,12 @@ class b {
54
54
  return this.x = t, this.y = e, this.z = i, this;
55
55
  }
56
56
  rot(t) {
57
- if (t === 0)
58
- return this;
57
+ if (t === 0) return this;
59
58
  const { x: e, y: i } = this, o = Math.sin(t), r = Math.cos(t);
60
59
  return this.x = e * r - i * o, this.y = e * o + i * r, this;
61
60
  }
62
61
  rotWith(t, e) {
63
- if (e === 0)
64
- return this;
62
+ if (e === 0) return this;
65
63
  const i = this.x - t.x, o = this.y - t.y, r = Math.sin(e), s = Math.cos(e);
66
64
  return this.x = t.x + (i * s - o * r), this.y = t.y + (i * r + o * s), this;
67
65
  }
@@ -293,14 +291,10 @@ class b {
293
291
  static NearestPointOnLineSegment(t, e, i, o = !0) {
294
292
  const r = b.Tan(e, t), s = b.Add(t, b.Mul(r, b.Sub(i, t).pry(r)));
295
293
  if (o) {
296
- if (s.x < Math.min(t.x, e.x))
297
- return b.Cast(t.x < e.x ? t : e);
298
- if (s.x > Math.max(t.x, e.x))
299
- return b.Cast(t.x > e.x ? t : e);
300
- if (s.y < Math.min(t.y, e.y))
301
- return b.Cast(t.y < e.y ? t : e);
302
- if (s.y > Math.max(t.y, e.y))
303
- return b.Cast(t.y > e.y ? t : e);
294
+ if (s.x < Math.min(t.x, e.x)) return b.Cast(t.x < e.x ? t : e);
295
+ if (s.x > Math.max(t.x, e.x)) return b.Cast(t.x > e.x ? t : e);
296
+ if (s.y < Math.min(t.y, e.y)) return b.Cast(t.y < e.y ? t : e);
297
+ if (s.y > Math.max(t.y, e.y)) return b.Cast(t.y > e.y ? t : e);
304
298
  }
305
299
  return s;
306
300
  }
@@ -1035,14 +1029,14 @@ function md(n) {
1035
1029
  return wd(n, vd | Nd);
1036
1030
  }
1037
1031
  var Td = md;
1038
- const Rt = /* @__PURE__ */ oo(Td), So = "1.0.4", Cd = "@netless/appliance-plugin", ko = typeof OffscreenCanvas == "function" ? "worker" : "mainThread";
1032
+ const Rt = /* @__PURE__ */ oo(Td), So = "1.0.6", Cd = "@netless/appliance-plugin", ko = typeof OffscreenCanvas == "function" ? "worker" : "mainThread";
1039
1033
  if (typeof window < "u") {
1040
1034
  let n = window.__netlessUA || "";
1041
1035
  n += ` ${Cd}@${So}_${ko}`, window.__netlessUA = n;
1042
1036
  }
1043
1037
  const Ge = {
1044
1038
  syncOpt: {
1045
- interval: 200
1039
+ interval: 500
1046
1040
  },
1047
1041
  canvasOpt: {
1048
1042
  contextType: oi.Canvas2d
@@ -1057,6 +1051,9 @@ const Ge = {
1057
1051
  bufferSize: {
1058
1052
  full: 2e4,
1059
1053
  sub: 1e3
1054
+ },
1055
+ bezier: {
1056
+ combineUnitTime: 100
1060
1057
  }
1061
1058
  };
1062
1059
  class de extends b {
@@ -2258,7 +2255,7 @@ class vg {
2258
2255
  (this.willConsumeEventWorkers.size || this.cursorInfoMap.size) && this.runAnimation();
2259
2256
  }
2260
2257
  sendEvent(t, e) {
2261
- if (this.displayer && ae(this.displayer)) {
2258
+ if (this.displayer && ne(this.displayer)) {
2262
2259
  const i = G(t[0]) && G(t[1]) && this.control.viewContainerManager.transformToScenePoint(t, e) || [void 0, void 0];
2263
2260
  this.willSendEventWorkers.push({ consumPoint: i, viewId: e }), this.sendEventTimerId || (this.sendEventTimerId = setTimeout(() => {
2264
2261
  this.dispatchMagixEvent();
@@ -2302,7 +2299,7 @@ class vg {
2302
2299
  }
2303
2300
  unabled() {
2304
2301
  var t;
2305
- this.displayer && ae(this.displayer) && (this.willSendEventWorkers.length = 0, this.displayer.dispatchMagixEvent(this.eventName, {
2302
+ this.displayer && ne(this.displayer) && (this.willSendEventWorkers.length = 0, this.displayer.dispatchMagixEvent(this.eventName, {
2306
2303
  type: mt.Cursor,
2307
2304
  op: [{ viewId: this.control.viewContainerManager.focuedViewId, consumPoint: [void 0, void 0] }],
2308
2305
  uid: (t = this.control.collector) == null ? void 0 : t.uid
@@ -2807,8 +2804,7 @@ class Cg extends De {
2807
2804
  const c = l.focusScenePath, u = [...o], h = (I = this.serviceColloctor) == null ? void 0 : I.storage, d = [], g = s === j.Start && Date.now() || void 0;
2808
2805
  for (g && this.mainEngine.internalMsgEmitter.emit("addUndoTicker", g, a); u.length; ) {
2809
2806
  const N = u.pop();
2810
- if (!N)
2811
- continue;
2807
+ if (!N) continue;
2812
2808
  const w = N.toString(), z = this.serviceColloctor.isLocalId(w), M = z && this.serviceColloctor.transformKey(N) || w;
2813
2809
  let y = w;
2814
2810
  !z && this.serviceColloctor.isOwn(y) && (y = this.serviceColloctor.getLocalId(y));
@@ -2920,25 +2916,25 @@ class jg extends De {
2920
2916
  const S = E.updateNodeOpt || {};
2921
2917
  if (S.dir = c, S.originPoint = a, S.scenePoint = l, S.workState = r, S.scale = u, S.translate = h, r === j.Start) {
2922
2918
  this.cacheTextInfo.clear();
2923
- for (const se of E.selectIds) {
2924
- const re = (y = this.serviceColloctor) == null ? void 0 : y.isLocalId(se), $ = re && ((C = this.serviceColloctor) == null ? void 0 : C.transformKey(se)) || se;
2919
+ for (const re of E.selectIds) {
2920
+ const ae = (y = this.serviceColloctor) == null ? void 0 : y.isLocalId(re), $ = ae && ((C = this.serviceColloctor) == null ? void 0 : C.transformKey(re)) || re;
2925
2921
  let q = $;
2926
- !re && ((v = this.serviceColloctor) != null && v.isOwn($)) && (q = this.serviceColloctor.getLocalId($));
2922
+ !ae && ((v = this.serviceColloctor) != null && v.isOwn($)) && (q = this.serviceColloctor.getLocalId($));
2927
2923
  const U = this.control.textEditorManager.get(q);
2928
2924
  U && r === j.Start && this.targetText.set(q, Rt(U));
2929
2925
  }
2930
2926
  }
2931
2927
  if (this.targetText.size && r !== j.Start && u) {
2932
- const se = [];
2928
+ const re = [];
2933
2929
  for (const [$, q] of this.targetText.entries()) {
2934
2930
  const { opt: U } = q, V = Math.floor(U.fontSize * u[0]), Z = this.cacheTextInfo.get($), ie = !Z && U.fontSize !== V || Z && Z.fontSize !== V || !1, B = (T = this.control.textEditorManager.get($)) == null ? void 0 : T.opt;
2935
2931
  if (ie && B && U.boxSize && U.boxPoint) {
2936
2932
  const ee = this.setTextStyle($, { ...B, fontSize: V }, s);
2937
- se.push(ee);
2933
+ re.push(ee);
2938
2934
  }
2939
2935
  }
2940
- const re = await Promise.all(se);
2941
- for (const $ of re)
2936
+ const ae = await Promise.all(re);
2937
+ for (const $ of ae)
2942
2938
  if ($) {
2943
2939
  const { key: q, textInfo: U } = $;
2944
2940
  this.cacheTextInfo.set(q, {
@@ -3216,10 +3212,10 @@ class kg extends De {
3216
3212
  if (L && R === P && ((M = L.selectIds) != null && M.length))
3217
3213
  for (const S of L.selectIds) {
3218
3214
  const te = (y = this.serviceColloctor) == null ? void 0 : y.isLocalId(S);
3219
- let se = te && ((C = this.serviceColloctor) == null ? void 0 : C.transformKey(S)) || S;
3220
- const re = g[l][h][se] || void 0;
3221
- if (!te && ((v = this.serviceColloctor) != null && v.isOwn(se)) && (se = this.serviceColloctor.getLocalId(se)), re && re.toolsType === m.Text && L.opt) {
3222
- const $ = this.setTextStyle(se, Ie(re), E, l);
3215
+ let re = te && ((C = this.serviceColloctor) == null ? void 0 : C.transformKey(S)) || S;
3216
+ const ae = g[l][h][re] || void 0;
3217
+ if (!te && ((v = this.serviceColloctor) != null && v.isOwn(re)) && (re = this.serviceColloctor.getLocalId(re)), ae && ae.toolsType === m.Text && L.opt) {
3218
+ const $ = this.setTextStyle(re, Ie(ae), E, l);
3223
3219
  w.push($);
3224
3220
  continue;
3225
3221
  }
@@ -3556,7 +3552,7 @@ class Ag extends Eg {
3556
3552
  async on() {
3557
3553
  if (!this.control.hasOffscreenCanvas()) {
3558
3554
  console.info("no OffscreenCanvas");
3559
- const { MainThreadManagerImpl: e } = await import("./index-BJWcnp2n.mjs");
3555
+ const { MainThreadManagerImpl: e } = await import("./index-D_EDUBFF.mjs");
3560
3556
  this.mainThread = new e(this);
3561
3557
  return;
3562
3558
  }
@@ -3639,8 +3635,8 @@ class Ag extends Eg {
3639
3635
  workId: E,
3640
3636
  viewId: S,
3641
3637
  dataType: te,
3642
- canLock: se,
3643
- isLocked: re,
3638
+ canLock: re,
3639
+ isLocked: ae,
3644
3640
  shapeOpt: $,
3645
3641
  toolsTypes: q,
3646
3642
  thickness: U,
@@ -3653,7 +3649,7 @@ class Ag extends Eg {
3653
3649
  switch (l) {
3654
3650
  case A.Select: {
3655
3651
  const B = c != null && c.length ? { ...h, selectIds: c, canvasHeight: z, canvasWidth: M, points: T } : void 0;
3656
- B && (u != null && u.strokeColor) && (B.selectorColor = u.strokeColor), B && x && (B.selectorColor = x), B && d && (B.strokeColor = d), B && (u != null && u.fillColor) && (B.fillColor = u.fillColor), B && g && (B.fillColor = g), B && ze(k) && (B.canRotate = k), B && Y && (B.scaleType = Y), B && v && (B.canTextEdit = v), B && R && (B.textOpt = R), B && ze(se) && (B.canLock = se), B && ze(re) && (B.isLocked = re), B && $ && (B.shapeOpt = $), B && q && (B.toolsTypes = q), B && U && (B.thickness = U), B && V && (B.strokeType = V), B && ze(Z) && (B.useStroke = Z), S && this.viewContainerManager.showFloatBar(S, !!B, B), I && ((o = this.collector) == null || o.dispatch({ type: l, selectIds: c, opt: u, isSync: N, viewId: S, scenePath: ie }));
3652
+ B && (u != null && u.strokeColor) && (B.selectorColor = u.strokeColor), B && x && (B.selectorColor = x), B && d && (B.strokeColor = d), B && (u != null && u.fillColor) && (B.fillColor = u.fillColor), B && g && (B.fillColor = g), B && ze(k) && (B.canRotate = k), B && Y && (B.scaleType = Y), B && v && (B.canTextEdit = v), B && R && (B.textOpt = R), B && ze(re) && (B.canLock = re), B && ze(ae) && (B.isLocked = ae), B && $ && (B.shapeOpt = $), B && q && (B.toolsTypes = q), B && U && (B.thickness = U), B && V && (B.strokeType = V), B && ze(Z) && (B.useStroke = Z), S && this.viewContainerManager.showFloatBar(S, !!B, B), I && ((o = this.collector) == null || o.dispatch({ type: l, selectIds: c, opt: u, isSync: N, viewId: S, scenePath: ie }));
3657
3653
  break;
3658
3654
  }
3659
3655
  case A.Snapshot:
@@ -4815,7 +4811,7 @@ const gt = class gt {
4815
4811
  (i = this.worker) == null || i.updateCamera(t, e);
4816
4812
  });
4817
4813
  const { displayer: e, plugin: i, options: o } = t;
4818
- this.plugin = i, this.room = ae(e) ? e : void 0, this.play = ti(e) ? e : void 0, this.pluginOptions = o, this.roomMember = new Ig();
4814
+ this.plugin = i, this.room = ne(e) ? e : void 0, this.play = ti(e) ? e : void 0, this.pluginOptions = o, this.roomMember = new Ig();
4819
4815
  const r = {
4820
4816
  control: this,
4821
4817
  internalMsgEmitter: gt.InternalMsgEmitter
@@ -5214,15 +5210,15 @@ const Ze = class Ze {
5214
5210
  const { scenePath: o } = t, r = t.data;
5215
5211
  if (!(!r || !this.collector))
5216
5212
  for (const L of r.values()) {
5217
- const { dataType: E, data: S, key: te } = L, se = this.collector.getStorageData(this.viewId, o), re = se && Object.keys(se) || [];
5213
+ const { dataType: E, data: S, key: te } = L, re = this.collector.getStorageData(this.viewId, o), ae = re && Object.keys(re) || [];
5218
5214
  switch (E) {
5219
5215
  case 1:
5220
- if (i = e ? this.isDrawEffectiveScene(L, re) : this.isDeleteEffectiveScene(L, re, o), i)
5216
+ if (i = e ? this.isDrawEffectiveScene(L, ae) : this.isDeleteEffectiveScene(L, ae, o), i)
5221
5217
  if (e && !Array.isArray(S)) {
5222
5218
  if ((s = S.updateNodeOpt) != null && s.useAnimation && (S.updateNodeOpt.useAnimation = !1), ((a = this.collector) == null ? void 0 : a.getLocalId(te)) === P && ((l = this.collector) != null && l.isOwn(L.key))) {
5223
5219
  const $ = S.selectIds;
5224
5220
  if ($) {
5225
- const q = re.filter((V) => {
5221
+ const q = ae.filter((V) => {
5226
5222
  var Z, ie;
5227
5223
  return ((Z = this.collector) == null ? void 0 : Z.getLocalId(V)) === P && !((ie = this.collector) != null && ie.isOwn(V));
5228
5224
  }).map((V) => {
@@ -5237,18 +5233,17 @@ const Ze = class Ze {
5237
5233
  }
5238
5234
  }
5239
5235
  (u = this.collector) == null || u.updateValue(L.key, S, { isAfterUpdate: !0, viewId: this.viewId, scenePath: o, isSync: !0 });
5240
- } else
5241
- !e && !Array.isArray(L.data) && ((h = this.collector) == null || h.updateValue(L.key, void 0, { isAfterUpdate: !0, viewId: this.viewId, scenePath: o, isSync: !0 }));
5236
+ } else !e && !Array.isArray(L.data) && ((h = this.collector) == null || h.updateValue(L.key, void 0, { isAfterUpdate: !0, viewId: this.viewId, scenePath: o, isSync: !0 }));
5242
5237
  break;
5243
5238
  case 2:
5244
- if (i = e ? this.isDeleteEffectiveScene(L, re, o) : this.isDrawEffectiveScene(L, re), i) {
5239
+ if (i = e ? this.isDeleteEffectiveScene(L, ae, o) : this.isDrawEffectiveScene(L, ae), i) {
5245
5240
  if (e && !Array.isArray(S))
5246
5241
  (d = this.collector) == null || d.updateValue(te, void 0, { isAfterUpdate: !0, viewId: this.viewId, scenePath: o, isSync: !0 });
5247
5242
  else if (!e && !Array.isArray(S)) {
5248
5243
  if ((g = S.updateNodeOpt) != null && g.useAnimation && (S.updateNodeOpt.useAnimation = !1), ((I = this.collector) == null ? void 0 : I.getLocalId(L.key)) === P && ((N = this.collector) != null && N.isOwn(L.key))) {
5249
5244
  const $ = S.selectIds;
5250
5245
  if ($) {
5251
- const q = re.filter((V) => {
5246
+ const q = ae.filter((V) => {
5252
5247
  var Z, ie;
5253
5248
  return ((Z = this.collector) == null ? void 0 : Z.getLocalId(V)) === P && !((ie = this.collector) != null && ie.isOwn(V));
5254
5249
  }).map((V) => {
@@ -5267,13 +5262,13 @@ const Ze = class Ze {
5267
5262
  }
5268
5263
  break;
5269
5264
  case 3:
5270
- if (i = e ? this.isNewEffectiveScene(L, re) : this.isOldEffectiveScene(L, re, o), i) {
5265
+ if (i = e ? this.isNewEffectiveScene(L, ae) : this.isOldEffectiveScene(L, ae, o), i) {
5271
5266
  if (e && Array.isArray(S) && S.length === 2) {
5272
5267
  const $ = S[1];
5273
5268
  if ((M = $.updateNodeOpt) != null && M.useAnimation && ($.updateNodeOpt.useAnimation = !1), ((y = this.collector) == null ? void 0 : y.getLocalId(L.key)) === P && ((C = this.collector) != null && C.isOwn(L.key))) {
5274
5269
  const q = $.selectIds;
5275
5270
  if (q) {
5276
- const U = re.filter((Z) => {
5271
+ const U = ae.filter((Z) => {
5277
5272
  var ie, B;
5278
5273
  return ((ie = this.collector) == null ? void 0 : ie.getLocalId(Z)) === P && !((B = this.collector) != null && B.isOwn(Z));
5279
5274
  }).map((Z) => {
@@ -5293,7 +5288,7 @@ const Ze = class Ze {
5293
5288
  if ((x = $.updateNodeOpt) != null && x.useAnimation && ($.updateNodeOpt.useAnimation = !1), ((k = this.collector) == null ? void 0 : k.getLocalId(L.key)) === P && ((Y = this.collector) != null && Y.isOwn(L.key))) {
5294
5289
  const q = $.selectIds;
5295
5290
  if (q) {
5296
- const U = re.filter((Z) => {
5291
+ const U = ae.filter((Z) => {
5297
5292
  var ie, B;
5298
5293
  return ((ie = this.collector) == null ? void 0 : ie.getLocalId(Z)) === P && !((B = this.collector) != null && B.isOwn(Z));
5299
5294
  }).map((Z) => {
@@ -5469,17 +5464,17 @@ class dt {
5469
5464
  for (const y of t) {
5470
5465
  const { rect: C, imageBitmap: v, isClear: T, isUnClose: x, drawCanvas: k, clearCanvas: Y, viewId: R } = y, L = (e = this.getView(R)) == null ? void 0 : e.displayer;
5471
5466
  if (L && C) {
5472
- const { dpr: E, canvasBgRef: S, canvasFloatRef: te, canvasServiceFloatRef: se, canvasTopRef: re } = L, $ = Math.floor(C.w * E), q = Math.floor(C.h * E), U = Math.ceil(C.x * E), V = Math.ceil(C.y * E);
5467
+ const { dpr: E, canvasBgRef: S, canvasFloatRef: te, canvasServiceFloatRef: re, canvasTopRef: ae } = L, $ = Math.floor(C.w * E), q = Math.floor(C.h * E), U = Math.ceil(C.x * E), V = Math.ceil(C.y * E);
5473
5468
  if (T) {
5474
5469
  switch (Y) {
5475
5470
  case Re.TopFloat:
5476
- (o = (i = re.current) == null ? void 0 : i.getContext("2d")) == null || o.clearRect(U, V, $, q);
5471
+ (o = (i = ae.current) == null ? void 0 : i.getContext("2d")) == null || o.clearRect(U, V, $, q);
5477
5472
  break;
5478
5473
  case Re.Float:
5479
5474
  (s = (r = te.current) == null ? void 0 : r.getContext("2d")) == null || s.clearRect(U, V, $, q);
5480
5475
  break;
5481
5476
  case Re.ServiceFloat:
5482
- (l = (a = se.current) == null ? void 0 : a.getContext("2d")) == null || l.clearRect(U, V, $, q);
5477
+ (l = (a = re.current) == null ? void 0 : a.getContext("2d")) == null || l.clearRect(U, V, $, q);
5483
5478
  break;
5484
5479
  case Re.Bg:
5485
5480
  (u = (c = S.current) == null ? void 0 : c.getContext("2d")) == null || u.clearRect(U, V, $, q);
@@ -5490,14 +5485,14 @@ class dt {
5490
5485
  if (k && v)
5491
5486
  switch (k) {
5492
5487
  case Re.TopFloat:
5493
- (d = (h = re.current) == null ? void 0 : h.getContext("2d")) == null || d.drawImage(v, 0, 0, $, q, U, V, $, q);
5488
+ (d = (h = ae.current) == null ? void 0 : h.getContext("2d")) == null || d.drawImage(v, 0, 0, $, q, U, V, $, q);
5494
5489
  break;
5495
5490
  case Re.Float: {
5496
5491
  (I = (g = te.current) == null ? void 0 : g.getContext("2d")) == null || I.drawImage(v, 0, 0, $, q, U, V, $, q);
5497
5492
  break;
5498
5493
  }
5499
5494
  case Re.ServiceFloat: {
5500
- (w = (N = se.current) == null ? void 0 : N.getContext("2d")) == null || w.drawImage(v, 0, 0, $, q, U, V, $, q);
5495
+ (w = (N = re.current) == null ? void 0 : N.getContext("2d")) == null || w.drawImage(v, 0, 0, $, q, U, V, $, q);
5501
5496
  break;
5502
5497
  }
5503
5498
  case Re.Bg: {
@@ -5738,8 +5733,7 @@ class Eo {
5738
5733
  }
5739
5734
  });
5740
5735
  f(this, "mousemove", (t) => {
5741
- if (!this.active)
5742
- return;
5736
+ if (!this.active) return;
5743
5737
  const e = this.getPoint(t);
5744
5738
  this.cachePoint = e, e && this.control.worker.originalEventLintener(j.Doing, e, this.viewId);
5745
5739
  });
@@ -5751,8 +5745,7 @@ class Eo {
5751
5745
  });
5752
5746
  f(this, "touchstart", (t) => {
5753
5747
  var i;
5754
- if (!this.active)
5755
- return;
5748
+ if (!this.active) return;
5756
5749
  if (!et(t)) {
5757
5750
  this.control.worker.unWritable(), this.viewId && this.control.worker.removeDrawingWork(this.viewId);
5758
5751
  return;
@@ -5766,8 +5759,7 @@ class Eo {
5766
5759
  this.cachePoint = e, e && this.control.worker.originalEventLintener(j.Start, e, this.viewId);
5767
5760
  });
5768
5761
  f(this, "touchmove", (t) => {
5769
- if (!this.active)
5770
- return;
5762
+ if (!this.active) return;
5771
5763
  if (!et(t)) {
5772
5764
  this.control.worker.unWritable(), this.viewId && this.control.worker.removeDrawingWork(this.viewId);
5773
5765
  return;
@@ -5776,8 +5768,7 @@ class Eo {
5776
5768
  this.cachePoint = e, e && this.control.worker.originalEventLintener(j.Doing, e, this.viewId);
5777
5769
  });
5778
5770
  f(this, "touchend", (t) => {
5779
- if (!this.active)
5780
- return;
5771
+ if (!this.active) return;
5781
5772
  if (!et(t) || !this.control.worker.isAbled()) {
5782
5773
  this.control.worker.removeDrawingWork(this.viewId);
5783
5774
  return;
@@ -6033,7 +6024,7 @@ const LM = (n) => {
6033
6024
  }, h = (d) => {
6034
6025
  d.stopPropagation(), d.nativeEvent.stopImmediatePropagation(), e(!t);
6035
6026
  };
6036
- return ne(() => {
6027
+ return se(() => {
6037
6028
  ce(o == null ? void 0 : o.selectIds, s) || o != null && o.selectIds && !ce(o == null ? void 0 : o.selectIds, s) && (a(o == null ? void 0 : o.selectIds), e(!1));
6038
6029
  }, [t, o, s, e]), /* @__PURE__ */ p.createElement(
6039
6030
  "div",
@@ -6069,7 +6060,7 @@ const LM = (n) => {
6069
6060
  );
6070
6061
  }, Qt = (n) => {
6071
6062
  const { opacity: t, activeColor: e, setCurOpacity: i } = n, [o, r] = K({ x: 108, y: 0 });
6072
- if (ne(() => {
6063
+ if (se(() => {
6073
6064
  r({ x: t * 100 + 8, y: 0 });
6074
6065
  }, []), !e)
6075
6066
  return null;
@@ -6129,7 +6120,7 @@ const LM = (n) => {
6129
6120
  );
6130
6121
  }, OM = (n) => {
6131
6122
  const { min: t, max: e, activeNumber: i, setActiveNumber: o, color: r } = n, [s, a] = K({ x: 108, y: 0 });
6132
- if (ne(() => {
6123
+ if (se(() => {
6133
6124
  const h = Math.ceil((i - t) / (e - t) * 100) + 8;
6134
6125
  a({ x: h, y: 0 });
6135
6126
  }, []), !i)
@@ -6242,7 +6233,7 @@ const LM = (n) => {
6242
6233
  ));
6243
6234
  }, YM = (n) => {
6244
6235
  const { open: t, setOpen: e, floatBarRef: i } = n, { floatBarData: o, floatBarColors: r, mananger: s, setFloatBarData: a } = fe(pe), [l, c] = K(), [u, h] = K(1);
6245
- ne(() => {
6236
+ se(() => {
6246
6237
  if (o != null && o.strokeColor) {
6247
6238
  const [M, y] = Ut(o.strokeColor);
6248
6239
  c(M), h(y);
@@ -6359,7 +6350,7 @@ const LM = (n) => {
6359
6350
  );
6360
6351
  }, RM = (n) => {
6361
6352
  const { open: t, setOpen: e, floatBarRef: i } = n, { floatBarData: o, floatBarColors: r, mananger: s, setFloatBarData: a } = fe(pe), [l, c] = K(), [u, h] = K(1);
6362
- ne(() => {
6353
+ se(() => {
6363
6354
  if (o != null && o.fillColor) {
6364
6355
  const [w, z] = (o == null ? void 0 : o.fillColor) === "transparent" && ["transparent", 1] || Ut(o.fillColor);
6365
6356
  c(w), h(z);
@@ -6469,7 +6460,7 @@ const LM = (n) => {
6469
6460
  );
6470
6461
  }, WM = (n) => {
6471
6462
  const { open: t, setOpen: e, textOpt: i, workIds: o, floatBarRef: r } = n, { floatBarColors: s, mananger: a, setFloatBarData: l, floatBarData: c } = fe(pe), [u, h] = K(), [d, g] = K(1);
6472
- ne(() => {
6463
+ se(() => {
6473
6464
  if (i != null && i.fontColor) {
6474
6465
  const [M, y] = (i == null ? void 0 : i.fontColor) === "transparent" && ["transparent", 0] || Ut(i.fontColor);
6475
6466
  h(M), g(y);
@@ -6561,7 +6552,7 @@ const LM = (n) => {
6561
6552
  );
6562
6553
  }, UM = (n) => {
6563
6554
  const { open: t, setOpen: e, textOpt: i, workIds: o, floatBarRef: r } = n, { floatBarColors: s, mananger: a, setFloatBarData: l, floatBarData: c } = fe(pe), [u, h] = K(), [d, g] = K(1);
6564
- ne(() => {
6555
+ se(() => {
6565
6556
  if (i != null && i.fontBgColor) {
6566
6557
  const [M, y] = (i == null ? void 0 : i.fontBgColor) === "transparent" && ["transparent", 1] || Ut(i.fontBgColor);
6567
6558
  h(M), g(y);
@@ -6749,7 +6740,7 @@ const LM = (n) => {
6749
6740
  );
6750
6741
  }, VM = (n) => {
6751
6742
  const { open: t, setOpen: e, textOpt: i, workIds: o, style: r, floatBarRef: s } = n, { mananger: a, floatBarData: l } = fe(pe), [c, u] = K("normal"), [h, d] = K("normal"), [g, I] = K(!1), [N, w] = K(!1);
6752
- ne(() => {
6743
+ se(() => {
6753
6744
  i != null && i.bold && u(i.bold), ze(i == null ? void 0 : i.underline) && I(i.underline || !1), ze(i == null ? void 0 : i.lineThrough) && w(i.lineThrough || !1), i != null && i.italic && d(i.italic);
6754
6745
  }, [i]);
6755
6746
  const z = Q(() => {
@@ -6848,7 +6839,7 @@ const LM = (n) => {
6848
6839
  );
6849
6840
  }, ZM = (n) => {
6850
6841
  const t = it(null), { open: e, setOpen: i, textOpt: o, workIds: r, floatBarRef: s } = n, { mananger: a, floatBarData: l } = fe(pe), [c, u] = K(0), [h, d] = K(), g = ke.length - 1;
6851
- ne(() => {
6842
+ se(() => {
6852
6843
  o != null && o.fontSize && (u(o.fontSize), t.current && (t.current.value = o.fontSize.toString()));
6853
6844
  }, [o == null ? void 0 : o.fontSize]);
6854
6845
  const I = Q(() => {
@@ -6875,7 +6866,7 @@ const LM = (n) => {
6875
6866
  }, z = Q(() => e ? /* @__PURE__ */ p.createElement(BM, { onClickHandler: w, style: I }) : null, [e, w, I]), M = (y) => {
6876
6867
  y > ke[g] && (y = ke[g]), y < ke[0] && (y = ke[0]), N(y);
6877
6868
  };
6878
- return ne(() => () => {
6869
+ return se(() => () => {
6879
6870
  a != null && a.control.room && ze(h) && (a.control.room.disableDeviceInputs = h);
6880
6871
  }, [a, h]), /* @__PURE__ */ p.createElement(
6881
6872
  "div",
@@ -6975,7 +6966,7 @@ const LM = (n) => {
6975
6966
  const { icon: t, min: e, max: i, step: o, value: r, onInputHandler: s } = n, [a, l] = K(0), c = it(null), u = (h) => {
6976
6967
  h > i && (h = i), h < e && (h = e), l(h), s(h), c.current && (c.current.value = h.toString());
6977
6968
  };
6978
- return ne(() => {
6969
+ return se(() => {
6979
6970
  r && (l(r), c.current && (c.current.value = r.toString()));
6980
6971
  }, [r]), /* @__PURE__ */ p.createElement(
6981
6972
  "div",
@@ -7049,7 +7040,7 @@ const LM = (n) => {
7049
7040
  return /* @__PURE__ */ p.createElement("div", { className: "button input-button" }, /* @__PURE__ */ p.createElement("img", { src: me(t) }), /* @__PURE__ */ p.createElement(KM, { min: e, max: i, step: o, value: r, onInputHandler: s }));
7050
7041
  }, KM = (n) => {
7051
7042
  const { value: t, min: e, max: i, onInputHandler: o } = n, [r, s] = K({ x: 0, y: 0 });
7052
- ne(() => {
7043
+ se(() => {
7053
7044
  s({ x: t * 100, y: 0 });
7054
7045
  }, []);
7055
7046
  const a = ve((u, h) => {
@@ -7102,7 +7093,7 @@ const LM = (n) => {
7102
7093
  return g.top = "inherit", g.bottom = 50, g;
7103
7094
  }
7104
7095
  }, [o]);
7105
- ne(() => {
7096
+ se(() => {
7106
7097
  e && (s(qe.indexOf(e)), c.current && (c.current.value = e));
7107
7098
  }, [e]);
7108
7099
  const d = Q(() => a ? /* @__PURE__ */ p.createElement(XM, { options: qe, onClickHandler: u, style: h }) : null, [a, u, h]);
@@ -7241,7 +7232,7 @@ const LM = (n) => {
7241
7232
  return /* @__PURE__ */ p.createElement("div", { className: `button tab-button ${e ? "active" : ""}`, onClick: i, onTouchEnd: o }, /* @__PURE__ */ p.createElement("img", { src: me(t) }));
7242
7233
  }, ip = (n) => {
7243
7234
  const { toolsTypes: t, style: e, mananger: i, shapeOpt: o } = n, [r, s] = K();
7244
- ne(() => {
7235
+ se(() => {
7245
7236
  t.includes(m.Polygon) ? s(m.Polygon) : t.includes(m.Star) ? s(m.Star) : s(m.SpeechBalloon);
7246
7237
  }, [t]);
7247
7238
  const a = (h, d) => {
@@ -7275,9 +7266,9 @@ const LM = (n) => {
7275
7266
  }, N = (w) => {
7276
7267
  w.stopPropagation(), w.nativeEvent.stopImmediatePropagation(), e(!t);
7277
7268
  };
7278
- return ne(() => {
7269
+ return se(() => {
7279
7270
  ce(s == null ? void 0 : s.selectIds, l) || s != null && s.selectIds && !ce(s == null ? void 0 : s.selectIds, l) && (c(s == null ? void 0 : s.selectIds), e(!1));
7280
- }, [t, s, l, e]), ne(() => () => {
7271
+ }, [t, s, l, e]), se(() => () => {
7281
7272
  t && a != null && a.control.room && ze(u) && (a.control.room.disableDeviceInputs = u);
7282
7273
  }, [t, a, u]), /* @__PURE__ */ p.createElement(
7283
7274
  "div",
@@ -7294,7 +7285,7 @@ const LM = (n) => {
7294
7285
  0
7295
7286
  /* none */
7296
7287
  ), [c, u] = p.useState(), h = it(null);
7297
- ne(() => {
7288
+ se(() => {
7298
7289
  var k, Y, R, L;
7299
7290
  const v = {}, T = (r == null ? void 0 : r.w) || ((k = t == null ? void 0 : t.boxSize) == null ? void 0 : k[0]) || 0, x = (r == null ? void 0 : r.h) || ((Y = t == null ? void 0 : t.boxSize) == null ? void 0 : Y[1]) || 0;
7300
7291
  if (o && T && x && (s != null && s.width) && (s != null && s.height)) {
@@ -7403,8 +7394,8 @@ const LM = (n) => {
7403
7394
  if (r.text) {
7404
7395
  const S = Wt(r.text);
7405
7396
  for (let te = 0; te < S.length; te++) {
7406
- const se = S[te];
7407
- se === "" ? E.push(/* @__PURE__ */ p.createElement("div", { style: { backgroundColor: r.fontBgColor }, key: te }, /* @__PURE__ */ p.createElement("br", null))) : E.push(/* @__PURE__ */ p.createElement("div", { style: { backgroundColor: r.fontBgColor }, key: te }, se));
7397
+ const re = S[te];
7398
+ re === "" ? E.push(/* @__PURE__ */ p.createElement("div", { style: { backgroundColor: r.fontBgColor }, key: te }, /* @__PURE__ */ p.createElement("br", null))) : E.push(/* @__PURE__ */ p.createElement("div", { style: { backgroundColor: r.fontBgColor }, key: te }, re));
7408
7399
  }
7409
7400
  }
7410
7401
  return E.length ? E : null;
@@ -7435,7 +7426,7 @@ const LM = (n) => {
7435
7426
  }, sp = p.memo(
7436
7427
  (n) => {
7437
7428
  const { data: t, left: e, top: i, workId: o, updateOptInfo: r } = n, { opt: s, scale: a, translate: l } = t, c = it(null);
7438
- ne(() => {
7429
+ se(() => {
7439
7430
  var Y, R;
7440
7431
  if ((Y = c.current) != null && Y.offsetWidth && ((R = c.current) != null && R.offsetHeight)) {
7441
7432
  const L = s.boxSize;
@@ -7543,7 +7534,7 @@ const LM = (n) => {
7543
7534
  transform: ee,
7544
7535
  transformOrigin: "left top"
7545
7536
  };
7546
- }, [g, I, N, w]), se = Q(() => {
7537
+ }, [g, I, N, w]), re = Q(() => {
7547
7538
  var ee, oe;
7548
7539
  return !i && g && o && G(N) && G(w) && d.boxSize && G((ee = d.boxSize) == null ? void 0 : ee[0]) && G((oe = d.boxSize) == null ? void 0 : oe[1]) ? /* @__PURE__ */ p.createElement(
7549
7540
  "div",
@@ -7558,7 +7549,7 @@ const LM = (n) => {
7558
7549
  },
7559
7550
  /* @__PURE__ */ p.createElement(Oo, { position: { x: N, y: w }, textOpt: d, workIds: [e], noLayer: !0 })
7560
7551
  ) : null;
7561
- }, [i, d, o, e, N, w, g]), re = Q(() => {
7552
+ }, [i, d, o, e, N, w, g]), ae = Q(() => {
7562
7553
  let ee = "";
7563
7554
  if (d.text) {
7564
7555
  const oe = Wt(d.text);
@@ -7569,7 +7560,7 @@ const LM = (n) => {
7569
7560
  } else
7570
7561
  ee = `<div style="background-color:${d.fontBgColor}"></div>`;
7571
7562
  return ee;
7572
- }, [d.fontBgColor, d.text]), $ = Q(() => typeof re == "string" ? /* @__PURE__ */ p.createElement(
7563
+ }, [d.fontBgColor, d.text]), $ = Q(() => typeof ae == "string" ? /* @__PURE__ */ p.createElement(
7573
7564
  "div",
7574
7565
  {
7575
7566
  id: e,
@@ -7585,10 +7576,10 @@ const LM = (n) => {
7585
7576
  onFocus: s,
7586
7577
  onPaste: ie,
7587
7578
  onInput: B,
7588
- dangerouslySetInnerHTML: { __html: re }
7579
+ dangerouslySetInnerHTML: { __html: ae }
7589
7580
  }
7590
- ) : null, [re, S, e]);
7591
- ne(() => {
7581
+ ) : null, [ae, S, e]);
7582
+ se(() => {
7592
7583
  $ && E.current && (E.current.click(), setTimeout(() => {
7593
7584
  var ee;
7594
7585
  if (E.current) {
@@ -7599,7 +7590,7 @@ const LM = (n) => {
7599
7590
  }
7600
7591
  }
7601
7592
  }, 20));
7602
- }, [$, E.current]), ne(() => {
7593
+ }, [$, E.current]), se(() => {
7603
7594
  var ee, oe, X, he;
7604
7595
  if ($ && ((ee = E.current) != null && ee.offsetWidth || (oe = E.current) != null && oe.offsetHeight || (X = E.current) != null && X.offsetLeft || (he = E.current) != null && he.offsetTop)) {
7605
7596
  const ye = [E.current.offsetWidth, E.current.offsetHeight];
@@ -7632,8 +7623,7 @@ const LM = (n) => {
7632
7623
  }
7633
7624
  function Z(ee, oe, X) {
7634
7625
  const he = window == null ? void 0 : window.getSelection();
7635
- if (!(he != null && he.rangeCount) || !he.anchorNode)
7636
- return;
7626
+ if (!(he != null && he.rangeCount) || !he.anchorNode) return;
7637
7627
  const ye = ee.split(/\n/);
7638
7628
  let Le = he.anchorNode.parentNode;
7639
7629
  Le === X && (Le = he.anchorNode);
@@ -7670,15 +7660,14 @@ const LM = (n) => {
7670
7660
  function ie(ee) {
7671
7661
  if (ee.cancelable && ee.preventDefault(), ee.stopPropagation(), E.current) {
7672
7662
  const oe = (ee.clipboardData || window.clipboardData).getData("text"), X = window == null ? void 0 : window.getSelection();
7673
- if (!(X != null && X.rangeCount))
7674
- return;
7663
+ if (!(X != null && X.rangeCount)) return;
7675
7664
  oe && X && X.anchorNode && V(oe, E.current), c();
7676
7665
  }
7677
7666
  }
7678
7667
  function B(ee) {
7679
7668
  r(ee), c();
7680
7669
  }
7681
- return /* @__PURE__ */ p.createElement(p.Fragment, null, se, /* @__PURE__ */ p.createElement(
7670
+ return /* @__PURE__ */ p.createElement(p.Fragment, null, re, /* @__PURE__ */ p.createElement(
7682
7671
  "div",
7683
7672
  {
7684
7673
  className: "editor-box",
@@ -7864,7 +7853,7 @@ const cp = () => {
7864
7853
  );
7865
7854
  }, lp = () => {
7866
7855
  const { floatBarData: n, mananger: t } = fe(pe), [e, i] = K(), [o, r] = K();
7867
- ne(() => {
7856
+ se(() => {
7868
7857
  const l = [];
7869
7858
  if (t && G(n == null ? void 0 : n.x) && G(n == null ? void 0 : n.y) && (n != null && n.points)) {
7870
7859
  const c = t.viewId;
@@ -7933,7 +7922,7 @@ const cp = () => {
7933
7922
  );
7934
7923
  }, dp = (n) => {
7935
7924
  const { className: t } = n, { floatBarData: e, angle: i, setAngle: o, setOperationType: r, mananger: s } = fe(pe), [a, l] = K(!1), [c, u] = K(new de()), [h, d] = K(new de()), [g, I] = K(!1);
7936
- ne(() => (F.activeListener(N), () => {
7925
+ se(() => (F.activeListener(N), () => {
7937
7926
  F.unmountActiveListener(N);
7938
7927
  }), []);
7939
7928
  const N = (y) => {
@@ -7944,7 +7933,7 @@ const cp = () => {
7944
7933
  }
7945
7934
  I(!1), (C = s == null ? void 0 : s.control.room) != null && C.disableDeviceInputs && (s.control.room.disableDeviceInputs = !1);
7946
7935
  };
7947
- ne(() => {
7936
+ se(() => {
7948
7937
  if (e) {
7949
7938
  const y = Math.floor(e.w / 2), C = Math.floor(-e.h / 2);
7950
7939
  d(new de(y, C)), u(new de());
@@ -8012,7 +8001,7 @@ const cp = () => {
8012
8001
  );
8013
8002
  }, gp = (n) => {
8014
8003
  const { floatBarData: t, setOperationType: e, mananger: i } = fe(pe), { onClickHandle: o } = n, [r, s] = K(j.Pending), [a, l] = K(), [c, u] = K(), [h, d] = K(!1);
8015
- ne(() => (F.activeListener(g), () => {
8004
+ se(() => (F.activeListener(g), () => {
8016
8005
  F.unmountActiveListener(g);
8017
8006
  }), []);
8018
8007
  const g = (M) => {
@@ -8023,13 +8012,13 @@ const cp = () => {
8023
8012
  }
8024
8013
  d(!1), (y = i == null ? void 0 : i.control.room) != null && y.disableDeviceInputs && (i.control.room.disableDeviceInputs = !1);
8025
8014
  };
8026
- ne(() => {
8015
+ se(() => {
8027
8016
  if (t != null && t.isLocked || i != null && i.control.worker.isBusy) {
8028
8017
  d(!0), s(j.Pending);
8029
8018
  return;
8030
8019
  }
8031
8020
  d(!1);
8032
- }, [t == null ? void 0 : t.isLocked]), ne(() => {
8021
+ }, [t == null ? void 0 : t.isLocked]), se(() => {
8033
8022
  G(t == null ? void 0 : t.x) && G(t == null ? void 0 : t.y) && (r === j.Pending || r === j.Done) && u({ x: t == null ? void 0 : t.x, y: t == null ? void 0 : t.y });
8034
8023
  }, [r, t == null ? void 0 : t.x, t == null ? void 0 : t.y]);
8035
8024
  const I = (M) => {
@@ -8095,7 +8084,7 @@ const cp = () => {
8095
8084
  );
8096
8085
  }, Mp = (n) => {
8097
8086
  const { className: t } = n, [e, i] = K({ x: 0, y: 0, h: 0, w: 0 }), [o, r] = K(), [s, a] = K(), [l, c] = K(), { floatBarData: u, mananger: h } = fe(pe), [d, g] = K(), [I, N] = K(!1);
8098
- ne(() => {
8087
+ se(() => {
8099
8088
  if (u && h) {
8100
8089
  const x = { x: u.x, y: u.y, w: u.w, h: u.h };
8101
8090
  i(x);
@@ -8138,7 +8127,7 @@ const cp = () => {
8138
8127
  y: e.y,
8139
8128
  w: e.w,
8140
8129
  h: e.h
8141
- }, te = [1, 1], se = [0, 0];
8130
+ }, te = [1, 1], re = [0, 0];
8142
8131
  switch (x) {
8143
8132
  case "top": {
8144
8133
  const U = k.height + e.h;
@@ -8191,7 +8180,7 @@ const cp = () => {
8191
8180
  }
8192
8181
  te[0] = S.w / e.w, te[1] = S.h / e.h;
8193
8182
  const $ = z(S).map((U) => Y.control.viewContainerManager.transformToScenePoint(U, Y.viewId)), q = M($, x);
8194
- return E && (se[1] = q[1] - R[1]), L && (se[0] = q[0] - R[0]), { scale: te, translate: se };
8183
+ return E && (re[1] = q[1] - R[1]), L && (re[0] = q[0] - R[0]), { scale: te, translate: re };
8195
8184
  }, C = (x, k) => {
8196
8185
  if (x.cancelable && x.preventDefault(), x.stopPropagation(), h != null && h.control.worker.isBusy) {
8197
8186
  N(!0);
@@ -8272,7 +8261,7 @@ const cp = () => {
8272
8261
  );
8273
8262
  }, Ji = (n) => {
8274
8263
  const { id: t, pos: e, pointMap: i, type: o } = n, { setOperationType: r, mananger: s, floatBarData: a } = fe(pe), [l, c] = K({ x: 0, y: 0 }), [u, h] = K(j.Pending), [d, g] = K(!1);
8275
- ne(() => (F.activeListener(I), () => {
8264
+ se(() => (F.activeListener(I), () => {
8276
8265
  F.unmountActiveListener(I);
8277
8266
  }), []);
8278
8267
  const I = (M) => {
@@ -8283,7 +8272,7 @@ const cp = () => {
8283
8272
  }
8284
8273
  g(!1), (y = s == null ? void 0 : s.control.room) != null && y.disableDeviceInputs && (s.control.room.disableDeviceInputs = !1);
8285
8274
  };
8286
- ne(() => {
8275
+ se(() => {
8287
8276
  G(e.x) && G(e.y) && (u === j.Pending || u === j.Done) && c({ x: e.x, y: e.y });
8288
8277
  }, [e, u]);
8289
8278
  const N = (M) => {
@@ -8348,7 +8337,7 @@ const cp = () => {
8348
8337
  );
8349
8338
  }, pp = (n) => {
8350
8339
  const { className: t } = n, { floatBarData: e, mananger: i } = fe(pe), [o, r] = K(), [s, a] = K(), [l, c] = K(/* @__PURE__ */ new Map());
8351
- ne(() => {
8340
+ se(() => {
8352
8341
  const d = [];
8353
8342
  if (i && (e != null && e.points)) {
8354
8343
  const g = i.viewId;
@@ -8530,7 +8519,7 @@ const Tp = (n) => {
8530
8519
  } : { display: "none" } }, i && /* @__PURE__ */ p.createElement(mp, { roomMember: i }));
8531
8520
  }, Cp = (n) => {
8532
8521
  const { className: t, manager: e } = n, [i, o] = K();
8533
- ne(() => (e.internalMsgEmitter.on([H.Cursor, e.viewId], r), () => {
8522
+ se(() => (e.internalMsgEmitter.on([H.Cursor, e.viewId], r), () => {
8534
8523
  e.internalMsgEmitter.off([H.Cursor, e.viewId], r);
8535
8524
  }), [e]);
8536
8525
  function r(a) {
@@ -9109,7 +9098,7 @@ const W = class W extends eo {
9109
9098
  });
9110
9099
  f(this, "roomStateChangeListener", async (e) => {
9111
9100
  var i, o;
9112
- ae(this.displayer) && !this.displayer.isWritable || (e.memberState && ((i = W.currentManager) == null || i.onMemberChange(e.memberState)), e != null && e.roomMembers && ((o = W.currentManager) == null || o.onRoomMembersChange(e.roomMembers)));
9101
+ ne(this.displayer) && !this.displayer.isWritable || (e.memberState && ((i = W.currentManager) == null || i.onMemberChange(e.memberState)), e != null && e.roomMembers && ((o = W.currentManager) == null || o.onRoomMembersChange(e.roomMembers)));
9113
9102
  });
9114
9103
  }
9115
9104
  static async getInstance(e, i) {
@@ -9121,7 +9110,7 @@ const W = class W extends eo {
9121
9110
  e,
9122
9111
  W.options,
9123
9112
  u
9124
- ), !u && ae(o) && (u = await W.createApplianceMultiPlugin(o, W.kind)), u && W.currentManager && (W.currentManager.bindPlugin(u), u.init(o));
9113
+ ), !u && ne(o) && (u = await W.createApplianceMultiPlugin(o, W.kind)), u && W.currentManager && (W.currentManager.bindPlugin(u), u.init(o));
9125
9114
  const h = {
9126
9115
  displayer: o,
9127
9116
  windowManager: e,
@@ -9174,34 +9163,34 @@ const W = class W extends eo {
9174
9163
  }, I.append(S), getComputedStyle(I).position || (I.style.position = "relative");
9175
9164
  },
9176
9165
  _callbacksOn: function(g, I) {
9177
- W.logger.info(`[ApplianceMultiPlugin] callbacks ${g}`), (g === "onCanUndoStepsUpdate" || g === "onCanRedoStepsUpdate") && ae(o) && o.isWritable ? Nt.InternalMsgEmitter.on(g, I) : r.call(o.callbacks, g, I);
9166
+ W.logger.info(`[ApplianceMultiPlugin] callbacks ${g}`), (g === "onCanUndoStepsUpdate" || g === "onCanRedoStepsUpdate") && ne(o) && o.isWritable ? Nt.InternalMsgEmitter.on(g, I) : r.call(o.callbacks, g, I);
9178
9167
  },
9179
9168
  _callbacksOnce: function(g, I) {
9180
- W.logger.info(`[ApplianceMultiPlugin] callbacks ${g}`), (g === "onCanUndoStepsUpdate" || g === "onCanRedoStepsUpdate") && ae(o) && o.isWritable ? Nt.InternalMsgEmitter.on(g, I) : a.call(o.callbacks, g, I);
9169
+ W.logger.info(`[ApplianceMultiPlugin] callbacks ${g}`), (g === "onCanUndoStepsUpdate" || g === "onCanRedoStepsUpdate") && ne(o) && o.isWritable ? Nt.InternalMsgEmitter.on(g, I) : a.call(o.callbacks, g, I);
9181
9170
  },
9182
9171
  _callbacksOff: function(g, I) {
9183
- W.logger.info(`[ApplianceMultiPlugin] callbacks ${g}`), (g === "onCanUndoStepsUpdate" || g === "onCanRedoStepsUpdate") && ae(o) && o.isWritable ? Nt.InternalMsgEmitter.off(g, I) : s.call(o.callbacks, g, I);
9172
+ W.logger.info(`[ApplianceMultiPlugin] callbacks ${g}`), (g === "onCanUndoStepsUpdate" || g === "onCanRedoStepsUpdate") && ne(o) && o.isWritable ? Nt.InternalMsgEmitter.off(g, I) : s.call(o.callbacks, g, I);
9184
9173
  },
9185
9174
  undo: function() {
9186
- return W.logger.info("[ApplianceMultiPlugin] undo"), W.currentManager && ae(o) && !o.disableSerialization ? W.currentManager.viewContainerManager.undo() : 0;
9175
+ return W.logger.info("[ApplianceMultiPlugin] undo"), W.currentManager && ne(o) && !o.disableSerialization ? W.currentManager.viewContainerManager.undo() : 0;
9187
9176
  },
9188
9177
  redo: function() {
9189
- return W.logger.info("[ApplianceMultiPlugin] redo"), W.currentManager && ae(o) && !o.disableSerialization ? W.currentManager.viewContainerManager.redo() : 0;
9178
+ return W.logger.info("[ApplianceMultiPlugin] redo"), W.currentManager && ne(o) && !o.disableSerialization ? W.currentManager.viewContainerManager.redo() : 0;
9190
9179
  },
9191
9180
  cleanCurrentScene: function() {
9192
- W.logger.info("[ApplianceMultiPlugin] cleanCurrentScene"), W.currentManager && ae(o) && o.isWritable && (W.currentManager.cleanCurrentScene(), l.call(e));
9181
+ W.logger.info("[ApplianceMultiPlugin] cleanCurrentScene"), W.currentManager && ne(o) && o.isWritable && (W.currentManager.cleanCurrentScene(), l.call(e));
9193
9182
  },
9194
9183
  insertImage: function(g) {
9195
- W.logger.info("[ApplianceMultiPlugin] insertImage"), W.currentManager && ae(o) && o.isWritable && W.currentManager.worker.insertImage(g);
9184
+ W.logger.info("[ApplianceMultiPlugin] insertImage"), W.currentManager && ne(o) && o.isWritable && W.currentManager.worker.insertImage(g);
9196
9185
  },
9197
9186
  lockImage: function(g, I) {
9198
- W.logger.info("[ApplianceMultiPlugin] lockImage"), W.currentManager && ae(o) && o.isWritable && W.currentManager.worker.lockImage(g, I);
9187
+ W.logger.info("[ApplianceMultiPlugin] lockImage"), W.currentManager && ne(o) && o.isWritable && W.currentManager.worker.lockImage(g, I);
9199
9188
  },
9200
9189
  completeImageUpload: function(g, I) {
9201
- W.logger.info("[ApplianceMultiPlugin] completeImageUpload"), W.currentManager && ae(o) && o.isWritable && W.currentManager.worker.completeImageUpload(g, I);
9190
+ W.logger.info("[ApplianceMultiPlugin] completeImageUpload"), W.currentManager && ne(o) && o.isWritable && W.currentManager.worker.completeImageUpload(g, I);
9202
9191
  },
9203
9192
  getImagesInformation: function(g) {
9204
- return W.logger.info("[ApplianceMultiPlugin] completeImageUpload"), W.currentManager && ae(o) && o.isWritable ? W.currentManager.worker.getImagesInformation(g) : [];
9193
+ return W.logger.info("[ApplianceMultiPlugin] completeImageUpload"), W.currentManager && ne(o) && o.isWritable ? W.currentManager.worker.getImagesInformation(g) : [];
9205
9194
  },
9206
9195
  callbacks: () => (W.logger.info("[ApplianceMultiPlugin] callbacks bind"), {
9207
9196
  ...o.callbacks,
@@ -9213,7 +9202,13 @@ const W = class W extends eo {
9213
9202
  W.currentManager && (W.logger.info("[ApplianceMultiPlugin] destroy"), W.currentManager.destroy(), W.currentManager = void 0);
9214
9203
  },
9215
9204
  setMemberState(g) {
9216
- W.logger.info("[ApplianceMultiPlugin] setMemberState"), Object.keys(g).includes("currentApplianceName") && (g.currentApplianceName && g.currentApplianceName === _.laserPen ? (g.currentApplianceName = _.pencil, g.useLaserPen = !0) : g.currentApplianceName && g.currentApplianceName === _.pencil && (g.useLaserPen = !1)), c.call(e.mainView, g);
9205
+ W.logger.info("[ApplianceMultiPlugin] setMemberState");
9206
+ const I = Object.keys(g);
9207
+ if (ne(o) && o.isWritable) {
9208
+ I.includes("currentApplianceName") && (g.currentApplianceName && g.currentApplianceName === _.laserPen ? (g.currentApplianceName = _.pencil, g.useLaserPen = !0) : g.currentApplianceName && g.currentApplianceName === _.pencil && (g.useLaserPen = !1)), c.call(e.mainView, g);
9209
+ return;
9210
+ }
9211
+ throw new Error("setMemberState must be called in writable room");
9217
9212
  }
9218
9213
  }, d = (g, I) => {
9219
9214
  if (W.logger.info(`[ApplianceMultiPlugin] injectMethodToObject ${I}`), typeof g[I] == "function" || typeof g[I] > "u") {
@@ -9247,7 +9242,7 @@ const W = class W extends eo {
9247
9242
  }
9248
9243
  init(e) {
9249
9244
  var i, o;
9250
- if (ae(e)) {
9245
+ if (ne(e)) {
9251
9246
  const r = e.state;
9252
9247
  (i = W.currentManager) == null || i.onMemberChange(r.memberState), (o = W.currentManager) == null || o.onRoomMembersChange(r.roomMembers);
9253
9248
  }
@@ -9509,7 +9504,7 @@ const O = class O extends eo {
9509
9504
  });
9510
9505
  f(this, "roomStateChangeListener", async (e) => {
9511
9506
  var i, o;
9512
- O.currentManager instanceof Ue && (e.cameraState && O.currentManager.onCameraChange(e.cameraState), e.sceneState && O.currentManager.onSceneChange(e.sceneState.scenePath, we)), !(ae(this.displayer) && !this.displayer.isWritable) && (e.memberState && ((i = O.currentManager) == null || i.onMemberChange(e.memberState)), e != null && e.roomMembers && ((o = O.currentManager) == null || o.onRoomMembersChange(e.roomMembers)));
9507
+ O.currentManager instanceof Ue && (e.cameraState && O.currentManager.onCameraChange(e.cameraState), e.sceneState && O.currentManager.onSceneChange(e.sceneState.scenePath, we)), !(ne(this.displayer) && !this.displayer.isWritable) && (e.memberState && ((i = O.currentManager) == null || i.onMemberChange(e.memberState)), e != null && e.roomMembers && ((o = O.currentManager) == null || o.onRoomMembersChange(e.roomMembers)));
9513
9508
  });
9514
9509
  }
9515
9510
  static async getInstance(e, i) {
@@ -9520,7 +9515,7 @@ const O = class O extends eo {
9520
9515
  e,
9521
9516
  O.options,
9522
9517
  c
9523
- ), !c && ae(e) && (c = await O.createAppliancePlugin(e, O.kind)), c && O.currentManager && (O.currentManager.bindPlugin(c), c.init(e)), i != null && i.cursorAdapter && (O.cursorAdapter = i.cursorAdapter), O.effectInstance();
9518
+ ), !c && ne(e) && (c = await O.createAppliancePlugin(e, O.kind)), c && O.currentManager && (O.currentManager.bindPlugin(c), c.init(e)), i != null && i.cursorAdapter && (O.cursorAdapter = i.cursorAdapter), O.effectInstance();
9524
9519
  const u = {
9525
9520
  displayer: e,
9526
9521
  currentManager: O.currentManager,
@@ -9574,34 +9569,34 @@ const O = class O extends eo {
9574
9569
  }, g.append(E), getComputedStyle(g).position || (g.style.position = "relative");
9575
9570
  },
9576
9571
  _callbacksOn: function(d, g) {
9577
- O.logger.info(`[ApplianceSinglePlugin] callbacks ${d}`), (d === "onCanUndoStepsUpdate" || d === "onCanRedoStepsUpdate") && ae(e) && e.isWritable ? Ue.InternalMsgEmitter.on(d, g) : o.call(e.callbacks, d, g);
9572
+ O.logger.info(`[ApplianceSinglePlugin] callbacks ${d}`), (d === "onCanUndoStepsUpdate" || d === "onCanRedoStepsUpdate") && ne(e) && e.isWritable ? Ue.InternalMsgEmitter.on(d, g) : o.call(e.callbacks, d, g);
9578
9573
  },
9579
9574
  _callbacksOnce: function(d, g) {
9580
- O.logger.info(`[ApplianceSinglePlugin] callbacks ${d}`), (d === "onCanUndoStepsUpdate" || d === "onCanRedoStepsUpdate") && ae(e) && e.isWritable ? Ue.InternalMsgEmitter.on(d, g) : s.call(e.callbacks, d, g);
9575
+ O.logger.info(`[ApplianceSinglePlugin] callbacks ${d}`), (d === "onCanUndoStepsUpdate" || d === "onCanRedoStepsUpdate") && ne(e) && e.isWritable ? Ue.InternalMsgEmitter.on(d, g) : s.call(e.callbacks, d, g);
9581
9576
  },
9582
9577
  _callbacksOff: function(d, g) {
9583
- O.logger.info(`[ApplianceSinglePlugin] callbacks ${d}`), (d === "onCanUndoStepsUpdate" || d === "onCanRedoStepsUpdate") && ae(e) && e.isWritable ? Ue.InternalMsgEmitter.off(d, g) : r.call(e.callbacks, d, g);
9578
+ O.logger.info(`[ApplianceSinglePlugin] callbacks ${d}`), (d === "onCanUndoStepsUpdate" || d === "onCanRedoStepsUpdate") && ne(e) && e.isWritable ? Ue.InternalMsgEmitter.off(d, g) : r.call(e.callbacks, d, g);
9584
9579
  },
9585
9580
  undo: function() {
9586
- return O.logger.info("[ApplianceSinglePlugin] undo"), O.currentManager && ae(e) && !e.disableSerialization ? O.currentManager.viewContainerManager.undo() : 0;
9581
+ return O.logger.info("[ApplianceSinglePlugin] undo"), O.currentManager && ne(e) && !e.disableSerialization ? O.currentManager.viewContainerManager.undo() : 0;
9587
9582
  },
9588
9583
  redo: function() {
9589
- return O.logger.info("[ApplianceSinglePlugin] redo"), O.currentManager && ae(e) && !e.disableSerialization ? O.currentManager.viewContainerManager.redo() : 0;
9584
+ return O.logger.info("[ApplianceSinglePlugin] redo"), O.currentManager && ne(e) && !e.disableSerialization ? O.currentManager.viewContainerManager.redo() : 0;
9590
9585
  },
9591
9586
  cleanCurrentScene: function(d) {
9592
- O.logger.info("[ApplianceSinglePlugin] cleanCurrentScene"), O.currentManager && ae(e) && e.isWritable && (O.currentManager.cleanCurrentScene(), a.call(e, d));
9587
+ O.logger.info("[ApplianceSinglePlugin] cleanCurrentScene"), O.currentManager && ne(e) && e.isWritable && (O.currentManager.cleanCurrentScene(), a.call(e, d));
9593
9588
  },
9594
9589
  insertImage: function(d) {
9595
- O.logger.info("[ApplianceSinglePlugin] insertImage"), O.currentManager && ae(e) && e.isWritable && O.currentManager.worker.insertImage(d);
9590
+ O.logger.info("[ApplianceSinglePlugin] insertImage"), O.currentManager && ne(e) && e.isWritable && O.currentManager.worker.insertImage(d);
9596
9591
  },
9597
9592
  lockImage: function(d, g) {
9598
- O.logger.info("[ApplianceSinglePlugin] lockImage"), O.currentManager && ae(e) && e.isWritable && O.currentManager.worker.lockImage(d, g);
9593
+ O.logger.info("[ApplianceSinglePlugin] lockImage"), O.currentManager && ne(e) && e.isWritable && O.currentManager.worker.lockImage(d, g);
9599
9594
  },
9600
9595
  completeImageUpload: function(d, g) {
9601
- O.logger.info("[ApplianceSinglePlugin] completeImageUpload"), O.currentManager && ae(e) && e.isWritable && O.currentManager.worker.completeImageUpload(d, g);
9596
+ O.logger.info("[ApplianceSinglePlugin] completeImageUpload"), O.currentManager && ne(e) && e.isWritable && O.currentManager.worker.completeImageUpload(d, g);
9602
9597
  },
9603
9598
  getImagesInformation: function(d) {
9604
- return O.logger.info("[ApplianceSinglePlugin] completeImageUpload"), O.currentManager && ae(e) && e.isWritable ? O.currentManager.worker.getImagesInformation(d) : [];
9599
+ return O.logger.info("[ApplianceSinglePlugin] completeImageUpload"), O.currentManager && ne(e) && e.isWritable ? O.currentManager.worker.getImagesInformation(d) : [];
9605
9600
  },
9606
9601
  callbacks: () => ({
9607
9602
  ...e.callbacks,
@@ -9613,7 +9608,13 @@ const O = class O extends eo {
9613
9608
  O.currentManager && (O.logger.info("[ApplianceSinglePlugin] destroy"), O.currentManager.destroy(), O.currentManager = void 0, O.cursorAdapter = void 0);
9614
9609
  },
9615
9610
  setMemberState(d) {
9616
- O.logger.info("[ApplianceSinglePlugin] setMemberState"), Object.keys(d).includes("currentApplianceName") && (d.currentApplianceName && d.currentApplianceName === _.laserPen ? (d.currentApplianceName = _.pencil, d.useLaserPen = !0) : d.currentApplianceName && d.currentApplianceName === _.pencil && (d.useLaserPen = !1)), l(d);
9611
+ O.logger.info("[ApplianceSinglePlugin] setMemberState");
9612
+ const g = Object.keys(d);
9613
+ if (ne(e) && e.isWritable) {
9614
+ g.includes("currentApplianceName") && (d.currentApplianceName && d.currentApplianceName === _.laserPen ? (d.currentApplianceName = _.pencil, d.useLaserPen = !0) : d.currentApplianceName && d.currentApplianceName === _.pencil && (d.useLaserPen = !1)), l(d);
9615
+ return;
9616
+ }
9617
+ throw new Error("setMemberState must be called in writable room");
9617
9618
  }
9618
9619
  }, h = (d, g) => {
9619
9620
  if (O.logger.info(`[ApplianceSinglePlugin] injectMethodToObject ${g}`), typeof d[g] == "function" || typeof d[g] > "u") {
@@ -9664,7 +9665,7 @@ const O = class O extends eo {
9664
9665
  }
9665
9666
  init(e) {
9666
9667
  var i, o;
9667
- if (ae(e)) {
9668
+ if (ne(e)) {
9668
9669
  const r = e.state;
9669
9670
  r != null && r.memberState && ((i = O.currentManager) == null || i.onMemberChange(r.memberState), (o = O.currentManager) == null || o.onRoomMembersChange(r.roomMembers));
9670
9671
  }