playhtml 2.0.0 → 2.0.1

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.
@@ -19,7 +19,7 @@ const O = () => /* @__PURE__ */ new Map(), Tt = (s) => {
19
19
  if (e(n, t))
20
20
  return !0;
21
21
  return !1;
22
- }, ce = () => /* @__PURE__ */ new Set(), St = (s) => s[s.length - 1], fi = (s, e) => {
22
+ }, ae = () => /* @__PURE__ */ new Set(), St = (s) => s[s.length - 1], fi = (s, e) => {
23
23
  for (let t = 0; t < e.length; t++)
24
24
  s.push(e[t]);
25
25
  }, ee = Array.from, gi = Array.isArray, pi = String.fromCharCode, ki = (s) => s.toLowerCase(), mi = /^\s*/g, bi = (s) => s.replace(mi, ""), wi = /([A-Z])/g, Ss = (s, e) => bi(s.replace(wi, (t) => `${e}${ki(t)}`)), yi = (s) => {
@@ -165,7 +165,7 @@ const Oi = () => {
165
165
  return R;
166
166
  }, Ot = (s) => Oi().has(s), Rt = (s) => Ds(_e ? process.env[s.toUpperCase()] : Xs.getItem(s)), Ri = (s) => Ot("--" + s) || Rt(s) !== null;
167
167
  Ri("production");
168
- const Es = _e && Ti(process.env.FORCE_COLOR, ["true", "1", "2"]), Ni = !Ot("no-colors") && (!_e || process.stdout.isTTY || Es) && (!_e || Ot("color") || Es || Rt("COLORTERM") !== null || (Rt("TERM") || "").includes("color")), K = Math.floor, tt = Math.abs, Wt = (s, e) => s < e ? s : e, ge = (s, e) => s > e ? s : e, Bi = Math.pow, Ps = (s) => s !== 0 ? s < 0 : 1 / s < 0, Cs = 1, vs = 2, Dt = 4, Et = 8, Ne = 32, q = 64, U = 128, gt = 31, Nt = 63, re = 127, Fi = 2147483647, Qs = Number.MAX_SAFE_INTEGER, Hi = Number.isInteger || ((s) => typeof s == "number" && isFinite(s) && K(s) === s);
168
+ const Es = _e && Ti(process.env.FORCE_COLOR, ["true", "1", "2"]), Ni = !Ot("no-colors") && (!_e || process.stdout.isTTY || Es) && (!_e || Ot("color") || Es || Rt("COLORTERM") !== null || (Rt("TERM") || "").includes("color")), K = Math.floor, tt = Math.abs, Wt = (s, e) => s < e ? s : e, ge = (s, e) => s > e ? s : e, Bi = Math.pow, Ps = (s) => s !== 0 ? s < 0 : 1 / s < 0, Cs = 1, vs = 2, Dt = 4, Et = 8, Ne = 32, q = 64, U = 128, gt = 31, Nt = 63, oe = 127, Fi = 2147483647, Qs = Number.MAX_SAFE_INTEGER, Hi = Number.isInteger || ((s) => typeof s == "number" && isFinite(s) && K(s) === s);
169
169
  class Ke {
170
170
  constructor() {
171
171
  this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
@@ -191,13 +191,13 @@ const L = () => new Ke(), Pt = (s) => {
191
191
  const t = s.cbuf.length;
192
192
  s.cpos === t && (s.bufs.push(s.cbuf), s.cbuf = new Uint8Array(t * 2), s.cpos = 0), s.cbuf[s.cpos++] = e;
193
193
  }, Bt = v, p = (s, e) => {
194
- for (; e > re; )
195
- v(s, U | re & e), e = K(e / 128);
196
- v(s, re & e);
194
+ for (; e > oe; )
195
+ v(s, U | oe & e), e = K(e / 128);
196
+ v(s, oe & e);
197
197
  }, Qt = (s, e) => {
198
198
  const t = Ps(e);
199
199
  for (t && (e = -e), v(s, (e > Nt ? U : 0) | (t ? q : 0) | Nt & e), e = K(e / 64); e > 0; )
200
- v(s, (e > re ? U : 0) | re & e), e = K(e / 128);
200
+ v(s, (e > oe ? U : 0) | oe & e), e = K(e / 128);
201
201
  }, Ft = new Uint8Array(3e4), $i = Ft.length / 3, qi = (s, e) => {
202
202
  if (e.length < $i) {
203
203
  const t = Re.encodeInto(e, Ft).written || 0;
@@ -215,7 +215,7 @@ const L = () => new Ke(), Pt = (s) => {
215
215
  /** @type {number} */
216
216
  t.codePointAt(i)
217
217
  );
218
- }, oe = Re && /** @type {any} */
218
+ }, ce = Re && /** @type {any} */
219
219
  Re.encodeInto ? qi : Ki, pt = (s, e) => {
220
220
  const t = s.cbuf.length, n = s.cpos, i = Wt(t - n, e.length), r = e.length - i;
221
221
  s.cbuf.set(e.subarray(0, i), n), s.cpos += i, r > 0 && (s.bufs.push(s.cbuf), s.cbuf = new Uint8Array(ge(t * 2, r)), s.cbuf.set(e.subarray(i)), s.cpos = r);
@@ -231,7 +231,7 @@ Re.encodeInto ? qi : Ki, pt = (s, e) => {
231
231
  ), xs = new DataView(new ArrayBuffer(4)), Gi = (s) => (xs.setFloat32(0, s), xs.getFloat32(0) === s), Be = (s, e) => {
232
232
  switch (typeof e) {
233
233
  case "string":
234
- v(s, 119), oe(s, e);
234
+ v(s, 119), ce(s, e);
235
235
  break;
236
236
  case "number":
237
237
  Hi(e) && tt(e) <= Fi ? (v(s, 125), Qt(s, e)) : Gi(e) ? (v(s, 124), Yi(s, e)) : (v(s, 123), Ji(s, e));
@@ -254,7 +254,7 @@ Re.encodeInto ? qi : Ki, pt = (s, e) => {
254
254
  p(s, t.length);
255
255
  for (let n = 0; n < t.length; n++) {
256
256
  const i = t[n];
257
- oe(s, i), Be(s, e[i]);
257
+ ce(s, i), Be(s, e[i]);
258
258
  }
259
259
  }
260
260
  break;
@@ -328,7 +328,7 @@ class Wi {
328
328
  }
329
329
  toUint8Array() {
330
330
  const e = new Ke();
331
- return this.sarr.push(this.s), this.s = "", oe(e, this.sarr.join("")), pt(e, this.lensE.toUint8Array()), _(e);
331
+ return this.sarr.push(this.s), this.s = "", ce(e, this.sarr.join("")), pt(e, this.lensE.toUint8Array()), _(e);
332
332
  }
333
333
  }
334
334
  const Y = (s) => new Error(s), N = () => {
@@ -344,7 +344,7 @@ class kt {
344
344
  this.arr = e, this.pos = 0;
345
345
  }
346
346
  }
347
- const se = (s) => new kt(s), Pi = (s) => s.pos !== s.arr.length, Qi = (s, e) => {
347
+ const ne = (s) => new kt(s), Pi = (s) => s.pos !== s.arr.length, Qi = (s, e) => {
348
348
  const t = ss(s.arr.buffer, s.pos + s.arr.byteOffset, e);
349
349
  return s.pos += e, t;
350
350
  }, I = (s) => Qi(s, k(s)), Se = (s) => s.arr[s.pos++], k = (s) => {
@@ -352,7 +352,7 @@ const se = (s) => new kt(s), Pi = (s) => s.pos !== s.arr.length, Qi = (s, e) =>
352
352
  const n = s.arr.length;
353
353
  for (; s.pos < n; ) {
354
354
  const i = s.arr[s.pos++];
355
- if (e = e + (i & re) * t, t *= 128, i < U)
355
+ if (e = e + (i & oe) * t, t *= 128, i < U)
356
356
  return e;
357
357
  if (e > Qs)
358
358
  throw en;
@@ -365,7 +365,7 @@ const se = (s) => new kt(s), Pi = (s) => s.pos !== s.arr.length, Qi = (s, e) =>
365
365
  return i * t;
366
366
  const r = s.arr.length;
367
367
  for (; s.pos < r; ) {
368
- if (e = s.arr[s.pos++], t = t + (e & re) * n, n *= 128, e < U)
368
+ if (e = s.arr[s.pos++], t = t + (e & oe) * n, n *= 128, e < U)
369
369
  return i * t;
370
370
  if (t > Qs)
371
371
  throw en;
@@ -535,7 +535,7 @@ class gr {
535
535
  }
536
536
  }
537
537
  const pr = typeof BroadcastChannel > "u" ? gr : BroadcastChannel, ns = (s) => J(sn, s, () => {
538
- const e = ce(), t = new pr(s);
538
+ const e = ae(), t = new pr(s);
539
539
  return t.onmessage = (n) => e.forEach((i) => i(n.data, "broadcastchannel")), {
540
540
  bc: t,
541
541
  subs: e
@@ -546,7 +546,7 @@ const pr = typeof BroadcastChannel > "u" ? gr : BroadcastChannel, ns = (s) => J(
546
546
  }, me = (s, e, t = null) => {
547
547
  const n = ns(s);
548
548
  n.bc.postMessage(e), n.subs.forEach((i) => i(e, t));
549
- }, ae = Date.now;
549
+ }, le = Date.now;
550
550
  class mt {
551
551
  constructor() {
552
552
  this._observers = O();
@@ -556,7 +556,7 @@ class mt {
556
556
  * @param {function} f
557
557
  */
558
558
  on(e, t) {
559
- J(this._observers, e, ce).add(t);
559
+ J(this._observers, e, ae).add(t);
560
560
  }
561
561
  /**
562
562
  * @param {N} name
@@ -651,7 +651,7 @@ const Sr = (s) => ui(s, (e, t) => `${t}:${e};`).join(""), X = Symbol, rn = X(),
651
651
  return i;
652
652
  }, jr = Ni ? Lr : Ar, Mr = (...s) => {
653
653
  console.log(...jr(s)), Ur.forEach((e) => e.print(s));
654
- }, Ur = ce(), ln = (s) => ({
654
+ }, Ur = ae(), ln = (s) => ({
655
655
  /**
656
656
  * @return {IterableIterator<T>}
657
657
  */
@@ -794,7 +794,7 @@ const hn = (s, e, t) => e.clients.forEach((n, i) => {
794
794
  }
795
795
  }
796
796
  if (n.clients.size > 0) {
797
- const r = new le();
797
+ const r = new he();
798
798
  return p(r.restEncoder, 0), ve(r, n), r.toUint8Array();
799
799
  }
800
800
  return null;
@@ -935,7 +935,7 @@ class xe extends mt {
935
935
  * @public
936
936
  */
937
937
  getMap(e = "") {
938
- return this.get(e, he);
938
+ return this.get(e, ue);
939
939
  }
940
940
  /**
941
941
  * @param {string} [name]
@@ -944,7 +944,7 @@ class xe extends mt {
944
944
  * @public
945
945
  */
946
946
  getXmlFragment(e = "") {
947
- return this.get(e, ue);
947
+ return this.get(e, de);
948
948
  }
949
949
  /**
950
950
  * Converts the entire document into a js object, recursively traversing each yjs type
@@ -1273,7 +1273,7 @@ class Je extends pn {
1273
1273
  * @param {string} s
1274
1274
  */
1275
1275
  writeString(e) {
1276
- oe(this.restEncoder, e);
1276
+ ce(this.restEncoder, e);
1277
1277
  }
1278
1278
  /**
1279
1279
  * @param {boolean} isYKey
@@ -1311,13 +1311,13 @@ class Je extends pn {
1311
1311
  * @param {any} embed
1312
1312
  */
1313
1313
  writeJSON(e) {
1314
- oe(this.restEncoder, JSON.stringify(e));
1314
+ ce(this.restEncoder, JSON.stringify(e));
1315
1315
  }
1316
1316
  /**
1317
1317
  * @param {string} key
1318
1318
  */
1319
1319
  writeKey(e) {
1320
- oe(this.restEncoder, e);
1320
+ ce(this.restEncoder, e);
1321
1321
  }
1322
1322
  }
1323
1323
  class kn {
@@ -1344,7 +1344,7 @@ class kn {
1344
1344
  e === 0 && F(), p(this.restEncoder, e - 1), this.dsCurrVal += e;
1345
1345
  }
1346
1346
  }
1347
- class le extends kn {
1347
+ class he extends kn {
1348
1348
  constructor() {
1349
1349
  super(), this.keyMap = /* @__PURE__ */ new Map(), this.keyClock = 0, this.keyClockEncoder = new Ct(), this.clientEncoder = new st(), this.leftClockEncoder = new Ct(), this.rightClockEncoder = new Ct(), this.infoEncoder = new As(Bt), this.stringEncoder = new Wi(), this.parentInfoEncoder = new As(Bt), this.typeRefEncoder = new st(), this.lenEncoder = new st();
1350
1350
  }
@@ -1585,7 +1585,7 @@ const Fr = (s, e, t, n) => {
1585
1585
  }
1586
1586
  }
1587
1587
  if (c.clients.size > 0) {
1588
- const f = new le();
1588
+ const f = new he();
1589
1589
  return cs(f, c, /* @__PURE__ */ new Map()), p(f.restEncoder, 0), { missing: a, update: f.toUint8Array() };
1590
1590
  }
1591
1591
  return null;
@@ -1610,7 +1610,7 @@ const Fr = (s, e, t, n) => {
1610
1610
  c.pendingStructs = l;
1611
1611
  const u = Ms(n, i, c);
1612
1612
  if (c.pendingDs) {
1613
- const d = new Ee(se(c.pendingDs));
1613
+ const d = new Ee(ne(c.pendingDs));
1614
1614
  k(d.restDecoder);
1615
1615
  const f = Ms(d, i, c);
1616
1616
  u && f ? c.pendingDs = ct([u, f]) : c.pendingDs = u || f;
@@ -1624,18 +1624,18 @@ const Fr = (s, e, t, n) => {
1624
1624
  c.pendingStructs = null, mn(i.doc, d);
1625
1625
  }
1626
1626
  }, t, !1), mn = (s, e, t, n = Ee) => {
1627
- const i = se(e);
1627
+ const i = ne(e);
1628
1628
  qr(i, s, t, new n(i));
1629
1629
  }, bn = (s, e, t) => mn(s, e, t, gn), Kr = (s, e, t = /* @__PURE__ */ new Map()) => {
1630
1630
  cs(s, e.store, t), ve(s, Nr(e.store));
1631
- }, Yr = (s, e = new Uint8Array([0]), t = new le()) => {
1631
+ }, Yr = (s, e = new Uint8Array([0]), t = new he()) => {
1632
1632
  const n = wn(e);
1633
1633
  Kr(t, s, n);
1634
1634
  const i = [t.toUint8Array()];
1635
1635
  if (s.store.pendingDs && i.push(s.store.pendingDs), s.store.pendingStructs && i.push(co(s.store.pendingStructs.update, e)), i.length > 1) {
1636
1636
  if (t.constructor === Je)
1637
1637
  return ro(i.map((r, o) => o === 0 ? r : lo(r)));
1638
- if (t.constructor === le)
1638
+ if (t.constructor === he)
1639
1639
  return ct(i);
1640
1640
  }
1641
1641
  return i[0];
@@ -1646,7 +1646,7 @@ const Fr = (s, e, t, n) => {
1646
1646
  e.set(i, r);
1647
1647
  }
1648
1648
  return e;
1649
- }, wn = (s) => Jr(new fn(se(s))), yn = (s, e) => (p(s.restEncoder, e.size), ee(e.entries()).sort((t, n) => n[0] - t[0]).forEach(([t, n]) => {
1649
+ }, wn = (s) => Jr(new fn(ne(s))), yn = (s, e) => (p(s.restEncoder, e.size), ee(e.entries()).sort((t, n) => n[0] - t[0]).forEach(([t, n]) => {
1650
1650
  p(s.restEncoder, t), p(s.restEncoder, n);
1651
1651
  }), s), Xr = (s, e) => yn(s, bt(e.store)), Gr = (s, e = new kn()) => (s instanceof Map ? yn(e, s) : Xr(e, s), e.toUint8Array()), Wr = (s) => Gr(s, new pn());
1652
1652
  class Pr {
@@ -1673,7 +1673,7 @@ const Pe = (s, e) => s === e || s !== null && e !== null && s.client === e.clien
1673
1673
  return e;
1674
1674
  throw F();
1675
1675
  }, Me = (s, e) => e === void 0 ? !s.deleted : e.sv.has(s.id.client) && (e.sv.get(s.id.client) || 0) > s.id.clock && !un(e.ds, s.id), Ht = (s, e) => {
1676
- const t = J(s.meta, Ht, ce), n = s.doc.store;
1676
+ const t = J(s.meta, Ht, ae), n = s.doc.store;
1677
1677
  t.has(e) || (e.sv.forEach((i, r) => {
1678
1678
  i < x(n, r) && te(s, w(r, i));
1679
1679
  }), hn(s, e.ds, (i) => {
@@ -1766,7 +1766,7 @@ class to {
1766
1766
  }
1767
1767
  const Rs = (s, e) => e.deleteSet.clients.size === 0 && !di(e.afterState, (t, n) => e.beforeState.get(n) !== t) ? !1 : (rs(e.deleteSet), $r(s, e), ve(s, e.deleteSet), !0), Ns = (s, e, t) => {
1768
1768
  const n = e._item;
1769
- (n === null || n.id.clock < (s.beforeState.get(n.id.client) || 0) && !n.deleted) && J(s.changed, e, ce).add(t);
1769
+ (n === null || n.id.clock < (s.beforeState.get(n.id.client) || 0) && !n.deleted) && J(s.changed, e, ae).add(t);
1770
1770
  }, it = (s, e) => {
1771
1771
  let t = s[e], n = s[e - 1], i = e;
1772
1772
  for (; i > 0; t = n, n = s[--i - 1]) {
@@ -1854,7 +1854,7 @@ const Rs = (s, e) => e.deleteSet.clients.size === 0 && !di(e.afterState, (t, n)
1854
1854
  Rs(h, t) && n.emit("update", [h.toUint8Array(), t.origin, n, t]);
1855
1855
  }
1856
1856
  if (n._observers.has("updateV2")) {
1857
- const h = new le();
1857
+ const h = new he();
1858
1858
  Rs(h, t) && n.emit("updateV2", [h.toUint8Array(), t.origin, n, t]);
1859
1859
  }
1860
1860
  const { subdocsAdded: c, subdocsLoaded: a, subdocsRemoved: l } = t;
@@ -1963,10 +1963,10 @@ const ro = (s) => ct(s, gn, Je), oo = (s, e) => {
1963
1963
  t.content.splice(e)
1964
1964
  );
1965
1965
  }
1966
- }, ct = (s, e = Ee, t = le) => {
1966
+ }, ct = (s, e = Ee, t = he) => {
1967
1967
  if (s.length === 1)
1968
1968
  return s[0];
1969
- const n = s.map((h) => new e(se(h)));
1969
+ const n = s.map((h) => new e(ne(h)));
1970
1970
  let i = n.map((h) => new ls(h, !0)), r = null;
1971
1971
  const o = new t(), c = new hs(o);
1972
1972
  for (; i = i.filter((d) => d.curr !== null), i.sort(
@@ -2022,8 +2022,8 @@ const ro = (s) => ct(s, gn, Je), oo = (s, e) => {
2022
2022
  r !== null && (W(c, r.struct, r.offset), r = null), us(c);
2023
2023
  const a = n.map((h) => os(h)), l = Or(a);
2024
2024
  return ve(o, l), o.toUint8Array();
2025
- }, co = (s, e, t = Ee, n = le) => {
2026
- const i = wn(e), r = new n(), o = new hs(r), c = new t(se(s)), a = new ls(c, !1);
2025
+ }, co = (s, e, t = Ee, n = he) => {
2026
+ const i = wn(e), r = new n(), o = new hs(r), c = new t(ne(s)), a = new ls(c, !1);
2027
2027
  for (; a.curr; ) {
2028
2028
  const h = a.curr, u = h.id.client, d = i.get(u) || 0;
2029
2029
  if (a.curr.constructor === T) {
@@ -2053,7 +2053,7 @@ const ro = (s) => ct(s, gn, Je), oo = (s, e) => {
2053
2053
  p(e, n.written), pt(e, n.restEncoder);
2054
2054
  }
2055
2055
  }, ao = (s, e, t, n) => {
2056
- const i = new t(se(s)), r = new ls(i, !1), o = new n(), c = new hs(o);
2056
+ const i = new t(ne(s)), r = new ls(i, !1), o = new n(), c = new hs(o);
2057
2057
  for (let l = r.curr; l !== null; l = r.next())
2058
2058
  W(c, e(l), 0);
2059
2059
  us(c);
@@ -2170,7 +2170,7 @@ class wt {
2170
2170
  if (e === null) {
2171
2171
  if (this.transaction.doc._transactionCleanups.length === 0)
2172
2172
  throw Y(Bs);
2173
- const t = this.target, n = ce(), i = ce(), r = [];
2173
+ const t = this.target, n = ae(), i = ae(), r = [];
2174
2174
  if (e = {
2175
2175
  added: n,
2176
2176
  deleted: i,
@@ -2461,7 +2461,7 @@ const In = (s, e, t) => {
2461
2461
  const r = s.doc, o = r.clientID, c = r.store, a = t === null ? e._start : t.right;
2462
2462
  let l = [];
2463
2463
  const h = () => {
2464
- l.length > 0 && (i = new E(w(o, x(c, o)), i, i && i.lastId, a, a && a.id, e, null, new de(l)), i.integrate(s, 0), l = []);
2464
+ l.length > 0 && (i = new E(w(o, x(c, o)), i, i && i.lastId, a, a && a.id, e, null, new fe(l)), i.integrate(s, 0), l = []);
2465
2465
  };
2466
2466
  n.forEach((u) => {
2467
2467
  if (u === null)
@@ -2544,7 +2544,7 @@ const In = (s, e, t) => {
2544
2544
  const i = e._map.get(t) || null, r = s.doc, o = r.clientID;
2545
2545
  let c;
2546
2546
  if (n == null)
2547
- c = new de([n]);
2547
+ c = new fe([n]);
2548
2548
  else
2549
2549
  switch (n.constructor) {
2550
2550
  case Number:
@@ -2552,7 +2552,7 @@ const In = (s, e, t) => {
2552
2552
  case Boolean:
2553
2553
  case Array:
2554
2554
  case String:
2555
- c = new de([n]);
2555
+ c = new fe([n]);
2556
2556
  break;
2557
2557
  case Uint8Array:
2558
2558
  c = new Xe(
@@ -2805,7 +2805,7 @@ class wo extends wt {
2805
2805
  super(e, t), this.keysChanged = n;
2806
2806
  }
2807
2807
  }
2808
- class he extends A {
2808
+ class ue extends A {
2809
2809
  /**
2810
2810
  *
2811
2811
  * @param {Iterable<readonly [string, any]>=} entries - an optional iterable to initialize the YMap
@@ -2832,13 +2832,13 @@ class he extends A {
2832
2832
  * @return {YMap<MapType>}
2833
2833
  */
2834
2834
  _copy() {
2835
- return new he();
2835
+ return new ue();
2836
2836
  }
2837
2837
  /**
2838
2838
  * @return {YMap<MapType>}
2839
2839
  */
2840
2840
  clone() {
2841
- const e = new he();
2841
+ const e = new ue();
2842
2842
  return this.forEach((t, n) => {
2843
2843
  e.set(n, t instanceof A ? (
2844
2844
  /** @type {typeof value} */
@@ -2998,7 +2998,7 @@ class he extends A {
2998
2998
  e.writeTypeRef(Vo);
2999
2999
  }
3000
3000
  }
3001
- const yo = (s) => new he(), P = (s, e) => s === e || typeof s == "object" && typeof e == "object" && s && e && Mi(s, e);
3001
+ const yo = (s) => new ue(), P = (s, e) => s === e || typeof s == "object" && typeof e == "object" && s && e && Mi(s, e);
3002
3002
  class $t {
3003
3003
  /**
3004
3004
  * @param {Item|null} left
@@ -3737,7 +3737,7 @@ class Lt {
3737
3737
  if (e !== null && (!this._firstCall || e.deleted || !this._filter(t)))
3738
3738
  do
3739
3739
  if (t = /** @type {any} */
3740
- e.content.type, !e.deleted && (t.constructor === $e || t.constructor === ue) && t._start !== null)
3740
+ e.content.type, !e.deleted && (t.constructor === $e || t.constructor === de) && t._start !== null)
3741
3741
  e = t._start;
3742
3742
  else
3743
3743
  for (; e !== null; )
@@ -3757,7 +3757,7 @@ class Lt {
3757
3757
  ), done: !1 });
3758
3758
  }
3759
3759
  }
3760
- class ue extends A {
3760
+ class de extends A {
3761
3761
  constructor() {
3762
3762
  super(), this._prelimContent = [];
3763
3763
  }
@@ -3786,13 +3786,13 @@ class ue extends A {
3786
3786
  ), this._prelimContent = null;
3787
3787
  }
3788
3788
  _copy() {
3789
- return new ue();
3789
+ return new de();
3790
3790
  }
3791
3791
  /**
3792
3792
  * @return {YXmlFragment}
3793
3793
  */
3794
3794
  clone() {
3795
- const e = new ue();
3795
+ const e = new de();
3796
3796
  return e.insert(0, this.toArray().map((t) => t instanceof A ? t.clone() : t)), e;
3797
3797
  }
3798
3798
  get length() {
@@ -4011,8 +4011,8 @@ class ue extends A {
4011
4011
  e.writeTypeRef(Ko);
4012
4012
  }
4013
4013
  }
4014
- const vo = (s) => new ue();
4015
- class $e extends ue {
4014
+ const vo = (s) => new de();
4015
+ class $e extends de {
4016
4016
  constructor(e = "UNDEFINED") {
4017
4017
  super(), this.nodeName = e, this._prelimAttrs = /* @__PURE__ */ new Map();
4018
4018
  }
@@ -4216,7 +4216,7 @@ class Ao extends wt {
4216
4216
  });
4217
4217
  }
4218
4218
  }
4219
- class ht extends he {
4219
+ class ht extends ue {
4220
4220
  /**
4221
4221
  * @param {string} hookName nodeName of the Dom Node.
4222
4222
  */
@@ -4921,7 +4921,7 @@ const Ro = (s) => {
4921
4921
  }
4922
4922
  return new dt(t);
4923
4923
  };
4924
- class de {
4924
+ class fe {
4925
4925
  /**
4926
4926
  * @param {Array<any>} arr
4927
4927
  */
@@ -4950,14 +4950,14 @@ class de {
4950
4950
  * @return {ContentAny}
4951
4951
  */
4952
4952
  copy() {
4953
- return new de(this.arr);
4953
+ return new fe(this.arr);
4954
4954
  }
4955
4955
  /**
4956
4956
  * @param {number} offset
4957
4957
  * @return {ContentAny}
4958
4958
  */
4959
4959
  splice(e) {
4960
- const t = new de(this.arr.slice(e));
4960
+ const t = new fe(this.arr.slice(e));
4961
4961
  return this.arr = this.arr.slice(0, e), t;
4962
4962
  }
4963
4963
  /**
@@ -5006,7 +5006,7 @@ const No = (s) => {
5006
5006
  const e = s.readLen(), t = [];
5007
5007
  for (let n = 0; n < e; n++)
5008
5008
  t.push(s.readAny());
5009
- return new de(t);
5009
+ return new fe(t);
5010
5010
  };
5011
5011
  class V {
5012
5012
  /**
@@ -5540,7 +5540,7 @@ class nc extends mt {
5540
5540
  constructor(e) {
5541
5541
  super(), this.doc = e, this.clientID = e.clientID, this.states = /* @__PURE__ */ new Map(), this.meta = /* @__PURE__ */ new Map(), this._checkInterval = /** @type {any} */
5542
5542
  setInterval(() => {
5543
- const t = ae();
5543
+ const t = le();
5544
5544
  this.getLocalState() !== null && jt / 2 <= t - /** @type {{lastUpdated:number}} */
5545
5545
  this.meta.get(this.clientID).lastUpdated && this.setLocalState(this.getLocalState());
5546
5546
  const n = [];
@@ -5567,7 +5567,7 @@ class nc extends mt {
5567
5567
  const t = this.clientID, n = this.meta.get(t), i = n === void 0 ? 0 : n.clock + 1, r = this.states.get(t);
5568
5568
  e === null ? this.states.delete(t) : this.states.set(t, e), this.meta.set(t, {
5569
5569
  clock: i,
5570
- lastUpdated: ae()
5570
+ lastUpdated: le()
5571
5571
  });
5572
5572
  const o = [], c = [], a = [], l = [];
5573
5573
  e === null ? l.push(t) : r == null ? e != null && o.push(t) : (c.push(t), Te(r, e) || a.push(t)), (o.length > 0 || a.length > 0 || l.length > 0) && this.emit("change", [{ added: o, updated: a, removed: l }, "local"]), this.emit("update", [{ added: o, updated: c, removed: l }, "local"]);
@@ -5602,7 +5602,7 @@ const ms = (s, e, t) => {
5602
5602
  );
5603
5603
  s.meta.set(r, {
5604
5604
  clock: o.clock + 1,
5605
- lastUpdated: ae()
5605
+ lastUpdated: le()
5606
5606
  });
5607
5607
  }
5608
5608
  n.push(r);
@@ -5617,11 +5617,11 @@ const ms = (s, e, t) => {
5617
5617
  /** @type {MetaClientState} */
5618
5618
  s.meta.get(o).clock
5619
5619
  );
5620
- p(i, o), p(i, a), oe(i, JSON.stringify(c));
5620
+ p(i, o), p(i, a), ce(i, JSON.stringify(c));
5621
5621
  }
5622
5622
  return _(i);
5623
5623
  }, ic = (s, e, t) => {
5624
- const n = se(e), i = ae(), r = [], o = [], c = [], a = [], l = k(n);
5624
+ const n = ne(e), i = le(), r = [], o = [], c = [], a = [], l = k(n);
5625
5625
  for (let h = 0; h < l; h++) {
5626
5626
  const u = k(n);
5627
5627
  let d = k(n);
@@ -5641,14 +5641,14 @@ const ms = (s, e, t) => {
5641
5641
  removed: a
5642
5642
  }, t]);
5643
5643
  }, rc = (s) => Ii(s, (e, t) => `${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&");
5644
- var ie = 0, Wn = 3, ye = 1, oc = 2;
5644
+ var re = 0, Wn = 3, ye = 1, oc = 2;
5645
5645
  function cc(s, e) {
5646
5646
  if (!s)
5647
5647
  throw new Error(e);
5648
5648
  }
5649
5649
  var We = [];
5650
- We[ie] = (s, e, t, n, i) => {
5651
- p(s, ie);
5650
+ We[re] = (s, e, t, n, i) => {
5651
+ p(s, re);
5652
5652
  const r = ec(
5653
5653
  e,
5654
5654
  s,
@@ -5686,7 +5686,7 @@ function ac(s, e) {
5686
5686
  ${e}`);
5687
5687
  }
5688
5688
  function Pn(s, e, t) {
5689
- const n = se(e), i = L(), r = k(n), o = s.messageHandlers[r];
5689
+ const n = ne(e), i = L(), r = k(n), o = s.messageHandlers[r];
5690
5690
  return /** @type {any} */ o ? o(i, n, s, t, r) : console.error("Unable to compute message"), i;
5691
5691
  }
5692
5692
  function Qn(s) {
@@ -5697,7 +5697,7 @@ function Qn(s) {
5697
5697
  e.send("pong");
5698
5698
  return;
5699
5699
  }
5700
- s.wsLastMessageReceived = ae();
5700
+ s.wsLastMessageReceived = le();
5701
5701
  const n = Pn(s, new Uint8Array(t.data), !0);
5702
5702
  Pt(n) > 1 && e.send(_(n));
5703
5703
  }, e.onerror = (t) => {
@@ -5722,13 +5722,13 @@ function Qn(s) {
5722
5722
  s
5723
5723
  );
5724
5724
  }, e.onopen = () => {
5725
- s.wsLastMessageReceived = ae(), s.wsconnecting = !1, s.wsconnected = !0, s.wsUnsuccessfulReconnects = 0, s.emit("status", [
5725
+ s.wsLastMessageReceived = le(), s.wsconnecting = !1, s.wsconnected = !0, s.wsUnsuccessfulReconnects = 0, s.emit("status", [
5726
5726
  {
5727
5727
  status: "connected"
5728
5728
  }
5729
5729
  ]);
5730
5730
  const t = L();
5731
- if (p(t, ie), qt(t, s.doc), e.send(_(t)), s.awareness.getLocalState() !== null) {
5731
+ if (p(t, re), qt(t, s.doc), e.send(_(t)), s.awareness.getLocalState() !== null) {
5732
5732
  const n = L();
5733
5733
  p(n, ye), S(
5734
5734
  n,
@@ -5794,7 +5794,7 @@ var lc = class extends mt {
5794
5794
  setInterval(() => {
5795
5795
  if (this.ws && this.ws.readyState === WebSocket.OPEN) {
5796
5796
  const d = L();
5797
- p(d, ie), qt(d, n), this.ws.send(_(d));
5797
+ p(d, re), qt(d, n), this.ws.send(_(d));
5798
5798
  }
5799
5799
  }, a)), this._bcSubscriber = (d, f) => {
5800
5800
  if (f !== this) {
@@ -5804,7 +5804,7 @@ var lc = class extends mt {
5804
5804
  }, this._updateHandler = (d, f) => {
5805
5805
  if (f !== this) {
5806
5806
  const g = L();
5807
- p(g, ie), Qo(g, d), Mt(this, _(g));
5807
+ p(g, re), Qo(g, d), Mt(this, _(g));
5808
5808
  }
5809
5809
  }, this.doc.on("update", this._updateHandler), this._awarenessUpdateHandler = ({ added: d, updated: f, removed: g }, m) => {
5810
5810
  const j = d.concat(f).concat(g), Ie = L();
@@ -5820,7 +5820,7 @@ var lc = class extends mt {
5820
5820
  );
5821
5821
  }, typeof window < "u" ? window.addEventListener("unload", this._unloadHandler) : typeof process < "u" && process.on("exit", this._unloadHandler), r.on("update", this._awarenessUpdateHandler), this._checkInterval = /** @type {any} */
5822
5822
  setInterval(() => {
5823
- this.wsconnected && $s < ae() - this.wsLastMessageReceived && (cc(this.ws !== null, "ws must not be null"), this.ws.close());
5823
+ this.wsconnected && $s < le() - this.wsLastMessageReceived && (cc(this.ws !== null, "ws must not be null"), this.ws.close());
5824
5824
  }, $s / 10), i && this.connect();
5825
5825
  }
5826
5826
  /**
@@ -5840,9 +5840,9 @@ var lc = class extends mt {
5840
5840
  return;
5841
5841
  this.bcconnected || (kr(this.bcChannel, this._bcSubscriber), this.bcconnected = !0);
5842
5842
  const e = L();
5843
- p(e, ie), qt(e, this.doc), me(this.bcChannel, _(e), this);
5843
+ p(e, re), qt(e, this.doc), me(this.bcChannel, _(e), this);
5844
5844
  const t = L();
5845
- p(t, ie), Xn(t, this.doc), me(this.bcChannel, _(t), this);
5845
+ p(t, re), Xn(t, this.doc), me(this.bcChannel, _(t), this);
5846
5846
  const n = L();
5847
5847
  p(n, Wn), me(
5848
5848
  this.bcChannel,
@@ -9119,17 +9119,17 @@ class Tc {
9119
9119
  u(M, this.getEventHandlerData());
9120
9120
  }), d && (e.addEventListener("touchstart", (M) => {
9121
9121
  M.preventDefault(), f && f(M, this.getEventHandlerData());
9122
- const Le = (ne) => {
9123
- ne.preventDefault(), d(ne, this.getEventHandlerData());
9124
- }, je = (ne) => {
9122
+ const Le = (ie) => {
9123
+ ie.preventDefault(), d(ie, this.getEventHandlerData());
9124
+ }, je = (ie) => {
9125
9125
  document.removeEventListener("touchmove", Le), document.removeEventListener("touchend", je);
9126
9126
  };
9127
9127
  document.addEventListener("touchmove", Le), document.addEventListener("touchend", je);
9128
9128
  }), e.addEventListener("mousedown", (M) => {
9129
9129
  f && f(M, this.getEventHandlerData());
9130
- const Le = (ne) => {
9131
- ne.preventDefault(), d(ne, this.getEventHandlerData());
9132
- }, je = (ne) => {
9130
+ const Le = (ie) => {
9131
+ ie.preventDefault(), d(ie, this.getEventHandlerData());
9132
+ }, je = (ie) => {
9133
9133
  document.removeEventListener("mousemove", Le), document.removeEventListener("mouseup", je);
9134
9134
  };
9135
9135
  document.addEventListener("mousemove", Le), document.addEventListener("mouseup", je);
@@ -9225,10 +9225,10 @@ class Tc {
9225
9225
  }
9226
9226
  }
9227
9227
  const Oc = "playhtml.spencerc99.partykit.dev", zt = new xe(), Rc = window.location.href;
9228
- let fe, B, Z;
9228
+ let se, B, Z;
9229
9229
  const Ys = /* @__PURE__ */ new Map();
9230
9230
  let Yt = !0;
9231
- function Nc({
9231
+ function ci({
9232
9232
  room: s = Rc,
9233
9233
  host: e = Oc
9234
9234
  } = {}) {
@@ -9244,41 +9244,46 @@ function Nc({
9244
9244
  ࿂࿂࿂࿂ https://playhtml.fun ࿂࿂࿂࿂
9245
9245
  ࿂࿂࿂࿂ ࿂ ࿂ ࿂ ࿂ ࿂࿂࿂࿂
9246
9246
  ࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂`
9247
- ), fe = new hc(t, s, zt), B = zt.getMap("playhtml-global"), Z = /* @__PURE__ */ new Map(), new Cc(s, zt), Jt.globalData = B, Jt.elementHandlers = Z, fe.on("sync", (n) => {
9248
- n || console.error("Issue connecting to yjs..."), ai();
9247
+ ), se = new hc(t, s, zt), B = zt.getMap("playhtml-global"), Z = /* @__PURE__ */ new Map(), new Cc(s, zt), Jt.globalData = B, Jt.elementHandlers = Z, se.on("sync", (n) => {
9248
+ n || console.error("Issue connecting to yjs..."), Vc();
9249
9249
  });
9250
9250
  }
9251
- function Bc(s, e) {
9252
- const t = fe.awareness.getLocalState();
9251
+ setTimeout(() => {
9252
+ se || (console.log(
9253
+ "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."
9254
+ ), ci());
9255
+ }, 3e3);
9256
+ function Nc(s, e) {
9257
+ const t = se.awareness.getLocalState();
9253
9258
  return ((t == null ? void 0 : t[s]) ?? {})[e];
9254
9259
  }
9255
9260
  function bs(s) {
9256
9261
  return s instanceof HTMLElement;
9257
9262
  }
9258
- function Fc(s, e, t, n) {
9263
+ function Bc(s, e, t, n) {
9259
9264
  const i = B.get(e), r = {
9260
9265
  ...t,
9261
9266
  data: i.get(n) ?? t.defaultData,
9262
- awareness: Bc(e, n) ?? t.myDefaultAwareness !== void 0 ? [t.myDefaultAwareness] : void 0,
9267
+ awareness: Nc(e, n) ?? t.myDefaultAwareness !== void 0 ? [t.myDefaultAwareness] : void 0,
9263
9268
  element: s,
9264
9269
  onChange: (o) => {
9265
9270
  i.get(n) !== o && i.set(n, o);
9266
9271
  },
9267
9272
  onAwarenessChange: (o) => {
9268
9273
  var a;
9269
- const c = ((a = fe.awareness.getLocalState()) == null ? void 0 : a[e]) || {};
9270
- c[n] !== o && (c[n] = o, fe.awareness.setLocalStateField(e, c));
9274
+ const c = ((a = se.awareness.getLocalState()) == null ? void 0 : a[e]) || {};
9275
+ c[n] !== o && (c[n] = o, se.awareness.setLocalStateField(e, c));
9271
9276
  },
9272
9277
  triggerAwarenessUpdate: () => {
9273
- ci();
9278
+ ai();
9274
9279
  }
9275
9280
  };
9276
9281
  return new Tc(r);
9277
9282
  }
9278
- function Hc(s) {
9283
+ function Fc(s) {
9279
9284
  return s.defaultData !== void 0 && s.updateElement !== void 0;
9280
9285
  }
9281
- function Vc(s, e) {
9286
+ function Hc(s, e) {
9282
9287
  if (s === D.CanPlay) {
9283
9288
  const t = e;
9284
9289
  return {
@@ -9297,14 +9302,14 @@ function Vc(s, e) {
9297
9302
  }
9298
9303
  return oi[s];
9299
9304
  }
9300
- function ci() {
9305
+ function ai() {
9301
9306
  const s = /* @__PURE__ */ new Map();
9302
9307
  function e(t, n, i, r) {
9303
9308
  s.has(t) || s.set(t, /* @__PURE__ */ new Map());
9304
9309
  const o = s.get(t);
9305
9310
  o.has(n) || o.set(n, /* @__PURE__ */ new Map()), o.get(n).set(i, r);
9306
9311
  }
9307
- fe.awareness.getStates().forEach((t, n) => {
9312
+ se.awareness.getStates().forEach((t, n) => {
9308
9313
  var i;
9309
9314
  for (const [r, o] of Object.entries(t)) {
9310
9315
  const c = Z.get(r);
@@ -9334,7 +9339,7 @@ function ci() {
9334
9339
  }
9335
9340
  });
9336
9341
  }
9337
- function ai() {
9342
+ function Vc() {
9338
9343
  console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝");
9339
9344
  for (const s of Object.values(D)) {
9340
9345
  const e = Array.from(
@@ -9350,11 +9355,10 @@ function ai() {
9350
9355
  s.changes.keys.forEach((e, t) => {
9351
9356
  e.action === "add" && B.set(t, B.get(t));
9352
9357
  });
9353
- }), fe.awareness.on("change", () => ci()), Yt = !1);
9358
+ }), se.awareness.on("change", () => ai()), Yt = !1);
9354
9359
  }
9355
9360
  const Jt = {
9356
- init: Nc,
9357
- setupElements: ai,
9361
+ init: ci,
9358
9362
  setupPlayElement: Kc,
9359
9363
  globalData: void 0,
9360
9364
  elementHandlers: void 0
@@ -9363,7 +9367,7 @@ window.playhtml = Jt;
9363
9367
  function $c(s) {
9364
9368
  if (Z.has(s))
9365
9369
  return;
9366
- Z.set(s, /* @__PURE__ */ new Map()), s !== D.CanPlay && oi[s], B.get(s) || B.set(s, new he());
9370
+ Z.set(s, /* @__PURE__ */ new Map()), s !== D.CanPlay && oi[s], B.get(s) || B.set(s, new ue());
9367
9371
  const e = B.get(s);
9368
9372
  e.observe((t) => {
9369
9373
  t.changes.keys.forEach((n, i) => {
@@ -9424,17 +9428,17 @@ function ws(s, e) {
9424
9428
  const n = Z.get(e);
9425
9429
  if (n.has(t))
9426
9430
  return;
9427
- const i = Vc(
9431
+ const i = Hc(
9428
9432
  e,
9429
9433
  s
9430
9434
  );
9431
- if (!Hc(i)) {
9435
+ if (!Fc(i)) {
9432
9436
  console.error(
9433
9437
  `Element ${t} does not have proper info to initial a playhtml element. Please refer to https://github.com/spencerc99/playhtml#can-play for troubleshooting help.`
9434
9438
  );
9435
9439
  return;
9436
9440
  }
9437
- const r = B.get(e), o = Fc(
9441
+ const r = B.get(e), o = Bc(
9438
9442
  s,
9439
9443
  e,
9440
9444
  i,
@@ -9451,9 +9455,8 @@ function Kc(s) {
9451
9455
  s.hasAttribute(e) && ws(s, e);
9452
9456
  }
9453
9457
  export {
9454
- Nc as initPlayHTML,
9458
+ ci as initPlayHTML,
9455
9459
  Jt as playhtml,
9456
- ai as setupElements,
9457
9460
  Kc as setupPlayElement,
9458
9461
  ws as setupPlayElementForTag
9459
9462
  };