@animaapp/anima-sdk-react 0.6.28 → 0.6.30
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 +562 -562
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var sa=Object.defineProperty,aa=Object.defineProperties;var ia=Object.getOwnPropertyDescriptors;var zr=Object.getOwnPropertySymbols;var oa=Object.prototype.hasOwnProperty,ua=Object.prototype.propertyIsEnumerable;var Ur=(t,e,n)=>e in t?sa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,qe=(t,e)=>{for(var n in e||(e={}))oa.call(e,n)&&Ur(t,n,e[n]);if(zr)for(var n of zr(e))ua.call(e,n)&&Ur(t,n,e[n]);return t},Vr=(t,e)=>aa(t,ia(e));var Pe=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react"),ca=t=>{let e="";const n=new Uint8Array(t),r=n.byteLength;for(let s=0;s<r;s++)e+=String.fromCharCode(n[s]);return btoa(e)};var da=Object.defineProperty,la=Object.defineProperties,fa=Object.getOwnPropertyDescriptors,Kr=Object.getOwnPropertySymbols,ha=Object.prototype.hasOwnProperty,pa=Object.prototype.propertyIsEnumerable,qr=(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)&&qr(t,n,e[n]);if(Kr)for(var n of Kr(e))pa.call(e,n)&&qr(t,n,e[n]);return t},E=(t,e)=>la(t,fa(e)),Ee=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())});class Br extends Error{constructor({name:e,reason:n,status:r,detail:s}){super(),this.name=e,this.message=n,this.detail=s,this.status=r}}const ma="Figma Token Issue";class ya extends Error{constructor({fileKey:e,reason:n,cause:r}){super(ma),this.fileKey=e,this.reason=n,this.cause=r}}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 Sa="Unknown Figma API Exception";class Ea extends Error{constructor({fileKey:e,cause:n}){super(Sa),this.name="UnknownFigmaApiException",this.fileKey=e,this.cause=n}}const xa=(t,e)=>{var n;if(((n=t==null?void 0:t.cause)==null?void 0:n.message)==="Fetch Error"){const{err:r,status:s}=t.cause.body;if(s===403)return new ya({fileKey:e,reason:r,cause:t});if(s===429)return new va({fileKey:e,cause:t});if(s===404)return new ka({fileKey:e,cause:t});if(s===400&&r.includes("Request too large"))return new ba({fileKey:e,cause:t})}return new Ea({fileKey:e,cause:t})};var Oa=Object.defineProperty,Ta=Object.defineProperties,Aa=Object.getOwnPropertyDescriptors,Hr=Object.getOwnPropertySymbols,Ca=Object.prototype.hasOwnProperty,Na=Object.prototype.propertyIsEnumerable,Gr=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),xs=t=>{throw TypeError(t)},Jr=(t,e,n)=>e in t?Oa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,oe=(t,e)=>{for(var n in e||(e={}))Ca.call(e,n)&&Jr(t,n,e[n]);if(Hr)for(var n of Hr(e))Na.call(e,n)&&Jr(t,n,e[n]);return t},xr=(t,e)=>Ta(t,Aa(e)),Or=(t,e,n)=>e.has(t)||xs("Cannot "+n),P=(t,e,n)=>(Or(t,e,"read from private field"),n?n.call(t):e.get(t)),fe=(t,e,n)=>e.has(t)?xs("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Y=(t,e,n,r)=>(Or(t,e,"write to private field"),e.set(t,n),n),we=(t,e,n)=>(Or(t,e,"access private method"),n),B=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())}),Ra=(t,e,n)=>(e=t[Gr("asyncIterator")])?e.call(t):(t=t[Gr("iterator")](),e={},n=(r,s)=>(s=t[r])&&(e[r]=a=>new Promise((i,o,u)=>(a=s.call(t,a),u=a.done,Promise.resolve(a.value).then(c=>i({value:c,done:u}),o)))),n("next"),n("return"),e),ja=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 Vn={exports:{}},Pa=Vn.exports,Xr;function Za(){return Xr||(Xr=1,function(t,e){(function(n,r){t.exports=r()})(Pa,function(){var n=typeof Promise=="function",r=typeof self=="object"?self:ja,s=typeof Symbol!="undefined",a=typeof Map!="undefined",i=typeof Set!="undefined",o=typeof WeakMap!="undefined",u=typeof WeakSet!="undefined",c=typeof DataView!="undefined",h=s&&typeof Symbol.iterator!="undefined",p=s&&typeof Symbol.toStringTag!="undefined",k=i&&typeof Set.prototype.entries=="function",v=a&&typeof Map.prototype.entries=="function",b=k&&Object.getPrototypeOf(new Set().entries()),m=v&&Object.getPrototypeOf(new Map().entries()),g=h&&typeof Array.prototype[Symbol.iterator]=="function",l=g&&Object.getPrototypeOf([][Symbol.iterator]()),O=h&&typeof String.prototype[Symbol.iterator]=="function",I=O&&Object.getPrototypeOf(""[Symbol.iterator]()),q=8,Z=-1;function V(D){var M=typeof D;if(M!=="object")return M;if(D===null)return"null";if(D===r)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 J=p&&D[Symbol.toStringTag];if(typeof J=="string")return J;var $=Object.getPrototypeOf(D);return $===RegExp.prototype?"RegExp":$===Date.prototype?"Date":n&&$===Promise.prototype?"Promise":i&&$===Set.prototype?"Set":a&&$===Map.prototype?"Map":u&&$===WeakSet.prototype?"WeakSet":o&&$===WeakMap.prototype?"WeakMap":c&&$===DataView.prototype?"DataView":a&&$===m?"Map Iterator":i&&$===b?"Set Iterator":g&&$===l?"Array Iterator":O&&$===I?"String Iterator":$===null?"Object":Object.prototype.toString.call(D).slice(q,Z)}return V})}(Vn)),Vn.exports}var Da=Za();const Ma=Ia(Da),Tr=typeof Buffer!="undefined",La=Tr&&typeof Buffer.from!="undefined",$a=Tr?function(t){return Buffer.isBuffer(t)}:function(){return!1},Fa=La?function(t){return Buffer.from(t)}:Tr?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 za(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 Yr(t,e,n,r=null){switch(r||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 Ua=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,Va=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,Ka=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,Cn=Ua||Va||Ka||Function("return this")();function qa(t){return t.slice(0)}function Ba(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 te(t){return t}function Qr(){return[]}function ei(){return new Map}function ti(){return{}}function ni(){return new Set}const ri=new Map([["ArrayBuffer",qa],["Boolean",Ba],["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",te],["Map Iterator",te],["Promise",te],["Set Iterator",te],["String Iterator",te],["function",te],["global",te],["WeakMap",te],["WeakSet",te],["boolean",te],["null",te],["number",te],["string",te],["symbol",te],["undefined",te],["Arguments",Qr],["Array",Qr],["Map",ei],["Object",ti],["Set",ni]]);function si(){}function qn(t,e=null,n=si){arguments.length===2&&typeof e=="function"&&(n=e,e=null);const r=e||mt(t),s=ri.get(r);if(r==="Object"){const a=n(t,r);if(a!==void 0)return a}return s?s(t,r):t}function kt(t,e={}){typeof e=="function"&&(e={customizer:e});const{customizer:n}=e,r=mt(t);if(!Kn(r))return Bn(t,null,null,null);const s=qn(t,r,n),a=new WeakMap([[t,s]]),i=new WeakSet([t]);return Bn(t,s,a,i)}function Bn(t,e,n,r,s){const a=mt(t),i=qn(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 u of o){const c=za(t,u,a);if(r.has(c))Yr(e,u,n.get(c),a);else{const h=mt(c),p=qn(c,h);Kn(h)&&(n.set(c,p),r.add(c)),Yr(e,u,Bn(c,p,n,r),a)}}return e}const ai=t=>new Promise(e=>setTimeout(e,t));var rn,He,sn,Hn,Os;class ii{constructor({maxAttempts:e=3,func:n}){fe(this,Hn),fe(this,rn),fe(this,He),fe(this,sn),Y(this,rn,e),Y(this,sn,n),Y(this,He,0)}run(){return B(this,null,function*(){try{return yield P(this,sn).call(this)}catch(e){if(Y(this,He,P(this,He)+1),P(this,He)>P(this,rn))throw console.error("Max attempts reached"),e;const n=we(this,Hn,Os).call(this);return yield ai(n),yield this.run()}})}}rn=new WeakMap,He=new WeakMap,sn=new WeakMap,Hn=new WeakSet,Os=function(){return P(this,He)*1e3*1.5};function oi(){return typeof CompressionStream!="undefined"}function ui(t){return B(this,null,function*(){const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=[];try{for(var r=Ra(e),s,a,i;s=!(a=yield r.next()).done;s=!1){const o=a.value;n.push(o)}}catch(o){i=[o]}finally{try{s&&(a=r.return)&&(yield a.call(r))}finally{if(i)throw i[0]}}return yield ci(n)})}function ci(t){return B(this,null,function*(){const e=yield new Blob(t).arrayBuffer();return new Uint8Array(e)})}class di extends Error{constructor({resource:e,api:n,args:r,cause:s}){if(super(`API Error on resource "${e}" at api "${n}"`),this.causeProperties={},this.name="API Error",this.resource=e,this.api=n,this.cause=s,this.args=r,s instanceof Error)for(const[i,o]of Object.entries(s))if(typeof Headers!="undefined"&&o instanceof Headers){const u={};o.forEach((c,h)=>{u[h]=c}),this.causeProperties[i]=u}else this.causeProperties[i]=o;const a=this.causeProperties.body;a&&typeof a=="object"&&"code"in a&&(this.code=a.code)}}class es extends Error{constructor({url:e,method:n,statusCode:r,requestHeaders:s,responseHeaders:a,body:i}){if(super("Fetch Error"),this.name="Fetch Error",this.url=e,this.method=n,this.statusNumber=r,this.requestHeaders=s,this.responseHeaders=a,i)try{const o=JSON.parse(i);this.body=o}catch(o){this.body=i}}}class St 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 Nn extends Error{constructor(e){super(e),this.name="Request Validation Error"}}function Ts(){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,_e,Jn,Xn,Et;class pi{constructor({fetch:e=globalThis.fetch.bind(globalThis),baseAddress:n}){fe(this,_e),fe(this,Ge),fe(this,se),this.baseAddress=n,Y(this,Ge,e),Y(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 Y(this,se,e),this}get(e){return B(this,arguments,function*(n,r={}){const{overrideBaseAddress:s,overrideDefaultHeaders:a}=r,i=s!=null?s:this.baseAddress;let o=a!=null?a:this.headers;const u=kt(P(this,se));return Y(this,se,{}),u.extraHeaders&&(o=oe(oe({},o),u.extraHeaders)),u.requestValidation&&(o=xr(oe({},o),{"X-Request-Nonce":Ts(),"X-Request-Timestamp":Gn()})),u.async?yield we(this,_e,Xn).call(this,`${i}${n}`,u.async,{headers:o}):yield we(this,_e,Jn).call(this,`${i}${n}`,u,{headers:o})})}post(e,n){return B(this,arguments,function*(r,s,a={}){const i=kt(P(this,se));return Y(this,se,{}),we(this,_e,Et).call(this,r,"POST",s,a,i)})}put(e,n){return B(this,arguments,function*(r,s,a={}){const i=kt(P(this,se));return Y(this,se,{}),we(this,_e,Et).call(this,r,"PUT",s,a,i)})}delete(e,n){return B(this,arguments,function*(r,s,a={}){const i=kt(P(this,se));return Y(this,se,{}),we(this,_e,Et).call(this,r,"DELETE",s,a,i)})}patch(e,n){return B(this,arguments,function*(r,s,a={}){const i=kt(P(this,se));return Y(this,se,{}),we(this,_e,Et).call(this,r,"PATCH",s,a,i)})}}Ge=new WeakMap,se=new WeakMap,_e=new WeakSet,Jn=function(t,e,n){return B(this,null,function*(){const r=()=>B(this,null,function*(){var u,c;try{return yield P(this,Ge).call(this,t,oe(oe({},n),e.abortSignal&&{signal:e.abortSignal}))}catch(h){throw h instanceof Error&&h.name==="AbortError"?new St({canceled:(c=(u=e.abortSignal)==null?void 0:u.aborted)!=null?c:!1}):h}}),{headers:s}=n!=null?n:{},a=(u,c)=>{var h,p;return((h=u==null?void 0:u.headers)==null?void 0:h.get(c))||((p=u==null?void 0:u.headersObject)==null?void 0:p[c])||""},i=u=>B(this,null,function*(){var c;if(!u.ok){const p=yield u.text().catch();throw new es({url:t,method:(c=n==null?void 0:n.method)!=null?c:"GET",statusCode:u.status,requestHeaders:s,responseHeaders:u.headers,body:p})}if(e.requestValidation&&process.env.UI_TESTS!==!0)try{const p=a(u,"x-response-nonce"),k=s==null?void 0:s["X-Request-Nonce"];if(!p||p!==k)throw new Nn("Response nonce mismatch");const v=Number(a(u,"x-response-timestamp")),b=Number(Gn()),m=60*60*24;if(isNaN(v)||Math.abs(b-v)>m)throw new Nn("Invalid response timestamp")}catch(p){const k=p instanceof Error?p.message:"Request validation failed";throw new Nn(k)}let h=yield u.text();try{h=JSON.parse(h)}catch(p){}return h});if(e.retry){const u=yield new ii({maxAttempts:e.retry,func:r}).run();return yield i(u)}const o=yield r();return yield i(o)})},Xn=function(t,e,n){return B(this,null,function*(){var r,s;const{onProgress:a,abortSignal:i,pollingInterval:o=()=>hi,maxTimeout:u=fi}=e,c=`${t}/async`,h=`${t}/async/job`;let p;try{p=yield P(this,Ge).call(this,c,oe(oe({},n),i&&{signal:i}))}catch(b){throw b instanceof Error&&b.name==="AbortError"?new St({canceled:(r=i==null?void 0:i.aborted)!=null?r:!1}):b}if(!p.ok){const b=yield p.text().catch();throw new es({url:t,method:(s=n==null?void 0:n.method)!=null?s:"GET",statusCode:p.status,requestHeaders:this.headers,responseHeaders:p.headers,body:b})}const k=yield p.json(),{job_id:v}=k;if(!v)throw new Error("Job ID not found in response");return new Promise((b,m)=>B(this,null,function*(){const g=setTimeout(()=>{m(new Error("Job timed out"))},u),l=(O=0)=>B(this,null,function*(){if(i!=null&&i.aborted){clearTimeout(g),P(this,Ge).call(this,`${h}/${v}/cancel`,{method:"POST",headers:this.headers}).then(()=>{m(new St({canceled:!0}))}).catch(I=>{m(new St({canceled:!1}))});return}try{const I=yield(yield P(this,Ge).call(this,`${h}/${v}`,{headers:this.headers})).json();if(I.status==="success"){clearTimeout(g);const q=I.response_json;b(q)}else if(I.status==="failed")clearTimeout(g),m(new li(I.response_json));else{a&&a(I.response_json);const q=o(O);setTimeout(()=>l(O+1),q)}}catch(I){m(I)}});l()}))})},Et=function(t,e,n,r,s){return B(this,null,function*(){const{overrideBaseAddress:a,overrideDefaultHeaders:i}=r,o=a!=null?a:this.baseAddress;let u=i!=null?i:this.headers;s.extraHeaders&&(u=oe(oe({},u),s.extraHeaders)),s.requestValidation&&(u=xr(oe({},u),{"X-Request-Nonce":Ts(),"X-Request-Timestamp":Gn()}));let c=n;return typeof FormData!="undefined"&&n instanceof FormData?delete u["Content-Type"]:(c=r.skipBodyJsonStringify?n:JSON.stringify(n),s.compress&&oi()&&(u["Content-Encoding"]="gzip",c=yield ui(c))),s.async?yield we(this,_e,Xn).call(this,`${o}${t}`,s.async,{method:e,headers:u,body:c}):yield we(this,_e,Jn).call(this,`${o}${t}`,s,{method:e,headers:u,body:c})})};const ts=(t,e,n,r)=>t instanceof St?t:new di({resource:e,api:String(n),args:r,cause:t}),Rn=(t,e)=>new Proxy(e,{get(n,r){return(...s)=>{var a;for(const o of t.plugins){const u=(a=o.beforeApi)==null?void 0:a.call(o,{resource:n.resourceName,api:r,args:s});if(u!==void 0)return u}let i;try{i=n[r](...s)}catch(o){throw ts(o,n.resourceName,r,s)}return i instanceof Promise?i.catch(o=>{throw ts(o,n.resourceName,r,s)}):i}}});var xt;class mi{constructor(e){fe(this,xt),this.resourceName="Files",Y(this,xt,e)}get(e){return B(this,arguments,function*({fileKey:n,params:r={}}){const s=new URLSearchParams(oe({plugin_data:"857346721138427857"},r)).toString(),a=`v1/files/${n}?${s}`;return yield P(this,xt).get(a)})}getImageFills(e){return B(this,arguments,function*({fileKey:n}){var r,s;const a=`v1/files/${n}/images`;return(s=(r=(yield P(this,xt).get(a)).meta)==null?void 0:r.images)!=null?s:{}})}}xt=new WeakMap;const yi=(t,e,n)=>{const r=e.sort();return`${t}-${r.join("-")}-${n}`},gi=t=>t?t.ts>Date.now()-1e3*30:!1;var be,Yn,As;class vi{constructor(e){fe(this,Yn),fe(this,be),this.resourceName="Images",Y(this,be,e)}get(e){return B(this,arguments,function*({fileKey:n,nodeIds:r,format:s="jpg",scale:a}){const i=yi(n,r,s),o=P(this,be).cache.images.entries.get(i);if(gi(o))return o.result;o&&P(this,be).cache.images.entries.delete(i);const u=P(this,be).cache.images.pendingRequests.get(i);if(u)return u;const c=we(this,Yn,As).call(this,i,n,r,s,a);P(this,be).cache.images.pendingRequests.set(i,c);try{return yield c}finally{P(this,be).cache.images.pendingRequests.delete(i)}})}}be=new WeakMap,Yn=new WeakSet,As=function(t,e,n,r,s){return B(this,null,function*(){const a=yield P(this,be).get(`v1/images/${e}?ids=${n}&format=${r}${s?`&scale=${s}`:""}`);return P(this,be).cache.images.entries.set(t,{result:a,ts:Date.now()}),a})};var an;class _i{constructor(e){fe(this,an),this.resourceName="Nodes",Y(this,an,e)}get(e){return B(this,arguments,function*({fileKey:n,nodeIds:r,params:s={}}){const a=xr(oe({},s),{ids:r.join(",")}),i=new URLSearchParams(oe({plugin_data:"857346721138427857"},a)).toString(),o=`v1/files/${n}/nodes?${i}`;return yield P(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}),fe(this,Ze,""),this.cache={images:{entries:new Map,pendingRequests:new Map}},this.files=Rn(this,new mi(this)),this.nodes=Rn(this,new _i(this)),this.images=Rn(this,new vi(this))}set token(e){if(!e.startsWith("figd_")&&!e.startsWith("figu_"))throw new Error("Invalid Figma access token");Y(this,Ze,e)}get token(){return P(this,Ze)}get headers(){const e={"Content-Type":"application/json"};return P(this,Ze).startsWith("figd_")?e["X-FIGMA-TOKEN"]=P(this,Ze):P(this,Ze).startsWith("figu_")&&(e.Authorization=`Bearer ${P(this,Ze)}`),e}}Ze=new WeakMap;const wi=t=>Ee(void 0,[t],function*({fileKey:e,authToken:n,figmaRestApi:r=new bi,params:s={},signal:a}){n&&(r.token=n);try{return yield r.withOptions({abortSignal:a}).files.get({fileKey:e,params:s})}catch(i){throw i instanceof Error&&i.name==="AbortError"?i:(console.error(i),xa(i,e))}});var N;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(N||(N={}));var Qn;(function(t){t.mergeShapes=(e,n)=>d(d({},e),n)})(Qn||(Qn={}));const _=N.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Re=t=>{switch(typeof t){case"undefined":return _.undefined;case"string":return _.string;case"number":return isNaN(t)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(t)?_.array:t===null?_.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?_.promise:typeof Map!="undefined"&&t instanceof Map?_.map:typeof Set!="undefined"&&t instanceof Set?_.set:typeof Date!="undefined"&&t instanceof Date?_.date:_.object;default:return _.unknown}},f=N.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 ue extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};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},r={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let o=r,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return s(this),r}static assert(e){if(!(e instanceof ue))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,N.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ue.create=t=>new ue(t);const yt=(t,e)=>{let n;switch(t.code){case f.invalid_type:t.received===_.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,N.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${N.joinValues(t.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${N.joinValues(t.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${N.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}"`:N.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,N.assertNever(t)}return{message:n}};let Cs=yt;function Si(t){Cs=t}function cn(){return Cs}const dn=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],i=E(d({},s),{path:a});if(s.message!==void 0)return E(d({},s),{path:a,message:s.message});let o="";const u=r.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return E(d({},s),{path:a,message:o})},Ei=[];function y(t,e){const n=cn(),r=dn({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===yt?void 0:yt].filter(s=>!!s)});t.common.issues.push(r)}class Q{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return x;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static mergeObjectAsync(e,n){return Ee(this,null,function*(){const r=[];for(const s of n){const a=yield s.key,i=yield s.value;r.push({key:a,value:i})}return Q.mergeObjectSync(e,r)})}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return x;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value!="undefined"||s.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const x=Object.freeze({status:"aborted"}),ln=t=>({status:"dirty",value:t}),re=t=>({status:"valid",value:t}),er=t=>t.status==="aborted",tr=t=>t.status==="dirty",Ye=t=>t.status==="valid",jt=t=>typeof Promise!="undefined"&&t instanceof Promise;function fn(t,e,n,r){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 Ns(t,e,n,r,s){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,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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 ns=(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 ue(t.common.issues);return this._error=n,this._error}}};function T(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,i)=>{var o,u;const{message:c}=t;return a.code==="invalid_enum_value"?{message:c!=null?c:i.defaultError}:typeof i.data=="undefined"?{message:(o=c!=null?c:r)!==null&&o!==void 0?o:i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:(u=c!=null?c:n)!==null&&u!==void 0?u:i.defaultError}},description:s}}class A{get description(){return this._def.description}_getType(e){return Re(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Re(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Q,ctx:{common:e.parent.common,data:e.data,parsedType:Re(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(jt(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 r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Re(e)},a=this._parseSync({data:e,path:s.path,parent:s});return ns(s,a)}"~validate"(e){var n,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Re(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return Ye(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((r=(n=a==null?void 0:a.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>Ye(a)?{value:a.value}:{issues:s.common.issues})}parseAsync(e,n){return Ee(this,null,function*(){const r=yield this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error})}safeParseAsync(e,n){return Ee(this,null,function*(){const r={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:Re(e)},s=this._parse({data:e,path:r.path,parent:r}),a=yield jt(s)?s:Promise.resolve(s);return ns(r,a)})}refine(e,n){const r=s=>typeof n=="string"||typeof n=="undefined"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue(d({code:f.custom},r(s)));return typeof Promise!="undefined"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new ve({schema:this,typeName:S.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 Se.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ge.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 ve(E(d({},T(this._def)),{schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){const n=typeof e=="function"?e:()=>e;return new zt(E(d({},T(this._def)),{innerType:this,defaultValue:n,typeName:S.ZodDefault}))}brand(){return new Ar(d({typeName:S.ZodBranded,type:this},T(this._def)))}catch(e){const n=typeof e=="function"?e:()=>e;return new Ut(E(d({},T(this._def)),{innerType:this,catchValue:n,typeName:S.ZodCatch}))}describe(e){const n=this.constructor;return new n(E(d({},this._def),{description:e}))}pipe(e){return Gt.create(this,e)}readonly(){return Vt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xi=/^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,Ni=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ri=/^[-+]?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)?)??$/,ji=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ii="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let jn;const Pi=/^(?:(?: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}(=)?))?$/,Rs="((\\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(`^${Rs}$`);function js(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(`^${js(t)}$`)}function Is(t){let e=`${Rs}T${js(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 zi(t,e){return!!((e==="v4"||!e)&&Pi.test(t)||(e==="v6"||!e)&&Di.test(t))}function Ui(t,e){if(!Ni.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch(n){return!1}}function Vi(t,e){return!!((e==="v4"||!e)&&Zi.test(t)||(e==="v6"||!e)&&Mi.test(t))}class ye extends A{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.string,received:s.parsedType}),x}const n=new Q;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(r=this._getOrReturnCtx(e,r),a?y(r,{code:f.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&y(r,{code:f.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")ji.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"email",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")jn||(jn=new RegExp(Ii,"u")),jn.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"emoji",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Ai.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"uuid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Ci.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"nanoid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")xi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cuid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Oi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cuid2",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Ti.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"ulid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch(a){r=this._getOrReturnCtx(e,r),y(r,{validation:"url",code:f.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"regex",code:f.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Is(s).test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Fi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Wi(s).test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Ri.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"duration",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?zi(e.data,s.version)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"ip",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Ui(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"jwt",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Vi(e.data,s.version)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cidr",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Li.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"base64",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?$i.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"base64url",code:f.invalid_string,message:s.message}),n.dirty()):N.assertNever(s);return{status:n.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),d({validation:n,code:f.invalid_string},w.errToObj(r)))}_addCheck(e){return new ye(E(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,r;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:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!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 ye(E(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new ye(E(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new ye(E(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}}ye.create=t=>{var e;return new ye(d({checks:[],typeName:S.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},T(t)))};function Ki(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=parseInt(t.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class $e extends A{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)!==_.number){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.number,received:s.parsedType}),x}let n;const r=new Q;for(const s of this._def.checks)s.kind==="int"?N.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?Ki(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_finite,message:s.message}),r.dirty()):N.assertNever(s);return{status:r.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,r,s){return new $e(E(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]}))}_addCheck(e){return new $e(E(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"&&N.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}$e.create=t=>new $e(d({checks:[],typeName:S.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1},T(t)));class Fe extends A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(s){return this._getInvalidInput(e)}if(this._getType(e)!==_.bigint)return this._getInvalidInput(e);let n;const r=new Q;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):N.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.bigint,received:n.parsedType}),x}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,r,s){return new Fe(E(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]}))}_addCheck(e){return new Fe(E(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:S.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},T(t)))};class It extends A{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.boolean,received:n.parsedType}),x}return re(e.data)}}It.create=t=>new It(d({typeName:S.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1},T(t)));class Qe extends A{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.date,received:s.parsedType}),x}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_date}),x}const n=new Q;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):N.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qe(E(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:S.ZodDate},T(t)));class hn extends A{_parse(e){if(this._getType(e)!==_.symbol){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.symbol,received:n.parsedType}),x}return re(e.data)}}hn.create=t=>new hn(d({typeName:S.ZodSymbol},T(t)));class Pt extends A{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.undefined,received:n.parsedType}),x}return re(e.data)}}Pt.create=t=>new Pt(d({typeName:S.ZodUndefined},T(t)));class Zt extends A{_parse(e){if(this._getType(e)!==_.null){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.null,received:n.parsedType}),x}return re(e.data)}}Zt.create=t=>new Zt(d({typeName:S.ZodNull},T(t)));class gt extends A{constructor(){super(...arguments),this._any=!0}_parse(e){return re(e.data)}}gt.create=t=>new gt(d({typeName:S.ZodAny},T(t)));class Xe extends A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return re(e.data)}}Xe.create=t=>new Xe(d({typeName:S.ZodUnknown},T(t)));class Ie extends A{_parse(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.never,received:n.parsedType}),x}}Ie.create=t=>new Ie(d({typeName:S.ZodNever},T(t)));class pn extends A{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.void,received:n.parsedType}),x}return re(e.data)}}pn.create=t=>new pn(d({typeName:S.ZodVoid},T(t)));class ge extends A{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==_.array)return y(n,{code:f.invalid_type,expected:_.array,received:n.parsedType}),x;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,o=n.data.length<s.exactLength.value;(i||o)&&(y(n,{code:i?f.too_big:f.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(y(n,{code:f.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(y(n,{code:f.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>s.type._parseAsync(new xe(n,i,n.path,o)))).then(i=>Q.mergeArray(r,i));const a=[...n.data].map((i,o)=>s.type._parseSync(new xe(n,i,n.path,o)));return Q.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new ge(E(d({},this._def),{minLength:{value:e,message:w.toString(n)}}))}max(e,n){return new ge(E(d({},this._def),{maxLength:{value:e,message:w.toString(n)}}))}length(e,n){return new ge(E(d({},this._def),{exactLength:{value:e,message:w.toString(n)}}))}nonempty(e){return this.min(1,e)}}ge.create=(t,e)=>new ge(d({type:t,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray},T(e)));function ut(t){if(t instanceof U){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Se.create(ut(r))}return new U(E(d({},t._def),{shape:()=>e}))}else return t instanceof ge?new ge(E(d({},t._def),{type:ut(t.element)})):t instanceof Se?Se.create(ut(t.unwrap())):t instanceof ze?ze.create(ut(t.unwrap())):t instanceof Oe?Oe.create(t.items.map(e=>ut(e))):t}class U extends A{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=N.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==_.object){const u=this._getOrReturnCtx(e);return y(u,{code:f.invalid_type,expected:_.object,received:u.parsedType}),x}const{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ie&&this._def.unknownKeys==="strip"))for(const u in r.data)a.includes(u)||i.push(u);const o=[];for(const u of a){const c=s[u],h=r.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new xe(r,h,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof Ie){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of i)o.push({key:{status:"valid",value:c},value:{status:"valid",value:r.data[c]}});else if(u==="strict")i.length>0&&(y(r,{code:f.unrecognized_keys,keys:i}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of i){const h=r.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new xe(r,h,r.path,c)),alwaysSet:c in r.data})}}return r.common.async?Promise.resolve().then(()=>Ee(this,null,function*(){const u=[];for(const c of o){const h=yield c.key,p=yield c.value;u.push({key:h,value:p,alwaysSet:c.alwaysSet})}return u})).then(u=>Q.mergeObjectSync(n,u)):Q.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new U(d(E(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(n,r)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=w.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}))}strip(){return new U(E(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new U(E(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new U(E(d({},this._def),{shape:()=>d(d({},this._def.shape()),e)}))}merge(e){return new U({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>d(d({},this._def.shape()),e._def.shape()),typeName:S.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new U(E(d({},this._def),{catchall:e}))}pick(e){const n={};return N.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new U(E(d({},this._def),{shape:()=>n}))}omit(e){const n={};return N.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new U(E(d({},this._def),{shape:()=>n}))}deepPartial(){return ut(this)}partial(e){const n={};return N.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}),new U(E(d({},this._def),{shape:()=>n}))}required(e){const n={};return N.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Se;)s=s._def.innerType;n[r]=s}}),new U(E(d({},this._def),{shape:()=>n}))}keyof(){return Ps(N.objectKeys(this.shape))}}U.create=(t,e)=>new U(d({shape:()=>t,unknownKeys:"strip",catchall:Ie.create(),typeName:S.ZodObject},T(e)));U.strictCreate=(t,e)=>new U(d({shape:()=>t,unknownKeys:"strict",catchall:Ie.create(),typeName:S.ZodObject},T(e)));U.lazycreate=(t,e)=>new U(d({shape:t,unknownKeys:"strip",catchall:Ie.create(),typeName:S.ZodObject},T(e)));class Dt extends A{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(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 ue(o.ctx.common.issues));return y(n,{code:f.invalid_union,unionErrors:i}),x}if(n.common.async)return Promise.all(r.map(a=>Ee(this,null,function*(){const i=E(d({},n),{common:E(d({},n.common),{issues:[]}),parent:null});return{result:yield a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}}))).then(s);{let a;const i=[];for(const u of r){const c=E(d({},n),{common:E(d({},n.common),{issues:[]}),parent:null}),h=u._parseSync({data:n.data,path:n.path,parent:c});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new ue(u));return y(n,{code:f.invalid_union,unionErrors:o}),x}}get options(){return this._def.options}}Dt.create=(t,e)=>new Dt(d({options:t,typeName:S.ZodUnion},T(e)));const De=t=>t instanceof $t?De(t.schema):t instanceof ve?De(t.innerType()):t instanceof Ft?[t.value]:t instanceof We?t.options:t instanceof Wt?N.objectValues(t.enum):t instanceof zt?De(t._def.innerType):t instanceof Pt?[void 0]:t instanceof Zt?[null]:t instanceof Se?[void 0,...De(t.unwrap())]:t instanceof ze?[null,...De(t.unwrap())]:t instanceof Ar||t instanceof Vt?De(t.unwrap()):t instanceof Ut?De(t._def.innerType):[];class wn extends A{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return y(n,{code:f.invalid_type,expected:_.object,received:n.parsedType}),x;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);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:[r]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=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(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new wn(d({typeName:S.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s},T(r)))}}function nr(t,e){const n=Re(t),r=Re(e);if(t===e)return{valid:!0,data:t};if(n===_.object&&r===_.object){const s=N.objectKeys(e),a=N.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i=d(d({},t),e);for(const o of a){const u=nr(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(n===_.array&&r===_.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],u=nr(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return n===_.date&&r===_.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Mt extends A{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,i)=>{if(er(a)||er(i))return x;const o=nr(a.value,i.value);return o.valid?((tr(a)||tr(i))&&n.dirty(),{status:n.value,value:o.data}):(y(r,{code:f.invalid_intersection_types}),x)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Mt.create=(t,e,n)=>new Mt(d({left:t,right:e,typeName:S.ZodIntersection},T(n)));class Oe extends A{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.array)return y(r,{code:f.invalid_type,expected:_.array,received:r.parsedType}),x;if(r.data.length<this._def.items.length)return y(r,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&r.data.length>this._def.items.length&&(y(r,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new xe(r,a,r.path,i)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>Q.mergeArray(n,a)):Q.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Oe(E(d({},this._def),{rest:e}))}}Oe.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Oe(d({items:t,typeName:S.ZodTuple,rest:null},T(e)))};class Lt extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.object)return y(r,{code:f.invalid_type,expected:_.object,received:r.parsedType}),x;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)s.push({key:a._parse(new xe(r,o,r.path,o)),value:i._parse(new xe(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?Q.mergeObjectAsync(n,s):Q.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof A?new Lt(d({keyType:e,valueType:n,typeName:S.ZodRecord},T(r))):new Lt(d({keyType:ye.create(),valueType:e,typeName:S.ZodRecord},T(n)))}}class mn extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.map)return y(r,{code:f.invalid_type,expected:_.map,received:r.parsedType}),x;const s=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,u],c)=>({key:s._parse(new xe(r,o,r.path,[c,"key"])),value:a._parse(new xe(r,u,r.path,[c,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(()=>Ee(this,null,function*(){for(const u of i){const c=yield u.key,h=yield u.value;if(c.status==="aborted"||h.status==="aborted")return x;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}))}else{const o=new Map;for(const u of i){const c=u.key,h=u.value;if(c.status==="aborted"||h.status==="aborted")return x;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}}}mn.create=(t,e,n)=>new mn(d({valueType:e,keyType:t,typeName:S.ZodMap},T(n)));class et extends A{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.set)return y(r,{code:f.invalid_type,expected:_.set,received:r.parsedType}),x;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(y(r,{code:f.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(y(r,{code:f.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function i(u){const c=new Set;for(const h of u){if(h.status==="aborted")return x;h.status==="dirty"&&n.dirty(),c.add(h.value)}return{status:n.value,value:c}}const o=[...r.data.values()].map((u,c)=>a._parse(new xe(r,u,r.path,c)));return r.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,n){return new et(E(d({},this._def),{minSize:{value:e,message:w.toString(n)}}))}max(e,n){return new et(E(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:S.ZodSet},T(e)));class ht extends A{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.function)return y(n,{code:f.invalid_type,expected:_.function,received:n.parsedType}),x;function r(o,u){return dn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cn(),yt].filter(c=>!!c),issueData:{code:f.invalid_arguments,argumentsError:u}})}function s(o,u){return dn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cn(),yt].filter(c=>!!c),issueData:{code:f.invalid_return_type,returnTypeError:u}})}const a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof vt){const o=this;return re(function(...u){return Ee(this,null,function*(){const c=new ue([]),h=yield o._def.args.parseAsync(u,a).catch(k=>{throw c.addIssue(r(u,k)),c}),p=yield Reflect.apply(i,this,h);return yield o._def.returns._def.type.parseAsync(p,a).catch(k=>{throw c.addIssue(s(p,k)),c})})})}else{const o=this;return re(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new ue([r(u,c.error)]);const h=Reflect.apply(i,this,c.data),p=o._def.returns.safeParse(h,a);if(!p.success)throw new ue([s(h,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ht(E(d({},this._def),{args:Oe.create(e).rest(Xe.create())}))}returns(e){return new ht(E(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new ht(d({args:e||Oe.create([]).rest(Xe.create()),returns:n||Xe.create(),typeName:S.ZodFunction},T(r)))}}class $t extends A{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:S.ZodLazy},T(e)));class Ft extends A{_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}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ft.create=(t,e)=>new Ft(d({value:t,typeName:S.ZodLiteral},T(e)));function Ps(t,e){return new We(d({values:t,typeName:S.ZodEnum},T(e)))}class We extends A{constructor(){super(...arguments),Ot.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{expected:N.joinValues(r),received:n.parsedType,code:f.invalid_type}),x}if(fn(this,Ot)||Ns(this,Ot,new Set(this._def.values)),!fn(this,Ot).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{received:n.data,code:f.invalid_enum_value,options:r}),x}return re(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(r=>!e.includes(r)),d(d({},this._def),n))}}Ot=new WeakMap;We.create=Ps;class Wt extends A{constructor(){super(...arguments),Tt.set(this,void 0)}_parse(e){const n=N.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==_.string&&r.parsedType!==_.number){const s=N.objectValues(n);return y(r,{expected:N.joinValues(s),received:r.parsedType,code:f.invalid_type}),x}if(fn(this,Tt)||Ns(this,Tt,new Set(N.getValidEnumValues(this._def.values))),!fn(this,Tt).has(e.data)){const s=N.objectValues(n);return y(r,{received:r.data,code:f.invalid_enum_value,options:s}),x}return re(e.data)}get enum(){return this._def.values}}Tt=new WeakMap;Wt.create=(t,e)=>new Wt(d({values:t,typeName:S.ZodNativeEnum},T(e)));class vt extends A{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.promise&&n.common.async===!1)return y(n,{code:f.invalid_type,expected:_.promise,received:n.parsedType}),x;const r=n.parsedType===_.promise?n.data:Promise.resolve(n.data);return re(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}vt.create=(t,e)=>new vt(d({type:t,typeName:S.ZodPromise},T(e)));class ve extends A{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{y(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(o=>Ee(this,null,function*(){if(n.value==="aborted")return x;const u=yield this._def.schema._parseAsync({data:o,path:r.path,parent:r});return u.status==="aborted"?x:u.status==="dirty"||n.value==="dirty"?ln(u.value):u}));{if(n.value==="aborted")return x;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?x:o.status==="dirty"||n.value==="dirty"?ln(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?x:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?x:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ye(i))return i;const o=s.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:r.data,path:r.path,parent:r}).then(i=>Ye(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:n.value,value:o})):i);N.assertNever(s)}}ve.create=(t,e,n)=>new ve(d({schema:t,typeName:S.ZodEffects,effect:e},T(n)));ve.createWithPreprocess=(t,e,n)=>new ve(d({schema:e,effect:{type:"preprocess",transform:t},typeName:S.ZodEffects},T(n)));class Se extends A{_parse(e){return this._getType(e)===_.undefined?re(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Se.create=(t,e)=>new Se(d({innerType:t,typeName:S.ZodOptional},T(e)));class ze extends A{_parse(e){return this._getType(e)===_.null?re(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ze.create=(t,e)=>new ze(d({innerType:t,typeName:S.ZodNullable},T(e)));class zt extends A{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===_.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}zt.create=(t,e)=>new zt(d({innerType:t,typeName:S.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},T(e)));class Ut extends A{_parse(e){const{ctx:n}=this._processInputParams(e),r=E(d({},n),{common:E(d({},n.common),{issues:[]})}),s=this._def.innerType._parse({data:r.data,path:r.path,parent:d({},r)});return jt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ue(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ue(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ut.create=(t,e)=>new Ut(d({innerType:t,typeName:S.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},T(e)));class yn extends A{_parse(e){if(this._getType(e)!==_.nan){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.nan,received:n.parsedType}),x}return{status:"valid",value:e.data}}}yn.create=t=>new yn(d({typeName:S.ZodNaN},T(t)));const qi=Symbol("zod_brand");class Ar extends A{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Gt extends A{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return Ee(this,null,function*(){const s=yield this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?x:s.status==="dirty"?(n.dirty(),ln(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})});{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?x:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Gt({in:e,out:n,typeName:S.ZodPipeline})}}class Vt extends A{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Ye(s)&&(s.value=Object.freeze(s.value)),s);return jt(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Vt.create=(t,e)=>new Vt(d({innerType:t,typeName:S.ZodReadonly},T(e)));function rs(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Zs(t,e={},n){return t?gt.create().superRefine((r,s)=>{var a,i;const o=t(r);if(o instanceof Promise)return o.then(u=>{var c,h;if(!u){const p=rs(e,r),k=(h=(c=p.fatal)!==null&&c!==void 0?c:n)!==null&&h!==void 0?h:!0;s.addIssue(E(d({code:"custom"},p),{fatal:k}))}});if(!o){const u=rs(e,r),c=(i=(a=u.fatal)!==null&&a!==void 0?a:n)!==null&&i!==void 0?i:!0;s.addIssue(E(d({code:"custom"},u),{fatal:c}))}}):gt.create()}const Bi={object:U.lazycreate};var S;(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"})(S||(S={}));const Hi=(t,e={message:`Input not instance of ${t.name}`})=>Zs(n=>n instanceof t,e),Ds=ye.create,Ms=$e.create,Gi=yn.create,Ji=Fe.create,Ls=It.create,Xi=Qe.create,Yi=hn.create,Qi=Pt.create,eo=Zt.create,to=gt.create,no=Xe.create,ro=Ie.create,so=pn.create,ao=ge.create,io=U.create,oo=U.strictCreate,uo=Dt.create,co=wn.create,lo=Mt.create,fo=Oe.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,ss=ve.create,ko=Se.create,So=ze.create,Eo=ve.createWithPreprocess,xo=Gt.create,Oo=()=>Ds().optional(),To=()=>Ms().optional(),Ao=()=>Ls().optional(),Co={string:t=>ye.create(E(d({},t),{coerce:!0})),number:t=>$e.create(E(d({},t),{coerce:!0})),boolean:t=>It.create(E(d({},t),{coerce:!0})),bigint:t=>Fe.create(E(d({},t),{coerce:!0})),date:t=>Qe.create(E(d({},t),{coerce:!0}))},No=x;var j=Object.freeze({__proto__:null,defaultErrorMap:yt,setErrorMap:Si,getErrorMap:cn,makeIssue:dn,EMPTY_PATH:Ei,addIssueToContext:y,ParseStatus:Q,INVALID:x,DIRTY:ln,OK:re,isAborted:er,isDirty:tr,isValid:Ye,isAsync:jt,get util(){return N},get objectUtil(){return Qn},ZodParsedType:_,getParsedType:Re,ZodType:A,datetimeRegex:Is,ZodString:ye,ZodNumber:$e,ZodBigInt:Fe,ZodBoolean:It,ZodDate:Qe,ZodSymbol:hn,ZodUndefined:Pt,ZodNull:Zt,ZodAny:gt,ZodUnknown:Xe,ZodNever:Ie,ZodVoid:pn,ZodArray:ge,ZodObject:U,ZodUnion:Dt,ZodDiscriminatedUnion:wn,ZodIntersection:Mt,ZodTuple:Oe,ZodRecord:Lt,ZodMap:mn,ZodSet:et,ZodFunction:ht,ZodLazy:$t,ZodLiteral:Ft,ZodEnum:We,ZodNativeEnum:Wt,ZodPromise:vt,ZodEffects:ve,ZodTransformer:ve,ZodOptional:Se,ZodNullable:ze,ZodDefault:zt,ZodCatch:Ut,ZodNaN:yn,BRAND:qi,ZodBranded:Ar,ZodPipeline:Gt,ZodReadonly:Vt,custom:Zs,Schema:A,ZodSchema:A,late:Bi,get ZodFirstPartyTypeKind(){return S},coerce:Co,any:to,array:ao,bigint:Ji,boolean:Ls,date:Xi,discriminatedUnion:co,effect:ss,enum:_o,function:yo,instanceof:Hi,intersection:lo,lazy:go,literal:vo,map:po,nan:Gi,nativeEnum:bo,never:ro,null:eo,nullable:So,number:Ms,object:io,oboolean:Ao,onumber:To,optional:ko,ostring:Oo,pipeline:xo,preprocess:Eo,promise:wo,record:ho,set:mo,strictObject:oo,string:Ds,symbol:Yi,transformer:ss,tuple:fo,undefined:Qi,union:uo,unknown:no,void:so,NEVER:No,ZodIssueCode:f,quotelessJson:ki,ZodError:ue});j.object({language:j.enum(["typescript","javascript"]).optional(),disableMarkedForExport:j.boolean().optional(),allowAutoSelectFirstNode:j.boolean().optional().default(!0),enableDisplayDataId:j.boolean().optional(),enableDisplayDataName:j.boolean().optional()}).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 as 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 Ro(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:r=In,onComment:s}=t;let a="",i=!0,o,u="",c="";function h(m){const g=i?m.replace(/^\xEF\xBB\xBF/,""):m,[l,O]=jo(`${a}${g}`);for(const I of l)p(I);a=O,i=!1}function p(m){if(m===""){v();return}if(m.startsWith(":")){s&&s(m.slice(m.startsWith(": ")?2:1));return}const g=m.indexOf(":");if(g!==-1){const l=m.slice(0,g),O=m[g+1]===" "?2:1,I=m.slice(g+O);k(l,I,m);return}k(m,"",m)}function k(m,g,l){switch(m){case"event":c=g;break;case"data":u=`${u}${g}
|
|
1
|
+
"use strict";var sa=Object.defineProperty,aa=Object.defineProperties;var ia=Object.getOwnPropertyDescriptors;var zr=Object.getOwnPropertySymbols;var oa=Object.prototype.hasOwnProperty,ua=Object.prototype.propertyIsEnumerable;var Ur=(t,e,n)=>e in t?sa(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)&&Ur(t,n,e[n]);if(zr)for(var n of zr(e))ua.call(e,n)&&Ur(t,n,e[n]);return t},Vr=(t,e)=>aa(t,ia(e));var De=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("react"),ca=t=>{let e="";const n=new Uint8Array(t),r=n.byteLength;for(let s=0;s<r;s++)e+=String.fromCharCode(n[s]);return btoa(e)};var da=Object.defineProperty,la=Object.defineProperties,fa=Object.getOwnPropertyDescriptors,Kr=Object.getOwnPropertySymbols,ha=Object.prototype.hasOwnProperty,pa=Object.prototype.propertyIsEnumerable,qr=(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)&&qr(t,n,e[n]);if(Kr)for(var n of Kr(e))pa.call(e,n)&&qr(t,n,e[n]);return t},E=(t,e)=>la(t,fa(e)),xe=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())});class Br extends Error{constructor({name:e,reason:n,status:r,detail:s}){super(),this.name=e,this.message=n,this.detail=s,this.status=r}}const ma="Figma Token Issue";class ya extends Error{constructor({fileKey:e,reason:n,cause:r}){super(ma),this.fileKey=e,this.reason=n,this.cause=r}}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 Sa="Unknown Figma API Exception";class Ea extends Error{constructor({fileKey:e,cause:n}){super(Sa),this.name="UnknownFigmaApiException",this.fileKey=e,this.cause=n}}const xa=(t,e)=>{var n;if(((n=t==null?void 0:t.cause)==null?void 0:n.message)==="Fetch Error"){const{err:r,status:s}=t.cause.body;if(s===403)return new ya({fileKey:e,reason:r,cause:t});if(s===429)return new va({fileKey:e,cause:t});if(s===404)return new ka({fileKey:e,cause:t});if(s===400&&r.includes("Request too large"))return new ba({fileKey:e,cause:t})}return new Ea({fileKey:e,cause:t})};var Oa=Object.defineProperty,Ta=Object.defineProperties,Aa=Object.getOwnPropertyDescriptors,Hr=Object.getOwnPropertySymbols,Ca=Object.prototype.hasOwnProperty,Na=Object.prototype.propertyIsEnumerable,Gr=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),xs=t=>{throw TypeError(t)},Jr=(t,e,n)=>e in t?Oa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,oe=(t,e)=>{for(var n in e||(e={}))Ca.call(e,n)&&Jr(t,n,e[n]);if(Hr)for(var n of Hr(e))Na.call(e,n)&&Jr(t,n,e[n]);return t},xr=(t,e)=>Ta(t,Aa(e)),Or=(t,e,n)=>e.has(t)||xs("Cannot "+n),P=(t,e,n)=>(Or(t,e,"read from private field"),n?n.call(t):e.get(t)),pe=(t,e,n)=>e.has(t)?xs("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),X=(t,e,n,r)=>(Or(t,e,"write to private field"),e.set(t,n),n),ke=(t,e,n)=>(Or(t,e,"access private method"),n),B=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())}),Ra=(t,e,n)=>(e=t[Gr("asyncIterator")])?e.call(t):(t=t[Gr("iterator")](),e={},n=(r,s)=>(s=t[r])&&(e[r]=a=>new Promise((i,o,u)=>(a=s.call(t,a),u=a.done,Promise.resolve(a.value).then(c=>i({value:c,done:u}),o)))),n("next"),n("return"),e),ja=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 Vn={exports:{}},Pa=Vn.exports,Xr;function Za(){return Xr||(Xr=1,function(t,e){(function(n,r){t.exports=r()})(Pa,function(){var n=typeof Promise=="function",r=typeof self=="object"?self:ja,s=typeof Symbol!="undefined",a=typeof Map!="undefined",i=typeof Set!="undefined",o=typeof WeakMap!="undefined",u=typeof WeakSet!="undefined",c=typeof DataView!="undefined",h=s&&typeof Symbol.iterator!="undefined",p=s&&typeof Symbol.toStringTag!="undefined",k=i&&typeof Set.prototype.entries=="function",v=a&&typeof Map.prototype.entries=="function",b=k&&Object.getPrototypeOf(new Set().entries()),m=v&&Object.getPrototypeOf(new Map().entries()),g=h&&typeof Array.prototype[Symbol.iterator]=="function",l=g&&Object.getPrototypeOf([][Symbol.iterator]()),O=h&&typeof String.prototype[Symbol.iterator]=="function",I=O&&Object.getPrototypeOf(""[Symbol.iterator]()),q=8,Z=-1;function V(D){var M=typeof D;if(M!=="object")return M;if(D===null)return"null";if(D===r)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 le=p&&D[Symbol.toStringTag];if(typeof le=="string")return le;var L=Object.getPrototypeOf(D);return L===RegExp.prototype?"RegExp":L===Date.prototype?"Date":n&&L===Promise.prototype?"Promise":i&&L===Set.prototype?"Set":a&&L===Map.prototype?"Map":u&&L===WeakSet.prototype?"WeakSet":o&&L===WeakMap.prototype?"WeakMap":c&&L===DataView.prototype?"DataView":a&&L===m?"Map Iterator":i&&L===b?"Set Iterator":g&&L===l?"Array Iterator":O&&L===I?"String Iterator":L===null?"Object":Object.prototype.toString.call(D).slice(q,Z)}return V})}(Vn)),Vn.exports}var Da=Za();const Ma=Ia(Da),Tr=typeof Buffer!="undefined",La=Tr&&typeof Buffer.from!="undefined",$a=Tr?function(t){return Buffer.isBuffer(t)}:function(){return!1},Fa=La?function(t){return Buffer.from(t)}:Tr?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 za(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 Yr(t,e,n,r=null){switch(r||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 Ua=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,Va=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,Ka=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,Cn=Ua||Va||Ka||Function("return this")();function qa(t){return t.slice(0)}function Ba(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 Re(t,e){return Cn[e].from?Cn[e].from(t):new Cn[e](t)}function ee(t){return t}function Qr(){return[]}function ei(){return new Map}function ti(){return{}}function ni(){return new Set}const ri=new Map([["ArrayBuffer",qa],["Boolean",Ba],["Buffer",Ga],["DataView",Ha],["Date",Ja],["Number",Xa],["RegExp",Ya],["String",Qa],["Float32Array",Re],["Float64Array",Re],["Int16Array",Re],["Int32Array",Re],["Int8Array",Re],["Uint16Array",Re],["Uint32Array",Re],["Uint8Array",Re],["Uint8ClampedArray",Re],["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",Qr],["Array",Qr],["Map",ei],["Object",ti],["Set",ni]]);function si(){}function qn(t,e=null,n=si){arguments.length===2&&typeof e=="function"&&(n=e,e=null);const r=e||mt(t),s=ri.get(r);if(r==="Object"){const a=n(t,r);if(a!==void 0)return a}return s?s(t,r):t}function kt(t,e={}){typeof e=="function"&&(e={customizer:e});const{customizer:n}=e,r=mt(t);if(!Kn(r))return Bn(t,null,null,null);const s=qn(t,r,n),a=new WeakMap([[t,s]]),i=new WeakSet([t]);return Bn(t,s,a,i)}function Bn(t,e,n,r,s){const a=mt(t),i=qn(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 u of o){const c=za(t,u,a);if(r.has(c))Yr(e,u,n.get(c),a);else{const h=mt(c),p=qn(c,h);Kn(h)&&(n.set(c,p),r.add(c)),Yr(e,u,Bn(c,p,n,r),a)}}return e}const ai=t=>new Promise(e=>setTimeout(e,t));var rn,Ge,sn,Hn,Os;class ii{constructor({maxAttempts:e=3,func:n}){pe(this,Hn),pe(this,rn),pe(this,Ge),pe(this,sn),X(this,rn,e),X(this,sn,n),X(this,Ge,0)}run(){return B(this,null,function*(){try{return yield P(this,sn).call(this)}catch(e){if(X(this,Ge,P(this,Ge)+1),P(this,Ge)>P(this,rn))throw console.error("Max attempts reached"),e;const n=ke(this,Hn,Os).call(this);return yield ai(n),yield this.run()}})}}rn=new WeakMap,Ge=new WeakMap,sn=new WeakMap,Hn=new WeakSet,Os=function(){return P(this,Ge)*1e3*1.5};function oi(){return typeof CompressionStream!="undefined"}function ui(t){return B(this,null,function*(){const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=[];try{for(var r=Ra(e),s,a,i;s=!(a=yield r.next()).done;s=!1){const o=a.value;n.push(o)}}catch(o){i=[o]}finally{try{s&&(a=r.return)&&(yield a.call(r))}finally{if(i)throw i[0]}}return yield ci(n)})}function ci(t){return B(this,null,function*(){const e=yield new Blob(t).arrayBuffer();return new Uint8Array(e)})}class di extends Error{constructor({resource:e,api:n,args:r,cause:s}){if(super(`API Error on resource "${e}" at api "${n}"`),this.causeProperties={},this.name="API Error",this.resource=e,this.api=n,this.cause=s,this.args=r,s instanceof Error)for(const[i,o]of Object.entries(s))if(typeof Headers!="undefined"&&o instanceof Headers){const u={};o.forEach((c,h)=>{u[h]=c}),this.causeProperties[i]=u}else this.causeProperties[i]=o;const a=this.causeProperties.body;a&&typeof a=="object"&&"code"in a&&(this.code=a.code)}}class es extends Error{constructor({url:e,method:n,statusCode:r,requestHeaders:s,responseHeaders:a,body:i}){if(super("Fetch Error"),this.name="Fetch Error",this.url=e,this.method=n,this.statusNumber=r,this.requestHeaders=s,this.responseHeaders=a,i)try{const o=JSON.parse(i);this.body=o}catch(o){this.body=i}}}class St 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 Nn extends Error{constructor(e){super(e),this.name="Request Validation Error"}}function Ts(){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 Je,se,be,Jn,Xn,Et;class pi{constructor({fetch:e=globalThis.fetch.bind(globalThis),baseAddress:n}){pe(this,be),pe(this,Je),pe(this,se),this.baseAddress=n,X(this,Je,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 B(this,arguments,function*(n,r={}){const{overrideBaseAddress:s,overrideDefaultHeaders:a}=r,i=s!=null?s:this.baseAddress;let o=a!=null?a:this.headers;const u=kt(P(this,se));return X(this,se,{}),u.extraHeaders&&(o=oe(oe({},o),u.extraHeaders)),u.requestValidation&&(o=xr(oe({},o),{"X-Request-Nonce":Ts(),"X-Request-Timestamp":Gn()})),u.async?yield ke(this,be,Xn).call(this,`${i}${n}`,u.async,{headers:o}):yield ke(this,be,Jn).call(this,`${i}${n}`,u,{headers:o})})}post(e,n){return B(this,arguments,function*(r,s,a={}){const i=kt(P(this,se));return X(this,se,{}),ke(this,be,Et).call(this,r,"POST",s,a,i)})}put(e,n){return B(this,arguments,function*(r,s,a={}){const i=kt(P(this,se));return X(this,se,{}),ke(this,be,Et).call(this,r,"PUT",s,a,i)})}delete(e,n){return B(this,arguments,function*(r,s,a={}){const i=kt(P(this,se));return X(this,se,{}),ke(this,be,Et).call(this,r,"DELETE",s,a,i)})}patch(e,n){return B(this,arguments,function*(r,s,a={}){const i=kt(P(this,se));return X(this,se,{}),ke(this,be,Et).call(this,r,"PATCH",s,a,i)})}}Je=new WeakMap,se=new WeakMap,be=new WeakSet,Jn=function(t,e,n){return B(this,null,function*(){const r=()=>B(this,null,function*(){var u,c;try{return yield P(this,Je).call(this,t,oe(oe({},n),e.abortSignal&&{signal:e.abortSignal}))}catch(h){throw h instanceof Error&&h.name==="AbortError"?new St({canceled:(c=(u=e.abortSignal)==null?void 0:u.aborted)!=null?c:!1}):h}}),{headers:s}=n!=null?n:{},a=(u,c)=>{var h,p;return((h=u==null?void 0:u.headers)==null?void 0:h.get(c))||((p=u==null?void 0:u.headersObject)==null?void 0:p[c])||""},i=u=>B(this,null,function*(){var c;if(!u.ok){const p=yield u.text().catch();throw new es({url:t,method:(c=n==null?void 0:n.method)!=null?c:"GET",statusCode:u.status,requestHeaders:s,responseHeaders:u.headers,body:p})}if(e.requestValidation&&process.env.UI_TESTS!==!0)try{const p=a(u,"x-response-nonce"),k=s==null?void 0:s["X-Request-Nonce"];if(!p||p!==k)throw new Nn("Response nonce mismatch");const v=Number(a(u,"x-response-timestamp")),b=Number(Gn()),m=60*60*24;if(isNaN(v)||Math.abs(b-v)>m)throw new Nn("Invalid response timestamp")}catch(p){const k=p instanceof Error?p.message:"Request validation failed";throw new Nn(k)}let h=yield u.text();try{h=JSON.parse(h)}catch(p){}return h});if(e.retry){const u=yield new ii({maxAttempts:e.retry,func:r}).run();return yield i(u)}const o=yield r();return yield i(o)})},Xn=function(t,e,n){return B(this,null,function*(){var r,s;const{onProgress:a,abortSignal:i,pollingInterval:o=()=>hi,maxTimeout:u=fi}=e,c=`${t}/async`,h=`${t}/async/job`;let p;try{p=yield P(this,Je).call(this,c,oe(oe({},n),i&&{signal:i}))}catch(b){throw b instanceof Error&&b.name==="AbortError"?new St({canceled:(r=i==null?void 0:i.aborted)!=null?r:!1}):b}if(!p.ok){const b=yield p.text().catch();throw new es({url:t,method:(s=n==null?void 0:n.method)!=null?s:"GET",statusCode:p.status,requestHeaders:this.headers,responseHeaders:p.headers,body:b})}const k=yield p.json(),{job_id:v}=k;if(!v)throw new Error("Job ID not found in response");return new Promise((b,m)=>B(this,null,function*(){const g=setTimeout(()=>{m(new Error("Job timed out"))},u),l=(O=0)=>B(this,null,function*(){if(i!=null&&i.aborted){clearTimeout(g),P(this,Je).call(this,`${h}/${v}/cancel`,{method:"POST",headers:this.headers}).then(()=>{m(new St({canceled:!0}))}).catch(I=>{m(new St({canceled:!1}))});return}try{const I=yield(yield P(this,Je).call(this,`${h}/${v}`,{headers:this.headers})).json();if(I.status==="success"){clearTimeout(g);const q=I.response_json;b(q)}else if(I.status==="failed")clearTimeout(g),m(new li(I.response_json));else{a&&a(I.response_json);const q=o(O);setTimeout(()=>l(O+1),q)}}catch(I){m(I)}});l()}))})},Et=function(t,e,n,r,s){return B(this,null,function*(){const{overrideBaseAddress:a,overrideDefaultHeaders:i}=r,o=a!=null?a:this.baseAddress;let u=i!=null?i:this.headers;s.extraHeaders&&(u=oe(oe({},u),s.extraHeaders)),s.requestValidation&&(u=xr(oe({},u),{"X-Request-Nonce":Ts(),"X-Request-Timestamp":Gn()}));let c=n;return typeof FormData!="undefined"&&n instanceof FormData?delete u["Content-Type"]:(c=r.skipBodyJsonStringify?n:JSON.stringify(n),s.compress&&oi()&&(u["Content-Encoding"]="gzip",c=yield ui(c))),s.async?yield ke(this,be,Xn).call(this,`${o}${t}`,s.async,{method:e,headers:u,body:c}):yield ke(this,be,Jn).call(this,`${o}${t}`,s,{method:e,headers:u,body:c})})};const ts=(t,e,n,r)=>t instanceof St?t:new di({resource:e,api:String(n),args:r,cause:t}),Rn=(t,e)=>new Proxy(e,{get(n,r){return(...s)=>{var a;for(const o of t.plugins){const u=(a=o.beforeApi)==null?void 0:a.call(o,{resource:n.resourceName,api:r,args:s});if(u!==void 0)return u}let i;try{i=n[r](...s)}catch(o){throw ts(o,n.resourceName,r,s)}return i instanceof Promise?i.catch(o=>{throw ts(o,n.resourceName,r,s)}):i}}});var xt;class mi{constructor(e){pe(this,xt),this.resourceName="Files",X(this,xt,e)}get(e){return B(this,arguments,function*({fileKey:n,params:r={}}){const s=new URLSearchParams(oe({plugin_data:"857346721138427857"},r)).toString(),a=`v1/files/${n}?${s}`;return yield P(this,xt).get(a)})}getImageFills(e){return B(this,arguments,function*({fileKey:n}){var r,s;const a=`v1/files/${n}/images`;return(s=(r=(yield P(this,xt).get(a)).meta)==null?void 0:r.images)!=null?s:{}})}}xt=new WeakMap;const yi=(t,e,n)=>{const r=e.sort();return`${t}-${r.join("-")}-${n}`},gi=t=>t?t.ts>Date.now()-1e3*30:!1;var we,Yn,As;class vi{constructor(e){pe(this,Yn),pe(this,we),this.resourceName="Images",X(this,we,e)}get(e){return B(this,arguments,function*({fileKey:n,nodeIds:r,format:s="jpg",scale:a}){const i=yi(n,r,s),o=P(this,we).cache.images.entries.get(i);if(gi(o))return o.result;o&&P(this,we).cache.images.entries.delete(i);const u=P(this,we).cache.images.pendingRequests.get(i);if(u)return u;const c=ke(this,Yn,As).call(this,i,n,r,s,a);P(this,we).cache.images.pendingRequests.set(i,c);try{return yield c}finally{P(this,we).cache.images.pendingRequests.delete(i)}})}}we=new WeakMap,Yn=new WeakSet,As=function(t,e,n,r,s){return B(this,null,function*(){const a=yield P(this,we).get(`v1/images/${e}?ids=${n}&format=${r}${s?`&scale=${s}`:""}`);return P(this,we).cache.images.entries.set(t,{result:a,ts:Date.now()}),a})};var an;class _i{constructor(e){pe(this,an),this.resourceName="Nodes",X(this,an,e)}get(e){return B(this,arguments,function*({fileKey:n,nodeIds:r,params:s={}}){const a=xr(oe({},s),{ids:r.join(",")}),i=new URLSearchParams(oe({plugin_data:"857346721138427857"},a)).toString(),o=`v1/files/${n}/nodes?${i}`;return yield P(this,an).get(o)})}}an=new WeakMap;var Me;class bi extends pi{constructor({baseAddress:e="https://api.figma.com/",fetch:n=globalThis.fetch.bind(globalThis)}={}){super({fetch:n,baseAddress:e}),pe(this,Me,""),this.cache={images:{entries:new Map,pendingRequests:new Map}},this.files=Rn(this,new mi(this)),this.nodes=Rn(this,new _i(this)),this.images=Rn(this,new vi(this))}set token(e){if(!e.startsWith("figd_")&&!e.startsWith("figu_"))throw new Error("Invalid Figma access token");X(this,Me,e)}get token(){return P(this,Me)}get headers(){const e={"Content-Type":"application/json"};return P(this,Me).startsWith("figd_")?e["X-FIGMA-TOKEN"]=P(this,Me):P(this,Me).startsWith("figu_")&&(e.Authorization=`Bearer ${P(this,Me)}`),e}}Me=new WeakMap;const wi=t=>xe(void 0,[t],function*({fileKey:e,authToken:n,figmaRestApi:r=new bi,params:s={},signal:a}){n&&(r.token=n);try{return yield r.withOptions({abortSignal:a}).files.get({fileKey:e,params:s})}catch(i){throw i instanceof Error&&i.name==="AbortError"?i:(console.error(i),xa(i,e))}});var N;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(N||(N={}));var Qn;(function(t){t.mergeShapes=(e,n)=>d(d({},e),n)})(Qn||(Qn={}));const _=N.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ie=t=>{switch(typeof t){case"undefined":return _.undefined;case"string":return _.string;case"number":return isNaN(t)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(t)?_.array:t===null?_.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?_.promise:typeof Map!="undefined"&&t instanceof Map?_.map:typeof Set!="undefined"&&t instanceof Set?_.set:typeof Date!="undefined"&&t instanceof Date?_.date:_.object;default:return _.unknown}},f=N.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 ue extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};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},r={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let o=r,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return s(this),r}static assert(e){if(!(e instanceof ue))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,N.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ue.create=t=>new ue(t);const yt=(t,e)=>{let n;switch(t.code){case f.invalid_type:t.received===_.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,N.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${N.joinValues(t.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${N.joinValues(t.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${N.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}"`:N.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,N.assertNever(t)}return{message:n}};let Cs=yt;function Si(t){Cs=t}function cn(){return Cs}const dn=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],i=E(d({},s),{path:a});if(s.message!==void 0)return E(d({},s),{path:a,message:s.message});let o="";const u=r.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return E(d({},s),{path:a,message:o})},Ei=[];function y(t,e){const n=cn(),r=dn({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===yt?void 0:yt].filter(s=>!!s)});t.common.issues.push(r)}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 r=[];for(const s of n){if(s.status==="aborted")return x;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static mergeObjectAsync(e,n){return xe(this,null,function*(){const r=[];for(const s of n){const a=yield s.key,i=yield s.value;r.push({key:a,value:i})}return Y.mergeObjectSync(e,r)})}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return x;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value!="undefined"||s.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const x=Object.freeze({status:"aborted"}),ln=t=>({status:"dirty",value:t}),ne=t=>({status:"valid",value:t}),er=t=>t.status==="aborted",tr=t=>t.status==="dirty",Qe=t=>t.status==="valid",jt=t=>typeof Promise!="undefined"&&t instanceof Promise;function fn(t,e,n,r){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 Ns(t,e,n,r,s){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 Oe{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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 ns=(t,e)=>{if(Qe(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 ue(t.common.issues);return this._error=n,this._error}}};function T(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,i)=>{var o,u;const{message:c}=t;return a.code==="invalid_enum_value"?{message:c!=null?c:i.defaultError}:typeof i.data=="undefined"?{message:(o=c!=null?c:r)!==null&&o!==void 0?o:i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:(u=c!=null?c:n)!==null&&u!==void 0?u:i.defaultError}},description:s}}class A{get description(){return this._def.description}_getType(e){return Ie(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Ie(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:Ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(jt(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 r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ie(e)},a=this._parseSync({data:e,path:s.path,parent:s});return ns(s,a)}"~validate"(e){var n,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Ie(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return Qe(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((r=(n=a==null?void 0:a.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>Qe(a)?{value:a.value}:{issues:s.common.issues})}parseAsync(e,n){return xe(this,null,function*(){const r=yield this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error})}safeParseAsync(e,n){return xe(this,null,function*(){const r={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:Ie(e)},s=this._parse({data:e,path:r.path,parent:r}),a=yield jt(s)?s:Promise.resolve(s);return ns(r,a)})}refine(e,n){const r=s=>typeof n=="string"||typeof n=="undefined"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue(d({code:f.custom},r(s)));return typeof Promise!="undefined"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new _e({schema:this,typeName:S.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 Ee.create(this,this._def)}nullable(){return Ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ve.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 _e(E(d({},T(this._def)),{schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){const n=typeof e=="function"?e:()=>e;return new zt(E(d({},T(this._def)),{innerType:this,defaultValue:n,typeName:S.ZodDefault}))}brand(){return new Ar(d({typeName:S.ZodBranded,type:this},T(this._def)))}catch(e){const n=typeof e=="function"?e:()=>e;return new Ut(E(d({},T(this._def)),{innerType:this,catchValue:n,typeName:S.ZodCatch}))}describe(e){const n=this.constructor;return new n(E(d({},this._def),{description:e}))}pipe(e){return Gt.create(this,e)}readonly(){return Vt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const xi=/^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,Ni=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ri=/^[-+]?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)?)??$/,ji=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ii="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let jn;const Pi=/^(?:(?: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}(=)?))?$/,Rs="((\\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(`^${Rs}$`);function js(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(`^${js(t)}$`)}function Is(t){let e=`${Rs}T${js(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 zi(t,e){return!!((e==="v4"||!e)&&Pi.test(t)||(e==="v6"||!e)&&Di.test(t))}function Ui(t,e){if(!Ni.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch(n){return!1}}function Vi(t,e){return!!((e==="v4"||!e)&&Zi.test(t)||(e==="v6"||!e)&&Mi.test(t))}class ge extends A{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.string,received:s.parsedType}),x}const n=new Y;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(r=this._getOrReturnCtx(e,r),a?y(r,{code:f.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&y(r,{code:f.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")ji.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"email",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")jn||(jn=new RegExp(Ii,"u")),jn.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"emoji",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Ai.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"uuid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Ci.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"nanoid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")xi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cuid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Oi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cuid2",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Ti.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"ulid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch(a){r=this._getOrReturnCtx(e,r),y(r,{validation:"url",code:f.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"regex",code:f.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Is(s).test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Fi.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Wi(s).test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Ri.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"duration",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?zi(e.data,s.version)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"ip",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Ui(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"jwt",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Vi(e.data,s.version)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cidr",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Li.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"base64",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?$i.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"base64url",code:f.invalid_string,message:s.message}),n.dirty()):N.assertNever(s);return{status:n.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),d({validation:n,code:f.invalid_string},w.errToObj(r)))}_addCheck(e){return new ge(E(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,r;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:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!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 ge(E(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new ge(E(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new ge(E(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}}ge.create=t=>{var e;return new ge(d({checks:[],typeName:S.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},T(t)))};function Ki(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=parseInt(t.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class We extends A{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)!==_.number){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.number,received:s.parsedType}),x}let n;const r=new Y;for(const s of this._def.checks)s.kind==="int"?N.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?Ki(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_finite,message:s.message}),r.dirty()):N.assertNever(s);return{status:r.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,r,s){return new We(E(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]}))}_addCheck(e){return new We(E(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"&&N.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}We.create=t=>new We(d({checks:[],typeName:S.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1},T(t)));class ze extends A{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(s){return this._getInvalidInput(e)}if(this._getType(e)!==_.bigint)return this._getInvalidInput(e);let n;const r=new Y;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):N.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.bigint,received:n.parsedType}),x}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,r,s){return new ze(E(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]}))}_addCheck(e){return new ze(E(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}}ze.create=t=>{var e;return new ze(d({checks:[],typeName:S.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},T(t)))};class It extends A{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.boolean,received:n.parsedType}),x}return ne(e.data)}}It.create=t=>new It(d({typeName:S.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1},T(t)));class et extends A{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.date,received:s.parsedType}),x}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_date}),x}const n=new Y;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):N.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new et(E(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}}et.create=t=>new et(d({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:S.ZodDate},T(t)));class hn extends A{_parse(e){if(this._getType(e)!==_.symbol){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.symbol,received:n.parsedType}),x}return ne(e.data)}}hn.create=t=>new hn(d({typeName:S.ZodSymbol},T(t)));class Pt extends A{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.undefined,received:n.parsedType}),x}return ne(e.data)}}Pt.create=t=>new Pt(d({typeName:S.ZodUndefined},T(t)));class Zt extends A{_parse(e){if(this._getType(e)!==_.null){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.null,received:n.parsedType}),x}return ne(e.data)}}Zt.create=t=>new Zt(d({typeName:S.ZodNull},T(t)));class gt extends A{constructor(){super(...arguments),this._any=!0}_parse(e){return ne(e.data)}}gt.create=t=>new gt(d({typeName:S.ZodAny},T(t)));class Ye extends A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ne(e.data)}}Ye.create=t=>new Ye(d({typeName:S.ZodUnknown},T(t)));class Ze extends A{_parse(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.never,received:n.parsedType}),x}}Ze.create=t=>new Ze(d({typeName:S.ZodNever},T(t)));class pn extends A{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.void,received:n.parsedType}),x}return ne(e.data)}}pn.create=t=>new pn(d({typeName:S.ZodVoid},T(t)));class ve extends A{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==_.array)return y(n,{code:f.invalid_type,expected:_.array,received:n.parsedType}),x;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,o=n.data.length<s.exactLength.value;(i||o)&&(y(n,{code:i?f.too_big:f.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(y(n,{code:f.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(y(n,{code:f.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>s.type._parseAsync(new Oe(n,i,n.path,o)))).then(i=>Y.mergeArray(r,i));const a=[...n.data].map((i,o)=>s.type._parseSync(new Oe(n,i,n.path,o)));return Y.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new ve(E(d({},this._def),{minLength:{value:e,message:w.toString(n)}}))}max(e,n){return new ve(E(d({},this._def),{maxLength:{value:e,message:w.toString(n)}}))}length(e,n){return new ve(E(d({},this._def),{exactLength:{value:e,message:w.toString(n)}}))}nonempty(e){return this.min(1,e)}}ve.create=(t,e)=>new ve(d({type:t,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray},T(e)));function ut(t){if(t instanceof U){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Ee.create(ut(r))}return new U(E(d({},t._def),{shape:()=>e}))}else return t instanceof ve?new ve(E(d({},t._def),{type:ut(t.element)})):t instanceof Ee?Ee.create(ut(t.unwrap())):t instanceof Ve?Ve.create(ut(t.unwrap())):t instanceof Te?Te.create(t.items.map(e=>ut(e))):t}class U extends A{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=N.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==_.object){const u=this._getOrReturnCtx(e);return y(u,{code:f.invalid_type,expected:_.object,received:u.parsedType}),x}const{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ze&&this._def.unknownKeys==="strip"))for(const u in r.data)a.includes(u)||i.push(u);const o=[];for(const u of a){const c=s[u],h=r.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new Oe(r,h,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof Ze){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of i)o.push({key:{status:"valid",value:c},value:{status:"valid",value:r.data[c]}});else if(u==="strict")i.length>0&&(y(r,{code:f.unrecognized_keys,keys:i}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of i){const h=r.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new Oe(r,h,r.path,c)),alwaysSet:c in r.data})}}return r.common.async?Promise.resolve().then(()=>xe(this,null,function*(){const u=[];for(const c of o){const h=yield c.key,p=yield c.value;u.push({key:h,value:p,alwaysSet:c.alwaysSet})}return u})).then(u=>Y.mergeObjectSync(n,u)):Y.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new U(d(E(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(n,r)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=w.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}))}strip(){return new U(E(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new U(E(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new U(E(d({},this._def),{shape:()=>d(d({},this._def.shape()),e)}))}merge(e){return new U({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>d(d({},this._def.shape()),e._def.shape()),typeName:S.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new U(E(d({},this._def),{catchall:e}))}pick(e){const n={};return N.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new U(E(d({},this._def),{shape:()=>n}))}omit(e){const n={};return N.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new U(E(d({},this._def),{shape:()=>n}))}deepPartial(){return ut(this)}partial(e){const n={};return N.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}),new U(E(d({},this._def),{shape:()=>n}))}required(e){const n={};return N.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ee;)s=s._def.innerType;n[r]=s}}),new U(E(d({},this._def),{shape:()=>n}))}keyof(){return Ps(N.objectKeys(this.shape))}}U.create=(t,e)=>new U(d({shape:()=>t,unknownKeys:"strip",catchall:Ze.create(),typeName:S.ZodObject},T(e)));U.strictCreate=(t,e)=>new U(d({shape:()=>t,unknownKeys:"strict",catchall:Ze.create(),typeName:S.ZodObject},T(e)));U.lazycreate=(t,e)=>new U(d({shape:t,unknownKeys:"strip",catchall:Ze.create(),typeName:S.ZodObject},T(e)));class Dt extends A{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(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 ue(o.ctx.common.issues));return y(n,{code:f.invalid_union,unionErrors:i}),x}if(n.common.async)return Promise.all(r.map(a=>xe(this,null,function*(){const i=E(d({},n),{common:E(d({},n.common),{issues:[]}),parent:null});return{result:yield a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}}))).then(s);{let a;const i=[];for(const u of r){const c=E(d({},n),{common:E(d({},n.common),{issues:[]}),parent:null}),h=u._parseSync({data:n.data,path:n.path,parent:c});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new ue(u));return y(n,{code:f.invalid_union,unionErrors:o}),x}}get options(){return this._def.options}}Dt.create=(t,e)=>new Dt(d({options:t,typeName:S.ZodUnion},T(e)));const Le=t=>t instanceof $t?Le(t.schema):t instanceof _e?Le(t.innerType()):t instanceof Ft?[t.value]:t instanceof Ue?t.options:t instanceof Wt?N.objectValues(t.enum):t instanceof zt?Le(t._def.innerType):t instanceof Pt?[void 0]:t instanceof Zt?[null]:t instanceof Ee?[void 0,...Le(t.unwrap())]:t instanceof Ve?[null,...Le(t.unwrap())]:t instanceof Ar||t instanceof Vt?Le(t.unwrap()):t instanceof Ut?Le(t._def.innerType):[];class wn extends A{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return y(n,{code:f.invalid_type,expected:_.object,received:n.parsedType}),x;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);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:[r]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const a of n){const i=Le(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(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new wn(d({typeName:S.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s},T(r)))}}function nr(t,e){const n=Ie(t),r=Ie(e);if(t===e)return{valid:!0,data:t};if(n===_.object&&r===_.object){const s=N.objectKeys(e),a=N.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i=d(d({},t),e);for(const o of a){const u=nr(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(n===_.array&&r===_.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],u=nr(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return n===_.date&&r===_.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Mt extends A{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,i)=>{if(er(a)||er(i))return x;const o=nr(a.value,i.value);return o.valid?((tr(a)||tr(i))&&n.dirty(),{status:n.value,value:o.data}):(y(r,{code:f.invalid_intersection_types}),x)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Mt.create=(t,e,n)=>new Mt(d({left:t,right:e,typeName:S.ZodIntersection},T(n)));class Te extends A{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.array)return y(r,{code:f.invalid_type,expected:_.array,received:r.parsedType}),x;if(r.data.length<this._def.items.length)return y(r,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&r.data.length>this._def.items.length&&(y(r,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new Oe(r,a,r.path,i)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>Y.mergeArray(n,a)):Y.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Te(E(d({},this._def),{rest:e}))}}Te.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Te(d({items:t,typeName:S.ZodTuple,rest:null},T(e)))};class Lt extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.object)return y(r,{code:f.invalid_type,expected:_.object,received:r.parsedType}),x;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)s.push({key:a._parse(new Oe(r,o,r.path,o)),value:i._parse(new Oe(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?Y.mergeObjectAsync(n,s):Y.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof A?new Lt(d({keyType:e,valueType:n,typeName:S.ZodRecord},T(r))):new Lt(d({keyType:ge.create(),valueType:e,typeName:S.ZodRecord},T(n)))}}class mn extends A{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.map)return y(r,{code:f.invalid_type,expected:_.map,received:r.parsedType}),x;const s=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,u],c)=>({key:s._parse(new Oe(r,o,r.path,[c,"key"])),value:a._parse(new Oe(r,u,r.path,[c,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(()=>xe(this,null,function*(){for(const u of i){const c=yield u.key,h=yield u.value;if(c.status==="aborted"||h.status==="aborted")return x;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}))}else{const o=new Map;for(const u of i){const c=u.key,h=u.value;if(c.status==="aborted"||h.status==="aborted")return x;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}}}mn.create=(t,e,n)=>new mn(d({valueType:e,keyType:t,typeName:S.ZodMap},T(n)));class tt extends A{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.set)return y(r,{code:f.invalid_type,expected:_.set,received:r.parsedType}),x;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(y(r,{code:f.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(y(r,{code:f.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function i(u){const c=new Set;for(const h of u){if(h.status==="aborted")return x;h.status==="dirty"&&n.dirty(),c.add(h.value)}return{status:n.value,value:c}}const o=[...r.data.values()].map((u,c)=>a._parse(new Oe(r,u,r.path,c)));return r.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,n){return new tt(E(d({},this._def),{minSize:{value:e,message:w.toString(n)}}))}max(e,n){return new tt(E(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)}}tt.create=(t,e)=>new tt(d({valueType:t,minSize:null,maxSize:null,typeName:S.ZodSet},T(e)));class ht extends A{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.function)return y(n,{code:f.invalid_type,expected:_.function,received:n.parsedType}),x;function r(o,u){return dn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cn(),yt].filter(c=>!!c),issueData:{code:f.invalid_arguments,argumentsError:u}})}function s(o,u){return dn({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,cn(),yt].filter(c=>!!c),issueData:{code:f.invalid_return_type,returnTypeError:u}})}const a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof vt){const o=this;return ne(function(...u){return xe(this,null,function*(){const c=new ue([]),h=yield o._def.args.parseAsync(u,a).catch(k=>{throw c.addIssue(r(u,k)),c}),p=yield Reflect.apply(i,this,h);return yield o._def.returns._def.type.parseAsync(p,a).catch(k=>{throw c.addIssue(s(p,k)),c})})})}else{const o=this;return ne(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new ue([r(u,c.error)]);const h=Reflect.apply(i,this,c.data),p=o._def.returns.safeParse(h,a);if(!p.success)throw new ue([s(h,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ht(E(d({},this._def),{args:Te.create(e).rest(Ye.create())}))}returns(e){return new ht(E(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new ht(d({args:e||Te.create([]).rest(Ye.create()),returns:n||Ye.create(),typeName:S.ZodFunction},T(r)))}}class $t extends A{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:S.ZodLazy},T(e)));class Ft extends A{_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}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ft.create=(t,e)=>new Ft(d({value:t,typeName:S.ZodLiteral},T(e)));function Ps(t,e){return new Ue(d({values:t,typeName:S.ZodEnum},T(e)))}class Ue extends A{constructor(){super(...arguments),Ot.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{expected:N.joinValues(r),received:n.parsedType,code:f.invalid_type}),x}if(fn(this,Ot)||Ns(this,Ot,new Set(this._def.values)),!fn(this,Ot).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{received:n.data,code:f.invalid_enum_value,options:r}),x}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 Ue.create(e,d(d({},this._def),n))}exclude(e,n=this._def){return Ue.create(this.options.filter(r=>!e.includes(r)),d(d({},this._def),n))}}Ot=new WeakMap;Ue.create=Ps;class Wt extends A{constructor(){super(...arguments),Tt.set(this,void 0)}_parse(e){const n=N.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==_.string&&r.parsedType!==_.number){const s=N.objectValues(n);return y(r,{expected:N.joinValues(s),received:r.parsedType,code:f.invalid_type}),x}if(fn(this,Tt)||Ns(this,Tt,new Set(N.getValidEnumValues(this._def.values))),!fn(this,Tt).has(e.data)){const s=N.objectValues(n);return y(r,{received:r.data,code:f.invalid_enum_value,options:s}),x}return ne(e.data)}get enum(){return this._def.values}}Tt=new WeakMap;Wt.create=(t,e)=>new Wt(d({values:t,typeName:S.ZodNativeEnum},T(e)));class vt extends A{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.promise&&n.common.async===!1)return y(n,{code:f.invalid_type,expected:_.promise,received:n.parsedType}),x;const r=n.parsedType===_.promise?n.data:Promise.resolve(n.data);return ne(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}vt.create=(t,e)=>new vt(d({type:t,typeName:S.ZodPromise},T(e)));class _e extends A{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{y(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(o=>xe(this,null,function*(){if(n.value==="aborted")return x;const u=yield this._def.schema._parseAsync({data:o,path:r.path,parent:r});return u.status==="aborted"?x:u.status==="dirty"||n.value==="dirty"?ln(u.value):u}));{if(n.value==="aborted")return x;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?x:o.status==="dirty"||n.value==="dirty"?ln(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?x:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?x:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Qe(i))return i;const o=s.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:r.data,path:r.path,parent:r}).then(i=>Qe(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:n.value,value:o})):i);N.assertNever(s)}}_e.create=(t,e,n)=>new _e(d({schema:t,typeName:S.ZodEffects,effect:e},T(n)));_e.createWithPreprocess=(t,e,n)=>new _e(d({schema:e,effect:{type:"preprocess",transform:t},typeName:S.ZodEffects},T(n)));class Ee extends A{_parse(e){return this._getType(e)===_.undefined?ne(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ee.create=(t,e)=>new Ee(d({innerType:t,typeName:S.ZodOptional},T(e)));class Ve extends A{_parse(e){return this._getType(e)===_.null?ne(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ve.create=(t,e)=>new Ve(d({innerType:t,typeName:S.ZodNullable},T(e)));class zt extends A{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===_.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}zt.create=(t,e)=>new zt(d({innerType:t,typeName:S.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},T(e)));class Ut extends A{_parse(e){const{ctx:n}=this._processInputParams(e),r=E(d({},n),{common:E(d({},n.common),{issues:[]})}),s=this._def.innerType._parse({data:r.data,path:r.path,parent:d({},r)});return jt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ue(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ue(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Ut.create=(t,e)=>new Ut(d({innerType:t,typeName:S.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},T(e)));class yn extends A{_parse(e){if(this._getType(e)!==_.nan){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.nan,received:n.parsedType}),x}return{status:"valid",value:e.data}}}yn.create=t=>new yn(d({typeName:S.ZodNaN},T(t)));const qi=Symbol("zod_brand");class Ar extends A{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Gt extends A{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return xe(this,null,function*(){const s=yield this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?x:s.status==="dirty"?(n.dirty(),ln(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})});{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?x:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Gt({in:e,out:n,typeName:S.ZodPipeline})}}class Vt extends A{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Qe(s)&&(s.value=Object.freeze(s.value)),s);return jt(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Vt.create=(t,e)=>new Vt(d({innerType:t,typeName:S.ZodReadonly},T(e)));function rs(t,e){const n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Zs(t,e={},n){return t?gt.create().superRefine((r,s)=>{var a,i;const o=t(r);if(o instanceof Promise)return o.then(u=>{var c,h;if(!u){const p=rs(e,r),k=(h=(c=p.fatal)!==null&&c!==void 0?c:n)!==null&&h!==void 0?h:!0;s.addIssue(E(d({code:"custom"},p),{fatal:k}))}});if(!o){const u=rs(e,r),c=(i=(a=u.fatal)!==null&&a!==void 0?a:n)!==null&&i!==void 0?i:!0;s.addIssue(E(d({code:"custom"},u),{fatal:c}))}}):gt.create()}const Bi={object:U.lazycreate};var S;(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"})(S||(S={}));const Hi=(t,e={message:`Input not instance of ${t.name}`})=>Zs(n=>n instanceof t,e),Ds=ge.create,Ms=We.create,Gi=yn.create,Ji=ze.create,Ls=It.create,Xi=et.create,Yi=hn.create,Qi=Pt.create,eo=Zt.create,to=gt.create,no=Ye.create,ro=Ze.create,so=pn.create,ao=ve.create,io=U.create,oo=U.strictCreate,uo=Dt.create,co=wn.create,lo=Mt.create,fo=Te.create,ho=Lt.create,po=mn.create,mo=tt.create,yo=ht.create,go=$t.create,vo=Ft.create,_o=Ue.create,bo=Wt.create,wo=vt.create,ss=_e.create,ko=Ee.create,So=Ve.create,Eo=_e.createWithPreprocess,xo=Gt.create,Oo=()=>Ds().optional(),To=()=>Ms().optional(),Ao=()=>Ls().optional(),Co={string:t=>ge.create(E(d({},t),{coerce:!0})),number:t=>We.create(E(d({},t),{coerce:!0})),boolean:t=>It.create(E(d({},t),{coerce:!0})),bigint:t=>ze.create(E(d({},t),{coerce:!0})),date:t=>et.create(E(d({},t),{coerce:!0}))},No=x;var j=Object.freeze({__proto__:null,defaultErrorMap:yt,setErrorMap:Si,getErrorMap:cn,makeIssue:dn,EMPTY_PATH:Ei,addIssueToContext:y,ParseStatus:Y,INVALID:x,DIRTY:ln,OK:ne,isAborted:er,isDirty:tr,isValid:Qe,isAsync:jt,get util(){return N},get objectUtil(){return Qn},ZodParsedType:_,getParsedType:Ie,ZodType:A,datetimeRegex:Is,ZodString:ge,ZodNumber:We,ZodBigInt:ze,ZodBoolean:It,ZodDate:et,ZodSymbol:hn,ZodUndefined:Pt,ZodNull:Zt,ZodAny:gt,ZodUnknown:Ye,ZodNever:Ze,ZodVoid:pn,ZodArray:ve,ZodObject:U,ZodUnion:Dt,ZodDiscriminatedUnion:wn,ZodIntersection:Mt,ZodTuple:Te,ZodRecord:Lt,ZodMap:mn,ZodSet:tt,ZodFunction:ht,ZodLazy:$t,ZodLiteral:Ft,ZodEnum:Ue,ZodNativeEnum:Wt,ZodPromise:vt,ZodEffects:_e,ZodTransformer:_e,ZodOptional:Ee,ZodNullable:Ve,ZodDefault:zt,ZodCatch:Ut,ZodNaN:yn,BRAND:qi,ZodBranded:Ar,ZodPipeline:Gt,ZodReadonly:Vt,custom:Zs,Schema:A,ZodSchema:A,late:Bi,get ZodFirstPartyTypeKind(){return S},coerce:Co,any:to,array:ao,bigint:Ji,boolean:Ls,date:Xi,discriminatedUnion:co,effect:ss,enum:_o,function:yo,instanceof:Hi,intersection:lo,lazy:go,literal:vo,map:po,nan:Gi,nativeEnum:bo,never:ro,null:eo,nullable:So,number:Ms,object:io,oboolean:Ao,onumber:To,optional:ko,ostring:Oo,pipeline:xo,preprocess:Eo,promise:wo,record:ho,set:mo,strictObject:oo,string:Ds,symbol:Yi,transformer:ss,tuple:fo,undefined:Qi,union:uo,unknown:no,void:so,NEVER:No,ZodIssueCode:f,quotelessJson:ki,ZodError:ue});j.object({language:j.enum(["typescript","javascript"]).optional(),disableMarkedForExport:j.boolean().optional(),allowAutoSelectFirstNode:j.boolean().optional().default(!0),enableDisplayDataId:j.boolean().optional(),enableDisplayDataName:j.boolean().optional()}).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 as 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 Ro(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:r=In,onComment:s}=t;let a="",i=!0,o,u="",c="";function h(m){const g=i?m.replace(/^\xEF\xBB\xBF/,""):m,[l,O]=jo(`${a}${g}`);for(const I of l)p(I);a=O,i=!1}function p(m){if(m===""){v();return}if(m.startsWith(":")){s&&s(m.slice(m.startsWith(": ")?2:1));return}const g=m.indexOf(":");if(g!==-1){const l=m.slice(0,g),O=m[g+1]===" "?2:1,I=m.slice(g+O);k(l,I,m);return}k(m,"",m)}function k(m,g,l){switch(m){case"event":c=g;break;case"data":u=`${u}${g}
|
|
2
2
|
`;break;case"id":o=g.includes("\0")?void 0:g;break;case"retry":/^\d+$/.test(g)?r(parseInt(g,10)):n(new as(`Invalid \`retry\` value: "${g}"`,{type:"invalid-retry",value:g,line:l}));break;default:n(new as(`Unknown field "${m.length>20?`${m.slice(0,20)}…`:m}"`,{type:"unknown-field",field:m,value:g,line:l}));break}}function v(){u.length>0&&e({id:o,event:c||void 0,data:u.endsWith(`
|
|
3
3
|
`)?u.slice(0,-1):u}),o=void 0,u="",c=""}function b(m={}){a&&m.consume&&p(a),i=!0,o=void 0,u="",c="",a=""}return{feed:h,reset:b}}function jo(t){const e=[];let n="",r=0;for(;r<t.length;){const s=t.indexOf("\r",r),a=t.indexOf(`
|
|
4
4
|
`,r);let i=-1;if(s!==-1&&a!==-1?i=Math.min(s,a):s!==-1?i=s:a!==-1&&(i=a),i===-1){n=t.slice(r);break}else{const o=t.slice(r,i);e.push(o),r=i+1,t[r-1]==="\r"&&t[r]===`
|
|
5
|
-
`&&r++}}return[e,n]}class is extends Event{constructor(e,n){var r,s;super(e),this.code=(r=n==null?void 0:n.code)!=null?r:void 0,this.message=(s=n==null?void 0:n.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,n,r){return r(os(this),n)}[Symbol.for("Deno.customInspect")](e,n){return e(os(this),n)}}function Io(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function rr(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(rr).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${rr(t.cause)}`:t.message:`${t}`}function os(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var $s=t=>{throw TypeError(t)},Cr=(t,e,n)=>e.has(t)||$s("Cannot "+n),C=(t,e,n)=>(Cr(t,e,"read from private field"),n?n.call(t):e.get(t)),H=(t,e,n)=>e.has(t)?$s("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),W=(t,e,n,r)=>(Cr(t,e,"write to private field"),e.set(t,n),n),Ne=(t,e,n)=>(Cr(t,e,"access private method"),n),ae,Je,ct,on,gn,Nt,ft,Rt,Me,dt,pt,lt,At,me,sr,ar,ir,us,or,ur,Ct,cr,dr;class un extends EventTarget{constructor(e,n){var r,s;super(),H(this,me),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,H(this,ae),H(this,Je),H(this,ct),H(this,on),H(this,gn),H(this,Nt),H(this,ft),H(this,Rt,null),H(this,Me),H(this,dt),H(this,pt,null),H(this,lt,null),H(this,At,null),H(this,ar,a=>Pe(this,null,function*(){var i;C(this,dt).reset();const{body:o,redirected:u,status:c,headers:h}=a;if(c===204){Ne(this,me,Ct).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?W(this,ct,new URL(a.url)):W(this,ct,void 0),c!==200){Ne(this,me,Ct).call(this,`Non-200 status code (${c})`,c);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){Ne(this,me,Ct).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(C(this,ae)===this.CLOSED)return;W(this,ae,this.OPEN);const p=new Event("open");if((i=C(this,At))==null||i.call(this,p),this.dispatchEvent(p),typeof o!="object"||!o||!("getReader"in o)){Ne(this,me,Ct).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const k=new TextDecoder,v=o.getReader();let b=!0;do{const{done:m,value:g}=yield v.read();g&&C(this,dt).feed(k.decode(g,{stream:!m})),m&&(b=!1,C(this,dt).reset(),Ne(this,me,cr).call(this))}while(b)})),H(this,ir,a=>{W(this,Me,void 0),!(a.name==="AbortError"||a.type==="aborted")&&Ne(this,me,cr).call(this,rr(a))}),H(this,or,a=>{typeof a.id=="string"&&W(this,Rt,a.id);const i=new MessageEvent(a.event||"message",{data:a.data,origin:C(this,ct)?C(this,ct).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,ur,a=>{W(this,Nt,a)}),H(this,dr,()=>{W(this,ft,void 0),C(this,ae)===this.CONNECTING&&Ne(this,me,sr).call(this)});try{if(e instanceof URL)W(this,Je,e);else if(typeof e=="string")W(this,Je,new URL(e,Po()));else throw new Error("Invalid URL")}catch(a){throw Io("An invalid or illegal string was specified")}W(this,dt,Ro({onEvent:C(this,or),onRetry:C(this,ur)})),W(this,ae,this.CONNECTING),W(this,Nt,3e3),W(this,gn,(r=n==null?void 0:n.fetch)!=null?r:globalThis.fetch),W(this,on,(s=n==null?void 0:n.withCredentials)!=null?s:!1),Ne(this,me,sr).call(this)}get readyState(){return C(this,ae)}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,At)}set onopen(e){W(this,At,e)}addEventListener(e,n,r){const s=n;super.addEventListener(e,s,r)}removeEventListener(e,n,r){const s=n;super.removeEventListener(e,s,r)}close(){C(this,ft)&&clearTimeout(C(this,ft)),C(this,ae)!==this.CLOSED&&(C(this,Me)&&C(this,Me).abort(),W(this,ae,this.CLOSED),W(this,Me,void 0))}}ae=new WeakMap,Je=new WeakMap,ct=new WeakMap,on=new WeakMap,gn=new WeakMap,Nt=new WeakMap,ft=new WeakMap,Rt=new WeakMap,Me=new WeakMap,dt=new WeakMap,pt=new WeakMap,lt=new WeakMap,At=new WeakMap,me=new WeakSet,sr=function(){W(this,ae,this.CONNECTING),W(this,Me,new AbortController),C(this,gn)(C(this,Je),Ne(this,me,us).call(this)).then(C(this,ar)).catch(C(this,ir))},ar=new WeakMap,ir=new WeakMap,us=function(){var t;const e={mode:"cors",redirect:"follow",headers:qe({Accept:"text/event-stream"},C(this,Rt)?{"Last-Event-ID":C(this,Rt)}: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},or=new WeakMap,ur=new WeakMap,Ct=function(t,e){var n;C(this,ae)!==this.CLOSED&&W(this,ae,this.CLOSED);const r=new is("error",{code:e,message:t});(n=C(this,pt))==null||n.call(this,r),this.dispatchEvent(r)},cr=function(t,e){var n;if(C(this,ae)===this.CLOSED)return;W(this,ae,this.CONNECTING);const r=new is("error",{code:e,message:t});(n=C(this,pt))==null||n.call(this,r),this.dispatchEvent(r),W(this,ft,setTimeout(C(this,dr),C(this,Nt)))},dr=new WeakMap,un.CONNECTING=0,un.OPEN=1,un.CLOSED=2;function Po(){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 Fs=Symbol.for("immer-nothing"),cs=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 ie(t,...e){if(process.env.NODE_ENV!=="production"){const n=Zo[t],r=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${r}`)}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?Ws(t)||Array.isArray(t)||!!t[cs]||!!((e=t.constructor)!=null&&e[cs])||Sn(t)||En(t):!1}var Do=Object.prototype.constructor.toString();function Ws(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,r)=>e(r,n,t))}function kn(t){const e=t[ce];return e?e.type_:Array.isArray(t)?1:Sn(t)?2:En(t)?3:0}function lr(t,e){return kn(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function zs(t,e,n){const r=kn(t);r===2?t.set(e,n):r===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 Sn(t){return t instanceof Map}function En(t){return t instanceof Set}function Be(t){return t.copy_||t.base_}function fr(t,e){if(Sn(t))return new Map(t);if(En(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Ws(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[ce];let s=Reflect.ownKeys(r);for(let a=0;a<s.length;a++){const i=s[a],o=r[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[i]})}return Object.create(_t(t),r)}else{const r=_t(t);if(r!==null&&n)return qe({},t);const s=Object.create(r);return Object.assign(s,t)}}function Kt(t,e=!1){return xn(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,r])=>Kt(r,!0))),t}function Lo(){ie(2)}function xn(t){return Object.isFrozen(t)}var $o={};function nt(t){const e=$o[t];return e||ie(0,t),e}var qt;function Us(){return qt}function Fo(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ds(t,e){e&&(nt("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function hr(t){pr(t),t.drafts_.forEach(Wo),t.drafts_=null}function pr(t){t===qt&&(qt=t.parent_)}function ls(t){return qt=Fo(qt,t)}function Wo(t){const e=t[ce];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function fs(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[ce].modified_&&(hr(e),ie(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,[]),hr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Fs?t:void 0}function _n(t,e,n){if(xn(e))return e;const r=e[ce];if(!r)return vn(e,(s,a)=>hs(t,r,e,s,a,n)),e;if(r.scope_!==t)return e;if(!r.modified_)return bn(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const s=r.copy_;let a=s,i=!1;r.type_===3&&(a=new Set(s),s.clear(),i=!0),vn(a,(o,u)=>hs(t,r,s,o,u,n,i)),bn(t,s,!1),n&&t.patches_&&nt("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function hs(t,e,n,r,s,a,i){if(process.env.NODE_ENV!=="production"&&s===n&&ie(5),bt(s)){const o=a&&e&&e.type_!==3&&!lr(e.assigned_,r)?a.concat(r):void 0,u=_n(t,s,o);if(zs(n,r,u),bt(u))t.canAutoFreeze_=!1;else return}else i&&n.add(s);if(tt(s)&&!xn(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;_n(t,s),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&bn(t,s)}}function bn(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Kt(e,n)}function zo(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:Us(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=r,a=Nr;n&&(s=[r],a=Bt);const{revoke:i,proxy:o}=Proxy.revocable(s,a);return r.draft_=o,r.revoke_=i,o}var Nr={get(t,e){if(e===ce)return t;const n=Be(t);if(!lr(n,e))return Uo(t,n,e);const r=n[e];return t.finalized_||!tt(r)?r:r===Pn(t.base_,e)?(Zn(t),t.copy_[e]=yr(r,t)):r},has(t,e){return e in Be(t)},ownKeys(t){return Reflect.ownKeys(Be(t))},set(t,e,n){const r=Vs(Be(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const s=Pn(Be(t),e),a=s==null?void 0:s[ce];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Mo(n,s)&&(n!==void 0||lr(t.base_,e)))return!0;Zn(t),mr(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 Pn(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Zn(t),mr(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Be(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){ie(11)},getPrototypeOf(t){return _t(t.base_)},setPrototypeOf(){ie(12)}},Bt={};vn(Nr,(t,e)=>{Bt[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});Bt.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&ie(13),Bt.set.call(this,t,e,void 0)};Bt.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&ie(14),Nr.set.call(this,t[0],e,n,t[0])};function Pn(t,e){const n=t[ce];return(n?Be(n):t)[e]}function Uo(t,e,n){var s;const r=Vs(e,n);return r?"value"in r?r.value:(s=r.get)==null?void 0:s.call(t.draft_):void 0}function Vs(t,e){if(!(e in t))return;let n=_t(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=_t(n)}}function mr(t){t.modified_||(t.modified_=!0,t.parent_&&mr(t.parent_))}function Zn(t){t.copy_||(t.copy_=fr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Vo=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const a=n;n=e;const i=this;return function(u=a,...c){return i.produce(u,h=>n.call(this,h,...c))}}typeof n!="function"&&ie(6),r!==void 0&&typeof r!="function"&&ie(7);let s;if(tt(e)){const a=ls(this),i=yr(e,void 0);let o=!0;try{s=n(i),o=!1}finally{o?hr(a):pr(a)}return ds(a,r),fs(s,a)}else if(!e||typeof e!="object"){if(s=n(e),s===void 0&&(s=e),s===Fs&&(s=void 0),this.autoFreeze_&&Kt(s,!0),r){const a=[],i=[];nt("Patches").generateReplacementPatches_(e,s,a,i),r(a,i)}return s}else ie(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(i,...o)=>this.produceWithPatches(i,u=>e(u,...o));let r,s;return[this.produce(e,n,(i,o)=>{r=i,s=o}),r,s]},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)||ie(8),bt(t)&&(t=Ko(t));const e=ls(this),n=yr(t,void 0);return n[ce].isManual_=!0,pr(e),n}finishDraft(t,e){const n=t&&t[ce];(!n||!n.isManual_)&&ie(9);const{scope_:r}=n;return ds(r,e),fs(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const s=e[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(e=e.slice(n+1));const r=nt("Patches").applyPatches_;return bt(t)?r(t,e):this.produce(t,s=>r(s,e))}};function yr(t,e){const n=Sn(t)?nt("MapSet").proxyMap_(t,e):En(t)?nt("MapSet").proxySet_(t,e):zo(t,e);return(e?e.scope_:Us()).drafts_.push(n),n}function Ko(t){return bt(t)||ie(10,t),Ks(t)}function Ks(t){if(!tt(t)||xn(t))return t;const e=t[ce];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=fr(t,e.scope_.immer_.useStrictShallowCopy_)}else n=fr(t,!0);return vn(n,(r,s)=>{zs(n,r,Ks(s))}),e&&(e.finalized_=!1),n}var de=new Vo,qo=de.produce;de.produceWithPatches.bind(de);de.setAutoFreeze.bind(de);de.setUseStrictShallowCopy.bind(de);de.applyPatches.bind(de);de.createDraft.bind(de);de.finishDraft.bind(de);function Bo(t){var e=z.useState(function(){return Kt(typeof t=="function"?t():t,!0)}),n=e[1];return[e[0],z.useCallback(function(r){n(typeof r=="function"?qo(r):Kt(r))},[])]}const ps=10,ms={status:"idle",error:null,result:null,progressMessages:[],tasks:{fetchDesign:{status:"pending"},codeGeneration:{status:"pending",progress:0},uploadAssets:{status:"pending"}},jobSessionId:null,jobStatus:{}},ys=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,r]=Bo(ms);return{getCode:a=>Pe(exports,null,function*(){var h,p,k;r(v=>{v.status="pending",v.error=null,v.result=null,v.tasks=ms.tasks});const i=structuredClone(a);if(((h=a.assetsStorage)==null?void 0:h.strategy)==="local"){const{referencePath:v}=ys(a.assetsStorage);a.assetsStorage={strategy:"external",url:v}}let o;const u=new un(t,{fetch:(v,b)=>(o=fetch(v,Vr(qe({},b),{method:e,body:JSON.stringify(a)})),o)}),c=new Promise(v=>{const b={};u.addEventListener("start",g=>{const l=JSON.parse(g.data);b.sessionId=l.sessionId,r(O=>{O.tasks.fetchDesign.status="running",O.jobSessionId=l.sessionId})}),u.addEventListener("queueing",g=>{const l=JSON.parse(g.data);r(O=>{O.jobSessionId=l.payload.sessionId})}),u.addEventListener("pre_codegen",g=>{JSON.parse(g.data).message==="Anima model built"&&r(O=>{O.tasks.fetchDesign.status="finished",O.tasks.codeGeneration.status="running",O.tasks.uploadAssets.status="running"})}),u.addEventListener("figma_metadata",g=>{const l=JSON.parse(g.data);b.figmaFileName=l.figmaFileName,b.figmaSelectedFrameName=l.figmaSelectedFrameName}),u.addEventListener("aborted",()=>{const g=new Br({name:"Aborted",reason:"Unknown"});r(l=>{l.status="aborted",l.result=null,l.error=g}),v({result:null,error:g})}),u.addEventListener("generating_code",g=>{const l=JSON.parse(g.data);l.payload.status==="success"&&(b.files=l.payload.files),r(O=>{O.tasks.codeGeneration.progress=l.payload.progress,O.tasks.codeGeneration.status="running"})}),u.addEventListener("progress_messages_updated",g=>{const l=JSON.parse(g.data);r(O=>{O.progressMessages=l.payload.progressMessages})}),u.addEventListener("job_status_updated",g=>{const l=JSON.parse(g.data);r(O=>{O.jobStatus=l.payload.jobStatus})}),u.addEventListener("codegen_completed",()=>{r(g=>{g.tasks.codeGeneration.status="finished"})}),u.addEventListener("generation_completed",()=>{r(g=>{g.tasks.codeGeneration.status="finished"})}),u.addEventListener("assets_uploaded",()=>{r(g=>{g.tasks.uploadAssets.status="finished"})}),u.addEventListener("assets_list",g=>{const l=JSON.parse(g.data);b.assets=l.payload.assets});let m=0;u.addEventListener("error",g=>Pe(exports,null,function*(){var V,D,M;console.warn(`Experienced error during code generation (attempt ${m+1} / ${ps})`,g);let l,O,I=!1;try{if(g instanceof MessageEvent)l=JSON.parse(g.data);else{const J=yield o;O=J.status;try{l=yield J.json()}catch($){}}(((V=l==null?void 0:l.payload)==null?void 0:V.name)==="Task Crashed"||O===429)&&(I=!0)}catch(J){}const q=new Br({name:(D=l==null?void 0:l.payload.name)!=null?D:"Unknown error",reason:(M=l==null?void 0:l.payload.message)!=null?M:"Unknown",status:l==null?void 0:l.payload.status,detail:l==null?void 0:l.payload.detail});m++;let Z=!1;m>ps?(console.error("Experienced too many errors, terminating request"),Z=!0):I&&(console.error("Experienced unrecoverable error, terminating request"),Z=!0),Z&&(r(J=>{J.status="error",J.error=q}),v({result:null,error:q}))})),u.addEventListener("done",g=>{const l=JSON.parse(g.data);b.tokenUsage=l.payload.tokenUsage,b.sessionId=l.payload.sessionId,r(O=>{O.status="success",O.result=b}),v({result:b,error:null})})});try{const{result:v,error:b}=yield c,m=structuredClone(v);if(((p=i.assetsStorage)==null?void 0:p.strategy)==="local"&&((k=m==null?void 0:m.assets)!=null&&k.length)){const{filePath:g}=ys(i.assetsStorage),l=m.assets.map(I=>Pe(exports,null,function*(){const Z=yield(yield fetch(I.url)).arrayBuffer();return{assetName:I.name,base64:ca(Z)}})),O=yield Promise.allSettled(l);for(const I of O){const q={};if(I.status==="fulfilled"){const{assetName:Z,base64:V}=I.value;q[Z]=V;const D=g?`${g}/${Z}`:Z;m.files[D]={content:V,isBinary:!0}}}}return b?{result:null,error:b}:{result:m,error:b}}finally{u.close()}}),status:n.status,progressMessages:n.progressMessages,jobSessionId:n.jobSessionId,jobStatus:n.jobStatus,tasks:n.tasks,error:n.error,result:n.result}};var en={exports:{}},Dn={};/**
|
|
5
|
+
`&&r++}}return[e,n]}class is extends Event{constructor(e,n){var r,s;super(e),this.code=(r=n==null?void 0:n.code)!=null?r:void 0,this.message=(s=n==null?void 0:n.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,n,r){return r(os(this),n)}[Symbol.for("Deno.customInspect")](e,n){return e(os(this),n)}}function Io(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function rr(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(rr).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${rr(t.cause)}`:t.message:`${t}`}function os(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var $s=t=>{throw TypeError(t)},Cr=(t,e,n)=>e.has(t)||$s("Cannot "+n),C=(t,e,n)=>(Cr(t,e,"read from private field"),n?n.call(t):e.get(t)),H=(t,e,n)=>e.has(t)?$s("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),W=(t,e,n,r)=>(Cr(t,e,"write to private field"),e.set(t,n),n),je=(t,e,n)=>(Cr(t,e,"access private method"),n),ae,Xe,ct,on,gn,Nt,ft,Rt,$e,dt,pt,lt,At,ye,sr,ar,ir,us,or,ur,Ct,cr,dr;class un extends EventTarget{constructor(e,n){var r,s;super(),H(this,ye),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,H(this,ae),H(this,Xe),H(this,ct),H(this,on),H(this,gn),H(this,Nt),H(this,ft),H(this,Rt,null),H(this,$e),H(this,dt),H(this,pt,null),H(this,lt,null),H(this,At,null),H(this,ar,a=>De(this,null,function*(){var i;C(this,dt).reset();const{body:o,redirected:u,status:c,headers:h}=a;if(c===204){je(this,ye,Ct).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?W(this,ct,new URL(a.url)):W(this,ct,void 0),c!==200){je(this,ye,Ct).call(this,`Non-200 status code (${c})`,c);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){je(this,ye,Ct).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(C(this,ae)===this.CLOSED)return;W(this,ae,this.OPEN);const p=new Event("open");if((i=C(this,At))==null||i.call(this,p),this.dispatchEvent(p),typeof o!="object"||!o||!("getReader"in o)){je(this,ye,Ct).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const k=new TextDecoder,v=o.getReader();let b=!0;do{const{done:m,value:g}=yield v.read();g&&C(this,dt).feed(k.decode(g,{stream:!m})),m&&(b=!1,C(this,dt).reset(),je(this,ye,cr).call(this))}while(b)})),H(this,ir,a=>{W(this,$e,void 0),!(a.name==="AbortError"||a.type==="aborted")&&je(this,ye,cr).call(this,rr(a))}),H(this,or,a=>{typeof a.id=="string"&&W(this,Rt,a.id);const i=new MessageEvent(a.event||"message",{data:a.data,origin:C(this,ct)?C(this,ct).origin:C(this,Xe).origin,lastEventId:a.id||""});C(this,lt)&&(!a.event||a.event==="message")&&C(this,lt).call(this,i),this.dispatchEvent(i)}),H(this,ur,a=>{W(this,Nt,a)}),H(this,dr,()=>{W(this,ft,void 0),C(this,ae)===this.CONNECTING&&je(this,ye,sr).call(this)});try{if(e instanceof URL)W(this,Xe,e);else if(typeof e=="string")W(this,Xe,new URL(e,Po()));else throw new Error("Invalid URL")}catch(a){throw Io("An invalid or illegal string was specified")}W(this,dt,Ro({onEvent:C(this,or),onRetry:C(this,ur)})),W(this,ae,this.CONNECTING),W(this,Nt,3e3),W(this,gn,(r=n==null?void 0:n.fetch)!=null?r:globalThis.fetch),W(this,on,(s=n==null?void 0:n.withCredentials)!=null?s:!1),je(this,ye,sr).call(this)}get readyState(){return C(this,ae)}get url(){return C(this,Xe).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,At)}set onopen(e){W(this,At,e)}addEventListener(e,n,r){const s=n;super.addEventListener(e,s,r)}removeEventListener(e,n,r){const s=n;super.removeEventListener(e,s,r)}close(){C(this,ft)&&clearTimeout(C(this,ft)),C(this,ae)!==this.CLOSED&&(C(this,$e)&&C(this,$e).abort(),W(this,ae,this.CLOSED),W(this,$e,void 0))}}ae=new WeakMap,Xe=new WeakMap,ct=new WeakMap,on=new WeakMap,gn=new WeakMap,Nt=new WeakMap,ft=new WeakMap,Rt=new WeakMap,$e=new WeakMap,dt=new WeakMap,pt=new WeakMap,lt=new WeakMap,At=new WeakMap,ye=new WeakSet,sr=function(){W(this,ae,this.CONNECTING),W(this,$e,new AbortController),C(this,gn)(C(this,Xe),je(this,ye,us).call(this)).then(C(this,ar)).catch(C(this,ir))},ar=new WeakMap,ir=new WeakMap,us=function(){var t;const e={mode:"cors",redirect:"follow",headers:Be({Accept:"text/event-stream"},C(this,Rt)?{"Last-Event-ID":C(this,Rt)}:void 0),cache:"no-store",signal:(t=C(this,$e))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},or=new WeakMap,ur=new WeakMap,Ct=function(t,e){var n;C(this,ae)!==this.CLOSED&&W(this,ae,this.CLOSED);const r=new is("error",{code:e,message:t});(n=C(this,pt))==null||n.call(this,r),this.dispatchEvent(r)},cr=function(t,e){var n;if(C(this,ae)===this.CLOSED)return;W(this,ae,this.CONNECTING);const r=new is("error",{code:e,message:t});(n=C(this,pt))==null||n.call(this,r),this.dispatchEvent(r),W(this,ft,setTimeout(C(this,dr),C(this,Nt)))},dr=new WeakMap,un.CONNECTING=0,un.OPEN=1,un.CLOSED=2;function Po(){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 Fs=Symbol.for("immer-nothing"),cs=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 ie(t,...e){if(process.env.NODE_ENV!=="production"){const n=Zo[t],r=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${r}`)}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 nt(t){var e;return t?Ws(t)||Array.isArray(t)||!!t[cs]||!!((e=t.constructor)!=null&&e[cs])||Sn(t)||En(t):!1}var Do=Object.prototype.constructor.toString();function Ws(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,r)=>e(r,n,t))}function kn(t){const e=t[ce];return e?e.type_:Array.isArray(t)?1:Sn(t)?2:En(t)?3:0}function lr(t,e){return kn(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function zs(t,e,n){const r=kn(t);r===2?t.set(e,n):r===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 Sn(t){return t instanceof Map}function En(t){return t instanceof Set}function He(t){return t.copy_||t.base_}function fr(t,e){if(Sn(t))return new Map(t);if(En(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Ws(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[ce];let s=Reflect.ownKeys(r);for(let a=0;a<s.length;a++){const i=s[a],o=r[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[i]})}return Object.create(_t(t),r)}else{const r=_t(t);if(r!==null&&n)return Be({},t);const s=Object.create(r);return Object.assign(s,t)}}function Kt(t,e=!1){return xn(t)||bt(t)||!nt(t)||(kn(t)>1&&(t.set=t.add=t.clear=t.delete=Lo),Object.freeze(t),e&&Object.entries(t).forEach(([n,r])=>Kt(r,!0))),t}function Lo(){ie(2)}function xn(t){return Object.isFrozen(t)}var $o={};function rt(t){const e=$o[t];return e||ie(0,t),e}var qt;function Us(){return qt}function Fo(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function ds(t,e){e&&(rt("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function hr(t){pr(t),t.drafts_.forEach(Wo),t.drafts_=null}function pr(t){t===qt&&(qt=t.parent_)}function ls(t){return qt=Fo(qt,t)}function Wo(t){const e=t[ce];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function fs(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[ce].modified_&&(hr(e),ie(4)),nt(t)&&(t=_n(e,t),e.parent_||bn(e,t)),e.patches_&&rt("Patches").generateReplacementPatches_(n[ce].base_,t,e.patches_,e.inversePatches_)):t=_n(e,n,[]),hr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Fs?t:void 0}function _n(t,e,n){if(xn(e))return e;const r=e[ce];if(!r)return vn(e,(s,a)=>hs(t,r,e,s,a,n)),e;if(r.scope_!==t)return e;if(!r.modified_)return bn(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const s=r.copy_;let a=s,i=!1;r.type_===3&&(a=new Set(s),s.clear(),i=!0),vn(a,(o,u)=>hs(t,r,s,o,u,n,i)),bn(t,s,!1),n&&t.patches_&&rt("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function hs(t,e,n,r,s,a,i){if(process.env.NODE_ENV!=="production"&&s===n&&ie(5),bt(s)){const o=a&&e&&e.type_!==3&&!lr(e.assigned_,r)?a.concat(r):void 0,u=_n(t,s,o);if(zs(n,r,u),bt(u))t.canAutoFreeze_=!1;else return}else i&&n.add(s);if(nt(s)&&!xn(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;_n(t,s),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&bn(t,s)}}function bn(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Kt(e,n)}function zo(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:Us(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=r,a=Nr;n&&(s=[r],a=Bt);const{revoke:i,proxy:o}=Proxy.revocable(s,a);return r.draft_=o,r.revoke_=i,o}var Nr={get(t,e){if(e===ce)return t;const n=He(t);if(!lr(n,e))return Uo(t,n,e);const r=n[e];return t.finalized_||!nt(r)?r:r===Pn(t.base_,e)?(Zn(t),t.copy_[e]=yr(r,t)):r},has(t,e){return e in He(t)},ownKeys(t){return Reflect.ownKeys(He(t))},set(t,e,n){const r=Vs(He(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const s=Pn(He(t),e),a=s==null?void 0:s[ce];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Mo(n,s)&&(n!==void 0||lr(t.base_,e)))return!0;Zn(t),mr(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 Pn(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Zn(t),mr(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=He(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){ie(11)},getPrototypeOf(t){return _t(t.base_)},setPrototypeOf(){ie(12)}},Bt={};vn(Nr,(t,e)=>{Bt[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});Bt.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&ie(13),Bt.set.call(this,t,e,void 0)};Bt.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&ie(14),Nr.set.call(this,t[0],e,n,t[0])};function Pn(t,e){const n=t[ce];return(n?He(n):t)[e]}function Uo(t,e,n){var s;const r=Vs(e,n);return r?"value"in r?r.value:(s=r.get)==null?void 0:s.call(t.draft_):void 0}function Vs(t,e){if(!(e in t))return;let n=_t(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=_t(n)}}function mr(t){t.modified_||(t.modified_=!0,t.parent_&&mr(t.parent_))}function Zn(t){t.copy_||(t.copy_=fr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Vo=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const a=n;n=e;const i=this;return function(u=a,...c){return i.produce(u,h=>n.call(this,h,...c))}}typeof n!="function"&&ie(6),r!==void 0&&typeof r!="function"&&ie(7);let s;if(nt(e)){const a=ls(this),i=yr(e,void 0);let o=!0;try{s=n(i),o=!1}finally{o?hr(a):pr(a)}return ds(a,r),fs(s,a)}else if(!e||typeof e!="object"){if(s=n(e),s===void 0&&(s=e),s===Fs&&(s=void 0),this.autoFreeze_&&Kt(s,!0),r){const a=[],i=[];rt("Patches").generateReplacementPatches_(e,s,a,i),r(a,i)}return s}else ie(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(i,...o)=>this.produceWithPatches(i,u=>e(u,...o));let r,s;return[this.produce(e,n,(i,o)=>{r=i,s=o}),r,s]},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){nt(t)||ie(8),bt(t)&&(t=Ko(t));const e=ls(this),n=yr(t,void 0);return n[ce].isManual_=!0,pr(e),n}finishDraft(t,e){const n=t&&t[ce];(!n||!n.isManual_)&&ie(9);const{scope_:r}=n;return ds(r,e),fs(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const s=e[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(e=e.slice(n+1));const r=rt("Patches").applyPatches_;return bt(t)?r(t,e):this.produce(t,s=>r(s,e))}};function yr(t,e){const n=Sn(t)?rt("MapSet").proxyMap_(t,e):En(t)?rt("MapSet").proxySet_(t,e):zo(t,e);return(e?e.scope_:Us()).drafts_.push(n),n}function Ko(t){return bt(t)||ie(10,t),Ks(t)}function Ks(t){if(!nt(t)||xn(t))return t;const e=t[ce];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=fr(t,e.scope_.immer_.useStrictShallowCopy_)}else n=fr(t,!0);return vn(n,(r,s)=>{zs(n,r,Ks(s))}),e&&(e.finalized_=!1),n}var de=new Vo,qo=de.produce;de.produceWithPatches.bind(de);de.setAutoFreeze.bind(de);de.setUseStrictShallowCopy.bind(de);de.applyPatches.bind(de);de.createDraft.bind(de);de.finishDraft.bind(de);function Bo(t){var e=z.useState(function(){return Kt(typeof t=="function"?t():t,!0)}),n=e[1];return[e[0],z.useCallback(function(r){n(typeof r=="function"?qo(r):Kt(r))},[])]}const ps=10,ms={status:"idle",error:null,result:null,progressMessages:[],tasks:{fetchDesign:{status:"pending"},codeGeneration:{status:"pending",progress:0},uploadAssets:{status:"pending"}},jobSessionId:null,jobStatus:{}},ys=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,r]=Bo(ms);return{getCode:a=>De(exports,null,function*(){var h,p,k;r(v=>{v.status="pending",v.error=null,v.result=null,v.tasks=ms.tasks});const i=structuredClone(a);if(((h=a.assetsStorage)==null?void 0:h.strategy)==="local"){const{referencePath:v}=ys(a.assetsStorage);a.assetsStorage={strategy:"external",url:v}}let o;const u=new un(t,{fetch:(v,b)=>(o=fetch(v,Vr(Be({},b),{method:e,body:JSON.stringify(a)})),o)}),c=new Promise(v=>{const b={};u.addEventListener("start",g=>{const l=JSON.parse(g.data);b.sessionId=l.sessionId,r(O=>{O.tasks.fetchDesign.status="running",O.jobSessionId=l.sessionId})}),u.addEventListener("queueing",g=>{const l=JSON.parse(g.data);r(O=>{O.jobSessionId=l.payload.sessionId})}),u.addEventListener("pre_codegen",g=>{JSON.parse(g.data).message==="Anima model built"&&r(O=>{O.tasks.fetchDesign.status="finished",O.tasks.codeGeneration.status="running",O.tasks.uploadAssets.status="running"})}),u.addEventListener("figma_metadata",g=>{const l=JSON.parse(g.data);b.figmaFileName=l.figmaFileName,b.figmaSelectedFrameName=l.figmaSelectedFrameName}),u.addEventListener("aborted",()=>{const g=new Br({name:"Aborted",reason:"Unknown"});r(l=>{l.status="aborted",l.result=null,l.error=g}),v({result:null,error:g})}),u.addEventListener("generating_code",g=>{const l=JSON.parse(g.data);l.payload.status==="success"&&(b.files=l.payload.files),r(O=>{O.tasks.codeGeneration.progress=l.payload.progress,O.tasks.codeGeneration.status="running"})}),u.addEventListener("progress_messages_updated",g=>{const l=JSON.parse(g.data);r(O=>{O.progressMessages=l.payload.progressMessages})}),u.addEventListener("job_status_updated",g=>{const l=JSON.parse(g.data);r(O=>{O.jobStatus=l.payload.jobStatus})}),u.addEventListener("codegen_completed",()=>{r(g=>{g.tasks.codeGeneration.status="finished"})}),u.addEventListener("generation_completed",()=>{r(g=>{g.tasks.codeGeneration.status="finished"})}),u.addEventListener("assets_uploaded",()=>{r(g=>{g.tasks.uploadAssets.status="finished"})}),u.addEventListener("assets_list",g=>{const l=JSON.parse(g.data);b.assets=l.payload.assets});let m=0;u.addEventListener("error",g=>De(exports,null,function*(){var V,D,M,le,L,Ae;console.warn(`Experienced error during code generation (attempt ${m+1} / ${ps})`,g);let l,O,I=!1;try{if(g instanceof MessageEvent)l=JSON.parse(g.data);else{const re=yield o;O=re.status;try{l=yield re.json()}catch(fe){}}(((V=l==null?void 0:l.payload)==null?void 0:V.name)==="Task Crashed"||((D=l==null?void 0:l.payload)==null?void 0:D.name)==="TimeoutError"||((M=l==null?void 0:l.payload)==null?void 0:M.name)==="Error"||((le=l==null?void 0:l.payload)==null?void 0:le.name)==="Unknown error"||O===429)&&(I=!0)}catch(re){}const q=new Br({name:(L=l==null?void 0:l.payload.name)!=null?L:"Unknown error",reason:(Ae=l==null?void 0:l.payload.message)!=null?Ae:"Unknown",status:l==null?void 0:l.payload.status,detail:l==null?void 0:l.payload.detail});m++;let Z=!1;m>ps?(console.error("Experienced too many errors, terminating request"),Z=!0):I&&(console.error("Experienced unrecoverable error, terminating request"),Z=!0),Z&&(r(re=>{re.status="error",re.error=q}),v({result:null,error:q}))})),u.addEventListener("done",g=>{const l=JSON.parse(g.data);b.tokenUsage=l.payload.tokenUsage,b.sessionId=l.payload.sessionId,r(O=>{O.status="success",O.result=b}),v({result:b,error:null})})});try{const{result:v,error:b}=yield c,m=structuredClone(v);if(((p=i.assetsStorage)==null?void 0:p.strategy)==="local"&&((k=m==null?void 0:m.assets)!=null&&k.length)){const{filePath:g}=ys(i.assetsStorage),l=m.assets.map(I=>De(exports,null,function*(){const Z=yield(yield fetch(I.url)).arrayBuffer();return{assetName:I.name,base64:ca(Z)}})),O=yield Promise.allSettled(l);for(const I of O){const q={};if(I.status==="fulfilled"){const{assetName:Z,base64:V}=I.value;q[Z]=V;const D=g?`${g}/${Z}`:Z;m.files[D]={content:V,isBinary:!0}}}}return b?{result:null,error:b}:{result:m,error:b}}finally{u.close()}}),status:n.status,progressMessages:n.progressMessages,jobSessionId:n.jobSessionId,jobStatus:n.jobStatus,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 vs;function Jo(){return vs||(vs=1,process.env.NODE_ENV!=="production"&&function(){function t(v,b){return v===b&&(v!==0||1/v===1/b)||v!==v&&b!==b}function e(v,b){h||s.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 g=b();a(m,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}g=i({inst:{value:m,getSnapshot:b}});var l=g[0].inst,O=g[1];return u(function(){l.value=m,l.getSnapshot=b,n(l)&&O({inst:l})},[v,m,b]),o(function(){return n(l)&&O({inst:l}),v(function(){n(l)&&O({inst:l})})},[v]),c(m),m}function n(v){var b=v.getSnapshot;v=v.value;try{var m=b();return!a(v,m)}catch(g){return!0}}function r(v,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=z,a=typeof Object.is=="function"?Object.is:t,i=s.useState,o=s.useEffect,u=s.useLayoutEffect,c=s.useDebugValue,h=!1,p=!1,k=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?r:e;Mn.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:k,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Mn}var _s;function Xo(){return _s||(_s=1,process.env.NODE_ENV==="production"?en.exports=Go():en.exports=Jo()),en.exports}var Yo=Xo();const qs=0,Bs=1,Hs=2,bs=3;var ws=Object.prototype.hasOwnProperty;function gr(t,e){var n,r;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((r=t.length)===e.length)for(;r--&&gr(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(ws.call(t,n)&&++r&&!ws.call(e,n)||!(n in e)||!gr(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}const je=new WeakMap,Le=()=>{},ne=Le(),vr=Object,R=t=>t===ne,ke=t=>typeof t=="function",Ue=(t,e)=>qe(qe({},t),e),Gs=t=>ke(t.then),Ln={},tn={},Rr="undefined",Jt=typeof window!=Rr,_r=typeof document!=Rr,Qo=Jt&&"Deno"in window,eu=()=>Jt&&typeof window.requestAnimationFrame!=Rr,Js=(t,e)=>{const n=je.get(t);return[()=>!R(e)&&t.get(e)||Ln,r=>{if(!R(e)){const s=t.get(e);e in tn||(tn[e]=s),n[5](e,Ue(s,r),s||Ln)}},n[6],()=>!R(e)&&e in tn?tn[e]:!R(e)&&t.get(e)||Ln]};let br=!0;const tu=()=>br,[wr,kr]=Jt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Le,Le],nu=()=>{const t=_r&&document.visibilityState;return R(t)||t!=="hidden"},ru=t=>(_r&&document.addEventListener("visibilitychange",t),wr("focus",t),()=>{_r&&document.removeEventListener("visibilitychange",t),kr("focus",t)}),su=t=>{const e=()=>{br=!0,t()},n=()=>{br=!1};return wr("online",e),wr("offline",n),()=>{kr("online",e),kr("offline",n)}},au={isOnline:tu,isVisible:nu},iu={initFocus:ru,initReconnect:su},ks=!z.useId,Ht=!Jt||Qo,ou=t=>eu()?window.requestAnimationFrame(t):setTimeout(t,1),$n=Ht?z.useEffect:z.useLayoutEffect,Fn=typeof navigator!="undefined"&&navigator.connection,Ss=!Ht&&Fn&&(["slow-2g","2g"].includes(Fn.effectiveType)||Fn.saveData),nn=new WeakMap,Wn=(t,e)=>vr.prototype.toString.call(t)===`[object ${e}]`;let uu=0;const Sr=t=>{const e=typeof t,n=Wn(t,"Date"),r=Wn(t,"RegExp"),s=Wn(t,"Object");let a,i;if(vr(t)===t&&!n&&!r){if(a=nn.get(t),a)return a;if(a=++uu+"~",nn.set(t,a),Array.isArray(t)){for(a="@",i=0;i<t.length;i++)a+=Sr(t[i])+",";nn.set(t,a)}if(s){a="#";const o=vr.keys(t).sort();for(;!R(i=o.pop());)R(t[i])||(a+=i+":"+Sr(t[i])+",");nn.set(t,a)}}else a=n?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return a},jr=t=>{if(ke(t))try{t=t()}catch(n){t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Sr(t):"",[t,e]};let cu=0;const Er=()=>++cu;function Xs(...t){return Pe(this,null,function*(){const[e,n,r,s]=t,a=Ue({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let i=a.populateCache;const o=a.rollbackOnError;let u=a.optimisticData;const c=k=>typeof o=="function"?o(k):o!==!1,h=a.throwOnError;if(ke(n)){const k=n,v=[],b=e.keys();for(const m of b)!/^\$(inf|sub)\$/.test(m)&&k(e.get(m)._k)&&v.push(m);return Promise.all(v.map(p))}return p(n);function p(k){return Pe(this,null,function*(){const[v]=jr(k);if(!v)return;const[b,m]=Js(e,v),[g,l,O,I]=je.get(e),q=()=>{const he=g[v];return(ke(a.revalidate)?a.revalidate(b().data,k):a.revalidate!==!1)&&(delete O[v],delete I[v],he&&he[0])?he[0](Hs).then(()=>b().data):b().data};if(t.length<3)return q();let Z=r,V;const D=Er();l[v]=[D,0];const M=!R(u),J=b(),$=J.data,rt=J._c,Ve=R(rt)?$:rt;if(M&&(u=ke(u)?u(Ve,$):u,m({data:u,_c:Ve})),ke(Z))try{Z=Z(Ve)}catch(he){V=he}if(Z&&Gs(Z))if(Z=yield Z.catch(he=>{V=he}),D!==l[v][0]){if(V)throw V;return Z}else V&&M&&c(V)&&(i=!0,m({data:Ve,_c:ne}));if(i&&!V)if(ke(i)){const he=i(Z,Ve);m({data:he,error:ne,_c:ne})}else m({data:Z,error:ne,_c:ne});if(l[v][1]=Er(),Promise.resolve(q()).then(()=>{m({_c:ne})}),V){if(h)throw V;return}return Z})}})}const Es=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},du=(t,e)=>{if(!je.has(t)){const n=Ue(iu,e),r=Object.create(null),s=Xs.bind(ne,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)},u=(h,p,k)=>{t.set(h,p);const v=i[h];if(v)for(const b of v)b(p,k)},c=()=>{if(!je.has(t)&&(je.set(t,[r,Object.create(null),Object.create(null),Object.create(null),s,u,o]),!Ht)){const h=n.initFocus(setTimeout.bind(ne,Es.bind(ne,r,qs))),p=n.initReconnect(setTimeout.bind(ne,Es.bind(ne,r,Bs)));a=()=>{h&&h(),p&&p(),je.delete(t)}}};return c(),[t,s,c,a]}return[t,je.get(t)[4]]},lu=(t,e,n,r,s)=>{const a=n.errorRetryCount,i=s.retryCount,o=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!R(a)&&i>a||setTimeout(r,o,s)},fu=gr,[Ys,hu]=du(new Map),pu=Ue({onLoadingSlow:Le,onSuccess:Le,onError:Le,onErrorRetry:lu,onDiscarded:Le,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ss?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ss?5e3:3e3,compare:fu,isPaused:()=>!1,cache:Ys,mutate:hu,fallback:{}},au),mu=(t,e)=>{const n=Ue(t,e);if(e){const{use:r,fallback:s}=t,{use:a,fallback:i}=e;r&&a&&(n.use=r.concat(a)),s&&i&&(n.fallback=Ue(s,i))}return n},yu=z.createContext({}),gu="$inf$",Qs=Jt&&window.__SWR_DEVTOOLS_USE__,vu=Qs?window.__SWR_DEVTOOLS_USE__:[],_u=()=>{Qs&&(window.__SWR_DEVTOOLS_REACT__=z)},bu=t=>ke(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],wu=()=>Ue(pu,z.useContext(yu)),ku=t=>(e,n,r)=>t(e,n&&((...a)=>{const[i]=jr(e),[,,,o]=je.get(Ys);if(i.startsWith(gu))return n(...a);const u=o[i];return R(u)?n(...a):(delete o[i],u)}),r),Su=vu.concat(ku),Eu=t=>function(...n){const r=wu(),[s,a,i]=bu(n),o=mu(r,i);let u=t;const{use:c}=o,h=(c||[]).concat(Su);for(let p=h.length;p--;)u=h[p](u);return u(s,a||o.fetcher||null,o)},xu=(t,e,n)=>{const r=e[t]||(e[t]=[]);return r.push(n),()=>{const s=r.indexOf(n);s>=0&&(r[s]=r[r.length-1],r.pop())}};_u();const zn=z.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}}),Un={dedupe:!0},Ou=(t,e,n)=>{const{cache:r,compare:s,suspense:a,fallbackData:i,revalidateOnMount:o,revalidateIfStale:u,refreshInterval:c,refreshWhenHidden:h,refreshWhenOffline:p,keepPreviousData:k}=n,[v,b,m,g]=je.get(r),[l,O]=jr(t),I=z.useRef(!1),q=z.useRef(!1),Z=z.useRef(l),V=z.useRef(e),D=z.useRef(n),M=()=>D.current,J=()=>M().isVisible()&&M().isOnline(),[$,rt,Ve,he]=Js(r,l),st=z.useRef({}).current,Xt=R(i)?R(n.fallback)?ne:n.fallback[l]:i,Ir=(F,L)=>{for(const X in st){const K=X;if(K==="data"){if(!s(F[K],L[K])&&(!R(F[K])||!s(Qt,L[K])))return!1}else if(L[K]!==F[K])return!1}return!0},Pr=z.useMemo(()=>{const F=!l||!e?!1:R(o)?M().isPaused()||a?!1:u!==!1:o,L=ee=>{const Te=Ue(ee);return delete Te._k,F?qe({isValidating:!0,isLoading:!0},Te):Te},X=$(),K=he(),pe=L(X),ot=X===K?pe:L(K);let G=pe;return[()=>{const ee=L($());return Ir(ee,G)?(G.data=ee.data,G.isLoading=ee.isLoading,G.isValidating=ee.isValidating,G.error=ee.error,G):(G=ee,ee)},()=>ot]},[r,l]),at=Yo.useSyncExternalStore(z.useCallback(F=>Ve(l,(L,X)=>{Ir(X,L)||F()}),[r,l]),Pr[0],Pr[1]),Zr=!I.current,ea=v[l]&&v[l].length>0,it=at.data,Ke=R(it)?Xt&&Gs(Xt)?zn(Xt):Xt:it,Yt=at.error,On=z.useRef(Ke),Qt=k?R(it)?R(On.current)?Ke:On.current:it:Ke,Dr=ea&&!R(Yt)?!1:Zr&&!R(o)?o:M().isPaused()?!1:a?R(Ke)?!1:u:R(Ke)||u,Mr=!!(l&&e&&Zr&&Dr),ta=R(at.isValidating)?Mr:at.isValidating,na=R(at.isLoading)?Mr:at.isLoading,wt=z.useCallback(F=>Pe(exports,null,function*(){const L=V.current;if(!l||!L||q.current||M().isPaused())return!1;let X,K,pe=!0;const ot=F||{},G=!m[l]||!ot.dedupe,ee=()=>ks?!q.current&&l===Z.current&&I.current:l===Z.current,Te={isValidating:!1,isLoading:!1},$r=()=>{rt(Te)},Fr=()=>{const le=m[l];le&&le[1]===K&&delete m[l]},Wr={isValidating:!0};R($().data)&&(Wr.isLoading=!0);try{if(G&&(rt(Wr),n.loadingTimeout&&R($().data)&&setTimeout(()=>{pe&&ee()&&M().onLoadingSlow(l,n)},n.loadingTimeout),m[l]=[L(O),Er()]),[X,K]=m[l],X=yield X,G&&setTimeout(Fr,n.dedupingInterval),!m[l]||m[l][1]!==K)return G&&ee()&&M().onDiscarded(l),!1;Te.error=ne;const le=b[l];if(!R(le)&&(K<=le[0]||K<=le[1]||le[1]===0))return $r(),G&&ee()&&M().onDiscarded(l),!1;const Ae=$().data;Te.data=s(Ae,X)?Ae:X,G&&ee()&&M().onSuccess(X,l,n)}catch(le){Fr();const Ae=M(),{shouldRetryOnError:Tn}=Ae;Ae.isPaused()||(Te.error=le,G&&ee()&&(Ae.onError(le,l,Ae),(Tn===!0||ke(Tn)&&Tn(le))&&(!M().revalidateOnFocus||!M().revalidateOnReconnect||J())&&Ae.onErrorRetry(le,l,Ae,ra=>{const An=v[l];An&&An[0]&&An[0](bs,ra)},{retryCount:(ot.retryCount||0)+1,dedupe:!0})))}return pe=!1,$r(),!0}),[l,r]),Lr=z.useCallback((...F)=>Xs(r,Z.current,...F),[]);if($n(()=>{V.current=e,D.current=n,R(it)||(On.current=it)}),$n(()=>{if(!l)return;const F=wt.bind(ne,Un);let L=0;M().revalidateOnFocus&&(L=Date.now()+M().focusThrottleInterval);const K=xu(l,v,(pe,ot={})=>{if(pe==qs){const G=Date.now();M().revalidateOnFocus&&G>L&&J()&&(L=G+M().focusThrottleInterval,F())}else if(pe==Bs)M().revalidateOnReconnect&&J()&&F();else{if(pe==Hs)return wt();if(pe==bs)return wt(ot)}});return q.current=!1,Z.current=l,I.current=!0,rt({_k:O}),Dr&&(R(Ke)||Ht?F():ou(F)),()=>{q.current=!0,K()}},[l]),$n(()=>{let F;function L(){const K=ke(c)?c($().data):c;K&&F!==-1&&(F=setTimeout(X,K))}function X(){!$().error&&(h||M().isVisible())&&(p||M().isOnline())?wt(Un).then(L):L()}return L(),()=>{F&&(clearTimeout(F),F=-1)}},[c,h,p,l]),z.useDebugValue(Qt),a&&R(Ke)&&l){if(!ks&&Ht)throw new Error("Fallback data is required when using Suspense in SSR.");V.current=e,D.current=n,q.current=!1;const F=g[l];if(!R(F)){const L=Lr(F);zn(L)}if(R(Yt)){const L=wt(Un);R(Qt)||(L.status="fulfilled",L.value=!0),zn(L)}else throw Yt}return{mutate:Lr,get data(){return st.data=!0,Qt},get error(){return st.error=!0,Yt},get isValidating(){return st.isValidating=!0,ta},get isLoading(){return st.isLoading=!0,na}}},Tu=Eu(Ou),Au=({fileKey:t,authToken:e,enabled:n=!0,params:r={}})=>{const s=!!(n&&t&&e),{data:a,isLoading:i,error:o}=Tu(["useFigmaFile",t,e,r],()=>s?wi({fileKey:t,authToken:e,params:r}):null,{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1});return{data:a!=null?a:null,isLoading:i,error:o}};exports.useAnimaCodegen=Ho;exports.useFigmaFile=Au;
|
|
21
|
+
*/var vs;function Jo(){return vs||(vs=1,process.env.NODE_ENV!=="production"&&function(){function t(v,b){return v===b&&(v!==0||1/v===1/b)||v!==v&&b!==b}function e(v,b){h||s.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 g=b();a(m,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}g=i({inst:{value:m,getSnapshot:b}});var l=g[0].inst,O=g[1];return u(function(){l.value=m,l.getSnapshot=b,n(l)&&O({inst:l})},[v,m,b]),o(function(){return n(l)&&O({inst:l}),v(function(){n(l)&&O({inst:l})})},[v]),c(m),m}function n(v){var b=v.getSnapshot;v=v.value;try{var m=b();return!a(v,m)}catch(g){return!0}}function r(v,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=z,a=typeof Object.is=="function"?Object.is:t,i=s.useState,o=s.useEffect,u=s.useLayoutEffect,c=s.useDebugValue,h=!1,p=!1,k=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?r:e;Mn.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:k,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Mn}var _s;function Xo(){return _s||(_s=1,process.env.NODE_ENV==="production"?en.exports=Go():en.exports=Jo()),en.exports}var Yo=Xo();const qs=0,Bs=1,Hs=2,bs=3;var ws=Object.prototype.hasOwnProperty;function gr(t,e){var n,r;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((r=t.length)===e.length)for(;r--&&gr(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(ws.call(t,n)&&++r&&!ws.call(e,n)||!(n in e)||!gr(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}const Pe=new WeakMap,Fe=()=>{},te=Fe(),vr=Object,R=t=>t===te,Se=t=>typeof t=="function",Ke=(t,e)=>Be(Be({},t),e),Gs=t=>Se(t.then),Ln={},tn={},Rr="undefined",Jt=typeof window!=Rr,_r=typeof document!=Rr,Qo=Jt&&"Deno"in window,eu=()=>Jt&&typeof window.requestAnimationFrame!=Rr,Js=(t,e)=>{const n=Pe.get(t);return[()=>!R(e)&&t.get(e)||Ln,r=>{if(!R(e)){const s=t.get(e);e in tn||(tn[e]=s),n[5](e,Ke(s,r),s||Ln)}},n[6],()=>!R(e)&&e in tn?tn[e]:!R(e)&&t.get(e)||Ln]};let br=!0;const tu=()=>br,[wr,kr]=Jt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Fe,Fe],nu=()=>{const t=_r&&document.visibilityState;return R(t)||t!=="hidden"},ru=t=>(_r&&document.addEventListener("visibilitychange",t),wr("focus",t),()=>{_r&&document.removeEventListener("visibilitychange",t),kr("focus",t)}),su=t=>{const e=()=>{br=!0,t()},n=()=>{br=!1};return wr("online",e),wr("offline",n),()=>{kr("online",e),kr("offline",n)}},au={isOnline:tu,isVisible:nu},iu={initFocus:ru,initReconnect:su},ks=!z.useId,Ht=!Jt||Qo,ou=t=>eu()?window.requestAnimationFrame(t):setTimeout(t,1),$n=Ht?z.useEffect:z.useLayoutEffect,Fn=typeof navigator!="undefined"&&navigator.connection,Ss=!Ht&&Fn&&(["slow-2g","2g"].includes(Fn.effectiveType)||Fn.saveData),nn=new WeakMap,Wn=(t,e)=>vr.prototype.toString.call(t)===`[object ${e}]`;let uu=0;const Sr=t=>{const e=typeof t,n=Wn(t,"Date"),r=Wn(t,"RegExp"),s=Wn(t,"Object");let a,i;if(vr(t)===t&&!n&&!r){if(a=nn.get(t),a)return a;if(a=++uu+"~",nn.set(t,a),Array.isArray(t)){for(a="@",i=0;i<t.length;i++)a+=Sr(t[i])+",";nn.set(t,a)}if(s){a="#";const o=vr.keys(t).sort();for(;!R(i=o.pop());)R(t[i])||(a+=i+":"+Sr(t[i])+",");nn.set(t,a)}}else a=n?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return a},jr=t=>{if(Se(t))try{t=t()}catch(n){t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?Sr(t):"",[t,e]};let cu=0;const Er=()=>++cu;function Xs(...t){return De(this,null,function*(){const[e,n,r,s]=t,a=Ke({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let i=a.populateCache;const o=a.rollbackOnError;let u=a.optimisticData;const c=k=>typeof o=="function"?o(k):o!==!1,h=a.throwOnError;if(Se(n)){const k=n,v=[],b=e.keys();for(const m of b)!/^\$(inf|sub)\$/.test(m)&&k(e.get(m)._k)&&v.push(m);return Promise.all(v.map(p))}return p(n);function p(k){return De(this,null,function*(){const[v]=jr(k);if(!v)return;const[b,m]=Js(e,v),[g,l,O,I]=Pe.get(e),q=()=>{const fe=g[v];return(Se(a.revalidate)?a.revalidate(b().data,k):a.revalidate!==!1)&&(delete O[v],delete I[v],fe&&fe[0])?fe[0](Hs).then(()=>b().data):b().data};if(t.length<3)return q();let Z=r,V;const D=Er();l[v]=[D,0];const M=!R(u),le=b(),L=le.data,Ae=le._c,re=R(Ae)?L:Ae;if(M&&(u=Se(u)?u(re,L):u,m({data:u,_c:re})),Se(Z))try{Z=Z(re)}catch(fe){V=fe}if(Z&&Gs(Z))if(Z=yield Z.catch(fe=>{V=fe}),D!==l[v][0]){if(V)throw V;return Z}else V&&M&&c(V)&&(i=!0,m({data:re,_c:te}));if(i&&!V)if(Se(i)){const fe=i(Z,re);m({data:fe,error:te,_c:te})}else m({data:Z,error:te,_c:te});if(l[v][1]=Er(),Promise.resolve(q()).then(()=>{m({_c:te})}),V){if(h)throw V;return}return Z})}})}const Es=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},du=(t,e)=>{if(!Pe.has(t)){const n=Ke(iu,e),r=Object.create(null),s=Xs.bind(te,t);let a=Fe;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)},u=(h,p,k)=>{t.set(h,p);const v=i[h];if(v)for(const b of v)b(p,k)},c=()=>{if(!Pe.has(t)&&(Pe.set(t,[r,Object.create(null),Object.create(null),Object.create(null),s,u,o]),!Ht)){const h=n.initFocus(setTimeout.bind(te,Es.bind(te,r,qs))),p=n.initReconnect(setTimeout.bind(te,Es.bind(te,r,Bs)));a=()=>{h&&h(),p&&p(),Pe.delete(t)}}};return c(),[t,s,c,a]}return[t,Pe.get(t)[4]]},lu=(t,e,n,r,s)=>{const a=n.errorRetryCount,i=s.retryCount,o=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!R(a)&&i>a||setTimeout(r,o,s)},fu=gr,[Ys,hu]=du(new Map),pu=Ke({onLoadingSlow:Fe,onSuccess:Fe,onError:Fe,onErrorRetry:lu,onDiscarded:Fe,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Ss?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Ss?5e3:3e3,compare:fu,isPaused:()=>!1,cache:Ys,mutate:hu,fallback:{}},au),mu=(t,e)=>{const n=Ke(t,e);if(e){const{use:r,fallback:s}=t,{use:a,fallback:i}=e;r&&a&&(n.use=r.concat(a)),s&&i&&(n.fallback=Ke(s,i))}return n},yu=z.createContext({}),gu="$inf$",Qs=Jt&&window.__SWR_DEVTOOLS_USE__,vu=Qs?window.__SWR_DEVTOOLS_USE__:[],_u=()=>{Qs&&(window.__SWR_DEVTOOLS_REACT__=z)},bu=t=>Se(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],wu=()=>Ke(pu,z.useContext(yu)),ku=t=>(e,n,r)=>t(e,n&&((...a)=>{const[i]=jr(e),[,,,o]=Pe.get(Ys);if(i.startsWith(gu))return n(...a);const u=o[i];return R(u)?n(...a):(delete o[i],u)}),r),Su=vu.concat(ku),Eu=t=>function(...n){const r=wu(),[s,a,i]=bu(n),o=mu(r,i);let u=t;const{use:c}=o,h=(c||[]).concat(Su);for(let p=h.length;p--;)u=h[p](u);return u(s,a||o.fetcher||null,o)},xu=(t,e,n)=>{const r=e[t]||(e[t]=[]);return r.push(n),()=>{const s=r.indexOf(n);s>=0&&(r[s]=r[r.length-1],r.pop())}};_u();const zn=z.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}}),Un={dedupe:!0},Ou=(t,e,n)=>{const{cache:r,compare:s,suspense:a,fallbackData:i,revalidateOnMount:o,revalidateIfStale:u,refreshInterval:c,refreshWhenHidden:h,refreshWhenOffline:p,keepPreviousData:k}=n,[v,b,m,g]=Pe.get(r),[l,O]=jr(t),I=z.useRef(!1),q=z.useRef(!1),Z=z.useRef(l),V=z.useRef(e),D=z.useRef(n),M=()=>D.current,le=()=>M().isVisible()&&M().isOnline(),[L,Ae,re,fe]=Js(r,l),st=z.useRef({}).current,Xt=R(i)?R(n.fallback)?te:n.fallback[l]:i,Ir=(F,$)=>{for(const J in st){const K=J;if(K==="data"){if(!s(F[K],$[K])&&(!R(F[K])||!s(Qt,$[K])))return!1}else if($[K]!==F[K])return!1}return!0},Pr=z.useMemo(()=>{const F=!l||!e?!1:R(o)?M().isPaused()||a?!1:u!==!1:o,$=Q=>{const Ce=Ke(Q);return delete Ce._k,F?Be({isValidating:!0,isLoading:!0},Ce):Ce},J=L(),K=fe(),me=$(J),ot=J===K?me:$(K);let G=me;return[()=>{const Q=$(L());return Ir(Q,G)?(G.data=Q.data,G.isLoading=Q.isLoading,G.isValidating=Q.isValidating,G.error=Q.error,G):(G=Q,Q)},()=>ot]},[r,l]),at=Yo.useSyncExternalStore(z.useCallback(F=>re(l,($,J)=>{Ir(J,$)||F()}),[r,l]),Pr[0],Pr[1]),Zr=!I.current,ea=v[l]&&v[l].length>0,it=at.data,qe=R(it)?Xt&&Gs(Xt)?zn(Xt):Xt:it,Yt=at.error,On=z.useRef(qe),Qt=k?R(it)?R(On.current)?qe:On.current:it:qe,Dr=ea&&!R(Yt)?!1:Zr&&!R(o)?o:M().isPaused()?!1:a?R(qe)?!1:u:R(qe)||u,Mr=!!(l&&e&&Zr&&Dr),ta=R(at.isValidating)?Mr:at.isValidating,na=R(at.isLoading)?Mr:at.isLoading,wt=z.useCallback(F=>De(exports,null,function*(){const $=V.current;if(!l||!$||q.current||M().isPaused())return!1;let J,K,me=!0;const ot=F||{},G=!m[l]||!ot.dedupe,Q=()=>ks?!q.current&&l===Z.current&&I.current:l===Z.current,Ce={isValidating:!1,isLoading:!1},$r=()=>{Ae(Ce)},Fr=()=>{const he=m[l];he&&he[1]===K&&delete m[l]},Wr={isValidating:!0};R(L().data)&&(Wr.isLoading=!0);try{if(G&&(Ae(Wr),n.loadingTimeout&&R(L().data)&&setTimeout(()=>{me&&Q()&&M().onLoadingSlow(l,n)},n.loadingTimeout),m[l]=[$(O),Er()]),[J,K]=m[l],J=yield J,G&&setTimeout(Fr,n.dedupingInterval),!m[l]||m[l][1]!==K)return G&&Q()&&M().onDiscarded(l),!1;Ce.error=te;const he=b[l];if(!R(he)&&(K<=he[0]||K<=he[1]||he[1]===0))return $r(),G&&Q()&&M().onDiscarded(l),!1;const Ne=L().data;Ce.data=s(Ne,J)?Ne:J,G&&Q()&&M().onSuccess(J,l,n)}catch(he){Fr();const Ne=M(),{shouldRetryOnError:Tn}=Ne;Ne.isPaused()||(Ce.error=he,G&&Q()&&(Ne.onError(he,l,Ne),(Tn===!0||Se(Tn)&&Tn(he))&&(!M().revalidateOnFocus||!M().revalidateOnReconnect||le())&&Ne.onErrorRetry(he,l,Ne,ra=>{const An=v[l];An&&An[0]&&An[0](bs,ra)},{retryCount:(ot.retryCount||0)+1,dedupe:!0})))}return me=!1,$r(),!0}),[l,r]),Lr=z.useCallback((...F)=>Xs(r,Z.current,...F),[]);if($n(()=>{V.current=e,D.current=n,R(it)||(On.current=it)}),$n(()=>{if(!l)return;const F=wt.bind(te,Un);let $=0;M().revalidateOnFocus&&($=Date.now()+M().focusThrottleInterval);const K=xu(l,v,(me,ot={})=>{if(me==qs){const G=Date.now();M().revalidateOnFocus&&G>$&&le()&&($=G+M().focusThrottleInterval,F())}else if(me==Bs)M().revalidateOnReconnect&&le()&&F();else{if(me==Hs)return wt();if(me==bs)return wt(ot)}});return q.current=!1,Z.current=l,I.current=!0,Ae({_k:O}),Dr&&(R(qe)||Ht?F():ou(F)),()=>{q.current=!0,K()}},[l]),$n(()=>{let F;function $(){const K=Se(c)?c(L().data):c;K&&F!==-1&&(F=setTimeout(J,K))}function J(){!L().error&&(h||M().isVisible())&&(p||M().isOnline())?wt(Un).then($):$()}return $(),()=>{F&&(clearTimeout(F),F=-1)}},[c,h,p,l]),z.useDebugValue(Qt),a&&R(qe)&&l){if(!ks&&Ht)throw new Error("Fallback data is required when using Suspense in SSR.");V.current=e,D.current=n,q.current=!1;const F=g[l];if(!R(F)){const $=Lr(F);zn($)}if(R(Yt)){const $=wt(Un);R(Qt)||($.status="fulfilled",$.value=!0),zn($)}else throw Yt}return{mutate:Lr,get data(){return st.data=!0,Qt},get error(){return st.error=!0,Yt},get isValidating(){return st.isValidating=!0,ta},get isLoading(){return st.isLoading=!0,na}}},Tu=Eu(Ou),Au=({fileKey:t,authToken:e,enabled:n=!0,params:r={}})=>{const s=!!(n&&t&&e),{data:a,isLoading:i,error:o}=Tu(["useFigmaFile",t,e,r],()=>s?wi({fileKey:t,authToken:e,params:r}):null,{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1});return{data:a!=null?a:null,isLoading:i,error:o}};exports.useAnimaCodegen=Ho;exports.useFigmaFile=Au;
|
|
22
22
|
//# sourceMappingURL=index.cjs.map
|