@automerge/automerge-repo-react-hooks 2.5.0-alpha.0 → 2.5.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,381 +1,1242 @@
1
- import q, { createContext as I, useContext as j, useRef as $, useState as E, useEffect as y, useCallback as R } from "react";
2
- function O(s) {
3
- let u = "pending", n, f;
4
- const h = s.then(
5
- (p) => {
6
- u = "success", n = p;
1
+ import ke, { createContext as Oe, useContext as Fe, useRef as qe, useState as X, useEffect as z, useCallback as Le } from "react";
2
+ function Ue(e) {
3
+ let t = "pending", n, H;
4
+ const y = e.then(
5
+ (w) => {
6
+ t = "success", n = w;
7
7
  },
8
- (p) => {
9
- u = "error", f = p;
8
+ (w) => {
9
+ t = "error", H = w;
10
10
  }
11
11
  );
12
12
  return {
13
- promise: s,
13
+ promise: e,
14
14
  read() {
15
- switch (u) {
15
+ switch (t) {
16
16
  case "pending":
17
- throw h;
17
+ throw y;
18
18
  case "error":
19
- throw f;
19
+ throw H;
20
20
  case "success":
21
21
  return n;
22
22
  }
23
23
  }
24
24
  };
25
25
  }
26
- const z = I(null);
27
- function k() {
28
- const s = j(z);
29
- if (!s) throw new Error("Repo was not found on RepoContext.");
30
- return s;
26
+ const Ge = Oe(null);
27
+ function Ve() {
28
+ const e = Fe(Ge);
29
+ if (!e) throw new Error("Repo was not found on RepoContext.");
30
+ return e;
31
31
  }
32
- const x = /* @__PURE__ */ new Map();
33
- function F(s, { suspense: u } = { suspense: !1 }) {
34
- const n = k(), f = $(), [h, p] = E();
35
- let i = h;
36
- if (s && !i) {
37
- const e = n.findWithProgress(s);
38
- e.state === "ready" && (i = e.handle);
32
+ const Pe = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
33
+ function de(e) {
34
+ return typeof e == "string" && Pe.test(e);
35
+ }
36
+ function je(e) {
37
+ if (!de(e))
38
+ throw TypeError("Invalid UUID");
39
+ let t;
40
+ const n = new Uint8Array(16);
41
+ return n[0] = (t = parseInt(e.slice(0, 8), 16)) >>> 24, n[1] = t >>> 16 & 255, n[2] = t >>> 8 & 255, n[3] = t & 255, n[4] = (t = parseInt(e.slice(9, 13), 16)) >>> 8, n[5] = t & 255, n[6] = (t = parseInt(e.slice(14, 18), 16)) >>> 8, n[7] = t & 255, n[8] = (t = parseInt(e.slice(19, 23), 16)) >>> 8, n[9] = t & 255, n[10] = (t = parseInt(e.slice(24, 36), 16)) / 1099511627776 & 255, n[11] = t / 4294967296 & 255, n[12] = t >>> 24 & 255, n[13] = t >>> 16 & 255, n[14] = t >>> 8 & 255, n[15] = t & 255, n;
42
+ }
43
+ function be(e) {
44
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
45
+ }
46
+ var $ = {}, T = {}, P = {}, se = {}, J = {}, pe;
47
+ function We() {
48
+ return pe || (pe = 1, Object.defineProperty(J, "__esModule", { value: !0 }), J.crypto = void 0, J.crypto = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0), J;
49
+ }
50
+ var He;
51
+ function Ce() {
52
+ return He || (He = 1, function(e) {
53
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
54
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.wrapXOFConstructorWithOpts = e.wrapConstructorWithOpts = e.wrapConstructor = e.Hash = e.nextTick = e.swap32IfBE = e.byteSwapIfBE = e.swap8IfBE = e.isLE = void 0, e.isBytes = n, e.anumber = H, e.abytes = y, e.ahash = w, e.aexists = a, e.aoutput = c, e.u8 = s, e.u32 = o, e.clean = i, e.createView = h, e.rotr = m, e.rotl = B, e.byteSwap = f, e.byteSwap32 = g, e.bytesToHex = M, e.hexToBytes = A, e.asyncLoop = L, e.utf8ToBytes = E, e.bytesToUtf8 = u, e.toBytes = l, e.kdfInputToBytes = b, e.concatBytes = C, e.checkOpts = S, e.createHasher = O, e.createOptHasher = F, e.createXOFer = q, e.randomBytes = j;
55
+ const t = /* @__PURE__ */ We();
56
+ function n(r) {
57
+ return r instanceof Uint8Array || ArrayBuffer.isView(r) && r.constructor.name === "Uint8Array";
58
+ }
59
+ function H(r) {
60
+ if (!Number.isSafeInteger(r) || r < 0)
61
+ throw new Error("positive integer expected, got " + r);
62
+ }
63
+ function y(r, ...p) {
64
+ if (!n(r))
65
+ throw new Error("Uint8Array expected");
66
+ if (p.length > 0 && !p.includes(r.length))
67
+ throw new Error("Uint8Array expected of length " + p + ", got length=" + r.length);
68
+ }
69
+ function w(r) {
70
+ if (typeof r != "function" || typeof r.create != "function")
71
+ throw new Error("Hash should be wrapped by utils.createHasher");
72
+ H(r.outputLen), H(r.blockLen);
73
+ }
74
+ function a(r, p = !0) {
75
+ if (r.destroyed)
76
+ throw new Error("Hash instance has been destroyed");
77
+ if (p && r.finished)
78
+ throw new Error("Hash#digest() has already been called");
79
+ }
80
+ function c(r, p) {
81
+ y(r);
82
+ const v = p.outputLen;
83
+ if (r.length < v)
84
+ throw new Error("digestInto() expects output buffer of length at least " + v);
85
+ }
86
+ function s(r) {
87
+ return new Uint8Array(r.buffer, r.byteOffset, r.byteLength);
88
+ }
89
+ function o(r) {
90
+ return new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4));
91
+ }
92
+ function i(...r) {
93
+ for (let p = 0; p < r.length; p++)
94
+ r[p].fill(0);
95
+ }
96
+ function h(r) {
97
+ return new DataView(r.buffer, r.byteOffset, r.byteLength);
98
+ }
99
+ function m(r, p) {
100
+ return r << 32 - p | r >>> p;
101
+ }
102
+ function B(r, p) {
103
+ return r << p | r >>> 32 - p >>> 0;
104
+ }
105
+ e.isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
106
+ function f(r) {
107
+ return r << 24 & 4278190080 | r << 8 & 16711680 | r >>> 8 & 65280 | r >>> 24 & 255;
108
+ }
109
+ e.swap8IfBE = e.isLE ? (r) => r : (r) => f(r), e.byteSwapIfBE = e.swap8IfBE;
110
+ function g(r) {
111
+ for (let p = 0; p < r.length; p++)
112
+ r[p] = f(r[p]);
113
+ return r;
114
+ }
115
+ e.swap32IfBE = e.isLE ? (r) => r : g;
116
+ const d = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", V = /* @__PURE__ */ Array.from({ length: 256 }, (r, p) => p.toString(16).padStart(2, "0"));
117
+ function M(r) {
118
+ if (y(r), d)
119
+ return r.toHex();
120
+ let p = "";
121
+ for (let v = 0; v < r.length; v++)
122
+ p += V[r[v]];
123
+ return p;
124
+ }
125
+ const x = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
126
+ function R(r) {
127
+ if (r >= x._0 && r <= x._9)
128
+ return r - x._0;
129
+ if (r >= x.A && r <= x.F)
130
+ return r - (x.A - 10);
131
+ if (r >= x.a && r <= x.f)
132
+ return r - (x.a - 10);
133
+ }
134
+ function A(r) {
135
+ if (typeof r != "string")
136
+ throw new Error("hex string expected, got " + typeof r);
137
+ if (d)
138
+ return Uint8Array.fromHex(r);
139
+ const p = r.length, v = p / 2;
140
+ if (p % 2)
141
+ throw new Error("hex string expected, got unpadded hex of length " + p);
142
+ const D = new Uint8Array(v);
143
+ for (let k = 0, G = 0; k < v; k++, G += 2) {
144
+ const K = R(r.charCodeAt(G)), W = R(r.charCodeAt(G + 1));
145
+ if (K === void 0 || W === void 0) {
146
+ const N = r[G] + r[G + 1];
147
+ throw new Error('hex string expected, got non-hex character "' + N + '" at index ' + G);
148
+ }
149
+ D[k] = K * 16 + W;
150
+ }
151
+ return D;
152
+ }
153
+ const I = async () => {
154
+ };
155
+ e.nextTick = I;
156
+ async function L(r, p, v) {
157
+ let D = Date.now();
158
+ for (let k = 0; k < r; k++) {
159
+ v(k);
160
+ const G = Date.now() - D;
161
+ G >= 0 && G < p || (await (0, e.nextTick)(), D += G);
162
+ }
163
+ }
164
+ function E(r) {
165
+ if (typeof r != "string")
166
+ throw new Error("string expected");
167
+ return new Uint8Array(new TextEncoder().encode(r));
168
+ }
169
+ function u(r) {
170
+ return new TextDecoder().decode(r);
171
+ }
172
+ function l(r) {
173
+ return typeof r == "string" && (r = E(r)), y(r), r;
174
+ }
175
+ function b(r) {
176
+ return typeof r == "string" && (r = E(r)), y(r), r;
177
+ }
178
+ function C(...r) {
179
+ let p = 0;
180
+ for (let D = 0; D < r.length; D++) {
181
+ const k = r[D];
182
+ y(k), p += k.length;
183
+ }
184
+ const v = new Uint8Array(p);
185
+ for (let D = 0, k = 0; D < r.length; D++) {
186
+ const G = r[D];
187
+ v.set(G, k), k += G.length;
188
+ }
189
+ return v;
190
+ }
191
+ function S(r, p) {
192
+ if (p !== void 0 && {}.toString.call(p) !== "[object Object]")
193
+ throw new Error("options should be object or undefined");
194
+ return Object.assign(r, p);
195
+ }
196
+ class U {
197
+ }
198
+ e.Hash = U;
199
+ function O(r) {
200
+ const p = (D) => r().update(l(D)).digest(), v = r();
201
+ return p.outputLen = v.outputLen, p.blockLen = v.blockLen, p.create = () => r(), p;
202
+ }
203
+ function F(r) {
204
+ const p = (D, k) => r(k).update(l(D)).digest(), v = r({});
205
+ return p.outputLen = v.outputLen, p.blockLen = v.blockLen, p.create = (D) => r(D), p;
206
+ }
207
+ function q(r) {
208
+ const p = (D, k) => r(k).update(l(D)).digest(), v = r({});
209
+ return p.outputLen = v.outputLen, p.blockLen = v.blockLen, p.create = (D) => r(D), p;
210
+ }
211
+ e.wrapConstructor = O, e.wrapConstructorWithOpts = F, e.wrapXOFConstructorWithOpts = q;
212
+ function j(r = 32) {
213
+ if (t.crypto && typeof t.crypto.getRandomValues == "function")
214
+ return t.crypto.getRandomValues(new Uint8Array(r));
215
+ if (t.crypto && typeof t.crypto.randomBytes == "function")
216
+ return Uint8Array.from(t.crypto.randomBytes(r));
217
+ throw new Error("crypto.getRandomValues must be defined");
218
+ }
219
+ }(se)), se;
220
+ }
221
+ var ye;
222
+ function Ne() {
223
+ if (ye) return P;
224
+ ye = 1, Object.defineProperty(P, "__esModule", { value: !0 }), P.SHA512_IV = P.SHA384_IV = P.SHA224_IV = P.SHA256_IV = P.HashMD = void 0, P.setBigUint64 = t, P.Chi = n, P.Maj = H;
225
+ const e = /* @__PURE__ */ Ce();
226
+ function t(w, a, c, s) {
227
+ if (typeof w.setBigUint64 == "function")
228
+ return w.setBigUint64(a, c, s);
229
+ const o = BigInt(32), i = BigInt(4294967295), h = Number(c >> o & i), m = Number(c & i), B = s ? 4 : 0, f = s ? 0 : 4;
230
+ w.setUint32(a + B, h, s), w.setUint32(a + f, m, s);
231
+ }
232
+ function n(w, a, c) {
233
+ return w & a ^ ~w & c;
234
+ }
235
+ function H(w, a, c) {
236
+ return w & a ^ w & c ^ a & c;
237
+ }
238
+ class y extends e.Hash {
239
+ constructor(a, c, s, o) {
240
+ super(), this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.blockLen = a, this.outputLen = c, this.padOffset = s, this.isLE = o, this.buffer = new Uint8Array(a), this.view = (0, e.createView)(this.buffer);
241
+ }
242
+ update(a) {
243
+ (0, e.aexists)(this), a = (0, e.toBytes)(a), (0, e.abytes)(a);
244
+ const { view: c, buffer: s, blockLen: o } = this, i = a.length;
245
+ for (let h = 0; h < i; ) {
246
+ const m = Math.min(o - this.pos, i - h);
247
+ if (m === o) {
248
+ const B = (0, e.createView)(a);
249
+ for (; o <= i - h; h += o)
250
+ this.process(B, h);
251
+ continue;
252
+ }
253
+ s.set(a.subarray(h, h + m), this.pos), this.pos += m, h += m, this.pos === o && (this.process(c, 0), this.pos = 0);
254
+ }
255
+ return this.length += a.length, this.roundClean(), this;
256
+ }
257
+ digestInto(a) {
258
+ (0, e.aexists)(this), (0, e.aoutput)(a, this), this.finished = !0;
259
+ const { buffer: c, view: s, blockLen: o, isLE: i } = this;
260
+ let { pos: h } = this;
261
+ c[h++] = 128, (0, e.clean)(this.buffer.subarray(h)), this.padOffset > o - h && (this.process(s, 0), h = 0);
262
+ for (let d = h; d < o; d++)
263
+ c[d] = 0;
264
+ t(s, o - 8, BigInt(this.length * 8), i), this.process(s, 0);
265
+ const m = (0, e.createView)(a), B = this.outputLen;
266
+ if (B % 4)
267
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
268
+ const f = B / 4, g = this.get();
269
+ if (f > g.length)
270
+ throw new Error("_sha2: outputLen bigger than state");
271
+ for (let d = 0; d < f; d++)
272
+ m.setUint32(4 * d, g[d], i);
273
+ }
274
+ digest() {
275
+ const { buffer: a, outputLen: c } = this;
276
+ this.digestInto(a);
277
+ const s = a.slice(0, c);
278
+ return this.destroy(), s;
279
+ }
280
+ _cloneInto(a) {
281
+ a || (a = new this.constructor()), a.set(...this.get());
282
+ const { blockLen: c, buffer: s, length: o, finished: i, destroyed: h, pos: m } = this;
283
+ return a.destroyed = h, a.finished = i, a.length = o, a.pos = m, o % c && a.buffer.set(s), a;
284
+ }
285
+ clone() {
286
+ return this._cloneInto();
287
+ }
288
+ }
289
+ return P.HashMD = y, P.SHA256_IV = Uint32Array.from([
290
+ 1779033703,
291
+ 3144134277,
292
+ 1013904242,
293
+ 2773480762,
294
+ 1359893119,
295
+ 2600822924,
296
+ 528734635,
297
+ 1541459225
298
+ ]), P.SHA224_IV = Uint32Array.from([
299
+ 3238371032,
300
+ 914150663,
301
+ 812702999,
302
+ 4144912697,
303
+ 4290775857,
304
+ 1750603025,
305
+ 1694076839,
306
+ 3204075428
307
+ ]), P.SHA384_IV = Uint32Array.from([
308
+ 3418070365,
309
+ 3238371032,
310
+ 1654270250,
311
+ 914150663,
312
+ 2438529370,
313
+ 812702999,
314
+ 355462360,
315
+ 4144912697,
316
+ 1731405415,
317
+ 4290775857,
318
+ 2394180231,
319
+ 1750603025,
320
+ 3675008525,
321
+ 1694076839,
322
+ 1203062813,
323
+ 3204075428
324
+ ]), P.SHA512_IV = Uint32Array.from([
325
+ 1779033703,
326
+ 4089235720,
327
+ 3144134277,
328
+ 2227873595,
329
+ 1013904242,
330
+ 4271175723,
331
+ 2773480762,
332
+ 1595750129,
333
+ 1359893119,
334
+ 2917565137,
335
+ 2600822924,
336
+ 725511199,
337
+ 528734635,
338
+ 4215389547,
339
+ 1541459225,
340
+ 327033209
341
+ ]), P;
342
+ }
343
+ var _ = {}, Ae;
344
+ function $e() {
345
+ if (Ae) return _;
346
+ Ae = 1, Object.defineProperty(_, "__esModule", { value: !0 }), _.toBig = _.shrSL = _.shrSH = _.rotrSL = _.rotrSH = _.rotrBL = _.rotrBH = _.rotr32L = _.rotr32H = _.rotlSL = _.rotlSH = _.rotlBL = _.rotlBH = _.add5L = _.add5H = _.add4L = _.add4H = _.add3L = _.add3H = void 0, _.add = V, _.fromBig = n, _.split = H;
347
+ const e = /* @__PURE__ */ BigInt(2 ** 32 - 1), t = /* @__PURE__ */ BigInt(32);
348
+ function n(u, l = !1) {
349
+ return l ? { h: Number(u & e), l: Number(u >> t & e) } : { h: Number(u >> t & e) | 0, l: Number(u & e) | 0 };
39
350
  }
40
- let r = s ? x.get(s) : void 0;
41
- if (!r && s) {
42
- f.current?.abort(), f.current = new AbortController();
43
- const e = n.find(s, { signal: f.current.signal });
44
- r = O(e), x.set(s, r);
351
+ function H(u, l = !1) {
352
+ const b = u.length;
353
+ let C = new Uint32Array(b), S = new Uint32Array(b);
354
+ for (let U = 0; U < b; U++) {
355
+ const { h: O, l: F } = n(u[U], l);
356
+ [C[U], S[U]] = [O, F];
357
+ }
358
+ return [C, S];
45
359
  }
46
- return y(() => {
47
- i || u || !r || r.promise.then((e) => {
48
- p(e);
360
+ const y = (u, l) => BigInt(u >>> 0) << t | BigInt(l >>> 0);
361
+ _.toBig = y;
362
+ const w = (u, l, b) => u >>> b;
363
+ _.shrSH = w;
364
+ const a = (u, l, b) => u << 32 - b | l >>> b;
365
+ _.shrSL = a;
366
+ const c = (u, l, b) => u >>> b | l << 32 - b;
367
+ _.rotrSH = c;
368
+ const s = (u, l, b) => u << 32 - b | l >>> b;
369
+ _.rotrSL = s;
370
+ const o = (u, l, b) => u << 64 - b | l >>> b - 32;
371
+ _.rotrBH = o;
372
+ const i = (u, l, b) => u >>> b - 32 | l << 64 - b;
373
+ _.rotrBL = i;
374
+ const h = (u, l) => l;
375
+ _.rotr32H = h;
376
+ const m = (u, l) => u;
377
+ _.rotr32L = m;
378
+ const B = (u, l, b) => u << b | l >>> 32 - b;
379
+ _.rotlSH = B;
380
+ const f = (u, l, b) => l << b | u >>> 32 - b;
381
+ _.rotlSL = f;
382
+ const g = (u, l, b) => l << b - 32 | u >>> 64 - b;
383
+ _.rotlBH = g;
384
+ const d = (u, l, b) => u << b - 32 | l >>> 64 - b;
385
+ _.rotlBL = d;
386
+ function V(u, l, b, C) {
387
+ const S = (l >>> 0) + (C >>> 0);
388
+ return { h: u + b + (S / 2 ** 32 | 0) | 0, l: S | 0 };
389
+ }
390
+ const M = (u, l, b) => (u >>> 0) + (l >>> 0) + (b >>> 0);
391
+ _.add3L = M;
392
+ const x = (u, l, b, C) => l + b + C + (u / 2 ** 32 | 0) | 0;
393
+ _.add3H = x;
394
+ const R = (u, l, b, C) => (u >>> 0) + (l >>> 0) + (b >>> 0) + (C >>> 0);
395
+ _.add4L = R;
396
+ const A = (u, l, b, C, S) => l + b + C + S + (u / 2 ** 32 | 0) | 0;
397
+ _.add4H = A;
398
+ const I = (u, l, b, C, S) => (u >>> 0) + (l >>> 0) + (b >>> 0) + (C >>> 0) + (S >>> 0);
399
+ _.add5L = I;
400
+ const L = (u, l, b, C, S, U) => l + b + C + S + U + (u / 2 ** 32 | 0) | 0;
401
+ _.add5H = L;
402
+ const E = {
403
+ fromBig: n,
404
+ split: H,
405
+ toBig: y,
406
+ shrSH: w,
407
+ shrSL: a,
408
+ rotrSH: c,
409
+ rotrSL: s,
410
+ rotrBH: o,
411
+ rotrBL: i,
412
+ rotr32H: h,
413
+ rotr32L: m,
414
+ rotlSH: B,
415
+ rotlSL: f,
416
+ rotlBH: g,
417
+ rotlBL: d,
418
+ add: V,
419
+ add3L: M,
420
+ add3H: x,
421
+ add4L: R,
422
+ add4H: A,
423
+ add5H: L,
424
+ add5L: I
425
+ };
426
+ return _.default = E, _;
427
+ }
428
+ var we;
429
+ function ze() {
430
+ if (we) return T;
431
+ we = 1, Object.defineProperty(T, "__esModule", { value: !0 }), T.sha512_224 = T.sha512_256 = T.sha384 = T.sha512 = T.sha224 = T.sha256 = T.SHA512_256 = T.SHA512_224 = T.SHA384 = T.SHA512 = T.SHA224 = T.SHA256 = void 0;
432
+ const e = /* @__PURE__ */ Ne(), t = /* @__PURE__ */ $e(), n = /* @__PURE__ */ Ce(), H = /* @__PURE__ */ Uint32Array.from([
433
+ 1116352408,
434
+ 1899447441,
435
+ 3049323471,
436
+ 3921009573,
437
+ 961987163,
438
+ 1508970993,
439
+ 2453635748,
440
+ 2870763221,
441
+ 3624381080,
442
+ 310598401,
443
+ 607225278,
444
+ 1426881987,
445
+ 1925078388,
446
+ 2162078206,
447
+ 2614888103,
448
+ 3248222580,
449
+ 3835390401,
450
+ 4022224774,
451
+ 264347078,
452
+ 604807628,
453
+ 770255983,
454
+ 1249150122,
455
+ 1555081692,
456
+ 1996064986,
457
+ 2554220882,
458
+ 2821834349,
459
+ 2952996808,
460
+ 3210313671,
461
+ 3336571891,
462
+ 3584528711,
463
+ 113926993,
464
+ 338241895,
465
+ 666307205,
466
+ 773529912,
467
+ 1294757372,
468
+ 1396182291,
469
+ 1695183700,
470
+ 1986661051,
471
+ 2177026350,
472
+ 2456956037,
473
+ 2730485921,
474
+ 2820302411,
475
+ 3259730800,
476
+ 3345764771,
477
+ 3516065817,
478
+ 3600352804,
479
+ 4094571909,
480
+ 275423344,
481
+ 430227734,
482
+ 506948616,
483
+ 659060556,
484
+ 883997877,
485
+ 958139571,
486
+ 1322822218,
487
+ 1537002063,
488
+ 1747873779,
489
+ 1955562222,
490
+ 2024104815,
491
+ 2227730452,
492
+ 2361852424,
493
+ 2428436474,
494
+ 2756734187,
495
+ 3204031479,
496
+ 3329325298
497
+ ]), y = /* @__PURE__ */ new Uint32Array(64);
498
+ class w extends e.HashMD {
499
+ constructor(x = 32) {
500
+ super(64, x, 8, !1), this.A = e.SHA256_IV[0] | 0, this.B = e.SHA256_IV[1] | 0, this.C = e.SHA256_IV[2] | 0, this.D = e.SHA256_IV[3] | 0, this.E = e.SHA256_IV[4] | 0, this.F = e.SHA256_IV[5] | 0, this.G = e.SHA256_IV[6] | 0, this.H = e.SHA256_IV[7] | 0;
501
+ }
502
+ get() {
503
+ const { A: x, B: R, C: A, D: I, E: L, F: E, G: u, H: l } = this;
504
+ return [x, R, A, I, L, E, u, l];
505
+ }
506
+ // prettier-ignore
507
+ set(x, R, A, I, L, E, u, l) {
508
+ this.A = x | 0, this.B = R | 0, this.C = A | 0, this.D = I | 0, this.E = L | 0, this.F = E | 0, this.G = u | 0, this.H = l | 0;
509
+ }
510
+ process(x, R) {
511
+ for (let S = 0; S < 16; S++, R += 4)
512
+ y[S] = x.getUint32(R, !1);
513
+ for (let S = 16; S < 64; S++) {
514
+ const U = y[S - 15], O = y[S - 2], F = (0, n.rotr)(U, 7) ^ (0, n.rotr)(U, 18) ^ U >>> 3, q = (0, n.rotr)(O, 17) ^ (0, n.rotr)(O, 19) ^ O >>> 10;
515
+ y[S] = q + y[S - 7] + F + y[S - 16] | 0;
516
+ }
517
+ let { A, B: I, C: L, D: E, E: u, F: l, G: b, H: C } = this;
518
+ for (let S = 0; S < 64; S++) {
519
+ const U = (0, n.rotr)(u, 6) ^ (0, n.rotr)(u, 11) ^ (0, n.rotr)(u, 25), O = C + U + (0, e.Chi)(u, l, b) + H[S] + y[S] | 0, q = ((0, n.rotr)(A, 2) ^ (0, n.rotr)(A, 13) ^ (0, n.rotr)(A, 22)) + (0, e.Maj)(A, I, L) | 0;
520
+ C = b, b = l, l = u, u = E + O | 0, E = L, L = I, I = A, A = O + q | 0;
521
+ }
522
+ A = A + this.A | 0, I = I + this.B | 0, L = L + this.C | 0, E = E + this.D | 0, u = u + this.E | 0, l = l + this.F | 0, b = b + this.G | 0, C = C + this.H | 0, this.set(A, I, L, E, u, l, b, C);
523
+ }
524
+ roundClean() {
525
+ (0, n.clean)(y);
526
+ }
527
+ destroy() {
528
+ this.set(0, 0, 0, 0, 0, 0, 0, 0), (0, n.clean)(this.buffer);
529
+ }
530
+ }
531
+ T.SHA256 = w;
532
+ class a extends w {
533
+ constructor() {
534
+ super(28), this.A = e.SHA224_IV[0] | 0, this.B = e.SHA224_IV[1] | 0, this.C = e.SHA224_IV[2] | 0, this.D = e.SHA224_IV[3] | 0, this.E = e.SHA224_IV[4] | 0, this.F = e.SHA224_IV[5] | 0, this.G = e.SHA224_IV[6] | 0, this.H = e.SHA224_IV[7] | 0;
535
+ }
536
+ }
537
+ T.SHA224 = a;
538
+ const c = t.split([
539
+ "0x428a2f98d728ae22",
540
+ "0x7137449123ef65cd",
541
+ "0xb5c0fbcfec4d3b2f",
542
+ "0xe9b5dba58189dbbc",
543
+ "0x3956c25bf348b538",
544
+ "0x59f111f1b605d019",
545
+ "0x923f82a4af194f9b",
546
+ "0xab1c5ed5da6d8118",
547
+ "0xd807aa98a3030242",
548
+ "0x12835b0145706fbe",
549
+ "0x243185be4ee4b28c",
550
+ "0x550c7dc3d5ffb4e2",
551
+ "0x72be5d74f27b896f",
552
+ "0x80deb1fe3b1696b1",
553
+ "0x9bdc06a725c71235",
554
+ "0xc19bf174cf692694",
555
+ "0xe49b69c19ef14ad2",
556
+ "0xefbe4786384f25e3",
557
+ "0x0fc19dc68b8cd5b5",
558
+ "0x240ca1cc77ac9c65",
559
+ "0x2de92c6f592b0275",
560
+ "0x4a7484aa6ea6e483",
561
+ "0x5cb0a9dcbd41fbd4",
562
+ "0x76f988da831153b5",
563
+ "0x983e5152ee66dfab",
564
+ "0xa831c66d2db43210",
565
+ "0xb00327c898fb213f",
566
+ "0xbf597fc7beef0ee4",
567
+ "0xc6e00bf33da88fc2",
568
+ "0xd5a79147930aa725",
569
+ "0x06ca6351e003826f",
570
+ "0x142929670a0e6e70",
571
+ "0x27b70a8546d22ffc",
572
+ "0x2e1b21385c26c926",
573
+ "0x4d2c6dfc5ac42aed",
574
+ "0x53380d139d95b3df",
575
+ "0x650a73548baf63de",
576
+ "0x766a0abb3c77b2a8",
577
+ "0x81c2c92e47edaee6",
578
+ "0x92722c851482353b",
579
+ "0xa2bfe8a14cf10364",
580
+ "0xa81a664bbc423001",
581
+ "0xc24b8b70d0f89791",
582
+ "0xc76c51a30654be30",
583
+ "0xd192e819d6ef5218",
584
+ "0xd69906245565a910",
585
+ "0xf40e35855771202a",
586
+ "0x106aa07032bbd1b8",
587
+ "0x19a4c116b8d2d0c8",
588
+ "0x1e376c085141ab53",
589
+ "0x2748774cdf8eeb99",
590
+ "0x34b0bcb5e19b48a8",
591
+ "0x391c0cb3c5c95a63",
592
+ "0x4ed8aa4ae3418acb",
593
+ "0x5b9cca4f7763e373",
594
+ "0x682e6ff3d6b2b8a3",
595
+ "0x748f82ee5defb2fc",
596
+ "0x78a5636f43172f60",
597
+ "0x84c87814a1f0ab72",
598
+ "0x8cc702081a6439ec",
599
+ "0x90befffa23631e28",
600
+ "0xa4506cebde82bde9",
601
+ "0xbef9a3f7b2c67915",
602
+ "0xc67178f2e372532b",
603
+ "0xca273eceea26619c",
604
+ "0xd186b8c721c0c207",
605
+ "0xeada7dd6cde0eb1e",
606
+ "0xf57d4f7fee6ed178",
607
+ "0x06f067aa72176fba",
608
+ "0x0a637dc5a2c898a6",
609
+ "0x113f9804bef90dae",
610
+ "0x1b710b35131c471b",
611
+ "0x28db77f523047d84",
612
+ "0x32caab7b40c72493",
613
+ "0x3c9ebe0a15c9bebc",
614
+ "0x431d67c49c100d4c",
615
+ "0x4cc5d4becb3e42b6",
616
+ "0x597f299cfc657e2a",
617
+ "0x5fcb6fab3ad6faec",
618
+ "0x6c44198c4a475817"
619
+ ].map((M) => BigInt(M))), s = c[0], o = c[1], i = /* @__PURE__ */ new Uint32Array(80), h = /* @__PURE__ */ new Uint32Array(80);
620
+ class m extends e.HashMD {
621
+ constructor(x = 64) {
622
+ super(128, x, 16, !1), this.Ah = e.SHA512_IV[0] | 0, this.Al = e.SHA512_IV[1] | 0, this.Bh = e.SHA512_IV[2] | 0, this.Bl = e.SHA512_IV[3] | 0, this.Ch = e.SHA512_IV[4] | 0, this.Cl = e.SHA512_IV[5] | 0, this.Dh = e.SHA512_IV[6] | 0, this.Dl = e.SHA512_IV[7] | 0, this.Eh = e.SHA512_IV[8] | 0, this.El = e.SHA512_IV[9] | 0, this.Fh = e.SHA512_IV[10] | 0, this.Fl = e.SHA512_IV[11] | 0, this.Gh = e.SHA512_IV[12] | 0, this.Gl = e.SHA512_IV[13] | 0, this.Hh = e.SHA512_IV[14] | 0, this.Hl = e.SHA512_IV[15] | 0;
623
+ }
624
+ // prettier-ignore
625
+ get() {
626
+ const { Ah: x, Al: R, Bh: A, Bl: I, Ch: L, Cl: E, Dh: u, Dl: l, Eh: b, El: C, Fh: S, Fl: U, Gh: O, Gl: F, Hh: q, Hl: j } = this;
627
+ return [x, R, A, I, L, E, u, l, b, C, S, U, O, F, q, j];
628
+ }
629
+ // prettier-ignore
630
+ set(x, R, A, I, L, E, u, l, b, C, S, U, O, F, q, j) {
631
+ this.Ah = x | 0, this.Al = R | 0, this.Bh = A | 0, this.Bl = I | 0, this.Ch = L | 0, this.Cl = E | 0, this.Dh = u | 0, this.Dl = l | 0, this.Eh = b | 0, this.El = C | 0, this.Fh = S | 0, this.Fl = U | 0, this.Gh = O | 0, this.Gl = F | 0, this.Hh = q | 0, this.Hl = j | 0;
632
+ }
633
+ process(x, R) {
634
+ for (let v = 0; v < 16; v++, R += 4)
635
+ i[v] = x.getUint32(R), h[v] = x.getUint32(R += 4);
636
+ for (let v = 16; v < 80; v++) {
637
+ const D = i[v - 15] | 0, k = h[v - 15] | 0, G = t.rotrSH(D, k, 1) ^ t.rotrSH(D, k, 8) ^ t.shrSH(D, k, 7), K = t.rotrSL(D, k, 1) ^ t.rotrSL(D, k, 8) ^ t.shrSL(D, k, 7), W = i[v - 2] | 0, N = h[v - 2] | 0, Y = t.rotrSH(W, N, 19) ^ t.rotrBH(W, N, 61) ^ t.shrSH(W, N, 6), re = t.rotrSL(W, N, 19) ^ t.rotrBL(W, N, 61) ^ t.shrSL(W, N, 6), Z = t.add4L(K, re, h[v - 7], h[v - 16]), ne = t.add4H(Z, G, Y, i[v - 7], i[v - 16]);
638
+ i[v] = ne | 0, h[v] = Z | 0;
639
+ }
640
+ let { Ah: A, Al: I, Bh: L, Bl: E, Ch: u, Cl: l, Dh: b, Dl: C, Eh: S, El: U, Fh: O, Fl: F, Gh: q, Gl: j, Hh: r, Hl: p } = this;
641
+ for (let v = 0; v < 80; v++) {
642
+ const D = t.rotrSH(S, U, 14) ^ t.rotrSH(S, U, 18) ^ t.rotrBH(S, U, 41), k = t.rotrSL(S, U, 14) ^ t.rotrSL(S, U, 18) ^ t.rotrBL(S, U, 41), G = S & O ^ ~S & q, K = U & F ^ ~U & j, W = t.add5L(p, k, K, o[v], h[v]), N = t.add5H(W, r, D, G, s[v], i[v]), Y = W | 0, re = t.rotrSH(A, I, 28) ^ t.rotrBH(A, I, 34) ^ t.rotrBH(A, I, 39), Z = t.rotrSL(A, I, 28) ^ t.rotrBL(A, I, 34) ^ t.rotrBL(A, I, 39), ne = A & L ^ A & u ^ L & u, Te = I & E ^ I & l ^ E & l;
643
+ r = q | 0, p = j | 0, q = O | 0, j = F | 0, O = S | 0, F = U | 0, { h: S, l: U } = t.add(b | 0, C | 0, N | 0, Y | 0), b = u | 0, C = l | 0, u = L | 0, l = E | 0, L = A | 0, E = I | 0;
644
+ const xe = t.add3L(Y, Z, Te);
645
+ A = t.add3H(xe, N, re, ne), I = xe | 0;
646
+ }
647
+ ({ h: A, l: I } = t.add(this.Ah | 0, this.Al | 0, A | 0, I | 0)), { h: L, l: E } = t.add(this.Bh | 0, this.Bl | 0, L | 0, E | 0), { h: u, l } = t.add(this.Ch | 0, this.Cl | 0, u | 0, l | 0), { h: b, l: C } = t.add(this.Dh | 0, this.Dl | 0, b | 0, C | 0), { h: S, l: U } = t.add(this.Eh | 0, this.El | 0, S | 0, U | 0), { h: O, l: F } = t.add(this.Fh | 0, this.Fl | 0, O | 0, F | 0), { h: q, l: j } = t.add(this.Gh | 0, this.Gl | 0, q | 0, j | 0), { h: r, l: p } = t.add(this.Hh | 0, this.Hl | 0, r | 0, p | 0), this.set(A, I, L, E, u, l, b, C, S, U, O, F, q, j, r, p);
648
+ }
649
+ roundClean() {
650
+ (0, n.clean)(i, h);
651
+ }
652
+ destroy() {
653
+ (0, n.clean)(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
654
+ }
655
+ }
656
+ T.SHA512 = m;
657
+ class B extends m {
658
+ constructor() {
659
+ super(48), this.Ah = e.SHA384_IV[0] | 0, this.Al = e.SHA384_IV[1] | 0, this.Bh = e.SHA384_IV[2] | 0, this.Bl = e.SHA384_IV[3] | 0, this.Ch = e.SHA384_IV[4] | 0, this.Cl = e.SHA384_IV[5] | 0, this.Dh = e.SHA384_IV[6] | 0, this.Dl = e.SHA384_IV[7] | 0, this.Eh = e.SHA384_IV[8] | 0, this.El = e.SHA384_IV[9] | 0, this.Fh = e.SHA384_IV[10] | 0, this.Fl = e.SHA384_IV[11] | 0, this.Gh = e.SHA384_IV[12] | 0, this.Gl = e.SHA384_IV[13] | 0, this.Hh = e.SHA384_IV[14] | 0, this.Hl = e.SHA384_IV[15] | 0;
660
+ }
661
+ }
662
+ T.SHA384 = B;
663
+ const f = /* @__PURE__ */ Uint32Array.from([
664
+ 2352822216,
665
+ 424955298,
666
+ 1944164710,
667
+ 2312950998,
668
+ 502970286,
669
+ 855612546,
670
+ 1738396948,
671
+ 1479516111,
672
+ 258812777,
673
+ 2077511080,
674
+ 2011393907,
675
+ 79989058,
676
+ 1067287976,
677
+ 1780299464,
678
+ 286451373,
679
+ 2446758561
680
+ ]), g = /* @__PURE__ */ Uint32Array.from([
681
+ 573645204,
682
+ 4230739756,
683
+ 2673172387,
684
+ 3360449730,
685
+ 596883563,
686
+ 1867755857,
687
+ 2520282905,
688
+ 1497426621,
689
+ 2519219938,
690
+ 2827943907,
691
+ 3193839141,
692
+ 1401305490,
693
+ 721525244,
694
+ 746961066,
695
+ 246885852,
696
+ 2177182882
697
+ ]);
698
+ class d extends m {
699
+ constructor() {
700
+ super(28), this.Ah = f[0] | 0, this.Al = f[1] | 0, this.Bh = f[2] | 0, this.Bl = f[3] | 0, this.Ch = f[4] | 0, this.Cl = f[5] | 0, this.Dh = f[6] | 0, this.Dl = f[7] | 0, this.Eh = f[8] | 0, this.El = f[9] | 0, this.Fh = f[10] | 0, this.Fl = f[11] | 0, this.Gh = f[12] | 0, this.Gl = f[13] | 0, this.Hh = f[14] | 0, this.Hl = f[15] | 0;
701
+ }
702
+ }
703
+ T.SHA512_224 = d;
704
+ class V extends m {
705
+ constructor() {
706
+ super(32), this.Ah = g[0] | 0, this.Al = g[1] | 0, this.Bh = g[2] | 0, this.Bl = g[3] | 0, this.Ch = g[4] | 0, this.Cl = g[5] | 0, this.Dh = g[6] | 0, this.Dl = g[7] | 0, this.Eh = g[8] | 0, this.El = g[9] | 0, this.Fh = g[10] | 0, this.Fl = g[11] | 0, this.Gh = g[12] | 0, this.Gl = g[13] | 0, this.Hh = g[14] | 0, this.Hl = g[15] | 0;
707
+ }
708
+ }
709
+ return T.SHA512_256 = V, T.sha256 = (0, n.createHasher)(() => new w()), T.sha224 = (0, n.createHasher)(() => new a()), T.sha512 = (0, n.createHasher)(() => new m()), T.sha384 = (0, n.createHasher)(() => new B()), T.sha512_256 = (0, n.createHasher)(() => new V()), T.sha512_224 = (0, n.createHasher)(() => new d()), T;
710
+ }
711
+ var ge;
712
+ function Ke() {
713
+ if (ge) return $;
714
+ ge = 1, Object.defineProperty($, "__esModule", { value: !0 }), $.sha224 = $.SHA224 = $.sha256 = $.SHA256 = void 0;
715
+ const e = /* @__PURE__ */ ze();
716
+ return $.SHA256 = e.SHA256, $.sha256 = e.sha256, $.SHA224 = e.SHA224, $.sha224 = e.sha224, $;
717
+ }
718
+ var oe, ve;
719
+ function Xe() {
720
+ if (ve) return oe;
721
+ ve = 1;
722
+ function e(t) {
723
+ if (t.length >= 255)
724
+ throw new TypeError("Alphabet too long");
725
+ for (var n = new Uint8Array(256), H = 0; H < n.length; H++)
726
+ n[H] = 255;
727
+ for (var y = 0; y < t.length; y++) {
728
+ var w = t.charAt(y), a = w.charCodeAt(0);
729
+ if (n[a] !== 255)
730
+ throw new TypeError(w + " is ambiguous");
731
+ n[a] = y;
732
+ }
733
+ var c = t.length, s = t.charAt(0), o = Math.log(c) / Math.log(256), i = Math.log(256) / Math.log(c);
734
+ function h(f) {
735
+ if (f instanceof Uint8Array || (ArrayBuffer.isView(f) ? f = new Uint8Array(f.buffer, f.byteOffset, f.byteLength) : Array.isArray(f) && (f = Uint8Array.from(f))), !(f instanceof Uint8Array))
736
+ throw new TypeError("Expected Uint8Array");
737
+ if (f.length === 0)
738
+ return "";
739
+ for (var g = 0, d = 0, V = 0, M = f.length; V !== M && f[V] === 0; )
740
+ V++, g++;
741
+ for (var x = (M - V) * i + 1 >>> 0, R = new Uint8Array(x); V !== M; ) {
742
+ for (var A = f[V], I = 0, L = x - 1; (A !== 0 || I < d) && L !== -1; L--, I++)
743
+ A += 256 * R[L] >>> 0, R[L] = A % c >>> 0, A = A / c >>> 0;
744
+ if (A !== 0)
745
+ throw new Error("Non-zero carry");
746
+ d = I, V++;
747
+ }
748
+ for (var E = x - d; E !== x && R[E] === 0; )
749
+ E++;
750
+ for (var u = s.repeat(g); E < x; ++E)
751
+ u += t.charAt(R[E]);
752
+ return u;
753
+ }
754
+ function m(f) {
755
+ if (typeof f != "string")
756
+ throw new TypeError("Expected String");
757
+ if (f.length === 0)
758
+ return new Uint8Array();
759
+ for (var g = 0, d = 0, V = 0; f[g] === s; )
760
+ d++, g++;
761
+ for (var M = (f.length - g) * o + 1 >>> 0, x = new Uint8Array(M); f[g]; ) {
762
+ var R = f.charCodeAt(g);
763
+ if (R > 255)
764
+ return;
765
+ var A = n[R];
766
+ if (A === 255)
767
+ return;
768
+ for (var I = 0, L = M - 1; (A !== 0 || I < V) && L !== -1; L--, I++)
769
+ A += c * x[L] >>> 0, x[L] = A % 256 >>> 0, A = A / 256 >>> 0;
770
+ if (A !== 0)
771
+ throw new Error("Non-zero carry");
772
+ V = I, g++;
773
+ }
774
+ for (var E = M - V; E !== M && x[E] === 0; )
775
+ E++;
776
+ for (var u = new Uint8Array(d + (M - E)), l = d; E !== M; )
777
+ u[l++] = x[E++];
778
+ return u;
779
+ }
780
+ function B(f) {
781
+ var g = m(f);
782
+ if (g)
783
+ return g;
784
+ throw new Error("Non-base" + c + " character");
785
+ }
786
+ return {
787
+ encode: h,
788
+ decodeUnsafe: m,
789
+ decode: B
790
+ };
791
+ }
792
+ return oe = e, oe;
793
+ }
794
+ var ce, Se;
795
+ function Je() {
796
+ return Se || (Se = 1, ce = Xe()("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")), ce;
797
+ }
798
+ var ae, _e;
799
+ function Qe() {
800
+ if (_e) return ae;
801
+ _e = 1;
802
+ var e = Je();
803
+ return ae = function(t) {
804
+ function n(a) {
805
+ var c = Uint8Array.from(a), s = t(c), o = c.length + 4, i = new Uint8Array(o);
806
+ return i.set(c, 0), i.set(s.subarray(0, 4), c.length), e.encode(i, o);
807
+ }
808
+ function H(a) {
809
+ var c = a.slice(0, -4), s = a.slice(-4), o = t(c);
810
+ if (!(s[0] ^ o[0] | s[1] ^ o[1] | s[2] ^ o[2] | s[3] ^ o[3]))
811
+ return c;
812
+ }
813
+ function y(a) {
814
+ var c = e.decodeUnsafe(a);
815
+ if (c)
816
+ return H(c);
817
+ }
818
+ function w(a) {
819
+ var c = e.decode(a), s = H(c);
820
+ if (!s) throw new Error("Invalid checksum");
821
+ return s;
822
+ }
823
+ return {
824
+ encode: n,
825
+ decode: w,
826
+ decodeUnsafe: y
827
+ };
828
+ }, ae;
829
+ }
830
+ var ie, me;
831
+ function Ye() {
832
+ if (me) return ie;
833
+ me = 1;
834
+ var { sha256: e } = /* @__PURE__ */ Ke(), t = Qe();
835
+ function n(H) {
836
+ return e(e(H));
837
+ }
838
+ return ie = t(n), ie;
839
+ }
840
+ var Ze = Ye();
841
+ const Q = /* @__PURE__ */ be(Ze), et = (e) => Array.from(e, (t) => t.toString(16).padStart(2, "0")).join(""), ee = "automerge:", tt = (e) => {
842
+ const [t, n, ...H] = e.split("#");
843
+ if (H.length > 0)
844
+ throw new Error("Invalid URL: contains multiple heads sections");
845
+ const y = new RegExp(`^${ee}(\\w+)$`), [, w] = t.match(y) || [], a = w, c = Re(a);
846
+ if (!c)
847
+ throw new Error("Invalid document URL: " + e);
848
+ if (n === void 0)
849
+ return { binaryDocumentId: c, documentId: a };
850
+ const s = n === "" ? [] : n.split("|"), o = s.map((i) => {
851
+ try {
852
+ return et(Q.decode(i));
853
+ } catch {
854
+ throw new Error(`Invalid head in URL: ${i}`);
855
+ }
856
+ });
857
+ return { binaryDocumentId: c, hexHeads: o, documentId: a, heads: s };
858
+ }, De = (e) => {
859
+ if (e instanceof Uint8Array || typeof e == "string")
860
+ return ee + (e instanceof Uint8Array ? Ie(e) : e);
861
+ const { documentId: t, heads: n = void 0 } = e;
862
+ if (t === void 0)
863
+ throw new Error("Invalid documentId: " + t);
864
+ const H = t instanceof Uint8Array ? Ie(t) : t;
865
+ let y = `${ee}${H}`;
866
+ return n !== void 0 && (n.forEach((w) => {
867
+ try {
868
+ Q.decode(w);
869
+ } catch {
870
+ throw new Error(`Invalid head: ${w}`);
871
+ }
872
+ }), y += "#" + n.join("|")), y;
873
+ }, rt = (e) => nt(e) ? e : Me(e) ? De({ documentId: e }) : st(e) ? ot(e) : void 0, nt = (e) => {
874
+ if (typeof e != "string" || !e || !e.startsWith(ee))
875
+ return !1;
876
+ try {
877
+ const { documentId: t, heads: n } = tt(e);
878
+ return !(!Me(t) || n && !n.every((H) => {
879
+ try {
880
+ return Q.decode(H), !0;
881
+ } catch {
882
+ return !1;
883
+ }
884
+ }));
885
+ } catch {
886
+ return !1;
887
+ }
888
+ }, Me = (e) => typeof e != "string" ? !1 : Re(e) !== void 0, st = (e) => typeof e == "string" && de(e), Re = (e) => Q.decodeUnsafe(e), Ie = (e) => Q.encode(e), ot = (e) => {
889
+ if (!de(e))
890
+ return;
891
+ const t = je(e);
892
+ return De({ documentId: t });
893
+ }, te = /* @__PURE__ */ new Map();
894
+ function ct(e, { suspense: t } = { suspense: !1 }) {
895
+ const n = Ve(), H = qe(), [y, w] = X();
896
+ let a = (
897
+ // make sure the handle matches the id
898
+ e && y && y.url === rt(e) ? y : void 0
899
+ );
900
+ if (e && !a) {
901
+ const s = n.findWithProgress(e);
902
+ s.state === "ready" && (a = s.handle);
903
+ }
904
+ let c = e ? te.get(e) : void 0;
905
+ if (!c && e) {
906
+ H.current?.abort(), H.current = new AbortController();
907
+ const s = n.find(e, { signal: H.current.signal });
908
+ c = Ue(s), te.set(e, c);
909
+ }
910
+ return z(() => {
911
+ a || t || !c || c.promise.then((s) => {
912
+ w(s);
49
913
  }).catch(() => {
50
- p(void 0);
914
+ w(void 0);
51
915
  });
52
- }, [i, u, r]), i || !u || !r ? i : r.read();
916
+ }, [a, t, c]), a || !t || !c ? a : c.read();
53
917
  }
54
- function X(s, u = { suspense: !1 }) {
55
- const n = F(s, u), [f, h] = E(() => n?.doc()), [p, i] = E();
56
- y(() => {
57
- h(n?.doc());
58
- }, [n]), y(() => {
918
+ function pt(e, t = { suspense: !1 }) {
919
+ const n = ct(e, t), [H, y] = X(() => n?.doc()), [w, a] = X();
920
+ z(() => {
921
+ y(n?.doc());
922
+ }, [n]), z(() => {
59
923
  if (!n)
60
924
  return;
61
- const e = () => h(n.doc()), t = () => {
62
- i(new Error(`Document ${s} was deleted`));
925
+ const s = () => y(n.doc()), o = () => {
926
+ a(new Error(`Document ${e} was deleted`));
63
927
  };
64
- return n.on("change", e), n.on("delete", t), () => {
65
- n.removeListener("change", e), n.removeListener("delete", t);
928
+ return n.on("change", s), n.on("delete", o), () => {
929
+ n.removeListener("change", s), n.removeListener("delete", o);
66
930
  };
67
- }, [n, s]);
68
- const r = R(
69
- (e, t) => {
70
- n.change(e, t);
931
+ }, [n, e]);
932
+ const c = Le(
933
+ (s, o) => {
934
+ n.change(s, o);
71
935
  },
72
936
  [n]
73
937
  );
74
- if (p)
75
- throw p;
76
- return f ? [f, r] : [void 0, () => {
938
+ if (w)
939
+ throw w;
940
+ return H ? [H, c] : [void 0, () => {
77
941
  }];
78
942
  }
79
- function N(s) {
80
- const [u, n] = E(() => new Set(s));
81
- return y(() => {
82
- const f = new Set(s);
83
- W(u, f) || n(f);
84
- }, [u, s]), u;
943
+ function at(e) {
944
+ const [t, n] = X(() => new Set(e));
945
+ return z(() => {
946
+ const H = new Set(e);
947
+ it(t, H) || n(H);
948
+ }, [t, e]), t;
85
949
  }
86
- function W(s, u) {
87
- return s.size === u.size && Array.from(s).every((n) => u.has(n));
950
+ function it(e, t) {
951
+ return e.size === t.size && Array.from(e).every((n) => t.has(n));
88
952
  }
89
- function T(s, { suspense: u = !1 } = {}) {
90
- const n = N(s), f = k(), [h, p] = E(() => {
91
- const e = /* @__PURE__ */ new Map();
92
- for (const t of n.values()) {
93
- let o;
953
+ function ft(e, { suspense: t = !1 } = {}) {
954
+ const n = at(e), H = Ve(), [y, w] = X(() => {
955
+ const s = /* @__PURE__ */ new Map();
956
+ for (const o of n.values()) {
957
+ let i;
94
958
  try {
95
- o = f.findWithProgress(t);
959
+ i = H.findWithProgress(o);
96
960
  } catch {
97
961
  continue;
98
962
  }
99
- o.state === "ready" && e.set(t, o.handle);
963
+ i.state === "ready" && s.set(o, i.handle);
100
964
  }
101
- return e;
102
- }), i = [], r = /* @__PURE__ */ new Map();
103
- for (const e of n.values()) {
104
- let t = h.get(e), o = x.get(e);
105
- if (!o)
965
+ return s;
966
+ }), a = [], c = /* @__PURE__ */ new Map();
967
+ for (const s of n.values()) {
968
+ let o = y.get(s), i = te.get(s);
969
+ if (!i)
106
970
  try {
107
- const c = f.find(e);
108
- o = O(c), x.set(e, o);
971
+ const h = H.find(s);
972
+ i = Ue(h), te.set(s, i);
109
973
  } catch {
110
974
  continue;
111
975
  }
112
976
  try {
113
- t ??= o.read(), r.set(e, t);
114
- } catch (c) {
115
- c instanceof Promise ? i.push(o) : r.set(e, void 0);
977
+ o ??= i.read(), c.set(s, o);
978
+ } catch (h) {
979
+ h instanceof Promise ? a.push(i) : c.set(s, void 0);
116
980
  }
117
981
  }
118
- if (y(() => {
119
- i.length > 0 ? Promise.allSettled(i.map((e) => e.promise)).then(
120
- (e) => {
121
- e.forEach((t) => {
122
- if (t.status === "fulfilled") {
123
- const o = t.value;
124
- r.set(o.url, o);
982
+ if (z(() => {
983
+ a.length > 0 ? Promise.allSettled(a.map((s) => s.promise)).then(
984
+ (s) => {
985
+ s.forEach((o) => {
986
+ if (o.status === "fulfilled") {
987
+ const i = o.value;
988
+ c.set(i.url, i);
125
989
  }
126
- }), p(r);
990
+ }), w(c);
127
991
  }
128
- ) : p(r);
129
- }, [u, n]), u && i.length > 0)
130
- throw Promise.all(i.map((e) => e.promise));
131
- return h;
992
+ ) : w(c);
993
+ }, [t, n]), t && a.length > 0)
994
+ throw Promise.all(a.map((s) => s.promise));
995
+ return y;
132
996
  }
133
- function Y(s, { suspense: u = !0 } = {}) {
134
- const n = T(s, { suspense: u }), [f, h] = E(() => {
135
- const i = /* @__PURE__ */ new Map();
136
- return n.forEach((r) => {
137
- const e = r?.url;
138
- e && i.set(e, r?.doc());
139
- }), i;
997
+ function Ht(e, { suspense: t = !0 } = {}) {
998
+ const n = ft(e, { suspense: t }), [H, y] = X(() => {
999
+ const a = /* @__PURE__ */ new Map();
1000
+ return n.forEach((c) => {
1001
+ const s = c?.url;
1002
+ s && a.set(s, c?.doc());
1003
+ }), a;
140
1004
  });
141
- y(() => {
142
- const i = /* @__PURE__ */ new Map();
143
- return n.forEach((r, e) => {
144
- if (r) {
145
- const t = () => {
146
- h((o) => {
147
- const c = new Map(o);
148
- return c.set(e, r.doc()), c;
1005
+ z(() => {
1006
+ const a = /* @__PURE__ */ new Map();
1007
+ return n.forEach((c, s) => {
1008
+ if (c) {
1009
+ const o = () => {
1010
+ y((i) => {
1011
+ const h = new Map(i);
1012
+ return h.set(s, c.doc()), h;
149
1013
  });
150
1014
  };
151
- h((o) => {
152
- const c = new Map(o);
153
- return c.set(e, r.doc()), c;
154
- }), r.on("change", t), i.set(e, t);
1015
+ y((i) => {
1016
+ const h = new Map(i);
1017
+ return h.set(s, c.doc()), h;
1018
+ }), c.on("change", o), a.set(s, o);
155
1019
  }
156
- }), h((r) => {
157
- const e = new Map(r);
158
- for (const [t] of e)
159
- n.has(t) || e.delete(t);
160
- return e;
1020
+ }), y((c) => {
1021
+ const s = new Map(c);
1022
+ for (const [o] of s)
1023
+ n.has(o) || s.delete(o);
1024
+ return s;
161
1025
  }), () => {
162
- n.forEach((r, e) => {
163
- const t = i.get(e);
164
- r && t && r.removeListener("change", t);
1026
+ n.forEach((c, s) => {
1027
+ const o = a.get(s);
1028
+ c && o && c.removeListener("change", o);
165
1029
  });
166
1030
  };
167
1031
  }, [n]);
168
- const p = R(
169
- (i, r, e) => {
170
- const t = n.get(i);
171
- t && t.change(r, e);
1032
+ const w = Le(
1033
+ (a, c, s) => {
1034
+ const o = n.get(a);
1035
+ o && o.change(c, s);
172
1036
  },
173
1037
  [n]
174
1038
  );
175
- return [f, p];
176
- }
177
- function A(s) {
178
- return s && s.__esModule && Object.prototype.hasOwnProperty.call(s, "default") ? s.default : s;
1039
+ return [H, w];
179
1040
  }
180
- var S, M;
181
- function B() {
182
- if (M) return S;
183
- M = 1;
184
- var s = q, u = function(f) {
185
- return typeof f == "function";
186
- }, n = function(f) {
187
- var h = s.useState(f), p = h[0], i = h[1], r = s.useRef(p), e = s.useCallback(function(t) {
188
- r.current = u(t) ? t(r.current) : t, i(r.current);
1041
+ var fe, Ee;
1042
+ function ht() {
1043
+ if (Ee) return fe;
1044
+ Ee = 1;
1045
+ var e = ke, t = function(H) {
1046
+ return typeof H == "function";
1047
+ }, n = function(H) {
1048
+ var y = e.useState(H), w = y[0], a = y[1], c = e.useRef(w), s = e.useCallback(function(o) {
1049
+ c.current = t(o) ? o(c.current) : o, a(c.current);
189
1050
  }, []);
190
- return [p, e, r];
1051
+ return [w, s, c];
191
1052
  };
192
- return S = n, S;
1053
+ return fe = n, fe;
193
1054
  }
194
- var G = B();
195
- const D = /* @__PURE__ */ A(G);
196
- var C = { exports: {} }, P;
197
- function J() {
198
- return P || (P = 1, function(s) {
199
- var u = Object.prototype.hasOwnProperty, n = "~";
200
- function f() {
201
- }
202
- Object.create && (f.prototype = /* @__PURE__ */ Object.create(null), new f().__proto__ || (n = !1));
203
- function h(e, t, o) {
204
- this.fn = e, this.context = t, this.once = o || !1;
205
- }
206
- function p(e, t, o, c, w) {
207
- if (typeof o != "function")
1055
+ var ut = ht();
1056
+ const ue = /* @__PURE__ */ be(ut);
1057
+ var he = { exports: {} }, Be;
1058
+ function lt() {
1059
+ return Be || (Be = 1, function(e) {
1060
+ var t = Object.prototype.hasOwnProperty, n = "~";
1061
+ function H() {
1062
+ }
1063
+ Object.create && (H.prototype = /* @__PURE__ */ Object.create(null), new H().__proto__ || (n = !1));
1064
+ function y(s, o, i) {
1065
+ this.fn = s, this.context = o, this.once = i || !1;
1066
+ }
1067
+ function w(s, o, i, h, m) {
1068
+ if (typeof i != "function")
208
1069
  throw new TypeError("The listener must be a function");
209
- var v = new h(o, c || e, w), l = n ? n + t : t;
210
- return e._events[l] ? e._events[l].fn ? e._events[l] = [e._events[l], v] : e._events[l].push(v) : (e._events[l] = v, e._eventsCount++), e;
211
- }
212
- function i(e, t) {
213
- --e._eventsCount === 0 ? e._events = new f() : delete e._events[t];
214
- }
215
- function r() {
216
- this._events = new f(), this._eventsCount = 0;
217
- }
218
- r.prototype.eventNames = function() {
219
- var t = [], o, c;
220
- if (this._eventsCount === 0) return t;
221
- for (c in o = this._events)
222
- u.call(o, c) && t.push(n ? c.slice(1) : c);
223
- return Object.getOwnPropertySymbols ? t.concat(Object.getOwnPropertySymbols(o)) : t;
224
- }, r.prototype.listeners = function(t) {
225
- var o = n ? n + t : t, c = this._events[o];
226
- if (!c) return [];
227
- if (c.fn) return [c.fn];
228
- for (var w = 0, v = c.length, l = new Array(v); w < v; w++)
229
- l[w] = c[w].fn;
230
- return l;
231
- }, r.prototype.listenerCount = function(t) {
232
- var o = n ? n + t : t, c = this._events[o];
233
- return c ? c.fn ? 1 : c.length : 0;
234
- }, r.prototype.emit = function(t, o, c, w, v, l) {
235
- var m = n ? n + t : t;
236
- if (!this._events[m]) return !1;
237
- var a = this._events[m], g = arguments.length, _, d;
238
- if (a.fn) {
239
- switch (a.once && this.removeListener(t, a.fn, void 0, !0), g) {
1070
+ var B = new y(i, h || s, m), f = n ? n + o : o;
1071
+ return s._events[f] ? s._events[f].fn ? s._events[f] = [s._events[f], B] : s._events[f].push(B) : (s._events[f] = B, s._eventsCount++), s;
1072
+ }
1073
+ function a(s, o) {
1074
+ --s._eventsCount === 0 ? s._events = new H() : delete s._events[o];
1075
+ }
1076
+ function c() {
1077
+ this._events = new H(), this._eventsCount = 0;
1078
+ }
1079
+ c.prototype.eventNames = function() {
1080
+ var o = [], i, h;
1081
+ if (this._eventsCount === 0) return o;
1082
+ for (h in i = this._events)
1083
+ t.call(i, h) && o.push(n ? h.slice(1) : h);
1084
+ return Object.getOwnPropertySymbols ? o.concat(Object.getOwnPropertySymbols(i)) : o;
1085
+ }, c.prototype.listeners = function(o) {
1086
+ var i = n ? n + o : o, h = this._events[i];
1087
+ if (!h) return [];
1088
+ if (h.fn) return [h.fn];
1089
+ for (var m = 0, B = h.length, f = new Array(B); m < B; m++)
1090
+ f[m] = h[m].fn;
1091
+ return f;
1092
+ }, c.prototype.listenerCount = function(o) {
1093
+ var i = n ? n + o : o, h = this._events[i];
1094
+ return h ? h.fn ? 1 : h.length : 0;
1095
+ }, c.prototype.emit = function(o, i, h, m, B, f) {
1096
+ var g = n ? n + o : o;
1097
+ if (!this._events[g]) return !1;
1098
+ var d = this._events[g], V = arguments.length, M, x;
1099
+ if (d.fn) {
1100
+ switch (d.once && this.removeListener(o, d.fn, void 0, !0), V) {
240
1101
  case 1:
241
- return a.fn.call(a.context), !0;
1102
+ return d.fn.call(d.context), !0;
242
1103
  case 2:
243
- return a.fn.call(a.context, o), !0;
1104
+ return d.fn.call(d.context, i), !0;
244
1105
  case 3:
245
- return a.fn.call(a.context, o, c), !0;
1106
+ return d.fn.call(d.context, i, h), !0;
246
1107
  case 4:
247
- return a.fn.call(a.context, o, c, w), !0;
1108
+ return d.fn.call(d.context, i, h, m), !0;
248
1109
  case 5:
249
- return a.fn.call(a.context, o, c, w, v), !0;
1110
+ return d.fn.call(d.context, i, h, m, B), !0;
250
1111
  case 6:
251
- return a.fn.call(a.context, o, c, w, v, l), !0;
1112
+ return d.fn.call(d.context, i, h, m, B, f), !0;
252
1113
  }
253
- for (d = 1, _ = new Array(g - 1); d < g; d++)
254
- _[d - 1] = arguments[d];
255
- a.fn.apply(a.context, _);
1114
+ for (x = 1, M = new Array(V - 1); x < V; x++)
1115
+ M[x - 1] = arguments[x];
1116
+ d.fn.apply(d.context, M);
256
1117
  } else {
257
- var H = a.length, b;
258
- for (d = 0; d < H; d++)
259
- switch (a[d].once && this.removeListener(t, a[d].fn, void 0, !0), g) {
1118
+ var R = d.length, A;
1119
+ for (x = 0; x < R; x++)
1120
+ switch (d[x].once && this.removeListener(o, d[x].fn, void 0, !0), V) {
260
1121
  case 1:
261
- a[d].fn.call(a[d].context);
1122
+ d[x].fn.call(d[x].context);
262
1123
  break;
263
1124
  case 2:
264
- a[d].fn.call(a[d].context, o);
1125
+ d[x].fn.call(d[x].context, i);
265
1126
  break;
266
1127
  case 3:
267
- a[d].fn.call(a[d].context, o, c);
1128
+ d[x].fn.call(d[x].context, i, h);
268
1129
  break;
269
1130
  case 4:
270
- a[d].fn.call(a[d].context, o, c, w);
1131
+ d[x].fn.call(d[x].context, i, h, m);
271
1132
  break;
272
1133
  default:
273
- if (!_) for (b = 1, _ = new Array(g - 1); b < g; b++)
274
- _[b - 1] = arguments[b];
275
- a[d].fn.apply(a[d].context, _);
1134
+ if (!M) for (A = 1, M = new Array(V - 1); A < V; A++)
1135
+ M[A - 1] = arguments[A];
1136
+ d[x].fn.apply(d[x].context, M);
276
1137
  }
277
1138
  }
278
1139
  return !0;
279
- }, r.prototype.on = function(t, o, c) {
280
- return p(this, t, o, c, !1);
281
- }, r.prototype.once = function(t, o, c) {
282
- return p(this, t, o, c, !0);
283
- }, r.prototype.removeListener = function(t, o, c, w) {
284
- var v = n ? n + t : t;
285
- if (!this._events[v]) return this;
286
- if (!o)
287
- return i(this, v), this;
288
- var l = this._events[v];
289
- if (l.fn)
290
- l.fn === o && (!w || l.once) && (!c || l.context === c) && i(this, v);
1140
+ }, c.prototype.on = function(o, i, h) {
1141
+ return w(this, o, i, h, !1);
1142
+ }, c.prototype.once = function(o, i, h) {
1143
+ return w(this, o, i, h, !0);
1144
+ }, c.prototype.removeListener = function(o, i, h, m) {
1145
+ var B = n ? n + o : o;
1146
+ if (!this._events[B]) return this;
1147
+ if (!i)
1148
+ return a(this, B), this;
1149
+ var f = this._events[B];
1150
+ if (f.fn)
1151
+ f.fn === i && (!m || f.once) && (!h || f.context === h) && a(this, B);
291
1152
  else {
292
- for (var m = 0, a = [], g = l.length; m < g; m++)
293
- (l[m].fn !== o || w && !l[m].once || c && l[m].context !== c) && a.push(l[m]);
294
- a.length ? this._events[v] = a.length === 1 ? a[0] : a : i(this, v);
1153
+ for (var g = 0, d = [], V = f.length; g < V; g++)
1154
+ (f[g].fn !== i || m && !f[g].once || h && f[g].context !== h) && d.push(f[g]);
1155
+ d.length ? this._events[B] = d.length === 1 ? d[0] : d : a(this, B);
295
1156
  }
296
1157
  return this;
297
- }, r.prototype.removeAllListeners = function(t) {
298
- var o;
299
- return t ? (o = n ? n + t : t, this._events[o] && i(this, o)) : (this._events = new f(), this._eventsCount = 0), this;
300
- }, r.prototype.off = r.prototype.removeListener, r.prototype.addListener = r.prototype.on, r.prefixed = n, r.EventEmitter = r, s.exports = r;
301
- }(C)), C.exports;
1158
+ }, c.prototype.removeAllListeners = function(o) {
1159
+ var i;
1160
+ return o ? (i = n ? n + o : o, this._events[i] && a(this, i)) : (this._events = new H(), this._eventsCount = 0), this;
1161
+ }, c.prototype.off = c.prototype.removeListener, c.prototype.addListener = c.prototype.on, c.prefixed = n, c.EventEmitter = c, e.exports = c;
1162
+ }(he)), he.exports;
302
1163
  }
303
- var K = J();
304
- const Q = /* @__PURE__ */ A(K), L = new Q(), Z = ({
305
- handle: s,
306
- localUserId: u,
1164
+ var dt = lt();
1165
+ const bt = /* @__PURE__ */ be(dt), le = new bt(), yt = ({
1166
+ handle: e,
1167
+ localUserId: t,
307
1168
  offlineTimeout: n = 3e4,
308
- getTime: f = () => (/* @__PURE__ */ new Date()).getTime()
1169
+ getTime: H = () => (/* @__PURE__ */ new Date()).getTime()
309
1170
  }) => {
310
- const [h, p, i] = D({}), [r, e, t] = D({});
311
- return y(() => {
312
- if (!s)
1171
+ const [y, w, a] = ue({}), [c, s, o] = ue({});
1172
+ return z(() => {
1173
+ if (!e)
313
1174
  return;
314
- const o = (v) => {
315
- const [l, m] = v.message;
316
- l !== u && (t.current[l] || L.emit("new_peer", v), p({
317
- ...i.current,
318
- [l]: m
319
- }), e({
320
- ...t.current,
321
- [l]: f()
1175
+ const i = (B) => {
1176
+ const [f, g] = B.message;
1177
+ f !== t && (o.current[f] || le.emit("new_peer", B), w({
1178
+ ...a.current,
1179
+ [f]: g
1180
+ }), s({
1181
+ ...o.current,
1182
+ [f]: H()
322
1183
  }));
323
- }, c = () => {
324
- const v = { ...i.current }, l = { ...t.current }, m = f();
325
- let a = !1;
326
- for (const g in l)
327
- m - l[g] > n && (delete v[g], delete l[g], a = !0);
328
- a && (p(v), e(l));
1184
+ }, h = () => {
1185
+ const B = { ...a.current }, f = { ...o.current }, g = H();
1186
+ let d = !1;
1187
+ for (const V in f)
1188
+ g - f[V] > n && (delete B[V], delete f[V], d = !0);
1189
+ d && (w(B), s(f));
329
1190
  };
330
- s.on("ephemeral-message", o);
331
- const w = setInterval(
332
- c,
1191
+ e.on("ephemeral-message", i);
1192
+ const m = setInterval(
1193
+ h,
333
1194
  n
334
1195
  );
335
1196
  return () => {
336
- s.removeListener("ephemeral-message", o), clearInterval(w);
1197
+ e.removeListener("ephemeral-message", i), clearInterval(m);
337
1198
  };
338
- }, [s, u, n, f]), [h, r];
339
- }, U = ({
340
- handle: s,
341
- userId: u,
1199
+ }, [e, t, n, H]), [y, c];
1200
+ }, At = ({
1201
+ handle: e,
1202
+ userId: t,
342
1203
  initialState: n,
343
- heartbeatTime: f = 15e3
1204
+ heartbeatTime: H = 15e3
344
1205
  }) => {
345
- const [h, p, i] = D(n), r = (e) => {
346
- const t = typeof e == "function" ? e(i.current) : e;
347
- p(t), s && s.broadcast([u, t]);
1206
+ const [y, w, a] = ue(n), c = (s) => {
1207
+ const o = typeof s == "function" ? s(a.current) : s;
1208
+ w(o), e && e.broadcast([t, o]);
348
1209
  };
349
- return y(() => {
350
- if (!u || !s)
1210
+ return z(() => {
1211
+ if (!t || !e)
351
1212
  return;
352
- const e = () => void s.broadcast([u, i.current]);
353
- e();
354
- const t = setInterval(e, f);
355
- return () => void clearInterval(t);
356
- }, [s, u, f]), y(() => {
357
- if (!s || !u)
1213
+ const s = () => void e.broadcast([t, a.current]);
1214
+ s();
1215
+ const o = setInterval(s, H);
1216
+ return () => void clearInterval(o);
1217
+ }, [e, t, H]), z(() => {
1218
+ if (!e || !t)
358
1219
  return;
359
- let e;
360
- const t = L.on("new_peer", () => {
361
- e = setTimeout(
362
- () => s.broadcast([u, i.current]),
1220
+ let s;
1221
+ const o = le.on("new_peer", () => {
1222
+ s = setTimeout(
1223
+ () => e.broadcast([t, a.current]),
363
1224
  500
364
1225
  // Wait for the peer to be ready
365
1226
  );
366
1227
  });
367
1228
  return () => {
368
- t.off("new_peer"), e && clearTimeout(e);
1229
+ o.off("new_peer"), s && clearTimeout(s);
369
1230
  };
370
- }, [s, u, L]), [h, r];
1231
+ }, [e, t, le]), [y, c];
371
1232
  };
372
1233
  export {
373
- z as RepoContext,
374
- F as useDocHandle,
375
- T as useDocHandles,
376
- X as useDocument,
377
- Y as useDocuments,
378
- U as useLocalAwareness,
379
- Z as useRemoteAwareness,
380
- k as useRepo
1234
+ Ge as RepoContext,
1235
+ ct as useDocHandle,
1236
+ ft as useDocHandles,
1237
+ pt as useDocument,
1238
+ Ht as useDocuments,
1239
+ At as useLocalAwareness,
1240
+ yt as useRemoteAwareness,
1241
+ Ve as useRepo
381
1242
  };