@animaapp/anima-sdk-react 0.7.3 → 0.8.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.
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +500 -500
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -11,23 +11,23 @@ var Ct = (e, t, n) => t in e ? ln(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
11
11
|
return e;
|
|
12
12
|
}, At = (e, t) => fn(e, dn(t));
|
|
13
13
|
var oe = (e, t, n) => new Promise((r, s) => {
|
|
14
|
-
var
|
|
14
|
+
var i = (d) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
16
|
+
l(n.next(d));
|
|
17
17
|
} catch (_) {
|
|
18
18
|
s(_);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, u = (d) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
22
|
+
l(n.throw(d));
|
|
23
23
|
} catch (_) {
|
|
24
24
|
s(_);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, l = (d) => d.done ? r(d.value) : Promise.resolve(d.value).then(i, u);
|
|
27
|
+
l((n = n.apply(e, t)).next());
|
|
28
28
|
});
|
|
29
29
|
import Oe, { createContext as Bt, useState as nt, useRef as le, useEffect as Ht, useContext as zt, useCallback as Ve, useLayoutEffect as En, useMemo as Kt, useDebugValue as mn } from "react";
|
|
30
|
-
import { CodegenError as Ye
|
|
30
|
+
import { CodegenError as Ye } from "@animaapp/anima-sdk";
|
|
31
31
|
var Pe = { exports: {} }, Ce = {};
|
|
32
32
|
/**
|
|
33
33
|
* @license React
|
|
@@ -39,23 +39,23 @@ var Pe = { exports: {} }, Ce = {};
|
|
|
39
39
|
* LICENSE file in the root directory of this source tree.
|
|
40
40
|
*/
|
|
41
41
|
var Lt;
|
|
42
|
-
function
|
|
42
|
+
function gn() {
|
|
43
43
|
if (Lt) return Ce;
|
|
44
44
|
Lt = 1;
|
|
45
45
|
var e = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
46
|
-
function n(r, s,
|
|
47
|
-
var
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
for (var
|
|
51
|
-
|
|
52
|
-
} else
|
|
53
|
-
return s =
|
|
46
|
+
function n(r, s, i) {
|
|
47
|
+
var u = null;
|
|
48
|
+
if (i !== void 0 && (u = "" + i), s.key !== void 0 && (u = "" + s.key), "key" in s) {
|
|
49
|
+
i = {};
|
|
50
|
+
for (var l in s)
|
|
51
|
+
l !== "key" && (i[l] = s[l]);
|
|
52
|
+
} else i = s;
|
|
53
|
+
return s = i.ref, {
|
|
54
54
|
$$typeof: e,
|
|
55
55
|
type: r,
|
|
56
|
-
key:
|
|
56
|
+
key: u,
|
|
57
57
|
ref: s !== void 0 ? s : null,
|
|
58
|
-
props:
|
|
58
|
+
props: i
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
return Ce.Fragment = t, Ce.jsx = n, Ce.jsxs = n, Ce;
|
|
@@ -71,187 +71,187 @@ var Ae = {};
|
|
|
71
71
|
* LICENSE file in the root directory of this source tree.
|
|
72
72
|
*/
|
|
73
73
|
var xt;
|
|
74
|
-
function
|
|
74
|
+
function vn() {
|
|
75
75
|
return xt || (xt = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
76
|
-
function e(
|
|
77
|
-
if (
|
|
78
|
-
if (typeof
|
|
79
|
-
return
|
|
80
|
-
if (typeof
|
|
81
|
-
switch (
|
|
82
|
-
case
|
|
76
|
+
function e(a) {
|
|
77
|
+
if (a == null) return null;
|
|
78
|
+
if (typeof a == "function")
|
|
79
|
+
return a.$$typeof === U ? null : a.displayName || a.name || null;
|
|
80
|
+
if (typeof a == "string") return a;
|
|
81
|
+
switch (a) {
|
|
82
|
+
case c:
|
|
83
83
|
return "Fragment";
|
|
84
|
-
case
|
|
84
|
+
case o:
|
|
85
85
|
return "Profiler";
|
|
86
86
|
case f:
|
|
87
87
|
return "StrictMode";
|
|
88
88
|
case T:
|
|
89
89
|
return "Suspense";
|
|
90
|
-
case
|
|
90
|
+
case F:
|
|
91
91
|
return "SuspenseList";
|
|
92
92
|
case K:
|
|
93
93
|
return "Activity";
|
|
94
94
|
}
|
|
95
|
-
if (typeof
|
|
96
|
-
switch (typeof
|
|
95
|
+
if (typeof a == "object")
|
|
96
|
+
switch (typeof a.tag == "number" && console.error(
|
|
97
97
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
98
|
-
),
|
|
99
|
-
case
|
|
98
|
+
), a.$$typeof) {
|
|
99
|
+
case p:
|
|
100
100
|
return "Portal";
|
|
101
|
-
case I:
|
|
102
|
-
return (o.displayName || "Context") + ".Provider";
|
|
103
|
-
case g:
|
|
104
|
-
return (o._context.displayName || "Context") + ".Consumer";
|
|
105
101
|
case k:
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
return (a.displayName || "Context") + ".Provider";
|
|
103
|
+
case g:
|
|
104
|
+
return (a._context.displayName || "Context") + ".Consumer";
|
|
105
|
+
case N:
|
|
106
|
+
var v = a.render;
|
|
107
|
+
return a = a.displayName, a || (a = v.displayName || v.name || "", a = a !== "" ? "ForwardRef(" + a + ")" : "ForwardRef"), a;
|
|
108
108
|
case $:
|
|
109
|
-
return v =
|
|
109
|
+
return v = a.displayName || null, v !== null ? v : e(a.type) || "Memo";
|
|
110
110
|
case b:
|
|
111
|
-
v =
|
|
111
|
+
v = a._payload, a = a._init;
|
|
112
112
|
try {
|
|
113
|
-
return e(
|
|
113
|
+
return e(a(v));
|
|
114
114
|
} catch (O) {
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
return null;
|
|
118
118
|
}
|
|
119
|
-
function t(
|
|
120
|
-
return "" +
|
|
119
|
+
function t(a) {
|
|
120
|
+
return "" + a;
|
|
121
121
|
}
|
|
122
|
-
function n(
|
|
122
|
+
function n(a) {
|
|
123
123
|
try {
|
|
124
|
-
t(
|
|
124
|
+
t(a);
|
|
125
125
|
var v = !1;
|
|
126
126
|
} catch (H) {
|
|
127
127
|
v = !0;
|
|
128
128
|
}
|
|
129
129
|
if (v) {
|
|
130
130
|
v = console;
|
|
131
|
-
var O = v.error,
|
|
131
|
+
var O = v.error, I = typeof Symbol == "function" && Symbol.toStringTag && a[Symbol.toStringTag] || a.constructor.name || "Object";
|
|
132
132
|
return O.call(
|
|
133
133
|
v,
|
|
134
134
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
135
|
-
|
|
136
|
-
), t(
|
|
135
|
+
I
|
|
136
|
+
), t(a);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
function r(
|
|
140
|
-
if (
|
|
141
|
-
if (typeof
|
|
139
|
+
function r(a) {
|
|
140
|
+
if (a === c) return "<>";
|
|
141
|
+
if (typeof a == "object" && a !== null && a.$$typeof === b)
|
|
142
142
|
return "<...>";
|
|
143
143
|
try {
|
|
144
|
-
var v = e(
|
|
144
|
+
var v = e(a);
|
|
145
145
|
return v ? "<" + v + ">" : "<...>";
|
|
146
146
|
} catch (O) {
|
|
147
147
|
return "<...>";
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
function s() {
|
|
151
|
-
var
|
|
152
|
-
return
|
|
151
|
+
var a = B.A;
|
|
152
|
+
return a === null ? null : a.getOwner();
|
|
153
153
|
}
|
|
154
|
-
function
|
|
154
|
+
function i() {
|
|
155
155
|
return Error("react-stack-top-frame");
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
if (Q.call(
|
|
159
|
-
var v = Object.getOwnPropertyDescriptor(
|
|
157
|
+
function u(a) {
|
|
158
|
+
if (Q.call(a, "key")) {
|
|
159
|
+
var v = Object.getOwnPropertyDescriptor(a, "key").get;
|
|
160
160
|
if (v && v.isReactWarning) return !1;
|
|
161
161
|
}
|
|
162
|
-
return
|
|
162
|
+
return a.key !== void 0;
|
|
163
163
|
}
|
|
164
|
-
function a
|
|
164
|
+
function l(a, v) {
|
|
165
165
|
function O() {
|
|
166
166
|
ce || (ce = !0, console.error(
|
|
167
167
|
"%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)",
|
|
168
168
|
v
|
|
169
169
|
));
|
|
170
170
|
}
|
|
171
|
-
O.isReactWarning = !0, Object.defineProperty(
|
|
171
|
+
O.isReactWarning = !0, Object.defineProperty(a, "key", {
|
|
172
172
|
get: O,
|
|
173
173
|
configurable: !0
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
var
|
|
178
|
-
return ye[
|
|
176
|
+
function d() {
|
|
177
|
+
var a = e(this.type);
|
|
178
|
+
return ye[a] || (ye[a] = !0, console.error(
|
|
179
179
|
"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."
|
|
180
|
-
)),
|
|
180
|
+
)), a = this.props.ref, a !== void 0 ? a : null;
|
|
181
181
|
}
|
|
182
|
-
function _(
|
|
183
|
-
return O = G.ref,
|
|
184
|
-
$$typeof:
|
|
185
|
-
type:
|
|
182
|
+
function _(a, v, O, I, H, G, Ee, me) {
|
|
183
|
+
return O = G.ref, a = {
|
|
184
|
+
$$typeof: h,
|
|
185
|
+
type: a,
|
|
186
186
|
key: v,
|
|
187
187
|
props: G,
|
|
188
188
|
_owner: H
|
|
189
|
-
}, (O !== void 0 ? O : null) !== null ? Object.defineProperty(
|
|
189
|
+
}, (O !== void 0 ? O : null) !== null ? Object.defineProperty(a, "ref", {
|
|
190
190
|
enumerable: !1,
|
|
191
|
-
get:
|
|
192
|
-
}) : Object.defineProperty(
|
|
191
|
+
get: d
|
|
192
|
+
}) : Object.defineProperty(a, "ref", { enumerable: !1, value: null }), a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
193
193
|
configurable: !1,
|
|
194
194
|
enumerable: !1,
|
|
195
195
|
writable: !0,
|
|
196
196
|
value: 0
|
|
197
|
-
}), Object.defineProperty(
|
|
197
|
+
}), Object.defineProperty(a, "_debugInfo", {
|
|
198
198
|
configurable: !1,
|
|
199
199
|
enumerable: !1,
|
|
200
200
|
writable: !0,
|
|
201
201
|
value: null
|
|
202
|
-
}), Object.defineProperty(
|
|
202
|
+
}), Object.defineProperty(a, "_debugStack", {
|
|
203
203
|
configurable: !1,
|
|
204
204
|
enumerable: !1,
|
|
205
205
|
writable: !0,
|
|
206
206
|
value: Ee
|
|
207
|
-
}), Object.defineProperty(
|
|
207
|
+
}), Object.defineProperty(a, "_debugTask", {
|
|
208
208
|
configurable: !1,
|
|
209
209
|
enumerable: !1,
|
|
210
210
|
writable: !0,
|
|
211
211
|
value: me
|
|
212
|
-
}), Object.freeze && (Object.freeze(
|
|
212
|
+
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
213
213
|
}
|
|
214
|
-
function w(
|
|
214
|
+
function w(a, v, O, I, H, G, Ee, me) {
|
|
215
215
|
var P = v.children;
|
|
216
216
|
if (P !== void 0)
|
|
217
|
-
if (
|
|
217
|
+
if (I)
|
|
218
218
|
if (q(P)) {
|
|
219
|
-
for (
|
|
220
|
-
|
|
219
|
+
for (I = 0; I < P.length; I++)
|
|
220
|
+
m(P[I]);
|
|
221
221
|
Object.freeze && Object.freeze(P);
|
|
222
222
|
} else
|
|
223
223
|
console.error(
|
|
224
224
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
225
225
|
);
|
|
226
|
-
else
|
|
226
|
+
else m(P);
|
|
227
227
|
if (Q.call(v, "key")) {
|
|
228
|
-
P = e(
|
|
228
|
+
P = e(a);
|
|
229
229
|
var ue = Object.keys(v).filter(function(je) {
|
|
230
230
|
return je !== "key";
|
|
231
231
|
});
|
|
232
|
-
|
|
232
|
+
I = 0 < ue.length ? "{key: someKey, " + ue.join(": ..., ") + ": ...}" : "{key: someKey}", Te[P + I] || (ue = 0 < ue.length ? "{" + ue.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
233
233
|
`A props object containing a "key" prop is being spread into JSX:
|
|
234
234
|
let props = %s;
|
|
235
235
|
<%s {...props} />
|
|
236
236
|
React keys must be passed directly to JSX without using spread:
|
|
237
237
|
let props = %s;
|
|
238
238
|
<%s key={someKey} {...props} />`,
|
|
239
|
-
|
|
239
|
+
I,
|
|
240
240
|
P,
|
|
241
241
|
ue,
|
|
242
242
|
P
|
|
243
|
-
), Te[P +
|
|
243
|
+
), Te[P + I] = !0);
|
|
244
244
|
}
|
|
245
|
-
if (P = null, O !== void 0 && (n(O), P = "" + O),
|
|
245
|
+
if (P = null, O !== void 0 && (n(O), P = "" + O), u(v) && (n(v.key), P = "" + v.key), "key" in v) {
|
|
246
246
|
O = {};
|
|
247
247
|
for (var ne in v)
|
|
248
248
|
ne !== "key" && (O[ne] = v[ne]);
|
|
249
249
|
} else O = v;
|
|
250
|
-
return P &&
|
|
250
|
+
return P && l(
|
|
251
251
|
O,
|
|
252
|
-
typeof
|
|
252
|
+
typeof a == "function" ? a.displayName || a.name || "Unknown" : a
|
|
253
253
|
), _(
|
|
254
|
-
|
|
254
|
+
a,
|
|
255
255
|
P,
|
|
256
256
|
G,
|
|
257
257
|
H,
|
|
@@ -261,53 +261,53 @@ React keys must be passed directly to JSX without using spread:
|
|
|
261
261
|
me
|
|
262
262
|
);
|
|
263
263
|
}
|
|
264
|
-
function
|
|
265
|
-
typeof
|
|
264
|
+
function m(a) {
|
|
265
|
+
typeof a == "object" && a !== null && a.$$typeof === h && a._store && (a._store.validated = 1);
|
|
266
266
|
}
|
|
267
|
-
var
|
|
267
|
+
var E = Oe, h = Symbol.for("react.transitional.element"), p = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), f = Symbol.for("react.strict_mode"), o = Symbol.for("react.profiler"), g = Symbol.for("react.consumer"), k = Symbol.for("react.context"), N = Symbol.for("react.forward_ref"), T = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), $ = Symbol.for("react.memo"), b = Symbol.for("react.lazy"), K = Symbol.for("react.activity"), U = Symbol.for("react.client.reference"), B = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Q = Object.prototype.hasOwnProperty, q = Array.isArray, C = console.createTask ? console.createTask : function() {
|
|
268
268
|
return null;
|
|
269
269
|
};
|
|
270
|
-
|
|
271
|
-
react_stack_bottom_frame: function(
|
|
272
|
-
return
|
|
270
|
+
E = {
|
|
271
|
+
react_stack_bottom_frame: function(a) {
|
|
272
|
+
return a();
|
|
273
273
|
}
|
|
274
274
|
};
|
|
275
|
-
var ce, ye = {}, be =
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
)(), te = C(r(
|
|
279
|
-
Ae.Fragment =
|
|
275
|
+
var ce, ye = {}, be = E.react_stack_bottom_frame.bind(
|
|
276
|
+
E,
|
|
277
|
+
i
|
|
278
|
+
)(), te = C(r(i)), Te = {};
|
|
279
|
+
Ae.Fragment = c, Ae.jsx = function(a, v, O, I, H) {
|
|
280
280
|
var G = 1e4 > B.recentlyCreatedOwnerStacks++;
|
|
281
281
|
return w(
|
|
282
|
-
|
|
282
|
+
a,
|
|
283
283
|
v,
|
|
284
284
|
O,
|
|
285
285
|
!1,
|
|
286
|
-
|
|
286
|
+
I,
|
|
287
287
|
H,
|
|
288
288
|
G ? Error("react-stack-top-frame") : be,
|
|
289
|
-
G ? C(r(
|
|
289
|
+
G ? C(r(a)) : te
|
|
290
290
|
);
|
|
291
|
-
}, Ae.jsxs = function(
|
|
291
|
+
}, Ae.jsxs = function(a, v, O, I, H) {
|
|
292
292
|
var G = 1e4 > B.recentlyCreatedOwnerStacks++;
|
|
293
293
|
return w(
|
|
294
|
-
|
|
294
|
+
a,
|
|
295
295
|
v,
|
|
296
296
|
O,
|
|
297
297
|
!0,
|
|
298
|
-
|
|
298
|
+
I,
|
|
299
299
|
H,
|
|
300
300
|
G ? Error("react-stack-top-frame") : be,
|
|
301
|
-
G ? C(r(
|
|
301
|
+
G ? C(r(a)) : te
|
|
302
302
|
);
|
|
303
303
|
};
|
|
304
304
|
})()), Ae;
|
|
305
305
|
}
|
|
306
306
|
var Nt;
|
|
307
|
-
function
|
|
308
|
-
return Nt || (Nt = 1, process.env.NODE_ENV === "production" ? Pe.exports =
|
|
307
|
+
function _n() {
|
|
308
|
+
return Nt || (Nt = 1, process.env.NODE_ENV === "production" ? Pe.exports = gn() : Pe.exports = vn()), Pe.exports;
|
|
309
309
|
}
|
|
310
|
-
var
|
|
310
|
+
var Sn = _n();
|
|
311
311
|
class It extends Error {
|
|
312
312
|
constructor(t, n) {
|
|
313
313
|
super(t), this.name = "ParseError", this.type = n.type, this.field = n.field, this.value = n.value, this.line = n.line;
|
|
@@ -315,95 +315,95 @@ class It extends Error {
|
|
|
315
315
|
}
|
|
316
316
|
function Be(e) {
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function wn(e) {
|
|
319
319
|
if (typeof e == "function")
|
|
320
320
|
throw new TypeError(
|
|
321
321
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
322
322
|
);
|
|
323
323
|
const { onEvent: t = Be, onError: n = Be, onRetry: r = Be, onComment: s } = e;
|
|
324
|
-
let
|
|
325
|
-
function w(
|
|
326
|
-
const f =
|
|
327
|
-
for (const
|
|
328
|
-
|
|
329
|
-
|
|
324
|
+
let i = "", u = !0, l, d = "", _ = "";
|
|
325
|
+
function w(c) {
|
|
326
|
+
const f = u ? c.replace(/^\xEF\xBB\xBF/, "") : c, [o, g] = Rn(`${i}${f}`);
|
|
327
|
+
for (const k of o)
|
|
328
|
+
m(k);
|
|
329
|
+
i = g, u = !1;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
332
|
-
if (
|
|
333
|
-
|
|
331
|
+
function m(c) {
|
|
332
|
+
if (c === "") {
|
|
333
|
+
h();
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
|
-
if (
|
|
337
|
-
s && s(
|
|
336
|
+
if (c.startsWith(":")) {
|
|
337
|
+
s && s(c.slice(c.startsWith(": ") ? 2 : 1));
|
|
338
338
|
return;
|
|
339
339
|
}
|
|
340
|
-
const f =
|
|
340
|
+
const f = c.indexOf(":");
|
|
341
341
|
if (f !== -1) {
|
|
342
|
-
const
|
|
343
|
-
|
|
342
|
+
const o = c.slice(0, f), g = c[f + 1] === " " ? 2 : 1, k = c.slice(f + g);
|
|
343
|
+
E(o, k, c);
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
E(c, "", c);
|
|
347
347
|
}
|
|
348
|
-
function
|
|
349
|
-
switch (
|
|
348
|
+
function E(c, f, o) {
|
|
349
|
+
switch (c) {
|
|
350
350
|
case "event":
|
|
351
351
|
_ = f;
|
|
352
352
|
break;
|
|
353
353
|
case "data":
|
|
354
|
-
|
|
354
|
+
d = `${d}${f}
|
|
355
355
|
`;
|
|
356
356
|
break;
|
|
357
357
|
case "id":
|
|
358
|
-
|
|
358
|
+
l = f.includes("\0") ? void 0 : f;
|
|
359
359
|
break;
|
|
360
360
|
case "retry":
|
|
361
361
|
/^\d+$/.test(f) ? r(parseInt(f, 10)) : n(
|
|
362
362
|
new It(`Invalid \`retry\` value: "${f}"`, {
|
|
363
363
|
type: "invalid-retry",
|
|
364
364
|
value: f,
|
|
365
|
-
line:
|
|
365
|
+
line: o
|
|
366
366
|
})
|
|
367
367
|
);
|
|
368
368
|
break;
|
|
369
369
|
default:
|
|
370
370
|
n(
|
|
371
371
|
new It(
|
|
372
|
-
`Unknown field "${
|
|
373
|
-
{ type: "unknown-field", field:
|
|
372
|
+
`Unknown field "${c.length > 20 ? `${c.slice(0, 20)}…` : c}"`,
|
|
373
|
+
{ type: "unknown-field", field: c, value: f, line: o }
|
|
374
374
|
)
|
|
375
375
|
);
|
|
376
376
|
break;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
function
|
|
380
|
-
|
|
381
|
-
id:
|
|
379
|
+
function h() {
|
|
380
|
+
d.length > 0 && t({
|
|
381
|
+
id: l,
|
|
382
382
|
event: _ || void 0,
|
|
383
383
|
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
384
384
|
// then remove the last character from the data buffer.
|
|
385
|
-
data:
|
|
386
|
-
`) ?
|
|
387
|
-
}),
|
|
385
|
+
data: d.endsWith(`
|
|
386
|
+
`) ? d.slice(0, -1) : d
|
|
387
|
+
}), l = void 0, d = "", _ = "";
|
|
388
388
|
}
|
|
389
|
-
function
|
|
390
|
-
|
|
389
|
+
function p(c = {}) {
|
|
390
|
+
i && c.consume && m(i), u = !0, l = void 0, d = "", _ = "", i = "";
|
|
391
391
|
}
|
|
392
|
-
return { feed: w, reset:
|
|
392
|
+
return { feed: w, reset: p };
|
|
393
393
|
}
|
|
394
|
-
function
|
|
394
|
+
function Rn(e) {
|
|
395
395
|
const t = [];
|
|
396
396
|
let n = "", r = 0;
|
|
397
397
|
for (; r < e.length; ) {
|
|
398
|
-
const s = e.indexOf("\r", r),
|
|
398
|
+
const s = e.indexOf("\r", r), i = e.indexOf(`
|
|
399
399
|
`, r);
|
|
400
|
-
let
|
|
401
|
-
if (s !== -1 &&
|
|
400
|
+
let u = -1;
|
|
401
|
+
if (s !== -1 && i !== -1 ? u = Math.min(s, i) : s !== -1 ? s === e.length - 1 ? u = -1 : u = s : i !== -1 && (u = i), u === -1) {
|
|
402
402
|
n = e.slice(r);
|
|
403
403
|
break;
|
|
404
404
|
} else {
|
|
405
|
-
const
|
|
406
|
-
t.push(
|
|
405
|
+
const l = e.slice(r, u);
|
|
406
|
+
t.push(l), r = u + 1, e[r - 1] === "\r" && e[r] === `
|
|
407
407
|
` && r++;
|
|
408
408
|
}
|
|
409
409
|
}
|
|
@@ -451,7 +451,7 @@ class kt extends Event {
|
|
|
451
451
|
return t(Dt(this), n);
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
-
function
|
|
454
|
+
function On(e) {
|
|
455
455
|
const t = globalThis.DOMException;
|
|
456
456
|
return typeof t == "function" ? new t(e, "SyntaxError") : new SyntaxError(e);
|
|
457
457
|
}
|
|
@@ -474,15 +474,15 @@ var Xt = (e) => {
|
|
|
474
474
|
class Ue extends EventTarget {
|
|
475
475
|
constructor(t, n) {
|
|
476
476
|
var r, s;
|
|
477
|
-
super(), j(this, Z), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, j(this, Y), j(this, pe), j(this, ve), j(this, $e), j(this, qe), j(this, Ne), j(this, we), j(this, Ie, null), j(this, fe), j(this, _e), j(this, Re, null), j(this, Se, null), j(this, Le, null), j(this, ot, (
|
|
478
|
-
var
|
|
477
|
+
super(), j(this, Z), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, j(this, Y), j(this, pe), j(this, ve), j(this, $e), j(this, qe), j(this, Ne), j(this, we), j(this, Ie, null), j(this, fe), j(this, _e), j(this, Re, null), j(this, Se, null), j(this, Le, null), j(this, ot, (i) => oe(this, null, function* () {
|
|
478
|
+
var u;
|
|
479
479
|
S(this, _e).reset();
|
|
480
|
-
const { body:
|
|
480
|
+
const { body: l, redirected: d, status: _, headers: w } = i;
|
|
481
481
|
if (_ === 204) {
|
|
482
482
|
ae(this, Z, xe).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
|
|
483
483
|
return;
|
|
484
484
|
}
|
|
485
|
-
if (
|
|
485
|
+
if (d ? L(this, ve, new URL(i.url)) : L(this, ve, void 0), _ !== 200) {
|
|
486
486
|
ae(this, Z, xe).call(this, `Non-200 status code (${_})`, _);
|
|
487
487
|
return;
|
|
488
488
|
}
|
|
@@ -493,29 +493,29 @@ class Ue extends EventTarget {
|
|
|
493
493
|
if (S(this, Y) === this.CLOSED)
|
|
494
494
|
return;
|
|
495
495
|
L(this, Y, this.OPEN);
|
|
496
|
-
const
|
|
497
|
-
if ((
|
|
496
|
+
const m = new Event("open");
|
|
497
|
+
if ((u = S(this, Le)) == null || u.call(this, m), this.dispatchEvent(m), typeof l != "object" || !l || !("getReader" in l)) {
|
|
498
498
|
ae(this, Z, xe).call(this, "Invalid response body, expected a web ReadableStream", _), this.close();
|
|
499
499
|
return;
|
|
500
500
|
}
|
|
501
|
-
const
|
|
502
|
-
let
|
|
501
|
+
const E = new TextDecoder(), h = l.getReader();
|
|
502
|
+
let p = !0;
|
|
503
503
|
do {
|
|
504
|
-
const { done:
|
|
505
|
-
f && S(this, _e).feed(
|
|
506
|
-
} while (
|
|
507
|
-
})), j(this, at, (
|
|
508
|
-
L(this, fe, void 0), !(
|
|
509
|
-
}), j(this, it, (
|
|
510
|
-
typeof
|
|
511
|
-
const
|
|
512
|
-
data:
|
|
504
|
+
const { done: c, value: f } = yield h.read();
|
|
505
|
+
f && S(this, _e).feed(E.decode(f, { stream: !c })), c && (p = !1, S(this, _e).reset(), ae(this, Z, ut).call(this));
|
|
506
|
+
} while (p);
|
|
507
|
+
})), j(this, at, (i) => {
|
|
508
|
+
L(this, fe, void 0), !(i.name === "AbortError" || i.type === "aborted") && ae(this, Z, ut).call(this, st(i));
|
|
509
|
+
}), j(this, it, (i) => {
|
|
510
|
+
typeof i.id == "string" && L(this, Ie, i.id);
|
|
511
|
+
const u = new MessageEvent(i.event || "message", {
|
|
512
|
+
data: i.data,
|
|
513
513
|
origin: S(this, ve) ? S(this, ve).origin : S(this, pe).origin,
|
|
514
|
-
lastEventId:
|
|
514
|
+
lastEventId: i.id || ""
|
|
515
515
|
});
|
|
516
|
-
S(this, Se) && (!
|
|
517
|
-
}), j(this, ct, (
|
|
518
|
-
L(this, Ne,
|
|
516
|
+
S(this, Se) && (!i.event || i.event === "message") && S(this, Se).call(this, u), this.dispatchEvent(u);
|
|
517
|
+
}), j(this, ct, (i) => {
|
|
518
|
+
L(this, Ne, i);
|
|
519
519
|
}), j(this, lt, () => {
|
|
520
520
|
L(this, we, void 0), S(this, Y) === this.CONNECTING && ae(this, Z, rt).call(this);
|
|
521
521
|
});
|
|
@@ -523,13 +523,13 @@ class Ue extends EventTarget {
|
|
|
523
523
|
if (t instanceof URL)
|
|
524
524
|
L(this, pe, t);
|
|
525
525
|
else if (typeof t == "string")
|
|
526
|
-
L(this, pe, new URL(t,
|
|
526
|
+
L(this, pe, new URL(t, yn()));
|
|
527
527
|
else
|
|
528
528
|
throw new Error("Invalid URL");
|
|
529
|
-
} catch (
|
|
530
|
-
throw
|
|
529
|
+
} catch (i) {
|
|
530
|
+
throw On("An invalid or illegal string was specified");
|
|
531
531
|
}
|
|
532
|
-
L(this, _e,
|
|
532
|
+
L(this, _e, wn({
|
|
533
533
|
onEvent: S(this, it),
|
|
534
534
|
onRetry: S(this, ct)
|
|
535
535
|
})), L(this, Y, this.CONNECTING), L(this, Ne, 3e3), L(this, qe, (r = n == null ? void 0 : n.fetch) != null ? r : globalThis.fetch), L(this, $e, (s = n == null ? void 0 : n.withCredentials) != null ? s : !1), ae(this, Z, rt).call(this);
|
|
@@ -672,11 +672,11 @@ Ue.OPEN = 1, /**
|
|
|
672
672
|
* @public
|
|
673
673
|
*/
|
|
674
674
|
Ue.CLOSED = 2;
|
|
675
|
-
function
|
|
675
|
+
function yn() {
|
|
676
676
|
const e = "document" in globalThis ? globalThis.document : void 0;
|
|
677
677
|
return e && typeof e == "object" && "baseURI" in e && typeof e.baseURI == "string" ? e.baseURI : void 0;
|
|
678
678
|
}
|
|
679
|
-
const
|
|
679
|
+
const bn = (e) => {
|
|
680
680
|
let t = "";
|
|
681
681
|
const n = new Uint8Array(e), r = n.byteLength;
|
|
682
682
|
for (let s = 0; s < r; s++)
|
|
@@ -702,263 +702,264 @@ const Tn = (e) => {
|
|
|
702
702
|
filePath: e.filePath.replace(/^\//, ""),
|
|
703
703
|
referencePath: e.referencePath === "/" ? "" : e.referencePath
|
|
704
704
|
}, Zt = (e, t, n, r) => oe(null, null, function* () {
|
|
705
|
-
var _, w,
|
|
705
|
+
var _, w, m;
|
|
706
706
|
const s = structuredClone(St);
|
|
707
707
|
s.status = "pending", r(D({}, s));
|
|
708
|
-
const
|
|
708
|
+
const i = structuredClone(n);
|
|
709
709
|
if (((_ = n.assetsStorage) == null ? void 0 : _.strategy) === "local") {
|
|
710
|
-
const { referencePath:
|
|
710
|
+
const { referencePath: E } = Mt(
|
|
711
711
|
n.assetsStorage
|
|
712
712
|
);
|
|
713
713
|
n.assetsStorage = {
|
|
714
714
|
strategy: "external",
|
|
715
|
-
url:
|
|
715
|
+
url: E
|
|
716
716
|
};
|
|
717
717
|
}
|
|
718
|
-
let
|
|
719
|
-
const
|
|
720
|
-
fetch: (
|
|
718
|
+
let u;
|
|
719
|
+
const l = new Ue(e, {
|
|
720
|
+
fetch: (E, h) => (u = fetch(E, At(D({}, h), {
|
|
721
721
|
method: t,
|
|
722
722
|
body: JSON.stringify(n)
|
|
723
|
-
})),
|
|
724
|
-
}),
|
|
725
|
-
const
|
|
726
|
-
|
|
727
|
-
const
|
|
728
|
-
|
|
729
|
-
}),
|
|
730
|
-
const
|
|
731
|
-
s.jobSessionId =
|
|
732
|
-
}),
|
|
723
|
+
})), u)
|
|
724
|
+
}), d = new Promise((E, h) => {
|
|
725
|
+
const p = {};
|
|
726
|
+
l.addEventListener("start", (f) => {
|
|
727
|
+
const o = JSON.parse(f.data);
|
|
728
|
+
p.sessionId = o.sessionId, s.tasks.fetchDesign.status = "running", s.jobSessionId = o.sessionId, r(D({}, s));
|
|
729
|
+
}), l.addEventListener("queueing", (f) => {
|
|
730
|
+
const o = JSON.parse(f.data);
|
|
731
|
+
s.jobSessionId = o.payload.sessionId, r(D({}, s));
|
|
732
|
+
}), l.addEventListener("pre_codegen", (f) => {
|
|
733
733
|
JSON.parse(
|
|
734
734
|
f.data
|
|
735
735
|
).message === "Anima model built" && (s.tasks.fetchDesign.status = "finished", s.tasks.codeGeneration.status = "running", s.tasks.uploadAssets.status = "running", r(D({}, s)));
|
|
736
|
-
}),
|
|
737
|
-
const
|
|
736
|
+
}), l.addEventListener("figma_metadata", (f) => {
|
|
737
|
+
const o = JSON.parse(
|
|
738
738
|
f.data
|
|
739
739
|
);
|
|
740
|
-
|
|
741
|
-
}),
|
|
740
|
+
p.figmaFileName = o.figmaFileName, p.figmaSelectedFrameName = o.figmaSelectedFrameName;
|
|
741
|
+
}), l.addEventListener("aborted", () => {
|
|
742
742
|
const f = new Ye({ name: "Aborted", reason: "Unknown" });
|
|
743
|
-
s.status = "aborted", s.result = null, s.error = f, r(D({}, s)),
|
|
743
|
+
s.status = "aborted", s.result = null, s.error = f, r(D({}, s)), E({
|
|
744
744
|
result: null,
|
|
745
745
|
error: f
|
|
746
746
|
});
|
|
747
|
-
}),
|
|
748
|
-
const
|
|
747
|
+
}), l.addEventListener("generating_code", (f) => {
|
|
748
|
+
const o = JSON.parse(
|
|
749
749
|
f.data
|
|
750
750
|
);
|
|
751
|
-
|
|
752
|
-
}),
|
|
753
|
-
const
|
|
751
|
+
o.payload.status === "success" && (p.files = o.payload.files), s.tasks.codeGeneration.progress = o.payload.progress, s.tasks.codeGeneration.status = "running", r(D({}, s));
|
|
752
|
+
}), l.addEventListener("progress_messages_updated", (f) => {
|
|
753
|
+
const o = JSON.parse(
|
|
754
754
|
f.data
|
|
755
755
|
);
|
|
756
|
-
s.progressMessages =
|
|
757
|
-
}),
|
|
758
|
-
const
|
|
756
|
+
s.progressMessages = o.payload.progressMessages, r(D({}, s));
|
|
757
|
+
}), l.addEventListener("job_status_updated", (f) => {
|
|
758
|
+
const o = JSON.parse(
|
|
759
759
|
f.data
|
|
760
760
|
);
|
|
761
|
-
s.jobStatus =
|
|
762
|
-
}),
|
|
761
|
+
s.jobStatus = o.payload.jobStatus, r(D({}, s));
|
|
762
|
+
}), l.addEventListener("codegen_completed", () => {
|
|
763
763
|
s.tasks.codeGeneration.status = "finished", r(D({}, s));
|
|
764
|
-
}),
|
|
764
|
+
}), l.addEventListener("generation_completed", () => {
|
|
765
765
|
s.tasks.codeGeneration.status = "finished", r(D({}, s));
|
|
766
|
-
}),
|
|
766
|
+
}), l.addEventListener("assets_uploaded", () => {
|
|
767
767
|
s.tasks.uploadAssets.status = "finished", r(D({}, s));
|
|
768
|
-
}),
|
|
769
|
-
const
|
|
768
|
+
}), l.addEventListener("assets_list", (f) => {
|
|
769
|
+
const o = JSON.parse(
|
|
770
770
|
f.data
|
|
771
771
|
);
|
|
772
|
-
|
|
772
|
+
p.assets = o.payload.assets;
|
|
773
773
|
});
|
|
774
|
-
let
|
|
775
|
-
|
|
776
|
-
var
|
|
777
|
-
const
|
|
778
|
-
if (!
|
|
774
|
+
let c = 0;
|
|
775
|
+
l.addEventListener("error", (f) => oe(null, null, function* () {
|
|
776
|
+
var F, $, b, K, U, B, Q;
|
|
777
|
+
const o = yield u;
|
|
778
|
+
if (!o.ok) {
|
|
779
779
|
let q = "";
|
|
780
780
|
try {
|
|
781
|
-
q = yield
|
|
781
|
+
q = yield o.text();
|
|
782
782
|
const C = JSON.parse(q);
|
|
783
|
-
(
|
|
783
|
+
(F = C == null ? void 0 : C.payload) != null && F.message && (q = C.payload.message);
|
|
784
784
|
} catch (C) {
|
|
785
785
|
}
|
|
786
|
-
|
|
786
|
+
h(
|
|
787
787
|
new Ye({
|
|
788
788
|
name: "Request failed",
|
|
789
789
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
790
790
|
reason: q,
|
|
791
|
-
status:
|
|
791
|
+
status: o.status
|
|
792
792
|
})
|
|
793
|
-
),
|
|
793
|
+
), l.close();
|
|
794
794
|
return;
|
|
795
795
|
}
|
|
796
796
|
console.warn(
|
|
797
|
-
`Experienced error during code generation (attempt ${
|
|
797
|
+
`Experienced error during code generation (attempt ${c + 1} / ${Pt})`,
|
|
798
798
|
f
|
|
799
799
|
);
|
|
800
|
-
let g,
|
|
800
|
+
let g, k = !1;
|
|
801
801
|
if (f instanceof MessageEvent)
|
|
802
802
|
try {
|
|
803
803
|
g = JSON.parse(f.data);
|
|
804
804
|
} catch (q) {
|
|
805
805
|
}
|
|
806
|
-
((($ = g == null ? void 0 : g.payload) == null ? void 0 : $.name) === "Task Crashed" || ((b = g == null ? void 0 : g.payload) == null ? void 0 : b.name) === "TimeoutError" || ((K = g == null ? void 0 : g.payload) == null ? void 0 : K.name) === "Error" || ((U = g == null ? void 0 : g.payload) == null ? void 0 : U.name) === "Unknown error") && (
|
|
807
|
-
const
|
|
806
|
+
((($ = g == null ? void 0 : g.payload) == null ? void 0 : $.name) === "Task Crashed" || ((b = g == null ? void 0 : g.payload) == null ? void 0 : b.name) === "TimeoutError" || ((K = g == null ? void 0 : g.payload) == null ? void 0 : K.name) === "Error" || ((U = g == null ? void 0 : g.payload) == null ? void 0 : U.name) === "Unknown error") && (k = !0);
|
|
807
|
+
const N = new Ye({
|
|
808
808
|
name: (B = g == null ? void 0 : g.payload.name) != null ? B : "Unknown error",
|
|
809
809
|
reason: (Q = g == null ? void 0 : g.payload.message) != null ? Q : "Unknown",
|
|
810
810
|
status: g == null ? void 0 : g.payload.status,
|
|
811
811
|
detail: g == null ? void 0 : g.payload.detail
|
|
812
812
|
});
|
|
813
|
-
|
|
813
|
+
c++;
|
|
814
814
|
let T = !1;
|
|
815
|
-
|
|
815
|
+
c > Pt ? (console.error("Experienced too many errors, terminating request"), T = !0) : k && (console.error("Experienced unrecoverable error, terminating request"), T = !0), T && (s.status = "error", s.error = N, r(D({}, s)), E({
|
|
816
816
|
result: null,
|
|
817
|
-
error:
|
|
817
|
+
error: N
|
|
818
818
|
}));
|
|
819
|
-
})),
|
|
820
|
-
const
|
|
821
|
-
|
|
819
|
+
})), l.addEventListener("done", (f) => {
|
|
820
|
+
const o = JSON.parse(f.data);
|
|
821
|
+
p.tokenUsage = o.payload.tokenUsage, p.sessionId = o.payload.sessionId, s.status = "success", s.result = p, r(D({}, s)), E({ result: p, error: null });
|
|
822
822
|
});
|
|
823
823
|
});
|
|
824
824
|
try {
|
|
825
|
-
const { result:
|
|
826
|
-
if (((w =
|
|
827
|
-
const { filePath:
|
|
828
|
-
|
|
829
|
-
), f =
|
|
830
|
-
const
|
|
825
|
+
const { result: E, error: h } = yield d, p = structuredClone(E);
|
|
826
|
+
if (((w = i.assetsStorage) == null ? void 0 : w.strategy) === "local" && ((m = p == null ? void 0 : p.assets) != null && m.length)) {
|
|
827
|
+
const { filePath: c } = Mt(
|
|
828
|
+
i.assetsStorage
|
|
829
|
+
), f = p.assets.map((g) => oe(null, null, function* () {
|
|
830
|
+
const N = yield (yield fetch(g.url)).arrayBuffer();
|
|
831
831
|
return {
|
|
832
832
|
assetName: g.name,
|
|
833
|
-
base64:
|
|
833
|
+
base64: bn(N)
|
|
834
834
|
};
|
|
835
|
-
})),
|
|
836
|
-
for (const g of
|
|
837
|
-
const
|
|
835
|
+
})), o = yield Promise.allSettled(f);
|
|
836
|
+
for (const g of o) {
|
|
837
|
+
const k = {};
|
|
838
838
|
if (g.status === "fulfilled") {
|
|
839
|
-
const { assetName:
|
|
840
|
-
|
|
841
|
-
const
|
|
842
|
-
|
|
839
|
+
const { assetName: N, base64: T } = g.value;
|
|
840
|
+
k[N] = T;
|
|
841
|
+
const F = c ? `${c}/${N}` : N;
|
|
842
|
+
p.files[F] = {
|
|
843
843
|
content: T,
|
|
844
844
|
isBinary: !0
|
|
845
845
|
};
|
|
846
846
|
}
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
|
-
return
|
|
849
|
+
return h ? { result: null, error: h } : { result: p, error: h };
|
|
850
850
|
} finally {
|
|
851
|
-
|
|
851
|
+
l.close();
|
|
852
852
|
}
|
|
853
853
|
});
|
|
854
|
-
class
|
|
854
|
+
class Tn extends Error {
|
|
855
855
|
constructor(t, n) {
|
|
856
856
|
super(t), this.name = "CreateJobError", this.cause = n;
|
|
857
857
|
}
|
|
858
858
|
}
|
|
859
|
-
class
|
|
859
|
+
class Cn extends Error {
|
|
860
860
|
constructor() {
|
|
861
861
|
super(""), this.name = "UnknownCodegenError";
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
864
|
const Qt = Bt(null);
|
|
865
|
-
function hs({
|
|
866
|
-
const [
|
|
867
|
-
f2c:
|
|
868
|
-
l2c:
|
|
869
|
-
p2c:
|
|
870
|
-
},
|
|
871
|
-
var
|
|
872
|
-
if (
|
|
865
|
+
function hs({ figmaRestApi: e, f2cUrl: t, l2cUrl: n, p2cUrl: r, children: s }) {
|
|
866
|
+
const [i, u] = nt({ status: "idle" }), l = le(null), [d, _] = nt(St), w = {
|
|
867
|
+
f2c: t,
|
|
868
|
+
l2c: n,
|
|
869
|
+
p2c: r
|
|
870
|
+
}, m = (E, h) => oe(null, null, function* () {
|
|
871
|
+
var p;
|
|
872
|
+
if (i.status === "pending")
|
|
873
873
|
throw new Error("A job is already in progress");
|
|
874
874
|
l.current = E;
|
|
875
875
|
try {
|
|
876
|
-
const
|
|
877
|
-
if (
|
|
878
|
-
const
|
|
879
|
-
|
|
876
|
+
const c = w[E], { result: f } = yield Zt(c, "POST", h, (o) => _(o));
|
|
877
|
+
if (f) {
|
|
878
|
+
const o = f.sessionId, g = f.files, k = f.assets;
|
|
879
|
+
u((N) => ({
|
|
880
880
|
status: "success",
|
|
881
881
|
type: E,
|
|
882
|
-
params: "params" in
|
|
883
|
-
sessionId:
|
|
884
|
-
payload:
|
|
885
|
-
assets:
|
|
886
|
-
files:
|
|
887
|
-
progressMessages:
|
|
882
|
+
params: "params" in N ? N.params : {},
|
|
883
|
+
sessionId: o,
|
|
884
|
+
payload: d.jobStatus,
|
|
885
|
+
assets: k,
|
|
886
|
+
files: g,
|
|
887
|
+
progressMessages: d.progressMessages
|
|
888
888
|
}));
|
|
889
889
|
return;
|
|
890
890
|
}
|
|
891
|
-
} catch (
|
|
891
|
+
} catch (c) {
|
|
892
892
|
l.current = null;
|
|
893
|
-
const
|
|
894
|
-
throw
|
|
893
|
+
const f = c instanceof Error ? c.message : "Unknown error", o = new Tn(f, c);
|
|
894
|
+
throw u({
|
|
895
895
|
status: "error",
|
|
896
896
|
type: E,
|
|
897
|
-
params:
|
|
898
|
-
error:
|
|
899
|
-
sessionId: (
|
|
900
|
-
payload:
|
|
901
|
-
progressMessages:
|
|
902
|
-
}),
|
|
897
|
+
params: h,
|
|
898
|
+
error: o,
|
|
899
|
+
sessionId: (p = d.jobSessionId) != null ? p : null,
|
|
900
|
+
payload: d.jobStatus,
|
|
901
|
+
progressMessages: d.progressMessages
|
|
902
|
+
}), o;
|
|
903
903
|
}
|
|
904
904
|
});
|
|
905
905
|
return Ht(() => {
|
|
906
|
-
var
|
|
906
|
+
var h;
|
|
907
907
|
if (!l.current)
|
|
908
908
|
return;
|
|
909
909
|
const E = l.current;
|
|
910
|
-
if (
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
var
|
|
910
|
+
if (d.status === "error") {
|
|
911
|
+
const p = (h = d.error) != null ? h : new Cn();
|
|
912
|
+
u((c) => {
|
|
913
|
+
var f;
|
|
914
914
|
return {
|
|
915
915
|
status: "error",
|
|
916
916
|
type: E,
|
|
917
|
-
params: "params" in
|
|
918
|
-
error:
|
|
919
|
-
sessionId: (
|
|
920
|
-
payload:
|
|
921
|
-
progressMessages:
|
|
917
|
+
params: "params" in c ? c.params : {},
|
|
918
|
+
error: p,
|
|
919
|
+
sessionId: (f = d.jobSessionId) != null ? f : null,
|
|
920
|
+
payload: d.jobStatus,
|
|
921
|
+
progressMessages: d.progressMessages
|
|
922
922
|
};
|
|
923
923
|
});
|
|
924
924
|
return;
|
|
925
925
|
}
|
|
926
|
-
if (
|
|
927
|
-
|
|
926
|
+
if (d.status === "pending") {
|
|
927
|
+
u((p) => ({
|
|
928
928
|
status: "pending",
|
|
929
929
|
type: E,
|
|
930
|
-
params: "params" in
|
|
931
|
-
sessionId:
|
|
932
|
-
payload:
|
|
933
|
-
progressMessages:
|
|
930
|
+
params: "params" in p ? p.params : {},
|
|
931
|
+
sessionId: d.jobSessionId,
|
|
932
|
+
payload: d.jobStatus,
|
|
933
|
+
progressMessages: d.progressMessages
|
|
934
934
|
}));
|
|
935
935
|
return;
|
|
936
936
|
}
|
|
937
|
-
}, [
|
|
937
|
+
}, [d]), /* @__PURE__ */ Sn.jsx(
|
|
938
938
|
Qt.Provider,
|
|
939
939
|
{
|
|
940
940
|
value: {
|
|
941
|
-
createJob:
|
|
942
|
-
job:
|
|
941
|
+
createJob: m,
|
|
942
|
+
job: i,
|
|
943
|
+
figmaRestApi: e
|
|
943
944
|
},
|
|
944
|
-
children:
|
|
945
|
+
children: s
|
|
945
946
|
}
|
|
946
947
|
);
|
|
947
948
|
}
|
|
948
|
-
function
|
|
949
|
+
function An() {
|
|
949
950
|
const e = zt(Qt);
|
|
950
951
|
if (!e)
|
|
951
952
|
throw new Error("useAnimaSDK must be used within AnimaSDKProvider");
|
|
952
953
|
return e;
|
|
953
954
|
}
|
|
954
|
-
const
|
|
955
|
+
const ps = ({
|
|
955
956
|
url: e,
|
|
956
957
|
method: t = "POST"
|
|
957
958
|
}) => {
|
|
958
959
|
const [n, r] = nt(St);
|
|
959
960
|
return {
|
|
960
961
|
getCode: Ve(
|
|
961
|
-
(
|
|
962
|
+
(i) => Zt(e, t, i, r),
|
|
962
963
|
[e, t]
|
|
963
964
|
),
|
|
964
965
|
status: n.status,
|
|
@@ -980,45 +981,45 @@ var Me = { exports: {} }, He = {};
|
|
|
980
981
|
* This source code is licensed under the MIT license found in the
|
|
981
982
|
* LICENSE file in the root directory of this source tree.
|
|
982
983
|
*/
|
|
983
|
-
var
|
|
984
|
+
var Wt;
|
|
984
985
|
function Ln() {
|
|
985
|
-
if (
|
|
986
|
-
|
|
986
|
+
if (Wt) return He;
|
|
987
|
+
Wt = 1;
|
|
987
988
|
var e = Oe;
|
|
988
|
-
function t(
|
|
989
|
-
return
|
|
989
|
+
function t(m, E) {
|
|
990
|
+
return m === E && (m !== 0 || 1 / m === 1 / E) || m !== m && E !== E;
|
|
990
991
|
}
|
|
991
|
-
var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, s = e.useEffect,
|
|
992
|
-
function
|
|
993
|
-
var
|
|
994
|
-
return
|
|
992
|
+
var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, s = e.useEffect, i = e.useLayoutEffect, u = e.useDebugValue;
|
|
993
|
+
function l(m, E) {
|
|
994
|
+
var h = E(), p = r({ inst: { value: h, getSnapshot: E } }), c = p[0].inst, f = p[1];
|
|
995
|
+
return i(
|
|
995
996
|
function() {
|
|
996
|
-
|
|
997
|
+
c.value = h, c.getSnapshot = E, d(c) && f({ inst: c });
|
|
997
998
|
},
|
|
998
|
-
[
|
|
999
|
+
[m, h, E]
|
|
999
1000
|
), s(
|
|
1000
1001
|
function() {
|
|
1001
|
-
return
|
|
1002
|
-
|
|
1002
|
+
return d(c) && f({ inst: c }), m(function() {
|
|
1003
|
+
d(c) && f({ inst: c });
|
|
1003
1004
|
});
|
|
1004
1005
|
},
|
|
1005
|
-
[
|
|
1006
|
-
),
|
|
1006
|
+
[m]
|
|
1007
|
+
), u(h), h;
|
|
1007
1008
|
}
|
|
1008
|
-
function m
|
|
1009
|
-
var
|
|
1010
|
-
|
|
1009
|
+
function d(m) {
|
|
1010
|
+
var E = m.getSnapshot;
|
|
1011
|
+
m = m.value;
|
|
1011
1012
|
try {
|
|
1012
|
-
var
|
|
1013
|
-
return !n(
|
|
1014
|
-
} catch (
|
|
1013
|
+
var h = E();
|
|
1014
|
+
return !n(m, h);
|
|
1015
|
+
} catch (p) {
|
|
1015
1016
|
return !0;
|
|
1016
1017
|
}
|
|
1017
1018
|
}
|
|
1018
|
-
function _(
|
|
1019
|
-
return
|
|
1019
|
+
function _(m, E) {
|
|
1020
|
+
return E();
|
|
1020
1021
|
}
|
|
1021
|
-
var w = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? _ :
|
|
1022
|
+
var w = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? _ : l;
|
|
1022
1023
|
return He.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : w, He;
|
|
1023
1024
|
}
|
|
1024
1025
|
var ze = {};
|
|
@@ -1031,57 +1032,57 @@ var ze = {};
|
|
|
1031
1032
|
* This source code is licensed under the MIT license found in the
|
|
1032
1033
|
* LICENSE file in the root directory of this source tree.
|
|
1033
1034
|
*/
|
|
1034
|
-
var
|
|
1035
|
+
var Ft;
|
|
1035
1036
|
function xn() {
|
|
1036
|
-
return
|
|
1037
|
-
function e(
|
|
1038
|
-
return
|
|
1037
|
+
return Ft || (Ft = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
1038
|
+
function e(h, p) {
|
|
1039
|
+
return h === p && (h !== 0 || 1 / h === 1 / p) || h !== h && p !== p;
|
|
1039
1040
|
}
|
|
1040
|
-
function t(
|
|
1041
|
+
function t(h, p) {
|
|
1041
1042
|
w || s.startTransition === void 0 || (w = !0, console.error(
|
|
1042
1043
|
"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."
|
|
1043
1044
|
));
|
|
1044
|
-
var
|
|
1045
|
-
if (!
|
|
1046
|
-
var f =
|
|
1047
|
-
c
|
|
1045
|
+
var c = p();
|
|
1046
|
+
if (!m) {
|
|
1047
|
+
var f = p();
|
|
1048
|
+
i(c, f) || (console.error(
|
|
1048
1049
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
1049
|
-
),
|
|
1050
|
+
), m = !0);
|
|
1050
1051
|
}
|
|
1051
|
-
f =
|
|
1052
|
-
inst: { value:
|
|
1052
|
+
f = u({
|
|
1053
|
+
inst: { value: c, getSnapshot: p }
|
|
1053
1054
|
});
|
|
1054
|
-
var
|
|
1055
|
-
return
|
|
1055
|
+
var o = f[0].inst, g = f[1];
|
|
1056
|
+
return d(
|
|
1056
1057
|
function() {
|
|
1057
|
-
|
|
1058
|
+
o.value = c, o.getSnapshot = p, n(o) && g({ inst: o });
|
|
1058
1059
|
},
|
|
1059
|
-
[
|
|
1060
|
-
),
|
|
1060
|
+
[h, c, p]
|
|
1061
|
+
), l(
|
|
1061
1062
|
function() {
|
|
1062
|
-
return n(
|
|
1063
|
-
n(
|
|
1063
|
+
return n(o) && g({ inst: o }), h(function() {
|
|
1064
|
+
n(o) && g({ inst: o });
|
|
1064
1065
|
});
|
|
1065
1066
|
},
|
|
1066
|
-
[
|
|
1067
|
-
), _(
|
|
1067
|
+
[h]
|
|
1068
|
+
), _(c), c;
|
|
1068
1069
|
}
|
|
1069
|
-
function n(
|
|
1070
|
-
var
|
|
1071
|
-
|
|
1070
|
+
function n(h) {
|
|
1071
|
+
var p = h.getSnapshot;
|
|
1072
|
+
h = h.value;
|
|
1072
1073
|
try {
|
|
1073
|
-
var
|
|
1074
|
-
return !
|
|
1074
|
+
var c = p();
|
|
1075
|
+
return !i(h, c);
|
|
1075
1076
|
} catch (f) {
|
|
1076
1077
|
return !0;
|
|
1077
1078
|
}
|
|
1078
1079
|
}
|
|
1079
|
-
function r(
|
|
1080
|
-
return
|
|
1080
|
+
function r(h, p) {
|
|
1081
|
+
return p();
|
|
1081
1082
|
}
|
|
1082
1083
|
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
1083
|
-
var s = Oe,
|
|
1084
|
-
ze.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore :
|
|
1084
|
+
var s = Oe, i = typeof Object.is == "function" ? Object.is : e, u = s.useState, l = s.useEffect, d = s.useLayoutEffect, _ = s.useDebugValue, w = !1, m = !1, E = typeof window == "undefined" || typeof window.document == "undefined" || typeof window.document.createElement == "undefined" ? r : t;
|
|
1085
|
+
ze.useSyncExternalStore = s.useSyncExternalStore !== void 0 ? s.useSyncExternalStore : E, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ != "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1085
1086
|
})()), ze;
|
|
1086
1087
|
}
|
|
1087
1088
|
var Vt;
|
|
@@ -1115,7 +1116,7 @@ const ie = /* @__PURE__ */ new WeakMap(), de = () => {
|
|
|
1115
1116
|
}, V = (
|
|
1116
1117
|
/*#__NOINLINE__*/
|
|
1117
1118
|
de()
|
|
1118
|
-
), dt = Object, R = (e) => e === V, ee = (e) => typeof e == "function", he = (e, t) => D(D({}, e), t), sn = (e) => ee(e.then), Ke = {},
|
|
1119
|
+
), dt = Object, R = (e) => e === V, ee = (e) => typeof e == "function", he = (e, t) => D(D({}, e), t), sn = (e) => ee(e.then), Ke = {}, We = {}, wt = "undefined", De = typeof window != wt, ht = typeof document != wt, kn = De && "Deno" in window, Dn = () => De && typeof window.requestAnimationFrame != wt, rn = (e, t) => {
|
|
1119
1120
|
const n = ie.get(e);
|
|
1120
1121
|
return [
|
|
1121
1122
|
// Getter
|
|
@@ -1124,13 +1125,13 @@ const ie = /* @__PURE__ */ new WeakMap(), de = () => {
|
|
|
1124
1125
|
(r) => {
|
|
1125
1126
|
if (!R(t)) {
|
|
1126
1127
|
const s = e.get(t);
|
|
1127
|
-
t in
|
|
1128
|
+
t in We || (We[t] = s), n[5](t, he(s, r), s || Ke);
|
|
1128
1129
|
}
|
|
1129
1130
|
},
|
|
1130
1131
|
// Subscriber
|
|
1131
1132
|
n[6],
|
|
1132
1133
|
// Get server cache snapshot
|
|
1133
|
-
() => !R(t) && t in
|
|
1134
|
+
() => !R(t) && t in We ? We[t] : !R(t) && e.get(t) || Ke
|
|
1134
1135
|
];
|
|
1135
1136
|
};
|
|
1136
1137
|
let pt = !0;
|
|
@@ -1145,7 +1146,7 @@ const jn = () => pt, [Et, mt] = De && window.addEventListener ? [
|
|
|
1145
1146
|
return R(e) || e !== "hidden";
|
|
1146
1147
|
}, Mn = (e) => (ht && document.addEventListener("visibilitychange", e), Et("focus", e), () => {
|
|
1147
1148
|
ht && document.removeEventListener("visibilitychange", e), mt("focus", e);
|
|
1148
|
-
}),
|
|
1149
|
+
}), Wn = (e) => {
|
|
1149
1150
|
const t = () => {
|
|
1150
1151
|
pt = !0, e();
|
|
1151
1152
|
}, n = () => {
|
|
@@ -1154,37 +1155,37 @@ const jn = () => pt, [Et, mt] = De && window.addEventListener ? [
|
|
|
1154
1155
|
return Et("online", t), Et("offline", n), () => {
|
|
1155
1156
|
mt("online", t), mt("offline", n);
|
|
1156
1157
|
};
|
|
1157
|
-
},
|
|
1158
|
+
}, Fn = {
|
|
1158
1159
|
isOnline: jn,
|
|
1159
1160
|
isVisible: Pn
|
|
1160
1161
|
}, Vn = {
|
|
1161
1162
|
initFocus: Mn,
|
|
1162
|
-
initReconnect:
|
|
1163
|
+
initReconnect: Wn
|
|
1163
1164
|
}, qt = !Oe.useId, ke = !De || kn, $n = (e) => Dn() ? window.requestAnimationFrame(e) : setTimeout(e, 1), Xe = ke ? Ht : En, Ze = typeof navigator != "undefined" && navigator.connection, Gt = !ke && Ze && ([
|
|
1164
1165
|
"slow-2g",
|
|
1165
1166
|
"2g"
|
|
1166
|
-
].includes(Ze.effectiveType) || Ze.saveData),
|
|
1167
|
+
].includes(Ze.effectiveType) || Ze.saveData), Fe = /* @__PURE__ */ new WeakMap(), Un = (e) => dt.prototype.toString.call(e), Qe = (e, t) => e === `[object ${t}]`;
|
|
1167
1168
|
let qn = 0;
|
|
1168
1169
|
const gt = (e) => {
|
|
1169
|
-
const t = typeof e, n = Un(e), r = Qe(n, "Date"), s = Qe(n, "RegExp"),
|
|
1170
|
-
let
|
|
1170
|
+
const t = typeof e, n = Un(e), r = Qe(n, "Date"), s = Qe(n, "RegExp"), i = Qe(n, "Object");
|
|
1171
|
+
let u, l;
|
|
1171
1172
|
if (dt(e) === e && !r && !s) {
|
|
1172
|
-
if (
|
|
1173
|
-
if (
|
|
1174
|
-
for (
|
|
1175
|
-
|
|
1176
|
-
|
|
1173
|
+
if (u = Fe.get(e), u) return u;
|
|
1174
|
+
if (u = ++qn + "~", Fe.set(e, u), Array.isArray(e)) {
|
|
1175
|
+
for (u = "@", l = 0; l < e.length; l++)
|
|
1176
|
+
u += gt(e[l]) + ",";
|
|
1177
|
+
Fe.set(e, u);
|
|
1177
1178
|
}
|
|
1178
|
-
if (
|
|
1179
|
-
|
|
1180
|
-
const
|
|
1181
|
-
for (; !R(
|
|
1182
|
-
R(e[
|
|
1183
|
-
|
|
1179
|
+
if (i) {
|
|
1180
|
+
u = "#";
|
|
1181
|
+
const d = dt.keys(e).sort();
|
|
1182
|
+
for (; !R(l = d.pop()); )
|
|
1183
|
+
R(e[l]) || (u += l + ":" + gt(e[l]) + ",");
|
|
1184
|
+
Fe.set(e, u);
|
|
1184
1185
|
}
|
|
1185
1186
|
} else
|
|
1186
|
-
|
|
1187
|
-
return
|
|
1187
|
+
u = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
|
|
1188
|
+
return u;
|
|
1188
1189
|
}, Rt = (e) => {
|
|
1189
1190
|
if (ee(e))
|
|
1190
1191
|
try {
|
|
@@ -1202,80 +1203,80 @@ let Gn = 0;
|
|
|
1202
1203
|
const vt = () => ++Gn;
|
|
1203
1204
|
function on(...e) {
|
|
1204
1205
|
return oe(this, null, function* () {
|
|
1205
|
-
const [t, n, r, s] = e,
|
|
1206
|
+
const [t, n, r, s] = e, i = he({
|
|
1206
1207
|
populateCache: !0,
|
|
1207
1208
|
throwOnError: !0
|
|
1208
1209
|
}, typeof s == "boolean" ? {
|
|
1209
1210
|
revalidate: s
|
|
1210
1211
|
} : s || {});
|
|
1211
|
-
let
|
|
1212
|
-
const
|
|
1213
|
-
let
|
|
1214
|
-
const _ = (
|
|
1212
|
+
let u = i.populateCache;
|
|
1213
|
+
const l = i.rollbackOnError;
|
|
1214
|
+
let d = i.optimisticData;
|
|
1215
|
+
const _ = (E) => typeof l == "function" ? l(E) : l !== !1, w = i.throwOnError;
|
|
1215
1216
|
if (ee(n)) {
|
|
1216
|
-
const
|
|
1217
|
-
for (const
|
|
1217
|
+
const E = n, h = [], p = t.keys();
|
|
1218
|
+
for (const c of p)
|
|
1218
1219
|
// Skip the special useSWRInfinite and useSWRSubscription keys.
|
|
1219
|
-
!/^\$(inf|sub)\$/.test(
|
|
1220
|
-
return Promise.all(
|
|
1220
|
+
!/^\$(inf|sub)\$/.test(c) && E(t.get(c)._k) && h.push(c);
|
|
1221
|
+
return Promise.all(h.map(m));
|
|
1221
1222
|
}
|
|
1222
|
-
return
|
|
1223
|
-
function E
|
|
1223
|
+
return m(n);
|
|
1224
|
+
function m(E) {
|
|
1224
1225
|
return oe(this, null, function* () {
|
|
1225
|
-
const [
|
|
1226
|
-
if (!
|
|
1227
|
-
const [
|
|
1228
|
-
const C = f[
|
|
1229
|
-
return (ee(
|
|
1226
|
+
const [h] = Rt(E);
|
|
1227
|
+
if (!h) return;
|
|
1228
|
+
const [p, c] = rn(t, h), [f, o, g, k] = ie.get(t), N = () => {
|
|
1229
|
+
const C = f[h];
|
|
1230
|
+
return (ee(i.revalidate) ? i.revalidate(p().data, E) : i.revalidate !== !1) && (delete g[h], delete k[h], C && C[0]) ? C[0](nn).then(() => p().data) : p().data;
|
|
1230
1231
|
};
|
|
1231
1232
|
if (e.length < 3)
|
|
1232
|
-
return
|
|
1233
|
-
let T = r,
|
|
1233
|
+
return N();
|
|
1234
|
+
let T = r, F, $ = !1;
|
|
1234
1235
|
const b = vt();
|
|
1235
|
-
|
|
1236
|
+
o[h] = [
|
|
1236
1237
|
b,
|
|
1237
1238
|
0
|
|
1238
1239
|
];
|
|
1239
|
-
const K = !R(
|
|
1240
|
-
if (K && (
|
|
1241
|
-
data:
|
|
1240
|
+
const K = !R(d), U = p(), B = U.data, Q = U._c, q = R(Q) ? B : Q;
|
|
1241
|
+
if (K && (d = ee(d) ? d(q, B) : d, c({
|
|
1242
|
+
data: d,
|
|
1242
1243
|
_c: q
|
|
1243
1244
|
})), ee(T))
|
|
1244
1245
|
try {
|
|
1245
1246
|
T = T(q);
|
|
1246
1247
|
} catch (C) {
|
|
1247
|
-
|
|
1248
|
+
F = C, $ = !0;
|
|
1248
1249
|
}
|
|
1249
1250
|
if (T && sn(T))
|
|
1250
1251
|
if (T = yield T.catch((C) => {
|
|
1251
|
-
|
|
1252
|
-
}), b !==
|
|
1253
|
-
if ($) throw
|
|
1252
|
+
F = C, $ = !0;
|
|
1253
|
+
}), b !== o[h][0]) {
|
|
1254
|
+
if ($) throw F;
|
|
1254
1255
|
return T;
|
|
1255
|
-
} else $ && K && _(
|
|
1256
|
+
} else $ && K && _(F) && (u = !0, c({
|
|
1256
1257
|
data: q,
|
|
1257
1258
|
_c: V
|
|
1258
1259
|
}));
|
|
1259
|
-
if (
|
|
1260
|
-
if (ee(
|
|
1261
|
-
const C =
|
|
1262
|
-
|
|
1260
|
+
if (u && !$)
|
|
1261
|
+
if (ee(u)) {
|
|
1262
|
+
const C = u(T, q);
|
|
1263
|
+
c({
|
|
1263
1264
|
data: C,
|
|
1264
1265
|
error: V,
|
|
1265
1266
|
_c: V
|
|
1266
1267
|
});
|
|
1267
1268
|
} else
|
|
1268
|
-
|
|
1269
|
+
c({
|
|
1269
1270
|
data: T,
|
|
1270
1271
|
error: V,
|
|
1271
1272
|
_c: V
|
|
1272
1273
|
});
|
|
1273
|
-
if (
|
|
1274
|
-
|
|
1274
|
+
if (o[h][1] = vt(), Promise.resolve(N()).then(() => {
|
|
1275
|
+
c({
|
|
1275
1276
|
_c: V
|
|
1276
1277
|
});
|
|
1277
1278
|
}), $) {
|
|
1278
|
-
if (w) throw
|
|
1279
|
+
if (w) throw F;
|
|
1279
1280
|
return;
|
|
1280
1281
|
}
|
|
1281
1282
|
return T;
|
|
@@ -1289,16 +1290,16 @@ const Jt = (e, t) => {
|
|
|
1289
1290
|
}, Jn = (e, t) => {
|
|
1290
1291
|
if (!ie.has(e)) {
|
|
1291
1292
|
const n = he(Vn, t), r = /* @__PURE__ */ Object.create(null), s = on.bind(V, e);
|
|
1292
|
-
let
|
|
1293
|
-
const
|
|
1294
|
-
const
|
|
1295
|
-
return
|
|
1296
|
-
},
|
|
1297
|
-
e.set(w,
|
|
1298
|
-
const
|
|
1299
|
-
if (
|
|
1300
|
-
for (const
|
|
1301
|
-
|
|
1293
|
+
let i = de;
|
|
1294
|
+
const u = /* @__PURE__ */ Object.create(null), l = (w, m) => {
|
|
1295
|
+
const E = u[w] || [];
|
|
1296
|
+
return u[w] = E, E.push(m), () => E.splice(E.indexOf(m), 1);
|
|
1297
|
+
}, d = (w, m, E) => {
|
|
1298
|
+
e.set(w, m);
|
|
1299
|
+
const h = u[w];
|
|
1300
|
+
if (h)
|
|
1301
|
+
for (const p of h)
|
|
1302
|
+
p(m, E);
|
|
1302
1303
|
}, _ = () => {
|
|
1303
1304
|
if (!ie.has(e) && (ie.set(e, [
|
|
1304
1305
|
r,
|
|
@@ -1306,12 +1307,12 @@ const Jt = (e, t) => {
|
|
|
1306
1307
|
/* @__PURE__ */ Object.create(null),
|
|
1307
1308
|
/* @__PURE__ */ Object.create(null),
|
|
1308
1309
|
s,
|
|
1309
|
-
|
|
1310
|
-
|
|
1310
|
+
d,
|
|
1311
|
+
l
|
|
1311
1312
|
]), !ke)) {
|
|
1312
|
-
const w = n.initFocus(setTimeout.bind(V, Jt.bind(V, r, en))),
|
|
1313
|
-
|
|
1314
|
-
w && w(),
|
|
1313
|
+
const w = n.initFocus(setTimeout.bind(V, Jt.bind(V, r, en))), m = n.initReconnect(setTimeout.bind(V, Jt.bind(V, r, tn)));
|
|
1314
|
+
i = () => {
|
|
1315
|
+
w && w(), m && m(), ie.delete(e);
|
|
1315
1316
|
};
|
|
1316
1317
|
}
|
|
1317
1318
|
};
|
|
@@ -1319,7 +1320,7 @@ const Jt = (e, t) => {
|
|
|
1319
1320
|
e,
|
|
1320
1321
|
s,
|
|
1321
1322
|
_,
|
|
1322
|
-
|
|
1323
|
+
i
|
|
1323
1324
|
];
|
|
1324
1325
|
}
|
|
1325
1326
|
return [
|
|
@@ -1327,8 +1328,8 @@ const Jt = (e, t) => {
|
|
|
1327
1328
|
ie.get(e)[4]
|
|
1328
1329
|
];
|
|
1329
1330
|
}, Yn = (e, t, n, r, s) => {
|
|
1330
|
-
const
|
|
1331
|
-
!R(
|
|
1331
|
+
const i = n.errorRetryCount, u = s.retryCount, l = ~~((Math.random() + 0.5) * (1 << (u < 8 ? u : 8))) * n.errorRetryInterval;
|
|
1332
|
+
!R(i) && u > i || setTimeout(r, l, s);
|
|
1332
1333
|
}, Bn = ft, [an, Hn] = Jn(/* @__PURE__ */ new Map()), zn = he(
|
|
1333
1334
|
{
|
|
1334
1335
|
// events
|
|
@@ -1355,12 +1356,12 @@ const Jt = (e, t) => {
|
|
|
1355
1356
|
fallback: {}
|
|
1356
1357
|
},
|
|
1357
1358
|
// use web preset by default
|
|
1358
|
-
|
|
1359
|
+
Fn
|
|
1359
1360
|
), Kn = (e, t) => {
|
|
1360
1361
|
const n = he(e, t);
|
|
1361
1362
|
if (t) {
|
|
1362
|
-
const { use: r, fallback: s } = e, { use:
|
|
1363
|
-
r &&
|
|
1363
|
+
const { use: r, fallback: s } = e, { use: i, fallback: u } = t;
|
|
1364
|
+
r && i && (n.use = r.concat(i)), s && u && (n.fallback = he(s, u));
|
|
1364
1365
|
}
|
|
1365
1366
|
return n;
|
|
1366
1367
|
}, Xn = Bt({}), Zn = "$inf$", cn = De && window.__SWR_DEVTOOLS_USE__, Qn = cn ? window.__SWR_DEVTOOLS_USE__ : [], es = () => {
|
|
@@ -1378,19 +1379,19 @@ const Jt = (e, t) => {
|
|
|
1378
1379
|
return Kt(() => he(zn, e), [
|
|
1379
1380
|
e
|
|
1380
1381
|
]);
|
|
1381
|
-
}, ss = (e) => (t, n, r) => e(t, n && ((...
|
|
1382
|
-
const [
|
|
1383
|
-
if (
|
|
1384
|
-
return n(...
|
|
1385
|
-
const
|
|
1386
|
-
return R(
|
|
1382
|
+
}, ss = (e) => (t, n, r) => e(t, n && ((...i) => {
|
|
1383
|
+
const [u] = Rt(t), [, , , l] = ie.get(an);
|
|
1384
|
+
if (u.startsWith(Zn))
|
|
1385
|
+
return n(...i);
|
|
1386
|
+
const d = l[u];
|
|
1387
|
+
return R(d) ? n(...i) : (delete l[u], d);
|
|
1387
1388
|
}), r), rs = Qn.concat(ss), os = (e) => function(...n) {
|
|
1388
|
-
const r = ns(), [s,
|
|
1389
|
-
let
|
|
1390
|
-
const { use: _ } =
|
|
1391
|
-
for (let
|
|
1392
|
-
|
|
1393
|
-
return
|
|
1389
|
+
const r = ns(), [s, i, u] = ts(n), l = Kn(r, u);
|
|
1390
|
+
let d = e;
|
|
1391
|
+
const { use: _ } = l, w = (_ || []).concat(rs);
|
|
1392
|
+
for (let m = w.length; m--; )
|
|
1393
|
+
d = w[m](d);
|
|
1394
|
+
return d(s, i || l.fetcher || null, l);
|
|
1394
1395
|
}, as = (e, t, n) => {
|
|
1395
1396
|
const r = t[e] || (t[e] = []);
|
|
1396
1397
|
return r.push(n), () => {
|
|
@@ -1421,7 +1422,7 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1421
1422
|
}), tt = {
|
|
1422
1423
|
dedupe: !0
|
|
1423
1424
|
}, Yt = Promise.resolve(V), is = (e, t, n) => {
|
|
1424
|
-
const { cache: r, compare: s, suspense:
|
|
1425
|
+
const { cache: r, compare: s, suspense: i, fallbackData: u, revalidateOnMount: l, revalidateIfStale: d, refreshInterval: _, refreshWhenHidden: w, refreshWhenOffline: m, keepPreviousData: E } = n, [h, p, c, f] = ie.get(r), [o, g] = Rt(e), k = le(!1), N = le(!1), T = le(o), F = le(t), $ = le(n), b = () => $.current, K = () => b().isVisible() && b().isOnline(), [U, B, Q, q] = rn(r, o), C = le({}).current, ce = R(u) ? R(n.fallback) ? V : n.fallback[o] : u, ye = (y, x) => {
|
|
1425
1426
|
for (const M in C) {
|
|
1426
1427
|
const A = M;
|
|
1427
1428
|
if (A === "data") {
|
|
@@ -1432,73 +1433,73 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1432
1433
|
}
|
|
1433
1434
|
return !0;
|
|
1434
1435
|
}, be = Kt(() => {
|
|
1435
|
-
const y = !
|
|
1436
|
+
const y = !o || !t ? !1 : R(l) ? b().isPaused() || i ? !1 : d !== !1 : l, x = (J) => {
|
|
1436
1437
|
const se = he(J);
|
|
1437
1438
|
return delete se._k, y ? D({
|
|
1438
1439
|
isValidating: !0,
|
|
1439
1440
|
isLoading: !0
|
|
1440
1441
|
}, se) : se;
|
|
1441
1442
|
}, M = U(), A = q(), X = x(M), ge = M === A ? X : x(A);
|
|
1442
|
-
let
|
|
1443
|
+
let W = X;
|
|
1443
1444
|
return [
|
|
1444
1445
|
() => {
|
|
1445
1446
|
const J = x(U());
|
|
1446
|
-
return ye(J,
|
|
1447
|
+
return ye(J, W) ? (W.data = J.data, W.isLoading = J.isLoading, W.isValidating = J.isValidating, W.error = J.error, W) : (W = J, J);
|
|
1447
1448
|
},
|
|
1448
1449
|
() => ge
|
|
1449
1450
|
];
|
|
1450
1451
|
}, [
|
|
1451
1452
|
r,
|
|
1452
|
-
|
|
1453
|
+
o
|
|
1453
1454
|
]), te = In.useSyncExternalStore(Ve(
|
|
1454
|
-
(y) => Q(
|
|
1455
|
+
(y) => Q(o, (x, M) => {
|
|
1455
1456
|
ye(M, x) || y();
|
|
1456
1457
|
}),
|
|
1457
1458
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1458
1459
|
[
|
|
1459
1460
|
r,
|
|
1460
|
-
|
|
1461
|
+
o
|
|
1461
1462
|
]
|
|
1462
|
-
), be[0], be[1]), Te = !
|
|
1463
|
+
), be[0], be[1]), Te = !k.current, a = h[o] && h[o].length > 0, v = te.data, O = R(v) ? ce && sn(ce) ? et(ce) : ce : v, I = te.error, H = le(O), G = E ? R(v) ? R(H.current) ? O : H.current : v : O, Ee = a && !R(I) ? !1 : Te && !R(l) ? l : b().isPaused() ? !1 : i ? R(O) ? !1 : d : R(O) || d, me = !!(o && t && Te && Ee), P = R(te.isValidating) ? me : te.isValidating, ue = R(te.isLoading) ? me : te.isLoading, ne = Ve(
|
|
1463
1464
|
(y) => oe(null, null, function* () {
|
|
1464
|
-
const x =
|
|
1465
|
-
if (!
|
|
1465
|
+
const x = F.current;
|
|
1466
|
+
if (!o || !x || N.current || b().isPaused())
|
|
1466
1467
|
return !1;
|
|
1467
1468
|
let M, A, X = !0;
|
|
1468
|
-
const ge = y || {},
|
|
1469
|
+
const ge = y || {}, W = !c[o] || !ge.dedupe, J = () => qt ? !N.current && o === T.current && k.current : o === T.current, se = {
|
|
1469
1470
|
isValidating: !1,
|
|
1470
1471
|
isLoading: !1
|
|
1471
1472
|
}, Ot = () => {
|
|
1472
1473
|
B(se);
|
|
1473
1474
|
}, yt = () => {
|
|
1474
|
-
const z =
|
|
1475
|
-
z && z[1] === A && delete
|
|
1475
|
+
const z = c[o];
|
|
1476
|
+
z && z[1] === A && delete c[o];
|
|
1476
1477
|
}, bt = {
|
|
1477
1478
|
isValidating: !0
|
|
1478
1479
|
};
|
|
1479
1480
|
R(U().data) && (bt.isLoading = !0);
|
|
1480
1481
|
try {
|
|
1481
|
-
if (
|
|
1482
|
-
X && J() && b().onLoadingSlow(
|
|
1483
|
-
}, n.loadingTimeout),
|
|
1482
|
+
if (W && (B(bt), n.loadingTimeout && R(U().data) && setTimeout(() => {
|
|
1483
|
+
X && J() && b().onLoadingSlow(o, n);
|
|
1484
|
+
}, n.loadingTimeout), c[o] = [
|
|
1484
1485
|
x(g),
|
|
1485
1486
|
vt()
|
|
1486
|
-
]), [M, A] =
|
|
1487
|
-
return
|
|
1487
|
+
]), [M, A] = c[o], M = yield M, W && setTimeout(yt, n.dedupingInterval), !c[o] || c[o][1] !== A)
|
|
1488
|
+
return W && J() && b().onDiscarded(o), !1;
|
|
1488
1489
|
se.error = V;
|
|
1489
|
-
const z =
|
|
1490
|
+
const z = p[o];
|
|
1490
1491
|
if (!R(z) && // case 1
|
|
1491
1492
|
(A <= z[0] || // case 2
|
|
1492
1493
|
A <= z[1] || // case 3
|
|
1493
1494
|
z[1] === 0))
|
|
1494
|
-
return Ot(),
|
|
1495
|
+
return Ot(), W && J() && b().onDiscarded(o), !1;
|
|
1495
1496
|
const re = U().data;
|
|
1496
|
-
se.data = s(re, M) ? re : M,
|
|
1497
|
+
se.data = s(re, M) ? re : M, W && J() && b().onSuccess(M, o, n);
|
|
1497
1498
|
} catch (z) {
|
|
1498
1499
|
yt();
|
|
1499
1500
|
const re = b(), { shouldRetryOnError: Ge } = re;
|
|
1500
|
-
re.isPaused() || (se.error = z,
|
|
1501
|
-
const Je =
|
|
1501
|
+
re.isPaused() || (se.error = z, W && J() && (re.onError(z, o, re), (Ge === !0 || ee(Ge) && Ge(z)) && (!b().revalidateOnFocus || !b().revalidateOnReconnect || K()) && re.onErrorRetry(z, o, re, (un) => {
|
|
1502
|
+
const Je = h[o];
|
|
1502
1503
|
Je && Je[0] && Je[0]($t, un);
|
|
1503
1504
|
}, {
|
|
1504
1505
|
retryCount: (ge.retryCount || 0) + 1,
|
|
@@ -1519,7 +1520,7 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1519
1520
|
// even though it might cause unexpected behaviors.
|
|
1520
1521
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1521
1522
|
[
|
|
1522
|
-
|
|
1523
|
+
o,
|
|
1523
1524
|
r
|
|
1524
1525
|
]
|
|
1525
1526
|
), je = Ve(
|
|
@@ -1529,16 +1530,16 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1529
1530
|
[]
|
|
1530
1531
|
);
|
|
1531
1532
|
if (Xe(() => {
|
|
1532
|
-
|
|
1533
|
+
F.current = t, $.current = n, R(v) || (H.current = v);
|
|
1533
1534
|
}), Xe(() => {
|
|
1534
|
-
if (!
|
|
1535
|
+
if (!o) return;
|
|
1535
1536
|
const y = ne.bind(V, tt);
|
|
1536
1537
|
let x = 0;
|
|
1537
1538
|
b().revalidateOnFocus && (x = Date.now() + b().focusThrottleInterval);
|
|
1538
|
-
const A = as(
|
|
1539
|
+
const A = as(o, h, (X, ge = {}) => {
|
|
1539
1540
|
if (X == en) {
|
|
1540
|
-
const
|
|
1541
|
-
b().revalidateOnFocus &&
|
|
1541
|
+
const W = Date.now();
|
|
1542
|
+
b().revalidateOnFocus && W > x && K() && (x = W + b().focusThrottleInterval, y());
|
|
1542
1543
|
} else if (X == tn)
|
|
1543
1544
|
b().revalidateOnReconnect && K() && y();
|
|
1544
1545
|
else {
|
|
@@ -1548,13 +1549,13 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1548
1549
|
return ne(ge);
|
|
1549
1550
|
}
|
|
1550
1551
|
});
|
|
1551
|
-
return
|
|
1552
|
+
return N.current = !1, T.current = o, k.current = !0, B({
|
|
1552
1553
|
_k: g
|
|
1553
|
-
}), Ee && (
|
|
1554
|
-
|
|
1554
|
+
}), Ee && (c[o] || (R(O) || ke ? y() : $n(y))), () => {
|
|
1555
|
+
N.current = !0, A();
|
|
1555
1556
|
};
|
|
1556
1557
|
}, [
|
|
1557
|
-
|
|
1558
|
+
o
|
|
1558
1559
|
]), Xe(() => {
|
|
1559
1560
|
let y;
|
|
1560
1561
|
function x() {
|
|
@@ -1562,7 +1563,7 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1562
1563
|
A && y !== -1 && (y = setTimeout(M, A));
|
|
1563
1564
|
}
|
|
1564
1565
|
function M() {
|
|
1565
|
-
!U().error && (w || b().isVisible()) && (
|
|
1566
|
+
!U().error && (w || b().isVisible()) && (m || b().isOnline()) ? ne(tt).then(x) : x();
|
|
1566
1567
|
}
|
|
1567
1568
|
return x(), () => {
|
|
1568
1569
|
y && (clearTimeout(y), y = -1);
|
|
@@ -1570,16 +1571,16 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1570
1571
|
}, [
|
|
1571
1572
|
_,
|
|
1572
1573
|
w,
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
]), mn(G),
|
|
1576
|
-
const y =
|
|
1574
|
+
m,
|
|
1575
|
+
o
|
|
1576
|
+
]), mn(G), i) {
|
|
1577
|
+
const y = o && R(O);
|
|
1577
1578
|
if (!qt && ke && y)
|
|
1578
1579
|
throw new Error("Fallback data is required when using Suspense in SSR.");
|
|
1579
|
-
y && (
|
|
1580
|
-
const x = f[
|
|
1581
|
-
if (et(M), !R(
|
|
1582
|
-
throw
|
|
1580
|
+
y && (F.current = t, $.current = n, N.current = !1);
|
|
1581
|
+
const x = f[o], M = !R(x) && y ? je(x) : Yt;
|
|
1582
|
+
if (et(M), !R(I) && y)
|
|
1583
|
+
throw I;
|
|
1583
1584
|
const A = y ? ne(tt) : Yt;
|
|
1584
1585
|
!R(G) && y && (A.status = "fulfilled", A.value = !0), et(A);
|
|
1585
1586
|
}
|
|
@@ -1589,7 +1590,7 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1589
1590
|
return C.data = !0, G;
|
|
1590
1591
|
},
|
|
1591
1592
|
get error() {
|
|
1592
|
-
return C.error = !0,
|
|
1593
|
+
return C.error = !0, I;
|
|
1593
1594
|
},
|
|
1594
1595
|
get isValidating() {
|
|
1595
1596
|
return C.isValidating = !0, P;
|
|
@@ -1598,18 +1599,17 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1598
1599
|
return C.isLoading = !0, ue;
|
|
1599
1600
|
}
|
|
1600
1601
|
};
|
|
1601
|
-
}, cs = os(is),
|
|
1602
|
+
}, cs = os(is), Es = ({
|
|
1602
1603
|
fileKey: e,
|
|
1603
1604
|
authToken: t,
|
|
1604
1605
|
enabled: n = !0,
|
|
1605
1606
|
params: r = {}
|
|
1606
1607
|
}) => {
|
|
1607
|
-
const s = !!(n && e && t), { data:
|
|
1608
|
+
const { figmaRestApi: s } = An(), i = !!(n && e && t), { data: u, isLoading: l, error: d } = cs(
|
|
1608
1609
|
["useFigmaFile", e, t, r],
|
|
1609
|
-
() => s ?
|
|
1610
|
+
() => i ? s.withOptions(t ? { token: t } : {}).getFile({
|
|
1610
1611
|
fileKey: e,
|
|
1611
|
-
|
|
1612
|
-
params: r
|
|
1612
|
+
depth: r.depth
|
|
1613
1613
|
}) : null,
|
|
1614
1614
|
{
|
|
1615
1615
|
revalidateIfStale: !1,
|
|
@@ -1618,18 +1618,18 @@ const et = Oe.use || // This extra generic is to avoid TypeScript mixing up the
|
|
|
1618
1618
|
}
|
|
1619
1619
|
);
|
|
1620
1620
|
return {
|
|
1621
|
-
data:
|
|
1621
|
+
data: u != null ? u : null,
|
|
1622
1622
|
isLoading: l,
|
|
1623
|
-
error:
|
|
1623
|
+
error: d
|
|
1624
1624
|
};
|
|
1625
1625
|
};
|
|
1626
1626
|
export {
|
|
1627
1627
|
Qt as AnimaSdkContext,
|
|
1628
1628
|
hs as AnimaSdkProvider,
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1629
|
+
Tn as CreateJobError,
|
|
1630
|
+
Cn as UnknownCodegenError,
|
|
1631
|
+
ps as useAnimaCodegen,
|
|
1632
|
+
An as useAnimaSDK,
|
|
1633
|
+
Es as useFigmaFile
|
|
1634
1634
|
};
|
|
1635
1635
|
//# sourceMappingURL=index.js.map
|