clankie 0.2.2 → 0.2.4

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.
Files changed (40) hide show
  1. package/README.md +17 -16
  2. package/dist/cli.js +301862 -0
  3. package/dist/koffi-216xhpes.node +0 -0
  4. package/dist/koffi-2erktc37.node +0 -0
  5. package/dist/koffi-2rrez93a.node +0 -0
  6. package/dist/koffi-2wv0r22g.node +0 -0
  7. package/dist/koffi-3kae4xj3.node +0 -0
  8. package/dist/koffi-3rkr2zqv.node +0 -0
  9. package/dist/koffi-abxfktv9.node +0 -0
  10. package/dist/koffi-c67c0c5b.node +0 -0
  11. package/dist/koffi-cnf0q0dx.node +0 -0
  12. package/dist/koffi-df38sqz5.node +0 -0
  13. package/dist/koffi-gfbqb3a0.node +0 -0
  14. package/dist/koffi-kjemmmem.node +0 -0
  15. package/dist/koffi-kkrfq9yv.node +0 -0
  16. package/dist/koffi-mzaqwwqy.node +0 -0
  17. package/dist/koffi-q49fgkeq.node +0 -0
  18. package/dist/koffi-q54bk8bf.node +0 -0
  19. package/dist/koffi-x1790w0j.node +0 -0
  20. package/dist/koffi-yxvjwcj6.node +0 -0
  21. package/package.json +8 -7
  22. package/web-ui-dist/_shell.html +2 -2
  23. package/web-ui-dist/assets/{card-BUP-xovx.js → card-Ce8RCN8-.js} +1 -1
  24. package/web-ui-dist/assets/{extensions-DC620Nmx.js → extensions-D-3Wl_TA.js} +1 -1
  25. package/web-ui-dist/assets/{index-DurjG9O_.js → index-ClDMn-6f.js} +1 -1
  26. package/web-ui-dist/assets/{loader-circle-DbOtKfCA.js → loader-circle-CpT1_nns.js} +1 -1
  27. package/web-ui-dist/assets/{main-B2sRcuyZ.js → main-J9rrgTOF.js} +4 -4
  28. package/web-ui-dist/assets/{sessions._sessionId-BJazw9EJ.js → sessions._sessionId-D6gfJDaW.js} +2 -2
  29. package/web-ui-dist/assets/{settings-Bv8oeIho.js → settings-ZDTymG3K.js} +1 -1
  30. package/web-ui-dist/manifest.json +23 -23
  31. package/src/agent.ts +0 -118
  32. package/src/channels/channel.ts +0 -57
  33. package/src/channels/slack.ts +0 -376
  34. package/src/channels/web.ts +0 -1375
  35. package/src/cli.ts +0 -505
  36. package/src/config.ts +0 -261
  37. package/src/daemon.ts +0 -380
  38. package/src/extensions/workspace-jail.ts +0 -171
  39. package/src/service.ts +0 -374
  40. package/src/sessions.ts +0 -262
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-Bv8oeIho.js","assets/card-BUP-xovx.js","assets/loader-circle-DbOtKfCA.js","assets/extensions-DC620Nmx.js","assets/sessions._sessionId-BJazw9EJ.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-ZDTymG3K.js","assets/card-Ce8RCN8-.js","assets/loader-circle-CpT1_nns.js","assets/extensions-D-3Wl_TA.js","assets/sessions._sessionId-D6gfJDaW.js"])))=>i.map(i=>d[i]);
2
2
  function AR(t,o){for(var r=0;r<o.length;r++){const a=o[r];if(typeof a!="string"&&!Array.isArray(a)){for(const l in a)if(l!=="default"&&!(l in t)){const c=Object.getOwnPropertyDescriptor(a,l);c&&Object.defineProperty(t,l,c.get?c:{enumerable:!0,get:()=>a[l]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function DR(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ih={exports:{}},Di={};var sb;function kR(){if(sb)return Di;sb=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.fragment");function r(a,l,c){var f=null;if(c!==void 0&&(f=""+c),l.key!==void 0&&(f=""+l.key),"key"in l){c={};for(var d in l)d!=="key"&&(c[d]=l[d])}else c=l;return l=c.ref,{$$typeof:t,type:a,key:f,ref:l!==void 0?l:null,props:c}}return Di.Fragment=o,Di.jsx=r,Di.jsxs=r,Di}var ab;function zR(){return ab||(ab=1,ih.exports=kR()),ih.exports}var L=zR(),lh={exports:{}},Ue={};var ib;function NR(){if(ib)return Ue;ib=1;var t=Symbol.for("react.transitional.element"),o=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),f=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.iterator;function b(P){return P===null||typeof P!="object"?null:(P=v&&P[v]||P["@@iterator"],typeof P=="function"?P:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,E={};function C(P,X,le){this.props=P,this.context=X,this.refs=E,this.updater=le||x}C.prototype.isReactComponent={},C.prototype.setState=function(P,X){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,X,"setState")},C.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function _(){}_.prototype=C.prototype;function k(P,X,le){this.props=P,this.context=X,this.refs=E,this.updater=le||x}var O=k.prototype=new _;O.constructor=k,w(O,C.prototype),O.isPureReactComponent=!0;var z=Array.isArray;function N(){}var j={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function Y(P,X,le){var re=le.ref;return{$$typeof:t,type:P,key:X,ref:re!==void 0?re:null,props:le}}function $(P,X){return Y(P.type,X,P.props)}function Z(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function V(P){var X={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(le){return X[le]})}var J=/\/+/g;function ne(P,X){return typeof P=="object"&&P!==null&&P.key!=null?V(""+P.key):X.toString(36)}function ae(P){switch(P.status){case"fulfilled":return P.value;case"rejected":throw P.reason;default:switch(typeof P.status=="string"?P.then(N,N):(P.status="pending",P.then(function(X){P.status==="pending"&&(P.status="fulfilled",P.value=X)},function(X){P.status==="pending"&&(P.status="rejected",P.reason=X)})),P.status){case"fulfilled":return P.value;case"rejected":throw P.reason}}throw P}function B(P,X,le,re,ue){var he=typeof P;(he==="undefined"||he==="boolean")&&(P=null);var ve=!1;if(P===null)ve=!0;else switch(he){case"bigint":case"string":case"number":ve=!0;break;case"object":switch(P.$$typeof){case t:case o:ve=!0;break;case y:return ve=P._init,B(ve(P._payload),X,le,re,ue)}}if(ve)return ue=ue(P),ve=re===""?"."+ne(P,0):re,z(ue)?(le="",ve!=null&&(le=ve.replace(J,"$&/")+"/"),B(ue,X,le,"",function(ze){return ze})):ue!=null&&(Z(ue)&&(ue=$(ue,le+(ue.key==null||P&&P.key===ue.key?"":(""+ue.key).replace(J,"$&/")+"/")+ve)),X.push(ue)),1;ve=0;var Me=re===""?".":re+":";if(z(P))for(var fe=0;fe<P.length;fe++)re=P[fe],he=Me+ne(re,fe),ve+=B(re,X,le,he,ue);else if(fe=b(P),typeof fe=="function")for(P=fe.call(P),fe=0;!(re=P.next()).done;)re=re.value,he=Me+ne(re,fe++),ve+=B(re,X,le,he,ue);else if(he==="object"){if(typeof P.then=="function")return B(ae(P),X,le,re,ue);throw X=String(P),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return ve}function H(P,X,le){if(P==null)return P;var re=[],ue=0;return B(P,re,"","",function(he){return X.call(le,he,ue++)}),re}function G(P){if(P._status===-1){var X=P._result;X=X(),X.then(function(le){(P._status===0||P._status===-1)&&(P._status=1,P._result=le)},function(le){(P._status===0||P._status===-1)&&(P._status=2,P._result=le)}),P._status===-1&&(P._status=0,P._result=X)}if(P._status===1)return P._result.default;throw P._result}var ce=typeof reportError=="function"?reportError:function(P){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof P=="object"&&P!==null&&typeof P.message=="string"?String(P.message):String(P),error:P});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",P);return}console.error(P)},W={map:H,forEach:function(P,X,le){H(P,function(){X.apply(this,arguments)},le)},count:function(P){var X=0;return H(P,function(){X++}),X},toArray:function(P){return H(P,function(X){return X})||[]},only:function(P){if(!Z(P))throw Error("React.Children.only expected to receive a single React element child.");return P}};return Ue.Activity=g,Ue.Children=W,Ue.Component=C,Ue.Fragment=r,Ue.Profiler=l,Ue.PureComponent=k,Ue.StrictMode=a,Ue.Suspense=m,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(P){return j.H.useMemoCache(P)}},Ue.cache=function(P){return function(){return P.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(P,X,le){if(P==null)throw Error("The argument must be a React element, but you passed "+P+".");var re=w({},P.props),ue=P.key;if(X!=null)for(he in X.key!==void 0&&(ue=""+X.key),X)!D.call(X,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&X.ref===void 0||(re[he]=X[he]);var he=arguments.length-2;if(he===1)re.children=le;else if(1<he){for(var ve=Array(he),Me=0;Me<he;Me++)ve[Me]=arguments[Me+2];re.children=ve}return Y(P.type,ue,re)},Ue.createContext=function(P){return P={$$typeof:f,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null},P.Provider=P,P.Consumer={$$typeof:c,_context:P},P},Ue.createElement=function(P,X,le){var re,ue={},he=null;if(X!=null)for(re in X.key!==void 0&&(he=""+X.key),X)D.call(X,re)&&re!=="key"&&re!=="__self"&&re!=="__source"&&(ue[re]=X[re]);var ve=arguments.length-2;if(ve===1)ue.children=le;else if(1<ve){for(var Me=Array(ve),fe=0;fe<ve;fe++)Me[fe]=arguments[fe+2];ue.children=Me}if(P&&P.defaultProps)for(re in ve=P.defaultProps,ve)ue[re]===void 0&&(ue[re]=ve[re]);return Y(P,he,ue)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(P){return{$$typeof:d,render:P}},Ue.isValidElement=Z,Ue.lazy=function(P){return{$$typeof:y,_payload:{_status:-1,_result:P},_init:G}},Ue.memo=function(P,X){return{$$typeof:p,type:P,compare:X===void 0?null:X}},Ue.startTransition=function(P){var X=j.T,le={};j.T=le;try{var re=P(),ue=j.S;ue!==null&&ue(le,re),typeof re=="object"&&re!==null&&typeof re.then=="function"&&re.then(N,ce)}catch(he){ce(he)}finally{X!==null&&le.types!==null&&(X.types=le.types),j.T=X}},Ue.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},Ue.use=function(P){return j.H.use(P)},Ue.useActionState=function(P,X,le){return j.H.useActionState(P,X,le)},Ue.useCallback=function(P,X){return j.H.useCallback(P,X)},Ue.useContext=function(P){return j.H.useContext(P)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(P,X){return j.H.useDeferredValue(P,X)},Ue.useEffect=function(P,X){return j.H.useEffect(P,X)},Ue.useEffectEvent=function(P){return j.H.useEffectEvent(P)},Ue.useId=function(){return j.H.useId()},Ue.useImperativeHandle=function(P,X,le){return j.H.useImperativeHandle(P,X,le)},Ue.useInsertionEffect=function(P,X){return j.H.useInsertionEffect(P,X)},Ue.useLayoutEffect=function(P,X){return j.H.useLayoutEffect(P,X)},Ue.useMemo=function(P,X){return j.H.useMemo(P,X)},Ue.useOptimistic=function(P,X){return j.H.useOptimistic(P,X)},Ue.useReducer=function(P,X,le){return j.H.useReducer(P,X,le)},Ue.useRef=function(P){return j.H.useRef(P)},Ue.useState=function(P){return j.H.useState(P)},Ue.useSyncExternalStore=function(P,X,le){return j.H.useSyncExternalStore(P,X,le)},Ue.useTransition=function(){return j.H.useTransition()},Ue.version="19.2.4",Ue}var lb;function Zi(){return lb||(lb=1,lh.exports=NR()),lh.exports}var R=Zi();const Ra=DR(R),pp=AR({__proto__:null,default:Ra},[R]);var ch={exports:{}},ki={},uh={exports:{}},fh={};var cb;function LR(){return cb||(cb=1,(function(t){function o(B,H){var G=B.length;B.push(H);e:for(;0<G;){var ce=G-1>>>1,W=B[ce];if(0<l(W,H))B[ce]=H,B[G]=W,G=ce;else break e}}function r(B){return B.length===0?null:B[0]}function a(B){if(B.length===0)return null;var H=B[0],G=B.pop();if(G!==H){B[0]=G;e:for(var ce=0,W=B.length,P=W>>>1;ce<P;){var X=2*(ce+1)-1,le=B[X],re=X+1,ue=B[re];if(0>l(le,G))re<W&&0>l(ue,le)?(B[ce]=ue,B[re]=G,ce=re):(B[ce]=le,B[X]=G,ce=X);else if(re<W&&0>l(ue,G))B[ce]=ue,B[re]=G,ce=re;else break e}}return H}function l(B,H){var G=B.sortIndex-H.sortIndex;return G!==0?G:B.id-H.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var f=Date,d=f.now();t.unstable_now=function(){return f.now()-d}}var m=[],p=[],y=1,g=null,v=3,b=!1,x=!1,w=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function O(B){for(var H=r(p);H!==null;){if(H.callback===null)a(p);else if(H.startTime<=B)a(p),H.sortIndex=H.expirationTime,o(m,H);else break;H=r(p)}}function z(B){if(w=!1,O(B),!x)if(r(m)!==null)x=!0,N||(N=!0,V());else{var H=r(p);H!==null&&ae(z,H.startTime-B)}}var N=!1,j=-1,D=5,Y=-1;function $(){return E?!0:!(t.unstable_now()-Y<D)}function Z(){if(E=!1,N){var B=t.unstable_now();Y=B;var H=!0;try{e:{x=!1,w&&(w=!1,_(j),j=-1),b=!0;var G=v;try{t:{for(O(B),g=r(m);g!==null&&!(g.expirationTime>B&&$());){var ce=g.callback;if(typeof ce=="function"){g.callback=null,v=g.priorityLevel;var W=ce(g.expirationTime<=B);if(B=t.unstable_now(),typeof W=="function"){g.callback=W,O(B),H=!0;break t}g===r(m)&&a(m),O(B)}else a(m);g=r(m)}if(g!==null)H=!0;else{var P=r(p);P!==null&&ae(z,P.startTime-B),H=!1}}break e}finally{g=null,v=G,b=!1}H=void 0}}finally{H?V():N=!1}}}var V;if(typeof k=="function")V=function(){k(Z)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,ne=J.port2;J.port1.onmessage=Z,V=function(){ne.postMessage(null)}}else V=function(){C(Z,0)};function ae(B,H){j=C(function(){B(t.unstable_now())},H)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(B){B.callback=null},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return v},t.unstable_next=function(B){switch(v){case 1:case 2:case 3:var H=3;break;default:H=v}var G=v;v=H;try{return B()}finally{v=G}},t.unstable_requestPaint=function(){E=!0},t.unstable_runWithPriority=function(B,H){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var G=v;v=B;try{return H()}finally{v=G}},t.unstable_scheduleCallback=function(B,H,G){var ce=t.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?ce+G:ce):G=ce,B){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=G+W,B={id:y++,callback:H,priorityLevel:B,startTime:G,expirationTime:W,sortIndex:-1},G>ce?(B.sortIndex=G,o(p,B),r(m)===null&&B===r(p)&&(w?(_(j),j=-1):w=!0,ae(z,G-ce))):(B.sortIndex=W,o(m,B),x||b||(x=!0,N||(N=!0,V()))),B},t.unstable_shouldYield=$,t.unstable_wrapCallback=function(B){var H=v;return function(){var G=v;v=H;try{return B.apply(this,arguments)}finally{v=G}}}})(fh)),fh}var ub;function jR(){return ub||(ub=1,uh.exports=LR()),uh.exports}var dh={exports:{}},Zt={};var fb;function PR(){if(fb)return Zt;fb=1;var t=Zi();function o(m){var p="https://react.dev/errors/"+m;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+m+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var a={d:{f:r,r:function(){throw Error(o(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(m,p,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:g==null?null:""+g,children:m,containerInfo:p,implementation:y}}var f=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(m,p){if(m==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Zt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,Zt.createPortal=function(m,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(o(299));return c(m,p,null,y)},Zt.flushSync=function(m){var p=f.T,y=a.p;try{if(f.T=null,a.p=2,m)return m()}finally{f.T=p,a.p=y,a.d.f()}},Zt.preconnect=function(m,p){typeof m=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(m,p))},Zt.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},Zt.preinit=function(m,p){if(typeof m=="string"&&p&&typeof p.as=="string"){var y=p.as,g=d(y,p.crossOrigin),v=typeof p.integrity=="string"?p.integrity:void 0,b=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?a.d.S(m,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:v,fetchPriority:b}):y==="script"&&a.d.X(m,{crossOrigin:g,integrity:v,fetchPriority:b,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Zt.preinitModule=function(m,p){if(typeof m=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=d(p.as,p.crossOrigin);a.d.M(m,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(m)},Zt.preload=function(m,p){if(typeof m=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,g=d(y,p.crossOrigin);a.d.L(m,y,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Zt.preloadModule=function(m,p){if(typeof m=="string")if(p){var y=d(p.as,p.crossOrigin);a.d.m(m,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(m)},Zt.requestFormReset=function(m){a.d.r(m)},Zt.unstable_batchedUpdates=function(m,p){return m(p)},Zt.useFormState=function(m,p,y){return f.H.useFormState(m,p,y)},Zt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Zt.version="19.2.4",Zt}var db;function Q0(){if(db)return dh.exports;db=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(o){console.error(o)}}return t(),dh.exports=PR(),dh.exports}var hb;function UR(){if(hb)return ki;hb=1;var t=jR(),o=Zi(),r=Q0();function a(e){var n="https://react.dev/errors/"+e;if(1<arguments.length){n+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)n+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var n=e,s=e;if(e.alternate)for(;n.return;)n=n.return;else{e=n;do n=e,(n.flags&4098)!==0&&(s=n.return),e=n.return;while(e)}return n.tag===3?s:null}function f(e){if(e.tag===13){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function d(e){if(e.tag===31){var n=e.memoizedState;if(n===null&&(e=e.alternate,e!==null&&(n=e.memoizedState)),n!==null)return n.dehydrated}return null}function m(e){if(c(e)!==e)throw Error(a(188))}function p(e){var n=e.alternate;if(!n){if(n=c(e),n===null)throw Error(a(188));return n!==e?null:e}for(var s=e,i=n;;){var u=s.return;if(u===null)break;var h=u.alternate;if(h===null){if(i=u.return,i!==null){s=i;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===s)return m(u),e;if(h===i)return m(u),n;h=h.sibling}throw Error(a(188))}if(s.return!==i.return)s=u,i=h;else{for(var S=!1,M=u.child;M;){if(M===s){S=!0,s=u,i=h;break}if(M===i){S=!0,i=u,s=h;break}M=M.sibling}if(!S){for(M=h.child;M;){if(M===s){S=!0,s=h,i=u;break}if(M===i){S=!0,i=h,s=u;break}M=M.sibling}if(!S)throw Error(a(189))}}if(s.alternate!==i)throw Error(a(190))}if(s.tag!==3)throw Error(a(188));return s.stateNode.current===s?e:n}function y(e){var n=e.tag;if(n===5||n===26||n===27||n===6)return e;for(e=e.child;e!==null;){if(n=y(e),n!==null)return n;e=e.sibling}return null}var g=Object.assign,v=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),k=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),N=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),$=Symbol.for("react.memo_cache_sentinel"),Z=Symbol.iterator;function V(e){return e===null||typeof e!="object"?null:(e=Z&&e[Z]||e["@@iterator"],typeof e=="function"?e:null)}var J=Symbol.for("react.client.reference");function ne(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===J?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case w:return"Fragment";case C:return"Profiler";case E:return"StrictMode";case z:return"Suspense";case N:return"SuspenseList";case Y:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case x:return"Portal";case k:return e.displayName||"Context";case _:return(e._context.displayName||"Context")+".Consumer";case O:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case j:return n=e.displayName||null,n!==null?n:ne(e.type)||"Memo";case D:n=e._payload,e=e._init;try{return ne(e(n))}catch{}}return null}var ae=Array.isArray,B=o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},ce=[],W=-1;function P(e){return{current:e}}function X(e){0>W||(e.current=ce[W],ce[W]=null,W--)}function le(e,n){W++,ce[W]=e.current,e.current=n}var re=P(null),ue=P(null),he=P(null),ve=P(null);function Me(e,n){switch(le(he,n),le(ue,e),le(re,null),n.nodeType){case 9:case 11:e=(e=n.documentElement)&&(e=e.namespaceURI)?Ov(e):0;break;default:if(e=n.tagName,n=n.namespaceURI)n=Ov(n),e=_v(n,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}X(re),le(re,e)}function fe(){X(re),X(ue),X(he)}function ze(e){e.memoizedState!==null&&le(ve,e);var n=re.current,s=_v(n,e.type);n!==s&&(le(ue,e),le(re,s))}function je(e){ue.current===e&&(X(re),X(ue)),ve.current===e&&(X(ve),Mi._currentValue=G)}var te,me;function pe(e){if(te===void 0)try{throw Error()}catch(s){var n=s.stack.trim().match(/\n( *(at )?)/);te=n&&n[1]||"",me=-1<s.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+te+e+me}var Ne=!1;function be(e,n){if(!e||Ne)return"";Ne=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(n){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(ee){var Q=ee}Reflect.construct(e,[],ie)}else{try{ie.call()}catch(ee){Q=ee}e.call(ie.prototype)}}else{try{throw Error()}catch(ee){Q=ee}(ie=e())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(ee){if(ee&&Q&&typeof ee.stack=="string")return[ee.stack,Q.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=i.DetermineComponentFrameRoot(),S=h[0],M=h[1];if(S&&M){var U=S.split(`
@@ -15,7 +15,7 @@ Error generating stack: `+i.message+`
15
15
  `)}else{const p=l.indexOf(`
16
16
  `);if(p>=0){const y=l.slice(0,p).trim();l=l.slice(p+1),y.length>0&&(f=JSON.parse(y),c=!0)}}}return(async()=>{try{for(;;){const{value:d,done:m}=await a.read();d&&(l+=d);const p=l.lastIndexOf(`
17
17
  `);if(p>=0){const y=l.slice(0,p);l=l.slice(p+1);const g=y.split(`
18
- `).filter(Boolean);for(const v of g)try{o(JSON.parse(v))}catch(b){r?.(`Invalid JSON line: ${v}`,b)}}if(m)break}}catch(d){r?.("Stream processing error:",d)}})(),o(f)}async function nA({jsonStream:t,onMessage:o,onError:r}){const a=t.getReader(),{value:l,done:c}=await a.read();if(c||!l)throw new Error("Stream ended before first object");const f=JSON.parse(l);return(async()=>{try{for(;;){const{value:d,done:m}=await a.read();if(m)break;if(d)try{o(JSON.parse(d))}catch(p){r?.(`Invalid JSON: ${d}`,p)}}}catch(d){r?.("Stream processing error:",d)}})(),o(f)}function oA(t){const o="/_serverFn/"+t;return Object.assign((...l)=>{const c=nx()?.serverFns?.fetch;return J_(o,l,c??fetch)},{url:o,serverFnMeta:{id:t},[Gh]:!0})}const rA={key:"$TSS/serverfn",test:t=>typeof t!="function"||!(Gh in t)?!1:!!t[Gh],toSerializable:({serverFnMeta:t})=>({functionId:t.id}),fromSerializable:({functionId:t})=>oA(t)};const ax=(...t)=>t.filter((o,r,a)=>!!o&&o.trim()!==""&&a.indexOf(o)===r).join(" ").trim();const sA=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const aA=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(o,r,a)=>a?a.toUpperCase():r.toLowerCase());const $b=t=>{const o=aA(t);return o.charAt(0).toUpperCase()+o.slice(1)};var iA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const lA=t=>{for(const o in t)if(o.startsWith("aria-")||o==="role"||o==="title")return!0;return!1};const cA=R.forwardRef(({color:t="currentColor",size:o=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:l="",children:c,iconNode:f,...d},m)=>R.createElement("svg",{ref:m,...iA,width:o,height:o,stroke:t,strokeWidth:a?Number(r)*24/Number(o):r,className:ax("lucide",l),...!c&&!lA(d)&&{"aria-hidden":"true"},...d},[...f.map(([p,y])=>R.createElement(p,y)),...Array.isArray(c)?c:[c]]));const Ho=(t,o)=>{const r=R.forwardRef(({className:a,...l},c)=>R.createElement(cA,{ref:c,iconNode:o,className:ax(`lucide-${sA($b(t))}`,`lucide-${t}`,a),...l}));return r.displayName=$b(t),r};const uA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],fA=Ho("chevron-right",uA);const dA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],hA=Ho("circle-plus",dA);const pA=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],mA=Ho("ellipsis",pA);const gA=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Fh=Ho("message-square",gA);const yA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],vA=Ho("panel-left",yA);const bA=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],SA=Ho("puzzle",bA);const xA=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],wA=Ho("settings",xA);const EA=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],RA=Ho("trash-2",EA);const TA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],CA=Ho("x",TA);function Xh(t,o){if(t&&!o)return t;if(!t&&o)return o;if(t||o)return{...t,...o}}const Vi={};function Po(t,o,r,a,l){let c={...Kh(t,Vi)};return o&&(c=Gc(c,o)),r&&(c=Gc(c,r)),a&&(c=Gc(c,a)),c}function MA(t){if(t.length===0)return Vi;if(t.length===1)return Kh(t[0],Vi);let o={...Kh(t[0],Vi)};for(let r=1;r<t.length;r+=1)o=Gc(o,t[r]);return o}function Gc(t,o){return ix(o)?o(t):OA(t,o)}function OA(t,o){if(!o)return t;for(const r in o){const a=o[r];switch(r){case"style":{t[r]=Xh(t.style,a);break}case"className":{t[r]=lx(t.className,a);break}default:_A(r,a)?t[r]=AA(t[r],a):t[r]=a}}return t}function _A(t,o){const r=t.charCodeAt(0),a=t.charCodeAt(1),l=t.charCodeAt(2);return r===111&&a===110&&l>=65&&l<=90&&(typeof o=="function"||typeof o>"u")}function ix(t){return typeof t=="function"}function Kh(t,o){return ix(t)?t(o):t??Vi}function AA(t,o){return o?t?r=>{if(DA(r)){const l=r;Qh(l);const c=o(l);return l.baseUIHandlerPrevented||t?.(l),c}const a=o(r);return t?.(r),a}:o:t}function Qh(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function lx(t,o){return o?t?o+" "+t:o:t}function DA(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function tn(t,...o){const r=new URL("https://base-ui.com/production-error");return r.searchParams.set("code",t.toString()),o.forEach(a=>r.searchParams.append("args[]",a)),`Base UI error #${t}; visit ${r} for the full message.`}const Jb={};function Wt(t,o){const r=R.useRef(Jb);return r.current===Jb&&(r.current=t(o)),r}function Ma(t,o,r,a){const l=Wt(cx).current;return zA(l,t,o,r,a)&&ux(l,[t,o,r,a]),l.callback}function kA(t){const o=Wt(cx).current;return NA(o,t)&&ux(o,t),o.callback}function cx(){return{callback:null,cleanup:null,refs:[]}}function zA(t,o,r,a,l){return t.refs[0]!==o||t.refs[1]!==r||t.refs[2]!==a||t.refs[3]!==l}function NA(t,o){return t.refs.length!==o.length||t.refs.some((r,a)=>r!==o[a])}function ux(t,o){if(t.refs=o,o.every(r=>r==null)){t.callback=null;return}t.callback=r=>{if(t.cleanup&&(t.cleanup(),t.cleanup=null),r!=null){const a=Array(o.length).fill(null);for(let l=0;l<o.length;l+=1){const c=o[l];if(c!=null)switch(typeof c){case"function":{const f=c(r);typeof f=="function"&&(a[l]=f);break}case"object":{c.current=r;break}}}t.cleanup=()=>{for(let l=0;l<o.length;l+=1){const c=o[l];if(c!=null)switch(typeof c){case"function":{const f=a[l];typeof f=="function"?f():c(null);break}case"object":{c.current=null;break}}}}}}}const LA=parseInt(R.version,10);function kp(t){return LA>=t}function Wb(t){if(!R.isValidElement(t))return null;const o=t,r=o.props;return(kp(19)?r?.ref:o.ref)??null}function jA(t,o){const r={};for(const a in t){const l=t[a];if(o?.hasOwnProperty(a)){const c=o[a](l);c!=null&&Object.assign(r,c);continue}l===!0?r[`data-${a.toLowerCase()}`]="":l&&(r[`data-${a.toLowerCase()}`]=l.toString())}return r}function PA(t,o){return typeof t=="function"?t(o):t}function UA(t,o){return typeof t=="function"?t(o):t}function fx(){}const Zh=Object.freeze([]),qt=Object.freeze({}),BA=500,IA=500,HA={style:{transition:"none"}},VA="data-base-ui-click-trigger",qA={fallbackAxisSide:"none"},dx={fallbackAxisSide:"end"},YA={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function Mt(t,o,r={}){const a=o.render,l=GA(o,r);if(r.enabled===!1)return null;const c=r.state??qt;return XA(t,a,l,c)}function GA(t,o={}){const{className:r,style:a,render:l}=t,{state:c=qt,ref:f,props:d,stateAttributesMapping:m,enabled:p=!0}=o,y=p?PA(r,c):void 0,g=p?UA(a,c):void 0,v=p?jA(c,m):qt,b=p?Xh(v,Array.isArray(d)?MA(d):d)??qt:qt;return typeof document<"u"&&(p?Array.isArray(f)?b.ref=kA([b.ref,Wb(l),...f]):b.ref=Ma(b.ref,Wb(l),f):Ma(null,null)),p?(y!==void 0&&(b.className=lx(b.className,y)),g!==void 0&&(b.style=Xh(b.style,g)),b):qt}const FA=Symbol.for("react.lazy");function XA(t,o,r,a){if(o){if(typeof o=="function")return o(r,a);const l=Po(r,o.props);l.ref=r.ref;let c=o;return c?.$$typeof===FA&&(c=R.Children.toArray(o)[0]),R.cloneElement(c,l)}if(t&&typeof t=="string")return KA(t,r);throw new Error(tn(8))}function KA(t,o){return t==="button"?R.createElement("button",{type:"button",...o,key:o.key}):t==="img"?R.createElement("img",{alt:"",...o,key:o.key}):R.createElement(t,o)}function ku(t){return Mt(t.defaultTagName??"div",t,t)}function hx(t){var o,r,a="";if(typeof t=="string"||typeof t=="number")a+=t;else if(typeof t=="object")if(Array.isArray(t)){var l=t.length;for(o=0;o<l;o++)t[o]&&(r=hx(t[o]))&&(a&&(a+=" "),a+=r)}else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}function px(){for(var t,o,r=0,a="",l=arguments.length;r<l;r++)(t=arguments[r])&&(o=hx(t))&&(a&&(a+=" "),a+=o);return a}const e0=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,t0=px,zp=(t,o)=>r=>{var a;if(o?.variants==null)return t0(t,r?.class,r?.className);const{variants:l,defaultVariants:c}=o,f=Object.keys(l).map(p=>{const y=r?.[p],g=c?.[p];if(y===null)return null;const v=e0(y)||e0(g);return l[p][v]}),d=r&&Object.entries(r).reduce((p,y)=>{let[g,v]=y;return v===void 0||(p[g]=v),p},{}),m=o==null||(a=o.compoundVariants)===null||a===void 0?void 0:a.reduce((p,y)=>{let{class:g,className:v,...b}=y;return Object.entries(b).every(x=>{let[w,E]=x;return Array.isArray(E)?E.includes({...c,...d}[w]):{...c,...d}[w]===E})?[...p,g,v]:p},[]);return t0(t,f,m,r?.class,r?.className)};function zu(){return typeof window<"u"}function zr(t){return Np(t)?(t.nodeName||"").toLowerCase():"#document"}function zt(t){var o;return(t==null||(o=t.ownerDocument)==null?void 0:o.defaultView)||window}function uo(t){var o;return(o=(Np(t)?t.ownerDocument:t.document)||window.document)==null?void 0:o.documentElement}function Np(t){return zu()?t instanceof Node||t instanceof zt(t).Node:!1}function st(t){return zu()?t instanceof Element||t instanceof zt(t).Element:!1}function St(t){return zu()?t instanceof HTMLElement||t instanceof zt(t).HTMLElement:!1}function $h(t){return!zu()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof zt(t).ShadowRoot}const QA=new Set(["inline","contents"]);function Nr(t){const{overflow:o,overflowX:r,overflowY:a,display:l}=On(t);return/auto|scroll|overlay|hidden|clip/.test(o+a+r)&&!QA.has(l)}const ZA=new Set(["table","td","th"]);function $A(t){return ZA.has(zr(t))}const JA=[":popover-open",":modal"];function Nu(t){return JA.some(o=>{try{return t.matches(o)}catch{return!1}})}const WA=["transform","translate","scale","rotate","perspective"],e2=["transform","translate","scale","rotate","perspective","filter"],t2=["paint","layout","strict","content"];function Lp(t){const o=Lu(),r=st(t)?On(t):t;return WA.some(a=>r[a]?r[a]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!o&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!o&&(r.filter?r.filter!=="none":!1)||e2.some(a=>(r.willChange||"").includes(a))||t2.some(a=>(r.contain||"").includes(a))}function n2(t){let o=lo(t);for(;St(o)&&!ro(o);){if(Lp(o))return o;if(Nu(o))return null;o=lo(o)}return null}function Lu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const o2=new Set(["html","body","#document"]);function ro(t){return o2.has(zr(t))}function On(t){return zt(t).getComputedStyle(t)}function ju(t){return st(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function lo(t){if(zr(t)==="html")return t;const o=t.assignedSlot||t.parentNode||$h(t)&&t.host||uo(t);return $h(o)?o.host:o}function mx(t){const o=lo(t);return ro(o)?t.ownerDocument?t.ownerDocument.body:t.body:St(o)&&Nr(o)?o:mx(o)}function Mr(t,o,r){var a;o===void 0&&(o=[]),r===void 0&&(r=!0);const l=mx(t),c=l===((a=t.ownerDocument)==null?void 0:a.body),f=zt(l);if(c){const d=Jh(f);return o.concat(f,f.visualViewport||[],Nr(l)?l:[],d&&r?Mr(d):[])}return o.concat(l,Mr(l,[],r))}function Jh(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const Ch=pp[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],r2=Ch&&Ch!==R.useLayoutEffect?Ch:t=>t();function Ce(t){const o=Wt(s2).current;return o.next=t,r2(o.effect),o.trampoline}function s2(){const t={next:void 0,callback:a2,trampoline:(...o)=>t.callback?.(...o),effect:()=>{t.callback=t.next}};return t}function a2(){}const i2={...pp},l2=()=>{},Ae=typeof document<"u"?R.useLayoutEffect:l2,c2=R.createContext(void 0);function jp(t=!1){const o=R.useContext(c2);if(o===void 0&&!t)throw new Error(tn(16));return o}function u2(t){const{focusableWhenDisabled:o,disabled:r,composite:a=!1,tabIndex:l=0,isNativeButton:c}=t,f=a&&o!==!1,d=a&&o===!1;return{props:R.useMemo(()=>{const p={onKeyDown(y){r&&o&&y.key!=="Tab"&&y.preventDefault()}};return a||(p.tabIndex=l,!c&&r&&(p.tabIndex=o?l:-1)),(c&&(o||f)||!c&&r)&&(p["aria-disabled"]=r),c&&(!o||d)&&(p.disabled=r),p},[a,r,o,f,d,c,l])}}function Pu(t={}){const{disabled:o=!1,focusableWhenDisabled:r,tabIndex:a=0,native:l=!0}=t,c=R.useRef(null),f=jp(!0)!==void 0,d=Ce(()=>{const v=c.current;return!!(v?.tagName==="A"&&v?.href)}),{props:m}=u2({focusableWhenDisabled:r,disabled:o,composite:f,tabIndex:a,isNativeButton:l}),p=R.useCallback(()=>{const v=c.current;f2(v)&&f&&o&&m.disabled===void 0&&v.disabled&&(v.disabled=!1)},[o,m.disabled,f]);Ae(p,[p]);const y=R.useCallback((v={})=>{const{onClick:b,onMouseDown:x,onKeyUp:w,onKeyDown:E,onPointerDown:C,..._}=v;return Po({type:l?"button":void 0,onClick(O){if(o){O.preventDefault();return}b?.(O)},onMouseDown(O){o||x?.(O)},onKeyDown(O){if(o||(Qh(O),E?.(O)),O.baseUIHandlerPrevented)return;const z=O.target===O.currentTarget&&!l&&!d()&&!o,N=O.key==="Enter",j=O.key===" ";z&&((j||N)&&O.preventDefault(),N&&b?.(O))},onKeyUp(O){o||(Qh(O),w?.(O)),!O.baseUIHandlerPrevented&&O.target===O.currentTarget&&!l&&!o&&O.key===" "&&b?.(O)},onPointerDown(O){if(o){O.preventDefault();return}C?.(O)}},l?void 0:{role:"button"},m,_)},[o,m,l,d]),g=Ce(v=>{c.current=v,p()});return{getButtonProps:y,buttonRef:g}}function f2(t){return St(t)&&t.tagName==="BUTTON"}const d2=R.forwardRef(function(o,r){const{render:a,className:l,disabled:c=!1,focusableWhenDisabled:f=!1,nativeButton:d=!0,...m}=o,{getButtonProps:p,buttonRef:y}=Pu({disabled:c,focusableWhenDisabled:f,native:d});return Mt("button",o,{state:{disabled:c},ref:[r,y],props:[m,p]})}),h2=(t,o)=>{const r=new Array(t.length+o.length);for(let a=0;a<t.length;a++)r[a]=t[a];for(let a=0;a<o.length;a++)r[t.length+a]=o[a];return r},p2=(t,o)=>({classGroupId:t,validator:o}),gx=(t=new Map,o=null,r)=>({nextPart:t,validators:o,classGroupId:r}),cu="-",n0=[],m2="arbitrary..",g2=t=>{const o=v2(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=t;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return y2(f);const d=f.split(cu),m=d[0]===""&&d.length>1?1:0;return yx(d,m,o)},getConflictingClassGroupIds:(f,d)=>{if(d){const m=a[f],p=r[f];return m?p?h2(p,m):m:p||n0}return r[f]||n0}}},yx=(t,o,r)=>{if(t.length-o===0)return r.classGroupId;const l=t[o],c=r.nextPart.get(l);if(c){const p=yx(t,o+1,c);if(p)return p}const f=r.validators;if(f===null)return;const d=o===0?t.join(cu):t.slice(o).join(cu),m=f.length;for(let p=0;p<m;p++){const y=f[p];if(y.validator(d))return y.classGroupId}},y2=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=t.slice(1,-1),r=o.indexOf(":"),a=o.slice(0,r);return a?m2+a:void 0})(),v2=t=>{const{theme:o,classGroups:r}=t;return b2(r,o)},b2=(t,o)=>{const r=gx();for(const a in t){const l=t[a];Pp(l,r,a,o)}return r},Pp=(t,o,r,a)=>{const l=t.length;for(let c=0;c<l;c++){const f=t[c];S2(f,o,r,a)}},S2=(t,o,r,a)=>{if(typeof t=="string"){x2(t,o,r);return}if(typeof t=="function"){w2(t,o,r,a);return}E2(t,o,r,a)},x2=(t,o,r)=>{const a=t===""?o:vx(o,t);a.classGroupId=r},w2=(t,o,r,a)=>{if(R2(t)){Pp(t(a),o,r,a);return}o.validators===null&&(o.validators=[]),o.validators.push(p2(r,t))},E2=(t,o,r,a)=>{const l=Object.entries(t),c=l.length;for(let f=0;f<c;f++){const[d,m]=l[f];Pp(m,vx(o,d),r,a)}},vx=(t,o)=>{let r=t;const a=o.split(cu),l=a.length;for(let c=0;c<l;c++){const f=a[c];let d=r.nextPart.get(f);d||(d=gx(),r.nextPart.set(f,d)),r=d}return r},R2=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,T2=t=>{if(t<1)return{get:()=>{},set:()=>{}};let o=0,r=Object.create(null),a=Object.create(null);const l=(c,f)=>{r[c]=f,o++,o>t&&(o=0,a=r,r=Object.create(null))};return{get(c){let f=r[c];if(f!==void 0)return f;if((f=a[c])!==void 0)return l(c,f),f},set(c,f){c in r?r[c]=f:l(c,f)}}},Wh="!",o0=":",C2=[],r0=(t,o,r,a,l)=>({modifiers:t,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:a,isExternal:l}),M2=t=>{const{prefix:o,experimentalParseClassName:r}=t;let a=l=>{const c=[];let f=0,d=0,m=0,p;const y=l.length;for(let w=0;w<y;w++){const E=l[w];if(f===0&&d===0){if(E===o0){c.push(l.slice(m,w)),m=w+1;continue}if(E==="/"){p=w;continue}}E==="["?f++:E==="]"?f--:E==="("?d++:E===")"&&d--}const g=c.length===0?l:l.slice(m);let v=g,b=!1;g.endsWith(Wh)?(v=g.slice(0,-1),b=!0):g.startsWith(Wh)&&(v=g.slice(1),b=!0);const x=p&&p>m?p-m:void 0;return r0(c,b,v,x)};if(o){const l=o+o0,c=a;a=f=>f.startsWith(l)?c(f.slice(l.length)):r0(C2,!1,f,void 0,!0)}if(r){const l=a;a=c=>r({className:c,parseClassName:l})}return a},O2=t=>{const o=new Map;return t.orderSensitiveModifiers.forEach((r,a)=>{o.set(r,1e6+a)}),r=>{const a=[];let l=[];for(let c=0;c<r.length;c++){const f=r[c],d=f[0]==="[",m=o.has(f);d||m?(l.length>0&&(l.sort(),a.push(...l),l=[]),a.push(f)):l.push(f)}return l.length>0&&(l.sort(),a.push(...l)),a}},_2=t=>({cache:T2(t.cacheSize),parseClassName:M2(t),sortModifiers:O2(t),...g2(t)}),A2=/\s+/,D2=(t,o)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:c}=o,f=[],d=t.trim().split(A2);let m="";for(let p=d.length-1;p>=0;p-=1){const y=d[p],{isExternal:g,modifiers:v,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:w}=r(y);if(g){m=y+(m.length>0?" "+m:m);continue}let E=!!w,C=a(E?x.substring(0,w):x);if(!C){if(!E){m=y+(m.length>0?" "+m:m);continue}if(C=a(x),!C){m=y+(m.length>0?" "+m:m);continue}E=!1}const _=v.length===0?"":v.length===1?v[0]:c(v).join(":"),k=b?_+Wh:_,O=k+C;if(f.indexOf(O)>-1)continue;f.push(O);const z=l(C,E);for(let N=0;N<z.length;++N){const j=z[N];f.push(k+j)}m=y+(m.length>0?" "+m:m)}return m},k2=(...t)=>{let o=0,r,a,l="";for(;o<t.length;)(r=t[o++])&&(a=bx(r))&&(l&&(l+=" "),l+=a);return l},bx=t=>{if(typeof t=="string")return t;let o,r="";for(let a=0;a<t.length;a++)t[a]&&(o=bx(t[a]))&&(r&&(r+=" "),r+=o);return r},z2=(t,...o)=>{let r,a,l,c;const f=m=>{const p=o.reduce((y,g)=>g(y),t());return r=_2(p),a=r.cache.get,l=r.cache.set,c=d,d(m)},d=m=>{const p=a(m);if(p)return p;const y=D2(m,r);return l(m,y),y};return c=f,(...m)=>c(k2(...m))},N2=[],jt=t=>{const o=r=>r[t]||N2;return o.isThemeGetter=!0,o},Sx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,L2=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,j2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,P2=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,U2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,B2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,I2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vr=t=>L2.test(t),Ge=t=>!!t&&!Number.isNaN(Number(t)),br=t=>!!t&&Number.isInteger(Number(t)),Mh=t=>t.endsWith("%")&&Ge(t.slice(0,-1)),ko=t=>j2.test(t),wx=()=>!0,H2=t=>P2.test(t)&&!U2.test(t),Up=()=>!1,V2=t=>B2.test(t),q2=t=>I2.test(t),Y2=t=>!Ee(t)&&!Re(t),G2=t=>Lr(t,Tx,Up),Ee=t=>Sx.test(t),os=t=>Lr(t,Cx,H2),s0=t=>Lr(t,W2,Ge),F2=t=>Lr(t,Ox,wx),X2=t=>Lr(t,Mx,Up),a0=t=>Lr(t,Ex,Up),K2=t=>Lr(t,Rx,q2),Oc=t=>Lr(t,_x,V2),Re=t=>xx.test(t),Pi=t=>bs(t,Cx),Q2=t=>bs(t,Mx),i0=t=>bs(t,Ex),Z2=t=>bs(t,Tx),$2=t=>bs(t,Rx),_c=t=>bs(t,_x,!0),J2=t=>bs(t,Ox,!0),Lr=(t,o,r)=>{const a=Sx.exec(t);return a?a[1]?o(a[1]):r(a[2]):!1},bs=(t,o,r=!1)=>{const a=xx.exec(t);return a?a[1]?o(a[1]):r:!1},Ex=t=>t==="position"||t==="percentage",Rx=t=>t==="image"||t==="url",Tx=t=>t==="length"||t==="size"||t==="bg-size",Cx=t=>t==="length",W2=t=>t==="number",Mx=t=>t==="family-name",Ox=t=>t==="number"||t==="weight",_x=t=>t==="shadow",eD=()=>{const t=jt("color"),o=jt("font"),r=jt("text"),a=jt("font-weight"),l=jt("tracking"),c=jt("leading"),f=jt("breakpoint"),d=jt("container"),m=jt("spacing"),p=jt("radius"),y=jt("shadow"),g=jt("inset-shadow"),v=jt("text-shadow"),b=jt("drop-shadow"),x=jt("blur"),w=jt("perspective"),E=jt("aspect"),C=jt("ease"),_=jt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],O=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],z=()=>[...O(),Re,Ee],N=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],D=()=>[Re,Ee,m],Y=()=>[vr,"full","auto",...D()],$=()=>[br,"none","subgrid",Re,Ee],Z=()=>["auto",{span:["full",br,Re,Ee]},br,Re,Ee],V=()=>[br,"auto",Re,Ee],J=()=>["auto","min","max","fr",Re,Ee],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ae=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...D()],H=()=>[vr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],G=()=>[vr,"screen","full","dvw","lvw","svw","min","max","fit",...D()],ce=()=>[vr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],W=()=>[t,Re,Ee],P=()=>[...O(),i0,a0,{position:[Re,Ee]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],le=()=>["auto","cover","contain",Z2,G2,{size:[Re,Ee]}],re=()=>[Mh,Pi,os],ue=()=>["","none","full",p,Re,Ee],he=()=>["",Ge,Pi,os],ve=()=>["solid","dashed","dotted","double"],Me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[Ge,Mh,i0,a0],ze=()=>["","none",x,Re,Ee],je=()=>["none",Ge,Re,Ee],te=()=>["none",Ge,Re,Ee],me=()=>[Ge,Re,Ee],pe=()=>[vr,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ko],breakpoint:[ko],color:[wx],container:[ko],"drop-shadow":[ko],ease:["in","out","in-out"],font:[Y2],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ko],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ko],shadow:[ko],spacing:["px",Ge],text:[ko],"text-shadow":[ko],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",vr,Ee,Re,E]}],container:["container"],columns:[{columns:[Ge,Ee,Re,d]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:z()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Y()}],"inset-x":[{"inset-x":Y()}],"inset-y":[{"inset-y":Y()}],start:[{"inset-s":Y(),start:Y()}],end:[{"inset-e":Y(),end:Y()}],"inset-bs":[{"inset-bs":Y()}],"inset-be":[{"inset-be":Y()}],top:[{top:Y()}],right:[{right:Y()}],bottom:[{bottom:Y()}],left:[{left:Y()}],visibility:["visible","invisible","collapse"],z:[{z:[br,"auto",Re,Ee]}],basis:[{basis:[vr,"full","auto",d,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,vr,"auto","initial","none",Ee]}],grow:[{grow:["",Ge,Re,Ee]}],shrink:[{shrink:["",Ge,Re,Ee]}],order:[{order:[br,"first","last","none",Re,Ee]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:Z()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:Z()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...ae(),"normal"]}],"justify-self":[{"justify-self":["auto",...ae()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...ae(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ae(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...ae(),"baseline"]}],"place-self":[{"place-self":["auto",...ae()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...G()]}],"min-inline-size":[{"min-inline":["auto",...G()]}],"max-inline-size":[{"max-inline":["none",...G()]}],"block-size":[{block:["auto",...ce()]}],"min-block-size":[{"min-block":["auto",...ce()]}],"max-block-size":[{"max-block":["none",...ce()]}],w:[{w:[d,"screen",...H()]}],"min-w":[{"min-w":[d,"screen","none",...H()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[f]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,Pi,os]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,J2,F2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Mh,Ee]}],"font-family":[{font:[Q2,X2,o]}],"font-features":[{"font-features":[Ee]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,Re,Ee]}],"line-clamp":[{"line-clamp":[Ge,"none",Re,s0]}],leading:[{leading:[c,...D()]}],"list-image":[{"list-image":["none",Re,Ee]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Re,Ee]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",Re,os]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[Ge,"auto",Re,Ee]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Re,Ee]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Re,Ee]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:le()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},br,Re,Ee],radial:["",Re,Ee],conic:[br,Re,Ee]},$2,K2]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":he()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ve(),"hidden","none"]}],"divide-style":[{divide:[...ve(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...ve(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,Re,Ee]}],"outline-w":[{outline:["",Ge,Pi,os]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",y,_c,Oc]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",g,_c,Oc]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[Ge,os]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",v,_c,Oc]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[Ge,Re,Ee]}],"mix-blend":[{"mix-blend":[...Me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Me()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[Re,Ee]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":O()}],"mask-image-conic-pos":[{"mask-conic":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Re,Ee]}],filter:[{filter:["","none",Re,Ee]}],blur:[{blur:ze()}],brightness:[{brightness:[Ge,Re,Ee]}],contrast:[{contrast:[Ge,Re,Ee]}],"drop-shadow":[{"drop-shadow":["","none",b,_c,Oc]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",Ge,Re,Ee]}],"hue-rotate":[{"hue-rotate":[Ge,Re,Ee]}],invert:[{invert:["",Ge,Re,Ee]}],saturate:[{saturate:[Ge,Re,Ee]}],sepia:[{sepia:["",Ge,Re,Ee]}],"backdrop-filter":[{"backdrop-filter":["","none",Re,Ee]}],"backdrop-blur":[{"backdrop-blur":ze()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,Re,Ee]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,Re,Ee]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,Re,Ee]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,Re,Ee]}],"backdrop-invert":[{"backdrop-invert":["",Ge,Re,Ee]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,Re,Ee]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,Re,Ee]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,Re,Ee]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Re,Ee]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",Re,Ee]}],ease:[{ease:["linear","initial",C,Re,Ee]}],delay:[{delay:[Ge,Re,Ee]}],animate:[{animate:["none",_,Re,Ee]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Re,Ee]}],"perspective-origin":[{"perspective-origin":z()}],rotate:[{rotate:je()}],"rotate-x":[{"rotate-x":je()}],"rotate-y":[{"rotate-y":je()}],"rotate-z":[{"rotate-z":je()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[Re,Ee,"","none","gpu","cpu"]}],"transform-origin":[{origin:z()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Re,Ee]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Re,Ee]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[Ge,Pi,os,s0]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},tD=z2(eD);function ct(...t){return tD(px(t))}const nD=zp("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",destructive:"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Ax({className:t,variant:o="default",size:r="default",...a}){return L.jsx(d2,{"data-slot":"button",className:ct(nD({variant:o,size:r,className:t})),...a})}let l0=0;function oD(t,o="mui"){const[r,a]=R.useState(t),l=t||r;return R.useEffect(()=>{r==null&&(l0+=1,a(`${o}-${l0}`))},[r,o]),l}const c0=i2.useId;function Ss(t,o){if(c0!==void 0){const r=c0();return t??(o?`${o}-${r}`:r)}return oD(t,o)}function xs(t){return Ss(t,"base-ui")}const rD=[];function Bp(t){R.useEffect(t,rD)}const Ui=0;class co{static create(){return new co}currentId=Ui;start(o,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ui,r()},o)}isStarted(){return this.currentId!==Ui}clear=()=>{this.currentId!==Ui&&(clearTimeout(this.currentId),this.currentId=Ui)};disposeEffect=()=>this.clear}function qn(){const t=Wt(co.create).current;return Bp(t.disposeEffect),t}function at(t){return t?.ownerDocument||document}const ja=typeof navigator<"u",Oh=aD(),Dx=lD(),kx=iD(),zx=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Nx=Oh.platform==="MacIntel"&&Oh.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Oh.platform),Lx=ja&&/apple/i.test(navigator.vendor),ep=ja&&/android/i.test(Dx)||/android/i.test(kx),sD=ja&&Dx.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,jx=kx.includes("jsdom/");function aD(){if(!ja)return{platform:"",maxTouchPoints:-1};const t=navigator.userAgentData;return t?.platform?{platform:t.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function iD(){if(!ja)return"";const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:o,version:r})=>`${o}/${r}`).join(" "):navigator.userAgent}function lD(){if(!ja)return"";const t=navigator.userAgentData;return t?.platform?t.platform:navigator.platform??""}const tp="data-base-ui-focusable",Px="active",Ux="selected",Bx="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Or="ArrowLeft",_r="ArrowRight",Ip="ArrowUp",Wi="ArrowDown";function Zn(t){let o=t.activeElement;for(;o?.shadowRoot?.activeElement!=null;)o=o.shadowRoot.activeElement;return o}function Ye(t,o){if(!t||!o)return!1;const r=o.getRootNode?.();if(t.contains(o))return!0;if(r&&$h(r)){let a=o;for(;a;){if(t===a)return!0;a=a.parentNode||a.host}}return!1}function uu(t,o){if(!st(t))return!1;const r=t;if(o.hasElement(r))return!r.hasAttribute("data-trigger-disabled");for(const[,a]of o.entries())if(Ye(a,r))return!a.hasAttribute("data-trigger-disabled");return!1}function rn(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Qn(t,o){if(o==null)return!1;if("composedPath"in t)return t.composedPath().includes(o);const r=t;return r.target!=null&&o.contains(r.target)}function cD(t){return t.matches("html,body")}function Uu(t){return St(t)&&t.matches(Bx)}function np(t){return t?t.getAttribute("role")==="combobox"&&Uu(t):!1}function uD(t){if(!t||jx)return!0;try{return t.matches(":focus-visible")}catch{return!0}}function fu(t){return t?t.hasAttribute(tp)?t:t.querySelector(`[${tp}]`)||t:null}function us(t,o,r=!0){return t.filter(l=>l.parentId===o&&(!r||l.context?.open)).flatMap(l=>[l,...us(t,l.id,r)])}function u0(t,o){let r=[],a=t.find(l=>l.id===o)?.parentId;for(;a;){const l=t.find(c=>c.id===a);a=l?.parentId,l&&(r=r.concat(l))}return r}function Jt(t){t.preventDefault(),t.stopPropagation()}function fD(t){return"nativeEvent"in t}function Ix(t){return t.pointerType===""&&t.isTrusted?!0:ep&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function Hx(t){return jx?!1:!ep&&t.width===0&&t.height===0||ep&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function ms(t,o){const r=["mouse","pen"];return o||r.push("",void 0),r.includes(t)}function Vx(t){const o=t.type;return o==="click"||o==="mousedown"||o==="keydown"||o==="keyup"}const dD=["top","right","bottom","left"],Oa=Math.min,Mn=Math.max,du=Math.round,ha=Math.floor,so=t=>({x:t,y:t}),hD={left:"right",right:"left",bottom:"top",top:"bottom"},pD={start:"end",end:"start"};function op(t,o,r){return Mn(t,Oa(o,r))}function Uo(t,o){return typeof t=="function"?t(o):t}function vn(t){return t.split("-")[0]}function jr(t){return t.split("-")[1]}function Hp(t){return t==="x"?"y":"x"}function Vp(t){return t==="y"?"height":"width"}const mD=new Set(["top","bottom"]);function Vn(t){return mD.has(vn(t))?"y":"x"}function qp(t){return Hp(Vn(t))}function gD(t,o,r){r===void 0&&(r=!1);const a=jr(t),l=qp(t),c=Vp(l);let f=l==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return o.reference[c]>o.floating[c]&&(f=hu(f)),[f,hu(f)]}function yD(t){const o=hu(t);return[rp(t),o,rp(o)]}function rp(t){return t.replace(/start|end/g,o=>pD[o])}const f0=["left","right"],d0=["right","left"],vD=["top","bottom"],bD=["bottom","top"];function SD(t,o,r){switch(t){case"top":case"bottom":return r?o?d0:f0:o?f0:d0;case"left":case"right":return o?vD:bD;default:return[]}}function xD(t,o,r,a){const l=jr(t);let c=SD(vn(t),r==="start",a);return l&&(c=c.map(f=>f+"-"+l),o&&(c=c.concat(c.map(rp)))),c}function hu(t){return t.replace(/left|right|bottom|top/g,o=>hD[o])}function wD(t){return{top:0,right:0,bottom:0,left:0,...t}}function qx(t){return typeof t!="number"?wD(t):{top:t,right:t,bottom:t,left:t}}function pu(t){const{x:o,y:r,width:a,height:l}=t;return{width:a,height:l,top:r,left:o,right:o+a,bottom:r+l,x:o,y:r}}function Ac(t,o,r){return Math.floor(t/o)!==r}function qi(t,o){return o<0||o>=t.current.length}function _h(t,o){return $t(t,{disabledIndices:o})}function h0(t,o){return $t(t,{decrement:!0,startingIndex:t.current.length,disabledIndices:o})}function $t(t,{startingIndex:o=-1,decrement:r=!1,disabledIndices:a,amount:l=1}={}){let c=o;do c+=r?-l:l;while(c>=0&&c<=t.current.length-1&&Yi(t,c,a));return c}function ED(t,{event:o,orientation:r,loopFocus:a,rtl:l,cols:c,disabledIndices:f,minIndex:d,maxIndex:m,prevIndex:p,stopEvent:y=!1}){let g=p;const v=[],b={};let x=!1;{let C=null,_=-1;t.current.forEach((k,O)=>{if(k==null)return;const z=k.closest('[role="row"]');z&&(x=!0),(z!==C||_===-1)&&(C=z,_+=1,v[_]=[]),v[_].push(O),b[O]=_})}const w=x&&v.length>0&&v.some(C=>C.length!==c);function E(C){if(!w||p===-1)return;const _=b[p];if(_==null)return;const k=v[_].indexOf(p);let O=C==="up"?_-1:_+1;a&&(O<0?O=v.length-1:O>=v.length&&(O=0));const z=new Set;for(;O>=0&&O<v.length&&!z.has(O);){z.add(O);const N=v[O];if(N.length===0){O=C==="up"?O-1:O+1;continue}const j=Math.min(k,N.length-1);for(let D=j;D>=0;D-=1){const Y=N[D];if(!Yi(t,Y,f))return Y}O=C==="up"?O-1:O+1,a&&(O<0?O=v.length-1:O>=v.length&&(O=0))}}if(o.key===Ip){const C=E("up");if(C!==void 0)y&&Jt(o),g=C;else{if(y&&Jt(o),p===-1)g=m;else if(g=$t(t,{startingIndex:g,amount:c,decrement:!0,disabledIndices:f}),a&&(p-c<d||g<0)){const _=p%c,k=m%c,O=m-(k-_);k===_?g=m:g=k>_?O:O-c}qi(t,g)&&(g=p)}}if(o.key===Wi){const C=E("down");C!==void 0?(y&&Jt(o),g=C):(y&&Jt(o),p===-1?g=d:(g=$t(t,{startingIndex:p,amount:c,disabledIndices:f}),a&&p+c>m&&(g=$t(t,{startingIndex:p%c-c,amount:c,disabledIndices:f}))),qi(t,g)&&(g=p))}if(r==="both"){const C=ha(p/c);o.key===(l?Or:_r)&&(y&&Jt(o),p%c!==c-1?(g=$t(t,{startingIndex:p,disabledIndices:f}),a&&Ac(g,c,C)&&(g=$t(t,{startingIndex:p-p%c-1,disabledIndices:f}))):a&&(g=$t(t,{startingIndex:p-p%c-1,disabledIndices:f})),Ac(g,c,C)&&(g=p)),o.key===(l?_r:Or)&&(y&&Jt(o),p%c!==0?(g=$t(t,{startingIndex:p,decrement:!0,disabledIndices:f}),a&&Ac(g,c,C)&&(g=$t(t,{startingIndex:p+(c-p%c),decrement:!0,disabledIndices:f}))):a&&(g=$t(t,{startingIndex:p+(c-p%c),decrement:!0,disabledIndices:f})),Ac(g,c,C)&&(g=p));const _=ha(m/c)===C;qi(t,g)&&(a&&_?g=o.key===(l?_r:Or)?m:$t(t,{startingIndex:p-p%c-1,disabledIndices:f}):g=p)}return g}function RD(t,o,r){const a=[];let l=0;return t.forEach(({width:c,height:f},d)=>{let m=!1;for(;!m;){const p=[];for(let y=0;y<c;y+=1)for(let g=0;g<f;g+=1)p.push(l+y+g*o);l%o+c<=o&&p.every(y=>a[y]==null)?(p.forEach(y=>{a[y]=d}),m=!0):l+=1}}),[...a]}function TD(t,o,r,a,l){if(t===-1)return-1;const c=r.indexOf(t),f=o[t];switch(l){case"tl":return c;case"tr":return f?c+f.width-1:c;case"bl":return f?c+(f.height-1)*a:c;case"br":return r.lastIndexOf(t);default:return-1}}function CD(t,o){return o.flatMap((r,a)=>t.includes(r)?[a]:[])}function Yi(t,o,r){if(typeof r=="function")return r(o);if(r)return r.includes(o);const a=t.current[o];return a?a.hasAttribute("disabled")||a.getAttribute("aria-disabled")==="true":!1}var MD=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],mu=MD.join(","),Yx=typeof Element>"u",_a=Yx?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,gu=!Yx&&Element.prototype.getRootNode?function(t){var o;return t==null||(o=t.getRootNode)===null||o===void 0?void 0:o.call(t)}:function(t){return t?.ownerDocument},yu=function(o,r){var a;r===void 0&&(r=!0);var l=o==null||(a=o.getAttribute)===null||a===void 0?void 0:a.call(o,"inert"),c=l===""||l==="true",f=c||r&&o&&(typeof o.closest=="function"?o.closest("[inert]"):yu(o.parentNode));return f},OD=function(o){var r,a=o==null||(r=o.getAttribute)===null||r===void 0?void 0:r.call(o,"contenteditable");return a===""||a==="true"},Gx=function(o,r,a){if(yu(o))return[];var l=Array.prototype.slice.apply(o.querySelectorAll(mu));return r&&_a.call(o,mu)&&l.unshift(o),l=l.filter(a),l},vu=function(o,r,a){for(var l=[],c=Array.from(o);c.length;){var f=c.shift();if(!yu(f,!1))if(f.tagName==="SLOT"){var d=f.assignedElements(),m=d.length?d:f.children,p=vu(m,!0,a);a.flatten?l.push.apply(l,p):l.push({scopeParent:f,candidates:p})}else{var y=_a.call(f,mu);y&&a.filter(f)&&(r||!o.includes(f))&&l.push(f);var g=f.shadowRoot||typeof a.getShadowRoot=="function"&&a.getShadowRoot(f),v=!yu(g,!1)&&(!a.shadowRootFilter||a.shadowRootFilter(f));if(g&&v){var b=vu(g===!0?f.children:g.children,!0,a);a.flatten?l.push.apply(l,b):l.push({scopeParent:f,candidates:b})}else c.unshift.apply(c,f.children)}}return l},Fx=function(o){return!isNaN(parseInt(o.getAttribute("tabindex"),10))},Xx=function(o){if(!o)throw new Error("No node provided");return o.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(o.tagName)||OD(o))&&!Fx(o)?0:o.tabIndex},_D=function(o,r){var a=Xx(o);return a<0&&r&&!Fx(o)?0:a},AD=function(o,r){return o.tabIndex===r.tabIndex?o.documentOrder-r.documentOrder:o.tabIndex-r.tabIndex},Kx=function(o){return o.tagName==="INPUT"},DD=function(o){return Kx(o)&&o.type==="hidden"},kD=function(o){var r=o.tagName==="DETAILS"&&Array.prototype.slice.apply(o.children).some(function(a){return a.tagName==="SUMMARY"});return r},zD=function(o,r){for(var a=0;a<o.length;a++)if(o[a].checked&&o[a].form===r)return o[a]},ND=function(o){if(!o.name)return!0;var r=o.form||gu(o),a=function(d){return r.querySelectorAll('input[type="radio"][name="'+d+'"]')},l;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")l=a(window.CSS.escape(o.name));else try{l=a(o.name)}catch(f){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",f.message),!1}var c=zD(l,o.form);return!c||c===o},LD=function(o){return Kx(o)&&o.type==="radio"},jD=function(o){return LD(o)&&!ND(o)},PD=function(o){var r,a=o&&gu(o),l=(r=a)===null||r===void 0?void 0:r.host,c=!1;if(a&&a!==o){var f,d,m;for(c=!!((f=l)!==null&&f!==void 0&&(d=f.ownerDocument)!==null&&d!==void 0&&d.contains(l)||o!=null&&(m=o.ownerDocument)!==null&&m!==void 0&&m.contains(o));!c&&l;){var p,y,g;a=gu(l),l=(p=a)===null||p===void 0?void 0:p.host,c=!!((y=l)!==null&&y!==void 0&&(g=y.ownerDocument)!==null&&g!==void 0&&g.contains(l))}}return c},p0=function(o){var r=o.getBoundingClientRect(),a=r.width,l=r.height;return a===0&&l===0},UD=function(o,r){var a=r.displayCheck,l=r.getShadowRoot;if(a==="full-native"&&"checkVisibility"in o){var c=o.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!c}if(getComputedStyle(o).visibility==="hidden")return!0;var f=_a.call(o,"details>summary:first-of-type"),d=f?o.parentElement:o;if(_a.call(d,"details:not([open]) *"))return!0;if(!a||a==="full"||a==="full-native"||a==="legacy-full"){if(typeof l=="function"){for(var m=o;o;){var p=o.parentElement,y=gu(o);if(p&&!p.shadowRoot&&l(p)===!0)return p0(o);o.assignedSlot?o=o.assignedSlot:!p&&y!==o.ownerDocument?o=y.host:o=p}o=m}if(PD(o))return!o.getClientRects().length;if(a!=="legacy-full")return!0}else if(a==="non-zero-area")return p0(o);return!1},BD=function(o){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(o.tagName))for(var r=o.parentElement;r;){if(r.tagName==="FIELDSET"&&r.disabled){for(var a=0;a<r.children.length;a++){var l=r.children.item(a);if(l.tagName==="LEGEND")return _a.call(r,"fieldset[disabled] *")?!0:!l.contains(o)}return!0}r=r.parentElement}return!1},sp=function(o,r){return!(r.disabled||DD(r)||UD(r,o)||kD(r)||BD(r))},ap=function(o,r){return!(jD(r)||Xx(r)<0||!sp(o,r))},ID=function(o){var r=parseInt(o.getAttribute("tabindex"),10);return!!(isNaN(r)||r>=0)},Qx=function(o){var r=[],a=[];return o.forEach(function(l,c){var f=!!l.scopeParent,d=f?l.scopeParent:l,m=_D(d,f),p=f?Qx(l.candidates):d;m===0?f?r.push.apply(r,p):r.push(d):a.push({documentOrder:c,tabIndex:m,item:l,isScope:f,content:p})}),a.sort(AD).reduce(function(l,c){return c.isScope?l.push.apply(l,c.content):l.push(c.content),l},[]).concat(r)},el=function(o,r){r=r||{};var a;return r.getShadowRoot?a=vu([o],r.includeContainer,{filter:ap.bind(null,r),flatten:!1,getShadowRoot:r.getShadowRoot,shadowRootFilter:ID}):a=Gx(o,r.includeContainer,ap.bind(null,r)),Qx(a)},HD=function(o,r){r=r||{};var a;return r.getShadowRoot?a=vu([o],r.includeContainer,{filter:sp.bind(null,r),flatten:!0,getShadowRoot:r.getShadowRoot}):a=Gx(o,r.includeContainer,sp.bind(null,r)),a},Zx=function(o,r){if(r=r||{},!o)throw new Error("No node provided");return _a.call(o,mu)===!1?!1:ap(r,o)};const Pa=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function $x(t,o){const r=el(t,Pa()),a=r.length;if(a===0)return;const l=Zn(at(t)),c=r.indexOf(l),f=c===-1?o===1?0:a-1:c+o;return r[f]}function Yp(t){return $x(at(t).body,1)||t}function Jx(t){return $x(at(t).body,-1)||t}function Wx(t,o){if(!t)return null;const r=el(at(t).body,Pa()),a=r.length;if(a===0)return null;const l=r.indexOf(t);if(l===-1)return null;const c=(l+o+a)%a;return r[c]}function VD(t){return Wx(t,1)}function qD(t){return Wx(t,-1)}function Sa(t,o){const r=o||t.currentTarget,a=t.relatedTarget;return!a||!Ye(r,a)}function YD(t){el(t,Pa()).forEach(r=>{r.dataset.tabindex=r.getAttribute("tabindex")||"",r.setAttribute("tabindex","-1")})}function m0(t){t.querySelectorAll("[data-tabindex]").forEach(r=>{const a=r.dataset.tabindex;delete r.dataset.tabindex,a?r.setAttribute("tabindex",a):r.removeAttribute("tabindex")})}const Dc=null;class GD{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=o=>{this.isScheduled=!1;const r=this.callbacks,a=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,a>0)for(let l=0;l<r.length;l+=1)r[l]?.(o)};request(o){const r=this.nextId;return this.nextId+=1,this.callbacks.push(o),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),r}cancel(o){const r=o-this.startId;r<0||r>=this.callbacks.length||(this.callbacks[r]=null,this.callbacksCount-=1)}}const kc=new GD;class oo{static create(){return new oo}static request(o){return kc.request(o)}static cancel(o){return kc.cancel(o)}currentId=Dc;request(o){this.cancel(),this.currentId=kc.request(()=>{this.currentId=Dc,o()})}cancel=()=>{this.currentId!==Dc&&(kc.cancel(this.currentId),this.currentId=Dc)};disposeEffect=()=>this.cancel}function Gp(){const t=Wt(oo.create).current;return Bp(t.disposeEffect),t}function zo(t){return t==null?t:"current"in t?t.current:t}let Qi=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const FD={[Qi.startingStyle]:""},XD={[Qi.endingStyle]:""},Bu={transitionStatus(t){return t==="starting"?FD:t==="ending"?XD:null}};function KD(t,o=!1,r=!0){const a=Gp();return Ce((l,c=null)=>{a.cancel();function f(){io.flushSync(l)}const d=zo(t);if(d==null)return;const m=d;if(typeof m.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)l();else{let p=function(){const g=Qi.startingStyle;if(!m.hasAttribute(g)){a.request(y);return}const v=new MutationObserver(()=>{m.hasAttribute(g)||(v.disconnect(),y())});v.observe(m,{attributes:!0,attributeFilter:[g]}),c?.addEventListener("abort",()=>v.disconnect(),{once:!0})},y=function(){Promise.all(m.getAnimations().map(g=>g.finished)).then(()=>{c?.aborted||f()}).catch(()=>{const g=m.getAnimations();if(r){if(c?.aborted)return;f()}else g.length>0&&g.some(v=>v.pending||v.playState!=="finished")&&y()})};if(o){p();return}a.request(y)}})}function Iu(t){const{enabled:o=!0,open:r,ref:a,onComplete:l}=t,c=Ce(l),f=KD(a,r,!1);R.useEffect(()=>{if(!o)return;const d=new AbortController;return f(c,d.signal),()=>{d.abort()}},[o,r,c,f])}function QD(t,o=!1,r=!1){const[a,l]=R.useState(t&&o?"idle":void 0),[c,f]=R.useState(t);return t&&!c&&(f(!0),l("starting")),!t&&c&&a!=="ending"&&!r&&l("ending"),!t&&!c&&a==="ending"&&l(void 0),Ae(()=>{if(!t&&c&&a!=="ending"&&r){const d=oo.request(()=>{l("ending")});return()=>{oo.cancel(d)}}},[t,c,a,r]),Ae(()=>{if(!t||o)return;const d=oo.request(()=>{l(void 0)});return()=>{oo.cancel(d)}},[o,t]),Ae(()=>{if(!t||!o)return;t&&c&&a!=="idle"&&l("starting");const d=oo.request(()=>{l("idle")});return()=>{oo.cancel(d)}},[o,t,c,l,a]),R.useMemo(()=>({mounted:c,setMounted:f,transitionStatus:a}),[c,a])}const Fp="none",Aa="trigger-press",sn="trigger-hover",xa="trigger-focus",Xp="outside-press",ew="item-press",ZD="close-press",Da="focus-out",Hu="escape-key",Fc="list-navigation",$D="cancel-open",Xc="sibling-open",JD="disabled",Kp="imperative-action";function Qe(t,o,r,a){let l=!1,c=!1;const f=qt;return{reason:t,event:o??new Event("base-ui"),cancel(){l=!0},allowPropagation(){c=!0},get isCanceled(){return l},get isPropagationAllowed(){return c},trigger:r,...f}}const WD=R.forwardRef(function(o,r){const{className:a,render:l,orientation:c="horizontal",...f}=o;return Mt("div",o,{state:{orientation:c},ref:r,props:[{role:"separator","aria-orientation":c},f]})}),tw=R.createContext(void 0);function ws(t){const o=R.useContext(tw);if(t===!1&&o===void 0)throw new Error(tn(27));return o}let is=(function(t){return t.open="data-open",t.closed="data-closed",t[t.startingStyle=Qi.startingStyle]="startingStyle",t[t.endingStyle=Qi.endingStyle]="endingStyle",t.anchorHidden="data-anchor-hidden",t.side="data-side",t.align="data-align",t})({}),bu=(function(t){return t.popupOpen="data-popup-open",t.pressed="data-pressed",t})({});const ek={[bu.popupOpen]:""},tk={[bu.popupOpen]:"",[bu.pressed]:""},nk={[is.open]:""},ok={[is.closed]:""},rk={[is.anchorHidden]:""},nw={open(t){return t?ek:null}},g0={open(t){return t?tk:null}},Es={open(t){return t?nk:ok},anchorHidden(t){return t?rk:null}},sk={...Es,...Bu},ak=R.forwardRef(function(o,r){const{render:a,className:l,forceRender:c=!1,...f}=o,{store:d}=ws(),m=d.useState("open"),p=d.useState("nested"),y=d.useState("mounted"),g=d.useState("transitionStatus");return Mt("div",o,{state:{open:m,transitionStatus:g},ref:[d.context.backdropRef,r],stateAttributesMapping:sk,props:[{role:"presentation",hidden:!y,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:c||!p})}),ik=R.forwardRef(function(o,r){const{render:a,className:l,disabled:c=!1,nativeButton:f=!0,...d}=o,{store:m}=ws(),p=m.useState("open");function y(x){p&&m.setOpen(!1,Qe(ZD,x.nativeEvent))}const{getButtonProps:g,buttonRef:v}=Pu({disabled:c,native:f});return Mt("button",o,{state:{disabled:c},ref:[r,v],props:[{onClick:y},d,g]})}),lk=R.forwardRef(function(o,r){const{render:a,className:l,id:c,...f}=o,{store:d}=ws(),m=xs(c);return d.useSyncedValueWithCleanup("descriptionElementId",m),Mt("p",o,{ref:r,props:[{id:m},f]})});function an(t){const o=Wt(ck,t).current;return o.next=t,Ae(o.effect),o}function ck(t){const o={current:t,next:t,effect:()=>{o.current=o.next}};return o}function ow(){const t=new Map;return{emit(o,r){t.get(o)?.forEach(a=>a(r))},on(o,r){t.has(o)||t.set(o,new Set),t.get(o).add(r)},off(o,r){t.get(o)?.delete(r)}}}class Qp{nodesRef={current:[]};events=ow();addNode(o){this.nodesRef.current.push(o)}removeNode(o){const r=this.nodesRef.current.findIndex(a=>a===o);r!==-1&&this.nodesRef.current.splice(r,1)}}const rw=R.createContext(null),sw=R.createContext(null),Vo=()=>R.useContext(rw)?.id||null,Pr=t=>{const o=R.useContext(sw);return t??o};function aw(t){const o=Ss(),r=Pr(t),a=Vo();return Ae(()=>{if(!o)return;const l={id:o,parentId:a};return r?.addNode(l),()=>{r?.removeNode(l)}},[r,o,a]),o}function uk(t){const{children:o,id:r}=t,a=Vo();return L.jsx(rw.Provider,{value:R.useMemo(()=>({id:r,parentId:a}),[r,a]),children:o})}function fk(t){const{children:o,externalTree:r}=t,a=Wt(()=>r??new Qp).current;return L.jsx(sw.Provider,{value:a,children:o})}function ka(t){return`data-base-ui-${t}`}function Kc(t,o,r){if(r&&!ms(r))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const a=t();return typeof a=="number"?a:a?.[o]}return t?.[o]}const iw=R.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new co,currentIdRef:{current:null},currentContextRef:{current:null}});function dk(t){const{children:o,delay:r,timeoutMs:a=0}=t,l=R.useRef(r),c=R.useRef(r),f=R.useRef(null),d=R.useRef(null),m=qn();return L.jsx(iw.Provider,{value:R.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:f,timeoutMs:a,currentContextRef:d,timeout:m}),[a,m]),children:o})}function hk(t,o={open:!1}){const r="rootStore"in t?t.rootStore:t,a=r.useState("floatingId"),{open:l}=o,c=R.useContext(iw),{currentIdRef:f,delayRef:d,timeoutMs:m,initialDelayRef:p,currentContextRef:y,hasProvider:g,timeout:v}=c,[b,x]=R.useState(!1);return Ae(()=>{function w(){x(!1),y.current?.setIsInstantPhase(!1),f.current=null,y.current=null,d.current=p.current}if(f.current&&!l&&f.current===a){if(x(!1),m){const E=a;return v.start(m,()=>{r.select("open")||f.current&&f.current!==E||w()}),()=>{v.clear()}}w()}},[l,a,f,d,m,p,y,v,r]),Ae(()=>{if(!l)return;const w=y.current,E=f.current;v.clear(),y.current={onOpenChange:r.setOpen,setIsInstantPhase:x},f.current=a,d.current={open:0,close:Kc(p.current,"close")},E!==null&&E!==a?(x(!0),w?.setIsInstantPhase(!0),w?.onOpenChange(!1,Qe(Fp))):(x(!1),w?.setIsInstantPhase(!1))},[l,a,r,f,d,m,p,y,v]),Ae(()=>()=>{y.current=null},[y]),R.useMemo(()=>({hasProvider:g,delayRef:d,isInstantPhase:b}),[g,d,b])}const pk={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},lw={...pk,position:"fixed",top:0,left:0},za=R.forwardRef(function(o,r){const[a,l]=R.useState();Ae(()=>{Lx&&l("button")},[]);const c={tabIndex:0,role:a};return L.jsx("span",{...o,ref:r,style:lw,"aria-hidden":a?void 0:!0,...c,"data-base-ui-focus-guard":""})});let y0=0;function Gi(t,o={}){const{preventScroll:r=!1,cancelPrevious:a=!0,sync:l=!1}=o;a&&cancelAnimationFrame(y0);const c=()=>t?.focus({preventScroll:r});l?c():y0=requestAnimationFrame(c)}const wa={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function v0(t){return t==="inert"?wa.inert:t==="aria-hidden"?wa["aria-hidden"]:wa.none}let zc=new WeakSet,Nc={},Ah=0;const cw=t=>t&&(t.host||cw(t.parentNode)),mk=(t,o)=>o.map(r=>{if(t.contains(r))return r;const a=cw(r);return t.contains(a)?a:null}).filter(r=>r!=null);function gk(t,o,r,a){const l="data-base-ui-inert",c=a?"inert":r?"aria-hidden":null,f=mk(o,t),d=new Set,m=new Set(f),p=[];Nc[l]||(Nc[l]=new WeakMap);const y=Nc[l];f.forEach(g),v(o),d.clear();function g(b){!b||d.has(b)||(d.add(b),b.parentNode&&g(b.parentNode))}function v(b){!b||m.has(b)||[].forEach.call(b.children,x=>{if(zr(x)!=="script")if(d.has(x))v(x);else{const w=c?x.getAttribute(c):null,E=w!==null&&w!=="false",C=v0(c),_=(C.get(x)||0)+1,k=(y.get(x)||0)+1;C.set(x,_),y.set(x,k),p.push(x),_===1&&E&&zc.add(x),k===1&&x.setAttribute(l,""),!E&&c&&x.setAttribute(c,c==="inert"?"":"true")}})}return Ah+=1,()=>{p.forEach(b=>{const x=v0(c),E=(x.get(b)||0)-1,C=(y.get(b)||0)-1;x.set(b,E),y.set(b,C),E||(!zc.has(b)&&c&&b.removeAttribute(c),zc.delete(b)),C||b.removeAttribute(l)}),Ah-=1,Ah||(wa.inert=new WeakMap,wa["aria-hidden"]=new WeakMap,wa.none=new WeakMap,zc=new WeakSet,Nc={})}}function yk(t,o=!1,r=!1){const a=at(t[0]).body;return gk(t.concat(Array.from(a.querySelectorAll("[aria-live]"))),a,o,r)}const uw=R.createContext(null),fw=()=>R.useContext(uw),vk=ka("portal");function dw(t={}){const{ref:o,container:r,componentProps:a=qt,elementProps:l}=t,c=Ss(),d=fw()?.portalNode,[m,p]=R.useState(null),[y,g]=R.useState(null),v=Ce(E=>{E!==null&&g(E)}),b=R.useRef(null);Ae(()=>{if(r===null){b.current&&(b.current=null,g(null),p(null));return}if(c==null)return;const E=(r&&(Np(r)?r:r.current))??d??document.body;if(E==null){b.current&&(b.current=null,g(null),p(null));return}b.current!==E&&(b.current=E,g(null),p(E))},[r,d,c]);const x=Mt("div",a,{ref:[o,v],props:[{id:c,[vk]:""},l]});return{portalNode:y,portalSubtree:m&&x?io.createPortal(x,m):null}}const hw=R.forwardRef(function(o,r){const{children:a,container:l,className:c,render:f,renderGuards:d,...m}=o,{portalNode:p,portalSubtree:y}=dw({container:l,ref:r,componentProps:o,elementProps:m}),g=R.useRef(null),v=R.useRef(null),b=R.useRef(null),x=R.useRef(null),[w,E]=R.useState(null),C=w?.modal,_=w?.open,k=typeof d=="boolean"?d:!!w&&!w.modal&&w.open&&!!p;R.useEffect(()=>{if(!p||C)return;function z(N){p&&N.relatedTarget&&Sa(N)&&(N.type==="focusin"?m0:YD)(p)}return p.addEventListener("focusin",z,!0),p.addEventListener("focusout",z,!0),()=>{p.removeEventListener("focusin",z,!0),p.removeEventListener("focusout",z,!0)}},[p,C]),R.useEffect(()=>{!p||_||m0(p)},[_,p]);const O=R.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:v,beforeInsideRef:b,afterInsideRef:x,portalNode:p,setFocusManagerState:E}),[p]);return L.jsxs(R.Fragment,{children:[y,L.jsxs(uw.Provider,{value:O,children:[k&&p&&L.jsx(za,{"data-type":"outside",ref:g,onFocus:z=>{if(Sa(z,p))b.current?.focus();else{const N=w?w.domReference:null;Jx(N)?.focus()}}}),k&&p&&L.jsx("span",{"aria-owns":p.id,style:YA}),p&&io.createPortal(a,p),k&&p&&L.jsx(za,{"data-type":"outside",ref:v,onFocus:z=>{if(Sa(z,p))x.current?.focus();else{const N=w?w.domReference:null;Yp(N)?.focus(),w?.closeOnFocusOut&&w?.onOpenChange(!1,Qe(Da,z.nativeEvent))}}})]})]})});function bk(t,o){const r=zt(t.target);return t instanceof r.KeyboardEvent?"keyboard":t instanceof r.FocusEvent?o||"keyboard":"pointerType"in t?t.pointerType||"keyboard":"touches"in t?"touch":t instanceof r.MouseEvent?o||(t.detail===0?"keyboard":"mouse"):""}const b0=20;let Rr=[];function Zp(){Rr=Rr.filter(t=>t.deref()?.isConnected)}function Sk(t){Zp(),t&&zr(t)!=="body"&&(Rr.push(new WeakRef(t)),Rr.length>b0&&(Rr=Rr.slice(-b0)))}function Dh(){return Zp(),Rr[Rr.length-1]?.deref()}function xk(t){if(!t)return null;const o=Pa();return Zx(t,o)?t:el(t,o)[0]||t}function wk(t){return!t||!t.isConnected?!1:typeof t.checkVisibility=="function"?t.checkVisibility():On(t).display!=="none"}function S0(t,o){if(!o.current.includes("floating")&&!t.getAttribute("role")?.includes("dialog"))return;const r=Pa(),l=HD(t,r).filter(f=>{const d=f.getAttribute("data-tabindex")||"";return Zx(f,r)||f.hasAttribute("data-tabindex")&&!d.startsWith("-")}),c=t.getAttribute("tabindex");o.current.includes("floating")||l.length===0?c!=="0"&&t.setAttribute("tabindex","0"):(c!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}function pw(t){const{context:o,children:r,disabled:a=!1,initialFocus:l=!0,returnFocus:c=!0,restoreFocus:f=!1,modal:d=!0,closeOnFocusOut:m=!0,openInteractionType:p="",nextFocusableElement:y,previousFocusableElement:g,beforeContentFocusGuardRef:v,externalTree:b}=t,x="rootStore"in o?o.rootStore:o,w=x.useState("open"),E=x.useState("domReferenceElement"),C=x.useState("floatingElement"),{events:_,dataRef:k}=x.context,O=Ce(()=>k.current.floatingContext?.nodeId),z=l===!1,N=np(E)&&z,j=R.useRef(["content"]),D=an(l),Y=an(c),$=an(p),Z=Pr(b),V=fw(),J=R.useRef(null),ne=R.useRef(null),ae=R.useRef(!1),B=R.useRef(!1),H=R.useRef(!1),G=R.useRef(-1),ce=R.useRef(""),W=R.useRef(""),P=R.useRef(null),X=R.useRef(null),le=Ma(P,v,V?.beforeInsideRef),re=Ma(X,V?.afterInsideRef),ue=qn(),he=qn(),ve=Gp(),Me=V!=null,fe=fu(C),ze=Ce((me=fe)=>me?el(me,Pa()):[]),je=Ce(me=>{const pe=ze(me);return j.current.map(()=>pe).filter(Boolean).flat()});R.useEffect(()=>{if(a||!d)return;function me(Ne){Ne.key==="Tab"&&Ye(fe,Zn(at(fe)))&&ze().length===0&&!N&&Jt(Ne)}const pe=at(fe);return pe.addEventListener("keydown",me),()=>{pe.removeEventListener("keydown",me)}},[a,E,fe,d,j,N,ze,je]),R.useEffect(()=>{if(a||!w)return;const me=at(fe);function pe(){H.current=!1}function Ne(Se){const ye=rn(Se),de=Ye(C,ye)||Ye(E,ye)||Ye(V?.portalNode,ye);H.current=!de,W.current=Se.pointerType||"keyboard",ye?.closest(`[${VA}]`)&&(B.current=!0)}function be(){W.current="keyboard"}return me.addEventListener("pointerdown",Ne,!0),me.addEventListener("pointerup",pe,!0),me.addEventListener("pointercancel",pe,!0),me.addEventListener("keydown",be,!0),()=>{me.removeEventListener("pointerdown",Ne,!0),me.removeEventListener("pointerup",pe,!0),me.removeEventListener("pointercancel",pe,!0),me.removeEventListener("keydown",be,!0)}},[a,C,E,fe,w,V]),R.useEffect(()=>{if(a||!m)return;const me=at(fe);function pe(){B.current=!0,he.start(0,()=>{B.current=!1})}function Ne(we){const ge=rn(we),qe=ze().indexOf(ge);qe!==-1&&(G.current=qe)}function be(we){const ge=we.relatedTarget,De=we.currentTarget,qe=rn(we);queueMicrotask(()=>{const Be=O(),Ot=x.context.triggerElements,He=ge?.hasAttribute(ka("focus-guard"))&&[P.current,X.current,V?.beforeInsideRef.current,V?.afterInsideRef.current,V?.beforeOutsideRef.current,V?.afterOutsideRef.current,zo(g),zo(y)].includes(ge),Je=!(Ye(E,ge)||Ye(C,ge)||Ye(ge,C)||Ye(V?.portalNode,ge)||ge!=null&&Ot.hasElement(ge)||Ot.hasMatchingElement(Pe=>Ye(Pe,ge))||He||Z&&(us(Z.nodesRef.current,Be).find(Pe=>Ye(Pe.context?.elements.floating,ge)||Ye(Pe.context?.elements.domReference,ge))||u0(Z.nodesRef.current,Be).find(Pe=>[Pe.context?.elements.floating,fu(Pe.context?.elements.floating)].includes(ge)||Pe.context?.elements.domReference===ge)));if(De===E&&fe&&S0(fe,j),f&&De!==E&&!wk(qe)&&Zn(me)===me.body){if(St(fe)&&(fe.focus(),f==="popup")){ve.request(()=>{fe.focus()});return}const Pe=G.current,Et=ze(),Qt=Et[Pe]||Et[Et.length-1]||fe;St(Qt)&&Qt.focus()}if(k.current.insideReactTree){k.current.insideReactTree=!1;return}(N||!d)&&ge&&Je&&!B.current&&(N||ge!==Dh())&&(ae.current=!0,x.setOpen(!1,Qe(Da,we)))})}function Se(){H.current||(k.current.insideReactTree=!0,ue.start(0,()=>{k.current.insideReactTree=!1}))}const ye=St(E)?E:null,de=[];if(!(!C&&!ye))return ye&&(ye.addEventListener("focusout",be),ye.addEventListener("pointerdown",pe),de.push(()=>{ye.removeEventListener("focusout",be),ye.removeEventListener("pointerdown",pe)})),C&&(C.addEventListener("focusin",Ne),C.addEventListener("focusout",be),V&&(C.addEventListener("focusout",Se,!0),de.push(()=>{C.removeEventListener("focusout",Se,!0)})),de.push(()=>{C.removeEventListener("focusin",Ne),C.removeEventListener("focusout",be)})),()=>{de.forEach(we=>{we()})}},[a,E,C,fe,d,Z,V,x,m,f,ze,N,O,j,k,ue,he,ve,y,g]),R.useEffect(()=>{if(a||!C||!w)return;const me=Array.from(V?.portalNode?.querySelectorAll(`[${ka("portal")}]`)||[]),Ne=(Z?u0(Z.nodesRef.current,O()):[]).find(Se=>np(Se.context?.elements.domReference||null))?.context?.elements.domReference,be=[C,Ne,...me,J.current,ne.current,P.current,X.current,V?.beforeOutsideRef.current,V?.afterOutsideRef.current,zo(g),zo(y),N?E:null].filter(Se=>Se!=null);return yk(be,d||N)},[w,a,E,C,d,j,V,N,Z,O,y,g]),Ae(()=>{if(!w||a||!St(fe))return;const me=at(fe),pe=Zn(me);queueMicrotask(()=>{const Ne=je(fe),be=D.current,Se=typeof be=="function"?be($.current||""):be;if(Se===void 0||Se===!1)return;let ye;Se===!0||Se===null?ye=Ne[0]||fe:ye=zo(Se),ye=ye||Ne[0]||fe,!Ye(fe,pe)&&Gi(ye,{preventScroll:ye===fe})})},[a,w,fe,z,je,D,$]),Ae(()=>{if(a||!fe)return;const me=at(fe),pe=Zn(me);Sk(pe);function Ne(ye){if(ye.open||(ce.current=bk(ye.nativeEvent,W.current)),ye.reason===sn&&ye.nativeEvent.type==="mouseleave"&&(ae.current=!0),ye.reason===Xp)if(ye.nested)ae.current=!1;else if(Ix(ye.nativeEvent)||Hx(ye.nativeEvent))ae.current=!1;else{let de=!1;document.createElement("div").focus({get preventScroll(){return de=!0,!1}}),de?ae.current=!1:ae.current=!0}}_.on("openchange",Ne);const be=me.createElement("span");be.setAttribute("tabindex","-1"),be.setAttribute("aria-hidden","true"),Object.assign(be.style,lw),Me&&E&&E.insertAdjacentElement("afterend",be);function Se(){const ye=Y.current;let de=typeof ye=="function"?ye(ce.current):ye;if(de===void 0||de===!1)return null;if(de===null&&(de=!0),typeof de=="boolean"){const ge=E||Dh();return ge&&ge.isConnected?ge:be}const we=E||Dh()||be;return zo(de)||we}return()=>{_.off("openchange",Ne);const ye=Zn(me),de=Ye(C,ye)||Z&&us(Z.nodesRef.current,O(),!1).some(ge=>Ye(ge.context?.elements.floating,ye)),we=Se();queueMicrotask(()=>{const ge=xk(we),De=typeof Y.current!="boolean";Y.current&&!ae.current&&St(ge)&&(!(!De&&ge!==ye&&ye!==me.body)||de)&&ge.focus({preventScroll:!0}),be.remove(),ae.current=!1})}},[a,C,fe,Y,k,_,Z,Me,E,O]),Ae(()=>{if(!zx||w||!C)return;const me=Zn(at(C));!St(me)||!Uu(me)||Ye(C,me)&&me.blur()},[w,C]),Ae(()=>{if(!(a||!V))return V.setFocusManagerState({modal:d,closeOnFocusOut:m,open:w,onOpenChange:x.setOpen,domReference:E}),()=>{V.setFocusManagerState(null)}},[a,V,d,w,x,m,E]),Ae(()=>{if(!(a||!fe))return S0(fe,j),()=>{queueMicrotask(Zp)}},[a,fe,j]);const te=!a&&(d?!N:!0)&&(Me||d);return L.jsxs(R.Fragment,{children:[te&&L.jsx(za,{"data-type":"inside",ref:le,onFocus:me=>{if(d){const pe=je();Gi(pe[pe.length-1])}else V?.portalNode&&(ae.current=!1,Sa(me,V.portalNode)?Yp(E)?.focus():zo(g??V.beforeOutsideRef)?.focus())}}),r,te&&L.jsx(za,{"data-type":"inside",ref:re,onFocus:me=>{d?Gi(je()[0]):V?.portalNode&&(m&&(ae.current=!0),Sa(me,V.portalNode)?Jx(E)?.focus():zo(y??V.afterOutsideRef)?.focus())}})]})}function mw(t,o={}){const r="rootStore"in t?t.rootStore:t,a=r.context.dataRef,{enabled:l=!0,event:c="click",toggle:f=!0,ignoreMouse:d=!1,stickIfOpen:m=!0,touchOpenDelay:p=0,reason:y=Aa}=o,g=R.useRef(void 0),v=Gp(),b=qn(),x=R.useMemo(()=>({onPointerDown(w){g.current=w.pointerType},onMouseDown(w){const E=g.current,C=w.nativeEvent,_=r.select("open");if(w.button!==0||c==="click"||ms(E,!0)&&d)return;const k=a.current.openEvent,O=k?.type,z=r.select("domReferenceElement")!==w.currentTarget,N=_&&z||!(_&&f&&(!(k&&m)||O==="click"||O==="mousedown"));if(Uu(C.target)){const D=Qe(y,C,C.target);N&&E==="touch"&&p>0?b.start(p,()=>{r.setOpen(!0,D)}):r.setOpen(N,D);return}const j=w.currentTarget;v.request(()=>{const D=Qe(y,C,j);N&&E==="touch"&&p>0?b.start(p,()=>{r.setOpen(!0,D)}):r.setOpen(N,D)})},onClick(w){if(c==="mousedown-only")return;const E=g.current;if(c==="mousedown"&&E){g.current=void 0;return}if(ms(E,!0)&&d)return;const C=r.select("open"),_=a.current.openEvent,k=r.select("domReferenceElement")!==w.currentTarget,O=C&&k||!(C&&f&&(!(_&&m)||Vx(_))),z=Qe(y,w.nativeEvent,w.currentTarget);O&&E==="touch"&&p>0?b.start(p,()=>{r.setOpen(!0,z)}):r.setOpen(O,z)},onKeyDown(){g.current=void 0}}),[a,c,d,r,m,f,v,b,p,y]);return R.useMemo(()=>l?{reference:x}:qt,[l,x])}function Ek(t,o){let r=null,a=null,l=!1;return{contextElement:t||void 0,getBoundingClientRect(){const c=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},f=o.axis==="x"||o.axis==="both",d=o.axis==="y"||o.axis==="both",m=["mouseenter","mousemove"].includes(o.dataRef.current.openEvent?.type||"")&&o.pointerType!=="touch";let p=c.width,y=c.height,g=c.x,v=c.y;return r==null&&o.x&&f&&(r=c.x-o.x),a==null&&o.y&&d&&(a=c.y-o.y),g-=r||0,v-=a||0,p=0,y=0,!l||m?(p=o.axis==="y"?c.width:0,y=o.axis==="x"?c.height:0,g=f&&o.x!=null?o.x:g,v=d&&o.y!=null?o.y:v):l&&!m&&(y=o.axis==="x"?c.height:y,p=o.axis==="y"?c.width:p),l=!0,{width:p,height:y,x:g,y:v,top:v,right:g+p,bottom:v+y,left:g}}}}function x0(t){return t!=null&&t.clientX!=null}function Rk(t,o={}){const r="rootStore"in t?t.rootStore:t,a=r.useState("open"),l=r.useState("floatingElement"),c=r.useState("domReferenceElement"),f=r.context.dataRef,{enabled:d=!0,axis:m="both"}=o,p=R.useRef(!1),y=R.useRef(null),[g,v]=R.useState(),[b,x]=R.useState([]),w=Ce((O,z,N)=>{p.current||f.current.openEvent&&!x0(f.current.openEvent)||r.set("positionReference",Ek(N??c,{x:O,y:z,axis:m,dataRef:f,pointerType:g}))}),E=Ce(O=>{a?y.current||x([]):w(O.clientX,O.clientY,O.currentTarget)}),C=ms(g)?l:a,_=R.useCallback(()=>{if(!C||!d)return;const O=zt(l);function z(N){const j=rn(N);Ye(l,j)?(O.removeEventListener("mousemove",z),y.current=null):w(N.clientX,N.clientY)}if(!f.current.openEvent||x0(f.current.openEvent)){O.addEventListener("mousemove",z);const N=()=>{O.removeEventListener("mousemove",z),y.current=null};return y.current=N,N}r.set("positionReference",c)},[C,d,l,f,c,r,w]);R.useEffect(()=>_(),[_,b]),R.useEffect(()=>{d&&!l&&(p.current=!1)},[d,l]),R.useEffect(()=>{!d&&a&&(p.current=!0)},[d,a]);const k=R.useMemo(()=>{function O(z){v(z.pointerType)}return{onPointerDown:O,onPointerEnter:O,onMouseMove:E,onMouseEnter:E}},[E]);return R.useMemo(()=>d?{reference:k,trigger:k}:{},[d,k])}function w0(t,o,r){let{reference:a,floating:l}=t;const c=Vn(o),f=qp(o),d=Vp(f),m=vn(o),p=c==="y",y=a.x+a.width/2-l.width/2,g=a.y+a.height/2-l.height/2,v=a[d]/2-l[d]/2;let b;switch(m){case"top":b={x:y,y:a.y-l.height};break;case"bottom":b={x:y,y:a.y+a.height};break;case"right":b={x:a.x+a.width,y:g};break;case"left":b={x:a.x-l.width,y:g};break;default:b={x:a.x,y:a.y}}switch(jr(o)){case"start":b[f]-=v*(r&&p?-1:1);break;case"end":b[f]+=v*(r&&p?-1:1);break}return b}async function Tk(t,o){var r;o===void 0&&(o={});const{x:a,y:l,platform:c,rects:f,elements:d,strategy:m}=t,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:g="floating",altBoundary:v=!1,padding:b=0}=Uo(o,t),x=qx(b),E=d[v?g==="floating"?"reference":"floating":g],C=pu(await c.getClippingRect({element:(r=await(c.isElement==null?void 0:c.isElement(E)))==null||r?E:E.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(d.floating)),boundary:p,rootBoundary:y,strategy:m})),_=g==="floating"?{x:a,y:l,width:f.floating.width,height:f.floating.height}:f.reference,k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(d.floating)),O=await(c.isElement==null?void 0:c.isElement(k))?await(c.getScale==null?void 0:c.getScale(k))||{x:1,y:1}:{x:1,y:1},z=pu(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:_,offsetParent:k,strategy:m}):_);return{top:(C.top-z.top+x.top)/O.y,bottom:(z.bottom-C.bottom+x.bottom)/O.y,left:(C.left-z.left+x.left)/O.x,right:(z.right-C.right+x.right)/O.x}}const Ck=async(t,o,r)=>{const{placement:a="bottom",strategy:l="absolute",middleware:c=[],platform:f}=r,d=c.filter(Boolean),m=await(f.isRTL==null?void 0:f.isRTL(o));let p=await f.getElementRects({reference:t,floating:o,strategy:l}),{x:y,y:g}=w0(p,a,m),v=a,b={},x=0;for(let E=0;E<d.length;E++){var w;const{name:C,fn:_}=d[E],{x:k,y:O,data:z,reset:N}=await _({x:y,y:g,initialPlacement:a,placement:v,strategy:l,middlewareData:b,rects:p,platform:{...f,detectOverflow:(w=f.detectOverflow)!=null?w:Tk},elements:{reference:t,floating:o}});y=k??y,g=O??g,b={...b,[C]:{...b[C],...z}},N&&x<=50&&(x++,typeof N=="object"&&(N.placement&&(v=N.placement),N.rects&&(p=N.rects===!0?await f.getElementRects({reference:t,floating:o,strategy:l}):N.rects),{x:y,y:g}=w0(p,v,m)),E=-1)}return{x:y,y:g,placement:v,strategy:l,middlewareData:b}},Mk=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(o){var r,a;const{placement:l,middlewareData:c,rects:f,initialPlacement:d,platform:m,elements:p}=o,{mainAxis:y=!0,crossAxis:g=!0,fallbackPlacements:v,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:w=!0,...E}=Uo(t,o);if((r=c.arrow)!=null&&r.alignmentOffset)return{};const C=vn(l),_=Vn(d),k=vn(d)===d,O=await(m.isRTL==null?void 0:m.isRTL(p.floating)),z=v||(k||!w?[hu(d)]:yD(d)),N=x!=="none";!v&&N&&z.push(...xD(d,w,x,O));const j=[d,...z],D=await m.detectOverflow(o,E),Y=[];let $=((a=c.flip)==null?void 0:a.overflows)||[];if(y&&Y.push(D[C]),g){const ne=gD(l,f,O);Y.push(D[ne[0]],D[ne[1]])}if($=[...$,{placement:l,overflows:Y}],!Y.every(ne=>ne<=0)){var Z,V;const ne=(((Z=c.flip)==null?void 0:Z.index)||0)+1,ae=j[ne];if(ae&&(!(g==="alignment"?_!==Vn(ae):!1)||$.every(G=>Vn(G.placement)===_?G.overflows[0]>0:!0)))return{data:{index:ne,overflows:$},reset:{placement:ae}};let B=(V=$.filter(H=>H.overflows[0]<=0).sort((H,G)=>H.overflows[1]-G.overflows[1])[0])==null?void 0:V.placement;if(!B)switch(b){case"bestFit":{var J;const H=(J=$.filter(G=>{if(N){const ce=Vn(G.placement);return ce===_||ce==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(ce=>ce>0).reduce((ce,W)=>ce+W,0)]).sort((G,ce)=>G[1]-ce[1])[0])==null?void 0:J[0];H&&(B=H);break}case"initialPlacement":B=d;break}if(l!==B)return{reset:{placement:B}}}return{}}}};function E0(t,o){return{top:t.top-o.height,right:t.right-o.width,bottom:t.bottom-o.height,left:t.left-o.width}}function R0(t){return dD.some(o=>t[o]>=0)}const Ok=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(o){const{rects:r,platform:a}=o,{strategy:l="referenceHidden",...c}=Uo(t,o);switch(l){case"referenceHidden":{const f=await a.detectOverflow(o,{...c,elementContext:"reference"}),d=E0(f,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:R0(d)}}}case"escaped":{const f=await a.detectOverflow(o,{...c,altBoundary:!0}),d=E0(f,r.floating);return{data:{escapedOffsets:d,escaped:R0(d)}}}default:return{}}}}},gw=new Set(["left","top"]);async function _k(t,o){const{placement:r,platform:a,elements:l}=t,c=await(a.isRTL==null?void 0:a.isRTL(l.floating)),f=vn(r),d=jr(r),m=Vn(r)==="y",p=gw.has(f)?-1:1,y=c&&m?-1:1,g=Uo(o,t);let{mainAxis:v,crossAxis:b,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof x=="number"&&(b=d==="end"?x*-1:x),m?{x:b*y,y:v*p}:{x:v*p,y:b*y}}const Ak=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(o){var r,a;const{x:l,y:c,placement:f,middlewareData:d}=o,m=await _k(o,t);return f===((r=d.offset)==null?void 0:r.placement)&&(a=d.arrow)!=null&&a.alignmentOffset?{}:{x:l+m.x,y:c+m.y,data:{...m,placement:f}}}}},Dk=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(o){const{x:r,y:a,placement:l,platform:c}=o,{mainAxis:f=!0,crossAxis:d=!1,limiter:m={fn:C=>{let{x:_,y:k}=C;return{x:_,y:k}}},...p}=Uo(t,o),y={x:r,y:a},g=await c.detectOverflow(o,p),v=Vn(vn(l)),b=Hp(v);let x=y[b],w=y[v];if(f){const C=b==="y"?"top":"left",_=b==="y"?"bottom":"right",k=x+g[C],O=x-g[_];x=op(k,x,O)}if(d){const C=v==="y"?"top":"left",_=v==="y"?"bottom":"right",k=w+g[C],O=w-g[_];w=op(k,w,O)}const E=m.fn({...o,[b]:x,[v]:w});return{...E,data:{x:E.x-r,y:E.y-a,enabled:{[b]:f,[v]:d}}}}}},kk=function(t){return t===void 0&&(t={}),{options:t,fn(o){const{x:r,y:a,placement:l,rects:c,middlewareData:f}=o,{offset:d=0,mainAxis:m=!0,crossAxis:p=!0}=Uo(t,o),y={x:r,y:a},g=Vn(l),v=Hp(g);let b=y[v],x=y[g];const w=Uo(d,o),E=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(m){const k=v==="y"?"height":"width",O=c.reference[v]-c.floating[k]+E.mainAxis,z=c.reference[v]+c.reference[k]-E.mainAxis;b<O?b=O:b>z&&(b=z)}if(p){var C,_;const k=v==="y"?"width":"height",O=gw.has(vn(l)),z=c.reference[g]-c.floating[k]+(O&&((C=f.offset)==null?void 0:C[g])||0)+(O?0:E.crossAxis),N=c.reference[g]+c.reference[k]+(O?0:((_=f.offset)==null?void 0:_[g])||0)-(O?E.crossAxis:0);x<z?x=z:x>N&&(x=N)}return{[v]:b,[g]:x}}}},zk=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(o){var r,a;const{placement:l,rects:c,platform:f,elements:d}=o,{apply:m=()=>{},...p}=Uo(t,o),y=await f.detectOverflow(o,p),g=vn(l),v=jr(l),b=Vn(l)==="y",{width:x,height:w}=c.floating;let E,C;g==="top"||g==="bottom"?(E=g,C=v===(await(f.isRTL==null?void 0:f.isRTL(d.floating))?"start":"end")?"left":"right"):(C=g,E=v==="end"?"top":"bottom");const _=w-y.top-y.bottom,k=x-y.left-y.right,O=Oa(w-y[E],_),z=Oa(x-y[C],k),N=!o.middlewareData.shift;let j=O,D=z;if((r=o.middlewareData.shift)!=null&&r.enabled.x&&(D=k),(a=o.middlewareData.shift)!=null&&a.enabled.y&&(j=_),N&&!v){const $=Mn(y.left,0),Z=Mn(y.right,0),V=Mn(y.top,0),J=Mn(y.bottom,0);b?D=x-2*($!==0||Z!==0?$+Z:Mn(y.left,y.right)):j=w-2*(V!==0||J!==0?V+J:Mn(y.top,y.bottom))}await m({...o,availableWidth:D,availableHeight:j});const Y=await f.getDimensions(d.floating);return x!==Y.width||w!==Y.height?{reset:{rects:!0}}:{}}}};function yw(t){const o=On(t);let r=parseFloat(o.width)||0,a=parseFloat(o.height)||0;const l=St(t),c=l?t.offsetWidth:r,f=l?t.offsetHeight:a,d=du(r)!==c||du(a)!==f;return d&&(r=c,a=f),{width:r,height:a,$:d}}function $p(t){return st(t)?t:t.contextElement}function Ea(t){const o=$p(t);if(!St(o))return so(1);const r=o.getBoundingClientRect(),{width:a,height:l,$:c}=yw(o);let f=(c?du(r.width):r.width)/a,d=(c?du(r.height):r.height)/l;return(!f||!Number.isFinite(f))&&(f=1),(!d||!Number.isFinite(d))&&(d=1),{x:f,y:d}}const Nk=so(0);function vw(t){const o=zt(t);return!Lu()||!o.visualViewport?Nk:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function Lk(t,o,r){return o===void 0&&(o=!1),!r||o&&r!==zt(t)?!1:o}function gs(t,o,r,a){o===void 0&&(o=!1),r===void 0&&(r=!1);const l=t.getBoundingClientRect(),c=$p(t);let f=so(1);o&&(a?st(a)&&(f=Ea(a)):f=Ea(t));const d=Lk(c,r,a)?vw(c):so(0);let m=(l.left+d.x)/f.x,p=(l.top+d.y)/f.y,y=l.width/f.x,g=l.height/f.y;if(c){const v=zt(c),b=a&&st(a)?zt(a):a;let x=v,w=Jh(x);for(;w&&a&&b!==x;){const E=Ea(w),C=w.getBoundingClientRect(),_=On(w),k=C.left+(w.clientLeft+parseFloat(_.paddingLeft))*E.x,O=C.top+(w.clientTop+parseFloat(_.paddingTop))*E.y;m*=E.x,p*=E.y,y*=E.x,g*=E.y,m+=k,p+=O,x=zt(w),w=Jh(x)}}return pu({width:y,height:g,x:m,y:p})}function Vu(t,o){const r=ju(t).scrollLeft;return o?o.left+r:gs(uo(t)).left+r}function bw(t,o){const r=t.getBoundingClientRect(),a=r.left+o.scrollLeft-Vu(t,r),l=r.top+o.scrollTop;return{x:a,y:l}}function jk(t){let{elements:o,rect:r,offsetParent:a,strategy:l}=t;const c=l==="fixed",f=uo(a),d=o?Nu(o.floating):!1;if(a===f||d&&c)return r;let m={scrollLeft:0,scrollTop:0},p=so(1);const y=so(0),g=St(a);if((g||!g&&!c)&&((zr(a)!=="body"||Nr(f))&&(m=ju(a)),St(a))){const b=gs(a);p=Ea(a),y.x=b.x+a.clientLeft,y.y=b.y+a.clientTop}const v=f&&!g&&!c?bw(f,m):so(0);return{width:r.width*p.x,height:r.height*p.y,x:r.x*p.x-m.scrollLeft*p.x+y.x+v.x,y:r.y*p.y-m.scrollTop*p.y+y.y+v.y}}function Pk(t){return Array.from(t.getClientRects())}function Uk(t){const o=uo(t),r=ju(t),a=t.ownerDocument.body,l=Mn(o.scrollWidth,o.clientWidth,a.scrollWidth,a.clientWidth),c=Mn(o.scrollHeight,o.clientHeight,a.scrollHeight,a.clientHeight);let f=-r.scrollLeft+Vu(t);const d=-r.scrollTop;return On(a).direction==="rtl"&&(f+=Mn(o.clientWidth,a.clientWidth)-l),{width:l,height:c,x:f,y:d}}const T0=25;function Bk(t,o){const r=zt(t),a=uo(t),l=r.visualViewport;let c=a.clientWidth,f=a.clientHeight,d=0,m=0;if(l){c=l.width,f=l.height;const y=Lu();(!y||y&&o==="fixed")&&(d=l.offsetLeft,m=l.offsetTop)}const p=Vu(a);if(p<=0){const y=a.ownerDocument,g=y.body,v=getComputedStyle(g),b=y.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,x=Math.abs(a.clientWidth-g.clientWidth-b);x<=T0&&(c-=x)}else p<=T0&&(c+=p);return{width:c,height:f,x:d,y:m}}const Ik=new Set(["absolute","fixed"]);function Hk(t,o){const r=gs(t,!0,o==="fixed"),a=r.top+t.clientTop,l=r.left+t.clientLeft,c=St(t)?Ea(t):so(1),f=t.clientWidth*c.x,d=t.clientHeight*c.y,m=l*c.x,p=a*c.y;return{width:f,height:d,x:m,y:p}}function C0(t,o,r){let a;if(o==="viewport")a=Bk(t,r);else if(o==="document")a=Uk(uo(t));else if(st(o))a=Hk(o,r);else{const l=vw(t);a={x:o.x-l.x,y:o.y-l.y,width:o.width,height:o.height}}return pu(a)}function Sw(t,o){const r=lo(t);return r===o||!st(r)||ro(r)?!1:On(r).position==="fixed"||Sw(r,o)}function Vk(t,o){const r=o.get(t);if(r)return r;let a=Mr(t,[],!1).filter(d=>st(d)&&zr(d)!=="body"),l=null;const c=On(t).position==="fixed";let f=c?lo(t):t;for(;st(f)&&!ro(f);){const d=On(f),m=Lp(f);!m&&d.position==="fixed"&&(l=null),(c?!m&&!l:!m&&d.position==="static"&&!!l&&Ik.has(l.position)||Nr(f)&&!m&&Sw(t,f))?a=a.filter(y=>y!==f):l=d,f=lo(f)}return o.set(t,a),a}function qk(t){let{element:o,boundary:r,rootBoundary:a,strategy:l}=t;const f=[...r==="clippingAncestors"?Nu(o)?[]:Vk(o,this._c):[].concat(r),a],d=f[0],m=f.reduce((p,y)=>{const g=C0(o,y,l);return p.top=Mn(g.top,p.top),p.right=Oa(g.right,p.right),p.bottom=Oa(g.bottom,p.bottom),p.left=Mn(g.left,p.left),p},C0(o,d,l));return{width:m.right-m.left,height:m.bottom-m.top,x:m.left,y:m.top}}function Yk(t){const{width:o,height:r}=yw(t);return{width:o,height:r}}function Gk(t,o,r){const a=St(o),l=uo(o),c=r==="fixed",f=gs(t,!0,c,o);let d={scrollLeft:0,scrollTop:0};const m=so(0);function p(){m.x=Vu(l)}if(a||!a&&!c)if((zr(o)!=="body"||Nr(l))&&(d=ju(o)),a){const b=gs(o,!0,c,o);m.x=b.x+o.clientLeft,m.y=b.y+o.clientTop}else l&&p();c&&!a&&l&&p();const y=l&&!a&&!c?bw(l,d):so(0),g=f.left+d.scrollLeft-m.x-y.x,v=f.top+d.scrollTop-m.y-y.y;return{x:g,y:v,width:f.width,height:f.height}}function kh(t){return On(t).position==="static"}function M0(t,o){if(!St(t)||On(t).position==="fixed")return null;if(o)return o(t);let r=t.offsetParent;return uo(t)===r&&(r=r.ownerDocument.body),r}function xw(t,o){const r=zt(t);if(Nu(t))return r;if(!St(t)){let l=lo(t);for(;l&&!ro(l);){if(st(l)&&!kh(l))return l;l=lo(l)}return r}let a=M0(t,o);for(;a&&$A(a)&&kh(a);)a=M0(a,o);return a&&ro(a)&&kh(a)&&!Lp(a)?r:a||n2(t)||r}const Fk=async function(t){const o=this.getOffsetParent||xw,r=this.getDimensions,a=await r(t.floating);return{reference:Gk(t.reference,await o(t.floating),t.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function Xk(t){return On(t).direction==="rtl"}const Kk={convertOffsetParentRelativeRectToViewportRelativeRect:jk,getDocumentElement:uo,getClippingRect:qk,getOffsetParent:xw,getElementRects:Fk,getClientRects:Pk,getDimensions:Yk,getScale:Ea,isElement:st,isRTL:Xk};function ww(t,o){return t.x===o.x&&t.y===o.y&&t.width===o.width&&t.height===o.height}function Qk(t,o){let r=null,a;const l=uo(t);function c(){var d;clearTimeout(a),(d=r)==null||d.disconnect(),r=null}function f(d,m){d===void 0&&(d=!1),m===void 0&&(m=1),c();const p=t.getBoundingClientRect(),{left:y,top:g,width:v,height:b}=p;if(d||o(),!v||!b)return;const x=ha(g),w=ha(l.clientWidth-(y+v)),E=ha(l.clientHeight-(g+b)),C=ha(y),k={rootMargin:-x+"px "+-w+"px "+-E+"px "+-C+"px",threshold:Mn(0,Oa(1,m))||1};let O=!0;function z(N){const j=N[0].intersectionRatio;if(j!==m){if(!O)return f();j?f(!1,j):a=setTimeout(()=>{f(!1,1e-7)},1e3)}j===1&&!ww(p,t.getBoundingClientRect())&&f(),O=!1}try{r=new IntersectionObserver(z,{...k,root:l.ownerDocument})}catch{r=new IntersectionObserver(z,k)}r.observe(t)}return f(!0),c}function O0(t,o,r,a){a===void 0&&(a={});const{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=a,p=$p(t),y=l||c?[...p?Mr(p):[],...Mr(o)]:[];y.forEach(C=>{l&&C.addEventListener("scroll",r,{passive:!0}),c&&C.addEventListener("resize",r)});const g=p&&d?Qk(p,r):null;let v=-1,b=null;f&&(b=new ResizeObserver(C=>{let[_]=C;_&&_.target===p&&b&&(b.unobserve(o),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var k;(k=b)==null||k.observe(o)})),r()}),p&&!m&&b.observe(p),b.observe(o));let x,w=m?gs(t):null;m&&E();function E(){const C=gs(t);w&&!ww(w,C)&&r(),w=C,x=requestAnimationFrame(E)}return r(),()=>{var C;y.forEach(_=>{l&&_.removeEventListener("scroll",r),c&&_.removeEventListener("resize",r)}),g?.(),(C=b)==null||C.disconnect(),b=null,m&&cancelAnimationFrame(x)}}const Zk=Ak,$k=Dk,Jk=Mk,Wk=zk,ez=Ok,tz=kk,nz=(t,o,r)=>{const a=new Map,l={platform:Kk,...r},c={...l.platform,_c:a};return Ck(t,o,{...l,platform:c})};var oz=typeof document<"u",rz=function(){},Qc=oz?R.useLayoutEffect:rz;function Su(t,o){if(t===o)return!0;if(typeof t!=typeof o)return!1;if(typeof t=="function"&&t.toString()===o.toString())return!0;let r,a,l;if(t&&o&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==o.length)return!1;for(a=r;a--!==0;)if(!Su(t[a],o[a]))return!1;return!0}if(l=Object.keys(t),r=l.length,r!==Object.keys(o).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(o,l[a]))return!1;for(a=r;a--!==0;){const c=l[a];if(!(c==="_owner"&&t.$$typeof)&&!Su(t[c],o[c]))return!1}return!0}return t!==t&&o!==o}function Ew(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function _0(t,o){const r=Ew(t);return Math.round(o*r)/r}function zh(t){const o=R.useRef(t);return Qc(()=>{o.current=t}),o}function sz(t){t===void 0&&(t={});const{placement:o="bottom",strategy:r="absolute",middleware:a=[],platform:l,elements:{reference:c,floating:f}={},transform:d=!0,whileElementsMounted:m,open:p}=t,[y,g]=R.useState({x:0,y:0,strategy:r,placement:o,middlewareData:{},isPositioned:!1}),[v,b]=R.useState(a);Su(v,a)||b(a);const[x,w]=R.useState(null),[E,C]=R.useState(null),_=R.useCallback(G=>{G!==N.current&&(N.current=G,w(G))},[]),k=R.useCallback(G=>{G!==j.current&&(j.current=G,C(G))},[]),O=c||x,z=f||E,N=R.useRef(null),j=R.useRef(null),D=R.useRef(y),Y=m!=null,$=zh(m),Z=zh(l),V=zh(p),J=R.useCallback(()=>{if(!N.current||!j.current)return;const G={placement:o,strategy:r,middleware:v};Z.current&&(G.platform=Z.current),nz(N.current,j.current,G).then(ce=>{const W={...ce,isPositioned:V.current!==!1};ne.current&&!Su(D.current,W)&&(D.current=W,io.flushSync(()=>{g(W)}))})},[v,o,r,Z,V]);Qc(()=>{p===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,g(G=>({...G,isPositioned:!1})))},[p]);const ne=R.useRef(!1);Qc(()=>(ne.current=!0,()=>{ne.current=!1}),[]),Qc(()=>{if(O&&(N.current=O),z&&(j.current=z),O&&z){if($.current)return $.current(O,z,J);J()}},[O,z,J,$,Y]);const ae=R.useMemo(()=>({reference:N,floating:j,setReference:_,setFloating:k}),[_,k]),B=R.useMemo(()=>({reference:O,floating:z}),[O,z]),H=R.useMemo(()=>{const G={position:r,left:0,top:0};if(!B.floating)return G;const ce=_0(B.floating,y.x),W=_0(B.floating,y.y);return d?{...G,transform:"translate("+ce+"px, "+W+"px)",...Ew(B.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:ce,top:W}},[r,d,B.floating,y.x,y.y]);return R.useMemo(()=>({...y,update:J,refs:ae,elements:B,floatingStyles:H}),[y,J,ae,B,H])}const az=(t,o)=>({...Zk(t),options:[t,o]}),iz=(t,o)=>({...$k(t),options:[t,o]}),lz=(t,o)=>({...tz(t),options:[t,o]}),cz=(t,o)=>({...Jk(t),options:[t,o]}),uz=(t,o)=>({...Wk(t),options:[t,o]}),fz=(t,o)=>({...ez(t),options:[t,o]}),dz={intentional:"onClick",sloppy:"onPointerDown"};function hz(t){return{escapeKey:typeof t=="boolean"?t:t?.escapeKey??!1,outsidePress:typeof t=="boolean"?t:t?.outsidePress??!0}}function Jp(t,o={}){const r="rootStore"in t?t.rootStore:t,a=r.useState("open"),l=r.useState("floatingElement"),c=r.useState("referenceElement"),f=r.useState("domReferenceElement"),{onOpenChange:d,dataRef:m}=r.context,{enabled:p=!0,escapeKey:y=!0,outsidePress:g=!0,outsidePressEvent:v="sloppy",referencePress:b=!1,referencePressEvent:x="sloppy",ancestorScroll:w=!1,bubbles:E,externalTree:C}=o,_=Pr(C),k=Ce(typeof g=="function"?g:()=>!1),O=typeof g=="function"?k:g,z=R.useRef(!1),{escapeKey:N,outsidePress:j}=hz(E),D=R.useRef(null),Y=qn(),$=qn(),Z=Ce(()=>{$.clear(),m.current.insideReactTree=!1}),V=R.useRef(!1),J=R.useRef(""),ne=Ce(te=>{J.current=te.pointerType}),ae=Ce(()=>{const te=J.current,me=te==="pen"||!te?"mouse":te,pe=typeof v=="function"?v():v;return typeof pe=="string"?pe:pe[me]}),B=Ce(te=>{if(!a||!p||!y||te.key!=="Escape"||V.current)return;const me=m.current.floatingContext?.nodeId,pe=_?us(_.nodesRef.current,me):[];if(!N&&pe.length>0){let Se=!0;if(pe.forEach(ye=>{ye.context?.open&&!ye.context.dataRef.current.__escapeKeyBubbles&&(Se=!1)}),!Se)return}const Ne=fD(te)?te.nativeEvent:te,be=Qe(Hu,Ne);r.setOpen(!1,be),!N&&!be.isPropagationAllowed&&te.stopPropagation()}),H=Ce(te=>{const me=ae();return me==="intentional"&&te.type!=="click"||me==="sloppy"&&te.type==="click"}),G=Ce(()=>{m.current.insideReactTree=!0,$.start(0,Z)}),ce=Ce((te,me=!1)=>{if(H(te)){Z();return}if(m.current.insideReactTree){Z();return}if(ae()==="intentional"&&me||typeof O=="function"&&!O(te))return;const pe=rn(te),Ne=`[${ka("inert")}]`,be=at(r.select("floatingElement")).querySelectorAll(Ne),Se=r.context.triggerElements;if(pe&&(Se.hasElement(pe)||Se.hasMatchingElement(De=>Ye(De,pe))))return;let ye=st(pe)?pe:null;for(;ye&&!ro(ye);){const De=lo(ye);if(ro(De)||!st(De))break;ye=De}if(be.length&&st(pe)&&!cD(pe)&&!Ye(pe,r.select("floatingElement"))&&Array.from(be).every(De=>!Ye(ye,De)))return;if(St(pe)&&!("touches"in te)){const De=ro(pe),qe=On(pe),Be=/auto|scroll/,Ot=De||Be.test(qe.overflowX),He=De||Be.test(qe.overflowY),Je=Ot&&pe.clientWidth>0&&pe.scrollWidth>pe.clientWidth,Pe=He&&pe.clientHeight>0&&pe.scrollHeight>pe.clientHeight,Et=qe.direction==="rtl",Qt=Pe&&(Et?te.offsetX<=pe.offsetWidth-pe.clientWidth:te.offsetX>pe.clientWidth),Yn=Je&&te.offsetY>pe.clientHeight;if(Qt||Yn)return}const de=m.current.floatingContext?.nodeId,we=_&&us(_.nodesRef.current,de).some(De=>Qn(te,De.context?.elements.floating));if(Qn(te,r.select("floatingElement"))||Qn(te,r.select("domReferenceElement"))||we)return;const ge=_?us(_.nodesRef.current,de):[];if(ge.length>0){let De=!0;if(ge.forEach(qe=>{qe.context?.open&&!qe.context.dataRef.current.__outsidePressBubbles&&(De=!1)}),!De)return}r.setOpen(!1,Qe(Xp,te)),Z()}),W=Ce(te=>{ae()!=="sloppy"||te.pointerType==="touch"||!r.select("open")||!p||Qn(te,r.select("floatingElement"))||Qn(te,r.select("domReferenceElement"))||ce(te)}),P=Ce(te=>{if(ae()!=="sloppy"||!r.select("open")||!p||Qn(te,r.select("floatingElement"))||Qn(te,r.select("domReferenceElement")))return;const me=te.touches[0];me&&(D.current={startTime:Date.now(),startX:me.clientX,startY:me.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},Y.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}),X=Ce(te=>{const me=rn(te);function pe(){P(te),me?.removeEventListener(te.type,pe)}me?.addEventListener(te.type,pe)}),le=Ce(te=>{const me=z.current;if(z.current=!1,Y.clear(),te.type==="mousedown"&&D.current&&!D.current.dismissOnMouseDown)return;const pe=rn(te);function Ne(){te.type==="pointerdown"?W(te):ce(te,me),pe?.removeEventListener(te.type,Ne)}pe?.addEventListener(te.type,Ne)}),re=Ce(te=>{if(ae()!=="sloppy"||!D.current||Qn(te,r.select("floatingElement"))||Qn(te,r.select("domReferenceElement")))return;const me=te.touches[0];if(!me)return;const pe=Math.abs(me.clientX-D.current.startX),Ne=Math.abs(me.clientY-D.current.startY),be=Math.sqrt(pe*pe+Ne*Ne);be>5&&(D.current.dismissOnTouchEnd=!0),be>10&&(ce(te),Y.clear(),D.current=null)}),ue=Ce(te=>{const me=rn(te);function pe(){re(te),me?.removeEventListener(te.type,pe)}me?.addEventListener(te.type,pe)}),he=Ce(te=>{ae()!=="sloppy"||!D.current||Qn(te,r.select("floatingElement"))||Qn(te,r.select("domReferenceElement"))||(D.current.dismissOnTouchEnd&&ce(te),Y.clear(),D.current=null)}),ve=Ce(te=>{const me=rn(te);function pe(){he(te),me?.removeEventListener(te.type,pe)}me?.addEventListener(te.type,pe)});R.useEffect(()=>{if(!a||!p)return;m.current.__escapeKeyBubbles=N,m.current.__outsidePressBubbles=j;const te=new co;function me(ye){r.setOpen(!1,Qe(Fp,ye))}function pe(){te.clear(),V.current=!0}function Ne(){te.start(Lu()?5:0,()=>{V.current=!1})}const be=at(l);be.addEventListener("pointerdown",ne,!0),y&&(be.addEventListener("keydown",B),be.addEventListener("compositionstart",pe),be.addEventListener("compositionend",Ne)),O&&(be.addEventListener("click",le,!0),be.addEventListener("pointerdown",le,!0),be.addEventListener("touchstart",X,!0),be.addEventListener("touchmove",ue,!0),be.addEventListener("touchend",ve,!0),be.addEventListener("mousedown",le,!0));let Se=[];return w&&(st(f)&&(Se=Mr(f)),st(l)&&(Se=Se.concat(Mr(l))),!st(c)&&c&&c.contextElement&&(Se=Se.concat(Mr(c.contextElement)))),Se=Se.filter(ye=>ye!==be.defaultView?.visualViewport),Se.forEach(ye=>{ye.addEventListener("scroll",me,{passive:!0})}),()=>{be.removeEventListener("pointerdown",ne,!0),y&&(be.removeEventListener("keydown",B),be.removeEventListener("compositionstart",pe),be.removeEventListener("compositionend",Ne)),O&&(be.removeEventListener("click",le,!0),be.removeEventListener("pointerdown",le,!0),be.removeEventListener("touchstart",X,!0),be.removeEventListener("touchmove",ue,!0),be.removeEventListener("touchend",ve,!0),be.removeEventListener("mousedown",le,!0)),Se.forEach(ye=>{ye.removeEventListener("scroll",me)}),te.clear(),z.current=!1}},[m,l,c,f,y,O,a,d,w,p,N,j,B,ce,le,W,X,ue,ve,ne,r]),R.useEffect(Z,[O,Z]);const Me=R.useMemo(()=>({onKeyDown:B,...b&&{[dz[x]]:te=>{r.setOpen(!1,Qe(Aa,te.nativeEvent))},...x!=="intentional"&&{onClick(te){r.setOpen(!1,Qe(Aa,te.nativeEvent))}}}}),[B,r,b,x]),fe=Ce(te=>{const me=rn(te.nativeEvent);!Ye(r.select("floatingElement"),me)||te.button!==0||(z.current=!0)}),ze=Ce(te=>{!a||!p||te.button!==0||(z.current=!0)}),je=R.useMemo(()=>({onKeyDown:B,onPointerDown:fe,onMouseDown:fe,onMouseUp:fe,onClickCapture:G,onMouseDownCapture(te){G(),ze(te)},onPointerDownCapture(te){G(),ze(te)},onMouseUpCapture:G,onTouchEndCapture:G,onTouchMoveCapture:G}),[B,fe,G,ze]);return R.useMemo(()=>p?{reference:Me,floating:je,trigger:Me}:{},[p,Me,je])}var xu=Symbol("NOT_FOUND");function pz(t,o=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(o)}function mz(t,o=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(o)}function gz(t,o="expected all items to be functions, instead received the following types: "){if(!t.every(r=>typeof r=="function")){const r=t.map(a=>typeof a=="function"?`function ${a.name||"unnamed"}()`:typeof a).join(", ");throw new TypeError(`${o}[${r}]`)}}var A0=t=>Array.isArray(t)?t:[t];function yz(t){const o=Array.isArray(t[0])?t[0]:t;return gz(o,"createSelector expects all input-selectors to be functions, but received the following types: "),o}function vz(t,o){const r=[],{length:a}=t;for(let l=0;l<a;l++)r.push(t[l].apply(null,o));return r}function bz(t){let o;return{get(r){return o&&t(o.key,r)?o.value:xu},put(r,a){o={key:r,value:a}},getEntries(){return o?[o]:[]},clear(){o=void 0}}}function Sz(t,o){let r=[];function a(d){const m=r.findIndex(p=>o(d,p.key));if(m>-1){const p=r[m];return m>0&&(r.splice(m,1),r.unshift(p)),p.value}return xu}function l(d,m){a(d)===xu&&(r.unshift({key:d,value:m}),r.length>t&&r.pop())}function c(){return r}function f(){r=[]}return{get:a,put:l,getEntries:c,clear:f}}var xz=(t,o)=>t===o;function wz(t){return function(r,a){if(r===null||a===null||r.length!==a.length)return!1;const{length:l}=r;for(let c=0;c<l;c++)if(!t(r[c],a[c]))return!1;return!0}}function Ez(t,o){const r=typeof o=="object"?o:{equalityCheck:o},{equalityCheck:a=xz,maxSize:l=1,resultEqualityCheck:c}=r,f=wz(a);let d=0;const m=l<=1?bz(f):Sz(l,f);function p(){let y=m.get(arguments);if(y===xu){if(y=t.apply(null,arguments),d++,c){const v=m.getEntries().find(b=>c(b.value,y));v&&(y=v.value,d!==0&&d--)}m.put(arguments,y)}return y}return p.clearCache=()=>{m.clear(),p.resetResultsCount()},p.resultsCount=()=>d,p.resetResultsCount=()=>{d=0},p}var Rz=class{constructor(t){this.value=t}deref(){return this.value}},Tz=typeof WeakRef<"u"?WeakRef:Rz,Cz=0,D0=1;function Lc(){return{s:Cz,v:void 0,o:null,p:null}}function Rw(t,o={}){let r=Lc();const{resultEqualityCheck:a}=o;let l,c=0;function f(){let d=r;const{length:m}=arguments;for(let g=0,v=m;g<v;g++){const b=arguments[g];if(typeof b=="function"||typeof b=="object"&&b!==null){let x=d.o;x===null&&(d.o=x=new WeakMap);const w=x.get(b);w===void 0?(d=Lc(),x.set(b,d)):d=w}else{let x=d.p;x===null&&(d.p=x=new Map);const w=x.get(b);w===void 0?(d=Lc(),x.set(b,d)):d=w}}const p=d;let y;if(d.s===D0)y=d.v;else if(y=t.apply(null,arguments),c++,a){const g=l?.deref?.()??l;g!=null&&a(g,y)&&(y=g,c!==0&&c--),l=typeof y=="object"&&y!==null||typeof y=="function"?new Tz(y):y}return p.s=D0,p.v=y,y}return f.clearCache=()=>{r=Lc(),f.resetResultsCount()},f.resultsCount=()=>c,f.resetResultsCount=()=>{c=0},f}function Tw(t,...o){const r=typeof t=="function"?{memoize:t,memoizeOptions:o}:t,a=(...l)=>{let c=0,f=0,d,m={},p=l.pop();typeof p=="object"&&(m=p,p=l.pop()),pz(p,`createSelector expects an output function after the inputs, but received: [${typeof p}]`);const y={...r,...m},{memoize:g,memoizeOptions:v=[],argsMemoize:b=Rw,argsMemoizeOptions:x=[]}=y,w=A0(v),E=A0(x),C=yz(l),_=g(function(){return c++,p.apply(null,arguments)},...w),k=b(function(){f++;const z=vz(C,arguments);return d=_.apply(null,z),d},...E);return Object.assign(k,{resultFunc:p,memoizedResultFunc:_,dependencies:C,dependencyRecomputations:()=>f,resetDependencyRecomputations:()=>{f=0},lastResult:()=>d,recomputations:()=>c,resetRecomputations:()=>{c=0},memoize:g,argsMemoize:b})};return Object.assign(a,{withTypes:()=>a}),a}var Mz=Tw(Rw),Oz=Object.assign((t,o=Mz)=>{mz(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const r=Object.keys(t),a=r.map(c=>t[c]);return o(a,(...c)=>c.reduce((f,d,m)=>(f[r[m]]=d,f),{}))},{withTypes:()=>Oz});Tw({memoize:Ez,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const _e=(t,o,r,a,l,c,...f)=>{if(f.length>0)throw new Error(tn(1));let d;if(t)d=t;else throw new Error("Missing arguments");return d};var Cw=KS();const ip=[];let lp;function _z(){return lp}function Az(t){ip.push(t)}function Wp(t){const o=(r,a)=>{const l=Wt(Dz).current;let c;try{lp=l;for(const f of ip)f.before(l);c=t(r,a);for(const f of ip)f.after(l);l.didInitialize=!0}finally{lp=void 0}return c};return o.displayName=t.displayName||t.name,o}function Mw(t){return R.forwardRef(Wp(t))}function Dz(){return{didInitialize:!1}}const kz=kp(19),zz=kz?Lz:jz;function Ow(t,o,r,a,l){return zz(t,o,r,a,l)}function Nz(t,o,r,a,l){const c=R.useCallback(()=>o(t.getSnapshot(),r,a,l),[t,o,r,a,l]);return Cw.useSyncExternalStore(t.subscribe,c,c)}Az({before(t){t.syncIndex=0,t.didInitialize||(t.syncTick=1,t.syncHooks=[],t.didChangeStore=!0,t.getSnapshot=()=>{let o=!1;for(let r=0;r<t.syncHooks.length;r+=1){const a=t.syncHooks[r],l=a.selector(a.store.state,a.a1,a.a2,a.a3);(a.didChange||!Object.is(a.value,l))&&(o=!0,a.value=l,a.didChange=!1)}return o&&(t.syncTick+=1),t.syncTick})},after(t){t.syncHooks.length>0&&(t.didChangeStore&&(t.didChangeStore=!1,t.subscribe=o=>{const r=new Set;for(const l of t.syncHooks)r.add(l.store);const a=[];for(const l of r)a.push(l.subscribe(o));return()=>{for(const l of a)l()}}),Cw.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot))}});function Lz(t,o,r,a,l){const c=_z();if(!c)return Nz(t,o,r,a,l);const f=c.syncIndex;c.syncIndex+=1;let d;return c.didInitialize?(d=c.syncHooks[f],(d.store!==t||d.selector!==o||!Object.is(d.a1,r)||!Object.is(d.a2,a)||!Object.is(d.a3,l))&&(d.store!==t&&(c.didChangeStore=!0),d.store=t,d.selector=o,d.a1=r,d.a2=a,d.a3=l,d.didChange=!0)):(d={store:t,selector:o,a1:r,a2:a,a3:l,value:o(t.getSnapshot(),r,a,l),didChange:!1},c.syncHooks.push(d)),d.value}function jz(t,o,r,a,l){return QS.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getSnapshot,c=>o(c,r,a,l))}class Pz{constructor(o){this.state=o,this.listeners=new Set,this.updateTick=0}subscribe=o=>(this.listeners.add(o),()=>{this.listeners.delete(o)});getSnapshot=()=>this.state;setState(o){if(this.state===o)return;this.state=o,this.updateTick+=1;const r=this.updateTick;for(const a of this.listeners){if(r!==this.updateTick)return;a(o)}}update(o){for(const r in o)if(!Object.is(this.state[r],o[r])){this.setState({...this.state,...o});return}}set(o,r){Object.is(this.state[o],r)||this.setState({...this.state,[o]:r})}notifyAll(){const o={...this.state};this.setState(o)}use(o,r,a,l){return Ow(this,o,r,a,l)}}class qu extends Pz{constructor(o,r={},a){super(o),this.context=r,this.selectors=a}useSyncedValue(o,r){R.useDebugValue(o),Ae(()=>{this.state[o]!==r&&this.set(o,r)},[o,r])}useSyncedValueWithCleanup(o,r){const a=this;Ae(()=>(a.state[o]!==r&&a.set(o,r),()=>{a.set(o,void 0)}),[a,o,r])}useSyncedValues(o){const r=this,a=Object.values(o);Ae(()=>{r.update(o)},[r,...a])}useControlledProp(o,r){R.useDebugValue(o);const a=r!==void 0;Ae(()=>{a&&!Object.is(this.state[o],r)&&super.setState({...this.state,[o]:r})},[o,r,a])}select(o,r,a,l){const c=this.selectors[o];return c(this.state,r,a,l)}useState(o,r,a,l){return R.useDebugValue(o),Ow(this,this.selectors[o],r,a,l)}useContextCallback(o,r){R.useDebugValue(o);const a=Ce(r??fx);this.context[o]=a}useStateSetter(o){const r=R.useRef(void 0);return r.current===void 0&&(r.current=a=>{this.set(o,a)}),r.current}observe(o,r){let a;typeof o=="function"?a=o:a=this.selectors[o];let l=a(this.state);return r(l,l,this),this.subscribe(c=>{const f=a(c);if(!Object.is(l,f)){const d=l;l=f,r(f,d,this)}})}}const Uz={open:_e(t=>t.open),domReferenceElement:_e(t=>t.domReferenceElement),referenceElement:_e(t=>t.positionReference??t.referenceElement),floatingElement:_e(t=>t.floatingElement),floatingId:_e(t=>t.floatingId)};class em extends qu{constructor(o){const{nested:r,noEmit:a,onOpenChange:l,triggerElements:c,...f}=o;super({...f,positionReference:f.referenceElement,domReferenceElement:f.referenceElement},{onOpenChange:l,dataRef:{current:{}},events:ow(),nested:r,noEmit:a,triggerElements:c},Uz)}setOpen=(o,r)=>{if((!o||!this.state.open||Vx(r.event))&&(this.context.dataRef.current.openEvent=o?r.event:void 0),!this.context.noEmit){const a={open:o,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",a)}this.context.onOpenChange?.(o,r)}}function _w(t,o){const r=R.useRef(null),a=R.useRef(null);return R.useCallback(l=>{if(t!==void 0){if(r.current!==null){const c=r.current,f=a.current,d=o.context.triggerElements.getById(c);f&&d===f&&o.context.triggerElements.delete(c),r.current=null,a.current=null}l!==null&&(r.current=t,a.current=l,o.context.triggerElements.add(t,l))}},[o,t])}function Aw(t,o,r,a){const l=r.useState("isMountedByTrigger",t),c=_w(t,r),f=Ce(d=>{if(c(d),!d||!r.select("open"))return;const m=r.select("activeTriggerId");if(m===t){r.update({activeTriggerElement:d,...a});return}m==null&&r.update({activeTriggerId:t,activeTriggerElement:d,...a})});return Ae(()=>{l&&r.update({activeTriggerElement:o.current,...a})},[l,r,o,...Object.values(a)]),{registerTrigger:f,isMountedByThisTrigger:l}}function tm(t){const o=t.useState("open");Ae(()=>{if(o&&!t.select("activeTriggerId")&&t.context.triggerElements.size===1){const r=t.context.triggerElements.entries().next();if(!r.done){const[a,l]=r.value;t.update({activeTriggerId:a,activeTriggerElement:l})}}},[o,t])}function nm(t,o,r){const{mounted:a,setMounted:l,transitionStatus:c}=QD(t);o.useSyncedValues({mounted:a,transitionStatus:c});const f=Ce(()=>{l(!1),o.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),r?.(),o.context.onOpenChangeComplete?.(!1)}),d=o.useState("preventUnmountingOnClose");return Iu({enabled:!d,open:t,ref:o.context.popupRef,onComplete(){t||f()}}),{forceUnmount:f,transitionStatus:c}}class tl{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(o,r){const a=this.idMap.get(o);a!==r&&(a!==void 0&&this.elementsSet.delete(a),this.elementsSet.add(r),this.idMap.set(o,r))}delete(o){const r=this.idMap.get(o);r&&(this.elementsSet.delete(r),this.idMap.delete(o))}hasElement(o){return this.elementsSet.has(o)}hasMatchingElement(o){for(const r of this.elementsSet)if(o(r))return!0;return!1}getById(o){return this.idMap.get(o)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function Bz(){return new em({open:!1,floatingElement:null,referenceElement:null,triggerElements:new tl,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function om(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:Bz(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:qt,inactiveTriggerProps:qt,popupProps:qt}}const jc=_e(t=>t.triggerIdProp??t.activeTriggerId),rm={open:_e(t=>t.openProp??t.open),mounted:_e(t=>t.mounted),transitionStatus:_e(t=>t.transitionStatus),floatingRootContext:_e(t=>t.floatingRootContext),preventUnmountingOnClose:_e(t=>t.preventUnmountingOnClose),payload:_e(t=>t.payload),activeTriggerId:jc,activeTriggerElement:_e(t=>t.mounted?t.activeTriggerElement:null),isTriggerActive:_e((t,o)=>o!==void 0&&jc(t)===o),isOpenedByTrigger:_e((t,o)=>o!==void 0&&jc(t)===o&&t.open),isMountedByTrigger:_e((t,o)=>o!==void 0&&jc(t)===o&&t.mounted),triggerProps:_e((t,o)=>o?t.activeTriggerProps:t.inactiveTriggerProps),popupProps:_e(t=>t.popupProps),popupElement:_e(t=>t.popupElement),positionerElement:_e(t=>t.positionerElement)};function Iz(t){const{open:o=!1,onOpenChange:r,elements:a={}}=t,l=Ss(),c=Vo()!=null,f=Wt(()=>new em({open:o,onOpenChange:r,referenceElement:a.reference??null,floatingElement:a.floating??null,triggerElements:new tl,floatingId:l,nested:c,noEmit:!1})).current;return Ae(()=>{const d={open:o,floatingId:l};a.reference!==void 0&&(d.referenceElement=a.reference,d.domReferenceElement=st(a.reference)?a.reference:null),a.floating!==void 0&&(d.floatingElement=a.floating),f.update(d)},[o,l,a.reference,a.floating,f]),f.context.onOpenChange=r,f.context.nested=c,f.context.noEmit=!1,f}function Hz(t={}){const{nodeId:o,externalTree:r}=t,a=Iz(t),l=t.rootContext||a,c={reference:l.useState("referenceElement"),floating:l.useState("floatingElement"),domReference:l.useState("domReferenceElement")},[f,d]=R.useState(null),m=R.useRef(null),p=Pr(r);Ae(()=>{c.domReference&&(m.current=c.domReference)},[c.domReference]);const y=sz({...t,elements:{...c,...f&&{reference:f}}}),g=R.useCallback(j=>{const D=st(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;d(D),y.refs.setReference(D)},[y.refs]),[v,b]=R.useState(null),[x,w]=R.useState(null);l.useSyncedValue("referenceElement",v),l.useSyncedValue("domReferenceElement",st(v)?v:null),l.useSyncedValue("floatingElement",x);const E=R.useCallback(j=>{(st(j)||j===null)&&(m.current=j,b(j)),(st(y.refs.reference.current)||y.refs.reference.current===null||j!==null&&!st(j))&&y.refs.setReference(j)},[y.refs,b]),C=R.useCallback(j=>{w(j),y.refs.setFloating(j)},[y.refs]),_=R.useMemo(()=>({...y.refs,setReference:E,setFloating:C,setPositionReference:g,domReference:m}),[y.refs,E,C,g]),k=R.useMemo(()=>({...y.elements,domReference:c.domReference}),[y.elements,c.domReference]),O=l.useState("open"),z=l.useState("floatingId"),N=R.useMemo(()=>({...y,dataRef:l.context.dataRef,open:O,onOpenChange:l.setOpen,events:l.context.events,floatingId:z,refs:_,elements:k,nodeId:o,rootStore:l}),[y,_,k,o,l,O,z]);return Ae(()=>{l.context.dataRef.current.floatingContext=N;const j=p?.nodesRef.current.find(D=>D.id===o);j&&(j.context=N)}),R.useMemo(()=>({...y,context:N,refs:_,elements:k,rootStore:l}),[y,_,k,N,l])}function sm(t){const{popupStore:o,noEmit:r=!1,treatPopupAsFloatingElement:a=!1,onOpenChange:l}=t,c=Ss(),f=Vo()!=null,d=o.useState("open"),m=o.useState("activeTriggerElement"),p=o.useState(a?"popupElement":"positionerElement"),y=o.context.triggerElements,g=Wt(()=>new em({open:d,referenceElement:m,floatingElement:p,triggerElements:y,onOpenChange:l,floatingId:c,nested:f,noEmit:r})).current;return Ae(()=>{const v={open:d,floatingId:c,referenceElement:m,floatingElement:p};st(m)&&(v.domReferenceElement=m),g.state.positionReference===g.state.referenceElement&&(v.positionReference=m),g.update(v)},[d,c,m,p,g]),g.context.onOpenChange=l,g.context.nested=f,g.context.noEmit=r,g}const Nh=sD&&Lx;function Dw(t,o={}){const r="rootStore"in t?t.rootStore:t,{events:a,dataRef:l}=r.context,{enabled:c=!0,delay:f}=o,d=R.useRef(!1),m=R.useRef(null),p=qn(),y=R.useRef(!0);R.useEffect(()=>{const v=r.select("domReferenceElement");if(!c)return;const b=zt(v);function x(){const C=r.select("domReferenceElement");!r.select("open")&&St(C)&&C===Zn(at(C))&&(d.current=!0)}function w(){y.current=!0}function E(){y.current=!1}return b.addEventListener("blur",x),Nh&&(b.addEventListener("keydown",w,!0),b.addEventListener("pointerdown",E,!0)),()=>{b.removeEventListener("blur",x),Nh&&(b.removeEventListener("keydown",w,!0),b.removeEventListener("pointerdown",E,!0))}},[r,c]),R.useEffect(()=>{if(!c)return;function v(b){if(b.reason===Aa||b.reason===Hu){const x=r.select("domReferenceElement");st(x)&&(m.current=x,d.current=!0)}}return a.on("openchange",v),()=>{a.off("openchange",v)}},[a,c,r]);const g=R.useMemo(()=>({onMouseLeave(){d.current=!1,m.current=null},onFocus(v){const b=v.currentTarget;if(d.current){if(m.current===b)return;d.current=!1,m.current=null}const x=rn(v.nativeEvent);if(st(x)){if(Nh&&!v.relatedTarget){if(!y.current&&!Uu(x))return}else if(!uD(x))return}const w=uu(v.relatedTarget,r.context.triggerElements),{nativeEvent:E,currentTarget:C}=v,_=typeof f=="function"?f():f;if(r.select("open")&&w||_===0||_===void 0){r.setOpen(!0,Qe(xa,E,C));return}p.start(_,()=>{d.current||r.setOpen(!0,Qe(xa,E,C))})},onBlur(v){d.current=!1,m.current=null;const b=v.relatedTarget,x=v.nativeEvent,w=st(b)&&b.hasAttribute(ka("focus-guard"))&&b.getAttribute("data-type")==="outside";p.start(0,()=>{const E=r.select("domReferenceElement"),C=Zn(E?E.ownerDocument:document);!b&&C===E||Ye(l.current.floatingContext?.refs.floating.current,C)||Ye(E,C)||w||uu(b??C,r.context.triggerElements)||r.setOpen(!1,Qe(xa,x))})}}),[l,r,p,f]);return R.useMemo(()=>c?{reference:g,trigger:g}:{},[c,g])}const cp=ka("safe-polygon"),Vz=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Bx}`;function qz(t){return t?!!t.closest(Vz):!1}class am{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.unbindMouseMove=()=>{},this.restTimeoutPending=!1,this.openChangeTimeout=new co,this.restTimeout=new co,this.handleCloseOptions=void 0}static create(){return new am}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function kw(t){const o=Wt(am.create).current,r=t.context.dataRef.current;return r.hoverInteractionState||(r.hoverInteractionState=o),Bp(r.hoverInteractionState.disposeEffect),r.hoverInteractionState}const Yz=new Set(["click","mousedown"]);function zw(t,o={}){const r="rootStore"in t?t.rootStore:t,a=r.useState("open"),l=r.useState("floatingElement"),c=r.useState("domReferenceElement"),{dataRef:f}=r.context,{enabled:d=!0,closeDelay:m=0}=o,p=kw(r),y=Pr(),g=Vo(),v=Ce(()=>p.interactedInside?!0:f.current.openEvent?Yz.has(f.current.openEvent.type):!1),b=Ce(()=>{const k=f.current.openEvent?.type;return k?.includes("mouse")&&k!=="mousedown"}),x=Ce(k=>uu(k,r.context.triggerElements)),w=R.useCallback((k,O=!0)=>{const z=Gz(m,p.pointerType);z&&!p.handler?p.openChangeTimeout.start(z,()=>r.setOpen(!1,Qe(sn,k))):O&&(p.openChangeTimeout.clear(),r.setOpen(!1,Qe(sn,k)))},[m,r,p]),E=Ce(()=>{p.unbindMouseMove(),p.handler=void 0}),C=Ce(()=>{if(p.performedPointerEventsMutation){const k=at(l).body;k.style.pointerEvents="",k.removeAttribute(cp),p.performedPointerEventsMutation=!1}}),_=Ce(k=>{const O=rn(k);if(!qz(O)){p.interactedInside=!1;return}p.interactedInside=!0});Ae(()=>{a||(p.pointerType=void 0,p.restTimeoutPending=!1,p.interactedInside=!1,E(),C())},[a,p,E,C]),R.useEffect(()=>()=>{E()},[E]),R.useEffect(()=>C,[C]),Ae(()=>{if(d&&a&&p.handleCloseOptions?.blockPointerEvents&&b()&&st(c)&&l){p.performedPointerEventsMutation=!0;const k=at(l).body;k.setAttribute(cp,"");const O=c,z=l,N=y?.nodesRef.current.find(j=>j.id===g)?.context?.elements.floating;return N&&(N.style.pointerEvents=""),k.style.pointerEvents="none",O.style.pointerEvents="auto",z.style.pointerEvents="auto",()=>{k.style.pointerEvents="",O.style.pointerEvents="",z.style.pointerEvents=""}}},[d,a,c,l,p,b,y,g]),R.useEffect(()=>{if(!d)return;function k(j){v()||!f.current.floatingContext||!r.select("open")||x(j.relatedTarget)||(C(),E(),v()||w(j))}function O(j){p.openChangeTimeout.clear(),C(),p.handler?.(j),E()}function z(j){v()||w(j,!1)}const N=l;return N&&(N.addEventListener("mouseleave",k),N.addEventListener("mouseenter",O),N.addEventListener("mouseleave",z),N.addEventListener("pointerdown",_,!0)),()=>{N&&(N.removeEventListener("mouseleave",k),N.removeEventListener("mouseenter",O),N.removeEventListener("mouseleave",z),N.removeEventListener("pointerdown",_,!0))}},[d,l,r,f,v,x,w,C,E,_,p])}function Gz(t,o){return o&&!ms(o)?0:typeof t=="function"?t():t}function Lh(t){return typeof t=="function"?t():t}const Fz={current:null};function im(t,o={}){const r="rootStore"in t?t.rootStore:t,{dataRef:a,events:l}=r.context,{enabled:c=!0,delay:f=0,handleClose:d=null,mouseOnly:m=!1,restMs:p=0,move:y=!0,triggerElementRef:g=Fz,externalTree:v,isActiveTrigger:b=!0}=o,x=Pr(v),w=kw(r),E=an(d),C=an(f),_=an(p),k=an(c);b&&(w.handleCloseOptions=E.current?.__options);const O=Ce(()=>w.interactedInside?!0:a.current.openEvent?["click","mousedown"].includes(a.current.openEvent.type):!1),z=Ce($=>uu($,r.context.triggerElements)),N=R.useCallback(($,Z=!0)=>{const V=Kc(C.current,"close",w.pointerType);V&&!w.handler?w.openChangeTimeout.start(V,()=>r.setOpen(!1,Qe(sn,$))):Z&&(w.openChangeTimeout.clear(),r.setOpen(!1,Qe(sn,$)))},[C,r,w]),j=Ce(()=>{w.unbindMouseMove(),w.handler=void 0}),D=Ce(()=>{if(w.performedPointerEventsMutation){const $=at(r.select("domReferenceElement")).body;$.style.pointerEvents="",$.removeAttribute(cp),w.performedPointerEventsMutation=!1}});R.useEffect(()=>{if(!c)return;function $(Z){Z.open||(w.openChangeTimeout.clear(),w.restTimeout.clear(),w.blockMouseMove=!0,w.restTimeoutPending=!1)}return l.on("openchange",$),()=>{l.off("openchange",$)}},[c,l,w]);const Y=Ce($=>{if(O()||!a.current.floatingContext||z($.relatedTarget))return;const Z=g.current;E.current?.({...a.current.floatingContext,tree:x,x:$.clientX,y:$.clientY,onClose(){D(),j(),!O()&&Z===r.select("domReferenceElement")&&N($)}})($)});return R.useEffect(()=>{if(!c)return;const $=g.current??(b?r.select("domReferenceElement"):null);if(!st($))return;function Z(ne){if(w.openChangeTimeout.clear(),w.blockMouseMove=!1,m&&!ms(w.pointerType)||Lh(_.current)>0&&!Kc(C.current,"open"))return;const ae=Kc(C.current,"open",w.pointerType),B=r.select("domReferenceElement"),H=r.context.triggerElements,G=(H.hasElement(ne.target)||H.hasMatchingElement(X=>Ye(X,ne.target)))&&(!B||!Ye(B,ne.target)),ce=ne.currentTarget??null,W=r.select("open"),P=!W||G;G&&W?r.setOpen(!0,Qe(sn,ne,ce)):ae?w.openChangeTimeout.start(ae,()=>{P&&r.setOpen(!0,Qe(sn,ne,ce))}):P&&r.setOpen(!0,Qe(sn,ne,ce))}function V(ne){if(O()){D();return}w.unbindMouseMove();const ae=r.select("domReferenceElement"),B=at(ae);if(w.restTimeout.clear(),w.restTimeoutPending=!1,z(ne.relatedTarget))return;if(E.current&&a.current.floatingContext){r.select("open")||w.openChangeTimeout.clear();const G=g.current;w.handler=E.current({...a.current.floatingContext,tree:x,x:ne.clientX,y:ne.clientY,onClose(){D(),j(),k.current&&!O()&&G===r.select("domReferenceElement")&&N(ne,!0)}});const ce=w.handler;ce(ne),B.addEventListener("mousemove",ce),w.unbindMouseMove=()=>{B.removeEventListener("mousemove",ce)};return}(w.pointerType!=="touch"||!Ye(r.select("floatingElement"),ne.relatedTarget))&&N(ne)}function J(ne){Y(ne)}return r.select("open")&&$.addEventListener("mouseleave",J),y&&$.addEventListener("mousemove",Z,{once:!0}),$.addEventListener("mouseenter",Z),$.addEventListener("mouseleave",V),()=>{$.removeEventListener("mouseleave",J),y&&$.removeEventListener("mousemove",Z),$.removeEventListener("mouseenter",Z),$.removeEventListener("mouseleave",V)}},[j,D,a,C,N,r,c,E,Y,w,b,O,z,m,y,_,g,x,k]),R.useMemo(()=>{if(!c)return;function $(Z){w.pointerType=Z.pointerType}return{onPointerDown:$,onPointerEnter:$,onMouseMove(Z){const{nativeEvent:V}=Z,J=Z.currentTarget,ne=r.select("domReferenceElement"),ae=r.context.triggerElements,B=r.select("open"),H=(ae.hasElement(Z.target)||ae.hasMatchingElement(ce=>Ye(ce,Z.target)))&&(!ne||!Ye(ne,Z.target));if(m&&!ms(w.pointerType)||B&&!H||Lh(_.current)===0||!H&&w.restTimeoutPending&&Z.movementX**2+Z.movementY**2<2)return;w.restTimeout.clear();function G(){if(w.restTimeoutPending=!1,O())return;const ce=r.select("open");!w.blockMouseMove&&(!ce||H)&&r.setOpen(!0,Qe(sn,V,J))}w.pointerType==="touch"?io.flushSync(()=>{G()}):H&&B?G():(w.restTimeoutPending=!0,w.restTimeout.start(Lh(_.current),G))}}},[c,w,O,m,r,_])}function nl(t=[]){const o=t.map(p=>p?.reference),r=t.map(p=>p?.floating),a=t.map(p=>p?.item),l=t.map(p=>p?.trigger),c=R.useCallback(p=>Pc(p,t,"reference"),o),f=R.useCallback(p=>Pc(p,t,"floating"),r),d=R.useCallback(p=>Pc(p,t,"item"),a),m=R.useCallback(p=>Pc(p,t,"trigger"),l);return R.useMemo(()=>({getReferenceProps:c,getFloatingProps:f,getItemProps:d,getTriggerProps:m}),[c,f,d,m])}function Pc(t,o,r){const a=new Map,l=r==="item",c={};r==="floating"&&(c.tabIndex=-1,c[tp]="");for(const f in t)l&&t&&(f===Px||f===Ux)||(c[f]=t[f]);for(let f=0;f<o.length;f+=1){let d;const m=o[f]?.[r];typeof m=="function"?d=t?m(t):null:d=m,d&&k0(c,d,l,a)}return k0(c,t,l,a),c}function k0(t,o,r,a){for(const l in o){const c=o[l];r&&(l===Px||l===Ux)||(l.startsWith("on")?(a.has(l)||a.set(l,[]),typeof c=="function"&&(a.get(l)?.push(c),t[l]=(...f)=>a.get(l)?.map(d=>d(...f)).find(d=>d!==void 0))):t[l]=c)}}const Xz="Escape";function Yu(t,o,r){switch(t){case"vertical":return o;case"horizontal":return r;default:return o||r}}function Uc(t,o){return Yu(o,t===Ip||t===Wi,t===Or||t===_r)}function jh(t,o,r){return Yu(o,t===Wi,r?t===Or:t===_r)||t==="Enter"||t===" "||t===""}function Kz(t,o,r){return Yu(o,r?t===Or:t===_r,t===Wi)}function Qz(t,o,r,a){const l=r?t===_r:t===Or,c=t===Ip;return o==="both"||o==="horizontal"&&a&&a>1?t===Xz:Yu(o,l,c)}function Zz(t,o){const r="rootStore"in t?t.rootStore:t,a=r.useState("open"),l=r.useState("floatingElement"),c=r.useState("domReferenceElement"),f=r.context.dataRef,{listRef:d,activeIndex:m,onNavigate:p=()=>{},enabled:y=!0,selectedIndex:g=null,allowEscape:v=!1,loopFocus:b=!1,nested:x=!1,rtl:w=!1,virtual:E=!1,focusItemOnOpen:C="auto",focusItemOnHover:_=!0,openOnArrowKeyDown:k=!0,disabledIndices:O=void 0,orientation:z="vertical",parentOrientation:N,cols:j=1,id:D,resetOnPointerLeave:Y=!0,externalTree:$}=o,Z=fu(l),V=an(Z),J=Vo(),ne=Pr($);Ae(()=>{f.current.orientation=z},[f,z]);const ae=np(c),B=R.useRef(C),H=R.useRef(g??-1),G=R.useRef(null),ce=R.useRef(!0),W=Ce(de=>{p(H.current===-1?null:H.current,de)}),P=R.useRef(W),X=R.useRef(!!l),le=R.useRef(a),re=R.useRef(!1),ue=R.useRef(!1),he=an(O),ve=an(a),Me=an(g),fe=an(Y),ze=Ce(()=>{function de(qe){E?ne?.events.emit("virtualfocus",qe):Gi(qe,{sync:re.current,preventScroll:!0})}const we=d.current[H.current],ge=ue.current;we&&de(we),(re.current?qe=>qe():requestAnimationFrame)(()=>{const qe=d.current[H.current]||we;if(!qe)return;we||de(qe),te&&(ge||!ce.current)&&qe.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Ae(()=>{y&&(a&&l?(H.current=g??-1,B.current&&g!=null&&(ue.current=!0,W())):X.current&&(H.current=-1,P.current()))},[y,a,l,g,W]),Ae(()=>{if(y){if(!a){re.current=!1;return}if(l)if(m==null){if(re.current=!1,Me.current!=null)return;if(X.current&&(H.current=-1,ze()),(!le.current||!X.current)&&B.current&&(G.current!=null||B.current===!0&&G.current==null)){let de=0;const we=()=>{d.current[0]==null?(de<2&&(de?requestAnimationFrame:queueMicrotask)(we),de+=1):(H.current=G.current==null||jh(G.current,z,w)||x?_h(d):h0(d),G.current=null,W())};we()}}else qi(d,m)||(H.current=m,ze(),ue.current=!1)}},[y,a,l,m,Me,x,d,z,w,W,ze,he]),Ae(()=>{if(!y||l||!ne||E||!X.current)return;const de=ne.nodesRef.current,we=de.find(qe=>qe.id===J)?.context?.elements.floating,ge=Zn(at(l)),De=de.some(qe=>qe.context&&Ye(qe.context.elements.floating,ge));we&&!De&&ce.current&&we.focus({preventScroll:!0})},[y,l,ne,J,E]),Ae(()=>{P.current=W,le.current=a,X.current=!!l}),Ae(()=>{a||(G.current=null,B.current=C)},[a,C]);const je=m!=null,te=R.useMemo(()=>{function de(ge){if(!ve.current)return;const De=d.current.indexOf(ge.currentTarget);De!==-1&&H.current!==De&&(H.current=De,W(ge))}return{onFocus(ge){re.current=!0,de(ge)},onClick:({currentTarget:ge})=>ge.focus({preventScroll:!0}),onMouseMove(ge){re.current=!0,ue.current=!1,_&&de(ge)},onPointerLeave(ge){if(!ve.current||!ce.current||ge.pointerType==="touch")return;re.current=!0;const De=ge.relatedTarget;!_||d.current.includes(De)||fe.current&&(Gi(null,{sync:!0}),H.current=-1,W(ge),E||V.current?.focus({preventScroll:!0}))}}},[ve,V,_,d,W,fe,E]),me=R.useCallback(()=>N??ne?.nodesRef.current.find(de=>de.id===J)?.context?.dataRef?.current.orientation,[J,ne,N]),pe=Ce(de=>{if(ce.current=!1,re.current=!0,de.which===229||!ve.current&&de.currentTarget===V.current)return;if(x&&Qz(de.key,z,w,j)){Uc(de.key,me())||Jt(de),r.setOpen(!1,Qe(Fc,de.nativeEvent)),St(c)&&(E?ne?.events.emit("virtualfocus",c):c.focus());return}const we=H.current,ge=_h(d,O),De=h0(d,O);if(ae||(de.key==="Home"&&(Jt(de),H.current=ge,W(de)),de.key==="End"&&(Jt(de),H.current=De,W(de))),j>1){const qe=Array.from({length:d.current.length},()=>({width:1,height:1})),Be=RD(qe,j),Ot=Be.findIndex(Pe=>Pe!=null&&!Yi(d,Pe,O)),He=Be.reduce((Pe,Et,Qt)=>Et!=null&&!Yi(d,Et,O)?Qt:Pe,-1),Je=Be[ED({current:Be.map(Pe=>Pe!=null?d.current[Pe]:null)},{event:de,orientation:z,loopFocus:b,rtl:w,cols:j,disabledIndices:CD([...(typeof O!="function"?O:null)||d.current.map((Pe,Et)=>Yi(d,Et,O)?Et:void 0),void 0],Be),minIndex:Ot,maxIndex:He,prevIndex:TD(H.current>De?ge:H.current,qe,Be,j,de.key===Wi?"bl":de.key===(w?Or:_r)?"tr":"tl"),stopEvent:!0})];if(Je!=null&&(H.current=Je,W(de)),z==="both")return}if(Uc(de.key,z)){if(Jt(de),a&&!E&&Zn(de.currentTarget.ownerDocument)===de.currentTarget){H.current=jh(de.key,z,w)?ge:De,W(de);return}jh(de.key,z,w)?b?we>=De?v&&we!==d.current.length?H.current=-1:(re.current=!1,H.current=ge):H.current=$t(d,{startingIndex:we,disabledIndices:O}):H.current=Math.min(De,$t(d,{startingIndex:we,disabledIndices:O})):b?we<=ge?v&&we!==-1?H.current=d.current.length:(re.current=!1,H.current=De):H.current=$t(d,{startingIndex:we,decrement:!0,disabledIndices:O}):H.current=Math.max(ge,$t(d,{startingIndex:we,decrement:!0,disabledIndices:O})),qi(d,H.current)&&(H.current=-1),W(de)}}),Ne=R.useMemo(()=>E&&a&&je&&{"aria-activedescendant":`${D}-${m}`},[E,a,je,D,m]),be=R.useMemo(()=>({"aria-orientation":z==="both"?void 0:z,...ae?{}:Ne,onKeyDown(de){if(de.key==="Tab"&&de.shiftKey&&a&&!E){const we=rn(de.nativeEvent);if(we&&!Ye(V.current,we))return;Jt(de),r.setOpen(!1,Qe(Da,de.nativeEvent)),St(c)&&c.focus();return}pe(de)},onPointerMove(){ce.current=!0}}),[Ne,pe,V,z,ae,r,a,E,c]),Se=R.useMemo(()=>{function de(ge){C==="auto"&&Ix(ge.nativeEvent)&&(B.current=!E)}function we(ge){B.current=C,C==="auto"&&Hx(ge.nativeEvent)&&(B.current=!0)}return{onKeyDown(ge){const De=r.select("open");ce.current=!1;const qe=ge.key.startsWith("Arrow"),Be=Kz(ge.key,me(),w),Ot=Uc(ge.key,z),He=(x?Be:Ot)||ge.key==="Enter"||ge.key.trim()==="";if(E&&De)return pe(ge);if(!(!De&&!k&&qe)){if(He){const Je=Uc(ge.key,me());G.current=x&&Je?null:ge.key}if(x){Be&&(Jt(ge),De?(H.current=_h(d,he.current),W(ge)):r.setOpen(!0,Qe(Fc,ge.nativeEvent,ge.currentTarget)));return}Ot&&(Me.current!=null&&(H.current=Me.current),Jt(ge),!De&&k?r.setOpen(!0,Qe(Fc,ge.nativeEvent,ge.currentTarget)):pe(ge),De&&W(ge))}},onFocus(ge){r.select("open")&&!E&&(H.current=-1,W(ge))},onPointerDown:we,onPointerEnter:we,onMouseDown:de,onClick:de}},[pe,he,C,d,x,W,r,k,z,me,w,Me,E]),ye=R.useMemo(()=>({...Ne,...Se}),[Ne,Se]);return R.useMemo(()=>y?{reference:ye,floating:be,item:te,trigger:Se}:{},[y,ye,be,Se,te])}const $z=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Nw(t,o={}){const r="rootStore"in t?t.rootStore:t,a=r.useState("open"),l=r.useState("floatingId"),c=r.useState("domReferenceElement"),f=r.useState("floatingElement"),{role:d="dialog"}=o,m=Ss(),p=c?.id||m,y=R.useMemo(()=>fu(f)?.id||l,[f,l]),g=$z.get(d)??d,b=Vo()!=null,x=R.useMemo(()=>g==="tooltip"||d==="label"?qt:{"aria-haspopup":g==="alertdialog"?"dialog":g,"aria-expanded":"false",...g==="listbox"&&{role:"combobox"},...g==="menu"&&b&&{role:"menuitem"},...d==="select"&&{"aria-autocomplete":"none"},...d==="combobox"&&{"aria-autocomplete":"list"}},[g,b,d]),w=R.useMemo(()=>g==="tooltip"||d==="label"?{[`aria-${d==="label"?"labelledby":"describedby"}`]:a?y:void 0}:{...x,"aria-expanded":a?"true":"false","aria-controls":a?y:void 0,...g==="menu"&&{id:p}},[g,y,a,p,d,x]),E=R.useMemo(()=>{const _={id:y,...g&&{role:g}};return g==="tooltip"||d==="label"?_:{..._,...g==="menu"&&{"aria-labelledby":p}}},[g,y,p,d]),C=R.useCallback(({active:_,selected:k})=>{const O={role:"option",..._&&{id:`${y}-fui-option`}};switch(d){case"select":case"combobox":return{...O,"aria-selected":k}}return{}},[y,d]);return R.useMemo(()=>({reference:w,floating:E,item:C,trigger:x}),[w,E,x,C])}function Jz(t,o){const r="rootStore"in t?t.rootStore:t,a=r.context.dataRef,l=r.useState("open"),{listRef:c,activeIndex:f,onMatch:d,onTypingChange:m,enabled:p=!0,resetMs:y=750,selectedIndex:g=null}=o,v=qn(),b=R.useRef(""),x=R.useRef(g??f??-1),w=R.useRef(null);Ae(()=>{!l&&g!==null||(v.clear(),w.current=null,b.current!==""&&(b.current=""))},[l,g,v]),Ae(()=>{l&&b.current===""&&(x.current=g??f??-1)},[l,g,f]);const E=Ce(z=>{z?a.current.typing||(a.current.typing=z,m?.(z)):a.current.typing&&(a.current.typing=z,m?.(z))}),C=Ce(z=>{function N(V,J,ne){const ae=J.find(B=>B?.toLocaleLowerCase().indexOf(ne.toLocaleLowerCase())===0);return ae?V.indexOf(ae):-1}const j=c.current;if(b.current.length>0&&b.current[0]!==" "&&(N(j,j,b.current)===-1?E(!1):z.key===" "&&Jt(z)),j==null||z.key.length!==1||z.ctrlKey||z.metaKey||z.altKey)return;l&&z.key!==" "&&(Jt(z),E(!0));const D=b.current==="";D&&(x.current=g??f??-1),j.every(V=>V?V[0]?.toLocaleLowerCase()!==V[1]?.toLocaleLowerCase():!0)&&b.current===z.key&&(b.current="",x.current=w.current),b.current+=z.key,v.start(y,()=>{b.current="",x.current=w.current,E(!1)});const $=D?g??f??-1:x.current,Z=N(j,[...j.slice(($||0)+1),...j.slice(0,($||0)+1)],b.current);Z!==-1?(d?.(Z),w.current=Z):z.key!==" "&&(b.current="",E(!1))}),_=Ce(z=>{const N=z.relatedTarget,j=r.select("domReferenceElement"),D=r.select("floatingElement"),Y=Ye(j,N),$=Ye(D,N);Y||$||(v.clear(),b.current="",x.current=w.current,E(!1))}),k=R.useMemo(()=>({onKeyDown:C,onBlur:_}),[C,_]),O=R.useMemo(()=>({onKeyDown:C,onKeyUp(z){z.key===" "&&E(!1)},onBlur:_}),[C,_,E]);return R.useMemo(()=>p?{reference:k,floating:O}:{},[p,k,O])}function z0(t,o){const[r,a]=t;let l=!1;const c=o.length;for(let f=0,d=c-1;f<c;d=f++){const[m,p]=o[f]||[0,0],[y,g]=o[d]||[0,0];p>=a!=g>=a&&r<=(y-m)*(a-p)/(g-p)+m&&(l=!l)}return l}function Wz(t,o){return t[0]>=o.x&&t[0]<=o.x+o.width&&t[1]>=o.y&&t[1]<=o.y+o.height}function lm(t={}){const{buffer:o=.5,blockPointerEvents:r=!1,requireIntent:a=!0}=t,l=new co;let c=!1,f=null,d=null,m=typeof performance<"u"?performance.now():0;function p(g,v){const b=performance.now(),x=b-m;if(f===null||d===null||x===0)return f=g,d=v,m=b,null;const w=g-f,E=v-d,_=Math.sqrt(w*w+E*E)/x;return f=g,d=v,m=b,_}const y=({x:g,y:v,placement:b,elements:x,onClose:w,nodeId:E,tree:C})=>function(k){function O(){l.clear(),w()}if(l.clear(),!x.domReference||!x.floating||b==null||g==null||v==null)return;const{clientX:z,clientY:N}=k,j=[z,N],D=rn(k),Y=k.type==="mouseleave",$=Ye(x.floating,D),Z=Ye(x.domReference,D),V=x.domReference.getBoundingClientRect(),J=x.floating.getBoundingClientRect(),ne=b.split("-")[0],ae=g>J.right-J.width/2,B=v>J.bottom-J.height/2,H=Wz(j,V),G=J.width>V.width,ce=J.height>V.height,W=(G?V:J).left,P=(G?V:J).right,X=(ce?V:J).top,le=(ce?V:J).bottom;if($&&(c=!0,!Y))return;if(Z&&(c=!1),Z&&!Y){c=!0;return}if(Y&&st(k.relatedTarget)&&Ye(x.floating,k.relatedTarget)||C&&us(C.nodesRef.current,E).some(({context:he})=>he?.open))return;if(ne==="top"&&v>=V.bottom-1||ne==="bottom"&&v<=V.top+1||ne==="left"&&g>=V.right-1||ne==="right"&&g<=V.left+1)return O();let re=[];switch(ne){case"top":re=[[W,V.top+1],[W,J.bottom-1],[P,J.bottom-1],[P,V.top+1]];break;case"bottom":re=[[W,J.top+1],[W,V.bottom-1],[P,V.bottom-1],[P,J.top+1]];break;case"left":re=[[J.right-1,le],[J.right-1,X],[V.left+1,X],[V.left+1,le]];break;case"right":re=[[V.right-1,le],[V.right-1,X],[J.left+1,X],[J.left+1,le]];break}function ue([he,ve]){switch(ne){case"top":{const Me=[G?he+o/2:ae?he+o*4:he-o*4,ve+o+1],fe=[G?he-o/2:ae?he+o*4:he-o*4,ve+o+1],ze=[[J.left,ae||G?J.bottom-o:J.top],[J.right,ae?G?J.bottom-o:J.top:J.bottom-o]];return[Me,fe,...ze]}case"bottom":{const Me=[G?he+o/2:ae?he+o*4:he-o*4,ve-o],fe=[G?he-o/2:ae?he+o*4:he-o*4,ve-o],ze=[[J.left,ae||G?J.top+o:J.bottom],[J.right,ae?G?J.top+o:J.bottom:J.top+o]];return[Me,fe,...ze]}case"left":{const Me=[he+o+1,ce?ve+o/2:B?ve+o*4:ve-o*4],fe=[he+o+1,ce?ve-o/2:B?ve+o*4:ve-o*4];return[...[[B||ce?J.right-o:J.left,J.top],[B?ce?J.right-o:J.left:J.right-o,J.bottom]],Me,fe]}case"right":{const Me=[he-o,ce?ve+o/2:B?ve+o*4:ve-o*4],fe=[he-o,ce?ve-o/2:B?ve+o*4:ve-o*4],ze=[[B||ce?J.left+o:J.right,J.top],[B?ce?J.left+o:J.right:J.left+o,J.bottom]];return[Me,fe,...ze]}default:return[]}}if(!z0([z,N],re)){if(c&&!H)return O();if(!Y&&a){const he=p(k.clientX,k.clientY);if(he!==null&&he<.1)return O()}z0([z,N],ue([g,v]))?!c&&a&&l.start(40,O):O()}};return y.__options={blockPointerEvents:r},y}let eN=(function(t){return t.nestedDialogs="--nested-dialogs",t})({}),tN=(function(t){return t[t.open=is.open]="open",t[t.closed=is.closed]="closed",t[t.startingStyle=is.startingStyle]="startingStyle",t[t.endingStyle=is.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const Lw=R.createContext(void 0);function nN(){const t=R.useContext(Lw);if(t===void 0)throw new Error(tn(26));return t}const jw="ArrowUp",Pw="ArrowDown",Uw="ArrowLeft",Bw="ArrowRight",Iw="Home",Hw="End",oN=new Set([Uw,Bw]),rN=new Set([jw,Pw]),sN=new Set([...oN,...rN]);[...sN];const Vw=new Set([jw,Pw,Uw,Bw,Iw,Hw]),aN={...Es,...Bu,nestedDialogOpen(t){return t?{[tN.nestedDialogOpen]:""}:null}},iN=R.forwardRef(function(o,r){const{className:a,finalFocus:l,initialFocus:c,render:f,...d}=o,{store:m}=ws(),p=m.useState("descriptionElementId"),y=m.useState("disablePointerDismissal"),g=m.useState("floatingRootContext"),v=m.useState("popupProps"),b=m.useState("modal"),x=m.useState("mounted"),w=m.useState("nested"),E=m.useState("nestedOpenDialogCount"),C=m.useState("open"),_=m.useState("openMethod"),k=m.useState("titleElementId"),O=m.useState("transitionStatus"),z=m.useState("role");nN(),Iu({open:C,ref:m.context.popupRef,onComplete(){C&&m.context.onOpenChangeComplete?.(!0)}});function N(Z){return Z==="touch"?m.context.popupRef.current:!0}const j=c===void 0?N:c,D=E>0,$=Mt("div",o,{state:{open:C,nested:w,transitionStatus:O,nestedDialogOpen:D},props:[v,{"aria-labelledby":k??void 0,"aria-describedby":p??void 0,role:z,tabIndex:-1,hidden:!x,onKeyDown(Z){Vw.has(Z.key)&&Z.stopPropagation()},style:{[eN.nestedDialogs]:E}},d],ref:[r,m.context.popupRef,m.useStateSetter("popupElement")],stateAttributesMapping:aN});return L.jsx(pw,{context:g,openInteractionType:_,disabled:!x,closeOnFocusOut:!y,initialFocus:j,returnFocus:l,modal:b!==!1,restoreFocus:"popup",children:$})});function qw(t){return kp(19)?t:t?"true":void 0}const Yw=R.forwardRef(function(o,r){const{cutout:a,...l}=o;let c;if(a){const f=a?.getBoundingClientRect();c=`polygon(
18
+ `).filter(Boolean);for(const v of g)try{o(JSON.parse(v))}catch(b){r?.(`Invalid JSON line: ${v}`,b)}}if(m)break}}catch(d){r?.("Stream processing error:",d)}})(),o(f)}async function nA({jsonStream:t,onMessage:o,onError:r}){const a=t.getReader(),{value:l,done:c}=await a.read();if(c||!l)throw new Error("Stream ended before first object");const f=JSON.parse(l);return(async()=>{try{for(;;){const{value:d,done:m}=await a.read();if(m)break;if(d)try{o(JSON.parse(d))}catch(p){r?.(`Invalid JSON: ${d}`,p)}}}catch(d){r?.("Stream processing error:",d)}})(),o(f)}function oA(t){const o="/_serverFn/"+t;return Object.assign((...l)=>{const c=nx()?.serverFns?.fetch;return J_(o,l,c??fetch)},{url:o,serverFnMeta:{id:t},[Gh]:!0})}const rA={key:"$TSS/serverfn",test:t=>typeof t!="function"||!(Gh in t)?!1:!!t[Gh],toSerializable:({serverFnMeta:t})=>({functionId:t.id}),fromSerializable:({functionId:t})=>oA(t)},sA="/assets/styles-D2oHO1JL.css";const ax=(...t)=>t.filter((o,r,a)=>!!o&&o.trim()!==""&&a.indexOf(o)===r).join(" ").trim();const aA=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const iA=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(o,r,a)=>a?a.toUpperCase():r.toLowerCase());const $b=t=>{const o=iA(t);return o.charAt(0).toUpperCase()+o.slice(1)};var lA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const cA=t=>{for(const o in t)if(o.startsWith("aria-")||o==="role"||o==="title")return!0;return!1};const uA=R.forwardRef(({color:t="currentColor",size:o=24,strokeWidth:r=2,absoluteStrokeWidth:a,className:l="",children:c,iconNode:f,...d},m)=>R.createElement("svg",{ref:m,...lA,width:o,height:o,stroke:t,strokeWidth:a?Number(r)*24/Number(o):r,className:ax("lucide",l),...!c&&!cA(d)&&{"aria-hidden":"true"},...d},[...f.map(([p,y])=>R.createElement(p,y)),...Array.isArray(c)?c:[c]]));const Ho=(t,o)=>{const r=R.forwardRef(({className:a,...l},c)=>R.createElement(uA,{ref:c,iconNode:o,className:ax(`lucide-${aA($b(t))}`,`lucide-${t}`,a),...l}));return r.displayName=$b(t),r};const fA=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],dA=Ho("chevron-right",fA);const hA=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],pA=Ho("circle-plus",hA);const mA=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],gA=Ho("ellipsis",mA);const yA=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Fh=Ho("message-square",yA);const vA=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],bA=Ho("panel-left",vA);const SA=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],xA=Ho("puzzle",SA);const wA=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],EA=Ho("settings",wA);const RA=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],TA=Ho("trash-2",RA);const CA=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],MA=Ho("x",CA);function Xh(t,o){if(t&&!o)return t;if(!t&&o)return o;if(t||o)return{...t,...o}}const Vi={};function Po(t,o,r,a,l){let c={...Kh(t,Vi)};return o&&(c=Gc(c,o)),r&&(c=Gc(c,r)),a&&(c=Gc(c,a)),c}function OA(t){if(t.length===0)return Vi;if(t.length===1)return Kh(t[0],Vi);let o={...Kh(t[0],Vi)};for(let r=1;r<t.length;r+=1)o=Gc(o,t[r]);return o}function Gc(t,o){return ix(o)?o(t):_A(t,o)}function _A(t,o){if(!o)return t;for(const r in o){const a=o[r];switch(r){case"style":{t[r]=Xh(t.style,a);break}case"className":{t[r]=lx(t.className,a);break}default:AA(r,a)?t[r]=DA(t[r],a):t[r]=a}}return t}function AA(t,o){const r=t.charCodeAt(0),a=t.charCodeAt(1),l=t.charCodeAt(2);return r===111&&a===110&&l>=65&&l<=90&&(typeof o=="function"||typeof o>"u")}function ix(t){return typeof t=="function"}function Kh(t,o){return ix(t)?t(o):t??Vi}function DA(t,o){return o?t?r=>{if(kA(r)){const l=r;Qh(l);const c=o(l);return l.baseUIHandlerPrevented||t?.(l),c}const a=o(r);return t?.(r),a}:o:t}function Qh(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function lx(t,o){return o?t?o+" "+t:o:t}function kA(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function tn(t,...o){const r=new URL("https://base-ui.com/production-error");return r.searchParams.set("code",t.toString()),o.forEach(a=>r.searchParams.append("args[]",a)),`Base UI error #${t}; visit ${r} for the full message.`}const Jb={};function Wt(t,o){const r=R.useRef(Jb);return r.current===Jb&&(r.current=t(o)),r}function Ma(t,o,r,a){const l=Wt(cx).current;return NA(l,t,o,r,a)&&ux(l,[t,o,r,a]),l.callback}function zA(t){const o=Wt(cx).current;return LA(o,t)&&ux(o,t),o.callback}function cx(){return{callback:null,cleanup:null,refs:[]}}function NA(t,o,r,a,l){return t.refs[0]!==o||t.refs[1]!==r||t.refs[2]!==a||t.refs[3]!==l}function LA(t,o){return t.refs.length!==o.length||t.refs.some((r,a)=>r!==o[a])}function ux(t,o){if(t.refs=o,o.every(r=>r==null)){t.callback=null;return}t.callback=r=>{if(t.cleanup&&(t.cleanup(),t.cleanup=null),r!=null){const a=Array(o.length).fill(null);for(let l=0;l<o.length;l+=1){const c=o[l];if(c!=null)switch(typeof c){case"function":{const f=c(r);typeof f=="function"&&(a[l]=f);break}case"object":{c.current=r;break}}}t.cleanup=()=>{for(let l=0;l<o.length;l+=1){const c=o[l];if(c!=null)switch(typeof c){case"function":{const f=a[l];typeof f=="function"?f():c(null);break}case"object":{c.current=null;break}}}}}}}const jA=parseInt(R.version,10);function kp(t){return jA>=t}function Wb(t){if(!R.isValidElement(t))return null;const o=t,r=o.props;return(kp(19)?r?.ref:o.ref)??null}function PA(t,o){const r={};for(const a in t){const l=t[a];if(o?.hasOwnProperty(a)){const c=o[a](l);c!=null&&Object.assign(r,c);continue}l===!0?r[`data-${a.toLowerCase()}`]="":l&&(r[`data-${a.toLowerCase()}`]=l.toString())}return r}function UA(t,o){return typeof t=="function"?t(o):t}function BA(t,o){return typeof t=="function"?t(o):t}function fx(){}const Zh=Object.freeze([]),qt=Object.freeze({}),IA=500,HA=500,VA={style:{transition:"none"}},qA="data-base-ui-click-trigger",YA={fallbackAxisSide:"none"},dx={fallbackAxisSide:"end"},GA={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function Mt(t,o,r={}){const a=o.render,l=FA(o,r);if(r.enabled===!1)return null;const c=r.state??qt;return KA(t,a,l,c)}function FA(t,o={}){const{className:r,style:a,render:l}=t,{state:c=qt,ref:f,props:d,stateAttributesMapping:m,enabled:p=!0}=o,y=p?UA(r,c):void 0,g=p?BA(a,c):void 0,v=p?PA(c,m):qt,b=p?Xh(v,Array.isArray(d)?OA(d):d)??qt:qt;return typeof document<"u"&&(p?Array.isArray(f)?b.ref=zA([b.ref,Wb(l),...f]):b.ref=Ma(b.ref,Wb(l),f):Ma(null,null)),p?(y!==void 0&&(b.className=lx(b.className,y)),g!==void 0&&(b.style=Xh(b.style,g)),b):qt}const XA=Symbol.for("react.lazy");function KA(t,o,r,a){if(o){if(typeof o=="function")return o(r,a);const l=Po(r,o.props);l.ref=r.ref;let c=o;return c?.$$typeof===XA&&(c=R.Children.toArray(o)[0]),R.cloneElement(c,l)}if(t&&typeof t=="string")return QA(t,r);throw new Error(tn(8))}function QA(t,o){return t==="button"?R.createElement("button",{type:"button",...o,key:o.key}):t==="img"?R.createElement("img",{alt:"",...o,key:o.key}):R.createElement(t,o)}function ku(t){return Mt(t.defaultTagName??"div",t,t)}function hx(t){var o,r,a="";if(typeof t=="string"||typeof t=="number")a+=t;else if(typeof t=="object")if(Array.isArray(t)){var l=t.length;for(o=0;o<l;o++)t[o]&&(r=hx(t[o]))&&(a&&(a+=" "),a+=r)}else for(r in t)t[r]&&(a&&(a+=" "),a+=r);return a}function px(){for(var t,o,r=0,a="",l=arguments.length;r<l;r++)(t=arguments[r])&&(o=hx(t))&&(a&&(a+=" "),a+=o);return a}const e0=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,t0=px,zp=(t,o)=>r=>{var a;if(o?.variants==null)return t0(t,r?.class,r?.className);const{variants:l,defaultVariants:c}=o,f=Object.keys(l).map(p=>{const y=r?.[p],g=c?.[p];if(y===null)return null;const v=e0(y)||e0(g);return l[p][v]}),d=r&&Object.entries(r).reduce((p,y)=>{let[g,v]=y;return v===void 0||(p[g]=v),p},{}),m=o==null||(a=o.compoundVariants)===null||a===void 0?void 0:a.reduce((p,y)=>{let{class:g,className:v,...b}=y;return Object.entries(b).every(x=>{let[w,E]=x;return Array.isArray(E)?E.includes({...c,...d}[w]):{...c,...d}[w]===E})?[...p,g,v]:p},[]);return t0(t,f,m,r?.class,r?.className)};function zu(){return typeof window<"u"}function zr(t){return Np(t)?(t.nodeName||"").toLowerCase():"#document"}function zt(t){var o;return(t==null||(o=t.ownerDocument)==null?void 0:o.defaultView)||window}function uo(t){var o;return(o=(Np(t)?t.ownerDocument:t.document)||window.document)==null?void 0:o.documentElement}function Np(t){return zu()?t instanceof Node||t instanceof zt(t).Node:!1}function st(t){return zu()?t instanceof Element||t instanceof zt(t).Element:!1}function St(t){return zu()?t instanceof HTMLElement||t instanceof zt(t).HTMLElement:!1}function $h(t){return!zu()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof zt(t).ShadowRoot}const ZA=new Set(["inline","contents"]);function Nr(t){const{overflow:o,overflowX:r,overflowY:a,display:l}=On(t);return/auto|scroll|overlay|hidden|clip/.test(o+a+r)&&!ZA.has(l)}const $A=new Set(["table","td","th"]);function JA(t){return $A.has(zr(t))}const WA=[":popover-open",":modal"];function Nu(t){return WA.some(o=>{try{return t.matches(o)}catch{return!1}})}const e2=["transform","translate","scale","rotate","perspective"],t2=["transform","translate","scale","rotate","perspective","filter"],n2=["paint","layout","strict","content"];function Lp(t){const o=Lu(),r=st(t)?On(t):t;return e2.some(a=>r[a]?r[a]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!o&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!o&&(r.filter?r.filter!=="none":!1)||t2.some(a=>(r.willChange||"").includes(a))||n2.some(a=>(r.contain||"").includes(a))}function o2(t){let o=lo(t);for(;St(o)&&!ro(o);){if(Lp(o))return o;if(Nu(o))return null;o=lo(o)}return null}function Lu(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const r2=new Set(["html","body","#document"]);function ro(t){return r2.has(zr(t))}function On(t){return zt(t).getComputedStyle(t)}function ju(t){return st(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function lo(t){if(zr(t)==="html")return t;const o=t.assignedSlot||t.parentNode||$h(t)&&t.host||uo(t);return $h(o)?o.host:o}function mx(t){const o=lo(t);return ro(o)?t.ownerDocument?t.ownerDocument.body:t.body:St(o)&&Nr(o)?o:mx(o)}function Mr(t,o,r){var a;o===void 0&&(o=[]),r===void 0&&(r=!0);const l=mx(t),c=l===((a=t.ownerDocument)==null?void 0:a.body),f=zt(l);if(c){const d=Jh(f);return o.concat(f,f.visualViewport||[],Nr(l)?l:[],d&&r?Mr(d):[])}return o.concat(l,Mr(l,[],r))}function Jh(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const Ch=pp[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],s2=Ch&&Ch!==R.useLayoutEffect?Ch:t=>t();function Ce(t){const o=Wt(a2).current;return o.next=t,s2(o.effect),o.trampoline}function a2(){const t={next:void 0,callback:i2,trampoline:(...o)=>t.callback?.(...o),effect:()=>{t.callback=t.next}};return t}function i2(){}const l2={...pp},c2=()=>{},Ae=typeof document<"u"?R.useLayoutEffect:c2,u2=R.createContext(void 0);function jp(t=!1){const o=R.useContext(u2);if(o===void 0&&!t)throw new Error(tn(16));return o}function f2(t){const{focusableWhenDisabled:o,disabled:r,composite:a=!1,tabIndex:l=0,isNativeButton:c}=t,f=a&&o!==!1,d=a&&o===!1;return{props:R.useMemo(()=>{const p={onKeyDown(y){r&&o&&y.key!=="Tab"&&y.preventDefault()}};return a||(p.tabIndex=l,!c&&r&&(p.tabIndex=o?l:-1)),(c&&(o||f)||!c&&r)&&(p["aria-disabled"]=r),c&&(!o||d)&&(p.disabled=r),p},[a,r,o,f,d,c,l])}}function Pu(t={}){const{disabled:o=!1,focusableWhenDisabled:r,tabIndex:a=0,native:l=!0}=t,c=R.useRef(null),f=jp(!0)!==void 0,d=Ce(()=>{const v=c.current;return!!(v?.tagName==="A"&&v?.href)}),{props:m}=f2({focusableWhenDisabled:r,disabled:o,composite:f,tabIndex:a,isNativeButton:l}),p=R.useCallback(()=>{const v=c.current;d2(v)&&f&&o&&m.disabled===void 0&&v.disabled&&(v.disabled=!1)},[o,m.disabled,f]);Ae(p,[p]);const y=R.useCallback((v={})=>{const{onClick:b,onMouseDown:x,onKeyUp:w,onKeyDown:E,onPointerDown:C,..._}=v;return Po({type:l?"button":void 0,onClick(O){if(o){O.preventDefault();return}b?.(O)},onMouseDown(O){o||x?.(O)},onKeyDown(O){if(o||(Qh(O),E?.(O)),O.baseUIHandlerPrevented)return;const z=O.target===O.currentTarget&&!l&&!d()&&!o,N=O.key==="Enter",j=O.key===" ";z&&((j||N)&&O.preventDefault(),N&&b?.(O))},onKeyUp(O){o||(Qh(O),w?.(O)),!O.baseUIHandlerPrevented&&O.target===O.currentTarget&&!l&&!o&&O.key===" "&&b?.(O)},onPointerDown(O){if(o){O.preventDefault();return}C?.(O)}},l?void 0:{role:"button"},m,_)},[o,m,l,d]),g=Ce(v=>{c.current=v,p()});return{getButtonProps:y,buttonRef:g}}function d2(t){return St(t)&&t.tagName==="BUTTON"}const h2=R.forwardRef(function(o,r){const{render:a,className:l,disabled:c=!1,focusableWhenDisabled:f=!1,nativeButton:d=!0,...m}=o,{getButtonProps:p,buttonRef:y}=Pu({disabled:c,focusableWhenDisabled:f,native:d});return Mt("button",o,{state:{disabled:c},ref:[r,y],props:[m,p]})}),p2=(t,o)=>{const r=new Array(t.length+o.length);for(let a=0;a<t.length;a++)r[a]=t[a];for(let a=0;a<o.length;a++)r[t.length+a]=o[a];return r},m2=(t,o)=>({classGroupId:t,validator:o}),gx=(t=new Map,o=null,r)=>({nextPart:t,validators:o,classGroupId:r}),cu="-",n0=[],g2="arbitrary..",y2=t=>{const o=b2(t),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=t;return{getClassGroupId:f=>{if(f.startsWith("[")&&f.endsWith("]"))return v2(f);const d=f.split(cu),m=d[0]===""&&d.length>1?1:0;return yx(d,m,o)},getConflictingClassGroupIds:(f,d)=>{if(d){const m=a[f],p=r[f];return m?p?p2(p,m):m:p||n0}return r[f]||n0}}},yx=(t,o,r)=>{if(t.length-o===0)return r.classGroupId;const l=t[o],c=r.nextPart.get(l);if(c){const p=yx(t,o+1,c);if(p)return p}const f=r.validators;if(f===null)return;const d=o===0?t.join(cu):t.slice(o).join(cu),m=f.length;for(let p=0;p<m;p++){const y=f[p];if(y.validator(d))return y.classGroupId}},v2=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const o=t.slice(1,-1),r=o.indexOf(":"),a=o.slice(0,r);return a?g2+a:void 0})(),b2=t=>{const{theme:o,classGroups:r}=t;return S2(r,o)},S2=(t,o)=>{const r=gx();for(const a in t){const l=t[a];Pp(l,r,a,o)}return r},Pp=(t,o,r,a)=>{const l=t.length;for(let c=0;c<l;c++){const f=t[c];x2(f,o,r,a)}},x2=(t,o,r,a)=>{if(typeof t=="string"){w2(t,o,r);return}if(typeof t=="function"){E2(t,o,r,a);return}R2(t,o,r,a)},w2=(t,o,r)=>{const a=t===""?o:vx(o,t);a.classGroupId=r},E2=(t,o,r,a)=>{if(T2(t)){Pp(t(a),o,r,a);return}o.validators===null&&(o.validators=[]),o.validators.push(m2(r,t))},R2=(t,o,r,a)=>{const l=Object.entries(t),c=l.length;for(let f=0;f<c;f++){const[d,m]=l[f];Pp(m,vx(o,d),r,a)}},vx=(t,o)=>{let r=t;const a=o.split(cu),l=a.length;for(let c=0;c<l;c++){const f=a[c];let d=r.nextPart.get(f);d||(d=gx(),r.nextPart.set(f,d)),r=d}return r},T2=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,C2=t=>{if(t<1)return{get:()=>{},set:()=>{}};let o=0,r=Object.create(null),a=Object.create(null);const l=(c,f)=>{r[c]=f,o++,o>t&&(o=0,a=r,r=Object.create(null))};return{get(c){let f=r[c];if(f!==void 0)return f;if((f=a[c])!==void 0)return l(c,f),f},set(c,f){c in r?r[c]=f:l(c,f)}}},Wh="!",o0=":",M2=[],r0=(t,o,r,a,l)=>({modifiers:t,hasImportantModifier:o,baseClassName:r,maybePostfixModifierPosition:a,isExternal:l}),O2=t=>{const{prefix:o,experimentalParseClassName:r}=t;let a=l=>{const c=[];let f=0,d=0,m=0,p;const y=l.length;for(let w=0;w<y;w++){const E=l[w];if(f===0&&d===0){if(E===o0){c.push(l.slice(m,w)),m=w+1;continue}if(E==="/"){p=w;continue}}E==="["?f++:E==="]"?f--:E==="("?d++:E===")"&&d--}const g=c.length===0?l:l.slice(m);let v=g,b=!1;g.endsWith(Wh)?(v=g.slice(0,-1),b=!0):g.startsWith(Wh)&&(v=g.slice(1),b=!0);const x=p&&p>m?p-m:void 0;return r0(c,b,v,x)};if(o){const l=o+o0,c=a;a=f=>f.startsWith(l)?c(f.slice(l.length)):r0(M2,!1,f,void 0,!0)}if(r){const l=a;a=c=>r({className:c,parseClassName:l})}return a},_2=t=>{const o=new Map;return t.orderSensitiveModifiers.forEach((r,a)=>{o.set(r,1e6+a)}),r=>{const a=[];let l=[];for(let c=0;c<r.length;c++){const f=r[c],d=f[0]==="[",m=o.has(f);d||m?(l.length>0&&(l.sort(),a.push(...l),l=[]),a.push(f)):l.push(f)}return l.length>0&&(l.sort(),a.push(...l)),a}},A2=t=>({cache:C2(t.cacheSize),parseClassName:O2(t),sortModifiers:_2(t),...y2(t)}),D2=/\s+/,k2=(t,o)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:l,sortModifiers:c}=o,f=[],d=t.trim().split(D2);let m="";for(let p=d.length-1;p>=0;p-=1){const y=d[p],{isExternal:g,modifiers:v,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:w}=r(y);if(g){m=y+(m.length>0?" "+m:m);continue}let E=!!w,C=a(E?x.substring(0,w):x);if(!C){if(!E){m=y+(m.length>0?" "+m:m);continue}if(C=a(x),!C){m=y+(m.length>0?" "+m:m);continue}E=!1}const _=v.length===0?"":v.length===1?v[0]:c(v).join(":"),k=b?_+Wh:_,O=k+C;if(f.indexOf(O)>-1)continue;f.push(O);const z=l(C,E);for(let N=0;N<z.length;++N){const j=z[N];f.push(k+j)}m=y+(m.length>0?" "+m:m)}return m},z2=(...t)=>{let o=0,r,a,l="";for(;o<t.length;)(r=t[o++])&&(a=bx(r))&&(l&&(l+=" "),l+=a);return l},bx=t=>{if(typeof t=="string")return t;let o,r="";for(let a=0;a<t.length;a++)t[a]&&(o=bx(t[a]))&&(r&&(r+=" "),r+=o);return r},N2=(t,...o)=>{let r,a,l,c;const f=m=>{const p=o.reduce((y,g)=>g(y),t());return r=A2(p),a=r.cache.get,l=r.cache.set,c=d,d(m)},d=m=>{const p=a(m);if(p)return p;const y=k2(m,r);return l(m,y),y};return c=f,(...m)=>c(z2(...m))},L2=[],jt=t=>{const o=r=>r[t]||L2;return o.isThemeGetter=!0,o},Sx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,xx=/^\((?:(\w[\w-]*):)?(.+)\)$/i,j2=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,P2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,U2=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,B2=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,I2=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,H2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,vr=t=>j2.test(t),Ge=t=>!!t&&!Number.isNaN(Number(t)),br=t=>!!t&&Number.isInteger(Number(t)),Mh=t=>t.endsWith("%")&&Ge(t.slice(0,-1)),ko=t=>P2.test(t),wx=()=>!0,V2=t=>U2.test(t)&&!B2.test(t),Up=()=>!1,q2=t=>I2.test(t),Y2=t=>H2.test(t),G2=t=>!Ee(t)&&!Re(t),F2=t=>Lr(t,Tx,Up),Ee=t=>Sx.test(t),os=t=>Lr(t,Cx,V2),s0=t=>Lr(t,eD,Ge),X2=t=>Lr(t,Ox,wx),K2=t=>Lr(t,Mx,Up),a0=t=>Lr(t,Ex,Up),Q2=t=>Lr(t,Rx,Y2),Oc=t=>Lr(t,_x,q2),Re=t=>xx.test(t),Pi=t=>bs(t,Cx),Z2=t=>bs(t,Mx),i0=t=>bs(t,Ex),$2=t=>bs(t,Tx),J2=t=>bs(t,Rx),_c=t=>bs(t,_x,!0),W2=t=>bs(t,Ox,!0),Lr=(t,o,r)=>{const a=Sx.exec(t);return a?a[1]?o(a[1]):r(a[2]):!1},bs=(t,o,r=!1)=>{const a=xx.exec(t);return a?a[1]?o(a[1]):r:!1},Ex=t=>t==="position"||t==="percentage",Rx=t=>t==="image"||t==="url",Tx=t=>t==="length"||t==="size"||t==="bg-size",Cx=t=>t==="length",eD=t=>t==="number",Mx=t=>t==="family-name",Ox=t=>t==="number"||t==="weight",_x=t=>t==="shadow",tD=()=>{const t=jt("color"),o=jt("font"),r=jt("text"),a=jt("font-weight"),l=jt("tracking"),c=jt("leading"),f=jt("breakpoint"),d=jt("container"),m=jt("spacing"),p=jt("radius"),y=jt("shadow"),g=jt("inset-shadow"),v=jt("text-shadow"),b=jt("drop-shadow"),x=jt("blur"),w=jt("perspective"),E=jt("aspect"),C=jt("ease"),_=jt("animate"),k=()=>["auto","avoid","all","avoid-page","page","left","right","column"],O=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],z=()=>[...O(),Re,Ee],N=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto","contain","none"],D=()=>[Re,Ee,m],Y=()=>[vr,"full","auto",...D()],$=()=>[br,"none","subgrid",Re,Ee],Z=()=>["auto",{span:["full",br,Re,Ee]},br,Re,Ee],V=()=>[br,"auto",Re,Ee],J=()=>["auto","min","max","fr",Re,Ee],ne=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ae=()=>["start","end","center","stretch","center-safe","end-safe"],B=()=>["auto",...D()],H=()=>[vr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],G=()=>[vr,"screen","full","dvw","lvw","svw","min","max","fit",...D()],ce=()=>[vr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],W=()=>[t,Re,Ee],P=()=>[...O(),i0,a0,{position:[Re,Ee]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],le=()=>["auto","cover","contain",$2,F2,{size:[Re,Ee]}],re=()=>[Mh,Pi,os],ue=()=>["","none","full",p,Re,Ee],he=()=>["",Ge,Pi,os],ve=()=>["solid","dashed","dotted","double"],Me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],fe=()=>[Ge,Mh,i0,a0],ze=()=>["","none",x,Re,Ee],je=()=>["none",Ge,Re,Ee],te=()=>["none",Ge,Re,Ee],me=()=>[Ge,Re,Ee],pe=()=>[vr,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ko],breakpoint:[ko],color:[wx],container:[ko],"drop-shadow":[ko],ease:["in","out","in-out"],font:[G2],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ko],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ko],shadow:[ko],spacing:["px",Ge],text:[ko],"text-shadow":[ko],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",vr,Ee,Re,E]}],container:["container"],columns:[{columns:[Ge,Ee,Re,d]}],"break-after":[{"break-after":k()}],"break-before":[{"break-before":k()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:z()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:j()}],"overscroll-x":[{"overscroll-x":j()}],"overscroll-y":[{"overscroll-y":j()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Y()}],"inset-x":[{"inset-x":Y()}],"inset-y":[{"inset-y":Y()}],start:[{"inset-s":Y(),start:Y()}],end:[{"inset-e":Y(),end:Y()}],"inset-bs":[{"inset-bs":Y()}],"inset-be":[{"inset-be":Y()}],top:[{top:Y()}],right:[{right:Y()}],bottom:[{bottom:Y()}],left:[{left:Y()}],visibility:["visible","invisible","collapse"],z:[{z:[br,"auto",Re,Ee]}],basis:[{basis:[vr,"full","auto",d,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,vr,"auto","initial","none",Ee]}],grow:[{grow:["",Ge,Re,Ee]}],shrink:[{shrink:["",Ge,Re,Ee]}],order:[{order:[br,"first","last","none",Re,Ee]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:Z()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:Z()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...ne(),"normal"]}],"justify-items":[{"justify-items":[...ae(),"normal"]}],"justify-self":[{"justify-self":["auto",...ae()]}],"align-content":[{content:["normal",...ne()]}],"align-items":[{items:[...ae(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ae(),{baseline:["","last"]}]}],"place-content":[{"place-content":ne()}],"place-items":[{"place-items":[...ae(),"baseline"]}],"place-self":[{"place-self":["auto",...ae()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:B()}],mx:[{mx:B()}],my:[{my:B()}],ms:[{ms:B()}],me:[{me:B()}],mbs:[{mbs:B()}],mbe:[{mbe:B()}],mt:[{mt:B()}],mr:[{mr:B()}],mb:[{mb:B()}],ml:[{ml:B()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...G()]}],"min-inline-size":[{"min-inline":["auto",...G()]}],"max-inline-size":[{"max-inline":["none",...G()]}],"block-size":[{block:["auto",...ce()]}],"min-block-size":[{"min-block":["auto",...ce()]}],"max-block-size":[{"max-block":["none",...ce()]}],w:[{w:[d,"screen",...H()]}],"min-w":[{"min-w":[d,"screen","none",...H()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[f]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,Pi,os]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,W2,X2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Mh,Ee]}],"font-family":[{font:[Z2,K2,o]}],"font-features":[{"font-features":[Ee]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[l,Re,Ee]}],"line-clamp":[{"line-clamp":[Ge,"none",Re,s0]}],leading:[{leading:[c,...D()]}],"list-image":[{"list-image":["none",Re,Ee]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Re,Ee]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ve(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",Re,os]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[Ge,"auto",Re,Ee]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Re,Ee]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Re,Ee]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:P()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:le()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},br,Re,Ee],radial:["",Re,Ee],conic:[br,Re,Ee]},J2,Q2]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:ue()}],"rounded-s":[{"rounded-s":ue()}],"rounded-e":[{"rounded-e":ue()}],"rounded-t":[{"rounded-t":ue()}],"rounded-r":[{"rounded-r":ue()}],"rounded-b":[{"rounded-b":ue()}],"rounded-l":[{"rounded-l":ue()}],"rounded-ss":[{"rounded-ss":ue()}],"rounded-se":[{"rounded-se":ue()}],"rounded-ee":[{"rounded-ee":ue()}],"rounded-es":[{"rounded-es":ue()}],"rounded-tl":[{"rounded-tl":ue()}],"rounded-tr":[{"rounded-tr":ue()}],"rounded-br":[{"rounded-br":ue()}],"rounded-bl":[{"rounded-bl":ue()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":he()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ve(),"hidden","none"]}],"divide-style":[{divide:[...ve(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-bs":[{"border-bs":W()}],"border-color-be":[{"border-be":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...ve(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,Re,Ee]}],"outline-w":[{outline:["",Ge,Pi,os]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",y,_c,Oc]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",g,_c,Oc]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[Ge,os]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",v,_c,Oc]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[Ge,Re,Ee]}],"mix-blend":[{"mix-blend":[...Me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Me()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":fe()}],"mask-image-linear-to-pos":[{"mask-linear-to":fe()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":fe()}],"mask-image-t-to-pos":[{"mask-t-to":fe()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":fe()}],"mask-image-r-to-pos":[{"mask-r-to":fe()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":fe()}],"mask-image-b-to-pos":[{"mask-b-to":fe()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":fe()}],"mask-image-l-to-pos":[{"mask-l-to":fe()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":fe()}],"mask-image-x-to-pos":[{"mask-x-to":fe()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":fe()}],"mask-image-y-to-pos":[{"mask-y-to":fe()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[Re,Ee]}],"mask-image-radial-from-pos":[{"mask-radial-from":fe()}],"mask-image-radial-to-pos":[{"mask-radial-to":fe()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":O()}],"mask-image-conic-pos":[{"mask-conic":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":fe()}],"mask-image-conic-to-pos":[{"mask-conic-to":fe()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:P()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:le()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Re,Ee]}],filter:[{filter:["","none",Re,Ee]}],blur:[{blur:ze()}],brightness:[{brightness:[Ge,Re,Ee]}],contrast:[{contrast:[Ge,Re,Ee]}],"drop-shadow":[{"drop-shadow":["","none",b,_c,Oc]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",Ge,Re,Ee]}],"hue-rotate":[{"hue-rotate":[Ge,Re,Ee]}],invert:[{invert:["",Ge,Re,Ee]}],saturate:[{saturate:[Ge,Re,Ee]}],sepia:[{sepia:["",Ge,Re,Ee]}],"backdrop-filter":[{"backdrop-filter":["","none",Re,Ee]}],"backdrop-blur":[{"backdrop-blur":ze()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,Re,Ee]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,Re,Ee]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,Re,Ee]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,Re,Ee]}],"backdrop-invert":[{"backdrop-invert":["",Ge,Re,Ee]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,Re,Ee]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,Re,Ee]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,Re,Ee]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Re,Ee]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",Re,Ee]}],ease:[{ease:["linear","initial",C,Re,Ee]}],delay:[{delay:[Ge,Re,Ee]}],animate:[{animate:["none",_,Re,Ee]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Re,Ee]}],"perspective-origin":[{"perspective-origin":z()}],rotate:[{rotate:je()}],"rotate-x":[{"rotate-x":je()}],"rotate-y":[{"rotate-y":je()}],"rotate-z":[{"rotate-z":je()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[Re,Ee,"","none","gpu","cpu"]}],"transform-origin":[{origin:z()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:pe()}],"translate-x":[{"translate-x":pe()}],"translate-y":[{"translate-y":pe()}],"translate-z":[{"translate-z":pe()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Re,Ee]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Re,Ee]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[Ge,Pi,os,s0]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},nD=N2(tD);function ct(...t){return nD(px(t))}const oD=zp("focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 rounded-lg border border-transparent bg-clip-padding text-sm font-medium focus-visible:ring-3 aria-invalid:ring-3 [&_svg:not([class*='size-'])]:size-4 inline-flex items-center justify-center whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none shrink-0 [&_svg]:shrink-0 outline-none group/button select-none",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 aria-expanded:bg-muted aria-expanded:text-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground dark:hover:bg-muted/50 aria-expanded:bg-muted aria-expanded:text-foreground",destructive:"bg-destructive/10 hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/20 text-destructive focus-visible:border-destructive/40 dark:hover:bg-destructive/30",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Ax({className:t,variant:o="default",size:r="default",...a}){return L.jsx(h2,{"data-slot":"button",className:ct(oD({variant:o,size:r,className:t})),...a})}let l0=0;function rD(t,o="mui"){const[r,a]=R.useState(t),l=t||r;return R.useEffect(()=>{r==null&&(l0+=1,a(`${o}-${l0}`))},[r,o]),l}const c0=l2.useId;function Ss(t,o){if(c0!==void 0){const r=c0();return t??(o?`${o}-${r}`:r)}return rD(t,o)}function xs(t){return Ss(t,"base-ui")}const sD=[];function Bp(t){R.useEffect(t,sD)}const Ui=0;class co{static create(){return new co}currentId=Ui;start(o,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ui,r()},o)}isStarted(){return this.currentId!==Ui}clear=()=>{this.currentId!==Ui&&(clearTimeout(this.currentId),this.currentId=Ui)};disposeEffect=()=>this.clear}function qn(){const t=Wt(co.create).current;return Bp(t.disposeEffect),t}function at(t){return t?.ownerDocument||document}const ja=typeof navigator<"u",Oh=iD(),Dx=cD(),kx=lD(),zx=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Nx=Oh.platform==="MacIntel"&&Oh.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Oh.platform),Lx=ja&&/apple/i.test(navigator.vendor),ep=ja&&/android/i.test(Dx)||/android/i.test(kx),aD=ja&&Dx.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,jx=kx.includes("jsdom/");function iD(){if(!ja)return{platform:"",maxTouchPoints:-1};const t=navigator.userAgentData;return t?.platform?{platform:t.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function lD(){if(!ja)return"";const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:o,version:r})=>`${o}/${r}`).join(" "):navigator.userAgent}function cD(){if(!ja)return"";const t=navigator.userAgentData;return t?.platform?t.platform:navigator.platform??""}const tp="data-base-ui-focusable",Px="active",Ux="selected",Bx="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Or="ArrowLeft",_r="ArrowRight",Ip="ArrowUp",Wi="ArrowDown";function Zn(t){let o=t.activeElement;for(;o?.shadowRoot?.activeElement!=null;)o=o.shadowRoot.activeElement;return o}function Ye(t,o){if(!t||!o)return!1;const r=o.getRootNode?.();if(t.contains(o))return!0;if(r&&$h(r)){let a=o;for(;a;){if(t===a)return!0;a=a.parentNode||a.host}}return!1}function uu(t,o){if(!st(t))return!1;const r=t;if(o.hasElement(r))return!r.hasAttribute("data-trigger-disabled");for(const[,a]of o.entries())if(Ye(a,r))return!a.hasAttribute("data-trigger-disabled");return!1}function rn(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Qn(t,o){if(o==null)return!1;if("composedPath"in t)return t.composedPath().includes(o);const r=t;return r.target!=null&&o.contains(r.target)}function uD(t){return t.matches("html,body")}function Uu(t){return St(t)&&t.matches(Bx)}function np(t){return t?t.getAttribute("role")==="combobox"&&Uu(t):!1}function fD(t){if(!t||jx)return!0;try{return t.matches(":focus-visible")}catch{return!0}}function fu(t){return t?t.hasAttribute(tp)?t:t.querySelector(`[${tp}]`)||t:null}function us(t,o,r=!0){return t.filter(l=>l.parentId===o&&(!r||l.context?.open)).flatMap(l=>[l,...us(t,l.id,r)])}function u0(t,o){let r=[],a=t.find(l=>l.id===o)?.parentId;for(;a;){const l=t.find(c=>c.id===a);a=l?.parentId,l&&(r=r.concat(l))}return r}function Jt(t){t.preventDefault(),t.stopPropagation()}function dD(t){return"nativeEvent"in t}function Ix(t){return t.pointerType===""&&t.isTrusted?!0:ep&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function Hx(t){return jx?!1:!ep&&t.width===0&&t.height===0||ep&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function ms(t,o){const r=["mouse","pen"];return o||r.push("",void 0),r.includes(t)}function Vx(t){const o=t.type;return o==="click"||o==="mousedown"||o==="keydown"||o==="keyup"}const hD=["top","right","bottom","left"],Oa=Math.min,Mn=Math.max,du=Math.round,ha=Math.floor,so=t=>({x:t,y:t}),pD={left:"right",right:"left",bottom:"top",top:"bottom"},mD={start:"end",end:"start"};function op(t,o,r){return Mn(t,Oa(o,r))}function Uo(t,o){return typeof t=="function"?t(o):t}function vn(t){return t.split("-")[0]}function jr(t){return t.split("-")[1]}function Hp(t){return t==="x"?"y":"x"}function Vp(t){return t==="y"?"height":"width"}const gD=new Set(["top","bottom"]);function Vn(t){return gD.has(vn(t))?"y":"x"}function qp(t){return Hp(Vn(t))}function yD(t,o,r){r===void 0&&(r=!1);const a=jr(t),l=qp(t),c=Vp(l);let f=l==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return o.reference[c]>o.floating[c]&&(f=hu(f)),[f,hu(f)]}function vD(t){const o=hu(t);return[rp(t),o,rp(o)]}function rp(t){return t.replace(/start|end/g,o=>mD[o])}const f0=["left","right"],d0=["right","left"],bD=["top","bottom"],SD=["bottom","top"];function xD(t,o,r){switch(t){case"top":case"bottom":return r?o?d0:f0:o?f0:d0;case"left":case"right":return o?bD:SD;default:return[]}}function wD(t,o,r,a){const l=jr(t);let c=xD(vn(t),r==="start",a);return l&&(c=c.map(f=>f+"-"+l),o&&(c=c.concat(c.map(rp)))),c}function hu(t){return t.replace(/left|right|bottom|top/g,o=>pD[o])}function ED(t){return{top:0,right:0,bottom:0,left:0,...t}}function qx(t){return typeof t!="number"?ED(t):{top:t,right:t,bottom:t,left:t}}function pu(t){const{x:o,y:r,width:a,height:l}=t;return{width:a,height:l,top:r,left:o,right:o+a,bottom:r+l,x:o,y:r}}function Ac(t,o,r){return Math.floor(t/o)!==r}function qi(t,o){return o<0||o>=t.current.length}function _h(t,o){return $t(t,{disabledIndices:o})}function h0(t,o){return $t(t,{decrement:!0,startingIndex:t.current.length,disabledIndices:o})}function $t(t,{startingIndex:o=-1,decrement:r=!1,disabledIndices:a,amount:l=1}={}){let c=o;do c+=r?-l:l;while(c>=0&&c<=t.current.length-1&&Yi(t,c,a));return c}function RD(t,{event:o,orientation:r,loopFocus:a,rtl:l,cols:c,disabledIndices:f,minIndex:d,maxIndex:m,prevIndex:p,stopEvent:y=!1}){let g=p;const v=[],b={};let x=!1;{let C=null,_=-1;t.current.forEach((k,O)=>{if(k==null)return;const z=k.closest('[role="row"]');z&&(x=!0),(z!==C||_===-1)&&(C=z,_+=1,v[_]=[]),v[_].push(O),b[O]=_})}const w=x&&v.length>0&&v.some(C=>C.length!==c);function E(C){if(!w||p===-1)return;const _=b[p];if(_==null)return;const k=v[_].indexOf(p);let O=C==="up"?_-1:_+1;a&&(O<0?O=v.length-1:O>=v.length&&(O=0));const z=new Set;for(;O>=0&&O<v.length&&!z.has(O);){z.add(O);const N=v[O];if(N.length===0){O=C==="up"?O-1:O+1;continue}const j=Math.min(k,N.length-1);for(let D=j;D>=0;D-=1){const Y=N[D];if(!Yi(t,Y,f))return Y}O=C==="up"?O-1:O+1,a&&(O<0?O=v.length-1:O>=v.length&&(O=0))}}if(o.key===Ip){const C=E("up");if(C!==void 0)y&&Jt(o),g=C;else{if(y&&Jt(o),p===-1)g=m;else if(g=$t(t,{startingIndex:g,amount:c,decrement:!0,disabledIndices:f}),a&&(p-c<d||g<0)){const _=p%c,k=m%c,O=m-(k-_);k===_?g=m:g=k>_?O:O-c}qi(t,g)&&(g=p)}}if(o.key===Wi){const C=E("down");C!==void 0?(y&&Jt(o),g=C):(y&&Jt(o),p===-1?g=d:(g=$t(t,{startingIndex:p,amount:c,disabledIndices:f}),a&&p+c>m&&(g=$t(t,{startingIndex:p%c-c,amount:c,disabledIndices:f}))),qi(t,g)&&(g=p))}if(r==="both"){const C=ha(p/c);o.key===(l?Or:_r)&&(y&&Jt(o),p%c!==c-1?(g=$t(t,{startingIndex:p,disabledIndices:f}),a&&Ac(g,c,C)&&(g=$t(t,{startingIndex:p-p%c-1,disabledIndices:f}))):a&&(g=$t(t,{startingIndex:p-p%c-1,disabledIndices:f})),Ac(g,c,C)&&(g=p)),o.key===(l?_r:Or)&&(y&&Jt(o),p%c!==0?(g=$t(t,{startingIndex:p,decrement:!0,disabledIndices:f}),a&&Ac(g,c,C)&&(g=$t(t,{startingIndex:p+(c-p%c),decrement:!0,disabledIndices:f}))):a&&(g=$t(t,{startingIndex:p+(c-p%c),decrement:!0,disabledIndices:f})),Ac(g,c,C)&&(g=p));const _=ha(m/c)===C;qi(t,g)&&(a&&_?g=o.key===(l?_r:Or)?m:$t(t,{startingIndex:p-p%c-1,disabledIndices:f}):g=p)}return g}function TD(t,o,r){const a=[];let l=0;return t.forEach(({width:c,height:f},d)=>{let m=!1;for(;!m;){const p=[];for(let y=0;y<c;y+=1)for(let g=0;g<f;g+=1)p.push(l+y+g*o);l%o+c<=o&&p.every(y=>a[y]==null)?(p.forEach(y=>{a[y]=d}),m=!0):l+=1}}),[...a]}function CD(t,o,r,a,l){if(t===-1)return-1;const c=r.indexOf(t),f=o[t];switch(l){case"tl":return c;case"tr":return f?c+f.width-1:c;case"bl":return f?c+(f.height-1)*a:c;case"br":return r.lastIndexOf(t);default:return-1}}function MD(t,o){return o.flatMap((r,a)=>t.includes(r)?[a]:[])}function Yi(t,o,r){if(typeof r=="function")return r(o);if(r)return r.includes(o);const a=t.current[o];return a?a.hasAttribute("disabled")||a.getAttribute("aria-disabled")==="true":!1}var OD=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],mu=OD.join(","),Yx=typeof Element>"u",_a=Yx?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,gu=!Yx&&Element.prototype.getRootNode?function(t){var o;return t==null||(o=t.getRootNode)===null||o===void 0?void 0:o.call(t)}:function(t){return t?.ownerDocument},yu=function(o,r){var a;r===void 0&&(r=!0);var l=o==null||(a=o.getAttribute)===null||a===void 0?void 0:a.call(o,"inert"),c=l===""||l==="true",f=c||r&&o&&(typeof o.closest=="function"?o.closest("[inert]"):yu(o.parentNode));return f},_D=function(o){var r,a=o==null||(r=o.getAttribute)===null||r===void 0?void 0:r.call(o,"contenteditable");return a===""||a==="true"},Gx=function(o,r,a){if(yu(o))return[];var l=Array.prototype.slice.apply(o.querySelectorAll(mu));return r&&_a.call(o,mu)&&l.unshift(o),l=l.filter(a),l},vu=function(o,r,a){for(var l=[],c=Array.from(o);c.length;){var f=c.shift();if(!yu(f,!1))if(f.tagName==="SLOT"){var d=f.assignedElements(),m=d.length?d:f.children,p=vu(m,!0,a);a.flatten?l.push.apply(l,p):l.push({scopeParent:f,candidates:p})}else{var y=_a.call(f,mu);y&&a.filter(f)&&(r||!o.includes(f))&&l.push(f);var g=f.shadowRoot||typeof a.getShadowRoot=="function"&&a.getShadowRoot(f),v=!yu(g,!1)&&(!a.shadowRootFilter||a.shadowRootFilter(f));if(g&&v){var b=vu(g===!0?f.children:g.children,!0,a);a.flatten?l.push.apply(l,b):l.push({scopeParent:f,candidates:b})}else c.unshift.apply(c,f.children)}}return l},Fx=function(o){return!isNaN(parseInt(o.getAttribute("tabindex"),10))},Xx=function(o){if(!o)throw new Error("No node provided");return o.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(o.tagName)||_D(o))&&!Fx(o)?0:o.tabIndex},AD=function(o,r){var a=Xx(o);return a<0&&r&&!Fx(o)?0:a},DD=function(o,r){return o.tabIndex===r.tabIndex?o.documentOrder-r.documentOrder:o.tabIndex-r.tabIndex},Kx=function(o){return o.tagName==="INPUT"},kD=function(o){return Kx(o)&&o.type==="hidden"},zD=function(o){var r=o.tagName==="DETAILS"&&Array.prototype.slice.apply(o.children).some(function(a){return a.tagName==="SUMMARY"});return r},ND=function(o,r){for(var a=0;a<o.length;a++)if(o[a].checked&&o[a].form===r)return o[a]},LD=function(o){if(!o.name)return!0;var r=o.form||gu(o),a=function(d){return r.querySelectorAll('input[type="radio"][name="'+d+'"]')},l;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")l=a(window.CSS.escape(o.name));else try{l=a(o.name)}catch(f){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",f.message),!1}var c=ND(l,o.form);return!c||c===o},jD=function(o){return Kx(o)&&o.type==="radio"},PD=function(o){return jD(o)&&!LD(o)},UD=function(o){var r,a=o&&gu(o),l=(r=a)===null||r===void 0?void 0:r.host,c=!1;if(a&&a!==o){var f,d,m;for(c=!!((f=l)!==null&&f!==void 0&&(d=f.ownerDocument)!==null&&d!==void 0&&d.contains(l)||o!=null&&(m=o.ownerDocument)!==null&&m!==void 0&&m.contains(o));!c&&l;){var p,y,g;a=gu(l),l=(p=a)===null||p===void 0?void 0:p.host,c=!!((y=l)!==null&&y!==void 0&&(g=y.ownerDocument)!==null&&g!==void 0&&g.contains(l))}}return c},p0=function(o){var r=o.getBoundingClientRect(),a=r.width,l=r.height;return a===0&&l===0},BD=function(o,r){var a=r.displayCheck,l=r.getShadowRoot;if(a==="full-native"&&"checkVisibility"in o){var c=o.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!c}if(getComputedStyle(o).visibility==="hidden")return!0;var f=_a.call(o,"details>summary:first-of-type"),d=f?o.parentElement:o;if(_a.call(d,"details:not([open]) *"))return!0;if(!a||a==="full"||a==="full-native"||a==="legacy-full"){if(typeof l=="function"){for(var m=o;o;){var p=o.parentElement,y=gu(o);if(p&&!p.shadowRoot&&l(p)===!0)return p0(o);o.assignedSlot?o=o.assignedSlot:!p&&y!==o.ownerDocument?o=y.host:o=p}o=m}if(UD(o))return!o.getClientRects().length;if(a!=="legacy-full")return!0}else if(a==="non-zero-area")return p0(o);return!1},ID=function(o){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(o.tagName))for(var r=o.parentElement;r;){if(r.tagName==="FIELDSET"&&r.disabled){for(var a=0;a<r.children.length;a++){var l=r.children.item(a);if(l.tagName==="LEGEND")return _a.call(r,"fieldset[disabled] *")?!0:!l.contains(o)}return!0}r=r.parentElement}return!1},sp=function(o,r){return!(r.disabled||kD(r)||BD(r,o)||zD(r)||ID(r))},ap=function(o,r){return!(PD(r)||Xx(r)<0||!sp(o,r))},HD=function(o){var r=parseInt(o.getAttribute("tabindex"),10);return!!(isNaN(r)||r>=0)},Qx=function(o){var r=[],a=[];return o.forEach(function(l,c){var f=!!l.scopeParent,d=f?l.scopeParent:l,m=AD(d,f),p=f?Qx(l.candidates):d;m===0?f?r.push.apply(r,p):r.push(d):a.push({documentOrder:c,tabIndex:m,item:l,isScope:f,content:p})}),a.sort(DD).reduce(function(l,c){return c.isScope?l.push.apply(l,c.content):l.push(c.content),l},[]).concat(r)},el=function(o,r){r=r||{};var a;return r.getShadowRoot?a=vu([o],r.includeContainer,{filter:ap.bind(null,r),flatten:!1,getShadowRoot:r.getShadowRoot,shadowRootFilter:HD}):a=Gx(o,r.includeContainer,ap.bind(null,r)),Qx(a)},VD=function(o,r){r=r||{};var a;return r.getShadowRoot?a=vu([o],r.includeContainer,{filter:sp.bind(null,r),flatten:!0,getShadowRoot:r.getShadowRoot}):a=Gx(o,r.includeContainer,sp.bind(null,r)),a},Zx=function(o,r){if(r=r||{},!o)throw new Error("No node provided");return _a.call(o,mu)===!1?!1:ap(r,o)};const Pa=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function $x(t,o){const r=el(t,Pa()),a=r.length;if(a===0)return;const l=Zn(at(t)),c=r.indexOf(l),f=c===-1?o===1?0:a-1:c+o;return r[f]}function Yp(t){return $x(at(t).body,1)||t}function Jx(t){return $x(at(t).body,-1)||t}function Wx(t,o){if(!t)return null;const r=el(at(t).body,Pa()),a=r.length;if(a===0)return null;const l=r.indexOf(t);if(l===-1)return null;const c=(l+o+a)%a;return r[c]}function qD(t){return Wx(t,1)}function YD(t){return Wx(t,-1)}function Sa(t,o){const r=o||t.currentTarget,a=t.relatedTarget;return!a||!Ye(r,a)}function GD(t){el(t,Pa()).forEach(r=>{r.dataset.tabindex=r.getAttribute("tabindex")||"",r.setAttribute("tabindex","-1")})}function m0(t){t.querySelectorAll("[data-tabindex]").forEach(r=>{const a=r.dataset.tabindex;delete r.dataset.tabindex,a?r.setAttribute("tabindex",a):r.removeAttribute("tabindex")})}const Dc=null;class FD{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=o=>{this.isScheduled=!1;const r=this.callbacks,a=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,a>0)for(let l=0;l<r.length;l+=1)r[l]?.(o)};request(o){const r=this.nextId;return this.nextId+=1,this.callbacks.push(o),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),r}cancel(o){const r=o-this.startId;r<0||r>=this.callbacks.length||(this.callbacks[r]=null,this.callbacksCount-=1)}}const kc=new FD;class oo{static create(){return new oo}static request(o){return kc.request(o)}static cancel(o){return kc.cancel(o)}currentId=Dc;request(o){this.cancel(),this.currentId=kc.request(()=>{this.currentId=Dc,o()})}cancel=()=>{this.currentId!==Dc&&(kc.cancel(this.currentId),this.currentId=Dc)};disposeEffect=()=>this.cancel}function Gp(){const t=Wt(oo.create).current;return Bp(t.disposeEffect),t}function zo(t){return t==null?t:"current"in t?t.current:t}let Qi=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const XD={[Qi.startingStyle]:""},KD={[Qi.endingStyle]:""},Bu={transitionStatus(t){return t==="starting"?XD:t==="ending"?KD:null}};function QD(t,o=!1,r=!0){const a=Gp();return Ce((l,c=null)=>{a.cancel();function f(){io.flushSync(l)}const d=zo(t);if(d==null)return;const m=d;if(typeof m.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)l();else{let p=function(){const g=Qi.startingStyle;if(!m.hasAttribute(g)){a.request(y);return}const v=new MutationObserver(()=>{m.hasAttribute(g)||(v.disconnect(),y())});v.observe(m,{attributes:!0,attributeFilter:[g]}),c?.addEventListener("abort",()=>v.disconnect(),{once:!0})},y=function(){Promise.all(m.getAnimations().map(g=>g.finished)).then(()=>{c?.aborted||f()}).catch(()=>{const g=m.getAnimations();if(r){if(c?.aborted)return;f()}else g.length>0&&g.some(v=>v.pending||v.playState!=="finished")&&y()})};if(o){p();return}a.request(y)}})}function Iu(t){const{enabled:o=!0,open:r,ref:a,onComplete:l}=t,c=Ce(l),f=QD(a,r,!1);R.useEffect(()=>{if(!o)return;const d=new AbortController;return f(c,d.signal),()=>{d.abort()}},[o,r,c,f])}function ZD(t,o=!1,r=!1){const[a,l]=R.useState(t&&o?"idle":void 0),[c,f]=R.useState(t);return t&&!c&&(f(!0),l("starting")),!t&&c&&a!=="ending"&&!r&&l("ending"),!t&&!c&&a==="ending"&&l(void 0),Ae(()=>{if(!t&&c&&a!=="ending"&&r){const d=oo.request(()=>{l("ending")});return()=>{oo.cancel(d)}}},[t,c,a,r]),Ae(()=>{if(!t||o)return;const d=oo.request(()=>{l(void 0)});return()=>{oo.cancel(d)}},[o,t]),Ae(()=>{if(!t||!o)return;t&&c&&a!=="idle"&&l("starting");const d=oo.request(()=>{l("idle")});return()=>{oo.cancel(d)}},[o,t,c,l,a]),R.useMemo(()=>({mounted:c,setMounted:f,transitionStatus:a}),[c,a])}const Fp="none",Aa="trigger-press",sn="trigger-hover",xa="trigger-focus",Xp="outside-press",ew="item-press",$D="close-press",Da="focus-out",Hu="escape-key",Fc="list-navigation",JD="cancel-open",Xc="sibling-open",WD="disabled",Kp="imperative-action";function Qe(t,o,r,a){let l=!1,c=!1;const f=qt;return{reason:t,event:o??new Event("base-ui"),cancel(){l=!0},allowPropagation(){c=!0},get isCanceled(){return l},get isPropagationAllowed(){return c},trigger:r,...f}}const ek=R.forwardRef(function(o,r){const{className:a,render:l,orientation:c="horizontal",...f}=o;return Mt("div",o,{state:{orientation:c},ref:r,props:[{role:"separator","aria-orientation":c},f]})}),tw=R.createContext(void 0);function ws(t){const o=R.useContext(tw);if(t===!1&&o===void 0)throw new Error(tn(27));return o}let is=(function(t){return t.open="data-open",t.closed="data-closed",t[t.startingStyle=Qi.startingStyle]="startingStyle",t[t.endingStyle=Qi.endingStyle]="endingStyle",t.anchorHidden="data-anchor-hidden",t.side="data-side",t.align="data-align",t})({}),bu=(function(t){return t.popupOpen="data-popup-open",t.pressed="data-pressed",t})({});const tk={[bu.popupOpen]:""},nk={[bu.popupOpen]:"",[bu.pressed]:""},ok={[is.open]:""},rk={[is.closed]:""},sk={[is.anchorHidden]:""},nw={open(t){return t?tk:null}},g0={open(t){return t?nk:null}},Es={open(t){return t?ok:rk},anchorHidden(t){return t?sk:null}},ak={...Es,...Bu},ik=R.forwardRef(function(o,r){const{render:a,className:l,forceRender:c=!1,...f}=o,{store:d}=ws(),m=d.useState("open"),p=d.useState("nested"),y=d.useState("mounted"),g=d.useState("transitionStatus");return Mt("div",o,{state:{open:m,transitionStatus:g},ref:[d.context.backdropRef,r],stateAttributesMapping:ak,props:[{role:"presentation",hidden:!y,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:c||!p})}),lk=R.forwardRef(function(o,r){const{render:a,className:l,disabled:c=!1,nativeButton:f=!0,...d}=o,{store:m}=ws(),p=m.useState("open");function y(x){p&&m.setOpen(!1,Qe($D,x.nativeEvent))}const{getButtonProps:g,buttonRef:v}=Pu({disabled:c,native:f});return Mt("button",o,{state:{disabled:c},ref:[r,v],props:[{onClick:y},d,g]})}),ck=R.forwardRef(function(o,r){const{render:a,className:l,id:c,...f}=o,{store:d}=ws(),m=xs(c);return d.useSyncedValueWithCleanup("descriptionElementId",m),Mt("p",o,{ref:r,props:[{id:m},f]})});function an(t){const o=Wt(uk,t).current;return o.next=t,Ae(o.effect),o}function uk(t){const o={current:t,next:t,effect:()=>{o.current=o.next}};return o}function ow(){const t=new Map;return{emit(o,r){t.get(o)?.forEach(a=>a(r))},on(o,r){t.has(o)||t.set(o,new Set),t.get(o).add(r)},off(o,r){t.get(o)?.delete(r)}}}class Qp{nodesRef={current:[]};events=ow();addNode(o){this.nodesRef.current.push(o)}removeNode(o){const r=this.nodesRef.current.findIndex(a=>a===o);r!==-1&&this.nodesRef.current.splice(r,1)}}const rw=R.createContext(null),sw=R.createContext(null),Vo=()=>R.useContext(rw)?.id||null,Pr=t=>{const o=R.useContext(sw);return t??o};function aw(t){const o=Ss(),r=Pr(t),a=Vo();return Ae(()=>{if(!o)return;const l={id:o,parentId:a};return r?.addNode(l),()=>{r?.removeNode(l)}},[r,o,a]),o}function fk(t){const{children:o,id:r}=t,a=Vo();return L.jsx(rw.Provider,{value:R.useMemo(()=>({id:r,parentId:a}),[r,a]),children:o})}function dk(t){const{children:o,externalTree:r}=t,a=Wt(()=>r??new Qp).current;return L.jsx(sw.Provider,{value:a,children:o})}function ka(t){return`data-base-ui-${t}`}function Kc(t,o,r){if(r&&!ms(r))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const a=t();return typeof a=="number"?a:a?.[o]}return t?.[o]}const iw=R.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new co,currentIdRef:{current:null},currentContextRef:{current:null}});function hk(t){const{children:o,delay:r,timeoutMs:a=0}=t,l=R.useRef(r),c=R.useRef(r),f=R.useRef(null),d=R.useRef(null),m=qn();return L.jsx(iw.Provider,{value:R.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:f,timeoutMs:a,currentContextRef:d,timeout:m}),[a,m]),children:o})}function pk(t,o={open:!1}){const r="rootStore"in t?t.rootStore:t,a=r.useState("floatingId"),{open:l}=o,c=R.useContext(iw),{currentIdRef:f,delayRef:d,timeoutMs:m,initialDelayRef:p,currentContextRef:y,hasProvider:g,timeout:v}=c,[b,x]=R.useState(!1);return Ae(()=>{function w(){x(!1),y.current?.setIsInstantPhase(!1),f.current=null,y.current=null,d.current=p.current}if(f.current&&!l&&f.current===a){if(x(!1),m){const E=a;return v.start(m,()=>{r.select("open")||f.current&&f.current!==E||w()}),()=>{v.clear()}}w()}},[l,a,f,d,m,p,y,v,r]),Ae(()=>{if(!l)return;const w=y.current,E=f.current;v.clear(),y.current={onOpenChange:r.setOpen,setIsInstantPhase:x},f.current=a,d.current={open:0,close:Kc(p.current,"close")},E!==null&&E!==a?(x(!0),w?.setIsInstantPhase(!0),w?.onOpenChange(!1,Qe(Fp))):(x(!1),w?.setIsInstantPhase(!1))},[l,a,r,f,d,m,p,y,v]),Ae(()=>()=>{y.current=null},[y]),R.useMemo(()=>({hasProvider:g,delayRef:d,isInstantPhase:b}),[g,d,b])}const mk={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},lw={...mk,position:"fixed",top:0,left:0},za=R.forwardRef(function(o,r){const[a,l]=R.useState();Ae(()=>{Lx&&l("button")},[]);const c={tabIndex:0,role:a};return L.jsx("span",{...o,ref:r,style:lw,"aria-hidden":a?void 0:!0,...c,"data-base-ui-focus-guard":""})});let y0=0;function Gi(t,o={}){const{preventScroll:r=!1,cancelPrevious:a=!0,sync:l=!1}=o;a&&cancelAnimationFrame(y0);const c=()=>t?.focus({preventScroll:r});l?c():y0=requestAnimationFrame(c)}const wa={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function v0(t){return t==="inert"?wa.inert:t==="aria-hidden"?wa["aria-hidden"]:wa.none}let zc=new WeakSet,Nc={},Ah=0;const cw=t=>t&&(t.host||cw(t.parentNode)),gk=(t,o)=>o.map(r=>{if(t.contains(r))return r;const a=cw(r);return t.contains(a)?a:null}).filter(r=>r!=null);function yk(t,o,r,a){const l="data-base-ui-inert",c=a?"inert":r?"aria-hidden":null,f=gk(o,t),d=new Set,m=new Set(f),p=[];Nc[l]||(Nc[l]=new WeakMap);const y=Nc[l];f.forEach(g),v(o),d.clear();function g(b){!b||d.has(b)||(d.add(b),b.parentNode&&g(b.parentNode))}function v(b){!b||m.has(b)||[].forEach.call(b.children,x=>{if(zr(x)!=="script")if(d.has(x))v(x);else{const w=c?x.getAttribute(c):null,E=w!==null&&w!=="false",C=v0(c),_=(C.get(x)||0)+1,k=(y.get(x)||0)+1;C.set(x,_),y.set(x,k),p.push(x),_===1&&E&&zc.add(x),k===1&&x.setAttribute(l,""),!E&&c&&x.setAttribute(c,c==="inert"?"":"true")}})}return Ah+=1,()=>{p.forEach(b=>{const x=v0(c),E=(x.get(b)||0)-1,C=(y.get(b)||0)-1;x.set(b,E),y.set(b,C),E||(!zc.has(b)&&c&&b.removeAttribute(c),zc.delete(b)),C||b.removeAttribute(l)}),Ah-=1,Ah||(wa.inert=new WeakMap,wa["aria-hidden"]=new WeakMap,wa.none=new WeakMap,zc=new WeakSet,Nc={})}}function vk(t,o=!1,r=!1){const a=at(t[0]).body;return yk(t.concat(Array.from(a.querySelectorAll("[aria-live]"))),a,o,r)}const uw=R.createContext(null),fw=()=>R.useContext(uw),bk=ka("portal");function dw(t={}){const{ref:o,container:r,componentProps:a=qt,elementProps:l}=t,c=Ss(),d=fw()?.portalNode,[m,p]=R.useState(null),[y,g]=R.useState(null),v=Ce(E=>{E!==null&&g(E)}),b=R.useRef(null);Ae(()=>{if(r===null){b.current&&(b.current=null,g(null),p(null));return}if(c==null)return;const E=(r&&(Np(r)?r:r.current))??d??document.body;if(E==null){b.current&&(b.current=null,g(null),p(null));return}b.current!==E&&(b.current=E,g(null),p(E))},[r,d,c]);const x=Mt("div",a,{ref:[o,v],props:[{id:c,[bk]:""},l]});return{portalNode:y,portalSubtree:m&&x?io.createPortal(x,m):null}}const hw=R.forwardRef(function(o,r){const{children:a,container:l,className:c,render:f,renderGuards:d,...m}=o,{portalNode:p,portalSubtree:y}=dw({container:l,ref:r,componentProps:o,elementProps:m}),g=R.useRef(null),v=R.useRef(null),b=R.useRef(null),x=R.useRef(null),[w,E]=R.useState(null),C=w?.modal,_=w?.open,k=typeof d=="boolean"?d:!!w&&!w.modal&&w.open&&!!p;R.useEffect(()=>{if(!p||C)return;function z(N){p&&N.relatedTarget&&Sa(N)&&(N.type==="focusin"?m0:GD)(p)}return p.addEventListener("focusin",z,!0),p.addEventListener("focusout",z,!0),()=>{p.removeEventListener("focusin",z,!0),p.removeEventListener("focusout",z,!0)}},[p,C]),R.useEffect(()=>{!p||_||m0(p)},[_,p]);const O=R.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:v,beforeInsideRef:b,afterInsideRef:x,portalNode:p,setFocusManagerState:E}),[p]);return L.jsxs(R.Fragment,{children:[y,L.jsxs(uw.Provider,{value:O,children:[k&&p&&L.jsx(za,{"data-type":"outside",ref:g,onFocus:z=>{if(Sa(z,p))b.current?.focus();else{const N=w?w.domReference:null;Jx(N)?.focus()}}}),k&&p&&L.jsx("span",{"aria-owns":p.id,style:GA}),p&&io.createPortal(a,p),k&&p&&L.jsx(za,{"data-type":"outside",ref:v,onFocus:z=>{if(Sa(z,p))x.current?.focus();else{const N=w?w.domReference:null;Yp(N)?.focus(),w?.closeOnFocusOut&&w?.onOpenChange(!1,Qe(Da,z.nativeEvent))}}})]})]})});function Sk(t,o){const r=zt(t.target);return t instanceof r.KeyboardEvent?"keyboard":t instanceof r.FocusEvent?o||"keyboard":"pointerType"in t?t.pointerType||"keyboard":"touches"in t?"touch":t instanceof r.MouseEvent?o||(t.detail===0?"keyboard":"mouse"):""}const b0=20;let Rr=[];function Zp(){Rr=Rr.filter(t=>t.deref()?.isConnected)}function xk(t){Zp(),t&&zr(t)!=="body"&&(Rr.push(new WeakRef(t)),Rr.length>b0&&(Rr=Rr.slice(-b0)))}function Dh(){return Zp(),Rr[Rr.length-1]?.deref()}function wk(t){if(!t)return null;const o=Pa();return Zx(t,o)?t:el(t,o)[0]||t}function Ek(t){return!t||!t.isConnected?!1:typeof t.checkVisibility=="function"?t.checkVisibility():On(t).display!=="none"}function S0(t,o){if(!o.current.includes("floating")&&!t.getAttribute("role")?.includes("dialog"))return;const r=Pa(),l=VD(t,r).filter(f=>{const d=f.getAttribute("data-tabindex")||"";return Zx(f,r)||f.hasAttribute("data-tabindex")&&!d.startsWith("-")}),c=t.getAttribute("tabindex");o.current.includes("floating")||l.length===0?c!=="0"&&t.setAttribute("tabindex","0"):(c!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}function pw(t){const{context:o,children:r,disabled:a=!1,initialFocus:l=!0,returnFocus:c=!0,restoreFocus:f=!1,modal:d=!0,closeOnFocusOut:m=!0,openInteractionType:p="",nextFocusableElement:y,previousFocusableElement:g,beforeContentFocusGuardRef:v,externalTree:b}=t,x="rootStore"in o?o.rootStore:o,w=x.useState("open"),E=x.useState("domReferenceElement"),C=x.useState("floatingElement"),{events:_,dataRef:k}=x.context,O=Ce(()=>k.current.floatingContext?.nodeId),z=l===!1,N=np(E)&&z,j=R.useRef(["content"]),D=an(l),Y=an(c),$=an(p),Z=Pr(b),V=fw(),J=R.useRef(null),ne=R.useRef(null),ae=R.useRef(!1),B=R.useRef(!1),H=R.useRef(!1),G=R.useRef(-1),ce=R.useRef(""),W=R.useRef(""),P=R.useRef(null),X=R.useRef(null),le=Ma(P,v,V?.beforeInsideRef),re=Ma(X,V?.afterInsideRef),ue=qn(),he=qn(),ve=Gp(),Me=V!=null,fe=fu(C),ze=Ce((me=fe)=>me?el(me,Pa()):[]),je=Ce(me=>{const pe=ze(me);return j.current.map(()=>pe).filter(Boolean).flat()});R.useEffect(()=>{if(a||!d)return;function me(Ne){Ne.key==="Tab"&&Ye(fe,Zn(at(fe)))&&ze().length===0&&!N&&Jt(Ne)}const pe=at(fe);return pe.addEventListener("keydown",me),()=>{pe.removeEventListener("keydown",me)}},[a,E,fe,d,j,N,ze,je]),R.useEffect(()=>{if(a||!w)return;const me=at(fe);function pe(){H.current=!1}function Ne(Se){const ye=rn(Se),de=Ye(C,ye)||Ye(E,ye)||Ye(V?.portalNode,ye);H.current=!de,W.current=Se.pointerType||"keyboard",ye?.closest(`[${qA}]`)&&(B.current=!0)}function be(){W.current="keyboard"}return me.addEventListener("pointerdown",Ne,!0),me.addEventListener("pointerup",pe,!0),me.addEventListener("pointercancel",pe,!0),me.addEventListener("keydown",be,!0),()=>{me.removeEventListener("pointerdown",Ne,!0),me.removeEventListener("pointerup",pe,!0),me.removeEventListener("pointercancel",pe,!0),me.removeEventListener("keydown",be,!0)}},[a,C,E,fe,w,V]),R.useEffect(()=>{if(a||!m)return;const me=at(fe);function pe(){B.current=!0,he.start(0,()=>{B.current=!1})}function Ne(we){const ge=rn(we),qe=ze().indexOf(ge);qe!==-1&&(G.current=qe)}function be(we){const ge=we.relatedTarget,De=we.currentTarget,qe=rn(we);queueMicrotask(()=>{const Be=O(),Ot=x.context.triggerElements,He=ge?.hasAttribute(ka("focus-guard"))&&[P.current,X.current,V?.beforeInsideRef.current,V?.afterInsideRef.current,V?.beforeOutsideRef.current,V?.afterOutsideRef.current,zo(g),zo(y)].includes(ge),Je=!(Ye(E,ge)||Ye(C,ge)||Ye(ge,C)||Ye(V?.portalNode,ge)||ge!=null&&Ot.hasElement(ge)||Ot.hasMatchingElement(Pe=>Ye(Pe,ge))||He||Z&&(us(Z.nodesRef.current,Be).find(Pe=>Ye(Pe.context?.elements.floating,ge)||Ye(Pe.context?.elements.domReference,ge))||u0(Z.nodesRef.current,Be).find(Pe=>[Pe.context?.elements.floating,fu(Pe.context?.elements.floating)].includes(ge)||Pe.context?.elements.domReference===ge)));if(De===E&&fe&&S0(fe,j),f&&De!==E&&!Ek(qe)&&Zn(me)===me.body){if(St(fe)&&(fe.focus(),f==="popup")){ve.request(()=>{fe.focus()});return}const Pe=G.current,Et=ze(),Qt=Et[Pe]||Et[Et.length-1]||fe;St(Qt)&&Qt.focus()}if(k.current.insideReactTree){k.current.insideReactTree=!1;return}(N||!d)&&ge&&Je&&!B.current&&(N||ge!==Dh())&&(ae.current=!0,x.setOpen(!1,Qe(Da,we)))})}function Se(){H.current||(k.current.insideReactTree=!0,ue.start(0,()=>{k.current.insideReactTree=!1}))}const ye=St(E)?E:null,de=[];if(!(!C&&!ye))return ye&&(ye.addEventListener("focusout",be),ye.addEventListener("pointerdown",pe),de.push(()=>{ye.removeEventListener("focusout",be),ye.removeEventListener("pointerdown",pe)})),C&&(C.addEventListener("focusin",Ne),C.addEventListener("focusout",be),V&&(C.addEventListener("focusout",Se,!0),de.push(()=>{C.removeEventListener("focusout",Se,!0)})),de.push(()=>{C.removeEventListener("focusin",Ne),C.removeEventListener("focusout",be)})),()=>{de.forEach(we=>{we()})}},[a,E,C,fe,d,Z,V,x,m,f,ze,N,O,j,k,ue,he,ve,y,g]),R.useEffect(()=>{if(a||!C||!w)return;const me=Array.from(V?.portalNode?.querySelectorAll(`[${ka("portal")}]`)||[]),Ne=(Z?u0(Z.nodesRef.current,O()):[]).find(Se=>np(Se.context?.elements.domReference||null))?.context?.elements.domReference,be=[C,Ne,...me,J.current,ne.current,P.current,X.current,V?.beforeOutsideRef.current,V?.afterOutsideRef.current,zo(g),zo(y),N?E:null].filter(Se=>Se!=null);return vk(be,d||N)},[w,a,E,C,d,j,V,N,Z,O,y,g]),Ae(()=>{if(!w||a||!St(fe))return;const me=at(fe),pe=Zn(me);queueMicrotask(()=>{const Ne=je(fe),be=D.current,Se=typeof be=="function"?be($.current||""):be;if(Se===void 0||Se===!1)return;let ye;Se===!0||Se===null?ye=Ne[0]||fe:ye=zo(Se),ye=ye||Ne[0]||fe,!Ye(fe,pe)&&Gi(ye,{preventScroll:ye===fe})})},[a,w,fe,z,je,D,$]),Ae(()=>{if(a||!fe)return;const me=at(fe),pe=Zn(me);xk(pe);function Ne(ye){if(ye.open||(ce.current=Sk(ye.nativeEvent,W.current)),ye.reason===sn&&ye.nativeEvent.type==="mouseleave"&&(ae.current=!0),ye.reason===Xp)if(ye.nested)ae.current=!1;else if(Ix(ye.nativeEvent)||Hx(ye.nativeEvent))ae.current=!1;else{let de=!1;document.createElement("div").focus({get preventScroll(){return de=!0,!1}}),de?ae.current=!1:ae.current=!0}}_.on("openchange",Ne);const be=me.createElement("span");be.setAttribute("tabindex","-1"),be.setAttribute("aria-hidden","true"),Object.assign(be.style,lw),Me&&E&&E.insertAdjacentElement("afterend",be);function Se(){const ye=Y.current;let de=typeof ye=="function"?ye(ce.current):ye;if(de===void 0||de===!1)return null;if(de===null&&(de=!0),typeof de=="boolean"){const ge=E||Dh();return ge&&ge.isConnected?ge:be}const we=E||Dh()||be;return zo(de)||we}return()=>{_.off("openchange",Ne);const ye=Zn(me),de=Ye(C,ye)||Z&&us(Z.nodesRef.current,O(),!1).some(ge=>Ye(ge.context?.elements.floating,ye)),we=Se();queueMicrotask(()=>{const ge=wk(we),De=typeof Y.current!="boolean";Y.current&&!ae.current&&St(ge)&&(!(!De&&ge!==ye&&ye!==me.body)||de)&&ge.focus({preventScroll:!0}),be.remove(),ae.current=!1})}},[a,C,fe,Y,k,_,Z,Me,E,O]),Ae(()=>{if(!zx||w||!C)return;const me=Zn(at(C));!St(me)||!Uu(me)||Ye(C,me)&&me.blur()},[w,C]),Ae(()=>{if(!(a||!V))return V.setFocusManagerState({modal:d,closeOnFocusOut:m,open:w,onOpenChange:x.setOpen,domReference:E}),()=>{V.setFocusManagerState(null)}},[a,V,d,w,x,m,E]),Ae(()=>{if(!(a||!fe))return S0(fe,j),()=>{queueMicrotask(Zp)}},[a,fe,j]);const te=!a&&(d?!N:!0)&&(Me||d);return L.jsxs(R.Fragment,{children:[te&&L.jsx(za,{"data-type":"inside",ref:le,onFocus:me=>{if(d){const pe=je();Gi(pe[pe.length-1])}else V?.portalNode&&(ae.current=!1,Sa(me,V.portalNode)?Yp(E)?.focus():zo(g??V.beforeOutsideRef)?.focus())}}),r,te&&L.jsx(za,{"data-type":"inside",ref:re,onFocus:me=>{d?Gi(je()[0]):V?.portalNode&&(m&&(ae.current=!0),Sa(me,V.portalNode)?Jx(E)?.focus():zo(y??V.afterOutsideRef)?.focus())}})]})}function mw(t,o={}){const r="rootStore"in t?t.rootStore:t,a=r.context.dataRef,{enabled:l=!0,event:c="click",toggle:f=!0,ignoreMouse:d=!1,stickIfOpen:m=!0,touchOpenDelay:p=0,reason:y=Aa}=o,g=R.useRef(void 0),v=Gp(),b=qn(),x=R.useMemo(()=>({onPointerDown(w){g.current=w.pointerType},onMouseDown(w){const E=g.current,C=w.nativeEvent,_=r.select("open");if(w.button!==0||c==="click"||ms(E,!0)&&d)return;const k=a.current.openEvent,O=k?.type,z=r.select("domReferenceElement")!==w.currentTarget,N=_&&z||!(_&&f&&(!(k&&m)||O==="click"||O==="mousedown"));if(Uu(C.target)){const D=Qe(y,C,C.target);N&&E==="touch"&&p>0?b.start(p,()=>{r.setOpen(!0,D)}):r.setOpen(N,D);return}const j=w.currentTarget;v.request(()=>{const D=Qe(y,C,j);N&&E==="touch"&&p>0?b.start(p,()=>{r.setOpen(!0,D)}):r.setOpen(N,D)})},onClick(w){if(c==="mousedown-only")return;const E=g.current;if(c==="mousedown"&&E){g.current=void 0;return}if(ms(E,!0)&&d)return;const C=r.select("open"),_=a.current.openEvent,k=r.select("domReferenceElement")!==w.currentTarget,O=C&&k||!(C&&f&&(!(_&&m)||Vx(_))),z=Qe(y,w.nativeEvent,w.currentTarget);O&&E==="touch"&&p>0?b.start(p,()=>{r.setOpen(!0,z)}):r.setOpen(O,z)},onKeyDown(){g.current=void 0}}),[a,c,d,r,m,f,v,b,p,y]);return R.useMemo(()=>l?{reference:x}:qt,[l,x])}function Rk(t,o){let r=null,a=null,l=!1;return{contextElement:t||void 0,getBoundingClientRect(){const c=t?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},f=o.axis==="x"||o.axis==="both",d=o.axis==="y"||o.axis==="both",m=["mouseenter","mousemove"].includes(o.dataRef.current.openEvent?.type||"")&&o.pointerType!=="touch";let p=c.width,y=c.height,g=c.x,v=c.y;return r==null&&o.x&&f&&(r=c.x-o.x),a==null&&o.y&&d&&(a=c.y-o.y),g-=r||0,v-=a||0,p=0,y=0,!l||m?(p=o.axis==="y"?c.width:0,y=o.axis==="x"?c.height:0,g=f&&o.x!=null?o.x:g,v=d&&o.y!=null?o.y:v):l&&!m&&(y=o.axis==="x"?c.height:y,p=o.axis==="y"?c.width:p),l=!0,{width:p,height:y,x:g,y:v,top:v,right:g+p,bottom:v+y,left:g}}}}function x0(t){return t!=null&&t.clientX!=null}function Tk(t,o={}){const r="rootStore"in t?t.rootStore:t,a=r.useState("open"),l=r.useState("floatingElement"),c=r.useState("domReferenceElement"),f=r.context.dataRef,{enabled:d=!0,axis:m="both"}=o,p=R.useRef(!1),y=R.useRef(null),[g,v]=R.useState(),[b,x]=R.useState([]),w=Ce((O,z,N)=>{p.current||f.current.openEvent&&!x0(f.current.openEvent)||r.set("positionReference",Rk(N??c,{x:O,y:z,axis:m,dataRef:f,pointerType:g}))}),E=Ce(O=>{a?y.current||x([]):w(O.clientX,O.clientY,O.currentTarget)}),C=ms(g)?l:a,_=R.useCallback(()=>{if(!C||!d)return;const O=zt(l);function z(N){const j=rn(N);Ye(l,j)?(O.removeEventListener("mousemove",z),y.current=null):w(N.clientX,N.clientY)}if(!f.current.openEvent||x0(f.current.openEvent)){O.addEventListener("mousemove",z);const N=()=>{O.removeEventListener("mousemove",z),y.current=null};return y.current=N,N}r.set("positionReference",c)},[C,d,l,f,c,r,w]);R.useEffect(()=>_(),[_,b]),R.useEffect(()=>{d&&!l&&(p.current=!1)},[d,l]),R.useEffect(()=>{!d&&a&&(p.current=!0)},[d,a]);const k=R.useMemo(()=>{function O(z){v(z.pointerType)}return{onPointerDown:O,onPointerEnter:O,onMouseMove:E,onMouseEnter:E}},[E]);return R.useMemo(()=>d?{reference:k,trigger:k}:{},[d,k])}function w0(t,o,r){let{reference:a,floating:l}=t;const c=Vn(o),f=qp(o),d=Vp(f),m=vn(o),p=c==="y",y=a.x+a.width/2-l.width/2,g=a.y+a.height/2-l.height/2,v=a[d]/2-l[d]/2;let b;switch(m){case"top":b={x:y,y:a.y-l.height};break;case"bottom":b={x:y,y:a.y+a.height};break;case"right":b={x:a.x+a.width,y:g};break;case"left":b={x:a.x-l.width,y:g};break;default:b={x:a.x,y:a.y}}switch(jr(o)){case"start":b[f]-=v*(r&&p?-1:1);break;case"end":b[f]+=v*(r&&p?-1:1);break}return b}async function Ck(t,o){var r;o===void 0&&(o={});const{x:a,y:l,platform:c,rects:f,elements:d,strategy:m}=t,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:g="floating",altBoundary:v=!1,padding:b=0}=Uo(o,t),x=qx(b),E=d[v?g==="floating"?"reference":"floating":g],C=pu(await c.getClippingRect({element:(r=await(c.isElement==null?void 0:c.isElement(E)))==null||r?E:E.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(d.floating)),boundary:p,rootBoundary:y,strategy:m})),_=g==="floating"?{x:a,y:l,width:f.floating.width,height:f.floating.height}:f.reference,k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(d.floating)),O=await(c.isElement==null?void 0:c.isElement(k))?await(c.getScale==null?void 0:c.getScale(k))||{x:1,y:1}:{x:1,y:1},z=pu(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:_,offsetParent:k,strategy:m}):_);return{top:(C.top-z.top+x.top)/O.y,bottom:(z.bottom-C.bottom+x.bottom)/O.y,left:(C.left-z.left+x.left)/O.x,right:(z.right-C.right+x.right)/O.x}}const Mk=async(t,o,r)=>{const{placement:a="bottom",strategy:l="absolute",middleware:c=[],platform:f}=r,d=c.filter(Boolean),m=await(f.isRTL==null?void 0:f.isRTL(o));let p=await f.getElementRects({reference:t,floating:o,strategy:l}),{x:y,y:g}=w0(p,a,m),v=a,b={},x=0;for(let E=0;E<d.length;E++){var w;const{name:C,fn:_}=d[E],{x:k,y:O,data:z,reset:N}=await _({x:y,y:g,initialPlacement:a,placement:v,strategy:l,middlewareData:b,rects:p,platform:{...f,detectOverflow:(w=f.detectOverflow)!=null?w:Ck},elements:{reference:t,floating:o}});y=k??y,g=O??g,b={...b,[C]:{...b[C],...z}},N&&x<=50&&(x++,typeof N=="object"&&(N.placement&&(v=N.placement),N.rects&&(p=N.rects===!0?await f.getElementRects({reference:t,floating:o,strategy:l}):N.rects),{x:y,y:g}=w0(p,v,m)),E=-1)}return{x:y,y:g,placement:v,strategy:l,middlewareData:b}},Ok=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(o){var r,a;const{placement:l,middlewareData:c,rects:f,initialPlacement:d,platform:m,elements:p}=o,{mainAxis:y=!0,crossAxis:g=!0,fallbackPlacements:v,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:w=!0,...E}=Uo(t,o);if((r=c.arrow)!=null&&r.alignmentOffset)return{};const C=vn(l),_=Vn(d),k=vn(d)===d,O=await(m.isRTL==null?void 0:m.isRTL(p.floating)),z=v||(k||!w?[hu(d)]:vD(d)),N=x!=="none";!v&&N&&z.push(...wD(d,w,x,O));const j=[d,...z],D=await m.detectOverflow(o,E),Y=[];let $=((a=c.flip)==null?void 0:a.overflows)||[];if(y&&Y.push(D[C]),g){const ne=yD(l,f,O);Y.push(D[ne[0]],D[ne[1]])}if($=[...$,{placement:l,overflows:Y}],!Y.every(ne=>ne<=0)){var Z,V;const ne=(((Z=c.flip)==null?void 0:Z.index)||0)+1,ae=j[ne];if(ae&&(!(g==="alignment"?_!==Vn(ae):!1)||$.every(G=>Vn(G.placement)===_?G.overflows[0]>0:!0)))return{data:{index:ne,overflows:$},reset:{placement:ae}};let B=(V=$.filter(H=>H.overflows[0]<=0).sort((H,G)=>H.overflows[1]-G.overflows[1])[0])==null?void 0:V.placement;if(!B)switch(b){case"bestFit":{var J;const H=(J=$.filter(G=>{if(N){const ce=Vn(G.placement);return ce===_||ce==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(ce=>ce>0).reduce((ce,W)=>ce+W,0)]).sort((G,ce)=>G[1]-ce[1])[0])==null?void 0:J[0];H&&(B=H);break}case"initialPlacement":B=d;break}if(l!==B)return{reset:{placement:B}}}return{}}}};function E0(t,o){return{top:t.top-o.height,right:t.right-o.width,bottom:t.bottom-o.height,left:t.left-o.width}}function R0(t){return hD.some(o=>t[o]>=0)}const _k=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(o){const{rects:r,platform:a}=o,{strategy:l="referenceHidden",...c}=Uo(t,o);switch(l){case"referenceHidden":{const f=await a.detectOverflow(o,{...c,elementContext:"reference"}),d=E0(f,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:R0(d)}}}case"escaped":{const f=await a.detectOverflow(o,{...c,altBoundary:!0}),d=E0(f,r.floating);return{data:{escapedOffsets:d,escaped:R0(d)}}}default:return{}}}}},gw=new Set(["left","top"]);async function Ak(t,o){const{placement:r,platform:a,elements:l}=t,c=await(a.isRTL==null?void 0:a.isRTL(l.floating)),f=vn(r),d=jr(r),m=Vn(r)==="y",p=gw.has(f)?-1:1,y=c&&m?-1:1,g=Uo(o,t);let{mainAxis:v,crossAxis:b,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof x=="number"&&(b=d==="end"?x*-1:x),m?{x:b*y,y:v*p}:{x:v*p,y:b*y}}const Dk=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(o){var r,a;const{x:l,y:c,placement:f,middlewareData:d}=o,m=await Ak(o,t);return f===((r=d.offset)==null?void 0:r.placement)&&(a=d.arrow)!=null&&a.alignmentOffset?{}:{x:l+m.x,y:c+m.y,data:{...m,placement:f}}}}},kk=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(o){const{x:r,y:a,placement:l,platform:c}=o,{mainAxis:f=!0,crossAxis:d=!1,limiter:m={fn:C=>{let{x:_,y:k}=C;return{x:_,y:k}}},...p}=Uo(t,o),y={x:r,y:a},g=await c.detectOverflow(o,p),v=Vn(vn(l)),b=Hp(v);let x=y[b],w=y[v];if(f){const C=b==="y"?"top":"left",_=b==="y"?"bottom":"right",k=x+g[C],O=x-g[_];x=op(k,x,O)}if(d){const C=v==="y"?"top":"left",_=v==="y"?"bottom":"right",k=w+g[C],O=w-g[_];w=op(k,w,O)}const E=m.fn({...o,[b]:x,[v]:w});return{...E,data:{x:E.x-r,y:E.y-a,enabled:{[b]:f,[v]:d}}}}}},zk=function(t){return t===void 0&&(t={}),{options:t,fn(o){const{x:r,y:a,placement:l,rects:c,middlewareData:f}=o,{offset:d=0,mainAxis:m=!0,crossAxis:p=!0}=Uo(t,o),y={x:r,y:a},g=Vn(l),v=Hp(g);let b=y[v],x=y[g];const w=Uo(d,o),E=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(m){const k=v==="y"?"height":"width",O=c.reference[v]-c.floating[k]+E.mainAxis,z=c.reference[v]+c.reference[k]-E.mainAxis;b<O?b=O:b>z&&(b=z)}if(p){var C,_;const k=v==="y"?"width":"height",O=gw.has(vn(l)),z=c.reference[g]-c.floating[k]+(O&&((C=f.offset)==null?void 0:C[g])||0)+(O?0:E.crossAxis),N=c.reference[g]+c.reference[k]+(O?0:((_=f.offset)==null?void 0:_[g])||0)-(O?E.crossAxis:0);x<z?x=z:x>N&&(x=N)}return{[v]:b,[g]:x}}}},Nk=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(o){var r,a;const{placement:l,rects:c,platform:f,elements:d}=o,{apply:m=()=>{},...p}=Uo(t,o),y=await f.detectOverflow(o,p),g=vn(l),v=jr(l),b=Vn(l)==="y",{width:x,height:w}=c.floating;let E,C;g==="top"||g==="bottom"?(E=g,C=v===(await(f.isRTL==null?void 0:f.isRTL(d.floating))?"start":"end")?"left":"right"):(C=g,E=v==="end"?"top":"bottom");const _=w-y.top-y.bottom,k=x-y.left-y.right,O=Oa(w-y[E],_),z=Oa(x-y[C],k),N=!o.middlewareData.shift;let j=O,D=z;if((r=o.middlewareData.shift)!=null&&r.enabled.x&&(D=k),(a=o.middlewareData.shift)!=null&&a.enabled.y&&(j=_),N&&!v){const $=Mn(y.left,0),Z=Mn(y.right,0),V=Mn(y.top,0),J=Mn(y.bottom,0);b?D=x-2*($!==0||Z!==0?$+Z:Mn(y.left,y.right)):j=w-2*(V!==0||J!==0?V+J:Mn(y.top,y.bottom))}await m({...o,availableWidth:D,availableHeight:j});const Y=await f.getDimensions(d.floating);return x!==Y.width||w!==Y.height?{reset:{rects:!0}}:{}}}};function yw(t){const o=On(t);let r=parseFloat(o.width)||0,a=parseFloat(o.height)||0;const l=St(t),c=l?t.offsetWidth:r,f=l?t.offsetHeight:a,d=du(r)!==c||du(a)!==f;return d&&(r=c,a=f),{width:r,height:a,$:d}}function $p(t){return st(t)?t:t.contextElement}function Ea(t){const o=$p(t);if(!St(o))return so(1);const r=o.getBoundingClientRect(),{width:a,height:l,$:c}=yw(o);let f=(c?du(r.width):r.width)/a,d=(c?du(r.height):r.height)/l;return(!f||!Number.isFinite(f))&&(f=1),(!d||!Number.isFinite(d))&&(d=1),{x:f,y:d}}const Lk=so(0);function vw(t){const o=zt(t);return!Lu()||!o.visualViewport?Lk:{x:o.visualViewport.offsetLeft,y:o.visualViewport.offsetTop}}function jk(t,o,r){return o===void 0&&(o=!1),!r||o&&r!==zt(t)?!1:o}function gs(t,o,r,a){o===void 0&&(o=!1),r===void 0&&(r=!1);const l=t.getBoundingClientRect(),c=$p(t);let f=so(1);o&&(a?st(a)&&(f=Ea(a)):f=Ea(t));const d=jk(c,r,a)?vw(c):so(0);let m=(l.left+d.x)/f.x,p=(l.top+d.y)/f.y,y=l.width/f.x,g=l.height/f.y;if(c){const v=zt(c),b=a&&st(a)?zt(a):a;let x=v,w=Jh(x);for(;w&&a&&b!==x;){const E=Ea(w),C=w.getBoundingClientRect(),_=On(w),k=C.left+(w.clientLeft+parseFloat(_.paddingLeft))*E.x,O=C.top+(w.clientTop+parseFloat(_.paddingTop))*E.y;m*=E.x,p*=E.y,y*=E.x,g*=E.y,m+=k,p+=O,x=zt(w),w=Jh(x)}}return pu({width:y,height:g,x:m,y:p})}function Vu(t,o){const r=ju(t).scrollLeft;return o?o.left+r:gs(uo(t)).left+r}function bw(t,o){const r=t.getBoundingClientRect(),a=r.left+o.scrollLeft-Vu(t,r),l=r.top+o.scrollTop;return{x:a,y:l}}function Pk(t){let{elements:o,rect:r,offsetParent:a,strategy:l}=t;const c=l==="fixed",f=uo(a),d=o?Nu(o.floating):!1;if(a===f||d&&c)return r;let m={scrollLeft:0,scrollTop:0},p=so(1);const y=so(0),g=St(a);if((g||!g&&!c)&&((zr(a)!=="body"||Nr(f))&&(m=ju(a)),St(a))){const b=gs(a);p=Ea(a),y.x=b.x+a.clientLeft,y.y=b.y+a.clientTop}const v=f&&!g&&!c?bw(f,m):so(0);return{width:r.width*p.x,height:r.height*p.y,x:r.x*p.x-m.scrollLeft*p.x+y.x+v.x,y:r.y*p.y-m.scrollTop*p.y+y.y+v.y}}function Uk(t){return Array.from(t.getClientRects())}function Bk(t){const o=uo(t),r=ju(t),a=t.ownerDocument.body,l=Mn(o.scrollWidth,o.clientWidth,a.scrollWidth,a.clientWidth),c=Mn(o.scrollHeight,o.clientHeight,a.scrollHeight,a.clientHeight);let f=-r.scrollLeft+Vu(t);const d=-r.scrollTop;return On(a).direction==="rtl"&&(f+=Mn(o.clientWidth,a.clientWidth)-l),{width:l,height:c,x:f,y:d}}const T0=25;function Ik(t,o){const r=zt(t),a=uo(t),l=r.visualViewport;let c=a.clientWidth,f=a.clientHeight,d=0,m=0;if(l){c=l.width,f=l.height;const y=Lu();(!y||y&&o==="fixed")&&(d=l.offsetLeft,m=l.offsetTop)}const p=Vu(a);if(p<=0){const y=a.ownerDocument,g=y.body,v=getComputedStyle(g),b=y.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,x=Math.abs(a.clientWidth-g.clientWidth-b);x<=T0&&(c-=x)}else p<=T0&&(c+=p);return{width:c,height:f,x:d,y:m}}const Hk=new Set(["absolute","fixed"]);function Vk(t,o){const r=gs(t,!0,o==="fixed"),a=r.top+t.clientTop,l=r.left+t.clientLeft,c=St(t)?Ea(t):so(1),f=t.clientWidth*c.x,d=t.clientHeight*c.y,m=l*c.x,p=a*c.y;return{width:f,height:d,x:m,y:p}}function C0(t,o,r){let a;if(o==="viewport")a=Ik(t,r);else if(o==="document")a=Bk(uo(t));else if(st(o))a=Vk(o,r);else{const l=vw(t);a={x:o.x-l.x,y:o.y-l.y,width:o.width,height:o.height}}return pu(a)}function Sw(t,o){const r=lo(t);return r===o||!st(r)||ro(r)?!1:On(r).position==="fixed"||Sw(r,o)}function qk(t,o){const r=o.get(t);if(r)return r;let a=Mr(t,[],!1).filter(d=>st(d)&&zr(d)!=="body"),l=null;const c=On(t).position==="fixed";let f=c?lo(t):t;for(;st(f)&&!ro(f);){const d=On(f),m=Lp(f);!m&&d.position==="fixed"&&(l=null),(c?!m&&!l:!m&&d.position==="static"&&!!l&&Hk.has(l.position)||Nr(f)&&!m&&Sw(t,f))?a=a.filter(y=>y!==f):l=d,f=lo(f)}return o.set(t,a),a}function Yk(t){let{element:o,boundary:r,rootBoundary:a,strategy:l}=t;const f=[...r==="clippingAncestors"?Nu(o)?[]:qk(o,this._c):[].concat(r),a],d=f[0],m=f.reduce((p,y)=>{const g=C0(o,y,l);return p.top=Mn(g.top,p.top),p.right=Oa(g.right,p.right),p.bottom=Oa(g.bottom,p.bottom),p.left=Mn(g.left,p.left),p},C0(o,d,l));return{width:m.right-m.left,height:m.bottom-m.top,x:m.left,y:m.top}}function Gk(t){const{width:o,height:r}=yw(t);return{width:o,height:r}}function Fk(t,o,r){const a=St(o),l=uo(o),c=r==="fixed",f=gs(t,!0,c,o);let d={scrollLeft:0,scrollTop:0};const m=so(0);function p(){m.x=Vu(l)}if(a||!a&&!c)if((zr(o)!=="body"||Nr(l))&&(d=ju(o)),a){const b=gs(o,!0,c,o);m.x=b.x+o.clientLeft,m.y=b.y+o.clientTop}else l&&p();c&&!a&&l&&p();const y=l&&!a&&!c?bw(l,d):so(0),g=f.left+d.scrollLeft-m.x-y.x,v=f.top+d.scrollTop-m.y-y.y;return{x:g,y:v,width:f.width,height:f.height}}function kh(t){return On(t).position==="static"}function M0(t,o){if(!St(t)||On(t).position==="fixed")return null;if(o)return o(t);let r=t.offsetParent;return uo(t)===r&&(r=r.ownerDocument.body),r}function xw(t,o){const r=zt(t);if(Nu(t))return r;if(!St(t)){let l=lo(t);for(;l&&!ro(l);){if(st(l)&&!kh(l))return l;l=lo(l)}return r}let a=M0(t,o);for(;a&&JA(a)&&kh(a);)a=M0(a,o);return a&&ro(a)&&kh(a)&&!Lp(a)?r:a||o2(t)||r}const Xk=async function(t){const o=this.getOffsetParent||xw,r=this.getDimensions,a=await r(t.floating);return{reference:Fk(t.reference,await o(t.floating),t.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function Kk(t){return On(t).direction==="rtl"}const Qk={convertOffsetParentRelativeRectToViewportRelativeRect:Pk,getDocumentElement:uo,getClippingRect:Yk,getOffsetParent:xw,getElementRects:Xk,getClientRects:Uk,getDimensions:Gk,getScale:Ea,isElement:st,isRTL:Kk};function ww(t,o){return t.x===o.x&&t.y===o.y&&t.width===o.width&&t.height===o.height}function Zk(t,o){let r=null,a;const l=uo(t);function c(){var d;clearTimeout(a),(d=r)==null||d.disconnect(),r=null}function f(d,m){d===void 0&&(d=!1),m===void 0&&(m=1),c();const p=t.getBoundingClientRect(),{left:y,top:g,width:v,height:b}=p;if(d||o(),!v||!b)return;const x=ha(g),w=ha(l.clientWidth-(y+v)),E=ha(l.clientHeight-(g+b)),C=ha(y),k={rootMargin:-x+"px "+-w+"px "+-E+"px "+-C+"px",threshold:Mn(0,Oa(1,m))||1};let O=!0;function z(N){const j=N[0].intersectionRatio;if(j!==m){if(!O)return f();j?f(!1,j):a=setTimeout(()=>{f(!1,1e-7)},1e3)}j===1&&!ww(p,t.getBoundingClientRect())&&f(),O=!1}try{r=new IntersectionObserver(z,{...k,root:l.ownerDocument})}catch{r=new IntersectionObserver(z,k)}r.observe(t)}return f(!0),c}function O0(t,o,r,a){a===void 0&&(a={});const{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:f=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=a,p=$p(t),y=l||c?[...p?Mr(p):[],...Mr(o)]:[];y.forEach(C=>{l&&C.addEventListener("scroll",r,{passive:!0}),c&&C.addEventListener("resize",r)});const g=p&&d?Zk(p,r):null;let v=-1,b=null;f&&(b=new ResizeObserver(C=>{let[_]=C;_&&_.target===p&&b&&(b.unobserve(o),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var k;(k=b)==null||k.observe(o)})),r()}),p&&!m&&b.observe(p),b.observe(o));let x,w=m?gs(t):null;m&&E();function E(){const C=gs(t);w&&!ww(w,C)&&r(),w=C,x=requestAnimationFrame(E)}return r(),()=>{var C;y.forEach(_=>{l&&_.removeEventListener("scroll",r),c&&_.removeEventListener("resize",r)}),g?.(),(C=b)==null||C.disconnect(),b=null,m&&cancelAnimationFrame(x)}}const $k=Dk,Jk=kk,Wk=Ok,ez=Nk,tz=_k,nz=zk,oz=(t,o,r)=>{const a=new Map,l={platform:Qk,...r},c={...l.platform,_c:a};return Mk(t,o,{...l,platform:c})};var rz=typeof document<"u",sz=function(){},Qc=rz?R.useLayoutEffect:sz;function Su(t,o){if(t===o)return!0;if(typeof t!=typeof o)return!1;if(typeof t=="function"&&t.toString()===o.toString())return!0;let r,a,l;if(t&&o&&typeof t=="object"){if(Array.isArray(t)){if(r=t.length,r!==o.length)return!1;for(a=r;a--!==0;)if(!Su(t[a],o[a]))return!1;return!0}if(l=Object.keys(t),r=l.length,r!==Object.keys(o).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(o,l[a]))return!1;for(a=r;a--!==0;){const c=l[a];if(!(c==="_owner"&&t.$$typeof)&&!Su(t[c],o[c]))return!1}return!0}return t!==t&&o!==o}function Ew(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function _0(t,o){const r=Ew(t);return Math.round(o*r)/r}function zh(t){const o=R.useRef(t);return Qc(()=>{o.current=t}),o}function az(t){t===void 0&&(t={});const{placement:o="bottom",strategy:r="absolute",middleware:a=[],platform:l,elements:{reference:c,floating:f}={},transform:d=!0,whileElementsMounted:m,open:p}=t,[y,g]=R.useState({x:0,y:0,strategy:r,placement:o,middlewareData:{},isPositioned:!1}),[v,b]=R.useState(a);Su(v,a)||b(a);const[x,w]=R.useState(null),[E,C]=R.useState(null),_=R.useCallback(G=>{G!==N.current&&(N.current=G,w(G))},[]),k=R.useCallback(G=>{G!==j.current&&(j.current=G,C(G))},[]),O=c||x,z=f||E,N=R.useRef(null),j=R.useRef(null),D=R.useRef(y),Y=m!=null,$=zh(m),Z=zh(l),V=zh(p),J=R.useCallback(()=>{if(!N.current||!j.current)return;const G={placement:o,strategy:r,middleware:v};Z.current&&(G.platform=Z.current),oz(N.current,j.current,G).then(ce=>{const W={...ce,isPositioned:V.current!==!1};ne.current&&!Su(D.current,W)&&(D.current=W,io.flushSync(()=>{g(W)}))})},[v,o,r,Z,V]);Qc(()=>{p===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,g(G=>({...G,isPositioned:!1})))},[p]);const ne=R.useRef(!1);Qc(()=>(ne.current=!0,()=>{ne.current=!1}),[]),Qc(()=>{if(O&&(N.current=O),z&&(j.current=z),O&&z){if($.current)return $.current(O,z,J);J()}},[O,z,J,$,Y]);const ae=R.useMemo(()=>({reference:N,floating:j,setReference:_,setFloating:k}),[_,k]),B=R.useMemo(()=>({reference:O,floating:z}),[O,z]),H=R.useMemo(()=>{const G={position:r,left:0,top:0};if(!B.floating)return G;const ce=_0(B.floating,y.x),W=_0(B.floating,y.y);return d?{...G,transform:"translate("+ce+"px, "+W+"px)",...Ew(B.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:ce,top:W}},[r,d,B.floating,y.x,y.y]);return R.useMemo(()=>({...y,update:J,refs:ae,elements:B,floatingStyles:H}),[y,J,ae,B,H])}const iz=(t,o)=>({...$k(t),options:[t,o]}),lz=(t,o)=>({...Jk(t),options:[t,o]}),cz=(t,o)=>({...nz(t),options:[t,o]}),uz=(t,o)=>({...Wk(t),options:[t,o]}),fz=(t,o)=>({...ez(t),options:[t,o]}),dz=(t,o)=>({...tz(t),options:[t,o]}),hz={intentional:"onClick",sloppy:"onPointerDown"};function pz(t){return{escapeKey:typeof t=="boolean"?t:t?.escapeKey??!1,outsidePress:typeof t=="boolean"?t:t?.outsidePress??!0}}function Jp(t,o={}){const r="rootStore"in t?t.rootStore:t,a=r.useState("open"),l=r.useState("floatingElement"),c=r.useState("referenceElement"),f=r.useState("domReferenceElement"),{onOpenChange:d,dataRef:m}=r.context,{enabled:p=!0,escapeKey:y=!0,outsidePress:g=!0,outsidePressEvent:v="sloppy",referencePress:b=!1,referencePressEvent:x="sloppy",ancestorScroll:w=!1,bubbles:E,externalTree:C}=o,_=Pr(C),k=Ce(typeof g=="function"?g:()=>!1),O=typeof g=="function"?k:g,z=R.useRef(!1),{escapeKey:N,outsidePress:j}=pz(E),D=R.useRef(null),Y=qn(),$=qn(),Z=Ce(()=>{$.clear(),m.current.insideReactTree=!1}),V=R.useRef(!1),J=R.useRef(""),ne=Ce(te=>{J.current=te.pointerType}),ae=Ce(()=>{const te=J.current,me=te==="pen"||!te?"mouse":te,pe=typeof v=="function"?v():v;return typeof pe=="string"?pe:pe[me]}),B=Ce(te=>{if(!a||!p||!y||te.key!=="Escape"||V.current)return;const me=m.current.floatingContext?.nodeId,pe=_?us(_.nodesRef.current,me):[];if(!N&&pe.length>0){let Se=!0;if(pe.forEach(ye=>{ye.context?.open&&!ye.context.dataRef.current.__escapeKeyBubbles&&(Se=!1)}),!Se)return}const Ne=dD(te)?te.nativeEvent:te,be=Qe(Hu,Ne);r.setOpen(!1,be),!N&&!be.isPropagationAllowed&&te.stopPropagation()}),H=Ce(te=>{const me=ae();return me==="intentional"&&te.type!=="click"||me==="sloppy"&&te.type==="click"}),G=Ce(()=>{m.current.insideReactTree=!0,$.start(0,Z)}),ce=Ce((te,me=!1)=>{if(H(te)){Z();return}if(m.current.insideReactTree){Z();return}if(ae()==="intentional"&&me||typeof O=="function"&&!O(te))return;const pe=rn(te),Ne=`[${ka("inert")}]`,be=at(r.select("floatingElement")).querySelectorAll(Ne),Se=r.context.triggerElements;if(pe&&(Se.hasElement(pe)||Se.hasMatchingElement(De=>Ye(De,pe))))return;let ye=st(pe)?pe:null;for(;ye&&!ro(ye);){const De=lo(ye);if(ro(De)||!st(De))break;ye=De}if(be.length&&st(pe)&&!uD(pe)&&!Ye(pe,r.select("floatingElement"))&&Array.from(be).every(De=>!Ye(ye,De)))return;if(St(pe)&&!("touches"in te)){const De=ro(pe),qe=On(pe),Be=/auto|scroll/,Ot=De||Be.test(qe.overflowX),He=De||Be.test(qe.overflowY),Je=Ot&&pe.clientWidth>0&&pe.scrollWidth>pe.clientWidth,Pe=He&&pe.clientHeight>0&&pe.scrollHeight>pe.clientHeight,Et=qe.direction==="rtl",Qt=Pe&&(Et?te.offsetX<=pe.offsetWidth-pe.clientWidth:te.offsetX>pe.clientWidth),Yn=Je&&te.offsetY>pe.clientHeight;if(Qt||Yn)return}const de=m.current.floatingContext?.nodeId,we=_&&us(_.nodesRef.current,de).some(De=>Qn(te,De.context?.elements.floating));if(Qn(te,r.select("floatingElement"))||Qn(te,r.select("domReferenceElement"))||we)return;const ge=_?us(_.nodesRef.current,de):[];if(ge.length>0){let De=!0;if(ge.forEach(qe=>{qe.context?.open&&!qe.context.dataRef.current.__outsidePressBubbles&&(De=!1)}),!De)return}r.setOpen(!1,Qe(Xp,te)),Z()}),W=Ce(te=>{ae()!=="sloppy"||te.pointerType==="touch"||!r.select("open")||!p||Qn(te,r.select("floatingElement"))||Qn(te,r.select("domReferenceElement"))||ce(te)}),P=Ce(te=>{if(ae()!=="sloppy"||!r.select("open")||!p||Qn(te,r.select("floatingElement"))||Qn(te,r.select("domReferenceElement")))return;const me=te.touches[0];me&&(D.current={startTime:Date.now(),startX:me.clientX,startY:me.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},Y.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}),X=Ce(te=>{const me=rn(te);function pe(){P(te),me?.removeEventListener(te.type,pe)}me?.addEventListener(te.type,pe)}),le=Ce(te=>{const me=z.current;if(z.current=!1,Y.clear(),te.type==="mousedown"&&D.current&&!D.current.dismissOnMouseDown)return;const pe=rn(te);function Ne(){te.type==="pointerdown"?W(te):ce(te,me),pe?.removeEventListener(te.type,Ne)}pe?.addEventListener(te.type,Ne)}),re=Ce(te=>{if(ae()!=="sloppy"||!D.current||Qn(te,r.select("floatingElement"))||Qn(te,r.select("domReferenceElement")))return;const me=te.touches[0];if(!me)return;const pe=Math.abs(me.clientX-D.current.startX),Ne=Math.abs(me.clientY-D.current.startY),be=Math.sqrt(pe*pe+Ne*Ne);be>5&&(D.current.dismissOnTouchEnd=!0),be>10&&(ce(te),Y.clear(),D.current=null)}),ue=Ce(te=>{const me=rn(te);function pe(){re(te),me?.removeEventListener(te.type,pe)}me?.addEventListener(te.type,pe)}),he=Ce(te=>{ae()!=="sloppy"||!D.current||Qn(te,r.select("floatingElement"))||Qn(te,r.select("domReferenceElement"))||(D.current.dismissOnTouchEnd&&ce(te),Y.clear(),D.current=null)}),ve=Ce(te=>{const me=rn(te);function pe(){he(te),me?.removeEventListener(te.type,pe)}me?.addEventListener(te.type,pe)});R.useEffect(()=>{if(!a||!p)return;m.current.__escapeKeyBubbles=N,m.current.__outsidePressBubbles=j;const te=new co;function me(ye){r.setOpen(!1,Qe(Fp,ye))}function pe(){te.clear(),V.current=!0}function Ne(){te.start(Lu()?5:0,()=>{V.current=!1})}const be=at(l);be.addEventListener("pointerdown",ne,!0),y&&(be.addEventListener("keydown",B),be.addEventListener("compositionstart",pe),be.addEventListener("compositionend",Ne)),O&&(be.addEventListener("click",le,!0),be.addEventListener("pointerdown",le,!0),be.addEventListener("touchstart",X,!0),be.addEventListener("touchmove",ue,!0),be.addEventListener("touchend",ve,!0),be.addEventListener("mousedown",le,!0));let Se=[];return w&&(st(f)&&(Se=Mr(f)),st(l)&&(Se=Se.concat(Mr(l))),!st(c)&&c&&c.contextElement&&(Se=Se.concat(Mr(c.contextElement)))),Se=Se.filter(ye=>ye!==be.defaultView?.visualViewport),Se.forEach(ye=>{ye.addEventListener("scroll",me,{passive:!0})}),()=>{be.removeEventListener("pointerdown",ne,!0),y&&(be.removeEventListener("keydown",B),be.removeEventListener("compositionstart",pe),be.removeEventListener("compositionend",Ne)),O&&(be.removeEventListener("click",le,!0),be.removeEventListener("pointerdown",le,!0),be.removeEventListener("touchstart",X,!0),be.removeEventListener("touchmove",ue,!0),be.removeEventListener("touchend",ve,!0),be.removeEventListener("mousedown",le,!0)),Se.forEach(ye=>{ye.removeEventListener("scroll",me)}),te.clear(),z.current=!1}},[m,l,c,f,y,O,a,d,w,p,N,j,B,ce,le,W,X,ue,ve,ne,r]),R.useEffect(Z,[O,Z]);const Me=R.useMemo(()=>({onKeyDown:B,...b&&{[hz[x]]:te=>{r.setOpen(!1,Qe(Aa,te.nativeEvent))},...x!=="intentional"&&{onClick(te){r.setOpen(!1,Qe(Aa,te.nativeEvent))}}}}),[B,r,b,x]),fe=Ce(te=>{const me=rn(te.nativeEvent);!Ye(r.select("floatingElement"),me)||te.button!==0||(z.current=!0)}),ze=Ce(te=>{!a||!p||te.button!==0||(z.current=!0)}),je=R.useMemo(()=>({onKeyDown:B,onPointerDown:fe,onMouseDown:fe,onMouseUp:fe,onClickCapture:G,onMouseDownCapture(te){G(),ze(te)},onPointerDownCapture(te){G(),ze(te)},onMouseUpCapture:G,onTouchEndCapture:G,onTouchMoveCapture:G}),[B,fe,G,ze]);return R.useMemo(()=>p?{reference:Me,floating:je,trigger:Me}:{},[p,Me,je])}var xu=Symbol("NOT_FOUND");function mz(t,o=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(o)}function gz(t,o=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(o)}function yz(t,o="expected all items to be functions, instead received the following types: "){if(!t.every(r=>typeof r=="function")){const r=t.map(a=>typeof a=="function"?`function ${a.name||"unnamed"}()`:typeof a).join(", ");throw new TypeError(`${o}[${r}]`)}}var A0=t=>Array.isArray(t)?t:[t];function vz(t){const o=Array.isArray(t[0])?t[0]:t;return yz(o,"createSelector expects all input-selectors to be functions, but received the following types: "),o}function bz(t,o){const r=[],{length:a}=t;for(let l=0;l<a;l++)r.push(t[l].apply(null,o));return r}function Sz(t){let o;return{get(r){return o&&t(o.key,r)?o.value:xu},put(r,a){o={key:r,value:a}},getEntries(){return o?[o]:[]},clear(){o=void 0}}}function xz(t,o){let r=[];function a(d){const m=r.findIndex(p=>o(d,p.key));if(m>-1){const p=r[m];return m>0&&(r.splice(m,1),r.unshift(p)),p.value}return xu}function l(d,m){a(d)===xu&&(r.unshift({key:d,value:m}),r.length>t&&r.pop())}function c(){return r}function f(){r=[]}return{get:a,put:l,getEntries:c,clear:f}}var wz=(t,o)=>t===o;function Ez(t){return function(r,a){if(r===null||a===null||r.length!==a.length)return!1;const{length:l}=r;for(let c=0;c<l;c++)if(!t(r[c],a[c]))return!1;return!0}}function Rz(t,o){const r=typeof o=="object"?o:{equalityCheck:o},{equalityCheck:a=wz,maxSize:l=1,resultEqualityCheck:c}=r,f=Ez(a);let d=0;const m=l<=1?Sz(f):xz(l,f);function p(){let y=m.get(arguments);if(y===xu){if(y=t.apply(null,arguments),d++,c){const v=m.getEntries().find(b=>c(b.value,y));v&&(y=v.value,d!==0&&d--)}m.put(arguments,y)}return y}return p.clearCache=()=>{m.clear(),p.resetResultsCount()},p.resultsCount=()=>d,p.resetResultsCount=()=>{d=0},p}var Tz=class{constructor(t){this.value=t}deref(){return this.value}},Cz=typeof WeakRef<"u"?WeakRef:Tz,Mz=0,D0=1;function Lc(){return{s:Mz,v:void 0,o:null,p:null}}function Rw(t,o={}){let r=Lc();const{resultEqualityCheck:a}=o;let l,c=0;function f(){let d=r;const{length:m}=arguments;for(let g=0,v=m;g<v;g++){const b=arguments[g];if(typeof b=="function"||typeof b=="object"&&b!==null){let x=d.o;x===null&&(d.o=x=new WeakMap);const w=x.get(b);w===void 0?(d=Lc(),x.set(b,d)):d=w}else{let x=d.p;x===null&&(d.p=x=new Map);const w=x.get(b);w===void 0?(d=Lc(),x.set(b,d)):d=w}}const p=d;let y;if(d.s===D0)y=d.v;else if(y=t.apply(null,arguments),c++,a){const g=l?.deref?.()??l;g!=null&&a(g,y)&&(y=g,c!==0&&c--),l=typeof y=="object"&&y!==null||typeof y=="function"?new Cz(y):y}return p.s=D0,p.v=y,y}return f.clearCache=()=>{r=Lc(),f.resetResultsCount()},f.resultsCount=()=>c,f.resetResultsCount=()=>{c=0},f}function Tw(t,...o){const r=typeof t=="function"?{memoize:t,memoizeOptions:o}:t,a=(...l)=>{let c=0,f=0,d,m={},p=l.pop();typeof p=="object"&&(m=p,p=l.pop()),mz(p,`createSelector expects an output function after the inputs, but received: [${typeof p}]`);const y={...r,...m},{memoize:g,memoizeOptions:v=[],argsMemoize:b=Rw,argsMemoizeOptions:x=[]}=y,w=A0(v),E=A0(x),C=vz(l),_=g(function(){return c++,p.apply(null,arguments)},...w),k=b(function(){f++;const z=bz(C,arguments);return d=_.apply(null,z),d},...E);return Object.assign(k,{resultFunc:p,memoizedResultFunc:_,dependencies:C,dependencyRecomputations:()=>f,resetDependencyRecomputations:()=>{f=0},lastResult:()=>d,recomputations:()=>c,resetRecomputations:()=>{c=0},memoize:g,argsMemoize:b})};return Object.assign(a,{withTypes:()=>a}),a}var Oz=Tw(Rw),_z=Object.assign((t,o=Oz)=>{gz(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const r=Object.keys(t),a=r.map(c=>t[c]);return o(a,(...c)=>c.reduce((f,d,m)=>(f[r[m]]=d,f),{}))},{withTypes:()=>_z});Tw({memoize:Rz,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const _e=(t,o,r,a,l,c,...f)=>{if(f.length>0)throw new Error(tn(1));let d;if(t)d=t;else throw new Error("Missing arguments");return d};var Cw=KS();const ip=[];let lp;function Az(){return lp}function Dz(t){ip.push(t)}function Wp(t){const o=(r,a)=>{const l=Wt(kz).current;let c;try{lp=l;for(const f of ip)f.before(l);c=t(r,a);for(const f of ip)f.after(l);l.didInitialize=!0}finally{lp=void 0}return c};return o.displayName=t.displayName||t.name,o}function Mw(t){return R.forwardRef(Wp(t))}function kz(){return{didInitialize:!1}}const zz=kp(19),Nz=zz?jz:Pz;function Ow(t,o,r,a,l){return Nz(t,o,r,a,l)}function Lz(t,o,r,a,l){const c=R.useCallback(()=>o(t.getSnapshot(),r,a,l),[t,o,r,a,l]);return Cw.useSyncExternalStore(t.subscribe,c,c)}Dz({before(t){t.syncIndex=0,t.didInitialize||(t.syncTick=1,t.syncHooks=[],t.didChangeStore=!0,t.getSnapshot=()=>{let o=!1;for(let r=0;r<t.syncHooks.length;r+=1){const a=t.syncHooks[r],l=a.selector(a.store.state,a.a1,a.a2,a.a3);(a.didChange||!Object.is(a.value,l))&&(o=!0,a.value=l,a.didChange=!1)}return o&&(t.syncTick+=1),t.syncTick})},after(t){t.syncHooks.length>0&&(t.didChangeStore&&(t.didChangeStore=!1,t.subscribe=o=>{const r=new Set;for(const l of t.syncHooks)r.add(l.store);const a=[];for(const l of r)a.push(l.subscribe(o));return()=>{for(const l of a)l()}}),Cw.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot))}});function jz(t,o,r,a,l){const c=Az();if(!c)return Lz(t,o,r,a,l);const f=c.syncIndex;c.syncIndex+=1;let d;return c.didInitialize?(d=c.syncHooks[f],(d.store!==t||d.selector!==o||!Object.is(d.a1,r)||!Object.is(d.a2,a)||!Object.is(d.a3,l))&&(d.store!==t&&(c.didChangeStore=!0),d.store=t,d.selector=o,d.a1=r,d.a2=a,d.a3=l,d.didChange=!0)):(d={store:t,selector:o,a1:r,a2:a,a3:l,value:o(t.getSnapshot(),r,a,l),didChange:!1},c.syncHooks.push(d)),d.value}function Pz(t,o,r,a,l){return QS.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getSnapshot,c=>o(c,r,a,l))}class Uz{constructor(o){this.state=o,this.listeners=new Set,this.updateTick=0}subscribe=o=>(this.listeners.add(o),()=>{this.listeners.delete(o)});getSnapshot=()=>this.state;setState(o){if(this.state===o)return;this.state=o,this.updateTick+=1;const r=this.updateTick;for(const a of this.listeners){if(r!==this.updateTick)return;a(o)}}update(o){for(const r in o)if(!Object.is(this.state[r],o[r])){this.setState({...this.state,...o});return}}set(o,r){Object.is(this.state[o],r)||this.setState({...this.state,[o]:r})}notifyAll(){const o={...this.state};this.setState(o)}use(o,r,a,l){return Ow(this,o,r,a,l)}}class qu extends Uz{constructor(o,r={},a){super(o),this.context=r,this.selectors=a}useSyncedValue(o,r){R.useDebugValue(o),Ae(()=>{this.state[o]!==r&&this.set(o,r)},[o,r])}useSyncedValueWithCleanup(o,r){const a=this;Ae(()=>(a.state[o]!==r&&a.set(o,r),()=>{a.set(o,void 0)}),[a,o,r])}useSyncedValues(o){const r=this,a=Object.values(o);Ae(()=>{r.update(o)},[r,...a])}useControlledProp(o,r){R.useDebugValue(o);const a=r!==void 0;Ae(()=>{a&&!Object.is(this.state[o],r)&&super.setState({...this.state,[o]:r})},[o,r,a])}select(o,r,a,l){const c=this.selectors[o];return c(this.state,r,a,l)}useState(o,r,a,l){return R.useDebugValue(o),Ow(this,this.selectors[o],r,a,l)}useContextCallback(o,r){R.useDebugValue(o);const a=Ce(r??fx);this.context[o]=a}useStateSetter(o){const r=R.useRef(void 0);return r.current===void 0&&(r.current=a=>{this.set(o,a)}),r.current}observe(o,r){let a;typeof o=="function"?a=o:a=this.selectors[o];let l=a(this.state);return r(l,l,this),this.subscribe(c=>{const f=a(c);if(!Object.is(l,f)){const d=l;l=f,r(f,d,this)}})}}const Bz={open:_e(t=>t.open),domReferenceElement:_e(t=>t.domReferenceElement),referenceElement:_e(t=>t.positionReference??t.referenceElement),floatingElement:_e(t=>t.floatingElement),floatingId:_e(t=>t.floatingId)};class em extends qu{constructor(o){const{nested:r,noEmit:a,onOpenChange:l,triggerElements:c,...f}=o;super({...f,positionReference:f.referenceElement,domReferenceElement:f.referenceElement},{onOpenChange:l,dataRef:{current:{}},events:ow(),nested:r,noEmit:a,triggerElements:c},Bz)}setOpen=(o,r)=>{if((!o||!this.state.open||Vx(r.event))&&(this.context.dataRef.current.openEvent=o?r.event:void 0),!this.context.noEmit){const a={open:o,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",a)}this.context.onOpenChange?.(o,r)}}function _w(t,o){const r=R.useRef(null),a=R.useRef(null);return R.useCallback(l=>{if(t!==void 0){if(r.current!==null){const c=r.current,f=a.current,d=o.context.triggerElements.getById(c);f&&d===f&&o.context.triggerElements.delete(c),r.current=null,a.current=null}l!==null&&(r.current=t,a.current=l,o.context.triggerElements.add(t,l))}},[o,t])}function Aw(t,o,r,a){const l=r.useState("isMountedByTrigger",t),c=_w(t,r),f=Ce(d=>{if(c(d),!d||!r.select("open"))return;const m=r.select("activeTriggerId");if(m===t){r.update({activeTriggerElement:d,...a});return}m==null&&r.update({activeTriggerId:t,activeTriggerElement:d,...a})});return Ae(()=>{l&&r.update({activeTriggerElement:o.current,...a})},[l,r,o,...Object.values(a)]),{registerTrigger:f,isMountedByThisTrigger:l}}function tm(t){const o=t.useState("open");Ae(()=>{if(o&&!t.select("activeTriggerId")&&t.context.triggerElements.size===1){const r=t.context.triggerElements.entries().next();if(!r.done){const[a,l]=r.value;t.update({activeTriggerId:a,activeTriggerElement:l})}}},[o,t])}function nm(t,o,r){const{mounted:a,setMounted:l,transitionStatus:c}=ZD(t);o.useSyncedValues({mounted:a,transitionStatus:c});const f=Ce(()=>{l(!1),o.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),r?.(),o.context.onOpenChangeComplete?.(!1)}),d=o.useState("preventUnmountingOnClose");return Iu({enabled:!d,open:t,ref:o.context.popupRef,onComplete(){t||f()}}),{forceUnmount:f,transitionStatus:c}}class tl{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(o,r){const a=this.idMap.get(o);a!==r&&(a!==void 0&&this.elementsSet.delete(a),this.elementsSet.add(r),this.idMap.set(o,r))}delete(o){const r=this.idMap.get(o);r&&(this.elementsSet.delete(r),this.idMap.delete(o))}hasElement(o){return this.elementsSet.has(o)}hasMatchingElement(o){for(const r of this.elementsSet)if(o(r))return!0;return!1}getById(o){return this.idMap.get(o)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function Iz(){return new em({open:!1,floatingElement:null,referenceElement:null,triggerElements:new tl,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function om(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:Iz(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:qt,inactiveTriggerProps:qt,popupProps:qt}}const jc=_e(t=>t.triggerIdProp??t.activeTriggerId),rm={open:_e(t=>t.openProp??t.open),mounted:_e(t=>t.mounted),transitionStatus:_e(t=>t.transitionStatus),floatingRootContext:_e(t=>t.floatingRootContext),preventUnmountingOnClose:_e(t=>t.preventUnmountingOnClose),payload:_e(t=>t.payload),activeTriggerId:jc,activeTriggerElement:_e(t=>t.mounted?t.activeTriggerElement:null),isTriggerActive:_e((t,o)=>o!==void 0&&jc(t)===o),isOpenedByTrigger:_e((t,o)=>o!==void 0&&jc(t)===o&&t.open),isMountedByTrigger:_e((t,o)=>o!==void 0&&jc(t)===o&&t.mounted),triggerProps:_e((t,o)=>o?t.activeTriggerProps:t.inactiveTriggerProps),popupProps:_e(t=>t.popupProps),popupElement:_e(t=>t.popupElement),positionerElement:_e(t=>t.positionerElement)};function Hz(t){const{open:o=!1,onOpenChange:r,elements:a={}}=t,l=Ss(),c=Vo()!=null,f=Wt(()=>new em({open:o,onOpenChange:r,referenceElement:a.reference??null,floatingElement:a.floating??null,triggerElements:new tl,floatingId:l,nested:c,noEmit:!1})).current;return Ae(()=>{const d={open:o,floatingId:l};a.reference!==void 0&&(d.referenceElement=a.reference,d.domReferenceElement=st(a.reference)?a.reference:null),a.floating!==void 0&&(d.floatingElement=a.floating),f.update(d)},[o,l,a.reference,a.floating,f]),f.context.onOpenChange=r,f.context.nested=c,f.context.noEmit=!1,f}function Vz(t={}){const{nodeId:o,externalTree:r}=t,a=Hz(t),l=t.rootContext||a,c={reference:l.useState("referenceElement"),floating:l.useState("floatingElement"),domReference:l.useState("domReferenceElement")},[f,d]=R.useState(null),m=R.useRef(null),p=Pr(r);Ae(()=>{c.domReference&&(m.current=c.domReference)},[c.domReference]);const y=az({...t,elements:{...c,...f&&{reference:f}}}),g=R.useCallback(j=>{const D=st(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),getClientRects:()=>j.getClientRects(),contextElement:j}:j;d(D),y.refs.setReference(D)},[y.refs]),[v,b]=R.useState(null),[x,w]=R.useState(null);l.useSyncedValue("referenceElement",v),l.useSyncedValue("domReferenceElement",st(v)?v:null),l.useSyncedValue("floatingElement",x);const E=R.useCallback(j=>{(st(j)||j===null)&&(m.current=j,b(j)),(st(y.refs.reference.current)||y.refs.reference.current===null||j!==null&&!st(j))&&y.refs.setReference(j)},[y.refs,b]),C=R.useCallback(j=>{w(j),y.refs.setFloating(j)},[y.refs]),_=R.useMemo(()=>({...y.refs,setReference:E,setFloating:C,setPositionReference:g,domReference:m}),[y.refs,E,C,g]),k=R.useMemo(()=>({...y.elements,domReference:c.domReference}),[y.elements,c.domReference]),O=l.useState("open"),z=l.useState("floatingId"),N=R.useMemo(()=>({...y,dataRef:l.context.dataRef,open:O,onOpenChange:l.setOpen,events:l.context.events,floatingId:z,refs:_,elements:k,nodeId:o,rootStore:l}),[y,_,k,o,l,O,z]);return Ae(()=>{l.context.dataRef.current.floatingContext=N;const j=p?.nodesRef.current.find(D=>D.id===o);j&&(j.context=N)}),R.useMemo(()=>({...y,context:N,refs:_,elements:k,rootStore:l}),[y,_,k,N,l])}function sm(t){const{popupStore:o,noEmit:r=!1,treatPopupAsFloatingElement:a=!1,onOpenChange:l}=t,c=Ss(),f=Vo()!=null,d=o.useState("open"),m=o.useState("activeTriggerElement"),p=o.useState(a?"popupElement":"positionerElement"),y=o.context.triggerElements,g=Wt(()=>new em({open:d,referenceElement:m,floatingElement:p,triggerElements:y,onOpenChange:l,floatingId:c,nested:f,noEmit:r})).current;return Ae(()=>{const v={open:d,floatingId:c,referenceElement:m,floatingElement:p};st(m)&&(v.domReferenceElement=m),g.state.positionReference===g.state.referenceElement&&(v.positionReference=m),g.update(v)},[d,c,m,p,g]),g.context.onOpenChange=l,g.context.nested=f,g.context.noEmit=r,g}const Nh=aD&&Lx;function Dw(t,o={}){const r="rootStore"in t?t.rootStore:t,{events:a,dataRef:l}=r.context,{enabled:c=!0,delay:f}=o,d=R.useRef(!1),m=R.useRef(null),p=qn(),y=R.useRef(!0);R.useEffect(()=>{const v=r.select("domReferenceElement");if(!c)return;const b=zt(v);function x(){const C=r.select("domReferenceElement");!r.select("open")&&St(C)&&C===Zn(at(C))&&(d.current=!0)}function w(){y.current=!0}function E(){y.current=!1}return b.addEventListener("blur",x),Nh&&(b.addEventListener("keydown",w,!0),b.addEventListener("pointerdown",E,!0)),()=>{b.removeEventListener("blur",x),Nh&&(b.removeEventListener("keydown",w,!0),b.removeEventListener("pointerdown",E,!0))}},[r,c]),R.useEffect(()=>{if(!c)return;function v(b){if(b.reason===Aa||b.reason===Hu){const x=r.select("domReferenceElement");st(x)&&(m.current=x,d.current=!0)}}return a.on("openchange",v),()=>{a.off("openchange",v)}},[a,c,r]);const g=R.useMemo(()=>({onMouseLeave(){d.current=!1,m.current=null},onFocus(v){const b=v.currentTarget;if(d.current){if(m.current===b)return;d.current=!1,m.current=null}const x=rn(v.nativeEvent);if(st(x)){if(Nh&&!v.relatedTarget){if(!y.current&&!Uu(x))return}else if(!fD(x))return}const w=uu(v.relatedTarget,r.context.triggerElements),{nativeEvent:E,currentTarget:C}=v,_=typeof f=="function"?f():f;if(r.select("open")&&w||_===0||_===void 0){r.setOpen(!0,Qe(xa,E,C));return}p.start(_,()=>{d.current||r.setOpen(!0,Qe(xa,E,C))})},onBlur(v){d.current=!1,m.current=null;const b=v.relatedTarget,x=v.nativeEvent,w=st(b)&&b.hasAttribute(ka("focus-guard"))&&b.getAttribute("data-type")==="outside";p.start(0,()=>{const E=r.select("domReferenceElement"),C=Zn(E?E.ownerDocument:document);!b&&C===E||Ye(l.current.floatingContext?.refs.floating.current,C)||Ye(E,C)||w||uu(b??C,r.context.triggerElements)||r.setOpen(!1,Qe(xa,x))})}}),[l,r,p,f]);return R.useMemo(()=>c?{reference:g,trigger:g}:{},[c,g])}const cp=ka("safe-polygon"),qz=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Bx}`;function Yz(t){return t?!!t.closest(qz):!1}class am{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.unbindMouseMove=()=>{},this.restTimeoutPending=!1,this.openChangeTimeout=new co,this.restTimeout=new co,this.handleCloseOptions=void 0}static create(){return new am}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function kw(t){const o=Wt(am.create).current,r=t.context.dataRef.current;return r.hoverInteractionState||(r.hoverInteractionState=o),Bp(r.hoverInteractionState.disposeEffect),r.hoverInteractionState}const Gz=new Set(["click","mousedown"]);function zw(t,o={}){const r="rootStore"in t?t.rootStore:t,a=r.useState("open"),l=r.useState("floatingElement"),c=r.useState("domReferenceElement"),{dataRef:f}=r.context,{enabled:d=!0,closeDelay:m=0}=o,p=kw(r),y=Pr(),g=Vo(),v=Ce(()=>p.interactedInside?!0:f.current.openEvent?Gz.has(f.current.openEvent.type):!1),b=Ce(()=>{const k=f.current.openEvent?.type;return k?.includes("mouse")&&k!=="mousedown"}),x=Ce(k=>uu(k,r.context.triggerElements)),w=R.useCallback((k,O=!0)=>{const z=Fz(m,p.pointerType);z&&!p.handler?p.openChangeTimeout.start(z,()=>r.setOpen(!1,Qe(sn,k))):O&&(p.openChangeTimeout.clear(),r.setOpen(!1,Qe(sn,k)))},[m,r,p]),E=Ce(()=>{p.unbindMouseMove(),p.handler=void 0}),C=Ce(()=>{if(p.performedPointerEventsMutation){const k=at(l).body;k.style.pointerEvents="",k.removeAttribute(cp),p.performedPointerEventsMutation=!1}}),_=Ce(k=>{const O=rn(k);if(!Yz(O)){p.interactedInside=!1;return}p.interactedInside=!0});Ae(()=>{a||(p.pointerType=void 0,p.restTimeoutPending=!1,p.interactedInside=!1,E(),C())},[a,p,E,C]),R.useEffect(()=>()=>{E()},[E]),R.useEffect(()=>C,[C]),Ae(()=>{if(d&&a&&p.handleCloseOptions?.blockPointerEvents&&b()&&st(c)&&l){p.performedPointerEventsMutation=!0;const k=at(l).body;k.setAttribute(cp,"");const O=c,z=l,N=y?.nodesRef.current.find(j=>j.id===g)?.context?.elements.floating;return N&&(N.style.pointerEvents=""),k.style.pointerEvents="none",O.style.pointerEvents="auto",z.style.pointerEvents="auto",()=>{k.style.pointerEvents="",O.style.pointerEvents="",z.style.pointerEvents=""}}},[d,a,c,l,p,b,y,g]),R.useEffect(()=>{if(!d)return;function k(j){v()||!f.current.floatingContext||!r.select("open")||x(j.relatedTarget)||(C(),E(),v()||w(j))}function O(j){p.openChangeTimeout.clear(),C(),p.handler?.(j),E()}function z(j){v()||w(j,!1)}const N=l;return N&&(N.addEventListener("mouseleave",k),N.addEventListener("mouseenter",O),N.addEventListener("mouseleave",z),N.addEventListener("pointerdown",_,!0)),()=>{N&&(N.removeEventListener("mouseleave",k),N.removeEventListener("mouseenter",O),N.removeEventListener("mouseleave",z),N.removeEventListener("pointerdown",_,!0))}},[d,l,r,f,v,x,w,C,E,_,p])}function Fz(t,o){return o&&!ms(o)?0:typeof t=="function"?t():t}function Lh(t){return typeof t=="function"?t():t}const Xz={current:null};function im(t,o={}){const r="rootStore"in t?t.rootStore:t,{dataRef:a,events:l}=r.context,{enabled:c=!0,delay:f=0,handleClose:d=null,mouseOnly:m=!1,restMs:p=0,move:y=!0,triggerElementRef:g=Xz,externalTree:v,isActiveTrigger:b=!0}=o,x=Pr(v),w=kw(r),E=an(d),C=an(f),_=an(p),k=an(c);b&&(w.handleCloseOptions=E.current?.__options);const O=Ce(()=>w.interactedInside?!0:a.current.openEvent?["click","mousedown"].includes(a.current.openEvent.type):!1),z=Ce($=>uu($,r.context.triggerElements)),N=R.useCallback(($,Z=!0)=>{const V=Kc(C.current,"close",w.pointerType);V&&!w.handler?w.openChangeTimeout.start(V,()=>r.setOpen(!1,Qe(sn,$))):Z&&(w.openChangeTimeout.clear(),r.setOpen(!1,Qe(sn,$)))},[C,r,w]),j=Ce(()=>{w.unbindMouseMove(),w.handler=void 0}),D=Ce(()=>{if(w.performedPointerEventsMutation){const $=at(r.select("domReferenceElement")).body;$.style.pointerEvents="",$.removeAttribute(cp),w.performedPointerEventsMutation=!1}});R.useEffect(()=>{if(!c)return;function $(Z){Z.open||(w.openChangeTimeout.clear(),w.restTimeout.clear(),w.blockMouseMove=!0,w.restTimeoutPending=!1)}return l.on("openchange",$),()=>{l.off("openchange",$)}},[c,l,w]);const Y=Ce($=>{if(O()||!a.current.floatingContext||z($.relatedTarget))return;const Z=g.current;E.current?.({...a.current.floatingContext,tree:x,x:$.clientX,y:$.clientY,onClose(){D(),j(),!O()&&Z===r.select("domReferenceElement")&&N($)}})($)});return R.useEffect(()=>{if(!c)return;const $=g.current??(b?r.select("domReferenceElement"):null);if(!st($))return;function Z(ne){if(w.openChangeTimeout.clear(),w.blockMouseMove=!1,m&&!ms(w.pointerType)||Lh(_.current)>0&&!Kc(C.current,"open"))return;const ae=Kc(C.current,"open",w.pointerType),B=r.select("domReferenceElement"),H=r.context.triggerElements,G=(H.hasElement(ne.target)||H.hasMatchingElement(X=>Ye(X,ne.target)))&&(!B||!Ye(B,ne.target)),ce=ne.currentTarget??null,W=r.select("open"),P=!W||G;G&&W?r.setOpen(!0,Qe(sn,ne,ce)):ae?w.openChangeTimeout.start(ae,()=>{P&&r.setOpen(!0,Qe(sn,ne,ce))}):P&&r.setOpen(!0,Qe(sn,ne,ce))}function V(ne){if(O()){D();return}w.unbindMouseMove();const ae=r.select("domReferenceElement"),B=at(ae);if(w.restTimeout.clear(),w.restTimeoutPending=!1,z(ne.relatedTarget))return;if(E.current&&a.current.floatingContext){r.select("open")||w.openChangeTimeout.clear();const G=g.current;w.handler=E.current({...a.current.floatingContext,tree:x,x:ne.clientX,y:ne.clientY,onClose(){D(),j(),k.current&&!O()&&G===r.select("domReferenceElement")&&N(ne,!0)}});const ce=w.handler;ce(ne),B.addEventListener("mousemove",ce),w.unbindMouseMove=()=>{B.removeEventListener("mousemove",ce)};return}(w.pointerType!=="touch"||!Ye(r.select("floatingElement"),ne.relatedTarget))&&N(ne)}function J(ne){Y(ne)}return r.select("open")&&$.addEventListener("mouseleave",J),y&&$.addEventListener("mousemove",Z,{once:!0}),$.addEventListener("mouseenter",Z),$.addEventListener("mouseleave",V),()=>{$.removeEventListener("mouseleave",J),y&&$.removeEventListener("mousemove",Z),$.removeEventListener("mouseenter",Z),$.removeEventListener("mouseleave",V)}},[j,D,a,C,N,r,c,E,Y,w,b,O,z,m,y,_,g,x,k]),R.useMemo(()=>{if(!c)return;function $(Z){w.pointerType=Z.pointerType}return{onPointerDown:$,onPointerEnter:$,onMouseMove(Z){const{nativeEvent:V}=Z,J=Z.currentTarget,ne=r.select("domReferenceElement"),ae=r.context.triggerElements,B=r.select("open"),H=(ae.hasElement(Z.target)||ae.hasMatchingElement(ce=>Ye(ce,Z.target)))&&(!ne||!Ye(ne,Z.target));if(m&&!ms(w.pointerType)||B&&!H||Lh(_.current)===0||!H&&w.restTimeoutPending&&Z.movementX**2+Z.movementY**2<2)return;w.restTimeout.clear();function G(){if(w.restTimeoutPending=!1,O())return;const ce=r.select("open");!w.blockMouseMove&&(!ce||H)&&r.setOpen(!0,Qe(sn,V,J))}w.pointerType==="touch"?io.flushSync(()=>{G()}):H&&B?G():(w.restTimeoutPending=!0,w.restTimeout.start(Lh(_.current),G))}}},[c,w,O,m,r,_])}function nl(t=[]){const o=t.map(p=>p?.reference),r=t.map(p=>p?.floating),a=t.map(p=>p?.item),l=t.map(p=>p?.trigger),c=R.useCallback(p=>Pc(p,t,"reference"),o),f=R.useCallback(p=>Pc(p,t,"floating"),r),d=R.useCallback(p=>Pc(p,t,"item"),a),m=R.useCallback(p=>Pc(p,t,"trigger"),l);return R.useMemo(()=>({getReferenceProps:c,getFloatingProps:f,getItemProps:d,getTriggerProps:m}),[c,f,d,m])}function Pc(t,o,r){const a=new Map,l=r==="item",c={};r==="floating"&&(c.tabIndex=-1,c[tp]="");for(const f in t)l&&t&&(f===Px||f===Ux)||(c[f]=t[f]);for(let f=0;f<o.length;f+=1){let d;const m=o[f]?.[r];typeof m=="function"?d=t?m(t):null:d=m,d&&k0(c,d,l,a)}return k0(c,t,l,a),c}function k0(t,o,r,a){for(const l in o){const c=o[l];r&&(l===Px||l===Ux)||(l.startsWith("on")?(a.has(l)||a.set(l,[]),typeof c=="function"&&(a.get(l)?.push(c),t[l]=(...f)=>a.get(l)?.map(d=>d(...f)).find(d=>d!==void 0))):t[l]=c)}}const Kz="Escape";function Yu(t,o,r){switch(t){case"vertical":return o;case"horizontal":return r;default:return o||r}}function Uc(t,o){return Yu(o,t===Ip||t===Wi,t===Or||t===_r)}function jh(t,o,r){return Yu(o,t===Wi,r?t===Or:t===_r)||t==="Enter"||t===" "||t===""}function Qz(t,o,r){return Yu(o,r?t===Or:t===_r,t===Wi)}function Zz(t,o,r,a){const l=r?t===_r:t===Or,c=t===Ip;return o==="both"||o==="horizontal"&&a&&a>1?t===Kz:Yu(o,l,c)}function $z(t,o){const r="rootStore"in t?t.rootStore:t,a=r.useState("open"),l=r.useState("floatingElement"),c=r.useState("domReferenceElement"),f=r.context.dataRef,{listRef:d,activeIndex:m,onNavigate:p=()=>{},enabled:y=!0,selectedIndex:g=null,allowEscape:v=!1,loopFocus:b=!1,nested:x=!1,rtl:w=!1,virtual:E=!1,focusItemOnOpen:C="auto",focusItemOnHover:_=!0,openOnArrowKeyDown:k=!0,disabledIndices:O=void 0,orientation:z="vertical",parentOrientation:N,cols:j=1,id:D,resetOnPointerLeave:Y=!0,externalTree:$}=o,Z=fu(l),V=an(Z),J=Vo(),ne=Pr($);Ae(()=>{f.current.orientation=z},[f,z]);const ae=np(c),B=R.useRef(C),H=R.useRef(g??-1),G=R.useRef(null),ce=R.useRef(!0),W=Ce(de=>{p(H.current===-1?null:H.current,de)}),P=R.useRef(W),X=R.useRef(!!l),le=R.useRef(a),re=R.useRef(!1),ue=R.useRef(!1),he=an(O),ve=an(a),Me=an(g),fe=an(Y),ze=Ce(()=>{function de(qe){E?ne?.events.emit("virtualfocus",qe):Gi(qe,{sync:re.current,preventScroll:!0})}const we=d.current[H.current],ge=ue.current;we&&de(we),(re.current?qe=>qe():requestAnimationFrame)(()=>{const qe=d.current[H.current]||we;if(!qe)return;we||de(qe),te&&(ge||!ce.current)&&qe.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Ae(()=>{y&&(a&&l?(H.current=g??-1,B.current&&g!=null&&(ue.current=!0,W())):X.current&&(H.current=-1,P.current()))},[y,a,l,g,W]),Ae(()=>{if(y){if(!a){re.current=!1;return}if(l)if(m==null){if(re.current=!1,Me.current!=null)return;if(X.current&&(H.current=-1,ze()),(!le.current||!X.current)&&B.current&&(G.current!=null||B.current===!0&&G.current==null)){let de=0;const we=()=>{d.current[0]==null?(de<2&&(de?requestAnimationFrame:queueMicrotask)(we),de+=1):(H.current=G.current==null||jh(G.current,z,w)||x?_h(d):h0(d),G.current=null,W())};we()}}else qi(d,m)||(H.current=m,ze(),ue.current=!1)}},[y,a,l,m,Me,x,d,z,w,W,ze,he]),Ae(()=>{if(!y||l||!ne||E||!X.current)return;const de=ne.nodesRef.current,we=de.find(qe=>qe.id===J)?.context?.elements.floating,ge=Zn(at(l)),De=de.some(qe=>qe.context&&Ye(qe.context.elements.floating,ge));we&&!De&&ce.current&&we.focus({preventScroll:!0})},[y,l,ne,J,E]),Ae(()=>{P.current=W,le.current=a,X.current=!!l}),Ae(()=>{a||(G.current=null,B.current=C)},[a,C]);const je=m!=null,te=R.useMemo(()=>{function de(ge){if(!ve.current)return;const De=d.current.indexOf(ge.currentTarget);De!==-1&&H.current!==De&&(H.current=De,W(ge))}return{onFocus(ge){re.current=!0,de(ge)},onClick:({currentTarget:ge})=>ge.focus({preventScroll:!0}),onMouseMove(ge){re.current=!0,ue.current=!1,_&&de(ge)},onPointerLeave(ge){if(!ve.current||!ce.current||ge.pointerType==="touch")return;re.current=!0;const De=ge.relatedTarget;!_||d.current.includes(De)||fe.current&&(Gi(null,{sync:!0}),H.current=-1,W(ge),E||V.current?.focus({preventScroll:!0}))}}},[ve,V,_,d,W,fe,E]),me=R.useCallback(()=>N??ne?.nodesRef.current.find(de=>de.id===J)?.context?.dataRef?.current.orientation,[J,ne,N]),pe=Ce(de=>{if(ce.current=!1,re.current=!0,de.which===229||!ve.current&&de.currentTarget===V.current)return;if(x&&Zz(de.key,z,w,j)){Uc(de.key,me())||Jt(de),r.setOpen(!1,Qe(Fc,de.nativeEvent)),St(c)&&(E?ne?.events.emit("virtualfocus",c):c.focus());return}const we=H.current,ge=_h(d,O),De=h0(d,O);if(ae||(de.key==="Home"&&(Jt(de),H.current=ge,W(de)),de.key==="End"&&(Jt(de),H.current=De,W(de))),j>1){const qe=Array.from({length:d.current.length},()=>({width:1,height:1})),Be=TD(qe,j),Ot=Be.findIndex(Pe=>Pe!=null&&!Yi(d,Pe,O)),He=Be.reduce((Pe,Et,Qt)=>Et!=null&&!Yi(d,Et,O)?Qt:Pe,-1),Je=Be[RD({current:Be.map(Pe=>Pe!=null?d.current[Pe]:null)},{event:de,orientation:z,loopFocus:b,rtl:w,cols:j,disabledIndices:MD([...(typeof O!="function"?O:null)||d.current.map((Pe,Et)=>Yi(d,Et,O)?Et:void 0),void 0],Be),minIndex:Ot,maxIndex:He,prevIndex:CD(H.current>De?ge:H.current,qe,Be,j,de.key===Wi?"bl":de.key===(w?Or:_r)?"tr":"tl"),stopEvent:!0})];if(Je!=null&&(H.current=Je,W(de)),z==="both")return}if(Uc(de.key,z)){if(Jt(de),a&&!E&&Zn(de.currentTarget.ownerDocument)===de.currentTarget){H.current=jh(de.key,z,w)?ge:De,W(de);return}jh(de.key,z,w)?b?we>=De?v&&we!==d.current.length?H.current=-1:(re.current=!1,H.current=ge):H.current=$t(d,{startingIndex:we,disabledIndices:O}):H.current=Math.min(De,$t(d,{startingIndex:we,disabledIndices:O})):b?we<=ge?v&&we!==-1?H.current=d.current.length:(re.current=!1,H.current=De):H.current=$t(d,{startingIndex:we,decrement:!0,disabledIndices:O}):H.current=Math.max(ge,$t(d,{startingIndex:we,decrement:!0,disabledIndices:O})),qi(d,H.current)&&(H.current=-1),W(de)}}),Ne=R.useMemo(()=>E&&a&&je&&{"aria-activedescendant":`${D}-${m}`},[E,a,je,D,m]),be=R.useMemo(()=>({"aria-orientation":z==="both"?void 0:z,...ae?{}:Ne,onKeyDown(de){if(de.key==="Tab"&&de.shiftKey&&a&&!E){const we=rn(de.nativeEvent);if(we&&!Ye(V.current,we))return;Jt(de),r.setOpen(!1,Qe(Da,de.nativeEvent)),St(c)&&c.focus();return}pe(de)},onPointerMove(){ce.current=!0}}),[Ne,pe,V,z,ae,r,a,E,c]),Se=R.useMemo(()=>{function de(ge){C==="auto"&&Ix(ge.nativeEvent)&&(B.current=!E)}function we(ge){B.current=C,C==="auto"&&Hx(ge.nativeEvent)&&(B.current=!0)}return{onKeyDown(ge){const De=r.select("open");ce.current=!1;const qe=ge.key.startsWith("Arrow"),Be=Qz(ge.key,me(),w),Ot=Uc(ge.key,z),He=(x?Be:Ot)||ge.key==="Enter"||ge.key.trim()==="";if(E&&De)return pe(ge);if(!(!De&&!k&&qe)){if(He){const Je=Uc(ge.key,me());G.current=x&&Je?null:ge.key}if(x){Be&&(Jt(ge),De?(H.current=_h(d,he.current),W(ge)):r.setOpen(!0,Qe(Fc,ge.nativeEvent,ge.currentTarget)));return}Ot&&(Me.current!=null&&(H.current=Me.current),Jt(ge),!De&&k?r.setOpen(!0,Qe(Fc,ge.nativeEvent,ge.currentTarget)):pe(ge),De&&W(ge))}},onFocus(ge){r.select("open")&&!E&&(H.current=-1,W(ge))},onPointerDown:we,onPointerEnter:we,onMouseDown:de,onClick:de}},[pe,he,C,d,x,W,r,k,z,me,w,Me,E]),ye=R.useMemo(()=>({...Ne,...Se}),[Ne,Se]);return R.useMemo(()=>y?{reference:ye,floating:be,item:te,trigger:Se}:{},[y,ye,be,Se,te])}const Jz=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Nw(t,o={}){const r="rootStore"in t?t.rootStore:t,a=r.useState("open"),l=r.useState("floatingId"),c=r.useState("domReferenceElement"),f=r.useState("floatingElement"),{role:d="dialog"}=o,m=Ss(),p=c?.id||m,y=R.useMemo(()=>fu(f)?.id||l,[f,l]),g=Jz.get(d)??d,b=Vo()!=null,x=R.useMemo(()=>g==="tooltip"||d==="label"?qt:{"aria-haspopup":g==="alertdialog"?"dialog":g,"aria-expanded":"false",...g==="listbox"&&{role:"combobox"},...g==="menu"&&b&&{role:"menuitem"},...d==="select"&&{"aria-autocomplete":"none"},...d==="combobox"&&{"aria-autocomplete":"list"}},[g,b,d]),w=R.useMemo(()=>g==="tooltip"||d==="label"?{[`aria-${d==="label"?"labelledby":"describedby"}`]:a?y:void 0}:{...x,"aria-expanded":a?"true":"false","aria-controls":a?y:void 0,...g==="menu"&&{id:p}},[g,y,a,p,d,x]),E=R.useMemo(()=>{const _={id:y,...g&&{role:g}};return g==="tooltip"||d==="label"?_:{..._,...g==="menu"&&{"aria-labelledby":p}}},[g,y,p,d]),C=R.useCallback(({active:_,selected:k})=>{const O={role:"option",..._&&{id:`${y}-fui-option`}};switch(d){case"select":case"combobox":return{...O,"aria-selected":k}}return{}},[y,d]);return R.useMemo(()=>({reference:w,floating:E,item:C,trigger:x}),[w,E,x,C])}function Wz(t,o){const r="rootStore"in t?t.rootStore:t,a=r.context.dataRef,l=r.useState("open"),{listRef:c,activeIndex:f,onMatch:d,onTypingChange:m,enabled:p=!0,resetMs:y=750,selectedIndex:g=null}=o,v=qn(),b=R.useRef(""),x=R.useRef(g??f??-1),w=R.useRef(null);Ae(()=>{!l&&g!==null||(v.clear(),w.current=null,b.current!==""&&(b.current=""))},[l,g,v]),Ae(()=>{l&&b.current===""&&(x.current=g??f??-1)},[l,g,f]);const E=Ce(z=>{z?a.current.typing||(a.current.typing=z,m?.(z)):a.current.typing&&(a.current.typing=z,m?.(z))}),C=Ce(z=>{function N(V,J,ne){const ae=J.find(B=>B?.toLocaleLowerCase().indexOf(ne.toLocaleLowerCase())===0);return ae?V.indexOf(ae):-1}const j=c.current;if(b.current.length>0&&b.current[0]!==" "&&(N(j,j,b.current)===-1?E(!1):z.key===" "&&Jt(z)),j==null||z.key.length!==1||z.ctrlKey||z.metaKey||z.altKey)return;l&&z.key!==" "&&(Jt(z),E(!0));const D=b.current==="";D&&(x.current=g??f??-1),j.every(V=>V?V[0]?.toLocaleLowerCase()!==V[1]?.toLocaleLowerCase():!0)&&b.current===z.key&&(b.current="",x.current=w.current),b.current+=z.key,v.start(y,()=>{b.current="",x.current=w.current,E(!1)});const $=D?g??f??-1:x.current,Z=N(j,[...j.slice(($||0)+1),...j.slice(0,($||0)+1)],b.current);Z!==-1?(d?.(Z),w.current=Z):z.key!==" "&&(b.current="",E(!1))}),_=Ce(z=>{const N=z.relatedTarget,j=r.select("domReferenceElement"),D=r.select("floatingElement"),Y=Ye(j,N),$=Ye(D,N);Y||$||(v.clear(),b.current="",x.current=w.current,E(!1))}),k=R.useMemo(()=>({onKeyDown:C,onBlur:_}),[C,_]),O=R.useMemo(()=>({onKeyDown:C,onKeyUp(z){z.key===" "&&E(!1)},onBlur:_}),[C,_,E]);return R.useMemo(()=>p?{reference:k,floating:O}:{},[p,k,O])}function z0(t,o){const[r,a]=t;let l=!1;const c=o.length;for(let f=0,d=c-1;f<c;d=f++){const[m,p]=o[f]||[0,0],[y,g]=o[d]||[0,0];p>=a!=g>=a&&r<=(y-m)*(a-p)/(g-p)+m&&(l=!l)}return l}function eN(t,o){return t[0]>=o.x&&t[0]<=o.x+o.width&&t[1]>=o.y&&t[1]<=o.y+o.height}function lm(t={}){const{buffer:o=.5,blockPointerEvents:r=!1,requireIntent:a=!0}=t,l=new co;let c=!1,f=null,d=null,m=typeof performance<"u"?performance.now():0;function p(g,v){const b=performance.now(),x=b-m;if(f===null||d===null||x===0)return f=g,d=v,m=b,null;const w=g-f,E=v-d,_=Math.sqrt(w*w+E*E)/x;return f=g,d=v,m=b,_}const y=({x:g,y:v,placement:b,elements:x,onClose:w,nodeId:E,tree:C})=>function(k){function O(){l.clear(),w()}if(l.clear(),!x.domReference||!x.floating||b==null||g==null||v==null)return;const{clientX:z,clientY:N}=k,j=[z,N],D=rn(k),Y=k.type==="mouseleave",$=Ye(x.floating,D),Z=Ye(x.domReference,D),V=x.domReference.getBoundingClientRect(),J=x.floating.getBoundingClientRect(),ne=b.split("-")[0],ae=g>J.right-J.width/2,B=v>J.bottom-J.height/2,H=eN(j,V),G=J.width>V.width,ce=J.height>V.height,W=(G?V:J).left,P=(G?V:J).right,X=(ce?V:J).top,le=(ce?V:J).bottom;if($&&(c=!0,!Y))return;if(Z&&(c=!1),Z&&!Y){c=!0;return}if(Y&&st(k.relatedTarget)&&Ye(x.floating,k.relatedTarget)||C&&us(C.nodesRef.current,E).some(({context:he})=>he?.open))return;if(ne==="top"&&v>=V.bottom-1||ne==="bottom"&&v<=V.top+1||ne==="left"&&g>=V.right-1||ne==="right"&&g<=V.left+1)return O();let re=[];switch(ne){case"top":re=[[W,V.top+1],[W,J.bottom-1],[P,J.bottom-1],[P,V.top+1]];break;case"bottom":re=[[W,J.top+1],[W,V.bottom-1],[P,V.bottom-1],[P,J.top+1]];break;case"left":re=[[J.right-1,le],[J.right-1,X],[V.left+1,X],[V.left+1,le]];break;case"right":re=[[V.right-1,le],[V.right-1,X],[J.left+1,X],[J.left+1,le]];break}function ue([he,ve]){switch(ne){case"top":{const Me=[G?he+o/2:ae?he+o*4:he-o*4,ve+o+1],fe=[G?he-o/2:ae?he+o*4:he-o*4,ve+o+1],ze=[[J.left,ae||G?J.bottom-o:J.top],[J.right,ae?G?J.bottom-o:J.top:J.bottom-o]];return[Me,fe,...ze]}case"bottom":{const Me=[G?he+o/2:ae?he+o*4:he-o*4,ve-o],fe=[G?he-o/2:ae?he+o*4:he-o*4,ve-o],ze=[[J.left,ae||G?J.top+o:J.bottom],[J.right,ae?G?J.top+o:J.bottom:J.top+o]];return[Me,fe,...ze]}case"left":{const Me=[he+o+1,ce?ve+o/2:B?ve+o*4:ve-o*4],fe=[he+o+1,ce?ve-o/2:B?ve+o*4:ve-o*4];return[...[[B||ce?J.right-o:J.left,J.top],[B?ce?J.right-o:J.left:J.right-o,J.bottom]],Me,fe]}case"right":{const Me=[he-o,ce?ve+o/2:B?ve+o*4:ve-o*4],fe=[he-o,ce?ve-o/2:B?ve+o*4:ve-o*4],ze=[[B||ce?J.left+o:J.right,J.top],[B?ce?J.left+o:J.right:J.left+o,J.bottom]];return[Me,fe,...ze]}default:return[]}}if(!z0([z,N],re)){if(c&&!H)return O();if(!Y&&a){const he=p(k.clientX,k.clientY);if(he!==null&&he<.1)return O()}z0([z,N],ue([g,v]))?!c&&a&&l.start(40,O):O()}};return y.__options={blockPointerEvents:r},y}let tN=(function(t){return t.nestedDialogs="--nested-dialogs",t})({}),nN=(function(t){return t[t.open=is.open]="open",t[t.closed=is.closed]="closed",t[t.startingStyle=is.startingStyle]="startingStyle",t[t.endingStyle=is.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const Lw=R.createContext(void 0);function oN(){const t=R.useContext(Lw);if(t===void 0)throw new Error(tn(26));return t}const jw="ArrowUp",Pw="ArrowDown",Uw="ArrowLeft",Bw="ArrowRight",Iw="Home",Hw="End",rN=new Set([Uw,Bw]),sN=new Set([jw,Pw]),aN=new Set([...rN,...sN]);[...aN];const Vw=new Set([jw,Pw,Uw,Bw,Iw,Hw]),iN={...Es,...Bu,nestedDialogOpen(t){return t?{[nN.nestedDialogOpen]:""}:null}},lN=R.forwardRef(function(o,r){const{className:a,finalFocus:l,initialFocus:c,render:f,...d}=o,{store:m}=ws(),p=m.useState("descriptionElementId"),y=m.useState("disablePointerDismissal"),g=m.useState("floatingRootContext"),v=m.useState("popupProps"),b=m.useState("modal"),x=m.useState("mounted"),w=m.useState("nested"),E=m.useState("nestedOpenDialogCount"),C=m.useState("open"),_=m.useState("openMethod"),k=m.useState("titleElementId"),O=m.useState("transitionStatus"),z=m.useState("role");oN(),Iu({open:C,ref:m.context.popupRef,onComplete(){C&&m.context.onOpenChangeComplete?.(!0)}});function N(Z){return Z==="touch"?m.context.popupRef.current:!0}const j=c===void 0?N:c,D=E>0,$=Mt("div",o,{state:{open:C,nested:w,transitionStatus:O,nestedDialogOpen:D},props:[v,{"aria-labelledby":k??void 0,"aria-describedby":p??void 0,role:z,tabIndex:-1,hidden:!x,onKeyDown(Z){Vw.has(Z.key)&&Z.stopPropagation()},style:{[tN.nestedDialogs]:E}},d],ref:[r,m.context.popupRef,m.useStateSetter("popupElement")],stateAttributesMapping:iN});return L.jsx(pw,{context:g,openInteractionType:_,disabled:!x,closeOnFocusOut:!y,initialFocus:j,returnFocus:l,modal:b!==!1,restoreFocus:"popup",children:$})});function qw(t){return kp(19)?t:t?"true":void 0}const Yw=R.forwardRef(function(o,r){const{cutout:a,...l}=o;let c;if(a){const f=a?.getBoundingClientRect();c=`polygon(
19
19
  0% 0%,
20
20
  100% 0%,
21
21
  100% 100%,
@@ -26,6 +26,6 @@ Error generating stack: `+i.message+`
26
26
  ${f.right}px ${f.bottom}px,
27
27
  ${f.right}px ${f.top}px,
28
28
  ${f.left}px ${f.top}px
29
- )`}return L.jsx("div",{ref:r,role:"presentation","data-base-ui-inert":"",...l,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})}),lN=R.forwardRef(function(o,r){const{keepMounted:a=!1,...l}=o,{store:c}=ws(),f=c.useState("mounted"),d=c.useState("modal"),m=c.useState("open");return f||a?L.jsx(Lw.Provider,{value:a,children:L.jsxs(hw,{ref:r,...l,children:[f&&d===!0&&L.jsx(Yw,{ref:c.context.internalBackdropRef,inert:qw(!m)}),o.children]})}):null});function cm(t){const o=R.useRef(!0);o.current&&(o.current=!1,t())}let N0={},L0={},j0="";function cN(t){if(typeof document>"u")return!1;const o=at(t);return zt(o).innerWidth-o.documentElement.clientWidth>0}function uN(t){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const r=at(t),a=r.documentElement,l=r.body,c=Nr(a)?a:l,f=c.style.overflowY,d=a.style.scrollbarGutter;a.style.scrollbarGutter="stable",c.style.overflowY="scroll";const m=c.offsetWidth;c.style.overflowY="hidden";const p=c.offsetWidth;return c.style.overflowY=f,a.style.scrollbarGutter=d,m===p}function fN(t){const o=at(t),r=o.documentElement,a=o.body,l=Nr(r)?r:a,c={overflowY:l.style.overflowY,overflowX:l.style.overflowX};return Object.assign(l.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(l.style,c)}}function dN(t){const o=at(t),r=o.documentElement,a=o.body,l=zt(r);let c=0,f=0,d=!1;const m=oo.create();if(zx&&(l.visualViewport?.scale??1)!==1)return()=>{};function p(){const v=l.getComputedStyle(r),b=l.getComputedStyle(a),E=(v.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=r.scrollTop,f=r.scrollLeft,N0={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},j0=r.style.scrollBehavior,L0={position:a.style.position,height:a.style.height,width:a.style.width,boxSizing:a.style.boxSizing,overflowY:a.style.overflowY,overflowX:a.style.overflowX,scrollBehavior:a.style.scrollBehavior};const C=r.scrollHeight>r.clientHeight,_=r.scrollWidth>r.clientWidth,k=v.overflowY==="scroll"||b.overflowY==="scroll",O=v.overflowX==="scroll"||b.overflowX==="scroll",z=Math.max(0,l.innerWidth-a.clientWidth),N=Math.max(0,l.innerHeight-a.clientHeight),j=parseFloat(b.marginTop)+parseFloat(b.marginBottom),D=parseFloat(b.marginLeft)+parseFloat(b.marginRight),Y=Nr(r)?r:a;if(d=uN(t),d){r.style.scrollbarGutter=E,Y.style.overflowY="hidden",Y.style.overflowX="hidden";return}Object.assign(r.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(C||k)&&(r.style.overflowY="scroll"),(_||O)&&(r.style.overflowX="scroll"),Object.assign(a.style,{position:"relative",height:j||N?`calc(100dvh - ${j+N}px)`:"100dvh",width:D||z?`calc(100vw - ${D+z}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),a.scrollTop=c,a.scrollLeft=f,r.setAttribute("data-base-ui-scroll-locked",""),r.style.scrollBehavior="unset"}function y(){Object.assign(r.style,N0),Object.assign(a.style,L0),d||(r.scrollTop=c,r.scrollLeft=f,r.removeAttribute("data-base-ui-scroll-locked"),r.style.scrollBehavior=j0)}function g(){y(),m.request(p)}return p(),l.addEventListener("resize",g),()=>{m.cancel(),y(),typeof l.removeEventListener=="function"&&l.removeEventListener("resize",g)}}class hN{lockCount=0;restore=null;timeoutLock=co.create();timeoutUnlock=co.create();acquire(o){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(o)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(o){if(this.lockCount===0||this.restore!==null)return;const a=at(o).documentElement,l=zt(a).getComputedStyle(a).overflowY;if(l==="hidden"||l==="clip"){this.restore=fx;return}const c=Nx||!cN(o);this.restore=c?fN(o):dN(o)}}const pN=new hN;function Gw(t=!0,o=null){Ae(()=>{if(t)return pN.acquire(o)},[t,o])}function mN(t){const o=R.useRef(""),r=R.useCallback(l=>{l.defaultPrevented||(o.current=l.pointerType,t(l,l.pointerType))},[t]);return{onClick:R.useCallback(l=>{if(l.detail===0){t(l,"keyboard");return}"pointerType"in l?t(l,l.pointerType):t(l,o.current),o.current=""},[t]),onPointerDown:r}}function Fw(t){const[o,r]=R.useState(null),a=Ce((d,m)=>{t||r(m||(Nx?"touch":""))}),l=R.useCallback(()=>{r(null)},[]),{onClick:c,onPointerDown:f}=mN(a);return R.useMemo(()=>({openMethod:o,reset:l,triggerProps:{onClick:c,onPointerDown:f}}),[o,l,c,f])}function gN(t){const{store:o,parentContext:r,actionsRef:a}=t,l=o.useState("open"),c=o.useState("disablePointerDismissal"),f=o.useState("modal"),d=o.useState("popupElement"),{openMethod:m,triggerProps:p,reset:y}=Fw(l);tm(o);const{forceUnmount:g}=nm(l,o,()=>{y()}),v=Ce($=>{const Z=Qe($);return Z.preventUnmountOnClose=()=>{o.set("preventUnmountingOnClose",!0)},Z}),b=R.useCallback(()=>{o.setOpen(!1,v(Kp))},[o,v]);R.useImperativeHandle(a,()=>({unmount:g,close:b}),[g,b]);const x=sm({popupStore:o,onOpenChange:o.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[w,E]=R.useState(0),C=w===0,_=Nw(x),k=Jp(x,{outsidePressEvent(){return o.context.internalBackdropRef.current||o.context.backdropRef.current?"intentional":{mouse:f==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress($){if(!o.context.outsidePressEnabledRef.current||"button"in $&&$.button!==0||"touches"in $&&$.touches.length!==1)return!1;const Z=rn($);if(C&&!c){const V=Z;return f&&(o.context.internalBackdropRef.current||o.context.backdropRef.current)?o.context.internalBackdropRef.current===V||o.context.backdropRef.current===V||Ye(V,d)&&!V?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:C});Gw(l&&f===!0,d);const{getReferenceProps:O,getFloatingProps:z,getTriggerProps:N}=nl([_,k]);o.useContextCallback("onNestedDialogOpen",$=>{E($+1)}),o.useContextCallback("onNestedDialogClose",()=>{E(0)}),R.useEffect(()=>(r?.onNestedDialogOpen&&l&&r.onNestedDialogOpen(w),r?.onNestedDialogClose&&!l&&r.onNestedDialogClose(),()=>{r?.onNestedDialogClose&&l&&r.onNestedDialogClose()}),[l,r,w]);const j=R.useMemo(()=>O(p),[O,p]),D=R.useMemo(()=>N(p),[N,p]),Y=R.useMemo(()=>z(),[z]);o.useSyncedValues({openMethod:m,activeTriggerProps:j,inactiveTriggerProps:D,popupProps:Y,floatingRootContext:x,nestedOpenDialogCount:w})}const yN={...rm,modal:_e(t=>t.modal),nested:_e(t=>t.nested),nestedOpenDialogCount:_e(t=>t.nestedOpenDialogCount),disablePointerDismissal:_e(t=>t.disablePointerDismissal),openMethod:_e(t=>t.openMethod),descriptionElementId:_e(t=>t.descriptionElementId),titleElementId:_e(t=>t.titleElementId),viewportElement:_e(t=>t.viewportElement),role:_e(t=>t.role)};class vN extends qu{constructor(o){super(bN(o),{popupRef:R.createRef(),backdropRef:R.createRef(),internalBackdropRef:R.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new tl,onOpenChange:void 0,onOpenChangeComplete:void 0},yN)}setOpen=(o,r)=>{if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!o&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(o,r),r.isCanceled)return;const a={open:o,nativeEvent:r.event,reason:r.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",a);const l={open:o},c=r.trigger?.id??null;(c||o)&&(l.activeTriggerId=c,l.activeTriggerElement=r.trigger??null),this.update(l)}}function bN(t={}){return{...om(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...t}}function SN(t){const{children:o,open:r,defaultOpen:a=!1,onOpenChange:l,onOpenChangeComplete:c,disablePointerDismissal:f=!1,modal:d=!0,actionsRef:m,handle:p,triggerId:y,defaultTriggerId:g=null}=t,v=ws(!0),b=!!v,x=Wt(()=>p?.store??new vN({open:a,openProp:r,activeTriggerId:g,triggerIdProp:y,modal:d,disablePointerDismissal:f,nested:b})).current;cm(()=>{r===void 0&&x.state.open===!1&&a===!0&&x.update({open:!0,activeTriggerId:g})}),x.useControlledProp("openProp",r),x.useControlledProp("triggerIdProp",y),x.useSyncedValues({disablePointerDismissal:f,nested:b,modal:d}),x.useContextCallback("onOpenChange",l),x.useContextCallback("onOpenChangeComplete",c);const w=x.useState("payload");gN({store:x,actionsRef:m,parentContext:v?.store.context});const E=R.useMemo(()=>({store:x}),[x]);return L.jsx(tw.Provider,{value:E,children:typeof o=="function"?o({payload:w}):o})}const xN=R.forwardRef(function(o,r){const{render:a,className:l,id:c,...f}=o,{store:d}=ws(),m=xs(c);return d.useSyncedValueWithCleanup("titleElementId",m),Mt("h2",o,{ref:r,props:[{id:m},f]})});function wN({...t}){return L.jsx(SN,{"data-slot":"sheet",...t})}function EN({...t}){return L.jsx(lN,{"data-slot":"sheet-portal",...t})}function RN({className:t,...o}){return L.jsx(ak,{"data-slot":"sheet-overlay",className:ct("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",t),...o})}function TN({className:t,children:o,side:r="right",showCloseButton:a=!0,...l}){return L.jsxs(EN,{children:[L.jsx(RN,{}),L.jsxs(iN,{"data-slot":"sheet-content","data-side":r,className:ct("bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...l,children:[o,a&&L.jsxs(ik,{"data-slot":"sheet-close",render:L.jsx(Ax,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[L.jsx(CA,{}),L.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function CN({className:t,...o}){return L.jsx("div",{"data-slot":"sheet-header",className:ct("gap-0.5 p-4 flex flex-col",t),...o})}function MN({className:t,...o}){return L.jsx(xN,{"data-slot":"sheet-title",className:ct("text-foreground text-base font-medium",t),...o})}function ON({className:t,...o}){return L.jsx(lk,{"data-slot":"sheet-description",className:ct("text-muted-foreground text-sm",t),...o})}const Xw=R.createContext(void 0);function ol(t){const o=R.useContext(Xw);if(o===void 0&&!t)throw new Error(tn(72));return o}const _N={...rm,disabled:_e(t=>t.disabled),instantType:_e(t=>t.instantType),isInstantPhase:_e(t=>t.isInstantPhase),trackCursorAxis:_e(t=>t.trackCursorAxis),disableHoverablePopup:_e(t=>t.disableHoverablePopup),lastOpenChangeReason:_e(t=>t.openChangeReason),closeDelay:_e(t=>t.closeDelay),hasViewport:_e(t=>t.hasViewport)};class um extends qu{constructor(o){super({...AN(),...o},{popupRef:R.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new tl},_N)}setOpen=(o,r)=>{const a=r.reason,l=a===sn,c=o&&a===xa,f=!o&&(a===Aa||a===Hu);if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(o,r),r.isCanceled)return;const d=()=>{const m={open:o,openChangeReason:a};c?m.instantType="focus":f?m.instantType="dismiss":a===sn&&(m.instantType=void 0);const p=r.trigger?.id??null;(p||o)&&(m.activeTriggerId=p,m.activeTriggerElement=r.trigger??null),this.update(m)};l?io.flushSync(d):d()};static useStore(o,r){const a=Wt(()=>new um(r)).current,l=o??a,c=sm({popupStore:l,onOpenChange:l.setOpen});return l.state.floatingRootContext=c,l}}function AN(){return{...om(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0,hasViewport:!1}}const DN=Wp(function(o){const{disabled:r=!1,defaultOpen:a=!1,open:l,disableHoverablePopup:c=!1,trackCursorAxis:f="none",actionsRef:d,onOpenChange:m,onOpenChangeComplete:p,handle:y,triggerId:g,defaultTriggerId:v=null,children:b}=o,x=um.useStore(y?.store,{open:a,openProp:l,activeTriggerId:v,triggerIdProp:g});cm(()=>{l===void 0&&x.state.open===!1&&a===!0&&x.update({open:!0,activeTriggerId:v})}),x.useControlledProp("openProp",l),x.useControlledProp("triggerIdProp",g),x.useContextCallback("onOpenChange",m),x.useContextCallback("onOpenChangeComplete",p);const w=x.useState("open"),E=!r&&w,C=x.useState("activeTriggerId"),_=x.useState("payload");x.useSyncedValues({trackCursorAxis:f,disableHoverablePopup:c}),Ae(()=>{w&&r&&x.setOpen(!1,Qe(JD))},[w,r,x]),x.useSyncedValue("disabled",r),tm(x);const{forceUnmount:k,transitionStatus:O}=nm(E,x),z=x.useState("isInstantPhase"),N=x.useState("instantType"),j=x.useState("lastOpenChangeReason"),D=R.useRef(null);Ae(()=>{O==="ending"&&j===Fp||O!=="ending"&&z?(N!=="delay"&&(D.current=N),x.set("instantType","delay")):D.current!==null&&(x.set("instantType",D.current),D.current=null)},[O,z,j,N,x]),Ae(()=>{E&&C==null&&x.set("payload",void 0)},[x,C,E]);const Y=R.useCallback(()=>{x.setOpen(!1,kN(x,Kp))},[x]);R.useImperativeHandle(d,()=>({unmount:k,close:Y}),[k,Y]);const $=x.useState("floatingRootContext"),Z=Jp($,{enabled:!r,referencePress:!0}),V=Rk($,{enabled:!r&&f!=="none",axis:f==="none"?void 0:f}),{getReferenceProps:J,getFloatingProps:ne,getTriggerProps:ae}=nl([Z,V]),B=R.useMemo(()=>J(),[J]),H=R.useMemo(()=>ae(),[ae]),G=R.useMemo(()=>ne(),[ne]);return x.useSyncedValues({activeTriggerProps:B,inactiveTriggerProps:H,popupProps:G}),L.jsx(Xw.Provider,{value:x,children:typeof b=="function"?b({payload:_}):b})});function kN(t,o){const r=Qe(o);return r.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},r}const Kw=R.createContext(void 0);function zN(){return R.useContext(Kw)}let NN=(function(t){return t[t.popupOpen=bu.popupOpen]="popupOpen",t.triggerDisabled="data-trigger-disabled",t})({});const LN=600,jN=Mw(function(o,r){const{className:a,render:l,handle:c,payload:f,disabled:d,delay:m,closeDelay:p,id:y,...g}=o,v=ol(!0),b=c?.store??v;if(!b)throw new Error(tn(82));const x=xs(y),w=b.useState("isTriggerActive",x),E=b.useState("isOpenedByTrigger",x),C=b.useState("floatingRootContext"),_=R.useRef(null),k=m??LN,O=p??0,{registerTrigger:z,isMountedByThisTrigger:N}=Aw(x,_,b,{payload:f,closeDelay:O}),j=zN(),{delayRef:D,isInstantPhase:Y,hasProvider:$}=hk(C,{open:E});b.useSyncedValue("isInstantPhase",Y);const Z=b.useState("disabled"),V=d??Z,J=b.useState("trackCursorAxis"),ne=b.useState("disableHoverablePopup"),ae=im(C,{enabled:!V,mouseOnly:!0,move:!1,handleClose:!ne&&J!=="both"?lm():null,restMs(){const W=j?.delay,P=typeof D.current=="object"?D.current.open:void 0;let X=k;return $&&(P!==0?X=m??W??k:X=0),X},delay(){const W=typeof D.current=="object"?D.current.close:void 0;let P=O;return p==null&&$&&(P=W),{close:P}},triggerElementRef:_,isActiveTrigger:w}),B=Dw(C,{enabled:!V}).reference,H={open:E},G=b.useState("triggerProps",N);return Mt("button",o,{state:H,ref:[r,z,_],props:[ae,B,G,{id:x,[NN.triggerDisabled]:V?"":void 0},g],stateAttributesMapping:nw})}),Qw=R.createContext(void 0);function PN(){const t=R.useContext(Qw);if(t===void 0)throw new Error(tn(70));return t}const UN=R.forwardRef(function(o,r){const{children:a,container:l,className:c,render:f,...d}=o,{portalNode:m,portalSubtree:p}=dw({container:l,ref:r,componentProps:o,elementProps:d});return!p&&!m?null:L.jsxs(R.Fragment,{children:[p,m&&io.createPortal(a,m)]})}),BN=R.forwardRef(function(o,r){const{keepMounted:a=!1,...l}=o;return ol().useState("mounted")||a?L.jsx(Qw.Provider,{value:a,children:L.jsx(UN,{ref:r,...l})}):null}),Zw=R.createContext(void 0);function $w(){const t=R.useContext(Zw);if(t===void 0)throw new Error(tn(71));return t}const IN=R.createContext(void 0);function Jw(){return R.useContext(IN)?.direction??"ltr"}const HN=t=>({name:"arrow",options:t,async fn(o){const{x:r,y:a,placement:l,rects:c,platform:f,elements:d,middlewareData:m}=o,{element:p,padding:y=0,offsetParent:g="real"}=Uo(t,o)||{};if(p==null)return{};const v=qx(y),b={x:r,y:a},x=qp(l),w=Vp(x),E=await f.getDimensions(p),C=x==="y",_=C?"top":"left",k=C?"bottom":"right",O=C?"clientHeight":"clientWidth",z=c.reference[w]+c.reference[x]-b[x]-c.floating[w],N=b[x]-c.reference[x],j=g==="real"?await f.getOffsetParent?.(p):d.floating;let D=d.floating[O]||c.floating[w];(!D||!await f.isElement?.(j))&&(D=d.floating[O]||c.floating[w]);const Y=z/2-N/2,$=D/2-E[w]/2-1,Z=Math.min(v[_],$),V=Math.min(v[k],$),J=Z,ne=D-E[w]-V,ae=D/2-E[w]/2+Y,B=op(J,ae,ne),H=!m.arrow&&jr(l)!=null&&ae!==B&&c.reference[w]/2-(ae<J?Z:V)-E[w]/2<0,G=H?ae<J?ae-J:ae-ne:0;return{[x]:b[x]+G,data:{[x]:B,centerOffset:ae-B-G,...H&&{alignmentOffset:G}},reset:H}}}),VN=(t,o)=>({...HN(t),options:[t,o]}),qN={name:"hide",async fn(t){const{width:o,height:r,x:a,y:l}=t.rects.reference,c=o===0&&r===0&&a===0&&l===0;return{data:{referenceHidden:(await fz().fn(t)).data?.referenceHidden||c}}}},Zc={sideX:"left",sideY:"top"},YN={name:"adaptiveOrigin",async fn(t){const{x:o,y:r,rects:{floating:a},elements:{floating:l},platform:c,strategy:f,placement:d}=t,m=zt(l),p=m.getComputedStyle(l);if(!(p.transitionDuration!=="0s"&&p.transitionDuration!==""))return{x:o,y:r,data:Zc};const g=await c.getOffsetParent?.(l);let v={width:0,height:0};if(f==="fixed"&&m?.visualViewport)v={width:m.visualViewport.width,height:m.visualViewport.height};else if(g===m){const _=at(l);v={width:_.documentElement.clientWidth,height:_.documentElement.clientHeight}}else await c.isElement?.(g)&&(v=await c.getDimensions(g));const b=vn(d);let x=o,w=r;b==="left"&&(x=v.width-(o+a.width)),b==="top"&&(w=v.height-(r+a.height));const E=b==="left"?"right":Zc.sideX,C=b==="top"?"bottom":Zc.sideY;return{x,y:w,data:{sideX:E,sideY:C}}}};function Ww(t,o,r){const a=t==="inline-start"||t==="inline-end";return{top:"top",right:a?r?"inline-start":"inline-end":"right",bottom:"bottom",left:a?r?"inline-end":"inline-start":"left"}[o]}function P0(t,o,r){const{rects:a,placement:l}=t;return{side:Ww(o,vn(l),r),align:jr(l)||"center",anchor:{width:a.reference.width,height:a.reference.height},positioner:{width:a.floating.width,height:a.floating.height}}}function e1(t){const{anchor:o,positionMethod:r="absolute",side:a="bottom",sideOffset:l=0,align:c="center",alignOffset:f=0,collisionBoundary:d,collisionPadding:m=5,sticky:p=!1,arrowPadding:y=5,disableAnchorTracking:g=!1,keepMounted:v=!1,floatingRootContext:b,mounted:x,collisionAvoidance:w,shiftCrossAxis:E=!1,nodeId:C,adaptiveOrigin:_,lazyFlip:k=!1,externalTree:O}=t,[z,N]=R.useState(null);!x&&z!==null&&N(null);const j=w.side||"flip",D=w.align||"flip",Y=w.fallbackAxisSide||"end",$=typeof o=="function"?o:void 0,Z=Ce($),V=$?Z:o,J=an(o),ae=Jw()==="rtl",B=z||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":ae?"left":"right","inline-start":ae?"right":"left"}[a],H=c==="center"?B:`${B}-${c}`;let G=m;const ce=1,W=a==="bottom"?ce:0,P=a==="top"?ce:0,X=a==="right"?ce:0,le=a==="left"?ce:0;typeof G=="number"?G={top:G+W,right:G+le,bottom:G+P,left:G+X}:G&&(G={top:(G.top||0)+W,right:(G.right||0)+le,bottom:(G.bottom||0)+P,left:(G.left||0)+X});const re={boundary:d==="clipping-ancestors"?"clippingAncestors":d,padding:G},ue=R.useRef(null),he=an(l),ve=an(f),ze=[az(ht=>{const Rt=P0(ht,a,ae),nn=typeof he.current=="function"?he.current(Rt):he.current,Nt=typeof ve.current=="function"?ve.current(Rt):ve.current;return{mainAxis:nn,crossAxis:Nt,alignmentAxis:Nt}},[typeof l!="function"?l:0,typeof f!="function"?f:0,ae,a])],je=D==="none"&&j!=="shift",te=!je&&(p||E||j==="shift"),me=j==="none"?null:cz({...re,padding:{top:G.top+ce,right:G.right+ce,bottom:G.bottom+ce,left:G.left+ce},mainAxis:!E&&j==="flip",crossAxis:D==="flip"?"alignment":!1,fallbackAxisSideDirection:Y}),pe=je?null:iz(ht=>{const Rt=at(ht.elements.floating).documentElement;return{...re,rootBoundary:E?{x:0,y:0,width:Rt.clientWidth,height:Rt.clientHeight}:void 0,mainAxis:D!=="none",crossAxis:te,limiter:p||E?void 0:lz(nn=>{if(!ue.current)return{};const{width:Nt,height:It}=ue.current.getBoundingClientRect(),_n=Vn(vn(nn.placement)),cn=_n==="y"?Nt:It,Fo=_n==="y"?G.left+G.right:G.top+G.bottom;return{offset:cn/2+Fo/2}})}},[re,p,E,G,D]);j==="shift"||D==="shift"||c==="center"?ze.push(pe,me):ze.push(me,pe),ze.push(uz({...re,apply({elements:{floating:ht},rects:{reference:Rt},availableWidth:nn,availableHeight:Nt}){const It=ht.style;It.setProperty("--available-width",`${nn}px`),It.setProperty("--available-height",`${Nt}px`),It.setProperty("--anchor-width",`${Rt.width}px`),It.setProperty("--anchor-height",`${Rt.height}px`)}}),VN(()=>({element:ue.current||document.createElement("div"),padding:y,offsetParent:"floating"}),[y]),{name:"transformOrigin",fn(ht){const{elements:Rt,middlewareData:nn,placement:Nt,rects:It,y:_n}=ht,cn=vn(Nt),Fo=Vn(cn),Xo=ue.current,Zu=nn.arrow?.x||0,il=nn.arrow?.y||0,Ua=Xo?.clientWidth||0,Ur=Xo?.clientHeight||0,Ba=Zu+Ua/2,Ia=il+Ur/2,ll=Math.abs(nn.shift?.y||0),cl=It.reference.height/2,fo=typeof l=="function"?l(P0(ht,a,ae)):l,Ha=ll>fo,ul={top:`${Ba}px calc(100% + ${fo}px)`,bottom:`${Ba}px ${-fo}px`,left:`calc(100% + ${fo}px) ${Ia}px`,right:`${-fo}px ${Ia}px`}[cn],fl=`${Ba}px ${It.reference.y+cl-_n}px`;return Rt.floating.style.setProperty("--transform-origin",te&&Fo==="y"&&Ha?fl:ul),{}}},qN,_),Ae(()=>{!x&&b&&b.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[x,b]);const Ne=R.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:be,elements:Se,x:ye,y:de,middlewareData:we,update:ge,placement:De,context:qe,isPositioned:Be,floatingStyles:Ot}=Hz({rootContext:b,placement:H,middleware:ze,strategy:r,whileElementsMounted:v?void 0:(...ht)=>O0(...ht,Ne),nodeId:C,externalTree:O}),{sideX:He,sideY:Je}=we.adaptiveOrigin||Zc,Pe=Be?r:"fixed",Et=R.useMemo(()=>{const ht=_?{position:Pe,[He]:ye,[Je]:de}:{position:Pe,...Ot};return Be||(ht.opacity=0),ht},[_,Pe,He,ye,Je,de,Ot,Be]),Qt=R.useRef(null);Ae(()=>{if(!x)return;const ht=J.current,Rt=typeof ht=="function"?ht():ht,Nt=(U0(Rt)?Rt.current:Rt)||null||null;Nt!==Qt.current&&(be.setPositionReference(Nt),Qt.current=Nt)},[x,be,V,J]),R.useEffect(()=>{if(!x)return;const ht=J.current;typeof ht!="function"&&U0(ht)&&ht.current!==Qt.current&&(be.setPositionReference(ht.current),Qt.current=ht.current)},[x,be,V,J]),R.useEffect(()=>{if(v&&x&&Se.domReference&&Se.floating)return O0(Se.domReference,Se.floating,ge,Ne)},[v,x,Se,ge,Ne]);const Yn=vn(De),Rs=Ww(a,Yn,ae),Gn=jr(De)||"center",Le=!!we.hide?.referenceHidden;Ae(()=>{k&&x&&Be&&N(Yn)},[k,x,Be,Yn]);const Fe=R.useMemo(()=>({position:"absolute",top:we.arrow?.y,left:we.arrow?.x}),[we.arrow]),ot=we.arrow?.centerOffset!==0;return R.useMemo(()=>({positionerStyles:Et,arrowStyles:Fe,arrowRef:ue,arrowUncentered:ot,side:Rs,align:Gn,physicalSide:Yn,anchorHidden:Le,refs:be,context:qe,isPositioned:Be,update:ge}),[Et,Fe,ue,ot,Rs,Gn,Yn,Le,be,qe,Be,ge])}function U0(t){return t!=null&&"current"in t}function Gu(t){return t==="starting"?HA:qt}const GN=R.forwardRef(function(o,r){const{render:a,className:l,anchor:c,positionMethod:f="absolute",side:d="top",align:m="center",sideOffset:p=0,alignOffset:y=0,collisionBoundary:g="clipping-ancestors",collisionPadding:v=5,arrowPadding:b=5,sticky:x=!1,disableAnchorTracking:w=!1,collisionAvoidance:E=dx,...C}=o,_=ol(),k=PN(),O=_.useState("open"),z=_.useState("mounted"),N=_.useState("trackCursorAxis"),j=_.useState("disableHoverablePopup"),D=_.useState("floatingRootContext"),Y=_.useState("instantType"),$=_.useState("transitionStatus"),Z=_.useState("hasViewport"),V=e1({anchor:c,positionMethod:f,floatingRootContext:D,mounted:z,side:d,sideOffset:p,align:m,alignOffset:y,collisionBoundary:g,collisionPadding:v,sticky:x,arrowPadding:b,disableAnchorTracking:w,keepMounted:k,collisionAvoidance:E,adaptiveOrigin:Z?YN:void 0}),J=R.useMemo(()=>{const H={};return(!O||N==="both"||j)&&(H.pointerEvents="none"),{role:"presentation",hidden:!z,style:{...V.positionerStyles,...H}}},[O,N,j,z,V.positionerStyles]),ne=R.useMemo(()=>({open:O,side:V.side,align:V.align,anchorHidden:V.anchorHidden,instant:N!=="none"?"tracking-cursor":Y}),[O,V.side,V.align,V.anchorHidden,N,Y]),ae=R.useMemo(()=>({...ne,arrowRef:V.arrowRef,arrowStyles:V.arrowStyles,arrowUncentered:V.arrowUncentered}),[ne,V.arrowRef,V.arrowStyles,V.arrowUncentered]),B=Mt("div",o,{state:ne,props:[J,Gu($),C],ref:[r,_.useStateSetter("positionerElement")],stateAttributesMapping:Es});return L.jsx(Zw.Provider,{value:ae,children:B})}),FN={...Es,...Bu},XN=R.forwardRef(function(o,r){const{className:a,render:l,...c}=o,f=ol(),{side:d,align:m}=$w(),p=f.useState("open"),y=f.useState("instantType"),g=f.useState("transitionStatus"),v=f.useState("popupProps"),b=f.useState("floatingRootContext");Iu({open:p,ref:f.context.popupRef,onComplete(){p&&f.context.onOpenChangeComplete?.(!0)}});const x=f.useState("disabled"),w=f.useState("closeDelay");return zw(b,{enabled:!x,closeDelay:w}),Mt("div",o,{state:{open:p,side:d,align:m,instant:y,transitionStatus:g},ref:[r,f.context.popupRef,f.useStateSetter("popupElement")],props:[v,Gu(g),c],stateAttributesMapping:FN})}),KN=R.forwardRef(function(o,r){const{className:a,render:l,...c}=o,d=ol().useState("instantType"),{open:m,arrowRef:p,side:y,align:g,arrowUncentered:v,arrowStyles:b}=$w();return Mt("div",o,{state:{open:m,side:y,align:g,uncentered:v,instant:d},ref:[r,p],props:[{style:b,"aria-hidden":!0},c],stateAttributesMapping:Es})}),QN=function(o){const{delay:r,closeDelay:a,timeout:l=400}=o,c=R.useMemo(()=>({delay:r,closeDelay:a}),[r,a]),f=R.useMemo(()=>({open:r,close:a}),[r,a]);return L.jsx(Kw.Provider,{value:c,children:L.jsx(dk,{delay:f,timeoutMs:l,children:o.children})})};function ZN({delay:t=0,...o}){return L.jsx(QN,{"data-slot":"tooltip-provider",delay:t,...o})}function $N({...t}){return L.jsx(DN,{"data-slot":"tooltip",...t})}function JN({...t}){return L.jsx(jN,{"data-slot":"tooltip-trigger",...t})}function WN({className:t,side:o="top",sideOffset:r=4,align:a="center",alignOffset:l=0,children:c,...f}){return L.jsx(BN,{children:L.jsx(GN,{align:a,alignOffset:l,side:o,sideOffset:r,className:"isolate z-50",children:L.jsxs(XN,{"data-slot":"tooltip-content",className:ct("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-md px-3 py-1.5 text-xs data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 bg-foreground text-background z-50 w-fit max-w-xs origin-(--transform-origin)",t),...f,children:[c,L.jsx(KN,{className:"size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 bg-foreground fill-foreground z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const Ph=768;function eL(){const[t,o]=R.useState(void 0);return R.useEffect(()=>{const r=window.matchMedia(`(max-width: ${Ph-1}px)`),a=()=>{o(window.innerWidth<Ph)};return r.addEventListener("change",a),o(window.innerWidth<Ph),()=>r.removeEventListener("change",a)},[]),!!t}const tL="sidebar_state",nL=3600*24*7,oL="16rem",rL="18rem",sL="3rem",aL="b",t1=R.createContext(null);function Fu(){const t=R.useContext(t1);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function iL({defaultOpen:t=!0,open:o,onOpenChange:r,className:a,style:l,children:c,...f}){const d=eL(),[m,p]=R.useState(!1),[y,g]=R.useState(t),v=o??y,b=R.useCallback(C=>{const _=typeof C=="function"?C(v):C;r?r(_):g(_),document.cookie=`${tL}=${_}; path=/; max-age=${nL}`},[r,v]),x=R.useCallback(()=>d?p(C=>!C):b(C=>!C),[d,b,p]);R.useEffect(()=>{const C=_=>{_.key===aL&&(_.metaKey||_.ctrlKey)&&(_.preventDefault(),x())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[x]);const w=v?"expanded":"collapsed",E=R.useMemo(()=>({state:w,open:v,setOpen:b,isMobile:d,openMobile:m,setOpenMobile:p,toggleSidebar:x}),[w,v,b,d,m,p,x]);return L.jsx(t1.Provider,{value:E,children:L.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":oL,"--sidebar-width-icon":sL,...l},className:ct("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",a),...f,children:c})})}function lL({side:t="left",variant:o="sidebar",collapsible:r="offcanvas",className:a,children:l,dir:c,...f}){const{isMobile:d,state:m,openMobile:p,setOpenMobile:y}=Fu();return r==="none"?L.jsx("div",{"data-slot":"sidebar",className:ct("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",a),...f,children:l}):d?L.jsx(wN,{open:p,onOpenChange:y,...f,children:L.jsxs(TN,{dir:c,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":rL},side:t,children:[L.jsxs(CN,{className:"sr-only",children:[L.jsx(MN,{children:"Sidebar"}),L.jsx(ON,{children:"Displays the mobile sidebar."})]}),L.jsx("div",{className:"flex h-full w-full flex-col",children:l})]})}):L.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":m,"data-collapsible":m==="collapsed"?r:"","data-variant":o,"data-side":t,"data-slot":"sidebar",children:[L.jsx("div",{"data-slot":"sidebar-gap",className:ct("transition-[width] duration-200 ease-linear relative w-(--sidebar-width) bg-transparent","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",o==="floating"||o==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),L.jsx("div",{"data-slot":"sidebar-container","data-side":t,className:ct("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",o==="floating"||o==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...f,children:L.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 flex size-full flex-col",children:l})})]})}function cL({className:t,onClick:o,...r}){const{toggleSidebar:a}=Fu();return L.jsxs(Ax,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:ct(t),onClick:l=>{o?.(l),a()},...r,children:[L.jsx(vA,{}),L.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function uL({className:t,...o}){return L.jsx("main",{"data-slot":"sidebar-inset",className:ct("bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 relative flex w-full flex-1 flex-col",t),...o})}function fL({className:t,...o}){return L.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:ct("gap-2 p-2 flex flex-col",t),...o})}function dL({className:t,...o}){return L.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:ct("no-scrollbar gap-0 flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...o})}function fm({className:t,...o}){return L.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:ct("p-2 relative flex w-full min-w-0 flex-col",t),...o})}function hL({className:t,render:o,...r}){return ku({defaultTagName:"div",props:Po({className:ct("text-sidebar-foreground/70 ring-sidebar-ring h-8 rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 flex shrink-0 items-center outline-hidden [&>svg]:shrink-0",t)},r),render:o,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function n1({className:t,...o}){return L.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:ct("text-sm w-full",t),...o})}function Xu({className:t,...o}){return L.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:ct("gap-0 flex w-full min-w-0 flex-col",t),...o})}function fs({className:t,...o}){return L.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:ct("group/menu-item relative",t),...o})}const pL=zp("ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-md p-2 text-left text-sm transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Na({render:t,isActive:o=!1,variant:r="default",size:a="default",tooltip:l,className:c,...f}){const{isMobile:d,state:m}=Fu(),p=ku({defaultTagName:"button",props:Po({className:ct(pL({variant:r,size:a}),c)},f),render:l?JN:t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:o}});return l?(typeof l=="string"&&(l={children:l}),L.jsxs($N,{children:[p,L.jsx(WN,{side:"right",align:"center",hidden:m!=="collapsed"||d,...l})]})):p}function mL({className:t,render:o,showOnHover:r=!1,...a}){return ku({defaultTagName:"button",props:Po({className:ct("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 aspect-square w-5 rounded-md p-0 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 focus-visible:ring-2 [&>svg]:size-4 flex items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>svg]:shrink-0",r&&"peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 aria-expanded:opacity-100 md:opacity-0",t)},a),render:o,state:{slot:"sidebar-menu-action",sidebar:"menu-action"}})}function gL(){if(typeof window>"u")return"ws://localhost:3100";const t=window.location.protocol==="https:"?"wss:":"ws:",o=window.location.host;return o.startsWith("localhost:3000")||o.startsWith("127.0.0.1:3000")?"ws://localhost:3100":`${t}//${o}`}const B0={url:gL(),authToken:""};function yL(){if(typeof window>"u")return B0;try{const t=localStorage.getItem("clankie-connection");if(t)return JSON.parse(t)}catch(t){console.error("Failed to load connection settings:",t)}return B0}function vL(t){if(!(typeof window>"u"))try{localStorage.setItem("clankie-connection",JSON.stringify(t))}catch(o){console.error("Failed to save connection settings:",o)}}const rl=new La({settings:yL(),status:"disconnected",error:void 0});function bL(t){rl.setState(o=>{const r={...o.settings,...t};return vL(r),{...o,settings:r}})}function I0(t,o){rl.setState(r=>({...r,status:t,error:o}))}const o1={messages:[],streamingContent:"",thinkingContent:"",currentMessageId:null},qo=new La(o1);function n4(t){const o=`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;qo.setState(r=>({...r,messages:[...r.messages,{id:o,role:"user",content:t,timestamp:Date.now()}]}))}function SL(){const t=`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;qo.setState(o=>({...o,currentMessageId:t,streamingContent:"",messages:[...o.messages,{id:t,role:"assistant",content:"",timestamp:Date.now(),isStreaming:!0}]}))}function xL(t){qo.setState(o=>o.currentMessageId?{...o,streamingContent:t,messages:o.messages.map(r=>r.id===o.currentMessageId?{...r,content:t,isStreaming:!0}:r)}:o)}function wL(){qo.setState(t=>({...t,streamingContent:"",thinkingContent:"",currentMessageId:null,messages:t.messages.map(o=>o.id===t.currentMessageId?{...o,isStreaming:!1,isThinking:!1}:o)}))}function EL(){qo.setState(t=>t.currentMessageId?{...t,thinkingContent:"",messages:t.messages.map(o=>o.id===t.currentMessageId?{...o,isThinking:!0}:o)}:t)}function RL(t){qo.setState(o=>o.currentMessageId?{...o,thinkingContent:t,messages:o.messages.map(r=>r.id===o.currentMessageId?{...r,thinkingContent:t}:r)}:o)}function TL(){qo.setState(t=>t.currentMessageId?{...t,messages:t.messages.map(o=>o.id===t.currentMessageId?{...o,isThinking:!1}:o)}:t)}function CL(t){const o=t.map((r,a)=>{const l=r.content.filter(c=>c.type==="text").map(c=>c.text).join(`
29
+ )`}return L.jsx("div",{ref:r,role:"presentation","data-base-ui-inert":"",...l,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})}),cN=R.forwardRef(function(o,r){const{keepMounted:a=!1,...l}=o,{store:c}=ws(),f=c.useState("mounted"),d=c.useState("modal"),m=c.useState("open");return f||a?L.jsx(Lw.Provider,{value:a,children:L.jsxs(hw,{ref:r,...l,children:[f&&d===!0&&L.jsx(Yw,{ref:c.context.internalBackdropRef,inert:qw(!m)}),o.children]})}):null});function cm(t){const o=R.useRef(!0);o.current&&(o.current=!1,t())}let N0={},L0={},j0="";function uN(t){if(typeof document>"u")return!1;const o=at(t);return zt(o).innerWidth-o.documentElement.clientWidth>0}function fN(t){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const r=at(t),a=r.documentElement,l=r.body,c=Nr(a)?a:l,f=c.style.overflowY,d=a.style.scrollbarGutter;a.style.scrollbarGutter="stable",c.style.overflowY="scroll";const m=c.offsetWidth;c.style.overflowY="hidden";const p=c.offsetWidth;return c.style.overflowY=f,a.style.scrollbarGutter=d,m===p}function dN(t){const o=at(t),r=o.documentElement,a=o.body,l=Nr(r)?r:a,c={overflowY:l.style.overflowY,overflowX:l.style.overflowX};return Object.assign(l.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(l.style,c)}}function hN(t){const o=at(t),r=o.documentElement,a=o.body,l=zt(r);let c=0,f=0,d=!1;const m=oo.create();if(zx&&(l.visualViewport?.scale??1)!==1)return()=>{};function p(){const v=l.getComputedStyle(r),b=l.getComputedStyle(a),E=(v.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=r.scrollTop,f=r.scrollLeft,N0={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},j0=r.style.scrollBehavior,L0={position:a.style.position,height:a.style.height,width:a.style.width,boxSizing:a.style.boxSizing,overflowY:a.style.overflowY,overflowX:a.style.overflowX,scrollBehavior:a.style.scrollBehavior};const C=r.scrollHeight>r.clientHeight,_=r.scrollWidth>r.clientWidth,k=v.overflowY==="scroll"||b.overflowY==="scroll",O=v.overflowX==="scroll"||b.overflowX==="scroll",z=Math.max(0,l.innerWidth-a.clientWidth),N=Math.max(0,l.innerHeight-a.clientHeight),j=parseFloat(b.marginTop)+parseFloat(b.marginBottom),D=parseFloat(b.marginLeft)+parseFloat(b.marginRight),Y=Nr(r)?r:a;if(d=fN(t),d){r.style.scrollbarGutter=E,Y.style.overflowY="hidden",Y.style.overflowX="hidden";return}Object.assign(r.style,{scrollbarGutter:E,overflowY:"hidden",overflowX:"hidden"}),(C||k)&&(r.style.overflowY="scroll"),(_||O)&&(r.style.overflowX="scroll"),Object.assign(a.style,{position:"relative",height:j||N?`calc(100dvh - ${j+N}px)`:"100dvh",width:D||z?`calc(100vw - ${D+z}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),a.scrollTop=c,a.scrollLeft=f,r.setAttribute("data-base-ui-scroll-locked",""),r.style.scrollBehavior="unset"}function y(){Object.assign(r.style,N0),Object.assign(a.style,L0),d||(r.scrollTop=c,r.scrollLeft=f,r.removeAttribute("data-base-ui-scroll-locked"),r.style.scrollBehavior=j0)}function g(){y(),m.request(p)}return p(),l.addEventListener("resize",g),()=>{m.cancel(),y(),typeof l.removeEventListener=="function"&&l.removeEventListener("resize",g)}}class pN{lockCount=0;restore=null;timeoutLock=co.create();timeoutUnlock=co.create();acquire(o){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(o)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(o){if(this.lockCount===0||this.restore!==null)return;const a=at(o).documentElement,l=zt(a).getComputedStyle(a).overflowY;if(l==="hidden"||l==="clip"){this.restore=fx;return}const c=Nx||!uN(o);this.restore=c?dN(o):hN(o)}}const mN=new pN;function Gw(t=!0,o=null){Ae(()=>{if(t)return mN.acquire(o)},[t,o])}function gN(t){const o=R.useRef(""),r=R.useCallback(l=>{l.defaultPrevented||(o.current=l.pointerType,t(l,l.pointerType))},[t]);return{onClick:R.useCallback(l=>{if(l.detail===0){t(l,"keyboard");return}"pointerType"in l?t(l,l.pointerType):t(l,o.current),o.current=""},[t]),onPointerDown:r}}function Fw(t){const[o,r]=R.useState(null),a=Ce((d,m)=>{t||r(m||(Nx?"touch":""))}),l=R.useCallback(()=>{r(null)},[]),{onClick:c,onPointerDown:f}=gN(a);return R.useMemo(()=>({openMethod:o,reset:l,triggerProps:{onClick:c,onPointerDown:f}}),[o,l,c,f])}function yN(t){const{store:o,parentContext:r,actionsRef:a}=t,l=o.useState("open"),c=o.useState("disablePointerDismissal"),f=o.useState("modal"),d=o.useState("popupElement"),{openMethod:m,triggerProps:p,reset:y}=Fw(l);tm(o);const{forceUnmount:g}=nm(l,o,()=>{y()}),v=Ce($=>{const Z=Qe($);return Z.preventUnmountOnClose=()=>{o.set("preventUnmountingOnClose",!0)},Z}),b=R.useCallback(()=>{o.setOpen(!1,v(Kp))},[o,v]);R.useImperativeHandle(a,()=>({unmount:g,close:b}),[g,b]);const x=sm({popupStore:o,onOpenChange:o.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[w,E]=R.useState(0),C=w===0,_=Nw(x),k=Jp(x,{outsidePressEvent(){return o.context.internalBackdropRef.current||o.context.backdropRef.current?"intentional":{mouse:f==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress($){if(!o.context.outsidePressEnabledRef.current||"button"in $&&$.button!==0||"touches"in $&&$.touches.length!==1)return!1;const Z=rn($);if(C&&!c){const V=Z;return f&&(o.context.internalBackdropRef.current||o.context.backdropRef.current)?o.context.internalBackdropRef.current===V||o.context.backdropRef.current===V||Ye(V,d)&&!V?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:C});Gw(l&&f===!0,d);const{getReferenceProps:O,getFloatingProps:z,getTriggerProps:N}=nl([_,k]);o.useContextCallback("onNestedDialogOpen",$=>{E($+1)}),o.useContextCallback("onNestedDialogClose",()=>{E(0)}),R.useEffect(()=>(r?.onNestedDialogOpen&&l&&r.onNestedDialogOpen(w),r?.onNestedDialogClose&&!l&&r.onNestedDialogClose(),()=>{r?.onNestedDialogClose&&l&&r.onNestedDialogClose()}),[l,r,w]);const j=R.useMemo(()=>O(p),[O,p]),D=R.useMemo(()=>N(p),[N,p]),Y=R.useMemo(()=>z(),[z]);o.useSyncedValues({openMethod:m,activeTriggerProps:j,inactiveTriggerProps:D,popupProps:Y,floatingRootContext:x,nestedOpenDialogCount:w})}const vN={...rm,modal:_e(t=>t.modal),nested:_e(t=>t.nested),nestedOpenDialogCount:_e(t=>t.nestedOpenDialogCount),disablePointerDismissal:_e(t=>t.disablePointerDismissal),openMethod:_e(t=>t.openMethod),descriptionElementId:_e(t=>t.descriptionElementId),titleElementId:_e(t=>t.titleElementId),viewportElement:_e(t=>t.viewportElement),role:_e(t=>t.role)};class bN extends qu{constructor(o){super(SN(o),{popupRef:R.createRef(),backdropRef:R.createRef(),internalBackdropRef:R.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new tl,onOpenChange:void 0,onOpenChangeComplete:void 0},vN)}setOpen=(o,r)=>{if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!o&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(o,r),r.isCanceled)return;const a={open:o,nativeEvent:r.event,reason:r.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",a);const l={open:o},c=r.trigger?.id??null;(c||o)&&(l.activeTriggerId=c,l.activeTriggerElement=r.trigger??null),this.update(l)}}function SN(t={}){return{...om(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...t}}function xN(t){const{children:o,open:r,defaultOpen:a=!1,onOpenChange:l,onOpenChangeComplete:c,disablePointerDismissal:f=!1,modal:d=!0,actionsRef:m,handle:p,triggerId:y,defaultTriggerId:g=null}=t,v=ws(!0),b=!!v,x=Wt(()=>p?.store??new bN({open:a,openProp:r,activeTriggerId:g,triggerIdProp:y,modal:d,disablePointerDismissal:f,nested:b})).current;cm(()=>{r===void 0&&x.state.open===!1&&a===!0&&x.update({open:!0,activeTriggerId:g})}),x.useControlledProp("openProp",r),x.useControlledProp("triggerIdProp",y),x.useSyncedValues({disablePointerDismissal:f,nested:b,modal:d}),x.useContextCallback("onOpenChange",l),x.useContextCallback("onOpenChangeComplete",c);const w=x.useState("payload");yN({store:x,actionsRef:m,parentContext:v?.store.context});const E=R.useMemo(()=>({store:x}),[x]);return L.jsx(tw.Provider,{value:E,children:typeof o=="function"?o({payload:w}):o})}const wN=R.forwardRef(function(o,r){const{render:a,className:l,id:c,...f}=o,{store:d}=ws(),m=xs(c);return d.useSyncedValueWithCleanup("titleElementId",m),Mt("h2",o,{ref:r,props:[{id:m},f]})});function EN({...t}){return L.jsx(xN,{"data-slot":"sheet",...t})}function RN({...t}){return L.jsx(cN,{"data-slot":"sheet-portal",...t})}function TN({className:t,...o}){return L.jsx(ik,{"data-slot":"sheet-overlay",className:ct("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 z-50",t),...o})}function CN({className:t,children:o,side:r="right",showCloseButton:a=!0,...l}){return L.jsxs(RN,{children:[L.jsx(TN,{}),L.jsxs(lN,{"data-slot":"sheet-content","data-side":r,className:ct("bg-background data-open:animate-in data-closed:animate-out data-[side=right]:data-closed:slide-out-to-right-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=top]:data-closed:slide-out-to-top-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:fade-out-0 data-open:fade-in-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=bottom]:data-open:slide-in-from-bottom-10 fixed z-50 flex flex-col gap-4 bg-clip-padding text-sm shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",t),...l,children:[o,a&&L.jsxs(lk,{"data-slot":"sheet-close",render:L.jsx(Ax,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[L.jsx(MA,{}),L.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function MN({className:t,...o}){return L.jsx("div",{"data-slot":"sheet-header",className:ct("gap-0.5 p-4 flex flex-col",t),...o})}function ON({className:t,...o}){return L.jsx(wN,{"data-slot":"sheet-title",className:ct("text-foreground text-base font-medium",t),...o})}function _N({className:t,...o}){return L.jsx(ck,{"data-slot":"sheet-description",className:ct("text-muted-foreground text-sm",t),...o})}const Xw=R.createContext(void 0);function ol(t){const o=R.useContext(Xw);if(o===void 0&&!t)throw new Error(tn(72));return o}const AN={...rm,disabled:_e(t=>t.disabled),instantType:_e(t=>t.instantType),isInstantPhase:_e(t=>t.isInstantPhase),trackCursorAxis:_e(t=>t.trackCursorAxis),disableHoverablePopup:_e(t=>t.disableHoverablePopup),lastOpenChangeReason:_e(t=>t.openChangeReason),closeDelay:_e(t=>t.closeDelay),hasViewport:_e(t=>t.hasViewport)};class um extends qu{constructor(o){super({...DN(),...o},{popupRef:R.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new tl},AN)}setOpen=(o,r)=>{const a=r.reason,l=a===sn,c=o&&a===xa,f=!o&&(a===Aa||a===Hu);if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(o,r),r.isCanceled)return;const d=()=>{const m={open:o,openChangeReason:a};c?m.instantType="focus":f?m.instantType="dismiss":a===sn&&(m.instantType=void 0);const p=r.trigger?.id??null;(p||o)&&(m.activeTriggerId=p,m.activeTriggerElement=r.trigger??null),this.update(m)};l?io.flushSync(d):d()};static useStore(o,r){const a=Wt(()=>new um(r)).current,l=o??a,c=sm({popupStore:l,onOpenChange:l.setOpen});return l.state.floatingRootContext=c,l}}function DN(){return{...om(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0,hasViewport:!1}}const kN=Wp(function(o){const{disabled:r=!1,defaultOpen:a=!1,open:l,disableHoverablePopup:c=!1,trackCursorAxis:f="none",actionsRef:d,onOpenChange:m,onOpenChangeComplete:p,handle:y,triggerId:g,defaultTriggerId:v=null,children:b}=o,x=um.useStore(y?.store,{open:a,openProp:l,activeTriggerId:v,triggerIdProp:g});cm(()=>{l===void 0&&x.state.open===!1&&a===!0&&x.update({open:!0,activeTriggerId:v})}),x.useControlledProp("openProp",l),x.useControlledProp("triggerIdProp",g),x.useContextCallback("onOpenChange",m),x.useContextCallback("onOpenChangeComplete",p);const w=x.useState("open"),E=!r&&w,C=x.useState("activeTriggerId"),_=x.useState("payload");x.useSyncedValues({trackCursorAxis:f,disableHoverablePopup:c}),Ae(()=>{w&&r&&x.setOpen(!1,Qe(WD))},[w,r,x]),x.useSyncedValue("disabled",r),tm(x);const{forceUnmount:k,transitionStatus:O}=nm(E,x),z=x.useState("isInstantPhase"),N=x.useState("instantType"),j=x.useState("lastOpenChangeReason"),D=R.useRef(null);Ae(()=>{O==="ending"&&j===Fp||O!=="ending"&&z?(N!=="delay"&&(D.current=N),x.set("instantType","delay")):D.current!==null&&(x.set("instantType",D.current),D.current=null)},[O,z,j,N,x]),Ae(()=>{E&&C==null&&x.set("payload",void 0)},[x,C,E]);const Y=R.useCallback(()=>{x.setOpen(!1,zN(x,Kp))},[x]);R.useImperativeHandle(d,()=>({unmount:k,close:Y}),[k,Y]);const $=x.useState("floatingRootContext"),Z=Jp($,{enabled:!r,referencePress:!0}),V=Tk($,{enabled:!r&&f!=="none",axis:f==="none"?void 0:f}),{getReferenceProps:J,getFloatingProps:ne,getTriggerProps:ae}=nl([Z,V]),B=R.useMemo(()=>J(),[J]),H=R.useMemo(()=>ae(),[ae]),G=R.useMemo(()=>ne(),[ne]);return x.useSyncedValues({activeTriggerProps:B,inactiveTriggerProps:H,popupProps:G}),L.jsx(Xw.Provider,{value:x,children:typeof b=="function"?b({payload:_}):b})});function zN(t,o){const r=Qe(o);return r.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},r}const Kw=R.createContext(void 0);function NN(){return R.useContext(Kw)}let LN=(function(t){return t[t.popupOpen=bu.popupOpen]="popupOpen",t.triggerDisabled="data-trigger-disabled",t})({});const jN=600,PN=Mw(function(o,r){const{className:a,render:l,handle:c,payload:f,disabled:d,delay:m,closeDelay:p,id:y,...g}=o,v=ol(!0),b=c?.store??v;if(!b)throw new Error(tn(82));const x=xs(y),w=b.useState("isTriggerActive",x),E=b.useState("isOpenedByTrigger",x),C=b.useState("floatingRootContext"),_=R.useRef(null),k=m??jN,O=p??0,{registerTrigger:z,isMountedByThisTrigger:N}=Aw(x,_,b,{payload:f,closeDelay:O}),j=NN(),{delayRef:D,isInstantPhase:Y,hasProvider:$}=pk(C,{open:E});b.useSyncedValue("isInstantPhase",Y);const Z=b.useState("disabled"),V=d??Z,J=b.useState("trackCursorAxis"),ne=b.useState("disableHoverablePopup"),ae=im(C,{enabled:!V,mouseOnly:!0,move:!1,handleClose:!ne&&J!=="both"?lm():null,restMs(){const W=j?.delay,P=typeof D.current=="object"?D.current.open:void 0;let X=k;return $&&(P!==0?X=m??W??k:X=0),X},delay(){const W=typeof D.current=="object"?D.current.close:void 0;let P=O;return p==null&&$&&(P=W),{close:P}},triggerElementRef:_,isActiveTrigger:w}),B=Dw(C,{enabled:!V}).reference,H={open:E},G=b.useState("triggerProps",N);return Mt("button",o,{state:H,ref:[r,z,_],props:[ae,B,G,{id:x,[LN.triggerDisabled]:V?"":void 0},g],stateAttributesMapping:nw})}),Qw=R.createContext(void 0);function UN(){const t=R.useContext(Qw);if(t===void 0)throw new Error(tn(70));return t}const BN=R.forwardRef(function(o,r){const{children:a,container:l,className:c,render:f,...d}=o,{portalNode:m,portalSubtree:p}=dw({container:l,ref:r,componentProps:o,elementProps:d});return!p&&!m?null:L.jsxs(R.Fragment,{children:[p,m&&io.createPortal(a,m)]})}),IN=R.forwardRef(function(o,r){const{keepMounted:a=!1,...l}=o;return ol().useState("mounted")||a?L.jsx(Qw.Provider,{value:a,children:L.jsx(BN,{ref:r,...l})}):null}),Zw=R.createContext(void 0);function $w(){const t=R.useContext(Zw);if(t===void 0)throw new Error(tn(71));return t}const HN=R.createContext(void 0);function Jw(){return R.useContext(HN)?.direction??"ltr"}const VN=t=>({name:"arrow",options:t,async fn(o){const{x:r,y:a,placement:l,rects:c,platform:f,elements:d,middlewareData:m}=o,{element:p,padding:y=0,offsetParent:g="real"}=Uo(t,o)||{};if(p==null)return{};const v=qx(y),b={x:r,y:a},x=qp(l),w=Vp(x),E=await f.getDimensions(p),C=x==="y",_=C?"top":"left",k=C?"bottom":"right",O=C?"clientHeight":"clientWidth",z=c.reference[w]+c.reference[x]-b[x]-c.floating[w],N=b[x]-c.reference[x],j=g==="real"?await f.getOffsetParent?.(p):d.floating;let D=d.floating[O]||c.floating[w];(!D||!await f.isElement?.(j))&&(D=d.floating[O]||c.floating[w]);const Y=z/2-N/2,$=D/2-E[w]/2-1,Z=Math.min(v[_],$),V=Math.min(v[k],$),J=Z,ne=D-E[w]-V,ae=D/2-E[w]/2+Y,B=op(J,ae,ne),H=!m.arrow&&jr(l)!=null&&ae!==B&&c.reference[w]/2-(ae<J?Z:V)-E[w]/2<0,G=H?ae<J?ae-J:ae-ne:0;return{[x]:b[x]+G,data:{[x]:B,centerOffset:ae-B-G,...H&&{alignmentOffset:G}},reset:H}}}),qN=(t,o)=>({...VN(t),options:[t,o]}),YN={name:"hide",async fn(t){const{width:o,height:r,x:a,y:l}=t.rects.reference,c=o===0&&r===0&&a===0&&l===0;return{data:{referenceHidden:(await dz().fn(t)).data?.referenceHidden||c}}}},Zc={sideX:"left",sideY:"top"},GN={name:"adaptiveOrigin",async fn(t){const{x:o,y:r,rects:{floating:a},elements:{floating:l},platform:c,strategy:f,placement:d}=t,m=zt(l),p=m.getComputedStyle(l);if(!(p.transitionDuration!=="0s"&&p.transitionDuration!==""))return{x:o,y:r,data:Zc};const g=await c.getOffsetParent?.(l);let v={width:0,height:0};if(f==="fixed"&&m?.visualViewport)v={width:m.visualViewport.width,height:m.visualViewport.height};else if(g===m){const _=at(l);v={width:_.documentElement.clientWidth,height:_.documentElement.clientHeight}}else await c.isElement?.(g)&&(v=await c.getDimensions(g));const b=vn(d);let x=o,w=r;b==="left"&&(x=v.width-(o+a.width)),b==="top"&&(w=v.height-(r+a.height));const E=b==="left"?"right":Zc.sideX,C=b==="top"?"bottom":Zc.sideY;return{x,y:w,data:{sideX:E,sideY:C}}}};function Ww(t,o,r){const a=t==="inline-start"||t==="inline-end";return{top:"top",right:a?r?"inline-start":"inline-end":"right",bottom:"bottom",left:a?r?"inline-end":"inline-start":"left"}[o]}function P0(t,o,r){const{rects:a,placement:l}=t;return{side:Ww(o,vn(l),r),align:jr(l)||"center",anchor:{width:a.reference.width,height:a.reference.height},positioner:{width:a.floating.width,height:a.floating.height}}}function e1(t){const{anchor:o,positionMethod:r="absolute",side:a="bottom",sideOffset:l=0,align:c="center",alignOffset:f=0,collisionBoundary:d,collisionPadding:m=5,sticky:p=!1,arrowPadding:y=5,disableAnchorTracking:g=!1,keepMounted:v=!1,floatingRootContext:b,mounted:x,collisionAvoidance:w,shiftCrossAxis:E=!1,nodeId:C,adaptiveOrigin:_,lazyFlip:k=!1,externalTree:O}=t,[z,N]=R.useState(null);!x&&z!==null&&N(null);const j=w.side||"flip",D=w.align||"flip",Y=w.fallbackAxisSide||"end",$=typeof o=="function"?o:void 0,Z=Ce($),V=$?Z:o,J=an(o),ae=Jw()==="rtl",B=z||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":ae?"left":"right","inline-start":ae?"right":"left"}[a],H=c==="center"?B:`${B}-${c}`;let G=m;const ce=1,W=a==="bottom"?ce:0,P=a==="top"?ce:0,X=a==="right"?ce:0,le=a==="left"?ce:0;typeof G=="number"?G={top:G+W,right:G+le,bottom:G+P,left:G+X}:G&&(G={top:(G.top||0)+W,right:(G.right||0)+le,bottom:(G.bottom||0)+P,left:(G.left||0)+X});const re={boundary:d==="clipping-ancestors"?"clippingAncestors":d,padding:G},ue=R.useRef(null),he=an(l),ve=an(f),ze=[iz(ht=>{const Rt=P0(ht,a,ae),nn=typeof he.current=="function"?he.current(Rt):he.current,Nt=typeof ve.current=="function"?ve.current(Rt):ve.current;return{mainAxis:nn,crossAxis:Nt,alignmentAxis:Nt}},[typeof l!="function"?l:0,typeof f!="function"?f:0,ae,a])],je=D==="none"&&j!=="shift",te=!je&&(p||E||j==="shift"),me=j==="none"?null:uz({...re,padding:{top:G.top+ce,right:G.right+ce,bottom:G.bottom+ce,left:G.left+ce},mainAxis:!E&&j==="flip",crossAxis:D==="flip"?"alignment":!1,fallbackAxisSideDirection:Y}),pe=je?null:lz(ht=>{const Rt=at(ht.elements.floating).documentElement;return{...re,rootBoundary:E?{x:0,y:0,width:Rt.clientWidth,height:Rt.clientHeight}:void 0,mainAxis:D!=="none",crossAxis:te,limiter:p||E?void 0:cz(nn=>{if(!ue.current)return{};const{width:Nt,height:It}=ue.current.getBoundingClientRect(),_n=Vn(vn(nn.placement)),cn=_n==="y"?Nt:It,Fo=_n==="y"?G.left+G.right:G.top+G.bottom;return{offset:cn/2+Fo/2}})}},[re,p,E,G,D]);j==="shift"||D==="shift"||c==="center"?ze.push(pe,me):ze.push(me,pe),ze.push(fz({...re,apply({elements:{floating:ht},rects:{reference:Rt},availableWidth:nn,availableHeight:Nt}){const It=ht.style;It.setProperty("--available-width",`${nn}px`),It.setProperty("--available-height",`${Nt}px`),It.setProperty("--anchor-width",`${Rt.width}px`),It.setProperty("--anchor-height",`${Rt.height}px`)}}),qN(()=>({element:ue.current||document.createElement("div"),padding:y,offsetParent:"floating"}),[y]),{name:"transformOrigin",fn(ht){const{elements:Rt,middlewareData:nn,placement:Nt,rects:It,y:_n}=ht,cn=vn(Nt),Fo=Vn(cn),Xo=ue.current,Zu=nn.arrow?.x||0,il=nn.arrow?.y||0,Ua=Xo?.clientWidth||0,Ur=Xo?.clientHeight||0,Ba=Zu+Ua/2,Ia=il+Ur/2,ll=Math.abs(nn.shift?.y||0),cl=It.reference.height/2,fo=typeof l=="function"?l(P0(ht,a,ae)):l,Ha=ll>fo,ul={top:`${Ba}px calc(100% + ${fo}px)`,bottom:`${Ba}px ${-fo}px`,left:`calc(100% + ${fo}px) ${Ia}px`,right:`${-fo}px ${Ia}px`}[cn],fl=`${Ba}px ${It.reference.y+cl-_n}px`;return Rt.floating.style.setProperty("--transform-origin",te&&Fo==="y"&&Ha?fl:ul),{}}},YN,_),Ae(()=>{!x&&b&&b.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[x,b]);const Ne=R.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:be,elements:Se,x:ye,y:de,middlewareData:we,update:ge,placement:De,context:qe,isPositioned:Be,floatingStyles:Ot}=Vz({rootContext:b,placement:H,middleware:ze,strategy:r,whileElementsMounted:v?void 0:(...ht)=>O0(...ht,Ne),nodeId:C,externalTree:O}),{sideX:He,sideY:Je}=we.adaptiveOrigin||Zc,Pe=Be?r:"fixed",Et=R.useMemo(()=>{const ht=_?{position:Pe,[He]:ye,[Je]:de}:{position:Pe,...Ot};return Be||(ht.opacity=0),ht},[_,Pe,He,ye,Je,de,Ot,Be]),Qt=R.useRef(null);Ae(()=>{if(!x)return;const ht=J.current,Rt=typeof ht=="function"?ht():ht,Nt=(U0(Rt)?Rt.current:Rt)||null||null;Nt!==Qt.current&&(be.setPositionReference(Nt),Qt.current=Nt)},[x,be,V,J]),R.useEffect(()=>{if(!x)return;const ht=J.current;typeof ht!="function"&&U0(ht)&&ht.current!==Qt.current&&(be.setPositionReference(ht.current),Qt.current=ht.current)},[x,be,V,J]),R.useEffect(()=>{if(v&&x&&Se.domReference&&Se.floating)return O0(Se.domReference,Se.floating,ge,Ne)},[v,x,Se,ge,Ne]);const Yn=vn(De),Rs=Ww(a,Yn,ae),Gn=jr(De)||"center",Le=!!we.hide?.referenceHidden;Ae(()=>{k&&x&&Be&&N(Yn)},[k,x,Be,Yn]);const Fe=R.useMemo(()=>({position:"absolute",top:we.arrow?.y,left:we.arrow?.x}),[we.arrow]),ot=we.arrow?.centerOffset!==0;return R.useMemo(()=>({positionerStyles:Et,arrowStyles:Fe,arrowRef:ue,arrowUncentered:ot,side:Rs,align:Gn,physicalSide:Yn,anchorHidden:Le,refs:be,context:qe,isPositioned:Be,update:ge}),[Et,Fe,ue,ot,Rs,Gn,Yn,Le,be,qe,Be,ge])}function U0(t){return t!=null&&"current"in t}function Gu(t){return t==="starting"?VA:qt}const FN=R.forwardRef(function(o,r){const{render:a,className:l,anchor:c,positionMethod:f="absolute",side:d="top",align:m="center",sideOffset:p=0,alignOffset:y=0,collisionBoundary:g="clipping-ancestors",collisionPadding:v=5,arrowPadding:b=5,sticky:x=!1,disableAnchorTracking:w=!1,collisionAvoidance:E=dx,...C}=o,_=ol(),k=UN(),O=_.useState("open"),z=_.useState("mounted"),N=_.useState("trackCursorAxis"),j=_.useState("disableHoverablePopup"),D=_.useState("floatingRootContext"),Y=_.useState("instantType"),$=_.useState("transitionStatus"),Z=_.useState("hasViewport"),V=e1({anchor:c,positionMethod:f,floatingRootContext:D,mounted:z,side:d,sideOffset:p,align:m,alignOffset:y,collisionBoundary:g,collisionPadding:v,sticky:x,arrowPadding:b,disableAnchorTracking:w,keepMounted:k,collisionAvoidance:E,adaptiveOrigin:Z?GN:void 0}),J=R.useMemo(()=>{const H={};return(!O||N==="both"||j)&&(H.pointerEvents="none"),{role:"presentation",hidden:!z,style:{...V.positionerStyles,...H}}},[O,N,j,z,V.positionerStyles]),ne=R.useMemo(()=>({open:O,side:V.side,align:V.align,anchorHidden:V.anchorHidden,instant:N!=="none"?"tracking-cursor":Y}),[O,V.side,V.align,V.anchorHidden,N,Y]),ae=R.useMemo(()=>({...ne,arrowRef:V.arrowRef,arrowStyles:V.arrowStyles,arrowUncentered:V.arrowUncentered}),[ne,V.arrowRef,V.arrowStyles,V.arrowUncentered]),B=Mt("div",o,{state:ne,props:[J,Gu($),C],ref:[r,_.useStateSetter("positionerElement")],stateAttributesMapping:Es});return L.jsx(Zw.Provider,{value:ae,children:B})}),XN={...Es,...Bu},KN=R.forwardRef(function(o,r){const{className:a,render:l,...c}=o,f=ol(),{side:d,align:m}=$w(),p=f.useState("open"),y=f.useState("instantType"),g=f.useState("transitionStatus"),v=f.useState("popupProps"),b=f.useState("floatingRootContext");Iu({open:p,ref:f.context.popupRef,onComplete(){p&&f.context.onOpenChangeComplete?.(!0)}});const x=f.useState("disabled"),w=f.useState("closeDelay");return zw(b,{enabled:!x,closeDelay:w}),Mt("div",o,{state:{open:p,side:d,align:m,instant:y,transitionStatus:g},ref:[r,f.context.popupRef,f.useStateSetter("popupElement")],props:[v,Gu(g),c],stateAttributesMapping:XN})}),QN=R.forwardRef(function(o,r){const{className:a,render:l,...c}=o,d=ol().useState("instantType"),{open:m,arrowRef:p,side:y,align:g,arrowUncentered:v,arrowStyles:b}=$w();return Mt("div",o,{state:{open:m,side:y,align:g,uncentered:v,instant:d},ref:[r,p],props:[{style:b,"aria-hidden":!0},c],stateAttributesMapping:Es})}),ZN=function(o){const{delay:r,closeDelay:a,timeout:l=400}=o,c=R.useMemo(()=>({delay:r,closeDelay:a}),[r,a]),f=R.useMemo(()=>({open:r,close:a}),[r,a]);return L.jsx(Kw.Provider,{value:c,children:L.jsx(hk,{delay:f,timeoutMs:l,children:o.children})})};function $N({delay:t=0,...o}){return L.jsx(ZN,{"data-slot":"tooltip-provider",delay:t,...o})}function JN({...t}){return L.jsx(kN,{"data-slot":"tooltip",...t})}function WN({...t}){return L.jsx(PN,{"data-slot":"tooltip-trigger",...t})}function eL({className:t,side:o="top",sideOffset:r=4,align:a="center",alignOffset:l=0,children:c,...f}){return L.jsx(IN,{children:L.jsx(FN,{align:a,alignOffset:l,side:o,sideOffset:r,className:"isolate z-50",children:L.jsxs(KN,{"data-slot":"tooltip-content",className:ct("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 rounded-md px-3 py-1.5 text-xs data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 bg-foreground text-background z-50 w-fit max-w-xs origin-(--transform-origin)",t),...f,children:[c,L.jsx(QN,{className:"size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 bg-foreground fill-foreground z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const Ph=768;function tL(){const[t,o]=R.useState(void 0);return R.useEffect(()=>{const r=window.matchMedia(`(max-width: ${Ph-1}px)`),a=()=>{o(window.innerWidth<Ph)};return r.addEventListener("change",a),o(window.innerWidth<Ph),()=>r.removeEventListener("change",a)},[]),!!t}const nL="sidebar_state",oL=3600*24*7,rL="16rem",sL="18rem",aL="3rem",iL="b",t1=R.createContext(null);function Fu(){const t=R.useContext(t1);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function lL({defaultOpen:t=!0,open:o,onOpenChange:r,className:a,style:l,children:c,...f}){const d=tL(),[m,p]=R.useState(!1),[y,g]=R.useState(t),v=o??y,b=R.useCallback(C=>{const _=typeof C=="function"?C(v):C;r?r(_):g(_),document.cookie=`${nL}=${_}; path=/; max-age=${oL}`},[r,v]),x=R.useCallback(()=>d?p(C=>!C):b(C=>!C),[d,b,p]);R.useEffect(()=>{const C=_=>{_.key===iL&&(_.metaKey||_.ctrlKey)&&(_.preventDefault(),x())};return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[x]);const w=v?"expanded":"collapsed",E=R.useMemo(()=>({state:w,open:v,setOpen:b,isMobile:d,openMobile:m,setOpenMobile:p,toggleSidebar:x}),[w,v,b,d,m,p,x]);return L.jsx(t1.Provider,{value:E,children:L.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":rL,"--sidebar-width-icon":aL,...l},className:ct("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",a),...f,children:c})})}function cL({side:t="left",variant:o="sidebar",collapsible:r="offcanvas",className:a,children:l,dir:c,...f}){const{isMobile:d,state:m,openMobile:p,setOpenMobile:y}=Fu();return r==="none"?L.jsx("div",{"data-slot":"sidebar",className:ct("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",a),...f,children:l}):d?L.jsx(EN,{open:p,onOpenChange:y,...f,children:L.jsxs(CN,{dir:c,"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":sL},side:t,children:[L.jsxs(MN,{className:"sr-only",children:[L.jsx(ON,{children:"Sidebar"}),L.jsx(_N,{children:"Displays the mobile sidebar."})]}),L.jsx("div",{className:"flex h-full w-full flex-col",children:l})]})}):L.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":m,"data-collapsible":m==="collapsed"?r:"","data-variant":o,"data-side":t,"data-slot":"sidebar",children:[L.jsx("div",{"data-slot":"sidebar-gap",className:ct("transition-[width] duration-200 ease-linear relative w-(--sidebar-width) bg-transparent","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",o==="floating"||o==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),L.jsx("div",{"data-slot":"sidebar-container","data-side":t,className:ct("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex",o==="floating"||o==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...f,children:L.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:ring-sidebar-border group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 flex size-full flex-col",children:l})})]})}function uL({className:t,onClick:o,...r}){const{toggleSidebar:a}=Fu();return L.jsxs(Ax,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon-sm",className:ct(t),onClick:l=>{o?.(l),a()},...r,children:[L.jsx(bA,{}),L.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function fL({className:t,...o}){return L.jsx("main",{"data-slot":"sidebar-inset",className:ct("bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2 relative flex w-full flex-1 flex-col",t),...o})}function dL({className:t,...o}){return L.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:ct("gap-2 p-2 flex flex-col",t),...o})}function hL({className:t,...o}){return L.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:ct("no-scrollbar gap-0 flex min-h-0 flex-1 flex-col overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...o})}function fm({className:t,...o}){return L.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:ct("p-2 relative flex w-full min-w-0 flex-col",t),...o})}function pL({className:t,render:o,...r}){return ku({defaultTagName:"div",props:Po({className:ct("text-sidebar-foreground/70 ring-sidebar-ring h-8 rounded-md px-2 text-xs font-medium transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 flex shrink-0 items-center outline-hidden [&>svg]:shrink-0",t)},r),render:o,state:{slot:"sidebar-group-label",sidebar:"group-label"}})}function n1({className:t,...o}){return L.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:ct("text-sm w-full",t),...o})}function Xu({className:t,...o}){return L.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:ct("gap-0 flex w-full min-w-0 flex-col",t),...o})}function fs({className:t,...o}){return L.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:ct("group/menu-item relative",t),...o})}const mL=zp("ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground gap-2 rounded-md p-2 text-left text-sm transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! focus-visible:ring-2 data-active:font-medium peer/menu-button flex w-full items-center overflow-hidden outline-hidden group/menu-button disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background hover:bg-sidebar-accent hover:text-sidebar-accent-foreground shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Na({render:t,isActive:o=!1,variant:r="default",size:a="default",tooltip:l,className:c,...f}){const{isMobile:d,state:m}=Fu(),p=ku({defaultTagName:"button",props:Po({className:ct(mL({variant:r,size:a}),c)},f),render:l?WN:t,state:{slot:"sidebar-menu-button",sidebar:"menu-button",size:a,active:o}});return l?(typeof l=="string"&&(l={children:l}),L.jsxs(JN,{children:[p,L.jsx(eL,{side:"right",align:"center",hidden:m!=="collapsed"||d,...l})]})):p}function gL({className:t,render:o,showOnHover:r=!1,...a}){return ku({defaultTagName:"button",props:Po({className:ct("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 aspect-square w-5 rounded-md p-0 peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 focus-visible:ring-2 [&>svg]:size-4 flex items-center justify-center outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 md:after:hidden [&>svg]:shrink-0",r&&"peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 aria-expanded:opacity-100 md:opacity-0",t)},a),render:o,state:{slot:"sidebar-menu-action",sidebar:"menu-action"}})}class yL{ws=null;options;state="disconnected";reconnectAttempt=0;reconnectTimer=null;shouldReconnect=!0;constructor(o){this.options={reconnect:!0,reconnectDelay:1e3,maxReconnectDelay:3e4,...o}}connect(){if(!(this.state==="connected"||this.state==="connecting")){this.shouldReconnect=!0,this.setState("connecting");try{const o=new URL(this.options.url);o.searchParams.set("token",this.options.authToken),this.ws=new WebSocket(o.toString()),this.ws.onopen=()=>{this.reconnectAttempt=0,this.setState("connected")},this.ws.onmessage=r=>{try{const a=JSON.parse(r.data);this.options.onMessage(a)}catch(a){console.error("[ws] Failed to parse message:",a)}},this.ws.onerror=r=>{console.error("[ws] WebSocket error:",r),this.setState("error","Connection error")},this.ws.onclose=()=>{this.ws=null,this.shouldReconnect&&this.options.reconnect?this.scheduleReconnect():this.setState("disconnected")}}catch(o){const r=o instanceof Error?o.message:String(o);this.setState("error",r)}}}disconnect(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected")}send(o){if(this.state!=="connected"||!this.ws)throw new Error("WebSocket is not connected");this.ws.send(JSON.stringify(o))}getState(){return this.state}setState(o,r){this.state!==o&&(this.state=o,this.options.onStateChange(o,r))}scheduleReconnect(){if(this.reconnectTimer)return;const o=Math.min(this.options.reconnectDelay*2**this.reconnectAttempt,this.options.maxReconnectDelay);this.reconnectAttempt++,console.log(`[ws] Reconnecting in ${o}ms (attempt ${this.reconnectAttempt})...`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},o)}}class vL{ws;options;pendingRequests=new Map;requestIdCounter=0;constructor(o){this.options=o,this.ws=new yL({url:o.url,authToken:o.authToken,onMessage:r=>this.handleMessage(r),onStateChange:o.onStateChange})}connect(){this.ws.connect()}disconnect(){this.ws.disconnect();for(const[o,r]of this.pendingRequests.entries())r.reject(new Error("Connection closed")),this.pendingRequests.delete(o)}getConnectionState(){return this.ws.getState()}async newSession(o){const r=await this.sendCommand({type:"new_session",parentSession:o});return console.log("[clankie-client] newSession response:",r),r}async listSessions(){return await this.sendCommand({type:"list_sessions"})}async prompt(o,r,a){await this.sendCommand({type:"prompt",message:r,images:a},o)}async steer(o,r){await this.sendCommand({type:"steer",message:r},o)}async followUp(o,r){await this.sendCommand({type:"follow_up",message:r},o)}async abort(o){await this.sendCommand({type:"abort"},o)}async uploadAttachment(o,r,a,l){return await this.sendCommand({type:"upload_attachment",fileName:r,data:a,mimeType:l},o)}async getState(o){return await this.sendCommand({type:"get_state"},o)}async getMessages(o){return await this.sendCommand({type:"get_messages"},o)}async setModel(o,r,a){return await this.sendCommand({type:"set_model",provider:r,modelId:a},o)}async cycleModel(o){return await this.sendCommand({type:"cycle_model"},o)}async getAvailableModels(o){return await this.sendCommand({type:"get_available_models"},o)}async setThinkingLevel(o,r){await this.sendCommand({type:"set_thinking_level",level:r},o)}async cycleThinkingLevel(o){return await this.sendCommand({type:"cycle_thinking_level"},o)}async compact(o,r){return await this.sendCommand({type:"compact",customInstructions:r},o)}async getSessionStats(o){return await this.sendCommand({type:"get_session_stats"},o)}async getAuthProviders(){return await this.sendCommand({type:"get_auth_providers"})}async authLogin(o){return await this.sendCommand({type:"auth_login",providerId:o})}async authSetApiKey(o,r){await this.sendCommand({type:"auth_set_api_key",providerId:o,apiKey:r})}authLoginInput(o,r){const a={command:{type:"auth_login_input",loginFlowId:o,value:r}};this.ws.send(a)}authLoginCancel(o){const r={command:{type:"auth_login_cancel",loginFlowId:o}};this.ws.send(r)}async authLogout(o){await this.sendCommand({type:"auth_logout",providerId:o})}async getExtensions(o){return await this.sendCommand({type:"get_extensions"},o)}async getSkills(o){return await this.sendCommand({type:"get_skills"},o)}async installPackage(o,r,a){return await this.sendCommand({type:"install_package",source:r,local:a},o)}async reload(o){await this.sendCommand({type:"reload"},o)}handleMessage(o){if("type"in o&&o.type==="response"&&"id"in o){const r=o;if(!r.id)return;const a=this.pendingRequests.get(r.id);if(a){this.pendingRequests.delete(r.id),r.success?a.resolve(r.data):a.reject(new Error(r.error));return}return}if("sessionId"in o&&"event"in o){const{sessionId:r,event:a}=o;if(a.type==="response"&&a.id){const l=this.pendingRequests.get(a.id);if(l){this.pendingRequests.delete(a.id),a.success?l.resolve(a.data):l.reject(new Error(a.error));return}}if(r==="_auth"&&a.type==="auth_event"){this.options.onAuthEvent(a);return}a.type!=="auth_event"&&this.options.onEvent(r,a);return}console.warn("[clankie-client] Unknown message format:",o)}async sendCommand(o,r){if(this.getConnectionState()!=="connected")throw new Error("WebSocket is not connected");const a=`req-${++this.requestIdCounter}`,l={...r!==void 0&&{sessionId:r},command:{...o,id:a}};return new Promise((c,f)=>{this.pendingRequests.set(a,{resolve:c,reject:f}),this.ws.send(l),setTimeout(()=>{this.pendingRequests.has(a)&&(this.pendingRequests.delete(a),f(new Error("Request timeout")))},3e4)})}}const bL={providers:[],isLoadingProviders:!1,loginFlow:null},rl=new La(bL);function n4(t){rl.setState(o=>({...o,isLoadingProviders:t}))}function o4(t){rl.setState(o=>({...o,providers:t,isLoadingProviders:!1}))}function r4(t,o){rl.setState(r=>({...r,loginFlow:{loginFlowId:t,providerId:o,status:"idle"}}))}function SL(t){rl.setState(o=>{if(!o.loginFlow||o.loginFlow.loginFlowId!==t.loginFlowId)return o;const r={...o.loginFlow};switch(t.event){case"url":r.status="waiting_url",r.url=t.url,r.instructions=t.instructions;break;case"prompt":r.status="waiting_input",r.promptMessage=t.message,r.promptPlaceholder=t.placeholder;break;case"manual_input":r.showManualInput=!0;break;case"progress":r.status="in_progress",r.progressMessage=t.message;break;case"complete":r.status=t.success?"complete":"error",r.success=t.success,r.error=t.error;break}return{...o,loginFlow:r}})}function s4(){rl.setState(t=>({...t,loginFlow:null}))}const o1={messages:[],streamingContent:"",thinkingContent:"",currentMessageId:null},qo=new La(o1);function a4(t){const o=`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;qo.setState(r=>({...r,messages:[...r.messages,{id:o,role:"user",content:t,timestamp:Date.now()}]}))}function xL(){const t=`msg-${Date.now()}-${Math.random().toString(36).slice(2,9)}`;qo.setState(o=>({...o,currentMessageId:t,streamingContent:"",messages:[...o.messages,{id:t,role:"assistant",content:"",timestamp:Date.now(),isStreaming:!0}]}))}function wL(t){qo.setState(o=>o.currentMessageId?{...o,streamingContent:t,messages:o.messages.map(r=>r.id===o.currentMessageId?{...r,content:t,isStreaming:!0}:r)}:o)}function EL(){qo.setState(t=>({...t,streamingContent:"",thinkingContent:"",currentMessageId:null,messages:t.messages.map(o=>o.id===t.currentMessageId?{...o,isStreaming:!1,isThinking:!1}:o)}))}function RL(){qo.setState(t=>t.currentMessageId?{...t,thinkingContent:"",messages:t.messages.map(o=>o.id===t.currentMessageId?{...o,isThinking:!0}:o)}:t)}function TL(t){qo.setState(o=>o.currentMessageId?{...o,thinkingContent:t,messages:o.messages.map(r=>r.id===o.currentMessageId?{...r,thinkingContent:t}:r)}:o)}function CL(){qo.setState(t=>t.currentMessageId?{...t,messages:t.messages.map(o=>o.id===t.currentMessageId?{...o,isThinking:!1}:o)}:t)}function ML(t){const o=t.filter(r=>r.role==="user"||r.role==="assistant").map((r,a)=>{let l;return typeof r.content=="string"?l=r.content:Array.isArray(r.content)?l=r.content.filter(c=>c.type==="text").map(c=>c.text).join(`
30
30
 
31
- `);return{id:`msg-${a}`,role:r.role,content:l,timestamp:Date.now()-(t.length-a)*1e3}});qo.setState(r=>({...r,messages:o}))}function Uh(){qo.setState(()=>o1)}const r1={sessionId:null,model:null,availableModels:[],thinkingLevel:"medium",isStreaming:!1,isCompacting:!1,steeringMode:"one-at-a-time",followUpMode:"one-at-a-time",sessionName:void 0,autoCompactionEnabled:!1,messageCount:0},Yo=new La(r1);function $c(t){Yo.setState(o=>({...o,sessionId:t}))}function up(t){const{sessionId:o,...r}=t;Yo.setState(a=>({...a,...r}))}function fp(t){Yo.setState(o=>({...o,model:t}))}function H0(t){Yo.setState(o=>({...o,availableModels:t}))}function dp(t){Yo.setState(o=>({...o,thinkingLevel:t}))}function s1(t){Yo.setState(o=>({...o,sessionName:t}))}function V0(t){Yo.setState(o=>({...o,isStreaming:t}))}function q0(t){Yo.setState(o=>({...o,isCompacting:t}))}function ML(){Yo.setState(()=>r1)}const a1={sessions:[],activeSessionId:null},Bo=new La(a1);function Jc(t){Bo.setState(o=>o.sessions.some(r=>r.sessionId===t.sessionId)?(console.log(`[sessions-list] Skipping duplicate session: ${t.sessionId}`),o):(console.log(`[sessions-list] Adding session: ${t.sessionId}`,t),{...o,sessions:[...o.sessions,t]}))}function OL(t){Bo.setState(o=>({...o,sessions:o.sessions.filter(r=>r.sessionId!==t),activeSessionId:o.activeSessionId===t?null:o.activeSessionId}))}function Y0(t){console.log(`[sessions-list] Setting active session: ${t}`),Bo.setState(o=>({...o,activeSessionId:t}))}function _L(t){const o=Date.now();Bo.setState(r=>({...r,sessions:r.sessions.map(a=>a.sessionId===t?{...a,updatedAt:o}:a)}))}function G0(t,o){Bo.setState(r=>({...r,sessions:r.sessions.map(a=>a.sessionId===t?{...a,...o}:a)}))}function F0(){console.log("[sessions-list] Clearing all sessions"),Bo.setState(()=>a1)}function AL(t){return[...t].sort((o,r)=>{const a=o.updatedAt??o.createdAt;return(r.updatedAt??r.createdAt)-a})}class DL{ws=null;options;state="disconnected";reconnectAttempt=0;reconnectTimer=null;shouldReconnect=!0;constructor(o){this.options={reconnect:!0,reconnectDelay:1e3,maxReconnectDelay:3e4,...o}}connect(){if(!(this.state==="connected"||this.state==="connecting")){this.shouldReconnect=!0,this.setState("connecting");try{const o=new URL(this.options.url);o.searchParams.set("token",this.options.authToken),this.ws=new WebSocket(o.toString()),this.ws.onopen=()=>{this.reconnectAttempt=0,this.setState("connected")},this.ws.onmessage=r=>{try{const a=JSON.parse(r.data);this.options.onMessage(a)}catch(a){console.error("[ws] Failed to parse message:",a)}},this.ws.onerror=r=>{console.error("[ws] WebSocket error:",r),this.setState("error","Connection error")},this.ws.onclose=()=>{this.ws=null,this.shouldReconnect&&this.options.reconnect?this.scheduleReconnect():this.setState("disconnected")}}catch(o){const r=o instanceof Error?o.message:String(o);this.setState("error",r)}}}disconnect(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(),this.ws=null),this.setState("disconnected")}send(o){if(this.state!=="connected"||!this.ws)throw new Error("WebSocket is not connected");this.ws.send(JSON.stringify(o))}getState(){return this.state}setState(o,r){this.state!==o&&(this.state=o,this.options.onStateChange(o,r))}scheduleReconnect(){if(this.reconnectTimer)return;const o=Math.min(this.options.reconnectDelay*2**this.reconnectAttempt,this.options.maxReconnectDelay);this.reconnectAttempt++,console.log(`[ws] Reconnecting in ${o}ms (attempt ${this.reconnectAttempt})...`),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},o)}}class kL{ws;options;pendingRequests=new Map;requestIdCounter=0;constructor(o){this.options=o,this.ws=new DL({url:o.url,authToken:o.authToken,onMessage:r=>this.handleMessage(r),onStateChange:o.onStateChange})}connect(){this.ws.connect()}disconnect(){this.ws.disconnect();for(const[o,r]of this.pendingRequests.entries())r.reject(new Error("Connection closed")),this.pendingRequests.delete(o)}getConnectionState(){return this.ws.getState()}async newSession(o){const r=await this.sendCommand({type:"new_session",parentSession:o});return console.log("[clankie-client] newSession response:",r),r}async listSessions(){return await this.sendCommand({type:"list_sessions"})}async prompt(o,r,a){await this.sendCommand({type:"prompt",message:r,images:a},o)}async steer(o,r){await this.sendCommand({type:"steer",message:r},o)}async followUp(o,r){await this.sendCommand({type:"follow_up",message:r},o)}async abort(o){await this.sendCommand({type:"abort"},o)}async uploadAttachment(o,r,a,l){return await this.sendCommand({type:"upload_attachment",fileName:r,data:a,mimeType:l},o)}async getState(o){return await this.sendCommand({type:"get_state"},o)}async getMessages(o){return await this.sendCommand({type:"get_messages"},o)}async setModel(o,r,a){return await this.sendCommand({type:"set_model",provider:r,modelId:a},o)}async cycleModel(o){return await this.sendCommand({type:"cycle_model"},o)}async getAvailableModels(o){return await this.sendCommand({type:"get_available_models"},o)}async setThinkingLevel(o,r){await this.sendCommand({type:"set_thinking_level",level:r},o)}async cycleThinkingLevel(o){return await this.sendCommand({type:"cycle_thinking_level"},o)}async compact(o,r){return await this.sendCommand({type:"compact",customInstructions:r},o)}async getSessionStats(o){return await this.sendCommand({type:"get_session_stats"},o)}async getAuthProviders(){return await this.sendCommand({type:"get_auth_providers"})}async authLogin(o){return await this.sendCommand({type:"auth_login",providerId:o})}async authSetApiKey(o,r){await this.sendCommand({type:"auth_set_api_key",providerId:o,apiKey:r})}authLoginInput(o,r){const a={command:{type:"auth_login_input",loginFlowId:o,value:r}};this.ws.send(a)}authLoginCancel(o){const r={command:{type:"auth_login_cancel",loginFlowId:o}};this.ws.send(r)}async authLogout(o){await this.sendCommand({type:"auth_logout",providerId:o})}async getExtensions(o){return await this.sendCommand({type:"get_extensions"},o)}async getSkills(o){return await this.sendCommand({type:"get_skills"},o)}async installPackage(o,r,a){return await this.sendCommand({type:"install_package",source:r,local:a},o)}async reload(o){await this.sendCommand({type:"reload"},o)}handleMessage(o){if("type"in o&&o.type==="response"&&"id"in o){const r=o;if(!r.id)return;const a=this.pendingRequests.get(r.id);if(a){this.pendingRequests.delete(r.id),r.success?a.resolve(r.data):a.reject(new Error(r.error));return}return}if("sessionId"in o&&"event"in o){const{sessionId:r,event:a}=o;if(a.type==="response"&&a.id){const l=this.pendingRequests.get(a.id);if(l){this.pendingRequests.delete(a.id),a.success?l.resolve(a.data):l.reject(new Error(a.error));return}}if(r==="_auth"&&a.type==="auth_event"){this.options.onAuthEvent(a);return}a.type!=="auth_event"&&this.options.onEvent(r,a);return}console.warn("[clankie-client] Unknown message format:",o)}async sendCommand(o,r){if(this.getConnectionState()!=="connected")throw new Error("WebSocket is not connected");const a=`req-${++this.requestIdCounter}`,l={...r!==void 0&&{sessionId:r},command:{...o,id:a}};return new Promise((c,f)=>{this.pendingRequests.set(a,{resolve:c,reject:f}),this.ws.send(l),setTimeout(()=>{this.pendingRequests.has(a)&&(this.pendingRequests.delete(a),f(new Error("Request timeout")))},3e4)})}}const zL={providers:[],isLoadingProviders:!1,loginFlow:null},sl=new La(zL);function o4(t){sl.setState(o=>({...o,isLoadingProviders:t}))}function r4(t){sl.setState(o=>({...o,providers:t,isLoadingProviders:!1}))}function s4(t,o){sl.setState(r=>({...r,loginFlow:{loginFlowId:t,providerId:o,status:"idle"}}))}function NL(t){sl.setState(o=>{if(!o.loginFlow||o.loginFlow.loginFlowId!==t.loginFlowId)return o;const r={...o.loginFlow};switch(t.event){case"url":r.status="waiting_url",r.url=t.url,r.instructions=t.instructions;break;case"prompt":r.status="waiting_input",r.promptMessage=t.message,r.promptPlaceholder=t.placeholder;break;case"manual_input":r.showManualInput=!0;break;case"progress":r.status="in_progress",r.progressMessage=t.message;break;case"complete":r.status=t.success?"complete":"error",r.success=t.success,r.error=t.error;break}return{...o,loginFlow:r}})}function a4(){sl.setState(t=>({...t,loginFlow:null}))}function LL(t,o,r){if(o.type==="response"){console.log("[event-handlers] RPC response:",o);return}console.log(`[event-handlers] Received event for session ${t}:`,o.type,o);const a=t===r;switch((o.type==="model_changed"||o.type==="thinking_level_changed")&&console.log("[event-handlers] Event check:",{eventType:o.type,eventSessionId:t,activeSessionId:r,isActiveSession:a}),o.type){case"session_start":Jc({sessionId:t,title:void 0,messageCount:0,createdAt:Date.now()}),a&&$c(t);break;case"session_name_changed":a&&s1(o.name);break;case"model_changed":console.log("[event-handlers] model_changed event:",{sessionId:t,isActiveSession:a,model:o.model}),a&&fp(o.model);break;case"thinking_level_changed":a&&dp(o.level);break;case"state_update":G0(t,{messageCount:o.state.messageCount}),a&&up(o.state);break;case"agent_start":a&&V0(!0);break;case"agent_end":a&&V0(!1);break;case"message_start":a&&o.message?.role==="assistant"&&SL();break;case"message_update":{if(!a)break;const l=o.assistantMessageEvent;switch(l.type){case"text_delta":xL(l.partial?.content?.filter(c=>c.type==="text").map(c=>c.text).join("")??"");break;case"thinking_start":EL();break;case"thinking_delta":RL(l.partial?.content?.filter(c=>c.type==="thinking").map(c=>c.thinking).join("")??"");break;case"thinking_end":TL();break}break}case"message_end":if(_L(t),a){if(o.message?.role==="assistant")wL();else if(o.message?.role==="user"){const l=o.message.content?.filter(c=>c.type==="text").map(c=>c.text).join(" ");if(l){const c=l.substring(0,100);G0(t,{title:c})}}}break;case"turn_start":case"turn_end":break;case"tool_execution_start":a&&console.log("[event-handlers] Tool execution:",o.toolName);break;case"tool_execution_update":break;case"tool_execution_end":break;case"compact_start":case"auto_compaction_start":a&&q0(!0);break;case"compact_end":case"auto_compaction_end":a&&q0(!1);break;case"error":console.error("[event-handlers] Agent error:",o.error);break;default:console.log("[event-handlers] Unhandled event:",o)}}function jL(t){console.log("[event-handlers] Auth event:",t),NL(t)}class PL{client=null;connect(){if(this.client){console.warn("Client already connected");return}const{settings:o}=rl.state;if(!o.authToken){I0("error","Auth token is required");return}this.client=new kL({url:o.url,authToken:o.authToken,onEvent:(r,a)=>{const{activeSessionId:l}=Bo.state;LL(r,a,l)},onAuthEvent:r=>jL(r),onStateChange:(r,a)=>{I0(r,a),r==="connected"&&this.restoreOrCreateSession()}}),this.client.connect()}disconnect(){this.client&&(this.client.disconnect(),this.client=null),F0(),ML(),Uh()}async restoreOrCreateSession(){if(!this.client){console.error("[client-manager] Cannot restore session: not connected");return}try{await this.loadAllSessions();const o=localStorage.getItem("clankie-last-session-id");if(o){console.log(`[client-manager] Attempting to restore session: ${o}`);try{await this.switchSession(o),console.log(`[client-manager] Successfully restored session: ${o}`);return}catch(r){console.warn(`[client-manager] Failed to restore session ${o}, creating new:`,r),localStorage.removeItem("clankie-last-session-id")}}console.log("[client-manager] Creating new session"),await this.createNewSession()}catch(o){console.error("[client-manager] Failed to restore or create session:",o)}}async loadAllSessions(){if(!this.client){console.error("[client-manager] Cannot load sessions: not connected");return}try{const{sessions:o}=await this.client.listSessions();console.log(`[client-manager] Loaded ${o.length} sessions from server:`,o),F0();for(const r of o)console.log("[client-manager] Adding session to store:",r),Jc({sessionId:r.sessionId,title:r.title,messageCount:r.messageCount,createdAt:Date.now()})}catch(o){console.error("[client-manager] Failed to load sessions:",o)}}getClient(){return this.client}isConnected(){return this.client?.getConnectionState()==="connected"}async createNewSession(){if(!this.client)return console.error("[client-manager] Cannot create session: not connected"),null;try{console.log("[client-manager] Requesting new session from server...");const o=await this.client.newSession();if(console.log("[client-manager] Received new session result:",o),o.cancelled)return console.log("[client-manager] Session creation cancelled"),null;console.log(`[client-manager] Creating new session with ID: ${o.sessionId}`),Jc({sessionId:o.sessionId,title:void 0,messageCount:0,createdAt:Date.now()}),Y0(o.sessionId),$c(o.sessionId),localStorage.setItem("clankie-last-session-id",o.sessionId),Uh();try{const r=await this.client.getState(o.sessionId);fp(r.model),dp(r.thinkingLevel),up(r);const{models:a}=await this.client.getAvailableModels(o.sessionId);H0(a)}catch(r){console.error("[client-manager] Failed to fetch session state or models:",r)}return o.sessionId}catch(o){return console.error("[client-manager] Failed to create session:",o),null}}async switchSession(o){if(!this.client){console.error("[client-manager] Cannot switch session: not connected");return}try{Y0(o),$c(o),localStorage.setItem("clankie-last-session-id",o),Uh(),console.log(`[client-manager] Fetching messages for session: ${o}`);const{messages:r}=await this.client.getMessages(o);console.log(`[client-manager] Loaded ${r.length} messages for session ${o}`),CL(r);const a=await this.client.getState(o);$c(o),fp(a.model),dp(a.thinkingLevel),a.sessionName&&s1(a.sessionName),up(a);try{const{models:c}=await this.client.getAvailableModels(o);H0(c)}catch(c){console.error("[client-manager] Failed to fetch available models:",c)}const{sessions:l}=Bo.state;if(!l.some(c=>c.sessionId===o)){const c=[...r].reverse().find(d=>d.role==="user");let f;c?f=c.content?.filter(m=>m.type==="text").map(m=>m.text).join(" ")?.substring(0,100)||a.sessionName:f=a.sessionName,Jc({sessionId:o,title:f,messageCount:a.messageCount,createdAt:Date.now()})}console.log(`[client-manager] Switched to session ${o}`)}catch(r){throw console.error("[client-manager] Failed to switch session:",r),r}}}const hp=new PL;function UL(){const t=Ji(),o=async()=>{try{const r=await hp.createNewSession();r&&t({to:"/sessions/$sessionId",params:{sessionId:r}})}catch(r){console.error("[nav-main] Failed to create new session:",r)}};return L.jsx(fm,{children:L.jsx(n1,{children:L.jsx(Xu,{children:L.jsx(fs,{children:L.jsxs(Na,{tooltip:"Create Chat",className:"bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground active:bg-primary/90 active:text-primary-foreground duration-200 ease-linear",onClick:o,children:[L.jsx(hA,{}),L.jsx("span",{children:"Create Chat"})]})})})})})}const BL=zp("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function IL({className:t,variant:o="default",render:r,...a}){return ku({defaultTagName:"span",props:Po({className:ct(BL({variant:o}),t)},a),render:r,state:{slot:"badge",variant:o}})}function HL({...t}){const{status:o}=Mp(rl,a=>({status:a.status})),r={connected:{label:"Connected",variant:"default",className:"bg-green-500/10 text-green-500 border-green-500/20",dotColor:"bg-green-500"},connecting:{label:"Connecting",variant:"secondary",className:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20",dotColor:"bg-yellow-500"},disconnected:{label:"Disconnected",variant:"secondary",className:"bg-red-500/10 text-red-500 border-red-500/20",dotColor:"bg-red-500"},error:{label:"Error",variant:"destructive",className:"bg-red-500/10 text-red-500 border-red-500/20",dotColor:"bg-red-500"}}[o];return L.jsx(fm,{...t,children:L.jsx(n1,{children:L.jsxs(Xu,{children:[L.jsx(fs,{children:L.jsxs(Na,{render:L.jsx(Ki,{to:"/settings"}),children:[L.jsx(wA,{}),L.jsx("span",{children:"Settings"})]})}),L.jsx(fs,{children:L.jsxs(Na,{render:L.jsx(Ki,{to:"/extensions"}),children:[L.jsx(SA,{}),L.jsx("span",{children:"Extensions"})]})}),L.jsx(fs,{children:L.jsx("div",{className:"px-2 py-1.5",children:L.jsxs(IL,{variant:r.variant,className:`${r.className} w-full justify-start`,children:[L.jsx("div",{className:`size-2 rounded-full mr-2 ${r.dotColor}`}),r.label]})})})]})})})}const i1=R.createContext(void 0);function dm(t){const o=R.useContext(i1);if(o===void 0&&!t)throw new Error(tn(33));return o}const l1=R.createContext(void 0);function Go(t){const o=R.useContext(l1);if(o===void 0&&!t)throw new Error(tn(36));return o}const VL=R.createContext(void 0);function Ku(t=!0){const o=R.useContext(VL);if(o===void 0&&!t)throw new Error(tn(25));return o}function qL(t){const{closeOnClick:o,highlighted:r,id:a,nodeId:l,store:c,itemRef:f,itemMetadata:d}=t,{events:m}=c.useState("floatingTreeRoot"),p=Ku(!0),y=p!==void 0;return R.useMemo(()=>({id:a,role:"menuitem",tabIndex:r?0:-1,onMouseMove(g){l&&m.emit("itemhover",{nodeId:l,target:g.currentTarget})},onClick(g){o&&m.emit("close",{domEvent:g,reason:ew})},onMouseUp(g){if(p){const v=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,y&&v&&Math.abs(g.clientX-v.x)<=1&&Math.abs(g.clientY-v.y)<=1)return}f.current&&c.context.allowMouseUpTriggerRef.current&&(!y||g.button===2)&&(!d||d.type==="regular-item")&&f.current.click()}}),[o,r,a,m,l,c,f,p,y,d])}const YL={type:"regular-item"};function c1(t){const{closeOnClick:o,disabled:r=!1,highlighted:a,id:l,store:c,nativeButton:f,itemMetadata:d,nodeId:m}=t,p=R.useRef(null),{getButtonProps:y,buttonRef:g}=Pu({disabled:r,focusableWhenDisabled:!0,native:f}),v=qL({closeOnClick:o,highlighted:a,id:l,nodeId:m,store:c,itemRef:p,itemMetadata:d}),b=R.useCallback(w=>Po(v,{onMouseEnter(){d.type==="submenu-trigger"&&d.setActive()},onKeyUp(E){E.key===" "&&c.context.typingRef.current&&E.preventBaseUIHandler()}},w,y),[v,y,c,d]),x=Ma(p,g);return R.useMemo(()=>({getItemProps:b,itemRef:x}),[b,x])}const u1=R.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function GL(){return R.useContext(u1)}let FL=(function(t){return t[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t})({});function hm(t={}){const{label:o,metadata:r,textRef:a,indexGuessBehavior:l,index:c}=t,{register:f,unregister:d,subscribeMapChange:m,elementsRef:p,labelsRef:y,nextIndexRef:g}=GL(),v=R.useRef(-1),[b,x]=R.useState(c??(l===FL.GuessFromOrder?()=>{if(v.current===-1){const C=g.current;g.current+=1,v.current=C}return v.current}:-1)),w=R.useRef(null),E=R.useCallback(C=>{if(w.current=C,b!==-1&&C!==null&&(p.current[b]=C,y)){const _=o!==void 0;y.current[b]=_?o:a?.current?.textContent??C.textContent}},[b,p,y,o,a]);return Ae(()=>{if(c!=null)return;const C=w.current;if(C)return f(C,r),()=>{d(C)}},[c,f,d,r]),Ae(()=>{if(c==null)return m(C=>{const _=w.current?C.get(w.current)?.index:null;_!=null&&x(_)})},[c,m,x]),R.useMemo(()=>({ref:E,index:b}),[b,E])}const f1=R.createContext(void 0);function XL(){const t=R.useContext(f1);if(t===void 0)throw new Error(tn(31));return t}const KL=R.forwardRef(function(o,r){const{render:a,className:l,...c}=o,[f,d]=R.useState(void 0),m=R.useMemo(()=>({setLabelId:d}),[d]),p=Mt("div",o,{ref:r,props:{role:"group","aria-labelledby":f,...c}});return L.jsx(f1.Provider,{value:m,children:p})}),QL=R.forwardRef(function(o,r){const{className:a,render:l,id:c,...f}=o,d=xs(c),{setLabelId:m}=XL();return Ae(()=>(m(d),()=>{m(void 0)}),[m,d]),Mt("div",o,{ref:r,props:{id:d,role:"presentation",...f}})}),ZL=R.forwardRef(function(o,r){const{render:a,className:l,id:c,label:f,nativeButton:d=!1,disabled:m=!1,closeOnClick:p=!0,...y}=o,g=hm({label:f}),v=dm(!0),b=xs(c),{store:x}=Go(),w=x.useState("isActive",g.index),E=x.useState("itemProps"),{getItemProps:C,itemRef:_}=c1({closeOnClick:p,disabled:m,highlighted:w,id:b,store:x,nativeButton:d,nodeId:v?.nodeId,itemMetadata:YL});return Mt("div",o,{state:{disabled:m,highlighted:w},props:[E,y,C],ref:[_,r,g.ref]})}),$L=R.createContext(void 0);function JL(t){return R.useContext($L)}const WL={...Es,...Bu},e3=R.forwardRef(function(o,r){const{render:a,className:l,finalFocus:c,...f}=o,{store:d}=Go(),{side:m,align:p}=dm(),y=JL()!=null,g=d.useState("open"),v=d.useState("transitionStatus"),b=d.useState("popupProps"),x=d.useState("mounted"),w=d.useState("instantType"),E=d.useState("activeTriggerElement"),C=d.useState("parent"),_=d.useState("lastOpenChangeReason"),k=d.useState("rootId"),O=d.useState("floatingRootContext"),z=d.useState("floatingTreeRoot"),N=d.useState("closeDelay"),j=d.useState("activeTriggerElement"),D=C.type==="context-menu";Iu({open:g,ref:d.context.popupRef,onComplete(){g&&d.context.onOpenChangeComplete?.(!0)}}),R.useEffect(()=>{function ne(ae){d.setOpen(!1,Qe(ae.reason,ae.domEvent))}return z.events.on("close",ne),()=>{z.events.off("close",ne)}},[z.events,d]);const Y=d.useState("hoverEnabled"),$=d.useState("disabled");zw(O,{enabled:Y&&!$&&!D&&C.type!=="menubar",closeDelay:N});const Z={transitionStatus:v,side:m,align:p,open:g,nested:C.type==="menu",instant:w},V=Mt("div",o,{state:Z,ref:[r,d.context.popupRef],stateAttributesMapping:WL,props:[b,{onKeyDown(ne){y&&Vw.has(ne.key)&&ne.stopPropagation()}},Gu(v),f,{"data-rootownerid":k}]});let J=C.type===void 0||D;return(E||C.type==="menubar"&&_!==Xp)&&(J=!0),L.jsx(pw,{context:O,modal:D,disabled:!x,returnFocus:c===void 0?J:c,initialFocus:C.type!=="menu",restoreFocus:!0,externalTree:C.type!=="menubar"?z:void 0,previousFocusableElement:j,nextFocusableElement:C.type===void 0?d.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:C.type===void 0?d.context.beforeContentFocusGuardRef:void 0,children:V})}),d1=R.createContext(void 0);function t3(){const t=R.useContext(d1);if(t===void 0)throw new Error(tn(32));return t}const n3=R.forwardRef(function(o,r){const{keepMounted:a=!1,...l}=o,{store:c}=Go();return c.useState("mounted")||a?L.jsx(d1.Provider,{value:a,children:L.jsx(hw,{ref:r,...l})}):null});function o3(t){const{children:o,elementsRef:r,labelsRef:a,onMapChange:l}=t,c=Ce(l),f=R.useRef(0),d=Wt(s3).current,m=Wt(r3).current,[p,y]=R.useState(0),g=R.useRef(p),v=Ce((C,_)=>{m.set(C,_??null),g.current+=1,y(g.current)}),b=Ce(C=>{m.delete(C),g.current+=1,y(g.current)}),x=R.useMemo(()=>{const C=new Map;return Array.from(m.keys()).filter(k=>k.isConnected).sort(a3).forEach((k,O)=>{const z=m.get(k)??{};C.set(k,{...z,index:O})}),C},[m,p]);Ae(()=>{if(typeof MutationObserver!="function"||x.size===0)return;const C=new MutationObserver(_=>{const k=new Set,O=z=>k.has(z)?k.delete(z):k.add(z);_.forEach(z=>{z.removedNodes.forEach(O),z.addedNodes.forEach(O)}),k.size===0&&(g.current+=1,y(g.current))});return x.forEach((_,k)=>{k.parentElement&&C.observe(k.parentElement,{childList:!0})}),()=>{C.disconnect()}},[x]),Ae(()=>{g.current===p&&(r.current.length!==x.size&&(r.current.length=x.size),a&&a.current.length!==x.size&&(a.current.length=x.size),f.current=x.size),c(x)},[c,x,r,a,p]),Ae(()=>()=>{r.current=[]},[r]),Ae(()=>()=>{a&&(a.current=[])},[a]);const w=Ce(C=>(d.add(C),()=>{d.delete(C)}));Ae(()=>{d.forEach(C=>C(x))},[d,x]);const E=R.useMemo(()=>({register:v,unregister:b,subscribeMapChange:w,elementsRef:r,labelsRef:a,nextIndexRef:f}),[v,b,w,r,a,f]);return L.jsx(u1.Provider,{value:E,children:o})}function r3(){return new Map}function s3(){return new Set}function a3(t,o){const r=t.compareDocumentPosition(o);return r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS?1:0}const i3=R.forwardRef(function(o,r){const{anchor:a,positionMethod:l="absolute",className:c,render:f,side:d,align:m,sideOffset:p=0,alignOffset:y=0,collisionBoundary:g="clipping-ancestors",collisionPadding:v=5,arrowPadding:b=5,sticky:x=!1,disableAnchorTracking:w=!1,collisionAvoidance:E=qA,...C}=o,{store:_}=Go(),k=t3(),O=Ku(!0),z=_.useState("parent"),N=_.useState("floatingRootContext"),j=_.useState("floatingTreeRoot"),D=_.useState("mounted"),Y=_.useState("open"),$=_.useState("modal"),Z=_.useState("activeTriggerElement"),V=_.useState("transitionStatus"),J=_.useState("lastOpenChangeReason"),ne=_.useState("floatingNodeId"),ae=_.useState("floatingParentNodeId");let B=a,H=p,G=y,ce=m,W=E;z.type==="context-menu"&&(B=a??z.context?.anchor,ce=ce??"start",!d&&ce!=="center"&&(G=o.alignOffset??2,H=o.sideOffset??-5));let P=d,X=ce;z.type==="menu"?(P=P??"inline-end",X=X??"start",W=o.collisionAvoidance??dx):z.type==="menubar"&&(P=P??"bottom",X=X??"start");const le=z.type==="context-menu",re=e1({anchor:B,floatingRootContext:N,positionMethod:O?"fixed":l,mounted:D,side:P,sideOffset:H,align:X,alignOffset:G,arrowPadding:le?0:b,collisionBoundary:g,collisionPadding:v,sticky:x,nodeId:ne,keepMounted:k,disableAnchorTracking:w,collisionAvoidance:W,shiftCrossAxis:le&&!("side"in W&&W.side==="flip"),externalTree:j}),ue=R.useMemo(()=>{const je={};return Y||(je.pointerEvents="none"),{role:"presentation",hidden:!D,style:{...re.positionerStyles,...je}}},[Y,D,re.positionerStyles]);R.useEffect(()=>{function je(te){te.open&&(te.parentNodeId===ne&&_.set("hoverEnabled",!1),te.nodeId!==ne&&te.parentNodeId===_.select("floatingParentNodeId")&&_.setOpen(!1,Qe(Xc)))}return j.events.on("menuopenchange",je),()=>{j.events.off("menuopenchange",je)}},[_,j.events,ne]),R.useEffect(()=>{if(_.select("floatingParentNodeId")==null)return;function je(te){if(te.open||te.nodeId!==_.select("floatingParentNodeId"))return;const me=te.reason??Xc;_.setOpen(!1,Qe(me))}return j.events.on("menuopenchange",je),()=>{j.events.off("menuopenchange",je)}},[j.events,_]),R.useEffect(()=>{function je(te){!Y||te.nodeId!==_.select("floatingParentNodeId")||te.target&&Z&&Z!==te.target&&_.setOpen(!1,Qe(Xc))}return j.events.on("itemhover",je),()=>{j.events.off("itemhover",je)}},[j.events,Y,Z,_]),R.useEffect(()=>{const je={open:Y,nodeId:ne,parentNodeId:ae,reason:_.select("lastOpenChangeReason")};j.events.emit("menuopenchange",je)},[j.events,Y,_,ne,ae]);const he={open:Y,side:re.side,align:re.align,anchorHidden:re.anchorHidden,nested:z.type==="menu"},ve=R.useMemo(()=>({side:re.side,align:re.align,arrowRef:re.arrowRef,arrowUncentered:re.arrowUncentered,arrowStyles:re.arrowStyles,nodeId:re.context.nodeId}),[re.side,re.align,re.arrowRef,re.arrowUncentered,re.arrowStyles,re.context.nodeId]),Me=Mt("div",o,{state:he,stateAttributesMapping:Es,ref:[r,_.useStateSetter("positionerElement")],props:[ue,Gu(V),C]}),fe=D&&z.type!=="menu"&&(z.type!=="menubar"&&$&&J!==sn||z.type==="menubar"&&z.context.modal);let ze=null;return z.type==="menubar"?ze=z.context.contentElement:z.type===void 0&&(ze=Z),L.jsxs(i1.Provider,{value:ve,children:[fe&&L.jsx(Yw,{ref:z.type==="context-menu"||z.type==="nested-context-menu"?z.context.internalBackdropRef:null,inert:qw(!Y),cutout:ze}),L.jsx(uk,{id:ne,children:L.jsx(o3,{elementsRef:_.context.itemDomElements,labelsRef:_.context.itemLabels,children:Me})})]})}),l3=R.createContext(null);function h1(t){return R.useContext(l3)}const c3={...rm,disabled:_e(t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled),modal:_e(t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0)),allowMouseEnter:_e(t=>t.allowMouseEnter),stickIfOpen:_e(t=>t.stickIfOpen),parent:_e(t=>t.parent),rootId:_e(t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId),activeIndex:_e(t=>t.activeIndex),isActive:_e((t,o)=>t.activeIndex===o),hoverEnabled:_e(t=>t.hoverEnabled),instantType:_e(t=>t.instantType),lastOpenChangeReason:_e(t=>t.openChangeReason),floatingTreeRoot:_e(t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot),floatingNodeId:_e(t=>t.floatingNodeId),floatingParentNodeId:_e(t=>t.floatingParentNodeId),itemProps:_e(t=>t.itemProps),closeDelay:_e(t=>t.closeDelay),keyboardEventRelay:_e(t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")})};class pm extends qu{constructor(o){super({...u3(),...o},{positionerRef:R.createRef(),popupRef:R.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:R.createRef(),beforeContentFocusGuardRef:R.createRef(),onOpenChangeComplete:void 0,triggerElements:new tl},c3),this.unsubscribeParentListener=this.observe("parent",r=>{if(this.unsubscribeParentListener?.(),r.type==="menu"){this.unsubscribeParentListener=r.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=r.store.context.allowMouseUpTriggerRef;return}r.type!==void 0&&(this.context.allowMouseUpTriggerRef=r.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(o,r){this.state.floatingRootContext.context.events.emit("setOpen",{open:o,eventDetails:r})}static useStore(o,r){const a=Wt(()=>new pm(r)).current;return o??a}unsubscribeParentListener=null}function u3(){return{...om(),disabled:!1,modal:!0,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Qp,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:qt,keyboardEventRelay:void 0,closeDelay:0}}const p1=R.createContext(void 0);function m1(){return R.useContext(p1)}const g1=Wp(function(o){const{children:r,open:a,onOpenChange:l,onOpenChangeComplete:c,defaultOpen:f=!1,disabled:d=!1,modal:m,loopFocus:p=!0,orientation:y="vertical",actionsRef:g,closeParentOnEsc:v=!1,handle:b,triggerId:x,defaultTriggerId:w=null,highlightItemOnHover:E=!0}=o,C=Ku(!0),_=Go(!0),k=h1(!0),O=m1(),z=R.useMemo(()=>O&&_?{type:"menu",store:_.store}:k?{type:"menubar",context:k}:C&&!_?{type:"context-menu",context:C}:{type:void 0},[C,_,k,O]),N=pm.useStore(b?.store,{open:f,openProp:a,activeTriggerId:w,triggerIdProp:x,parent:z});cm(()=>{a===void 0&&N.state.open===!1&&f===!0&&N.update({open:!0,activeTriggerId:w})}),N.useControlledProp("openProp",a),N.useControlledProp("triggerIdProp",x),N.useContextCallback("onOpenChangeComplete",c);const j=N.useState("floatingTreeRoot"),D=aw(j),Y=Vo();Ae(()=>{C&&!_?N.update({parent:{type:"context-menu",context:C},floatingNodeId:D,floatingParentNodeId:Y}):_&&N.update({floatingNodeId:D,floatingParentNodeId:Y})},[C,_,D,Y,N]);const $=N.useState("open"),Z=N.useState("activeTriggerElement"),V=N.useState("positionerElement"),J=N.useState("hoverEnabled"),ne=N.useState("modal"),ae=N.useState("disabled"),B=N.useState("lastOpenChangeReason"),H=N.useState("parent"),G=N.useState("activeIndex"),ce=N.useState("payload"),W=N.useState("floatingParentNodeId"),P=R.useRef(null),X=W!=null;let le;N.useSyncedValues({disabled:d,modal:H.type===void 0?m:void 0,rootId:Ss()});const{openMethod:re,triggerProps:ue,reset:he}=Fw($);tm(N);const{forceUnmount:ve}=nm($,N,()=>{N.update({allowMouseEnter:!1,stickIfOpen:!0}),he()}),Me=R.useRef(H.type!=="context-menu"),fe=qn();R.useEffect(()=>{if($||(P.current=null),H.type==="context-menu"){if(!$){fe.clear(),Me.current=!1;return}fe.start(500,()=>{Me.current=!0})}},[fe,$,H.type]),Gw($&&ne&&B!==sn&&re!=="touch",V),Ae(()=>{!$&&!J&&N.set("hoverEnabled",!0)},[$,J,N]);const ze=R.useRef(!0),je=qn(),te=Ce((Le,Fe)=>{const ot=Fe.reason;if($===Le&&Fe.trigger===Z&&B===ot||(Fe.preventUnmountOnClose=()=>{N.set("preventUnmountingOnClose",!0)},!Le&&Fe.trigger==null&&(Fe.trigger=Z??void 0),l?.(Le,Fe),Fe.isCanceled))return;const ht={open:Le,nativeEvent:Fe.event,reason:Fe.reason,nested:X};le?.emit("openchange",ht);const Rt=Fe.event;if(Le===!1&&Rt?.type==="click"&&Rt.pointerType==="touch"&&!ze.current)return;if(!Le&&G!==null){const cn=N.context.itemDomElements.current[G];queueMicrotask(()=>{cn?.setAttribute("tabindex","-1")})}Le&&ot===xa?(ze.current=!1,je.start(300,()=>{ze.current=!0})):(ze.current=!0,je.clear());const nn=(ot===Aa||ot===ew)&&Rt.detail===0&&Rt?.isTrusted,Nt=!Le&&(ot===Hu||ot==null),It={open:Le,openChangeReason:ot};P.current=Fe.event??null;const _n=Fe.trigger?.id??null;(_n||Le)&&(It.activeTriggerId=_n,It.activeTriggerElement=Fe.trigger??null),N.update(It),H.type==="menubar"&&(ot===xa||ot===Da||ot===sn||ot===Fc||ot===Xc)?N.set("instantType","group"):nn||Nt?N.set("instantType",nn?"click":"dismiss"):N.set("instantType",void 0)}),me=R.useCallback(Le=>{const Fe=Qe(Le);return Fe.preventUnmountOnClose=()=>{N.set("preventUnmountingOnClose",!0)},Fe},[N]),pe=R.useCallback(()=>{N.setOpen(!1,me(Kp))},[N,me]);R.useImperativeHandle(g,()=>({unmount:ve,close:pe}),[ve,pe]);let Ne;H.type==="context-menu"&&(Ne=H.context),R.useImperativeHandle(Ne?.positionerRef,()=>V,[V]),R.useImperativeHandle(Ne?.actionsRef,()=>({setOpen:te}),[te]);const be=sm({popupStore:N,onOpenChange:te});le=be.context.events,R.useEffect(()=>{const Le=({open:Fe,eventDetails:ot})=>te(Fe,ot);return le.on("setOpen",Le),()=>{le?.off("setOpen",Le)}},[le,te]);const Se=Jp(be,{enabled:!ae,bubbles:{escapeKey:v&&H.type==="menu"},outsidePress(){return H.type!=="context-menu"||P.current?.type==="contextmenu"?!0:Me.current},externalTree:X?j:void 0}),ye=Nw(be,{role:"menu"}),de=Jw(),we=R.useCallback(Le=>{N.select("activeIndex")!==Le&&N.set("activeIndex",Le)},[N]),ge=Zz(be,{enabled:!ae,listRef:N.context.itemDomElements,activeIndex:G,nested:H.type!==void 0,loopFocus:p,orientation:y,parentOrientation:H.type==="menubar"?H.context.orientation:void 0,rtl:de==="rtl",disabledIndices:Zh,onNavigate:we,openOnArrowKeyDown:H.type!=="context-menu",externalTree:X?j:void 0,focusItemOnHover:E}),De=R.useCallback(Le=>{N.context.typingRef.current=Le},[N]),qe=Jz(be,{listRef:N.context.itemLabels,activeIndex:G,resetMs:BA,onMatch:Le=>{$&&Le!==G&&N.set("activeIndex",Le)},onTypingChange:De}),{getReferenceProps:Be,getFloatingProps:Ot,getItemProps:He,getTriggerProps:Je}=nl([Se,ye,ge,qe]),Pe=R.useMemo(()=>{const Le=Po(Be(),{onMouseMove(){N.set("allowMouseEnter",!0)}},ue);return delete Le.role,Le},[Be,N,ue]),Et=R.useMemo(()=>{const Le=Je();if(!Le)return Le;const Fe=Po(Le,ue);return delete Fe.role,delete Fe["aria-controls"],Fe},[Je,ue]),Qt=R.useMemo(()=>Ot({onMouseMove(){N.set("allowMouseEnter",!0),H.type==="menu"&&N.set("hoverEnabled",!1)},onClick(){N.select("hoverEnabled")&&N.set("hoverEnabled",!1)},onKeyDown(Le){const Fe=N.select("keyboardEventRelay");Fe&&!Le.isPropagationStopped()&&Fe(Le)}}),[Ot,H.type,N]),Yn=R.useMemo(()=>He(),[He]);N.useSyncedValues({floatingRootContext:be,activeTriggerProps:Pe,inactiveTriggerProps:Et,popupProps:Qt,itemProps:Yn});const Rs=R.useMemo(()=>({store:N,parent:z}),[N,z]),Gn=L.jsx(l1.Provider,{value:Rs,children:typeof r=="function"?r({payload:ce}):r});return H.type===void 0||H.type==="context-menu"?L.jsx(fk,{externalTree:j,children:Gn}):Gn});function f3(t){const o=Go().store,r=R.useMemo(()=>({parentMenu:o}),[o]);return L.jsx(p1.Provider,{value:r,children:L.jsx(g1,{...t})})}function d3(t){const o=t.getBoundingClientRect(),r=window.getComputedStyle(t,"::before"),a=window.getComputedStyle(t,"::after");if(!(r.content!=="none"||a.content!=="none"))return o;const c=parseFloat(r.width)||0,f=parseFloat(r.height)||0,d=parseFloat(a.width)||0,m=parseFloat(a.height)||0,p=Math.max(o.width,c,d),y=Math.max(o.height,f,m),g=p-o.width,v=y-o.height;return{left:o.left-g/2,right:o.right+g/2,top:o.top-v/2,bottom:o.bottom+v/2}}function h3(t={}){const{highlightItemOnHover:o,highlightedIndex:r,onHighlightedIndexChange:a}=jp(),{ref:l,index:c}=hm(t),f=r===c,d=R.useRef(null),m=Ma(l,d);return{compositeProps:R.useMemo(()=>({tabIndex:f?0:-1,onFocus(){a(c)},onMouseMove(){const y=d.current;if(!o||!y)return;const g=y.hasAttribute("disabled")||y.ariaDisabled==="true";!f&&!g&&y.focus()}}),[f,a,c,o]),compositeRef:m,index:c}}function p3(t){const{render:o,className:r,state:a=qt,props:l=Zh,refs:c=Zh,metadata:f,stateAttributesMapping:d,tag:m="div",...p}=t,{compositeProps:y,compositeRef:g}=h3({metadata:f});return Mt(m,t,{state:a,ref:[...c,g],props:[y,...l,p],stateAttributesMapping:d})}function y1(t){if(St(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid")??void 0;if(!ro(t))return y1(lo(t))}function m3(t){const{enabled:o=!0,mouseDownAction:r,open:a}=t,l=R.useRef(!1);return R.useMemo(()=>o?{onMouseDown:c=>{(r==="open"&&!a||r==="close"&&a)&&(l.current=!0,at(c.currentTarget).addEventListener("click",()=>{l.current=!1},{once:!0}))},onClick:c=>{l.current&&(l.current=!1,c.preventBaseUIHandler())}}:qt,[o,r,a])}const Bc=2,g3=Mw(function(o,r){const{render:a,className:l,disabled:c=!1,nativeButton:f=!0,id:d,openOnHover:m,delay:p=100,closeDelay:y=0,handle:g,payload:v,...b}=o,x=Go(!0),w=g?.store??x?.store;if(!w)throw new Error(tn(85));const E=xs(d),C=w.useState("isTriggerActive",E),_=w.useState("floatingRootContext"),k=w.useState("isOpenedByTrigger",E),O=R.useRef(null),z=v3(),N=jp(!0),j=Pr(),D=R.useMemo(()=>j??new Qp,[j]),Y=aw(D),$=Vo(),{registerTrigger:Z,isMountedByThisTrigger:V}=Aw(E,O,w,{payload:v,closeDelay:y,parent:z,floatingTreeRoot:D,floatingNodeId:Y,floatingParentNodeId:$,keyboardEventRelay:N?.relayKeyboardEvent}),J=z.type==="menubar",ne=w.useState("disabled"),ae=c||ne||J&&z.context.disabled,{getButtonProps:B,buttonRef:H}=Pu({disabled:ae,native:f});R.useEffect(()=>{!k&&z.type===void 0&&(w.context.allowMouseUpTriggerRef.current=!1)},[w,k,z.type]);const G=R.useRef(null),ce=qn(),W=Ce(Se=>{if(!G.current)return;ce.clear(),w.context.allowMouseUpTriggerRef.current=!1;const ye=Se.target;if(Ye(G.current,ye)||Ye(w.select("positionerElement"),ye)||ye===G.current||ye!=null&&y1(ye)===w.select("rootId"))return;const de=d3(G.current);Se.clientX>=de.left-Bc&&Se.clientX<=de.right+Bc&&Se.clientY>=de.top-Bc&&Se.clientY<=de.bottom+Bc||D.events.emit("close",{domEvent:Se,reason:$D})});R.useEffect(()=>{k&&w.select("lastOpenChangeReason")===sn&&at(G.current).addEventListener("mouseup",W,{once:!0})},[k,W,w]);const P=J&&z.context.hasSubmenuOpen,le=im(_,{enabled:(m??P)&&!ae&&z.type!=="context-menu"&&(!J||P&&!V),handleClose:lm({blockPointerEvents:!J}),mouseOnly:!0,move:!1,restMs:z.type===void 0?p:void 0,delay:{close:y},triggerElementRef:O,externalTree:D,isActiveTrigger:C}),re=y3(k,w.select("lastOpenChangeReason")),ue=mw(_,{enabled:!ae&&z.type!=="context-menu",event:k&&J?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:z.type===void 0?re:!1}),he=Dw(_,{enabled:!ae&&P}),ve=m3({open:k,enabled:J,mouseDownAction:"open"}),Me=nl([ue,he]),fe={disabled:ae,open:k},ze=w.useState("triggerProps",V),je=[G,r,H,Z,O],te=[Me.getReferenceProps(),le??qt,ze,{"aria-haspopup":"menu",id:E,onMouseDown:Se=>{if(w.select("open"))return;ce.start(200,()=>{w.context.allowMouseUpTriggerRef.current=!0}),at(Se.currentTarget).addEventListener("mouseup",W,{once:!0})}},J?{role:"menuitem"}:{},ve,b,B],me=R.useRef(null),pe=Ce(Se=>{io.flushSync(()=>{w.setOpen(!1,Qe(Da,Se.nativeEvent,Se.currentTarget))}),qD(me.current)?.focus()}),Ne=Ce(Se=>{const ye=w.select("positionerElement");if(ye&&Sa(Se,ye))w.context.beforeContentFocusGuardRef.current?.focus();else{io.flushSync(()=>{w.setOpen(!1,Qe(Da,Se.nativeEvent,Se.currentTarget))});let de=VD(w.context.triggerFocusTargetRef.current||O.current);for(;de!==null&&Ye(ye,de);){const we=de;if(de=Yp(de),de===we)break}de?.focus()}}),be=Mt("button",o,{enabled:!J,stateAttributesMapping:g0,state:fe,ref:je,props:te});return J?L.jsx(p3,{tag:"button",render:a,className:l,state:fe,refs:je,props:te,stateAttributesMapping:g0}):k?L.jsxs(R.Fragment,{children:[L.jsx(za,{ref:me,onFocus:pe},`${E}-pre-focus-guard`),L.jsx(R.Fragment,{children:be},E),L.jsx(za,{ref:w.context.triggerFocusTargetRef,onFocus:Ne},`${E}-post-focus-guard`)]}):L.jsx(R.Fragment,{children:be},E)});function y3(t,o){const r=qn(),[a,l]=R.useState(!1);return Ae(()=>{t&&o==="trigger-hover"?(l(!0),r.start(IA,()=>{l(!1)})):t||(r.clear(),l(!1))},[t,o,r]),a}function v3(){const t=Ku(!0),o=Go(!0),r=h1();return R.useMemo(()=>r?{type:"menubar",context:r}:t&&!o?{type:"context-menu",context:t}:{type:void 0},[t,o,r])}const b3=R.forwardRef(function(o,r){const{render:a,className:l,label:c,id:f,nativeButton:d=!1,openOnHover:m=!0,delay:p=100,closeDelay:y=0,disabled:g=!1,...v}=o,b=hm(),x=dm(),{store:w}=Go(),E=xs(f),C=w.useState("open"),_=w.useState("floatingRootContext"),k=w.useState("floatingTreeRoot"),O=_w(E,w),z=R.useCallback(ue=>{const he=O(ue);return ue!==null&&w.select("open")&&w.select("activeTriggerId")==null&&w.update({activeTriggerId:E,activeTriggerElement:ue,closeDelay:y}),he},[O,y,w,E]),N=R.useRef(null),j=R.useCallback(ue=>{N.current=ue,w.set("activeTriggerElement",ue)},[w]),D=m1();if(!D?.parentMenu)throw new Error(tn(37));w.useSyncedValue("closeDelay",y);const Y=D.parentMenu,$=Y.useState("itemProps"),Z=Y.useState("isActive",b.index),V=R.useMemo(()=>({type:"submenu-trigger",setActive(){Y.set("activeIndex",b.index)}}),[Y,b.index]),J=w.useState("disabled"),ne=g||J,{getItemProps:ae,itemRef:B}=c1({closeOnClick:!1,disabled:ne,highlighted:Z,id:E,store:w,nativeButton:d,itemMetadata:V,nodeId:x?.nodeId}),H=w.useState("hoverEnabled"),G=Y.useState("allowMouseEnter"),ce=im(_,{enabled:H&&m&&!ne,handleClose:lm({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:p,delay:G?{open:p,close:y}:0,triggerElementRef:N,externalTree:k}),W=mw(_,{enabled:!ne,event:"mousedown",toggle:!m,ignoreMouse:m,stickIfOpen:!1}),P=nl([W]),X=w.useState("triggerProps",!0);return delete X.id,Mt("div",o,{state:{disabled:ne,highlighted:Z,open:C},stateAttributesMapping:nw,props:[P.getReferenceProps(),ce,X,$,{tabIndex:C||Z?0:-1,onBlur(){Z&&Y.set("activeIndex",null)}},v,ae],ref:[r,b.ref,B,z,j]})});function S3({...t}){return L.jsx(g1,{"data-slot":"dropdown-menu",...t})}function x3({...t}){return L.jsx(g3,{"data-slot":"dropdown-menu-trigger",...t})}function v1({align:t="start",alignOffset:o=0,side:r="bottom",sideOffset:a=4,className:l,...c}){return L.jsx(n3,{children:L.jsx(i3,{className:"isolate z-50 outline-none",align:t,alignOffset:o,side:r,sideOffset:a,children:L.jsx(e3,{"data-slot":"dropdown-menu-content",className:ct("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden",l),...c})})})}function i4({...t}){return L.jsx(KL,{"data-slot":"dropdown-menu-group",...t})}function l4({className:t,inset:o,...r}){return L.jsx(QL,{"data-slot":"dropdown-menu-label","data-inset":o,className:ct("text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:pl-7",t),...r})}function X0({className:t,inset:o,variant:r="default",...a}){return L.jsx(ZL,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":r,className:ct("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...a})}function c4({...t}){return L.jsx(f3,{"data-slot":"dropdown-menu-sub",...t})}function u4({className:t,inset:o,children:r,...a}){return L.jsxs(b3,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:ct("focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 data-popup-open:bg-accent data-popup-open:text-accent-foreground flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...a,children:[r,L.jsx(fA,{className:"ml-auto"})]})}function f4({align:t="start",alignOffset:o=-3,side:r="right",sideOffset:a=0,className:l,...c}){return L.jsx(v1,{"data-slot":"dropdown-menu-sub-content",className:ct("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-[96px] rounded-lg p-1 shadow-lg ring-1 duration-100 w-auto",l),align:t,alignOffset:o,side:r,sideOffset:a,...c})}function w3({className:t,...o}){return L.jsx(WD,{"data-slot":"dropdown-menu-separator",className:ct("bg-border -mx-1 my-1 h-px",t),...o})}function E3(){const t=Ji(),{isMobile:o}=Fu(),{sessions:r,activeSessionId:a}=Mp(Bo,d=>({sessions:d.sessions??[],activeSessionId:d.activeSessionId})),l=d=>{t({to:"/sessions/$sessionId",params:{sessionId:d}})},c=d=>{OL(d)},f=AL(r||[]).slice(0,15);return L.jsxs(fm,{className:"group-data-[collapsible=icon]:hidden",children:[L.jsx(hL,{children:"Recent Sessions"}),L.jsx(Xu,{children:f.length===0?L.jsx(fs,{children:L.jsx(Na,{disabled:!0,children:L.jsx("span",{className:"text-sidebar-foreground/70",children:"No sessions yet"})})}):f.map(d=>L.jsxs(fs,{children:[L.jsxs(Na,{isActive:d.sessionId===a,onClick:()=>l(d.sessionId),children:[L.jsx(Fh,{}),L.jsx("span",{className:"truncate",children:d.title||`Session ${d.sessionId.slice(0,8)}`})]}),L.jsxs(S3,{children:[L.jsxs(x3,{render:L.jsx(mL,{showOnHover:!0,className:"aria-expanded:bg-muted"}),children:[L.jsx(mA,{}),L.jsx("span",{className:"sr-only",children:"More"})]}),L.jsxs(v1,{className:"w-32",side:o?"bottom":"right",align:o?"end":"start",children:[L.jsxs(X0,{onClick:()=>l(d.sessionId),children:[L.jsx(Fh,{}),L.jsx("span",{children:"Open"})]}),L.jsx(w3,{}),L.jsxs(X0,{variant:"destructive",onClick:()=>c(d.sessionId),children:[L.jsx(RA,{}),L.jsx("span",{children:"Delete"})]})]})]})]},d.sessionId))})]})}function R3({...t}){return L.jsxs(lL,{collapsible:"offcanvas",...t,children:[L.jsx(fL,{children:L.jsx(Xu,{children:L.jsx(fs,{children:L.jsxs(Na,{size:"lg",render:L.jsx(Ki,{to:"/"}),children:[L.jsx(Fh,{className:"size-5"}),L.jsx("span",{className:"text-base font-semibold",children:"clankie"})]})})})}),L.jsxs(dL,{children:[L.jsx(UL,{}),L.jsx(E3,{}),L.jsx(HL,{className:"mt-auto"})]})]})}const T3="/assets/styles-D2oHO1JL.css",al=E_({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{title:"clankie — Web UI"}],links:[{rel:"stylesheet",href:T3}]}),component:C3});function C3(){return R.useEffect(()=>{if(typeof window<"u"){const r=new URLSearchParams(window.location.search).get("token");r&&(bL({authToken:r}),window.history.replaceState(null,"",window.location.pathname),console.log("[root] Detected auth token from URL, saved to localStorage"))}const{settings:t}=rl.state;t.authToken&&!hp.isConnected()&&hp.connect()},[]),L.jsx(M3,{children:L.jsx(ZN,{children:L.jsxs(iL,{children:[L.jsx(R3,{variant:"inset"}),L.jsx(uL,{children:L.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[L.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b px-4",children:L.jsx(cL,{})}),L.jsx(WS,{})]})})]})})})}function M3({children:t}){return L.jsxs("html",{lang:"en",className:"dark",children:[L.jsx("head",{children:L.jsx(U_,{})}),L.jsxs("body",{children:[t,L.jsx(B_,{})]})]})}const O3="modulepreload",_3=function(t){return"/"+t},K0={},Qu=function(o,r,a){let l=Promise.resolve();if(r&&r.length>0){let m=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),d=f?.nonce||f?.getAttribute("nonce");l=m(r.map(p=>{if(p=_3(p),p in K0)return;K0[p]=!0;const y=p.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const v=document.createElement("link");if(v.rel=y?"stylesheet":O3,y||(v.as="script"),v.crossOrigin="",v.href=p,d&&v.setAttribute("nonce",d),document.head.appendChild(v),y)return new Promise((b,x)=>{v.addEventListener("load",b),v.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(f){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=f,window.dispatchEvent(d),!d.defaultPrevented)throw f}return l.then(f=>{for(const d of f||[])d.status==="rejected"&&c(d.reason);return o().catch(c)})},A3=()=>Qu(()=>import("./settings-Bv8oeIho.js"),__vite__mapDeps([0,1,2])),D3=Ca("/settings")({component:Du(A3,"component")}),k3=()=>Qu(()=>import("./extensions-DC620Nmx.js"),__vite__mapDeps([3,1,2])),z3=Ca("/extensions")({component:Du(k3,"component")}),N3=()=>Qu(()=>import("./index-DurjG9O_.js"),[]),L3=Ca("/")({component:Du(N3,"component")}),j3=()=>Qu(()=>import("./sessions._sessionId-BJazw9EJ.js"),__vite__mapDeps([4,2])),P3=Ca("/sessions/$sessionId")({component:Du(j3,"component")}),U3=D3.update({id:"/settings",path:"/settings",getParentRoute:()=>al}),B3=z3.update({id:"/extensions",path:"/extensions",getParentRoute:()=>al}),I3=L3.update({id:"/",path:"/",getParentRoute:()=>al}),H3=P3.update({id:"/sessions/$sessionId",path:"/sessions/$sessionId",getParentRoute:()=>al}),V3={IndexRoute:I3,ExtensionsRoute:B3,SettingsRoute:U3,SessionsSessionIdRoute:H3},q3=al._addFileChildren(V3),Y3=()=>D_({routeTree:q3,scrollRestoration:!0,defaultPreloadStaleTime:0});async function G3(){const t=await Y3();let o;return o=[],window.__TSS_START_OPTIONS__={serializationAdapters:o},o.push(rA),t.options.serializationAdapters&&o.push(...t.options.serializationAdapters),t.update({basepath:"",serializationAdapters:o}),t.state.matches.length||await H_(t),t}async function F3(){const t=await G3();return window.$_TSR?.h(),t}let Bh;function X3(){return Bh||(Bh=F3()),L.jsx(t_,{promise:Bh,children:t=>L.jsx(N_,{router:t})})}R.startTransition(()=>{IR.hydrateRoot(document,L.jsx(R.StrictMode,{children:L.jsx(X3,{})}))});export{l4 as $,wA as A,Ax as B,tn as C,vN as D,qt as E,xs as F,Ce as G,Ae as H,st as I,io as J,Zn as K,Ki as L,at as M,fx as N,Mt as O,SA as P,Qe as Q,Fp as R,La as S,zp as T,Ji as U,Yo as V,S3 as W,CA as X,x3 as Y,v1 as Z,i4 as _,Wt as a,w3 as a0,c4 as a1,u4 as a2,f4 as a3,X0 as a4,dp as a5,fp as a6,n4 as a7,DR as a8,qo as a9,P3 as aa,gN as b,Ho as c,tw as d,iN as e,ct as f,xN as g,lk as h,ik as i,L as j,lN as k,ak as l,Mp as m,sl as n,a4 as o,hp as p,rl as q,R as r,bL as s,o4 as t,ws as u,r4 as v,Bo as w,H0 as x,IL as y,s4 as z};
31
+ `):l="",{id:`msg-${a}`,role:r.role,content:l,timestamp:Date.now()-(t.length-a)*1e3}});qo.setState(r=>({...r,messages:o}))}function Uh(){qo.setState(()=>o1)}const r1={sessionId:null,model:null,availableModels:[],thinkingLevel:"medium",isStreaming:!1,isCompacting:!1,steeringMode:"one-at-a-time",followUpMode:"one-at-a-time",sessionName:void 0,autoCompactionEnabled:!1,messageCount:0},Yo=new La(r1);function $c(t){Yo.setState(o=>({...o,sessionId:t}))}function up(t){const{sessionId:o,...r}=t;Yo.setState(a=>({...a,...r}))}function fp(t){Yo.setState(o=>({...o,model:t}))}function B0(t){Yo.setState(o=>({...o,availableModels:t}))}function dp(t){Yo.setState(o=>({...o,thinkingLevel:t}))}function s1(t){Yo.setState(o=>({...o,sessionName:t}))}function I0(t){Yo.setState(o=>({...o,isStreaming:t}))}function H0(t){Yo.setState(o=>({...o,isCompacting:t}))}function OL(){Yo.setState(()=>r1)}const a1={sessions:[],activeSessionId:null},Bo=new La(a1);function Jc(t){Bo.setState(o=>o.sessions.some(r=>r.sessionId===t.sessionId)?(console.log(`[sessions-list] Skipping duplicate session: ${t.sessionId}`),o):(console.log(`[sessions-list] Adding session: ${t.sessionId}`,t),{...o,sessions:[...o.sessions,t]}))}function _L(t){Bo.setState(o=>({...o,sessions:o.sessions.filter(r=>r.sessionId!==t),activeSessionId:o.activeSessionId===t?null:o.activeSessionId}))}function V0(t){console.log(`[sessions-list] Setting active session: ${t}`),Bo.setState(o=>({...o,activeSessionId:t}))}function AL(t){const o=Date.now();Bo.setState(r=>({...r,sessions:r.sessions.map(a=>a.sessionId===t?{...a,updatedAt:o}:a)}))}function q0(t,o){Bo.setState(r=>({...r,sessions:r.sessions.map(a=>a.sessionId===t?{...a,...o}:a)}))}function Y0(){console.log("[sessions-list] Clearing all sessions"),Bo.setState(()=>a1)}function DL(t){return[...t].sort((o,r)=>{const a=o.updatedAt??o.createdAt;return(r.updatedAt??r.createdAt)-a})}function kL(t,o,r){if(o.type==="response"){console.log("[event-handlers] RPC response:",o);return}console.log(`[event-handlers] Received event for session ${t}:`,o.type,o);const a=t===r;switch((o.type==="model_changed"||o.type==="thinking_level_changed")&&console.log("[event-handlers] Event check:",{eventType:o.type,eventSessionId:t,activeSessionId:r,isActiveSession:a}),o.type){case"session_start":Jc({sessionId:t,title:void 0,messageCount:0,createdAt:Date.now()}),a&&$c(t);break;case"session_name_changed":a&&s1(o.name);break;case"model_changed":console.log("[event-handlers] model_changed event:",{sessionId:t,isActiveSession:a,model:o.model}),a&&fp(o.model);break;case"thinking_level_changed":a&&dp(o.level);break;case"state_update":q0(t,{messageCount:o.state.messageCount}),a&&up(o.state);break;case"agent_start":a&&I0(!0);break;case"agent_end":a&&I0(!1);break;case"message_start":a&&o.message?.role==="assistant"&&xL();break;case"message_update":{if(!a)break;const l=o.assistantMessageEvent;switch(l.type){case"text_delta":wL(l.partial?.content?.filter(c=>c.type==="text").map(c=>c.text).join("")??"");break;case"thinking_start":RL();break;case"thinking_delta":TL(l.partial?.content?.filter(c=>c.type==="thinking").map(c=>c.thinking).join("")??"");break;case"thinking_end":CL();break}break}case"message_end":if(AL(t),a){if(o.message?.role==="assistant")EL();else if(o.message?.role==="user"){const l=o.message.content?.filter(c=>c.type==="text").map(c=>c.text).join(" ");if(l){const c=l.substring(0,100);q0(t,{title:c})}}}break;case"turn_start":case"turn_end":break;case"tool_execution_start":a&&console.log("[event-handlers] Tool execution:",o.toolName);break;case"tool_execution_update":break;case"tool_execution_end":break;case"compact_start":case"auto_compaction_start":a&&H0(!0);break;case"compact_end":case"auto_compaction_end":a&&H0(!1);break;case"error":console.error("[event-handlers] Agent error:",o.error);break;default:console.log("[event-handlers] Unhandled event:",o)}}function zL(t){console.log("[event-handlers] Auth event:",t),SL(t)}function NL(){if(typeof window>"u")return"ws://localhost:3100";const t=window.location.protocol==="https:"?"wss:":"ws:",o=window.location.host;return o.startsWith("localhost:3000")||o.startsWith("127.0.0.1:3000")?"ws://localhost:3100":`${t}//${o}`}const G0={url:NL(),authToken:""};function LL(){if(typeof window>"u")return G0;try{const t=localStorage.getItem("clankie-connection");if(t)return JSON.parse(t)}catch(t){console.error("Failed to load connection settings:",t)}return G0}function jL(t){if(!(typeof window>"u"))try{localStorage.setItem("clankie-connection",JSON.stringify(t))}catch(o){console.error("Failed to save connection settings:",o)}}const sl=new La({settings:LL(),status:"disconnected",error:void 0});function PL(t){sl.setState(o=>{const r={...o.settings,...t};return jL(r),{...o,settings:r}})}function F0(t,o){sl.setState(r=>({...r,status:t,error:o}))}class UL{client=null;connect(){if(this.client){console.warn("Client already connected");return}const{settings:o}=sl.state;if(!o.authToken){F0("error","Auth token is required");return}this.client=new vL({url:o.url,authToken:o.authToken,onEvent:(r,a)=>{const{activeSessionId:l}=Bo.state;kL(r,a,l)},onAuthEvent:r=>zL(r),onStateChange:(r,a)=>{F0(r,a),r==="connected"&&this.restoreOrCreateSession()}}),this.client.connect()}disconnect(){this.client&&(this.client.disconnect(),this.client=null),Y0(),OL(),Uh()}async restoreOrCreateSession(){if(!this.client){console.error("[client-manager] Cannot restore session: not connected");return}try{await this.loadAllSessions();const o=localStorage.getItem("clankie-last-session-id");if(o){console.log(`[client-manager] Attempting to restore session: ${o}`);try{await this.switchSession(o),console.log(`[client-manager] Successfully restored session: ${o}`);return}catch(r){console.warn(`[client-manager] Failed to restore session ${o}, creating new:`,r),localStorage.removeItem("clankie-last-session-id")}}console.log("[client-manager] Creating new session"),await this.createNewSession()}catch(o){console.error("[client-manager] Failed to restore or create session:",o)}}async loadAllSessions(){if(!this.client){console.error("[client-manager] Cannot load sessions: not connected");return}try{const{sessions:o}=await this.client.listSessions();console.log(`[client-manager] Loaded ${o.length} sessions from server:`,o),Y0();for(const r of o)console.log("[client-manager] Adding session to store:",r),Jc({sessionId:r.sessionId,title:r.title,messageCount:r.messageCount,createdAt:Date.now()})}catch(o){console.error("[client-manager] Failed to load sessions:",o)}}getClient(){return this.client}isConnected(){return this.client?.getConnectionState()==="connected"}async createNewSession(){if(!this.client)return console.error("[client-manager] Cannot create session: not connected"),null;try{console.log("[client-manager] Requesting new session from server...");const o=await this.client.newSession();if(console.log("[client-manager] Received new session result:",o),o.cancelled)return console.log("[client-manager] Session creation cancelled"),null;console.log(`[client-manager] Creating new session with ID: ${o.sessionId}`),Jc({sessionId:o.sessionId,title:void 0,messageCount:0,createdAt:Date.now()}),V0(o.sessionId),$c(o.sessionId),localStorage.setItem("clankie-last-session-id",o.sessionId),Uh();try{const r=await this.client.getState(o.sessionId);fp(r.model),dp(r.thinkingLevel),up(r);const{models:a}=await this.client.getAvailableModels(o.sessionId);B0(a)}catch(r){console.error("[client-manager] Failed to fetch session state or models:",r)}return o.sessionId}catch(o){return console.error("[client-manager] Failed to create session:",o),null}}async switchSession(o){if(!this.client){console.error("[client-manager] Cannot switch session: not connected");return}try{V0(o),$c(o),localStorage.setItem("clankie-last-session-id",o),Uh(),console.log(`[client-manager] Fetching messages for session: ${o}`);const{messages:r}=await this.client.getMessages(o);console.log(`[client-manager] Loaded ${r.length} messages for session ${o}`),ML(r);const a=await this.client.getState(o);$c(o),fp(a.model),dp(a.thinkingLevel),a.sessionName&&s1(a.sessionName),up(a);try{const{models:c}=await this.client.getAvailableModels(o);B0(c)}catch(c){console.error("[client-manager] Failed to fetch available models:",c)}const{sessions:l}=Bo.state;if(!l.some(c=>c.sessionId===o)){const c=[...r].reverse().find(d=>d.role==="user");let f;if(c){let d;typeof c.content=="string"?d=c.content:Array.isArray(c.content)&&(d=c.content.filter(m=>m.type==="text").map(m=>m.text).join(" ")),f=d?.substring(0,100)||a.sessionName}else f=a.sessionName;Jc({sessionId:o,title:f,messageCount:a.messageCount,createdAt:Date.now()})}console.log(`[client-manager] Switched to session ${o}`)}catch(r){throw console.error("[client-manager] Failed to switch session:",r),r}}}const hp=new UL;function BL(){const t=Ji(),o=async()=>{try{const r=await hp.createNewSession();r&&t({to:"/sessions/$sessionId",params:{sessionId:r}})}catch(r){console.error("[nav-main] Failed to create new session:",r)}};return L.jsx(fm,{children:L.jsx(n1,{children:L.jsx(Xu,{children:L.jsx(fs,{children:L.jsxs(Na,{tooltip:"Create Chat",className:"bg-primary text-primary-foreground hover:bg-primary/90 hover:text-primary-foreground active:bg-primary/90 active:text-primary-foreground duration-200 ease-linear",onClick:o,children:[L.jsx(pA,{}),L.jsx("span",{children:"Create Chat"})]})})})})})}const IL=zp("h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function HL({className:t,variant:o="default",render:r,...a}){return ku({defaultTagName:"span",props:Po({className:ct(IL({variant:o}),t)},a),render:r,state:{slot:"badge",variant:o}})}function VL({...t}){const{status:o}=Mp(sl,a=>({status:a.status})),r={connected:{label:"Connected",variant:"default",className:"bg-green-500/10 text-green-500 border-green-500/20",dotColor:"bg-green-500"},connecting:{label:"Connecting",variant:"secondary",className:"bg-yellow-500/10 text-yellow-500 border-yellow-500/20",dotColor:"bg-yellow-500"},disconnected:{label:"Disconnected",variant:"secondary",className:"bg-red-500/10 text-red-500 border-red-500/20",dotColor:"bg-red-500"},error:{label:"Error",variant:"destructive",className:"bg-red-500/10 text-red-500 border-red-500/20",dotColor:"bg-red-500"}}[o];return L.jsx(fm,{...t,children:L.jsx(n1,{children:L.jsxs(Xu,{children:[L.jsx(fs,{children:L.jsxs(Na,{render:L.jsx(Ki,{to:"/settings"}),children:[L.jsx(EA,{}),L.jsx("span",{children:"Settings"})]})}),L.jsx(fs,{children:L.jsxs(Na,{render:L.jsx(Ki,{to:"/extensions"}),children:[L.jsx(xA,{}),L.jsx("span",{children:"Extensions"})]})}),L.jsx(fs,{children:L.jsx("div",{className:"px-2 py-1.5",children:L.jsxs(HL,{variant:r.variant,className:`${r.className} w-full justify-start`,children:[L.jsx("div",{className:`size-2 rounded-full mr-2 ${r.dotColor}`}),r.label]})})})]})})})}const i1=R.createContext(void 0);function dm(t){const o=R.useContext(i1);if(o===void 0&&!t)throw new Error(tn(33));return o}const l1=R.createContext(void 0);function Go(t){const o=R.useContext(l1);if(o===void 0&&!t)throw new Error(tn(36));return o}const qL=R.createContext(void 0);function Ku(t=!0){const o=R.useContext(qL);if(o===void 0&&!t)throw new Error(tn(25));return o}function YL(t){const{closeOnClick:o,highlighted:r,id:a,nodeId:l,store:c,itemRef:f,itemMetadata:d}=t,{events:m}=c.useState("floatingTreeRoot"),p=Ku(!0),y=p!==void 0;return R.useMemo(()=>({id:a,role:"menuitem",tabIndex:r?0:-1,onMouseMove(g){l&&m.emit("itemhover",{nodeId:l,target:g.currentTarget})},onClick(g){o&&m.emit("close",{domEvent:g,reason:ew})},onMouseUp(g){if(p){const v=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,y&&v&&Math.abs(g.clientX-v.x)<=1&&Math.abs(g.clientY-v.y)<=1)return}f.current&&c.context.allowMouseUpTriggerRef.current&&(!y||g.button===2)&&(!d||d.type==="regular-item")&&f.current.click()}}),[o,r,a,m,l,c,f,p,y,d])}const GL={type:"regular-item"};function c1(t){const{closeOnClick:o,disabled:r=!1,highlighted:a,id:l,store:c,nativeButton:f,itemMetadata:d,nodeId:m}=t,p=R.useRef(null),{getButtonProps:y,buttonRef:g}=Pu({disabled:r,focusableWhenDisabled:!0,native:f}),v=YL({closeOnClick:o,highlighted:a,id:l,nodeId:m,store:c,itemRef:p,itemMetadata:d}),b=R.useCallback(w=>Po(v,{onMouseEnter(){d.type==="submenu-trigger"&&d.setActive()},onKeyUp(E){E.key===" "&&c.context.typingRef.current&&E.preventBaseUIHandler()}},w,y),[v,y,c,d]),x=Ma(p,g);return R.useMemo(()=>({getItemProps:b,itemRef:x}),[b,x])}const u1=R.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function FL(){return R.useContext(u1)}let XL=(function(t){return t[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t})({});function hm(t={}){const{label:o,metadata:r,textRef:a,indexGuessBehavior:l,index:c}=t,{register:f,unregister:d,subscribeMapChange:m,elementsRef:p,labelsRef:y,nextIndexRef:g}=FL(),v=R.useRef(-1),[b,x]=R.useState(c??(l===XL.GuessFromOrder?()=>{if(v.current===-1){const C=g.current;g.current+=1,v.current=C}return v.current}:-1)),w=R.useRef(null),E=R.useCallback(C=>{if(w.current=C,b!==-1&&C!==null&&(p.current[b]=C,y)){const _=o!==void 0;y.current[b]=_?o:a?.current?.textContent??C.textContent}},[b,p,y,o,a]);return Ae(()=>{if(c!=null)return;const C=w.current;if(C)return f(C,r),()=>{d(C)}},[c,f,d,r]),Ae(()=>{if(c==null)return m(C=>{const _=w.current?C.get(w.current)?.index:null;_!=null&&x(_)})},[c,m,x]),R.useMemo(()=>({ref:E,index:b}),[b,E])}const f1=R.createContext(void 0);function KL(){const t=R.useContext(f1);if(t===void 0)throw new Error(tn(31));return t}const QL=R.forwardRef(function(o,r){const{render:a,className:l,...c}=o,[f,d]=R.useState(void 0),m=R.useMemo(()=>({setLabelId:d}),[d]),p=Mt("div",o,{ref:r,props:{role:"group","aria-labelledby":f,...c}});return L.jsx(f1.Provider,{value:m,children:p})}),ZL=R.forwardRef(function(o,r){const{className:a,render:l,id:c,...f}=o,d=xs(c),{setLabelId:m}=KL();return Ae(()=>(m(d),()=>{m(void 0)}),[m,d]),Mt("div",o,{ref:r,props:{id:d,role:"presentation",...f}})}),$L=R.forwardRef(function(o,r){const{render:a,className:l,id:c,label:f,nativeButton:d=!1,disabled:m=!1,closeOnClick:p=!0,...y}=o,g=hm({label:f}),v=dm(!0),b=xs(c),{store:x}=Go(),w=x.useState("isActive",g.index),E=x.useState("itemProps"),{getItemProps:C,itemRef:_}=c1({closeOnClick:p,disabled:m,highlighted:w,id:b,store:x,nativeButton:d,nodeId:v?.nodeId,itemMetadata:GL});return Mt("div",o,{state:{disabled:m,highlighted:w},props:[E,y,C],ref:[_,r,g.ref]})}),JL=R.createContext(void 0);function WL(t){return R.useContext(JL)}const e3={...Es,...Bu},t3=R.forwardRef(function(o,r){const{render:a,className:l,finalFocus:c,...f}=o,{store:d}=Go(),{side:m,align:p}=dm(),y=WL()!=null,g=d.useState("open"),v=d.useState("transitionStatus"),b=d.useState("popupProps"),x=d.useState("mounted"),w=d.useState("instantType"),E=d.useState("activeTriggerElement"),C=d.useState("parent"),_=d.useState("lastOpenChangeReason"),k=d.useState("rootId"),O=d.useState("floatingRootContext"),z=d.useState("floatingTreeRoot"),N=d.useState("closeDelay"),j=d.useState("activeTriggerElement"),D=C.type==="context-menu";Iu({open:g,ref:d.context.popupRef,onComplete(){g&&d.context.onOpenChangeComplete?.(!0)}}),R.useEffect(()=>{function ne(ae){d.setOpen(!1,Qe(ae.reason,ae.domEvent))}return z.events.on("close",ne),()=>{z.events.off("close",ne)}},[z.events,d]);const Y=d.useState("hoverEnabled"),$=d.useState("disabled");zw(O,{enabled:Y&&!$&&!D&&C.type!=="menubar",closeDelay:N});const Z={transitionStatus:v,side:m,align:p,open:g,nested:C.type==="menu",instant:w},V=Mt("div",o,{state:Z,ref:[r,d.context.popupRef],stateAttributesMapping:e3,props:[b,{onKeyDown(ne){y&&Vw.has(ne.key)&&ne.stopPropagation()}},Gu(v),f,{"data-rootownerid":k}]});let J=C.type===void 0||D;return(E||C.type==="menubar"&&_!==Xp)&&(J=!0),L.jsx(pw,{context:O,modal:D,disabled:!x,returnFocus:c===void 0?J:c,initialFocus:C.type!=="menu",restoreFocus:!0,externalTree:C.type!=="menubar"?z:void 0,previousFocusableElement:j,nextFocusableElement:C.type===void 0?d.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:C.type===void 0?d.context.beforeContentFocusGuardRef:void 0,children:V})}),d1=R.createContext(void 0);function n3(){const t=R.useContext(d1);if(t===void 0)throw new Error(tn(32));return t}const o3=R.forwardRef(function(o,r){const{keepMounted:a=!1,...l}=o,{store:c}=Go();return c.useState("mounted")||a?L.jsx(d1.Provider,{value:a,children:L.jsx(hw,{ref:r,...l})}):null});function r3(t){const{children:o,elementsRef:r,labelsRef:a,onMapChange:l}=t,c=Ce(l),f=R.useRef(0),d=Wt(a3).current,m=Wt(s3).current,[p,y]=R.useState(0),g=R.useRef(p),v=Ce((C,_)=>{m.set(C,_??null),g.current+=1,y(g.current)}),b=Ce(C=>{m.delete(C),g.current+=1,y(g.current)}),x=R.useMemo(()=>{const C=new Map;return Array.from(m.keys()).filter(k=>k.isConnected).sort(i3).forEach((k,O)=>{const z=m.get(k)??{};C.set(k,{...z,index:O})}),C},[m,p]);Ae(()=>{if(typeof MutationObserver!="function"||x.size===0)return;const C=new MutationObserver(_=>{const k=new Set,O=z=>k.has(z)?k.delete(z):k.add(z);_.forEach(z=>{z.removedNodes.forEach(O),z.addedNodes.forEach(O)}),k.size===0&&(g.current+=1,y(g.current))});return x.forEach((_,k)=>{k.parentElement&&C.observe(k.parentElement,{childList:!0})}),()=>{C.disconnect()}},[x]),Ae(()=>{g.current===p&&(r.current.length!==x.size&&(r.current.length=x.size),a&&a.current.length!==x.size&&(a.current.length=x.size),f.current=x.size),c(x)},[c,x,r,a,p]),Ae(()=>()=>{r.current=[]},[r]),Ae(()=>()=>{a&&(a.current=[])},[a]);const w=Ce(C=>(d.add(C),()=>{d.delete(C)}));Ae(()=>{d.forEach(C=>C(x))},[d,x]);const E=R.useMemo(()=>({register:v,unregister:b,subscribeMapChange:w,elementsRef:r,labelsRef:a,nextIndexRef:f}),[v,b,w,r,a,f]);return L.jsx(u1.Provider,{value:E,children:o})}function s3(){return new Map}function a3(){return new Set}function i3(t,o){const r=t.compareDocumentPosition(o);return r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS?1:0}const l3=R.forwardRef(function(o,r){const{anchor:a,positionMethod:l="absolute",className:c,render:f,side:d,align:m,sideOffset:p=0,alignOffset:y=0,collisionBoundary:g="clipping-ancestors",collisionPadding:v=5,arrowPadding:b=5,sticky:x=!1,disableAnchorTracking:w=!1,collisionAvoidance:E=YA,...C}=o,{store:_}=Go(),k=n3(),O=Ku(!0),z=_.useState("parent"),N=_.useState("floatingRootContext"),j=_.useState("floatingTreeRoot"),D=_.useState("mounted"),Y=_.useState("open"),$=_.useState("modal"),Z=_.useState("activeTriggerElement"),V=_.useState("transitionStatus"),J=_.useState("lastOpenChangeReason"),ne=_.useState("floatingNodeId"),ae=_.useState("floatingParentNodeId");let B=a,H=p,G=y,ce=m,W=E;z.type==="context-menu"&&(B=a??z.context?.anchor,ce=ce??"start",!d&&ce!=="center"&&(G=o.alignOffset??2,H=o.sideOffset??-5));let P=d,X=ce;z.type==="menu"?(P=P??"inline-end",X=X??"start",W=o.collisionAvoidance??dx):z.type==="menubar"&&(P=P??"bottom",X=X??"start");const le=z.type==="context-menu",re=e1({anchor:B,floatingRootContext:N,positionMethod:O?"fixed":l,mounted:D,side:P,sideOffset:H,align:X,alignOffset:G,arrowPadding:le?0:b,collisionBoundary:g,collisionPadding:v,sticky:x,nodeId:ne,keepMounted:k,disableAnchorTracking:w,collisionAvoidance:W,shiftCrossAxis:le&&!("side"in W&&W.side==="flip"),externalTree:j}),ue=R.useMemo(()=>{const je={};return Y||(je.pointerEvents="none"),{role:"presentation",hidden:!D,style:{...re.positionerStyles,...je}}},[Y,D,re.positionerStyles]);R.useEffect(()=>{function je(te){te.open&&(te.parentNodeId===ne&&_.set("hoverEnabled",!1),te.nodeId!==ne&&te.parentNodeId===_.select("floatingParentNodeId")&&_.setOpen(!1,Qe(Xc)))}return j.events.on("menuopenchange",je),()=>{j.events.off("menuopenchange",je)}},[_,j.events,ne]),R.useEffect(()=>{if(_.select("floatingParentNodeId")==null)return;function je(te){if(te.open||te.nodeId!==_.select("floatingParentNodeId"))return;const me=te.reason??Xc;_.setOpen(!1,Qe(me))}return j.events.on("menuopenchange",je),()=>{j.events.off("menuopenchange",je)}},[j.events,_]),R.useEffect(()=>{function je(te){!Y||te.nodeId!==_.select("floatingParentNodeId")||te.target&&Z&&Z!==te.target&&_.setOpen(!1,Qe(Xc))}return j.events.on("itemhover",je),()=>{j.events.off("itemhover",je)}},[j.events,Y,Z,_]),R.useEffect(()=>{const je={open:Y,nodeId:ne,parentNodeId:ae,reason:_.select("lastOpenChangeReason")};j.events.emit("menuopenchange",je)},[j.events,Y,_,ne,ae]);const he={open:Y,side:re.side,align:re.align,anchorHidden:re.anchorHidden,nested:z.type==="menu"},ve=R.useMemo(()=>({side:re.side,align:re.align,arrowRef:re.arrowRef,arrowUncentered:re.arrowUncentered,arrowStyles:re.arrowStyles,nodeId:re.context.nodeId}),[re.side,re.align,re.arrowRef,re.arrowUncentered,re.arrowStyles,re.context.nodeId]),Me=Mt("div",o,{state:he,stateAttributesMapping:Es,ref:[r,_.useStateSetter("positionerElement")],props:[ue,Gu(V),C]}),fe=D&&z.type!=="menu"&&(z.type!=="menubar"&&$&&J!==sn||z.type==="menubar"&&z.context.modal);let ze=null;return z.type==="menubar"?ze=z.context.contentElement:z.type===void 0&&(ze=Z),L.jsxs(i1.Provider,{value:ve,children:[fe&&L.jsx(Yw,{ref:z.type==="context-menu"||z.type==="nested-context-menu"?z.context.internalBackdropRef:null,inert:qw(!Y),cutout:ze}),L.jsx(fk,{id:ne,children:L.jsx(r3,{elementsRef:_.context.itemDomElements,labelsRef:_.context.itemLabels,children:Me})})]})}),c3=R.createContext(null);function h1(t){return R.useContext(c3)}const u3={...rm,disabled:_e(t=>t.parent.type==="menubar"&&t.parent.context.disabled||t.disabled),modal:_e(t=>(t.parent.type===void 0||t.parent.type==="context-menu")&&(t.modal??!0)),allowMouseEnter:_e(t=>t.allowMouseEnter),stickIfOpen:_e(t=>t.stickIfOpen),parent:_e(t=>t.parent),rootId:_e(t=>t.parent.type==="menu"?t.parent.store.select("rootId"):t.parent.type!==void 0?t.parent.context.rootId:t.rootId),activeIndex:_e(t=>t.activeIndex),isActive:_e((t,o)=>t.activeIndex===o),hoverEnabled:_e(t=>t.hoverEnabled),instantType:_e(t=>t.instantType),lastOpenChangeReason:_e(t=>t.openChangeReason),floatingTreeRoot:_e(t=>t.parent.type==="menu"?t.parent.store.select("floatingTreeRoot"):t.floatingTreeRoot),floatingNodeId:_e(t=>t.floatingNodeId),floatingParentNodeId:_e(t=>t.floatingParentNodeId),itemProps:_e(t=>t.itemProps),closeDelay:_e(t=>t.closeDelay),keyboardEventRelay:_e(t=>{if(t.keyboardEventRelay)return t.keyboardEventRelay;if(t.parent.type==="menu")return t.parent.store.select("keyboardEventRelay")})};class pm extends qu{constructor(o){super({...f3(),...o},{positionerRef:R.createRef(),popupRef:R.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:R.createRef(),beforeContentFocusGuardRef:R.createRef(),onOpenChangeComplete:void 0,triggerElements:new tl},u3),this.unsubscribeParentListener=this.observe("parent",r=>{if(this.unsubscribeParentListener?.(),r.type==="menu"){this.unsubscribeParentListener=r.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=r.store.context.allowMouseUpTriggerRef;return}r.type!==void 0&&(this.context.allowMouseUpTriggerRef=r.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(o,r){this.state.floatingRootContext.context.events.emit("setOpen",{open:o,eventDetails:r})}static useStore(o,r){const a=Wt(()=>new pm(r)).current;return o??a}unsubscribeParentListener=null}function f3(){return{...om(),disabled:!1,modal:!0,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Qp,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:qt,keyboardEventRelay:void 0,closeDelay:0}}const p1=R.createContext(void 0);function m1(){return R.useContext(p1)}const g1=Wp(function(o){const{children:r,open:a,onOpenChange:l,onOpenChangeComplete:c,defaultOpen:f=!1,disabled:d=!1,modal:m,loopFocus:p=!0,orientation:y="vertical",actionsRef:g,closeParentOnEsc:v=!1,handle:b,triggerId:x,defaultTriggerId:w=null,highlightItemOnHover:E=!0}=o,C=Ku(!0),_=Go(!0),k=h1(!0),O=m1(),z=R.useMemo(()=>O&&_?{type:"menu",store:_.store}:k?{type:"menubar",context:k}:C&&!_?{type:"context-menu",context:C}:{type:void 0},[C,_,k,O]),N=pm.useStore(b?.store,{open:f,openProp:a,activeTriggerId:w,triggerIdProp:x,parent:z});cm(()=>{a===void 0&&N.state.open===!1&&f===!0&&N.update({open:!0,activeTriggerId:w})}),N.useControlledProp("openProp",a),N.useControlledProp("triggerIdProp",x),N.useContextCallback("onOpenChangeComplete",c);const j=N.useState("floatingTreeRoot"),D=aw(j),Y=Vo();Ae(()=>{C&&!_?N.update({parent:{type:"context-menu",context:C},floatingNodeId:D,floatingParentNodeId:Y}):_&&N.update({floatingNodeId:D,floatingParentNodeId:Y})},[C,_,D,Y,N]);const $=N.useState("open"),Z=N.useState("activeTriggerElement"),V=N.useState("positionerElement"),J=N.useState("hoverEnabled"),ne=N.useState("modal"),ae=N.useState("disabled"),B=N.useState("lastOpenChangeReason"),H=N.useState("parent"),G=N.useState("activeIndex"),ce=N.useState("payload"),W=N.useState("floatingParentNodeId"),P=R.useRef(null),X=W!=null;let le;N.useSyncedValues({disabled:d,modal:H.type===void 0?m:void 0,rootId:Ss()});const{openMethod:re,triggerProps:ue,reset:he}=Fw($);tm(N);const{forceUnmount:ve}=nm($,N,()=>{N.update({allowMouseEnter:!1,stickIfOpen:!0}),he()}),Me=R.useRef(H.type!=="context-menu"),fe=qn();R.useEffect(()=>{if($||(P.current=null),H.type==="context-menu"){if(!$){fe.clear(),Me.current=!1;return}fe.start(500,()=>{Me.current=!0})}},[fe,$,H.type]),Gw($&&ne&&B!==sn&&re!=="touch",V),Ae(()=>{!$&&!J&&N.set("hoverEnabled",!0)},[$,J,N]);const ze=R.useRef(!0),je=qn(),te=Ce((Le,Fe)=>{const ot=Fe.reason;if($===Le&&Fe.trigger===Z&&B===ot||(Fe.preventUnmountOnClose=()=>{N.set("preventUnmountingOnClose",!0)},!Le&&Fe.trigger==null&&(Fe.trigger=Z??void 0),l?.(Le,Fe),Fe.isCanceled))return;const ht={open:Le,nativeEvent:Fe.event,reason:Fe.reason,nested:X};le?.emit("openchange",ht);const Rt=Fe.event;if(Le===!1&&Rt?.type==="click"&&Rt.pointerType==="touch"&&!ze.current)return;if(!Le&&G!==null){const cn=N.context.itemDomElements.current[G];queueMicrotask(()=>{cn?.setAttribute("tabindex","-1")})}Le&&ot===xa?(ze.current=!1,je.start(300,()=>{ze.current=!0})):(ze.current=!0,je.clear());const nn=(ot===Aa||ot===ew)&&Rt.detail===0&&Rt?.isTrusted,Nt=!Le&&(ot===Hu||ot==null),It={open:Le,openChangeReason:ot};P.current=Fe.event??null;const _n=Fe.trigger?.id??null;(_n||Le)&&(It.activeTriggerId=_n,It.activeTriggerElement=Fe.trigger??null),N.update(It),H.type==="menubar"&&(ot===xa||ot===Da||ot===sn||ot===Fc||ot===Xc)?N.set("instantType","group"):nn||Nt?N.set("instantType",nn?"click":"dismiss"):N.set("instantType",void 0)}),me=R.useCallback(Le=>{const Fe=Qe(Le);return Fe.preventUnmountOnClose=()=>{N.set("preventUnmountingOnClose",!0)},Fe},[N]),pe=R.useCallback(()=>{N.setOpen(!1,me(Kp))},[N,me]);R.useImperativeHandle(g,()=>({unmount:ve,close:pe}),[ve,pe]);let Ne;H.type==="context-menu"&&(Ne=H.context),R.useImperativeHandle(Ne?.positionerRef,()=>V,[V]),R.useImperativeHandle(Ne?.actionsRef,()=>({setOpen:te}),[te]);const be=sm({popupStore:N,onOpenChange:te});le=be.context.events,R.useEffect(()=>{const Le=({open:Fe,eventDetails:ot})=>te(Fe,ot);return le.on("setOpen",Le),()=>{le?.off("setOpen",Le)}},[le,te]);const Se=Jp(be,{enabled:!ae,bubbles:{escapeKey:v&&H.type==="menu"},outsidePress(){return H.type!=="context-menu"||P.current?.type==="contextmenu"?!0:Me.current},externalTree:X?j:void 0}),ye=Nw(be,{role:"menu"}),de=Jw(),we=R.useCallback(Le=>{N.select("activeIndex")!==Le&&N.set("activeIndex",Le)},[N]),ge=$z(be,{enabled:!ae,listRef:N.context.itemDomElements,activeIndex:G,nested:H.type!==void 0,loopFocus:p,orientation:y,parentOrientation:H.type==="menubar"?H.context.orientation:void 0,rtl:de==="rtl",disabledIndices:Zh,onNavigate:we,openOnArrowKeyDown:H.type!=="context-menu",externalTree:X?j:void 0,focusItemOnHover:E}),De=R.useCallback(Le=>{N.context.typingRef.current=Le},[N]),qe=Wz(be,{listRef:N.context.itemLabels,activeIndex:G,resetMs:IA,onMatch:Le=>{$&&Le!==G&&N.set("activeIndex",Le)},onTypingChange:De}),{getReferenceProps:Be,getFloatingProps:Ot,getItemProps:He,getTriggerProps:Je}=nl([Se,ye,ge,qe]),Pe=R.useMemo(()=>{const Le=Po(Be(),{onMouseMove(){N.set("allowMouseEnter",!0)}},ue);return delete Le.role,Le},[Be,N,ue]),Et=R.useMemo(()=>{const Le=Je();if(!Le)return Le;const Fe=Po(Le,ue);return delete Fe.role,delete Fe["aria-controls"],Fe},[Je,ue]),Qt=R.useMemo(()=>Ot({onMouseMove(){N.set("allowMouseEnter",!0),H.type==="menu"&&N.set("hoverEnabled",!1)},onClick(){N.select("hoverEnabled")&&N.set("hoverEnabled",!1)},onKeyDown(Le){const Fe=N.select("keyboardEventRelay");Fe&&!Le.isPropagationStopped()&&Fe(Le)}}),[Ot,H.type,N]),Yn=R.useMemo(()=>He(),[He]);N.useSyncedValues({floatingRootContext:be,activeTriggerProps:Pe,inactiveTriggerProps:Et,popupProps:Qt,itemProps:Yn});const Rs=R.useMemo(()=>({store:N,parent:z}),[N,z]),Gn=L.jsx(l1.Provider,{value:Rs,children:typeof r=="function"?r({payload:ce}):r});return H.type===void 0||H.type==="context-menu"?L.jsx(dk,{externalTree:j,children:Gn}):Gn});function d3(t){const o=Go().store,r=R.useMemo(()=>({parentMenu:o}),[o]);return L.jsx(p1.Provider,{value:r,children:L.jsx(g1,{...t})})}function h3(t){const o=t.getBoundingClientRect(),r=window.getComputedStyle(t,"::before"),a=window.getComputedStyle(t,"::after");if(!(r.content!=="none"||a.content!=="none"))return o;const c=parseFloat(r.width)||0,f=parseFloat(r.height)||0,d=parseFloat(a.width)||0,m=parseFloat(a.height)||0,p=Math.max(o.width,c,d),y=Math.max(o.height,f,m),g=p-o.width,v=y-o.height;return{left:o.left-g/2,right:o.right+g/2,top:o.top-v/2,bottom:o.bottom+v/2}}function p3(t={}){const{highlightItemOnHover:o,highlightedIndex:r,onHighlightedIndexChange:a}=jp(),{ref:l,index:c}=hm(t),f=r===c,d=R.useRef(null),m=Ma(l,d);return{compositeProps:R.useMemo(()=>({tabIndex:f?0:-1,onFocus(){a(c)},onMouseMove(){const y=d.current;if(!o||!y)return;const g=y.hasAttribute("disabled")||y.ariaDisabled==="true";!f&&!g&&y.focus()}}),[f,a,c,o]),compositeRef:m,index:c}}function m3(t){const{render:o,className:r,state:a=qt,props:l=Zh,refs:c=Zh,metadata:f,stateAttributesMapping:d,tag:m="div",...p}=t,{compositeProps:y,compositeRef:g}=p3({metadata:f});return Mt(m,t,{state:a,ref:[...c,g],props:[y,...l,p],stateAttributesMapping:d})}function y1(t){if(St(t)&&t.hasAttribute("data-rootownerid"))return t.getAttribute("data-rootownerid")??void 0;if(!ro(t))return y1(lo(t))}function g3(t){const{enabled:o=!0,mouseDownAction:r,open:a}=t,l=R.useRef(!1);return R.useMemo(()=>o?{onMouseDown:c=>{(r==="open"&&!a||r==="close"&&a)&&(l.current=!0,at(c.currentTarget).addEventListener("click",()=>{l.current=!1},{once:!0}))},onClick:c=>{l.current&&(l.current=!1,c.preventBaseUIHandler())}}:qt,[o,r,a])}const Bc=2,y3=Mw(function(o,r){const{render:a,className:l,disabled:c=!1,nativeButton:f=!0,id:d,openOnHover:m,delay:p=100,closeDelay:y=0,handle:g,payload:v,...b}=o,x=Go(!0),w=g?.store??x?.store;if(!w)throw new Error(tn(85));const E=xs(d),C=w.useState("isTriggerActive",E),_=w.useState("floatingRootContext"),k=w.useState("isOpenedByTrigger",E),O=R.useRef(null),z=b3(),N=jp(!0),j=Pr(),D=R.useMemo(()=>j??new Qp,[j]),Y=aw(D),$=Vo(),{registerTrigger:Z,isMountedByThisTrigger:V}=Aw(E,O,w,{payload:v,closeDelay:y,parent:z,floatingTreeRoot:D,floatingNodeId:Y,floatingParentNodeId:$,keyboardEventRelay:N?.relayKeyboardEvent}),J=z.type==="menubar",ne=w.useState("disabled"),ae=c||ne||J&&z.context.disabled,{getButtonProps:B,buttonRef:H}=Pu({disabled:ae,native:f});R.useEffect(()=>{!k&&z.type===void 0&&(w.context.allowMouseUpTriggerRef.current=!1)},[w,k,z.type]);const G=R.useRef(null),ce=qn(),W=Ce(Se=>{if(!G.current)return;ce.clear(),w.context.allowMouseUpTriggerRef.current=!1;const ye=Se.target;if(Ye(G.current,ye)||Ye(w.select("positionerElement"),ye)||ye===G.current||ye!=null&&y1(ye)===w.select("rootId"))return;const de=h3(G.current);Se.clientX>=de.left-Bc&&Se.clientX<=de.right+Bc&&Se.clientY>=de.top-Bc&&Se.clientY<=de.bottom+Bc||D.events.emit("close",{domEvent:Se,reason:JD})});R.useEffect(()=>{k&&w.select("lastOpenChangeReason")===sn&&at(G.current).addEventListener("mouseup",W,{once:!0})},[k,W,w]);const P=J&&z.context.hasSubmenuOpen,le=im(_,{enabled:(m??P)&&!ae&&z.type!=="context-menu"&&(!J||P&&!V),handleClose:lm({blockPointerEvents:!J}),mouseOnly:!0,move:!1,restMs:z.type===void 0?p:void 0,delay:{close:y},triggerElementRef:O,externalTree:D,isActiveTrigger:C}),re=v3(k,w.select("lastOpenChangeReason")),ue=mw(_,{enabled:!ae&&z.type!=="context-menu",event:k&&J?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:z.type===void 0?re:!1}),he=Dw(_,{enabled:!ae&&P}),ve=g3({open:k,enabled:J,mouseDownAction:"open"}),Me=nl([ue,he]),fe={disabled:ae,open:k},ze=w.useState("triggerProps",V),je=[G,r,H,Z,O],te=[Me.getReferenceProps(),le??qt,ze,{"aria-haspopup":"menu",id:E,onMouseDown:Se=>{if(w.select("open"))return;ce.start(200,()=>{w.context.allowMouseUpTriggerRef.current=!0}),at(Se.currentTarget).addEventListener("mouseup",W,{once:!0})}},J?{role:"menuitem"}:{},ve,b,B],me=R.useRef(null),pe=Ce(Se=>{io.flushSync(()=>{w.setOpen(!1,Qe(Da,Se.nativeEvent,Se.currentTarget))}),YD(me.current)?.focus()}),Ne=Ce(Se=>{const ye=w.select("positionerElement");if(ye&&Sa(Se,ye))w.context.beforeContentFocusGuardRef.current?.focus();else{io.flushSync(()=>{w.setOpen(!1,Qe(Da,Se.nativeEvent,Se.currentTarget))});let de=qD(w.context.triggerFocusTargetRef.current||O.current);for(;de!==null&&Ye(ye,de);){const we=de;if(de=Yp(de),de===we)break}de?.focus()}}),be=Mt("button",o,{enabled:!J,stateAttributesMapping:g0,state:fe,ref:je,props:te});return J?L.jsx(m3,{tag:"button",render:a,className:l,state:fe,refs:je,props:te,stateAttributesMapping:g0}):k?L.jsxs(R.Fragment,{children:[L.jsx(za,{ref:me,onFocus:pe},`${E}-pre-focus-guard`),L.jsx(R.Fragment,{children:be},E),L.jsx(za,{ref:w.context.triggerFocusTargetRef,onFocus:Ne},`${E}-post-focus-guard`)]}):L.jsx(R.Fragment,{children:be},E)});function v3(t,o){const r=qn(),[a,l]=R.useState(!1);return Ae(()=>{t&&o==="trigger-hover"?(l(!0),r.start(HA,()=>{l(!1)})):t||(r.clear(),l(!1))},[t,o,r]),a}function b3(){const t=Ku(!0),o=Go(!0),r=h1();return R.useMemo(()=>r?{type:"menubar",context:r}:t&&!o?{type:"context-menu",context:t}:{type:void 0},[t,o,r])}const S3=R.forwardRef(function(o,r){const{render:a,className:l,label:c,id:f,nativeButton:d=!1,openOnHover:m=!0,delay:p=100,closeDelay:y=0,disabled:g=!1,...v}=o,b=hm(),x=dm(),{store:w}=Go(),E=xs(f),C=w.useState("open"),_=w.useState("floatingRootContext"),k=w.useState("floatingTreeRoot"),O=_w(E,w),z=R.useCallback(ue=>{const he=O(ue);return ue!==null&&w.select("open")&&w.select("activeTriggerId")==null&&w.update({activeTriggerId:E,activeTriggerElement:ue,closeDelay:y}),he},[O,y,w,E]),N=R.useRef(null),j=R.useCallback(ue=>{N.current=ue,w.set("activeTriggerElement",ue)},[w]),D=m1();if(!D?.parentMenu)throw new Error(tn(37));w.useSyncedValue("closeDelay",y);const Y=D.parentMenu,$=Y.useState("itemProps"),Z=Y.useState("isActive",b.index),V=R.useMemo(()=>({type:"submenu-trigger",setActive(){Y.set("activeIndex",b.index)}}),[Y,b.index]),J=w.useState("disabled"),ne=g||J,{getItemProps:ae,itemRef:B}=c1({closeOnClick:!1,disabled:ne,highlighted:Z,id:E,store:w,nativeButton:d,itemMetadata:V,nodeId:x?.nodeId}),H=w.useState("hoverEnabled"),G=Y.useState("allowMouseEnter"),ce=im(_,{enabled:H&&m&&!ne,handleClose:lm({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:p,delay:G?{open:p,close:y}:0,triggerElementRef:N,externalTree:k}),W=mw(_,{enabled:!ne,event:"mousedown",toggle:!m,ignoreMouse:m,stickIfOpen:!1}),P=nl([W]),X=w.useState("triggerProps",!0);return delete X.id,Mt("div",o,{state:{disabled:ne,highlighted:Z,open:C},stateAttributesMapping:nw,props:[P.getReferenceProps(),ce,X,$,{tabIndex:C||Z?0:-1,onBlur(){Z&&Y.set("activeIndex",null)}},v,ae],ref:[r,b.ref,B,z,j]})});function x3({...t}){return L.jsx(g1,{"data-slot":"dropdown-menu",...t})}function w3({...t}){return L.jsx(y3,{"data-slot":"dropdown-menu-trigger",...t})}function v1({align:t="start",alignOffset:o=0,side:r="bottom",sideOffset:a=4,className:l,...c}){return L.jsx(o3,{children:L.jsx(l3,{className:"isolate z-50 outline-none",align:t,alignOffset:o,side:r,sideOffset:a,children:L.jsx(t3,{"data-slot":"dropdown-menu-content",className:ct("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden",l),...c})})})}function i4({...t}){return L.jsx(QL,{"data-slot":"dropdown-menu-group",...t})}function l4({className:t,inset:o,...r}){return L.jsx(ZL,{"data-slot":"dropdown-menu-label","data-inset":o,className:ct("text-muted-foreground px-1.5 py-1 text-xs font-medium data-inset:pl-7",t),...r})}function X0({className:t,inset:o,variant:r="default",...a}){return L.jsx($L,{"data-slot":"dropdown-menu-item","data-inset":o,"data-variant":r,className:ct("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...a})}function c4({...t}){return L.jsx(d3,{"data-slot":"dropdown-menu-sub",...t})}function u4({className:t,inset:o,children:r,...a}){return L.jsxs(S3,{"data-slot":"dropdown-menu-sub-trigger","data-inset":o,className:ct("focus:bg-accent focus:text-accent-foreground data-open:bg-accent data-open:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md px-1.5 py-1 text-sm data-inset:pl-7 [&_svg:not([class*='size-'])]:size-4 data-popup-open:bg-accent data-popup-open:text-accent-foreground flex cursor-default items-center outline-hidden select-none [&_svg]:pointer-events-none [&_svg]:shrink-0",t),...a,children:[r,L.jsx(dA,{className:"ml-auto"})]})}function f4({align:t="start",alignOffset:o=-3,side:r="right",sideOffset:a=0,className:l,...c}){return L.jsx(v1,{"data-slot":"dropdown-menu-sub-content",className:ct("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 bg-popover text-popover-foreground min-w-[96px] rounded-lg p-1 shadow-lg ring-1 duration-100 w-auto",l),align:t,alignOffset:o,side:r,sideOffset:a,...c})}function E3({className:t,...o}){return L.jsx(ek,{"data-slot":"dropdown-menu-separator",className:ct("bg-border -mx-1 my-1 h-px",t),...o})}function R3(){const t=Ji(),{isMobile:o}=Fu(),{sessions:r,activeSessionId:a}=Mp(Bo,d=>({sessions:d.sessions??[],activeSessionId:d.activeSessionId})),l=d=>{t({to:"/sessions/$sessionId",params:{sessionId:d}})},c=d=>{_L(d)},f=DL(r||[]).slice(0,15);return L.jsxs(fm,{className:"group-data-[collapsible=icon]:hidden",children:[L.jsx(pL,{children:"Recent Sessions"}),L.jsx(Xu,{children:f.length===0?L.jsx(fs,{children:L.jsx(Na,{disabled:!0,children:L.jsx("span",{className:"text-sidebar-foreground/70",children:"No sessions yet"})})}):f.map(d=>L.jsxs(fs,{children:[L.jsxs(Na,{isActive:d.sessionId===a,onClick:()=>l(d.sessionId),children:[L.jsx(Fh,{}),L.jsx("span",{className:"truncate",children:d.title||`Session ${d.sessionId.slice(0,8)}`})]}),L.jsxs(x3,{children:[L.jsxs(w3,{render:L.jsx(gL,{showOnHover:!0,className:"aria-expanded:bg-muted"}),children:[L.jsx(gA,{}),L.jsx("span",{className:"sr-only",children:"More"})]}),L.jsxs(v1,{className:"w-32",side:o?"bottom":"right",align:o?"end":"start",children:[L.jsxs(X0,{onClick:()=>l(d.sessionId),children:[L.jsx(Fh,{}),L.jsx("span",{children:"Open"})]}),L.jsx(E3,{}),L.jsxs(X0,{variant:"destructive",onClick:()=>c(d.sessionId),children:[L.jsx(TA,{}),L.jsx("span",{children:"Delete"})]})]})]})]},d.sessionId))})]})}function T3({...t}){return L.jsxs(cL,{collapsible:"offcanvas",...t,children:[L.jsx(dL,{children:L.jsx(Xu,{children:L.jsx(fs,{children:L.jsxs(Na,{size:"lg",render:L.jsx(Ki,{to:"/"}),children:[L.jsx(Fh,{className:"size-5"}),L.jsx("span",{className:"text-base font-semibold",children:"clankie"})]})})})}),L.jsxs(hL,{children:[L.jsx(BL,{}),L.jsx(R3,{}),L.jsx(VL,{className:"mt-auto"})]})]})}const al=E_({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{title:"clankie — Web UI"}],links:[{rel:"stylesheet",href:sA}]}),component:C3});function C3(){return R.useEffect(()=>{if(typeof window<"u"){const r=new URLSearchParams(window.location.search).get("token");r&&(PL({authToken:r}),window.history.replaceState(null,"",window.location.pathname),console.log("[root] Detected auth token from URL, saved to localStorage"))}const{settings:t}=sl.state;t.authToken&&!hp.isConnected()&&hp.connect()},[]),L.jsx(M3,{children:L.jsx($N,{children:L.jsxs(lL,{children:[L.jsx(T3,{variant:"inset"}),L.jsx(fL,{children:L.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[L.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b px-4",children:L.jsx(uL,{})}),L.jsx(WS,{})]})})]})})})}function M3({children:t}){return L.jsxs("html",{lang:"en",className:"dark",children:[L.jsx("head",{children:L.jsx(U_,{})}),L.jsxs("body",{children:[t,L.jsx(B_,{})]})]})}const O3="modulepreload",_3=function(t){return"/"+t},K0={},Qu=function(o,r,a){let l=Promise.resolve();if(r&&r.length>0){let m=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),d=f?.nonce||f?.getAttribute("nonce");l=m(r.map(p=>{if(p=_3(p),p in K0)return;K0[p]=!0;const y=p.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const v=document.createElement("link");if(v.rel=y?"stylesheet":O3,y||(v.as="script"),v.crossOrigin="",v.href=p,d&&v.setAttribute("nonce",d),document.head.appendChild(v),y)return new Promise((b,x)=>{v.addEventListener("load",b),v.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(f){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=f,window.dispatchEvent(d),!d.defaultPrevented)throw f}return l.then(f=>{for(const d of f||[])d.status==="rejected"&&c(d.reason);return o().catch(c)})},A3=()=>Qu(()=>import("./settings-ZDTymG3K.js"),__vite__mapDeps([0,1,2])),D3=Ca("/settings")({component:Du(A3,"component")}),k3=()=>Qu(()=>import("./extensions-D-3Wl_TA.js"),__vite__mapDeps([3,1,2])),z3=Ca("/extensions")({component:Du(k3,"component")}),N3=()=>Qu(()=>import("./index-ClDMn-6f.js"),[]),L3=Ca("/")({component:Du(N3,"component")}),j3=()=>Qu(()=>import("./sessions._sessionId-D6gfJDaW.js"),__vite__mapDeps([4,2])),P3=Ca("/sessions/$sessionId")({component:Du(j3,"component")}),U3=D3.update({id:"/settings",path:"/settings",getParentRoute:()=>al}),B3=z3.update({id:"/extensions",path:"/extensions",getParentRoute:()=>al}),I3=L3.update({id:"/",path:"/",getParentRoute:()=>al}),H3=P3.update({id:"/sessions/$sessionId",path:"/sessions/$sessionId",getParentRoute:()=>al}),V3={IndexRoute:I3,ExtensionsRoute:B3,SettingsRoute:U3,SessionsSessionIdRoute:H3},q3=al._addFileChildren(V3),Y3=()=>D_({routeTree:q3,scrollRestoration:!0,defaultPreloadStaleTime:0});async function G3(){const t=await Y3();let o;return o=[],window.__TSS_START_OPTIONS__={serializationAdapters:o},o.push(rA),t.options.serializationAdapters&&o.push(...t.options.serializationAdapters),t.update({basepath:"",serializationAdapters:o}),t.state.matches.length||await H_(t),t}async function F3(){const t=await G3();return window.$_TSR?.h(),t}let Bh;function X3(){return Bh||(Bh=F3()),L.jsx(t_,{promise:Bh,children:t=>L.jsx(N_,{router:t})})}R.startTransition(()=>{IR.hydrateRoot(document,L.jsx(R.StrictMode,{children:L.jsx(X3,{})}))});export{l4 as $,EA as A,Ax as B,tn as C,bN as D,qt as E,xs as F,Ce as G,Ae as H,st as I,io as J,Zn as K,Ki as L,at as M,fx as N,Mt as O,xA as P,Qe as Q,Fp as R,La as S,zp as T,Ji as U,Yo as V,x3 as W,MA as X,w3 as Y,v1 as Z,i4 as _,Wt as a,E3 as a0,c4 as a1,u4 as a2,f4 as a3,X0 as a4,dp as a5,fp as a6,a4 as a7,DR as a8,qo as a9,P3 as aa,yN as b,Ho as c,tw as d,lN as e,ct as f,wN as g,ck as h,lk as i,L as j,cN as k,ik as l,Mp as m,rl as n,s4 as o,hp as p,sl as q,R as r,PL as s,n4 as t,ws as u,o4 as v,Bo as w,B0 as x,HL as y,r4 as z};