playhtml 2.0.14 → 2.0.16

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.
@@ -45,7 +45,7 @@ var Gt = 1e6, wr = "y-pk-batch", Cn = !1, mr = (n, t) => {
45
45
  function An(n) {
46
46
  return `${wr}#${JSON.stringify(n)}`;
47
47
  }
48
- const R = () => /* @__PURE__ */ new Map(), Be = (n) => {
48
+ const R = () => /* @__PURE__ */ new Map(), Ne = (n) => {
49
49
  const t = R();
50
50
  return n.forEach((e, s) => {
51
51
  t.set(s, e);
@@ -63,7 +63,7 @@ const R = () => /* @__PURE__ */ new Map(), Be = (n) => {
63
63
  if (t(s, e))
64
64
  return !0;
65
65
  return !1;
66
- }, lt = () => /* @__PURE__ */ new Set(), De = (n) => n[n.length - 1], kr = (n, t) => {
66
+ }, lt = () => /* @__PURE__ */ new Set(), Ee = (n) => n[n.length - 1], kr = (n, t) => {
67
67
  for (let e = 0; e < t.length; e++)
68
68
  n.push(t[e]);
69
69
  }, tt = Array.from, _r = Array.isArray;
@@ -112,7 +112,7 @@ class fe {
112
112
  this._observers = R();
113
113
  }
114
114
  }
115
- const Y = Math.floor, te = Math.abs, Ge = (n, t) => n < t ? n : t, ft = (n, t) => n > t ? n : t, Sr = Math.pow, ts = (n) => n !== 0 ? n < 0 : 1 / n < 0, Dr = String.fromCharCode, Er = (n) => n.toLowerCase(), Cr = /^\s*/g, Ar = (n) => n.replace(Cr, ""), Lr = /([A-Z])/g, Ln = (n, t) => Ar(n.replace(Lr, (e) => `${t}${Er(e)}`)), Ir = (n) => {
115
+ const Y = Math.floor, te = Math.abs, Pe = (n, t) => n < t ? n : t, ft = (n, t) => n > t ? n : t, Sr = Math.pow, ts = (n) => n !== 0 ? n < 0 : 1 / n < 0, Dr = String.fromCharCode, Er = (n) => n.toLowerCase(), Cr = /^\s*/g, Ar = (n) => n.replace(Cr, ""), Lr = /([A-Z])/g, Ln = (n, t) => Ar(n.replace(Lr, (e) => `${t}${Er(e)}`)), Ir = (n) => {
116
116
  const t = unescape(encodeURIComponent(n)), e = t.length, s = new Uint8Array(e);
117
117
  for (let r = 0; r < e; r++)
118
118
  s[r] = /** @type {number} */
@@ -143,16 +143,16 @@ class xr {
143
143
  return this.map.get(t);
144
144
  }
145
145
  }
146
- let es = new xr(), Pe = !0;
146
+ let es = new xr(), qe = !0;
147
147
  try {
148
- typeof localStorage < "u" && (es = localStorage, Pe = !1);
148
+ typeof localStorage < "u" && (es = localStorage, qe = !1);
149
149
  } catch {
150
150
  }
151
- const ns = es, Ur = (n) => Pe || addEventListener(
151
+ const ns = es, Ur = (n) => qe || addEventListener(
152
152
  "storage",
153
153
  /** @type {any} */
154
154
  n
155
- ), Tr = (n) => Pe || removeEventListener(
155
+ ), Tr = (n) => qe || removeEventListener(
156
156
  "storage",
157
157
  /** @type {any} */
158
158
  n
@@ -173,12 +173,12 @@ const ns = es, Ur = (n) => Pe || addEventListener(
173
173
  if (!t(n[e], e))
174
174
  return !1;
175
175
  return !0;
176
- }, ss = (n, t) => Object.prototype.hasOwnProperty.call(n, t), Hr = (n, t) => n === t || re(n) === re(t) && Vr(n, (e, s) => (e !== void 0 || ss(t, s)) && t[s] === e), qe = (n, t, e = 0) => {
176
+ }, ss = (n, t) => Object.prototype.hasOwnProperty.call(n, t), Hr = (n, t) => n === t || re(n) === re(t) && Vr(n, (e, s) => (e !== void 0 || ss(t, s)) && t[s] === e), Ze = (n, t, e = 0) => {
177
177
  try {
178
178
  for (; e < n.length; e++)
179
179
  n[e](...t);
180
180
  } finally {
181
- e < n.length && qe(n, t, e + 1);
181
+ e < n.length && Ze(n, t, e + 1);
182
182
  }
183
183
  }, $r = (n) => n, jr = (n, t) => n === t, xt = (n, t) => {
184
184
  if (n == null || t == null)
@@ -253,9 +253,9 @@ const zr = () => {
253
253
  }
254
254
  })) : B = R();
255
255
  return B;
256
- }, Ne = (n) => zr().has(n), Fe = (n) => In(_t ? process.env[n.toUpperCase()] : ns.getItem(n)), Yr = (n) => Ne("--" + n) || Fe(n) !== null;
256
+ }, Fe = (n) => zr().has(n), Ve = (n) => In(_t ? process.env[n.toUpperCase()] : ns.getItem(n)), Yr = (n) => Fe("--" + n) || Ve(n) !== null;
257
257
  Yr("production");
258
- const Mn = _t && Kr(process.env.FORCE_COLOR, ["true", "1", "2"]), Xr = !Ne("no-colors") && (!_t || process.stdout.isTTY || Mn) && (!_t || Ne("color") || Mn || Fe("COLORTERM") !== null || (Fe("TERM") || "").includes("color")), vn = 1, xn = 2, Ee = 4, Ce = 8, Ot = 32, z = 64, x = 128, ge = 31, Ve = 63, it = 127, Jr = 2147483647, is = Number.MAX_SAFE_INTEGER, Wr = Number.isInteger || ((n) => typeof n == "number" && isFinite(n) && Y(n) === n), X = (n) => new Error(n), N = () => {
258
+ const Mn = _t && Kr(process.env.FORCE_COLOR, ["true", "1", "2"]), Xr = !Fe("no-colors") && (!_t || process.stdout.isTTY || Mn) && (!_t || Fe("color") || Mn || Ve("COLORTERM") !== null || (Ve("TERM") || "").includes("color")), vn = 1, xn = 2, Ce = 4, Ae = 8, Ot = 32, z = 64, U = 128, ge = 31, He = 63, it = 127, Jr = 2147483647, is = Number.MAX_SAFE_INTEGER, Wr = Number.isInteger || ((n) => typeof n == "number" && isFinite(n) && Y(n) === n), X = (n) => new Error(n), N = () => {
259
259
  throw X("Method unimplemented");
260
260
  }, V = () => {
261
261
  throw X("Unexpected case");
@@ -269,27 +269,27 @@ class pe {
269
269
  }
270
270
  }
271
271
  const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) => {
272
- const e = tn(n.arr.buffer, n.pos + n.arr.byteOffset, t);
272
+ const e = en(n.arr.buffer, n.pos + n.arr.byteOffset, t);
273
273
  return n.pos += t, e;
274
274
  }, M = (n) => Pr(n, m(n)), St = (n) => n.arr[n.pos++], m = (n) => {
275
275
  let t = 0, e = 1;
276
276
  const s = n.arr.length;
277
277
  for (; n.pos < s; ) {
278
278
  const r = n.arr[n.pos++];
279
- if (t = t + (r & it) * e, e *= 128, r < x)
279
+ if (t = t + (r & it) * e, e *= 128, r < U)
280
280
  return t;
281
281
  if (t > is)
282
282
  throw ls;
283
283
  }
284
284
  throw os;
285
- }, Ze = (n) => {
286
- let t = n.arr[n.pos++], e = t & Ve, s = 64;
285
+ }, Qe = (n) => {
286
+ let t = n.arr[n.pos++], e = t & He, s = 64;
287
287
  const r = (t & z) > 0 ? -1 : 1;
288
- if (!(t & x))
288
+ if (!(t & U))
289
289
  return r * e;
290
290
  const i = n.arr.length;
291
291
  for (; n.pos < i; ) {
292
- if (t = n.arr[n.pos++], e = e + (t & it) * s, s *= 128, t < x)
292
+ if (t = n.arr[n.pos++], e = e + (t & it) * s, s *= 128, t < U)
293
293
  return r * e;
294
294
  if (e > is)
295
295
  throw ls;
@@ -318,19 +318,19 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) =>
318
318
  }, Zr = (n) => (
319
319
  /** @type any */
320
320
  vt.decode(M(n))
321
- ), Z = vt ? Zr : qr, Qe = (n, t) => {
321
+ ), Z = vt ? Zr : qr, tn = (n, t) => {
322
322
  const e = new DataView(n.arr.buffer, n.arr.byteOffset + n.pos, t);
323
323
  return n.pos += t, e;
324
- }, Qr = (n) => Qe(n, 4).getFloat32(0, !1), ti = (n) => Qe(n, 8).getFloat64(0, !1), ei = (n) => (
324
+ }, Qr = (n) => tn(n, 4).getFloat32(0, !1), ti = (n) => tn(n, 8).getFloat64(0, !1), ei = (n) => (
325
325
  /** @type {any} */
326
- Qe(n, 8).getBigInt64(0, !1)
326
+ tn(n, 8).getBigInt64(0, !1)
327
327
  ), ni = [
328
328
  (n) => {
329
329
  },
330
330
  // CASE 127: undefined
331
331
  (n) => null,
332
332
  // CASE 126: null
333
- Ze,
333
+ Qe,
334
334
  // CASE 125: integer
335
335
  Qr,
336
336
  // CASE 124: float32
@@ -383,7 +383,7 @@ class ee extends pe {
383
383
  }
384
384
  read() {
385
385
  if (this.count === 0) {
386
- this.s = Ze(this);
386
+ this.s = Qe(this);
387
387
  const t = ts(this.s);
388
388
  this.count = 1, t && (this.s = -this.s, this.count = m(this) + 2);
389
389
  }
@@ -391,7 +391,7 @@ class ee extends pe {
391
391
  this.s;
392
392
  }
393
393
  }
394
- class Ae extends pe {
394
+ class Le extends pe {
395
395
  /**
396
396
  * @param {Uint8Array} uint8Array
397
397
  */
@@ -403,7 +403,7 @@ class Ae extends pe {
403
403
  */
404
404
  read() {
405
405
  if (this.count === 0) {
406
- const t = Ze(this), e = t & 1;
406
+ const t = Qe(this), e = t & 1;
407
407
  this.diff = Y(t / 2), this.count = 1, e && (this.count = m(this) + 2);
408
408
  }
409
409
  return this.s += this.diff, this.count--, this.s;
@@ -424,7 +424,7 @@ class si {
424
424
  return this.spos = t, e;
425
425
  }
426
426
  }
427
- const cs = (n) => new Uint8Array(n), tn = (n, t, e) => new Uint8Array(n, t, e), ri = (n) => new Uint8Array(n), ii = (n) => {
427
+ const cs = (n) => new Uint8Array(n), en = (n, t, e) => new Uint8Array(n, t, e), ri = (n) => new Uint8Array(n), ii = (n) => {
428
428
  let t = "";
429
429
  for (let e = 0; e < n.byteLength; e++)
430
430
  t += Dr(n[e]);
@@ -446,39 +446,39 @@ class $t {
446
446
  this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
447
447
  }
448
448
  }
449
- const v = () => new $t(), en = (n) => {
449
+ const v = () => new $t(), nn = (n) => {
450
450
  let t = n.cpos;
451
451
  for (let e = 0; e < n.bufs.length; e++)
452
452
  t += n.bufs[e].length;
453
453
  return t;
454
454
  }, _ = (n) => {
455
- const t = new Uint8Array(en(n));
455
+ const t = new Uint8Array(nn(n));
456
456
  let e = 0;
457
457
  for (let s = 0; s < n.bufs.length; s++) {
458
458
  const r = n.bufs[s];
459
459
  t.set(r, e), e += r.length;
460
460
  }
461
- return t.set(tn(n.cbuf.buffer, 0, n.cpos), e), t;
461
+ return t.set(en(n.cbuf.buffer, 0, n.cpos), e), t;
462
462
  }, di = (n, t) => {
463
463
  const e = n.cbuf.length;
464
- e - n.cpos < t && (n.bufs.push(tn(n.cbuf.buffer, 0, n.cpos)), n.cbuf = new Uint8Array(ft(e, t) * 2), n.cpos = 0);
464
+ e - n.cpos < t && (n.bufs.push(en(n.cbuf.buffer, 0, n.cpos)), n.cbuf = new Uint8Array(ft(e, t) * 2), n.cpos = 0);
465
465
  }, A = (n, t) => {
466
466
  const e = n.cbuf.length;
467
467
  n.cpos === e && (n.bufs.push(n.cbuf), n.cbuf = new Uint8Array(e * 2), n.cpos = 0), n.cbuf[n.cpos++] = t;
468
- }, He = A, p = (n, t) => {
468
+ }, $e = A, p = (n, t) => {
469
469
  for (; t > it; )
470
- A(n, x | it & t), t = Y(t / 128);
470
+ A(n, U | it & t), t = Y(t / 128);
471
471
  A(n, it & t);
472
- }, nn = (n, t) => {
472
+ }, sn = (n, t) => {
473
473
  const e = ts(t);
474
- for (e && (t = -t), A(n, (t > Ve ? x : 0) | (e ? z : 0) | Ve & t), t = Y(t / 64); t > 0; )
475
- A(n, (t > it ? x : 0) | it & t), t = Y(t / 128);
476
- }, $e = new Uint8Array(3e4), fi = $e.length / 3, gi = (n, t) => {
474
+ for (e && (t = -t), A(n, (t > He ? U : 0) | (e ? z : 0) | He & t), t = Y(t / 64); t > 0; )
475
+ A(n, (t > it ? U : 0) | it & t), t = Y(t / 128);
476
+ }, je = new Uint8Array(3e4), fi = je.length / 3, gi = (n, t) => {
477
477
  if (t.length < fi) {
478
- const e = Tt.encodeInto(t, $e).written || 0;
478
+ const e = Tt.encodeInto(t, je).written || 0;
479
479
  p(n, e);
480
480
  for (let s = 0; s < e; s++)
481
- A(n, $e[s]);
481
+ A(n, je[s]);
482
482
  } else
483
483
  D(n, vr(t));
484
484
  }, pi = (n, t) => {
@@ -492,24 +492,24 @@ const v = () => new $t(), en = (n) => {
492
492
  );
493
493
  }, ot = Tt && /** @type {any} */
494
494
  Tt.encodeInto ? gi : pi, we = (n, t) => {
495
- const e = n.cbuf.length, s = n.cpos, r = Ge(e - s, t.length), i = t.length - r;
495
+ const e = n.cbuf.length, s = n.cpos, r = Pe(e - s, t.length), i = t.length - r;
496
496
  n.cbuf.set(t.subarray(0, r), s), n.cpos += r, i > 0 && (n.bufs.push(n.cbuf), n.cbuf = new Uint8Array(ft(e * 2, i)), n.cbuf.set(t.subarray(r)), n.cpos = i);
497
497
  }, D = (n, t) => {
498
498
  p(n, t.byteLength), we(n, t);
499
- }, sn = (n, t) => {
499
+ }, rn = (n, t) => {
500
500
  di(n, t);
501
501
  const e = new DataView(n.cbuf.buffer, n.cpos, t);
502
502
  return n.cpos += t, e;
503
- }, wi = (n, t) => sn(n, 4).setFloat32(0, t, !1), mi = (n, t) => sn(n, 8).setFloat64(0, t, !1), yi = (n, t) => (
503
+ }, wi = (n, t) => rn(n, 4).setFloat32(0, t, !1), mi = (n, t) => rn(n, 8).setFloat64(0, t, !1), yi = (n, t) => (
504
504
  /** @type {any} */
505
- sn(n, 8).setBigInt64(0, t, !1)
505
+ rn(n, 8).setBigInt64(0, t, !1)
506
506
  ), Tn = new DataView(new ArrayBuffer(4)), bi = (n) => (Tn.setFloat32(0, n), Tn.getFloat32(0) === n), Bt = (n, t) => {
507
507
  switch (typeof t) {
508
508
  case "string":
509
509
  A(n, 119), ot(n, t);
510
510
  break;
511
511
  case "number":
512
- Wr(t) && te(t) <= Jr ? (A(n, 125), nn(n, t)) : bi(t) ? (A(n, 124), wi(n, t)) : (A(n, 123), mi(n, t));
512
+ Wr(t) && te(t) <= Jr ? (A(n, 125), sn(n, t)) : bi(t) ? (A(n, 124), wi(n, t)) : (A(n, 123), mi(n, t));
513
513
  break;
514
514
  case "bigint":
515
515
  A(n, 122), yi(n, t);
@@ -555,7 +555,7 @@ class On extends $t {
555
555
  }
556
556
  }
557
557
  const Rn = (n) => {
558
- n.count > 0 && (nn(n.encoder, n.count === 1 ? n.s : -n.s), n.count > 1 && p(n.encoder, n.count - 2));
558
+ n.count > 0 && (sn(n.encoder, n.count === 1 ? n.s : -n.s), n.count > 1 && p(n.encoder, n.count - 2));
559
559
  };
560
560
  class ne {
561
561
  constructor() {
@@ -574,10 +574,10 @@ class ne {
574
574
  const Bn = (n) => {
575
575
  if (n.count > 0) {
576
576
  const t = n.diff * 2 + (n.count === 1 ? 0 : 1);
577
- nn(n.encoder, t), n.count > 1 && p(n.encoder, n.count - 2);
577
+ sn(n.encoder, t), n.count > 1 && p(n.encoder, n.count - 2);
578
578
  }
579
579
  };
580
- class Le {
580
+ class Ie {
581
581
  constructor() {
582
582
  this.encoder = new $t(), this.s = 0, this.count = 0, this.diff = 0;
583
583
  }
@@ -680,11 +680,11 @@ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol, hs = W(),
680
680
  e = n.next();
681
681
  while (!e.done && !t(e.value));
682
682
  return e;
683
- }), Ie = (n, t) => gs(() => {
683
+ }), Me = (n, t) => gs(() => {
684
684
  const { done: e, value: s } = n.next();
685
685
  return { done: e, value: e ? void 0 : t(s) };
686
686
  });
687
- class rn {
687
+ class on {
688
688
  /**
689
689
  * @param {number} clock
690
690
  * @param {number} len
@@ -722,7 +722,7 @@ const ps = (n, t, e) => t.clients.forEach((s, r) => {
722
722
  }, ws = (n, t) => {
723
723
  const e = n.clients.get(t.client);
724
724
  return e !== void 0 && Fi(e, t.clock) !== null;
725
- }, on = (n) => {
725
+ }, ln = (n) => {
726
726
  n.clients.forEach((t) => {
727
727
  t.sort((r, i) => r.clock - i.clock);
728
728
  let e, s;
@@ -743,12 +743,12 @@ const ps = (n, t, e) => t.clients.forEach((s, r) => {
743
743
  t.clients.set(r, i);
744
744
  }
745
745
  });
746
- return on(t), t;
746
+ return ln(t), t;
747
747
  }, ie = (n, t, e, s) => {
748
748
  J(n.clients, t, () => (
749
749
  /** @type {Array<DeleteItem>} */
750
750
  []
751
- )).push(new rn(e, s));
751
+ )).push(new on(e, s));
752
752
  }, Hi = () => new jt(), $i = (n) => {
753
753
  const t = Hi();
754
754
  return n.clients.forEach((e, s) => {
@@ -761,7 +761,7 @@ const ps = (n, t, e) => t.clients.forEach((s, r) => {
761
761
  if (i + 1 < e.length)
762
762
  for (let a = e[i + 1]; i + 1 < e.length && a.deleted; a = e[++i + 1])
763
763
  c += a.length;
764
- r.push(new rn(l, c));
764
+ r.push(new on(l, c));
765
765
  }
766
766
  }
767
767
  r.length > 0 && t.clients.set(s, r);
@@ -776,7 +776,7 @@ const ps = (n, t, e) => t.clients.forEach((s, r) => {
776
776
  n.writeDsClock(o.clock), n.writeDsLen(o.len);
777
777
  }
778
778
  });
779
- }, ln = (n) => {
779
+ }, cn = (n) => {
780
780
  const t = new jt(), e = m(n.restDecoder);
781
781
  for (let s = 0; s < e; s++) {
782
782
  n.resetDsCurVal();
@@ -787,7 +787,7 @@ const ps = (n, t, e) => t.clients.forEach((s, r) => {
787
787
  []
788
788
  ));
789
789
  for (let l = 0; l < i; l++)
790
- o.push(new rn(n.readDsClock(), n.readDsLen()));
790
+ o.push(new on(n.readDsClock(), n.readDsLen()));
791
791
  }
792
792
  }
793
793
  return t;
@@ -1144,7 +1144,7 @@ class Et extends ji {
1144
1144
  * @param {decoding.Decoder} decoder
1145
1145
  */
1146
1146
  constructor(t) {
1147
- super(t), this.keys = [], m(t), this.keyClockDecoder = new Ae(M(t)), this.clientDecoder = new ee(M(t)), this.leftClockDecoder = new Ae(M(t)), this.rightClockDecoder = new Ae(M(t)), this.infoDecoder = new Un(M(t), St), this.stringDecoder = new si(M(t)), this.parentInfoDecoder = new Un(M(t), St), this.typeRefDecoder = new ee(M(t)), this.lenDecoder = new ee(M(t));
1147
+ super(t), this.keys = [], m(t), this.keyClockDecoder = new Le(M(t)), this.clientDecoder = new ee(M(t)), this.leftClockDecoder = new Le(M(t)), this.rightClockDecoder = new Le(M(t)), this.infoDecoder = new Un(M(t), St), this.stringDecoder = new si(M(t)), this.parentInfoDecoder = new Un(M(t), St), this.typeRefDecoder = new ee(M(t)), this.lenDecoder = new ee(M(t));
1148
1148
  }
1149
1149
  /**
1150
1150
  * @return {ID}
@@ -1281,7 +1281,7 @@ class Kt extends ks {
1281
1281
  * @param {number} info An unsigned 8-bit integer
1282
1282
  */
1283
1283
  writeInfo(t) {
1284
- He(this.restEncoder, t);
1284
+ $e(this.restEncoder, t);
1285
1285
  }
1286
1286
  /**
1287
1287
  * @param {string} s
@@ -1360,7 +1360,7 @@ class _s {
1360
1360
  }
1361
1361
  class at extends _s {
1362
1362
  constructor() {
1363
- super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Le(), this.clientEncoder = new ne(), this.leftClockEncoder = new Le(), this.rightClockEncoder = new Le(), this.infoEncoder = new On(He), this.stringEncoder = new ki(), this.parentInfoEncoder = new On(He), this.typeRefEncoder = new ne(), this.lenEncoder = new ne();
1363
+ super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Ie(), this.clientEncoder = new ne(), this.leftClockEncoder = new Ie(), this.rightClockEncoder = new Ie(), this.infoEncoder = new On($e), this.stringEncoder = new ki(), this.parentInfoEncoder = new On($e), this.typeRefEncoder = new ne(), this.lenEncoder = new ne();
1364
1364
  }
1365
1365
  toUint8Array() {
1366
1366
  const t = v();
@@ -1459,7 +1459,7 @@ const Ki = (n, t, e, s) => {
1459
1459
  i.write(n, s - i.id.clock);
1460
1460
  for (let o = r + 1; o < t.length; o++)
1461
1461
  t[o].write(n, 0);
1462
- }, cn = (n, t, e) => {
1462
+ }, an = (n, t, e) => {
1463
1463
  const s = /* @__PURE__ */ new Map();
1464
1464
  e.forEach((r, i) => {
1465
1465
  L(t, i) > r && s.set(i, r);
@@ -1485,20 +1485,20 @@ const Ki = (n, t, e, s) => {
1485
1485
  switch (ge & h) {
1486
1486
  case 0: {
1487
1487
  const d = n.readLen();
1488
- o[a] = new U(b(l, c), d), c += d;
1488
+ o[a] = new T(b(l, c), d), c += d;
1489
1489
  break;
1490
1490
  }
1491
1491
  case 10: {
1492
1492
  const d = m(n.restDecoder);
1493
- o[a] = new T(b(l, c), d), c += d;
1493
+ o[a] = new O(b(l, c), d), c += d;
1494
1494
  break;
1495
1495
  }
1496
1496
  default: {
1497
- const d = (h & (z | x)) === 0, u = new E(
1497
+ const d = (h & (z | U)) === 0, u = new E(
1498
1498
  b(l, c),
1499
1499
  null,
1500
1500
  // leftd
1501
- (h & x) === x ? n.readLeftID() : null,
1501
+ (h & U) === U ? n.readLeftID() : null,
1502
1502
  // origin
1503
1503
  null,
1504
1504
  // right
@@ -1559,7 +1559,7 @@ const Ki = (n, t, e, s) => {
1559
1559
  s.length = 0;
1560
1560
  };
1561
1561
  for (; ; ) {
1562
- if (h.constructor !== T) {
1562
+ if (h.constructor !== O) {
1563
1563
  const g = J(d, h.id.client, () => L(t, h.id.client)) - h.id.clock;
1564
1564
  if (g < 0)
1565
1565
  s.push(h), a(h.id.client, h.id.clock - 1), u();
@@ -1600,10 +1600,10 @@ const Ki = (n, t, e, s) => {
1600
1600
  }
1601
1601
  if (l.clients.size > 0) {
1602
1602
  const f = new at();
1603
- return cn(f, l, /* @__PURE__ */ new Map()), p(f.restEncoder, 0), { missing: c, update: f.toUint8Array() };
1603
+ return an(f, l, /* @__PURE__ */ new Map()), p(f.restEncoder, 0), { missing: c, update: f.toUint8Array() };
1604
1604
  }
1605
1605
  return null;
1606
- }, Xi = (n, t) => cn(n, t.doc.store, t.beforeState), Ji = (n, t, e, s = new Et(n)) => k(t, (r) => {
1606
+ }, Xi = (n, t) => an(n, t.doc.store, t.beforeState), Ji = (n, t, e, s = new Et(n)) => k(t, (r) => {
1607
1607
  r.local = !1;
1608
1608
  let i = !1;
1609
1609
  const o = r.doc, l = o.store, c = zi(s, o), a = Yi(r, l, c), h = l.pendingStructs;
@@ -1641,7 +1641,7 @@ const Ki = (n, t, e, s) => {
1641
1641
  const r = nt(t);
1642
1642
  Ji(r, n, e, new s(r));
1643
1643
  }, Ds = (n, t, e) => Ss(n, t, e, bs), Wi = (n, t, e = /* @__PURE__ */ new Map()) => {
1644
- cn(n, t.store, e), At(n, $i(t.store));
1644
+ an(n, t.store, e), At(n, $i(t.store));
1645
1645
  }, Gi = (n, t = new Uint8Array([0]), e = new at()) => {
1646
1646
  const s = Es(t);
1647
1647
  Wi(e, n, s);
@@ -1653,7 +1653,7 @@ const Ki = (n, t, e, s) => {
1653
1653
  return oe(r);
1654
1654
  }
1655
1655
  return r[0];
1656
- }, an = (n, t) => Gi(n, t, new Kt()), Pi = (n) => {
1656
+ }, hn = (n, t) => Gi(n, t, new Kt()), Pi = (n) => {
1657
1657
  const t = /* @__PURE__ */ new Map(), e = m(n.restDecoder);
1658
1658
  for (let s = 0; s < e; s++) {
1659
1659
  const r = m(n.restDecoder), i = m(n.restDecoder);
@@ -1671,7 +1671,7 @@ class to {
1671
1671
  const Fn = () => new to(), Vn = (n, t) => n.l.push(t), Hn = (n, t) => {
1672
1672
  const e = n.l, s = e.length;
1673
1673
  n.l = e.filter((r) => t !== r), s === n.l.length && console.error("[yjs] Tried to remove event handler that doesn't exist.");
1674
- }, As = (n, t, e) => qe(n.l, [t, e]);
1674
+ }, As = (n, t, e) => Ze(n.l, [t, e]);
1675
1675
  class yt {
1676
1676
  /**
1677
1677
  * @param {number} client client id
@@ -1686,8 +1686,8 @@ const Pt = (n, t) => n === t || n !== null && t !== null && n.client === t.clien
1686
1686
  if (e === n)
1687
1687
  return t;
1688
1688
  throw V();
1689
- }, It = (n, t) => t === void 0 ? !n.deleted : t.sv.has(n.id.client) && (t.sv.get(n.id.client) || 0) > n.id.clock && !ws(t.ds, n.id), je = (n, t) => {
1690
- const e = J(n.meta, je, lt), s = n.doc.store;
1689
+ }, It = (n, t) => t === void 0 ? !n.deleted : t.sv.has(n.id.client) && (t.sv.get(n.id.client) || 0) > n.id.clock && !ws(t.ds, n.id), Ke = (n, t) => {
1690
+ const e = J(n.meta, Ke, lt), s = n.doc.store;
1691
1691
  e.has(t) || (t.sv.forEach((r, i) => {
1692
1692
  r < L(s, i) && et(n, b(i, r));
1693
1693
  }), ps(n, t.ds, (r) => {
@@ -1738,10 +1738,10 @@ const me = (n) => {
1738
1738
  }, no = (n, t) => {
1739
1739
  const e = n.clients.get(t.client);
1740
1740
  return e[H(e, t.clock)];
1741
- }, Me = (
1741
+ }, ve = (
1742
1742
  /** @type {function(StructStore,ID):Item} */
1743
1743
  no
1744
- ), Ke = (n, t, e) => {
1744
+ ), ze = (n, t, e) => {
1745
1745
  const s = H(t, e), r = t[s];
1746
1746
  return r.id.clock < e && r instanceof E ? (t.splice(s + 1, 0, de(n, r, e - r.id.clock)), s + 1) : s;
1747
1747
  }, et = (n, t) => {
@@ -1749,10 +1749,10 @@ const me = (n) => {
1749
1749
  /** @type {Array<Item>} */
1750
1750
  n.doc.store.clients.get(t.client)
1751
1751
  );
1752
- return e[Ke(n, e, t.clock)];
1752
+ return e[ze(n, e, t.clock)];
1753
1753
  }, $n = (n, t, e) => {
1754
1754
  const s = t.clients.get(e.client), r = H(s, e.clock), i = s[r];
1755
- return e.clock !== i.id.clock + i.length - 1 && i.constructor !== U && s.splice(r + 1, 0, de(n, i, e.clock - i.id.clock + 1)), i;
1755
+ return e.clock !== i.id.clock + i.length - 1 && i.constructor !== T && s.splice(r + 1, 0, de(n, i, e.clock - i.id.clock + 1)), i;
1756
1756
  }, so = (n, t, e) => {
1757
1757
  const s = (
1758
1758
  /** @type {Array<GC|Item>} */
@@ -1763,9 +1763,9 @@ const me = (n) => {
1763
1763
  if (s === 0)
1764
1764
  return;
1765
1765
  const i = e + s;
1766
- let o = Ke(n, t, e), l;
1766
+ let o = ze(n, t, e), l;
1767
1767
  do
1768
- l = t[o++], i < l.id.clock + l.length && Ke(n, t, i), r(l);
1768
+ l = t[o++], i < l.id.clock + l.length && ze(n, t, i), r(l);
1769
1769
  while (o < t.length && t[o].id.clock < i);
1770
1770
  };
1771
1771
  class ro {
@@ -1778,7 +1778,7 @@ class ro {
1778
1778
  this.doc = t, this.deleteSet = new jt(), this.beforeState = me(t.store), this.afterState = /* @__PURE__ */ new Map(), this.changed = /* @__PURE__ */ new Map(), this.changedParentTypes = /* @__PURE__ */ new Map(), this._mergeStructs = [], this.origin = e, 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;
1779
1779
  }
1780
1780
  }
1781
- const jn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s) => t.beforeState.get(s) !== e) ? !1 : (on(t.deleteSet), Xi(n, t), At(n, t.deleteSet), !0), Kn = (n, t, e) => {
1781
+ const jn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s) => t.beforeState.get(s) !== e) ? !1 : (ln(t.deleteSet), Xi(n, t), At(n, t.deleteSet), !0), Kn = (n, t, e) => {
1782
1782
  const s = t._item;
1783
1783
  (s === null || s.id.clock < (n.beforeState.get(s.id.client) || 0) && !s.deleted) && J(n.changed, t, lt).add(e);
1784
1784
  }, se = (n, t) => {
@@ -1820,7 +1820,7 @@ const jn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
1820
1820
  t.clients.get(s)
1821
1821
  );
1822
1822
  for (let i = e.length - 1; i >= 0; i--) {
1823
- const o = e[i], l = Ge(r.length - 1, 1 + H(r, o.clock + o.len - 1));
1823
+ const o = e[i], l = Pe(r.length - 1, 1 + H(r, o.clock + o.len - 1));
1824
1824
  for (let c = l, a = r[c]; c > 0 && a.id.clock >= o.clock; a = r[c])
1825
1825
  c -= 1 + se(r, c);
1826
1826
  }
@@ -1829,7 +1829,7 @@ const jn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
1829
1829
  if (t < n.length) {
1830
1830
  const e = n[t], s = e.doc, r = s.store, i = e.deleteSet, o = e._mergeStructs;
1831
1831
  try {
1832
- on(i), e.afterState = me(e.doc.store), s.emit("beforeObserverCalls", [e, s]);
1832
+ ln(i), e.afterState = me(e.doc.store), s.emit("beforeObserverCalls", [e, s]);
1833
1833
  const l = [];
1834
1834
  e.changed.forEach(
1835
1835
  (c, a) => l.push(() => {
@@ -1843,7 +1843,7 @@ const jn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
1843
1843
  h.currentTarget = a, h._path = null;
1844
1844
  }), c.sort((h, d) => h.path.length - d.path.length), As(a._dEH, c, e));
1845
1845
  });
1846
- }), l.push(() => s.emit("afterTransaction", [e, s])), qe(l, []), e._needFormattingCleanup && Ao(e);
1846
+ }), l.push(() => s.emit("afterTransaction", [e, s])), Ze(l, []), e._needFormattingCleanup && Ao(e);
1847
1847
  } finally {
1848
1848
  s.gc && io(i, r, s.gcFilter), oo(i, r), e.afterState.forEach((h, d) => {
1849
1849
  const u = e.beforeState.get(d) || 0;
@@ -1900,13 +1900,13 @@ function* lo(n) {
1900
1900
  const l = n.readInfo();
1901
1901
  if (l === 10) {
1902
1902
  const c = m(n.restDecoder);
1903
- yield new T(b(r, i), c), i += c;
1903
+ yield new O(b(r, i), c), i += c;
1904
1904
  } else if (ge & l) {
1905
- const c = (l & (z | x)) === 0, a = new E(
1905
+ const c = (l & (z | U)) === 0, a = new E(
1906
1906
  b(r, i),
1907
1907
  null,
1908
1908
  // left
1909
- (l & x) === x ? n.readLeftID() : null,
1909
+ (l & U) === U ? n.readLeftID() : null,
1910
1910
  // origin
1911
1911
  null,
1912
1912
  // right
@@ -1923,12 +1923,12 @@ function* lo(n) {
1923
1923
  yield a, i += a.length;
1924
1924
  } else {
1925
1925
  const c = n.readLen();
1926
- yield new U(b(r, i), c), i += c;
1926
+ yield new T(b(r, i), c), i += c;
1927
1927
  }
1928
1928
  }
1929
1929
  }
1930
1930
  }
1931
- class hn {
1931
+ class un {
1932
1932
  /**
1933
1933
  * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
1934
1934
  * @param {boolean} filterSkips
@@ -1942,11 +1942,11 @@ class hn {
1942
1942
  next() {
1943
1943
  do
1944
1944
  this.curr = this.gen.next().value || null;
1945
- while (this.filterSkips && this.curr !== null && this.curr.constructor === T);
1945
+ while (this.filterSkips && this.curr !== null && this.curr.constructor === O);
1946
1946
  return this.curr;
1947
1947
  }
1948
1948
  }
1949
- class un {
1949
+ class dn {
1950
1950
  /**
1951
1951
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
1952
1952
  */
@@ -1955,12 +1955,12 @@ class un {
1955
1955
  }
1956
1956
  }
1957
1957
  const co = (n) => oe(n, bs, Kt), ao = (n, t) => {
1958
- if (n.constructor === U) {
1959
- const { client: e, clock: s } = n.id;
1960
- return new U(b(e, s + t), n.length - t);
1961
- } else if (n.constructor === T) {
1958
+ if (n.constructor === T) {
1962
1959
  const { client: e, clock: s } = n.id;
1963
1960
  return new T(b(e, s + t), n.length - t);
1961
+ } else if (n.constructor === O) {
1962
+ const { client: e, clock: s } = n.id;
1963
+ return new O(b(e, s + t), n.length - t);
1964
1964
  } else {
1965
1965
  const e = (
1966
1966
  /** @type {Item} */
@@ -1981,14 +1981,14 @@ const co = (n) => oe(n, bs, Kt), ao = (n, t) => {
1981
1981
  if (n.length === 1)
1982
1982
  return n[0];
1983
1983
  const s = n.map((h) => new t(nt(h)));
1984
- let r = s.map((h) => new hn(h, !0)), i = null;
1985
- const o = new e(), l = new un(o);
1984
+ let r = s.map((h) => new un(h, !0)), i = null;
1985
+ const o = new e(), l = new dn(o);
1986
1986
  for (; r = r.filter((u) => u.curr !== null), r.sort(
1987
1987
  /** @type {function(any,any):number} */
1988
1988
  (u, f) => {
1989
1989
  if (u.curr.id.client === f.curr.id.client) {
1990
1990
  const g = u.curr.id.clock - f.curr.id.clock;
1991
- return g === 0 ? u.curr.constructor === f.curr.constructor ? 0 : u.curr.constructor === T ? 1 : -1 : g;
1991
+ return g === 0 ? u.curr.constructor === f.curr.constructor ? 0 : u.curr.constructor === O ? 1 : -1 : g;
1992
1992
  } else
1993
1993
  return f.curr.id.client - u.curr.id.client;
1994
1994
  }
@@ -2011,16 +2011,16 @@ const co = (n) => oe(n, bs, Kt), ao = (n, t) => {
2011
2011
  if (d !== i.struct.id.client)
2012
2012
  P(l, i.struct, i.offset), i = { struct: u, offset: 0 }, h.next();
2013
2013
  else if (i.struct.id.clock + i.struct.length < u.id.clock)
2014
- if (i.struct.constructor === T)
2014
+ if (i.struct.constructor === O)
2015
2015
  i.struct.length = u.id.clock + u.length - i.struct.id.clock;
2016
2016
  else {
2017
2017
  P(l, i.struct, i.offset);
2018
2018
  const g = u.id.clock - i.struct.id.clock - i.struct.length;
2019
- i = { struct: new T(b(d, i.struct.id.clock + i.struct.length), g), offset: 0 };
2019
+ i = { struct: new O(b(d, i.struct.id.clock + i.struct.length), g), offset: 0 };
2020
2020
  }
2021
2021
  else {
2022
2022
  const g = i.struct.id.clock + i.struct.length - u.id.clock;
2023
- g > 0 && (i.struct.constructor === T ? i.struct.length -= g : u = ao(u, g)), i.struct.mergeWith(
2023
+ g > 0 && (i.struct.constructor === O ? i.struct.length -= g : u = ao(u, g)), i.struct.mergeWith(
2024
2024
  /** @type {any} */
2025
2025
  u
2026
2026
  ) || (P(l, i.struct, i.offset), i = { struct: u, offset: 0 }, h.next());
@@ -2030,17 +2030,17 @@ const co = (n) => oe(n, bs, Kt), ao = (n, t) => {
2030
2030
  /** @type {Item | GC} */
2031
2031
  h.curr
2032
2032
  ), offset: 0 }, h.next();
2033
- for (let u = h.curr; u !== null && u.id.client === d && u.id.clock === i.struct.id.clock + i.struct.length && u.constructor !== T; u = h.next())
2033
+ for (let u = h.curr; u !== null && u.id.client === d && u.id.clock === i.struct.id.clock + i.struct.length && u.constructor !== O; u = h.next())
2034
2034
  P(l, i.struct, i.offset), i = { struct: u, offset: 0 };
2035
2035
  }
2036
- i !== null && (P(l, i.struct, i.offset), i = null), dn(l);
2037
- const c = s.map((h) => ln(h)), a = Vi(c);
2036
+ i !== null && (P(l, i.struct, i.offset), i = null), fn(l);
2037
+ const c = s.map((h) => cn(h)), a = Vi(c);
2038
2038
  return At(o, a), o.toUint8Array();
2039
2039
  }, ho = (n, t, e = Et, s = at) => {
2040
- const r = Es(t), i = new s(), o = new un(i), l = new e(nt(n)), c = new hn(l, !1);
2040
+ const r = Es(t), i = new s(), o = new dn(i), l = new e(nt(n)), c = new un(l, !1);
2041
2041
  for (; c.curr; ) {
2042
2042
  const h = c.curr, d = h.id.client, u = r.get(d) || 0;
2043
- if (c.curr.constructor === T) {
2043
+ if (c.curr.constructor === O) {
2044
2044
  c.next();
2045
2045
  continue;
2046
2046
  }
@@ -2051,14 +2051,14 @@ const co = (n) => oe(n, bs, Kt), ao = (n, t) => {
2051
2051
  for (; c.curr && c.curr.id.client === d && c.curr.id.clock + c.curr.length <= u; )
2052
2052
  c.next();
2053
2053
  }
2054
- dn(o);
2055
- const a = ln(l);
2054
+ fn(o);
2055
+ const a = cn(l);
2056
2056
  return At(i, a), i.toUint8Array();
2057
2057
  }, xs = (n) => {
2058
2058
  n.written > 0 && (n.clientStructs.push({ written: n.written, restEncoder: _(n.encoder.restEncoder) }), n.encoder.restEncoder = v(), n.written = 0);
2059
2059
  }, P = (n, t, e) => {
2060
2060
  n.written > 0 && n.currClient !== t.id.client && xs(n), n.written === 0 && (n.currClient = t.id.client, n.encoder.writeClient(t.id.client), p(n.encoder.restEncoder, t.id.clock + e)), t.write(n.encoder, e), n.written++;
2061
- }, dn = (n) => {
2061
+ }, fn = (n) => {
2062
2062
  xs(n);
2063
2063
  const t = n.encoder.restEncoder;
2064
2064
  p(t, n.clientStructs.length);
@@ -2067,11 +2067,11 @@ const co = (n) => oe(n, bs, Kt), ao = (n, t) => {
2067
2067
  p(t, s.written), we(t, s.restEncoder);
2068
2068
  }
2069
2069
  }, uo = (n, t, e, s) => {
2070
- const r = new e(nt(n)), i = new hn(r, !1), o = new s(), l = new un(o);
2070
+ const r = new e(nt(n)), i = new un(r, !1), o = new s(), l = new dn(o);
2071
2071
  for (let a = i.curr; a !== null; a = i.next())
2072
2072
  P(l, t(a), 0);
2073
- dn(l);
2074
- const c = ln(r);
2073
+ fn(l);
2074
+ const c = cn(r);
2075
2075
  return At(o, c), o.toUint8Array();
2076
2076
  }, fo = (n) => uo(n, $r, Et, Kt), zn = "You must not compute changes after the event-handler fired.";
2077
2077
  class ye {
@@ -2131,13 +2131,13 @@ class ye {
2131
2131
  c = c.left;
2132
2132
  if (this.deletes(i))
2133
2133
  if (c !== null && this.deletes(c))
2134
- o = "delete", l = De(c.content.getContent());
2134
+ o = "delete", l = Ee(c.content.getContent());
2135
2135
  else
2136
2136
  return;
2137
2137
  else
2138
- c !== null && this.deletes(c) ? (o = "update", l = De(c.content.getContent())) : (o = "add", l = void 0);
2138
+ c !== null && this.deletes(c) ? (o = "update", l = Ee(c.content.getContent())) : (o = "add", l = void 0);
2139
2139
  } else if (this.deletes(i))
2140
- o = "delete", l = De(
2140
+ o = "delete", l = Ee(
2141
2141
  /** @type {Item} */
2142
2142
  i.content.getContent()
2143
2143
  );
@@ -2227,20 +2227,20 @@ const go = (n, t) => {
2227
2227
  }
2228
2228
  return e;
2229
2229
  }, Us = 80;
2230
- let fn = 0;
2230
+ let gn = 0;
2231
2231
  class po {
2232
2232
  /**
2233
2233
  * @param {Item} p
2234
2234
  * @param {number} index
2235
2235
  */
2236
2236
  constructor(t, e) {
2237
- t.marker = !0, this.p = t, this.index = e, this.timestamp = fn++;
2237
+ t.marker = !0, this.p = t, this.index = e, this.timestamp = gn++;
2238
2238
  }
2239
2239
  }
2240
2240
  const wo = (n) => {
2241
- n.timestamp = fn++;
2241
+ n.timestamp = gn++;
2242
2242
  }, Ts = (n, t, e) => {
2243
- n.p.marker = !1, n.p = t, t.marker = !0, n.index = e, n.timestamp = fn++;
2243
+ n.p.marker = !1, n.p = t, t.marker = !0, n.index = e, n.timestamp = gn++;
2244
2244
  }, mo = (n, t, e) => {
2245
2245
  if (n.length >= Us) {
2246
2246
  const s = n.reduce((r, i) => r.timestamp < i.timestamp ? r : i);
@@ -2554,7 +2554,7 @@ const Os = (n, t, e) => {
2554
2554
  }, ce = (n, t, e) => {
2555
2555
  const s = t._map.get(e);
2556
2556
  s !== void 0 && s.delete(n);
2557
- }, gn = (n, t, e, s) => {
2557
+ }, pn = (n, t, e, s) => {
2558
2558
  const r = t._map.get(e) || null, i = n.doc, o = i.clientID;
2559
2559
  let l;
2560
2560
  if (s == null)
@@ -2587,7 +2587,7 @@ const Os = (n, t, e) => {
2587
2587
  throw new Error("Unexpected content type");
2588
2588
  }
2589
2589
  new E(b(o, L(i.store, o)), r, r && r.lastId, null, null, t, e, l).integrate(n, 0);
2590
- }, pn = (n, t) => {
2590
+ }, wn = (n, t) => {
2591
2591
  const e = n._map.get(t);
2592
2592
  return e !== void 0 && !e.deleted ? e.content.getContent()[e.length - 1] : void 0;
2593
2593
  }, $s = (n) => {
@@ -2897,7 +2897,7 @@ class ht extends I {
2897
2897
  * @return {IterableIterator<string>}
2898
2898
  */
2899
2899
  keys() {
2900
- return Ie(
2900
+ return Me(
2901
2901
  qt(this._map),
2902
2902
  /** @param {any} v */
2903
2903
  (t) => t[0]
@@ -2909,7 +2909,7 @@ class ht extends I {
2909
2909
  * @return {IterableIterator<any>}
2910
2910
  */
2911
2911
  values() {
2912
- return Ie(
2912
+ return Me(
2913
2913
  qt(this._map),
2914
2914
  /** @param {any} v */
2915
2915
  (t) => t[1].content.getContent()[t[1].length - 1]
@@ -2921,7 +2921,7 @@ class ht extends I {
2921
2921
  * @return {IterableIterator<any>}
2922
2922
  */
2923
2923
  entries() {
2924
- return Ie(
2924
+ return Me(
2925
2925
  qt(this._map),
2926
2926
  /** @param {any} v */
2927
2927
  (t) => [t[0], t[1].content.getContent()[t[1].length - 1]]
@@ -2965,7 +2965,7 @@ class ht extends I {
2965
2965
  */
2966
2966
  set(t, e) {
2967
2967
  return this.doc !== null ? k(this.doc, (s) => {
2968
- gn(
2968
+ pn(
2969
2969
  s,
2970
2970
  this,
2971
2971
  t,
@@ -2983,7 +2983,7 @@ class ht extends I {
2983
2983
  get(t) {
2984
2984
  return (
2985
2985
  /** @type {any} */
2986
- pn(this, t)
2986
+ wn(this, t)
2987
2987
  );
2988
2988
  }
2989
2989
  /**
@@ -3013,7 +3013,7 @@ class ht extends I {
3013
3013
  }
3014
3014
  }
3015
3015
  const Do = (n) => new ht(), q = (n, t) => n === t || typeof n == "object" && typeof t == "object" && n && t && Hr(n, t);
3016
- class ze {
3016
+ class Ye {
3017
3017
  /**
3018
3018
  * @param {Item|null} left
3019
3019
  * @param {Item|null} right
@@ -3062,10 +3062,10 @@ const Yn = (n, t, e) => {
3062
3062
  }, Zt = (n, t, e) => {
3063
3063
  const s = /* @__PURE__ */ new Map(), r = be(t, e);
3064
3064
  if (r) {
3065
- const i = new ze(r.p.left, r.p, r.index, s);
3065
+ const i = new Ye(r.p.left, r.p, r.index, s);
3066
3066
  return Yn(n, i, e - r.index);
3067
3067
  } else {
3068
- const i = new ze(null, t._start, 0, s);
3068
+ const i = new Ye(null, t._start, 0, s);
3069
3069
  return Yn(n, i, e);
3070
3070
  }
3071
3071
  }, Ks = (n, t, e, s) => {
@@ -3113,7 +3113,7 @@ const Yn = (n, t, e) => {
3113
3113
  }
3114
3114
  }
3115
3115
  return o;
3116
- }, ve = (n, t, e, s, r) => {
3116
+ }, xe = (n, t, e, s, r) => {
3117
3117
  e.currentAttributes.forEach((u, f) => {
3118
3118
  r[f] === void 0 && (r[f] = null);
3119
3119
  });
@@ -3225,7 +3225,7 @@ const Yn = (n, t, e) => {
3225
3225
  /** @type {Item} */
3226
3226
  n._start
3227
3227
  ), r = n._start, i = R();
3228
- const o = Be(i);
3228
+ const o = Ne(i);
3229
3229
  for (; r; ) {
3230
3230
  if (r.deleted === !1)
3231
3231
  switch (r.content.constructor) {
@@ -3237,7 +3237,7 @@ const Yn = (n, t, e) => {
3237
3237
  );
3238
3238
  break;
3239
3239
  default:
3240
- t += Xs(e, s, r, i, o), i = Be(o), s = r;
3240
+ t += Xs(e, s, r, i, o), i = Ne(o), s = r;
3241
3241
  break;
3242
3242
  }
3243
3243
  r = r.right;
@@ -3256,7 +3256,7 @@ const Yn = (n, t, e) => {
3256
3256
  r,
3257
3257
  (o) => {
3258
3258
  !o.deleted && /** @type {Item} */
3259
- o.content.constructor === C && o.constructor !== U && t.add(
3259
+ o.content.constructor === C && o.constructor !== T && t.add(
3260
3260
  /** @type {any} */
3261
3261
  o.parent
3262
3262
  );
@@ -3265,7 +3265,7 @@ const Yn = (n, t, e) => {
3265
3265
  }
3266
3266
  k(e, (s) => {
3267
3267
  ps(n, n.deleteSet, (r) => {
3268
- if (r instanceof U || !/** @type {YText} */
3268
+ if (r instanceof T || !/** @type {YText} */
3269
3269
  r.parent._hasFormatting || t.has(
3270
3270
  /** @type {YText} */
3271
3271
  r.parent
@@ -3281,7 +3281,7 @@ const Yn = (n, t, e) => {
3281
3281
  Co(r);
3282
3282
  });
3283
3283
  }, Jn = (n, t, e) => {
3284
- const s = e, r = Be(t.currentAttributes), i = t.right;
3284
+ const s = e, r = Ne(t.currentAttributes), i = t.right;
3285
3285
  for (; e > 0 && t.right !== null; ) {
3286
3286
  if (t.right.deleted === !1)
3287
3287
  switch (t.right.content.constructor) {
@@ -3504,13 +3504,13 @@ class Ct extends I {
3504
3504
  */
3505
3505
  applyDelta(t, { sanitize: e = !0 } = {}) {
3506
3506
  this.doc !== null ? k(this.doc, (s) => {
3507
- const r = new ze(null, this._start, 0, /* @__PURE__ */ new Map());
3507
+ const r = new Ye(null, this._start, 0, /* @__PURE__ */ new Map());
3508
3508
  for (let i = 0; i < t.length; i++) {
3509
3509
  const o = t[i];
3510
3510
  if (o.insert !== void 0) {
3511
3511
  const l = !e && typeof o.insert == "string" && i === t.length - 1 && r.right === null && o.insert.slice(-1) === `
3512
3512
  ` ? o.insert.slice(0, -1) : o.insert;
3513
- (typeof l != "string" || l.length > 0) && ve(s, this, r, l, o.attributes || {});
3513
+ (typeof l != "string" || l.length > 0) && xe(s, this, r, l, o.attributes || {});
3514
3514
  } else
3515
3515
  o.retain !== void 0 ? Xn(s, this, r, o.retain, o.attributes || {}) : o.delete !== void 0 && Jn(s, r, o.delete);
3516
3516
  }
@@ -3584,7 +3584,7 @@ class Ct extends I {
3584
3584
  a();
3585
3585
  };
3586
3586
  return t || e ? k(o, (d) => {
3587
- t && je(d, t), e && je(d, e), h();
3587
+ t && Ke(d, t), e && Ke(d, e), h();
3588
3588
  }, "cleanup") : h(), r;
3589
3589
  }
3590
3590
  /**
@@ -3605,7 +3605,7 @@ class Ct extends I {
3605
3605
  const o = Zt(i, this, t);
3606
3606
  s || (s = {}, o.currentAttributes.forEach((l, c) => {
3607
3607
  s[c] = l;
3608
- })), ve(i, this, o, e, s);
3608
+ })), xe(i, this, o, e, s);
3609
3609
  }) : this._pending.push(() => this.insert(t, e, s));
3610
3610
  }
3611
3611
  /**
@@ -3622,7 +3622,7 @@ class Ct extends I {
3622
3622
  const r = this.doc;
3623
3623
  r !== null ? k(r, (i) => {
3624
3624
  const o = Zt(i, this, t);
3625
- ve(i, this, o, e, s);
3625
+ xe(i, this, o, e, s);
3626
3626
  }) : this._pending.push(() => this.insertEmbed(t, e, s));
3627
3627
  }
3628
3628
  /**
@@ -3686,7 +3686,7 @@ class Ct extends I {
3686
3686
  */
3687
3687
  setAttribute(t, e) {
3688
3688
  this.doc !== null ? k(this.doc, (s) => {
3689
- gn(s, this, t, e);
3689
+ pn(s, this, t, e);
3690
3690
  }) : this._pending.push(() => this.setAttribute(t, e));
3691
3691
  }
3692
3692
  /**
@@ -3703,7 +3703,7 @@ class Ct extends I {
3703
3703
  getAttribute(t) {
3704
3704
  return (
3705
3705
  /** @type {any} */
3706
- pn(this, t)
3706
+ wn(this, t)
3707
3707
  );
3708
3708
  }
3709
3709
  /**
@@ -3726,7 +3726,7 @@ class Ct extends I {
3726
3726
  }
3727
3727
  }
3728
3728
  const Io = (n) => new Ct();
3729
- class xe {
3729
+ class Ue {
3730
3730
  /**
3731
3731
  * @param {YXmlFragment | YXmlElement} root
3732
3732
  * @param {function(AbstractType<any>):boolean} [f]
@@ -3830,7 +3830,7 @@ class ut extends I {
3830
3830
  * @public
3831
3831
  */
3832
3832
  createTreeWalker(t) {
3833
- return new xe(this, t);
3833
+ return new Ue(this, t);
3834
3834
  }
3835
3835
  /**
3836
3836
  * Returns the first YXmlElement that matches the query.
@@ -3849,7 +3849,7 @@ class ut extends I {
3849
3849
  */
3850
3850
  querySelector(t) {
3851
3851
  t = t.toUpperCase();
3852
- const s = new xe(this, (r) => r.nodeName && r.nodeName.toUpperCase() === t).next();
3852
+ const s = new Ue(this, (r) => r.nodeName && r.nodeName.toUpperCase() === t).next();
3853
3853
  return s.done ? null : s.value;
3854
3854
  }
3855
3855
  /**
@@ -3864,7 +3864,7 @@ class ut extends I {
3864
3864
  * @public
3865
3865
  */
3866
3866
  querySelectorAll(t) {
3867
- return t = t.toUpperCase(), tt(new xe(this, (e) => e.nodeName && e.nodeName.toUpperCase() === t));
3867
+ return t = t.toUpperCase(), tt(new Ue(this, (e) => e.nodeName && e.nodeName.toUpperCase() === t));
3868
3868
  }
3869
3869
  /**
3870
3870
  * Creates YXmlEvent and calls observers.
@@ -4131,7 +4131,7 @@ class Vt extends ut {
4131
4131
  */
4132
4132
  setAttribute(t, e) {
4133
4133
  this.doc !== null ? k(this.doc, (s) => {
4134
- gn(s, this, t, e);
4134
+ pn(s, this, t, e);
4135
4135
  }) : this._prelimAttrs.set(t, e);
4136
4136
  }
4137
4137
  /**
@@ -4148,7 +4148,7 @@ class Vt extends ut {
4148
4148
  getAttribute(t) {
4149
4149
  return (
4150
4150
  /** @type {any} */
4151
- pn(this, t)
4151
+ wn(this, t)
4152
4152
  );
4153
4153
  }
4154
4154
  /**
@@ -4377,7 +4377,7 @@ class he extends Ct {
4377
4377
  }
4378
4378
  }
4379
4379
  const To = (n) => new he();
4380
- class wn {
4380
+ class mn {
4381
4381
  /**
4382
4382
  * @param {ID} id
4383
4383
  * @param {number} length
@@ -4418,7 +4418,7 @@ class wn {
4418
4418
  }
4419
4419
  }
4420
4420
  const Oo = 0;
4421
- class U extends wn {
4421
+ class T extends mn {
4422
4422
  get deleted() {
4423
4423
  return !0;
4424
4424
  }
@@ -5214,7 +5214,7 @@ const qo = (n) => new G(Ko[n.readTypeRef()](n)), de = (n, t, e) => {
5214
5214
  );
5215
5215
  return t.deleted && i.markDeleted(), t.keep && (i.keep = !0), t.redone !== null && (i.redone = b(t.redone.client, t.redone.clock + e)), t.right = i, i.right !== null && (i.right.left = i), n._mergeStructs.push(i), i.parentSub !== null && i.right === null && i.parent._map.set(i.parentSub, i), t.length = e, i;
5216
5216
  };
5217
- class E extends wn {
5217
+ class E extends mn {
5218
5218
  /**
5219
5219
  * @param {ID} id
5220
5220
  * @param {Item | null} left
@@ -5234,10 +5234,10 @@ class E extends wn {
5234
5234
  * @type {boolean}
5235
5235
  */
5236
5236
  set marker(t) {
5237
- (this.info & Ce) > 0 !== t && (this.info ^= Ce);
5237
+ (this.info & Ae) > 0 !== t && (this.info ^= Ae);
5238
5238
  }
5239
5239
  get marker() {
5240
- return (this.info & Ce) > 0;
5240
+ return (this.info & Ae) > 0;
5241
5241
  }
5242
5242
  /**
5243
5243
  * If true, do not garbage collect this Item.
@@ -5256,13 +5256,13 @@ class E extends wn {
5256
5256
  * @type {Boolean}
5257
5257
  */
5258
5258
  get deleted() {
5259
- return (this.info & Ee) > 0;
5259
+ return (this.info & Ce) > 0;
5260
5260
  }
5261
5261
  set deleted(t) {
5262
- this.deleted !== t && (this.info ^= Ee);
5262
+ this.deleted !== t && (this.info ^= Ce);
5263
5263
  }
5264
5264
  markDeleted() {
5265
- this.info |= Ee;
5265
+ this.info |= Ce;
5266
5266
  }
5267
5267
  /**
5268
5268
  * Return the creator clientID of the missing op or define missing items and return null.
@@ -5278,13 +5278,13 @@ class E extends wn {
5278
5278
  return this.rightOrigin.client;
5279
5279
  if (this.parent && this.parent.constructor === yt && this.id.client !== this.parent.client && this.parent.clock >= L(e, this.parent.client))
5280
5280
  return this.parent.client;
5281
- if (this.origin && (this.left = $n(t, e, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = et(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === U || this.right && this.right.constructor === U)
5281
+ if (this.origin && (this.left = $n(t, e, this.origin), this.origin = this.left.lastId), this.rightOrigin && (this.right = et(t, this.rightOrigin), this.rightOrigin = this.right.id), this.left && this.left.constructor === T || this.right && this.right.constructor === T)
5282
5282
  this.parent = null;
5283
5283
  else if (!this.parent)
5284
5284
  this.left && this.left.constructor === E && (this.parent = this.left.parent, this.parentSub = this.left.parentSub), this.right && this.right.constructor === E && (this.parent = this.right.parent, this.parentSub = this.right.parentSub);
5285
5285
  else if (this.parent.constructor === yt) {
5286
- const s = Me(e, this.parent);
5287
- s.constructor === U ? this.parent = null : this.parent = /** @type {ContentType} */
5286
+ const s = ve(e, this.parent);
5287
+ s.constructor === T ? this.parent = null : this.parent = /** @type {ContentType} */
5288
5288
  s.content.type;
5289
5289
  }
5290
5290
  return null;
@@ -5313,8 +5313,8 @@ class E extends wn {
5313
5313
  s = r, i.clear();
5314
5314
  else if (Pt(this.rightOrigin, r.rightOrigin))
5315
5315
  break;
5316
- } else if (r.origin !== null && o.has(Me(t.doc.store, r.origin)))
5317
- i.has(Me(t.doc.store, r.origin)) || (s = r, i.clear());
5316
+ } else if (r.origin !== null && o.has(ve(t.doc.store, r.origin)))
5317
+ i.has(ve(t.doc.store, r.origin)) || (s = r, i.clear());
5318
5318
  else
5319
5319
  break;
5320
5320
  r = r.right;
@@ -5344,7 +5344,7 @@ class E extends wn {
5344
5344
  (this.parent._item !== null && /** @type {AbstractType<any>} */
5345
5345
  this.parent._item.deleted || this.parentSub !== null && this.right !== null) && this.delete(t);
5346
5346
  } else
5347
- new U(this.id, this.length).integrate(t, 0);
5347
+ new T(this.id, this.length).integrate(t, 0);
5348
5348
  }
5349
5349
  /**
5350
5350
  * Returns the next non-deleted item
@@ -5409,7 +5409,7 @@ class E extends wn {
5409
5409
  gc(t, e) {
5410
5410
  if (!this.deleted)
5411
5411
  throw V();
5412
- this.content.gc(t), e ? so(t, this, new U(this.id, this.length)) : this.content = new Ht(this.length);
5412
+ this.content.gc(t), e ? so(t, this, new T(this.id, this.length)) : this.content = new Ht(this.length);
5413
5413
  }
5414
5414
  /**
5415
5415
  * Transform the properties of this type to binary and write it to an
@@ -5421,7 +5421,7 @@ class E extends wn {
5421
5421
  * @param {number} offset
5422
5422
  */
5423
5423
  write(t, e) {
5424
- const s = e > 0 ? b(this.id.client, this.id.clock + e - 1) : this.origin, r = this.rightOrigin, i = this.parentSub, o = this.content.getRef() & ge | (s === null ? 0 : x) | // origin is defined
5424
+ const s = e > 0 ? b(this.id.client, this.id.clock + e - 1) : this.origin, r = this.rightOrigin, i = this.parentSub, o = this.content.getRef() & ge | (s === null ? 0 : U) | // origin is defined
5425
5425
  (r === null ? 0 : z) | // right origin is defined
5426
5426
  (i === null ? 0 : Ot);
5427
5427
  if (t.writeInfo(o), s !== null && t.writeLeftID(s), r !== null && t.writeRightID(r), s === null && r === null) {
@@ -5471,7 +5471,7 @@ const Ws = (n, t) => Zo[t & ge](n), Zo = [
5471
5471
  }
5472
5472
  // 10 - Skip is not ItemContent
5473
5473
  ], Qo = 10;
5474
- class T extends wn {
5474
+ class O extends mn {
5475
5475
  get deleted() {
5476
5476
  return !0;
5477
5477
  }
@@ -5531,24 +5531,24 @@ class tl {
5531
5531
  Tr(this._onChange);
5532
5532
  }
5533
5533
  }
5534
- const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, mn = (n) => J(qs, n, () => {
5534
+ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, yn = (n) => J(qs, n, () => {
5535
5535
  const t = lt(), e = new el(n);
5536
5536
  return e.onmessage = (s) => t.forEach((r) => r(s.data, "broadcastchannel")), {
5537
5537
  bc: e,
5538
5538
  subs: t
5539
5539
  };
5540
- }), nl = (n, t) => (mn(n).subs.add(t), t), sl = (n, t) => {
5541
- const e = mn(n), s = e.subs.delete(t);
5540
+ }), nl = (n, t) => (yn(n).subs.add(t), t), sl = (n, t) => {
5541
+ const e = yn(n), s = e.subs.delete(t);
5542
5542
  return s && e.subs.size === 0 && (e.bc.close(), qs.delete(n)), s;
5543
5543
  }, mt = (n, t, e = null) => {
5544
- const s = mn(n);
5544
+ const s = yn(n);
5545
5545
  s.bc.postMessage(t), s.subs.forEach((r) => r(t, e));
5546
- }, Zs = 0, yn = 1, Qs = 2, Ye = (n, t) => {
5546
+ }, Zs = 0, bn = 1, Qs = 2, Xe = (n, t) => {
5547
5547
  p(n, Zs);
5548
5548
  const e = Qi(t);
5549
5549
  D(n, e);
5550
5550
  }, tr = (n, t, e) => {
5551
- p(n, yn), D(n, an(t, e));
5551
+ p(n, bn), D(n, hn(t, e));
5552
5552
  }, rl = (n, t, e) => tr(t, e, M(n)), er = (n, t, e) => {
5553
5553
  try {
5554
5554
  Ds(t, M(n), e);
@@ -5563,7 +5563,7 @@ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, mn = (n) => J(
5563
5563
  case Zs:
5564
5564
  rl(n, t, e);
5565
5565
  break;
5566
- case yn:
5566
+ case bn:
5567
5567
  er(n, e, s);
5568
5568
  break;
5569
5569
  case Qs:
@@ -5578,7 +5578,7 @@ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, mn = (n) => J(
5578
5578
  case cl:
5579
5579
  e(t, Z(n));
5580
5580
  }
5581
- }, Ue = 3e4;
5581
+ }, Te = 3e4;
5582
5582
  class hl extends fe {
5583
5583
  /**
5584
5584
  * @param {Y.Doc} doc
@@ -5587,13 +5587,13 @@ class hl extends fe {
5587
5587
  super(), this.doc = t, this.clientID = t.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = /** @type {any} */
5588
5588
  setInterval(() => {
5589
5589
  const e = ct();
5590
- this.getLocalState() !== null && Ue / 2 <= e - /** @type {{lastUpdated:number}} */
5590
+ this.getLocalState() !== null && Te / 2 <= e - /** @type {{lastUpdated:number}} */
5591
5591
  this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
5592
5592
  const s = [];
5593
5593
  this.meta.forEach((r, i) => {
5594
- i !== this.clientID && Ue <= e - r.lastUpdated && this.states.has(i) && s.push(i);
5595
- }), s.length > 0 && bn(this, s, "timeout");
5596
- }, Y(Ue / 10)), t.on("destroy", () => {
5594
+ i !== this.clientID && Te <= e - r.lastUpdated && this.states.has(i) && s.push(i);
5595
+ }), s.length > 0 && kn(this, s, "timeout");
5596
+ }, Y(Te / 10)), t.on("destroy", () => {
5597
5597
  this.destroy();
5598
5598
  }), this.setLocalState({});
5599
5599
  }
@@ -5636,7 +5636,7 @@ class hl extends fe {
5636
5636
  return this.states;
5637
5637
  }
5638
5638
  }
5639
- const bn = (n, t, e) => {
5639
+ const kn = (n, t, e) => {
5640
5640
  const s = [];
5641
5641
  for (let r = 0; r < t.length; r++) {
5642
5642
  const i = t[r];
@@ -5701,7 +5701,7 @@ Xt[st] = (n, t, e, s, r) => {
5701
5701
  e.doc,
5702
5702
  e
5703
5703
  );
5704
- s && i === yn && !e.synced && (e.synced = !0);
5704
+ s && i === bn && !e.synced && (e.synced = !0);
5705
5705
  };
5706
5706
  Xt[nr] = (n, t, e, s, r) => {
5707
5707
  p(n, kt), D(
@@ -5743,11 +5743,11 @@ function rr(n) {
5743
5743
  return;
5744
5744
  n.wsLastMessageReceived = ct();
5745
5745
  const s = sr(n, new Uint8Array(e.data), !0);
5746
- en(s) > 1 && t.send(_(s));
5746
+ nn(s) > 1 && t.send(_(s));
5747
5747
  }, t.onerror = (e) => {
5748
5748
  n.emit("connection-error", [e, n]);
5749
5749
  }, t.onclose = (e) => {
5750
- n.emit("connection-close", [e, n]), n.ws = null, n.wsconnecting = !1, n.wsconnected ? (n.wsconnected = !1, n.synced = !1, bn(
5750
+ n.emit("connection-close", [e, n]), n.ws = null, n.wsconnecting = !1, n.wsconnected ? (n.wsconnected = !1, n.synced = !1, kn(
5751
5751
  n.awareness,
5752
5752
  Array.from(n.awareness.getStates().keys()).filter(
5753
5753
  (s) => s !== n.doc.clientID
@@ -5759,7 +5759,7 @@ function rr(n) {
5759
5759
  }
5760
5760
  ])) : n.wsUnsuccessfulReconnects++, setTimeout(
5761
5761
  rr,
5762
- Ge(
5762
+ Pe(
5763
5763
  Sr(2, n.wsUnsuccessfulReconnects) * 100,
5764
5764
  n.maxBackoffTime
5765
5765
  ),
@@ -5772,7 +5772,7 @@ function rr(n) {
5772
5772
  }
5773
5773
  ]);
5774
5774
  const e = v();
5775
- if (p(e, st), Ye(e, n.doc), t.send(_(e)), n.awareness.getLocalState() !== null) {
5775
+ if (p(e, st), Xe(e, n.doc), t.send(_(e)), n.awareness.getLocalState() !== null) {
5776
5776
  const s = v();
5777
5777
  p(s, kt), D(
5778
5778
  s,
@@ -5788,7 +5788,7 @@ function rr(n) {
5788
5788
  ]);
5789
5789
  }
5790
5790
  }
5791
- function Te(n, t) {
5791
+ function Oe(n, t) {
5792
5792
  const e = n.ws;
5793
5793
  n.wsconnected && e && e.readyState === e.OPEN && e.send(t), n.bcconnected && mt(n.bcChannel, t, n);
5794
5794
  }
@@ -5838,26 +5838,26 @@ var ml = class extends fe {
5838
5838
  setInterval(() => {
5839
5839
  if (this.ws && this.ws.readyState === WebSocket.OPEN) {
5840
5840
  const u = v();
5841
- p(u, st), Ye(u, s), this.ws.send(_(u));
5841
+ p(u, st), Xe(u, s), this.ws.send(_(u));
5842
5842
  }
5843
5843
  }, c)), this._bcSubscriber = (u, f) => {
5844
5844
  if (f !== this) {
5845
5845
  const g = sr(this, new Uint8Array(u), !1);
5846
- en(g) > 1 && mt(this.bcChannel, _(g), this);
5846
+ nn(g) > 1 && mt(this.bcChannel, _(g), this);
5847
5847
  }
5848
5848
  }, this._updateHandler = (u, f) => {
5849
5849
  if (f !== this) {
5850
5850
  const g = v();
5851
- p(g, st), il(g, u), Te(this, _(g));
5851
+ p(g, st), il(g, u), Oe(this, _(g));
5852
5852
  }
5853
5853
  }, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: u, updated: f, removed: g }, w) => {
5854
5854
  const S = u.concat(f).concat(g), j = v();
5855
5855
  p(j, kt), D(
5856
5856
  j,
5857
5857
  Ut(i, S)
5858
- ), Te(this, _(j));
5858
+ ), Oe(this, _(j));
5859
5859
  }, this._unloadHandler = () => {
5860
- bn(
5860
+ kn(
5861
5861
  this.awareness,
5862
5862
  [s.clientID],
5863
5863
  "window unload"
@@ -5884,7 +5884,7 @@ var ml = class extends fe {
5884
5884
  return;
5885
5885
  this.bcconnected || (nl(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
5886
5886
  const t = v();
5887
- p(t, st), Ye(t, this.doc), mt(this.bcChannel, _(t), this);
5887
+ p(t, st), Xe(t, this.doc), mt(this.bcChannel, _(t), this);
5888
5888
  const e = v();
5889
5889
  p(e, st), tr(e, this.doc), mt(this.bcChannel, _(e), this);
5890
5890
  const s = v();
@@ -5914,7 +5914,7 @@ var ml = class extends fe {
5914
5914
  [this.doc.clientID],
5915
5915
  /* @__PURE__ */ new Map()
5916
5916
  )
5917
- ), Te(this, _(t)), this.bcconnected && (sl(this.bcChannel, this._bcSubscriber), this.bcconnected = !1);
5917
+ ), Oe(this, _(t)), this.bcconnected && (sl(this.bcChannel, this._bcSubscriber), this.bcconnected = !1);
5918
5918
  }
5919
5919
  disconnect() {
5920
5920
  this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && this.ws.close();
@@ -5988,7 +5988,7 @@ const wt = (n) => Dt((t, e) => {
5988
5988
  ), Mt = (n, t, e = "readwrite") => {
5989
5989
  const s = n.transaction(t, e);
5990
5990
  return t.map((r) => xl(s, r));
5991
- }, ir = (n, t) => wt(n.count(t)), El = (n, t) => wt(n.get(t)), or = (n, t) => wt(n.delete(t)), Cl = (n, t, e) => wt(n.put(t, e)), Xe = (n, t) => wt(n.add(t)), Al = (n, t, e) => wt(n.getAll(t, e)), Ll = (n, t, e) => {
5991
+ }, ir = (n, t) => wt(n.count(t)), El = (n, t) => wt(n.get(t)), or = (n, t) => wt(n.delete(t)), Cl = (n, t, e) => wt(n.put(t, e)), Je = (n, t) => wt(n.add(t)), Al = (n, t, e) => wt(n.getAll(t, e)), Ll = (n, t, e) => {
5992
5992
  let s = null;
5993
5993
  return vl(n, t, (r) => (s = r, !1), e).then(() => s);
5994
5994
  }, Il = (n, t = null) => Ll(n, t, "prev"), Ml = (n, t) => Dt((e, s) => {
@@ -5998,7 +5998,7 @@ const wt = (n) => Dt((t, e) => {
5998
5998
  return e();
5999
5999
  i.continue();
6000
6000
  };
6001
- }), vl = (n, t, e, s = "next") => Ml(n.openKeyCursor(t, s), (r) => e(r.key)), xl = (n, t) => n.objectStore(t), Ul = (n, t) => IDBKeyRange.upperBound(n, t), Tl = (n, t) => IDBKeyRange.lowerBound(n, t), Oe = "custom", lr = "updates", cr = 500, ar = (n, t = () => {
6001
+ }), vl = (n, t, e, s = "next") => Ml(n.openKeyCursor(t, s), (r) => e(r.key)), xl = (n, t) => n.objectStore(t), Ul = (n, t) => IDBKeyRange.upperBound(n, t), Tl = (n, t) => IDBKeyRange.lowerBound(n, t), Re = "custom", lr = "updates", cr = 500, ar = (n, t = () => {
6002
6002
  }, e = () => {
6003
6003
  }) => {
6004
6004
  const [s] = Mt(
@@ -6016,7 +6016,7 @@ const wt = (n) => Dt((t, e) => {
6016
6016
  n._dbsize = r;
6017
6017
  })).then(() => s);
6018
6018
  }, Ol = (n, t = !0) => ar(n).then((e) => {
6019
- (t || n._dbsize >= cr) && Xe(e, an(n.doc)).then(() => or(e, Ul(n._dbref, !0))).then(() => ir(e).then((s) => {
6019
+ (t || n._dbsize >= cr) && Je(e, hn(n.doc)).then(() => or(e, Ul(n._dbref, !0))).then(() => ir(e).then((s) => {
6020
6020
  n._dbsize = s;
6021
6021
  }));
6022
6022
  });
@@ -6033,7 +6033,7 @@ class Rl extends fe {
6033
6033
  ["custom"]
6034
6034
  ])
6035
6035
  ), this.whenSynced = Dt((s) => this.on("synced", () => s(this))), this._db.then((s) => {
6036
- this.db = s, ar(this, (o) => Xe(o, an(e)), () => {
6036
+ this.db = s, ar(this, (o) => Je(o, hn(e)), () => {
6037
6037
  if (this._destroyed)
6038
6038
  return this;
6039
6039
  this.synced = !0, this.emit("synced", [this]);
@@ -6045,7 +6045,7 @@ class Rl extends fe {
6045
6045
  this.db,
6046
6046
  [lr]
6047
6047
  );
6048
- Xe(i, s), ++this._dbsize >= cr && (this._storeTimeoutId !== null && clearTimeout(this._storeTimeoutId), this._storeTimeoutId = setTimeout(() => {
6048
+ Je(i, s), ++this._dbsize >= cr && (this._storeTimeoutId !== null && clearTimeout(this._storeTimeoutId), this._storeTimeoutId = setTimeout(() => {
6049
6049
  Ol(this, !1), this._storeTimeoutId = null;
6050
6050
  }, this._storeTimeout));
6051
6051
  }
@@ -6072,7 +6072,7 @@ class Rl extends fe {
6072
6072
  */
6073
6073
  get(t) {
6074
6074
  return this._db.then((e) => {
6075
- const [s] = Mt(e, [Oe], "readonly");
6075
+ const [s] = Mt(e, [Re], "readonly");
6076
6076
  return El(s, t);
6077
6077
  });
6078
6078
  }
@@ -6083,7 +6083,7 @@ class Rl extends fe {
6083
6083
  */
6084
6084
  set(t, e) {
6085
6085
  return this._db.then((s) => {
6086
- const [r] = Mt(s, [Oe]);
6086
+ const [r] = Mt(s, [Re]);
6087
6087
  return Cl(r, e, t);
6088
6088
  });
6089
6089
  }
@@ -6093,7 +6093,7 @@ class Rl extends fe {
6093
6093
  */
6094
6094
  del(t) {
6095
6095
  return this._db.then((e) => {
6096
- const [s] = Mt(e, [Oe]);
6096
+ const [s] = Mt(e, [Re]);
6097
6097
  return or(s, t);
6098
6098
  });
6099
6099
  }
@@ -6468,24 +6468,24 @@ class $l {
6468
6468
  this.setData(this.defaultData);
6469
6469
  }
6470
6470
  }
6471
- const jl = "playhtml.spencerc99.partykit.dev", Re = new gt();
6471
+ const jl = "playhtml.spencerc99.partykit.dev", Be = new gt();
6472
6472
  function Kl() {
6473
6473
  return window.location.pathname + window.location.search;
6474
6474
  }
6475
- let Q, F, O;
6475
+ let Q, F, x;
6476
6476
  const Zn = /* @__PURE__ */ new Map();
6477
6477
  let Jt = Hl;
6478
6478
  function ur() {
6479
6479
  return [_e.CanPlay, ...Object.keys(Jt)];
6480
6480
  }
6481
- let kn = !1, Je = !0;
6481
+ let Se = !1, We = !0;
6482
6482
  function zl({
6483
6483
  // TODO: if it is a localhost url, need to make some deterministic way to connect to the same room.
6484
6484
  room: n = Kl(),
6485
6485
  host: t = jl,
6486
6486
  extraCapabilities: e
6487
6487
  } = {}) {
6488
- if (!Je) {
6488
+ if (!We) {
6489
6489
  console.error("playhtml already set up!");
6490
6490
  return;
6491
6491
  }
@@ -6497,11 +6497,11 @@ function zl({
6497
6497
  ࿂࿂࿂࿂ https://playhtml.fun ࿂࿂࿂࿂
6498
6498
  ࿂࿂࿂࿂ ࿂ ࿂ ࿂ ࿂ ࿂࿂࿂࿂
6499
6499
  ࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂`
6500
- ), Q = new kl(r, s, Re), F = Re.getMap("playhtml-global"), O = /* @__PURE__ */ new Map(), new Rl(s, Re), We.globalData = F, We.elementHandlers = O, e)
6500
+ ), Q = new kl(r, s, Be), F = Be.getMap("playhtml-global"), x = /* @__PURE__ */ new Map(), new Rl(s, Be), Ge.globalData = F, Ge.elementHandlers = x, e)
6501
6501
  for (const [i, o] of Object.entries(e))
6502
6502
  Jt[i] = o;
6503
6503
  return Q.on("sync", (i) => {
6504
- i || console.error("Issue connecting to yjs..."), kn = !0, console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝"), fr();
6504
+ i || console.error("Issue connecting to yjs..."), Se = !0, console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝"), fr();
6505
6505
  }), Q;
6506
6506
  }
6507
6507
  function Yl(n, t) {
@@ -6564,7 +6564,7 @@ function dr() {
6564
6564
  Q.awareness.getStates().forEach((e, s) => {
6565
6565
  var r;
6566
6566
  for (const [i, o] of Object.entries(e)) {
6567
- const l = O.get(i);
6567
+ const l = x.get(i);
6568
6568
  if (l)
6569
6569
  for (const [c, a] of l) {
6570
6570
  if (!(c in o))
@@ -6579,7 +6579,7 @@ function dr() {
6579
6579
  }
6580
6580
  }
6581
6581
  for (const [i, o] of n) {
6582
- const l = O.get(i);
6582
+ const l = x.get(i);
6583
6583
  if (l)
6584
6584
  for (const [c, a] of l) {
6585
6585
  const h = (r = o.get(c)) == null ? void 0 : r.values();
@@ -6592,47 +6592,49 @@ function dr() {
6592
6592
  });
6593
6593
  }
6594
6594
  function fr() {
6595
- for (const n of ur()) {
6596
- const t = Array.from(
6597
- document.querySelectorAll(`[${n}]`)
6598
- ).filter(_n);
6599
- if (t.length)
6600
- for (let e = 0; e < t.length; e++) {
6601
- const s = t[e];
6602
- Se(s, n);
6603
- }
6595
+ if (Se) {
6596
+ for (const n of ur()) {
6597
+ const t = Array.from(
6598
+ document.querySelectorAll(`[${n}]`)
6599
+ ).filter(_n);
6600
+ if (t.length)
6601
+ for (let e = 0; e < t.length; e++) {
6602
+ const s = t[e];
6603
+ De(s, n);
6604
+ }
6605
+ }
6606
+ We && (F.observe((n) => {
6607
+ n.changes.keys.forEach((t, e) => {
6608
+ t.action === "add" && F.set(e, F.get(e));
6609
+ });
6610
+ }), Q.awareness.on("change", () => dr()), We = !1);
6604
6611
  }
6605
- Je && (F.observe((n) => {
6606
- n.changes.keys.forEach((t, e) => {
6607
- t.action === "add" && F.set(e, F.get(e));
6608
- });
6609
- }), Q.awareness.on("change", () => dr()), Je = !1);
6610
6612
  }
6611
- const We = {
6613
+ const Ge = {
6612
6614
  init: zl,
6613
6615
  setupPlayElements: fr,
6614
6616
  setupPlayElement: ql,
6615
6617
  removePlayElement: Zl,
6616
- setupPlayElementForTag: Se,
6618
+ setupPlayElementForTag: De,
6617
6619
  globalData: void 0,
6618
6620
  elementHandlers: void 0
6619
6621
  };
6620
- window.playhtml = We;
6622
+ window.playhtml = Ge;
6621
6623
  function Gl(n) {
6622
- if (O.has(n) || !kn)
6624
+ if (x.has(n) || !Se)
6623
6625
  return;
6624
- O.has(n) || O.set(n, /* @__PURE__ */ new Map()), n !== _e.CanPlay && Jt[n], F.get(n) || F.set(n, new ht());
6626
+ x.has(n) || x.set(n, /* @__PURE__ */ new Map()), n !== _e.CanPlay && Jt[n], F.get(n) || F.set(n, new ht());
6625
6627
  const t = F.get(n);
6626
6628
  t.observe((e) => {
6627
6629
  e.changes.keys.forEach((s, r) => {
6628
- const i = O.get(n);
6630
+ const i = x.get(n);
6629
6631
  if (s.action === "add") {
6630
6632
  const o = document.getElementById(r);
6631
6633
  if (!_n(o)) {
6632
6634
  console.log(`Element ${r} not an HTML element. Ignoring.`);
6633
6635
  return;
6634
6636
  }
6635
- Se(o, n);
6637
+ De(o, n);
6636
6638
  } else if (s.action === "update") {
6637
6639
  const o = i.get(r);
6638
6640
  o.__data = t.get(r);
@@ -6645,9 +6647,9 @@ function Pl(n, t) {
6645
6647
  var e, s;
6646
6648
  return ((s = (e = Jt[t]) == null ? void 0 : e.isValidElementForTag) == null ? void 0 : s.call(e, n)) ?? !0;
6647
6649
  }
6648
- function Se(n, t) {
6650
+ function De(n, t) {
6649
6651
  var l;
6650
- if (!Pl(n, t) || !kn)
6652
+ if (!Pl(n, t) || !Se)
6651
6653
  return;
6652
6654
  if (!n.id) {
6653
6655
  const c = n.getAttribute("selector-id");
@@ -6665,7 +6667,7 @@ function Se(n, t) {
6665
6667
  return;
6666
6668
  }
6667
6669
  Gl(t);
6668
- const s = O.get(t), r = Wl(
6670
+ const s = x.get(t), r = Wl(
6669
6671
  t,
6670
6672
  n
6671
6673
  );
@@ -6688,21 +6690,28 @@ function Se(n, t) {
6688
6690
  s.set(e, new $l(o));
6689
6691
  i.get(e) === void 0 && r.defaultData !== void 0 && i.set(e, r.defaultData), (l = o.triggerAwarenessUpdate) == null || l.call(o), n.classList.add("__playhtml-element"), n.classList.add(`__playhtml-${t}`), n.style.setProperty("--jiggle-delay", `${Math.random() * 1}s;}`);
6690
6692
  }
6691
- function ql(n) {
6692
- if (!_n(n)) {
6693
- console.log(`Element ${n.id} not an HTML element. Ignoring.`);
6694
- return;
6693
+ function ql(n, { ignoreIfAlreadySetup: t } = {}) {
6694
+ if (!(t && Object.keys(x || {}).some(
6695
+ (e) => {
6696
+ var s;
6697
+ return (s = x.get(e)) == null ? void 0 : s.has(n.id);
6698
+ }
6699
+ ))) {
6700
+ if (!_n(n)) {
6701
+ console.log(`Element ${n.id} not an HTML element. Ignoring.`);
6702
+ return;
6703
+ }
6704
+ for (const e of ur())
6705
+ n.hasAttribute(e) && De(n, e);
6695
6706
  }
6696
- for (const t of ur())
6697
- n.hasAttribute(t) && Se(n, t);
6698
6707
  }
6699
6708
  function Zl(n) {
6700
6709
  if (!(!n || !n.id))
6701
- for (const t of Object.keys(O)) {
6702
- const e = O.get(t);
6710
+ for (const t of Object.keys(x)) {
6711
+ const e = x.get(t);
6703
6712
  e.has(n.id) && e.delete(n.id);
6704
6713
  }
6705
6714
  }
6706
6715
  export {
6707
- We as playhtml
6716
+ Ge as playhtml
6708
6717
  };