@univerjs/drawing 0.2.4-alpha.0 → 0.2.5

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.
package/lib/es/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var Pt = Object.defineProperty;
2
- var Ut = (n, e, t) => e in n ? Pt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var V = (n, e, t) => Ut(n, typeof e != "symbol" ? e + "" : e, t);
2
+ var Mt = (n, e, t) => e in n ? Pt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
+ var V = (n, e, t) => Mt(n, typeof e != "symbol" ? e + "" : e, t);
4
4
  import { Subject as we } from "rxjs";
5
- import { sortRules as Mt, sortRulesByDesc as Nt, createIdentifier as It, Tools as kt, Inject as Rt, Injector as St, Plugin as jt, mergeOverrideWithDependencies as Tt } from "@univerjs/core";
5
+ import { sortRules as Ut, sortRulesByDesc as Nt, createIdentifier as It, Tools as kt, Inject as Rt, Injector as St, Plugin as Tt, mergeOverrideWithDependencies as jt } from "@univerjs/core";
6
6
  const sn = 500, on = 500, ln = 10, $t = 5 * 1024 * 1024, Wt = ["image/png", "image/jpeg", "image/jpg", "image/gif", "image/bmp"];
7
7
  var Ce = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, F = {}, Ct = {}, ct = {};
8
8
  Object.defineProperty(ct, "__esModule", { value: !0 });
@@ -52,11 +52,11 @@ var ft = {};
52
52
  if (!O)
53
53
  throw new Error(o);
54
54
  }
