@animaapp/anima-sdk-react 0.6.12-beta.0 → 0.6.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +262 -262
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var ra=Object.defineProperty,aa=Object.defineProperties;var ia=Object.getOwnPropertyDescriptors;var Us=Object.getOwnPropertySymbols;var oa=Object.prototype.hasOwnProperty,ca=Object.prototype.propertyIsEnumerable;var Vs=(t,e,n)=>e in t?ra(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Be=(t,e)=>{for(var n in e||(e={}))oa.call(e,n)&&Vs(t,n,e[n]);if(Us)for(var n of Us(e))ca.call(e,n)&&Vs(t,n,e[n]);return t},zs=(t,e)=>aa(t,ia(e));var Ie=(t,e,n)=>new Promise((s,r)=>{var a=c=>{try{o(n.next(c))}catch(u){r(u)}},i=c=>{try{o(n.throw(c))}catch(u){r(u)}},o=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,i);o((n=n.apply(t,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("react"),ua=t=>{let e="";const n=new Uint8Array(t),s=n.byteLength;for(let r=0;r<s;r++)e+=String.fromCharCode(n[r]);return btoa(e)};var da=Object.defineProperty,la=Object.defineProperties,fa=Object.getOwnPropertyDescriptors,Ks=Object.getOwnPropertySymbols,ha=Object.prototype.hasOwnProperty,pa=Object.prototype.propertyIsEnumerable,Bs=(t,e,n)=>e in t?da(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e)=>{for(var n in e||(e={}))ha.call(e,n)&&Bs(t,n,e[n]);if(Ks)for(var n of Ks(e))pa.call(e,n)&&Bs(t,n,e[n]);return t},x=(t,e)=>la(t,fa(e)),Ee=(t,e,n)=>new Promise((s,r)=>{var a=c=>{try{o(n.next(c))}catch(u){r(u)}},i=c=>{try{o(n.throw(c))}catch(u){r(u)}},o=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,i);o((n=n.apply(t,e)).next())});class qs extends Error{constructor({name:e,reason:n,status:s,detail:r}){super(),this.name=e,this.message=n,this.detail=r,this.status=s}}const ma="Figma Token Issue";class ya extends Error{constructor({fileKey:e,reason:n,cause:s}){super(ma),this.fileKey=e,this.reason=n,this.cause=s}}const ga="Rate Limit Exceeded";class va extends Error{constructor({fileKey:e,cause:n}){super(ga),this.fileKey=e,this.cause=n}}const _a="Request Too Large";class ba extends Error{constructor({fileKey:e,cause:n}){super(_a),this.fileKey=e,this.cause=n}}const wa="Not Found";class ka extends Error{constructor({fileKey:e,cause:n}){super(wa),this.fileKey=e,this.cause=n}}const Ea="Unknown Figma API Exception";class xa extends Error{constructor({fileKey:e,cause:n}){super(Ea),this.name="UnknownFigmaApiException",this.fileKey=e,this.cause=n}}const Sa=(t,e)=>{var n;if(((n=t==null?void 0:t.cause)==null?void 0:n.message)==="Fetch Error"){const{err:s,status:r}=t.cause.body;if(r===403)return new ya({fileKey:e,reason:s,cause:t});if(r===429)return new va({fileKey:e,cause:t});if(r===404)return new ka({fileKey:e,cause:t});if(r===400&&s.includes("Request too large"))return new ba({fileKey:e,cause:t})}return new xa({fileKey:e,cause:t})};var Oa=Object.defineProperty,Ta=Object.defineProperties,Aa=Object.getOwnPropertyDescriptors,Hs=Object.getOwnPropertySymbols,Ca=Object.prototype.hasOwnProperty,Ra=Object.prototype.propertyIsEnumerable,Gs=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Sr=t=>{throw TypeError(t)},Js=(t,e,n)=>e in t?Oa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ie=(t,e)=>{for(var n in e||(e={}))Ca.call(e,n)&&Js(t,n,e[n]);if(Hs)for(var n of Hs(e))Ra.call(e,n)&&Js(t,n,e[n]);return t},Ss=(t,e)=>Ta(t,Aa(e)),Os=(t,e,n)=>e.has(t)||Sr("Cannot "+n),Z=(t,e,n)=>(Os(t,e,"read from private field"),n?n.call(t):e.get(t)),le=(t,e,n)=>e.has(t)?Sr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),X=(t,e,n,s)=>(Os(t,e,"write to private field"),e.set(t,n),n),be=(t,e,n)=>(Os(t,e,"access private method"),n),q=(t,e,n)=>new Promise((s,r)=>{var a=c=>{try{o(n.next(c))}catch(u){r(u)}},i=c=>{try{o(n.throw(c))}catch(u){r(u)}},o=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,i);o((n=n.apply(t,e)).next())}),Na=(t,e,n)=>(e=t[Gs("asyncIterator")])?e.call(t):(t=t[Gs("iterator")](),e={},n=(s,r)=>(r=t[s])&&(e[s]=a=>new Promise((i,o,c)=>(a=r.call(t,a),c=a.done,Promise.resolve(a.value).then(u=>i({value:u,done:c}),o)))),n("next"),n("return"),e),Pa=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function ja(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var zn={exports:{}},Ia=zn.exports,Xs;function Za(){return Xs||(Xs=1,function(t,e){(function(n,s){t.exports=s()})(Ia,function(){var n=typeof Promise=="function",s=typeof self=="object"?self:Pa,r=typeof Symbol!="undefined",a=typeof Map!="undefined",i=typeof Set!="undefined",o=typeof WeakMap!="undefined",c=typeof WeakSet!="undefined",u=typeof DataView!="undefined",h=r&&typeof Symbol.iterator!="undefined",p=r&&typeof Symbol.toStringTag!="undefined",k=i&&typeof Set.prototype.entries=="function",g=a&&typeof Map.prototype.entries=="function",b=k&&Object.getPrototypeOf(new Set().entries()),m=g&&Object.getPrototypeOf(new Map().entries()),_=h&&typeof Array.prototype[Symbol.iterator]=="function",l=_&&Object.getPrototypeOf([][Symbol.iterator]()),C=h&&typeof String.prototype[Symbol.iterator]=="function",j=C&&Object.getPrototypeOf(""[Symbol.iterator]()),z=8,M=-1;function K(D){var P=typeof D;if(P!=="object")return P;if(D===null)return"null";if(D===s)return"global";if(Array.isArray(D)&&(p===!1||!(Symbol.toStringTag in D)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&D===window.location)return"Location";if(typeof window.document=="object"&&D===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&D===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&D===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&D instanceof window.HTMLElement){if(D.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(D.tagName==="TD")return"HTMLTableDataCellElement";if(D.tagName==="TH")return"HTMLTableHeaderCellElement"}}var Oe=p&&D[Symbol.toStringTag];if(typeof Oe=="string")return Oe;var F=Object.getPrototypeOf(D);return F===RegExp.prototype?"RegExp":F===Date.prototype?"Date":n&&F===Promise.prototype?"Promise":i&&F===Set.prototype?"Set":a&&F===Map.prototype?"Map":c&&F===WeakSet.prototype?"WeakSet":o&&F===WeakMap.prototype?"WeakMap":u&&F===DataView.prototype?"DataView":a&&F===m?"Map Iterator":i&&F===b?"Set Iterator":_&&F===l?"Array Iterator":C&&F===j?"String Iterator":F===null?"Object":Object.prototype.toString.call(D).slice(z,M)}return K})}(zn)),zn.exports}var Da=Za();const Ma=ja(Da),Ts=typeof Buffer!="undefined",La=Ts&&typeof Buffer.from!="undefined",$a=Ts?function(t){return Buffer.isBuffer(t)}:function(){return!1},Fa=La?function(t){return Buffer.from(t)}:Ts?function(t){return new Buffer(t)}:function(t){return t};function mt(t){return $a(t)?"Buffer":Ma(t)}const Wa=new Set(["Arguments","Array","Map","Object","Set"]);function Ua(t,e,n=null){switch(n||mt(t)){case"Arguments":case"Array":case"Object":return t[e];case"Map":return t.get(e);case"Set":return e}}function Kn(t){return Wa.has(t)}function Ys(t,e,n,s=null){switch(s||mt(t)){case"Arguments":case"Array":case"Object":t[e]=n;break;case"Map":t.set(e,n);break;case"Set":t.add(n);break}return t}const Va=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,za=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,Ka=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,Cn=Va||za||Ka||Function("return this")();function Ba(t){return t.slice(0)}function qa(t){return new Boolean(t.valueOf())}function Ha(t){return new DataView(t.buffer)}function Ga(t){return Fa(t)}function Ja(t){return new Date(t.getTime())}function Xa(t){return new Number(t)}function Ya(t){return new RegExp(t.source,t.flags)}function Qa(t){return new String(t)}function Ce(t,e){return Cn[e].from?Cn[e].from(t):new Cn[e](t)}function ee(t){return t}function Qs(){return[]}function ei(){return new Map}function ti(){return{}}function ni(){return new Set}const si=new Map([["ArrayBuffer",Ba],["Boolean",qa],["Buffer",Ga],["DataView",Ha],["Date",Ja],["Number",Xa],["RegExp",Ya],["String",Qa],["Float32Array",Ce],["Float64Array",Ce],["Int16Array",Ce],["Int32Array",Ce],["Int8Array",Ce],["Uint16Array",Ce],["Uint32Array",Ce],["Uint8Array",Ce],["Uint8ClampedArray",Ce],["Array Iterator",ee],["Map Iterator",ee],["Promise",ee],["Set Iterator",ee],["String Iterator",ee],["function",ee],["global",ee],["WeakMap",ee],["WeakSet",ee],["boolean",ee],["null",ee],["number",ee],["string",ee],["symbol",ee],["undefined",ee],["Arguments",Qs],["Array",Qs],["Map",ei],["Object",ti],["Set",ni]]);function ri(){}function Bn(t,e=null,n=ri){arguments.length===2&&typeof e=="function"&&(n=e,e=null);const s=e||mt(t),r=si.get(s);if(s==="Object"){const a=n(t,s);if(a!==void 0)return a}return r?r(t,s):t}function kt(t,e={}){typeof e=="function"&&(e={customizer:e});const{customizer:n}=e,s=mt(t);if(!Kn(s))return qn(t,null,null,null);const r=Bn(t,s,n),a=new WeakMap([[t,r]]),i=new WeakSet([t]);return qn(t,r,a,i)}function qn(t,e,n,s,r){const a=mt(t),i=Bn(t,a);if(!Kn(a))return i;let o;switch(a){case"Arguments":case"Array":o=Object.keys(t);break;case"Object":o=Object.keys(t),o.push(...Object.getOwnPropertySymbols(t));break;case"Map":case"Set":o=t.keys();break}for(let c of o){const u=Ua(t,c,a);if(s.has(u))Ys(e,c,n.get(u),a);else{const h=mt(u),p=Bn(u,h);Kn(h)&&(n.set(u,p),s.add(u)),Ys(e,c,qn(u,p,n,s),a)}}return e}const ai=t=>new Promise(e=>setTimeout(e,t));var sn,He,rn,Hn,Or;class ii{constructor({maxAttempts:e=3,func:n}){le(this,Hn),le(this,sn),le(this,He),le(this,rn),X(this,sn,e),X(this,rn,n),X(this,He,0)}run(){return q(this,null,function*(){try{return yield Z(this,rn).call(this)}catch(e){if(X(this,He,Z(this,He)+1),Z(this,He)>Z(this,sn))throw console.error("Max attempts reached"),e;const n=be(this,Hn,Or).call(this);return yield ai(n),yield this.run()}})}}sn=new WeakMap,He=new WeakMap,rn=new WeakMap,Hn=new WeakSet,Or=function(){return Z(this,He)*1e3*1.5};function oi(){return typeof CompressionStream!="undefined"}function ci(t){return q(this,null,function*(){const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=[];try{for(var s=Na(e),r,a,i;r=!(a=yield s.next()).done;r=!1){const o=a.value;n.push(o)}}catch(o){i=[o]}finally{try{r&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i[0]}}return yield ui(n)})}function ui(t){return q(this,null,function*(){const e=yield new Blob(t).arrayBuffer();return new Uint8Array(e)})}class di extends Error{constructor({resource:e,api:n,args:s,cause:r}){if(super(`API Error on resource "${e}" at api "${n}"`),this.causeProperties={},this.name="API Error",this.resource=e,this.api=n,this.cause=r,this.args=s,r instanceof Error)for(const[i,o]of Object.entries(r))if(typeof Headers!="undefined"&&o instanceof Headers){const c={};o.forEach((u,h)=>{c[h]=u}),this.causeProperties[i]=c}else this.causeProperties[i]=o;const a=this.causeProperties.body;a&&typeof a=="object"&&"code"in a&&(this.code=a.code)}}class er extends Error{constructor({url:e,method:n,statusCode:s,requestHeaders:r,responseHeaders:a,body:i}){if(super("Fetch Error"),this.name="Fetch Error",this.url=e,this.method=n,this.statusNumber=s,this.requestHeaders=r,this.responseHeaders=a,i)try{const o=JSON.parse(i);this.body=o}catch(o){this.body=i}}}class Et extends Error{constructor(e={}){const{canceled:n=!1}=e;super("Abort Error"),this.name="Abort Error",this.canceled=n}}class li extends Error{constructor(e){super(`Async API Error: ${JSON.stringify(e)}`),this.name="Async API Error",this.body=e}}class Rn extends Error{constructor(e){super(e),this.name="Request Validation Error"}}function Tr(){return Array.from({length:32},()=>Math.floor(Math.random()*256).toString(16).padStart(2,"0")).join("")}function Gn(){return Math.floor(Date.now()/1e3).toString()}const fi=5*60*1e3,hi=1*1e3;var Ge,se,ve,Jn,Xn,xt;class pi{constructor({fetch:e=globalThis.fetch.bind(globalThis),baseAddress:n}){le(this,ve),le(this,Ge),le(this,se),this.baseAddress=n,X(this,Ge,e),X(this,se,{}),this.plugins=[]}get headers(){throw new Error("Missing implementation")}addPlugin(e){this.plugins.push(e)}removePlugin(e){this.plugins=this.plugins.filter(n=>n.name!==e)}withOptions(e={}){return X(this,se,e),this}get(e){return q(this,arguments,function*(n,s={}){const{overrideBaseAddress:r,overrideDefaultHeaders:a}=s,i=r!=null?r:this.baseAddress;let o=a!=null?a:this.headers;const c=kt(Z(this,se));return X(this,se,{}),c.extraHeaders&&(o=ie(ie({},o),c.extraHeaders)),c.requestValidation&&(o=Ss(ie({},o),{"X-Request-Nonce":Tr(),"X-Request-Timestamp":Gn()})),c.async?yield be(this,ve,Xn).call(this,`${i}${n}`,c.async,{headers:o}):yield be(this,ve,Jn).call(this,`${i}${n}`,c,{headers:o})})}post(e,n){return q(this,arguments,function*(s,r,a={}){const i=kt(Z(this,se));return X(this,se,{}),be(this,ve,xt).call(this,s,"POST",r,a,i)})}put(e,n){return q(this,arguments,function*(s,r,a={}){const i=kt(Z(this,se));return X(this,se,{}),be(this,ve,xt).call(this,s,"PUT",r,a,i)})}delete(e,n){return q(this,arguments,function*(s,r,a={}){const i=kt(Z(this,se));return X(this,se,{}),be(this,ve,xt).call(this,s,"DELETE",r,a,i)})}patch(e,n){return q(this,arguments,function*(s,r,a={}){const i=kt(Z(this,se));return X(this,se,{}),be(this,ve,xt).call(this,s,"PATCH",r,a,i)})}}Ge=new WeakMap,se=new WeakMap,ve=new WeakSet,Jn=function(t,e,n){return q(this,null,function*(){const s=()=>q(this,null,function*(){var c,u;try{return yield Z(this,Ge).call(this,t,ie(ie({},n),e.abortSignal&&{signal:e.abortSignal}))}catch(h){throw h instanceof Error&&h.name==="AbortError"?new Et({canceled:(u=(c=e.abortSignal)==null?void 0:c.aborted)!=null?u:!1}):h}}),{headers:r}=n!=null?n:{},a=(c,u)=>{var h,p;return((h=c==null?void 0:c.headers)==null?void 0:h.get(u))||((p=c==null?void 0:c.headersObject)==null?void 0:p[u])||""},i=c=>q(this,null,function*(){var u;if(!c.ok){const p=yield c.text().catch();throw new er({url:t,method:(u=n==null?void 0:n.method)!=null?u:"GET",statusCode:c.status,requestHeaders:r,responseHeaders:c.headers,body:p})}if(e.requestValidation&&process.env.UI_TESTS!==!0)try{const p=a(c,"x-response-nonce"),k=r==null?void 0:r["X-Request-Nonce"];if(!p||p!==k)throw new Rn("Response nonce mismatch");const g=Number(a(c,"x-response-timestamp")),b=Number(Gn()),m=60*60*24;if(isNaN(g)||Math.abs(b-g)>m)throw new Rn("Invalid response timestamp")}catch(p){const k=p instanceof Error?p.message:"Request validation failed";throw new Rn(k)}let h=yield c.text();try{h=JSON.parse(h)}catch(p){}return h});if(e.retry){const c=yield new ii({maxAttempts:e.retry,func:s}).run();return yield i(c)}const o=yield s();return yield i(o)})},Xn=function(t,e,n){return q(this,null,function*(){var s,r;const{onProgress:a,abortSignal:i,pollingInterval:o=()=>hi,maxTimeout:c=fi}=e,u=`${t}/async`,h=`${t}/async/job`;let p;try{p=yield Z(this,Ge).call(this,u,ie(ie({},n),i&&{signal:i}))}catch(b){throw b instanceof Error&&b.name==="AbortError"?new Et({canceled:(s=i==null?void 0:i.aborted)!=null?s:!1}):b}if(!p.ok){const b=yield p.text().catch();throw new er({url:t,method:(r=n==null?void 0:n.method)!=null?r:"GET",statusCode:p.status,requestHeaders:this.headers,responseHeaders:p.headers,body:b})}const k=yield p.json(),{job_id:g}=k;if(!g)throw new Error("Job ID not found in response");return new Promise((b,m)=>q(this,null,function*(){const _=setTimeout(()=>{m(new Error("Job timed out"))},c),l=(C=0)=>q(this,null,function*(){if(i!=null&&i.aborted){clearTimeout(_),Z(this,Ge).call(this,`${h}/${g}/cancel`,{method:"POST",headers:this.headers}).then(()=>{m(new Et({canceled:!0}))}).catch(j=>{m(new Et({canceled:!1}))});return}try{const j=yield(yield Z(this,Ge).call(this,`${h}/${g}`,{headers:this.headers})).json();if(j.status==="success"){clearTimeout(_);const z=j.response_json;b(z)}else if(j.status==="failed")clearTimeout(_),m(new li(j.response_json));else{a&&a(j.response_json);const z=o(C);setTimeout(()=>l(C+1),z)}}catch(j){m(j)}});l()}))})},xt=function(t,e,n,s,r){return q(this,null,function*(){const{overrideBaseAddress:a,overrideDefaultHeaders:i}=s,o=a!=null?a:this.baseAddress;let c=i!=null?i:this.headers;r.extraHeaders&&(c=ie(ie({},c),r.extraHeaders)),r.requestValidation&&(c=Ss(ie({},c),{"X-Request-Nonce":Tr(),"X-Request-Timestamp":Gn()}));let u=n;return typeof FormData!="undefined"&&n instanceof FormData?delete c["Content-Type"]:(u=s.skipBodyJsonStringify?n:JSON.stringify(n),r.compress&&oi()&&(c["Content-Encoding"]="gzip",u=yield ci(u))),r.async?yield be(this,ve,Xn).call(this,`${o}${t}`,r.async,{method:e,headers:c,body:u}):yield be(this,ve,Jn).call(this,`${o}${t}`,r,{method:e,headers:c,body:u})})};const tr=(t,e,n,s)=>t instanceof Et?t:new di({resource:e,api:String(n),args:s,cause:t}),Nn=(t,e)=>new Proxy(e,{get(n,s){return(...r)=>{var a;for(const o of t.plugins){const c=(a=o.beforeApi)==null?void 0:a.call(o,{resource:n.resourceName,api:s,args:r});if(c!==void 0)return c}let i;try{i=n[s](...r)}catch(o){throw tr(o,n.resourceName,s,r)}return i instanceof Promise?i.catch(o=>{throw tr(o,n.resourceName,s,r)}):i}}});var St;class mi{constructor(e){le(this,St),this.resourceName="Files",X(this,St,e)}get(e){return q(this,arguments,function*({fileKey:n,params:s={}}){const r=new URLSearchParams(ie({plugin_data:"857346721138427857"},s)).toString(),a=`v1/files/${n}?${r}`;return yield Z(this,St).get(a)})}getImageFills(e){return q(this,arguments,function*({fileKey:n}){var s,r;const a=`v1/files/${n}/images`;return(r=(s=(yield Z(this,St).get(a)).meta)==null?void 0:s.images)!=null?r:{}})}}St=new WeakMap;const yi=(t,e,n)=>{const s=e.sort();return`${t}-${s.join("-")}-${n}`},gi=t=>t?t.ts>Date.now()-1e3*30:!1;var _e,Yn,Ar;class vi{constructor(e){le(this,Yn),le(this,_e),this.resourceName="Images",X(this,_e,e)}get(e){return q(this,arguments,function*({fileKey:n,nodeIds:s,format:r="jpg",scale:a}){const i=yi(n,s,r),o=Z(this,_e).cache.images.entries.get(i);if(gi(o))return o.result;o&&Z(this,_e).cache.images.entries.delete(i);const c=Z(this,_e).cache.images.pendingRequests.get(i);if(c)return c;const u=be(this,Yn,Ar).call(this,i,n,s,r,a);Z(this,_e).cache.images.pendingRequests.set(i,u);try{return yield u}finally{Z(this,_e).cache.images.pendingRequests.delete(i)}})}}_e=new WeakMap,Yn=new WeakSet,Ar=function(t,e,n,s,r){return q(this,null,function*(){const a=yield Z(this,_e).get(`v1/images/${e}?ids=${n}&format=${s}${r?`&scale=${r}`:""}`);return Z(this,_e).cache.images.entries.set(t,{result:a,ts:Date.now()}),a})};var an;class _i{constructor(e){le(this,an),this.resourceName="Nodes",X(this,an,e)}get(e){return q(this,arguments,function*({fileKey:n,nodeIds:s,params:r={}}){const a=Ss(ie({},r),{ids:s.join(",")}),i=new URLSearchParams(ie({plugin_data:"857346721138427857"},a)).toString(),o=`v1/files/${n}/nodes?${i}`;return yield Z(this,an).get(o)})}}an=new WeakMap;var Ze;class bi extends pi{constructor({baseAddress:e="https://api.figma.com/",fetch:n=globalThis.fetch.bind(globalThis)}={}){super({fetch:n,baseAddress:e}),le(this,Ze,""),this.cache={images:{entries:new Map,pendingRequests:new Map}},this.files=Nn(this,new mi(this)),this.nodes=Nn(this,new _i(this)),this.images=Nn(this,new vi(this))}set token(e){if(!e.startsWith("figd_")&&!e.startsWith("figu_"))throw new Error("Invalid Figma access token");X(this,Ze,e)}get token(){return Z(this,Ze)}get headers(){const e={"Content-Type":"application/json"};return Z(this,Ze).startsWith("figd_")?e["X-FIGMA-TOKEN"]=Z(this,Ze):Z(this,Ze).startsWith("figu_")&&(e.Authorization=`Bearer ${Z(this,Ze)}`),e}}Ze=new WeakMap;const wi=t=>Ee(void 0,[t],function*({fileKey:e,authToken:n,figmaRestApi:s=new bi,params:r={},signal:a}){n&&(s.token=n);try{return yield s.withOptions({abortSignal:a}).files.get({fileKey:e,params:r})}catch(i){throw i instanceof Error&&i.name==="AbortError"?i:(console.error(i),Sa(i,e))}});var R;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{const a={};for(const i of r)a[i]=i;return a},t.getValidEnumValues=r=>{const a=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of a)i[o]=r[o];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(a){return r[a]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&a.push(i);return a},t.find=(r,a)=>{for(const i of r)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function s(r,a=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=s,t.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(R||(R={}));var Qn;(function(t){t.mergeShapes=(e,n)=>d(d({},e),n)})(Qn||(Qn={}));const v=R.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ne=t=>{switch(typeof t){case"undefined":return v.undefined;case"string":return v.string;case"number":return isNaN(t)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(t)?v.array:t===null?v.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?v.promise:typeof Map!="undefined"&&t instanceof Map?v.map:typeof Set!="undefined"&&t instanceof Set?v.set:typeof Date!="undefined"&&t instanceof Date?v.date:v.object;default:return v.unknown}},f=R.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ki=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class oe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},s={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(n(i));else{let o=s,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return r(this),s}static assert(e){if(!(e instanceof oe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,R.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},s=[];for(const r of this.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(e(r))):s.push(e(r));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}oe.create=t=>new oe(t);const yt=(t,e)=>{let n;switch(t.code){case f.invalid_type:t.received===v.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,R.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${R.joinValues(t.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${R.joinValues(t.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${R.joinValues(t.options)}, received '${t.received}'`;break;case f.invalid_arguments:n="Invalid function arguments";break;case f.invalid_return_type:n="Invalid function return type";break;case f.invalid_date:n="Invalid date";break;case f.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:R.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case f.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case f.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case f.custom:n="Invalid input";break;case f.invalid_intersection_types:n="Intersection results could not be merged";break;case f.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case f.not_finite:n="Number must be finite";break;default:n=e.defaultError,R.assertNever(t)}return{message:n}};let Cr=yt;function Ei(t){Cr=t}function un(){return Cr}const dn=t=>{const{data:e,path:n,errorMaps:s,issueData:r}=t,a=[...n,...r.path||[]],i=x(d({},r),{path:a});if(r.message!==void 0)return x(d({},r),{path:a,message:r.message});let o="";const c=s.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return x(d({},r),{path:a,message:o})},xi=[];function y(t,e){const n=un(),s=dn({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===yt?void 0:yt].filter(r=>!!r)});t.common.issues.push(s)}class Y{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const s=[];for(const r of n){if(r.status==="aborted")return S;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static mergeObjectAsync(e,n){return Ee(this,null,function*(){const s=[];for(const r of n){const a=yield r.key,i=yield r.value;s.push({key:a,value:i})}return Y.mergeObjectSync(e,s)})}static mergeObjectSync(e,n){const s={};for(const r of n){const{key:a,value:i}=r;if(a.status==="aborted"||i.status==="aborted")return S;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value!="undefined"||r.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const S=Object.freeze({status:"aborted"}),ln=t=>({status:"dirty",value:t}),ne=t=>({status:"valid",value:t}),es=t=>t.status==="aborted",ts=t=>t.status==="dirty",Ye=t=>t.status==="valid",Pt=t=>typeof Promise!="undefined"&&t instanceof Promise;function fn(t,e,n,s){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Rr(t,e,n,s,r){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var w;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(w||(w={}));var Ot,Tt;class xe{constructor(e,n,s,r){this._cachedPath=[],this.parent=e,this.data=n,this._path=s,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const nr=(t,e)=>{if(Ye(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new oe(t.common.issues);return this._error=n,this._error}}};function O(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:s,description:r}=t;if(e&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,i)=>{var o,c;const{message:u}=t;return a.code==="invalid_enum_value"?{message:u!=null?u:i.defaultError}:typeof i.data=="undefined"?{message:(o=u!=null?u:s)!==null&&o!==void 0?o:i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:(c=u!=null?u:n)!==null&&c!==void 0?c:i.defaultError}},description:r}}class T{get description(){return this._def.description}_getType(e){return Ne(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Ne(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Y,ctx:{common:e.parent.common,data:e.data,parsedType:Ne(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Pt(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const s=this.safeParse(e,n);if(s.success)return s.data;throw s.error}safeParse(e,n){var s;const r={common:{issues:[],async:(s=n==null?void 0:n.async)!==null&&s!==void 0?s:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ne(e)},a=this._parseSync({data:e,path:r.path,parent:r});return nr(r,a)}"~validate"(e){var n,s;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ne(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return Ye(a)?{value:a.value}:{issues:r.common.issues}}catch(a){!((s=(n=a==null?void 0:a.message)===null||n===void 0?void 0:n.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>Ye(a)?{value:a.value}:{issues:r.common.issues})}parseAsync(e,n){return Ee(this,null,function*(){const s=yield this.safeParseAsync(e,n);if(s.success)return s.data;throw s.error})}safeParseAsync(e,n){return Ee(this,null,function*(){const s={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ne(e)},r=this._parse({data:e,path:s.path,parent:s}),a=yield Pt(r)?r:Promise.resolve(r);return nr(s,a)})}refine(e,n){const s=r=>typeof n=="string"||typeof n=="undefined"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,a)=>{const i=e(r),o=()=>a.addIssue(d({code:f.custom},s(r)));return typeof Promise!="undefined"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof n=="function"?n(s,r):n),!1))}_refinement(e){return new ge({schema:this,typeName:E.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ke.create(this,this._def)}nullable(){return Ue.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ye.create(this)}promise(){return vt.create(this,this._def)}or(e){return Dt.create([this,e],this._def)}and(e){return Mt.create(this,e,this._def)}transform(e){return new ge(x(d({},O(this._def)),{schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){const n=typeof e=="function"?e:()=>e;return new Ut(x(d({},O(this._def)),{innerType:this,defaultValue:n,typeName:E.ZodDefault}))}brand(){return new As(d({typeName:E.ZodBranded,type:this},O(this._def)))}catch(e){const n=typeof e=="function"?e:()=>e;return new Vt(x(d({},O(this._def)),{innerType:this,catchValue:n,typeName:E.ZodCatch}))}describe(e){const n=this.constructor;return new n(x(d({},this._def),{description:e}))}pipe(e){return Gt.create(this,e)}readonly(){return zt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Si=/^c[^\s-]{8,}$/i,Oi=/^[0-9a-z]+$/,Ti=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ai=/^[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,Ci=/^[a-z0-9_-]{21}$/i,Ri=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ni=/^[-+]?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)?)??$/,Pi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ji="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Pn;const Ii=/^(?:(?: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])$/,Zi=/^(?:(?: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])$/,Di=/^(([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]))$/,Mi=/^(([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])$/,Li=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$i=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Nr="((\\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])))",Fi=new RegExp(`^${Nr}$`);function Pr(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Wi(t){return new RegExp(`^${Pr(t)}$`)}function jr(t){let e=`${Nr}T${Pr(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Ui(t,e){return!!((e==="v4"||!e)&&Ii.test(t)||(e==="v6"||!e)&&Di.test(t))}function Vi(t,e){if(!Ri.test(t))return!1;try{const[n]=t.split("."),s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||!r.typ||!r.alg||e&&r.alg!==e)}catch(n){return!1}}function zi(t,e){return!!((e==="v4"||!e)&&Zi.test(t)||(e==="v6"||!e)&&Mi.test(t))}class me extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==v.string){const r=this._getOrReturnCtx(e);return y(r,{code:f.invalid_type,expected:v.string,received:r.parsedType}),S}const n=new Y;let s;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:f.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")e.data.length>r.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:f.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){const a=e.data.length>r.value,i=e.data.length<r.value;(a||i)&&(s=this._getOrReturnCtx(e,s),a?y(s,{code:f.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):i&&y(s,{code:f.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")Pi.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"email",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")Pn||(Pn=new RegExp(ji,"u")),Pn.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"emoji",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")Ai.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"uuid",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")Ci.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"nanoid",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")Si.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"cuid",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")Oi.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"cuid2",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")Ti.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"ulid",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(e.data)}catch(a){s=this._getOrReturnCtx(e,s),y(s,{validation:"url",code:f.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"regex",code:f.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?jr(r).test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?Fi.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?Wi(r).test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?Ni.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"duration",code:f.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?Ui(e.data,r.version)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"ip",code:f.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?Vi(e.data,r.alg)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"jwt",code:f.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?zi(e.data,r.version)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"cidr",code:f.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?Li.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"base64",code:f.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?$i.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"base64url",code:f.invalid_string,message:r.message}),n.dirty()):R.assertNever(r);return{status:n.value,value:e.data}}_regex(e,n,s){return this.refinement(r=>e.test(r),d({validation:n,code:f.invalid_string},w.errToObj(s)))}_addCheck(e){return new me(x(d({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(d({kind:"email"},w.errToObj(e)))}url(e){return this._addCheck(d({kind:"url"},w.errToObj(e)))}emoji(e){return this._addCheck(d({kind:"emoji"},w.errToObj(e)))}uuid(e){return this._addCheck(d({kind:"uuid"},w.errToObj(e)))}nanoid(e){return this._addCheck(d({kind:"nanoid"},w.errToObj(e)))}cuid(e){return this._addCheck(d({kind:"cuid"},w.errToObj(e)))}cuid2(e){return this._addCheck(d({kind:"cuid2"},w.errToObj(e)))}ulid(e){return this._addCheck(d({kind:"ulid"},w.errToObj(e)))}base64(e){return this._addCheck(d({kind:"base64"},w.errToObj(e)))}base64url(e){return this._addCheck(d({kind:"base64url"},w.errToObj(e)))}jwt(e){return this._addCheck(d({kind:"jwt"},w.errToObj(e)))}ip(e){return this._addCheck(d({kind:"ip"},w.errToObj(e)))}cidr(e){return this._addCheck(d({kind:"cidr"},w.errToObj(e)))}datetime(e){var n,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(d({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!1},w.errToObj(e==null?void 0:e.message)))}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck(d({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision},w.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(d({kind:"duration"},w.errToObj(e)))}regex(e,n){return this._addCheck(d({kind:"regex",regex:e},w.errToObj(n)))}includes(e,n){return this._addCheck(d({kind:"includes",value:e,position:n==null?void 0:n.position},w.errToObj(n==null?void 0:n.message)))}startsWith(e,n){return this._addCheck(d({kind:"startsWith",value:e},w.errToObj(n)))}endsWith(e,n){return this._addCheck(d({kind:"endsWith",value:e},w.errToObj(n)))}min(e,n){return this._addCheck(d({kind:"min",value:e},w.errToObj(n)))}max(e,n){return this._addCheck(d({kind:"max",value:e},w.errToObj(n)))}length(e,n){return this._addCheck(d({kind:"length",value:e},w.errToObj(n)))}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new me(x(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new me(x(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new me(x(d({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}me.create=t=>{var e;return new me(d({checks:[],typeName:E.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},O(t)))};function Ki(t,e){const n=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=n>s?n:s,a=parseInt(t.toFixed(r).replace(".","")),i=parseInt(e.toFixed(r).replace(".",""));return a%i/Math.pow(10,r)}class $e extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==v.number){const r=this._getOrReturnCtx(e);return y(r,{code:f.invalid_type,expected:v.number,received:r.parsedType}),S}let n;const s=new Y;for(const r of this._def.checks)r.kind==="int"?R.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.invalid_type,expected:"integer",received:"float",message:r.message}),s.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="multipleOf"?Ki(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_finite,message:r.message}),s.dirty()):R.assertNever(r);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,s,r){return new $e(x(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:w.toString(r)}]}))}_addCheck(e){return new $e(x(d({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&R.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(n)&&Number.isFinite(e)}}$e.create=t=>new $e(d({checks:[],typeName:E.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1},O(t)));class Fe extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(r){return this._getInvalidInput(e)}if(this._getType(e)!==v.bigint)return this._getInvalidInput(e);let n;const s=new Y;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):R.assertNever(r);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.bigint,received:n.parsedType}),S}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,s,r){return new Fe(x(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:w.toString(r)}]}))}_addCheck(e){return new Fe(x(d({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Fe.create=t=>{var e;return new Fe(d({checks:[],typeName:E.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},O(t)))};class jt extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==v.boolean){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.boolean,received:n.parsedType}),S}return ne(e.data)}}jt.create=t=>new jt(d({typeName:E.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1},O(t)));class Qe extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==v.date){const r=this._getOrReturnCtx(e);return y(r,{code:f.invalid_type,expected:v.date,received:r.parsedType}),S}if(isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return y(r,{code:f.invalid_date}),S}const n=new Y;let s;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:f.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:f.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):R.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qe(x(d({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Qe.create=t=>new Qe(d({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:E.ZodDate},O(t)));class hn extends T{_parse(e){if(this._getType(e)!==v.symbol){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.symbol,received:n.parsedType}),S}return ne(e.data)}}hn.create=t=>new hn(d({typeName:E.ZodSymbol},O(t)));class It extends T{_parse(e){if(this._getType(e)!==v.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.undefined,received:n.parsedType}),S}return ne(e.data)}}It.create=t=>new It(d({typeName:E.ZodUndefined},O(t)));class Zt extends T{_parse(e){if(this._getType(e)!==v.null){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.null,received:n.parsedType}),S}return ne(e.data)}}Zt.create=t=>new Zt(d({typeName:E.ZodNull},O(t)));class gt extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return ne(e.data)}}gt.create=t=>new gt(d({typeName:E.ZodAny},O(t)));class Xe extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ne(e.data)}}Xe.create=t=>new Xe(d({typeName:E.ZodUnknown},O(t)));class je extends T{_parse(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.never,received:n.parsedType}),S}}je.create=t=>new je(d({typeName:E.ZodNever},O(t)));class pn extends T{_parse(e){if(this._getType(e)!==v.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.void,received:n.parsedType}),S}return ne(e.data)}}pn.create=t=>new pn(d({typeName:E.ZodVoid},O(t)));class ye extends T{_parse(e){const{ctx:n,status:s}=this._processInputParams(e),r=this._def;if(n.parsedType!==v.array)return y(n,{code:f.invalid_type,expected:v.array,received:n.parsedType}),S;if(r.exactLength!==null){const i=n.data.length>r.exactLength.value,o=n.data.length<r.exactLength.value;(i||o)&&(y(n,{code:i?f.too_big:f.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(y(n,{code:f.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(y(n,{code:f.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>r.type._parseAsync(new xe(n,i,n.path,o)))).then(i=>Y.mergeArray(s,i));const a=[...n.data].map((i,o)=>r.type._parseSync(new xe(n,i,n.path,o)));return Y.mergeArray(s,a)}get element(){return this._def.type}min(e,n){return new ye(x(d({},this._def),{minLength:{value:e,message:w.toString(n)}}))}max(e,n){return new ye(x(d({},this._def),{maxLength:{value:e,message:w.toString(n)}}))}length(e,n){return new ye(x(d({},this._def),{exactLength:{value:e,message:w.toString(n)}}))}nonempty(e){return this.min(1,e)}}ye.create=(t,e)=>new ye(d({type:t,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray},O(e)));function ct(t){if(t instanceof V){const e={};for(const n in t.shape){const s=t.shape[n];e[n]=ke.create(ct(s))}return new V(x(d({},t._def),{shape:()=>e}))}else return t instanceof ye?new ye(x(d({},t._def),{type:ct(t.element)})):t instanceof ke?ke.create(ct(t.unwrap())):t instanceof Ue?Ue.create(ct(t.unwrap())):t instanceof Se?Se.create(t.items.map(e=>ct(e))):t}class V extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=R.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==v.object){const c=this._getOrReturnCtx(e);return y(c,{code:f.invalid_type,expected:v.object,received:c.parsedType}),S}const{status:n,ctx:s}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof je&&this._def.unknownKeys==="strip"))for(const c in s.data)a.includes(c)||i.push(c);const o=[];for(const c of a){const u=r[c],h=s.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new xe(s,h,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof je){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of i)o.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")i.length>0&&(y(s,{code:f.unrecognized_keys,keys:i}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of i){const h=s.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new xe(s,h,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(()=>Ee(this,null,function*(){const c=[];for(const u of o){const h=yield u.key,p=yield u.value;c.push({key:h,value:p,alwaysSet:u.alwaysSet})}return c})).then(c=>Y.mergeObjectSync(n,c)):Y.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new V(d(x(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(n,s)=>{var r,a,i,o;const c=(i=(a=(r=this._def).errorMap)===null||a===void 0?void 0:a.call(r,n,s).message)!==null&&i!==void 0?i:s.defaultError;return n.code==="unrecognized_keys"?{message:(o=w.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}))}strip(){return new V(x(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new V(x(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new V(x(d({},this._def),{shape:()=>d(d({},this._def.shape()),e)}))}merge(e){return new V({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>d(d({},this._def.shape()),e._def.shape()),typeName:E.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new V(x(d({},this._def),{catchall:e}))}pick(e){const n={};return R.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(n[s]=this.shape[s])}),new V(x(d({},this._def),{shape:()=>n}))}omit(e){const n={};return R.objectKeys(this.shape).forEach(s=>{e[s]||(n[s]=this.shape[s])}),new V(x(d({},this._def),{shape:()=>n}))}deepPartial(){return ct(this)}partial(e){const n={};return R.objectKeys(this.shape).forEach(s=>{const r=this.shape[s];e&&!e[s]?n[s]=r:n[s]=r.optional()}),new V(x(d({},this._def),{shape:()=>n}))}required(e){const n={};return R.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])n[s]=this.shape[s];else{let r=this.shape[s];for(;r instanceof ke;)r=r._def.innerType;n[s]=r}}),new V(x(d({},this._def),{shape:()=>n}))}keyof(){return Ir(R.objectKeys(this.shape))}}V.create=(t,e)=>new V(d({shape:()=>t,unknownKeys:"strip",catchall:je.create(),typeName:E.ZodObject},O(e)));V.strictCreate=(t,e)=>new V(d({shape:()=>t,unknownKeys:"strict",catchall:je.create(),typeName:E.ZodObject},O(e)));V.lazycreate=(t,e)=>new V(d({shape:t,unknownKeys:"strip",catchall:je.create(),typeName:E.ZodObject},O(e)));class Dt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),s=this._def.options;function r(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new oe(o.ctx.common.issues));return y(n,{code:f.invalid_union,unionErrors:i}),S}if(n.common.async)return Promise.all(s.map(a=>Ee(this,null,function*(){const i=x(d({},n),{common:x(d({},n.common),{issues:[]}),parent:null});return{result:yield a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}}))).then(r);{let a;const i=[];for(const c of s){const u=x(d({},n),{common:x(d({},n.common),{issues:[]}),parent:null}),h=c._parseSync({data:n.data,path:n.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new oe(c));return y(n,{code:f.invalid_union,unionErrors:o}),S}}get options(){return this._def.options}}Dt.create=(t,e)=>new Dt(d({options:t,typeName:E.ZodUnion},O(e)));const De=t=>t instanceof $t?De(t.schema):t instanceof ge?De(t.innerType()):t instanceof Ft?[t.value]:t instanceof We?t.options:t instanceof Wt?R.objectValues(t.enum):t instanceof Ut?De(t._def.innerType):t instanceof It?[void 0]:t instanceof Zt?[null]:t instanceof ke?[void 0,...De(t.unwrap())]:t instanceof Ue?[null,...De(t.unwrap())]:t instanceof As||t instanceof zt?De(t.unwrap()):t instanceof Vt?De(t._def.innerType):[];class wn extends T{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==v.object)return y(n,{code:f.invalid_type,expected:v.object,received:n.parsedType}),S;const s=this.discriminator,r=n.data[s],a=this.optionsMap.get(r);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(y(n,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,s){const r=new Map;for(const a of n){const i=De(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,a)}}return new wn(d({typeName:E.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r},O(s)))}}function ns(t,e){const n=Ne(t),s=Ne(e);if(t===e)return{valid:!0,data:t};if(n===v.object&&s===v.object){const r=R.objectKeys(e),a=R.objectKeys(t).filter(o=>r.indexOf(o)!==-1),i=d(d({},t),e);for(const o of a){const c=ns(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(n===v.array&&s===v.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],c=ns(i,o);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return n===v.date&&s===v.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Mt extends T{_parse(e){const{status:n,ctx:s}=this._processInputParams(e),r=(a,i)=>{if(es(a)||es(i))return S;const o=ns(a.value,i.value);return o.valid?((ts(a)||ts(i))&&n.dirty(),{status:n.value,value:o.data}):(y(s,{code:f.invalid_intersection_types}),S)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>r(a,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Mt.create=(t,e,n)=>new Mt(d({left:t,right:e,typeName:E.ZodIntersection},O(n)));class Se extends T{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.array)return y(s,{code:f.invalid_type,expected:v.array,received:s.parsedType}),S;if(s.data.length<this._def.items.length)return y(s,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&s.data.length>this._def.items.length&&(y(s,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const r=[...s.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new xe(s,a,s.path,i)):null}).filter(a=>!!a);return s.common.async?Promise.all(r).then(a=>Y.mergeArray(n,a)):Y.mergeArray(n,r)}get items(){return this._def.items}rest(e){return new Se(x(d({},this._def),{rest:e}))}}Se.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Se(d({items:t,typeName:E.ZodTuple,rest:null},O(e)))};class Lt extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.object)return y(s,{code:f.invalid_type,expected:v.object,received:s.parsedType}),S;const r=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)r.push({key:a._parse(new xe(s,o,s.path,o)),value:i._parse(new xe(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Y.mergeObjectAsync(n,r):Y.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,s){return n instanceof T?new Lt(d({keyType:e,valueType:n,typeName:E.ZodRecord},O(s))):new Lt(d({keyType:me.create(),valueType:e,typeName:E.ZodRecord},O(n)))}}class mn extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.map)return y(s,{code:f.invalid_type,expected:v.map,received:s.parsedType}),S;const r=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,c],u)=>({key:r._parse(new xe(s,o,s.path,[u,"key"])),value:a._parse(new xe(s,c,s.path,[u,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(()=>Ee(this,null,function*(){for(const c of i){const u=yield c.key,h=yield c.value;if(u.status==="aborted"||h.status==="aborted")return S;(u.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(u.value,h.value)}return{status:n.value,value:o}}))}else{const o=new Map;for(const c of i){const u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return S;(u.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(u.value,h.value)}return{status:n.value,value:o}}}}mn.create=(t,e,n)=>new mn(d({valueType:e,keyType:t,typeName:E.ZodMap},O(n)));class et extends T{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.set)return y(s,{code:f.invalid_type,expected:v.set,received:s.parsedType}),S;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(y(s,{code:f.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(y(s,{code:f.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const a=this._def.valueType;function i(c){const u=new Set;for(const h of c){if(h.status==="aborted")return S;h.status==="dirty"&&n.dirty(),u.add(h.value)}return{status:n.value,value:u}}const o=[...s.data.values()].map((c,u)=>a._parse(new xe(s,c,s.path,u)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,n){return new et(x(d({},this._def),{minSize:{value:e,message:w.toString(n)}}))}max(e,n){return new et(x(d({},this._def),{maxSize:{value:e,message:w.toString(n)}}))}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}et.create=(t,e)=>new et(d({valueType:t,minSize:null,maxSize:null,typeName:E.ZodSet},O(e)));class ht extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==v.function)return y(n,{code:f.invalid_type,expected:v.function,received:n.parsedType}),S;function s(o,c){return dn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,un(),yt].filter(u=>!!u),issueData:{code:f.invalid_arguments,argumentsError:c}})}function r(o,c){return dn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,un(),yt].filter(u=>!!u),issueData:{code:f.invalid_return_type,returnTypeError:c}})}const a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof vt){const o=this;return ne(function(...c){return Ee(this,null,function*(){const u=new oe([]),h=yield o._def.args.parseAsync(c,a).catch(k=>{throw u.addIssue(s(c,k)),u}),p=yield Reflect.apply(i,this,h);return yield o._def.returns._def.type.parseAsync(p,a).catch(k=>{throw u.addIssue(r(p,k)),u})})})}else{const o=this;return ne(function(...c){const u=o._def.args.safeParse(c,a);if(!u.success)throw new oe([s(c,u.error)]);const h=Reflect.apply(i,this,u.data),p=o._def.returns.safeParse(h,a);if(!p.success)throw new oe([r(h,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ht(x(d({},this._def),{args:Se.create(e).rest(Xe.create())}))}returns(e){return new ht(x(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,s){return new ht(d({args:e||Se.create([]).rest(Xe.create()),returns:n||Xe.create(),typeName:E.ZodFunction},O(s)))}}class $t extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}$t.create=(t,e)=>new $t(d({getter:t,typeName:E.ZodLazy},O(e)));class Ft extends T{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return y(n,{received:n.data,code:f.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ft.create=(t,e)=>new Ft(d({value:t,typeName:E.ZodLiteral},O(e)));function Ir(t,e){return new We(d({values:t,typeName:E.ZodEnum},O(e)))}class We extends T{constructor(){super(...arguments),Ot.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),s=this._def.values;return y(n,{expected:R.joinValues(s),received:n.parsedType,code:f.invalid_type}),S}if(fn(this,Ot)||Rr(this,Ot,new Set(this._def.values)),!fn(this,Ot).has(e.data)){const n=this._getOrReturnCtx(e),s=this._def.values;return y(n,{received:n.data,code:f.invalid_enum_value,options:s}),S}return ne(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return We.create(e,d(d({},this._def),n))}exclude(e,n=this._def){return We.create(this.options.filter(s=>!e.includes(s)),d(d({},this._def),n))}}Ot=new WeakMap;We.create=Ir;class Wt extends T{constructor(){super(...arguments),Tt.set(this,void 0)}_parse(e){const n=R.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==v.string&&s.parsedType!==v.number){const r=R.objectValues(n);return y(s,{expected:R.joinValues(r),received:s.parsedType,code:f.invalid_type}),S}if(fn(this,Tt)||Rr(this,Tt,new Set(R.getValidEnumValues(this._def.values))),!fn(this,Tt).has(e.data)){const r=R.objectValues(n);return y(s,{received:s.data,code:f.invalid_enum_value,options:r}),S}return ne(e.data)}get enum(){return this._def.values}}Tt=new WeakMap;Wt.create=(t,e)=>new Wt(d({values:t,typeName:E.ZodNativeEnum},O(e)));class vt extends T{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==v.promise&&n.common.async===!1)return y(n,{code:f.invalid_type,expected:v.promise,received:n.parsedType}),S;const s=n.parsedType===v.promise?n.data:Promise.resolve(n.data);return ne(s.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}vt.create=(t,e)=>new vt(d({type:t,typeName:E.ZodPromise},O(e)));class ge extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:s}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:i=>{y(s,i),i.fatal?n.abort():n.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const i=r.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(o=>Ee(this,null,function*(){if(n.value==="aborted")return S;const c=yield this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?S:c.status==="dirty"||n.value==="dirty"?ln(c.value):c}));{if(n.value==="aborted")return S;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?S:o.status==="dirty"||n.value==="dirty"?ln(o.value):o}}if(r.type==="refinement"){const i=o=>{const c=r.refinement(o,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?S:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?S:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Ye(i))return i;const o=r.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>Ye(i)?Promise.resolve(r.transform(i.value,a)).then(o=>({status:n.value,value:o})):i);R.assertNever(r)}}ge.create=(t,e,n)=>new ge(d({schema:t,typeName:E.ZodEffects,effect:e},O(n)));ge.createWithPreprocess=(t,e,n)=>new ge(d({schema:e,effect:{type:"preprocess",transform:t},typeName:E.ZodEffects},O(n)));class ke extends T{_parse(e){return this._getType(e)===v.undefined?ne(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ke.create=(t,e)=>new ke(d({innerType:t,typeName:E.ZodOptional},O(e)));class Ue extends T{_parse(e){return this._getType(e)===v.null?ne(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ue.create=(t,e)=>new Ue(d({innerType:t,typeName:E.ZodNullable},O(e)));class Ut extends T{_parse(e){const{ctx:n}=this._processInputParams(e);let s=n.data;return n.parsedType===v.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ut.create=(t,e)=>new Ut(d({innerType:t,typeName:E.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},O(e)));class Vt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),s=x(d({},n),{common:x(d({},n.common),{issues:[]})}),r=this._def.innerType._parse({data:s.data,path:s.path,parent:d({},s)});return Pt(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new oe(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Vt.create=(t,e)=>new Vt(d({innerType:t,typeName:E.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},O(e)));class yn extends T{_parse(e){if(this._getType(e)!==v.nan){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.nan,received:n.parsedType}),S}return{status:"valid",value:e.data}}}yn.create=t=>new yn(d({typeName:E.ZodNaN},O(t)));const Bi=Symbol("zod_brand");class As extends T{_parse(e){const{ctx:n}=this._processInputParams(e),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class Gt extends T{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.common.async)return Ee(this,null,function*(){const r=yield this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?S:r.status==="dirty"?(n.dirty(),ln(r.value)):this._def.out._parseAsync({data:r.value,path:s.path,parent:s})});{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?S:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,n){return new Gt({in:e,out:n,typeName:E.ZodPipeline})}}class zt extends T{_parse(e){const n=this._def.innerType._parse(e),s=r=>(Ye(r)&&(r.value=Object.freeze(r.value)),r);return Pt(n)?n.then(r=>s(r)):s(n)}unwrap(){return this._def.innerType}}zt.create=(t,e)=>new zt(d({innerType:t,typeName:E.ZodReadonly},O(e)));function sr(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Zr(t,e={},n){return t?gt.create().superRefine((s,r)=>{var a,i;const o=t(s);if(o instanceof Promise)return o.then(c=>{var u,h;if(!c){const p=sr(e,s),k=(h=(u=p.fatal)!==null&&u!==void 0?u:n)!==null&&h!==void 0?h:!0;r.addIssue(x(d({code:"custom"},p),{fatal:k}))}});if(!o){const c=sr(e,s),u=(i=(a=c.fatal)!==null&&a!==void 0?a:n)!==null&&i!==void 0?i:!0;r.addIssue(x(d({code:"custom"},c),{fatal:u}))}}):gt.create()}const qi={object:V.lazycreate};var E;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(E||(E={}));const Hi=(t,e={message:`Input not instance of ${t.name}`})=>Zr(n=>n instanceof t,e),Dr=me.create,Mr=$e.create,Gi=yn.create,Ji=Fe.create,Lr=jt.create,Xi=Qe.create,Yi=hn.create,Qi=It.create,eo=Zt.create,to=gt.create,no=Xe.create,so=je.create,ro=pn.create,ao=ye.create,io=V.create,oo=V.strictCreate,co=Dt.create,uo=wn.create,lo=Mt.create,fo=Se.create,ho=Lt.create,po=mn.create,mo=et.create,yo=ht.create,go=$t.create,vo=Ft.create,_o=We.create,bo=Wt.create,wo=vt.create,rr=ge.create,ko=ke.create,Eo=Ue.create,xo=ge.createWithPreprocess,So=Gt.create,Oo=()=>Dr().optional(),To=()=>Mr().optional(),Ao=()=>Lr().optional(),Co={string:t=>me.create(x(d({},t),{coerce:!0})),number:t=>$e.create(x(d({},t),{coerce:!0})),boolean:t=>jt.create(x(d({},t),{coerce:!0})),bigint:t=>Fe.create(x(d({},t),{coerce:!0})),date:t=>Qe.create(x(d({},t),{coerce:!0}))},Ro=S;var I=Object.freeze({__proto__:null,defaultErrorMap:yt,setErrorMap:Ei,getErrorMap:un,makeIssue:dn,EMPTY_PATH:xi,addIssueToContext:y,ParseStatus:Y,INVALID:S,DIRTY:ln,OK:ne,isAborted:es,isDirty:ts,isValid:Ye,isAsync:Pt,get util(){return R},get objectUtil(){return Qn},ZodParsedType:v,getParsedType:Ne,ZodType:T,datetimeRegex:jr,ZodString:me,ZodNumber:$e,ZodBigInt:Fe,ZodBoolean:jt,ZodDate:Qe,ZodSymbol:hn,ZodUndefined:It,ZodNull:Zt,ZodAny:gt,ZodUnknown:Xe,ZodNever:je,ZodVoid:pn,ZodArray:ye,ZodObject:V,ZodUnion:Dt,ZodDiscriminatedUnion:wn,ZodIntersection:Mt,ZodTuple:Se,ZodRecord:Lt,ZodMap:mn,ZodSet:et,ZodFunction:ht,ZodLazy:$t,ZodLiteral:Ft,ZodEnum:We,ZodNativeEnum:Wt,ZodPromise:vt,ZodEffects:ge,ZodTransformer:ge,ZodOptional:ke,ZodNullable:Ue,ZodDefault:Ut,ZodCatch:Vt,ZodNaN:yn,BRAND:Bi,ZodBranded:As,ZodPipeline:Gt,ZodReadonly:zt,custom:Zr,Schema:T,ZodSchema:T,late:qi,get ZodFirstPartyTypeKind(){return E},coerce:Co,any:to,array:ao,bigint:Ji,boolean:Lr,date:Xi,discriminatedUnion:uo,effect:rr,enum:_o,function:yo,instanceof:Hi,intersection:lo,lazy:go,literal:vo,map:po,nan:Gi,nativeEnum:bo,never:so,null:eo,nullable:Eo,number:Mr,object:io,oboolean:Ao,onumber:To,optional:ko,ostring:Oo,pipeline:So,preprocess:xo,promise:wo,record:ho,set:mo,strictObject:oo,string:Dr,symbol:Yi,transformer:rr,tuple:fo,undefined:Qi,union:co,unknown:no,void:ro,NEVER:Ro,ZodIssueCode:f,quotelessJson:ki,ZodError:oe});I.object({language:I.enum(["typescript","javascript"]).optional(),disableMarkedForExport:I.boolean().optional(),allowAutoSelectFirstNode:I.boolean().optional().default(!0)}).and(I.union([I.object({framework:I.literal("react"),model:I.string().optional(),styling:I.enum(["plain_css","css_modules","styled_components","tailwind","sass","scss","inline_styles"]),uiLibrary:I.enum(["mui","antd","radix","shadcn","clean_react"]).optional(),responsivePages:I.array(I.object({name:I.string(),framesId:I.array(I.string())})).optional(),enableUILibraryTheming:I.boolean().optional(),enableCompactStructure:I.boolean().optional(),enableDisplayScreenModelId:I.boolean().optional(),enableGeneratePackageLock:I.boolean().optional(),enableAnimationsPreset:I.boolean().optional(),enableAutoSplit:I.boolean().optional(),autoSplitThreshold:I.number().optional(),url:I.string().url().optional(),codegenSettings:I.record(I.unknown()).optional()}),I.object({framework:I.literal("html"),styling:I.enum(["plain_css","inline_styles","tailwind"]),enableTranslation:I.boolean().optional()})]));class ar extends Error{constructor(e,n){super(e),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}function jn(t){}function No(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=jn,onError:n=jn,onRetry:s=jn,onComment:r}=t;let a="",i=!0,o,c="",u="";function h(m){const _=i?m.replace(/^\xEF\xBB\xBF/,""):m,[l,C]=Po(`${a}${_}`);for(const j of l)p(j);a=C,i=!1}function p(m){if(m===""){g();return}if(m.startsWith(":")){r&&r(m.slice(m.startsWith(": ")?2:1));return}const _=m.indexOf(":");if(_!==-1){const l=m.slice(0,_),C=m[_+1]===" "?2:1,j=m.slice(_+C);k(l,j,m);return}k(m,"",m)}function k(m,_,l){switch(m){case"event":u=_;break;case"data":c=`${c}${_}
|
|
1
|
+
"use strict";var ra=Object.defineProperty,aa=Object.defineProperties;var ia=Object.getOwnPropertyDescriptors;var Us=Object.getOwnPropertySymbols;var oa=Object.prototype.hasOwnProperty,ca=Object.prototype.propertyIsEnumerable;var Vs=(t,e,n)=>e in t?ra(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Be=(t,e)=>{for(var n in e||(e={}))oa.call(e,n)&&Vs(t,n,e[n]);if(Us)for(var n of Us(e))ca.call(e,n)&&Vs(t,n,e[n]);return t},zs=(t,e)=>aa(t,ia(e));var je=(t,e,n)=>new Promise((s,r)=>{var a=c=>{try{o(n.next(c))}catch(u){r(u)}},i=c=>{try{o(n.throw(c))}catch(u){r(u)}},o=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,i);o((n=n.apply(t,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("react"),ua=t=>{let e="";const n=new Uint8Array(t),s=n.byteLength;for(let r=0;r<s;r++)e+=String.fromCharCode(n[r]);return btoa(e)};var da=Object.defineProperty,la=Object.defineProperties,fa=Object.getOwnPropertyDescriptors,Ks=Object.getOwnPropertySymbols,ha=Object.prototype.hasOwnProperty,pa=Object.prototype.propertyIsEnumerable,Bs=(t,e,n)=>e in t?da(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e)=>{for(var n in e||(e={}))ha.call(e,n)&&Bs(t,n,e[n]);if(Ks)for(var n of Ks(e))pa.call(e,n)&&Bs(t,n,e[n]);return t},x=(t,e)=>la(t,fa(e)),Ee=(t,e,n)=>new Promise((s,r)=>{var a=c=>{try{o(n.next(c))}catch(u){r(u)}},i=c=>{try{o(n.throw(c))}catch(u){r(u)}},o=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,i);o((n=n.apply(t,e)).next())});class qs extends Error{constructor({name:e,reason:n,status:s,detail:r}){super(),this.name=e,this.message=n,this.detail=r,this.status=s}}const ma="Figma Token Issue";class ya extends Error{constructor({fileKey:e,reason:n,cause:s}){super(ma),this.fileKey=e,this.reason=n,this.cause=s}}const ga="Rate Limit Exceeded";class va extends Error{constructor({fileKey:e,cause:n}){super(ga),this.fileKey=e,this.cause=n}}const _a="Request Too Large";class ba extends Error{constructor({fileKey:e,cause:n}){super(_a),this.fileKey=e,this.cause=n}}const wa="Not Found";class ka extends Error{constructor({fileKey:e,cause:n}){super(wa),this.fileKey=e,this.cause=n}}const Ea="Unknown Figma API Exception";class xa extends Error{constructor({fileKey:e,cause:n}){super(Ea),this.name="UnknownFigmaApiException",this.fileKey=e,this.cause=n}}const Sa=(t,e)=>{var n;if(((n=t==null?void 0:t.cause)==null?void 0:n.message)==="Fetch Error"){const{err:s,status:r}=t.cause.body;if(r===403)return new ya({fileKey:e,reason:s,cause:t});if(r===429)return new va({fileKey:e,cause:t});if(r===404)return new ka({fileKey:e,cause:t});if(r===400&&s.includes("Request too large"))return new ba({fileKey:e,cause:t})}return new xa({fileKey:e,cause:t})};var Oa=Object.defineProperty,Ta=Object.defineProperties,Ca=Object.getOwnPropertyDescriptors,Hs=Object.getOwnPropertySymbols,Aa=Object.prototype.hasOwnProperty,Ra=Object.prototype.propertyIsEnumerable,Gs=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Sr=t=>{throw TypeError(t)},Js=(t,e,n)=>e in t?Oa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ie=(t,e)=>{for(var n in e||(e={}))Aa.call(e,n)&&Js(t,n,e[n]);if(Hs)for(var n of Hs(e))Ra.call(e,n)&&Js(t,n,e[n]);return t},Ss=(t,e)=>Ta(t,Ca(e)),Os=(t,e,n)=>e.has(t)||Sr("Cannot "+n),Z=(t,e,n)=>(Os(t,e,"read from private field"),n?n.call(t):e.get(t)),le=(t,e,n)=>e.has(t)?Sr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),X=(t,e,n,s)=>(Os(t,e,"write to private field"),e.set(t,n),n),be=(t,e,n)=>(Os(t,e,"access private method"),n),q=(t,e,n)=>new Promise((s,r)=>{var a=c=>{try{o(n.next(c))}catch(u){r(u)}},i=c=>{try{o(n.throw(c))}catch(u){r(u)}},o=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,i);o((n=n.apply(t,e)).next())}),Na=(t,e,n)=>(e=t[Gs("asyncIterator")])?e.call(t):(t=t[Gs("iterator")](),e={},n=(s,r)=>(r=t[s])&&(e[s]=a=>new Promise((i,o,c)=>(a=r.call(t,a),c=a.done,Promise.resolve(a.value).then(u=>i({value:u,done:c}),o)))),n("next"),n("return"),e),Pa=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ia(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var zn={exports:{}},ja=zn.exports,Xs;function Za(){return Xs||(Xs=1,function(t,e){(function(n,s){t.exports=s()})(ja,function(){var n=typeof Promise=="function",s=typeof self=="object"?self:Pa,r=typeof Symbol!="undefined",a=typeof Map!="undefined",i=typeof Set!="undefined",o=typeof WeakMap!="undefined",c=typeof WeakSet!="undefined",u=typeof DataView!="undefined",h=r&&typeof Symbol.iterator!="undefined",p=r&&typeof Symbol.toStringTag!="undefined",k=i&&typeof Set.prototype.entries=="function",g=a&&typeof Map.prototype.entries=="function",b=k&&Object.getPrototypeOf(new Set().entries()),m=g&&Object.getPrototypeOf(new Map().entries()),_=h&&typeof Array.prototype[Symbol.iterator]=="function",l=_&&Object.getPrototypeOf([][Symbol.iterator]()),A=h&&typeof String.prototype[Symbol.iterator]=="function",I=A&&Object.getPrototypeOf(""[Symbol.iterator]()),z=8,M=-1;function K(D){var P=typeof D;if(P!=="object")return P;if(D===null)return"null";if(D===s)return"global";if(Array.isArray(D)&&(p===!1||!(Symbol.toStringTag in D)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&D===window.location)return"Location";if(typeof window.document=="object"&&D===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&D===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&D===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&D instanceof window.HTMLElement){if(D.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(D.tagName==="TD")return"HTMLTableDataCellElement";if(D.tagName==="TH")return"HTMLTableHeaderCellElement"}}var Oe=p&&D[Symbol.toStringTag];if(typeof Oe=="string")return Oe;var $=Object.getPrototypeOf(D);return $===RegExp.prototype?"RegExp":$===Date.prototype?"Date":n&&$===Promise.prototype?"Promise":i&&$===Set.prototype?"Set":a&&$===Map.prototype?"Map":c&&$===WeakSet.prototype?"WeakSet":o&&$===WeakMap.prototype?"WeakMap":u&&$===DataView.prototype?"DataView":a&&$===m?"Map Iterator":i&&$===b?"Set Iterator":_&&$===l?"Array Iterator":A&&$===I?"String Iterator":$===null?"Object":Object.prototype.toString.call(D).slice(z,M)}return K})}(zn)),zn.exports}var Da=Za();const Ma=Ia(Da),Ts=typeof Buffer!="undefined",La=Ts&&typeof Buffer.from!="undefined",Fa=Ts?function(t){return Buffer.isBuffer(t)}:function(){return!1},$a=La?function(t){return Buffer.from(t)}:Ts?function(t){return new Buffer(t)}:function(t){return t};function mt(t){return Fa(t)?"Buffer":Ma(t)}const Wa=new Set(["Arguments","Array","Map","Object","Set"]);function Ua(t,e,n=null){switch(n||mt(t)){case"Arguments":case"Array":case"Object":return t[e];case"Map":return t.get(e);case"Set":return e}}function Kn(t){return Wa.has(t)}function Ys(t,e,n,s=null){switch(s||mt(t)){case"Arguments":case"Array":case"Object":t[e]=n;break;case"Map":t.set(e,n);break;case"Set":t.add(n);break}return t}const Va=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,za=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,Ka=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,An=Va||za||Ka||Function("return this")();function Ba(t){return t.slice(0)}function qa(t){return new Boolean(t.valueOf())}function Ha(t){return new DataView(t.buffer)}function Ga(t){return $a(t)}function Ja(t){return new Date(t.getTime())}function Xa(t){return new Number(t)}function Ya(t){return new RegExp(t.source,t.flags)}function Qa(t){return new String(t)}function Ae(t,e){return An[e].from?An[e].from(t):new An[e](t)}function ee(t){return t}function Qs(){return[]}function ei(){return new Map}function ti(){return{}}function ni(){return new Set}const si=new Map([["ArrayBuffer",Ba],["Boolean",qa],["Buffer",Ga],["DataView",Ha],["Date",Ja],["Number",Xa],["RegExp",Ya],["String",Qa],["Float32Array",Ae],["Float64Array",Ae],["Int16Array",Ae],["Int32Array",Ae],["Int8Array",Ae],["Uint16Array",Ae],["Uint32Array",Ae],["Uint8Array",Ae],["Uint8ClampedArray",Ae],["Array Iterator",ee],["Map Iterator",ee],["Promise",ee],["Set Iterator",ee],["String Iterator",ee],["function",ee],["global",ee],["WeakMap",ee],["WeakSet",ee],["boolean",ee],["null",ee],["number",ee],["string",ee],["symbol",ee],["undefined",ee],["Arguments",Qs],["Array",Qs],["Map",ei],["Object",ti],["Set",ni]]);function ri(){}function Bn(t,e=null,n=ri){arguments.length===2&&typeof e=="function"&&(n=e,e=null);const s=e||mt(t),r=si.get(s);if(s==="Object"){const a=n(t,s);if(a!==void 0)return a}return r?r(t,s):t}function kt(t,e={}){typeof e=="function"&&(e={customizer:e});const{customizer:n}=e,s=mt(t);if(!Kn(s))return qn(t,null,null,null);const r=Bn(t,s,n),a=new WeakMap([[t,r]]),i=new WeakSet([t]);return qn(t,r,a,i)}function qn(t,e,n,s,r){const a=mt(t),i=Bn(t,a);if(!Kn(a))return i;let o;switch(a){case"Arguments":case"Array":o=Object.keys(t);break;case"Object":o=Object.keys(t),o.push(...Object.getOwnPropertySymbols(t));break;case"Map":case"Set":o=t.keys();break}for(let c of o){const u=Ua(t,c,a);if(s.has(u))Ys(e,c,n.get(u),a);else{const h=mt(u),p=Bn(u,h);Kn(h)&&(n.set(u,p),s.add(u)),Ys(e,c,qn(u,p,n,s),a)}}return e}const ai=t=>new Promise(e=>setTimeout(e,t));var sn,He,rn,Hn,Or;class ii{constructor({maxAttempts:e=3,func:n}){le(this,Hn),le(this,sn),le(this,He),le(this,rn),X(this,sn,e),X(this,rn,n),X(this,He,0)}run(){return q(this,null,function*(){try{return yield Z(this,rn).call(this)}catch(e){if(X(this,He,Z(this,He)+1),Z(this,He)>Z(this,sn))throw console.error("Max attempts reached"),e;const n=be(this,Hn,Or).call(this);return yield ai(n),yield this.run()}})}}sn=new WeakMap,He=new WeakMap,rn=new WeakMap,Hn=new WeakSet,Or=function(){return Z(this,He)*1e3*1.5};function oi(){return typeof CompressionStream!="undefined"}function ci(t){return q(this,null,function*(){const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=[];try{for(var s=Na(e),r,a,i;r=!(a=yield s.next()).done;r=!1){const o=a.value;n.push(o)}}catch(o){i=[o]}finally{try{r&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i[0]}}return yield ui(n)})}function ui(t){return q(this,null,function*(){const e=yield new Blob(t).arrayBuffer();return new Uint8Array(e)})}class di extends Error{constructor({resource:e,api:n,args:s,cause:r}){if(super(`API Error on resource "${e}" at api "${n}"`),this.causeProperties={},this.name="API Error",this.resource=e,this.api=n,this.cause=r,this.args=s,r instanceof Error)for(const[i,o]of Object.entries(r))if(typeof Headers!="undefined"&&o instanceof Headers){const c={};o.forEach((u,h)=>{c[h]=u}),this.causeProperties[i]=c}else this.causeProperties[i]=o;const a=this.causeProperties.body;a&&typeof a=="object"&&"code"in a&&(this.code=a.code)}}class er extends Error{constructor({url:e,method:n,statusCode:s,requestHeaders:r,responseHeaders:a,body:i}){if(super("Fetch Error"),this.name="Fetch Error",this.url=e,this.method=n,this.statusNumber=s,this.requestHeaders=r,this.responseHeaders=a,i)try{const o=JSON.parse(i);this.body=o}catch(o){this.body=i}}}class Et extends Error{constructor(e={}){const{canceled:n=!1}=e;super("Abort Error"),this.name="Abort Error",this.canceled=n}}class li extends Error{constructor(e){super(`Async API Error: ${JSON.stringify(e)}`),this.name="Async API Error",this.body=e}}class Rn extends Error{constructor(e){super(e),this.name="Request Validation Error"}}function Tr(){return Array.from({length:32},()=>Math.floor(Math.random()*256).toString(16).padStart(2,"0")).join("")}function Gn(){return Math.floor(Date.now()/1e3).toString()}const fi=5*60*1e3,hi=1*1e3;var Ge,se,ve,Jn,Xn,xt;class pi{constructor({fetch:e=globalThis.fetch.bind(globalThis),baseAddress:n}){le(this,ve),le(this,Ge),le(this,se),this.baseAddress=n,X(this,Ge,e),X(this,se,{}),this.plugins=[]}get headers(){throw new Error("Missing implementation")}addPlugin(e){this.plugins.push(e)}removePlugin(e){this.plugins=this.plugins.filter(n=>n.name!==e)}withOptions(e={}){return X(this,se,e),this}get(e){return q(this,arguments,function*(n,s={}){const{overrideBaseAddress:r,overrideDefaultHeaders:a}=s,i=r!=null?r:this.baseAddress;let o=a!=null?a:this.headers;const c=kt(Z(this,se));return X(this,se,{}),c.extraHeaders&&(o=ie(ie({},o),c.extraHeaders)),c.requestValidation&&(o=Ss(ie({},o),{"X-Request-Nonce":Tr(),"X-Request-Timestamp":Gn()})),c.async?yield be(this,ve,Xn).call(this,`${i}${n}`,c.async,{headers:o}):yield be(this,ve,Jn).call(this,`${i}${n}`,c,{headers:o})})}post(e,n){return q(this,arguments,function*(s,r,a={}){const i=kt(Z(this,se));return X(this,se,{}),be(this,ve,xt).call(this,s,"POST",r,a,i)})}put(e,n){return q(this,arguments,function*(s,r,a={}){const i=kt(Z(this,se));return X(this,se,{}),be(this,ve,xt).call(this,s,"PUT",r,a,i)})}delete(e,n){return q(this,arguments,function*(s,r,a={}){const i=kt(Z(this,se));return X(this,se,{}),be(this,ve,xt).call(this,s,"DELETE",r,a,i)})}patch(e,n){return q(this,arguments,function*(s,r,a={}){const i=kt(Z(this,se));return X(this,se,{}),be(this,ve,xt).call(this,s,"PATCH",r,a,i)})}}Ge=new WeakMap,se=new WeakMap,ve=new WeakSet,Jn=function(t,e,n){return q(this,null,function*(){const s=()=>q(this,null,function*(){var c,u;try{return yield Z(this,Ge).call(this,t,ie(ie({},n),e.abortSignal&&{signal:e.abortSignal}))}catch(h){throw h instanceof Error&&h.name==="AbortError"?new Et({canceled:(u=(c=e.abortSignal)==null?void 0:c.aborted)!=null?u:!1}):h}}),{headers:r}=n!=null?n:{},a=(c,u)=>{var h,p;return((h=c==null?void 0:c.headers)==null?void 0:h.get(u))||((p=c==null?void 0:c.headersObject)==null?void 0:p[u])||""},i=c=>q(this,null,function*(){var u;if(!c.ok){const p=yield c.text().catch();throw new er({url:t,method:(u=n==null?void 0:n.method)!=null?u:"GET",statusCode:c.status,requestHeaders:r,responseHeaders:c.headers,body:p})}if(e.requestValidation&&process.env.UI_TESTS!==!0)try{const p=a(c,"x-response-nonce"),k=r==null?void 0:r["X-Request-Nonce"];if(!p||p!==k)throw new Rn("Response nonce mismatch");const g=Number(a(c,"x-response-timestamp")),b=Number(Gn()),m=60*60*24;if(isNaN(g)||Math.abs(b-g)>m)throw new Rn("Invalid response timestamp")}catch(p){const k=p instanceof Error?p.message:"Request validation failed";throw new Rn(k)}let h=yield c.text();try{h=JSON.parse(h)}catch(p){}return h});if(e.retry){const c=yield new ii({maxAttempts:e.retry,func:s}).run();return yield i(c)}const o=yield s();return yield i(o)})},Xn=function(t,e,n){return q(this,null,function*(){var s,r;const{onProgress:a,abortSignal:i,pollingInterval:o=()=>hi,maxTimeout:c=fi}=e,u=`${t}/async`,h=`${t}/async/job`;let p;try{p=yield Z(this,Ge).call(this,u,ie(ie({},n),i&&{signal:i}))}catch(b){throw b instanceof Error&&b.name==="AbortError"?new Et({canceled:(s=i==null?void 0:i.aborted)!=null?s:!1}):b}if(!p.ok){const b=yield p.text().catch();throw new er({url:t,method:(r=n==null?void 0:n.method)!=null?r:"GET",statusCode:p.status,requestHeaders:this.headers,responseHeaders:p.headers,body:b})}const k=yield p.json(),{job_id:g}=k;if(!g)throw new Error("Job ID not found in response");return new Promise((b,m)=>q(this,null,function*(){const _=setTimeout(()=>{m(new Error("Job timed out"))},c),l=(A=0)=>q(this,null,function*(){if(i!=null&&i.aborted){clearTimeout(_),Z(this,Ge).call(this,`${h}/${g}/cancel`,{method:"POST",headers:this.headers}).then(()=>{m(new Et({canceled:!0}))}).catch(I=>{m(new Et({canceled:!1}))});return}try{const I=yield(yield Z(this,Ge).call(this,`${h}/${g}`,{headers:this.headers})).json();if(I.status==="success"){clearTimeout(_);const z=I.response_json;b(z)}else if(I.status==="failed")clearTimeout(_),m(new li(I.response_json));else{a&&a(I.response_json);const z=o(A);setTimeout(()=>l(A+1),z)}}catch(I){m(I)}});l()}))})},xt=function(t,e,n,s,r){return q(this,null,function*(){const{overrideBaseAddress:a,overrideDefaultHeaders:i}=s,o=a!=null?a:this.baseAddress;let c=i!=null?i:this.headers;r.extraHeaders&&(c=ie(ie({},c),r.extraHeaders)),r.requestValidation&&(c=Ss(ie({},c),{"X-Request-Nonce":Tr(),"X-Request-Timestamp":Gn()}));let u=n;return typeof FormData!="undefined"&&n instanceof FormData?delete c["Content-Type"]:(u=s.skipBodyJsonStringify?n:JSON.stringify(n),r.compress&&oi()&&(c["Content-Encoding"]="gzip",u=yield ci(u))),r.async?yield be(this,ve,Xn).call(this,`${o}${t}`,r.async,{method:e,headers:c,body:u}):yield be(this,ve,Jn).call(this,`${o}${t}`,r,{method:e,headers:c,body:u})})};const tr=(t,e,n,s)=>t instanceof Et?t:new di({resource:e,api:String(n),args:s,cause:t}),Nn=(t,e)=>new Proxy(e,{get(n,s){return(...r)=>{var a;for(const o of t.plugins){const c=(a=o.beforeApi)==null?void 0:a.call(o,{resource:n.resourceName,api:s,args:r});if(c!==void 0)return c}let i;try{i=n[s](...r)}catch(o){throw tr(o,n.resourceName,s,r)}return i instanceof Promise?i.catch(o=>{throw tr(o,n.resourceName,s,r)}):i}}});var St;class mi{constructor(e){le(this,St),this.resourceName="Files",X(this,St,e)}get(e){return q(this,arguments,function*({fileKey:n,params:s={}}){const r=new URLSearchParams(ie({plugin_data:"857346721138427857"},s)).toString(),a=`v1/files/${n}?${r}`;return yield Z(this,St).get(a)})}getImageFills(e){return q(this,arguments,function*({fileKey:n}){var s,r;const a=`v1/files/${n}/images`;return(r=(s=(yield Z(this,St).get(a)).meta)==null?void 0:s.images)!=null?r:{}})}}St=new WeakMap;const yi=(t,e,n)=>{const s=e.sort();return`${t}-${s.join("-")}-${n}`},gi=t=>t?t.ts>Date.now()-1e3*30:!1;var _e,Yn,Cr;class vi{constructor(e){le(this,Yn),le(this,_e),this.resourceName="Images",X(this,_e,e)}get(e){return q(this,arguments,function*({fileKey:n,nodeIds:s,format:r="jpg",scale:a}){const i=yi(n,s,r),o=Z(this,_e).cache.images.entries.get(i);if(gi(o))return o.result;o&&Z(this,_e).cache.images.entries.delete(i);const c=Z(this,_e).cache.images.pendingRequests.get(i);if(c)return c;const u=be(this,Yn,Cr).call(this,i,n,s,r,a);Z(this,_e).cache.images.pendingRequests.set(i,u);try{return yield u}finally{Z(this,_e).cache.images.pendingRequests.delete(i)}})}}_e=new WeakMap,Yn=new WeakSet,Cr=function(t,e,n,s,r){return q(this,null,function*(){const a=yield Z(this,_e).get(`v1/images/${e}?ids=${n}&format=${s}${r?`&scale=${r}`:""}`);return Z(this,_e).cache.images.entries.set(t,{result:a,ts:Date.now()}),a})};var an;class _i{constructor(e){le(this,an),this.resourceName="Nodes",X(this,an,e)}get(e){return q(this,arguments,function*({fileKey:n,nodeIds:s,params:r={}}){const a=Ss(ie({},r),{ids:s.join(",")}),i=new URLSearchParams(ie({plugin_data:"857346721138427857"},a)).toString(),o=`v1/files/${n}/nodes?${i}`;return yield Z(this,an).get(o)})}}an=new WeakMap;var Ze;class bi extends pi{constructor({baseAddress:e="https://api.figma.com/",fetch:n=globalThis.fetch.bind(globalThis)}={}){super({fetch:n,baseAddress:e}),le(this,Ze,""),this.cache={images:{entries:new Map,pendingRequests:new Map}},this.files=Nn(this,new mi(this)),this.nodes=Nn(this,new _i(this)),this.images=Nn(this,new vi(this))}set token(e){if(!e.startsWith("figd_")&&!e.startsWith("figu_"))throw new Error("Invalid Figma access token");X(this,Ze,e)}get token(){return Z(this,Ze)}get headers(){const e={"Content-Type":"application/json"};return Z(this,Ze).startsWith("figd_")?e["X-FIGMA-TOKEN"]=Z(this,Ze):Z(this,Ze).startsWith("figu_")&&(e.Authorization=`Bearer ${Z(this,Ze)}`),e}}Ze=new WeakMap;const wi=t=>Ee(void 0,[t],function*({fileKey:e,authToken:n,figmaRestApi:s=new bi,params:r={},signal:a}){n&&(s.token=n);try{return yield s.withOptions({abortSignal:a}).files.get({fileKey:e,params:r})}catch(i){throw i instanceof Error&&i.name==="AbortError"?i:(console.error(i),Sa(i,e))}});var R;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{const a={};for(const i of r)a[i]=i;return a},t.getValidEnumValues=r=>{const a=t.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of a)i[o]=r[o];return t.objectValues(i)},t.objectValues=r=>t.objectKeys(r).map(function(a){return r[a]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&a.push(i);return a},t.find=(r,a)=>{for(const i of r)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function s(r,a=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=s,t.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(R||(R={}));var Qn;(function(t){t.mergeShapes=(e,n)=>d(d({},e),n)})(Qn||(Qn={}));const v=R.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ne=t=>{switch(typeof t){case"undefined":return v.undefined;case"string":return v.string;case"number":return isNaN(t)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(t)?v.array:t===null?v.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?v.promise:typeof Map!="undefined"&&t instanceof Map?v.map:typeof Set!="undefined"&&t instanceof Set?v.set:typeof Date!="undefined"&&t instanceof Date?v.date:v.object;default:return v.unknown}},f=R.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),ki=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class oe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},s={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(n(i));else{let o=s,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return r(this),s}static assert(e){if(!(e instanceof oe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,R.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},s=[];for(const r of this.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(e(r))):s.push(e(r));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}oe.create=t=>new oe(t);const yt=(t,e)=>{let n;switch(t.code){case f.invalid_type:t.received===v.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,R.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${R.joinValues(t.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${R.joinValues(t.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${R.joinValues(t.options)}, received '${t.received}'`;break;case f.invalid_arguments:n="Invalid function arguments";break;case f.invalid_return_type:n="Invalid function return type";break;case f.invalid_date:n="Invalid date";break;case f.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:R.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case f.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case f.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case f.custom:n="Invalid input";break;case f.invalid_intersection_types:n="Intersection results could not be merged";break;case f.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case f.not_finite:n="Number must be finite";break;default:n=e.defaultError,R.assertNever(t)}return{message:n}};let Ar=yt;function Ei(t){Ar=t}function un(){return Ar}const dn=t=>{const{data:e,path:n,errorMaps:s,issueData:r}=t,a=[...n,...r.path||[]],i=x(d({},r),{path:a});if(r.message!==void 0)return x(d({},r),{path:a,message:r.message});let o="";const c=s.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return x(d({},r),{path:a,message:o})},xi=[];function y(t,e){const n=un(),s=dn({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===yt?void 0:yt].filter(r=>!!r)});t.common.issues.push(s)}class Y{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const s=[];for(const r of n){if(r.status==="aborted")return S;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static mergeObjectAsync(e,n){return Ee(this,null,function*(){const s=[];for(const r of n){const a=yield r.key,i=yield r.value;s.push({key:a,value:i})}return Y.mergeObjectSync(e,s)})}static mergeObjectSync(e,n){const s={};for(const r of n){const{key:a,value:i}=r;if(a.status==="aborted"||i.status==="aborted")return S;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value!="undefined"||r.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const S=Object.freeze({status:"aborted"}),ln=t=>({status:"dirty",value:t}),ne=t=>({status:"valid",value:t}),es=t=>t.status==="aborted",ts=t=>t.status==="dirty",Ye=t=>t.status==="valid",Pt=t=>typeof Promise!="undefined"&&t instanceof Promise;function fn(t,e,n,s){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Rr(t,e,n,s,r){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var w;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(w||(w={}));var Ot,Tt;class xe{constructor(e,n,s,r){this._cachedPath=[],this.parent=e,this.data=n,this._path=s,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const nr=(t,e)=>{if(Ye(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new oe(t.common.issues);return this._error=n,this._error}}};function O(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:s,description:r}=t;if(e&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(a,i)=>{var o,c;const{message:u}=t;return a.code==="invalid_enum_value"?{message:u!=null?u:i.defaultError}:typeof i.data=="undefined"?{message:(o=u!=null?u:s)!==null&&o!==void 0?o:i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:(c=u!=null?u:n)!==null&&c!==void 0?c:i.defaultError}},description:r}}class T{get description(){return this._def.description}_getType(e){return Ne(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Ne(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Y,ctx:{common:e.parent.common,data:e.data,parsedType:Ne(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Pt(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const s=this.safeParse(e,n);if(s.success)return s.data;throw s.error}safeParse(e,n){var s;const r={common:{issues:[],async:(s=n==null?void 0:n.async)!==null&&s!==void 0?s:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ne(e)},a=this._parseSync({data:e,path:r.path,parent:r});return nr(r,a)}"~validate"(e){var n,s;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ne(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return Ye(a)?{value:a.value}:{issues:r.common.issues}}catch(a){!((s=(n=a==null?void 0:a.message)===null||n===void 0?void 0:n.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>Ye(a)?{value:a.value}:{issues:r.common.issues})}parseAsync(e,n){return Ee(this,null,function*(){const s=yield this.safeParseAsync(e,n);if(s.success)return s.data;throw s.error})}safeParseAsync(e,n){return Ee(this,null,function*(){const s={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ne(e)},r=this._parse({data:e,path:s.path,parent:s}),a=yield Pt(r)?r:Promise.resolve(r);return nr(s,a)})}refine(e,n){const s=r=>typeof n=="string"||typeof n=="undefined"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,a)=>{const i=e(r),o=()=>a.addIssue(d({code:f.custom},s(r)));return typeof Promise!="undefined"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof n=="function"?n(s,r):n),!1))}_refinement(e){return new ge({schema:this,typeName:E.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ke.create(this,this._def)}nullable(){return Ue.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ye.create(this)}promise(){return vt.create(this,this._def)}or(e){return Dt.create([this,e],this._def)}and(e){return Mt.create(this,e,this._def)}transform(e){return new ge(x(d({},O(this._def)),{schema:this,typeName:E.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){const n=typeof e=="function"?e:()=>e;return new Ut(x(d({},O(this._def)),{innerType:this,defaultValue:n,typeName:E.ZodDefault}))}brand(){return new Cs(d({typeName:E.ZodBranded,type:this},O(this._def)))}catch(e){const n=typeof e=="function"?e:()=>e;return new Vt(x(d({},O(this._def)),{innerType:this,catchValue:n,typeName:E.ZodCatch}))}describe(e){const n=this.constructor;return new n(x(d({},this._def),{description:e}))}pipe(e){return Gt.create(this,e)}readonly(){return zt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Si=/^c[^\s-]{8,}$/i,Oi=/^[0-9a-z]+$/,Ti=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ci=/^[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,Ai=/^[a-z0-9_-]{21}$/i,Ri=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ni=/^[-+]?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)?)??$/,Pi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ii="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Pn;const ji=/^(?:(?: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])$/,Zi=/^(?:(?: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])$/,Di=/^(([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]))$/,Mi=/^(([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])$/,Li=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Nr="((\\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])))",$i=new RegExp(`^${Nr}$`);function Pr(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Wi(t){return new RegExp(`^${Pr(t)}$`)}function Ir(t){let e=`${Nr}T${Pr(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Ui(t,e){return!!((e==="v4"||!e)&&ji.test(t)||(e==="v6"||!e)&&Di.test(t))}function Vi(t,e){if(!Ri.test(t))return!1;try{const[n]=t.split("."),s=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||!r.typ||!r.alg||e&&r.alg!==e)}catch(n){return!1}}function zi(t,e){return!!((e==="v4"||!e)&&Zi.test(t)||(e==="v6"||!e)&&Mi.test(t))}class me extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==v.string){const r=this._getOrReturnCtx(e);return y(r,{code:f.invalid_type,expected:v.string,received:r.parsedType}),S}const n=new Y;let s;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:f.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")e.data.length>r.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:f.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){const a=e.data.length>r.value,i=e.data.length<r.value;(a||i)&&(s=this._getOrReturnCtx(e,s),a?y(s,{code:f.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):i&&y(s,{code:f.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")Pi.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"email",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")Pn||(Pn=new RegExp(Ii,"u")),Pn.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"emoji",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")Ci.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"uuid",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")Ai.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"nanoid",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")Si.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"cuid",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")Oi.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"cuid2",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")Ti.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"ulid",code:f.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(e.data)}catch(a){s=this._getOrReturnCtx(e,s),y(s,{validation:"url",code:f.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"regex",code:f.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?Ir(r).test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?$i.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?Wi(r).test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:f.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?Ni.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"duration",code:f.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?Ui(e.data,r.version)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"ip",code:f.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?Vi(e.data,r.alg)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"jwt",code:f.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?zi(e.data,r.version)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"cidr",code:f.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?Li.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"base64",code:f.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?Fi.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"base64url",code:f.invalid_string,message:r.message}),n.dirty()):R.assertNever(r);return{status:n.value,value:e.data}}_regex(e,n,s){return this.refinement(r=>e.test(r),d({validation:n,code:f.invalid_string},w.errToObj(s)))}_addCheck(e){return new me(x(d({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(d({kind:"email"},w.errToObj(e)))}url(e){return this._addCheck(d({kind:"url"},w.errToObj(e)))}emoji(e){return this._addCheck(d({kind:"emoji"},w.errToObj(e)))}uuid(e){return this._addCheck(d({kind:"uuid"},w.errToObj(e)))}nanoid(e){return this._addCheck(d({kind:"nanoid"},w.errToObj(e)))}cuid(e){return this._addCheck(d({kind:"cuid"},w.errToObj(e)))}cuid2(e){return this._addCheck(d({kind:"cuid2"},w.errToObj(e)))}ulid(e){return this._addCheck(d({kind:"ulid"},w.errToObj(e)))}base64(e){return this._addCheck(d({kind:"base64"},w.errToObj(e)))}base64url(e){return this._addCheck(d({kind:"base64url"},w.errToObj(e)))}jwt(e){return this._addCheck(d({kind:"jwt"},w.errToObj(e)))}ip(e){return this._addCheck(d({kind:"ip"},w.errToObj(e)))}cidr(e){return this._addCheck(d({kind:"cidr"},w.errToObj(e)))}datetime(e){var n,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(d({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!1},w.errToObj(e==null?void 0:e.message)))}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck(d({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision},w.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(d({kind:"duration"},w.errToObj(e)))}regex(e,n){return this._addCheck(d({kind:"regex",regex:e},w.errToObj(n)))}includes(e,n){return this._addCheck(d({kind:"includes",value:e,position:n==null?void 0:n.position},w.errToObj(n==null?void 0:n.message)))}startsWith(e,n){return this._addCheck(d({kind:"startsWith",value:e},w.errToObj(n)))}endsWith(e,n){return this._addCheck(d({kind:"endsWith",value:e},w.errToObj(n)))}min(e,n){return this._addCheck(d({kind:"min",value:e},w.errToObj(n)))}max(e,n){return this._addCheck(d({kind:"max",value:e},w.errToObj(n)))}length(e,n){return this._addCheck(d({kind:"length",value:e},w.errToObj(n)))}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new me(x(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new me(x(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new me(x(d({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}me.create=t=>{var e;return new me(d({checks:[],typeName:E.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},O(t)))};function Ki(t,e){const n=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=n>s?n:s,a=parseInt(t.toFixed(r).replace(".","")),i=parseInt(e.toFixed(r).replace(".",""));return a%i/Math.pow(10,r)}class Fe extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==v.number){const r=this._getOrReturnCtx(e);return y(r,{code:f.invalid_type,expected:v.number,received:r.parsedType}),S}let n;const s=new Y;for(const r of this._def.checks)r.kind==="int"?R.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.invalid_type,expected:"integer",received:"float",message:r.message}),s.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="multipleOf"?Ki(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_finite,message:r.message}),s.dirty()):R.assertNever(r);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,s,r){return new Fe(x(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:w.toString(r)}]}))}_addCheck(e){return new Fe(x(d({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&R.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Fe.create=t=>new Fe(d({checks:[],typeName:E.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1},O(t)));class $e extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(r){return this._getInvalidInput(e)}if(this._getType(e)!==v.bigint)return this._getInvalidInput(e);let n;const s=new Y;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):R.assertNever(r);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.bigint,received:n.parsedType}),S}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,s,r){return new $e(x(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:w.toString(r)}]}))}_addCheck(e){return new $e(x(d({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}$e.create=t=>{var e;return new $e(d({checks:[],typeName:E.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},O(t)))};class It extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==v.boolean){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.boolean,received:n.parsedType}),S}return ne(e.data)}}It.create=t=>new It(d({typeName:E.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1},O(t)));class Qe extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==v.date){const r=this._getOrReturnCtx(e);return y(r,{code:f.invalid_type,expected:v.date,received:r.parsedType}),S}if(isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return y(r,{code:f.invalid_date}),S}const n=new Y;let s;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:f.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:f.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):R.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qe(x(d({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Qe.create=t=>new Qe(d({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:E.ZodDate},O(t)));class hn extends T{_parse(e){if(this._getType(e)!==v.symbol){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.symbol,received:n.parsedType}),S}return ne(e.data)}}hn.create=t=>new hn(d({typeName:E.ZodSymbol},O(t)));class jt extends T{_parse(e){if(this._getType(e)!==v.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.undefined,received:n.parsedType}),S}return ne(e.data)}}jt.create=t=>new jt(d({typeName:E.ZodUndefined},O(t)));class Zt extends T{_parse(e){if(this._getType(e)!==v.null){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.null,received:n.parsedType}),S}return ne(e.data)}}Zt.create=t=>new Zt(d({typeName:E.ZodNull},O(t)));class gt extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return ne(e.data)}}gt.create=t=>new gt(d({typeName:E.ZodAny},O(t)));class Xe extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ne(e.data)}}Xe.create=t=>new Xe(d({typeName:E.ZodUnknown},O(t)));class Ie extends T{_parse(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.never,received:n.parsedType}),S}}Ie.create=t=>new Ie(d({typeName:E.ZodNever},O(t)));class pn extends T{_parse(e){if(this._getType(e)!==v.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.void,received:n.parsedType}),S}return ne(e.data)}}pn.create=t=>new pn(d({typeName:E.ZodVoid},O(t)));class ye extends T{_parse(e){const{ctx:n,status:s}=this._processInputParams(e),r=this._def;if(n.parsedType!==v.array)return y(n,{code:f.invalid_type,expected:v.array,received:n.parsedType}),S;if(r.exactLength!==null){const i=n.data.length>r.exactLength.value,o=n.data.length<r.exactLength.value;(i||o)&&(y(n,{code:i?f.too_big:f.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&n.data.length<r.minLength.value&&(y(n,{code:f.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&n.data.length>r.maxLength.value&&(y(n,{code:f.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>r.type._parseAsync(new xe(n,i,n.path,o)))).then(i=>Y.mergeArray(s,i));const a=[...n.data].map((i,o)=>r.type._parseSync(new xe(n,i,n.path,o)));return Y.mergeArray(s,a)}get element(){return this._def.type}min(e,n){return new ye(x(d({},this._def),{minLength:{value:e,message:w.toString(n)}}))}max(e,n){return new ye(x(d({},this._def),{maxLength:{value:e,message:w.toString(n)}}))}length(e,n){return new ye(x(d({},this._def),{exactLength:{value:e,message:w.toString(n)}}))}nonempty(e){return this.min(1,e)}}ye.create=(t,e)=>new ye(d({type:t,minLength:null,maxLength:null,exactLength:null,typeName:E.ZodArray},O(e)));function ct(t){if(t instanceof V){const e={};for(const n in t.shape){const s=t.shape[n];e[n]=ke.create(ct(s))}return new V(x(d({},t._def),{shape:()=>e}))}else return t instanceof ye?new ye(x(d({},t._def),{type:ct(t.element)})):t instanceof ke?ke.create(ct(t.unwrap())):t instanceof Ue?Ue.create(ct(t.unwrap())):t instanceof Se?Se.create(t.items.map(e=>ct(e))):t}class V extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=R.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==v.object){const c=this._getOrReturnCtx(e);return y(c,{code:f.invalid_type,expected:v.object,received:c.parsedType}),S}const{status:n,ctx:s}=this._processInputParams(e),{shape:r,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ie&&this._def.unknownKeys==="strip"))for(const c in s.data)a.includes(c)||i.push(c);const o=[];for(const c of a){const u=r[c],h=s.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new xe(s,h,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Ie){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of i)o.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")i.length>0&&(y(s,{code:f.unrecognized_keys,keys:i}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of i){const h=s.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new xe(s,h,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(()=>Ee(this,null,function*(){const c=[];for(const u of o){const h=yield u.key,p=yield u.value;c.push({key:h,value:p,alwaysSet:u.alwaysSet})}return c})).then(c=>Y.mergeObjectSync(n,c)):Y.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new V(d(x(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(n,s)=>{var r,a,i,o;const c=(i=(a=(r=this._def).errorMap)===null||a===void 0?void 0:a.call(r,n,s).message)!==null&&i!==void 0?i:s.defaultError;return n.code==="unrecognized_keys"?{message:(o=w.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}))}strip(){return new V(x(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new V(x(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new V(x(d({},this._def),{shape:()=>d(d({},this._def.shape()),e)}))}merge(e){return new V({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>d(d({},this._def.shape()),e._def.shape()),typeName:E.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new V(x(d({},this._def),{catchall:e}))}pick(e){const n={};return R.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(n[s]=this.shape[s])}),new V(x(d({},this._def),{shape:()=>n}))}omit(e){const n={};return R.objectKeys(this.shape).forEach(s=>{e[s]||(n[s]=this.shape[s])}),new V(x(d({},this._def),{shape:()=>n}))}deepPartial(){return ct(this)}partial(e){const n={};return R.objectKeys(this.shape).forEach(s=>{const r=this.shape[s];e&&!e[s]?n[s]=r:n[s]=r.optional()}),new V(x(d({},this._def),{shape:()=>n}))}required(e){const n={};return R.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])n[s]=this.shape[s];else{let r=this.shape[s];for(;r instanceof ke;)r=r._def.innerType;n[s]=r}}),new V(x(d({},this._def),{shape:()=>n}))}keyof(){return jr(R.objectKeys(this.shape))}}V.create=(t,e)=>new V(d({shape:()=>t,unknownKeys:"strip",catchall:Ie.create(),typeName:E.ZodObject},O(e)));V.strictCreate=(t,e)=>new V(d({shape:()=>t,unknownKeys:"strict",catchall:Ie.create(),typeName:E.ZodObject},O(e)));V.lazycreate=(t,e)=>new V(d({shape:t,unknownKeys:"strip",catchall:Ie.create(),typeName:E.ZodObject},O(e)));class Dt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),s=this._def.options;function r(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new oe(o.ctx.common.issues));return y(n,{code:f.invalid_union,unionErrors:i}),S}if(n.common.async)return Promise.all(s.map(a=>Ee(this,null,function*(){const i=x(d({},n),{common:x(d({},n.common),{issues:[]}),parent:null});return{result:yield a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}}))).then(r);{let a;const i=[];for(const c of s){const u=x(d({},n),{common:x(d({},n.common),{issues:[]}),parent:null}),h=c._parseSync({data:n.data,path:n.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new oe(c));return y(n,{code:f.invalid_union,unionErrors:o}),S}}get options(){return this._def.options}}Dt.create=(t,e)=>new Dt(d({options:t,typeName:E.ZodUnion},O(e)));const De=t=>t instanceof Ft?De(t.schema):t instanceof ge?De(t.innerType()):t instanceof $t?[t.value]:t instanceof We?t.options:t instanceof Wt?R.objectValues(t.enum):t instanceof Ut?De(t._def.innerType):t instanceof jt?[void 0]:t instanceof Zt?[null]:t instanceof ke?[void 0,...De(t.unwrap())]:t instanceof Ue?[null,...De(t.unwrap())]:t instanceof Cs||t instanceof zt?De(t.unwrap()):t instanceof Vt?De(t._def.innerType):[];class wn extends T{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==v.object)return y(n,{code:f.invalid_type,expected:v.object,received:n.parsedType}),S;const s=this.discriminator,r=n.data[s],a=this.optionsMap.get(r);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(y(n,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,s){const r=new Map;for(const a of n){const i=De(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,a)}}return new wn(d({typeName:E.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r},O(s)))}}function ns(t,e){const n=Ne(t),s=Ne(e);if(t===e)return{valid:!0,data:t};if(n===v.object&&s===v.object){const r=R.objectKeys(e),a=R.objectKeys(t).filter(o=>r.indexOf(o)!==-1),i=d(d({},t),e);for(const o of a){const c=ns(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(n===v.array&&s===v.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],c=ns(i,o);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return n===v.date&&s===v.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Mt extends T{_parse(e){const{status:n,ctx:s}=this._processInputParams(e),r=(a,i)=>{if(es(a)||es(i))return S;const o=ns(a.value,i.value);return o.valid?((ts(a)||ts(i))&&n.dirty(),{status:n.value,value:o.data}):(y(s,{code:f.invalid_intersection_types}),S)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>r(a,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Mt.create=(t,e,n)=>new Mt(d({left:t,right:e,typeName:E.ZodIntersection},O(n)));class Se extends T{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.array)return y(s,{code:f.invalid_type,expected:v.array,received:s.parsedType}),S;if(s.data.length<this._def.items.length)return y(s,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&s.data.length>this._def.items.length&&(y(s,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const r=[...s.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new xe(s,a,s.path,i)):null}).filter(a=>!!a);return s.common.async?Promise.all(r).then(a=>Y.mergeArray(n,a)):Y.mergeArray(n,r)}get items(){return this._def.items}rest(e){return new Se(x(d({},this._def),{rest:e}))}}Se.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Se(d({items:t,typeName:E.ZodTuple,rest:null},O(e)))};class Lt extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.object)return y(s,{code:f.invalid_type,expected:v.object,received:s.parsedType}),S;const r=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)r.push({key:a._parse(new xe(s,o,s.path,o)),value:i._parse(new xe(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Y.mergeObjectAsync(n,r):Y.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,s){return n instanceof T?new Lt(d({keyType:e,valueType:n,typeName:E.ZodRecord},O(s))):new Lt(d({keyType:me.create(),valueType:e,typeName:E.ZodRecord},O(n)))}}class mn extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.map)return y(s,{code:f.invalid_type,expected:v.map,received:s.parsedType}),S;const r=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,c],u)=>({key:r._parse(new xe(s,o,s.path,[u,"key"])),value:a._parse(new xe(s,c,s.path,[u,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(()=>Ee(this,null,function*(){for(const c of i){const u=yield c.key,h=yield c.value;if(u.status==="aborted"||h.status==="aborted")return S;(u.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(u.value,h.value)}return{status:n.value,value:o}}))}else{const o=new Map;for(const c of i){const u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return S;(u.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(u.value,h.value)}return{status:n.value,value:o}}}}mn.create=(t,e,n)=>new mn(d({valueType:e,keyType:t,typeName:E.ZodMap},O(n)));class et extends T{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==v.set)return y(s,{code:f.invalid_type,expected:v.set,received:s.parsedType}),S;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(y(s,{code:f.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),n.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(y(s,{code:f.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const a=this._def.valueType;function i(c){const u=new Set;for(const h of c){if(h.status==="aborted")return S;h.status==="dirty"&&n.dirty(),u.add(h.value)}return{status:n.value,value:u}}const o=[...s.data.values()].map((c,u)=>a._parse(new xe(s,c,s.path,u)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,n){return new et(x(d({},this._def),{minSize:{value:e,message:w.toString(n)}}))}max(e,n){return new et(x(d({},this._def),{maxSize:{value:e,message:w.toString(n)}}))}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}et.create=(t,e)=>new et(d({valueType:t,minSize:null,maxSize:null,typeName:E.ZodSet},O(e)));class ht extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==v.function)return y(n,{code:f.invalid_type,expected:v.function,received:n.parsedType}),S;function s(o,c){return dn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,un(),yt].filter(u=>!!u),issueData:{code:f.invalid_arguments,argumentsError:c}})}function r(o,c){return dn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,un(),yt].filter(u=>!!u),issueData:{code:f.invalid_return_type,returnTypeError:c}})}const a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof vt){const o=this;return ne(function(...c){return Ee(this,null,function*(){const u=new oe([]),h=yield o._def.args.parseAsync(c,a).catch(k=>{throw u.addIssue(s(c,k)),u}),p=yield Reflect.apply(i,this,h);return yield o._def.returns._def.type.parseAsync(p,a).catch(k=>{throw u.addIssue(r(p,k)),u})})})}else{const o=this;return ne(function(...c){const u=o._def.args.safeParse(c,a);if(!u.success)throw new oe([s(c,u.error)]);const h=Reflect.apply(i,this,u.data),p=o._def.returns.safeParse(h,a);if(!p.success)throw new oe([r(h,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ht(x(d({},this._def),{args:Se.create(e).rest(Xe.create())}))}returns(e){return new ht(x(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,s){return new ht(d({args:e||Se.create([]).rest(Xe.create()),returns:n||Xe.create(),typeName:E.ZodFunction},O(s)))}}class Ft extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Ft.create=(t,e)=>new Ft(d({getter:t,typeName:E.ZodLazy},O(e)));class $t extends T{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return y(n,{received:n.data,code:f.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}}$t.create=(t,e)=>new $t(d({value:t,typeName:E.ZodLiteral},O(e)));function jr(t,e){return new We(d({values:t,typeName:E.ZodEnum},O(e)))}class We extends T{constructor(){super(...arguments),Ot.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),s=this._def.values;return y(n,{expected:R.joinValues(s),received:n.parsedType,code:f.invalid_type}),S}if(fn(this,Ot)||Rr(this,Ot,new Set(this._def.values)),!fn(this,Ot).has(e.data)){const n=this._getOrReturnCtx(e),s=this._def.values;return y(n,{received:n.data,code:f.invalid_enum_value,options:s}),S}return ne(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return We.create(e,d(d({},this._def),n))}exclude(e,n=this._def){return We.create(this.options.filter(s=>!e.includes(s)),d(d({},this._def),n))}}Ot=new WeakMap;We.create=jr;class Wt extends T{constructor(){super(...arguments),Tt.set(this,void 0)}_parse(e){const n=R.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==v.string&&s.parsedType!==v.number){const r=R.objectValues(n);return y(s,{expected:R.joinValues(r),received:s.parsedType,code:f.invalid_type}),S}if(fn(this,Tt)||Rr(this,Tt,new Set(R.getValidEnumValues(this._def.values))),!fn(this,Tt).has(e.data)){const r=R.objectValues(n);return y(s,{received:s.data,code:f.invalid_enum_value,options:r}),S}return ne(e.data)}get enum(){return this._def.values}}Tt=new WeakMap;Wt.create=(t,e)=>new Wt(d({values:t,typeName:E.ZodNativeEnum},O(e)));class vt extends T{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==v.promise&&n.common.async===!1)return y(n,{code:f.invalid_type,expected:v.promise,received:n.parsedType}),S;const s=n.parsedType===v.promise?n.data:Promise.resolve(n.data);return ne(s.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}vt.create=(t,e)=>new vt(d({type:t,typeName:E.ZodPromise},O(e)));class ge extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===E.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:s}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:i=>{y(s,i),i.fatal?n.abort():n.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const i=r.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(o=>Ee(this,null,function*(){if(n.value==="aborted")return S;const c=yield this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?S:c.status==="dirty"||n.value==="dirty"?ln(c.value):c}));{if(n.value==="aborted")return S;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?S:o.status==="dirty"||n.value==="dirty"?ln(o.value):o}}if(r.type==="refinement"){const i=o=>{const c=r.refinement(o,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?S:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?S:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Ye(i))return i;const o=r.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>Ye(i)?Promise.resolve(r.transform(i.value,a)).then(o=>({status:n.value,value:o})):i);R.assertNever(r)}}ge.create=(t,e,n)=>new ge(d({schema:t,typeName:E.ZodEffects,effect:e},O(n)));ge.createWithPreprocess=(t,e,n)=>new ge(d({schema:e,effect:{type:"preprocess",transform:t},typeName:E.ZodEffects},O(n)));class ke extends T{_parse(e){return this._getType(e)===v.undefined?ne(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ke.create=(t,e)=>new ke(d({innerType:t,typeName:E.ZodOptional},O(e)));class Ue extends T{_parse(e){return this._getType(e)===v.null?ne(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ue.create=(t,e)=>new Ue(d({innerType:t,typeName:E.ZodNullable},O(e)));class Ut extends T{_parse(e){const{ctx:n}=this._processInputParams(e);let s=n.data;return n.parsedType===v.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Ut.create=(t,e)=>new Ut(d({innerType:t,typeName:E.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},O(e)));class Vt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),s=x(d({},n),{common:x(d({},n.common),{issues:[]})}),r=this._def.innerType._parse({data:s.data,path:s.path,parent:d({},s)});return Pt(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new oe(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Vt.create=(t,e)=>new Vt(d({innerType:t,typeName:E.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},O(e)));class yn extends T{_parse(e){if(this._getType(e)!==v.nan){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:v.nan,received:n.parsedType}),S}return{status:"valid",value:e.data}}}yn.create=t=>new yn(d({typeName:E.ZodNaN},O(t)));const Bi=Symbol("zod_brand");class Cs extends T{_parse(e){const{ctx:n}=this._processInputParams(e),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class Gt extends T{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.common.async)return Ee(this,null,function*(){const r=yield this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?S:r.status==="dirty"?(n.dirty(),ln(r.value)):this._def.out._parseAsync({data:r.value,path:s.path,parent:s})});{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?S:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,n){return new Gt({in:e,out:n,typeName:E.ZodPipeline})}}class zt extends T{_parse(e){const n=this._def.innerType._parse(e),s=r=>(Ye(r)&&(r.value=Object.freeze(r.value)),r);return Pt(n)?n.then(r=>s(r)):s(n)}unwrap(){return this._def.innerType}}zt.create=(t,e)=>new zt(d({innerType:t,typeName:E.ZodReadonly},O(e)));function sr(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Zr(t,e={},n){return t?gt.create().superRefine((s,r)=>{var a,i;const o=t(s);if(o instanceof Promise)return o.then(c=>{var u,h;if(!c){const p=sr(e,s),k=(h=(u=p.fatal)!==null&&u!==void 0?u:n)!==null&&h!==void 0?h:!0;r.addIssue(x(d({code:"custom"},p),{fatal:k}))}});if(!o){const c=sr(e,s),u=(i=(a=c.fatal)!==null&&a!==void 0?a:n)!==null&&i!==void 0?i:!0;r.addIssue(x(d({code:"custom"},c),{fatal:u}))}}):gt.create()}const qi={object:V.lazycreate};var E;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(E||(E={}));const Hi=(t,e={message:`Input not instance of ${t.name}`})=>Zr(n=>n instanceof t,e),Dr=me.create,Mr=Fe.create,Gi=yn.create,Ji=$e.create,Lr=It.create,Xi=Qe.create,Yi=hn.create,Qi=jt.create,eo=Zt.create,to=gt.create,no=Xe.create,so=Ie.create,ro=pn.create,ao=ye.create,io=V.create,oo=V.strictCreate,co=Dt.create,uo=wn.create,lo=Mt.create,fo=Se.create,ho=Lt.create,po=mn.create,mo=et.create,yo=ht.create,go=Ft.create,vo=$t.create,_o=We.create,bo=Wt.create,wo=vt.create,rr=ge.create,ko=ke.create,Eo=Ue.create,xo=ge.createWithPreprocess,So=Gt.create,Oo=()=>Dr().optional(),To=()=>Mr().optional(),Co=()=>Lr().optional(),Ao={string:t=>me.create(x(d({},t),{coerce:!0})),number:t=>Fe.create(x(d({},t),{coerce:!0})),boolean:t=>It.create(x(d({},t),{coerce:!0})),bigint:t=>$e.create(x(d({},t),{coerce:!0})),date:t=>Qe.create(x(d({},t),{coerce:!0}))},Ro=S;var j=Object.freeze({__proto__:null,defaultErrorMap:yt,setErrorMap:Ei,getErrorMap:un,makeIssue:dn,EMPTY_PATH:xi,addIssueToContext:y,ParseStatus:Y,INVALID:S,DIRTY:ln,OK:ne,isAborted:es,isDirty:ts,isValid:Ye,isAsync:Pt,get util(){return R},get objectUtil(){return Qn},ZodParsedType:v,getParsedType:Ne,ZodType:T,datetimeRegex:Ir,ZodString:me,ZodNumber:Fe,ZodBigInt:$e,ZodBoolean:It,ZodDate:Qe,ZodSymbol:hn,ZodUndefined:jt,ZodNull:Zt,ZodAny:gt,ZodUnknown:Xe,ZodNever:Ie,ZodVoid:pn,ZodArray:ye,ZodObject:V,ZodUnion:Dt,ZodDiscriminatedUnion:wn,ZodIntersection:Mt,ZodTuple:Se,ZodRecord:Lt,ZodMap:mn,ZodSet:et,ZodFunction:ht,ZodLazy:Ft,ZodLiteral:$t,ZodEnum:We,ZodNativeEnum:Wt,ZodPromise:vt,ZodEffects:ge,ZodTransformer:ge,ZodOptional:ke,ZodNullable:Ue,ZodDefault:Ut,ZodCatch:Vt,ZodNaN:yn,BRAND:Bi,ZodBranded:Cs,ZodPipeline:Gt,ZodReadonly:zt,custom:Zr,Schema:T,ZodSchema:T,late:qi,get ZodFirstPartyTypeKind(){return E},coerce:Ao,any:to,array:ao,bigint:Ji,boolean:Lr,date:Xi,discriminatedUnion:uo,effect:rr,enum:_o,function:yo,instanceof:Hi,intersection:lo,lazy:go,literal:vo,map:po,nan:Gi,nativeEnum:bo,never:so,null:eo,nullable:Eo,number:Mr,object:io,oboolean:Co,onumber:To,optional:ko,ostring:Oo,pipeline:So,preprocess:xo,promise:wo,record:ho,set:mo,strictObject:oo,string:Dr,symbol:Yi,transformer:rr,tuple:fo,undefined:Qi,union:co,unknown:no,void:ro,NEVER:Ro,ZodIssueCode:f,quotelessJson:ki,ZodError:oe});j.object({language:j.enum(["typescript","javascript"]).optional(),disableMarkedForExport:j.boolean().optional(),allowAutoSelectFirstNode:j.boolean().optional().default(!0)}).and(j.union([j.object({framework:j.literal("react"),model:j.string().optional(),styling:j.enum(["plain_css","css_modules","styled_components","tailwind","sass","scss","inline_styles"]),uiLibrary:j.enum(["mui","antd","radix","shadcn","clean_react"]).optional(),responsivePages:j.array(j.object({name:j.string(),framesId:j.array(j.string())})).optional(),enableUILibraryTheming:j.boolean().optional(),enableCompactStructure:j.boolean().optional(),enableDisplayScreenModelId:j.boolean().optional(),enableGeneratePackageLock:j.boolean().optional(),enableAnimationsPreset:j.boolean().optional(),enableAutoSplit:j.boolean().optional(),autoSplitThreshold:j.number().optional(),url:j.string().url().optional(),codegenSettings:j.record(j.unknown()).optional()}),j.object({framework:j.literal("html"),styling:j.enum(["plain_css","inline_styles","tailwind"]),enableTranslation:j.boolean().optional()})]));class ar extends Error{constructor(e,n){super(e),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}function In(t){}function No(t){if(typeof t=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");const{onEvent:e=In,onError:n=In,onRetry:s=In,onComment:r}=t;let a="",i=!0,o,c="",u="";function h(m){const _=i?m.replace(/^\xEF\xBB\xBF/,""):m,[l,A]=Po(`${a}${_}`);for(const I of l)p(I);a=A,i=!1}function p(m){if(m===""){g();return}if(m.startsWith(":")){r&&r(m.slice(m.startsWith(": ")?2:1));return}const _=m.indexOf(":");if(_!==-1){const l=m.slice(0,_),A=m[_+1]===" "?2:1,I=m.slice(_+A);k(l,I,m);return}k(m,"",m)}function k(m,_,l){switch(m){case"event":u=_;break;case"data":c=`${c}${_}
|
|
2
2
|
`;break;case"id":o=_.includes("\0")?void 0:_;break;case"retry":/^\d+$/.test(_)?s(parseInt(_,10)):n(new ar(`Invalid \`retry\` value: "${_}"`,{type:"invalid-retry",value:_,line:l}));break;default:n(new ar(`Unknown field "${m.length>20?`${m.slice(0,20)}…`:m}"`,{type:"unknown-field",field:m,value:_,line:l}));break}}function g(){c.length>0&&e({id:o,event:u||void 0,data:c.endsWith(`
|
|
3
3
|
`)?c.slice(0,-1):c}),o=void 0,c="",u=""}function b(m={}){a&&m.consume&&p(a),i=!0,o=void 0,c="",u="",a=""}return{feed:h,reset:b}}function Po(t){const e=[];let n="",s=0;for(;s<t.length;){const r=t.indexOf("\r",s),a=t.indexOf(`
|
|
4
4
|
`,s);let i=-1;if(r!==-1&&a!==-1?i=Math.min(r,a):r!==-1?i=r:a!==-1&&(i=a),i===-1){n=t.slice(s);break}else{const o=t.slice(s,i);e.push(o),s=i+1,t[s-1]==="\r"&&t[s]===`
|
|
5
|
-
`&&s++}}return[e,n]}class ir extends Event{constructor(e,n){var s,r;super(e),this.code=(s=n==null?void 0:n.code)!=null?s:void 0,this.message=(r=n==null?void 0:n.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,n,s){return s(or(this),n)}[Symbol.for("Deno.customInspect")](e,n){return e(or(this),n)}}function jo(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function ss(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(ss).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${ss(t.cause)}`:t.message:`${t}`}function or(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var $r=t=>{throw TypeError(t)},Cs=(t,e,n)=>e.has(t)||$r("Cannot "+n),A=(t,e,n)=>(Cs(t,e,"read from private field"),n?n.call(t):e.get(t)),H=(t,e,n)=>e.has(t)?$r("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),W=(t,e,n,s)=>(Cs(t,e,"write to private field"),e.set(t,n),n),Re=(t,e,n)=>(Cs(t,e,"access private method"),n),re,Je,ut,on,gn,Rt,ft,Nt,Me,dt,pt,lt,At,pe,rs,as,is,cr,os,cs,Ct,us,ds;class cn extends EventTarget{constructor(e,n){var s,r;super(),H(this,pe),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,H(this,re),H(this,Je),H(this,ut),H(this,on),H(this,gn),H(this,Rt),H(this,ft),H(this,Nt,null),H(this,Me),H(this,dt),H(this,pt,null),H(this,lt,null),H(this,At,null),H(this,as,a=>Ie(this,null,function*(){var i;A(this,dt).reset();const{body:o,redirected:c,status:u,headers:h}=a;if(u===204){Re(this,pe,Ct).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?W(this,ut,new URL(a.url)):W(this,ut,void 0),u!==200){Re(this,pe,Ct).call(this,`Non-200 status code (${u})`,u);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){Re(this,pe,Ct).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(A(this,re)===this.CLOSED)return;W(this,re,this.OPEN);const p=new Event("open");if((i=A(this,At))==null||i.call(this,p),this.dispatchEvent(p),typeof o!="object"||!o||!("getReader"in o)){Re(this,pe,Ct).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const k=new TextDecoder,g=o.getReader();let b=!0;do{const{done:m,value:_}=yield g.read();_&&A(this,dt).feed(k.decode(_,{stream:!m})),m&&(b=!1,A(this,dt).reset(),Re(this,pe,us).call(this))}while(b)})),H(this,is,a=>{W(this,Me,void 0),!(a.name==="AbortError"||a.type==="aborted")&&Re(this,pe,us).call(this,ss(a))}),H(this,os,a=>{typeof a.id=="string"&&W(this,Nt,a.id);const i=new MessageEvent(a.event||"message",{data:a.data,origin:A(this,ut)?A(this,ut).origin:A(this,Je).origin,lastEventId:a.id||""});A(this,lt)&&(!a.event||a.event==="message")&&A(this,lt).call(this,i),this.dispatchEvent(i)}),H(this,cs,a=>{W(this,Rt,a)}),H(this,ds,()=>{W(this,ft,void 0),A(this,re)===this.CONNECTING&&Re(this,pe,rs).call(this)});try{if(e instanceof URL)W(this,Je,e);else if(typeof e=="string")W(this,Je,new URL(e,Io()));else throw new Error("Invalid URL")}catch(a){throw jo("An invalid or illegal string was specified")}W(this,dt,No({onEvent:A(this,os),onRetry:A(this,cs)})),W(this,re,this.CONNECTING),W(this,Rt,3e3),W(this,gn,(s=n==null?void 0:n.fetch)!=null?s:globalThis.fetch),W(this,on,(r=n==null?void 0:n.withCredentials)!=null?r:!1),Re(this,pe,rs).call(this)}get readyState(){return A(this,re)}get url(){return A(this,Je).href}get withCredentials(){return A(this,on)}get onerror(){return A(this,pt)}set onerror(e){W(this,pt,e)}get onmessage(){return A(this,lt)}set onmessage(e){W(this,lt,e)}get onopen(){return A(this,At)}set onopen(e){W(this,At,e)}addEventListener(e,n,s){const r=n;super.addEventListener(e,r,s)}removeEventListener(e,n,s){const r=n;super.removeEventListener(e,r,s)}close(){A(this,ft)&&clearTimeout(A(this,ft)),A(this,re)!==this.CLOSED&&(A(this,Me)&&A(this,Me).abort(),W(this,re,this.CLOSED),W(this,Me,void 0))}}re=new WeakMap,Je=new WeakMap,ut=new WeakMap,on=new WeakMap,gn=new WeakMap,Rt=new WeakMap,ft=new WeakMap,Nt=new WeakMap,Me=new WeakMap,dt=new WeakMap,pt=new WeakMap,lt=new WeakMap,At=new WeakMap,pe=new WeakSet,rs=function(){W(this,re,this.CONNECTING),W(this,Me,new AbortController),A(this,gn)(A(this,Je),Re(this,pe,cr).call(this)).then(A(this,as)).catch(A(this,is))},as=new WeakMap,is=new WeakMap,cr=function(){var t;const e={mode:"cors",redirect:"follow",headers:Be({Accept:"text/event-stream"},A(this,Nt)?{"Last-Event-ID":A(this,Nt)}:void 0),cache:"no-store",signal:(t=A(this,Me))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},os=new WeakMap,cs=new WeakMap,Ct=function(t,e){var n;A(this,re)!==this.CLOSED&&W(this,re,this.CLOSED);const s=new ir("error",{code:e,message:t});(n=A(this,pt))==null||n.call(this,s),this.dispatchEvent(s)},us=function(t,e){var n;if(A(this,re)===this.CLOSED)return;W(this,re,this.CONNECTING);const s=new ir("error",{code:e,message:t});(n=A(this,pt))==null||n.call(this,s),this.dispatchEvent(s),W(this,ft,setTimeout(A(this,ds),A(this,Rt)))},ds=new WeakMap,cn.CONNECTING=0,cn.OPEN=1,cn.CLOSED=2;function Io(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var Fr=Symbol.for("immer-nothing"),ur=Symbol.for("immer-draftable"),ce=Symbol.for("immer-state"),Zo=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function ae(t,...e){if(process.env.NODE_ENV!=="production"){const n=Zo[t],s=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${s}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var _t=Object.getPrototypeOf;function bt(t){return!!t&&!!t[ce]}function tt(t){var e;return t?Wr(t)||Array.isArray(t)||!!t[ur]||!!((e=t.constructor)!=null&&e[ur])||En(t)||xn(t):!1}var Do=Object.prototype.constructor.toString();function Wr(t){if(!t||typeof t!="object")return!1;const e=_t(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Do}function vn(t,e){kn(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,s)=>e(s,n,t))}function kn(t){const e=t[ce];return e?e.type_:Array.isArray(t)?1:En(t)?2:xn(t)?3:0}function ls(t,e){return kn(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Ur(t,e,n){const s=kn(t);s===2?t.set(e,n):s===3?t.add(n):t[e]=n}function Mo(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function En(t){return t instanceof Map}function xn(t){return t instanceof Set}function qe(t){return t.copy_||t.base_}function fs(t,e){if(En(t))return new Map(t);if(xn(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Wr(t);if(e===!0||e==="class_only"&&!n){const s=Object.getOwnPropertyDescriptors(t);delete s[ce];let r=Reflect.ownKeys(s);for(let a=0;a<r.length;a++){const i=r[a],o=s[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(s[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[i]})}return Object.create(_t(t),s)}else{const s=_t(t);if(s!==null&&n)return Be({},t);const r=Object.create(s);return Object.assign(r,t)}}function Kt(t,e=!1){return Sn(t)||bt(t)||!tt(t)||(kn(t)>1&&(t.set=t.add=t.clear=t.delete=Lo),Object.freeze(t),e&&Object.entries(t).forEach(([n,s])=>Kt(s,!0))),t}function Lo(){ae(2)}function Sn(t){return Object.isFrozen(t)}var $o={};function nt(t){const e=$o[t];return e||ae(0,t),e}var Bt;function Vr(){return Bt}function Fo(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function dr(t,e){e&&(nt("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function hs(t){ps(t),t.drafts_.forEach(Wo),t.drafts_=null}function ps(t){t===Bt&&(Bt=t.parent_)}function lr(t){return Bt=Fo(Bt,t)}function Wo(t){const e=t[ce];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function fr(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[ce].modified_&&(hs(e),ae(4)),tt(t)&&(t=_n(e,t),e.parent_||bn(e,t)),e.patches_&&nt("Patches").generateReplacementPatches_(n[ce].base_,t,e.patches_,e.inversePatches_)):t=_n(e,n,[]),hs(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Fr?t:void 0}function _n(t,e,n){if(Sn(e))return e;const s=e[ce];if(!s)return vn(e,(r,a)=>hr(t,s,e,r,a,n)),e;if(s.scope_!==t)return e;if(!s.modified_)return bn(t,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;const r=s.copy_;let a=r,i=!1;s.type_===3&&(a=new Set(r),r.clear(),i=!0),vn(a,(o,c)=>hr(t,s,r,o,c,n,i)),bn(t,r,!1),n&&t.patches_&&nt("Patches").generatePatches_(s,n,t.patches_,t.inversePatches_)}return s.copy_}function hr(t,e,n,s,r,a,i){if(process.env.NODE_ENV!=="production"&&r===n&&ae(5),bt(r)){const o=a&&e&&e.type_!==3&&!ls(e.assigned_,s)?a.concat(s):void 0,c=_n(t,r,o);if(Ur(n,s,c),bt(c))t.canAutoFreeze_=!1;else return}else i&&n.add(r);if(tt(r)&&!Sn(r)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;_n(t,r),(!e||!e.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,s)&&bn(t,r)}}function bn(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Kt(e,n)}function Uo(t,e){const n=Array.isArray(t),s={type_:n?1:0,scope_:e?e.scope_:Vr(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=s,a=Rs;n&&(r=[s],a=qt);const{revoke:i,proxy:o}=Proxy.revocable(r,a);return s.draft_=o,s.revoke_=i,o}var Rs={get(t,e){if(e===ce)return t;const n=qe(t);if(!ls(n,e))return Vo(t,n,e);const s=n[e];return t.finalized_||!tt(s)?s:s===In(t.base_,e)?(Zn(t),t.copy_[e]=ys(s,t)):s},has(t,e){return e in qe(t)},ownKeys(t){return Reflect.ownKeys(qe(t))},set(t,e,n){const s=zr(qe(t),e);if(s!=null&&s.set)return s.set.call(t.draft_,n),!0;if(!t.modified_){const r=In(qe(t),e),a=r==null?void 0:r[ce];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Mo(n,r)&&(n!==void 0||ls(t.base_,e)))return!0;Zn(t),ms(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return In(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Zn(t),ms(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=qe(t),s=Reflect.getOwnPropertyDescriptor(n,e);return s&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:s.enumerable,value:n[e]}},defineProperty(){ae(11)},getPrototypeOf(t){return _t(t.base_)},setPrototypeOf(){ae(12)}},qt={};vn(Rs,(t,e)=>{qt[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});qt.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&ae(13),qt.set.call(this,t,e,void 0)};qt.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&ae(14),Rs.set.call(this,t[0],e,n,t[0])};function In(t,e){const n=t[ce];return(n?qe(n):t)[e]}function Vo(t,e,n){var r;const s=zr(e,n);return s?"value"in s?s.value:(r=s.get)==null?void 0:r.call(t.draft_):void 0}function zr(t,e){if(!(e in t))return;let n=_t(t);for(;n;){const s=Object.getOwnPropertyDescriptor(n,e);if(s)return s;n=_t(n)}}function ms(t){t.modified_||(t.modified_=!0,t.parent_&&ms(t.parent_))}function Zn(t){t.copy_||(t.copy_=fs(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var zo=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,s)=>{if(typeof e=="function"&&typeof n!="function"){const a=n;n=e;const i=this;return function(c=a,...u){return i.produce(c,h=>n.call(this,h,...u))}}typeof n!="function"&&ae(6),s!==void 0&&typeof s!="function"&&ae(7);let r;if(tt(e)){const a=lr(this),i=ys(e,void 0);let o=!0;try{r=n(i),o=!1}finally{o?hs(a):ps(a)}return dr(a,s),fr(r,a)}else if(!e||typeof e!="object"){if(r=n(e),r===void 0&&(r=e),r===Fr&&(r=void 0),this.autoFreeze_&&Kt(r,!0),s){const a=[],i=[];nt("Patches").generateReplacementPatches_(e,r,a,i),s(a,i)}return r}else ae(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(i,...o)=>this.produceWithPatches(i,c=>e(c,...o));let s,r;return[this.produce(e,n,(i,o)=>{s=i,r=o}),s,r]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){tt(t)||ae(8),bt(t)&&(t=Ko(t));const e=lr(this),n=ys(t,void 0);return n[ce].isManual_=!0,ps(e),n}finishDraft(t,e){const n=t&&t[ce];(!n||!n.isManual_)&&ae(9);const{scope_:s}=n;return dr(s,e),fr(void 0,s)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const r=e[n];if(r.path.length===0&&r.op==="replace"){t=r.value;break}}n>-1&&(e=e.slice(n+1));const s=nt("Patches").applyPatches_;return bt(t)?s(t,e):this.produce(t,r=>s(r,e))}};function ys(t,e){const n=En(t)?nt("MapSet").proxyMap_(t,e):xn(t)?nt("MapSet").proxySet_(t,e):Uo(t,e);return(e?e.scope_:Vr()).drafts_.push(n),n}function Ko(t){return bt(t)||ae(10,t),Kr(t)}function Kr(t){if(!tt(t)||Sn(t))return t;const e=t[ce];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=fs(t,e.scope_.immer_.useStrictShallowCopy_)}else n=fs(t,!0);return vn(n,(s,r)=>{Ur(n,s,Kr(r))}),e&&(e.finalized_=!1),n}var ue=new zo,Bo=ue.produce;ue.produceWithPatches.bind(ue);ue.setAutoFreeze.bind(ue);ue.setUseStrictShallowCopy.bind(ue);ue.applyPatches.bind(ue);ue.createDraft.bind(ue);ue.finishDraft.bind(ue);function qo(t){var e=U.useState(function(){return Kt(typeof t=="function"?t():t,!0)}),n=e[1];return[e[0],U.useCallback(function(s){n(typeof s=="function"?Bo(s):Kt(s))},[])]}const pr=10,mr={status:"idle",error:null,result:null,tasks:{fetchDesign:{status:"pending"},codeGeneration:{status:"pending",progress:0},uploadAssets:{status:"pending"}}},yr=t=>"path"in t?{filePath:t.path.replace(/^\//,""),referencePath:t.path==="/"?"":t.path}:{filePath:t.filePath.replace(/^\//,""),referencePath:t.referencePath==="/"?"":t.referencePath},Ho=({url:t,method:e="POST"})=>{const[n,s]=qo(mr);return{getCode:a=>Ie(exports,null,function*(){var h,p,k;s(g=>{g.status="pending",g.error=null,g.result=null,g.tasks=mr.tasks});const i=structuredClone(a);if(((h=a.assetsStorage)==null?void 0:h.strategy)==="local"){const{referencePath:g}=yr(a.assetsStorage);a.assetsStorage={strategy:"external",url:g}}let o;const c=new cn(t,{fetch:(g,b)=>(o=fetch(g,zs(Be({},b),{method:e,body:JSON.stringify(a)})),o)}),u=new Promise(g=>{const b={};c.addEventListener("start",_=>{const l=JSON.parse(_.data);b.sessionId=l.sessionId,s(C=>{C.tasks.fetchDesign.status="running"})}),c.addEventListener("pre_codegen",_=>{JSON.parse(_.data).message==="Anima model built"&&s(C=>{C.tasks.fetchDesign.status="finished",C.tasks.codeGeneration.status="running",C.tasks.uploadAssets.status="running"})}),c.addEventListener("figma_metadata",_=>{const l=JSON.parse(_.data);b.figmaFileName=l.figmaFileName,b.figmaSelectedFrameName=l.figmaSelectedFrameName}),c.addEventListener("aborted",()=>{const _=new qs({name:"Aborted",reason:"Unknown"});s(l=>{l.status="aborted",l.result=null,l.error=_}),g({result:null,error:_})}),c.addEventListener("generating_code",_=>{const l=JSON.parse(_.data);l.payload.status==="success"&&(b.files=l.payload.files),s(C=>{C.tasks.codeGeneration.progress=l.payload.progress,C.tasks.codeGeneration.status="running"})}),c.addEventListener("codegen_completed",()=>{s(_=>{_.tasks.codeGeneration.status="finished"})}),c.addEventListener("generation_completed",()=>{s(_=>{_.tasks.codeGeneration.status="finished"})}),c.addEventListener("assets_uploaded",()=>{s(_=>{_.tasks.uploadAssets.status="finished"})}),c.addEventListener("assets_list",_=>{const l=JSON.parse(_.data);b.assets=l.payload.assets});let m=0;c.addEventListener("error",_=>Ie(exports,null,function*(){var M,K,D;console.warn(`Experienced error during code generation (attempt ${m+1} / ${pr})`,_);let l,C=!1;try{_ instanceof MessageEvent?l=JSON.parse(_.data):l=yield(yield o).json(),((M=l==null?void 0:l.payload)==null?void 0:M.name)==="Task Crashed"&&(C=!0)}catch(P){}const j=new qs({name:(K=l==null?void 0:l.payload.name)!=null?K:"Unknown error",reason:(D=l==null?void 0:l.payload.message)!=null?D:"Unknown",status:l==null?void 0:l.payload.status,detail:l==null?void 0:l.payload.detail});m++;let z=!1;m>pr?(console.error("Experienced too many errors, terminating request"),z=!0):C&&(console.error("Experienced unrecoverable error, terminating request"),z=!0),z&&(s(P=>{P.status="error",P.error=j}),g({result:null,error:j}))})),c.addEventListener("done",_=>{const l=JSON.parse(_.data);b.tokenUsage=l.payload.tokenUsage,b.sessionId=l.payload.sessionId,s(C=>{C.status="success",C.result=b}),g({result:b,error:null})})});try{const{result:g,error:b}=yield u,m=structuredClone(g);if(((p=i.assetsStorage)==null?void 0:p.strategy)==="local"&&((k=m==null?void 0:m.assets)!=null&&k.length)){const{filePath:_}=yr(i.assetsStorage),l=m.assets.map(j=>Ie(exports,null,function*(){const M=yield(yield fetch(j.url)).arrayBuffer();return{assetName:j.name,base64:ua(M)}})),C=yield Promise.allSettled(l);for(const j of C){const z={};if(j.status==="fulfilled"){const{assetName:M,base64:K}=j.value;z[M]=K;const D=_?`${_}/${M}`:M;m.files[D]={content:K,isBinary:!0}}}}return b?{result:null,error:b}:{result:m,error:b}}finally{c.close()}}),status:n.status,tasks:n.tasks,error:n.error,result:n.result}};var en={exports:{}},Dn={};/**
|
|
5
|
+
`&&s++}}return[e,n]}class ir extends Event{constructor(e,n){var s,r;super(e),this.code=(s=n==null?void 0:n.code)!=null?s:void 0,this.message=(r=n==null?void 0:n.message)!=null?r:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,n,s){return s(or(this),n)}[Symbol.for("Deno.customInspect")](e,n){return e(or(this),n)}}function Io(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function ss(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(ss).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${ss(t.cause)}`:t.message:`${t}`}function or(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Fr=t=>{throw TypeError(t)},As=(t,e,n)=>e.has(t)||Fr("Cannot "+n),C=(t,e,n)=>(As(t,e,"read from private field"),n?n.call(t):e.get(t)),H=(t,e,n)=>e.has(t)?Fr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),W=(t,e,n,s)=>(As(t,e,"write to private field"),e.set(t,n),n),Re=(t,e,n)=>(As(t,e,"access private method"),n),re,Je,ut,on,gn,Rt,ft,Nt,Me,dt,pt,lt,Ct,pe,rs,as,is,cr,os,cs,At,us,ds;class cn extends EventTarget{constructor(e,n){var s,r;super(),H(this,pe),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,H(this,re),H(this,Je),H(this,ut),H(this,on),H(this,gn),H(this,Rt),H(this,ft),H(this,Nt,null),H(this,Me),H(this,dt),H(this,pt,null),H(this,lt,null),H(this,Ct,null),H(this,as,a=>je(this,null,function*(){var i;C(this,dt).reset();const{body:o,redirected:c,status:u,headers:h}=a;if(u===204){Re(this,pe,At).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(c?W(this,ut,new URL(a.url)):W(this,ut,void 0),u!==200){Re(this,pe,At).call(this,`Non-200 status code (${u})`,u);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){Re(this,pe,At).call(this,'Invalid content type, expected "text/event-stream"',u);return}if(C(this,re)===this.CLOSED)return;W(this,re,this.OPEN);const p=new Event("open");if((i=C(this,Ct))==null||i.call(this,p),this.dispatchEvent(p),typeof o!="object"||!o||!("getReader"in o)){Re(this,pe,At).call(this,"Invalid response body, expected a web ReadableStream",u),this.close();return}const k=new TextDecoder,g=o.getReader();let b=!0;do{const{done:m,value:_}=yield g.read();_&&C(this,dt).feed(k.decode(_,{stream:!m})),m&&(b=!1,C(this,dt).reset(),Re(this,pe,us).call(this))}while(b)})),H(this,is,a=>{W(this,Me,void 0),!(a.name==="AbortError"||a.type==="aborted")&&Re(this,pe,us).call(this,ss(a))}),H(this,os,a=>{typeof a.id=="string"&&W(this,Nt,a.id);const i=new MessageEvent(a.event||"message",{data:a.data,origin:C(this,ut)?C(this,ut).origin:C(this,Je).origin,lastEventId:a.id||""});C(this,lt)&&(!a.event||a.event==="message")&&C(this,lt).call(this,i),this.dispatchEvent(i)}),H(this,cs,a=>{W(this,Rt,a)}),H(this,ds,()=>{W(this,ft,void 0),C(this,re)===this.CONNECTING&&Re(this,pe,rs).call(this)});try{if(e instanceof URL)W(this,Je,e);else if(typeof e=="string")W(this,Je,new URL(e,jo()));else throw new Error("Invalid URL")}catch(a){throw Io("An invalid or illegal string was specified")}W(this,dt,No({onEvent:C(this,os),onRetry:C(this,cs)})),W(this,re,this.CONNECTING),W(this,Rt,3e3),W(this,gn,(s=n==null?void 0:n.fetch)!=null?s:globalThis.fetch),W(this,on,(r=n==null?void 0:n.withCredentials)!=null?r:!1),Re(this,pe,rs).call(this)}get readyState(){return C(this,re)}get url(){return C(this,Je).href}get withCredentials(){return C(this,on)}get onerror(){return C(this,pt)}set onerror(e){W(this,pt,e)}get onmessage(){return C(this,lt)}set onmessage(e){W(this,lt,e)}get onopen(){return C(this,Ct)}set onopen(e){W(this,Ct,e)}addEventListener(e,n,s){const r=n;super.addEventListener(e,r,s)}removeEventListener(e,n,s){const r=n;super.removeEventListener(e,r,s)}close(){C(this,ft)&&clearTimeout(C(this,ft)),C(this,re)!==this.CLOSED&&(C(this,Me)&&C(this,Me).abort(),W(this,re,this.CLOSED),W(this,Me,void 0))}}re=new WeakMap,Je=new WeakMap,ut=new WeakMap,on=new WeakMap,gn=new WeakMap,Rt=new WeakMap,ft=new WeakMap,Nt=new WeakMap,Me=new WeakMap,dt=new WeakMap,pt=new WeakMap,lt=new WeakMap,Ct=new WeakMap,pe=new WeakSet,rs=function(){W(this,re,this.CONNECTING),W(this,Me,new AbortController),C(this,gn)(C(this,Je),Re(this,pe,cr).call(this)).then(C(this,as)).catch(C(this,is))},as=new WeakMap,is=new WeakMap,cr=function(){var t;const e={mode:"cors",redirect:"follow",headers:Be({Accept:"text/event-stream"},C(this,Nt)?{"Last-Event-ID":C(this,Nt)}:void 0),cache:"no-store",signal:(t=C(this,Me))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},os=new WeakMap,cs=new WeakMap,At=function(t,e){var n;C(this,re)!==this.CLOSED&&W(this,re,this.CLOSED);const s=new ir("error",{code:e,message:t});(n=C(this,pt))==null||n.call(this,s),this.dispatchEvent(s)},us=function(t,e){var n;if(C(this,re)===this.CLOSED)return;W(this,re,this.CONNECTING);const s=new ir("error",{code:e,message:t});(n=C(this,pt))==null||n.call(this,s),this.dispatchEvent(s),W(this,ft,setTimeout(C(this,ds),C(this,Rt)))},ds=new WeakMap,cn.CONNECTING=0,cn.OPEN=1,cn.CLOSED=2;function jo(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var $r=Symbol.for("immer-nothing"),ur=Symbol.for("immer-draftable"),ce=Symbol.for("immer-state"),Zo=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function ae(t,...e){if(process.env.NODE_ENV!=="production"){const n=Zo[t],s=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${s}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var _t=Object.getPrototypeOf;function bt(t){return!!t&&!!t[ce]}function tt(t){var e;return t?Wr(t)||Array.isArray(t)||!!t[ur]||!!((e=t.constructor)!=null&&e[ur])||En(t)||xn(t):!1}var Do=Object.prototype.constructor.toString();function Wr(t){if(!t||typeof t!="object")return!1;const e=_t(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Do}function vn(t,e){kn(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,s)=>e(s,n,t))}function kn(t){const e=t[ce];return e?e.type_:Array.isArray(t)?1:En(t)?2:xn(t)?3:0}function ls(t,e){return kn(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function Ur(t,e,n){const s=kn(t);s===2?t.set(e,n):s===3?t.add(n):t[e]=n}function Mo(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function En(t){return t instanceof Map}function xn(t){return t instanceof Set}function qe(t){return t.copy_||t.base_}function fs(t,e){if(En(t))return new Map(t);if(xn(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Wr(t);if(e===!0||e==="class_only"&&!n){const s=Object.getOwnPropertyDescriptors(t);delete s[ce];let r=Reflect.ownKeys(s);for(let a=0;a<r.length;a++){const i=r[a],o=s[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(s[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[i]})}return Object.create(_t(t),s)}else{const s=_t(t);if(s!==null&&n)return Be({},t);const r=Object.create(s);return Object.assign(r,t)}}function Kt(t,e=!1){return Sn(t)||bt(t)||!tt(t)||(kn(t)>1&&(t.set=t.add=t.clear=t.delete=Lo),Object.freeze(t),e&&Object.entries(t).forEach(([n,s])=>Kt(s,!0))),t}function Lo(){ae(2)}function Sn(t){return Object.isFrozen(t)}var Fo={};function nt(t){const e=Fo[t];return e||ae(0,t),e}var Bt;function Vr(){return Bt}function $o(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function dr(t,e){e&&(nt("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function hs(t){ps(t),t.drafts_.forEach(Wo),t.drafts_=null}function ps(t){t===Bt&&(Bt=t.parent_)}function lr(t){return Bt=$o(Bt,t)}function Wo(t){const e=t[ce];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function fr(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[ce].modified_&&(hs(e),ae(4)),tt(t)&&(t=_n(e,t),e.parent_||bn(e,t)),e.patches_&&nt("Patches").generateReplacementPatches_(n[ce].base_,t,e.patches_,e.inversePatches_)):t=_n(e,n,[]),hs(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==$r?t:void 0}function _n(t,e,n){if(Sn(e))return e;const s=e[ce];if(!s)return vn(e,(r,a)=>hr(t,s,e,r,a,n)),e;if(s.scope_!==t)return e;if(!s.modified_)return bn(t,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;const r=s.copy_;let a=r,i=!1;s.type_===3&&(a=new Set(r),r.clear(),i=!0),vn(a,(o,c)=>hr(t,s,r,o,c,n,i)),bn(t,r,!1),n&&t.patches_&&nt("Patches").generatePatches_(s,n,t.patches_,t.inversePatches_)}return s.copy_}function hr(t,e,n,s,r,a,i){if(process.env.NODE_ENV!=="production"&&r===n&&ae(5),bt(r)){const o=a&&e&&e.type_!==3&&!ls(e.assigned_,s)?a.concat(s):void 0,c=_n(t,r,o);if(Ur(n,s,c),bt(c))t.canAutoFreeze_=!1;else return}else i&&n.add(r);if(tt(r)&&!Sn(r)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;_n(t,r),(!e||!e.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,s)&&bn(t,r)}}function bn(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Kt(e,n)}function Uo(t,e){const n=Array.isArray(t),s={type_:n?1:0,scope_:e?e.scope_:Vr(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let r=s,a=Rs;n&&(r=[s],a=qt);const{revoke:i,proxy:o}=Proxy.revocable(r,a);return s.draft_=o,s.revoke_=i,o}var Rs={get(t,e){if(e===ce)return t;const n=qe(t);if(!ls(n,e))return Vo(t,n,e);const s=n[e];return t.finalized_||!tt(s)?s:s===jn(t.base_,e)?(Zn(t),t.copy_[e]=ys(s,t)):s},has(t,e){return e in qe(t)},ownKeys(t){return Reflect.ownKeys(qe(t))},set(t,e,n){const s=zr(qe(t),e);if(s!=null&&s.set)return s.set.call(t.draft_,n),!0;if(!t.modified_){const r=jn(qe(t),e),a=r==null?void 0:r[ce];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Mo(n,r)&&(n!==void 0||ls(t.base_,e)))return!0;Zn(t),ms(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return jn(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Zn(t),ms(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=qe(t),s=Reflect.getOwnPropertyDescriptor(n,e);return s&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:s.enumerable,value:n[e]}},defineProperty(){ae(11)},getPrototypeOf(t){return _t(t.base_)},setPrototypeOf(){ae(12)}},qt={};vn(Rs,(t,e)=>{qt[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});qt.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&ae(13),qt.set.call(this,t,e,void 0)};qt.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&ae(14),Rs.set.call(this,t[0],e,n,t[0])};function jn(t,e){const n=t[ce];return(n?qe(n):t)[e]}function Vo(t,e,n){var r;const s=zr(e,n);return s?"value"in s?s.value:(r=s.get)==null?void 0:r.call(t.draft_):void 0}function zr(t,e){if(!(e in t))return;let n=_t(t);for(;n;){const s=Object.getOwnPropertyDescriptor(n,e);if(s)return s;n=_t(n)}}function ms(t){t.modified_||(t.modified_=!0,t.parent_&&ms(t.parent_))}function Zn(t){t.copy_||(t.copy_=fs(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var zo=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,s)=>{if(typeof e=="function"&&typeof n!="function"){const a=n;n=e;const i=this;return function(c=a,...u){return i.produce(c,h=>n.call(this,h,...u))}}typeof n!="function"&&ae(6),s!==void 0&&typeof s!="function"&&ae(7);let r;if(tt(e)){const a=lr(this),i=ys(e,void 0);let o=!0;try{r=n(i),o=!1}finally{o?hs(a):ps(a)}return dr(a,s),fr(r,a)}else if(!e||typeof e!="object"){if(r=n(e),r===void 0&&(r=e),r===$r&&(r=void 0),this.autoFreeze_&&Kt(r,!0),s){const a=[],i=[];nt("Patches").generateReplacementPatches_(e,r,a,i),s(a,i)}return r}else ae(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(i,...o)=>this.produceWithPatches(i,c=>e(c,...o));let s,r;return[this.produce(e,n,(i,o)=>{s=i,r=o}),s,r]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){tt(t)||ae(8),bt(t)&&(t=Ko(t));const e=lr(this),n=ys(t,void 0);return n[ce].isManual_=!0,ps(e),n}finishDraft(t,e){const n=t&&t[ce];(!n||!n.isManual_)&&ae(9);const{scope_:s}=n;return dr(s,e),fr(void 0,s)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const r=e[n];if(r.path.length===0&&r.op==="replace"){t=r.value;break}}n>-1&&(e=e.slice(n+1));const s=nt("Patches").applyPatches_;return bt(t)?s(t,e):this.produce(t,r=>s(r,e))}};function ys(t,e){const n=En(t)?nt("MapSet").proxyMap_(t,e):xn(t)?nt("MapSet").proxySet_(t,e):Uo(t,e);return(e?e.scope_:Vr()).drafts_.push(n),n}function Ko(t){return bt(t)||ae(10,t),Kr(t)}function Kr(t){if(!tt(t)||Sn(t))return t;const e=t[ce];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=fs(t,e.scope_.immer_.useStrictShallowCopy_)}else n=fs(t,!0);return vn(n,(s,r)=>{Ur(n,s,Kr(r))}),e&&(e.finalized_=!1),n}var ue=new zo,Bo=ue.produce;ue.produceWithPatches.bind(ue);ue.setAutoFreeze.bind(ue);ue.setUseStrictShallowCopy.bind(ue);ue.applyPatches.bind(ue);ue.createDraft.bind(ue);ue.finishDraft.bind(ue);function qo(t){var e=U.useState(function(){return Kt(typeof t=="function"?t():t,!0)}),n=e[1];return[e[0],U.useCallback(function(s){n(typeof s=="function"?Bo(s):Kt(s))},[])]}const pr=10,mr={status:"idle",error:null,result:null,tasks:{fetchDesign:{status:"pending"},codeGeneration:{status:"pending",progress:0},uploadAssets:{status:"pending"}}},yr=t=>"path"in t?{filePath:t.path.replace(/^\//,""),referencePath:t.path==="/"?"":t.path}:{filePath:t.filePath.replace(/^\//,""),referencePath:t.referencePath==="/"?"":t.referencePath},Ho=({url:t,method:e="POST"})=>{const[n,s]=qo(mr);return{getCode:a=>je(exports,null,function*(){var h,p,k;s(g=>{g.status="pending",g.error=null,g.result=null,g.tasks=mr.tasks});const i=structuredClone(a);if(((h=a.assetsStorage)==null?void 0:h.strategy)==="local"){const{referencePath:g}=yr(a.assetsStorage);a.assetsStorage={strategy:"external",url:g}}let o;const c=new cn(t,{fetch:(g,b)=>(o=fetch(g,zs(Be({},b),{method:e,body:JSON.stringify(a)})),o)}),u=new Promise(g=>{const b={};c.addEventListener("start",_=>{const l=JSON.parse(_.data);b.sessionId=l.sessionId,s(A=>{A.tasks.fetchDesign.status="running"})}),c.addEventListener("pre_codegen",_=>{JSON.parse(_.data).message==="Anima model built"&&s(A=>{A.tasks.fetchDesign.status="finished",A.tasks.codeGeneration.status="running",A.tasks.uploadAssets.status="running"})}),c.addEventListener("figma_metadata",_=>{const l=JSON.parse(_.data);b.figmaFileName=l.figmaFileName,b.figmaSelectedFrameName=l.figmaSelectedFrameName}),c.addEventListener("aborted",()=>{const _=new qs({name:"Aborted",reason:"Unknown"});s(l=>{l.status="aborted",l.result=null,l.error=_}),g({result:null,error:_})}),c.addEventListener("generating_code",_=>{const l=JSON.parse(_.data);l.payload.status==="success"&&(b.files=l.payload.files),s(A=>{A.tasks.codeGeneration.progress=l.payload.progress,A.tasks.codeGeneration.status="running"})}),c.addEventListener("codegen_completed",()=>{s(_=>{_.tasks.codeGeneration.status="finished"})}),c.addEventListener("generation_completed",()=>{s(_=>{_.tasks.codeGeneration.status="finished"})}),c.addEventListener("assets_uploaded",()=>{s(_=>{_.tasks.uploadAssets.status="finished"})}),c.addEventListener("assets_list",_=>{const l=JSON.parse(_.data);b.assets=l.payload.assets});let m=0;c.addEventListener("error",_=>je(exports,null,function*(){var M,K,D;console.warn(`Experienced error during code generation (attempt ${m+1} / ${pr})`,_);let l,A=!1;try{_ instanceof MessageEvent?l=JSON.parse(_.data):l=yield(yield o).json(),((M=l==null?void 0:l.payload)==null?void 0:M.name)==="Task Crashed"&&(A=!0)}catch(P){}const I=new qs({name:(K=l==null?void 0:l.payload.name)!=null?K:"Unknown error",reason:(D=l==null?void 0:l.payload.message)!=null?D:"Unknown",status:l==null?void 0:l.payload.status,detail:l==null?void 0:l.payload.detail});m++;let z=!1;m>pr?(console.error("Experienced too many errors, terminating request"),z=!0):A&&(console.error("Experienced unrecoverable error, terminating request"),z=!0),z&&(s(P=>{P.status="error",P.error=I}),g({result:null,error:I}))})),c.addEventListener("done",_=>{const l=JSON.parse(_.data);b.tokenUsage=l.payload.tokenUsage,b.sessionId=l.payload.sessionId,s(A=>{A.status="success",A.result=b}),g({result:b,error:null})})});try{const{result:g,error:b}=yield u,m=structuredClone(g);if(((p=i.assetsStorage)==null?void 0:p.strategy)==="local"&&((k=m==null?void 0:m.assets)!=null&&k.length)){const{filePath:_}=yr(i.assetsStorage),l=m.assets.map(I=>je(exports,null,function*(){const M=yield(yield fetch(I.url)).arrayBuffer();return{assetName:I.name,base64:ua(M)}})),A=yield Promise.allSettled(l);for(const I of A){const z={};if(I.status==="fulfilled"){const{assetName:M,base64:K}=I.value;z[M]=K;const D=_?`${_}/${M}`:M;m.files[D]={content:K,isBinary:!0}}}}return b?{result:null,error:b}:{result:m,error:b}}finally{c.close()}}),status:n.status,tasks:n.tasks,error:n.error,result:n.result}};var en={exports:{}},Dn={};/**
|
|
6
6
|
* @license React
|
|
7
7
|
* use-sync-external-store-shim.production.js
|
|
8
8
|
*
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the MIT license found in the
|
|
20
20
|
* LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/var vr;function Jo(){return vr||(vr=1,process.env.NODE_ENV!=="production"&&function(){function t(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}function e(g,b){h||r.startTransition===void 0||(h=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=b();if(!p){var _=b();a(m,_)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}_=i({inst:{value:m,getSnapshot:b}});var l=_[0].inst,C=_[1];return c(function(){l.value=m,l.getSnapshot=b,n(l)&&C({inst:l})},[g,m,b]),o(function(){return n(l)&&C({inst:l}),g(function(){n(l)&&C({inst:l})})},[g]),u(m),m}function n(g){var b=g.getSnapshot;g=g.value;try{var m=b();return!a(g,m)}catch(_){return!0}}function s(g,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=U,a=typeof Object.is=="function"?Object.is:t,i=r.useState,o=r.useEffect,c=r.useLayoutEffect,u=r.useDebugValue,h=!1,p=!1,k=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?s:e;Mn.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:k,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Mn}var _r;function Xo(){return _r||(_r=1,process.env.NODE_ENV==="production"?en.exports=Go():en.exports=Jo()),en.exports}var Yo=Xo();const Br=0,qr=1,Hr=2,br=3;var wr=Object.prototype.hasOwnProperty;function gs(t,e){var n,s;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((s=t.length)===e.length)for(;s--&&gs(t[s],e[s]););return s===-1}if(!n||typeof t=="object"){s=0;for(n in t)if(wr.call(t,n)&&++s&&!wr.call(e,n)||!(n in e)||!gs(t[n],e[n]))return!1;return Object.keys(e).length===s}}return t!==t&&e!==e}const Pe=new WeakMap,Le=()=>{},te=Le(),vs=Object,N=t=>t===te,we=t=>typeof t=="function",Ve=(t,e)=>Be(Be({},t),e),Gr=t=>we(t.then),Ln={},tn={},Ns="undefined",Jt=typeof window!=Ns,_s=typeof document!=Ns,Qo=Jt&&"Deno"in window,ec=()=>Jt&&typeof window.requestAnimationFrame!=Ns,Jr=(t,e)=>{const n=Pe.get(t);return[()=>!N(e)&&t.get(e)||Ln,s=>{if(!N(e)){const r=t.get(e);e in tn||(tn[e]=r),n[5](e,Ve(r,s),r||Ln)}},n[6],()=>!N(e)&&e in tn?tn[e]:!N(e)&&t.get(e)||Ln]};let bs=!0;const tc=()=>bs,[ws,ks]=Jt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Le,Le],nc=()=>{const t=_s&&document.visibilityState;return N(t)||t!=="hidden"},sc=t=>(_s&&document.addEventListener("visibilitychange",t),ws("focus",t),()=>{_s&&document.removeEventListener("visibilitychange",t),ks("focus",t)}),rc=t=>{const e=()=>{bs=!0,t()},n=()=>{bs=!1};return ws("online",e),ws("offline",n),()=>{ks("online",e),ks("offline",n)}},ac={isOnline:tc,isVisible:nc},ic={initFocus:sc,initReconnect:rc},kr=!U.useId,Ht=!Jt||Qo,oc=t=>ec()?window.requestAnimationFrame(t):setTimeout(t,1),$n=Ht?U.useEffect:U.useLayoutEffect,Fn=typeof navigator!="undefined"&&navigator.connection,Er=!Ht&&Fn&&(["slow-2g","2g"].includes(Fn.effectiveType)||Fn.saveData),nn=new WeakMap,Wn=(t,e)=>vs.prototype.toString.call(t)===`[object ${e}]`;let cc=0;const Es=t=>{const e=typeof t,n=Wn(t,"Date"),s=Wn(t,"RegExp"),r=Wn(t,"Object");let a,i;if(vs(t)===t&&!n&&!s){if(a=nn.get(t),a)return a;if(a=++cc+"~",nn.set(t,a),Array.isArray(t)){for(a="@",i=0;i<t.length;i++)a+=Es(t[i])+",";nn.set(t,a)}if(r){a="#";const o=vs.keys(t).sort();for(;!N(i=o.pop());)N(t[i])||(a+=i+":"+Es(t[i])+",");nn.set(t,a)}}else a=n?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return a},Ps=t=>{if(we(t))try{t=t()}catch(n){t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Es(t):"",[t,e]};let uc=0;const xs=()=>++uc;function Xr(...t){return Ie(this,null,function*(){const[e,n,s,r]=t,a=Ve({populateCache:!0,throwOnError:!0},typeof r=="boolean"?{revalidate:r}:r||{});let i=a.populateCache;const o=a.rollbackOnError;let c=a.optimisticData;const u=k=>typeof o=="function"?o(k):o!==!1,h=a.throwOnError;if(we(n)){const k=n,g=[],b=e.keys();for(const m of b)!/^\$(inf|sub)\$/.test(m)&&k(e.get(m)._k)&&g.push(m);return Promise.all(g.map(p))}return p(n);function p(k){return Ie(this,null,function*(){const[g]=Ps(k);if(!g)return;const[b,m]=Jr(e,g),[_,l,C,j]=Pe.get(e),z=()=>{const fe=_[g];return(we(a.revalidate)?a.revalidate(b().data,k):a.revalidate!==!1)&&(delete C[g],delete j[g],fe&&fe[0])?fe[0](Hr).then(()=>b().data):b().data};if(t.length<3)return z();let M=s,K;const D=xs();l[g]=[D,0];const P=!N(c),Oe=b(),F=Oe.data,st=Oe._c,ze=N(st)?F:st;if(P&&(c=we(c)?c(ze,F):c,m({data:c,_c:ze})),we(M))try{M=M(ze)}catch(fe){K=fe}if(M&&Gr(M))if(M=yield M.catch(fe=>{K=fe}),D!==l[g][0]){if(K)throw K;return M}else K&&P&&u(K)&&(i=!0,m({data:ze,_c:te}));if(i&&!K)if(we(i)){const fe=i(M,ze);m({data:fe,error:te,_c:te})}else m({data:M,error:te,_c:te});if(l[g][1]=xs(),Promise.resolve(z()).then(()=>{m({_c:te})}),K){if(h)throw K;return}return M})}})}const xr=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},dc=(t,e)=>{if(!Pe.has(t)){const n=Ve(ic,e),s=Object.create(null),r=Xr.bind(te,t);let a=Le;const i=Object.create(null),o=(h,p)=>{const k=i[h]||[];return i[h]=k,k.push(p),()=>k.splice(k.indexOf(p),1)},c=(h,p,k)=>{t.set(h,p);const g=i[h];if(g)for(const b of g)b(p,k)},u=()=>{if(!Pe.has(t)&&(Pe.set(t,[s,Object.create(null),Object.create(null),Object.create(null),r,c,o]),!Ht)){const h=n.initFocus(setTimeout.bind(te,xr.bind(te,s,Br))),p=n.initReconnect(setTimeout.bind(te,xr.bind(te,s,qr)));a=()=>{h&&h(),p&&p(),Pe.delete(t)}}};return u(),[t,r,u,a]}return[t,Pe.get(t)[4]]},lc=(t,e,n,s,r)=>{const a=n.errorRetryCount,i=r.retryCount,o=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!N(a)&&i>a||setTimeout(s,o,r)},fc=gs,[Yr,hc]=dc(new Map),pc=Ve({onLoadingSlow:Le,onSuccess:Le,onError:Le,onErrorRetry:lc,onDiscarded:Le,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Er?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Er?5e3:3e3,compare:fc,isPaused:()=>!1,cache:Yr,mutate:hc,fallback:{}},ac),mc=(t,e)=>{const n=Ve(t,e);if(e){const{use:s,fallback:r}=t,{use:a,fallback:i}=e;s&&a&&(n.use=s.concat(a)),r&&i&&(n.fallback=Ve(r,i))}return n},yc=U.createContext({}),gc="$inf$",Qr=Jt&&window.__SWR_DEVTOOLS_USE__,vc=Qr?window.__SWR_DEVTOOLS_USE__:[],_c=()=>{Qr&&(window.__SWR_DEVTOOLS_REACT__=U)},bc=t=>we(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],wc=()=>Ve(pc,U.useContext(yc)),kc=t=>(e,n,s)=>t(e,n&&((...a)=>{const[i]=Ps(e),[,,,o]=Pe.get(Yr);if(i.startsWith(gc))return n(...a);const c=o[i];return N(c)?n(...a):(delete o[i],c)}),s),Ec=vc.concat(kc),xc=t=>function(...n){const s=wc(),[r,a,i]=bc(n),o=mc(s,i);let c=t;const{use:u}=o,h=(u||[]).concat(Ec);for(let p=h.length;p--;)c=h[p](c);return c(r,a||o.fetcher||null,o)},Sc=(t,e,n)=>{const s=e[t]||(e[t]=[]);return s.push(n),()=>{const r=s.indexOf(n);r>=0&&(s[r]=s[s.length-1],s.pop())}};_c();const Un=U.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),Vn={dedupe:!0},Oc=(t,e,n)=>{const{cache:s,compare:r,suspense:a,fallbackData:i,revalidateOnMount:o,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:h,refreshWhenOffline:p,keepPreviousData:k}=n,[g,b,m,_]=Pe.get(s),[l,C]=Ps(t),j=U.useRef(!1),z=U.useRef(!1),M=U.useRef(l),K=U.useRef(e),D=U.useRef(n),P=()=>D.current,Oe=()=>P().isVisible()&&P().isOnline(),[F,st,ze,fe]=Jr(s,l),rt=U.useRef({}).current,Xt=N(i)?N(n.fallback)?te:n.fallback[l]:i,js=($,L)=>{for(const J in rt){const B=J;if(B==="data"){if(!r($[B],L[B])&&(!N($[B])||!r(Qt,L[B])))return!1}else if(L[B]!==$[B])return!1}return!0},Is=U.useMemo(()=>{const $=!l||!e?!1:N(o)?P().isPaused()||a?!1:c!==!1:o,L=Q=>{const Te=Ve(Q);return delete Te._k,$?Be({isValidating:!0,isLoading:!0},Te):Te},J=F(),B=fe(),he=L(J),ot=J===B?he:L(B);let G=he;return[()=>{const Q=L(F());return js(Q,G)?(G.data=Q.data,G.isLoading=Q.isLoading,G.isValidating=Q.isValidating,G.error=Q.error,G):(G=Q,Q)},()=>ot]},[s,l]),at=Yo.useSyncExternalStore(U.useCallback($=>ze(l,(L,J)=>{js(J,L)||$()}),[s,l]),Is[0],Is[1]),Zs=!j.current,ea=g[l]&&g[l].length>0,it=at.data,Ke=N(it)?Xt&&Gr(Xt)?Un(Xt):Xt:it,Yt=at.error,On=U.useRef(Ke),Qt=k?N(it)?N(On.current)?Ke:On.current:it:Ke,Ds=ea&&!N(Yt)?!1:Zs&&!N(o)?o:P().isPaused()?!1:a?N(Ke)?!1:c:N(Ke)||c,Ms=!!(l&&e&&Zs&&Ds),ta=N(at.isValidating)?Ms:at.isValidating,na=N(at.isLoading)?Ms:at.isLoading,wt=U.useCallback($=>Ie(exports,null,function*(){const L=K.current;if(!l||!L||z.current||P().isPaused())return!1;let J,B,he=!0;const ot=$||{},G=!m[l]||!ot.dedupe,Q=()=>kr?!z.current&&l===M.current&&j.current:l===M.current,Te={isValidating:!1,isLoading:!1},$s=()=>{st(Te)},Fs=()=>{const de=m[l];de&&de[1]===B&&delete m[l]},Ws={isValidating:!0};N(F().data)&&(Ws.isLoading=!0);try{if(G&&(st(Ws),n.loadingTimeout&&N(F().data)&&setTimeout(()=>{he&&Q()&&P().onLoadingSlow(l,n)},n.loadingTimeout),m[l]=[L(C),xs()]),[J,B]=m[l],J=yield J,G&&setTimeout(Fs,n.dedupingInterval),!m[l]||m[l][1]!==B)return G&&Q()&&P().onDiscarded(l),!1;Te.error=te;const de=b[l];if(!N(de)&&(B<=de[0]||B<=de[1]||de[1]===0))return $s(),G&&Q()&&P().onDiscarded(l),!1;const Ae=F().data;Te.data=r(Ae,J)?Ae:J,G&&Q()&&P().onSuccess(J,l,n)}catch(de){Fs();const Ae=P(),{shouldRetryOnError:Tn}=Ae;Ae.isPaused()||(Te.error=de,G&&Q()&&(Ae.onError(de,l,Ae),(Tn===!0||we(Tn)&&Tn(de))&&(!P().revalidateOnFocus||!P().revalidateOnReconnect||Oe())&&Ae.onErrorRetry(de,l,Ae,sa=>{const An=g[l];An&&An[0]&&An[0](br,sa)},{retryCount:(ot.retryCount||0)+1,dedupe:!0})))}return he=!1,$s(),!0}),[l,s]),Ls=U.useCallback((...$)=>Xr(s,M.current,...$),[]);if($n(()=>{K.current=e,D.current=n,N(it)||(On.current=it)}),$n(()=>{if(!l)return;const $=wt.bind(te,Vn);let L=0;P().revalidateOnFocus&&(L=Date.now()+P().focusThrottleInterval);const B=Sc(l,g,(he,ot={})=>{if(he==Br){const G=Date.now();P().revalidateOnFocus&&G>L&&Oe()&&(L=G+P().focusThrottleInterval,$())}else if(he==qr)P().revalidateOnReconnect&&Oe()&&$();else{if(he==Hr)return wt();if(he==br)return wt(ot)}});return z.current=!1,M.current=l,j.current=!0,st({_k:C}),Ds&&(N(Ke)||Ht?$():oc($)),()=>{z.current=!0,B()}},[l]),$n(()=>{let $;function L(){const B=we(u)?u(F().data):u;B&&$!==-1&&($=setTimeout(J,B))}function J(){!F().error&&(h||P().isVisible())&&(p||P().isOnline())?wt(Vn).then(L):L()}return L(),()=>{$&&(clearTimeout($),$=-1)}},[u,h,p,l]),U.useDebugValue(Qt),a&&N(Ke)&&l){if(!kr&&Ht)throw new Error("Fallback data is required when using Suspense in SSR.");K.current=e,D.current=n,z.current=!1;const $=_[l];if(!N($)){const L=Ls($);Un(L)}if(N(Yt)){const L=wt(Vn);N(Qt)||(L.status="fulfilled",L.value=!0),Un(L)}else throw Yt}return{mutate:Ls,get data(){return rt.data=!0,Qt},get error(){return rt.error=!0,Yt},get isValidating(){return rt.isValidating=!0,ta},get isLoading(){return rt.isLoading=!0,na}}},Tc=xc(Oc),Ac=({fileKey:t,authToken:e,enabled:n=!0,params:s={}})=>{const r=!!(n&&t&&e),{data:a,isLoading:i,error:o}=Tc(["useFigmaFile",t,e,s],()=>r?wi({fileKey:t,authToken:e,params:s}):null,{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1});return{data:a!=null?a:null,isLoading:i,error:o}};exports.useAnimaCodegen=Ho;exports.useFigmaFile=Ac;
|
|
21
|
+
*/var vr;function Jo(){return vr||(vr=1,process.env.NODE_ENV!=="production"&&function(){function t(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}function e(g,b){h||r.startTransition===void 0||(h=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=b();if(!p){var _=b();a(m,_)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}_=i({inst:{value:m,getSnapshot:b}});var l=_[0].inst,A=_[1];return c(function(){l.value=m,l.getSnapshot=b,n(l)&&A({inst:l})},[g,m,b]),o(function(){return n(l)&&A({inst:l}),g(function(){n(l)&&A({inst:l})})},[g]),u(m),m}function n(g){var b=g.getSnapshot;g=g.value;try{var m=b();return!a(g,m)}catch(_){return!0}}function s(g,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=U,a=typeof Object.is=="function"?Object.is:t,i=r.useState,o=r.useEffect,c=r.useLayoutEffect,u=r.useDebugValue,h=!1,p=!1,k=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?s:e;Mn.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:k,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Mn}var _r;function Xo(){return _r||(_r=1,process.env.NODE_ENV==="production"?en.exports=Go():en.exports=Jo()),en.exports}var Yo=Xo();const Br=0,qr=1,Hr=2,br=3;var wr=Object.prototype.hasOwnProperty;function gs(t,e){var n,s;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((s=t.length)===e.length)for(;s--&&gs(t[s],e[s]););return s===-1}if(!n||typeof t=="object"){s=0;for(n in t)if(wr.call(t,n)&&++s&&!wr.call(e,n)||!(n in e)||!gs(t[n],e[n]))return!1;return Object.keys(e).length===s}}return t!==t&&e!==e}const Pe=new WeakMap,Le=()=>{},te=Le(),vs=Object,N=t=>t===te,we=t=>typeof t=="function",Ve=(t,e)=>Be(Be({},t),e),Gr=t=>we(t.then),Ln={},tn={},Ns="undefined",Jt=typeof window!=Ns,_s=typeof document!=Ns,Qo=Jt&&"Deno"in window,ec=()=>Jt&&typeof window.requestAnimationFrame!=Ns,Jr=(t,e)=>{const n=Pe.get(t);return[()=>!N(e)&&t.get(e)||Ln,s=>{if(!N(e)){const r=t.get(e);e in tn||(tn[e]=r),n[5](e,Ve(r,s),r||Ln)}},n[6],()=>!N(e)&&e in tn?tn[e]:!N(e)&&t.get(e)||Ln]};let bs=!0;const tc=()=>bs,[ws,ks]=Jt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Le,Le],nc=()=>{const t=_s&&document.visibilityState;return N(t)||t!=="hidden"},sc=t=>(_s&&document.addEventListener("visibilitychange",t),ws("focus",t),()=>{_s&&document.removeEventListener("visibilitychange",t),ks("focus",t)}),rc=t=>{const e=()=>{bs=!0,t()},n=()=>{bs=!1};return ws("online",e),ws("offline",n),()=>{ks("online",e),ks("offline",n)}},ac={isOnline:tc,isVisible:nc},ic={initFocus:sc,initReconnect:rc},kr=!U.useId,Ht=!Jt||Qo,oc=t=>ec()?window.requestAnimationFrame(t):setTimeout(t,1),Fn=Ht?U.useEffect:U.useLayoutEffect,$n=typeof navigator!="undefined"&&navigator.connection,Er=!Ht&&$n&&(["slow-2g","2g"].includes($n.effectiveType)||$n.saveData),nn=new WeakMap,Wn=(t,e)=>vs.prototype.toString.call(t)===`[object ${e}]`;let cc=0;const Es=t=>{const e=typeof t,n=Wn(t,"Date"),s=Wn(t,"RegExp"),r=Wn(t,"Object");let a,i;if(vs(t)===t&&!n&&!s){if(a=nn.get(t),a)return a;if(a=++cc+"~",nn.set(t,a),Array.isArray(t)){for(a="@",i=0;i<t.length;i++)a+=Es(t[i])+",";nn.set(t,a)}if(r){a="#";const o=vs.keys(t).sort();for(;!N(i=o.pop());)N(t[i])||(a+=i+":"+Es(t[i])+",");nn.set(t,a)}}else a=n?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return a},Ps=t=>{if(we(t))try{t=t()}catch(n){t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Es(t):"",[t,e]};let uc=0;const xs=()=>++uc;function Xr(...t){return je(this,null,function*(){const[e,n,s,r]=t,a=Ve({populateCache:!0,throwOnError:!0},typeof r=="boolean"?{revalidate:r}:r||{});let i=a.populateCache;const o=a.rollbackOnError;let c=a.optimisticData;const u=k=>typeof o=="function"?o(k):o!==!1,h=a.throwOnError;if(we(n)){const k=n,g=[],b=e.keys();for(const m of b)!/^\$(inf|sub)\$/.test(m)&&k(e.get(m)._k)&&g.push(m);return Promise.all(g.map(p))}return p(n);function p(k){return je(this,null,function*(){const[g]=Ps(k);if(!g)return;const[b,m]=Jr(e,g),[_,l,A,I]=Pe.get(e),z=()=>{const fe=_[g];return(we(a.revalidate)?a.revalidate(b().data,k):a.revalidate!==!1)&&(delete A[g],delete I[g],fe&&fe[0])?fe[0](Hr).then(()=>b().data):b().data};if(t.length<3)return z();let M=s,K;const D=xs();l[g]=[D,0];const P=!N(c),Oe=b(),$=Oe.data,st=Oe._c,ze=N(st)?$:st;if(P&&(c=we(c)?c(ze,$):c,m({data:c,_c:ze})),we(M))try{M=M(ze)}catch(fe){K=fe}if(M&&Gr(M))if(M=yield M.catch(fe=>{K=fe}),D!==l[g][0]){if(K)throw K;return M}else K&&P&&u(K)&&(i=!0,m({data:ze,_c:te}));if(i&&!K)if(we(i)){const fe=i(M,ze);m({data:fe,error:te,_c:te})}else m({data:M,error:te,_c:te});if(l[g][1]=xs(),Promise.resolve(z()).then(()=>{m({_c:te})}),K){if(h)throw K;return}return M})}})}const xr=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},dc=(t,e)=>{if(!Pe.has(t)){const n=Ve(ic,e),s=Object.create(null),r=Xr.bind(te,t);let a=Le;const i=Object.create(null),o=(h,p)=>{const k=i[h]||[];return i[h]=k,k.push(p),()=>k.splice(k.indexOf(p),1)},c=(h,p,k)=>{t.set(h,p);const g=i[h];if(g)for(const b of g)b(p,k)},u=()=>{if(!Pe.has(t)&&(Pe.set(t,[s,Object.create(null),Object.create(null),Object.create(null),r,c,o]),!Ht)){const h=n.initFocus(setTimeout.bind(te,xr.bind(te,s,Br))),p=n.initReconnect(setTimeout.bind(te,xr.bind(te,s,qr)));a=()=>{h&&h(),p&&p(),Pe.delete(t)}}};return u(),[t,r,u,a]}return[t,Pe.get(t)[4]]},lc=(t,e,n,s,r)=>{const a=n.errorRetryCount,i=r.retryCount,o=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!N(a)&&i>a||setTimeout(s,o,r)},fc=gs,[Yr,hc]=dc(new Map),pc=Ve({onLoadingSlow:Le,onSuccess:Le,onError:Le,onErrorRetry:lc,onDiscarded:Le,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Er?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Er?5e3:3e3,compare:fc,isPaused:()=>!1,cache:Yr,mutate:hc,fallback:{}},ac),mc=(t,e)=>{const n=Ve(t,e);if(e){const{use:s,fallback:r}=t,{use:a,fallback:i}=e;s&&a&&(n.use=s.concat(a)),r&&i&&(n.fallback=Ve(r,i))}return n},yc=U.createContext({}),gc="$inf$",Qr=Jt&&window.__SWR_DEVTOOLS_USE__,vc=Qr?window.__SWR_DEVTOOLS_USE__:[],_c=()=>{Qr&&(window.__SWR_DEVTOOLS_REACT__=U)},bc=t=>we(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],wc=()=>Ve(pc,U.useContext(yc)),kc=t=>(e,n,s)=>t(e,n&&((...a)=>{const[i]=Ps(e),[,,,o]=Pe.get(Yr);if(i.startsWith(gc))return n(...a);const c=o[i];return N(c)?n(...a):(delete o[i],c)}),s),Ec=vc.concat(kc),xc=t=>function(...n){const s=wc(),[r,a,i]=bc(n),o=mc(s,i);let c=t;const{use:u}=o,h=(u||[]).concat(Ec);for(let p=h.length;p--;)c=h[p](c);return c(r,a||o.fetcher||null,o)},Sc=(t,e,n)=>{const s=e[t]||(e[t]=[]);return s.push(n),()=>{const r=s.indexOf(n);r>=0&&(s[r]=s[s.length-1],s.pop())}};_c();const Un=U.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),Vn={dedupe:!0},Oc=(t,e,n)=>{const{cache:s,compare:r,suspense:a,fallbackData:i,revalidateOnMount:o,revalidateIfStale:c,refreshInterval:u,refreshWhenHidden:h,refreshWhenOffline:p,keepPreviousData:k}=n,[g,b,m,_]=Pe.get(s),[l,A]=Ps(t),I=U.useRef(!1),z=U.useRef(!1),M=U.useRef(l),K=U.useRef(e),D=U.useRef(n),P=()=>D.current,Oe=()=>P().isVisible()&&P().isOnline(),[$,st,ze,fe]=Jr(s,l),rt=U.useRef({}).current,Xt=N(i)?N(n.fallback)?te:n.fallback[l]:i,Is=(F,L)=>{for(const J in rt){const B=J;if(B==="data"){if(!r(F[B],L[B])&&(!N(F[B])||!r(Qt,L[B])))return!1}else if(L[B]!==F[B])return!1}return!0},js=U.useMemo(()=>{const F=!l||!e?!1:N(o)?P().isPaused()||a?!1:c!==!1:o,L=Q=>{const Te=Ve(Q);return delete Te._k,F?Be({isValidating:!0,isLoading:!0},Te):Te},J=$(),B=fe(),he=L(J),ot=J===B?he:L(B);let G=he;return[()=>{const Q=L($());return Is(Q,G)?(G.data=Q.data,G.isLoading=Q.isLoading,G.isValidating=Q.isValidating,G.error=Q.error,G):(G=Q,Q)},()=>ot]},[s,l]),at=Yo.useSyncExternalStore(U.useCallback(F=>ze(l,(L,J)=>{Is(J,L)||F()}),[s,l]),js[0],js[1]),Zs=!I.current,ea=g[l]&&g[l].length>0,it=at.data,Ke=N(it)?Xt&&Gr(Xt)?Un(Xt):Xt:it,Yt=at.error,On=U.useRef(Ke),Qt=k?N(it)?N(On.current)?Ke:On.current:it:Ke,Ds=ea&&!N(Yt)?!1:Zs&&!N(o)?o:P().isPaused()?!1:a?N(Ke)?!1:c:N(Ke)||c,Ms=!!(l&&e&&Zs&&Ds),ta=N(at.isValidating)?Ms:at.isValidating,na=N(at.isLoading)?Ms:at.isLoading,wt=U.useCallback(F=>je(exports,null,function*(){const L=K.current;if(!l||!L||z.current||P().isPaused())return!1;let J,B,he=!0;const ot=F||{},G=!m[l]||!ot.dedupe,Q=()=>kr?!z.current&&l===M.current&&I.current:l===M.current,Te={isValidating:!1,isLoading:!1},Fs=()=>{st(Te)},$s=()=>{const de=m[l];de&&de[1]===B&&delete m[l]},Ws={isValidating:!0};N($().data)&&(Ws.isLoading=!0);try{if(G&&(st(Ws),n.loadingTimeout&&N($().data)&&setTimeout(()=>{he&&Q()&&P().onLoadingSlow(l,n)},n.loadingTimeout),m[l]=[L(A),xs()]),[J,B]=m[l],J=yield J,G&&setTimeout($s,n.dedupingInterval),!m[l]||m[l][1]!==B)return G&&Q()&&P().onDiscarded(l),!1;Te.error=te;const de=b[l];if(!N(de)&&(B<=de[0]||B<=de[1]||de[1]===0))return Fs(),G&&Q()&&P().onDiscarded(l),!1;const Ce=$().data;Te.data=r(Ce,J)?Ce:J,G&&Q()&&P().onSuccess(J,l,n)}catch(de){$s();const Ce=P(),{shouldRetryOnError:Tn}=Ce;Ce.isPaused()||(Te.error=de,G&&Q()&&(Ce.onError(de,l,Ce),(Tn===!0||we(Tn)&&Tn(de))&&(!P().revalidateOnFocus||!P().revalidateOnReconnect||Oe())&&Ce.onErrorRetry(de,l,Ce,sa=>{const Cn=g[l];Cn&&Cn[0]&&Cn[0](br,sa)},{retryCount:(ot.retryCount||0)+1,dedupe:!0})))}return he=!1,Fs(),!0}),[l,s]),Ls=U.useCallback((...F)=>Xr(s,M.current,...F),[]);if(Fn(()=>{K.current=e,D.current=n,N(it)||(On.current=it)}),Fn(()=>{if(!l)return;const F=wt.bind(te,Vn);let L=0;P().revalidateOnFocus&&(L=Date.now()+P().focusThrottleInterval);const B=Sc(l,g,(he,ot={})=>{if(he==Br){const G=Date.now();P().revalidateOnFocus&&G>L&&Oe()&&(L=G+P().focusThrottleInterval,F())}else if(he==qr)P().revalidateOnReconnect&&Oe()&&F();else{if(he==Hr)return wt();if(he==br)return wt(ot)}});return z.current=!1,M.current=l,I.current=!0,st({_k:A}),Ds&&(N(Ke)||Ht?F():oc(F)),()=>{z.current=!0,B()}},[l]),Fn(()=>{let F;function L(){const B=we(u)?u($().data):u;B&&F!==-1&&(F=setTimeout(J,B))}function J(){!$().error&&(h||P().isVisible())&&(p||P().isOnline())?wt(Vn).then(L):L()}return L(),()=>{F&&(clearTimeout(F),F=-1)}},[u,h,p,l]),U.useDebugValue(Qt),a&&N(Ke)&&l){if(!kr&&Ht)throw new Error("Fallback data is required when using Suspense in SSR.");K.current=e,D.current=n,z.current=!1;const F=_[l];if(!N(F)){const L=Ls(F);Un(L)}if(N(Yt)){const L=wt(Vn);N(Qt)||(L.status="fulfilled",L.value=!0),Un(L)}else throw Yt}return{mutate:Ls,get data(){return rt.data=!0,Qt},get error(){return rt.error=!0,Yt},get isValidating(){return rt.isValidating=!0,ta},get isLoading(){return rt.isLoading=!0,na}}},Tc=xc(Oc),Cc=({fileKey:t,authToken:e,enabled:n=!0,params:s={}})=>{const r=!!(n&&t&&e),{data:a,isLoading:i,error:o}=Tc(["useFigmaFile",t,e,s],()=>r?wi({fileKey:t,authToken:e,params:s}):null,{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1});return{data:a!=null?a:null,isLoading:i,error:o}};exports.useAnimaCodegen=Ho;exports.useFigmaFile=Cc;
|
|
22
22
|
//# sourceMappingURL=index.cjs.map
|