@animaapp/anima-sdk 0.17.0-test.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";var ea=Object.defineProperty,ta=Object.defineProperties;var na=Object.getOwnPropertyDescriptors;var An=Object.getOwnPropertySymbols;var ra=Object.prototype.hasOwnProperty,aa=Object.prototype.propertyIsEnumerable;var On=e=>{throw TypeError(e)},Rn=Math.pow,Cn=(e,t,n)=>t in e?ea(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var n in t||(t={}))ra.call(t,n)&&Cn(e,n,t[n]);if(An)for(var n of An(t))aa.call(t,n)&&Cn(e,n,t[n]);return e},v=(e,t)=>ta(e,na(t));var Dt=(e,t,n)=>t.has(e)||On("Cannot "+n);var w=(e,t,n)=>(Dt(e,t,"read from private field"),n?n.call(e):t.get(e)),X=(e,t,n)=>t.has(e)?On("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),H=(e,t,n,r)=>(Dt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),L=(e,t,n)=>(Dt(e,t,"access private method"),n);var C=(e,t,n)=>new Promise((r,a)=>{var i=c=>{try{o(n.next(c))}catch(l){a(l)}},s=c=>{try{o(n.throw(c))}catch(l){a(l)}},o=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,s);o((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const ia=4,Nn=0,In=1,sa=2;function $e(e){let t=e.length;for(;--t>=0;)e[t]=0}const oa=0,or=1,la=2,ca=3,da=258,vn=29,lt=256,Ye=lt+1+vn,Re=30,bn=19,lr=2*Ye+1,we=15,jt=16,ua=7,wn=256,cr=16,dr=17,ur=18,Wt=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),xt=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),fa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),fr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ha=512,se=new Array((Ye+2)*2);$e(se);const Ke=new Array(Re*2);$e(Ke);const Qe=new Array(ha);$e(Qe);const et=new Array(da-ca+1);$e(et);const xn=new Array(vn);$e(xn);const Tt=new Array(Re);$e(Tt);function Mt(e,t,n,r,a){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=a,this.has_stree=e&&e.length}let hr,_r,pr;function $t(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const mr=e=>e<256?Qe[e]:Qe[256+(e>>>7)],tt=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},$=(e,t,n)=>{e.bi_valid>jt-n?(e.bi_buf|=t<<e.bi_valid&65535,tt(e,e.bi_buf),e.bi_buf=t>>jt-e.bi_valid,e.bi_valid+=n-jt):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},Q=(e,t,n)=>{$(e,n[t*2],n[t*2+1])},gr=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},_a=e=>{e.bi_valid===16?(tt(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},pa=(e,t)=>{const n=t.dyn_tree,r=t.max_code,a=t.stat_desc.static_tree,i=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,c=t.stat_desc.max_length;let l,h,T,y,N,I,P=0;for(y=0;y<=we;y++)e.bl_count[y]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<lr;l++)h=e.heap[l],y=n[n[h*2+1]*2+1]+1,y>c&&(y=c,P++),n[h*2+1]=y,!(h>r)&&(e.bl_count[y]++,N=0,h>=o&&(N=s[h-o]),I=n[h*2],e.opt_len+=I*(y+N),i&&(e.static_len+=I*(a[h*2+1]+N)));if(P!==0){do{for(y=c-1;e.bl_count[y]===0;)y--;e.bl_count[y]--,e.bl_count[y+1]+=2,e.bl_count[c]--,P-=2}while(P>0);for(y=c;y!==0;y--)for(h=e.bl_count[y];h!==0;)T=e.heap[--l],!(T>r)&&(n[T*2+1]!==y&&(e.opt_len+=(y-n[T*2+1])*n[T*2],n[T*2+1]=y),h--)}},yr=(e,t,n)=>{const r=new Array(we+1);let a=0,i,s;for(i=1;i<=we;i++)a=a+n[i-1]<<1,r[i]=a;for(s=0;s<=t;s++){let o=e[s*2+1];o!==0&&(e[s*2]=gr(r[o]++,o))}},ma=()=>{let e,t,n,r,a;const i=new Array(we+1);for(n=0,r=0;r<vn-1;r++)for(xn[r]=n,e=0;e<1<<Wt[r];e++)et[n++]=r;for(et[n-1]=r,a=0,r=0;r<16;r++)for(Tt[r]=a,e=0;e<1<<xt[r];e++)Qe[a++]=r;for(a>>=7;r<Re;r++)for(Tt[r]=a<<7,e=0;e<1<<xt[r]-7;e++)Qe[256+a++]=r;for(t=0;t<=we;t++)i[t]=0;for(e=0;e<=143;)se[e*2+1]=8,e++,i[8]++;for(;e<=255;)se[e*2+1]=9,e++,i[9]++;for(;e<=279;)se[e*2+1]=7,e++,i[7]++;for(;e<=287;)se[e*2+1]=8,e++,i[8]++;for(yr(se,Ye+1,i),e=0;e<Re;e++)Ke[e*2+1]=5,Ke[e*2]=gr(e,5);hr=new Mt(se,Wt,lt+1,Ye,we),_r=new Mt(Ke,xt,0,Re,we),pr=new Mt(new Array(0),fa,0,bn,ua)},vr=e=>{let t;for(t=0;t<Ye;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Re;t++)e.dyn_dtree[t*2]=0;for(t=0;t<bn;t++)e.bl_tree[t*2]=0;e.dyn_ltree[wn*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},br=e=>{e.bi_valid>8?tt(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Zn=(e,t,n,r)=>{const a=t*2,i=n*2;return e[a]<e[i]||e[a]===e[i]&&r[t]<=r[n]},Ut=(e,t,n)=>{const r=e.heap[n];let a=n<<1;for(;a<=e.heap_len&&(a<e.heap_len&&Zn(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!Zn(t,r,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=r},zn=(e,t,n)=>{let r,a,i=0,s,o;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+i++]&255,r+=(e.pending_buf[e.sym_buf+i++]&255)<<8,a=e.pending_buf[e.sym_buf+i++],r===0?Q(e,a,t):(s=et[a],Q(e,s+lt+1,t),o=Wt[s],o!==0&&(a-=xn[s],$(e,a,o)),r--,s=mr(r),Q(e,s,n),o=xt[s],o!==0&&(r-=Tt[s],$(e,r,o)));while(i<e.sym_next);Q(e,wn,t)},qt=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,a=t.stat_desc.has_stree,i=t.stat_desc.elems;let s,o,c=-1,l;for(e.heap_len=0,e.heap_max=lr,s=0;s<i;s++)n[s*2]!==0?(e.heap[++e.heap_len]=c=s,e.depth[s]=0):n[s*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,a&&(e.static_len-=r[l*2+1]);for(t.max_code=c,s=e.heap_len>>1;s>=1;s--)Ut(e,n,s);l=i;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ut(e,n,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,n[l*2]=n[s*2]+n[o*2],e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,n[s*2+1]=n[o*2+1]=l,e.heap[1]=l++,Ut(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],pa(e,t),yr(n,c,e.bl_count)},Fn=(e,t,n)=>{let r,a=-1,i,s=t[1],o=0,c=7,l=4;for(s===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)i=s,s=t[(r+1)*2+1],!(++o<c&&i===s)&&(o<l?e.bl_tree[i*2]+=o:i!==0?(i!==a&&e.bl_tree[i*2]++,e.bl_tree[cr*2]++):o<=10?e.bl_tree[dr*2]++:e.bl_tree[ur*2]++,o=0,a=i,s===0?(c=138,l=3):i===s?(c=6,l=3):(c=7,l=4))},Ln=(e,t,n)=>{let r,a=-1,i,s=t[1],o=0,c=7,l=4;for(s===0&&(c=138,l=3),r=0;r<=n;r++)if(i=s,s=t[(r+1)*2+1],!(++o<c&&i===s)){if(o<l)do Q(e,i,e.bl_tree);while(--o!==0);else i!==0?(i!==a&&(Q(e,i,e.bl_tree),o--),Q(e,cr,e.bl_tree),$(e,o-3,2)):o<=10?(Q(e,dr,e.bl_tree),$(e,o-3,3)):(Q(e,ur,e.bl_tree),$(e,o-11,7));o=0,a=i,s===0?(c=138,l=3):i===s?(c=6,l=3):(c=7,l=4)}},ga=e=>{let t;for(Fn(e,e.dyn_ltree,e.l_desc.max_code),Fn(e,e.dyn_dtree,e.d_desc.max_code),qt(e,e.bl_desc),t=bn-1;t>=3&&e.bl_tree[fr[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},ya=(e,t,n,r)=>{let a;for($(e,t-257,5),$(e,n-1,5),$(e,r-4,4),a=0;a<r;a++)$(e,e.bl_tree[fr[a]*2+1],3);Ln(e,e.dyn_ltree,t-1),Ln(e,e.dyn_dtree,n-1)},va=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Nn;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return In;for(n=32;n<lt;n++)if(e.dyn_ltree[n*2]!==0)return In;return Nn};let Dn=!1;const ba=e=>{Dn||(ma(),Dn=!0),e.l_desc=new $t(e.dyn_ltree,hr),e.d_desc=new $t(e.dyn_dtree,_r),e.bl_desc=new $t(e.bl_tree,pr),e.bi_buf=0,e.bi_valid=0,vr(e)},wr=(e,t,n,r)=>{$(e,(oa<<1)+(r?1:0),3),br(e),tt(e,n),tt(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},wa=e=>{$(e,or<<1,3),Q(e,wn,se),_a(e)},xa=(e,t,n,r)=>{let a,i,s=0;e.level>0?(e.strm.data_type===sa&&(e.strm.data_type=va(e)),qt(e,e.l_desc),qt(e,e.d_desc),s=ga(e),a=e.opt_len+3+7>>>3,i=e.static_len+3+7>>>3,i<=a&&(a=i)):a=i=n+5,n+4<=a&&t!==-1?wr(e,t,n,r):e.strategy===ia||i===a?($(e,(or<<1)+(r?1:0),3),zn(e,se,Ke)):($(e,(la<<1)+(r?1:0),3),ya(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),zn(e,e.dyn_ltree,e.dyn_dtree)),vr(e),r&&br(e)},ka=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(et[n]+lt+1)*2]++,e.dyn_dtree[mr(t)*2]++),e.sym_next===e.sym_end);var Sa=ba,Ta=wr,Ea=xa,Aa=ka,Ca=wa,Oa={_tr_init:Sa,_tr_stored_block:Ta,_tr_flush_block:Ea,_tr_tally:Aa,_tr_align:Ca};const Ra=(e,t,n,r)=>{let a=e&65535|0,i=e>>>16&65535|0,s=0;for(;n!==0;){s=n>2e3?2e3:n,n-=s;do a=a+t[r++]|0,i=i+a|0;while(--s);a%=65521,i%=65521}return a|i<<16|0};var xr=Ra;const Na=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},Ia=new Uint32Array(Na()),Za=(e,t,n,r)=>{const a=Ia,i=r+n;e^=-1;for(let s=r;s<i;s++)e=e>>>8^a[(e^t[s])&255];return e^-1};var de=Za,Et={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},kr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:za,_tr_stored_block:Gt,_tr_flush_block:Fa,_tr_tally:pe,_tr_align:La}=Oa,{Z_NO_FLUSH:me,Z_PARTIAL_FLUSH:Da,Z_FULL_FLUSH:ja,Z_FINISH:q,Z_BLOCK:jn,Z_OK:F,Z_STREAM_END:Mn,Z_STREAM_ERROR:te,Z_DATA_ERROR:Ma,Z_BUF_ERROR:Pt,Z_DEFAULT_COMPRESSION:$a,Z_FILTERED:Ua,Z_HUFFMAN_ONLY:yt,Z_RLE:Pa,Z_FIXED:Ba,Z_DEFAULT_STRATEGY:Va,Z_UNKNOWN:Ha,Z_DEFLATED:zt}=kr,Wa=9,qa=15,Ga=8,Ja=29,Ka=256,Jt=Ka+1+Ja,Xa=30,Ya=19,Qa=2*Jt+1,ei=15,x=3,_e=258,ne=_e+x+1,ti=32,Ie=42,kn=57,Kt=69,Xt=73,Yt=91,Qt=103,xe=113,We=666,j=1,Ue=2,Se=3,Pe=4,ni=3,ke=(e,t)=>(e.msg=Et[t],t),$n=e=>e*2-(e>4?9:0),he=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ri=e=>{let t,n,r,a=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=a?n-a:0;while(--t);t=a,r=t;do n=e.prev[--r],e.prev[r]=n>=a?n-a:0;while(--t)};let ai=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,ge=ai;const B=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},V=(e,t)=>{Fa(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,B(e.strm)},A=(e,t)=>{e.pending_buf[e.pending++]=t},He=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},en=(e,t,n,r)=>{let a=e.avail_in;return a>r&&(a=r),a===0?0:(e.avail_in-=a,t.set(e.input.subarray(e.next_in,e.next_in+a),n),e.state.wrap===1?e.adler=xr(e.adler,t,a,n):e.state.wrap===2&&(e.adler=de(e.adler,t,a,n)),e.next_in+=a,e.total_in+=a,a)},Sr=(e,t)=>{let n=e.max_chain_length,r=e.strstart,a,i,s=e.prev_length,o=e.nice_match;const c=e.strstart>e.w_size-ne?e.strstart-(e.w_size-ne):0,l=e.window,h=e.w_mask,T=e.prev,y=e.strstart+_e;let N=l[r+s-1],I=l[r+s];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do if(a=t,!(l[a+s]!==I||l[a+s-1]!==N||l[a]!==l[r]||l[++a]!==l[r+1])){r+=2,a++;do;while(l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&r<y);if(i=_e-(y-r),r=y-_e,i>s){if(e.match_start=t,s=i,i>=o)break;N=l[r+s-1],I=l[r+s]}}while((t=T[t&h])>c&&--n!==0);return s<=e.lookahead?s:e.lookahead},Ze=e=>{const t=e.w_size;let n,r,a;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ne)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),ri(e),r+=t),e.strm.avail_in===0)break;if(n=en(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=x)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=ge(e,e.ins_h,e.window[a+1]);e.insert&&(e.ins_h=ge(e,e.ins_h,e.window[a+x-1]),e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<x)););}while(e.lookahead<ne&&e.strm.avail_in!==0)},Tr=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,a,i,s=0,o=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i||(i=e.strm.avail_out-i,a=e.strstart-e.block_start,r>a+e.strm.avail_in&&(r=a+e.strm.avail_in),r>i&&(r=i),r<n&&(r===0&&t!==q||t===me||r!==a+e.strm.avail_in)))break;s=t===q&&r===a+e.strm.avail_in?1:0,Gt(e,0,0,s),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,B(e.strm),a&&(a>r&&(a=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+a),e.strm.next_out),e.strm.next_out+=a,e.strm.avail_out-=a,e.strm.total_out+=a,e.block_start+=a,r-=a),r&&(en(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(s===0);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?Pe:t!==me&&t!==q&&e.strm.avail_in===0&&e.strstart===e.block_start?Ue:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(en(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,n=i>e.w_size?e.w_size:i,a=e.strstart-e.block_start,(a>=n||(a||t===q)&&t!==me&&e.strm.avail_in===0&&a<=i)&&(r=a>i?i:a,s=t===q&&e.strm.avail_in===0&&r===a?1:0,Gt(e,e.block_start,r,s),e.block_start+=r,B(e.strm)),s?Se:j)},Bt=(e,t)=>{let n,r;for(;;){if(e.lookahead<ne){if(Ze(e),e.lookahead<ne&&t===me)return j;if(e.lookahead===0)break}if(n=0,e.lookahead>=x&&(e.ins_h=ge(e,e.ins_h,e.window[e.strstart+x-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-ne&&(e.match_length=Sr(e,n)),e.match_length>=x)if(r=pe(e,e.strstart-e.match_start,e.match_length-x),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=x){e.match_length--;do e.strstart++,e.ins_h=ge(e,e.ins_h,e.window[e.strstart+x-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=ge(e,e.ins_h,e.window[e.strstart+1]);else r=pe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(V(e,!1),e.strm.avail_out===0))return j}return e.insert=e.strstart<x-1?e.strstart:x-1,t===q?(V(e,!0),e.strm.avail_out===0?Se:Pe):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?j:Ue},Ae=(e,t)=>{let n,r,a;for(;;){if(e.lookahead<ne){if(Ze(e),e.lookahead<ne&&t===me)return j;if(e.lookahead===0)break}if(n=0,e.lookahead>=x&&(e.ins_h=ge(e,e.ins_h,e.window[e.strstart+x-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=x-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-ne&&(e.match_length=Sr(e,n),e.match_length<=5&&(e.strategy===Ua||e.match_length===x&&e.strstart-e.match_start>4096)&&(e.match_length=x-1)),e.prev_length>=x&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-x,r=pe(e,e.strstart-1-e.prev_match,e.prev_length-x),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=a&&(e.ins_h=ge(e,e.ins_h,e.window[e.strstart+x-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=x-1,e.strstart++,r&&(V(e,!1),e.strm.avail_out===0))return j}else if(e.match_available){if(r=pe(e,0,e.window[e.strstart-1]),r&&V(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return j}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=pe(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<x-1?e.strstart:x-1,t===q?(V(e,!0),e.strm.avail_out===0?Se:Pe):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?j:Ue},ii=(e,t)=>{let n,r,a,i;const s=e.window;for(;;){if(e.lookahead<=_e){if(Ze(e),e.lookahead<=_e&&t===me)return j;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=x&&e.strstart>0&&(a=e.strstart-1,r=s[a],r===s[++a]&&r===s[++a]&&r===s[++a])){i=e.strstart+_e;do;while(r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&a<i);e.match_length=_e-(i-a),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=x?(n=pe(e,1,e.match_length-x),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=pe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(V(e,!1),e.strm.avail_out===0))return j}return e.insert=0,t===q?(V(e,!0),e.strm.avail_out===0?Se:Pe):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?j:Ue},si=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Ze(e),e.lookahead===0)){if(t===me)return j;break}if(e.match_length=0,n=pe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(V(e,!1),e.strm.avail_out===0))return j}return e.insert=0,t===q?(V(e,!0),e.strm.avail_out===0?Se:Pe):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?j:Ue};function Y(e,t,n,r,a){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=a}const qe=[new Y(0,0,0,0,Tr),new Y(4,4,8,4,Bt),new Y(4,5,16,8,Bt),new Y(4,6,32,32,Bt),new Y(4,4,16,16,Ae),new Y(8,16,32,32,Ae),new Y(8,16,128,128,Ae),new Y(8,32,128,256,Ae),new Y(32,128,258,1024,Ae),new Y(32,258,258,4096,Ae)],oi=e=>{e.window_size=2*e.w_size,he(e.head),e.max_lazy_match=qe[e.level].max_lazy,e.good_match=qe[e.level].good_length,e.nice_match=qe[e.level].nice_length,e.max_chain_length=qe[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=x-1,e.match_available=0,e.ins_h=0};function li(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=zt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Qa*2),this.dyn_dtree=new Uint16Array((2*Xa+1)*2),this.bl_tree=new Uint16Array((2*Ya+1)*2),he(this.dyn_ltree),he(this.dyn_dtree),he(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ei+1),this.heap=new Uint16Array(2*Jt+1),he(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Jt+1),he(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const ct=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Ie&&t.status!==kn&&t.status!==Kt&&t.status!==Xt&&t.status!==Yt&&t.status!==Qt&&t.status!==xe&&t.status!==We?1:0},Er=e=>{if(ct(e))return ke(e,te);e.total_in=e.total_out=0,e.data_type=Ha;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?kn:t.wrap?Ie:xe,e.adler=t.wrap===2?0:1,t.last_flush=-2,za(t),F},Ar=e=>{const t=Er(e);return t===F&&oi(e.state),t},ci=(e,t)=>ct(e)||e.state.wrap!==2?te:(e.state.gzhead=t,F),Cr=(e,t,n,r,a,i)=>{if(!e)return te;let s=1;if(t===$a&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),a<1||a>Wa||n!==zt||r<8||r>15||t<0||t>9||i<0||i>Ba||r===8&&s!==1)return ke(e,te);r===8&&(r=9);const o=new li;return e.state=o,o.strm=e,o.status=Ie,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=a+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+x-1)/x),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<a+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=t,o.strategy=i,o.method=n,Ar(e)},di=(e,t)=>Cr(e,t,zt,qa,Ga,Va),ui=(e,t)=>{if(ct(e)||t>jn||t<0)return e?ke(e,te):te;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===We&&t!==q)return ke(e,e.avail_out===0?Pt:te);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(B(e),e.avail_out===0)return n.last_flush=-1,F}else if(e.avail_in===0&&$n(t)<=$n(r)&&t!==q)return ke(e,Pt);if(n.status===We&&e.avail_in!==0)return ke(e,Pt);if(n.status===Ie&&n.wrap===0&&(n.status=xe),n.status===Ie){let a=zt+(n.w_bits-8<<4)<<8,i=-1;if(n.strategy>=yt||n.level<2?i=0:n.level<6?i=1:n.level===6?i=2:i=3,a|=i<<6,n.strstart!==0&&(a|=ti),a+=31-a%31,He(n,a),n.strstart!==0&&(He(n,e.adler>>>16),He(n,e.adler&65535)),e.adler=1,n.status=xe,B(e),n.pending!==0)return n.last_flush=-1,F}if(n.status===kn){if(e.adler=0,A(n,31),A(n,139),A(n,8),n.gzhead)A(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),A(n,n.gzhead.time&255),A(n,n.gzhead.time>>8&255),A(n,n.gzhead.time>>16&255),A(n,n.gzhead.time>>24&255),A(n,n.level===9?2:n.strategy>=yt||n.level<2?4:0),A(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(A(n,n.gzhead.extra.length&255),A(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=de(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Kt;else if(A(n,0),A(n,0),A(n,0),A(n,0),A(n,0),A(n,n.level===9?2:n.strategy>=yt||n.level<2?4:0),A(n,ni),n.status=xe,B(e),n.pending!==0)return n.last_flush=-1,F}if(n.status===Kt){if(n.gzhead.extra){let a=n.pending,i=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let o=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a)),n.gzindex+=o,B(e),n.pending!==0)return n.last_flush=-1,F;a=0,i-=o}let s=new Uint8Array(n.gzhead.extra);n.pending_buf.set(s.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a)),n.gzindex=0}n.status=Xt}if(n.status===Xt){if(n.gzhead.name){let a=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a)),B(e),n.pending!==0)return n.last_flush=-1,F;a=0}n.gzindex<n.gzhead.name.length?i=n.gzhead.name.charCodeAt(n.gzindex++)&255:i=0,A(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a)),n.gzindex=0}n.status=Yt}if(n.status===Yt){if(n.gzhead.comment){let a=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a)),B(e),n.pending!==0)return n.last_flush=-1,F;a=0}n.gzindex<n.gzhead.comment.length?i=n.gzhead.comment.charCodeAt(n.gzindex++)&255:i=0,A(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a))}n.status=Qt}if(n.status===Qt){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(B(e),n.pending!==0))return n.last_flush=-1,F;A(n,e.adler&255),A(n,e.adler>>8&255),e.adler=0}if(n.status=xe,B(e),n.pending!==0)return n.last_flush=-1,F}if(e.avail_in!==0||n.lookahead!==0||t!==me&&n.status!==We){let a=n.level===0?Tr(n,t):n.strategy===yt?si(n,t):n.strategy===Pa?ii(n,t):qe[n.level].func(n,t);if((a===Se||a===Pe)&&(n.status=We),a===j||a===Se)return e.avail_out===0&&(n.last_flush=-1),F;if(a===Ue&&(t===Da?La(n):t!==jn&&(Gt(n,0,0,!1),t===ja&&(he(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),B(e),e.avail_out===0))return n.last_flush=-1,F}return t!==q?F:n.wrap<=0?Mn:(n.wrap===2?(A(n,e.adler&255),A(n,e.adler>>8&255),A(n,e.adler>>16&255),A(n,e.adler>>24&255),A(n,e.total_in&255),A(n,e.total_in>>8&255),A(n,e.total_in>>16&255),A(n,e.total_in>>24&255)):(He(n,e.adler>>>16),He(n,e.adler&65535)),B(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?F:Mn)},fi=e=>{if(ct(e))return te;const t=e.state.status;return e.state=null,t===xe?ke(e,Ma):F},hi=(e,t)=>{let n=t.length;if(ct(e))return te;const r=e.state,a=r.wrap;if(a===2||a===1&&r.status!==Ie||r.lookahead)return te;if(a===1&&(e.adler=xr(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){a===0&&(he(r.head),r.strstart=0,r.block_start=0,r.insert=0);let c=new Uint8Array(r.w_size);c.set(t.subarray(n-r.w_size,n),0),t=c,n=r.w_size}const i=e.avail_in,s=e.next_in,o=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Ze(r);r.lookahead>=x;){let c=r.strstart,l=r.lookahead-(x-1);do r.ins_h=ge(r,r.ins_h,r.window[c+x-1]),r.prev[c&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=c,c++;while(--l);r.strstart=c,r.lookahead=x-1,Ze(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=x-1,r.match_available=0,e.next_in=s,e.input=o,e.avail_in=i,r.wrap=a,F};var _i=di,pi=Cr,mi=Ar,gi=Er,yi=ci,vi=ui,bi=fi,wi=hi,xi="pako deflate (from Nodeca project)",Xe={deflateInit:_i,deflateInit2:pi,deflateReset:mi,deflateResetKeep:gi,deflateSetHeader:yi,deflate:vi,deflateEnd:bi,deflateSetDictionary:wi,deflateInfo:xi};const ki=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Si=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)ki(n,r)&&(e[r]=n[r])}}return e},Ti=e=>{let t=0;for(let r=0,a=e.length;r<a;r++)t+=e[r].length;const n=new Uint8Array(t);for(let r=0,a=0,i=e.length;r<i;r++){let s=e[r];n.set(s,a),a+=s.length}return n},Or={assign:Si,flattenChunks:Ti};let Rr=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Rr=!1}const nt=new Uint8Array(256);for(let e=0;e<256;e++)nt[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;nt[254]=nt[254]=1;var Ei=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,a,i,s=e.length,o=0;for(a=0;a<s;a++)n=e.charCodeAt(a),(n&64512)===55296&&a+1<s&&(r=e.charCodeAt(a+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),a++)),o+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(o),i=0,a=0;i<o;a++)n=e.charCodeAt(a),(n&64512)===55296&&a+1<s&&(r=e.charCodeAt(a+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),a++)),n<128?t[i++]=n:n<2048?(t[i++]=192|n>>>6,t[i++]=128|n&63):n<65536?(t[i++]=224|n>>>12,t[i++]=128|n>>>6&63,t[i++]=128|n&63):(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63,t[i++]=128|n>>>6&63,t[i++]=128|n&63);return t};const Ai=(e,t)=>{if(t<65534&&e.subarray&&Rr)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var Ci=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,a;const i=new Array(n*2);for(a=0,r=0;r<n;){let s=e[r++];if(s<128){i[a++]=s;continue}let o=nt[s];if(o>4){i[a++]=65533,r+=o-1;continue}for(s&=o===2?31:o===3?15:7;o>1&&r<n;)s=s<<6|e[r++]&63,o--;if(o>1){i[a++]=65533;continue}s<65536?i[a++]=s:(s-=65536,i[a++]=55296|s>>10&1023,i[a++]=56320|s&1023)}return Ai(i,a)},Oi=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+nt[e[n]]>t?n:t},Nr={string2buf:Ei,buf2string:Ci,utf8border:Oi};function Ri(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Ni=Ri;const Ir=Object.prototype.toString,{Z_NO_FLUSH:Ii,Z_SYNC_FLUSH:Zi,Z_FULL_FLUSH:zi,Z_FINISH:Fi,Z_OK:At,Z_STREAM_END:Li,Z_DEFAULT_COMPRESSION:Di,Z_DEFAULT_STRATEGY:ji,Z_DEFLATED:Mi}=kr;function Ft(e){this.options=Or.assign({level:Di,method:Mi,chunkSize:16384,windowBits:15,memLevel:8,strategy:ji},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ni,this.strm.avail_out=0;let n=Xe.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==At)throw new Error(Et[n]);if(t.header&&Xe.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=Nr.string2buf(t.dictionary):Ir.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=Xe.deflateSetDictionary(this.strm,r),n!==At)throw new Error(Et[n]);this._dict_set=!0}}Ft.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let a,i;if(this.ended)return!1;for(t===~~t?i=t:i=t===!0?Fi:Ii,typeof e=="string"?n.input=Nr.string2buf(e):Ir.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(i===Zi||i===zi)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(a=Xe.deflate(n,i),a===Li)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),a=Xe.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===At;if(n.avail_out===0){this.onData(n.output);continue}if(i>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};Ft.prototype.onData=function(e){this.chunks.push(e)};Ft.prototype.onEnd=function(e){e===At&&(this.result=Or.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function $i(e,t){const n=new Ft(t);if(n.push(e,!0),n.err)throw n.msg||Et[n.err];return n.result}function Ui(e,t){return t=t||{},t.gzip=!0,$i(e,t)}var Pi=Ui,Bi={gzip:Pi};const{gzip:Vi}=Bi;var Hi=Vi;class ue extends Error{constructor({name:t,reason:n,status:r,detail:a}){super(),this.name=t,this.message=n,this.detail=a,this.status=r}}class Zr extends Error{constructor(){super("Malformatted Figma Token")}}class zr extends Error{constructor(){super("Missing Figma Token")}}class tn extends Error{constructor(){super("Needs Reauth Figma Token")}}class nn extends Error{constructor(){super("Expired Figma Token")}}class rn extends Error{constructor(){super("File Not Exportable")}}class an extends Error{constructor({reason:t}){super("Unknown Forbidden Figma Error"),this.reason=t}}const Fr="Not Found";class Lr extends Error{constructor({cause:t}){super(Fr),this.cause=t}}const Wi=e=>e.message===Fr,Dr="Unknown Figma API Exception";class jr extends Error{constructor({cause:t}){super(Dr),this.cause=t}}const qi=e=>e.message===Dr,Mr="Rate Limit Exceeded";class sn extends Error{constructor({cause:t}){super(Mr),this.cause=t}}const Gi=e=>e.message===Mr,$r="Request Too Large";class Ur extends Error{constructor({cause:t}){super($r),this.cause=t}}const Ji=e=>e.message===$r;var E;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,e.arrayToEnum=a=>{const i={};for(const s of a)i[s]=s;return i},e.getValidEnumValues=a=>{const i=e.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(const o of i)s[o]=a[o];return e.objectValues(s)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},e.find=(a,i)=>{for(const s of a)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(E||(E={}));var Un;(function(e){e.mergeShapes=(t,n)=>d(d({},t),n)})(Un||(Un={}));const _=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fe=e=>{switch(typeof e){case"undefined":return _.undefined;case"string":return _.string;case"number":return Number.isNaN(e)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(e)?_.array:e===null?_.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?_.promise:typeof Map!="undefined"&&e instanceof Map?_.map:typeof Set!="undefined"&&e instanceof Set?_.set:typeof Date!="undefined"&&e instanceof Date?_.date:_.object;default:return _.unknown}},u=E.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"]);class ce extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},a=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,c=0;for(;c<s.path.length;){const l=s.path[c];c===s.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(n(s))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return a(this),r}static assert(t){if(!(t instanceof ce))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];n[i]=n[i]||[],n[i].push(t(a))}else r.push(t(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ce.create=e=>new ce(e);const on=(e,t)=>{let n;switch(e.code){case u.invalid_type:e.received===_.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case u.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,E.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:n=`Unrecognized key(s) in object: ${E.joinValues(e.keys,", ")}`;break;case u.invalid_union:n="Invalid input";break;case u.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${E.joinValues(e.options)}`;break;case u.invalid_enum_value:n=`Invalid enum value. Expected ${E.joinValues(e.options)}, received '${e.received}'`;break;case u.invalid_arguments:n="Invalid function arguments";break;case u.invalid_return_type:n="Invalid function return type";break;case u.invalid_date:n="Invalid date";break;case u.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:E.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case u.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case u.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case u.custom:n="Invalid input";break;case u.invalid_intersection_types:n="Intersection results could not be merged";break;case u.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case u.not_finite:n="Number must be finite";break;default:n=t.defaultError,E.assertNever(e)}return{message:n}};let Ki=on;function Xi(){return Ki}const Yi=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,i=[...n,...a.path||[]],s=v(d({},a),{path:i});if(a.message!==void 0)return v(d({},a),{path:i,message:a.message});let o="";const c=r.filter(l=>!!l).slice().reverse();for(const l of c)o=l(s,{data:t,defaultError:o}).message;return v(d({},a),{path:i,message:o})};function f(e,t){const n=Xi(),r=Yi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===on?void 0:on].filter(a=>!!a)});e.common.issues.push(r)}class M{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const a of n){if(a.status==="aborted")return g;a.status==="dirty"&&t.dirty(),r.push(a.value)}return{status:t.value,value:r}}static mergeObjectAsync(t,n){return C(this,null,function*(){const r=[];for(const a of n){const i=yield a.key,s=yield a.value;r.push({key:i,value:s})}return M.mergeObjectSync(t,r)})}static mergeObjectSync(t,n){const r={};for(const a of n){const{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return g;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||a.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}}const g=Object.freeze({status:"aborted"}),Ge=e=>({status:"dirty",value:e}),G=e=>({status:"valid",value:e}),Pn=e=>e.status==="aborted",Bn=e=>e.status==="dirty",ze=e=>e.status==="valid",Ct=e=>typeof Promise!="undefined"&&e instanceof Promise;var p;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(p||(p={}));class ae{constructor(t,n,r,a){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Vn=(e,t)=>{if(ze(t))return{success:!0,data:t.value};if(!e.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 ce(e.common.issues);return this._error=n,this._error}}};function b(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(s,o)=>{var l,h;const{message:c}=e;return s.code==="invalid_enum_value"?{message:c!=null?c:o.defaultError}:typeof o.data=="undefined"?{message:(l=c!=null?c:r)!=null?l:o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:(h=c!=null?c:n)!=null?h:o.defaultError}},description:a}}class k{get description(){return this._def.description}_getType(t){return fe(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:fe(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new M,ctx:{common:t.parent.common,data:t.data,parsedType:fe(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Ct(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var i;const r={common:{issues:[],async:(i=n==null?void 0:n.async)!=null?i:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fe(t)},a=this._parseSync({data:t,path:r.path,parent:r});return Vn(r,a)}"~validate"(t){var r,a;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fe(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return ze(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(a=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>ze(i)?{value:i.value}:{issues:n.common.issues})}parseAsync(t,n){return C(this,null,function*(){const r=yield this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error})}safeParseAsync(t,n){return C(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:t,parsedType:fe(t)},a=this._parse({data:t,path:r.path,parent:r}),i=yield Ct(a)?a:Promise.resolve(a);return Vn(r,i)})}refine(t,n){const r=a=>typeof n=="string"||typeof n=="undefined"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,i)=>{const s=t(a),o=()=>i.addIssue(d({code:u.custom},r(a)));return typeof Promise!="undefined"&&s instanceof Promise?s.then(c=>c?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(t,n){return this._refinement((r,a)=>t(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(t){return new De({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 ye.create(this,this._def)}nullable(){return je.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return re.create(this)}promise(){return Zt.create(this,this._def)}or(t){return Rt.create([this,t],this._def)}and(t){return Nt.create(this,t,this._def)}transform(t){return new De(v(d({},b(this._def)),{schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:t}}))}default(t){const n=typeof t=="function"?t:()=>t;return new fn(v(d({},b(this._def)),{innerType:this,defaultValue:n,typeName:m.ZodDefault}))}brand(){return new ws(d({typeName:m.ZodBranded,type:this},b(this._def)))}catch(t){const n=typeof t=="function"?t:()=>t;return new hn(v(d({},b(this._def)),{innerType:this,catchValue:n,typeName:m.ZodCatch}))}describe(t){const n=this.constructor;return new n(v(d({},this._def),{description:t}))}pipe(t){return Sn.create(this,t)}readonly(){return _n.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Qi=/^c[^\s-]{8,}$/i,es=/^[0-9a-z]+$/,ts=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ns=/^[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,rs=/^[a-z0-9_-]{21}$/i,as=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,is=/^[-+]?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)?)??$/,ss=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,os="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Vt;const ls=/^(?:(?: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])$/,cs=/^(?:(?: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])$/,ds=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,us=/^(([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])$/,fs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Pr="((\\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])))",_s=new RegExp(`^${Pr}$`);function Br(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function ps(e){return new RegExp(`^${Br(e)}$`)}function ms(e){let t=`${Pr}T${Br(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function gs(e,t){return!!((t==="v4"||!t)&&ls.test(e)||(t==="v6"||!t)&&ds.test(e))}function ys(e,t){if(!as.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||t&&a.alg!==t)}catch(n){return!1}}function vs(e,t){return!!((t==="v4"||!t)&&cs.test(e)||(t==="v6"||!t)&&us.test(e))}class le extends k{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==_.string){const i=this._getOrReturnCtx(t);return f(i,{code:u.invalid_type,expected:_.string,received:i.parsedType}),g}const r=new M;let a;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(a=this._getOrReturnCtx(t,a),f(a,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(a=this._getOrReturnCtx(t,a),f(a,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=t.data.length>i.value,o=t.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(t,a),s?f(a,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&f(a,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")ss.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"email",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Vt||(Vt=new RegExp(os,"u")),Vt.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"emoji",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")ns.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"uuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")rs.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"nanoid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Qi.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"cuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")es.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"cuid2",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")ts.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"ulid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch(s){a=this._getOrReturnCtx(t,a),f(a,{validation:"url",code:u.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"regex",code:u.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?ms(i).test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?_s.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?ps(i).test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?is.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"duration",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?gs(t.data,i.version)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"ip",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?ys(t.data,i.alg)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"jwt",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?vs(t.data,i.version)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"cidr",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?fs.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"base64",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?hs.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"base64url",code:u.invalid_string,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(a=>t.test(a),d({validation:n,code:u.invalid_string},p.errToObj(r)))}_addCheck(t){return new le(v(d({},this._def),{checks:[...this._def.checks,t]}))}email(t){return this._addCheck(d({kind:"email"},p.errToObj(t)))}url(t){return this._addCheck(d({kind:"url"},p.errToObj(t)))}emoji(t){return this._addCheck(d({kind:"emoji"},p.errToObj(t)))}uuid(t){return this._addCheck(d({kind:"uuid"},p.errToObj(t)))}nanoid(t){return this._addCheck(d({kind:"nanoid"},p.errToObj(t)))}cuid(t){return this._addCheck(d({kind:"cuid"},p.errToObj(t)))}cuid2(t){return this._addCheck(d({kind:"cuid2"},p.errToObj(t)))}ulid(t){return this._addCheck(d({kind:"ulid"},p.errToObj(t)))}base64(t){return this._addCheck(d({kind:"base64"},p.errToObj(t)))}base64url(t){return this._addCheck(d({kind:"base64url"},p.errToObj(t)))}jwt(t){return this._addCheck(d({kind:"jwt"},p.errToObj(t)))}ip(t){return this._addCheck(d({kind:"ip"},p.errToObj(t)))}cidr(t){return this._addCheck(d({kind:"cidr"},p.errToObj(t)))}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck(d({kind:"datetime",precision:typeof(t==null?void 0:t.precision)=="undefined"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!=null?n:!1,local:(r=t==null?void 0:t.local)!=null?r:!1},p.errToObj(t==null?void 0:t.message)))}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck(d({kind:"time",precision:typeof(t==null?void 0:t.precision)=="undefined"?null:t==null?void 0:t.precision},p.errToObj(t==null?void 0:t.message)))}duration(t){return this._addCheck(d({kind:"duration"},p.errToObj(t)))}regex(t,n){return this._addCheck(d({kind:"regex",regex:t},p.errToObj(n)))}includes(t,n){return this._addCheck(d({kind:"includes",value:t,position:n==null?void 0:n.position},p.errToObj(n==null?void 0:n.message)))}startsWith(t,n){return this._addCheck(d({kind:"startsWith",value:t},p.errToObj(n)))}endsWith(t,n){return this._addCheck(d({kind:"endsWith",value:t},p.errToObj(n)))}min(t,n){return this._addCheck(d({kind:"min",value:t},p.errToObj(n)))}max(t,n){return this._addCheck(d({kind:"max",value:t},p.errToObj(n)))}length(t,n){return this._addCheck(d({kind:"length",value:t},p.errToObj(n)))}nonempty(t){return this.min(1,p.errToObj(t))}trim(){return new le(v(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new le(v(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new le(v(d({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}le.create=e=>{var t;return new le(d({checks:[],typeName:m.ZodString,coerce:(t=e==null?void 0:e.coerce)!=null?t:!1},b(e)))};function bs(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r,i=Number.parseInt(e.toFixed(a).replace(".","")),s=Number.parseInt(t.toFixed(a).replace(".",""));return i%s/Rn(10,a)}class Fe extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==_.number){const i=this._getOrReturnCtx(t);return f(i,{code:u.invalid_type,expected:_.number,received:i.parsedType}),g}let r;const a=new M;for(const i of this._def.checks)i.kind==="int"?E.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{code:u.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?bs(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{code:u.not_finite,message:i.message}),a.dirty()):E.assertNever(i);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,p.toString(n))}gt(t,n){return this.setLimit("min",t,!1,p.toString(n))}lte(t,n){return this.setLimit("max",t,!0,p.toString(n))}lt(t,n){return this.setLimit("max",t,!1,p.toString(n))}setLimit(t,n,r,a){return new Fe(v(d({},this._def),{checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:p.toString(a)}]}))}_addCheck(t){return new Fe(v(d({},this._def),{checks:[...this._def.checks,t]}))}int(t){return this._addCheck({kind:"int",message:p.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:p.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:p.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&E.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Fe.create=e=>new Fe(d({checks:[],typeName:m.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1},b(e)));class rt extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch(i){return this._getInvalidInput(t)}if(this._getType(t)!==_.bigint)return this._getInvalidInput(t);let r;const a=new M;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):E.assertNever(i);return{status:a.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return f(n,{code:u.invalid_type,expected:_.bigint,received:n.parsedType}),g}gte(t,n){return this.setLimit("min",t,!0,p.toString(n))}gt(t,n){return this.setLimit("min",t,!1,p.toString(n))}lte(t,n){return this.setLimit("max",t,!0,p.toString(n))}lt(t,n){return this.setLimit("max",t,!1,p.toString(n))}setLimit(t,n,r,a){return new rt(v(d({},this._def),{checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:p.toString(a)}]}))}_addCheck(t){return new rt(v(d({},this._def),{checks:[...this._def.checks,t]}))}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:p.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}rt.create=e=>{var t;return new rt(d({checks:[],typeName:m.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!=null?t:!1},b(e)))};class ln extends k{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==_.boolean){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.boolean,received:r.parsedType}),g}return G(t.data)}}ln.create=e=>new ln(d({typeName:m.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1},b(e)));class Ot extends k{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==_.date){const i=this._getOrReturnCtx(t);return f(i,{code:u.invalid_type,expected:_.date,received:i.parsedType}),g}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return f(i,{code:u.invalid_date}),g}const r=new M;let a;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(a=this._getOrReturnCtx(t,a),f(a,{code:u.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(a=this._getOrReturnCtx(t,a),f(a,{code:u.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):E.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Ot(v(d({},this._def),{checks:[...this._def.checks,t]}))}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:p.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:p.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Ot.create=e=>new Ot(d({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:m.ZodDate},b(e)));class Hn extends k{_parse(t){if(this._getType(t)!==_.symbol){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.symbol,received:r.parsedType}),g}return G(t.data)}}Hn.create=e=>new Hn(d({typeName:m.ZodSymbol},b(e)));class Wn extends k{_parse(t){if(this._getType(t)!==_.undefined){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.undefined,received:r.parsedType}),g}return G(t.data)}}Wn.create=e=>new Wn(d({typeName:m.ZodUndefined},b(e)));class qn extends k{_parse(t){if(this._getType(t)!==_.null){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.null,received:r.parsedType}),g}return G(t.data)}}qn.create=e=>new qn(d({typeName:m.ZodNull},b(e)));class Gn extends k{constructor(){super(...arguments),this._any=!0}_parse(t){return G(t.data)}}Gn.create=e=>new Gn(d({typeName:m.ZodAny},b(e)));class cn extends k{constructor(){super(...arguments),this._unknown=!0}_parse(t){return G(t.data)}}cn.create=e=>new cn(d({typeName:m.ZodUnknown},b(e)));class ve extends k{_parse(t){const n=this._getOrReturnCtx(t);return f(n,{code:u.invalid_type,expected:_.never,received:n.parsedType}),g}}ve.create=e=>new ve(d({typeName:m.ZodNever},b(e)));class Jn extends k{_parse(t){if(this._getType(t)!==_.undefined){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.void,received:r.parsedType}),g}return G(t.data)}}Jn.create=e=>new Jn(d({typeName:m.ZodVoid},b(e)));class re extends k{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),a=this._def;if(n.parsedType!==_.array)return f(n,{code:u.invalid_type,expected:_.array,received:n.parsedType}),g;if(a.exactLength!==null){const s=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(s||o)&&(f(n,{code:s?u.too_big:u.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(f(n,{code:u.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(f(n,{code:u.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>a.type._parseAsync(new ae(n,s,n.path,o)))).then(s=>M.mergeArray(r,s));const i=[...n.data].map((s,o)=>a.type._parseSync(new ae(n,s,n.path,o)));return M.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new re(v(d({},this._def),{minLength:{value:t,message:p.toString(n)}}))}max(t,n){return new re(v(d({},this._def),{maxLength:{value:t,message:p.toString(n)}}))}length(t,n){return new re(v(d({},this._def),{exactLength:{value:t,message:p.toString(n)}}))}nonempty(t){return this.min(1,t)}}re.create=(e,t)=>new re(d({type:e,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray},b(t)));function Ce(e){if(e instanceof z){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ye.create(Ce(r))}return new z(v(d({},e._def),{shape:()=>t}))}else return e instanceof re?new re(v(d({},e._def),{type:Ce(e.element)})):e instanceof ye?ye.create(Ce(e.unwrap())):e instanceof je?je.create(Ce(e.unwrap())):e instanceof Te?Te.create(e.items.map(t=>Ce(t))):e}class z extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=E.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==_.object){const l=this._getOrReturnCtx(t);return f(l,{code:u.invalid_type,expected:_.object,received:l.parsedType}),g}const{status:r,ctx:a}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof ve&&this._def.unknownKeys==="strip"))for(const l in a.data)s.includes(l)||o.push(l);const c=[];for(const l of s){const h=i[l],T=a.data[l];c.push({key:{status:"valid",value:l},value:h._parse(new ae(a,T,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof ve){const l=this._def.unknownKeys;if(l==="passthrough")for(const h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:a.data[h]}});else if(l==="strict")o.length>0&&(f(a,{code:u.unrecognized_keys,keys:o}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const h of o){const T=a.data[h];c.push({key:{status:"valid",value:h},value:l._parse(new ae(a,T,a.path,h)),alwaysSet:h in a.data})}}return a.common.async?Promise.resolve().then(()=>C(this,null,function*(){const l=[];for(const h of c){const T=yield h.key,y=yield h.value;l.push({key:T,value:y,alwaysSet:h.alwaysSet})}return l})).then(l=>M.mergeObjectSync(r,l)):M.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return p.errToObj,new z(d(v(d({},this._def),{unknownKeys:"strict"}),t!==void 0?{errorMap:(n,r)=>{var i,s,o,c;const a=(o=(s=(i=this._def).errorMap)==null?void 0:s.call(i,n,r).message)!=null?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(c=p.errToObj(t).message)!=null?c:a}:{message:a}}}:{}))}strip(){return new z(v(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new z(v(d({},this._def),{unknownKeys:"passthrough"}))}extend(t){return new z(v(d({},this._def),{shape:()=>d(d({},this._def.shape()),t)}))}merge(t){return new z({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>d(d({},this._def.shape()),t._def.shape()),typeName:m.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new z(v(d({},this._def),{catchall:t}))}pick(t){const n={};for(const r of E.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new z(v(d({},this._def),{shape:()=>n}))}omit(t){const n={};for(const r of E.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new z(v(d({},this._def),{shape:()=>n}))}deepPartial(){return Ce(this)}partial(t){const n={};for(const r of E.objectKeys(this.shape)){const a=this.shape[r];t&&!t[r]?n[r]=a:n[r]=a.optional()}return new z(v(d({},this._def),{shape:()=>n}))}required(t){const n={};for(const r of E.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ye;)i=i._def.innerType;n[r]=i}return new z(v(d({},this._def),{shape:()=>n}))}keyof(){return Vr(E.objectKeys(this.shape))}}z.create=(e,t)=>new z(d({shape:()=>e,unknownKeys:"strip",catchall:ve.create(),typeName:m.ZodObject},b(t)));z.strictCreate=(e,t)=>new z(d({shape:()=>e,unknownKeys:"strict",catchall:ve.create(),typeName:m.ZodObject},b(t)));z.lazycreate=(e,t)=>new z(d({shape:e,unknownKeys:"strip",catchall:ve.create(),typeName:m.ZodObject},b(t)));class Rt extends k{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function a(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const s=i.map(o=>new ce(o.ctx.common.issues));return f(n,{code:u.invalid_union,unionErrors:s}),g}if(n.common.async)return Promise.all(r.map(i=>C(this,null,function*(){const s=v(d({},n),{common:v(d({},n.common),{issues:[]}),parent:null});return{result:yield i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}}))).then(a);{let i;const s=[];for(const c of r){const l=v(d({},n),{common:v(d({},n.common),{issues:[]}),parent:null}),h=c._parseSync({data:n.data,path:n.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const o=s.map(c=>new ce(c));return f(n,{code:u.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}}Rt.create=(e,t)=>new Rt(d({options:e,typeName:m.ZodUnion},b(t)));function dn(e,t){const n=fe(e),r=fe(t);if(e===t)return{valid:!0,data:e};if(n===_.object&&r===_.object){const a=E.objectKeys(t),i=E.objectKeys(e).filter(o=>a.indexOf(o)!==-1),s=d(d({},e),t);for(const o of i){const c=dn(e[o],t[o]);if(!c.valid)return{valid:!1};s[o]=c.data}return{valid:!0,data:s}}else if(n===_.array&&r===_.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let i=0;i<e.length;i++){const s=e[i],o=t[i],c=dn(s,o);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return n===_.date&&r===_.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Nt extends k{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),a=(i,s)=>{if(Pn(i)||Pn(s))return g;const o=dn(i.value,s.value);return o.valid?((Bn(i)||Bn(s))&&n.dirty(),{status:n.value,value:o.data}):(f(r,{code:u.invalid_intersection_types}),g)};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(([i,s])=>a(i,s)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Nt.create=(e,t,n)=>new Nt(d({left:e,right:t,typeName:m.ZodIntersection},b(n)));class Te extends k{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_.array)return f(r,{code:u.invalid_type,expected:_.array,received:r.parsedType}),g;if(r.data.length<this._def.items.length)return f(r,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&r.data.length>this._def.items.length&&(f(r,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new ae(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>M.mergeArray(n,s)):M.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Te(v(d({},this._def),{rest:t}))}}Te.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Te(d({items:e,typeName:m.ZodTuple,rest:null},b(t)))};class It extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_.object)return f(r,{code:u.invalid_type,expected:_.object,received:r.parsedType}),g;const a=[],i=this._def.keyType,s=this._def.valueType;for(const o in r.data)a.push({key:i._parse(new ae(r,o,r.path,o)),value:s._parse(new ae(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?M.mergeObjectAsync(n,a):M.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof k?new It(d({keyType:t,valueType:n,typeName:m.ZodRecord},b(r))):new It(d({keyType:le.create(),valueType:t,typeName:m.ZodRecord},b(n)))}}class Kn extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_.map)return f(r,{code:u.invalid_type,expected:_.map,received:r.parsedType}),g;const a=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([o,c],l)=>({key:a._parse(new ae(r,o,r.path,[l,"key"])),value:i._parse(new ae(r,c,r.path,[l,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(()=>C(this,null,function*(){for(const c of s){const l=yield c.key,h=yield c.value;if(l.status==="aborted"||h.status==="aborted")return g;(l.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(l.value,h.value)}return{status:n.value,value:o}}))}else{const o=new Map;for(const c of s){const l=c.key,h=c.value;if(l.status==="aborted"||h.status==="aborted")return g;(l.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(l.value,h.value)}return{status:n.value,value:o}}}}Kn.create=(e,t,n)=>new Kn(d({valueType:t,keyType:e,typeName:m.ZodMap},b(n)));class at extends k{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_.set)return f(r,{code:u.invalid_type,expected:_.set,received:r.parsedType}),g;const a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(f(r,{code:u.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(f(r,{code:u.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const i=this._def.valueType;function s(c){const l=new Set;for(const h of c){if(h.status==="aborted")return g;h.status==="dirty"&&n.dirty(),l.add(h.value)}return{status:n.value,value:l}}const o=[...r.data.values()].map((c,l)=>i._parse(new ae(r,c,r.path,l)));return r.common.async?Promise.all(o).then(c=>s(c)):s(o)}min(t,n){return new at(v(d({},this._def),{minSize:{value:t,message:p.toString(n)}}))}max(t,n){return new at(v(d({},this._def),{maxSize:{value:t,message:p.toString(n)}}))}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}at.create=(e,t)=>new at(d({valueType:e,minSize:null,maxSize:null,typeName:m.ZodSet},b(t)));class Xn extends k{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Xn.create=(e,t)=>new Xn(d({getter:e,typeName:m.ZodLazy},b(t)));class un extends k{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return f(n,{received:n.data,code:u.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:t.data}}get value(){return this._def.value}}un.create=(e,t)=>new un(d({value:e,typeName:m.ZodLiteral},b(t)));function Vr(e,t){return new Le(d({values:e,typeName:m.ZodEnum},b(t)))}class Le extends k{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return f(n,{expected:E.joinValues(r),received:n.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return f(n,{received:n.data,code:u.invalid_enum_value,options:r}),g}return G(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Le.create(t,d(d({},this._def),n))}exclude(t,n=this._def){return Le.create(this.options.filter(r=>!t.includes(r)),d(d({},this._def),n))}}Le.create=Vr;class Yn extends k{_parse(t){const n=E.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==_.string&&r.parsedType!==_.number){const a=E.objectValues(n);return f(r,{expected:E.joinValues(a),received:r.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(E.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const a=E.objectValues(n);return f(r,{received:r.data,code:u.invalid_enum_value,options:a}),g}return G(t.data)}get enum(){return this._def.values}}Yn.create=(e,t)=>new Yn(d({values:e,typeName:m.ZodNativeEnum},b(t)));class Zt extends k{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_.promise&&n.common.async===!1)return f(n,{code:u.invalid_type,expected:_.promise,received:n.parsedType}),g;const r=n.parsedType===_.promise?n.data:Promise.resolve(n.data);return G(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Zt.create=(e,t)=>new Zt(d({type:e,typeName:m.ZodPromise},b(t)));class De extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),a=this._def.effect||null,i={addIssue:s=>{f(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const s=a.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(o=>C(this,null,function*(){if(n.value==="aborted")return g;const c=yield this._def.schema._parseAsync({data:o,path:r.path,parent:r});return c.status==="aborted"?g:c.status==="dirty"||n.value==="dirty"?Ge(c.value):c}));{if(n.value==="aborted")return g;const o=this._def.schema._parseSync({data:s,path:r.path,parent:r});return o.status==="aborted"?g:o.status==="dirty"||n.value==="dirty"?Ge(o.value):o}}if(a.type==="refinement"){const s=o=>{const c=a.refinement(o,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?g:(o.status==="dirty"&&n.dirty(),s(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"?g:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ze(s))return g;const o=a.transform(s.value,i);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(s=>ze(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:n.value,value:o})):g);E.assertNever(a)}}De.create=(e,t,n)=>new De(d({schema:e,typeName:m.ZodEffects,effect:t},b(n)));De.createWithPreprocess=(e,t,n)=>new De(d({schema:t,effect:{type:"preprocess",transform:e},typeName:m.ZodEffects},b(n)));class ye extends k{_parse(t){return this._getType(t)===_.undefined?G(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ye.create=(e,t)=>new ye(d({innerType:e,typeName:m.ZodOptional},b(t)));class je extends k{_parse(t){return this._getType(t)===_.null?G(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}je.create=(e,t)=>new je(d({innerType:e,typeName:m.ZodNullable},b(t)));class fn extends k{_parse(t){const{ctx:n}=this._processInputParams(t);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}}fn.create=(e,t)=>new fn(d({innerType:e,typeName:m.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default},b(t)));class hn extends k{_parse(t){const{ctx:n}=this._processInputParams(t),r=v(d({},n),{common:v(d({},n.common),{issues:[]})}),a=this._def.innerType._parse({data:r.data,path:r.path,parent:d({},r)});return Ct(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ce(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ce(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}hn.create=(e,t)=>new hn(d({innerType:e,typeName:m.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch},b(t)));class Qn extends k{_parse(t){if(this._getType(t)!==_.nan){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.nan,received:r.parsedType}),g}return{status:"valid",value:t.data}}}Qn.create=e=>new Qn(d({typeName:m.ZodNaN},b(e)));class ws extends k{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Sn extends k{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return C(this,null,function*(){const i=yield this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?g:i.status==="dirty"?(n.dirty(),Ge(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})});{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?g:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(t,n){return new Sn({in:t,out:n,typeName:m.ZodPipeline})}}class _n extends k{_parse(t){const n=this._def.innerType._parse(t),r=a=>(ze(a)&&(a.value=Object.freeze(a.value)),a);return Ct(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}}_n.create=(e,t)=>new _n(d({innerType:e,typeName:m.ZodReadonly},b(t)));var m;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(m||(m={}));const vt=le.create,xs=Fe.create,J=ln.create,ks=cn.create;ve.create;const er=re.create,bt=z.create,Ss=Rt.create;Nt.create;Te.create;const Ts=It.create,tr=un.create,wt=Le.create;Zt.create;ye.create;je.create;const Es=bt({language:wt(["typescript","javascript"]).optional(),disableMarkedForExport:J().optional(),allowAutoSelectFirstNode:J().optional().default(!0),enableDisplayDataId:J().optional(),enableDisplayDataName:J().optional()}).and(Ss([bt({framework:tr("react"),model:vt().optional(),styling:wt(["plain_css","tailwind","inline_styles"]),uiLibrary:wt(["mui","antd","radix","shadcn","clean_react","custom_design_system"]).optional(),responsivePages:er(bt({name:vt(),framesId:er(vt())})).optional(),enableUILibraryTheming:J().optional(),enableCompactStructure:J().optional(),enableDisplayScreenModelId:J().optional(),enableGeneratePackageLock:J().optional(),enableAnimationsPreset:J().optional(),enableAutoSplit:J().optional(),autoSplitThreshold:xs().optional(),url:vt().url().optional(),codegenSettings:Ts(ks()).optional()}),bt({framework:tr("html"),styling:wt(["plain_css","inline_styles","tailwind"]),enableTranslation:J().optional()})])),Hr=e=>{const t=Es.safeParse(e);if(t.success===!1){const n=new Error("Invalid codegen settings");throw n.cause=t.error,n}return t.data},Tn=(e,t)=>{if(e.id===t)return e;if("children"in e)for(const n of e.children){const r=Tn(n,t);if(r)return r}return null},nr=new Set(["FRAME","INSTANCE","COMPONENT","COMPONENT_SET","GROUP"]),Wr=(e,t,n={allowAutoSelectFirstNode:!0})=>{const r=Tn(e.document,t);if(!r)return{isValid:!1,reason:"There is no node with the given id"};if(r.type==="CANVAS"){const a=r.children.filter(i=>nr.has(i.type));return a.length===0?{isValid:!1,reason:"Selected node is a page with no valid children"}:a.length===1?{isValid:!0,node:a[0],note:"Selected node is a page with a single valid children - returning it instead"}:n.allowAutoSelectFirstNode?{isValid:!0,node:a[0],note:"Selected node is a page with multiple valid children - returning the first one instead"}:{isValid:!1,reason:"Selected node is a page with multiple children"}}return nr.has(r.type)?{isValid:!0,node:r}:{isValid:!1,reason:"Selected node type is not supported"}};function As(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kt={exports:{}},Cs=kt.exports,rr;function Os(){return rr||(rr=1,(function(e,t){(function(n,r){e.exports=r()})(Cs,(function(){var n=typeof Promise=="function",r=(function(R){if(typeof globalThis=="object")return globalThis;Object.defineProperty(R,"typeDetectGlobalObject",{get:function(){return this},configurable:!0});var be=typeDetectGlobalObject;return delete R.typeDetectGlobalObject,be})(Object.prototype),a=typeof Symbol!="undefined",i=typeof Map!="undefined",s=typeof Set!="undefined",o=typeof WeakMap!="undefined",c=typeof WeakSet!="undefined",l=typeof DataView!="undefined",h=a&&typeof Symbol.iterator!="undefined",T=a&&typeof Symbol.toStringTag!="undefined",y=s&&typeof Set.prototype.entries=="function",N=i&&typeof Map.prototype.entries=="function",I=y&&Object.getPrototypeOf(new Set().entries()),P=N&&Object.getPrototypeOf(new Map().entries()),Be=h&&typeof Array.prototype[Symbol.iterator]=="function",ft=Be&&Object.getPrototypeOf([][Symbol.iterator]()),Ve=h&&typeof String.prototype[Symbol.iterator]=="function",ht=Ve&&Object.getPrototypeOf(""[Symbol.iterator]()),_t=8,pt=-1;function mt(R){var be=typeof R;if(be!=="object")return be;if(R===null)return"null";if(R===r)return"global";if(Array.isArray(R)&&(T===!1||!(Symbol.toStringTag in R)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&R===window.location)return"Location";if(typeof window.document=="object"&&R===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&R===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&R===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&R instanceof window.HTMLElement){if(R.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(R.tagName==="TD")return"HTMLTableDataCellElement";if(R.tagName==="TH")return"HTMLTableHeaderCellElement"}}var Ee=T&&R[Symbol.toStringTag];if(typeof Ee=="string")return Ee;var Z=Object.getPrototypeOf(R);return Z===RegExp.prototype?"RegExp":Z===Date.prototype?"Date":n&&Z===Promise.prototype?"Promise":s&&Z===Set.prototype?"Set":i&&Z===Map.prototype?"Map":c&&Z===WeakSet.prototype?"WeakSet":o&&Z===WeakMap.prototype?"WeakMap":l&&Z===DataView.prototype?"DataView":i&&Z===P?"Map Iterator":s&&Z===I?"Set Iterator":Be&&Z===ft?"Array Iterator":Ve&&Z===ht?"String Iterator":Z===null?"Object":Object.prototype.toString.call(R).slice(_t,pt)}return mt}))})(kt)),kt.exports}var Rs=Os();const Ns=As(Rs),En=typeof Buffer!="undefined",Is=En&&typeof Buffer.from!="undefined",Zs=En?function(t){return Buffer.isBuffer(t)}:function(){return!1},zs=Is?function(t){return Buffer.from(t)}:En?function(t){return new Buffer(t)}:function(t){return t};function Me(e){return Zs(e)?"Buffer":Ns(e)}const Fs=new Set(["Arguments","Array","Map","Object","Set"]);function Ls(e,t,n=null){switch(n||Me(e)){case"Arguments":case"Array":case"Object":return e[t];case"Map":return e.get(t);case"Set":return t}}function pn(e){return Fs.has(e)}function ar(e,t,n,r=null){switch(r||Me(e)){case"Arguments":case"Array":case"Object":e[t]=n;break;case"Map":e.set(t,n);break;case"Set":e.add(n);break}return e}const Ds=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,js=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,Ms=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,Ht=Ds||js||Ms||Function("return this")();function $s(e){return e.slice(0)}function Us(e){return new Boolean(e.valueOf())}function Ps(e){return new DataView(e.buffer)}function Bs(e){return zs(e)}function Vs(e){return new Date(e.getTime())}function Hs(e){return new Number(e)}function Ws(e){return new RegExp(e.source,e.flags)}function qs(e){return new String(e)}function ie(e,t){return Ht[t].from?Ht[t].from(e):new Ht[t](e)}function D(e){return e}function ir(){return[]}function Gs(){return new Map}function Js(){return{}}function Ks(){return new Set}const Xs=new Map([["ArrayBuffer",$s],["Boolean",Us],["Buffer",Bs],["DataView",Ps],["Date",Vs],["Number",Hs],["RegExp",Ws],["String",qs],["Float32Array",ie],["Float64Array",ie],["Int16Array",ie],["Int32Array",ie],["Int8Array",ie],["Uint16Array",ie],["Uint32Array",ie],["Uint8Array",ie],["Uint8ClampedArray",ie],["Array Iterator",D],["Map Iterator",D],["Promise",D],["Set Iterator",D],["String Iterator",D],["function",D],["global",D],["WeakMap",D],["WeakSet",D],["boolean",D],["null",D],["number",D],["string",D],["symbol",D],["undefined",D],["Arguments",ir],["Array",ir],["Map",Gs],["Object",Js],["Set",Ks]]);function Ys(){}function mn(e,t=null,n=Ys){arguments.length===2&&typeof t=="function"&&(n=t,t=null);const r=t||Me(e),a=Xs.get(r);if(r==="Object"){const i=n(e,r);if(i!==void 0)return i}return a?a(e,r):e}function sr(e,t={}){typeof t=="function"&&(t={customizer:t});const{customizer:n}=t,r=Me(e);if(!pn(r))return gn(e,null,null,null);const a=mn(e,r,n),i=new WeakMap([[e,a]]),s=new WeakSet([e]);return gn(e,a,i,s)}function gn(e,t,n,r,a){const i=Me(e),s=mn(e,i);if(!pn(i))return s;let o;switch(i){case"Arguments":case"Array":o=Object.keys(e);break;case"Object":o=Object.keys(e),o.push(...Object.getOwnPropertySymbols(e));break;case"Map":case"Set":o=e.keys();break}for(let c of o){const l=Ls(e,c,i);if(r.has(l))ar(t,c,n.get(l),i);else{const h=Me(l),T=mn(l,h);pn(h)&&(n.set(l,T),r.add(l)),ar(t,c,gn(l,T,n,r),i)}}return t}var it,Ne,oe,W,U,yn,St,Je;class qr{constructor({fetch:t=globalThis.fetch.bind(globalThis),baseAddress:n="https://api.figma.com/",defaultOptions:r={}}={}){X(this,U);X(this,it);X(this,Ne);X(this,oe);X(this,W);H(this,it,n),H(this,Ne,t),H(this,W,r),H(this,oe,w(this,W)),r.token&&L(this,U,yn).call(this,r.token)}hasDefaultToken(){return!!w(this,W).token}updateDefaultOptions(t){t.token&&L(this,U,yn).call(this,t.token),H(this,W,d(d({},w(this,W)),t)),H(this,oe,w(this,W))}withOptions(t){return H(this,oe,d(d(d({},w(this,W)),w(this,oe)),t)),this}getHeaders(t){const n={"Content-Type":"application/json"},r=t!=null?t:w(this,W).token;if(r!=null&&r.startsWith("figd_"))n["X-FIGMA-TOKEN"]=r;else if(r!=null&&r.startsWith("figu_"))n.Authorization=`Bearer ${r}`;else throw new zr;return n}getFile(a){return C(this,arguments,function*({fileKey:t,nodeIds:n=[],depth:r}){const i=new URLSearchParams({plugin_data:"857346721138427857",geometry:"paths"});n.length>0&&i.append("ids",n.join(",")),r&&i.append("depth",`${r}`);const s=i.toString(),o=`v1/files/${t}?${s}`;return yield L(this,U,Je).call(this,o)})}getNodeImages(s){return C(this,arguments,function*({fileKey:t,nodeIds:n,scale:r=1,as:a="arrayBuffer",format:i="jpg"}){const c=(yield L(this,U,Je).call(this,`v1/images/${t}?ids=${n}&format=${i}&scale=${r}`)).images;if(a==="links")return c;const l=n.map(y=>C(this,null,function*(){const N=c[y];if(!N)return null;const I=yield w(this,Ne).call(this,N);return I.ok?yield I.arrayBuffer():null})),h=yield Promise.allSettled(l);return n.reduce((y,N,I)=>{const P=h[I];return P.status==="fulfilled"?y[N]=P.value:y[N]=null,y},{})})}getImageFills(n){return C(this,arguments,function*({fileKey:t}){var i,s;const r=`v1/files/${t}/images`;return(s=(i=(yield L(this,U,Je).call(this,r)).meta)==null?void 0:i.images)!=null?s:{}})}getMe(){return C(this,null,function*(){return yield L(this,U,Je).call(this,"v1/me")})}}it=new WeakMap,Ne=new WeakMap,oe=new WeakMap,W=new WeakMap,U=new WeakSet,yn=function(t){if(!t.startsWith("figd_")&&!t.startsWith("figu_"))throw new Zr},St=function(t,n){return C(this,null,function*(){var a;const r=yield n();if(!r.ok){const i=r.status;let s=null;try{s=yield r.text()}catch(o){}if(i===403)throw s!=null&&s.includes("Invalid token")?new tn:s!=null&&s.includes("Token expired")?new nn:s!=null&&s.includes("File not exportable")?new rn:new an({reason:s});if(i===404)throw new Lr({cause:r});if(i===429){const o=r.headers.get("Retry-After"),c=o?Number(o):null;if(!c)throw new sn({cause:r});if(yield(a=t.onRateLimited)==null?void 0:a.call(t,{retryAfter:c,figmaPlanTier:r.headers.get("X-Figma-Plan-Tier"),figmaRateLimitType:r.headers.get("X-Figma-Rate-Limit-Type")}))return new Promise((h,T)=>{var N;const y=setTimeout(()=>{var I;(I=t.abortSignal)!=null&&I.aborted||L(this,U,St).call(this,t,n).then(h).catch(T)},c*1e3+1e3);(N=t.abortSignal)==null||N.addEventListener("abort",()=>{clearTimeout(y),T(new Error("The operation was aborted."))})});throw new sn({cause:r})}else throw i===500&&(s!=null&&s.includes("Request too large"))?new Ur({cause:r}):new jr({cause:r})}return r})},Je=function(t){return C(this,null,function*(){const n=sr(w(this,oe));H(this,oe,sr(w(this,W)));const r=()=>C(this,null,function*(){return yield w(this,Ne).call(this,`${w(this,it)}${t}`,{method:"GET",headers:this.getHeaders(n.token),signal:n.abortSignal})});try{return yield(yield L(this,U,St).call(this,n,r)).json()}catch(a){if(n.onForbidden&&(a instanceof tn||a instanceof nn||a instanceof rn||a instanceof an)){const i=yield n.onForbidden(a);if(i)return n.token=i.retry.newToken,yield(yield L(this,U,St).call(this,n,r)).json()}throw a}})};const Qs={codegen:"f2c",l2c:"l2c",p2c:"p2c"};var O,st,ot,ee,Gr,Oe;class eo{constructor({auth:t,apiBaseAddress:n="https://public-api.animaapp.com",figmaRestApi:r=new qr}={}){X(this,ee);X(this,O);X(this,st);X(this,ot);H(this,st,n),H(this,ot,r),t&&(this.auth=t)}hasAuth(){return!!w(this,O)}set auth(t){H(this,O,t)}get headers(){const t={"Content-Type":"application/json"};return w(this,O)&&(t.Authorization=`Bearer ${w(this,O).token}`,"teamId"in w(this,O)&&(t["X-Team-Id"]=w(this,O).teamId)),t}generateCode(a){return C(this,arguments,function*(t,n={},r){var l;let i;try{i=yield w(this,ot).withOptions({token:t.figmaToken,abortSignal:r}).getFile({fileKey:t.fileKey})}catch(h){if(h instanceof Error&&h.name==="AbortError")throw h}const s=Hr(t.settings);i&&(yield L(this,ee,Gr).call(this,i,t.nodesId,{allowAutoSelectFirstNode:(l=s.allowAutoSelectFirstNode)!=null?l:!0}));let o=t.tracking;w(this,O)&&"userId"in w(this,O)&&w(this,O).userId&&(o!=null&&o.externalId||(o={externalId:w(this,O).userId}));const c={tracking:o,fileKey:t.fileKey,figmaToken:t.figmaToken,nodesId:t.nodesId,figmaRateLimitMaxWait:t.figmaRateLimitMaxWait,assetsStorage:t.assetsStorage,language:s.language,model:s.model,framework:s.framework,styling:s.styling,uiLibrary:s.uiLibrary,enableTranslation:s.enableTranslation,enableUILibraryTheming:s.enableUILibraryTheming,enableCompactStructure:s.enableCompactStructure,enableAutoSplit:s.enableAutoSplit,autoSplitThreshold:s.autoSplitThreshold,disableMarkedForExport:s.disableMarkedForExport,allowAutoSelectFirstNode:s.allowAutoSelectFirstNode,enableDisplayScreenModelId:s.enableDisplayScreenModelId,enableGeneratePackageLock:s.enableGeneratePackageLock,enableAnimationsPreset:s.enableAnimationsPreset,enableDisplayDataId:s.enableDisplayDataId,enableDisplayDataName:s.enableDisplayDataName,codegenSettings:s.codegenSettings,webhookUrl:t.webhookUrl,prompt:t.prompt,images:t.images,createSession:t.createSession};return L(this,ee,Oe).call(this,"POST","/v1/codegen",c,n,"codegen",r)})}generateCodeFromWebsite(a){return C(this,arguments,function*(t,n={},r){let i=t.tracking;w(this,O)&&"userId"in w(this,O)&&w(this,O).userId&&(i!=null&&i.externalId||(i={externalId:w(this,O).userId}));let s;if(t.mhtmlUrl)s={type:"hosted-mhtml",mhtmlUrl:t.mhtmlUrl,url:t.url};else if(t.mhtml)s={type:"mhtml",mhtml:t.mhtml,url:t.url};else if(t.url)s={type:"url",url:t.url};else throw new Error("Either 'url', 'mhtml' or 'mhtmlUrl' must be provided");let o;t.experimental_useNewReactEngine&&(o="react-v2");const c={tracking:i,assetsStorage:t.assetsStorage,prompt:t.prompt,images:t.images,params:{input:s,conventions:{framework:t.settings.framework,language:t.settings.language,styling:t.settings.styling},assetsStorage:{type:"bundled"},engine:o}};return L(this,ee,Oe).call(this,"POST","/v1/l2c",c,n,"l2c",r)})}generateCodeFromPrompt(a){return C(this,arguments,function*(t,n={},r){var o;let i=t.tracking;w(this,O)&&"userId"in w(this,O)&&w(this,O).userId&&(i!=null&&i.externalId||(i={externalId:w(this,O).userId}));const s={tracking:i,assetsStorage:t.assetsStorage,params:d({prompt:t.prompt,guidelines:t.guidelines,images:t.images,conventions:{language:t.settings.language,framework:t.settings.framework,styling:t.settings.styling,uiLibrary:t.settings.uiLibrary}},(o=t.settings.codegenSettings)!=null?o:{}),webhookUrl:t.webhookUrl};return L(this,ee,Oe).call(this,"POST","/v1/p2c",s,n,"p2c",r)})}generateLink2Code(a){return C(this,arguments,function*(t,n={},r){let i=t.tracking;w(this,O)&&"userId"in w(this,O)&&w(this,O).userId&&(i!=null&&i.externalId||(i={externalId:w(this,O).userId}));const s={tracking:i,assetsStorage:t.assetsStorage,params:t.params};return L(this,ee,Oe).call(this,"POST","/v1/l2c",s,n,"l2c",r)})}attachToGenerationJob(a){return C(this,arguments,function*(t,n={},r){const i={};return L(this,ee,Oe).call(this,"GET",`/v1/jobs/${t.sessionId}`,i,n,void 0,r)})}}O=new WeakMap,st=new WeakMap,ot=new WeakMap,ee=new WeakSet,Gr=function(t,n,r){return C(this,null,function*(){const i=n.map(s=>Wr(t,s,r)).find(s=>!s.isValid);if(i)throw new ue({name:"Task Crashed",reason:i.reason})})},Oe=function(t,n,r,a,i,s){return C(this,null,function*(){var P,Be,ft,Ve,ht,_t,pt,mt,R,be,Ee;if(this.hasAuth()===!1)throw new Error('It needs to set "auth" before calling this method.');const o={},c={method:t,headers:v(d({},this.headers),{Accept:"text/event-stream"}),signal:s};if(t==="POST"){const Z=Hi(JSON.stringify(r));c.body=Z,c.headers=v(d({},c.headers),{"Content-Encoding":"gzip","Content-Type":"application/json"})}const l=yield fetch(`${w(this,st)}${n}`,c);if(!l.ok){const Z=yield l.text();let K;try{K=JSON.parse(Z)}catch(Lt){}throw((P=K==null?void 0:K.error)==null?void 0:P.name)==="ZodError"?(console.log("Zod validation error:",JSON.stringify(K.error.issues,null,2)),new ue({name:"HTTP error from Anima API",reason:"Invalid body payload",detail:K.error.issues,status:l.status})):typeof K=="object"?new ue({name:`Error "${K}"`,reason:"Unknown",status:l.status}):new ue({name:"HTTP error from Anima API",reason:Z,status:l.status})}if(!l.body)throw new ue({name:"Stream Error",reason:"Response body is null",status:l.status});const h=l.headers.get("x-anima-job-type"),T=h&&Qs[h];T&&typeof a=="function"&&a({type:"set_job_type",payload:{jobType:T}});const y=l.body.getReader(),N=new TextDecoder;let I="";try{for(;;){const{done:Z,value:K}=yield y.read();if(Z)break;I+=N.decode(K,{stream:!0});const Lt=I.split(`
2
- `);I=Lt.pop()||"";for(const gt of Lt)if(!(!gt.trim()||gt.startsWith(":"))&&gt.startsWith("data: ")){let S;try{S=JSON.parse(gt.slice(6))}catch(_o){continue}switch(S.type){case"queueing":{typeof a=="function"?a(S):(Be=a.onQueueing)==null||Be.call(a,{sessionId:S.sessionId});break}case"start":{o.sessionId=S.sessionId,typeof a=="function"?a(S):(ft=a.onStart)==null||ft.call(a,{sessionId:S.sessionId});break}case"pre_codegen":{i==="codegen"&&(typeof a=="function"?a(S):(Ve=a.onPreCodegen)==null||Ve.call(a,{message:S.message}));break}case"assets_uploaded":{typeof a=="function"?a(S):(ht=a.onAssetsUploaded)==null||ht.call(a);break}case"assets_list":{o.assets=S.payload.assets,typeof a=="function"?a(S):(_t=a.onAssetsList)==null||_t.call(a,S.payload);break}case"figma_metadata":{i==="codegen"&&(o.figmaFileName=S.figmaFileName,o.figmaSelectedFrameName=S.figmaSelectedFrameName,typeof a=="function"?a(S):(pt=a.onFigmaMetadata)==null||pt.call(a,{figmaFileName:S.figmaFileName,figmaSelectedFrameName:S.figmaSelectedFrameName}));break}case"generating_code":{S.payload.status==="success"&&(o.files=S.payload.files),typeof a=="function"?a(S):(mt=a.onGeneratingCode)==null||mt.call(a,{status:S.payload.status,progress:S.payload.progress,files:S.payload.files});break}case"progress_messages_updated":{typeof a=="function"?a(S):(R=a.onProgressMessagesUpdated)==null||R.call(a,S.payload.progressMessages);break}case"job_status_updated":{typeof a=="function"?a(S):(be=a.onJobStatusUpdated)==null||be.call(a,S.payload.jobStatus);break}case"codegen_completed":case"generation_completed":{typeof a=="function"?a(S):(Ee=a.onCodegenCompleted)==null||Ee.call(a);break}case"error":throw new ue({name:S.payload.errorName,reason:S.payload.reason});case"done":return o.tokenUsage=S.payload.tokenUsage,o.sessionId=S.payload.sessionId,o}}}}finally{y.cancel()}throw new ue({name:"Connection",reason:"Connection closed before the 'done' message",status:500})})};const to=e=>{var t;if(!e)return[!1,"",""];try{const n=new URL(e),r=n.pathname;if(n.origin!=="https://www.figma.com"&&n.origin!=="https://embed.figma.com")return[!1,"",""];const a=n.toString();if(e!==a)return[!1,"",""];const i=((t=n.searchParams.get("node-id"))!=null?t:"").replace(/-/g,":"),s=r.split("/")[2];return[(r.startsWith("/file/")&&n.searchParams.get("type")!=="whiteboard"||r.startsWith("/design/")||r.startsWith("/proto/"))&&s.length===22,s,i]}catch(n){return[!1,"",""]}},no=({fileKey:e,nodeId:t,duplicate:n})=>{const r=new URL("https://www.figma.com");return r.pathname=`design/${e}`,n&&(r.pathname=`${r.pathname}/dummy/duplicate`),t&&r.searchParams.set("node-id",t.replace(":","-")),r};class ro extends Error{constructor(t,n){super(t),this.response=n}}const ao=({files:e,screenPath:t="src/screens"})=>{const n={},r=new Set;function a(i){if(r.has(i)||!e[i])return;r.add(i),n[i]=e[i],io(e[i].content).forEach(o=>{try{const c=so(i,o);if(c.startsWith("src/")){const l=c.split("/").slice(0,-1).join("/");oo(e,l).forEach(T=>{r.has(T)||a(T)})}}catch(c){console.warn(`Failed to resolve import ${o} in ${i}:`,c)}})}return Object.entries(e).forEach(([i,s])=>{i.startsWith(t)?a(i):i.startsWith("src/")||(n[i]=s)}),n};function io(e){const t=/import.*?["']([^"']+)["']/g,n=/export.*from\s+["']([^"']+)["']/g,r=[];let a;for(;(a=t.exec(e))!==null;)r.push(a[1]);for(;(a=n.exec(e))!==null;)r.push(a[1]);return[...new Set(r)]}function so(e,t){if(!t.startsWith("."))return t;const n=e.split("/").slice(0,-1),r=t.split("/"),a=[...n];for(const i of r)i===".."?a.pop():i!=="."&&a.push(i);return a.join("/")}function oo(e,t){return Object.keys(e).filter(n=>n.startsWith(t))}function dt(e,t,n){return new ReadableStream({start(r){n.call(e,t,a=>{a.type==="error"||r.enqueue(a),(a.type==="aborted"||a.type==="error")&&r.close()}).then(a=>{r.enqueue({type:"done",payload:{tokenUsage:a.tokenUsage,sessionId:a.sessionId}}),r.close()}).catch(a=>{r.enqueue({type:"error",payload:{name:"name"in a?a.name:"Unknown error",message:"message"in a?a.message:"Unknown",status:"status"in a?a.status:void 0,detail:"detail"in a?a.detail:void 0,errorPayload:"payload"in a?a.payload:void 0}}),r.close()})}})}const Jr=(e,t)=>dt(e,t,e.generateCode);function ut(e){return C(this,null,function*(){var s,o,c,l;const[t,n]=e.tee(),r=yield t.getReader().read();if(r.done||!r.value||r.value.type==="error"&&((s=r.value.payload)!=null&&s.status))return new Response(JSON.stringify(r.value),{status:((o=r.value)==null?void 0:o.type)==="error"&&(l=(c=r.value.payload)==null?void 0:c.status)!=null?l:500,headers:{"Content-Type":"application/json"}});const a=new TextEncoder,i=n.pipeThrough(new TransformStream({transform(h,T){const y=`event: ${h.type}
1
+ "use strict";var ea=Object.defineProperty,ta=Object.defineProperties;var na=Object.getOwnPropertyDescriptors;var An=Object.getOwnPropertySymbols;var ra=Object.prototype.hasOwnProperty,aa=Object.prototype.propertyIsEnumerable;var On=e=>{throw TypeError(e)},Rn=Math.pow,Cn=(e,t,n)=>t in e?ea(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var n in t||(t={}))ra.call(t,n)&&Cn(e,n,t[n]);if(An)for(var n of An(t))aa.call(t,n)&&Cn(e,n,t[n]);return e},v=(e,t)=>ta(e,na(t));var Dt=(e,t,n)=>t.has(e)||On("Cannot "+n);var w=(e,t,n)=>(Dt(e,t,"read from private field"),n?n.call(e):t.get(e)),X=(e,t,n)=>t.has(e)?On("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),H=(e,t,n,r)=>(Dt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),L=(e,t,n)=>(Dt(e,t,"access private method"),n);var C=(e,t,n)=>new Promise((r,a)=>{var i=c=>{try{o(n.next(c))}catch(l){a(l)}},s=c=>{try{o(n.throw(c))}catch(l){a(l)}},o=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,s);o((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const ia=4,Nn=0,In=1,sa=2;function $e(e){let t=e.length;for(;--t>=0;)e[t]=0}const oa=0,or=1,la=2,ca=3,da=258,vn=29,ct=256,Qe=ct+1+vn,Re=30,bn=19,lr=2*Qe+1,we=15,jt=16,ua=7,wn=256,cr=16,dr=17,ur=18,Wt=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),xt=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),fa=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),fr=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ha=512,se=new Array((Qe+2)*2);$e(se);const Xe=new Array(Re*2);$e(Xe);const et=new Array(ha);$e(et);const tt=new Array(da-ca+1);$e(tt);const xn=new Array(vn);$e(xn);const Tt=new Array(Re);$e(Tt);function Mt(e,t,n,r,a){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=a,this.has_stree=e&&e.length}let hr,_r,pr;function $t(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}const mr=e=>e<256?et[e]:et[256+(e>>>7)],nt=(e,t)=>{e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255},$=(e,t,n)=>{e.bi_valid>jt-n?(e.bi_buf|=t<<e.bi_valid&65535,nt(e,e.bi_buf),e.bi_buf=t>>jt-e.bi_valid,e.bi_valid+=n-jt):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},Q=(e,t,n)=>{$(e,n[t*2],n[t*2+1])},gr=(e,t)=>{let n=0;do n|=e&1,e>>>=1,n<<=1;while(--t>0);return n>>>1},_a=e=>{e.bi_valid===16?(nt(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)},pa=(e,t)=>{const n=t.dyn_tree,r=t.max_code,a=t.stat_desc.static_tree,i=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,o=t.stat_desc.extra_base,c=t.stat_desc.max_length;let l,h,T,y,N,I,P=0;for(y=0;y<=we;y++)e.bl_count[y]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<lr;l++)h=e.heap[l],y=n[n[h*2+1]*2+1]+1,y>c&&(y=c,P++),n[h*2+1]=y,!(h>r)&&(e.bl_count[y]++,N=0,h>=o&&(N=s[h-o]),I=n[h*2],e.opt_len+=I*(y+N),i&&(e.static_len+=I*(a[h*2+1]+N)));if(P!==0){do{for(y=c-1;e.bl_count[y]===0;)y--;e.bl_count[y]--,e.bl_count[y+1]+=2,e.bl_count[c]--,P-=2}while(P>0);for(y=c;y!==0;y--)for(h=e.bl_count[y];h!==0;)T=e.heap[--l],!(T>r)&&(n[T*2+1]!==y&&(e.opt_len+=(y-n[T*2+1])*n[T*2],n[T*2+1]=y),h--)}},yr=(e,t,n)=>{const r=new Array(we+1);let a=0,i,s;for(i=1;i<=we;i++)a=a+n[i-1]<<1,r[i]=a;for(s=0;s<=t;s++){let o=e[s*2+1];o!==0&&(e[s*2]=gr(r[o]++,o))}},ma=()=>{let e,t,n,r,a;const i=new Array(we+1);for(n=0,r=0;r<vn-1;r++)for(xn[r]=n,e=0;e<1<<Wt[r];e++)tt[n++]=r;for(tt[n-1]=r,a=0,r=0;r<16;r++)for(Tt[r]=a,e=0;e<1<<xt[r];e++)et[a++]=r;for(a>>=7;r<Re;r++)for(Tt[r]=a<<7,e=0;e<1<<xt[r]-7;e++)et[256+a++]=r;for(t=0;t<=we;t++)i[t]=0;for(e=0;e<=143;)se[e*2+1]=8,e++,i[8]++;for(;e<=255;)se[e*2+1]=9,e++,i[9]++;for(;e<=279;)se[e*2+1]=7,e++,i[7]++;for(;e<=287;)se[e*2+1]=8,e++,i[8]++;for(yr(se,Qe+1,i),e=0;e<Re;e++)Xe[e*2+1]=5,Xe[e*2]=gr(e,5);hr=new Mt(se,Wt,ct+1,Qe,we),_r=new Mt(Xe,xt,0,Re,we),pr=new Mt(new Array(0),fa,0,bn,ua)},vr=e=>{let t;for(t=0;t<Qe;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Re;t++)e.dyn_dtree[t*2]=0;for(t=0;t<bn;t++)e.bl_tree[t*2]=0;e.dyn_ltree[wn*2]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},br=e=>{e.bi_valid>8?nt(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},Zn=(e,t,n,r)=>{const a=t*2,i=n*2;return e[a]<e[i]||e[a]===e[i]&&r[t]<=r[n]},Ut=(e,t,n)=>{const r=e.heap[n];let a=n<<1;for(;a<=e.heap_len&&(a<e.heap_len&&Zn(t,e.heap[a+1],e.heap[a],e.depth)&&a++,!Zn(t,r,e.heap[a],e.depth));)e.heap[n]=e.heap[a],n=a,a<<=1;e.heap[n]=r},zn=(e,t,n)=>{let r,a,i=0,s,o;if(e.sym_next!==0)do r=e.pending_buf[e.sym_buf+i++]&255,r+=(e.pending_buf[e.sym_buf+i++]&255)<<8,a=e.pending_buf[e.sym_buf+i++],r===0?Q(e,a,t):(s=tt[a],Q(e,s+ct+1,t),o=Wt[s],o!==0&&(a-=xn[s],$(e,a,o)),r--,s=mr(r),Q(e,s,n),o=xt[s],o!==0&&(r-=Tt[s],$(e,r,o)));while(i<e.sym_next);Q(e,wn,t)},qt=(e,t)=>{const n=t.dyn_tree,r=t.stat_desc.static_tree,a=t.stat_desc.has_stree,i=t.stat_desc.elems;let s,o,c=-1,l;for(e.heap_len=0,e.heap_max=lr,s=0;s<i;s++)n[s*2]!==0?(e.heap[++e.heap_len]=c=s,e.depth[s]=0):n[s*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=c<2?++c:0,n[l*2]=1,e.depth[l]=0,e.opt_len--,a&&(e.static_len-=r[l*2+1]);for(t.max_code=c,s=e.heap_len>>1;s>=1;s--)Ut(e,n,s);l=i;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ut(e,n,1),o=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=o,n[l*2]=n[s*2]+n[o*2],e.depth[l]=(e.depth[s]>=e.depth[o]?e.depth[s]:e.depth[o])+1,n[s*2+1]=n[o*2+1]=l,e.heap[1]=l++,Ut(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],pa(e,t),yr(n,c,e.bl_count)},Fn=(e,t,n)=>{let r,a=-1,i,s=t[1],o=0,c=7,l=4;for(s===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)i=s,s=t[(r+1)*2+1],!(++o<c&&i===s)&&(o<l?e.bl_tree[i*2]+=o:i!==0?(i!==a&&e.bl_tree[i*2]++,e.bl_tree[cr*2]++):o<=10?e.bl_tree[dr*2]++:e.bl_tree[ur*2]++,o=0,a=i,s===0?(c=138,l=3):i===s?(c=6,l=3):(c=7,l=4))},Ln=(e,t,n)=>{let r,a=-1,i,s=t[1],o=0,c=7,l=4;for(s===0&&(c=138,l=3),r=0;r<=n;r++)if(i=s,s=t[(r+1)*2+1],!(++o<c&&i===s)){if(o<l)do Q(e,i,e.bl_tree);while(--o!==0);else i!==0?(i!==a&&(Q(e,i,e.bl_tree),o--),Q(e,cr,e.bl_tree),$(e,o-3,2)):o<=10?(Q(e,dr,e.bl_tree),$(e,o-3,3)):(Q(e,ur,e.bl_tree),$(e,o-11,7));o=0,a=i,s===0?(c=138,l=3):i===s?(c=6,l=3):(c=7,l=4)}},ga=e=>{let t;for(Fn(e,e.dyn_ltree,e.l_desc.max_code),Fn(e,e.dyn_dtree,e.d_desc.max_code),qt(e,e.bl_desc),t=bn-1;t>=3&&e.bl_tree[fr[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t},ya=(e,t,n,r)=>{let a;for($(e,t-257,5),$(e,n-1,5),$(e,r-4,4),a=0;a<r;a++)$(e,e.bl_tree[fr[a]*2+1],3);Ln(e,e.dyn_ltree,t-1),Ln(e,e.dyn_dtree,n-1)},va=e=>{let t=4093624447,n;for(n=0;n<=31;n++,t>>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return Nn;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return In;for(n=32;n<ct;n++)if(e.dyn_ltree[n*2]!==0)return In;return Nn};let Dn=!1;const ba=e=>{Dn||(ma(),Dn=!0),e.l_desc=new $t(e.dyn_ltree,hr),e.d_desc=new $t(e.dyn_dtree,_r),e.bl_desc=new $t(e.bl_tree,pr),e.bi_buf=0,e.bi_valid=0,vr(e)},wr=(e,t,n,r)=>{$(e,(oa<<1)+(r?1:0),3),br(e),nt(e,n),nt(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n},wa=e=>{$(e,or<<1,3),Q(e,wn,se),_a(e)},xa=(e,t,n,r)=>{let a,i,s=0;e.level>0?(e.strm.data_type===sa&&(e.strm.data_type=va(e)),qt(e,e.l_desc),qt(e,e.d_desc),s=ga(e),a=e.opt_len+3+7>>>3,i=e.static_len+3+7>>>3,i<=a&&(a=i)):a=i=n+5,n+4<=a&&t!==-1?wr(e,t,n,r):e.strategy===ia||i===a?($(e,(or<<1)+(r?1:0),3),zn(e,se,Xe)):($(e,(la<<1)+(r?1:0),3),ya(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),zn(e,e.dyn_ltree,e.dyn_dtree)),vr(e),r&&br(e)},ka=(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(tt[n]+ct+1)*2]++,e.dyn_dtree[mr(t)*2]++),e.sym_next===e.sym_end);var Sa=ba,Ta=wr,Ea=xa,Aa=ka,Ca=wa,Oa={_tr_init:Sa,_tr_stored_block:Ta,_tr_flush_block:Ea,_tr_tally:Aa,_tr_align:Ca};const Ra=(e,t,n,r)=>{let a=e&65535|0,i=e>>>16&65535|0,s=0;for(;n!==0;){s=n>2e3?2e3:n,n-=s;do a=a+t[r++]|0,i=i+a|0;while(--s);a%=65521,i%=65521}return a|i<<16|0};var xr=Ra;const Na=()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t},Ia=new Uint32Array(Na()),Za=(e,t,n,r)=>{const a=Ia,i=r+n;e^=-1;for(let s=r;s<i;s++)e=e>>>8^a[(e^t[s])&255];return e^-1};var de=Za,Et={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},kr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:za,_tr_stored_block:Gt,_tr_flush_block:Fa,_tr_tally:pe,_tr_align:La}=Oa,{Z_NO_FLUSH:me,Z_PARTIAL_FLUSH:Da,Z_FULL_FLUSH:ja,Z_FINISH:q,Z_BLOCK:jn,Z_OK:F,Z_STREAM_END:Mn,Z_STREAM_ERROR:te,Z_DATA_ERROR:Ma,Z_BUF_ERROR:Pt,Z_DEFAULT_COMPRESSION:$a,Z_FILTERED:Ua,Z_HUFFMAN_ONLY:vt,Z_RLE:Pa,Z_FIXED:Ba,Z_DEFAULT_STRATEGY:Va,Z_UNKNOWN:Ha,Z_DEFLATED:zt}=kr,Wa=9,qa=15,Ga=8,Ja=29,Ka=256,Jt=Ka+1+Ja,Xa=30,Ya=19,Qa=2*Jt+1,ei=15,x=3,_e=258,ne=_e+x+1,ti=32,Ie=42,kn=57,Kt=69,Xt=73,Yt=91,Qt=103,xe=113,qe=666,j=1,Ue=2,Se=3,Pe=4,ni=3,ke=(e,t)=>(e.msg=Et[t],t),$n=e=>e*2-(e>4?9:0),he=e=>{let t=e.length;for(;--t>=0;)e[t]=0},ri=e=>{let t,n,r,a=e.w_size;t=e.hash_size,r=t;do n=e.head[--r],e.head[r]=n>=a?n-a:0;while(--t);t=a,r=t;do n=e.prev[--r],e.prev[r]=n>=a?n-a:0;while(--t)};let ai=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,ge=ai;const B=e=>{const t=e.state;let n=t.pending;n>e.avail_out&&(n=e.avail_out),n!==0&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))},V=(e,t)=>{Fa(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,B(e.strm)},A=(e,t)=>{e.pending_buf[e.pending++]=t},He=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255},en=(e,t,n,r)=>{let a=e.avail_in;return a>r&&(a=r),a===0?0:(e.avail_in-=a,t.set(e.input.subarray(e.next_in,e.next_in+a),n),e.state.wrap===1?e.adler=xr(e.adler,t,a,n):e.state.wrap===2&&(e.adler=de(e.adler,t,a,n)),e.next_in+=a,e.total_in+=a,a)},Sr=(e,t)=>{let n=e.max_chain_length,r=e.strstart,a,i,s=e.prev_length,o=e.nice_match;const c=e.strstart>e.w_size-ne?e.strstart-(e.w_size-ne):0,l=e.window,h=e.w_mask,T=e.prev,y=e.strstart+_e;let N=l[r+s-1],I=l[r+s];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do if(a=t,!(l[a+s]!==I||l[a+s-1]!==N||l[a]!==l[r]||l[++a]!==l[r+1])){r+=2,a++;do;while(l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&l[++r]===l[++a]&&r<y);if(i=_e-(y-r),r=y-_e,i>s){if(e.match_start=t,s=i,i>=o)break;N=l[r+s-1],I=l[r+s]}}while((t=T[t&h])>c&&--n!==0);return s<=e.lookahead?s:e.lookahead},Ze=e=>{const t=e.w_size;let n,r,a;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ne)&&(e.window.set(e.window.subarray(t,t+t-r),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),ri(e),r+=t),e.strm.avail_in===0)break;if(n=en(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=n,e.lookahead+e.insert>=x)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=ge(e,e.ins_h,e.window[a+1]);e.insert&&(e.ins_h=ge(e,e.ins_h,e.window[a+x-1]),e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<x)););}while(e.lookahead<ne&&e.strm.avail_in!==0)},Tr=(e,t)=>{let n=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r,a,i,s=0,o=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i||(i=e.strm.avail_out-i,a=e.strstart-e.block_start,r>a+e.strm.avail_in&&(r=a+e.strm.avail_in),r>i&&(r=i),r<n&&(r===0&&t!==q||t===me||r!==a+e.strm.avail_in)))break;s=t===q&&r===a+e.strm.avail_in?1:0,Gt(e,0,0,s),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,B(e.strm),a&&(a>r&&(a=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+a),e.strm.next_out),e.strm.next_out+=a,e.strm.avail_out-=a,e.strm.total_out+=a,e.block_start+=a,r-=a),r&&(en(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(s===0);return o-=e.strm.avail_in,o&&(o>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=o&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-o,e.strm.next_in),e.strstart),e.strstart+=o,e.insert+=o>e.w_size-e.insert?e.w_size-e.insert:o),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?Pe:t!==me&&t!==q&&e.strm.avail_in===0&&e.strstart===e.block_start?Ue:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(en(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,n=i>e.w_size?e.w_size:i,a=e.strstart-e.block_start,(a>=n||(a||t===q)&&t!==me&&e.strm.avail_in===0&&a<=i)&&(r=a>i?i:a,s=t===q&&e.strm.avail_in===0&&r===a?1:0,Gt(e,e.block_start,r,s),e.block_start+=r,B(e.strm)),s?Se:j)},Bt=(e,t)=>{let n,r;for(;;){if(e.lookahead<ne){if(Ze(e),e.lookahead<ne&&t===me)return j;if(e.lookahead===0)break}if(n=0,e.lookahead>=x&&(e.ins_h=ge(e,e.ins_h,e.window[e.strstart+x-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),n!==0&&e.strstart-n<=e.w_size-ne&&(e.match_length=Sr(e,n)),e.match_length>=x)if(r=pe(e,e.strstart-e.match_start,e.match_length-x),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=x){e.match_length--;do e.strstart++,e.ins_h=ge(e,e.ins_h,e.window[e.strstart+x-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=ge(e,e.ins_h,e.window[e.strstart+1]);else r=pe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(V(e,!1),e.strm.avail_out===0))return j}return e.insert=e.strstart<x-1?e.strstart:x-1,t===q?(V(e,!0),e.strm.avail_out===0?Se:Pe):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?j:Ue},Ae=(e,t)=>{let n,r,a;for(;;){if(e.lookahead<ne){if(Ze(e),e.lookahead<ne&&t===me)return j;if(e.lookahead===0)break}if(n=0,e.lookahead>=x&&(e.ins_h=ge(e,e.ins_h,e.window[e.strstart+x-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=x-1,n!==0&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-ne&&(e.match_length=Sr(e,n),e.match_length<=5&&(e.strategy===Ua||e.match_length===x&&e.strstart-e.match_start>4096)&&(e.match_length=x-1)),e.prev_length>=x&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-x,r=pe(e,e.strstart-1-e.prev_match,e.prev_length-x),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=a&&(e.ins_h=ge(e,e.ins_h,e.window[e.strstart+x-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=x-1,e.strstart++,r&&(V(e,!1),e.strm.avail_out===0))return j}else if(e.match_available){if(r=pe(e,0,e.window[e.strstart-1]),r&&V(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return j}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=pe(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<x-1?e.strstart:x-1,t===q?(V(e,!0),e.strm.avail_out===0?Se:Pe):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?j:Ue},ii=(e,t)=>{let n,r,a,i;const s=e.window;for(;;){if(e.lookahead<=_e){if(Ze(e),e.lookahead<=_e&&t===me)return j;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=x&&e.strstart>0&&(a=e.strstart-1,r=s[a],r===s[++a]&&r===s[++a]&&r===s[++a])){i=e.strstart+_e;do;while(r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&r===s[++a]&&a<i);e.match_length=_e-(i-a),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=x?(n=pe(e,1,e.match_length-x),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=pe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(V(e,!1),e.strm.avail_out===0))return j}return e.insert=0,t===q?(V(e,!0),e.strm.avail_out===0?Se:Pe):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?j:Ue},si=(e,t)=>{let n;for(;;){if(e.lookahead===0&&(Ze(e),e.lookahead===0)){if(t===me)return j;break}if(e.match_length=0,n=pe(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(V(e,!1),e.strm.avail_out===0))return j}return e.insert=0,t===q?(V(e,!0),e.strm.avail_out===0?Se:Pe):e.sym_next&&(V(e,!1),e.strm.avail_out===0)?j:Ue};function Y(e,t,n,r,a){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=a}const Ge=[new Y(0,0,0,0,Tr),new Y(4,4,8,4,Bt),new Y(4,5,16,8,Bt),new Y(4,6,32,32,Bt),new Y(4,4,16,16,Ae),new Y(8,16,32,32,Ae),new Y(8,16,128,128,Ae),new Y(8,32,128,256,Ae),new Y(32,128,258,1024,Ae),new Y(32,258,258,4096,Ae)],oi=e=>{e.window_size=2*e.w_size,he(e.head),e.max_lazy_match=Ge[e.level].max_lazy,e.good_match=Ge[e.level].good_length,e.nice_match=Ge[e.level].nice_length,e.max_chain_length=Ge[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=x-1,e.match_available=0,e.ins_h=0};function li(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=zt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Qa*2),this.dyn_dtree=new Uint16Array((2*Xa+1)*2),this.bl_tree=new Uint16Array((2*Ya+1)*2),he(this.dyn_ltree),he(this.dyn_dtree),he(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(ei+1),this.heap=new Uint16Array(2*Jt+1),he(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Jt+1),he(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const dt=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Ie&&t.status!==kn&&t.status!==Kt&&t.status!==Xt&&t.status!==Yt&&t.status!==Qt&&t.status!==xe&&t.status!==qe?1:0},Er=e=>{if(dt(e))return ke(e,te);e.total_in=e.total_out=0,e.data_type=Ha;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?kn:t.wrap?Ie:xe,e.adler=t.wrap===2?0:1,t.last_flush=-2,za(t),F},Ar=e=>{const t=Er(e);return t===F&&oi(e.state),t},ci=(e,t)=>dt(e)||e.state.wrap!==2?te:(e.state.gzhead=t,F),Cr=(e,t,n,r,a,i)=>{if(!e)return te;let s=1;if(t===$a&&(t=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),a<1||a>Wa||n!==zt||r<8||r>15||t<0||t>9||i<0||i>Ba||r===8&&s!==1)return ke(e,te);r===8&&(r=9);const o=new li;return e.state=o,o.strm=e,o.status=Ie,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=a+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+x-1)/x),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<a+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=t,o.strategy=i,o.method=n,Ar(e)},di=(e,t)=>Cr(e,t,zt,qa,Ga,Va),ui=(e,t)=>{if(dt(e)||t>jn||t<0)return e?ke(e,te):te;const n=e.state;if(!e.output||e.avail_in!==0&&!e.input||n.status===qe&&t!==q)return ke(e,e.avail_out===0?Pt:te);const r=n.last_flush;if(n.last_flush=t,n.pending!==0){if(B(e),e.avail_out===0)return n.last_flush=-1,F}else if(e.avail_in===0&&$n(t)<=$n(r)&&t!==q)return ke(e,Pt);if(n.status===qe&&e.avail_in!==0)return ke(e,Pt);if(n.status===Ie&&n.wrap===0&&(n.status=xe),n.status===Ie){let a=zt+(n.w_bits-8<<4)<<8,i=-1;if(n.strategy>=vt||n.level<2?i=0:n.level<6?i=1:n.level===6?i=2:i=3,a|=i<<6,n.strstart!==0&&(a|=ti),a+=31-a%31,He(n,a),n.strstart!==0&&(He(n,e.adler>>>16),He(n,e.adler&65535)),e.adler=1,n.status=xe,B(e),n.pending!==0)return n.last_flush=-1,F}if(n.status===kn){if(e.adler=0,A(n,31),A(n,139),A(n,8),n.gzhead)A(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),A(n,n.gzhead.time&255),A(n,n.gzhead.time>>8&255),A(n,n.gzhead.time>>16&255),A(n,n.gzhead.time>>24&255),A(n,n.level===9?2:n.strategy>=vt||n.level<2?4:0),A(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(A(n,n.gzhead.extra.length&255),A(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=de(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=Kt;else if(A(n,0),A(n,0),A(n,0),A(n,0),A(n,0),A(n,n.level===9?2:n.strategy>=vt||n.level<2?4:0),A(n,ni),n.status=xe,B(e),n.pending!==0)return n.last_flush=-1,F}if(n.status===Kt){if(n.gzhead.extra){let a=n.pending,i=(n.gzhead.extra.length&65535)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let o=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+o),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a)),n.gzindex+=o,B(e),n.pending!==0)return n.last_flush=-1,F;a=0,i-=o}let s=new Uint8Array(n.gzhead.extra);n.pending_buf.set(s.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a)),n.gzindex=0}n.status=Xt}if(n.status===Xt){if(n.gzhead.name){let a=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a)),B(e),n.pending!==0)return n.last_flush=-1,F;a=0}n.gzindex<n.gzhead.name.length?i=n.gzhead.name.charCodeAt(n.gzindex++)&255:i=0,A(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a)),n.gzindex=0}n.status=Yt}if(n.status===Yt){if(n.gzhead.comment){let a=n.pending,i;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a)),B(e),n.pending!==0)return n.last_flush=-1,F;a=0}n.gzindex<n.gzhead.comment.length?i=n.gzhead.comment.charCodeAt(n.gzindex++)&255:i=0,A(n,i)}while(i!==0);n.gzhead.hcrc&&n.pending>a&&(e.adler=de(e.adler,n.pending_buf,n.pending-a,a))}n.status=Qt}if(n.status===Qt){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(B(e),n.pending!==0))return n.last_flush=-1,F;A(n,e.adler&255),A(n,e.adler>>8&255),e.adler=0}if(n.status=xe,B(e),n.pending!==0)return n.last_flush=-1,F}if(e.avail_in!==0||n.lookahead!==0||t!==me&&n.status!==qe){let a=n.level===0?Tr(n,t):n.strategy===vt?si(n,t):n.strategy===Pa?ii(n,t):Ge[n.level].func(n,t);if((a===Se||a===Pe)&&(n.status=qe),a===j||a===Se)return e.avail_out===0&&(n.last_flush=-1),F;if(a===Ue&&(t===Da?La(n):t!==jn&&(Gt(n,0,0,!1),t===ja&&(he(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),B(e),e.avail_out===0))return n.last_flush=-1,F}return t!==q?F:n.wrap<=0?Mn:(n.wrap===2?(A(n,e.adler&255),A(n,e.adler>>8&255),A(n,e.adler>>16&255),A(n,e.adler>>24&255),A(n,e.total_in&255),A(n,e.total_in>>8&255),A(n,e.total_in>>16&255),A(n,e.total_in>>24&255)):(He(n,e.adler>>>16),He(n,e.adler&65535)),B(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?F:Mn)},fi=e=>{if(dt(e))return te;const t=e.state.status;return e.state=null,t===xe?ke(e,Ma):F},hi=(e,t)=>{let n=t.length;if(dt(e))return te;const r=e.state,a=r.wrap;if(a===2||a===1&&r.status!==Ie||r.lookahead)return te;if(a===1&&(e.adler=xr(e.adler,t,n,0)),r.wrap=0,n>=r.w_size){a===0&&(he(r.head),r.strstart=0,r.block_start=0,r.insert=0);let c=new Uint8Array(r.w_size);c.set(t.subarray(n-r.w_size,n),0),t=c,n=r.w_size}const i=e.avail_in,s=e.next_in,o=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,Ze(r);r.lookahead>=x;){let c=r.strstart,l=r.lookahead-(x-1);do r.ins_h=ge(r,r.ins_h,r.window[c+x-1]),r.prev[c&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=c,c++;while(--l);r.strstart=c,r.lookahead=x-1,Ze(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=x-1,r.match_available=0,e.next_in=s,e.input=o,e.avail_in=i,r.wrap=a,F};var _i=di,pi=Cr,mi=Ar,gi=Er,yi=ci,vi=ui,bi=fi,wi=hi,xi="pako deflate (from Nodeca project)",Ye={deflateInit:_i,deflateInit2:pi,deflateReset:mi,deflateResetKeep:gi,deflateSetHeader:yi,deflate:vi,deflateEnd:bi,deflateSetDictionary:wi,deflateInfo:xi};const ki=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Si=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const n=t.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(const r in n)ki(n,r)&&(e[r]=n[r])}}return e},Ti=e=>{let t=0;for(let r=0,a=e.length;r<a;r++)t+=e[r].length;const n=new Uint8Array(t);for(let r=0,a=0,i=e.length;r<i;r++){let s=e[r];n.set(s,a),a+=s.length}return n},Or={assign:Si,flattenChunks:Ti};let Rr=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Rr=!1}const rt=new Uint8Array(256);for(let e=0;e<256;e++)rt[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;rt[254]=rt[254]=1;var Ei=e=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(e);let t,n,r,a,i,s=e.length,o=0;for(a=0;a<s;a++)n=e.charCodeAt(a),(n&64512)===55296&&a+1<s&&(r=e.charCodeAt(a+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),a++)),o+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(o),i=0,a=0;i<o;a++)n=e.charCodeAt(a),(n&64512)===55296&&a+1<s&&(r=e.charCodeAt(a+1),(r&64512)===56320&&(n=65536+(n-55296<<10)+(r-56320),a++)),n<128?t[i++]=n:n<2048?(t[i++]=192|n>>>6,t[i++]=128|n&63):n<65536?(t[i++]=224|n>>>12,t[i++]=128|n>>>6&63,t[i++]=128|n&63):(t[i++]=240|n>>>18,t[i++]=128|n>>>12&63,t[i++]=128|n>>>6&63,t[i++]=128|n&63);return t};const Ai=(e,t)=>{if(t<65534&&e.subarray&&Rr)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e[r]);return n};var Ci=(e,t)=>{const n=t||e.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(e.subarray(0,t));let r,a;const i=new Array(n*2);for(a=0,r=0;r<n;){let s=e[r++];if(s<128){i[a++]=s;continue}let o=rt[s];if(o>4){i[a++]=65533,r+=o-1;continue}for(s&=o===2?31:o===3?15:7;o>1&&r<n;)s=s<<6|e[r++]&63,o--;if(o>1){i[a++]=65533;continue}s<65536?i[a++]=s:(s-=65536,i[a++]=55296|s>>10&1023,i[a++]=56320|s&1023)}return Ai(i,a)},Oi=(e,t)=>{t=t||e.length,t>e.length&&(t=e.length);let n=t-1;for(;n>=0&&(e[n]&192)===128;)n--;return n<0||n===0?t:n+rt[e[n]]>t?n:t},Nr={string2buf:Ei,buf2string:Ci,utf8border:Oi};function Ri(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Ni=Ri;const Ir=Object.prototype.toString,{Z_NO_FLUSH:Ii,Z_SYNC_FLUSH:Zi,Z_FULL_FLUSH:zi,Z_FINISH:Fi,Z_OK:At,Z_STREAM_END:Li,Z_DEFAULT_COMPRESSION:Di,Z_DEFAULT_STRATEGY:ji,Z_DEFLATED:Mi}=kr;function Ft(e){this.options=Or.assign({level:Di,method:Mi,chunkSize:16384,windowBits:15,memLevel:8,strategy:ji},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ni,this.strm.avail_out=0;let n=Ye.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==At)throw new Error(Et[n]);if(t.header&&Ye.deflateSetHeader(this.strm,t.header),t.dictionary){let r;if(typeof t.dictionary=="string"?r=Nr.string2buf(t.dictionary):Ir.call(t.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(t.dictionary):r=t.dictionary,n=Ye.deflateSetDictionary(this.strm,r),n!==At)throw new Error(Et[n]);this._dict_set=!0}}Ft.prototype.push=function(e,t){const n=this.strm,r=this.options.chunkSize;let a,i;if(this.ended)return!1;for(t===~~t?i=t:i=t===!0?Fi:Ii,typeof e=="string"?n.input=Nr.string2buf(e):Ir.call(e)==="[object ArrayBuffer]"?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;;){if(n.avail_out===0&&(n.output=new Uint8Array(r),n.next_out=0,n.avail_out=r),(i===Zi||i===zi)&&n.avail_out<=6){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(a=Ye.deflate(n,i),a===Li)return n.next_out>0&&this.onData(n.output.subarray(0,n.next_out)),a=Ye.deflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===At;if(n.avail_out===0){this.onData(n.output);continue}if(i>0&&n.next_out>0){this.onData(n.output.subarray(0,n.next_out)),n.avail_out=0;continue}if(n.avail_in===0)break}return!0};Ft.prototype.onData=function(e){this.chunks.push(e)};Ft.prototype.onEnd=function(e){e===At&&(this.result=Or.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function $i(e,t){const n=new Ft(t);if(n.push(e,!0),n.err)throw n.msg||Et[n.err];return n.result}function Ui(e,t){return t=t||{},t.gzip=!0,$i(e,t)}var Pi=Ui,Bi={gzip:Pi};const{gzip:Vi}=Bi;var Hi=Vi;class ue extends Error{constructor({name:t,reason:n,status:r,detail:a}){super(),this.name=t,this.message=n,this.detail=a,this.status=r}}class Zr extends Error{constructor(){super("Malformatted Figma Token")}}class zr extends Error{constructor(){super("Missing Figma Token")}}class tn extends Error{constructor(){super("Needs Reauth Figma Token")}}class nn extends Error{constructor(){super("Expired Figma Token")}}class rn extends Error{constructor(){super("File Not Exportable")}}class an extends Error{constructor({reason:t}){super("Unknown Forbidden Figma Error"),this.reason=t}}const Fr="Not Found";class Lr extends Error{constructor({cause:t}){super(Fr),this.cause=t}}const Wi=e=>e.message===Fr,Dr="Unknown Figma API Exception";class jr extends Error{constructor({cause:t}){super(Dr),this.cause=t}}const qi=e=>e.message===Dr,Mr="Rate Limit Exceeded";class sn extends Error{constructor({cause:t}){super(Mr),this.cause=t}}const Gi=e=>e.message===Mr,$r="Request Too Large";class Ur extends Error{constructor({cause:t}){super($r),this.cause=t}}const Ji=e=>e.message===$r;var E;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,e.arrayToEnum=a=>{const i={};for(const s of a)i[s]=s;return i},e.getValidEnumValues=a=>{const i=e.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(const o of i)s[o]=a[o];return e.objectValues(s)},e.objectValues=a=>e.objectKeys(a).map(function(i){return a[i]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},e.find=(a,i)=>{for(const s of a)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(E||(E={}));var Un;(function(e){e.mergeShapes=(t,n)=>d(d({},t),n)})(Un||(Un={}));const _=E.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fe=e=>{switch(typeof e){case"undefined":return _.undefined;case"string":return _.string;case"number":return Number.isNaN(e)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(e)?_.array:e===null?_.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?_.promise:typeof Map!="undefined"&&e instanceof Map?_.map:typeof Set!="undefined"&&e instanceof Set?_.set:typeof Date!="undefined"&&e instanceof Date?_.date:_.object;default:return _.unknown}},u=E.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"]);class ce extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},a=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let o=r,c=0;for(;c<s.path.length;){const l=s.path[c];c===s.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(n(s))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return a(this),r}static assert(t){if(!(t instanceof ce))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,E.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const a of this.issues)if(a.path.length>0){const i=a.path[0];n[i]=n[i]||[],n[i].push(t(a))}else r.push(t(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ce.create=e=>new ce(e);const on=(e,t)=>{let n;switch(e.code){case u.invalid_type:e.received===_.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case u.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,E.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:n=`Unrecognized key(s) in object: ${E.joinValues(e.keys,", ")}`;break;case u.invalid_union:n="Invalid input";break;case u.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${E.joinValues(e.options)}`;break;case u.invalid_enum_value:n=`Invalid enum value. Expected ${E.joinValues(e.options)}, received '${e.received}'`;break;case u.invalid_arguments:n="Invalid function arguments";break;case u.invalid_return_type:n="Invalid function return type";break;case u.invalid_date:n="Invalid date";break;case u.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:E.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case u.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case u.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case u.custom:n="Invalid input";break;case u.invalid_intersection_types:n="Intersection results could not be merged";break;case u.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case u.not_finite:n="Number must be finite";break;default:n=t.defaultError,E.assertNever(e)}return{message:n}};let Ki=on;function Xi(){return Ki}const Yi=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,i=[...n,...a.path||[]],s=v(d({},a),{path:i});if(a.message!==void 0)return v(d({},a),{path:i,message:a.message});let o="";const c=r.filter(l=>!!l).slice().reverse();for(const l of c)o=l(s,{data:t,defaultError:o}).message;return v(d({},a),{path:i,message:o})};function f(e,t){const n=Xi(),r=Yi({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===on?void 0:on].filter(a=>!!a)});e.common.issues.push(r)}class M{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const a of n){if(a.status==="aborted")return g;a.status==="dirty"&&t.dirty(),r.push(a.value)}return{status:t.value,value:r}}static mergeObjectAsync(t,n){return C(this,null,function*(){const r=[];for(const a of n){const i=yield a.key,s=yield a.value;r.push({key:i,value:s})}return M.mergeObjectSync(t,r)})}static mergeObjectSync(t,n){const r={};for(const a of n){const{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return g;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value!="undefined"||a.alwaysSet)&&(r[i.value]=s.value)}return{status:t.value,value:r}}}const g=Object.freeze({status:"aborted"}),Je=e=>({status:"dirty",value:e}),G=e=>({status:"valid",value:e}),Pn=e=>e.status==="aborted",Bn=e=>e.status==="dirty",ze=e=>e.status==="valid",Ct=e=>typeof Promise!="undefined"&&e instanceof Promise;var p;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(p||(p={}));class ae{constructor(t,n,r,a){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Vn=(e,t)=>{if(ze(t))return{success:!0,data:t.value};if(!e.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 ce(e.common.issues);return this._error=n,this._error}}};function b(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(s,o)=>{var l,h;const{message:c}=e;return s.code==="invalid_enum_value"?{message:c!=null?c:o.defaultError}:typeof o.data=="undefined"?{message:(l=c!=null?c:r)!=null?l:o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:(h=c!=null?c:n)!=null?h:o.defaultError}},description:a}}class k{get description(){return this._def.description}_getType(t){return fe(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:fe(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new M,ctx:{common:t.parent.common,data:t.data,parsedType:fe(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Ct(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var i;const r={common:{issues:[],async:(i=n==null?void 0:n.async)!=null?i:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fe(t)},a=this._parseSync({data:t,path:r.path,parent:r});return Vn(r,a)}"~validate"(t){var r,a;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:fe(t)};if(!this["~standard"].async)try{const i=this._parseSync({data:t,path:[],parent:n});return ze(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(a=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(i=>ze(i)?{value:i.value}:{issues:n.common.issues})}parseAsync(t,n){return C(this,null,function*(){const r=yield this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error})}safeParseAsync(t,n){return C(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:t,parsedType:fe(t)},a=this._parse({data:t,path:r.path,parent:r}),i=yield Ct(a)?a:Promise.resolve(a);return Vn(r,i)})}refine(t,n){const r=a=>typeof n=="string"||typeof n=="undefined"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,i)=>{const s=t(a),o=()=>i.addIssue(d({code:u.custom},r(a)));return typeof Promise!="undefined"&&s instanceof Promise?s.then(c=>c?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(t,n){return this._refinement((r,a)=>t(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(t){return new De({schema:this,typeName:m.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 ye.create(this,this._def)}nullable(){return je.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return re.create(this)}promise(){return Zt.create(this,this._def)}or(t){return Rt.create([this,t],this._def)}and(t){return Nt.create(this,t,this._def)}transform(t){return new De(v(d({},b(this._def)),{schema:this,typeName:m.ZodEffects,effect:{type:"transform",transform:t}}))}default(t){const n=typeof t=="function"?t:()=>t;return new fn(v(d({},b(this._def)),{innerType:this,defaultValue:n,typeName:m.ZodDefault}))}brand(){return new ws(d({typeName:m.ZodBranded,type:this},b(this._def)))}catch(t){const n=typeof t=="function"?t:()=>t;return new hn(v(d({},b(this._def)),{innerType:this,catchValue:n,typeName:m.ZodCatch}))}describe(t){const n=this.constructor;return new n(v(d({},this._def),{description:t}))}pipe(t){return Sn.create(this,t)}readonly(){return _n.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Qi=/^c[^\s-]{8,}$/i,es=/^[0-9a-z]+$/,ts=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ns=/^[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,rs=/^[a-z0-9_-]{21}$/i,as=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,is=/^[-+]?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)?)??$/,ss=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,os="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Vt;const ls=/^(?:(?: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])$/,cs=/^(?:(?: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])$/,ds=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,us=/^(([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])$/,fs=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,hs=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Pr="((\\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])))",_s=new RegExp(`^${Pr}$`);function Br(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function ps(e){return new RegExp(`^${Br(e)}$`)}function ms(e){let t=`${Pr}T${Br(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function gs(e,t){return!!((t==="v4"||!t)&&ls.test(e)||(t==="v6"||!t)&&ds.test(e))}function ys(e,t){if(!as.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||t&&a.alg!==t)}catch(n){return!1}}function vs(e,t){return!!((t==="v4"||!t)&&cs.test(e)||(t==="v6"||!t)&&us.test(e))}class le extends k{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==_.string){const i=this._getOrReturnCtx(t);return f(i,{code:u.invalid_type,expected:_.string,received:i.parsedType}),g}const r=new M;let a;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(a=this._getOrReturnCtx(t,a),f(a,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(a=this._getOrReturnCtx(t,a),f(a,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const s=t.data.length>i.value,o=t.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(t,a),s?f(a,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&f(a,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")ss.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"email",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")Vt||(Vt=new RegExp(os,"u")),Vt.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"emoji",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")ns.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"uuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")rs.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"nanoid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Qi.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"cuid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")es.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"cuid2",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")ts.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"ulid",code:u.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch(s){a=this._getOrReturnCtx(t,a),f(a,{validation:"url",code:u.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"regex",code:u.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?ms(i).test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?_s.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?ps(i).test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{code:u.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?is.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"duration",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?gs(t.data,i.version)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"ip",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?ys(t.data,i.alg)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"jwt",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?vs(t.data,i.version)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"cidr",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?fs.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"base64",code:u.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?hs.test(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{validation:"base64url",code:u.invalid_string,message:i.message}),r.dirty()):E.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(a=>t.test(a),d({validation:n,code:u.invalid_string},p.errToObj(r)))}_addCheck(t){return new le(v(d({},this._def),{checks:[...this._def.checks,t]}))}email(t){return this._addCheck(d({kind:"email"},p.errToObj(t)))}url(t){return this._addCheck(d({kind:"url"},p.errToObj(t)))}emoji(t){return this._addCheck(d({kind:"emoji"},p.errToObj(t)))}uuid(t){return this._addCheck(d({kind:"uuid"},p.errToObj(t)))}nanoid(t){return this._addCheck(d({kind:"nanoid"},p.errToObj(t)))}cuid(t){return this._addCheck(d({kind:"cuid"},p.errToObj(t)))}cuid2(t){return this._addCheck(d({kind:"cuid2"},p.errToObj(t)))}ulid(t){return this._addCheck(d({kind:"ulid"},p.errToObj(t)))}base64(t){return this._addCheck(d({kind:"base64"},p.errToObj(t)))}base64url(t){return this._addCheck(d({kind:"base64url"},p.errToObj(t)))}jwt(t){return this._addCheck(d({kind:"jwt"},p.errToObj(t)))}ip(t){return this._addCheck(d({kind:"ip"},p.errToObj(t)))}cidr(t){return this._addCheck(d({kind:"cidr"},p.errToObj(t)))}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck(d({kind:"datetime",precision:typeof(t==null?void 0:t.precision)=="undefined"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!=null?n:!1,local:(r=t==null?void 0:t.local)!=null?r:!1},p.errToObj(t==null?void 0:t.message)))}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck(d({kind:"time",precision:typeof(t==null?void 0:t.precision)=="undefined"?null:t==null?void 0:t.precision},p.errToObj(t==null?void 0:t.message)))}duration(t){return this._addCheck(d({kind:"duration"},p.errToObj(t)))}regex(t,n){return this._addCheck(d({kind:"regex",regex:t},p.errToObj(n)))}includes(t,n){return this._addCheck(d({kind:"includes",value:t,position:n==null?void 0:n.position},p.errToObj(n==null?void 0:n.message)))}startsWith(t,n){return this._addCheck(d({kind:"startsWith",value:t},p.errToObj(n)))}endsWith(t,n){return this._addCheck(d({kind:"endsWith",value:t},p.errToObj(n)))}min(t,n){return this._addCheck(d({kind:"min",value:t},p.errToObj(n)))}max(t,n){return this._addCheck(d({kind:"max",value:t},p.errToObj(n)))}length(t,n){return this._addCheck(d({kind:"length",value:t},p.errToObj(n)))}nonempty(t){return this.min(1,p.errToObj(t))}trim(){return new le(v(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new le(v(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new le(v(d({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}le.create=e=>{var t;return new le(d({checks:[],typeName:m.ZodString,coerce:(t=e==null?void 0:e.coerce)!=null?t:!1},b(e)))};function bs(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r,i=Number.parseInt(e.toFixed(a).replace(".","")),s=Number.parseInt(t.toFixed(a).replace(".",""));return i%s/Rn(10,a)}class Fe extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==_.number){const i=this._getOrReturnCtx(t);return f(i,{code:u.invalid_type,expected:_.number,received:i.parsedType}),g}let r;const a=new M;for(const i of this._def.checks)i.kind==="int"?E.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{code:u.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?bs(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{code:u.not_finite,message:i.message}),a.dirty()):E.assertNever(i);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,p.toString(n))}gt(t,n){return this.setLimit("min",t,!1,p.toString(n))}lte(t,n){return this.setLimit("max",t,!0,p.toString(n))}lt(t,n){return this.setLimit("max",t,!1,p.toString(n))}setLimit(t,n,r,a){return new Fe(v(d({},this._def),{checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:p.toString(a)}]}))}_addCheck(t){return new Fe(v(d({},this._def),{checks:[...this._def.checks,t]}))}int(t){return this._addCheck({kind:"int",message:p.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:p.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:p.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&E.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Fe.create=e=>new Fe(d({checks:[],typeName:m.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1},b(e)));class at extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch(i){return this._getInvalidInput(t)}if(this._getType(t)!==_.bigint)return this._getInvalidInput(t);let r;const a=new M;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),f(r,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):E.assertNever(i);return{status:a.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return f(n,{code:u.invalid_type,expected:_.bigint,received:n.parsedType}),g}gte(t,n){return this.setLimit("min",t,!0,p.toString(n))}gt(t,n){return this.setLimit("min",t,!1,p.toString(n))}lte(t,n){return this.setLimit("max",t,!0,p.toString(n))}lt(t,n){return this.setLimit("max",t,!1,p.toString(n))}setLimit(t,n,r,a){return new at(v(d({},this._def),{checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:p.toString(a)}]}))}_addCheck(t){return new at(v(d({},this._def),{checks:[...this._def.checks,t]}))}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:p.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}at.create=e=>{var t;return new at(d({checks:[],typeName:m.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!=null?t:!1},b(e)))};class ln extends k{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==_.boolean){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.boolean,received:r.parsedType}),g}return G(t.data)}}ln.create=e=>new ln(d({typeName:m.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1},b(e)));class Ot extends k{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==_.date){const i=this._getOrReturnCtx(t);return f(i,{code:u.invalid_type,expected:_.date,received:i.parsedType}),g}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return f(i,{code:u.invalid_date}),g}const r=new M;let a;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(a=this._getOrReturnCtx(t,a),f(a,{code:u.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(a=this._getOrReturnCtx(t,a),f(a,{code:u.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):E.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Ot(v(d({},this._def),{checks:[...this._def.checks,t]}))}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:p.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:p.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Ot.create=e=>new Ot(d({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:m.ZodDate},b(e)));class Hn extends k{_parse(t){if(this._getType(t)!==_.symbol){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.symbol,received:r.parsedType}),g}return G(t.data)}}Hn.create=e=>new Hn(d({typeName:m.ZodSymbol},b(e)));class Wn extends k{_parse(t){if(this._getType(t)!==_.undefined){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.undefined,received:r.parsedType}),g}return G(t.data)}}Wn.create=e=>new Wn(d({typeName:m.ZodUndefined},b(e)));class qn extends k{_parse(t){if(this._getType(t)!==_.null){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.null,received:r.parsedType}),g}return G(t.data)}}qn.create=e=>new qn(d({typeName:m.ZodNull},b(e)));class Gn extends k{constructor(){super(...arguments),this._any=!0}_parse(t){return G(t.data)}}Gn.create=e=>new Gn(d({typeName:m.ZodAny},b(e)));class cn extends k{constructor(){super(...arguments),this._unknown=!0}_parse(t){return G(t.data)}}cn.create=e=>new cn(d({typeName:m.ZodUnknown},b(e)));class ve extends k{_parse(t){const n=this._getOrReturnCtx(t);return f(n,{code:u.invalid_type,expected:_.never,received:n.parsedType}),g}}ve.create=e=>new ve(d({typeName:m.ZodNever},b(e)));class Jn extends k{_parse(t){if(this._getType(t)!==_.undefined){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.void,received:r.parsedType}),g}return G(t.data)}}Jn.create=e=>new Jn(d({typeName:m.ZodVoid},b(e)));class re extends k{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),a=this._def;if(n.parsedType!==_.array)return f(n,{code:u.invalid_type,expected:_.array,received:n.parsedType}),g;if(a.exactLength!==null){const s=n.data.length>a.exactLength.value,o=n.data.length<a.exactLength.value;(s||o)&&(f(n,{code:s?u.too_big:u.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&n.data.length<a.minLength.value&&(f(n,{code:u.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&n.data.length>a.maxLength.value&&(f(n,{code:u.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,o)=>a.type._parseAsync(new ae(n,s,n.path,o)))).then(s=>M.mergeArray(r,s));const i=[...n.data].map((s,o)=>a.type._parseSync(new ae(n,s,n.path,o)));return M.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new re(v(d({},this._def),{minLength:{value:t,message:p.toString(n)}}))}max(t,n){return new re(v(d({},this._def),{maxLength:{value:t,message:p.toString(n)}}))}length(t,n){return new re(v(d({},this._def),{exactLength:{value:t,message:p.toString(n)}}))}nonempty(t){return this.min(1,t)}}re.create=(e,t)=>new re(d({type:e,minLength:null,maxLength:null,exactLength:null,typeName:m.ZodArray},b(t)));function Ce(e){if(e instanceof z){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ye.create(Ce(r))}return new z(v(d({},e._def),{shape:()=>t}))}else return e instanceof re?new re(v(d({},e._def),{type:Ce(e.element)})):e instanceof ye?ye.create(Ce(e.unwrap())):e instanceof je?je.create(Ce(e.unwrap())):e instanceof Te?Te.create(e.items.map(t=>Ce(t))):e}class z extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=E.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==_.object){const l=this._getOrReturnCtx(t);return f(l,{code:u.invalid_type,expected:_.object,received:l.parsedType}),g}const{status:r,ctx:a}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof ve&&this._def.unknownKeys==="strip"))for(const l in a.data)s.includes(l)||o.push(l);const c=[];for(const l of s){const h=i[l],T=a.data[l];c.push({key:{status:"valid",value:l},value:h._parse(new ae(a,T,a.path,l)),alwaysSet:l in a.data})}if(this._def.catchall instanceof ve){const l=this._def.unknownKeys;if(l==="passthrough")for(const h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:a.data[h]}});else if(l==="strict")o.length>0&&(f(a,{code:u.unrecognized_keys,keys:o}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const h of o){const T=a.data[h];c.push({key:{status:"valid",value:h},value:l._parse(new ae(a,T,a.path,h)),alwaysSet:h in a.data})}}return a.common.async?Promise.resolve().then(()=>C(this,null,function*(){const l=[];for(const h of c){const T=yield h.key,y=yield h.value;l.push({key:T,value:y,alwaysSet:h.alwaysSet})}return l})).then(l=>M.mergeObjectSync(r,l)):M.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return p.errToObj,new z(d(v(d({},this._def),{unknownKeys:"strict"}),t!==void 0?{errorMap:(n,r)=>{var i,s,o,c;const a=(o=(s=(i=this._def).errorMap)==null?void 0:s.call(i,n,r).message)!=null?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(c=p.errToObj(t).message)!=null?c:a}:{message:a}}}:{}))}strip(){return new z(v(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new z(v(d({},this._def),{unknownKeys:"passthrough"}))}extend(t){return new z(v(d({},this._def),{shape:()=>d(d({},this._def.shape()),t)}))}merge(t){return new z({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>d(d({},this._def.shape()),t._def.shape()),typeName:m.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new z(v(d({},this._def),{catchall:t}))}pick(t){const n={};for(const r of E.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new z(v(d({},this._def),{shape:()=>n}))}omit(t){const n={};for(const r of E.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new z(v(d({},this._def),{shape:()=>n}))}deepPartial(){return Ce(this)}partial(t){const n={};for(const r of E.objectKeys(this.shape)){const a=this.shape[r];t&&!t[r]?n[r]=a:n[r]=a.optional()}return new z(v(d({},this._def),{shape:()=>n}))}required(t){const n={};for(const r of E.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ye;)i=i._def.innerType;n[r]=i}return new z(v(d({},this._def),{shape:()=>n}))}keyof(){return Vr(E.objectKeys(this.shape))}}z.create=(e,t)=>new z(d({shape:()=>e,unknownKeys:"strip",catchall:ve.create(),typeName:m.ZodObject},b(t)));z.strictCreate=(e,t)=>new z(d({shape:()=>e,unknownKeys:"strict",catchall:ve.create(),typeName:m.ZodObject},b(t)));z.lazycreate=(e,t)=>new z(d({shape:e,unknownKeys:"strip",catchall:ve.create(),typeName:m.ZodObject},b(t)));class Rt extends k{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function a(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const s=i.map(o=>new ce(o.ctx.common.issues));return f(n,{code:u.invalid_union,unionErrors:s}),g}if(n.common.async)return Promise.all(r.map(i=>C(this,null,function*(){const s=v(d({},n),{common:v(d({},n.common),{issues:[]}),parent:null});return{result:yield i._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}}))).then(a);{let i;const s=[];for(const c of r){const l=v(d({},n),{common:v(d({},n.common),{issues:[]}),parent:null}),h=c._parseSync({data:n.data,path:n.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!i&&(i={result:h,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const o=s.map(c=>new ce(c));return f(n,{code:u.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}}Rt.create=(e,t)=>new Rt(d({options:e,typeName:m.ZodUnion},b(t)));function dn(e,t){const n=fe(e),r=fe(t);if(e===t)return{valid:!0,data:e};if(n===_.object&&r===_.object){const a=E.objectKeys(t),i=E.objectKeys(e).filter(o=>a.indexOf(o)!==-1),s=d(d({},e),t);for(const o of i){const c=dn(e[o],t[o]);if(!c.valid)return{valid:!1};s[o]=c.data}return{valid:!0,data:s}}else if(n===_.array&&r===_.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let i=0;i<e.length;i++){const s=e[i],o=t[i],c=dn(s,o);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return n===_.date&&r===_.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Nt extends k{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),a=(i,s)=>{if(Pn(i)||Pn(s))return g;const o=dn(i.value,s.value);return o.valid?((Bn(i)||Bn(s))&&n.dirty(),{status:n.value,value:o.data}):(f(r,{code:u.invalid_intersection_types}),g)};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(([i,s])=>a(i,s)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Nt.create=(e,t,n)=>new Nt(d({left:e,right:t,typeName:m.ZodIntersection},b(n)));class Te extends k{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_.array)return f(r,{code:u.invalid_type,expected:_.array,received:r.parsedType}),g;if(r.data.length<this._def.items.length)return f(r,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&r.data.length>this._def.items.length&&(f(r,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((s,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new ae(r,s,r.path,o)):null}).filter(s=>!!s);return r.common.async?Promise.all(i).then(s=>M.mergeArray(n,s)):M.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Te(v(d({},this._def),{rest:t}))}}Te.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Te(d({items:e,typeName:m.ZodTuple,rest:null},b(t)))};class It extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_.object)return f(r,{code:u.invalid_type,expected:_.object,received:r.parsedType}),g;const a=[],i=this._def.keyType,s=this._def.valueType;for(const o in r.data)a.push({key:i._parse(new ae(r,o,r.path,o)),value:s._parse(new ae(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?M.mergeObjectAsync(n,a):M.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof k?new It(d({keyType:t,valueType:n,typeName:m.ZodRecord},b(r))):new It(d({keyType:le.create(),valueType:t,typeName:m.ZodRecord},b(n)))}}class Kn extends k{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_.map)return f(r,{code:u.invalid_type,expected:_.map,received:r.parsedType}),g;const a=this._def.keyType,i=this._def.valueType,s=[...r.data.entries()].map(([o,c],l)=>({key:a._parse(new ae(r,o,r.path,[l,"key"])),value:i._parse(new ae(r,c,r.path,[l,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(()=>C(this,null,function*(){for(const c of s){const l=yield c.key,h=yield c.value;if(l.status==="aborted"||h.status==="aborted")return g;(l.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(l.value,h.value)}return{status:n.value,value:o}}))}else{const o=new Map;for(const c of s){const l=c.key,h=c.value;if(l.status==="aborted"||h.status==="aborted")return g;(l.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(l.value,h.value)}return{status:n.value,value:o}}}}Kn.create=(e,t,n)=>new Kn(d({valueType:t,keyType:e,typeName:m.ZodMap},b(n)));class it extends k{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==_.set)return f(r,{code:u.invalid_type,expected:_.set,received:r.parsedType}),g;const a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(f(r,{code:u.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),n.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(f(r,{code:u.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const i=this._def.valueType;function s(c){const l=new Set;for(const h of c){if(h.status==="aborted")return g;h.status==="dirty"&&n.dirty(),l.add(h.value)}return{status:n.value,value:l}}const o=[...r.data.values()].map((c,l)=>i._parse(new ae(r,c,r.path,l)));return r.common.async?Promise.all(o).then(c=>s(c)):s(o)}min(t,n){return new it(v(d({},this._def),{minSize:{value:t,message:p.toString(n)}}))}max(t,n){return new it(v(d({},this._def),{maxSize:{value:t,message:p.toString(n)}}))}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}it.create=(e,t)=>new it(d({valueType:e,minSize:null,maxSize:null,typeName:m.ZodSet},b(t)));class Xn extends k{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Xn.create=(e,t)=>new Xn(d({getter:e,typeName:m.ZodLazy},b(t)));class un extends k{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return f(n,{received:n.data,code:u.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:t.data}}get value(){return this._def.value}}un.create=(e,t)=>new un(d({value:e,typeName:m.ZodLiteral},b(t)));function Vr(e,t){return new Le(d({values:e,typeName:m.ZodEnum},b(t)))}class Le extends k{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return f(n,{expected:E.joinValues(r),received:n.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return f(n,{received:n.data,code:u.invalid_enum_value,options:r}),g}return G(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Le.create(t,d(d({},this._def),n))}exclude(t,n=this._def){return Le.create(this.options.filter(r=>!t.includes(r)),d(d({},this._def),n))}}Le.create=Vr;class Yn extends k{_parse(t){const n=E.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==_.string&&r.parsedType!==_.number){const a=E.objectValues(n);return f(r,{expected:E.joinValues(a),received:r.parsedType,code:u.invalid_type}),g}if(this._cache||(this._cache=new Set(E.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const a=E.objectValues(n);return f(r,{received:r.data,code:u.invalid_enum_value,options:a}),g}return G(t.data)}get enum(){return this._def.values}}Yn.create=(e,t)=>new Yn(d({values:e,typeName:m.ZodNativeEnum},b(t)));class Zt extends k{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==_.promise&&n.common.async===!1)return f(n,{code:u.invalid_type,expected:_.promise,received:n.parsedType}),g;const r=n.parsedType===_.promise?n.data:Promise.resolve(n.data);return G(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Zt.create=(e,t)=>new Zt(d({type:e,typeName:m.ZodPromise},b(t)));class De extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===m.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),a=this._def.effect||null,i={addIssue:s=>{f(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const s=a.transform(r.data,i);if(r.common.async)return Promise.resolve(s).then(o=>C(this,null,function*(){if(n.value==="aborted")return g;const c=yield this._def.schema._parseAsync({data:o,path:r.path,parent:r});return c.status==="aborted"?g:c.status==="dirty"||n.value==="dirty"?Je(c.value):c}));{if(n.value==="aborted")return g;const o=this._def.schema._parseSync({data:s,path:r.path,parent:r});return o.status==="aborted"?g:o.status==="dirty"||n.value==="dirty"?Je(o.value):o}}if(a.type==="refinement"){const s=o=>{const c=a.refinement(o,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?g:(o.status==="dirty"&&n.dirty(),s(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"?g:(o.status==="dirty"&&n.dirty(),s(o.value).then(()=>({status:n.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ze(s))return g;const o=a.transform(s.value,i);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(s=>ze(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:n.value,value:o})):g);E.assertNever(a)}}De.create=(e,t,n)=>new De(d({schema:e,typeName:m.ZodEffects,effect:t},b(n)));De.createWithPreprocess=(e,t,n)=>new De(d({schema:t,effect:{type:"preprocess",transform:e},typeName:m.ZodEffects},b(n)));class ye extends k{_parse(t){return this._getType(t)===_.undefined?G(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ye.create=(e,t)=>new ye(d({innerType:e,typeName:m.ZodOptional},b(t)));class je extends k{_parse(t){return this._getType(t)===_.null?G(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}je.create=(e,t)=>new je(d({innerType:e,typeName:m.ZodNullable},b(t)));class fn extends k{_parse(t){const{ctx:n}=this._processInputParams(t);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}}fn.create=(e,t)=>new fn(d({innerType:e,typeName:m.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default},b(t)));class hn extends k{_parse(t){const{ctx:n}=this._processInputParams(t),r=v(d({},n),{common:v(d({},n.common),{issues:[]})}),a=this._def.innerType._parse({data:r.data,path:r.path,parent:d({},r)});return Ct(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ce(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ce(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}hn.create=(e,t)=>new hn(d({innerType:e,typeName:m.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch},b(t)));class Qn extends k{_parse(t){if(this._getType(t)!==_.nan){const r=this._getOrReturnCtx(t);return f(r,{code:u.invalid_type,expected:_.nan,received:r.parsedType}),g}return{status:"valid",value:t.data}}}Qn.create=e=>new Qn(d({typeName:m.ZodNaN},b(e)));class ws extends k{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Sn extends k{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return C(this,null,function*(){const i=yield this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?g:i.status==="dirty"?(n.dirty(),Je(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})});{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?g:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(t,n){return new Sn({in:t,out:n,typeName:m.ZodPipeline})}}class _n extends k{_parse(t){const n=this._def.innerType._parse(t),r=a=>(ze(a)&&(a.value=Object.freeze(a.value)),a);return Ct(n)?n.then(a=>r(a)):r(n)}unwrap(){return this._def.innerType}}_n.create=(e,t)=>new _n(d({innerType:e,typeName:m.ZodReadonly},b(t)));var m;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(m||(m={}));const We=le.create,xs=Fe.create,J=ln.create,ks=cn.create;ve.create;const er=re.create,bt=z.create,Ss=Rt.create;Nt.create;Te.create;const Ts=It.create,tr=un.create,wt=Le.create;Zt.create;ye.create;je.create;const Es=bt({language:wt(["typescript","javascript"]).optional(),disableMarkedForExport:J().optional(),allowAutoSelectFirstNode:J().optional().default(!0),enableDisplayDataId:J().optional(),enableDisplayDataName:J().optional()}).and(Ss([bt({framework:tr("react"),model:We().optional(),styling:wt(["plain_css","tailwind","inline_styles"]),uiLibrary:wt(["mui","antd","radix","shadcn","clean_react","custom_design_system"]).optional(),responsivePages:er(bt({name:We(),framesId:er(We())})).optional(),enableUILibraryTheming:J().optional(),enableCompactStructure:J().optional(),enableDisplayScreenModelId:J().optional(),enableGeneratePackageLock:J().optional(),enableAnimationsPreset:J().optional(),enableAutoSplit:J().optional(),autoSplitThreshold:xs().optional(),url:We().url().optional(),codegenSettings:Ts(ks()).optional(),designSystemId:We().optional()}),bt({framework:tr("html"),styling:wt(["plain_css","inline_styles","tailwind"]),enableTranslation:J().optional()})])),Hr=e=>{const t=Es.safeParse(e);if(t.success===!1){const n=new Error("Invalid codegen settings");throw n.cause=t.error,n}return t.data},Tn=(e,t)=>{if(e.id===t)return e;if("children"in e)for(const n of e.children){const r=Tn(n,t);if(r)return r}return null},nr=new Set(["FRAME","INSTANCE","COMPONENT","COMPONENT_SET","GROUP"]),Wr=(e,t,n={allowAutoSelectFirstNode:!0})=>{const r=Tn(e.document,t);if(!r)return{isValid:!1,reason:"There is no node with the given id"};if(r.type==="CANVAS"){const a=r.children.filter(i=>nr.has(i.type));return a.length===0?{isValid:!1,reason:"Selected node is a page with no valid children"}:a.length===1?{isValid:!0,node:a[0],note:"Selected node is a page with a single valid children - returning it instead"}:n.allowAutoSelectFirstNode?{isValid:!0,node:a[0],note:"Selected node is a page with multiple valid children - returning the first one instead"}:{isValid:!1,reason:"Selected node is a page with multiple children"}}return nr.has(r.type)?{isValid:!0,node:r}:{isValid:!1,reason:"Selected node type is not supported"}};function As(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var kt={exports:{}},Cs=kt.exports,rr;function Os(){return rr||(rr=1,(function(e,t){(function(n,r){e.exports=r()})(Cs,(function(){var n=typeof Promise=="function",r=(function(R){if(typeof globalThis=="object")return globalThis;Object.defineProperty(R,"typeDetectGlobalObject",{get:function(){return this},configurable:!0});var be=typeDetectGlobalObject;return delete R.typeDetectGlobalObject,be})(Object.prototype),a=typeof Symbol!="undefined",i=typeof Map!="undefined",s=typeof Set!="undefined",o=typeof WeakMap!="undefined",c=typeof WeakSet!="undefined",l=typeof DataView!="undefined",h=a&&typeof Symbol.iterator!="undefined",T=a&&typeof Symbol.toStringTag!="undefined",y=s&&typeof Set.prototype.entries=="function",N=i&&typeof Map.prototype.entries=="function",I=y&&Object.getPrototypeOf(new Set().entries()),P=N&&Object.getPrototypeOf(new Map().entries()),Be=h&&typeof Array.prototype[Symbol.iterator]=="function",ht=Be&&Object.getPrototypeOf([][Symbol.iterator]()),Ve=h&&typeof String.prototype[Symbol.iterator]=="function",_t=Ve&&Object.getPrototypeOf(""[Symbol.iterator]()),pt=8,mt=-1;function gt(R){var be=typeof R;if(be!=="object")return be;if(R===null)return"null";if(R===r)return"global";if(Array.isArray(R)&&(T===!1||!(Symbol.toStringTag in R)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&R===window.location)return"Location";if(typeof window.document=="object"&&R===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&R===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&R===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&R instanceof window.HTMLElement){if(R.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(R.tagName==="TD")return"HTMLTableDataCellElement";if(R.tagName==="TH")return"HTMLTableHeaderCellElement"}}var Ee=T&&R[Symbol.toStringTag];if(typeof Ee=="string")return Ee;var Z=Object.getPrototypeOf(R);return Z===RegExp.prototype?"RegExp":Z===Date.prototype?"Date":n&&Z===Promise.prototype?"Promise":s&&Z===Set.prototype?"Set":i&&Z===Map.prototype?"Map":c&&Z===WeakSet.prototype?"WeakSet":o&&Z===WeakMap.prototype?"WeakMap":l&&Z===DataView.prototype?"DataView":i&&Z===P?"Map Iterator":s&&Z===I?"Set Iterator":Be&&Z===ht?"Array Iterator":Ve&&Z===_t?"String Iterator":Z===null?"Object":Object.prototype.toString.call(R).slice(pt,mt)}return gt}))})(kt)),kt.exports}var Rs=Os();const Ns=As(Rs),En=typeof Buffer!="undefined",Is=En&&typeof Buffer.from!="undefined",Zs=En?function(t){return Buffer.isBuffer(t)}:function(){return!1},zs=Is?function(t){return Buffer.from(t)}:En?function(t){return new Buffer(t)}:function(t){return t};function Me(e){return Zs(e)?"Buffer":Ns(e)}const Fs=new Set(["Arguments","Array","Map","Object","Set"]);function Ls(e,t,n=null){switch(n||Me(e)){case"Arguments":case"Array":case"Object":return e[t];case"Map":return e.get(t);case"Set":return t}}function pn(e){return Fs.has(e)}function ar(e,t,n,r=null){switch(r||Me(e)){case"Arguments":case"Array":case"Object":e[t]=n;break;case"Map":e.set(t,n);break;case"Set":e.add(n);break}return e}const Ds=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,js=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,Ms=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,Ht=Ds||js||Ms||Function("return this")();function $s(e){return e.slice(0)}function Us(e){return new Boolean(e.valueOf())}function Ps(e){return new DataView(e.buffer)}function Bs(e){return zs(e)}function Vs(e){return new Date(e.getTime())}function Hs(e){return new Number(e)}function Ws(e){return new RegExp(e.source,e.flags)}function qs(e){return new String(e)}function ie(e,t){return Ht[t].from?Ht[t].from(e):new Ht[t](e)}function D(e){return e}function ir(){return[]}function Gs(){return new Map}function Js(){return{}}function Ks(){return new Set}const Xs=new Map([["ArrayBuffer",$s],["Boolean",Us],["Buffer",Bs],["DataView",Ps],["Date",Vs],["Number",Hs],["RegExp",Ws],["String",qs],["Float32Array",ie],["Float64Array",ie],["Int16Array",ie],["Int32Array",ie],["Int8Array",ie],["Uint16Array",ie],["Uint32Array",ie],["Uint8Array",ie],["Uint8ClampedArray",ie],["Array Iterator",D],["Map Iterator",D],["Promise",D],["Set Iterator",D],["String Iterator",D],["function",D],["global",D],["WeakMap",D],["WeakSet",D],["boolean",D],["null",D],["number",D],["string",D],["symbol",D],["undefined",D],["Arguments",ir],["Array",ir],["Map",Gs],["Object",Js],["Set",Ks]]);function Ys(){}function mn(e,t=null,n=Ys){arguments.length===2&&typeof t=="function"&&(n=t,t=null);const r=t||Me(e),a=Xs.get(r);if(r==="Object"){const i=n(e,r);if(i!==void 0)return i}return a?a(e,r):e}function sr(e,t={}){typeof t=="function"&&(t={customizer:t});const{customizer:n}=t,r=Me(e);if(!pn(r))return gn(e,null,null,null);const a=mn(e,r,n),i=new WeakMap([[e,a]]),s=new WeakSet([e]);return gn(e,a,i,s)}function gn(e,t,n,r,a){const i=Me(e),s=mn(e,i);if(!pn(i))return s;let o;switch(i){case"Arguments":case"Array":o=Object.keys(e);break;case"Object":o=Object.keys(e),o.push(...Object.getOwnPropertySymbols(e));break;case"Map":case"Set":o=e.keys();break}for(let c of o){const l=Ls(e,c,i);if(r.has(l))ar(t,c,n.get(l),i);else{const h=Me(l),T=mn(l,h);pn(h)&&(n.set(l,T),r.add(l)),ar(t,c,gn(l,T,n,r),i)}}return t}var st,Ne,oe,W,U,yn,St,Ke;class qr{constructor({fetch:t=globalThis.fetch.bind(globalThis),baseAddress:n="https://api.figma.com/",defaultOptions:r={}}={}){X(this,U);X(this,st);X(this,Ne);X(this,oe);X(this,W);H(this,st,n),H(this,Ne,t),H(this,W,r),H(this,oe,w(this,W)),r.token&&L(this,U,yn).call(this,r.token)}hasDefaultToken(){return!!w(this,W).token}updateDefaultOptions(t){t.token&&L(this,U,yn).call(this,t.token),H(this,W,d(d({},w(this,W)),t)),H(this,oe,w(this,W))}withOptions(t){return H(this,oe,d(d(d({},w(this,W)),w(this,oe)),t)),this}getHeaders(t){const n={"Content-Type":"application/json"},r=t!=null?t:w(this,W).token;if(r!=null&&r.startsWith("figd_"))n["X-FIGMA-TOKEN"]=r;else if(r!=null&&r.startsWith("figu_"))n.Authorization=`Bearer ${r}`;else throw new zr;return n}getFile(a){return C(this,arguments,function*({fileKey:t,nodeIds:n=[],depth:r}){const i=new URLSearchParams({plugin_data:"857346721138427857",geometry:"paths"});n.length>0&&i.append("ids",n.join(",")),r&&i.append("depth",`${r}`);const s=i.toString(),o=`v1/files/${t}?${s}`;return yield L(this,U,Ke).call(this,o)})}getNodeImages(s){return C(this,arguments,function*({fileKey:t,nodeIds:n,scale:r=1,as:a="arrayBuffer",format:i="jpg"}){const c=(yield L(this,U,Ke).call(this,`v1/images/${t}?ids=${n}&format=${i}&scale=${r}`)).images;if(a==="links")return c;const l=n.map(y=>C(this,null,function*(){const N=c[y];if(!N)return null;const I=yield w(this,Ne).call(this,N);return I.ok?yield I.arrayBuffer():null})),h=yield Promise.allSettled(l);return n.reduce((y,N,I)=>{const P=h[I];return P.status==="fulfilled"?y[N]=P.value:y[N]=null,y},{})})}getImageFills(n){return C(this,arguments,function*({fileKey:t}){var i,s;const r=`v1/files/${t}/images`;return(s=(i=(yield L(this,U,Ke).call(this,r)).meta)==null?void 0:i.images)!=null?s:{}})}getMe(){return C(this,null,function*(){return yield L(this,U,Ke).call(this,"v1/me")})}}st=new WeakMap,Ne=new WeakMap,oe=new WeakMap,W=new WeakMap,U=new WeakSet,yn=function(t){if(!t.startsWith("figd_")&&!t.startsWith("figu_"))throw new Zr},St=function(t,n){return C(this,null,function*(){var a;const r=yield n();if(!r.ok){const i=r.status;let s=null;try{s=yield r.text()}catch(o){}if(i===403)throw s!=null&&s.includes("Invalid token")?new tn:s!=null&&s.includes("Token expired")?new nn:s!=null&&s.includes("File not exportable")?new rn:new an({reason:s});if(i===404)throw new Lr({cause:r});if(i===429){const o=r.headers.get("Retry-After"),c=o?Number(o):null;if(!c)throw new sn({cause:r});if(yield(a=t.onRateLimited)==null?void 0:a.call(t,{retryAfter:c,figmaPlanTier:r.headers.get("X-Figma-Plan-Tier"),figmaRateLimitType:r.headers.get("X-Figma-Rate-Limit-Type")}))return new Promise((h,T)=>{var N;const y=setTimeout(()=>{var I;(I=t.abortSignal)!=null&&I.aborted||L(this,U,St).call(this,t,n).then(h).catch(T)},c*1e3+1e3);(N=t.abortSignal)==null||N.addEventListener("abort",()=>{clearTimeout(y),T(new Error("The operation was aborted."))})});throw new sn({cause:r})}else throw i===500&&(s!=null&&s.includes("Request too large"))?new Ur({cause:r}):new jr({cause:r})}return r})},Ke=function(t){return C(this,null,function*(){const n=sr(w(this,oe));H(this,oe,sr(w(this,W)));const r=()=>C(this,null,function*(){return yield w(this,Ne).call(this,`${w(this,st)}${t}`,{method:"GET",headers:this.getHeaders(n.token),signal:n.abortSignal})});try{return yield(yield L(this,U,St).call(this,n,r)).json()}catch(a){if(n.onForbidden&&(a instanceof tn||a instanceof nn||a instanceof rn||a instanceof an)){const i=yield n.onForbidden(a);if(i)return n.token=i.retry.newToken,yield(yield L(this,U,St).call(this,n,r)).json()}throw a}})};const Qs={codegen:"f2c",l2c:"l2c",p2c:"p2c"};var O,ot,lt,ee,Gr,Oe;class eo{constructor({auth:t,apiBaseAddress:n="https://public-api.animaapp.com",figmaRestApi:r=new qr}={}){X(this,ee);X(this,O);X(this,ot);X(this,lt);H(this,ot,n),H(this,lt,r),t&&(this.auth=t)}hasAuth(){return!!w(this,O)}set auth(t){H(this,O,t)}get headers(){const t={"Content-Type":"application/json"};return w(this,O)&&(t.Authorization=`Bearer ${w(this,O).token}`,"teamId"in w(this,O)&&(t["X-Team-Id"]=w(this,O).teamId)),t}generateCode(a){return C(this,arguments,function*(t,n={},r){var l;let i;try{i=yield w(this,lt).withOptions({token:t.figmaToken,abortSignal:r}).getFile({fileKey:t.fileKey})}catch(h){if(h instanceof Error&&h.name==="AbortError")throw h}const s=Hr(t.settings);i&&(yield L(this,ee,Gr).call(this,i,t.nodesId,{allowAutoSelectFirstNode:(l=s.allowAutoSelectFirstNode)!=null?l:!0}));let o=t.tracking;w(this,O)&&"userId"in w(this,O)&&w(this,O).userId&&(o!=null&&o.externalId||(o={externalId:w(this,O).userId}));const c={tracking:o,fileKey:t.fileKey,figmaToken:t.figmaToken,nodesId:t.nodesId,figmaRateLimitMaxWait:t.figmaRateLimitMaxWait,assetsStorage:t.assetsStorage,language:s.language,model:s.model,framework:s.framework,styling:s.styling,uiLibrary:s.uiLibrary,enableTranslation:s.enableTranslation,enableUILibraryTheming:s.enableUILibraryTheming,enableCompactStructure:s.enableCompactStructure,enableAutoSplit:s.enableAutoSplit,autoSplitThreshold:s.autoSplitThreshold,disableMarkedForExport:s.disableMarkedForExport,allowAutoSelectFirstNode:s.allowAutoSelectFirstNode,enableDisplayScreenModelId:s.enableDisplayScreenModelId,enableGeneratePackageLock:s.enableGeneratePackageLock,enableAnimationsPreset:s.enableAnimationsPreset,enableDisplayDataId:s.enableDisplayDataId,enableDisplayDataName:s.enableDisplayDataName,codegenSettings:s.codegenSettings,webhookUrl:t.webhookUrl,prompt:t.prompt,images:t.images,createSession:t.createSession};return L(this,ee,Oe).call(this,"POST","/v1/codegen",c,n,"codegen",r)})}generateCodeFromWebsite(a){return C(this,arguments,function*(t,n={},r){let i=t.tracking;w(this,O)&&"userId"in w(this,O)&&w(this,O).userId&&(i!=null&&i.externalId||(i={externalId:w(this,O).userId}));let s;if(t.mhtmlUrl)s={type:"hosted-mhtml",mhtmlUrl:t.mhtmlUrl,url:t.url};else if(t.mhtml)s={type:"mhtml",mhtml:t.mhtml,url:t.url};else if(t.url)s={type:"url",url:t.url};else throw new Error("Either 'url', 'mhtml' or 'mhtmlUrl' must be provided");let o;t.experimental_useNewReactEngine&&(o="react-v2");const c={tracking:i,assetsStorage:t.assetsStorage,prompt:t.prompt,images:t.images,params:{input:s,conventions:{framework:t.settings.framework,language:t.settings.language,styling:t.settings.styling},assetsStorage:{type:"bundled"},engine:o}};return L(this,ee,Oe).call(this,"POST","/v1/l2c",c,n,"l2c",r)})}generateCodeFromPrompt(a){return C(this,arguments,function*(t,n={},r){var o;let i=t.tracking;w(this,O)&&"userId"in w(this,O)&&w(this,O).userId&&(i!=null&&i.externalId||(i={externalId:w(this,O).userId}));const s={tracking:i,assetsStorage:t.assetsStorage,params:d({prompt:t.prompt,guidelines:t.guidelines,images:t.images,conventions:{language:t.settings.language,framework:t.settings.framework,styling:t.settings.styling,uiLibrary:t.settings.uiLibrary}},(o=t.settings.codegenSettings)!=null?o:{}),webhookUrl:t.webhookUrl};return L(this,ee,Oe).call(this,"POST","/v1/p2c",s,n,"p2c",r)})}generateLink2Code(a){return C(this,arguments,function*(t,n={},r){let i=t.tracking;w(this,O)&&"userId"in w(this,O)&&w(this,O).userId&&(i!=null&&i.externalId||(i={externalId:w(this,O).userId}));const s={tracking:i,assetsStorage:t.assetsStorage,params:t.params};return L(this,ee,Oe).call(this,"POST","/v1/l2c",s,n,"l2c",r)})}attachToGenerationJob(a){return C(this,arguments,function*(t,n={},r){const i={};return L(this,ee,Oe).call(this,"GET",`/v1/jobs/${t.sessionId}`,i,n,void 0,r)})}}O=new WeakMap,ot=new WeakMap,lt=new WeakMap,ee=new WeakSet,Gr=function(t,n,r){return C(this,null,function*(){const i=n.map(s=>Wr(t,s,r)).find(s=>!s.isValid);if(i)throw new ue({name:"Task Crashed",reason:i.reason})})},Oe=function(t,n,r,a,i,s){return C(this,null,function*(){var P,Be,ht,Ve,_t,pt,mt,gt,R,be,Ee;if(this.hasAuth()===!1)throw new Error('It needs to set "auth" before calling this method.');const o={},c={method:t,headers:v(d({},this.headers),{Accept:"text/event-stream"}),signal:s};if(t==="POST"){const Z=Hi(JSON.stringify(r));c.body=Z,c.headers=v(d({},c.headers),{"Content-Encoding":"gzip","Content-Type":"application/json"})}const l=yield fetch(`${w(this,ot)}${n}`,c);if(!l.ok){const Z=yield l.text();let K;try{K=JSON.parse(Z)}catch(Lt){}throw((P=K==null?void 0:K.error)==null?void 0:P.name)==="ZodError"?(console.log("Zod validation error:",JSON.stringify(K.error.issues,null,2)),new ue({name:"HTTP error from Anima API",reason:"Invalid body payload",detail:K.error.issues,status:l.status})):typeof K=="object"?new ue({name:`Error "${K}"`,reason:"Unknown",status:l.status}):new ue({name:"HTTP error from Anima API",reason:Z,status:l.status})}if(!l.body)throw new ue({name:"Stream Error",reason:"Response body is null",status:l.status});const h=l.headers.get("x-anima-job-type"),T=h&&Qs[h];T&&typeof a=="function"&&a({type:"set_job_type",payload:{jobType:T}});const y=l.body.getReader(),N=new TextDecoder;let I="";try{for(;;){const{done:Z,value:K}=yield y.read();if(Z)break;I+=N.decode(K,{stream:!0});const Lt=I.split(`
2
+ `);I=Lt.pop()||"";for(const yt of Lt)if(!(!yt.trim()||yt.startsWith(":"))&&yt.startsWith("data: ")){let S;try{S=JSON.parse(yt.slice(6))}catch(_o){continue}switch(S.type){case"queueing":{typeof a=="function"?a(S):(Be=a.onQueueing)==null||Be.call(a,{sessionId:S.sessionId});break}case"start":{o.sessionId=S.sessionId,typeof a=="function"?a(S):(ht=a.onStart)==null||ht.call(a,{sessionId:S.sessionId});break}case"pre_codegen":{i==="codegen"&&(typeof a=="function"?a(S):(Ve=a.onPreCodegen)==null||Ve.call(a,{message:S.message}));break}case"assets_uploaded":{typeof a=="function"?a(S):(_t=a.onAssetsUploaded)==null||_t.call(a);break}case"assets_list":{o.assets=S.payload.assets,typeof a=="function"?a(S):(pt=a.onAssetsList)==null||pt.call(a,S.payload);break}case"figma_metadata":{i==="codegen"&&(o.figmaFileName=S.figmaFileName,o.figmaSelectedFrameName=S.figmaSelectedFrameName,typeof a=="function"?a(S):(mt=a.onFigmaMetadata)==null||mt.call(a,{figmaFileName:S.figmaFileName,figmaSelectedFrameName:S.figmaSelectedFrameName}));break}case"generating_code":{S.payload.status==="success"&&(o.files=S.payload.files),typeof a=="function"?a(S):(gt=a.onGeneratingCode)==null||gt.call(a,{status:S.payload.status,progress:S.payload.progress,files:S.payload.files});break}case"progress_messages_updated":{typeof a=="function"?a(S):(R=a.onProgressMessagesUpdated)==null||R.call(a,S.payload.progressMessages);break}case"job_status_updated":{typeof a=="function"?a(S):(be=a.onJobStatusUpdated)==null||be.call(a,S.payload.jobStatus);break}case"codegen_completed":case"generation_completed":{typeof a=="function"?a(S):(Ee=a.onCodegenCompleted)==null||Ee.call(a);break}case"error":throw new ue({name:S.payload.errorName,reason:S.payload.reason});case"done":return o.tokenUsage=S.payload.tokenUsage,o.sessionId=S.payload.sessionId,o}}}}finally{y.cancel()}throw new ue({name:"Connection",reason:"Connection closed before the 'done' message",status:500})})};const to=e=>{var t;if(!e)return[!1,"",""];try{const n=new URL(e),r=n.pathname;if(n.origin!=="https://www.figma.com"&&n.origin!=="https://embed.figma.com")return[!1,"",""];const a=n.toString();if(e!==a)return[!1,"",""];const i=((t=n.searchParams.get("node-id"))!=null?t:"").replace(/-/g,":"),s=r.split("/")[2];return[(r.startsWith("/file/")&&n.searchParams.get("type")!=="whiteboard"||r.startsWith("/design/")||r.startsWith("/proto/"))&&s.length===22,s,i]}catch(n){return[!1,"",""]}},no=({fileKey:e,nodeId:t,duplicate:n})=>{const r=new URL("https://www.figma.com");return r.pathname=`design/${e}`,n&&(r.pathname=`${r.pathname}/dummy/duplicate`),t&&r.searchParams.set("node-id",t.replace(":","-")),r};class ro extends Error{constructor(t,n){super(t),this.response=n}}const ao=({files:e,screenPath:t="src/screens"})=>{const n={},r=new Set;function a(i){if(r.has(i)||!e[i])return;r.add(i),n[i]=e[i],io(e[i].content).forEach(o=>{try{const c=so(i,o);if(c.startsWith("src/")){const l=c.split("/").slice(0,-1).join("/");oo(e,l).forEach(T=>{r.has(T)||a(T)})}}catch(c){console.warn(`Failed to resolve import ${o} in ${i}:`,c)}})}return Object.entries(e).forEach(([i,s])=>{i.startsWith(t)?a(i):i.startsWith("src/")||(n[i]=s)}),n};function io(e){const t=/import.*?["']([^"']+)["']/g,n=/export.*from\s+["']([^"']+)["']/g,r=[];let a;for(;(a=t.exec(e))!==null;)r.push(a[1]);for(;(a=n.exec(e))!==null;)r.push(a[1]);return[...new Set(r)]}function so(e,t){if(!t.startsWith("."))return t;const n=e.split("/").slice(0,-1),r=t.split("/"),a=[...n];for(const i of r)i===".."?a.pop():i!=="."&&a.push(i);return a.join("/")}function oo(e,t){return Object.keys(e).filter(n=>n.startsWith(t))}function ut(e,t,n){return new ReadableStream({start(r){n.call(e,t,a=>{a.type==="error"||r.enqueue(a),(a.type==="aborted"||a.type==="error")&&r.close()}).then(a=>{r.enqueue({type:"done",payload:{tokenUsage:a.tokenUsage,sessionId:a.sessionId}}),r.close()}).catch(a=>{r.enqueue({type:"error",payload:{name:"name"in a?a.name:"Unknown error",message:"message"in a?a.message:"Unknown",status:"status"in a?a.status:void 0,detail:"detail"in a?a.detail:void 0,errorPayload:"payload"in a?a.payload:void 0}}),r.close()})}})}const Jr=(e,t)=>ut(e,t,e.generateCode);function ft(e){return C(this,null,function*(){var s,o,c,l;const[t,n]=e.tee(),r=yield t.getReader().read();if(r.done||!r.value||r.value.type==="error"&&((s=r.value.payload)!=null&&s.status))return new Response(JSON.stringify(r.value),{status:((o=r.value)==null?void 0:o.type)==="error"&&(l=(c=r.value.payload)==null?void 0:c.status)!=null?l:500,headers:{"Content-Type":"application/json"}});const a=new TextEncoder,i=n.pipeThrough(new TransformStream({transform(h,T){const y=`event: ${h.type}
3
3
  data: ${JSON.stringify(h)}
4
4
 
5
- `;T.enqueue(a.encode(y))}}));return new Response(i,{status:200,headers:{"Content-Type":"text/event-stream; charset=utf-8",Connection:"keep-alive","Cache-Control":"no-cache"}})})}const lo=(e,t)=>C(null,null,function*(){const n=Jr(e,t);return ut(n)}),Kr=(e,t)=>dt(e,t,e.generateCodeFromWebsite),co=(e,t)=>C(null,null,function*(){const n=Kr(e,t);return ut(n)}),Xr=(e,t)=>dt(e,t,e.generateCodeFromPrompt),uo=(e,t)=>C(null,null,function*(){const n=Xr(e,t);return ut(n)}),Yr=(e,t)=>dt(e,t,e.attachToGenerationJob),fo=(e,t)=>C(null,null,function*(){const n=Yr(e,t);return ut(n)}),Qr=(e,t)=>dt(e,t,e.generateLink2Code),ho=(e,t)=>C(null,null,function*(){const n=Qr(e,t);return ut(n)});exports.Anima=eo;exports.CodegenError=ue;exports.ExpiredFigmaToken=nn;exports.FigmaRestApi=qr;exports.FileNotExportable=rn;exports.MalformattedFigmaToken=Zr;exports.MissingFigmaToken=zr;exports.NeedsReauthFigmaToken=tn;exports.NotFound=Lr;exports.RateLimitExceeded=sn;exports.RequestTooLarge=Ur;exports.ResponseError=ro;exports.UnknownFigmaApiException=jr;exports.UnknownForbiddenFigmaError=an;exports.attachToGenerationJobResponseEventStream=fo;exports.attachToGenerationJobStream=Yr;exports.createCodeFromPromptResponseEventStream=uo;exports.createCodeFromPromptStream=Xr;exports.createCodeFromWebsiteResponseEventStream=co;exports.createCodeFromWebsiteStream=Kr;exports.createCodegenResponseEventStream=lo;exports.createCodegenStream=Jr;exports.createLink2CodeResponseEventStream=ho;exports.createLink2CodeStream=Qr;exports.findChildrenNode=Tn;exports.formatToFigmaLink=no;exports.getRelatedScreenFiles=ao;exports.isNodeCodegenCompatible=Wr;exports.isNotFound=Wi;exports.isRateLimitExceeded=Gi;exports.isRequestTooLarge=Ji;exports.isUnknownFigmaApiException=qi;exports.isValidFigmaUrl=to;exports.validateSettings=Hr;
5
+ `;T.enqueue(a.encode(y))}}));return new Response(i,{status:200,headers:{"Content-Type":"text/event-stream; charset=utf-8",Connection:"keep-alive","Cache-Control":"no-cache"}})})}const lo=(e,t)=>C(null,null,function*(){const n=Jr(e,t);return ft(n)}),Kr=(e,t)=>ut(e,t,e.generateCodeFromWebsite),co=(e,t)=>C(null,null,function*(){const n=Kr(e,t);return ft(n)}),Xr=(e,t)=>ut(e,t,e.generateCodeFromPrompt),uo=(e,t)=>C(null,null,function*(){const n=Xr(e,t);return ft(n)}),Yr=(e,t)=>ut(e,t,e.attachToGenerationJob),fo=(e,t)=>C(null,null,function*(){const n=Yr(e,t);return ft(n)}),Qr=(e,t)=>ut(e,t,e.generateLink2Code),ho=(e,t)=>C(null,null,function*(){const n=Qr(e,t);return ft(n)});exports.Anima=eo;exports.CodegenError=ue;exports.ExpiredFigmaToken=nn;exports.FigmaRestApi=qr;exports.FileNotExportable=rn;exports.MalformattedFigmaToken=Zr;exports.MissingFigmaToken=zr;exports.NeedsReauthFigmaToken=tn;exports.NotFound=Lr;exports.RateLimitExceeded=sn;exports.RequestTooLarge=Ur;exports.ResponseError=ro;exports.UnknownFigmaApiException=jr;exports.UnknownForbiddenFigmaError=an;exports.attachToGenerationJobResponseEventStream=fo;exports.attachToGenerationJobStream=Yr;exports.createCodeFromPromptResponseEventStream=uo;exports.createCodeFromPromptStream=Xr;exports.createCodeFromWebsiteResponseEventStream=co;exports.createCodeFromWebsiteStream=Kr;exports.createCodegenResponseEventStream=lo;exports.createCodegenStream=Jr;exports.createLink2CodeResponseEventStream=ho;exports.createLink2CodeStream=Qr;exports.findChildrenNode=Tn;exports.formatToFigmaLink=no;exports.getRelatedScreenFiles=ao;exports.isNodeCodegenCompatible=Wr;exports.isNotFound=Wi;exports.isRateLimitExceeded=Gi;exports.isRequestTooLarge=Ji;exports.isUnknownFigmaApiException=qi;exports.isValidFigmaUrl=to;exports.validateSettings=Hr;
6
6
  //# sourceMappingURL=index.cjs.map