@txnlab/use-wallet-ui-react 0.4.0 → 0.4.1

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.
@@ -65,7 +65,7 @@
65
65
  ${Mo}
66
66
  }
67
67
  }
68
- `,document.head.appendChild(e)}const Nh=()=>new bh({defaultOptions:{queries:{staleTime:5*60*1e3,gcTime:60*60*1e3,refetchOnWindowFocus:!0,refetchInterval:10*60*1e3,retry:(e,t)=>t instanceof Error&&t.message.includes("404")?!1:e<3}}}),ec=O.createContext(void 0);function Lh({enabled:e,nfdView:t}){const n=Xl(),{activeAddress:r,activeWallet:o,algodClient:i}=xt.useWallet(),{activeNetwork:s}=xt.useNetwork(),a=O.useRef(null);return O.useEffect(()=>{if(!e){a.current=r;return}const l=a.current===null&&r!==null&&o!==null&&o.accounts!==void 0&&o.accounts.length>0&&i!==void 0;if(a.current=r,!l)return;console.log(`[WalletUI] Prefetching data for all accounts in wallet ${o.id}`);const c=o.accounts.map(d=>d.address);if(c.length>0){const h=[];for(let m=0;m<c.length;m+=20)h.push(c.slice(m,m+20));h.forEach(async m=>{const x=s==="testnet"?"https://api.testnet.nf.domains":"https://api.nf.domains",b=new URLSearchParams;m.forEach(R=>{b.append("address",R)}),b.append("view",t);try{const R=await fetch(`${x}/nfd/lookup?${b.toString()}`,{method:"GET",headers:{Accept:"application/json"}});if(!R.ok&&R.status!==404)throw new Error(`NFD prefetch lookup failed: ${R.statusText}`);const $=R.status===404?{}:await R.json();m.forEach(w=>{const T=$[w]||null;n.setQueryData(["nfd",w,s,t],T)})}catch(R){console.error("Error prefetching NFD data:",R)}})}c.forEach(d=>{n.prefetchQuery({queryKey:["account-balance",d],queryFn:async()=>{try{const h=await i.accountInformation(d).do();return Number(h.amount)}catch(h){throw new Error(`Error fetching account balance: ${h}`)}}})})},[r,o,s,t,i,n,e]),null}function jh({children:e,queryClient:t,enablePrefetching:n=!0,prefetchNfdView:r="thumbnail",theme:o="system"}){const i=O.useMemo(()=>t||Nh(),[t]),s=Zl(o);O.useEffect(()=>{Dh()},[]);const a=O.useMemo(()=>({queryClient:i,theme:o,resolvedTheme:s}),[i,o,s]),l=o==="system"?void 0:o,c=L.jsx(ec.Provider,{value:a,children:L.jsxs("div",{"data-wallet-ui":!0,"data-theme":l,children:[L.jsx(Lh,{enabled:n,nfdView:r}),e]})});return t?c:L.jsx(Jl,{client:i,children:c})}function uo(){const e=O.useContext(ec);if(e===void 0)throw new Error("useWalletUI must be used within a WalletUIProvider");return e}function tc({wallets:e,handleWalletClick:t}){return L.jsxs("ul",{className:"space-y-1.5",children:[e.map(n=>L.jsx("li",{children:L.jsxs("button",{onClick:()=>t(n),className:"flex w-full items-center gap-3 py-1.5 px-1.5 text-left text-[var(--wui-color-text)] transition-colors hover:bg-[var(--wui-color-bg-hover)] rounded-xl",children:[L.jsx("div",{className:"flex-shrink-0 h-8 w-8 rounded-md overflow-hidden bg-[var(--wui-color-bg-secondary)] flex items-center justify-center",children:L.jsx("img",{src:n.metadata.icon,alt:`${n.metadata.name} icon`,className:"h-8 w-8 object-contain rounded-md"})}),L.jsx("span",{className:"text-lg font-bold wallet-custom-font",children:n.metadata.name})]})},n.id)),e.length===0&&L.jsx("p",{className:"text-center text-[var(--wui-color-text-secondary)]",children:"No wallets found."})]})}function nc({children:e}){const[t,n]=O.useState(!1),[r,o]=O.useState(null),{wallets:i,activeAddress:s}=xt.useWallet(),{theme:a}=uo(),l=a==="system"?void 0:a,{refs:c,context:d}=Hl({open:t,onOpenChange:u=>{u&&s||(u?(n(!0),o("starting"),requestAnimationFrame(()=>{o("entered")})):(o("exiting"),setTimeout(()=>{n(!1),o(null)},150)))}}),h=jl(d),m=Bl(d,{outsidePressEvent:"mousedown"}),f=eh(d,{role:"dialog"}),{getReferenceProps:x,getFloatingProps:b}=Wl([h,m,f]),R=Wn(),$=Wn(),w=async u=>{try{await u.connect(),d.onOpenChange(!1)}catch(p){console.error(`Error connecting to ${u.metadata.name}:`,p),d.onOpenChange(!1)}},T=u=>{s||d.onOpenChange(!0)},N=e||L.jsx(Di,{}),D=Ad([c.setReference,N.ref||null]),j={...x(),ref:D,onClick:T},W=O.cloneElement(N,j);return L.jsxs(L.Fragment,{children:[W,L.jsx(Dl,{id:"wallet-dialog-portal",children:t&&L.jsx("div",{"data-wallet-ui":!0,"data-theme":l,children:L.jsx(Qd,{className:"grid place-items-center px-4 z-50 transition-opacity duration-150 ease-in-out bg-[var(--wui-color-overlay)] data-[state=starting]:opacity-0 data-[state=exiting]:opacity-0 data-[state=entered]:opacity-100","data-state":r,lockScroll:!0,children:L.jsx(Ll,{context:d,modal:!0,children:L.jsxs("div",{ref:c.setFloating,...b({"aria-labelledby":R,"aria-describedby":$}),"data-state":r,className:"w-full max-w-sm rounded-3xl bg-[var(--wui-color-bg)] shadow-xl transform transition-all duration-150 ease-in-out data-[state=starting]:opacity-0 data-[state=starting]:scale-90 data-[state=exiting]:opacity-0 data-[state=exiting]:scale-90 data-[state=entered]:opacity-100 data-[state=entered]:scale-100",style:{marginTop:"-0.5rem"},children:[L.jsxs("div",{className:"relative flex items-center px-6 pt-5 pb-4",children:[L.jsx("h2",{id:R,className:"text-xl font-bold text-[var(--wui-color-text)] wallet-custom-font",children:"Connect a Wallet"}),L.jsx("button",{onClick:()=>d.onOpenChange(!1),className:"absolute right-4 rounded-full bg-[var(--wui-color-bg-tertiary)] p-2 text-[var(--wui-color-text-secondary)] hover:brightness-90 transition-all","aria-label":"Close dialog",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:L.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),L.jsx("div",{className:"px-4 pb-3",children:L.jsx(tc,{wallets:i,handleWalletClick:w})}),L.jsxs("div",{className:"px-6 py-5 border-t border-[var(--wui-color-border)] flex items-center justify-between",children:[L.jsx("span",{className:"text-[var(--wui-color-text-secondary)] text-sm",children:"Need an Algorand wallet?"}),L.jsx("a",{href:"https://algorand.co/wallets",className:"text-[var(--wui-color-link)] font-medium text-sm hover:text-[var(--wui-color-link-hover)]",target:"_blank",rel:"noopener noreferrer",children:"Start here →"})]})]})})})})})]})}var Bh=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Io=Math.ceil,He=Math.floor,Fe="[BigNumber Error] ",na=Fe+"Number primitive has more than 15 significant digits: ",Ge=1e14,te=14,ra=9007199254740991,Do=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],At=1e7,Me=1e9;function rc(e){var t,n,r,o=w.prototype={constructor:w,toString:null,valueOf:null},i=new w(1),s=20,a=4,l=-7,c=21,d=-1e7,h=1e7,m=!1,f=1,x=0,b={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},R="0123456789abcdefghijklmnopqrstuvwxyz",$=!0;function w(u,p){var g,C,S,A,k,v,E,F,y=this;if(!(y instanceof w))return new w(u,p);if(p==null){if(u&&u._isBigNumber===!0){y.s=u.s,!u.c||u.e>h?y.c=y.e=null:u.e<d?y.c=[y.e=0]:(y.e=u.e,y.c=u.c.slice());return}if((v=typeof u=="number")&&u*0==0){if(y.s=1/u<0?(u=-u,-1):1,u===~~u){for(A=0,k=u;k>=10;k/=10,A++);A>h?y.c=y.e=null:(y.e=A,y.c=[u]);return}F=String(u)}else{if(!Bh.test(F=String(u)))return r(y,F,v);y.s=F.charCodeAt(0)==45?(F=F.slice(1),-1):1}(A=F.indexOf("."))>-1&&(F=F.replace(".","")),(k=F.search(/e/i))>0?(A<0&&(A=k),A+=+F.slice(k+1),F=F.substring(0,k)):A<0&&(A=F.length)}else{if(fe(p,2,R.length,"Base"),p==10&&$)return y=new w(u),j(y,s+y.e+1,a);if(F=String(u),v=typeof u=="number"){if(u*0!=0)return r(y,F,v,p);if(y.s=1/u<0?(F=F.slice(1),-1):1,w.DEBUG&&F.replace(/^0\.0*|\./,"").length>15)throw Error(na+u)}else y.s=F.charCodeAt(0)===45?(F=F.slice(1),-1):1;for(g=R.slice(0,p),A=k=0,E=F.length;k<E;k++)if(g.indexOf(C=F.charAt(k))<0){if(C=="."){if(k>A){A=E;continue}}else if(!S&&(F==F.toUpperCase()&&(F=F.toLowerCase())||F==F.toLowerCase()&&(F=F.toUpperCase()))){S=!0,k=-1,A=0;continue}return r(y,String(u),v,p)}v=!1,F=n(F,p,10,y.s),(A=F.indexOf("."))>-1?F=F.replace(".",""):A=F.length}for(k=0;F.charCodeAt(k)===48;k++);for(E=F.length;F.charCodeAt(--E)===48;);if(F=F.slice(k,++E)){if(E-=k,v&&w.DEBUG&&E>15&&(u>ra||u!==He(u)))throw Error(na+y.s*u);if((A=A-k-1)>h)y.c=y.e=null;else if(A<d)y.c=[y.e=0];else{if(y.e=A,y.c=[],k=(A+1)%te,A<0&&(k+=te),k<E){for(k&&y.c.push(+F.slice(0,k)),E-=te;k<E;)y.c.push(+F.slice(k,k+=te));k=te-(F=F.slice(k)).length}else k-=E;for(;k--;F+="0");y.c.push(+F)}}else y.c=[y.e=0]}w.clone=rc,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(u){var p,g;if(u!=null)if(typeof u=="object"){if(u.hasOwnProperty(p="DECIMAL_PLACES")&&(g=u[p],fe(g,0,Me,p),s=g),u.hasOwnProperty(p="ROUNDING_MODE")&&(g=u[p],fe(g,0,8,p),a=g),u.hasOwnProperty(p="EXPONENTIAL_AT")&&(g=u[p],g&&g.pop?(fe(g[0],-1e9,0,p),fe(g[1],0,Me,p),l=g[0],c=g[1]):(fe(g,-1e9,Me,p),l=-(c=g<0?-g:g))),u.hasOwnProperty(p="RANGE"))if(g=u[p],g&&g.pop)fe(g[0],-1e9,-1,p),fe(g[1],1,Me,p),d=g[0],h=g[1];else if(fe(g,-1e9,Me,p),g)d=-(h=g<0?-g:g);else throw Error(Fe+p+" cannot be zero: "+g);if(u.hasOwnProperty(p="CRYPTO"))if(g=u[p],g===!!g)if(g)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))m=g;else throw m=!g,Error(Fe+"crypto unavailable");else m=g;else throw Error(Fe+p+" not true or false: "+g);if(u.hasOwnProperty(p="MODULO_MODE")&&(g=u[p],fe(g,0,9,p),f=g),u.hasOwnProperty(p="POW_PRECISION")&&(g=u[p],fe(g,0,Me,p),x=g),u.hasOwnProperty(p="FORMAT"))if(g=u[p],typeof g=="object")b=g;else throw Error(Fe+p+" not an object: "+g);if(u.hasOwnProperty(p="ALPHABET"))if(g=u[p],typeof g=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(g))$=g.slice(0,10)=="0123456789",R=g;else throw Error(Fe+p+" invalid: "+g)}else throw Error(Fe+"Object expected: "+u);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[l,c],RANGE:[d,h],CRYPTO:m,MODULO_MODE:f,POW_PRECISION:x,FORMAT:b,ALPHABET:R}},w.isBigNumber=function(u){if(!u||u._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var p,g,C=u.c,S=u.e,A=u.s;e:if({}.toString.call(C)=="[object Array]"){if((A===1||A===-1)&&S>=-1e9&&S<=Me&&S===He(S)){if(C[0]===0){if(S===0&&C.length===1)return!0;break e}if(p=(S+1)%te,p<1&&(p+=te),String(C[0]).length==p){for(p=0;p<C.length;p++)if(g=C[p],g<0||g>=Ge||g!==He(g))break e;if(g!==0)return!0}}}else if(C===null&&S===null&&(A===null||A===1||A===-1))return!0;throw Error(Fe+"Invalid BigNumber: "+u)},w.maximum=w.max=function(){return N(arguments,-1)},w.minimum=w.min=function(){return N(arguments,1)},w.random=function(){var u=9007199254740992,p=Math.random()*u&2097151?function(){return He(Math.random()*u)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(g){var C,S,A,k,v,E=0,F=[],y=new w(i);if(g==null?g=s:fe(g,0,Me),k=Io(g/te),m)if(crypto.getRandomValues){for(C=crypto.getRandomValues(new Uint32Array(k*=2));E<k;)v=C[E]*131072+(C[E+1]>>>11),v>=9e15?(S=crypto.getRandomValues(new Uint32Array(2)),C[E]=S[0],C[E+1]=S[1]):(F.push(v%1e14),E+=2);E=k/2}else if(crypto.randomBytes){for(C=crypto.randomBytes(k*=7);E<k;)v=(C[E]&31)*281474976710656+C[E+1]*1099511627776+C[E+2]*4294967296+C[E+3]*16777216+(C[E+4]<<16)+(C[E+5]<<8)+C[E+6],v>=9e15?crypto.randomBytes(7).copy(C,E):(F.push(v%1e14),E+=7);E=k/7}else throw m=!1,Error(Fe+"crypto unavailable");if(!m)for(;E<k;)v=p(),v<9e15&&(F[E++]=v%1e14);for(k=F[--E],g%=te,k&&g&&(v=Do[te-g],F[E]=He(k/v)*v);F[E]===0;F.pop(),E--);if(E<0)F=[A=0];else{for(A=-1;F[0]===0;F.splice(0,1),A-=te);for(E=1,v=F[0];v>=10;v/=10,E++);E<te&&(A-=te-E)}return y.e=A,y.c=F,y}}(),w.sum=function(){for(var u=1,p=arguments,g=new w(p[0]);u<p.length;)g=g.plus(p[u++]);return g},n=function(){var u="0123456789";function p(g,C,S,A){for(var k,v=[0],E,F=0,y=g.length;F<y;){for(E=v.length;E--;v[E]*=C);for(v[0]+=A.indexOf(g.charAt(F++)),k=0;k<v.length;k++)v[k]>S-1&&(v[k+1]==null&&(v[k+1]=0),v[k+1]+=v[k]/S|0,v[k]%=S)}return v.reverse()}return function(g,C,S,A,k){var v,E,F,y,M,B,V,H,_=g.indexOf("."),ee=s,Z=a;for(_>=0&&(y=x,x=0,g=g.replace(".",""),H=new w(C),B=H.pow(g.length-_),x=y,H.c=p(vt(je(B.c),B.e,"0"),10,S,u),H.e=H.c.length),V=p(g,C,S,k?(v=R,u):(v=u,R)),F=y=V.length;V[--y]==0;V.pop());if(!V[0])return v.charAt(0);if(_<0?--F:(B.c=V,B.e=F,B.s=A,B=t(B,H,ee,Z,S),V=B.c,M=B.r,F=B.e),E=F+ee+1,_=V[E],y=S/2,M=M||E<0||V[E+1]!=null,M=Z<4?(_!=null||M)&&(Z==0||Z==(B.s<0?3:2)):_>y||_==y&&(Z==4||M||Z==6&&V[E-1]&1||Z==(B.s<0?8:7)),E<1||!V[0])g=M?vt(v.charAt(1),-ee,v.charAt(0)):v.charAt(0);else{if(V.length=E,M)for(--S;++V[--E]>S;)V[E]=0,E||(++F,V=[1].concat(V));for(y=V.length;!V[--y];);for(_=0,g="";_<=y;g+=v.charAt(V[_++]));g=vt(g,F,v.charAt(0))}return g}}(),t=function(){function u(C,S,A){var k,v,E,F,y=0,M=C.length,B=S%At,V=S/At|0;for(C=C.slice();M--;)E=C[M]%At,F=C[M]/At|0,k=V*E+F*B,v=B*E+k%At*At+y,y=(v/A|0)+(k/At|0)+V*F,C[M]=v%A;return y&&(C=[y].concat(C)),C}function p(C,S,A,k){var v,E;if(A!=k)E=A>k?1:-1;else for(v=E=0;v<A;v++)if(C[v]!=S[v]){E=C[v]>S[v]?1:-1;break}return E}function g(C,S,A,k){for(var v=0;A--;)C[A]-=v,v=C[A]<S[A]?1:0,C[A]=v*k+C[A]-S[A];for(;!C[0]&&C.length>1;C.splice(0,1));}return function(C,S,A,k,v){var E,F,y,M,B,V,H,_,ee,Z,Y,U,ae,ge,Ee,Q,ne,X=C.s==S.s?1:-1,K=C.c,re=S.c;if(!K||!K[0]||!re||!re[0])return new w(!C.s||!S.s||(K?re&&K[0]==re[0]:!re)?NaN:K&&K[0]==0||!re?X*0:X/0);for(_=new w(X),ee=_.c=[],F=C.e-S.e,X=A+F+1,v||(v=Ge,F=We(C.e/te)-We(S.e/te),X=X/te|0),y=0;re[y]==(K[y]||0);y++);if(re[y]>(K[y]||0)&&F--,X<0)ee.push(1),M=!0;else{for(ge=K.length,Q=re.length,y=0,X+=2,B=He(v/(re[0]+1)),B>1&&(re=u(re,B,v),K=u(K,B,v),Q=re.length,ge=K.length),ae=Q,Z=K.slice(0,Q),Y=Z.length;Y<Q;Z[Y++]=0);ne=re.slice(),ne=[0].concat(ne),Ee=re[0],re[1]>=v/2&&Ee++;do{if(B=0,E=p(re,Z,Q,Y),E<0){if(U=Z[0],Q!=Y&&(U=U*v+(Z[1]||0)),B=He(U/Ee),B>1)for(B>=v&&(B=v-1),V=u(re,B,v),H=V.length,Y=Z.length;p(V,Z,H,Y)==1;)B--,g(V,Q<H?ne:re,H,v),H=V.length,E=1;else B==0&&(E=B=1),V=re.slice(),H=V.length;if(H<Y&&(V=[0].concat(V)),g(Z,V,Y,v),Y=Z.length,E==-1)for(;p(re,Z,Q,Y)<1;)B++,g(Z,Q<Y?ne:re,Y,v),Y=Z.length}else E===0&&(B++,Z=[0]);ee[y++]=B,Z[0]?Z[Y++]=K[ae]||0:(Z=[K[ae]],Y=1)}while((ae++<ge||Z[0]!=null)&&X--);M=Z[0]!=null,ee[0]||ee.splice(0,1)}if(v==Ge){for(y=1,X=ee[0];X>=10;X/=10,y++);j(_,A+(_.e=y+F*te-1)+1,k,M)}else _.e=F,_.r=+M;return _}}();function T(u,p,g,C){var S,A,k,v,E;if(g==null?g=a:fe(g,0,8),!u.c)return u.toString();if(S=u.c[0],k=u.e,p==null)E=je(u.c),E=C==1||C==2&&(k<=l||k>=c)?$r(E,k):vt(E,k,"0");else if(u=j(new w(u),p,g),A=u.e,E=je(u.c),v=E.length,C==1||C==2&&(p<=A||A<=l)){for(;v<p;E+="0",v++);E=$r(E,A)}else if(p-=k,E=vt(E,A,"0"),A+1>v){if(--p>0)for(E+=".";p--;E+="0");}else if(p+=A-v,p>0)for(A+1==v&&(E+=".");p--;E+="0");return u.s<0&&S?"-"+E:E}function N(u,p){for(var g,C,S=1,A=new w(u[0]);S<u.length;S++)C=new w(u[S]),(!C.s||(g=_t(A,C))===p||g===0&&A.s===p)&&(A=C);return A}function D(u,p,g){for(var C=1,S=p.length;!p[--S];p.pop());for(S=p[0];S>=10;S/=10,C++);return(g=C+g*te-1)>h?u.c=u.e=null:g<d?u.c=[u.e=0]:(u.e=g,u.c=p),u}r=function(){var u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,p=/^([^.]+)\.$/,g=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,S=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,k,v,E){var F,y=v?k:k.replace(S,"");if(C.test(y))A.s=isNaN(y)?null:y<0?-1:1;else{if(!v&&(y=y.replace(u,function(M,B,V){return F=(V=V.toLowerCase())=="x"?16:V=="b"?2:8,!E||E==F?B:M}),E&&(F=E,y=y.replace(p,"$1").replace(g,"0.$1")),k!=y))return new w(y,F);if(w.DEBUG)throw Error(Fe+"Not a"+(E?" base "+E:"")+" number: "+k);A.s=null}A.c=A.e=null}}();function j(u,p,g,C){var S,A,k,v,E,F,y,M=u.c,B=Do;if(M){e:{for(S=1,v=M[0];v>=10;v/=10,S++);if(A=p-S,A<0)A+=te,k=p,E=M[F=0],y=He(E/B[S-k-1]%10);else if(F=Io((A+1)/te),F>=M.length)if(C){for(;M.length<=F;M.push(0));E=y=0,S=1,A%=te,k=A-te+1}else break e;else{for(E=v=M[F],S=1;v>=10;v/=10,S++);A%=te,k=A-te+S,y=k<0?0:He(E/B[S-k-1]%10)}if(C=C||p<0||M[F+1]!=null||(k<0?E:E%B[S-k-1]),C=g<4?(y||C)&&(g==0||g==(u.s<0?3:2)):y>5||y==5&&(g==4||C||g==6&&(A>0?k>0?E/B[S-k]:0:M[F-1])%10&1||g==(u.s<0?8:7)),p<1||!M[0])return M.length=0,C?(p-=u.e+1,M[0]=B[(te-p%te)%te],u.e=-p||0):M[0]=u.e=0,u;if(A==0?(M.length=F,v=1,F--):(M.length=F+1,v=B[te-A],M[F]=k>0?He(E/B[S-k]%B[k])*v:0),C)for(;;)if(F==0){for(A=1,k=M[0];k>=10;k/=10,A++);for(k=M[0]+=v,v=1;k>=10;k/=10,v++);A!=v&&(u.e++,M[0]==Ge&&(M[0]=1));break}else{if(M[F]+=v,M[F]!=Ge)break;M[F--]=0,v=1}for(A=M.length;M[--A]===0;M.pop());}u.e>h?u.c=u.e=null:u.e<d&&(u.c=[u.e=0])}return u}function W(u){var p,g=u.e;return g===null?u.toString():(p=je(u.c),p=g<=l||g>=c?$r(p,g):vt(p,g,"0"),u.s<0?"-"+p:p)}return o.absoluteValue=o.abs=function(){var u=new w(this);return u.s<0&&(u.s=1),u},o.comparedTo=function(u,p){return _t(this,new w(u,p))},o.decimalPlaces=o.dp=function(u,p){var g,C,S,A=this;if(u!=null)return fe(u,0,Me),p==null?p=a:fe(p,0,8),j(new w(A),u+A.e+1,p);if(!(g=A.c))return null;if(C=((S=g.length-1)-We(this.e/te))*te,S=g[S])for(;S%10==0;S/=10,C--);return C<0&&(C=0),C},o.dividedBy=o.div=function(u,p){return t(this,new w(u,p),s,a)},o.dividedToIntegerBy=o.idiv=function(u,p){return t(this,new w(u,p),0,1)},o.exponentiatedBy=o.pow=function(u,p){var g,C,S,A,k,v,E,F,y,M=this;if(u=new w(u),u.c&&!u.isInteger())throw Error(Fe+"Exponent not an integer: "+W(u));if(p!=null&&(p=new w(p)),v=u.e>14,!M.c||!M.c[0]||M.c[0]==1&&!M.e&&M.c.length==1||!u.c||!u.c[0])return y=new w(Math.pow(+W(M),v?u.s*(2-Pr(u)):+W(u))),p?y.mod(p):y;if(E=u.s<0,p){if(p.c?!p.c[0]:!p.s)return new w(NaN);C=!E&&M.isInteger()&&p.isInteger(),C&&(M=M.mod(p))}else{if(u.e>9&&(M.e>0||M.e<-1||(M.e==0?M.c[0]>1||v&&M.c[1]>=24e7:M.c[0]<8e13||v&&M.c[0]<=9999975e7)))return A=M.s<0&&Pr(u)?-0:0,M.e>-1&&(A=1/A),new w(E?1/A:A);x&&(A=Io(x/te+2))}for(v?(g=new w(.5),E&&(u.s=1),F=Pr(u)):(S=Math.abs(+W(u)),F=S%2),y=new w(i);;){if(F){if(y=y.times(M),!y.c)break;A?y.c.length>A&&(y.c.length=A):C&&(y=y.mod(p))}if(S){if(S=He(S/2),S===0)break;F=S%2}else if(u=u.times(g),j(u,u.e+1,1),u.e>14)F=Pr(u);else{if(S=+W(u),S===0)break;F=S%2}M=M.times(M),A?M.c&&M.c.length>A&&(M.c.length=A):C&&(M=M.mod(p))}return C?y:(E&&(y=i.div(y)),p?y.mod(p):A?j(y,x,a,k):y)},o.integerValue=function(u){var p=new w(this);return u==null?u=a:fe(u,0,8),j(p,p.e+1,u)},o.isEqualTo=o.eq=function(u,p){return _t(this,new w(u,p))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(u,p){return _t(this,new w(u,p))>0},o.isGreaterThanOrEqualTo=o.gte=function(u,p){return(p=_t(this,new w(u,p)))===1||p===0},o.isInteger=function(){return!!this.c&&We(this.e/te)>this.c.length-2},o.isLessThan=o.lt=function(u,p){return _t(this,new w(u,p))<0},o.isLessThanOrEqualTo=o.lte=function(u,p){return(p=_t(this,new w(u,p)))===-1||p===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(u,p){var g,C,S,A,k=this,v=k.s;if(u=new w(u,p),p=u.s,!v||!p)return new w(NaN);if(v!=p)return u.s=-p,k.plus(u);var E=k.e/te,F=u.e/te,y=k.c,M=u.c;if(!E||!F){if(!y||!M)return y?(u.s=-p,u):new w(M?k:NaN);if(!y[0]||!M[0])return M[0]?(u.s=-p,u):new w(y[0]?k:a==3?-0:0)}if(E=We(E),F=We(F),y=y.slice(),v=E-F){for((A=v<0)?(v=-v,S=y):(F=E,S=M),S.reverse(),p=v;p--;S.push(0));S.reverse()}else for(C=(A=(v=y.length)<(p=M.length))?v:p,v=p=0;p<C;p++)if(y[p]!=M[p]){A=y[p]<M[p];break}if(A&&(S=y,y=M,M=S,u.s=-u.s),p=(C=M.length)-(g=y.length),p>0)for(;p--;y[g++]=0);for(p=Ge-1;C>v;){if(y[--C]<M[C]){for(g=C;g&&!y[--g];y[g]=p);--y[g],y[C]+=Ge}y[C]-=M[C]}for(;y[0]==0;y.splice(0,1),--F);return y[0]?D(u,y,F):(u.s=a==3?-1:1,u.c=[u.e=0],u)},o.modulo=o.mod=function(u,p){var g,C,S=this;return u=new w(u,p),!S.c||!u.s||u.c&&!u.c[0]?new w(NaN):!u.c||S.c&&!S.c[0]?new w(S):(f==9?(C=u.s,u.s=1,g=t(S,u,0,3),u.s=C,g.s*=C):g=t(S,u,0,f),u=S.minus(g.times(u)),!u.c[0]&&f==1&&(u.s=S.s),u)},o.multipliedBy=o.times=function(u,p){var g,C,S,A,k,v,E,F,y,M,B,V,H,_,ee,Z=this,Y=Z.c,U=(u=new w(u,p)).c;if(!Y||!U||!Y[0]||!U[0])return!Z.s||!u.s||Y&&!Y[0]&&!U||U&&!U[0]&&!Y?u.c=u.e=u.s=null:(u.s*=Z.s,!Y||!U?u.c=u.e=null:(u.c=[0],u.e=0)),u;for(C=We(Z.e/te)+We(u.e/te),u.s*=Z.s,E=Y.length,M=U.length,E<M&&(H=Y,Y=U,U=H,S=E,E=M,M=S),S=E+M,H=[];S--;H.push(0));for(_=Ge,ee=At,S=M;--S>=0;){for(g=0,B=U[S]%ee,V=U[S]/ee|0,k=E,A=S+k;A>S;)F=Y[--k]%ee,y=Y[k]/ee|0,v=V*F+y*B,F=B*F+v%ee*ee+H[A]+g,g=(F/_|0)+(v/ee|0)+V*y,H[A--]=F%_;H[A]=g}return g?++C:H.splice(0,1),D(u,H,C)},o.negated=function(){var u=new w(this);return u.s=-u.s||null,u},o.plus=function(u,p){var g,C=this,S=C.s;if(u=new w(u,p),p=u.s,!S||!p)return new w(NaN);if(S!=p)return u.s=-p,C.minus(u);var A=C.e/te,k=u.e/te,v=C.c,E=u.c;if(!A||!k){if(!v||!E)return new w(S/0);if(!v[0]||!E[0])return E[0]?u:new w(v[0]?C:S*0)}if(A=We(A),k=We(k),v=v.slice(),S=A-k){for(S>0?(k=A,g=E):(S=-S,g=v),g.reverse();S--;g.push(0));g.reverse()}for(S=v.length,p=E.length,S-p<0&&(g=E,E=v,v=g,p=S),S=0;p;)S=(v[--p]=v[p]+E[p]+S)/Ge|0,v[p]=Ge===v[p]?0:v[p]%Ge;return S&&(v=[S].concat(v),++k),D(u,v,k)},o.precision=o.sd=function(u,p){var g,C,S,A=this;if(u!=null&&u!==!!u)return fe(u,1,Me),p==null?p=a:fe(p,0,8),j(new w(A),u,p);if(!(g=A.c))return null;if(S=g.length-1,C=S*te+1,S=g[S]){for(;S%10==0;S/=10,C--);for(S=g[0];S>=10;S/=10,C++);}return u&&A.e+1>C&&(C=A.e+1),C},o.shiftedBy=function(u){return fe(u,-9007199254740991,ra),this.times("1e"+u)},o.squareRoot=o.sqrt=function(){var u,p,g,C,S,A=this,k=A.c,v=A.s,E=A.e,F=s+4,y=new w("0.5");if(v!==1||!k||!k[0])return new w(!v||v<0&&(!k||k[0])?NaN:k?A:1/0);if(v=Math.sqrt(+W(A)),v==0||v==1/0?(p=je(k),(p.length+E)%2==0&&(p+="0"),v=Math.sqrt(+p),E=We((E+1)/2)-(E<0||E%2),v==1/0?p="5e"+E:(p=v.toExponential(),p=p.slice(0,p.indexOf("e")+1)+E),g=new w(p)):g=new w(v+""),g.c[0]){for(E=g.e,v=E+F,v<3&&(v=0);;)if(S=g,g=y.times(S.plus(t(A,S,F,1))),je(S.c).slice(0,v)===(p=je(g.c)).slice(0,v))if(g.e<E&&--v,p=p.slice(v-3,v+1),p=="9999"||!C&&p=="4999"){if(!C&&(j(S,S.e+s+2,0),S.times(S).eq(A))){g=S;break}F+=4,v+=4,C=1}else{(!+p||!+p.slice(1)&&p.charAt(0)=="5")&&(j(g,g.e+s+2,1),u=!g.times(g).eq(A));break}}return j(g,g.e+s+1,a,u)},o.toExponential=function(u,p){return u!=null&&(fe(u,0,Me),u++),T(this,u,p,1)},o.toFixed=function(u,p){return u!=null&&(fe(u,0,Me),u=u+this.e+1),T(this,u,p)},o.toFormat=function(u,p,g){var C,S=this;if(g==null)u!=null&&p&&typeof p=="object"?(g=p,p=null):u&&typeof u=="object"?(g=u,u=p=null):g=b;else if(typeof g!="object")throw Error(Fe+"Argument not an object: "+g);if(C=S.toFixed(u,p),S.c){var A,k=C.split("."),v=+g.groupSize,E=+g.secondaryGroupSize,F=g.groupSeparator||"",y=k[0],M=k[1],B=S.s<0,V=B?y.slice(1):y,H=V.length;if(E&&(A=v,v=E,E=A,H-=A),v>0&&H>0){for(A=H%v||v,y=V.substr(0,A);A<H;A+=v)y+=F+V.substr(A,v);E>0&&(y+=F+V.slice(A)),B&&(y="-"+y)}C=M?y+(g.decimalSeparator||"")+((E=+g.fractionGroupSize)?M.replace(new RegExp("\\d{"+E+"}\\B","g"),"$&"+(g.fractionGroupSeparator||"")):M):y}return(g.prefix||"")+C+(g.suffix||"")},o.toFraction=function(u){var p,g,C,S,A,k,v,E,F,y,M,B,V=this,H=V.c;if(u!=null&&(v=new w(u),!v.isInteger()&&(v.c||v.s!==1)||v.lt(i)))throw Error(Fe+"Argument "+(v.isInteger()?"out of range: ":"not an integer: ")+W(v));if(!H)return new w(V);for(p=new w(i),F=g=new w(i),C=E=new w(i),B=je(H),A=p.e=B.length-V.e-1,p.c[0]=Do[(k=A%te)<0?te+k:k],u=!u||v.comparedTo(p)>0?A>0?p:F:v,k=h,h=1/0,v=new w(B),E.c[0]=0;y=t(v,p,0,1),S=g.plus(y.times(C)),S.comparedTo(u)!=1;)g=C,C=S,F=E.plus(y.times(S=F)),E=S,p=v.minus(y.times(S=p)),v=S;return S=t(u.minus(g),C,0,1),E=E.plus(S.times(F)),g=g.plus(S.times(C)),E.s=F.s=V.s,A=A*2,M=t(F,C,A,a).minus(V).abs().comparedTo(t(E,g,A,a).minus(V).abs())<1?[F,C]:[E,g],h=k,M},o.toNumber=function(){return+W(this)},o.toPrecision=function(u,p){return u!=null&&fe(u,1,Me),T(this,u,p,2)},o.toString=function(u){var p,g=this,C=g.s,S=g.e;return S===null?C?(p="Infinity",C<0&&(p="-"+p)):p="NaN":(u==null?p=S<=l||S>=c?$r(je(g.c),S):vt(je(g.c),S,"0"):u===10&&$?(g=j(new w(g),s+S+1,a),p=vt(je(g.c),g.e,"0")):(fe(u,2,R.length,"Base"),p=n(vt(je(g.c),S,"0"),10,u,C,!0)),C<0&&g.c[0]&&(p="-"+p)),p},o.valueOf=o.toJSON=function(){return W(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&w.set(e),w}function We(e){var t=e|0;return e>0||e===t?t:t-1}function je(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=te-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function _t(e,t){var n,r,o=e.c,i=t.c,s=e.s,a=t.s,l=e.e,c=t.e;if(!s||!a)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=l==c,!o||!i)return r?0:!o^n?1:-1;if(!r)return l>c^n?1:-1;for(a=(l=o.length)<(c=i.length)?l:c,s=0;s<a;s++)if(o[s]!=i[s])return o[s]>i[s]^n?1:-1;return l==c?0:l>c^n?1:-1}function fe(e,t,n,r){if(e<t||e>n||e!==He(e))throw Error(Fe+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Pr(e){var t=e.c.length-1;return We(e.e/te)==t&&e.c[t]%2!=0}function $r(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function vt(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}rc();const Hh=100000n,Wh=(e,t={})=>{const{style:n="decimal",compact:r=!1,fractionDigits:o,adaptiveDecimals:i=!1}=t,s=typeof e=="string"?Number(e):e,a=typeof s=="bigint"?s<0n?-s:s:Math.abs(s),l=r==="auto"?a>=Hh:r,c=typeof s=="bigint"?Number(s):s,d=i&&c!==0&&Math.abs(c)<Math.pow(10,-(o??2)),h=new Intl.NumberFormat("en-US",{style:n,...n==="currency"&&{currency:"USD"},maximumFractionDigits:d?20:o??2,minimumFractionDigits:d?0:o??2});if(!l)return d?h.format(oa(c)):h.format(s);const m=[{threshold:1e12,suffix:"T",divisor:1e12},{threshold:1e9,suffix:"B",divisor:1e9},{threshold:1e6,suffix:"M",divisor:1e6},{threshold:1e3,suffix:"K",divisor:1e3}].find(f=>a>=f.threshold);if(m){const f=new Intl.NumberFormat("en-US",{style:n,...n==="currency"&&{currency:"USD"},maximumFractionDigits:o??1,minimumFractionDigits:o??1}),x=Number(s)/m.divisor;return f.format(x)+m.suffix}return d?h.format(oa(c)):h.format(s)};function oa(e){if(e===0)return 0;const t=e.toExponential().split("e"),n=parseInt(t[1]),r=Math.abs(n);return Number(e.toFixed(r))}function Xn(e,t=5,n=5){return e?e.length<=t+n?e:`${e.slice(0,t)}...${e.slice(-n)}`:""}function qi(e={}){const{activeAddress:t}=xt.useWallet(),{activeNetwork:n}=xt.useNetwork(),{enabled:r=!0,view:o="thumbnail"}=e;return Vi({queryKey:["nfd",t,n,o],queryFn:async({signal:i})=>{if(!t)return null;const l=await fetch(`${n==="testnet"?"https://api.testnet.nf.domains":"https://api.nf.domains"}/nfd/lookup?address=${encodeURIComponent(t)}&view=${o}`,{method:"GET",headers:{Accept:"application/json"},signal:i});if(l.status===404)return null;if(!l.ok)throw new Error(`NFD lookup failed: ${l.statusText}`);return(await l.json())[t]},enabled:r&&!!t,retry:(i,s)=>s instanceof Error&&s.message.includes("404")?!1:i<3,refetchOnWindowFocus:!0})}const ia="https://ipfs.algonode.dev",Uh=async e=>{if(!e.startsWith("ipfs://"))return e;const t=e.replace("ipfs://",""),n=`https://images.nf.domains/ipfs/${t}`,r=`${ia}/ipfs/${t}`,o=i=>i.startsWith("image/");try{const i=await fetch(n,{method:"HEAD"});if(i.ok){const s=i.headers.get("content-type");if(s&&o(s))return n}}catch{console.info(`CID ${t} is not cached on images.nf.domains, trying IPFS gateway...`)}try{const i=await fetch(r,{method:"HEAD"});if(i.ok){const s=i.headers.get("content-type");if(s&&o(s))return r;if(s==="application/json")try{const c=(await(await fetch(r)).json()).image;if(c){if(c.startsWith("ipfs://")){const d=c.replace("ipfs://",""),h=`${ia}/ipfs/${d}`,m=await fetch(h,{method:"HEAD"});if(m.ok){const f=m.headers.get("content-type");if(f&&o(f))return h}}else if(c.startsWith("http"))try{const d=await fetch(c,{method:"HEAD"});if(d.ok){const h=d.headers.get("content-type");if(h&&o(h))return c}}catch{console.error("Error checking HTTP image URL")}}}catch{console.error("Error processing JSON metadata")}}}catch{console.error(`Error checking gateway for CID ${t}`)}return r};function zi({nfd:e,alt:t,className:n,size:r=40,fallback:o,lightOnly:i=!1}){var d,h,m,f;const s=((h=(d=e==null?void 0:e.properties)==null?void 0:d.userDefined)==null?void 0:h.avatar)||((f=(m=e==null?void 0:e.properties)==null?void 0:m.verified)==null?void 0:f.avatar)||null,a=t||(e==null?void 0:e.name)||"NFD Avatar",{data:l,isLoading:c}=Vi({queryKey:["nfd-avatar",s],queryFn:async()=>s?s.startsWith("https://")&&!s.includes("/ipfs/")?s:s.startsWith("ipfs://")||s.includes("/ipfs/")?await Uh(s):s:null,enabled:!!s,staleTime:60*60*1e3,gcTime:24*60*60*1e3});return c||!l?o?L.jsx(L.Fragment,{children:o}):L.jsx("div",{className:En("flex items-center justify-center rounded-full",i?"bg-gray-200 dark:bg-gray-200":"bg-gray-200 dark:bg-[#192A39]",n),style:{width:`${r}px`,height:`${r}px`},"aria-label":a,role:"img",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:En("text-gray-400",!i&&"dark:text-gray-500"),style:{width:`${Math.max(r/2,12)}px`,height:`${Math.max(r/2,12)}px`},children:L.jsx("path",{fillRule:"evenodd",d:"M7.5 6a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0zM3.751 20.105a8.25 8.25 0 0116.498 0 .75.75 0 01-.437.695A18.683 18.683 0 0112 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 01-.437-.695z",clipRule:"evenodd"})})}):L.jsx("img",{src:l,alt:a,className:En("rounded-full",n),style:{width:`${r}px`,height:`${r}px`,objectFit:"cover"},loading:"lazy"})}const fo=O.forwardRef(({className:e="",children:t,style:n,...r},o)=>{var c;const{activeAddress:i}=xt.useWallet(),s=qi({enabled:!!i}),a=((c=s.data)==null?void 0:c.name)??null;return L.jsx("button",{ref:o,className:En("flex items-center py-2.5 pl-3 md:pl-3.5 pr-3 bg-[var(--wui-color-primary)] text-[var(--wui-color-primary-text)] rounded-xl cursor-pointer font-bold",e),style:n,disabled:!1,...r,type:"button",children:t||L.jsxs("div",{className:"flex items-center",children:[i&&L.jsx("div",{className:"mr-1 md:mr-2 h-6 w-6 overflow-hidden",children:L.jsx(zi,{nfd:s.data,alt:`${a||i} avatar`,size:24,lightOnly:!0})}),L.jsx("span",{className:"hidden md:block max-w-[160px] truncate",children:a||(i?Xn(i,6,4):"Connect")}),i&&L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 16 16",fill:"none",className:"ml-1.5 mt-0.5","aria-hidden":"true",children:L.jsx("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})});fo.displayName="ConnectedWalletButton";const oc=typeof document<"u"?O.useLayoutEffect:()=>{};function Vh(e){const t=O.useRef(null);return oc(()=>{t.current=e},[e]),O.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const zt=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Yt=e=>e&&"window"in e&&e.window===e?e:zt(e).defaultView||window;function qh(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function zh(e){return qh(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Gh=!1;function Gi(){return Gh}function ic(e,t){if(!Gi())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:zh(n)?n=n.host:n=n.parentNode}return!1}const wi=(e=document)=>{var t;if(!Gi())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function sc(e){return Gi()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function ho(e){var t;return typeof window>"u"||window.navigator==null?!1:((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands.some(n=>e.test(n.brand)))||e.test(window.navigator.userAgent)}function _i(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Rt(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Qi=Rt(function(){return _i(/^Mac/i)}),_h=Rt(function(){return _i(/^iPhone/i)}),Qh=Rt(function(){return _i(/^iPad/i)||Qi()&&navigator.maxTouchPoints>1}),Kh=Rt(function(){return _h()||Qh()});Rt(function(){return Qi()||Kh()});Rt(function(){return ho(/AppleWebKit/i)&&!Yh()});const Yh=Rt(function(){return ho(/Chrome/i)}),Xh=Rt(function(){return ho(/Android/i)});Rt(function(){return ho(/Firefox/i)});function ac(){let e=O.useRef(new Map),t=O.useCallback((o,i,s,a)=>{let l=a!=null&&a.once?(...c)=>{e.current.delete(s),s(...c)}:s;e.current.set(s,{type:i,eventTarget:o,fn:l,options:a}),o.addEventListener(i,l,a)},[]),n=O.useCallback((o,i,s,a)=>{var l;let c=((l=e.current.get(s))===null||l===void 0?void 0:l.fn)||s;o.removeEventListener(i,c,a),e.current.delete(s)},[]),r=O.useCallback(()=>{e.current.forEach((o,i)=>{n(o.eventTarget,o.type,i,o.options)})},[n]);return O.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Jh(e){return e.mozInputSource===0&&e.isTrusted?!0:Xh()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function lc(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Zh(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function cc(e){let t=O.useRef({isFocused:!1,observer:null});oc(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Vh(r=>{e==null||e(r)});return O.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,i=s=>{if(t.current.isFocused=!1,o.disabled){let a=lc(s);n(a)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var s;(s=t.current.observer)===null||s===void 0||s.disconnect();let a=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:a})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:a}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let ep=!1,vr=null,xi=new Set,tr=new Map,hn=!1,Ei=!1;const tp={Tab:!0,Escape:!0};function Ki(e,t){for(let n of xi)n(e,t)}function np(e){return!(e.metaKey||!Qi()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Xr(e){hn=!0,np(e)&&(vr="keyboard",Ki("keyboard",e))}function Ve(e){vr="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(hn=!0,Ki("pointer",e))}function uc(e){Jh(e)&&(hn=!0,vr="virtual")}function fc(e){e.target===window||e.target===document||ep||!e.isTrusted||(!hn&&!Ei&&(vr="virtual",Ki("virtual",e)),hn=!1,Ei=!1)}function dc(){hn=!1,Ei=!0}function Ri(e){if(typeof window>"u"||typeof document>"u"||tr.get(Yt(e)))return;const t=Yt(e),n=zt(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){hn=!0,r.apply(this,arguments)},n.addEventListener("keydown",Xr,!0),n.addEventListener("keyup",Xr,!0),n.addEventListener("click",uc,!0),t.addEventListener("focus",fc,!0),t.addEventListener("blur",dc,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Ve,!0),n.addEventListener("pointermove",Ve,!0),n.addEventListener("pointerup",Ve,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Ve,!0),n.addEventListener("mousemove",Ve,!0),n.addEventListener("mouseup",Ve,!0)),t.addEventListener("beforeunload",()=>{hc(e)},{once:!0}),tr.set(t,{focus:r})}const hc=(e,t)=>{const n=Yt(e),r=zt(e);t&&r.removeEventListener("DOMContentLoaded",t),tr.has(n)&&(n.HTMLElement.prototype.focus=tr.get(n).focus,r.removeEventListener("keydown",Xr,!0),r.removeEventListener("keyup",Xr,!0),r.removeEventListener("click",uc,!0),n.removeEventListener("focus",fc,!0),n.removeEventListener("blur",dc,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Ve,!0),r.removeEventListener("pointermove",Ve,!0),r.removeEventListener("pointerup",Ve,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Ve,!0),r.removeEventListener("mousemove",Ve,!0),r.removeEventListener("mouseup",Ve,!0)),tr.delete(n))};function rp(e){const t=zt(e);let n;return t.readyState!=="loading"?Ri(e):(n=()=>{Ri(e)},t.addEventListener("DOMContentLoaded",n)),()=>hc(e,n)}typeof document<"u"&&rp();function pc(){return vr!=="pointer"}const op=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function ip(e,t,n){let r=zt(n==null?void 0:n.target);const o=typeof window<"u"?Yt(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?Yt(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,s=typeof window<"u"?Yt(n==null?void 0:n.target).HTMLElement:HTMLElement,a=typeof window<"u"?Yt(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!op.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof s&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!tp[n.key])}function sp(e,t,n){Ri(),O.useEffect(()=>{let r=(o,i)=>{ip(!!(n!=null&&n.isTextInput),o,i)&&e(pc())};return xi.add(r),()=>{xi.delete(r)}},t)}function ap(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const i=O.useCallback(l=>{if(l.target===l.currentTarget)return r&&r(l),o&&o(!1),!0},[r,o]),s=cc(i),a=O.useCallback(l=>{const c=zt(l.target),d=c?wi(c):wi();l.target===l.currentTarget&&d===sc(l.nativeEvent)&&(n&&n(l),o&&o(!0),s(l))},[o,n,s]);return{focusProps:{onFocus:!t&&(n||o||r)?a:void 0,onBlur:!t&&(r||o)?i:void 0}}}function lp(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,i=O.useRef({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:a}=ac(),l=O.useCallback(h=>{h.currentTarget.contains(h.target)&&i.current.isFocusWithin&&!h.currentTarget.contains(h.relatedTarget)&&(i.current.isFocusWithin=!1,a(),n&&n(h),o&&o(!1))},[n,o,i,a]),c=cc(l),d=O.useCallback(h=>{if(!h.currentTarget.contains(h.target))return;const m=zt(h.target),f=wi(m);if(!i.current.isFocusWithin&&f===sc(h.nativeEvent)){r&&r(h),o&&o(!0),i.current.isFocusWithin=!0,c(h);let x=h.currentTarget;s(m,"focus",b=>{if(i.current.isFocusWithin&&!ic(x,b.target)){let R=new m.defaultView.FocusEvent("blur",{relatedTarget:b.target});Zh(R,x);let $=lc(R);l($)}},{capture:!0})}},[r,o,c,s,l]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:l}}}let Jr=!1,No=0;function Si(){Jr=!0,setTimeout(()=>{Jr=!1},50)}function sa(e){e.pointerType==="touch"&&Si()}function cp(){if(!(typeof document>"u"))return typeof PointerEvent<"u"?document.addEventListener("pointerup",sa):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Si),No++,()=>{No--,!(No>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",sa):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Si))}}function up(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[i,s]=O.useState(!1),a=O.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;O.useEffect(cp,[]);let{addGlobalListener:l,removeAllGlobalListeners:c}=ac(),{hoverProps:d,triggerHoverEnd:h}=O.useMemo(()=>{let m=(b,R)=>{if(a.pointerType=R,o||R==="touch"||a.isHovered||!b.currentTarget.contains(b.target))return;a.isHovered=!0;let $=b.currentTarget;a.target=$,l(zt(b.target),"pointerover",w=>{a.isHovered&&a.target&&!ic(a.target,w.target)&&f(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:$,pointerType:R}),n&&n(!0),s(!0)},f=(b,R)=>{let $=a.target;a.pointerType="",a.target=null,!(R==="touch"||!a.isHovered||!$)&&(a.isHovered=!1,c(),r&&r({type:"hoverend",target:$,pointerType:R}),n&&n(!1),s(!1))},x={};return typeof PointerEvent<"u"?(x.onPointerEnter=b=>{Jr&&b.pointerType==="mouse"||m(b,b.pointerType)},x.onPointerLeave=b=>{!o&&b.currentTarget.contains(b.target)&&f(b,b.pointerType)}):process.env.NODE_ENV==="test"&&(x.onTouchStart=()=>{a.ignoreEmulatedMouseEvents=!0},x.onMouseEnter=b=>{!a.ignoreEmulatedMouseEvents&&!Jr&&m(b,"mouse"),a.ignoreEmulatedMouseEvents=!1},x.onMouseLeave=b=>{!o&&b.currentTarget.contains(b.target)&&f(b,"mouse")}),{hoverProps:x,triggerHoverEnd:f}},[t,n,r,o,a,l,c]);return O.useEffect(()=>{o&&h({currentTarget:a.target},a.pointerType)},[o]),{hoverProps:d,isHovered:i}}function fp(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=O.useRef({isFocused:!1,isFocusVisible:t||pc()}),[i,s]=O.useState(!1),[a,l]=O.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=O.useCallback(()=>l(o.current.isFocused&&o.current.isFocusVisible),[]),d=O.useCallback(f=>{o.current.isFocused=f,s(f),c()},[c]);sp(f=>{o.current.isFocusVisible=f,c()},[],{isTextInput:n});let{focusProps:h}=ap({isDisabled:r,onFocusChange:d}),{focusWithinProps:m}=lp({isDisabled:!r,onFocusWithinChange:d});return{isFocused:i,isFocusVisible:a,focusProps:r?m:h}}var dp=Object.defineProperty,hp=(e,t,n)=>t in e?dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lo=(e,t,n)=>(hp(e,typeof t!="symbol"?t+"":t,n),n);let pp=class{constructor(){Lo(this,"current",this.detect()),Lo(this,"handoffState","pending"),Lo(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},cn=new pp;function br(e){var t,n;return cn.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function mc(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Je(){let e=[],t={addEventListener(n,r,o,i){return n.addEventListener(r,o,i),t.add(()=>n.removeEventListener(r,o,i))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return mc(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let i=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:i})})},group(n){let r=Je();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function yr(){let[e]=O.useState(Je);return O.useEffect(()=>()=>e.dispose(),[e]),e}let xe=(e,t)=>{cn.isServer?O.useEffect(e,t):O.useLayoutEffect(e,t)};function zn(e){let t=O.useRef(e);return xe(()=>{t.current=e},[e]),t}let ce=function(e){let t=zn(e);return O.useCallback((...n)=>t.current(...n),[t])};function mp(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function gp(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function vp({disabled:e=!1}={}){let t=O.useRef(null),[n,r]=O.useState(!1),o=yr(),i=ce(()=>{t.current=null,r(!1),o.dispose()}),s=ce(a=>{if(o.dispose(),t.current===null){t.current=a.currentTarget,r(!0);{let l=br(a.currentTarget);o.addEventListener(l,"pointerup",i,!1),o.addEventListener(l,"pointermove",c=>{if(t.current){let d=mp(c);r(gp(d,t.current.getBoundingClientRect()))}},!1),o.addEventListener(l,"pointercancel",i,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:s,onPointerUp:i,onClick:i}}}let bp=O.createContext(void 0);function Yi(){return O.useContext(bp)}function aa(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function ut(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,ut),r}var Ci=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Ci||{}),yp=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(yp||{});function Ze(){let e=xp();return O.useCallback(t=>wp({mergeRefs:e,...t}),[e])}function wp({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:s,mergeRefs:a}){a=a??Ep;let l=gc(t,e);if(i)return Mr(l,n,r,s,a);let c=o??0;if(c&2){let{static:d=!1,...h}=l;if(d)return Mr(h,n,r,s,a)}if(c&1){let{unmount:d=!0,...h}=l;return ut(d?0:1,{0(){return null},1(){return Mr({...h,hidden:!0,style:{display:"none"}},n,r,s,a)}})}return Mr(l,n,r,s,a)}function Mr(e,t={},n,r,o){let{as:i=n,children:s,refName:a="ref",...l}=jo(e,["unmount","static"]),c=e.ref!==void 0?{[a]:e.ref}:{},d=typeof s=="function"?s(t):s;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t)),l["aria-labelledby"]&&l["aria-labelledby"]===l.id&&(l["aria-labelledby"]=void 0);let h={};if(t){let m=!1,f=[];for(let[x,b]of Object.entries(t))typeof b=="boolean"&&(m=!0),b===!0&&f.push(x.replace(/([A-Z])/g,R=>`-${R.toLowerCase()}`));if(m){h["data-headlessui-state"]=f.join(" ");for(let x of f)h[`data-${x}`]=""}}if(i===O.Fragment&&(Object.keys(Kt(l)).length>0||Object.keys(Kt(h)).length>0))if(!O.isValidElement(d)||Array.isArray(d)&&d.length>1){if(Object.keys(Kt(l)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Kt(l)).concat(Object.keys(Kt(h))).map(m=>` - ${m}`).join(`
68
+ `,document.head.appendChild(e)}const Nh=()=>new bh({defaultOptions:{queries:{staleTime:5*60*1e3,gcTime:60*60*1e3,refetchOnWindowFocus:!0,refetchInterval:10*60*1e3,retry:(e,t)=>t instanceof Error&&t.message.includes("404")?!1:e<3}}}),ec=O.createContext(void 0);function Lh({enabled:e,nfdView:t}){const n=Xl(),{activeAddress:r,activeWallet:o,algodClient:i}=xt.useWallet(),{activeNetwork:s}=xt.useNetwork(),a=O.useRef(null);return O.useEffect(()=>{if(!e){a.current=r;return}const l=a.current===null&&r!==null&&o!==null&&o.accounts!==void 0&&o.accounts.length>0&&i!==void 0;if(a.current=r,!l)return;console.log(`[WalletUI] Prefetching data for all accounts in wallet ${o.id}`);const c=o.accounts.map(d=>d.address);if(c.length>0){const h=[];for(let m=0;m<c.length;m+=20)h.push(c.slice(m,m+20));h.forEach(async m=>{const x=s==="testnet"?"https://api.testnet.nf.domains":"https://api.nf.domains",b=new URLSearchParams;m.forEach(R=>{b.append("address",R)}),b.append("view",t);try{const R=await fetch(`${x}/nfd/lookup?${b.toString()}`,{method:"GET",headers:{Accept:"application/json"}});if(!R.ok&&R.status!==404)throw new Error(`NFD prefetch lookup failed: ${R.statusText}`);const $=R.status===404?{}:await R.json();m.forEach(w=>{const T=$[w]||null;n.setQueryData(["nfd",w,s,t],T)})}catch(R){console.error("Error prefetching NFD data:",R)}})}c.forEach(d=>{n.prefetchQuery({queryKey:["account-balance",d],queryFn:async()=>{try{const h=await i.accountInformation(d).do();return Number(h.amount)}catch(h){throw new Error(`Error fetching account balance: ${h}`)}}})})},[r,o,s,t,i,n,e]),null}function jh({children:e,queryClient:t,enablePrefetching:n=!0,prefetchNfdView:r="thumbnail",theme:o="system"}){const i=O.useMemo(()=>t||Nh(),[t]),s=Zl(o);O.useEffect(()=>{Dh()},[]);const a=O.useMemo(()=>({queryClient:i,theme:o,resolvedTheme:s}),[i,o,s]),l=o==="system"?void 0:o,c=L.jsx(ec.Provider,{value:a,children:L.jsxs("div",{"data-wallet-ui":!0,"data-theme":l,children:[L.jsx(Lh,{enabled:n,nfdView:r}),e]})});return t?c:L.jsx(Jl,{client:i,children:c})}function uo(){const e=O.useContext(ec);if(e===void 0)throw new Error("useWalletUI must be used within a WalletUIProvider");return e}function tc({wallets:e,handleWalletClick:t}){return L.jsxs("ul",{className:"space-y-1.5",children:[e.map(n=>L.jsx("li",{children:L.jsxs("button",{onClick:()=>t(n),className:"flex w-full items-center gap-3 py-1.5 px-1.5 text-left text-[var(--wui-color-text)] transition-colors hover:bg-[var(--wui-color-bg-hover)] rounded-xl",children:[L.jsx("div",{className:"flex-shrink-0 h-8 w-8 rounded-md overflow-hidden bg-[var(--wui-color-bg-secondary)] flex items-center justify-center",children:L.jsx("img",{src:n.metadata.icon,alt:`${n.metadata.name} icon`,className:"h-8 w-8 object-contain rounded-md"})}),L.jsx("span",{className:"text-lg font-bold wallet-custom-font",children:n.metadata.name})]})},n.id)),e.length===0&&L.jsx("p",{className:"text-center text-[var(--wui-color-text-secondary)]",children:"No wallets found."})]})}function nc({children:e}){const[t,n]=O.useState(!1),[r,o]=O.useState(null),{wallets:i,activeAddress:s}=xt.useWallet(),{theme:a}=uo(),l=a==="system"?void 0:a,{refs:c,context:d}=Hl({open:t,onOpenChange:u=>{u&&s||(u?(n(!0),o("starting"),requestAnimationFrame(()=>{o("entered")})):(o("exiting"),setTimeout(()=>{n(!1),o(null)},150)))}}),h=jl(d),m=Bl(d,{outsidePressEvent:"mousedown"}),f=eh(d,{role:"dialog"}),{getReferenceProps:x,getFloatingProps:b}=Wl([h,m,f]),R=Wn(),$=Wn(),w=async u=>{try{await u.connect(),d.onOpenChange(!1)}catch(p){console.error(`Error connecting to ${u.metadata.name}:`,p),d.onOpenChange(!1)}},T=u=>{s||d.onOpenChange(!0)},N=e||L.jsx(Di,{}),D=Ad([c.setReference,N.ref||null]),j={...x(),ref:D,onClick:T},W=O.cloneElement(N,j);return L.jsxs(L.Fragment,{children:[W,L.jsx(Dl,{id:"wallet-dialog-portal",children:t&&L.jsx("div",{"data-wallet-ui":!0,"data-wallet-ui-scope":!0,"data-theme":l,children:L.jsx(Qd,{className:"grid place-items-center px-4 z-50 transition-opacity duration-150 ease-in-out bg-[var(--wui-color-overlay)] data-[state=starting]:opacity-0 data-[state=exiting]:opacity-0 data-[state=entered]:opacity-100","data-state":r,lockScroll:!0,children:L.jsx(Ll,{context:d,modal:!0,children:L.jsxs("div",{ref:c.setFloating,...b({"aria-labelledby":R,"aria-describedby":$}),"data-state":r,className:"w-full max-w-sm rounded-3xl bg-[var(--wui-color-bg)] shadow-xl transform transition-all duration-150 ease-in-out data-[state=starting]:opacity-0 data-[state=starting]:scale-90 data-[state=exiting]:opacity-0 data-[state=exiting]:scale-90 data-[state=entered]:opacity-100 data-[state=entered]:scale-100",style:{marginTop:"-0.5rem"},children:[L.jsxs("div",{className:"relative flex items-center px-6 pt-5 pb-4",children:[L.jsx("h2",{id:R,className:"text-xl font-bold text-[var(--wui-color-text)] wallet-custom-font",children:"Connect a Wallet"}),L.jsx("button",{onClick:()=>d.onOpenChange(!1),className:"absolute right-4 rounded-full bg-[var(--wui-color-bg-tertiary)] p-2 text-[var(--wui-color-text-secondary)] hover:brightness-90 transition-all","aria-label":"Close dialog",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:L.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]}),L.jsx("div",{className:"px-4 pb-3",children:L.jsx(tc,{wallets:i,handleWalletClick:w})}),L.jsxs("div",{className:"px-6 py-5 border-t border-[var(--wui-color-border)] flex items-center justify-between",children:[L.jsx("span",{className:"text-[var(--wui-color-text-secondary)] text-sm",children:"Need an Algorand wallet?"}),L.jsx("a",{href:"https://algorand.co/wallets",className:"text-[var(--wui-color-link)] font-medium text-sm hover:text-[var(--wui-color-link-hover)]",target:"_blank",rel:"noopener noreferrer",children:"Start here →"})]})]})})})})})]})}var Bh=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Io=Math.ceil,He=Math.floor,Fe="[BigNumber Error] ",na=Fe+"Number primitive has more than 15 significant digits: ",Ge=1e14,te=14,ra=9007199254740991,Do=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],At=1e7,Me=1e9;function rc(e){var t,n,r,o=w.prototype={constructor:w,toString:null,valueOf:null},i=new w(1),s=20,a=4,l=-7,c=21,d=-1e7,h=1e7,m=!1,f=1,x=0,b={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},R="0123456789abcdefghijklmnopqrstuvwxyz",$=!0;function w(u,p){var g,C,S,A,k,v,E,F,y=this;if(!(y instanceof w))return new w(u,p);if(p==null){if(u&&u._isBigNumber===!0){y.s=u.s,!u.c||u.e>h?y.c=y.e=null:u.e<d?y.c=[y.e=0]:(y.e=u.e,y.c=u.c.slice());return}if((v=typeof u=="number")&&u*0==0){if(y.s=1/u<0?(u=-u,-1):1,u===~~u){for(A=0,k=u;k>=10;k/=10,A++);A>h?y.c=y.e=null:(y.e=A,y.c=[u]);return}F=String(u)}else{if(!Bh.test(F=String(u)))return r(y,F,v);y.s=F.charCodeAt(0)==45?(F=F.slice(1),-1):1}(A=F.indexOf("."))>-1&&(F=F.replace(".","")),(k=F.search(/e/i))>0?(A<0&&(A=k),A+=+F.slice(k+1),F=F.substring(0,k)):A<0&&(A=F.length)}else{if(fe(p,2,R.length,"Base"),p==10&&$)return y=new w(u),j(y,s+y.e+1,a);if(F=String(u),v=typeof u=="number"){if(u*0!=0)return r(y,F,v,p);if(y.s=1/u<0?(F=F.slice(1),-1):1,w.DEBUG&&F.replace(/^0\.0*|\./,"").length>15)throw Error(na+u)}else y.s=F.charCodeAt(0)===45?(F=F.slice(1),-1):1;for(g=R.slice(0,p),A=k=0,E=F.length;k<E;k++)if(g.indexOf(C=F.charAt(k))<0){if(C=="."){if(k>A){A=E;continue}}else if(!S&&(F==F.toUpperCase()&&(F=F.toLowerCase())||F==F.toLowerCase()&&(F=F.toUpperCase()))){S=!0,k=-1,A=0;continue}return r(y,String(u),v,p)}v=!1,F=n(F,p,10,y.s),(A=F.indexOf("."))>-1?F=F.replace(".",""):A=F.length}for(k=0;F.charCodeAt(k)===48;k++);for(E=F.length;F.charCodeAt(--E)===48;);if(F=F.slice(k,++E)){if(E-=k,v&&w.DEBUG&&E>15&&(u>ra||u!==He(u)))throw Error(na+y.s*u);if((A=A-k-1)>h)y.c=y.e=null;else if(A<d)y.c=[y.e=0];else{if(y.e=A,y.c=[],k=(A+1)%te,A<0&&(k+=te),k<E){for(k&&y.c.push(+F.slice(0,k)),E-=te;k<E;)y.c.push(+F.slice(k,k+=te));k=te-(F=F.slice(k)).length}else k-=E;for(;k--;F+="0");y.c.push(+F)}}else y.c=[y.e=0]}w.clone=rc,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(u){var p,g;if(u!=null)if(typeof u=="object"){if(u.hasOwnProperty(p="DECIMAL_PLACES")&&(g=u[p],fe(g,0,Me,p),s=g),u.hasOwnProperty(p="ROUNDING_MODE")&&(g=u[p],fe(g,0,8,p),a=g),u.hasOwnProperty(p="EXPONENTIAL_AT")&&(g=u[p],g&&g.pop?(fe(g[0],-1e9,0,p),fe(g[1],0,Me,p),l=g[0],c=g[1]):(fe(g,-1e9,Me,p),l=-(c=g<0?-g:g))),u.hasOwnProperty(p="RANGE"))if(g=u[p],g&&g.pop)fe(g[0],-1e9,-1,p),fe(g[1],1,Me,p),d=g[0],h=g[1];else if(fe(g,-1e9,Me,p),g)d=-(h=g<0?-g:g);else throw Error(Fe+p+" cannot be zero: "+g);if(u.hasOwnProperty(p="CRYPTO"))if(g=u[p],g===!!g)if(g)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))m=g;else throw m=!g,Error(Fe+"crypto unavailable");else m=g;else throw Error(Fe+p+" not true or false: "+g);if(u.hasOwnProperty(p="MODULO_MODE")&&(g=u[p],fe(g,0,9,p),f=g),u.hasOwnProperty(p="POW_PRECISION")&&(g=u[p],fe(g,0,Me,p),x=g),u.hasOwnProperty(p="FORMAT"))if(g=u[p],typeof g=="object")b=g;else throw Error(Fe+p+" not an object: "+g);if(u.hasOwnProperty(p="ALPHABET"))if(g=u[p],typeof g=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(g))$=g.slice(0,10)=="0123456789",R=g;else throw Error(Fe+p+" invalid: "+g)}else throw Error(Fe+"Object expected: "+u);return{DECIMAL_PLACES:s,ROUNDING_MODE:a,EXPONENTIAL_AT:[l,c],RANGE:[d,h],CRYPTO:m,MODULO_MODE:f,POW_PRECISION:x,FORMAT:b,ALPHABET:R}},w.isBigNumber=function(u){if(!u||u._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var p,g,C=u.c,S=u.e,A=u.s;e:if({}.toString.call(C)=="[object Array]"){if((A===1||A===-1)&&S>=-1e9&&S<=Me&&S===He(S)){if(C[0]===0){if(S===0&&C.length===1)return!0;break e}if(p=(S+1)%te,p<1&&(p+=te),String(C[0]).length==p){for(p=0;p<C.length;p++)if(g=C[p],g<0||g>=Ge||g!==He(g))break e;if(g!==0)return!0}}}else if(C===null&&S===null&&(A===null||A===1||A===-1))return!0;throw Error(Fe+"Invalid BigNumber: "+u)},w.maximum=w.max=function(){return N(arguments,-1)},w.minimum=w.min=function(){return N(arguments,1)},w.random=function(){var u=9007199254740992,p=Math.random()*u&2097151?function(){return He(Math.random()*u)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(g){var C,S,A,k,v,E=0,F=[],y=new w(i);if(g==null?g=s:fe(g,0,Me),k=Io(g/te),m)if(crypto.getRandomValues){for(C=crypto.getRandomValues(new Uint32Array(k*=2));E<k;)v=C[E]*131072+(C[E+1]>>>11),v>=9e15?(S=crypto.getRandomValues(new Uint32Array(2)),C[E]=S[0],C[E+1]=S[1]):(F.push(v%1e14),E+=2);E=k/2}else if(crypto.randomBytes){for(C=crypto.randomBytes(k*=7);E<k;)v=(C[E]&31)*281474976710656+C[E+1]*1099511627776+C[E+2]*4294967296+C[E+3]*16777216+(C[E+4]<<16)+(C[E+5]<<8)+C[E+6],v>=9e15?crypto.randomBytes(7).copy(C,E):(F.push(v%1e14),E+=7);E=k/7}else throw m=!1,Error(Fe+"crypto unavailable");if(!m)for(;E<k;)v=p(),v<9e15&&(F[E++]=v%1e14);for(k=F[--E],g%=te,k&&g&&(v=Do[te-g],F[E]=He(k/v)*v);F[E]===0;F.pop(),E--);if(E<0)F=[A=0];else{for(A=-1;F[0]===0;F.splice(0,1),A-=te);for(E=1,v=F[0];v>=10;v/=10,E++);E<te&&(A-=te-E)}return y.e=A,y.c=F,y}}(),w.sum=function(){for(var u=1,p=arguments,g=new w(p[0]);u<p.length;)g=g.plus(p[u++]);return g},n=function(){var u="0123456789";function p(g,C,S,A){for(var k,v=[0],E,F=0,y=g.length;F<y;){for(E=v.length;E--;v[E]*=C);for(v[0]+=A.indexOf(g.charAt(F++)),k=0;k<v.length;k++)v[k]>S-1&&(v[k+1]==null&&(v[k+1]=0),v[k+1]+=v[k]/S|0,v[k]%=S)}return v.reverse()}return function(g,C,S,A,k){var v,E,F,y,M,B,V,H,_=g.indexOf("."),ee=s,Z=a;for(_>=0&&(y=x,x=0,g=g.replace(".",""),H=new w(C),B=H.pow(g.length-_),x=y,H.c=p(vt(je(B.c),B.e,"0"),10,S,u),H.e=H.c.length),V=p(g,C,S,k?(v=R,u):(v=u,R)),F=y=V.length;V[--y]==0;V.pop());if(!V[0])return v.charAt(0);if(_<0?--F:(B.c=V,B.e=F,B.s=A,B=t(B,H,ee,Z,S),V=B.c,M=B.r,F=B.e),E=F+ee+1,_=V[E],y=S/2,M=M||E<0||V[E+1]!=null,M=Z<4?(_!=null||M)&&(Z==0||Z==(B.s<0?3:2)):_>y||_==y&&(Z==4||M||Z==6&&V[E-1]&1||Z==(B.s<0?8:7)),E<1||!V[0])g=M?vt(v.charAt(1),-ee,v.charAt(0)):v.charAt(0);else{if(V.length=E,M)for(--S;++V[--E]>S;)V[E]=0,E||(++F,V=[1].concat(V));for(y=V.length;!V[--y];);for(_=0,g="";_<=y;g+=v.charAt(V[_++]));g=vt(g,F,v.charAt(0))}return g}}(),t=function(){function u(C,S,A){var k,v,E,F,y=0,M=C.length,B=S%At,V=S/At|0;for(C=C.slice();M--;)E=C[M]%At,F=C[M]/At|0,k=V*E+F*B,v=B*E+k%At*At+y,y=(v/A|0)+(k/At|0)+V*F,C[M]=v%A;return y&&(C=[y].concat(C)),C}function p(C,S,A,k){var v,E;if(A!=k)E=A>k?1:-1;else for(v=E=0;v<A;v++)if(C[v]!=S[v]){E=C[v]>S[v]?1:-1;break}return E}function g(C,S,A,k){for(var v=0;A--;)C[A]-=v,v=C[A]<S[A]?1:0,C[A]=v*k+C[A]-S[A];for(;!C[0]&&C.length>1;C.splice(0,1));}return function(C,S,A,k,v){var E,F,y,M,B,V,H,_,ee,Z,Y,U,ae,ge,Ee,Q,ne,X=C.s==S.s?1:-1,K=C.c,re=S.c;if(!K||!K[0]||!re||!re[0])return new w(!C.s||!S.s||(K?re&&K[0]==re[0]:!re)?NaN:K&&K[0]==0||!re?X*0:X/0);for(_=new w(X),ee=_.c=[],F=C.e-S.e,X=A+F+1,v||(v=Ge,F=We(C.e/te)-We(S.e/te),X=X/te|0),y=0;re[y]==(K[y]||0);y++);if(re[y]>(K[y]||0)&&F--,X<0)ee.push(1),M=!0;else{for(ge=K.length,Q=re.length,y=0,X+=2,B=He(v/(re[0]+1)),B>1&&(re=u(re,B,v),K=u(K,B,v),Q=re.length,ge=K.length),ae=Q,Z=K.slice(0,Q),Y=Z.length;Y<Q;Z[Y++]=0);ne=re.slice(),ne=[0].concat(ne),Ee=re[0],re[1]>=v/2&&Ee++;do{if(B=0,E=p(re,Z,Q,Y),E<0){if(U=Z[0],Q!=Y&&(U=U*v+(Z[1]||0)),B=He(U/Ee),B>1)for(B>=v&&(B=v-1),V=u(re,B,v),H=V.length,Y=Z.length;p(V,Z,H,Y)==1;)B--,g(V,Q<H?ne:re,H,v),H=V.length,E=1;else B==0&&(E=B=1),V=re.slice(),H=V.length;if(H<Y&&(V=[0].concat(V)),g(Z,V,Y,v),Y=Z.length,E==-1)for(;p(re,Z,Q,Y)<1;)B++,g(Z,Q<Y?ne:re,Y,v),Y=Z.length}else E===0&&(B++,Z=[0]);ee[y++]=B,Z[0]?Z[Y++]=K[ae]||0:(Z=[K[ae]],Y=1)}while((ae++<ge||Z[0]!=null)&&X--);M=Z[0]!=null,ee[0]||ee.splice(0,1)}if(v==Ge){for(y=1,X=ee[0];X>=10;X/=10,y++);j(_,A+(_.e=y+F*te-1)+1,k,M)}else _.e=F,_.r=+M;return _}}();function T(u,p,g,C){var S,A,k,v,E;if(g==null?g=a:fe(g,0,8),!u.c)return u.toString();if(S=u.c[0],k=u.e,p==null)E=je(u.c),E=C==1||C==2&&(k<=l||k>=c)?$r(E,k):vt(E,k,"0");else if(u=j(new w(u),p,g),A=u.e,E=je(u.c),v=E.length,C==1||C==2&&(p<=A||A<=l)){for(;v<p;E+="0",v++);E=$r(E,A)}else if(p-=k,E=vt(E,A,"0"),A+1>v){if(--p>0)for(E+=".";p--;E+="0");}else if(p+=A-v,p>0)for(A+1==v&&(E+=".");p--;E+="0");return u.s<0&&S?"-"+E:E}function N(u,p){for(var g,C,S=1,A=new w(u[0]);S<u.length;S++)C=new w(u[S]),(!C.s||(g=_t(A,C))===p||g===0&&A.s===p)&&(A=C);return A}function D(u,p,g){for(var C=1,S=p.length;!p[--S];p.pop());for(S=p[0];S>=10;S/=10,C++);return(g=C+g*te-1)>h?u.c=u.e=null:g<d?u.c=[u.e=0]:(u.e=g,u.c=p),u}r=function(){var u=/^(-?)0([xbo])(?=\w[\w.]*$)/i,p=/^([^.]+)\.$/,g=/^\.([^.]+)$/,C=/^-?(Infinity|NaN)$/,S=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,k,v,E){var F,y=v?k:k.replace(S,"");if(C.test(y))A.s=isNaN(y)?null:y<0?-1:1;else{if(!v&&(y=y.replace(u,function(M,B,V){return F=(V=V.toLowerCase())=="x"?16:V=="b"?2:8,!E||E==F?B:M}),E&&(F=E,y=y.replace(p,"$1").replace(g,"0.$1")),k!=y))return new w(y,F);if(w.DEBUG)throw Error(Fe+"Not a"+(E?" base "+E:"")+" number: "+k);A.s=null}A.c=A.e=null}}();function j(u,p,g,C){var S,A,k,v,E,F,y,M=u.c,B=Do;if(M){e:{for(S=1,v=M[0];v>=10;v/=10,S++);if(A=p-S,A<0)A+=te,k=p,E=M[F=0],y=He(E/B[S-k-1]%10);else if(F=Io((A+1)/te),F>=M.length)if(C){for(;M.length<=F;M.push(0));E=y=0,S=1,A%=te,k=A-te+1}else break e;else{for(E=v=M[F],S=1;v>=10;v/=10,S++);A%=te,k=A-te+S,y=k<0?0:He(E/B[S-k-1]%10)}if(C=C||p<0||M[F+1]!=null||(k<0?E:E%B[S-k-1]),C=g<4?(y||C)&&(g==0||g==(u.s<0?3:2)):y>5||y==5&&(g==4||C||g==6&&(A>0?k>0?E/B[S-k]:0:M[F-1])%10&1||g==(u.s<0?8:7)),p<1||!M[0])return M.length=0,C?(p-=u.e+1,M[0]=B[(te-p%te)%te],u.e=-p||0):M[0]=u.e=0,u;if(A==0?(M.length=F,v=1,F--):(M.length=F+1,v=B[te-A],M[F]=k>0?He(E/B[S-k]%B[k])*v:0),C)for(;;)if(F==0){for(A=1,k=M[0];k>=10;k/=10,A++);for(k=M[0]+=v,v=1;k>=10;k/=10,v++);A!=v&&(u.e++,M[0]==Ge&&(M[0]=1));break}else{if(M[F]+=v,M[F]!=Ge)break;M[F--]=0,v=1}for(A=M.length;M[--A]===0;M.pop());}u.e>h?u.c=u.e=null:u.e<d&&(u.c=[u.e=0])}return u}function W(u){var p,g=u.e;return g===null?u.toString():(p=je(u.c),p=g<=l||g>=c?$r(p,g):vt(p,g,"0"),u.s<0?"-"+p:p)}return o.absoluteValue=o.abs=function(){var u=new w(this);return u.s<0&&(u.s=1),u},o.comparedTo=function(u,p){return _t(this,new w(u,p))},o.decimalPlaces=o.dp=function(u,p){var g,C,S,A=this;if(u!=null)return fe(u,0,Me),p==null?p=a:fe(p,0,8),j(new w(A),u+A.e+1,p);if(!(g=A.c))return null;if(C=((S=g.length-1)-We(this.e/te))*te,S=g[S])for(;S%10==0;S/=10,C--);return C<0&&(C=0),C},o.dividedBy=o.div=function(u,p){return t(this,new w(u,p),s,a)},o.dividedToIntegerBy=o.idiv=function(u,p){return t(this,new w(u,p),0,1)},o.exponentiatedBy=o.pow=function(u,p){var g,C,S,A,k,v,E,F,y,M=this;if(u=new w(u),u.c&&!u.isInteger())throw Error(Fe+"Exponent not an integer: "+W(u));if(p!=null&&(p=new w(p)),v=u.e>14,!M.c||!M.c[0]||M.c[0]==1&&!M.e&&M.c.length==1||!u.c||!u.c[0])return y=new w(Math.pow(+W(M),v?u.s*(2-Pr(u)):+W(u))),p?y.mod(p):y;if(E=u.s<0,p){if(p.c?!p.c[0]:!p.s)return new w(NaN);C=!E&&M.isInteger()&&p.isInteger(),C&&(M=M.mod(p))}else{if(u.e>9&&(M.e>0||M.e<-1||(M.e==0?M.c[0]>1||v&&M.c[1]>=24e7:M.c[0]<8e13||v&&M.c[0]<=9999975e7)))return A=M.s<0&&Pr(u)?-0:0,M.e>-1&&(A=1/A),new w(E?1/A:A);x&&(A=Io(x/te+2))}for(v?(g=new w(.5),E&&(u.s=1),F=Pr(u)):(S=Math.abs(+W(u)),F=S%2),y=new w(i);;){if(F){if(y=y.times(M),!y.c)break;A?y.c.length>A&&(y.c.length=A):C&&(y=y.mod(p))}if(S){if(S=He(S/2),S===0)break;F=S%2}else if(u=u.times(g),j(u,u.e+1,1),u.e>14)F=Pr(u);else{if(S=+W(u),S===0)break;F=S%2}M=M.times(M),A?M.c&&M.c.length>A&&(M.c.length=A):C&&(M=M.mod(p))}return C?y:(E&&(y=i.div(y)),p?y.mod(p):A?j(y,x,a,k):y)},o.integerValue=function(u){var p=new w(this);return u==null?u=a:fe(u,0,8),j(p,p.e+1,u)},o.isEqualTo=o.eq=function(u,p){return _t(this,new w(u,p))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(u,p){return _t(this,new w(u,p))>0},o.isGreaterThanOrEqualTo=o.gte=function(u,p){return(p=_t(this,new w(u,p)))===1||p===0},o.isInteger=function(){return!!this.c&&We(this.e/te)>this.c.length-2},o.isLessThan=o.lt=function(u,p){return _t(this,new w(u,p))<0},o.isLessThanOrEqualTo=o.lte=function(u,p){return(p=_t(this,new w(u,p)))===-1||p===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(u,p){var g,C,S,A,k=this,v=k.s;if(u=new w(u,p),p=u.s,!v||!p)return new w(NaN);if(v!=p)return u.s=-p,k.plus(u);var E=k.e/te,F=u.e/te,y=k.c,M=u.c;if(!E||!F){if(!y||!M)return y?(u.s=-p,u):new w(M?k:NaN);if(!y[0]||!M[0])return M[0]?(u.s=-p,u):new w(y[0]?k:a==3?-0:0)}if(E=We(E),F=We(F),y=y.slice(),v=E-F){for((A=v<0)?(v=-v,S=y):(F=E,S=M),S.reverse(),p=v;p--;S.push(0));S.reverse()}else for(C=(A=(v=y.length)<(p=M.length))?v:p,v=p=0;p<C;p++)if(y[p]!=M[p]){A=y[p]<M[p];break}if(A&&(S=y,y=M,M=S,u.s=-u.s),p=(C=M.length)-(g=y.length),p>0)for(;p--;y[g++]=0);for(p=Ge-1;C>v;){if(y[--C]<M[C]){for(g=C;g&&!y[--g];y[g]=p);--y[g],y[C]+=Ge}y[C]-=M[C]}for(;y[0]==0;y.splice(0,1),--F);return y[0]?D(u,y,F):(u.s=a==3?-1:1,u.c=[u.e=0],u)},o.modulo=o.mod=function(u,p){var g,C,S=this;return u=new w(u,p),!S.c||!u.s||u.c&&!u.c[0]?new w(NaN):!u.c||S.c&&!S.c[0]?new w(S):(f==9?(C=u.s,u.s=1,g=t(S,u,0,3),u.s=C,g.s*=C):g=t(S,u,0,f),u=S.minus(g.times(u)),!u.c[0]&&f==1&&(u.s=S.s),u)},o.multipliedBy=o.times=function(u,p){var g,C,S,A,k,v,E,F,y,M,B,V,H,_,ee,Z=this,Y=Z.c,U=(u=new w(u,p)).c;if(!Y||!U||!Y[0]||!U[0])return!Z.s||!u.s||Y&&!Y[0]&&!U||U&&!U[0]&&!Y?u.c=u.e=u.s=null:(u.s*=Z.s,!Y||!U?u.c=u.e=null:(u.c=[0],u.e=0)),u;for(C=We(Z.e/te)+We(u.e/te),u.s*=Z.s,E=Y.length,M=U.length,E<M&&(H=Y,Y=U,U=H,S=E,E=M,M=S),S=E+M,H=[];S--;H.push(0));for(_=Ge,ee=At,S=M;--S>=0;){for(g=0,B=U[S]%ee,V=U[S]/ee|0,k=E,A=S+k;A>S;)F=Y[--k]%ee,y=Y[k]/ee|0,v=V*F+y*B,F=B*F+v%ee*ee+H[A]+g,g=(F/_|0)+(v/ee|0)+V*y,H[A--]=F%_;H[A]=g}return g?++C:H.splice(0,1),D(u,H,C)},o.negated=function(){var u=new w(this);return u.s=-u.s||null,u},o.plus=function(u,p){var g,C=this,S=C.s;if(u=new w(u,p),p=u.s,!S||!p)return new w(NaN);if(S!=p)return u.s=-p,C.minus(u);var A=C.e/te,k=u.e/te,v=C.c,E=u.c;if(!A||!k){if(!v||!E)return new w(S/0);if(!v[0]||!E[0])return E[0]?u:new w(v[0]?C:S*0)}if(A=We(A),k=We(k),v=v.slice(),S=A-k){for(S>0?(k=A,g=E):(S=-S,g=v),g.reverse();S--;g.push(0));g.reverse()}for(S=v.length,p=E.length,S-p<0&&(g=E,E=v,v=g,p=S),S=0;p;)S=(v[--p]=v[p]+E[p]+S)/Ge|0,v[p]=Ge===v[p]?0:v[p]%Ge;return S&&(v=[S].concat(v),++k),D(u,v,k)},o.precision=o.sd=function(u,p){var g,C,S,A=this;if(u!=null&&u!==!!u)return fe(u,1,Me),p==null?p=a:fe(p,0,8),j(new w(A),u,p);if(!(g=A.c))return null;if(S=g.length-1,C=S*te+1,S=g[S]){for(;S%10==0;S/=10,C--);for(S=g[0];S>=10;S/=10,C++);}return u&&A.e+1>C&&(C=A.e+1),C},o.shiftedBy=function(u){return fe(u,-9007199254740991,ra),this.times("1e"+u)},o.squareRoot=o.sqrt=function(){var u,p,g,C,S,A=this,k=A.c,v=A.s,E=A.e,F=s+4,y=new w("0.5");if(v!==1||!k||!k[0])return new w(!v||v<0&&(!k||k[0])?NaN:k?A:1/0);if(v=Math.sqrt(+W(A)),v==0||v==1/0?(p=je(k),(p.length+E)%2==0&&(p+="0"),v=Math.sqrt(+p),E=We((E+1)/2)-(E<0||E%2),v==1/0?p="5e"+E:(p=v.toExponential(),p=p.slice(0,p.indexOf("e")+1)+E),g=new w(p)):g=new w(v+""),g.c[0]){for(E=g.e,v=E+F,v<3&&(v=0);;)if(S=g,g=y.times(S.plus(t(A,S,F,1))),je(S.c).slice(0,v)===(p=je(g.c)).slice(0,v))if(g.e<E&&--v,p=p.slice(v-3,v+1),p=="9999"||!C&&p=="4999"){if(!C&&(j(S,S.e+s+2,0),S.times(S).eq(A))){g=S;break}F+=4,v+=4,C=1}else{(!+p||!+p.slice(1)&&p.charAt(0)=="5")&&(j(g,g.e+s+2,1),u=!g.times(g).eq(A));break}}return j(g,g.e+s+1,a,u)},o.toExponential=function(u,p){return u!=null&&(fe(u,0,Me),u++),T(this,u,p,1)},o.toFixed=function(u,p){return u!=null&&(fe(u,0,Me),u=u+this.e+1),T(this,u,p)},o.toFormat=function(u,p,g){var C,S=this;if(g==null)u!=null&&p&&typeof p=="object"?(g=p,p=null):u&&typeof u=="object"?(g=u,u=p=null):g=b;else if(typeof g!="object")throw Error(Fe+"Argument not an object: "+g);if(C=S.toFixed(u,p),S.c){var A,k=C.split("."),v=+g.groupSize,E=+g.secondaryGroupSize,F=g.groupSeparator||"",y=k[0],M=k[1],B=S.s<0,V=B?y.slice(1):y,H=V.length;if(E&&(A=v,v=E,E=A,H-=A),v>0&&H>0){for(A=H%v||v,y=V.substr(0,A);A<H;A+=v)y+=F+V.substr(A,v);E>0&&(y+=F+V.slice(A)),B&&(y="-"+y)}C=M?y+(g.decimalSeparator||"")+((E=+g.fractionGroupSize)?M.replace(new RegExp("\\d{"+E+"}\\B","g"),"$&"+(g.fractionGroupSeparator||"")):M):y}return(g.prefix||"")+C+(g.suffix||"")},o.toFraction=function(u){var p,g,C,S,A,k,v,E,F,y,M,B,V=this,H=V.c;if(u!=null&&(v=new w(u),!v.isInteger()&&(v.c||v.s!==1)||v.lt(i)))throw Error(Fe+"Argument "+(v.isInteger()?"out of range: ":"not an integer: ")+W(v));if(!H)return new w(V);for(p=new w(i),F=g=new w(i),C=E=new w(i),B=je(H),A=p.e=B.length-V.e-1,p.c[0]=Do[(k=A%te)<0?te+k:k],u=!u||v.comparedTo(p)>0?A>0?p:F:v,k=h,h=1/0,v=new w(B),E.c[0]=0;y=t(v,p,0,1),S=g.plus(y.times(C)),S.comparedTo(u)!=1;)g=C,C=S,F=E.plus(y.times(S=F)),E=S,p=v.minus(y.times(S=p)),v=S;return S=t(u.minus(g),C,0,1),E=E.plus(S.times(F)),g=g.plus(S.times(C)),E.s=F.s=V.s,A=A*2,M=t(F,C,A,a).minus(V).abs().comparedTo(t(E,g,A,a).minus(V).abs())<1?[F,C]:[E,g],h=k,M},o.toNumber=function(){return+W(this)},o.toPrecision=function(u,p){return u!=null&&fe(u,1,Me),T(this,u,p,2)},o.toString=function(u){var p,g=this,C=g.s,S=g.e;return S===null?C?(p="Infinity",C<0&&(p="-"+p)):p="NaN":(u==null?p=S<=l||S>=c?$r(je(g.c),S):vt(je(g.c),S,"0"):u===10&&$?(g=j(new w(g),s+S+1,a),p=vt(je(g.c),g.e,"0")):(fe(u,2,R.length,"Base"),p=n(vt(je(g.c),S,"0"),10,u,C,!0)),C<0&&g.c[0]&&(p="-"+p)),p},o.valueOf=o.toJSON=function(){return W(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&w.set(e),w}function We(e){var t=e|0;return e>0||e===t?t:t-1}function je(e){for(var t,n,r=1,o=e.length,i=e[0]+"";r<o;){for(t=e[r++]+"",n=te-t.length;n--;t="0"+t);i+=t}for(o=i.length;i.charCodeAt(--o)===48;);return i.slice(0,o+1||1)}function _t(e,t){var n,r,o=e.c,i=t.c,s=e.s,a=t.s,l=e.e,c=t.e;if(!s||!a)return null;if(n=o&&!o[0],r=i&&!i[0],n||r)return n?r?0:-a:s;if(s!=a)return s;if(n=s<0,r=l==c,!o||!i)return r?0:!o^n?1:-1;if(!r)return l>c^n?1:-1;for(a=(l=o.length)<(c=i.length)?l:c,s=0;s<a;s++)if(o[s]!=i[s])return o[s]>i[s]^n?1:-1;return l==c?0:l>c^n?1:-1}function fe(e,t,n,r){if(e<t||e>n||e!==He(e))throw Error(Fe+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Pr(e){var t=e.c.length-1;return We(e.e/te)==t&&e.c[t]%2!=0}function $r(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function vt(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}rc();const Hh=100000n,Wh=(e,t={})=>{const{style:n="decimal",compact:r=!1,fractionDigits:o,adaptiveDecimals:i=!1}=t,s=typeof e=="string"?Number(e):e,a=typeof s=="bigint"?s<0n?-s:s:Math.abs(s),l=r==="auto"?a>=Hh:r,c=typeof s=="bigint"?Number(s):s,d=i&&c!==0&&Math.abs(c)<Math.pow(10,-(o??2)),h=new Intl.NumberFormat("en-US",{style:n,...n==="currency"&&{currency:"USD"},maximumFractionDigits:d?20:o??2,minimumFractionDigits:d?0:o??2});if(!l)return d?h.format(oa(c)):h.format(s);const m=[{threshold:1e12,suffix:"T",divisor:1e12},{threshold:1e9,suffix:"B",divisor:1e9},{threshold:1e6,suffix:"M",divisor:1e6},{threshold:1e3,suffix:"K",divisor:1e3}].find(f=>a>=f.threshold);if(m){const f=new Intl.NumberFormat("en-US",{style:n,...n==="currency"&&{currency:"USD"},maximumFractionDigits:o??1,minimumFractionDigits:o??1}),x=Number(s)/m.divisor;return f.format(x)+m.suffix}return d?h.format(oa(c)):h.format(s)};function oa(e){if(e===0)return 0;const t=e.toExponential().split("e"),n=parseInt(t[1]),r=Math.abs(n);return Number(e.toFixed(r))}function Xn(e,t=5,n=5){return e?e.length<=t+n?e:`${e.slice(0,t)}...${e.slice(-n)}`:""}function qi(e={}){const{activeAddress:t}=xt.useWallet(),{activeNetwork:n}=xt.useNetwork(),{enabled:r=!0,view:o="thumbnail"}=e;return Vi({queryKey:["nfd",t,n,o],queryFn:async({signal:i})=>{if(!t)return null;const l=await fetch(`${n==="testnet"?"https://api.testnet.nf.domains":"https://api.nf.domains"}/nfd/lookup?address=${encodeURIComponent(t)}&view=${o}`,{method:"GET",headers:{Accept:"application/json"},signal:i});if(l.status===404)return null;if(!l.ok)throw new Error(`NFD lookup failed: ${l.statusText}`);return(await l.json())[t]},enabled:r&&!!t,retry:(i,s)=>s instanceof Error&&s.message.includes("404")?!1:i<3,refetchOnWindowFocus:!0})}const ia="https://ipfs.algonode.dev",Uh=async e=>{if(!e.startsWith("ipfs://"))return e;const t=e.replace("ipfs://",""),n=`https://images.nf.domains/ipfs/${t}`,r=`${ia}/ipfs/${t}`,o=i=>i.startsWith("image/");try{const i=await fetch(n,{method:"HEAD"});if(i.ok){const s=i.headers.get("content-type");if(s&&o(s))return n}}catch{console.info(`CID ${t} is not cached on images.nf.domains, trying IPFS gateway...`)}try{const i=await fetch(r,{method:"HEAD"});if(i.ok){const s=i.headers.get("content-type");if(s&&o(s))return r;if(s==="application/json")try{const c=(await(await fetch(r)).json()).image;if(c){if(c.startsWith("ipfs://")){const d=c.replace("ipfs://",""),h=`${ia}/ipfs/${d}`,m=await fetch(h,{method:"HEAD"});if(m.ok){const f=m.headers.get("content-type");if(f&&o(f))return h}}else if(c.startsWith("http"))try{const d=await fetch(c,{method:"HEAD"});if(d.ok){const h=d.headers.get("content-type");if(h&&o(h))return c}}catch{console.error("Error checking HTTP image URL")}}}catch{console.error("Error processing JSON metadata")}}}catch{console.error(`Error checking gateway for CID ${t}`)}return r};function zi({nfd:e,alt:t,className:n,size:r=40,fallback:o,lightOnly:i=!1}){var d,h,m,f;const s=((h=(d=e==null?void 0:e.properties)==null?void 0:d.userDefined)==null?void 0:h.avatar)||((f=(m=e==null?void 0:e.properties)==null?void 0:m.verified)==null?void 0:f.avatar)||null,a=t||(e==null?void 0:e.name)||"NFD Avatar",{data:l,isLoading:c}=Vi({queryKey:["nfd-avatar",s],queryFn:async()=>s?s.startsWith("https://")&&!s.includes("/ipfs/")?s:s.startsWith("ipfs://")||s.includes("/ipfs/")?await Uh(s):s:null,enabled:!!s,staleTime:60*60*1e3,gcTime:24*60*60*1e3});return c||!l?o?L.jsx(L.Fragment,{children:o}):L.jsx("div",{className:En("flex items-center justify-center rounded-full",i?"bg-gray-200 dark:bg-gray-200":"bg-gray-200 dark:bg-[#192A39]",n),style:{width:`${r}px`,height:`${r}px`},"aria-label":a,role:"img",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:En("text-gray-400",!i&&"dark:text-gray-500"),style:{width:`${Math.max(r/2,12)}px`,height:`${Math.max(r/2,12)}px`},children:L.jsx("path",{fillRule:"evenodd",d:"M7.5 6a4.5 4.5 0 119 0 4.5 4.5 0 01-9 0zM3.751 20.105a8.25 8.25 0 0116.498 0 .75.75 0 01-.437.695A18.683 18.683 0 0112 22.5c-2.786 0-5.433-.608-7.812-1.7a.75.75 0 01-.437-.695z",clipRule:"evenodd"})})}):L.jsx("img",{src:l,alt:a,className:En("rounded-full",n),style:{width:`${r}px`,height:`${r}px`,objectFit:"cover"},loading:"lazy"})}const fo=O.forwardRef(({className:e="",children:t,style:n,...r},o)=>{var c;const{activeAddress:i}=xt.useWallet(),s=qi({enabled:!!i}),a=((c=s.data)==null?void 0:c.name)??null;return L.jsx("button",{ref:o,className:En("flex items-center py-2.5 pl-3 md:pl-3.5 pr-3 bg-[var(--wui-color-primary)] text-[var(--wui-color-primary-text)] rounded-xl cursor-pointer font-bold",e),style:n,disabled:!1,...r,type:"button",children:t||L.jsxs("div",{className:"flex items-center",children:[i&&L.jsx("div",{className:"mr-1 md:mr-2 h-6 w-6 overflow-hidden",children:L.jsx(zi,{nfd:s.data,alt:`${a||i} avatar`,size:24,lightOnly:!0})}),L.jsx("span",{className:"hidden md:block max-w-[160px] truncate",children:a||(i?Xn(i,6,4):"Connect")}),i&&L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 16 16",fill:"none",className:"ml-1.5 mt-0.5","aria-hidden":"true",children:L.jsx("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})});fo.displayName="ConnectedWalletButton";const oc=typeof document<"u"?O.useLayoutEffect:()=>{};function Vh(e){const t=O.useRef(null);return oc(()=>{t.current=e},[e]),O.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const zt=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Yt=e=>e&&"window"in e&&e.window===e?e:zt(e).defaultView||window;function qh(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function zh(e){return qh(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Gh=!1;function Gi(){return Gh}function ic(e,t){if(!Gi())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:zh(n)?n=n.host:n=n.parentNode}return!1}const wi=(e=document)=>{var t;if(!Gi())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function sc(e){return Gi()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function ho(e){var t;return typeof window>"u"||window.navigator==null?!1:((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands.some(n=>e.test(n.brand)))||e.test(window.navigator.userAgent)}function _i(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Rt(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Qi=Rt(function(){return _i(/^Mac/i)}),_h=Rt(function(){return _i(/^iPhone/i)}),Qh=Rt(function(){return _i(/^iPad/i)||Qi()&&navigator.maxTouchPoints>1}),Kh=Rt(function(){return _h()||Qh()});Rt(function(){return Qi()||Kh()});Rt(function(){return ho(/AppleWebKit/i)&&!Yh()});const Yh=Rt(function(){return ho(/Chrome/i)}),Xh=Rt(function(){return ho(/Android/i)});Rt(function(){return ho(/Firefox/i)});function ac(){let e=O.useRef(new Map),t=O.useCallback((o,i,s,a)=>{let l=a!=null&&a.once?(...c)=>{e.current.delete(s),s(...c)}:s;e.current.set(s,{type:i,eventTarget:o,fn:l,options:a}),o.addEventListener(i,l,a)},[]),n=O.useCallback((o,i,s,a)=>{var l;let c=((l=e.current.get(s))===null||l===void 0?void 0:l.fn)||s;o.removeEventListener(i,c,a),e.current.delete(s)},[]),r=O.useCallback(()=>{e.current.forEach((o,i)=>{n(o.eventTarget,o.type,i,o.options)})},[n]);return O.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Jh(e){return e.mozInputSource===0&&e.isTrusted?!0:Xh()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function lc(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Zh(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function cc(e){let t=O.useRef({isFocused:!1,observer:null});oc(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=Vh(r=>{e==null||e(r)});return O.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,i=s=>{if(t.current.isFocused=!1,o.disabled){let a=lc(s);n(a)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",i,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var s;(s=t.current.observer)===null||s===void 0||s.disconnect();let a=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:a})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:a}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let ep=!1,vr=null,xi=new Set,tr=new Map,hn=!1,Ei=!1;const tp={Tab:!0,Escape:!0};function Ki(e,t){for(let n of xi)n(e,t)}function np(e){return!(e.metaKey||!Qi()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Xr(e){hn=!0,np(e)&&(vr="keyboard",Ki("keyboard",e))}function Ve(e){vr="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(hn=!0,Ki("pointer",e))}function uc(e){Jh(e)&&(hn=!0,vr="virtual")}function fc(e){e.target===window||e.target===document||ep||!e.isTrusted||(!hn&&!Ei&&(vr="virtual",Ki("virtual",e)),hn=!1,Ei=!1)}function dc(){hn=!1,Ei=!0}function Ri(e){if(typeof window>"u"||typeof document>"u"||tr.get(Yt(e)))return;const t=Yt(e),n=zt(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){hn=!0,r.apply(this,arguments)},n.addEventListener("keydown",Xr,!0),n.addEventListener("keyup",Xr,!0),n.addEventListener("click",uc,!0),t.addEventListener("focus",fc,!0),t.addEventListener("blur",dc,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",Ve,!0),n.addEventListener("pointermove",Ve,!0),n.addEventListener("pointerup",Ve,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",Ve,!0),n.addEventListener("mousemove",Ve,!0),n.addEventListener("mouseup",Ve,!0)),t.addEventListener("beforeunload",()=>{hc(e)},{once:!0}),tr.set(t,{focus:r})}const hc=(e,t)=>{const n=Yt(e),r=zt(e);t&&r.removeEventListener("DOMContentLoaded",t),tr.has(n)&&(n.HTMLElement.prototype.focus=tr.get(n).focus,r.removeEventListener("keydown",Xr,!0),r.removeEventListener("keyup",Xr,!0),r.removeEventListener("click",uc,!0),n.removeEventListener("focus",fc,!0),n.removeEventListener("blur",dc,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",Ve,!0),r.removeEventListener("pointermove",Ve,!0),r.removeEventListener("pointerup",Ve,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",Ve,!0),r.removeEventListener("mousemove",Ve,!0),r.removeEventListener("mouseup",Ve,!0)),tr.delete(n))};function rp(e){const t=zt(e);let n;return t.readyState!=="loading"?Ri(e):(n=()=>{Ri(e)},t.addEventListener("DOMContentLoaded",n)),()=>hc(e,n)}typeof document<"u"&&rp();function pc(){return vr!=="pointer"}const op=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function ip(e,t,n){let r=zt(n==null?void 0:n.target);const o=typeof window<"u"?Yt(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,i=typeof window<"u"?Yt(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,s=typeof window<"u"?Yt(n==null?void 0:n.target).HTMLElement:HTMLElement,a=typeof window<"u"?Yt(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!op.has(r.activeElement.type)||r.activeElement instanceof i||r.activeElement instanceof s&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!tp[n.key])}function sp(e,t,n){Ri(),O.useEffect(()=>{let r=(o,i)=>{ip(!!(n!=null&&n.isTextInput),o,i)&&e(pc())};return xi.add(r),()=>{xi.delete(r)}},t)}function ap(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const i=O.useCallback(l=>{if(l.target===l.currentTarget)return r&&r(l),o&&o(!1),!0},[r,o]),s=cc(i),a=O.useCallback(l=>{const c=zt(l.target),d=c?wi(c):wi();l.target===l.currentTarget&&d===sc(l.nativeEvent)&&(n&&n(l),o&&o(!0),s(l))},[o,n,s]);return{focusProps:{onFocus:!t&&(n||o||r)?a:void 0,onBlur:!t&&(r||o)?i:void 0}}}function lp(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,i=O.useRef({isFocusWithin:!1}),{addGlobalListener:s,removeAllGlobalListeners:a}=ac(),l=O.useCallback(h=>{h.currentTarget.contains(h.target)&&i.current.isFocusWithin&&!h.currentTarget.contains(h.relatedTarget)&&(i.current.isFocusWithin=!1,a(),n&&n(h),o&&o(!1))},[n,o,i,a]),c=cc(l),d=O.useCallback(h=>{if(!h.currentTarget.contains(h.target))return;const m=zt(h.target),f=wi(m);if(!i.current.isFocusWithin&&f===sc(h.nativeEvent)){r&&r(h),o&&o(!0),i.current.isFocusWithin=!0,c(h);let x=h.currentTarget;s(m,"focus",b=>{if(i.current.isFocusWithin&&!ic(x,b.target)){let R=new m.defaultView.FocusEvent("blur",{relatedTarget:b.target});Zh(R,x);let $=lc(R);l($)}},{capture:!0})}},[r,o,c,s,l]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:l}}}let Jr=!1,No=0;function Si(){Jr=!0,setTimeout(()=>{Jr=!1},50)}function sa(e){e.pointerType==="touch"&&Si()}function cp(){if(!(typeof document>"u"))return typeof PointerEvent<"u"?document.addEventListener("pointerup",sa):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",Si),No++,()=>{No--,!(No>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",sa):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",Si))}}function up(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[i,s]=O.useState(!1),a=O.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;O.useEffect(cp,[]);let{addGlobalListener:l,removeAllGlobalListeners:c}=ac(),{hoverProps:d,triggerHoverEnd:h}=O.useMemo(()=>{let m=(b,R)=>{if(a.pointerType=R,o||R==="touch"||a.isHovered||!b.currentTarget.contains(b.target))return;a.isHovered=!0;let $=b.currentTarget;a.target=$,l(zt(b.target),"pointerover",w=>{a.isHovered&&a.target&&!ic(a.target,w.target)&&f(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:$,pointerType:R}),n&&n(!0),s(!0)},f=(b,R)=>{let $=a.target;a.pointerType="",a.target=null,!(R==="touch"||!a.isHovered||!$)&&(a.isHovered=!1,c(),r&&r({type:"hoverend",target:$,pointerType:R}),n&&n(!1),s(!1))},x={};return typeof PointerEvent<"u"?(x.onPointerEnter=b=>{Jr&&b.pointerType==="mouse"||m(b,b.pointerType)},x.onPointerLeave=b=>{!o&&b.currentTarget.contains(b.target)&&f(b,b.pointerType)}):process.env.NODE_ENV==="test"&&(x.onTouchStart=()=>{a.ignoreEmulatedMouseEvents=!0},x.onMouseEnter=b=>{!a.ignoreEmulatedMouseEvents&&!Jr&&m(b,"mouse"),a.ignoreEmulatedMouseEvents=!1},x.onMouseLeave=b=>{!o&&b.currentTarget.contains(b.target)&&f(b,"mouse")}),{hoverProps:x,triggerHoverEnd:f}},[t,n,r,o,a,l,c]);return O.useEffect(()=>{o&&h({currentTarget:a.target},a.pointerType)},[o]),{hoverProps:d,isHovered:i}}function fp(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=O.useRef({isFocused:!1,isFocusVisible:t||pc()}),[i,s]=O.useState(!1),[a,l]=O.useState(()=>o.current.isFocused&&o.current.isFocusVisible),c=O.useCallback(()=>l(o.current.isFocused&&o.current.isFocusVisible),[]),d=O.useCallback(f=>{o.current.isFocused=f,s(f),c()},[c]);sp(f=>{o.current.isFocusVisible=f,c()},[],{isTextInput:n});let{focusProps:h}=ap({isDisabled:r,onFocusChange:d}),{focusWithinProps:m}=lp({isDisabled:!r,onFocusWithinChange:d});return{isFocused:i,isFocusVisible:a,focusProps:r?m:h}}var dp=Object.defineProperty,hp=(e,t,n)=>t in e?dp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Lo=(e,t,n)=>(hp(e,typeof t!="symbol"?t+"":t,n),n);let pp=class{constructor(){Lo(this,"current",this.detect()),Lo(this,"handoffState","pending"),Lo(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},cn=new pp;function br(e){var t,n;return cn.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function mc(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Je(){let e=[],t={addEventListener(n,r,o,i){return n.addEventListener(r,o,i),t.add(()=>n.removeEventListener(r,o,i))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return mc(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let i=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:i})})},group(n){let r=Je();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function yr(){let[e]=O.useState(Je);return O.useEffect(()=>()=>e.dispose(),[e]),e}let xe=(e,t)=>{cn.isServer?O.useEffect(e,t):O.useLayoutEffect(e,t)};function zn(e){let t=O.useRef(e);return xe(()=>{t.current=e},[e]),t}let ce=function(e){let t=zn(e);return O.useCallback((...n)=>t.current(...n),[t])};function mp(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function gp(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function vp({disabled:e=!1}={}){let t=O.useRef(null),[n,r]=O.useState(!1),o=yr(),i=ce(()=>{t.current=null,r(!1),o.dispose()}),s=ce(a=>{if(o.dispose(),t.current===null){t.current=a.currentTarget,r(!0);{let l=br(a.currentTarget);o.addEventListener(l,"pointerup",i,!1),o.addEventListener(l,"pointermove",c=>{if(t.current){let d=mp(c);r(gp(d,t.current.getBoundingClientRect()))}},!1),o.addEventListener(l,"pointercancel",i,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:s,onPointerUp:i,onClick:i}}}let bp=O.createContext(void 0);function Yi(){return O.useContext(bp)}function aa(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function ut(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,ut),r}var Ci=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Ci||{}),yp=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(yp||{});function Ze(){let e=xp();return O.useCallback(t=>wp({mergeRefs:e,...t}),[e])}function wp({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:i=!0,name:s,mergeRefs:a}){a=a??Ep;let l=gc(t,e);if(i)return Mr(l,n,r,s,a);let c=o??0;if(c&2){let{static:d=!1,...h}=l;if(d)return Mr(h,n,r,s,a)}if(c&1){let{unmount:d=!0,...h}=l;return ut(d?0:1,{0(){return null},1(){return Mr({...h,hidden:!0,style:{display:"none"}},n,r,s,a)}})}return Mr(l,n,r,s,a)}function Mr(e,t={},n,r,o){let{as:i=n,children:s,refName:a="ref",...l}=jo(e,["unmount","static"]),c=e.ref!==void 0?{[a]:e.ref}:{},d=typeof s=="function"?s(t):s;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t)),l["aria-labelledby"]&&l["aria-labelledby"]===l.id&&(l["aria-labelledby"]=void 0);let h={};if(t){let m=!1,f=[];for(let[x,b]of Object.entries(t))typeof b=="boolean"&&(m=!0),b===!0&&f.push(x.replace(/([A-Z])/g,R=>`-${R.toLowerCase()}`));if(m){h["data-headlessui-state"]=f.join(" ");for(let x of f)h[`data-${x}`]=""}}if(i===O.Fragment&&(Object.keys(Kt(l)).length>0||Object.keys(Kt(h)).length>0))if(!O.isValidElement(d)||Array.isArray(d)&&d.length>1){if(Object.keys(Kt(l)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Kt(l)).concat(Object.keys(Kt(h))).map(m=>` - ${m}`).join(`
69
69
  `),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(m=>` - ${m}`).join(`
