@graffiticode/l0000-view 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { jsx as it, jsxs as kt } from "react/jsx-runtime";
2
- import at, { createContext as ge, useEffect as st, useLayoutEffect as ve, useContext as Oe, useMemo as re, useRef as P, useCallback as gt, useDebugValue as we, useState as k } from "react";
3
- var Ct = { exports: {} }, vt = {};
1
+ import { jsx as F, jsxs as Lt } from "react/jsx-runtime";
2
+ import ct, { createContext as ve, useEffect as at, useLayoutEffect as ye, useContext as Oe, useMemo as oe, useRef as q, useCallback as Et, useDebugValue as we, useState as J } from "react";
3
+ var bt = { exports: {} }, vt = {};
4
4
  /**
5
5
  * @license React
6
6
  * use-sync-external-store-shim.production.js
@@ -11,47 +11,47 @@ var Ct = { exports: {} }, vt = {};
11
11
  * LICENSE file in the root directory of this source tree.
12
12
  */
13
13
  var Bt;
14
- function ye() {
14
+ function _e() {
15
15
  if (Bt) return vt;
16
16
  Bt = 1;
17
- var t = at;
18
- function e(i, p) {
19
- return i === p && (i !== 0 || 1 / i === 1 / p) || i !== i && p !== p;
17
+ var t = ct;
18
+ function e(i, l) {
19
+ return i === l && (i !== 0 || 1 / i === 1 / l) || i !== i && l !== l;
20
20
  }
21
- var n = typeof Object.is == "function" ? Object.is : e, r = t.useState, o = t.useEffect, l = t.useLayoutEffect, a = t.useDebugValue;
22
- function d(i, p) {
23
- var c = p(), h = r({ inst: { value: c, getSnapshot: p } }), u = h[0].inst, g = h[1];
24
- return l(
21
+ var n = typeof Object.is == "function" ? Object.is : e, r = t.useState, o = t.useEffect, u = t.useLayoutEffect, a = t.useDebugValue;
22
+ function d(i, l) {
23
+ var c = l(), p = r({ inst: { value: c, getSnapshot: l } }), g = p[0].inst, h = p[1];
24
+ return u(
25
25
  function() {
26
- u.value = c, u.getSnapshot = p, m(u) && g({ inst: u });
26
+ g.value = c, g.getSnapshot = l, m(g) && h({ inst: g });
27
27
  },
28
- [i, c, p]
28
+ [i, c, l]
29
29
  ), o(
30
30
  function() {
31
- return m(u) && g({ inst: u }), i(function() {
32
- m(u) && g({ inst: u });
31
+ return m(g) && h({ inst: g }), i(function() {
32
+ m(g) && h({ inst: g });
33
33
  });
34
34
  },
35
35
  [i]
36
36
  ), a(c), c;
37
37
  }
38
38
  function m(i) {
39
- var p = i.getSnapshot;
39
+ var l = i.getSnapshot;
40
40
  i = i.value;
41
41
  try {
42
- var c = p();
42
+ var c = l();
43
43
  return !n(i, c);
44
44
  } catch {
45
45
  return !0;
46
46
  }
47
47
  }
48
- function R(i, p) {
49
- return p();
48
+ function R(i, l) {
49
+ return l();
50
50
  }
51
- var S = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? R : d;
52
- return vt.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : S, vt;
51
+ var E = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? R : d;
52
+ return vt.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : E, vt;
53
53
  }
54
- var Ot = {};
54
+ var yt = {};
55
55
  /**
56
56
  * @license React
57
57
  * use-sync-external-store-shim.development.js
@@ -61,32 +61,32 @@ var Ot = {};
61
61
  * This source code is licensed under the MIT license found in the
62
62
  * LICENSE file in the root directory of this source tree.
63
63
  */
64
- var Kt;
65
- function _e() {
66
- return Kt || (Kt = 1, process.env.NODE_ENV !== "production" && function() {
67
- function t(c, h) {
68
- return c === h && (c !== 0 || 1 / c === 1 / h) || c !== c && h !== h;
64
+ var Jt;
65
+ function Re() {
66
+ return Jt || (Jt = 1, process.env.NODE_ENV !== "production" && function() {
67
+ function t(c, p) {
68
+ return c === p && (c !== 0 || 1 / c === 1 / p) || c !== c && p !== p;
69
69
  }
70
- function e(c, h) {
71
- S || o.startTransition === void 0 || (S = !0, console.error(
70
+ function e(c, p) {
71
+ E || o.startTransition === void 0 || (E = !0, console.error(
72
72
  "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
73
73
  ));
74
- var u = h();
74
+ var g = p();
75
75
  if (!i) {
76
- var g = h();
77
- l(u, g) || (console.error(
76
+ var h = p();
77
+ u(g, h) || (console.error(
78
78
  "The result of getSnapshot should be cached to avoid an infinite loop"
79
79
  ), i = !0);
80
80
  }
81
- g = a({
82
- inst: { value: u, getSnapshot: h }
81
+ h = a({
82
+ inst: { value: g, getSnapshot: p }
83
83
  });
84
- var D = g[0].inst, s = g[1];
84
+ var D = h[0].inst, s = h[1];
85
85
  return m(
86
86
  function() {
87
- D.value = u, D.getSnapshot = h, n(D) && s({ inst: D });
87
+ D.value = g, D.getSnapshot = p, n(D) && s({ inst: D });
88
88
  },
89
- [c, u, h]
89
+ [c, g, p]
90
90
  ), d(
91
91
  function() {
92
92
  return n(D) && s({ inst: D }), c(function() {
@@ -94,31 +94,31 @@ function _e() {
94
94
  });
95
95
  },
96
96
  [c]
97
- ), R(u), u;
97
+ ), R(g), g;
98
98
  }
99
99
  function n(c) {
100
- var h = c.getSnapshot;
100
+ var p = c.getSnapshot;
101
101
  c = c.value;
102
102
  try {
103
- var u = h();
104
- return !l(c, u);
103
+ var g = p();
104
+ return !u(c, g);
105
105
  } catch {
106
106
  return !0;
107
107
  }
108
108
  }
109
- function r(c, h) {
110
- return h();
109
+ function r(c, p) {
110
+ return p();
111
111
  }
112
112
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
113
- var o = at, l = typeof Object.is == "function" ? Object.is : t, a = o.useState, d = o.useEffect, m = o.useLayoutEffect, R = o.useDebugValue, S = !1, i = !1, p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : e;
114
- Ot.useSyncExternalStore = o.useSyncExternalStore !== void 0 ? o.useSyncExternalStore : p, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
115
- }()), Ot;
113
+ var o = ct, u = typeof Object.is == "function" ? Object.is : t, a = o.useState, d = o.useEffect, m = o.useLayoutEffect, R = o.useDebugValue, E = !1, i = !1, l = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? r : e;
114
+ yt.useSyncExternalStore = o.useSyncExternalStore !== void 0 ? o.useSyncExternalStore : l, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
115
+ }()), yt;
116
116
  }
117
- process.env.NODE_ENV === "production" ? Ct.exports = ye() : Ct.exports = _e();
118
- var Jt = Ct.exports;
119
- const oe = 0, se = 1, ie = 2, zt = 3;
117
+ process.env.NODE_ENV === "production" ? bt.exports = _e() : bt.exports = Re();
118
+ var Kt = bt.exports;
119
+ const se = 0, ie = 1, ae = 2, zt = 3;
120
120
  var Yt = Object.prototype.hasOwnProperty;
121
- function At(t, e) {
121
+ function Ct(t, e) {
122
122
  var n, r;
123
123
  if (t === e) return !0;
124
124
  if (t && e && (n = t.constructor) === e.constructor) {
@@ -126,184 +126,184 @@ function At(t, e) {
126
126
  if (n === RegExp) return t.toString() === e.toString();
127
127
  if (n === Array) {
128
128
  if ((r = t.length) === e.length)
129
- for (; r-- && At(t[r], e[r]); ) ;
129
+ for (; r-- && Ct(t[r], e[r]); ) ;
130
130
  return r === -1;
131
131
  }
132
132
  if (!n || typeof t == "object") {
133
133
  r = 0;
134
134
  for (n in t)
135
- if (Yt.call(t, n) && ++r && !Yt.call(e, n) || !(n in e) || !At(t[n], e[n])) return !1;
135
+ if (Yt.call(t, n) && ++r && !Yt.call(e, n) || !(n in e) || !Ct(t[n], e[n])) return !1;
136
136
  return Object.keys(e).length === r;
137
137
  }
138
138
  }
139
139
  return t !== t && e !== e;
140
140
  }
141
- const U = /* @__PURE__ */ new WeakMap(), W = () => {
142
- }, C = (
141
+ const U = /* @__PURE__ */ new WeakMap(), P = () => {
142
+ }, L = (
143
143
  /*#__NOINLINE__*/
144
- W()
145
- ), Lt = Object, f = (t) => t === C, F = (t) => typeof t == "function", $ = (t, e) => ({
144
+ P()
145
+ ), At = Object, f = (t) => t === L, M = (t) => typeof t == "function", H = (t, e) => ({
146
146
  ...t,
147
147
  ...e
148
- }), ae = (t) => F(t.then), wt = {}, dt = {}, Ft = "undefined", ct = typeof window != Ft, bt = typeof document != Ft, Re = ct && "Deno" in window, De = () => ct && typeof window.requestAnimationFrame != Ft, ce = (t, e) => {
148
+ }), ce = (t) => M(t.then), Ot = {}, dt = {}, Wt = "undefined", ut = typeof window != Wt, xt = typeof document != Wt, De = ut && "Deno" in window, Te = () => ut && typeof window.requestAnimationFrame != Wt, ue = (t, e) => {
149
149
  const n = U.get(t);
150
150
  return [
151
151
  // Getter
152
- () => !f(e) && t.get(e) || wt,
152
+ () => !f(e) && t.get(e) || Ot,
153
153
  // Setter
154
154
  (r) => {
155
155
  if (!f(e)) {
156
156
  const o = t.get(e);
157
- e in dt || (dt[e] = o), n[5](e, $(o, r), o || wt);
157
+ e in dt || (dt[e] = o), n[5](e, H(o, r), o || Ot);
158
158
  }
159
159
  },
160
160
  // Subscriber
161
161
  n[6],
162
162
  // Get server cache snapshot
163
- () => !f(e) && e in dt ? dt[e] : !f(e) && t.get(e) || wt
163
+ () => !f(e) && e in dt ? dt[e] : !f(e) && t.get(e) || Ot
164
164
  ];
165
165
  };
166
- let xt = !0;
167
- const Te = () => xt, [It, Nt] = ct && window.addEventListener ? [
166
+ let It = !0;
167
+ const Le = () => It, [Nt, Vt] = ut && window.addEventListener ? [
168
168
  window.addEventListener.bind(window),
169
169
  window.removeEventListener.bind(window)
170
170
  ] : [
171
- W,
172
- W
173
- ], Ce = () => {
174
- const t = bt && document.visibilityState;
171
+ P,
172
+ P
173
+ ], be = () => {
174
+ const t = xt && document.visibilityState;
175
175
  return f(t) || t !== "hidden";
176
- }, Ae = (t) => (bt && document.addEventListener("visibilitychange", t), It("focus", t), () => {
177
- bt && document.removeEventListener("visibilitychange", t), Nt("focus", t);
178
- }), Le = (t) => {
176
+ }, Ce = (t) => (xt && document.addEventListener("visibilitychange", t), Nt("focus", t), () => {
177
+ xt && document.removeEventListener("visibilitychange", t), Vt("focus", t);
178
+ }), Ae = (t) => {
179
179
  const e = () => {
180
- xt = !0, t();
180
+ It = !0, t();
181
181
  }, n = () => {
182
- xt = !1;
182
+ It = !1;
183
183
  };
184
- return It("online", e), It("offline", n), () => {
185
- Nt("online", e), Nt("offline", n);
184
+ return Nt("online", e), Nt("offline", n), () => {
185
+ Vt("online", e), Vt("offline", n);
186
186
  };
187
- }, be = {
188
- isOnline: Te,
189
- isVisible: Ce
190
187
  }, xe = {
191
- initFocus: Ae,
192
- initReconnect: Le
193
- }, Xt = !at.useId, tt = !ct || Re, Ie = (t) => De() ? window.requestAnimationFrame(t) : setTimeout(t, 1), yt = tt ? st : ve, _t = typeof navigator < "u" && navigator.connection, Qt = !tt && _t && ([
188
+ isOnline: Le,
189
+ isVisible: be
190
+ }, Ie = {
191
+ initFocus: Ce,
192
+ initReconnect: Ae
193
+ }, Xt = !ct.useId, nt = !ut || De, Ne = (t) => Te() ? window.requestAnimationFrame(t) : setTimeout(t, 1), wt = nt ? at : ye, _t = typeof navigator < "u" && navigator.connection, Qt = !nt && _t && ([
194
194
  "slow-2g",
195
195
  "2g"
196
- ].includes(_t.effectiveType) || _t.saveData), pt = /* @__PURE__ */ new WeakMap(), Ne = (t) => Lt.prototype.toString.call(t), Rt = (t, e) => t === `[object ${e}]`;
197
- let Ve = 0;
198
- const Vt = (t) => {
199
- const e = typeof t, n = Ne(t), r = Rt(n, "Date"), o = Rt(n, "RegExp"), l = Rt(n, "Object");
196
+ ].includes(_t.effectiveType) || _t.saveData), pt = /* @__PURE__ */ new WeakMap(), Ve = (t) => At.prototype.toString.call(t), Rt = (t, e) => t === `[object ${e}]`;
197
+ let je = 0;
198
+ const jt = (t) => {
199
+ const e = typeof t, n = Ve(t), r = Rt(n, "Date"), o = Rt(n, "RegExp"), u = Rt(n, "Object");
200
200
  let a, d;
201
- if (Lt(t) === t && !r && !o) {
201
+ if (At(t) === t && !r && !o) {
202
202
  if (a = pt.get(t), a) return a;
203
- if (a = ++Ve + "~", pt.set(t, a), Array.isArray(t)) {
203
+ if (a = ++je + "~", pt.set(t, a), Array.isArray(t)) {
204
204
  for (a = "@", d = 0; d < t.length; d++)
205
- a += Vt(t[d]) + ",";
205
+ a += jt(t[d]) + ",";
206
206
  pt.set(t, a);
207
207
  }
208
- if (l) {
208
+ if (u) {
209
209
  a = "#";
210
- const m = Lt.keys(t).sort();
210
+ const m = At.keys(t).sort();
211
211
  for (; !f(d = m.pop()); )
212
- f(t[d]) || (a += d + ":" + Vt(t[d]) + ",");
212
+ f(t[d]) || (a += d + ":" + jt(t[d]) + ",");
213
213
  pt.set(t, a);
214
214
  }
215
215
  } else
216
216
  a = r ? t.toJSON() : e == "symbol" ? t.toString() : e == "string" ? JSON.stringify(t) : "" + t;
217
217
  return a;
218
- }, Mt = (t) => {
219
- if (F(t))
218
+ }, Ft = (t) => {
219
+ if (M(t))
220
220
  try {
221
221
  t = t();
222
222
  } catch {
223
223
  t = "";
224
224
  }
225
225
  const e = t;
226
- return t = typeof t == "string" ? t : (Array.isArray(t) ? t.length : t) ? Vt(t) : "", [
226
+ return t = typeof t == "string" ? t : (Array.isArray(t) ? t.length : t) ? jt(t) : "", [
227
227
  t,
228
228
  e
229
229
  ];
230
230
  };
231
- let je = 0;
232
- const jt = () => ++je;
233
- async function ue(...t) {
234
- const [e, n, r, o] = t, l = $({
231
+ let Me = 0;
232
+ const Mt = () => ++Me;
233
+ async function le(...t) {
234
+ const [e, n, r, o] = t, u = H({
235
235
  populateCache: !0,
236
236
  throwOnError: !0
237
237
  }, typeof o == "boolean" ? {
238
238
  revalidate: o
239
239
  } : o || {});
240
- let a = l.populateCache;
241
- const d = l.rollbackOnError;
242
- let m = l.optimisticData;
243
- const R = (p) => typeof d == "function" ? d(p) : d !== !1, S = l.throwOnError;
244
- if (F(n)) {
245
- const p = n, c = [], h = e.keys();
246
- for (const u of h)
240
+ let a = u.populateCache;
241
+ const d = u.rollbackOnError;
242
+ let m = u.optimisticData;
243
+ const R = (l) => typeof d == "function" ? d(l) : d !== !1, E = u.throwOnError;
244
+ if (M(n)) {
245
+ const l = n, c = [], p = e.keys();
246
+ for (const g of p)
247
247
  // Skip the special useSWRInfinite and useSWRSubscription keys.
248
- !/^\$(inf|sub)\$/.test(u) && p(e.get(u)._k) && c.push(u);
248
+ !/^\$(inf|sub)\$/.test(g) && l(e.get(g)._k) && c.push(g);
249
249
  return Promise.all(c.map(i));
250
250
  }
251
251
  return i(n);
252
- async function i(p) {
253
- const [c] = Mt(p);
252
+ async function i(l) {
253
+ const [c] = Ft(l);
254
254
  if (!c) return;
255
- const [h, u] = ce(e, c), [g, D, s, ut] = U.get(e), B = () => {
256
- const b = g[c];
257
- return (F(l.revalidate) ? l.revalidate(h().data, p) : l.revalidate !== !1) && (delete s[c], delete ut[c], b && b[0]) ? b[0](ie).then(() => h().data) : h().data;
255
+ const [p, g] = ue(e, c), [h, D, s, $] = U.get(e), K = () => {
256
+ const A = h[c];
257
+ return (M(u.revalidate) ? u.revalidate(p().data, l) : u.revalidate !== !1) && (delete s[c], delete $[c], A && A[0]) ? A[0](ae).then(() => p().data) : p().data;
258
258
  };
259
259
  if (t.length < 3)
260
- return B();
260
+ return K();
261
261
  let T = r, I, N = !1;
262
- const K = jt();
262
+ const z = Mt();
263
263
  D[c] = [
264
- K,
264
+ z,
265
265
  0
266
266
  ];
267
- const v = !f(m), J = h(), V = J.data, z = J._c, q = f(z) ? V : z;
268
- if (v && (m = F(m) ? m(q, V) : m, u({
267
+ const v = !f(m), Y = p(), V = Y.data, X = Y._c, k = f(X) ? V : X;
268
+ if (v && (m = M(m) ? m(k, V) : m, g({
269
269
  data: m,
270
- _c: q
271
- })), F(T))
270
+ _c: k
271
+ })), M(T))
272
272
  try {
273
- T = T(q);
274
- } catch (b) {
275
- I = b, N = !0;
273
+ T = T(k);
274
+ } catch (A) {
275
+ I = A, N = !0;
276
276
  }
277
- if (T && ae(T))
278
- if (T = await T.catch((b) => {
279
- I = b, N = !0;
280
- }), K !== D[c][0]) {
277
+ if (T && ce(T))
278
+ if (T = await T.catch((A) => {
279
+ I = A, N = !0;
280
+ }), z !== D[c][0]) {
281
281
  if (N) throw I;
282
282
  return T;
283
- } else N && v && R(I) && (a = !0, u({
284
- data: q,
285
- _c: C
283
+ } else N && v && R(I) && (a = !0, g({
284
+ data: k,
285
+ _c: L
286
286
  }));
287
287
  if (a && !N)
288
- if (F(a)) {
289
- const b = a(T, q);
290
- u({
291
- data: b,
292
- error: C,
293
- _c: C
288
+ if (M(a)) {
289
+ const A = a(T, k);
290
+ g({
291
+ data: A,
292
+ error: L,
293
+ _c: L
294
294
  });
295
295
  } else
296
- u({
296
+ g({
297
297
  data: T,
298
- error: C,
299
- _c: C
298
+ error: L,
299
+ _c: L
300
300
  });
301
- if (D[c][1] = jt(), Promise.resolve(B()).then(() => {
302
- u({
303
- _c: C
301
+ if (D[c][1] = Mt(), Promise.resolve(K()).then(() => {
302
+ g({
303
+ _c: L
304
304
  });
305
305
  }), N) {
306
- if (S) throw I;
306
+ if (E) throw I;
307
307
  return;
308
308
  }
309
309
  return T;
@@ -312,19 +312,19 @@ async function ue(...t) {
312
312
  const Zt = (t, e) => {
313
313
  for (const n in t)
314
314
  t[n][0] && t[n][0](e);
315
- }, Fe = (t, e) => {
315
+ }, We = (t, e) => {
316
316
  if (!U.has(t)) {
317
- const n = $(xe, e), r = /* @__PURE__ */ Object.create(null), o = ue.bind(C, t);
318
- let l = W;
319
- const a = /* @__PURE__ */ Object.create(null), d = (S, i) => {
320
- const p = a[S] || [];
321
- return a[S] = p, p.push(i), () => p.splice(p.indexOf(i), 1);
322
- }, m = (S, i, p) => {
323
- t.set(S, i);
324
- const c = a[S];
317
+ const n = H(Ie, e), r = /* @__PURE__ */ Object.create(null), o = le.bind(L, t);
318
+ let u = P;
319
+ const a = /* @__PURE__ */ Object.create(null), d = (E, i) => {
320
+ const l = a[E] || [];
321
+ return a[E] = l, l.push(i), () => l.splice(l.indexOf(i), 1);
322
+ }, m = (E, i, l) => {
323
+ t.set(E, i);
324
+ const c = a[E];
325
325
  if (c)
326
- for (const h of c)
327
- h(i, p);
326
+ for (const p of c)
327
+ p(i, l);
328
328
  }, R = () => {
329
329
  if (!U.has(t) && (U.set(t, [
330
330
  r,
@@ -334,10 +334,10 @@ const Zt = (t, e) => {
334
334
  o,
335
335
  m,
336
336
  d
337
- ]), !tt)) {
338
- const S = n.initFocus(setTimeout.bind(C, Zt.bind(C, r, oe))), i = n.initReconnect(setTimeout.bind(C, Zt.bind(C, r, se)));
339
- l = () => {
340
- S && S(), i && i(), U.delete(t);
337
+ ]), !nt)) {
338
+ const E = n.initFocus(setTimeout.bind(L, Zt.bind(L, r, se))), i = n.initReconnect(setTimeout.bind(L, Zt.bind(L, r, ie)));
339
+ u = () => {
340
+ E && E(), i && i(), U.delete(t);
341
341
  };
342
342
  }
343
343
  };
@@ -345,24 +345,24 @@ const Zt = (t, e) => {
345
345
  t,
346
346
  o,
347
347
  R,
348
- l
348
+ u
349
349
  ];
350
350
  }
351
351
  return [
352
352
  t,
353
353
  U.get(t)[4]
354
354
  ];
355
- }, Me = (t, e, n, r, o) => {
356
- const l = n.errorRetryCount, a = o.retryCount, d = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * n.errorRetryInterval;
357
- !f(l) && a > l || setTimeout(r, d, o);
358
- }, Ue = At, [le, We] = Fe(/* @__PURE__ */ new Map()), Pe = $(
355
+ }, Fe = (t, e, n, r, o) => {
356
+ const u = n.errorRetryCount, a = o.retryCount, d = ~~((Math.random() + 0.5) * (1 << (a < 8 ? a : 8))) * n.errorRetryInterval;
357
+ !f(u) && a > u || setTimeout(r, d, o);
358
+ }, Ue = Ct, [fe, Pe] = We(/* @__PURE__ */ new Map()), $e = H(
359
359
  {
360
360
  // events
361
- onLoadingSlow: W,
362
- onSuccess: W,
363
- onError: W,
364
- onErrorRetry: Me,
365
- onDiscarded: W,
361
+ onLoadingSlow: P,
362
+ onSuccess: P,
363
+ onError: P,
364
+ onErrorRetry: Fe,
365
+ onDiscarded: P,
366
366
  // switches
367
367
  revalidateOnFocus: !0,
368
368
  revalidateOnReconnect: !0,
@@ -376,22 +376,22 @@ const Zt = (t, e) => {
376
376
  // providers
377
377
  compare: Ue,
378
378
  isPaused: () => !1,
379
- cache: le,
380
- mutate: We,
379
+ cache: fe,
380
+ mutate: Pe,
381
381
  fallback: {}
382
382
  },
383
383
  // use web preset by default
384
- be
385
- ), $e = (t, e) => {
386
- const n = $(t, e);
384
+ xe
385
+ ), qe = (t, e) => {
386
+ const n = H(t, e);
387
387
  if (e) {
388
- const { use: r, fallback: o } = t, { use: l, fallback: a } = e;
389
- r && l && (n.use = r.concat(l)), o && a && (n.fallback = $(o, a));
388
+ const { use: r, fallback: o } = t, { use: u, fallback: a } = e;
389
+ r && u && (n.use = r.concat(u)), o && a && (n.fallback = H(o, a));
390
390
  }
391
391
  return n;
392
- }, qe = ge({}), He = "$inf$", fe = ct && window.__SWR_DEVTOOLS_USE__, Ge = fe ? window.__SWR_DEVTOOLS_USE__ : [], ke = () => {
393
- fe && (window.__SWR_DEVTOOLS_REACT__ = at);
394
- }, Be = (t) => F(t[1]) ? [
392
+ }, He = ve({}), ke = "$inf$", de = ut && window.__SWR_DEVTOOLS_USE__, Ge = de ? window.__SWR_DEVTOOLS_USE__ : [], Be = () => {
393
+ de && (window.__SWR_DEVTOOLS_REACT__ = ct);
394
+ }, Je = (t) => M(t[1]) ? [
395
395
  t[0],
396
396
  t[1],
397
397
  t[2] || {}
@@ -400,32 +400,32 @@ const Zt = (t, e) => {
400
400
  null,
401
401
  (t[1] === null ? t[2] : t[1]) || {}
402
402
  ], Ke = () => {
403
- const t = Oe(qe);
404
- return re(() => $(Pe, t), [
403
+ const t = Oe(He);
404
+ return oe(() => H($e, t), [
405
405
  t
406
406
  ]);
407
- }, Je = (t) => (e, n, r) => t(e, n && ((...l) => {
408
- const [a] = Mt(e), [, , , d] = U.get(le);
409
- if (a.startsWith(He))
410
- return n(...l);
407
+ }, ze = (t) => (e, n, r) => t(e, n && ((...u) => {
408
+ const [a] = Ft(e), [, , , d] = U.get(fe);
409
+ if (a.startsWith(ke))
410
+ return n(...u);
411
411
  const m = d[a];
412
- return f(m) ? n(...l) : (delete d[a], m);
413
- }), r), ze = Ge.concat(Je), Ye = (t) => function(...n) {
414
- const r = Ke(), [o, l, a] = Be(n), d = $e(r, a);
412
+ return f(m) ? n(...u) : (delete d[a], m);
413
+ }), r), Ye = Ge.concat(ze), Xe = (t) => function(...n) {
414
+ const r = Ke(), [o, u, a] = Je(n), d = qe(r, a);
415
415
  let m = t;
416
- const { use: R } = d, S = (R || []).concat(ze);
417
- for (let i = S.length; i--; )
418
- m = S[i](m);
419
- return m(o, l || d.fetcher || null, d);
420
- }, Xe = (t, e, n) => {
416
+ const { use: R } = d, E = (R || []).concat(Ye);
417
+ for (let i = E.length; i--; )
418
+ m = E[i](m);
419
+ return m(o, u || d.fetcher || null, d);
420
+ }, Qe = (t, e, n) => {
421
421
  const r = e[t] || (e[t] = []);
422
422
  return r.push(n), () => {
423
423
  const o = r.indexOf(n);
424
424
  o >= 0 && (r[o] = r[r.length - 1], r.pop());
425
425
  };
426
426
  };
427
- ke();
428
- const Dt = at.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
427
+ Be();
428
+ const Dt = ct.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
429
429
  // and emitting an error.
430
430
  // We assume that this is only for the `use(thenable)` case, not `use(context)`.
431
431
  // https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
@@ -446,104 +446,104 @@ const Dt = at.use || // This extra generic is to avoid TypeScript mixing up the
446
446
  }
447
447
  }), Tt = {
448
448
  dedupe: !0
449
- }, te = Promise.resolve(C), Qe = () => W, Ze = (t, e, n) => {
450
- const { cache: r, compare: o, suspense: l, fallbackData: a, revalidateOnMount: d, revalidateIfStale: m, refreshInterval: R, refreshWhenHidden: S, refreshWhenOffline: i, keepPreviousData: p, strictServerPrefetchWarning: c } = n, [h, u, g, D] = U.get(r), [s, ut] = Mt(t), B = P(!1), T = P(!1), I = P(s), N = P(e), K = P(n), v = () => K.current, J = () => v().isVisible() && v().isOnline(), [V, z, q, b] = ce(r, s), Y = P({}).current, X = f(a) ? f(n.fallback) ? C : n.fallback[s] : a, Ut = (E, O) => {
451
- for (const w in Y) {
452
- const y = w;
453
- if (y === "data") {
454
- if (!o(E[y], O[y]) && (!f(E[y]) || !o(ft, O[y])))
449
+ }, te = Promise.resolve(L), Ze = () => P, tn = (t, e, n) => {
450
+ const { cache: r, compare: o, suspense: u, fallbackData: a, revalidateOnMount: d, revalidateIfStale: m, refreshInterval: R, refreshWhenHidden: E, refreshWhenOffline: i, keepPreviousData: l, strictServerPrefetchWarning: c } = n, [p, g, h, D] = U.get(r), [s, $] = Ft(t), K = q(!1), T = q(!1), I = q(s), N = q(e), z = q(n), v = () => z.current, Y = () => v().isVisible() && v().isOnline(), [V, X, k, A] = ue(r, s), Q = q({}).current, Z = f(a) ? f(n.fallback) ? L : n.fallback[s] : a, Ut = (S, y) => {
451
+ for (const O in Q) {
452
+ const w = O;
453
+ if (w === "data") {
454
+ if (!o(S[w], y[w]) && (!f(S[w]) || !o(ft, y[w])))
455
455
  return !1;
456
- } else if (O[y] !== E[y])
456
+ } else if (y[w] !== S[w])
457
457
  return !1;
458
458
  }
459
459
  return !0;
460
- }, ht = !B.current, Wt = re(() => {
461
- const E = V(), O = b(), w = (_) => {
462
- const x = $(_);
460
+ }, ht = !K.current, Pt = oe(() => {
461
+ const S = V(), y = A(), O = (_) => {
462
+ const x = H(_);
463
463
  return delete x._k, (() => {
464
464
  if (!s || !e || v().isPaused()) return !1;
465
465
  if (ht && !f(d)) return d;
466
- const ot = f(X) ? x.data : X;
467
- return f(ot) || m;
466
+ const it = f(Z) ? x.data : Z;
467
+ return f(it) || m;
468
468
  })() ? {
469
469
  isValidating: !0,
470
470
  isLoading: !0,
471
471
  ...x
472
472
  } : x;
473
- }, y = w(E), j = E === O ? y : w(O);
474
- let A = y;
473
+ }, w = O(S), j = S === y ? w : O(y);
474
+ let b = w;
475
475
  return [
476
476
  () => {
477
- const _ = w(V());
478
- return Ut(_, A) ? (A.data = _.data, A.isLoading = _.isLoading, A.isValidating = _.isValidating, A.error = _.error, A) : (A = _, _);
477
+ const _ = O(V());
478
+ return Ut(_, b) ? (b.data = _.data, b.isLoading = _.isLoading, b.isValidating = _.isValidating, b.error = _.error, b) : (b = _, _);
479
479
  },
480
480
  () => j
481
481
  ];
482
482
  }, [
483
483
  r,
484
484
  s
485
- ]), Q = Jt.useSyncExternalStore(gt(
486
- (E) => q(s, (O, w) => {
487
- Ut(w, O) || E();
485
+ ]), tt = Kt.useSyncExternalStore(Et(
486
+ (S) => k(s, (y, O) => {
487
+ Ut(O, y) || S();
488
488
  }),
489
489
  // eslint-disable-next-line react-hooks/exhaustive-deps
490
490
  [
491
491
  r,
492
492
  s
493
493
  ]
494
- ), Wt[0], Wt[1]), pe = h[s] && h[s].length > 0, Z = Q.data, H = f(Z) ? X && ae(X) ? Dt(X) : X : Z, lt = Q.error, mt = P(H), ft = p ? f(Z) ? f(mt.current) ? H : mt.current : Z : H, G = s && f(H), et = P(null);
495
- !tt && // getServerSnapshot is only called during hydration
494
+ ), Pt[0], Pt[1]), he = p[s] && p[s].length > 0, et = tt.data, G = f(et) ? Z && ce(Z) ? Dt(Z) : Z : et, lt = tt.error, gt = q(G), ft = l ? f(et) ? f(gt.current) ? G : gt.current : et : G, B = s && f(G), rt = q(null);
495
+ !nt && // getServerSnapshot is only called during hydration
496
496
  // eslint-disable-next-line react-hooks/rules-of-hooks
497
- Jt.useSyncExternalStore(Qe, () => (et.current = !1, et), () => (et.current = !0, et));
498
- const he = et.current;
499
- c && he && !l && G && console.warn(`Missing pre-initiated data for serialized key "${s}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);
500
- const Pt = !s || !e || v().isPaused() || pe && !f(lt) ? !1 : ht && !f(d) ? d : l ? f(H) ? !1 : m : f(H) || m, $t = ht && Pt, me = f(Q.isValidating) ? $t : Q.isValidating, Ee = f(Q.isLoading) ? $t : Q.isLoading, nt = gt(
501
- async (E) => {
502
- const O = N.current;
503
- if (!s || !O || T.current || v().isPaused())
497
+ Kt.useSyncExternalStore(Ze, () => (rt.current = !1, rt), () => (rt.current = !0, rt));
498
+ const ge = rt.current;
499
+ c && ge && !u && B && console.warn(`Missing pre-initiated data for serialized key "${s}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);
500
+ const $t = !s || !e || v().isPaused() || he && !f(lt) ? !1 : ht && !f(d) ? d : u ? f(G) ? !1 : m : f(G) || m, qt = ht && $t, me = f(tt.isValidating) ? qt : tt.isValidating, Se = f(tt.isLoading) ? qt : tt.isLoading, ot = Et(
501
+ async (S) => {
502
+ const y = N.current;
503
+ if (!s || !y || T.current || v().isPaused())
504
504
  return !1;
505
- let w, y, j = !0;
506
- const A = E || {}, _ = !g[s] || !A.dedupe, x = () => Xt ? !T.current && s === I.current && B.current : s === I.current, rt = {
505
+ let O, w, j = !0;
506
+ const b = S || {}, _ = !h[s] || !b.dedupe, x = () => Xt ? !T.current && s === I.current && K.current : s === I.current, st = {
507
507
  isValidating: !1,
508
508
  isLoading: !1
509
- }, ot = () => {
510
- z(rt);
511
- }, Ht = () => {
512
- const L = g[s];
513
- L && L[1] === y && delete g[s];
509
+ }, it = () => {
510
+ X(st);
511
+ }, kt = () => {
512
+ const C = h[s];
513
+ C && C[1] === w && delete h[s];
514
514
  }, Gt = {
515
515
  isValidating: !0
516
516
  };
517
517
  f(V().data) && (Gt.isLoading = !0);
518
518
  try {
519
- if (_ && (z(Gt), n.loadingTimeout && f(V().data) && setTimeout(() => {
519
+ if (_ && (X(Gt), n.loadingTimeout && f(V().data) && setTimeout(() => {
520
520
  j && x() && v().onLoadingSlow(s, n);
521
- }, n.loadingTimeout), g[s] = [
522
- O(ut),
523
- jt()
524
- ]), [w, y] = g[s], w = await w, _ && setTimeout(Ht, n.dedupingInterval), !g[s] || g[s][1] !== y)
521
+ }, n.loadingTimeout), h[s] = [
522
+ y($),
523
+ Mt()
524
+ ]), [O, w] = h[s], O = await O, _ && setTimeout(kt, n.dedupingInterval), !h[s] || h[s][1] !== w)
525
525
  return _ && x() && v().onDiscarded(s), !1;
526
- rt.error = C;
527
- const L = u[s];
528
- if (!f(L) && // case 1
529
- (y <= L[0] || // case 2
530
- y <= L[1] || // case 3
531
- L[1] === 0))
532
- return ot(), _ && x() && v().onDiscarded(s), !1;
533
- const M = V().data;
534
- rt.data = o(M, w) ? M : w, _ && x() && v().onSuccess(w, s, n);
535
- } catch (L) {
536
- Ht();
537
- const M = v(), { shouldRetryOnError: Et } = M;
538
- M.isPaused() || (rt.error = L, _ && x() && (M.onError(L, s, M), (Et === !0 || F(Et) && Et(L)) && (!v().revalidateOnFocus || !v().revalidateOnReconnect || J()) && M.onErrorRetry(L, s, M, (Se) => {
539
- const St = h[s];
540
- St && St[0] && St[0](zt, Se);
526
+ st.error = L;
527
+ const C = g[s];
528
+ if (!f(C) && // case 1
529
+ (w <= C[0] || // case 2
530
+ w <= C[1] || // case 3
531
+ C[1] === 0))
532
+ return it(), _ && x() && v().onDiscarded(s), !1;
533
+ const W = V().data;
534
+ st.data = o(W, O) ? W : O, _ && x() && v().onSuccess(O, s, n);
535
+ } catch (C) {
536
+ kt();
537
+ const W = v(), { shouldRetryOnError: mt } = W;
538
+ W.isPaused() || (st.error = C, _ && x() && (W.onError(C, s, W), (mt === !0 || M(mt) && mt(C)) && (!v().revalidateOnFocus || !v().revalidateOnReconnect || Y()) && W.onErrorRetry(C, s, W, (Ee) => {
539
+ const St = p[s];
540
+ St && St[0] && St[0](zt, Ee);
541
541
  }, {
542
- retryCount: (A.retryCount || 0) + 1,
542
+ retryCount: (b.retryCount || 0) + 1,
543
543
  dedupe: !0
544
544
  })));
545
545
  }
546
- return j = !1, ot(), !0;
546
+ return j = !1, it(), !0;
547
547
  },
548
548
  // `setState` is immutable, and `eventsCallback`, `fnArg`, and
549
549
  // `keyValidating` are depending on `key`, so we can exclude them from
@@ -560,82 +560,82 @@ const Dt = at.use || // This extra generic is to avoid TypeScript mixing up the
560
560
  s,
561
561
  r
562
562
  ]
563
- ), qt = gt(
563
+ ), Ht = Et(
564
564
  // Use callback to make sure `keyRef.current` returns latest result every time
565
- (...E) => ue(r, I.current, ...E),
565
+ (...S) => le(r, I.current, ...S),
566
566
  // eslint-disable-next-line react-hooks/exhaustive-deps
567
567
  []
568
568
  );
569
- if (yt(() => {
570
- N.current = e, K.current = n, f(Z) || (mt.current = Z);
571
- }), yt(() => {
569
+ if (wt(() => {
570
+ N.current = e, z.current = n, f(et) || (gt.current = et);
571
+ }), wt(() => {
572
572
  if (!s) return;
573
- const E = nt.bind(C, Tt);
574
- let O = 0;
575
- v().revalidateOnFocus && (O = Date.now() + v().focusThrottleInterval);
576
- const y = Xe(s, h, (j, A = {}) => {
577
- if (j == oe) {
573
+ const S = ot.bind(L, Tt);
574
+ let y = 0;
575
+ v().revalidateOnFocus && (y = Date.now() + v().focusThrottleInterval);
576
+ const w = Qe(s, p, (j, b = {}) => {
577
+ if (j == se) {
578
578
  const _ = Date.now();
579
- v().revalidateOnFocus && _ > O && J() && (O = _ + v().focusThrottleInterval, E());
580
- } else if (j == se)
581
- v().revalidateOnReconnect && J() && E();
579
+ v().revalidateOnFocus && _ > y && Y() && (y = _ + v().focusThrottleInterval, S());
580
+ } else if (j == ie)
581
+ v().revalidateOnReconnect && Y() && S();
582
582
  else {
583
- if (j == ie)
584
- return nt();
583
+ if (j == ae)
584
+ return ot();
585
585
  if (j == zt)
586
- return nt(A);
586
+ return ot(b);
587
587
  }
588
588
  });
589
- return T.current = !1, I.current = s, B.current = !0, z({
590
- _k: ut
591
- }), Pt && (g[s] || (f(H) || tt ? E() : Ie(E))), () => {
592
- T.current = !0, y();
589
+ return T.current = !1, I.current = s, K.current = !0, X({
590
+ _k: $
591
+ }), $t && (h[s] || (f(G) || nt ? S() : Ne(S))), () => {
592
+ T.current = !0, w();
593
593
  };
594
594
  }, [
595
595
  s
596
- ]), yt(() => {
597
- let E;
598
- function O() {
599
- const y = F(R) ? R(V().data) : R;
600
- y && E !== -1 && (E = setTimeout(w, y));
596
+ ]), wt(() => {
597
+ let S;
598
+ function y() {
599
+ const w = M(R) ? R(V().data) : R;
600
+ w && S !== -1 && (S = setTimeout(O, w));
601
601
  }
602
- function w() {
603
- !V().error && (S || v().isVisible()) && (i || v().isOnline()) ? nt(Tt).then(O) : O();
602
+ function O() {
603
+ !V().error && (E || v().isVisible()) && (i || v().isOnline()) ? ot(Tt).then(y) : y();
604
604
  }
605
- return O(), () => {
606
- E && (clearTimeout(E), E = -1);
605
+ return y(), () => {
606
+ S && (clearTimeout(S), S = -1);
607
607
  };
608
608
  }, [
609
609
  R,
610
- S,
610
+ E,
611
611
  i,
612
612
  s
613
- ]), we(ft), l) {
614
- if (!Xt && tt && G)
613
+ ]), we(ft), u) {
614
+ if (!Xt && nt && B)
615
615
  throw new Error("Fallback data is required when using Suspense in SSR.");
616
- G && (N.current = e, K.current = n, T.current = !1);
617
- const E = D[s], O = !f(E) && G ? qt(E) : te;
618
- if (Dt(O), !f(lt) && G)
616
+ B && (N.current = e, z.current = n, T.current = !1);
617
+ const S = D[s], y = !f(S) && B ? Ht(S) : te;
618
+ if (Dt(y), !f(lt) && B)
619
619
  throw lt;
620
- const w = G ? nt(Tt) : te;
621
- !f(ft) && G && (w.status = "fulfilled", w.value = !0), Dt(w);
620
+ const O = B ? ot(Tt) : te;
621
+ !f(ft) && B && (O.status = "fulfilled", O.value = !0), Dt(O);
622
622
  }
623
623
  return {
624
- mutate: qt,
624
+ mutate: Ht,
625
625
  get data() {
626
- return Y.data = !0, ft;
626
+ return Q.data = !0, ft;
627
627
  },
628
628
  get error() {
629
- return Y.error = !0, lt;
629
+ return Q.error = !0, lt;
630
630
  },
631
631
  get isValidating() {
632
- return Y.isValidating = !0, me;
632
+ return Q.isValidating = !0, me;
633
633
  },
634
634
  get isLoading() {
635
- return Y.isLoading = !0, Ee;
635
+ return Q.isLoading = !0, Se;
636
636
  }
637
637
  };
638
- }, ee = Ye(Ze), tn = (t, e) => {
638
+ }, ee = Xe(tn), en = (t, e) => {
639
639
  let n = t;
640
640
  return {
641
641
  apply(r) {
@@ -646,26 +646,26 @@ const Dt = at.use || // This extra generic is to avoid TypeScript mixing up the
646
646
  }
647
647
  };
648
648
  };
649
- function de() {
649
+ function pe() {
650
650
  return window.document.location.host.indexOf("localhost") === 0 ? "http://localhost:3100" : "https://api.graffiticode.org";
651
651
  }
652
- const en = async ({
652
+ const nn = async ({
653
653
  accessToken: t,
654
654
  id: e
655
655
  }) => {
656
- const n = await fetch(`${de()}/data?id=${e}`, {
656
+ const n = await fetch(`${pe()}/data?id=${e}`, {
657
657
  headers: { Authorization: t || "" }
658
- }), { status: r, error: o, data: l } = await n.json();
658
+ }), { status: r, error: o, data: u } = await n.json();
659
659
  if (r !== "success")
660
660
  throw new Error(`failed to get data ${e}: ${o == null ? void 0 : o.message}`);
661
- return l;
662
- }, nn = async ({
661
+ return u;
662
+ }, rn = async ({
663
663
  accessToken: t,
664
664
  id: e,
665
665
  data: n
666
666
  }) => {
667
- var l;
668
- const o = await (await fetch(`${de()}/compile`, {
667
+ var u;
668
+ const o = await (await fetch(`${pe()}/compile`, {
669
669
  method: "POST",
670
670
  headers: {
671
671
  "Content-Type": "application/json",
@@ -675,79 +675,103 @@ const en = async ({
675
675
  body: JSON.stringify({ id: e, data: n })
676
676
  })).json();
677
677
  if (o.status !== "success")
678
- throw new Error(`failed to post compile ${e}: ${(l = o.error) == null ? void 0 : l.message}`);
678
+ throw new Error(`failed to post compile ${e}: ${(u = o.error) == null ? void 0 : u.message}`);
679
679
  return o.data;
680
- }, rn = async ({
680
+ }, on = async ({
681
681
  accessToken: t,
682
682
  id: e,
683
683
  data: n
684
684
  }) => {
685
685
  const r = Object.keys(n).length > 0 ? 1 : 2;
686
- return e = e.split("+").slice(0, r).join("+"), await nn({ accessToken: t, id: e, data: n });
687
- }, on = async ({
686
+ return e = e.split("+").slice(0, r).join("+"), await rn({ accessToken: t, id: e, data: n });
687
+ }, sn = async ({
688
688
  accessToken: t,
689
689
  id: e
690
- }) => await en({ accessToken: t, id: e });
690
+ }) => await nn({ accessToken: t, id: e });
691
691
  function ne(t) {
692
692
  return t && typeof t == "object" && Array.isArray(t.errors) ? { data: t.data ?? null, errors: t.errors } : { data: t, errors: [] };
693
693
  }
694
- function sn(t, e) {
694
+ function an(t, e) {
695
695
  return e.length > 0 ? !0 : !(t == null || typeof t == "object" && !Array.isArray(t) && Object.keys(t).length === 0);
696
696
  }
697
- const fn = ({ Form: t }) => {
698
- const e = new URLSearchParams(window.location.search), [n] = k(e.get("id") ?? void 0), [r] = k(e.get("access_token") ?? void 0), [o] = k(e.get("origin") ?? void 0), [l, a] = k(!1), [d, m] = k(!1), [R, S] = k([]), [i] = k(
699
- () => tn({}, (u, { type: g, args: D }) => {
700
- switch (g) {
697
+ const pn = ({ Form: t }) => {
698
+ var g;
699
+ const e = new URLSearchParams(window.location.search), [n] = J(e.get("id") ?? void 0), [r] = J(e.get("access_token") ?? void 0), [o] = J(e.get("origin") ?? void 0), [u, a] = J(!1), [d, m] = J(!1), [R, E] = J([]), [i] = J(
700
+ () => en({}, (h, { type: D, args: s }) => {
701
+ switch (console.log(
702
+ "L0000 View()",
703
+ "type=" + D,
704
+ "args=" + JSON.stringify(s, null, 2)
705
+ ), D) {
701
706
  case "init":
702
- return D;
707
+ return s;
703
708
  case "compiled":
704
- return D;
709
+ return s;
705
710
  case "update": {
706
- const s = { ...u, ...D };
707
- return JSON.stringify(s) !== JSON.stringify(u) && (m(!0), o && window.parent.postMessage({ focus: { type: "update", value: s } }, o)), s;
711
+ const $ = { ...h, ...s };
712
+ return JSON.stringify($) !== JSON.stringify(h) && (m(!0), o && window.parent.postMessage({ focus: { type: "update", value: $ } }, o)), $;
708
713
  }
709
714
  default:
710
- return console.error(`Unimplemented action type: ${g}`), u;
715
+ return console.error(`Unimplemented action type: ${D}`), h;
711
716
  }
712
717
  })
713
718
  );
714
- st(() => {
715
- const u = e.get("data");
716
- u && i.apply({ type: "init", args: JSON.parse(u) });
717
- }, []), st(() => {
719
+ at(() => {
720
+ const h = e.get("data");
721
+ h && i.apply({ type: "init", args: JSON.parse(h) });
722
+ }, []), at(() => {
718
723
  o && window.parent.postMessage({ type: "onload", data: i.data }, o);
719
- }, []), st(() => {
724
+ }, []), at(() => {
720
725
  n && a(!0);
721
- }, [n]), st(() => {
726
+ }, [n]), at(() => {
722
727
  o && window.parent.postMessage({ type: "data-updated", data: i.data }, o);
723
728
  }, [JSON.stringify(i.data)]);
724
- const p = ee(
725
- l && r && n ? { accessToken: r, id: n } : null,
726
- on
729
+ const l = ee(
730
+ u && n ? { accessToken: r, id: n } : null,
731
+ sn
727
732
  );
728
- if (p.data !== void 0) {
729
- const u = ne(p.data);
730
- i.apply({ type: "compiled", args: u.data }), S(u.errors), a(!1);
733
+ if (l.data !== void 0) {
734
+ const h = ne(l.data);
735
+ i.apply({ type: "compiled", args: h.data }), E(h.errors), a(!1);
731
736
  }
732
737
  const c = ee(
733
- d && r && n ? { accessToken: r, id: n, data: i.data } : null,
734
- rn
738
+ d && n ? { accessToken: r, id: n, data: i.data } : null,
739
+ on
735
740
  );
736
741
  if (c.data !== void 0) {
737
- const u = ne(c.data);
738
- i.apply({ type: "compiled", args: u.data }), S(u.errors), m(!1);
742
+ const h = ne(c.data);
743
+ i.apply({ type: "compiled", args: h.data }), E(h.errors), m(!1);
739
744
  }
740
- const h = { data: i.data, errors: R, apply: i.apply };
741
- return sn(i.data, R) ? /* @__PURE__ */ it(t, { state: h }) : /* @__PURE__ */ it("div", {});
745
+ const p = { data: i.data, errors: R, apply: i.apply };
746
+ return an(i.data, R) ? /* @__PURE__ */ F(t, { state: p }) : l.error ? /* @__PURE__ */ Lt("div", { role: "alert", style: re, children: [
747
+ /* @__PURE__ */ F("p", { style: { margin: 0, fontWeight: 600 }, children: "Couldn’t load this form." }),
748
+ /* @__PURE__ */ F("p", { style: { margin: "4px 0 12px", color: "#555" }, children: String(((g = l.error) == null ? void 0 : g.message) ?? l.error) }),
749
+ /* @__PURE__ */ F("button", { type: "button", style: cn, onClick: () => l.mutate(), children: "Retry" })
750
+ ] }) : l.isLoading ? /* @__PURE__ */ F("div", { role: "status", "aria-live": "polite", style: re, children: "Loading…" }) : /* @__PURE__ */ F("div", {});
751
+ }, re = {
752
+ display: "flex",
753
+ flexDirection: "column",
754
+ alignItems: "center",
755
+ justifyContent: "center",
756
+ height: "100%",
757
+ padding: "24px",
758
+ textAlign: "center",
759
+ font: "14px/1.4 system-ui, sans-serif"
760
+ }, cn = {
761
+ padding: "6px 14px",
762
+ border: "1px solid #888",
763
+ borderRadius: "4px",
764
+ background: "#fff",
765
+ cursor: "pointer"
742
766
  };
743
- function an({ errors: t }) {
744
- return /* @__PURE__ */ it("div", { className: "flex flex-col gap-2 font-mono text-xs", children: t.map((e, n) => /* @__PURE__ */ kt(
767
+ function un({ errors: t }) {
768
+ return /* @__PURE__ */ F("div", { className: "flex flex-col gap-2 font-mono text-xs", children: t.map((e, n) => /* @__PURE__ */ Lt(
745
769
  "div",
746
770
  {
747
771
  className: "rounded-md border border-red-200 bg-red-50 p-3 text-red-800",
748
772
  children: [
749
773
  e.message,
750
- typeof e.from == "number" && e.from >= 0 && /* @__PURE__ */ kt("span", { className: "ml-2 text-red-400", children: [
774
+ typeof e.from == "number" && e.from >= 0 && /* @__PURE__ */ Lt("span", { className: "ml-2 text-red-400", children: [
751
775
  "[",
752
776
  e.from,
753
777
  typeof e.to == "number" && e.to >= 0 ? `–${e.to}` : "",
@@ -758,15 +782,15 @@ function an({ errors: t }) {
758
782
  n
759
783
  )) });
760
784
  }
761
- const dn = ({ state: t }) => {
785
+ const hn = ({ state: t }) => {
762
786
  const e = t.errors ?? [];
763
787
  if (e.length > 0)
764
- return /* @__PURE__ */ it(an, { errors: e });
788
+ return /* @__PURE__ */ F(un, { errors: e });
765
789
  const n = t.data;
766
- return /* @__PURE__ */ it("pre", { className: "rounded-md bg-zinc-50 text-zinc-900 text-xs font-mono p-4 overflow-auto", children: JSON.stringify(n, null, 2) });
790
+ return /* @__PURE__ */ F("pre", { className: "rounded-md bg-zinc-50 text-zinc-900 text-xs font-mono p-4 overflow-auto", children: JSON.stringify(n, null, 2) });
767
791
  };
768
792
  export {
769
- dn as Form,
770
- fn as View
793
+ hn as Form,
794
+ pn as View
771
795
  };
772
796
  //# sourceMappingURL=index.js.map