playhtml 2.0.12 → 2.0.13

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.
@@ -50,7 +50,7 @@ const O = () => /* @__PURE__ */ new Map(), Be = (n) => {
50
50
  return n.forEach((e, s) => {
51
51
  t.set(s, e);
52
52
  }), t;
53
- }, W = (n, t, e) => {
53
+ }, J = (n, t, e) => {
54
54
  let s = n.get(t);
55
55
  return s === void 0 && n.set(t, s = e()), s;
56
56
  }, yr = (n, t) => {
@@ -76,7 +76,7 @@ class fe {
76
76
  * @param {function} f
77
77
  */
78
78
  on(t, e) {
79
- W(this._observers, t, lt).add(e);
79
+ J(this._observers, t, lt).add(e);
80
80
  }
81
81
  /**
82
82
  * @param {N} name
@@ -112,7 +112,7 @@ class fe {
112
112
  this._observers = O();
113
113
  }
114
114
  }
115
- const X = Math.floor, te = Math.abs, Pe = (n, t) => n < t ? n : t, ft = (n, t) => n > t ? n : t, Sr = Math.pow, es = (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, In = (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, es = (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, In = (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} */
@@ -121,10 +121,10 @@ const X = Math.floor, te = Math.abs, Pe = (n, t) => n < t ? n : t, ft = (n, t) =
121
121
  }, Tt = (
122
122
  /** @type {TextEncoder} */
123
123
  typeof TextEncoder < "u" ? new TextEncoder() : null
124
- ), vr = (n) => Tt.encode(n), Mr = Tt ? vr : Ir;
125
- let Mt = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
126
- Mt && Mt.decode(new Uint8Array()).length === 1 && (Mt = null);
127
- const vn = (n) => n === void 0 ? null : n;
124
+ ), Mr = (n) => Tt.encode(n), vr = Tt ? Mr : Ir;
125
+ let vt = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
126
+ vt && vt.decode(new Uint8Array()).length === 1 && (vt = null);
127
+ const Mn = (n) => n === void 0 ? null : n;
128
128
  class xr {
129
129
  constructor() {
130
130
  this.map = /* @__PURE__ */ new Map();
@@ -253,13 +253,13 @@ const zr = () => {
253
253
  }
254
254
  })) : R = O();
255
255
  return R;
256
- }, Ne = (n) => zr().has(n), Fe = (n) => vn(_t ? process.env[n.toUpperCase()] : ss.getItem(n)), Yr = (n) => Ne("--" + n) || Fe(n) !== null;
256
+ }, Ne = (n) => zr().has(n), Fe = (n) => Mn(_t ? process.env[n.toUpperCase()] : ss.getItem(n)), Yr = (n) => Ne("--" + n) || Fe(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")), xn = 1, Un = 2, Ee = 4, Ce = 8, Ot = 32, z = 64, x = 128, ge = 31, Ve = 63, it = 127, Jr = 2147483647, os = Number.MAX_SAFE_INTEGER, Wr = Number.isInteger || ((n) => typeof n == "number" && isFinite(n) && X(n) === n), J = (n) => new Error(n), B = () => {
259
- throw J("Method unimplemented");
258
+ const vn = _t && Kr(process.env.FORCE_COLOR, ["true", "1", "2"]), Xr = !Ne("no-colors") && (!_t || process.stdout.isTTY || vn) && (!_t || Ne("color") || vn || Fe("COLORTERM") !== null || (Fe("TERM") || "").includes("color")), xn = 1, Un = 2, Ee = 4, Ce = 8, Ot = 32, z = 64, x = 128, ge = 31, Ve = 63, it = 127, Jr = 2147483647, os = Number.MAX_SAFE_INTEGER, Wr = Number.isInteger || ((n) => typeof n == "number" && isFinite(n) && Y(n) === n), X = (n) => new Error(n), B = () => {
259
+ throw X("Method unimplemented");
260
260
  }, V = () => {
261
- throw J("Unexpected case");
262
- }, ls = J("Unexpected end of array"), cs = J("Integer out of Range");
261
+ throw X("Unexpected case");
262
+ }, ls = X("Unexpected end of array"), cs = X("Integer out of Range");
263
263
  class pe {
264
264
  /**
265
265
  * @param {Uint8Array} uint8Array Binary data to decode
@@ -271,7 +271,7 @@ class pe {
271
271
  const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) => {
272
272
  const e = en(n.arr.buffer, n.pos + n.arr.byteOffset, t);
273
273
  return n.pos += t, e;
274
- }, v = (n) => Pr(n, m(n)), St = (n) => n.arr[n.pos++], m = (n) => {
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; ) {
@@ -317,8 +317,8 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) =>
317
317
  }
318
318
  }, Zr = (n) => (
319
319
  /** @type any */
320
- Mt.decode(v(n))
321
- ), Q = Mt ? Zr : qr, tn = (n, t) => {
320
+ vt.decode(M(n))
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
324
  }, Qr = (n) => tn(n, 4).getFloat32(0, !1), ti = (n) => tn(n, 8).getFloat64(0, !1), ei = (n) => (
@@ -342,12 +342,12 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) =>
342
342
  // CASE 121: boolean (false)
343
343
  (n) => !0,
344
344
  // CASE 120: boolean (true)
345
- Q,
345
+ Z,
346
346
  // CASE 119: string
347
347
  (n) => {
348
348
  const t = m(n), e = {};
349
349
  for (let s = 0; s < t; s++) {
350
- const r = Q(n);
350
+ const r = Z(n);
351
351
  e[r] = Rt(n);
352
352
  }
353
353
  return e;
@@ -358,7 +358,7 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) =>
358
358
  e.push(Rt(n));
359
359
  return e;
360
360
  },
361
- v
361
+ M
362
362
  // CASE 116: Uint8Array
363
363
  ], Rt = (n) => ni[127 - St(n)](n);
