@noxickon/onyx 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/chunks/Button-CLMaoxRW.js +11054 -0
  2. package/dist/chunks/Button-CZYAHivj.js +20 -0
  3. package/dist/chunks/Input-BQQT5eZ0.js +138 -0
  4. package/dist/chunks/Input-DJZcvJdP.js +1 -0
  5. package/dist/chunks/_commonjsHelpers-C6fGbg64.js +6 -0
  6. package/dist/chunks/_commonjsHelpers-DwGv2jUC.js +1 -0
  7. package/dist/chunks/constants-B1_n9ezb.js +1 -0
  8. package/dist/chunks/constants-CDXq37n6.js +4 -0
  9. package/dist/chunks/index-1-zQ3RaM.js +601 -0
  10. package/dist/chunks/index-BgUMV1hv.js +2129 -0
  11. package/dist/chunks/index-CjVXr8mh.js +2 -0
  12. package/dist/chunks/index-XTQUUzZ1.js +22 -0
  13. package/dist/chunks/isObject-BDHKUJKN.js +1 -0
  14. package/dist/chunks/isObject-vmP43YLW.js +6 -0
  15. package/dist/chunks/jsx-runtime-C5mzlN2N.js +284 -0
  16. package/dist/chunks/jsx-runtime-DUiatUiq.js +22 -0
  17. package/dist/chunks/useAuth-C-TIgBfr.js +61 -0
  18. package/dist/chunks/useAuth-CfKOZqhG.js +10 -0
  19. package/dist/chunks/useForm-BIKRbGHj.js +3085 -0
  20. package/dist/chunks/useForm-BZEaiRaa.js +26 -0
  21. package/dist/chunks/useQuery-B_ce5e8f.js +2 -0
  22. package/dist/chunks/useQuery-CJdYhuQu.js +1481 -0
  23. package/dist/context/context.cjs.js +1 -0
  24. package/dist/context/context.es.js +6 -0
  25. package/dist/context.d.ts +44 -0
  26. package/dist/hooks/hooks.cjs.js +6 -0
  27. package/dist/hooks/hooks.es.js +1917 -0
  28. package/dist/hooks.d.ts +130 -0
  29. package/dist/index.css +1 -1
  30. package/dist/index.d.ts +148 -110
  31. package/dist/layout/layout.cjs.js +1 -0
  32. package/dist/layout/layout.es.js +264 -0
  33. package/dist/layout.d.ts +89 -0
  34. package/dist/onyx.cjs.js +12 -0
  35. package/dist/onyx.es.js +2523 -9494
  36. package/dist/pages/pages.cjs.js +7 -0
  37. package/dist/pages/pages.es.js +93 -0
  38. package/dist/pages.d.ts +14 -0
  39. package/dist/shared.css +104 -0
  40. package/package.json +41 -16
  41. package/dist/onyx.umd.js +0 -42
