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