364
364
  class Tn extends pe {
@@ -404,7 +404,7 @@ class Ae extends pe {
404
404
  read() {
405
405
  if (this.count === 0) {
406
406
  const t = Qe(this), e = t & 1;
407
- this.diff = X(t / 2), this.count = 1, e && (this.count = m(this) + 2);
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;
410
410
  }
@@ -414,7 +414,7 @@ class si {
414
414
  * @param {Uint8Array} uint8Array
415
415
  */
416
416
  constructor(t) {
417
- this.decoder = new ee(t), this.str = Q(this.decoder), this.spos = 0;
417
+ this.decoder = new ee(t), this.str = Z(this.decoder), this.spos = 0;
418
418
  }
419
419
  /**
420
420
  * @return {string}
@@ -446,7 +446,7 @@ class $t {
446
446
  this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
447
447
  }
448
448
  }
449
- const M = () => new $t(), nn = (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;
@@ -467,12 +467,12 @@ const M = () => new $t(), nn = (n) => {
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
468
  }, He = A, p = (n, t) => {
469
469
  for (; t > it; )
470
- A(n, x | it & t), t = X(t / 128);
470
+ A(n, x | it & t), t = Y(t / 128);
471
471
  A(n, it & t);
472
472
  }, sn = (n, t) => {
473
473
  const e = es(t);
474
- for (e && (t = -t), A(n, (t > Ve ? x : 0) | (e ? z : 0) | Ve & t), t = X(t / 64); t > 0; )
475
- A(n, (t > it ? x : 0) | it & t), t = X(t / 128);
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
476
  }, $e = new Uint8Array(3e4), fi = $e.length / 3, gi = (n, t) => {
477
477
  if (t.length < fi) {
478
478
  const e = Tt.encodeInto(t, $e).written || 0;
@@ -480,7 +480,7 @@ const M = () => new $t(), nn = (n) => {
480
480
  for (let s = 0; s < e; s++)
481
481
  A(n, $e[s]);
482
482
  } else
483
- D(n, Mr(t));
483
+ D(n, vr(t));
484
484
  }, pi = (n, t) => {
485
485
  const e = unescape(encodeURIComponent(t)), s = e.length;
486
486
  p(n, s);
@@ -626,7 +626,7 @@ class Ei {
626
626
  }
627
627
  const K = (n, t) => new Ei(n, t);
628
628
  typeof DOMParser < "u" && new DOMParser();
629
- const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), G = Symbol, us = G(), ds = G(), Ai = G(), Li = G(), Ii = G(), fs = G(), vi = G(), gs = G(), Mi = G(), xi = (n) => {
629
+ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol, us = W(), ds = W(), Ai = W(), Li = W(), Ii = W(), fs = W(), Mi = W(), gs = W(), vi = W(), xi = (n) => {
630
630
  const t = [];
631
631
  let e = 0;
632
632
  for (; e < n.length; e++) {
@@ -641,10 +641,10 @@ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), G = Symbol, us = G(),
641
641
  [Ii]: K("color", "green"),
642
642
  [Li]: K("color", "grey"),
643
643
  [fs]: K("color", "red"),
644
- [vi]: K("color", "purple"),
644
+ [Mi]: K("color", "purple"),
645
645
  [gs]: K("color", "orange"),
646
646
  // not well supported in chrome when debugging node with inspector - TODO: deprecate
647
- [Mi]: K("color", "black")
647
+ [vi]: K("color", "black")
648
648
  }, Ti = (n) => {
649
649
  const t = [], e = [], s = O();
650
650
  let r = [], i = 0;
@@ -705,12 +705,12 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
705
705
  );
706
706
  for (let o = 0; o < s.length; o++) {
707
707
  const l = s[o];
708
- Ms(n, i, l.clock, l.len, e);
708
+ vs(n, i, l.clock, l.len, e);
709
709
  }
710
710
  }), Fi = (n, t) => {
711
711
  let e = 0, s = n.length - 1;
712
712
  for (; e <= s; ) {
713
- const r = X((e + s) / 2), i = n[r], o = i.clock;
713
+ const r = Y((e + s) / 2), i = n[r], o = i.clock;
714
714
  if (o <= t) {
715
715
  if (t < o + i.len)
716
716
  return r;
@@ -745,7 +745,7 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
745
745
  });
746
746
  return ln(t), t;
747
747
  }, ie = (n, t, e, s) => {
748
- W(n.clients, t, () => (
748
+ J(n.clients, t, () => (
749
749
  /** @type {Array<DeleteItem>} */
750
750
  []
751
751
  )).push(new on(e, s));
@@ -782,7 +782,7 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
782
782
  n.resetDsCurVal();
783
783
  const r = m(n.restDecoder), i = m(n.restDecoder);
784
784
  if (i > 0) {
785
- const o = W(t.clients, r, () => (
785
+ const o = J(t.clients, r, () => (
786
786
  /** @type {Array<DeleteItem>} */
787
787
  []
788
788
  ));
@@ -901,7 +901,7 @@ class gt extends fe {
901
901
  * @public
902
902
  */
903
903
  get(t, e = I) {
904
- const s = W(this.share, t, () => {
904
+ const s = J(this.share, t, () => {
905
905
  const i = new e();
906
906
  return i._integrate(this, null), i;
907
907
  }), r = s.constructor;
@@ -1066,7 +1066,7 @@ class ks extends bs {
1066
1066
  * @return {string}
1067
1067
  */
1068
1068
  readString() {
1069
- return Q(this.restDecoder);
1069
+ return Z(this.restDecoder);
1070
1070
  }
1071
1071
  /**
1072
1072
  * @return {boolean} isKey
@@ -1098,7 +1098,7 @@ class ks extends bs {
1098
1098
  * @return {Uint8Array}
1099
1099
  */
1100
1100
  readBuf() {
1101
- return ui(v(this.restDecoder));
1101
+ return ui(M(this.restDecoder));
1102
1102
  }
1103
1103
  /**
1104
1104
  * Legacy implementation uses JSON parse. We use any-decoding in v2.
@@ -1106,13 +1106,13 @@ class ks extends bs {
1106
1106
  * @return {any}
1107
1107
  */
1108
1108
  readJSON() {
1109
- return JSON.parse(Q(this.restDecoder));
1109
+ return JSON.parse(Z(this.restDecoder));
1110
1110
  }
1111
1111
  /**
1112
1112
  * @return {string}
1113
1113
  */
1114
1114
  readKey() {
1115
- return Q(this.restDecoder);
1115
+ return Z(this.restDecoder);
1116
1116
  }
1117
1117
  }
1118
1118
  class ji {
@@ -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(v(t)), this.clientDecoder = new ee(v(t)), this.leftClockDecoder = new Ae(v(t)), this.rightClockDecoder = new Ae(v(t)), this.infoDecoder = new Tn(v(t), St), this.stringDecoder = new si(v(t)), this.parentInfoDecoder = new Tn(v(t), St), this.typeRefDecoder = new ee(v(t)), this.lenDecoder = new ee(v(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 Tn(M(t), St), this.stringDecoder = new si(M(t)), this.parentInfoDecoder = new Tn(M(t), St), this.typeRefDecoder = new ee(M(t)), this.lenDecoder = new ee(M(t));
1148
1148
  }
1149
1149
  /**
1150
1150
  * @return {ID}
@@ -1210,7 +1210,7 @@ class Et extends ji {
1210
1210
  * @return {Uint8Array}
1211
1211
  */
1212
1212
  readBuf() {
1213
- return v(this.restDecoder);
1213
+ return M(this.restDecoder);
1214
1214
  }
1215
1215
  /**
1216
1216
  * This is mainly here for legacy purposes.
@@ -1237,7 +1237,7 @@ class Et extends ji {
1237
1237
  }
1238
1238
  class _s {
1239
1239
  constructor() {
1240
- this.restEncoder = M();
1240
+ this.restEncoder = v();
1241
1241
  }
1242
1242
  toUint8Array() {
1243
1243
  return _(this.restEncoder);
@@ -1336,7 +1336,7 @@ class Kt extends _s {
1336
1336
  }
1337
1337
  class Ss {
1338
1338
  constructor() {
1339
- this.restEncoder = M(), this.dsCurrVal = 0;
1339
+ this.restEncoder = v(), this.dsCurrVal = 0;
1340
1340
  }
1341
1341
  toUint8Array() {
1342
1342
  return _(this.restEncoder);
@@ -1363,7 +1363,7 @@ class at extends Ss {
1363
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 Rn(He), this.stringEncoder = new ki(), this.parentInfoEncoder = new Rn(He), this.typeRefEncoder = new ne(), this.lenEncoder = new ne();
1364
1364
  }
1365
1365
  toUint8Array() {
1366
- const t = M();
1366
+ const t = v();
1367
1367
  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, _(this.infoEncoder)), D(t, this.stringEncoder.toUint8Array()), D(t, _(this.parentInfoEncoder)), D(t, this.typeRefEncoder.toUint8Array()), D(t, this.lenEncoder.toUint8Array()), we(t, _(this.restEncoder)), _(t);
1368
1368
  }
1369
1369
  /**
@@ -1560,7 +1560,7 @@ const Ki = (n, t, e, s) => {
1560
1560
  };
1561
1561
  for (; ; ) {
1562
1562
  if (h.constructor !== T) {
1563
- const g = W(d, h.id.client, () => L(t, h.id.client)) - h.id.clock;
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();
1566
1566
  else {
@@ -1687,7 +1687,7 @@ const Pt = (n, t) => n === t || n !== null && t !== null && n.client === t.clien
1687
1687
  return t;
1688
1688
  throw V();
1689
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 && !ms(t.ds, n.id), je = (n, t) => {
1690
- const e = W(n.meta, je, lt), s = n.doc.store;
1690
+ const e = J(n.meta, je, 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
  }), ws(n, t.ds, (r) => {
@@ -1710,7 +1710,7 @@ const me = (n) => {
1710
1710
  return 0;
1711
1711
  const s = e[e.length - 1];
1712
1712
  return s.id.clock + s.length;
1713
- }, vs = (n, t) => {
1713
+ }, Ms = (n, t) => {
1714
1714
  let e = n.clients.get(t.id.client);
1715
1715
  if (e === void 0)
1716
1716
  e = [], n.clients.set(t.id.client, e);
@@ -1724,7 +1724,7 @@ const me = (n) => {
1724
1724
  let e = 0, s = n.length - 1, r = n[s], i = r.id.clock;
1725
1725
  if (i === t)
1726
1726
  return s;
1727
- let o = X(t / (i + r.length - 1) * s);
1727
+ let o = Y(t / (i + r.length - 1) * s);
1728
1728
  for (; e <= s; ) {
1729
1729
  if (r = n[o], i = r.id.clock, i <= t) {
1730
1730
  if (t < i + r.length)
@@ -1732,13 +1732,13 @@ const me = (n) => {
1732
1732
  e = o + 1;
1733
1733
  } else
1734
1734
  s = o - 1;
1735
- o = X((e + s) / 2);
1735
+ o = Y((e + s) / 2);
1736
1736
  }
1737
1737
  throw V();
1738
1738
  }, no = (n, t) => {
1739
1739
  const e = n.clients.get(t.client);
1740
1740
  return e[H(e, t.clock)];
1741
- }, ve = (
1741
+ }, Me = (
1742
1742
  /** @type {function(StructStore,ID):Item} */
1743
1743
  no
1744
1744
  ), Ke = (n, t, e) => {
@@ -1759,7 +1759,7 @@ const me = (n) => {
1759
1759
  n.clients.get(t.id.client)
1760
1760
  );
1761
1761
  s[H(s, t.id.clock)] = e;
1762
- }, Ms = (n, t, e, s, r) => {
1762
+ }, vs = (n, t, e, s, r) => {
1763
1763
  if (s === 0)
1764
1764
  return;
1765
1765
  const i = e + s;
@@ -1780,7 +1780,7 @@ class ro {
1780
1780
  }
1781
1781
  const Kn = (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), zn = (n, t, e) => {
1782
1782
  const s = t._item;
1783
- (s === null || s.id.clock < (n.beforeState.get(s.id.client) || 0) && !s.deleted) && W(n.changed, t, lt).add(e);
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) => {
1785
1785
  let e = n[t], s = n[t - 1], r = t;
1786
1786
  for (; r > 0; e = s, s = n[--r - 1]) {
@@ -2009,12 +2009,12 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
2009
2009
  f && u.id.clock > i.struct.id.clock + i.struct.length)
2010
2010
  continue;
2011
2011
  if (d !== i.struct.id.client)
2012
- q(l, i.struct, i.offset), i = { struct: u, offset: 0 }, h.next();
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
2014
  if (i.struct.constructor === T)
2015
2015
  i.struct.length = u.id.clock + u.length - i.struct.id.clock;
2016
2016
  else {
2017
- q(l, i.struct, i.offset);
2017
+ P(l, i.struct, i.offset);
2018
2018
  const g = u.id.clock - i.struct.id.clock - i.struct.length;
2019
2019
  i = { struct: new T(b(d, i.struct.id.clock + i.struct.length), g), offset: 0 };
2020
2020
  }
@@ -2023,7 +2023,7 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
2023
2023
  g > 0 && (i.struct.constructor === T ? i.struct.length -= g : u = ao(u, g)), i.struct.mergeWith(
2024
2024
  /** @type {any} */
2025
2025
  u
2026
- ) || (q(l, i.struct, i.offset), i = { struct: u, offset: 0 }, h.next());
2026
+ ) || (P(l, i.struct, i.offset), i = { struct: u, offset: 0 }, h.next());
2027
2027
  }
2028
2028
  } else
2029
2029
  i = { struct: (
@@ -2031,9 +2031,9 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
2031
2031
  h.curr
2032
2032
  ), offset: 0 }, h.next();
2033
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())
2034
- q(l, i.struct, i.offset), i = { struct: u, offset: 0 };
2034
+ P(l, i.struct, i.offset), i = { struct: u, offset: 0 };
2035
2035
  }
2036
- i !== null && (q(l, i.struct, i.offset), i = null), fn(l);
2036
+ i !== null && (P(l, i.struct, i.offset), i = null), fn(l);
2037
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) => {
@@ -2045,8 +2045,8 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
2045
2045
  continue;
2046
2046
  }
2047
2047
  if (h.id.clock + h.length > u)
2048
- for (q(o, h, ft(u - h.id.clock, 0)), c.next(); c.curr && c.curr.id.client === d; )
2049
- q(o, c.curr, 0), c.next();
2048
+ for (P(o, h, ft(u - h.id.clock, 0)), c.next(); c.curr && c.curr.id.client === d; )
2049
+ P(o, c.curr, 0), c.next();
2050
2050
  else
2051
2051
  for (; c.curr && c.curr.id.client === d && c.curr.id.clock + c.curr.length <= u; )
2052
2052
  c.next();
@@ -2055,8 +2055,8 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
2055
2055
  const a = cn(l);
2056
2056
  return At(i, a), i.toUint8Array();
2057
2057
  }, Us = (n) => {
2058
- n.written > 0 && (n.clientStructs.push({ written: n.written, restEncoder: _(n.encoder.restEncoder) }), n.encoder.restEncoder = M(), n.written = 0);
2059
- }, q = (n, t, e) => {
2058
+ n.written > 0 && (n.clientStructs.push({ written: n.written, restEncoder: _(n.encoder.restEncoder) }), n.encoder.restEncoder = v(), n.written = 0);
2059
+ }, P = (n, t, e) => {
2060
2060
  n.written > 0 && n.currClient !== t.id.client && Us(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
2061
  }, fn = (n) => {
2062
2062
  Us(n);
@@ -2069,7 +2069,7 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
2069
2069
  }, uo = (n, t, e, s) => {
2070
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
- q(l, t(a), 0);
2072
+ P(l, t(a), 0);
2073
2073
  fn(l);
2074
2074
  const c = cn(r);
2075
2075
  return At(o, c), o.toUint8Array();
@@ -2115,7 +2115,7 @@ class ye {
2115
2115
  get keys() {
2116
2116
  if (this._keys === null) {
2117
2117
  if (this.transaction.doc._transactionCleanups.length === 0)
2118
- throw J(Yn);
2118
+ throw X(Yn);
2119
2119
  const t = /* @__PURE__ */ new Map(), e = this.target;
2120
2120
  /** @type Set<string|null> */
2121
2121
  this.transaction.changed.get(e).forEach((r) => {
@@ -2183,7 +2183,7 @@ class ye {
2183
2183
  let t = this._changes;
2184
2184
  if (t === null) {
2185
2185
  if (this.transaction.doc._transactionCleanups.length === 0)
2186
- throw J(Yn);
2186
+ throw X(Yn);
2187
2187
  const e = this.target, s = lt(), r = lt(), i = [];
2188
2188
  if (t = {
2189
2189
  added: s,
@@ -2285,7 +2285,7 @@ const wo = (n) => {
2285
2285
  }
2286
2286
  }, ke = (n, t, e) => {
2287
2287
  const s = n, r = t.changedParentTypes;
2288
- for (; W(r, n, () => []).push(e), n._item !== null; )
2288
+ for (; J(r, n, () => []).push(e), n._item !== null; )
2289
2289
  n = /** @type {AbstractType<any>} */
2290
2290
  n._item.parent;
2291
2291
  Ls(s._eH, e, t);
@@ -2506,13 +2506,13 @@ const Rs = (n, t, e) => {
2506
2506
  break;
2507
2507
  default:
2508
2508
  if (d instanceof I)
2509
- r = new E(b(o, L(l, o)), r, r && r.lastId, c, c && c.id, t, null, new P(d)), r.integrate(n, 0);
2509
+ r = new E(b(o, L(l, o)), r, r && r.lastId, c, c && c.id, t, null, new G(d)), r.integrate(n, 0);
2510
2510
  else
2511
2511
  throw new Error("Unexpected content type in insert operation");
2512
2512
  }
2513
2513
  }
2514
2514
  }), h();
2515
- }, Vs = () => J("Length exceeded!"), Hs = (n, t, e, s) => {
2515
+ }, Vs = () => X("Length exceeded!"), Hs = (n, t, e, s) => {
2516
2516
  if (e > t._length)
2517
2517
  throw Vs();
2518
2518
  if (e === 0)
@@ -2582,7 +2582,7 @@ const Rs = (n, t, e) => {
2582
2582
  break;
2583
2583
  default:
2584
2584
  if (s instanceof I)
2585
- l = new P(s);
2585
+ l = new G(s);
2586
2586
  else
2587
2587
  throw new Error("Unexpected content type");
2588
2588
  }
@@ -3012,7 +3012,7 @@ class ht extends I {
3012
3012
  t.writeTypeRef(Yo);
3013
3013
  }
3014
3014
  }
3015
- const Do = (n) => new ht(), Z = (n, t) => n === t || typeof n == "object" && typeof t == "object" && n && t && Hr(n, t);
3015
+ const Do = (n) => new ht(), q = (n, t) => n === t || typeof n == "object" && typeof t == "object" && n && t && Hr(n, t);
3016
3016
  class ze {
3017
3017
  /**
3018
3018
  * @param {Item|null} left
@@ -3069,7 +3069,7 @@ const Xn = (n, t, e) => {
3069
3069
  return Xn(n, i, e);
3070
3070
  }
3071
3071
  }, zs = (n, t, e, s) => {
3072
- for (; e.right !== null && (e.right.deleted === !0 || e.right.content.constructor === C && Z(
3072
+ for (; e.right !== null && (e.right.deleted === !0 || e.right.content.constructor === C && q(
3073
3073
  s.get(
3074
3074
  /** @type {ContentFormat} */
3075
3075
  e.right.content.key
@@ -3091,7 +3091,7 @@ const Xn = (n, t, e) => {
3091
3091
  s === null ? n.delete(e) : n.set(e, s);
3092
3092
  }, Ys = (n, t) => {
3093
3093
  for (; n.right !== null; ) {
3094
- if (!(n.right.deleted || n.right.content.constructor === C && Z(
3094
+ if (!(n.right.deleted || n.right.content.constructor === C && q(
3095
3095
  t[
3096
3096
  /** @type {ContentFormat} */
3097
3097
  n.right.content.key
@@ -3106,14 +3106,14 @@ const Xn = (n, t, e) => {
3106
3106
  const r = n.doc, i = r.clientID, o = /* @__PURE__ */ new Map();
3107
3107
  for (const l in s) {
3108
3108
  const c = s[l], a = e.currentAttributes.get(l) || null;
3109
- if (!Z(a, c)) {
3109
+ if (!q(a, c)) {
3110
3110
  o.set(l, a);
3111
3111
  const { left: h, right: d } = e;
3112
3112
  e.right = new E(b(i, L(r.store, i)), h, h && h.lastId, d, d && d.id, t, null, new C(l, c)), e.right.integrate(n, 0), e.forward();
3113
3113
  }
3114
3114
  }
3115
3115
  return o;
3116
- }, Me = (n, t, e, s, r) => {
3116
+ }, ve = (n, t, e, s, r) => {
3117
3117
  e.currentAttributes.forEach((u, f) => {
3118
3118
  r[f] === void 0 && (r[f] = null);
3119
3119
  });
@@ -3122,7 +3122,7 @@ const Xn = (n, t, e) => {
3122
3122
  const l = Xs(n, t, e, r), c = s.constructor === String ? new $(
3123
3123
  /** @type {string} */
3124
3124
  s
3125
- ) : s instanceof I ? new P(s) : new pt(s);
3125
+ ) : s instanceof I ? new G(s) : new pt(s);
3126
3126
  let { left: a, right: h, index: d } = e;
3127
3127
  t._searchMarker && Nt(t._searchMarker, e.index, c.getLength()), h = new E(b(o, L(i.store, o)), a, a && a.lastId, h, h && h.id, t, null, c), h.integrate(n, 0), e.right = h, e.index = d, e.forward(), zs(n, t, e, l);
3128
3128
  }, Jn = (n, t, e, s, r) => {
@@ -3139,7 +3139,7 @@ const Xn = (n, t, e) => {
3139
3139
  e.right.content
3140
3140
  ), h = r[c];
3141
3141
  if (h !== void 0) {
3142
- if (Z(h, a))
3142
+ if (q(h, a))
3143
3143
  l.delete(c);
3144
3144
  else {
3145
3145
  if (s === 0)
@@ -3248,7 +3248,7 @@ const Xn = (n, t, e) => {
3248
3248
  const t = /* @__PURE__ */ new Set(), e = n.doc;
3249
3249
  for (const [s, r] of n.afterState.entries()) {
3250
3250
  const i = n.beforeState.get(s) || 0;
3251
- r !== i && Ms(
3251
+ r !== i && vs(
3252
3252
  n,
3253
3253
  /** @type {Array<Item|GC>} */
3254
3254
  e.store.clients.get(s),
@@ -3285,7 +3285,7 @@ const Xn = (n, t, e) => {
3285
3285
  for (; e > 0 && t.right !== null; ) {
3286
3286
  if (t.right.deleted === !1)
3287
3287
  switch (t.right.content.constructor) {
3288
- case P:
3288
+ case G:
3289
3289
  case pt:
3290
3290
  case $:
3291
3291
  e < t.right.length && et(n, b(t.right.id.client, t.right.id.clock + e)), e -= t.right.length, t.right.delete(n);
@@ -3370,7 +3370,7 @@ class Lo extends ye {
3370
3370
  };
3371
3371
  for (; o !== null; ) {
3372
3372
  switch (o.content.constructor) {
3373
- case P:
3373
+ case G:
3374
3374
  case pt:
3375
3375
  this.adds(o) ? this.deletes(o) || (u(), l = "insert", a = o.content.getContent()[0], u()) : this.deletes(o) ? (l !== "delete" && (u(), l = "delete"), d += 1) : o.deleted || (l !== "retain" && (u(), l = "retain"), h += 1);
3376
3376
  break;
@@ -3386,16 +3386,16 @@ class Lo extends ye {
3386
3386
  if (this.adds(o)) {
3387
3387
  if (!this.deletes(o)) {
3388
3388
  const w = r.get(f) || null;
3389
- Z(w, g) ? g !== null && o.delete(s) : (l === "retain" && u(), Z(g, i.get(f) || null) ? delete c[f] : c[f] = g);
3389
+ q(w, g) ? g !== null && o.delete(s) : (l === "retain" && u(), q(g, i.get(f) || null) ? delete c[f] : c[f] = g);
3390
3390
  }
3391
3391
  } else if (this.deletes(o)) {
3392
3392
  i.set(f, g);
3393
3393
  const w = r.get(f) || null;
3394
- Z(w, g) || (l === "retain" && u(), c[f] = w);
3394
+ q(w, g) || (l === "retain" && u(), c[f] = w);
3395
3395
  } else if (!o.deleted) {
3396
3396
  i.set(f, g);
3397
3397
  const w = c[f];
3398
- w !== void 0 && (Z(w, g) ? w !== null && o.delete(s) : (l === "retain" && u(), g === null ? delete c[f] : c[f] = g));
3398
+ w !== void 0 && (q(w, g) ? w !== null && o.delete(s) : (l === "retain" && u(), g === null ? delete c[f] : c[f] = g));
3399
3399
  }
3400
3400
  o.deleted || (l === "insert" && u(), Lt(
3401
3401
  r,
@@ -3510,7 +3510,7 @@ class Ct extends 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) && Me(s, this, r, l, o.attributes || {});
3513
+ (typeof l != "string" || l.length > 0) && ve(s, this, r, l, o.attributes || {});
3514
3514
  } else
3515
3515
  o.retain !== void 0 ? Jn(s, this, r, o.retain, o.attributes || {}) : o.delete !== void 0 && Wn(s, r, o.delete);
3516
3516
  }
@@ -3553,7 +3553,7 @@ class Ct extends I {
3553
3553
  c.content.str;
3554
3554
  break;
3555
3555
  }
3556
- case P:
3556
+ case G:
3557
3557
  case pt: {
3558
3558
  a();
3559
3559
  const d = {
@@ -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
- })), Me(i, this, o, e, s);
3608
+ })), ve(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
- Me(i, this, o, e, s);
3625
+ ve(i, this, o, e, s);
3626
3626
  }) : this._pending.push(() => this.insertEmbed(t, e, s));
3627
3627
  }
3628
3628
  /**
@@ -3947,7 +3947,7 @@ class ut extends I {
3947
3947
  this._prelimContent
3948
3948
  ), r = t === null ? 0 : s.findIndex((i) => i === t) + 1;
3949
3949
  if (r === 0 && t !== null)
3950
- throw J("Reference item not found");
3950
+ throw X("Reference item not found");
3951
3951
  s.splice(r, 0, ...e);
3952
3952
  }
3953
3953
  }
@@ -4025,7 +4025,7 @@ class ut extends I {
4025
4025
  t.writeTypeRef(Wo);
4026
4026
  }
4027
4027
  }
4028
- const vo = (n) => new ut();
4028
+ const Mo = (n) => new ut();
4029
4029
  class Vt extends ut {
4030
4030
  constructor(t = "UNDEFINED") {
4031
4031
  super(), this.nodeName = t, this._prelimAttrs = /* @__PURE__ */ new Map();
@@ -4215,7 +4215,7 @@ class Vt extends ut {
4215
4215
  t.writeTypeRef(Jo), t.writeKey(this.nodeName);
4216
4216
  }
4217
4217
  }
4218
- const Mo = (n) => new Vt(n.readKey());
4218
+ const vo = (n) => new Vt(n.readKey());
4219
4219
  class xo extends ye {
4220
4220
  /**
4221
4221
  * @param {YXmlElement|YXmlText|YXmlFragment} target The target on which the event is created.
@@ -4436,7 +4436,7 @@ class U extends mn {
4436
4436
  * @param {number} offset
4437
4437
  */
4438
4438
  integrate(t, e) {
4439
- e > 0 && (this.id.clock += e, this.length -= e), vs(t.doc.store, this);
4439
+ e > 0 && (this.id.clock += e, this.length -= e), Ms(t.doc.store, this);
4440
4440
  }
4441
4441
  /**
4442
4442
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
@@ -5104,12 +5104,12 @@ const jo = (n) => new $(n.readString()), Ko = [
5104
5104
  _o,
5105
5105
  Do,
5106
5106
  Io,
5107
- Mo,
5108
5107
  vo,
5108
+ Mo,
5109
5109
  Uo,
5110
5110
  To
5111
5111
  ], zo = 0, Yo = 1, Xo = 2, Jo = 3, Wo = 4, Go = 5, Po = 6;
5112
- class P {
5112
+ class G {
5113
5113
  /**
5114
5114
  * @param {AbstractType<any>} type
5115
5115
  */
@@ -5138,7 +5138,7 @@ class P {
5138
5138
  * @return {ContentType}
5139
5139
  */
5140
5140
  copy() {
5141
- return new P(this.type._copy());
5141
+ return new G(this.type._copy());
5142
5142
  }
5143
5143
  /**
5144
5144
  * @param {number} offset
@@ -5201,7 +5201,7 @@ class P {
5201
5201
  return 7;
5202
5202
  }
5203
5203
  }
5204
- const qo = (n) => new P(Ko[n.readTypeRef()](n)), de = (n, t, e) => {
5204
+ const qo = (n) => new G(Ko[n.readTypeRef()](n)), de = (n, t, e) => {
5205
5205
  const { client: s, clock: r } = t.id, i = new E(
5206
5206
  b(s, r + e),
5207
5207
  t,
@@ -5283,7 +5283,7 @@ class E extends mn {
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 = ve(e, this.parent);
5286
+ const s = Me(e, this.parent);
5287
5287
  s.constructor === U ? this.parent = null : this.parent = /** @type {ContentType} */
5288
5288
  s.content.type;
5289
5289
  }
@@ -5313,8 +5313,8 @@ class E extends mn {
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(ve(t.doc.store, r.origin)))
5317
- i.has(ve(t.doc.store, r.origin)) || (s = r, i.clear());
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());
5318
5318
  else
5319
5319
  break;
5320
5320
  r = r.right;
@@ -5335,7 +5335,7 @@ class E extends mn {
5335
5335
  this.parent._start, this.parent._start = this;
5336
5336
  this.right = s;
5337
5337
  }
5338
- this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(t)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), vs(t.doc.store, this), this.content.integrate(t, this), zn(
5338
+ this.right !== null ? this.right.left = this : this.parentSub !== null && (this.parent._map.set(this.parentSub, this), this.left !== null && this.left.delete(t)), this.parentSub === null && this.countable && !this.deleted && (this.parent._length += this.length), Ms(t.doc.store, this), this.content.integrate(t, this), zn(
5339
5339
  t,
5340
5340
  /** @type {AbstractType<any>} */
5341
5341
  this.parent,
@@ -5531,7 +5531,7 @@ class tl {
5531
5531
  Tr(this._onChange);
5532
5532
  }
5533
5533
  }
5534
- const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, yn = (n) => W(Zs, n, () => {
5534
+ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, yn = (n) => J(Zs, 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,
@@ -5549,9 +5549,9 @@ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, yn = (n) => W(
5549
5549
  D(n, e);
5550
5550
  }, er = (n, t, e) => {
5551
5551
  p(n, bn), D(n, hn(t, e));
5552
- }, rl = (n, t, e) => er(t, e, v(n)), nr = (n, t, e) => {
5552
+ }, rl = (n, t, e) => er(t, e, M(n)), nr = (n, t, e) => {
5553
5553
  try {
5554
- Es(t, v(n), e);
5554
+ Es(t, M(n), e);
5555
5555
  } catch (s) {
5556
5556
  console.error("Caught error while handling a Yjs update", s);
5557
5557
  }
@@ -5576,7 +5576,7 @@ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, yn = (n) => W(
5576
5576
  }, cl = 0, al = (n, t, e) => {
5577
5577
  switch (m(n)) {
5578
5578
  case cl:
5579
- e(t, Q(n));
5579
+ e(t, Z(n));
5580
5580
  }
5581
5581
  }, Ue = 3e4;
5582
5582
  class hl extends fe {
@@ -5593,7 +5593,7 @@ class hl extends fe {
5593
5593
  this.meta.forEach((r, i) => {
5594
5594
  i !== this.clientID && Ue <= e - r.lastUpdated && this.states.has(i) && s.push(i);
5595
5595
  }), s.length > 0 && kn(this, s, "timeout");
5596
- }, X(Ue / 10)), t.on("destroy", () => {
5596
+ }, Y(Ue / 10)), t.on("destroy", () => {
5597
5597
  this.destroy();
5598
5598
  }), this.setLocalState({});
5599
5599
  }
@@ -5656,7 +5656,7 @@ const kn = (n, t, e) => {
5656
5656
  }
5657
5657
  s.length > 0 && (n.emit("change", [{ added: [], updated: [], removed: s }, e]), n.emit("update", [{ added: [], updated: [], removed: s }, e]));
5658
5658
  }, Ut = (n, t, e = n.states) => {
5659
- const s = t.length, r = M();
5659
+ const s = t.length, r = v();
5660
5660
  p(r, s);
5661
5661
  for (let i = 0; i < s; i++) {
5662
5662
  const o = t[i], l = e.get(o) || null, c = (
@@ -5671,7 +5671,7 @@ const kn = (n, t, e) => {
5671
5671
  for (let h = 0; h < a; h++) {
5672
5672
  const d = m(s);
5673
5673
  let u = m(s);
5674
- const f = JSON.parse(Q(s)), g = n.meta.get(d), w = n.states.get(d), S = g === void 0 ? 0 : g.clock;
5674
+ const f = JSON.parse(Z(s)), g = n.meta.get(d), w = n.states.get(d), S = g === void 0 ? 0 : g.clock;
5675
5675
  (S < u || S === u && f === null && n.states.has(d)) && (f === null ? d === n.clientID && n.getLocalState() != null ? u++ : n.states.delete(d) : n.states.set(d, f), n.meta.set(d, {
5676
5676
  clock: u,
5677
5677
  lastUpdated: r
@@ -5715,7 +5715,7 @@ Xt[sr] = (n, t, e, s, r) => {
5715
5715
  Xt[kt] = (n, t, e, s, r) => {
5716
5716
  ul(
5717
5717
  e.awareness,
5718
- v(t),
5718
+ M(t),
5719
5719
  e
5720
5720
  );
5721
5721
  };
@@ -5732,7 +5732,7 @@ function wl(n, t) {
5732
5732
  ${t}`);
5733
5733
  }
5734
5734
  function rr(n, t, e) {
5735
- const s = nt(t), r = M(), i = m(s), o = n.messageHandlers[i];
5735
+ const s = nt(t), r = v(), i = m(s), o = n.messageHandlers[i];
5736
5736
  return /** @type {any} */ o ? o(r, s, n, e, i) : console.error("Unable to compute message"), r;
5737
5737
  }
5738
5738
  function ir(n) {
@@ -5771,9 +5771,9 @@ function ir(n) {
5771
5771
  status: "connected"
5772
5772
  }
5773
5773
  ]);
5774
- const e = M();
5774
+ const e = v();
5775
5775
  if (p(e, st), Ye(e, n.doc), t.send(_(e)), n.awareness.getLocalState() !== null) {
5776
- const s = M();
5776
+ const s = v();
5777
5777
  p(s, kt), D(
5778
5778
  s,
5779
5779
  Ut(n.awareness, [
@@ -5837,7 +5837,7 @@ var ml = class extends fe {
5837
5837
  this.maxBackoffTime = a, this.bcChannel = t + "/" + e, this.url = t + "/" + e + (d.length === 0 ? "" : "?" + d), this.roomname = e, this.doc = s, this._WS = l, this.awareness = i, this.wsconnected = !1, this.wsconnecting = !1, this.bcconnected = !1, this.disableBc = h, this.wsUnsuccessfulReconnects = 0, this.messageHandlers = Xt.slice(), this._synced = !1, this.ws = null, this.wsLastMessageReceived = 0, this.shouldConnect = r, this._resyncInterval = 0, c > 0 && (this._resyncInterval = /** @type {any} */
5838
5838
  setInterval(() => {
5839
5839
  if (this.ws && this.ws.readyState === WebSocket.OPEN) {
5840
- const u = M();
5840
+ const u = v();
5841
5841
  p(u, st), Ye(u, s), this.ws.send(_(u));
5842
5842
  }
5843
5843
  }, c)), this._bcSubscriber = (u, f) => {
@@ -5847,11 +5847,11 @@ var ml = class extends fe {
5847
5847
  }
5848
5848
  }, this._updateHandler = (u, f) => {
5849
5849
  if (f !== this) {
5850
- const g = M();
5850
+ const g = v();
5851
5851
  p(g, st), il(g, u), Te(this, _(g));
5852
5852
  }
5853
5853
  }, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: u, updated: f, removed: g }, w) => {
5854
- const S = u.concat(f).concat(g), j = M();
5854
+ const S = u.concat(f).concat(g), j = v();
5855
5855
  p(j, kt), D(
5856
5856
  j,
5857
5857
  Ut(i, S)
@@ -5883,17 +5883,17 @@ var ml = class extends fe {
5883
5883
  if (this.disableBc)
5884
5884
  return;
5885
5885
  this.bcconnected || (nl(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
5886
- const t = M();
5886
+ const t = v();
5887
5887
  p(t, st), Ye(t, this.doc), mt(this.bcChannel, _(t), this);
5888
- const e = M();
5888
+ const e = v();
5889
5889
  p(e, st), er(e, this.doc), mt(this.bcChannel, _(e), this);
5890
- const s = M();
5890
+ const s = v();
5891
5891
  p(s, sr), mt(
5892
5892
  this.bcChannel,
5893
5893
  _(s),
5894
5894
  this
5895
5895
  );
5896
- const r = M();
5896
+ const r = v();
5897
5897
  p(r, kt), D(
5898
5898
  r,
5899
5899
  Ut(this.awareness, [
@@ -5906,7 +5906,7 @@ var ml = class extends fe {
5906
5906
  );
5907
5907
  }
5908
5908
  disconnectBc() {
5909
- const t = M();
5909
+ const t = v();
5910
5910
  p(t, kt), D(
5911
5911
  t,
5912
5912
  Ut(
@@ -5974,7 +5974,7 @@ const wt = (n) => Dt((t, e) => {
5974
5974
  n.onerror = (s) => e(new Error(s.target.error)), n.onsuccess = (s) => t(s.target.result);
5975
5975
  }), _l = (n, t) => Dt((e, s) => {
5976
5976
  const r = indexedDB.open(n);
5977
- r.onupgradeneeded = (i) => t(i.target.result), r.onerror = (i) => s(J(i.target.error)), r.onsuccess = (i) => {
5977
+ r.onupgradeneeded = (i) => t(i.target.result), r.onerror = (i) => s(X(i.target.error)), r.onsuccess = (i) => {
5978
5978
  const o = i.target.result;
5979
5979
  o.onversionchange = () => {
5980
5980
  o.close();
@@ -5985,23 +5985,23 @@ const wt = (n) => Dt((t, e) => {
5985
5985
  // @ts-ignore
5986
5986
  n.createObjectStore.apply(n, e)
5987
5987
  )
5988
- ), vt = (n, t, e = "readwrite") => {
5988
+ ), Mt = (n, t, e = "readwrite") => {
5989
5989
  const s = n.transaction(t, e);
5990
5990
  return t.map((r) => xl(s, r));
5991
5991
  }, or = (n, t) => wt(n.count(t)), El = (n, t) => wt(n.get(t)), lr = (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) => {
5992
5992
  let s = null;
5993
- return Ml(n, t, (r) => (s = r, !1), e).then(() => s);
5994
- }, Il = (n, t = null) => Ll(n, t, "prev"), vl = (n, t) => Dt((e, s) => {
5993
+ return vl(n, t, (r) => (s = r, !1), e).then(() => s);
5994
+ }, Il = (n, t = null) => Ll(n, t, "prev"), Ml = (n, t) => Dt((e, s) => {
5995
5995
  n.onerror = s, n.onsuccess = async (r) => {
5996
5996
  const i = r.target.result;
5997
5997
  if (i === null || await t(i) === !1)
5998
5998
  return e();
5999
5999
  i.continue();
6000
6000
  };
6001
- }), Ml = (n, t, e, s = "next") => vl(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", cr = "updates", ar = 500, hr = (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), Oe = "custom", cr = "updates", ar = 500, hr = (n, t = () => {
6002
6002
  }, e = () => {
6003
6003
  }) => {
6004
- const [s] = vt(
6004
+ const [s] = Mt(
6005
6005
  /** @type {IDBDatabase} */
6006
6006
  n.db,
6007
6007
  [cr]
@@ -6040,7 +6040,7 @@ class Rl extends fe {
6040
6040
  });
6041
6041
  }), this._storeTimeout = 1e3, this._storeTimeoutId = null, this._storeUpdate = (s, r) => {
6042
6042
  if (this.db && r !== this) {
6043
- const [i] = vt(
6043
+ const [i] = Mt(
6044
6044
  /** @type {IDBDatabase} */
6045
6045
  this.db,
6046
6046
  [cr]
@@ -6072,7 +6072,7 @@ class Rl extends fe {
6072
6072
  */
6073
6073
  get(t) {
6074
6074
  return this._db.then((e) => {
6075
- const [s] = vt(e, [Oe], "readonly");
6075
+ const [s] = Mt(e, [Oe], "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] = vt(s, [Oe]);
6086
+ const [r] = Mt(s, [Oe]);
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] = vt(e, [Oe]);
6096
+ const [s] = Mt(e, [Oe]);
6097
6097
  return lr(s, t);
6098
6098
  });
6099
6099
  }
@@ -6470,14 +6470,14 @@ const jl = "playhtml.spencerc99.partykit.dev", Re = new gt();
6470
6470
  function Kl() {
6471
6471
  return window.location.pathname + window.location.search;
6472
6472
  }
6473
- let Y, N, F;
6473
+ let Q, N, F;
6474
6474
  const Qn = /* @__PURE__ */ new Map();
6475
6475
  let Jt = Hl;
6476
6476
  function Je() {
6477
6477
  return [_e.CanPlay, ...Object.keys(Jt)];
6478
6478
  }
6479
6479
  let _n = !1, We = !0;
6480
- function dr({
6480
+ function zl({
6481
6481
  // TODO: if it is a localhost url, need to make some deterministic way to connect to the same room.
6482
6482
  room: n = Kl(),
6483
6483
  host: t = jl,
@@ -6495,49 +6495,44 @@ function dr({
6495
6495
  ࿂࿂࿂࿂ https://playhtml.fun ࿂࿂࿂࿂
6496
6496
  ࿂࿂࿂࿂ ࿂ ࿂ ࿂ ࿂ ࿂࿂࿂࿂
6497
6497
  ࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂`
6498
- ), Y = new kl(r, s, Re), N = Re.getMap("playhtml-global"), F = /* @__PURE__ */ new Map(), new Rl(s, Re), Ge.globalData = N, Ge.elementHandlers = F, e)
6498
+ ), Q = new kl(r, s, Re), N = Re.getMap("playhtml-global"), F = /* @__PURE__ */ new Map(), new Rl(s, Re), Ge.globalData = N, Ge.elementHandlers = F, e)
6499
6499
  for (const [i, o] of Object.entries(e))
6500
6500
  Jt[i] = o;
6501
- return Y.on("sync", (i) => {
6502
- i || console.error("Issue connecting to yjs..."), _n = !0, Wl();
6503
- }), Y;
6501
+ return Q.on("sync", (i) => {
6502
+ i || console.error("Issue connecting to yjs..."), _n = !0, fr();
6503
+ }), Q;
6504
6504
  }
6505
- setTimeout(() => {
6506
- Y || (console.error(
6507
- "You are using a deprecated version of playhtml. Please call `playhtml.init()` explicitly rather than just importing the library. Refer to https://github.com/spencerc99/playhtml#usage for reference."
6508
- ), dr());
6509
- }, 3e3);
6510
- function zl(n, t) {
6511
- const e = Y.awareness.getLocalState();
6505
+ function Yl(n, t) {
6506
+ const e = Q.awareness.getLocalState();
6512
6507
  return ((e == null ? void 0 : e[n]) ?? {})[t];
6513
6508
  }
6514
6509
  function Sn(n) {
6515
6510
  return n instanceof HTMLElement;
6516
6511
  }
6517
- function Yl(n, t, e, s) {
6512
+ function Xl(n, t, e, s) {
6518
6513
  const r = N.get(t);
6519
6514
  return {
6520
6515
  ...e,
6521
6516
  data: r.get(s) ?? e.defaultData,
6522
- awareness: zl(t, s) ?? e.myDefaultAwareness !== void 0 ? [e.myDefaultAwareness] : void 0,
6517
+ awareness: Yl(t, s) ?? e.myDefaultAwareness !== void 0 ? [e.myDefaultAwareness] : void 0,
6523
6518
  element: n,
6524
6519
  onChange: (o) => {
6525
6520
  r.get(s) !== o && r.set(s, o);
6526
6521
  },
6527
6522
  onAwarenessChange: (o) => {
6528
6523
  var c;
6529
- const l = ((c = Y.awareness.getLocalState()) == null ? void 0 : c[t]) || {};
6530
- l[s] !== o && (l[s] = o, Y.awareness.setLocalStateField(t, l));
6524
+ const l = ((c = Q.awareness.getLocalState()) == null ? void 0 : c[t]) || {};
6525
+ l[s] !== o && (l[s] = o, Q.awareness.setLocalStateField(t, l));
6531
6526
  },
6532
6527
  triggerAwarenessUpdate: () => {
6533
- fr();
6528
+ dr();
6534
6529
  }
6535
6530
  };
6536
6531
  }
6537
- function Xl(n) {
6538
- return n.defaultData !== void 0 && n.updateElement !== void 0;
6532
+ function Jl(n) {
6533
+ return n.defaultData !== void 0 && typeof n.defaultData == "object" && n.updateElement !== void 0;
6539
6534
  }
6540
- function Jl(n, t) {
6535
+ function Wl(n, t) {
6541
6536
  if (n === _e.CanPlay) {
6542
6537
  const e = t;
6543
6538
  return {
@@ -6557,14 +6552,14 @@ function Jl(n, t) {
6557
6552
  }
6558
6553
  return Jt[n];
6559
6554
  }
6560
- function fr() {
6555
+ function dr() {
6561
6556
  const n = /* @__PURE__ */ new Map();
6562
6557
  function t(e, s, r, i) {
6563
6558
  n.has(e) || n.set(e, /* @__PURE__ */ new Map());
6564
6559
  const o = n.get(e);
6565
6560
  o.has(s) || o.set(s, /* @__PURE__ */ new Map()), o.get(s).set(r, i);
6566
6561
  }
6567
- Y.awareness.getStates().forEach((e, s) => {
6562
+ Q.awareness.getStates().forEach((e, s) => {
6568
6563
  var r;
6569
6564
  for (const [i, o] of Object.entries(e)) {
6570
6565
  const l = F.get(i);
@@ -6594,7 +6589,7 @@ function fr() {
6594
6589
  }
6595
6590
  });
6596
6591
  }
6597
- function Wl() {
6592
+ function fr() {
6598
6593
  console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝"), console.log(Je());
6599
6594
  for (const n of Je()) {
6600
6595
  const t = Array.from(
@@ -6610,10 +6605,11 @@ function Wl() {
6610
6605
  n.changes.keys.forEach((t, e) => {
6611
6606
  t.action === "add" && N.set(e, N.get(e));
6612
6607
  });
6613
- }), Y.awareness.on("change", () => fr()), We = !1);
6608
+ }), Q.awareness.on("change", () => dr()), We = !1);
6614
6609
  }
6615
6610
  const Ge = {
6616
- init: dr,
6611
+ init: zl,
6612
+ setupPlayElements: fr,
6617
6613
  setupPlayElement: ql,
6618
6614
  removePlayElement: Zl,
6619
6615
  setupPlayElementForTag: Se,
@@ -6668,17 +6664,17 @@ function Se(n, t) {
6668
6664
  return;
6669
6665
  }
6670
6666
  Gl(t);
6671
- const s = F.get(t), r = Jl(
6667
+ const s = F.get(t), r = Wl(
6672
6668
  t,
6673
6669
  n
6674
6670
  );
6675
- if (!Xl(r)) {
6671
+ if (!Jl(r)) {
6676
6672
  console.error(
6677
6673
  `Element ${e} does not have proper info to initial a playhtml element. Please refer to https://github.com/spencerc99/playhtml#can-play for troubleshooting help.`
6678
6674
  );
6679
6675
  return;
6680
6676
  }
6681
- const i = N.get(t), o = Yl(
6677
+ const i = N.get(t), o = Xl(
6682
6678
  n,
6683
6679
  t,
6684
6680
  r,