@graffiti-garden/wrapper-vue 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,9 @@
1
1
  var he = Object.defineProperty;
2
- var pe = (t, r, e) => r in t ? he(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
3
- var y = (t, r, e) => pe(t, typeof r != "symbol" ? r + "" : r, e);
4
- import { inject as X, ref as A, watch as de, onScopeDispose as ye, toValue as O, defineComponent as W, toRef as b, renderSlot as U, unref as g } from "vue";
2
+ var pe = (t, n, e) => n in t ? he(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
+ var v = (t, n, e) => pe(t, typeof n != "symbol" ? n + "" : n, e);
4
+ import { inject as X, ref as M, computed as de, watch as ye, onScopeDispose as ve, toValue as j, defineComponent as L, toRef as g, renderSlot as W, unref as b } from "vue";
5
5
  const Y = Symbol(), Z = Symbol();
6
- function B() {
6
+ function N() {
7
7
  const t = X(Y);
8
8
  if (!t)
9
9
  throw new Error(
@@ -11,8 +11,8 @@ function B() {
11
11
  );
12
12
  return t;
13
13
  }
14
- function Le() {
15
- return B();
14
+ function $e() {
15
+ return N();
16
16
  }
17
17
  function ee() {
18
18
  const t = X(Z);
@@ -22,237 +22,169 @@ function ee() {
22
22
  );
23
23
  return t;
24
24
  }
25
- class ve {
26
- constructor(r) {
27
- y(this, "poll", async (r) => {
25
+ class me {
26
+ constructor(n) {
27
+ v(this, "poll", async (n) => {
28
28
  let e;
29
29
  try {
30
30
  e = await this.getter();
31
31
  } catch {
32
- r(null);
32
+ n(null);
33
33
  return;
34
34
  }
35
- r(e);
35
+ n({ object: e });
36
36
  });
37
- this.getter = r;
37
+ this.getter = n;
38
38
  }
39
39
  clear() {
40
40
  }
41
41
  }
42
42
  class te {
43
- constructor(r, e) {
44
- y(this, "bookmark");
45
- y(this, "iterator");
46
- y(this, "poll", async (r) => {
47
- var s, f;
48
- const e = (/* @__PURE__ */ new Date()).getTime(), n = this.schemaGetter();
49
- let o = typeof n == "object" ? n : {};
50
- if (this.bookmark && this.bookmark.fullRepollBy > e) {
51
- const h = (s = o.properties) == null ? void 0 : s.lastModified;
52
- o = {
53
- ...o,
54
- properties: {
55
- ...o.properties,
56
- lastModified: {
57
- minimum: this.bookmark.lastModified,
58
- // if the schema already has a minimum
59
- // it won't be overridden because
60
- // the schema below takes precedence
61
- ...typeof h == "object" ? h : {}
62
- }
63
- }
64
- };
65
- }
66
- let i;
67
- try {
68
- i = this.streamFactory();
69
- } catch (h) {
70
- console.error(h);
71
- return;
72
- }
73
- this.iterator = i;
74
- let a = (f = this.bookmark) == null ? void 0 : f.lastModified, u = await i.next();
75
- for (; !u.done; ) {
76
- if (u.value.error) {
77
- console.error(u.value.error), u = await i.next();
43
+ constructor(n) {
44
+ v(this, "iterator");
45
+ v(this, "continue");
46
+ v(this, "poll", async (n) => {
47
+ for (this.iterator || (this.continue ? this.iterator = this.continue() : this.iterator = this.streamFactory()); ; ) {
48
+ const e = await this.iterator.next();
49
+ if (e.done) {
50
+ e.value && (this.iterator = void 0, this.continue = e.value.continue);
51
+ break;
52
+ }
53
+ if (e.value.error) {
54
+ console.error(e.value.error);
78
55
  continue;
79
56
  }
80
- const h = u.value.value;
81
- (!a || h.lastModified > a) && (a = h.lastModified), r(h), u = await i.next();
57
+ n(e.value);
82
58
  }
83
- if (this.iterator !== i) return;
84
- this.iterator = void 0;
85
- const { tombstoneRetention: c } = u.value;
86
- a && (this.bookmark = {
87
- lastModified: a,
88
- fullRepollBy: e + c
89
- });
90
59
  });
91
- this.schemaGetter = r, this.streamFactory = e;
60
+ this.streamFactory = n;
92
61
  }
93
62
  clear() {
94
- var r;
95
- this.bookmark = void 0, (r = this.iterator) == null || r.return({ tombstoneRetention: 0 }), this.iterator = void 0;
96
- }
97
- }
98
- var me = class {
99
- }, we = class re extends Error {
100
- constructor(r) {
101
- super(r), this.name = "GraffitiErrorInvalidSchema", Object.setPrototypeOf(this, re.prototype);
102
- }
103
- }, ge = class ne extends Error {
104
- constructor(r) {
105
- super(r), this.name = "GraffitiErrorPatchTestFailed", Object.setPrototypeOf(this, ne.prototype);
106
- }
107
- }, be = class ie extends Error {
108
- constructor(r) {
109
- super(r), this.name = "GraffitiErrorPatchError", Object.setPrototypeOf(this, ie.prototype);
110
- }
111
- };
112
- function Pe(t) {
113
- return typeof t == "string" ? t : t.url;
114
- }
115
- function oe(t, r) {
116
- return t.lastModified > r.lastModified || t.lastModified === r.lastModified && !t.tombstone && r.tombstone;
117
- }
118
- function xe(t, r, e, n) {
119
- const o = e[r];
120
- if (!(!o || !o.length))
121
- try {
122
- n[r] = t(n[r], o, !0, !1).newDocument;
123
- } catch (i) {
124
- throw typeof i == "object" && i && "name" in i && typeof i.name == "string" && "message" in i && typeof i.message == "string" ? i.name === "TEST_OPERATION_FAILED" ? new ge(i.message) : new be(i.name + ": " + i.message) : i;
63
+ if (this.iterator) {
64
+ const n = this.iterator;
65
+ this.iterator.return({
66
+ continue: () => n,
67
+ cursor: ""
68
+ });
125
69
  }
126
- }
127
- function Oe(t, r) {
128
- try {
129
- return t.compile(r);
130
- } catch (e) {
131
- throw new we(
132
- e instanceof Error ? e.message : void 0
133
- );
70
+ this.iterator = void 0, this.continue = void 0;
134
71
  }
135
72
  }
136
- function Ge(t, r, e) {
137
- t.actor !== (e == null ? void 0 : e.actor) && (t.allowed = t.allowed && e ? [e.actor] : void 0, t.channels = t.channels.filter(
138
- (n) => r.includes(n)
139
- ));
140
- }
141
- function Ee(t, r) {
142
- return t.allowed === void 0 || t.allowed === null || !!(r != null && r.actor) && (t.actor === r.actor || t.allowed.includes(r.actor));
73
+ function ne(t, n) {
74
+ return !n || t.object.lastModified > n.object.lastModified || t.object.lastModified === n.object.lastModified && !t.tombstone && !!n.tombstone;
143
75
  }
144
- class Se {
76
+ class we {
145
77
  constructor() {
146
- y(this, "result", A(void 0));
78
+ v(this, "entry", M());
79
+ }
80
+ get result() {
81
+ return de(() => {
82
+ const n = this.entry.value;
83
+ return n && (n.tombstone ? null : n.object);
84
+ });
147
85
  }
148
86
  clear() {
149
- this.result.value = void 0;
87
+ this.entry.value = void 0;
150
88
  }
151
- onObject(r) {
152
- (!r || !this.result.value || oe(r, this.result.value)) && (!r || r.tombstone ? this.result.value = null : this.result.value = {
153
- ...r,
154
- tombstone: !1
155
- });
89
+ onEntry(n) {
90
+ (!n || ne(n, this.entry.value)) && (this.entry.value = n);
156
91
  }
157
92
  }
158
- class se {
159
- constructor(r) {
160
- y(this, "results", A([]));
161
- y(this, "resultsRaw", /* @__PURE__ */ new Map());
162
- y(this, "batchFlattenTimer");
163
- this.graffiti = r;
93
+ class re {
94
+ constructor(n) {
95
+ v(this, "results", M([]));
96
+ v(this, "resultsRaw", /* @__PURE__ */ new Map());
97
+ v(this, "batchFlattenTimer");
98
+ this.graffiti = n;
164
99
  }
165
100
  clear() {
166
101
  this.resultsRaw.clear(), this.results.value = [], clearTimeout(this.batchFlattenTimer), this.batchFlattenTimer = void 0;
167
102
  }
168
103
  flattenResults() {
169
- this.results.value = Array.from(this.resultsRaw.values()).reduce((r, e) => {
170
- const { tombstone: n } = e;
171
- return n || r.push({ ...e, tombstone: n }), r;
172
- }, []);
104
+ this.results.value = Array.from(this.resultsRaw.values()).reduce((n, e) => (e.tombstone || n.push(e.object), n), []);
173
105
  }
174
- onObject(r) {
175
- if (!r) return;
176
- const e = this.resultsRaw.get(r.url);
177
- e && !oe(r, e) || (this.resultsRaw.set(r.url, r), this.batchFlattenTimer || (this.batchFlattenTimer = setTimeout(() => {
106
+ onEntry(n) {
107
+ if (!n) return;
108
+ const e = this.resultsRaw.get(n.object.url);
109
+ ne(n, e) && (this.resultsRaw.set(n.object.url, n), this.batchFlattenTimer || (this.batchFlattenTimer = setTimeout(() => {
178
110
  this.flattenResults(), this.batchFlattenTimer = void 0;
179
111
  }, 0)));
180
112
  }
181
113
  }
182
- function J(t, r, e, n) {
183
- let o;
184
- async function i() {
185
- o = e();
186
- for await (const c of o) {
187
- if (c.error) {
188
- console.error(c.error);
114
+ function J(t, n, e, r) {
115
+ let i;
116
+ async function o() {
117
+ i = e();
118
+ for await (const a of i) {
119
+ if (a.error) {
120
+ console.error(a.error);
189
121
  continue;
190
122
  }
191
- t.onObject(c.value);
123
+ t.onEntry(a);
192
124
  }
193
125
  }
194
- const a = () => r.poll(t.onObject.bind(t)), u = A(!1);
195
- return de(
196
- n,
197
- async (c, s) => {
198
- if (JSON.stringify(c) !== JSON.stringify(s)) {
199
- o == null || o.return(), t.clear(), r.clear(), i(), u.value = !0;
126
+ const u = () => n.poll(t.onEntry.bind(t)), l = M(!1);
127
+ return ye(
128
+ r,
129
+ async (a, s) => {
130
+ if (JSON.stringify(a) !== JSON.stringify(s)) {
131
+ i == null || i.return(null), t.clear(), n.clear(), o(), l.value = !0;
200
132
  try {
201
- await a();
133
+ await u();
202
134
  } finally {
203
- u.value = !1;
135
+ l.value = !1;
204
136
  }
205
137
  }
206
138
  },
207
139
  {
208
140
  immediate: !0
209
141
  }
210
- ), ye(() => o == null ? void 0 : o.return()), { poll: a, isPolling: u };
142
+ ), ve(() => i == null ? void 0 : i.return(null)), { poll: u, isPolling: l };
211
143
  }
212
- function ae(t, r) {
144
+ function oe(t, n) {
213
145
  return () => {
214
- const e = O(r);
146
+ const e = j(n);
215
147
  return e === void 0 ? t == null ? void 0 : t.value : e;
216
148
  };
217
149
  }
218
- function S(t) {
219
- return t.map((r) => r());
150
+ function E(t) {
151
+ return t.map((n) => n());
220
152
  }
221
- function je(t, r, e) {
222
- const n = B(), o = ee(), i = () => O(t), a = () => O(r), u = ae(o, e), c = [i, a, u], s = () => n.synchronizeDiscover(...S(c)), f = () => n.discover(...S(c)), h = new se(n), l = new te(a, f), { poll: p, isPolling: d } = J(
223
- h,
224
- l,
153
+ function be(t, n, e) {
154
+ const r = N(), i = ee(), o = () => j(t), u = () => j(n), l = oe(i, e), a = [o, u, l], s = () => r.synchronizeDiscover(...E(a)), f = () => r.discover(...E(a)), p = new re(r), c = new te(f), { poll: d, isPolling: h } = J(
155
+ p,
156
+ c,
225
157
  s,
226
- c
158
+ a
227
159
  );
228
160
  return {
229
161
  /**
230
162
  * A [Ref](https://vuejs.org/api/reactivity-core.html#ref) that contains
231
163
  * an array of Graffiti objects. All tombstoned objects have been filtered out.
232
164
  */
233
- results: h.results,
165
+ results: p.results,
234
166
  /**
235
167
  * A method to poll for new results.
236
168
  */
237
- poll: p,
169
+ poll: d,
238
170
  /**
239
171
  * A boolean [Ref](https://vuejs.org/api/reactivity-core.html#ref)
240
172
  * that indicates if the poll is currently running.
241
173
  * Useful to show a loading spinner or disable a button.
242
174
  */
243
- isPolling: d
175
+ isPolling: h
244
176
  };
245
177
  }
246
- function ke(t, r, e) {
247
- const n = B(), o = ee(), i = () => O(t), a = () => O(r), u = ae(o, e), c = [
248
- i,
249
- a,
250
- u
251
- ], s = () => n.synchronizeGet(...S(c)), f = new Se(), h = () => n.get(...S(c)), l = new ve(h), { poll: p, isPolling: d } = J(
178
+ function ge(t, n, e) {
179
+ const r = N(), i = ee(), o = () => j(t), u = () => j(n), l = oe(i, e), a = [
180
+ o,
181
+ u,
182
+ l
183
+ ], s = () => r.synchronizeGet(...E(a)), f = new we(), p = () => r.get(...E(a)), c = new me(p), { poll: d, isPolling: h } = J(
252
184
  f,
253
- l,
185
+ c,
254
186
  s,
255
- c
187
+ a
256
188
  );
257
189
  return {
258
190
  /**
@@ -264,28 +196,28 @@ function ke(t, r, e) {
264
196
  /**
265
197
  * A method to poll for new results.
266
198
  */
267
- poll: p,
199
+ poll: d,
268
200
  /**
269
201
  * A boolean [Ref](https://vuejs.org/api/reactivity-core.html#ref)
270
202
  * that indicates if the poll is currently running.
271
203
  * Useful to show a loading spinner or disable a button.
272
204
  */
273
- isPolling: d
205
+ isPolling: h
274
206
  };
275
207
  }
276
- function Re(t, r) {
277
- const e = B(), n = () => O(t), i = [n, () => O(r)], a = () => e.synchronizeRecoverOrphans(...S(i)), u = new se(e), c = () => e.recoverOrphans(...S(i)), s = new te(n, c), { poll: f, isPolling: h } = J(
278
- u,
208
+ function Pe(t, n) {
209
+ const e = N(), o = [() => j(t), () => j(n)], u = () => e.synchronizeRecoverOrphans(...E(o)), l = new re(e), a = () => e.recoverOrphans(...E(o)), s = new te(a), { poll: f, isPolling: p } = J(
210
+ l,
279
211
  s,
280
- a,
281
- i
212
+ u,
213
+ o
282
214
  );
283
215
  return {
284
216
  /**
285
217
  * A [Ref](https://vuejs.org/api/reactivity-core.html#ref) that contains
286
218
  * an array of Graffiti objects. All tombstoned objects have been filtered out.
287
219
  */
288
- results: u.results,
220
+ results: l.results,
289
221
  /**
290
222
  * A method to poll for new results.
291
223
  */
@@ -295,10 +227,10 @@ function Re(t, r) {
295
227
  * that indicates if the poll is currently running.
296
228
  * Useful to show a loading spinner or disable a button.
297
229
  */
298
- isPolling: h
230
+ isPolling: p
299
231
  };
300
232
  }
301
- const ue = /* @__PURE__ */ W({
233
+ const ie = /* @__PURE__ */ L({
302
234
  __name: "Discover",
303
235
  props: {
304
236
  channels: {},
@@ -306,18 +238,18 @@ const ue = /* @__PURE__ */ W({
306
238
  session: {}
307
239
  },
308
240
  setup(t) {
309
- const r = t, { results: e, poll: n, isPolling: o } = je(
310
- b(r, "channels"),
311
- b(r, "schema"),
312
- b(r, "session")
241
+ const n = t, { results: e, poll: r, isPolling: i } = be(
242
+ g(n, "channels"),
243
+ g(n, "schema"),
244
+ g(n, "session")
313
245
  );
314
- return (i, a) => U(i.$slots, "default", {
315
- results: g(e),
316
- poll: g(n),
317
- isPolling: g(o)
246
+ return (o, u) => W(o.$slots, "default", {
247
+ results: b(e),
248
+ poll: b(r),
249
+ isPolling: b(i)
318
250
  });
319
251
  }
320
- }), ce = /* @__PURE__ */ W({
252
+ }), se = /* @__PURE__ */ L({
321
253
  __name: "Get",
322
254
  props: {
323
255
  url: {},
@@ -325,35 +257,49 @@ const ue = /* @__PURE__ */ W({
325
257
  session: {}
326
258
  },
327
259
  setup(t) {
328
- const r = t, { result: e, poll: n, isPolling: o } = ke(
329
- b(r, "url"),
330
- b(r, "schema"),
331
- b(r, "session")
260
+ const n = t, { result: e, poll: r, isPolling: i } = ge(
261
+ g(n, "url"),
262
+ g(n, "schema"),
263
+ g(n, "session")
332
264
  );
333
- return (i, a) => U(i.$slots, "default", {
334
- result: g(e),
335
- poll: g(n),
336
- isPolling: g(o)
265
+ return (o, u) => W(o.$slots, "default", {
266
+ result: b(e),
267
+ poll: b(r),
268
+ isPolling: b(i)
337
269
  });
338
270
  }
339
- }), le = /* @__PURE__ */ W({
271
+ }), ue = /* @__PURE__ */ L({
340
272
  __name: "RecoverOrphans",
341
273
  props: {
342
274
  schema: {},
343
275
  session: {}
344
276
  },
345
277
  setup(t) {
346
- const r = t, { results: e, poll: n, isPolling: o } = Re(
347
- b(r, "schema"),
348
- b(r, "session")
278
+ const n = t, { results: e, poll: r, isPolling: i } = Pe(
279
+ g(n, "schema"),
280
+ g(n, "session")
349
281
  );
350
- return (i, a) => U(i.$slots, "default", {
351
- results: g(e),
352
- poll: g(n),
353
- isPolling: g(o)
282
+ return (o, u) => W(o.$slots, "default", {
283
+ results: b(e),
284
+ poll: b(r),
285
+ isPolling: b(i)
354
286
  });
355
287
  }
356
288
  });
289
+ var xe = class {
290
+ }, je = class ae extends Error {
291
+ constructor(n) {
292
+ super(n), this.name = "GraffitiErrorInvalidSchema", Object.setPrototypeOf(this, ae.prototype);
293
+ }
294
+ }, Oe = class ce extends Error {
295
+ constructor(n) {
296
+ super(n), this.name = "GraffitiErrorPatchTestFailed", Object.setPrototypeOf(this, ce.prototype);
297
+ }
298
+ }, Se = class le extends Error {
299
+ constructor(n) {
300
+ super(n), this.name = "GraffitiErrorPatchError", Object.setPrototypeOf(this, le.prototype);
301
+ }
302
+ };
357
303
  /*! *****************************************************************************
358
304
  Copyright (c) Microsoft Corporation.
359
305
 
@@ -368,172 +314,172 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
368
314
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
369
315
  PERFORMANCE OF THIS SOFTWARE.
370
316
  ***************************************************************************** */
371
- var L = function(t, r) {
372
- return L = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, n) {
373
- e.__proto__ = n;
374
- } || function(e, n) {
375
- for (var o in n) n.hasOwnProperty(o) && (e[o] = n[o]);
376
- }, L(t, r);
317
+ var C = function(t, n) {
318
+ return C = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
319
+ e.__proto__ = r;
320
+ } || function(e, r) {
321
+ for (var i in r) r.hasOwnProperty(i) && (e[i] = r[i]);
322
+ }, C(t, n);
377
323
  };
378
- function _e(t, r) {
379
- L(t, r);
324
+ function Ee(t, n) {
325
+ C(t, n);
380
326
  function e() {
381
327
  this.constructor = t;
382
328
  }
383
- t.prototype = r === null ? Object.create(r) : (e.prototype = r.prototype, new e());
329
+ t.prototype = n === null ? Object.create(n) : (e.prototype = n.prototype, new e());
384
330
  }
385
- function j(t, r, e, n) {
386
- function o(i) {
387
- return i instanceof e ? i : new e(function(a) {
388
- a(i);
331
+ function G(t, n, e, r) {
332
+ function i(o) {
333
+ return o instanceof e ? o : new e(function(u) {
334
+ u(o);
389
335
  });
390
336
  }
391
- return new (e || (e = Promise))(function(i, a) {
392
- function u(f) {
337
+ return new (e || (e = Promise))(function(o, u) {
338
+ function l(f) {
393
339
  try {
394
- s(n.next(f));
395
- } catch (h) {
396
- a(h);
340
+ s(r.next(f));
341
+ } catch (p) {
342
+ u(p);
397
343
  }
398
344
  }
399
- function c(f) {
345
+ function a(f) {
400
346
  try {
401
- s(n.throw(f));
402
- } catch (h) {
403
- a(h);
347
+ s(r.throw(f));
348
+ } catch (p) {
349
+ u(p);
404
350
  }
405
351
  }
406
352
  function s(f) {
407
- f.done ? i(f.value) : o(f.value).then(u, c);
353
+ f.done ? o(f.value) : i(f.value).then(l, a);
408
354
  }
409
- s((n = n.apply(t, [])).next());
355
+ s((r = r.apply(t, [])).next());
410
356
  });
411
357
  }
412
- function P(t, r) {
358
+ function P(t, n) {
413
359
  var e = { label: 0, sent: function() {
414
- if (i[0] & 1) throw i[1];
415
- return i[1];
416
- }, trys: [], ops: [] }, n, o, i, a;
417
- return a = { next: u(0), throw: u(1), return: u(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
360
+ if (o[0] & 1) throw o[1];
361
+ return o[1];
362
+ }, trys: [], ops: [] }, r, i, o, u;
363
+ return u = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() {
418
364
  return this;
419
- }), a;
420
- function u(s) {
365
+ }), u;
366
+ function l(s) {
421
367
  return function(f) {
422
- return c([s, f]);
368
+ return a([s, f]);
423
369
  };
424
370
  }
425
- function c(s) {
426
- if (n) throw new TypeError("Generator is already executing.");
371
+ function a(s) {
372
+ if (r) throw new TypeError("Generator is already executing.");
427
373
  for (; e; ) try {
428
- if (n = 1, o && (i = s[0] & 2 ? o.return : s[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, s[1])).done) return i;
429
- switch (o = 0, i && (s = [s[0] & 2, i.value]), s[0]) {
374
+ if (r = 1, i && (o = s[0] & 2 ? i.return : s[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, s[1])).done) return o;
375
+ switch (i = 0, o && (s = [s[0] & 2, o.value]), s[0]) {
430
376
  case 0:
431
377
  case 1:
432
- i = s;
378
+ o = s;
433
379
  break;
434
380
  case 4:
435
381
  return e.label++, { value: s[1], done: !1 };
436
382
  case 5:
437
- e.label++, o = s[1], s = [0];
383
+ e.label++, i = s[1], s = [0];
438
384
  continue;
439
385
  case 7:
440
386
  s = e.ops.pop(), e.trys.pop();
441
387
  continue;
442
388
  default:
443
- if (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (s[0] === 6 || s[0] === 2)) {
389
+ if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (s[0] === 6 || s[0] === 2)) {
444
390
  e = 0;
445
391
  continue;
446
392
  }
447
- if (s[0] === 3 && (!i || s[1] > i[0] && s[1] < i[3])) {
393
+ if (s[0] === 3 && (!o || s[1] > o[0] && s[1] < o[3])) {
448
394
  e.label = s[1];
449
395
  break;
450
396
  }
451
- if (s[0] === 6 && e.label < i[1]) {
452
- e.label = i[1], i = s;
397
+ if (s[0] === 6 && e.label < o[1]) {
398
+ e.label = o[1], o = s;
453
399
  break;
454
400
  }
455
- if (i && e.label < i[2]) {
456
- e.label = i[2], e.ops.push(s);
401
+ if (o && e.label < o[2]) {
402
+ e.label = o[2], e.ops.push(s);
457
403
  break;
458
404
  }
459
- i[2] && e.ops.pop(), e.trys.pop();
405
+ o[2] && e.ops.pop(), e.trys.pop();
460
406
  continue;
461
407
  }
462
- s = r.call(t, e);
408
+ s = n.call(t, e);
463
409
  } catch (f) {
464
- s = [6, f], o = 0;
410
+ s = [6, f], i = 0;
465
411
  } finally {
466
- n = i = 0;
412
+ r = o = 0;
467
413
  }
468
414
  if (s[0] & 5) throw s[1];
469
415
  return { value: s[0] ? s[1] : void 0, done: !0 };
470
416
  }
471
417
  }
472
- function k(t) {
473
- var r = typeof Symbol == "function" && Symbol.iterator, e = r && t[r], n = 0;
418
+ function _(t) {
419
+ var n = typeof Symbol == "function" && Symbol.iterator, e = n && t[n], r = 0;
474
420
  if (e) return e.call(t);
475
421
  if (t && typeof t.length == "number") return {
476
422
  next: function() {
477
- return t && n >= t.length && (t = void 0), { value: t && t[n++], done: !t };
423
+ return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t };
478
424
  }
479
425
  };
480
- throw new TypeError(r ? "Object is not iterable." : "Symbol.iterator is not defined.");
426
+ throw new TypeError(n ? "Object is not iterable." : "Symbol.iterator is not defined.");
481
427
  }
482
- function _(t) {
483
- return this instanceof _ ? (this.v = t, this) : new _(t);
428
+ function z(t) {
429
+ return this instanceof z ? (this.v = t, this) : new z(t);
484
430
  }
485
- function ze(t, r, e) {
431
+ function Ge(t, n, e) {
486
432
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
487
- var n = e.apply(t, r || []), o, i = [];
488
- return o = {}, a("next"), a("throw"), a("return"), o[Symbol.asyncIterator] = function() {
433
+ var r = e.apply(t, n || []), i, o = [];
434
+ return i = {}, u("next"), u("throw"), u("return"), i[Symbol.asyncIterator] = function() {
489
435
  return this;
490
- }, o;
491
- function a(l) {
492
- n[l] && (o[l] = function(p) {
493
- return new Promise(function(d, v) {
494
- i.push([l, p, d, v]) > 1 || u(l, p);
436
+ }, i;
437
+ function u(c) {
438
+ r[c] && (i[c] = function(d) {
439
+ return new Promise(function(h, y) {
440
+ o.push([c, d, h, y]) > 1 || l(c, d);
495
441
  });
496
442
  });
497
443
  }
498
- function u(l, p) {
444
+ function l(c, d) {
499
445
  try {
500
- c(n[l](p));
501
- } catch (d) {
502
- h(i[0][3], d);
446
+ a(r[c](d));
447
+ } catch (h) {
448
+ p(o[0][3], h);
503
449
  }
504
450
  }
505
- function c(l) {
506
- l.value instanceof _ ? Promise.resolve(l.value.v).then(s, f) : h(i[0][2], l);
451
+ function a(c) {
452
+ c.value instanceof z ? Promise.resolve(c.value.v).then(s, f) : p(o[0][2], c);
507
453
  }
508
- function s(l) {
509
- u("next", l);
454
+ function s(c) {
455
+ l("next", c);
510
456
  }
511
- function f(l) {
512
- u("throw", l);
457
+ function f(c) {
458
+ l("throw", c);
513
459
  }
514
- function h(l, p) {
515
- l(p), i.shift(), i.length && u(i[0][0], i[0][1]);
460
+ function p(c, d) {
461
+ c(d), o.shift(), o.length && l(o[0][0], o[0][1]);
516
462
  }
517
463
  }
518
464
  var fe = (
519
465
  /** @class */
520
466
  function(t) {
521
- _e(r, t);
522
- function r(e) {
523
- var n = t.call(this, e) || this;
524
- return Object.defineProperty(n, "name", {
467
+ Ee(n, t);
468
+ function n(e) {
469
+ var r = t.call(this, e) || this;
470
+ return Object.defineProperty(r, "name", {
525
471
  value: "RepeaterOverflowError",
526
472
  enumerable: !1
527
- }), typeof Object.setPrototypeOf == "function" ? Object.setPrototypeOf(n, n.constructor.prototype) : n.__proto__ = n.constructor.prototype, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(n, n.constructor), n;
473
+ }), typeof Object.setPrototypeOf == "function" ? Object.setPrototypeOf(r, r.constructor.prototype) : r.__proto__ = r.constructor.prototype, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(r, r.constructor), r;
528
474
  }
529
- return r;
475
+ return n;
530
476
  }(Error)
531
477
  );
532
478
  (function() {
533
- function t(r) {
534
- if (r < 0)
479
+ function t(n) {
480
+ if (n < 0)
535
481
  throw new RangeError("Capacity may not be less than 0");
536
- this._c = r, this._q = [];
482
+ this._c = n, this._q = [];
537
483
  }
538
484
  return Object.defineProperty(t.prototype, "empty", {
539
485
  get: function() {
@@ -547,10 +493,10 @@ var fe = (
547
493
  },
548
494
  enumerable: !1,
549
495
  configurable: !0
550
- }), t.prototype.add = function(r) {
496
+ }), t.prototype.add = function(n) {
551
497
  if (this.full)
552
498
  throw new Error("Buffer full");
553
- this._q.push(r);
499
+ this._q.push(n);
554
500
  }, t.prototype.remove = function() {
555
501
  if (this.empty)
556
502
  throw new Error("Buffer empty");
@@ -558,10 +504,10 @@ var fe = (
558
504
  }, t;
559
505
  })();
560
506
  (function() {
561
- function t(r) {
562
- if (r < 1)
507
+ function t(n) {
508
+ if (n < 1)
563
509
  throw new RangeError("Capacity may not be less than 1");
564
- this._c = r, this._q = [];
510
+ this._c = n, this._q = [];
565
511
  }
566
512
  return Object.defineProperty(t.prototype, "empty", {
567
513
  get: function() {
@@ -575,10 +521,10 @@ var fe = (
575
521
  },
576
522
  enumerable: !1,
577
523
  configurable: !0
578
- }), t.prototype.add = function(r) {
524
+ }), t.prototype.add = function(n) {
579
525
  for (; this._q.length >= this._c; )
580
526
  this._q.shift();
581
- this._q.push(r);
527
+ this._q.push(n);
582
528
  }, t.prototype.remove = function() {
583
529
  if (this.empty)
584
530
  throw new Error("Buffer empty");
@@ -586,10 +532,10 @@ var fe = (
586
532
  }, t;
587
533
  })();
588
534
  (function() {
589
- function t(r) {
590
- if (r < 1)
535
+ function t(n) {
536
+ if (n < 1)
591
537
  throw new RangeError("Capacity may not be less than 1");
592
- this._c = r, this._q = [];
538
+ this._c = n, this._q = [];
593
539
  }
594
540
  return Object.defineProperty(t.prototype, "empty", {
595
541
  get: function() {
@@ -603,8 +549,8 @@ var fe = (
603
549
  },
604
550
  enumerable: !1,
605
551
  configurable: !0
606
- }), t.prototype.add = function(r) {
607
- this._q.length < this._c && this._q.push(r);
552
+ }), t.prototype.add = function(n) {
553
+ this._q.length < this._c && this._q.push(n);
608
554
  }, t.prototype.remove = function() {
609
555
  if (this.empty)
610
556
  throw new Error("Buffer empty");
@@ -612,15 +558,15 @@ var fe = (
612
558
  }, t;
613
559
  })();
614
560
  function $(t) {
615
- t != null && typeof t.then == "function" && t.then(I, I);
561
+ t != null && typeof t.then == "function" && t.then(A, A);
616
562
  }
617
- var V = 0, H = 1, G = 2, q = 3, C = 4, F = 1024, I = function() {
563
+ var B = 0, H = 1, O = 2, F = 3, U = 4, I = 1024, A = function() {
618
564
  };
619
- function E(t) {
620
- var r = t.err, e = Promise.resolve(t.execution).then(function(n) {
621
- if (r != null)
622
- throw r;
623
- return n;
565
+ function S(t) {
566
+ var n = t.err, e = Promise.resolve(t.execution).then(function(r) {
567
+ if (n != null)
568
+ throw n;
569
+ return r;
624
570
  });
625
571
  return t.err = void 0, t.execution = e.then(function() {
626
572
  }, function() {
@@ -628,188 +574,188 @@ function E(t) {
628
574
  return e;
629
575
  });
630
576
  }
631
- function x(t, r) {
632
- var e = t.state >= q;
633
- return Promise.resolve(r).then(function(n) {
634
- return !e && t.state >= C ? E(t).then(function(o) {
577
+ function x(t, n) {
578
+ var e = t.state >= F;
579
+ return Promise.resolve(n).then(function(r) {
580
+ return !e && t.state >= U ? S(t).then(function(i) {
635
581
  return {
636
- value: o,
582
+ value: i,
637
583
  done: !0
638
584
  };
639
- }) : { value: n, done: e };
585
+ }) : { value: r, done: e };
640
586
  });
641
587
  }
642
- function K(t, r) {
643
- var e, n;
644
- if (!(t.state >= G))
645
- if (t.state = G, t.onnext(), t.onstop(), t.err == null && (t.err = r), t.pushes.length === 0 && (typeof t.buffer > "u" || t.buffer.empty))
588
+ function K(t, n) {
589
+ var e, r;
590
+ if (!(t.state >= O))
591
+ if (t.state = O, t.onnext(), t.onstop(), t.err == null && (t.err = n), t.pushes.length === 0 && (typeof t.buffer > "u" || t.buffer.empty))
646
592
  R(t);
647
593
  else
648
594
  try {
649
- for (var o = k(t.pushes), i = o.next(); !i.done; i = o.next()) {
650
- var a = i.value;
651
- a.resolve();
595
+ for (var i = _(t.pushes), o = i.next(); !o.done; o = i.next()) {
596
+ var u = o.value;
597
+ u.resolve();
652
598
  }
653
- } catch (u) {
654
- e = { error: u };
599
+ } catch (l) {
600
+ e = { error: l };
655
601
  } finally {
656
602
  try {
657
- i && !i.done && (n = o.return) && n.call(o);
603
+ o && !o.done && (r = i.return) && r.call(i);
658
604
  } finally {
659
605
  if (e) throw e.error;
660
606
  }
661
607
  }
662
608
  }
663
609
  function R(t) {
664
- var r, e;
665
- if (!(t.state >= q)) {
666
- t.state < G && K(t), t.state = q, t.buffer = void 0;
610
+ var n, e;
611
+ if (!(t.state >= F)) {
612
+ t.state < O && K(t), t.state = F, t.buffer = void 0;
667
613
  try {
668
- for (var n = k(t.nexts), o = n.next(); !o.done; o = n.next()) {
669
- var i = o.value, a = t.pending === void 0 ? E(t) : t.pending.then(function() {
670
- return E(t);
614
+ for (var r = _(t.nexts), i = r.next(); !i.done; i = r.next()) {
615
+ var o = i.value, u = t.pending === void 0 ? S(t) : t.pending.then(function() {
616
+ return S(t);
671
617
  });
672
- i.resolve(x(t, a));
618
+ o.resolve(x(t, u));
673
619
  }
674
- } catch (u) {
675
- r = { error: u };
620
+ } catch (l) {
621
+ n = { error: l };
676
622
  } finally {
677
623
  try {
678
- o && !o.done && (e = n.return) && e.call(n);
624
+ i && !i.done && (e = r.return) && e.call(r);
679
625
  } finally {
680
- if (r) throw r.error;
626
+ if (n) throw n.error;
681
627
  }
682
628
  }
683
629
  t.pushes = [], t.nexts = [];
684
630
  }
685
631
  }
686
632
  function Q(t) {
687
- t.state >= C || (t.state < q && R(t), t.state = C);
633
+ t.state >= U || (t.state < F && R(t), t.state = U);
688
634
  }
689
- function Te(t, r) {
690
- if ($(r), t.pushes.length >= F)
691
- throw new fe("No more than " + F + " pending calls to push are allowed on a single repeater.");
692
- if (t.state >= G)
635
+ function _e(t, n) {
636
+ if ($(n), t.pushes.length >= I)
637
+ throw new fe("No more than " + I + " pending calls to push are allowed on a single repeater.");
638
+ if (t.state >= O)
693
639
  return Promise.resolve(void 0);
694
- var e = t.pending === void 0 ? Promise.resolve(r) : t.pending.then(function() {
695
- return r;
640
+ var e = t.pending === void 0 ? Promise.resolve(n) : t.pending.then(function() {
641
+ return n;
696
642
  });
697
- e = e.catch(function(c) {
698
- t.state < G && (t.err = c), Q(t);
643
+ e = e.catch(function(a) {
644
+ t.state < O && (t.err = a), Q(t);
699
645
  });
700
- var n;
646
+ var r;
701
647
  if (t.nexts.length) {
702
- var o = t.nexts.shift();
703
- o.resolve(x(t, e)), t.nexts.length ? n = Promise.resolve(t.nexts[0].value) : typeof t.buffer < "u" && !t.buffer.full ? n = Promise.resolve(void 0) : n = new Promise(function(c) {
704
- return t.onnext = c;
648
+ var i = t.nexts.shift();
649
+ i.resolve(x(t, e)), t.nexts.length ? r = Promise.resolve(t.nexts[0].value) : typeof t.buffer < "u" && !t.buffer.full ? r = Promise.resolve(void 0) : r = new Promise(function(a) {
650
+ return t.onnext = a;
705
651
  });
706
- } else typeof t.buffer < "u" && !t.buffer.full ? (t.buffer.add(e), n = Promise.resolve(void 0)) : n = new Promise(function(c) {
707
- return t.pushes.push({ resolve: c, value: e });
652
+ } else typeof t.buffer < "u" && !t.buffer.full ? (t.buffer.add(e), r = Promise.resolve(void 0)) : r = new Promise(function(a) {
653
+ return t.pushes.push({ resolve: a, value: e });
708
654
  });
709
- var i = !0, a = {}, u = n.catch(function(c) {
710
- if (i)
711
- throw c;
655
+ var o = !0, u = {}, l = r.catch(function(a) {
656
+ if (o)
657
+ throw a;
712
658
  });
713
- return a.then = function(c, s) {
714
- return i = !1, Promise.prototype.then.call(n, c, s);
715
- }, a.catch = function(c) {
716
- return i = !1, Promise.prototype.catch.call(n, c);
717
- }, a.finally = n.finally.bind(n), t.pending = e.then(function() {
718
- return u;
719
- }).catch(function(c) {
720
- t.err = c, Q(t);
721
- }), a;
659
+ return u.then = function(a, s) {
660
+ return o = !1, Promise.prototype.then.call(r, a, s);
661
+ }, u.catch = function(a) {
662
+ return o = !1, Promise.prototype.catch.call(r, a);
663
+ }, u.finally = r.finally.bind(r), t.pending = e.then(function() {
664
+ return l;
665
+ }).catch(function(a) {
666
+ t.err = a, Q(t);
667
+ }), u;
722
668
  }
723
- function Me(t) {
724
- var r = K.bind(null, t), e = new Promise(function(n) {
725
- return t.onstop = n;
669
+ function Re(t) {
670
+ var n = K.bind(null, t), e = new Promise(function(r) {
671
+ return t.onstop = r;
726
672
  });
727
- return r.then = e.then.bind(e), r.catch = e.catch.bind(e), r.finally = e.finally.bind(e), r;
673
+ return n.then = e.then.bind(e), n.catch = e.catch.bind(e), n.finally = e.finally.bind(e), n;
728
674
  }
729
- function De(t) {
675
+ function ze(t) {
730
676
  if (!(t.state >= H)) {
731
677
  t.state = H;
732
- var r = Te.bind(null, t), e = Me(t);
733
- t.execution = new Promise(function(n) {
734
- return n(t.executor(r, e));
678
+ var n = _e.bind(null, t), e = Re(t);
679
+ t.execution = new Promise(function(r) {
680
+ return r(t.executor(n, e));
735
681
  }), t.execution.catch(function() {
736
682
  return K(t);
737
683
  });
738
684
  }
739
685
  }
740
- var D = /* @__PURE__ */ new WeakMap(), z = (
686
+ var D = /* @__PURE__ */ new WeakMap(), k = (
741
687
  /** @class */
742
688
  function() {
743
- function t(r, e) {
689
+ function t(n, e) {
744
690
  D.set(this, {
745
- executor: r,
691
+ executor: n,
746
692
  buffer: e,
747
693
  err: void 0,
748
- state: V,
694
+ state: B,
749
695
  pushes: [],
750
696
  nexts: [],
751
697
  pending: void 0,
752
698
  execution: void 0,
753
- onnext: I,
754
- onstop: I
699
+ onnext: A,
700
+ onstop: A
755
701
  });
756
702
  }
757
- return t.prototype.next = function(r) {
758
- $(r);
703
+ return t.prototype.next = function(n) {
704
+ $(n);
759
705
  var e = D.get(this);
760
706
  if (e === void 0)
761
707
  throw new Error("WeakMap error");
762
- if (e.nexts.length >= F)
763
- throw new fe("No more than " + F + " pending calls to next are allowed on a single repeater.");
764
- if (e.state <= V && De(e), e.onnext(r), typeof e.buffer < "u" && !e.buffer.empty) {
765
- var n = x(e, e.buffer.remove());
708
+ if (e.nexts.length >= I)
709
+ throw new fe("No more than " + I + " pending calls to next are allowed on a single repeater.");
710
+ if (e.state <= B && ze(e), e.onnext(n), typeof e.buffer < "u" && !e.buffer.empty) {
711
+ var r = x(e, e.buffer.remove());
766
712
  if (e.pushes.length) {
767
- var o = e.pushes.shift();
768
- e.buffer.add(o.value), e.onnext = o.resolve;
713
+ var i = e.pushes.shift();
714
+ e.buffer.add(i.value), e.onnext = i.resolve;
769
715
  }
770
- return n;
716
+ return r;
771
717
  } else if (e.pushes.length) {
772
- var i = e.pushes.shift();
773
- return e.onnext = i.resolve, x(e, i.value);
774
- } else if (e.state >= G)
775
- return R(e), x(e, E(e));
776
- return new Promise(function(a) {
777
- return e.nexts.push({ resolve: a, value: r });
718
+ var o = e.pushes.shift();
719
+ return e.onnext = o.resolve, x(e, o.value);
720
+ } else if (e.state >= O)
721
+ return R(e), x(e, S(e));
722
+ return new Promise(function(u) {
723
+ return e.nexts.push({ resolve: u, value: n });
778
724
  });
779
- }, t.prototype.return = function(r) {
780
- $(r);
725
+ }, t.prototype.return = function(n) {
726
+ $(n);
781
727
  var e = D.get(this);
782
728
  if (e === void 0)
783
729
  throw new Error("WeakMap error");
784
730
  return R(e), e.execution = Promise.resolve(e.execution).then(function() {
785
- return r;
786
- }), x(e, E(e));
787
- }, t.prototype.throw = function(r) {
731
+ return n;
732
+ }), x(e, S(e));
733
+ }, t.prototype.throw = function(n) {
788
734
  var e = D.get(this);
789
735
  if (e === void 0)
790
736
  throw new Error("WeakMap error");
791
- return e.state <= V || e.state >= G || typeof e.buffer < "u" && !e.buffer.empty ? (R(e), e.err == null && (e.err = r), x(e, E(e))) : this.next(Promise.reject(r));
737
+ return e.state <= B || e.state >= O || typeof e.buffer < "u" && !e.buffer.empty ? (R(e), e.err == null && (e.err = n), x(e, S(e))) : this.next(Promise.reject(n));
792
738
  }, t.prototype[Symbol.asyncIterator] = function() {
793
739
  return this;
794
- }, t.race = qe, t.merge = Fe, t.zip = Ie, t.latest = Ae, t;
740
+ }, t.race = ke, t.merge = Te, t.zip = qe, t.latest = De, t;
795
741
  }()
796
742
  );
797
- function N(t, r) {
798
- var e, n, o = [], i = function(s) {
799
- s != null && typeof s[Symbol.asyncIterator] == "function" ? o.push(s[Symbol.asyncIterator]()) : s != null && typeof s[Symbol.iterator] == "function" ? o.push(s[Symbol.iterator]()) : o.push(function() {
800
- return ze(this, arguments, function() {
801
- return P(this, function(l) {
802
- switch (l.label) {
743
+ function V(t, n) {
744
+ var e, r, i = [], o = function(s) {
745
+ s != null && typeof s[Symbol.asyncIterator] == "function" ? i.push(s[Symbol.asyncIterator]()) : s != null && typeof s[Symbol.iterator] == "function" ? i.push(s[Symbol.iterator]()) : i.push(function() {
746
+ return Ge(this, arguments, function() {
747
+ return P(this, function(c) {
748
+ switch (c.label) {
803
749
  case 0:
804
- return r.yieldValues ? [4, _(s)] : [3, 3];
750
+ return n.yieldValues ? [4, z(s)] : [3, 3];
805
751
  case 1:
806
- return [4, l.sent()];
752
+ return [4, c.sent()];
807
753
  case 2:
808
- l.sent(), l.label = 3;
754
+ c.sent(), c.label = 3;
809
755
  case 3:
810
- return r.returnValues ? [4, _(s)] : [3, 5];
756
+ return n.returnValues ? [4, z(s)] : [3, 5];
811
757
  case 4:
812
- return [2, l.sent()];
758
+ return [2, c.sent()];
813
759
  case 5:
814
760
  return [
815
761
  2
@@ -821,67 +767,67 @@ function N(t, r) {
821
767
  }());
822
768
  };
823
769
  try {
824
- for (var a = k(t), u = a.next(); !u.done; u = a.next()) {
825
- var c = u.value;
826
- i(c);
770
+ for (var u = _(t), l = u.next(); !l.done; l = u.next()) {
771
+ var a = l.value;
772
+ o(a);
827
773
  }
828
774
  } catch (s) {
829
775
  e = { error: s };
830
776
  } finally {
831
777
  try {
832
- u && !u.done && (n = a.return) && n.call(a);
778
+ l && !l.done && (r = u.return) && r.call(u);
833
779
  } finally {
834
780
  if (e) throw e.error;
835
781
  }
836
782
  }
837
- return o;
783
+ return i;
838
784
  }
839
- function qe(t) {
840
- var r = this, e = N(t, { returnValues: !0 });
841
- return new z(function(n, o) {
842
- return j(r, void 0, void 0, function() {
843
- var i, a, u, c, s, f;
844
- return P(this, function(h) {
845
- switch (h.label) {
785
+ function ke(t) {
786
+ var n = this, e = V(t, { returnValues: !0 });
787
+ return new k(function(r, i) {
788
+ return G(n, void 0, void 0, function() {
789
+ var o, u, l, a, s, f;
790
+ return P(this, function(p) {
791
+ switch (p.label) {
846
792
  case 0:
847
793
  if (!e.length)
848
- return o(), [
794
+ return i(), [
849
795
  2
850
796
  /*return*/
851
797
  ];
852
- a = !1, o.then(function() {
853
- i(), a = !0;
854
- }), h.label = 1;
798
+ u = !1, i.then(function() {
799
+ o(), u = !0;
800
+ }), p.label = 1;
855
801
  case 1:
856
- h.trys.push([1, , 5, 7]), c = void 0, s = 0, f = function() {
857
- var l, p, d, v, m, T;
858
- return P(this, function(M) {
859
- switch (M.label) {
802
+ p.trys.push([1, , 5, 7]), a = void 0, s = 0, f = function() {
803
+ var c, d, h, y, m, T;
804
+ return P(this, function(q) {
805
+ switch (q.label) {
860
806
  case 0:
861
- l = s;
807
+ c = s;
862
808
  try {
863
- for (p = (m = void 0, k(e)), d = p.next(); !d.done; d = p.next())
864
- v = d.value, Promise.resolve(v.next()).then(function(w) {
865
- w.done ? (o(), u === void 0 && (u = w)) : s === l && (s++, i(w));
809
+ for (d = (m = void 0, _(e)), h = d.next(); !h.done; h = d.next())
810
+ y = h.value, Promise.resolve(y.next()).then(function(w) {
811
+ w.done ? (i(), l === void 0 && (l = w)) : s === c && (s++, o(w));
866
812
  }, function(w) {
867
- return o(w);
813
+ return i(w);
868
814
  });
869
815
  } catch (w) {
870
816
  m = { error: w };
871
817
  } finally {
872
818
  try {
873
- d && !d.done && (T = p.return) && T.call(p);
819
+ h && !h.done && (T = d.return) && T.call(d);
874
820
  } finally {
875
821
  if (m) throw m.error;
876
822
  }
877
823
  }
878
824
  return [4, new Promise(function(w) {
879
- return i = w;
825
+ return o = w;
880
826
  })];
881
827
  case 1:
882
- return c = M.sent(), c === void 0 ? [3, 3] : [4, n(c.value)];
828
+ return a = q.sent(), a === void 0 ? [3, 3] : [4, r(a.value)];
883
829
  case 2:
884
- M.sent(), M.label = 3;
830
+ q.sent(), q.label = 3;
885
831
  case 3:
886
832
  return [
887
833
  2
@@ -889,19 +835,19 @@ function qe(t) {
889
835
  ];
890
836
  }
891
837
  });
892
- }, h.label = 2;
838
+ }, p.label = 2;
893
839
  case 2:
894
- return a ? [3, 4] : [5, f()];
840
+ return u ? [3, 4] : [5, f()];
895
841
  case 3:
896
- return h.sent(), [3, 2];
842
+ return p.sent(), [3, 2];
897
843
  case 4:
898
- return [2, u && u.value];
844
+ return [2, l && l.value];
899
845
  case 5:
900
- return o(), [4, Promise.race(e.map(function(l) {
901
- return l.return && l.return();
846
+ return i(), [4, Promise.race(e.map(function(c) {
847
+ return c.return && c.return();
902
848
  }))];
903
849
  case 6:
904
- return h.sent(), [
850
+ return p.sent(), [
905
851
  7
906
852
  /*endfinally*/
907
853
  ];
@@ -915,68 +861,68 @@ function qe(t) {
915
861
  });
916
862
  });
917
863
  }
918
- function Fe(t) {
919
- var r = this, e = N(t, { yieldValues: !0 });
920
- return new z(function(n, o) {
921
- return j(r, void 0, void 0, function() {
922
- var i, a, u, c = this;
864
+ function Te(t) {
865
+ var n = this, e = V(t, { yieldValues: !0 });
866
+ return new k(function(r, i) {
867
+ return G(n, void 0, void 0, function() {
868
+ var o, u, l, a = this;
923
869
  return P(this, function(s) {
924
870
  switch (s.label) {
925
871
  case 0:
926
872
  if (!e.length)
927
- return o(), [
873
+ return i(), [
928
874
  2
929
875
  /*return*/
930
876
  ];
931
- i = [], a = !1, o.then(function() {
932
- var f, h;
933
- a = !0;
877
+ o = [], u = !1, i.then(function() {
878
+ var f, p;
879
+ u = !0;
934
880
  try {
935
- for (var l = k(i), p = l.next(); !p.done; p = l.next()) {
936
- var d = p.value;
937
- d();
881
+ for (var c = _(o), d = c.next(); !d.done; d = c.next()) {
882
+ var h = d.value;
883
+ h();
938
884
  }
939
- } catch (v) {
940
- f = { error: v };
885
+ } catch (y) {
886
+ f = { error: y };
941
887
  } finally {
942
888
  try {
943
- p && !p.done && (h = l.return) && h.call(l);
889
+ d && !d.done && (p = c.return) && p.call(c);
944
890
  } finally {
945
891
  if (f) throw f.error;
946
892
  }
947
893
  }
948
894
  }), s.label = 1;
949
895
  case 1:
950
- return s.trys.push([1, , 3, 4]), [4, Promise.all(e.map(function(f, h) {
951
- return j(c, void 0, void 0, function() {
952
- var l, p;
953
- return P(this, function(d) {
954
- switch (d.label) {
896
+ return s.trys.push([1, , 3, 4]), [4, Promise.all(e.map(function(f, p) {
897
+ return G(a, void 0, void 0, function() {
898
+ var c, d;
899
+ return P(this, function(h) {
900
+ switch (h.label) {
955
901
  case 0:
956
- d.trys.push([0, , 6, 9]), d.label = 1;
902
+ h.trys.push([0, , 6, 9]), h.label = 1;
957
903
  case 1:
958
- return a ? [3, 5] : (Promise.resolve(f.next()).then(function(v) {
959
- return i[h](v);
960
- }, function(v) {
961
- return o(v);
962
- }), [4, new Promise(function(v) {
963
- i[h] = v;
904
+ return u ? [3, 5] : (Promise.resolve(f.next()).then(function(y) {
905
+ return o[p](y);
906
+ }, function(y) {
907
+ return i(y);
908
+ }), [4, new Promise(function(y) {
909
+ o[p] = y;
964
910
  })]);
965
911
  case 2:
966
- return l = d.sent(), l === void 0 ? [3, 4] : l.done ? (u = l, [
912
+ return c = h.sent(), c === void 0 ? [3, 4] : c.done ? (l = c, [
967
913
  2
968
914
  /*return*/
969
- ]) : [4, n(l.value)];
915
+ ]) : [4, r(c.value)];
970
916
  case 3:
971
- d.sent(), d.label = 4;
917
+ h.sent(), h.label = 4;
972
918
  case 4:
973
919
  return [3, 1];
974
920
  case 5:
975
921
  return [3, 9];
976
922
  case 6:
977
- return p = f.return, p ? [4, f.return()] : [3, 8];
923
+ return d = f.return, d ? [4, f.return()] : [3, 8];
978
924
  case 7:
979
- p = d.sent(), d.label = 8;
925
+ d = h.sent(), h.label = 8;
980
926
  case 8:
981
927
  return [
982
928
  7
@@ -992,9 +938,9 @@ function Fe(t) {
992
938
  });
993
939
  }))];
994
940
  case 2:
995
- return s.sent(), [2, u && u.value];
941
+ return s.sent(), [2, l && l.value];
996
942
  case 3:
997
- return o(), [
943
+ return i(), [
998
944
  7
999
945
  /*endfinally*/
1000
946
  ];
@@ -1008,46 +954,46 @@ function Fe(t) {
1008
954
  });
1009
955
  });
1010
956
  }
1011
- function Ie(t) {
1012
- var r = this, e = N(t, { returnValues: !0 });
1013
- return new z(function(n, o) {
1014
- return j(r, void 0, void 0, function() {
1015
- var i, a, u, c;
957
+ function qe(t) {
958
+ var n = this, e = V(t, { returnValues: !0 });
959
+ return new k(function(r, i) {
960
+ return G(n, void 0, void 0, function() {
961
+ var o, u, l, a;
1016
962
  return P(this, function(s) {
1017
963
  switch (s.label) {
1018
964
  case 0:
1019
965
  if (!e.length)
1020
- return o(), [2, []];
1021
- a = !1, o.then(function() {
1022
- i(), a = !0;
966
+ return i(), [2, []];
967
+ u = !1, i.then(function() {
968
+ o(), u = !0;
1023
969
  }), s.label = 1;
1024
970
  case 1:
1025
971
  s.trys.push([1, , 6, 8]), s.label = 2;
1026
972
  case 2:
1027
- return a ? [3, 5] : (Promise.all(e.map(function(f) {
973
+ return u ? [3, 5] : (Promise.all(e.map(function(f) {
1028
974
  return f.next();
1029
975
  })).then(function(f) {
1030
- return i(f);
1031
- }, function(f) {
1032
976
  return o(f);
977
+ }, function(f) {
978
+ return i(f);
1033
979
  }), [4, new Promise(function(f) {
1034
- return i = f;
980
+ return o = f;
1035
981
  })]);
1036
982
  case 3:
1037
- return u = s.sent(), u === void 0 ? [
983
+ return l = s.sent(), l === void 0 ? [
1038
984
  2
1039
985
  /*return*/
1040
- ] : (c = u.map(function(f) {
986
+ ] : (a = l.map(function(f) {
1041
987
  return f.value;
1042
- }), u.some(function(f) {
988
+ }), l.some(function(f) {
1043
989
  return f.done;
1044
- }) ? [2, c] : [4, n(c)]);
990
+ }) ? [2, a] : [4, r(a)]);
1045
991
  case 4:
1046
992
  return s.sent(), [3, 2];
1047
993
  case 5:
1048
994
  return [3, 8];
1049
995
  case 6:
1050
- return o(), [4, Promise.all(e.map(function(f) {
996
+ return i(), [4, Promise.all(e.map(function(f) {
1051
997
  return f.return && f.return();
1052
998
  }))];
1053
999
  case 7:
@@ -1065,79 +1011,79 @@ function Ie(t) {
1065
1011
  });
1066
1012
  });
1067
1013
  }
1068
- function Ae(t) {
1069
- var r = this, e = N(t, {
1014
+ function De(t) {
1015
+ var n = this, e = V(t, {
1070
1016
  yieldValues: !0,
1071
1017
  returnValues: !0
1072
1018
  });
1073
- return new z(function(n, o) {
1074
- return j(r, void 0, void 0, function() {
1075
- var i, a, u, c, s, f = this;
1076
- return P(this, function(h) {
1077
- switch (h.label) {
1019
+ return new k(function(r, i) {
1020
+ return G(n, void 0, void 0, function() {
1021
+ var o, u, l, a, s, f = this;
1022
+ return P(this, function(p) {
1023
+ switch (p.label) {
1078
1024
  case 0:
1079
1025
  if (!e.length)
1080
- return o(), [2, []];
1081
- a = [], u = !1, o.then(function() {
1082
- var l, p;
1083
- i();
1026
+ return i(), [2, []];
1027
+ u = [], l = !1, i.then(function() {
1028
+ var c, d;
1029
+ o();
1084
1030
  try {
1085
- for (var d = k(a), v = d.next(); !v.done; v = d.next()) {
1086
- var m = v.value;
1031
+ for (var h = _(u), y = h.next(); !y.done; y = h.next()) {
1032
+ var m = y.value;
1087
1033
  m();
1088
1034
  }
1089
1035
  } catch (T) {
1090
- l = { error: T };
1036
+ c = { error: T };
1091
1037
  } finally {
1092
1038
  try {
1093
- v && !v.done && (p = d.return) && p.call(d);
1039
+ y && !y.done && (d = h.return) && d.call(h);
1094
1040
  } finally {
1095
- if (l) throw l.error;
1041
+ if (c) throw c.error;
1096
1042
  }
1097
1043
  }
1098
- u = !0;
1099
- }), h.label = 1;
1044
+ l = !0;
1045
+ }), p.label = 1;
1100
1046
  case 1:
1101
- return h.trys.push([1, , 5, 7]), Promise.all(e.map(function(l) {
1102
- return l.next();
1103
- })).then(function(l) {
1104
- return i(l);
1105
- }, function(l) {
1106
- return o(l);
1107
- }), [4, new Promise(function(l) {
1108
- return i = l;
1047
+ return p.trys.push([1, , 5, 7]), Promise.all(e.map(function(c) {
1048
+ return c.next();
1049
+ })).then(function(c) {
1050
+ return o(c);
1051
+ }, function(c) {
1052
+ return i(c);
1053
+ }), [4, new Promise(function(c) {
1054
+ return o = c;
1109
1055
  })];
1110
1056
  case 2:
1111
- return c = h.sent(), c === void 0 ? [
1057
+ return a = p.sent(), a === void 0 ? [
1112
1058
  2
1113
1059
  /*return*/
1114
- ] : (s = c.map(function(l) {
1115
- return l.value;
1116
- }), c.every(function(l) {
1117
- return l.done;
1118
- }) ? [2, s] : [4, n(s.slice())]);
1060
+ ] : (s = a.map(function(c) {
1061
+ return c.value;
1062
+ }), a.every(function(c) {
1063
+ return c.done;
1064
+ }) ? [2, s] : [4, r(s.slice())]);
1119
1065
  case 3:
1120
- return h.sent(), [4, Promise.all(e.map(function(l, p) {
1121
- return j(f, void 0, void 0, function() {
1122
- var d;
1123
- return P(this, function(v) {
1124
- switch (v.label) {
1066
+ return p.sent(), [4, Promise.all(e.map(function(c, d) {
1067
+ return G(f, void 0, void 0, function() {
1068
+ var h;
1069
+ return P(this, function(y) {
1070
+ switch (y.label) {
1125
1071
  case 0:
1126
- if (c[p].done)
1127
- return [2, c[p].value];
1128
- v.label = 1;
1072
+ if (a[d].done)
1073
+ return [2, a[d].value];
1074
+ y.label = 1;
1129
1075
  case 1:
1130
- return u ? [3, 4] : (Promise.resolve(l.next()).then(function(m) {
1131
- return a[p](m);
1076
+ return l ? [3, 4] : (Promise.resolve(c.next()).then(function(m) {
1077
+ return u[d](m);
1132
1078
  }, function(m) {
1133
- return o(m);
1079
+ return i(m);
1134
1080
  }), [4, new Promise(function(m) {
1135
- return a[p] = m;
1081
+ return u[d] = m;
1136
1082
  })]);
1137
1083
  case 2:
1138
- return d = v.sent(), d === void 0 ? [2, c[p].value] : d.done ? [2, d.value] : (s[p] = d.value, [4, n(s.slice())]);
1084
+ return h = y.sent(), h === void 0 ? [2, a[d].value] : h.done ? [2, h.value] : (s[d] = h.value, [4, r(s.slice())]);
1139
1085
  case 3:
1140
- return v.sent(), [3, 1];
1086
+ return y.sent(), [3, 1];
1141
1087
  case 4:
1142
1088
  return [
1143
1089
  2
@@ -1148,13 +1094,13 @@ function Ae(t) {
1148
1094
  });
1149
1095
  }))];
1150
1096
  case 4:
1151
- return [2, h.sent()];
1097
+ return [2, p.sent()];
1152
1098
  case 5:
1153
- return o(), [4, Promise.all(e.map(function(l) {
1154
- return l.return && l.return();
1099
+ return i(), [4, Promise.all(e.map(function(c) {
1100
+ return c.return && c.return();
1155
1101
  }))];
1156
1102
  case 6:
1157
- return h.sent(), [
1103
+ return p.sent(), [
1158
1104
  7
1159
1105
  /*endfinally*/
1160
1106
  ];
@@ -1168,61 +1114,114 @@ function Ae(t) {
1168
1114
  });
1169
1115
  });
1170
1116
  }
1171
- class Be extends me {
1117
+ function Fe(t) {
1118
+ return typeof t == "string" ? t : t.url;
1119
+ }
1120
+ function Ie(t, n, e, r) {
1121
+ const i = e[n];
1122
+ if (!(!i || !i.length))
1123
+ try {
1124
+ r[n] = t(r[n], i, !0, !1).newDocument;
1125
+ } catch (o) {
1126
+ throw typeof o == "object" && o && "name" in o && typeof o.name == "string" && "message" in o && typeof o.message == "string" ? o.name === "TEST_OPERATION_FAILED" ? new Oe(o.message) : new Se(o.name + ": " + o.message) : o;
1127
+ }
1128
+ }
1129
+ function Ae(t, n) {
1130
+ try {
1131
+ return t.compile(n);
1132
+ } catch (e) {
1133
+ throw new je(
1134
+ e instanceof Error ? e.message : void 0
1135
+ );
1136
+ }
1137
+ }
1138
+ function Me(t, n, e) {
1139
+ t.actor !== (e == null ? void 0 : e.actor) && (t.allowed = t.allowed && e ? [e.actor] : void 0, t.channels = t.channels.filter(
1140
+ (r) => n.includes(r)
1141
+ ));
1142
+ }
1143
+ function Ne(t, n) {
1144
+ return t.allowed === void 0 || t.allowed === null || !!(n != null && n.actor) && (t.actor === n.actor || t.allowed.includes(n.actor));
1145
+ }
1146
+ class Ve extends xe {
1172
1147
  /**
1173
1148
  * Wraps a Graffiti API instance to provide the synchronize methods.
1174
1149
  * The GraffitiSyncrhonize class rather than the Graffiti class
1175
1150
  * must be used for all functions for the synchronize methods to work.
1176
1151
  */
1177
- constructor(e, n) {
1152
+ constructor(e, r) {
1178
1153
  super();
1179
- y(this, "ajv_");
1180
- y(this, "applyPatch_");
1181
- y(this, "graffiti");
1182
- y(this, "callbacks", /* @__PURE__ */ new Set());
1183
- y(this, "options");
1184
- y(this, "channelStats");
1185
- y(this, "login");
1186
- y(this, "logout");
1187
- y(this, "sessionEvents");
1188
- y(this, "get", async (...e) => {
1189
- const n = await this.graffiti.get(...e);
1190
- return this.synchronizeDispatch(n), n;
1154
+ v(this, "ajv_");
1155
+ v(this, "applyPatch_");
1156
+ v(this, "graffiti");
1157
+ v(this, "callbacks", /* @__PURE__ */ new Set());
1158
+ v(this, "options");
1159
+ v(this, "channelStats");
1160
+ v(this, "login");
1161
+ v(this, "logout");
1162
+ v(this, "sessionEvents");
1163
+ v(this, "get", async (...e) => {
1164
+ const r = await this.graffiti.get(...e);
1165
+ return this.synchronizeDispatch({ object: r }), r;
1191
1166
  });
1192
- y(this, "put", async (...e) => {
1193
- const n = await this.graffiti.put(...e), o = e[0], i = {
1194
- ...n,
1195
- value: o.value,
1196
- channels: o.channels,
1197
- allowed: o.allowed,
1198
- tombstone: !1
1167
+ v(this, "put", async (...e) => {
1168
+ const r = await this.graffiti.put(...e), i = e[0], o = {
1169
+ ...r,
1170
+ value: i.value,
1171
+ channels: i.channels,
1172
+ allowed: i.allowed
1199
1173
  };
1200
- return await this.synchronizeDispatch(n, i, !0), n;
1174
+ return await this.synchronizeDispatch(
1175
+ {
1176
+ tombstone: !0,
1177
+ object: r
1178
+ },
1179
+ {
1180
+ object: o
1181
+ },
1182
+ !0
1183
+ ), r;
1201
1184
  });
1202
- y(this, "patch", async (...e) => {
1203
- const n = await this.graffiti.patch(...e), o = { ...n };
1204
- o.tombstone = !1;
1205
- for (const i of ["value", "channels", "allowed"])
1206
- xe(await this.applyPatch, i, e[0], o);
1207
- return await this.synchronizeDispatch(n, o, !0), n;
1185
+ v(this, "patch", async (...e) => {
1186
+ const r = await this.graffiti.patch(...e), i = { ...r };
1187
+ for (const o of ["value", "channels", "allowed"])
1188
+ Ie(await this.applyPatch, o, e[0], i);
1189
+ return await this.synchronizeDispatch(
1190
+ {
1191
+ tombstone: !0,
1192
+ object: r
1193
+ },
1194
+ {
1195
+ object: i
1196
+ },
1197
+ !0
1198
+ ), r;
1208
1199
  });
1209
- y(this, "delete", async (...e) => {
1210
- const n = await this.graffiti.delete(...e);
1211
- return await this.synchronizeDispatch(n, void 0, !0), n;
1200
+ v(this, "delete", async (...e) => {
1201
+ const r = await this.graffiti.delete(...e);
1202
+ return await this.synchronizeDispatch(
1203
+ {
1204
+ tombstone: !0,
1205
+ object: r
1206
+ },
1207
+ void 0,
1208
+ !0
1209
+ ), r;
1212
1210
  });
1213
- y(this, "discover", (...e) => {
1214
- const n = this.graffiti.discover(...e);
1215
- return this.objectStream(n);
1211
+ v(this, "discover", (...e) => {
1212
+ const r = this.graffiti.discover(...e);
1213
+ return this.objectStream(r);
1216
1214
  });
1217
- y(this, "recoverOrphans", (...e) => {
1218
- const n = this.graffiti.recoverOrphans(...e);
1219
- return this.objectStream(n);
1215
+ v(this, "recoverOrphans", (...e) => {
1216
+ const r = this.graffiti.recoverOrphans(...e);
1217
+ return this.objectStream(r);
1220
1218
  });
1221
- this.options = n ?? {}, this.graffiti = e, this.channelStats = e.channelStats.bind(e), this.login = e.login.bind(e), this.logout = e.logout.bind(e), this.sessionEvents = e.sessionEvents;
1219
+ v(this, "continueObjectStream", (...e) => this.graffiti.continueObjectStream(...e));
1220
+ this.options = r ?? {}, this.graffiti = e, this.channelStats = e.channelStats.bind(e), this.login = e.login.bind(e), this.logout = e.logout.bind(e), this.sessionEvents = e.sessionEvents;
1222
1221
  }
1223
1222
  get ajv() {
1224
1223
  return this.ajv_ || (this.ajv_ = (async () => {
1225
- const { default: e } = await import("./ajv-C30pimY5.mjs").then((n) => n.a);
1224
+ const { default: e } = await import("./ajv-C30pimY5.mjs").then((r) => r.a);
1226
1225
  return new e({ strict: !1 });
1227
1226
  })()), this.ajv_;
1228
1227
  }
@@ -1232,20 +1231,23 @@ class Be extends me {
1232
1231
  return e;
1233
1232
  })()), this.applyPatch_;
1234
1233
  }
1235
- synchronize(e, n, o, i) {
1236
- return new z(
1237
- async (u, c) => {
1238
- const s = Oe(await this.ajv, o), f = (h, l) => {
1239
- for (const p of [l, h])
1240
- if (p && e(p) && (this.options.omniscient || Ee(p, i))) {
1241
- const d = { ...p };
1242
- if (this.options.omniscient || Ge(d, n, i), s(d)) {
1243
- u({ value: d });
1234
+ synchronize(e, r, i, o) {
1235
+ const u = /* @__PURE__ */ new Set();
1236
+ return new k(
1237
+ async (a, s) => {
1238
+ const f = Ae(await this.ajv, i), p = (c, d) => {
1239
+ for (const h of [d, c])
1240
+ if (h != null && h.tombstone)
1241
+ u.has(h.object.url) && a(h);
1242
+ else if (h && e(h.object) && (this.options.omniscient || Ne(h.object, o))) {
1243
+ const y = { ...h.object };
1244
+ if (this.options.omniscient || Me(y, r, o), f(y)) {
1245
+ a({ object: y }), u.add(y.url);
1244
1246
  break;
1245
1247
  }
1246
1248
  }
1247
1249
  };
1248
- this.callbacks.add(f), await c, this.callbacks.delete(f);
1250
+ this.callbacks.add(p), await s, this.callbacks.delete(p);
1249
1251
  }
1250
1252
  );
1251
1253
  }
@@ -1263,11 +1265,11 @@ class Be extends me {
1263
1265
  * @group Synchronize Methods
1264
1266
  */
1265
1267
  synchronizeDiscover(...e) {
1266
- const [n, o, i] = e;
1267
- function a(u) {
1268
- return u.channels.some((c) => n.includes(c));
1268
+ const [r, i, o] = e;
1269
+ function u(l) {
1270
+ return l.channels.some((a) => r.includes(a));
1269
1271
  }
1270
- return this.synchronize(a, n, o, i);
1272
+ return this.synchronize(u, r, i, o);
1271
1273
  }
1272
1274
  /**
1273
1275
  * This method has the same signature as {@link get} but
@@ -1276,16 +1278,17 @@ class Be extends me {
1276
1278
  * streams appropriate changes to provide a responsive and consistent user experience.
1277
1279
  *
1278
1280
  * Unlike {@link get}, which returns a single result, this method continuously
1279
- * listens for changes which are output as an asynchronous {@link GraffitiStream}.
1281
+ * listens for changes which are output as an asynchronous stream, similar
1282
+ * to {@link discover}.
1280
1283
  *
1281
1284
  * @group Synchronize Methods
1282
1285
  */
1283
1286
  synchronizeGet(...e) {
1284
- const [n, o, i] = e, a = Pe(n);
1285
- function u(c) {
1286
- return c.url === a;
1287
+ const [r, i, o] = e, u = Fe(r);
1288
+ function l(a) {
1289
+ return a.url === u;
1287
1290
  }
1288
- return this.synchronize(u, [], o, i);
1291
+ return this.synchronize(l, [], i, o);
1289
1292
  }
1290
1293
  /**
1291
1294
  * This method has the same signature as {@link recoverOrphans} but
@@ -1301,11 +1304,11 @@ class Be extends me {
1301
1304
  * @group Synchronize Methods
1302
1305
  */
1303
1306
  synchronizeRecoverOrphans(...e) {
1304
- const [n, o] = e;
1305
- function i(a) {
1306
- return a.actor === o.actor && a.channels.length === 0;
1307
+ const [r, i] = e;
1308
+ function o(u) {
1309
+ return u.actor === i.actor && u.channels.length === 0;
1307
1310
  }
1308
- return this.synchronize(i, [], n, o);
1311
+ return this.synchronize(o, [], r, i);
1309
1312
  }
1310
1313
  /**
1311
1314
  * Streams changes made to *any* object in *any* channel
@@ -1317,60 +1320,79 @@ class Be extends me {
1317
1320
  * Be careful using this method. Without additional filters it can
1318
1321
  * expose the user to content out of context.
1319
1322
  */
1320
- synchronizeAll(e, n) {
1321
- return this.synchronize(() => !0, [], e ?? {}, n);
1323
+ synchronizeAll(e, r) {
1324
+ return this.synchronize(() => !0, [], e, r);
1325
+ }
1326
+ async synchronizeDispatch(e, r, i = !1) {
1327
+ for (const o of this.callbacks)
1328
+ o(e, r);
1329
+ i && await new Promise((o) => setTimeout(o, 0));
1322
1330
  }
1323
- async synchronizeDispatch(e, n, o = !1) {
1324
- for (const i of this.callbacks)
1325
- i(e, n);
1326
- o && await new Promise((i) => setTimeout(i, 0));
1331
+ objectStreamContinue(e) {
1332
+ const r = this;
1333
+ return async function* () {
1334
+ for (; ; ) {
1335
+ const i = await e.next();
1336
+ if (i.done) {
1337
+ const { continue: o, cursor: u } = i.value;
1338
+ return {
1339
+ continue: () => r.objectStreamContinue(o()),
1340
+ cursor: u
1341
+ };
1342
+ }
1343
+ i.value.error || r.synchronizeDispatch(
1344
+ i.value
1345
+ ), yield i.value;
1346
+ }
1347
+ }();
1327
1348
  }
1328
1349
  objectStream(e) {
1329
- const n = this.synchronizeDispatch.bind(this);
1350
+ const r = this.objectStreamContinue(e);
1330
1351
  return async function* () {
1331
- let i = await e.next();
1332
- for (; !i.done; )
1333
- i.value.error || n(i.value.value), yield i.value, i = await e.next();
1334
- return i.value;
1352
+ for (; ; ) {
1353
+ const i = await r.next();
1354
+ if (i.done) return i.value;
1355
+ (i.value.error || !i.value.tombstone) && (yield i.value);
1356
+ }
1335
1357
  }();
1336
1358
  }
1337
1359
  }
1338
- const $e = {
1339
- install(t, r) {
1340
- const e = r.graffiti, n = new Be(e), o = A(void 0);
1341
- n.sessionEvents.addEventListener("initialized", async (i) => {
1342
- const a = i.detail;
1343
- if (a && a.error && console.error(a.error), a && a.href) {
1344
- const u = t.config.globalProperties.$router;
1345
- if (u) {
1346
- const c = u.options.history.base, s = new URL(a.href);
1347
- s.pathname.startsWith(c) && (s.pathname = s.pathname.slice(c.length)), await u.replace(s.pathname + s.search + s.hash);
1360
+ const Ue = {
1361
+ install(t, n) {
1362
+ const e = n.graffiti, r = new Ve(e), i = M(void 0);
1363
+ r.sessionEvents.addEventListener("initialized", async (o) => {
1364
+ const u = o.detail;
1365
+ if (u && u.error && console.error(u.error), u && u.href) {
1366
+ const l = t.config.globalProperties.$router;
1367
+ if (l) {
1368
+ const a = l.options.history.base, s = new URL(u.href);
1369
+ s.pathname.startsWith(a) && (s.pathname = s.pathname.slice(a.length)), await l.replace(s.pathname + s.search + s.hash);
1348
1370
  }
1349
1371
  }
1350
- o.value || (o.value = null);
1351
- }), n.sessionEvents.addEventListener("login", (i) => {
1352
- const a = i.detail;
1353
- if (a.error) {
1354
- console.error("Error logging in:"), console.error(a.error);
1372
+ i.value || (i.value = null);
1373
+ }), r.sessionEvents.addEventListener("login", (o) => {
1374
+ const u = o.detail;
1375
+ if (u.error) {
1376
+ console.error("Error logging in:"), console.error(u.error);
1355
1377
  return;
1356
1378
  } else
1357
- o.value = a.session;
1358
- }), n.sessionEvents.addEventListener("logout", (i) => {
1359
- const a = i.detail;
1360
- a.error ? (console.error("Error logging out:"), console.error(a.error)) : o.value = null;
1361
- }), t.provide(Y, n), t.provide(Z, o), t.component("GraffitiDiscover", ue), t.component("GraffitiGet", ce), t.component("GraffitiRecoverOrphans", le), t.config.globalProperties.$graffiti = n, t.config.globalProperties.$graffitiSession = o;
1379
+ i.value = u.session;
1380
+ }), r.sessionEvents.addEventListener("logout", (o) => {
1381
+ const u = o.detail;
1382
+ u.error ? (console.error("Error logging out:"), console.error(u.error)) : i.value = null;
1383
+ }), t.provide(Y, r), t.provide(Z, i), t.component("GraffitiDiscover", ie), t.component("GraffitiGet", se), t.component("GraffitiRecoverOrphans", ue), t.config.globalProperties.$graffiti = r, t.config.globalProperties.$graffitiSession = i;
1362
1384
  }
1363
- }, Ce = ue, We = ce, Ue = le;
1385
+ }, Le = ie, We = se, Je = ue;
1364
1386
  export {
1365
- Ce as GraffitiDiscover,
1387
+ Le as GraffitiDiscover,
1366
1388
  We as GraffitiGet,
1367
- $e as GraffitiPlugin,
1368
- Ue as GraffitiRecoverOrphans,
1369
- Le as useGraffiti,
1370
- je as useGraffitiDiscover,
1371
- ke as useGraffitiGet,
1372
- Re as useGraffitiRecoverOrphans,
1389
+ Ue as GraffitiPlugin,
1390
+ Je as GraffitiRecoverOrphans,
1391
+ $e as useGraffiti,
1392
+ be as useGraffitiDiscover,
1393
+ ge as useGraffitiGet,
1394
+ Pe as useGraffitiRecoverOrphans,
1373
1395
  ee as useGraffitiSession,
1374
- B as useGraffitiSynchronize
1396
+ N as useGraffitiSynchronize
1375
1397
  };
1376
1398
  //# sourceMappingURL=plugin.mjs.map