playhtml 2.0.13 → 2.0.14

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.
@@ -1,27 +1,27 @@
1
1
  var gr = Object.defineProperty;
2
2
  var pr = (n, t, e) => t in n ? gr(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var y = (n, t, e) => (pr(n, typeof t != "symbol" ? t + "" : t, e), e), Dn = (n, t, e) => {
3
+ var y = (n, t, e) => (pr(n, typeof t != "symbol" ? t + "" : t, e), e), Sn = (n, t, e) => {
4
4
  if (!t.has(n))
5
5
  throw TypeError("Cannot " + e);
6
6
  };
7
- var Wt = (n, t, e) => (Dn(n, t, "read from private field"), e ? e.call(n) : t.get(n)), En = (n, t, e) => {
7
+ var Wt = (n, t, e) => (Sn(n, t, "read from private field"), e ? e.call(n) : t.get(n)), Dn = (n, t, e) => {
8
8
  if (t.has(n))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  t instanceof WeakSet ? t.add(n) : t.set(n, e);
11
- }, Cn = (n, t, e, s) => (Dn(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e);
12
- var Gt = 1e6, wr = "y-pk-batch", An = !1, mr = (n, t) => {
11
+ }, En = (n, t, e, s) => (Sn(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e);
12
+ var Gt = 1e6, wr = "y-pk-batch", Cn = !1, mr = (n, t) => {
13
13
  if (n.byteLength <= Gt) {
14
14
  t(n);
15
15
  return;
16
16
  }
17
- An || (console.warn(
17
+ Cn || (console.warn(
18
18
  "[y-partykit]",
19
19
  "The Y.js update size exceeds 1MB, which is the maximum size for an individual update. The update will be split into chunks. This is an experimental feature.",
20
20
  `Message size: ${(n.byteLength / 1e3 / 1e3).toFixed(1)}MB`
21
- ), An = !0);
21
+ ), Cn = !0);
22
22
  const e = (Date.now() + Math.random()).toString(36).substring(10), s = Math.ceil(n.byteLength / Gt);
23
23
  t(
24
- Ln({
24
+ An({
25
25
  id: e,
26
26
  type: "start",
27
27
  size: n.byteLength,
@@ -34,7 +34,7 @@ var Gt = 1e6, wr = "y-pk-batch", An = !1, mr = (n, t) => {
34
34
  t(l), i += 1, r += l.byteLength;
35
35
  }
36
36
  t(
37
- Ln({
37
+ An({
38
38
  id: e,
39
39
  type: "end",
40
40
  size: r,
@@ -42,11 +42,11 @@ var Gt = 1e6, wr = "y-pk-batch", An = !1, mr = (n, t) => {
42
42
  })
43
43
  );
44
44
  };
45
- function Ln(n) {
45
+ function An(n) {
46
46
  return `${wr}#${JSON.stringify(n)}`;
47
47
  }
48
- const O = () => /* @__PURE__ */ new Map(), Be = (n) => {
49
- const t = O();
48
+ const R = () => /* @__PURE__ */ new Map(), Be = (n) => {
49
+ const t = R();
50
50
  return n.forEach((e, s) => {
51
51
  t.set(s, e);
52
52
  }), t;
@@ -69,7 +69,7 @@ const O = () => /* @__PURE__ */ new Map(), Be = (n) => {
69
69
  }, tt = Array.from, _r = Array.isArray;
70
70
  class fe {
71
71
  constructor() {
72
- this._observers = O();
72
+ this._observers = R();
73
73
  }
74
74
  /**
75
75
  * @param {N} name
@@ -106,13 +106,13 @@ class fe {
106
106
  * @param {Array<any>} args The arguments that are applied to the event listener.
107
107
  */
108
108
  emit(t, e) {
109
- return tt((this._observers.get(t) || O()).values()).forEach((s) => s(...e));
109
+ return tt((this._observers.get(t) || R()).values()).forEach((s) => s(...e));
110
110
  }
111
111
  destroy() {
112
- this._observers = O();
112
+ this._observers = R();
113
113
  }
114
114
  }
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) => {
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) => {
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} */
@@ -124,7 +124,7 @@ const Y = Math.floor, te = Math.abs, Pe = (n, t) => n < t ? n : t, ft = (n, t) =
124
124
  ), Mr = (n) => Tt.encode(n), vr = Tt ? Mr : Ir;
125
125
  let vt = typeof TextDecoder > "u" ? null : new TextDecoder("utf-8", { fatal: !0, ignoreBOM: !0 });
126
126
  vt && vt.decode(new Uint8Array()).length === 1 && (vt = null);
127
- const Mn = (n) => n === void 0 ? null : n;
127
+ const In = (n) => n === void 0 ? null : n;
128
128
  class xr {
129
129
  constructor() {
130
130
  this.map = /* @__PURE__ */ new Map();
@@ -143,16 +143,16 @@ class xr {
143
143
  return this.map.get(t);
144
144
  }
145
145
  }
146
- let ns = new xr(), qe = !0;
146
+ let es = new xr(), Pe = !0;
147
147
  try {
148
- typeof localStorage < "u" && (ns = localStorage, qe = !1);
148
+ typeof localStorage < "u" && (es = localStorage, Pe = !1);
149
149
  } catch {
150
150
  }
151
- const ss = ns, Ur = (n) => qe || addEventListener(
151
+ const ns = es, Ur = (n) => Pe || addEventListener(
152
152
  "storage",
153
153
  /** @type {any} */
154
154
  n
155
- ), Tr = (n) => qe || removeEventListener(
155
+ ), Tr = (n) => Pe || removeEventListener(
156
156
  "storage",
157
157
  /** @type {any} */
158
158
  n
@@ -173,12 +173,12 @@ const ss = ns, Ur = (n) => qe || addEventListener(
173
173
  if (!t(n[e], e))
174
174
  return !1;
175
175
  return !0;
176
- }, rs = (n, t) => Object.prototype.hasOwnProperty.call(n, t), Hr = (n, t) => n === t || re(n) === re(t) && Vr(n, (e, s) => (e !== void 0 || rs(t, s)) && t[s] === e), Ze = (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), qe = (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 && Ze(n, t, e + 1);
181
+ e < n.length && qe(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)
@@ -218,7 +218,7 @@ const ss = ns, Ur = (n) => qe || addEventListener(
218
218
  if (re(n) !== re(t))
219
219
  return !1;
220
220
  for (const e in n)
221
- if (!rs(n, e) || !xt(n[e], t[e]))
221
+ if (!ss(n, e) || !xt(n[e], t[e]))
222
222
  return !1;
223
223
  break;
224
224
  case Array:
@@ -232,34 +232,34 @@ const ss = ns, Ur = (n) => qe || addEventListener(
232
232
  return !1;
233
233
  }
234
234
  return !0;
235
- }, Kr = (n, t) => t.includes(n), _t = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name), is = typeof window < "u" && typeof document < "u" && !_t;
236
- let R;
235
+ }, Kr = (n, t) => t.includes(n), _t = typeof process < "u" && process.release && /node|io\.js/.test(process.release.name), rs = typeof window < "u" && typeof document < "u" && !_t;
236
+ let B;
237
237
  const zr = () => {
238
- if (R === void 0)
238
+ if (B === void 0)
239
239
  if (_t) {
240
- R = O();
240
+ B = R();
241
241
  const n = process.argv;
242
242
  let t = null;
243
243
  for (let e = 0; e < n.length; e++) {
244
244
  const s = n[e];
245
- s[0] === "-" ? (t !== null && R.set(t, ""), t = s) : t !== null && (R.set(t, s), t = null);
245
+ s[0] === "-" ? (t !== null && B.set(t, ""), t = s) : t !== null && (B.set(t, s), t = null);
246
246
  }
247
- t !== null && R.set(t, "");
247
+ t !== null && B.set(t, "");
248
248
  } else
249
- typeof location == "object" ? (R = O(), (location.search || "?").slice(1).split("&").forEach((n) => {
249
+ typeof location == "object" ? (B = R(), (location.search || "?").slice(1).split("&").forEach((n) => {
250
250
  if (n.length !== 0) {
251
251
  const [t, e] = n.split("=");
252
- R.set(`--${In(t, "-")}`, e), R.set(`-${In(t, "-")}`, e);
252
+ B.set(`--${Ln(t, "-")}`, e), B.set(`-${Ln(t, "-")}`, e);
253
253
  }
254
- })) : R = O();
255
- return R;
256
- }, Ne = (n) => zr().has(n), Fe = (n) => Mn(_t ? process.env[n.toUpperCase()] : ss.getItem(n)), Yr = (n) => Ne("--" + n) || Fe(n) !== null;
254
+ })) : B = R();
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;
257
257
  Yr("production");
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 = () => {
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 = () => {
259
259
  throw X("Method unimplemented");
260
260
  }, V = () => {
261
261
  throw X("Unexpected case");
262
- }, ls = X("Unexpected end of array"), cs = X("Integer out of Range");
262
+ }, os = X("Unexpected end of array"), ls = X("Integer out of Range");
263
263
  class pe {
264
264
  /**
265
265
  * @param {Uint8Array} uint8Array Binary data to decode
@@ -269,7 +269,7 @@ 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 = en(n.arr.buffer, n.pos + n.arr.byteOffset, t);
272
+ const e = tn(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;
@@ -278,11 +278,11 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) =>
278
278
  const r = n.arr[n.pos++];
279
279
  if (t = t + (r & it) * e, e *= 128, r < x)
280
280
  return t;
281
- if (t > os)
282
- throw cs;
281
+ if (t > is)
282
+ throw ls;
283
283
  }
284
- throw ls;
285
- }, Qe = (n) => {
284
+ throw os;
285
+ }, Ze = (n) => {
286
286
  let t = n.arr[n.pos++], e = t & Ve, s = 64;
287
287
  const r = (t & z) > 0 ? -1 : 1;
288
288
  if (!(t & x))
@@ -291,10 +291,10 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) =>
291
291
  for (; n.pos < i; ) {
292
292
  if (t = n.arr[n.pos++], e = e + (t & it) * s, s *= 128, t < x)
293
293
  return r * e;
294
- if (e > os)
295
- throw cs;
294
+ if (e > is)
295
+ throw ls;
296
296
  }
297
- throw ls;
297
+ throw os;
298
298
  }, qr = (n) => {
299
299
  let t = m(n);
300
300
  if (t === 0)
@@ -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, tn = (n, t) => {
321
+ ), Z = vt ? Zr : qr, Qe = (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) => tn(n, 4).getFloat32(0, !1), ti = (n) => tn(n, 8).getFloat64(0, !1), ei = (n) => (
324
+ }, Qr = (n) => Qe(n, 4).getFloat32(0, !1), ti = (n) => Qe(n, 8).getFloat64(0, !1), ei = (n) => (
325
325
  /** @type {any} */
326
- tn(n, 8).getBigInt64(0, !1)
326
+ Qe(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
- Qe,
333
+ Ze,
334
334
  // CASE 125: integer
335
335
  Qr,
336
336
  // CASE 124: float32
@@ -361,7 +361,7 @@ const nt = (n) => new pe(n), Gr = (n) => n.pos !== n.arr.length, Pr = (n, t) =>
361
361
  M
362
362
  // CASE 116: Uint8Array
363
363
  ], Rt = (n) => ni[127 - St(n)](n);
364
- class Tn extends pe {
364
+ class Un extends pe {
365
365
  /**
366
366
  * @param {Uint8Array} uint8Array
367
367
  * @param {function(Decoder):T} reader
@@ -383,8 +383,8 @@ class ee extends pe {
383
383
  }
384
384
  read() {
385
385
  if (this.count === 0) {
386
- this.s = Qe(this);
387
- const t = es(this.s);
386
+ this.s = Ze(this);
387
+ const t = ts(this.s);
388
388
  this.count = 1, t && (this.s = -this.s, this.count = m(this) + 2);
389
389
  }
390
390
  return this.count--, /** @type {number} */
@@ -403,7 +403,7 @@ class Ae extends pe {
403
403
  */
404
404
  read() {
405
405
  if (this.count === 0) {
406
- const t = Qe(this), e = t & 1;
406
+ const t = Ze(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,21 +424,21 @@ class si {
424
424
  return this.spos = t, e;
425
425
  }
426
426
  }
427
- const as = (n) => new Uint8Array(n), en = (n, t, e) => new Uint8Array(n, t, e), ri = (n) => new Uint8Array(n), ii = (n) => {
427
+ const cs = (n) => new Uint8Array(n), tn = (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]);
431
431
  return btoa(t);
432
432
  }, oi = (n) => Buffer.from(n.buffer, n.byteOffset, n.byteLength).toString("base64"), li = (n) => {
433
- const t = atob(n), e = as(t.length);
433
+ const t = atob(n), e = cs(t.length);
434
434
  for (let s = 0; s < t.length; s++)
435
435
  e[s] = t.charCodeAt(s);
436
436
  return e;
437
437
  }, ci = (n) => {
438
438
  const t = Buffer.from(n, "base64");
439
439
  return new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
440
- }, ai = is ? ii : oi, hi = is ? li : ci, ui = (n) => {
441
- const t = as(n.byteLength);
440
+ }, ai = rs ? ii : oi, hi = rs ? li : ci, ui = (n) => {
441
+ const t = cs(n.byteLength);
442
442
  return t.set(n), t;
443
443
  };
444
444
  class $t {
@@ -446,22 +446,22 @@ class $t {
446
446
  this.cpos = 0, this.cbuf = new Uint8Array(100), this.bufs = [];
447
447
  }
448
448
  }
449
- const v = () => new $t(), nn = (n) => {
449
+ const v = () => new $t(), en = (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(nn(n));
455
+ const t = new Uint8Array(en(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(en(n.cbuf.buffer, 0, n.cpos), e), t;
461
+ return t.set(tn(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(en(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(tn(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;
@@ -469,8 +469,8 @@ const v = () => new $t(), nn = (n) => {
469
469
  for (; t > it; )
470
470
  A(n, x | it & t), t = Y(t / 128);
471
471
  A(n, it & t);
472
- }, sn = (n, t) => {
473
- const e = es(t);
472
+ }, nn = (n, t) => {
473
+ const e = ts(t);
474
474
  for (e && (t = -t), A(n, (t > Ve ? x : 0) | (e ? z : 0) | Ve & t), t = Y(t / 64); t > 0; )
475
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) => {
@@ -492,24 +492,24 @@ const v = () => new $t(), nn = (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 = Pe(e - s, t.length), i = t.length - r;
495
+ const e = n.cbuf.length, s = n.cpos, r = Ge(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
- }, rn = (n, t) => {
499
+ }, sn = (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) => rn(n, 4).setFloat32(0, t, !1), mi = (n, t) => rn(n, 8).setFloat64(0, t, !1), yi = (n, t) => (
503
+ }, wi = (n, t) => sn(n, 4).setFloat32(0, t, !1), mi = (n, t) => sn(n, 8).setFloat64(0, t, !1), yi = (n, t) => (
504
504
  /** @type {any} */
505
- rn(n, 8).setBigInt64(0, t, !1)
506
- ), On = new DataView(new ArrayBuffer(4)), bi = (n) => (On.setFloat32(0, n), On.getFloat32(0) === n), Bt = (n, t) => {
505
+ sn(n, 8).setBigInt64(0, t, !1)
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), sn(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), nn(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);
@@ -540,7 +540,7 @@ Tt.encodeInto ? gi : pi, we = (n, t) => {
540
540
  A(n, 127);
541
541
  }
542
542
  };
543
- class Rn extends $t {
543
+ class On extends $t {
544
544
  /**
545
545
  * @param {function(Encoder, T):void} writer
546
546
  */
@@ -554,8 +554,8 @@ class Rn extends $t {
554
554
  this.s === t ? this.count++ : (this.count > 0 && p(this, this.count - 1), this.count = 1, this.w(this, t), this.s = t);
555
555
  }
556
556
  }
557
- const Bn = (n) => {
558
- n.count > 0 && (sn(n.encoder, n.count === 1 ? n.s : -n.s), n.count > 1 && p(n.encoder, n.count - 2));
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));
559
559
  };
560
560
  class ne {
561
561
  constructor() {
@@ -565,16 +565,16 @@ class ne {
565
565
  * @param {number} v
566
566
  */
567
567
  write(t) {
568
- this.s === t ? this.count++ : (Bn(this), this.count = 1, this.s = t);
568
+ this.s === t ? this.count++ : (Rn(this), this.count = 1, this.s = t);
569
569
  }
570
570
  toUint8Array() {
571
- return Bn(this), _(this.encoder);
571
+ return Rn(this), _(this.encoder);
572
572
  }
573
573
  }
574
- const Nn = (n) => {
574
+ const Bn = (n) => {
575
575
  if (n.count > 0) {
576
576
  const t = n.diff * 2 + (n.count === 1 ? 0 : 1);
577
- sn(n.encoder, t), n.count > 1 && p(n.encoder, n.count - 2);
577
+ nn(n.encoder, t), n.count > 1 && p(n.encoder, n.count - 2);
578
578
  }
579
579
  };
580
580
  class Le {
@@ -585,10 +585,10 @@ class Le {
585
585
  * @param {number} v
586
586
  */
587
587
  write(t) {
588
- this.diff === t - this.s ? (this.s = t, this.count++) : (Nn(this), this.count = 1, this.diff = t - this.s, this.s = t);
588
+ this.diff === t - this.s ? (this.s = t, this.count++) : (Bn(this), this.count = 1, this.diff = t - this.s, this.s = t);
589
589
  }
590
590
  toUint8Array() {
591
- return Nn(this), _(this.encoder);
591
+ return Bn(this), _(this.encoder);
592
592
  }
593
593
  }
594
594
  class ki {
@@ -606,10 +606,10 @@ class ki {
606
606
  return this.sarr.push(this.s), this.s = "", ot(t, this.sarr.join("")), we(t, this.lensE.toUint8Array()), _(t);
607
607
  }
608
608
  }
609
- const _i = crypto.getRandomValues.bind(crypto), hs = () => _i(new Uint32Array(1))[0], Si = [1e7] + -1e3 + -4e3 + -8e3 + -1e11, Di = () => Si.replace(
609
+ const _i = crypto.getRandomValues.bind(crypto), as = () => _i(new Uint32Array(1))[0], Si = [1e7] + -1e3 + -4e3 + -8e3 + -1e11, Di = () => Si.replace(
610
610
  /[018]/g,
611
611
  /** @param {number} c */
612
- (n) => (n ^ hs() & 15 >> n / 4).toString(16)
612
+ (n) => (n ^ as() & 15 >> n / 4).toString(16)
613
613
  ), ct = Date.now, Dt = (n) => (
614
614
  /** @type {Promise<T>} */
615
615
  new Promise(n)
@@ -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(""), W = Symbol, us = W(), ds = W(), Ai = W(), Li = W(), Ii = W(), fs = W(), Mi = W(), gs = W(), vi = W(), xi = (n) => {
629
+ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol, hs = W(), us = W(), Ai = W(), Li = W(), Ii = W(), ds = W(), Mi = W(), fs = W(), vi = W(), xi = (n) => {
630
630
  const t = [];
631
631
  let e = 0;
632
632
  for (; e < n.length; e++) {
@@ -635,18 +635,18 @@ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol, us = W(),
635
635
  }
636
636
  return t;
637
637
  }, Ui = {
638
- [us]: K("font-weight", "bold"),
639
- [ds]: K("font-weight", "normal"),
638
+ [hs]: K("font-weight", "bold"),
639
+ [us]: K("font-weight", "normal"),
640
640
  [Ai]: K("color", "blue"),
641
641
  [Ii]: K("color", "green"),
642
642
  [Li]: K("color", "grey"),
643
- [fs]: K("color", "red"),
643
+ [ds]: K("color", "red"),
644
644
  [Mi]: K("color", "purple"),
645
- [gs]: K("color", "orange"),
645
+ [fs]: K("color", "orange"),
646
646
  // not well supported in chrome when debugging node with inspector - TODO: deprecate
647
647
  [vi]: K("color", "black")
648
648
  }, Ti = (n) => {
649
- const t = [], e = [], s = O();
649
+ const t = [], e = [], s = R();
650
650
  let r = [], i = 0;
651
651
  for (; i < n.length; i++) {
652
652
  const o = n[i], l = Ui[o];
@@ -665,7 +665,7 @@ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol, us = W(),
665
665
  return r;
666
666
  }, Oi = Xr ? Ti : xi, Ri = (...n) => {
667
667
  console.log(...Oi(n)), Bi.forEach((t) => t.print(n));
668
- }, Bi = lt(), ps = (n) => ({
668
+ }, Bi = lt(), gs = (n) => ({
669
669
  /**
670
670
  * @return {IterableIterator<T>}
671
671
  */
@@ -674,17 +674,17 @@ const Ci = (n) => yr(n, (t, e) => `${e}:${t};`).join(""), W = Symbol, us = W(),
674
674
  },
675
675
  // @ts-ignore
676
676
  next: n
677
- }), Ni = (n, t) => ps(() => {
677
+ }), Ni = (n, t) => gs(() => {
678
678
  let e;
679
679
  do
680
680
  e = n.next();
681
681
  while (!e.done && !t(e.value));
682
682
  return e;
683
- }), Ie = (n, t) => ps(() => {
683
+ }), Ie = (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 on {
687
+ class rn {
688
688
  /**
689
689
  * @param {number} clock
690
690
  * @param {number} len
@@ -698,14 +698,14 @@ class jt {
698
698
  this.clients = /* @__PURE__ */ new Map();
699
699
  }
700
700
  }
701
- const ws = (n, t, e) => t.clients.forEach((s, r) => {
701
+ const ps = (n, t, e) => t.clients.forEach((s, r) => {
702
702
  const i = (
703
703
  /** @type {Array<GC|Item>} */
704
704
  n.doc.store.clients.get(r)
705
705
  );
706
706
  for (let o = 0; o < s.length; o++) {
707
707
  const l = s[o];
708
- vs(n, i, l.clock, l.len, e);
708
+ Ms(n, i, l.clock, l.len, e);
709
709
  }
710
710
  }), Fi = (n, t) => {
711
711
  let e = 0, s = n.length - 1;
@@ -719,10 +719,10 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
719
719
  s = r - 1;
720
720
  }
721
721
  return null;
722
- }, ms = (n, t) => {
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
- }, ln = (n) => {
725
+ }, on = (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 ws = (n, t, e) => t.clients.forEach((s, r) => {
743
743
  t.clients.set(r, i);
744
744
  }
745
745
  });
746
- return ln(t), t;
746
+ return on(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 on(e, s));
751
+ )).push(new rn(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 ws = (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 on(l, c));
764
+ r.push(new rn(l, c));
765
765
  }
766
766
  }
767
767
  r.length > 0 && t.clients.set(s, r);
@@ -776,7 +776,7 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
776
776
  n.writeDsClock(o.clock), n.writeDsLen(o.len);
777
777
  }
778
778
  });
779
- }, cn = (n) => {
779
+ }, ln = (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,11 +787,11 @@ const ws = (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 on(n.readDsClock(), n.readDsLen()));
790
+ o.push(new rn(n.readDsClock(), n.readDsLen()));
791
791
  }
792
792
  }
793
793
  return t;
794
- }, Fn = (n, t, e) => {
794
+ }, Nn = (n, t, e) => {
795
795
  const s = new jt(), r = m(n.restDecoder);
796
796
  for (let i = 0; i < r; i++) {
797
797
  n.resetDsCurVal();
@@ -812,13 +812,13 @@ const ws = (n, t, e) => t.clients.forEach((s, r) => {
812
812
  return p(i.restEncoder, 0), At(i, s), i.toUint8Array();
813
813
  }
814
814
  return null;
815
- }, ys = hs;
815
+ }, ms = as;
816
816
  class gt extends fe {
817
817
  /**
818
818
  * @param {DocOpts} opts configuration
819
819
  */
820
820
  constructor({ guid: t = Di(), collectionid: e = null, gc: s = !0, gcFilter: r = () => !0, meta: i = null, autoLoad: o = !1, shouldLoad: l = !0 } = {}) {
821
- super(), this.gc = s, this.gcFilter = r, this.clientID = ys(), this.guid = t, this.collectionid = e, this.share = /* @__PURE__ */ new Map(), this.store = new Is(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = l, this.autoLoad = o, this.meta = i, this.isLoaded = !1, this.isSynced = !1, this.whenLoaded = Dt((a) => {
821
+ super(), this.gc = s, this.gcFilter = r, this.clientID = ms(), this.guid = t, this.collectionid = e, this.share = /* @__PURE__ */ new Map(), this.store = new Ls(), this._transaction = null, this._transactionCleanups = [], this.subdocs = /* @__PURE__ */ new Set(), this._item = null, this.shouldLoad = l, this.autoLoad = o, this.meta = i, this.isLoaded = !1, this.isSynced = !1, this.whenLoaded = Dt((a) => {
822
822
  this.on("load", () => {
823
823
  this.isLoaded = !0, a(this);
824
824
  });
@@ -1014,7 +1014,7 @@ class gt extends fe {
1014
1014
  super.off(t, e);
1015
1015
  }
1016
1016
  }
1017
- class bs {
1017
+ class ys {
1018
1018
  /**
1019
1019
  * @param {decoding.Decoder} decoder
1020
1020
  */
@@ -1036,7 +1036,7 @@ class bs {
1036
1036
  return m(this.restDecoder);
1037
1037
  }
1038
1038
  }
1039
- class ks extends bs {
1039
+ class bs extends ys {
1040
1040
  /**
1041
1041
  * @return {ID}
1042
1042
  */
@@ -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 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));
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));
1148
1148
  }
1149
1149
  /**
1150
1150
  * @return {ID}
@@ -1235,7 +1235,7 @@ class Et extends ji {
1235
1235
  }
1236
1236
  }
1237
1237
  }
1238
- class _s {
1238
+ class ks {
1239
1239
  constructor() {
1240
1240
  this.restEncoder = v();
1241
1241
  }
@@ -1257,7 +1257,7 @@ class _s {
1257
1257
  p(this.restEncoder, t);
1258
1258
  }
1259
1259
  }
1260
- class Kt extends _s {
1260
+ class Kt extends ks {
1261
1261
  /**
1262
1262
  * @param {ID} id
1263
1263
  */
@@ -1334,7 +1334,7 @@ class Kt extends _s {
1334
1334
  ot(this.restEncoder, t);
1335
1335
  }
1336
1336
  }
1337
- class Ss {
1337
+ class _s {
1338
1338
  constructor() {
1339
1339
  this.restEncoder = v(), this.dsCurrVal = 0;
1340
1340
  }
@@ -1358,9 +1358,9 @@ class Ss {
1358
1358
  t === 0 && V(), p(this.restEncoder, t - 1), this.dsCurrVal += t;
1359
1359
  }
1360
1360
  }
1361
- class at extends Ss {
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 Rn(He), this.stringEncoder = new ki(), this.parentInfoEncoder = new Rn(He), this.typeRefEncoder = new ne(), this.lenEncoder = new ne();
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();
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
- }, an = (n, t, e) => {
1462
+ }, cn = (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);
@@ -1475,7 +1475,7 @@ const Ki = (n, t, e, s) => {
1475
1475
  );
1476
1476
  });
1477
1477
  }, zi = (n, t) => {
1478
- const e = O(), s = m(n.restDecoder);
1478
+ const e = R(), s = m(n.restDecoder);
1479
1479
  for (let r = 0; r < s; r++) {
1480
1480
  const i = m(n.restDecoder), o = new Array(i), l = n.readClient();
1481
1481
  let c = m(n.restDecoder);
@@ -1508,7 +1508,7 @@ const Ki = (n, t, e, s) => {
1508
1508
  // parent
1509
1509
  d && (h & Ot) === Ot ? n.readString() : null,
1510
1510
  // parentSub
1511
- Gs(n, h)
1511
+ Ws(n, h)
1512
1512
  // item content
1513
1513
  );
1514
1514
  o[a] = u, c += u.length;
@@ -1540,7 +1540,7 @@ const Ki = (n, t, e, s) => {
1540
1540
  let o = i();
1541
1541
  if (o === null && s.length === 0)
1542
1542
  return null;
1543
- const l = new Is(), c = /* @__PURE__ */ new Map(), a = (f, g) => {
1543
+ const l = new Ls(), c = /* @__PURE__ */ new Map(), a = (f, g) => {
1544
1544
  const w = c.get(f);
1545
1545
  (w == null || w > g) && c.set(f, g);
1546
1546
  };
@@ -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 an(f, l, /* @__PURE__ */ new Map()), p(f.restEncoder, 0), { missing: c, update: f.toUint8Array() };
1603
+ return cn(f, l, /* @__PURE__ */ new Map()), p(f.restEncoder, 0), { missing: c, update: f.toUint8Array() };
1604
1604
  }
1605
1605
  return null;
1606
- }, Xi = (n, t) => an(n, t.doc.store, t.beforeState), Ji = (n, t, e, s = new Et(n)) => k(t, (r) => {
1606
+ }, Xi = (n, t) => cn(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;
@@ -1622,11 +1622,11 @@ const Ki = (n, t, e, s) => {
1622
1622
  }
1623
1623
  } else
1624
1624
  l.pendingStructs = a;
1625
- const d = Fn(s, r, l);
1625
+ const d = Nn(s, r, l);
1626
1626
  if (l.pendingDs) {
1627
1627
  const u = new Et(nt(l.pendingDs));
1628
1628
  m(u.restDecoder);
1629
- const f = Fn(u, r, l);
1629
+ const f = Nn(u, r, l);
1630
1630
  d && f ? l.pendingDs = oe([d, f]) : l.pendingDs = d || f;
1631
1631
  } else
1632
1632
  l.pendingDs = d;
@@ -1635,15 +1635,15 @@ const Ki = (n, t, e, s) => {
1635
1635
  /** @type {{update: Uint8Array}} */
1636
1636
  l.pendingStructs.update
1637
1637
  );
1638
- l.pendingStructs = null, Ds(r.doc, u);
1638
+ l.pendingStructs = null, Ss(r.doc, u);
1639
1639
  }
1640
- }, e, !1), Ds = (n, t, e, s = Et) => {
1640
+ }, e, !1), Ss = (n, t, e, s = Et) => {
1641
1641
  const r = nt(t);
1642
1642
  Ji(r, n, e, new s(r));
1643
- }, Es = (n, t, e) => Ds(n, t, e, ks), Wi = (n, t, e = /* @__PURE__ */ new Map()) => {
1644
- an(n, t.store, e), At(n, $i(t.store));
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));
1645
1645
  }, Gi = (n, t = new Uint8Array([0]), e = new at()) => {
1646
- const s = Cs(t);
1646
+ const s = Es(t);
1647
1647
  Wi(e, n, s);
1648
1648
  const r = [e.toUint8Array()];
1649
1649
  if (n.store.pendingDs && r.push(n.store.pendingDs), n.store.pendingStructs && r.push(ho(n.store.pendingStructs.update, t)), r.length > 1) {
@@ -1653,25 +1653,25 @@ const Ki = (n, t, e, s) => {
1653
1653
  return oe(r);
1654
1654
  }
1655
1655
  return r[0];
1656
- }, hn = (n, t) => Gi(n, t, new Kt()), Pi = (n) => {
1656
+ }, an = (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);
1660
1660
  t.set(r, i);
1661
1661
  }
1662
1662
  return t;
1663
- }, Cs = (n) => Pi(new bs(nt(n))), As = (n, t) => (p(n.restEncoder, t.size), tt(t.entries()).sort((e, s) => s[0] - e[0]).forEach(([e, s]) => {
1663
+ }, Es = (n) => Pi(new ys(nt(n))), Cs = (n, t) => (p(n.restEncoder, t.size), tt(t.entries()).sort((e, s) => s[0] - e[0]).forEach(([e, s]) => {
1664
1664
  p(n.restEncoder, e), p(n.restEncoder, s);
1665
- }), n), qi = (n, t) => As(n, me(t.store)), Zi = (n, t = new Ss()) => (n instanceof Map ? As(t, n) : qi(t, n), t.toUint8Array()), Qi = (n) => Zi(n, new _s());
1665
+ }), n), qi = (n, t) => Cs(n, me(t.store)), Zi = (n, t = new _s()) => (n instanceof Map ? Cs(t, n) : qi(t, n), t.toUint8Array()), Qi = (n) => Zi(n, new ks());
1666
1666
  class to {
1667
1667
  constructor() {
1668
1668
  this.l = [];
1669
1669
  }
1670
1670
  }
1671
- const Vn = () => new to(), Hn = (n, t) => n.l.push(t), $n = (n, t) => {
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
- }, Ls = (n, t, e) => Ze(n.l, [t, e]);
1674
+ }, As = (n, t, e) => qe(n.l, [t, e]);
1675
1675
  class yt {
1676
1676
  /**
1677
1677
  * @param {number} client client id
@@ -1686,14 +1686,14 @@ 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 && !ms(t.ds, n.id), je = (n, t) => {
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
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
- }), ws(n, t.ds, (r) => {
1693
+ }), ps(n, t.ds, (r) => {
1694
1694
  }), e.add(t));
1695
1695
  };
1696
- class Is {
1696
+ class Ls {
1697
1697
  constructor() {
1698
1698
  this.clients = /* @__PURE__ */ new Map(), this.pendingStructs = null, this.pendingDs = null;
1699
1699
  }
@@ -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
- }, Ms = (n, t) => {
1713
+ }, Is = (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);
@@ -1750,7 +1750,7 @@ const me = (n) => {
1750
1750
  n.doc.store.clients.get(t.client)
1751
1751
  );
1752
1752
  return e[Ke(n, e, t.clock)];
1753
- }, jn = (n, t, e) => {
1753
+ }, $n = (n, t, e) => {
1754
1754
  const s = t.clients.get(e.client), r = H(s, e.clock), i = s[r];
1755
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;
1756
1756
  }, so = (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
- }, vs = (n, t, e, s, r) => {
1762
+ }, Ms = (n, t, e, s, r) => {
1763
1763
  if (s === 0)
1764
1764
  return;
1765
1765
  const i = e + s;
@@ -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 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) => {
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) => {
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,16 +1820,16 @@ const Kn = (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 = Pe(r.length - 1, 1 + H(r, o.clock + o.len - 1));
1823
+ const o = e[i], l = Ge(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
  }
1827
1827
  });
1828
- }, xs = (n, t) => {
1828
+ }, vs = (n, t) => {
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
- ln(i), e.afterState = me(e.doc.store), s.emit("beforeObserverCalls", [e, s]);
1832
+ on(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(() => {
@@ -1841,9 +1841,9 @@ const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
1841
1841
  (h) => h.target._item === null || !h.target._item.deleted
1842
1842
  ), c.forEach((h) => {
1843
1843
  h.currentTarget = a, h._path = null;
1844
- }), c.sort((h, d) => h.path.length - d.path.length), Ls(a._dEH, c, e));
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])), Ze(l, []), e._needFormattingCleanup && Ao(e);
1846
+ }), l.push(() => s.emit("afterTransaction", [e, s])), qe(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;
@@ -1863,18 +1863,18 @@ const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
1863
1863
  ), g = H(f, u);
1864
1864
  g + 1 < f.length && se(f, g + 1) > 1 || g > 0 && se(f, g);
1865
1865
  }
1866
- if (!e.local && e.afterState.get(s.clientID) !== e.beforeState.get(s.clientID) && (Ri(gs, us, "[yjs] ", ds, fs, "Changed the client-id because another client seems to be using it."), s.clientID = ys()), s.emit("afterTransactionCleanup", [e, s]), s._observers.has("update")) {
1866
+ if (!e.local && e.afterState.get(s.clientID) !== e.beforeState.get(s.clientID) && (Ri(fs, hs, "[yjs] ", us, ds, "Changed the client-id because another client seems to be using it."), s.clientID = ms()), s.emit("afterTransactionCleanup", [e, s]), s._observers.has("update")) {
1867
1867
  const h = new Kt();
1868
- Kn(h, e) && s.emit("update", [h.toUint8Array(), e.origin, s, e]);
1868
+ jn(h, e) && s.emit("update", [h.toUint8Array(), e.origin, s, e]);
1869
1869
  }
1870
1870
  if (s._observers.has("updateV2")) {
1871
1871
  const h = new at();
1872
- Kn(h, e) && s.emit("updateV2", [h.toUint8Array(), e.origin, s, e]);
1872
+ jn(h, e) && s.emit("updateV2", [h.toUint8Array(), e.origin, s, e]);
1873
1873
  }
1874
1874
  const { subdocsAdded: l, subdocsLoaded: c, subdocsRemoved: a } = e;
1875
1875
  (l.size > 0 || a.size > 0 || c.size > 0) && (l.forEach((h) => {
1876
1876
  h.clientID = s.clientID, h.collectionid == null && (h.collectionid = s.collectionid), s.subdocs.add(h);
1877
- }), a.forEach((h) => s.subdocs.delete(h)), s.emit("subdocs", [{ loaded: c, added: l, removed: a }, s, e]), a.forEach((h) => h.destroy())), n.length <= t + 1 ? (s._transactionCleanups = [], s.emit("afterAllTransactions", [s, n])) : xs(n, t + 1);
1877
+ }), a.forEach((h) => s.subdocs.delete(h)), s.emit("subdocs", [{ loaded: c, added: l, removed: a }, s, e]), a.forEach((h) => h.destroy())), n.length <= t + 1 ? (s._transactionCleanups = [], s.emit("afterAllTransactions", [s, n])) : vs(n, t + 1);
1878
1878
  }
1879
1879
  }
1880
1880
  }, k = (n, t, e = null, s = !0) => {
@@ -1886,7 +1886,7 @@ const Kn = (n, t) => t.deleteSet.clients.size === 0 && !br(t.afterState, (e, s)
1886
1886
  } finally {
1887
1887
  if (i) {
1888
1888
  const l = n._transaction === r[0];
1889
- n._transaction = null, l && xs(r, 0);
1889
+ n._transaction = null, l && vs(r, 0);
1890
1890
  }
1891
1891
  }
1892
1892
  return o;
@@ -1917,7 +1917,7 @@ function* lo(n) {
1917
1917
  // parent
1918
1918
  c && (l & Ot) === Ot ? n.readString() : null,
1919
1919
  // parentSub
1920
- Gs(n, l)
1920
+ Ws(n, l)
1921
1921
  // item content
1922
1922
  );
1923
1923
  yield a, i += a.length;
@@ -1928,7 +1928,7 @@ function* lo(n) {
1928
1928
  }
1929
1929
  }
1930
1930
  }
1931
- class un {
1931
+ class hn {
1932
1932
  /**
1933
1933
  * @param {UpdateDecoderV1 | UpdateDecoderV2} decoder
1934
1934
  * @param {boolean} filterSkips
@@ -1946,7 +1946,7 @@ class un {
1946
1946
  return this.curr;
1947
1947
  }
1948
1948
  }
1949
- class dn {
1949
+ class un {
1950
1950
  /**
1951
1951
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
1952
1952
  */
@@ -1954,7 +1954,7 @@ class dn {
1954
1954
  this.currClient = 0, this.startClock = 0, this.written = 0, this.encoder = t, this.clientStructs = [];
1955
1955
  }
1956
1956
  }
1957
- const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
1957
+ const co = (n) => oe(n, bs, Kt), ao = (n, t) => {
1958
1958
  if (n.constructor === U) {
1959
1959
  const { client: e, clock: s } = n.id;
1960
1960
  return new U(b(e, s + t), n.length - t);
@@ -1981,8 +1981,8 @@ const co = (n) => oe(n, ks, 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 un(h, !0)), i = null;
1985
- const o = new e(), l = new dn(o);
1984
+ let r = s.map((h) => new hn(h, !0)), i = null;
1985
+ const o = new e(), l = new un(o);
1986
1986
  for (; r = r.filter((u) => u.curr !== null), r.sort(
1987
1987
  /** @type {function(any,any):number} */
1988
1988
  (u, f) => {
@@ -2033,11 +2033,11 @@ const co = (n) => oe(n, ks, Kt), ao = (n, t) => {
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
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), fn(l);
2037
- const c = s.map((h) => cn(h)), a = Vi(c);
2036
+ i !== null && (P(l, i.struct, i.offset), i = null), dn(l);
2037
+ const c = s.map((h) => ln(h)), a = Vi(c);
2038
2038
  return At(o, a), o.toUint8Array();
2039
2039
  }, ho = (n, t, e = Et, s = at) => {
2040
- const r = Cs(t), i = new s(), o = new dn(i), l = new e(nt(n)), c = new un(l, !1);
2040
+ const r = Es(t), i = new s(), o = new un(i), l = new e(nt(n)), c = new hn(l, !1);
2041
2041
  for (; c.curr; ) {
2042
2042
  const h = c.curr, d = h.id.client, u = r.get(d) || 0;
2043
2043
  if (c.curr.constructor === T) {
@@ -2051,15 +2051,15 @@ const co = (n) => oe(n, ks, 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
- fn(o);
2055
- const a = cn(l);
2054
+ dn(o);
2055
+ const a = ln(l);
2056
2056
  return At(i, a), i.toUint8Array();
2057
- }, Us = (n) => {
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
- 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
- }, fn = (n) => {
2062
- Us(n);
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) => {
2062
+ xs(n);
2063
2063
  const t = n.encoder.restEncoder;
2064
2064
  p(t, n.clientStructs.length);
2065
2065
  for (let e = 0; e < n.clientStructs.length; e++) {
@@ -2067,13 +2067,13 @@ const co = (n) => oe(n, ks, 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 un(r, !1), o = new s(), l = new dn(o);
2070
+ const r = new e(nt(n)), i = new hn(r, !1), o = new s(), l = new un(o);
2071
2071
  for (let a = i.curr; a !== null; a = i.next())
2072
2072
  P(l, t(a), 0);
2073
- fn(l);
2074
- const c = cn(r);
2073
+ dn(l);
2074
+ const c = ln(r);
2075
2075
  return At(o, c), o.toUint8Array();
2076
- }, fo = (n) => uo(n, $r, Et, Kt), Yn = "You must not compute changes after the event-handler fired.";
2076
+ }, fo = (n) => uo(n, $r, Et, Kt), zn = "You must not compute changes after the event-handler fired.";
2077
2077
  class ye {
2078
2078
  /**
2079
2079
  * @param {T} target The changed type.
@@ -2107,7 +2107,7 @@ class ye {
2107
2107
  * @return {boolean}
2108
2108
  */
2109
2109
  deletes(t) {
2110
- return ms(this.transaction.deleteSet, t.id);
2110
+ return ws(this.transaction.deleteSet, t.id);
2111
2111
  }
2112
2112
  /**
2113
2113
  * @type {Map<string, { action: 'add' | 'update' | 'delete', oldValue: any, newValue: any }>}
@@ -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 X(Yn);
2118
+ throw X(zn);
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 X(Yn);
2186
+ throw X(zn);
2187
2187
  const e = this.target, s = lt(), r = lt(), i = [];
2188
2188
  if (t = {
2189
2189
  added: s,
@@ -2226,25 +2226,25 @@ const go = (n, t) => {
2226
2226
  t._item.parent;
2227
2227
  }
2228
2228
  return e;
2229
- }, Ts = 80;
2230
- let gn = 0;
2229
+ }, Us = 80;
2230
+ let fn = 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 = gn++;
2237
+ t.marker = !0, this.p = t, this.index = e, this.timestamp = fn++;
2238
2238
  }
2239
2239
  }
2240
2240
  const wo = (n) => {
2241
- n.timestamp = gn++;
2242
- }, Os = (n, t, e) => {
2243
- n.p.marker = !1, n.p = t, t.marker = !0, n.index = e, n.timestamp = gn++;
2241
+ n.timestamp = fn++;
2242
+ }, Ts = (n, t, e) => {
2243
+ n.p.marker = !1, n.p = t, t.marker = !0, n.index = e, n.timestamp = fn++;
2244
2244
  }, mo = (n, t, e) => {
2245
- if (n.length >= Ts) {
2245
+ if (n.length >= Us) {
2246
2246
  const s = n.reduce((r, i) => r.timestamp < i.timestamp ? r : i);
2247
- return Os(s, t, e), s;
2247
+ return Ts(s, t, e), s;
2248
2248
  } else {
2249
2249
  const s = new po(t, e);
2250
2250
  return n.push(s), s;
@@ -2267,7 +2267,7 @@ const wo = (n) => {
2267
2267
  for (; s.left !== null && s.left.id.client === s.id.client && s.left.id.clock + s.left.length === s.id.clock; )
2268
2268
  s = s.left, !s.deleted && s.countable && (r -= s.length);
2269
2269
  return e !== null && te(e.index - r) < /** @type {YText|YArray<any>} */
2270
- s.parent.length / Ts ? (Os(e, s, r), e) : mo(n._searchMarker, s, r);
2270
+ s.parent.length / Us ? (Ts(e, s, r), e) : mo(n._searchMarker, s, r);
2271
2271
  }, Nt = (n, t, e) => {
2272
2272
  for (let s = n.length - 1; s >= 0; s--) {
2273
2273
  const r = n[s];
@@ -2288,11 +2288,11 @@ const wo = (n) => {
2288
2288
  for (; J(r, n, () => []).push(e), n._item !== null; )
2289
2289
  n = /** @type {AbstractType<any>} */
2290
2290
  n._item.parent;
2291
- Ls(s._eH, e, t);
2291
+ As(s._eH, e, t);
2292
2292
  };
2293
2293
  class I {
2294
2294
  constructor() {
2295
- this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = Vn(), this._dEH = Vn(), this._searchMarker = null;
2295
+ this._item = null, this._map = /* @__PURE__ */ new Map(), this._start = null, this.doc = null, this._length = 0, this._eH = Fn(), this._dEH = Fn(), this._searchMarker = null;
2296
2296
  }
2297
2297
  /**
2298
2298
  * @return {AbstractType<any>|null}
@@ -2320,13 +2320,13 @@ class I {
2320
2320
  * @return {AbstractType<EventType>}
2321
2321
  */
2322
2322
  _copy() {
2323
- throw B();
2323
+ throw N();
2324
2324
  }
2325
2325
  /**
2326
2326
  * @return {AbstractType<EventType>}
2327
2327
  */
2328
2328
  clone() {
2329
- throw B();
2329
+ throw N();
2330
2330
  }
2331
2331
  /**
2332
2332
  * @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder
@@ -2358,7 +2358,7 @@ class I {
2358
2358
  * @param {function(EventType, Transaction):void} f Observer function
2359
2359
  */
2360
2360
  observe(t) {
2361
- Hn(this._eH, t);
2361
+ Vn(this._eH, t);
2362
2362
  }
2363
2363
  /**
2364
2364
  * Observe all events that are created by this type and its children.
@@ -2366,7 +2366,7 @@ class I {
2366
2366
  * @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
2367
2367
  */
2368
2368
  observeDeep(t) {
2369
- Hn(this._dEH, t);
2369
+ Vn(this._dEH, t);
2370
2370
  }
2371
2371
  /**
2372
2372
  * Unregister an observer function.
@@ -2374,7 +2374,7 @@ class I {
2374
2374
  * @param {function(EventType,Transaction):void} f Observer function
2375
2375
  */
2376
2376
  unobserve(t) {
2377
- $n(this._eH, t);
2377
+ Hn(this._eH, t);
2378
2378
  }
2379
2379
  /**
2380
2380
  * Unregister an observer function.
@@ -2382,7 +2382,7 @@ class I {
2382
2382
  * @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
2383
2383
  */
2384
2384
  unobserveDeep(t) {
2385
- $n(this._dEH, t);
2385
+ Hn(this._dEH, t);
2386
2386
  }
2387
2387
  /**
2388
2388
  * @abstract
@@ -2391,7 +2391,7 @@ class I {
2391
2391
  toJSON() {
2392
2392
  }
2393
2393
  }
2394
- const Rs = (n, t, e) => {
2394
+ const Os = (n, t, e) => {
2395
2395
  t < 0 && (t = n._length + t), e < 0 && (e = n._length + e);
2396
2396
  let s = e - t;
2397
2397
  const r = [];
@@ -2410,7 +2410,7 @@ const Rs = (n, t, e) => {
2410
2410
  i = i.right;
2411
2411
  }
2412
2412
  return r;
2413
- }, Bs = (n) => {
2413
+ }, Rs = (n) => {
2414
2414
  const t = [];
2415
2415
  let e = n._start;
2416
2416
  for (; e !== null; ) {
@@ -2432,7 +2432,7 @@ const Rs = (n, t, e) => {
2432
2432
  }
2433
2433
  s = s.right;
2434
2434
  }
2435
- }, Ns = (n, t) => {
2435
+ }, Bs = (n, t) => {
2436
2436
  const e = [];
2437
2437
  return Ft(n, (s, r) => {
2438
2438
  e.push(t(s, r, n));
@@ -2461,7 +2461,7 @@ const Rs = (n, t, e) => {
2461
2461
  };
2462
2462
  }
2463
2463
  };
2464
- }, Fs = (n, t) => {
2464
+ }, Ns = (n, t) => {
2465
2465
  const e = be(n, t);
2466
2466
  let s = n._start;
2467
2467
  for (e !== null && (s = e.p, t -= e.index); s !== null; s = s.right)
@@ -2512,9 +2512,9 @@ const Rs = (n, t, e) => {
2512
2512
  }
2513
2513
  }
2514
2514
  }), h();
2515
- }, Vs = () => X("Length exceeded!"), Hs = (n, t, e, s) => {
2515
+ }, Fs = () => X("Length exceeded!"), Vs = (n, t, e, s) => {
2516
2516
  if (e > t._length)
2517
- throw Vs();
2517
+ throw Fs();
2518
2518
  if (e === 0)
2519
2519
  return t._searchMarker && Nt(t._searchMarker, e, s.length), le(n, t, null, s);
2520
2520
  const r = e, i = be(t, e);
@@ -2534,7 +2534,7 @@ const Rs = (n, t, e) => {
2534
2534
  for (; r.right; )
2535
2535
  r = r.right;
2536
2536
  return le(n, t, r, e);
2537
- }, $s = (n, t, e, s) => {
2537
+ }, Hs = (n, t, e, s) => {
2538
2538
  if (s === 0)
2539
2539
  return;
2540
2540
  const r = e, i = s, o = be(t, e);
@@ -2544,7 +2544,7 @@ const Rs = (n, t, e) => {
2544
2544
  for (; s > 0 && l !== null; )
2545
2545
  l.deleted || (s < l.length && et(n, b(l.id.client, l.id.clock + s)), l.delete(n), s -= l.length), l = l.right;
2546
2546
  if (s > 0)
2547
- throw Vs();
2547
+ throw Fs();
2548
2548
  t._searchMarker && Nt(
2549
2549
  t._searchMarker,
2550
2550
  r,
@@ -2554,7 +2554,7 @@ const Rs = (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
- }, pn = (n, t, e, s) => {
2557
+ }, gn = (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,15 +2587,15 @@ const Rs = (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
- }, wn = (n, t) => {
2590
+ }, pn = (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
- }, js = (n) => {
2593
+ }, $s = (n) => {
2594
2594
  const t = {};
2595
2595
  return n._map.forEach((e, s) => {
2596
2596
  e.deleted || (t[s] = e.content.getContent()[e.length - 1]);
2597
2597
  }), t;
2598
- }, Ks = (n, t) => {
2598
+ }, js = (n, t) => {
2599
2599
  const e = n._map.get(t);
2600
2600
  return e !== void 0 && !e.deleted;
2601
2601
  }, qt = (n) => Ni(
@@ -2691,7 +2691,7 @@ class bt extends I {
2691
2691
  */
2692
2692
  insert(t, e) {
2693
2693
  this.doc !== null ? k(this.doc, (s) => {
2694
- Hs(
2694
+ Vs(
2695
2695
  s,
2696
2696
  this,
2697
2697
  t,
@@ -2733,7 +2733,7 @@ class bt extends I {
2733
2733
  */
2734
2734
  delete(t, e = 1) {
2735
2735
  this.doc !== null ? k(this.doc, (s) => {
2736
- $s(s, this, t, e);
2736
+ Hs(s, this, t, e);
2737
2737
  }) : this._prelimContent.splice(t, e);
2738
2738
  }
2739
2739
  /**
@@ -2743,7 +2743,7 @@ class bt extends I {
2743
2743
  * @return {T}
2744
2744
  */
2745
2745
  get(t) {
2746
- return Fs(this, t);
2746
+ return Ns(this, t);
2747
2747
  }
2748
2748
  /**
2749
2749
  * Transforms this YArray to a JavaScript Array.
@@ -2751,7 +2751,7 @@ class bt extends I {
2751
2751
  * @return {Array<T>}
2752
2752
  */
2753
2753
  toArray() {
2754
- return Bs(this);
2754
+ return Rs(this);
2755
2755
  }
2756
2756
  /**
2757
2757
  * Transforms this YArray to a JavaScript Array.
@@ -2761,7 +2761,7 @@ class bt extends I {
2761
2761
  * @return {Array<T>}
2762
2762
  */
2763
2763
  slice(t = 0, e = this.length) {
2764
- return Rs(this, t, e);
2764
+ return Os(this, t, e);
2765
2765
  }
2766
2766
  /**
2767
2767
  * Transforms this Shared Type to a JSON object.
@@ -2781,7 +2781,7 @@ class bt extends I {
2781
2781
  * callback function
2782
2782
  */
2783
2783
  map(t) {
2784
- return Ns(
2784
+ return Bs(
2785
2785
  this,
2786
2786
  /** @type {any} */
2787
2787
  t
@@ -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
- pn(
2968
+ gn(
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
- wn(this, t)
2986
+ pn(this, t)
2987
2987
  );
2988
2988
  }
2989
2989
  /**
@@ -2993,7 +2993,7 @@ class ht extends I {
2993
2993
  * @return {boolean}
2994
2994
  */
2995
2995
  has(t) {
2996
- return Ks(this, t);
2996
+ return js(this, t);
2997
2997
  }
2998
2998
  /**
2999
2999
  * Removes all elements from this YMap.
@@ -3042,7 +3042,7 @@ class ze {
3042
3042
  this.left = this.right, this.right = this.right.right;
3043
3043
  }
3044
3044
  }
3045
- const Xn = (n, t, e) => {
3045
+ const Yn = (n, t, e) => {
3046
3046
  for (; t.right !== null && e > 0; ) {
3047
3047
  switch (t.right.content.constructor) {
3048
3048
  case C:
@@ -3063,12 +3063,12 @@ const Xn = (n, t, e) => {
3063
3063
  const s = /* @__PURE__ */ new Map(), r = be(t, e);
3064
3064
  if (r) {
3065
3065
  const i = new ze(r.p.left, r.p, r.index, s);
3066
- return Xn(n, i, e - r.index);
3066
+ return Yn(n, i, e - r.index);
3067
3067
  } else {
3068
3068
  const i = new ze(null, t._start, 0, s);
3069
- return Xn(n, i, e);
3069
+ return Yn(n, i, e);
3070
3070
  }
3071
- }, zs = (n, t, e, s) => {
3071
+ }, Ks = (n, t, e, s) => {
3072
3072
  for (; e.right !== null && (e.right.deleted === !0 || e.right.content.constructor === C && q(
3073
3073
  s.get(
3074
3074
  /** @type {ContentFormat} */
@@ -3089,7 +3089,7 @@ const Xn = (n, t, e) => {
3089
3089
  }, Lt = (n, t) => {
3090
3090
  const { key: e, value: s } = t;
3091
3091
  s === null ? n.delete(e) : n.set(e, s);
3092
- }, Ys = (n, t) => {
3092
+ }, zs = (n, t) => {
3093
3093
  for (; n.right !== null; ) {
3094
3094
  if (!(n.right.deleted || n.right.content.constructor === C && q(
3095
3095
  t[
@@ -3102,7 +3102,7 @@ const Xn = (n, t, e) => {
3102
3102
  break;
3103
3103
  n.forward();
3104
3104
  }
3105
- }, Xs = (n, t, e, s) => {
3105
+ }, Ys = (n, t, e, s) => {
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;
@@ -3118,17 +3118,17 @@ const Xn = (n, t, e) => {
3118
3118
  r[f] === void 0 && (r[f] = null);
3119
3119
  });
3120
3120
  const i = n.doc, o = i.clientID;
3121
- Ys(e, r);
3122
- const l = Xs(n, t, e, r), c = s.constructor === String ? new $(
3121
+ zs(e, r);
3122
+ const l = Ys(n, t, e, r), c = s.constructor === String ? new $(
3123
3123
  /** @type {string} */
3124
3124
  s
3125
3125
  ) : s instanceof I ? new G(s) : new pt(s);
3126
3126
  let { left: a, right: h, index: d } = e;
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
- }, Jn = (n, t, e, s, r) => {
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(), Ks(n, t, e, l);
3128
+ }, Xn = (n, t, e, s, r) => {
3129
3129
  const i = n.doc, o = i.clientID;
3130
- Ys(e, r);
3131
- const l = Xs(n, t, e, r);
3130
+ zs(e, r);
3131
+ const l = Ys(n, t, e, r);
3132
3132
  t:
3133
3133
  for (; e.right !== null && (s > 0 || l.size > 0 && (e.right.deleted || e.right.content.constructor === C)); ) {
3134
3134
  if (!e.right.deleted)
@@ -3164,10 +3164,10 @@ const Xn = (n, t, e) => {
3164
3164
  `;
3165
3165
  e.right = new E(b(o, L(i.store, o)), e.left, e.left && e.left.lastId, e.right, e.right && e.right.id, t, null, new $(c)), e.right.integrate(n, 0), e.forward();
3166
3166
  }
3167
- zs(n, t, e, l);
3168
- }, Js = (n, t, e, s, r) => {
3167
+ Ks(n, t, e, l);
3168
+ }, Xs = (n, t, e, s, r) => {
3169
3169
  let i = t;
3170
- const o = O();
3170
+ const o = R();
3171
3171
  for (; i && (!i.countable || i.deleted); ) {
3172
3172
  if (!i.deleted && i.content.constructor === C) {
3173
3173
  const a = (
@@ -3224,7 +3224,7 @@ const Xn = (n, t, e) => {
3224
3224
  let s = (
3225
3225
  /** @type {Item} */
3226
3226
  n._start
3227
- ), r = n._start, i = O();
3227
+ ), r = n._start, i = R();
3228
3228
  const o = Be(i);
3229
3229
  for (; r; ) {
3230
3230
  if (r.deleted === !1)
@@ -3237,7 +3237,7 @@ const Xn = (n, t, e) => {
3237
3237
  );
3238
3238
  break;
3239
3239
  default:
3240
- t += Js(e, s, r, i, o), i = Be(o), s = r;
3240
+ t += Xs(e, s, r, i, o), i = Be(o), s = r;
3241
3241
  break;
3242
3242
  }
3243
3243
  r = r.right;
@@ -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 && vs(
3251
+ r !== i && Ms(
3252
3252
  n,
3253
3253
  /** @type {Array<Item|GC>} */
3254
3254
  e.store.clients.get(s),
@@ -3264,7 +3264,7 @@ const Xn = (n, t, e) => {
3264
3264
  );
3265
3265
  }
3266
3266
  k(e, (s) => {
3267
- ws(n, n.deleteSet, (r) => {
3267
+ ps(n, n.deleteSet, (r) => {
3268
3268
  if (r instanceof U || !/** @type {YText} */
3269
3269
  r.parent._hasFormatting || t.has(
3270
3270
  /** @type {YText} */
@@ -3280,7 +3280,7 @@ const Xn = (n, t, e) => {
3280
3280
  for (const r of t)
3281
3281
  Co(r);
3282
3282
  });
3283
- }, Wn = (n, t, e) => {
3283
+ }, Jn = (n, t, e) => {
3284
3284
  const s = e, r = Be(t.currentAttributes), i = t.right;
3285
3285
  for (; e > 0 && t.right !== null; ) {
3286
3286
  if (t.right.deleted === !1)
@@ -3293,7 +3293,7 @@ const Xn = (n, t, e) => {
3293
3293
  }
3294
3294
  t.forward();
3295
3295
  }
3296
- i && Js(n, i, t.right, r, t.currentAttributes);
3296
+ i && Xs(n, i, t.right, r, t.currentAttributes);
3297
3297
  const o = (
3298
3298
  /** @type {AbstractType<any>} */
3299
3299
  /** @type {Item} */
@@ -3512,7 +3512,7 @@ class Ct extends I {
3512
3512
  ` ? o.insert.slice(0, -1) : o.insert;
3513
3513
  (typeof l != "string" || l.length > 0) && ve(s, this, r, l, o.attributes || {});
3514
3514
  } else
3515
- o.retain !== void 0 ? Jn(s, this, r, o.retain, o.attributes || {}) : o.delete !== void 0 && Wn(s, r, o.delete);
3515
+ o.retain !== void 0 ? Xn(s, this, r, o.retain, o.attributes || {}) : o.delete !== void 0 && Jn(s, r, o.delete);
3516
3516
  }
3517
3517
  }) : this._pending.push(() => this.applyDelta(t));
3518
3518
  }
@@ -3638,7 +3638,7 @@ class Ct extends I {
3638
3638
  return;
3639
3639
  const s = this.doc;
3640
3640
  s !== null ? k(s, (r) => {
3641
- Wn(r, Zt(r, this, t), e);
3641
+ Jn(r, Zt(r, this, t), e);
3642
3642
  }) : this._pending.push(() => this.delete(t, e));
3643
3643
  }
3644
3644
  /**
@@ -3657,7 +3657,7 @@ class Ct extends I {
3657
3657
  const r = this.doc;
3658
3658
  r !== null ? k(r, (i) => {
3659
3659
  const o = Zt(i, this, t);
3660
- o.right !== null && Jn(i, this, o, e, s);
3660
+ o.right !== null && Xn(i, this, o, e, s);
3661
3661
  }) : this._pending.push(() => this.format(t, e, s));
3662
3662
  }
3663
3663
  /**
@@ -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
- pn(s, this, t, e);
3689
+ gn(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
- wn(this, t)
3706
+ pn(this, t)
3707
3707
  );
3708
3708
  }
3709
3709
  /**
@@ -3716,7 +3716,7 @@ class Ct extends I {
3716
3716
  * @public
3717
3717
  */
3718
3718
  getAttributes() {
3719
- return js(this);
3719
+ return $s(this);
3720
3720
  }
3721
3721
  /**
3722
3722
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
@@ -3881,7 +3881,7 @@ class ut extends I {
3881
3881
  * @return {string} The string representation of all children.
3882
3882
  */
3883
3883
  toString() {
3884
- return Ns(this, (t) => t.toString()).join("");
3884
+ return Bs(this, (t) => t.toString()).join("");
3885
3885
  }
3886
3886
  /**
3887
3887
  * @return {string}
@@ -3922,7 +3922,7 @@ class ut extends I {
3922
3922
  */
3923
3923
  insert(t, e) {
3924
3924
  this.doc !== null ? k(this.doc, (s) => {
3925
- Hs(s, this, t, e);
3925
+ Vs(s, this, t, e);
3926
3926
  }) : this._prelimContent.splice(t, 0, ...e);
3927
3927
  }
3928
3928
  /**
@@ -3959,7 +3959,7 @@ class ut extends I {
3959
3959
  */
3960
3960
  delete(t, e = 1) {
3961
3961
  this.doc !== null ? k(this.doc, (s) => {
3962
- $s(s, this, t, e);
3962
+ Hs(s, this, t, e);
3963
3963
  }) : this._prelimContent.splice(t, e);
3964
3964
  }
3965
3965
  /**
@@ -3968,7 +3968,7 @@ class ut extends I {
3968
3968
  * @return {Array<YXmlElement|YXmlText|YXmlHook>}
3969
3969
  */
3970
3970
  toArray() {
3971
- return Bs(this);
3971
+ return Rs(this);
3972
3972
  }
3973
3973
  /**
3974
3974
  * Appends content to this YArray.
@@ -3993,7 +3993,7 @@ class ut extends I {
3993
3993
  * @return {YXmlElement|YXmlText}
3994
3994
  */
3995
3995
  get(t) {
3996
- return Fs(this, t);
3996
+ return Ns(this, t);
3997
3997
  }
3998
3998
  /**
3999
3999
  * Transforms this YArray to a JavaScript Array.
@@ -4003,7 +4003,7 @@ class ut extends I {
4003
4003
  * @return {Array<YXmlElement|YXmlText>}
4004
4004
  */
4005
4005
  slice(t = 0, e = this.length) {
4006
- return Rs(this, t, e);
4006
+ return Os(this, t, e);
4007
4007
  }
4008
4008
  /**
4009
4009
  * Executes a provided function on once on overy child element.
@@ -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
- pn(s, this, t, e);
4134
+ gn(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
- wn(this, t)
4151
+ pn(this, t)
4152
4152
  );
4153
4153
  }
4154
4154
  /**
@@ -4162,7 +4162,7 @@ class Vt extends ut {
4162
4162
  hasAttribute(t) {
4163
4163
  return (
4164
4164
  /** @type {any} */
4165
- Ks(this, t)
4165
+ js(this, t)
4166
4166
  );
4167
4167
  }
4168
4168
  /**
@@ -4175,7 +4175,7 @@ class Vt extends ut {
4175
4175
  getAttributes() {
4176
4176
  return (
4177
4177
  /** @type {any} */
4178
- js(this)
4178
+ $s(this)
4179
4179
  );
4180
4180
  }
4181
4181
  /**
@@ -4377,7 +4377,7 @@ class he extends Ct {
4377
4377
  }
4378
4378
  }
4379
4379
  const To = (n) => new he();
4380
- class mn {
4380
+ class wn {
4381
4381
  /**
4382
4382
  * @param {ID} id
4383
4383
  * @param {number} length
@@ -4389,7 +4389,7 @@ class mn {
4389
4389
  * @type {boolean}
4390
4390
  */
4391
4391
  get deleted() {
4392
- throw B();
4392
+ throw N();
4393
4393
  }
4394
4394
  /**
4395
4395
  * Merge this struct with the item to the right.
@@ -4407,18 +4407,18 @@ class mn {
4407
4407
  * @param {number} encodingRef
4408
4408
  */
4409
4409
  write(t, e, s) {
4410
- throw B();
4410
+ throw N();
4411
4411
  }
4412
4412
  /**
4413
4413
  * @param {Transaction} transaction
4414
4414
  * @param {number} offset
4415
4415
  */
4416
4416
  integrate(t, e) {
4417
- throw B();
4417
+ throw N();
4418
4418
  }
4419
4419
  }
4420
4420
  const Oo = 0;
4421
- class U extends mn {
4421
+ class U extends wn {
4422
4422
  get deleted() {
4423
4423
  return !0;
4424
4424
  }
@@ -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), Ms(t.doc.store, this);
4439
+ e > 0 && (this.id.clock += e, this.length -= e), Is(t.doc.store, this);
4440
4440
  }
4441
4441
  /**
4442
4442
  * @param {UpdateEncoderV1 | UpdateEncoderV2} encoder
@@ -4490,7 +4490,7 @@ class zt {
4490
4490
  * @return {ContentBinary}
4491
4491
  */
4492
4492
  splice(t) {
4493
- throw B();
4493
+ throw N();
4494
4494
  }
4495
4495
  /**
4496
4496
  * @param {ContentBinary} right
@@ -4607,7 +4607,7 @@ class Ht {
4607
4607
  return 1;
4608
4608
  }
4609
4609
  }
4610
- const Bo = (n) => new Ht(n.readLen()), Ws = (n, t) => new gt({ guid: n, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
4610
+ const Bo = (n) => new Ht(n.readLen()), Js = (n, t) => new gt({ guid: n, ...t, shouldLoad: t.shouldLoad || t.autoLoad || !1 });
4611
4611
  class Yt {
4612
4612
  /**
4613
4613
  * @param {Doc} doc
@@ -4639,14 +4639,14 @@ class Yt {
4639
4639
  * @return {ContentDoc}
4640
4640
  */
4641
4641
  copy() {
4642
- return new Yt(Ws(this.doc.guid, this.opts));
4642
+ return new Yt(Js(this.doc.guid, this.opts));
4643
4643
  }
4644
4644
  /**
4645
4645
  * @param {number} offset
4646
4646
  * @return {ContentDoc}
4647
4647
  */
4648
4648
  splice(t) {
4649
- throw B();
4649
+ throw N();
4650
4650
  }
4651
4651
  /**
4652
4652
  * @param {ContentDoc} right
@@ -4687,7 +4687,7 @@ class Yt {
4687
4687
  return 9;
4688
4688
  }
4689
4689
  }
4690
- const No = (n) => new Yt(Ws(n.readString(), n.readAny()));
4690
+ const No = (n) => new Yt(Js(n.readString(), n.readAny()));
4691
4691
  class pt {
4692
4692
  /**
4693
4693
  * @param {Object} embed
@@ -4724,7 +4724,7 @@ class pt {
4724
4724
  * @return {ContentEmbed}
4725
4725
  */
4726
4726
  splice(t) {
4727
- throw B();
4727
+ throw N();
4728
4728
  }
4729
4729
  /**
4730
4730
  * @param {ContentEmbed} right
@@ -4801,7 +4801,7 @@ class C {
4801
4801
  * @return {ContentFormat}
4802
4802
  */
4803
4803
  splice(t) {
4804
- throw B();
4804
+ throw N();
4805
4805
  }
4806
4806
  /**
4807
4807
  * @param {ContentFormat} _right
@@ -5145,7 +5145,7 @@ class G {
5145
5145
  * @return {ContentType}
5146
5146
  */
5147
5147
  splice(t) {
5148
- throw B();
5148
+ throw N();
5149
5149
  }
5150
5150
  /**
5151
5151
  * @param {ContentType} right
@@ -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 mn {
5217
+ class E extends wn {
5218
5218
  /**
5219
5219
  * @param {ID} id
5220
5220
  * @param {Item | null} left
@@ -5226,7 +5226,7 @@ class E extends mn {
5226
5226
  * @param {AbstractContent} content
5227
5227
  */
5228
5228
  constructor(t, e, s, r, i, o, l, c) {
5229
- super(t, c.getLength()), this.origin = s, this.left = e, this.right = r, this.rightOrigin = i, this.parent = o, this.parentSub = l, this.redone = null, this.content = c, this.info = this.content.isCountable() ? Un : 0;
5229
+ super(t, c.getLength()), this.origin = s, this.left = e, this.right = r, this.rightOrigin = i, this.parent = o, this.parentSub = l, this.redone = null, this.content = c, this.info = this.content.isCountable() ? xn : 0;
5230
5230
  }
5231
5231
  /**
5232
5232
  * This is used to mark the item as an indexed fast-search marker
@@ -5243,13 +5243,13 @@ class E extends mn {
5243
5243
  * If true, do not garbage collect this Item.
5244
5244
  */
5245
5245
  get keep() {
5246
- return (this.info & xn) > 0;
5246
+ return (this.info & vn) > 0;
5247
5247
  }
5248
5248
  set keep(t) {
5249
- this.keep !== t && (this.info ^= xn);
5249
+ this.keep !== t && (this.info ^= vn);
5250
5250
  }
5251
5251
  get countable() {
5252
- return (this.info & Un) > 0;
5252
+ return (this.info & xn) > 0;
5253
5253
  }
5254
5254
  /**
5255
5255
  * Whether this item was deleted or not.
@@ -5278,7 +5278,7 @@ class E extends mn {
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 = jn(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 === U || this.right && this.right.constructor === U)
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);
@@ -5294,7 +5294,7 @@ class E extends mn {
5294
5294
  * @param {number} offset
5295
5295
  */
5296
5296
  integrate(t, e) {
5297
- if (e > 0 && (this.id.clock += e, this.left = jn(t, t.doc.store, b(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(e), this.length -= e), this.parent) {
5297
+ if (e > 0 && (this.id.clock += e, this.left = $n(t, t.doc.store, b(this.id.client, this.id.clock - 1)), this.origin = this.left.lastId, this.content = this.content.splice(e), this.length -= e), this.parent) {
5298
5298
  if (!this.left && (!this.right || this.right.left !== null) || this.left && this.left.right !== this.right) {
5299
5299
  let s = this.left, r;
5300
5300
  if (s !== null)
@@ -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), Ms(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), Is(t.doc.store, this), this.content.integrate(t, this), Kn(
5339
5339
  t,
5340
5340
  /** @type {AbstractType<any>} */
5341
5341
  this.parent,
@@ -5399,7 +5399,7 @@ class E extends mn {
5399
5399
  /** @type {AbstractType<any>} */
5400
5400
  this.parent
5401
5401
  );
5402
- this.countable && this.parentSub === null && (e._length -= this.length), this.markDeleted(), ie(t.deleteSet, this.id.client, this.id.clock, this.length), zn(t, e, this.parentSub), this.content.delete(t);
5402
+ this.countable && this.parentSub === null && (e._length -= this.length), this.markDeleted(), ie(t.deleteSet, this.id.client, this.id.clock, this.length), Kn(t, e, this.parentSub), this.content.delete(t);
5403
5403
  }
5404
5404
  }
5405
5405
  /**
@@ -5443,7 +5443,7 @@ class E extends mn {
5443
5443
  this.content.write(t, e);
5444
5444
  }
5445
5445
  }
5446
- const Gs = (n, t) => Zo[t & ge](n), Zo = [
5446
+ const Ws = (n, t) => Zo[t & ge](n), Zo = [
5447
5447
  () => {
5448
5448
  V();
5449
5449
  },
@@ -5471,7 +5471,7 @@ const Gs = (n, t) => Zo[t & ge](n), Zo = [
5471
5471
  }
5472
5472
  // 10 - Skip is not ItemContent
5473
5473
  ], Qo = 10;
5474
- class T extends mn {
5474
+ class T extends wn {
5475
5475
  get deleted() {
5476
5476
  return !0;
5477
5477
  }
@@ -5507,13 +5507,13 @@ class T extends mn {
5507
5507
  return null;
5508
5508
  }
5509
5509
  }
5510
- const Ps = (
5510
+ const Gs = (
5511
5511
  /** @type {any} */
5512
5512
  typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}
5513
- ), qs = "__ $YJS$ __";
5514
- Ps[qs] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
5515
- Ps[qs] = !0;
5516
- const Zs = /* @__PURE__ */ new Map();
5513
+ ), Ps = "__ $YJS$ __";
5514
+ Gs[Ps] === !0 && console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");
5515
+ Gs[Ps] = !0;
5516
+ const qs = /* @__PURE__ */ new Map();
5517
5517
  class tl {
5518
5518
  /**
5519
5519
  * @param {string} room
@@ -5525,48 +5525,48 @@ class tl {
5525
5525
  * @param {ArrayBuffer} buf
5526
5526
  */
5527
5527
  postMessage(t) {
5528
- ss.setItem(this.room, ai(ri(t)));
5528
+ ns.setItem(this.room, ai(ri(t)));
5529
5529
  }
5530
5530
  close() {
5531
5531
  Tr(this._onChange);
5532
5532
  }
5533
5533
  }
5534
- const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, yn = (n) => J(Zs, n, () => {
5534
+ const el = typeof BroadcastChannel > "u" ? tl : BroadcastChannel, mn = (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) => (yn(n).subs.add(t), t), sl = (n, t) => {
5541
- const e = yn(n), s = e.subs.delete(t);
5542
- return s && e.subs.size === 0 && (e.bc.close(), Zs.delete(n)), s;
5540
+ }), nl = (n, t) => (mn(n).subs.add(t), t), sl = (n, t) => {
5541
+ const e = mn(n), s = e.subs.delete(t);
5542
+ return s && e.subs.size === 0 && (e.bc.close(), qs.delete(n)), s;
5543
5543
  }, mt = (n, t, e = null) => {
5544
- const s = yn(n);
5544
+ const s = mn(n);
5545
5545
  s.bc.postMessage(t), s.subs.forEach((r) => r(t, e));
5546
- }, Qs = 0, bn = 1, tr = 2, Ye = (n, t) => {
5547
- p(n, Qs);
5546
+ }, Zs = 0, yn = 1, Qs = 2, Ye = (n, t) => {
5547
+ p(n, Zs);
5548
5548
  const e = Qi(t);
5549
5549
  D(n, e);
5550
- }, er = (n, t, e) => {
5551
- p(n, bn), D(n, hn(t, e));
5552
- }, rl = (n, t, e) => er(t, e, M(n)), nr = (n, t, e) => {
5550
+ }, tr = (n, t, e) => {
5551
+ p(n, yn), D(n, an(t, e));
5552
+ }, rl = (n, t, e) => tr(t, e, M(n)), er = (n, t, e) => {
5553
5553
  try {
5554
- Es(t, M(n), e);
5554
+ Ds(t, M(n), e);
5555
5555
  } catch (s) {
5556
5556
  console.error("Caught error while handling a Yjs update", s);
5557
5557
  }
5558
5558
  }, il = (n, t) => {
5559
- p(n, tr), D(n, t);
5560
- }, ol = nr, ll = (n, t, e, s) => {
5559
+ p(n, Qs), D(n, t);
5560
+ }, ol = er, ll = (n, t, e, s) => {
5561
5561
  const r = m(n);
5562
5562
  switch (r) {
5563
- case Qs:
5563
+ case Zs:
5564
5564
  rl(n, t, e);
5565
5565
  break;
5566
- case bn:
5567
- nr(n, e, s);
5566
+ case yn:
5567
+ er(n, e, s);
5568
5568
  break;
5569
- case tr:
5569
+ case Qs:
5570
5570
  ol(n, e, s);
5571
5571
  break;
5572
5572
  default:
@@ -5592,7 +5592,7 @@ class hl extends fe {
5592
5592
  const s = [];
5593
5593
  this.meta.forEach((r, i) => {
5594
5594
  i !== this.clientID && Ue <= e - r.lastUpdated && this.states.has(i) && s.push(i);
5595
- }), s.length > 0 && kn(this, s, "timeout");
5595
+ }), s.length > 0 && bn(this, s, "timeout");
5596
5596
  }, Y(Ue / 10)), t.on("destroy", () => {
5597
5597
  this.destroy();
5598
5598
  }), this.setLocalState({});
@@ -5636,7 +5636,7 @@ class hl extends fe {
5636
5636
  return this.states;
5637
5637
  }
5638
5638
  }
5639
- const kn = (n, t, e) => {
5639
+ const bn = (n, t, e) => {
5640
5640
  const s = [];
5641
5641
  for (let r = 0; r < t.length; r++) {
5642
5642
  const i = t[r];
@@ -5687,7 +5687,7 @@ const kn = (n, t, e) => {
5687
5687
  removed: c
5688
5688
  }, e]);
5689
5689
  }, dl = (n) => Nr(n, (t, e) => `${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&");
5690
- var st = 0, sr = 3, kt = 1, fl = 2, gl = typeof window > "u";
5690
+ var st = 0, nr = 3, kt = 1, fl = 2, gl = typeof window > "u";
5691
5691
  function pl(n, t) {
5692
5692
  if (!n)
5693
5693
  throw new Error(t);
@@ -5701,9 +5701,9 @@ Xt[st] = (n, t, e, s, r) => {
5701
5701
  e.doc,
5702
5702
  e
5703
5703
  );
5704
- s && i === bn && !e.synced && (e.synced = !0);
5704
+ s && i === yn && !e.synced && (e.synced = !0);
5705
5705
  };
5706
- Xt[sr] = (n, t, e, s, r) => {
5706
+ Xt[nr] = (n, t, e, s, r) => {
5707
5707
  p(n, kt), D(
5708
5708
  n,
5709
5709
  Ut(
@@ -5726,28 +5726,28 @@ Xt[fl] = (n, t, e, s, r) => {
5726
5726
  (i, o) => wl(e, o)
5727
5727
  );
5728
5728
  };
5729
- var Gn = 3e4;
5729
+ var Wn = 3e4;
5730
5730
  function wl(n, t) {
5731
5731
  console.warn(`Permission denied to access ${n.url}.
5732
5732
  ${t}`);
5733
5733
  }
5734
- function rr(n, t, e) {
5734
+ function sr(n, t, e) {
5735
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
- function ir(n) {
5738
+ function rr(n) {
5739
5739
  if (n.shouldConnect && n.ws === null) {
5740
5740
  const t = new n._WS(n.url);
5741
5741
  t.binaryType = "arraybuffer", n.ws = t, n.wsconnecting = !0, n.wsconnected = !1, n.synced = !1, t.onmessage = (e) => {
5742
5742
  if (typeof e.data == "string")
5743
5743
  return;
5744
5744
  n.wsLastMessageReceived = ct();
5745
- const s = rr(n, new Uint8Array(e.data), !0);
5746
- nn(s) > 1 && t.send(_(s));
5745
+ const s = sr(n, new Uint8Array(e.data), !0);
5746
+ en(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, kn(
5750
+ n.emit("connection-close", [e, n]), n.ws = null, n.wsconnecting = !1, n.wsconnected ? (n.wsconnected = !1, n.synced = !1, bn(
5751
5751
  n.awareness,
5752
5752
  Array.from(n.awareness.getStates().keys()).filter(
5753
5753
  (s) => s !== n.doc.clientID
@@ -5758,8 +5758,8 @@ function ir(n) {
5758
5758
  status: "disconnected"
5759
5759
  }
5760
5760
  ])) : n.wsUnsuccessfulReconnects++, setTimeout(
5761
- ir,
5762
- Pe(
5761
+ rr,
5762
+ Ge(
5763
5763
  Sr(2, n.wsUnsuccessfulReconnects) * 100,
5764
5764
  n.maxBackoffTime
5765
5765
  ),
@@ -5842,8 +5842,8 @@ var ml = class extends fe {
5842
5842
  }
5843
5843
  }, c)), this._bcSubscriber = (u, f) => {
5844
5844
  if (f !== this) {
5845
- const g = rr(this, new Uint8Array(u), !1);
5846
- nn(g) > 1 && mt(this.bcChannel, _(g), this);
5845
+ const g = sr(this, new Uint8Array(u), !1);
5846
+ en(g) > 1 && mt(this.bcChannel, _(g), this);
5847
5847
  }
5848
5848
  }, this._updateHandler = (u, f) => {
5849
5849
  if (f !== this) {
@@ -5857,15 +5857,15 @@ var ml = class extends fe {
5857
5857
  Ut(i, S)
5858
5858
  ), Te(this, _(j));
5859
5859
  }, this._unloadHandler = () => {
5860
- kn(
5860
+ bn(
5861
5861
  this.awareness,
5862
5862
  [s.clientID],
5863
5863
  "window unload"
5864
5864
  );
5865
5865
  }, typeof window < "u" ? window.addEventListener("unload", this._unloadHandler) : typeof process < "u" && process.on("exit", this._unloadHandler), i.on("update", this._awarenessUpdateHandler), this._checkInterval = /** @type {any} */
5866
5866
  setInterval(() => {
5867
- this.wsconnected && Gn < ct() - this.wsLastMessageReceived && (pl(this.ws !== null, "ws must not be null"), this.ws.close());
5868
- }, Gn / 10), r && this.connect();
5867
+ this.wsconnected && Wn < ct() - this.wsLastMessageReceived && (pl(this.ws !== null, "ws must not be null"), this.ws.close());
5868
+ }, Wn / 10), r && this.connect();
5869
5869
  }
5870
5870
  /**
5871
5871
  * @type {boolean}
@@ -5886,9 +5886,9 @@ var ml = class extends fe {
5886
5886
  const t = v();
5887
5887
  p(t, st), Ye(t, this.doc), mt(this.bcChannel, _(t), this);
5888
5888
  const e = v();
5889
- p(e, st), er(e, this.doc), mt(this.bcChannel, _(e), this);
5889
+ p(e, st), tr(e, this.doc), mt(this.bcChannel, _(e), this);
5890
5890
  const s = v();
5891
- p(s, sr), mt(
5891
+ p(s, nr), mt(
5892
5892
  this.bcChannel,
5893
5893
  _(s),
5894
5894
  this
@@ -5920,7 +5920,7 @@ var ml = class extends fe {
5920
5920
  this.shouldConnect = !1, this.disconnectBc(), this.ws !== null && this.ws.close();
5921
5921
  }
5922
5922
  connect() {
5923
- this.shouldConnect = !0, !this.wsconnected && this.ws === null && (ir(this), this.connectBc());
5923
+ this.shouldConnect = !0, !this.wsconnected && this.ws === null && (rr(this), this.connectBc());
5924
5924
  }
5925
5925
  };
5926
5926
  function yl() {
@@ -5932,7 +5932,7 @@ function yl() {
5932
5932
  return n > 0 ? (s = (n + s) % 16 | 0, n = Math.floor(n / 16)) : (s = (t + s) % 16 | 0, t = Math.floor(t / 16)), (e === "x" ? s : s & 3 | 8).toString(16);
5933
5933
  });
5934
5934
  }
5935
- function Pn(n, t, e) {
5935
+ function Gn(n, t, e) {
5936
5936
  if (typeof n !== e)
5937
5937
  throw new Error(
5938
5938
  `Invalid "${t}" parameter provided to YPartyKitProvider. Expected: ${e}, received: ${n}`
@@ -5942,9 +5942,9 @@ var bl = class extends WebSocket {
5942
5942
  send(n) {
5943
5943
  typeof n != "string" && mr(n, (t) => super.send(t));
5944
5944
  }
5945
- }, rt, ts, kl = (ts = class extends ml {
5945
+ }, rt, Qn, kl = (Qn = class extends ml {
5946
5946
  constructor(t, e, s, r = {}) {
5947
- Pn(t, "host", "string"), Pn(e, "room", "string"), t = t.replace(/^(http|https|ws|wss):\/\//, ""), t.endsWith("/") && t.slice(0, -1);
5947
+ Gn(t, "host", "string"), Gn(e, "room", "string"), t = t.replace(/^(http|https|ws|wss):\/\//, ""), t.endsWith("/") && t.slice(0, -1);
5948
5948
  const i = `${t.startsWith("localhost:") || t.startsWith("127.0.0.1:") ? "ws" : "wss"}://${t}${r.party ? `/parties/${r.party}` : "/party"}`, o = r.connectionId ?? yl(), { params: l, connect: c = !0, ...a } = r, h = {
5949
5949
  ...a,
5950
5950
  connect: !1,
@@ -5952,8 +5952,8 @@ var bl = class extends WebSocket {
5952
5952
  };
5953
5953
  super(i, e, s ?? new gt(), h);
5954
5954
  y(this, "id");
5955
- En(this, rt, void 0);
5956
- this.id = o, Cn(this, rt, l), c && this.connect();
5955
+ Dn(this, rt, void 0);
5956
+ this.id = o, En(this, rt, l), c && this.connect();
5957
5957
  }
5958
5958
  connect() {
5959
5959
  Promise.resolve(
@@ -5969,7 +5969,7 @@ var bl = class extends WebSocket {
5969
5969
  throw console.error("Failed to open connecton to PartyKit", t), new Error(t);
5970
5970
  });
5971
5971
  }
5972
- }, rt = new WeakMap(), ts);
5972
+ }, rt = new WeakMap(), Qn);
5973
5973
  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) => {
@@ -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
- }, 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) => {
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) => {
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,25 +5998,25 @@ 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", 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", lr = "updates", cr = 500, ar = (n, t = () => {
6002
6002
  }, e = () => {
6003
6003
  }) => {
6004
6004
  const [s] = Mt(
6005
6005
  /** @type {IDBDatabase} */
6006
6006
  n.db,
6007
- [cr]
6007
+ [lr]
6008
6008
  );
6009
6009
  return Al(s, Tl(n._dbref, !1)).then((r) => {
6010
6010
  n._destroyed || (t(s), k(n.doc, () => {
6011
- r.forEach((i) => Es(n.doc, i));
6011
+ r.forEach((i) => Ds(n.doc, i));
6012
6012
  }, n, !1), e(s));
6013
6013
  }).then(() => Il(s).then((r) => {
6014
6014
  n._dbref = r + 1;
6015
- })).then(() => or(s).then((r) => {
6015
+ })).then(() => ir(s).then((r) => {
6016
6016
  n._dbsize = r;
6017
6017
  })).then(() => s);
6018
- }, Ol = (n, t = !0) => hr(n).then((e) => {
6019
- (t || n._dbsize >= ar) && Xe(e, hn(n.doc)).then(() => lr(e, Ul(n._dbref, !0))).then(() => or(e).then((s) => {
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) => {
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, hr(this, (o) => Xe(o, hn(e)), () => {
6036
+ this.db = s, ar(this, (o) => Xe(o, an(e)), () => {
6037
6037
  if (this._destroyed)
6038
6038
  return this;
6039
6039
  this.synced = !0, this.emit("synced", [this]);
@@ -6043,9 +6043,9 @@ class Rl extends fe {
6043
6043
  const [i] = Mt(
6044
6044
  /** @type {IDBDatabase} */
6045
6045
  this.db,
6046
- [cr]
6046
+ [lr]
6047
6047
  );
6048
- Xe(i, s), ++this._dbsize >= ar && (this._storeTimeoutId !== null && clearTimeout(this._storeTimeoutId), this._storeTimeoutId = setTimeout(() => {
6048
+ Xe(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
  }
@@ -6094,7 +6094,7 @@ class Rl extends fe {
6094
6094
  del(t) {
6095
6095
  return this._db.then((e) => {
6096
6096
  const [s] = Mt(e, [Oe]);
6097
- return lr(s, t);
6097
+ return or(s, t);
6098
6098
  });
6099
6099
  }
6100
6100
  }
@@ -6108,10 +6108,10 @@ var _e = /* @__PURE__ */ ((n) => (n.CanPlay = "can-play", n.CanMove = "can-move"
6108
6108
  function Fl(n) {
6109
6109
  return n.id;
6110
6110
  }
6111
- const ur = `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='53' viewport='0 0 100 100' style='fill:black;font-size:26px;'><text y='40%'>🚿</text></svg>")
6111
+ const hr = `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='44' height='53' viewport='0 0 100 100' style='fill:black;font-size:26px;'><text y='40%'>🚿</text></svg>")
6112
6112
  16 0,
6113
6113
  auto`, Vl = `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='48' viewport='0 0 100 100' style='fill:black;font-size:24px;'><text y='50%'>✂️</text></svg>") 16 0,auto`;
6114
- function qn(n, { getData: t, getElement: e, getLocalData: s, setLocalData: r }) {
6114
+ function Pn(n, { getData: t, getElement: e, getLocalData: s, setLocalData: r }) {
6115
6115
  const i = t(), o = s(), l = e();
6116
6116
  if (o.isHovering = !0, n.altKey) {
6117
6117
  if (i.scale <= 0.5) {
@@ -6124,7 +6124,7 @@ function qn(n, { getData: t, getElement: e, getLocalData: s, setLocalData: r })
6124
6124
  l.style.cursor = "not-allowed";
6125
6125
  return;
6126
6126
  }
6127
- l.style.cursor = ur;
6127
+ l.style.cursor = hr;
6128
6128
  }
6129
6129
  r(o);
6130
6130
  }
@@ -6187,12 +6187,14 @@ const Hl = {
6187
6187
  "can-toggle"
6188
6188
  /* CanToggle */
6189
6189
  ]: {
6190
- defaultData: !1,
6190
+ defaultData: { on: !1 },
6191
6191
  updateElement: ({ element: n, data: t }) => {
6192
- n.classList.toggle("clicked", t);
6192
+ const e = typeof t == "object" ? t.on : t;
6193
+ n.classList.toggle("clicked", e);
6193
6194
  },
6194
6195
  onClick: (n, { data: t, setData: e }) => {
6195
- e(!t);
6196
+ const s = typeof t == "object" ? t.on : t;
6197
+ e({ on: !s });
6196
6198
  },
6197
6199
  resetShortcut: "shiftKey"
6198
6200
  },
@@ -6212,7 +6214,7 @@ const Hl = {
6212
6214
  return;
6213
6215
  i -= 0.1;
6214
6216
  } else {
6215
- if (e.style.cursor = ur, t.scale >= r.maxScale)
6217
+ if (e.style.cursor = hr, t.scale >= r.maxScale)
6216
6218
  return;
6217
6219
  i += 0.1;
6218
6220
  }
@@ -6220,8 +6222,8 @@ const Hl = {
6220
6222
  },
6221
6223
  additionalSetup: (n) => {
6222
6224
  n.getElement().addEventListener("mouseenter", (t) => {
6223
- qn(t, n);
6224
- const e = (s) => qn(s, n);
6225
+ Pn(t, n);
6226
+ const e = (s) => Pn(s, n);
6225
6227
  document.addEventListener("keydown", e), document.addEventListener("keyup", e), n.getElement().addEventListener("mouseleave", (s) => {
6226
6228
  document.removeEventListener("keydown", e), document.removeEventListener("keyup", e);
6227
6229
  });
@@ -6291,7 +6293,7 @@ const Hl = {
6291
6293
  ), !0) : !1;
6292
6294
  }
6293
6295
  }
6294
- }, Zn = (n, t = 300) => {
6296
+ }, qn = (n, t = 300) => {
6295
6297
  let e;
6296
6298
  return function(...s) {
6297
6299
  clearTimeout(e), e = setTimeout(() => n.apply(this, s), t);
@@ -6333,7 +6335,7 @@ class $l {
6333
6335
  debounceMs: f,
6334
6336
  triggerAwarenessUpdate: g
6335
6337
  } = t;
6336
- this.element = e, this.defaultData = i instanceof Function ? i(e) : i, this.localData = o instanceof Function ? o(e) : o, this.triggerAwarenessUpdate = g, this.onChange = s, this.debouncedOnChange = Zn(this.onChange, f), this.onAwarenessChange = r, this.updateElement = h, this.updateElementAwareness = d;
6338
+ this.element = e, this.defaultData = i instanceof Function ? i(e) : i, this.localData = o instanceof Function ? o(e) : o, this.triggerAwarenessUpdate = g, this.onChange = s, this.debouncedOnChange = qn(this.onChange, f), this.onAwarenessChange = r, this.updateElement = h, this.updateElementAwareness = d;
6337
6339
  const w = c === void 0 ? this.defaultData : c;
6338
6340
  a !== void 0 && (this.__awareness = a);
6339
6341
  const S = l instanceof Function ? l(e) : l;
@@ -6352,7 +6354,7 @@ class $l {
6352
6354
  debounceMs: h,
6353
6355
  triggerAwarenessUpdate: d
6354
6356
  }) {
6355
- this.triggerAwarenessUpdate = d, this.onChange = e, this.debouncedOnChange = Zn(this.onChange, h), this.onAwarenessChange = s, this.updateElement = r, this.updateElementAwareness = i, o && !this.onClick && t.addEventListener("click", (u) => {
6357
+ this.triggerAwarenessUpdate = d, this.onChange = e, this.debouncedOnChange = qn(this.onChange, h), this.onAwarenessChange = s, this.updateElement = r, this.updateElementAwareness = i, o && !this.onClick && t.addEventListener("click", (u) => {
6356
6358
  var f;
6357
6359
  (f = this.onClick) == null || f.call(this, u, this.getEventHandlerData());
6358
6360
  }), this.onClick = o, l && !this.onDrag && (t.addEventListener("touchstart", (u) => {
@@ -6470,20 +6472,20 @@ const jl = "playhtml.spencerc99.partykit.dev", Re = new gt();
6470
6472
  function Kl() {
6471
6473
  return window.location.pathname + window.location.search;
6472
6474
  }
6473
- let Q, N, F;
6474
- const Qn = /* @__PURE__ */ new Map();
6475
+ let Q, F, O;
6476
+ const Zn = /* @__PURE__ */ new Map();
6475
6477
  let Jt = Hl;
6476
- function Je() {
6478
+ function ur() {
6477
6479
  return [_e.CanPlay, ...Object.keys(Jt)];
6478
6480
  }
6479
- let _n = !1, We = !0;
6481
+ let kn = !1, Je = !0;
6480
6482
  function zl({
6481
6483
  // TODO: if it is a localhost url, need to make some deterministic way to connect to the same room.
6482
6484
  room: n = Kl(),
6483
6485
  host: t = jl,
6484
6486
  extraCapabilities: e
6485
6487
  } = {}) {
6486
- if (!We) {
6488
+ if (!Je) {
6487
6489
  console.error("playhtml already set up!");
6488
6490
  return;
6489
6491
  }
@@ -6495,22 +6497,22 @@ function zl({
6495
6497
  ࿂࿂࿂࿂ https://playhtml.fun ࿂࿂࿂࿂
6496
6498
  ࿂࿂࿂࿂ ࿂ ࿂ ࿂ ࿂ ࿂࿂࿂࿂
6497
6499
  ࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂࿂`
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)
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)
6499
6501
  for (const [i, o] of Object.entries(e))
6500
6502
  Jt[i] = o;
6501
6503
  return Q.on("sync", (i) => {
6502
- i || console.error("Issue connecting to yjs..."), _n = !0, fr();
6504
+ i || console.error("Issue connecting to yjs..."), kn = !0, console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝"), fr();
6503
6505
  }), Q;
6504
6506
  }
6505
6507
  function Yl(n, t) {
6506
6508
  const e = Q.awareness.getLocalState();
6507
6509
  return ((e == null ? void 0 : e[n]) ?? {})[t];
6508
6510
  }
6509
- function Sn(n) {
6511
+ function _n(n) {
6510
6512
  return n instanceof HTMLElement;
6511
6513
  }
6512
6514
  function Xl(n, t, e, s) {
6513
- const r = N.get(t);
6515
+ const r = F.get(t);
6514
6516
  return {
6515
6517
  ...e,
6516
6518
  data: r.get(s) ?? e.defaultData,
@@ -6562,7 +6564,7 @@ function dr() {
6562
6564
  Q.awareness.getStates().forEach((e, s) => {
6563
6565
  var r;
6564
6566
  for (const [i, o] of Object.entries(e)) {
6565
- const l = F.get(i);
6567
+ const l = O.get(i);
6566
6568
  if (l)
6567
6569
  for (const [c, a] of l) {
6568
6570
  if (!(c in o))
@@ -6577,7 +6579,7 @@ function dr() {
6577
6579
  }
6578
6580
  }
6579
6581
  for (const [i, o] of n) {
6580
- const l = F.get(i);
6582
+ const l = O.get(i);
6581
6583
  if (l)
6582
6584
  for (const [c, a] of l) {
6583
6585
  const h = (r = o.get(c)) == null ? void 0 : r.values();
@@ -6590,24 +6592,23 @@ function dr() {
6590
6592
  });
6591
6593
  }
6592
6594
  function fr() {
6593
- console.log("[PLAYHTML]: Setting up elements... Time to have some fun 🛝"), console.log(Je());
6594
- for (const n of Je()) {
6595
+ for (const n of ur()) {
6595
6596
  const t = Array.from(
6596
6597
  document.querySelectorAll(`[${n}]`)
6597
- ).filter(Sn);
6598
+ ).filter(_n);
6598
6599
  if (t.length)
6599
6600
  for (let e = 0; e < t.length; e++) {
6600
6601
  const s = t[e];
6601
6602
  Se(s, n);
6602
6603
  }
6603
6604
  }
6604
- We && (N.observe((n) => {
6605
+ Je && (F.observe((n) => {
6605
6606
  n.changes.keys.forEach((t, e) => {
6606
- t.action === "add" && N.set(e, N.get(e));
6607
+ t.action === "add" && F.set(e, F.get(e));
6607
6608
  });
6608
- }), Q.awareness.on("change", () => dr()), We = !1);
6609
+ }), Q.awareness.on("change", () => dr()), Je = !1);
6609
6610
  }
6610
- const Ge = {
6611
+ const We = {
6611
6612
  init: zl,
6612
6613
  setupPlayElements: fr,
6613
6614
  setupPlayElement: ql,
@@ -6616,18 +6617,18 @@ const Ge = {
6616
6617
  globalData: void 0,
6617
6618
  elementHandlers: void 0
6618
6619
  };
6619
- window.playhtml = Ge;
6620
+ window.playhtml = We;
6620
6621
  function Gl(n) {
6621
- if (F.has(n) || !_n)
6622
+ if (O.has(n) || !kn)
6622
6623
  return;
6623
- F.set(n, /* @__PURE__ */ new Map()), n !== _e.CanPlay && Jt[n], N.get(n) || N.set(n, new ht());
6624
- const t = N.get(n);
6624
+ O.has(n) || O.set(n, /* @__PURE__ */ new Map()), n !== _e.CanPlay && Jt[n], F.get(n) || F.set(n, new ht());
6625
+ const t = F.get(n);
6625
6626
  t.observe((e) => {
6626
6627
  e.changes.keys.forEach((s, r) => {
6627
- const i = F.get(n);
6628
+ const i = O.get(n);
6628
6629
  if (s.action === "add") {
6629
6630
  const o = document.getElementById(r);
6630
- if (!Sn(o)) {
6631
+ if (!_n(o)) {
6631
6632
  console.log(`Element ${r} not an HTML element. Ignoring.`);
6632
6633
  return;
6633
6634
  }
@@ -6646,13 +6647,13 @@ function Pl(n, t) {
6646
6647
  }
6647
6648
  function Se(n, t) {
6648
6649
  var l;
6649
- if (!Pl(n, t) || !_n)
6650
+ if (!Pl(n, t) || !kn)
6650
6651
  return;
6651
6652
  if (!n.id) {
6652
6653
  const c = n.getAttribute("selector-id");
6653
6654
  if (c) {
6654
- const a = Qn.get(c) ?? 0;
6655
- n.id = btoa(`${t}-${c}-${a}`), Qn.set(c, a + 1);
6655
+ const a = Zn.get(c) ?? 0;
6656
+ n.id = btoa(`${t}-${c}-${a}`), Zn.set(c, a + 1);
6656
6657
  } else
6657
6658
  n.id = btoa(`${t}-${n.innerHTML}}`);
6658
6659
  }
@@ -6664,7 +6665,7 @@ function Se(n, t) {
6664
6665
  return;
6665
6666
  }
6666
6667
  Gl(t);
6667
- const s = F.get(t), r = Wl(
6668
+ const s = O.get(t), r = Wl(
6668
6669
  t,
6669
6670
  n
6670
6671
  );
@@ -6674,7 +6675,7 @@ function Se(n, t) {
6674
6675
  );
6675
6676
  return;
6676
6677
  }
6677
- const i = N.get(t), o = Xl(
6678
+ const i = F.get(t), o = Xl(
6678
6679
  n,
6679
6680
  t,
6680
6681
  r,
@@ -6688,20 +6689,20 @@ function Se(n, t) {
6688
6689
  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;}`);
6689
6690
  }
6690
6691
  function ql(n) {
6691
- if (!Sn(n)) {
6692
+ if (!_n(n)) {
6692
6693
  console.log(`Element ${n.id} not an HTML element. Ignoring.`);
6693
6694
  return;
6694
6695
  }
6695
- for (const t of Je())
6696
+ for (const t of ur())
6696
6697
  n.hasAttribute(t) && Se(n, t);
6697
6698
  }
6698
6699
  function Zl(n) {
6699
6700
  if (!(!n || !n.id))
6700
- for (const t of Object.keys(F)) {
6701
- const e = F.get(t);
6701
+ for (const t of Object.keys(O)) {
6702
+ const e = O.get(t);
6702
6703
  e.has(n.id) && e.delete(n.id);
6703
6704
  }
6704
6705
  }
6705
6706
  export {
6706
- Ge as playhtml
6707
+ We as playhtml
6707
6708
  };