@animaapp/anima-sdk 0.6.10 → 0.6.12-beta.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.js CHANGED
@@ -13,8 +13,8 @@ var Lt = (r, e, t) => e in r ? xr(r, e, { enumerable: !0, configurable: !0, writ
13
13
  Er.call(e, t) && Lt(r, t, e[t]);
14
14
  return r;
15
15
  }, g = (r, e) => kr(r, Tr(e));
16
- var ht = (r, e, t) => e.has(r) || Vt("Cannot " + t);
17
- var N = (r, e, t) => (ht(r, e, "read from private field"), t ? t.call(r) : e.get(r)), Qe = (r, e, t) => e.has(r) ? Vt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), pt = (r, e, t, s) => (ht(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t), Ne = (r, e, t) => (ht(r, e, "access private method"), t);
16
+ var mt = (r, e, t) => e.has(r) || Vt("Cannot " + t);
17
+ var A = (r, e, t) => (mt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), et = (r, e, t) => e.has(r) ? Vt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), gt = (r, e, t, s) => (mt(r, e, "write to private field"), s ? s.call(r, t) : e.set(r, t), t), ke = (r, e, t) => (mt(r, e, "access private method"), t);
18
18
  var C = (r, e, t) => new Promise((s, n) => {
19
19
  var a = (c) => {
20
20
  try {
@@ -31,7 +31,7 @@ var C = (r, e, t) => new Promise((s, n) => {
31
31
  }, o = (c) => c.done ? s(c.value) : Promise.resolve(c.value).then(a, i);
32
32
  o((t = t.apply(r, e)).next());
33
33
  });
34
- class de extends Error {
34
+ class ue extends Error {
35
35
  constructor({
36
36
  name: e,
37
37
  reason: t,
@@ -58,13 +58,13 @@ class Cr extends Error {
58
58
  }
59
59
  }
60
60
  const tr = "Request Too Large";
61
- class Or extends Error {
61
+ class Ir extends Error {
62
62
  constructor({ fileKey: e, cause: t }) {
63
63
  super(tr), this.fileKey = e, this.cause = t;
64
64
  }
65
65
  }
66
66
  const rr = "Not Found";
67
- class Ir extends Error {
67
+ class Or extends Error {
68
68
  constructor({ fileKey: e, cause: t }) {
69
69
  super(rr), this.fileKey = e, this.cause = t;
70
70
  }
@@ -75,7 +75,7 @@ class jr extends Error {
75
75
  super(sr), this.name = "UnknownFigmaApiException", this.fileKey = e, this.cause = t;
76
76
  }
77
77
  }
78
- const Kn = (r) => r.message === sr, Rr = (r) => r.message === er, Zr = (r) => [Qt, ...[
78
+ const Xn = (r) => r.message === sr, Rr = (r) => r.message === er, Zr = (r) => [Qt, ...[
79
79
  "Invalid Figma token",
80
80
  "Figma token expired"
81
81
  ]].includes(
@@ -93,12 +93,12 @@ const Kn = (r) => r.message === sr, Rr = (r) => r.message === er, Zr = (r) => [Q
93
93
  if (a === 429)
94
94
  return new Cr({ fileKey: e, cause: r });
95
95
  if (a === 404)
96
- return new Ir({ fileKey: e, cause: r });
97
- if (a === 400 && n.includes("Request too large"))
98
96
  return new Or({ fileKey: e, cause: r });
97
+ if (a === 400 && n.includes("Request too large"))
98
+ return new Ir({ fileKey: e, cause: r });
99
99
  }
100
100
  return new jr({ fileKey: e, cause: r });
101
- }, Xn = (r) => Nr(r) ? "NotFound" : Rr(r) ? "RateLimitExceeded" : Zr(r) ? "FigmaTokenIssue" : Mr(r) ? "RequestTooLarge" : "UnknownFigmaApiException";
101
+ }, Yn = (r) => Nr(r) ? "NotFound" : Rr(r) ? "RateLimitExceeded" : Zr(r) ? "FigmaTokenIssue" : Mr(r) ? "RequestTooLarge" : "UnknownFigmaApiException";
102
102
  var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwnPropertyDescriptors, Dt = Object.getOwnPropertySymbols, Lr = Object.prototype.hasOwnProperty, Vr = Object.prototype.propertyIsEnumerable, Ut = (r, e) => (e = Symbol[r]) ? e : Symbol.for("Symbol." + r), ar = (r) => {
103
103
  throw TypeError(r);
104
104
  }, Wt = (r, e, t) => e in r ? Pr(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, U = (r, e) => {
@@ -108,7 +108,7 @@ var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwn
108
108
  for (var t of Dt(e))
109
109
  Vr.call(e, t) && Wt(r, t, e[t]);
110
110
  return r;
111
- }, jt = (r, e) => $r(r, Fr(e)), Rt = (r, e, t) => e.has(r) || ar("Cannot " + t), T = (r, e, t) => (Rt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), B = (r, e, t) => e.has(r) ? ar("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), R = (r, e, t, s) => (Rt(r, e, "write to private field"), e.set(r, t), t), Q = (r, e, t) => (Rt(r, e, "access private method"), t), I = (r, e, t) => new Promise((s, n) => {
111
+ }, Zt = (r, e) => $r(r, Fr(e)), Mt = (r, e, t) => e.has(r) || ar("Cannot " + t), S = (r, e, t) => (Mt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), B = (r, e, t) => e.has(r) ? ar("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), R = (r, e, t, s) => (Mt(r, e, "write to private field"), e.set(r, t), t), Q = (r, e, t) => (Mt(r, e, "access private method"), t), N = (r, e, t) => new Promise((s, n) => {
112
112
  var a = (c) => {
113
113
  try {
114
114
  o(t.next(c));
@@ -127,55 +127,55 @@ var Pr = Object.defineProperty, $r = Object.defineProperties, Fr = Object.getOwn
127
127
  function Wr(r) {
128
128
  return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
129
129
  }
130
- var _t = { exports: {} }, zr = _t.exports, zt;
130
+ var wt = { exports: {} }, zr = wt.exports, zt;
131
131
  function Br() {
132
132
  return zt || (zt = 1, function(r, e) {
133
133
  (function(t, s) {
134
134
  r.exports = s();
135
135
  })(zr, function() {
136
- var t = typeof Promise == "function", s = typeof self == "object" ? self : Ur, n = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = n && typeof Symbol.iterator != "undefined", v = n && typeof Symbol.toStringTag != "undefined", j = i && typeof Set.prototype.entries == "function", M = a && typeof Map.prototype.entries == "function", F = j && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), z = M && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), se = f && typeof Array.prototype[Symbol.iterator] == "function", ge = se && Object.getPrototypeOf([][Symbol.iterator]()), ce = f && typeof String.prototype[Symbol.iterator] == "function", V = ce && Object.getPrototypeOf(""[Symbol.iterator]()), K = 8, q = -1;
137
- function Ie(A) {
138
- var k = typeof A;
136
+ var t = typeof Promise == "function", s = typeof self == "object" ? self : Ur, n = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = n && typeof Symbol.iterator != "undefined", v = n && typeof Symbol.toStringTag != "undefined", j = i && typeof Set.prototype.entries == "function", M = a && typeof Map.prototype.entries == "function", F = j && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), z = M && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), se = f && typeof Array.prototype[Symbol.iterator] == "function", ge = se && Object.getPrototypeOf([][Symbol.iterator]()), de = f && typeof String.prototype[Symbol.iterator] == "function", V = de && Object.getPrototypeOf(""[Symbol.iterator]()), K = 8, q = -1;
137
+ function Ne(O) {
138
+ var k = typeof O;
139
139
  if (k !== "object")
140
140
  return k;
141
- if (A === null)
141
+ if (O === null)
142
142
  return "null";
143
- if (A === s)
143
+ if (O === s)
144
144
  return "global";
145
- if (Array.isArray(A) && (v === !1 || !(Symbol.toStringTag in A)))
145
+ if (Array.isArray(O) && (v === !1 || !(Symbol.toStringTag in O)))
146
146
  return "Array";
147
147
  if (typeof window == "object" && window !== null) {
148
- if (typeof window.location == "object" && A === window.location)
148
+ if (typeof window.location == "object" && O === window.location)
149
149
  return "Location";
150
- if (typeof window.document == "object" && A === window.document)
150
+ if (typeof window.document == "object" && O === window.document)
151
151
  return "Document";
152
152
  if (typeof window.navigator == "object") {
153
- if (typeof window.navigator.mimeTypes == "object" && A === window.navigator.mimeTypes)
153
+ if (typeof window.navigator.mimeTypes == "object" && O === window.navigator.mimeTypes)
154
154
  return "MimeTypeArray";
155
- if (typeof window.navigator.plugins == "object" && A === window.navigator.plugins)
155
+ if (typeof window.navigator.plugins == "object" && O === window.navigator.plugins)
156
156
  return "PluginArray";
157
157
  }
158
- if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && A instanceof window.HTMLElement) {
159
- if (A.tagName === "BLOCKQUOTE")
158
+ if ((typeof window.HTMLElement == "function" || typeof window.HTMLElement == "object") && O instanceof window.HTMLElement) {
159
+ if (O.tagName === "BLOCKQUOTE")
160
160
  return "HTMLQuoteElement";
161
- if (A.tagName === "TD")
161
+ if (O.tagName === "TD")
162
162
  return "HTMLTableDataCellElement";
163
- if (A.tagName === "TH")
163
+ if (O.tagName === "TH")
164
164
  return "HTMLTableHeaderCellElement";
165
165
  }
166
166
  }
167
- var ft = v && A[Symbol.toStringTag];
168
- if (typeof ft == "string")
169
- return ft;
170
- var D = Object.getPrototypeOf(A);
171
- 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" : d && D === DataView.prototype ? "DataView" : a && D === z ? "Map Iterator" : i && D === F ? "Set Iterator" : se && D === ge ? "Array Iterator" : ce && D === V ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(A).slice(K, q);
167
+ var pt = v && O[Symbol.toStringTag];
168
+ if (typeof pt == "string")
169
+ return pt;
170
+ var D = Object.getPrototypeOf(O);
171
+ 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" : d && D === DataView.prototype ? "DataView" : a && D === z ? "Map Iterator" : i && D === F ? "Set Iterator" : se && D === ge ? "Array Iterator" : de && D === V ? "String Iterator" : D === null ? "Object" : Object.prototype.toString.call(O).slice(K, q);
172
172
  }
173
- return Ie;
173
+ return Ne;
174
174
  });
175
- }(_t)), _t.exports;
175
+ }(wt)), wt.exports;
176
176
  }
177
177
  var qr = Br();
178
- const Hr = /* @__PURE__ */ Wr(qr), Zt = typeof Buffer != "undefined", Jr = Zt && typeof Buffer.from != "undefined", Gr = Zt ? (
178
+ const Hr = /* @__PURE__ */ Wr(qr), Pt = typeof Buffer != "undefined", Jr = Pt && typeof Buffer.from != "undefined", Gr = Pt ? (
179
179
  /**
180
180
  * is value is Buffer?
181
181
  *
@@ -206,7 +206,7 @@ const Hr = /* @__PURE__ */ Wr(qr), Zt = typeof Buffer != "undefined", Jr = Zt &&
206
206
  function(r) {
207
207
  return Buffer.from(r);
208
208
  }
209
- ) : Zt ? (
209
+ ) : Pt ? (
210
210
  /**
211
211
  * copy Buffer
212
212
  *
@@ -231,7 +231,7 @@ const Hr = /* @__PURE__ */ Wr(qr), Zt = typeof Buffer != "undefined", Jr = Zt &&
231
231
  return r;
232
232
  }
233
233
  );
234
- function Ee(r) {
234
+ function Ae(r) {
235
235
  return Gr(r) ? "Buffer" : Hr(r);
236
236
  }
237
237
  const Xr = /* @__PURE__ */ new Set([
@@ -242,7 +242,7 @@ const Xr = /* @__PURE__ */ new Set([
242
242
  "Set"
243
243
  ]);
244
244
  function Yr(r, e, t = null) {
245
- switch (t || Ee(r)) {
245
+ switch (t || Ae(r)) {
246
246
  case "Arguments":
247
247
  case "Array":
248
248
  case "Object":
@@ -253,11 +253,11 @@ function Yr(r, e, t = null) {
253
253
  return e;
254
254
  }
255
255
  }
256
- function bt(r) {
256
+ function xt(r) {
257
257
  return Xr.has(r);
258
258
  }
259
259
  function Bt(r, e, t, s = null) {
260
- switch (s || Ee(r)) {
260
+ switch (s || Ae(r)) {
261
261
  case "Arguments":
262
262
  case "Array":
263
263
  case "Object":
@@ -272,7 +272,7 @@ function Bt(r, e, t, s = null) {
272
272
  }
273
273
  return r;
274
274
  }
275
- const Qr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, es = typeof global != "undefined" && global !== null && global.Object === Object && global, ts = typeof self != "undefined" && self !== null && self.Object === Object && self, mt = Qr || es || ts || Function("return this")();
275
+ const Qr = typeof globalThis != "undefined" && globalThis !== null && globalThis.Object === Object && globalThis, es = typeof global != "undefined" && global !== null && global.Object === Object && global, ts = typeof self != "undefined" && self !== null && self.Object === Object && self, yt = Qr || es || ts || Function("return this")();
276
276
  function rs(r) {
277
277
  return r.slice(0);
278
278
  }
@@ -298,7 +298,7 @@ function ds(r) {
298
298
  return new String(r);
299
299
  }
300
300
  function ne(r, e) {
301
- return mt[e].from ? mt[e].from(r) : new mt[e](r);
301
+ return yt[e].from ? yt[e].from(r) : new yt[e](r);
302
302
  }
303
303
  function P(r) {
304
304
  return r;
@@ -374,9 +374,9 @@ const hs = /* @__PURE__ */ new Map([
374
374
  ]);
375
375
  function ps() {
376
376
  }
377
- function wt(r, e = null, t = ps) {
377
+ function kt(r, e = null, t = ps) {
378
378
  arguments.length === 2 && typeof e == "function" && (t = e, e = null);
379
- const s = e || Ee(r), n = hs.get(s);
379
+ const s = e || Ae(r), n = hs.get(s);
380
380
  if (s === "Object") {
381
381
  const a = t(r, s);
382
382
  if (a !== void 0)
@@ -393,15 +393,15 @@ function je(r, e = {}) {
393
393
  customizer: t
394
394
  // TODO: max depth
395
395
  // depth = Infinity,
396
- } = e, s = Ee(r);
397
- if (!bt(s))
398
- return xt(r, null, null, null);
399
- const n = wt(r, s, t), a = new WeakMap([[r, n]]), i = new WeakSet([r]);
400
- return xt(r, n, a, i);
396
+ } = e, s = Ae(r);
397
+ if (!xt(s))
398
+ return Tt(r, null, null, null);
399
+ const n = kt(r, s, t), a = new WeakMap([[r, n]]), i = new WeakSet([r]);
400
+ return Tt(r, n, a, i);
401
401
  }
402
- function xt(r, e, t, s, n) {
403
- const a = Ee(r), i = wt(r, a);
404
- if (!bt(a))
402
+ function Tt(r, e, t, s, n) {
403
+ const a = Ae(r), i = kt(r, a);
404
+ if (!xt(a))
405
405
  return i;
406
406
  let o;
407
407
  switch (a) {
@@ -422,11 +422,11 @@ function xt(r, e, t, s, n) {
422
422
  if (s.has(d))
423
423
  Bt(e, c, t.get(d), a);
424
424
  else {
425
- const f = Ee(d), v = wt(d, f);
426
- bt(f) && (t.set(d, v), s.add(d)), Bt(
425
+ const f = Ae(d), v = kt(d, f);
426
+ xt(f) && (t.set(d, v), s.add(d)), Bt(
427
427
  e,
428
428
  c,
429
- xt(
429
+ Tt(
430
430
  d,
431
431
  v,
432
432
  t,
@@ -439,32 +439,32 @@ function xt(r, e, t, s, n) {
439
439
  return e;
440
440
  }
441
441
  const ms = (r) => new Promise((e) => setTimeout(e, r));
442
- var et, ye, tt, kt, ir;
442
+ var tt, ye, rt, St, ir;
443
443
  class gs {
444
444
  constructor({ maxAttempts: e = 3, func: t }) {
445
- B(this, kt), B(this, et), B(this, ye), B(this, tt), R(this, et, e), R(this, tt, t), R(this, ye, 0);
445
+ B(this, St), B(this, tt), B(this, ye), B(this, rt), R(this, tt, e), R(this, rt, t), R(this, ye, 0);
446
446
  }
447
447
  run() {
448
- return I(this, null, function* () {
448
+ return N(this, null, function* () {
449
449
  try {
450
- return yield T(this, tt).call(this);
450
+ return yield S(this, rt).call(this);
451
451
  } catch (e) {
452
- if (R(this, ye, T(this, ye) + 1), T(this, ye) > T(this, et))
452
+ if (R(this, ye, S(this, ye) + 1), S(this, ye) > S(this, tt))
453
453
  throw console.error("Max attempts reached"), e;
454
- const t = Q(this, kt, ir).call(this);
454
+ const t = Q(this, St, ir).call(this);
455
455
  return yield ms(t), yield this.run();
456
456
  }
457
457
  });
458
458
  }
459
459
  }
460
- et = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), kt = /* @__PURE__ */ new WeakSet(), ir = function() {
461
- return T(this, ye) * 1e3 * 1.5;
460
+ tt = /* @__PURE__ */ new WeakMap(), ye = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), ir = function() {
461
+ return S(this, ye) * 1e3 * 1.5;
462
462
  };
463
463
  function ys() {
464
464
  return typeof CompressionStream != "undefined";
465
465
  }
466
466
  function vs(r) {
467
- return I(this, null, function* () {
467
+ return N(this, null, function* () {
468
468
  const e = new Blob([r]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
469
469
  try {
470
470
  for (var s = Dr(e), n, a, i; n = !(a = yield s.next()).done; n = !1) {
@@ -485,7 +485,7 @@ function vs(r) {
485
485
  });
486
486
  }
487
487
  function _s(r) {
488
- return I(this, null, function* () {
488
+ return N(this, null, function* () {
489
489
  const e = yield new Blob(r).arrayBuffer();
490
490
  return new Uint8Array(e);
491
491
  });
@@ -534,7 +534,7 @@ class ws extends Error {
534
534
  super(`Async API Error: ${JSON.stringify(e)}`), this.name = "Async API Error", this.body = e;
535
535
  }
536
536
  }
537
- class gt extends Error {
537
+ class vt extends Error {
538
538
  constructor(e) {
539
539
  super(e), this.name = "Request Validation Error";
540
540
  }
@@ -545,11 +545,11 @@ function or() {
545
545
  () => Math.floor(Math.random() * 256).toString(16).padStart(2, "0")
546
546
  ).join("");
547
547
  }
548
- function Tt() {
548
+ function Et() {
549
549
  return Math.floor(Date.now() / 1e3).toString();
550
550
  }
551
551
  const xs = 5 * 60 * 1e3, ks = 1 * 1e3;
552
- var ve, L, X, St, Et, Ze;
552
+ var ve, L, X, At, Ct, Ze;
553
553
  class Ts {
554
554
  constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
555
555
  B(this, X), B(this, ve), B(this, L), this.baseAddress = t, R(this, ve, e), R(this, L, {}), this.plugins = [];
@@ -567,51 +567,51 @@ class Ts {
567
567
  return R(this, L, e), this;
568
568
  }
569
569
  get(e) {
570
- return I(this, arguments, function* (t, s = {}) {
570
+ return N(this, arguments, function* (t, s = {}) {
571
571
  const { overrideBaseAddress: n, overrideDefaultHeaders: a } = s, i = n != null ? n : this.baseAddress;
572
572
  let o = a != null ? a : this.headers;
573
- const c = je(T(this, L));
574
- return R(this, L, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = jt(U({}, o), { "X-Request-Nonce": or(), "X-Request-Timestamp": Tt() })), c.async ? yield Q(this, X, Et).call(this, `${i}${t}`, c.async, { headers: o }) : yield Q(this, X, St).call(this, `${i}${t}`, c, { headers: o });
573
+ const c = je(S(this, L));
574
+ return R(this, L, {}), c.extraHeaders && (o = U(U({}, o), c.extraHeaders)), c.requestValidation && (o = Zt(U({}, o), { "X-Request-Nonce": or(), "X-Request-Timestamp": Et() })), c.async ? yield Q(this, X, Ct).call(this, `${i}${t}`, c.async, { headers: o }) : yield Q(this, X, At).call(this, `${i}${t}`, c, { headers: o });
575
575
  });
576
576
  }
577
577
  post(e, t) {
578
- return I(this, arguments, function* (s, n, a = {}) {
579
- const i = je(T(this, L));
578
+ return N(this, arguments, function* (s, n, a = {}) {
579
+ const i = je(S(this, L));
580
580
  return R(this, L, {}), Q(this, X, Ze).call(this, s, "POST", n, a, i);
581
581
  });
582
582
  }
583
583
  put(e, t) {
584
- return I(this, arguments, function* (s, n, a = {}) {
585
- const i = je(T(this, L));
584
+ return N(this, arguments, function* (s, n, a = {}) {
585
+ const i = je(S(this, L));
586
586
  return R(this, L, {}), Q(this, X, Ze).call(this, s, "PUT", n, a, i);
587
587
  });
588
588
  }
589
589
  delete(e, t) {
590
- return I(this, arguments, function* (s, n, a = {}) {
591
- const i = je(T(this, L));
590
+ return N(this, arguments, function* (s, n, a = {}) {
591
+ const i = je(S(this, L));
592
592
  return R(this, L, {}), Q(this, X, Ze).call(this, s, "DELETE", n, a, i);
593
593
  });
594
594
  }
595
595
  patch(e, t) {
596
- return I(this, arguments, function* (s, n, a = {}) {
597
- const i = je(T(this, L));
596
+ return N(this, arguments, function* (s, n, a = {}) {
597
+ const i = je(S(this, L));
598
598
  return R(this, L, {}), Q(this, X, Ze).call(this, s, "PATCH", n, a, i);
599
599
  });
600
600
  }
601
601
  }
602
- ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), St = function(r, e, t) {
603
- return I(this, null, function* () {
604
- const s = () => I(this, null, function* () {
602
+ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), At = function(r, e, t) {
603
+ return N(this, null, function* () {
604
+ const s = () => N(this, null, function* () {
605
605
  var c, d;
606
606
  try {
607
- return yield T(this, ve).call(this, r, U(U({}, t), e.abortSignal && { signal: e.abortSignal }));
607
+ return yield S(this, ve).call(this, r, U(U({}, t), e.abortSignal && { signal: e.abortSignal }));
608
608
  } catch (f) {
609
609
  throw f instanceof Error && f.name === "AbortError" ? new Re({ canceled: (d = (c = e.abortSignal) == null ? void 0 : c.aborted) != null ? d : !1 }) : f;
610
610
  }
611
611
  }), { headers: n } = t != null ? t : {}, a = (c, d) => {
612
612
  var f, v;
613
613
  return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(d)) || ((v = c == null ? void 0 : c.headersObject) == null ? void 0 : v[d]) || "";
614
- }, i = (c) => I(this, null, function* () {
614
+ }, i = (c) => N(this, null, function* () {
615
615
  var d;
616
616
  if (!c.ok) {
617
617
  const v = yield c.text().catch();
@@ -628,13 +628,13 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
628
628
  try {
629
629
  const v = a(c, "x-response-nonce"), j = n == null ? void 0 : n["X-Request-Nonce"];
630
630
  if (!v || v !== j)
631
- throw new gt("Response nonce mismatch");
632
- const M = Number(a(c, "x-response-timestamp")), F = Number(Tt()), z = 60 * 60 * 24;
631
+ throw new vt("Response nonce mismatch");
632
+ const M = Number(a(c, "x-response-timestamp")), F = Number(Et()), z = 60 * 60 * 24;
633
633
  if (isNaN(M) || Math.abs(F - M) > z)
634
- throw new gt("Invalid response timestamp");
634
+ throw new vt("Invalid response timestamp");
635
635
  } catch (v) {
636
636
  const j = v instanceof Error ? v.message : "Request validation failed";
637
- throw new gt(j);
637
+ throw new vt(j);
638
638
  }
639
639
  let f = yield c.text();
640
640
  try {
@@ -653,8 +653,8 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
653
653
  const o = yield s();
654
654
  return yield i(o);
655
655
  });
656
- }, Et = function(r, e, t) {
657
- return I(this, null, function* () {
656
+ }, Ct = function(r, e, t) {
657
+ return N(this, null, function* () {
658
658
  var s, n;
659
659
  const {
660
660
  onProgress: a,
@@ -664,7 +664,7 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
664
664
  } = e, d = `${r}/async`, f = `${r}/async/job`;
665
665
  let v;
666
666
  try {
667
- v = yield T(this, ve).call(this, d, U(U({}, t), i && { signal: i }));
667
+ v = yield S(this, ve).call(this, d, U(U({}, t), i && { signal: i }));
668
668
  } catch (F) {
669
669
  throw F instanceof Error && F.name === "AbortError" ? new Re({ canceled: (s = i == null ? void 0 : i.aborted) != null ? s : !1 }) : F;
670
670
  }
@@ -682,12 +682,12 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
682
682
  const j = yield v.json(), { job_id: M } = j;
683
683
  if (!M)
684
684
  throw new Error("Job ID not found in response");
685
- return new Promise((F, z) => I(this, null, function* () {
685
+ return new Promise((F, z) => N(this, null, function* () {
686
686
  const se = setTimeout(() => {
687
687
  z(new Error("Job timed out"));
688
- }, c), ge = (ce = 0) => I(this, null, function* () {
688
+ }, c), ge = (de = 0) => N(this, null, function* () {
689
689
  if (i != null && i.aborted) {
690
- clearTimeout(se), T(this, ve).call(this, `${f}/${M}/cancel`, { method: "POST", headers: this.headers }).then(() => {
690
+ clearTimeout(se), S(this, ve).call(this, `${f}/${M}/cancel`, { method: "POST", headers: this.headers }).then(() => {
691
691
  z(new Re({ canceled: !0 }));
692
692
  }).catch((V) => {
693
693
  z(new Re({ canceled: !1 }));
@@ -695,7 +695,7 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
695
695
  return;
696
696
  }
697
697
  try {
698
- const V = yield (yield T(this, ve).call(this, `${f}/${M}`, { headers: this.headers })).json();
698
+ const V = yield (yield S(this, ve).call(this, `${f}/${M}`, { headers: this.headers })).json();
699
699
  if (V.status === "success") {
700
700
  clearTimeout(se);
701
701
  const K = V.response_json;
@@ -704,8 +704,8 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
704
704
  clearTimeout(se), z(new ws(V.response_json));
705
705
  else {
706
706
  a && a(V.response_json);
707
- const K = o(ce);
708
- setTimeout(() => ge(ce + 1), K);
707
+ const K = o(de);
708
+ setTimeout(() => ge(de + 1), K);
709
709
  }
710
710
  } catch (V) {
711
711
  z(V);
@@ -715,19 +715,19 @@ ve = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
715
715
  }));
716
716
  });
717
717
  }, Ze = function(r, e, t, s, n) {
718
- return I(this, null, function* () {
718
+ return N(this, null, function* () {
719
719
  const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
720
720
  let c = i != null ? i : this.headers;
721
- n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c = jt(U({}, c), { "X-Request-Nonce": or(), "X-Request-Timestamp": Tt() }));
721
+ n.extraHeaders && (c = U(U({}, c), n.extraHeaders)), n.requestValidation && (c = Zt(U({}, c), { "X-Request-Nonce": or(), "X-Request-Timestamp": Et() }));
722
722
  let d = t;
723
- return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (d = s.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && ys() && (c["Content-Encoding"] = "gzip", d = yield vs(d))), n.async ? yield Q(this, X, Et).call(this, `${o}${r}`, n.async, {
723
+ return typeof FormData != "undefined" && t instanceof FormData ? delete c["Content-Type"] : (d = s.skipBodyJsonStringify ? t : JSON.stringify(t), n.compress && ys() && (c["Content-Encoding"] = "gzip", d = yield vs(d))), n.async ? yield Q(this, X, Ct).call(this, `${o}${r}`, n.async, {
724
724
  method: e,
725
725
  headers: c,
726
726
  body: d
727
- }) : yield Q(this, X, St).call(this, `${o}${r}`, n, { method: e, headers: c, body: d });
727
+ }) : yield Q(this, X, At).call(this, `${o}${r}`, n, { method: e, headers: c, body: d });
728
728
  });
729
729
  };
730
- const Jt = (r, e, t, s) => r instanceof Re ? r : new bs({ resource: e, api: String(t), args: s, cause: r }), yt = (r, e) => new Proxy(e, {
730
+ const Jt = (r, e, t, s) => r instanceof Re ? r : new bs({ resource: e, api: String(t), args: s, cause: r }), _t = (r, e) => new Proxy(e, {
731
731
  get(t, s) {
732
732
  return (...n) => {
733
733
  var a;
@@ -754,18 +754,18 @@ class Ss {
754
754
  B(this, Me), this.resourceName = "Files", R(this, Me, e);
755
755
  }
756
756
  get(e) {
757
- return I(this, arguments, function* ({ fileKey: t, params: s = {} }) {
757
+ return N(this, arguments, function* ({ fileKey: t, params: s = {} }) {
758
758
  const n = new URLSearchParams(U({
759
759
  plugin_data: "857346721138427857"
760
760
  }, s)).toString(), a = `v1/files/${t}?${n}`;
761
- return yield T(this, Me).get(a);
761
+ return yield S(this, Me).get(a);
762
762
  });
763
763
  }
764
764
  getImageFills(e) {
765
- return I(this, arguments, function* ({ fileKey: t }) {
765
+ return N(this, arguments, function* ({ fileKey: t }) {
766
766
  var s, n;
767
767
  const a = `v1/files/${t}/images`;
768
- return (n = (s = (yield T(this, Me).get(a)).meta) == null ? void 0 : s.images) != null ? n : {};
768
+ return (n = (s = (yield S(this, Me).get(a)).meta) == null ? void 0 : s.images) != null ? n : {};
769
769
  });
770
770
  }
771
771
  }
@@ -774,92 +774,92 @@ const Es = (r, e, t) => {
774
774
  const s = e.sort();
775
775
  return `${r}-${s.join("-")}-${t}`;
776
776
  }, As = (r) => r ? r.ts > Date.now() - 1e3 * 30 : !1;
777
- var Y, At, cr;
777
+ var Y, It, cr;
778
778
  class Cs {
779
779
  constructor(e) {
780
- B(this, At), B(this, Y), this.resourceName = "Images", R(this, Y, e);
780
+ B(this, It), B(this, Y), this.resourceName = "Images", R(this, Y, e);
781
781
  }
782
782
  /**
783
783
  * Return the URL for the _layer_ images for the given nodes.
784
784
  * Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
785
785
  */
786
786
  get(e) {
787
- return I(this, arguments, function* ({ fileKey: t, nodeIds: s, format: n = "jpg", scale: a }) {
788
- const i = Es(t, s, n), o = T(this, Y).cache.images.entries.get(i);
787
+ return N(this, arguments, function* ({ fileKey: t, nodeIds: s, format: n = "jpg", scale: a }) {
788
+ const i = Es(t, s, n), o = S(this, Y).cache.images.entries.get(i);
789
789
  if (As(o))
790
790
  return o.result;
791
- o && T(this, Y).cache.images.entries.delete(i);
792
- const c = T(this, Y).cache.images.pendingRequests.get(i);
791
+ o && S(this, Y).cache.images.entries.delete(i);
792
+ const c = S(this, Y).cache.images.pendingRequests.get(i);
793
793
  if (c)
794
794
  return c;
795
- const d = Q(this, At, cr).call(this, i, t, s, n, a);
796
- T(this, Y).cache.images.pendingRequests.set(i, d);
795
+ const d = Q(this, It, cr).call(this, i, t, s, n, a);
796
+ S(this, Y).cache.images.pendingRequests.set(i, d);
797
797
  try {
798
798
  return yield d;
799
799
  } finally {
800
- T(this, Y).cache.images.pendingRequests.delete(i);
800
+ S(this, Y).cache.images.pendingRequests.delete(i);
801
801
  }
802
802
  });
803
803
  }
804
804
  }
805
- Y = /* @__PURE__ */ new WeakMap(), At = /* @__PURE__ */ new WeakSet(), cr = function(r, e, t, s, n) {
806
- return I(this, null, function* () {
807
- const a = yield T(this, Y).get(
805
+ Y = /* @__PURE__ */ new WeakMap(), It = /* @__PURE__ */ new WeakSet(), cr = function(r, e, t, s, n) {
806
+ return N(this, null, function* () {
807
+ const a = yield S(this, Y).get(
808
808
  `v1/images/${e}?ids=${t}&format=${s}${n ? `&scale=${n}` : ""}`
809
809
  );
810
- return T(this, Y).cache.images.entries.set(r, {
810
+ return S(this, Y).cache.images.entries.set(r, {
811
811
  result: a,
812
812
  ts: Date.now()
813
813
  }), a;
814
814
  });
815
815
  };
816
- var rt;
817
- class Os {
816
+ var st;
817
+ class Is {
818
818
  constructor(e) {
819
- B(this, rt), this.resourceName = "Nodes", R(this, rt, e);
819
+ B(this, st), this.resourceName = "Nodes", R(this, st, e);
820
820
  }
821
821
  get(e) {
822
- return I(this, arguments, function* ({ fileKey: t, nodeIds: s, params: n = {} }) {
823
- const a = jt(U({}, n), {
822
+ return N(this, arguments, function* ({ fileKey: t, nodeIds: s, params: n = {} }) {
823
+ const a = Zt(U({}, n), {
824
824
  ids: s.join(",")
825
825
  }), i = new URLSearchParams(U({
826
826
  plugin_data: "857346721138427857"
827
827
  }, a)).toString(), o = `v1/files/${t}/nodes?${i}`;
828
- return yield T(this, rt).get(o);
828
+ return yield S(this, st).get(o);
829
829
  });
830
830
  }
831
831
  }
832
- rt = /* @__PURE__ */ new WeakMap();
833
- var ue;
832
+ st = /* @__PURE__ */ new WeakMap();
833
+ var le;
834
834
  class dr extends Ts {
835
835
  constructor({
836
836
  baseAddress: e = "https://api.figma.com/",
837
837
  fetch: t = globalThis.fetch.bind(globalThis)
838
838
  } = {}) {
839
- super({ fetch: t, baseAddress: e }), B(this, ue, ""), this.cache = {
839
+ super({ fetch: t, baseAddress: e }), B(this, le, ""), this.cache = {
840
840
  images: {
841
841
  entries: /* @__PURE__ */ new Map(),
842
842
  pendingRequests: /* @__PURE__ */ new Map()
843
843
  }
844
- }, this.files = yt(this, new Ss(this)), this.nodes = yt(this, new Os(this)), this.images = yt(this, new Cs(this));
844
+ }, this.files = _t(this, new Ss(this)), this.nodes = _t(this, new Is(this)), this.images = _t(this, new Cs(this));
845
845
  }
846
846
  set token(e) {
847
847
  if (!e.startsWith("figd_") && !e.startsWith("figu_"))
848
848
  throw new Error("Invalid Figma access token");
849
- R(this, ue, e);
849
+ R(this, le, e);
850
850
  }
851
851
  get token() {
852
- return T(this, ue);
852
+ return S(this, le);
853
853
  }
854
854
  get headers() {
855
855
  const e = {
856
856
  "Content-Type": "application/json"
857
857
  };
858
- return T(this, ue).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = T(this, ue) : T(this, ue).startsWith("figu_") && (e.Authorization = `Bearer ${T(this, ue)}`), e;
858
+ return S(this, le).startsWith("figd_") ? e["X-FIGMA-TOKEN"] = S(this, le) : S(this, le).startsWith("figu_") && (e.Authorization = `Bearer ${S(this, le)}`), e;
859
859
  }
860
860
  }
861
- ue = /* @__PURE__ */ new WeakMap();
862
- const Is = (a) => C(void 0, [a], function* ({
861
+ le = /* @__PURE__ */ new WeakMap();
862
+ const Os = (a) => C(void 0, [a], function* ({
863
863
  fileKey: r,
864
864
  authToken: e,
865
865
  figmaRestApi: t = new dr(),
@@ -877,7 +877,7 @@ const Is = (a) => C(void 0, [a], function* ({
877
877
  } catch (i) {
878
878
  throw i instanceof Error && i.name === "AbortError" ? i : (console.error(i), nr(i, r));
879
879
  }
880
- }), Yn = (i) => C(void 0, [i], function* ({
880
+ }), Qn = (i) => C(void 0, [i], function* ({
881
881
  fileKey: r,
882
882
  authToken: e,
883
883
  nodeIds: t,
@@ -944,10 +944,10 @@ var x;
944
944
  }
945
945
  r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a;
946
946
  })(x || (x = {}));
947
- var Ct;
947
+ var Ot;
948
948
  (function(r) {
949
949
  r.mergeShapes = (e, t) => u(u({}, e), t);
950
- })(Ct || (Ct = {}));
950
+ })(Ot || (Ot = {}));
951
951
  const p = x.arrayToEnum([
952
952
  "string",
953
953
  "nan",
@@ -1068,7 +1068,7 @@ class W extends Error {
1068
1068
  }
1069
1069
  }
1070
1070
  W.create = (r) => new W(r);
1071
- const Ae = (r, e) => {
1071
+ const Ce = (r, e) => {
1072
1072
  let t;
1073
1073
  switch (r.code) {
1074
1074
  case l.invalid_type:
@@ -1124,7 +1124,7 @@ const Ae = (r, e) => {
1124
1124
  }
1125
1125
  return { message: t };
1126
1126
  };
1127
- let lr = Ae;
1127
+ let lr = Ce;
1128
1128
  function js(r) {
1129
1129
  lr = r;
1130
1130
  }
@@ -1161,7 +1161,7 @@ function h(r, e) {
1161
1161
  // then schema-bound map if available
1162
1162
  t,
1163
1163
  // then global override map
1164
- t === Ae ? void 0 : Ae
1164
+ t === Ce ? void 0 : Ce
1165
1165
  // then global default map
1166
1166
  ].filter((n) => !!n)
1167
1167
  });
@@ -1212,7 +1212,7 @@ class Z {
1212
1212
  }
1213
1213
  const _ = Object.freeze({
1214
1214
  status: "aborted"
1215
- }), Te = (r) => ({ status: "dirty", value: r }), $ = (r) => ({ status: "valid", value: r }), Ot = (r) => r.status === "aborted", It = (r) => r.status === "dirty", be = (r) => r.status === "valid", Fe = (r) => typeof Promise != "undefined" && r instanceof Promise;
1215
+ }), Se = (r) => ({ status: "dirty", value: r }), $ = (r) => ({ status: "valid", value: r }), Nt = (r) => r.status === "aborted", jt = (r) => r.status === "dirty", be = (r) => r.status === "valid", Le = (r) => typeof Promise != "undefined" && r instanceof Promise;
1216
1216
  function it(r, e, t, s) {
1217
1217
  if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
1218
1218
  return e.get(r);
@@ -1293,7 +1293,7 @@ class w {
1293
1293
  }
1294
1294
  _parseSync(e) {
1295
1295
  const t = this._parse(e);
1296
- if (Fe(t))
1296
+ if (Le(t))
1297
1297
  throw new Error("Synchronous parse encountered promise.");
1298
1298
  return t;
1299
1299
  }
@@ -1377,7 +1377,7 @@ class w {
1377
1377
  parent: null,
1378
1378
  data: e,
1379
1379
  parsedType: ie(e)
1380
- }, n = this._parse({ data: e, path: s.path, parent: s }), a = yield Fe(n) ? n : Promise.resolve(n);
1380
+ }, n = this._parse({ data: e, path: s.path, parent: s }), a = yield Le(n) ? n : Promise.resolve(n);
1381
1381
  return Gt(s, a);
1382
1382
  });
1383
1383
  }
@@ -1426,10 +1426,10 @@ class w {
1426
1426
  return Oe.create(this, this._def);
1427
1427
  }
1428
1428
  or(e) {
1429
- return Ue.create([this, e], this._def);
1429
+ return We.create([this, e], this._def);
1430
1430
  }
1431
1431
  and(e) {
1432
- return We.create(this, e, this._def);
1432
+ return ze.create(this, e, this._def);
1433
1433
  }
1434
1434
  transform(e) {
1435
1435
  return new G(g(u({}, b(this._def)), {
@@ -1440,21 +1440,21 @@ class w {
1440
1440
  }
1441
1441
  default(e) {
1442
1442
  const t = typeof e == "function" ? e : () => e;
1443
- return new Je(g(u({}, b(this._def)), {
1443
+ return new Ge(g(u({}, b(this._def)), {
1444
1444
  innerType: this,
1445
1445
  defaultValue: t,
1446
1446
  typeName: y.ZodDefault
1447
1447
  }));
1448
1448
  }
1449
1449
  brand() {
1450
- return new Mt(u({
1450
+ return new $t(u({
1451
1451
  typeName: y.ZodBranded,
1452
1452
  type: this
1453
1453
  }, b(this._def)));
1454
1454
  }
1455
1455
  catch(e) {
1456
1456
  const t = typeof e == "function" ? e : () => e;
1457
- return new Ge(g(u({}, b(this._def)), {
1457
+ return new Ke(g(u({}, b(this._def)), {
1458
1458
  innerType: this,
1459
1459
  catchValue: t,
1460
1460
  typeName: y.ZodCatch
@@ -1467,10 +1467,10 @@ class w {
1467
1467
  }));
1468
1468
  }
1469
1469
  pipe(e) {
1470
- return Ye.create(this, e);
1470
+ return Qe.create(this, e);
1471
1471
  }
1472
1472
  readonly() {
1473
- return Ke.create(this);
1473
+ return Xe.create(this);
1474
1474
  }
1475
1475
  isOptional() {
1476
1476
  return this.safeParse(void 0).success;
@@ -1480,7 +1480,7 @@ class w {
1480
1480
  }
1481
1481
  }
1482
1482
  const Zs = /^c[^\s-]{8,}$/i, Ms = /^[0-9a-z]+$/, Ps = /^[0-9A-HJKMNP-TV-Z]{26}$/i, $s = /^[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, Fs = /^[a-z0-9_-]{21}$/i, Ls = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Vs = /^[-+]?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)?)??$/, Ds = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Us = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
1483
- let vt;
1483
+ let bt;
1484
1484
  const Ws = /^(?:(?: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])$/, zs = /^(?:(?: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])$/, Bs = /^(([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]))$/, qs = /^(([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])$/, Hs = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Js = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, hr = "((\\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])))", Gs = new RegExp(`^${hr}$`);
1485
1485
  function pr(r) {
1486
1486
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
@@ -1565,7 +1565,7 @@ class H extends w {
1565
1565
  message: a.message
1566
1566
  }), s.dirty());
1567
1567
  else if (a.kind === "emoji")
1568
- vt || (vt = new RegExp(Us, "u")), vt.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
1568
+ bt || (bt = new RegExp(Us, "u")), bt.test(e.data) || (n = this._getOrReturnCtx(e, n), h(n, {
1569
1569
  validation: "emoji",
1570
1570
  code: l.invalid_string,
1571
1571
  message: a.message
@@ -2187,7 +2187,7 @@ he.create = (r) => {
2187
2187
  coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1
2188
2188
  }, b(r)));
2189
2189
  };
2190
- class Le extends w {
2190
+ class Ve extends w {
2191
2191
  _parse(e) {
2192
2192
  if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
2193
2193
  const s = this._getOrReturnCtx(e);
@@ -2200,7 +2200,7 @@ class Le extends w {
2200
2200
  return $(e.data);
2201
2201
  }
2202
2202
  }
2203
- Le.create = (r) => new Le(u({
2203
+ Ve.create = (r) => new Ve(u({
2204
2204
  typeName: y.ZodBoolean,
2205
2205
  coerce: (r == null ? void 0 : r.coerce) || !1
2206
2206
  }, b(r)));
@@ -2296,7 +2296,7 @@ class ot extends w {
2296
2296
  ot.create = (r) => new ot(u({
2297
2297
  typeName: y.ZodSymbol
2298
2298
  }, b(r)));
2299
- class Ve extends w {
2299
+ class De extends w {
2300
2300
  _parse(e) {
2301
2301
  if (this._getType(e) !== p.undefined) {
2302
2302
  const s = this._getOrReturnCtx(e);
@@ -2309,10 +2309,10 @@ class Ve extends w {
2309
2309
  return $(e.data);
2310
2310
  }
2311
2311
  }
2312
- Ve.create = (r) => new Ve(u({
2312
+ De.create = (r) => new De(u({
2313
2313
  typeName: y.ZodUndefined
2314
2314
  }, b(r)));
2315
- class De extends w {
2315
+ class Ue extends w {
2316
2316
  _parse(e) {
2317
2317
  if (this._getType(e) !== p.null) {
2318
2318
  const s = this._getOrReturnCtx(e);
@@ -2325,10 +2325,10 @@ class De extends w {
2325
2325
  return $(e.data);
2326
2326
  }
2327
2327
  }
2328
- De.create = (r) => new De(u({
2328
+ Ue.create = (r) => new Ue(u({
2329
2329
  typeName: y.ZodNull
2330
2330
  }, b(r)));
2331
- class Ce extends w {
2331
+ class Ie extends w {
2332
2332
  constructor() {
2333
2333
  super(...arguments), this._any = !0;
2334
2334
  }
@@ -2336,7 +2336,7 @@ class Ce extends w {
2336
2336
  return $(e.data);
2337
2337
  }
2338
2338
  }
2339
- Ce.create = (r) => new Ce(u({
2339
+ Ie.create = (r) => new Ie(u({
2340
2340
  typeName: y.ZodAny
2341
2341
  }, b(r)));
2342
2342
  class _e extends w {
@@ -2350,7 +2350,7 @@ class _e extends w {
2350
2350
  _e.create = (r) => new _e(u({
2351
2351
  typeName: y.ZodUnknown
2352
2352
  }, b(r)));
2353
- class oe extends w {
2353
+ class ce extends w {
2354
2354
  _parse(e) {
2355
2355
  const t = this._getOrReturnCtx(e);
2356
2356
  return h(t, {
@@ -2360,7 +2360,7 @@ class oe extends w {
2360
2360
  }), _;
2361
2361
  }
2362
2362
  }
2363
- oe.create = (r) => new oe(u({
2363
+ ce.create = (r) => new ce(u({
2364
2364
  typeName: y.ZodNever
2365
2365
  }, b(r)));
2366
2366
  class ct extends w {
@@ -2448,21 +2448,21 @@ J.create = (r, e) => new J(u({
2448
2448
  exactLength: null,
2449
2449
  typeName: y.ZodArray
2450
2450
  }, b(e)));
2451
- function ke(r) {
2452
- if (r instanceof E) {
2451
+ function Te(r) {
2452
+ if (r instanceof I) {
2453
2453
  const e = {};
2454
2454
  for (const t in r.shape) {
2455
2455
  const s = r.shape[t];
2456
- e[t] = ee.create(ke(s));
2456
+ e[t] = ee.create(Te(s));
2457
2457
  }
2458
- return new E(g(u({}, r._def), {
2458
+ return new I(g(u({}, r._def), {
2459
2459
  shape: () => e
2460
2460
  }));
2461
2461
  } else return r instanceof J ? new J(g(u({}, r._def), {
2462
- type: ke(r.element)
2463
- })) : r instanceof ee ? ee.create(ke(r.unwrap())) : r instanceof me ? me.create(ke(r.unwrap())) : r instanceof re ? re.create(r.items.map((e) => ke(e))) : r;
2462
+ type: Te(r.element)
2463
+ })) : r instanceof ee ? ee.create(Te(r.unwrap())) : r instanceof me ? me.create(Te(r.unwrap())) : r instanceof re ? re.create(r.items.map((e) => Te(e))) : r;
2464
2464
  }
2465
- class E extends w {
2465
+ class I extends w {
2466
2466
  constructor() {
2467
2467
  super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
2468
2468
  }
@@ -2482,7 +2482,7 @@ class E extends w {
2482
2482
  }), _;
2483
2483
  }
2484
2484
  const { status: s, ctx: n } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
2485
- if (!(this._def.catchall instanceof oe && this._def.unknownKeys === "strip"))
2485
+ if (!(this._def.catchall instanceof ce && this._def.unknownKeys === "strip"))
2486
2486
  for (const d in n.data)
2487
2487
  i.includes(d) || o.push(d);
2488
2488
  const c = [];
@@ -2494,7 +2494,7 @@ class E extends w {
2494
2494
  alwaysSet: d in n.data
2495
2495
  });
2496
2496
  }
2497
- if (this._def.catchall instanceof oe) {
2497
+ if (this._def.catchall instanceof ce) {
2498
2498
  const d = this._def.unknownKeys;
2499
2499
  if (d === "passthrough")
2500
2500
  for (const f of o)
@@ -2539,7 +2539,7 @@ class E extends w {
2539
2539
  return this._def.shape();
2540
2540
  }
2541
2541
  strict(e) {
2542
- return m.errToObj, new E(u(g(u({}, this._def), {
2542
+ return m.errToObj, new I(u(g(u({}, this._def), {
2543
2543
  unknownKeys: "strict"
2544
2544
  }), e !== void 0 ? {
2545
2545
  errorMap: (t, s) => {
@@ -2554,12 +2554,12 @@ class E extends w {
2554
2554
  } : {}));
2555
2555
  }
2556
2556
  strip() {
2557
- return new E(g(u({}, this._def), {
2557
+ return new I(g(u({}, this._def), {
2558
2558
  unknownKeys: "strip"
2559
2559
  }));
2560
2560
  }
2561
2561
  passthrough() {
2562
- return new E(g(u({}, this._def), {
2562
+ return new I(g(u({}, this._def), {
2563
2563
  unknownKeys: "passthrough"
2564
2564
  }));
2565
2565
  }
@@ -2581,7 +2581,7 @@ class E extends w {
2581
2581
  // }) as any;
2582
2582
  // };
2583
2583
  extend(e) {
2584
- return new E(g(u({}, this._def), {
2584
+ return new I(g(u({}, this._def), {
2585
2585
  shape: () => u(u({}, this._def.shape()), e)
2586
2586
  }));
2587
2587
  }
@@ -2591,7 +2591,7 @@ class E extends w {
2591
2591
  * upgrade if you are experiencing issues.
2592
2592
  */
2593
2593
  merge(e) {
2594
- return new E({
2594
+ return new I({
2595
2595
  unknownKeys: e._def.unknownKeys,
2596
2596
  catchall: e._def.catchall,
2597
2597
  shape: () => u(u({}, this._def.shape()), e._def.shape()),
@@ -2658,7 +2658,7 @@ class E extends w {
2658
2658
  // return merged;
2659
2659
  // }
2660
2660
  catchall(e) {
2661
- return new E(g(u({}, this._def), {
2661
+ return new I(g(u({}, this._def), {
2662
2662
  catchall: e
2663
2663
  }));
2664
2664
  }
@@ -2666,7 +2666,7 @@ class E extends w {
2666
2666
  const t = {};
2667
2667
  return x.objectKeys(e).forEach((s) => {
2668
2668
  e[s] && this.shape[s] && (t[s] = this.shape[s]);
2669
- }), new E(g(u({}, this._def), {
2669
+ }), new I(g(u({}, this._def), {
2670
2670
  shape: () => t
2671
2671
  }));
2672
2672
  }
@@ -2674,7 +2674,7 @@ class E extends w {
2674
2674
  const t = {};
2675
2675
  return x.objectKeys(this.shape).forEach((s) => {
2676
2676
  e[s] || (t[s] = this.shape[s]);
2677
- }), new E(g(u({}, this._def), {
2677
+ }), new I(g(u({}, this._def), {
2678
2678
  shape: () => t
2679
2679
  }));
2680
2680
  }
@@ -2682,14 +2682,14 @@ class E extends w {
2682
2682
  * @deprecated
2683
2683
  */
2684
2684
  deepPartial() {
2685
- return ke(this);
2685
+ return Te(this);
2686
2686
  }
2687
2687
  partial(e) {
2688
2688
  const t = {};
2689
2689
  return x.objectKeys(this.shape).forEach((s) => {
2690
2690
  const n = this.shape[s];
2691
2691
  e && !e[s] ? t[s] = n : t[s] = n.optional();
2692
- }), new E(g(u({}, this._def), {
2692
+ }), new I(g(u({}, this._def), {
2693
2693
  shape: () => t
2694
2694
  }));
2695
2695
  }
@@ -2704,7 +2704,7 @@ class E extends w {
2704
2704
  a = a._def.innerType;
2705
2705
  t[s] = a;
2706
2706
  }
2707
- }), new E(g(u({}, this._def), {
2707
+ }), new I(g(u({}, this._def), {
2708
2708
  shape: () => t
2709
2709
  }));
2710
2710
  }
@@ -2712,25 +2712,25 @@ class E extends w {
2712
2712
  return gr(x.objectKeys(this.shape));
2713
2713
  }
2714
2714
  }
2715
- E.create = (r, e) => new E(u({
2715
+ I.create = (r, e) => new I(u({
2716
2716
  shape: () => r,
2717
2717
  unknownKeys: "strip",
2718
- catchall: oe.create(),
2718
+ catchall: ce.create(),
2719
2719
  typeName: y.ZodObject
2720
2720
  }, b(e)));
2721
- E.strictCreate = (r, e) => new E(u({
2721
+ I.strictCreate = (r, e) => new I(u({
2722
2722
  shape: () => r,
2723
2723
  unknownKeys: "strict",
2724
- catchall: oe.create(),
2724
+ catchall: ce.create(),
2725
2725
  typeName: y.ZodObject
2726
2726
  }, b(e)));
2727
- E.lazycreate = (r, e) => new E(u({
2727
+ I.lazycreate = (r, e) => new I(u({
2728
2728
  shape: r,
2729
2729
  unknownKeys: "strip",
2730
- catchall: oe.create(),
2730
+ catchall: ce.create(),
2731
2731
  typeName: y.ZodObject
2732
2732
  }, b(e)));
2733
- class Ue extends w {
2733
+ class We extends w {
2734
2734
  _parse(e) {
2735
2735
  const { ctx: t } = this._processInputParams(e), s = this._def.options;
2736
2736
  function n(a) {
@@ -2794,11 +2794,11 @@ class Ue extends w {
2794
2794
  return this._def.options;
2795
2795
  }
2796
2796
  }
2797
- Ue.create = (r, e) => new Ue(u({
2797
+ We.create = (r, e) => new We(u({
2798
2798
  options: r,
2799
2799
  typeName: y.ZodUnion
2800
2800
  }, b(e)));
2801
- const ae = (r) => r instanceof Be ? ae(r.schema) : r instanceof G ? ae(r.innerType()) : r instanceof qe ? [r.value] : r instanceof pe ? r.options : r instanceof He ? x.objectValues(r.enum) : r instanceof Je ? ae(r._def.innerType) : r instanceof Ve ? [void 0] : r instanceof De ? [null] : r instanceof ee ? [void 0, ...ae(r.unwrap())] : r instanceof me ? [null, ...ae(r.unwrap())] : r instanceof Mt || r instanceof Ke ? ae(r.unwrap()) : r instanceof Ge ? ae(r._def.innerType) : [];
2801
+ const ae = (r) => r instanceof qe ? ae(r.schema) : r instanceof G ? ae(r.innerType()) : r instanceof He ? [r.value] : r instanceof pe ? r.options : r instanceof Je ? x.objectValues(r.enum) : r instanceof Ge ? ae(r._def.innerType) : r instanceof De ? [void 0] : r instanceof Ue ? [null] : r instanceof ee ? [void 0, ...ae(r.unwrap())] : r instanceof me ? [null, ...ae(r.unwrap())] : r instanceof $t || r instanceof Xe ? ae(r.unwrap()) : r instanceof Ke ? ae(r._def.innerType) : [];
2802
2802
  class lt extends w {
2803
2803
  _parse(e) {
2804
2804
  const { ctx: t } = this._processInputParams(e);
@@ -2860,14 +2860,14 @@ class lt extends w {
2860
2860
  }, b(s)));
2861
2861
  }
2862
2862
  }
2863
- function Nt(r, e) {
2863
+ function Rt(r, e) {
2864
2864
  const t = ie(r), s = ie(e);
2865
2865
  if (r === e)
2866
2866
  return { valid: !0, data: r };
2867
2867
  if (t === p.object && s === p.object) {
2868
2868
  const n = x.objectKeys(e), a = x.objectKeys(r).filter((o) => n.indexOf(o) !== -1), i = u(u({}, r), e);
2869
2869
  for (const o of a) {
2870
- const c = Nt(r[o], e[o]);
2870
+ const c = Rt(r[o], e[o]);
2871
2871
  if (!c.valid)
2872
2872
  return { valid: !1 };
2873
2873
  i[o] = c.data;
@@ -2878,7 +2878,7 @@ function Nt(r, e) {
2878
2878
  return { valid: !1 };
2879
2879
  const n = [];
2880
2880
  for (let a = 0; a < r.length; a++) {
2881
- const i = r[a], o = e[a], c = Nt(i, o);
2881
+ const i = r[a], o = e[a], c = Rt(i, o);
2882
2882
  if (!c.valid)
2883
2883
  return { valid: !1 };
2884
2884
  n.push(c.data);
@@ -2886,13 +2886,13 @@ function Nt(r, e) {
2886
2886
  return { valid: !0, data: n };
2887
2887
  } else return t === p.date && s === p.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
2888
2888
  }
2889
- class We extends w {
2889
+ class ze extends w {
2890
2890
  _parse(e) {
2891
2891
  const { status: t, ctx: s } = this._processInputParams(e), n = (a, i) => {
2892
- if (Ot(a) || Ot(i))
2892
+ if (Nt(a) || Nt(i))
2893
2893
  return _;
2894
- const o = Nt(a.value, i.value);
2895
- return o.valid ? ((It(a) || It(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
2894
+ const o = Rt(a.value, i.value);
2895
+ return o.valid ? ((jt(a) || jt(i)) && t.dirty(), { status: t.value, value: o.data }) : (h(s, {
2896
2896
  code: l.invalid_intersection_types
2897
2897
  }), _);
2898
2898
  };
@@ -2918,7 +2918,7 @@ class We extends w {
2918
2918
  }));
2919
2919
  }
2920
2920
  }
2921
- We.create = (r, e, t) => new We(u({
2921
+ ze.create = (r, e, t) => new ze(u({
2922
2922
  left: r,
2923
2923
  right: e,
2924
2924
  typeName: y.ZodIntersection
@@ -2971,7 +2971,7 @@ re.create = (r, e) => {
2971
2971
  rest: null
2972
2972
  }, b(e)));
2973
2973
  };
2974
- class ze extends w {
2974
+ class Be extends w {
2975
2975
  get keySchema() {
2976
2976
  return this._def.keyType;
2977
2977
  }
@@ -2999,11 +2999,11 @@ class ze extends w {
2999
2999
  return this._def.valueType;
3000
3000
  }
3001
3001
  static create(e, t, s) {
3002
- return t instanceof w ? new ze(u({
3002
+ return t instanceof w ? new Be(u({
3003
3003
  keyType: e,
3004
3004
  valueType: t,
3005
3005
  typeName: y.ZodRecord
3006
- }, b(s))) : new ze(u({
3006
+ }, b(s))) : new Be(u({
3007
3007
  keyType: H.create(),
3008
3008
  valueType: e,
3009
3009
  typeName: y.ZodRecord
@@ -3118,7 +3118,7 @@ xe.create = (r, e) => new xe(u({
3118
3118
  maxSize: null,
3119
3119
  typeName: y.ZodSet
3120
3120
  }, b(e)));
3121
- class Se extends w {
3121
+ class Ee extends w {
3122
3122
  constructor() {
3123
3123
  super(...arguments), this.validate = this.implement;
3124
3124
  }
@@ -3138,7 +3138,7 @@ class Se extends w {
3138
3138
  t.common.contextualErrorMap,
3139
3139
  t.schemaErrorMap,
3140
3140
  nt(),
3141
- Ae
3141
+ Ce
3142
3142
  ].filter((d) => !!d),
3143
3143
  issueData: {
3144
3144
  code: l.invalid_arguments,
@@ -3154,7 +3154,7 @@ class Se extends w {
3154
3154
  t.common.contextualErrorMap,
3155
3155
  t.schemaErrorMap,
3156
3156
  nt(),
3157
- Ae
3157
+ Ce
3158
3158
  ].filter((d) => !!d),
3159
3159
  issueData: {
3160
3160
  code: l.invalid_return_type,
@@ -3195,12 +3195,12 @@ class Se extends w {
3195
3195
  return this._def.returns;
3196
3196
  }
3197
3197
  args(...e) {
3198
- return new Se(g(u({}, this._def), {
3198
+ return new Ee(g(u({}, this._def), {
3199
3199
  args: re.create(e).rest(_e.create())
3200
3200
  }));
3201
3201
  }
3202
3202
  returns(e) {
3203
- return new Se(g(u({}, this._def), {
3203
+ return new Ee(g(u({}, this._def), {
3204
3204
  returns: e
3205
3205
  }));
3206
3206
  }
@@ -3211,14 +3211,14 @@ class Se extends w {
3211
3211
  return this.parse(e);
3212
3212
  }
3213
3213
  static create(e, t, s) {
3214
- return new Se(u({
3214
+ return new Ee(u({
3215
3215
  args: e || re.create([]).rest(_e.create()),
3216
3216
  returns: t || _e.create(),
3217
3217
  typeName: y.ZodFunction
3218
3218
  }, b(s)));
3219
3219
  }
3220
3220
  }
3221
- class Be extends w {
3221
+ class qe extends w {
3222
3222
  get schema() {
3223
3223
  return this._def.getter();
3224
3224
  }
@@ -3227,11 +3227,11 @@ class Be extends w {
3227
3227
  return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
3228
3228
  }
3229
3229
  }
3230
- Be.create = (r, e) => new Be(u({
3230
+ qe.create = (r, e) => new qe(u({
3231
3231
  getter: r,
3232
3232
  typeName: y.ZodLazy
3233
3233
  }, b(e)));
3234
- class qe extends w {
3234
+ class He extends w {
3235
3235
  _parse(e) {
3236
3236
  if (e.data !== this._def.value) {
3237
3237
  const t = this._getOrReturnCtx(e);
@@ -3247,7 +3247,7 @@ class qe extends w {
3247
3247
  return this._def.value;
3248
3248
  }
3249
3249
  }
3250
- qe.create = (r, e) => new qe(u({
3250
+ He.create = (r, e) => new He(u({
3251
3251
  value: r,
3252
3252
  typeName: y.ZodLiteral
3253
3253
  }, b(e)));
@@ -3310,7 +3310,7 @@ class pe extends w {
3310
3310
  }
3311
3311
  Pe = /* @__PURE__ */ new WeakMap();
3312
3312
  pe.create = gr;
3313
- class He extends w {
3313
+ class Je extends w {
3314
3314
  constructor() {
3315
3315
  super(...arguments), $e.set(this, void 0);
3316
3316
  }
@@ -3339,7 +3339,7 @@ class He extends w {
3339
3339
  }
3340
3340
  }
3341
3341
  $e = /* @__PURE__ */ new WeakMap();
3342
- He.create = (r, e) => new He(u({
3342
+ Je.create = (r, e) => new Je(u({
3343
3343
  values: r,
3344
3344
  typeName: y.ZodNativeEnum
3345
3345
  }, b(e)));
@@ -3393,7 +3393,7 @@ class G extends w {
3393
3393
  path: s.path,
3394
3394
  parent: s
3395
3395
  });
3396
- return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ? Te(c.value) : c;
3396
+ return c.status === "aborted" ? _ : c.status === "dirty" || t.value === "dirty" ? Se(c.value) : c;
3397
3397
  }));
3398
3398
  {
3399
3399
  if (t.value === "aborted")
@@ -3403,7 +3403,7 @@ class G extends w {
3403
3403
  path: s.path,
3404
3404
  parent: s
3405
3405
  });
3406
- return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ? Te(o.value) : o;
3406
+ return o.status === "aborted" ? _ : o.status === "dirty" || t.value === "dirty" ? Se(o.value) : o;
3407
3407
  }
3408
3408
  }
3409
3409
  if (n.type === "refinement") {
@@ -3477,7 +3477,7 @@ me.create = (r, e) => new me(u({
3477
3477
  innerType: r,
3478
3478
  typeName: y.ZodNullable
3479
3479
  }, b(e)));
3480
- class Je extends w {
3480
+ class Ge extends w {
3481
3481
  _parse(e) {
3482
3482
  const { ctx: t } = this._processInputParams(e);
3483
3483
  let s = t.data;
@@ -3491,12 +3491,12 @@ class Je extends w {
3491
3491
  return this._def.innerType;
3492
3492
  }
3493
3493
  }
3494
- Je.create = (r, e) => new Je(u({
3494
+ Ge.create = (r, e) => new Ge(u({
3495
3495
  innerType: r,
3496
3496
  typeName: y.ZodDefault,
3497
3497
  defaultValue: typeof e.default == "function" ? e.default : () => e.default
3498
3498
  }, b(e)));
3499
- class Ge extends w {
3499
+ class Ke extends w {
3500
3500
  _parse(e) {
3501
3501
  const { ctx: t } = this._processInputParams(e), s = g(u({}, t), {
3502
3502
  common: g(u({}, t.common), {
@@ -3507,7 +3507,7 @@ class Ge extends w {
3507
3507
  path: s.path,
3508
3508
  parent: u({}, s)
3509
3509
  });
3510
- return Fe(n) ? n.then((a) => ({
3510
+ return Le(n) ? n.then((a) => ({
3511
3511
  status: "valid",
3512
3512
  value: a.status === "valid" ? a.value : this._def.catchValue({
3513
3513
  get error() {
@@ -3529,7 +3529,7 @@ class Ge extends w {
3529
3529
  return this._def.innerType;
3530
3530
  }
3531
3531
  }
3532
- Ge.create = (r, e) => new Ge(u({
3532
+ Ke.create = (r, e) => new Ke(u({
3533
3533
  innerType: r,
3534
3534
  typeName: y.ZodCatch,
3535
3535
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch
@@ -3551,7 +3551,7 @@ ut.create = (r) => new ut(u({
3551
3551
  typeName: y.ZodNaN
3552
3552
  }, b(r)));
3553
3553
  const tn = Symbol("zod_brand");
3554
- class Mt extends w {
3554
+ class $t extends w {
3555
3555
  _parse(e) {
3556
3556
  const { ctx: t } = this._processInputParams(e), s = t.data;
3557
3557
  return this._def.type._parse({
@@ -3564,7 +3564,7 @@ class Mt extends w {
3564
3564
  return this._def.type;
3565
3565
  }
3566
3566
  }
3567
- class Ye extends w {
3567
+ class Qe extends w {
3568
3568
  _parse(e) {
3569
3569
  const { status: t, ctx: s } = this._processInputParams(e);
3570
3570
  if (s.common.async)
@@ -3574,7 +3574,7 @@ class Ye extends w {
3574
3574
  path: s.path,
3575
3575
  parent: s
3576
3576
  });
3577
- return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), Te(a.value)) : this._def.out._parseAsync({
3577
+ return a.status === "aborted" ? _ : a.status === "dirty" ? (t.dirty(), Se(a.value)) : this._def.out._parseAsync({
3578
3578
  data: a.value,
3579
3579
  path: s.path,
3580
3580
  parent: s
@@ -3597,23 +3597,23 @@ class Ye extends w {
3597
3597
  }
3598
3598
  }
3599
3599
  static create(e, t) {
3600
- return new Ye({
3600
+ return new Qe({
3601
3601
  in: e,
3602
3602
  out: t,
3603
3603
  typeName: y.ZodPipeline
3604
3604
  });
3605
3605
  }
3606
3606
  }
3607
- class Ke extends w {
3607
+ class Xe extends w {
3608
3608
  _parse(e) {
3609
3609
  const t = this._def.innerType._parse(e), s = (n) => (be(n) && (n.value = Object.freeze(n.value)), n);
3610
- return Fe(t) ? t.then((n) => s(n)) : s(t);
3610
+ return Le(t) ? t.then((n) => s(n)) : s(t);
3611
3611
  }
3612
3612
  unwrap() {
3613
3613
  return this._def.innerType;
3614
3614
  }
3615
3615
  }
3616
- Ke.create = (r, e) => new Ke(u({
3616
+ Xe.create = (r, e) => new Xe(u({
3617
3617
  innerType: r,
3618
3618
  typeName: y.ZodReadonly
3619
3619
  }, b(e)));
@@ -3622,7 +3622,7 @@ function Kt(r, e) {
3622
3622
  return typeof t == "string" ? { message: t } : t;
3623
3623
  }
3624
3624
  function yr(r, e = {}, t) {
3625
- return r ? Ce.create().superRefine((s, n) => {
3625
+ return r ? Ie.create().superRefine((s, n) => {
3626
3626
  var a, i;
3627
3627
  const o = r(s);
3628
3628
  if (o instanceof Promise)
@@ -3637,10 +3637,10 @@ function yr(r, e = {}, t) {
3637
3637
  const c = Kt(e, s), d = (i = (a = c.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
3638
3638
  n.addIssue(g(u({ code: "custom" }, c), { fatal: d }));
3639
3639
  }
3640
- }) : Ce.create();
3640
+ }) : Ie.create();
3641
3641
  }
3642
3642
  const rn = {
3643
- object: E.lazycreate
3643
+ object: I.lazycreate
3644
3644
  };
3645
3645
  var y;
3646
3646
  (function(r) {
@@ -3648,18 +3648,18 @@ var y;
3648
3648
  })(y || (y = {}));
3649
3649
  const sn = (r, e = {
3650
3650
  message: `Input not instance of ${r.name}`
3651
- }) => yr((t) => t instanceof r, e), vr = H.create, _r = fe.create, nn = ut.create, an = he.create, br = Le.create, on = we.create, cn = ot.create, dn = Ve.create, un = De.create, ln = Ce.create, fn = _e.create, hn = oe.create, pn = ct.create, mn = J.create, gn = E.create, yn = E.strictCreate, vn = Ue.create, _n = lt.create, bn = We.create, wn = re.create, xn = ze.create, kn = dt.create, Tn = xe.create, Sn = Se.create, En = Be.create, An = qe.create, Cn = pe.create, On = He.create, In = Oe.create, Xt = G.create, Nn = ee.create, jn = me.create, Rn = G.createWithPreprocess, Zn = Ye.create, Mn = () => vr().optional(), Pn = () => _r().optional(), $n = () => br().optional(), Fn = {
3651
+ }) => yr((t) => t instanceof r, e), vr = H.create, _r = fe.create, nn = ut.create, an = he.create, br = Ve.create, on = we.create, cn = ot.create, dn = De.create, un = Ue.create, ln = Ie.create, fn = _e.create, hn = ce.create, pn = ct.create, mn = J.create, gn = I.create, yn = I.strictCreate, vn = We.create, _n = lt.create, bn = ze.create, wn = re.create, xn = Be.create, kn = dt.create, Tn = xe.create, Sn = Ee.create, En = qe.create, An = He.create, Cn = pe.create, In = Je.create, On = Oe.create, Xt = G.create, Nn = ee.create, jn = me.create, Rn = G.createWithPreprocess, Zn = Qe.create, Mn = () => vr().optional(), Pn = () => _r().optional(), $n = () => br().optional(), Fn = {
3652
3652
  string: (r) => H.create(g(u({}, r), { coerce: !0 })),
3653
3653
  number: (r) => fe.create(g(u({}, r), { coerce: !0 })),
3654
- boolean: (r) => Le.create(g(u({}, r), {
3654
+ boolean: (r) => Ve.create(g(u({}, r), {
3655
3655
  coerce: !0
3656
3656
  })),
3657
3657
  bigint: (r) => he.create(g(u({}, r), { coerce: !0 })),
3658
3658
  date: (r) => we.create(g(u({}, r), { coerce: !0 }))
3659
3659
  }, Ln = _;
3660
- var S = /* @__PURE__ */ Object.freeze({
3660
+ var T = /* @__PURE__ */ Object.freeze({
3661
3661
  __proto__: null,
3662
- defaultErrorMap: Ae,
3662
+ defaultErrorMap: Ce,
3663
3663
  setErrorMap: js,
3664
3664
  getErrorMap: nt,
3665
3665
  makeIssue: at,
@@ -3667,17 +3667,17 @@ var S = /* @__PURE__ */ Object.freeze({
3667
3667
  addIssueToContext: h,
3668
3668
  ParseStatus: Z,
3669
3669
  INVALID: _,
3670
- DIRTY: Te,
3670
+ DIRTY: Se,
3671
3671
  OK: $,
3672
- isAborted: Ot,
3673
- isDirty: It,
3672
+ isAborted: Nt,
3673
+ isDirty: jt,
3674
3674
  isValid: be,
3675
- isAsync: Fe,
3675
+ isAsync: Le,
3676
3676
  get util() {
3677
3677
  return x;
3678
3678
  },
3679
3679
  get objectUtil() {
3680
- return Ct;
3680
+ return Ot;
3681
3681
  },
3682
3682
  ZodParsedType: p,
3683
3683
  getParsedType: ie,
@@ -3686,41 +3686,41 @@ var S = /* @__PURE__ */ Object.freeze({
3686
3686
  ZodString: H,
3687
3687
  ZodNumber: fe,
3688
3688
  ZodBigInt: he,
3689
- ZodBoolean: Le,
3689
+ ZodBoolean: Ve,
3690
3690
  ZodDate: we,
3691
3691
  ZodSymbol: ot,
3692
- ZodUndefined: Ve,
3693
- ZodNull: De,
3694
- ZodAny: Ce,
3692
+ ZodUndefined: De,
3693
+ ZodNull: Ue,
3694
+ ZodAny: Ie,
3695
3695
  ZodUnknown: _e,
3696
- ZodNever: oe,
3696
+ ZodNever: ce,
3697
3697
  ZodVoid: ct,
3698
3698
  ZodArray: J,
3699
- ZodObject: E,
3700
- ZodUnion: Ue,
3699
+ ZodObject: I,
3700
+ ZodUnion: We,
3701
3701
  ZodDiscriminatedUnion: lt,
3702
- ZodIntersection: We,
3702
+ ZodIntersection: ze,
3703
3703
  ZodTuple: re,
3704
- ZodRecord: ze,
3704
+ ZodRecord: Be,
3705
3705
  ZodMap: dt,
3706
3706
  ZodSet: xe,
3707
- ZodFunction: Se,
3708
- ZodLazy: Be,
3709
- ZodLiteral: qe,
3707
+ ZodFunction: Ee,
3708
+ ZodLazy: qe,
3709
+ ZodLiteral: He,
3710
3710
  ZodEnum: pe,
3711
- ZodNativeEnum: He,
3711
+ ZodNativeEnum: Je,
3712
3712
  ZodPromise: Oe,
3713
3713
  ZodEffects: G,
3714
3714
  ZodTransformer: G,
3715
3715
  ZodOptional: ee,
3716
3716
  ZodNullable: me,
3717
- ZodDefault: Je,
3718
- ZodCatch: Ge,
3717
+ ZodDefault: Ge,
3718
+ ZodCatch: Ke,
3719
3719
  ZodNaN: ut,
3720
3720
  BRAND: tn,
3721
- ZodBranded: Mt,
3722
- ZodPipeline: Ye,
3723
- ZodReadonly: Ke,
3721
+ ZodBranded: $t,
3722
+ ZodPipeline: Qe,
3723
+ ZodReadonly: Xe,
3724
3724
  custom: yr,
3725
3725
  Schema: w,
3726
3726
  ZodSchema: w,
@@ -3744,7 +3744,7 @@ var S = /* @__PURE__ */ Object.freeze({
3744
3744
  literal: An,
3745
3745
  map: kn,
3746
3746
  nan: nn,
3747
- nativeEnum: On,
3747
+ nativeEnum: In,
3748
3748
  never: hn,
3749
3749
  null: un,
3750
3750
  nullable: jn,
@@ -3756,7 +3756,7 @@ var S = /* @__PURE__ */ Object.freeze({
3756
3756
  ostring: Mn,
3757
3757
  pipeline: Zn,
3758
3758
  preprocess: Rn,
3759
- promise: In,
3759
+ promise: On,
3760
3760
  record: xn,
3761
3761
  set: Tn,
3762
3762
  strictObject: yn,
@@ -3773,16 +3773,16 @@ var S = /* @__PURE__ */ Object.freeze({
3773
3773
  quotelessJson: Ns,
3774
3774
  ZodError: W
3775
3775
  });
3776
- const Vn = S.object({
3777
- language: S.enum(["typescript", "javascript"]).optional(),
3778
- disableMarkedForExport: S.boolean().optional(),
3779
- allowAutoSelectFirstNode: S.boolean().optional().default(!0)
3776
+ const Vn = T.object({
3777
+ language: T.enum(["typescript", "javascript"]).optional(),
3778
+ disableMarkedForExport: T.boolean().optional(),
3779
+ allowAutoSelectFirstNode: T.boolean().optional().default(!0)
3780
3780
  }).and(
3781
- S.union([
3782
- S.object({
3783
- framework: S.literal("react"),
3784
- model: S.string().optional(),
3785
- styling: S.enum([
3781
+ T.union([
3782
+ T.object({
3783
+ framework: T.literal("react"),
3784
+ model: T.string().optional(),
3785
+ styling: T.enum([
3786
3786
  "plain_css",
3787
3787
  "css_modules",
3788
3788
  "styled_components",
@@ -3791,26 +3791,27 @@ const Vn = S.object({
3791
3791
  "scss",
3792
3792
  "inline_styles"
3793
3793
  ]),
3794
- uiLibrary: S.enum(["mui", "antd", "radix", "shadcn", "clean_react"]).optional(),
3795
- responsivePages: S.array(
3796
- S.object({
3797
- name: S.string(),
3798
- framesId: S.array(S.string())
3794
+ uiLibrary: T.enum(["mui", "antd", "radix", "shadcn", "clean_react"]).optional(),
3795
+ responsivePages: T.array(
3796
+ T.object({
3797
+ name: T.string(),
3798
+ framesId: T.array(T.string())
3799
3799
  })
3800
3800
  ).optional(),
3801
- enableUILibraryTheming: S.boolean().optional(),
3802
- enableCompactStructure: S.boolean().optional(),
3803
- enableDisplayScreenModelId: S.boolean().optional(),
3804
- enableGeneratePackageLock: S.boolean().optional(),
3805
- enableAutoSplit: S.boolean().optional(),
3806
- autoSplitThreshold: S.number().optional(),
3807
- url: S.string().url().optional(),
3808
- codegenSettings: S.record(S.unknown()).optional()
3801
+ enableUILibraryTheming: T.boolean().optional(),
3802
+ enableCompactStructure: T.boolean().optional(),
3803
+ enableDisplayScreenModelId: T.boolean().optional(),
3804
+ enableGeneratePackageLock: T.boolean().optional(),
3805
+ enableAnimationsPreset: T.boolean().optional(),
3806
+ enableAutoSplit: T.boolean().optional(),
3807
+ autoSplitThreshold: T.number().optional(),
3808
+ url: T.string().url().optional(),
3809
+ codegenSettings: T.record(T.unknown()).optional()
3809
3810
  }),
3810
- S.object({
3811
- framework: S.literal("html"),
3812
- styling: S.enum(["plain_css", "inline_styles", "tailwind"]),
3813
- enableTranslation: S.boolean().optional()
3811
+ T.object({
3812
+ framework: T.literal("html"),
3813
+ styling: T.enum(["plain_css", "inline_styles", "tailwind"]),
3814
+ enableTranslation: T.boolean().optional()
3814
3815
  })
3815
3816
  ])
3816
3817
  ), Dn = (r) => {
@@ -3858,36 +3859,36 @@ const Vn = S.object({
3858
3859
  reason: "Selected node type is not supported"
3859
3860
  };
3860
3861
  };
3861
- var O, Xe, le, wr, st;
3862
- class Qn {
3862
+ var E, Ye, oe, wr, Fe;
3863
+ class ea {
3863
3864
  constructor({
3864
3865
  auth: e,
3865
3866
  apiBaseAddress: t = "https://public-api.animaapp.com"
3866
3867
  } = {}) {
3867
- Qe(this, le);
3868
- Qe(this, O);
3869
- Qe(this, Xe);
3870
- pt(this, Xe, t), e && (this.auth = e);
3868
+ et(this, oe);
3869
+ et(this, E);
3870
+ et(this, Ye);
3871
+ gt(this, Ye, t), e && (this.auth = e);
3871
3872
  }
3872
3873
  hasAuth() {
3873
- return !!N(this, O);
3874
+ return !!A(this, E);
3874
3875
  }
3875
3876
  set auth(e) {
3876
- pt(this, O, e);
3877
+ gt(this, E, e);
3877
3878
  }
3878
3879
  get headers() {
3879
3880
  const e = {
3880
3881
  "Content-Type": "application/json"
3881
3882
  };
3882
- return N(this, O) && (e.Authorization = `Bearer ${N(this, O).token}`, "teamId" in N(this, O) && (e["X-Team-Id"] = N(this, O).teamId)), e;
3883
+ return A(this, E) && (e.Authorization = `Bearer ${A(this, E).token}`, "teamId" in A(this, E) && (e["X-Team-Id"] = A(this, E).teamId)), e;
3883
3884
  }
3884
3885
  generateCode(n) {
3885
3886
  return C(this, arguments, function* (e, t = {}, s) {
3886
3887
  var c;
3887
3888
  const a = Dn(e.settings);
3888
- e.figmaToken && (yield Ne(this, le, wr).call(this, e.fileKey, e.figmaToken, e.nodesId, { allowAutoSelectFirstNode: (c = a.allowAutoSelectFirstNode) != null ? c : !0 }, s));
3889
+ e.figmaToken && (yield ke(this, oe, wr).call(this, e.fileKey, e.figmaToken, e.nodesId, { allowAutoSelectFirstNode: (c = a.allowAutoSelectFirstNode) != null ? c : !0 }, s));
3889
3890
  let i = e.tracking;
3890
- N(this, O) && "userId" in N(this, O) && N(this, O).userId && (i != null && i.externalId || (i = { externalId: N(this, O).userId }));
3891
+ A(this, E) && "userId" in A(this, E) && A(this, E).userId && (i != null && i.externalId || (i = { externalId: A(this, E).userId }));
3891
3892
  const o = {
3892
3893
  tracking: i,
3893
3894
  fileKey: e.fileKey,
@@ -3908,16 +3909,17 @@ class Qn {
3908
3909
  allowAutoSelectFirstNode: a.allowAutoSelectFirstNode,
3909
3910
  enableDisplayScreenModelId: a.enableDisplayScreenModelId,
3910
3911
  enableGeneratePackageLock: a.enableGeneratePackageLock,
3912
+ enableAnimationsPreset: a.enableAnimationsPreset,
3911
3913
  codegenSettings: a.codegenSettings,
3912
3914
  webhookUrl: e.webhookUrl
3913
3915
  };
3914
- return Ne(this, le, st).call(this, "/v1/codegen", o, t, "codegen", s);
3916
+ return ke(this, oe, Fe).call(this, "/v1/codegen", o, t, "codegen", s);
3915
3917
  });
3916
3918
  }
3917
3919
  generateCodeFromWebsite(n) {
3918
3920
  return C(this, arguments, function* (e, t = {}, s) {
3919
3921
  let a = e.tracking;
3920
- N(this, O) && "userId" in N(this, O) && N(this, O).userId && (a != null && a.externalId || (a = { externalId: N(this, O).userId }));
3922
+ A(this, E) && "userId" in A(this, E) && A(this, E).userId && (a != null && a.externalId || (a = { externalId: A(this, E).userId }));
3921
3923
  const i = {
3922
3924
  tracking: a,
3923
3925
  assetsStorage: e.assetsStorage,
@@ -3936,7 +3938,56 @@ class Qn {
3936
3938
  }
3937
3939
  }
3938
3940
  };
3939
- return Ne(this, le, st).call(this, "/v1/l2c", i, t, "l2c", s);
3941
+ return ke(this, oe, Fe).call(this, "/v1/l2c", i, t, "l2c", s);
3942
+ });
3943
+ }
3944
+ /**
3945
+ * Generates code from a text prompt using AI.
3946
+ *
3947
+ * This method sends a prompt to the Anima API and generates code based on the description provided.
3948
+ * It supports real-time streaming of the generation process through Server-Sent Events (SSE).
3949
+ *
3950
+ * @param params - The parameters for code generation
3951
+ * @param params.prompt - The text prompt describing what code to generate
3952
+ * @param params.settings - Code generation settings (framework, language, styling, etc.)
3953
+ * @param params.assetsStorage - Optional asset storage configuration
3954
+ * @param params.tracking - Optional tracking information
3955
+ * @param params.webhookUrl - Optional webhook URL for completion notification
3956
+ * @param handler - Event handler for processing SSE messages during generation
3957
+ * @param signal - Optional AbortSignal to cancel the request
3958
+ * @returns Promise resolving to AnimaSDKResult with generated files and metadata
3959
+ *
3960
+ * @example
3961
+ * ```typescript
3962
+ * const result = await anima.generateCodeFromPrompt({
3963
+ * prompt: "Create a login form with email and password fields",
3964
+ * settings: {
3965
+ * framework: "react",
3966
+ * language: "typescript",
3967
+ * styling: "tailwind"
3968
+ * }
3969
+ * }, {
3970
+ * onStart: ({ sessionId }) => console.log("Started:", sessionId),
3971
+ * onGeneratingCode: ({ progress }) => console.log("Progress:", progress),
3972
+ * onCodegenCompleted: () => console.log("Generation completed!")
3973
+ * });
3974
+ * ```
3975
+ */
3976
+ generateCodeFromPrompt(n) {
3977
+ return C(this, arguments, function* (e, t = {}, s) {
3978
+ let a = e.tracking;
3979
+ A(this, E) && "userId" in A(this, E) && A(this, E).userId && (a != null && a.externalId || (a = { externalId: A(this, E).userId }));
3980
+ const i = {
3981
+ tracking: a,
3982
+ assetsStorage: e.assetsStorage,
3983
+ prompt: e.prompt,
3984
+ language: e.settings.language,
3985
+ framework: e.settings.framework,
3986
+ styling: e.settings.styling,
3987
+ uiLibrary: e.settings.uiLibrary,
3988
+ webhookUrl: e.webhookUrl
3989
+ };
3990
+ return ke(this, oe, Fe).call(this, "/v1/p2c", i, t, "p2c", s);
3940
3991
  });
3941
3992
  }
3942
3993
  /**
@@ -3945,21 +3996,21 @@ class Qn {
3945
3996
  generateLink2Code(n) {
3946
3997
  return C(this, arguments, function* (e, t = {}, s) {
3947
3998
  let a = e.tracking;
3948
- N(this, O) && "userId" in N(this, O) && N(this, O).userId && (a != null && a.externalId || (a = { externalId: N(this, O).userId }));
3999
+ A(this, E) && "userId" in A(this, E) && A(this, E).userId && (a != null && a.externalId || (a = { externalId: A(this, E).userId }));
3949
4000
  const i = {
3950
4001
  tracking: a,
3951
4002
  assetsStorage: e.assetsStorage,
3952
4003
  params: e.params
3953
4004
  };
3954
- return Ne(this, le, st).call(this, "/v1/l2c", i, t, "l2c", s);
4005
+ return ke(this, oe, Fe).call(this, "/v1/l2c", i, t, "l2c", s);
3955
4006
  });
3956
4007
  }
3957
4008
  }
3958
- O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s, n, a) {
4009
+ E = new WeakMap(), Ye = new WeakMap(), oe = new WeakSet(), wr = function(e, t, s, n, a) {
3959
4010
  return C(this, null, function* () {
3960
4011
  let i;
3961
4012
  try {
3962
- i = yield Is({
4013
+ i = yield Os({
3963
4014
  fileKey: e,
3964
4015
  authToken: t,
3965
4016
  params: {
@@ -3978,17 +4029,17 @@ O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s
3978
4029
  (d) => !d.isValid
3979
4030
  );
3980
4031
  if (c)
3981
- throw new de({
4032
+ throw new ue({
3982
4033
  name: "Task Crashed",
3983
4034
  reason: c.reason
3984
4035
  });
3985
4036
  });
3986
- }, st = function(e, t, s, n, a) {
4037
+ }, Fe = function(e, t, s, n, a) {
3987
4038
  return C(this, null, function* () {
3988
- var v, j, M, F, z, se, ge, ce, V;
4039
+ var v, j, M, F, z, se, ge, de, V;
3989
4040
  if (this.hasAuth() === !1)
3990
4041
  throw new Error('It needs to set "auth" before calling this method.');
3991
- const i = {}, o = yield fetch(`${N(this, Xe)}${e}`, {
4042
+ const i = {}, o = yield fetch(`${A(this, Ye)}${e}`, {
3992
4043
  method: "POST",
3993
4044
  headers: g(u({}, this.headers), {
3994
4045
  Accept: "text/event-stream"
@@ -4001,25 +4052,25 @@ O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s
4001
4052
  let q;
4002
4053
  try {
4003
4054
  q = JSON.parse(K);
4004
- } catch (Ie) {
4055
+ } catch (Ne) {
4005
4056
  }
4006
- throw ((v = q == null ? void 0 : q.error) == null ? void 0 : v.name) === "ZodError" ? new de({
4057
+ throw ((v = q == null ? void 0 : q.error) == null ? void 0 : v.name) === "ZodError" ? new ue({
4007
4058
  name: "HTTP error from Anima API",
4008
4059
  reason: "Invalid body payload",
4009
4060
  detail: q.error.issues,
4010
4061
  status: o.status
4011
- }) : typeof q == "object" ? new de({
4062
+ }) : typeof q == "object" ? new ue({
4012
4063
  name: `Error "${q}"`,
4013
4064
  reason: "Unknown",
4014
4065
  status: o.status
4015
- }) : new de({
4066
+ }) : new ue({
4016
4067
  name: "HTTP error from Anima API",
4017
4068
  reason: K,
4018
4069
  status: o.status
4019
4070
  });
4020
4071
  }
4021
4072
  if (!o.body)
4022
- throw new de({
4073
+ throw new ue({
4023
4074
  name: "Stream Error",
4024
4075
  reason: "Response body is null",
4025
4076
  status: o.status
@@ -4032,15 +4083,15 @@ O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s
4032
4083
  if (K)
4033
4084
  break;
4034
4085
  f += d.decode(q, { stream: !0 });
4035
- const Ie = f.split(`
4086
+ const Ne = f.split(`
4036
4087
  `);
4037
- f = Ie.pop() || "";
4038
- for (const A of Ie)
4039
- if (!(!A.trim() || A.startsWith(":")) && A.startsWith("data: ")) {
4088
+ f = Ne.pop() || "";
4089
+ for (const O of Ne)
4090
+ if (!(!O.trim() || O.startsWith(":")) && O.startsWith("data: ")) {
4040
4091
  let k;
4041
4092
  try {
4042
- k = JSON.parse(A.slice(6));
4043
- } catch (ft) {
4093
+ k = JSON.parse(O.slice(6));
4094
+ } catch (pt) {
4044
4095
  continue;
4045
4096
  }
4046
4097
  switch (k.type) {
@@ -4074,7 +4125,7 @@ O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s
4074
4125
  break;
4075
4126
  }
4076
4127
  case "generating_code": {
4077
- k.payload.status === "success" && (i.files = k.payload.files), typeof s == "function" ? s(k) : (ce = s.onGeneratingCode) == null || ce.call(s, {
4128
+ k.payload.status === "success" && (i.files = k.payload.files), typeof s == "function" ? s(k) : (de = s.onGeneratingCode) == null || de.call(s, {
4078
4129
  status: k.payload.status,
4079
4130
  progress: k.payload.progress,
4080
4131
  files: k.payload.files
@@ -4087,13 +4138,13 @@ O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s
4087
4138
  break;
4088
4139
  }
4089
4140
  case "error":
4090
- throw new de({
4141
+ throw new ue({
4091
4142
  name: k.payload.errorName,
4092
4143
  reason: k.payload.reason
4093
4144
  });
4094
4145
  case "done": {
4095
4146
  if (!i.files)
4096
- throw new de({
4147
+ throw new ue({
4097
4148
  name: "Invalid response",
4098
4149
  reason: "No code generated"
4099
4150
  });
@@ -4105,14 +4156,14 @@ O = new WeakMap(), Xe = new WeakMap(), le = new WeakSet(), wr = function(e, t, s
4105
4156
  } finally {
4106
4157
  c.cancel();
4107
4158
  }
4108
- throw new de({
4159
+ throw new ue({
4109
4160
  name: "Connection",
4110
4161
  reason: "Connection closed before the 'done' message",
4111
4162
  status: 500
4112
4163
  });
4113
4164
  });
4114
4165
  };
4115
- const ea = (r) => {
4166
+ const ta = (r) => {
4116
4167
  var e;
4117
4168
  if (!r)
4118
4169
  return [!1, "", ""];
@@ -4124,11 +4175,11 @@ const ea = (r) => {
4124
4175
  if (r !== n)
4125
4176
  return [!1, "", ""];
4126
4177
  const a = ((e = t.searchParams.get("node-id")) != null ? e : "").replace(/-/g, ":"), i = s.split("/")[2];
4127
- return [(s.startsWith("/file/") && t.searchParams.get("type") !== "whiteboard" || s.startsWith("/design/")) && i.length === 22, i, a];
4178
+ return [(s.startsWith("/file/") && t.searchParams.get("type") !== "whiteboard" || s.startsWith("/design/") || s.startsWith("/proto/")) && i.length === 22, i, a];
4128
4179
  } catch (t) {
4129
4180
  return [!1, "", ""];
4130
4181
  }
4131
- }, ta = ({
4182
+ }, ra = ({
4132
4183
  fileKey: r,
4133
4184
  nodeId: e,
4134
4185
  duplicate: t
@@ -4136,12 +4187,12 @@ const ea = (r) => {
4136
4187
  const s = new URL("https://www.figma.com");
4137
4188
  return s.pathname = `design/${r}`, t && (s.pathname = `${s.pathname}/dummy/duplicate`), e && s.searchParams.set("node-id", e.replace(":", "-")), s;
4138
4189
  };
4139
- class ra extends Error {
4190
+ class sa extends Error {
4140
4191
  constructor(e, t) {
4141
4192
  super(e), this.response = t;
4142
4193
  }
4143
4194
  }
4144
- const sa = ({
4195
+ const na = ({
4145
4196
  files: r,
4146
4197
  screenPath: e = "src/screens"
4147
4198
  }) => {
@@ -4190,7 +4241,7 @@ function zn(r, e) {
4190
4241
  function Bn(r, e) {
4191
4242
  return Object.keys(r).filter((t) => t.startsWith(e));
4192
4243
  }
4193
- function Pt(r, e, t) {
4244
+ function ft(r, e, t) {
4194
4245
  return new ReadableStream({
4195
4246
  start(s) {
4196
4247
  t.call(r, e, (n) => {
@@ -4218,12 +4269,12 @@ function Pt(r, e, t) {
4218
4269
  }
4219
4270
  });
4220
4271
  }
4221
- const qn = (r, e) => Pt(
4272
+ const qn = (r, e) => ft(
4222
4273
  r,
4223
4274
  e,
4224
4275
  r.generateCode
4225
4276
  );
4226
- function $t(r) {
4277
+ function ht(r) {
4227
4278
  return C(this, null, function* () {
4228
4279
  var i, o, c, d;
4229
4280
  const [e, t] = r.tee(), s = yield e.getReader().read();
@@ -4257,52 +4308,61 @@ data: ${JSON.stringify(
4257
4308
  });
4258
4309
  });
4259
4310
  }
4260
- const na = (r, e) => C(void 0, null, function* () {
4311
+ const aa = (r, e) => C(void 0, null, function* () {
4261
4312
  const t = qn(r, e);
4262
- return $t(t);
4263
- }), Hn = (r, e) => Pt(
4313
+ return ht(t);
4314
+ }), Hn = (r, e) => ft(
4264
4315
  r,
4265
4316
  e,
4266
4317
  r.generateCodeFromWebsite
4267
- ), aa = (r, e) => C(void 0, null, function* () {
4318
+ ), ia = (r, e) => C(void 0, null, function* () {
4268
4319
  const t = Hn(r, e);
4269
- return $t(t);
4270
- }), Jn = (r, e) => Pt(
4320
+ return ht(t);
4321
+ }), Jn = (r, e) => ft(
4271
4322
  r,
4272
4323
  e,
4273
- r.generateLink2Code
4274
- ), ia = (r, e) => C(void 0, null, function* () {
4324
+ r.generateCodeFromPrompt
4325
+ ), oa = (r, e) => C(void 0, null, function* () {
4275
4326
  const t = Jn(r, e);
4276
- return $t(t);
4327
+ return ht(t);
4328
+ }), Gn = (r, e) => ft(
4329
+ r,
4330
+ e,
4331
+ r.generateLink2Code
4332
+ ), ca = (r, e) => C(void 0, null, function* () {
4333
+ const t = Gn(r, e);
4334
+ return ht(t);
4277
4335
  });
4278
4336
  export {
4279
- Qn as Anima,
4280
- de as CodegenError,
4337
+ ea as Anima,
4338
+ ue as CodegenError,
4281
4339
  Ar as FigmaTokenIssue,
4282
- Ir as NotFound,
4340
+ Or as NotFound,
4283
4341
  Cr as RateLimitExceeded,
4284
- Or as RequestTooLarge,
4285
- ra as ResponseError,
4342
+ Ir as RequestTooLarge,
4343
+ sa as ResponseError,
4286
4344
  jr as UnknownFigmaApiException,
4287
- aa as createCodeFromWebsiteResponseEventStream,
4345
+ oa as createCodeFromPromptResponseEventStream,
4346
+ Jn as createCodeFromPromptStream,
4347
+ ia as createCodeFromWebsiteResponseEventStream,
4288
4348
  Hn as createCodeFromWebsiteStream,
4289
- na as createCodegenResponseEventStream,
4349
+ aa as createCodegenResponseEventStream,
4290
4350
  qn as createCodegenStream,
4291
- ia as createLink2CodeResponseEventStream,
4292
- Jn as createLink2CodeStream,
4351
+ ca as createLink2CodeResponseEventStream,
4352
+ Gn as createLink2CodeStream,
4293
4353
  ur as findChildrenNode,
4294
- ta as formatToFigmaLink,
4295
- Xn as getFigmaApiErrorType,
4296
- Is as getFigmaFile,
4297
- Yn as getFileNodes,
4298
- sa as getRelatedScreenFiles,
4354
+ ra as formatToFigmaLink,
4355
+ Yn as getFigmaApiErrorType,
4356
+ Os as getFigmaFile,
4357
+ Qn as getFileNodes,
4358
+ na as getRelatedScreenFiles,
4299
4359
  Zr as isFigmaTokenIssue,
4300
4360
  Un as isNodeCodegenCompatible,
4301
4361
  Nr as isNotFound,
4302
4362
  Rr as isRateLimitExceeded,
4303
4363
  Mr as isRequestTooLarge,
4304
- Kn as isUnknownFigmaApiException,
4305
- ea as isValidFigmaUrl,
4364
+ Xn as isUnknownFigmaApiException,
4365
+ ta as isValidFigmaUrl,
4306
4366
  Dn as validateSettings,
4307
4367
  nr as wrapFigmaApiError
4308
4368
  };