@editora/core 1.0.31 → 1.0.33
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/README.md +11 -3
- package/dist/{CollaborationPlugin.native-B9aiC2s7.mjs → CollaborationPlugin.native-8gcyVRnR.mjs} +869 -857
- package/dist/{VersionDiffPlugin.native-DJZIzFSK.mjs → VersionDiffPlugin.native-2v8ZaZWN.mjs} +248 -247
- package/dist/editora.min.js +15 -15
- package/dist/editora.umd.js +15 -15
- package/dist/index-BahpGXyw.js +12 -0
- package/dist/{index-8WhEVFK8.mjs → index-BlsTuyTe.mjs} +676 -582
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/plugin-loader.js +4 -4
- package/dist/webcomponent-core.js +480 -386
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +29 -29
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +481 -387
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +267 -267
- package/package.json +1 -1
- package/dist/index-DMk3V5_f.js +0 -12
package/dist/{CollaborationPlugin.native-B9aiC2s7.mjs → CollaborationPlugin.native-8gcyVRnR.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var oe = (e, t, n) =>
|
|
4
|
-
const $ = () => /* @__PURE__ */ new Map(),
|
|
1
|
+
var bi = Object.defineProperty;
|
|
2
|
+
var ki = (e, t, n) => t in e ? bi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var oe = (e, t, n) => ki(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
const $ = () => /* @__PURE__ */ new Map(), an = (e) => {
|
|
5
5
|
const t = $();
|
|
6
6
|
return e.forEach((n, s) => {
|
|
7
7
|
t.set(s, n);
|
|
@@ -9,36 +9,36 @@ const $ = () => /* @__PURE__ */ new Map(), ln = (e) => {
|
|
|
9
9
|
}, K = (e, t, n) => {
|
|
10
10
|
let s = e.get(t);
|
|
11
11
|
return s === void 0 && e.set(t, s = n()), s;
|
|
12
|
-
},
|
|
12
|
+
}, _i = (e, t) => {
|
|
13
13
|
const n = [];
|
|
14
14
|
for (const [s, r] of e)
|
|
15
15
|
n.push(t(r, s));
|
|
16
16
|
return n;
|
|
17
|
-
},
|
|
17
|
+
}, Si = (e, t) => {
|
|
18
18
|
for (const [n, s] of e)
|
|
19
19
|
if (t(s, n))
|
|
20
20
|
return !0;
|
|
21
21
|
return !1;
|
|
22
|
-
},
|
|
22
|
+
}, ot = () => /* @__PURE__ */ new Set(), We = (e) => e[e.length - 1], Ci = (e, t) => {
|
|
23
23
|
for (let n = 0; n < t.length; n++)
|
|
24
24
|
e.push(t[n]);
|
|
25
|
-
}, q = Array.from,
|
|
25
|
+
}, q = Array.from, Cn = (e, t) => {
|
|
26
26
|
for (let n = 0; n < e.length; n++)
|
|
27
27
|
if (!t(e[n], n, e))
|
|
28
28
|
return !1;
|
|
29
29
|
return !0;
|
|
30
|
-
},
|
|
30
|
+
}, En = (e, t) => {
|
|
31
31
|
for (let n = 0; n < e.length; n++)
|
|
32
32
|
if (t(e[n], n, e))
|
|
33
33
|
return !0;
|
|
34
34
|
return !1;
|
|
35
|
-
},
|
|
35
|
+
}, Ei = (e, t) => {
|
|
36
36
|
const n = new Array(e);
|
|
37
37
|
for (let s = 0; s < e; s++)
|
|
38
38
|
n[s] = t(s, n);
|
|
39
39
|
return n;
|
|
40
40
|
}, It = Array.isArray;
|
|
41
|
-
class
|
|
41
|
+
class Dn {
|
|
42
42
|
constructor() {
|
|
43
43
|
this._observers = $();
|
|
44
44
|
}
|
|
@@ -52,7 +52,7 @@ class Cn {
|
|
|
52
52
|
this._observers,
|
|
53
53
|
/** @type {string} */
|
|
54
54
|
t,
|
|
55
|
-
|
|
55
|
+
ot
|
|
56
56
|
).add(n), n;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
@@ -100,7 +100,7 @@ class Cn {
|
|
|
100
100
|
this._observers = $();
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
class
|
|
103
|
+
class Di {
|
|
104
104
|
constructor() {
|
|
105
105
|
this._observers = $();
|
|
106
106
|
}
|
|
@@ -109,7 +109,7 @@ class Ei {
|
|
|
109
109
|
* @param {function} f
|
|
110
110
|
*/
|
|
111
111
|
on(t, n) {
|
|
112
|
-
K(this._observers, t,
|
|
112
|
+
K(this._observers, t, ot).add(n);
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* @param {N} name
|
|
@@ -145,7 +145,7 @@ class Ei {
|
|
|
145
145
|
this._observers = $();
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
const z = Math.floor, he = Math.abs,
|
|
148
|
+
const z = Math.floor, he = Math.abs, An = (e, t) => e < t ? e : t, mt = (e, t) => e > t ? e : t, Ai = Math.pow, $s = (e) => e !== 0 ? e < 0 : 1 / e < 0, es = 1, ns = 2, Xe = 4, qe = 8, zt = 32, X = 64, B = 128, Oe = 31, hn = 63, dt = 127, Ti = 2147483647, we = Number.MAX_SAFE_INTEGER, ss = Number.MIN_SAFE_INTEGER, xi = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && z(e) === e), Bs = String.fromCharCode, Ii = (e) => e.toLowerCase(), Li = /^\s*/g, vi = (e) => e.replace(Li, ""), Oi = /([A-Z])/g, rs = (e, t) => vi(e.replace(Oi, (n) => `${t}${Ii(n)}`)), Ni = (e) => {
|
|
149
149
|
const t = unescape(encodeURIComponent(e)), n = t.length, s = new Uint8Array(n);
|
|
150
150
|
for (let r = 0; r < n; r++)
|
|
151
151
|
s[r] = /** @type {number} */
|
|
@@ -154,51 +154,51 @@ const z = Math.floor, he = Math.abs, En = (e, t) => e < t ? e : t, mt = (e, t) =
|
|
|
154
154
|
}, Pt = (
|
|
155
155
|
/** @type {TextEncoder} */
|
|
156
156
|
typeof TextEncoder != "undefined" ? new TextEncoder() : null
|
|
157
|
-
),
|
|
157
|
+
), Mi = (e) => Pt.encode(e), Ui = Pt ? Mi : Ni;
|
|
158
158
|
let jt = typeof TextDecoder == "undefined" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
|
|
159
159
|
jt && jt.decode(new Uint8Array()).length === 1 && (jt = null);
|
|
160
|
-
const
|
|
160
|
+
const Ri = (e, t) => Ei(t, () => e).join("");
|
|
161
161
|
class Zt {
|
|
162
162
|
constructor() {
|
|
163
163
|
this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
const N = () => new Zt(),
|
|
166
|
+
const N = () => new Zt(), Tn = (e) => {
|
|
167
167
|
let t = e.cpos;
|
|
168
168
|
for (let n = 0; n < e.bufs.length; n++)
|
|
169
169
|
t += e.bufs[n].length;
|
|
170
170
|
return t;
|
|
171
171
|
}, C = (e) => {
|
|
172
|
-
const t = new Uint8Array(
|
|
172
|
+
const t = new Uint8Array(Tn(e));
|
|
173
173
|
let n = 0;
|
|
174
174
|
for (let s = 0; s < e.bufs.length; s++) {
|
|
175
175
|
const r = e.bufs[s];
|
|
176
176
|
t.set(r, n), n += r.length;
|
|
177
177
|
}
|
|
178
178
|
return t.set(new Uint8Array(e.cbuf.buffer, 0, e.cpos), n), t;
|
|
179
|
-
},
|
|
179
|
+
}, $i = (e, t) => {
|
|
180
180
|
const n = e.cbuf.length;
|
|
181
181
|
n - e.cpos < t && (e.bufs.push(new Uint8Array(e.cbuf.buffer, 0, e.cpos)), e.cbuf = new Uint8Array(mt(n, t) * 2), e.cpos = 0);
|
|
182
182
|
}, x = (e, t) => {
|
|
183
183
|
const n = e.cbuf.length;
|
|
184
184
|
e.cpos === n && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(n * 2), e.cpos = 0), e.cbuf[e.cpos++] = t;
|
|
185
|
-
},
|
|
186
|
-
for (; t >
|
|
187
|
-
x(e, B |
|
|
188
|
-
x(e,
|
|
189
|
-
},
|
|
190
|
-
const n =
|
|
191
|
-
for (n && (t = -t), x(e, (t >
|
|
192
|
-
x(e, (t >
|
|
193
|
-
},
|
|
194
|
-
if (t.length <
|
|
195
|
-
const n = Pt.encodeInto(t,
|
|
185
|
+
}, un = x, m = (e, t) => {
|
|
186
|
+
for (; t > dt; )
|
|
187
|
+
x(e, B | dt & t), t = z(t / 128);
|
|
188
|
+
x(e, dt & t);
|
|
189
|
+
}, xn = (e, t) => {
|
|
190
|
+
const n = $s(t);
|
|
191
|
+
for (n && (t = -t), x(e, (t > hn ? B : 0) | (n ? X : 0) | hn & t), t = z(t / 64); t > 0; )
|
|
192
|
+
x(e, (t > dt ? B : 0) | dt & t), t = z(t / 128);
|
|
193
|
+
}, dn = new Uint8Array(3e4), Bi = dn.length / 3, Fi = (e, t) => {
|
|
194
|
+
if (t.length < Bi) {
|
|
195
|
+
const n = Pt.encodeInto(t, dn).written || 0;
|
|
196
196
|
m(e, n);
|
|
197
197
|
for (let s = 0; s < n; s++)
|
|
198
|
-
x(e,
|
|
198
|
+
x(e, dn[s]);
|
|
199
199
|
} else
|
|
200
|
-
E(e,
|
|
201
|
-
},
|
|
200
|
+
E(e, Ui(t));
|
|
201
|
+
}, Vi = (e, t) => {
|
|
202
202
|
const n = unescape(encodeURIComponent(t)), s = n.length;
|
|
203
203
|
m(e, s);
|
|
204
204
|
for (let r = 0; r < s; r++)
|
|
@@ -207,29 +207,29 @@ const N = () => new Zt(), Dn = (e) => {
|
|
|
207
207
|
/** @type {number} */
|
|
208
208
|
n.codePointAt(r)
|
|
209
209
|
);
|
|
210
|
-
},
|
|
211
|
-
Pt.encodeInto ?
|
|
212
|
-
const n = e.cbuf.length, s = e.cpos, r =
|
|
210
|
+
}, ft = Pt && /** @type {any} */
|
|
211
|
+
Pt.encodeInto ? Fi : Vi, Ne = (e, t) => {
|
|
212
|
+
const n = e.cbuf.length, s = e.cpos, r = An(n - s, t.length), i = t.length - r;
|
|
213
213
|
e.cbuf.set(t.subarray(0, r), s), e.cpos += r, i > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(mt(n * 2, i)), e.cbuf.set(t.subarray(r)), e.cpos = i);
|
|
214
214
|
}, E = (e, t) => {
|
|
215
215
|
m(e, t.byteLength), Ne(e, t);
|
|
216
|
-
},
|
|
217
|
-
|
|
216
|
+
}, In = (e, t) => {
|
|
217
|
+
$i(e, t);
|
|
218
218
|
const n = new DataView(e.cbuf.buffer, e.cpos, t);
|
|
219
219
|
return e.cpos += t, n;
|
|
220
|
-
},
|
|
220
|
+
}, ji = (e, t) => In(e, 4).setFloat32(0, t, !1), Hi = (e, t) => In(e, 8).setFloat64(0, t, !1), zi = (e, t) => (
|
|
221
221
|
/** @type {any} */
|
|
222
|
-
|
|
223
|
-
),
|
|
222
|
+
In(e, 8).setBigInt64(0, t, !1)
|
|
223
|
+
), is = new DataView(new ArrayBuffer(4)), Pi = (e) => (is.setFloat32(0, e), is.getFloat32(0) === e), Yt = (e, t) => {
|
|
224
224
|
switch (typeof t) {
|
|
225
225
|
case "string":
|
|
226
|
-
x(e, 119),
|
|
226
|
+
x(e, 119), ft(e, t);
|
|
227
227
|
break;
|
|
228
228
|
case "number":
|
|
229
|
-
|
|
229
|
+
xi(t) && he(t) <= Ti ? (x(e, 125), xn(e, t)) : Pi(t) ? (x(e, 124), ji(e, t)) : (x(e, 123), Hi(e, t));
|
|
230
230
|
break;
|
|
231
231
|
case "bigint":
|
|
232
|
-
x(e, 122),
|
|
232
|
+
x(e, 122), zi(e, t);
|
|
233
233
|
break;
|
|
234
234
|
case "object":
|
|
235
235
|
if (t === null)
|
|
@@ -246,7 +246,7 @@ Pt.encodeInto ? Bi : Fi, Ne = (e, t) => {
|
|
|
246
246
|
m(e, n.length);
|
|
247
247
|
for (let s = 0; s < n.length; s++) {
|
|
248
248
|
const r = n[s];
|
|
249
|
-
|
|
249
|
+
ft(e, r), Yt(e, t[r]);
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
break;
|
|
@@ -257,7 +257,7 @@ Pt.encodeInto ? Bi : Fi, Ne = (e, t) => {
|
|
|
257
257
|
x(e, 127);
|
|
258
258
|
}
|
|
259
259
|
};
|
|
260
|
-
class
|
|
260
|
+
class os extends Zt {
|
|
261
261
|
/**
|
|
262
262
|
* @param {function(Encoder, T):void} writer
|
|
263
263
|
*/
|
|
@@ -271,8 +271,8 @@ class is extends Zt {
|
|
|
271
271
|
this.s === t ? this.count++ : (this.count > 0 && m(this, this.count - 1), this.count = 1, this.w(this, t), this.s = t);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
-
const
|
|
275
|
-
e.count > 0 && (
|
|
274
|
+
const cs = (e) => {
|
|
275
|
+
e.count > 0 && (xn(e.encoder, e.count === 1 ? e.s : -e.s), e.count > 1 && m(e.encoder, e.count - 2));
|
|
276
276
|
};
|
|
277
277
|
class ue {
|
|
278
278
|
constructor() {
|
|
@@ -282,7 +282,7 @@ class ue {
|
|
|
282
282
|
* @param {number} v
|
|
283
283
|
*/
|
|
284
284
|
write(t) {
|
|
285
|
-
this.s === t ? this.count++ : (
|
|
285
|
+
this.s === t ? this.count++ : (cs(this), this.count = 1, this.s = t);
|
|
286
286
|
}
|
|
287
287
|
/**
|
|
288
288
|
* Flush the encoded state and transform this to a Uint8Array.
|
|
@@ -290,16 +290,16 @@ class ue {
|
|
|
290
290
|
* Note that this should only be called once.
|
|
291
291
|
*/
|
|
292
292
|
toUint8Array() {
|
|
293
|
-
return
|
|
293
|
+
return cs(this), C(this.encoder);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
const
|
|
296
|
+
const ls = (e) => {
|
|
297
297
|
if (e.count > 0) {
|
|
298
298
|
const t = e.diff * 2 + (e.count === 1 ? 0 : 1);
|
|
299
|
-
|
|
299
|
+
xn(e.encoder, t), e.count > 1 && m(e.encoder, e.count - 2);
|
|
300
300
|
}
|
|
301
301
|
};
|
|
302
|
-
class
|
|
302
|
+
class Qe {
|
|
303
303
|
constructor() {
|
|
304
304
|
this.encoder = new Zt(), this.s = 0, this.count = 0, this.diff = 0;
|
|
305
305
|
}
|
|
@@ -307,7 +307,7 @@ class qe {
|
|
|
307
307
|
* @param {number} v
|
|
308
308
|
*/
|
|
309
309
|
write(t) {
|
|
310
|
-
this.diff === t - this.s ? (this.s = t, this.count++) : (
|
|
310
|
+
this.diff === t - this.s ? (this.s = t, this.count++) : (ls(this), this.count = 1, this.diff = t - this.s, this.s = t);
|
|
311
311
|
}
|
|
312
312
|
/**
|
|
313
313
|
* Flush the encoded state and transform this to a Uint8Array.
|
|
@@ -315,10 +315,10 @@ class qe {
|
|
|
315
315
|
* Note that this should only be called once.
|
|
316
316
|
*/
|
|
317
317
|
toUint8Array() {
|
|
318
|
-
return
|
|
318
|
+
return ls(this), C(this.encoder);
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
|
-
class
|
|
321
|
+
class Yi {
|
|
322
322
|
constructor() {
|
|
323
323
|
this.sarr = [], this.s = "", this.lensE = new ue();
|
|
324
324
|
}
|
|
@@ -330,18 +330,18 @@ class Pi {
|
|
|
330
330
|
}
|
|
331
331
|
toUint8Array() {
|
|
332
332
|
const t = new Zt();
|
|
333
|
-
return this.sarr.push(this.s), this.s = "",
|
|
333
|
+
return this.sarr.push(this.s), this.s = "", ft(t, this.sarr.join("")), Ne(t, this.lensE.toUint8Array()), C(t);
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
const Y = (e) => new Error(e), H = () => {
|
|
337
337
|
throw Y("Method unimplemented");
|
|
338
338
|
}, j = () => {
|
|
339
339
|
throw Y("Unexpected case");
|
|
340
|
-
}, Me = Y("Unexpected end of array"),
|
|
340
|
+
}, Me = Y("Unexpected end of array"), Fs = Y("Integer out of Range"), Gi = (e, t, n) => {
|
|
341
341
|
if (t < 0 || n < 0 || t + n > e.length)
|
|
342
342
|
throw Me;
|
|
343
343
|
return new Uint8Array(e.buffer, e.byteOffset + t, n);
|
|
344
|
-
},
|
|
344
|
+
}, Ji = (e, t, n) => {
|
|
345
345
|
if (t < 0 || n < 0 || t + n > e.length)
|
|
346
346
|
throw Me;
|
|
347
347
|
return new DataView(e.buffer, e.byteOffset + t, n);
|
|
@@ -354,34 +354,34 @@ class Ue {
|
|
|
354
354
|
this.arr = t, this.pos = 0;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
|
-
const
|
|
358
|
-
const n =
|
|
357
|
+
const ht = (e) => new Ue(e), Ki = (e) => e.pos !== e.arr.length, Wi = (e, t) => {
|
|
358
|
+
const n = Gi(e.arr, e.pos, t);
|
|
359
359
|
return e.pos += t, n;
|
|
360
|
-
}, O = (e) =>
|
|
360
|
+
}, O = (e) => Wi(e, b(e)), Lt = (e) => e.arr[e.pos++], b = (e) => {
|
|
361
361
|
let t = 0, n = 1;
|
|
362
362
|
const s = e.arr.length;
|
|
363
363
|
for (; e.pos < s; ) {
|
|
364
364
|
const r = e.arr[e.pos++];
|
|
365
|
-
if (t = t + (r &
|
|
365
|
+
if (t = t + (r & dt) * n, n *= 128, r < B)
|
|
366
366
|
return t;
|
|
367
367
|
if (t > we)
|
|
368
|
-
throw
|
|
368
|
+
throw Fs;
|
|
369
369
|
}
|
|
370
370
|
throw Me;
|
|
371
|
-
},
|
|
372
|
-
let t = e.arr[e.pos++], n = t &
|
|
371
|
+
}, Ln = (e) => {
|
|
372
|
+
let t = e.arr[e.pos++], n = t & hn, s = 64;
|
|
373
373
|
const r = (t & X) > 0 ? -1 : 1;
|
|
374
374
|
if ((t & B) === 0)
|
|
375
375
|
return r * n;
|
|
376
376
|
const i = e.arr.length;
|
|
377
377
|
for (; e.pos < i; ) {
|
|
378
|
-
if (t = e.arr[e.pos++], n = n + (t &
|
|
378
|
+
if (t = e.arr[e.pos++], n = n + (t & dt) * s, s *= 128, t < B)
|
|
379
379
|
return r * n;
|
|
380
380
|
if (n > we)
|
|
381
|
-
throw
|
|
381
|
+
throw Fs;
|
|
382
382
|
}
|
|
383
383
|
throw Me;
|
|
384
|
-
},
|
|
384
|
+
}, Xi = (e) => {
|
|
385
385
|
let t = b(e);
|
|
386
386
|
if (t === 0)
|
|
387
387
|
return "";
|
|
@@ -401,39 +401,39 @@ const lt = (e) => new Ue(e), Ji = (e) => e.pos !== e.arr.length, Ki = (e, t) =>
|
|
|
401
401
|
}
|
|
402
402
|
return decodeURIComponent(escape(n));
|
|
403
403
|
}
|
|
404
|
-
},
|
|
404
|
+
}, qi = (e) => (
|
|
405
405
|
/** @type any */
|
|
406
406
|
jt.decode(O(e))
|
|
407
|
-
),
|
|
408
|
-
const n =
|
|
407
|
+
), it = jt ? qi : Xi, vn = (e, t) => {
|
|
408
|
+
const n = Ji(e.arr, e.pos, t);
|
|
409
409
|
return e.pos += t, n;
|
|
410
|
-
},
|
|
410
|
+
}, Qi = (e) => vn(e, 4).getFloat32(0, !1), Zi = (e) => vn(e, 8).getFloat64(0, !1), to = (e) => (
|
|
411
411
|
/** @type {any} */
|
|
412
|
-
|
|
413
|
-
),
|
|
412
|
+
vn(e, 8).getBigInt64(0, !1)
|
|
413
|
+
), eo = [
|
|
414
414
|
(e) => {
|
|
415
415
|
},
|
|
416
416
|
// CASE 127: undefined
|
|
417
417
|
(e) => null,
|
|
418
418
|
// CASE 126: null
|
|
419
|
-
|
|
419
|
+
Ln,
|
|
420
420
|
// CASE 125: integer
|
|
421
|
-
qi,
|
|
422
|
-
// CASE 124: float32
|
|
423
421
|
Qi,
|
|
424
|
-
// CASE
|
|
422
|
+
// CASE 124: float32
|
|
425
423
|
Zi,
|
|
424
|
+
// CASE 123: float64
|
|
425
|
+
to,
|
|
426
426
|
// CASE 122: bigint
|
|
427
427
|
(e) => !1,
|
|
428
428
|
// CASE 121: boolean (false)
|
|
429
429
|
(e) => !0,
|
|
430
430
|
// CASE 120: boolean (true)
|
|
431
|
-
|
|
431
|
+
it,
|
|
432
432
|
// CASE 119: string
|
|
433
433
|
(e) => {
|
|
434
434
|
const t = b(e), n = {};
|
|
435
435
|
for (let s = 0; s < t; s++) {
|
|
436
|
-
const r =
|
|
436
|
+
const r = it(e);
|
|
437
437
|
n[r] = Gt(e);
|
|
438
438
|
}
|
|
439
439
|
return n;
|
|
@@ -446,8 +446,8 @@ const lt = (e) => new Ue(e), Ji = (e) => e.pos !== e.arr.length, Ki = (e, t) =>
|
|
|
446
446
|
},
|
|
447
447
|
O
|
|
448
448
|
// CASE 116: Uint8Array
|
|
449
|
-
], Gt = (e) =>
|
|
450
|
-
class
|
|
449
|
+
], Gt = (e) => eo[127 - Lt(e)](e);
|
|
450
|
+
class as extends Ue {
|
|
451
451
|
/**
|
|
452
452
|
* @param {Uint8Array} uint8Array
|
|
453
453
|
* @param {function(Decoder):T} reader
|
|
@@ -456,7 +456,7 @@ class ls extends Ue {
|
|
|
456
456
|
super(t), this.reader = n, this.s = null, this.count = 0;
|
|
457
457
|
}
|
|
458
458
|
read() {
|
|
459
|
-
return this.count === 0 && (this.s = this.reader(this),
|
|
459
|
+
return this.count === 0 && (this.s = this.reader(this), Ki(this) ? this.count = b(this) + 1 : this.count = -1), this.count--, /** @type {T} */
|
|
460
460
|
this.s;
|
|
461
461
|
}
|
|
462
462
|
}
|
|
@@ -469,15 +469,15 @@ class de extends Ue {
|
|
|
469
469
|
}
|
|
470
470
|
read() {
|
|
471
471
|
if (this.count === 0) {
|
|
472
|
-
this.s =
|
|
473
|
-
const t =
|
|
472
|
+
this.s = Ln(this);
|
|
473
|
+
const t = $s(this.s);
|
|
474
474
|
this.count = 1, t && (this.s = -this.s, this.count = b(this) + 2);
|
|
475
475
|
}
|
|
476
476
|
return this.count--, /** @type {number} */
|
|
477
477
|
this.s;
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
-
class
|
|
480
|
+
class Ze extends Ue {
|
|
481
481
|
/**
|
|
482
482
|
* @param {Uint8Array} uint8Array
|
|
483
483
|
*/
|
|
@@ -489,18 +489,18 @@ class Qe extends Ue {
|
|
|
489
489
|
*/
|
|
490
490
|
read() {
|
|
491
491
|
if (this.count === 0) {
|
|
492
|
-
const t =
|
|
492
|
+
const t = Ln(this), n = t & 1;
|
|
493
493
|
this.diff = z(t / 2), this.count = 1, n && (this.count = b(this) + 2);
|
|
494
494
|
}
|
|
495
495
|
return this.s += this.diff, this.count--, this.s;
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
class
|
|
498
|
+
class no {
|
|
499
499
|
/**
|
|
500
500
|
* @param {Uint8Array} uint8Array
|
|
501
501
|
*/
|
|
502
502
|
constructor(t) {
|
|
503
|
-
this.decoder = new de(t), this.str =
|
|
503
|
+
this.decoder = new de(t), this.str = it(this.decoder), this.spos = 0;
|
|
504
504
|
}
|
|
505
505
|
/**
|
|
506
506
|
* @return {string}
|
|
@@ -510,17 +510,17 @@ class eo {
|
|
|
510
510
|
return this.spos = t, n;
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
|
-
const
|
|
513
|
+
const so = crypto.getRandomValues.bind(crypto), Vs = () => so(new Uint32Array(1))[0], ro = "10000000-1000-4000-8000" + -1e11, io = () => ro.replace(
|
|
514
514
|
/[018]/g,
|
|
515
515
|
/** @param {number} c */
|
|
516
|
-
(e) => (e ^
|
|
517
|
-
),
|
|
516
|
+
(e) => (e ^ Vs() & 15 >> e / 4).toString(16)
|
|
517
|
+
), ct = Date.now, hs = (e) => (
|
|
518
518
|
/** @type {Promise<T>} */
|
|
519
519
|
new Promise(e)
|
|
520
520
|
);
|
|
521
521
|
Promise.all.bind(Promise);
|
|
522
|
-
const
|
|
523
|
-
class
|
|
522
|
+
const us = (e) => e === void 0 ? null : e;
|
|
523
|
+
class oo {
|
|
524
524
|
constructor() {
|
|
525
525
|
this.map = /* @__PURE__ */ new Map();
|
|
526
526
|
}
|
|
@@ -538,31 +538,31 @@ class io {
|
|
|
538
538
|
return this.map.get(t);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
|
-
let
|
|
541
|
+
let js = new oo(), On = !0;
|
|
542
542
|
try {
|
|
543
|
-
typeof localStorage != "undefined" && localStorage && (
|
|
543
|
+
typeof localStorage != "undefined" && localStorage && (js = localStorage, On = !1);
|
|
544
544
|
} catch (e) {
|
|
545
545
|
}
|
|
546
|
-
const
|
|
546
|
+
const Hs = js, co = (e) => On || addEventListener(
|
|
547
547
|
"storage",
|
|
548
548
|
/** @type {any} */
|
|
549
549
|
e
|
|
550
|
-
),
|
|
550
|
+
), lo = (e) => On || removeEventListener(
|
|
551
551
|
"storage",
|
|
552
552
|
/** @type {any} */
|
|
553
553
|
e
|
|
554
|
-
), Jt = /* @__PURE__ */ Symbol("Equality"),
|
|
554
|
+
), Jt = /* @__PURE__ */ Symbol("Equality"), zs = (e, t) => {
|
|
555
555
|
var n;
|
|
556
556
|
return e === t || !!((n = e == null ? void 0 : e[Jt]) != null && n.call(e, t)) || !1;
|
|
557
|
-
},
|
|
557
|
+
}, ao = (e) => typeof e == "object", ho = Object.assign, uo = Object.keys, fo = (e, t) => {
|
|
558
558
|
for (const n in e)
|
|
559
559
|
t(e[n], n);
|
|
560
|
-
},
|
|
560
|
+
}, go = (e, t) => {
|
|
561
561
|
const n = [];
|
|
562
562
|
for (const s in e)
|
|
563
563
|
n.push(t(e[s], s));
|
|
564
564
|
return n;
|
|
565
|
-
}, me = (e) =>
|
|
565
|
+
}, me = (e) => uo(e).length, po = (e) => {
|
|
566
566
|
for (const t in e)
|
|
567
567
|
return !1;
|
|
568
568
|
return !0;
|
|
@@ -571,20 +571,20 @@ const js = Vs, oo = (e) => Ln || addEventListener(
|
|
|
571
571
|
if (!t(e[n], n))
|
|
572
572
|
return !1;
|
|
573
573
|
return !0;
|
|
574
|
-
},
|
|
574
|
+
}, Nn = (e, t) => Object.prototype.hasOwnProperty.call(e, t), wo = (e, t) => e === t || me(e) === me(t) && te(e, (n, s) => (n !== void 0 || Nn(t, s)) && zs(t[s], n)), mo = Object.freeze, Ps = (e) => {
|
|
575
575
|
for (const t in e) {
|
|
576
576
|
const n = e[t];
|
|
577
|
-
(typeof n == "object" || typeof n == "function") &&
|
|
577
|
+
(typeof n == "object" || typeof n == "function") && Ps(e[t]);
|
|
578
578
|
}
|
|
579
|
-
return
|
|
580
|
-
},
|
|
579
|
+
return mo(e);
|
|
580
|
+
}, Mn = (e, t, n = 0) => {
|
|
581
581
|
try {
|
|
582
582
|
for (; n < e.length; n++)
|
|
583
583
|
e[n](...t);
|
|
584
584
|
} finally {
|
|
585
|
-
n < e.length &&
|
|
585
|
+
n < e.length && Mn(e, t, n + 1);
|
|
586
586
|
}
|
|
587
|
-
},
|
|
587
|
+
}, yo = (e) => e, Et = (e, t) => {
|
|
588
588
|
if (e === t)
|
|
589
589
|
return !0;
|
|
590
590
|
if (e == null || t == null || e.constructor !== t.constructor && (e.constructor || Object) !== (t.constructor || Object))
|
|
@@ -624,7 +624,7 @@ const js = Vs, oo = (e) => Ln || addEventListener(
|
|
|
624
624
|
if (me(e) !== me(t))
|
|
625
625
|
return !1;
|
|
626
626
|
for (const n in e)
|
|
627
|
-
if (!
|
|
627
|
+
if (!Nn(e, n) || !Et(e[n], t[n]))
|
|
628
628
|
return !1;
|
|
629
629
|
break;
|
|
630
630
|
case Array:
|
|
@@ -638,13 +638,13 @@ const js = Vs, oo = (e) => Ln || addEventListener(
|
|
|
638
638
|
return !1;
|
|
639
639
|
}
|
|
640
640
|
return !0;
|
|
641
|
-
},
|
|
642
|
-
var
|
|
643
|
-
const
|
|
641
|
+
}, bo = (e, t) => t.includes(e);
|
|
642
|
+
var Ys = {};
|
|
643
|
+
const lt = typeof process != "undefined" && process.release && /node|io\.js/.test(process.release.name) && Object.prototype.toString.call(typeof process != "undefined" ? process : 0) === "[object process]", Gs = typeof window != "undefined" && typeof document != "undefined" && !lt;
|
|
644
644
|
let P;
|
|
645
|
-
const
|
|
645
|
+
const ko = () => {
|
|
646
646
|
if (P === void 0)
|
|
647
|
-
if (
|
|
647
|
+
if (lt) {
|
|
648
648
|
P = $();
|
|
649
649
|
const e = process.argv;
|
|
650
650
|
let t = null;
|
|
@@ -656,26 +656,26 @@ const bo = () => {
|
|
|
656
656
|
} else typeof location == "object" ? (P = $(), (location.search || "?").slice(1).split("&").forEach((e) => {
|
|
657
657
|
if (e.length !== 0) {
|
|
658
658
|
const [t, n] = e.split("=");
|
|
659
|
-
P.set(`--${
|
|
659
|
+
P.set(`--${rs(t, "-")}`, n), P.set(`-${rs(t, "-")}`, n);
|
|
660
660
|
}
|
|
661
661
|
})) : P = $();
|
|
662
662
|
return P;
|
|
663
|
-
},
|
|
664
|
-
!
|
|
663
|
+
}, fn = (e) => ko().has(e), ye = (e) => us(lt ? Ys[e.toUpperCase().replaceAll("-", "_")] : Hs.getItem(e)), Js = (e) => fn("--" + e) || ye(e) !== null, _o = Js("production"), So = lt && bo(Ys.FORCE_COLOR, ["true", "1", "2"]), Co = So || !fn("--no-colors") && // @todo deprecate --no-colors
|
|
664
|
+
!Js("no-color") && (!lt || process.stdout.isTTY) && (!lt || fn("--color") || ye("COLORTERM") !== null || (ye("TERM") || "").includes("color")), Ks = (e) => new Uint8Array(e), Eo = (e) => new Uint8Array(e), Do = (e) => {
|
|
665
665
|
let t = "";
|
|
666
666
|
for (let n = 0; n < e.byteLength; n++)
|
|
667
|
-
t +=
|
|
667
|
+
t += Bs(e[n]);
|
|
668
668
|
return btoa(t);
|
|
669
|
-
},
|
|
670
|
-
const t = atob(e), n =
|
|
669
|
+
}, Ao = (e) => Buffer.from(e.buffer, e.byteOffset, e.byteLength).toString("base64"), To = (e) => {
|
|
670
|
+
const t = atob(e), n = Ks(t.length);
|
|
671
671
|
for (let s = 0; s < t.length; s++)
|
|
672
672
|
n[s] = t.charCodeAt(s);
|
|
673
673
|
return n;
|
|
674
|
-
},
|
|
675
|
-
const t =
|
|
674
|
+
}, xo = (e) => new Uint8Array(Buffer.from(e, "base64")), Io = Gs ? Do : Ao, Lo = Gs ? To : xo, vo = (e) => {
|
|
675
|
+
const t = Ks(e.byteLength);
|
|
676
676
|
return t.set(e), t;
|
|
677
677
|
};
|
|
678
|
-
class
|
|
678
|
+
class Oo {
|
|
679
679
|
/**
|
|
680
680
|
* @param {L} left
|
|
681
681
|
* @param {R} right
|
|
@@ -684,14 +684,14 @@ class vo {
|
|
|
684
684
|
this.left = t, this.right = n;
|
|
685
685
|
}
|
|
686
686
|
}
|
|
687
|
-
const W = (e, t) => new
|
|
688
|
-
const s =
|
|
687
|
+
const W = (e, t) => new Oo(e, t), ds = (e) => e.next() >= 0.5, tn = (e, t, n) => z(e.next() * (n + 1 - t) + t), Ws = (e, t, n) => z(e.next() * (n + 1 - t) + t), Un = (e, t, n) => Ws(e, t, n), No = (e) => Bs(Un(e, 97, 122)), Mo = (e, t = 0, n = 20) => {
|
|
688
|
+
const s = Un(e, t, n);
|
|
689
689
|
let r = "";
|
|
690
690
|
for (let i = 0; i < s; i++)
|
|
691
|
-
r +=
|
|
691
|
+
r += No(e);
|
|
692
692
|
return r;
|
|
693
|
-
},
|
|
694
|
-
class
|
|
693
|
+
}, en = (e, t) => t[Un(e, 0, t.length - 1)], Uo = /* @__PURE__ */ Symbol("0schema");
|
|
694
|
+
class Ro {
|
|
695
695
|
constructor() {
|
|
696
696
|
this._rerrs = [];
|
|
697
697
|
}
|
|
@@ -708,18 +708,18 @@ class Uo {
|
|
|
708
708
|
const t = [];
|
|
709
709
|
for (let n = this._rerrs.length - 1; n > 0; n--) {
|
|
710
710
|
const s = this._rerrs[n];
|
|
711
|
-
t.push(
|
|
711
|
+
t.push(Ri(" ", (this._rerrs.length - n) * 2) + `${s.path != null ? `[${s.path}] ` : ""}${s.has} doesn't match ${s.expected}. ${s.message}`);
|
|
712
712
|
}
|
|
713
713
|
return t.join(`
|
|
714
714
|
`);
|
|
715
715
|
}
|
|
716
716
|
}
|
|
717
|
-
const
|
|
717
|
+
const gn = (e, t) => e === t ? !0 : e == null || t == null || e.constructor !== t.constructor ? !1 : e[Jt] ? zs(e, t) : It(e) ? Cn(
|
|
718
718
|
e,
|
|
719
|
-
(n) =>
|
|
720
|
-
) :
|
|
719
|
+
(n) => En(t, (s) => gn(n, s))
|
|
720
|
+
) : ao(e) ? te(
|
|
721
721
|
e,
|
|
722
|
-
(n, s) =>
|
|
722
|
+
(n, s) => gn(n, t[s])
|
|
723
723
|
) : !1;
|
|
724
724
|
class U {
|
|
725
725
|
/**
|
|
@@ -734,7 +734,7 @@ class U {
|
|
|
734
734
|
];
|
|
735
735
|
return (
|
|
736
736
|
/** @type {typeof Schema<any>} */
|
|
737
|
-
this.constructor._dilutes && ([s, n] = [n, s]),
|
|
737
|
+
this.constructor._dilutes && ([s, n] = [n, s]), gn(n, s)
|
|
738
738
|
);
|
|
739
739
|
}
|
|
740
740
|
/**
|
|
@@ -745,7 +745,7 @@ class U {
|
|
|
745
745
|
equals(t) {
|
|
746
746
|
return this.constructor === t.constructor && Et(this.shape, t.shape);
|
|
747
747
|
}
|
|
748
|
-
[
|
|
748
|
+
[Uo]() {
|
|
749
749
|
return !0;
|
|
750
750
|
}
|
|
751
751
|
/**
|
|
@@ -790,7 +790,7 @@ class U {
|
|
|
790
790
|
* @type {$Optional<Schema<T>>}
|
|
791
791
|
*/
|
|
792
792
|
get optional() {
|
|
793
|
-
return new
|
|
793
|
+
return new Qs(
|
|
794
794
|
/** @type {Schema<T>} */
|
|
795
795
|
this
|
|
796
796
|
);
|
|
@@ -808,7 +808,7 @@ class U {
|
|
|
808
808
|
* @return {Extract<OO, T> extends never ? T : (OO extends Array<never> ? T : Extract<OO,T>)}
|
|
809
809
|
*/
|
|
810
810
|
cast(t) {
|
|
811
|
-
return
|
|
811
|
+
return fs(t, this), /** @type {any} */
|
|
812
812
|
t;
|
|
813
813
|
}
|
|
814
814
|
/**
|
|
@@ -831,7 +831,7 @@ class U {
|
|
|
831
831
|
* @return {o extends T ? T : never}
|
|
832
832
|
*/
|
|
833
833
|
expect(t) {
|
|
834
|
-
return
|
|
834
|
+
return fs(t, this), t;
|
|
835
835
|
}
|
|
836
836
|
}
|
|
837
837
|
// this.shape must not be defined on Schema. Otherwise typecheck on metatypes (e.g. $$object) won't work as expected anymore
|
|
@@ -841,7 +841,7 @@ class U {
|
|
|
841
841
|
* @protected
|
|
842
842
|
*/
|
|
843
843
|
oe(U, "_dilutes", !1);
|
|
844
|
-
class
|
|
844
|
+
class Rn extends U {
|
|
845
845
|
/**
|
|
846
846
|
* @param {C} c
|
|
847
847
|
* @param {((o:Instance<C>)=>boolean)|null} check
|
|
@@ -859,9 +859,9 @@ class Mn extends U {
|
|
|
859
859
|
return !s && (n == null || n.extend(null, this.shape.name, t == null ? void 0 : t.constructor.name, (t == null ? void 0 : t.constructor) !== this.shape ? "Constructor match failed" : "Check failed")), s;
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
|
-
const D = (e, t = null) => new
|
|
863
|
-
D(
|
|
864
|
-
class
|
|
862
|
+
const D = (e, t = null) => new Rn(e, t);
|
|
863
|
+
D(Rn);
|
|
864
|
+
class $n extends U {
|
|
865
865
|
/**
|
|
866
866
|
* @param {(o:any) => boolean} check
|
|
867
867
|
*/
|
|
@@ -878,8 +878,8 @@ class Un extends U {
|
|
|
878
878
|
return !s && (n == null || n.extend(null, "custom prop", t == null ? void 0 : t.constructor.name, "failed to check custom prop")), s;
|
|
879
879
|
}
|
|
880
880
|
}
|
|
881
|
-
const L = (e) => new
|
|
882
|
-
D(
|
|
881
|
+
const L = (e) => new $n(e);
|
|
882
|
+
D($n);
|
|
883
883
|
class Re extends U {
|
|
884
884
|
/**
|
|
885
885
|
* @param {Array<T>} literals
|
|
@@ -898,32 +898,32 @@ class Re extends U {
|
|
|
898
898
|
return !s && (n == null || n.extend(null, this.shape.join(" | "), t.toString())), s;
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
|
-
const $e = (...e) => new Re(e),
|
|
901
|
+
const $e = (...e) => new Re(e), Xs = D(Re), $o = (
|
|
902
902
|
/** @type {any} */
|
|
903
903
|
RegExp.escape || /** @type {(str:string) => string} */
|
|
904
904
|
((e) => e.replace(/[().|&,$^[\]]/g, (t) => "\\" + t))
|
|
905
|
-
),
|
|
905
|
+
), qs = (e) => {
|
|
906
906
|
if (vt.check(e))
|
|
907
|
-
return [
|
|
908
|
-
if (
|
|
907
|
+
return [$o(e)];
|
|
908
|
+
if (Xs.check(e))
|
|
909
909
|
return (
|
|
910
910
|
/** @type {Array<string|number>} */
|
|
911
911
|
e.shape.map((t) => t + "")
|
|
912
912
|
);
|
|
913
|
-
if (or.check(e))
|
|
914
|
-
return ["[+-]?\\d+.?\\d*"];
|
|
915
913
|
if (cr.check(e))
|
|
914
|
+
return ["[+-]?\\d+.?\\d*"];
|
|
915
|
+
if (lr.check(e))
|
|
916
916
|
return [".*"];
|
|
917
917
|
if (ke.check(e))
|
|
918
|
-
return e.shape.map(
|
|
918
|
+
return e.shape.map(qs).flat(1);
|
|
919
919
|
j();
|
|
920
920
|
};
|
|
921
|
-
class
|
|
921
|
+
class Bo extends U {
|
|
922
922
|
/**
|
|
923
923
|
* @param {T} shape
|
|
924
924
|
*/
|
|
925
925
|
constructor(t) {
|
|
926
|
-
super(), this.shape = t, this._r = new RegExp("^" + t.map(
|
|
926
|
+
super(), this.shape = t, this._r = new RegExp("^" + t.map(qs).map((n) => `(${n.join("|")})`).join("") + "$");
|
|
927
927
|
}
|
|
928
928
|
/**
|
|
929
929
|
* @param {any} o
|
|
@@ -935,9 +935,9 @@ class $o extends U {
|
|
|
935
935
|
return !s && (n == null || n.extend(null, this._r.toString(), t.toString(), "String doesn't match string template.")), s;
|
|
936
936
|
}
|
|
937
937
|
}
|
|
938
|
-
D(
|
|
939
|
-
const
|
|
940
|
-
class
|
|
938
|
+
D(Bo);
|
|
939
|
+
const Fo = /* @__PURE__ */ Symbol("optional");
|
|
940
|
+
class Qs extends U {
|
|
941
941
|
/**
|
|
942
942
|
* @param {S} shape
|
|
943
943
|
*/
|
|
@@ -953,12 +953,12 @@ class qs extends U {
|
|
|
953
953
|
const s = t === void 0 || this.shape.check(t);
|
|
954
954
|
return !s && (n == null || n.extend(null, "undefined (optional)", "()")), s;
|
|
955
955
|
}
|
|
956
|
-
get [
|
|
956
|
+
get [Fo]() {
|
|
957
957
|
return !0;
|
|
958
958
|
}
|
|
959
959
|
}
|
|
960
|
-
const
|
|
961
|
-
class
|
|
960
|
+
const Vo = D(Qs);
|
|
961
|
+
class jo extends U {
|
|
962
962
|
/**
|
|
963
963
|
* @param {any} _o
|
|
964
964
|
* @param {ValidationError} [err]
|
|
@@ -968,7 +968,7 @@ class Vo extends U {
|
|
|
968
968
|
return n == null || n.extend(null, "never", typeof t), !1;
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
|
-
D(
|
|
971
|
+
D(jo);
|
|
972
972
|
const ve = class ve extends U {
|
|
973
973
|
/**
|
|
974
974
|
* @param {S} shape
|
|
@@ -990,18 +990,18 @@ const ve = class ve extends U {
|
|
|
990
990
|
*/
|
|
991
991
|
check(t, n) {
|
|
992
992
|
return t == null ? (n == null || n.extend(null, "object", "null"), !1) : te(this.shape, (s, r) => {
|
|
993
|
-
const i = this._isPartial && !
|
|
993
|
+
const i = this._isPartial && !Nn(t, r) || s.check(t[r], n);
|
|
994
994
|
return !i && (n == null || n.extend(r.toString(), s.toString(), typeof t[r], "Object property does not match")), i;
|
|
995
995
|
});
|
|
996
996
|
}
|
|
997
997
|
};
|
|
998
998
|
oe(ve, "_dilutes", !0);
|
|
999
999
|
let be = ve;
|
|
1000
|
-
const
|
|
1000
|
+
const Ho = (e) => (
|
|
1001
1001
|
/** @type {any} */
|
|
1002
1002
|
new be(e)
|
|
1003
|
-
),
|
|
1004
|
-
class
|
|
1003
|
+
), zo = D(be), Po = L((e) => e != null && (e.constructor === Object || e.constructor == null));
|
|
1004
|
+
class Zs extends U {
|
|
1005
1005
|
/**
|
|
1006
1006
|
* @param {Keys} keys
|
|
1007
1007
|
* @param {Values} values
|
|
@@ -1024,8 +1024,8 @@ class Qs extends U {
|
|
|
1024
1024
|
});
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
const
|
|
1028
|
-
class
|
|
1027
|
+
const tr = (e, t) => new Zs(e, t), Yo = D(Zs);
|
|
1028
|
+
class er extends U {
|
|
1029
1029
|
/**
|
|
1030
1030
|
* @param {S} shape
|
|
1031
1031
|
*/
|
|
@@ -1047,9 +1047,9 @@ class tr extends U {
|
|
|
1047
1047
|
});
|
|
1048
1048
|
}
|
|
1049
1049
|
}
|
|
1050
|
-
const
|
|
1051
|
-
D(
|
|
1052
|
-
class
|
|
1050
|
+
const Go = (...e) => new er(e);
|
|
1051
|
+
D(er);
|
|
1052
|
+
class nr extends U {
|
|
1053
1053
|
/**
|
|
1054
1054
|
* @param {Array<S>} v
|
|
1055
1055
|
*/
|
|
@@ -1062,12 +1062,12 @@ class er extends U {
|
|
|
1062
1062
|
* @return {o is Array<S extends Schema<infer T> ? T : never>} o
|
|
1063
1063
|
*/
|
|
1064
1064
|
check(t, n) {
|
|
1065
|
-
const s = It(t) &&
|
|
1065
|
+
const s = It(t) && Cn(t, (r) => this.shape.check(r));
|
|
1066
1066
|
return !s && (n == null || n.extend(null, "Array", "")), s;
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
1069
|
-
const
|
|
1070
|
-
class
|
|
1069
|
+
const sr = (...e) => new nr(e), Jo = D(nr), Ko = L((e) => It(e));
|
|
1070
|
+
class rr extends U {
|
|
1071
1071
|
/**
|
|
1072
1072
|
* @param {new (...args:any) => T} constructor
|
|
1073
1073
|
* @param {((o:T) => boolean)|null} check
|
|
@@ -1085,15 +1085,15 @@ class sr extends U {
|
|
|
1085
1085
|
return !s && (n == null || n.extend(null, this.shape.name, t == null ? void 0 : t.constructor.name)), s;
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
1088
|
-
const
|
|
1089
|
-
D(
|
|
1090
|
-
const
|
|
1091
|
-
class
|
|
1088
|
+
const Wo = (e, t = null) => new rr(e, t);
|
|
1089
|
+
D(rr);
|
|
1090
|
+
const Xo = Wo(U);
|
|
1091
|
+
class qo extends U {
|
|
1092
1092
|
/**
|
|
1093
1093
|
* @param {Args} args
|
|
1094
1094
|
*/
|
|
1095
1095
|
constructor(t) {
|
|
1096
|
-
super(), this.len = t.length - 1, this.args =
|
|
1096
|
+
super(), this.len = t.length - 1, this.args = Go(...t.slice(-1)), this.res = t[this.len];
|
|
1097
1097
|
}
|
|
1098
1098
|
/**
|
|
1099
1099
|
* @param {any} f
|
|
@@ -1105,8 +1105,8 @@ class Xo extends U {
|
|
|
1105
1105
|
return !s && (n == null || n.extend(null, "function", typeof t)), s;
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
|
-
const
|
|
1109
|
-
class
|
|
1108
|
+
const Qo = D(qo), Zo = L((e) => typeof e == "function");
|
|
1109
|
+
class tc extends U {
|
|
1110
1110
|
/**
|
|
1111
1111
|
* @param {T} v
|
|
1112
1112
|
*/
|
|
@@ -1119,11 +1119,11 @@ class Zo extends U {
|
|
|
1119
1119
|
* @return {o is Intersect<UnwrapArray<T>>}
|
|
1120
1120
|
*/
|
|
1121
1121
|
check(t, n) {
|
|
1122
|
-
const s =
|
|
1122
|
+
const s = Cn(this.shape, (r) => r.check(t, n));
|
|
1123
1123
|
return !s && (n == null || n.extend(null, "Intersectinon", typeof t)), s;
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
|
-
D(
|
|
1126
|
+
D(tc, (e) => e.shape.length > 0);
|
|
1127
1127
|
class Be extends U {
|
|
1128
1128
|
/**
|
|
1129
1129
|
* @param {Array<Schema<S>>} v
|
|
@@ -1137,7 +1137,7 @@ class Be extends U {
|
|
|
1137
1137
|
* @return {o is S}
|
|
1138
1138
|
*/
|
|
1139
1139
|
check(t, n) {
|
|
1140
|
-
const s =
|
|
1140
|
+
const s = En(this.shape, (r) => r.check(t, n));
|
|
1141
1141
|
return n == null || n.extend(null, "Union", typeof t), s;
|
|
1142
1142
|
}
|
|
1143
1143
|
}
|
|
@@ -1145,69 +1145,69 @@ oe(Be, "_dilutes", !0);
|
|
|
1145
1145
|
const Rt = (...e) => e.findIndex((t) => ke.check(t)) >= 0 ? Rt(...e.map((t) => Kt(t)).map((t) => ke.check(t) ? t.shape : [t]).flat(1)) : e.length === 1 ? e[0] : new Be(e), ke = (
|
|
1146
1146
|
/** @type {Schema<$Union<any>>} */
|
|
1147
1147
|
D(Be)
|
|
1148
|
-
),
|
|
1148
|
+
), ir = () => !0, _e = L(ir), ec = (
|
|
1149
1149
|
/** @type {Schema<Schema<any>>} */
|
|
1150
|
-
D(
|
|
1151
|
-
),
|
|
1150
|
+
D($n, (e) => e.shape === ir)
|
|
1151
|
+
), Bn = L((e) => typeof e == "bigint"), nc = (
|
|
1152
1152
|
/** @type {Schema<Schema<BigInt>>} */
|
|
1153
|
-
L((e) => e ===
|
|
1154
|
-
),
|
|
1155
|
-
L((e) => e ===
|
|
1156
|
-
const Dt = L((e) => typeof e == "number"),
|
|
1153
|
+
L((e) => e === Bn)
|
|
1154
|
+
), or = L((e) => typeof e == "symbol");
|
|
1155
|
+
L((e) => e === or);
|
|
1156
|
+
const Dt = L((e) => typeof e == "number"), cr = (
|
|
1157
1157
|
/** @type {Schema<Schema<number>>} */
|
|
1158
1158
|
L((e) => e === Dt)
|
|
1159
|
-
), vt = L((e) => typeof e == "string"),
|
|
1159
|
+
), vt = L((e) => typeof e == "string"), lr = (
|
|
1160
1160
|
/** @type {Schema<Schema<string>>} */
|
|
1161
1161
|
L((e) => e === vt)
|
|
1162
|
-
), Fe = L((e) => typeof e == "boolean"),
|
|
1162
|
+
), Fe = L((e) => typeof e == "boolean"), sc = (
|
|
1163
1163
|
/** @type {Schema<Schema<Boolean>>} */
|
|
1164
1164
|
L((e) => e === Fe)
|
|
1165
|
-
),
|
|
1165
|
+
), ar = $e(void 0);
|
|
1166
1166
|
D(Re, (e) => e.shape.length === 1 && e.shape[0] === void 0);
|
|
1167
1167
|
$e(void 0);
|
|
1168
|
-
const Ve = $e(null),
|
|
1168
|
+
const Ve = $e(null), rc = (
|
|
1169
1169
|
/** @type {Schema<Schema<null>>} */
|
|
1170
1170
|
D(Re, (e) => e.shape.length === 1 && e.shape[0] === null)
|
|
1171
1171
|
);
|
|
1172
1172
|
D(Uint8Array);
|
|
1173
|
-
D(
|
|
1174
|
-
const
|
|
1173
|
+
D(Rn, (e) => e.shape === Uint8Array);
|
|
1174
|
+
const ic = Rt(Dt, vt, Ve, ar, Bn, Fe, or);
|
|
1175
1175
|
(() => {
|
|
1176
1176
|
const e = (
|
|
1177
1177
|
/** @type {$Array<$any>} */
|
|
1178
|
-
|
|
1178
|
+
sr(_e)
|
|
1179
1179
|
), t = (
|
|
1180
1180
|
/** @type {$Record<$string,$any>} */
|
|
1181
|
-
|
|
1181
|
+
tr(vt, _e)
|
|
1182
1182
|
), n = Rt(Dt, vt, Ve, Fe, e, t);
|
|
1183
1183
|
return e.shape = n, t.shape.values = n, n;
|
|
1184
1184
|
})();
|
|
1185
1185
|
const Kt = (e) => {
|
|
1186
|
-
if (
|
|
1186
|
+
if (Xo.check(e))
|
|
1187
1187
|
return (
|
|
1188
1188
|
/** @type {any} */
|
|
1189
1189
|
e
|
|
1190
1190
|
);
|
|
1191
|
-
if (
|
|
1191
|
+
if (Po.check(e)) {
|
|
1192
1192
|
const t = {};
|
|
1193
1193
|
for (const n in e)
|
|
1194
1194
|
t[n] = Kt(e[n]);
|
|
1195
1195
|
return (
|
|
1196
1196
|
/** @type {any} */
|
|
1197
|
-
|
|
1197
|
+
Ho(t)
|
|
1198
1198
|
);
|
|
1199
1199
|
} else {
|
|
1200
|
-
if (
|
|
1200
|
+
if (Ko.check(e))
|
|
1201
1201
|
return (
|
|
1202
1202
|
/** @type {any} */
|
|
1203
1203
|
Rt(...e.map(Kt))
|
|
1204
1204
|
);
|
|
1205
|
-
if (
|
|
1205
|
+
if (ic.check(e))
|
|
1206
1206
|
return (
|
|
1207
1207
|
/** @type {any} */
|
|
1208
1208
|
$e(e)
|
|
1209
1209
|
);
|
|
1210
|
-
if (
|
|
1210
|
+
if (Zo.check(e))
|
|
1211
1211
|
return (
|
|
1212
1212
|
/** @type {any} */
|
|
1213
1213
|
D(
|
|
@@ -1217,14 +1217,14 @@ const Kt = (e) => {
|
|
|
1217
1217
|
);
|
|
1218
1218
|
}
|
|
1219
1219
|
j();
|
|
1220
|
-
},
|
|
1220
|
+
}, fs = _o ? () => {
|
|
1221
1221
|
} : (e, t) => {
|
|
1222
|
-
const n = new
|
|
1222
|
+
const n = new Ro();
|
|
1223
1223
|
if (!t.check(e, n))
|
|
1224
1224
|
throw Y(`Expected value to be of type ${t.constructor.name}.
|
|
1225
1225
|
${n.toString()}`);
|
|
1226
1226
|
};
|
|
1227
|
-
class
|
|
1227
|
+
class oc {
|
|
1228
1228
|
/**
|
|
1229
1229
|
* @param {Schema<State>} [$state]
|
|
1230
1230
|
*/
|
|
@@ -1267,45 +1267,45 @@ class ic {
|
|
|
1267
1267
|
);
|
|
1268
1268
|
}
|
|
1269
1269
|
}
|
|
1270
|
-
const
|
|
1270
|
+
const cc = (e) => new oc(
|
|
1271
1271
|
/** @type {any} */
|
|
1272
1272
|
e
|
|
1273
|
-
),
|
|
1273
|
+
), hr = (
|
|
1274
1274
|
/** @type {any} */
|
|
1275
|
-
|
|
1275
|
+
cc(
|
|
1276
1276
|
/** @type {Schema<prng.PRNG>} */
|
|
1277
1277
|
_e
|
|
1278
|
-
).if(
|
|
1278
|
+
).if(cr, (e, t) => tn(t, ss, we)).if(lr, (e, t) => Mo(t)).if(sc, (e, t) => ds(t)).if(nc, (e, t) => BigInt(tn(t, ss, we))).if(ke, (e, t) => kt(t, en(t, e.shape))).if(zo, (e, t) => {
|
|
1279
1279
|
const n = {};
|
|
1280
1280
|
for (const s in e.shape) {
|
|
1281
1281
|
let r = e.shape[s];
|
|
1282
|
-
if (
|
|
1283
|
-
if (
|
|
1282
|
+
if (Vo.check(r)) {
|
|
1283
|
+
if (ds(t))
|
|
1284
1284
|
continue;
|
|
1285
1285
|
r = r.shape;
|
|
1286
1286
|
}
|
|
1287
|
-
n[s] =
|
|
1287
|
+
n[s] = hr(r, t);
|
|
1288
1288
|
}
|
|
1289
1289
|
return n;
|
|
1290
|
-
}).if(
|
|
1291
|
-
const n = [], s =
|
|
1290
|
+
}).if(Jo, (e, t) => {
|
|
1291
|
+
const n = [], s = Ws(t, 0, 42);
|
|
1292
1292
|
for (let r = 0; r < s; r++)
|
|
1293
1293
|
n.push(kt(t, e.shape));
|
|
1294
1294
|
return n;
|
|
1295
|
-
}).if(
|
|
1295
|
+
}).if(Xs, (e, t) => en(t, e.shape)).if(rc, (e, t) => null).if(Qo, (e, t) => {
|
|
1296
1296
|
const n = kt(t, e.res);
|
|
1297
1297
|
return () => n;
|
|
1298
|
-
}).if(
|
|
1298
|
+
}).if(ec, (e, t) => kt(t, en(t, [
|
|
1299
1299
|
Dt,
|
|
1300
1300
|
vt,
|
|
1301
1301
|
Ve,
|
|
1302
|
-
|
|
1303
|
-
|
|
1302
|
+
ar,
|
|
1303
|
+
Bn,
|
|
1304
1304
|
Fe,
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
]))).if(
|
|
1308
|
-
const n = {}, s =
|
|
1305
|
+
sr(Dt),
|
|
1306
|
+
tr(Rt("a", "b", "c"), Dt)
|
|
1307
|
+
]))).if(Yo, (e, t) => {
|
|
1308
|
+
const n = {}, s = tn(t, 0, 3);
|
|
1309
1309
|
for (let r = 0; r < s; r++) {
|
|
1310
1310
|
const i = kt(t, e.shape.keys), o = kt(t, e.shape.values);
|
|
1311
1311
|
n[i] = o;
|
|
@@ -1314,18 +1314,18 @@ const oc = (e) => new ic(
|
|
|
1314
1314
|
}).done()
|
|
1315
1315
|
), kt = (e, t) => (
|
|
1316
1316
|
/** @type {any} */
|
|
1317
|
-
|
|
1317
|
+
hr(Kt(t), e)
|
|
1318
1318
|
), je = (
|
|
1319
1319
|
/** @type {Document} */
|
|
1320
1320
|
typeof document != "undefined" ? document : {}
|
|
1321
1321
|
);
|
|
1322
|
-
L((e) => e.nodeType ===
|
|
1322
|
+
L((e) => e.nodeType === dc);
|
|
1323
1323
|
typeof DOMParser != "undefined" && new DOMParser();
|
|
1324
|
-
L((e) => e.nodeType === lc);
|
|
1325
1324
|
L((e) => e.nodeType === ac);
|
|
1326
|
-
const cc = (e) => ki(e, (t, n) => `${n}:${t};`).join(""), lc = je.ELEMENT_NODE, ac = je.TEXT_NODE, hc = je.DOCUMENT_NODE, uc = je.DOCUMENT_FRAGMENT_NODE;
|
|
1327
1325
|
L((e) => e.nodeType === hc);
|
|
1328
|
-
const
|
|
1326
|
+
const lc = (e) => _i(e, (t, n) => `${n}:${t};`).join(""), ac = je.ELEMENT_NODE, hc = je.TEXT_NODE, uc = je.DOCUMENT_NODE, dc = je.DOCUMENT_FRAGMENT_NODE;
|
|
1327
|
+
L((e) => e.nodeType === uc);
|
|
1328
|
+
const et = Symbol, ur = et(), dr = et(), fc = et(), gc = et(), pc = et(), fr = et(), wc = et(), Fn = et(), mc = et(), yc = (e) => {
|
|
1329
1329
|
var r;
|
|
1330
1330
|
e.length === 1 && ((r = e[0]) == null ? void 0 : r.constructor) === Function && (e = /** @type {Array<string|Symbol|Object|number>} */
|
|
1331
1331
|
/** @type {[function]} */
|
|
@@ -1346,18 +1346,18 @@ const tt = Symbol, hr = tt(), ur = tt(), dc = tt(), fc = tt(), gc = tt(), dr = t
|
|
|
1346
1346
|
i instanceof Symbol || n.push(i);
|
|
1347
1347
|
}
|
|
1348
1348
|
return n;
|
|
1349
|
-
},
|
|
1350
|
-
[
|
|
1351
|
-
[
|
|
1352
|
-
[
|
|
1353
|
-
[
|
|
1354
|
-
[
|
|
1355
|
-
[
|
|
1356
|
-
[
|
|
1357
|
-
[
|
|
1349
|
+
}, bc = {
|
|
1350
|
+
[ur]: W("font-weight", "bold"),
|
|
1351
|
+
[dr]: W("font-weight", "normal"),
|
|
1352
|
+
[fc]: W("color", "blue"),
|
|
1353
|
+
[pc]: W("color", "green"),
|
|
1354
|
+
[gc]: W("color", "grey"),
|
|
1355
|
+
[fr]: W("color", "red"),
|
|
1356
|
+
[wc]: W("color", "purple"),
|
|
1357
|
+
[Fn]: W("color", "orange"),
|
|
1358
1358
|
// not well supported in chrome when debugging node with inspector - TODO: deprecate
|
|
1359
|
-
[
|
|
1360
|
-
},
|
|
1359
|
+
[mc]: W("color", "black")
|
|
1360
|
+
}, kc = (e) => {
|
|
1361
1361
|
var o;
|
|
1362
1362
|
e.length === 1 && ((o = e[0]) == null ? void 0 : o.constructor) === Function && (e = /** @type {Array<string|Symbol|Object|number>} */
|
|
1363
1363
|
/** @type {[function]} */
|
|
@@ -1365,14 +1365,14 @@ const tt = Symbol, hr = tt(), ur = tt(), dc = tt(), fc = tt(), gc = tt(), dr = t
|
|
|
1365
1365
|
const t = [], n = [], s = $();
|
|
1366
1366
|
let r = [], i = 0;
|
|
1367
1367
|
for (; i < e.length; i++) {
|
|
1368
|
-
const c = e[i], l =
|
|
1368
|
+
const c = e[i], l = bc[c];
|
|
1369
1369
|
if (l !== void 0)
|
|
1370
1370
|
s.set(l.left, l.right);
|
|
1371
1371
|
else {
|
|
1372
1372
|
if (c === void 0)
|
|
1373
1373
|
break;
|
|
1374
1374
|
if (c.constructor === String || c.constructor === Number) {
|
|
1375
|
-
const a =
|
|
1375
|
+
const a = lc(s);
|
|
1376
1376
|
i > 0 || a.length > 0 ? (t.push("%c" + c), n.push(a)) : t.push(c);
|
|
1377
1377
|
} else
|
|
1378
1378
|
break;
|
|
@@ -1383,11 +1383,11 @@ const tt = Symbol, hr = tt(), ur = tt(), dc = tt(), fc = tt(), gc = tt(), dr = t
|
|
|
1383
1383
|
c instanceof Symbol || r.push(c);
|
|
1384
1384
|
}
|
|
1385
1385
|
return r;
|
|
1386
|
-
},
|
|
1387
|
-
console.log(...
|
|
1388
|
-
},
|
|
1389
|
-
console.warn(...
|
|
1390
|
-
},
|
|
1386
|
+
}, gr = Co ? kc : yc, _c = (...e) => {
|
|
1387
|
+
console.log(...gr(e)), wr.forEach((t) => t.print(e));
|
|
1388
|
+
}, pr = (...e) => {
|
|
1389
|
+
console.warn(...gr(e)), e.unshift(Fn), wr.forEach((t) => t.print(e));
|
|
1390
|
+
}, wr = ot(), mr = (e) => ({
|
|
1391
1391
|
/**
|
|
1392
1392
|
* @return {IterableIterator<T>}
|
|
1393
1393
|
*/
|
|
@@ -1396,13 +1396,13 @@ const tt = Symbol, hr = tt(), ur = tt(), dc = tt(), fc = tt(), gc = tt(), dr = t
|
|
|
1396
1396
|
},
|
|
1397
1397
|
// @ts-ignore
|
|
1398
1398
|
next: e
|
|
1399
|
-
}),
|
|
1399
|
+
}), Sc = (e, t) => mr(() => {
|
|
1400
1400
|
let n;
|
|
1401
1401
|
do
|
|
1402
1402
|
n = e.next();
|
|
1403
1403
|
while (!n.done && !t(n.value));
|
|
1404
1404
|
return n;
|
|
1405
|
-
}),
|
|
1405
|
+
}), nn = (e, t) => mr(() => {
|
|
1406
1406
|
const { done: n, value: s } = e.next();
|
|
1407
1407
|
return { done: n, value: n ? void 0 : t(s) };
|
|
1408
1408
|
});
|
|
@@ -1428,9 +1428,9 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
|
|
|
1428
1428
|
if (i != null) {
|
|
1429
1429
|
const o = i[i.length - 1], c = o.id.clock + o.length;
|
|
1430
1430
|
for (let l = 0, a = s[l]; l < s.length && a.clock < c; a = s[++l])
|
|
1431
|
-
|
|
1431
|
+
Ir(e, i, a.clock, a.len, n);
|
|
1432
1432
|
}
|
|
1433
|
-
}),
|
|
1433
|
+
}), Cc = (e, t) => {
|
|
1434
1434
|
let n = 0, s = e.length - 1;
|
|
1435
1435
|
for (; n <= s; ) {
|
|
1436
1436
|
const r = z((n + s) / 2), i = e[r], o = i.clock;
|
|
@@ -1444,8 +1444,8 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
|
|
|
1444
1444
|
return null;
|
|
1445
1445
|
}, ee = (e, t) => {
|
|
1446
1446
|
const n = e.clients.get(t.client);
|
|
1447
|
-
return n !== void 0 &&
|
|
1448
|
-
},
|
|
1447
|
+
return n !== void 0 && Cc(n, t.clock) !== null;
|
|
1448
|
+
}, Vn = (e) => {
|
|
1449
1449
|
e.clients.forEach((t) => {
|
|
1450
1450
|
t.sort((r, i) => r.clock - i.clock);
|
|
1451
1451
|
let n, s;
|
|
@@ -1455,25 +1455,25 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
|
|
|
1455
1455
|
}
|
|
1456
1456
|
t.length = s;
|
|
1457
1457
|
});
|
|
1458
|
-
},
|
|
1458
|
+
}, pn = (e) => {
|
|
1459
1459
|
const t = new $t();
|
|
1460
1460
|
for (let n = 0; n < e.length; n++)
|
|
1461
1461
|
e[n].clients.forEach((s, r) => {
|
|
1462
1462
|
if (!t.clients.has(r)) {
|
|
1463
1463
|
const i = s.slice();
|
|
1464
1464
|
for (let o = n + 1; o < e.length; o++)
|
|
1465
|
-
|
|
1465
|
+
Ci(i, e[o].clients.get(r) || []);
|
|
1466
1466
|
t.clients.set(r, i);
|
|
1467
1467
|
}
|
|
1468
1468
|
});
|
|
1469
|
-
return
|
|
1469
|
+
return Vn(t), t;
|
|
1470
1470
|
}, Wt = (e, t, n, s) => {
|
|
1471
1471
|
K(e.clients, t, () => (
|
|
1472
1472
|
/** @type {Array<DeleteItem>} */
|
|
1473
1473
|
[]
|
|
1474
1474
|
)).push(new He(n, s));
|
|
1475
|
-
},
|
|
1476
|
-
const t =
|
|
1475
|
+
}, Ec = () => new $t(), Dc = (e) => {
|
|
1476
|
+
const t = Ec();
|
|
1477
1477
|
return e.clients.forEach((n, s) => {
|
|
1478
1478
|
const r = [];
|
|
1479
1479
|
for (let i = 0; i < n.length; i++) {
|
|
@@ -1499,7 +1499,7 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
|
|
|
1499
1499
|
e.writeDsClock(o.clock), e.writeDsLen(o.len);
|
|
1500
1500
|
}
|
|
1501
1501
|
});
|
|
1502
|
-
},
|
|
1502
|
+
}, jn = (e) => {
|
|
1503
1503
|
const t = new $t(), n = b(e.restDecoder);
|
|
1504
1504
|
for (let s = 0; s < n; s++) {
|
|
1505
1505
|
e.resetDsCurVal();
|
|
@@ -1514,7 +1514,7 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
|
|
|
1514
1514
|
}
|
|
1515
1515
|
}
|
|
1516
1516
|
return t;
|
|
1517
|
-
},
|
|
1517
|
+
}, gs = (e, t, n) => {
|
|
1518
1518
|
const s = new $t(), r = b(e.restDecoder);
|
|
1519
1519
|
for (let i = 0; i < r; i++) {
|
|
1520
1520
|
e.resetDsCurVal();
|
|
@@ -1531,22 +1531,22 @@ const Ot = (e, t, n) => t.clients.forEach((s, r) => {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
}
|
|
1533
1533
|
if (s.clients.size > 0) {
|
|
1534
|
-
const i = new
|
|
1534
|
+
const i = new gt();
|
|
1535
1535
|
return m(i.restEncoder, 0), Bt(i, s), i.toUint8Array();
|
|
1536
1536
|
}
|
|
1537
1537
|
return null;
|
|
1538
|
-
},
|
|
1539
|
-
class yt extends
|
|
1538
|
+
}, yr = Vs;
|
|
1539
|
+
class yt extends Dn {
|
|
1540
1540
|
/**
|
|
1541
1541
|
* @param {DocOpts} opts configuration
|
|
1542
1542
|
*/
|
|
1543
|
-
constructor({ guid: t =
|
|
1544
|
-
super(), this.gc = s, this.gcFilter = r, this.clientID =
|
|
1543
|
+
constructor({ guid: t = io(), collectionid: n = null, gc: s = !0, gcFilter: r = () => !0, meta: i = null, autoLoad: o = !1, shouldLoad: c = !0 } = {}) {
|
|
1544
|
+
super(), this.gc = s, this.gcFilter = r, this.clientID = yr(), this.guid = t, this.collectionid = n, this.share = /* @__PURE__ */ new Map(), this.store = new Tr(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = c, this.autoLoad = o, this.meta = i, this.isLoaded = !1, this.isSynced = !1, this.isDestroyed = !1, this.whenLoaded = hs((a) => {
|
|
1545
1545
|
this.on("load", () => {
|
|
1546
1546
|
this.isLoaded = !0, a(this);
|
|
1547
1547
|
});
|
|
1548
1548
|
});
|
|
1549
|
-
const l = () =>
|
|
1549
|
+
const l = () => hs((a) => {
|
|
1550
1550
|
const h = (d) => {
|
|
1551
1551
|
(d === void 0 || d === !0) && (this.off("sync", h), a());
|
|
1552
1552
|
};
|
|
@@ -1707,7 +1707,7 @@ class yt extends Cn {
|
|
|
1707
1707
|
* @public
|
|
1708
1708
|
*/
|
|
1709
1709
|
getXmlFragment(t = "") {
|
|
1710
|
-
return this.get(t,
|
|
1710
|
+
return this.get(t, pt);
|
|
1711
1711
|
}
|
|
1712
1712
|
/**
|
|
1713
1713
|
* Converts the entire document into a js object, recursively traversing each yjs type
|
|
@@ -1749,7 +1749,7 @@ class yt extends Cn {
|
|
|
1749
1749
|
this.emit("destroyed", [!0]), this.emit("destroy", [this]), super.destroy();
|
|
1750
1750
|
}
|
|
1751
1751
|
}
|
|
1752
|
-
class
|
|
1752
|
+
class br {
|
|
1753
1753
|
/**
|
|
1754
1754
|
* @param {decoding.Decoder} decoder
|
|
1755
1755
|
*/
|
|
@@ -1771,7 +1771,7 @@ class yr {
|
|
|
1771
1771
|
return b(this.restDecoder);
|
|
1772
1772
|
}
|
|
1773
1773
|
}
|
|
1774
|
-
class
|
|
1774
|
+
class kr extends br {
|
|
1775
1775
|
/**
|
|
1776
1776
|
* @return {ID}
|
|
1777
1777
|
*/
|
|
@@ -1801,7 +1801,7 @@ class br extends yr {
|
|
|
1801
1801
|
* @return {string}
|
|
1802
1802
|
*/
|
|
1803
1803
|
readString() {
|
|
1804
|
-
return
|
|
1804
|
+
return it(this.restDecoder);
|
|
1805
1805
|
}
|
|
1806
1806
|
/**
|
|
1807
1807
|
* @return {boolean} isKey
|
|
@@ -1833,7 +1833,7 @@ class br extends yr {
|
|
|
1833
1833
|
* @return {Uint8Array}
|
|
1834
1834
|
*/
|
|
1835
1835
|
readBuf() {
|
|
1836
|
-
return
|
|
1836
|
+
return vo(O(this.restDecoder));
|
|
1837
1837
|
}
|
|
1838
1838
|
/**
|
|
1839
1839
|
* Legacy implementation uses JSON parse. We use any-decoding in v2.
|
|
@@ -1841,16 +1841,16 @@ class br extends yr {
|
|
|
1841
1841
|
* @return {any}
|
|
1842
1842
|
*/
|
|
1843
1843
|
readJSON() {
|
|
1844
|
-
return JSON.parse(
|
|
1844
|
+
return JSON.parse(it(this.restDecoder));
|
|
1845
1845
|
}
|
|
1846
1846
|
/**
|
|
1847
1847
|
* @return {string}
|
|
1848
1848
|
*/
|
|
1849
1849
|
readKey() {
|
|
1850
|
-
return
|
|
1850
|
+
return it(this.restDecoder);
|
|
1851
1851
|
}
|
|
1852
1852
|
}
|
|
1853
|
-
class
|
|
1853
|
+
class Ac {
|
|
1854
1854
|
/**
|
|
1855
1855
|
* @param {decoding.Decoder} decoder
|
|
1856
1856
|
*/
|
|
@@ -1874,12 +1874,12 @@ class Dc {
|
|
|
1874
1874
|
return this.dsCurrVal += t, t;
|
|
1875
1875
|
}
|
|
1876
1876
|
}
|
|
1877
|
-
class Nt extends
|
|
1877
|
+
class Nt extends Ac {
|
|
1878
1878
|
/**
|
|
1879
1879
|
* @param {decoding.Decoder} decoder
|
|
1880
1880
|
*/
|
|
1881
1881
|
constructor(t) {
|
|
1882
|
-
super(t), this.keys = [], b(t), this.keyClockDecoder = new
|
|
1882
|
+
super(t), this.keys = [], b(t), this.keyClockDecoder = new Ze(O(t)), this.clientDecoder = new de(O(t)), this.leftClockDecoder = new Ze(O(t)), this.rightClockDecoder = new Ze(O(t)), this.infoDecoder = new as(O(t), Lt), this.stringDecoder = new no(O(t)), this.parentInfoDecoder = new as(O(t), Lt), this.typeRefDecoder = new de(O(t)), this.lenDecoder = new de(O(t));
|
|
1883
1883
|
}
|
|
1884
1884
|
/**
|
|
1885
1885
|
* @return {ID}
|
|
@@ -1970,7 +1970,7 @@ class Nt extends Dc {
|
|
|
1970
1970
|
}
|
|
1971
1971
|
}
|
|
1972
1972
|
}
|
|
1973
|
-
class
|
|
1973
|
+
class _r {
|
|
1974
1974
|
constructor() {
|
|
1975
1975
|
this.restEncoder = N();
|
|
1976
1976
|
}
|
|
@@ -1992,7 +1992,7 @@ class kr {
|
|
|
1992
1992
|
m(this.restEncoder, t);
|
|
1993
1993
|
}
|
|
1994
1994
|
}
|
|
1995
|
-
class ne extends
|
|
1995
|
+
class ne extends _r {
|
|
1996
1996
|
/**
|
|
1997
1997
|
* @param {ID} id
|
|
1998
1998
|
*/
|
|
@@ -2016,13 +2016,13 @@ class ne extends kr {
|
|
|
2016
2016
|
* @param {number} info An unsigned 8-bit integer
|
|
2017
2017
|
*/
|
|
2018
2018
|
writeInfo(t) {
|
|
2019
|
-
|
|
2019
|
+
un(this.restEncoder, t);
|
|
2020
2020
|
}
|
|
2021
2021
|
/**
|
|
2022
2022
|
* @param {string} s
|
|
2023
2023
|
*/
|
|
2024
2024
|
writeString(t) {
|
|
2025
|
-
|
|
2025
|
+
ft(this.restEncoder, t);
|
|
2026
2026
|
}
|
|
2027
2027
|
/**
|
|
2028
2028
|
* @param {boolean} isYKey
|
|
@@ -2060,16 +2060,16 @@ class ne extends kr {
|
|
|
2060
2060
|
* @param {any} embed
|
|
2061
2061
|
*/
|
|
2062
2062
|
writeJSON(t) {
|
|
2063
|
-
|
|
2063
|
+
ft(this.restEncoder, JSON.stringify(t));
|
|
2064
2064
|
}
|
|
2065
2065
|
/**
|
|
2066
2066
|
* @param {string} key
|
|
2067
2067
|
*/
|
|
2068
2068
|
writeKey(t) {
|
|
2069
|
-
|
|
2069
|
+
ft(this.restEncoder, t);
|
|
2070
2070
|
}
|
|
2071
2071
|
}
|
|
2072
|
-
class
|
|
2072
|
+
class Sr {
|
|
2073
2073
|
constructor() {
|
|
2074
2074
|
this.restEncoder = N(), this.dsCurrVal = 0;
|
|
2075
2075
|
}
|
|
@@ -2093,9 +2093,9 @@ class _r {
|
|
|
2093
2093
|
t === 0 && j(), m(this.restEncoder, t - 1), this.dsCurrVal += t;
|
|
2094
2094
|
}
|
|
2095
2095
|
}
|
|
2096
|
-
class
|
|
2096
|
+
class gt extends Sr {
|
|
2097
2097
|
constructor() {
|
|
2098
|
-
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new
|
|
2098
|
+
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Qe(), this.clientEncoder = new ue(), this.leftClockEncoder = new Qe(), this.rightClockEncoder = new Qe(), this.infoEncoder = new os(un), this.stringEncoder = new Yi(), this.parentInfoEncoder = new os(un), this.typeRefEncoder = new ue(), this.lenEncoder = new ue();
|
|
2099
2099
|
}
|
|
2100
2100
|
toUint8Array() {
|
|
2101
2101
|
const t = N();
|
|
@@ -2186,7 +2186,7 @@ class dt extends _r {
|
|
|
2186
2186
|
n === void 0 ? (this.keyClockEncoder.write(this.keyClock++), this.stringEncoder.write(t)) : this.keyClockEncoder.write(n);
|
|
2187
2187
|
}
|
|
2188
2188
|
}
|
|
2189
|
-
const
|
|
2189
|
+
const Tc = (e, t, n, s) => {
|
|
2190
2190
|
s = mt(s, t[0].id.clock);
|
|
2191
2191
|
const r = G(t, s);
|
|
2192
2192
|
m(e.restEncoder, t.length - r), e.writeClient(n), m(e.restEncoder, s);
|
|
@@ -2194,14 +2194,14 @@ const Ac = (e, t, n, s) => {
|
|
|
2194
2194
|
i.write(e, s - i.id.clock);
|
|
2195
2195
|
for (let o = r + 1; o < t.length; o++)
|
|
2196
2196
|
t[o].write(e, 0);
|
|
2197
|
-
},
|
|
2197
|
+
}, Hn = (e, t, n) => {
|
|
2198
2198
|
const s = /* @__PURE__ */ new Map();
|
|
2199
2199
|
n.forEach((r, i) => {
|
|
2200
2200
|
A(t, i) > r && s.set(i, r);
|
|
2201
2201
|
}), ze(t).forEach((r, i) => {
|
|
2202
2202
|
n.has(i) || s.set(i, 0);
|
|
2203
2203
|
}), m(e.restEncoder, s.size), q(s.entries()).sort((r, i) => i[0] - r[0]).forEach(([r, i]) => {
|
|
2204
|
-
|
|
2204
|
+
Tc(
|
|
2205
2205
|
e,
|
|
2206
2206
|
/** @type {Array<GC|Item>} */
|
|
2207
2207
|
t.clients.get(r),
|
|
@@ -2209,7 +2209,7 @@ const Ac = (e, t, n, s) => {
|
|
|
2209
2209
|
i
|
|
2210
2210
|
);
|
|
2211
2211
|
});
|
|
2212
|
-
},
|
|
2212
|
+
}, xc = (e, t) => {
|
|
2213
2213
|
const n = $(), s = b(e.restDecoder);
|
|
2214
2214
|
for (let r = 0; r < s; r++) {
|
|
2215
2215
|
const i = b(e.restDecoder), o = new Array(i), c = e.readClient();
|
|
@@ -2243,7 +2243,7 @@ const Ac = (e, t, n, s) => {
|
|
|
2243
2243
|
// parent
|
|
2244
2244
|
d && (h & zt) === zt ? e.readString() : null,
|
|
2245
2245
|
// parentSub
|
|
2246
|
-
|
|
2246
|
+
Wr(e, h)
|
|
2247
2247
|
// item content
|
|
2248
2248
|
);
|
|
2249
2249
|
o[a] = u, l += u.length;
|
|
@@ -2252,7 +2252,7 @@ const Ac = (e, t, n, s) => {
|
|
|
2252
2252
|
}
|
|
2253
2253
|
}
|
|
2254
2254
|
return n;
|
|
2255
|
-
},
|
|
2255
|
+
}, Ic = (e, t, n) => {
|
|
2256
2256
|
const s = [];
|
|
2257
2257
|
let r = q(n.keys()).sort((f, g) => f - g);
|
|
2258
2258
|
if (r.length === 0)
|
|
@@ -2275,7 +2275,7 @@ const Ac = (e, t, n, s) => {
|
|
|
2275
2275
|
let o = i();
|
|
2276
2276
|
if (o === null)
|
|
2277
2277
|
return null;
|
|
2278
|
-
const c = new
|
|
2278
|
+
const c = new Tr(), l = /* @__PURE__ */ new Map(), a = (f, g) => {
|
|
2279
2279
|
const w = l.get(f);
|
|
2280
2280
|
(w == null || w > g) && l.set(f, g);
|
|
2281
2281
|
};
|
|
@@ -2333,14 +2333,14 @@ const Ac = (e, t, n, s) => {
|
|
|
2333
2333
|
}
|
|
2334
2334
|
}
|
|
2335
2335
|
if (c.clients.size > 0) {
|
|
2336
|
-
const f = new
|
|
2337
|
-
return
|
|
2336
|
+
const f = new gt();
|
|
2337
|
+
return Hn(f, c, /* @__PURE__ */ new Map()), m(f.restEncoder, 0), { missing: l, update: f.toUint8Array() };
|
|
2338
2338
|
}
|
|
2339
2339
|
return null;
|
|
2340
|
-
},
|
|
2340
|
+
}, Lc = (e, t) => Hn(e, t.doc.store, t.beforeState), vc = (e, t, n, s = new Nt(e)) => _(t, (r) => {
|
|
2341
2341
|
r.local = !1;
|
|
2342
2342
|
let i = !1;
|
|
2343
|
-
const o = r.doc, c = o.store, l =
|
|
2343
|
+
const o = r.doc, c = o.store, l = xc(s, o), a = Ic(r, c, l), h = c.pendingStructs;
|
|
2344
2344
|
if (h) {
|
|
2345
2345
|
for (const [u, f] of h.missing)
|
|
2346
2346
|
if (f < A(c, u)) {
|
|
@@ -2356,11 +2356,11 @@ const Ac = (e, t, n, s) => {
|
|
|
2356
2356
|
}
|
|
2357
2357
|
} else
|
|
2358
2358
|
c.pendingStructs = a;
|
|
2359
|
-
const d =
|
|
2359
|
+
const d = gs(s, r, c);
|
|
2360
2360
|
if (c.pendingDs) {
|
|
2361
|
-
const u = new Nt(
|
|
2361
|
+
const u = new Nt(ht(c.pendingDs));
|
|
2362
2362
|
b(u.restDecoder);
|
|
2363
|
-
const f =
|
|
2363
|
+
const f = gs(u, r, c);
|
|
2364
2364
|
d && f ? c.pendingDs = Ce([d, f]) : c.pendingDs = d || f;
|
|
2365
2365
|
} else
|
|
2366
2366
|
c.pendingDs = d;
|
|
@@ -2369,43 +2369,43 @@ const Ac = (e, t, n, s) => {
|
|
|
2369
2369
|
/** @type {{update: Uint8Array}} */
|
|
2370
2370
|
c.pendingStructs.update
|
|
2371
2371
|
);
|
|
2372
|
-
c.pendingStructs = null,
|
|
2373
|
-
}
|
|
2374
|
-
}, n, !1),
|
|
2375
|
-
const r =
|
|
2376
|
-
|
|
2377
|
-
},
|
|
2378
|
-
|
|
2379
|
-
},
|
|
2380
|
-
const s =
|
|
2381
|
-
|
|
2372
|
+
c.pendingStructs = null, Cr(r.doc, u);
|
|
2373
|
+
}
|
|
2374
|
+
}, n, !1), Cr = (e, t, n, s = Nt) => {
|
|
2375
|
+
const r = ht(t);
|
|
2376
|
+
vc(r, e, n, new s(r));
|
|
2377
|
+
}, Oc = (e, t, n) => Cr(e, t, n, kr), Nc = (e, t, n = /* @__PURE__ */ new Map()) => {
|
|
2378
|
+
Hn(e, t.store, n), Bt(e, Dc(t.store));
|
|
2379
|
+
}, Mc = (e, t = new Uint8Array([0]), n = new gt()) => {
|
|
2380
|
+
const s = Er(t);
|
|
2381
|
+
Nc(n, e, s);
|
|
2382
2382
|
const r = [n.toUint8Array()];
|
|
2383
|
-
if (e.store.pendingDs && r.push(e.store.pendingDs), e.store.pendingStructs && r.push(
|
|
2383
|
+
if (e.store.pendingDs && r.push(e.store.pendingDs), e.store.pendingStructs && r.push(Qc(e.store.pendingStructs.update, t)), r.length > 1) {
|
|
2384
2384
|
if (n.constructor === ne)
|
|
2385
|
-
return
|
|
2386
|
-
if (n.constructor ===
|
|
2385
|
+
return Xc(r.map((i, o) => o === 0 ? i : tl(i)));
|
|
2386
|
+
if (n.constructor === gt)
|
|
2387
2387
|
return Ce(r);
|
|
2388
2388
|
}
|
|
2389
2389
|
return r[0];
|
|
2390
|
-
},
|
|
2390
|
+
}, Uc = (e, t) => Mc(e, t, new ne()), Rc = (e) => {
|
|
2391
2391
|
const t = /* @__PURE__ */ new Map(), n = b(e.restDecoder);
|
|
2392
2392
|
for (let s = 0; s < n; s++) {
|
|
2393
2393
|
const r = b(e.restDecoder), i = b(e.restDecoder);
|
|
2394
2394
|
t.set(r, i);
|
|
2395
2395
|
}
|
|
2396
2396
|
return t;
|
|
2397
|
-
},
|
|
2397
|
+
}, Er = (e) => Rc(new br(ht(e))), Dr = (e, t) => (m(e.restEncoder, t.size), q(t.entries()).sort((n, s) => s[0] - n[0]).forEach(([n, s]) => {
|
|
2398
2398
|
m(e.restEncoder, n), m(e.restEncoder, s);
|
|
2399
|
-
}), e),
|
|
2400
|
-
class
|
|
2399
|
+
}), e), $c = (e, t) => Dr(e, ze(t.store)), Bc = (e, t = new Sr()) => (e instanceof Map ? Dr(t, e) : $c(t, e), t.toUint8Array()), Fc = (e) => Bc(e, new _r());
|
|
2400
|
+
class Vc {
|
|
2401
2401
|
constructor() {
|
|
2402
2402
|
this.l = [];
|
|
2403
2403
|
}
|
|
2404
2404
|
}
|
|
2405
|
-
const
|
|
2405
|
+
const ps = () => new Vc(), ws = (e, t) => e.l.push(t), ms = (e, t) => {
|
|
2406
2406
|
const n = e.l, s = n.length;
|
|
2407
2407
|
e.l = n.filter((r) => t !== r), s === e.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
|
|
2408
|
-
},
|
|
2408
|
+
}, Ar = (e, t, n) => Mn(e.l, [t, n]);
|
|
2409
2409
|
class At {
|
|
2410
2410
|
/**
|
|
2411
2411
|
* @param {number} client client id
|
|
@@ -2415,7 +2415,7 @@ class At {
|
|
|
2415
2415
|
this.client = t, this.clock = n;
|
|
2416
2416
|
}
|
|
2417
2417
|
}
|
|
2418
|
-
const ce = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, k = (e, t) => new At(e, t),
|
|
2418
|
+
const ce = (e, t) => e === t || e !== null && t !== null && e.client === t.client && e.clock === t.clock, k = (e, t) => new At(e, t), jc = (e) => {
|
|
2419
2419
|
for (const [t, n] of e.doc.share.entries())
|
|
2420
2420
|
if (n === e)
|
|
2421
2421
|
return t;
|
|
@@ -2428,14 +2428,14 @@ const ce = (e, t) => e === t || e !== null && t !== null && e.client === t.clien
|
|
|
2428
2428
|
t.parent._item;
|
|
2429
2429
|
}
|
|
2430
2430
|
return !1;
|
|
2431
|
-
}, _t = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !ee(t.ds, e.id),
|
|
2432
|
-
const n = K(e.meta,
|
|
2431
|
+
}, _t = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !ee(t.ds, e.id), wn = (e, t) => {
|
|
2432
|
+
const n = K(e.meta, wn, ot), s = e.doc.store;
|
|
2433
2433
|
n.has(t) || (t.sv.forEach((r, i) => {
|
|
2434
2434
|
r < A(s, i) && R(e, k(i, r));
|
|
2435
2435
|
}), Ot(e, t.ds, (r) => {
|
|
2436
2436
|
}), n.add(t));
|
|
2437
2437
|
};
|
|
2438
|
-
class
|
|
2438
|
+
class Tr {
|
|
2439
2439
|
constructor() {
|
|
2440
2440
|
this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
|
|
2441
2441
|
}
|
|
@@ -2452,7 +2452,7 @@ const ze = (e) => {
|
|
|
2452
2452
|
return 0;
|
|
2453
2453
|
const s = n[n.length - 1];
|
|
2454
2454
|
return s.id.clock + s.length;
|
|
2455
|
-
},
|
|
2455
|
+
}, xr = (e, t) => {
|
|
2456
2456
|
let n = e.clients.get(t.id.client);
|
|
2457
2457
|
if (n === void 0)
|
|
2458
2458
|
n = [], e.clients.set(t.id.client, n);
|
|
@@ -2477,13 +2477,13 @@ const ze = (e) => {
|
|
|
2477
2477
|
o = z((n + s) / 2);
|
|
2478
2478
|
}
|
|
2479
2479
|
throw j();
|
|
2480
|
-
},
|
|
2480
|
+
}, Hc = (e, t) => {
|
|
2481
2481
|
const n = e.clients.get(t.client);
|
|
2482
2482
|
return n[G(n, t.clock)];
|
|
2483
2483
|
}, fe = (
|
|
2484
2484
|
/** @type {function(StructStore,ID):Item} */
|
|
2485
|
-
|
|
2486
|
-
),
|
|
2485
|
+
Hc
|
|
2486
|
+
), mn = (e, t, n) => {
|
|
2487
2487
|
const s = G(t, n), r = t[s];
|
|
2488
2488
|
return r.id.clock < n && r instanceof S ? (t.splice(s + 1, 0, xe(e, r, n - r.id.clock)), s + 1) : s;
|
|
2489
2489
|
}, R = (e, t) => {
|
|
@@ -2491,26 +2491,26 @@ const ze = (e) => {
|
|
|
2491
2491
|
/** @type {Array<Item>} */
|
|
2492
2492
|
e.doc.store.clients.get(t.client)
|
|
2493
2493
|
);
|
|
2494
|
-
return n[
|
|
2495
|
-
},
|
|
2494
|
+
return n[mn(e, n, t.clock)];
|
|
2495
|
+
}, ys = (e, t, n) => {
|
|
2496
2496
|
const s = t.clients.get(n.client), r = G(s, n.clock), i = s[r];
|
|
2497
2497
|
return n.clock !== i.id.clock + i.length - 1 && i.constructor !== F && s.splice(r + 1, 0, xe(e, i, n.clock - i.id.clock + 1)), i;
|
|
2498
|
-
},
|
|
2498
|
+
}, zc = (e, t, n) => {
|
|
2499
2499
|
const s = (
|
|
2500
2500
|
/** @type {Array<GC|Item>} */
|
|
2501
2501
|
e.clients.get(t.id.client)
|
|
2502
2502
|
);
|
|
2503
2503
|
s[G(s, t.id.clock)] = n;
|
|
2504
|
-
},
|
|
2504
|
+
}, Ir = (e, t, n, s, r) => {
|
|
2505
2505
|
if (s === 0)
|
|
2506
2506
|
return;
|
|
2507
2507
|
const i = n + s;
|
|
2508
|
-
let o =
|
|
2508
|
+
let o = mn(e, t, n), c;
|
|
2509
2509
|
do
|
|
2510
|
-
c = t[o++], i < c.id.clock + c.length &&
|
|
2510
|
+
c = t[o++], i < c.id.clock + c.length && mn(e, t, i), r(c);
|
|
2511
2511
|
while (o < t.length && t[o].id.clock < i);
|
|
2512
2512
|
};
|
|
2513
|
-
class
|
|
2513
|
+
class Pc {
|
|
2514
2514
|
/**
|
|
2515
2515
|
* @param {Doc} doc
|
|
2516
2516
|
* @param {any} origin
|
|
@@ -2520,9 +2520,9 @@ class zc {
|
|
|
2520
2520
|
this.doc = t, this.deleteSet = new $t(), this.beforeState = ze(t.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = n, this.meta = /* @__PURE__ */ new Map(), this.local = s, this.subdocsAdded = /* @__PURE__ */ new Set(), this.subdocsRemoved = /* @__PURE__ */ new Set(), this.subdocsLoaded = /* @__PURE__ */ new Set(), this._needFormattingCleanup = !1;
|
|
2521
2521
|
}
|
|
2522
2522
|
}
|
|
2523
|
-
const
|
|
2523
|
+
const bs = (e, t) => t.deleteSet.clients.size === 0 && !Si(t.afterState, (n, s) => t.beforeState.get(s) !== n) ? !1 : (Vn(t.deleteSet), Lc(e, t), Bt(e, t.deleteSet), !0), ks = (e, t, n) => {
|
|
2524
2524
|
const s = t._item;
|
|
2525
|
-
(s === null || s.id.clock < (e.beforeState.get(s.id.client) || 0) && !s.deleted) && K(e.changed, t,
|
|
2525
|
+
(s === null || s.id.clock < (e.beforeState.get(s.id.client) || 0) && !s.deleted) && K(e.changed, t, ot).add(n);
|
|
2526
2526
|
}, ge = (e, t) => {
|
|
2527
2527
|
let n = e[t], s = e[t - 1], r = t;
|
|
2528
2528
|
for (; r > 0; n = s, s = e[--r - 1]) {
|
|
@@ -2539,7 +2539,7 @@ const ys = (e, t) => t.deleteSet.clients.size === 0 && !_i(t.afterState, (n, s)
|
|
|
2539
2539
|
}
|
|
2540
2540
|
const i = t - r;
|
|
2541
2541
|
return i && e.splice(t + 1 - i, i), i;
|
|
2542
|
-
},
|
|
2542
|
+
}, Yc = (e, t, n) => {
|
|
2543
2543
|
for (const [s, r] of e.clients.entries()) {
|
|
2544
2544
|
const i = (
|
|
2545
2545
|
/** @type {Array<GC|Item>} */
|
|
@@ -2555,23 +2555,23 @@ const ys = (e, t) => t.deleteSet.clients.size === 0 && !_i(t.afterState, (n, s)
|
|
|
2555
2555
|
}
|
|
2556
2556
|
}
|
|
2557
2557
|
}
|
|
2558
|
-
},
|
|
2558
|
+
}, Gc = (e, t) => {
|
|
2559
2559
|
e.clients.forEach((n, s) => {
|
|
2560
2560
|
const r = (
|
|
2561
2561
|
/** @type {Array<GC|Item>} */
|
|
2562
2562
|
t.clients.get(s)
|
|
2563
2563
|
);
|
|
2564
2564
|
for (let i = n.length - 1; i >= 0; i--) {
|
|
2565
|
-
const o = n[i], c =
|
|
2565
|
+
const o = n[i], c = An(r.length - 1, 1 + G(r, o.clock + o.len - 1));
|
|
2566
2566
|
for (let l = c, a = r[l]; l > 0 && a.id.clock >= o.clock; a = r[l])
|
|
2567
2567
|
l -= 1 + ge(r, l);
|
|
2568
2568
|
}
|
|
2569
2569
|
});
|
|
2570
|
-
},
|
|
2570
|
+
}, Lr = (e, t) => {
|
|
2571
2571
|
if (t < e.length) {
|
|
2572
2572
|
const n = e[t], s = n.doc, r = s.store, i = n.deleteSet, o = n._mergeStructs;
|
|
2573
2573
|
try {
|
|
2574
|
-
|
|
2574
|
+
Vn(i), n.afterState = ze(n.doc.store), s.emit("beforeObserverCalls", [n, s]);
|
|
2575
2575
|
const c = [];
|
|
2576
2576
|
n.changed.forEach(
|
|
2577
2577
|
(l, a) => c.push(() => {
|
|
@@ -2584,14 +2584,14 @@ const ys = (e, t) => t.deleteSet.clients.size === 0 && !_i(t.afterState, (n, s)
|
|
|
2584
2584
|
(h) => h.target._item === null || !h.target._item.deleted
|
|
2585
2585
|
), l.forEach((h) => {
|
|
2586
2586
|
h.currentTarget = a, h._path = null;
|
|
2587
|
-
}), l.sort((h, d) => h.path.length - d.path.length),
|
|
2587
|
+
}), l.sort((h, d) => h.path.length - d.path.length), Ar(a._dEH, l, n);
|
|
2588
2588
|
});
|
|
2589
2589
|
}), c.push(() => s.emit("afterTransaction", [n, s])), c.push(() => {
|
|
2590
|
-
n._needFormattingCleanup &&
|
|
2590
|
+
n._needFormattingCleanup && gl(n);
|
|
2591
2591
|
});
|
|
2592
|
-
}),
|
|
2592
|
+
}), Mn(c, []);
|
|
2593
2593
|
} finally {
|
|
2594
|
-
s.gc &&
|
|
2594
|
+
s.gc && Yc(i, r, s.gcFilter), Gc(i, r), n.afterState.forEach((h, d) => {
|
|
2595
2595
|
const u = n.beforeState.get(d) || 0;
|
|
2596
2596
|
if (u !== h) {
|
|
2597
2597
|
const f = (
|
|
@@ -2609,35 +2609,35 @@ const ys = (e, t) => t.deleteSet.clients.size === 0 && !_i(t.afterState, (n, s)
|
|
|
2609
2609
|
), g = G(f, u);
|
|
2610
2610
|
g + 1 < f.length && ge(f, g + 1) > 1 || g > 0 && ge(f, g);
|
|
2611
2611
|
}
|
|
2612
|
-
if (!n.local && n.afterState.get(s.clientID) !== n.beforeState.get(s.clientID) && (
|
|
2612
|
+
if (!n.local && n.afterState.get(s.clientID) !== n.beforeState.get(s.clientID) && (_c(Fn, ur, "[yjs] ", dr, fr, "Changed the client-id because another client seems to be using it."), s.clientID = yr()), s.emit("afterTransactionCleanup", [n, s]), s._observers.has("update")) {
|
|
2613
2613
|
const h = new ne();
|
|
2614
|
-
|
|
2614
|
+
bs(h, n) && s.emit("update", [h.toUint8Array(), n.origin, s, n]);
|
|
2615
2615
|
}
|
|
2616
2616
|
if (s._observers.has("updateV2")) {
|
|
2617
|
-
const h = new
|
|
2618
|
-
|
|
2617
|
+
const h = new gt();
|
|
2618
|
+
bs(h, n) && s.emit("updateV2", [h.toUint8Array(), n.origin, s, n]);
|
|
2619
2619
|
}
|
|
2620
2620
|
const { subdocsAdded: c, subdocsLoaded: l, subdocsRemoved: a } = n;
|
|
2621
2621
|
(c.size > 0 || a.size > 0 || l.size > 0) && (c.forEach((h) => {
|
|
2622
2622
|
h.clientID = s.clientID, h.collectionid == null && (h.collectionid = s.collectionid), s.subdocs.add(h);
|
|
2623
|
-
}), a.forEach((h) => s.subdocs.delete(h)), s.emit("subdocs", [{ loaded: l, added: c, removed: a }, s, n]), a.forEach((h) => h.destroy())), e.length <= t + 1 ? (s._transactionCleanups = [], s.emit("afterAllTransactions", [s, e])) :
|
|
2623
|
+
}), a.forEach((h) => s.subdocs.delete(h)), s.emit("subdocs", [{ loaded: l, added: c, removed: a }, s, n]), a.forEach((h) => h.destroy())), e.length <= t + 1 ? (s._transactionCleanups = [], s.emit("afterAllTransactions", [s, e])) : Lr(e, t + 1);
|
|
2624
2624
|
}
|
|
2625
2625
|
}
|
|
2626
2626
|
}, _ = (e, t, n = null, s = !0) => {
|
|
2627
2627
|
const r = e._transactionCleanups;
|
|
2628
2628
|
let i = !1, o = null;
|
|
2629
|
-
e._transaction === null && (i = !0, e._transaction = new
|
|
2629
|
+
e._transaction === null && (i = !0, e._transaction = new Pc(e, n, s), r.push(e._transaction), r.length === 1 && e.emit("beforeAllTransactions", [e]), e.emit("beforeTransaction", [e._transaction, e]));
|
|
2630
2630
|
try {
|
|
2631
2631
|
o = t(e._transaction);
|
|
2632
2632
|
} finally {
|
|
2633
2633
|
if (i) {
|
|
2634
2634
|
const c = e._transaction === r[0];
|
|
2635
|
-
e._transaction = null, c &&
|
|
2635
|
+
e._transaction = null, c && Lr(r, 0);
|
|
2636
2636
|
}
|
|
2637
2637
|
}
|
|
2638
2638
|
return o;
|
|
2639
2639
|
};
|
|
2640
|
-
class
|
|
2640
|
+
class Jc {
|
|
2641
2641
|
/**
|
|
2642
2642
|
* @param {DeleteSet} deletions
|
|
2643
2643
|
* @param {DeleteSet} insertions
|
|
@@ -2646,15 +2646,15 @@ class Gc {
|
|
|
2646
2646
|
this.insertions = n, this.deletions = t, this.meta = /* @__PURE__ */ new Map();
|
|
2647
2647
|
}
|
|
2648
2648
|
}
|
|
2649
|
-
const
|
|
2649
|
+
const _s = (e, t, n) => {
|
|
2650
2650
|
Ot(e, n.deletions, (s) => {
|
|
2651
2651
|
s instanceof S && t.scope.some((r) => r === e.doc || Se(
|
|
2652
2652
|
/** @type {AbstractType<any>} */
|
|
2653
2653
|
r,
|
|
2654
2654
|
s
|
|
2655
|
-
)) &&
|
|
2655
|
+
)) && Xn(s, !1);
|
|
2656
2656
|
});
|
|
2657
|
-
},
|
|
2657
|
+
}, Ss = (e, t, n) => {
|
|
2658
2658
|
let s = null;
|
|
2659
2659
|
const r = e.doc, i = e.scope;
|
|
2660
2660
|
_(r, (c) => {
|
|
@@ -2667,7 +2667,7 @@ const ks = (e, t, n) => {
|
|
|
2667
2667
|
Ot(c, a.insertions, (f) => {
|
|
2668
2668
|
if (f instanceof S) {
|
|
2669
2669
|
if (f.redone !== null) {
|
|
2670
|
-
let { item: g, diff: w } =
|
|
2670
|
+
let { item: g, diff: w } = jl(l, f.id);
|
|
2671
2671
|
w > 0 && (g = R(c, k(g.id.client, g.id.clock + w))), f = g;
|
|
2672
2672
|
}
|
|
2673
2673
|
!f.deleted && i.some((g) => g === c.doc || Se(
|
|
@@ -2685,7 +2685,7 @@ const ks = (e, t, n) => {
|
|
|
2685
2685
|
)) && // Never redo structs in stackItem.insertions because they were created and deleted in the same capture interval.
|
|
2686
2686
|
!ee(a.insertions, f.id) && h.add(f);
|
|
2687
2687
|
}), h.forEach((f) => {
|
|
2688
|
-
u =
|
|
2688
|
+
u = Kr(c, f, h, a.insertions, e.ignoreRemoteMapChanges, e) !== null || u;
|
|
2689
2689
|
});
|
|
2690
2690
|
for (let f = d.length - 1; f >= 0; f--) {
|
|
2691
2691
|
const g = d[f];
|
|
@@ -2704,7 +2704,7 @@ const ks = (e, t, n) => {
|
|
|
2704
2704
|
}
|
|
2705
2705
|
return o;
|
|
2706
2706
|
};
|
|
2707
|
-
class
|
|
2707
|
+
class Kc extends Dn {
|
|
2708
2708
|
/**
|
|
2709
2709
|
* @param {Doc|AbstractType<any>|Array<AbstractType<any>>} typeScope Limits the scope of the UndoManager. If this is set to a ydoc instance, all changes on that ydoc will be undone. If set to a specific type, only changes on that type or its children will be undone. Also accepts an array of types.
|
|
2710
2710
|
* @param {UndoManagerOptions} options
|
|
@@ -2733,13 +2733,13 @@ class Jc extends Cn {
|
|
|
2733
2733
|
const v = l.beforeState.get(y) || 0, Vt = p - v;
|
|
2734
2734
|
Vt > 0 && Wt(u, y, v, Vt);
|
|
2735
2735
|
});
|
|
2736
|
-
const f =
|
|
2736
|
+
const f = ct();
|
|
2737
2737
|
let g = !1;
|
|
2738
2738
|
if (this.lastChange > 0 && f - this.lastChange < this.captureTimeout && d.length > 0 && !a && !h) {
|
|
2739
2739
|
const p = d[d.length - 1];
|
|
2740
|
-
p.deletions =
|
|
2740
|
+
p.deletions = pn([p.deletions, l.deleteSet]), p.insertions = pn([p.insertions, u]);
|
|
2741
2741
|
} else
|
|
2742
|
-
d.push(new
|
|
2742
|
+
d.push(new Jc(l.deleteSet, u)), g = !0;
|
|
2743
2743
|
!a && !h && (this.lastChange = f), Ot(
|
|
2744
2744
|
l,
|
|
2745
2745
|
l.deleteSet,
|
|
@@ -2749,7 +2749,7 @@ class Jc extends Cn {
|
|
|
2749
2749
|
/** @type {AbstractType<any>} */
|
|
2750
2750
|
y,
|
|
2751
2751
|
p
|
|
2752
|
-
)) &&
|
|
2752
|
+
)) && Xn(p, !0);
|
|
2753
2753
|
}
|
|
2754
2754
|
);
|
|
2755
2755
|
const w = [{ stackItem: d[d.length - 1], origin: l.origin, type: a ? "redo" : "undo", changedParentTypes: l.changedParentTypes }, this];
|
|
@@ -2764,7 +2764,7 @@ class Jc extends Cn {
|
|
|
2764
2764
|
addToScope(t) {
|
|
2765
2765
|
const n = new Set(this.scope);
|
|
2766
2766
|
t = It(t) ? t : [t], t.forEach((s) => {
|
|
2767
|
-
n.has(s) || (n.add(s), (s instanceof I ? s.doc !== this.doc : s !== this.doc) &&
|
|
2767
|
+
n.has(s) || (n.add(s), (s instanceof I ? s.doc !== this.doc : s !== this.doc) && pr("[yjs#509] Not same Y.Doc"), this.scope.push(s));
|
|
2768
2768
|
});
|
|
2769
2769
|
}
|
|
2770
2770
|
/**
|
|
@@ -2781,7 +2781,7 @@ class Jc extends Cn {
|
|
|
2781
2781
|
}
|
|
2782
2782
|
clear(t = !0, n = !0) {
|
|
2783
2783
|
(t && this.canUndo() || n && this.canRedo()) && this.doc.transact((s) => {
|
|
2784
|
-
t && (this.undoStack.forEach((r) =>
|
|
2784
|
+
t && (this.undoStack.forEach((r) => _s(s, this, r)), this.undoStack = []), n && (this.redoStack.forEach((r) => _s(s, this, r)), this.redoStack = []), this.emit("stack-cleared", [{ undoStackCleared: t, redoStackCleared: n }]);
|
|
2785
2785
|
});
|
|
2786
2786
|
}
|
|
2787
2787
|
/**
|
|
@@ -2816,7 +2816,7 @@ class Jc extends Cn {
|
|
|
2816
2816
|
this.undoing = !0;
|
|
2817
2817
|
let t;
|
|
2818
2818
|
try {
|
|
2819
|
-
t =
|
|
2819
|
+
t = Ss(this, this.undoStack, "undo");
|
|
2820
2820
|
} finally {
|
|
2821
2821
|
this.undoing = !1;
|
|
2822
2822
|
}
|
|
@@ -2831,7 +2831,7 @@ class Jc extends Cn {
|
|
|
2831
2831
|
this.redoing = !0;
|
|
2832
2832
|
let t;
|
|
2833
2833
|
try {
|
|
2834
|
-
t =
|
|
2834
|
+
t = Ss(this, this.redoStack, "redo");
|
|
2835
2835
|
} finally {
|
|
2836
2836
|
this.redoing = !1;
|
|
2837
2837
|
}
|
|
@@ -2857,7 +2857,7 @@ class Jc extends Cn {
|
|
|
2857
2857
|
this.trackedOrigins.delete(this), this.doc.off("afterTransaction", this.afterTransactionHandler), this.doc.off("destroy", this.destroy), super.destroy();
|
|
2858
2858
|
}
|
|
2859
2859
|
}
|
|
2860
|
-
function*
|
|
2860
|
+
function* Wc(e) {
|
|
2861
2861
|
const t = b(e.restDecoder);
|
|
2862
2862
|
for (let n = 0; n < t; n++) {
|
|
2863
2863
|
const s = b(e.restDecoder), r = e.readClient();
|
|
@@ -2883,7 +2883,7 @@ function* Kc(e) {
|
|
|
2883
2883
|
// parent
|
|
2884
2884
|
l && (c & zt) === zt ? e.readString() : null,
|
|
2885
2885
|
// parentSub
|
|
2886
|
-
|
|
2886
|
+
Wr(e, c)
|
|
2887
2887
|
// item content
|
|
2888
2888
|
);
|
|
2889
2889
|
yield a, i += a.length;
|
|
@@ -2894,13 +2894,13 @@ function* Kc(e) {
|
|
|
2894
2894
|
}
|
|
2895
2895
|
}
|
|
2896
2896
|
}
|
|
2897
|
-
class
|
|
2897
|
+
class zn {
|
|
2898
2898
|
/**
|
|
2899
2899
|
* @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
|
|
2900
2900
|
* @param {boolean} filterSkips
|
|
2901
2901
|
*/
|
|
2902
2902
|
constructor(t, n) {
|
|
2903
|
-
this.gen =
|
|
2903
|
+
this.gen = Wc(t), this.curr = null, this.done = !1, this.filterSkips = n, this.next();
|
|
2904
2904
|
}
|
|
2905
2905
|
/**
|
|
2906
2906
|
* @return {Item | GC | Skip |null}
|
|
@@ -2912,7 +2912,7 @@ class jn {
|
|
|
2912
2912
|
return this.curr;
|
|
2913
2913
|
}
|
|
2914
2914
|
}
|
|
2915
|
-
class
|
|
2915
|
+
class Pn {
|
|
2916
2916
|
/**
|
|
2917
2917
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
2918
2918
|
*/
|
|
@@ -2920,7 +2920,7 @@ class Hn {
|
|
|
2920
2920
|
this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = t, this.clientStructs = [];
|
|
2921
2921
|
}
|
|
2922
2922
|
}
|
|
2923
|
-
const
|
|
2923
|
+
const Xc = (e) => Ce(e, kr, ne), qc = (e, t) => {
|
|
2924
2924
|
if (e.constructor === F) {
|
|
2925
2925
|
const { client: n, clock: s } = e.id;
|
|
2926
2926
|
return new F(k(n, s + t), e.length - t);
|
|
@@ -2943,12 +2943,12 @@ const Wc = (e) => Ce(e, br, ne), Xc = (e, t) => {
|
|
|
2943
2943
|
n.content.splice(t)
|
|
2944
2944
|
);
|
|
2945
2945
|
}
|
|
2946
|
-
}, Ce = (e, t = Nt, n =
|
|
2946
|
+
}, Ce = (e, t = Nt, n = gt) => {
|
|
2947
2947
|
if (e.length === 1)
|
|
2948
2948
|
return e[0];
|
|
2949
|
-
const s = e.map((h) => new t(
|
|
2950
|
-
let r = s.map((h) => new
|
|
2951
|
-
const o = new n(), c = new
|
|
2949
|
+
const s = e.map((h) => new t(ht(h)));
|
|
2950
|
+
let r = s.map((h) => new zn(h, !0)), i = null;
|
|
2951
|
+
const o = new n(), c = new Pn(o);
|
|
2952
2952
|
for (; r = r.filter((u) => u.curr !== null), r.sort(
|
|
2953
2953
|
/** @type {function(any,any):number} */
|
|
2954
2954
|
(u, f) => {
|
|
@@ -2975,21 +2975,21 @@ const Wc = (e) => Ce(e, br, ne), Xc = (e, t) => {
|
|
|
2975
2975
|
f && u.id.clock > i.struct.id.clock + i.struct.length)
|
|
2976
2976
|
continue;
|
|
2977
2977
|
if (d !== i.struct.id.client)
|
|
2978
|
-
|
|
2978
|
+
st(c, i.struct, i.offset), i = { struct: u, offset: 0 }, h.next();
|
|
2979
2979
|
else if (i.struct.id.clock + i.struct.length < u.id.clock)
|
|
2980
2980
|
if (i.struct.constructor === V)
|
|
2981
2981
|
i.struct.length = u.id.clock + u.length - i.struct.id.clock;
|
|
2982
2982
|
else {
|
|
2983
|
-
|
|
2983
|
+
st(c, i.struct, i.offset);
|
|
2984
2984
|
const g = u.id.clock - i.struct.id.clock - i.struct.length;
|
|
2985
2985
|
i = { struct: new V(k(d, i.struct.id.clock + i.struct.length), g), offset: 0 };
|
|
2986
2986
|
}
|
|
2987
2987
|
else {
|
|
2988
2988
|
const g = i.struct.id.clock + i.struct.length - u.id.clock;
|
|
2989
|
-
g > 0 && (i.struct.constructor === V ? i.struct.length -= g : u =
|
|
2989
|
+
g > 0 && (i.struct.constructor === V ? i.struct.length -= g : u = qc(u, g)), i.struct.mergeWith(
|
|
2990
2990
|
/** @type {any} */
|
|
2991
2991
|
u
|
|
2992
|
-
) || (
|
|
2992
|
+
) || (st(c, i.struct, i.offset), i = { struct: u, offset: 0 }, h.next());
|
|
2993
2993
|
}
|
|
2994
2994
|
} else
|
|
2995
2995
|
i = { struct: (
|
|
@@ -2997,13 +2997,13 @@ const Wc = (e) => Ce(e, br, ne), Xc = (e, t) => {
|
|
|
2997
2997
|
h.curr
|
|
2998
2998
|
), offset: 0 }, h.next();
|
|
2999
2999
|
for (let u = h.curr; u !== null && u.id.client === d && u.id.clock === i.struct.id.clock + i.struct.length && u.constructor !== V; u = h.next())
|
|
3000
|
-
|
|
3000
|
+
st(c, i.struct, i.offset), i = { struct: u, offset: 0 };
|
|
3001
3001
|
}
|
|
3002
|
-
i !== null && (
|
|
3003
|
-
const l = s.map((h) =>
|
|
3002
|
+
i !== null && (st(c, i.struct, i.offset), i = null), Yn(c);
|
|
3003
|
+
const l = s.map((h) => jn(h)), a = pn(l);
|
|
3004
3004
|
return Bt(o, a), o.toUint8Array();
|
|
3005
|
-
},
|
|
3006
|
-
const r =
|
|
3005
|
+
}, Qc = (e, t, n = Nt, s = gt) => {
|
|
3006
|
+
const r = Er(t), i = new s(), o = new Pn(i), c = new n(ht(e)), l = new zn(c, !1);
|
|
3007
3007
|
for (; l.curr; ) {
|
|
3008
3008
|
const h = l.curr, d = h.id.client, u = r.get(d) || 0;
|
|
3009
3009
|
if (l.curr.constructor === V) {
|
|
@@ -3011,35 +3011,35 @@ const Wc = (e) => Ce(e, br, ne), Xc = (e, t) => {
|
|
|
3011
3011
|
continue;
|
|
3012
3012
|
}
|
|
3013
3013
|
if (h.id.clock + h.length > u)
|
|
3014
|
-
for (
|
|
3015
|
-
|
|
3014
|
+
for (st(o, h, mt(u - h.id.clock, 0)), l.next(); l.curr && l.curr.id.client === d; )
|
|
3015
|
+
st(o, l.curr, 0), l.next();
|
|
3016
3016
|
else
|
|
3017
3017
|
for (; l.curr && l.curr.id.client === d && l.curr.id.clock + l.curr.length <= u; )
|
|
3018
3018
|
l.next();
|
|
3019
3019
|
}
|
|
3020
|
-
|
|
3021
|
-
const a =
|
|
3020
|
+
Yn(o);
|
|
3021
|
+
const a = jn(c);
|
|
3022
3022
|
return Bt(i, a), i.toUint8Array();
|
|
3023
|
-
},
|
|
3023
|
+
}, vr = (e) => {
|
|
3024
3024
|
e.written > 0 && (e.clientStructs.push({ written: e.written, restEncoder: C(e.encoder.restEncoder) }), e.encoder.restEncoder = N(), e.written = 0);
|
|
3025
|
-
},
|
|
3026
|
-
e.written > 0 && e.currClient !== t.id.client &&
|
|
3027
|
-
},
|
|
3028
|
-
|
|
3025
|
+
}, st = (e, t, n) => {
|
|
3026
|
+
e.written > 0 && e.currClient !== t.id.client && vr(e), e.written === 0 && (e.currClient = t.id.client, e.encoder.writeClient(t.id.client), m(e.encoder.restEncoder, t.id.clock + n)), t.write(e.encoder, n), e.written++;
|
|
3027
|
+
}, Yn = (e) => {
|
|
3028
|
+
vr(e);
|
|
3029
3029
|
const t = e.encoder.restEncoder;
|
|
3030
3030
|
m(t, e.clientStructs.length);
|
|
3031
3031
|
for (let n = 0; n < e.clientStructs.length; n++) {
|
|
3032
3032
|
const s = e.clientStructs[n];
|
|
3033
3033
|
m(t, s.written), Ne(t, s.restEncoder);
|
|
3034
3034
|
}
|
|
3035
|
-
},
|
|
3036
|
-
const r = new n(
|
|
3035
|
+
}, Zc = (e, t, n, s) => {
|
|
3036
|
+
const r = new n(ht(e)), i = new zn(r, !1), o = new s(), c = new Pn(o);
|
|
3037
3037
|
for (let a = i.curr; a !== null; a = i.next())
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
const l =
|
|
3038
|
+
st(c, t(a), 0);
|
|
3039
|
+
Yn(c);
|
|
3040
|
+
const l = jn(r);
|
|
3041
3041
|
return Bt(o, l), o.toUint8Array();
|
|
3042
|
-
},
|
|
3042
|
+
}, tl = (e) => Zc(e, yo, Nt, ne), Cs = "You must not compute changes after the event-handler fired.";
|
|
3043
3043
|
class Pe {
|
|
3044
3044
|
/**
|
|
3045
3045
|
* @param {T} target The changed type.
|
|
@@ -3062,7 +3062,7 @@ class Pe {
|
|
|
3062
3062
|
* type === event.target // => true
|
|
3063
3063
|
*/
|
|
3064
3064
|
get path() {
|
|
3065
|
-
return this._path || (this._path =
|
|
3065
|
+
return this._path || (this._path = el(this.currentTarget, this.target));
|
|
3066
3066
|
}
|
|
3067
3067
|
/**
|
|
3068
3068
|
* Check if a struct is deleted by this event.
|
|
@@ -3081,7 +3081,7 @@ class Pe {
|
|
|
3081
3081
|
get keys() {
|
|
3082
3082
|
if (this._keys === null) {
|
|
3083
3083
|
if (this.transaction.doc._transactionCleanups.length === 0)
|
|
3084
|
-
throw Y(
|
|
3084
|
+
throw Y(Cs);
|
|
3085
3085
|
const t = /* @__PURE__ */ new Map(), n = this.target;
|
|
3086
3086
|
/** @type Set<string|null> */
|
|
3087
3087
|
this.transaction.changed.get(n).forEach((r) => {
|
|
@@ -3097,13 +3097,13 @@ class Pe {
|
|
|
3097
3097
|
l = l.left;
|
|
3098
3098
|
if (this.deletes(i))
|
|
3099
3099
|
if (l !== null && this.deletes(l))
|
|
3100
|
-
o = "delete", c =
|
|
3100
|
+
o = "delete", c = We(l.content.getContent());
|
|
3101
3101
|
else
|
|
3102
3102
|
return;
|
|
3103
3103
|
else
|
|
3104
|
-
l !== null && this.deletes(l) ? (o = "update", c =
|
|
3104
|
+
l !== null && this.deletes(l) ? (o = "update", c = We(l.content.getContent())) : (o = "add", c = void 0);
|
|
3105
3105
|
} else if (this.deletes(i))
|
|
3106
|
-
o = "delete", c =
|
|
3106
|
+
o = "delete", c = We(
|
|
3107
3107
|
/** @type {Item} */
|
|
3108
3108
|
i.content.getContent()
|
|
3109
3109
|
);
|
|
@@ -3149,8 +3149,8 @@ class Pe {
|
|
|
3149
3149
|
let t = this._changes;
|
|
3150
3150
|
if (t === null) {
|
|
3151
3151
|
if (this.transaction.doc._transactionCleanups.length === 0)
|
|
3152
|
-
throw Y(
|
|
3153
|
-
const n = this.target, s =
|
|
3152
|
+
throw Y(Cs);
|
|
3153
|
+
const n = this.target, s = ot(), r = ot(), i = [];
|
|
3154
3154
|
if (t = {
|
|
3155
3155
|
added: s,
|
|
3156
3156
|
deleted: r,
|
|
@@ -3174,7 +3174,7 @@ class Pe {
|
|
|
3174
3174
|
);
|
|
3175
3175
|
}
|
|
3176
3176
|
}
|
|
3177
|
-
const
|
|
3177
|
+
const el = (e, t) => {
|
|
3178
3178
|
const n = [];
|
|
3179
3179
|
for (; t._item !== null && t !== e; ) {
|
|
3180
3180
|
if (t._item.parentSub !== null)
|
|
@@ -3193,28 +3193,28 @@ const tl = (e, t) => {
|
|
|
3193
3193
|
}
|
|
3194
3194
|
return n;
|
|
3195
3195
|
}, M = () => {
|
|
3196
|
-
|
|
3197
|
-
},
|
|
3198
|
-
let
|
|
3199
|
-
class
|
|
3196
|
+
pr("Invalid access: Add Yjs type to a document before reading data.");
|
|
3197
|
+
}, Or = 80;
|
|
3198
|
+
let Gn = 0;
|
|
3199
|
+
class nl {
|
|
3200
3200
|
/**
|
|
3201
3201
|
* @param {Item} p
|
|
3202
3202
|
* @param {number} index
|
|
3203
3203
|
*/
|
|
3204
3204
|
constructor(t, n) {
|
|
3205
|
-
t.marker = !0, this.p = t, this.index = n, this.timestamp =
|
|
3205
|
+
t.marker = !0, this.p = t, this.index = n, this.timestamp = Gn++;
|
|
3206
3206
|
}
|
|
3207
3207
|
}
|
|
3208
|
-
const
|
|
3209
|
-
e.timestamp =
|
|
3210
|
-
},
|
|
3211
|
-
e.p.marker = !1, e.p = t, t.marker = !0, e.index = n, e.timestamp =
|
|
3212
|
-
},
|
|
3213
|
-
if (e.length >=
|
|
3208
|
+
const sl = (e) => {
|
|
3209
|
+
e.timestamp = Gn++;
|
|
3210
|
+
}, Nr = (e, t, n) => {
|
|
3211
|
+
e.p.marker = !1, e.p = t, t.marker = !0, e.index = n, e.timestamp = Gn++;
|
|
3212
|
+
}, rl = (e, t, n) => {
|
|
3213
|
+
if (e.length >= Or) {
|
|
3214
3214
|
const s = e.reduce((r, i) => r.timestamp < i.timestamp ? r : i);
|
|
3215
|
-
return
|
|
3215
|
+
return Nr(s, t, n), s;
|
|
3216
3216
|
} else {
|
|
3217
|
-
const s = new
|
|
3217
|
+
const s = new nl(t, n);
|
|
3218
3218
|
return e.push(s), s;
|
|
3219
3219
|
}
|
|
3220
3220
|
}, Ye = (e, t) => {
|
|
@@ -3222,7 +3222,7 @@ const nl = (e) => {
|
|
|
3222
3222
|
return null;
|
|
3223
3223
|
const n = e._searchMarker.length === 0 ? null : e._searchMarker.reduce((i, o) => he(t - i.index) < he(t - o.index) ? i : o);
|
|
3224
3224
|
let s = e._start, r = 0;
|
|
3225
|
-
for (n !== null && (s = n.p, r = n.index,
|
|
3225
|
+
for (n !== null && (s = n.p, r = n.index, sl(n)); s.right !== null && r < t; ) {
|
|
3226
3226
|
if (!s.deleted && s.countable) {
|
|
3227
3227
|
if (t < r + s.length)
|
|
3228
3228
|
break;
|
|
@@ -3235,7 +3235,7 @@ const nl = (e) => {
|
|
|
3235
3235
|
for (; s.left !== null && s.left.id.client === s.id.client && s.left.id.clock + s.left.length === s.id.clock; )
|
|
3236
3236
|
s = s.left, !s.deleted && s.countable && (r -= s.length);
|
|
3237
3237
|
return n !== null && he(n.index - r) < /** @type {YText|YArray<any>} */
|
|
3238
|
-
s.parent.length /
|
|
3238
|
+
s.parent.length / Or ? (Nr(n, s, r), n) : rl(e._searchMarker, s, r);
|
|
3239
3239
|
}, Xt = (e, t, n) => {
|
|
3240
3240
|
for (let s = e.length - 1; s >= 0; s--) {
|
|
3241
3241
|
const r = e[s];
|
|
@@ -3256,11 +3256,11 @@ const nl = (e) => {
|
|
|
3256
3256
|
for (; K(r, e, () => []).push(n), e._item !== null; )
|
|
3257
3257
|
e = /** @type {AbstractType<any>} */
|
|
3258
3258
|
e._item.parent;
|
|
3259
|
-
|
|
3259
|
+
Ar(s._eH, n, t);
|
|
3260
3260
|
};
|
|
3261
3261
|
class I {
|
|
3262
3262
|
constructor() {
|
|
3263
|
-
this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH =
|
|
3263
|
+
this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = ps(), this._dEH = ps(), this._searchMarker = null;
|
|
3264
3264
|
}
|
|
3265
3265
|
/**
|
|
3266
3266
|
* @return {AbstractType<any>|null}
|
|
@@ -3330,7 +3330,7 @@ class I {
|
|
|
3330
3330
|
* @param {function(EventType, Transaction):void} f Observer function
|
|
3331
3331
|
*/
|
|
3332
3332
|
observe(t) {
|
|
3333
|
-
|
|
3333
|
+
ws(this._eH, t);
|
|
3334
3334
|
}
|
|
3335
3335
|
/**
|
|
3336
3336
|
* Observe all events that are created by this type and its children.
|
|
@@ -3338,7 +3338,7 @@ class I {
|
|
|
3338
3338
|
* @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
|
|
3339
3339
|
*/
|
|
3340
3340
|
observeDeep(t) {
|
|
3341
|
-
|
|
3341
|
+
ws(this._dEH, t);
|
|
3342
3342
|
}
|
|
3343
3343
|
/**
|
|
3344
3344
|
* Unregister an observer function.
|
|
@@ -3346,7 +3346,7 @@ class I {
|
|
|
3346
3346
|
* @param {function(EventType,Transaction):void} f Observer function
|
|
3347
3347
|
*/
|
|
3348
3348
|
unobserve(t) {
|
|
3349
|
-
|
|
3349
|
+
ms(this._eH, t);
|
|
3350
3350
|
}
|
|
3351
3351
|
/**
|
|
3352
3352
|
* Unregister an observer function.
|
|
@@ -3354,7 +3354,7 @@ class I {
|
|
|
3354
3354
|
* @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
|
|
3355
3355
|
*/
|
|
3356
3356
|
unobserveDeep(t) {
|
|
3357
|
-
|
|
3357
|
+
ms(this._dEH, t);
|
|
3358
3358
|
}
|
|
3359
3359
|
/**
|
|
3360
3360
|
* @abstract
|
|
@@ -3363,7 +3363,7 @@ class I {
|
|
|
3363
3363
|
toJSON() {
|
|
3364
3364
|
}
|
|
3365
3365
|
}
|
|
3366
|
-
const
|
|
3366
|
+
const Mr = (e, t, n) => {
|
|
3367
3367
|
var o;
|
|
3368
3368
|
(o = e.doc) != null || M(), t < 0 && (t = e._length + t), n < 0 && (n = e._length + n);
|
|
3369
3369
|
let s = n - t;
|
|
@@ -3383,7 +3383,7 @@ const Nr = (e, t, n) => {
|
|
|
3383
3383
|
i = i.right;
|
|
3384
3384
|
}
|
|
3385
3385
|
return r;
|
|
3386
|
-
},
|
|
3386
|
+
}, Ur = (e) => {
|
|
3387
3387
|
var s;
|
|
3388
3388
|
(s = e.doc) != null || M();
|
|
3389
3389
|
const t = [];
|
|
@@ -3408,12 +3408,12 @@ const Nr = (e, t, n) => {
|
|
|
3408
3408
|
}
|
|
3409
3409
|
s = s.right;
|
|
3410
3410
|
}
|
|
3411
|
-
},
|
|
3411
|
+
}, Rr = (e, t) => {
|
|
3412
3412
|
const n = [];
|
|
3413
3413
|
return qt(e, (s, r) => {
|
|
3414
3414
|
n.push(t(s, r, e));
|
|
3415
3415
|
}), n;
|
|
3416
|
-
},
|
|
3416
|
+
}, il = (e) => {
|
|
3417
3417
|
let t = e._start, n = null, s = 0;
|
|
3418
3418
|
return {
|
|
3419
3419
|
[Symbol.iterator]() {
|
|
@@ -3437,7 +3437,7 @@ const Nr = (e, t, n) => {
|
|
|
3437
3437
|
};
|
|
3438
3438
|
}
|
|
3439
3439
|
};
|
|
3440
|
-
},
|
|
3440
|
+
}, $r = (e, t) => {
|
|
3441
3441
|
var r;
|
|
3442
3442
|
(r = e.doc) != null || M();
|
|
3443
3443
|
const n = Ye(e, t);
|
|
@@ -3453,7 +3453,7 @@ const Nr = (e, t, n) => {
|
|
|
3453
3453
|
const i = e.doc, o = i.clientID, c = i.store, l = n === null ? t._start : n.right;
|
|
3454
3454
|
let a = [];
|
|
3455
3455
|
const h = () => {
|
|
3456
|
-
a.length > 0 && (r = new S(k(o, A(c, o)), r, r && r.lastId, l, l && l.id, t, null, new
|
|
3456
|
+
a.length > 0 && (r = new S(k(o, A(c, o)), r, r && r.lastId, l, l && l.id, t, null, new wt(a)), r.integrate(e, 0), a = []);
|
|
3457
3457
|
};
|
|
3458
3458
|
s.forEach((d) => {
|
|
3459
3459
|
if (d === null)
|
|
@@ -3484,15 +3484,15 @@ const Nr = (e, t, n) => {
|
|
|
3484
3484
|
break;
|
|
3485
3485
|
default:
|
|
3486
3486
|
if (d instanceof I)
|
|
3487
|
-
r = new S(k(o, A(c, o)), r, r && r.lastId, l, l && l.id, t, null, new
|
|
3487
|
+
r = new S(k(o, A(c, o)), r, r && r.lastId, l, l && l.id, t, null, new nt(d)), r.integrate(e, 0);
|
|
3488
3488
|
else
|
|
3489
3489
|
throw new Error("Unexpected content type in insert operation");
|
|
3490
3490
|
}
|
|
3491
3491
|
}
|
|
3492
3492
|
}), h();
|
|
3493
|
-
},
|
|
3493
|
+
}, Br = () => Y("Length exceeded!"), Fr = (e, t, n, s) => {
|
|
3494
3494
|
if (n > t._length)
|
|
3495
|
-
throw
|
|
3495
|
+
throw Br();
|
|
3496
3496
|
if (n === 0)
|
|
3497
3497
|
return t._searchMarker && Xt(t._searchMarker, n, s.length), Ee(e, t, null, s);
|
|
3498
3498
|
const r = n, i = Ye(t, n);
|
|
@@ -3506,13 +3506,13 @@ const Nr = (e, t, n) => {
|
|
|
3506
3506
|
n -= o.length;
|
|
3507
3507
|
}
|
|
3508
3508
|
return t._searchMarker && Xt(t._searchMarker, r, s.length), Ee(e, t, o, s);
|
|
3509
|
-
},
|
|
3509
|
+
}, ol = (e, t, n) => {
|
|
3510
3510
|
let r = (t._searchMarker || []).reduce((i, o) => o.index > i.index ? o : i, { index: 0, p: t._start }).p;
|
|
3511
3511
|
if (r)
|
|
3512
3512
|
for (; r.right; )
|
|
3513
3513
|
r = r.right;
|
|
3514
3514
|
return Ee(e, t, r, n);
|
|
3515
|
-
},
|
|
3515
|
+
}, Vr = (e, t, n, s) => {
|
|
3516
3516
|
if (s === 0)
|
|
3517
3517
|
return;
|
|
3518
3518
|
const r = n, i = s, o = Ye(t, n);
|
|
@@ -3522,7 +3522,7 @@ const Nr = (e, t, n) => {
|
|
|
3522
3522
|
for (; s > 0 && c !== null; )
|
|
3523
3523
|
c.deleted || (s < c.length && R(e, k(c.id.client, c.id.clock + s)), c.delete(e), s -= c.length), c = c.right;
|
|
3524
3524
|
if (s > 0)
|
|
3525
|
-
throw
|
|
3525
|
+
throw Br();
|
|
3526
3526
|
t._searchMarker && Xt(
|
|
3527
3527
|
t._searchMarker,
|
|
3528
3528
|
r,
|
|
@@ -3532,11 +3532,11 @@ const Nr = (e, t, n) => {
|
|
|
3532
3532
|
}, De = (e, t, n) => {
|
|
3533
3533
|
const s = t._map.get(n);
|
|
3534
3534
|
s !== void 0 && s.delete(e);
|
|
3535
|
-
},
|
|
3535
|
+
}, Jn = (e, t, n, s) => {
|
|
3536
3536
|
const r = t._map.get(n) || null, i = e.doc, o = i.clientID;
|
|
3537
3537
|
let c;
|
|
3538
3538
|
if (s == null)
|
|
3539
|
-
c = new
|
|
3539
|
+
c = new wt([s]);
|
|
3540
3540
|
else
|
|
3541
3541
|
switch (s.constructor) {
|
|
3542
3542
|
case Number:
|
|
@@ -3546,7 +3546,7 @@ const Nr = (e, t, n) => {
|
|
|
3546
3546
|
case String:
|
|
3547
3547
|
case Date:
|
|
3548
3548
|
case BigInt:
|
|
3549
|
-
c = new
|
|
3549
|
+
c = new wt([s]);
|
|
3550
3550
|
break;
|
|
3551
3551
|
case Uint8Array:
|
|
3552
3552
|
c = new se(
|
|
@@ -3562,28 +3562,28 @@ const Nr = (e, t, n) => {
|
|
|
3562
3562
|
break;
|
|
3563
3563
|
default:
|
|
3564
3564
|
if (s instanceof I)
|
|
3565
|
-
c = new
|
|
3565
|
+
c = new nt(s);
|
|
3566
3566
|
else
|
|
3567
3567
|
throw new Error("Unexpected content type");
|
|
3568
3568
|
}
|
|
3569
3569
|
new S(k(o, A(i.store, o)), r, r && r.lastId, null, null, t, n, c).integrate(e, 0);
|
|
3570
|
-
},
|
|
3570
|
+
}, Kn = (e, t) => {
|
|
3571
3571
|
var s;
|
|
3572
3572
|
(s = e.doc) != null || M();
|
|
3573
3573
|
const n = e._map.get(t);
|
|
3574
3574
|
return n !== void 0 && !n.deleted ? n.content.getContent()[n.length - 1] : void 0;
|
|
3575
|
-
},
|
|
3575
|
+
}, jr = (e) => {
|
|
3576
3576
|
var n;
|
|
3577
3577
|
const t = {};
|
|
3578
3578
|
return (n = e.doc) != null || M(), e._map.forEach((s, r) => {
|
|
3579
3579
|
s.deleted || (t[r] = s.content.getContent()[s.length - 1]);
|
|
3580
3580
|
}), t;
|
|
3581
|
-
},
|
|
3581
|
+
}, Hr = (e, t) => {
|
|
3582
3582
|
var s;
|
|
3583
3583
|
(s = e.doc) != null || M();
|
|
3584
3584
|
const n = e._map.get(t);
|
|
3585
3585
|
return n !== void 0 && !n.deleted;
|
|
3586
|
-
},
|
|
3586
|
+
}, cl = (e, t) => {
|
|
3587
3587
|
const n = {};
|
|
3588
3588
|
return e._map.forEach((s, r) => {
|
|
3589
3589
|
let i = s;
|
|
@@ -3593,13 +3593,13 @@ const Nr = (e, t, n) => {
|
|
|
3593
3593
|
}), n;
|
|
3594
3594
|
}, le = (e) => {
|
|
3595
3595
|
var t;
|
|
3596
|
-
return (t = e.doc) != null || M(),
|
|
3596
|
+
return (t = e.doc) != null || M(), Sc(
|
|
3597
3597
|
e._map.entries(),
|
|
3598
3598
|
/** @param {any} entry */
|
|
3599
3599
|
(n) => !n[1].deleted
|
|
3600
3600
|
);
|
|
3601
3601
|
};
|
|
3602
|
-
class
|
|
3602
|
+
class ll extends Pe {
|
|
3603
3603
|
}
|
|
3604
3604
|
class Tt extends I {
|
|
3605
3605
|
constructor() {
|
|
@@ -3665,7 +3665,7 @@ class Tt extends I {
|
|
|
3665
3665
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
3666
3666
|
*/
|
|
3667
3667
|
_callObserver(t, n) {
|
|
3668
|
-
super._callObserver(t, n), Ge(this, t, new
|
|
3668
|
+
super._callObserver(t, n), Ge(this, t, new ll(this, t));
|
|
3669
3669
|
}
|
|
3670
3670
|
/**
|
|
3671
3671
|
* Inserts new content at an index.
|
|
@@ -3685,7 +3685,7 @@ class Tt extends I {
|
|
|
3685
3685
|
*/
|
|
3686
3686
|
insert(t, n) {
|
|
3687
3687
|
this.doc !== null ? _(this.doc, (s) => {
|
|
3688
|
-
|
|
3688
|
+
Fr(
|
|
3689
3689
|
s,
|
|
3690
3690
|
this,
|
|
3691
3691
|
t,
|
|
@@ -3703,7 +3703,7 @@ class Tt extends I {
|
|
|
3703
3703
|
*/
|
|
3704
3704
|
push(t) {
|
|
3705
3705
|
this.doc !== null ? _(this.doc, (n) => {
|
|
3706
|
-
|
|
3706
|
+
ol(
|
|
3707
3707
|
n,
|
|
3708
3708
|
this,
|
|
3709
3709
|
/** @type {any} */
|
|
@@ -3727,7 +3727,7 @@ class Tt extends I {
|
|
|
3727
3727
|
*/
|
|
3728
3728
|
delete(t, n = 1) {
|
|
3729
3729
|
this.doc !== null ? _(this.doc, (s) => {
|
|
3730
|
-
|
|
3730
|
+
Vr(s, this, t, n);
|
|
3731
3731
|
}) : this._prelimContent.splice(t, n);
|
|
3732
3732
|
}
|
|
3733
3733
|
/**
|
|
@@ -3737,7 +3737,7 @@ class Tt extends I {
|
|
|
3737
3737
|
* @return {T}
|
|
3738
3738
|
*/
|
|
3739
3739
|
get(t) {
|
|
3740
|
-
return
|
|
3740
|
+
return $r(this, t);
|
|
3741
3741
|
}
|
|
3742
3742
|
/**
|
|
3743
3743
|
* Transforms this YArray to a JavaScript Array.
|
|
@@ -3745,7 +3745,7 @@ class Tt extends I {
|
|
|
3745
3745
|
* @return {Array<T>}
|
|
3746
3746
|
*/
|
|
3747
3747
|
toArray() {
|
|
3748
|
-
return
|
|
3748
|
+
return Ur(this);
|
|
3749
3749
|
}
|
|
3750
3750
|
/**
|
|
3751
3751
|
* Returns a portion of this YArray into a JavaScript Array selected
|
|
@@ -3756,7 +3756,7 @@ class Tt extends I {
|
|
|
3756
3756
|
* @return {Array<T>}
|
|
3757
3757
|
*/
|
|
3758
3758
|
slice(t = 0, n = this.length) {
|
|
3759
|
-
return
|
|
3759
|
+
return Mr(this, t, n);
|
|
3760
3760
|
}
|
|
3761
3761
|
/**
|
|
3762
3762
|
* Transforms this Shared Type to a JSON object.
|
|
@@ -3776,7 +3776,7 @@ class Tt extends I {
|
|
|
3776
3776
|
* callback function
|
|
3777
3777
|
*/
|
|
3778
3778
|
map(t) {
|
|
3779
|
-
return
|
|
3779
|
+
return Rr(
|
|
3780
3780
|
this,
|
|
3781
3781
|
/** @type {any} */
|
|
3782
3782
|
t
|
|
@@ -3794,17 +3794,17 @@ class Tt extends I {
|
|
|
3794
3794
|
* @return {IterableIterator<T>}
|
|
3795
3795
|
*/
|
|
3796
3796
|
[Symbol.iterator]() {
|
|
3797
|
-
return
|
|
3797
|
+
return il(this);
|
|
3798
3798
|
}
|
|
3799
3799
|
/**
|
|
3800
3800
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
3801
3801
|
*/
|
|
3802
3802
|
_write(t) {
|
|
3803
|
-
t.writeTypeRef(
|
|
3803
|
+
t.writeTypeRef(Nl);
|
|
3804
3804
|
}
|
|
3805
3805
|
}
|
|
3806
|
-
const
|
|
3807
|
-
class
|
|
3806
|
+
const al = (e) => new Tt();
|
|
3807
|
+
class hl extends Pe {
|
|
3808
3808
|
/**
|
|
3809
3809
|
* @param {YMap<T>} ymap The YArray that changed.
|
|
3810
3810
|
* @param {Transaction} transaction
|
|
@@ -3866,7 +3866,7 @@ class Mt extends I {
|
|
|
3866
3866
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
3867
3867
|
*/
|
|
3868
3868
|
_callObserver(t, n) {
|
|
3869
|
-
Ge(this, t, new
|
|
3869
|
+
Ge(this, t, new hl(this, t, n));
|
|
3870
3870
|
}
|
|
3871
3871
|
/**
|
|
3872
3872
|
* Transforms this Shared Type to a JSON object.
|
|
@@ -3898,7 +3898,7 @@ class Mt extends I {
|
|
|
3898
3898
|
* @return {IterableIterator<string>}
|
|
3899
3899
|
*/
|
|
3900
3900
|
keys() {
|
|
3901
|
-
return
|
|
3901
|
+
return nn(
|
|
3902
3902
|
le(this),
|
|
3903
3903
|
/** @param {any} v */
|
|
3904
3904
|
(t) => t[0]
|
|
@@ -3910,7 +3910,7 @@ class Mt extends I {
|
|
|
3910
3910
|
* @return {IterableIterator<MapType>}
|
|
3911
3911
|
*/
|
|
3912
3912
|
values() {
|
|
3913
|
-
return
|
|
3913
|
+
return nn(
|
|
3914
3914
|
le(this),
|
|
3915
3915
|
/** @param {any} v */
|
|
3916
3916
|
(t) => t[1].content.getContent()[t[1].length - 1]
|
|
@@ -3922,7 +3922,7 @@ class Mt extends I {
|
|
|
3922
3922
|
* @return {IterableIterator<[string, MapType]>}
|
|
3923
3923
|
*/
|
|
3924
3924
|
entries() {
|
|
3925
|
-
return
|
|
3925
|
+
return nn(
|
|
3926
3926
|
le(this),
|
|
3927
3927
|
/** @param {any} v */
|
|
3928
3928
|
(t) => (
|
|
@@ -3970,7 +3970,7 @@ class Mt extends I {
|
|
|
3970
3970
|
*/
|
|
3971
3971
|
set(t, n) {
|
|
3972
3972
|
return this.doc !== null ? _(this.doc, (s) => {
|
|
3973
|
-
|
|
3973
|
+
Jn(
|
|
3974
3974
|
s,
|
|
3975
3975
|
this,
|
|
3976
3976
|
t,
|
|
@@ -3988,7 +3988,7 @@ class Mt extends I {
|
|
|
3988
3988
|
get(t) {
|
|
3989
3989
|
return (
|
|
3990
3990
|
/** @type {any} */
|
|
3991
|
-
|
|
3991
|
+
Kn(this, t)
|
|
3992
3992
|
);
|
|
3993
3993
|
}
|
|
3994
3994
|
/**
|
|
@@ -3998,7 +3998,7 @@ class Mt extends I {
|
|
|
3998
3998
|
* @return {boolean}
|
|
3999
3999
|
*/
|
|
4000
4000
|
has(t) {
|
|
4001
|
-
return
|
|
4001
|
+
return Hr(this, t);
|
|
4002
4002
|
}
|
|
4003
4003
|
/**
|
|
4004
4004
|
* Removes all elements from this YMap.
|
|
@@ -4014,11 +4014,11 @@ class Mt extends I {
|
|
|
4014
4014
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
4015
4015
|
*/
|
|
4016
4016
|
_write(t) {
|
|
4017
|
-
t.writeTypeRef(
|
|
4017
|
+
t.writeTypeRef(Ml);
|
|
4018
4018
|
}
|
|
4019
4019
|
}
|
|
4020
|
-
const
|
|
4021
|
-
class
|
|
4020
|
+
const ul = (e) => new Mt(), rt = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && wo(e, t);
|
|
4021
|
+
class yn {
|
|
4022
4022
|
/**
|
|
4023
4023
|
* @param {Item|null} left
|
|
4024
4024
|
* @param {Item|null} right
|
|
@@ -4039,7 +4039,7 @@ class mn {
|
|
|
4039
4039
|
) : this.right.deleted || (this.index += this.right.length), this.left = this.right, this.right = this.right.right;
|
|
4040
4040
|
}
|
|
4041
4041
|
}
|
|
4042
|
-
const
|
|
4042
|
+
const Es = (e, t, n) => {
|
|
4043
4043
|
for (; t.right !== null && n > 0; )
|
|
4044
4044
|
t.right.content.constructor === T ? t.right.deleted || Ft(
|
|
4045
4045
|
t.currentAttributes,
|
|
@@ -4050,14 +4050,14 @@ const Cs = (e, t, n) => {
|
|
|
4050
4050
|
}, ae = (e, t, n, s) => {
|
|
4051
4051
|
const r = /* @__PURE__ */ new Map(), i = s ? Ye(t, n) : null;
|
|
4052
4052
|
if (i) {
|
|
4053
|
-
const o = new
|
|
4054
|
-
return
|
|
4053
|
+
const o = new yn(i.p.left, i.p, i.index, r);
|
|
4054
|
+
return Es(e, o, n - i.index);
|
|
4055
4055
|
} else {
|
|
4056
|
-
const o = new
|
|
4057
|
-
return
|
|
4056
|
+
const o = new yn(null, t._start, 0, r);
|
|
4057
|
+
return Es(e, o, n);
|
|
4058
4058
|
}
|
|
4059
|
-
},
|
|
4060
|
-
for (; n.right !== null && (n.right.deleted === !0 || n.right.content.constructor === T &&
|
|
4059
|
+
}, zr = (e, t, n, s) => {
|
|
4060
|
+
for (; n.right !== null && (n.right.deleted === !0 || n.right.content.constructor === T && rt(
|
|
4061
4061
|
s.get(
|
|
4062
4062
|
/** @type {ContentFormat} */
|
|
4063
4063
|
n.right.content.key
|
|
@@ -4077,10 +4077,10 @@ const Cs = (e, t, n) => {
|
|
|
4077
4077
|
}, Ft = (e, t) => {
|
|
4078
4078
|
const { key: n, value: s } = t;
|
|
4079
4079
|
s === null ? e.delete(n) : e.set(n, s);
|
|
4080
|
-
},
|
|
4080
|
+
}, Pr = (e, t) => {
|
|
4081
4081
|
var n;
|
|
4082
4082
|
for (; e.right !== null; ) {
|
|
4083
|
-
if (!(e.right.deleted || e.right.content.constructor === T &&
|
|
4083
|
+
if (!(e.right.deleted || e.right.content.constructor === T && rt(
|
|
4084
4084
|
(n = t[
|
|
4085
4085
|
/** @type {ContentFormat} */
|
|
4086
4086
|
e.right.content.key
|
|
@@ -4090,34 +4090,34 @@ const Cs = (e, t, n) => {
|
|
|
4090
4090
|
))) break;
|
|
4091
4091
|
e.forward();
|
|
4092
4092
|
}
|
|
4093
|
-
},
|
|
4093
|
+
}, Yr = (e, t, n, s) => {
|
|
4094
4094
|
var c;
|
|
4095
4095
|
const r = e.doc, i = r.clientID, o = /* @__PURE__ */ new Map();
|
|
4096
4096
|
for (const l in s) {
|
|
4097
4097
|
const a = s[l], h = (c = n.currentAttributes.get(l)) != null ? c : null;
|
|
4098
|
-
if (!
|
|
4098
|
+
if (!rt(h, a)) {
|
|
4099
4099
|
o.set(l, h);
|
|
4100
4100
|
const { left: d, right: u } = n;
|
|
4101
4101
|
n.right = new S(k(i, A(r.store, i)), d, d && d.lastId, u, u && u.id, t, null, new T(l, a)), n.right.integrate(e, 0), n.forward();
|
|
4102
4102
|
}
|
|
4103
4103
|
}
|
|
4104
4104
|
return o;
|
|
4105
|
-
},
|
|
4105
|
+
}, sn = (e, t, n, s, r) => {
|
|
4106
4106
|
n.currentAttributes.forEach((u, f) => {
|
|
4107
4107
|
r[f] === void 0 && (r[f] = null);
|
|
4108
4108
|
});
|
|
4109
4109
|
const i = e.doc, o = i.clientID;
|
|
4110
|
-
|
|
4111
|
-
const c =
|
|
4110
|
+
Pr(n, r);
|
|
4111
|
+
const c = Yr(e, t, n, r), l = s.constructor === String ? new J(
|
|
4112
4112
|
/** @type {string} */
|
|
4113
4113
|
s
|
|
4114
|
-
) : s instanceof I ? new
|
|
4114
|
+
) : s instanceof I ? new nt(s) : new bt(s);
|
|
4115
4115
|
let { left: a, right: h, index: d } = n;
|
|
4116
|
-
t._searchMarker && Xt(t._searchMarker, n.index, l.getLength()), h = new S(k(o, A(i.store, o)), a, a && a.lastId, h, h && h.id, t, null, l), h.integrate(e, 0), n.right = h, n.index = d, n.forward(),
|
|
4117
|
-
},
|
|
4116
|
+
t._searchMarker && Xt(t._searchMarker, n.index, l.getLength()), h = new S(k(o, A(i.store, o)), a, a && a.lastId, h, h && h.id, t, null, l), h.integrate(e, 0), n.right = h, n.index = d, n.forward(), zr(e, t, n, c);
|
|
4117
|
+
}, Ds = (e, t, n, s, r) => {
|
|
4118
4118
|
const i = e.doc, o = i.clientID;
|
|
4119
|
-
|
|
4120
|
-
const c =
|
|
4119
|
+
Pr(n, r);
|
|
4120
|
+
const c = Yr(e, t, n, r);
|
|
4121
4121
|
t: for (; n.right !== null && (s > 0 || c.size > 0 && (n.right.deleted || n.right.content.constructor === T)); ) {
|
|
4122
4122
|
if (!n.right.deleted)
|
|
4123
4123
|
switch (n.right.content.constructor) {
|
|
@@ -4127,7 +4127,7 @@ const Cs = (e, t, n) => {
|
|
|
4127
4127
|
n.right.content
|
|
4128
4128
|
), h = r[l];
|
|
4129
4129
|
if (h !== void 0) {
|
|
4130
|
-
if (
|
|
4130
|
+
if (rt(h, a))
|
|
4131
4131
|
c.delete(l);
|
|
4132
4132
|
else {
|
|
4133
4133
|
if (s === 0)
|
|
@@ -4152,8 +4152,8 @@ const Cs = (e, t, n) => {
|
|
|
4152
4152
|
`;
|
|
4153
4153
|
n.right = new S(k(o, A(i.store, o)), n.left, n.left && n.left.lastId, n.right, n.right && n.right.id, t, null, new J(l)), n.right.integrate(e, 0), n.forward();
|
|
4154
4154
|
}
|
|
4155
|
-
|
|
4156
|
-
},
|
|
4155
|
+
zr(e, t, n, c);
|
|
4156
|
+
}, Gr = (e, t, n, s, r) => {
|
|
4157
4157
|
var a, h;
|
|
4158
4158
|
let i = t;
|
|
4159
4159
|
const o = $();
|
|
@@ -4187,7 +4187,7 @@ const Cs = (e, t, n) => {
|
|
|
4187
4187
|
t.right;
|
|
4188
4188
|
}
|
|
4189
4189
|
return c;
|
|
4190
|
-
},
|
|
4190
|
+
}, dl = (e, t) => {
|
|
4191
4191
|
for (; t && t.right && (t.right.deleted || !t.right.countable); )
|
|
4192
4192
|
t = t.right;
|
|
4193
4193
|
const n = /* @__PURE__ */ new Set();
|
|
@@ -4201,7 +4201,7 @@ const Cs = (e, t, n) => {
|
|
|
4201
4201
|
}
|
|
4202
4202
|
t = t.left;
|
|
4203
4203
|
}
|
|
4204
|
-
},
|
|
4204
|
+
}, fl = (e) => {
|
|
4205
4205
|
let t = 0;
|
|
4206
4206
|
return _(
|
|
4207
4207
|
/** @type {Doc} */
|
|
@@ -4211,20 +4211,20 @@ const Cs = (e, t, n) => {
|
|
|
4211
4211
|
/** @type {Item} */
|
|
4212
4212
|
e._start
|
|
4213
4213
|
), r = e._start, i = $();
|
|
4214
|
-
const o =
|
|
4214
|
+
const o = an(i);
|
|
4215
4215
|
for (; r; )
|
|
4216
4216
|
r.deleted === !1 && (r.content.constructor === T ? Ft(
|
|
4217
4217
|
o,
|
|
4218
4218
|
/** @type {ContentFormat} */
|
|
4219
4219
|
r.content
|
|
4220
|
-
) : (t +=
|
|
4220
|
+
) : (t += Gr(n, s, r, i, o), i = an(o), s = r)), r = r.right;
|
|
4221
4221
|
}
|
|
4222
4222
|
), t;
|
|
4223
|
-
},
|
|
4223
|
+
}, gl = (e) => {
|
|
4224
4224
|
const t = /* @__PURE__ */ new Set(), n = e.doc;
|
|
4225
4225
|
for (const [s, r] of e.afterState.entries()) {
|
|
4226
4226
|
const i = e.beforeState.get(s) || 0;
|
|
4227
|
-
r !== i &&
|
|
4227
|
+
r !== i && Ir(
|
|
4228
4228
|
e,
|
|
4229
4229
|
/** @type {Array<Item|GC>} */
|
|
4230
4230
|
n.store.clients.get(s),
|
|
@@ -4251,17 +4251,17 @@ const Cs = (e, t, n) => {
|
|
|
4251
4251
|
/** @type {YText} */
|
|
4252
4252
|
r.parent
|
|
4253
4253
|
);
|
|
4254
|
-
r.content.constructor === T ? t.add(i) :
|
|
4254
|
+
r.content.constructor === T ? t.add(i) : dl(s, r);
|
|
4255
4255
|
});
|
|
4256
4256
|
for (const r of t)
|
|
4257
|
-
|
|
4257
|
+
fl(r);
|
|
4258
4258
|
});
|
|
4259
|
-
},
|
|
4260
|
-
const s = n, r =
|
|
4259
|
+
}, As = (e, t, n) => {
|
|
4260
|
+
const s = n, r = an(t.currentAttributes), i = t.right;
|
|
4261
4261
|
for (; n > 0 && t.right !== null; ) {
|
|
4262
4262
|
if (t.right.deleted === !1)
|
|
4263
4263
|
switch (t.right.content.constructor) {
|
|
4264
|
-
case
|
|
4264
|
+
case nt:
|
|
4265
4265
|
case bt:
|
|
4266
4266
|
case J:
|
|
4267
4267
|
n < t.right.length && R(e, k(t.right.id.client, t.right.id.clock + n)), n -= t.right.length, t.right.delete(e);
|
|
@@ -4269,7 +4269,7 @@ const Cs = (e, t, n) => {
|
|
|
4269
4269
|
}
|
|
4270
4270
|
t.forward();
|
|
4271
4271
|
}
|
|
4272
|
-
i &&
|
|
4272
|
+
i && Gr(e, i, t.right, r, t.currentAttributes);
|
|
4273
4273
|
const o = (
|
|
4274
4274
|
/** @type {AbstractType<any>} */
|
|
4275
4275
|
/** @type {Item} */
|
|
@@ -4277,7 +4277,7 @@ const Cs = (e, t, n) => {
|
|
|
4277
4277
|
);
|
|
4278
4278
|
return o._searchMarker && Xt(o._searchMarker, t.index, -s + n), t;
|
|
4279
4279
|
};
|
|
4280
|
-
class
|
|
4280
|
+
class pl extends Pe {
|
|
4281
4281
|
/**
|
|
4282
4282
|
* @param {YText} ytext
|
|
4283
4283
|
* @param {Transaction} transaction
|
|
@@ -4339,7 +4339,7 @@ class gl extends Pe {
|
|
|
4339
4339
|
}))), a = "";
|
|
4340
4340
|
break;
|
|
4341
4341
|
case "retain":
|
|
4342
|
-
h > 0 && (p = { retain: h },
|
|
4342
|
+
h > 0 && (p = { retain: h }, po(l) || (p.attributes = ho({}, l))), h = 0;
|
|
4343
4343
|
break;
|
|
4344
4344
|
}
|
|
4345
4345
|
p && n.push(p), c = null;
|
|
@@ -4347,7 +4347,7 @@ class gl extends Pe {
|
|
|
4347
4347
|
};
|
|
4348
4348
|
for (; o !== null; ) {
|
|
4349
4349
|
switch (o.content.constructor) {
|
|
4350
|
-
case
|
|
4350
|
+
case nt:
|
|
4351
4351
|
case bt:
|
|
4352
4352
|
this.adds(o) ? this.deletes(o) || (u(), c = "insert", a = o.content.getContent()[0], u()) : this.deletes(o) ? (c !== "delete" && (u(), c = "delete"), d += 1) : o.deleted || (c !== "retain" && (u(), c = "retain"), h += 1);
|
|
4353
4353
|
break;
|
|
@@ -4363,16 +4363,16 @@ class gl extends Pe {
|
|
|
4363
4363
|
if (this.adds(o)) {
|
|
4364
4364
|
if (!this.deletes(o)) {
|
|
4365
4365
|
const v = (f = r.get(p)) != null ? f : null;
|
|
4366
|
-
|
|
4366
|
+
rt(v, y) ? y !== null && o.delete(s) : (c === "retain" && u(), rt(y, (g = i.get(p)) != null ? g : null) ? delete l[p] : l[p] = y);
|
|
4367
4367
|
}
|
|
4368
4368
|
} else if (this.deletes(o)) {
|
|
4369
4369
|
i.set(p, y);
|
|
4370
4370
|
const v = (w = r.get(p)) != null ? w : null;
|
|
4371
|
-
|
|
4371
|
+
rt(v, y) || (c === "retain" && u(), l[p] = v);
|
|
4372
4372
|
} else if (!o.deleted) {
|
|
4373
4373
|
i.set(p, y);
|
|
4374
4374
|
const v = l[p];
|
|
4375
|
-
v !== void 0 && (
|
|
4375
|
+
v !== void 0 && (rt(v, y) ? v !== null && o.delete(s) : (c === "retain" && u(), y === null ? delete l[p] : l[p] = y));
|
|
4376
4376
|
}
|
|
4377
4377
|
o.deleted || (c === "insert" && u(), Ft(
|
|
4378
4378
|
r,
|
|
@@ -4450,7 +4450,7 @@ class Ut extends I {
|
|
|
4450
4450
|
*/
|
|
4451
4451
|
_callObserver(t, n) {
|
|
4452
4452
|
super._callObserver(t, n);
|
|
4453
|
-
const s = new
|
|
4453
|
+
const s = new pl(this, t, n);
|
|
4454
4454
|
Ge(this, t, s), !t.local && this._hasFormatting && (t._needFormattingCleanup = !0);
|
|
4455
4455
|
}
|
|
4456
4456
|
/**
|
|
@@ -4488,14 +4488,14 @@ class Ut extends I {
|
|
|
4488
4488
|
*/
|
|
4489
4489
|
applyDelta(t, { sanitize: n = !0 } = {}) {
|
|
4490
4490
|
this.doc !== null ? _(this.doc, (s) => {
|
|
4491
|
-
const r = new
|
|
4491
|
+
const r = new yn(null, this._start, 0, /* @__PURE__ */ new Map());
|
|
4492
4492
|
for (let i = 0; i < t.length; i++) {
|
|
4493
4493
|
const o = t[i];
|
|
4494
4494
|
if (o.insert !== void 0) {
|
|
4495
4495
|
const c = !n && typeof o.insert == "string" && i === t.length - 1 && r.right === null && o.insert.slice(-1) === `
|
|
4496
4496
|
` ? o.insert.slice(0, -1) : o.insert;
|
|
4497
|
-
(typeof c != "string" || c.length > 0) &&
|
|
4498
|
-
} else o.retain !== void 0 ?
|
|
4497
|
+
(typeof c != "string" || c.length > 0) && sn(s, this, r, c, o.attributes || {});
|
|
4498
|
+
} else o.retain !== void 0 ? Ds(s, this, r, o.retain, o.attributes || {}) : o.delete !== void 0 && As(s, r, o.delete);
|
|
4499
4499
|
}
|
|
4500
4500
|
}) : this._pending.push(() => this.applyDelta(t));
|
|
4501
4501
|
}
|
|
@@ -4538,7 +4538,7 @@ class Ut extends I {
|
|
|
4538
4538
|
l.content.str;
|
|
4539
4539
|
break;
|
|
4540
4540
|
}
|
|
4541
|
-
case
|
|
4541
|
+
case nt:
|
|
4542
4542
|
case bt: {
|
|
4543
4543
|
a();
|
|
4544
4544
|
const u = {
|
|
@@ -4569,7 +4569,7 @@ class Ut extends I {
|
|
|
4569
4569
|
a();
|
|
4570
4570
|
};
|
|
4571
4571
|
return t || n ? _(o, (u) => {
|
|
4572
|
-
t &&
|
|
4572
|
+
t && wn(u, t), n && wn(u, n), h();
|
|
4573
4573
|
}, "cleanup") : h(), r;
|
|
4574
4574
|
}
|
|
4575
4575
|
/**
|
|
@@ -4590,7 +4590,7 @@ class Ut extends I {
|
|
|
4590
4590
|
const o = ae(i, this, t, !s);
|
|
4591
4591
|
s || (s = {}, o.currentAttributes.forEach((c, l) => {
|
|
4592
4592
|
s[l] = c;
|
|
4593
|
-
})),
|
|
4593
|
+
})), sn(i, this, o, n, s);
|
|
4594
4594
|
}) : this._pending.push(() => this.insert(t, n, s));
|
|
4595
4595
|
}
|
|
4596
4596
|
/**
|
|
@@ -4607,7 +4607,7 @@ class Ut extends I {
|
|
|
4607
4607
|
const r = this.doc;
|
|
4608
4608
|
r !== null ? _(r, (i) => {
|
|
4609
4609
|
const o = ae(i, this, t, !s);
|
|
4610
|
-
|
|
4610
|
+
sn(i, this, o, n, s || {});
|
|
4611
4611
|
}) : this._pending.push(() => this.insertEmbed(t, n, s || {}));
|
|
4612
4612
|
}
|
|
4613
4613
|
/**
|
|
@@ -4623,7 +4623,7 @@ class Ut extends I {
|
|
|
4623
4623
|
return;
|
|
4624
4624
|
const s = this.doc;
|
|
4625
4625
|
s !== null ? _(s, (r) => {
|
|
4626
|
-
|
|
4626
|
+
As(r, ae(r, this, t, !0), n);
|
|
4627
4627
|
}) : this._pending.push(() => this.delete(t, n));
|
|
4628
4628
|
}
|
|
4629
4629
|
/**
|
|
@@ -4642,7 +4642,7 @@ class Ut extends I {
|
|
|
4642
4642
|
const r = this.doc;
|
|
4643
4643
|
r !== null ? _(r, (i) => {
|
|
4644
4644
|
const o = ae(i, this, t, !1);
|
|
4645
|
-
o.right !== null &&
|
|
4645
|
+
o.right !== null && Ds(i, this, o, n, s);
|
|
4646
4646
|
}) : this._pending.push(() => this.format(t, n, s));
|
|
4647
4647
|
}
|
|
4648
4648
|
/**
|
|
@@ -4671,7 +4671,7 @@ class Ut extends I {
|
|
|
4671
4671
|
*/
|
|
4672
4672
|
setAttribute(t, n) {
|
|
4673
4673
|
this.doc !== null ? _(this.doc, (s) => {
|
|
4674
|
-
|
|
4674
|
+
Jn(s, this, t, n);
|
|
4675
4675
|
}) : this._pending.push(() => this.setAttribute(t, n));
|
|
4676
4676
|
}
|
|
4677
4677
|
/**
|
|
@@ -4688,7 +4688,7 @@ class Ut extends I {
|
|
|
4688
4688
|
getAttribute(t) {
|
|
4689
4689
|
return (
|
|
4690
4690
|
/** @type {any} */
|
|
4691
|
-
|
|
4691
|
+
Kn(this, t)
|
|
4692
4692
|
);
|
|
4693
4693
|
}
|
|
4694
4694
|
/**
|
|
@@ -4701,17 +4701,17 @@ class Ut extends I {
|
|
|
4701
4701
|
* @public
|
|
4702
4702
|
*/
|
|
4703
4703
|
getAttributes() {
|
|
4704
|
-
return
|
|
4704
|
+
return jr(this);
|
|
4705
4705
|
}
|
|
4706
4706
|
/**
|
|
4707
4707
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
4708
4708
|
*/
|
|
4709
4709
|
_write(t) {
|
|
4710
|
-
t.writeTypeRef(
|
|
4710
|
+
t.writeTypeRef(Ul);
|
|
4711
4711
|
}
|
|
4712
4712
|
}
|
|
4713
|
-
const
|
|
4714
|
-
class
|
|
4713
|
+
const wl = (e) => new Ut();
|
|
4714
|
+
class rn {
|
|
4715
4715
|
/**
|
|
4716
4716
|
* @param {YXmlFragment | YXmlElement} root
|
|
4717
4717
|
* @param {function(AbstractType<any>):boolean} [f]
|
|
@@ -4737,7 +4737,7 @@ class sn {
|
|
|
4737
4737
|
if (t !== null && (!this._firstCall || t.deleted || !this._filter(n)))
|
|
4738
4738
|
do
|
|
4739
4739
|
if (n = /** @type {any} */
|
|
4740
|
-
t.content.type, !t.deleted && (n.constructor === Q || n.constructor ===
|
|
4740
|
+
t.content.type, !t.deleted && (n.constructor === Q || n.constructor === pt) && n._start !== null)
|
|
4741
4741
|
t = n._start;
|
|
4742
4742
|
else
|
|
4743
4743
|
for (; t !== null; ) {
|
|
@@ -4758,7 +4758,7 @@ class sn {
|
|
|
4758
4758
|
), done: !1 });
|
|
4759
4759
|
}
|
|
4760
4760
|
}
|
|
4761
|
-
class
|
|
4761
|
+
class pt extends I {
|
|
4762
4762
|
constructor() {
|
|
4763
4763
|
super(), this._prelimContent = [];
|
|
4764
4764
|
}
|
|
@@ -4787,7 +4787,7 @@ class ft extends I {
|
|
|
4787
4787
|
), this._prelimContent = null;
|
|
4788
4788
|
}
|
|
4789
4789
|
_copy() {
|
|
4790
|
-
return new
|
|
4790
|
+
return new pt();
|
|
4791
4791
|
}
|
|
4792
4792
|
/**
|
|
4793
4793
|
* Makes a copy of this data type that can be included somewhere else.
|
|
@@ -4797,7 +4797,7 @@ class ft extends I {
|
|
|
4797
4797
|
* @return {YXmlFragment}
|
|
4798
4798
|
*/
|
|
4799
4799
|
clone() {
|
|
4800
|
-
const t = new
|
|
4800
|
+
const t = new pt();
|
|
4801
4801
|
return t.insert(0, this.toArray().map((n) => n instanceof I ? n.clone() : n)), t;
|
|
4802
4802
|
}
|
|
4803
4803
|
get length() {
|
|
@@ -4822,7 +4822,7 @@ class ft extends I {
|
|
|
4822
4822
|
* @public
|
|
4823
4823
|
*/
|
|
4824
4824
|
createTreeWalker(t) {
|
|
4825
|
-
return new
|
|
4825
|
+
return new rn(this, t);
|
|
4826
4826
|
}
|
|
4827
4827
|
/**
|
|
4828
4828
|
* Returns the first YXmlElement that matches the query.
|
|
@@ -4841,7 +4841,7 @@ class ft extends I {
|
|
|
4841
4841
|
*/
|
|
4842
4842
|
querySelector(t) {
|
|
4843
4843
|
t = t.toUpperCase();
|
|
4844
|
-
const s = new
|
|
4844
|
+
const s = new rn(this, (r) => r.nodeName && r.nodeName.toUpperCase() === t).next();
|
|
4845
4845
|
return s.done ? null : s.value;
|
|
4846
4846
|
}
|
|
4847
4847
|
/**
|
|
@@ -4856,7 +4856,7 @@ class ft extends I {
|
|
|
4856
4856
|
* @public
|
|
4857
4857
|
*/
|
|
4858
4858
|
querySelectorAll(t) {
|
|
4859
|
-
return t = t.toUpperCase(), q(new
|
|
4859
|
+
return t = t.toUpperCase(), q(new rn(this, (n) => n.nodeName && n.nodeName.toUpperCase() === t));
|
|
4860
4860
|
}
|
|
4861
4861
|
/**
|
|
4862
4862
|
* Creates YXmlEvent and calls observers.
|
|
@@ -4865,7 +4865,7 @@ class ft extends I {
|
|
|
4865
4865
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
4866
4866
|
*/
|
|
4867
4867
|
_callObserver(t, n) {
|
|
4868
|
-
Ge(this, t, new
|
|
4868
|
+
Ge(this, t, new bl(this, n, t));
|
|
4869
4869
|
}
|
|
4870
4870
|
/**
|
|
4871
4871
|
* Get the string representation of all the children of this YXmlFragment.
|
|
@@ -4873,7 +4873,7 @@ class ft extends I {
|
|
|
4873
4873
|
* @return {string} The string representation of all children.
|
|
4874
4874
|
*/
|
|
4875
4875
|
toString() {
|
|
4876
|
-
return
|
|
4876
|
+
return Rr(this, (t) => t.toString()).join("");
|
|
4877
4877
|
}
|
|
4878
4878
|
/**
|
|
4879
4879
|
* @return {string}
|
|
@@ -4914,7 +4914,7 @@ class ft extends I {
|
|
|
4914
4914
|
*/
|
|
4915
4915
|
insert(t, n) {
|
|
4916
4916
|
this.doc !== null ? _(this.doc, (s) => {
|
|
4917
|
-
|
|
4917
|
+
Fr(s, this, t, n);
|
|
4918
4918
|
}) : this._prelimContent.splice(t, 0, ...n);
|
|
4919
4919
|
}
|
|
4920
4920
|
/**
|
|
@@ -4951,7 +4951,7 @@ class ft extends I {
|
|
|
4951
4951
|
*/
|
|
4952
4952
|
delete(t, n = 1) {
|
|
4953
4953
|
this.doc !== null ? _(this.doc, (s) => {
|
|
4954
|
-
|
|
4954
|
+
Vr(s, this, t, n);
|
|
4955
4955
|
}) : this._prelimContent.splice(t, n);
|
|
4956
4956
|
}
|
|
4957
4957
|
/**
|
|
@@ -4960,7 +4960,7 @@ class ft extends I {
|
|
|
4960
4960
|
* @return {Array<YXmlElement|YXmlText|YXmlHook>}
|
|
4961
4961
|
*/
|
|
4962
4962
|
toArray() {
|
|
4963
|
-
return
|
|
4963
|
+
return Ur(this);
|
|
4964
4964
|
}
|
|
4965
4965
|
/**
|
|
4966
4966
|
* Appends content to this YArray.
|
|
@@ -4985,7 +4985,7 @@ class ft extends I {
|
|
|
4985
4985
|
* @return {YXmlElement|YXmlText}
|
|
4986
4986
|
*/
|
|
4987
4987
|
get(t) {
|
|
4988
|
-
return
|
|
4988
|
+
return $r(this, t);
|
|
4989
4989
|
}
|
|
4990
4990
|
/**
|
|
4991
4991
|
* Returns a portion of this YXmlFragment into a JavaScript Array selected
|
|
@@ -4996,7 +4996,7 @@ class ft extends I {
|
|
|
4996
4996
|
* @return {Array<YXmlElement|YXmlText>}
|
|
4997
4997
|
*/
|
|
4998
4998
|
slice(t = 0, n = this.length) {
|
|
4999
|
-
return
|
|
4999
|
+
return Mr(this, t, n);
|
|
5000
5000
|
}
|
|
5001
5001
|
/**
|
|
5002
5002
|
* Executes a provided function on once on every child element.
|
|
@@ -5015,11 +5015,11 @@ class ft extends I {
|
|
|
5015
5015
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
|
|
5016
5016
|
*/
|
|
5017
5017
|
_write(t) {
|
|
5018
|
-
t.writeTypeRef(
|
|
5018
|
+
t.writeTypeRef($l);
|
|
5019
5019
|
}
|
|
5020
5020
|
}
|
|
5021
|
-
const
|
|
5022
|
-
class Q extends
|
|
5021
|
+
const ml = (e) => new pt();
|
|
5022
|
+
class Q extends pt {
|
|
5023
5023
|
constructor(t = "UNDEFINED") {
|
|
5024
5024
|
super(), this.nodeName = t, this._prelimAttrs = /* @__PURE__ */ new Map();
|
|
5025
5025
|
}
|
|
@@ -5077,7 +5077,7 @@ class Q extends ft {
|
|
|
5077
5077
|
*/
|
|
5078
5078
|
clone() {
|
|
5079
5079
|
const t = new Q(this.nodeName), n = this.getAttributes();
|
|
5080
|
-
return
|
|
5080
|
+
return fo(n, (s, r) => {
|
|
5081
5081
|
t.setAttribute(
|
|
5082
5082
|
r,
|
|
5083
5083
|
/** @type {any} */
|
|
@@ -5131,7 +5131,7 @@ class Q extends ft {
|
|
|
5131
5131
|
*/
|
|
5132
5132
|
setAttribute(t, n) {
|
|
5133
5133
|
this.doc !== null ? _(this.doc, (s) => {
|
|
5134
|
-
|
|
5134
|
+
Jn(s, this, t, n);
|
|
5135
5135
|
}) : this._prelimAttrs.set(t, n);
|
|
5136
5136
|
}
|
|
5137
5137
|
/**
|
|
@@ -5148,7 +5148,7 @@ class Q extends ft {
|
|
|
5148
5148
|
getAttribute(t) {
|
|
5149
5149
|
return (
|
|
5150
5150
|
/** @type {any} */
|
|
5151
|
-
|
|
5151
|
+
Kn(this, t)
|
|
5152
5152
|
);
|
|
5153
5153
|
}
|
|
5154
5154
|
/**
|
|
@@ -5162,7 +5162,7 @@ class Q extends ft {
|
|
|
5162
5162
|
hasAttribute(t) {
|
|
5163
5163
|
return (
|
|
5164
5164
|
/** @type {any} */
|
|
5165
|
-
|
|
5165
|
+
Hr(this, t)
|
|
5166
5166
|
);
|
|
5167
5167
|
}
|
|
5168
5168
|
/**
|
|
@@ -5176,7 +5176,7 @@ class Q extends ft {
|
|
|
5176
5176
|
getAttributes(t) {
|
|
5177
5177
|
return (
|
|
5178
5178
|
/** @type {any} */
|
|
5179
|
-
t ?
|
|
5179
|
+
t ? cl(this, t) : jr(this)
|
|
5180
5180
|
);
|
|
5181
5181
|
}
|
|
5182
5182
|
/**
|
|
@@ -5213,11 +5213,11 @@ class Q extends ft {
|
|
|
5213
5213
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
|
|
5214
5214
|
*/
|
|
5215
5215
|
_write(t) {
|
|
5216
|
-
t.writeTypeRef(
|
|
5216
|
+
t.writeTypeRef(Rl), t.writeKey(this.nodeName);
|
|
5217
5217
|
}
|
|
5218
5218
|
}
|
|
5219
|
-
const
|
|
5220
|
-
class
|
|
5219
|
+
const yl = (e) => new Q(e.readKey());
|
|
5220
|
+
class bl extends Pe {
|
|
5221
5221
|
/**
|
|
5222
5222
|
* @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
|
|
5223
5223
|
* @param {Set<string|null>} subs The set of changed attributes. `null` is included if the
|
|
@@ -5286,10 +5286,10 @@ class Ae extends Mt {
|
|
|
5286
5286
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder The encoder to write data to.
|
|
5287
5287
|
*/
|
|
5288
5288
|
_write(t) {
|
|
5289
|
-
t.writeTypeRef(
|
|
5289
|
+
t.writeTypeRef(Bl), t.writeKey(this.hookName);
|
|
5290
5290
|
}
|
|
5291
5291
|
}
|
|
5292
|
-
const
|
|
5292
|
+
const kl = (e) => new Ae(e.readKey());
|
|
5293
5293
|
class Z extends Ut {
|
|
5294
5294
|
/**
|
|
5295
5295
|
* @type {YXmlElement|YXmlText|null}
|
|
@@ -5382,11 +5382,11 @@ class Z extends Ut {
|
|
|
5382
5382
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
5383
5383
|
*/
|
|
5384
5384
|
_write(t) {
|
|
5385
|
-
t.writeTypeRef(
|
|
5385
|
+
t.writeTypeRef(Fl);
|
|
5386
5386
|
}
|
|
5387
5387
|
}
|
|
5388
|
-
const
|
|
5389
|
-
class
|
|
5388
|
+
const _l = (e) => new Z();
|
|
5389
|
+
class Wn {
|
|
5390
5390
|
/**
|
|
5391
5391
|
* @param {ID} id
|
|
5392
5392
|
* @param {number} length
|
|
@@ -5426,8 +5426,8 @@ class Jn {
|
|
|
5426
5426
|
throw H();
|
|
5427
5427
|
}
|
|
5428
5428
|
}
|
|
5429
|
-
const
|
|
5430
|
-
class F extends
|
|
5429
|
+
const Sl = 0;
|
|
5430
|
+
class F extends Wn {
|
|
5431
5431
|
get deleted() {
|
|
5432
5432
|
return !0;
|
|
5433
5433
|
}
|
|
@@ -5445,14 +5445,14 @@ class F extends Jn {
|
|
|
5445
5445
|
* @param {number} offset
|
|
5446
5446
|
*/
|
|
5447
5447
|
integrate(t, n) {
|
|
5448
|
-
n > 0 && (this.id.clock += n, this.length -= n),
|
|
5448
|
+
n > 0 && (this.id.clock += n, this.length -= n), xr(t.doc.store, this);
|
|
5449
5449
|
}
|
|
5450
5450
|
/**
|
|
5451
5451
|
* @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
|
|
5452
5452
|
* @param {number} offset
|
|
5453
5453
|
*/
|
|
5454
5454
|
write(t, n) {
|
|
5455
|
-
t.writeInfo(
|
|
5455
|
+
t.writeInfo(Sl), t.writeLen(this.length - n);
|
|
5456
5456
|
}
|
|
5457
5457
|
/**
|
|
5458
5458
|
* @param {Transaction} transaction
|
|
@@ -5538,7 +5538,7 @@ class se {
|
|
|
5538
5538
|
return 3;
|
|
5539
5539
|
}
|
|
5540
5540
|
}
|
|
5541
|
-
const
|
|
5541
|
+
const Cl = (e) => new se(e.readBuf());
|
|
5542
5542
|
class Qt {
|
|
5543
5543
|
/**
|
|
5544
5544
|
* @param {number} len
|
|
@@ -5616,7 +5616,7 @@ class Qt {
|
|
|
5616
5616
|
return 1;
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
|
-
const
|
|
5619
|
+
const El = (e) => new Qt(e.readLen()), Jr = (e, t) => new yt({ guid: e, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
|
|
5620
5620
|
class re {
|
|
5621
5621
|
/**
|
|
5622
5622
|
* @param {Doc} doc
|
|
@@ -5648,7 +5648,7 @@ class re {
|
|
|
5648
5648
|
* @return {ContentDoc}
|
|
5649
5649
|
*/
|
|
5650
5650
|
copy() {
|
|
5651
|
-
return new re(
|
|
5651
|
+
return new re(Jr(this.doc.guid, this.opts));
|
|
5652
5652
|
}
|
|
5653
5653
|
/**
|
|
5654
5654
|
* @param {number} offset
|
|
@@ -5696,7 +5696,7 @@ class re {
|
|
|
5696
5696
|
return 9;
|
|
5697
5697
|
}
|
|
5698
5698
|
}
|
|
5699
|
-
const
|
|
5699
|
+
const Dl = (e) => new re(Jr(e.readString(), e.readAny()));
|
|
5700
5700
|
class bt {
|
|
5701
5701
|
/**
|
|
5702
5702
|
* @param {Object} embed
|
|
@@ -5772,7 +5772,7 @@ class bt {
|
|
|
5772
5772
|
return 5;
|
|
5773
5773
|
}
|
|
5774
5774
|
}
|
|
5775
|
-
const
|
|
5775
|
+
const Al = (e) => new bt(e.readJSON());
|
|
5776
5776
|
class T {
|
|
5777
5777
|
/**
|
|
5778
5778
|
* @param {string} key
|
|
@@ -5854,7 +5854,7 @@ class T {
|
|
|
5854
5854
|
return 6;
|
|
5855
5855
|
}
|
|
5856
5856
|
}
|
|
5857
|
-
const
|
|
5857
|
+
const Tl = (e) => new T(e.readKey(), e.readJSON());
|
|
5858
5858
|
class Te {
|
|
5859
5859
|
/**
|
|
5860
5860
|
* @param {Array<any>} arr
|
|
@@ -5936,20 +5936,20 @@ class Te {
|
|
|
5936
5936
|
return 2;
|
|
5937
5937
|
}
|
|
5938
5938
|
}
|
|
5939
|
-
const
|
|
5939
|
+
const xl = (e) => {
|
|
5940
5940
|
const t = e.readLen(), n = [];
|
|
5941
5941
|
for (let s = 0; s < t; s++) {
|
|
5942
5942
|
const r = e.readString();
|
|
5943
5943
|
r === "undefined" ? n.push(void 0) : n.push(JSON.parse(r));
|
|
5944
5944
|
}
|
|
5945
5945
|
return new Te(n);
|
|
5946
|
-
},
|
|
5947
|
-
class
|
|
5946
|
+
}, Il = ye("node_env") === "development";
|
|
5947
|
+
class wt {
|
|
5948
5948
|
/**
|
|
5949
5949
|
* @param {Array<any>} arr
|
|
5950
5950
|
*/
|
|
5951
5951
|
constructor(t) {
|
|
5952
|
-
this.arr = t,
|
|
5952
|
+
this.arr = t, Il && Ps(t);
|
|
5953
5953
|
}
|
|
5954
5954
|
/**
|
|
5955
5955
|
* @return {number}
|
|
@@ -5973,14 +5973,14 @@ class gt {
|
|
|
5973
5973
|
* @return {ContentAny}
|
|
5974
5974
|
*/
|
|
5975
5975
|
copy() {
|
|
5976
|
-
return new
|
|
5976
|
+
return new wt(this.arr);
|
|
5977
5977
|
}
|
|
5978
5978
|
/**
|
|
5979
5979
|
* @param {number} offset
|
|
5980
5980
|
* @return {ContentAny}
|
|
5981
5981
|
*/
|
|
5982
5982
|
splice(t) {
|
|
5983
|
-
const n = new
|
|
5983
|
+
const n = new wt(this.arr.slice(t));
|
|
5984
5984
|
return this.arr = this.arr.slice(0, t), n;
|
|
5985
5985
|
}
|
|
5986
5986
|
/**
|
|
@@ -6025,11 +6025,11 @@ class gt {
|
|
|
6025
6025
|
return 8;
|
|
6026
6026
|
}
|
|
6027
6027
|
}
|
|
6028
|
-
const
|
|
6028
|
+
const Ll = (e) => {
|
|
6029
6029
|
const t = e.readLen(), n = [];
|
|
6030
6030
|
for (let s = 0; s < t; s++)
|
|
6031
6031
|
n.push(e.readAny());
|
|
6032
|
-
return new
|
|
6032
|
+
return new wt(n);
|
|
6033
6033
|
};
|
|
6034
6034
|
class J {
|
|
6035
6035
|
/**
|
|
@@ -6109,16 +6109,16 @@ class J {
|
|
|
6109
6109
|
return 4;
|
|
6110
6110
|
}
|
|
6111
6111
|
}
|
|
6112
|
-
const
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
pl,
|
|
6116
|
-
ml,
|
|
6112
|
+
const vl = (e) => new J(e.readString()), Ol = [
|
|
6113
|
+
al,
|
|
6114
|
+
ul,
|
|
6117
6115
|
wl,
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6116
|
+
yl,
|
|
6117
|
+
ml,
|
|
6118
|
+
kl,
|
|
6119
|
+
_l
|
|
6120
|
+
], Nl = 0, Ml = 1, Ul = 2, Rl = 3, $l = 4, Bl = 5, Fl = 6;
|
|
6121
|
+
class nt {
|
|
6122
6122
|
/**
|
|
6123
6123
|
* @param {AbstractType<any>} type
|
|
6124
6124
|
*/
|
|
@@ -6147,7 +6147,7 @@ class et {
|
|
|
6147
6147
|
* @return {ContentType}
|
|
6148
6148
|
*/
|
|
6149
6149
|
copy() {
|
|
6150
|
-
return new
|
|
6150
|
+
return new nt(this.type._copy());
|
|
6151
6151
|
}
|
|
6152
6152
|
/**
|
|
6153
6153
|
* @param {number} offset
|
|
@@ -6210,7 +6210,7 @@ class et {
|
|
|
6210
6210
|
return 7;
|
|
6211
6211
|
}
|
|
6212
6212
|
}
|
|
6213
|
-
const
|
|
6213
|
+
const Vl = (e) => new nt(Ol[e.readTypeRef()](e)), jl = (e, t) => {
|
|
6214
6214
|
let n = t, s = 0, r;
|
|
6215
6215
|
do
|
|
6216
6216
|
s > 0 && (n = k(n.client, n.clock + s)), r = fe(e, n), s = n.clock - r.id.clock, n = r.redone;
|
|
@@ -6219,7 +6219,7 @@ const Fl = (e) => new et(vl[e.readTypeRef()](e)), Vl = (e, t) => {
|
|
|
6219
6219
|
item: r,
|
|
6220
6220
|
diff: s
|
|
6221
6221
|
};
|
|
6222
|
-
},
|
|
6222
|
+
}, Xn = (e, t) => {
|
|
6223
6223
|
for (; e !== null && e.keep !== t; )
|
|
6224
6224
|
e.keep = t, e = /** @type {AbstractType<any>} */
|
|
6225
6225
|
e.parent._item;
|
|
@@ -6235,11 +6235,11 @@ const Fl = (e) => new et(vl[e.readTypeRef()](e)), Vl = (e, t) => {
|
|
|
6235
6235
|
t.content.splice(n)
|
|
6236
6236
|
);
|
|
6237
6237
|
return t.deleted && i.markDeleted(), t.keep && (i.keep = !0), t.redone !== null && (i.redone = k(t.redone.client, t.redone.clock + n)), t.right = i, i.right !== null && (i.right.left = i), e._mergeStructs.push(i), i.parentSub !== null && i.right === null && i.parent._map.set(i.parentSub, i), t.length = n, i;
|
|
6238
|
-
},
|
|
6238
|
+
}, Ts = (e, t) => En(
|
|
6239
6239
|
e,
|
|
6240
6240
|
/** @param {StackItem} s */
|
|
6241
6241
|
(n) => ee(n.deletions, t)
|
|
6242
|
-
),
|
|
6242
|
+
), Kr = (e, t, n, s, r, i) => {
|
|
6243
6243
|
const o = e.doc, c = o.store, l = o.clientID, a = t.redone;
|
|
6244
6244
|
if (a !== null)
|
|
6245
6245
|
return R(e, a);
|
|
@@ -6248,7 +6248,7 @@ const Fl = (e) => new et(vl[e.readTypeRef()](e)), Vl = (e, t) => {
|
|
|
6248
6248
|
t.parent._item
|
|
6249
6249
|
), d = null, u;
|
|
6250
6250
|
if (h !== null && h.deleted === !0) {
|
|
6251
|
-
if (h.redone === null && (!n.has(h) ||
|
|
6251
|
+
if (h.redone === null && (!n.has(h) || Kr(e, h, n, s, r, i) === null))
|
|
6252
6252
|
return null;
|
|
6253
6253
|
for (; h.redone !== null; )
|
|
6254
6254
|
h = R(e, h.redone);
|
|
@@ -6287,7 +6287,7 @@ const Fl = (e) => new et(vl[e.readTypeRef()](e)), Vl = (e, t) => {
|
|
|
6287
6287
|
}
|
|
6288
6288
|
} else {
|
|
6289
6289
|
if (u = null, t.right && !r) {
|
|
6290
|
-
for (d = t; d !== null && d.right !== null && (d.right.redone || ee(s, d.right.id) ||
|
|
6290
|
+
for (d = t; d !== null && d.right !== null && (d.right.redone || ee(s, d.right.id) || Ts(i.undoStack, d.right.id) || Ts(i.redoStack, d.right.id)); )
|
|
6291
6291
|
for (d = d.right; d.redone; ) d = R(e, d.redone);
|
|
6292
6292
|
if (d && d.right !== null)
|
|
6293
6293
|
return null;
|
|
@@ -6306,9 +6306,9 @@ const Fl = (e) => new et(vl[e.readTypeRef()](e)), Vl = (e, t) => {
|
|
|
6306
6306
|
t.parentSub,
|
|
6307
6307
|
t.content.copy()
|
|
6308
6308
|
);
|
|
6309
|
-
return t.redone = w,
|
|
6309
|
+
return t.redone = w, Xn(p, !0), p.integrate(e, 0), p;
|
|
6310
6310
|
};
|
|
6311
|
-
class S extends
|
|
6311
|
+
class S extends Wn {
|
|
6312
6312
|
/**
|
|
6313
6313
|
* @param {ID} id
|
|
6314
6314
|
* @param {Item | null} left
|
|
@@ -6320,7 +6320,7 @@ class S extends Jn {
|
|
|
6320
6320
|
* @param {AbstractContent} content
|
|
6321
6321
|
*/
|
|
6322
6322
|
constructor(t, n, s, r, i, o, c, l) {
|
|
6323
|
-
super(t, l.getLength()), this.origin = s, this.left = n, this.right = r, this.rightOrigin = i, this.parent = o, this.parentSub = c, this.redone = null, this.content = l, this.info = this.content.isCountable() ?
|
|
6323
|
+
super(t, l.getLength()), this.origin = s, this.left = n, this.right = r, this.rightOrigin = i, this.parent = o, this.parentSub = c, this.redone = null, this.content = l, this.info = this.content.isCountable() ? ns : 0;
|
|
6324
6324
|
}
|
|
6325
6325
|
/**
|
|
6326
6326
|
* This is used to mark the item as an indexed fast-search marker
|
|
@@ -6328,35 +6328,35 @@ class S extends Jn {
|
|
|
6328
6328
|
* @type {boolean}
|
|
6329
6329
|
*/
|
|
6330
6330
|
set marker(t) {
|
|
6331
|
-
(this.info &
|
|
6331
|
+
(this.info & qe) > 0 !== t && (this.info ^= qe);
|
|
6332
6332
|
}
|
|
6333
6333
|
get marker() {
|
|
6334
|
-
return (this.info &
|
|
6334
|
+
return (this.info & qe) > 0;
|
|
6335
6335
|
}
|
|
6336
6336
|
/**
|
|
6337
6337
|
* If true, do not garbage collect this Item.
|
|
6338
6338
|
*/
|
|
6339
6339
|
get keep() {
|
|
6340
|
-
return (this.info &
|
|
6340
|
+
return (this.info & es) > 0;
|
|
6341
6341
|
}
|
|
6342
6342
|
set keep(t) {
|
|
6343
|
-
this.keep !== t && (this.info ^=
|
|
6343
|
+
this.keep !== t && (this.info ^= es);
|
|
6344
6344
|
}
|
|
6345
6345
|
get countable() {
|
|
6346
|
-
return (this.info &
|
|
6346
|
+
return (this.info & ns) > 0;
|
|
6347
6347
|
}
|
|
6348
6348
|
/**
|
|
6349
6349
|
* Whether this item was deleted or not.
|
|
6350
6350
|
* @type {Boolean}
|
|
6351
6351
|
*/
|
|
6352
6352
|
get deleted() {
|
|
6353
|
-
return (this.info &
|
|
6353
|
+
return (this.info & Xe) > 0;
|
|
6354
6354
|
}
|
|
6355
6355
|
set deleted(t) {
|
|
6356
|
-
this.deleted !== t && (this.info ^=
|
|
6356
|
+
this.deleted !== t && (this.info ^= Xe);
|
|
6357
6357
|
}
|
|
6358
6358
|
markDeleted() {
|
|
6359
|
-
this.info |=
|
|
6359
|
+
this.info |= Xe;
|
|
6360
6360
|
}
|
|
6361
6361
|
/**
|
|
6362
6362
|
* Return the creator clientID of the missing op or define missing items and return null.
|
|
@@ -6372,7 +6372,7 @@ class S extends Jn {
|
|
|
6372
6372
|
return this.rightOrigin.client;
|
|
6373
6373
|
if (this.parent && this.parent.constructor === At && this.id.client !== this.parent.client && this.parent.clock >= A(n, this.parent.client))
|
|
6374
6374
|
return this.parent.client;
|
|
6375
|
-
if (this.origin && (this.left =
|
|
6375
|
+
if (this.origin && (this.left = ys(t, n, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = R(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === F || this.right && this.right.constructor === F)
|
|
6376
6376
|
this.parent = null;
|
|
6377
6377
|
else if (!this.parent)
|
|
6378
6378
|
this.left && this.left.constructor === S ? (this.parent = this.left.parent, this.parentSub = this.left.parentSub) : this.right && this.right.constructor === S && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
|
|
@@ -6388,7 +6388,7 @@ class S extends Jn {
|
|
|
6388
6388
|
* @param {number} offset
|
|
6389
6389
|
*/
|
|
6390
6390
|
integrate(t, n) {
|
|
6391
|
-
if (n > 0 && (this.id.clock += n, this.left =
|
|
6391
|
+
if (n > 0 && (this.id.clock += n, this.left = ys(t, t.doc.store, k(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(n), this.length -= n), this.parent) {
|
|
6392
6392
|
if (!this.left && (!this.right || this.right.left !== null) || this.left && this.left.right !== this.right) {
|
|
6393
6393
|
let s = this.left, r;
|
|
6394
6394
|
if (s !== null)
|
|
@@ -6429,7 +6429,7 @@ class S extends Jn {
|
|
|
6429
6429
|
this.parent._start, this.parent._start = this;
|
|
6430
6430
|
this.right = s;
|
|
6431
6431
|
}
|
|
6432
|
-
this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(t)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length),
|
|
6432
|
+
this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(t)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), xr(t.doc.store, this), this.content.integrate(t, this), ks(
|
|
6433
6433
|
t,
|
|
6434
6434
|
/** @type {AbstractType<any>} */
|
|
6435
6435
|
this.parent,
|
|
@@ -6493,7 +6493,7 @@ class S extends Jn {
|
|
|
6493
6493
|
/** @type {AbstractType<any>} */
|
|
6494
6494
|
this.parent
|
|
6495
6495
|
);
|
|
6496
|
-
this.countable && this.parentSub === null && (n._length -= this.length), this.markDeleted(), Wt(t.deleteSet, this.id.client, this.id.clock, this.length),
|
|
6496
|
+
this.countable && this.parentSub === null && (n._length -= this.length), this.markDeleted(), Wt(t.deleteSet, this.id.client, this.id.clock, this.length), ks(t, n, this.parentSub), this.content.delete(t);
|
|
6497
6497
|
}
|
|
6498
6498
|
}
|
|
6499
6499
|
/**
|
|
@@ -6503,7 +6503,7 @@ class S extends Jn {
|
|
|
6503
6503
|
gc(t, n) {
|
|
6504
6504
|
if (!this.deleted)
|
|
6505
6505
|
throw j();
|
|
6506
|
-
this.content.gc(t), n ?
|
|
6506
|
+
this.content.gc(t), n ? zc(t, this, new F(this.id, this.length)) : this.content = new Qt(this.length);
|
|
6507
6507
|
}
|
|
6508
6508
|
/**
|
|
6509
6509
|
* Transform the properties of this type to binary and write it to an
|
|
@@ -6526,7 +6526,7 @@ class S extends Jn {
|
|
|
6526
6526
|
if (c._item !== void 0) {
|
|
6527
6527
|
const l = c._item;
|
|
6528
6528
|
if (l === null) {
|
|
6529
|
-
const a =
|
|
6529
|
+
const a = jc(c);
|
|
6530
6530
|
t.writeParentInfo(!0), t.writeString(a);
|
|
6531
6531
|
} else
|
|
6532
6532
|
t.writeParentInfo(!1), t.writeLeftID(l.id);
|
|
@@ -6536,35 +6536,35 @@ class S extends Jn {
|
|
|
6536
6536
|
this.content.write(t, n);
|
|
6537
6537
|
}
|
|
6538
6538
|
}
|
|
6539
|
-
const
|
|
6539
|
+
const Wr = (e, t) => Hl[t & Oe](e), Hl = [
|
|
6540
6540
|
() => {
|
|
6541
6541
|
j();
|
|
6542
6542
|
},
|
|
6543
6543
|
// GC is not ItemContent
|
|
6544
|
-
|
|
6544
|
+
El,
|
|
6545
6545
|
// 1
|
|
6546
|
-
|
|
6546
|
+
xl,
|
|
6547
6547
|
// 2
|
|
6548
|
-
|
|
6548
|
+
Cl,
|
|
6549
6549
|
// 3
|
|
6550
|
-
|
|
6550
|
+
vl,
|
|
6551
6551
|
// 4
|
|
6552
|
-
Dl,
|
|
6553
|
-
// 5
|
|
6554
6552
|
Al,
|
|
6553
|
+
// 5
|
|
6554
|
+
Tl,
|
|
6555
6555
|
// 6
|
|
6556
|
-
|
|
6556
|
+
Vl,
|
|
6557
6557
|
// 7
|
|
6558
|
-
|
|
6558
|
+
Ll,
|
|
6559
6559
|
// 8
|
|
6560
|
-
|
|
6560
|
+
Dl,
|
|
6561
6561
|
// 9
|
|
6562
6562
|
() => {
|
|
6563
6563
|
j();
|
|
6564
6564
|
}
|
|
6565
6565
|
// 10 - Skip is not ItemContent
|
|
6566
|
-
],
|
|
6567
|
-
class V extends
|
|
6566
|
+
], zl = 10;
|
|
6567
|
+
class V extends Wn {
|
|
6568
6568
|
get deleted() {
|
|
6569
6569
|
return !0;
|
|
6570
6570
|
}
|
|
@@ -6589,7 +6589,7 @@ class V extends Jn {
|
|
|
6589
6589
|
* @param {number} offset
|
|
6590
6590
|
*/
|
|
6591
6591
|
write(t, n) {
|
|
6592
|
-
t.writeInfo(
|
|
6592
|
+
t.writeInfo(zl), m(t.restEncoder, this.length - n);
|
|
6593
6593
|
}
|
|
6594
6594
|
/**
|
|
6595
6595
|
* @param {Transaction} transaction
|
|
@@ -6600,93 +6600,93 @@ class V extends Jn {
|
|
|
6600
6600
|
return null;
|
|
6601
6601
|
}
|
|
6602
6602
|
}
|
|
6603
|
-
const
|
|
6603
|
+
const Xr = (
|
|
6604
6604
|
/** @type {any} */
|
|
6605
6605
|
typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof globalThis != "undefined" ? globalThis : {}
|
|
6606
|
-
),
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
const
|
|
6610
|
-
class
|
|
6606
|
+
), qr = "__ $YJS$ __";
|
|
6607
|
+
Xr[qr] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
|
|
6608
|
+
Xr[qr] = !0;
|
|
6609
|
+
const Qr = /* @__PURE__ */ new Map();
|
|
6610
|
+
class Pl {
|
|
6611
6611
|
/**
|
|
6612
6612
|
* @param {string} room
|
|
6613
6613
|
*/
|
|
6614
6614
|
constructor(t) {
|
|
6615
|
-
this.room = t, this.onmessage = null, this._onChange = (n) => n.key === t && this.onmessage !== null && this.onmessage({ data:
|
|
6615
|
+
this.room = t, this.onmessage = null, this._onChange = (n) => n.key === t && this.onmessage !== null && this.onmessage({ data: Lo(n.newValue || "") }), co(this._onChange);
|
|
6616
6616
|
}
|
|
6617
6617
|
/**
|
|
6618
6618
|
* @param {ArrayBuffer} buf
|
|
6619
6619
|
*/
|
|
6620
6620
|
postMessage(t) {
|
|
6621
|
-
|
|
6621
|
+
Hs.setItem(this.room, Io(Eo(t)));
|
|
6622
6622
|
}
|
|
6623
6623
|
close() {
|
|
6624
|
-
|
|
6624
|
+
lo(this._onChange);
|
|
6625
6625
|
}
|
|
6626
6626
|
}
|
|
6627
|
-
const
|
|
6628
|
-
const t =
|
|
6627
|
+
const Yl = typeof BroadcastChannel == "undefined" ? Pl : BroadcastChannel, qn = (e) => K(Qr, e, () => {
|
|
6628
|
+
const t = ot(), n = new Yl(e);
|
|
6629
6629
|
return n.onmessage = (s) => t.forEach((r) => r(s.data, "broadcastchannel")), {
|
|
6630
6630
|
bc: n,
|
|
6631
6631
|
subs: t
|
|
6632
6632
|
};
|
|
6633
|
-
}),
|
|
6634
|
-
const n =
|
|
6635
|
-
return s && n.subs.size === 0 && (n.bc.close(),
|
|
6633
|
+
}), Gl = (e, t) => (qn(e).subs.add(t), t), Jl = (e, t) => {
|
|
6634
|
+
const n = qn(e), s = n.subs.delete(t);
|
|
6635
|
+
return s && n.subs.size === 0 && (n.bc.close(), Qr.delete(e)), s;
|
|
6636
6636
|
}, St = (e, t, n = null) => {
|
|
6637
|
-
const s =
|
|
6637
|
+
const s = qn(e);
|
|
6638
6638
|
s.bc.postMessage(t), s.subs.forEach((r) => r(t, n));
|
|
6639
|
-
},
|
|
6640
|
-
m(e,
|
|
6641
|
-
const n =
|
|
6639
|
+
}, Zr = 0, Qn = 1, ti = 2, bn = (e, t) => {
|
|
6640
|
+
m(e, Zr);
|
|
6641
|
+
const n = Fc(t);
|
|
6642
6642
|
E(e, n);
|
|
6643
|
-
},
|
|
6644
|
-
m(e,
|
|
6645
|
-
},
|
|
6643
|
+
}, ei = (e, t, n) => {
|
|
6644
|
+
m(e, Qn), E(e, Uc(t, n));
|
|
6645
|
+
}, Kl = (e, t, n) => ei(t, n, O(e)), ni = (e, t, n, s) => {
|
|
6646
6646
|
try {
|
|
6647
|
-
|
|
6647
|
+
Oc(t, O(e), n);
|
|
6648
6648
|
} catch (r) {
|
|
6649
6649
|
s != null && s(
|
|
6650
6650
|
/** @type {Error} */
|
|
6651
6651
|
r
|
|
6652
6652
|
), console.error("Caught error while handling a Yjs update", r);
|
|
6653
6653
|
}
|
|
6654
|
-
},
|
|
6655
|
-
m(e,
|
|
6656
|
-
},
|
|
6654
|
+
}, Wl = (e, t) => {
|
|
6655
|
+
m(e, ti), E(e, t);
|
|
6656
|
+
}, Xl = ni, ql = (e, t, n, s, r) => {
|
|
6657
6657
|
const i = b(e);
|
|
6658
6658
|
switch (i) {
|
|
6659
|
-
case
|
|
6660
|
-
|
|
6659
|
+
case Zr:
|
|
6660
|
+
Kl(e, t, n);
|
|
6661
6661
|
break;
|
|
6662
|
-
case
|
|
6663
|
-
|
|
6662
|
+
case Qn:
|
|
6663
|
+
ni(e, n, s, r);
|
|
6664
6664
|
break;
|
|
6665
|
-
case
|
|
6666
|
-
|
|
6665
|
+
case ti:
|
|
6666
|
+
Xl(e, n, s, r);
|
|
6667
6667
|
break;
|
|
6668
6668
|
default:
|
|
6669
6669
|
throw new Error("Unknown message type");
|
|
6670
6670
|
}
|
|
6671
6671
|
return i;
|
|
6672
|
-
},
|
|
6673
|
-
b(e) ===
|
|
6674
|
-
},
|
|
6675
|
-
class
|
|
6672
|
+
}, Ql = 0, Zl = (e, t, n) => {
|
|
6673
|
+
b(e) === Ql && n(t, it(e));
|
|
6674
|
+
}, on = 3e4;
|
|
6675
|
+
class ta extends Di {
|
|
6676
6676
|
/**
|
|
6677
6677
|
* @param {Y.Doc} doc
|
|
6678
6678
|
*/
|
|
6679
6679
|
constructor(t) {
|
|
6680
6680
|
super(), this.doc = t, this.clientID = t.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = /** @type {any} */
|
|
6681
6681
|
setInterval(() => {
|
|
6682
|
-
const n =
|
|
6683
|
-
this.getLocalState() !== null &&
|
|
6682
|
+
const n = ct();
|
|
6683
|
+
this.getLocalState() !== null && on / 2 <= n - /** @type {{lastUpdated:number}} */
|
|
6684
6684
|
this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
|
|
6685
6685
|
const s = [];
|
|
6686
6686
|
this.meta.forEach((r, i) => {
|
|
6687
|
-
i !== this.clientID &&
|
|
6688
|
-
}), s.length > 0 &&
|
|
6689
|
-
}, z(
|
|
6687
|
+
i !== this.clientID && on <= n - r.lastUpdated && this.states.has(i) && s.push(i);
|
|
6688
|
+
}), s.length > 0 && Zn(this, s, "timeout");
|
|
6689
|
+
}, z(on / 10)), t.on("destroy", () => {
|
|
6690
6690
|
this.destroy();
|
|
6691
6691
|
}), this.setLocalState({});
|
|
6692
6692
|
}
|
|
@@ -6706,7 +6706,7 @@ class Zl extends Ei {
|
|
|
6706
6706
|
const n = this.clientID, s = this.meta.get(n), r = s === void 0 ? 0 : s.clock + 1, i = this.states.get(n);
|
|
6707
6707
|
t === null ? this.states.delete(n) : this.states.set(n, t), this.meta.set(n, {
|
|
6708
6708
|
clock: r,
|
|
6709
|
-
lastUpdated:
|
|
6709
|
+
lastUpdated: ct()
|
|
6710
6710
|
});
|
|
6711
6711
|
const o = [], c = [], l = [], a = [];
|
|
6712
6712
|
t === null ? a.push(n) : i == null ? t != null && o.push(n) : (c.push(n), Et(i, t) || l.push(n)), (o.length > 0 || l.length > 0 || a.length > 0) && this.emit("change", [{ added: o, updated: l, removed: a }, "local"]), this.emit("update", [{ added: o, updated: c, removed: a }, "local"]);
|
|
@@ -6729,7 +6729,7 @@ class Zl extends Ei {
|
|
|
6729
6729
|
return this.states;
|
|
6730
6730
|
}
|
|
6731
6731
|
}
|
|
6732
|
-
const
|
|
6732
|
+
const Zn = (e, t, n) => {
|
|
6733
6733
|
const s = [];
|
|
6734
6734
|
for (let r = 0; r < t.length; r++) {
|
|
6735
6735
|
const i = t[r];
|
|
@@ -6741,7 +6741,7 @@ const qn = (e, t, n) => {
|
|
|
6741
6741
|
);
|
|
6742
6742
|
e.meta.set(i, {
|
|
6743
6743
|
clock: o.clock + 1,
|
|
6744
|
-
lastUpdated:
|
|
6744
|
+
lastUpdated: ct()
|
|
6745
6745
|
});
|
|
6746
6746
|
}
|
|
6747
6747
|
s.push(i);
|
|
@@ -6756,15 +6756,15 @@ const qn = (e, t, n) => {
|
|
|
6756
6756
|
/** @type {MetaClientState} */
|
|
6757
6757
|
e.meta.get(o).clock
|
|
6758
6758
|
);
|
|
6759
|
-
m(r, o), m(r, l),
|
|
6759
|
+
m(r, o), m(r, l), ft(r, JSON.stringify(c));
|
|
6760
6760
|
}
|
|
6761
6761
|
return C(r);
|
|
6762
|
-
},
|
|
6763
|
-
const s =
|
|
6762
|
+
}, ea = (e, t, n) => {
|
|
6763
|
+
const s = ht(t), r = ct(), i = [], o = [], c = [], l = [], a = b(s);
|
|
6764
6764
|
for (let h = 0; h < a; h++) {
|
|
6765
6765
|
const d = b(s);
|
|
6766
6766
|
let u = b(s);
|
|
6767
|
-
const f = JSON.parse(
|
|
6767
|
+
const f = JSON.parse(it(s)), g = e.meta.get(d), w = e.states.get(d), p = g === void 0 ? 0 : g.clock;
|
|
6768
6768
|
(p < u || p === u && f === null && e.states.has(d)) && (f === null ? d === e.clientID && e.getLocalState() != null ? u++ : e.states.delete(d) : e.states.set(d, f), e.meta.set(d, {
|
|
6769
6769
|
clock: u,
|
|
6770
6770
|
lastUpdated: r
|
|
@@ -6779,18 +6779,18 @@ const qn = (e, t, n) => {
|
|
|
6779
6779
|
updated: o,
|
|
6780
6780
|
removed: l
|
|
6781
6781
|
}, n]);
|
|
6782
|
-
},
|
|
6783
|
-
ie[
|
|
6784
|
-
m(e,
|
|
6785
|
-
const i =
|
|
6782
|
+
}, na = (e) => go(e, (t, n) => `${encodeURIComponent(n)}=${encodeURIComponent(t)}`).join("&"), ut = 0, si = 3, xt = 1, sa = 2, ie = [];
|
|
6783
|
+
ie[ut] = (e, t, n, s, r) => {
|
|
6784
|
+
m(e, ut);
|
|
6785
|
+
const i = ql(
|
|
6786
6786
|
t,
|
|
6787
6787
|
e,
|
|
6788
6788
|
n.doc,
|
|
6789
6789
|
n
|
|
6790
6790
|
);
|
|
6791
|
-
s && i ===
|
|
6791
|
+
s && i === Qn && !n.synced && (n.synced = !0);
|
|
6792
6792
|
};
|
|
6793
|
-
ie[
|
|
6793
|
+
ie[si] = (e, t, n, s, r) => {
|
|
6794
6794
|
m(e, xt), E(
|
|
6795
6795
|
e,
|
|
6796
6796
|
Ht(
|
|
@@ -6800,25 +6800,25 @@ ie[ni] = (e, t, n, s, r) => {
|
|
|
6800
6800
|
);
|
|
6801
6801
|
};
|
|
6802
6802
|
ie[xt] = (e, t, n, s, r) => {
|
|
6803
|
-
|
|
6803
|
+
ea(
|
|
6804
6804
|
n.awareness,
|
|
6805
6805
|
O(t),
|
|
6806
6806
|
n
|
|
6807
6807
|
);
|
|
6808
6808
|
};
|
|
6809
|
-
ie[
|
|
6810
|
-
|
|
6809
|
+
ie[sa] = (e, t, n, s, r) => {
|
|
6810
|
+
Zl(
|
|
6811
6811
|
t,
|
|
6812
6812
|
n.doc,
|
|
6813
|
-
(i, o) =>
|
|
6813
|
+
(i, o) => ra(n, o)
|
|
6814
6814
|
);
|
|
6815
6815
|
};
|
|
6816
|
-
const
|
|
6817
|
-
${t}`),
|
|
6818
|
-
const s =
|
|
6816
|
+
const xs = 3e4, ra = (e, t) => console.warn(`Permission denied to access ${e.url}.
|
|
6817
|
+
${t}`), ri = (e, t, n) => {
|
|
6818
|
+
const s = ht(t), r = N(), i = b(s), o = e.messageHandlers[i];
|
|
6819
6819
|
return /** @type {any} */ o ? o(r, s, e, n, i) : console.error("Unable to compute message"), r;
|
|
6820
|
-
},
|
|
6821
|
-
t === e.ws && (e.emit("connection-close", [n, e]), e.ws = null, t.close(), e.wsconnecting = !1, e.wsconnected ? (e.wsconnected = !1, e.synced = !1,
|
|
6820
|
+
}, kn = (e, t, n) => {
|
|
6821
|
+
t === e.ws && (e.emit("connection-close", [n, e]), e.ws = null, t.close(), e.wsconnecting = !1, e.wsconnected ? (e.wsconnected = !1, e.synced = !1, Zn(
|
|
6822
6822
|
e.awareness,
|
|
6823
6823
|
Array.from(e.awareness.getStates().keys()).filter(
|
|
6824
6824
|
(s) => s !== e.doc.clientID
|
|
@@ -6827,30 +6827,30 @@ ${t}`), si = (e, t, n) => {
|
|
|
6827
6827
|
), e.emit("status", [{
|
|
6828
6828
|
status: "disconnected"
|
|
6829
6829
|
}])) : e.wsUnsuccessfulReconnects++, setTimeout(
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6830
|
+
ii,
|
|
6831
|
+
An(
|
|
6832
|
+
Ai(2, e.wsUnsuccessfulReconnects) * 100,
|
|
6833
6833
|
e.maxBackoffTime
|
|
6834
6834
|
),
|
|
6835
6835
|
e
|
|
6836
6836
|
));
|
|
6837
|
-
},
|
|
6837
|
+
}, ii = (e) => {
|
|
6838
6838
|
if (e.shouldConnect && e.ws === null) {
|
|
6839
6839
|
const t = new e._WS(e.url, e.protocols);
|
|
6840
6840
|
t.binaryType = "arraybuffer", e.ws = t, e.wsconnecting = !0, e.wsconnected = !1, e.synced = !1, t.onmessage = (n) => {
|
|
6841
|
-
e.wsLastMessageReceived =
|
|
6842
|
-
const s =
|
|
6843
|
-
|
|
6841
|
+
e.wsLastMessageReceived = ct();
|
|
6842
|
+
const s = ri(e, new Uint8Array(n.data), !0);
|
|
6843
|
+
Tn(s) > 1 && t.send(C(s));
|
|
6844
6844
|
}, t.onerror = (n) => {
|
|
6845
6845
|
e.emit("connection-error", [n, e]);
|
|
6846
6846
|
}, t.onclose = (n) => {
|
|
6847
|
-
|
|
6847
|
+
kn(e, t, n);
|
|
6848
6848
|
}, t.onopen = () => {
|
|
6849
|
-
e.wsLastMessageReceived =
|
|
6849
|
+
e.wsLastMessageReceived = ct(), e.wsconnecting = !1, e.wsconnected = !0, e.wsUnsuccessfulReconnects = 0, e.emit("status", [{
|
|
6850
6850
|
status: "connected"
|
|
6851
6851
|
}]);
|
|
6852
6852
|
const n = N();
|
|
6853
|
-
if (m(n,
|
|
6853
|
+
if (m(n, ut), bn(n, e.doc), t.send(C(n)), e.awareness.getLocalState() !== null) {
|
|
6854
6854
|
const s = N();
|
|
6855
6855
|
m(s, xt), E(
|
|
6856
6856
|
s,
|
|
@@ -6863,11 +6863,11 @@ ${t}`), si = (e, t, n) => {
|
|
|
6863
6863
|
status: "connecting"
|
|
6864
6864
|
}]);
|
|
6865
6865
|
}
|
|
6866
|
-
},
|
|
6866
|
+
}, cn = (e, t) => {
|
|
6867
6867
|
const n = e.ws;
|
|
6868
6868
|
e.wsconnected && n && n.readyState === n.OPEN && n.send(t), e.bcconnected && St(e.bcChannel, t, e);
|
|
6869
6869
|
};
|
|
6870
|
-
class
|
|
6870
|
+
class ia extends Dn {
|
|
6871
6871
|
/**
|
|
6872
6872
|
* @param {string} serverUrl
|
|
6873
6873
|
* @param {string} roomname
|
|
@@ -6884,7 +6884,7 @@ class ra extends Cn {
|
|
|
6884
6884
|
*/
|
|
6885
6885
|
constructor(t, n, s, {
|
|
6886
6886
|
connect: r = !0,
|
|
6887
|
-
awareness: i = new
|
|
6887
|
+
awareness: i = new ta(s),
|
|
6888
6888
|
params: o = {},
|
|
6889
6889
|
protocols: c = [],
|
|
6890
6890
|
WebSocketPolyfill: l = WebSocket,
|
|
@@ -6898,42 +6898,42 @@ class ra extends Cn {
|
|
|
6898
6898
|
setInterval(() => {
|
|
6899
6899
|
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
6900
6900
|
const u = N();
|
|
6901
|
-
m(u,
|
|
6901
|
+
m(u, ut), bn(u, s), this.ws.send(C(u));
|
|
6902
6902
|
}
|
|
6903
6903
|
}, a)), this._bcSubscriber = (u, f) => {
|
|
6904
6904
|
if (f !== this) {
|
|
6905
|
-
const g =
|
|
6906
|
-
|
|
6905
|
+
const g = ri(this, new Uint8Array(u), !1);
|
|
6906
|
+
Tn(g) > 1 && St(this.bcChannel, C(g), this);
|
|
6907
6907
|
}
|
|
6908
6908
|
}, this._updateHandler = (u, f) => {
|
|
6909
6909
|
if (f !== this) {
|
|
6910
6910
|
const g = N();
|
|
6911
|
-
m(g,
|
|
6911
|
+
m(g, ut), Wl(g, u), cn(this, C(g));
|
|
6912
6912
|
}
|
|
6913
6913
|
}, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: u, updated: f, removed: g }, w) => {
|
|
6914
6914
|
const p = u.concat(f).concat(g), y = N();
|
|
6915
6915
|
m(y, xt), E(
|
|
6916
6916
|
y,
|
|
6917
6917
|
Ht(i, p)
|
|
6918
|
-
),
|
|
6918
|
+
), cn(this, C(y));
|
|
6919
6919
|
}, this._exitHandler = () => {
|
|
6920
|
-
|
|
6920
|
+
Zn(
|
|
6921
6921
|
this.awareness,
|
|
6922
6922
|
[s.clientID],
|
|
6923
6923
|
"app closed"
|
|
6924
6924
|
);
|
|
6925
|
-
},
|
|
6925
|
+
}, lt && typeof process != "undefined" && process.on("exit", this._exitHandler), i.on("update", this._awarenessUpdateHandler), this._checkInterval = /** @type {any} */
|
|
6926
6926
|
setInterval(() => {
|
|
6927
|
-
this.wsconnected &&
|
|
6927
|
+
this.wsconnected && xs < ct() - this.wsLastMessageReceived && kn(
|
|
6928
6928
|
this,
|
|
6929
6929
|
/** @type {WebSocket} */
|
|
6930
6930
|
this.ws,
|
|
6931
6931
|
null
|
|
6932
6932
|
);
|
|
6933
|
-
},
|
|
6933
|
+
}, xs / 10), r && this.connect();
|
|
6934
6934
|
}
|
|
6935
6935
|
get url() {
|
|
6936
|
-
const t =
|
|
6936
|
+
const t = na(this.params);
|
|
6937
6937
|
return this.serverUrl + "/" + this.roomname + (t.length === 0 ? "" : "?" + t);
|
|
6938
6938
|
}
|
|
6939
6939
|
/**
|
|
@@ -6946,18 +6946,18 @@ class ra extends Cn {
|
|
|
6946
6946
|
this._synced !== t && (this._synced = t, this.emit("synced", [t]), this.emit("sync", [t]));
|
|
6947
6947
|
}
|
|
6948
6948
|
destroy() {
|
|
6949
|
-
this._resyncInterval !== 0 && clearInterval(this._resyncInterval), clearInterval(this._checkInterval), this.disconnect(),
|
|
6949
|
+
this._resyncInterval !== 0 && clearInterval(this._resyncInterval), clearInterval(this._checkInterval), this.disconnect(), lt && typeof process != "undefined" && process.off("exit", this._exitHandler), this.awareness.off("update", this._awarenessUpdateHandler), this.doc.off("update", this._updateHandler), super.destroy();
|
|
6950
6950
|
}
|
|
6951
6951
|
connectBc() {
|
|
6952
6952
|
if (this.disableBc)
|
|
6953
6953
|
return;
|
|
6954
|
-
this.bcconnected || (
|
|
6954
|
+
this.bcconnected || (Gl(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
|
|
6955
6955
|
const t = N();
|
|
6956
|
-
m(t,
|
|
6956
|
+
m(t, ut), bn(t, this.doc), St(this.bcChannel, C(t), this);
|
|
6957
6957
|
const n = N();
|
|
6958
|
-
m(n,
|
|
6958
|
+
m(n, ut), ei(n, this.doc), St(this.bcChannel, C(n), this);
|
|
6959
6959
|
const s = N();
|
|
6960
|
-
m(s,
|
|
6960
|
+
m(s, si), St(
|
|
6961
6961
|
this.bcChannel,
|
|
6962
6962
|
C(s),
|
|
6963
6963
|
this
|
|
@@ -6981,16 +6981,16 @@ class ra extends Cn {
|
|
|
6981
6981
|
Ht(this.awareness, [
|
|
6982
6982
|
this.doc.clientID
|
|
6983
6983
|
], /* @__PURE__ */ new Map())
|
|
6984
|
-
),
|
|
6984
|
+
), cn(this, C(t)), this.bcconnected && (Jl(this.bcChannel, this._bcSubscriber), this.bcconnected = !1);
|
|
6985
6985
|
}
|
|
6986
6986
|
disconnect() {
|
|
6987
|
-
this.shouldConnect = !1, this.disconnectBc(), this.ws !== null &&
|
|
6987
|
+
this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && kn(this, this.ws, null);
|
|
6988
6988
|
}
|
|
6989
6989
|
connect() {
|
|
6990
|
-
this.shouldConnect = !0, !this.wsconnected && this.ws === null && (
|
|
6990
|
+
this.shouldConnect = !0, !this.wsconnected && this.ws === null && (ii(this), this.connectBc());
|
|
6991
6991
|
}
|
|
6992
6992
|
}
|
|
6993
|
-
const
|
|
6993
|
+
const oi = "data-collab-blocked", ci = /^[a-z][a-z0-9-]*$/, oa = /^[a-z_:][-a-z0-9_:.]*$/i, ca = /* @__PURE__ */ new Set([
|
|
6994
6994
|
"script",
|
|
6995
6995
|
"style",
|
|
6996
6996
|
"iframe",
|
|
@@ -7005,7 +7005,7 @@ const ii = "data-collab-blocked", oi = /^[a-z][a-z0-9-]*$/, ia = /^[a-z_:][-a-z0
|
|
|
7005
7005
|
"noscript",
|
|
7006
7006
|
"template",
|
|
7007
7007
|
"portal"
|
|
7008
|
-
]),
|
|
7008
|
+
]), la = /* @__PURE__ */ new Set([
|
|
7009
7009
|
"href",
|
|
7010
7010
|
"src",
|
|
7011
7011
|
"xlink:href",
|
|
@@ -7022,12 +7022,12 @@ const ii = "data-collab-blocked", oi = /^[a-z][a-z0-9-]*$/, ia = /^[a-z_:][-a-z0
|
|
|
7022
7022
|
"usemap",
|
|
7023
7023
|
"lowsrc",
|
|
7024
7024
|
"dynsrc"
|
|
7025
|
-
]),
|
|
7026
|
-
function ha(e) {
|
|
7027
|
-
const t = e.replace(aa, "").toLowerCase();
|
|
7028
|
-
return /^(?:javascript|vbscript|livescript|mocha):/.test(t) ? !1 : t.startsWith("data:") ? la.test(t) : !0;
|
|
7029
|
-
}
|
|
7025
|
+
]), aa = /^data:image\/(?:png|gif|jpe?g|webp|avif|bmp|x-icon);/, ha = new RegExp("[\\u0000-\\u0020\\u007f-\\u009f\\u00ad\\u200b-\\u200f\\u2028\\u2029\\ufeff]", "g");
|
|
7030
7026
|
function ua(e) {
|
|
7027
|
+
const t = e.replace(ha, "").toLowerCase();
|
|
7028
|
+
return /^(?:javascript|vbscript|livescript|mocha):/.test(t) ? !1 : t.startsWith("data:") ? aa.test(t) : !0;
|
|
7029
|
+
}
|
|
7030
|
+
function da(e) {
|
|
7031
7031
|
var n;
|
|
7032
7032
|
if (!("data-editora-embed" in e)) return !1;
|
|
7033
7033
|
const t = (n = e.src) == null ? void 0 : n.trim();
|
|
@@ -7039,29 +7039,29 @@ function ua(e) {
|
|
|
7039
7039
|
return !1;
|
|
7040
7040
|
}
|
|
7041
7041
|
}
|
|
7042
|
-
function
|
|
7042
|
+
function fa(e, t) {
|
|
7043
7043
|
const n = e.toLowerCase();
|
|
7044
|
-
return
|
|
7044
|
+
return ci.test(n) ? n === "iframe" ? !da(t) : ca.has(n) : !0;
|
|
7045
7045
|
}
|
|
7046
|
-
function
|
|
7047
|
-
if (!
|
|
7046
|
+
function li(e, t) {
|
|
7047
|
+
if (!oa.test(e)) return !1;
|
|
7048
7048
|
const n = e.toLowerCase();
|
|
7049
|
-
return n.startsWith("on") || n === "srcdoc" ? !1 :
|
|
7049
|
+
return n.startsWith("on") || n === "srcdoc" ? !1 : la.has(n) ? ua(String(t)) : !0;
|
|
7050
7050
|
}
|
|
7051
|
-
function
|
|
7051
|
+
function ga(e, t) {
|
|
7052
7052
|
const n = e.createElement("span");
|
|
7053
|
-
return n.setAttribute(
|
|
7053
|
+
return n.setAttribute(oi, ci.test(t.toLowerCase()) ? t.toLowerCase().slice(0, 32) : "invalid"), n.hidden = !0, n;
|
|
7054
7054
|
}
|
|
7055
7055
|
function Ie(e) {
|
|
7056
|
-
return e.nodeType === Node.ELEMENT_NODE && e.hasAttribute(
|
|
7056
|
+
return e.nodeType === Node.ELEMENT_NODE && e.hasAttribute(oi);
|
|
7057
7057
|
}
|
|
7058
|
-
function
|
|
7058
|
+
function pa(e) {
|
|
7059
7059
|
return e instanceof Z || e instanceof Q;
|
|
7060
7060
|
}
|
|
7061
|
-
function
|
|
7062
|
-
return e.toArray().filter(
|
|
7061
|
+
function ts(e) {
|
|
7062
|
+
return e.toArray().filter(pa);
|
|
7063
7063
|
}
|
|
7064
|
-
function
|
|
7064
|
+
function wa(e, t) {
|
|
7065
7065
|
if (e === t) return null;
|
|
7066
7066
|
let n = 0;
|
|
7067
7067
|
const s = Math.min(e.length, t.length);
|
|
@@ -7075,75 +7075,75 @@ function pa(e, t) {
|
|
|
7075
7075
|
insertText: t.slice(n, t.length - r)
|
|
7076
7076
|
};
|
|
7077
7077
|
}
|
|
7078
|
-
function
|
|
7078
|
+
function ma(e) {
|
|
7079
7079
|
const t = new Q(e.tagName.toLowerCase());
|
|
7080
7080
|
for (const s of Array.from(e.attributes))
|
|
7081
7081
|
t.setAttribute(s.name, s.value);
|
|
7082
|
-
const n =
|
|
7082
|
+
const n = ai(e.childNodes);
|
|
7083
7083
|
return n.length && t.insert(0, n), t;
|
|
7084
7084
|
}
|
|
7085
|
-
function
|
|
7085
|
+
function ai(e) {
|
|
7086
7086
|
var n;
|
|
7087
7087
|
const t = [];
|
|
7088
7088
|
for (const s of Array.from(e))
|
|
7089
|
-
s.nodeType === Node.TEXT_NODE ? t.push(new Z((n = s.textContent) != null ? n : "")) : s.nodeType === Node.ELEMENT_NODE && t.push(
|
|
7089
|
+
s.nodeType === Node.TEXT_NODE ? t.push(new Z((n = s.textContent) != null ? n : "")) : s.nodeType === Node.ELEMENT_NODE && t.push(ma(s));
|
|
7090
7090
|
return t;
|
|
7091
7091
|
}
|
|
7092
|
-
function
|
|
7093
|
-
return
|
|
7092
|
+
function hi(e) {
|
|
7093
|
+
return fa(e.nodeName, e.getAttributes());
|
|
7094
7094
|
}
|
|
7095
|
-
function
|
|
7096
|
-
if (
|
|
7095
|
+
function ya(e, t) {
|
|
7096
|
+
if (hi(e)) return ga(t, e.nodeName);
|
|
7097
7097
|
const n = t.createElement(e.nodeName);
|
|
7098
7098
|
for (const [s, r] of Object.entries(e.getAttributes()))
|
|
7099
|
-
|
|
7100
|
-
for (const s of
|
|
7101
|
-
n.appendChild(
|
|
7099
|
+
li(s, r) && n.setAttribute(s, r);
|
|
7100
|
+
for (const s of ts(e))
|
|
7101
|
+
n.appendChild(ui(s, t));
|
|
7102
7102
|
return n;
|
|
7103
7103
|
}
|
|
7104
|
-
function hi(e, t) {
|
|
7105
|
-
return e instanceof Z ? t.createTextNode(e.toString()) : ma(e, t);
|
|
7106
|
-
}
|
|
7107
7104
|
function ui(e, t) {
|
|
7108
|
-
return
|
|
7105
|
+
return e instanceof Z ? t.createTextNode(e.toString()) : ya(e, t);
|
|
7106
|
+
}
|
|
7107
|
+
function di(e, t) {
|
|
7108
|
+
return hi(t) ? Ie(e) : !Ie(e) && e.tagName.toLowerCase() === t.nodeName.toLowerCase();
|
|
7109
7109
|
}
|
|
7110
|
-
function
|
|
7110
|
+
function _n(e, t) {
|
|
7111
7111
|
var o;
|
|
7112
7112
|
const n = Array.from(t.childNodes).filter(
|
|
7113
7113
|
(c) => c.nodeType === Node.TEXT_NODE || c.nodeType === Node.ELEMENT_NODE
|
|
7114
|
-
), s =
|
|
7114
|
+
), s = ts(e), r = Math.min(n.length, s.length);
|
|
7115
7115
|
let i = 0;
|
|
7116
7116
|
for (; i < r; i++) {
|
|
7117
7117
|
const c = n[i], l = s[i];
|
|
7118
7118
|
if (c.nodeType === Node.TEXT_NODE) {
|
|
7119
7119
|
if (l instanceof Z) {
|
|
7120
|
-
const a =
|
|
7120
|
+
const a = wa(l.toString(), (o = c.textContent) != null ? o : "");
|
|
7121
7121
|
a && (a.deleteCount > 0 && l.delete(a.start, a.deleteCount), a.insertText && l.insert(a.start, a.insertText));
|
|
7122
7122
|
continue;
|
|
7123
7123
|
}
|
|
7124
7124
|
break;
|
|
7125
7125
|
}
|
|
7126
|
-
if (l instanceof Q &&
|
|
7126
|
+
if (l instanceof Q && di(c, l)) {
|
|
7127
7127
|
if (Ie(c)) continue;
|
|
7128
|
-
|
|
7128
|
+
ba(l, c), _n(l, c);
|
|
7129
7129
|
continue;
|
|
7130
7130
|
}
|
|
7131
7131
|
break;
|
|
7132
7132
|
}
|
|
7133
7133
|
if (i < s.length && e.delete(i, s.length - i), i < n.length) {
|
|
7134
|
-
const c =
|
|
7134
|
+
const c = ai(n.slice(i));
|
|
7135
7135
|
c.length && e.insert(i, c);
|
|
7136
7136
|
}
|
|
7137
7137
|
}
|
|
7138
|
-
function
|
|
7138
|
+
function ba(e, t) {
|
|
7139
7139
|
const n = e.getAttributes(), s = new Set(Array.from(t.attributes).map((r) => r.name));
|
|
7140
7140
|
for (const r of Object.keys(n))
|
|
7141
7141
|
s.has(r) || e.removeAttribute(r);
|
|
7142
7142
|
for (const r of Array.from(t.attributes))
|
|
7143
7143
|
n[r.name] !== r.value && e.setAttribute(r.name, r.value);
|
|
7144
7144
|
}
|
|
7145
|
-
function
|
|
7146
|
-
const s =
|
|
7145
|
+
function fi(e, t, n) {
|
|
7146
|
+
const s = ts(t), r = Array.from(e.childNodes).filter(
|
|
7147
7147
|
(c) => c.nodeType === Node.TEXT_NODE || c.nodeType === Node.ELEMENT_NODE
|
|
7148
7148
|
), i = Math.min(s.length, r.length);
|
|
7149
7149
|
let o = 0;
|
|
@@ -7157,9 +7157,9 @@ function di(e, t, n) {
|
|
|
7157
7157
|
}
|
|
7158
7158
|
break;
|
|
7159
7159
|
}
|
|
7160
|
-
if (l.nodeType === Node.ELEMENT_NODE &&
|
|
7160
|
+
if (l.nodeType === Node.ELEMENT_NODE && di(l, c)) {
|
|
7161
7161
|
if (Ie(l)) continue;
|
|
7162
|
-
|
|
7162
|
+
ka(l, c), fi(l, c, n);
|
|
7163
7163
|
continue;
|
|
7164
7164
|
}
|
|
7165
7165
|
break;
|
|
@@ -7167,29 +7167,29 @@ function di(e, t, n) {
|
|
|
7167
7167
|
for (let c = r.length - 1; c >= o; c--)
|
|
7168
7168
|
e.removeChild(r[c]);
|
|
7169
7169
|
for (let c = o; c < s.length; c++)
|
|
7170
|
-
e.appendChild(
|
|
7170
|
+
e.appendChild(ui(s[c], n));
|
|
7171
7171
|
}
|
|
7172
|
-
function
|
|
7172
|
+
function ka(e, t) {
|
|
7173
7173
|
const n = t.getAttributes(), s = new Set(Array.from(e.attributes).map((r) => r.name));
|
|
7174
7174
|
for (const r of s)
|
|
7175
7175
|
r in n || e.removeAttribute(r);
|
|
7176
7176
|
for (const [r, i] of Object.entries(n)) {
|
|
7177
|
-
if (!
|
|
7177
|
+
if (!li(r, i)) {
|
|
7178
7178
|
e.removeAttribute(r);
|
|
7179
7179
|
continue;
|
|
7180
7180
|
}
|
|
7181
7181
|
e.getAttribute(r) !== i && e.setAttribute(r, i);
|
|
7182
7182
|
}
|
|
7183
7183
|
}
|
|
7184
|
-
class
|
|
7184
|
+
class _a {
|
|
7185
7185
|
constructor(t, n, s) {
|
|
7186
7186
|
this.root = t, this.doc = n, this.fragment = s, this.pending = !1, this.destroyed = !1, this.onFragmentChange = (r, i) => {
|
|
7187
7187
|
i.origin !== this && this.applyRemoteToDom();
|
|
7188
|
-
}, this.observer = new MutationObserver(() => this.scheduleLocalSync()), this.fragment.length === 0 && this.root.childNodes.length > 0 ? this.doc.transact(() =>
|
|
7188
|
+
}, this.observer = new MutationObserver(() => this.scheduleLocalSync()), this.fragment.length === 0 && this.root.childNodes.length > 0 ? this.doc.transact(() => _n(this.fragment, this.root), this) : this.applyRemoteToDom(), this.observer.observe(this.root, { childList: !0, characterData: !0, subtree: !0, attributes: !0 }), this.fragment.observeDeep(this.onFragmentChange);
|
|
7189
7189
|
}
|
|
7190
7190
|
scheduleLocalSync() {
|
|
7191
7191
|
this.pending || (this.pending = !0, queueMicrotask(() => {
|
|
7192
|
-
this.pending = !1, !this.destroyed && this.doc.transact(() =>
|
|
7192
|
+
this.pending = !1, !this.destroyed && this.doc.transact(() => _n(this.fragment, this.root), this);
|
|
7193
7193
|
}));
|
|
7194
7194
|
}
|
|
7195
7195
|
applyRemoteToDom() {
|
|
@@ -7197,7 +7197,7 @@ class ka {
|
|
|
7197
7197
|
const t = this.captureSelection();
|
|
7198
7198
|
this.observer.disconnect(), this.root.dispatchEvent(new CustomEvent("provenance:expect", { detail: { kind: "collaborator", timeoutMs: 1e3 }, bubbles: !0 }));
|
|
7199
7199
|
try {
|
|
7200
|
-
|
|
7200
|
+
fi(this.root, this.fragment, this.root.ownerDocument), this.root.dispatchEvent(new Event("input", { bubbles: !0, composed: !0 }));
|
|
7201
7201
|
} finally {
|
|
7202
7202
|
this.observer.observe(this.root, { childList: !0, characterData: !0, subtree: !0, attributes: !0 });
|
|
7203
7203
|
}
|
|
@@ -7247,11 +7247,11 @@ class ka {
|
|
|
7247
7247
|
this.destroyed = !0, this.observer.disconnect(), this.fragment.unobserveDeep(this.onFragmentChange);
|
|
7248
7248
|
}
|
|
7249
7249
|
}
|
|
7250
|
-
const
|
|
7251
|
-
function
|
|
7252
|
-
if (typeof document == "undefined" || document.getElementById(
|
|
7250
|
+
const Is = "editora-collaboration-cursor-styles";
|
|
7251
|
+
function Sa() {
|
|
7252
|
+
if (typeof document == "undefined" || document.getElementById(Is)) return;
|
|
7253
7253
|
const e = document.createElement("style");
|
|
7254
|
-
e.id =
|
|
7254
|
+
e.id = Is, e.textContent = `
|
|
7255
7255
|
.editora-collab-caret {
|
|
7256
7256
|
position: fixed;
|
|
7257
7257
|
width: 2px;
|
|
@@ -7280,31 +7280,31 @@ function _a() {
|
|
|
7280
7280
|
}
|
|
7281
7281
|
`, document.head.appendChild(e);
|
|
7282
7282
|
}
|
|
7283
|
-
const
|
|
7284
|
-
function
|
|
7283
|
+
const Ca = /^(?:#[0-9a-f]{3,8}|[a-z]{3,20}|(?:rgb|hsl)a?\([\d\s.,%/-]+\))$/i, Ea = "#64748b";
|
|
7284
|
+
function gi(e) {
|
|
7285
7285
|
if (!e || typeof e != "object") return null;
|
|
7286
7286
|
const { name: t, color: n } = e;
|
|
7287
7287
|
return typeof t != "string" || t.length === 0 ? null : {
|
|
7288
7288
|
name: t.slice(0, 64),
|
|
7289
|
-
color: typeof n == "string" &&
|
|
7289
|
+
color: typeof n == "string" && Ca.test(n.trim()) ? n.trim() : Ea
|
|
7290
7290
|
};
|
|
7291
7291
|
}
|
|
7292
|
-
function
|
|
7292
|
+
function Ls(e) {
|
|
7293
7293
|
return Array.isArray(e) && e.length <= 256 && e.every((t) => Number.isInteger(t) && t >= 0);
|
|
7294
7294
|
}
|
|
7295
|
-
function
|
|
7295
|
+
function Da(e) {
|
|
7296
7296
|
if (!e || typeof e != "object") return null;
|
|
7297
7297
|
const t = e;
|
|
7298
|
-
if (!
|
|
7298
|
+
if (!Ls(t.anchorPath)) return null;
|
|
7299
7299
|
const n = (s) => typeof s == "number" && Number.isFinite(s) && s >= 0 ? Math.floor(s) : 0;
|
|
7300
7300
|
return {
|
|
7301
7301
|
anchorPath: t.anchorPath,
|
|
7302
7302
|
anchorOffset: n(t.anchorOffset),
|
|
7303
|
-
focusPath:
|
|
7303
|
+
focusPath: Ls(t.focusPath) ? t.focusPath : void 0,
|
|
7304
7304
|
focusOffset: n(t.focusOffset)
|
|
7305
7305
|
};
|
|
7306
7306
|
}
|
|
7307
|
-
function
|
|
7307
|
+
function vs(e, t) {
|
|
7308
7308
|
let n = e;
|
|
7309
7309
|
for (const s of t) {
|
|
7310
7310
|
const r = n.childNodes[s];
|
|
@@ -7313,7 +7313,7 @@ function Ls(e, t) {
|
|
|
7313
7313
|
}
|
|
7314
7314
|
return n;
|
|
7315
7315
|
}
|
|
7316
|
-
function
|
|
7316
|
+
function Os(e, t, n) {
|
|
7317
7317
|
if (!e.contains(t)) return null;
|
|
7318
7318
|
const s = [];
|
|
7319
7319
|
let r = t;
|
|
@@ -7324,9 +7324,9 @@ function vs(e, t, n) {
|
|
|
7324
7324
|
}
|
|
7325
7325
|
return { path: s, offset: n };
|
|
7326
7326
|
}
|
|
7327
|
-
class
|
|
7327
|
+
class Aa {
|
|
7328
7328
|
constructor(t, n, s) {
|
|
7329
|
-
this.root = t, this.awareness = n, this.user = s, this.caretElements = /* @__PURE__ */ new Map(), this.pendingBroadcast = !1, this.onSelectionChange = () => this.scheduleBroadcast(), this.onAwarenessChange = () => this.renderRemoteCursors(), this.onViewportChange = () => this.renderRemoteCursors(),
|
|
7329
|
+
this.root = t, this.awareness = n, this.user = s, this.caretElements = /* @__PURE__ */ new Map(), this.pendingBroadcast = !1, this.onSelectionChange = () => this.scheduleBroadcast(), this.onAwarenessChange = () => this.renderRemoteCursors(), this.onViewportChange = () => this.renderRemoteCursors(), Sa(), this.awareness.setLocalStateField("user", this.user), document.addEventListener("selectionchange", this.onSelectionChange), this.awareness.on("change", this.onAwarenessChange), window.addEventListener("scroll", this.onViewportChange, !0), window.addEventListener("resize", this.onViewportChange);
|
|
7330
7330
|
}
|
|
7331
7331
|
scheduleBroadcast() {
|
|
7332
7332
|
this.pendingBroadcast || (this.pendingBroadcast = !0, queueMicrotask(() => {
|
|
@@ -7343,7 +7343,7 @@ class Da {
|
|
|
7343
7343
|
this.awareness.setLocalStateField("cursor", null);
|
|
7344
7344
|
return;
|
|
7345
7345
|
}
|
|
7346
|
-
const n =
|
|
7346
|
+
const n = Os(this.root, t.anchorNode, t.anchorOffset), s = Os(this.root, t.focusNode, t.focusOffset);
|
|
7347
7347
|
if (!n || !s) return;
|
|
7348
7348
|
const r = {
|
|
7349
7349
|
anchorPath: n.path,
|
|
@@ -7357,7 +7357,7 @@ class Da {
|
|
|
7357
7357
|
const t = this.awareness.getStates(), n = /* @__PURE__ */ new Set();
|
|
7358
7358
|
t.forEach((s, r) => {
|
|
7359
7359
|
if (r === this.awareness.clientID) return;
|
|
7360
|
-
const i =
|
|
7360
|
+
const i = gi(s == null ? void 0 : s.user), o = Da(s == null ? void 0 : s.cursor);
|
|
7361
7361
|
if (!i || !o) {
|
|
7362
7362
|
this.removeCursor(r);
|
|
7363
7363
|
return;
|
|
@@ -7369,7 +7369,7 @@ class Da {
|
|
|
7369
7369
|
}
|
|
7370
7370
|
renderCursor(t, n, s) {
|
|
7371
7371
|
var c, l, a;
|
|
7372
|
-
const r =
|
|
7372
|
+
const r = vs(this.root, s.anchorPath);
|
|
7373
7373
|
if (!r) {
|
|
7374
7374
|
this.removeCursor(t);
|
|
7375
7375
|
return;
|
|
@@ -7390,7 +7390,7 @@ class Da {
|
|
|
7390
7390
|
h.setStart(r, d), h.setEnd(r, d);
|
|
7391
7391
|
const u = h.getBoundingClientRect();
|
|
7392
7392
|
if (i.caret.style.top = `${u.top}px`, i.caret.style.left = `${u.left}px`, i.caret.style.height = `${u.height || 16}px`, s.focusPath) {
|
|
7393
|
-
const f =
|
|
7393
|
+
const f = vs(this.root, s.focusPath);
|
|
7394
7394
|
if (f) {
|
|
7395
7395
|
const g = Math.min((l = s.focusOffset) != null ? l : 0, ((a = f.textContent) != null ? a : "").length), w = document.createRange();
|
|
7396
7396
|
w.setStart(r, d), w.setEnd(f, g);
|
|
@@ -7412,68 +7412,75 @@ class Da {
|
|
|
7412
7412
|
for (const t of Array.from(this.caretElements.keys())) this.removeCursor(t);
|
|
7413
7413
|
}
|
|
7414
7414
|
}
|
|
7415
|
-
const
|
|
7416
|
-
let
|
|
7417
|
-
function
|
|
7418
|
-
|
|
7415
|
+
const Ta = "editora-content", pi = "wss://demos.yjs.dev", xa = "demos.yjs.dev", Ia = "editora-default-room", Ns = ["#f97316", "#0ea5e9", "#22c55e", "#a855f7", "#ec4899", "#eab308", "#14b8a6", "#ef4444"], at = /* @__PURE__ */ new WeakMap(), Je = /* @__PURE__ */ new Set(), tt = /* @__PURE__ */ new Set(), Le = /* @__PURE__ */ new Map();
|
|
7416
|
+
let Ms = !1, Us = !1;
|
|
7417
|
+
function La(e, t) {
|
|
7418
|
+
Ms || (Ms = !0, console.warn(
|
|
7419
7419
|
`[@editora/collaboration] Room "${e}" is syncing through the public demo server (${t}); anyone who knows the room name can read and edit this document. Use it for demos only: pass your own y-websocket server via the websocketUrl option (or a provider) for real use.`
|
|
7420
7420
|
));
|
|
7421
7421
|
}
|
|
7422
|
-
function
|
|
7422
|
+
function va(e) {
|
|
7423
7423
|
try {
|
|
7424
|
-
return new URL(e).hostname ===
|
|
7424
|
+
return new URL(e).hostname === xa;
|
|
7425
7425
|
} catch (t) {
|
|
7426
7426
|
return !1;
|
|
7427
7427
|
}
|
|
7428
7428
|
}
|
|
7429
|
-
function
|
|
7429
|
+
function wi(e) {
|
|
7430
7430
|
return (typeof e.websocketUrl == "string" ? e.websocketUrl.trim() : "") || void 0;
|
|
7431
7431
|
}
|
|
7432
|
-
function
|
|
7433
|
-
return e.provider ||
|
|
7432
|
+
function Oa(e) {
|
|
7433
|
+
return e.provider || wi(e) ? !0 : e.allowPublicDemoServer === !0;
|
|
7434
7434
|
}
|
|
7435
|
-
function
|
|
7436
|
-
|
|
7437
|
-
`[@editora/collaboration] Not connecting: no websocketUrl or provider was configured. This plugin used to fall back to the public Yjs demo server (${
|
|
7435
|
+
function Na() {
|
|
7436
|
+
Us || (Us = !0, console.warn(
|
|
7437
|
+
`[@editora/collaboration] Not connecting: no websocketUrl or provider was configured. This plugin used to fall back to the public Yjs demo server (${pi}), where anyone who knows the room name can read and edit the document, so it now stays off until you pass your own y-websocket server via the websocketUrl option (or a provider). For a throwaway demo only, set allowPublicDemoServer: true.`
|
|
7438
7438
|
));
|
|
7439
7439
|
}
|
|
7440
|
-
function
|
|
7440
|
+
function Rs() {
|
|
7441
7441
|
const e = Math.floor(Math.random() * 1e4);
|
|
7442
7442
|
return {
|
|
7443
7443
|
name: `Guest ${e}`,
|
|
7444
|
-
color:
|
|
7444
|
+
color: Ns[e % Ns.length]
|
|
7445
7445
|
};
|
|
7446
7446
|
}
|
|
7447
|
-
let
|
|
7448
|
-
const Ct = [],
|
|
7449
|
-
let
|
|
7450
|
-
function Ma(e) {
|
|
7451
|
-
return e.matches(wi);
|
|
7452
|
-
}
|
|
7447
|
+
let Ma = 1;
|
|
7448
|
+
const Ct = [], mi = ".rte-content, .editora-content, [contenteditable]";
|
|
7449
|
+
let ln = null;
|
|
7453
7450
|
function Ua(e) {
|
|
7451
|
+
return e.matches(mi);
|
|
7452
|
+
}
|
|
7453
|
+
function Ra(e) {
|
|
7454
7454
|
const t = [];
|
|
7455
|
-
return e instanceof HTMLElement &&
|
|
7456
|
-
n instanceof HTMLElement && !
|
|
7455
|
+
return e instanceof HTMLElement && Ua(e) && !at.has(e) && !tt.has(e) && t.push(e), e.querySelectorAll(mi).forEach((n) => {
|
|
7456
|
+
n instanceof HTMLElement && !at.has(n) && !tt.has(n) && t.push(n);
|
|
7457
7457
|
}), t;
|
|
7458
7458
|
}
|
|
7459
|
-
function
|
|
7459
|
+
function yi() {
|
|
7460
7460
|
if (Ct.length === 0 || typeof document == "undefined") return;
|
|
7461
|
-
const e =
|
|
7461
|
+
const e = Ra(document.body);
|
|
7462
7462
|
for (const t of e) {
|
|
7463
7463
|
const n = Ct.find((s) => !s.claimed);
|
|
7464
7464
|
if (!n) break;
|
|
7465
|
-
n.claimed = !0,
|
|
7465
|
+
n.claimed = !0, n.element = t, Ha(t, n.options);
|
|
7466
7466
|
}
|
|
7467
7467
|
for (; Ct.length && Ct[0].claimed; ) Ct.shift();
|
|
7468
7468
|
}
|
|
7469
|
-
function
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
const t = { id: Na++, options: e, claimed: !1 };
|
|
7474
|
-
return Ct.push(t), Ra(), mi(), t;
|
|
7469
|
+
function $a() {
|
|
7470
|
+
(/* @__PURE__ */ new Set([...Je, ...tt])).forEach((t) => {
|
|
7471
|
+
t.isConnected || Sn(t);
|
|
7472
|
+
});
|
|
7475
7473
|
}
|
|
7476
7474
|
function Ba() {
|
|
7475
|
+
ln || typeof document == "undefined" || typeof MutationObserver == "undefined" || (ln = new MutationObserver(() => {
|
|
7476
|
+
$a(), yi();
|
|
7477
|
+
}), ln.observe(document.body, { childList: !0, subtree: !0 }));
|
|
7478
|
+
}
|
|
7479
|
+
function Fa(e) {
|
|
7480
|
+
const t = { id: Ma++, options: e, claimed: !1 };
|
|
7481
|
+
return Ct.push(t), Ba(), yi(), t;
|
|
7482
|
+
}
|
|
7483
|
+
function Va() {
|
|
7477
7484
|
const e = "editora-collaboration-presence-styles";
|
|
7478
7485
|
if (typeof document == "undefined" || document.getElementById(e)) return;
|
|
7479
7486
|
const t = document.createElement("style");
|
|
@@ -7514,8 +7521,8 @@ function Ba() {
|
|
|
7514
7521
|
}
|
|
7515
7522
|
`, document.head.appendChild(t);
|
|
7516
7523
|
}
|
|
7517
|
-
function
|
|
7518
|
-
|
|
7524
|
+
function ja() {
|
|
7525
|
+
Va();
|
|
7519
7526
|
const e = document.createElement("div");
|
|
7520
7527
|
e.className = "editora-collab-presence";
|
|
7521
7528
|
const t = document.createElement("span");
|
|
@@ -7530,35 +7537,35 @@ function pe(e, t, n) {
|
|
|
7530
7537
|
if (!r) return;
|
|
7531
7538
|
r.innerHTML = "", n.getStates().forEach((o, c) => {
|
|
7532
7539
|
if (c === n.clientID) return;
|
|
7533
|
-
const l =
|
|
7540
|
+
const l = gi(o == null ? void 0 : o.user);
|
|
7534
7541
|
if (!l) return;
|
|
7535
7542
|
const a = document.createElement("span");
|
|
7536
7543
|
a.className = "editora-collab-presence__avatar", a.style.backgroundColor = l.color, a.title = l.name, a.textContent = Array.from(l.name)[0].toUpperCase(), r.appendChild(a);
|
|
7537
7544
|
});
|
|
7538
7545
|
}
|
|
7539
|
-
function
|
|
7546
|
+
function Ha(e, t) {
|
|
7540
7547
|
var f, g, w, p, y, v, Vt;
|
|
7541
|
-
if (
|
|
7542
|
-
|
|
7543
|
-
const n = (w = (g = t.doc) != null ? g : (f = t.provider) == null ? void 0 : f.doc) != null ? w : new yt(), s = !t.doc && !t.provider, r = typeof t.roomName == "function" ? t.roomName(e) : t.roomName || e.id ||
|
|
7544
|
-
i &&
|
|
7545
|
-
const c = (y = t.provider) != null ? y : new
|
|
7546
|
-
name: (v = t.userName) != null ? v :
|
|
7547
|
-
color: (Vt = t.userColor) != null ? Vt :
|
|
7548
|
-
}, a =
|
|
7548
|
+
if (at.has(e) || tt.has(e)) return;
|
|
7549
|
+
tt.add(e);
|
|
7550
|
+
const n = (w = (g = t.doc) != null ? g : (f = t.provider) == null ? void 0 : f.doc) != null ? w : new yt(), s = !t.doc && !t.provider, r = typeof t.roomName == "function" ? t.roomName(e) : t.roomName || e.id || Ia, i = !t.provider, o = (p = wi(t)) != null ? p : pi;
|
|
7551
|
+
i && va(o) && La(r, o);
|
|
7552
|
+
const c = (y = t.provider) != null ? y : new ia(o, r, n), l = {
|
|
7553
|
+
name: (v = t.userName) != null ? v : Rs().name,
|
|
7554
|
+
color: (Vt = t.userColor) != null ? Vt : Rs().color
|
|
7555
|
+
}, a = ja();
|
|
7549
7556
|
e.insertAdjacentElement("beforebegin", a), pe(a, "connecting", c.awareness);
|
|
7550
|
-
const h = ({ status:
|
|
7557
|
+
const h = ({ status: Ke }) => pe(a, Ke, c.awareness), d = () => pe(a, c.wsconnected ? "connected" : "connecting", c.awareness);
|
|
7551
7558
|
c.on("status", h), c.awareness.on("change", d);
|
|
7552
|
-
const u = (
|
|
7553
|
-
|
|
7559
|
+
const u = (Ke) => {
|
|
7560
|
+
Ke && (c.off("sync", u), Le.delete(e), za(e, n, c, i, s, l, a, h, d));
|
|
7554
7561
|
};
|
|
7555
7562
|
Le.set(e, () => {
|
|
7556
7563
|
c.off("sync", u), c.off("status", h), c.awareness.off("change", d), a.remove(), i && c.destroy(), s && n.destroy();
|
|
7557
7564
|
}), c.synced ? u(!0) : c.on("sync", u);
|
|
7558
7565
|
}
|
|
7559
|
-
function
|
|
7560
|
-
if (
|
|
7561
|
-
const a = t.getXmlFragment(
|
|
7566
|
+
function za(e, t, n, s, r, i, o, c, l) {
|
|
7567
|
+
if (tt.delete(e), at.has(e)) return;
|
|
7568
|
+
const a = t.getXmlFragment(Ta), h = new _a(e, t, a), d = new Aa(e, n.awareness, i), u = new Kc(a, { trackedOrigins: /* @__PURE__ */ new Set([h]) });
|
|
7562
7569
|
pe(o, n.wsconnected ? "connected" : "connecting", n.awareness);
|
|
7563
7570
|
const f = (w) => {
|
|
7564
7571
|
(w.metaKey || w.ctrlKey) && (w.key.toLowerCase() === "z" && !w.shiftKey ? (w.preventDefault(), w.stopImmediatePropagation(), u.undo()) : (w.key.toLowerCase() === "z" && w.shiftKey || w.key.toLowerCase() === "y") && (w.preventDefault(), w.stopImmediatePropagation(), u.redo()));
|
|
@@ -7567,38 +7574,43 @@ function ja(e, t, n, s, r, i, o, c, l) {
|
|
|
7567
7574
|
const g = () => {
|
|
7568
7575
|
e.removeEventListener("keydown", f, { capture: !0 }), n.off("status", c), n.awareness.off("change", l), o.remove(), d.destroy();
|
|
7569
7576
|
};
|
|
7570
|
-
|
|
7577
|
+
at.set(e, { doc: t, provider: n, ownsProvider: s, ownsDoc: r, binding: h, undoManager: u, cursorCleanup: g, connectionIndicator: o }), Je.add(e);
|
|
7571
7578
|
}
|
|
7572
|
-
function
|
|
7579
|
+
function Sn(e) {
|
|
7573
7580
|
const t = Le.get(e);
|
|
7574
|
-
t && (t(), Le.delete(e),
|
|
7575
|
-
const n =
|
|
7576
|
-
n && (n.cursorCleanup(), n.binding.destroy(), n.undoManager.destroy(), n.ownsProvider && n.provider.destroy(), n.ownsDoc && n.doc.destroy(),
|
|
7581
|
+
t && (t(), Le.delete(e), tt.delete(e));
|
|
7582
|
+
const n = at.get(e);
|
|
7583
|
+
n && (n.cursorCleanup(), n.binding.destroy(), n.undoManager.destroy(), n.ownsProvider && n.provider.destroy(), n.ownsDoc && n.doc.destroy(), at.delete(e), Je.delete(e));
|
|
7577
7584
|
}
|
|
7578
|
-
const
|
|
7579
|
-
let t = !1;
|
|
7580
|
-
const
|
|
7585
|
+
const Ya = (e = {}) => {
|
|
7586
|
+
let t = null, n = !1;
|
|
7587
|
+
const s = {
|
|
7581
7588
|
name: "collaboration",
|
|
7582
7589
|
init: () => {
|
|
7583
|
-
var
|
|
7584
|
-
if (t)
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7590
|
+
var i;
|
|
7591
|
+
if (t) {
|
|
7592
|
+
if (!t.claimed) return;
|
|
7593
|
+
const o = t.element;
|
|
7594
|
+
if (o && o.isConnected && (at.has(o) || tt.has(o))) return;
|
|
7595
|
+
o && Sn(o), t = null;
|
|
7596
|
+
}
|
|
7597
|
+
if (n) return;
|
|
7598
|
+
const r = { ...e, ...(i = s.__pluginConfig) != null ? i : {} };
|
|
7599
|
+
if (!Oa(r)) {
|
|
7600
|
+
n = !0, Na();
|
|
7589
7601
|
return;
|
|
7590
7602
|
}
|
|
7591
|
-
|
|
7603
|
+
t = Fa(r);
|
|
7592
7604
|
},
|
|
7593
7605
|
commands: {},
|
|
7594
7606
|
destroy: () => {
|
|
7595
|
-
const
|
|
7596
|
-
Array.from(
|
|
7607
|
+
const r = /* @__PURE__ */ new Set([...Je, ...tt]);
|
|
7608
|
+
Array.from(r).forEach((i) => Sn(i));
|
|
7597
7609
|
}
|
|
7598
7610
|
};
|
|
7599
|
-
return
|
|
7611
|
+
return s;
|
|
7600
7612
|
};
|
|
7601
7613
|
export {
|
|
7602
|
-
|
|
7614
|
+
Ya as CollaborationPlugin
|
|
7603
7615
|
};
|
|
7604
|
-
//# sourceMappingURL=CollaborationPlugin.native-
|
|
7616
|
+
//# sourceMappingURL=CollaborationPlugin.native-8gcyVRnR.mjs.map
|