@animaapp/anima-sdk 0.2.4 → 0.2.6

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.d.ts CHANGED
@@ -82,6 +82,7 @@ export declare type CodegenSettings = {
82
82
  enableCompactStructure?: boolean;
83
83
  enableAutoSplit?: boolean;
84
84
  autoSplitThreshold?: number;
85
+ disableMarkedForExport?: boolean;
85
86
  };
86
87
 
87
88
  /**
@@ -181,6 +182,7 @@ export declare type GetCodeParams = {
181
182
  nodesId: string[];
182
183
  assetsStorage?: AssetsStorage;
183
184
  settings: CodegenSettings;
185
+ tracking?: TrackingInfos;
184
186
  };
185
187
 
186
188
  export declare const getFigmaApiErrorType: (error: Error) => FigmaApiErrorType;
@@ -320,6 +322,10 @@ export declare type StreamCodgenMessage = Exclude<SSECodgenMessage, {
320
322
  };
321
323
  };
322
324
 
325
+ export declare type TrackingInfos = {
326
+ externalId: string;
327
+ };
328
+
323
329
  export declare class UnknownFigmaApiException extends Error {
324
330
  fileKey: string;
325
331
  constructor({ fileKey, cause }: {
package/dist/index.js CHANGED
@@ -551,7 +551,7 @@ class w {
551
551
  return J.create(this);
552
552
  }
553
553
  promise() {
554
- return Ae.create(this, this._def);
554
+ return Ee.create(this, this._def);
555
555
  }
556
556
  or(e) {
557
557
  return Le.create([this, e], this._def);
@@ -575,7 +575,7 @@ class w {
575
575
  }));
576
576
  }
577
577
  brand() {
578
- return new At(u({
578
+ return new Et(u({
579
579
  typeName: g.ZodBranded,
580
580
  type: this
581
581
  }, b(this._def)));
@@ -607,7 +607,7 @@ class w {
607
607
  return this.safeParse(null).success;
608
608
  }
609
609
  }
610
- const bn = /^c[^\s-]{8,}$/i, wn = /^[0-9a-z]+$/, xn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kn = /^[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, Tn = /^[a-z0-9_-]{21}$/i, Sn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, An = /^[-+]?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)?)??$/, En = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, On = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
610
+ const bn = /^c[^\s-]{8,}$/i, wn = /^[0-9a-z]+$/, xn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kn = /^[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, Tn = /^[a-z0-9_-]{21}$/i, Sn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, En = /^[-+]?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)?)??$/, An = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, On = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
611
611
  let ut;
612
612
  const Cn = /^(?:(?: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])$/, In = /^(?:(?: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])$/, Nn = /^(([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]))$/, jn = /^(([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])$/, Rn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Jt = "((\\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])))", Mn = new RegExp(`^${Jt}$`);
613
613
  function Gt(n) {
@@ -687,7 +687,7 @@ class H extends w {
687
687
  message: a.message
688
688
  }), s.dirty());
689
689
  } else if (a.kind === "email")
690
- En.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
690
+ An.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
691
691
  validation: "email",
692
692
  code: l.invalid_string,
693
693
  message: a.message
@@ -766,7 +766,7 @@ class H extends w {
766
766
  code: l.invalid_string,
767
767
  validation: "time",
768
768
  message: a.message
769
- }), s.dirty()) : a.kind === "duration" ? An.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
769
+ }), s.dirty()) : a.kind === "duration" ? En.test(e.data) || (r = this._getOrReturnCtx(e, r), h(r, {
770
770
  validation: "duration",
771
771
  code: l.invalid_string,
772
772
  message: a.message
@@ -1653,10 +1653,10 @@ class S extends w {
1653
1653
  return r.common.async ? Promise.resolve().then(() => F(this, null, function* () {
1654
1654
  const d = [];
1655
1655
  for (const f of c) {
1656
- const _ = yield f.key, I = yield f.value;
1656
+ const _ = yield f.key, N = yield f.value;
1657
1657
  d.push({
1658
1658
  key: _,
1659
- value: I,
1659
+ value: N,
1660
1660
  alwaysSet: f.alwaysSet
1661
1661
  });
1662
1662
  }
@@ -1926,7 +1926,7 @@ Le.create = (n, e) => new Le(u({
1926
1926
  options: n,
1927
1927
  typeName: g.ZodUnion
1928
1928
  }, b(e)));
1929
- const ae = (n) => n instanceof Ue ? ae(n.schema) : n instanceof G ? ae(n.innerType()) : n instanceof ze ? [n.value] : n instanceof fe ? n.options : n instanceof We ? x.objectValues(n.enum) : n instanceof Be ? ae(n._def.innerType) : n instanceof Pe ? [void 0] : n instanceof Fe ? [null] : n instanceof ee ? [void 0, ...ae(n.unwrap())] : n instanceof he ? [null, ...ae(n.unwrap())] : n instanceof At || n instanceof He ? ae(n.unwrap()) : n instanceof qe ? ae(n._def.innerType) : [];
1929
+ const ae = (n) => n instanceof Ue ? ae(n.schema) : n instanceof G ? ae(n.innerType()) : n instanceof ze ? [n.value] : n instanceof fe ? n.options : n instanceof We ? x.objectValues(n.enum) : n instanceof Be ? ae(n._def.innerType) : n instanceof Pe ? [void 0] : n instanceof Fe ? [null] : n instanceof ee ? [void 0, ...ae(n.unwrap())] : n instanceof he ? [null, ...ae(n.unwrap())] : n instanceof Et || n instanceof He ? ae(n.unwrap()) : n instanceof qe ? ae(n._def.innerType) : [];
1930
1930
  class it extends w {
1931
1931
  _parse(e) {
1932
1932
  const { ctx: t } = this._processInputParams(e);
@@ -2291,15 +2291,15 @@ class ke extends w {
2291
2291
  });
2292
2292
  }
2293
2293
  const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2294
- if (this._def.returns instanceof Ae) {
2294
+ if (this._def.returns instanceof Ee) {
2295
2295
  const o = this;
2296
2296
  return $(function(...c) {
2297
2297
  return F(this, null, function* () {
2298
- const d = new U([]), f = yield o._def.args.parseAsync(c, a).catch((E) => {
2299
- throw d.addIssue(s(c, E)), d;
2298
+ const d = new U([]), f = yield o._def.args.parseAsync(c, a).catch((A) => {
2299
+ throw d.addIssue(s(c, A)), d;
2300
2300
  }), _ = yield Reflect.apply(i, this, f);
2301
- return yield o._def.returns._def.type.parseAsync(_, a).catch((E) => {
2302
- throw d.addIssue(r(_, E)), d;
2301
+ return yield o._def.returns._def.type.parseAsync(_, a).catch((A) => {
2302
+ throw d.addIssue(r(_, A)), d;
2303
2303
  });
2304
2304
  });
2305
2305
  });
@@ -2471,7 +2471,7 @@ We.create = (n, e) => new We(u({
2471
2471
  values: n,
2472
2472
  typeName: g.ZodNativeEnum
2473
2473
  }, b(e)));
2474
- class Ae extends w {
2474
+ class Ee extends w {
2475
2475
  unwrap() {
2476
2476
  return this._def.type;
2477
2477
  }
@@ -2490,7 +2490,7 @@ class Ae extends w {
2490
2490
  })));
2491
2491
  }
2492
2492
  }
2493
- Ae.create = (n, e) => new Ae(u({
2493
+ Ee.create = (n, e) => new Ee(u({
2494
2494
  type: n,
2495
2495
  typeName: g.ZodPromise
2496
2496
  }, b(e)));
@@ -2679,7 +2679,7 @@ at.create = (n) => new at(u({
2679
2679
  typeName: g.ZodNaN
2680
2680
  }, b(n)));
2681
2681
  const Vn = Symbol("zod_brand");
2682
- class At extends w {
2682
+ class Et extends w {
2683
2683
  _parse(e) {
2684
2684
  const { ctx: t } = this._processInputParams(e), s = t.data;
2685
2685
  return this._def.type._parse({
@@ -2763,7 +2763,7 @@ var g;
2763
2763
  })(g || (g = {}));
2764
2764
  const zn = (n, e = {
2765
2765
  message: `Input not instance of ${n.name}`
2766
- }) => Yt((t) => t instanceof n, e), Qt = H.create, en = de.create, Wn = at.create, Bn = le.create, tn = $e.create, qn = ve.create, Hn = nt.create, Jn = Pe.create, Gn = Fe.create, Kn = Se.create, Xn = ye.create, Yn = oe.create, Qn = st.create, es = J.create, ts = S.create, ns = S.strictCreate, ss = Le.create, rs = it.create, as = De.create, is = ne.create, os = Ve.create, cs = rt.create, us = _e.create, ds = ke.create, ls = Ue.create, fs = ze.create, hs = fe.create, ps = We.create, ms = Ae.create, Pt = G.create, ys = ee.create, gs = he.create, vs = G.createWithPreprocess, _s = Ge.create, bs = () => Qt().optional(), ws = () => en().optional(), xs = () => tn().optional(), ks = {
2766
+ }) => Yt((t) => t instanceof n, e), Qt = H.create, en = de.create, Wn = at.create, Bn = le.create, tn = $e.create, qn = ve.create, Hn = nt.create, Jn = Pe.create, Gn = Fe.create, Kn = Se.create, Xn = ye.create, Yn = oe.create, Qn = st.create, es = J.create, ts = S.create, ns = S.strictCreate, ss = Le.create, rs = it.create, as = De.create, is = ne.create, os = Ve.create, cs = rt.create, us = _e.create, ds = ke.create, ls = Ue.create, fs = ze.create, hs = fe.create, ps = We.create, ms = Ee.create, Pt = G.create, ys = ee.create, gs = he.create, vs = G.createWithPreprocess, _s = Ge.create, bs = () => Qt().optional(), ws = () => en().optional(), xs = () => tn().optional(), ks = {
2767
2767
  string: (n) => H.create(y(u({}, n), { coerce: !0 })),
2768
2768
  number: (n) => de.create(y(u({}, n), { coerce: !0 })),
2769
2769
  boolean: (n) => $e.create(y(u({}, n), {
@@ -2772,7 +2772,7 @@ const zn = (n, e = {
2772
2772
  bigint: (n) => le.create(y(u({}, n), { coerce: !0 })),
2773
2773
  date: (n) => ve.create(y(u({}, n), { coerce: !0 }))
2774
2774
  }, Ts = v;
2775
- var N = /* @__PURE__ */ Object.freeze({
2775
+ var I = /* @__PURE__ */ Object.freeze({
2776
2776
  __proto__: null,
2777
2777
  defaultErrorMap: Te,
2778
2778
  setErrorMap: vn,
@@ -2824,7 +2824,7 @@ var N = /* @__PURE__ */ Object.freeze({
2824
2824
  ZodLiteral: ze,
2825
2825
  ZodEnum: fe,
2826
2826
  ZodNativeEnum: We,
2827
- ZodPromise: Ae,
2827
+ ZodPromise: Ee,
2828
2828
  ZodEffects: G,
2829
2829
  ZodTransformer: G,
2830
2830
  ZodOptional: ee,
@@ -2833,7 +2833,7 @@ var N = /* @__PURE__ */ Object.freeze({
2833
2833
  ZodCatch: qe,
2834
2834
  ZodNaN: at,
2835
2835
  BRAND: Vn,
2836
- ZodBranded: At,
2836
+ ZodBranded: Et,
2837
2837
  ZodPipeline: Ge,
2838
2838
  ZodReadonly: He,
2839
2839
  custom: Yt,
@@ -2888,14 +2888,15 @@ var N = /* @__PURE__ */ Object.freeze({
2888
2888
  quotelessJson: gn,
2889
2889
  ZodError: U
2890
2890
  });
2891
- const Ss = N.object({
2892
- language: N.enum(["typescript", "javascript"]).optional()
2891
+ const Ss = I.object({
2892
+ language: I.enum(["typescript", "javascript"]).optional(),
2893
+ disableMarkedForExport: I.boolean().optional()
2893
2894
  }).and(
2894
- N.union([
2895
- N.object({
2896
- framework: N.literal("react"),
2897
- model: N.string().optional(),
2898
- styling: N.enum([
2895
+ I.union([
2896
+ I.object({
2897
+ framework: I.literal("react"),
2898
+ model: I.string().optional(),
2899
+ styling: I.enum([
2899
2900
  "plain_css",
2900
2901
  "css_modules",
2901
2902
  "styled_components",
@@ -2904,19 +2905,19 @@ const Ss = N.object({
2904
2905
  "scss",
2905
2906
  "inline_styles"
2906
2907
  ]),
2907
- uiLibrary: N.enum(["mui", "antd", "radix", "shadcn"]).optional(),
2908
- enableUILibraryTheming: N.boolean().optional(),
2909
- enableCompactStructure: N.boolean().optional(),
2910
- enableAutoSplit: N.boolean().optional(),
2911
- autoSplitThreshold: N.number().optional()
2908
+ uiLibrary: I.enum(["mui", "antd", "radix", "shadcn"]).optional(),
2909
+ enableUILibraryTheming: I.boolean().optional(),
2910
+ enableCompactStructure: I.boolean().optional(),
2911
+ enableAutoSplit: I.boolean().optional(),
2912
+ autoSplitThreshold: I.number().optional()
2912
2913
  }),
2913
- N.object({
2914
- framework: N.literal("html"),
2915
- styling: N.enum(["plain_css", "inline_styles"]),
2916
- enableTranslation: N.boolean().optional()
2914
+ I.object({
2915
+ framework: I.literal("html"),
2916
+ styling: I.enum(["plain_css", "inline_styles"]),
2917
+ enableTranslation: I.boolean().optional()
2917
2918
  })
2918
2919
  ])
2919
- ), As = (n) => {
2920
+ ), Es = (n) => {
2920
2921
  const e = Ss.safeParse(n);
2921
2922
  if (e.success === !1) {
2922
2923
  const t = new Error("Invalid codegen settings");
@@ -2948,15 +2949,16 @@ class Zr {
2948
2949
  }
2949
2950
  generateCode(s) {
2950
2951
  return F(this, arguments, function* (e, t = {}) {
2951
- var f, _, I, E, O, Z, B, se;
2952
+ var f, _, N, A, O, Z, B, se;
2952
2953
  if (this.hasAuth() === !1)
2953
2954
  throw new Error('It needs to set "auth" before calling this method.');
2954
- const r = {}, a = As(e.settings), i = yield fetch(`${K(this, Je)}/v1/codegen`, {
2955
+ const r = {}, a = Es(e.settings), i = yield fetch(`${K(this, Je)}/v1/codegen`, {
2955
2956
  method: "POST",
2956
2957
  headers: y(u({}, this.headers), {
2957
2958
  Accept: "text/event-stream"
2958
2959
  }),
2959
2960
  body: JSON.stringify({
2961
+ tracking: e.tracking,
2960
2962
  fileKey: e.fileKey,
2961
2963
  figmaToken: e.figmaToken,
2962
2964
  nodesId: e.nodesId,
@@ -2970,7 +2972,8 @@ class Zr {
2970
2972
  enableUILibraryTheming: a.enableUILibraryTheming,
2971
2973
  enableCompactStructure: a.enableCompactStructure,
2972
2974
  enableAutoSplit: a.enableAutoSplit,
2973
- autoSplitThreshold: a.autoSplitThreshold
2975
+ autoSplitThreshold: a.autoSplitThreshold,
2976
+ disableMarkedForExport: a.disableMarkedForExport
2974
2977
  })
2975
2978
  });
2976
2979
  if (!i.ok) {
@@ -3021,11 +3024,11 @@ class Zr {
3021
3024
  break;
3022
3025
  }
3023
3026
  case "pre_codegen": {
3024
- typeof t == "function" ? t(k) : (I = t.onPreCodegen) == null || I.call(t, { message: k.message });
3027
+ typeof t == "function" ? t(k) : (N = t.onPreCodegen) == null || N.call(t, { message: k.message });
3025
3028
  break;
3026
3029
  }
3027
3030
  case "assets_uploaded": {
3028
- typeof t == "function" ? t(k) : (E = t.onAssetsUploaded) == null || E.call(t);
3031
+ typeof t == "function" ? t(k) : (A = t.onAssetsUploaded) == null || A.call(t);
3029
3032
  break;
3030
3033
  }
3031
3034
  case "assets_list": {
@@ -3112,7 +3115,7 @@ const Fr = ({
3112
3115
  function r(a) {
3113
3116
  if (s.has(a) || !n[a])
3114
3117
  return;
3115
- s.add(a), t[a] = n[a], Es(n[a].content).forEach((o) => {
3118
+ s.add(a), t[a] = n[a], As(n[a].content).forEach((o) => {
3116
3119
  try {
3117
3120
  const c = Os(a, o);
3118
3121
  if (c.startsWith("src/")) {
@@ -3133,7 +3136,7 @@ const Fr = ({
3133
3136
  a.startsWith(e) ? r(a) : a.startsWith("src/") || (t[a] = i);
3134
3137
  }), t;
3135
3138
  };
3136
- function Es(n) {
3139
+ function As(n) {
3137
3140
  const e = /import.*?["']([^"']+)["']/g, t = /export.*from\s+["']([^"']+)["']/g, s = [];
3138
3141
  let r;
3139
3142
  for (; (r = e.exec(n)) !== null; )
@@ -3199,7 +3202,7 @@ var Fs = Object.defineProperty, Ls = Object.defineProperties, Ds = Object.getOwn
3199
3202
  for (var t of Ft(e))
3200
3203
  Us.call(e, t) && Dt(n, t, e[t]);
3201
3204
  return n;
3202
- }, Et = (n, e) => Ls(n, Ds(e)), Ot = (n, e, t) => e.has(n) || on("Cannot " + t), T = (n, e, t) => (Ot(n, e, "read from private field"), t ? t.call(n) : e.get(n)), W = (n, e, t) => e.has(n) ? on("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), j = (n, e, t, s) => (Ot(n, e, "write to private field"), e.set(n, t), t), Q = (n, e, t) => (Ot(n, e, "access private method"), t), A = (n, e, t) => new Promise((s, r) => {
3205
+ }, At = (n, e) => Ls(n, Ds(e)), Ot = (n, e, t) => e.has(n) || on("Cannot " + t), T = (n, e, t) => (Ot(n, e, "read from private field"), t ? t.call(n) : e.get(n)), W = (n, e, t) => e.has(n) ? on("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), j = (n, e, t, s) => (Ot(n, e, "write to private field"), e.set(n, t), t), Q = (n, e, t) => (Ot(n, e, "access private method"), t), E = (n, e, t) => new Promise((s, r) => {
3203
3206
  var a = (c) => {
3204
3207
  try {
3205
3208
  o(t.next(c));
@@ -3224,7 +3227,7 @@ function Hs() {
3224
3227
  (function(t, s) {
3225
3228
  n.exports = s();
3226
3229
  })(qs, function() {
3227
- var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", I = i && typeof Set.prototype.entries == "function", E = a && typeof Map.prototype.entries == "function", O = I && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), Z = E && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), B = f && typeof Array.prototype[Symbol.iterator] == "function", se = B && Object.getPrototypeOf([][Symbol.iterator]()), q = f && typeof String.prototype[Symbol.iterator] == "function", P = q && Object.getPrototypeOf(""[Symbol.iterator]()), ce = 8, be = -1;
3230
+ var t = typeof Promise == "function", s = typeof self == "object" ? self : Ws, r = typeof Symbol != "undefined", a = typeof Map != "undefined", i = typeof Set != "undefined", o = typeof WeakMap != "undefined", c = typeof WeakSet != "undefined", d = typeof DataView != "undefined", f = r && typeof Symbol.iterator != "undefined", _ = r && typeof Symbol.toStringTag != "undefined", N = i && typeof Set.prototype.entries == "function", A = a && typeof Map.prototype.entries == "function", O = N && Object.getPrototypeOf((/* @__PURE__ */ new Set()).entries()), Z = A && Object.getPrototypeOf((/* @__PURE__ */ new Map()).entries()), B = f && typeof Array.prototype[Symbol.iterator] == "function", se = B && Object.getPrototypeOf([][Symbol.iterator]()), q = f && typeof String.prototype[Symbol.iterator] == "function", P = q && Object.getPrototypeOf(""[Symbol.iterator]()), ce = 8, be = -1;
3228
3231
  function k(C) {
3229
3232
  var It = typeof C;
3230
3233
  if (It !== "object")
@@ -3322,7 +3325,7 @@ const Gs = /* @__PURE__ */ Bs(Js), Ct = typeof Buffer != "undefined", Ks = Ct &&
3322
3325
  return n;
3323
3326
  }
3324
3327
  );
3325
- function Ee(n) {
3328
+ function Ae(n) {
3326
3329
  return Xs(n) ? "Buffer" : Gs(n);
3327
3330
  }
3328
3331
  const Qs = /* @__PURE__ */ new Set([
@@ -3333,7 +3336,7 @@ const Qs = /* @__PURE__ */ new Set([
3333
3336
  "Set"
3334
3337
  ]);
3335
3338
  function er(n, e, t = null) {
3336
- switch (t || Ee(n)) {
3339
+ switch (t || Ae(n)) {
3337
3340
  case "Arguments":
3338
3341
  case "Array":
3339
3342
  case "Object":
@@ -3348,7 +3351,7 @@ function vt(n) {
3348
3351
  return Qs.has(n);
3349
3352
  }
3350
3353
  function Ut(n, e, t, s = null) {
3351
- switch (s || Ee(n)) {
3354
+ switch (s || Ae(n)) {
3352
3355
  case "Arguments":
3353
3356
  case "Array":
3354
3357
  case "Object":
@@ -3467,7 +3470,7 @@ function yr() {
3467
3470
  }
3468
3471
  function _t(n, e = null, t = yr) {
3469
3472
  arguments.length === 2 && typeof e == "function" && (t = e, e = null);
3470
- const s = e || Ee(n), r = mr.get(s);
3473
+ const s = e || Ae(n), r = mr.get(s);
3471
3474
  if (s === "Object") {
3472
3475
  const a = t(n, s);
3473
3476
  if (a !== void 0)
@@ -3484,14 +3487,14 @@ function Ce(n, e = {}) {
3484
3487
  customizer: t
3485
3488
  // TODO: max depth
3486
3489
  // depth = Infinity,
3487
- } = e, s = Ee(n);
3490
+ } = e, s = Ae(n);
3488
3491
  if (!vt(s))
3489
3492
  return bt(n, null, null, null);
3490
3493
  const r = _t(n, s, t), a = new WeakMap([[n, r]]), i = new WeakSet([n]);
3491
3494
  return bt(n, r, a, i);
3492
3495
  }
3493
3496
  function bt(n, e, t, s, r) {
3494
- const a = Ee(n), i = _t(n, a);
3497
+ const a = Ae(n), i = _t(n, a);
3495
3498
  if (!vt(a))
3496
3499
  return i;
3497
3500
  let o;
@@ -3513,7 +3516,7 @@ function bt(n, e, t, s, r) {
3513
3516
  if (s.has(d))
3514
3517
  Ut(e, c, t.get(d), a);
3515
3518
  else {
3516
- const f = Ee(d), _ = _t(d, f);
3519
+ const f = Ae(d), _ = _t(d, f);
3517
3520
  vt(f) && (t.set(d, _), s.add(d)), Ut(
3518
3521
  e,
3519
3522
  c,
@@ -3536,7 +3539,7 @@ class vr {
3536
3539
  W(this, wt), W(this, Ke), W(this, pe), W(this, Xe), j(this, Ke, e), j(this, Xe, t), j(this, pe, 0);
3537
3540
  }
3538
3541
  run() {
3539
- return A(this, null, function* () {
3542
+ return E(this, null, function* () {
3540
3543
  try {
3541
3544
  return yield T(this, Xe).call(this);
3542
3545
  } catch (e) {
@@ -3555,7 +3558,7 @@ function _r() {
3555
3558
  return typeof CompressionStream != "undefined";
3556
3559
  }
3557
3560
  function br(n) {
3558
- return A(this, null, function* () {
3561
+ return E(this, null, function* () {
3559
3562
  const e = new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")), t = [];
3560
3563
  try {
3561
3564
  for (var s = zs(e), r, a, i; r = !(a = yield s.next()).done; r = !1) {
@@ -3576,7 +3579,7 @@ function br(n) {
3576
3579
  });
3577
3580
  }
3578
3581
  function wr(n) {
3579
- return A(this, null, function* () {
3582
+ return E(this, null, function* () {
3580
3583
  const e = yield new Blob(n).arrayBuffer();
3581
3584
  return new Uint8Array(e);
3582
3585
  });
@@ -3641,7 +3644,7 @@ function xt() {
3641
3644
  }
3642
3645
  const Tr = 5 * 60 * 1e3, Sr = 1 * 1e3;
3643
3646
  var me, L, X, kt, Tt, Re;
3644
- class Ar {
3647
+ class Er {
3645
3648
  constructor({ fetch: e = globalThis.fetch.bind(globalThis), baseAddress: t }) {
3646
3649
  W(this, X), W(this, me), W(this, L), this.baseAddress = t, j(this, me, e), j(this, L, {}), this.plugins = [];
3647
3650
  }
@@ -3658,41 +3661,41 @@ class Ar {
3658
3661
  return j(this, L, e), this;
3659
3662
  }
3660
3663
  get(e) {
3661
- return A(this, arguments, function* (t, s = {}) {
3664
+ return E(this, arguments, function* (t, s = {}) {
3662
3665
  const { overrideBaseAddress: r, overrideDefaultHeaders: a } = s, i = r != null ? r : this.baseAddress;
3663
3666
  let o = a != null ? a : this.headers;
3664
3667
  const c = Ce(T(this, L));
3665
- return j(this, L, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = Et(V({}, o), { "X-Request-Nonce": un(), "X-Request-Timestamp": xt() })), c.async ? yield Q(this, X, Tt).call(this, `${i}${t}`, c.async, { headers: o }) : yield Q(this, X, kt).call(this, `${i}${t}`, c, { headers: o });
3668
+ return j(this, L, {}), c.extraHeaders && (o = V(V({}, o), c.extraHeaders)), c.requestValidation && (o = At(V({}, o), { "X-Request-Nonce": un(), "X-Request-Timestamp": xt() })), c.async ? yield Q(this, X, Tt).call(this, `${i}${t}`, c.async, { headers: o }) : yield Q(this, X, kt).call(this, `${i}${t}`, c, { headers: o });
3666
3669
  });
3667
3670
  }
3668
3671
  post(e, t) {
3669
- return A(this, arguments, function* (s, r, a = {}) {
3672
+ return E(this, arguments, function* (s, r, a = {}) {
3670
3673
  const i = Ce(T(this, L));
3671
3674
  return j(this, L, {}), Q(this, X, Re).call(this, s, "POST", r, a, i);
3672
3675
  });
3673
3676
  }
3674
3677
  put(e, t) {
3675
- return A(this, arguments, function* (s, r, a = {}) {
3678
+ return E(this, arguments, function* (s, r, a = {}) {
3676
3679
  const i = Ce(T(this, L));
3677
3680
  return j(this, L, {}), Q(this, X, Re).call(this, s, "PUT", r, a, i);
3678
3681
  });
3679
3682
  }
3680
3683
  delete(e, t) {
3681
- return A(this, arguments, function* (s, r, a = {}) {
3684
+ return E(this, arguments, function* (s, r, a = {}) {
3682
3685
  const i = Ce(T(this, L));
3683
3686
  return j(this, L, {}), Q(this, X, Re).call(this, s, "DELETE", r, a, i);
3684
3687
  });
3685
3688
  }
3686
3689
  patch(e, t) {
3687
- return A(this, arguments, function* (s, r, a = {}) {
3690
+ return E(this, arguments, function* (s, r, a = {}) {
3688
3691
  const i = Ce(T(this, L));
3689
3692
  return j(this, L, {}), Q(this, X, Re).call(this, s, "PATCH", r, a, i);
3690
3693
  });
3691
3694
  }
3692
3695
  }
3693
3696
  me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakSet(), kt = function(n, e, t) {
3694
- return A(this, null, function* () {
3695
- const s = () => A(this, null, function* () {
3697
+ return E(this, null, function* () {
3698
+ const s = () => E(this, null, function* () {
3696
3699
  var c, d;
3697
3700
  try {
3698
3701
  return yield T(this, me).call(this, n, V(V({}, t), e.abortSignal && { signal: e.abortSignal }));
@@ -3702,7 +3705,7 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
3702
3705
  }), { headers: r } = t != null ? t : {}, a = (c, d) => {
3703
3706
  var f, _;
3704
3707
  return ((f = c == null ? void 0 : c.headers) == null ? void 0 : f.get(d)) || ((_ = c == null ? void 0 : c.headersObject) == null ? void 0 : _[d]) || "";
3705
- }, i = (c) => A(this, null, function* () {
3708
+ }, i = (c) => E(this, null, function* () {
3706
3709
  var d;
3707
3710
  if (!c.ok) {
3708
3711
  const _ = yield c.text().catch();
@@ -3717,15 +3720,15 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
3717
3720
  }
3718
3721
  if (e.requestValidation && process.env.UI_TESTS !== !0)
3719
3722
  try {
3720
- const _ = a(c, "x-response-nonce"), I = r == null ? void 0 : r["X-Request-Nonce"];
3721
- if (!_ || _ !== I)
3723
+ const _ = a(c, "x-response-nonce"), N = r == null ? void 0 : r["X-Request-Nonce"];
3724
+ if (!_ || _ !== N)
3722
3725
  throw new lt("Response nonce mismatch");
3723
- const E = Number(a(c, "x-response-timestamp")), O = Number(xt()), Z = 60 * 60 * 24;
3724
- if (isNaN(E) || Math.abs(O - E) > Z)
3726
+ const A = Number(a(c, "x-response-timestamp")), O = Number(xt()), Z = 60 * 60 * 24;
3727
+ if (isNaN(A) || Math.abs(O - A) > Z)
3725
3728
  throw new lt("Invalid response timestamp");
3726
3729
  } catch (_) {
3727
- const I = _ instanceof Error ? _.message : "Request validation failed";
3728
- throw new lt(I);
3730
+ const N = _ instanceof Error ? _.message : "Request validation failed";
3731
+ throw new lt(N);
3729
3732
  }
3730
3733
  let f = yield c.text();
3731
3734
  try {
@@ -3745,7 +3748,7 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
3745
3748
  return yield i(o);
3746
3749
  });
3747
3750
  }, Tt = function(n, e, t) {
3748
- return A(this, null, function* () {
3751
+ return E(this, null, function* () {
3749
3752
  var s, r;
3750
3753
  const {
3751
3754
  onProgress: a,
@@ -3770,15 +3773,15 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
3770
3773
  body: O
3771
3774
  });
3772
3775
  }
3773
- const I = yield _.json(), { job_id: E } = I;
3774
- if (!E)
3776
+ const N = yield _.json(), { job_id: A } = N;
3777
+ if (!A)
3775
3778
  throw new Error("Job ID not found in response");
3776
- return new Promise((O, Z) => A(this, null, function* () {
3779
+ return new Promise((O, Z) => E(this, null, function* () {
3777
3780
  const B = setTimeout(() => {
3778
3781
  Z(new Error("Job timed out"));
3779
- }, c), se = (q = 0) => A(this, null, function* () {
3782
+ }, c), se = (q = 0) => E(this, null, function* () {
3780
3783
  if (i != null && i.aborted) {
3781
- clearTimeout(B), T(this, me).call(this, `${f}/${E}/cancel`, { method: "POST", headers: this.headers }).then(() => {
3784
+ clearTimeout(B), T(this, me).call(this, `${f}/${A}/cancel`, { method: "POST", headers: this.headers }).then(() => {
3782
3785
  Z(new je({ canceled: !0 }));
3783
3786
  }).catch((P) => {
3784
3787
  Z(new je({ canceled: !1 }));
@@ -3786,7 +3789,7 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
3786
3789
  return;
3787
3790
  }
3788
3791
  try {
3789
- const P = yield (yield T(this, me).call(this, `${f}/${E}`, { headers: this.headers })).json();
3792
+ const P = yield (yield T(this, me).call(this, `${f}/${A}`, { headers: this.headers })).json();
3790
3793
  if (P.status === "success") {
3791
3794
  clearTimeout(B);
3792
3795
  const ce = P.response_json;
@@ -3806,10 +3809,10 @@ me = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), X = /* @_
3806
3809
  }));
3807
3810
  });
3808
3811
  }, Re = function(n, e, t, s, r) {
3809
- return A(this, null, function* () {
3812
+ return E(this, null, function* () {
3810
3813
  const { overrideBaseAddress: a, overrideDefaultHeaders: i } = s, o = a != null ? a : this.baseAddress;
3811
3814
  let c = i != null ? i : this.headers;
3812
- r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = Et(V({}, c), { "X-Request-Nonce": un(), "X-Request-Timestamp": xt() }));
3815
+ r.extraHeaders && (c = V(V({}, c), r.extraHeaders)), r.requestValidation && (c = At(V({}, c), { "X-Request-Nonce": un(), "X-Request-Timestamp": xt() }));
3813
3816
  let d = s.skipBodyJsonStringify ? t : JSON.stringify(t);
3814
3817
  return r.compress && _r() && (c["Content-Encoding"] = "gzip", d = yield br(d)), r.async ? yield Q(this, X, Tt).call(this, `${o}${n}`, r.async, {
3815
3818
  method: e,
@@ -3840,12 +3843,12 @@ const Bt = (n, e, t, s) => n instanceof je ? n : new xr({ resource: e, api: Stri
3840
3843
  }
3841
3844
  });
3842
3845
  var Ze;
3843
- class Er {
3846
+ class Ar {
3844
3847
  constructor(e) {
3845
3848
  W(this, Ze), this.resourceName = "Files", j(this, Ze, e);
3846
3849
  }
3847
3850
  get(e) {
3848
- return A(this, arguments, function* ({ fileKey: t, params: s = {} }) {
3851
+ return E(this, arguments, function* ({ fileKey: t, params: s = {} }) {
3849
3852
  const r = new URLSearchParams(V({
3850
3853
  plugin_data: "857346721138427857"
3851
3854
  }, s)).toString(), a = `v1/files/${t}?${r}`;
@@ -3853,7 +3856,7 @@ class Er {
3853
3856
  });
3854
3857
  }
3855
3858
  getImageFills(e) {
3856
- return A(this, arguments, function* ({ fileKey: t }) {
3859
+ return E(this, arguments, function* ({ fileKey: t }) {
3857
3860
  var s, r;
3858
3861
  const a = `v1/files/${t}/images`;
3859
3862
  return (r = (s = (yield T(this, Ze).get(a)).meta) == null ? void 0 : s.images) != null ? r : {};
@@ -3875,7 +3878,7 @@ class Ir {
3875
3878
  * Note: Use the `file.images` API to get the _source_ images used on the node fills, which has better quality.
3876
3879
  */
3877
3880
  get(e) {
3878
- return A(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
3881
+ return E(this, arguments, function* ({ fileKey: t, nodeIds: s, format: r = "jpg", scale: a }) {
3879
3882
  const i = Or(t, s, r), o = T(this, Y).cache.images.entries.get(i);
3880
3883
  if (Cr(o))
3881
3884
  return o.result;
@@ -3894,7 +3897,7 @@ class Ir {
3894
3897
  }
3895
3898
  }
3896
3899
  Y = /* @__PURE__ */ new WeakMap(), St = /* @__PURE__ */ new WeakSet(), dn = function(n, e, t, s, r) {
3897
- return A(this, null, function* () {
3900
+ return E(this, null, function* () {
3898
3901
  const a = yield T(this, Y).get(
3899
3902
  `v1/images/${e}?ids=${t}&format=${s}${r ? `&scale=${r}` : ""}`
3900
3903
  );
@@ -3910,8 +3913,8 @@ class Nr {
3910
3913
  W(this, Ye), this.resourceName = "Nodes", j(this, Ye, e);
3911
3914
  }
3912
3915
  get(e) {
3913
- return A(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
3914
- const a = Et(V({}, r), {
3916
+ return E(this, arguments, function* ({ fileKey: t, nodeIds: s, params: r = {} }) {
3917
+ const a = At(V({}, r), {
3915
3918
  ids: s.join(",")
3916
3919
  }), i = new URLSearchParams(V({
3917
3920
  plugin_data: "857346721138427857"
@@ -3922,7 +3925,7 @@ class Nr {
3922
3925
  }
3923
3926
  Ye = /* @__PURE__ */ new WeakMap();
3924
3927
  var ue;
3925
- class ln extends Ar {
3928
+ class ln extends Er {
3926
3929
  constructor({
3927
3930
  baseAddress: e = "https://api.figma.com/",
3928
3931
  fetch: t = globalThis.fetch.bind(globalThis)
@@ -3932,7 +3935,7 @@ class ln extends Ar {
3932
3935
  entries: /* @__PURE__ */ new Map(),
3933
3936
  pendingRequests: /* @__PURE__ */ new Map()
3934
3937
  }
3935
- }, this.files = ft(this, new Er(this)), this.nodes = ft(this, new Nr(this)), this.images = ft(this, new Ir(this));
3938
+ }, this.files = ft(this, new Ar(this)), this.nodes = ft(this, new Nr(this)), this.images = ft(this, new Ir(this));
3936
3939
  }
3937
3940
  set token(e) {
3938
3941
  if (!e.startsWith("figd_") && !e.startsWith("figu_"))
@@ -4008,11 +4011,11 @@ const Vr = (r) => F(void 0, [r], function* ({
4008
4011
  });
4009
4012
  }
4010
4013
  }), zr = (n, e) => F(void 0, null, function* () {
4011
- var c, d, f, _, I, E, O;
4014
+ var c, d, f, _, N, A, O;
4012
4015
  const t = jr(n, e), [s, r] = t.tee(), a = yield s.getReader().read();
4013
4016
  if (a.done || !a.value || ((c = a.value) == null ? void 0 : c.type) === "error" && ((f = (d = a.value) == null ? void 0 : d.payload) != null && f.status))
4014
4017
  return new Response(JSON.stringify(a.value), {
4015
- status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (E = (I = a.value) == null ? void 0 : I.payload) == null ? void 0 : E.status) != null ? O : 500,
4018
+ status: ((_ = a.value) == null ? void 0 : _.type) === "error" && (O = (A = (N = a.value) == null ? void 0 : N.payload) == null ? void 0 : A.status) != null ? O : 500,
4016
4019
  headers: {
4017
4020
  "Content-Type": "application/json"
4018
4021
  }
@@ -4060,6 +4063,6 @@ export {
4060
4063
  Ms as isRateLimitExceeded,
4061
4064
  Lr as isUnknownFigmaApiException,
4062
4065
  Mr as isValidFigmaUrl,
4063
- As as validateSettings
4066
+ Es as validateSettings
4064
4067
  };
4065
4068
  //# sourceMappingURL=index.js.map