@graffiti-garden/wrapper-vue 0.7.2 → 1.0.3

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