@univerjs/drawing 0.11.0-nightly.202511151013 → 0.12.0

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/index.js CHANGED
@@ -1,12 +1,12 @@
1
- var Nt = Object.defineProperty;
2
- var Rt = (a, e, n) => e in a ? Nt(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
3
- var F = (a, e, n) => Rt(a, typeof e != "symbol" ? e + "" : e, n);
4
- import { createIdentifier as xt, CommandType as Bt, sortRules as Wt, sortRulesByDesc as Gt, ImageSourceType as at, ImageUploadStatusType as et, generateRandomId as Lt, Inject as qt, Injector as Kt, IConfigService as Ft, ICommandService as Vt, Plugin as Ht, merge as zt, mergeOverrideWithDependencies as Xt, IImageIoService as Jt } from "@univerjs/core";
1
+ var Rt = Object.defineProperty;
2
+ var xt = (a, e, n) => e in a ? Rt(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
3
+ var F = (a, e, n) => xt(a, typeof e != "symbol" ? e + "" : e, n);
4
+ import { createIdentifier as Bt, CommandType as Wt, sortRules as Gt, sortRulesByDesc as Lt, ImageSourceType as at, ImageUploadStatusType as et, generateRandomId as qt, Inject as Kt, Injector as $t, IConfigService as Ft, ICommandService as Vt, Plugin as Ht, merge as zt, mergeOverrideWithDependencies as Xt, IImageIoService as Jt } from "@univerjs/core";
5
5
  import { IImageIoService as In, ImageSourceType as En, ImageUploadStatusType as Dn } from "@univerjs/core";
6
6
  import { Subject as be } from "rxjs";
7
- const _n = 500, vn = 500, mn = 10, Yt = 5 * 1024 * 1024, Zt = ["image/png", "image/jpeg", "image/jpg", "image/gif", "image/bmp"], Mt = xt("univer.drawing-manager.service"), Qt = {
7
+ const _n = 500, vn = 500, mn = 10, Yt = 5 * 1024 * 1024, Zt = ["image/png", "image/jpeg", "image/jpg", "image/gif", "image/bmp"], Mt = Bt("univer.drawing-manager.service"), Qt = {
8
8
  id: "drawing.operation.set-drawing-selected",
9
- type: Bt.OPERATION,
9
+ type: Wt.OPERATION,
10
10
  handler: (a, e) => {
11
11
  const n = a.get(Mt);
12
12
  return e == null ? !1 : (n.focusDrawing(e), !0);
@@ -262,10 +262,10 @@ function St() {
262
262
  for (; U; ) {
263
263
  const Ce = Z = _.getKey();
264
264
  if (pe != null) {
265
- let Le = !1;
266
- if (s && typeof Ce == "number" && (Z = s(Ce, _.getComponent()), Z < 0 && (Z = ~Z, Le = !0)), t(Z, pe))
265
+ let qe = !1;
266
+ if (s && typeof Ce == "number" && (Z = s(Ce, _.getComponent()), Z < 0 && (Z = ~Z, qe = !0)), t(Z, pe))
267
267
  return null;
268
- if (Z === pe && !Le)
268
+ if (Z === pe && !qe)
269
269
  return _;
270
270
  }
271
271
  c && typeof Z == "number" && c(Z, _.getComponent()), U = _.nextSibling();
@@ -277,7 +277,7 @@ function St() {
277
277
  }, Y;
278
278
  }
279
279
  a.advancer = E;
280
- function x(_, s, c) {
280
+ function B(_, s, c) {
281
281
  let h, U, Y, pe;
282
282
  for (h = U = _ && _.descendFirst(), Y = pe = s && s.descendFirst(); h || Y; ) {
283
283
  let Z = h ? _.getKey() : null, Ce = Y ? s.getKey() : null;
@@ -285,7 +285,7 @@ function St() {
285
285
  }
286
286
  U && _.ascend(), pe && s.ascend();
287
287
  }
288
- a.eachChildOf = x;
288
+ a.eachChildOf = B;
289
289
  })(lt)), lt;
290
290
  }
291
291
  var ut = {}, bt;
@@ -325,52 +325,52 @@ function ht() {
325
325
  throw Error("Op must be an array of components");
326
326
  let y = null;
327
327
  for (let b = 0; b < f.length; b++) {
328
- const L = f[b];
329
- switch (typeof L) {
328
+ const q = f[b];
329
+ switch (typeof q) {
330
330
  case "object":
331
- if (typeof L.d != "number" && typeof L.d != "string")
331
+ if (typeof q.d != "number" && typeof q.d != "string")
332
332
  throw Error("Delete must be number or string");
333
- if (a.dlen(L.d) <= 0)
333
+ if (a.dlen(q.d) <= 0)
334
334
  throw Error("Deletes must not be empty");
335
335
  break;
336
336
  case "string":
337
- if (!(L.length > 0))
337
+ if (!(q.length > 0))
338
338
  throw Error("Inserts cannot be empty");
339
339
  break;
340
340
  case "number":
341
- if (!(L > 0))
341
+ if (!(q > 0))
342
342
  throw Error("Skip components must be >0");
343
343
  if (typeof y == "number")
344
344
  throw Error("Adjacent skip components should be combined");
345
345
  break;
346
346
  }
347
- y = L;
347
+ y = q;
348
348
  }
349
349
  if (typeof y == "number")
350
350
  throw Error("Op has a trailing skip");
351
351
  };
352
352
  function t(f, y) {
353
- let b = 0, L = 0;
353
+ let b = 0, q = 0;
354
354
  for (let z = 0; z < f.length; z++) {
355
- const q = f[z];
356
- switch (y(q, b, L), typeof q) {
355
+ const K = f[z];
356
+ switch (y(K, b, q), typeof K) {
357
357
  case "object":
358
- b += a.dlen(q.d);
358
+ b += a.dlen(K.d);
359
359
  break;
360
360
  case "string":
361
- L += e.strPosToUni(q);
361
+ q += e.strPosToUni(K);
362
362
  break;
363
363
  case "number":
364
- b += q, L += q;
364
+ b += K, q += K;
365
365
  break;
366
366
  }
367
367
  }
368
368
  }
369
369
  a.eachOp = t;
370
370
  function r(f, y) {
371
- const b = [], L = l(b);
372
- return t(f, (z, q, Ee) => {
373
- L(y(z, q, Ee));
371
+ const b = [], q = l(b);
372
+ return t(f, (z, K, Ee) => {
373
+ q(y(z, K, Ee));
374
374
  }), s(b);
375
375
  }
376
376
  const u = (f) => f, o = (f) => r(f, u);
@@ -388,31 +388,31 @@ function ht() {
388
388
  f.push(y);
389
389
  }, E = (f) => typeof f == "number" ? f : typeof f == "string" ? e.strPosToUni(f) : typeof f.d == "number" ? f.d : e.strPosToUni(f.d);
390
390
  a.uniSlice = (f, y, b) => {
391
- const L = e.uniToStrPos(f, y), z = b == null ? 1 / 0 : e.uniToStrPos(f, b);
392
- return f.slice(L, z);
391
+ const q = e.uniToStrPos(f, y), z = b == null ? 1 / 0 : e.uniToStrPos(f, b);
392
+ return f.slice(q, z);
393
393
  };
394
- const x = (f, y, b) => typeof f == "number" ? b == null ? f - y : Math.min(f, b) - y : a.uniSlice(f, y, b), _ = (f) => {
394
+ const B = (f, y, b) => typeof f == "number" ? b == null ? f - y : Math.min(f, b) - y : a.uniSlice(f, y, b), _ = (f) => {
395
395
  let y = 0, b = 0;
396
- return { take: (q, Ee) => {
396
+ return { take: (K, Ee) => {
397
397
  if (y === f.length)
398
- return q === -1 ? null : q;
398
+ return K === -1 ? null : K;
399
399
  const ce = f[y];
400
400
  let ne;
401
401
  if (typeof ce == "number")
402
- return q === -1 || ce - b <= q ? (ne = ce - b, ++y, b = 0, ne) : (b += q, q);
402
+ return K === -1 || ce - b <= K ? (ne = ce - b, ++y, b = 0, ne) : (b += K, K);
403
403
  if (typeof ce == "string") {
404
- if (q === -1 || Ee === "i" || e.strPosToUni(ce.slice(b)) <= q)
404
+ if (K === -1 || Ee === "i" || e.strPosToUni(ce.slice(b)) <= K)
405
405
  return ne = ce.slice(b), ++y, b = 0, ne;
406
406
  {
407
- const le = b + e.uniToStrPos(ce.slice(b), q);
407
+ const le = b + e.uniToStrPos(ce.slice(b), K);
408
408
  return ne = ce.slice(b, le), b = le, ne;
409
409
  }
410
410
  } else {
411
- if (q === -1 || Ee === "d" || a.dlen(ce.d) - b <= q)
412
- return ne = { d: x(ce.d, b) }, ++y, b = 0, ne;
411
+ if (K === -1 || Ee === "d" || a.dlen(ce.d) - b <= K)
412
+ return ne = { d: B(ce.d, b) }, ++y, b = 0, ne;
413
413
  {
414
- let le = x(ce.d, b, b + q);
415
- return b += q, { d: le };
414
+ let le = B(ce.d, b, b + K);
415
+ return b += K, { d: le };
416
416
  }
417
417
  }
418
418
  }, peek: () => f[y] };
@@ -421,21 +421,21 @@ function ht() {
421
421
  if (b !== "left" && b !== "right")
422
422
  throw Error("side (" + b + ") must be 'left' or 'right'");
423
423
  n(f), n(y);
424
- const L = [], z = l(L), { take: q, peek: Ee } = _(f);
424
+ const q = [], z = l(q), { take: K, peek: Ee } = _(f);
425
425
  for (let ne = 0; ne < y.length; ne++) {
426
426
  const le = y[ne];
427
427
  let ge, De;
428
428
  switch (typeof le) {
429
429
  case "number":
430
430
  for (ge = le; ge > 0; )
431
- De = q(ge, "i"), z(De), typeof De != "string" && (ge -= E(De));
431
+ De = K(ge, "i"), z(De), typeof De != "string" && (ge -= E(De));
432
432
  break;
433
433
  case "string":
434
- b === "left" && typeof Ee() == "string" && z(q(-1)), z(e.strPosToUni(le));
434
+ b === "left" && typeof Ee() == "string" && z(K(-1)), z(e.strPosToUni(le));
435
435
  break;
436
436
  case "object":
437
437
  for (ge = a.dlen(le.d); ge > 0; )
438
- switch (De = q(ge, "i"), typeof De) {
438
+ switch (De = K(ge, "i"), typeof De) {
439
439
  case "number":
440
440
  ge -= De;
441
441
  break;
@@ -449,23 +449,23 @@ function ht() {
449
449
  }
450
450
  }
451
451
  let ce;
452
- for (; ce = q(-1); )
452
+ for (; ce = K(-1); )
453
453
  z(ce);
454
- return s(L);
454
+ return s(q);
455
455
  }
456
456
  function h(f, y) {
457
457
  n(f), n(y);
458
- const b = [], L = l(b), { take: z } = _(f);
458
+ const b = [], q = l(b), { take: z } = _(f);
459
459
  for (let Ee = 0; Ee < y.length; Ee++) {
460
460
  const ce = y[Ee];
461
461
  let ne, le;
462
462
  switch (typeof ce) {
463
463
  case "number":
464
464
  for (ne = ce; ne > 0; )
465
- le = z(ne, "d"), L(le), typeof le != "object" && (ne -= E(le));
465
+ le = z(ne, "d"), q(le), typeof le != "object" && (ne -= E(le));
466
466
  break;
467
467
  case "string":
468
- L(ce);
468
+ q(ce);
469
469
  break;
470
470
  case "object":
471
471
  ne = a.dlen(ce.d);
@@ -473,34 +473,34 @@ function ht() {
473
473
  for (; ge < ne; )
474
474
  switch (le = z(ne - ge, "d"), typeof le) {
475
475
  case "number":
476
- L({ d: x(ce.d, ge, ge + le) }), ge += le;
476
+ q({ d: B(ce.d, ge, ge + le) }), ge += le;
477
477
  break;
478
478
  case "string":
479
479
  ge += e.strPosToUni(le);
480
480
  break;
481
481
  case "object":
482
- L(le);
482
+ q(le);
483
483
  }
484
484
  break;
485
485
  }
486
486
  }
487
- let q;
488
- for (; q = z(-1); )
489
- L(q);
487
+ let K;
488
+ for (; K = z(-1); )
489
+ q(K);
490
490
  return s(b);
491
491
  }
492
492
  const U = (f, y) => {
493
493
  let b = 0;
494
- for (let L = 0; L < y.length && f > b; L++) {
495
- const z = y[L];
494
+ for (let q = 0; q < y.length && f > b; q++) {
495
+ const z = y[q];
496
496
  switch (typeof z) {
497
497
  case "number": {
498
498
  b += z;
499
499
  break;
500
500
  }
501
501
  case "string":
502
- const q = e.strPosToUni(z);
503
- b += q, f += q;
502
+ const K = e.strPosToUni(z);
503
+ b += K, f += K;
504
504
  break;
505
505
  case "object":
506
506
  f -= Math.min(a.dlen(z.d), f - b);
@@ -510,7 +510,7 @@ function ht() {
510
510
  return f;
511
511
  }, Y = (f, y) => typeof f == "number" ? U(f, y) : f.map((b) => U(b, y));
512
512
  function pe(f, y, b) {
513
- return r(f, (L, z) => typeof L == "object" && typeof L.d == "number" ? { d: b.slice(y, z, z + L.d) } : L);
513
+ return r(f, (q, z) => typeof q == "object" && typeof q.d == "number" ? { d: b.slice(y, z, z + q.d) } : q);
514
514
  }
515
515
  function Z(f) {
516
516
  return r(f, (y) => {
@@ -531,7 +531,7 @@ function ht() {
531
531
  function Ce(f) {
532
532
  return r(f, (y) => typeof y == "object" && typeof y.d == "string" ? { d: e.strPosToUni(y.d) } : y);
533
533
  }
534
- function Le(f) {
534
+ function qe(f) {
535
535
  let y = !0;
536
536
  return t(f, (b) => {
537
537
  typeof b == "object" && typeof b.d == "number" && (y = !1);
@@ -558,28 +558,28 @@ function ht() {
558
558
  */
559
559
  apply(y, b) {
560
560
  n(b);
561
- const L = f.builder(y);
561
+ const q = f.builder(y);
562
562
  for (let z = 0; z < b.length; z++) {
563
- const q = b[z];
564
- switch (typeof q) {
563
+ const K = b[z];
564
+ switch (typeof K) {
565
565
  case "number":
566
- L.skip(q);
566
+ q.skip(K);
567
567
  break;
568
568
  case "string":
569
- L.append(q);
569
+ q.append(K);
570
570
  break;
571
571
  case "object":
572
- L.del(a.dlen(q.d));
572
+ q.del(a.dlen(K.d));
573
573
  break;
574
574
  }
575
575
  }
576
- return L.build();
576
+ return q.build();
577
577
  },
578
578
  transform: c,
579
579
  compose: h,
580
580
  transformPosition: U,
581
581
  transformSelection: Y,
582
- isInvertible: Le,
582
+ isInvertible: qe,
583
583
  makeInvertible(y, b) {
584
584
  return pe(y, b, f);
585
585
  },
@@ -627,8 +627,8 @@ function rn() {
627
627
  this.onInsert && this.onInsert(E, o);
628
628
  break;
629
629
  case "object":
630
- const x = a.dlen(o.d);
631
- this.onRemove && this.onRemove(E, x);
630
+ const B = a.dlen(o.d);
631
+ this.onRemove && this.onRemove(E, B);
632
632
  }
633
633
  });
634
634
  },
@@ -690,7 +690,7 @@ function sn() {
690
690
  };
691
691
  },
692
692
  slice: o.uniSlice
693
- }, x = o.default(E), _ = Object.assign(Object.assign({}, x), { api: l.default });
693
+ }, B = o.default(E), _ = Object.assign(Object.assign({}, B), { api: l.default });
694
694
  a.type = _, a.insert = (c, h) => h.length === 0 ? [] : c === 0 ? [h] : [c, h], a.remove = (c, h) => o.dlen(h) === 0 ? [] : c === 0 ? [{ d: h }] : [c, { d: h }];
695
695
  var s = ht();
696
696
  Object.defineProperty(a, "makeType", { enumerable: !0, get: function() {
@@ -724,7 +724,7 @@ function on() {
724
724
  },
725
725
  registerSubtype: Z,
726
726
  checkValidOp: z,
727
- normalize: q,
727
+ normalize: K,
728
728
  apply: Ee,
729
729
  transformPosition: ce,
730
730
  compose: ne,
@@ -745,7 +745,7 @@ function on() {
745
745
  function E(i) {
746
746
  return i && typeof i == "object" && !Array.isArray(i);
747
747
  }
748
- const x = (i) => Array.isArray(i) ? i.slice() : i !== null && typeof i == "object" ? Object.assign({}, i) : i, _ = (i) => i && (i.p != null || i.r !== void 0), s = (i) => i && (i.d != null || i.i !== void 0);
748
+ const B = (i) => Array.isArray(i) ? i.slice() : i !== null && typeof i == "object" ? Object.assign({}, i) : i, _ = (i) => i && (i.p != null || i.r !== void 0), s = (i) => i && (i.d != null || i.i !== void 0);
749
749
  function c(i, d) {
750
750
  return o(i != null), typeof d == "number" ? (o(Array.isArray(i), "Invalid key - child is not an array"), (i = i.slice()).splice(d, 1)) : (o(E(i), "Invalid key - child is not an object"), delete (i = Object.assign({}, i))[d]), i;
751
751
  }
@@ -766,11 +766,11 @@ function on() {
766
766
  throw Error("Missing type: " + i);
767
767
  };
768
768
  Z(sn());
769
- const Le = (i, d) => i + d;
769
+ const qe = (i, d) => i + d;
770
770
  Z({
771
771
  name: "number",
772
- apply: Le,
773
- compose: Le,
772
+ apply: qe,
773
+ compose: qe,
774
774
  invert: (i) => -i,
775
775
  transform: (i) => i
776
776
  });
@@ -781,101 +781,101 @@ function on() {
781
781
  function b(i) {
782
782
  o(typeof i == "number"), o(i >= 0), o(i === (0 | i));
783
783
  }
784
- function L(i) {
784
+ function q(i) {
785
785
  typeof i == "number" ? b(i) : o(typeof i == "string");
786
786
  }
787
787
  function z(i) {
788
788
  if (i === null) return;
789
789
  const d = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), D = (I) => {
790
- let R = !0, $ = !1;
790
+ let x = !0, N = !1;
791
791
  for (let p in I) {
792
792
  const v = I[p];
793
- if (R = !1, o(p === "p" || p === "r" || p === "d" || p === "i" || p === "e" || p === "es" || p === "ena" || p === "et", "Invalid component item '" + p + "'"), p === "p") b(v), o(!d.has(v)), d.add(v), o(I.r === void 0);
793
+ if (x = !1, o(p === "p" || p === "r" || p === "d" || p === "i" || p === "e" || p === "es" || p === "ena" || p === "et", "Invalid component item '" + p + "'"), p === "p") b(v), o(!d.has(v)), d.add(v), o(I.r === void 0);
794
794
  else if (p === "d") b(v), o(!m.has(v)), m.add(v), o(I.i === void 0);
795
795
  else if (p === "e" || p === "es" || p === "ena") {
796
- o(!$), $ = !0;
796
+ o(!N), N = !0;
797
797
  const w = ve(I);
798
798
  o(w, "Missing type in edit"), w.checkValidOp && w.checkValidOp(f(I));
799
799
  }
800
800
  }
801
- o(!R);
802
- }, O = (I, R, $) => {
801
+ o(!x);
802
+ }, O = (I, x, N) => {
803
803
  if (!Array.isArray(I)) throw Error("Op must be null or a list");
804
804
  if (I.length === 0) throw Error("Empty descent");
805
- R || L(I[0]);
805
+ x || q(I[0]);
806
806
  let p = 1, v = 0, w = 0;
807
807
  for (let C = 0; C < I.length; C++) {
808
- const N = I[C];
809
- if (o(N != null), Array.isArray(N)) {
810
- const B = O(N, !1);
808
+ const R = I[C];
809
+ if (o(R != null), Array.isArray(R)) {
810
+ const W = O(R, !1);
811
811
  if (v) {
812
- const g = typeof w, S = typeof B;
813
- g === S ? o(w < B, "descent keys are not in order") : o(g === "number" && S === "string");
812
+ const g = typeof w, S = typeof W;
813
+ g === S ? o(w < W, "descent keys are not in order") : o(g === "number" && S === "string");
814
814
  }
815
- w = B, v++, p = 3;
816
- } else typeof N == "object" ? (o(p === 1, `Prev not scalar - instead ${p}`), D(N), p = 2) : (o(p !== 3), L(N), o(r.isValidPathItem(N), "Invalid path key"), p = 1);
815
+ w = W, v++, p = 3;
816
+ } else typeof R == "object" ? (o(p === 1, `Prev not scalar - instead ${p}`), D(R), p = 2) : (o(p !== 3), q(R), o(r.isValidPathItem(R), "Invalid path key"), p = 1);
817
817
  }
818
818
  return o(v !== 1, "Operation makes multiple descents. Remove some []"), o(p === 2 || p === 3), I[0];
819
819
  };
820
820
  O(i, !0), o(d.size === m.size, "Mismatched picks and drops in op");
821
821
  for (let I = 0; I < d.size; I++) o(d.has(I)), o(m.has(I));
822
822
  }
823
- function q(i) {
823
+ function K(i) {
824
824
  let d = 0, m = [];
825
825
  const D = r.writeCursor();
826
826
  return D.mergeTree(i, (O, I) => {
827
- const R = ve(O);
828
- if (R) {
827
+ const x = ve(O);
828
+ if (x) {
829
829
  const p = f(O);
830
- y(I, R, R.normalize ? R.normalize(p) : p);
830
+ y(I, x, x.normalize ? x.normalize(p) : p);
831
831
  }
832
832
  for (const p of ["r", "p", "i", "d"]) if (O[p] !== void 0) {
833
- const v = p === "p" || p === "d" ? ($ = O[p], m[$] == null && (m[$] = d++), m[$]) : O[p];
833
+ const v = p === "p" || p === "d" ? (N = O[p], m[N] == null && (m[N] = d++), m[N]) : O[p];
834
834
  I.write(p, v);
835
835
  }
836
- var $;
836
+ var N;
837
837
  }), D.get();
838
838
  }
839
839
  function Ee(i, d) {
840
840
  if (z(d), d === null) return i;
841
841
  const m = [];
842
842
  return (function D(O, I) {
843
- let R = O, $ = 0, p = {
843
+ let x = O, N = 0, p = {
844
844
  root: O
845
845
  }, v = 0, w = p, C = "root";
846
- function N() {
847
- for (; v < $; v++) {
848
- let B = I[v];
849
- typeof B != "object" && (o(U(w, C)), w = w[C] = x(w[C]), C = B);
846
+ function R() {
847
+ for (; v < N; v++) {
848
+ let W = I[v];
849
+ typeof W != "object" && (o(U(w, C)), w = w[C] = B(w[C]), C = W);
850
850
  }
851
851
  }
852
- for (; $ < I.length; $++) {
853
- const B = I[$];
854
- if (Array.isArray(B)) {
855
- const g = D(R, B);
856
- g !== R && g !== void 0 && (N(), R = w[C] = g);
857
- } else if (typeof B == "object") {
858
- B.d != null ? (N(), R = h(w, C, m[B.d])) : B.i !== void 0 && (N(), R = h(w, C, B.i));
859
- const g = ve(B);
860
- if (g) N(), R = w[C] = g.apply(R, f(B));
861
- else if (B.e !== void 0) throw Error("Subtype " + B.et + " undefined");
862
- } else R = Y(R, B);
852
+ for (; N < I.length; N++) {
853
+ const W = I[N];
854
+ if (Array.isArray(W)) {
855
+ const g = D(x, W);
856
+ g !== x && g !== void 0 && (R(), x = w[C] = g);
857
+ } else if (typeof W == "object") {
858
+ W.d != null ? (R(), x = h(w, C, m[W.d])) : W.i !== void 0 && (R(), x = h(w, C, W.i));
859
+ const g = ve(W);
860
+ if (g) R(), x = w[C] = g.apply(x, f(W));
861
+ else if (W.e !== void 0) throw Error("Subtype " + W.et + " undefined");
862
+ } else x = Y(x, W);
863
863
  }
864
864
  return p.root;
865
865
  })(i = (function D(O, I) {
866
- const R = [];
867
- let $ = 0;
868
- for (; $ < I.length; $++) {
869
- const C = I[$];
866
+ const x = [];
867
+ let N = 0;
868
+ for (; N < I.length; N++) {
869
+ const C = I[N];
870
870
  if (Array.isArray(C)) break;
871
- typeof C != "object" && (R.push(O), O = Y(O, C));
871
+ typeof C != "object" && (x.push(O), O = Y(O, C));
872
872
  }
873
- for (let C = I.length - 1; C >= $; C--) O = D(O, I[C]);
874
- for (--$; $ >= 0; $--) {
875
- const C = I[$];
873
+ for (let C = I.length - 1; C >= N; C--) O = D(O, I[C]);
874
+ for (--N; N >= 0; N--) {
875
+ const C = I[N];
876
876
  if (typeof C != "object") {
877
- const N = R.pop();
878
- O = O === Y(N, C) ? N : O === void 0 ? c(N, C) : (v = C, w = O, (p = x(p = N))[v] = w, p);
877
+ const R = x.pop();
878
+ O = O === Y(R, C) ? R : O === void 0 ? c(R, C) : (v = C, w = O, (p = B(p = R))[v] = w, p);
879
879
  } else _(C) && (o(O !== void 0, "Cannot pick up or remove undefined"), C.p != null && (m[C.p] = O), O = void 0);
880
880
  }
881
881
  var p, v, w;
@@ -886,20 +886,20 @@ function on() {
886
886
  i = i.slice(), z(d);
887
887
  const m = r.readCursor(d);
888
888
  let D, O, I = !1;
889
- const R = [];
889
+ const x = [];
890
890
  for (let p = 0; ; p++) {
891
891
  const v = i[p], w = m.getComponent();
892
892
  if (w && (w.r !== void 0 ? I = !0 : w.p != null && (I = !1, D = w.p, O = p)), p >= i.length) break;
893
893
  let C = 0;
894
- const N = r.advancer(m, void 0, (g, S) => {
894
+ const R = r.advancer(m, void 0, (g, S) => {
895
895
  _(S) && C++;
896
896
  });
897
- R.unshift(N);
898
- const B = N(v);
899
- if (typeof v == "number" && (i[p] -= C), !B) break;
897
+ x.unshift(R);
898
+ const W = R(v);
899
+ if (typeof v == "number" && (i[p] -= C), !W) break;
900
900
  }
901
- if (R.forEach((p) => p.end()), I) return null;
902
- const $ = () => {
901
+ if (x.forEach((p) => p.end()), I) return null;
902
+ const N = () => {
903
903
  let p = 0;
904
904
  if (D != null) {
905
905
  const v = m.getPath();
@@ -912,39 +912,39 @@ function on() {
912
912
  C.transformPosition && (i[p] = C.transformPosition(i[p], g));
913
913
  break;
914
914
  }
915
- let N = 0;
916
- const B = r.advancer(m, (g, S) => s(S) ? ~(g - N) : g - N, (g, S) => {
917
- s(S) && N++;
915
+ let R = 0;
916
+ const W = r.advancer(m, (g, S) => s(S) ? ~(g - R) : g - R, (g, S) => {
917
+ s(S) && R++;
918
918
  })(v);
919
- if (typeof v == "number" && (i[p] += N), !B) break;
919
+ if (typeof v == "number" && (i[p] += R), !W) break;
920
920
  }
921
921
  };
922
922
  return D != null ? m.eachDrop(null, (p) => {
923
- p === D && $();
924
- }) : $(), i;
923
+ p === D && N();
924
+ }) : N(), i;
925
925
  }
926
926
  function ne(i, d) {
927
927
  if (z(i), z(d), i == null) return d;
928
928
  if (d == null) return i;
929
929
  let m = 0;
930
- const D = r.readCursor(i), O = r.readCursor(d), I = r.writeCursor(), R = [], $ = [], p = [], v = [], w = [], C = [], N = /* @__PURE__ */ new Set();
930
+ const D = r.readCursor(i), O = r.readCursor(d), I = r.writeCursor(), x = [], N = [], p = [], v = [], w = [], C = [], R = /* @__PURE__ */ new Set();
931
931
  D.traverse(null, (g) => {
932
932
  g.p != null && (p[g.p] = D.clone());
933
933
  }), O.traverse(null, (g) => {
934
934
  g.d != null && (v[g.d] = O.clone());
935
935
  });
936
- const B = r.writeCursor();
937
- return (function g(S, re, te, K, se, Ne, Oe, ye) {
936
+ const W = r.writeCursor();
937
+ return (function g(S, re, te, $, se, Re, Oe, ye) {
938
938
  o(re || te);
939
- const oe = l(re), Pe = l(te), Ae = !!Pe && Pe.r !== void 0, qe = !!oe && oe.i !== void 0, Te = oe ? oe.d : null, Ie = Pe ? Pe.p : null, Re = (Ne || Ae) && Ie == null;
940
- if (Ie != null) K = v[Ie], Oe = $[Ie] = new r.WriteCursor();
941
- else if (Pe && Pe.r !== void 0) K = null;
939
+ const oe = l(re), Pe = l(te), Ae = !!Pe && Pe.r !== void 0, Ke = !!oe && oe.i !== void 0, Te = oe ? oe.d : null, Ie = Pe ? Pe.p : null, xe = (Re || Ae) && Ie == null;
940
+ if (Ie != null) $ = v[Ie], Oe = N[Ie] = new r.WriteCursor();
941
+ else if (Pe && Pe.r !== void 0) $ = null;
942
942
  else {
943
- const T = l(K);
944
- T && T.d != null && (K = null);
943
+ const T = l($);
944
+ T && T.d != null && ($ = null);
945
945
  }
946
- const Q = l(K);
947
- if (Te != null) if (S = p[Te], ye = R[Te] = new r.WriteCursor(), Re) Ne && !Ae && ye.write("r", !0);
946
+ const Q = l($);
947
+ if (Te != null) if (S = p[Te], ye = x[Te] = new r.WriteCursor(), xe) Re && !Ae && ye.write("r", !0);
948
948
  else {
949
949
  const T = w[Te] = m++;
950
950
  Oe.write("d", T);
@@ -955,61 +955,61 @@ function on() {
955
955
  T && T.p != null && (S = null);
956
956
  }
957
957
  let A;
958
- qe ? (o(se === void 0), A = oe.i) : A = se;
959
- const W = (Ie == null ? !qe || Ne || Ae : A === void 0) ? null : Oe.getComponent();
958
+ Ke ? (o(se === void 0), A = oe.i) : A = se;
959
+ const G = (Ie == null ? !Ke || Re || Ae : A === void 0) ? null : Oe.getComponent();
960
960
  if (Ie != null) {
961
- if (!(se !== void 0 || qe)) {
961
+ if (!(se !== void 0 || Ke)) {
962
962
  const T = Te != null ? w[Te] : m++;
963
963
  C[Ie] = T, ye.write("p", T);
964
964
  }
965
- } else Ae && (qe || se !== void 0 || (Pe.r, ye.write("r", Pe.r)));
966
- const M = Re ? null : ve(oe), P = ve(Q);
965
+ } else Ae && (Ke || se !== void 0 || (Pe.r, ye.write("r", Pe.r)));
966
+ const M = xe ? null : ve(oe), P = ve(Q);
967
967
  if ((M || P) && (M && M.name, P && P.name), M && P) {
968
968
  o(M === P);
969
- const T = f(oe), G = f(Q), he = M.compose(T, G);
970
- y(Oe, M, he), N.add(Q);
971
- } else M ? y(Oe, M, f(oe)) : P && (y(Oe, P, f(Q)), N.add(Q));
969
+ const T = f(oe), L = f(Q), he = M.compose(T, L);
970
+ y(Oe, M, he), R.add(Q);
971
+ } else M ? y(Oe, M, f(oe)) : P && (y(Oe, P, f(Q)), R.add(Q));
972
972
  const k = typeof A == "object" && A != null;
973
973
  let J = !1, X = 0, ee = 0, fe = 0, de = 0, ae = 0;
974
- const me = r.advancer(K, (T, G) => s(G) ? de - T - 1 : T - de, (T, G) => {
975
- s(G) && de++;
976
- }), H = r.advancer(S, (T, G) => _(G) ? X - T - 1 : T - X, (T, G) => {
977
- _(G) && X++;
974
+ const me = r.advancer($, (T, L) => s(L) ? de - T - 1 : T - de, (T, L) => {
975
+ s(L) && de++;
976
+ }), H = r.advancer(S, (T, L) => _(L) ? X - T - 1 : T - X, (T, L) => {
977
+ _(L) && X++;
978
978
  });
979
- if (r.eachChildOf(re, te, (T, G, he) => {
980
- let we, xe, Ke = T, Me = T, Ye = T;
979
+ if (r.eachChildOf(re, te, (T, L, he) => {
980
+ let we, Be, $e = T, Me = T, Ye = T;
981
981
  if (typeof T == "number") {
982
982
  let _e = T + fe;
983
- xe = me(_e), Me = _e + de;
983
+ Be = me(_e), Me = _e + de;
984
984
  let ue = T + ee;
985
- we = H(ue), s(l(xe)) && (we = null), Ke = ue + X, Ye = T + ae, o(Ke >= 0, "p1PickKey is negative"), o(Me >= 0, "p2DropKey is negative");
986
- const Se = s(l(G)), Be = _(l(he));
987
- (Se || Be && !Re) && ae--, Se && ee--, Be && fe--;
988
- } else we = H(T), xe = me(T);
989
- ye.descend(Ke), Oe.descend(Me);
990
- const Xe = k && !s(l(G)) ? A[Ye] : void 0, je = g(we, G, he, xe, Xe, Re, Oe, ye);
991
- var $e, j, ie;
992
- k && !Re ? Xe !== je && (J || (A = Array.isArray(A) ? A.slice() : Object.assign({}, A), J = !0), $e = A, ie = je, typeof (j = Ye) == "number" ? (o(Array.isArray($e)), o(j < $e.length)) : (o(!Array.isArray($e)), o($e[j] !== void 0)), ie === void 0 ? typeof j == "number" ? $e.splice(j, 1) : delete $e[j] : $e[j] = ie) : o(je === void 0), Oe.ascend(), ye.ascend();
993
- }), H.end(), me.end(), W != null) W.i = A;
994
- else if (!Ne && !Ae && Ie == null) return A;
995
- })(D, D.clone(), O, O.clone(), void 0, !1, I, B), I.reset(), I.mergeTree(B.get()), I.reset(), I.get(), R.map((g) => g.get()), $.map((g) => g.get()), D.traverse(I, (g, S) => {
985
+ we = H(ue), s(l(Be)) && (we = null), $e = ue + X, Ye = T + ae, o($e >= 0, "p1PickKey is negative"), o(Me >= 0, "p2DropKey is negative");
986
+ const Se = s(l(L)), We = _(l(he));
987
+ (Se || We && !xe) && ae--, Se && ee--, We && fe--;
988
+ } else we = H(T), Be = me(T);
989
+ ye.descend($e), Oe.descend(Me);
990
+ const Xe = k && !s(l(L)) ? A[Ye] : void 0, je = g(we, L, he, Be, Xe, xe, Oe, ye);
991
+ var Ne, j, ie;
992
+ k && !xe ? Xe !== je && (J || (A = Array.isArray(A) ? A.slice() : Object.assign({}, A), J = !0), Ne = A, ie = je, typeof (j = Ye) == "number" ? (o(Array.isArray(Ne)), o(j < Ne.length)) : (o(!Array.isArray(Ne)), o(Ne[j] !== void 0)), ie === void 0 ? typeof j == "number" ? Ne.splice(j, 1) : delete Ne[j] : Ne[j] = ie) : o(je === void 0), Oe.ascend(), ye.ascend();
993
+ }), H.end(), me.end(), G != null) G.i = A;
994
+ else if (!Re && !Ae && Ie == null) return A;
995
+ })(D, D.clone(), O, O.clone(), void 0, !1, I, W), I.reset(), I.mergeTree(W.get()), I.reset(), I.get(), x.map((g) => g.get()), N.map((g) => g.get()), D.traverse(I, (g, S) => {
996
996
  const re = g.p;
997
997
  if (re != null) {
998
998
  const te = w[re];
999
999
  te != null && S.write("p", te);
1000
- const K = R[re];
1001
- K && K.get(), K && S.mergeTree(K.get());
1000
+ const $ = x[re];
1001
+ $ && $.get(), $ && S.mergeTree($.get());
1002
1002
  } else g.r !== void 0 && S.write("r", g.r);
1003
1003
  }), I.reset(), I.get(), O.traverse(I, (g, S) => {
1004
1004
  const re = g.d;
1005
1005
  if (re != null) {
1006
- const K = C[re];
1007
- K != null && S.write("d", K);
1008
- const se = $[re];
1006
+ const $ = C[re];
1007
+ $ != null && S.write("d", $);
1008
+ const se = N[re];
1009
1009
  se && S.mergeTree(se.get());
1010
1010
  } else g.i !== void 0 && S.write("i", g.i);
1011
1011
  const te = ve(g);
1012
- te && !N.has(g) && y(S, te, f(g));
1012
+ te && !R.has(g) && y(S, te, f(g));
1013
1013
  }), I.get();
1014
1014
  }
1015
1015
  function le(i) {
@@ -1017,52 +1017,52 @@ function on() {
1017
1017
  const d = new r.ReadCursor(i), m = new r.WriteCursor();
1018
1018
  let D;
1019
1019
  const O = [], I = [];
1020
- return (function R($, p, v) {
1021
- const w = $.getComponent();
1022
- let C, N = !1;
1020
+ return (function x(N, p, v) {
1021
+ const w = N.getComponent();
1022
+ let C, R = !1;
1023
1023
  if (w) {
1024
- w.p != null && (p.write("d", w.p), O[w.p] = $.clone()), w.r !== void 0 && p.write("i", w.r), w.d != null && (p.write("p", w.d), v = void 0), w.i !== void 0 && (v = C = w.i);
1024
+ w.p != null && (p.write("d", w.p), O[w.p] = N.clone()), w.r !== void 0 && p.write("i", w.r), w.d != null && (p.write("p", w.d), v = void 0), w.i !== void 0 && (v = C = w.i);
1025
1025
  const g = ve(w);
1026
- g && (v === void 0 ? (D || (D = /* @__PURE__ */ new Set()), D.add(w)) : (f(w), v = g.apply(v, f(w)), N = !0));
1026
+ g && (v === void 0 ? (D || (D = /* @__PURE__ */ new Set()), D.add(w)) : (f(w), v = g.apply(v, f(w)), R = !0));
1027
1027
  }
1028
- let B = 0;
1029
- for (const g of $) {
1028
+ let W = 0;
1029
+ for (const g of N) {
1030
1030
  p.descend(g);
1031
- const S = typeof g == "number" ? g - B : g, re = Y(v, S);
1032
- s($.getComponent()) && B++;
1033
- const te = R($, p, re);
1031
+ const S = typeof g == "number" ? g - W : g, re = Y(v, S);
1032
+ s(N.getComponent()) && W++;
1033
+ const te = x(N, p, re);
1034
1034
  if (v !== void 0 && te !== void 0) {
1035
- if (N || (N = !0, v = x(v)), !U(v, S)) throw Error("Cannot modify child - invalid operation");
1035
+ if (R || (R = !0, v = B(v)), !U(v, S)) throw Error("Cannot modify child - invalid operation");
1036
1036
  v[S] = te;
1037
1037
  }
1038
1038
  p.ascend();
1039
1039
  }
1040
- if (C === void 0) return N ? v : void 0;
1040
+ if (C === void 0) return R ? v : void 0;
1041
1041
  p.write("r", v);
1042
- })(d, m, void 0), D && (m.reset(), (function R($, p, v) {
1042
+ })(d, m, void 0), D && (m.reset(), (function x(N, p, v) {
1043
1043
  const w = p.getComponent();
1044
1044
  if (w) {
1045
1045
  const g = w.d;
1046
- if (g != null && ($ = O[g], v = I[g] = r.writeCursor()), D.has(w)) {
1046
+ if (g != null && (N = O[g], v = I[g] = r.writeCursor()), D.has(w)) {
1047
1047
  const S = ve(w);
1048
1048
  if (!S.invert) throw Error(`Cannot invert subtype ${S.name}`);
1049
1049
  y(v, S, S.invert(f(w)));
1050
1050
  }
1051
1051
  }
1052
- let C = 0, N = 0;
1053
- const B = r.advancer($, (g, S) => _(S) ? C - g - 1 : g - C, (g, S) => {
1052
+ let C = 0, R = 0;
1053
+ const W = r.advancer(N, (g, S) => _(S) ? C - g - 1 : g - C, (g, S) => {
1054
1054
  _(S) && C++;
1055
1055
  });
1056
1056
  for (const g of p) if (typeof g == "number") {
1057
- const S = g - N, re = B(S), te = S + C;
1058
- v.descend(te), R(re, p, v), s(p.getComponent()) && N++, v.ascend();
1059
- } else v.descend(g), R(B(g), p, v), v.ascend();
1060
- B.end();
1061
- })(d.clone(), d, m), I.length && (m.reset(), d.traverse(m, (R, $) => {
1062
- const p = R.p;
1057
+ const S = g - R, re = W(S), te = S + C;
1058
+ v.descend(te), x(re, p, v), s(p.getComponent()) && R++, v.ascend();
1059
+ } else v.descend(g), x(W(g), p, v), v.ascend();
1060
+ W.end();
1061
+ })(d.clone(), d, m), I.length && (m.reset(), d.traverse(m, (x, N) => {
1062
+ const p = x.p;
1063
1063
  if (p != null) {
1064
1064
  const v = I[p];
1065
- v && v.get(), v && $.mergeTree(v.get());
1065
+ v && v.get(), v && N.mergeTree(v.get());
1066
1066
  }
1067
1067
  }))), m.get();
1068
1068
  }
@@ -1074,44 +1074,44 @@ function on() {
1074
1074
  })) return i;
1075
1075
  const m = new r.ReadCursor(i), D = new r.WriteCursor();
1076
1076
  let O = !1;
1077
- const I = [], R = [], $ = (p, v, w) => {
1077
+ const I = [], x = [], N = (p, v, w) => {
1078
1078
  const C = p.getComponent();
1079
- let N = !1;
1079
+ let R = !1;
1080
1080
  if (C) {
1081
1081
  C.d != null && v.write("d", C.d), C.i !== void 0 && v.write("i", C.i);
1082
1082
  const g = C.p;
1083
- if (g != null && (I[g] = p.clone(), o(w !== void 0, "Operation picks up at an invalid key"), R[g] = w, v.write("p", C.p)), C.r !== void 0 && w === void 0) throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");
1083
+ if (g != null && (I[g] = p.clone(), o(w !== void 0, "Operation picks up at an invalid key"), x[g] = w, v.write("p", C.p)), C.r !== void 0 && w === void 0) throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");
1084
1084
  const S = ve(C);
1085
1085
  S && (S.makeInvertible ? O = !0 : y(v, S, f(C), !0));
1086
1086
  }
1087
- let B = 0;
1087
+ let W = 0;
1088
1088
  for (const g of p) {
1089
1089
  v.descend(g);
1090
- const S = typeof g == "number" ? g - B : g, re = Y(w, S), te = $(p, v, re);
1091
- re !== te && (N || (N = !0, w = x(w)), te === void 0 ? (w = c(w, S), typeof g == "number" && B++) : w[S] = te), v.ascend();
1090
+ const S = typeof g == "number" ? g - W : g, re = Y(w, S), te = N(p, v, re);
1091
+ re !== te && (R || (R = !0, w = B(w)), te === void 0 ? (w = c(w, S), typeof g == "number" && W++) : w[S] = te), v.ascend();
1092
1092
  }
1093
1093
  return C && (C.r !== void 0 ? (v.write("r", t.default(w)), w = void 0) : C.p != null && (w = void 0)), w;
1094
1094
  };
1095
- return $(m, D, d), D.get(), O && (D.reset(), (function p(v, w, C, N, B) {
1095
+ return N(m, D, d), D.get(), O && (D.reset(), (function p(v, w, C, R, W) {
1096
1096
  const g = w.getComponent();
1097
1097
  if (g) {
1098
- g.i !== void 0 ? (N = g.i, B = !0) : g.d != null && (N = R[g.d], v = I[g.d], B = !1, g.d);
1099
- let K = ve(g);
1100
- if (K && K.makeInvertible) {
1098
+ g.i !== void 0 ? (R = g.i, W = !0) : g.d != null && (R = x[g.d], v = I[g.d], W = !1, g.d);
1099
+ let $ = ve(g);
1100
+ if ($ && $.makeInvertible) {
1101
1101
  const se = f(g);
1102
- y(C, K, K.makeInvertible(se, N), !0);
1102
+ y(C, $, $.makeInvertible(se, R), !0);
1103
1103
  }
1104
1104
  }
1105
1105
  let S = 0, re = 0;
1106
- const te = r.advancer(v, (K, se) => _(se) ? S - K - 1 : K - S, (K, se) => {
1106
+ const te = r.advancer(v, ($, se) => _(se) ? S - $ - 1 : $ - S, ($, se) => {
1107
1107
  _(se) && S++;
1108
1108
  });
1109
- for (const K of w) if (typeof K == "number") {
1110
- const se = K - re, Ne = te(se), Oe = se + S, ye = Y(N, B ? se : Oe);
1111
- C.descend(K), p(Ne, w, C, ye, B), s(w.getComponent()) && re++, C.ascend();
1109
+ for (const $ of w) if (typeof $ == "number") {
1110
+ const se = $ - re, Re = te(se), Oe = se + S, ye = Y(R, W ? se : Oe);
1111
+ C.descend($), p(Re, w, C, ye, W), s(w.getComponent()) && re++, C.ascend();
1112
1112
  } else {
1113
- const se = Y(N, K);
1114
- C.descend(K), p(te(K), w, C, se, B), C.ascend();
1113
+ const se = Y(R, $);
1114
+ C.descend($), p(te($), w, C, se, W), C.ascend();
1115
1115
  }
1116
1116
  te.end();
1117
1117
  })(m.clone(), m, D, d, !1)), D.get();
@@ -1137,26 +1137,26 @@ function on() {
1137
1137
  };
1138
1138
  z(i), z(d);
1139
1139
  let O = null;
1140
- const I = [], R = [], $ = [], p = [], v = [], w = [], C = [], N = [], B = [], g = [], S = [], re = [], te = [], K = [], se = [];
1141
- let Ne = 0;
1140
+ const I = [], x = [], N = [], p = [], v = [], w = [], C = [], R = [], W = [], g = [], S = [], re = [], te = [], $ = [], se = [];
1141
+ let Re = 0;
1142
1142
  const Oe = r.readCursor(i), ye = r.readCursor(d), oe = r.writeCursor();
1143
- if ((function Q(A, W = null, M) {
1144
- const P = l(W);
1145
- P && (P.r !== void 0 ? M = W.clone() : P.p != null && (M = null, w[P.p] = A.clone()));
1143
+ if ((function Q(A, G = null, M) {
1144
+ const P = l(G);
1145
+ P && (P.r !== void 0 ? M = G.clone() : P.p != null && (M = null, w[P.p] = A.clone()));
1146
1146
  const k = A.getComponent();
1147
1147
  let J;
1148
- k && (J = k.p) != null && (v[J] = W ? W.clone() : null, $[J] = A.clone(), M && (g[J] = !0, B[J] = M), P && P.p != null && (K[J] = P.p));
1149
- const X = r.advancer(W);
1148
+ k && (J = k.p) != null && (v[J] = G ? G.clone() : null, N[J] = A.clone(), M && (g[J] = !0, W[J] = M), P && P.p != null && ($[J] = P.p));
1149
+ const X = r.advancer(G);
1150
1150
  for (const ee of A) Q(A, X(ee), M);
1151
1151
  X.end();
1152
- })(ye, Oe, null), (function Q(A, W, M, P, k) {
1152
+ })(ye, Oe, null), (function Q(A, G, M, P, k) {
1153
1153
  const J = M.getComponent();
1154
1154
  let X, ee = !1;
1155
- J && ((X = J.d) != null ? (p[X] = M.clone(), P != null && (se[P] == null && (se[P] = []), se[P].push(X)), g[X], A = v[X] || null, W = $[X] || null, g[X] ? (k && (S[X] = !0), k = B[X] || null) : !k || D !== 1 && K[X] != null || O == null && (O = {
1155
+ J && ((X = J.d) != null ? (p[X] = M.clone(), P != null && (se[P] == null && (se[P] = []), se[P].push(X)), g[X], A = v[X] || null, G = N[X] || null, g[X] ? (k && (S[X] = !0), k = W[X] || null) : !k || D !== 1 && $[X] != null || O == null && (O = {
1156
1156
  type: u.ConflictType.RM_UNEXPECTED_CONTENT,
1157
1157
  op1: a.removeOp(k.getPath()),
1158
- op2: a.moveOp(W.getPath(), M.getPath())
1159
- }), ee = !0) : J.i !== void 0 && (A = W = null, ee = !0, k && O == null && (O = {
1158
+ op2: a.moveOp(G.getPath(), M.getPath())
1159
+ }), ee = !0) : J.i !== void 0 && (A = G = null, ee = !0, k && O == null && (O = {
1160
1160
  type: u.ConflictType.RM_UNEXPECTED_CONTENT,
1161
1161
  op1: a.removeOp(k.getPath()),
1162
1162
  op2: a.insertOp(M.getPath(), J.i)
@@ -1170,15 +1170,15 @@ function on() {
1170
1170
  op2: a.editOp(M.getPath(), de, f(J), !0)
1171
1171
  });
1172
1172
  let ae = 0, me = 0;
1173
- const H = r.advancer(W, (G, he) => _(he) ? ae - G - 1 : G - ae, (G, he) => {
1173
+ const H = r.advancer(G, (L, he) => _(he) ? ae - L - 1 : L - ae, (L, he) => {
1174
1174
  _(he) && ae++;
1175
1175
  }), T = r.advancer(A);
1176
- for (const G of M) if (typeof G == "number") {
1177
- const he = G - me, we = H(he);
1176
+ for (const L of M) if (typeof L == "number") {
1177
+ const he = L - me, we = H(he);
1178
1178
  me += +Q(T(he + ae), we, M, P, k);
1179
1179
  } else {
1180
- const he = H(G);
1181
- Q(T(G), he, M, P, k);
1180
+ const he = H(L);
1181
+ Q(T(L), he, M, P, k);
1182
1182
  }
1183
1183
  return H.end(), T.end(), ee;
1184
1184
  })(Oe, ye, ye.clone(), null, null), p.map((Q) => Q && Q.get()), O) return {
@@ -1188,57 +1188,57 @@ function on() {
1188
1188
  S.map((Q) => !!Q);
1189
1189
  const Pe = [];
1190
1190
  let Ae = null;
1191
- (function Q(A, W, M, P, k) {
1191
+ (function Q(A, G, M, P, k) {
1192
1192
  let J = !1;
1193
- const X = l(W);
1193
+ const X = l(G);
1194
1194
  if (_(X)) {
1195
1195
  const H = X.p;
1196
- H != null ? (M = p[H], P = re[H] = r.writeCursor(), J = !0, k = null) : (M = null, k = W.clone());
1196
+ H != null ? (M = p[H], P = re[H] = r.writeCursor(), J = !0, k = null) : (M = null, k = G.clone());
1197
1197
  } else s(l(M)) && (M = null);
1198
1198
  const ee = A.getComponent();
1199
1199
  if (ee) {
1200
1200
  const H = ee.p;
1201
- H != null ? (k && (N[H] = k), Pe[H] = k || D === 1 && J ? null : P.getComponent(), I[H] = A.clone(), M && (C[H] = M.clone())) : ee.r !== void 0 && (k || P.write("r", !0), (k || J) && (Ae == null && (Ae = /* @__PURE__ */ new Set()), Ae.add(ee)));
1201
+ H != null ? (k && (R[H] = k), Pe[H] = k || D === 1 && J ? null : P.getComponent(), I[H] = A.clone(), M && (C[H] = M.clone())) : ee.r !== void 0 && (k || P.write("r", !0), (k || J) && (Ae == null && (Ae = /* @__PURE__ */ new Set()), Ae.add(ee)));
1202
1202
  }
1203
1203
  let fe = 0, de = 0;
1204
- const ae = r.advancer(W, void 0, (H, T) => {
1204
+ const ae = r.advancer(G, void 0, (H, T) => {
1205
1205
  _(T) && fe++;
1206
1206
  }), me = r.advancer(M, (H, T) => s(T) ? ~(H - de) : H - de, (H, T) => {
1207
1207
  s(T) && de++;
1208
1208
  });
1209
1209
  if (A) for (const H of A) if (typeof H == "string") {
1210
- const T = ae(H), G = me(H);
1211
- P.descend(H), Q(A, T, G, P, k), P.ascend();
1210
+ const T = ae(H), L = me(H);
1211
+ P.descend(H), Q(A, T, L, P, k), P.ascend();
1212
1212
  } else {
1213
- const T = ae(H), G = H - fe, he = _(l(T)) ? null : me(G), we = G + de;
1213
+ const T = ae(H), L = H - fe, he = _(l(T)) ? null : me(L), we = L + de;
1214
1214
  o(we >= 0), P.descend(we), Q(A, T, he, P, k), P.ascend();
1215
1215
  }
1216
1216
  ae.end(), me.end();
1217
1217
  })(Oe, ye, ye.clone(), oe, null), oe.reset();
1218
- let qe = [];
1219
- if ((function Q(A, W, M, P, k, J) {
1220
- o(W);
1221
- const X = W.getComponent();
1218
+ let Ke = [];
1219
+ if ((function Q(A, G, M, P, k, J) {
1220
+ o(G);
1221
+ const X = G.getComponent();
1222
1222
  let ee = l(P), fe = !1;
1223
1223
  const de = (j, ie, _e) => j ? a.moveOp(j.getPath(), ie.getPath()) : a.insertOp(ie.getPath(), _e.i);
1224
1224
  if (s(X)) {
1225
1225
  const j = X.d;
1226
- j != null && (R[j] = W.clone());
1226
+ j != null && (x[j] = G.clone());
1227
1227
  const ie = j != null ? Pe[j] : null;
1228
1228
  let _e = !1;
1229
1229
  if (X.i !== void 0 || j != null && ie) {
1230
1230
  let ue;
1231
- ee && (ee.i !== void 0 || (ue = ee.d) != null && !g[ue]) && (_e = ue != null ? j != null && j === K[ue] : n.default(ee.i, X.i), _e || ue != null && D !== 1 && K[ue] != null || O == null && (O = {
1231
+ ee && (ee.i !== void 0 || (ue = ee.d) != null && !g[ue]) && (_e = ue != null ? j != null && j === $[ue] : n.default(ee.i, X.i), _e || ue != null && D !== 1 && $[ue] != null || O == null && (O = {
1232
1232
  type: u.ConflictType.DROP_COLLISION,
1233
- op1: de(j != null ? I[j] : null, W, X),
1234
- op2: de(ue != null ? $[ue] : null, P, ee)
1233
+ op1: de(j != null ? I[j] : null, G, X),
1234
+ op2: de(ue != null ? N[ue] : null, P, ee)
1235
1235
  })), _e || (J ? O == null && (O = {
1236
1236
  type: u.ConflictType.RM_UNEXPECTED_CONTENT,
1237
- op1: de(j != null ? I[j] : null, W, X),
1237
+ op1: de(j != null ? I[j] : null, G, X),
1238
1238
  op2: a.removeOp(J.getPath())
1239
- }) : (j != null ? (qe[Ne] = j, k.write("d", ie.p = Ne++)) : k.write("i", t.default(X.i)), fe = !0));
1239
+ }) : (j != null ? (Ke[Re] = j, k.write("d", ie.p = Re++)) : k.write("i", t.default(X.i)), fe = !0));
1240
1240
  } else if (j != null && !ie) {
1241
- const ue = N[j];
1241
+ const ue = R[j];
1242
1242
  ue && (J = ue.clone());
1243
1243
  }
1244
1244
  j != null ? (A = I[j], M = w[j], P = C[j]) : X.i !== void 0 && (A = M = null, _e || (P = null));
@@ -1246,7 +1246,7 @@ function on() {
1246
1246
  const ae = l(A), me = l(M);
1247
1247
  if (_(me)) {
1248
1248
  const j = me.p;
1249
- me.r !== void 0 && (!ae || ae.r === void 0) || g[j] ? (P = null, J = M.clone()) : j != null && (P = p[j], D !== 1 && K[j] != null || ((k = te[j]) || (k = te[j] = r.writeCursor()), k.reset(), J = null));
1249
+ me.r !== void 0 && (!ae || ae.r === void 0) || g[j] ? (P = null, J = M.clone()) : j != null && (P = p[j], D !== 1 && $[j] != null || ((k = te[j]) || (k = te[j] = r.writeCursor()), k.reset(), J = null));
1250
1250
  } else !s(X) && s(ee) && (P = null);
1251
1251
  ee = P != null ? P.getComponent() : null;
1252
1252
  const H = ve(X);
@@ -1254,7 +1254,7 @@ function on() {
1254
1254
  const j = f(X);
1255
1255
  if (J) O == null && (O = {
1256
1256
  type: u.ConflictType.RM_UNEXPECTED_CONTENT,
1257
- op1: a.editOp(W.getPath(), H, j, !0),
1257
+ op1: a.editOp(G.getPath(), H, j, !0),
1258
1258
  op2: a.removeOp(J.getPath())
1259
1259
  });
1260
1260
  else {
@@ -1268,37 +1268,37 @@ function on() {
1268
1268
  y(k, H, _e);
1269
1269
  }
1270
1270
  }
1271
- let T = 0, G = 0, he = 0, we = 0, xe = 0, Ke = 0, Me = A != null && A.descendFirst(), Ye = Me;
1271
+ let T = 0, L = 0, he = 0, we = 0, Be = 0, $e = 0, Me = A != null && A.descendFirst(), Ye = Me;
1272
1272
  const Xe = r.advancer(M, void 0, (j, ie) => {
1273
1273
  _(ie) && he++;
1274
1274
  });
1275
- let je = P != null && P.descendFirst(), $e = je;
1276
- for (const j of W) if (typeof j == "number") {
1275
+ let je = P != null && P.descendFirst(), Ne = je;
1276
+ for (const j of G) if (typeof j == "number") {
1277
1277
  let ie;
1278
- const _e = s(W.getComponent()), ue = j - G;
1278
+ const _e = s(G.getComponent()), ue = j - L;
1279
1279
  {
1280
- let We;
1281
- for (; Me && typeof (We = A.getKey()) == "number"; ) {
1282
- We += T;
1280
+ let Ge;
1281
+ for (; Me && typeof (Ge = A.getKey()) == "number"; ) {
1282
+ Ge += T;
1283
1283
  const ke = A.getComponent(), Je = _(ke);
1284
- if (We > ue || We === ue && (!Je || D === 0 && _e)) break;
1284
+ if (Ge > ue || Ge === ue && (!Je || D === 0 && _e)) break;
1285
1285
  if (Je) {
1286
1286
  T--;
1287
1287
  const Fe = ke.p;
1288
- K.includes(Fe), ke.d, l(te[ke.d]), _(l(te[ke.d])), (ke.r === void 0 || Ae && Ae.has(ke)) && (Fe == null || !Pe[Fe] || D !== 1 && K.includes(Fe)) || xe--;
1288
+ $.includes(Fe), ke.d, l(te[ke.d]), _(l(te[ke.d])), (ke.r === void 0 || Ae && Ae.has(ke)) && (Fe == null || !Pe[Fe] || D !== 1 && $.includes(Fe)) || Be--;
1289
1289
  }
1290
1290
  Me = A.nextSibling();
1291
1291
  }
1292
- ie = Me && We === ue ? A : null;
1292
+ ie = Me && Ge === ue ? A : null;
1293
1293
  }
1294
1294
  const Se = ue - T;
1295
- let Be = Xe(Se);
1295
+ let We = Xe(Se);
1296
1296
  const ot = Se - he;
1297
1297
  let Qe = null;
1298
1298
  {
1299
- let We, ke;
1300
- for (; je && typeof (We = P.getKey()) == "number"; ) {
1301
- ke = We - we;
1299
+ let Ge, ke;
1300
+ for (; je && typeof (Ge = P.getKey()) == "number"; ) {
1301
+ ke = Ge - we;
1302
1302
  const Je = P.getComponent(), Fe = s(Je);
1303
1303
  if (ke > ot) break;
1304
1304
  if (ke === ot) {
@@ -1311,82 +1311,82 @@ function on() {
1311
1311
  Qe = P;
1312
1312
  break;
1313
1313
  }
1314
- const Ge = Be && _(Be.getComponent());
1315
- if (D === 0 && Ge) break;
1314
+ const Le = We && _(We.getComponent());
1315
+ if (D === 0 && Le) break;
1316
1316
  }
1317
1317
  }
1318
1318
  if (Fe) {
1319
- const Ge = Je.d;
1320
- g[Ge], K[Ge], Je.i === void 0 && (g[Ge] || K[Ge] != null && D !== 1) ? (g[Ge] || K[Ge] != null && D === 0) && (we++, Ke--) : we++;
1319
+ const Le = Je.d;
1320
+ g[Le], $[Le], Je.i === void 0 && (g[Le] || $[Le] != null && D !== 1) ? (g[Le] || $[Le] != null && D === 0) && (we++, $e--) : we++;
1321
1321
  }
1322
1322
  je = P.nextSibling();
1323
1323
  }
1324
1324
  }
1325
- const _t = ot + we + xe + Ke;
1326
- o(_t >= 0, "trying to descend to a negative index"), k.descend(_t), _e && (ie = Be = Qe = null, G++), Q(ie, W, Be, Qe, k, J) && Ke++, k.ascend();
1325
+ const _t = ot + we + Be + $e;
1326
+ o(_t >= 0, "trying to descend to a negative index"), k.descend(_t), _e && (ie = We = Qe = null, L++), Q(ie, G, We, Qe, k, J) && $e++, k.ascend();
1327
1327
  } else {
1328
1328
  let ie;
1329
1329
  for (; Me && (ie = A.getKey(), typeof ie != "string" || !(ie > j || ie === j)); ) Me = A.nextSibling();
1330
1330
  const _e = Me && ie === j ? A : null, ue = Xe(j);
1331
1331
  let Se;
1332
1332
  for (; je && (Se = P.getKey(), typeof Se != "string" || !(Se > j || Se === j)); ) je = P.nextSibling();
1333
- const Be = je && Se === j ? P : null;
1334
- k.descend(j), Q(_e, W, ue, Be, k, J), k.ascend();
1333
+ const We = je && Se === j ? P : null;
1334
+ k.descend(j), Q(_e, G, ue, We, k, J), k.ascend();
1335
1335
  }
1336
- return Xe.end(), Ye && A.ascend(), $e && P.ascend(), fe;
1336
+ return Xe.end(), Ye && A.ascend(), Ne && P.ascend(), fe;
1337
1337
  })(Oe, Oe.clone(), ye, ye.clone(), oe, null), O) return {
1338
1338
  ok: !1,
1339
1339
  conflict: O
1340
1340
  };
1341
1341
  oe.reset();
1342
- const Te = (Q, A, W) => Q.traverse(A, (M, P) => {
1343
- M.d != null && W(M.d, Q, P);
1342
+ const Te = (Q, A, G) => Q.traverse(A, (M, P) => {
1343
+ M.d != null && G(M.d, Q, P);
1344
1344
  });
1345
- (g.length || re.length) && (Te(ye, oe, (Q, A, W) => {
1346
- g[Q] && !S[Q] && W.write("r", !0), re[Q] && W.mergeTree(re[Q].get());
1345
+ (g.length || re.length) && (Te(ye, oe, (Q, A, G) => {
1346
+ g[Q] && !S[Q] && G.write("r", !0), re[Q] && G.mergeTree(re[Q].get());
1347
1347
  }), oe.reset());
1348
- const Ie = [], Re = [];
1348
+ const Ie = [], xe = [];
1349
1349
  if ((te.length || g.length) && !O) {
1350
1350
  const Q = r.readCursor(it(oe.get()));
1351
- if (Te(Q, null, (A, W) => {
1352
- Ie[A] = W.clone();
1351
+ if (Te(Q, null, (A, G) => {
1352
+ Ie[A] = G.clone();
1353
1353
  }), te.forEach((A) => {
1354
- A && Te(r.readCursor(A.get()), null, (W, M) => {
1355
- Ie[W] = M.clone();
1354
+ A && Te(r.readCursor(A.get()), null, (G, M) => {
1355
+ Ie[G] = M.clone();
1356
1356
  });
1357
- }), (function A(W, M, P, k, J, X) {
1357
+ }), (function A(G, M, P, k, J, X) {
1358
1358
  const ee = l(M);
1359
1359
  if (ee && _(ee)) if (ee.p != null) {
1360
1360
  const T = ee.p;
1361
- Ie[T].getPath(), P = Ie[T], k = Re[T] = r.writeCursor();
1361
+ Ie[T].getPath(), P = Ie[T], k = xe[T] = r.writeCursor();
1362
1362
  } else ee.r !== void 0 && (P = null);
1363
1363
  else s(l(P)) && (P = null);
1364
- const fe = W.getComponent();
1364
+ const fe = G.getComponent();
1365
1365
  if (fe) {
1366
1366
  let T;
1367
1367
  if ((T = fe.d) != null) {
1368
- const G = te[T];
1369
- G && (G.get(), k.mergeTree(G.get()), P = r.readCursor(G.get()));
1368
+ const L = te[T];
1369
+ L && (L.get(), k.mergeTree(L.get()), P = r.readCursor(L.get()));
1370
1370
  }
1371
1371
  }
1372
1372
  let de = 0, ae = 0;
1373
- const me = r.advancer(M, void 0, (T, G) => {
1374
- _(G) && de--;
1375
- }), H = r.advancer(P, (T, G) => s(G) ? -(T - ae) - 1 : T - ae, (T, G) => {
1376
- s(G) && ae++;
1373
+ const me = r.advancer(M, void 0, (T, L) => {
1374
+ _(L) && de--;
1375
+ }), H = r.advancer(P, (T, L) => s(L) ? -(T - ae) - 1 : T - ae, (T, L) => {
1376
+ s(L) && ae++;
1377
1377
  });
1378
- for (const T of W) if (typeof T == "number") {
1379
- const G = me(T), he = T + de, we = H(he), xe = he + ae;
1380
- k.descend(xe), A(W, G, we, k), k.ascend();
1381
- } else k.descend(T), A(W, me(T), H(T), k), k.ascend();
1378
+ for (const T of G) if (typeof T == "number") {
1379
+ const L = me(T), he = T + de, we = H(he), Be = he + ae;
1380
+ k.descend(Be), A(G, L, we, k), k.ascend();
1381
+ } else k.descend(T), A(G, me(T), H(T), k), k.ascend();
1382
1382
  me.end(), H.end();
1383
1383
  })(ye, Q, Q.clone(), oe), oe.reset(), O) return {
1384
1384
  ok: !1,
1385
1385
  conflict: O
1386
1386
  };
1387
- if (oe.get(), Re.length) {
1388
- const A = Re.map((M) => M ? M.get() : null), W = r.readCursor(it(oe.get()));
1389
- if (Te(W, oe, (M, P, k) => {
1387
+ if (oe.get(), xe.length) {
1388
+ const A = xe.map((M) => M ? M.get() : null), G = r.readCursor(it(oe.get()));
1389
+ if (Te(G, oe, (M, P, k) => {
1390
1390
  const J = A[M];
1391
1391
  J && (k.mergeTree(J), A[M] = null);
1392
1392
  }), A.find((M) => M)) {
@@ -1394,11 +1394,11 @@ function on() {
1394
1394
  let k = 0, J = 0;
1395
1395
  A.forEach((X) => {
1396
1396
  X != null && Te(r.readCursor(X), null, (ee) => {
1397
- const fe = qe[ee];
1398
- M.writeMove(I[fe].getPath(), R[fe].getPath(), k++);
1397
+ const fe = Ke[ee];
1398
+ M.writeMove(I[fe].getPath(), x[fe].getPath(), k++);
1399
1399
  const de = se[fe];
1400
1400
  de && de.forEach((ae) => {
1401
- g[ae] || D !== 1 && K[ae] != null || P.writeMove($[ae].getPath(), p[ae].getPath(), J++);
1401
+ g[ae] || D !== 1 && $[ae] != null || P.writeMove(N[ae].getPath(), p[ae].getPath(), J++);
1402
1402
  });
1403
1403
  });
1404
1404
  }), O = {
@@ -1431,15 +1431,15 @@ function on() {
1431
1431
  return r.readCursor(i).traverse(d, (m, D) => {
1432
1432
  (s(m) || ve(m)) && D.write("r", !0);
1433
1433
  }), d.get();
1434
- }, $t = (i, d) => {
1434
+ }, Nt = (i, d) => {
1435
1435
  const { type: m, op1: D, op2: O } = i;
1436
1436
  switch (m) {
1437
1437
  case u.ConflictType.DROP_COLLISION:
1438
1438
  return d === "left" ? [null, ze(O)] : [ze(D), null];
1439
1439
  case u.ConflictType.RM_UNEXPECTED_CONTENT:
1440
1440
  let I = !1;
1441
- return r.readCursor(D).traverse(null, (R) => {
1442
- R.r !== void 0 && (I = !0);
1441
+ return r.readCursor(D).traverse(null, (x) => {
1442
+ x.r !== void 0 && (I = !0);
1443
1443
  }), I ? [null, ze(O)] : [ze(D), null];
1444
1444
  case u.ConflictType.BLACKHOLE:
1445
1445
  return [ze(D), ze(O)];
@@ -1453,10 +1453,10 @@ function on() {
1453
1453
  const I = st(d, m, D);
1454
1454
  if (I.ok) return ne(O, I.result);
1455
1455
  {
1456
- const { conflict: R } = I;
1457
- i(R) || gt(R);
1458
- const [$, p] = $t(R, D);
1459
- d = ne(q(d), $), m = ne(q(m), p), O = ne(O, p);
1456
+ const { conflict: x } = I;
1457
+ i(x) || gt(x);
1458
+ const [N, p] = Nt(x, D);
1459
+ d = ne(K(d), N), m = ne(K(m), p), O = ne(O, p);
1460
1460
  }
1461
1461
  }
1462
1462
  }
@@ -1579,9 +1579,9 @@ class ln {
1579
1579
  }
1580
1580
  getBatchAddOp(e) {
1581
1581
  const n = [], t = [], r = [];
1582
- e.forEach((x) => {
1583
- const { op: _, invertOp: s } = this._addByParam(x);
1584
- n.push({ unitId: x.unitId, subUnitId: x.subUnitId, drawingId: x.drawingId }), t.push(_), r.push(s);
1582
+ e.forEach((B) => {
1583
+ const { op: _, invertOp: s } = this._addByParam(B);
1584
+ n.push({ unitId: B.unitId, subUnitId: B.subUnitId, drawingId: B.drawingId }), t.push(_), r.push(s);
1585
1585
  });
1586
1586
  const u = t.reduce(V.type.compose, null), o = r.reduce(V.type.compose, null), { unitId: l, subUnitId: E } = e[0];
1587
1587
  return { undo: o, redo: u, unitId: l, subUnitId: E, objects: n };
@@ -1589,17 +1589,17 @@ class ln {
1589
1589
  getBatchRemoveOp(e) {
1590
1590
  const n = [], t = [];
1591
1591
  e.forEach((E) => {
1592
- const { op: x, invertOp: _ } = this._removeByParam(E);
1593
- n.unshift(x), t.push(_);
1592
+ const { op: B, invertOp: _ } = this._removeByParam(E);
1593
+ n.unshift(B), t.push(_);
1594
1594
  });
1595
1595
  const r = n.reduce(V.type.compose, null), u = t.reduce(V.type.compose, null), { unitId: o, subUnitId: l } = e[0];
1596
1596
  return { undo: u, redo: r, unitId: o, subUnitId: l, objects: e };
1597
1597
  }
1598
1598
  getBatchUpdateOp(e) {
1599
1599
  const n = [], t = [], r = [];
1600
- e.forEach((x) => {
1601
- const { op: _, invertOp: s } = this._updateByParam(x);
1602
- n.push({ unitId: x.unitId, subUnitId: x.subUnitId, drawingId: x.drawingId }), t.push(_), r.push(s);
1600
+ e.forEach((B) => {
1601
+ const { op: _, invertOp: s } = this._updateByParam(B);
1602
+ n.push({ unitId: B.unitId, subUnitId: B.subUnitId, drawingId: B.drawingId }), t.push(_), r.push(s);
1603
1603
  });
1604
1604
  const u = t.reduce(V.type.compose, null), o = r.reduce(V.type.compose, null), { unitId: l, subUnitId: E } = e[0];
1605
1605
  return { undo: o, redo: u, unitId: l, subUnitId: E, objects: n };
@@ -1647,8 +1647,8 @@ class ln {
1647
1647
  return [];
1648
1648
  const o = this._getDrawingData(n, t), l = [];
1649
1649
  return Object.keys(o).forEach((E) => {
1650
- const x = o[E];
1651
- x.groupId === r && l.push(x);
1650
+ const B = o[E];
1651
+ B.groupId === r && l.push(B);
1652
1652
  }), l;
1653
1653
  }
1654
1654
  _getGroupDrawingOp(e) {
@@ -1657,10 +1657,10 @@ class ln {
1657
1657
  V.insertOp([r, u, "data", o], n)
1658
1658
  );
1659
1659
  let E = Number.NEGATIVE_INFINITY;
1660
- return t.forEach((x) => {
1661
- const { unitId: _, subUnitId: s, drawingId: c } = x, h = this._hasDrawingOrder({ unitId: _, subUnitId: s, drawingId: c });
1660
+ return t.forEach((B) => {
1661
+ const { unitId: _, subUnitId: s, drawingId: c } = B, h = this._hasDrawingOrder({ unitId: _, subUnitId: s, drawingId: c });
1662
1662
  E = Math.max(E, h), l.push(
1663
- ...this._getUpdateParamCompareOp(x, this.getDrawingByParam({ unitId: _, subUnitId: s, drawingId: c }))
1663
+ ...this._getUpdateParamCompareOp(B, this.getDrawingByParam({ unitId: _, subUnitId: s, drawingId: c }))
1664
1664
  );
1665
1665
  }), E === Number.NEGATIVE_INFINITY && (E = this._getDrawingOrder(r, u).length), l.push(
1666
1666
  V.insertOp([r, u, "order", E], o)
@@ -1669,9 +1669,9 @@ class ln {
1669
1669
  _getUngroupDrawingOp(e) {
1670
1670
  const { parent: n, children: t } = e, { unitId: r, subUnitId: u, drawingId: o } = n, l = [];
1671
1671
  return t.forEach((E) => {
1672
- const { unitId: x, subUnitId: _, drawingId: s } = E;
1672
+ const { unitId: B, subUnitId: _, drawingId: s } = E;
1673
1673
  l.push(
1674
- ...this._getUpdateParamCompareOp(E, this.getDrawingByParam({ unitId: x, subUnitId: _, drawingId: s }))
1674
+ ...this._getUpdateParamCompareOp(E, this.getDrawingByParam({ unitId: B, subUnitId: _, drawingId: s }))
1675
1675
  );
1676
1676
  }), l.push(
1677
1677
  V.removeOp([r, u, "data", o], !0)
@@ -1790,8 +1790,8 @@ class ln {
1790
1790
  const { drawingId: c } = s, h = this._getDrawingCount(n, t) - 1, U = V.moveOp([n, t, "order", this._getDrawingOrder(n, t).indexOf(c)], [n, t, "order", h]);
1791
1791
  E.push(U), o.includes(l[h]) || o.push(l[h]);
1792
1792
  });
1793
- const x = E.reduce(V.type.compose, null);
1794
- return { undo: V.type.invertWithDoc(x, this.drawingManagerData), redo: x, unitId: n, subUnitId: t, objects: { ...e, drawingIds: o } };
1793
+ const B = E.reduce(V.type.compose, null);
1794
+ return { undo: V.type.invertWithDoc(B, this.drawingManagerData), redo: B, unitId: n, subUnitId: t, objects: { ...e, drawingIds: o } };
1795
1795
  }
1796
1796
  getBackDrawingsOp(e) {
1797
1797
  const { unitId: n, subUnitId: t, drawingIds: r } = e, u = this._getOrderFromSearchParams(n, t, r, !0), o = [...r], l = this.getDrawingOrder(n, t), E = [];
@@ -1799,8 +1799,8 @@ class ln {
1799
1799
  const { drawingId: c } = s, h = V.moveOp([n, t, "order", this._getDrawingOrder(n, t).indexOf(c)], [n, t, "order", 0]);
1800
1800
  E.push(h), o.includes(l[0]) || o.push(l[0]);
1801
1801
  });
1802
- const x = E.reduce(V.type.compose, null);
1803
- return { undo: V.type.invertWithDoc(x, this.drawingManagerData), redo: x, unitId: n, subUnitId: t, objects: { ...e, drawingIds: o } };
1802
+ const B = E.reduce(V.type.compose, null);
1803
+ return { undo: V.type.invertWithDoc(B, this.drawingManagerData), redo: B, unitId: n, subUnitId: t, objects: { ...e, drawingIds: o } };
1804
1804
  }
1805
1805
  _getDrawingCount(e, n) {
1806
1806
  return this.getDrawingOrder(e, n).length || 0;
@@ -1809,7 +1809,7 @@ class ln {
1809
1809
  return t.map((u) => {
1810
1810
  const o = this._hasDrawingOrder({ unitId: e, subUnitId: n, drawingId: u });
1811
1811
  return { drawingId: u, zIndex: o };
1812
- }).sort(r === !1 ? Wt : Gt);
1812
+ }).sort(r === !1 ? Gt : Lt);
1813
1813
  }
1814
1814
  _hasDrawingOrder(e) {
1815
1815
  if (e == null)
@@ -1850,8 +1850,8 @@ class ln {
1850
1850
  const { unitId: n, subUnitId: t, drawingId: r } = e;
1851
1851
  if (this._establishDrawingMap(n, t, r) == null)
1852
1852
  return { op: [], invertOp: [] };
1853
- const o = V.removeOp([n, t, "data", r], !0), l = V.removeOp([n, t, "order", this._getDrawingOrder(n, t).indexOf(r)], !0), E = [o, l].reduce(V.type.compose, null), x = V.type.invertWithDoc(E, this.drawingManagerData);
1854
- return { op: E, invertOp: x };
1853
+ const o = V.removeOp([n, t, "data", r], !0), l = V.removeOp([n, t, "order", this._getDrawingOrder(n, t).indexOf(r)], !0), E = [o, l].reduce(V.type.compose, null), B = V.type.invertWithDoc(E, this.drawingManagerData);
1854
+ return { op: E, invertOp: B };
1855
1855
  }
1856
1856
  _updateByParam(e) {
1857
1857
  const { unitId: n, subUnitId: t, drawingId: r } = e, u = this._establishDrawingMap(n, t, r);
@@ -1870,9 +1870,9 @@ class ln {
1870
1870
  _getUpdateParamCompareOp(e, n) {
1871
1871
  const { unitId: t, subUnitId: r, drawingId: u } = e, o = [];
1872
1872
  return Object.keys(e).forEach((l) => {
1873
- const E = e[l], x = n[l];
1874
- x !== E && o.push(
1875
- V.replaceOp([t, r, "data", u, l], x, E)
1873
+ const E = e[l], B = n[l];
1874
+ B !== E && o.push(
1875
+ V.replaceOp([t, r, "data", u, l], B, E)
1876
1876
  );
1877
1877
  }), o;
1878
1878
  }
@@ -1940,7 +1940,7 @@ class cn {
1940
1940
  t(new Error(et.ERROR_IMAGE)), this._decreaseWaiting();
1941
1941
  return;
1942
1942
  }
1943
- const l = Lt(6);
1943
+ const l = qt(6);
1944
1944
  n({
1945
1945
  imageId: l,
1946
1946
  imageSourceType: at.BASE64,
@@ -1989,7 +1989,7 @@ let At = (ft = class extends Ht {
1989
1989
  }
1990
1990
  }, F(ft, "pluginName", hn), ft);
1991
1991
  At = fn([
1992
- dt(1, qt(Kt)),
1992
+ dt(1, Kt($t)),
1993
1993
  dt(2, Ft),
1994
1994
  dt(3, Vt)
1995
1995
  ], At);