@figma-vars/hooks 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import fe, { createContext as it, useContext as ct, useEffect as ht, useLayoutEffect as St, useRef as se, useMemo as bt, useCallback as ae, useDebugValue as Ot, useState as M } from "react";
2
- var Se = { exports: {} }, pe = {};
1
+ import ce, { createContext as rt, useContext as ot, useEffect as ht, useLayoutEffect as _t, useRef as oe, useMemo as Re, useCallback as ge, useDebugValue as St } from "react";
2
+ var he = { exports: {} }, de = {};
3
3
  /**
4
4
  * @license React
5
5
  * react-jsx-runtime.production.js
@@ -9,29 +9,29 @@ var Se = { exports: {} }, pe = {};
9
9
  * This source code is licensed under the MIT license found in the
10
10
  * LICENSE file in the root directory of this source tree.
11
11
  */
12
- var ze;
13
- function Rt() {
14
- if (ze) return pe;
15
- ze = 1;
16
- var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
17
- function t(n, o, a) {
18
- var i = null;
19
- if (a !== void 0 && (i = "" + a), o.key !== void 0 && (i = "" + o.key), "key" in o) {
12
+ var He;
13
+ function Ot() {
14
+ if (He) return de;
15
+ He = 1;
16
+ var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
17
+ function n(o, s, a) {
18
+ var u = null;
19
+ if (a !== void 0 && (u = "" + a), s.key !== void 0 && (u = "" + s.key), "key" in s) {
20
20
  a = {};
21
- for (var f in o)
22
- f !== "key" && (a[f] = o[f]);
23
- } else a = o;
24
- return o = a.ref, {
21
+ for (var p in s)
22
+ p !== "key" && (a[p] = s[p]);
23
+ } else a = s;
24
+ return s = a.ref, {
25
25
  $$typeof: e,
26
- type: n,
27
- key: i,
28
- ref: o !== void 0 ? o : null,
26
+ type: o,
27
+ key: u,
28
+ ref: s !== void 0 ? s : null,
29
29
  props: a
30
30
  };
31
31
  }
32
- return pe.Fragment = r, pe.jsx = t, pe.jsxs = t, pe;
32
+ return de.Fragment = t, de.jsx = n, de.jsxs = n, de;
33
33
  }
34
- var ve = {};
34
+ var me = {};
35
35
  /**
36
36
  * @license React
37
37
  * react-jsx-runtime.development.js
@@ -41,166 +41,166 @@ var ve = {};
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
43
  */
44
- var Xe;
45
- function Tt() {
46
- return Xe || (Xe = 1, process.env.NODE_ENV !== "production" && function() {
47
- function e(s) {
48
- if (s == null) return null;
49
- if (typeof s == "function")
50
- return s.$$typeof === V ? null : s.displayName || s.name || null;
51
- if (typeof s == "string") return s;
52
- switch (s) {
53
- case m:
44
+ var Be;
45
+ function Rt() {
46
+ return Be || (Be = 1, process.env.NODE_ENV !== "production" && function() {
47
+ function e(r) {
48
+ if (r == null) return null;
49
+ if (typeof r == "function")
50
+ return r.$$typeof === N ? null : r.displayName || r.name || null;
51
+ if (typeof r == "string") return r;
52
+ switch (r) {
53
+ case d:
54
54
  return "Fragment";
55
- case c:
55
+ case i:
56
56
  return "Profiler";
57
- case k:
57
+ case I:
58
58
  return "StrictMode";
59
- case y:
59
+ case b:
60
60
  return "Suspense";
61
- case I:
61
+ case j:
62
62
  return "SuspenseList";
63
- case Q:
63
+ case Z:
64
64
  return "Activity";
65
65
  }
66
- if (typeof s == "object")
67
- switch (typeof s.tag == "number" && console.error(
66
+ if (typeof r == "object")
67
+ switch (typeof r.tag == "number" && console.error(
68
68
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
- ), s.$$typeof) {
70
- case h:
69
+ ), r.$$typeof) {
70
+ case v:
71
71
  return "Portal";
72
72
  case ne:
73
- return (s.displayName || "Context") + ".Provider";
74
- case W:
75
- return (s._context.displayName || "Context") + ".Consumer";
76
- case $:
77
- var l = s.render;
78
- return s = s.displayName, s || (s = l.displayName || l.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
79
- case Z:
80
- return l = s.displayName || null, l !== null ? l : e(s.type) || "Memo";
73
+ return (r.displayName || "Context") + ".Provider";
74
+ case q:
75
+ return (r._context.displayName || "Context") + ".Consumer";
76
+ case U:
77
+ var l = r.render;
78
+ return r = r.displayName, r || (r = l.displayName || l.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
79
+ case z:
80
+ return l = r.displayName || null, l !== null ? l : e(r.type) || "Memo";
81
81
  case O:
82
- l = s._payload, s = s._init;
82
+ l = r._payload, r = r._init;
83
83
  try {
84
- return e(s(l));
84
+ return e(r(l));
85
85
  } catch {
86
86
  }
87
87
  }
88
88
  return null;
89
89
  }
90
- function r(s) {
91
- return "" + s;
90
+ function t(r) {
91
+ return "" + r;
92
92
  }
93
- function t(s) {
93
+ function n(r) {
94
94
  try {
95
- r(s);
95
+ t(r);
96
96
  var l = !1;
97
97
  } catch {
98
98
  l = !0;
99
99
  }
100
100
  if (l) {
101
101
  l = console;
102
- var S = l.error, T = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
103
- return S.call(
102
+ var h = l.error, T = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
103
+ return h.call(
104
104
  l,
105
105
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
106
106
  T
107
- ), r(s);
107
+ ), t(r);
108
108
  }
109
109
  }
110
- function n(s) {
111
- if (s === m) return "<>";
112
- if (typeof s == "object" && s !== null && s.$$typeof === O)
110
+ function o(r) {
111
+ if (r === d) return "<>";
112
+ if (typeof r == "object" && r !== null && r.$$typeof === O)
113
113
  return "<...>";
114
114
  try {
115
- var l = e(s);
115
+ var l = e(r);
116
116
  return l ? "<" + l + ">" : "<...>";
117
117
  } catch {
118
118
  return "<...>";
119
119
  }
120
120
  }
121
- function o() {
122
- var s = q.A;
123
- return s === null ? null : s.getOwner();
121
+ function s() {
122
+ var r = W.A;
123
+ return r === null ? null : r.getOwner();
124
124
  }
125
125
  function a() {
126
126
  return Error("react-stack-top-frame");
127
127
  }
128
- function i(s) {
129
- if (G.call(s, "key")) {
130
- var l = Object.getOwnPropertyDescriptor(s, "key").get;
128
+ function u(r) {
129
+ if ($.call(r, "key")) {
130
+ var l = Object.getOwnPropertyDescriptor(r, "key").get;
131
131
  if (l && l.isReactWarning) return !1;
132
132
  }
133
- return s.key !== void 0;
133
+ return r.key !== void 0;
134
134
  }
135
- function f(s, l) {
136
- function S() {
137
- oe || (oe = !0, console.error(
135
+ function p(r, l) {
136
+ function h() {
137
+ re || (re = !0, console.error(
138
138
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
139
139
  l
140
140
  ));
141
141
  }
142
- S.isReactWarning = !0, Object.defineProperty(s, "key", {
143
- get: S,
142
+ h.isReactWarning = !0, Object.defineProperty(r, "key", {
143
+ get: h,
144
144
  configurable: !0
145
145
  });
146
146
  }
147
- function E() {
148
- var s = e(this.type);
149
- return de[s] || (de[s] = !0, console.error(
147
+ function _() {
148
+ var r = e(this.type);
149
+ return ue[r] || (ue[r] = !0, console.error(
150
150
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
151
- )), s = this.props.ref, s !== void 0 ? s : null;
151
+ )), r = this.props.ref, r !== void 0 ? r : null;
152
152
  }
153
- function g(s, l, S, T, F, L, ce, ue) {
154
- return S = L.ref, s = {
155
- $$typeof: u,
156
- type: s,
153
+ function A(r, l, h, T, F, x, se, ae) {
154
+ return h = x.ref, r = {
155
+ $$typeof: c,
156
+ type: r,
157
157
  key: l,
158
- props: L,
158
+ props: x,
159
159
  _owner: F
160
- }, (S !== void 0 ? S : null) !== null ? Object.defineProperty(s, "ref", {
160
+ }, (h !== void 0 ? h : null) !== null ? Object.defineProperty(r, "ref", {
161
161
  enumerable: !1,
162
- get: E
163
- }) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
162
+ get: _
163
+ }) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
164
164
  configurable: !1,
165
165
  enumerable: !1,
166
166
  writable: !0,
167
167
  value: 0
168
- }), Object.defineProperty(s, "_debugInfo", {
168
+ }), Object.defineProperty(r, "_debugInfo", {
169
169
  configurable: !1,
170
170
  enumerable: !1,
171
171
  writable: !0,
172
172
  value: null
173
- }), Object.defineProperty(s, "_debugStack", {
173
+ }), Object.defineProperty(r, "_debugStack", {
174
174
  configurable: !1,
175
175
  enumerable: !1,
176
176
  writable: !0,
177
- value: ce
178
- }), Object.defineProperty(s, "_debugTask", {
177
+ value: se
178
+ }), Object.defineProperty(r, "_debugTask", {
179
179
  configurable: !1,
180
180
  enumerable: !1,
181
181
  writable: !0,
182
- value: ue
183
- }), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
182
+ value: ae
183
+ }), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
184
184
  }
185
- function v(s, l, S, T, F, L, ce, ue) {
186
- var A = l.children;
187
- if (A !== void 0)
185
+ function w(r, l, h, T, F, x, se, ae) {
186
+ var y = l.children;
187
+ if (y !== void 0)
188
188
  if (T)
189
- if (P(A)) {
190
- for (T = 0; T < A.length; T++)
191
- d(A[T]);
192
- Object.freeze && Object.freeze(A);
189
+ if (k(y)) {
190
+ for (T = 0; T < y.length; T++)
191
+ f(y[T]);
192
+ Object.freeze && Object.freeze(y);
193
193
  } else
194
194
  console.error(
195
195
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
196
196
  );
197
- else d(A);
198
- if (G.call(l, "key")) {
199
- A = e(s);
200
- var ee = Object.keys(l).filter(function(he) {
201
- return he !== "key";
197
+ else f(y);
198
+ if ($.call(l, "key")) {
199
+ y = e(r);
200
+ var Q = Object.keys(l).filter(function(ve) {
201
+ return ve !== "key";
202
202
  });
203
- T = 0 < ee.length ? "{key: someKey, " + ee.join(": ..., ") + ": ...}" : "{key: someKey}", Ee[A + T] || (ee = 0 < ee.length ? "{" + ee.join(": ..., ") + ": ...}" : "{}", console.error(
203
+ T = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", fe[y + T] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
204
204
  `A props object containing a "key" prop is being spread into JSX:
205
205
  let props = %s;
206
206
  <%s {...props} />
@@ -208,94 +208,95 @@ React keys must be passed directly to JSX without using spread:
208
208
  let props = %s;
209
209
  <%s key={someKey} {...props} />`,
210
210
  T,
211
- A,
212
- ee,
213
- A
214
- ), Ee[A + T] = !0);
211
+ y,
212
+ Q,
213
+ y
214
+ ), fe[y + T] = !0);
215
215
  }
216
- if (A = null, S !== void 0 && (t(S), A = "" + S), i(l) && (t(l.key), A = "" + l.key), "key" in l) {
217
- S = {};
218
- for (var J in l)
219
- J !== "key" && (S[J] = l[J]);
220
- } else S = l;
221
- return A && f(
222
- S,
223
- typeof s == "function" ? s.displayName || s.name || "Unknown" : s
224
- ), g(
225
- s,
226
- A,
227
- L,
216
+ if (y = null, h !== void 0 && (n(h), y = "" + h), u(l) && (n(l.key), y = "" + l.key), "key" in l) {
217
+ h = {};
218
+ for (var B in l)
219
+ B !== "key" && (h[B] = l[B]);
220
+ } else h = l;
221
+ return y && p(
222
+ h,
223
+ typeof r == "function" ? r.displayName || r.name || "Unknown" : r
224
+ ), A(
225
+ r,
226
+ y,
227
+ x,
228
228
  F,
229
- o(),
230
- S,
231
- ce,
232
- ue
229
+ s(),
230
+ h,
231
+ se,
232
+ ae
233
233
  );
234
234
  }
235
- function d(s) {
236
- typeof s == "object" && s !== null && s.$$typeof === u && s._store && (s._store.validated = 1);
235
+ function f(r) {
236
+ typeof r == "object" && r !== null && r.$$typeof === c && r._store && (r._store.validated = 1);
237
237
  }
238
- var p = fe, u = Symbol.for("react.transitional.element"), h = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), k = Symbol.for("react.strict_mode"), c = Symbol.for("react.profiler"), W = Symbol.for("react.consumer"), ne = Symbol.for("react.context"), $ = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), I = Symbol.for("react.suspense_list"), Z = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), Q = Symbol.for("react.activity"), V = Symbol.for("react.client.reference"), q = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, G = Object.prototype.hasOwnProperty, P = Array.isArray, Y = console.createTask ? console.createTask : function() {
238
+ var m = ce, c = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), I = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), q = Symbol.for("react.consumer"), ne = Symbol.for("react.context"), U = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), j = Symbol.for("react.suspense_list"), z = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), Z = Symbol.for("react.activity"), N = Symbol.for("react.client.reference"), W = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, $ = Object.prototype.hasOwnProperty, k = Array.isArray, Y = console.createTask ? console.createTask : function() {
239
239
  return null;
240
240
  };
241
- p = {
242
- "react-stack-bottom-frame": function(s) {
243
- return s();
241
+ m = {
242
+ "react-stack-bottom-frame": function(r) {
243
+ return r();
244
244
  }
245
245
  };
246
- var oe, de = {}, me = p["react-stack-bottom-frame"].bind(
247
- p,
246
+ var re, ue = {}, le = m["react-stack-bottom-frame"].bind(
247
+ m,
248
248
  a
249
- )(), H = Y(n(a)), Ee = {};
250
- ve.Fragment = m, ve.jsx = function(s, l, S, T, F) {
251
- var L = 1e4 > q.recentlyCreatedOwnerStacks++;
252
- return v(
253
- s,
249
+ )(), H = Y(o(a)), fe = {};
250
+ me.Fragment = d, me.jsx = function(r, l, h, T, F) {
251
+ var x = 1e4 > W.recentlyCreatedOwnerStacks++;
252
+ return w(
253
+ r,
254
254
  l,
255
- S,
255
+ h,
256
256
  !1,
257
257
  T,
258
258
  F,
259
- L ? Error("react-stack-top-frame") : me,
260
- L ? Y(n(s)) : H
259
+ x ? Error("react-stack-top-frame") : le,
260
+ x ? Y(o(r)) : H
261
261
  );
262
- }, ve.jsxs = function(s, l, S, T, F) {
263
- var L = 1e4 > q.recentlyCreatedOwnerStacks++;
264
- return v(
265
- s,
262
+ }, me.jsxs = function(r, l, h, T, F) {
263
+ var x = 1e4 > W.recentlyCreatedOwnerStacks++;
264
+ return w(
265
+ r,
266
266
  l,
267
- S,
267
+ h,
268
268
  !0,
269
269
  T,
270
270
  F,
271
- L ? Error("react-stack-top-frame") : me,
272
- L ? Y(n(s)) : H
271
+ x ? Error("react-stack-top-frame") : le,
272
+ x ? Y(o(r)) : H
273
273
  );
274
274
  };
275
- }()), ve;
275
+ }()), me;
276
276
  }
277
- var Ze;
277
+ var Je;
278
278
  function wt() {
279
- return Ze || (Ze = 1, process.env.NODE_ENV === "production" ? Se.exports = Rt() : Se.exports = Tt()), Se.exports;
279
+ return Je || (Je = 1, process.env.NODE_ENV === "production" ? he.exports = Ot() : he.exports = Rt()), he.exports;
280
280
  }
281
- var yt = wt();
282
- const ut = it(
281
+ var Tt = wt();
282
+ const st = rt(
283
283
  void 0
284
- ), Er = ({
284
+ ), an = ({
285
285
  children: e,
286
- token: r
287
- }) => /* @__PURE__ */ yt.jsx(ut.Provider, { value: { token: r }, children: e }), At = () => {
288
- const e = ct(ut);
286
+ token: t,
287
+ fileKey: n
288
+ }) => /* @__PURE__ */ Tt.jsx(st.Provider, { value: { token: t, fileKey: n }, children: e }), at = () => {
289
+ const e = ot(st);
289
290
  if (e === void 0)
290
291
  throw new Error(
291
292
  "useFigmaTokenContext must be used within a FigmaVarsProvider"
292
293
  );
293
294
  return e;
294
- }, ie = () => {
295
- const { token: e } = At();
295
+ }, cn = () => {
296
+ const { token: e } = at();
296
297
  return e;
297
298
  };
298
- var be = { exports: {} }, ye = {};
299
+ var _e = { exports: {} }, be = {};
299
300
  /**
300
301
  * @license React
301
302
  * use-sync-external-store-shim.production.js
@@ -305,48 +306,48 @@ var be = { exports: {} }, ye = {};
305
306
  * This source code is licensed under the MIT license found in the
306
307
  * LICENSE file in the root directory of this source tree.
307
308
  */
308
- var Qe;
309
- function Dt() {
310
- if (Qe) return ye;
311
- Qe = 1;
312
- var e = fe;
313
- function r(d, p) {
314
- return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
309
+ var Ke;
310
+ function gt() {
311
+ if (Ke) return be;
312
+ Ke = 1;
313
+ var e = ce;
314
+ function t(f, m) {
315
+ return f === m && (f !== 0 || 1 / f === 1 / m) || f !== f && m !== m;
315
316
  }
316
- var t = typeof Object.is == "function" ? Object.is : r, n = e.useState, o = e.useEffect, a = e.useLayoutEffect, i = e.useDebugValue;
317
- function f(d, p) {
318
- var u = p(), h = n({ inst: { value: u, getSnapshot: p } }), m = h[0].inst, k = h[1];
317
+ var n = typeof Object.is == "function" ? Object.is : t, o = e.useState, s = e.useEffect, a = e.useLayoutEffect, u = e.useDebugValue;
318
+ function p(f, m) {
319
+ var c = m(), v = o({ inst: { value: c, getSnapshot: m } }), d = v[0].inst, I = v[1];
319
320
  return a(
320
321
  function() {
321
- m.value = u, m.getSnapshot = p, E(m) && k({ inst: m });
322
+ d.value = c, d.getSnapshot = m, _(d) && I({ inst: d });
322
323
  },
323
- [d, u, p]
324
- ), o(
324
+ [f, c, m]
325
+ ), s(
325
326
  function() {
326
- return E(m) && k({ inst: m }), d(function() {
327
- E(m) && k({ inst: m });
327
+ return _(d) && I({ inst: d }), f(function() {
328
+ _(d) && I({ inst: d });
328
329
  });
329
330
  },
330
- [d]
331
- ), i(u), u;
331
+ [f]
332
+ ), u(c), c;
332
333
  }
333
- function E(d) {
334
- var p = d.getSnapshot;
335
- d = d.value;
334
+ function _(f) {
335
+ var m = f.getSnapshot;
336
+ f = f.value;
336
337
  try {
337
- var u = p();
338
- return !t(d, u);
338
+ var c = m();
339
+ return !n(f, c);
339
340
  } catch {
340
341
  return !0;
341
342
  }
342
343
  }
343
- function g(d, p) {
344
- return p();
344
+ function A(f, m) {
345
+ return m();
345
346
  }
346
- var v = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? g : f;
347
- return ye.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : v, ye;
347
+ var w = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? A : p;
348
+ return be.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : w, be;
348
349
  }
349
- var Ae = {};
350
+ var ye = {};
350
351
  /**
351
352
  * @license React
352
353
  * use-sync-external-store-shim.development.js
@@ -356,293 +357,293 @@ var Ae = {};
356
357
  * This source code is licensed under the MIT license found in the
357
358
  * LICENSE file in the root directory of this source tree.
358
359
  */
359
- var et;
360
- function Ct() {
361
- return et || (et = 1, process.env.NODE_ENV !== "production" && function() {
362
- function e(u, h) {
363
- return u === h && (u !== 0 || 1 / u === 1 / h) || u !== u && h !== h;
360
+ var Xe;
361
+ function bt() {
362
+ return Xe || (Xe = 1, process.env.NODE_ENV !== "production" && function() {
363
+ function e(c, v) {
364
+ return c === v && (c !== 0 || 1 / c === 1 / v) || c !== c && v !== v;
364
365
  }
365
- function r(u, h) {
366
- v || o.startTransition === void 0 || (v = !0, console.error(
366
+ function t(c, v) {
367
+ w || s.startTransition === void 0 || (w = !0, console.error(
367
368
  "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."
368
369
  ));
369
- var m = h();
370
- if (!d) {
371
- var k = h();
372
- a(m, k) || (console.error(
370
+ var d = v();
371
+ if (!f) {
372
+ var I = v();
373
+ a(d, I) || (console.error(
373
374
  "The result of getSnapshot should be cached to avoid an infinite loop"
374
- ), d = !0);
375
+ ), f = !0);
375
376
  }
376
- k = i({
377
- inst: { value: m, getSnapshot: h }
377
+ I = u({
378
+ inst: { value: d, getSnapshot: v }
378
379
  });
379
- var c = k[0].inst, W = k[1];
380
- return E(
380
+ var i = I[0].inst, q = I[1];
381
+ return _(
381
382
  function() {
382
- c.value = m, c.getSnapshot = h, t(c) && W({ inst: c });
383
+ i.value = d, i.getSnapshot = v, n(i) && q({ inst: i });
383
384
  },
384
- [u, m, h]
385
- ), f(
385
+ [c, d, v]
386
+ ), p(
386
387
  function() {
387
- return t(c) && W({ inst: c }), u(function() {
388
- t(c) && W({ inst: c });
388
+ return n(i) && q({ inst: i }), c(function() {
389
+ n(i) && q({ inst: i });
389
390
  });
390
391
  },
391
- [u]
392
- ), g(m), m;
392
+ [c]
393
+ ), A(d), d;
393
394
  }
394
- function t(u) {
395
- var h = u.getSnapshot;
396
- u = u.value;
395
+ function n(c) {
396
+ var v = c.getSnapshot;
397
+ c = c.value;
397
398
  try {
398
- var m = h();
399
- return !a(u, m);
399
+ var d = v();
400
+ return !a(c, d);
400
401
  } catch {
401
402
  return !0;
402
403
  }
403
404
  }
404
- function n(u, h) {
405
- return h();
405
+ function o(c, v) {
406
+ return v();
406
407
  }
407
408
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
408
- var o = fe, a = typeof Object.is == "function" ? Object.is : e, i = o.useState, f = o.useEffect, E = o.useLayoutEffect, g = o.useDebugValue, v = !1, d = !1, p = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? n : r;
409
- Ae.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());
410
- }()), Ae;
409
+ var s = ce, a = typeof Object.is == "function" ? Object.is : e, u = s.useState, p = s.useEffect, _ = s.useLayoutEffect, A = s.useDebugValue, w = !1, f = !1, m = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? o : t;
410
+ ye.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : m, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
411
+ }()), ye;
411
412
  }
412
- var tt;
413
- function kt() {
414
- return tt || (tt = 1, process.env.NODE_ENV === "production" ? be.exports = Dt() : be.exports = Ct()), be.exports;
413
+ var ze;
414
+ function yt() {
415
+ return ze || (ze = 1, process.env.NODE_ENV === "production" ? _e.exports = gt() : _e.exports = bt()), _e.exports;
415
416
  }
416
- var It = kt();
417
- const lt = 0, ft = 1, dt = 2, rt = 3;
418
- var nt = Object.prototype.hasOwnProperty;
419
- function je(e, r) {
420
- var t, n;
421
- if (e === r) return !0;
422
- if (e && r && (t = e.constructor) === r.constructor) {
423
- if (t === Date) return e.getTime() === r.getTime();
424
- if (t === RegExp) return e.toString() === r.toString();
425
- if (t === Array) {
426
- if ((n = e.length) === r.length)
427
- for (; n-- && je(e[n], r[n]); ) ;
428
- return n === -1;
417
+ var At = yt();
418
+ const it = 0, ct = 1, ut = 2, Ze = 3;
419
+ var Qe = Object.prototype.hasOwnProperty;
420
+ function Le(e, t) {
421
+ var n, o;
422
+ if (e === t) return !0;
423
+ if (e && t && (n = e.constructor) === t.constructor) {
424
+ if (n === Date) return e.getTime() === t.getTime();
425
+ if (n === RegExp) return e.toString() === t.toString();
426
+ if (n === Array) {
427
+ if ((o = e.length) === t.length)
428
+ for (; o-- && Le(e[o], t[o]); ) ;
429
+ return o === -1;
429
430
  }
430
- if (!t || typeof e == "object") {
431
- n = 0;
432
- for (t in e)
433
- if (nt.call(e, t) && ++n && !nt.call(r, t) || !(t in r) || !je(e[t], r[t])) return !1;
434
- return Object.keys(r).length === n;
431
+ if (!n || typeof e == "object") {
432
+ o = 0;
433
+ for (n in e)
434
+ if (Qe.call(e, n) && ++o && !Qe.call(t, n) || !(n in t) || !Le(e[n], t[n])) return !1;
435
+ return Object.keys(t).length === o;
435
436
  }
436
437
  }
437
- return e !== e && r !== r;
438
+ return e !== e && t !== t;
438
439
  }
439
- const X = /* @__PURE__ */ new WeakMap(), te = () => {
440
- }, j = (
440
+ const X = /* @__PURE__ */ new WeakMap(), ee = () => {
441
+ }, P = (
441
442
  /*#__NOINLINE__*/
442
- te()
443
- ), Pe = Object, _ = (e) => e === j, B = (e) => typeof e == "function", re = (e, r) => ({
443
+ ee()
444
+ ), Pe = Object, E = (e) => e === P, G = (e) => typeof e == "function", te = (e, t) => ({
444
445
  ...e,
445
- ...r
446
- }), mt = (e) => B(e.then), De = {}, Oe = {}, $e = "undefined", _e = typeof window != $e, Ve = typeof document != $e, Lt = _e && "Deno" in window, xt = () => _e && typeof window.requestAnimationFrame != $e, Et = (e, r) => {
447
- const t = X.get(e);
446
+ ...t
447
+ }), lt = (e) => G(e.then), Ae = {}, Se = {}, Ue = "undefined", pe = typeof window != Ue, ke = typeof document != Ue, Ct = pe && "Deno" in window, Dt = () => pe && typeof window.requestAnimationFrame != Ue, ft = (e, t) => {
448
+ const n = X.get(e);
448
449
  return [
449
450
  // Getter
450
- () => !_(r) && e.get(r) || De,
451
+ () => !E(t) && e.get(t) || Ae,
451
452
  // Setter
452
- (n) => {
453
- if (!_(r)) {
454
- const o = e.get(r);
455
- r in Oe || (Oe[r] = o), t[5](r, re(o, n), o || De);
453
+ (o) => {
454
+ if (!E(t)) {
455
+ const s = e.get(t);
456
+ t in Se || (Se[t] = s), n[5](t, te(s, o), s || Ae);
456
457
  }
457
458
  },
458
459
  // Subscriber
459
- t[6],
460
+ n[6],
460
461
  // Get server cache snapshot
461
- () => !_(r) && r in Oe ? Oe[r] : !_(r) && e.get(r) || De
462
+ () => !E(t) && t in Se ? Se[t] : !E(t) && e.get(t) || Ae
462
463
  ];
463
464
  };
464
- let Fe = !0;
465
- const jt = () => Fe, [Ne, Me] = _e && window.addEventListener ? [
465
+ let Ne = !0;
466
+ const It = () => Ne, [Fe, Ve] = pe && window.addEventListener ? [
466
467
  window.addEventListener.bind(window),
467
468
  window.removeEventListener.bind(window)
468
469
  ] : [
469
- te,
470
- te
471
- ], Pt = () => {
472
- const e = Ve && document.visibilityState;
473
- return _(e) || e !== "hidden";
474
- }, Vt = (e) => (Ve && document.addEventListener("visibilitychange", e), Ne("focus", e), () => {
475
- Ve && document.removeEventListener("visibilitychange", e), Me("focus", e);
476
- }), Ft = (e) => {
477
- const r = () => {
478
- Fe = !0, e();
479
- }, t = () => {
480
- Fe = !1;
470
+ ee,
471
+ ee
472
+ ], jt = () => {
473
+ const e = ke && document.visibilityState;
474
+ return E(e) || e !== "hidden";
475
+ }, xt = (e) => (ke && document.addEventListener("visibilitychange", e), Fe("focus", e), () => {
476
+ ke && document.removeEventListener("visibilitychange", e), Ve("focus", e);
477
+ }), Lt = (e) => {
478
+ const t = () => {
479
+ Ne = !0, e();
480
+ }, n = () => {
481
+ Ne = !1;
481
482
  };
482
- return Ne("online", r), Ne("offline", t), () => {
483
- Me("online", r), Me("offline", t);
483
+ return Fe("online", t), Fe("offline", n), () => {
484
+ Ve("online", t), Ve("offline", n);
484
485
  };
485
- }, Nt = {
486
- isOnline: jt,
487
- isVisible: Pt
488
- }, Mt = {
489
- initFocus: Vt,
490
- initReconnect: Ft
491
- }, ot = !fe.useId, ge = !_e || Lt, Ut = (e) => xt() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Ce = ge ? ht : St, ke = typeof navigator < "u" && navigator.connection, st = !ge && ke && ([
486
+ }, Pt = {
487
+ isOnline: It,
488
+ isVisible: jt
489
+ }, kt = {
490
+ initFocus: xt,
491
+ initReconnect: Lt
492
+ }, et = !ce.useId, Ee = !pe || Ct, Nt = (e) => Dt() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Ce = Ee ? ht : _t, De = typeof navigator < "u" && navigator.connection, tt = !Ee && De && ([
492
493
  "slow-2g",
493
494
  "2g"
494
- ].includes(ke.effectiveType) || ke.saveData), Re = /* @__PURE__ */ new WeakMap(), Ie = (e, r) => Pe.prototype.toString.call(e) === `[object ${r}]`;
495
- let Wt = 0;
496
- const Ue = (e) => {
497
- const r = typeof e, t = Ie(e, "Date"), n = Ie(e, "RegExp"), o = Ie(e, "Object");
498
- let a, i;
499
- if (Pe(e) === e && !t && !n) {
500
- if (a = Re.get(e), a) return a;
501
- if (a = ++Wt + "~", Re.set(e, a), Array.isArray(e)) {
502
- for (a = "@", i = 0; i < e.length; i++)
503
- a += Ue(e[i]) + ",";
504
- Re.set(e, a);
495
+ ].includes(De.effectiveType) || De.saveData), Oe = /* @__PURE__ */ new WeakMap(), Ie = (e, t) => Pe.prototype.toString.call(e) === `[object ${t}]`;
496
+ let Ft = 0;
497
+ const Me = (e) => {
498
+ const t = typeof e, n = Ie(e, "Date"), o = Ie(e, "RegExp"), s = Ie(e, "Object");
499
+ let a, u;
500
+ if (Pe(e) === e && !n && !o) {
501
+ if (a = Oe.get(e), a) return a;
502
+ if (a = ++Ft + "~", Oe.set(e, a), Array.isArray(e)) {
503
+ for (a = "@", u = 0; u < e.length; u++)
504
+ a += Me(e[u]) + ",";
505
+ Oe.set(e, a);
505
506
  }
506
- if (o) {
507
+ if (s) {
507
508
  a = "#";
508
- const f = Pe.keys(e).sort();
509
- for (; !_(i = f.pop()); )
510
- _(e[i]) || (a += i + ":" + Ue(e[i]) + ",");
511
- Re.set(e, a);
509
+ const p = Pe.keys(e).sort();
510
+ for (; !E(u = p.pop()); )
511
+ E(e[u]) || (a += u + ":" + Me(e[u]) + ",");
512
+ Oe.set(e, a);
512
513
  }
513
514
  } else
514
- a = t ? e.toJSON() : r == "symbol" ? e.toString() : r == "string" ? JSON.stringify(e) : "" + e;
515
+ a = n ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
515
516
  return a;
516
- }, qe = (e) => {
517
- if (B(e))
517
+ }, We = (e) => {
518
+ if (G(e))
518
519
  try {
519
520
  e = e();
520
521
  } catch {
521
522
  e = "";
522
523
  }
523
- const r = e;
524
- return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? Ue(e) : "", [
524
+ const t = e;
525
+ return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? Me(e) : "", [
525
526
  e,
526
- r
527
+ t
527
528
  ];
528
529
  };
529
- let $t = 0;
530
- const We = () => ++$t;
531
- async function pt(...e) {
532
- const [r, t, n, o] = e, a = re({
530
+ let Vt = 0;
531
+ const qe = () => ++Vt;
532
+ async function dt(...e) {
533
+ const [t, n, o, s] = e, a = te({
533
534
  populateCache: !0,
534
535
  throwOnError: !0
535
- }, typeof o == "boolean" ? {
536
- revalidate: o
537
- } : o || {});
538
- let i = a.populateCache;
539
- const f = a.rollbackOnError;
540
- let E = a.optimisticData;
541
- const g = (p) => typeof f == "function" ? f(p) : f !== !1, v = a.throwOnError;
542
- if (B(t)) {
543
- const p = t, u = [], h = r.keys();
544
- for (const m of h)
536
+ }, typeof s == "boolean" ? {
537
+ revalidate: s
538
+ } : s || {});
539
+ let u = a.populateCache;
540
+ const p = a.rollbackOnError;
541
+ let _ = a.optimisticData;
542
+ const A = (m) => typeof p == "function" ? p(m) : p !== !1, w = a.throwOnError;
543
+ if (G(n)) {
544
+ const m = n, c = [], v = t.keys();
545
+ for (const d of v)
545
546
  // Skip the special useSWRInfinite and useSWRSubscription keys.
546
- !/^\$(inf|sub)\$/.test(m) && p(r.get(m)._k) && u.push(m);
547
- return Promise.all(u.map(d));
547
+ !/^\$(inf|sub)\$/.test(d) && m(t.get(d)._k) && c.push(d);
548
+ return Promise.all(c.map(f));
548
549
  }
549
- return d(t);
550
- async function d(p) {
551
- const [u] = qe(p);
552
- if (!u) return;
553
- const [h, m] = Et(r, u), [k, c, W, ne] = X.get(r), $ = () => {
554
- const P = k[u];
555
- return (B(a.revalidate) ? a.revalidate(h().data, p) : a.revalidate !== !1) && (delete W[u], delete ne[u], P && P[0]) ? P[0](dt).then(() => h().data) : h().data;
550
+ return f(n);
551
+ async function f(m) {
552
+ const [c] = We(m);
553
+ if (!c) return;
554
+ const [v, d] = ft(t, c), [I, i, q, ne] = X.get(t), U = () => {
555
+ const k = I[c];
556
+ return (G(a.revalidate) ? a.revalidate(v().data, m) : a.revalidate !== !1) && (delete q[c], delete ne[c], k && k[0]) ? k[0](ut).then(() => v().data) : v().data;
556
557
  };
557
558
  if (e.length < 3)
558
- return $();
559
- let y = n, I;
560
- const Z = We();
561
- c[u] = [
562
- Z,
559
+ return U();
560
+ let b = o, j;
561
+ const z = qe();
562
+ i[c] = [
563
+ z,
563
564
  0
564
565
  ];
565
- const O = !_(E), Q = h(), V = Q.data, q = Q._c, G = _(q) ? V : q;
566
- if (O && (E = B(E) ? E(G, V) : E, m({
567
- data: E,
568
- _c: G
569
- })), B(y))
566
+ const O = !E(_), Z = v(), N = Z.data, W = Z._c, $ = E(W) ? N : W;
567
+ if (O && (_ = G(_) ? _($, N) : _, d({
568
+ data: _,
569
+ _c: $
570
+ })), G(b))
570
571
  try {
571
- y = y(G);
572
- } catch (P) {
573
- I = P;
572
+ b = b($);
573
+ } catch (k) {
574
+ j = k;
574
575
  }
575
- if (y && mt(y))
576
- if (y = await y.catch((P) => {
577
- I = P;
578
- }), Z !== c[u][0]) {
579
- if (I) throw I;
580
- return y;
581
- } else I && O && g(I) && (i = !0, m({
582
- data: G,
583
- _c: j
576
+ if (b && lt(b))
577
+ if (b = await b.catch((k) => {
578
+ j = k;
579
+ }), z !== i[c][0]) {
580
+ if (j) throw j;
581
+ return b;
582
+ } else j && O && A(j) && (u = !0, d({
583
+ data: $,
584
+ _c: P
584
585
  }));
585
- if (i && !I)
586
- if (B(i)) {
587
- const P = i(y, G);
588
- m({
589
- data: P,
590
- error: j,
591
- _c: j
586
+ if (u && !j)
587
+ if (G(u)) {
588
+ const k = u(b, $);
589
+ d({
590
+ data: k,
591
+ error: P,
592
+ _c: P
592
593
  });
593
594
  } else
594
- m({
595
- data: y,
596
- error: j,
597
- _c: j
595
+ d({
596
+ data: b,
597
+ error: P,
598
+ _c: P
598
599
  });
599
- if (c[u][1] = We(), Promise.resolve($()).then(() => {
600
- m({
601
- _c: j
600
+ if (i[c][1] = qe(), Promise.resolve(U()).then(() => {
601
+ d({
602
+ _c: P
602
603
  });
603
- }), I) {
604
- if (v) throw I;
604
+ }), j) {
605
+ if (w) throw j;
605
606
  return;
606
607
  }
607
- return y;
608
+ return b;
608
609
  }
609
610
  }
610
- const at = (e, r) => {
611
- for (const t in e)
612
- e[t][0] && e[t][0](r);
613
- }, qt = (e, r) => {
611
+ const nt = (e, t) => {
612
+ for (const n in e)
613
+ e[n][0] && e[n][0](t);
614
+ }, Mt = (e, t) => {
614
615
  if (!X.has(e)) {
615
- const t = re(Mt, r), n = /* @__PURE__ */ Object.create(null), o = pt.bind(j, e);
616
- let a = te;
617
- const i = /* @__PURE__ */ Object.create(null), f = (v, d) => {
618
- const p = i[v] || [];
619
- return i[v] = p, p.push(d), () => p.splice(p.indexOf(d), 1);
620
- }, E = (v, d, p) => {
621
- e.set(v, d);
622
- const u = i[v];
623
- if (u)
624
- for (const h of u)
625
- h(d, p);
626
- }, g = () => {
616
+ const n = te(kt, t), o = /* @__PURE__ */ Object.create(null), s = dt.bind(P, e);
617
+ let a = ee;
618
+ const u = /* @__PURE__ */ Object.create(null), p = (w, f) => {
619
+ const m = u[w] || [];
620
+ return u[w] = m, m.push(f), () => m.splice(m.indexOf(f), 1);
621
+ }, _ = (w, f, m) => {
622
+ e.set(w, f);
623
+ const c = u[w];
624
+ if (c)
625
+ for (const v of c)
626
+ v(f, m);
627
+ }, A = () => {
627
628
  if (!X.has(e) && (X.set(e, [
628
- n,
629
+ o,
629
630
  /* @__PURE__ */ Object.create(null),
630
631
  /* @__PURE__ */ Object.create(null),
631
632
  /* @__PURE__ */ Object.create(null),
632
- o,
633
- E,
634
- f
635
- ]), !ge)) {
636
- const v = t.initFocus(setTimeout.bind(j, at.bind(j, n, lt))), d = t.initReconnect(setTimeout.bind(j, at.bind(j, n, ft)));
633
+ s,
634
+ _,
635
+ p
636
+ ]), !Ee)) {
637
+ const w = n.initFocus(setTimeout.bind(P, nt.bind(P, o, it))), f = n.initReconnect(setTimeout.bind(P, nt.bind(P, o, ct)));
637
638
  a = () => {
638
- v && v(), d && d(), X.delete(e);
639
+ w && w(), f && f(), X.delete(e);
639
640
  };
640
641
  }
641
642
  };
642
- return g(), [
643
+ return A(), [
643
644
  e,
644
- o,
645
- g,
645
+ s,
646
+ A,
646
647
  a
647
648
  ];
648
649
  }
@@ -650,46 +651,46 @@ const at = (e, r) => {
650
651
  e,
651
652
  X.get(e)[4]
652
653
  ];
653
- }, Gt = (e, r, t, n, o) => {
654
- const a = t.errorRetryCount, i = o.retryCount, f = ~~((Math.random() + 0.5) * (1 << (i < 8 ? i : 8))) * t.errorRetryInterval;
655
- !_(a) && i > a || setTimeout(n, f, o);
656
- }, Yt = je, [vt, Bt] = qt(/* @__PURE__ */ new Map()), Ht = re(
654
+ }, qt = (e, t, n, o, s) => {
655
+ const a = n.errorRetryCount, u = s.retryCount, p = ~~((Math.random() + 0.5) * (1 << (u < 8 ? u : 8))) * n.errorRetryInterval;
656
+ !E(a) && u > a || setTimeout(o, p, s);
657
+ }, Ut = Le, [mt, Wt] = Mt(/* @__PURE__ */ new Map()), $t = te(
657
658
  {
658
659
  // events
659
- onLoadingSlow: te,
660
- onSuccess: te,
661
- onError: te,
662
- onErrorRetry: Gt,
663
- onDiscarded: te,
660
+ onLoadingSlow: ee,
661
+ onSuccess: ee,
662
+ onError: ee,
663
+ onErrorRetry: qt,
664
+ onDiscarded: ee,
664
665
  // switches
665
666
  revalidateOnFocus: !0,
666
667
  revalidateOnReconnect: !0,
667
668
  revalidateIfStale: !0,
668
669
  shouldRetryOnError: !0,
669
670
  // timeouts
670
- errorRetryInterval: st ? 1e4 : 5e3,
671
+ errorRetryInterval: tt ? 1e4 : 5e3,
671
672
  focusThrottleInterval: 5 * 1e3,
672
673
  dedupingInterval: 2 * 1e3,
673
- loadingTimeout: st ? 5e3 : 3e3,
674
+ loadingTimeout: tt ? 5e3 : 3e3,
674
675
  // providers
675
- compare: Yt,
676
+ compare: Ut,
676
677
  isPaused: () => !1,
677
- cache: vt,
678
- mutate: Bt,
678
+ cache: mt,
679
+ mutate: Wt,
679
680
  fallback: {}
680
681
  },
681
682
  // use web preset by default
682
- Nt
683
- ), Jt = (e, r) => {
684
- const t = re(e, r);
685
- if (r) {
686
- const { use: n, fallback: o } = e, { use: a, fallback: i } = r;
687
- n && a && (t.use = n.concat(a)), o && i && (t.fallback = re(o, i));
683
+ Pt
684
+ ), Yt = (e, t) => {
685
+ const n = te(e, t);
686
+ if (t) {
687
+ const { use: o, fallback: s } = e, { use: a, fallback: u } = t;
688
+ o && a && (n.use = o.concat(a)), s && u && (n.fallback = te(s, u));
688
689
  }
689
- return t;
690
- }, Kt = it({}), zt = "$inf$", gt = _e && window.__SWR_DEVTOOLS_USE__, Xt = gt ? window.__SWR_DEVTOOLS_USE__ : [], Zt = () => {
691
- gt && (window.__SWR_DEVTOOLS_REACT__ = fe);
692
- }, Qt = (e) => B(e[1]) ? [
690
+ return n;
691
+ }, Gt = rt({}), Ht = "$inf$", Et = pe && window.__SWR_DEVTOOLS_USE__, Bt = Et ? window.__SWR_DEVTOOLS_USE__ : [], Jt = () => {
692
+ Et && (window.__SWR_DEVTOOLS_REACT__ = ce);
693
+ }, Kt = (e) => G(e[1]) ? [
693
694
  e[0],
694
695
  e[1],
695
696
  e[2] || {}
@@ -697,28 +698,28 @@ const at = (e, r) => {
697
698
  e[0],
698
699
  null,
699
700
  (e[1] === null ? e[2] : e[1]) || {}
700
- ], er = () => re(Ht, ct(Kt)), tr = (e) => (r, t, n) => e(r, t && ((...a) => {
701
- const [i] = qe(r), [, , , f] = X.get(vt);
702
- if (i.startsWith(zt))
703
- return t(...a);
704
- const E = f[i];
705
- return _(E) ? t(...a) : (delete f[i], E);
706
- }), n), rr = Xt.concat(tr), nr = (e) => function(...t) {
707
- const n = er(), [o, a, i] = Qt(t), f = Jt(n, i);
708
- let E = e;
709
- const { use: g } = f, v = (g || []).concat(rr);
710
- for (let d = v.length; d--; )
711
- E = v[d](E);
712
- return E(o, a || f.fetcher || null, f);
713
- }, or = (e, r, t) => {
714
- const n = r[e] || (r[e] = []);
715
- return n.push(t), () => {
716
- const o = n.indexOf(t);
717
- o >= 0 && (n[o] = n[n.length - 1], n.pop());
701
+ ], Xt = () => te($t, ot(Gt)), zt = (e) => (t, n, o) => e(t, n && ((...a) => {
702
+ const [u] = We(t), [, , , p] = X.get(mt);
703
+ if (u.startsWith(Ht))
704
+ return n(...a);
705
+ const _ = p[u];
706
+ return E(_) ? n(...a) : (delete p[u], _);
707
+ }), o), Zt = Bt.concat(zt), Qt = (e) => function(...n) {
708
+ const o = Xt(), [s, a, u] = Kt(n), p = Yt(o, u);
709
+ let _ = e;
710
+ const { use: A } = p, w = (A || []).concat(Zt);
711
+ for (let f = w.length; f--; )
712
+ _ = w[f](_);
713
+ return _(s, a || p.fetcher || null, p);
714
+ }, en = (e, t, n) => {
715
+ const o = t[e] || (t[e] = []);
716
+ return o.push(n), () => {
717
+ const s = o.indexOf(n);
718
+ s >= 0 && (o[s] = o[o.length - 1], o.pop());
718
719
  };
719
720
  };
720
- Zt();
721
- const Le = fe.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
721
+ Jt();
722
+ const je = ce.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
722
723
  // and emitting an error.
723
724
  // We assume that this is only for the `use(thenable)` case, not `use(context)`.
724
725
  // https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
@@ -731,101 +732,101 @@ const Le = fe.use || // This extra generic is to avoid TypeScript mixing up the
731
732
  case "rejected":
732
733
  throw e.reason;
733
734
  default:
734
- throw e.status = "pending", e.then((r) => {
735
- e.status = "fulfilled", e.value = r;
736
- }, (r) => {
737
- e.status = "rejected", e.reason = r;
735
+ throw e.status = "pending", e.then((t) => {
736
+ e.status = "fulfilled", e.value = t;
737
+ }, (t) => {
738
+ e.status = "rejected", e.reason = t;
738
739
  }), e;
739
740
  }
740
741
  }), xe = {
741
742
  dedupe: !0
742
- }, sr = (e, r, t) => {
743
- const { cache: n, compare: o, suspense: a, fallbackData: i, revalidateOnMount: f, revalidateIfStale: E, refreshInterval: g, refreshWhenHidden: v, refreshWhenOffline: d, keepPreviousData: p } = t, [u, h, m, k] = X.get(n), [c, W] = qe(e), ne = se(!1), $ = se(!1), y = se(c), I = se(r), Z = se(t), O = () => Z.current, Q = () => O().isVisible() && O().isOnline(), [V, q, G, P] = Et(n, c), Y = se({}).current, oe = _(i) ? _(t.fallback) ? j : t.fallback[c] : i, de = (R, b) => {
744
- for (const C in Y) {
745
- const w = C;
746
- if (w === "data") {
747
- if (!o(R[w], b[w]) && (!_(R[w]) || !o(L, b[w])))
743
+ }, tn = (e, t, n) => {
744
+ const { cache: o, compare: s, suspense: a, fallbackData: u, revalidateOnMount: p, revalidateIfStale: _, refreshInterval: A, refreshWhenHidden: w, refreshWhenOffline: f, keepPreviousData: m } = n, [c, v, d, I] = X.get(o), [i, q] = We(e), ne = oe(!1), U = oe(!1), b = oe(i), j = oe(t), z = oe(n), O = () => z.current, Z = () => O().isVisible() && O().isOnline(), [N, W, $, k] = ft(o, i), Y = oe({}).current, re = E(u) ? E(n.fallback) ? P : n.fallback[i] : u, ue = (R, S) => {
745
+ for (const D in Y) {
746
+ const g = D;
747
+ if (g === "data") {
748
+ if (!s(R[g], S[g]) && (!E(R[g]) || !s(x, S[g])))
748
749
  return !1;
749
- } else if (b[w] !== R[w])
750
+ } else if (S[g] !== R[g])
750
751
  return !1;
751
752
  }
752
753
  return !0;
753
- }, me = bt(() => {
754
- const R = !c || !r ? !1 : _(f) ? O().isPaused() || a ? !1 : E !== !1 : f, b = (x) => {
755
- const K = re(x);
756
- return delete K._k, R ? {
754
+ }, le = Re(() => {
755
+ const R = !i || !t ? !1 : E(p) ? O().isPaused() || a ? !1 : _ !== !1 : p, S = (L) => {
756
+ const J = te(L);
757
+ return delete J._k, R ? {
757
758
  isValidating: !0,
758
759
  isLoading: !0,
759
- ...K
760
- } : K;
761
- }, C = V(), w = P(), U = b(C), le = C === w ? U : b(w);
762
- let D = U;
760
+ ...J
761
+ } : J;
762
+ }, D = N(), g = k(), M = S(D), ie = D === g ? M : S(g);
763
+ let C = M;
763
764
  return [
764
765
  () => {
765
- const x = b(V());
766
- return de(x, D) ? (D.data = x.data, D.isLoading = x.isLoading, D.isValidating = x.isValidating, D.error = x.error, D) : (D = x, x);
766
+ const L = S(N());
767
+ return ue(L, C) ? (C.data = L.data, C.isLoading = L.isLoading, C.isValidating = L.isValidating, C.error = L.error, C) : (C = L, L);
767
768
  },
768
- () => le
769
+ () => ie
769
770
  ];
770
771
  }, [
771
- n,
772
- c
773
- ]), H = It.useSyncExternalStore(ae(
774
- (R) => G(c, (b, C) => {
775
- de(C, b) || R();
772
+ o,
773
+ i
774
+ ]), H = At.useSyncExternalStore(ge(
775
+ (R) => $(i, (S, D) => {
776
+ ue(D, S) || R();
776
777
  }),
777
778
  // eslint-disable-next-line react-hooks/exhaustive-deps
778
779
  [
779
- n,
780
- c
780
+ o,
781
+ i
781
782
  ]
782
- ), me[0], me[1]), Ee = !ne.current, s = u[c] && u[c].length > 0, l = H.data, S = _(l) ? oe && mt(oe) ? Le(oe) : oe : l, T = H.error, F = se(S), L = p ? _(l) ? _(F.current) ? S : F.current : l : S, ce = s && !_(T) ? !1 : Ee && !_(f) ? f : O().isPaused() ? !1 : a ? _(S) ? !1 : E : _(S) || E, ue = !!(c && r && Ee && ce), A = _(H.isValidating) ? ue : H.isValidating, ee = _(H.isLoading) ? ue : H.isLoading, J = ae(
783
+ ), le[0], le[1]), fe = !ne.current, r = c[i] && c[i].length > 0, l = H.data, h = E(l) ? re && lt(re) ? je(re) : re : l, T = H.error, F = oe(h), x = m ? E(l) ? E(F.current) ? h : F.current : l : h, se = r && !E(T) ? !1 : fe && !E(p) ? p : O().isPaused() ? !1 : a ? E(h) ? !1 : _ : E(h) || _, ae = !!(i && t && fe && se), y = E(H.isValidating) ? ae : H.isValidating, Q = E(H.isLoading) ? ae : H.isLoading, B = ge(
783
784
  async (R) => {
784
- const b = I.current;
785
- if (!c || !b || $.current || O().isPaused())
785
+ const S = j.current;
786
+ if (!i || !S || U.current || O().isPaused())
786
787
  return !1;
787
- let C, w, U = !0;
788
- const le = R || {}, D = !m[c] || !le.dedupe, x = () => ot ? !$.current && c === y.current && ne.current : c === y.current, K = {
788
+ let D, g, M = !0;
789
+ const ie = R || {}, C = !d[i] || !ie.dedupe, L = () => et ? !U.current && i === b.current && ne.current : i === b.current, J = {
789
790
  isValidating: !1,
790
791
  isLoading: !1
791
- }, He = () => {
792
- q(K);
793
- }, Je = () => {
794
- const N = m[c];
795
- N && N[1] === w && delete m[c];
796
- }, Ke = {
792
+ }, $e = () => {
793
+ W(J);
794
+ }, Ye = () => {
795
+ const V = d[i];
796
+ V && V[1] === g && delete d[i];
797
+ }, Ge = {
797
798
  isValidating: !0
798
799
  };
799
- _(V().data) && (Ke.isLoading = !0);
800
+ E(N().data) && (Ge.isLoading = !0);
800
801
  try {
801
- if (D && (q(Ke), t.loadingTimeout && _(V().data) && setTimeout(() => {
802
- U && x() && O().onLoadingSlow(c, t);
803
- }, t.loadingTimeout), m[c] = [
804
- b(W),
805
- We()
806
- ]), [C, w] = m[c], C = await C, D && setTimeout(Je, t.dedupingInterval), !m[c] || m[c][1] !== w)
807
- return D && x() && O().onDiscarded(c), !1;
808
- K.error = j;
809
- const N = h[c];
810
- if (!_(N) && // case 1
811
- (w <= N[0] || // case 2
812
- w <= N[1] || // case 3
813
- N[1] === 0))
814
- return He(), D && x() && O().onDiscarded(c), !1;
815
- const z = V().data;
816
- K.data = o(z, C) ? z : C, D && x() && O().onSuccess(C, c, t);
817
- } catch (N) {
818
- Je();
819
- const z = O(), { shouldRetryOnError: Te } = z;
820
- z.isPaused() || (K.error = N, D && x() && (z.onError(N, c, z), (Te === !0 || B(Te) && Te(N)) && (!O().revalidateOnFocus || !O().revalidateOnReconnect || Q()) && z.onErrorRetry(N, c, z, (_t) => {
821
- const we = u[c];
822
- we && we[0] && we[0](rt, _t);
802
+ if (C && (W(Ge), n.loadingTimeout && E(N().data) && setTimeout(() => {
803
+ M && L() && O().onLoadingSlow(i, n);
804
+ }, n.loadingTimeout), d[i] = [
805
+ S(q),
806
+ qe()
807
+ ]), [D, g] = d[i], D = await D, C && setTimeout(Ye, n.dedupingInterval), !d[i] || d[i][1] !== g)
808
+ return C && L() && O().onDiscarded(i), !1;
809
+ J.error = P;
810
+ const V = v[i];
811
+ if (!E(V) && // case 1
812
+ (g <= V[0] || // case 2
813
+ g <= V[1] || // case 3
814
+ V[1] === 0))
815
+ return $e(), C && L() && O().onDiscarded(i), !1;
816
+ const K = N().data;
817
+ J.data = s(K, D) ? K : D, C && L() && O().onSuccess(D, i, n);
818
+ } catch (V) {
819
+ Ye();
820
+ const K = O(), { shouldRetryOnError: we } = K;
821
+ K.isPaused() || (J.error = V, C && L() && (K.onError(V, i, K), (we === !0 || G(we) && we(V)) && (!O().revalidateOnFocus || !O().revalidateOnReconnect || Z()) && K.onErrorRetry(V, i, K, (vt) => {
822
+ const Te = c[i];
823
+ Te && Te[0] && Te[0](Ze, vt);
823
824
  }, {
824
- retryCount: (le.retryCount || 0) + 1,
825
+ retryCount: (ie.retryCount || 0) + 1,
825
826
  dedupe: !0
826
827
  })));
827
828
  }
828
- return U = !1, He(), !0;
829
+ return M = !1, $e(), !0;
829
830
  },
830
831
  // `setState` is immutable, and `eventsCallback`, `fnArg`, and
831
832
  // `keyValidating` are depending on `key`, so we can exclude them from
@@ -839,336 +840,221 @@ const Le = fe.use || // This extra generic is to avoid TypeScript mixing up the
839
840
  // even though it might cause unexpected behaviors.
840
841
  // eslint-disable-next-line react-hooks/exhaustive-deps
841
842
  [
842
- c,
843
- n
843
+ i,
844
+ o
844
845
  ]
845
- ), he = ae(
846
+ ), ve = ge(
846
847
  // Use callback to make sure `keyRef.current` returns latest result every time
847
- (...R) => pt(n, y.current, ...R),
848
+ (...R) => dt(o, b.current, ...R),
848
849
  // eslint-disable-next-line react-hooks/exhaustive-deps
849
850
  []
850
851
  );
851
852
  if (Ce(() => {
852
- I.current = r, Z.current = t, _(l) || (F.current = l);
853
+ j.current = t, z.current = n, E(l) || (F.current = l);
853
854
  }), Ce(() => {
854
- if (!c) return;
855
- const R = J.bind(j, xe);
856
- let b = 0;
857
- O().revalidateOnFocus && (b = Date.now() + O().focusThrottleInterval);
858
- const w = or(c, u, (U, le = {}) => {
859
- if (U == lt) {
860
- const D = Date.now();
861
- O().revalidateOnFocus && D > b && Q() && (b = D + O().focusThrottleInterval, R());
862
- } else if (U == ft)
863
- O().revalidateOnReconnect && Q() && R();
855
+ if (!i) return;
856
+ const R = B.bind(P, xe);
857
+ let S = 0;
858
+ O().revalidateOnFocus && (S = Date.now() + O().focusThrottleInterval);
859
+ const g = en(i, c, (M, ie = {}) => {
860
+ if (M == it) {
861
+ const C = Date.now();
862
+ O().revalidateOnFocus && C > S && Z() && (S = C + O().focusThrottleInterval, R());
863
+ } else if (M == ct)
864
+ O().revalidateOnReconnect && Z() && R();
864
865
  else {
865
- if (U == dt)
866
- return J();
867
- if (U == rt)
868
- return J(le);
866
+ if (M == ut)
867
+ return B();
868
+ if (M == Ze)
869
+ return B(ie);
869
870
  }
870
871
  });
871
- return $.current = !1, y.current = c, ne.current = !0, q({
872
- _k: W
873
- }), ce && (_(S) || ge ? R() : Ut(R)), () => {
874
- $.current = !0, w();
872
+ return U.current = !1, b.current = i, ne.current = !0, W({
873
+ _k: q
874
+ }), se && (E(h) || Ee ? R() : Nt(R)), () => {
875
+ U.current = !0, g();
875
876
  };
876
877
  }, [
877
- c
878
+ i
878
879
  ]), Ce(() => {
879
880
  let R;
880
- function b() {
881
- const w = B(g) ? g(V().data) : g;
882
- w && R !== -1 && (R = setTimeout(C, w));
881
+ function S() {
882
+ const g = G(A) ? A(N().data) : A;
883
+ g && R !== -1 && (R = setTimeout(D, g));
883
884
  }
884
- function C() {
885
- !V().error && (v || O().isVisible()) && (d || O().isOnline()) ? J(xe).then(b) : b();
885
+ function D() {
886
+ !N().error && (w || O().isVisible()) && (f || O().isOnline()) ? B(xe).then(S) : S();
886
887
  }
887
- return b(), () => {
888
+ return S(), () => {
888
889
  R && (clearTimeout(R), R = -1);
889
890
  };
890
891
  }, [
891
- g,
892
- v,
893
- d,
894
- c
895
- ]), Ot(L), a && _(S) && c) {
896
- if (!ot && ge)
892
+ A,
893
+ w,
894
+ f,
895
+ i
896
+ ]), St(x), a && E(h) && i) {
897
+ if (!et && Ee)
897
898
  throw new Error("Fallback data is required when using Suspense in SSR.");
898
- I.current = r, Z.current = t, $.current = !1;
899
- const R = k[c];
900
- if (!_(R)) {
901
- const b = he(R);
902
- Le(b);
899
+ j.current = t, z.current = n, U.current = !1;
900
+ const R = I[i];
901
+ if (!E(R)) {
902
+ const S = ve(R);
903
+ je(S);
903
904
  }
904
- if (_(T)) {
905
- const b = J(xe);
906
- _(L) || (b.status = "fulfilled", b.value = !0), Le(b);
905
+ if (E(T)) {
906
+ const S = B(xe);
907
+ E(x) || (S.status = "fulfilled", S.value = !0), je(S);
907
908
  } else
908
909
  throw T;
909
910
  }
910
911
  return {
911
- mutate: he,
912
+ mutate: ve,
912
913
  get data() {
913
- return Y.data = !0, L;
914
+ return Y.data = !0, x;
914
915
  },
915
916
  get error() {
916
917
  return Y.error = !0, T;
917
918
  },
918
919
  get isValidating() {
919
- return Y.isValidating = !0, A;
920
+ return Y.isValidating = !0, y;
920
921
  },
921
922
  get isLoading() {
922
- return Y.isLoading = !0, ee;
923
+ return Y.isLoading = !0, Q;
923
924
  }
924
925
  };
925
- }, Ge = nr(sr), pr = () => null, Ye = async (e, r = { method: "GET" }) => {
926
- throw new Error("Figma API token is not available.");
927
- }, ar = "https://api.figma.com", ir = `${ar}/v1/files`, Be = (e) => `${ir}/${e}/variables`, vr = (e) => {
928
- const r = ie(), { data: t, error: n, isLoading: o, isValidating: a } = Ge(
929
- r ? Be(e) : null,
930
- Ye
931
- ), i = t != null && t.meta ? Object.values(t.meta.variables) : [], f = t != null && t.meta ? t.meta.variables : {};
932
- return {
933
- variables: i,
934
- variablesById: f,
935
- isLoading: o,
936
- isValidating: a,
937
- error: n ?? (t && "message" in t ? new Error(t.message) : null)
938
- };
939
- }, gr = (e) => {
940
- const r = ie(), { data: t, error: n, isLoading: o, isValidating: a } = Ge(
941
- r ? Be(e) : null,
942
- Ye
943
- ), i = t != null && t.meta ? Object.values(t.meta.variableCollections) : [], f = t != null && t.meta ? t.meta.variableCollections : {};
926
+ }, nn = Qt(tn), rn = async (e, t) => {
927
+ if (!t)
928
+ throw new Error("A Figma API token is required to make this request.");
929
+ const n = await fetch(e, {
930
+ headers: {
931
+ "X-FIGMA-TOKEN": t,
932
+ "Content-Type": "application/json"
933
+ }
934
+ });
935
+ if (!n.ok) {
936
+ const o = await n.json();
937
+ throw new Error(
938
+ o.message || "An error occurred while fetching data from the Figma API."
939
+ );
940
+ }
941
+ return n.json();
942
+ }, pt = () => {
943
+ const { token: e, fileKey: t } = at(), n = t ? `https://api.figma.com/v1/files/${t}/variables/local` : null, { data: o, error: s, isLoading: a, isValidating: u } = nn(
944
+ e && n ? [n, e] : null,
945
+ rn
946
+ );
944
947
  return {
945
- collections: i,
946
- collectionsById: f,
947
- isLoading: o,
948
- isValidating: a,
949
- error: n ?? (t && "message" in t ? new Error(t.message) : null)
948
+ data: o,
949
+ isLoading: a,
950
+ isValidating: u,
951
+ error: s
950
952
  };
951
- }, _r = (e) => {
952
- const r = ie(), { data: t, error: n, isLoading: o, isValidating: a } = Ge(
953
- r ? Be(e) : null,
954
- Ye
955
- ), i = [], f = {}, E = {};
956
- if (t != null && t.meta)
957
- for (const g of Object.values(
958
- t.meta.variableCollections
959
- )) {
960
- i.push(...g.modes), f[g.id] = g.modes;
961
- for (const v of g.modes)
962
- E[v.modeId] = v;
963
- }
953
+ }, un = () => {
954
+ const { data: e } = pt(), t = Re(
955
+ () => e != null && e.meta ? Object.values(e.meta.variableCollections) : [],
956
+ [e]
957
+ ), n = Re(
958
+ () => e != null && e.meta ? e.meta.variableCollections : {},
959
+ [e]
960
+ );
964
961
  return {
965
- modes: i,
966
- modesByCollectionId: f,
967
- modesById: E,
968
- isLoading: o,
969
- isValidating: a,
970
- error: n ?? (t && "message" in t ? new Error(t.message) : null)
962
+ collections: t,
963
+ collectionsById: n
971
964
  };
972
- };
973
- async function cr(e, r, t) {
974
- const n = `https://api.figma.com/v1/files/${r}/variables`;
975
- try {
976
- const o = await fetch(n, {
977
- method: "POST",
978
- headers: {
979
- "Content-Type": "application/json",
980
- "X-FIGMA-TOKEN": e
981
- },
982
- body: JSON.stringify(t)
983
- }), a = await o.json();
984
- return o.ok ? {
985
- error: !1,
986
- status: o.status,
987
- meta: a.meta
988
- } : {
989
- error: !0,
990
- status: o.status,
991
- message: a.message || "Failed to perform bulk update."
992
- };
993
- } catch (o) {
965
+ }, ln = () => {
966
+ const { data: e } = pt();
967
+ return Re(() => {
968
+ const t = [], n = {}, o = {};
969
+ if (e != null && e.meta)
970
+ for (const s of Object.values(
971
+ e.meta.variableCollections
972
+ )) {
973
+ t.push(...s.modes), n[s.id] = s.modes;
974
+ for (const a of s.modes)
975
+ o[a.modeId] = a;
976
+ }
994
977
  return {
995
- error: !0,
996
- status: 500,
997
- message: o instanceof Error ? o.message : "An unknown error occurred."
978
+ modes: t,
979
+ modesByCollectionId: n,
980
+ modesById: o
998
981
  };
999
- }
1000
- }
1001
- const hr = () => {
1002
- const e = ie(), [r, t] = M(!1), [n, o] = M(null), [a, i] = M(null);
1003
- return { bulkUpdate: ae(
1004
- async (E, g) => {
1005
- if (!e) {
1006
- o("Figma API token is not provided.");
1007
- return;
1008
- }
1009
- t(!0), o(null);
1010
- const v = await cr(e, E, g);
1011
- i(v), v.error && o(v.message || "An error occurred during the bulk update."), t(!1);
982
+ }, [e]);
983
+ }, fn = async (e, t, n) => {
984
+ if (!e || !t)
985
+ throw new Error("A Figma API token and file key are required.");
986
+ const o = `https://api.figma.com/v1/files/${t}/variables`, s = await fetch(o, {
987
+ method: "POST",
988
+ headers: {
989
+ "Content-Type": "application/json",
990
+ "X-FIGMA-TOKEN": e
1012
991
  },
1013
- [e]
1014
- ), loading: r, error: n, data: a };
1015
- };
1016
- async function ur(e, r) {
1017
- const t = "https://api.figma.com/v1/variables";
1018
- try {
1019
- const n = await fetch(t, {
1020
- method: "POST",
1021
- headers: {
1022
- "Content-Type": "application/json",
1023
- "X-FIGMA-TOKEN": e
1024
- },
1025
- body: JSON.stringify(r)
1026
- });
1027
- if (!n.ok) {
1028
- const a = await n.json();
1029
- return {
1030
- error: !0,
1031
- status: n.status,
1032
- message: a.message || "Failed to create Figma variable"
1033
- };
1034
- }
992
+ body: JSON.stringify(n)
993
+ }), a = await s.json();
994
+ if (!s.ok)
995
+ throw new Error(a.message || "Failed to perform bulk update.");
996
+ return a;
997
+ }, dn = async (e, t) => {
998
+ if (!e)
999
+ throw new Error("A Figma API token is required.");
1000
+ const n = await fetch("https://api.figma.com/v1/variables", {
1001
+ method: "POST",
1002
+ headers: {
1003
+ "Content-Type": "application/json",
1004
+ "X-FIGMA-TOKEN": e
1005
+ },
1006
+ body: JSON.stringify(t)
1007
+ });
1008
+ if (!n.ok) {
1035
1009
  const o = await n.json();
1036
- return {
1037
- error: !1,
1038
- status: n.status,
1039
- variable: o
1040
- };
1041
- } catch (n) {
1042
- return {
1043
- error: !0,
1044
- status: 500,
1045
- message: n instanceof Error ? n.message : "An unknown error occurred"
1046
- };
1010
+ throw new Error(o.message || "Failed to create Figma variable.");
1047
1011
  }
1048
- }
1049
- const Sr = () => {
1050
- const e = ie(), [r, t] = M(!1), [n, o] = M(null), [a, i] = M(null);
1051
- return { createVariable: ae(
1052
- async (E) => {
1053
- if (!e) {
1054
- o("Figma API token is not provided.");
1055
- return;
1056
- }
1057
- t(!0), o(null);
1058
- const g = await ur(e, E);
1059
- i(g), g.error && o(g.message || "An error occurred."), t(!1);
1060
- },
1061
- [e]
1062
- ), loading: r, error: n, data: a };
1063
- };
1064
- async function lr(e, r) {
1065
- const t = `https://api.figma.com/v1/variables/${r}`;
1066
- try {
1067
- const n = await fetch(t, {
1068
- method: "DELETE",
1069
- headers: {
1070
- "Content-Type": "application/json",
1071
- "X-FIGMA-TOKEN": e
1072
- }
1073
- });
1074
- if (!n.ok) {
1075
- const o = await n.json();
1076
- return {
1077
- error: !0,
1078
- status: n.status,
1079
- message: o.message || "Failed to delete Figma variable"
1080
- };
1012
+ return n.json();
1013
+ }, mn = async (e, t) => {
1014
+ if (!e)
1015
+ throw new Error("A Figma API token is required.");
1016
+ const n = `https://api.figma.com/v1/variables/${t}`, o = await fetch(n, {
1017
+ method: "DELETE",
1018
+ headers: {
1019
+ "Content-Type": "application/json",
1020
+ "X-FIGMA-TOKEN": e
1081
1021
  }
1082
- return {
1083
- error: !1,
1084
- status: n.status
1085
- };
1086
- } catch (n) {
1087
- return {
1088
- error: !0,
1089
- status: 500,
1090
- message: n instanceof Error ? n.message : "An unknown error occurred"
1091
- };
1022
+ });
1023
+ if (!o.ok) {
1024
+ const s = await o.json();
1025
+ throw new Error(s.message || "Failed to delete Figma variable.");
1092
1026
  }
1093
- }
1094
- const br = () => {
1095
- const e = ie(), [r, t] = M(!1), [n, o] = M(null), [a, i] = M(null);
1096
- return { deleteVariable: ae(
1097
- async (E) => {
1098
- if (!e) {
1099
- o("Figma API token is not provided.");
1100
- return;
1101
- }
1102
- t(!0), o(null);
1103
- const g = await lr(e, E);
1104
- i(g), g.error && o(g.message || "An error occurred."), t(!1);
1027
+ }, En = async (e, t, n) => {
1028
+ if (!e)
1029
+ throw new Error("A Figma API token is required.");
1030
+ const o = `https://api.figma.com/v1/variables/${t}`, s = await fetch(o, {
1031
+ method: "PUT",
1032
+ headers: {
1033
+ "Content-Type": "application/json",
1034
+ "X-FIGMA-TOKEN": e
1105
1035
  },
1106
- [e]
1107
- ), loading: r, error: n, data: a };
1108
- };
1109
- async function fr(e, r, t) {
1110
- const n = `https://api.figma.com/v1/variables/${r}`;
1111
- try {
1112
- const o = await fetch(n, {
1113
- method: "PUT",
1114
- headers: {
1115
- "Content-Type": "application/json",
1116
- "X-FIGMA-TOKEN": e
1117
- },
1118
- body: JSON.stringify(t)
1119
- });
1120
- if (!o.ok) {
1121
- const a = await o.json();
1122
- return {
1123
- error: !0,
1124
- status: o.status,
1125
- message: a.message || "Failed to update Figma variable"
1126
- };
1127
- }
1128
- return {
1129
- error: !1,
1130
- status: o.status
1131
- };
1132
- } catch (o) {
1133
- return {
1134
- error: !0,
1135
- status: 500,
1136
- message: o instanceof Error ? o.message : "An unknown error occurred"
1137
- };
1036
+ body: JSON.stringify(n)
1037
+ });
1038
+ if (!s.ok) {
1039
+ const a = await s.json();
1040
+ throw new Error(a.message || "Failed to update Figma variable.");
1138
1041
  }
1139
- }
1140
- const Or = () => {
1141
- const e = ie(), [r, t] = M(!1), [n, o] = M(null), [a, i] = M(null);
1142
- return { updateVariable: ae(
1143
- async (E, g) => {
1144
- if (!e) {
1145
- o("Figma API token is not provided.");
1146
- return;
1147
- }
1148
- t(!0), o(null);
1149
- const v = await fr(e, E, g);
1150
- i(v), v.error && o(v.message || "An error occurred."), t(!1);
1151
- },
1152
- [e]
1153
- ), loading: r, error: n, data: a };
1154
1042
  };
1155
- function Rr(e, r) {
1156
- return e.filter((t) => {
1157
- let n = !0;
1158
- return r.resolvedType && (n = n && t.resolvedType === r.resolvedType), r.name && (n = n && t.name.includes(r.name)), n;
1043
+ function pn(e, t) {
1044
+ return e.filter((n) => {
1045
+ let o = !0;
1046
+ return t.resolvedType && (o = o && n.resolvedType === t.resolvedType), t.name && (o = o && n.name.includes(t.name)), o;
1159
1047
  });
1160
1048
  }
1161
1049
  export {
1162
- Er as FigmaVarsProvider,
1163
- Ye as fetchWithAuth,
1164
- Rr as filterVariables,
1165
- pr as getFigmaToken,
1166
- hr as useBulkUpdateVariables,
1167
- Sr as useCreateVariable,
1168
- br as useDeleteVariable,
1169
- ie as useFigmaToken,
1170
- Or as useUpdateVariable,
1171
- gr as useVariableCollections,
1172
- _r as useVariableModes,
1173
- vr as useVariables
1050
+ an as FigmaVarsProvider,
1051
+ fn as bulkUpdateVariables,
1052
+ dn as createVariable,
1053
+ mn as deleteVariable,
1054
+ pn as filterVariables,
1055
+ En as updateVariable,
1056
+ cn as useFigmaToken,
1057
+ un as useVariableCollections,
1058
+ ln as useVariableModes,
1059
+ pt as useVariables
1174
1060
  };