@univerjs/drawing 0.5.2 → 0.5.3-nightly.202501041605
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/cjs/index.js +1 -1
- package/lib/es/index.js +126 -126
- package/lib/umd/index.js +1 -1
- package/package.json +4 -17
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var $t = Object.defineProperty;
|
|
2
2
|
var Nt = (a, e, n) => e in a ? $t(a, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : a[e] = n;
|
|
3
3
|
var F = (a, e, n) => Nt(a, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import { sortRules as Rt, sortRulesByDesc as xt, createIdentifier as Bt, ImageSourceType as at, ImageUploadStatusType as
|
|
4
|
+
import { sortRules as Rt, sortRulesByDesc as xt, createIdentifier as Bt, ImageSourceType as at, ImageUploadStatusType as Qe, Tools as Wt, Inject as Gt, Injector as Lt, Plugin as qt, merge as Kt, mergeOverrideWithDependencies as Ft, IConfigService as Vt, IImageIoService as Ht } from "@univerjs/core";
|
|
5
5
|
import { IImageIoService as bn, ImageSourceType as Cn, ImageUploadStatusType as In } from "@univerjs/core";
|
|
6
6
|
import { Subject as be } from "rxjs";
|
|
7
7
|
const gn = 500, yn = 500, _n = 10, zt = 5 * 1024 * 1024, Xt = ["image/png", "image/jpeg", "image/jpg", "image/gif", "image/bmp"];
|
|
8
|
-
var
|
|
8
|
+
var Ye = {}, et = {}, tt = {}, _t;
|
|
9
9
|
function Jt() {
|
|
10
10
|
if (_t) return tt;
|
|
11
11
|
_t = 1, Object.defineProperty(tt, "__esModule", { value: !0 });
|
|
@@ -289,9 +289,9 @@ function Ut() {
|
|
|
289
289
|
}(a.ConflictType || (a.ConflictType = {}));
|
|
290
290
|
}(ut)), ut;
|
|
291
291
|
}
|
|
292
|
-
var
|
|
292
|
+
var Fe = {}, Ve = {}, wt;
|
|
293
293
|
function ht() {
|
|
294
|
-
return wt || (wt = 1, Object.defineProperty(
|
|
294
|
+
return wt || (wt = 1, Object.defineProperty(Ve, "__esModule", { value: !0 }), Ve.uniToStrPos = Ve.strPosToUni = void 0, Ve.strPosToUni = (a, e = a.length) => {
|
|
295
295
|
let n = 0, t = 0;
|
|
296
296
|
for (; t < e; t++) {
|
|
297
297
|
const r = a.charCodeAt(t);
|
|
@@ -300,14 +300,14 @@ function ht() {
|
|
|
300
300
|
if (t !== e)
|
|
301
301
|
throw Error("Invalid offset - splits unicode bytes");
|
|
302
302
|
return t - n;
|
|
303
|
-
},
|
|
303
|
+
}, Ve.uniToStrPos = (a, e) => {
|
|
304
304
|
let n = 0;
|
|
305
305
|
for (; e > 0; e--) {
|
|
306
306
|
const t = a.charCodeAt(n);
|
|
307
307
|
n += t >= 55296 && t <= 57343 ? 2 : 1;
|
|
308
308
|
}
|
|
309
309
|
return n;
|
|
310
|
-
}),
|
|
310
|
+
}), Ve;
|
|
311
311
|
}
|
|
312
312
|
var ct = {}, bt;
|
|
313
313
|
function ft() {
|
|
@@ -634,22 +634,22 @@ function Zt() {
|
|
|
634
634
|
var It;
|
|
635
635
|
function Qt() {
|
|
636
636
|
return It || (It = 1, function(a) {
|
|
637
|
-
var e =
|
|
637
|
+
var e = Fe.__createBinding || (Object.create ? function(c, h, S, Y) {
|
|
638
638
|
Y === void 0 && (Y = S), Object.defineProperty(c, Y, { enumerable: !0, get: function() {
|
|
639
639
|
return h[S];
|
|
640
640
|
} });
|
|
641
641
|
} : function(c, h, S, Y) {
|
|
642
642
|
Y === void 0 && (Y = S), c[Y] = h[S];
|
|
643
|
-
}), n =
|
|
643
|
+
}), n = Fe.__setModuleDefault || (Object.create ? function(c, h) {
|
|
644
644
|
Object.defineProperty(c, "default", { enumerable: !0, value: h });
|
|
645
645
|
} : function(c, h) {
|
|
646
646
|
c.default = h;
|
|
647
|
-
}), t =
|
|
647
|
+
}), t = Fe.__importStar || function(c) {
|
|
648
648
|
if (c && c.__esModule) return c;
|
|
649
649
|
var h = {};
|
|
650
650
|
if (c != null) for (var S in c) Object.hasOwnProperty.call(c, S) && e(h, c, S);
|
|
651
651
|
return n(h, c), h;
|
|
652
|
-
}, r =
|
|
652
|
+
}, r = Fe.__importDefault || function(c) {
|
|
653
653
|
return c && c.__esModule ? c : { default: c };
|
|
654
654
|
};
|
|
655
655
|
Object.defineProperty(a, "__esModule", { value: !0 }), a.type = a.remove = a.insert = void 0;
|
|
@@ -689,12 +689,12 @@ function Qt() {
|
|
|
689
689
|
Object.defineProperty(a, "makeType", { enumerable: !0, get: function() {
|
|
690
690
|
return s.default;
|
|
691
691
|
} });
|
|
692
|
-
}(
|
|
692
|
+
}(Fe)), Fe;
|
|
693
693
|
}
|
|
694
694
|
var Et;
|
|
695
695
|
function en() {
|
|
696
696
|
return Et || (Et = 1, function(a) {
|
|
697
|
-
var e =
|
|
697
|
+
var e = et.__importDefault || function(i) {
|
|
698
698
|
return i && i.__esModule ? i : {
|
|
699
699
|
default: i
|
|
700
700
|
};
|
|
@@ -927,9 +927,9 @@ function en() {
|
|
|
927
927
|
g.d != null && (v[g.d] = O.clone());
|
|
928
928
|
});
|
|
929
929
|
const B = r.writeCursor();
|
|
930
|
-
return function g(U, re, te, K, se,
|
|
930
|
+
return function g(U, re, te, K, se, $e, Oe, ye) {
|
|
931
931
|
o(re || te);
|
|
932
|
-
const oe = l(re), Pe = l(te), Ae = !!Pe && Pe.r !== void 0, Le = !!oe && oe.i !== void 0, Te = oe ? oe.d : null, Ie = Pe ? Pe.p : null,
|
|
932
|
+
const oe = l(re), Pe = l(te), Ae = !!Pe && Pe.r !== void 0, Le = !!oe && oe.i !== void 0, Te = oe ? oe.d : null, Ie = Pe ? Pe.p : null, Ne = ($e || Ae) && Ie == null;
|
|
933
933
|
if (Ie != null) K = v[Ie], Oe = $[Ie] = new r.WriteCursor();
|
|
934
934
|
else if (Pe && Pe.r !== void 0) K = null;
|
|
935
935
|
else {
|
|
@@ -937,7 +937,7 @@ function en() {
|
|
|
937
937
|
T && T.d != null && (K = null);
|
|
938
938
|
}
|
|
939
939
|
const Q = l(K);
|
|
940
|
-
if (Te != null) if (U = p[Te], ye = R[Te] = new r.WriteCursor(),
|
|
940
|
+
if (Te != null) if (U = p[Te], ye = R[Te] = new r.WriteCursor(), Ne) $e && !Ae && ye.write("r", !0);
|
|
941
941
|
else {
|
|
942
942
|
const T = w[Te] = m++;
|
|
943
943
|
Oe.write("d", T);
|
|
@@ -949,42 +949,42 @@ function en() {
|
|
|
949
949
|
}
|
|
950
950
|
let A;
|
|
951
951
|
Le ? (o(se === void 0), A = oe.i) : A = se;
|
|
952
|
-
const W = (Ie == null ? !Le ||
|
|
952
|
+
const W = (Ie == null ? !Le || $e || Ae : A === void 0) ? null : Oe.getComponent();
|
|
953
953
|
if (Ie != null) {
|
|
954
954
|
if (!(se !== void 0 || Le)) {
|
|
955
955
|
const T = Te != null ? w[Te] : m++;
|
|
956
956
|
C[Ie] = T, ye.write("p", T);
|
|
957
957
|
}
|
|
958
958
|
} else Ae && (Le || se !== void 0 || (Pe.r, ye.write("r", Pe.r)));
|
|
959
|
-
const M =
|
|
959
|
+
const M = Ne ? null : ve(oe), P = ve(Q);
|
|
960
960
|
if ((M || P) && (M && M.name, P && P.name), M && P) {
|
|
961
961
|
o(M === P);
|
|
962
962
|
const T = f(oe), G = f(Q), he = M.compose(T, G);
|
|
963
963
|
y(Oe, M, he), N.add(Q);
|
|
964
964
|
} else M ? y(Oe, M, f(oe)) : P && (y(Oe, P, f(Q)), N.add(Q));
|
|
965
965
|
const k = typeof A == "object" && A != null;
|
|
966
|
-
let
|
|
966
|
+
let J = !1, X = 0, ee = 0, fe = 0, de = 0, ae = 0;
|
|
967
967
|
const me = r.advancer(K, (T, G) => s(G) ? de - T - 1 : T - de, (T, G) => {
|
|
968
968
|
s(G) && de++;
|
|
969
|
-
}), H = r.advancer(U, (T, G) => _(G) ?
|
|
970
|
-
_(G) &&
|
|
969
|
+
}), H = r.advancer(U, (T, G) => _(G) ? X - T - 1 : T - X, (T, G) => {
|
|
970
|
+
_(G) && X++;
|
|
971
971
|
});
|
|
972
972
|
if (r.eachChildOf(re, te, (T, G, he) => {
|
|
973
|
-
let we,
|
|
973
|
+
let we, Re, qe = T, Me = T, Je = T;
|
|
974
974
|
if (typeof T == "number") {
|
|
975
975
|
let _e = T + fe;
|
|
976
|
-
|
|
976
|
+
Re = me(_e), Me = _e + de;
|
|
977
977
|
let ue = T + ee;
|
|
978
|
-
we = H(ue), s(l(
|
|
979
|
-
const Ue = s(l(G)),
|
|
980
|
-
(Ue ||
|
|
981
|
-
} else we = H(T),
|
|
978
|
+
we = H(ue), s(l(Re)) && (we = null), qe = ue + X, Je = T + ae, o(qe >= 0, "p1PickKey is negative"), o(Me >= 0, "p2DropKey is negative");
|
|
979
|
+
const Ue = s(l(G)), xe = _(l(he));
|
|
980
|
+
(Ue || xe && !Ne) && ae--, Ue && ee--, xe && fe--;
|
|
981
|
+
} else we = H(T), Re = me(T);
|
|
982
982
|
ye.descend(qe), Oe.descend(Me);
|
|
983
|
-
const
|
|
984
|
-
var
|
|
985
|
-
k && !
|
|
983
|
+
const ze = k && !s(l(G)) ? A[Je] : void 0, Se = g(we, G, he, Re, ze, Ne, Oe, ye);
|
|
984
|
+
var je, j, ie;
|
|
985
|
+
k && !Ne ? ze !== Se && (J || (A = Array.isArray(A) ? A.slice() : Object.assign({}, A), J = !0), je = A, ie = Se, typeof (j = Je) == "number" ? (o(Array.isArray(je)), o(j < je.length)) : (o(!Array.isArray(je)), o(je[j] !== void 0)), ie === void 0 ? typeof j == "number" ? je.splice(j, 1) : delete je[j] : je[j] = ie) : o(Se === void 0), Oe.ascend(), ye.ascend();
|
|
986
986
|
}), H.end(), me.end(), W != null) W.i = A;
|
|
987
|
-
else if (
|
|
987
|
+
else if (!$e && !Ae && Ie == null) return A;
|
|
988
988
|
}(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, U) => {
|
|
989
989
|
const re = g.p;
|
|
990
990
|
if (re != null) {
|
|
@@ -1100,8 +1100,8 @@ function en() {
|
|
|
1100
1100
|
_(se) && U++;
|
|
1101
1101
|
});
|
|
1102
1102
|
for (const K of w) if (typeof K == "number") {
|
|
1103
|
-
const se = K - re,
|
|
1104
|
-
C.descend(K), p(
|
|
1103
|
+
const se = K - re, $e = te(se), Oe = se + U, ye = Y(N, B ? se : Oe);
|
|
1104
|
+
C.descend(K), p($e, w, C, ye, B), s(w.getComponent()) && re++, C.ascend();
|
|
1105
1105
|
} else {
|
|
1106
1106
|
const se = Y(N, K);
|
|
1107
1107
|
C.descend(K), p(te(K), w, C, se, B), C.ascend();
|
|
@@ -1131,36 +1131,36 @@ function en() {
|
|
|
1131
1131
|
z(i), z(d);
|
|
1132
1132
|
let O = null;
|
|
1133
1133
|
const I = [], R = [], $ = [], p = [], v = [], w = [], C = [], N = [], B = [], g = [], U = [], re = [], te = [], K = [], se = [];
|
|
1134
|
-
let
|
|
1134
|
+
let $e = 0;
|
|
1135
1135
|
const Oe = r.readCursor(i), ye = r.readCursor(d), oe = r.writeCursor();
|
|
1136
1136
|
if (function Q(A, W = null, M) {
|
|
1137
1137
|
const P = l(W);
|
|
1138
1138
|
P && (P.r !== void 0 ? M = W.clone() : P.p != null && (M = null, w[P.p] = A.clone()));
|
|
1139
1139
|
const k = A.getComponent();
|
|
1140
|
-
let
|
|
1141
|
-
k && (
|
|
1142
|
-
const
|
|
1143
|
-
for (const ee of A) Q(A,
|
|
1144
|
-
|
|
1140
|
+
let J;
|
|
1141
|
+
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));
|
|
1142
|
+
const X = r.advancer(W);
|
|
1143
|
+
for (const ee of A) Q(A, X(ee), M);
|
|
1144
|
+
X.end();
|
|
1145
1145
|
}(ye, Oe, null), function Q(A, W, M, P, k) {
|
|
1146
|
-
const
|
|
1147
|
-
let
|
|
1148
|
-
|
|
1146
|
+
const J = M.getComponent();
|
|
1147
|
+
let X, ee = !1;
|
|
1148
|
+
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 && (U[X] = !0), k = B[X] || null) : !k || D !== 1 && K[X] != null || O == null && (O = {
|
|
1149
1149
|
type: u.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1150
1150
|
op1: a.removeOp(k.getPath()),
|
|
1151
1151
|
op2: a.moveOp(W.getPath(), M.getPath())
|
|
1152
|
-
}), ee = !0) :
|
|
1152
|
+
}), ee = !0) : J.i !== void 0 && (A = W = null, ee = !0, k && O == null && (O = {
|
|
1153
1153
|
type: u.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1154
1154
|
op1: a.removeOp(k.getPath()),
|
|
1155
|
-
op2: a.insertOp(M.getPath(),
|
|
1155
|
+
op2: a.insertOp(M.getPath(), J.i)
|
|
1156
1156
|
})));
|
|
1157
1157
|
const fe = l(A);
|
|
1158
1158
|
fe && (fe.r !== void 0 ? k = A.clone() : fe.p != null && (fe.p, P = fe.p, k = null));
|
|
1159
|
-
const de = ve(
|
|
1159
|
+
const de = ve(J);
|
|
1160
1160
|
de && k && O == null && (O = {
|
|
1161
1161
|
type: u.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1162
1162
|
op1: a.removeOp(k.getPath()),
|
|
1163
|
-
op2: a.editOp(M.getPath(), de, f(
|
|
1163
|
+
op2: a.editOp(M.getPath(), de, f(J), !0)
|
|
1164
1164
|
});
|
|
1165
1165
|
let ae = 0, me = 0;
|
|
1166
1166
|
const H = r.advancer(W, (G, he) => _(he) ? ae - G - 1 : G - ae, (G, he) => {
|
|
@@ -1182,16 +1182,16 @@ function en() {
|
|
|
1182
1182
|
const Pe = [];
|
|
1183
1183
|
let Ae = null;
|
|
1184
1184
|
(function Q(A, W, M, P, k) {
|
|
1185
|
-
let
|
|
1186
|
-
const
|
|
1187
|
-
if (_(
|
|
1188
|
-
const H =
|
|
1189
|
-
H != null ? (M = p[H], P = re[H] = r.writeCursor(),
|
|
1185
|
+
let J = !1;
|
|
1186
|
+
const X = l(W);
|
|
1187
|
+
if (_(X)) {
|
|
1188
|
+
const H = X.p;
|
|
1189
|
+
H != null ? (M = p[H], P = re[H] = r.writeCursor(), J = !0, k = null) : (M = null, k = W.clone());
|
|
1190
1190
|
} else s(l(M)) && (M = null);
|
|
1191
1191
|
const ee = A.getComponent();
|
|
1192
1192
|
if (ee) {
|
|
1193
1193
|
const H = ee.p;
|
|
1194
|
-
H != null ? (k && (N[H] = k), Pe[H] = k || D === 1 &&
|
|
1194
|
+
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)));
|
|
1195
1195
|
}
|
|
1196
1196
|
let fe = 0, de = 0;
|
|
1197
1197
|
const ae = r.advancer(W, void 0, (H, T) => {
|
|
@@ -1209,46 +1209,46 @@ function en() {
|
|
|
1209
1209
|
ae.end(), me.end();
|
|
1210
1210
|
})(Oe, ye, ye.clone(), oe, null), oe.reset();
|
|
1211
1211
|
let Le = [];
|
|
1212
|
-
if (function Q(A, W, M, P, k,
|
|
1212
|
+
if (function Q(A, W, M, P, k, J) {
|
|
1213
1213
|
o(W);
|
|
1214
|
-
const
|
|
1214
|
+
const X = W.getComponent();
|
|
1215
1215
|
let ee = l(P), fe = !1;
|
|
1216
1216
|
const de = (j, ie, _e) => j ? a.moveOp(j.getPath(), ie.getPath()) : a.insertOp(ie.getPath(), _e.i);
|
|
1217
|
-
if (s(
|
|
1218
|
-
const j =
|
|
1217
|
+
if (s(X)) {
|
|
1218
|
+
const j = X.d;
|
|
1219
1219
|
j != null && (R[j] = W.clone());
|
|
1220
1220
|
const ie = j != null ? Pe[j] : null;
|
|
1221
1221
|
let _e = !1;
|
|
1222
|
-
if (
|
|
1222
|
+
if (X.i !== void 0 || j != null && ie) {
|
|
1223
1223
|
let ue;
|
|
1224
|
-
ee && (ee.i !== void 0 || (ue = ee.d) != null && !g[ue]) && (_e = ue != null ? j != null && j === K[ue] : n.default(ee.i,
|
|
1224
|
+
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 = {
|
|
1225
1225
|
type: u.ConflictType.DROP_COLLISION,
|
|
1226
|
-
op1: de(j != null ? I[j] : null, W,
|
|
1226
|
+
op1: de(j != null ? I[j] : null, W, X),
|
|
1227
1227
|
op2: de(ue != null ? $[ue] : null, P, ee)
|
|
1228
|
-
})), _e || (
|
|
1228
|
+
})), _e || (J ? O == null && (O = {
|
|
1229
1229
|
type: u.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1230
|
-
op1: de(j != null ? I[j] : null, W,
|
|
1231
|
-
op2: a.removeOp(
|
|
1232
|
-
}) : (j != null ? (Le[
|
|
1230
|
+
op1: de(j != null ? I[j] : null, W, X),
|
|
1231
|
+
op2: a.removeOp(J.getPath())
|
|
1232
|
+
}) : (j != null ? (Le[$e] = j, k.write("d", ie.p = $e++)) : k.write("i", t.default(X.i)), fe = !0));
|
|
1233
1233
|
} else if (j != null && !ie) {
|
|
1234
1234
|
const ue = N[j];
|
|
1235
|
-
ue && (
|
|
1235
|
+
ue && (J = ue.clone());
|
|
1236
1236
|
}
|
|
1237
|
-
j != null ? (A = I[j], M = w[j], P = C[j]) :
|
|
1237
|
+
j != null ? (A = I[j], M = w[j], P = C[j]) : X.i !== void 0 && (A = M = null, _e || (P = null));
|
|
1238
1238
|
} else _(l(A)) && (A = M = P = null);
|
|
1239
1239
|
const ae = l(A), me = l(M);
|
|
1240
1240
|
if (_(me)) {
|
|
1241
1241
|
const j = me.p;
|
|
1242
|
-
me.r !== void 0 && (!ae || ae.r === void 0) || g[j] ? (P = null,
|
|
1243
|
-
} else !s(
|
|
1242
|
+
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));
|
|
1243
|
+
} else !s(X) && s(ee) && (P = null);
|
|
1244
1244
|
ee = P != null ? P.getComponent() : null;
|
|
1245
|
-
const H = ve(
|
|
1245
|
+
const H = ve(X);
|
|
1246
1246
|
if (H) {
|
|
1247
|
-
const j = f(
|
|
1248
|
-
if (
|
|
1247
|
+
const j = f(X);
|
|
1248
|
+
if (J) O == null && (O = {
|
|
1249
1249
|
type: u.ConflictType.RM_UNEXPECTED_CONTENT,
|
|
1250
1250
|
op1: a.editOp(W.getPath(), H, j, !0),
|
|
1251
|
-
op2: a.removeOp(
|
|
1251
|
+
op2: a.removeOp(J.getPath())
|
|
1252
1252
|
});
|
|
1253
1253
|
else {
|
|
1254
1254
|
const ie = ve(ee);
|
|
@@ -1261,72 +1261,72 @@ function en() {
|
|
|
1261
1261
|
y(k, H, _e);
|
|
1262
1262
|
}
|
|
1263
1263
|
}
|
|
1264
|
-
let T = 0, G = 0, he = 0, we = 0,
|
|
1265
|
-
const
|
|
1264
|
+
let T = 0, G = 0, he = 0, we = 0, Re = 0, qe = 0, Me = A != null && A.descendFirst(), Je = Me;
|
|
1265
|
+
const ze = r.advancer(M, void 0, (j, ie) => {
|
|
1266
1266
|
_(ie) && he++;
|
|
1267
1267
|
});
|
|
1268
|
-
let
|
|
1268
|
+
let Se = P != null && P.descendFirst(), je = Se;
|
|
1269
1269
|
for (const j of W) if (typeof j == "number") {
|
|
1270
1270
|
let ie;
|
|
1271
1271
|
const _e = s(W.getComponent()), ue = j - G;
|
|
1272
1272
|
{
|
|
1273
|
-
let
|
|
1274
|
-
for (; Me && typeof (
|
|
1275
|
-
|
|
1276
|
-
const ke = A.getComponent(),
|
|
1277
|
-
if (
|
|
1278
|
-
if (
|
|
1273
|
+
let Be;
|
|
1274
|
+
for (; Me && typeof (Be = A.getKey()) == "number"; ) {
|
|
1275
|
+
Be += T;
|
|
1276
|
+
const ke = A.getComponent(), Xe = _(ke);
|
|
1277
|
+
if (Be > ue || Be === ue && (!Xe || D === 0 && _e)) break;
|
|
1278
|
+
if (Xe) {
|
|
1279
1279
|
T--;
|
|
1280
1280
|
const Ke = ke.p;
|
|
1281
|
-
K.includes(Ke), ke.d, l(te[ke.d]), _(l(te[ke.d])), (ke.r === void 0 || Ae && Ae.has(ke)) && (Ke == null || !Pe[Ke] || D !== 1 && K.includes(Ke)) ||
|
|
1281
|
+
K.includes(Ke), ke.d, l(te[ke.d]), _(l(te[ke.d])), (ke.r === void 0 || Ae && Ae.has(ke)) && (Ke == null || !Pe[Ke] || D !== 1 && K.includes(Ke)) || Re--;
|
|
1282
1282
|
}
|
|
1283
1283
|
Me = A.nextSibling();
|
|
1284
1284
|
}
|
|
1285
|
-
ie = Me &&
|
|
1285
|
+
ie = Me && Be === ue ? A : null;
|
|
1286
1286
|
}
|
|
1287
1287
|
const Ue = ue - T;
|
|
1288
|
-
let
|
|
1288
|
+
let xe = ze(Ue);
|
|
1289
1289
|
const ot = Ue - he;
|
|
1290
|
-
let
|
|
1290
|
+
let Ze = null;
|
|
1291
1291
|
{
|
|
1292
|
-
let
|
|
1293
|
-
for (;
|
|
1294
|
-
ke =
|
|
1295
|
-
const
|
|
1292
|
+
let Be, ke;
|
|
1293
|
+
for (; Se && typeof (Be = P.getKey()) == "number"; ) {
|
|
1294
|
+
ke = Be - we;
|
|
1295
|
+
const Xe = P.getComponent(), Ke = s(Xe);
|
|
1296
1296
|
if (ke > ot) break;
|
|
1297
1297
|
if (ke === ot) {
|
|
1298
1298
|
if (!Ke) {
|
|
1299
|
-
|
|
1299
|
+
Ze = P;
|
|
1300
1300
|
break;
|
|
1301
1301
|
}
|
|
1302
1302
|
{
|
|
1303
1303
|
if (D === 0 && _e) {
|
|
1304
|
-
|
|
1304
|
+
Ze = P;
|
|
1305
1305
|
break;
|
|
1306
1306
|
}
|
|
1307
|
-
const
|
|
1308
|
-
if (D === 0 &&
|
|
1307
|
+
const We = xe && _(xe.getComponent());
|
|
1308
|
+
if (D === 0 && We) break;
|
|
1309
1309
|
}
|
|
1310
1310
|
}
|
|
1311
1311
|
if (Ke) {
|
|
1312
|
-
const
|
|
1313
|
-
K[
|
|
1312
|
+
const We = Xe.d;
|
|
1313
|
+
g[We], K[We], Xe.i === void 0 && (g[We] || K[We] != null && D !== 1) ? (g[We] || K[We] != null && D === 0) && (we++, qe--) : we++;
|
|
1314
1314
|
}
|
|
1315
|
-
|
|
1315
|
+
Se = P.nextSibling();
|
|
1316
1316
|
}
|
|
1317
1317
|
}
|
|
1318
|
-
const yt = ot + we +
|
|
1319
|
-
o(yt >= 0, "trying to descend to a negative index"), k.descend(yt), _e && (ie =
|
|
1318
|
+
const yt = ot + we + Re + qe;
|
|
1319
|
+
o(yt >= 0, "trying to descend to a negative index"), k.descend(yt), _e && (ie = xe = Ze = null, G++), Q(ie, W, xe, Ze, k, J) && qe++, k.ascend();
|
|
1320
1320
|
} else {
|
|
1321
1321
|
let ie;
|
|
1322
1322
|
for (; Me && (ie = A.getKey(), typeof ie != "string" || !(ie > j || ie === j)); ) Me = A.nextSibling();
|
|
1323
|
-
const _e = Me && ie === j ? A : null, ue =
|
|
1323
|
+
const _e = Me && ie === j ? A : null, ue = ze(j);
|
|
1324
1324
|
let Ue;
|
|
1325
|
-
for (;
|
|
1326
|
-
const
|
|
1327
|
-
k.descend(j), Q(_e, W, ue,
|
|
1325
|
+
for (; Se && (Ue = P.getKey(), typeof Ue != "string" || !(Ue > j || Ue === j)); ) Se = P.nextSibling();
|
|
1326
|
+
const xe = Se && Ue === j ? P : null;
|
|
1327
|
+
k.descend(j), Q(_e, W, ue, xe, k, J), k.ascend();
|
|
1328
1328
|
}
|
|
1329
|
-
return
|
|
1329
|
+
return ze.end(), Je && A.ascend(), je && P.ascend(), fe;
|
|
1330
1330
|
}(Oe, Oe.clone(), ye, ye.clone(), oe, null), O) return {
|
|
1331
1331
|
ok: !1,
|
|
1332
1332
|
conflict: O
|
|
@@ -1338,7 +1338,7 @@ function en() {
|
|
|
1338
1338
|
(g.length || re.length) && (Te(ye, oe, (Q, A, W) => {
|
|
1339
1339
|
g[Q] && !U[Q] && W.write("r", !0), re[Q] && W.mergeTree(re[Q].get());
|
|
1340
1340
|
}), oe.reset());
|
|
1341
|
-
const Ie = [],
|
|
1341
|
+
const Ie = [], Ne = [];
|
|
1342
1342
|
if ((te.length || g.length) && !O) {
|
|
1343
1343
|
const Q = r.readCursor(it(oe.get()));
|
|
1344
1344
|
if (Te(Q, null, (A, W) => {
|
|
@@ -1347,11 +1347,11 @@ function en() {
|
|
|
1347
1347
|
A && Te(r.readCursor(A.get()), null, (W, M) => {
|
|
1348
1348
|
Ie[W] = M.clone();
|
|
1349
1349
|
});
|
|
1350
|
-
}), function A(W, M, P, k,
|
|
1350
|
+
}), function A(W, M, P, k, J, X) {
|
|
1351
1351
|
const ee = l(M);
|
|
1352
1352
|
if (ee && _(ee)) if (ee.p != null) {
|
|
1353
1353
|
const T = ee.p;
|
|
1354
|
-
Ie[T].getPath(), P = Ie[T], k =
|
|
1354
|
+
Ie[T].getPath(), P = Ie[T], k = Ne[T] = r.writeCursor();
|
|
1355
1355
|
} else ee.r !== void 0 && (P = null);
|
|
1356
1356
|
else s(l(P)) && (P = null);
|
|
1357
1357
|
const fe = W.getComponent();
|
|
@@ -1369,29 +1369,29 @@ function en() {
|
|
|
1369
1369
|
s(G) && ae++;
|
|
1370
1370
|
});
|
|
1371
1371
|
for (const T of W) if (typeof T == "number") {
|
|
1372
|
-
const G = me(T), he = T + de, we = H(he),
|
|
1373
|
-
k.descend(
|
|
1372
|
+
const G = me(T), he = T + de, we = H(he), Re = he + ae;
|
|
1373
|
+
k.descend(Re), A(W, G, we, k), k.ascend();
|
|
1374
1374
|
} else k.descend(T), A(W, me(T), H(T), k), k.ascend();
|
|
1375
1375
|
me.end(), H.end();
|
|
1376
1376
|
}(ye, Q, Q.clone(), oe), oe.reset(), O) return {
|
|
1377
1377
|
ok: !1,
|
|
1378
1378
|
conflict: O
|
|
1379
1379
|
};
|
|
1380
|
-
if (oe.get(),
|
|
1381
|
-
const A =
|
|
1380
|
+
if (oe.get(), Ne.length) {
|
|
1381
|
+
const A = Ne.map((M) => M ? M.get() : null), W = r.readCursor(it(oe.get()));
|
|
1382
1382
|
if (Te(W, oe, (M, P, k) => {
|
|
1383
|
-
const
|
|
1384
|
-
|
|
1383
|
+
const J = A[M];
|
|
1384
|
+
J && (k.mergeTree(J), A[M] = null);
|
|
1385
1385
|
}), A.find((M) => M)) {
|
|
1386
1386
|
const M = r.writeCursor(), P = r.writeCursor();
|
|
1387
|
-
let k = 0,
|
|
1388
|
-
A.forEach((
|
|
1389
|
-
|
|
1387
|
+
let k = 0, J = 0;
|
|
1388
|
+
A.forEach((X) => {
|
|
1389
|
+
X != null && Te(r.readCursor(X), null, (ee) => {
|
|
1390
1390
|
const fe = Le[ee];
|
|
1391
1391
|
M.writeMove(I[fe].getPath(), R[fe].getPath(), k++);
|
|
1392
1392
|
const de = se[fe];
|
|
1393
1393
|
de && de.forEach((ae) => {
|
|
1394
|
-
g[ae] || D !== 1 && K[ae] != null || P.writeMove($[ae].getPath(), p[ae].getPath(),
|
|
1394
|
+
g[ae] || D !== 1 && K[ae] != null || P.writeMove($[ae].getPath(), p[ae].getPath(), J++);
|
|
1395
1395
|
});
|
|
1396
1396
|
});
|
|
1397
1397
|
}), O = {
|
|
@@ -1419,7 +1419,7 @@ function en() {
|
|
|
1419
1419
|
if (D.ok) return D.result;
|
|
1420
1420
|
pt(D.conflict);
|
|
1421
1421
|
}
|
|
1422
|
-
const
|
|
1422
|
+
const He = (i) => {
|
|
1423
1423
|
const d = r.writeCursor();
|
|
1424
1424
|
return r.readCursor(i).traverse(d, (m, D) => {
|
|
1425
1425
|
(s(m) || ve(m)) && D.write("r", !0);
|
|
@@ -1428,14 +1428,14 @@ function en() {
|
|
|
1428
1428
|
const { type: m, op1: D, op2: O } = i;
|
|
1429
1429
|
switch (m) {
|
|
1430
1430
|
case u.ConflictType.DROP_COLLISION:
|
|
1431
|
-
return d === "left" ? [null,
|
|
1431
|
+
return d === "left" ? [null, He(O)] : [He(D), null];
|
|
1432
1432
|
case u.ConflictType.RM_UNEXPECTED_CONTENT:
|
|
1433
1433
|
let I = !1;
|
|
1434
1434
|
return r.readCursor(D).traverse(null, (R) => {
|
|
1435
1435
|
R.r !== void 0 && (I = !0);
|
|
1436
|
-
}), I ? [null,
|
|
1436
|
+
}), I ? [null, He(O)] : [He(D), null];
|
|
1437
1437
|
case u.ConflictType.BLACKHOLE:
|
|
1438
|
-
return [
|
|
1438
|
+
return [He(D), He(O)];
|
|
1439
1439
|
default:
|
|
1440
1440
|
throw Error("Unrecognised conflict: " + m);
|
|
1441
1441
|
}
|
|
@@ -1453,18 +1453,18 @@ function en() {
|
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
|
-
}(
|
|
1456
|
+
}(et)), et;
|
|
1457
1457
|
}
|
|
1458
1458
|
var Dt;
|
|
1459
1459
|
function tn() {
|
|
1460
1460
|
return Dt || (Dt = 1, function(a) {
|
|
1461
|
-
var e =
|
|
1461
|
+
var e = Ye.__createBinding || (Object.create ? function(u, o, l, E) {
|
|
1462
1462
|
E === void 0 && (E = l), Object.defineProperty(u, E, { enumerable: !0, get: function() {
|
|
1463
1463
|
return o[l];
|
|
1464
1464
|
} });
|
|
1465
1465
|
} : function(u, o, l, E) {
|
|
1466
1466
|
E === void 0 && (E = l), u[E] = o[l];
|
|
1467
|
-
}), n =
|
|
1467
|
+
}), n = Ye.__exportStar || function(u, o) {
|
|
1468
1468
|
for (var l in u) l !== "default" && !o.hasOwnProperty(l) && e(o, u, l);
|
|
1469
1469
|
};
|
|
1470
1470
|
Object.defineProperty(a, "__esModule", { value: !0 }), n(en(), a);
|
|
@@ -1478,7 +1478,7 @@ function tn() {
|
|
|
1478
1478
|
Object.defineProperty(a, "ConflictType", { enumerable: !0, get: function() {
|
|
1479
1479
|
return r.ConflictType;
|
|
1480
1480
|
} });
|
|
1481
|
-
}(
|
|
1481
|
+
}(Ye)), Ye;
|
|
1482
1482
|
}
|
|
1483
1483
|
var V = tn();
|
|
1484
1484
|
class nn {
|
|
@@ -1933,11 +1933,11 @@ class an {
|
|
|
1933
1933
|
async saveImage(e) {
|
|
1934
1934
|
return new Promise((n, t) => {
|
|
1935
1935
|
if (!Xt.includes(e.type)) {
|
|
1936
|
-
t(new Error(
|
|
1936
|
+
t(new Error(Qe.ERROR_IMAGE_TYPE)), this._decreaseWaiting();
|
|
1937
1937
|
return;
|
|
1938
1938
|
}
|
|
1939
1939
|
if (e.size > zt) {
|
|
1940
|
-
t(new Error(
|
|
1940
|
+
t(new Error(Qe.ERROR_EXCEED_SIZE)), this._decreaseWaiting();
|
|
1941
1941
|
return;
|
|
1942
1942
|
}
|
|
1943
1943
|
const r = new FileReader();
|
|
@@ -1945,7 +1945,7 @@ class an {
|
|
|
1945
1945
|
var E;
|
|
1946
1946
|
const o = (E = u.target) == null ? void 0 : E.result;
|
|
1947
1947
|
if (o == null) {
|
|
1948
|
-
t(new Error(
|
|
1948
|
+
t(new Error(Qe.ERROR_IMAGE)), this._decreaseWaiting();
|
|
1949
1949
|
return;
|
|
1950
1950
|
}
|
|
1951
1951
|
const l = Wt.generateRandomId(6);
|
|
@@ -1954,7 +1954,7 @@ class an {
|
|
|
1954
1954
|
imageSourceType: at.BASE64,
|
|
1955
1955
|
source: o,
|
|
1956
1956
|
base64Cache: o,
|
|
1957
|
-
status:
|
|
1957
|
+
status: Qe.SUCCUSS
|
|
1958
1958
|
}), this._decreaseWaiting();
|
|
1959
1959
|
};
|
|
1960
1960
|
});
|