55
- const t = (O) => O != null && typeof O == "object" && !Array.isArray(O), s = (O, o) => (
55
+ const t = (O) => O != null && typeof O == "object" && !Array.isArray(O), i = (O, o) => (
56
56
  // All the numbers, then all the letters. Just as the gods of ascii intended.
57
57
  typeof O == typeof o ? O > o : typeof O == "string" && typeof o == "number"
58
58
  );
59
- function i(O, o) {
59
+ function s(O, o) {
60
60
  for (let c in O) {
61
61
  const h = c;
62
62
  o.write(h, O[h]);
@@ -158,7 +158,7 @@ var ft = {};
158
158
  const R = this.container.splice(h, this.container.length - h);
159
159
  this.container.push(R), this.lcIdx > -1 && (this.lcIdx = h);
160
160
  }
161
- for (this.indexes.push(this.idx), this.parents.push(this.container), this.lcIdx !== -1 && (e(s(c, this.container[this.lcIdx][0])), h = this.lcIdx + 1, this.lcIdx = -1); h < this.container.length && s(c, this.container[h][0]); )
161
+ for (this.indexes.push(this.idx), this.parents.push(this.container), this.lcIdx !== -1 && (e(i(c, this.container[this.lcIdx][0])), h = this.lcIdx + 1, this.lcIdx = -1); h < this.container.length && i(c, this.container[h][0]); )
162
162
  h++;
163
163
  if (this.indexes.push(h), this.idx = 0, h < this.container.length && this.container[h][0] === c)
164
164
  this.container = this.container[h];
@@ -204,7 +204,7 @@ var ft = {};
204
204
  ascend() {
205
205
  this.pendingDescent.length ? this.pendingDescent.pop() : super.ascend();
206
206
  }
207
- mergeTree(o, c = i) {
207
+ mergeTree(o, c = s) {
208
208
  if (o === null)
209
209
  return;
210
210
  if (e(Array.isArray(o)), o === this._op)
@@ -248,7 +248,7 @@ var ft = {};
248
248
  const Ie = J = O.getKey();
249
249
  if (pe != null) {
250
250
  let xe = !1;
251
- if (o && typeof Ie == "number" && (J = o(Ie, O.getComponent()), J < 0 && (J = ~J, xe = !0)), s(J, pe))
251
+ if (o && typeof Ie == "number" && (J = o(Ie, O.getComponent()), J < 0 && (J = ~J, xe = !0)), i(J, pe))
252
252
  return null;
253
253
  if (J === pe && !xe)
254
254
  return O;
@@ -266,7 +266,7 @@ var ft = {};
266
266
  let h, R, Z, pe;
267
267
  for (h = R = O && O.descendFirst(), Z = pe = o && o.descendFirst(); h || Z; ) {
268
268
  let J = h ? O.getKey() : null, Ie = Z ? o.getKey() : null;
269
- J !== null && Ie !== null && (s(Ie, J) ? Ie = null : J !== Ie && (J = null)), c(J == null ? Ie : J, J != null ? O : null, Ie != null ? o : null), J != null && h && (h = O.nextSibling()), Ie != null && Z && (Z = o.nextSibling());
269
+ J !== null && Ie !== null && (i(Ie, J) ? Ie = null : J !== Ie && (J = null)), c(J == null ? Ie : J, J != null ? O : null, Ie != null ? o : null), J != null && h && (h = O.nextSibling()), Ie != null && Z && (Z = o.nextSibling());
270
270
  }
271
271
  R && O.ascend(), pe && o.ascend();
272
272
  }
@@ -281,19 +281,19 @@ var ht = {};
281
281
  var it = {}, Fe = {}, vt;
282
282
  function pt() {
283
283
  return vt || (vt = 1, Object.defineProperty(Fe, "__esModule", { value: !0 }), Fe.uniToStrPos = Fe.strPosToUni = void 0, Fe.strPosToUni = (n, e = n.length) => {
284
- let t = 0, s = 0;
285
- for (; s < e; s++) {
286
- const i = n.charCodeAt(s);
287
- i >= 55296 && i <= 57343 && (t++, s++);
284
+ let t = 0, i = 0;
285
+ for (; i < e; i++) {
286
+ const s = n.charCodeAt(i);
287
+ s >= 55296 && s <= 57343 && (t++, i++);
288
288
  }
289
- if (s !== e)
289
+ if (i !== e)
290
290
  throw Error("Invalid offset - splits unicode bytes");
291
- return s - t;
291
+ return i - t;
292
292
  }, Fe.uniToStrPos = (n, e) => {
293
293
  let t = 0;
294
294
  for (; e > 0; e--) {
295
- const s = n.charCodeAt(t);
296
- t += s >= 55296 && s <= 57343 ? 2 : 1;
295
+ const i = n.charCodeAt(t);
296
+ t += i >= 55296 && i <= 57343 ? 2 : 1;
297
297
  }
298
298
  return t;
299
299
  }), Fe;
@@ -331,7 +331,7 @@ function at() {
331
331
  if (typeof _ == "number")
332
332
  throw Error("Op has a trailing skip");
333
333
  };
334
- function s(f, _) {
334
+ function i(f, _) {
335
335
  let w = 0, L = 0;
336
336
  for (let z = 0; z < f.length; z++) {
337
337
  const H = f[z];
@@ -348,14 +348,14 @@ function at() {
348
348
  }
349
349
  }
350
350
  }
351
- n.eachOp = s;
352
- function i(f, _) {
351
+ n.eachOp = i;
352
+ function s(f, _) {
353
353
  const w = [], L = a(w);
354
- return s(f, (z, H, De) => {
354
+ return i(f, (z, H, De) => {
355
355
  L(_(z, H, De));
356
356
  }), o(w);
357
357
  }
358
- const d = (f) => f, l = (f) => i(f, d);
358
+ const d = (f) => f, l = (f) => s(f, d);
359
359
  n.dlen = (f) => typeof f == "number" ? f : e.strPosToUni(f);
360
360
  const a = (f) => (_) => {
361
361
  if (!(!_ || _.d === 0 || _.d === "")) if (f.length === 0)
@@ -492,10 +492,10 @@ function at() {
492
492
  return f;
493
493
  }, Z = (f, _) => typeof f == "number" ? R(f, _) : f.map((w) => R(w, _));
494
494
  function pe(f, _, w) {
495
- return i(f, (L, z) => typeof L == "object" && typeof L.d == "number" ? { d: w.slice(_, z, z + L.d) } : L);
495
+ return s(f, (L, z) => typeof L == "object" && typeof L.d == "number" ? { d: w.slice(_, z, z + L.d) } : L);
496
496
  }
497
497
  function J(f) {
498
- return i(f, (_) => {
498
+ return s(f, (_) => {
499
499
  switch (typeof _) {
500
500
  case "object":
501
501
  if (typeof _.d == "number")
@@ -509,11 +509,11 @@ function at() {
509
509
  });
510
510
  }
511
511
  function Ie(f) {
512
- return i(f, (_) => typeof _ == "object" && typeof _.d == "string" ? { d: e.strPosToUni(_.d) } : _);
512
+ return s(f, (_) => typeof _ == "object" && typeof _.d == "string" ? { d: e.strPosToUni(_.d) } : _);
513
513
  }
514
514
  function xe(f) {
515
515
  let _ = !0;
516
- return s(f, (w) => {
516
+ return i(f, (w) => {
517
517
  typeof w == "object" && typeof w.d == "number" && (_ = !1);
518
518
  }), _;
519
519
  }
@@ -574,27 +574,27 @@ function at() {
574
574
  n.default = ve;
575
575
  }(st)), st;
576
576
  }
577
- var Qe = {}, bt;
577
+ var Qe = {}, mt;
578
578
  function xt() {
579
- if (bt) return Qe;
580
- bt = 1, Object.defineProperty(Qe, "__esModule", { value: !0 });
579
+ if (mt) return Qe;
580
+ mt = 1, Object.defineProperty(Qe, "__esModule", { value: !0 });
581
581
  const n = at(), e = pt();
582
- function t(s, i) {
582
+ function t(i, s) {
583
583
  return {
584
584
  // Returns the text content of the document
585
- get: s,
585
+ get: i,
586
586
  // Returns the number of characters in the string
587
587
  getLength() {
588
- return s().length;
588
+ return i().length;
589
589
  },
590
590
  // Insert the specified text at the given position in the document
591
591
  insert(d, l, a) {
592
- const E = e.strPosToUni(s(), d);
593
- return i([E, l], a);
592
+ const E = e.strPosToUni(i(), d);
593
+ return s([E, l], a);
594
594
  },
595
595
  remove(d, l, a) {
596
- const E = e.strPosToUni(s(), d);
597
- return i([E, { d: l }], a);
596
+ const E = e.strPosToUni(i(), d);
597
+ return s([E, { d: l }], a);
598
598
  },
599
599
  // When you use this API, you should implement these two methods
600
600
  // in your editing context.
@@ -618,9 +618,9 @@ function xt() {
618
618
  }
619
619
  return Qe.default = t, t.provides = { text: !0 }, Qe;
620
620
  }
621
- var mt;
621
+ var bt;
622
622
  function Lt() {
623
- return mt || (mt = 1, function(n) {
623
+ return bt || (bt = 1, function(n) {
624
624
  var e = Ce && Ce.__createBinding || (Object.create ? function(c, h, R, Z) {
625
625
  Z === void 0 && (Z = R), Object.defineProperty(c, Z, { enumerable: !0, get: function() {
626
626
  return h[R];
@@ -631,16 +631,16 @@ function Lt() {
631
631
  Object.defineProperty(c, "default", { enumerable: !0, value: h });
632
632
  } : function(c, h) {
633
633
  c.default = h;
634
- }), s = Ce && Ce.__importStar || function(c) {
634
+ }), i = Ce && Ce.__importStar || function(c) {
635
635
  if (c && c.__esModule) return c;
636
636
  var h = {};
637
637
  if (c != null) for (var R in c) Object.hasOwnProperty.call(c, R) && e(h, c, R);
638
638
  return t(h, c), h;
639
- }, i = Ce && Ce.__importDefault || function(c) {
639
+ }, s = Ce && Ce.__importDefault || function(c) {
640
640
  return c && c.__esModule ? c : { default: c };
641
641
  };
642
642
  Object.defineProperty(n, "__esModule", { value: !0 }), n.type = n.remove = n.insert = void 0;
643
- const d = pt(), l = s(at()), a = i(xt()), E = {
643
+ const d = pt(), l = i(at()), a = s(xt()), E = {
644
644
  create(c) {
645
645
  return c;
646
646
  },
@@ -687,15 +687,15 @@ function Lt() {
687
687
  Object.defineProperty(n, "__esModule", {
688
688
  value: !0
689
689
  }), n.editOp = n.replaceOp = n.insertOp = n.moveOp = n.removeOp = n.type = void 0;
690
- const t = e(ct), s = e(dt), i = ft, d = ht;
690
+ const t = e(ct), i = e(dt), s = ft, d = ht;
691
691
  function l(r, u) {
692
692
  if (!r) throw new Error(u);
693
693
  }
694
694
  n.type = {
695
695
  name: "json1",
696
696
  uri: "http://sharejs.org/types/JSONv1",
697
- readCursor: i.readCursor,
698
- writeCursor: i.writeCursor,
697
+ readCursor: s.readCursor,
698
+ writeCursor: s.writeCursor,
699
699
  create: (r) => r,
700
700
  isNoop: (r) => r == null,
701
701
  setDebug(r) {
@@ -730,9 +730,9 @@ function Lt() {
730
730
  function h(r, u, y) {
731
731
  return typeof u == "number" ? (l(r != null, "Container is missing for key"), l(Array.isArray(r), "Cannot use numerical key for object container"), l(r.length >= u, "Cannot insert into out of bounds index"), r.splice(u, 0, y)) : (l(E(r), "Cannot insert into missing item"), l(r[u] === void 0, "Trying to overwrite value at key. Your op needs to remove it first"), r[u] = y), y;
732
732
  }
733
- n.removeOp = (r, u = !0) => i.writeCursor().writeAtPath(r, "r", u).get(), n.moveOp = (r, u) => i.writeCursor().writeMove(r, u).get(), n.insertOp = (r, u) => i.writeCursor().writeAtPath(r, "i", u).get(), n.replaceOp = (r, u, y) => i.writeCursor().at(r, (D) => {
733
+ n.removeOp = (r, u = !0) => s.writeCursor().writeAtPath(r, "r", u).get(), n.moveOp = (r, u) => s.writeCursor().writeMove(r, u).get(), n.insertOp = (r, u) => s.writeCursor().writeAtPath(r, "i", u).get(), n.replaceOp = (r, u, y) => s.writeCursor().at(r, (D) => {
734
734
  D.write("r", u), D.write("i", y);
735
- }).get(), n.editOp = (r, u, y, D = !1) => i.writeCursor().at(r, (b) => _(b, u, y, D)).get();
735
+ }).get(), n.editOp = (r, u, y, D = !1) => s.writeCursor().at(r, (m) => _(m, u, y, D)).get();
736
736
  const R = (r, u) => r != null && (typeof u == "number" ? Array.isArray(r) : typeof r == "object"), Z = (r, u) => R(r, u) ? r[u] : void 0, pe = {};
737
737
  function J(r) {
738
738
  let u = r.type ? r.type : r;
@@ -753,8 +753,8 @@ function Lt() {
753
753
  transform: (r) => r
754
754
  });
755
755
  const ve = (r) => r == null ? null : r.et ? Ie(r.et) : r.es ? pe["text-unicode"] : r.ena != null ? pe.number : null, f = (r) => r.es ? r.es : r.ena != null ? r.ena : r.e, _ = (r, u, y, D = !1) => {
756
- const [b, C] = typeof u == "string" ? [Ie(u), u] : [u, u.name];
757
- !D && b.isNoop && b.isNoop(y) || (C === "number" ? r.write("ena", y) : C === "text-unicode" ? r.write("es", y) : (r.write("et", C), r.write("e", y)));
756
+ const [m, C] = typeof u == "string" ? [Ie(u), u] : [u, u.name];
757
+ !D && m.isNoop && m.isNoop(y) || (C === "number" ? r.write("ena", y) : C === "text-unicode" ? r.write("es", y) : (r.write("et", C), r.write("e", y)));
758
758
  };
759
759
  function w(r) {
760
760
  l(typeof r == "number"), l(r >= 0), l(r === (0 | r));
@@ -765,282 +765,282 @@ function Lt() {
765
765
  function z(r) {
766
766
  if (r === null) return;
767
767
  const u = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set(), D = (C) => {
768
- let $ = !0, j = !1;
768
+ let $ = !0, T = !1;
769
769
  for (let p in C) {
770
770
  const v = C[p];
771
771
  if ($ = !1, l(p === "p" || p === "r" || p === "d" || p === "i" || p === "e" || p === "es" || p === "ena" || p === "et", "Invalid component item '" + p + "'"), p === "p") w(v), l(!u.has(v)), u.add(v), l(C.r === void 0);
772
772
  else if (p === "d") w(v), l(!y.has(v)), y.add(v), l(C.i === void 0);
773
773
  else if (p === "e" || p === "es" || p === "ena") {
774
- l(!j), j = !0;
775
- const m = ve(C);
776
- l(m, "Missing type in edit"), m.checkValidOp && m.checkValidOp(f(C));
774
+ l(!T), T = !0;
775
+ const b = ve(C);
776
+ l(b, "Missing type in edit"), b.checkValidOp && b.checkValidOp(f(C));
777
777
  }
778
778
  }
779
779
  l(!$);
780
- }, b = (C, $, j) => {
780
+ }, m = (C, $, T) => {
781
781
  if (!Array.isArray(C)) throw Error("Op must be null or a list");
782
782
  if (C.length === 0) throw Error("Empty descent");
783
783
  $ || L(C[0]);
784
- let p = 1, v = 0, m = 0;
784
+ let p = 1, v = 0, b = 0;
785
785
  for (let I = 0; I < C.length; I++) {
786
- const T = C[I];
787
- if (l(T != null), Array.isArray(T)) {
788
- const G = b(T, !1);
786
+ const j = C[I];
787
+ if (l(j != null), Array.isArray(j)) {
788
+ const G = m(j, !1);
789
789
  if (v) {
790
- const g = typeof m, N = typeof G;
791
- g === N ? l(m < G, "descent keys are not in order") : l(g === "number" && N === "string");
790
+ const g = typeof b, N = typeof G;
791
+ g === N ? l(b < G, "descent keys are not in order") : l(g === "number" && N === "string");
792
792
  }
793
- m = G, v++, p = 3;
794
- } else typeof T == "object" ? (l(p === 1, `Prev not scalar - instead ${p}`), D(T), p = 2) : (l(p !== 3), L(T), l(i.isValidPathItem(T), "Invalid path key"), p = 1);
793
+ b = G, v++, p = 3;
794
+ } else typeof j == "object" ? (l(p === 1, `Prev not scalar - instead ${p}`), D(j), p = 2) : (l(p !== 3), L(j), l(s.isValidPathItem(j), "Invalid path key"), p = 1);
795
795
  }
796
796
  return l(v !== 1, "Operation makes multiple descents. Remove some []"), l(p === 2 || p === 3), C[0];
797
797
  };
798
- b(r, !0), l(u.size === y.size, "Mismatched picks and drops in op");
798
+ m(r, !0), l(u.size === y.size, "Mismatched picks and drops in op");
799
799
  for (let C = 0; C < u.size; C++) l(u.has(C)), l(y.has(C));
800
800
  }
801
801
  function H(r) {
802
802
  let u = 0, y = [];
803
- const D = i.writeCursor();
804
- return D.mergeTree(r, (b, C) => {
805
- const $ = ve(b);
803
+ const D = s.writeCursor();
804
+ return D.mergeTree(r, (m, C) => {
805
+ const $ = ve(m);
806
806
  if ($) {
807
- const p = f(b);
807
+ const p = f(m);
808
808
  _(C, $, $.normalize ? $.normalize(p) : p);
809
809
  }
810
- for (const p of ["r", "p", "i", "d"]) if (b[p] !== void 0) {
811
- const v = p === "p" || p === "d" ? (j = b[p], y[j] == null && (y[j] = u++), y[j]) : b[p];
810
+ for (const p of ["r", "p", "i", "d"]) if (m[p] !== void 0) {
811
+ const v = p === "p" || p === "d" ? (T = m[p], y[T] == null && (y[T] = u++), y[T]) : m[p];
812
812
  C.write(p, v);
813
813
  }
814
- var j;
814
+ var T;
815
815
  }), D.get();
816
816
  }
817
817
  function De(r, u) {
818
818
  if (z(u), u === null) return r;
819
819
  const y = [];
820
- return function D(b, C) {
821
- let $ = b, j = 0, p = {
822
- root: b
823
- }, v = 0, m = p, I = "root";
824
- function T() {
825
- for (; v < j; v++) {
820
+ return function D(m, C) {
821
+ let $ = m, T = 0, p = {
822
+ root: m
823
+ }, v = 0, b = p, I = "root";
824
+ function j() {
825
+ for (; v < T; v++) {
826
826
  let G = C[v];
827
- typeof G != "object" && (l(R(m, I)), m = m[I] = W(m[I]), I = G);
827
+ typeof G != "object" && (l(R(b, I)), b = b[I] = W(b[I]), I = G);
828
828
  }
829
829
  }
830
- for (; j < C.length; j++) {
831
- const G = C[j];
830
+ for (; T < C.length; T++) {
831
+ const G = C[T];
832
832
  if (Array.isArray(G)) {
833
833
  const g = D($, G);
834
- g !== $ && g !== void 0 && (T(), $ = m[I] = g);
834
+ g !== $ && g !== void 0 && (j(), $ = b[I] = g);
835
835
  } else if (typeof G == "object") {
836
- G.d != null ? (T(), $ = h(m, I, y[G.d])) : G.i !== void 0 && (T(), $ = h(m, I, G.i));
836
+ G.d != null ? (j(), $ = h(b, I, y[G.d])) : G.i !== void 0 && (j(), $ = h(b, I, G.i));
837
837
  const g = ve(G);
838
- if (g) T(), $ = m[I] = g.apply($, f(G));
838
+ if (g) j(), $ = b[I] = g.apply($, f(G));
839
839
  else if (G.e !== void 0) throw Error("Subtype " + G.et + " undefined");
840
840
  } else $ = Z($, G);
841
841
  }
842
842
  return p.root;
843
- }(r = function D(b, C) {
843
+ }(r = function D(m, C) {
844
844
  const $ = [];
845
- let j = 0;
846
- for (; j < C.length; j++) {
847
- const I = C[j];
845
+ let T = 0;
846
+ for (; T < C.length; T++) {
847
+ const I = C[T];
848
848
  if (Array.isArray(I)) break;
849
- typeof I != "object" && ($.push(b), b = Z(b, I));
849
+ typeof I != "object" && ($.push(m), m = Z(m, I));
850
850
  }
851
- for (let I = C.length - 1; I >= j; I--) b = D(b, C[I]);
852
- for (--j; j >= 0; j--) {
853
- const I = C[j];
851
+ for (let I = C.length - 1; I >= T; I--) m = D(m, C[I]);
852
+ for (--T; T >= 0; T--) {
853
+ const I = C[T];
854
854
  if (typeof I != "object") {
855
- const T = $.pop();
856
- b = b === Z(T, I) ? T : b === void 0 ? c(T, I) : (v = I, m = b, (p = W(p = T))[v] = m, p);
857
- } else O(I) && (l(b !== void 0, "Cannot pick up or remove undefined"), I.p != null && (y[I.p] = b), b = void 0);
855
+ const j = $.pop();
856
+ m = m === Z(j, I) ? j : m === void 0 ? c(j, I) : (v = I, b = m, (p = W(p = j))[v] = b, p);
857
+ } else O(I) && (l(m !== void 0, "Cannot pick up or remove undefined"), I.p != null && (y[I.p] = m), m = void 0);
858
858
  }
859
- var p, v, m;
860
- return b;
859
+ var p, v, b;
860
+ return m;
861
861
  }(r, u), u);
862
862
  }
863
863
  function ue(r, u) {
864
864
  r = r.slice(), z(u);
865
- const y = i.readCursor(u);
866
- let D, b, C = !1;
865
+ const y = s.readCursor(u);
866
+ let D, m, C = !1;
867
867
  const $ = [];
868
868
  for (let p = 0; ; p++) {
869
- const v = r[p], m = y.getComponent();
870
- if (m && (m.r !== void 0 ? C = !0 : m.p != null && (C = !1, D = m.p, b = p)), p >= r.length) break;
869
+ const v = r[p], b = y.getComponent();
870
+ if (b && (b.r !== void 0 ? C = !0 : b.p != null && (C = !1, D = b.p, m = p)), p >= r.length) break;
871
871
  let I = 0;
872
- const T = i.advancer(y, void 0, (g, N) => {
872
+ const j = s.advancer(y, void 0, (g, N) => {
873
873
  O(N) && I++;
874
874
  });
875
- $.unshift(T);
876
- const G = T(v);
875
+ $.unshift(j);
876
+ const G = j(v);
877
877
  if (typeof v == "number" && (r[p] -= I), !G) break;
878
878
  }
879
879
  if ($.forEach((p) => p.end()), C) return null;
880
- const j = () => {
880
+ const T = () => {
881
881
  let p = 0;
882
882
  if (D != null) {
883
883
  const v = y.getPath();
884
- p = v.length, r = v.concat(r.slice(b));
884
+ p = v.length, r = v.concat(r.slice(m));
885
885
  }
886
886
  for (; p < r.length; p++) {
887
- const v = r[p], m = a(y), I = ve(m);
887
+ const v = r[p], b = a(y), I = ve(b);
888
888
  if (I) {
889
- const g = f(m);
889
+ const g = f(b);
890
890
  I.transformPosition && (r[p] = I.transformPosition(r[p], g));
891
891
  break;
892
892
  }
893
- let T = 0;
894
- const G = i.advancer(y, (g, N) => o(N) ? ~(g - T) : g - T, (g, N) => {
895
- o(N) && T++;
893
+ let j = 0;
894
+ const G = s.advancer(y, (g, N) => o(N) ? ~(g - j) : g - j, (g, N) => {
895
+ o(N) && j++;
896
896
  })(v);
897
- if (typeof v == "number" && (r[p] += T), !G) break;
897
+ if (typeof v == "number" && (r[p] += j), !G) break;
898
898
  }
899
899
  };
900
900
  return D != null ? y.eachDrop(null, (p) => {
901
- p === D && j();
902
- }) : j(), r;
901
+ p === D && T();
902
+ }) : T(), r;
903
903
  }
904
904
  function ne(r, u) {
905
905
  if (z(r), z(u), r == null) return u;
906
906
  if (u == null) return r;
907
907
  let y = 0;
908
- const D = i.readCursor(r), b = i.readCursor(u), C = i.writeCursor(), $ = [], j = [], p = [], v = [], m = [], I = [], T = /* @__PURE__ */ new Set();
908
+ const D = s.readCursor(r), m = s.readCursor(u), C = s.writeCursor(), $ = [], T = [], p = [], v = [], b = [], I = [], j = /* @__PURE__ */ new Set();
909
909
  D.traverse(null, (g) => {
910
910
  g.p != null && (p[g.p] = D.clone());
911
- }), b.traverse(null, (g) => {
912
- g.d != null && (v[g.d] = b.clone());
911
+ }), m.traverse(null, (g) => {
912
+ g.d != null && (v[g.d] = m.clone());
913
913
  });
914
- const G = i.writeCursor();
915
- return function g(N, re, te, K, se, Te, be, _e) {
914
+ const G = s.writeCursor();
915
+ return function g(N, re, te, K, se, je, me, _e) {
916
916
  l(re || te);
917
- const oe = a(re), Pe = a(te), Me = !!Pe && Pe.r !== void 0, Le = !!oe && oe.i !== void 0, Ue = oe ? oe.d : null, Ee = Pe ? Pe.p : null, $e = (Te || Me) && Ee == null;
918
- if (Ee != null) K = v[Ee], be = j[Ee] = new i.WriteCursor();
917
+ const oe = a(re), Pe = a(te), Ue = !!Pe && Pe.r !== void 0, Le = !!oe && oe.i !== void 0, Me = oe ? oe.d : null, Ee = Pe ? Pe.p : null, $e = (je || Ue) && Ee == null;
918
+ if (Ee != null) K = v[Ee], me = T[Ee] = new s.WriteCursor();
919
919
  else if (Pe && Pe.r !== void 0) K = null;
920
920
  else {
921
921
  const P = a(K);
922
922
  P && P.d != null && (K = null);
923
923
  }
924
924
  const Q = a(K);
925
- if (Ue != null) if (N = p[Ue], _e = $[Ue] = new i.WriteCursor(), $e) Te && !Me && _e.write("r", !0);
925
+ if (Me != null) if (N = p[Me], _e = $[Me] = new s.WriteCursor(), $e) je && !Ue && _e.write("r", !0);
926
926
  else {
927
- const P = m[Ue] = y++;
928
- be.write("d", P);
927
+ const P = b[Me] = y++;
928
+ me.write("d", P);
929
929
  }
930
930
  else if (oe && oe.i !== void 0) N = null;
931
931
  else {
932
932
  const P = a(N);
933
933
  P && P.p != null && (N = null);
934
934
  }
935
- let U;
936
- Le ? (l(se === void 0), U = oe.i) : U = se;
937
- const B = (Ee == null ? !Le || Te || Me : U === void 0) ? null : be.getComponent();
935
+ let M;
936
+ Le ? (l(se === void 0), M = oe.i) : M = se;
937
+ const B = (Ee == null ? !Le || je || Ue : M === void 0) ? null : me.getComponent();
938
938
  if (Ee != null) {
939
939
  if (!(se !== void 0 || Le)) {
940
- const P = Ue != null ? m[Ue] : y++;
940
+ const P = Me != null ? b[Me] : y++;
941
941
  I[Ee] = P, _e.write("p", P);
942
942
  }
943
- } else Me && (Le || se !== void 0 || (Pe.r, _e.write("r", Pe.r)));
944
- const M = $e ? null : ve(oe), A = ve(Q);
945
- if ((M || A) && (M && M.name, A && A.name), M && A) {
946
- l(M === A);
947
- const P = f(oe), x = f(Q), he = M.compose(P, x);
948
- _(be, M, he), T.add(Q);
949
- } else M ? _(be, M, f(oe)) : A && (_(be, A, f(Q)), T.add(Q));
950
- const k = typeof U == "object" && U != null;
943
+ } else Ue && (Le || se !== void 0 || (Pe.r, _e.write("r", Pe.r)));
944
+ const U = $e ? null : ve(oe), A = ve(Q);
945
+ if ((U || A) && (U && U.name, A && A.name), U && A) {
946
+ l(U === A);
947
+ const P = f(oe), x = f(Q), he = U.compose(P, x);
948
+ _(me, U, he), j.add(Q);
949
+ } else U ? _(me, U, f(oe)) : A && (_(me, A, f(Q)), j.add(Q));
950
+ const k = typeof M == "object" && M != null;
951
951
  let X = !1, Y = 0, ee = 0, fe = 0, de = 0, le = 0;
952
- const ye = i.advancer(K, (P, x) => o(x) ? de - P - 1 : P - de, (P, x) => {
952
+ const ye = s.advancer(K, (P, x) => o(x) ? de - P - 1 : P - de, (P, x) => {
953
953
  o(x) && de++;
954
- }), q = i.advancer(N, (P, x) => O(x) ? Y - P - 1 : P - Y, (P, x) => {
954
+ }), q = s.advancer(N, (P, x) => O(x) ? Y - P - 1 : P - Y, (P, x) => {
955
955
  O(x) && Y++;
956
956
  });
957
- if (i.eachChildOf(re, te, (P, x, he) => {
958
- let me, We, He = P, Ne = P, Ye = P;
957
+ if (s.eachChildOf(re, te, (P, x, he) => {
958
+ let be, We, He = P, Ne = P, Ye = P;
959
959
  if (typeof P == "number") {
960
960
  let Oe = P + fe;
961
961
  We = ye(Oe), Ne = Oe + de;
962
962
  let ce = P + ee;
963
- me = q(ce), o(a(We)) && (me = null), He = ce + Y, Ye = P + le, l(He >= 0, "p1PickKey is negative"), l(Ne >= 0, "p2DropKey is negative");
963
+ be = q(ce), o(a(We)) && (be = null), He = ce + Y, Ye = P + le, l(He >= 0, "p1PickKey is negative"), l(Ne >= 0, "p2DropKey is negative");
964
964
  const ke = o(a(x)), Ge = O(a(he));
965
965
  (ke || Ge && !$e) && le--, ke && ee--, Ge && fe--;
966
- } else me = q(P), We = ye(P);
967
- _e.descend(He), be.descend(Ne);
968
- const ze = k && !o(a(x)) ? U[Ye] : void 0, Se = g(me, x, he, We, ze, $e, be, _e);
969
- var je, S, ie;
970
- k && !$e ? ze !== Se && (X || (U = Array.isArray(U) ? U.slice() : Object.assign({}, U), X = !0), je = U, ie = Se, typeof (S = Ye) == "number" ? (l(Array.isArray(je)), l(S < je.length)) : (l(!Array.isArray(je)), l(je[S] !== void 0)), ie === void 0 ? typeof S == "number" ? je.splice(S, 1) : delete je[S] : je[S] = ie) : l(Se === void 0), be.ascend(), _e.ascend();
971
- }), q.end(), ye.end(), B != null) B.i = U;
972
- else if (!Te && !Me && Ee == null) return U;
973
- }(D, D.clone(), b, b.clone(), void 0, !1, C, G), C.reset(), C.mergeTree(G.get()), C.reset(), C.get(), $.map((g) => g.get()), j.map((g) => g.get()), D.traverse(C, (g, N) => {
966
+ } else be = q(P), We = ye(P);
967
+ _e.descend(He), me.descend(Ne);
968
+ const ze = k && !o(a(x)) ? M[Ye] : void 0, Se = g(be, x, he, We, ze, $e, me, _e);
969
+ var Te, S, ie;
970
+ k && !$e ? ze !== Se && (X || (M = Array.isArray(M) ? M.slice() : Object.assign({}, M), X = !0), Te = M, ie = Se, typeof (S = Ye) == "number" ? (l(Array.isArray(Te)), l(S < Te.length)) : (l(!Array.isArray(Te)), l(Te[S] !== void 0)), ie === void 0 ? typeof S == "number" ? Te.splice(S, 1) : delete Te[S] : Te[S] = ie) : l(Se === void 0), me.ascend(), _e.ascend();
971
+ }), q.end(), ye.end(), B != null) B.i = M;
972
+ else if (!je && !Ue && Ee == null) return M;
973
+ }(D, D.clone(), m, m.clone(), void 0, !1, C, G), C.reset(), C.mergeTree(G.get()), C.reset(), C.get(), $.map((g) => g.get()), T.map((g) => g.get()), D.traverse(C, (g, N) => {
974
974
  const re = g.p;
975
975
  if (re != null) {
976
- const te = m[re];
976
+ const te = b[re];
977
977
  te != null && N.write("p", te);
978
978
  const K = $[re];
979
979
  K && K.get(), K && N.mergeTree(K.get());
980
980
  } else g.r !== void 0 && N.write("r", g.r);
981
- }), C.reset(), C.get(), b.traverse(C, (g, N) => {
981
+ }), C.reset(), C.get(), m.traverse(C, (g, N) => {
982
982
  const re = g.d;
983
983
  if (re != null) {
984
984
  const K = I[re];
985
985
  K != null && N.write("d", K);
986
- const se = j[re];
986
+ const se = T[re];
987
987
  se && N.mergeTree(se.get());
988
988
  } else g.i !== void 0 && N.write("i", g.i);
989
989
  const te = ve(g);
990
- te && !T.has(g) && _(N, te, f(g));
990
+ te && !j.has(g) && _(N, te, f(g));
991
991
  }), C.get();
992
992
  }
993
993
  function ae(r) {
994
994
  if (r == null) return null;
995
- const u = new i.ReadCursor(r), y = new i.WriteCursor();
995
+ const u = new s.ReadCursor(r), y = new s.WriteCursor();
996
996
  let D;
997
- const b = [], C = [];
998
- return function $(j, p, v) {
999
- const m = j.getComponent();
1000
- let I, T = !1;
1001
- if (m) {
1002
- m.p != null && (p.write("d", m.p), b[m.p] = j.clone()), m.r !== void 0 && p.write("i", m.r), m.d != null && (p.write("p", m.d), v = void 0), m.i !== void 0 && (v = I = m.i);
1003
- const g = ve(m);
1004
- g && (v === void 0 ? (D || (D = /* @__PURE__ */ new Set()), D.add(m)) : (f(m), v = g.apply(v, f(m)), T = !0));
997
+ const m = [], C = [];
998
+ return function $(T, p, v) {
999
+ const b = T.getComponent();
1000
+ let I, j = !1;
1001
+ if (b) {
1002
+ b.p != null && (p.write("d", b.p), m[b.p] = T.clone()), b.r !== void 0 && p.write("i", b.r), b.d != null && (p.write("p", b.d), v = void 0), b.i !== void 0 && (v = I = b.i);
1003
+ const g = ve(b);
1004
+ g && (v === void 0 ? (D || (D = /* @__PURE__ */ new Set()), D.add(b)) : (f(b), v = g.apply(v, f(b)), j = !0));
1005
1005
  }
1006
1006
  let G = 0;
1007
- for (const g of j) {
1007
+ for (const g of T) {
1008
1008
  p.descend(g);
1009
1009
  const N = typeof g == "number" ? g - G : g, re = Z(v, N);
1010
- o(j.getComponent()) && G++;
1011
- const te = $(j, p, re);
1010
+ o(T.getComponent()) && G++;
1011
+ const te = $(T, p, re);
1012
1012
  if (v !== void 0 && te !== void 0) {
1013
- if (T || (T = !0, v = W(v)), !R(v, N)) throw Error("Cannot modify child - invalid operation");
1013
+ if (j || (j = !0, v = W(v)), !R(v, N)) throw Error("Cannot modify child - invalid operation");
1014
1014
  v[N] = te;
1015
1015
  }
1016
1016
  p.ascend();
1017
1017
  }
1018
- if (I === void 0) return T ? v : void 0;
1018
+ if (I === void 0) return j ? v : void 0;
1019
1019
  p.write("r", v);
1020
- }(u, y, void 0), D && (y.reset(), function $(j, p, v) {
1021
- const m = p.getComponent();
1022
- if (m) {
1023
- const g = m.d;
1024
- if (g != null && (j = b[g], v = C[g] = i.writeCursor()), D.has(m)) {
1025
- const N = ve(m);
1020
+ }(u, y, void 0), D && (y.reset(), function $(T, p, v) {
1021
+ const b = p.getComponent();
1022
+ if (b) {
1023
+ const g = b.d;
1024
+ if (g != null && (T = m[g], v = C[g] = s.writeCursor()), D.has(b)) {
1025
+ const N = ve(b);
1026
1026
  if (!N.invert) throw Error(`Cannot invert subtype ${N.name}`);
1027
- _(v, N, N.invert(f(m)));
1027
+ _(v, N, N.invert(f(b)));
1028
1028
  }
1029
1029
  }
1030
- let I = 0, T = 0;
1031
- const G = i.advancer(j, (g, N) => O(N) ? I - g - 1 : g - I, (g, N) => {
1030
+ let I = 0, j = 0;
1031
+ const G = s.advancer(T, (g, N) => O(N) ? I - g - 1 : g - I, (g, N) => {
1032
1032
  O(N) && I++;
1033
1033
  });
1034
1034
  for (const g of p) if (typeof g == "number") {
1035
- const N = g - T, re = G(N), te = N + I;
1036
- v.descend(te), $(re, p, v), o(p.getComponent()) && T++, v.ascend();
1035
+ const N = g - j, re = G(N), te = N + I;
1036
+ v.descend(te), $(re, p, v), o(p.getComponent()) && j++, v.ascend();
1037
1037
  } else v.descend(g), $(G(g), p, v), v.ascend();
1038
1038
  G.end();
1039
- }(u.clone(), u, y), C.length && (y.reset(), u.traverse(y, ($, j) => {
1039
+ }(u.clone(), u, y), C.length && (y.reset(), u.traverse(y, ($, T) => {
1040
1040
  const p = $.p;
1041
1041
  if (p != null) {
1042
1042
  const v = C[p];
1043
- v && v.get(), v && j.mergeTree(v.get());
1043
+ v && v.get(), v && T.mergeTree(v.get());
1044
1044
  }
1045
1045
  }))), y.get();
1046
1046
  }
@@ -1050,46 +1050,46 @@ function Lt() {
1050
1050
  var v;
1051
1051
  return p.r !== void 0 || ((v = ve(p)) === null || v === void 0 ? void 0 : v.makeInvertible) != null;
1052
1052
  })) return r;
1053
- const y = new i.ReadCursor(r), D = new i.WriteCursor();
1054
- let b = !1;
1055
- const C = [], $ = [], j = (p, v, m) => {
1053
+ const y = new s.ReadCursor(r), D = new s.WriteCursor();
1054
+ let m = !1;
1055
+ const C = [], $ = [], T = (p, v, b) => {
1056
1056
  const I = p.getComponent();
1057
- let T = !1;
1057
+ let j = !1;
1058
1058
  if (I) {
1059
1059
  I.d != null && v.write("d", I.d), I.i !== void 0 && v.write("i", I.i);
1060
1060
  const g = I.p;
1061
- if (g != null && (C[g] = p.clone(), l(m !== void 0, "Operation picks up at an invalid key"), $[g] = m, v.write("p", I.p)), I.r !== void 0 && m === void 0) throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");
1061
+ if (g != null && (C[g] = p.clone(), l(b !== void 0, "Operation picks up at an invalid key"), $[g] = b, v.write("p", I.p)), I.r !== void 0 && b === void 0) throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");
1062
1062
  const N = ve(I);
1063
- N && (N.makeInvertible ? b = !0 : _(v, N, f(I), !0));
1063
+ N && (N.makeInvertible ? m = !0 : _(v, N, f(I), !0));
1064
1064
  }
1065
1065
  let G = 0;
1066
1066
  for (const g of p) {
1067
1067
  v.descend(g);
1068
- const N = typeof g == "number" ? g - G : g, re = Z(m, N), te = j(p, v, re);
1069
- re !== te && (T || (T = !0, m = W(m)), te === void 0 ? (m = c(m, N), typeof g == "number" && G++) : m[N] = te), v.ascend();
1068
+ const N = typeof g == "number" ? g - G : g, re = Z(b, N), te = T(p, v, re);
1069
+ re !== te && (j || (j = !0, b = W(b)), te === void 0 ? (b = c(b, N), typeof g == "number" && G++) : b[N] = te), v.ascend();
1070
1070
  }
1071
- return I && (I.r !== void 0 ? (v.write("r", s.default(m)), m = void 0) : I.p != null && (m = void 0)), m;
1071
+ return I && (I.r !== void 0 ? (v.write("r", i.default(b)), b = void 0) : I.p != null && (b = void 0)), b;
1072
1072
  };
1073
- return j(y, D, u), D.get(), b && (D.reset(), function p(v, m, I, T, G) {
1074
- const g = m.getComponent();
1073
+ return T(y, D, u), D.get(), m && (D.reset(), function p(v, b, I, j, G) {
1074
+ const g = b.getComponent();
1075
1075
  if (g) {
1076
- g.i !== void 0 ? (T = g.i, G = !0) : g.d != null && (T = $[g.d], v = C[g.d], G = !1, g.d);
1076
+ g.i !== void 0 ? (j = g.i, G = !0) : g.d != null && (j = $[g.d], v = C[g.d], G = !1, g.d);
1077
1077
  let K = ve(g);
1078
1078
  if (K && K.makeInvertible) {
1079
1079
  const se = f(g);
1080
- _(I, K, K.makeInvertible(se, T), !0);
1080
+ _(I, K, K.makeInvertible(se, j), !0);
1081
1081
  }
1082
1082
  }
1083
1083
  let N = 0, re = 0;
1084
- const te = i.advancer(v, (K, se) => O(se) ? N - K - 1 : K - N, (K, se) => {
1084
+ const te = s.advancer(v, (K, se) => O(se) ? N - K - 1 : K - N, (K, se) => {
1085
1085
  O(se) && N++;
1086
1086
  });
1087
- for (const K of m) if (typeof K == "number") {
1088
- const se = K - re, Te = te(se), be = se + N, _e = Z(T, G ? se : be);
1089
- I.descend(K), p(Te, m, I, _e, G), o(m.getComponent()) && re++, I.ascend();
1087
+ for (const K of b) if (typeof K == "number") {
1088
+ const se = K - re, je = te(se), me = se + N, _e = Z(j, G ? se : me);
1089
+ I.descend(K), p(je, b, I, _e, G), o(b.getComponent()) && re++, I.ascend();
1090
1090
  } else {
1091
- const se = Z(T, K);
1092
- I.descend(K), p(te(K), m, I, se, G), I.ascend();
1091
+ const se = Z(j, K);
1092
+ I.descend(K), p(te(K), b, I, se, G), I.ascend();
1093
1093
  }
1094
1094
  te.end();
1095
1095
  }(y.clone(), y, D, u, !1)), D.get();
@@ -1114,87 +1114,87 @@ function Lt() {
1114
1114
  result: r
1115
1115
  };
1116
1116
  z(r), z(u);
1117
- let b = null;
1118
- const C = [], $ = [], j = [], p = [], v = [], m = [], I = [], T = [], G = [], g = [], N = [], re = [], te = [], K = [], se = [];
1119
- let Te = 0;
1120
- const be = i.readCursor(r), _e = i.readCursor(u), oe = i.writeCursor();
1121
- if (function Q(U, B = null, M) {
1117
+ let m = null;
1118
+ const C = [], $ = [], T = [], p = [], v = [], b = [], I = [], j = [], G = [], g = [], N = [], re = [], te = [], K = [], se = [];
1119
+ let je = 0;
1120
+ const me = s.readCursor(r), _e = s.readCursor(u), oe = s.writeCursor();
1121
+ if (function Q(M, B = null, U) {
1122
1122
  const A = a(B);
1123
- A && (A.r !== void 0 ? M = B.clone() : A.p != null && (M = null, m[A.p] = U.clone()));
1124
- const k = U.getComponent();
1123
+ A && (A.r !== void 0 ? U = B.clone() : A.p != null && (U = null, b[A.p] = M.clone()));
1124
+ const k = M.getComponent();
1125
1125
  let X;
1126
- k && (X = k.p) != null && (v[X] = B ? B.clone() : null, j[X] = U.clone(), M && (g[X] = !0, G[X] = M), A && A.p != null && (K[X] = A.p));
1127
- const Y = i.advancer(B);
1128
- for (const ee of U) Q(U, Y(ee), M);
1126
+ k && (X = k.p) != null && (v[X] = B ? B.clone() : null, T[X] = M.clone(), U && (g[X] = !0, G[X] = U), A && A.p != null && (K[X] = A.p));
1127
+ const Y = s.advancer(B);
1128
+ for (const ee of M) Q(M, Y(ee), U);
1129
1129
  Y.end();
1130
- }(_e, be, null), function Q(U, B, M, A, k) {
1131
- const X = M.getComponent();
1130
+ }(_e, me, null), function Q(M, B, U, A, k) {
1131
+ const X = U.getComponent();
1132
1132
  let Y, ee = !1;
1133
- X && ((Y = X.d) != null ? (p[Y] = M.clone(), A != null && (se[A] == null && (se[A] = []), se[A].push(Y)), U = v[Y] || null, B = j[Y] || null, g[Y] ? (k && (N[Y] = !0), k = G[Y] || null) : !k || D !== 1 && K[Y] != null || b == null && (b = {
1133
+ X && ((Y = X.d) != null ? (p[Y] = U.clone(), A != null && (se[A] == null && (se[A] = []), se[A].push(Y)), M = v[Y] || null, B = T[Y] || null, g[Y] ? (k && (N[Y] = !0), k = G[Y] || null) : !k || D !== 1 && K[Y] != null || m == null && (m = {
1134
1134
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1135
1135
  op1: n.removeOp(k.getPath()),
1136
- op2: n.moveOp(B.getPath(), M.getPath())
1137
- }), ee = !0) : X.i !== void 0 && (U = B = null, ee = !0, k && b == null && (b = {
1136
+ op2: n.moveOp(B.getPath(), U.getPath())
1137
+ }), ee = !0) : X.i !== void 0 && (M = B = null, ee = !0, k && m == null && (m = {
1138
1138
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1139
1139
  op1: n.removeOp(k.getPath()),
1140
- op2: n.insertOp(M.getPath(), X.i)
1140
+ op2: n.insertOp(U.getPath(), X.i)
1141
1141
  })));
1142
- const fe = a(U);
1143
- fe && (fe.r !== void 0 ? k = U.clone() : fe.p != null && (fe.p, A = fe.p, k = null));
1142
+ const fe = a(M);
1143
+ fe && (fe.r !== void 0 ? k = M.clone() : fe.p != null && (fe.p, A = fe.p, k = null));
1144
1144
  const de = ve(X);
1145
- de && k && b == null && (b = {
1145
+ de && k && m == null && (m = {
1146
1146
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1147
1147
  op1: n.removeOp(k.getPath()),
1148
- op2: n.editOp(M.getPath(), de, f(X), !0)
1148
+ op2: n.editOp(U.getPath(), de, f(X), !0)
1149
1149
  });
1150
1150
  let le = 0, ye = 0;
1151
- const q = i.advancer(B, (x, he) => O(he) ? le - x - 1 : x - le, (x, he) => {
1151
+ const q = s.advancer(B, (x, he) => O(he) ? le - x - 1 : x - le, (x, he) => {
1152
1152
  O(he) && le++;
1153
- }), P = i.advancer(U);
1154
- for (const x of M) if (typeof x == "number") {
1155
- const he = x - ye, me = q(he);
1156
- ye += +Q(P(he + le), me, M, A, k);
1153
+ }), P = s.advancer(M);
1154
+ for (const x of U) if (typeof x == "number") {
1155
+ const he = x - ye, be = q(he);
1156
+ ye += +Q(P(he + le), be, U, A, k);
1157
1157
  } else {
1158
1158
  const he = q(x);
1159
- Q(P(x), he, M, A, k);
1159
+ Q(P(x), he, U, A, k);
1160
1160
  }
1161
1161
  return q.end(), P.end(), ee;
1162
- }(be, _e, _e.clone(), null, null), p.map((Q) => Q && Q.get()), b) return {
1162
+ }(me, _e, _e.clone(), null, null), p.map((Q) => Q && Q.get()), m) return {
1163
1163
  ok: !1,
1164
- conflict: b
1164
+ conflict: m
1165
1165
  };
1166
1166
  N.map((Q) => !!Q);
1167
1167
  const Pe = [];
1168
- let Me = null;
1169
- (function Q(U, B, M, A, k) {
1168
+ let Ue = null;
1169
+ (function Q(M, B, U, A, k) {
1170
1170
  let X = !1;
1171
1171
  const Y = a(B);
1172
1172
  if (O(Y)) {
1173
1173
  const q = Y.p;
1174
- q != null ? (M = p[q], A = re[q] = i.writeCursor(), X = !0, k = null) : (M = null, k = B.clone());
1175
- } else o(a(M)) && (M = null);
1176
- const ee = U.getComponent();
1174
+ q != null ? (U = p[q], A = re[q] = s.writeCursor(), X = !0, k = null) : (U = null, k = B.clone());
1175
+ } else o(a(U)) && (U = null);
1176
+ const ee = M.getComponent();
1177
1177
  if (ee) {
1178
1178
  const q = ee.p;
1179
- q != null ? (k && (T[q] = k), Pe[q] = k || D === 1 && X ? null : A.getComponent(), C[q] = U.clone(), M && (I[q] = M.clone())) : ee.r !== void 0 && (k || A.write("r", !0), (k || X) && (Me == null && (Me = /* @__PURE__ */ new Set()), Me.add(ee)));
1179
+ q != null ? (k && (j[q] = k), Pe[q] = k || D === 1 && X ? null : A.getComponent(), C[q] = M.clone(), U && (I[q] = U.clone())) : ee.r !== void 0 && (k || A.write("r", !0), (k || X) && (Ue == null && (Ue = /* @__PURE__ */ new Set()), Ue.add(ee)));
1180
1180
  }
1181
1181
  let fe = 0, de = 0;
1182
- const le = i.advancer(B, void 0, (q, P) => {
1182
+ const le = s.advancer(B, void 0, (q, P) => {
1183
1183
  O(P) && fe++;
1184
- }), ye = i.advancer(M, (q, P) => o(P) ? ~(q - de) : q - de, (q, P) => {
1184
+ }), ye = s.advancer(U, (q, P) => o(P) ? ~(q - de) : q - de, (q, P) => {
1185
1185
  o(P) && de++;
1186
1186
  });
1187
- if (U) for (const q of U) if (typeof q == "string") {
1187
+ if (M) for (const q of M) if (typeof q == "string") {
1188
1188
  const P = le(q), x = ye(q);
1189
- A.descend(q), Q(U, P, x, A, k), A.ascend();
1189
+ A.descend(q), Q(M, P, x, A, k), A.ascend();
1190
1190
  } else {
1191
- const P = le(q), x = q - fe, he = O(a(P)) ? null : ye(x), me = x + de;
1192
- l(me >= 0), A.descend(me), Q(U, P, he, A, k), A.ascend();
1191
+ const P = le(q), x = q - fe, he = O(a(P)) ? null : ye(x), be = x + de;
1192
+ l(be >= 0), A.descend(be), Q(M, P, he, A, k), A.ascend();
1193
1193
  }
1194
1194
  le.end(), ye.end();
1195
- })(be, _e, _e.clone(), oe, null), oe.reset();
1195
+ })(me, _e, _e.clone(), oe, null), oe.reset();
1196
1196
  let Le = [];
1197
- if (function Q(U, B, M, A, k, X) {
1197
+ if (function Q(M, B, U, A, k, X) {
1198
1198
  l(B);
1199
1199
  const Y = B.getComponent();
1200
1200
  let ee = a(A), fe = !1;
@@ -1206,31 +1206,31 @@ function Lt() {
1206
1206
  let Oe = !1;
1207
1207
  if (Y.i !== void 0 || S != null && ie) {
1208
1208
  let ce;
1209
- ee && (ee.i !== void 0 || (ce = ee.d) != null && !g[ce]) && (Oe = ce != null ? S != null && S === K[ce] : t.default(ee.i, Y.i), Oe || ce != null && D !== 1 && K[ce] != null || b == null && (b = {
1209
+ ee && (ee.i !== void 0 || (ce = ee.d) != null && !g[ce]) && (Oe = ce != null ? S != null && S === K[ce] : t.default(ee.i, Y.i), Oe || ce != null && D !== 1 && K[ce] != null || m == null && (m = {
1210
1210
  type: d.ConflictType.DROP_COLLISION,
1211
1211
  op1: de(S != null ? C[S] : null, B, Y),
1212
- op2: de(ce != null ? j[ce] : null, A, ee)
1213
- })), Oe || (X ? b == null && (b = {
1212
+ op2: de(ce != null ? T[ce] : null, A, ee)
1213
+ })), Oe || (X ? m == null && (m = {
1214
1214
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1215
1215
  op1: de(S != null ? C[S] : null, B, Y),
1216
1216
  op2: n.removeOp(X.getPath())
1217
- }) : (S != null ? (Le[Te] = S, k.write("d", ie.p = Te++)) : k.write("i", s.default(Y.i)), fe = !0));
1217
+ }) : (S != null ? (Le[je] = S, k.write("d", ie.p = je++)) : k.write("i", i.default(Y.i)), fe = !0));
1218
1218
  } else if (S != null && !ie) {
1219
- const ce = T[S];
1219
+ const ce = j[S];
1220
1220
  ce && (X = ce.clone());
1221
1221
  }
1222
- S != null ? (U = C[S], M = m[S], A = I[S]) : Y.i !== void 0 && (U = M = null, Oe || (A = null));
1223
- } else O(a(U)) && (U = M = A = null);
1224
- const le = a(U), ye = a(M);
1222
+ S != null ? (M = C[S], U = b[S], A = I[S]) : Y.i !== void 0 && (M = U = null, Oe || (A = null));
1223
+ } else O(a(M)) && (M = U = A = null);
1224
+ const le = a(M), ye = a(U);
1225
1225
  if (O(ye)) {
1226
1226
  const S = ye.p;
1227
- ye.r !== void 0 && (!le || le.r === void 0) || g[S] ? (A = null, X = M.clone()) : S != null && (A = p[S], D !== 1 && K[S] != null || ((k = te[S]) || (k = te[S] = i.writeCursor()), k.reset(), X = null));
1227
+ ye.r !== void 0 && (!le || le.r === void 0) || g[S] ? (A = null, X = U.clone()) : S != null && (A = p[S], D !== 1 && K[S] != null || ((k = te[S]) || (k = te[S] = s.writeCursor()), k.reset(), X = null));
1228
1228
  } else !o(Y) && o(ee) && (A = null);
1229
1229
  ee = A != null ? A.getComponent() : null;
1230
1230
  const q = ve(Y);
1231
1231
  if (q) {
1232
1232
  const S = f(Y);
1233
- if (X) b == null && (b = {
1233
+ if (X) m == null && (m = {
1234
1234
  type: d.ConflictType.RM_UNEXPECTED_CONTENT,
1235
1235
  op1: n.editOp(B.getPath(), q, S, !0),
1236
1236
  op2: n.removeOp(X.getPath())
@@ -1242,32 +1242,32 @@ function Lt() {
1242
1242
  if (q !== ie) throw Error("Transforming incompatible types");
1243
1243
  const ce = f(ee);
1244
1244
  Oe = q.transform(S, ce, y);
1245
- } else Oe = s.default(S);
1245
+ } else Oe = i.default(S);
1246
1246
  _(k, q, Oe);
1247
1247
  }
1248
1248
  }
1249
- let P = 0, x = 0, he = 0, me = 0, We = 0, He = 0, Ne = U != null && U.descendFirst(), Ye = Ne;
1250
- const ze = i.advancer(M, void 0, (S, ie) => {
1249
+ let P = 0, x = 0, he = 0, be = 0, We = 0, He = 0, Ne = M != null && M.descendFirst(), Ye = Ne;
1250
+ const ze = s.advancer(U, void 0, (S, ie) => {
1251
1251
  O(ie) && he++;
1252
1252
  });
1253
- let Se = A != null && A.descendFirst(), je = Se;
1253
+ let Se = A != null && A.descendFirst(), Te = Se;
1254
1254
  for (const S of B) if (typeof S == "number") {
1255
1255
  let ie;
1256
1256
  const Oe = o(B.getComponent()), ce = S - x;
1257
1257
  {
1258
1258
  let Be;
1259
- for (; Ne && typeof (Be = U.getKey()) == "number"; ) {
1259
+ for (; Ne && typeof (Be = M.getKey()) == "number"; ) {
1260
1260
  Be += P;
1261
- const Re = U.getComponent(), Xe = O(Re);
1261
+ const Re = M.getComponent(), Xe = O(Re);
1262
1262
  if (Be > ce || Be === ce && (!Xe || D === 0 && Oe)) break;
1263
1263
  if (Xe) {
1264
1264
  P--;
1265
1265
  const Ke = Re.p;
1266
- K.includes(Ke), Re.d, a(te[Re.d]), O(a(te[Re.d])), (Re.r === void 0 || Me && Me.has(Re)) && (Ke == null || !Pe[Ke] || D !== 1 && K.includes(Ke)) || We--;
1266
+ K.includes(Ke), Re.d, a(te[Re.d]), O(a(te[Re.d])), (Re.r === void 0 || Ue && Ue.has(Re)) && (Ke == null || !Pe[Ke] || D !== 1 && K.includes(Ke)) || We--;
1267
1267
  }
1268
- Ne = U.nextSibling();
1268
+ Ne = M.nextSibling();
1269
1269
  }
1270
- ie = Ne && Be === ce ? U : null;
1270
+ ie = Ne && Be === ce ? M : null;
1271
1271
  }
1272
1272
  const ke = ce - P;
1273
1273
  let Ge = ze(ke);
@@ -1276,7 +1276,7 @@ function Lt() {
1276
1276
  {
1277
1277
  let Be, Re;
1278
1278
  for (; Se && typeof (Be = A.getKey()) == "number"; ) {
1279
- Re = Be - me;
1279
+ Re = Be - be;
1280
1280
  const Xe = A.getComponent(), Ke = o(Xe);
1281
1281
  if (Re > rt) break;
1282
1282
  if (Re === rt) {
@@ -1295,48 +1295,48 @@ function Lt() {
1295
1295
  }
1296
1296
  if (Ke) {
1297
1297
  const Ve = Xe.d;
1298
- K[Ve], Xe.i === void 0 && (g[Ve] || K[Ve] != null && D !== 1) ? (g[Ve] || K[Ve] != null && D === 0) && (me++, He--) : me++;
1298
+ K[Ve], Xe.i === void 0 && (g[Ve] || K[Ve] != null && D !== 1) ? (g[Ve] || K[Ve] != null && D === 0) && (be++, He--) : be++;
1299
1299
  }
1300
1300
  Se = A.nextSibling();
1301
1301
  }
1302
1302
  }
1303
- const Ot = rt + me + We + He;
1303
+ const Ot = rt + be + We + He;
1304
1304
  l(Ot >= 0, "trying to descend to a negative index"), k.descend(Ot), Oe && (ie = Ge = Je = null, x++), Q(ie, B, Ge, Je, k, X) && He++, k.ascend();
1305
1305
  } else {
1306
1306
  let ie;
1307
- for (; Ne && (ie = U.getKey(), typeof ie != "string" || !(ie > S || ie === S)); ) Ne = U.nextSibling();
1308
- const Oe = Ne && ie === S ? U : null, ce = ze(S);
1307
+ for (; Ne && (ie = M.getKey(), typeof ie != "string" || !(ie > S || ie === S)); ) Ne = M.nextSibling();
1308
+ const Oe = Ne && ie === S ? M : null, ce = ze(S);
1309
1309
  let ke;
1310
1310
  for (; Se && (ke = A.getKey(), typeof ke != "string" || !(ke > S || ke === S)); ) Se = A.nextSibling();
1311
1311
  const Ge = Se && ke === S ? A : null;
1312
1312
  k.descend(S), Q(Oe, B, ce, Ge, k, X), k.ascend();
1313
1313
  }
1314
- return ze.end(), Ye && U.ascend(), je && A.ascend(), fe;
1315
- }(be, be.clone(), _e, _e.clone(), oe, null), b) return {
1314
+ return ze.end(), Ye && M.ascend(), Te && A.ascend(), fe;
1315
+ }(me, me.clone(), _e, _e.clone(), oe, null), m) return {
1316
1316
  ok: !1,
1317
- conflict: b
1317
+ conflict: m
1318
1318
  };
1319
1319
  oe.reset();
1320
- const Ue = (Q, U, B) => Q.traverse(U, (M, A) => {
1321
- M.d != null && B(M.d, Q, A);
1320
+ const Me = (Q, M, B) => Q.traverse(M, (U, A) => {
1321
+ U.d != null && B(U.d, Q, A);
1322
1322
  });
1323
- (g.length || re.length) && (Ue(_e, oe, (Q, U, B) => {
1323
+ (g.length || re.length) && (Me(_e, oe, (Q, M, B) => {
1324
1324
  g[Q] && !N[Q] && B.write("r", !0), re[Q] && B.mergeTree(re[Q].get());
1325
1325
  }), oe.reset());
1326
1326
  const Ee = [], $e = [];
1327
- if ((te.length || g.length) && !b) {
1328
- const Q = i.readCursor(tt(oe.get()));
1329
- if (Ue(Q, null, (U, B) => {
1330
- Ee[U] = B.clone();
1331
- }), te.forEach((U) => {
1332
- U && Ue(i.readCursor(U.get()), null, (B, M) => {
1333
- Ee[B] = M.clone();
1327
+ if ((te.length || g.length) && !m) {
1328
+ const Q = s.readCursor(tt(oe.get()));
1329
+ if (Me(Q, null, (M, B) => {
1330
+ Ee[M] = B.clone();
1331
+ }), te.forEach((M) => {
1332
+ M && Me(s.readCursor(M.get()), null, (B, U) => {
1333
+ Ee[B] = U.clone();
1334
1334
  });
1335
- }), function U(B, M, A, k, X, Y) {
1336
- const ee = a(M);
1335
+ }), function M(B, U, A, k, X, Y) {
1336
+ const ee = a(U);
1337
1337
  if (ee && O(ee)) if (ee.p != null) {
1338
1338
  const P = ee.p;
1339
- Ee[P].getPath(), A = Ee[P], k = $e[P] = i.writeCursor();
1339
+ Ee[P].getPath(), A = Ee[P], k = $e[P] = s.writeCursor();
1340
1340
  } else ee.r !== void 0 && (A = null);
1341
1341
  else o(a(A)) && (A = null);
1342
1342
  const fe = B.getComponent();
@@ -1344,52 +1344,52 @@ function Lt() {
1344
1344
  let P;
1345
1345
  if ((P = fe.d) != null) {
1346
1346
  const x = te[P];
1347
- x && (x.get(), k.mergeTree(x.get()), A = i.readCursor(x.get()));
1347
+ x && (x.get(), k.mergeTree(x.get()), A = s.readCursor(x.get()));
1348
1348
  }
1349
1349
  }
1350
1350
  let de = 0, le = 0;
1351
- const ye = i.advancer(M, void 0, (P, x) => {
1351
+ const ye = s.advancer(U, void 0, (P, x) => {
1352
1352
  O(x) && de--;
1353
- }), q = i.advancer(A, (P, x) => o(x) ? -(P - le) - 1 : P - le, (P, x) => {
1353
+ }), q = s.advancer(A, (P, x) => o(x) ? -(P - le) - 1 : P - le, (P, x) => {
1354
1354
  o(x) && le++;
1355
1355
  });
1356
1356
  for (const P of B) if (typeof P == "number") {
1357
- const x = ye(P), he = P + de, me = q(he), We = he + le;
1358
- k.descend(We), U(B, x, me, k), k.ascend();
1359
- } else k.descend(P), U(B, ye(P), q(P), k), k.ascend();
1357
+ const x = ye(P), he = P + de, be = q(he), We = he + le;
1358
+ k.descend(We), M(B, x, be, k), k.ascend();
1359
+ } else k.descend(P), M(B, ye(P), q(P), k), k.ascend();
1360
1360
  ye.end(), q.end();
1361
- }(_e, Q, Q.clone(), oe), oe.reset(), b) return {
1361
+ }(_e, Q, Q.clone(), oe), oe.reset(), m) return {
1362
1362
  ok: !1,
1363
- conflict: b
1363
+ conflict: m
1364
1364
  };
1365
1365
  if (oe.get(), $e.length) {
1366
- const U = $e.map((M) => M ? M.get() : null), B = i.readCursor(tt(oe.get()));
1367
- if (Ue(B, oe, (M, A, k) => {
1368
- const X = U[M];
1369
- X && (k.mergeTree(X), U[M] = null);
1370
- }), U.find((M) => M)) {
1371
- const M = i.writeCursor(), A = i.writeCursor();
1366
+ const M = $e.map((U) => U ? U.get() : null), B = s.readCursor(tt(oe.get()));
1367
+ if (Me(B, oe, (U, A, k) => {
1368
+ const X = M[U];
1369
+ X && (k.mergeTree(X), M[U] = null);
1370
+ }), M.find((U) => U)) {
1371
+ const U = s.writeCursor(), A = s.writeCursor();
1372
1372
  let k = 0, X = 0;
1373
- U.forEach((Y) => {
1374
- Y != null && Ue(i.readCursor(Y), null, (ee) => {
1373
+ M.forEach((Y) => {
1374
+ Y != null && Me(s.readCursor(Y), null, (ee) => {
1375
1375
  const fe = Le[ee];
1376
- M.writeMove(C[fe].getPath(), $[fe].getPath(), k++);
1376
+ U.writeMove(C[fe].getPath(), $[fe].getPath(), k++);
1377
1377
  const de = se[fe];
1378
1378
  de && de.forEach((le) => {
1379
- g[le] || D !== 1 && K[le] != null || A.writeMove(j[le].getPath(), p[le].getPath(), X++);
1379
+ g[le] || D !== 1 && K[le] != null || A.writeMove(T[le].getPath(), p[le].getPath(), X++);
1380
1380
  });
1381
1381
  });
1382
- }), b = {
1382
+ }), m = {
1383
1383
  type: d.ConflictType.BLACKHOLE,
1384
- op1: M.get(),
1384
+ op1: U.get(),
1385
1385
  op2: A.get()
1386
1386
  };
1387
1387
  }
1388
1388
  }
1389
1389
  }
1390
- return b ? {
1390
+ return m ? {
1391
1391
  ok: !1,
1392
- conflict: b
1392
+ conflict: m
1393
1393
  } : {
1394
1394
  ok: !0,
1395
1395
  result: oe.get()
@@ -1405,36 +1405,36 @@ function Lt() {
1405
1405
  gt(D.conflict);
1406
1406
  }
1407
1407
  const qe = (r) => {
1408
- const u = i.writeCursor();
1409
- return i.readCursor(r).traverse(u, (y, D) => {
1408
+ const u = s.writeCursor();
1409
+ return s.readCursor(r).traverse(u, (y, D) => {
1410
1410
  (o(y) || ve(y)) && D.write("r", !0);
1411
1411
  }), u.get();
1412
1412
  }, At = (r, u) => {
1413
- const { type: y, op1: D, op2: b } = r;
1413
+ const { type: y, op1: D, op2: m } = r;
1414
1414
  switch (y) {
1415
1415
  case d.ConflictType.DROP_COLLISION:
1416
- return u === "left" ? [null, qe(b)] : [qe(D), null];
1416
+ return u === "left" ? [null, qe(m)] : [qe(D), null];
1417
1417
  case d.ConflictType.RM_UNEXPECTED_CONTENT:
1418
1418
  let C = !1;
1419
- return i.readCursor(D).traverse(null, ($) => {
1419
+ return s.readCursor(D).traverse(null, ($) => {
1420
1420
  $.r !== void 0 && (C = !0);
1421
- }), C ? [null, qe(b)] : [qe(D), null];
1421
+ }), C ? [null, qe(m)] : [qe(D), null];
1422
1422
  case d.ConflictType.BLACKHOLE:
1423
- return [qe(D), qe(b)];
1423
+ return [qe(D), qe(m)];
1424
1424
  default:
1425
1425
  throw Error("Unrecognised conflict: " + y);
1426
1426
  }
1427
1427
  };
1428
1428
  function _t(r, u, y, D) {
1429
- let b = null;
1429
+ let m = null;
1430
1430
  for (; ; ) {
1431
1431
  const C = nt(u, y, D);
1432
- if (C.ok) return ne(b, C.result);
1432
+ if (C.ok) return ne(m, C.result);
1433
1433
  {
1434
1434
  const { conflict: $ } = C;
1435
1435
  r($) || gt($);
1436
- const [j, p] = At($, D);
1437
- u = ne(H(u), j), y = ne(H(y), p), b = ne(b, p);
1436
+ const [T, p] = At($, D);
1437
+ u = ne(H(u), T), y = ne(H(y), p), m = ne(m, p);
1438
1438
  }
1439
1439
  }
1440
1440
  }
@@ -1450,15 +1450,15 @@ function Lt() {
1450
1450
  for (var a in d) a !== "default" && !l.hasOwnProperty(a) && e(l, d, a);
1451
1451
  };
1452
1452
  Object.defineProperty(n, "__esModule", { value: !0 }), t(Ct, n);
1453
- var s = ft;
1453
+ var i = ft;
1454
1454
  Object.defineProperty(n, "ReadCursor", { enumerable: !0, get: function() {
1455
- return s.ReadCursor;
1455
+ return i.ReadCursor;
1456
1456
  } }), Object.defineProperty(n, "WriteCursor", { enumerable: !0, get: function() {
1457
- return s.WriteCursor;
1457
+ return i.WriteCursor;
1458
1458
  } });
1459
- var i = ht;
1459
+ var s = ht;
1460
1460
  Object.defineProperty(n, "ConflictType", { enumerable: !0, get: function() {
1461
- return i.ConflictType;
1461
+ return s.ConflictType;
1462
1462
  } });
1463
1463
  })(F);
1464
1464
  class Ht {
@@ -1509,10 +1509,8 @@ class Ht {
1509
1509
  }
1510
1510
  refreshTransform(e) {
1511
1511
  e.forEach((t) => {
1512
- if (this.getDrawingByParam(t) == null)
1513
- return;
1514
1512
  const i = this._getCurrentBySearch(t);
1515
- i != null && (i.transform = t.transform);
1513
+ i != null && (i.transform = t.transform, i.transforms = t.transforms, i.isMultiTransform = t.isMultiTransform);
1516
1514
  }), this.refreshTransformNotification(e);
1517
1515
  }
1518
1516
  getDrawingDataForUnit(e) {
@@ -1523,25 +1521,25 @@ class Ht {
1523
1521
  if (t == null)
1524
1522
  return;
1525
1523
  delete this.drawingManagerData[e];
1526
- const s = [];
1527
- Object.keys(t).forEach((i) => {
1528
- const d = t[i];
1524
+ const i = [];
1525
+ Object.keys(t).forEach((s) => {
1526
+ const d = t[s];
1529
1527
  (d == null ? void 0 : d.data) != null && Object.keys(d.data).forEach((l) => {
1530
- s.push({ unitId: e, subUnitId: i, drawingId: l });
1528
+ i.push({ unitId: e, subUnitId: s, drawingId: l });
1531
1529
  });
1532
- }), s.length > 0 && this.removeNotification(s);
1530
+ }), i.length > 0 && this.removeNotification(i);
1533
1531
  }
1534
1532
  registerDrawingData(e, t) {
1535
1533
  this.drawingManagerData[e] = t;
1536
1534
  }
1537
1535
  initializeNotification(e) {
1538
- const t = [], s = this.drawingManagerData[e];
1539
- s != null && (Object.keys(s).forEach((i) => {
1540
- this._establishDrawingMap(e, i);
1541
- const d = s[i];
1536
+ const t = [], i = this.drawingManagerData[e];
1537
+ i != null && (Object.keys(i).forEach((s) => {
1538
+ this._establishDrawingMap(e, s);
1539
+ const d = i[s];
1542
1540
  Object.keys(d.data).forEach((l) => {
1543
1541
  const a = d.data[l];
1544
- a.unitId = e, a.subUnitId = i, t.push(a);
1542
+ a.unitId = e, a.subUnitId = s, t.push(a);
1545
1543
  });
1546
1544
  }), t.length > 0 && this.addNotification(t));
1547
1545
  }
@@ -1549,34 +1547,34 @@ class Ht {
1549
1547
  return this._getDrawingData(e, t);
1550
1548
  }
1551
1549
  // Use in doc only.
1552
- setDrawingData(e, t, s) {
1553
- this.drawingManagerData[e][t].data = s;
1550
+ setDrawingData(e, t, i) {
1551
+ this.drawingManagerData[e][t].data = i;
1554
1552
  }
1555
1553
  getBatchAddOp(e) {
1556
- const t = [], s = [], i = [];
1554
+ const t = [], i = [], s = [];
1557
1555
  e.forEach((W) => {
1558
1556
  const { op: O, invertOp: o } = this._addByParam(W);
1559
- t.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), s.push(O), i.push(o);
1557
+ t.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), i.push(O), s.push(o);
1560
1558
  });
1561
- const d = s.reduce(F.type.compose, null), l = i.reduce(F.type.compose, null), { unitId: a, subUnitId: E } = e[0];
1559
+ const d = i.reduce(F.type.compose, null), l = s.reduce(F.type.compose, null), { unitId: a, subUnitId: E } = e[0];
1562
1560
  return { undo: l, redo: d, unitId: a, subUnitId: E, objects: t };
1563
1561
  }
1564
1562
  getBatchRemoveOp(e) {
1565
- const t = [], s = [];
1563
+ const t = [], i = [];
1566
1564
  e.forEach((E) => {
1567
1565
  const { op: W, invertOp: O } = this._removeByParam(E);
1568
- t.push(W), s.push(O);
1566
+ t.push(W), i.push(O);
1569
1567
  });
1570
- const i = t.reduce(F.type.compose, null), d = s.reduce(F.type.compose, null), { unitId: l, subUnitId: a } = e[0];
1571
- return { undo: d, redo: i, unitId: l, subUnitId: a, objects: e };
1568
+ const s = t.reduce(F.type.compose, null), d = i.reduce(F.type.compose, null), { unitId: l, subUnitId: a } = e[0];
1569
+ return { undo: d, redo: s, unitId: l, subUnitId: a, objects: e };
1572
1570
  }
1573
1571
  getBatchUpdateOp(e) {
1574
- const t = [], s = [], i = [];
1572
+ const t = [], i = [], s = [];
1575
1573
  e.forEach((W) => {
1576
1574
  const { op: O, invertOp: o } = this._updateByParam(W);
1577
- t.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), s.push(O), i.push(o);
1575
+ t.push({ unitId: W.unitId, subUnitId: W.subUnitId, drawingId: W.drawingId }), i.push(O), s.push(o);
1578
1576
  });
1579
- const d = s.reduce(F.type.compose, null), l = i.reduce(F.type.compose, null), { unitId: a, subUnitId: E } = e[0];
1577
+ const d = i.reduce(F.type.compose, null), l = s.reduce(F.type.compose, null), { unitId: a, subUnitId: E } = e[0];
1580
1578
  return { undo: l, redo: d, unitId: a, subUnitId: E, objects: t };
1581
1579
  }
1582
1580
  removeNotification(e) {
@@ -1601,61 +1599,61 @@ class Ht {
1601
1599
  this._refreshTransform$.next(e);
1602
1600
  }
1603
1601
  getGroupDrawingOp(e) {
1604
- const t = [], { unitId: s, subUnitId: i } = e[0].parent;
1602
+ const t = [], { unitId: i, subUnitId: s } = e[0].parent;
1605
1603
  e.forEach((a) => {
1606
1604
  t.push(this._getGroupDrawingOp(a));
1607
1605
  });
1608
1606
  const d = t.reduce(F.type.compose, null);
1609
- return { undo: F.type.invertWithDoc(d, this.drawingManagerData), redo: d, unitId: s, subUnitId: i, objects: e };
1607
+ return { undo: F.type.invertWithDoc(d, this.drawingManagerData), redo: d, unitId: i, subUnitId: s, objects: e };
1610
1608
  }
1611
1609
  getUngroupDrawingOp(e) {
1612
- const t = [], { unitId: s, subUnitId: i } = e[0].parent;
1610
+ const t = [], { unitId: i, subUnitId: s } = e[0].parent;
1613
1611
  e.forEach((a) => {
1614
1612
  t.push(this._getUngroupDrawingOp(a));
1615
1613
  });
1616
1614
  const d = t.reduce(F.type.compose, null);
1617
- return { undo: F.type.invertWithDoc(d, this.drawingManagerData), redo: d, unitId: s, subUnitId: i, objects: e };
1615
+ return { undo: F.type.invertWithDoc(d, this.drawingManagerData), redo: d, unitId: i, subUnitId: s, objects: e };
1618
1616
  }
1619
1617
  getDrawingsByGroup(e) {
1620
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1621
- if (this.getDrawingByParam({ unitId: t, subUnitId: s, drawingId: i }) == null)
1618
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1619
+ if (this.getDrawingByParam({ unitId: t, subUnitId: i, drawingId: s }) == null)
1622
1620
  return [];
1623
- const l = this._getDrawingData(t, s), a = [];
1621
+ const l = this._getDrawingData(t, i), a = [];
1624
1622
  return Object.keys(l).forEach((E) => {
1625
1623
  const W = l[E];
1626
- W.groupId === i && a.push(W);
1624
+ W.groupId === s && a.push(W);
1627
1625
  }), a;
1628
1626
  }
1629
1627
  _getGroupDrawingOp(e) {
1630
- const { parent: t, children: s } = e, { unitId: i, subUnitId: d, drawingId: l } = t, a = [];
1628
+ const { parent: t, children: i } = e, { unitId: s, subUnitId: d, drawingId: l } = t, a = [];
1631
1629
  a.push(
1632
- F.insertOp([i, d, "data", l], t)
1630
+ F.insertOp([s, d, "data", l], t)
1633
1631
  );
1634
1632
  let E = Number.NEGATIVE_INFINITY;
1635
- return s.forEach((W) => {
1633
+ return i.forEach((W) => {
1636
1634
  const { unitId: O, subUnitId: o, drawingId: c } = W, h = this._hasDrawingOrder({ unitId: O, subUnitId: o, drawingId: c });
1637
1635
  E = Math.max(E, h), a.push(
1638
1636
  ...this._getUpdateParamCompareOp(W, this.getDrawingByParam({ unitId: O, subUnitId: o, drawingId: c }))
1639
1637
  );
1640
- }), E === Number.NEGATIVE_INFINITY && (E = this._getDrawingOrder(i, d).length), a.push(
1641
- F.insertOp([i, d, "order", E], l)
1638
+ }), E === Number.NEGATIVE_INFINITY && (E = this._getDrawingOrder(s, d).length), a.push(
1639
+ F.insertOp([s, d, "order", E], l)
1642
1640
  ), a.reduce(F.type.compose, null);
1643
1641
  }
1644
1642
  _getUngroupDrawingOp(e) {
1645
- const { parent: t, children: s } = e, { unitId: i, subUnitId: d, drawingId: l } = t, a = [];
1646
- return s.forEach((E) => {
1643
+ const { parent: t, children: i } = e, { unitId: s, subUnitId: d, drawingId: l } = t, a = [];
1644
+ return i.forEach((E) => {
1647
1645
  const { unitId: W, subUnitId: O, drawingId: o } = E;
1648
1646
  a.push(
1649
1647
  ...this._getUpdateParamCompareOp(E, this.getDrawingByParam({ unitId: W, subUnitId: O, drawingId: o }))
1650
1648
  );
1651
1649
  }), a.push(
1652
- F.removeOp([i, d, "data", l], !0)
1650
+ F.removeOp([s, d, "data", l], !0)
1653
1651
  ), a.push(
1654
- F.removeOp([i, d, "order", this._getDrawingOrder(i, d).indexOf(l)], !0)
1652
+ F.removeOp([s, d, "order", this._getDrawingOrder(s, d).indexOf(l)], !0)
1655
1653
  ), a.reduce(F.type.compose, null);
1656
1654
  }
1657
- applyJson1(e, t, s) {
1658
- this._establishDrawingMap(e, t), this._oldDrawingManagerData = { ...this.drawingManagerData }, this.drawingManagerData = F.type.apply(this.drawingManagerData, s);
1655
+ applyJson1(e, t, i) {
1656
+ this._establishDrawingMap(e, t), this._oldDrawingManagerData = { ...this.drawingManagerData }, this.drawingManagerData = F.type.apply(this.drawingManagerData, i);
1659
1657
  }
1660
1658
  // private _fillMissingFields(jsonOp: JSONOp) {
1661
1659
  // if (jsonOp == null) {
@@ -1702,8 +1700,8 @@ class Ht {
1702
1700
  return this._getOldBySearch(e);
1703
1701
  }
1704
1702
  getDrawingOKey(e) {
1705
- const [t, s, i] = e.split("#-#");
1706
- return this._getCurrentBySearch({ unitId: t, subUnitId: s, drawingId: i });
1703
+ const [t, i, s] = e.split("#-#");
1704
+ return this._getCurrentBySearch({ unitId: t, subUnitId: i, drawingId: s });
1707
1705
  }
1708
1706
  focusDrawing(e) {
1709
1707
  if (e == null) {
@@ -1711,9 +1709,9 @@ class Ht {
1711
1709
  return;
1712
1710
  }
1713
1711
  const t = [];
1714
- e.forEach((s) => {
1712
+ e.forEach((i) => {
1715
1713
  var E;
1716
- const { unitId: i, subUnitId: d, drawingId: l } = s, a = (E = this._getDrawingData(i, d)) == null ? void 0 : E[l];
1714
+ const { unitId: s, subUnitId: d, drawingId: l } = i, a = (E = this._getDrawingData(s, d)) == null ? void 0 : E[l];
1717
1715
  a != null && t.push(a);
1718
1716
  }), t.length > 0 && (this._focusDrawings = t, this._focus$.next(t));
1719
1717
  }
@@ -1721,7 +1719,7 @@ class Ht {
1721
1719
  const e = [];
1722
1720
  return this._focusDrawings.forEach((t) => {
1723
1721
  var a;
1724
- const { unitId: s, subUnitId: i, drawingId: d } = t, l = (a = this._getDrawingData(s, i)) == null ? void 0 : a[d];
1722
+ const { unitId: i, subUnitId: s, drawingId: d } = t, l = (a = this._getDrawingData(i, s)) == null ? void 0 : a[d];
1725
1723
  l != null && e.push(l);
1726
1724
  }), e;
1727
1725
  }
@@ -1729,107 +1727,107 @@ class Ht {
1729
1727
  return this._getDrawingOrder(e, t);
1730
1728
  }
1731
1729
  // Use in doc only.
1732
- setDrawingOrder(e, t, s) {
1733
- this.drawingManagerData[e][t].order = s;
1730
+ setDrawingOrder(e, t, i) {
1731
+ this.drawingManagerData[e][t].order = i;
1734
1732
  }
1735
1733
  orderUpdateNotification(e) {
1736
1734
  this._order$.next(e);
1737
1735
  }
1738
1736
  getForwardDrawingsOp(e) {
1739
- const { unitId: t, subUnitId: s, drawingIds: i } = e, d = [], l = this.getDrawingOrder(t, s), a = [...i];
1740
- i.forEach((O) => {
1741
- const o = this._hasDrawingOrder({ unitId: t, subUnitId: s, drawingId: O });
1737
+ const { unitId: t, subUnitId: i, drawingIds: s } = e, d = [], l = this.getDrawingOrder(t, i), a = [...s];
1738
+ s.forEach((O) => {
1739
+ const o = this._hasDrawingOrder({ unitId: t, subUnitId: i, drawingId: O });
1742
1740
  if (o === -1 || o === l.length - 1)
1743
1741
  return;
1744
- const c = F.moveOp([t, s, "order", o], [t, s, "order", o + 1]);
1742
+ const c = F.moveOp([t, i, "order", o], [t, i, "order", o + 1]);
1745
1743
  d.push(c), a.includes(l[o + 1]) || a.push(l[o + 1]);
1746
1744
  });
1747
1745
  const E = d.reduce(F.type.compose, null);
1748
- return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: t, subUnitId: s, objects: { ...e, drawingIds: a } };
1746
+ return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: t, subUnitId: i, objects: { ...e, drawingIds: a } };
1749
1747
  }
1750
1748
  getBackwardDrawingOp(e) {
1751
- const { unitId: t, subUnitId: s, drawingIds: i } = e, d = [], l = this.getDrawingOrder(t, s), a = [...i];
1752
- i.forEach((O) => {
1753
- const o = this._hasDrawingOrder({ unitId: t, subUnitId: s, drawingId: O });
1749
+ const { unitId: t, subUnitId: i, drawingIds: s } = e, d = [], l = this.getDrawingOrder(t, i), a = [...s];
1750
+ s.forEach((O) => {
1751
+ const o = this._hasDrawingOrder({ unitId: t, subUnitId: i, drawingId: O });
1754
1752
  if (o === -1 || o === 0)
1755
1753
  return;
1756
- const c = F.moveOp([t, s, "order", o], [t, s, "order", o - 1]);
1754
+ const c = F.moveOp([t, i, "order", o], [t, i, "order", o - 1]);
1757
1755
  d.push(c), a.includes(l[o - 1]) || a.push(l[o - 1]);
1758
1756
  });
1759
1757
  const E = d.reduce(F.type.compose, null);
1760
- return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: t, subUnitId: s, objects: { ...e, drawingIds: a } };
1758
+ return { undo: F.type.invertWithDoc(E, this.drawingManagerData), redo: E, unitId: t, subUnitId: i, objects: { ...e, drawingIds: a } };
1761
1759
  }
1762
1760
  getFrontDrawingsOp(e) {
1763
- const { unitId: t, subUnitId: s, drawingIds: i } = e, d = this._getOrderFromSearchParams(t, s, i), l = [...i], a = this.getDrawingOrder(t, s), E = [];
1761
+ const { unitId: t, subUnitId: i, drawingIds: s } = e, d = this._getOrderFromSearchParams(t, i, s), l = [...s], a = this.getDrawingOrder(t, i), E = [];
1764
1762
  d.forEach((o) => {
1765
- const { drawingId: c } = o, h = this._getDrawingCount(t, s) - 1, R = F.moveOp([t, s, "order", this._getDrawingOrder(t, s).indexOf(c)], [t, s, "order", h]);
1763
+ const { drawingId: c } = o, h = this._getDrawingCount(t, i) - 1, R = F.moveOp([t, i, "order", this._getDrawingOrder(t, i).indexOf(c)], [t, i, "order", h]);
1766
1764
  E.push(R), l.includes(a[h]) || l.push(a[h]);
1767
1765
  });
1768
1766
  const W = E.reduce(F.type.compose, null);
1769
- return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: t, subUnitId: s, objects: { ...e, drawingIds: l } };
1767
+ return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: t, subUnitId: i, objects: { ...e, drawingIds: l } };
1770
1768
  }
1771
1769
  getBackDrawingsOp(e) {
1772
- const { unitId: t, subUnitId: s, drawingIds: i } = e, d = this._getOrderFromSearchParams(t, s, i, !0), l = [...i], a = this.getDrawingOrder(t, s), E = [];
1770
+ const { unitId: t, subUnitId: i, drawingIds: s } = e, d = this._getOrderFromSearchParams(t, i, s, !0), l = [...s], a = this.getDrawingOrder(t, i), E = [];
1773
1771
  d.forEach((o) => {
1774
- const { drawingId: c } = o, h = F.moveOp([t, s, "order", this._getDrawingOrder(t, s).indexOf(c)], [t, s, "order", 0]);
1772
+ const { drawingId: c } = o, h = F.moveOp([t, i, "order", this._getDrawingOrder(t, i).indexOf(c)], [t, i, "order", 0]);
1775
1773
  E.push(h), l.includes(a[0]) || l.push(a[0]);
1776
1774
  });
1777
1775
  const W = E.reduce(F.type.compose, null);
1778
- return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: t, subUnitId: s, objects: { ...e, drawingIds: l } };
1776
+ return { undo: F.type.invertWithDoc(W, this.drawingManagerData), redo: W, unitId: t, subUnitId: i, objects: { ...e, drawingIds: l } };
1779
1777
  }
1780
1778
  _getDrawingCount(e, t) {
1781
1779
  return this.getDrawingOrder(e, t).length || 0;
1782
1780
  }
1783
- _getOrderFromSearchParams(e, t, s, i = !1) {
1784
- return s.map((d) => {
1781
+ _getOrderFromSearchParams(e, t, i, s = !1) {
1782
+ return i.map((d) => {
1785
1783
  const l = this._hasDrawingOrder({ unitId: e, subUnitId: t, drawingId: d });
1786
1784
  return { drawingId: d, zIndex: l };
1787
- }).sort(i === !1 ? Mt : Nt);
1785
+ }).sort(s === !1 ? Ut : Nt);
1788
1786
  }
1789
1787
  _hasDrawingOrder(e) {
1790
1788
  if (e == null)
1791
1789
  return -1;
1792
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1793
- return this._establishDrawingMap(t, s), this._getDrawingOrder(t, s).indexOf(i);
1790
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1791
+ return this._establishDrawingMap(t, i), this._getDrawingOrder(t, i).indexOf(s);
1794
1792
  }
1795
1793
  _getCurrentBySearch(e) {
1796
1794
  var d, l, a;
1797
1795
  if (e == null)
1798
1796
  return;
1799
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1800
- return (a = (l = (d = this.drawingManagerData[t]) == null ? void 0 : d[s]) == null ? void 0 : l.data) == null ? void 0 : a[i];
1797
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1798
+ return (a = (l = (d = this.drawingManagerData[t]) == null ? void 0 : d[i]) == null ? void 0 : l.data) == null ? void 0 : a[s];
1801
1799
  }
1802
1800
  _getOldBySearch(e) {
1803
1801
  var d, l, a;
1804
1802
  if (e == null)
1805
1803
  return;
1806
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1807
- return (a = (l = (d = this._oldDrawingManagerData[t]) == null ? void 0 : d[s]) == null ? void 0 : l.data) == null ? void 0 : a[i];
1804
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1805
+ return (a = (l = (d = this._oldDrawingManagerData[t]) == null ? void 0 : d[i]) == null ? void 0 : l.data) == null ? void 0 : a[s];
1808
1806
  }
1809
- _establishDrawingMap(e, t, s) {
1810
- var i;
1807
+ _establishDrawingMap(e, t, i) {
1808
+ var s;
1811
1809
  return this.drawingManagerData[e] || (this.drawingManagerData[e] = {}), this.drawingManagerData[e][t] || (this.drawingManagerData[e][t] = {
1812
1810
  data: {},
1813
1811
  order: []
1814
- }), s == null ? null : (i = this.drawingManagerData[e][t].data) == null ? void 0 : i[s];
1812
+ }), i == null ? null : (s = this.drawingManagerData[e][t].data) == null ? void 0 : s[i];
1815
1813
  }
1816
1814
  _addByParam(e) {
1817
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1818
- this._establishDrawingMap(t, s, i);
1819
- const d = F.insertOp([t, s, "data", i], e), l = F.insertOp([t, s, "order", this._getDrawingOrder(t, s).length], i), a = [d, l].reduce(F.type.compose, null), E = F.type.invertWithDoc(a, this.drawingManagerData);
1815
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1816
+ this._establishDrawingMap(t, i, s);
1817
+ const d = F.insertOp([t, i, "data", s], e), l = F.insertOp([t, i, "order", this._getDrawingOrder(t, i).length], s), a = [d, l].reduce(F.type.compose, null), E = F.type.invertWithDoc(a, this.drawingManagerData);
1820
1818
  return { op: a, invertOp: E };
1821
1819
  }
1822
1820
  _removeByParam(e) {
1823
1821
  if (e == null)
1824
1822
  return { op: [], invertOp: [] };
1825
- const { unitId: t, subUnitId: s, drawingId: i } = e;
1826
- if (this._establishDrawingMap(t, s, i) == null)
1823
+ const { unitId: t, subUnitId: i, drawingId: s } = e;
1824
+ if (this._establishDrawingMap(t, i, s) == null)
1827
1825
  return { op: [], invertOp: [] };
1828
- const l = F.removeOp([t, s, "data", i], !0), a = F.removeOp([t, s, "order", this._getDrawingOrder(t, s).indexOf(i)], !0), E = [l, a].reduce(F.type.compose, null), W = F.type.invertWithDoc(E, this.drawingManagerData);
1826
+ const l = F.removeOp([t, i, "data", s], !0), a = F.removeOp([t, i, "order", this._getDrawingOrder(t, i).indexOf(s)], !0), E = [l, a].reduce(F.type.compose, null), W = F.type.invertWithDoc(E, this.drawingManagerData);
1829
1827
  return { op: E, invertOp: W };
1830
1828
  }
1831
1829
  _updateByParam(e) {
1832
- const { unitId: t, subUnitId: s, drawingId: i } = e, d = this._establishDrawingMap(t, s, i);
1830
+ const { unitId: t, subUnitId: i, drawingId: s } = e, d = this._establishDrawingMap(t, i, s);
1833
1831
  if (d == null)
1834
1832
  return { op: [], invertOp: [] };
1835
1833
  const a = this._getUpdateParamCompareOp(e, d).reduce(F.type.compose, null), E = F.type.invertWithDoc(a, this.drawingManagerData);
@@ -1843,21 +1841,21 @@ class Ht {
1843
1841
  // });
1844
1842
  // }
1845
1843
  _getUpdateParamCompareOp(e, t) {
1846
- const { unitId: s, subUnitId: i, drawingId: d } = e, l = [];
1844
+ const { unitId: i, subUnitId: s, drawingId: d } = e, l = [];
1847
1845
  return Object.keys(e).forEach((a) => {
1848
1846
  const E = e[a], W = t[a];
1849
1847
  W !== E && l.push(
1850
- F.replaceOp([s, i, "data", d, a], W, E)
1848
+ F.replaceOp([i, s, "data", d, a], W, E)
1851
1849
  );
1852
1850
  }), l;
1853
1851
  }
1854
1852
  _getDrawingData(e, t) {
1855
- var s, i;
1856
- return ((i = (s = this.drawingManagerData[e]) == null ? void 0 : s[t]) == null ? void 0 : i.data) || {};
1853
+ var i, s;
1854
+ return ((s = (i = this.drawingManagerData[e]) == null ? void 0 : i[t]) == null ? void 0 : s.data) || {};
1857
1855
  }
1858
1856
  _getDrawingOrder(e, t) {
1859
- var s, i;
1860
- return ((i = (s = this.drawingManagerData[e]) == null ? void 0 : s[t]) == null ? void 0 : i.order) || [];
1857
+ var i, s;
1858
+ return ((s = (i = this.drawingManagerData[e]) == null ? void 0 : i[t]) == null ? void 0 : s.order) || [];
1861
1859
  }
1862
1860
  getDrawingVisible() {
1863
1861
  return this._visible;
@@ -1874,20 +1872,19 @@ class Ht {
1874
1872
  }
1875
1873
  class Kt extends Ht {
1876
1874
  }
1877
- function an(n) {
1878
- const { unitId: e, subUnitId: t, drawingId: s } = n;
1879
- return `${e}#-#${t}#-#${s}`;
1875
+ function an({ unitId: n, subUnitId: e, drawingId: t }, i) {
1876
+ return typeof i == "number" ? `${n}#-#${e}#-#${t}#-#${i}` : `${n}#-#${e}#-#${t}`;
1880
1877
  }
1881
1878
  const cn = async (n) => new Promise((e, t) => {
1882
- const s = new Image();
1883
- s.src = n, s.onload = () => {
1879
+ const i = new Image();
1880
+ i.src = n, i.onload = () => {
1884
1881
  e({
1885
- width: s.width,
1886
- height: s.height,
1887
- image: s
1882
+ width: i.width,
1883
+ height: i.height,
1884
+ image: i
1888
1885
  });
1889
- }, s.onerror = (i) => {
1890
- t(i);
1886
+ }, i.onerror = (s) => {
1887
+ t(s);
1891
1888
  };
1892
1889
  });
1893
1890
  var et = /* @__PURE__ */ ((n) => (n.URL = "URL", n.UUID = "UUID", n.BASE64 = "BASE64", n))(et || {}), Ze = /* @__PURE__ */ ((n) => (n.SUCCUSS = "0", n.ERROR_EXCEED_SIZE = "1", n.ERROR_IMAGE_TYPE = "2", n.ERROR_UPLOAD_COUNT_LIMIT = "3", n.ERROR_IMAGE = "4", n))(Ze || {});
@@ -1904,33 +1901,33 @@ class Ft {
1904
1901
  }
1905
1902
  getImageSourceCache(e, t) {
1906
1903
  if (t === et.BASE64) {
1907
- const s = new Image();
1908
- return s.src = e, s;
1904
+ const i = new Image();
1905
+ return i.src = e, i;
1909
1906
  }
1910
1907
  return this._imageSourceCache.get(e);
1911
1908
  }
1912
- addImageSourceCache(e, t, s) {
1913
- t === et.BASE64 || s == null || this._imageSourceCache.set(e, s);
1909
+ addImageSourceCache(e, t, i) {
1910
+ t === et.BASE64 || i == null || this._imageSourceCache.set(e, i);
1914
1911
  }
1915
1912
  async getImage(e) {
1916
1913
  return Promise.resolve(e);
1917
1914
  }
1918
1915
  async saveImage(e) {
1919
- return new Promise((t, s) => {
1916
+ return new Promise((t, i) => {
1920
1917
  if (!Wt.includes(e.type)) {
1921
- s(new Error(Ze.ERROR_IMAGE_TYPE)), this._decreaseWaiting();
1918
+ i(new Error(Ze.ERROR_IMAGE_TYPE)), this._decreaseWaiting();
1922
1919
  return;
1923
1920
  }
1924
1921
  if (e.size > $t) {
1925
- s(new Error(Ze.ERROR_EXCEED_SIZE)), this._decreaseWaiting();
1922
+ i(new Error(Ze.ERROR_EXCEED_SIZE)), this._decreaseWaiting();
1926
1923
  return;
1927
1924
  }
1928
- const i = new FileReader();
1929
- i.readAsDataURL(e), i.onload = (d) => {
1925
+ const s = new FileReader();
1926
+ s.readAsDataURL(e), s.onload = (d) => {
1930
1927
  var E;
1931
1928
  const l = (E = d.target) == null ? void 0 : E.result;
1932
1929
  if (l == null) {
1933
- s(new Error(Ze.ERROR_IMAGE)), this._decreaseWaiting();
1930
+ i(new Error(Ze.ERROR_IMAGE)), this._decreaseWaiting();
1934
1931
  return;
1935
1932
  }
1936
1933
  const a = kt.generateRandomId(6);
@@ -1951,14 +1948,14 @@ class Ft {
1951
1948
  const un = "__default_document_sub_component_id20231101__";
1952
1949
  var qt = /* @__PURE__ */ ((n) => (n[n.forward = 0] = "forward", n[n.backward = 1] = "backward", n[n.front = 2] = "front", n[n.back = 3] = "back", n))(qt || {}), zt = /* @__PURE__ */ ((n) => (n[n.UNRECOGNIZED = -1] = "UNRECOGNIZED", n[n.DRAWING_IMAGE = 0] = "DRAWING_IMAGE", n[n.DRAWING_SHAPE = 1] = "DRAWING_SHAPE", n[n.DRAWING_CHART = 2] = "DRAWING_CHART", n[n.DRAWING_TABLE = 3] = "DRAWING_TABLE", n[n.DRAWING_SMART_ART = 4] = "DRAWING_SMART_ART", n[n.DRAWING_VIDEO = 5] = "DRAWING_VIDEO", n[n.DRAWING_GROUP = 6] = "DRAWING_GROUP", n[n.DRAWING_UNIT = 7] = "DRAWING_UNIT", n[n.DRAWING_DOM = 8] = "DRAWING_DOM", n))(zt || {});
1953
1950
  const Xt = It("univer.drawing-manager.service");
1954
- var Yt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, Jt = (n, e, t, s) => {
1955
- for (var i = s > 1 ? void 0 : s ? Zt(e, t) : e, d = n.length - 1, l; d >= 0; d--)
1956
- (l = n[d]) && (i = (s ? l(e, t, i) : l(i)) || i);
1957
- return s && i && Yt(e, t, i), i;
1958
- }, Qt = (n, e) => (t, s) => e(t, s, n);
1951
+ var Yt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, Jt = (n, e, t, i) => {
1952
+ for (var s = i > 1 ? void 0 : i ? Zt(e, t) : e, d = n.length - 1, l; d >= 0; d--)
1953
+ (l = n[d]) && (s = (i ? l(e, t, s) : l(s)) || s);
1954
+ return i && s && Yt(e, t, s), s;
1955
+ }, Qt = (n, e) => (t, i) => e(t, i, n);
1959
1956
  const en = "DRAWING_PLUGIN";
1960
1957
  var ot;
1961
- let wt = (ot = class extends jt {
1958
+ let wt = (ot = class extends Tt {
1962
1959
  constructor(n, e) {
1963
1960
  super(), this._config = n, this._injector = e;
1964
1961
  }
@@ -1966,11 +1963,11 @@ let wt = (ot = class extends jt {
1966
1963
  this._initDependencies(n);
1967
1964
  }
1968
1965
  _initDependencies(n) {
1969
- var s;
1970
- Tt([
1966
+ var i;
1967
+ jt([
1971
1968
  [Vt, { useClass: Ft }],
1972
1969
  [Xt, { useClass: Kt }]
1973
- ], (s = this._config) == null ? void 0 : s.override).forEach((i) => n.add(i));
1970
+ ], (i = this._config) == null ? void 0 : i.override).forEach((s) => n.add(s));
1974
1971
  }
1975
1972
  }, V(ot, "pluginName", en), ot);
1976
1973
  wt = Jt([