@@ -0,0 +1,1481 @@
1
+ import { i as m, A as It, c as Tt, r as Qt, n as vt, a as K, b as Mt, d as C, e as _, f as xt, _ as y, g as N, h as Rt, j as H, R as Ct, k as P, l as jt, u as pt, m as Vt, o as At, v as Lt, D as zt } from "./index-1-zQ3RaM.js";
2
+ function Nt(e, r) {
3
+ var t = e.directives;
4
+ return !t || !t.length ? !0 : Ut(t).every(function(n) {
5
+ var i = n.directive, o = n.ifArgument, a = !1;
6
+ return o.value.kind === "Variable" ? (a = r && r[o.value.name.value], m(a !== void 0, 78, i.name.value)) : a = o.value.value, i.name.value === "skip" ? !a : a;
7
+ });
8
+ }
9
+ function Wt(e) {
10
+ var r = e.name.value;
11
+ return r === "skip" || r === "include";
12
+ }
13
+ function Ut(e) {
14
+ var r = [];
15
+ return e && e.length && e.forEach(function(t) {
16
+ if (Wt(t)) {
17
+ var n = t.arguments, i = t.name.value;
18
+ m(n && n.length === 1, 79, i);
19
+ var o = n[0];
20
+ m(o.name && o.name.value === "if", 80, i);
21
+ var a = o.value;
22
+ m(a && (a.kind === "Variable" || a.kind === "BooleanValue"), 81, i), r.push({ directive: t, ifArgument: o });
23
+ }
24
+ }), r;
25
+ }
26
+ function Bt(e) {
27
+ e === void 0 && (e = []);
28
+ var r = {};
29
+ return e.forEach(function(t) {
30
+ r[t.name.value] = t;
31
+ }), r;
32
+ }
33
+ function Gt(e, r) {
34
+ switch (e.kind) {
35
+ case "InlineFragment":
36
+ return e;
37
+ case "FragmentSpread": {
38
+ var t = e.name.value;
39
+ if (typeof r == "function")
40
+ return r(t);
41
+ var n = r && r[t];
42
+ return m(n, 87, t), n || null;
43
+ }
44
+ default:
45
+ return null;
46
+ }
47
+ }
48
+ var dt = Object.assign(function(r) {
49
+ return JSON.stringify(r, Ht);
50
+ }, {
51
+ reset: function() {
52
+ D = new It(
53
+ Tt.canonicalStringify || 1e3
54
+ /* defaultCacheSizes.canonicalStringify */
55
+ );
56
+ }
57
+ });
58
+ globalThis.__DEV__ !== !1 && Qt("canonicalStringify", function() {
59
+ return D.size;
60
+ });
61
+ var D;
62
+ dt.reset();
63
+ function Ht(e, r) {
64
+ if (r && typeof r == "object") {
65
+ var t = Object.getPrototypeOf(r);
66
+ if (t === Object.prototype || t === null) {
67
+ var n = Object.keys(r);
68
+ if (n.every(Jt))
69
+ return r;
70
+ var i = JSON.stringify(n), o = D.get(i);
71
+ if (!o) {
72
+ n.sort();
73
+ var a = JSON.stringify(n);
74
+ o = D.get(a) || n, D.set(i, o), D.set(a, o);
75
+ }
76
+ var u = Object.create(t);
77
+ return o.forEach(function(s) {
78
+ u[s] = r[s];
79
+ }), u;
80
+ }
81
+ }
82
+ return r;
83
+ }
84
+ function Jt(e, r, t) {
85
+ return r === 0 || t[r - 1] <= e;
86
+ }
87
+ var $t = [
88
+ "connection",
89
+ "include",
90
+ "skip",
91
+ "client",
92
+ "rest",
93
+ "export",
94
+ "nonreactive"
95
+ ], I = dt;
96
+ Object.assign(function(e, r, t) {
97
+ if (r && t && t.connection && t.connection.key)
98
+ if (t.connection.filter && t.connection.filter.length > 0) {
99
+ var n = t.connection.filter ? t.connection.filter : [];
100
+ n.sort();
101
+ var i = {};
102
+ return n.forEach(function(u) {
103
+ i[u] = r[u];
104
+ }), "".concat(t.connection.key, "(").concat(I(i), ")");
105
+ } else
106
+ return t.connection.key;
107
+ var o = e;
108
+ if (r) {
109
+ var a = I(r);
110
+ o += "(".concat(a, ")");
111
+ }
112
+ return t && Object.keys(t).forEach(function(u) {
113
+ $t.indexOf(u) === -1 && (t[u] && Object.keys(t[u]).length ? o += "@".concat(u, "(").concat(I(t[u]), ")") : o += "@".concat(u));
114
+ }), o;
115
+ }, {
116
+ setStringify: function(e) {
117
+ var r = I;
118
+ return I = e, r;
119
+ }
120
+ });
121
+ function Xt(e) {
122
+ return e.alias ? e.alias.value : e.name.value;
123
+ }
124
+ function Yt(e) {
125
+ return e.kind === "Field";
126
+ }
127
+ function bt(e) {
128
+ m(e && e.kind === "Document", 88);
129
+ var r = e.definitions.filter(function(t) {
130
+ return t.kind !== "FragmentDefinition";
131
+ }).map(function(t) {
132
+ if (t.kind !== "OperationDefinition")
133
+ throw vt(89, t.kind);
134
+ return t;
135
+ });
136
+ return m(r.length <= 1, 90, r.length), e;
137
+ }
138
+ function gt(e) {
139
+ return bt(e), e.definitions.filter(function(r) {
140
+ return r.kind === "OperationDefinition";
141
+ })[0];
142
+ }
143
+ function Zt(e) {
144
+ return e.definitions.filter(function(r) {
145
+ return r.kind === "FragmentDefinition";
146
+ });
147
+ }
148
+ function Kt(e) {
149
+ var r = gt(e);
150
+ return m(r && r.operation === "query", 91), r;
151
+ }
152
+ function te(e) {
153
+ bt(e);
154
+ for (var r, t = 0, n = e.definitions; t < n.length; t++) {
155
+ var i = n[t];
156
+ if (i.kind === "OperationDefinition") {
157
+ var o = i.operation;
158
+ if (o === "query" || o === "mutation" || o === "subscription")
159
+ return i;
160
+ }
161
+ i.kind === "FragmentDefinition" && !r && (r = i);
162
+ }
163
+ if (r)
164
+ return r;
165
+ throw vt(95);
166
+ }
167
+ let g = null;
168
+ const tt = {};
169
+ let ee = 1;
170
+ const re = () => class {
171
+ constructor() {
172
+ this.id = [
173
+ "slot",
174
+ ee++,
175
+ Date.now(),
176
+ Math.random().toString(36).slice(2)
177
+ ].join(":");
178
+ }
179
+ hasValue() {
180
+ for (let r = g; r; r = r.parent)
181
+ if (this.id in r.slots) {
182
+ const t = r.slots[this.id];
183
+ if (t === tt)
184
+ break;
185
+ return r !== g && (g.slots[this.id] = t), !0;
186
+ }
187
+ return g && (g.slots[this.id] = tt), !1;
188
+ }
189
+ getValue() {
190
+ if (this.hasValue())
191
+ return g.slots[this.id];
192
+ }
193
+ withValue(r, t, n, i) {
194
+ const o = {
195
+ __proto__: null,
196
+ [this.id]: r
197
+ }, a = g;
198
+ g = { parent: a, slots: o };
199
+ try {
200
+ return t.apply(i, n);
201
+ } finally {
202
+ g = a;
203
+ }
204
+ }
205
+ // Capture the current context and wrap a callback function so that it
206
+ // reestablishes the captured context when called.
207
+ static bind(r) {
208
+ const t = g;
209
+ return function() {
210
+ const n = g;
211
+ try {
212
+ return g = t, r.apply(this, arguments);
213
+ } finally {
214
+ g = n;
215
+ }
216
+ };
217
+ }
218
+ // Immediately run a callback function without any captured context.
219
+ static noContext(r, t, n) {
220
+ if (g) {
221
+ const i = g;
222
+ try {
223
+ return g = null, r.apply(n, t);
224
+ } finally {
225
+ g = i;
226
+ }
227
+ } else
228
+ return r.apply(n, t);
229
+ }
230
+ };
231
+ function et(e) {
232
+ try {
233
+ return e();
234
+ } catch {
235
+ }
236
+ }
237
+ const V = "@wry/context:Slot", ne = (
238
+ // Prefer globalThis when available.
239
+ // https://github.com/benjamn/wryware/issues/347
240
+ et(() => globalThis) || // Fall back to global, which works in Node.js and may be converted by some
241
+ // bundlers to the appropriate identifier (window, self, ...) depending on the
242
+ // bundling target. https://github.com/endojs/endo/issues/576#issuecomment-1178515224
243
+ et(() => global) || // Otherwise, use a dummy host that's local to this module. We used to fall
244
+ // back to using the Array constructor as a namespace, but that was flagged in
245
+ // https://github.com/benjamn/wryware/issues/347, and can be avoided.
246
+ /* @__PURE__ */ Object.create(null)
247
+ ), rt = ne, J = rt[V] || // Earlier versions of this package stored the globalKey property on the Array
248
+ // constructor, so we check there as well, to prevent Slot class duplication.
249
+ Array[V] || function(e) {
250
+ try {
251
+ Object.defineProperty(rt, V, {
252
+ value: e,
253
+ enumerable: !1,
254
+ writable: !1,
255
+ // When it was possible for globalHost to be the Array constructor (a
256
+ // legacy Slot dedup strategy), it was important for the property to be
257
+ // configurable:true so it could be deleted. That does not seem to be as
258
+ // important when globalHost is the global object, but I don't want to
259
+ // cause similar problems again, and configurable:true seems safest.
260
+ // https://github.com/endojs/endo/issues/576#issuecomment-1178274008
261
+ configurable: !0
262
+ });
263
+ } finally {
264
+ return e;
265
+ }
266
+ }(re()), { bind: We, noContext: Ue } = J;
267
+ new J();
268
+ function mt(e) {
269
+ return Array.isArray(e) && e.length > 0;
270
+ }
271
+ function ie(e, r) {
272
+ var t = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
273
+ if (t) return (t = t.call(e)).next.bind(t);
274
+ if (Array.isArray(e) || (t = oe(e)) || r) {
275
+ t && (e = t);
276
+ var n = 0;
277
+ return function() {
278
+ return n >= e.length ? { done: !0 } : { done: !1, value: e[n++] };
279
+ };
280
+ }
281
+ throw new TypeError(`Invalid attempt to iterate non-iterable instance.
282
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
283
+ }
284
+ function oe(e, r) {
285
+ if (e) {
286
+ if (typeof e == "string") return nt(e, r);
287
+ var t = Object.prototype.toString.call(e).slice(8, -1);
288
+ if (t === "Object" && e.constructor && (t = e.constructor.name), t === "Map" || t === "Set") return Array.from(e);
289
+ if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return nt(e, r);
290
+ }
291
+ }
292
+ function nt(e, r) {
293
+ (r == null || r > e.length) && (r = e.length);
294
+ for (var t = 0, n = new Array(r); t < r; t++)
295
+ n[t] = e[t];
296
+ return n;
297
+ }
298
+ function it(e, r) {
299
+ for (var t = 0; t < r.length; t++) {
300
+ var n = r[t];
301
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
302
+ }
303
+ }
304
+ function $(e, r, t) {
305
+ return r && it(e.prototype, r), t && it(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
306
+ }
307
+ var X = function() {
308
+ return typeof Symbol == "function";
309
+ }, Y = function(e) {
310
+ return X() && !!Symbol[e];
311
+ }, Z = function(e) {
312
+ return Y(e) ? Symbol[e] : "@@" + e;
313
+ };
314
+ X() && !Y("observable") && (Symbol.observable = Symbol("observable"));
315
+ var ae = Z("iterator"), W = Z("observable"), wt = Z("species");
316
+ function j(e, r) {
317
+ var t = e[r];
318
+ if (t != null) {
319
+ if (typeof t != "function") throw new TypeError(t + " is not a function");
320
+ return t;
321
+ }
322
+ }
323
+ function T(e) {
324
+ var r = e.constructor;
325
+ return r !== void 0 && (r = r[wt], r === null && (r = void 0)), r !== void 0 ? r : k;
326
+ }
327
+ function ue(e) {
328
+ return e instanceof k;
329
+ }
330
+ function F(e) {
331
+ F.log ? F.log(e) : setTimeout(function() {
332
+ throw e;
333
+ });
334
+ }
335
+ function M(e) {
336
+ Promise.resolve().then(function() {
337
+ try {
338
+ e();
339
+ } catch (r) {
340
+ F(r);
341
+ }
342
+ });
343
+ }
344
+ function _t(e) {
345
+ var r = e._cleanup;
346
+ if (r !== void 0 && (e._cleanup = void 0, !!r))
347
+ try {
348
+ if (typeof r == "function")
349
+ r();
350
+ else {
351
+ var t = j(r, "unsubscribe");
352
+ t && t.call(r);
353
+ }
354
+ } catch (n) {
355
+ F(n);
356
+ }
357
+ }
358
+ function U(e) {
359
+ e._observer = void 0, e._queue = void 0, e._state = "closed";
360
+ }
361
+ function se(e) {
362
+ var r = e._queue;
363
+ if (r) {
364
+ e._queue = void 0, e._state = "ready";
365
+ for (var t = 0; t < r.length && (St(e, r[t].type, r[t].value), e._state !== "closed"); ++t)
366
+ ;
367
+ }
368
+ }
369
+ function St(e, r, t) {
370
+ e._state = "running";
371
+ var n = e._observer;
372
+ try {
373
+ var i = j(n, r);
374
+ switch (r) {
375
+ case "next":
376
+ i && i.call(n, t);
377
+ break;
378
+ case "error":
379
+ if (U(e), i) i.call(n, t);
380
+ else throw t;
381
+ break;
382
+ case "complete":
383
+ U(e), i && i.call(n);
384
+ break;
385
+ }
386
+ } catch (o) {
387
+ F(o);
388
+ }
389
+ e._state === "closed" ? _t(e) : e._state === "running" && (e._state = "ready");
390
+ }
391
+ function A(e, r, t) {
392
+ if (e._state !== "closed") {
393
+ if (e._state === "buffering") {
394
+ e._queue.push({
395
+ type: r,
396
+ value: t
397
+ });
398
+ return;
399
+ }
400
+ if (e._state !== "ready") {
401
+ e._state = "buffering", e._queue = [{
402
+ type: r,
403
+ value: t
404
+ }], M(function() {
405
+ return se(e);
406
+ });
407
+ return;
408
+ }
409
+ St(e, r, t);
410
+ }
411
+ }
412
+ var ce = /* @__PURE__ */ function() {
413
+ function e(t, n) {
414
+ this._cleanup = void 0, this._observer = t, this._queue = void 0, this._state = "initializing";
415
+ var i = new fe(this);
416
+ try {
417
+ this._cleanup = n.call(void 0, i);
418
+ } catch (o) {
419
+ i.error(o);
420
+ }
421
+ this._state === "initializing" && (this._state = "ready");
422
+ }
423
+ var r = e.prototype;
424
+ return r.unsubscribe = function() {
425
+ this._state !== "closed" && (U(this), _t(this));
426
+ }, $(e, [{
427
+ key: "closed",
428
+ get: function() {
429
+ return this._state === "closed";
430
+ }
431
+ }]), e;
432
+ }(), fe = /* @__PURE__ */ function() {
433
+ function e(t) {
434
+ this._subscription = t;
435
+ }
436
+ var r = e.prototype;
437
+ return r.next = function(n) {
438
+ A(this._subscription, "next", n);
439
+ }, r.error = function(n) {
440
+ A(this._subscription, "error", n);
441
+ }, r.complete = function() {
442
+ A(this._subscription, "complete");
443
+ }, $(e, [{
444
+ key: "closed",
445
+ get: function() {
446
+ return this._subscription._state === "closed";
447
+ }
448
+ }]), e;
449
+ }(), k = /* @__PURE__ */ function() {
450
+ function e(t) {
451
+ if (!(this instanceof e)) throw new TypeError("Observable cannot be called as a function");
452
+ if (typeof t != "function") throw new TypeError("Observable initializer must be a function");
453
+ this._subscriber = t;
454
+ }
455
+ var r = e.prototype;
456
+ return r.subscribe = function(n) {
457
+ return (typeof n != "object" || n === null) && (n = {
458
+ next: n,
459
+ error: arguments[1],
460
+ complete: arguments[2]
461
+ }), new ce(n, this._subscriber);
462
+ }, r.forEach = function(n) {
463
+ var i = this;
464
+ return new Promise(function(o, a) {
465
+ if (typeof n != "function") {
466
+ a(new TypeError(n + " is not a function"));
467
+ return;
468
+ }
469
+ function u() {
470
+ s.unsubscribe(), o();
471
+ }
472
+ var s = i.subscribe({
473
+ next: function(c) {
474
+ try {
475
+ n(c, u);
476
+ } catch (f) {
477
+ a(f), s.unsubscribe();
478
+ }
479
+ },
480
+ error: a,
481
+ complete: o
482
+ });
483
+ });
484
+ }, r.map = function(n) {
485
+ var i = this;
486
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
487
+ var o = T(this);
488
+ return new o(function(a) {
489
+ return i.subscribe({
490
+ next: function(u) {
491
+ try {
492
+ u = n(u);
493
+ } catch (s) {
494
+ return a.error(s);
495
+ }
496
+ a.next(u);
497
+ },
498
+ error: function(u) {
499
+ a.error(u);
500
+ },
501
+ complete: function() {
502
+ a.complete();
503
+ }
504
+ });
505
+ });
506
+ }, r.filter = function(n) {
507
+ var i = this;
508
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
509
+ var o = T(this);
510
+ return new o(function(a) {
511
+ return i.subscribe({
512
+ next: function(u) {
513
+ try {
514
+ if (!n(u)) return;
515
+ } catch (s) {
516
+ return a.error(s);
517
+ }
518
+ a.next(u);
519
+ },
520
+ error: function(u) {
521
+ a.error(u);
522
+ },
523
+ complete: function() {
524
+ a.complete();
525
+ }
526
+ });
527
+ });
528
+ }, r.reduce = function(n) {
529
+ var i = this;
530
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
531
+ var o = T(this), a = arguments.length > 1, u = !1, s = arguments[1], c = s;
532
+ return new o(function(f) {
533
+ return i.subscribe({
534
+ next: function(l) {
535
+ var h = !u;
536
+ if (u = !0, !h || a)
537
+ try {
538
+ c = n(c, l);
539
+ } catch (v) {
540
+ return f.error(v);
541
+ }
542
+ else
543
+ c = l;
544
+ },
545
+ error: function(l) {
546
+ f.error(l);
547
+ },
548
+ complete: function() {
549
+ if (!u && !a) return f.error(new TypeError("Cannot reduce an empty sequence"));
550
+ f.next(c), f.complete();
551
+ }
552
+ });
553
+ });
554
+ }, r.concat = function() {
555
+ for (var n = this, i = arguments.length, o = new Array(i), a = 0; a < i; a++)
556
+ o[a] = arguments[a];
557
+ var u = T(this);
558
+ return new u(function(s) {
559
+ var c, f = 0;
560
+ function l(h) {
561
+ c = h.subscribe({
562
+ next: function(v) {
563
+ s.next(v);
564
+ },
565
+ error: function(v) {
566
+ s.error(v);
567
+ },
568
+ complete: function() {
569
+ f === o.length ? (c = void 0, s.complete()) : l(u.from(o[f++]));
570
+ }
571
+ });
572
+ }
573
+ return l(n), function() {
574
+ c && (c.unsubscribe(), c = void 0);
575
+ };
576
+ });
577
+ }, r.flatMap = function(n) {
578
+ var i = this;
579
+ if (typeof n != "function") throw new TypeError(n + " is not a function");
580
+ var o = T(this);
581
+ return new o(function(a) {
582
+ var u = [], s = i.subscribe({
583
+ next: function(f) {
584
+ if (n)
585
+ try {
586
+ f = n(f);
587
+ } catch (h) {
588
+ return a.error(h);
589
+ }
590
+ var l = o.from(f).subscribe({
591
+ next: function(h) {
592
+ a.next(h);
593
+ },
594
+ error: function(h) {
595
+ a.error(h);
596
+ },
597
+ complete: function() {
598
+ var h = u.indexOf(l);
599
+ h >= 0 && u.splice(h, 1), c();
600
+ }
601
+ });
602
+ u.push(l);
603
+ },
604
+ error: function(f) {
605
+ a.error(f);
606
+ },
607
+ complete: function() {
608
+ c();
609
+ }
610
+ });
611
+ function c() {
612
+ s.closed && u.length === 0 && a.complete();
613
+ }
614
+ return function() {
615
+ u.forEach(function(f) {
616
+ return f.unsubscribe();
617
+ }), s.unsubscribe();
618
+ };
619
+ });
620
+ }, r[W] = function() {
621
+ return this;
622
+ }, e.from = function(n) {
623
+ var i = typeof this == "function" ? this : e;
624
+ if (n == null) throw new TypeError(n + " is not an object");
625
+ var o = j(n, W);
626
+ if (o) {
627
+ var a = o.call(n);
628
+ if (Object(a) !== a) throw new TypeError(a + " is not an object");
629
+ return ue(a) && a.constructor === i ? a : new i(function(u) {
630
+ return a.subscribe(u);
631
+ });
632
+ }
633
+ if (Y("iterator") && (o = j(n, ae), o))
634
+ return new i(function(u) {
635
+ M(function() {
636
+ if (!u.closed) {
637
+ for (var s = ie(o.call(n)), c; !(c = s()).done; ) {
638
+ var f = c.value;
639
+ if (u.next(f), u.closed) return;
640
+ }
641
+ u.complete();
642
+ }
643
+ });
644
+ });
645
+ if (Array.isArray(n))
646
+ return new i(function(u) {
647
+ M(function() {
648
+ if (!u.closed) {
649
+ for (var s = 0; s < n.length; ++s)
650
+ if (u.next(n[s]), u.closed) return;
651
+ u.complete();
652
+ }
653
+ });
654
+ });
655
+ throw new TypeError(n + " is not observable");
656
+ }, e.of = function() {
657
+ for (var n = arguments.length, i = new Array(n), o = 0; o < n; o++)
658
+ i[o] = arguments[o];
659
+ var a = typeof this == "function" ? this : e;
660
+ return new a(function(u) {
661
+ M(function() {
662
+ if (!u.closed) {
663
+ for (var s = 0; s < i.length; ++s)
664
+ if (u.next(i[s]), u.closed) return;
665
+ u.complete();
666
+ }
667
+ });
668
+ });
669
+ }, $(e, null, [{
670
+ key: wt,
671
+ get: function() {
672
+ return this;
673
+ }
674
+ }]), e;
675
+ }();
676
+ X() && Object.defineProperty(k, Symbol("extensions"), {
677
+ value: {
678
+ symbol: W,
679
+ hostReportError: F
680
+ },
681
+ configurable: !0
682
+ });
683
+ function le(e) {
684
+ var r, t = e.Symbol;
685
+ if (typeof t == "function")
686
+ if (t.observable)
687
+ r = t.observable;
688
+ else {
689
+ typeof t.for == "function" ? r = t.for("https://github.com/benlesh/symbol-observable") : r = t("https://github.com/benlesh/symbol-observable");
690
+ try {
691
+ t.observable = r;
692
+ } catch {
693
+ }
694
+ }
695
+ else
696
+ r = "@@observable";
697
+ return r;
698
+ }
699
+ var E;
700
+ typeof self < "u" ? E = self : typeof window < "u" ? E = window : typeof global < "u" ? E = global : typeof module < "u" ? E = module : E = Function("return this")();
701
+ le(E);
702
+ var ot = k.prototype, at = "@@observable";
703
+ ot[at] || (ot[at] = function() {
704
+ return this;
705
+ });
706
+ function he(e) {
707
+ return e.catch(function() {
708
+ }), e;
709
+ }
710
+ var ye = Object.prototype.toString;
711
+ function ve(e) {
712
+ return B(e);
713
+ }
714
+ function B(e, r) {
715
+ switch (ye.call(e)) {
716
+ case "[object Array]": {
717
+ if (r = r || /* @__PURE__ */ new Map(), r.has(e))
718
+ return r.get(e);
719
+ var t = e.slice(0);
720
+ return r.set(e, t), t.forEach(function(i, o) {
721
+ t[o] = B(i, r);
722
+ }), t;
723
+ }
724
+ case "[object Object]": {
725
+ if (r = r || /* @__PURE__ */ new Map(), r.has(e))
726
+ return r.get(e);
727
+ var n = Object.create(Object.getPrototypeOf(e));
728
+ return r.set(e, n), Object.keys(e).forEach(function(i) {
729
+ n[i] = B(e[i], r);
730
+ }), n;
731
+ }
732
+ default:
733
+ return e;
734
+ }
735
+ }
736
+ function pe(e) {
737
+ var r = /* @__PURE__ */ new Set([e]);
738
+ return r.forEach(function(t) {
739
+ K(t) && de(t) === t && Object.getOwnPropertyNames(t).forEach(function(n) {
740
+ K(t[n]) && r.add(t[n]);
741
+ });
742
+ }), e;
743
+ }
744
+ function de(e) {
745
+ if (globalThis.__DEV__ !== !1 && !Object.isFrozen(e))
746
+ try {
747
+ Object.freeze(e);
748
+ } catch (r) {
749
+ if (r instanceof TypeError)
750
+ return null;
751
+ throw r;
752
+ }
753
+ return e;
754
+ }
755
+ function Ot(e) {
756
+ return globalThis.__DEV__ !== !1 && pe(e), e;
757
+ }
758
+ function ut(e, r, t) {
759
+ var n = [];
760
+ e.forEach(function(i) {
761
+ return i[r] && n.push(i);
762
+ }), n.forEach(function(i) {
763
+ return i[r](t);
764
+ });
765
+ }
766
+ function be(e) {
767
+ function r(t) {
768
+ Object.defineProperty(e, t, { value: k });
769
+ }
770
+ return Mt && Symbol.species && r(Symbol.species), r("@@species"), e;
771
+ }
772
+ function ge(e, r, t, n) {
773
+ var i = r.data, o = C(r, ["data"]), a = t.data, u = C(t, ["data"]);
774
+ return _(o, u) && x(te(e).selectionSet, i, a, {
775
+ fragmentMap: Bt(Zt(e)),
776
+ variables: n
777
+ });
778
+ }
779
+ function x(e, r, t, n) {
780
+ if (r === t)
781
+ return !0;
782
+ var i = /* @__PURE__ */ new Set();
783
+ return e.selections.every(function(o) {
784
+ if (i.has(o) || (i.add(o), !Nt(o, n.variables)) || st(o))
785
+ return !0;
786
+ if (Yt(o)) {
787
+ var a = Xt(o), u = r && r[a], s = t && t[a], c = o.selectionSet;
788
+ if (!c)
789
+ return _(u, s);
790
+ var f = Array.isArray(u), l = Array.isArray(s);
791
+ if (f !== l)
792
+ return !1;
793
+ if (f && l) {
794
+ var h = u.length;
795
+ if (s.length !== h)
796
+ return !1;
797
+ for (var v = 0; v < h; ++v)
798
+ if (!x(c, u[v], s[v], n))
799
+ return !1;
800
+ return !0;
801
+ }
802
+ return x(c, u, s, n);
803
+ } else {
804
+ var p = Gt(o, n.fragmentMap);
805
+ if (p)
806
+ return st(p) ? !0 : x(
807
+ p.selectionSet,
808
+ // Notice that we reuse the same aResult and bResult values here,
809
+ // since the fragment ...spread does not specify a field name, but
810
+ // consists of multiple fields (within the fragment's selection set)
811
+ // that should be applied to the current result value(s).
812
+ r,
813
+ t,
814
+ n
815
+ );
816
+ }
817
+ });
818
+ }
819
+ function st(e) {
820
+ return !!e.directives && e.directives.some(me);
821
+ }
822
+ function me(e) {
823
+ return e.name.value === "nonreactive";
824
+ }
825
+ var b;
826
+ (function(e) {
827
+ e[e.loading = 1] = "loading", e[e.setVariables = 2] = "setVariables", e[e.fetchMore = 3] = "fetchMore", e[e.refetch = 4] = "refetch", e[e.poll = 6] = "poll", e[e.ready = 7] = "ready", e[e.error = 8] = "error";
828
+ })(b || (b = {}));
829
+ function Q(e) {
830
+ return e ? e < 7 : !1;
831
+ }
832
+ var ct = Object.assign, we = Object.hasOwnProperty, Pt = (
833
+ /** @class */
834
+ function(e) {
835
+ xt(r, e);
836
+ function r(t) {
837
+ var n = t.queryManager, i = t.queryInfo, o = t.options, a = this, u = r.inactiveOnCreation.getValue();
838
+ a = e.call(this, function(d) {
839
+ u && (n.queries.set(a.queryId, i), u = !1);
840
+ try {
841
+ var w = d._subscription._observer;
842
+ w && !w.error && (w.error = _e);
843
+ } catch {
844
+ }
845
+ var kt = !a.observers.size;
846
+ a.observers.add(d);
847
+ var q = a.last;
848
+ return q && q.error ? d.error && d.error(q.error) : q && q.result && d.next && d.next(a.maskResult(q.result)), kt && a.reobserve().catch(function() {
849
+ }), function() {
850
+ a.observers.delete(d) && !a.observers.size && a.tearDownQuery();
851
+ };
852
+ }) || this, a.observers = /* @__PURE__ */ new Set(), a.subscriptions = /* @__PURE__ */ new Set(), a.dirty = !1, a.queryInfo = i, a.queryManager = n, a.waitForOwnResult = L(o.fetchPolicy), a.isTornDown = !1, a.subscribeToMore = a.subscribeToMore.bind(a), a.maskResult = a.maskResult.bind(a);
853
+ var s = n.defaultOptions.watchQuery, c = s === void 0 ? {} : s, f = c.fetchPolicy, l = f === void 0 ? "cache-first" : f, h = o.fetchPolicy, v = h === void 0 ? l : h, p = o.initialFetchPolicy, O = p === void 0 ? v === "standby" ? l : v : p;
854
+ a.options = y(y({}, o), {
855
+ // Remember the initial options.fetchPolicy so we can revert back to this
856
+ // policy when variables change. This information can also be specified
857
+ // (or overridden) by providing options.initialFetchPolicy explicitly.
858
+ initialFetchPolicy: O,
859
+ // This ensures this.options.fetchPolicy always has a string value, in
860
+ // case options.fetchPolicy was not provided.
861
+ fetchPolicy: v
862
+ }), a.queryId = i.queryId || n.generateQueryId();
863
+ var S = gt(a.query);
864
+ return a.queryName = S && S.name && S.name.value, a;
865
+ }
866
+ return Object.defineProperty(r.prototype, "query", {
867
+ // The `query` computed property will always reflect the document transformed
868
+ // by the last run query. `this.options.query` will always reflect the raw
869
+ // untransformed query to ensure document transforms with runtime conditionals
870
+ // are run on the original document.
871
+ get: function() {
872
+ return this.lastQuery || this.options.query;
873
+ },
874
+ enumerable: !1,
875
+ configurable: !0
876
+ }), Object.defineProperty(r.prototype, "variables", {
877
+ // Computed shorthand for this.options.variables, preserved for
878
+ // backwards compatibility.
879
+ /**
880
+ * An object containing the variables that were provided for the query.
881
+ */
882
+ get: function() {
883
+ return this.options.variables;
884
+ },
885
+ enumerable: !1,
886
+ configurable: !0
887
+ }), r.prototype.result = function() {
888
+ var t = this;
889
+ return new Promise(function(n, i) {
890
+ var o = {
891
+ next: function(u) {
892
+ n(u), t.observers.delete(o), t.observers.size || t.queryManager.removeQuery(t.queryId), setTimeout(function() {
893
+ a.unsubscribe();
894
+ }, 0);
895
+ },
896
+ error: i
897
+ }, a = t.subscribe(o);
898
+ });
899
+ }, r.prototype.resetDiff = function() {
900
+ this.queryInfo.resetDiff();
901
+ }, r.prototype.getCurrentFullResult = function(t) {
902
+ t === void 0 && (t = !0);
903
+ var n = this.getLastResult(!0), i = this.queryInfo.networkStatus || n && n.networkStatus || b.ready, o = y(y({}, n), { loading: Q(i), networkStatus: i }), a = this.options.fetchPolicy, u = a === void 0 ? "cache-first" : a;
904
+ if (
905
+ // These fetch policies should never deliver data from the cache, unless
906
+ // redelivering a previously delivered result.
907
+ !(L(u) || // If this.options.query has @client(always: true) fields, we cannot
908
+ // trust diff.result, since it was read from the cache without running
909
+ // local resolvers (and it's too late to run resolvers now, since we must
910
+ // return a result synchronously).
911
+ this.queryManager.getDocumentInfo(this.query).hasForcedResolvers)
912
+ ) if (this.waitForOwnResult)
913
+ this.queryInfo.updateWatch();
914
+ else {
915
+ var s = this.queryInfo.getDiff();
916
+ (s.complete || this.options.returnPartialData) && (o.data = s.result), _(o.data, {}) && (o.data = void 0), s.complete ? (delete o.partial, s.complete && o.networkStatus === b.loading && (u === "cache-first" || u === "cache-only") && (o.networkStatus = b.ready, o.loading = !1)) : o.partial = !0, o.networkStatus === b.ready && (o.error || o.errors) && (o.networkStatus = b.error), globalThis.__DEV__ !== !1 && !s.complete && !this.options.partialRefetch && !o.loading && !o.data && !o.error && Se(s.missing);
917
+ }
918
+ return t && this.updateLastResult(o), o;
919
+ }, r.prototype.getCurrentResult = function(t) {
920
+ return t === void 0 && (t = !0), this.maskResult(this.getCurrentFullResult(t));
921
+ }, r.prototype.isDifferentFromLastResult = function(t, n) {
922
+ if (!this.last)
923
+ return !0;
924
+ var i = this.queryManager.getDocumentInfo(this.query), o = this.queryManager.dataMasking, a = o ? i.nonReactiveQuery : this.query, u = o || i.hasNonreactiveDirective ? !ge(a, this.last.result, t, this.variables) : !_(this.last.result, t);
925
+ return u || n && !_(this.last.variables, n);
926
+ }, r.prototype.getLast = function(t, n) {
927
+ var i = this.last;
928
+ if (i && i[t] && (!n || _(i.variables, this.variables)))
929
+ return i[t];
930
+ }, r.prototype.getLastResult = function(t) {
931
+ return this.getLast("result", t);
932
+ }, r.prototype.getLastError = function(t) {
933
+ return this.getLast("error", t);
934
+ }, r.prototype.resetLastResults = function() {
935
+ delete this.last, this.isTornDown = !1;
936
+ }, r.prototype.resetQueryStoreErrors = function() {
937
+ this.queryManager.resetErrors(this.queryId);
938
+ }, r.prototype.refetch = function(t) {
939
+ var n, i = {
940
+ // Always disable polling for refetches.
941
+ pollInterval: 0
942
+ }, o = this.options.fetchPolicy;
943
+ if (o === "no-cache" ? i.fetchPolicy = "no-cache" : i.fetchPolicy = "network-only", globalThis.__DEV__ !== !1 && t && we.call(t, "variables")) {
944
+ var a = Kt(this.query), u = a.variableDefinitions;
945
+ (!u || !u.some(function(s) {
946
+ return s.variable.name.value === "variables";
947
+ })) && globalThis.__DEV__ !== !1 && m.warn(
948
+ 21,
949
+ t,
950
+ ((n = a.name) === null || n === void 0 ? void 0 : n.value) || a
951
+ );
952
+ }
953
+ return t && !_(this.options.variables, t) && (i.variables = this.options.variables = y(y({}, this.options.variables), t)), this.queryInfo.resetLastWrite(), this.reobserve(i, b.refetch);
954
+ }, r.prototype.fetchMore = function(t) {
955
+ var n = this, i = y(y({}, t.query ? t : y(y(y(y({}, this.options), { query: this.options.query }), t), { variables: y(y({}, this.options.variables), t.variables) })), {
956
+ // The fetchMore request goes immediately to the network and does
957
+ // not automatically write its result to the cache (hence no-cache
958
+ // instead of network-only), because we allow the caller of
959
+ // fetchMore to provide an updateQuery callback that determines how
960
+ // the data gets written to the cache.
961
+ fetchPolicy: "no-cache"
962
+ });
963
+ i.query = this.transformDocument(i.query);
964
+ var o = this.queryManager.generateQueryId();
965
+ this.lastQuery = t.query ? this.transformDocument(this.options.query) : i.query;
966
+ var a = this.queryInfo, u = a.networkStatus;
967
+ a.networkStatus = b.fetchMore, i.notifyOnNetworkStatusChange && this.observe();
968
+ var s = /* @__PURE__ */ new Set(), c = t == null ? void 0 : t.updateQuery, f = this.options.fetchPolicy !== "no-cache";
969
+ return f || m(c, 22), this.queryManager.fetchQuery(o, i, b.fetchMore).then(function(l) {
970
+ if (n.queryManager.removeQuery(o), a.networkStatus === b.fetchMore && (a.networkStatus = u), f)
971
+ n.queryManager.cache.batch({
972
+ update: function(p) {
973
+ var O = t.updateQuery;
974
+ O ? p.updateQuery({
975
+ query: n.query,
976
+ variables: n.variables,
977
+ returnPartialData: !0,
978
+ optimistic: !1
979
+ }, function(S) {
980
+ return O(S, {
981
+ fetchMoreResult: l.data,
982
+ variables: i.variables
983
+ });
984
+ }) : p.writeQuery({
985
+ query: i.query,
986
+ variables: i.variables,
987
+ data: l.data
988
+ });
989
+ },
990
+ onWatchUpdated: function(p) {
991
+ s.add(p.query);
992
+ }
993
+ });
994
+ else {
995
+ var h = n.getLast("result"), v = c(h.data, {
996
+ fetchMoreResult: l.data,
997
+ variables: i.variables
998
+ });
999
+ n.reportResult(y(y({}, h), { networkStatus: u, loading: Q(u), data: v }), n.variables);
1000
+ }
1001
+ return n.maskResult(l);
1002
+ }).finally(function() {
1003
+ f && !s.has(n.query) && n.reobserveCacheFirst();
1004
+ });
1005
+ }, r.prototype.subscribeToMore = function(t) {
1006
+ var n = this, i = this.queryManager.startGraphQLSubscription({
1007
+ query: t.document,
1008
+ variables: t.variables,
1009
+ context: t.context
1010
+ }).subscribe({
1011
+ next: function(o) {
1012
+ var a = t.updateQuery;
1013
+ a && n.updateQuery(function(u, s) {
1014
+ return a(u, y({ subscriptionData: o }, s));
1015
+ });
1016
+ },
1017
+ error: function(o) {
1018
+ if (t.onError) {
1019
+ t.onError(o);
1020
+ return;
1021
+ }
1022
+ globalThis.__DEV__ !== !1 && m.error(23, o);
1023
+ }
1024
+ });
1025
+ return this.subscriptions.add(i), function() {
1026
+ n.subscriptions.delete(i) && i.unsubscribe();
1027
+ };
1028
+ }, r.prototype.setOptions = function(t) {
1029
+ return this.reobserve(t);
1030
+ }, r.prototype.silentSetOptions = function(t) {
1031
+ var n = N(this.options, t || {});
1032
+ ct(this.options, n);
1033
+ }, r.prototype.setVariables = function(t) {
1034
+ return _(this.variables, t) ? this.observers.size ? this.result() : Promise.resolve() : (this.options.variables = t, this.observers.size ? this.reobserve({
1035
+ // Reset options.fetchPolicy to its original value.
1036
+ fetchPolicy: this.options.initialFetchPolicy,
1037
+ variables: t
1038
+ }, b.setVariables) : Promise.resolve());
1039
+ }, r.prototype.updateQuery = function(t) {
1040
+ var n = this.queryManager, i = n.cache.diff({
1041
+ query: this.options.query,
1042
+ variables: this.variables,
1043
+ returnPartialData: !0,
1044
+ optimistic: !1
1045
+ }), o = i.result, a = i.complete, u = t(o, {
1046
+ variables: this.variables,
1047
+ complete: !!a,
1048
+ previousData: o
1049
+ });
1050
+ u && (n.cache.writeQuery({
1051
+ query: this.options.query,
1052
+ data: u,
1053
+ variables: this.variables
1054
+ }), n.broadcastQueries());
1055
+ }, r.prototype.startPolling = function(t) {
1056
+ this.options.pollInterval = t, this.updatePolling();
1057
+ }, r.prototype.stopPolling = function() {
1058
+ this.options.pollInterval = 0, this.updatePolling();
1059
+ }, r.prototype.applyNextFetchPolicy = function(t, n) {
1060
+ if (n.nextFetchPolicy) {
1061
+ var i = n.fetchPolicy, o = i === void 0 ? "cache-first" : i, a = n.initialFetchPolicy, u = a === void 0 ? o : a;
1062
+ o === "standby" || (typeof n.nextFetchPolicy == "function" ? n.fetchPolicy = n.nextFetchPolicy(o, {
1063
+ reason: t,
1064
+ options: n,
1065
+ observable: this,
1066
+ initialFetchPolicy: u
1067
+ }) : t === "variables-changed" ? n.fetchPolicy = u : n.fetchPolicy = n.nextFetchPolicy);
1068
+ }
1069
+ return n.fetchPolicy;
1070
+ }, r.prototype.fetch = function(t, n, i) {
1071
+ var o = this.queryManager.getOrCreateQuery(this.queryId);
1072
+ return o.setObservableQuery(this), this.queryManager.fetchConcastWithInfo(o, t, n, i);
1073
+ }, r.prototype.updatePolling = function() {
1074
+ var t = this;
1075
+ if (!this.queryManager.ssrMode) {
1076
+ var n = this, i = n.pollingInfo, o = n.options.pollInterval;
1077
+ if (!o || !this.hasObservers()) {
1078
+ i && (clearTimeout(i.timeout), delete this.pollingInfo);
1079
+ return;
1080
+ }
1081
+ if (!(i && i.interval === o)) {
1082
+ m(o, 24);
1083
+ var a = i || (this.pollingInfo = {});
1084
+ a.interval = o;
1085
+ var u = function() {
1086
+ var c, f;
1087
+ t.pollingInfo && (!Q(t.queryInfo.networkStatus) && !(!((f = (c = t.options).skipPollAttempt) === null || f === void 0) && f.call(c)) ? t.reobserve({
1088
+ // Most fetchPolicy options don't make sense to use in a polling context, as
1089
+ // users wouldn't want to be polling the cache directly. However, network-only and
1090
+ // no-cache are both useful for when the user wants to control whether or not the
1091
+ // polled results are written to the cache.
1092
+ fetchPolicy: t.options.initialFetchPolicy === "no-cache" ? "no-cache" : "network-only"
1093
+ }, b.poll).then(s, s) : s());
1094
+ }, s = function() {
1095
+ var c = t.pollingInfo;
1096
+ c && (clearTimeout(c.timeout), c.timeout = setTimeout(u, c.interval));
1097
+ };
1098
+ s();
1099
+ }
1100
+ }
1101
+ }, r.prototype.updateLastResult = function(t, n) {
1102
+ n === void 0 && (n = this.variables);
1103
+ var i = this.getLastError();
1104
+ return i && this.last && !_(n, this.last.variables) && (i = void 0), this.last = y({ result: this.queryManager.assumeImmutableResults ? t : ve(t), variables: n }, i ? { error: i } : null);
1105
+ }, r.prototype.reobserveAsConcast = function(t, n) {
1106
+ var i = this;
1107
+ this.isTornDown = !1;
1108
+ var o = (
1109
+ // Refetching uses a disposable Concast to allow refetches using different
1110
+ // options/variables, without permanently altering the options of the
1111
+ // original ObservableQuery.
1112
+ n === b.refetch || // The fetchMore method does not actually call the reobserve method, but,
1113
+ // if it did, it would definitely use a disposable Concast.
1114
+ n === b.fetchMore || // Polling uses a disposable Concast so the polling options (which force
1115
+ // fetchPolicy to be "network-only" or "no-cache") won't override the original options.
1116
+ n === b.poll
1117
+ ), a = this.options.variables, u = this.options.fetchPolicy, s = N(this.options, t || {}), c = o ? (
1118
+ // Disposable Concast fetches receive a shallow copy of this.options
1119
+ // (merged with newOptions), leaving this.options unmodified.
1120
+ s
1121
+ ) : ct(this.options, s), f = this.transformDocument(c.query);
1122
+ this.lastQuery = f, o || (this.updatePolling(), t && t.variables && !_(t.variables, a) && // Don't mess with the fetchPolicy if it's currently "standby".
1123
+ c.fetchPolicy !== "standby" && // If we're changing the fetchPolicy anyway, don't try to change it here
1124
+ // using applyNextFetchPolicy. The explicit options.fetchPolicy wins.
1125
+ (c.fetchPolicy === u || // A `nextFetchPolicy` function has even higher priority, though,
1126
+ // so in that case `applyNextFetchPolicy` must be called.
1127
+ typeof c.nextFetchPolicy == "function") && (this.applyNextFetchPolicy("variables-changed", c), n === void 0 && (n = b.setVariables))), this.waitForOwnResult && (this.waitForOwnResult = L(c.fetchPolicy));
1128
+ var l = function() {
1129
+ i.concast === p && (i.waitForOwnResult = !1);
1130
+ }, h = c.variables && y({}, c.variables), v = this.fetch(c, n, f), p = v.concast, O = v.fromLink, S = {
1131
+ next: function(d) {
1132
+ _(i.variables, h) && (l(), i.reportResult(d, h));
1133
+ },
1134
+ error: function(d) {
1135
+ _(i.variables, h) && (Rt(d) || (d = new H({ networkError: d })), l(), i.reportError(d, h));
1136
+ }
1137
+ };
1138
+ return !o && (O || !this.concast) && (this.concast && this.observer && this.concast.removeObserver(this.observer), this.concast = p, this.observer = S), p.addObserver(S), p;
1139
+ }, r.prototype.reobserve = function(t, n) {
1140
+ return he(this.reobserveAsConcast(t, n).promise.then(this.maskResult));
1141
+ }, r.prototype.resubscribeAfterError = function() {
1142
+ for (var t = [], n = 0; n < arguments.length; n++)
1143
+ t[n] = arguments[n];
1144
+ var i = this.last;
1145
+ this.resetLastResults();
1146
+ var o = this.subscribe.apply(this, t);
1147
+ return this.last = i, o;
1148
+ }, r.prototype.observe = function() {
1149
+ this.reportResult(
1150
+ // Passing false is important so that this.getCurrentResult doesn't
1151
+ // save the fetchMore result as this.lastResult, causing it to be
1152
+ // ignored due to the this.isDifferentFromLastResult check in
1153
+ // this.reportResult.
1154
+ this.getCurrentFullResult(!1),
1155
+ this.variables
1156
+ );
1157
+ }, r.prototype.reportResult = function(t, n) {
1158
+ var i = this.getLastError(), o = this.isDifferentFromLastResult(t, n);
1159
+ (i || !t.partial || this.options.returnPartialData) && this.updateLastResult(t, n), (i || o) && ut(this.observers, "next", this.maskResult(t));
1160
+ }, r.prototype.reportError = function(t, n) {
1161
+ var i = y(y({}, this.getLastResult()), { error: t, errors: t.graphQLErrors, networkStatus: b.error, loading: !1 });
1162
+ this.updateLastResult(i, n), ut(this.observers, "error", this.last.error = t);
1163
+ }, r.prototype.hasObservers = function() {
1164
+ return this.observers.size > 0;
1165
+ }, r.prototype.tearDownQuery = function() {
1166
+ this.isTornDown || (this.concast && this.observer && (this.concast.removeObserver(this.observer), delete this.concast, delete this.observer), this.stopPolling(), this.subscriptions.forEach(function(t) {
1167
+ return t.unsubscribe();
1168
+ }), this.subscriptions.clear(), this.queryManager.stopQuery(this.queryId), this.observers.clear(), this.isTornDown = !0);
1169
+ }, r.prototype.transformDocument = function(t) {
1170
+ return this.queryManager.transform(t);
1171
+ }, r.prototype.maskResult = function(t) {
1172
+ return t && "data" in t ? y(y({}, t), { data: this.queryManager.maskOperation({
1173
+ document: this.query,
1174
+ data: t.data,
1175
+ fetchPolicy: this.options.fetchPolicy,
1176
+ id: this.queryId
1177
+ }) }) : t;
1178
+ }, r.prototype.resetNotifications = function() {
1179
+ this.cancelNotifyTimeout(), this.dirty = !1;
1180
+ }, r.prototype.cancelNotifyTimeout = function() {
1181
+ this.notifyTimeout && (clearTimeout(this.notifyTimeout), this.notifyTimeout = void 0);
1182
+ }, r.prototype.scheduleNotify = function() {
1183
+ var t = this;
1184
+ this.dirty || (this.dirty = !0, this.notifyTimeout || (this.notifyTimeout = setTimeout(function() {
1185
+ return t.notify();
1186
+ }, 0)));
1187
+ }, r.prototype.notify = function() {
1188
+ if (this.cancelNotifyTimeout(), this.dirty && (this.options.fetchPolicy == "cache-only" || this.options.fetchPolicy == "cache-and-network" || !Q(this.queryInfo.networkStatus))) {
1189
+ var t = this.queryInfo.getDiff();
1190
+ t.fromOptimisticTransaction ? this.observe() : this.reobserveCacheFirst();
1191
+ }
1192
+ this.dirty = !1;
1193
+ }, r.prototype.reobserveCacheFirst = function() {
1194
+ var t = this.options, n = t.fetchPolicy, i = t.nextFetchPolicy;
1195
+ return n === "cache-and-network" || n === "network-only" ? this.reobserve({
1196
+ fetchPolicy: "cache-first",
1197
+ // Use a temporary nextFetchPolicy function that replaces itself with the
1198
+ // previous nextFetchPolicy value and returns the original fetchPolicy.
1199
+ nextFetchPolicy: function(o, a) {
1200
+ return this.nextFetchPolicy = i, typeof this.nextFetchPolicy == "function" ? this.nextFetchPolicy(o, a) : n;
1201
+ }
1202
+ }) : this.reobserve();
1203
+ }, r.inactiveOnCreation = new J(), r;
1204
+ }(k)
1205
+ );
1206
+ be(Pt);
1207
+ function _e(e) {
1208
+ globalThis.__DEV__ !== !1 && m.error(25, e.message, e.stack);
1209
+ }
1210
+ function Se(e) {
1211
+ globalThis.__DEV__ !== !1 && e && globalThis.__DEV__ !== !1 && m.debug(26, e);
1212
+ }
1213
+ function L(e) {
1214
+ return e === "network-only" || e === "no-cache" || e === "standby";
1215
+ }
1216
+ var ft = !1, Oe = "useSyncExternalStore", Pe = Ct[Oe], qe = Pe || function(e, r, t) {
1217
+ var n = r();
1218
+ // DEVIATION: Using __DEV__
1219
+ globalThis.__DEV__ !== !1 && !ft && // DEVIATION: Not using Object.is because we know our snapshots will never
1220
+ // be exotic primitive values like NaN, which is !== itself.
1221
+ n !== r() && (ft = !0, globalThis.__DEV__ !== !1 && m.error(68));
1222
+ var i = P.useState({
1223
+ inst: { value: n, getSnapshot: r }
1224
+ }), o = i[0].inst, a = i[1];
1225
+ return jt ? P.useLayoutEffect(function() {
1226
+ Object.assign(o, { value: n, getSnapshot: r }), z(o) && a({ inst: o });
1227
+ }, [e, n, r]) : Object.assign(o, { value: n, getSnapshot: r }), P.useEffect(function() {
1228
+ return z(o) && a({ inst: o }), e(function() {
1229
+ z(o) && a({ inst: o });
1230
+ });
1231
+ }, [e]), n;
1232
+ };
1233
+ function z(e) {
1234
+ var r = e.value, t = e.getSnapshot;
1235
+ try {
1236
+ return r !== t();
1237
+ } catch {
1238
+ return !0;
1239
+ }
1240
+ }
1241
+ var Ee = Symbol.for("apollo.hook.wrappers");
1242
+ function De(e, r, t) {
1243
+ var n = t.queryManager, i = n && n[Ee], o = i && i[e];
1244
+ return o ? o(r) : r;
1245
+ }
1246
+ var Fe = Object.prototype.hasOwnProperty;
1247
+ function lt() {
1248
+ }
1249
+ var R = Symbol();
1250
+ function Be(e, r) {
1251
+ return r === void 0 && (r = /* @__PURE__ */ Object.create(null)), De(
1252
+ "useQuery",
1253
+ // eslint-disable-next-line react-compiler/react-compiler
1254
+ ke,
1255
+ pt(r && r.client)
1256
+ )(e, r);
1257
+ }
1258
+ function ke(e, r) {
1259
+ var t = Te(e, r), n = t.result, i = t.obsQueryFields;
1260
+ return P.useMemo(function() {
1261
+ return y(y({}, n), i);
1262
+ }, [n, i]);
1263
+ }
1264
+ function Ie(e, r, t, n, i) {
1265
+ function o(l) {
1266
+ var h;
1267
+ Lt(r, zt.Query);
1268
+ var v = {
1269
+ client: e,
1270
+ query: r,
1271
+ observable: (
1272
+ // See if there is an existing observable that was used to fetch the same
1273
+ // data and if so, use it instead since it will contain the proper queryId
1274
+ // to fetch the result set. This is used during SSR.
1275
+ n && n.getSSRObservable(i()) || Pt.inactiveOnCreation.withValue(!n, function() {
1276
+ return e.watchQuery(qt(void 0, e, t, i()));
1277
+ })
1278
+ ),
1279
+ resultData: {
1280
+ // Reuse previousData from previous InternalState (if any) to provide
1281
+ // continuity of previousData even if/when the query or client changes.
1282
+ previousData: (h = l == null ? void 0 : l.resultData.current) === null || h === void 0 ? void 0 : h.data
1283
+ }
1284
+ };
1285
+ return v;
1286
+ }
1287
+ var a = P.useState(o), u = a[0], s = a[1];
1288
+ function c(l) {
1289
+ var h, v;
1290
+ Object.assign(u.observable, (h = {}, h[R] = l, h));
1291
+ var p = u.resultData;
1292
+ s(y(y({}, u), {
1293
+ // might be a different query
1294
+ query: l.query,
1295
+ resultData: Object.assign(p, {
1296
+ // We need to modify the previous `resultData` object as we rely on the
1297
+ // object reference in other places
1298
+ previousData: ((v = p.current) === null || v === void 0 ? void 0 : v.data) || p.previousData,
1299
+ current: void 0
1300
+ })
1301
+ }));
1302
+ }
1303
+ if (e !== u.client || r !== u.query) {
1304
+ var f = o(u);
1305
+ return s(f), [f, c];
1306
+ }
1307
+ return [u, c];
1308
+ }
1309
+ function Te(e, r) {
1310
+ var t = pt(r.client), n = P.useContext(Vt()).renderPromises, i = !!n, o = t.disableNetworkFetches, a = r.ssr !== !1 && !r.skip, u = r.partialRefetch, s = Re(t, e, r, i), c = Ie(t, e, r, n, s), f = c[0], l = f.observable, h = f.resultData, v = c[1], p = s(l);
1311
+ xe(
1312
+ h,
1313
+ // might get mutated during render
1314
+ l,
1315
+ // might get mutated during render
1316
+ t,
1317
+ r,
1318
+ p
1319
+ );
1320
+ var O = P.useMemo(function() {
1321
+ return Ae(l);
1322
+ }, [l]);
1323
+ Me(l, n, a);
1324
+ var S = Qe(h, l, t, r, p, o, u, i, {
1325
+ onCompleted: r.onCompleted || lt,
1326
+ onError: r.onError || lt
1327
+ });
1328
+ return {
1329
+ result: S,
1330
+ obsQueryFields: O,
1331
+ observable: l,
1332
+ resultData: h,
1333
+ client: t,
1334
+ onQueryExecuted: v
1335
+ };
1336
+ }
1337
+ function Qe(e, r, t, n, i, o, a, u, s) {
1338
+ var c = P.useRef(s);
1339
+ P.useEffect(function() {
1340
+ c.current = s;
1341
+ });
1342
+ var f = (u || o) && n.ssr === !1 && !n.skip ? (
1343
+ // If SSR has been explicitly disabled, and this function has been called
1344
+ // on the server side, return the default loading state.
1345
+ Dt
1346
+ ) : n.skip || i.fetchPolicy === "standby" ? (
1347
+ // When skipping a query (ie. we're not querying for data but still want to
1348
+ // render children), make sure the `data` is cleared out and `loading` is
1349
+ // set to `false` (since we aren't loading anything).
1350
+ //
1351
+ // NOTE: We no longer think this is the correct behavior. Skipping should
1352
+ // not automatically set `data` to `undefined`, but instead leave the
1353
+ // previous data in place. In other words, skipping should not mandate that
1354
+ // previously received data is all of a sudden removed. Unfortunately,
1355
+ // changing this is breaking, so we'll have to wait until Apollo Client 4.0
1356
+ // to address this.
1357
+ Ft
1358
+ ) : void 0, l = e.previousData, h = P.useMemo(function() {
1359
+ return f && Et(f, l, r, t);
1360
+ }, [t, r, f, l]);
1361
+ return qe(P.useCallback(function(v) {
1362
+ if (u)
1363
+ return function() {
1364
+ };
1365
+ var p = function() {
1366
+ var d = e.current, w = r.getCurrentResult();
1367
+ d && d.loading === w.loading && d.networkStatus === w.networkStatus && _(d.data, w.data) || G(w, e, r, t, a, v, c.current);
1368
+ }, O = function(d) {
1369
+ if (S.current.unsubscribe(), S.current = r.resubscribeAfterError(p, O), !Fe.call(d, "graphQLErrors"))
1370
+ throw d;
1371
+ var w = e.current;
1372
+ (!w || w && w.loading || !_(d, w.error)) && G({
1373
+ data: w && w.data,
1374
+ error: d,
1375
+ loading: !1,
1376
+ networkStatus: b.error
1377
+ }, e, r, t, a, v, c.current);
1378
+ }, S = { current: r.subscribe(p, O) };
1379
+ return function() {
1380
+ setTimeout(function() {
1381
+ return S.current.unsubscribe();
1382
+ });
1383
+ };
1384
+ }, [
1385
+ o,
1386
+ u,
1387
+ r,
1388
+ e,
1389
+ a,
1390
+ t
1391
+ ]), function() {
1392
+ return h || ht(e, r, c.current, a, t);
1393
+ }, function() {
1394
+ return h || ht(e, r, c.current, a, t);
1395
+ });
1396
+ }
1397
+ function Me(e, r, t) {
1398
+ r && t && (r.registerSSRObservable(e), e.getCurrentResult().loading && r.addObservableQueryPromise(e));
1399
+ }
1400
+ function xe(e, r, t, n, i) {
1401
+ var o;
1402
+ r[R] && !_(r[R], i) && (r.reobserve(qt(r, t, n, i)), e.previousData = ((o = e.current) === null || o === void 0 ? void 0 : o.data) || e.previousData, e.current = void 0), r[R] = i;
1403
+ }
1404
+ function Re(e, r, t, n) {
1405
+ t === void 0 && (t = {});
1406
+ var i = t.skip;
1407
+ t.ssr, t.onCompleted, t.onError;
1408
+ var o = t.defaultOptions, a = C(t, ["skip", "ssr", "onCompleted", "onError", "defaultOptions"]);
1409
+ return function(u) {
1410
+ var s = Object.assign(a, { query: r });
1411
+ return n && (s.fetchPolicy === "network-only" || s.fetchPolicy === "cache-and-network") && (s.fetchPolicy = "cache-first"), s.variables || (s.variables = {}), i ? (s.initialFetchPolicy = s.initialFetchPolicy || s.fetchPolicy || yt(o, e.defaultOptions), s.fetchPolicy = "standby") : s.fetchPolicy || (s.fetchPolicy = (u == null ? void 0 : u.options.initialFetchPolicy) || yt(o, e.defaultOptions)), s;
1412
+ };
1413
+ }
1414
+ function qt(e, r, t, n) {
1415
+ var i = [], o = r.defaultOptions.watchQuery;
1416
+ return o && i.push(o), t.defaultOptions && i.push(t.defaultOptions), i.push(N(e && e.options, n)), i.reduce(At);
1417
+ }
1418
+ function G(e, r, t, n, i, o, a) {
1419
+ var u = r.current;
1420
+ u && u.data && (r.previousData = u.data), !e.error && mt(e.errors) && (e.error = new H({ graphQLErrors: e.errors })), r.current = Et(Ve(e, t, i), r.previousData, t, n), o(), Ce(e, u == null ? void 0 : u.networkStatus, a);
1421
+ }
1422
+ function Ce(e, r, t) {
1423
+ if (!e.loading) {
1424
+ var n = je(e);
1425
+ Promise.resolve().then(function() {
1426
+ n ? t.onError(n) : e.data && r !== e.networkStatus && e.networkStatus === b.ready && t.onCompleted(e.data);
1427
+ }).catch(function(i) {
1428
+ globalThis.__DEV__ !== !1 && m.warn(i);
1429
+ });
1430
+ }
1431
+ }
1432
+ function ht(e, r, t, n, i) {
1433
+ return e.current || G(r.getCurrentResult(), e, r, i, n, function() {
1434
+ }, t), e.current;
1435
+ }
1436
+ function yt(e, r) {
1437
+ var t;
1438
+ return (e == null ? void 0 : e.fetchPolicy) || ((t = r == null ? void 0 : r.watchQuery) === null || t === void 0 ? void 0 : t.fetchPolicy) || "cache-first";
1439
+ }
1440
+ function je(e) {
1441
+ return mt(e.errors) ? new H({ graphQLErrors: e.errors }) : e.error;
1442
+ }
1443
+ function Et(e, r, t, n) {
1444
+ var i = e.data;
1445
+ e.partial;
1446
+ var o = C(e, ["data", "partial"]), a = y(y({ data: i }, o), { client: n, observable: t, variables: t.variables, called: e !== Dt && e !== Ft, previousData: r });
1447
+ return a;
1448
+ }
1449
+ function Ve(e, r, t) {
1450
+ return e.partial && t && !e.loading && (!e.data || Object.keys(e.data).length === 0) && r.options.fetchPolicy !== "cache-only" ? (r.refetch(), y(y({}, e), { loading: !0, networkStatus: b.refetch })) : e;
1451
+ }
1452
+ var Dt = Ot({
1453
+ loading: !0,
1454
+ data: void 0,
1455
+ error: void 0,
1456
+ networkStatus: b.loading
1457
+ }), Ft = Ot({
1458
+ loading: !1,
1459
+ data: void 0,
1460
+ error: void 0,
1461
+ networkStatus: b.ready
1462
+ });
1463
+ function Ae(e) {
1464
+ return {
1465
+ refetch: e.refetch.bind(e),
1466
+ reobserve: e.reobserve.bind(e),
1467
+ fetchMore: e.fetchMore.bind(e),
1468
+ updateQuery: e.updateQuery.bind(e),
1469
+ startPolling: e.startPolling.bind(e),
1470
+ stopPolling: e.stopPolling.bind(e),
1471
+ subscribeToMore: e.subscribeToMore.bind(e)
1472
+ };
1473
+ }
1474
+ export {
1475
+ Te as a,
1476
+ qt as b,
1477
+ Re as c,
1478
+ yt as g,
1479
+ Et as t,
1480
+ Be as u
1481
+ };