@animaapp/anima-sdk 0.3.4 → 0.3.5
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 +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +199 -186
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var vn = Object.defineProperty, _n = Object.defineProperties;
|
|
2
|
+
var bn = Object.getOwnPropertyDescriptors;
|
|
3
3
|
var Rt = Object.getOwnPropertySymbols;
|
|
4
|
-
var
|
|
4
|
+
var wn = Object.prototype.hasOwnProperty, xn = Object.prototype.propertyIsEnumerable;
|
|
5
5
|
var Pt = (n) => {
|
|
6
6
|
throw TypeError(n);
|
|
7
7
|
};
|
|
8
|
-
var Mt = (n, e, t) => e in n ?
|
|
8
|
+
var Mt = (n, e, t) => e in n ? vn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, d = (n, e) => {
|
|
9
9
|
for (var t in e || (e = {}))
|
|
10
|
-
|
|
10
|
+
wn.call(e, t) && Mt(n, t, e[t]);
|
|
11
11
|
if (Rt)
|
|
12
12
|
for (var t of Rt(e))
|
|
13
|
-
|
|
13
|
+
xn.call(e, t) && Mt(n, t, e[t]);
|
|
14
14
|
return n;
|
|
15
|
-
}, y = (n, e) =>
|
|
15
|
+
}, y = (n, e) => _n(n, bn(e));
|
|
16
16
|
var lt = (n, e, t) => e.has(n) || Pt("Cannot " + t);
|
|
17
17
|
var H = (n, e, t) => (lt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), Xe = (n, e, t) => e.has(n) ? Pt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), ft = (n, e, t, s) => (lt(n, e, "write to private field"), s ? s.call(n, t) : e.set(n, t), t), $t = (n, e, t) => (lt(n, e, "access private method"), t);
|
|
18
18
|
var M = (n, e, t) => new Promise((s, r) => {
|
|
@@ -42,52 +42,65 @@ class ue extends Error {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
const Gt = "Figma Token Issue";
|
|
45
|
-
class
|
|
46
|
-
constructor({
|
|
47
|
-
|
|
45
|
+
class kn extends Error {
|
|
46
|
+
constructor({
|
|
47
|
+
fileKey: e,
|
|
48
|
+
reason: t,
|
|
49
|
+
cause: s
|
|
50
|
+
}) {
|
|
51
|
+
super(Gt), this.fileKey = e, this.reason = t, this.cause = s;
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
const Kt = "Rate Limit Exceeded";
|
|
51
|
-
class
|
|
52
|
-
constructor({ fileKey: e }) {
|
|
53
|
-
super(Kt), this.fileKey = e;
|
|
55
|
+
class Tn extends Error {
|
|
56
|
+
constructor({ fileKey: e, cause: t }) {
|
|
57
|
+
super(Kt), this.fileKey = e, this.cause = t;
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
const Xt = "Not Found";
|
|
57
|
-
class
|
|
58
|
-
constructor({ fileKey: e }) {
|
|
59
|
-
super(Xt), this.fileKey = e;
|
|
61
|
+
class Sn extends Error {
|
|
62
|
+
constructor({ fileKey: e, cause: t }) {
|
|
63
|
+
super(Xt), this.fileKey = e, this.cause = t;
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
|
-
const
|
|
66
|
+
const En = (n) => n.message === Xt, Yt = "Unknown Figma API Exception";
|
|
63
67
|
class An extends Error {
|
|
64
68
|
constructor({ fileKey: e, cause: t }) {
|
|
65
69
|
super(Yt), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
|
-
const Lr = (n) => n.message === Yt,
|
|
72
|
+
const Lr = (n) => n.message === Yt, On = (n) => n.message === Kt, Cn = (n) => [Gt, ...[
|
|
69
73
|
"Invalid Figma token",
|
|
70
74
|
"Figma token expired"
|
|
71
75
|
]].includes(
|
|
72
76
|
n.message
|
|
73
|
-
),
|
|
74
|
-
var s
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
), Qt = (n, e) => {
|
|
78
|
+
var s;
|
|
79
|
+
if (((s = n == null ? void 0 : n.cause) == null ? void 0 : s.message) === "Fetch Error") {
|
|
80
|
+
const { err: r, status: a } = n.cause.body;
|
|
81
|
+
if (a === 403)
|
|
82
|
+
return new kn({
|
|
83
|
+
fileKey: e,
|
|
84
|
+
reason: r,
|
|
85
|
+
cause: n
|
|
86
|
+
});
|
|
87
|
+
if (a === 429)
|
|
88
|
+
return new Tn({ fileKey: e, cause: n });
|
|
89
|
+
if (a === 404)
|
|
90
|
+
return new Sn({ fileKey: e, cause: n });
|
|
91
|
+
}
|
|
92
|
+
return new An({ fileKey: e, cause: n });
|
|
93
|
+
}, Ur = (n) => En(n) ? "NotFound" : On(n) ? "RateLimitExceeded" : Cn(n) ? "FigmaTokenIssue" : "UnknownFigmaApiException";
|
|
94
|
+
var Nn = Object.defineProperty, In = Object.defineProperties, jn = Object.getOwnPropertyDescriptors, Ft = Object.getOwnPropertySymbols, Zn = Object.prototype.hasOwnProperty, Rn = Object.prototype.propertyIsEnumerable, Vt = (n, e) => (e = Symbol[n]) ? e : Symbol.for("Symbol." + n), en = (n) => {
|
|
82
95
|
throw TypeError(n);
|
|
83
96
|
}, Dt = (n, e, t) => e in n ? Nn(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, U = (n, e) => {
|
|
84
97
|
for (var t in e || (e = {}))
|
|
85
98
|
Zn.call(e, t) && Dt(n, t, e[t]);
|
|
86
|
-
if (
|
|
87
|
-
for (var t of
|
|
99
|
+
if (Ft)
|
|
100
|
+
for (var t of Ft(e))
|
|
88
101
|
Rn.call(e, t) && Dt(n, t, e[t]);
|
|
89
102
|
return n;
|
|
90
|
-
}, Nt = (n, e) => In(n, jn(e)), It = (n, e, t) => e.has(n) ||
|
|
103
|
+
}, Nt = (n, e) => In(n, jn(e)), It = (n, e, t) => e.has(n) || en("Cannot " + t), T = (n, e, t) => (It(n, e, "read from private field"), t ? t.call(n) : e.get(n)), W = (n, e, t) => e.has(n) ? en("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), j = (n, e, t, s) => (It(n, e, "write to private field"), e.set(n, t), t), ee = (n, e, t) => (It(n, e, "access private method"), t), A = (n, e, t) => new Promise((s, r) => {
|
|
91
104
|
var a = (c) => {
|
|
92
105
|
try {
|
|
93
106
|
o(t.next(c));
|
|
@@ -102,58 +115,58 @@ var Nn = Object.defineProperty, In = Object.defineProperties, jn = Object.getOwn
|
|
|
102
115
|
}
|
|
103
116
|
}, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
|
|
104
117
|
o((t = t.apply(n, e)).next());
|
|
105
|
-
}), Mn = (n, e, t) => (e = n[
|
|
118
|
+
}), Mn = (n, e, t) => (e = n[Vt("asyncIterator")]) ? e.call(n) : (n = n[Vt("iterator")](), e = {}, t = (s, r) => (r = n[s]) && (e[s] = (a) => new Promise((i, o, c) => (a = r.call(n, a), c = a.done, Promise.resolve(a.value).then((u) => i({ value: u, done: c }), o)))), t("next"), t("return"), e), Pn = typeof globalThis != "undefined" ? globalThis : typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : {};
|
|
106
119
|
function $n(n) {
|
|
107
120
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
108
121
|
}
|
|
109
|
-
var gt = { exports: {} },
|
|
110
|
-
function
|
|
122
|
+
var gt = { exports: {} }, Fn = gt.exports, Lt;
|
|
123
|
+
function Vn() {
|
|
111
124
|
return Lt || (Lt = 1, function(n, e) {
|
|
112
125
|
(function(t, s) {
|
|
113
126
|
n.exports = s();
|
|
114
|
-
})(
|
|
115
|
-
var t = typeof Promise == "function", s = typeof self == "object" ? self : Pn, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", I = i && typeof Set.prototype.entries == "function", O = a && typeof Map.prototype.entries == "function", C = I && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), R = O && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), B = f && typeof Array.prototype[Symbol.iterator] == "function", re = B && Object.getPrototypeOf([][Symbol.iterator]()), de = f && typeof String.prototype[Symbol.iterator] == "function",
|
|
116
|
-
function Ce(
|
|
117
|
-
var k = typeof
|
|
127
|
+
})(Fn, function() {
|
|
128
|
+
var t = typeof Promise == "function", s = typeof self == "object" ? self : Pn, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", u = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", I = i && typeof Set.prototype.entries == "function", O = a && typeof Map.prototype.entries == "function", C = I && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), R = O && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), B = f && typeof Array.prototype[Symbol.iterator] == "function", re = B && Object.getPrototypeOf([][Symbol.iterator]()), de = f && typeof String.prototype[Symbol.iterator] == "function", V = de && Object.getPrototypeOf(""[Symbol.iterator]()), X = 8, q = -1;
|
|
129
|
+
function Ce(E) {
|
|
130
|
+
var k = typeof E;
|
|
118
131
|
if (k !== "object")
|
|
119
132
|
return k;
|
|
120
|
-
if (
|
|
133
|
+
if (E === null)
|
|
121
134
|
return "null";
|
|
122
|
-
if (
|
|
135
|
+
if (E === s)
|
|
123
136
|
return "global";
|
|
124
|
-
if (Array.isArray(
|
|
137
|
+
if (Array.isArray(E) && (_ === !1 || !(Symbol.toStringTag in E)))
|
|
125
138
|
return "Array";
|
|
126
139
|
if (typeof window == "object" && window !== null) {
|
|
127
|
-
if (typeof window.location == "object" &&
|
|
140
|
+
if (typeof window.location == "object" && E === window.location)
|
|
128
141
|
return "Location";
|
|
129
|
-
if (typeof window.document == "object" &&
|
|
142
|
+
if (typeof window.document == "object" && E === window.document)
|
|
130
143
|
return "Document";
|
|
131
144
|
if (typeof window.navigator == "object") {
|
|
132
|
-
if (typeof window.navigator.mimeTypes == "object" &&
|
|
145
|
+
if (typeof window.navigator.mimeTypes == "object" && E === window.navigator.mimeTypes)
|
|
133
146
|
return "MimeTypeArray";
|
|
134
|
-
if (typeof window.navigator.plugins == "object" &&
|
|
147
|
+
if (typeof window.navigator.plugins == "object" && E === window.navigator.plugins)
|
|
135
148
|
return "PluginArray";
|
|
136
149
|
}
|
|
137
|
-
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") &&
|
|
138
|
-
if (
|
|
150
|
+
if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && E instanceof window.HTMLElement) {
|
|
151
|
+
if (E.tagName === "BLOCKQUOTE")
|
|
139
152
|
return "HTMLQuoteElement";
|
|
140
|
-
if (
|
|
153
|
+
if (E.tagName === "TD")
|
|
141
154
|
return "HTMLTableDataCellElement";
|
|
142
|
-
if (
|
|
155
|
+
if (E.tagName === "TH")
|
|
143
156
|
return "HTMLTableHeaderCellElement";
|
|
144
157
|
}
|
|
145
158
|
}
|
|
146
|
-
var ut = _ &&
|
|
159
|
+
var ut = _ && E[Symbol.toStringTag];
|
|
147
160
|
if (typeof ut == "string")
|
|
148
161
|
return ut;
|
|
149
|
-
var D = Object.getPrototypeOf(
|
|
150
|
-
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" : u && D === DataView.prototype ? "DataView" : a && D === R ? "Map Iterator" : i && D === C ? "Set Iterator" : B && D === re ? "Array Iterator" : de && D ===
|
|
162
|
+
var D = Object.getPrototypeOf(E);
|
|
163
|
+
return D === RegExp.prototype ? "RegExp" : D === Date.prototype ? "Date" : t && D === Promise.prototype ? "Promise" : i && D === Set.prototype ? "Set" : a && D === Map.prototype ? "Map" : c && D === WeakSet.prototype ? "WeakSet" : o && D === WeakMap.prototype ? "WeakMap" : u && D === DataView.prototype ? "DataView" : a && D === R ? "Map Iterator" : i && D === C ? "Set Iterator" : B && D === re ? "Array Iterator" : de && D === V ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(E).slice(X, q);
|
|
151
164
|
}
|
|
152
165
|
return Ce;
|
|
153
166
|
});
|
|
154
167
|
}(gt)), gt.exports;
|
|
155
168
|
}
|
|
156
|
-
var Dn =
|
|
169
|
+
var Dn = Vn();
|
|
157
170
|
const Ln = /* @__PURE__ */ $n(Dn), jt = typeof Buffer != "undefined", Un = jt && typeof Buffer.from != "undefined", zn = jt ? (
|
|
158
171
|
/**
|
|
159
172
|
* is value is Buffer?
|
|
@@ -418,32 +431,32 @@ function bt(n, e, t, s, r) {
|
|
|
418
431
|
return e;
|
|
419
432
|
}
|
|
420
433
|
const ds = (n) => new Promise((e) => setTimeout(e, n));
|
|
421
|
-
var Ye, ye, Qe, wt,
|
|
434
|
+
var Ye, ye, Qe, wt, tn;
|
|
422
435
|
class us {
|
|
423
436
|
constructor({ maxAttempts: e = 3, func: t }) {
|
|
424
437
|
W(this, wt), W(this, Ye), W(this, ye), W(this, Qe), j(this, Ye, e), j(this, Qe, t), j(this, ye, 0);
|
|
425
438
|
}
|
|
426
439
|
run() {
|
|
427
|
-
return
|
|
440
|
+
return A(this, null, function* () {
|
|
428
441
|
try {
|
|
429
442
|
return yield T(this, Qe).call(this);
|
|
430
443
|
} catch (e) {
|
|
431
444
|
if (j(this, ye, T(this, ye) + 1), T(this, ye) > T(this, Ye))
|
|
432
445
|
throw console.error("Max attempts reached"), e;
|
|
433
|
-
const t = ee(this, wt,
|
|
446
|
+
const t = ee(this, wt, tn).call(this);
|
|
434
447
|
return yield ds(t), yield this.run();
|
|
435
448
|
}
|
|
436
449
|
});
|
|
437
450
|
}
|
|
438
451
|
}
|
|
439
|
-
Ye = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakSet(),
|
|
452
|
+
Ye = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), Qe = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakSet(), tn = function() {
|
|
440
453
|
return T(this, ye) * 1e3 * 1.5;
|
|
441
454
|
};
|
|
442
455
|
function ls() {
|
|
443
456
|
return typeof CompressionStream != "undefined";
|
|
444
457
|
}
|
|
445
458
|
function fs(n) {
|
|
446
|
-
return
|
|
459
|
+
return A(this, null, function* () {
|
|
447
460
|
const e = new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
|
|
448
461
|
try {
|
|
449
462
|
for (var s = Mn(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
|
|
@@ -464,7 +477,7 @@ function fs(n) {
|
|
|
464
477
|
});
|
|
465
478
|
}
|
|
466
479
|
function hs(n) {
|
|
467
|
-
return
|
|
480
|
+
return A(this, null, function* () {
|
|
468
481
|
const e = yield new Blob(n).arrayBuffer();
|
|
469
482
|
return new Uint8Array(e);
|
|
470
483
|
});
|
|
@@ -518,7 +531,7 @@ class pt extends Error {
|
|
|
518
531
|
super(e), this.name = "Request Validation Error";
|
|
519
532
|
}
|
|
520
533
|
}
|
|
521
|
-
function
|
|
534
|
+
function nn() {
|
|
522
535
|
return Array.from(
|
|
523
536
|
{ length: 32 },
|
|
524
537
|
() => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
|
|
@@ -528,10 +541,10 @@ function xt() {
|
|
|
528
541
|
return Math.floor(Date.now() / 1e3).toString();
|
|
529
542
|
}
|
|
530
543
|
const ys = 5 * 60 * 1e3, gs = 1 * 1e3;
|
|
531
|
-
var ge,
|
|
544
|
+
var ge, F, Y, kt, Tt, je;
|
|
532
545
|
class vs {
|
|
533
546
|
constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
|
|
534
|
-
W(this, Y), W(this, ge), W(this,
|
|
547
|
+
W(this, Y), W(this, ge), W(this, F), this.baseAddress = t, j(this, ge, e), j(this, F, {}), this.plugins = [];
|
|
535
548
|
}
|
|
536
549
|
get headers() {
|
|
537
550
|
throw new Error("Missing implementation");
|
|
@@ -543,44 +556,44 @@ class vs {
|
|
|
543
556
|
this.plugins = this.plugins.filter((t) => t.name !== e);
|
|
544
557
|
}
|
|
545
558
|
withOptions(e = {}) {
|
|
546
|
-
return j(this,
|
|
559
|
+
return j(this, F, e), this;
|
|
547
560
|
}
|
|
548
561
|
get(e) {
|
|
549
|
-
return
|
|
562
|
+
return A(this, arguments, function* (t, s = {}) {
|
|
550
563
|
const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
|
|
551
564
|
let o = a != null ? a : this.headers;
|
|
552
|
-
const c = Ne(T(this,
|
|
553
|
-
return j(this,
|
|
565
|
+
const c = Ne(T(this, F));
|
|
566
|
+
return j(this, F, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = Nt(U({}, o), { "X-Request-Nonce": nn(), "X-Request-Timestamp": xt() })), c.async ? yield ee(this, Y, Tt).call(this, `${i}${t}`, c.async, { headers: o }) : yield ee(this, Y, kt).call(this, `${i}${t}`, c, { headers: o });
|
|
554
567
|
});
|
|
555
568
|
}
|
|
556
569
|
post(e, t) {
|
|
557
|
-
return
|
|
558
|
-
const i = Ne(T(this,
|
|
559
|
-
return j(this,
|
|
570
|
+
return A(this, arguments, function* (s, r, a = {}) {
|
|
571
|
+
const i = Ne(T(this, F));
|
|
572
|
+
return j(this, F, {}), ee(this, Y, je).call(this, s, "POST", r, a, i);
|
|
560
573
|
});
|
|
561
574
|
}
|
|
562
575
|
put(e, t) {
|
|
563
|
-
return
|
|
564
|
-
const i = Ne(T(this,
|
|
565
|
-
return j(this,
|
|
576
|
+
return A(this, arguments, function* (s, r, a = {}) {
|
|
577
|
+
const i = Ne(T(this, F));
|
|
578
|
+
return j(this, F, {}), ee(this, Y, je).call(this, s, "PUT", r, a, i);
|
|
566
579
|
});
|
|
567
580
|
}
|
|
568
581
|
delete(e, t) {
|
|
569
|
-
return
|
|
570
|
-
const i = Ne(T(this,
|
|
571
|
-
return j(this,
|
|
582
|
+
return A(this, arguments, function* (s, r, a = {}) {
|
|
583
|
+
const i = Ne(T(this, F));
|
|
584
|
+
return j(this, F, {}), ee(this, Y, je).call(this, s, "DELETE", r, a, i);
|
|
572
585
|
});
|
|
573
586
|
}
|
|
574
587
|
patch(e, t) {
|
|
575
|
-
return
|
|
576
|
-
const i = Ne(T(this,
|
|
577
|
-
return j(this,
|
|
588
|
+
return A(this, arguments, function* (s, r, a = {}) {
|
|
589
|
+
const i = Ne(T(this, F));
|
|
590
|
+
return j(this, F, {}), ee(this, Y, je).call(this, s, "PATCH", r, a, i);
|
|
578
591
|
});
|
|
579
592
|
}
|
|
580
593
|
}
|
|
581
|
-
ge = /* @__PURE__ */ new WeakMap(),
|
|
582
|
-
return
|
|
583
|
-
const s = () =>
|
|
594
|
+
ge = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakSet(), kt = function(n, e, t) {
|
|
595
|
+
return A(this, null, function* () {
|
|
596
|
+
const s = () => A(this, null, function* () {
|
|
584
597
|
var c, u;
|
|
585
598
|
try {
|
|
586
599
|
return yield T(this, ge).call(this, n, U(U({}, t), e.abortSignal && { signal: e.abortSignal }));
|
|
@@ -590,7 +603,7 @@ ge = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
590
603
|
}), { headers: r } = t != null ? t : {}, a = (c, u) => {
|
|
591
604
|
var f, _;
|
|
592
605
|
return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(u)) || ((_ = c == null ? void 0 : c.headersObject) == null ? void 0 : _[u]) || "";
|
|
593
|
-
}, i = (c) =>
|
|
606
|
+
}, i = (c) => A(this, null, function* () {
|
|
594
607
|
var u;
|
|
595
608
|
if (!c.ok) {
|
|
596
609
|
const _ = yield c.text().catch();
|
|
@@ -633,7 +646,7 @@ ge = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
633
646
|
return yield i(o);
|
|
634
647
|
});
|
|
635
648
|
}, Tt = function(n, e, t) {
|
|
636
|
-
return
|
|
649
|
+
return A(this, null, function* () {
|
|
637
650
|
var s, r;
|
|
638
651
|
const {
|
|
639
652
|
onProgress: a,
|
|
@@ -661,43 +674,43 @@ ge = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), Y = /* @_
|
|
|
661
674
|
const I = yield _.json(), { job_id: O } = I;
|
|
662
675
|
if (!O)
|
|
663
676
|
throw new Error("Job ID not found in response");
|
|
664
|
-
return new Promise((C, R) =>
|
|
677
|
+
return new Promise((C, R) => A(this, null, function* () {
|
|
665
678
|
const B = setTimeout(() => {
|
|
666
679
|
R(new Error("Job timed out"));
|
|
667
|
-
}, c), re = (de = 0) =>
|
|
680
|
+
}, c), re = (de = 0) => A(this, null, function* () {
|
|
668
681
|
if (i != null && i.aborted) {
|
|
669
682
|
clearTimeout(B), T(this, ge).call(this, `${f}/${O}/cancel`, { method: "POST", headers: this.headers }).then(() => {
|
|
670
683
|
R(new Ie({ canceled: !0 }));
|
|
671
|
-
}).catch((
|
|
684
|
+
}).catch((V) => {
|
|
672
685
|
R(new Ie({ canceled: !1 }));
|
|
673
686
|
});
|
|
674
687
|
return;
|
|
675
688
|
}
|
|
676
689
|
try {
|
|
677
|
-
const
|
|
678
|
-
if (
|
|
690
|
+
const V = yield (yield T(this, ge).call(this, `${f}/${O}`, { headers: this.headers })).json();
|
|
691
|
+
if (V.status === "success") {
|
|
679
692
|
clearTimeout(B);
|
|
680
|
-
const X =
|
|
693
|
+
const X = V.response_json;
|
|
681
694
|
C(X);
|
|
682
|
-
} else if (
|
|
683
|
-
clearTimeout(B), R(new ms(
|
|
695
|
+
} else if (V.status === "failed")
|
|
696
|
+
clearTimeout(B), R(new ms(V.response_json));
|
|
684
697
|
else {
|
|
685
|
-
a && a(
|
|
698
|
+
a && a(V.response_json);
|
|
686
699
|
const X = o(de);
|
|
687
700
|
setTimeout(() => re(de + 1), X);
|
|
688
701
|
}
|
|
689
|
-
} catch (
|
|
690
|
-
R(
|
|
702
|
+
} catch (V) {
|
|
703
|
+
R(V);
|
|
691
704
|
}
|
|
692
705
|
});
|
|
693
706
|
re();
|
|
694
707
|
}));
|
|
695
708
|
});
|
|
696
709
|
}, je = function(n, e, t, s, r) {
|
|
697
|
-
return
|
|
710
|
+
return A(this, null, function* () {
|
|
698
711
|
const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
|
|
699
712
|
let c = i != null ? i : this.headers;
|
|
700
|
-
r.extraHeaders && (c = U(U({}, c), r.extraHeaders)), r.requestValidation && (c = Nt(U({}, c), { "X-Request-Nonce":
|
|
713
|
+
r.extraHeaders && (c = U(U({}, c), r.extraHeaders)), r.requestValidation && (c = Nt(U({}, c), { "X-Request-Nonce": nn(), "X-Request-Timestamp": xt() }));
|
|
701
714
|
let u = s.skipBodyJsonStringify ? t : JSON.stringify(t);
|
|
702
715
|
return r.compress && ls() && (c["Content-Encoding"] = "gzip", u = yield fs(u)), r.async ? yield ee(this, Y, Tt).call(this, `${o}${n}`, r.async, {
|
|
703
716
|
method: e,
|
|
@@ -733,7 +746,7 @@ class _s {
|
|
|
733
746
|
W(this, Ze), this.resourceName = "Files", j(this, Ze, e);
|
|
734
747
|
}
|
|
735
748
|
get(e) {
|
|
736
|
-
return
|
|
749
|
+
return A(this, arguments, function* ({ fileKey: t, params: s = {} }) {
|
|
737
750
|
const r = new URLSearchParams(U({
|
|
738
751
|
plugin_data: "857346721138427857"
|
|
739
752
|
}, s)).toString(), a = `v1/files/${t}?${r}`;
|
|
@@ -741,7 +754,7 @@ class _s {
|
|
|
741
754
|
});
|
|
742
755
|
}
|
|
743
756
|
getImageFills(e) {
|
|
744
|
-
return
|
|
757
|
+
return A(this, arguments, function* ({ fileKey: t }) {
|
|
745
758
|
var s, r;
|
|
746
759
|
const a = `v1/files/${t}/images`;
|
|
747
760
|
return (r = (s = (yield T(this, Ze).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
|
|
@@ -753,7 +766,7 @@ const bs = (n, e, t) => {
|
|
|
753
766
|
const s = e.sort();
|
|
754
767
|
return `${n}-${s.join("-")}-${t}`;
|
|
755
768
|
}, ws = (n) => n ? n.ts > Date.now() - 1e3 * 30 : !1;
|
|
756
|
-
var Q, St,
|
|
769
|
+
var Q, St, sn;
|
|
757
770
|
class xs {
|
|
758
771
|
constructor(e) {
|
|
759
772
|
W(this, St), W(this, Q), this.resourceName = "Images", j(this, Q, e);
|
|
@@ -763,7 +776,7 @@ class xs {
|
|
|
763
776
|
* Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
|
|
764
777
|
*/
|
|
765
778
|
get(e) {
|
|
766
|
-
return
|
|
779
|
+
return A(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
|
|
767
780
|
const i = bs(t, s, r), o = T(this, Q).cache.images.entries.get(i);
|
|
768
781
|
if (ws(o))
|
|
769
782
|
return o.result;
|
|
@@ -771,7 +784,7 @@ class xs {
|
|
|
771
784
|
const c = T(this, Q).cache.images.pendingRequests.get(i);
|
|
772
785
|
if (c)
|
|
773
786
|
return c;
|
|
774
|
-
const u = ee(this, St,
|
|
787
|
+
const u = ee(this, St, sn).call(this, i, t, s, r, a);
|
|
775
788
|
T(this, Q).cache.images.pendingRequests.set(i, u);
|
|
776
789
|
try {
|
|
777
790
|
return yield u;
|
|
@@ -781,8 +794,8 @@ class xs {
|
|
|
781
794
|
});
|
|
782
795
|
}
|
|
783
796
|
}
|
|
784
|
-
Q = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(),
|
|
785
|
-
return
|
|
797
|
+
Q = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), sn = function(n, e, t, s, r) {
|
|
798
|
+
return A(this, null, function* () {
|
|
786
799
|
const a = yield T(this, Q).get(
|
|
787
800
|
`v1/images/${e}?ids=${t}&format=${s}${r ? `&scale=${r}` : ""}`
|
|
788
801
|
);
|
|
@@ -798,7 +811,7 @@ class ks {
|
|
|
798
811
|
W(this, et), this.resourceName = "Nodes", j(this, et, e);
|
|
799
812
|
}
|
|
800
813
|
get(e) {
|
|
801
|
-
return
|
|
814
|
+
return A(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
|
|
802
815
|
const a = Nt(U({}, r), {
|
|
803
816
|
ids: s.join(",")
|
|
804
817
|
}), i = new URLSearchParams(U({
|
|
@@ -810,7 +823,7 @@ class ks {
|
|
|
810
823
|
}
|
|
811
824
|
et = /* @__PURE__ */ new WeakMap();
|
|
812
825
|
var le;
|
|
813
|
-
class
|
|
826
|
+
class rn extends vs {
|
|
814
827
|
constructor({
|
|
815
828
|
baseAddress: e = "https://api.figma.com/",
|
|
816
829
|
fetch: t = globalThis.fetch.bind(globalThis)
|
|
@@ -841,7 +854,7 @@ le = /* @__PURE__ */ new WeakMap();
|
|
|
841
854
|
const Ts = (r) => M(void 0, [r], function* ({
|
|
842
855
|
fileKey: n,
|
|
843
856
|
authToken: e,
|
|
844
|
-
figmaRestApi: t = new
|
|
857
|
+
figmaRestApi: t = new rn(),
|
|
845
858
|
params: s = {}
|
|
846
859
|
}) {
|
|
847
860
|
e && (t.token = e);
|
|
@@ -851,13 +864,13 @@ const Ts = (r) => M(void 0, [r], function* ({
|
|
|
851
864
|
params: s
|
|
852
865
|
});
|
|
853
866
|
} catch (a) {
|
|
854
|
-
throw console.error(a), a;
|
|
867
|
+
throw console.error(a), Qt(a, n);
|
|
855
868
|
}
|
|
856
869
|
}), zr = (a) => M(void 0, [a], function* ({
|
|
857
870
|
fileKey: n,
|
|
858
871
|
authToken: e,
|
|
859
872
|
nodeIds: t,
|
|
860
|
-
figmaRestApi: s = new
|
|
873
|
+
figmaRestApi: s = new rn(),
|
|
861
874
|
params: r = {}
|
|
862
875
|
}) {
|
|
863
876
|
e && (s.token = e);
|
|
@@ -868,14 +881,14 @@ const Ts = (r) => M(void 0, [r], function* ({
|
|
|
868
881
|
params: d({}, r)
|
|
869
882
|
})).nodes;
|
|
870
883
|
} catch (i) {
|
|
871
|
-
|
|
884
|
+
throw Qt(i, n);
|
|
872
885
|
}
|
|
873
|
-
}),
|
|
886
|
+
}), an = (n, e) => {
|
|
874
887
|
if (n.id === e)
|
|
875
888
|
return n;
|
|
876
889
|
if ("children" in n)
|
|
877
890
|
for (const t of n.children) {
|
|
878
|
-
const s =
|
|
891
|
+
const s = an(t, e);
|
|
879
892
|
if (s)
|
|
880
893
|
return s;
|
|
881
894
|
}
|
|
@@ -917,10 +930,10 @@ var x;
|
|
|
917
930
|
}
|
|
918
931
|
n.joinValues = s, n.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
|
|
919
932
|
})(x || (x = {}));
|
|
920
|
-
var
|
|
933
|
+
var Et;
|
|
921
934
|
(function(n) {
|
|
922
935
|
n.mergeShapes = (e, t) => d(d({}, e), t);
|
|
923
|
-
})(
|
|
936
|
+
})(Et || (Et = {}));
|
|
924
937
|
const p = x.arrayToEnum([
|
|
925
938
|
"string",
|
|
926
939
|
"nan",
|
|
@@ -1041,7 +1054,7 @@ class z extends Error {
|
|
|
1041
1054
|
}
|
|
1042
1055
|
}
|
|
1043
1056
|
z.create = (n) => new z(n);
|
|
1044
|
-
const
|
|
1057
|
+
const Ee = (n, e) => {
|
|
1045
1058
|
let t;
|
|
1046
1059
|
switch (n.code) {
|
|
1047
1060
|
case l.invalid_type:
|
|
@@ -1097,12 +1110,12 @@ const Ae = (n, e) => {
|
|
|
1097
1110
|
}
|
|
1098
1111
|
return { message: t };
|
|
1099
1112
|
};
|
|
1100
|
-
let
|
|
1101
|
-
function
|
|
1102
|
-
|
|
1113
|
+
let on = Ee;
|
|
1114
|
+
function Es(n) {
|
|
1115
|
+
on = n;
|
|
1103
1116
|
}
|
|
1104
1117
|
function tt() {
|
|
1105
|
-
return
|
|
1118
|
+
return on;
|
|
1106
1119
|
}
|
|
1107
1120
|
const nt = (n) => {
|
|
1108
1121
|
const { data: e, path: t, errorMaps: s, issueData: r } = n, a = [...t, ...r.path || []], i = y(d({}, r), {
|
|
@@ -1121,7 +1134,7 @@ const nt = (n) => {
|
|
|
1121
1134
|
path: a,
|
|
1122
1135
|
message: o
|
|
1123
1136
|
});
|
|
1124
|
-
},
|
|
1137
|
+
}, As = [];
|
|
1125
1138
|
function h(n, e) {
|
|
1126
1139
|
const t = tt(), s = nt({
|
|
1127
1140
|
issueData: e,
|
|
@@ -1134,7 +1147,7 @@ function h(n, e) {
|
|
|
1134
1147
|
// then schema-bound map if available
|
|
1135
1148
|
t,
|
|
1136
1149
|
// then global override map
|
|
1137
|
-
t ===
|
|
1150
|
+
t === Ee ? void 0 : Ee
|
|
1138
1151
|
// then global default map
|
|
1139
1152
|
].filter((r) => !!r)
|
|
1140
1153
|
});
|
|
@@ -1185,12 +1198,12 @@ class Z {
|
|
|
1185
1198
|
}
|
|
1186
1199
|
const v = Object.freeze({
|
|
1187
1200
|
status: "aborted"
|
|
1188
|
-
}), ke = (n) => ({ status: "dirty", value: n }), $ = (n) => ({ status: "valid", value: n }),
|
|
1201
|
+
}), ke = (n) => ({ status: "dirty", value: n }), $ = (n) => ({ status: "valid", value: n }), At = (n) => n.status === "aborted", Ot = (n) => n.status === "dirty", _e = (n) => n.status === "valid", Pe = (n) => typeof Promise != "undefined" && n instanceof Promise;
|
|
1189
1202
|
function st(n, e, t, s) {
|
|
1190
1203
|
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
1191
1204
|
return e.get(n);
|
|
1192
1205
|
}
|
|
1193
|
-
function
|
|
1206
|
+
function cn(n, e, t, s, r) {
|
|
1194
1207
|
if (typeof e == "function" ? n !== e || !0 : !e.has(n)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
1195
1208
|
return e.set(n, t), t;
|
|
1196
1209
|
}
|
|
@@ -1454,21 +1467,21 @@ class w {
|
|
|
1454
1467
|
}
|
|
1455
1468
|
const Os = /^c[^\s-]{8,}$/i, Cs = /^[0-9a-z]+$/, Ns = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Is = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, js = /^[a-z0-9_-]{21}$/i, Zs = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Rs = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ms = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ps = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1456
1469
|
let yt;
|
|
1457
|
-
const $s = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
1458
|
-
function
|
|
1470
|
+
const $s = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Fs = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Vs = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ds = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ls = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Us = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, dn = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", zs = new RegExp(`^${dn}$`);
|
|
1471
|
+
function un(n) {
|
|
1459
1472
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
1460
1473
|
return n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
1461
1474
|
}
|
|
1462
1475
|
function Ws(n) {
|
|
1463
|
-
return new RegExp(`^${
|
|
1476
|
+
return new RegExp(`^${un(n)}$`);
|
|
1464
1477
|
}
|
|
1465
|
-
function
|
|
1466
|
-
let e = `${
|
|
1478
|
+
function ln(n) {
|
|
1479
|
+
let e = `${dn}T${un(n)}`;
|
|
1467
1480
|
const t = [];
|
|
1468
1481
|
return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
1469
1482
|
}
|
|
1470
1483
|
function Bs(n, e) {
|
|
1471
|
-
return !!((e === "v4" || !e) && $s.test(n) || (e === "v6" || !e) &&
|
|
1484
|
+
return !!((e === "v4" || !e) && $s.test(n) || (e === "v6" || !e) && Vs.test(n));
|
|
1472
1485
|
}
|
|
1473
1486
|
function qs(n, e) {
|
|
1474
1487
|
if (!Zs.test(n))
|
|
@@ -1481,7 +1494,7 @@ function qs(n, e) {
|
|
|
1481
1494
|
}
|
|
1482
1495
|
}
|
|
1483
1496
|
function Hs(n, e) {
|
|
1484
|
-
return !!((e === "v4" || !e) &&
|
|
1497
|
+
return !!((e === "v4" || !e) && Fs.test(n) || (e === "v6" || !e) && Ds.test(n));
|
|
1485
1498
|
}
|
|
1486
1499
|
class J extends w {
|
|
1487
1500
|
_parse(e) {
|
|
@@ -1599,7 +1612,7 @@ class J extends w {
|
|
|
1599
1612
|
code: l.invalid_string,
|
|
1600
1613
|
validation: { endsWith: a.value },
|
|
1601
1614
|
message: a.message
|
|
1602
|
-
}), s.dirty()) : a.kind === "datetime" ?
|
|
1615
|
+
}), s.dirty()) : a.kind === "datetime" ? ln(a).test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
|
|
1603
1616
|
code: l.invalid_string,
|
|
1604
1617
|
validation: "datetime",
|
|
1605
1618
|
message: a.message
|
|
@@ -2269,7 +2282,7 @@ class rt extends w {
|
|
|
2269
2282
|
rt.create = (n) => new rt(d({
|
|
2270
2283
|
typeName: g.ZodSymbol
|
|
2271
2284
|
}, b(n)));
|
|
2272
|
-
class
|
|
2285
|
+
class Fe extends w {
|
|
2273
2286
|
_parse(e) {
|
|
2274
2287
|
if (this._getType(e) !== p.undefined) {
|
|
2275
2288
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2282,10 +2295,10 @@ class Ve extends w {
|
|
|
2282
2295
|
return $(e.data);
|
|
2283
2296
|
}
|
|
2284
2297
|
}
|
|
2285
|
-
|
|
2298
|
+
Fe.create = (n) => new Fe(d({
|
|
2286
2299
|
typeName: g.ZodUndefined
|
|
2287
2300
|
}, b(n)));
|
|
2288
|
-
class
|
|
2301
|
+
class Ve extends w {
|
|
2289
2302
|
_parse(e) {
|
|
2290
2303
|
if (this._getType(e) !== p.null) {
|
|
2291
2304
|
const s = this._getOrReturnCtx(e);
|
|
@@ -2298,10 +2311,10 @@ class Fe extends w {
|
|
|
2298
2311
|
return $(e.data);
|
|
2299
2312
|
}
|
|
2300
2313
|
}
|
|
2301
|
-
|
|
2314
|
+
Ve.create = (n) => new Ve(d({
|
|
2302
2315
|
typeName: g.ZodNull
|
|
2303
2316
|
}, b(n)));
|
|
2304
|
-
class
|
|
2317
|
+
class Ae extends w {
|
|
2305
2318
|
constructor() {
|
|
2306
2319
|
super(...arguments), this._any = !0;
|
|
2307
2320
|
}
|
|
@@ -2309,7 +2322,7 @@ class Ee extends w {
|
|
|
2309
2322
|
return $(e.data);
|
|
2310
2323
|
}
|
|
2311
2324
|
}
|
|
2312
|
-
|
|
2325
|
+
Ae.create = (n) => new Ae(d({
|
|
2313
2326
|
typeName: g.ZodAny
|
|
2314
2327
|
}, b(n)));
|
|
2315
2328
|
class ve extends w {
|
|
@@ -2682,7 +2695,7 @@ class S extends w {
|
|
|
2682
2695
|
}));
|
|
2683
2696
|
}
|
|
2684
2697
|
keyof() {
|
|
2685
|
-
return
|
|
2698
|
+
return fn(x.objectKeys(this.shape));
|
|
2686
2699
|
}
|
|
2687
2700
|
}
|
|
2688
2701
|
S.create = (n, e) => new S(d({
|
|
@@ -2771,7 +2784,7 @@ De.create = (n, e) => new De(d({
|
|
|
2771
2784
|
options: n,
|
|
2772
2785
|
typeName: g.ZodUnion
|
|
2773
2786
|
}, b(e)));
|
|
2774
|
-
const ie = (n) => n instanceof ze ? ie(n.schema) : n instanceof K ? ie(n.innerType()) : n instanceof We ? [n.value] : n instanceof pe ? n.options : n instanceof Be ? x.objectValues(n.enum) : n instanceof qe ? ie(n._def.innerType) : n instanceof
|
|
2787
|
+
const ie = (n) => n instanceof ze ? ie(n.schema) : n instanceof K ? ie(n.innerType()) : n instanceof We ? [n.value] : n instanceof pe ? n.options : n instanceof Be ? x.objectValues(n.enum) : n instanceof qe ? ie(n._def.innerType) : n instanceof Fe ? [void 0] : n instanceof Ve ? [null] : n instanceof te ? [void 0, ...ie(n.unwrap())] : n instanceof me ? [null, ...ie(n.unwrap())] : n instanceof Zt || n instanceof Je ? ie(n.unwrap()) : n instanceof He ? ie(n._def.innerType) : [];
|
|
2775
2788
|
class dt extends w {
|
|
2776
2789
|
_parse(e) {
|
|
2777
2790
|
const { ctx: t } = this._processInputParams(e);
|
|
@@ -2862,7 +2875,7 @@ function Ct(n, e) {
|
|
|
2862
2875
|
class Le extends w {
|
|
2863
2876
|
_parse(e) {
|
|
2864
2877
|
const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
|
|
2865
|
-
if (
|
|
2878
|
+
if (At(a) || At(i))
|
|
2866
2879
|
return v;
|
|
2867
2880
|
const o = Ct(a.value, i.value);
|
|
2868
2881
|
return o.valid ? ((Ot(a) || Ot(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
|
|
@@ -3111,7 +3124,7 @@ class Te extends w {
|
|
|
3111
3124
|
t.common.contextualErrorMap,
|
|
3112
3125
|
t.schemaErrorMap,
|
|
3113
3126
|
tt(),
|
|
3114
|
-
|
|
3127
|
+
Ee
|
|
3115
3128
|
].filter((u) => !!u),
|
|
3116
3129
|
issueData: {
|
|
3117
3130
|
code: l.invalid_arguments,
|
|
@@ -3127,7 +3140,7 @@ class Te extends w {
|
|
|
3127
3140
|
t.common.contextualErrorMap,
|
|
3128
3141
|
t.schemaErrorMap,
|
|
3129
3142
|
tt(),
|
|
3130
|
-
|
|
3143
|
+
Ee
|
|
3131
3144
|
].filter((u) => !!u),
|
|
3132
3145
|
issueData: {
|
|
3133
3146
|
code: l.invalid_return_type,
|
|
@@ -3224,7 +3237,7 @@ We.create = (n, e) => new We(d({
|
|
|
3224
3237
|
value: n,
|
|
3225
3238
|
typeName: g.ZodLiteral
|
|
3226
3239
|
}, b(e)));
|
|
3227
|
-
function
|
|
3240
|
+
function fn(n, e) {
|
|
3228
3241
|
return new pe(d({
|
|
3229
3242
|
values: n,
|
|
3230
3243
|
typeName: g.ZodEnum
|
|
@@ -3243,7 +3256,7 @@ class pe extends w {
|
|
|
3243
3256
|
code: l.invalid_type
|
|
3244
3257
|
}), v;
|
|
3245
3258
|
}
|
|
3246
|
-
if (st(this, Re) ||
|
|
3259
|
+
if (st(this, Re) || cn(this, Re, new Set(this._def.values)), !st(this, Re).has(e.data)) {
|
|
3247
3260
|
const t = this._getOrReturnCtx(e), s = this._def.values;
|
|
3248
3261
|
return h(t, {
|
|
3249
3262
|
received: t.data,
|
|
@@ -3282,7 +3295,7 @@ class pe extends w {
|
|
|
3282
3295
|
}
|
|
3283
3296
|
}
|
|
3284
3297
|
Re = /* @__PURE__ */ new WeakMap();
|
|
3285
|
-
pe.create =
|
|
3298
|
+
pe.create = fn;
|
|
3286
3299
|
class Be extends w {
|
|
3287
3300
|
constructor() {
|
|
3288
3301
|
super(...arguments), Me.set(this, void 0);
|
|
@@ -3297,7 +3310,7 @@ class Be extends w {
|
|
|
3297
3310
|
code: l.invalid_type
|
|
3298
3311
|
}), v;
|
|
3299
3312
|
}
|
|
3300
|
-
if (st(this, Me) ||
|
|
3313
|
+
if (st(this, Me) || cn(this, Me, new Set(x.getValidEnumValues(this._def.values))), !st(this, Me).has(e.data)) {
|
|
3301
3314
|
const r = x.objectValues(t);
|
|
3302
3315
|
return h(s, {
|
|
3303
3316
|
received: s.data,
|
|
@@ -3590,14 +3603,14 @@ Je.create = (n, e) => new Je(d({
|
|
|
3590
3603
|
innerType: n,
|
|
3591
3604
|
typeName: g.ZodReadonly
|
|
3592
3605
|
}, b(e)));
|
|
3593
|
-
function
|
|
3594
|
-
return n ?
|
|
3606
|
+
function hn(n, e = {}, t) {
|
|
3607
|
+
return n ? Ae.create().superRefine((s, r) => {
|
|
3595
3608
|
var a, i;
|
|
3596
3609
|
if (!n(s)) {
|
|
3597
3610
|
const o = typeof e == "function" ? e(s) : typeof e == "string" ? { message: e } : e, c = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, u = typeof o == "string" ? { message: o } : o;
|
|
3598
3611
|
r.addIssue(y(d({ code: "custom" }, u), { fatal: c }));
|
|
3599
3612
|
}
|
|
3600
|
-
}) :
|
|
3613
|
+
}) : Ae.create();
|
|
3601
3614
|
}
|
|
3602
3615
|
const Ks = {
|
|
3603
3616
|
object: S.lazycreate
|
|
@@ -3608,7 +3621,7 @@ var g;
|
|
|
3608
3621
|
})(g || (g = {}));
|
|
3609
3622
|
const Xs = (n, e = {
|
|
3610
3623
|
message: `Input not instance of ${n.name}`
|
|
3611
|
-
}) =>
|
|
3624
|
+
}) => hn((t) => t instanceof n, e), pn = J.create, mn = fe.create, Ys = ot.create, Qs = he.create, yn = $e.create, er = be.create, tr = rt.create, nr = Fe.create, sr = Ve.create, rr = Ae.create, ar = ve.create, ir = ce.create, or = at.create, cr = G.create, dr = S.create, ur = S.strictCreate, lr = De.create, fr = dt.create, hr = Le.create, pr = se.create, mr = Ue.create, yr = it.create, gr = we.create, vr = Te.create, _r = ze.create, br = We.create, wr = pe.create, xr = Be.create, kr = Oe.create, Ht = K.create, Tr = te.create, Sr = me.create, Er = K.createWithPreprocess, Ar = Ke.create, Or = () => pn().optional(), Cr = () => mn().optional(), Nr = () => yn().optional(), Ir = {
|
|
3612
3625
|
string: (n) => J.create(y(d({}, n), { coerce: !0 })),
|
|
3613
3626
|
number: (n) => fe.create(y(d({}, n), { coerce: !0 })),
|
|
3614
3627
|
boolean: (n) => $e.create(y(d({}, n), {
|
|
@@ -3619,17 +3632,17 @@ const Xs = (n, e = {
|
|
|
3619
3632
|
}, jr = v;
|
|
3620
3633
|
var N = /* @__PURE__ */ Object.freeze({
|
|
3621
3634
|
__proto__: null,
|
|
3622
|
-
defaultErrorMap:
|
|
3623
|
-
setErrorMap:
|
|
3635
|
+
defaultErrorMap: Ee,
|
|
3636
|
+
setErrorMap: Es,
|
|
3624
3637
|
getErrorMap: tt,
|
|
3625
3638
|
makeIssue: nt,
|
|
3626
|
-
EMPTY_PATH:
|
|
3639
|
+
EMPTY_PATH: As,
|
|
3627
3640
|
addIssueToContext: h,
|
|
3628
3641
|
ParseStatus: Z,
|
|
3629
3642
|
INVALID: v,
|
|
3630
3643
|
DIRTY: ke,
|
|
3631
3644
|
OK: $,
|
|
3632
|
-
isAborted:
|
|
3645
|
+
isAborted: At,
|
|
3633
3646
|
isDirty: Ot,
|
|
3634
3647
|
isValid: _e,
|
|
3635
3648
|
isAsync: Pe,
|
|
@@ -3637,21 +3650,21 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
3637
3650
|
return x;
|
|
3638
3651
|
},
|
|
3639
3652
|
get objectUtil() {
|
|
3640
|
-
return
|
|
3653
|
+
return Et;
|
|
3641
3654
|
},
|
|
3642
3655
|
ZodParsedType: p,
|
|
3643
3656
|
getParsedType: oe,
|
|
3644
3657
|
ZodType: w,
|
|
3645
|
-
datetimeRegex:
|
|
3658
|
+
datetimeRegex: ln,
|
|
3646
3659
|
ZodString: J,
|
|
3647
3660
|
ZodNumber: fe,
|
|
3648
3661
|
ZodBigInt: he,
|
|
3649
3662
|
ZodBoolean: $e,
|
|
3650
3663
|
ZodDate: be,
|
|
3651
3664
|
ZodSymbol: rt,
|
|
3652
|
-
ZodUndefined:
|
|
3653
|
-
ZodNull:
|
|
3654
|
-
ZodAny:
|
|
3665
|
+
ZodUndefined: Fe,
|
|
3666
|
+
ZodNull: Ve,
|
|
3667
|
+
ZodAny: Ae,
|
|
3655
3668
|
ZodUnknown: ve,
|
|
3656
3669
|
ZodNever: ce,
|
|
3657
3670
|
ZodVoid: at,
|
|
@@ -3681,7 +3694,7 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
3681
3694
|
ZodBranded: Zt,
|
|
3682
3695
|
ZodPipeline: Ke,
|
|
3683
3696
|
ZodReadonly: Je,
|
|
3684
|
-
custom:
|
|
3697
|
+
custom: hn,
|
|
3685
3698
|
Schema: w,
|
|
3686
3699
|
ZodSchema: w,
|
|
3687
3700
|
late: Ks,
|
|
@@ -3692,7 +3705,7 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
3692
3705
|
any: rr,
|
|
3693
3706
|
array: cr,
|
|
3694
3707
|
bigint: Qs,
|
|
3695
|
-
boolean:
|
|
3708
|
+
boolean: yn,
|
|
3696
3709
|
date: er,
|
|
3697
3710
|
discriminatedUnion: fr,
|
|
3698
3711
|
effect: Ht,
|
|
@@ -3708,19 +3721,19 @@ var N = /* @__PURE__ */ Object.freeze({
|
|
|
3708
3721
|
never: ir,
|
|
3709
3722
|
null: sr,
|
|
3710
3723
|
nullable: Sr,
|
|
3711
|
-
number:
|
|
3724
|
+
number: mn,
|
|
3712
3725
|
object: dr,
|
|
3713
3726
|
oboolean: Nr,
|
|
3714
3727
|
onumber: Cr,
|
|
3715
3728
|
optional: Tr,
|
|
3716
3729
|
ostring: Or,
|
|
3717
|
-
pipeline:
|
|
3718
|
-
preprocess:
|
|
3730
|
+
pipeline: Ar,
|
|
3731
|
+
preprocess: Er,
|
|
3719
3732
|
promise: kr,
|
|
3720
3733
|
record: mr,
|
|
3721
3734
|
set: gr,
|
|
3722
3735
|
strictObject: ur,
|
|
3723
|
-
string:
|
|
3736
|
+
string: pn,
|
|
3724
3737
|
symbol: tr,
|
|
3725
3738
|
transformer: Ht,
|
|
3726
3739
|
tuple: pr,
|
|
@@ -3776,7 +3789,7 @@ const Zr = N.object({
|
|
|
3776
3789
|
"COMPONENT_SET",
|
|
3777
3790
|
"GROUP"
|
|
3778
3791
|
]), Mr = (n, e) => {
|
|
3779
|
-
const t =
|
|
3792
|
+
const t = an(n.document, e);
|
|
3780
3793
|
if (!t)
|
|
3781
3794
|
return {
|
|
3782
3795
|
isValid: !1,
|
|
@@ -3800,7 +3813,7 @@ const Zr = N.object({
|
|
|
3800
3813
|
reason: "Selected node type is not supported"
|
|
3801
3814
|
};
|
|
3802
3815
|
};
|
|
3803
|
-
var L, Ge, ct,
|
|
3816
|
+
var L, Ge, ct, gn;
|
|
3804
3817
|
class Wr {
|
|
3805
3818
|
constructor({
|
|
3806
3819
|
auth: e,
|
|
@@ -3825,10 +3838,10 @@ class Wr {
|
|
|
3825
3838
|
}
|
|
3826
3839
|
generateCode(s) {
|
|
3827
3840
|
return M(this, arguments, function* (e, t = {}) {
|
|
3828
|
-
var _, I, O, C, R, B, re, de,
|
|
3841
|
+
var _, I, O, C, R, B, re, de, V;
|
|
3829
3842
|
if (this.hasAuth() === !1)
|
|
3830
3843
|
throw new Error('It needs to set "auth" before calling this method.');
|
|
3831
|
-
e.figmaToken && (yield $t(this, ct,
|
|
3844
|
+
e.figmaToken && (yield $t(this, ct, gn).call(this, e.fileKey, e.figmaToken, e.nodesId));
|
|
3832
3845
|
const r = {}, a = Rr(e.settings);
|
|
3833
3846
|
let i = e.tracking;
|
|
3834
3847
|
H(this, L) && "userId" in H(this, L) && H(this, L).userId && (i != null && i.externalId || (i = { externalId: H(this, L).userId }));
|
|
@@ -3895,11 +3908,11 @@ class Wr {
|
|
|
3895
3908
|
const Ce = f.split(`
|
|
3896
3909
|
`);
|
|
3897
3910
|
f = Ce.pop() || "";
|
|
3898
|
-
for (const
|
|
3899
|
-
if (!(!
|
|
3911
|
+
for (const E of Ce)
|
|
3912
|
+
if (!(!E.trim() || E.startsWith(":")) && E.startsWith("data: ")) {
|
|
3900
3913
|
let k;
|
|
3901
3914
|
try {
|
|
3902
|
-
k = JSON.parse(
|
|
3915
|
+
k = JSON.parse(E.slice(6));
|
|
3903
3916
|
} catch (ut) {
|
|
3904
3917
|
continue;
|
|
3905
3918
|
}
|
|
@@ -3940,7 +3953,7 @@ class Wr {
|
|
|
3940
3953
|
break;
|
|
3941
3954
|
}
|
|
3942
3955
|
case "codegen_completed": {
|
|
3943
|
-
typeof t == "function" ? t(k) : (
|
|
3956
|
+
typeof t == "function" ? t(k) : (V = t.onCodegenCompleted) == null || V.call(t);
|
|
3944
3957
|
break;
|
|
3945
3958
|
}
|
|
3946
3959
|
case "error":
|
|
@@ -3970,7 +3983,7 @@ class Wr {
|
|
|
3970
3983
|
});
|
|
3971
3984
|
}
|
|
3972
3985
|
}
|
|
3973
|
-
L = new WeakMap(), Ge = new WeakMap(), ct = new WeakSet(),
|
|
3986
|
+
L = new WeakMap(), Ge = new WeakMap(), ct = new WeakSet(), gn = function(e, t, s) {
|
|
3974
3987
|
return M(this, null, function* () {
|
|
3975
3988
|
let r;
|
|
3976
3989
|
try {
|
|
@@ -4035,7 +4048,7 @@ const Jr = ({
|
|
|
4035
4048
|
const c = $r(a, o);
|
|
4036
4049
|
if (c.startsWith("src/")) {
|
|
4037
4050
|
const u = c.split("/").slice(0, -1).join("/");
|
|
4038
|
-
|
|
4051
|
+
Fr(n, u).forEach((_) => {
|
|
4039
4052
|
s.has(_) || r(_);
|
|
4040
4053
|
});
|
|
4041
4054
|
}
|
|
@@ -4068,10 +4081,10 @@ function $r(n, e) {
|
|
|
4068
4081
|
a === ".." ? r.pop() : a !== "." && r.push(a);
|
|
4069
4082
|
return r.join("/");
|
|
4070
4083
|
}
|
|
4071
|
-
function
|
|
4084
|
+
function Fr(n, e) {
|
|
4072
4085
|
return Object.keys(n).filter((t) => t.startsWith(e));
|
|
4073
4086
|
}
|
|
4074
|
-
const
|
|
4087
|
+
const Vr = (n, e) => new ReadableStream({
|
|
4075
4088
|
start(t) {
|
|
4076
4089
|
n.generateCode(e, (s) => {
|
|
4077
4090
|
s.type === "error" || t.enqueue(s), (s.type === "aborted" || s.type === "error") && t.close();
|
|
@@ -4097,7 +4110,7 @@ const Fr = (n, e) => new ReadableStream({
|
|
|
4097
4110
|
}
|
|
4098
4111
|
}), Gr = (n, e) => M(void 0, null, function* () {
|
|
4099
4112
|
var c, u, f, _, I, O, C;
|
|
4100
|
-
const t =
|
|
4113
|
+
const t = Vr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
|
|
4101
4114
|
if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((f = (u = a.value) == null ? void 0 : u.payload) != null && f.status))
|
|
4102
4115
|
return new Response(JSON.stringify(a.value), {
|
|
4103
4116
|
status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (C = (O = (I = a.value) == null ? void 0 : I.payload) == null ? void 0 : O.status) != null ? C : 500,
|
|
@@ -4130,26 +4143,26 @@ data: ${JSON.stringify(
|
|
|
4130
4143
|
export {
|
|
4131
4144
|
Wr as Anima,
|
|
4132
4145
|
ue as CodegenError,
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4146
|
+
kn as FigmaTokenIssue,
|
|
4147
|
+
Sn as NotFound,
|
|
4148
|
+
Tn as RateLimitExceeded,
|
|
4136
4149
|
Hr as ResponseError,
|
|
4137
4150
|
An as UnknownFigmaApiException,
|
|
4138
4151
|
Gr as createCodegenResponseEventStream,
|
|
4139
|
-
|
|
4140
|
-
|
|
4152
|
+
Vr as createCodegenStream,
|
|
4153
|
+
an as findChildrenNode,
|
|
4141
4154
|
qr as formatToFigmaLink,
|
|
4142
4155
|
Ur as getFigmaApiErrorType,
|
|
4143
4156
|
Ts as getFigmaFile,
|
|
4144
4157
|
zr as getFileNodes,
|
|
4145
4158
|
Jr as getRelatedScreenFiles,
|
|
4146
|
-
Cn as
|
|
4147
|
-
On as isFigmaTokenIssue,
|
|
4159
|
+
Cn as isFigmaTokenIssue,
|
|
4148
4160
|
Mr as isNodeCodegenCompatible,
|
|
4149
|
-
|
|
4150
|
-
|
|
4161
|
+
En as isNotFound,
|
|
4162
|
+
On as isRateLimitExceeded,
|
|
4151
4163
|
Lr as isUnknownFigmaApiException,
|
|
4152
4164
|
Br as isValidFigmaUrl,
|
|
4153
|
-
Rr as validateSettings
|
|
4165
|
+
Rr as validateSettings,
|
|
4166
|
+
Qt as wrapFigmaApiError
|
|
4154
4167
|
};
|
|
4155
4168
|
//# sourceMappingURL=index.js.map
|