70
70
  `)].join(`
71
71
  `))}else{let m=d.props,f=m==null?void 0:m.className,x=typeof f=="function"?(...$)=>aa(f(...$),l.className):aa(f,l.className),b=x?{className:x}:{},R=gc(d.props,Kt(jo(l,["ref"])));for(let $ in h)$ in R&&delete h[$];return O.cloneElement(d,Object.assign({},R,h,c,{ref:o(Rp(d),c.ref)},b))}return O.createElement(i,Object.assign({},jo(l,["ref"]),i!==O.Fragment&&c,i!==O.Fragment&&h),d)}function xp(){let e=O.useRef([]),t=O.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function Ep(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function gc(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var i;return(i=o==null?void 0:o.preventDefault)==null?void 0:i.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...i){let s=n[r];for(let a of s){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;a(o,...i)}}});return t}function vc(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let i=n[r];for(let s of i)s==null||s(...o)}});return t}function et(e){var t;return Object.assign(O.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Kt(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function jo(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function Rp(e){return O.version.split(".")[0]>="19"?e.props.ref:e.ref}function Sp(e,t,n){let[r,o]=O.useState(n),i=e!==void 0,s=O.useRef(i),a=O.useRef(!1),l=O.useRef(!1);return i&&!s.current&&!a.current?(a.current=!0,s.current=i,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!i&&s.current&&!l.current&&(l.current=!0,s.current=i,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[i?e:r,ce(c=>(i||o(c),t==null?void 0:t(c)))]}function Cp(e){let[t]=O.useState(e);return t}function bc(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))wc(n,yc(t,r),o);return n}function yc(e,t){return e?e+"["+t+"]":t}function wc(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())wc(e,yc(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):bc(n,t,e)}function Op(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let Ap="span";var Xi=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Xi||{});function kp(e,t){var n;let{features:r=1,...o}=e,i={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Ze()({ourProps:i,theirProps:o,slot:{},defaultTag:Ap,name:"Hidden"})}let xc=et(kp),Tp=O.createContext(null);function Fp({children:e}){let t=O.useContext(Tp);if(!t)return O.createElement(O.Fragment,null,e);let{target:n}=t;return n?Bt.createPortal(O.createElement(O.Fragment,null,e),n):null}function Pp({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[i,s]=O.useState(null),a=yr();return O.useEffect(()=>{if(r&&i)return a.addEventListener(i,"reset",r)},[i,t,r]),O.createElement(Fp,null,O.createElement($p,{setForm:s,formId:t}),bc(e).map(([l,c])=>O.createElement(xc,{features:Xi.Hidden,...Kt({key:l,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:l,value:c,...o})})))}function $p({setForm:e,formId:t}){return O.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:O.createElement(xc,{features:Xi.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Mp=O.createContext(void 0);function Ec(){return O.useContext(Mp)}function Ji(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function po(e){return Ji(e)&&"tagName"in e}function St(e){return po(e)&&"accessKey"in e}function wn(e){return po(e)&&"tabIndex"in e}function Ip(e){return po(e)&&"style"in e}function Dp(e){return St(e)&&e.nodeName==="IFRAME"}function Rc(e){return St(e)&&e.nodeName==="INPUT"}function la(e){return St(e)&&e.nodeName==="LABEL"}function Np(e){return St(e)&&e.nodeName==="FIELDSET"}function Sc(e){return St(e)&&e.nodeName==="LEGEND"}function Lp(e){return po(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function jp(e){let t=e.parentElement,n=null;for(;t&&!Np(t);)Sc(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Bp(n)?!1:r}function Bp(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Sc(t))return!1;t=t.previousElementSibling}return!0}let Cc=Symbol();function Hp(e,t=!0){return Object.assign(e,{[Cc]:t})}function ht(...e){let t=O.useRef(e);O.useEffect(()=>{t.current=e},[e]);let n=ce(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[Cc]))?void 0:n}let Zi=O.createContext(null);Zi.displayName="DescriptionContext";function Oc(){let e=O.useContext(Zi);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Oc),t}return e}function Wp(){var e,t;return(t=(e=O.useContext(Zi))==null?void 0:e.value)!=null?t:void 0}let Up="p";function Vp(e,t){let n=O.useId(),r=Yi(),{id:o=`headlessui-description-${n}`,...i}=e,s=Oc(),a=ht(t);xe(()=>s.register(o),[o,s.register]);let l=r||!1,c=O.useMemo(()=>({...s.slot,disabled:l}),[s.slot,l]),d={ref:a,...s.props,id:o};return Ze()({ourProps:d,theirProps:i,slot:c,defaultTag:Up,name:s.name||"Description"})}let qp=et(Vp);Object.assign(qp,{});var ye=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(ye||{});let mo=O.createContext(null);mo.displayName="LabelContext";function Ac(){let e=O.useContext(mo);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Ac),t}return e}function kc(e){var t,n,r;let o=(n=(t=O.useContext(mo))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function zp({inherit:e=!1}={}){let t=kc(),[n,r]=O.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,O.useMemo(()=>function(i){let s=ce(l=>(r(c=>[...c,l]),()=>r(c=>{let d=c.slice(),h=d.indexOf(l);return h!==-1&&d.splice(h,1),d}))),a=O.useMemo(()=>({register:s,slot:i.slot,name:i.name,props:i.props,value:i.value}),[s,i.slot,i.name,i.props,i.value]);return O.createElement(mo.Provider,{value:a},i.children)},[r])]}let Gp="label";function _p(e,t){var n;let r=O.useId(),o=Ac(),i=Ec(),s=Yi(),{id:a=`headlessui-label-${r}`,htmlFor:l=i??((n=o.props)==null?void 0:n.htmlFor),passive:c=!1,...d}=e,h=ht(t);xe(()=>o.register(a),[a,o.register]);let m=ce(R=>{let $=R.currentTarget;if(!(R.target!==R.currentTarget&&Lp(R.target))&&(la($)&&R.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(R),la($))){let w=document.getElementById($.htmlFor);if(w){let T=w.getAttribute("disabled");if(T==="true"||T==="")return;let N=w.getAttribute("aria-disabled");if(N==="true"||N==="")return;(Rc(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),f=s||!1,x=O.useMemo(()=>({...o.slot,disabled:f}),[o.slot,f]),b={ref:h,...o.props,id:a,htmlFor:l,onClick:m};return c&&("onClick"in b&&(delete b.htmlFor,delete b.onClick),"onClick"in d&&delete d.onClick),Ze()({ourProps:b,theirProps:d,slot:x,defaultTag:l?Gp:"div",name:o.name||"Label"})}let Qp=et(_p),Tc=Object.assign(Qp,{});function Kp(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function Yp(e=Kp){return O.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function Xp(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Jp(e,t=!1){let[n,r]=O.useReducer(()=>({}),{}),o=O.useMemo(()=>Xp(e),[e,n]);return xe(()=>{if(!e)return;let i=new ResizeObserver(r);return i.observe(e),()=>{i.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let Fc=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var Zp=Object.defineProperty,em=(e,t,n)=>t in e?Zp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tm=(e,t,n)=>(em(e,t+"",n),n),Pc=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Be=(e,t,n)=>(Pc(e,t,"read from private field"),n?n.call(e):t.get(e)),Bo=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},ca=(e,t,n,r)=>(Pc(e,t,"write to private field"),t.set(e,n),n),nt,Jn,Zn;let $c=class{constructor(t){Bo(this,nt,{}),Bo(this,Jn,new Fc(()=>new Set)),Bo(this,Zn,new Set),tm(this,"disposables",Je()),ca(this,nt,t)}dispose(){this.disposables.dispose()}get state(){return Be(this,nt)}subscribe(t,n){let r={selector:t,callback:n,current:t(Be(this,nt))};return Be(this,Zn).add(r),this.disposables.add(()=>{Be(this,Zn).delete(r)})}on(t,n){return Be(this,Jn).get(t).add(n),this.disposables.add(()=>{Be(this,Jn).get(t).delete(n)})}send(t){let n=this.reduce(Be(this,nt),t);if(n!==Be(this,nt)){ca(this,nt,n);for(let r of Be(this,Zn)){let o=r.selector(Be(this,nt));Mc(r.current,o)||(r.current=o,r.callback(o))}for(let r of Be(this,Jn).get(t.type))r(Be(this,nt),t)}}};nt=new WeakMap,Jn=new WeakMap,Zn=new WeakMap;function Mc(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:Ho(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Ho(e.entries(),t.entries()):ua(e)&&ua(t)?Ho(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Ho(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function ua(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Wo(e){let[t,n]=e(),r=Je();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var nm=Object.defineProperty,rm=(e,t,n)=>t in e?nm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fa=(e,t,n)=>(rm(e,typeof t!="symbol"?t+"":t,n),n),Ic=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(Ic||{});let om={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let i=e.stack.slice();return i.splice(o,1),i.push(n),r=i,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},im=class Dc extends $c{constructor(){super(...arguments),fa(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),fa(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Dc({stack:[]})}reduce(t,n){return ut(n.type,om,t,n)}};const es=new Fc(()=>im.new());var Ir={exports:{}},Uo={};/**
@@ -85,5 +85,5 @@
85
85
  * This source code is licensed under the MIT license found in the
86
86
  * LICENSE file in the root directory of this source tree.
87
87
  */var ha;function am(){return ha||(ha=1,process.env.NODE_ENV!=="production"&&function(){function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=O,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,i=t.useEffect,s=t.useMemo,a=t.useDebugValue;Vo.useSyncExternalStoreWithSelector=function(l,c,d,h,m){var f=o(null);if(f.current===null){var x={hasValue:!1,value:null};f.current=x}else x=f.current;f=s(function(){function R(D){if(!$){if($=!0,w=D,D=h(D),m!==void 0&&x.hasValue){var j=x.value;if(m(j,D))return T=j}return T=D}if(j=T,n(w,D))return j;var W=h(D);return m!==void 0&&m(j,W)?(w=D,j):(w=D,T=W)}var $=!1,w,T,N=d===void 0?null:d;return[function(){return R(c())},N===null?void 0:function(){return R(N())}]},[c,d,h,m]);var b=r(l,f[0],f[1]);return i(function(){x.hasValue=!0,x.value=b},[b]),a(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Vo}var pa;function lm(){return pa||(pa=1,process.env.NODE_ENV==="production"?Ir.exports=sm():Ir.exports=am()),Ir.exports}var cm=lm();function qe(e,t,n=Mc){return cm.useSyncExternalStoreWithSelector(ce(r=>e.subscribe(um,r)),ce(()=>e.state),ce(()=>e.state),ce(t),n)}function um(e){return e}function Nc(e,t){let n=O.useId(),r=es.get(t),[o,i]=qe(r,O.useCallback(s=>[r.selectors.isTop(s,n),r.selectors.inStack(s,n)],[r,n]));return xe(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?i?o:!0:!1}let Oi=new Map,nr=new Map;function ma(e){var t;let n=(t=nr.get(e))!=null?t:0;return nr.set(e,n+1),n!==0?()=>ga(e):(Oi.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>ga(e))}function ga(e){var t;let n=(t=nr.get(e))!=null?t:1;if(n===1?nr.delete(e):nr.set(e,n-1),n!==1)return;let r=Oi.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Oi.delete(e))}function fm(e,{allowed:t,disallowed:n}={}){let r=Nc(e,"inert-others");xe(()=>{var o,i;if(!r)return;let s=Je();for(let l of(o=n==null?void 0:n())!=null?o:[])l&&s.add(ma(l));let a=(i=t==null?void 0:t())!=null?i:[];for(let l of a){if(!l)continue;let c=br(l);if(!c)continue;let d=l.parentElement;for(;d&&d!==c.body;){for(let h of d.children)a.some(m=>h.contains(m))||s.add(ma(h));d=d.parentElement}}return s.dispose},[r,t,n])}function dm(e,t,n){let r=zn(o=>{let i=o.getBoundingClientRect();i.x===0&&i.y===0&&i.width===0&&i.height===0&&n()});O.useEffect(()=>{if(!e)return;let o=t===null?null:St(t)?t:t.current;if(!o)return;let i=Je();if(typeof ResizeObserver<"u"){let s=new ResizeObserver(()=>r.current(o));s.observe(o),i.add(()=>s.disconnect())}if(typeof IntersectionObserver<"u"){let s=new IntersectionObserver(()=>r.current(o));s.observe(o),i.add(()=>s.disconnect())}return()=>i.dispose()},[t,r,e])}let Ai=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),hm=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var ki=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(ki||{}),pm=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(pm||{}),mm=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(mm||{});function Lc(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ai)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function gm(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(hm)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var ts=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(ts||{});function jc(e,t=0){var n;return e===((n=br(e))==null?void 0:n.body)?!1:ut(t,{0(){return e.matches(Ai)},1(){let r=e;for(;r!==null;){if(r.matches(Ai))return!0;r=r.parentElement}return!1}})}var vm=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(vm||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let bm=["textarea","input"].join(",");function ym(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,bm))!=null?n:!1}function Bc(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),i=t(r);if(o===null||i===null)return 0;let s=o.compareDocumentPosition(i);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function wm(e,t){return xm(Lc(),t,{relativeTo:e})}function xm(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let i=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,s=Array.isArray(e)?n?Bc(e):e:t&64?gm(e):Lc(e);o.length>0&&s.length>1&&(s=s.filter(f=>!o.some(x=>x!=null&&"current"in x?(x==null?void 0:x.current)===f:x===f))),r=r??i.activeElement;let a=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,s.indexOf(r))-1;if(t&4)return Math.max(0,s.indexOf(r))+1;if(t&8)return s.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),c=t&32?{preventScroll:!0}:{},d=0,h=s.length,m;do{if(d>=h||d+h<=0)return 0;let f=l+d;if(t&16)f=(f+h)%h;else{if(f<0)return 3;if(f>=h)return 1}m=s[f],m==null||m.focus(c),d+=a}while(m!==i.activeElement);return t&6&&ym(m)&&m.select(),2}function Hc(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Em(){return/Android/gi.test(window.navigator.userAgent)}function va(){return Hc()||Em()}function xn(e,t,n,r){let o=zn(n);O.useEffect(()=>{if(!e)return;function i(s){o.current(s)}return document.addEventListener(t,i,r),()=>document.removeEventListener(t,i,r)},[e,t,r])}function Rm(e,t,n,r){let o=zn(n);O.useEffect(()=>{if(!e)return;function i(s){o.current(s)}return window.addEventListener(t,i,r),()=>window.removeEventListener(t,i,r)},[e,t,r])}const ba=30;function Sm(e,t,n){let r=zn(n),o=O.useCallback(function(a,l){if(a.defaultPrevented)return;let c=l(a);if(c===null||!c.getRootNode().contains(c)||!c.isConnected)return;let d=function h(m){return typeof m=="function"?h(m()):Array.isArray(m)||m instanceof Set?m:[m]}(t);for(let h of d)if(h!==null&&(h.contains(c)||a.composed&&a.composedPath().includes(h)))return;return!jc(c,ts.Loose)&&c.tabIndex!==-1&&a.preventDefault(),r.current(a,c)},[r,t]),i=O.useRef(null);xn(e,"pointerdown",a=>{var l,c;va()||(i.current=((c=(l=a.composedPath)==null?void 0:l.call(a))==null?void 0:c[0])||a.target)},!0),xn(e,"pointerup",a=>{if(va()||!i.current)return;let l=i.current;return i.current=null,o(a,()=>l)},!0);let s=O.useRef({x:0,y:0});xn(e,"touchstart",a=>{s.current.x=a.touches[0].clientX,s.current.y=a.touches[0].clientY},!0),xn(e,"touchend",a=>{let l={x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY};if(!(Math.abs(l.x-s.current.x)>=ba||Math.abs(l.y-s.current.y)>=ba))return o(a,()=>wn(a.target)?a.target:null)},!0),Rm(e,"blur",a=>o(a,()=>Dp(window.document.activeElement)?window.document.activeElement:null),!0)}function Ti(...e){return O.useMemo(()=>br(...e),[...e])}var Cm=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(Cm||{});const Dr={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},Om=200;function Am(e,{trigger:t,action:n,close:r,select:o}){let i=O.useRef(null);xn(e&&t!==null,"pointerdown",s=>{Ji(s==null?void 0:s.target)&&t!=null&&t.contains(s.target)&&(i.current=new Date)}),xn(e&&t!==null,"pointerup",s=>{if(i.current===null||!wn(s.target))return;let a=n(s),l=new Date().getTime()-i.current.getTime();switch(i.current=null,a.kind){case 0:return;case 1:{l>Om&&(o(a.target),r());break}case 2:{r();break}}},{capture:!0})}function km(e,t){return O.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function Tm(e){return O.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Fm(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...i){let s=t[o].call(n,...i);s&&(n=s,r.forEach(a=>a()))}}}function Pm(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),i=Math.max(0,e-o);n.style(r,"paddingRight",`${i}px`)}}}function $m(){return Hc()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(i=>i()).some(i=>i.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let a=Je();a.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>a.dispose()))}let i=(o=window.scrollY)!=null?o:window.pageYOffset,s=null;t.addEventListener(e,"click",a=>{if(wn(a.target))try{let l=a.target.closest("a");if(!l)return;let{hash:c}=new URL(l.href),d=e.querySelector(c);wn(d)&&!r(d)&&(s=d)}catch{}},!0),t.addEventListener(e,"touchstart",a=>{if(wn(a.target)&&Ip(a.target))if(r(a.target)){let l=a.target;for(;l.parentElement&&r(l.parentElement);)l=l.parentElement;t.style(l,"overscrollBehavior","contain")}else t.style(a.target,"touchAction","none")}),t.addEventListener(e,"touchmove",a=>{if(wn(a.target)){if(Rc(a.target))return;if(r(a.target)){let l=a.target;for(;l.parentElement&&l.dataset.headlessuiPortal!==""&&!(l.scrollHeight>l.clientHeight||l.scrollWidth>l.clientWidth);)l=l.parentElement;l.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),t.add(()=>{var a;let l=(a=window.scrollY)!=null?a:window.pageYOffset;i!==l&&window.scrollTo(0,i),s&&s.isConnected&&(s.scrollIntoView({block:"nearest"}),s=null)})})}}:{}}function Mm(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Im(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Xt=Fm(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Je(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:Im(n)},o=[$m(),Pm(),Mm()];o.forEach(({before:i})=>i==null?void 0:i(r)),o.forEach(({after:i})=>i==null?void 0:i(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Xt.subscribe(()=>{let e=Xt.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&Xt.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Xt.dispatch("TEARDOWN",n)}});function Dm(e,t,n=()=>({containers:[]})){let r=Tm(Xt),o=t?r.get(t):void 0,i=o?o.count>0:!1;return xe(()=>{if(!(!t||!e))return Xt.dispatch("PUSH",t,n),()=>Xt.dispatch("POP",t,n)},[e,t]),i}function Nm(e,t,n=()=>[document.body]){let r=Nc(e,"scroll-lock");Dm(r,t,o=>{var i;return{containers:[...(i=o.containers)!=null?i:[],n]}})}function ya(e){return[e.screenX,e.screenY]}function Lm(){let e=O.useRef([-1,-1]);return{wasMoved(t){let n=ya(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=ya(t)}}}function jm(e=0){let[t,n]=O.useState(e),r=O.useCallback(l=>n(l),[t]),o=O.useCallback(l=>n(c=>c|l),[t]),i=O.useCallback(l=>(t&l)===l,[t]),s=O.useCallback(l=>n(c=>c&~l),[n]),a=O.useCallback(l=>n(c=>c^l),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:i,removeFlag:s,toggleFlag:a}}var wa,xa;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((wa=process==null?void 0:process.env)==null?void 0:wa.NODE_ENV)==="test"&&typeof((xa=Element==null?void 0:Element.prototype)==null?void 0:xa.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
88
- `)),[]});var Bm=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Bm||{});function Hm(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Wm(e,t,n,r){let[o,i]=O.useState(n),{hasFlag:s,addFlag:a,removeFlag:l}=jm(e&&o?3:0),c=O.useRef(!1),d=O.useRef(!1),h=yr();return xe(()=>{var m;if(e){if(n&&i(!0),!t){n&&a(3);return}return(m=void 0)==null||m.call(r,n),Um(t,{inFlight:c,prepare(){d.current?d.current=!1:d.current=c.current,c.current=!0,!d.current&&(n?(a(3),l(4)):(a(4),l(2)))},run(){d.current?n?(l(3),a(4)):(l(4),a(3)):n?l(1):a(1)},done(){var f;d.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,l(7),n||i(!1),(f=void 0)==null||f.call(r,n))}})}},[e,n,t,h]),e?[o,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Um(e,{prepare:t,run:n,done:r,inFlight:o}){let i=Je();return qm(e,{prepare:t,inFlight:o}),i.nextFrame(()=>{n(),i.requestAnimationFrame(()=>{i.add(Vm(e,r))})}),i.dispose}function Vm(e,t){var n,r;let o=Je();if(!e)return o.dispose;let i=!1;o.add(()=>{i=!0});let s=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return s.length===0?(t(),o.dispose):(Promise.allSettled(s.map(a=>a.finished)).then(()=>{i||t()}),o.dispose)}function qm(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.style.transition=r}function go(){return typeof window<"u"}function Gn(e){return Wc(e)?(e.nodeName||"").toLowerCase():"#document"}function Le(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pt(e){var t;return(t=(Wc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Wc(e){return go()?e instanceof Node||e instanceof Le(e).Node:!1}function Ae(e){return go()?e instanceof Element||e instanceof Le(e).Element:!1}function ft(e){return go()?e instanceof HTMLElement||e instanceof Le(e).HTMLElement:!1}function Ea(e){return!go()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Le(e).ShadowRoot}function wr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Xe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function zm(e){return["table","td","th"].includes(Gn(e))}function vo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function ns(e){const t=rs(),n=Ae(e)?Xe(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Gm(e){let t=Ut(e);for(;ft(t)&&!Un(t);){if(ns(t))return t;if(vo(t))return null;t=Ut(t)}return null}function rs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Un(e){return["html","body","#document"].includes(Gn(e))}function Xe(e){return Le(e).getComputedStyle(e)}function bo(e){return Ae(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ut(e){if(Gn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ea(e)&&e.host||pt(e);return Ea(t)?t.host:t}function Uc(e){const t=Ut(e);return Un(t)?e.ownerDocument?e.ownerDocument.body:e.body:ft(t)&&wr(t)?t:Uc(t)}function sr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Uc(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Le(o);if(i){const a=Fi(s);return t.concat(s,s.visualViewport||[],wr(o)?o:[],a&&n?sr(a):[])}return t.concat(o,sr(o,[],n))}function Fi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _m(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const pn=Math.min,Oe=Math.max,ar=Math.round,Nr=Math.floor,ct=e=>({x:e,y:e}),Qm={left:"right",right:"left",bottom:"top",top:"bottom"},Km={start:"end",end:"start"};function Ra(e,t,n){return Oe(e,pn(t,n))}function _n(e,t){return typeof e=="function"?e(t):e}function Vt(e){return e.split("-")[0]}function xr(e){return e.split("-")[1]}function Vc(e){return e==="x"?"y":"x"}function qc(e){return e==="y"?"height":"width"}function mn(e){return["top","bottom"].includes(Vt(e))?"y":"x"}function zc(e){return Vc(mn(e))}function Ym(e,t,n){n===void 0&&(n=!1);const r=xr(e),o=zc(e),i=qc(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Zr(s)),[s,Zr(s)]}function Xm(e){const t=Zr(e);return[Pi(e),t,Pi(t)]}function Pi(e){return e.replace(/start|end/g,t=>Km[t])}function Jm(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function Zm(e,t,n,r){const o=xr(e);let i=Jm(Vt(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Pi)))),i}function Zr(e){return e.replace(/left|right|bottom|top/g,t=>Qm[t])}function eg(e){return{top:0,right:0,bottom:0,left:0,...e}}function tg(e){return typeof e!="number"?eg(e):{top:e,right:e,bottom:e,left:e}}function eo(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Sa(e,t,n){let{reference:r,floating:o}=e;const i=mn(t),s=zc(t),a=qc(s),l=Vt(t),c=i==="y",d=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let f;switch(l){case"top":f={x:d,y:r.y-o.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:h};break;case"left":f={x:r.x-o.width,y:h};break;default:f={x:r.x,y:r.y}}switch(xr(t)){case"start":f[s]-=m*(n&&c?-1:1);break;case"end":f[s]+=m*(n&&c?-1:1);break}return f}const ng=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:h}=Sa(c,r,l),m=r,f={},x=0;for(let b=0;b<a.length;b++){const{name:R,fn:$}=a[b],{x:w,y:T,data:N,reset:D}=await $({x:d,y:h,initialPlacement:r,placement:m,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});d=w??d,h=T??h,f={...f,[R]:{...f[R],...N}},D&&x<=50&&(x++,typeof D=="object"&&(D.placement&&(m=D.placement),D.rects&&(c=D.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):D.rects),{x:d,y:h}=Sa(c,m,l)),b=-1)}return{x:d,y:h,placement:m,strategy:o,middlewareData:f}};async function yo(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:f=0}=_n(t,e),x=tg(f),R=a[m?h==="floating"?"reference":"floating":h],$=eo(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(R)))==null||n?R:R.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),w=h==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),N=await(i.isElement==null?void 0:i.isElement(T))?await(i.getScale==null?void 0:i.getScale(T))||{x:1,y:1}:{x:1,y:1},D=eo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:T,strategy:l}):w);return{top:($.top-D.top+x.top)/N.y,bottom:(D.bottom-$.bottom+x.bottom)/N.y,left:($.left-D.left+x.left)/N.x,right:(D.right-$.right+x.right)/N.x}}const rg=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:b=!0,...R}=_n(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const $=Vt(o),w=mn(a),T=Vt(a)===a,N=await(l.isRTL==null?void 0:l.isRTL(c.floating)),D=m||(T||!b?[Zr(a)]:Xm(a)),j=x!=="none";!m&&j&&D.push(...Zm(a,b,x,N));const W=[a,...D],u=await yo(t,R),p=[];let g=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&p.push(u[$]),h){const k=Ym(o,s,N);p.push(u[k[0]],u[k[1]])}if(g=[...g,{placement:o,overflows:p}],!p.every(k=>k<=0)){var C,S;const k=(((C=i.flip)==null?void 0:C.index)||0)+1,v=W[k];if(v)return{data:{index:k,overflows:g},reset:{placement:v}};let E=(S=g.filter(F=>F.overflows[0]<=0).sort((F,y)=>F.overflows[1]-y.overflows[1])[0])==null?void 0:S.placement;if(!E)switch(f){case"bestFit":{var A;const F=(A=g.filter(y=>{if(j){const M=mn(y.placement);return M===w||M==="y"}return!0}).map(y=>[y.placement,y.overflows.filter(M=>M>0).reduce((M,B)=>M+B,0)]).sort((y,M)=>y[1]-M[1])[0])==null?void 0:A[0];F&&(E=F);break}case"initialPlacement":E=a;break}if(o!==E)return{reset:{placement:E}}}return{}}}};async function og(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Vt(n),a=xr(n),l=mn(n)==="y",c=["left","top"].includes(s)?-1:1,d=i&&l?-1:1,h=_n(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:x}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof x=="number"&&(f=a==="end"?x*-1:x),l?{x:f*d,y:m*c}:{x:m*c,y:f*d}}const ig=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await og(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},sg=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:R=>{let{x:$,y:w}=R;return{x:$,y:w}}},...l}=_n(e,t),c={x:n,y:r},d=await yo(t,l),h=mn(Vt(o)),m=Vc(h);let f=c[m],x=c[h];if(i){const R=m==="y"?"top":"left",$=m==="y"?"bottom":"right",w=f+d[R],T=f-d[$];f=Ra(w,f,T)}if(s){const R=h==="y"?"top":"left",$=h==="y"?"bottom":"right",w=x+d[R],T=x-d[$];x=Ra(w,x,T)}const b=a.fn({...t,[m]:f,[h]:x});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[m]:i,[h]:s}}}}}},ag=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=_n(e,t),d=await yo(t,c),h=Vt(o),m=xr(o),f=mn(o)==="y",{width:x,height:b}=i.floating;let R,$;h==="top"||h==="bottom"?(R=h,$=m===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):($=h,R=m==="end"?"top":"bottom");const w=b-d.top-d.bottom,T=x-d.left-d.right,N=pn(b-d[R],w),D=pn(x-d[$],T),j=!t.middlewareData.shift;let W=N,u=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(u=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(W=w),j&&!m){const g=Oe(d.left,0),C=Oe(d.right,0),S=Oe(d.top,0),A=Oe(d.bottom,0);f?u=x-2*(g!==0||C!==0?g+C:Oe(d.left,d.right)):W=b-2*(S!==0||A!==0?S+A:Oe(d.top,d.bottom))}await l({...t,availableWidth:u,availableHeight:W});const p=await s.getDimensions(a.floating);return x!==p.width||b!==p.height?{reset:{rects:!0}}:{}}}};function Gc(e){const t=Xe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ft(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=ar(n)!==i||ar(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function os(e){return Ae(e)?e:e.contextElement}function On(e){const t=os(e);if(!ft(t))return ct(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Gc(t);let s=(i?ar(n.width):n.width)/r,a=(i?ar(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const lg=ct(0);function _c(e){const t=Le(e);return!rs()||!t.visualViewport?lg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cg(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Le(e)?!1:t}function gn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=os(e);let s=ct(1);t&&(r?Ae(r)&&(s=On(r)):s=On(e));const a=cg(i,n,r)?_c(i):ct(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,d=o.width/s.x,h=o.height/s.y;if(i){const m=Le(i),f=r&&Ae(r)?Le(r):r;let x=m,b=Fi(x);for(;b&&r&&f!==x;){const R=On(b),$=b.getBoundingClientRect(),w=Xe(b),T=$.left+(b.clientLeft+parseFloat(w.paddingLeft))*R.x,N=$.top+(b.clientTop+parseFloat(w.paddingTop))*R.y;l*=R.x,c*=R.y,d*=R.x,h*=R.y,l+=T,c+=N,x=Le(b),b=Fi(x)}}return eo({width:d,height:h,x:l,y:c})}function is(e,t){const n=bo(e).scrollLeft;return t?t.left+n:gn(pt(e)).left+n}function Qc(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:is(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function ug(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=pt(r),a=t?vo(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=ct(1);const d=ct(0),h=ft(r);if((h||!h&&!i)&&((Gn(r)!=="body"||wr(s))&&(l=bo(r)),ft(r))){const f=gn(r);c=On(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const m=s&&!h&&!i?Qc(s,l,!0):ct(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+m.x,y:n.y*c.y-l.scrollTop*c.y+d.y+m.y}}function fg(e){return Array.from(e.getClientRects())}function dg(e){const t=pt(e),n=bo(e),r=e.ownerDocument.body,o=Oe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Oe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+is(e);const a=-n.scrollTop;return Xe(r).direction==="rtl"&&(s+=Oe(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function hg(e,t){const n=Le(e),r=pt(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=rs();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function pg(e,t){const n=gn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=ft(e)?On(e):ct(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function Ca(e,t,n){let r;if(t==="viewport")r=hg(e,n);else if(t==="document")r=dg(pt(e));else if(Ae(t))r=pg(t,n);else{const o=_c(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return eo(r)}function Kc(e,t){const n=Ut(e);return n===t||!Ae(n)||Un(n)?!1:Xe(n).position==="fixed"||Kc(n,t)}function mg(e,t){const n=t.get(e);if(n)return n;let r=sr(e,[],!1).filter(a=>Ae(a)&&Gn(a)!=="body"),o=null;const i=Xe(e).position==="fixed";let s=i?Ut(e):e;for(;Ae(s)&&!Un(s);){const a=Xe(s),l=ns(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||wr(s)&&!l&&Kc(e,s))?r=r.filter(d=>d!==s):o=a,s=Ut(s)}return t.set(e,r),r}function gg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?vo(t)?[]:mg(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,d)=>{const h=Ca(t,d,o);return c.top=Oe(h.top,c.top),c.right=pn(h.right,c.right),c.bottom=pn(h.bottom,c.bottom),c.left=Oe(h.left,c.left),c},Ca(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function vg(e){const{width:t,height:n}=Gc(e);return{width:t,height:n}}function bg(e,t,n){const r=ft(t),o=pt(t),i=n==="fixed",s=gn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ct(0);if(r||!r&&!i)if((Gn(t)!=="body"||wr(o))&&(a=bo(t)),r){const m=gn(t,!0,i,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else o&&(l.x=is(o));const c=o&&!r&&!i?Qc(o,a):ct(0),d=s.left+a.scrollLeft-l.x-c.x,h=s.top+a.scrollTop-l.y-c.y;return{x:d,y:h,width:s.width,height:s.height}}function qo(e){return Xe(e).position==="static"}function Oa(e,t){if(!ft(e)||Xe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return pt(e)===n&&(n=n.ownerDocument.body),n}function Yc(e,t){const n=Le(e);if(vo(e))return n;if(!ft(e)){let o=Ut(e);for(;o&&!Un(o);){if(Ae(o)&&!qo(o))return o;o=Ut(o)}return n}let r=Oa(e,t);for(;r&&zm(r)&&qo(r);)r=Oa(r,t);return r&&Un(r)&&qo(r)&&!ns(r)?n:r||Gm(e)||n}const yg=async function(e){const t=this.getOffsetParent||Yc,n=this.getDimensions,r=await n(e.floating);return{reference:bg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wg(e){return Xe(e).direction==="rtl"}const xg={convertOffsetParentRelativeRectToViewportRelativeRect:ug,getDocumentElement:pt,getClippingRect:gg,getOffsetParent:Yc,getElementRects:yg,getClientRects:fg,getDimensions:vg,getScale:On,isElement:Ae,isRTL:wg};function Xc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Eg(e,t){let n=null,r;const o=pt(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=e.getBoundingClientRect(),{left:d,top:h,width:m,height:f}=c;if(a||t(),!m||!f)return;const x=Nr(h),b=Nr(o.clientWidth-(d+m)),R=Nr(o.clientHeight-(h+f)),$=Nr(d),T={rootMargin:-x+"px "+-b+"px "+-R+"px "+-$+"px",threshold:Oe(0,pn(1,l))||1};let N=!0;function D(j){const W=j[0].intersectionRatio;if(W!==l){if(!N)return s();W?s(!1,W):r=setTimeout(()=>{s(!1,1e-7)},1e3)}W===1&&!Xc(c,e.getBoundingClientRect())&&s(),N=!1}try{n=new IntersectionObserver(D,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,T)}n.observe(e)}return s(!0),i}function Rg(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=os(e),d=o||i?[...c?sr(c):[],...sr(t)]:[];d.forEach($=>{o&&$.addEventListener("scroll",n,{passive:!0}),i&&$.addEventListener("resize",n)});const h=c&&a?Eg(c,n):null;let m=-1,f=null;s&&(f=new ResizeObserver($=>{let[w]=$;w&&w.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var T;(T=f)==null||T.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let x,b=l?gn(e):null;l&&R();function R(){const $=gn(e);b&&!Xc(b,$)&&n(),b=$,x=requestAnimationFrame(R)}return n(),()=>{var $;d.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),h==null||h(),($=f)==null||$.disconnect(),f=null,l&&cancelAnimationFrame(x)}}const zo=yo,Sg=ig,Cg=sg,Og=rg,Ag=ag,kg=(e,t,n)=>{const r=new Map,o={platform:xg,...n},i={...o.platform,_c:r};return ng(e,t,{...o,platform:i})};var Br=typeof document<"u"?O.useLayoutEffect:O.useEffect;function to(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!to(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!to(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Jc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Aa(e,t){const n=Jc(e);return Math.round(t*n)/n}function Go(e){const t=I.useRef(e);return Br(()=>{t.current=e}),t}function Tg(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[d,h]=I.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=I.useState(r);to(m,r)||f(r);const[x,b]=I.useState(null),[R,$]=I.useState(null),w=I.useCallback(y=>{y!==j.current&&(j.current=y,b(y))},[]),T=I.useCallback(y=>{y!==W.current&&(W.current=y,$(y))},[]),N=i||x,D=s||R,j=I.useRef(null),W=I.useRef(null),u=I.useRef(d),p=l!=null,g=Go(l),C=Go(o),S=Go(c),A=I.useCallback(()=>{if(!j.current||!W.current)return;const y={placement:t,strategy:n,middleware:m};C.current&&(y.platform=C.current),kg(j.current,W.current,y).then(M=>{const B={...M,isPositioned:S.current!==!1};k.current&&!to(u.current,B)&&(u.current=B,Bn.flushSync(()=>{h(B)}))})},[m,t,n,C,S]);Br(()=>{c===!1&&u.current.isPositioned&&(u.current.isPositioned=!1,h(y=>({...y,isPositioned:!1})))},[c]);const k=I.useRef(!1);Br(()=>(k.current=!0,()=>{k.current=!1}),[]),Br(()=>{if(N&&(j.current=N),D&&(W.current=D),N&&D){if(g.current)return g.current(N,D,A);A()}},[N,D,A,g,p]);const v=I.useMemo(()=>({reference:j,floating:W,setReference:w,setFloating:T}),[w,T]),E=I.useMemo(()=>({reference:N,floating:D}),[N,D]),F=I.useMemo(()=>{const y={position:n,left:0,top:0};if(!E.floating)return y;const M=Aa(E.floating,d.x),B=Aa(E.floating,d.y);return a?{...y,transform:"translate("+M+"px, "+B+"px)",...Jc(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:B}},[n,a,E.floating,d.x,d.y]);return I.useMemo(()=>({...d,update:A,refs:v,elements:E,floatingStyles:F}),[d,A,v,E,F])}const Zc=(e,t)=>({...Sg(e),options:[e,t]}),Fg=(e,t)=>({...Cg(e),options:[e,t]}),Pg=(e,t)=>({...Og(e),options:[e,t]}),$g=(e,t)=>({...Ag(e),options:[e,t]}),eu={...I},Mg=eu.useInsertionEffect,Ig=Mg||(e=>e());function tu(e){const t=I.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Ig(()=>{t.current=e}),I.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var $i=typeof document<"u"?O.useLayoutEffect:O.useEffect;let ka=!1,Dg=0;const Ta=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Dg++;function Ng(){const[e,t]=I.useState(()=>ka?Ta():void 0);return $i(()=>{e==null&&t(Ta())},[]),I.useEffect(()=>{ka=!0},[]),e}const Lg=eu.useId,jg=Lg||Ng;let lr;process.env.NODE_ENV!=="production"&&(lr=new Set);function Bg(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=lr)!=null&&e.has(o))){var i;(i=lr)==null||i.add(o),console.warn(o)}}function Hg(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=lr)!=null&&e.has(o))){var i;(i=lr)==null||i.add(o),console.error(o)}}function Wg(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const Ug=I.createContext(null),Vg=I.createContext(null),qg=()=>{var e;return((e=I.useContext(Ug))==null?void 0:e.id)||null},zg=()=>I.useContext(Vg),Gg="data-floating-ui-focusable";function _g(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=jg(),i=I.useRef({}),[s]=I.useState(()=>Wg()),a=qg()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!Ae(f)&&Hg("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[l,c]=I.useState(r.reference),d=tu((f,x,b)=>{i.current.openEvent=f?x:void 0,s.emit("openchange",{open:f,event:x,reason:b,nested:a}),n==null||n(f,x,b)}),h=I.useMemo(()=>({setPositionReference:c}),[]),m=I.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return I.useMemo(()=>({dataRef:i,open:t,onOpenChange:d,elements:m,events:s,floatingId:o,refs:h}),[t,d,m,s,o,h])}function Qg(e){e===void 0&&(e={});const{nodeId:t}=e,n=_g({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,s]=I.useState(null),[a,l]=I.useState(null),d=(o==null?void 0:o.domReference)||i,h=I.useRef(null),m=zg();$i(()=>{d&&(h.current=d)},[d]);const f=Tg({...e,elements:{...o,...a&&{reference:a}}}),x=I.useCallback(T=>{const N=Ae(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;l(N),f.refs.setReference(N)},[f.refs]),b=I.useCallback(T=>{(Ae(T)||T===null)&&(h.current=T,s(T)),(Ae(f.refs.reference.current)||f.refs.reference.current===null||T!==null&&!Ae(T))&&f.refs.setReference(T)},[f.refs]),R=I.useMemo(()=>({...f.refs,setReference:b,setPositionReference:x,domReference:h}),[f.refs,b,x]),$=I.useMemo(()=>({...f.elements,domReference:d}),[f.elements,d]),w=I.useMemo(()=>({...f,...r,refs:R,elements:$,nodeId:t}),[f,R,$,t,r]);return $i(()=>{r.dataRef.current.floatingContext=w;const T=m==null?void 0:m.nodesRef.current.find(N=>N.id===t);T&&(T.context=w)}),I.useMemo(()=>({...f,context:w,refs:R,elements:$}),[f,R,$,w])}const Fa="active",Pa="selected";function _o(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[Fa]:s,[Pa]:a,...l}=e;i=l}return{...n==="floating"&&{tabIndex:-1,[Gg]:""},...i,...t.map(s=>{const a=s?s[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(o&&[Fa,Pa].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof d=="function"){var h;(h=r.get(c))==null||h.push(d),s[c]=function(){for(var m,f=arguments.length,x=new Array(f),b=0;b<f;b++)x[b]=arguments[b];return(m=r.get(c))==null?void 0:m.map(R=>R(...x)).find(R=>R!==void 0)}}}else s[c]=d}),s),{})}}function Kg(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),o=I.useCallback(a=>_o(a,e,"reference"),t),i=I.useCallback(a=>_o(a,e,"floating"),n),s=I.useCallback(a=>_o(a,e,"item"),r);return I.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}function $a(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Yg=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:i=0,index:s=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...d}=_n(e,t),{rects:h,elements:{floating:m}}=t,f=n.current[s],x=(c==null?void 0:c.current)||m,b=m.clientTop||x.clientTop,R=m.clientTop!==0,$=x.clientTop!==0,w=m===x;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Bg('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const T={...t,...await Zc(-f.offsetTop-m.clientTop-h.reference.height/2-f.offsetHeight/2-i).fn(t)},N=await zo($a(T,x.scrollHeight+b+m.clientTop),d),D=await zo(T,{...d,elementContext:"reference"}),j=Oe(0,N.top),W=T.y+j,g=(x.scrollHeight>x.clientHeight?C=>C:ar)(Oe(0,x.scrollHeight+(R&&w||$?b*2:0)-j-Oe(0,N.bottom)));if(x.style.maxHeight=g+"px",x.scrollTop=j,o){const C=x.offsetHeight<f.offsetHeight*pn(a,n.current.length)-1||D.top>=-l||D.bottom>=-l;Bn.flushSync(()=>o(C))}return r&&(r.current=await zo($a({...T,y:W},x.offsetHeight+b+m.clientTop),d)),{y:W}}});function Xg(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:s,onChange:a}=t,l=tu(a),c=I.useRef(!1),d=I.useRef(null),h=I.useRef(null);I.useEffect(()=>{if(!o)return;function f(b){if(b.ctrlKey||!x||i.current==null)return;const R=b.deltaY,$=i.current.top>=-.5,w=i.current.bottom>=-.5,T=x.scrollHeight-x.clientHeight,N=R<0?-1:1,D=R<0?"max":"min";x.scrollHeight<=x.clientHeight||(!$&&R>0||!w&&R<0?(b.preventDefault(),Bn.flushSync(()=>{l(j=>j+Math[D](R,T*N))})):/firefox/i.test(_m())&&(x.scrollTop+=R))}const x=(s==null?void 0:s.current)||r.floating;if(n&&x)return x.addEventListener("wheel",f),requestAnimationFrame(()=>{d.current=x.scrollTop,i.current!=null&&(h.current={...i.current})}),()=>{d.current=null,h.current=null,x.removeEventListener("wheel",f)}},[o,n,r.floating,i,s,l]);const m=I.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const f=(s==null?void 0:s.current)||r.floating;if(!(!i.current||!f||!c.current)){if(d.current!==null){const x=f.scrollTop-d.current;(i.current.bottom<-.5&&x<-1||i.current.top<-.5&&x>1)&&Bn.flushSync(()=>l(b=>b+x))}requestAnimationFrame(()=>{d.current=f.scrollTop})}}}),[r.floating,l,i,s]);return I.useMemo(()=>o?{floating:m}:{},[o,m])}let Qn=O.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Qn.displayName="FloatingContext";let ss=O.createContext(null);ss.displayName="PlacementContext";function Jg(e){return O.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function Zg(){return O.useContext(Qn).setReference}function ev(){return O.useContext(Qn).getReferenceProps}function tv(){let{getFloatingProps:e,slot:t}=O.useContext(Qn);return O.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function nv(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=O.useContext(ss),n=O.useMemo(()=>e,[JSON.stringify(e,(o,i)=>{var s;return(s=i==null?void 0:i.outerHTML)!=null?s:i})]);xe(()=>{t==null||t(n??null)},[t,n]);let r=O.useContext(Qn);return O.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Ma=4;function rv({children:e,enabled:t=!0}){let[n,r]=O.useState(null),[o,i]=O.useState(0),s=O.useRef(null),[a,l]=O.useState(null);ov(a);let c=t&&n!==null&&a!==null,{to:d="bottom",gap:h=0,offset:m=0,padding:f=0,inner:x}=iv(n,a),[b,R="center"]=d.split(" ");xe(()=>{c&&i(0)},[c]);let{refs:$,floatingStyles:w,context:T}=Qg({open:c,placement:b==="selection"?R==="center"?"bottom":`bottom-${R}`:R==="center"?`${b}`:`${b}-${R}`,strategy:"absolute",transform:!1,middleware:[Zc({mainAxis:b==="selection"?0:h,crossAxis:m}),Fg({padding:f}),b!=="selection"&&Pg({padding:f}),b==="selection"&&x?Yg({...x,padding:f,overflowRef:s,offset:o,minItemsVisible:Ma,referenceOverflowThreshold:f,onFallbackChange(C){var S,A;if(!C)return;let k=T.elements.floating;if(!k)return;let v=parseFloat(getComputedStyle(k).scrollPaddingBottom)||0,E=Math.min(Ma,k.childElementCount),F=0,y=0;for(let M of(A=(S=T.elements.floating)==null?void 0:S.childNodes)!=null?A:[])if(St(M)){let B=M.offsetTop,V=B+M.clientHeight+v,H=k.scrollTop,_=H+k.clientHeight;if(B>=H&&V<=_)E--;else{y=Math.max(0,Math.min(V,_)-Math.max(B,H)),F=M.clientHeight;break}}E>=1&&i(M=>{let B=F*E-y+v;return M>=B?M:B})}}):null,$g({padding:f,apply({availableWidth:C,availableHeight:S,elements:A}){Object.assign(A.floating.style,{overflow:"auto",maxWidth:`${C}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${S}px)`})}})].filter(Boolean),whileElementsMounted:Rg}),[N=b,D=R]=T.placement.split("-");b==="selection"&&(N="selection");let j=O.useMemo(()=>({anchor:[N,D].filter(Boolean).join(" ")}),[N,D]),W=Xg(T,{overflowRef:s,onChange:i}),{getReferenceProps:u,getFloatingProps:p}=Kg([W]),g=ce(C=>{l(C),$.setFloating(C)});return I.createElement(ss.Provider,{value:r},I.createElement(Qn.Provider,{value:{setFloating:g,setReference:$.setReference,styles:w,getReferenceProps:u,getFloatingProps:p,slot:j}},e))}function ov(e){xe(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function iv(e,t){var n,r,o;let i=Qo((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),s=Qo((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),a=Qo((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:i,offset:s,padding:a}}function Qo(e,t,n=void 0){let r=yr(),o=ce((l,c)=>{if(l==null)return[n,null];if(typeof l=="number")return[l,null];if(typeof l=="string"){if(!c)return[n,null];let d=Ia(l,c);return[d,h=>{let m=nu(l);{let f=m.map(x=>window.getComputedStyle(c).getPropertyValue(x));r.requestAnimationFrame(function x(){r.nextFrame(x);let b=!1;for(let[$,w]of m.entries()){let T=window.getComputedStyle(c).getPropertyValue(w);if(f[$]!==T){f[$]=T,b=!0;break}}if(!b)return;let R=Ia(l,c);d!==R&&(h(R),d=R)})}return r.dispose}]}return[n,null]}),i=O.useMemo(()=>o(e,t)[0],[e,t]),[s=i,a]=O.useState();return xe(()=>{let[l,c]=o(e,t);if(a(l),!!c)return c(a)},[e,t]),s}function nu(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...nu(o)]:[r]}return[]}function Ia(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function sv(e,t){let[n,r]=O.useState(t);return!e&&n!==t&&r(t),e?n:t}let as=O.createContext(null);as.displayName="OpenClosedContext";var cr=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(cr||{});function av(){return O.useContext(as)}function lv({value:e,children:t}){return O.createElement(as.Provider,{value:e},t)}function cv(e){throw new Error("Unexpected object: "+e)}var ue=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ue||{});function Lr(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let i=0;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 1:{o===-1&&(o=n.length);for(let i=o-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 2:{for(let i=o+1;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 3:{for(let i=n.length-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 4:{for(let i=0;i<n.length;++i)if(t.resolveId(n[i],i,n)===e.id)return i;return r}case 5:return null;default:cv(e)}}function ru(e){let t=ce(e),n=O.useRef(!1);O.useEffect(()=>(n.current=!1,()=>{n.current=!0,mc(()=>{n.current&&t()})}),[t])}function uv(){let e=typeof document>"u";return"useSyncExternalStore"in I?(t=>t.useSyncExternalStore)(I)(()=>()=>{},()=>!1,()=>!e):!1}function fv(){let e=uv(),[t,n]=I.useState(cn.isHandoffComplete);return t&&cn.isHandoffComplete===!1&&n(!1),I.useEffect(()=>{t!==!0&&n(!0)},[t]),I.useEffect(()=>cn.handoff(),[]),e?!1:t}let dv=O.createContext(!1);function hv(){return O.useContext(dv)}function pv(e){let t=hv(),n=O.useContext(iu),[r,o]=O.useState(()=>{var i;if(!t&&n!==null)return(i=n.current)!=null?i:null;if(cn.isServer)return null;let s=e==null?void 0:e.getElementById("headlessui-portal-root");if(s)return s;if(e===null)return null;let a=e.createElement("div");return a.setAttribute("id","headlessui-portal-root"),e.body.appendChild(a)});return O.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),O.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let ou=O.Fragment,mv=et(function(e,t){let{ownerDocument:n=null,...r}=e,o=O.useRef(null),i=ht(Hp(f=>{o.current=f}),t),s=Ti(o),a=n??s,l=pv(a),[c]=O.useState(()=>{var f;return cn.isServer?null:(f=a==null?void 0:a.createElement("div"))!=null?f:null}),d=O.useContext(yv),h=fv();xe(()=>{!l||!c||l.contains(c)||(c.setAttribute("data-headlessui-portal",""),l.appendChild(c))},[l,c]),xe(()=>{if(c&&d)return d.register(c)},[d,c]),ru(()=>{var f;!l||!c||(Ji(c)&&l.contains(c)&&l.removeChild(c),l.childNodes.length<=0&&((f=l.parentElement)==null||f.removeChild(l)))});let m=Ze();return h?!l||!c?null:Bt.createPortal(m({ourProps:{ref:i},theirProps:r,slot:{},defaultTag:ou,name:"Portal"}),c):null});function gv(e,t){let n=ht(t),{enabled:r=!0,ownerDocument:o,...i}=e,s=Ze();return r?O.createElement(mv,{...i,ownerDocument:o,ref:n}):s({ourProps:{ref:n},theirProps:i,slot:{},defaultTag:ou,name:"Portal"})}let vv=O.Fragment,iu=O.createContext(null);function bv(e,t){let{target:n,...r}=e,o={ref:ht(t)},i=Ze();return O.createElement(iu.Provider,{value:n},i({ourProps:o,theirProps:r,defaultTag:vv,name:"Popover.Group"}))}let yv=O.createContext(null),wv=et(gv),xv=et(bv),Ev=Object.assign(wv,{Group:xv});function Rv(e,t){let n=O.useRef({left:0,top:0});if(xe(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let Da=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Na(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!St(o))return r;let i=!1;for(let a of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),i=!0;let s=i?(n=o.innerText)!=null?n:"":r;return Da.test(s)&&(s=s.replace(Da,"")),s}function Sv(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let i=document.getElementById(o);if(i){let s=i.getAttribute("aria-label");return typeof s=="string"?s.trim():Na(i).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Na(e).trim()}function Cv(e){let t=O.useRef(""),n=O.useRef("");return ce(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let i=Sv(r).trim().toLowerCase();return t.current=o,n.current=i,i})}var Ov=Object.defineProperty,Av=(e,t,n)=>t in e?Ov(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,La=(e,t,n)=>(Av(e,typeof t!="symbol"?t+"":t,n),n),we=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(we||{}),at=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(at||{}),Mi=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Mi||{}),su=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(su||{});function ja(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Bc(t(e.options.slice()),i=>i.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let kv={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ue.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(i=>r(i.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,i,s;if(e.dataRef.current.disabled||e.listboxState===1)return e;let a={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ue.Nothing)return{...a,activeOptionIndex:null};if(t.focus===ue.Specific)return{...a,activeOptionIndex:e.options.findIndex(d=>d.id===t.id)};if(t.focus===ue.Previous){let d=e.activeOptionIndex;if(d!==null){let h=e.options[d].dataRef.current.domRef,m=Lr(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((r=h.current)==null?void 0:r.previousElementSibling)===f.current||((o=f.current)==null?void 0:o.previousElementSibling)===null)return{...a,activeOptionIndex:m}}}}else if(t.focus===ue.Next){let d=e.activeOptionIndex;if(d!==null){let h=e.options[d].dataRef.current.domRef,m=Lr(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((i=h.current)==null?void 0:i.nextElementSibling)===f.current||((s=f.current)==null?void 0:s.nextElementSibling)===null)return{...a,activeOptionIndex:m}}}}let l=ja(e),c=Lr(t,{resolveItems:()=>l.options,resolveActiveIndex:()=>l.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});return{...a,...l,activeOptionIndex:c}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(s=>{var a;return!s.dataRef.current.disabled&&((a=s.dataRef.current.textValue)==null?void 0:a.startsWith(r))}),i=o?e.options.indexOf(o):-1;return i===-1||i===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:i,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ue.Nothing&&(r=Lr(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let i=n.findIndex(s=>o==null?void 0:o(s.dataRef.current.value));i!==-1&&(r=i)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ue.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[i,s]of n.entries())if(o.has(s.id)&&(r.push(i),o.delete(s.id),o.size===0))break;if(r.length>0){n=n.slice();for(let i of r.reverse())n.splice(i,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...ja(e),pendingShouldSort:!1}:e};class ls extends $c{constructor(t){super(t),La(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:i,value:s}=this.state.dataRef.current;return ut(i,{0:()=>r==null?void 0:r(n),1:()=>{let a=s.slice(),l=a.findIndex(c=>o(c,n));return l===-1?a.push(n):a.splice(l,1),r==null?void 0:r(a)}})},registerOption:Wo(()=>{let n=[],r=new Set;return[(o,i)=>{r.has(i)||(r.add(i),n.push({id:o,dataRef:i}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:Wo(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:Wo(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:ue.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),La(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,i=n.options;return o===null||(r=i[o])==null?void 0:r.id},isActive(n,r){var o;let i=n.activeOptionIndex,s=n.options;return i!==null?((o=s[i])==null?void 0:o.id)===r:!1},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=es.get(null);this.disposables.add(r.on(Ic.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new ls({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ue.Nothing},__demoMode:n})}reduce(t,n){return ut(n.type,kv,t,n)}}const au=O.createContext(null);function cs(e){let t=O.useContext(au);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,lu),n}return t}function lu({id:e,__demoMode:t=!1}){let n=O.useMemo(()=>ls.new({id:e,__demoMode:t}),[]);return ru(()=>n.dispose()),n}let wo=O.createContext(null);wo.displayName="ListboxDataContext";function Er(e){let t=O.useContext(wo);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Er),n}return t}let Tv=O.Fragment;function Fv(e,t){let n=O.useId(),r=Yi(),{value:o,defaultValue:i,form:s,name:a,onChange:l,by:c,invalid:d=!1,disabled:h=r||!1,horizontal:m=!1,multiple:f=!1,__demoMode:x=!1,...b}=e;const R=m?"horizontal":"vertical";let $=ht(t),w=Cp(i),[T=f?[]:void 0,N]=Sp(o,l,w),D=lu({id:n,__demoMode:x}),j=O.useRef({static:!1,hold:!1}),W=O.useRef(new Map),u=Yp(c),p=O.useCallback(H=>ut(g.mode,{[at.Multi]:()=>T.some(_=>u(_,H)),[at.Single]:()=>u(T,H)}),[T]),g=O.useMemo(()=>({value:T,disabled:h,invalid:d,mode:f?at.Multi:at.Single,orientation:R,onChange:N,compare:u,isSelected:p,optionsPropsRef:j,listRef:W}),[T,h,d,f,R,N,u,p,j,W]);xe(()=>{D.state.dataRef.current=g},[g]);let C=qe(D,H=>H.listboxState),S=es.get(null),A=qe(S,O.useCallback(H=>S.selectors.isTop(H,n),[S,n])),[k,v]=qe(D,H=>[H.buttonElement,H.optionsElement]);Sm(A,[k,v],(H,_)=>{D.send({type:su.CloseListbox}),jc(_,ts.Loose)||(H.preventDefault(),k==null||k.focus())});let E=O.useMemo(()=>({open:C===we.Open,disabled:h,invalid:d,value:T}),[C,h,d,T]),[F,y]=zp({inherit:!0}),M={ref:$},B=O.useCallback(()=>{if(w!==void 0)return N==null?void 0:N(w)},[N,w]),V=Ze();return O.createElement(y,{value:F,props:{htmlFor:k==null?void 0:k.id},slot:{open:C===we.Open,disabled:h}},O.createElement(rv,null,O.createElement(au.Provider,{value:D},O.createElement(wo.Provider,{value:g},O.createElement(lv,{value:ut(C,{[we.Open]:cr.Open,[we.Closed]:cr.Closed})},a!=null&&T!=null&&O.createElement(Pp,{disabled:h,data:{[a]:T},form:s,onReset:B}),V({ourProps:M,theirProps:b,slot:E,defaultTag:Tv,name:"Listbox"}))))))}let Pv="button";function $v(e,t){let n=O.useId(),r=Ec(),o=Er("Listbox.Button"),i=cs("Listbox.Button"),{id:s=r||`headlessui-listbox-button-${n}`,disabled:a=o.disabled||!1,autoFocus:l=!1,...c}=e,d=ht(t,Zg(),i.actions.setButtonElement),h=ev(),[m,f,x]=qe(i,v=>[v.listboxState,v.buttonElement,v.optionsElement]),b=m===we.Open;Am(b,{trigger:f,action:O.useCallback(v=>{if(f!=null&&f.contains(v.target))return Dr.Ignore;let E=v.target.closest('[role="option"]:not([data-disabled])');return St(E)?Dr.Select(E):x!=null&&x.contains(v.target)?Dr.Ignore:Dr.Close},[f,x]),close:i.actions.closeListbox,select:i.actions.selectActiveOption});let R=ce(v=>{switch(v.key){case ye.Enter:Op(v.currentTarget);break;case ye.Space:case ye.ArrowDown:v.preventDefault(),i.actions.openListbox({focus:o.value?ue.Nothing:ue.First});break;case ye.ArrowUp:v.preventDefault(),i.actions.openListbox({focus:o.value?ue.Nothing:ue.Last});break}}),$=ce(v=>{switch(v.key){case ye.Space:v.preventDefault();break}}),w=ce(v=>{var E;if(v.button===0){if(jp(v.currentTarget))return v.preventDefault();i.state.listboxState===we.Open?(Bt.flushSync(()=>i.actions.closeListbox()),(E=i.state.buttonElement)==null||E.focus({preventScroll:!0})):(v.preventDefault(),i.actions.openListbox({focus:ue.Nothing}))}}),T=ce(v=>v.preventDefault()),N=kc([s]),D=Wp(),{isFocusVisible:j,focusProps:W}=fp({autoFocus:l}),{isHovered:u,hoverProps:p}=up({isDisabled:a}),{pressed:g,pressProps:C}=vp({disabled:a}),S=O.useMemo(()=>({open:m===we.Open,active:g||m===we.Open,disabled:a,invalid:o.invalid,value:o.value,hover:u,focus:j,autofocus:l}),[m,o.value,a,u,j,g,o.invalid,l]),A=qe(i,v=>v.listboxState===we.Open),k=vc(h(),{ref:d,id:s,type:km(e,f),"aria-haspopup":"listbox","aria-controls":x==null?void 0:x.id,"aria-expanded":A,"aria-labelledby":N,"aria-describedby":D,disabled:a||void 0,autoFocus:l,onKeyDown:R,onKeyUp:$,onKeyPress:T,onPointerDown:w},W,p,C);return Ze()({ourProps:k,theirProps:c,slot:S,defaultTag:Pv,name:"Listbox.Button"})}let cu=O.createContext(!1),Mv="div",Iv=Ci.RenderStrategy|Ci.Static;function Dv(e,t){let n=O.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:i=!1,modal:s=!0,transition:a=!1,...l}=e,c=Jg(o),[d,h]=O.useState(null);c&&(i=!0);let m=Er("Listbox.Options"),f=cs("Listbox.Options"),[x,b,R,$]=qe(f,U=>[U.listboxState,U.buttonElement,U.optionsElement,U.__demoMode]),w=Ti(b),T=Ti(R),N=av(),[D,j]=Wm(a,d,N!==null?(N&cr.Open)===cr.Open:x===we.Open);dm(D,b,f.actions.closeListbox);let W=$?!1:s&&x===we.Open;Nm(W,T);let u=$?!1:s&&x===we.Open;fm(u,{allowed:O.useCallback(()=>[b,R],[b,R])});let p=x!==we.Open,g=Rv(p,b)?!1:D,C=D&&x===we.Closed,S=sv(C,m.value),A=ce(U=>m.compare(S,U)),k=qe(f,U=>{var ae;if(c==null||!((ae=c==null?void 0:c.to)!=null&&ae.includes("selection")))return null;let ge=U.options.findIndex(Ee=>A(Ee.dataRef.current.value));return ge===-1&&(ge=0),ge}),v=(()=>{if(c==null)return;if(k===null)return{...c,inner:void 0};let U=Array.from(m.listRef.current.values());return{...c,inner:{listRef:{current:U},index:k}}})(),[E,F]=nv(v),y=tv(),M=ht(t,c?E:null,f.actions.setOptionsElement,h),B=yr();O.useEffect(()=>{var U;let ae=R;ae&&x===we.Open&&ae!==((U=br(ae))==null?void 0:U.activeElement)&&(ae==null||ae.focus({preventScroll:!0}))},[x,R]);let V=ce(U=>{var ae,ge;switch(B.dispose(),U.key){case ye.Space:if(f.state.searchQuery!=="")return U.preventDefault(),U.stopPropagation(),f.actions.search(U.key);case ye.Enter:if(U.preventDefault(),U.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:Ee}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(Ee.current.value)}m.mode===at.Single&&(Bt.flushSync(()=>f.actions.closeListbox()),(ae=f.state.buttonElement)==null||ae.focus({preventScroll:!0}));break;case ut(m.orientation,{vertical:ye.ArrowDown,horizontal:ye.ArrowRight}):return U.preventDefault(),U.stopPropagation(),f.actions.goToOption({focus:ue.Next});case ut(m.orientation,{vertical:ye.ArrowUp,horizontal:ye.ArrowLeft}):return U.preventDefault(),U.stopPropagation(),f.actions.goToOption({focus:ue.Previous});case ye.Home:case ye.PageUp:return U.preventDefault(),U.stopPropagation(),f.actions.goToOption({focus:ue.First});case ye.End:case ye.PageDown:return U.preventDefault(),U.stopPropagation(),f.actions.goToOption({focus:ue.Last});case ye.Escape:U.preventDefault(),U.stopPropagation(),Bt.flushSync(()=>f.actions.closeListbox()),(ge=f.state.buttonElement)==null||ge.focus({preventScroll:!0});return;case ye.Tab:U.preventDefault(),U.stopPropagation(),Bt.flushSync(()=>f.actions.closeListbox()),wm(f.state.buttonElement,U.shiftKey?ki.Previous:ki.Next);break;default:U.key.length===1&&(f.actions.search(U.key),B.setTimeout(()=>f.actions.clearSearch(),350));break}}),H=qe(f,U=>{var ae;return(ae=U.buttonElement)==null?void 0:ae.id}),_=O.useMemo(()=>({open:x===we.Open}),[x]),ee=vc(c?y():{},{id:r,ref:M,"aria-activedescendant":qe(f,f.selectors.activeDescendantId),"aria-multiselectable":m.mode===at.Multi?!0:void 0,"aria-labelledby":H,"aria-orientation":m.orientation,onKeyDown:V,role:"listbox",tabIndex:x===we.Open?0:void 0,style:{...l.style,...F,"--button-width":Jp(b,!0).width},...Hm(j)}),Z=Ze(),Y=O.useMemo(()=>m.mode===at.Multi?m:{...m,isSelected:A},[m,A]);return O.createElement(Ev,{enabled:i?e.static||D:!1,ownerDocument:w},O.createElement(wo.Provider,{value:Y},Z({ourProps:ee,theirProps:l,slot:_,defaultTag:Mv,features:Iv,visible:g,name:"Listbox.Options"})))}let Nv="div";function Lv(e,t){let n=O.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:i,...s}=e,a=O.useContext(cu)===!0,l=Er("Listbox.Option"),c=cs("Listbox.Option"),d=qe(c,g=>c.selectors.isActive(g,r)),h=l.isSelected(i),m=O.useRef(null),f=Cv(m),x=zn({disabled:o,value:i,domRef:m,get textValue(){return f()}}),b=ht(t,m,g=>{g?l.listRef.current.set(r,g):l.listRef.current.delete(r)}),R=qe(c,g=>c.selectors.shouldScrollIntoView(g,r));xe(()=>{if(R)return Je().requestAnimationFrame(()=>{var g,C;(C=(g=m.current)==null?void 0:g.scrollIntoView)==null||C.call(g,{block:"nearest"})})},[R,m]),xe(()=>{if(!a)return c.actions.registerOption(r,x),()=>c.actions.unregisterOption(r)},[x,r,a]);let $=ce(g=>{var C;if(o)return g.preventDefault();c.actions.onChange(i),l.mode===at.Single&&(Bt.flushSync(()=>c.actions.closeListbox()),(C=c.state.buttonElement)==null||C.focus({preventScroll:!0}))}),w=ce(()=>{if(o)return c.actions.goToOption({focus:ue.Nothing});c.actions.goToOption({focus:ue.Specific,id:r})}),T=Lm(),N=ce(g=>{T.update(g),!o&&(d||c.actions.goToOption({focus:ue.Specific,id:r},Mi.Pointer))}),D=ce(g=>{T.wasMoved(g)&&(o||d||c.actions.goToOption({focus:ue.Specific,id:r},Mi.Pointer))}),j=ce(g=>{T.wasMoved(g)&&(o||d&&c.actions.goToOption({focus:ue.Nothing}))}),W=O.useMemo(()=>({active:d,focus:d,selected:h,disabled:o,selectedOption:h&&a}),[d,h,o,a]),u=a?{}:{id:r,ref:b,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":h,disabled:void 0,onClick:$,onFocus:w,onPointerEnter:N,onMouseEnter:N,onPointerMove:D,onMouseMove:D,onPointerLeave:j,onMouseLeave:j},p=Ze();return!h&&a?null:p({ourProps:u,theirProps:s,slot:W,defaultTag:Nv,name:"Listbox.Option"})}let jv=O.Fragment;function Bv(e,t){let{options:n,placeholder:r,...o}=e,i={ref:ht(t)},s=Er("ListboxSelectedOption"),a=O.useMemo(()=>({}),[]),l=s.value===void 0||s.value===null||s.mode===at.Multi&&Array.isArray(s.value)&&s.value.length===0,c=Ze();return O.createElement(cu.Provider,{value:!0},c({ourProps:i,theirProps:{...o,children:O.createElement(O.Fragment,null,r&&l?r:n)},slot:a,defaultTag:jv,name:"ListboxSelectedOption"}))}let Hv=et(Fv),uu=et($v),Wv=Tc,fu=et(Dv),du=et(Lv),Uv=et(Bv),Vv=Object.assign(Hv,{Button:uu,Label:Wv,Options:fu,Option:du,SelectedOption:Uv});function hu(e={}){const{activeAddress:t,algodClient:n}=xt.useWallet(),{enabled:r=!0}=e;return Vi({queryKey:["account-info",t],queryFn:async()=>{if(!t||!n)return null;try{return await n.accountInformation(t).do()}catch(o){throw new Error(`Error fetching account information: ${o}`)}},enabled:r&&!!t&&!!n,refetchOnWindowFocus:!0})}function qv({className:e,scale:t=.85}){return L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:En("inline-block align-baseline",e),style:{width:`${t}em`,height:`${t}em`},"aria-label":"Algorand",fill:"currentColor",children:L.jsx("path",{d:"M23.98 23.99h-3.75l-2.44-9.07-5.25 9.07H8.34l8.1-14.04-1.3-4.88L4.22 24H.02L13.88 0h3.67l1.61 5.96h3.79l-2.59 4.5 3.62 13.53z"})})}function zv({children:e}){var v;const{activeAddress:t,activeWallet:n}=xt.useWallet(),{theme:r}=uo(),[o,i]=O.useState(!1),[s,a]=O.useState(!1),[l,c]=O.useState(()=>{const E=localStorage.getItem("uwui:balance-preference");return E?E==="available":!1}),d=r==="system"?void 0:r,h=qi({enabled:!!t}),m=((v=h.data)==null?void 0:v.name)??null,{data:f}=hu({enabled:!!t}),x=O.useMemo(()=>!f||f.amount===void 0?null:Number(f.amount)/1e6,[f]),b=O.useMemo(()=>{if(!f||f.amount===void 0||f.minBalance===void 0)return null;const E=Number(f.amount)-Number(f.minBalance);return Math.max(0,E/1e6)},[f]),R=l?b:x,{refs:$,floatingStyles:w,context:T}=Hl({open:o,onOpenChange:i,placement:"bottom-end",middleware:[Sd(8),Od(),Cd()],whileElementsMounted:gd}),N=jl(T),D=Bl(T,{outsidePressEvent:"mousedown"}),{getReferenceProps:j,getFloatingProps:W}=Wl([N,D]),u=Wn(),p=()=>{t&&(navigator.clipboard.writeText(t),a(!0),setTimeout(()=>a(!1),2e3))},g=async()=>{if(n)try{await n.disconnect(),i(!1)}catch(E){console.error("Error disconnecting wallet:",E)}},C=E=>{n&&n.setActiveAccount&&n.setActiveAccount(E)},S=()=>{const E=!l;c(E),localStorage.setItem("uwui:balance-preference",E?"available":"total")},A=e||L.jsx(fo,{}),k=O.cloneElement(A,j({ref:$.setReference}));return L.jsxs(L.Fragment,{children:[k,o&&L.jsx(Dl,{children:L.jsx(Ll,{context:T,modal:!1,children:L.jsx("div",{"data-wallet-ui":!0,"data-theme":d,children:L.jsx("div",{ref:$.setFloating,style:w,...W(),"aria-labelledby":u,className:"z-50 w-80 rounded-xl bg-[var(--wui-color-bg)] shadow-xl border border-[var(--wui-color-border)]",children:L.jsxs("div",{className:"p-4",children:[L.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[L.jsx("div",{className:"h-12 w-12 overflow-hidden",children:L.jsx(zi,{nfd:h.data,alt:`${m||t} avatar`,size:48})}),L.jsxs("div",{children:[L.jsx("h3",{id:u,className:"text-lg font-bold text-[var(--wui-color-text)] max-w-[220px] truncate wallet-custom-font",children:m||(t?Xn(t,6,4):"My Wallet")}),m&&t&&L.jsx("p",{className:"text-sm text-[var(--wui-color-text-secondary)]",children:Xn(t,6,4)})]})]}),L.jsx("div",{className:"mb-4 bg-[var(--wui-color-bg-secondary)] rounded-lg p-3",children:L.jsxs("div",{className:"flex justify-between items-center",children:[R!==null&&L.jsxs("span",{className:"text-base font-medium text-[var(--wui-color-text)] flex items-center gap-1",children:[Wh(R,{fractionDigits:4}),L.jsx(qv,{})]}),L.jsxs("button",{onClick:S,className:"flex items-center gap-1 text-sm text-[var(--wui-color-text-secondary)] bg-[var(--wui-color-bg-tertiary)] py-1 pl-2.5 pr-2 rounded-md hover:brightness-90 transition-all focus:outline-none",title:l?"Show total balance":"Show available balance",children:[l?"Available":"Total",L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"ml-0.5 opacity-80",children:[L.jsx("path",{d:"m17 10-5-5-5 5"}),L.jsx("path",{d:"m17 14-5 5-5-5"})]})]})]})}),n&&n.accounts&&n.accounts.length>1&&L.jsx("div",{className:"mb-4",children:L.jsxs(Vv,{value:t||"",onChange:C,children:[L.jsx(Tc,{className:"block text-sm font-medium text-[var(--wui-color-text-secondary)] mb-1",children:"Select Account"}),L.jsxs("div",{className:"relative mt-1",children:[L.jsxs(uu,{className:"grid w-full cursor-default grid-cols-1 rounded-lg border border-[var(--wui-color-border)] bg-[var(--wui-color-bg-secondary)] py-2 px-3 text-left text-[var(--wui-color-text)] shadow-sm focus:outline-none focus:ring-2 focus:ring-[var(--wui-color-primary)] focus:border-transparent text-sm",children:[L.jsx("span",{className:"col-start-1 row-start-1 truncate pr-8",children:t?Xn(t,6,4):"Select account"}),L.jsx("span",{className:"col-start-1 row-start-1 self-center justify-self-end",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"text-[var(--wui-color-text-secondary)]","aria-hidden":"true",children:L.jsx("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),L.jsx(fu,{transition:!0,className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-[var(--wui-color-bg-secondary)] py-1 shadow-lg ring-1 ring-black/5 focus:outline-none text-sm data-[closed]:data-[leave]:opacity-0 data-[leave]:transition data-[leave]:duration-100 data-[leave]:ease-in",children:n.accounts.map(E=>L.jsxs(du,{value:E.address,className:"group relative cursor-default select-none py-2 pl-3 pr-9 text-[var(--wui-color-text)] data-[focus]:bg-[var(--wui-color-bg-hover)] data-[focus]:outline-none",children:[L.jsx("span",{className:"block truncate font-normal group-data-[selected]:font-medium",children:Xn(E.address,6,4)}),L.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-3 text-[var(--wui-color-primary)] group-[&:not([data-selected])]:hidden",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"h-5 w-5","aria-hidden":"true",children:L.jsx("path",{d:"M13.3334 4L6.00008 11.3333L2.66675 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},E.address))})]})]})}),L.jsx("div",{className:"border-t border-[var(--wui-color-border)] mt-2 mb-2"}),n&&L.jsxs("div",{className:"mb-2 flex items-center gap-2 px-1 py-0.5",children:[L.jsx("div",{className:"h-5 w-5 overflow-hidden rounded flex items-center justify-center",children:n.metadata.icon?L.jsx("img",{src:n.metadata.icon,alt:`${n.metadata.name} icon`,className:"max-w-full max-h-full"}):L.jsx("div",{className:"h-5 w-5 rounded-full bg-[var(--wui-color-bg-tertiary)] flex items-center justify-center",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3 w-3 text-[var(--wui-color-text-tertiary)]",viewBox:"0 0 20 20",fill:"currentColor",children:L.jsx("path",{fillRule:"evenodd",d:"M17 9c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v8c0 .55.45 1 1 1h4c.55 0 1-.45 1-1V9zm-1 0v8h-4V9h4zM8 4c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v13c0 .55.45 1 1 1h4c.55 0 1-.45 1-1V4zM3 3h4v14H3V3z",clipRule:"evenodd"})})})}),L.jsx("p",{className:"text-sm text-[var(--wui-color-text-secondary)]",children:n.metadata.name})]}),L.jsx("div",{className:"border-t border-[var(--wui-color-border)] mb-3 mt-2"}),L.jsxs("div",{className:"flex gap-2",children:[L.jsx("button",{onClick:p,className:"flex-1 py-2 px-4 bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text-secondary)] font-medium rounded-xl hover:brightness-90 transition-all text-sm flex items-center justify-center",title:"Copy address",children:s?L.jsxs(L.Fragment,{children:[L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-green-500 mr-1.5",viewBox:"0 0 20 20",fill:"currentColor",children:L.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Copied"]}):L.jsxs(L.Fragment,{children:[L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1.5",viewBox:"0 0 20 20",fill:"currentColor",children:[L.jsx("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),L.jsx("path",{d:"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"})]}),"Copy"]})}),L.jsx("button",{onClick:g,className:"flex-1 py-2 px-4 bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300 font-medium rounded-xl hover:bg-red-200 dark:hover:bg-red-800/60 transition-colors text-sm",children:"Disconnect"})]})]})})})})})]})}function pu(e){const{queryClient:t}=uo();return L.jsx(Jl,{client:t,children:L.jsx(zv,{...e})})}function Gv(){const{activeAddress:e}=xt.useWallet();return e?L.jsx(pu,{children:L.jsx(fo,{})}):L.jsx(nc,{})}gu();exports.ConnectWalletButton=Di;exports.ConnectWalletMenu=nc;exports.ConnectedWalletButton=fo;exports.ConnectedWalletMenu=pu;exports.NfdAvatar=zi;exports.WalletButton=Gv;exports.WalletList=tc;exports.WalletUIProvider=jh;exports.useAccountInfo=hu;exports.useNfd=qi;exports.useResolvedTheme=Zl;exports.useWalletUI=uo;
88
+ `)),[]});var Bm=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Bm||{});function Hm(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Wm(e,t,n,r){let[o,i]=O.useState(n),{hasFlag:s,addFlag:a,removeFlag:l}=jm(e&&o?3:0),c=O.useRef(!1),d=O.useRef(!1),h=yr();return xe(()=>{var m;if(e){if(n&&i(!0),!t){n&&a(3);return}return(m=void 0)==null||m.call(r,n),Um(t,{inFlight:c,prepare(){d.current?d.current=!1:d.current=c.current,c.current=!0,!d.current&&(n?(a(3),l(4)):(a(4),l(2)))},run(){d.current?n?(l(3),a(4)):(l(4),a(3)):n?l(1):a(1)},done(){var f;d.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(c.current=!1,l(7),n||i(!1),(f=void 0)==null||f.call(r,n))}})}},[e,n,t,h]),e?[o,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Um(e,{prepare:t,run:n,done:r,inFlight:o}){let i=Je();return qm(e,{prepare:t,inFlight:o}),i.nextFrame(()=>{n(),i.requestAnimationFrame(()=>{i.add(Vm(e,r))})}),i.dispose}function Vm(e,t){var n,r;let o=Je();if(!e)return o.dispose;let i=!1;o.add(()=>{i=!0});let s=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return s.length===0?(t(),o.dispose):(Promise.allSettled(s.map(a=>a.finished)).then(()=>{i||t()}),o.dispose)}function qm(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.style.transition=r}function go(){return typeof window<"u"}function Gn(e){return Wc(e)?(e.nodeName||"").toLowerCase():"#document"}function Le(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pt(e){var t;return(t=(Wc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Wc(e){return go()?e instanceof Node||e instanceof Le(e).Node:!1}function Ae(e){return go()?e instanceof Element||e instanceof Le(e).Element:!1}function ft(e){return go()?e instanceof HTMLElement||e instanceof Le(e).HTMLElement:!1}function Ea(e){return!go()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Le(e).ShadowRoot}function wr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Xe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function zm(e){return["table","td","th"].includes(Gn(e))}function vo(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function ns(e){const t=rs(),n=Ae(e)?Xe(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Gm(e){let t=Ut(e);for(;ft(t)&&!Un(t);){if(ns(t))return t;if(vo(t))return null;t=Ut(t)}return null}function rs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Un(e){return["html","body","#document"].includes(Gn(e))}function Xe(e){return Le(e).getComputedStyle(e)}function bo(e){return Ae(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ut(e){if(Gn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ea(e)&&e.host||pt(e);return Ea(t)?t.host:t}function Uc(e){const t=Ut(e);return Un(t)?e.ownerDocument?e.ownerDocument.body:e.body:ft(t)&&wr(t)?t:Uc(t)}function sr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Uc(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Le(o);if(i){const a=Fi(s);return t.concat(s,s.visualViewport||[],wr(o)?o:[],a&&n?sr(a):[])}return t.concat(o,sr(o,[],n))}function Fi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function _m(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const pn=Math.min,Oe=Math.max,ar=Math.round,Nr=Math.floor,ct=e=>({x:e,y:e}),Qm={left:"right",right:"left",bottom:"top",top:"bottom"},Km={start:"end",end:"start"};function Ra(e,t,n){return Oe(e,pn(t,n))}function _n(e,t){return typeof e=="function"?e(t):e}function Vt(e){return e.split("-")[0]}function xr(e){return e.split("-")[1]}function Vc(e){return e==="x"?"y":"x"}function qc(e){return e==="y"?"height":"width"}function mn(e){return["top","bottom"].includes(Vt(e))?"y":"x"}function zc(e){return Vc(mn(e))}function Ym(e,t,n){n===void 0&&(n=!1);const r=xr(e),o=zc(e),i=qc(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Zr(s)),[s,Zr(s)]}function Xm(e){const t=Zr(e);return[Pi(e),t,Pi(t)]}function Pi(e){return e.replace(/start|end/g,t=>Km[t])}function Jm(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function Zm(e,t,n,r){const o=xr(e);let i=Jm(Vt(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(Pi)))),i}function Zr(e){return e.replace(/left|right|bottom|top/g,t=>Qm[t])}function eg(e){return{top:0,right:0,bottom:0,left:0,...e}}function tg(e){return typeof e!="number"?eg(e):{top:e,right:e,bottom:e,left:e}}function eo(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Sa(e,t,n){let{reference:r,floating:o}=e;const i=mn(t),s=zc(t),a=qc(s),l=Vt(t),c=i==="y",d=r.x+r.width/2-o.width/2,h=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let f;switch(l){case"top":f={x:d,y:r.y-o.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:h};break;case"left":f={x:r.x-o.width,y:h};break;default:f={x:r.x,y:r.y}}switch(xr(t)){case"start":f[s]-=m*(n&&c?-1:1);break;case"end":f[s]+=m*(n&&c?-1:1);break}return f}const ng=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let c=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:h}=Sa(c,r,l),m=r,f={},x=0;for(let b=0;b<a.length;b++){const{name:R,fn:$}=a[b],{x:w,y:T,data:N,reset:D}=await $({x:d,y:h,initialPlacement:r,placement:m,strategy:o,middlewareData:f,rects:c,platform:s,elements:{reference:e,floating:t}});d=w??d,h=T??h,f={...f,[R]:{...f[R],...N}},D&&x<=50&&(x++,typeof D=="object"&&(D.placement&&(m=D.placement),D.rects&&(c=D.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):D.rects),{x:d,y:h}=Sa(c,m,l)),b=-1)}return{x:d,y:h,placement:m,strategy:o,middlewareData:f}};async function yo(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:h="floating",altBoundary:m=!1,padding:f=0}=_n(t,e),x=tg(f),R=a[m?h==="floating"?"reference":"floating":h],$=eo(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(R)))==null||n?R:R.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),w=h==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,T=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),N=await(i.isElement==null?void 0:i.isElement(T))?await(i.getScale==null?void 0:i.getScale(T))||{x:1,y:1}:{x:1,y:1},D=eo(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:T,strategy:l}):w);return{top:($.top-D.top+x.top)/N.y,bottom:(D.bottom-$.bottom+x.bottom)/N.y,left:($.left-D.left+x.left)/N.x,right:(D.right-$.right+x.right)/N.x}}const rg=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:b=!0,...R}=_n(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const $=Vt(o),w=mn(a),T=Vt(a)===a,N=await(l.isRTL==null?void 0:l.isRTL(c.floating)),D=m||(T||!b?[Zr(a)]:Xm(a)),j=x!=="none";!m&&j&&D.push(...Zm(a,b,x,N));const W=[a,...D],u=await yo(t,R),p=[];let g=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&p.push(u[$]),h){const k=Ym(o,s,N);p.push(u[k[0]],u[k[1]])}if(g=[...g,{placement:o,overflows:p}],!p.every(k=>k<=0)){var C,S;const k=(((C=i.flip)==null?void 0:C.index)||0)+1,v=W[k];if(v)return{data:{index:k,overflows:g},reset:{placement:v}};let E=(S=g.filter(F=>F.overflows[0]<=0).sort((F,y)=>F.overflows[1]-y.overflows[1])[0])==null?void 0:S.placement;if(!E)switch(f){case"bestFit":{var A;const F=(A=g.filter(y=>{if(j){const M=mn(y.placement);return M===w||M==="y"}return!0}).map(y=>[y.placement,y.overflows.filter(M=>M>0).reduce((M,B)=>M+B,0)]).sort((y,M)=>y[1]-M[1])[0])==null?void 0:A[0];F&&(E=F);break}case"initialPlacement":E=a;break}if(o!==E)return{reset:{placement:E}}}return{}}}};async function og(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Vt(n),a=xr(n),l=mn(n)==="y",c=["left","top"].includes(s)?-1:1,d=i&&l?-1:1,h=_n(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:x}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof x=="number"&&(f=a==="end"?x*-1:x),l?{x:f*d,y:m*c}:{x:m*c,y:f*d}}const ig=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await og(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},sg=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:R=>{let{x:$,y:w}=R;return{x:$,y:w}}},...l}=_n(e,t),c={x:n,y:r},d=await yo(t,l),h=mn(Vt(o)),m=Vc(h);let f=c[m],x=c[h];if(i){const R=m==="y"?"top":"left",$=m==="y"?"bottom":"right",w=f+d[R],T=f-d[$];f=Ra(w,f,T)}if(s){const R=h==="y"?"top":"left",$=h==="y"?"bottom":"right",w=x+d[R],T=x-d[$];x=Ra(w,x,T)}const b=a.fn({...t,[m]:f,[h]:x});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[m]:i,[h]:s}}}}}},ag=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...c}=_n(e,t),d=await yo(t,c),h=Vt(o),m=xr(o),f=mn(o)==="y",{width:x,height:b}=i.floating;let R,$;h==="top"||h==="bottom"?(R=h,$=m===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):($=h,R=m==="end"?"top":"bottom");const w=b-d.top-d.bottom,T=x-d.left-d.right,N=pn(b-d[R],w),D=pn(x-d[$],T),j=!t.middlewareData.shift;let W=N,u=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(u=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(W=w),j&&!m){const g=Oe(d.left,0),C=Oe(d.right,0),S=Oe(d.top,0),A=Oe(d.bottom,0);f?u=x-2*(g!==0||C!==0?g+C:Oe(d.left,d.right)):W=b-2*(S!==0||A!==0?S+A:Oe(d.top,d.bottom))}await l({...t,availableWidth:u,availableHeight:W});const p=await s.getDimensions(a.floating);return x!==p.width||b!==p.height?{reset:{rects:!0}}:{}}}};function Gc(e){const t=Xe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ft(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=ar(n)!==i||ar(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function os(e){return Ae(e)?e:e.contextElement}function On(e){const t=os(e);if(!ft(t))return ct(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Gc(t);let s=(i?ar(n.width):n.width)/r,a=(i?ar(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const lg=ct(0);function _c(e){const t=Le(e);return!rs()||!t.visualViewport?lg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function cg(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Le(e)?!1:t}function gn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=os(e);let s=ct(1);t&&(r?Ae(r)&&(s=On(r)):s=On(e));const a=cg(i,n,r)?_c(i):ct(0);let l=(o.left+a.x)/s.x,c=(o.top+a.y)/s.y,d=o.width/s.x,h=o.height/s.y;if(i){const m=Le(i),f=r&&Ae(r)?Le(r):r;let x=m,b=Fi(x);for(;b&&r&&f!==x;){const R=On(b),$=b.getBoundingClientRect(),w=Xe(b),T=$.left+(b.clientLeft+parseFloat(w.paddingLeft))*R.x,N=$.top+(b.clientTop+parseFloat(w.paddingTop))*R.y;l*=R.x,c*=R.y,d*=R.x,h*=R.y,l+=T,c+=N,x=Le(b),b=Fi(x)}}return eo({width:d,height:h,x:l,y:c})}function is(e,t){const n=bo(e).scrollLeft;return t?t.left+n:gn(pt(e)).left+n}function Qc(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:is(e,r)),i=r.top+t.scrollTop;return{x:o,y:i}}function ug(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=pt(r),a=t?vo(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},c=ct(1);const d=ct(0),h=ft(r);if((h||!h&&!i)&&((Gn(r)!=="body"||wr(s))&&(l=bo(r)),ft(r))){const f=gn(r);c=On(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}const m=s&&!h&&!i?Qc(s,l,!0):ct(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x+m.x,y:n.y*c.y-l.scrollTop*c.y+d.y+m.y}}function fg(e){return Array.from(e.getClientRects())}function dg(e){const t=pt(e),n=bo(e),r=e.ownerDocument.body,o=Oe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Oe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+is(e);const a=-n.scrollTop;return Xe(r).direction==="rtl"&&(s+=Oe(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function hg(e,t){const n=Le(e),r=pt(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const c=rs();(!c||c&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function pg(e,t){const n=gn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=ft(e)?On(e):ct(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,c=r*i.y;return{width:s,height:a,x:l,y:c}}function Ca(e,t,n){let r;if(t==="viewport")r=hg(e,n);else if(t==="document")r=dg(pt(e));else if(Ae(t))r=pg(t,n);else{const o=_c(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return eo(r)}function Kc(e,t){const n=Ut(e);return n===t||!Ae(n)||Un(n)?!1:Xe(n).position==="fixed"||Kc(n,t)}function mg(e,t){const n=t.get(e);if(n)return n;let r=sr(e,[],!1).filter(a=>Ae(a)&&Gn(a)!=="body"),o=null;const i=Xe(e).position==="fixed";let s=i?Ut(e):e;for(;Ae(s)&&!Un(s);){const a=Xe(s),l=ns(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||wr(s)&&!l&&Kc(e,s))?r=r.filter(d=>d!==s):o=a,s=Ut(s)}return t.set(e,r),r}function gg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?vo(t)?[]:mg(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((c,d)=>{const h=Ca(t,d,o);return c.top=Oe(h.top,c.top),c.right=pn(h.right,c.right),c.bottom=pn(h.bottom,c.bottom),c.left=Oe(h.left,c.left),c},Ca(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function vg(e){const{width:t,height:n}=Gc(e);return{width:t,height:n}}function bg(e,t,n){const r=ft(t),o=pt(t),i=n==="fixed",s=gn(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=ct(0);if(r||!r&&!i)if((Gn(t)!=="body"||wr(o))&&(a=bo(t)),r){const m=gn(t,!0,i,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else o&&(l.x=is(o));const c=o&&!r&&!i?Qc(o,a):ct(0),d=s.left+a.scrollLeft-l.x-c.x,h=s.top+a.scrollTop-l.y-c.y;return{x:d,y:h,width:s.width,height:s.height}}function qo(e){return Xe(e).position==="static"}function Oa(e,t){if(!ft(e)||Xe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return pt(e)===n&&(n=n.ownerDocument.body),n}function Yc(e,t){const n=Le(e);if(vo(e))return n;if(!ft(e)){let o=Ut(e);for(;o&&!Un(o);){if(Ae(o)&&!qo(o))return o;o=Ut(o)}return n}let r=Oa(e,t);for(;r&&zm(r)&&qo(r);)r=Oa(r,t);return r&&Un(r)&&qo(r)&&!ns(r)?n:r||Gm(e)||n}const yg=async function(e){const t=this.getOffsetParent||Yc,n=this.getDimensions,r=await n(e.floating);return{reference:bg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wg(e){return Xe(e).direction==="rtl"}const xg={convertOffsetParentRelativeRectToViewportRelativeRect:ug,getDocumentElement:pt,getClippingRect:gg,getOffsetParent:Yc,getElementRects:yg,getClientRects:fg,getDimensions:vg,getScale:On,isElement:Ae,isRTL:wg};function Xc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Eg(e,t){let n=null,r;const o=pt(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const c=e.getBoundingClientRect(),{left:d,top:h,width:m,height:f}=c;if(a||t(),!m||!f)return;const x=Nr(h),b=Nr(o.clientWidth-(d+m)),R=Nr(o.clientHeight-(h+f)),$=Nr(d),T={rootMargin:-x+"px "+-b+"px "+-R+"px "+-$+"px",threshold:Oe(0,pn(1,l))||1};let N=!0;function D(j){const W=j[0].intersectionRatio;if(W!==l){if(!N)return s();W?s(!1,W):r=setTimeout(()=>{s(!1,1e-7)},1e3)}W===1&&!Xc(c,e.getBoundingClientRect())&&s(),N=!1}try{n=new IntersectionObserver(D,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(D,T)}n.observe(e)}return s(!0),i}function Rg(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=os(e),d=o||i?[...c?sr(c):[],...sr(t)]:[];d.forEach($=>{o&&$.addEventListener("scroll",n,{passive:!0}),i&&$.addEventListener("resize",n)});const h=c&&a?Eg(c,n):null;let m=-1,f=null;s&&(f=new ResizeObserver($=>{let[w]=$;w&&w.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var T;(T=f)==null||T.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let x,b=l?gn(e):null;l&&R();function R(){const $=gn(e);b&&!Xc(b,$)&&n(),b=$,x=requestAnimationFrame(R)}return n(),()=>{var $;d.forEach(w=>{o&&w.removeEventListener("scroll",n),i&&w.removeEventListener("resize",n)}),h==null||h(),($=f)==null||$.disconnect(),f=null,l&&cancelAnimationFrame(x)}}const zo=yo,Sg=ig,Cg=sg,Og=rg,Ag=ag,kg=(e,t,n)=>{const r=new Map,o={platform:xg,...n},i={...o.platform,_c:r};return ng(e,t,{...o,platform:i})};var Br=typeof document<"u"?O.useLayoutEffect:O.useEffect;function to(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!to(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!to(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Jc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Aa(e,t){const n=Jc(e);return Math.round(t*n)/n}function Go(e){const t=I.useRef(e);return Br(()=>{t.current=e}),t}function Tg(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[d,h]=I.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=I.useState(r);to(m,r)||f(r);const[x,b]=I.useState(null),[R,$]=I.useState(null),w=I.useCallback(y=>{y!==j.current&&(j.current=y,b(y))},[]),T=I.useCallback(y=>{y!==W.current&&(W.current=y,$(y))},[]),N=i||x,D=s||R,j=I.useRef(null),W=I.useRef(null),u=I.useRef(d),p=l!=null,g=Go(l),C=Go(o),S=Go(c),A=I.useCallback(()=>{if(!j.current||!W.current)return;const y={placement:t,strategy:n,middleware:m};C.current&&(y.platform=C.current),kg(j.current,W.current,y).then(M=>{const B={...M,isPositioned:S.current!==!1};k.current&&!to(u.current,B)&&(u.current=B,Bn.flushSync(()=>{h(B)}))})},[m,t,n,C,S]);Br(()=>{c===!1&&u.current.isPositioned&&(u.current.isPositioned=!1,h(y=>({...y,isPositioned:!1})))},[c]);const k=I.useRef(!1);Br(()=>(k.current=!0,()=>{k.current=!1}),[]),Br(()=>{if(N&&(j.current=N),D&&(W.current=D),N&&D){if(g.current)return g.current(N,D,A);A()}},[N,D,A,g,p]);const v=I.useMemo(()=>({reference:j,floating:W,setReference:w,setFloating:T}),[w,T]),E=I.useMemo(()=>({reference:N,floating:D}),[N,D]),F=I.useMemo(()=>{const y={position:n,left:0,top:0};if(!E.floating)return y;const M=Aa(E.floating,d.x),B=Aa(E.floating,d.y);return a?{...y,transform:"translate("+M+"px, "+B+"px)",...Jc(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:B}},[n,a,E.floating,d.x,d.y]);return I.useMemo(()=>({...d,update:A,refs:v,elements:E,floatingStyles:F}),[d,A,v,E,F])}const Zc=(e,t)=>({...Sg(e),options:[e,t]}),Fg=(e,t)=>({...Cg(e),options:[e,t]}),Pg=(e,t)=>({...Og(e),options:[e,t]}),$g=(e,t)=>({...Ag(e),options:[e,t]}),eu={...I},Mg=eu.useInsertionEffect,Ig=Mg||(e=>e());function tu(e){const t=I.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Ig(()=>{t.current=e}),I.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var $i=typeof document<"u"?O.useLayoutEffect:O.useEffect;let ka=!1,Dg=0;const Ta=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Dg++;function Ng(){const[e,t]=I.useState(()=>ka?Ta():void 0);return $i(()=>{e==null&&t(Ta())},[]),I.useEffect(()=>{ka=!0},[]),e}const Lg=eu.useId,jg=Lg||Ng;let lr;process.env.NODE_ENV!=="production"&&(lr=new Set);function Bg(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=lr)!=null&&e.has(o))){var i;(i=lr)==null||i.add(o),console.warn(o)}}function Hg(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=lr)!=null&&e.has(o))){var i;(i=lr)==null||i.add(o),console.error(o)}}function Wg(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const Ug=I.createContext(null),Vg=I.createContext(null),qg=()=>{var e;return((e=I.useContext(Ug))==null?void 0:e.id)||null},zg=()=>I.useContext(Vg),Gg="data-floating-ui-focusable";function _g(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=jg(),i=I.useRef({}),[s]=I.useState(()=>Wg()),a=qg()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!Ae(f)&&Hg("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[l,c]=I.useState(r.reference),d=tu((f,x,b)=>{i.current.openEvent=f?x:void 0,s.emit("openchange",{open:f,event:x,reason:b,nested:a}),n==null||n(f,x,b)}),h=I.useMemo(()=>({setPositionReference:c}),[]),m=I.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return I.useMemo(()=>({dataRef:i,open:t,onOpenChange:d,elements:m,events:s,floatingId:o,refs:h}),[t,d,m,s,o,h])}function Qg(e){e===void 0&&(e={});const{nodeId:t}=e,n=_g({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,s]=I.useState(null),[a,l]=I.useState(null),d=(o==null?void 0:o.domReference)||i,h=I.useRef(null),m=zg();$i(()=>{d&&(h.current=d)},[d]);const f=Tg({...e,elements:{...o,...a&&{reference:a}}}),x=I.useCallback(T=>{const N=Ae(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;l(N),f.refs.setReference(N)},[f.refs]),b=I.useCallback(T=>{(Ae(T)||T===null)&&(h.current=T,s(T)),(Ae(f.refs.reference.current)||f.refs.reference.current===null||T!==null&&!Ae(T))&&f.refs.setReference(T)},[f.refs]),R=I.useMemo(()=>({...f.refs,setReference:b,setPositionReference:x,domReference:h}),[f.refs,b,x]),$=I.useMemo(()=>({...f.elements,domReference:d}),[f.elements,d]),w=I.useMemo(()=>({...f,...r,refs:R,elements:$,nodeId:t}),[f,R,$,t,r]);return $i(()=>{r.dataRef.current.floatingContext=w;const T=m==null?void 0:m.nodesRef.current.find(N=>N.id===t);T&&(T.context=w)}),I.useMemo(()=>({...f,context:w,refs:R,elements:$}),[f,R,$,w])}const Fa="active",Pa="selected";function _o(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[Fa]:s,[Pa]:a,...l}=e;i=l}return{...n==="floating"&&{tabIndex:-1,[Gg]:""},...i,...t.map(s=>{const a=s?s[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((s,a)=>(a&&Object.entries(a).forEach(l=>{let[c,d]=l;if(!(o&&[Fa,Pa].includes(c)))if(c.indexOf("on")===0){if(r.has(c)||r.set(c,[]),typeof d=="function"){var h;(h=r.get(c))==null||h.push(d),s[c]=function(){for(var m,f=arguments.length,x=new Array(f),b=0;b<f;b++)x[b]=arguments[b];return(m=r.get(c))==null?void 0:m.map(R=>R(...x)).find(R=>R!==void 0)}}}else s[c]=d}),s),{})}}function Kg(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),o=I.useCallback(a=>_o(a,e,"reference"),t),i=I.useCallback(a=>_o(a,e,"floating"),n),s=I.useCallback(a=>_o(a,e,"item"),r);return I.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}function $a(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Yg=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:i=0,index:s=0,minItemsVisible:a=4,referenceOverflowThreshold:l=0,scrollRef:c,...d}=_n(e,t),{rects:h,elements:{floating:m}}=t,f=n.current[s],x=(c==null?void 0:c.current)||m,b=m.clientTop||x.clientTop,R=m.clientTop!==0,$=x.clientTop!==0,w=m===x;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Bg('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const T={...t,...await Zc(-f.offsetTop-m.clientTop-h.reference.height/2-f.offsetHeight/2-i).fn(t)},N=await zo($a(T,x.scrollHeight+b+m.clientTop),d),D=await zo(T,{...d,elementContext:"reference"}),j=Oe(0,N.top),W=T.y+j,g=(x.scrollHeight>x.clientHeight?C=>C:ar)(Oe(0,x.scrollHeight+(R&&w||$?b*2:0)-j-Oe(0,N.bottom)));if(x.style.maxHeight=g+"px",x.scrollTop=j,o){const C=x.offsetHeight<f.offsetHeight*pn(a,n.current.length)-1||D.top>=-l||D.bottom>=-l;Bn.flushSync(()=>o(C))}return r&&(r.current=await zo($a({...T,y:W},x.offsetHeight+b+m.clientTop),d)),{y:W}}});function Xg(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:s,onChange:a}=t,l=tu(a),c=I.useRef(!1),d=I.useRef(null),h=I.useRef(null);I.useEffect(()=>{if(!o)return;function f(b){if(b.ctrlKey||!x||i.current==null)return;const R=b.deltaY,$=i.current.top>=-.5,w=i.current.bottom>=-.5,T=x.scrollHeight-x.clientHeight,N=R<0?-1:1,D=R<0?"max":"min";x.scrollHeight<=x.clientHeight||(!$&&R>0||!w&&R<0?(b.preventDefault(),Bn.flushSync(()=>{l(j=>j+Math[D](R,T*N))})):/firefox/i.test(_m())&&(x.scrollTop+=R))}const x=(s==null?void 0:s.current)||r.floating;if(n&&x)return x.addEventListener("wheel",f),requestAnimationFrame(()=>{d.current=x.scrollTop,i.current!=null&&(h.current={...i.current})}),()=>{d.current=null,h.current=null,x.removeEventListener("wheel",f)}},[o,n,r.floating,i,s,l]);const m=I.useMemo(()=>({onKeyDown(){c.current=!0},onWheel(){c.current=!1},onPointerMove(){c.current=!1},onScroll(){const f=(s==null?void 0:s.current)||r.floating;if(!(!i.current||!f||!c.current)){if(d.current!==null){const x=f.scrollTop-d.current;(i.current.bottom<-.5&&x<-1||i.current.top<-.5&&x>1)&&Bn.flushSync(()=>l(b=>b+x))}requestAnimationFrame(()=>{d.current=f.scrollTop})}}}),[r.floating,l,i,s]);return I.useMemo(()=>o?{floating:m}:{},[o,m])}let Qn=O.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Qn.displayName="FloatingContext";let ss=O.createContext(null);ss.displayName="PlacementContext";function Jg(e){return O.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function Zg(){return O.useContext(Qn).setReference}function ev(){return O.useContext(Qn).getReferenceProps}function tv(){let{getFloatingProps:e,slot:t}=O.useContext(Qn);return O.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function nv(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=O.useContext(ss),n=O.useMemo(()=>e,[JSON.stringify(e,(o,i)=>{var s;return(s=i==null?void 0:i.outerHTML)!=null?s:i})]);xe(()=>{t==null||t(n??null)},[t,n]);let r=O.useContext(Qn);return O.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Ma=4;function rv({children:e,enabled:t=!0}){let[n,r]=O.useState(null),[o,i]=O.useState(0),s=O.useRef(null),[a,l]=O.useState(null);ov(a);let c=t&&n!==null&&a!==null,{to:d="bottom",gap:h=0,offset:m=0,padding:f=0,inner:x}=iv(n,a),[b,R="center"]=d.split(" ");xe(()=>{c&&i(0)},[c]);let{refs:$,floatingStyles:w,context:T}=Qg({open:c,placement:b==="selection"?R==="center"?"bottom":`bottom-${R}`:R==="center"?`${b}`:`${b}-${R}`,strategy:"absolute",transform:!1,middleware:[Zc({mainAxis:b==="selection"?0:h,crossAxis:m}),Fg({padding:f}),b!=="selection"&&Pg({padding:f}),b==="selection"&&x?Yg({...x,padding:f,overflowRef:s,offset:o,minItemsVisible:Ma,referenceOverflowThreshold:f,onFallbackChange(C){var S,A;if(!C)return;let k=T.elements.floating;if(!k)return;let v=parseFloat(getComputedStyle(k).scrollPaddingBottom)||0,E=Math.min(Ma,k.childElementCount),F=0,y=0;for(let M of(A=(S=T.elements.floating)==null?void 0:S.childNodes)!=null?A:[])if(St(M)){let B=M.offsetTop,V=B+M.clientHeight+v,H=k.scrollTop,_=H+k.clientHeight;if(B>=H&&V<=_)E--;else{y=Math.max(0,Math.min(V,_)-Math.max(B,H)),F=M.clientHeight;break}}E>=1&&i(M=>{let B=F*E-y+v;return M>=B?M:B})}}):null,$g({padding:f,apply({availableWidth:C,availableHeight:S,elements:A}){Object.assign(A.floating.style,{overflow:"auto",maxWidth:`${C}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${S}px)`})}})].filter(Boolean),whileElementsMounted:Rg}),[N=b,D=R]=T.placement.split("-");b==="selection"&&(N="selection");let j=O.useMemo(()=>({anchor:[N,D].filter(Boolean).join(" ")}),[N,D]),W=Xg(T,{overflowRef:s,onChange:i}),{getReferenceProps:u,getFloatingProps:p}=Kg([W]),g=ce(C=>{l(C),$.setFloating(C)});return I.createElement(ss.Provider,{value:r},I.createElement(Qn.Provider,{value:{setFloating:g,setReference:$.setReference,styles:w,getReferenceProps:u,getFloatingProps:p,slot:j}},e))}function ov(e){xe(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function iv(e,t){var n,r,o;let i=Qo((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),s=Qo((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),a=Qo((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:i,offset:s,padding:a}}function Qo(e,t,n=void 0){let r=yr(),o=ce((l,c)=>{if(l==null)return[n,null];if(typeof l=="number")return[l,null];if(typeof l=="string"){if(!c)return[n,null];let d=Ia(l,c);return[d,h=>{let m=nu(l);{let f=m.map(x=>window.getComputedStyle(c).getPropertyValue(x));r.requestAnimationFrame(function x(){r.nextFrame(x);let b=!1;for(let[$,w]of m.entries()){let T=window.getComputedStyle(c).getPropertyValue(w);if(f[$]!==T){f[$]=T,b=!0;break}}if(!b)return;let R=Ia(l,c);d!==R&&(h(R),d=R)})}return r.dispose}]}return[n,null]}),i=O.useMemo(()=>o(e,t)[0],[e,t]),[s=i,a]=O.useState();return xe(()=>{let[l,c]=o(e,t);if(a(l),!!c)return c(a)},[e,t]),s}function nu(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...nu(o)]:[r]}return[]}function Ia(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function sv(e,t){let[n,r]=O.useState(t);return!e&&n!==t&&r(t),e?n:t}let as=O.createContext(null);as.displayName="OpenClosedContext";var cr=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(cr||{});function av(){return O.useContext(as)}function lv({value:e,children:t}){return O.createElement(as.Provider,{value:e},t)}function cv(e){throw new Error("Unexpected object: "+e)}var ue=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ue||{});function Lr(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let i=0;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 1:{o===-1&&(o=n.length);for(let i=o-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 2:{for(let i=o+1;i<n.length;++i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 3:{for(let i=n.length-1;i>=0;--i)if(!t.resolveDisabled(n[i],i,n))return i;return r}case 4:{for(let i=0;i<n.length;++i)if(t.resolveId(n[i],i,n)===e.id)return i;return r}case 5:return null;default:cv(e)}}function ru(e){let t=ce(e),n=O.useRef(!1);O.useEffect(()=>(n.current=!1,()=>{n.current=!0,mc(()=>{n.current&&t()})}),[t])}function uv(){let e=typeof document>"u";return"useSyncExternalStore"in I?(t=>t.useSyncExternalStore)(I)(()=>()=>{},()=>!1,()=>!e):!1}function fv(){let e=uv(),[t,n]=I.useState(cn.isHandoffComplete);return t&&cn.isHandoffComplete===!1&&n(!1),I.useEffect(()=>{t!==!0&&n(!0)},[t]),I.useEffect(()=>cn.handoff(),[]),e?!1:t}let dv=O.createContext(!1);function hv(){return O.useContext(dv)}function pv(e){let t=hv(),n=O.useContext(iu),[r,o]=O.useState(()=>{var i;if(!t&&n!==null)return(i=n.current)!=null?i:null;if(cn.isServer)return null;let s=e==null?void 0:e.getElementById("headlessui-portal-root");if(s)return s;if(e===null)return null;let a=e.createElement("div");return a.setAttribute("id","headlessui-portal-root"),e.body.appendChild(a)});return O.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),O.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let ou=O.Fragment,mv=et(function(e,t){let{ownerDocument:n=null,...r}=e,o=O.useRef(null),i=ht(Hp(f=>{o.current=f}),t),s=Ti(o),a=n??s,l=pv(a),[c]=O.useState(()=>{var f;return cn.isServer?null:(f=a==null?void 0:a.createElement("div"))!=null?f:null}),d=O.useContext(yv),h=fv();xe(()=>{!l||!c||l.contains(c)||(c.setAttribute("data-headlessui-portal",""),l.appendChild(c))},[l,c]),xe(()=>{if(c&&d)return d.register(c)},[d,c]),ru(()=>{var f;!l||!c||(Ji(c)&&l.contains(c)&&l.removeChild(c),l.childNodes.length<=0&&((f=l.parentElement)==null||f.removeChild(l)))});let m=Ze();return h?!l||!c?null:Bt.createPortal(m({ourProps:{ref:i},theirProps:r,slot:{},defaultTag:ou,name:"Portal"}),c):null});function gv(e,t){let n=ht(t),{enabled:r=!0,ownerDocument:o,...i}=e,s=Ze();return r?O.createElement(mv,{...i,ownerDocument:o,ref:n}):s({ourProps:{ref:n},theirProps:i,slot:{},defaultTag:ou,name:"Portal"})}let vv=O.Fragment,iu=O.createContext(null);function bv(e,t){let{target:n,...r}=e,o={ref:ht(t)},i=Ze();return O.createElement(iu.Provider,{value:n},i({ourProps:o,theirProps:r,defaultTag:vv,name:"Popover.Group"}))}let yv=O.createContext(null),wv=et(gv),xv=et(bv),Ev=Object.assign(wv,{Group:xv});function Rv(e,t){let n=O.useRef({left:0,top:0});if(xe(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let Da=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Na(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!St(o))return r;let i=!1;for(let a of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),i=!0;let s=i?(n=o.innerText)!=null?n:"":r;return Da.test(s)&&(s=s.replace(Da,"")),s}function Sv(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let i=document.getElementById(o);if(i){let s=i.getAttribute("aria-label");return typeof s=="string"?s.trim():Na(i).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return Na(e).trim()}function Cv(e){let t=O.useRef(""),n=O.useRef("");return ce(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let i=Sv(r).trim().toLowerCase();return t.current=o,n.current=i,i})}var Ov=Object.defineProperty,Av=(e,t,n)=>t in e?Ov(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,La=(e,t,n)=>(Av(e,typeof t!="symbol"?t+"":t,n),n),we=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(we||{}),at=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(at||{}),Mi=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Mi||{}),su=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(su||{});function ja(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Bc(t(e.options.slice()),i=>i.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let kv={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ue.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(i=>r(i.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,i,s;if(e.dataRef.current.disabled||e.listboxState===1)return e;let a={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ue.Nothing)return{...a,activeOptionIndex:null};if(t.focus===ue.Specific)return{...a,activeOptionIndex:e.options.findIndex(d=>d.id===t.id)};if(t.focus===ue.Previous){let d=e.activeOptionIndex;if(d!==null){let h=e.options[d].dataRef.current.domRef,m=Lr(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((r=h.current)==null?void 0:r.previousElementSibling)===f.current||((o=f.current)==null?void 0:o.previousElementSibling)===null)return{...a,activeOptionIndex:m}}}}else if(t.focus===ue.Next){let d=e.activeOptionIndex;if(d!==null){let h=e.options[d].dataRef.current.domRef,m=Lr(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((i=h.current)==null?void 0:i.nextElementSibling)===f.current||((s=f.current)==null?void 0:s.nextElementSibling)===null)return{...a,activeOptionIndex:m}}}}let l=ja(e),c=Lr(t,{resolveItems:()=>l.options,resolveActiveIndex:()=>l.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});return{...a,...l,activeOptionIndex:c}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(s=>{var a;return!s.dataRef.current.disabled&&((a=s.dataRef.current.textValue)==null?void 0:a.startsWith(r))}),i=o?e.options.indexOf(o):-1;return i===-1||i===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:i,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ue.Nothing&&(r=Lr(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let i=n.findIndex(s=>o==null?void 0:o(s.dataRef.current.value));i!==-1&&(r=i)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ue.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[i,s]of n.entries())if(o.has(s.id)&&(r.push(i),o.delete(s.id),o.size===0))break;if(r.length>0){n=n.slice();for(let i of r.reverse())n.splice(i,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...ja(e),pendingShouldSort:!1}:e};class ls extends $c{constructor(t){super(t),La(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:i,value:s}=this.state.dataRef.current;return ut(i,{0:()=>r==null?void 0:r(n),1:()=>{let a=s.slice(),l=a.findIndex(c=>o(c,n));return l===-1?a.push(n):a.splice(l,1),r==null?void 0:r(a)}})},registerOption:Wo(()=>{let n=[],r=new Set;return[(o,i)=>{r.has(i)||(r.add(i),n.push({id:o,dataRef:i}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:Wo(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:Wo(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:ue.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),La(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,i=n.options;return o===null||(r=i[o])==null?void 0:r.id},isActive(n,r){var o;let i=n.activeOptionIndex,s=n.options;return i!==null?((o=s[i])==null?void 0:o.id)===r:!1},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=es.get(null);this.disposables.add(r.on(Ic.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new ls({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ue.Nothing},__demoMode:n})}reduce(t,n){return ut(n.type,kv,t,n)}}const au=O.createContext(null);function cs(e){let t=O.useContext(au);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,lu),n}return t}function lu({id:e,__demoMode:t=!1}){let n=O.useMemo(()=>ls.new({id:e,__demoMode:t}),[]);return ru(()=>n.dispose()),n}let wo=O.createContext(null);wo.displayName="ListboxDataContext";function Er(e){let t=O.useContext(wo);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Er),n}return t}let Tv=O.Fragment;function Fv(e,t){let n=O.useId(),r=Yi(),{value:o,defaultValue:i,form:s,name:a,onChange:l,by:c,invalid:d=!1,disabled:h=r||!1,horizontal:m=!1,multiple:f=!1,__demoMode:x=!1,...b}=e;const R=m?"horizontal":"vertical";let $=ht(t),w=Cp(i),[T=f?[]:void 0,N]=Sp(o,l,w),D=lu({id:n,__demoMode:x}),j=O.useRef({static:!1,hold:!1}),W=O.useRef(new Map),u=Yp(c),p=O.useCallback(H=>ut(g.mode,{[at.Multi]:()=>T.some(_=>u(_,H)),[at.Single]:()=>u(T,H)}),[T]),g=O.useMemo(()=>({value:T,disabled:h,invalid:d,mode:f?at.Multi:at.Single,orientation:R,onChange:N,compare:u,isSelected:p,optionsPropsRef:j,listRef:W}),[T,h,d,f,R,N,u,p,j,W]);xe(()=>{D.state.dataRef.current=g},[g]);let C=qe(D,H=>H.listboxState),S=es.get(null),A=qe(S,O.useCallback(H=>S.selectors.isTop(H,n),[S,n])),[k,v]=qe(D,H=>[H.buttonElement,H.optionsElement]);Sm(A,[k,v],(H,_)=>{D.send({type:su.CloseListbox}),jc(_,ts.Loose)||(H.preventDefault(),k==null||k.focus())});let E=O.useMemo(()=>({open:C===we.Open,disabled:h,invalid:d,value:T}),[C,h,d,T]),[F,y]=zp({inherit:!0}),M={ref:$},B=O.useCallback(()=>{if(w!==void 0)return N==null?void 0:N(w)},[N,w]),V=Ze();return O.createElement(y,{value:F,props:{htmlFor:k==null?void 0:k.id},slot:{open:C===we.Open,disabled:h}},O.createElement(rv,null,O.createElement(au.Provider,{value:D},O.createElement(wo.Provider,{value:g},O.createElement(lv,{value:ut(C,{[we.Open]:cr.Open,[we.Closed]:cr.Closed})},a!=null&&T!=null&&O.createElement(Pp,{disabled:h,data:{[a]:T},form:s,onReset:B}),V({ourProps:M,theirProps:b,slot:E,defaultTag:Tv,name:"Listbox"}))))))}let Pv="button";function $v(e,t){let n=O.useId(),r=Ec(),o=Er("Listbox.Button"),i=cs("Listbox.Button"),{id:s=r||`headlessui-listbox-button-${n}`,disabled:a=o.disabled||!1,autoFocus:l=!1,...c}=e,d=ht(t,Zg(),i.actions.setButtonElement),h=ev(),[m,f,x]=qe(i,v=>[v.listboxState,v.buttonElement,v.optionsElement]),b=m===we.Open;Am(b,{trigger:f,action:O.useCallback(v=>{if(f!=null&&f.contains(v.target))return Dr.Ignore;let E=v.target.closest('[role="option"]:not([data-disabled])');return St(E)?Dr.Select(E):x!=null&&x.contains(v.target)?Dr.Ignore:Dr.Close},[f,x]),close:i.actions.closeListbox,select:i.actions.selectActiveOption});let R=ce(v=>{switch(v.key){case ye.Enter:Op(v.currentTarget);break;case ye.Space:case ye.ArrowDown:v.preventDefault(),i.actions.openListbox({focus:o.value?ue.Nothing:ue.First});break;case ye.ArrowUp:v.preventDefault(),i.actions.openListbox({focus:o.value?ue.Nothing:ue.Last});break}}),$=ce(v=>{switch(v.key){case ye.Space:v.preventDefault();break}}),w=ce(v=>{var E;if(v.button===0){if(jp(v.currentTarget))return v.preventDefault();i.state.listboxState===we.Open?(Bt.flushSync(()=>i.actions.closeListbox()),(E=i.state.buttonElement)==null||E.focus({preventScroll:!0})):(v.preventDefault(),i.actions.openListbox({focus:ue.Nothing}))}}),T=ce(v=>v.preventDefault()),N=kc([s]),D=Wp(),{isFocusVisible:j,focusProps:W}=fp({autoFocus:l}),{isHovered:u,hoverProps:p}=up({isDisabled:a}),{pressed:g,pressProps:C}=vp({disabled:a}),S=O.useMemo(()=>({open:m===we.Open,active:g||m===we.Open,disabled:a,invalid:o.invalid,value:o.value,hover:u,focus:j,autofocus:l}),[m,o.value,a,u,j,g,o.invalid,l]),A=qe(i,v=>v.listboxState===we.Open),k=vc(h(),{ref:d,id:s,type:km(e,f),"aria-haspopup":"listbox","aria-controls":x==null?void 0:x.id,"aria-expanded":A,"aria-labelledby":N,"aria-describedby":D,disabled:a||void 0,autoFocus:l,onKeyDown:R,onKeyUp:$,onKeyPress:T,onPointerDown:w},W,p,C);return Ze()({ourProps:k,theirProps:c,slot:S,defaultTag:Pv,name:"Listbox.Button"})}let cu=O.createContext(!1),Mv="div",Iv=Ci.RenderStrategy|Ci.Static;function Dv(e,t){let n=O.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:i=!1,modal:s=!0,transition:a=!1,...l}=e,c=Jg(o),[d,h]=O.useState(null);c&&(i=!0);let m=Er("Listbox.Options"),f=cs("Listbox.Options"),[x,b,R,$]=qe(f,U=>[U.listboxState,U.buttonElement,U.optionsElement,U.__demoMode]),w=Ti(b),T=Ti(R),N=av(),[D,j]=Wm(a,d,N!==null?(N&cr.Open)===cr.Open:x===we.Open);dm(D,b,f.actions.closeListbox);let W=$?!1:s&&x===we.Open;Nm(W,T);let u=$?!1:s&&x===we.Open;fm(u,{allowed:O.useCallback(()=>[b,R],[b,R])});let p=x!==we.Open,g=Rv(p,b)?!1:D,C=D&&x===we.Closed,S=sv(C,m.value),A=ce(U=>m.compare(S,U)),k=qe(f,U=>{var ae;if(c==null||!((ae=c==null?void 0:c.to)!=null&&ae.includes("selection")))return null;let ge=U.options.findIndex(Ee=>A(Ee.dataRef.current.value));return ge===-1&&(ge=0),ge}),v=(()=>{if(c==null)return;if(k===null)return{...c,inner:void 0};let U=Array.from(m.listRef.current.values());return{...c,inner:{listRef:{current:U},index:k}}})(),[E,F]=nv(v),y=tv(),M=ht(t,c?E:null,f.actions.setOptionsElement,h),B=yr();O.useEffect(()=>{var U;let ae=R;ae&&x===we.Open&&ae!==((U=br(ae))==null?void 0:U.activeElement)&&(ae==null||ae.focus({preventScroll:!0}))},[x,R]);let V=ce(U=>{var ae,ge;switch(B.dispose(),U.key){case ye.Space:if(f.state.searchQuery!=="")return U.preventDefault(),U.stopPropagation(),f.actions.search(U.key);case ye.Enter:if(U.preventDefault(),U.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:Ee}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(Ee.current.value)}m.mode===at.Single&&(Bt.flushSync(()=>f.actions.closeListbox()),(ae=f.state.buttonElement)==null||ae.focus({preventScroll:!0}));break;case ut(m.orientation,{vertical:ye.ArrowDown,horizontal:ye.ArrowRight}):return U.preventDefault(),U.stopPropagation(),f.actions.goToOption({focus:ue.Next});case ut(m.orientation,{vertical:ye.ArrowUp,horizontal:ye.ArrowLeft}):return U.preventDefault(),U.stopPropagation(),f.actions.goToOption({focus:ue.Previous});case ye.Home:case ye.PageUp:return U.preventDefault(),U.stopPropagation(),f.actions.goToOption({focus:ue.First});case ye.End:case ye.PageDown:return U.preventDefault(),U.stopPropagation(),f.actions.goToOption({focus:ue.Last});case ye.Escape:U.preventDefault(),U.stopPropagation(),Bt.flushSync(()=>f.actions.closeListbox()),(ge=f.state.buttonElement)==null||ge.focus({preventScroll:!0});return;case ye.Tab:U.preventDefault(),U.stopPropagation(),Bt.flushSync(()=>f.actions.closeListbox()),wm(f.state.buttonElement,U.shiftKey?ki.Previous:ki.Next);break;default:U.key.length===1&&(f.actions.search(U.key),B.setTimeout(()=>f.actions.clearSearch(),350));break}}),H=qe(f,U=>{var ae;return(ae=U.buttonElement)==null?void 0:ae.id}),_=O.useMemo(()=>({open:x===we.Open}),[x]),ee=vc(c?y():{},{id:r,ref:M,"aria-activedescendant":qe(f,f.selectors.activeDescendantId),"aria-multiselectable":m.mode===at.Multi?!0:void 0,"aria-labelledby":H,"aria-orientation":m.orientation,onKeyDown:V,role:"listbox",tabIndex:x===we.Open?0:void 0,style:{...l.style,...F,"--button-width":Jp(b,!0).width},...Hm(j)}),Z=Ze(),Y=O.useMemo(()=>m.mode===at.Multi?m:{...m,isSelected:A},[m,A]);return O.createElement(Ev,{enabled:i?e.static||D:!1,ownerDocument:w},O.createElement(wo.Provider,{value:Y},Z({ourProps:ee,theirProps:l,slot:_,defaultTag:Mv,features:Iv,visible:g,name:"Listbox.Options"})))}let Nv="div";function Lv(e,t){let n=O.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:i,...s}=e,a=O.useContext(cu)===!0,l=Er("Listbox.Option"),c=cs("Listbox.Option"),d=qe(c,g=>c.selectors.isActive(g,r)),h=l.isSelected(i),m=O.useRef(null),f=Cv(m),x=zn({disabled:o,value:i,domRef:m,get textValue(){return f()}}),b=ht(t,m,g=>{g?l.listRef.current.set(r,g):l.listRef.current.delete(r)}),R=qe(c,g=>c.selectors.shouldScrollIntoView(g,r));xe(()=>{if(R)return Je().requestAnimationFrame(()=>{var g,C;(C=(g=m.current)==null?void 0:g.scrollIntoView)==null||C.call(g,{block:"nearest"})})},[R,m]),xe(()=>{if(!a)return c.actions.registerOption(r,x),()=>c.actions.unregisterOption(r)},[x,r,a]);let $=ce(g=>{var C;if(o)return g.preventDefault();c.actions.onChange(i),l.mode===at.Single&&(Bt.flushSync(()=>c.actions.closeListbox()),(C=c.state.buttonElement)==null||C.focus({preventScroll:!0}))}),w=ce(()=>{if(o)return c.actions.goToOption({focus:ue.Nothing});c.actions.goToOption({focus:ue.Specific,id:r})}),T=Lm(),N=ce(g=>{T.update(g),!o&&(d||c.actions.goToOption({focus:ue.Specific,id:r},Mi.Pointer))}),D=ce(g=>{T.wasMoved(g)&&(o||d||c.actions.goToOption({focus:ue.Specific,id:r},Mi.Pointer))}),j=ce(g=>{T.wasMoved(g)&&(o||d&&c.actions.goToOption({focus:ue.Nothing}))}),W=O.useMemo(()=>({active:d,focus:d,selected:h,disabled:o,selectedOption:h&&a}),[d,h,o,a]),u=a?{}:{id:r,ref:b,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":h,disabled:void 0,onClick:$,onFocus:w,onPointerEnter:N,onMouseEnter:N,onPointerMove:D,onMouseMove:D,onPointerLeave:j,onMouseLeave:j},p=Ze();return!h&&a?null:p({ourProps:u,theirProps:s,slot:W,defaultTag:Nv,name:"Listbox.Option"})}let jv=O.Fragment;function Bv(e,t){let{options:n,placeholder:r,...o}=e,i={ref:ht(t)},s=Er("ListboxSelectedOption"),a=O.useMemo(()=>({}),[]),l=s.value===void 0||s.value===null||s.mode===at.Multi&&Array.isArray(s.value)&&s.value.length===0,c=Ze();return O.createElement(cu.Provider,{value:!0},c({ourProps:i,theirProps:{...o,children:O.createElement(O.Fragment,null,r&&l?r:n)},slot:a,defaultTag:jv,name:"ListboxSelectedOption"}))}let Hv=et(Fv),uu=et($v),Wv=Tc,fu=et(Dv),du=et(Lv),Uv=et(Bv),Vv=Object.assign(Hv,{Button:uu,Label:Wv,Options:fu,Option:du,SelectedOption:Uv});function hu(e={}){const{activeAddress:t,algodClient:n}=xt.useWallet(),{enabled:r=!0}=e;return Vi({queryKey:["account-info",t],queryFn:async()=>{if(!t||!n)return null;try{return await n.accountInformation(t).do()}catch(o){throw new Error(`Error fetching account information: ${o}`)}},enabled:r&&!!t&&!!n,refetchOnWindowFocus:!0})}function qv({className:e,scale:t=.85}){return L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:En("inline-block align-baseline",e),style:{width:`${t}em`,height:`${t}em`},"aria-label":"Algorand",fill:"currentColor",children:L.jsx("path",{d:"M23.98 23.99h-3.75l-2.44-9.07-5.25 9.07H8.34l8.1-14.04-1.3-4.88L4.22 24H.02L13.88 0h3.67l1.61 5.96h3.79l-2.59 4.5 3.62 13.53z"})})}function zv({children:e}){var v;const{activeAddress:t,activeWallet:n}=xt.useWallet(),{theme:r}=uo(),[o,i]=O.useState(!1),[s,a]=O.useState(!1),[l,c]=O.useState(()=>{const E=localStorage.getItem("uwui:balance-preference");return E?E==="available":!1}),d=r==="system"?void 0:r,h=qi({enabled:!!t}),m=((v=h.data)==null?void 0:v.name)??null,{data:f}=hu({enabled:!!t}),x=O.useMemo(()=>!f||f.amount===void 0?null:Number(f.amount)/1e6,[f]),b=O.useMemo(()=>{if(!f||f.amount===void 0||f.minBalance===void 0)return null;const E=Number(f.amount)-Number(f.minBalance);return Math.max(0,E/1e6)},[f]),R=l?b:x,{refs:$,floatingStyles:w,context:T}=Hl({open:o,onOpenChange:i,placement:"bottom-end",middleware:[Sd(8),Od(),Cd()],whileElementsMounted:gd}),N=jl(T),D=Bl(T,{outsidePressEvent:"mousedown"}),{getReferenceProps:j,getFloatingProps:W}=Wl([N,D]),u=Wn(),p=()=>{t&&(navigator.clipboard.writeText(t),a(!0),setTimeout(()=>a(!1),2e3))},g=async()=>{if(n)try{await n.disconnect(),i(!1)}catch(E){console.error("Error disconnecting wallet:",E)}},C=E=>{n&&n.setActiveAccount&&n.setActiveAccount(E)},S=()=>{const E=!l;c(E),localStorage.setItem("uwui:balance-preference",E?"available":"total")},A=e||L.jsx(fo,{}),k=O.cloneElement(A,j({ref:$.setReference}));return L.jsxs(L.Fragment,{children:[k,o&&L.jsx(Dl,{children:L.jsx(Ll,{context:T,modal:!1,children:L.jsx("div",{"data-wallet-ui":!0,"data-wallet-ui-scope":!0,"data-theme":d,children:L.jsx("div",{ref:$.setFloating,style:w,...W(),"aria-labelledby":u,className:"z-50 w-80 rounded-xl bg-[var(--wui-color-bg)] shadow-xl border border-[var(--wui-color-border)]",children:L.jsxs("div",{className:"p-4",children:[L.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[L.jsx("div",{className:"h-12 w-12 overflow-hidden",children:L.jsx(zi,{nfd:h.data,alt:`${m||t} avatar`,size:48})}),L.jsxs("div",{children:[L.jsx("h3",{id:u,className:"text-lg font-bold text-[var(--wui-color-text)] max-w-[220px] truncate wallet-custom-font",children:m||(t?Xn(t,6,4):"My Wallet")}),m&&t&&L.jsx("p",{className:"text-sm text-[var(--wui-color-text-secondary)]",children:Xn(t,6,4)})]})]}),L.jsx("div",{className:"mb-4 bg-[var(--wui-color-bg-secondary)] rounded-lg p-3",children:L.jsxs("div",{className:"flex justify-between items-center",children:[R!==null&&L.jsxs("span",{className:"text-base font-medium text-[var(--wui-color-text)] flex items-center gap-1",children:[Wh(R,{fractionDigits:4}),L.jsx(qv,{})]}),L.jsxs("button",{onClick:S,className:"flex items-center gap-1 text-sm text-[var(--wui-color-text-secondary)] bg-[var(--wui-color-bg-tertiary)] py-1 pl-2.5 pr-2 rounded-md hover:brightness-90 transition-all focus:outline-none",title:l?"Show total balance":"Show available balance",children:[l?"Available":"Total",L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"ml-0.5 opacity-80",children:[L.jsx("path",{d:"m17 10-5-5-5 5"}),L.jsx("path",{d:"m17 14-5 5-5-5"})]})]})]})}),n&&n.accounts&&n.accounts.length>1&&L.jsx("div",{className:"mb-4",children:L.jsxs(Vv,{value:t||"",onChange:C,children:[L.jsx(Tc,{className:"block text-sm font-medium text-[var(--wui-color-text-secondary)] mb-1",children:"Select Account"}),L.jsxs("div",{className:"relative mt-1",children:[L.jsxs(uu,{className:"grid w-full cursor-default grid-cols-1 rounded-lg border border-[var(--wui-color-border)] bg-[var(--wui-color-bg-secondary)] py-2 px-3 text-left text-[var(--wui-color-text)] shadow-sm focus:outline-none focus:ring-2 focus:ring-[var(--wui-color-primary)] focus:border-transparent text-sm",children:[L.jsx("span",{className:"col-start-1 row-start-1 truncate pr-8",children:t?Xn(t,6,4):"Select account"}),L.jsx("span",{className:"col-start-1 row-start-1 self-center justify-self-end",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"text-[var(--wui-color-text-secondary)]","aria-hidden":"true",children:L.jsx("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),L.jsx(fu,{transition:!0,className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-[var(--wui-color-bg-secondary)] py-1 shadow-lg ring-1 ring-black/5 focus:outline-none text-sm data-[closed]:data-[leave]:opacity-0 data-[leave]:transition data-[leave]:duration-100 data-[leave]:ease-in",children:n.accounts.map(E=>L.jsxs(du,{value:E.address,className:"group relative cursor-default select-none py-2 pl-3 pr-9 text-[var(--wui-color-text)] data-[focus]:bg-[var(--wui-color-bg-hover)] data-[focus]:outline-none",children:[L.jsx("span",{className:"block truncate font-normal group-data-[selected]:font-medium",children:Xn(E.address,6,4)}),L.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-3 text-[var(--wui-color-primary)] group-[&:not([data-selected])]:hidden",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"h-5 w-5","aria-hidden":"true",children:L.jsx("path",{d:"M13.3334 4L6.00008 11.3333L2.66675 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},E.address))})]})]})}),L.jsx("div",{className:"border-t border-[var(--wui-color-border)] mt-2 mb-2"}),n&&L.jsxs("div",{className:"mb-2 flex items-center gap-2 px-1 py-0.5",children:[L.jsx("div",{className:"h-5 w-5 overflow-hidden rounded flex items-center justify-center",children:n.metadata.icon?L.jsx("img",{src:n.metadata.icon,alt:`${n.metadata.name} icon`,className:"max-w-full max-h-full"}):L.jsx("div",{className:"h-5 w-5 rounded-full bg-[var(--wui-color-bg-tertiary)] flex items-center justify-center",children:L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-3 w-3 text-[var(--wui-color-text-tertiary)]",viewBox:"0 0 20 20",fill:"currentColor",children:L.jsx("path",{fillRule:"evenodd",d:"M17 9c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v8c0 .55.45 1 1 1h4c.55 0 1-.45 1-1V9zm-1 0v8h-4V9h4zM8 4c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v13c0 .55.45 1 1 1h4c.55 0 1-.45 1-1V4zM3 3h4v14H3V3z",clipRule:"evenodd"})})})}),L.jsx("p",{className:"text-sm text-[var(--wui-color-text-secondary)]",children:n.metadata.name})]}),L.jsx("div",{className:"border-t border-[var(--wui-color-border)] mb-3 mt-2"}),L.jsxs("div",{className:"flex gap-2",children:[L.jsx("button",{onClick:p,className:"flex-1 py-2 px-4 bg-[var(--wui-color-bg-tertiary)] text-[var(--wui-color-text-secondary)] font-medium rounded-xl hover:brightness-90 transition-all text-sm flex items-center justify-center",title:"Copy address",children:s?L.jsxs(L.Fragment,{children:[L.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-green-500 mr-1.5",viewBox:"0 0 20 20",fill:"currentColor",children:L.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),"Copied"]}):L.jsxs(L.Fragment,{children:[L.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-1.5",viewBox:"0 0 20 20",fill:"currentColor",children:[L.jsx("path",{d:"M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"}),L.jsx("path",{d:"M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z"})]}),"Copy"]})}),L.jsx("button",{onClick:g,className:"flex-1 py-2 px-4 bg-red-100 dark:bg-red-900/40 text-red-700 dark:text-red-300 font-medium rounded-xl hover:bg-red-200 dark:hover:bg-red-800/60 transition-colors text-sm",children:"Disconnect"})]})]})})})})})]})}function pu(e){const{queryClient:t}=uo();return L.jsx(Jl,{client:t,children:L.jsx(zv,{...e})})}function Gv(){const{activeAddress:e}=xt.useWallet();return e?L.jsx(pu,{children:L.jsx(fo,{})}):L.jsx(nc,{})}gu();exports.ConnectWalletButton=Di;exports.ConnectWalletMenu=nc;exports.ConnectedWalletButton=fo;exports.ConnectedWalletMenu=pu;exports.NfdAvatar=zi;exports.WalletButton=Gv;exports.WalletList=tc;exports.WalletUIProvider=jh;exports.useAccountInfo=hu;exports.useNfd=qi;exports.useResolvedTheme=Zl;exports.useWalletUI=uo;
89
89
  //# sourceMappingURL=index.cjs.map