playhtml 0.1.7 → 0.1.9
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 +45 -4
- package/dist/playhtml.es.js +189 -189
- package/dist/playhtml.umd.js +6 -6
- package/package.json +1 -1
package/dist/playhtml.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var tr = Object.defineProperty;
|
|
2
2
|
var er = (e, t, n) => t in e ? tr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
3
|
var _ = (e, t, n) => (er(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
-
const R = () => /* @__PURE__ */ new Map(),
|
|
4
|
+
const R = () => /* @__PURE__ */ new Map(), Me = (e) => {
|
|
5
5
|
const t = R();
|
|
6
6
|
return e.forEach((n, s) => {
|
|
7
7
|
t.set(s, n);
|
|
@@ -19,7 +19,7 @@ const R = () => /* @__PURE__ */ new Map(), xe = (e) => {
|
|
|
19
19
|
if (t(s, n))
|
|
20
20
|
return !0;
|
|
21
21
|
return !1;
|
|
22
|
-
}, rt = () => /* @__PURE__ */ new Set(),
|
|
22
|
+
}, rt = () => /* @__PURE__ */ new Set(), me = (e) => e[e.length - 1], rr = (e, t) => {
|
|
23
23
|
for (let n = 0; n < t.length; n++)
|
|
24
24
|
e.push(t[n]);
|
|
25
25
|
}, Q = Array.from, ir = Array.isArray, or = String.fromCharCode, cr = (e) => e.toLowerCase(), lr = /^\s*/g, ar = (e) => e.replace(lr, ""), hr = /([A-Z])/g, pn = (e, t) => ar(e.replace(hr, (n) => `${t}${cr(n)}`)), ur = (e) => {
|
|
@@ -74,7 +74,7 @@ const Hn = Fn, pr = (e) => $e || addEventListener(
|
|
|
74
74
|
for (const s in e)
|
|
75
75
|
n.push(t(e[s], s));
|
|
76
76
|
return n;
|
|
77
|
-
},
|
|
77
|
+
}, Pt = (e) => yr(e).length, kr = (e) => {
|
|
78
78
|
for (const t in e)
|
|
79
79
|
return !1;
|
|
80
80
|
return !0;
|
|
@@ -83,7 +83,7 @@ const Hn = Fn, pr = (e) => $e || addEventListener(
|
|
|
83
83
|
if (!t(e[n], n))
|
|
84
84
|
return !1;
|
|
85
85
|
return !0;
|
|
86
|
-
}, $n = (e, t) => Object.prototype.hasOwnProperty.call(e, t), Dr = (e, t) => e === t ||
|
|
86
|
+
}, $n = (e, t) => Object.prototype.hasOwnProperty.call(e, t), Dr = (e, t) => e === t || Pt(e) === Pt(t) && Sr(e, (n, s) => (n !== void 0 || $n(t, s)) && t[s] === n), Ke = (e, t, n = 0) => {
|
|
87
87
|
try {
|
|
88
88
|
for (; n < e.length; n++)
|
|
89
89
|
e[n](...t);
|
|
@@ -125,7 +125,7 @@ const Hn = Fn, pr = (e) => $e || addEventListener(
|
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
127
127
|
case Object:
|
|
128
|
-
if (
|
|
128
|
+
if (Pt(e) !== Pt(t))
|
|
129
129
|
return !1;
|
|
130
130
|
for (const n in e)
|
|
131
131
|
if (!$n(e, n) || !xt(e[n], t[n]))
|
|
@@ -163,9 +163,9 @@ const Ar = () => {
|
|
|
163
163
|
}
|
|
164
164
|
})) : N = R();
|
|
165
165
|
return N;
|
|
166
|
-
},
|
|
166
|
+
}, Ue = (e) => Ar().has(e), Te = (e) => wn(yt ? process.env[e.toUpperCase()] : Hn.getItem(e)), Lr = (e) => Ue("--" + e) || Te(e) !== null;
|
|
167
167
|
Lr("production");
|
|
168
|
-
const mn = yt && Ir(process.env.FORCE_COLOR, ["true", "1", "2"]), xr = !
|
|
168
|
+
const mn = yt && Ir(process.env.FORCE_COLOR, ["true", "1", "2"]), xr = !Ue("no-colors") && (!yt || process.stdout.isTTY || mn) && (!yt || Ue("color") || mn || Te("COLORTERM") !== null || (Te("TERM") || "").includes("color")), j = Math.floor, Gt = Math.abs, je = (e, t) => e < t ? e : t, ht = (e, t) => e > t ? e : t, Mr = Math.pow, jn = (e) => e !== 0 ? e < 0 : 1 / e < 0, yn = 1, _n = 2, ye = 4, _e = 8, Tt = 32, K = 64, T = 128, le = 31, ve = 63, nt = 127, Ur = 2147483647, Jn = Number.MAX_SAFE_INTEGER, Tr = Number.isInteger || ((e) => typeof e == "number" && isFinite(e) && j(e) === e);
|
|
169
169
|
class Ft {
|
|
170
170
|
constructor() {
|
|
171
171
|
this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
|
|
@@ -190,20 +190,20 @@ const M = () => new Ft(), Je = (e) => {
|
|
|
190
190
|
}, I = (e, t) => {
|
|
191
191
|
const n = e.cbuf.length;
|
|
192
192
|
e.cpos === n && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(n * 2), e.cpos = 0), e.cbuf[e.cpos++] = t;
|
|
193
|
-
},
|
|
193
|
+
}, Oe = I, p = (e, t) => {
|
|
194
194
|
for (; t > nt; )
|
|
195
195
|
I(e, T | nt & t), t = j(t / 128);
|
|
196
196
|
I(e, nt & t);
|
|
197
197
|
}, Xe = (e, t) => {
|
|
198
198
|
const n = jn(t);
|
|
199
|
-
for (n && (t = -t), I(e, (t >
|
|
199
|
+
for (n && (t = -t), I(e, (t > ve ? T : 0) | (n ? K : 0) | ve & t), t = j(t / 64); t > 0; )
|
|
200
200
|
I(e, (t > nt ? T : 0) | nt & t), t = j(t / 128);
|
|
201
|
-
},
|
|
201
|
+
}, Re = new Uint8Array(3e4), Or = Re.length / 3, Rr = (e, t) => {
|
|
202
202
|
if (t.length < Or) {
|
|
203
|
-
const n = Ut.encodeInto(t,
|
|
203
|
+
const n = Ut.encodeInto(t, Re).written || 0;
|
|
204
204
|
p(e, n);
|
|
205
205
|
for (let s = 0; s < n; s++)
|
|
206
|
-
I(e,
|
|
206
|
+
I(e, Re[s]);
|
|
207
207
|
} else
|
|
208
208
|
D(e, fr(t));
|
|
209
209
|
}, Nr = (e, t) => {
|
|
@@ -216,11 +216,11 @@ const M = () => new Ft(), Je = (e) => {
|
|
|
216
216
|
n.codePointAt(r)
|
|
217
217
|
);
|
|
218
218
|
}, st = Ut && /** @type {any} */
|
|
219
|
-
Ut.encodeInto ? Rr : Nr,
|
|
219
|
+
Ut.encodeInto ? Rr : Nr, ae = (e, t) => {
|
|
220
220
|
const n = e.cbuf.length, s = e.cpos, r = je(n - s, t.length), i = t.length - r;
|
|
221
221
|
e.cbuf.set(t.subarray(0, r), s), e.cpos += r, i > 0 && (e.bufs.push(e.cbuf), e.cbuf = new Uint8Array(ht(n * 2, i)), e.cbuf.set(t.subarray(r)), e.cpos = i);
|
|
222
222
|
}, D = (e, t) => {
|
|
223
|
-
p(e, t.byteLength),
|
|
223
|
+
p(e, t.byteLength), ae(e, t);
|
|
224
224
|
}, Ye = (e, t) => {
|
|
225
225
|
vr(e, t);
|
|
226
226
|
const n = new DataView(e.cbuf.buffer, e.cpos, t);
|
|
@@ -302,7 +302,7 @@ const Dn = (e) => {
|
|
|
302
302
|
Xe(e.encoder, t), e.count > 1 && p(e.encoder, e.count - 2);
|
|
303
303
|
}
|
|
304
304
|
};
|
|
305
|
-
class
|
|
305
|
+
class be {
|
|
306
306
|
constructor() {
|
|
307
307
|
this.encoder = new Ft(), this.s = 0, this.count = 0, this.diff = 0;
|
|
308
308
|
}
|
|
@@ -328,7 +328,7 @@ class $r {
|
|
|
328
328
|
}
|
|
329
329
|
toUint8Array() {
|
|
330
330
|
const t = new Ft();
|
|
331
|
-
return this.sarr.push(this.s), this.s = "", st(t, this.sarr.join("")),
|
|
331
|
+
return this.sarr.push(this.s), this.s = "", st(t, this.sarr.join("")), ae(t, this.lensE.toUint8Array()), S(t);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
const ut = (e) => new Error(e), B = () => {
|
|
@@ -336,7 +336,7 @@ const ut = (e) => new Error(e), B = () => {
|
|
|
336
336
|
}, V = () => {
|
|
337
337
|
throw ut("Unexpected case");
|
|
338
338
|
}, Xn = ut("Unexpected end of array"), Yn = ut("Integer out of Range");
|
|
339
|
-
class
|
|
339
|
+
class he {
|
|
340
340
|
/**
|
|
341
341
|
* @param {Uint8Array} uint8Array Binary data to decode
|
|
342
342
|
*/
|
|
@@ -344,7 +344,7 @@ class ae {
|
|
|
344
344
|
this.arr = t, this.pos = 0;
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
const P = (e) => new
|
|
347
|
+
const P = (e) => new he(e), Kr = (e) => e.pos !== e.arr.length, jr = (e, t) => {
|
|
348
348
|
const n = We(e.arr.buffer, e.pos + e.arr.byteOffset, t);
|
|
349
349
|
return e.pos += t, n;
|
|
350
350
|
}, x = (e) => jr(e, w(e)), _t = (e) => e.arr[e.pos++], w = (e) => {
|
|
@@ -359,7 +359,7 @@ const P = (e) => new ae(e), Kr = (e) => e.pos !== e.arr.length, jr = (e, t) => {
|
|
|
359
359
|
}
|
|
360
360
|
throw Xn;
|
|
361
361
|
}, ze = (e) => {
|
|
362
|
-
let t = e.arr[e.pos++], n = t &
|
|
362
|
+
let t = e.arr[e.pos++], n = t & ve, s = 64;
|
|
363
363
|
const r = (t & K) > 0 ? -1 : 1;
|
|
364
364
|
if (!(t & T))
|
|
365
365
|
return r * n;
|
|
@@ -437,7 +437,7 @@ const P = (e) => new ae(e), Kr = (e) => e.pos !== e.arr.length, jr = (e, t) => {
|
|
|
437
437
|
x
|
|
438
438
|
// CASE 116: Uint8Array
|
|
439
439
|
], Ot = (e) => Wr[127 - _t(e)](e);
|
|
440
|
-
class Cn extends
|
|
440
|
+
class Cn extends he {
|
|
441
441
|
/**
|
|
442
442
|
* @param {Uint8Array} uint8Array
|
|
443
443
|
* @param {function(Decoder):T} reader
|
|
@@ -450,7 +450,7 @@ class Cn extends ae {
|
|
|
450
450
|
this.s;
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
|
-
class qt extends
|
|
453
|
+
class qt extends he {
|
|
454
454
|
/**
|
|
455
455
|
* @param {Uint8Array} uint8Array
|
|
456
456
|
*/
|
|
@@ -467,7 +467,7 @@ class qt extends ae {
|
|
|
467
467
|
this.s;
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
class
|
|
470
|
+
class ke extends he {
|
|
471
471
|
/**
|
|
472
472
|
* @param {Uint8Array} uint8Array
|
|
473
473
|
*/
|
|
@@ -547,7 +547,7 @@ const oi = typeof BroadcastChannel > "u" ? ii : BroadcastChannel, qe = (e) => J(
|
|
|
547
547
|
const s = qe(e);
|
|
548
548
|
s.bc.postMessage(t), s.subs.forEach((r) => r(t, n));
|
|
549
549
|
}, it = Date.now;
|
|
550
|
-
class
|
|
550
|
+
class ue {
|
|
551
551
|
constructor() {
|
|
552
552
|
this._observers = R();
|
|
553
553
|
}
|
|
@@ -666,7 +666,7 @@ const fi = (e) => nr(e, (t, n) => `${n}:${t};`).join(""), X = Symbol, qn = X(),
|
|
|
666
666
|
n = e.next();
|
|
667
667
|
while (!n.done && !t(n.value));
|
|
668
668
|
return n;
|
|
669
|
-
}),
|
|
669
|
+
}), Se = (e, t) => ts(() => {
|
|
670
670
|
const { done: n, value: s } = e.next();
|
|
671
671
|
return { done: n, value: n ? void 0 : t(s) };
|
|
672
672
|
});
|
|
@@ -730,7 +730,7 @@ const es = (e, t, n) => t.clients.forEach((s, r) => {
|
|
|
730
730
|
}
|
|
731
731
|
});
|
|
732
732
|
return Ze(t), t;
|
|
733
|
-
},
|
|
733
|
+
}, te = (e, t, n, s) => {
|
|
734
734
|
J(e.clients, t, () => (
|
|
735
735
|
/** @type {Array<DeleteItem>} */
|
|
736
736
|
[]
|
|
@@ -785,12 +785,12 @@ const es = (e, t, n) => t.clients.forEach((s, r) => {
|
|
|
785
785
|
for (let h = 0; h < c; h++) {
|
|
786
786
|
const u = e.readDsClock(), d = u + e.readDsLen();
|
|
787
787
|
if (u < a) {
|
|
788
|
-
a < d &&
|
|
788
|
+
a < d && te(s, o, a, d - a);
|
|
789
789
|
let f = F(l, u), g = l[f];
|
|
790
|
-
for (!g.deleted && g.id.clock < u && (l.splice(f + 1, 0,
|
|
791
|
-
g.deleted || (d < g.id.clock + g.length && l.splice(f, 0,
|
|
790
|
+
for (!g.deleted && g.id.clock < u && (l.splice(f + 1, 0, ce(t, g, u - g.id.clock)), f++); f < l.length && (g = l[f++], g.id.clock < d); )
|
|
791
|
+
g.deleted || (d < g.id.clock + g.length && l.splice(f, 0, ce(t, g, d - g.id.clock)), g.delete(t));
|
|
792
792
|
} else
|
|
793
|
-
|
|
793
|
+
te(s, o, u, d - u);
|
|
794
794
|
}
|
|
795
795
|
}
|
|
796
796
|
if (s.clients.size > 0) {
|
|
@@ -799,7 +799,7 @@ const es = (e, t, n) => t.clients.forEach((s, r) => {
|
|
|
799
799
|
}
|
|
800
800
|
return null;
|
|
801
801
|
}, ss = Wn;
|
|
802
|
-
class Ct extends
|
|
802
|
+
class Ct extends ue {
|
|
803
803
|
/**
|
|
804
804
|
* @param {DocOpts} opts configuration
|
|
805
805
|
*/
|
|
@@ -1130,7 +1130,7 @@ class kt extends Mi {
|
|
|
1130
1130
|
* @param {decoding.Decoder} decoder
|
|
1131
1131
|
*/
|
|
1132
1132
|
constructor(t) {
|
|
1133
|
-
super(t), this.keys = [], w(t), this.keyClockDecoder = new
|
|
1133
|
+
super(t), this.keys = [], w(t), this.keyClockDecoder = new ke(x(t)), this.clientDecoder = new qt(x(t)), this.leftClockDecoder = new ke(x(t)), this.rightClockDecoder = new ke(x(t)), this.infoDecoder = new Cn(x(t), _t), this.stringDecoder = new qr(x(t)), this.parentInfoDecoder = new Cn(x(t), _t), this.typeRefDecoder = new qt(x(t)), this.lenDecoder = new qt(x(t));
|
|
1134
1134
|
}
|
|
1135
1135
|
/**
|
|
1136
1136
|
* @return {ID}
|
|
@@ -1267,7 +1267,7 @@ class $t extends os {
|
|
|
1267
1267
|
* @param {number} info An unsigned 8-bit integer
|
|
1268
1268
|
*/
|
|
1269
1269
|
writeInfo(t) {
|
|
1270
|
-
|
|
1270
|
+
Oe(this.restEncoder, t);
|
|
1271
1271
|
}
|
|
1272
1272
|
/**
|
|
1273
1273
|
* @param {string} s
|
|
@@ -1346,11 +1346,11 @@ class cs {
|
|
|
1346
1346
|
}
|
|
1347
1347
|
class ot extends cs {
|
|
1348
1348
|
constructor() {
|
|
1349
|
-
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new
|
|
1349
|
+
super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new be(), this.clientEncoder = new Wt(), this.leftClockEncoder = new be(), this.rightClockEncoder = new be(), this.infoEncoder = new kn(Oe), this.stringEncoder = new $r(), this.parentInfoEncoder = new kn(Oe), this.typeRefEncoder = new Wt(), this.lenEncoder = new Wt();
|
|
1350
1350
|
}
|
|
1351
1351
|
toUint8Array() {
|
|
1352
1352
|
const t = M();
|
|
1353
|
-
return p(t, 0), D(t, this.keyClockEncoder.toUint8Array()), D(t, this.clientEncoder.toUint8Array()), D(t, this.leftClockEncoder.toUint8Array()), D(t, this.rightClockEncoder.toUint8Array()), D(t, S(this.infoEncoder)), D(t, this.stringEncoder.toUint8Array()), D(t, S(this.parentInfoEncoder)), D(t, this.typeRefEncoder.toUint8Array()), D(t, this.lenEncoder.toUint8Array()),
|
|
1353
|
+
return p(t, 0), D(t, this.keyClockEncoder.toUint8Array()), D(t, this.clientEncoder.toUint8Array()), D(t, this.leftClockEncoder.toUint8Array()), D(t, this.rightClockEncoder.toUint8Array()), D(t, S(this.infoEncoder)), D(t, this.stringEncoder.toUint8Array()), D(t, S(this.parentInfoEncoder)), D(t, this.typeRefEncoder.toUint8Array()), D(t, this.lenEncoder.toUint8Array()), ae(t, S(this.restEncoder)), S(t);
|
|
1354
1354
|
}
|
|
1355
1355
|
/**
|
|
1356
1356
|
* @param {ID} id
|
|
@@ -1449,7 +1449,7 @@ const Ui = (e, t, n, s) => {
|
|
|
1449
1449
|
const s = /* @__PURE__ */ new Map();
|
|
1450
1450
|
n.forEach((r, i) => {
|
|
1451
1451
|
A(t, i) > r && s.set(i, r);
|
|
1452
|
-
}),
|
|
1452
|
+
}), de(t).forEach((r, i) => {
|
|
1453
1453
|
n.has(i) || s.set(i, 0);
|
|
1454
1454
|
}), p(e.restEncoder, s.size), Q(s.entries()).sort((r, i) => i[0] - r[0]).forEach(([r, i]) => {
|
|
1455
1455
|
Ui(
|
|
@@ -1468,7 +1468,7 @@ const Ui = (e, t, n, s) => {
|
|
|
1468
1468
|
n.set(c, { i: 0, refs: o });
|
|
1469
1469
|
for (let a = 0; a < i; a++) {
|
|
1470
1470
|
const h = e.readInfo();
|
|
1471
|
-
switch (
|
|
1471
|
+
switch (le & h) {
|
|
1472
1472
|
case 0: {
|
|
1473
1473
|
const u = e.readLen();
|
|
1474
1474
|
o[a] = new v(y(c, l), u), l += u;
|
|
@@ -1604,7 +1604,7 @@ const Ui = (e, t, n, s) => {
|
|
|
1604
1604
|
const g = h.missing.get(d);
|
|
1605
1605
|
(g == null || g > f) && h.missing.set(d, f);
|
|
1606
1606
|
}
|
|
1607
|
-
h.update =
|
|
1607
|
+
h.update = ee([h.update, a.update]);
|
|
1608
1608
|
}
|
|
1609
1609
|
} else
|
|
1610
1610
|
c.pendingStructs = a;
|
|
@@ -1613,7 +1613,7 @@ const Ui = (e, t, n, s) => {
|
|
|
1613
1613
|
const d = new kt(P(c.pendingDs));
|
|
1614
1614
|
w(d.restDecoder);
|
|
1615
1615
|
const f = En(d, r, c);
|
|
1616
|
-
u && f ? c.pendingDs =
|
|
1616
|
+
u && f ? c.pendingDs = ee([u, f]) : c.pendingDs = u || f;
|
|
1617
1617
|
} else
|
|
1618
1618
|
c.pendingDs = u;
|
|
1619
1619
|
if (i) {
|
|
@@ -1636,7 +1636,7 @@ const Ui = (e, t, n, s) => {
|
|
|
1636
1636
|
if (n.constructor === $t)
|
|
1637
1637
|
return qi(r.map((i, o) => o === 0 ? i : to(i)));
|
|
1638
1638
|
if (n.constructor === ot)
|
|
1639
|
-
return
|
|
1639
|
+
return ee(r);
|
|
1640
1640
|
}
|
|
1641
1641
|
return r[0];
|
|
1642
1642
|
}, en = (e, t) => Bi(e, t, new $t()), Vi = (e) => {
|
|
@@ -1648,7 +1648,7 @@ const Ui = (e, t, n, s) => {
|
|
|
1648
1648
|
return t;
|
|
1649
1649
|
}, hs = (e) => Vi(new rs(P(e))), us = (e, t) => (p(e.restEncoder, t.size), Q(t.entries()).sort((n, s) => s[0] - n[0]).forEach(([n, s]) => {
|
|
1650
1650
|
p(e.restEncoder, n), p(e.restEncoder, s);
|
|
1651
|
-
}), e), Fi = (e, t) => us(e,
|
|
1651
|
+
}), e), Fi = (e, t) => us(e, de(t.store)), Hi = (e, t = new cs()) => (e instanceof Map ? us(t, e) : Fi(t, e), t.toUint8Array()), $i = (e) => Hi(e, new os());
|
|
1652
1652
|
class Ki {
|
|
1653
1653
|
constructor() {
|
|
1654
1654
|
this.l = [];
|
|
@@ -1672,8 +1672,8 @@ const Xt = (e, t) => e === t || e !== null && t !== null && e.client === t.clien
|
|
|
1672
1672
|
if (n === e)
|
|
1673
1673
|
return t;
|
|
1674
1674
|
throw V();
|
|
1675
|
-
}, It = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !ns(t.ds, e.id),
|
|
1676
|
-
const n = J(e.meta,
|
|
1675
|
+
}, It = (e, t) => t === void 0 ? !e.deleted : t.sv.has(e.id.client) && (t.sv.get(e.id.client) || 0) > e.id.clock && !ns(t.ds, e.id), Ne = (e, t) => {
|
|
1676
|
+
const n = J(e.meta, Ne, rt), s = e.doc.store;
|
|
1677
1677
|
n.has(t) || (t.sv.forEach((r, i) => {
|
|
1678
1678
|
r < A(s, i) && Z(e, y(i, r));
|
|
1679
1679
|
}), es(e, t.ds, (r) => {
|
|
@@ -1684,7 +1684,7 @@ class fs {
|
|
|
1684
1684
|
this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
|
|
1685
1685
|
}
|
|
1686
1686
|
}
|
|
1687
|
-
const
|
|
1687
|
+
const de = (e) => {
|
|
1688
1688
|
const t = /* @__PURE__ */ new Map();
|
|
1689
1689
|
return e.clients.forEach((n, s) => {
|
|
1690
1690
|
const r = n[n.length - 1];
|
|
@@ -1724,21 +1724,21 @@ const ue = (e) => {
|
|
|
1724
1724
|
}, Ji = (e, t) => {
|
|
1725
1725
|
const n = e.clients.get(t.client);
|
|
1726
1726
|
return n[F(n, t.clock)];
|
|
1727
|
-
},
|
|
1727
|
+
}, De = (
|
|
1728
1728
|
/** @type {function(StructStore,ID):Item} */
|
|
1729
1729
|
Ji
|
|
1730
|
-
),
|
|
1730
|
+
), Be = (e, t, n) => {
|
|
1731
1731
|
const s = F(t, n), r = t[s];
|
|
1732
|
-
return r.id.clock < n && r instanceof C ? (t.splice(s + 1, 0,
|
|
1732
|
+
return r.id.clock < n && r instanceof C ? (t.splice(s + 1, 0, ce(e, r, n - r.id.clock)), s + 1) : s;
|
|
1733
1733
|
}, Z = (e, t) => {
|
|
1734
1734
|
const n = (
|
|
1735
1735
|
/** @type {Array<Item>} */
|
|
1736
1736
|
e.doc.store.clients.get(t.client)
|
|
1737
1737
|
);
|
|
1738
|
-
return n[
|
|
1738
|
+
return n[Be(e, n, t.clock)];
|
|
1739
1739
|
}, xn = (e, t, n) => {
|
|
1740
1740
|
const s = t.clients.get(n.client), r = F(s, n.clock), i = s[r];
|
|
1741
|
-
return n.clock !== i.id.clock + i.length - 1 && i.constructor !== v && s.splice(r + 1, 0,
|
|
1741
|
+
return n.clock !== i.id.clock + i.length - 1 && i.constructor !== v && s.splice(r + 1, 0, ce(e, i, n.clock - i.id.clock + 1)), i;
|
|
1742
1742
|
}, Xi = (e, t, n) => {
|
|
1743
1743
|
const s = (
|
|
1744
1744
|
/** @type {Array<GC|Item>} */
|
|
@@ -1749,9 +1749,9 @@ const ue = (e) => {
|
|
|
1749
1749
|
if (s === 0)
|
|
1750
1750
|
return;
|
|
1751
1751
|
const i = n + s;
|
|
1752
|
-
let o =
|
|
1752
|
+
let o = Be(e, t, n), c;
|
|
1753
1753
|
do
|
|
1754
|
-
c = t[o++], i < c.id.clock + c.length &&
|
|
1754
|
+
c = t[o++], i < c.id.clock + c.length && Be(e, t, i), r(c);
|
|
1755
1755
|
while (o < t.length && t[o].id.clock < i);
|
|
1756
1756
|
};
|
|
1757
1757
|
class Yi {
|
|
@@ -1761,7 +1761,7 @@ class Yi {
|
|
|
1761
1761
|
* @param {boolean} local
|
|
1762
1762
|
*/
|
|
1763
1763
|
constructor(t, n, s) {
|
|
1764
|
-
this.doc = t, this.deleteSet = new Ht(), this.beforeState =
|
|
1764
|
+
this.doc = t, this.deleteSet = new Ht(), this.beforeState = de(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;
|
|
1765
1765
|
}
|
|
1766
1766
|
}
|
|
1767
1767
|
const Mn = (e, t) => t.deleteSet.clients.size === 0 && !sr(t.afterState, (n, s) => t.beforeState.get(s) !== n) ? !1 : (Ze(t.deleteSet), Oi(e, t), Dt(e, t.deleteSet), !0), Un = (e, t, n) => {
|
|
@@ -1807,7 +1807,7 @@ const Mn = (e, t) => t.deleteSet.clients.size === 0 && !sr(t.afterState, (n, s)
|
|
|
1807
1807
|
if (t < e.length) {
|
|
1808
1808
|
const n = e[t], s = n.doc, r = s.store, i = n.deleteSet, o = n._mergeStructs;
|
|
1809
1809
|
try {
|
|
1810
|
-
Ze(i), n.afterState =
|
|
1810
|
+
Ze(i), n.afterState = de(n.doc.store), s.emit("beforeObserverCalls", [n, s]);
|
|
1811
1811
|
const c = [];
|
|
1812
1812
|
n.changed.forEach(
|
|
1813
1813
|
(l, a) => c.push(() => {
|
|
@@ -1879,7 +1879,7 @@ function* Wi(e) {
|
|
|
1879
1879
|
if (c === 10) {
|
|
1880
1880
|
const l = w(e.restDecoder);
|
|
1881
1881
|
yield new O(y(r, i), l), i += l;
|
|
1882
|
-
} else if (
|
|
1882
|
+
} else if (le & c) {
|
|
1883
1883
|
const l = (c & (K | T)) === 0, a = new C(
|
|
1884
1884
|
y(r, i),
|
|
1885
1885
|
null,
|
|
@@ -1932,7 +1932,7 @@ class sn {
|
|
|
1932
1932
|
this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = t, this.clientStructs = [];
|
|
1933
1933
|
}
|
|
1934
1934
|
}
|
|
1935
|
-
const qi = (e) =>
|
|
1935
|
+
const qi = (e) => ee(e, is, $t), Qi = (e, t) => {
|
|
1936
1936
|
if (e.constructor === v) {
|
|
1937
1937
|
const { client: n, clock: s } = e.id;
|
|
1938
1938
|
return new v(y(n, s + t), e.length - t);
|
|
@@ -1955,7 +1955,7 @@ const qi = (e) => te(e, is, $t), Qi = (e, t) => {
|
|
|
1955
1955
|
n.content.splice(t)
|
|
1956
1956
|
);
|
|
1957
1957
|
}
|
|
1958
|
-
},
|
|
1958
|
+
}, ee = (e, t = kt, n = ot) => {
|
|
1959
1959
|
if (e.length === 1)
|
|
1960
1960
|
return e[0];
|
|
1961
1961
|
const s = e.map((h) => new t(P(h)));
|
|
@@ -2042,7 +2042,7 @@ const qi = (e) => te(e, is, $t), Qi = (e, t) => {
|
|
|
2042
2042
|
p(t, e.clientStructs.length);
|
|
2043
2043
|
for (let n = 0; n < e.clientStructs.length; n++) {
|
|
2044
2044
|
const s = e.clientStructs[n];
|
|
2045
|
-
p(t, s.written),
|
|
2045
|
+
p(t, s.written), ae(t, s.restEncoder);
|
|
2046
2046
|
}
|
|
2047
2047
|
}, Pi = (e, t, n, s) => {
|
|
2048
2048
|
const r = new n(P(e)), i = new nn(r, !1), o = new s(), c = new sn(o);
|
|
@@ -2052,7 +2052,7 @@ const qi = (e) => te(e, is, $t), Qi = (e, t) => {
|
|
|
2052
2052
|
const l = Pe(r);
|
|
2053
2053
|
return Dt(o, l), o.toUint8Array();
|
|
2054
2054
|
}, to = (e) => Pi(e, Cr, kt, $t);
|
|
2055
|
-
class
|
|
2055
|
+
class fe {
|
|
2056
2056
|
/**
|
|
2057
2057
|
* @param {T} target The changed type.
|
|
2058
2058
|
* @param {Transaction} transaction
|
|
@@ -2107,13 +2107,13 @@ class de {
|
|
|
2107
2107
|
l = l.left;
|
|
2108
2108
|
if (this.deletes(i))
|
|
2109
2109
|
if (l !== null && this.deletes(l))
|
|
2110
|
-
o = "delete", c =
|
|
2110
|
+
o = "delete", c = me(l.content.getContent());
|
|
2111
2111
|
else
|
|
2112
2112
|
return;
|
|
2113
2113
|
else
|
|
2114
|
-
l !== null && this.deletes(l) ? (o = "update", c =
|
|
2114
|
+
l !== null && this.deletes(l) ? (o = "update", c = me(l.content.getContent())) : (o = "add", c = void 0);
|
|
2115
2115
|
} else if (this.deletes(i))
|
|
2116
|
-
o = "delete", c =
|
|
2116
|
+
o = "delete", c = me(
|
|
2117
2117
|
/** @type {Item} */
|
|
2118
2118
|
i.content.getContent()
|
|
2119
2119
|
);
|
|
@@ -2223,7 +2223,7 @@ const so = (e) => {
|
|
|
2223
2223
|
const s = new no(t, n);
|
|
2224
2224
|
return e.push(s), s;
|
|
2225
2225
|
}
|
|
2226
|
-
},
|
|
2226
|
+
}, ge = (e, t) => {
|
|
2227
2227
|
if (e._start === null || t === 0 || e._searchMarker === null)
|
|
2228
2228
|
return null;
|
|
2229
2229
|
const n = e._searchMarker.length === 0 ? null : e._searchMarker.reduce((i, o) => Gt(t - i.index) < Gt(t - o.index) ? i : o);
|
|
@@ -2257,7 +2257,7 @@ const so = (e) => {
|
|
|
2257
2257
|
}
|
|
2258
2258
|
(t < r.index || n > 0 && t === r.index) && (r.index = ht(t, r.index + n));
|
|
2259
2259
|
}
|
|
2260
|
-
},
|
|
2260
|
+
}, pe = (e, t, n) => {
|
|
2261
2261
|
const s = e, r = t.changedParentTypes;
|
|
2262
2262
|
for (; J(r, e, () => []).push(n), e._item !== null; )
|
|
2263
2263
|
e = /** @type {AbstractType<any>} */
|
|
@@ -2436,7 +2436,7 @@ const bs = (e, t, n) => {
|
|
|
2436
2436
|
}
|
|
2437
2437
|
};
|
|
2438
2438
|
}, Ds = (e, t) => {
|
|
2439
|
-
const n =
|
|
2439
|
+
const n = ge(e, t);
|
|
2440
2440
|
let s = e._start;
|
|
2441
2441
|
for (n !== null && (s = n.p, t -= n.index); s !== null; s = s.right)
|
|
2442
2442
|
if (!s.deleted && s.countable) {
|
|
@@ -2444,7 +2444,7 @@ const bs = (e, t, n) => {
|
|
|
2444
2444
|
return s.content.getContent()[t];
|
|
2445
2445
|
t -= s.length;
|
|
2446
2446
|
}
|
|
2447
|
-
},
|
|
2447
|
+
}, ne = (e, t, n, s) => {
|
|
2448
2448
|
let r = n;
|
|
2449
2449
|
const i = e.doc, o = i.clientID, c = i.store, l = n === null ? t._start : n.right;
|
|
2450
2450
|
let a = [];
|
|
@@ -2490,8 +2490,8 @@ const bs = (e, t, n) => {
|
|
|
2490
2490
|
if (n > t._length)
|
|
2491
2491
|
throw Cs;
|
|
2492
2492
|
if (n === 0)
|
|
2493
|
-
return t._searchMarker && Rt(t._searchMarker, n, s.length),
|
|
2494
|
-
const r = n, i =
|
|
2493
|
+
return t._searchMarker && Rt(t._searchMarker, n, s.length), ne(e, t, null, s);
|
|
2494
|
+
const r = n, i = ge(t, n);
|
|
2495
2495
|
let o = t._start;
|
|
2496
2496
|
for (i !== null && (o = i.p, n -= i.index, n === 0 && (o = o.prev, n += o && o.countable && !o.deleted ? o.length : 0)); o !== null; o = o.right)
|
|
2497
2497
|
if (!o.deleted && o.countable) {
|
|
@@ -2501,17 +2501,17 @@ const bs = (e, t, n) => {
|
|
|
2501
2501
|
}
|
|
2502
2502
|
n -= o.length;
|
|
2503
2503
|
}
|
|
2504
|
-
return t._searchMarker && Rt(t._searchMarker, r, s.length),
|
|
2504
|
+
return t._searchMarker && Rt(t._searchMarker, r, s.length), ne(e, t, o, s);
|
|
2505
2505
|
}, oo = (e, t, n) => {
|
|
2506
2506
|
let r = (t._searchMarker || []).reduce((i, o) => o.index > i.index ? o : i, { index: 0, p: t._start }).p;
|
|
2507
2507
|
if (r)
|
|
2508
2508
|
for (; r.right; )
|
|
2509
2509
|
r = r.right;
|
|
2510
|
-
return
|
|
2510
|
+
return ne(e, t, r, n);
|
|
2511
2511
|
}, Is = (e, t, n, s) => {
|
|
2512
2512
|
if (s === 0)
|
|
2513
2513
|
return;
|
|
2514
|
-
const r = n, i = s, o =
|
|
2514
|
+
const r = n, i = s, o = ge(t, n);
|
|
2515
2515
|
let c = t._start;
|
|
2516
2516
|
for (o !== null && (c = o.p, n -= o.index); c !== null && n > 0; c = c.right)
|
|
2517
2517
|
!c.deleted && c.countable && (n < c.length && Z(e, y(c.id.client, c.id.clock + n)), n -= c.length);
|
|
@@ -2525,7 +2525,7 @@ const bs = (e, t, n) => {
|
|
|
2525
2525
|
-i + s
|
|
2526
2526
|
/* in case we remove the above exception */
|
|
2527
2527
|
);
|
|
2528
|
-
},
|
|
2528
|
+
}, se = (e, t, n) => {
|
|
2529
2529
|
const s = t._map.get(n);
|
|
2530
2530
|
s !== void 0 && s.delete(e);
|
|
2531
2531
|
}, cn = (e, t, n, s) => {
|
|
@@ -2577,7 +2577,7 @@ const bs = (e, t, n) => {
|
|
|
2577
2577
|
/** @param {any} entry */
|
|
2578
2578
|
(t) => !t[1].deleted
|
|
2579
2579
|
);
|
|
2580
|
-
class co extends
|
|
2580
|
+
class co extends fe {
|
|
2581
2581
|
/**
|
|
2582
2582
|
* @param {YArray<T>} yarray The changed type
|
|
2583
2583
|
* @param {Transaction} transaction The transaction object
|
|
@@ -2645,7 +2645,7 @@ class wt extends L {
|
|
|
2645
2645
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
2646
2646
|
*/
|
|
2647
2647
|
_callObserver(t, n) {
|
|
2648
|
-
super._callObserver(t, n),
|
|
2648
|
+
super._callObserver(t, n), pe(this, t, new co(this, t));
|
|
2649
2649
|
}
|
|
2650
2650
|
/**
|
|
2651
2651
|
* Inserts new content at an index.
|
|
@@ -2783,7 +2783,7 @@ class wt extends L {
|
|
|
2783
2783
|
}
|
|
2784
2784
|
}
|
|
2785
2785
|
const lo = (e) => new wt();
|
|
2786
|
-
class ao extends
|
|
2786
|
+
class ao extends fe {
|
|
2787
2787
|
/**
|
|
2788
2788
|
* @param {YMap<T>} ymap The YArray that changed.
|
|
2789
2789
|
* @param {Transaction} transaction
|
|
@@ -2841,7 +2841,7 @@ class ct extends L {
|
|
|
2841
2841
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
2842
2842
|
*/
|
|
2843
2843
|
_callObserver(t, n) {
|
|
2844
|
-
|
|
2844
|
+
pe(this, t, new ao(this, t, n));
|
|
2845
2845
|
}
|
|
2846
2846
|
/**
|
|
2847
2847
|
* Transforms this Shared Type to a JSON object.
|
|
@@ -2871,7 +2871,7 @@ class ct extends L {
|
|
|
2871
2871
|
* @return {IterableIterator<string>}
|
|
2872
2872
|
*/
|
|
2873
2873
|
keys() {
|
|
2874
|
-
return
|
|
2874
|
+
return Se(
|
|
2875
2875
|
Yt(this._map),
|
|
2876
2876
|
/** @param {any} v */
|
|
2877
2877
|
(t) => t[0]
|
|
@@ -2883,7 +2883,7 @@ class ct extends L {
|
|
|
2883
2883
|
* @return {IterableIterator<any>}
|
|
2884
2884
|
*/
|
|
2885
2885
|
values() {
|
|
2886
|
-
return
|
|
2886
|
+
return Se(
|
|
2887
2887
|
Yt(this._map),
|
|
2888
2888
|
/** @param {any} v */
|
|
2889
2889
|
(t) => t[1].content.getContent()[t[1].length - 1]
|
|
@@ -2895,7 +2895,7 @@ class ct extends L {
|
|
|
2895
2895
|
* @return {IterableIterator<any>}
|
|
2896
2896
|
*/
|
|
2897
2897
|
entries() {
|
|
2898
|
-
return
|
|
2898
|
+
return Se(
|
|
2899
2899
|
Yt(this._map),
|
|
2900
2900
|
/** @param {any} v */
|
|
2901
2901
|
(t) => [t[0], t[1].content.getContent()[t[1].length - 1]]
|
|
@@ -2926,7 +2926,7 @@ class ct extends L {
|
|
|
2926
2926
|
*/
|
|
2927
2927
|
delete(t) {
|
|
2928
2928
|
this.doc !== null ? b(this.doc, (n) => {
|
|
2929
|
-
|
|
2929
|
+
se(n, this, t);
|
|
2930
2930
|
}) : this._prelimContent.delete(t);
|
|
2931
2931
|
}
|
|
2932
2932
|
/**
|
|
@@ -2975,7 +2975,7 @@ class ct extends L {
|
|
|
2975
2975
|
clear() {
|
|
2976
2976
|
this.doc !== null ? b(this.doc, (t) => {
|
|
2977
2977
|
this.forEach(function(n, s, r) {
|
|
2978
|
-
|
|
2978
|
+
se(t, r, s);
|
|
2979
2979
|
});
|
|
2980
2980
|
}) : this._prelimContent.clear();
|
|
2981
2981
|
}
|
|
@@ -2987,7 +2987,7 @@ class ct extends L {
|
|
|
2987
2987
|
}
|
|
2988
2988
|
}
|
|
2989
2989
|
const ho = (e) => new ct(), W = (e, t) => e === t || typeof e == "object" && typeof t == "object" && e && t && Dr(e, t);
|
|
2990
|
-
class
|
|
2990
|
+
class Ve {
|
|
2991
2991
|
/**
|
|
2992
2992
|
* @param {Item|null} left
|
|
2993
2993
|
* @param {Item|null} right
|
|
@@ -3034,12 +3034,12 @@ const Tn = (e, t, n) => {
|
|
|
3034
3034
|
}
|
|
3035
3035
|
return t;
|
|
3036
3036
|
}, zt = (e, t, n) => {
|
|
3037
|
-
const s = /* @__PURE__ */ new Map(), r =
|
|
3037
|
+
const s = /* @__PURE__ */ new Map(), r = ge(t, n);
|
|
3038
3038
|
if (r) {
|
|
3039
|
-
const i = new
|
|
3039
|
+
const i = new Ve(r.p.left, r.p, r.index, s);
|
|
3040
3040
|
return Tn(e, i, n - r.index);
|
|
3041
3041
|
} else {
|
|
3042
|
-
const i = new
|
|
3042
|
+
const i = new Ve(null, t._start, 0, s);
|
|
3043
3043
|
return Tn(e, i, n);
|
|
3044
3044
|
}
|
|
3045
3045
|
}, xs = (e, t, n, s) => {
|
|
@@ -3087,7 +3087,7 @@ const Tn = (e, t, n) => {
|
|
|
3087
3087
|
}
|
|
3088
3088
|
}
|
|
3089
3089
|
return o;
|
|
3090
|
-
},
|
|
3090
|
+
}, Ce = (e, t, n, s, r) => {
|
|
3091
3091
|
n.currentAttributes.forEach((d, f) => {
|
|
3092
3092
|
r[f] === void 0 && (r[f] = null);
|
|
3093
3093
|
});
|
|
@@ -3199,7 +3199,7 @@ const Tn = (e, t, n) => {
|
|
|
3199
3199
|
/** @type {Item} */
|
|
3200
3200
|
e._start
|
|
3201
3201
|
), r = e._start, i = R();
|
|
3202
|
-
const o =
|
|
3202
|
+
const o = Me(i);
|
|
3203
3203
|
for (; r; ) {
|
|
3204
3204
|
if (r.deleted === !1)
|
|
3205
3205
|
switch (r.content.constructor) {
|
|
@@ -3211,7 +3211,7 @@ const Tn = (e, t, n) => {
|
|
|
3211
3211
|
);
|
|
3212
3212
|
break;
|
|
3213
3213
|
default:
|
|
3214
|
-
t += Ts(n, s, r, i, o), i =
|
|
3214
|
+
t += Ts(n, s, r, i, o), i = Me(o), s = r;
|
|
3215
3215
|
break;
|
|
3216
3216
|
}
|
|
3217
3217
|
r = r.right;
|
|
@@ -3255,7 +3255,7 @@ const Tn = (e, t, n) => {
|
|
|
3255
3255
|
fo(r);
|
|
3256
3256
|
});
|
|
3257
3257
|
}, On = (e, t, n) => {
|
|
3258
|
-
const s = n, r =
|
|
3258
|
+
const s = n, r = Me(t.currentAttributes), i = t.right;
|
|
3259
3259
|
for (; n > 0 && t.right !== null; ) {
|
|
3260
3260
|
if (t.right.deleted === !1)
|
|
3261
3261
|
switch (t.right.content.constructor) {
|
|
@@ -3275,7 +3275,7 @@ const Tn = (e, t, n) => {
|
|
|
3275
3275
|
);
|
|
3276
3276
|
return o._searchMarker && Rt(o._searchMarker, t.index, -s + n), t;
|
|
3277
3277
|
};
|
|
3278
|
-
class po extends
|
|
3278
|
+
class po extends fe {
|
|
3279
3279
|
/**
|
|
3280
3280
|
* @param {YText} ytext
|
|
3281
3281
|
* @param {Transaction} transaction
|
|
@@ -3443,7 +3443,7 @@ class St extends L {
|
|
|
3443
3443
|
_callObserver(t, n) {
|
|
3444
3444
|
super._callObserver(t, n);
|
|
3445
3445
|
const s = new po(this, t, n);
|
|
3446
|
-
|
|
3446
|
+
pe(this, t, s), !t.local && this._hasFormatting && (t._needFormattingCleanup = !0);
|
|
3447
3447
|
}
|
|
3448
3448
|
/**
|
|
3449
3449
|
* Returns the unformatted string representation of this YText type.
|
|
@@ -3478,13 +3478,13 @@ class St extends L {
|
|
|
3478
3478
|
*/
|
|
3479
3479
|
applyDelta(t, { sanitize: n = !0 } = {}) {
|
|
3480
3480
|
this.doc !== null ? b(this.doc, (s) => {
|
|
3481
|
-
const r = new
|
|
3481
|
+
const r = new Ve(null, this._start, 0, /* @__PURE__ */ new Map());
|
|
3482
3482
|
for (let i = 0; i < t.length; i++) {
|
|
3483
3483
|
const o = t[i];
|
|
3484
3484
|
if (o.insert !== void 0) {
|
|
3485
3485
|
const c = !n && typeof o.insert == "string" && i === t.length - 1 && r.right === null && o.insert.slice(-1) === `
|
|
3486
3486
|
` ? o.insert.slice(0, -1) : o.insert;
|
|
3487
|
-
(typeof c != "string" || c.length > 0) &&
|
|
3487
|
+
(typeof c != "string" || c.length > 0) && Ce(s, this, r, c, o.attributes || {});
|
|
3488
3488
|
} else
|
|
3489
3489
|
o.retain !== void 0 ? vn(s, this, r, o.retain, o.attributes || {}) : o.delete !== void 0 && On(s, r, o.delete);
|
|
3490
3490
|
}
|
|
@@ -3558,7 +3558,7 @@ class St extends L {
|
|
|
3558
3558
|
a();
|
|
3559
3559
|
};
|
|
3560
3560
|
return t || n ? b(o, (u) => {
|
|
3561
|
-
t &&
|
|
3561
|
+
t && Ne(u, t), n && Ne(u, n), h();
|
|
3562
3562
|
}, "cleanup") : h(), r;
|
|
3563
3563
|
}
|
|
3564
3564
|
/**
|
|
@@ -3579,7 +3579,7 @@ class St extends L {
|
|
|
3579
3579
|
const o = zt(i, this, t);
|
|
3580
3580
|
s || (s = {}, o.currentAttributes.forEach((c, l) => {
|
|
3581
3581
|
s[l] = c;
|
|
3582
|
-
})),
|
|
3582
|
+
})), Ce(i, this, o, n, s);
|
|
3583
3583
|
}) : this._pending.push(() => this.insert(t, n, s));
|
|
3584
3584
|
}
|
|
3585
3585
|
/**
|
|
@@ -3596,7 +3596,7 @@ class St extends L {
|
|
|
3596
3596
|
const r = this.doc;
|
|
3597
3597
|
r !== null ? b(r, (i) => {
|
|
3598
3598
|
const o = zt(i, this, t);
|
|
3599
|
-
|
|
3599
|
+
Ce(i, this, o, n, s);
|
|
3600
3600
|
}) : this._pending.push(() => this.insertEmbed(t, n, s));
|
|
3601
3601
|
}
|
|
3602
3602
|
/**
|
|
@@ -3645,7 +3645,7 @@ class St extends L {
|
|
|
3645
3645
|
*/
|
|
3646
3646
|
removeAttribute(t) {
|
|
3647
3647
|
this.doc !== null ? b(this.doc, (n) => {
|
|
3648
|
-
|
|
3648
|
+
se(n, this, t);
|
|
3649
3649
|
}) : this._pending.push(() => this.removeAttribute(t));
|
|
3650
3650
|
}
|
|
3651
3651
|
/**
|
|
@@ -3700,7 +3700,7 @@ class St extends L {
|
|
|
3700
3700
|
}
|
|
3701
3701
|
}
|
|
3702
3702
|
const wo = (e) => new St();
|
|
3703
|
-
class
|
|
3703
|
+
class Ee {
|
|
3704
3704
|
/**
|
|
3705
3705
|
* @param {YXmlFragment | YXmlElement} root
|
|
3706
3706
|
* @param {function(AbstractType<any>):boolean} [f]
|
|
@@ -3804,7 +3804,7 @@ class lt extends L {
|
|
|
3804
3804
|
* @public
|
|
3805
3805
|
*/
|
|
3806
3806
|
createTreeWalker(t) {
|
|
3807
|
-
return new
|
|
3807
|
+
return new Ee(this, t);
|
|
3808
3808
|
}
|
|
3809
3809
|
/**
|
|
3810
3810
|
* Returns the first YXmlElement that matches the query.
|
|
@@ -3823,7 +3823,7 @@ class lt extends L {
|
|
|
3823
3823
|
*/
|
|
3824
3824
|
querySelector(t) {
|
|
3825
3825
|
t = t.toUpperCase();
|
|
3826
|
-
const s = new
|
|
3826
|
+
const s = new Ee(this, (r) => r.nodeName && r.nodeName.toUpperCase() === t).next();
|
|
3827
3827
|
return s.done ? null : s.value;
|
|
3828
3828
|
}
|
|
3829
3829
|
/**
|
|
@@ -3838,7 +3838,7 @@ class lt extends L {
|
|
|
3838
3838
|
* @public
|
|
3839
3839
|
*/
|
|
3840
3840
|
querySelectorAll(t) {
|
|
3841
|
-
return t = t.toUpperCase(), Q(new
|
|
3841
|
+
return t = t.toUpperCase(), Q(new Ee(this, (n) => n.nodeName && n.nodeName.toUpperCase() === t));
|
|
3842
3842
|
}
|
|
3843
3843
|
/**
|
|
3844
3844
|
* Creates YXmlEvent and calls observers.
|
|
@@ -3847,7 +3847,7 @@ class lt extends L {
|
|
|
3847
3847
|
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
3848
3848
|
*/
|
|
3849
3849
|
_callObserver(t, n) {
|
|
3850
|
-
|
|
3850
|
+
pe(this, t, new _o(this, n, t));
|
|
3851
3851
|
}
|
|
3852
3852
|
/**
|
|
3853
3853
|
* Get the string representation of all the children of this YXmlFragment.
|
|
@@ -3913,7 +3913,7 @@ class lt extends L {
|
|
|
3913
3913
|
if (this.doc !== null)
|
|
3914
3914
|
b(this.doc, (s) => {
|
|
3915
3915
|
const r = t && t instanceof L ? t._item : t;
|
|
3916
|
-
|
|
3916
|
+
ne(s, this, r, n);
|
|
3917
3917
|
});
|
|
3918
3918
|
else {
|
|
3919
3919
|
const s = (
|
|
@@ -4090,7 +4090,7 @@ class Bt extends lt {
|
|
|
4090
4090
|
*/
|
|
4091
4091
|
removeAttribute(t) {
|
|
4092
4092
|
this.doc !== null ? b(this.doc, (n) => {
|
|
4093
|
-
|
|
4093
|
+
se(n, this, t);
|
|
4094
4094
|
}) : this._prelimAttrs.delete(t);
|
|
4095
4095
|
}
|
|
4096
4096
|
/**
|
|
@@ -4190,7 +4190,7 @@ class Bt extends lt {
|
|
|
4190
4190
|
}
|
|
4191
4191
|
}
|
|
4192
4192
|
const yo = (e) => new Bt(e.readKey());
|
|
4193
|
-
class _o extends
|
|
4193
|
+
class _o extends fe {
|
|
4194
4194
|
/**
|
|
4195
4195
|
* @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
|
|
4196
4196
|
* @param {Set<string|null>} subs The set of changed attributes. `null` is included if the
|
|
@@ -4204,7 +4204,7 @@ class _o extends de {
|
|
|
4204
4204
|
});
|
|
4205
4205
|
}
|
|
4206
4206
|
}
|
|
4207
|
-
class
|
|
4207
|
+
class re extends ct {
|
|
4208
4208
|
/**
|
|
4209
4209
|
* @param {string} hookName nodeName of the Dom Node.
|
|
4210
4210
|
*/
|
|
@@ -4215,13 +4215,13 @@ class se extends ct {
|
|
|
4215
4215
|
* Creates an Item with the same effect as this Item (without position effect)
|
|
4216
4216
|
*/
|
|
4217
4217
|
_copy() {
|
|
4218
|
-
return new
|
|
4218
|
+
return new re(this.hookName);
|
|
4219
4219
|
}
|
|
4220
4220
|
/**
|
|
4221
4221
|
* @return {YXmlHook}
|
|
4222
4222
|
*/
|
|
4223
4223
|
clone() {
|
|
4224
|
-
const t = new
|
|
4224
|
+
const t = new re(this.hookName);
|
|
4225
4225
|
return this.forEach((n, s) => {
|
|
4226
4226
|
t.set(s, n);
|
|
4227
4227
|
}), t;
|
|
@@ -4258,8 +4258,8 @@ class se extends ct {
|
|
|
4258
4258
|
t.writeTypeRef(Bo), t.writeKey(this.hookName);
|
|
4259
4259
|
}
|
|
4260
4260
|
}
|
|
4261
|
-
const bo = (e) => new
|
|
4262
|
-
class
|
|
4261
|
+
const bo = (e) => new re(e.readKey());
|
|
4262
|
+
class ie extends St {
|
|
4263
4263
|
/**
|
|
4264
4264
|
* @type {YXmlElement|YXmlText|null}
|
|
4265
4265
|
*/
|
|
@@ -4283,13 +4283,13 @@ class re extends St {
|
|
|
4283
4283
|
) : null;
|
|
4284
4284
|
}
|
|
4285
4285
|
_copy() {
|
|
4286
|
-
return new
|
|
4286
|
+
return new ie();
|
|
4287
4287
|
}
|
|
4288
4288
|
/**
|
|
4289
4289
|
* @return {YXmlText}
|
|
4290
4290
|
*/
|
|
4291
4291
|
clone() {
|
|
4292
|
-
const t = new
|
|
4292
|
+
const t = new ie();
|
|
4293
4293
|
return t.applyDelta(this.toDelta()), t;
|
|
4294
4294
|
}
|
|
4295
4295
|
/**
|
|
@@ -4350,7 +4350,7 @@ class re extends St {
|
|
|
4350
4350
|
t.writeTypeRef(Vo);
|
|
4351
4351
|
}
|
|
4352
4352
|
}
|
|
4353
|
-
const ko = (e) => new
|
|
4353
|
+
const ko = (e) => new ie();
|
|
4354
4354
|
class an {
|
|
4355
4355
|
/**
|
|
4356
4356
|
* @param {ID} id
|
|
@@ -4555,7 +4555,7 @@ class Vt {
|
|
|
4555
4555
|
* @param {Item} item
|
|
4556
4556
|
*/
|
|
4557
4557
|
integrate(t, n) {
|
|
4558
|
-
|
|
4558
|
+
te(t.deleteSet, n.id.client, n.id.clock, this.len), n.markDeleted();
|
|
4559
4559
|
}
|
|
4560
4560
|
/**
|
|
4561
4561
|
* @param {Transaction} transaction
|
|
@@ -4820,7 +4820,7 @@ class E {
|
|
|
4820
4820
|
}
|
|
4821
4821
|
}
|
|
4822
4822
|
const Ao = (e) => new E(e.readKey(), e.readJSON());
|
|
4823
|
-
class
|
|
4823
|
+
class oe {
|
|
4824
4824
|
/**
|
|
4825
4825
|
* @param {Array<any>} arr
|
|
4826
4826
|
*/
|
|
@@ -4849,14 +4849,14 @@ class ie {
|
|
|
4849
4849
|
* @return {ContentJSON}
|
|
4850
4850
|
*/
|
|
4851
4851
|
copy() {
|
|
4852
|
-
return new
|
|
4852
|
+
return new oe(this.arr);
|
|
4853
4853
|
}
|
|
4854
4854
|
/**
|
|
4855
4855
|
* @param {number} offset
|
|
4856
4856
|
* @return {ContentJSON}
|
|
4857
4857
|
*/
|
|
4858
4858
|
splice(t) {
|
|
4859
|
-
const n = new
|
|
4859
|
+
const n = new oe(this.arr.slice(t));
|
|
4860
4860
|
return this.arr = this.arr.slice(0, t), n;
|
|
4861
4861
|
}
|
|
4862
4862
|
/**
|
|
@@ -4907,7 +4907,7 @@ const Lo = (e) => {
|
|
|
4907
4907
|
const r = e.readString();
|
|
4908
4908
|
r === "undefined" ? n.push(void 0) : n.push(JSON.parse(r));
|
|
4909
4909
|
}
|
|
4910
|
-
return new
|
|
4910
|
+
return new oe(n);
|
|
4911
4911
|
};
|
|
4912
4912
|
class at {
|
|
4913
4913
|
/**
|
|
@@ -5175,7 +5175,7 @@ class Y {
|
|
|
5175
5175
|
return 7;
|
|
5176
5176
|
}
|
|
5177
5177
|
}
|
|
5178
|
-
const Fo = (e) => new Y(Uo[e.readTypeRef()](e)),
|
|
5178
|
+
const Fo = (e) => new Y(Uo[e.readTypeRef()](e)), ce = (e, t, n) => {
|
|
5179
5179
|
const { client: s, clock: r } = t.id, i = new C(
|
|
5180
5180
|
y(s, r + n),
|
|
5181
5181
|
t,
|
|
@@ -5208,10 +5208,10 @@ class C extends an {
|
|
|
5208
5208
|
* @type {boolean}
|
|
5209
5209
|
*/
|
|
5210
5210
|
set marker(t) {
|
|
5211
|
-
(this.info &
|
|
5211
|
+
(this.info & _e) > 0 !== t && (this.info ^= _e);
|
|
5212
5212
|
}
|
|
5213
5213
|
get marker() {
|
|
5214
|
-
return (this.info &
|
|
5214
|
+
return (this.info & _e) > 0;
|
|
5215
5215
|
}
|
|
5216
5216
|
/**
|
|
5217
5217
|
* If true, do not garbage collect this Item.
|
|
@@ -5230,13 +5230,13 @@ class C extends an {
|
|
|
5230
5230
|
* @type {Boolean}
|
|
5231
5231
|
*/
|
|
5232
5232
|
get deleted() {
|
|
5233
|
-
return (this.info &
|
|
5233
|
+
return (this.info & ye) > 0;
|
|
5234
5234
|
}
|
|
5235
5235
|
set deleted(t) {
|
|
5236
|
-
this.deleted !== t && (this.info ^=
|
|
5236
|
+
this.deleted !== t && (this.info ^= ye);
|
|
5237
5237
|
}
|
|
5238
5238
|
markDeleted() {
|
|
5239
|
-
this.info |=
|
|
5239
|
+
this.info |= ye;
|
|
5240
5240
|
}
|
|
5241
5241
|
/**
|
|
5242
5242
|
* Return the creator clientID of the missing op or define missing items and return null.
|
|
@@ -5255,7 +5255,7 @@ class C extends an {
|
|
|
5255
5255
|
if (this.origin && (this.left = xn(t, n, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = Z(t, this.rightOrigin), this.rightOrigin = this.right.id), (this.left && this.left.constructor === v || this.right && this.right.constructor === v) && (this.parent = null), !this.parent)
|
|
5256
5256
|
this.left && this.left.constructor === C && (this.parent = this.left.parent, this.parentSub = this.left.parentSub), this.right && this.right.constructor === C && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
|
|
5257
5257
|
else if (this.parent.constructor === pt) {
|
|
5258
|
-
const s =
|
|
5258
|
+
const s = De(n, this.parent);
|
|
5259
5259
|
s.constructor === v ? this.parent = null : this.parent = /** @type {ContentType} */
|
|
5260
5260
|
s.content.type;
|
|
5261
5261
|
}
|
|
@@ -5285,8 +5285,8 @@ class C extends an {
|
|
|
5285
5285
|
s = r, i.clear();
|
|
5286
5286
|
else if (Xt(this.rightOrigin, r.rightOrigin))
|
|
5287
5287
|
break;
|
|
5288
|
-
} else if (r.origin !== null && o.has(
|
|
5289
|
-
i.has(
|
|
5288
|
+
} else if (r.origin !== null && o.has(De(t.doc.store, r.origin)))
|
|
5289
|
+
i.has(De(t.doc.store, r.origin)) || (s = r, i.clear());
|
|
5290
5290
|
else
|
|
5291
5291
|
break;
|
|
5292
5292
|
r = r.right;
|
|
@@ -5371,7 +5371,7 @@ class C extends an {
|
|
|
5371
5371
|
/** @type {AbstractType<any>} */
|
|
5372
5372
|
this.parent
|
|
5373
5373
|
);
|
|
5374
|
-
this.countable && this.parentSub === null && (n._length -= this.length), this.markDeleted(),
|
|
5374
|
+
this.countable && this.parentSub === null && (n._length -= this.length), this.markDeleted(), te(t.deleteSet, this.id.client, this.id.clock, this.length), Un(t, n, this.parentSub), this.content.delete(t);
|
|
5375
5375
|
}
|
|
5376
5376
|
}
|
|
5377
5377
|
/**
|
|
@@ -5393,7 +5393,7 @@ class C extends an {
|
|
|
5393
5393
|
* @param {number} offset
|
|
5394
5394
|
*/
|
|
5395
5395
|
write(t, n) {
|
|
5396
|
-
const s = n > 0 ? y(this.id.client, this.id.clock + n - 1) : this.origin, r = this.rightOrigin, i = this.parentSub, o = this.content.getRef() &
|
|
5396
|
+
const s = n > 0 ? y(this.id.client, this.id.clock + n - 1) : this.origin, r = this.rightOrigin, i = this.parentSub, o = this.content.getRef() & le | (s === null ? 0 : T) | // origin is defined
|
|
5397
5397
|
(r === null ? 0 : K) | // right origin is defined
|
|
5398
5398
|
(i === null ? 0 : Tt);
|
|
5399
5399
|
if (t.writeInfo(o), s !== null && t.writeLeftID(s), r !== null && t.writeRightID(r), s === null && r === null) {
|
|
@@ -5415,7 +5415,7 @@ class C extends an {
|
|
|
5415
5415
|
this.content.write(t, n);
|
|
5416
5416
|
}
|
|
5417
5417
|
}
|
|
5418
|
-
const Os = (e, t) => Ho[t &
|
|
5418
|
+
const Os = (e, t) => Ho[t & le](e), Ho = [
|
|
5419
5419
|
() => {
|
|
5420
5420
|
V();
|
|
5421
5421
|
},
|
|
@@ -5485,7 +5485,7 @@ const Rs = (
|
|
|
5485
5485
|
), Ns = "__ $YJS$ __";
|
|
5486
5486
|
Rs[Ns] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
|
|
5487
5487
|
Rs[Ns] = !0;
|
|
5488
|
-
const Bs = 0, hn = 1, Vs = 2,
|
|
5488
|
+
const Bs = 0, hn = 1, Vs = 2, Fe = (e, t) => {
|
|
5489
5489
|
p(e, Bs);
|
|
5490
5490
|
const n = $i(t);
|
|
5491
5491
|
D(e, n);
|
|
@@ -5520,8 +5520,8 @@ const Bs = 0, hn = 1, Vs = 2, Ve = (e, t) => {
|
|
|
5520
5520
|
case Yo:
|
|
5521
5521
|
n(t, q(e));
|
|
5522
5522
|
}
|
|
5523
|
-
},
|
|
5524
|
-
class Go extends
|
|
5523
|
+
}, Ie = 3e4;
|
|
5524
|
+
class Go extends ue {
|
|
5525
5525
|
/**
|
|
5526
5526
|
* @param {Y.Doc} doc
|
|
5527
5527
|
*/
|
|
@@ -5529,13 +5529,13 @@ class Go extends he {
|
|
|
5529
5529
|
super(), this.doc = t, this.clientID = t.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = /** @type {any} */
|
|
5530
5530
|
setInterval(() => {
|
|
5531
5531
|
const n = it();
|
|
5532
|
-
this.getLocalState() !== null &&
|
|
5532
|
+
this.getLocalState() !== null && Ie / 2 <= n - /** @type {{lastUpdated:number}} */
|
|
5533
5533
|
this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
|
|
5534
5534
|
const s = [];
|
|
5535
5535
|
this.meta.forEach((r, i) => {
|
|
5536
|
-
i !== this.clientID &&
|
|
5536
|
+
i !== this.clientID && Ie <= n - r.lastUpdated && this.states.has(i) && s.push(i);
|
|
5537
5537
|
}), s.length > 0 && un(this, s, "timeout");
|
|
5538
|
-
}, j(
|
|
5538
|
+
}, j(Ie / 10)), t.on("destroy", () => {
|
|
5539
5539
|
this.destroy();
|
|
5540
5540
|
}), this.setLocalState({});
|
|
5541
5541
|
}
|
|
@@ -5716,7 +5716,7 @@ function js(e) {
|
|
|
5716
5716
|
}
|
|
5717
5717
|
]);
|
|
5718
5718
|
const n = M();
|
|
5719
|
-
if (p(n, et),
|
|
5719
|
+
if (p(n, et), Fe(n, e.doc), t.send(S(n)), e.awareness.getLocalState() !== null) {
|
|
5720
5720
|
const s = M();
|
|
5721
5721
|
p(s, mt), D(
|
|
5722
5722
|
s,
|
|
@@ -5732,11 +5732,11 @@ function js(e) {
|
|
|
5732
5732
|
]);
|
|
5733
5733
|
}
|
|
5734
5734
|
}
|
|
5735
|
-
function
|
|
5735
|
+
function Ae(e, t) {
|
|
5736
5736
|
const n = e.ws;
|
|
5737
5737
|
e.wsconnected && n && n.readyState === n.OPEN && n.send(t), e.bcconnected && gt(e.bcChannel, t, e);
|
|
5738
5738
|
}
|
|
5739
|
-
var tc = class extends
|
|
5739
|
+
var tc = class extends ue {
|
|
5740
5740
|
constructor(t, n, s, {
|
|
5741
5741
|
connect: r = !0,
|
|
5742
5742
|
awareness: i = new Go(s),
|
|
@@ -5782,7 +5782,7 @@ var tc = class extends he {
|
|
|
5782
5782
|
setInterval(() => {
|
|
5783
5783
|
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
5784
5784
|
const d = M();
|
|
5785
|
-
p(d, et),
|
|
5785
|
+
p(d, et), Fe(d, s), this.ws.send(S(d));
|
|
5786
5786
|
}
|
|
5787
5787
|
}, l)), this._bcSubscriber = (d, f) => {
|
|
5788
5788
|
if (f !== this) {
|
|
@@ -5792,14 +5792,14 @@ var tc = class extends he {
|
|
|
5792
5792
|
}, this._updateHandler = (d, f) => {
|
|
5793
5793
|
if (f !== this) {
|
|
5794
5794
|
const g = M();
|
|
5795
|
-
p(g, et), jo(g, d),
|
|
5795
|
+
p(g, et), jo(g, d), Ae(this, S(g));
|
|
5796
5796
|
}
|
|
5797
5797
|
}, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: d, updated: f, removed: g }, m) => {
|
|
5798
5798
|
const U = d.concat(f).concat(g), k = M();
|
|
5799
5799
|
p(k, mt), D(
|
|
5800
5800
|
k,
|
|
5801
5801
|
Mt(i, U)
|
|
5802
|
-
),
|
|
5802
|
+
), Ae(this, S(k));
|
|
5803
5803
|
}, this._unloadHandler = () => {
|
|
5804
5804
|
un(
|
|
5805
5805
|
this.awareness,
|
|
@@ -5828,7 +5828,7 @@ var tc = class extends he {
|
|
|
5828
5828
|
return;
|
|
5829
5829
|
this.bcconnected || (ci(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
|
|
5830
5830
|
const t = M();
|
|
5831
|
-
p(t, et),
|
|
5831
|
+
p(t, et), Fe(t, this.doc), gt(this.bcChannel, S(t), this);
|
|
5832
5832
|
const n = M();
|
|
5833
5833
|
p(n, et), Fs(n, this.doc), gt(this.bcChannel, S(n), this);
|
|
5834
5834
|
const s = M();
|
|
@@ -5858,7 +5858,7 @@ var tc = class extends he {
|
|
|
5858
5858
|
[this.doc.clientID],
|
|
5859
5859
|
/* @__PURE__ */ new Map()
|
|
5860
5860
|
)
|
|
5861
|
-
),
|
|
5861
|
+
), Ae(this, S(t)), this.bcconnected && (li(this.bcChannel, this._bcSubscriber), this.bcconnected = !1);
|
|
5862
5862
|
}
|
|
5863
5863
|
disconnect() {
|
|
5864
5864
|
this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && this.ws.close();
|
|
@@ -5902,7 +5902,7 @@ const ft = (e) => bt((t, n) => {
|
|
|
5902
5902
|
), At = (e, t, n = "readwrite") => {
|
|
5903
5903
|
const s = e.transaction(t, n);
|
|
5904
5904
|
return t.map((r) => dc(s, r));
|
|
5905
|
-
}, Js = (e, t) => ft(e.count(t)), ic = (e, t) => ft(e.get(t)), Xs = (e, t) => ft(e.delete(t)), oc = (e, t, n) => ft(e.put(t, n)),
|
|
5905
|
+
}, Js = (e, t) => ft(e.count(t)), ic = (e, t) => ft(e.get(t)), Xs = (e, t) => ft(e.delete(t)), oc = (e, t, n) => ft(e.put(t, n)), He = (e, t) => ft(e.add(t)), cc = (e, t, n) => ft(e.getAll(t, n)), lc = (e, t, n) => {
|
|
5906
5906
|
let s = null;
|
|
5907
5907
|
return uc(e, t, (r) => (s = r, !1), n).then(() => s);
|
|
5908
5908
|
}, ac = (e, t = null) => lc(e, t, "prev"), hc = (e, t) => bt((n, s) => {
|
|
@@ -5912,7 +5912,7 @@ const ft = (e) => bt((t, n) => {
|
|
|
5912
5912
|
return n();
|
|
5913
5913
|
i.continue();
|
|
5914
5914
|
};
|
|
5915
|
-
}), uc = (e, t, n, s = "next") => hc(e.openKeyCursor(t, s), (r) => n(r.key)), dc = (e, t) => e.objectStore(t), fc = (e, t) => IDBKeyRange.upperBound(e, t), gc = (e, t) => IDBKeyRange.lowerBound(e, t),
|
|
5915
|
+
}), uc = (e, t, n, s = "next") => hc(e.openKeyCursor(t, s), (r) => n(r.key)), dc = (e, t) => e.objectStore(t), fc = (e, t) => IDBKeyRange.upperBound(e, t), gc = (e, t) => IDBKeyRange.lowerBound(e, t), Le = "custom", Ys = "updates", zs = 500, Gs = (e, t = () => {
|
|
5916
5916
|
}, n = () => {
|
|
5917
5917
|
}) => {
|
|
5918
5918
|
const [s] = At(
|
|
@@ -5930,11 +5930,11 @@ const ft = (e) => bt((t, n) => {
|
|
|
5930
5930
|
e._dbsize = r;
|
|
5931
5931
|
})).then(() => s);
|
|
5932
5932
|
}, pc = (e, t = !0) => Gs(e).then((n) => {
|
|
5933
|
-
(t || e._dbsize >= zs) &&
|
|
5933
|
+
(t || e._dbsize >= zs) && He(n, en(e.doc)).then(() => Xs(n, fc(e._dbref, !0))).then(() => Js(n).then((s) => {
|
|
5934
5934
|
e._dbsize = s;
|
|
5935
5935
|
}));
|
|
5936
5936
|
});
|
|
5937
|
-
class wc extends
|
|
5937
|
+
class wc extends ue {
|
|
5938
5938
|
/**
|
|
5939
5939
|
* @param {string} name
|
|
5940
5940
|
* @param {Y.Doc} doc
|
|
@@ -5947,7 +5947,7 @@ class wc extends he {
|
|
|
5947
5947
|
["custom"]
|
|
5948
5948
|
])
|
|
5949
5949
|
), this.whenSynced = bt((s) => this.on("synced", () => s(this))), this._db.then((s) => {
|
|
5950
|
-
this.db = s, Gs(this, (o) =>
|
|
5950
|
+
this.db = s, Gs(this, (o) => He(o, en(n)), () => {
|
|
5951
5951
|
if (this._destroyed)
|
|
5952
5952
|
return this;
|
|
5953
5953
|
this.synced = !0, this.emit("synced", [this]);
|
|
@@ -5959,7 +5959,7 @@ class wc extends he {
|
|
|
5959
5959
|
this.db,
|
|
5960
5960
|
[Ys]
|
|
5961
5961
|
);
|
|
5962
|
-
|
|
5962
|
+
He(i, s), ++this._dbsize >= zs && (this._storeTimeoutId !== null && clearTimeout(this._storeTimeoutId), this._storeTimeoutId = setTimeout(() => {
|
|
5963
5963
|
pc(this, !1), this._storeTimeoutId = null;
|
|
5964
5964
|
}, this._storeTimeout));
|
|
5965
5965
|
}
|
|
@@ -5986,7 +5986,7 @@ class wc extends he {
|
|
|
5986
5986
|
*/
|
|
5987
5987
|
get(t) {
|
|
5988
5988
|
return this._db.then((n) => {
|
|
5989
|
-
const [s] = At(n, [
|
|
5989
|
+
const [s] = At(n, [Le], "readonly");
|
|
5990
5990
|
return ic(s, t);
|
|
5991
5991
|
});
|
|
5992
5992
|
}
|
|
@@ -5997,7 +5997,7 @@ class wc extends he {
|
|
|
5997
5997
|
*/
|
|
5998
5998
|
set(t, n) {
|
|
5999
5999
|
return this._db.then((s) => {
|
|
6000
|
-
const [r] = At(s, [
|
|
6000
|
+
const [r] = At(s, [Le]);
|
|
6001
6001
|
return oc(r, n, t);
|
|
6002
6002
|
});
|
|
6003
6003
|
}
|
|
@@ -6007,7 +6007,7 @@ class wc extends he {
|
|
|
6007
6007
|
*/
|
|
6008
6008
|
del(t) {
|
|
6009
6009
|
return this._db.then((n) => {
|
|
6010
|
-
const [s] = At(n, [
|
|
6010
|
+
const [s] = At(n, [Le]);
|
|
6011
6011
|
return Xs(s, t);
|
|
6012
6012
|
});
|
|
6013
6013
|
}
|
|
@@ -6026,7 +6026,7 @@ const mc = (e, t = 300) => {
|
|
|
6026
6026
|
}, Ws = `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='53' viewport='0 0 100 100' style='fill:black;font-size:26px;'><text y='40%'>🚿</text></svg>")
|
|
6027
6027
|
16 0,
|
|
6028
6028
|
auto`, _c = `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewport='0 0 100 100' style='fill:black;font-size:24px;'><text y='50%'>✂️</text></svg>") 16 0,auto`;
|
|
6029
|
-
function
|
|
6029
|
+
function xe(e, { data: t, element: n, localData: s, setLocalData: r }) {
|
|
6030
6030
|
if (s.isHovering = !0, e.altKey) {
|
|
6031
6031
|
if (t.scale <= 0.5) {
|
|
6032
6032
|
n.style.cursor = "not-allowed";
|
|
@@ -6087,53 +6087,53 @@ const qs = {
|
|
|
6087
6087
|
e.classList.toggle("clicked", t);
|
|
6088
6088
|
},
|
|
6089
6089
|
onClick: (e, { data: t, setData: n }) => {
|
|
6090
|
-
|
|
6090
|
+
n(!t);
|
|
6091
6091
|
},
|
|
6092
6092
|
resetShortcut: "shiftKey"
|
|
6093
6093
|
},
|
|
6094
6094
|
[tt.CanGrow]: {
|
|
6095
6095
|
// TODO: turn this into a function so you can accept arbitrary user input?
|
|
6096
|
-
defaultData: { scale: 1
|
|
6097
|
-
defaultLocalData: { isHovering: !1 },
|
|
6096
|
+
defaultData: { scale: 1 },
|
|
6097
|
+
defaultLocalData: { maxScale: 2, isHovering: !1 },
|
|
6098
6098
|
updateElement: ({ element: e, data: t }) => {
|
|
6099
6099
|
e.style.transform = `scale(${t.scale})`;
|
|
6100
6100
|
},
|
|
6101
|
-
onClick: (e, { data: t, element: n, setData: s }) => {
|
|
6101
|
+
onClick: (e, { data: t, element: n, setData: s, localData: r }) => {
|
|
6102
|
+
let { scale: i } = t;
|
|
6102
6103
|
if (e.altKey) {
|
|
6103
6104
|
if (t.scale <= 0.5)
|
|
6104
6105
|
return;
|
|
6105
|
-
|
|
6106
|
+
i -= 0.1;
|
|
6106
6107
|
} else {
|
|
6107
|
-
if (n.style.cursor = Ws, t.scale >=
|
|
6108
|
+
if (n.style.cursor = Ws, t.scale >= r.maxScale)
|
|
6108
6109
|
return;
|
|
6109
|
-
|
|
6110
|
+
i += 0.1;
|
|
6110
6111
|
}
|
|
6111
|
-
s(t);
|
|
6112
|
+
s({ ...t, scale: i });
|
|
6112
6113
|
},
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6114
|
+
// TODO: this still needs to use te document as a whole
|
|
6115
|
+
onMouseEnter: xe,
|
|
6116
|
+
onKeyDown: xe,
|
|
6117
|
+
onKeyUp: xe
|
|
6116
6118
|
},
|
|
6117
6119
|
[tt.CanPost]: {
|
|
6118
6120
|
defaultData: [],
|
|
6119
6121
|
defaultLocalData: { addedEntries: /* @__PURE__ */ new Set() },
|
|
6120
6122
|
updateElement: ({
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
|
|
6124
|
-
setLocalData: s,
|
|
6125
|
-
setData: r
|
|
6123
|
+
data: e,
|
|
6124
|
+
localData: { addedEntries: t },
|
|
6125
|
+
setLocalData: n
|
|
6126
6126
|
}) => {
|
|
6127
|
-
const
|
|
6128
|
-
(
|
|
6129
|
-
),
|
|
6130
|
-
|
|
6131
|
-
const
|
|
6132
|
-
|
|
6133
|
-
const
|
|
6134
|
-
|
|
6135
|
-
<span class="guestbook-entry-timestamp">${
|
|
6136
|
-
}),
|
|
6127
|
+
const s = e.filter(
|
|
6128
|
+
(i) => !t.has(i.id)
|
|
6129
|
+
), r = Ps("guestbookMessages");
|
|
6130
|
+
s.forEach((i) => {
|
|
6131
|
+
const o = document.createElement("div");
|
|
6132
|
+
o.classList.add("guestbook-entry");
|
|
6133
|
+
const c = new Date(i.timestamp), l = c.toTimeString().split(" ")[0], a = c.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
|
|
6134
|
+
o.innerHTML = `
|
|
6135
|
+
<span class="guestbook-entry-timestamp">${a ? "" : c.toDateString() + " "}${l}</span><span class="guestbook-entry-name">${i.name}</span> <span class="guestbook-entry-message">${i.message}</span>`, r.prepend(o), t.add(i.id);
|
|
6136
|
+
}), n({ addedEntries: t });
|
|
6137
6137
|
},
|
|
6138
6138
|
onSubmit: (e, { data: t, setData: n }) => {
|
|
6139
6139
|
e.preventDefault(), e.stopImmediatePropagation();
|
|
@@ -6174,15 +6174,15 @@ class bc {
|
|
|
6174
6174
|
_(this, "debouncedOnChange");
|
|
6175
6175
|
_(this, "resetShortcut");
|
|
6176
6176
|
_(this, "updateElement");
|
|
6177
|
-
|
|
6177
|
+
this.element = t, this.defaultData = s, this.localData = r, this.onChange = n, this.resetShortcut = g, this.debouncedOnChange = mc(this.onChange, m), this.updateElement = o;
|
|
6178
6178
|
const U = i === void 0 ? s : i;
|
|
6179
6179
|
this._data = U, this.__data = U, c && t.addEventListener("click", (k) => {
|
|
6180
6180
|
c(k, this.getEventHandlerData());
|
|
6181
6181
|
}), l && t.addEventListener("mousedown", (k) => {
|
|
6182
6182
|
a && a(k, this.getEventHandlerData());
|
|
6183
|
-
const fn = (
|
|
6184
|
-
|
|
6185
|
-
}, gn = (
|
|
6183
|
+
const fn = (we) => {
|
|
6184
|
+
we.preventDefault(), l(we, this.getEventHandlerData());
|
|
6185
|
+
}, gn = (we) => {
|
|
6186
6186
|
document.removeEventListener("mousemove", fn), document.removeEventListener("mouseup", gn);
|
|
6187
6187
|
};
|
|
6188
6188
|
document.addEventListener("mousemove", fn), document.addEventListener("mouseup", gn);
|
|
@@ -6264,7 +6264,7 @@ const kc = "playhtml.spencerc99.partykit.dev", dn = new Ct(), Qs = window.locati
|
|
|
6264
6264
|
new wc(Qs, dn);
|
|
6265
6265
|
Zs.connect();
|
|
6266
6266
|
const z = dn.getMap("playhtml-global");
|
|
6267
|
-
function
|
|
6267
|
+
function Zt(e) {
|
|
6268
6268
|
return e.id;
|
|
6269
6269
|
}
|
|
6270
6270
|
function Ps(e) {
|
|
@@ -6277,9 +6277,7 @@ function Bn(e) {
|
|
|
6277
6277
|
return e instanceof HTMLElement;
|
|
6278
6278
|
}
|
|
6279
6279
|
function Vn(e, t) {
|
|
6280
|
-
const n = qs[t], s = z.get(t), r =
|
|
6281
|
-
console.log(r, s.get(r));
|
|
6282
|
-
const i = {
|
|
6280
|
+
const n = qs[t], s = z.get(t), r = Zt(e), i = {
|
|
6283
6281
|
...n,
|
|
6284
6282
|
data: s.get(r) || n.defaultData,
|
|
6285
6283
|
element: e,
|
|
@@ -6298,11 +6296,13 @@ function Sc() {
|
|
|
6298
6296
|
).filter(Bn);
|
|
6299
6297
|
if (!n.length || !qs[t])
|
|
6300
6298
|
continue;
|
|
6301
|
-
|
|
6299
|
+
z.get(t) || z.set(t, new ct());
|
|
6302
6300
|
const r = z.get(t);
|
|
6303
6301
|
for (const i of n) {
|
|
6302
|
+
if (e.has(Zt(i)))
|
|
6303
|
+
continue;
|
|
6304
6304
|
const o = Vn(i, t);
|
|
6305
|
-
e.set(
|
|
6305
|
+
e.set(Zt(i), o), i.classList.add("__playhtml-element"), i.classList.add(`__playhtml-${t}`);
|
|
6306
6306
|
}
|
|
6307
6307
|
r.observe((i) => {
|
|
6308
6308
|
i.changes.keys.forEach((o, c) => {
|
|
@@ -6320,7 +6320,7 @@ function Sc() {
|
|
|
6320
6320
|
l,
|
|
6321
6321
|
t
|
|
6322
6322
|
);
|
|
6323
|
-
e.set(
|
|
6323
|
+
e.set(Zt(l), a);
|
|
6324
6324
|
} else if (o.action === "update") {
|
|
6325
6325
|
const l = e.get(c);
|
|
6326
6326
|
l.__data = r.get(c);
|