tokentracker-cli 0.5.87 → 0.5.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -1
- package/README.zh-CN.md +12 -1
- package/dashboard/dist/assets/{Card-BbXzY-fw.js → Card-CnqcfvmO.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-CL9LvAb4.js +1 -0
- package/dashboard/dist/assets/FadeIn-DnSCeL3V.js +1 -0
- package/dashboard/dist/assets/{IpCheckPage-FulDeMPC.js → IpCheckPage-BzBH9Pzc.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-BQSqJVlP.js → LeaderboardPage--a89meL8.js} +2 -2
- package/dashboard/dist/assets/LeaderboardProfilePage-CPlgciKL.js +1 -0
- package/dashboard/dist/assets/LimitsPage-gI3NxbAg.js +2 -0
- package/dashboard/dist/assets/PopoverPopup-DSxDP7iu.js +12 -0
- package/dashboard/dist/assets/{ProviderIcon-DChRpzX_.js → ProviderIcon-CXJvW9mJ.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-CSBDnXij.js +1 -0
- package/dashboard/dist/assets/SkillsPage-ZSajczMn.js +1 -0
- package/dashboard/dist/assets/WidgetsPage-COk7qbro.js +1 -0
- package/dashboard/dist/assets/chevron-down-DoncrDIk.js +1 -0
- package/dashboard/dist/assets/{download-w3j__M5u.js → download-DjhGgU2Q.js} +1 -1
- package/dashboard/dist/assets/leaderboard-columns-eCqUMOqF.js +1 -0
- package/dashboard/dist/assets/{main-CJeNIc4Q.js → main-BkcFhXuV.js} +257 -189
- package/dashboard/dist/assets/main-DDHZqhEq.css +1 -0
- package/dashboard/dist/assets/refresh-cw-BvjQfCG5.js +1 -0
- package/dashboard/dist/assets/{use-limits-display-prefs-BzI5WJEo.js → use-limits-display-prefs-D8X45HMo.js} +1 -1
- package/dashboard/dist/assets/use-native-settings-BHpLvxeC.js +1 -0
- package/dashboard/dist/assets/{use-usage-limits-CuoJnC-V.js → use-usage-limits-B6fyz2im.js} +1 -1
- package/dashboard/dist/brand-logos/hermes.svg +11 -0
- package/dashboard/dist/clawd/mini/idle-tight.svg +15 -0
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/src/lib/local-api.js +83 -0
- package/src/lib/skills-manager.js +739 -0
- package/dashboard/dist/assets/DashboardPage-B_Yvna3-.js +0 -12
- package/dashboard/dist/assets/FadeIn-Dz3MVtMG.js +0 -1
- package/dashboard/dist/assets/LeaderboardProfilePage-DP8bewz7.js +0 -1
- package/dashboard/dist/assets/LimitsPage-BXDoE-jU.js +0 -2
- package/dashboard/dist/assets/SettingsPage-XFSmA7VB.js +0 -1
- package/dashboard/dist/assets/WidgetsPage-D5guzG01.js +0 -1
- package/dashboard/dist/assets/leaderboard-columns-ChIW6uNZ.js +0 -1
- package/dashboard/dist/assets/main-Cyta3wIj.css +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{aD as Ue,av as se,az as et,aI as Mo,aJ as Ao,r as d,aw as z,aA as Fo,aK as ls,ax as be,aL as us,D as ee,aB as je,aM as Ot,a6 as _e,aN as fs,F as ze,aF as qn,aG as Ce,aO as Pe,aP as ct,aC as ie,aQ as We,aR as Gn,aS as Cn,aT as Tn,aU as ft,aV as Ke,aW as ds,aX as Lo,aY as ps,aZ as Pt,a_ as Zt,E as gs}from"./main-BkcFhXuV.js";const ms=500,hs={style:{transition:"none"}},Do="data-base-ui-click-trigger",Ya={fallbackAxisSide:"none"},bs={fallbackAxisSide:"end"},vs={clipPath:"inset(50%)",position:"fixed",top:0,left:0},No={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Bo={...No,position:"fixed",top:0,left:0},Ua={...No,position:"absolute"};function Fe(e){const t=Ue(ys,e).current;return t.next=e,se(t.effect),t}function ys(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Ht=Symbol("NOT_FOUND");function Es(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Rs(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function xs(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(o=>typeof o=="function"?`function ${o.name||"unnamed"}()`:typeof o).join(", ");throw new TypeError(`${t}[${n}]`)}}var Xn=e=>Array.isArray(e)?e:[e];function Ss(e){const t=Array.isArray(e[0])?e[0]:e;return xs(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ws(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}function Cs(e){let t;return{get(n){return t&&e(t.key,n)?t.value:Ht},put(n,o){t={key:n,value:o}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Ts(e,t){let n=[];function o(a){const c=n.findIndex(l=>t(a,l.key));if(c>-1){const l=n[c];return c>0&&(n.splice(c,1),n.unshift(l)),l.value}return Ht}function r(a,c){o(a)===Ht&&(n.unshift({key:a,value:c}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:o,put:r,getEntries:s,clear:i}}var Os=(e,t)=>e===t;function Ps(e){return function(n,o){if(n===null||o===null||n.length!==o.length)return!1;const{length:r}=n;for(let s=0;s<r;s++)if(!e(n[s],o[s]))return!1;return!0}}function Is(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:o=Os,maxSize:r=1,resultEqualityCheck:s}=n,i=Ps(o);let a=0;const c=r<=1?Cs(i):Ts(r,i);function l(){let u=c.get(arguments);if(u===Ht){if(u=e.apply(null,arguments),a++,s){const p=c.getEntries().find(m=>s(m.value,u));p&&(u=p.value,a!==0&&a--)}c.put(arguments,u)}return u}return l.clearCache=()=>{c.clear(),l.resetResultsCount()},l.resultsCount=()=>a,l.resetResultsCount=()=>{a=0},l}var ks=class{constructor(e){this.value=e}deref(){return this.value}},Ms=typeof WeakRef<"u"?WeakRef:ks,As=0,Kn=1;function Ft(){return{s:As,v:void 0,o:null,p:null}}function $o(e,t={}){let n=Ft();const{resultEqualityCheck:o}=t;let r,s=0;function i(){let a=n;const{length:c}=arguments;for(let f=0,p=c;f<p;f++){const m=arguments[f];if(typeof m=="function"||typeof m=="object"&&m!==null){let g=a.o;g===null&&(a.o=g=new WeakMap);const h=g.get(m);h===void 0?(a=Ft(),g.set(m,a)):a=h}else{let g=a.p;g===null&&(a.p=g=new Map);const h=g.get(m);h===void 0?(a=Ft(),g.set(m,a)):a=h}}const l=a;let u;if(a.s===Kn)u=a.v;else if(u=e.apply(null,arguments),s++,o){const f=r?.deref?.()??r;f!=null&&o(f,u)&&(u=f,s!==0&&s--),r=typeof u=="object"&&u!==null||typeof u=="function"?new Ms(u):u}return l.s=Kn,l.v=u,u}return i.clearCache=()=>{n=Ft(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function Wo(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,o=(...r)=>{let s=0,i=0,a,c={},l=r.pop();typeof l=="object"&&(c=l,l=r.pop()),Es(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const u={...n,...c},{memoize:f,memoizeOptions:p=[],argsMemoize:m=$o,argsMemoizeOptions:g=[]}=u,h=Xn(p),v=Xn(g),y=Ss(r),b=f(function(){return s++,l.apply(null,arguments)},...h),E=m(function(){i++;const w=ws(y,arguments);return a=b.apply(null,w),a},...v);return Object.assign(E,{resultFunc:l,memoizedResultFunc:b,dependencies:y,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:m})};return Object.assign(o,{withTypes:()=>o}),o}var Fs=Wo($o),Ls=Object.assign((e,t=Fs)=>{Rs(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),o=n.map(s=>e[s]);return t(o,(...s)=>s.reduce((i,a,c)=>(i[n[c]]=a,i),{}))},{withTypes:()=>Ls});Wo({memoize:Is,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const G=(e,t,n,o,r,s,...i)=>{if(i.length>0)throw new Error(et(1));let a;if(e)a=e;else throw new Error("Missing arguments");return a};var on={exports:{}},rn={};var Zn;function Ds(){if(Zn)return rn;Zn=1;var e=Mo();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(f,p){var m=p(),g=o({inst:{value:m,getSnapshot:p}}),h=g[0].inst,v=g[1];return s(function(){h.value=m,h.getSnapshot=p,c(h)&&v({inst:h})},[f,m,p]),r(function(){return c(h)&&v({inst:h}),f(function(){c(h)&&v({inst:h})})},[f]),i(m),m}function c(f){var p=f.getSnapshot;f=f.value;try{var m=p();return!n(f,m)}catch{return!0}}function l(f,p){return p()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return rn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,rn}var Jn;function Vo(){return Jn||(Jn=1,on.exports=Ds()),on.exports}var Ns=Vo(),sn={exports:{}},cn={};var Qn;function Bs(){if(Qn)return cn;Qn=1;var e=Mo(),t=Vo();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,c=e.useDebugValue;return cn.useSyncExternalStoreWithSelector=function(l,u,f,p,m){var g=s(null);if(g.current===null){var h={hasValue:!1,value:null};g.current=h}else h=g.current;g=a(function(){function y(O){if(!b){if(b=!0,E=O,O=p(O),m!==void 0&&h.hasValue){var C=h.value;if(m(C,O))return S=C}return S=O}if(C=S,o(E,O))return C;var I=p(O);return m!==void 0&&m(C,I)?(E=O,C):(E=O,S=I)}var b=!1,E,S,w=f===void 0?null:f;return[function(){return y(u())},w===null?void 0:function(){return y(w())}]},[u,f,p,m]);var v=r(l,g[0],g[1]);return i(function(){h.hasValue=!0,h.value=v},[v]),c(v),v},cn}var eo;function $s(){return eo||(eo=1,sn.exports=Bs()),sn.exports}var Ws=$s();const Vs=Ao(19),js=Vs?_s:Ys;function Hs(e,t,n,o,r){return js(e,t,n,o,r)}function _s(e,t,n,o,r){const s=d.useCallback(()=>t(e.getSnapshot(),n,o,r),[e,t,n,o,r]);return Ns.useSyncExternalStore(e.subscribe,s,s)}function Ys(e,t,n,o,r){return Ws.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,o,r))}class St{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){St.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||St.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};St.prototype.setState.call(this,t)}}class On extends St{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}controlledValues=new Map;useSyncedValue(t,n){d.useDebugValue(t),se(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const o=this;se(()=>(o.state[t]!==n&&o.set(t,n),()=>{o.set(t,void 0)}),[o,t,n])}useSyncedValues(t){const n=this,o=Object.values(t);se(()=>{n.update(t)},[n,...o])}useControlledProp(t,n,o){d.useDebugValue(t);const r=this,s=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,s),!s&&!Object.is(this.state[t],o)&&super.setState({...this.state,[t]:o})),se(()=>{s&&!Object.is(r.state[t],n)&&super.setState({...r.state,[t]:n})},[r,t,n,o,s])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.update(n)}setState(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.setState({...this.state,...n})}select=(t,n,o,r)=>{const s=this.selectors[t];return s(this.state,n,o,r)};useState=(t,n,o,r)=>{d.useDebugValue(t);const s=this.selectors[t];return Hs(this,s,n,o,r)};useContextCallback(t,n){d.useDebugValue(t);const o=z(n??Fo);this.context[t]=o}useStateSetter(t){const n=d.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let r=o(this.state);return n(r,r,this),this.subscribe(s=>{const i=o(s);if(!Object.is(r,i)){const a=r;r=i,n(i,a,this)}})}}const Us=[];function Pn(e){d.useEffect(e,Us)}const Lt=null;class zs{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let r=0;r<n.length;r+=1)n[r]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const Dt=new zs;class Ae{static create(){return new Ae}static request(t){return Dt.request(t)}static cancel(t){return Dt.cancel(t)}currentId=Lt;request(t){this.cancel(),this.currentId=Dt.request(()=>{this.currentId=Lt,t()})}cancel=()=>{this.currentId!==Lt&&(Dt.cancel(this.currentId),this.currentId=Lt)};disposeEffect=()=>this.cancel}function In(){const e=Ue(Ae.create).current;return Pn(e.disposeEffect),e}const xt=0;class Ye{static create(){return new Ye}currentId=xt;start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=xt,n()},t)}isStarted(){return this.currentId!==xt}clear=()=>{this.currentId!==xt&&(clearTimeout(this.currentId),this.currentId=xt)};disposeEffect=()=>this.clear}function Je(){const e=Ue(Ye.create).current;return Pn(e.disposeEffect),e}const ht=typeof navigator<"u",an=Ks(),jo=Js(),Ho=Zs(),qs=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),_o=an.platform==="MacIntel"&&an.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(an.platform),Gs=ht&&/apple/i.test(navigator.vendor),hn=ht&&/android/i.test(jo)||/android/i.test(Ho);ht&&jo.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const Xs=Ho.includes("jsdom/");function Ks(){if(!ht)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function Zs(){if(!ht)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function Js(){if(!ht)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}const bn="data-base-ui-focusable",Yo="active",Uo="selected",zo="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",za="ArrowLeft",qa="ArrowRight",Ga="ArrowUp",Xa="ArrowDown";function it(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function re(e,t){if(!e||!t)return!1;const n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&ls(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Ee(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Te(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Qs(e){return e.matches("html,body")}function fe(e){return e?.ownerDocument||document}function qo(e){return be(e)&&e.matches(zo)}function to(e){return e?e.getAttribute("role")==="combobox"&&qo(e):!1}function vn(e){return e?e.hasAttribute(bn)?e:e.querySelector(`[${bn}]`)||e:null}function Ze(e,t,n=!0){return e.filter(r=>r.parentId===t&&(!n||r.context?.open)).flatMap(r=>[r,...Ze(e,r.id,n)])}function no(e,t){let n=[],o=e.find(r=>r.id===t)?.parentId;for(;o;){const r=e.find(s=>s.id===o);o=r?.parentId,r&&(n=n.concat(r))}return n}function ei(e){e.preventDefault(),e.stopPropagation()}function ti(e){return"nativeEvent"in e}function ni(e){return e.mozInputSource===0&&e.isTrusted?!0:hn&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function oi(e){return Xs?!1:!hn&&e.width===0&&e.height===0||hn&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function dt(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Go(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const ri=["top","right","bottom","left"],pt=Math.min,Re=Math.max,_t=Math.round,Nt=Math.floor,Le=e=>({x:e,y:e}),si={left:"right",right:"left",bottom:"top",top:"bottom"};function yn(e,t,n){return Re(e,pt(t,n))}function $e(e,t){return typeof e=="function"?e(t):e}function ye(e){return e.split("-")[0]}function qe(e){return e.split("-")[1]}function kn(e){return e==="x"?"y":"x"}function Mn(e){return e==="y"?"height":"width"}function we(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function An(e){return kn(we(e))}function ii(e,t,n){n===void 0&&(n=!1);const o=qe(e),r=An(e),s=Mn(r);let i=r==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Yt(i)),[i,Yt(i)]}function ci(e){const t=Yt(e);return[En(e),t,En(t)]}function En(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const oo=["left","right"],ro=["right","left"],ai=["top","bottom"],li=["bottom","top"];function ui(e,t,n){switch(e){case"top":case"bottom":return n?t?ro:oo:t?oo:ro;case"left":case"right":return t?ai:li;default:return[]}}function fi(e,t,n,o){const r=qe(e);let s=ui(ye(e),n==="start",o);return r&&(s=s.map(i=>i+"-"+r),t&&(s=s.concat(s.map(En)))),s}function Yt(e){const t=ye(e);return si[t]+e.slice(t.length)}function di(e){return{top:0,right:0,bottom:0,left:0,...e}}function Xo(e){return typeof e!="number"?di(e):{top:e,right:e,bottom:e,left:e}}function Ut(e){const{x:t,y:n,width:o,height:r}=e;return{width:o,height:r,top:n,left:t,right:t+o,bottom:n+r,x:t,y:n}}var pi=["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] *)"],zt=pi.join(","),Ko=typeof Element>"u",gt=Ko?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,qt=!Ko&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},Gt=function(t,n){var o;n===void 0&&(n=!0);var r=t==null||(o=t.getAttribute)===null||o===void 0?void 0:o.call(t,"inert"),s=r===""||r==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):Gt(t.parentNode));return i},gi=function(t){var n,o=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return o===""||o==="true"},Zo=function(t,n,o){if(Gt(t))return[];var r=Array.prototype.slice.apply(t.querySelectorAll(zt));return n&>.call(t,zt)&&r.unshift(t),r=r.filter(o),r},Xt=function(t,n,o){for(var r=[],s=Array.from(t);s.length;){var i=s.shift();if(!Gt(i,!1))if(i.tagName==="SLOT"){var a=i.assignedElements(),c=a.length?a:i.children,l=Xt(c,!0,o);o.flatten?r.push.apply(r,l):r.push({scopeParent:i,candidates:l})}else{var u=gt.call(i,zt);u&&o.filter(i)&&(n||!t.includes(i))&&r.push(i);var f=i.shadowRoot||typeof o.getShadowRoot=="function"&&o.getShadowRoot(i),p=!Gt(f,!1)&&(!o.shadowRootFilter||o.shadowRootFilter(i));if(f&&p){var m=Xt(f===!0?i.children:f.children,!0,o);o.flatten?r.push.apply(r,m):r.push({scopeParent:i,candidates:m})}else s.unshift.apply(s,i.children)}}return r},Jo=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Qo=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||gi(t))&&!Jo(t)?0:t.tabIndex},mi=function(t,n){var o=Qo(t);return o<0&&n&&!Jo(t)?0:o},hi=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},er=function(t){return t.tagName==="INPUT"},bi=function(t){return er(t)&&t.type==="hidden"},vi=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(o){return o.tagName==="SUMMARY"});return n},yi=function(t,n){for(var o=0;o<t.length;o++)if(t[o].checked&&t[o].form===n)return t[o]},Ei=function(t){if(!t.name)return!0;var n=t.form||qt(t),o=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=o(window.CSS.escape(t.name));else try{r=o(t.name)}catch(i){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",i.message),!1}var s=yi(r,t.form);return!s||s===t},Ri=function(t){return er(t)&&t.type==="radio"},xi=function(t){return Ri(t)&&!Ei(t)},Si=function(t){var n,o=t&&qt(t),r=(n=o)===null||n===void 0?void 0:n.host,s=!1;if(o&&o!==t){var i,a,c;for(s=!!((i=r)!==null&&i!==void 0&&(a=i.ownerDocument)!==null&&a!==void 0&&a.contains(r)||t!=null&&(c=t.ownerDocument)!==null&&c!==void 0&&c.contains(t));!s&&r;){var l,u,f;o=qt(r),r=(l=o)===null||l===void 0?void 0:l.host,s=!!((u=r)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(r))}}return s},so=function(t){var n=t.getBoundingClientRect(),o=n.width,r=n.height;return o===0&&r===0},wi=function(t,n){var o=n.displayCheck,r=n.getShadowRoot;if(o==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=gt.call(t,"details>summary:first-of-type"),a=i?t.parentElement:t;if(gt.call(a,"details:not([open]) *"))return!0;if(!o||o==="full"||o==="full-native"||o==="legacy-full"){if(typeof r=="function"){for(var c=t;t;){var l=t.parentElement,u=qt(t);if(l&&!l.shadowRoot&&r(l)===!0)return so(t);t.assignedSlot?t=t.assignedSlot:!l&&u!==t.ownerDocument?t=u.host:t=l}t=c}if(Si(t))return!t.getClientRects().length;if(o!=="legacy-full")return!0}else if(o==="non-zero-area")return so(t);return!1},Ci=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var o=0;o<n.children.length;o++){var r=n.children.item(o);if(r.tagName==="LEGEND")return gt.call(n,"fieldset[disabled] *")?!0:!r.contains(t)}return!0}n=n.parentElement}return!1},Rn=function(t,n){return!(n.disabled||bi(n)||wi(n,t)||vi(n)||Ci(n))},xn=function(t,n){return!(xi(n)||Qo(n)<0||!Rn(t,n))},Ti=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},tr=function(t){var n=[],o=[];return t.forEach(function(r,s){var i=!!r.scopeParent,a=i?r.scopeParent:r,c=mi(a,i),l=i?tr(r.candidates):a;c===0?i?n.push.apply(n,l):n.push(a):o.push({documentOrder:s,tabIndex:c,item:r,isScope:i,content:l})}),o.sort(hi).reduce(function(r,s){return s.isScope?r.push.apply(r,s.content):r.push(s.content),r},[]).concat(n)},It=function(t,n){n=n||{};var o;return n.getShadowRoot?o=Xt([t],n.includeContainer,{filter:xn.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Ti}):o=Zo(t,n.includeContainer,xn.bind(null,n)),tr(o)},Oi=function(t,n){n=n||{};var o;return n.getShadowRoot?o=Xt([t],n.includeContainer,{filter:Rn.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):o=Zo(t,n.includeContainer,Rn.bind(null,n)),o},nr=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return gt.call(t,zt)===!1?!1:xn(n,t)};const bt=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function or(e,t){const n=It(e,bt()),o=n.length;if(o===0)return;const r=it(fe(e)),s=n.indexOf(r),i=s===-1?t===1?0:o-1:s+t;return n[i]}function Fn(e){return or(fe(e).body,1)||e}function rr(e){return or(fe(e).body,-1)||e}function sr(e,t){if(!e)return null;const n=It(fe(e).body,bt()),o=n.length;if(o===0)return null;const r=n.indexOf(e);if(r===-1)return null;const s=(r+t+o)%o;return n[s]}function Pi(e){return sr(e,1)}function Ii(e){return sr(e,-1)}function at(e,t){const n=t||e.currentTarget,o=e.relatedTarget;return!o||!re(n,o)}function ki(e){It(e,bt()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function io(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const o=n.dataset.tabindex;delete n.dataset.tabindex,o?n.setAttribute("tabindex",o):n.removeAttribute("tabindex")})}const Mi={...us};let co=0;function Ai(e,t="mui"){const[n,o]=d.useState(e),r=e||n;return d.useEffect(()=>{n==null&&(co+=1,o(`${t}-${co}`))},[n,t]),r}const ao=Mi.useId;function vt(e,t){if(ao!==void 0){const n=ao();return e??(t?`${t}-${n}`:n)}return Ai(e,t)}function ir(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}class Fi{nodesRef={current:[]};events=ir();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(o=>o===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const cr=d.createContext(null),ar=d.createContext(null),tt=()=>d.useContext(cr)?.id||null,yt=e=>{const t=d.useContext(ar);return e??t};function Li(e){const t=vt(),n=yt(e),o=tt();return se(()=>{if(!t)return;const r={id:t,parentId:o};return n?.addNode(r),()=>{n?.removeNode(r)}},[n,t,o]),t}function Di(e){const{children:t,id:n}=e,o=tt();return ee.jsx(cr.Provider,{value:d.useMemo(()=>({id:n,parentId:o}),[n,o]),children:t})}function Ni(e){const{children:t,externalTree:n}=e,o=Ue(()=>n??new Fi).current;return ee.jsx(ar.Provider,{value:o,children:t})}const Bi="none",He="trigger-press",xe="trigger-hover",lr="outside-press",Ka="item-press",Za="close-press",wt="focus-out",ur="escape-key",Ja="list-navigation",Qa="cancel-open",fr="imperative-action",el="window-resize";function ce(e,t,n,o){let r=!1,s=!1;const i=je;return{reason:e,event:t??new Event("base-ui"),cancel(){r=!0},allowPropagation(){s=!0},get isCanceled(){return r},get isPropagationAllowed(){return s},trigger:n,...i}}function Ct(e){return`data-base-ui-${e}`}function ln(e,t,n){if(n&&!dt(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const o=e();return typeof o=="number"?o:o?.[t]}return e?.[t]}function nt(e){return e?.ownerDocument||document}const mt=d.forwardRef(function(t,n){const[o,r]=d.useState();se(()=>{Gs&&r("button")},[]);const s={tabIndex:0,role:o};return ee.jsx("span",{...t,ref:n,style:Bo,"aria-hidden":o?void 0:!0,...s,"data-base-ui-focus-guard":""})});let lo=0;function un(e,t={}){const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(lo);const s=()=>e?.focus({preventScroll:n});r?s():lo=requestAnimationFrame(s)}const lt={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function uo(e){return e==="inert"?lt.inert:e==="aria-hidden"?lt["aria-hidden"]:lt.none}let Bt=new WeakSet,$t={},fn=0;const dr=e=>e&&(e.host||dr(e.parentNode)),$i=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=dr(n);return e.contains(o)?o:null}).filter(n=>n!=null);function Wi(e,t,n,o){const r="data-base-ui-inert",s=o?"inert":n?"aria-hidden":null,i=$i(t,e),a=new Set,c=new Set(i),l=[];$t[r]||($t[r]=new WeakMap);const u=$t[r];i.forEach(f),p(t),a.clear();function f(m){!m||a.has(m)||(a.add(m),m.parentNode&&f(m.parentNode))}function p(m){!m||c.has(m)||[].forEach.call(m.children,g=>{if(Ot(g)!=="script")if(a.has(g))p(g);else{const h=s?g.getAttribute(s):null,v=h!==null&&h!=="false",y=uo(s),b=(y.get(g)||0)+1,E=(u.get(g)||0)+1;y.set(g,b),u.set(g,E),l.push(g),b===1&&v&&Bt.add(g),E===1&&g.setAttribute(r,""),!v&&s&&g.setAttribute(s,s==="inert"?"":"true")}})}return fn+=1,()=>{l.forEach(m=>{const g=uo(s),v=(g.get(m)||0)-1,y=(u.get(m)||0)-1;g.set(m,v),u.set(m,y),v||(!Bt.has(m)&&s&&m.removeAttribute(s),Bt.delete(m)),y||m.removeAttribute(r)}),fn-=1,fn||(lt.inert=new WeakMap,lt["aria-hidden"]=new WeakMap,lt.none=new WeakMap,Bt=new WeakSet,$t={})}}function Vi(e,t=!1,n=!1){const o=fe(e[0]).body;return Wi(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}const pr=d.createContext(null),gr=()=>d.useContext(pr),ji=Ct("portal");function Hi(e={}){const{ref:t,container:n,componentProps:o=je,elementProps:r,elementState:s}=e,i=vt(),c=gr()?.portalNode,[l,u]=d.useState(null),[f,p]=d.useState(null),m=z(y=>{y!==null&&p(y)}),g=d.useRef(null);se(()=>{if(n===null){g.current&&(g.current=null,p(null),u(null));return}if(i==null)return;const y=(n&&(fs(n)?n:n.current))??c??document.body;if(y==null){g.current&&(g.current=null,p(null),u(null));return}g.current!==y&&(g.current=y,p(null),u(y))},[n,c,i]);const h=ze("div",o,{ref:[t,m],state:s,props:[{id:i,[ji]:""},r]});return{portalNode:f,portalSubtree:l&&h?_e.createPortal(h,l):null}}const mr=d.forwardRef(function(t,n){const{children:o,container:r,className:s,render:i,renderGuards:a,...c}=t,{portalNode:l,portalSubtree:u}=Hi({container:r,ref:n,componentProps:t,elementProps:c}),f=d.useRef(null),p=d.useRef(null),m=d.useRef(null),g=d.useRef(null),[h,v]=d.useState(null),y=h?.modal,b=h?.open,E=typeof a=="boolean"?a:!!h&&!h.modal&&h.open&&!!l;d.useEffect(()=>{if(!l||y)return;function w(O){l&&O.relatedTarget&&at(O)&&(O.type==="focusin"?io:ki)(l)}return l.addEventListener("focusin",w,!0),l.addEventListener("focusout",w,!0),()=>{l.removeEventListener("focusin",w,!0),l.removeEventListener("focusout",w,!0)}},[l,y]),d.useEffect(()=>{!l||b||io(l)},[b,l]);const S=d.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:g,portalNode:l,setFocusManagerState:v}),[l]);return ee.jsxs(d.Fragment,{children:[u,ee.jsxs(pr.Provider,{value:S,children:[E&&l&&ee.jsx(mt,{"data-type":"outside",ref:f,onFocus:w=>{if(at(w,l))m.current?.focus();else{const O=h?h.domReference:null;rr(O)?.focus()}}}),E&&l&&ee.jsx("span",{"aria-owns":l.id,style:vs}),l&&_e.createPortal(o,l),E&&l&&ee.jsx(mt,{"data-type":"outside",ref:p,onFocus:w=>{if(at(w,l))g.current?.focus();else{const O=h?h.domReference:null;Fn(O)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,ce(wt,w.nativeEvent))}}})]})]})});function Be(e){return e==null?e:"current"in e?e.current:e}function _i(e,t){const n=Ce(e.target);return e instanceof n.KeyboardEvent?"keyboard":e instanceof n.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof n.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const fo=20;let Ve=[];function Ln(){Ve=Ve.filter(e=>e.isConnected)}function Yi(e){Ln(),e&&Ot(e)!=="body"&&(Ve.push(e),Ve.length>fo&&(Ve=Ve.slice(-fo)))}function dn(){return Ln(),Ve[Ve.length-1]}function Ui(e){if(!e)return null;const t=bt();return nr(e,t)?e:It(e,t)[0]||e}function zi(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Pe(e).display!=="none"}function po(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=bt(),r=Oi(e,n).filter(i=>{const a=i.getAttribute("data-tabindex")||"";return nr(i,n)||i.hasAttribute("data-tabindex")&&!a.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function hr(e){const{context:t,children:n,disabled:o=!1,order:r=["content"],initialFocus:s=!0,returnFocus:i=!0,restoreFocus:a=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u="",getInsideElements:f=()=>[],nextFocusableElement:p,previousFocusableElement:m,beforeContentFocusGuardRef:g,externalTree:h}=e,v="rootStore"in t?t.rootStore:t,y=v.useState("open"),b=v.useState("domReferenceElement"),E=v.useState("floatingElement"),{events:S,dataRef:w}=v.context,O=z(()=>w.current.floatingContext?.nodeId),C=z(f),I=s===!1,N=to(b)&&I,k=Fe(r),L=Fe(s),A=Fe(i),T=Fe(u),D=yt(h),P=gr(),V=d.useRef(null),B=d.useRef(null),x=d.useRef(!1),F=d.useRef(!1),Q=d.useRef(!1),X=d.useRef(-1),K=d.useRef(""),Z=d.useRef(""),_=d.useRef(null),ne=d.useRef(null),U=qn(_,g,P?.beforeInsideRef),J=qn(ne,P?.afterInsideRef),de=Je(),pe=Je(),ge=In(),De=P!=null,R=vn(E),Y=z((M=R)=>M?It(M,bt()):[]),$=z(M=>{const W=Y(M);return k.current.map(()=>W).filter(Boolean).flat()});d.useEffect(()=>{if(o||!c)return;function M(q){q.key==="Tab"&&re(R,it(fe(R)))&&Y().length===0&&!N&&ei(q)}const W=fe(R);return W.addEventListener("keydown",M),()=>{W.removeEventListener("keydown",M)}},[o,b,R,c,k,N,Y,$]),d.useEffect(()=>{if(o||!E)return;function M(W){const q=Ee(W),oe=Y().indexOf(q);oe!==-1&&(X.current=oe)}return E.addEventListener("focusin",M),()=>{E.removeEventListener("focusin",M)}},[o,E,Y]),d.useEffect(()=>{if(o||!y)return;const M=fe(R);function W(){Q.current=!1}function q(oe){const H=Ee(oe),j=re(E,H)||re(b,H)||re(P?.portalNode,H);Q.current=!j,Z.current=oe.pointerType||"keyboard"}function te(){Z.current="keyboard"}return M.addEventListener("pointerdown",q,!0),M.addEventListener("pointerup",W,!0),M.addEventListener("pointercancel",W,!0),M.addEventListener("keydown",te,!0),()=>{M.removeEventListener("pointerdown",q,!0),M.removeEventListener("pointerup",W,!0),M.removeEventListener("pointercancel",W,!0),M.removeEventListener("keydown",te,!0)}},[o,E,b,R,y,P]),d.useEffect(()=>{if(o||!l)return;function M(){F.current=!0,pe.start(0,()=>{F.current=!1})}function W(H){const j=H.relatedTarget,me=H.currentTarget,ae=Ee(H);queueMicrotask(()=>{const Ne=O(),Ge=v.context.triggerElements,ot=j?.hasAttribute(Ct("focus-guard"))&&[_.current,ne.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Be(m),Be(p)].includes(j),Xe=!(re(b,j)||re(E,j)||re(j,E)||re(P?.portalNode,j)||j!=null&&Ge.hasElement(j)||Ge.hasMatchingElement(he=>re(he,j))||ot||D&&(Ze(D.nodesRef.current,Ne).find(he=>re(he.context?.elements.floating,j)||re(he.context?.elements.domReference,j))||no(D.nodesRef.current,Ne).find(he=>[he.context?.elements.floating,vn(he.context?.elements.floating)].includes(j)||he.context?.elements.domReference===j)));if(me===b&&R&&po(R,k),a&&me!==b&&!zi(ae)&&it(fe(R))===fe(R).body){if(be(R)&&(R.focus(),a==="popup")){ge.request(()=>{R.focus()});return}const he=X.current,Ie=Y(),ke=Ie[he]||Ie[Ie.length-1]||R;be(ke)&&ke.focus()}if(w.current.insideReactTree){w.current.insideReactTree=!1;return}(N||!c)&&j&&Xe&&!F.current&&(N||j!==dn())&&(x.current=!0,v.setOpen(!1,ce(wt,H)))})}function q(){Q.current||(w.current.insideReactTree=!0,de.start(0,()=>{w.current.insideReactTree=!1}))}const te=be(b)?b:null,oe=[];if(!(!E&&!te))return te&&(te.addEventListener("focusout",W),te.addEventListener("pointerdown",M),oe.push(()=>{te.removeEventListener("focusout",W),te.removeEventListener("pointerdown",M)})),E&&(E.addEventListener("focusout",W),P&&(E.addEventListener("focusout",q,!0),oe.push(()=>{E.removeEventListener("focusout",q,!0)})),oe.push(()=>{E.removeEventListener("focusout",W)})),()=>{oe.forEach(H=>{H()})}},[o,b,E,R,c,D,P,v,l,a,Y,N,O,k,w,de,pe,ge,p,m]),d.useEffect(()=>{if(o||!E||!y)return;const M=Array.from(P?.portalNode?.querySelectorAll(`[${Ct("portal")}]`)||[]),q=(D?no(D.nodesRef.current,O()):[]).find(H=>to(H.context?.elements.domReference||null))?.context?.elements.domReference,te=[E,q,...M,...C(),V.current,B.current,_.current,ne.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Be(m),Be(p),N?b:null].filter(H=>H!=null),oe=Vi(te,c||N);return()=>{oe()}},[y,o,b,E,c,k,P,N,D,O,C,p,m]),se(()=>{if(!y||o||!be(R))return;const M=fe(R),W=it(M);queueMicrotask(()=>{const q=$(R),te=L.current,oe=typeof te=="function"?te(T.current||""):te;if(oe===void 0||oe===!1)return;let H;oe===!0||oe===null?H=q[0]||R:H=Be(oe),H=H||q[0]||R,!re(R,W)&&un(H,{preventScroll:H===R})})},[o,y,R,I,$,L,T]),se(()=>{if(o||!R)return;const M=fe(R),W=it(M);Yi(W);function q(H){if(H.open||(K.current=_i(H.nativeEvent,Z.current)),H.reason===xe&&H.nativeEvent.type==="mouseleave"&&(x.current=!0),H.reason===lr)if(H.nested)x.current=!1;else if(ni(H.nativeEvent)||oi(H.nativeEvent))x.current=!1;else{let j=!1;document.createElement("div").focus({get preventScroll(){return j=!0,!1}}),j?x.current=!1:x.current=!0}}S.on("openchange",q);const te=M.createElement("span");te.setAttribute("tabindex","-1"),te.setAttribute("aria-hidden","true"),Object.assign(te.style,Bo),De&&b&&b.insertAdjacentElement("afterend",te);function oe(){const H=A.current;let j=typeof H=="function"?H(K.current):H;if(j===void 0||j===!1)return null;if(j===null&&(j=!0),typeof j=="boolean"){const ae=b||dn();return ae&&ae.isConnected?ae:te}const me=b||dn()||te;return Be(j)||me}return()=>{S.off("openchange",q);const H=it(M),j=re(E,H)||D&&Ze(D.nodesRef.current,O(),!1).some(ae=>re(ae.context?.elements.floating,H)),me=oe();queueMicrotask(()=>{const ae=Ui(me),Ne=typeof A.current!="boolean";A.current&&!x.current&&be(ae)&&(!(!Ne&&ae!==H&&H!==M.body)||j)&&ae.focus({preventScroll:!0}),te.remove()})}},[o,E,R,A,w,S,D,De,b,O]),d.useEffect(()=>{queueMicrotask(()=>{x.current=!1})},[o]),d.useEffect(()=>{if(o||!y)return;function M(q){Ee(q)?.closest(`[${Do}]`)&&(F.current=!0)}const W=fe(R);return W.addEventListener("pointerdown",M,!0),()=>{W.removeEventListener("pointerdown",M,!0)}},[o,y,R]),se(()=>{if(!o&&P)return P.setFocusManagerState({modal:c,closeOnFocusOut:l,open:y,onOpenChange:v.setOpen,domReference:b}),()=>{P.setFocusManagerState(null)}},[o,P,c,y,v,l,b]),se(()=>{if(!(o||!R))return po(R,k),()=>{queueMicrotask(Ln)}},[o,R,k]);const ue=!o&&(c?!N:!0)&&(De||c);return ee.jsxs(d.Fragment,{children:[ue&&ee.jsx(mt,{"data-type":"inside",ref:U,onFocus:M=>{if(c){const W=$();un(W[W.length-1])}else P?.portalNode&&(x.current=!1,at(M,P.portalNode)?Fn(b)?.focus():Be(m??P.beforeOutsideRef)?.focus())}}),n,ue&&ee.jsx(mt,{"data-type":"inside",ref:J,onFocus:M=>{c?un($()[0]):P?.portalNode&&(l&&(x.current=!0),at(M,P.portalNode)?rr(b)?.focus():Be(p??P.afterOutsideRef)?.focus())}})]})}function qi(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.context.dataRef,{enabled:r=!0,event:s="click",toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:c=!0,touchOpenDelay:l=0}=t,u=d.useRef(void 0),f=In(),p=Je(),m=d.useMemo(()=>({onPointerDown(g){u.current=g.pointerType},onMouseDown(g){const h=u.current,v=g.nativeEvent,y=n.select("open");if(g.button!==0||s==="click"||dt(h,!0)&&a)return;const b=o.current.openEvent,E=b?.type,S=n.select("domReferenceElement")!==g.currentTarget,w=y&&S||!(y&&i&&(!(b&&c)||E==="click"||E==="mousedown"));if(qo(v.target)){const C=ce(He,v,v.target);w&&h==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,C)}):n.setOpen(w,C);return}const O=g.currentTarget;f.request(()=>{const C=ce(He,v,O);w&&h==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,C)}):n.setOpen(w,C)})},onClick(g){if(s==="mousedown-only")return;const h=u.current;if(s==="mousedown"&&h){u.current=void 0;return}if(dt(h,!0)&&a)return;const v=n.select("open"),y=o.current.openEvent,b=n.select("domReferenceElement")!==g.currentTarget,E=v&&b||!(v&&i&&(!(y&&c)||Go(y))),S=ce(He,g.nativeEvent,g.currentTarget);E&&h==="touch"&&l>0?p.start(l,()=>{n.setOpen(!0,S)}):n.setOpen(E,S)},onKeyDown(){u.current=void 0}}),[o,s,a,n,c,i,f,p,l]);return d.useMemo(()=>r?{reference:m}:je,[r,m])}function go(e,t,n){let{reference:o,floating:r}=e;const s=we(t),i=An(t),a=Mn(i),c=ye(t),l=s==="y",u=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,p=o[a]/2-r[a]/2;let m;switch(c){case"top":m={x:u,y:o.y-r.height};break;case"bottom":m={x:u,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:f};break;case"left":m={x:o.x-r.width,y:f};break;default:m={x:o.x,y:o.y}}switch(qe(t)){case"start":m[i]-=p*(n&&l?-1:1);break;case"end":m[i]+=p*(n&&l?-1:1);break}return m}async function Gi(e,t){var n;t===void 0&&(t={});const{x:o,y:r,platform:s,rects:i,elements:a,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:m=0}=$e(t,e),g=Xo(m),v=a[p?f==="floating"?"reference":"floating":f],y=Ut(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:c})),b=f==="floating"?{x:o,y:r,width:i.floating.width,height:i.floating.height}:i.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),S=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},w=Ut(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:E,strategy:c}):b);return{top:(y.top-w.top+g.top)/S.y,bottom:(w.bottom-y.bottom+g.bottom)/S.y,left:(y.left-w.left+g.left)/S.x,right:(w.right-y.right+g.right)/S.x}}const Xi=50,Ki=async(e,t,n)=>{const{placement:o="bottom",strategy:r="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:Gi},c=await(i.isRTL==null?void 0:i.isRTL(t));let l=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:u,y:f}=go(l,o,c),p=o,m=0;const g={};for(let h=0;h<s.length;h++){const v=s[h];if(!v)continue;const{name:y,fn:b}=v,{x:E,y:S,data:w,reset:O}=await b({x:u,y:f,initialPlacement:o,placement:p,strategy:r,middlewareData:g,rects:l,platform:a,elements:{reference:e,floating:t}});u=E??u,f=S??f,g[y]={...g[y],...w},O&&m<Xi&&(m++,typeof O=="object"&&(O.placement&&(p=O.placement),O.rects&&(l=O.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):O.rects),{x:u,y:f}=go(l,p,c)),h=-1)}return{x:u,y:f,placement:p,strategy:r,middlewareData:g}},Zi=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:r,middlewareData:s,rects:i,initialPlacement:a,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:h=!0,...v}=$e(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=ye(r),b=we(a),E=ye(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(l.floating)),w=p||(E||!h?[Yt(a)]:ci(a)),O=g!=="none";!p&&O&&w.push(...fi(a,h,g,S));const C=[a,...w],I=await c.detectOverflow(t,v),N=[];let k=((o=s.flip)==null?void 0:o.overflows)||[];if(u&&N.push(I[y]),f){const D=ii(r,i,S);N.push(I[D[0]],I[D[1]])}if(k=[...k,{placement:r,overflows:N}],!N.every(D=>D<=0)){var L,A;const D=(((L=s.flip)==null?void 0:L.index)||0)+1,P=C[D];if(P&&(!(f==="alignment"?b!==we(P):!1)||k.every(x=>we(x.placement)===b?x.overflows[0]>0:!0)))return{data:{index:D,overflows:k},reset:{placement:P}};let V=(A=k.filter(B=>B.overflows[0]<=0).sort((B,x)=>B.overflows[1]-x.overflows[1])[0])==null?void 0:A.placement;if(!V)switch(m){case"bestFit":{var T;const B=(T=k.filter(x=>{if(O){const F=we(x.placement);return F===b||F==="y"}return!0}).map(x=>[x.placement,x.overflows.filter(F=>F>0).reduce((F,Q)=>F+Q,0)]).sort((x,F)=>x[1]-F[1])[0])==null?void 0:T[0];B&&(V=B);break}case"initialPlacement":V=a;break}if(r!==V)return{reset:{placement:V}}}return{}}}};function mo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ho(e){return ri.some(t=>e[t]>=0)}const Ji=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:o}=t,{strategy:r="referenceHidden",...s}=$e(e,t);switch(r){case"referenceHidden":{const i=await o.detectOverflow(t,{...s,elementContext:"reference"}),a=mo(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:ho(a)}}}case"escaped":{const i=await o.detectOverflow(t,{...s,altBoundary:!0}),a=mo(i,n.floating);return{data:{escapedOffsets:a,escaped:ho(a)}}}default:return{}}}}},br=new Set(["left","top"]);async function Qi(e,t){const{placement:n,platform:o,elements:r}=e,s=await(o.isRTL==null?void 0:o.isRTL(r.floating)),i=ye(n),a=qe(n),c=we(n)==="y",l=br.has(i)?-1:1,u=s&&c?-1:1,f=$e(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(m=a==="end"?g*-1:g),c?{x:m*u,y:p*l}:{x:p*l,y:m*u}}const ec=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:r,y:s,placement:i,middlewareData:a}=t,c=await Qi(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+c.x,y:s+c.y,data:{...c,placement:i}}}}},tc=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:r,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:c={fn:y=>{let{x:b,y:E}=y;return{x:b,y:E}}},...l}=$e(e,t),u={x:n,y:o},f=await s.detectOverflow(t,l),p=we(ye(r)),m=kn(p);let g=u[m],h=u[p];if(i){const y=m==="y"?"top":"left",b=m==="y"?"bottom":"right",E=g+f[y],S=g-f[b];g=yn(E,g,S)}if(a){const y=p==="y"?"top":"left",b=p==="y"?"bottom":"right",E=h+f[y],S=h-f[b];h=yn(E,h,S)}const v=c.fn({...t,[m]:g,[p]:h});return{...v,data:{x:v.x-n,y:v.y-o,enabled:{[m]:i,[p]:a}}}}}},nc=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:o,placement:r,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:c=!0,crossAxis:l=!0}=$e(e,t),u={x:n,y:o},f=we(r),p=kn(f);let m=u[p],g=u[f];const h=$e(a,t),v=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){const E=p==="y"?"height":"width",S=s.reference[p]-s.floating[E]+v.mainAxis,w=s.reference[p]+s.reference[E]-v.mainAxis;m<S?m=S:m>w&&(m=w)}if(l){var y,b;const E=p==="y"?"width":"height",S=br.has(ye(r)),w=s.reference[f]-s.floating[E]+(S&&((y=i.offset)==null?void 0:y[f])||0)+(S?0:v.crossAxis),O=s.reference[f]+s.reference[E]+(S?0:((b=i.offset)==null?void 0:b[f])||0)-(S?v.crossAxis:0);g<w?g=w:g>O&&(g=O)}return{[p]:m,[f]:g}}}},oc=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,o;const{placement:r,rects:s,platform:i,elements:a}=t,{apply:c=()=>{},...l}=$e(e,t),u=await i.detectOverflow(t,l),f=ye(r),p=qe(r),m=we(r)==="y",{width:g,height:h}=s.floating;let v,y;f==="top"||f==="bottom"?(v=f,y=p===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(y=f,v=p==="end"?"top":"bottom");const b=h-u.top-u.bottom,E=g-u.left-u.right,S=pt(h-u[v],b),w=pt(g-u[y],E),O=!t.middlewareData.shift;let C=S,I=w;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(I=E),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(C=b),O&&!p){const k=Re(u.left,0),L=Re(u.right,0),A=Re(u.top,0),T=Re(u.bottom,0);m?I=g-2*(k!==0||L!==0?k+L:Re(u.left,u.right)):C=h-2*(A!==0||T!==0?A+T:Re(u.top,u.bottom))}await c({...t,availableWidth:I,availableHeight:C});const N=await i.getDimensions(a.floating);return g!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}};function vr(e){const t=Pe(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const r=be(e),s=r?e.offsetWidth:n,i=r?e.offsetHeight:o,a=_t(n)!==s||_t(o)!==i;return a&&(n=s,o=i),{width:n,height:o,$:a}}function Dn(e){return ie(e)?e:e.contextElement}function ut(e){const t=Dn(e);if(!be(t))return Le(1);const n=t.getBoundingClientRect(),{width:o,height:r,$:s}=vr(t);let i=(s?_t(n.width):n.width)/o,a=(s?_t(n.height):n.height)/r;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const rc=Le(0);function yr(e){const t=Ce(e);return!Cn()||!t.visualViewport?rc:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function sc(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ce(e)?!1:t}function Qe(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),s=Dn(e);let i=Le(1);t&&(o?ie(o)&&(i=ut(o)):i=ut(e));const a=sc(s,n,o)?yr(s):Le(0);let c=(r.left+a.x)/i.x,l=(r.top+a.y)/i.y,u=r.width/i.x,f=r.height/i.y;if(s){const p=Ce(s),m=o&&ie(o)?Ce(o):o;let g=p,h=Gn(g);for(;h&&o&&m!==g;){const v=ut(h),y=h.getBoundingClientRect(),b=Pe(h),E=y.left+(h.clientLeft+parseFloat(b.paddingLeft))*v.x,S=y.top+(h.clientTop+parseFloat(b.paddingTop))*v.y;c*=v.x,l*=v.y,u*=v.x,f*=v.y,c+=E,l+=S,g=Ce(h),h=Gn(g)}}return Ut({width:u,height:f,x:c,y:l})}function Jt(e,t){const n=Zt(e).scrollLeft;return t?t.left+n:Qe(We(e)).left+n}function Er(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-Jt(e,n),r=n.top+t.scrollTop;return{x:o,y:r}}function ic(e){let{elements:t,rect:n,offsetParent:o,strategy:r}=e;const s=r==="fixed",i=We(o),a=t?Tn(t.floating):!1;if(o===i||a&&s)return n;let c={scrollLeft:0,scrollTop:0},l=Le(1);const u=Le(0),f=be(o);if((f||!f&&!s)&&((Ot(o)!=="body"||Pt(i))&&(c=Zt(o)),f)){const m=Qe(o);l=ut(o),u.x=m.x+o.clientLeft,u.y=m.y+o.clientTop}const p=i&&!f&&!s?Er(i,c):Le(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+p.x,y:n.y*l.y-c.scrollTop*l.y+u.y+p.y}}function cc(e){return Array.from(e.getClientRects())}function ac(e){const t=We(e),n=Zt(e),o=e.ownerDocument.body,r=Re(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=Re(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let i=-n.scrollLeft+Jt(e);const a=-n.scrollTop;return Pe(o).direction==="rtl"&&(i+=Re(t.clientWidth,o.clientWidth)-r),{width:r,height:s,x:i,y:a}}const bo=25;function lc(e,t){const n=Ce(e),o=We(e),r=n.visualViewport;let s=o.clientWidth,i=o.clientHeight,a=0,c=0;if(r){s=r.width,i=r.height;const u=Cn();(!u||u&&t==="fixed")&&(a=r.offsetLeft,c=r.offsetTop)}const l=Jt(o);if(l<=0){const u=o.ownerDocument,f=u.body,p=getComputedStyle(f),m=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(o.clientWidth-f.clientWidth-m);g<=bo&&(s-=g)}else l<=bo&&(s+=l);return{width:s,height:i,x:a,y:c}}function uc(e,t){const n=Qe(e,!0,t==="fixed"),o=n.top+e.clientTop,r=n.left+e.clientLeft,s=be(e)?ut(e):Le(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,c=r*s.x,l=o*s.y;return{width:i,height:a,x:c,y:l}}function vo(e,t,n){let o;if(t==="viewport")o=lc(e,n);else if(t==="document")o=ac(We(e));else if(ie(t))o=uc(t,n);else{const r=yr(e);o={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Ut(o)}function Rr(e,t){const n=ft(e);return n===t||!ie(n)||Ke(n)?!1:Pe(n).position==="fixed"||Rr(n,t)}function fc(e,t){const n=t.get(e);if(n)return n;let o=ct(e,[],!1).filter(a=>ie(a)&&Ot(a)!=="body"),r=null;const s=Pe(e).position==="fixed";let i=s?ft(e):e;for(;ie(i)&&!Ke(i);){const a=Pe(i),c=Lo(i);!c&&a.position==="fixed"&&(r=null),(s?!c&&!r:!c&&a.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||Pt(i)&&!c&&Rr(e,i))?o=o.filter(u=>u!==i):r=a,i=ft(i)}return t.set(e,o),o}function dc(e){let{element:t,boundary:n,rootBoundary:o,strategy:r}=e;const i=[...n==="clippingAncestors"?Tn(t)?[]:fc(t,this._c):[].concat(n),o],a=vo(t,i[0],r);let c=a.top,l=a.right,u=a.bottom,f=a.left;for(let p=1;p<i.length;p++){const m=vo(t,i[p],r);c=Re(m.top,c),l=pt(m.right,l),u=pt(m.bottom,u),f=Re(m.left,f)}return{width:l-f,height:u-c,x:f,y:c}}function pc(e){const{width:t,height:n}=vr(e);return{width:t,height:n}}function gc(e,t,n){const o=be(t),r=We(t),s=n==="fixed",i=Qe(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const c=Le(0);function l(){c.x=Jt(r)}if(o||!o&&!s)if((Ot(t)!=="body"||Pt(r))&&(a=Zt(t)),o){const m=Qe(t,!0,s,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else r&&l();s&&!o&&r&&l();const u=r&&!o&&!s?Er(r,a):Le(0),f=i.left+a.scrollLeft-c.x-u.x,p=i.top+a.scrollTop-c.y-u.y;return{x:f,y:p,width:i.width,height:i.height}}function pn(e){return Pe(e).position==="static"}function yo(e,t){if(!be(e)||Pe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return We(e)===n&&(n=n.ownerDocument.body),n}function xr(e,t){const n=Ce(e);if(Tn(e))return n;if(!be(e)){let r=ft(e);for(;r&&!Ke(r);){if(ie(r)&&!pn(r))return r;r=ft(r)}return n}let o=yo(e,t);for(;o&&ds(o)&&pn(o);)o=yo(o,t);return o&&Ke(o)&&pn(o)&&!Lo(o)?n:o||ps(e)||n}const mc=async function(e){const t=this.getOffsetParent||xr,n=this.getDimensions,o=await n(e.floating);return{reference:gc(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function hc(e){return Pe(e).direction==="rtl"}const bc={convertOffsetParentRelativeRectToViewportRelativeRect:ic,getDocumentElement:We,getClippingRect:dc,getOffsetParent:xr,getElementRects:mc,getClientRects:cc,getDimensions:pc,getScale:ut,isElement:ie,isRTL:hc};function Sr(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vc(e,t){let n=null,o;const r=We(e);function s(){var a;clearTimeout(o),(a=n)==null||a.disconnect(),n=null}function i(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),s();const l=e.getBoundingClientRect(),{left:u,top:f,width:p,height:m}=l;if(a||t(),!p||!m)return;const g=Nt(f),h=Nt(r.clientWidth-(u+p)),v=Nt(r.clientHeight-(f+m)),y=Nt(u),E={rootMargin:-g+"px "+-h+"px "+-v+"px "+-y+"px",threshold:Re(0,pt(1,c))||1};let S=!0;function w(O){const C=O[0].intersectionRatio;if(C!==c){if(!S)return i();C?i(!1,C):o=setTimeout(()=>{i(!1,1e-7)},1e3)}C===1&&!Sr(l,e.getBoundingClientRect())&&i(),S=!1}try{n=new IntersectionObserver(w,{...E,root:r.ownerDocument})}catch{n=new IntersectionObserver(w,E)}n.observe(e)}return i(!0),s}function Eo(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,l=Dn(e),u=r||s?[...l?ct(l):[],...t?ct(t):[]]:[];u.forEach(y=>{r&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const f=l&&a?vc(l,n):null;let p=-1,m=null;i&&(m=new ResizeObserver(y=>{let[b]=y;b&&b.target===l&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var E;(E=m)==null||E.observe(t)})),n()}),l&&!c&&m.observe(l),t&&m.observe(t));let g,h=c?Qe(e):null;c&&v();function v(){const y=Qe(e);h&&!Sr(h,y)&&n(),h=y,g=requestAnimationFrame(v)}return n(),()=>{var y;u.forEach(b=>{r&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),f?.(),(y=m)==null||y.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const yc=ec,Ec=tc,Rc=Zi,xc=oc,Sc=Ji,wc=nc,Cc=(e,t,n)=>{const o=new Map,r={platform:bc,...n},s={...r.platform,_c:o};return Ki(e,t,{...r,platform:s})};var Tc=typeof document<"u",Oc=function(){},Vt=Tc?d.useLayoutEffect:Oc;function Kt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Kt(e[o],t[o]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,r[o]))return!1;for(o=n;o--!==0;){const s=r[o];if(!(s==="_owner"&&e.$$typeof)&&!Kt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function wr(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ro(e,t){const n=wr(e);return Math.round(t*n)/n}function gn(e){const t=d.useRef(e);return Vt(()=>{t.current=e}),t}function Pc(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:r,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:c,open:l}=e,[u,f]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=d.useState(o);Kt(p,o)||m(o);const[g,h]=d.useState(null),[v,y]=d.useState(null),b=d.useCallback(x=>{x!==O.current&&(O.current=x,h(x))},[]),E=d.useCallback(x=>{x!==C.current&&(C.current=x,y(x))},[]),S=s||g,w=i||v,O=d.useRef(null),C=d.useRef(null),I=d.useRef(u),N=c!=null,k=gn(c),L=gn(r),A=gn(l),T=d.useCallback(()=>{if(!O.current||!C.current)return;const x={placement:t,strategy:n,middleware:p};L.current&&(x.platform=L.current),Cc(O.current,C.current,x).then(F=>{const Q={...F,isPositioned:A.current!==!1};D.current&&!Kt(I.current,Q)&&(I.current=Q,_e.flushSync(()=>{f(Q)}))})},[p,t,n,L,A]);Vt(()=>{l===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,f(x=>({...x,isPositioned:!1})))},[l]);const D=d.useRef(!1);Vt(()=>(D.current=!0,()=>{D.current=!1}),[]),Vt(()=>{if(S&&(O.current=S),w&&(C.current=w),S&&w){if(k.current)return k.current(S,w,T);T()}},[S,w,T,k,N]);const P=d.useMemo(()=>({reference:O,floating:C,setReference:b,setFloating:E}),[b,E]),V=d.useMemo(()=>({reference:S,floating:w}),[S,w]),B=d.useMemo(()=>{const x={position:n,left:0,top:0};if(!V.floating)return x;const F=Ro(V.floating,u.x),Q=Ro(V.floating,u.y);return a?{...x,transform:"translate("+F+"px, "+Q+"px)",...wr(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:Q}},[n,a,V.floating,u.x,u.y]);return d.useMemo(()=>({...u,update:T,refs:P,elements:V,floatingStyles:B}),[u,T,P,V,B])}const Ic=(e,t)=>{const n=yc(e);return{name:n.name,fn:n.fn,options:[e,t]}},kc=(e,t)=>{const n=Ec(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mc=(e,t)=>({fn:wc(e).fn,options:[e,t]}),Ac=(e,t)=>{const n=Rc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Fc=(e,t)=>{const n=xc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lc=(e,t)=>{const n=Sc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dc={intentional:"onClick",sloppy:"onPointerDown"};function Nc(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Cr(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("referenceElement"),i=n.useState("domReferenceElement"),{onOpenChange:a,dataRef:c}=n.context,{enabled:l=!0,escapeKey:u=!0,outsidePress:f=!0,outsidePressEvent:p="sloppy",referencePress:m=!1,referencePressEvent:g="sloppy",ancestorScroll:h=!1,bubbles:v,externalTree:y}=t,b=yt(y),E=z(typeof f=="function"?f:()=>!1),S=typeof f=="function"?E:f,w=d.useRef(!1),{escapeKey:O,outsidePress:C}=Nc(v),I=d.useRef(null),N=Je(),k=Je(),L=z(()=>{k.clear(),c.current.insideReactTree=!1}),A=d.useRef(!1),T=d.useRef(""),D=z(R=>{T.current=R.pointerType}),P=z(()=>{const R=T.current,Y=R==="pen"||!R?"mouse":R,$=typeof p=="function"?p():p;return typeof $=="string"?$:$[Y]}),V=z(R=>{if(!o||!l||!u||R.key!=="Escape"||A.current)return;const Y=c.current.floatingContext?.nodeId,$=b?Ze(b.nodesRef.current,Y):[];if(!O&&$.length>0){let W=!0;if($.forEach(q=>{q.context?.open&&!q.context.dataRef.current.__escapeKeyBubbles&&(W=!1)}),!W)return}const ue=ti(R)?R.nativeEvent:R,M=ce(ur,ue);n.setOpen(!1,M),!O&&!M.isPropagationAllowed&&R.stopPropagation()}),B=z(R=>{const Y=P();return Y==="intentional"&&R.type!=="click"||Y==="sloppy"&&R.type==="click"}),x=z(()=>{c.current.insideReactTree=!0,k.start(0,L)}),F=z((R,Y=!1)=>{if(B(R)){L();return}if(c.current.insideReactTree){L();return}if(P()==="intentional"&&Y||typeof S=="function"&&!S(R))return;const $=Ee(R),ue=`[${Ct("inert")}]`,M=fe(n.select("floatingElement")).querySelectorAll(ue),W=n.context.triggerElements;if($&&(W.hasElement($)||W.hasMatchingElement(j=>re(j,$))))return;let q=ie($)?$:null;for(;q&&!Ke(q);){const j=ft(q);if(Ke(j)||!ie(j))break;q=j}if(M.length&&ie($)&&!Qs($)&&!re($,n.select("floatingElement"))&&Array.from(M).every(j=>!re(q,j)))return;if(be($)&&!("touches"in R)){const j=Ke($),me=Pe($),ae=/auto|scroll/,Ne=j||ae.test(me.overflowX),Ge=j||ae.test(me.overflowY),ot=Ne&&$.clientWidth>0&&$.scrollWidth>$.clientWidth,Xe=Ge&&$.clientHeight>0&&$.scrollHeight>$.clientHeight,he=me.direction==="rtl",Ie=Xe&&(he?R.offsetX<=$.offsetWidth-$.clientWidth:R.offsetX>$.clientWidth),ke=ot&&R.offsetY>$.clientHeight;if(Ie||ke)return}const te=c.current.floatingContext?.nodeId,oe=b&&Ze(b.nodesRef.current,te).some(j=>Te(R,j.context?.elements.floating));if(Te(R,n.select("floatingElement"))||Te(R,n.select("domReferenceElement"))||oe)return;const H=b?Ze(b.nodesRef.current,te):[];if(H.length>0){let j=!0;if(H.forEach(me=>{me.context?.open&&!me.context.dataRef.current.__outsidePressBubbles&&(j=!1)}),!j)return}n.setOpen(!1,ce(lr,R)),L()}),Q=z(R=>{P()!=="sloppy"||R.pointerType==="touch"||!n.select("open")||!l||Te(R,n.select("floatingElement"))||Te(R,n.select("domReferenceElement"))||F(R)}),X=z(R=>{if(P()!=="sloppy"||!n.select("open")||!l||Te(R,n.select("floatingElement"))||Te(R,n.select("domReferenceElement")))return;const Y=R.touches[0];Y&&(I.current={startTime:Date.now(),startX:Y.clientX,startY:Y.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},N.start(1e3,()=>{I.current&&(I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1)}))}),K=z(R=>{const Y=Ee(R);function $(){X(R),Y?.removeEventListener(R.type,$)}Y?.addEventListener(R.type,$)}),Z=z(R=>{const Y=w.current;if(w.current=!1,N.clear(),R.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)return;const $=Ee(R);function ue(){R.type==="pointerdown"?Q(R):F(R,Y),$?.removeEventListener(R.type,ue)}$?.addEventListener(R.type,ue)}),_=z(R=>{if(P()!=="sloppy"||!I.current||Te(R,n.select("floatingElement"))||Te(R,n.select("domReferenceElement")))return;const Y=R.touches[0];if(!Y)return;const $=Math.abs(Y.clientX-I.current.startX),ue=Math.abs(Y.clientY-I.current.startY),M=Math.sqrt($*$+ue*ue);M>5&&(I.current.dismissOnTouchEnd=!0),M>10&&(F(R),N.clear(),I.current=null)}),ne=z(R=>{const Y=Ee(R);function $(){_(R),Y?.removeEventListener(R.type,$)}Y?.addEventListener(R.type,$)}),U=z(R=>{P()!=="sloppy"||!I.current||Te(R,n.select("floatingElement"))||Te(R,n.select("domReferenceElement"))||(I.current.dismissOnTouchEnd&&F(R),N.clear(),I.current=null)}),J=z(R=>{const Y=Ee(R);function $(){U(R),Y?.removeEventListener(R.type,$)}Y?.addEventListener(R.type,$)});d.useEffect(()=>{if(!o||!l)return;c.current.__escapeKeyBubbles=O,c.current.__outsidePressBubbles=C;const R=new Ye;function Y(q){n.setOpen(!1,ce(Bi,q))}function $(){R.clear(),A.current=!0}function ue(){R.start(Cn()?5:0,()=>{A.current=!1})}const M=fe(r);M.addEventListener("pointerdown",D,!0),u&&(M.addEventListener("keydown",V),M.addEventListener("compositionstart",$),M.addEventListener("compositionend",ue)),S&&(M.addEventListener("click",Z,!0),M.addEventListener("pointerdown",Z,!0),M.addEventListener("touchstart",K,!0),M.addEventListener("touchmove",ne,!0),M.addEventListener("touchend",J,!0),M.addEventListener("mousedown",Z,!0));let W=[];return h&&(ie(i)&&(W=ct(i)),ie(r)&&(W=W.concat(ct(r))),!ie(s)&&s&&s.contextElement&&(W=W.concat(ct(s.contextElement)))),W=W.filter(q=>q!==M.defaultView?.visualViewport),W.forEach(q=>{q.addEventListener("scroll",Y,{passive:!0})}),()=>{M.removeEventListener("pointerdown",D,!0),u&&(M.removeEventListener("keydown",V),M.removeEventListener("compositionstart",$),M.removeEventListener("compositionend",ue)),S&&(M.removeEventListener("click",Z,!0),M.removeEventListener("pointerdown",Z,!0),M.removeEventListener("touchstart",K,!0),M.removeEventListener("touchmove",ne,!0),M.removeEventListener("touchend",J,!0),M.removeEventListener("mousedown",Z,!0)),W.forEach(q=>{q.removeEventListener("scroll",Y)}),R.clear(),w.current=!1}},[c,r,s,i,u,S,o,a,h,l,O,C,V,F,Z,Q,K,ne,J,D,n]),d.useEffect(L,[S,L]);const de=d.useMemo(()=>({onKeyDown:V,...m&&{[Dc[g]]:R=>{n.setOpen(!1,ce(He,R.nativeEvent))},...g!=="intentional"&&{onClick(R){n.setOpen(!1,ce(He,R.nativeEvent))}}}}),[V,n,m,g]),pe=z(R=>{const Y=Ee(R.nativeEvent);!re(n.select("floatingElement"),Y)||R.button!==0||(w.current=!0)}),ge=z(R=>{!o||!l||R.button!==0||(w.current=!0)}),De=d.useMemo(()=>({onKeyDown:V,onPointerDown:pe,onMouseDown:pe,onMouseUp:pe,onClickCapture:x,onMouseDownCapture(R){x(),ge(R)},onPointerDownCapture(R){x(),ge(R)},onMouseUpCapture:x,onTouchEndCapture:x,onTouchMoveCapture:x}),[V,pe,x,ge]);return d.useMemo(()=>l?{reference:de,floating:De,trigger:de}:{},[l,de,De])}const Bc={open:G(e=>e.open),domReferenceElement:G(e=>e.domReferenceElement),referenceElement:G(e=>e.positionReference??e.referenceElement),floatingElement:G(e=>e.floatingElement),floatingId:G(e=>e.floatingId)};class Nn extends On{constructor(t){const{nested:n,noEmit:o,onOpenChange:r,triggerElements:s,...i}=t;super({...i,positionReference:i.referenceElement,domReferenceElement:i.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:ir(),nested:n,noEmit:o,triggerElements:s},Bc)}setOpen=(t,n)=>{if((!t||!this.state.open||Go(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const o={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",o)}this.context.onOpenChange?.(t,n)}}function $c(e,t=!1,n=!1){const[o,r]=d.useState(e&&t?"idle":void 0),[s,i]=d.useState(e);return e&&!s&&(i(!0),r("starting")),!e&&s&&o!=="ending"&&!n&&r("ending"),!e&&!s&&o==="ending"&&r(void 0),se(()=>{if(!e&&s&&o!=="ending"&&n){const a=Ae.request(()=>{r("ending")});return()=>{Ae.cancel(a)}}},[e,s,o,n]),se(()=>{if(!e||t)return;const a=Ae.request(()=>{r(void 0)});return()=>{Ae.cancel(a)}},[t,e]),se(()=>{if(!e||!t)return;e&&s&&o!=="idle"&&r("starting");const a=Ae.request(()=>{r("idle")});return()=>{Ae.cancel(a)}},[t,e,s,r,o]),d.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:o}),[s,o])}let Tt=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const Wc={[Tt.startingStyle]:""},Vc={[Tt.endingStyle]:""},Qt={transitionStatus(e){return e==="starting"?Wc:e==="ending"?Vc:null}};function Tr(e,t=!1,n=!0){const o=In();return z((r,s=null)=>{o.cancel();function i(){_e.flushSync(r)}const a=Be(e);if(a==null)return;const c=a;if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)r();else{let l=function(){const f=Tt.startingStyle;if(!c.hasAttribute(f)){o.request(u);return}const p=new MutationObserver(()=>{c.hasAttribute(f)||(p.disconnect(),u())});p.observe(c,{attributes:!0,attributeFilter:[f]}),s?.addEventListener("abort",()=>p.disconnect(),{once:!0})},u=function(){Promise.all(c.getAnimations().map(f=>f.finished)).then(()=>{s?.aborted||i()}).catch(()=>{const f=c.getAnimations();if(n){if(s?.aborted)return;i()}else f.length>0&&f.some(p=>p.pending||p.playState!=="finished")&&u()})};if(t){l();return}o.request(u)}})}function Bn(e){const{enabled:t=!0,open:n,ref:o,onComplete:r}=e,s=z(r),i=Tr(o,n,!1);d.useEffect(()=>{if(!t)return;const a=new AbortController;return i(s,a.signal),()=>{a.abort()}},[t,n,s,i])}function jc(e,t){const n=d.useRef(null),o=d.useRef(null);return d.useCallback(r=>{if(e!==void 0){if(n.current!==null){const s=n.current,i=o.current,a=t.context.triggerElements.getById(s);i&&a===i&&t.context.triggerElements.delete(s),n.current=null,o.current=null}r!==null&&(n.current=e,o.current=r,t.context.triggerElements.add(e,r))}},[t,e])}function Hc(e,t,n,o){const r=n.useState("isMountedByTrigger",e),s=jc(e,n),i=z(a=>{if(s(a),!a||!n.select("open"))return;const c=n.select("activeTriggerId");if(c===e){n.update({activeTriggerElement:a,...o});return}c==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...o})});return se(()=>{r&&n.update({activeTriggerElement:t.current,...o})},[r,n,t,...Object.values(o)]),{registerTrigger:i,isMountedByThisTrigger:r}}function Or(e){const t=e.useState("open");se(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[o,r]=n.value;e.update({activeTriggerId:o,activeTriggerElement:r})}}},[t,e])}function Pr(e,t,n){const{mounted:o,setMounted:r,transitionStatus:s}=$c(e);t.useSyncedValues({mounted:o,transitionStatus:s});const i=z(()=>{r(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return Bn({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class en{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const o=this.idMap.get(t);o!==n&&(o!==void 0&&this.elements.delete(o),this.elements.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function _c(){return new Nn({open:!1,floatingElement:null,referenceElement:null,triggerElements:new en,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Ir(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:_c(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:je,inactiveTriggerProps:je,popupProps:je}}const kr={open:G(e=>e.open),mounted:G(e=>e.mounted),transitionStatus:G(e=>e.transitionStatus),floatingRootContext:G(e=>e.floatingRootContext),preventUnmountingOnClose:G(e=>e.preventUnmountingOnClose),payload:G(e=>e.payload),activeTriggerId:G(e=>e.activeTriggerId),activeTriggerElement:G(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:G((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:G((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:G((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:G((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:G(e=>e.popupProps),popupElement:G(e=>e.popupElement),positionerElement:G(e=>e.positionerElement)};function Yc(e){const{open:t=!1,onOpenChange:n,elements:o={}}=e,r=vt(),s=tt()!=null,i=Ue(()=>new Nn({open:t,onOpenChange:n,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:o.triggers??new en,floatingId:r,nested:s,noEmit:e.noEmit||!1})).current;return se(()=>{const a={open:t,floatingId:r};o.reference!==void 0&&(a.referenceElement=o.reference,a.domReferenceElement=ie(o.reference)?o.reference:null),o.floating!==void 0&&(a.floatingElement=o.floating),i.update(a)},[t,r,o.reference,o.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=e.noEmit||!1,i}function Uc(e={}){const{nodeId:t,externalTree:n}=e,o=Yc(e),r=e.rootContext||o,s={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[i,a]=d.useState(null),c=d.useRef(null),l=yt(n);se(()=>{s.domReference&&(c.current=s.domReference)},[s.domReference]);const u=Pc({...e,elements:{...s,...i&&{reference:i}}}),f=d.useCallback(C=>{const I=ie(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;a(I),u.refs.setReference(I)},[u.refs]),[p,m]=d.useState(null),[g,h]=d.useState(null);r.useSyncedValue("referenceElement",p),r.useSyncedValue("domReferenceElement",ie(p)?p:null),r.useSyncedValue("floatingElement",g);const v=d.useCallback(C=>{(ie(C)||C===null)&&(c.current=C,m(C)),(ie(u.refs.reference.current)||u.refs.reference.current===null||C!==null&&!ie(C))&&u.refs.setReference(C)},[u.refs,m]),y=d.useCallback(C=>{h(C),u.refs.setFloating(C)},[u.refs]),b=d.useMemo(()=>({...u.refs,setReference:v,setFloating:y,setPositionReference:f,domReference:c}),[u.refs,v,y,f]),E=d.useMemo(()=>({...u.elements,domReference:s.domReference}),[u.elements,s.domReference]),S=r.useState("open"),w=r.useState("floatingId"),O=d.useMemo(()=>({...u,dataRef:r.context.dataRef,open:S,onOpenChange:r.setOpen,events:r.context.events,floatingId:w,refs:b,elements:E,nodeId:t,rootStore:r}),[u,b,E,t,r,S,w]);return se(()=>{r.context.dataRef.current.floatingContext=O;const C=l?.nodesRef.current.find(I=>I.id===t);C&&(C.context=O)}),d.useMemo(()=>({...u,context:O,refs:b,elements:E,rootStore:r}),[u,b,E,O,r])}function Mr(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:o=!1,onOpenChange:r}=e,s=vt(),i=tt()!=null,a=t.useState("open"),c=t.useState("activeTriggerElement"),l=t.useState(o?"popupElement":"positionerElement"),u=t.context.triggerElements,f=Ue(()=>new Nn({open:a,referenceElement:c,floatingElement:l,triggerElements:u,onOpenChange:r,floatingId:s,nested:i,noEmit:n})).current;return se(()=>{const p={open:a,floatingId:s,referenceElement:c,floatingElement:l};ie(c)&&(p.domReferenceElement=c),f.state.positionReference===f.state.referenceElement&&(p.positionReference=c),f.update(p)},[a,s,c,l,f]),f.context.onOpenChange=r,f.context.nested=i,f.context.noEmit=n,f}const Sn=Ct("safe-polygon"),zc=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${zo}`;function qc(e){return e?!!e.closest(zc):!1}function Ar(e){const t=d.useRef(void 0),n=d.useRef(!1),o=d.useRef(void 0),r=d.useRef(!0),s=d.useRef(!1),i=d.useRef(()=>{}),a=d.useRef(!1),c=Je(),l=Je(),u=d.useRef(void 0);return d.useMemo(()=>{const f=e.context.dataRef.current;return f.hoverInteractionState||(f.hoverInteractionState={pointerTypeRef:t,interactedInsideRef:n,handlerRef:o,blockMouseMoveRef:r,performedPointerEventsMutationRef:s,unbindMouseMoveRef:i,restTimeoutPendingRef:a,openChangeTimeout:c,restTimeout:l,handleCloseOptionsRef:u}),f.hoverInteractionState},[e,t,n,o,r,s,i,a,c,l,u])}const Gc=new Set(["click","mousedown"]);function Xc(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:a=!0,closeDelay:c=0,externalTree:l}=t,{pointerTypeRef:u,interactedInsideRef:f,handlerRef:p,performedPointerEventsMutationRef:m,unbindMouseMoveRef:g,restTimeoutPendingRef:h,openChangeTimeout:v,handleCloseOptionsRef:y}=Ar(n),b=yt(l),E=tt(),S=z(()=>f.current?!0:i.current.openEvent?Gc.has(i.current.openEvent.type):!1),w=z(()=>{const k=i.current.openEvent?.type;return k?.includes("mouse")&&k!=="mousedown"}),O=d.useCallback((k,L=!0)=>{const A=Kc(c,u.current);A&&!p.current?v.start(A,()=>n.setOpen(!1,ce(xe,k))):L&&(v.clear(),n.setOpen(!1,ce(xe,k)))},[c,p,n,u,v]),C=z(()=>{g.current(),p.current=void 0}),I=z(()=>{if(m.current){const k=fe(r).body;k.style.pointerEvents="",k.removeAttribute(Sn),m.current=!1}}),N=z(k=>{const L=Ee(k);if(!qc(L)){f.current=!1;return}f.current=!0});se(()=>{o||(u.current=void 0,h.current=!1,f.current=!1,C(),I())},[o,u,h,f,C,I]),d.useEffect(()=>()=>{C()},[C]),d.useEffect(()=>I,[I]),se(()=>{if(a&&o&&y.current?.blockPointerEvents&&w()&&ie(s)&&r){m.current=!0;const k=fe(r).body;k.setAttribute(Sn,"");const L=s,A=r,T=b?.nodesRef.current.find(D=>D.id===E)?.context?.elements.floating;return T&&(T.style.pointerEvents=""),k.style.pointerEvents="none",L.style.pointerEvents="auto",A.style.pointerEvents="auto",()=>{k.style.pointerEvents="",L.style.pointerEvents="",A.style.pointerEvents=""}}},[a,o,s,r,y,w,b,E,m]),d.useEffect(()=>{if(!a)return;function k(D){if(S()||!i.current.floatingContext||!n.select("open"))return;const P=n.context.triggerElements;D.relatedTarget&&P.hasElement(D.relatedTarget)||(I(),C(),S()||O(D))}function L(D){v.clear(),I(),p.current?.(D),C()}function A(D){S()||O(D,!1)}const T=r;return T&&(T.addEventListener("mouseleave",k),T.addEventListener("mouseenter",L),T.addEventListener("mouseleave",A),T.addEventListener("pointerdown",N,!0)),()=>{T&&(T.removeEventListener("mouseleave",k),T.removeEventListener("mouseenter",L),T.removeEventListener("mouseleave",A),T.removeEventListener("pointerdown",N,!0))}})}function Kc(e,t){return t&&!dt(t)?0:typeof e=="function"?e():e}function mn(e){return typeof e=="function"?e():e}const Zc={current:null};function Jc(e,t={}){const n="rootStore"in e?e.rootStore:e,{dataRef:o,events:r}=n.context,{enabled:s=!0,delay:i=0,handleClose:a=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:f=Zc,externalTree:p,isActiveTrigger:m=!0}=t,g=yt(p),{pointerTypeRef:h,interactedInsideRef:v,handlerRef:y,blockMouseMoveRef:b,performedPointerEventsMutationRef:E,unbindMouseMoveRef:S,restTimeoutPendingRef:w,openChangeTimeout:O,restTimeout:C,handleCloseOptionsRef:I}=Ar(n),N=Fe(a),k=Fe(i),L=Fe(l);m&&(I.current=N.current?.__options);const A=z(()=>v.current?!0:o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1),T=d.useCallback((B,x=!0)=>{const F=ln(k.current,"close",h.current);F&&!y.current?O.start(F,()=>n.setOpen(!1,ce(xe,B))):x&&(O.clear(),n.setOpen(!1,ce(xe,B)))},[k,y,n,h,O]),D=z(()=>{S.current(),y.current=void 0}),P=z(()=>{if(E.current){const B=fe(n.select("domReferenceElement")).body;B.style.pointerEvents="",B.removeAttribute(Sn),E.current=!1}});d.useEffect(()=>{if(!s)return;function B(x){x.open||(O.clear(),C.clear(),b.current=!0,w.current=!1)}return r.on("openchange",B),()=>{r.off("openchange",B)}},[s,r,O,C,b,w]);const V=z(B=>{if(A()||!o.current.floatingContext)return;const x=n.context.triggerElements;if(B.relatedTarget&&x.hasElement(B.relatedTarget))return;const F=f.current;N.current?.({...o.current.floatingContext,tree:g,x:B.clientX,y:B.clientY,onClose(){P(),D(),!A()&&F===n.select("domReferenceElement")&&T(B)}})(B)});return d.useEffect(()=>{if(!s)return;const B=f.current??(m?n.select("domReferenceElement"):null);if(!ie(B))return;function x(X){if(O.clear(),b.current=!1,c&&!dt(h.current)||mn(L.current)>0&&!ln(k.current,"open"))return;const K=ln(k.current,"open",h.current),Z=n.select("domReferenceElement"),_=n.context.triggerElements,ne=(_.hasElement(X.target)||_.hasMatchingElement(pe=>re(pe,X.target)))&&(!Z||!re(Z,X.target)),U=X.currentTarget??null,J=n.select("open"),de=!J||ne;ne&&J?n.setOpen(!0,ce(xe,X,U)):K?O.start(K,()=>{de&&n.setOpen(!0,ce(xe,X,U))}):de&&n.setOpen(!0,ce(xe,X,U))}function F(X){if(A()){P();return}S.current();const K=n.select("domReferenceElement"),Z=fe(K);C.clear(),w.current=!1;const _=n.context.triggerElements;if(X.relatedTarget&&_.hasElement(X.relatedTarget))return;if(N.current&&o.current.floatingContext){n.select("open")||O.clear();const U=f.current;y.current=N.current({...o.current.floatingContext,tree:g,x:X.clientX,y:X.clientY,onClose(){P(),D(),!A()&&U===n.select("domReferenceElement")&&T(X,!0)}});const J=y.current;J(X),Z.addEventListener("mousemove",J),S.current=()=>{Z.removeEventListener("mousemove",J)};return}(h.current!=="touch"||!re(n.select("floatingElement"),X.relatedTarget))&&T(X)}function Q(X){V(X)}return n.select("open")&&B.addEventListener("mouseleave",Q),u&&B.addEventListener("mousemove",x,{once:!0}),B.addEventListener("mouseenter",x),B.addEventListener("mouseleave",F),()=>{B.removeEventListener("mouseleave",Q),u&&B.removeEventListener("mousemove",x),B.removeEventListener("mouseenter",x),B.removeEventListener("mouseleave",F)}},[D,P,b,o,k,T,n,s,N,V,m,A,c,u,h,L,C,w,O,f,g,S,y]),d.useMemo(()=>{function B(x){h.current=x.pointerType}return{onPointerDown:B,onPointerEnter:B,onMouseMove(x){const{nativeEvent:F}=x,Q=x.currentTarget,X=n.select("domReferenceElement"),K=n.context.triggerElements,Z=n.select("open"),_=(K.hasElement(x.target)||K.hasMatchingElement(U=>re(U,x.target)))&&(!X||!re(X,x.target));if(c&&!dt(h.current)||Z&&!_||mn(L.current)===0||!_&&w.current&&x.movementX**2+x.movementY**2<2)return;C.clear();function ne(){if(w.current=!1,A())return;const U=n.select("open");!b.current&&(!U||_)&&n.setOpen(!0,ce(xe,F,Q))}h.current==="touch"?_e.flushSync(()=>{ne()}):_&&Z?ne():(w.current=!0,C.start(mn(L.current),ne))}}},[b,A,c,n,h,L,C,w])}function $n(e=[]){const t=e.map(l=>l?.reference),n=e.map(l=>l?.floating),o=e.map(l=>l?.item),r=e.map(l=>l?.trigger),s=d.useCallback(l=>Wt(l,e,"reference"),t),i=d.useCallback(l=>Wt(l,e,"floating"),n),a=d.useCallback(l=>Wt(l,e,"item"),o),c=d.useCallback(l=>Wt(l,e,"trigger"),r);return d.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a,getTriggerProps:c}),[s,i,a,c])}function Wt(e,t,n){const o=new Map,r=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[bn]="");for(const i in e)r&&e&&(i===Yo||i===Uo)||(s[i]=e[i]);for(let i=0;i<t.length;i+=1){let a;const c=t[i]?.[n];typeof c=="function"?a=e?c(e):null:a=c,a&&xo(s,a,r,o)}return xo(s,e,r,o),s}function xo(e,t,n,o){for(const r in t){const s=t[r];n&&(r===Yo||r===Uo)||(r.startsWith("on")?(o.has(r)||o.set(r,[]),typeof s=="function"&&(o.get(r)?.push(s),e[r]=(...i)=>o.get(r)?.map(a=>a(...i)).find(a=>a!==void 0))):e[r]=s)}}const Qc=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Fr(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{enabled:a=!0,role:c="dialog"}=t,l=vt(),u=s?.id||l,f=d.useMemo(()=>vn(i)?.id||r,[i,r]),p=Qc.get(c)??c,g=tt()!=null,h=d.useMemo(()=>p==="tooltip"||c==="label"?je:{"aria-haspopup":p==="alertdialog"?"dialog":p,"aria-expanded":"false",...p==="listbox"&&{role:"combobox"},...p==="menu"&&g&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[p,g,c]),v=d.useMemo(()=>p==="tooltip"||c==="label"?{[`aria-${c==="label"?"labelledby":"describedby"}`]:o?f:void 0}:{...h,"aria-expanded":o?"true":"false","aria-controls":o?f:void 0,...p==="menu"&&{id:u}},[p,f,o,u,c,h]),y=d.useMemo(()=>{const E={id:f,...p&&{role:p}};return p==="tooltip"||c==="label"?E:{...E,...p==="menu"&&{"aria-labelledby":u}}},[p,f,u,c]),b=d.useCallback(({active:E,selected:S})=>{const w={role:"option",...E&&{id:`${f}-fui-option`}};switch(c){case"select":case"combobox":return{...w,"aria-selected":S}}return{}},[f,c]);return d.useMemo(()=>a?{reference:v,floating:y,item:b,trigger:h}:{},[a,v,y,h,b])}function So(e,t){const[n,o]=e;let r=!1;const s=t.length;for(let i=0,a=s-1;i<s;a=i++){const[c,l]=t[i]||[0,0],[u,f]=t[a]||[0,0];l>=o!=f>=o&&n<=(u-c)*(o-l)/(f-l)+c&&(r=!r)}return r}function ea(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function ta(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:o=!0}=e,r=new Ye;let s=!1,i=null,a=null,c=typeof performance<"u"?performance.now():0;function l(f,p){const m=performance.now(),g=m-c;if(i===null||a===null||g===0)return i=f,a=p,c=m,null;const h=f-i,v=p-a,b=Math.sqrt(h*h+v*v)/g;return i=f,a=p,c=m,b}const u=({x:f,y:p,placement:m,elements:g,onClose:h,nodeId:v,tree:y})=>function(E){function S(){r.clear(),h()}if(r.clear(),!g.domReference||!g.floating||m==null||f==null||p==null)return;const{clientX:w,clientY:O}=E,C=[w,O],I=Ee(E),N=E.type==="mouseleave",k=re(g.floating,I),L=re(g.domReference,I),A=g.domReference.getBoundingClientRect(),T=g.floating.getBoundingClientRect(),D=m.split("-")[0],P=f>T.right-T.width/2,V=p>T.bottom-T.height/2,B=ea(C,A),x=T.width>A.width,F=T.height>A.height,Q=(x?A:T).left,X=(x?A:T).right,K=(F?A:T).top,Z=(F?A:T).bottom;if(k&&(s=!0,!N))return;if(L&&(s=!1),L&&!N){s=!0;return}if(N&&ie(E.relatedTarget)&&re(g.floating,E.relatedTarget)||y&&Ze(y.nodesRef.current,v).some(({context:U})=>U?.open))return;if(D==="top"&&p>=A.bottom-1||D==="bottom"&&p<=A.top+1||D==="left"&&f>=A.right-1||D==="right"&&f<=A.left+1)return S();let _=[];switch(D){case"top":_=[[Q,A.top+1],[Q,T.bottom-1],[X,T.bottom-1],[X,A.top+1]];break;case"bottom":_=[[Q,T.top+1],[Q,A.bottom-1],[X,A.bottom-1],[X,T.top+1]];break;case"left":_=[[T.right-1,Z],[T.right-1,K],[A.left+1,K],[A.left+1,Z]];break;case"right":_=[[A.right-1,Z],[A.right-1,K],[T.left+1,K],[T.left+1,Z]];break}function ne([U,J]){switch(D){case"top":{const de=[x?U+t/2:P?U+t*4:U-t*4,J+t+1],pe=[x?U-t/2:P?U+t*4:U-t*4,J+t+1],ge=[[T.left,P||x?T.bottom-t:T.top],[T.right,P?x?T.bottom-t:T.top:T.bottom-t]];return[de,pe,...ge]}case"bottom":{const de=[x?U+t/2:P?U+t*4:U-t*4,J-t],pe=[x?U-t/2:P?U+t*4:U-t*4,J-t],ge=[[T.left,P||x?T.top+t:T.bottom],[T.right,P?x?T.top+t:T.bottom:T.top+t]];return[de,pe,...ge]}case"left":{const de=[U+t+1,F?J+t/2:V?J+t*4:J-t*4],pe=[U+t+1,F?J-t/2:V?J+t*4:J-t*4];return[...[[V||F?T.right-t:T.left,T.top],[V?F?T.right-t:T.left:T.right-t,T.bottom]],de,pe]}case"right":{const de=[U-t,F?J+t/2:V?J+t*4:J-t*4],pe=[U-t,F?J-t/2:V?J+t*4:J-t*4],ge=[[V||F?T.left+t:T.right,T.top],[V?F?T.left+t:T.right:T.left+t,T.bottom]];return[de,pe,...ge]}default:return[]}}if(!So([w,O],_)){if(s&&!B)return S();if(!N&&o){const U=l(E.clientX,E.clientY);if(U!==null&&U<.1)return S()}So([w,O],ne([f,p]))?!s&&o&&r.start(40,S):S()}};return u.__options={blockPointerEvents:n},u}function Lr(e){return vt(e,"base-ui")}function na(e){const t=d.useRef(""),n=d.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:d.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r&&e(r,r.pointerType),e(r,t.current),t.current=""},[e]),onPointerDown:n}}function Dr(e){const[t,n]=d.useState(null),o=z((a,c)=>{e||n(c||(_o?"touch":""))}),r=d.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:i}=na(o);return d.useMemo(()=>({openMethod:t,reset:r,triggerProps:{onClick:s,onPointerDown:i}}),[t,r,s,i])}let Oe=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Tt.startingStyle]="startingStyle",e[e.endingStyle=Tt.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),wn=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const oa={[wn.popupOpen]:""},ra={[wn.popupOpen]:"",[wn.pressed]:""},sa={[Oe.open]:""},ia={[Oe.closed]:""},ca={[Oe.anchorHidden]:""},aa={open(e){return e?oa:null}},la={open(e){return e?ra:null}},kt={open(e){return e?sa:ia},anchorHidden(e){return e?ca:null}};function Nr(e){return Ao(19)?e:e?"true":void 0}let wo={},Co={},To="";function ua(e){if(typeof document>"u")return!1;const t=nt(e);return Ce(t).innerWidth-t.documentElement.clientWidth>0}function fa(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const o=nt(e).documentElement,r={scrollbarGutter:o.style.scrollbarGutter,overflowY:o.style.overflowY};o.style.scrollbarGutter="stable",o.style.overflowY="scroll";const s=o.offsetWidth;o.style.overflowY="hidden";const i=o.offsetWidth;return Object.assign(o.style,r),s===i}function da(e){const t=nt(e),n=t.documentElement,o=t.body,r=Pt(n)?n:o,s=r.style.overflow;return r.style.overflow="hidden",()=>{r.style.overflow=s}}function pa(e){const t=nt(e),n=t.documentElement,o=t.body,r=Ce(n);let s=0,i=0,a=!1;const c=Ae.create();if(qs&&(r.visualViewport?.scale??1)!==1)return()=>{};function l(){const p=r.getComputedStyle(n),m=r.getComputedStyle(o),v=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,wo={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},To=n.style.scrollBehavior,Co={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const y=n.scrollHeight>n.clientHeight,b=n.scrollWidth>n.clientWidth,E=p.overflowY==="scroll"||m.overflowY==="scroll",S=p.overflowX==="scroll"||m.overflowX==="scroll",w=Math.max(0,r.innerWidth-o.clientWidth),O=Math.max(0,r.innerHeight-o.clientHeight),C=parseFloat(m.marginTop)+parseFloat(m.marginBottom),I=parseFloat(m.marginLeft)+parseFloat(m.marginRight),N=Pt(n)?n:o;if(a=fa(e),a){n.style.scrollbarGutter=v,N.style.overflowY="hidden",N.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:v,overflowY:"hidden",overflowX:"hidden"}),(y||E)&&(n.style.overflowY="scroll"),(b||S)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:C||O?`calc(100dvh - ${C+O}px)`:"100dvh",width:I||w?`calc(100vw - ${I+w}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function u(){Object.assign(n.style,wo),Object.assign(o.style,Co),a||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=To)}function f(){u(),c.request(l)}return l(),r.addEventListener("resize",f),()=>{c.cancel(),u(),typeof r.removeEventListener=="function"&&r.removeEventListener("resize",f)}}class ga{lockCount=0;restore=null;timeoutLock=Ye.create();timeoutUnlock=Ye.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),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(t){if(this.lockCount===0||this.restore!==null)return;const o=nt(t).documentElement,r=Ce(o).getComputedStyle(o).overflowY;if(r==="hidden"||r==="clip"){this.restore=Fo;return}const s=_o||!ua(t);this.restore=s?da(t):pa(t)}}const ma=new ga;function Br(e=!0,t=null){se(()=>{if(e)return ma.acquire(t)},[e,t])}const ha=d.createContext(void 0);function ba(){return d.useContext(ha)?.direction??"ltr"}const va=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:o,placement:r,rects:s,platform:i,elements:a,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:f="real"}=$e(e,t)||{};if(l==null)return{};const p=Xo(u),m={x:n,y:o},g=An(r),h=Mn(g),v=await i.getDimensions(l),y=g==="y",b=y?"top":"left",E=y?"bottom":"right",S=y?"clientHeight":"clientWidth",w=s.reference[h]+s.reference[g]-m[g]-s.floating[h],O=m[g]-s.reference[g],C=f==="real"?await i.getOffsetParent?.(l):a.floating;let I=a.floating[S]||s.floating[h];(!I||!await i.isElement?.(C))&&(I=a.floating[S]||s.floating[h]);const N=w/2-O/2,k=I/2-v[h]/2-1,L=Math.min(p[b],k),A=Math.min(p[E],k),T=L,D=I-v[h]-A,P=I/2-v[h]/2+N,V=yn(T,P,D),B=!c.arrow&&qe(r)!=null&&P!==V&&s.reference[h]/2-(P<T?L:A)-v[h]/2<0,x=B?P<T?P-T:P-D:0;return{[g]:m[g]+x,data:{[g]:V,centerOffset:P-V-x,...B&&{alignmentOffset:x}},reset:B}}}),ya=(e,t)=>({...va(e),options:[e,t]}),Ea={name:"hide",async fn(e){const{width:t,height:n,x:o,y:r}=e.rects.reference,s=t===0&&n===0&&o===0&&r===0;return{data:{referenceHidden:(await Lc().fn(e)).data?.referenceHidden||s}}}},jt={sideX:"left",sideY:"top"},Ra={name:"adaptiveOrigin",async fn(e){const{x:t,y:n,rects:{floating:o},elements:{floating:r},platform:s,strategy:i,placement:a}=e,c=Ce(r),l=c.getComputedStyle(r);if(!(l.transitionDuration!=="0s"&&l.transitionDuration!==""))return{x:t,y:n,data:jt};const f=await s.getOffsetParent?.(r);let p={width:0,height:0};if(i==="fixed"&&c?.visualViewport)p={width:c.visualViewport.width,height:c.visualViewport.height};else if(f===c){const b=nt(r);p={width:b.documentElement.clientWidth,height:b.documentElement.clientHeight}}else await s.isElement?.(f)&&(p=await s.getDimensions(f));const m=ye(a);let g=t,h=n;m==="left"&&(g=p.width-(t+o.width)),m==="top"&&(h=p.height-(n+o.height));const v=m==="left"?"right":jt.sideX,y=m==="top"?"bottom":jt.sideY;return{x:g,y:h,data:{sideX:v,sideY:y}}}};function $r(e,t,n){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?n?"inline-start":"inline-end":"right",bottom:"bottom",left:o?n?"inline-end":"inline-start":"left"}[t]}function Oo(e,t,n){const{rects:o,placement:r}=e;return{side:$r(t,ye(r),n),align:qe(r)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function xa(e){const{anchor:t,positionMethod:n="absolute",side:o="bottom",sideOffset:r=0,align:s="center",alignOffset:i=0,collisionBoundary:a,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:f=!1,keepMounted:p=!1,floatingRootContext:m,mounted:g,collisionAvoidance:h,shiftCrossAxis:v=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:E=!1,externalTree:S}=e,[w,O]=d.useState(null);!g&&w!==null&&O(null);const C=h.side||"flip",I=h.align||"flip",N=h.fallbackAxisSide||"end",k=typeof t=="function"?t:void 0,L=z(k),A=k?L:t,T=Fe(t),P=ba()==="rtl",V=w||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":P?"left":"right","inline-start":P?"right":"left"}[o],B=s==="center"?V:`${V}-${s}`;let x=c;const F=1,Q=o==="bottom"?F:0,X=o==="top"?F:0,K=o==="right"?F:0,Z=o==="left"?F:0;typeof x=="number"?x={top:x+Q,right:x+Z,bottom:x+X,left:x+K}:x&&(x={top:(x.top||0)+Q,right:(x.right||0)+Z,bottom:(x.bottom||0)+X,left:(x.left||0)+K});const _={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:x},ne=d.useRef(null),U=Fe(r),J=Fe(i),ge=[Ic(le=>{const ve=Oo(le,o,P),Me=typeof U.current=="function"?U.current(ve):U.current,Se=typeof J.current=="function"?J.current(ve):J.current;return{mainAxis:Me,crossAxis:Se,alignmentAxis:Se}},[typeof r!="function"?r:0,typeof i!="function"?i:0,P,o])],De=I==="none"&&C!=="shift",R=!De&&(l||v||C==="shift"),Y=C==="none"?null:Ac({..._,padding:{top:x.top+F,right:x.right+F,bottom:x.bottom+F,left:x.left+F},mainAxis:!v&&C==="flip",crossAxis:I==="flip"?"alignment":!1,fallbackAxisSideDirection:N}),$=De?null:kc(le=>{const ve=nt(le.elements.floating).documentElement;return{..._,rootBoundary:v?{x:0,y:0,width:ve.clientWidth,height:ve.clientHeight}:void 0,mainAxis:I!=="none",crossAxis:R,limiter:l||v?void 0:Mc(Me=>{if(!ne.current)return{};const{width:Se,height:rt}=ne.current.getBoundingClientRect(),st=we(ye(Me.placement)),At=st==="y"?Se:rt,tn=st==="y"?x.left+x.right:x.top+x.bottom;return{offset:At/2+tn/2}})}},[_,l,v,x,I]);C==="shift"||I==="shift"||s==="center"?ge.push($,Y):ge.push(Y,$),ge.push(Fc({..._,apply({elements:{floating:le},rects:{reference:ve},availableWidth:Me,availableHeight:Se}){Object.entries({"--available-width":`${Me}px`,"--available-height":`${Se}px`,"--anchor-width":`${ve.width}px`,"--anchor-height":`${ve.height}px`}).forEach(([rt,st])=>{le.style.setProperty(rt,st)})}}),ya(()=>({element:ne.current||document.createElement("div"),padding:u,offsetParent:"floating"}),[u]),{name:"transformOrigin",fn(le){const{elements:ve,middlewareData:Me,placement:Se,rects:rt,y:st}=le,At=ye(Se),tn=we(At),Un=ne.current,es=Me.arrow?.x||0,ts=Me.arrow?.y||0,ns=Un?.clientWidth||0,os=Un?.clientHeight||0,nn=es+ns/2,zn=ts+os/2,rs=Math.abs(Me.shift?.y||0),ss=rt.reference.height/2,Rt=typeof r=="function"?r(Oo(le,o,P)):r,is=rs>Rt,cs={top:`${nn}px calc(100% + ${Rt}px)`,bottom:`${nn}px ${-Rt}px`,left:`calc(100% + ${Rt}px) ${zn}px`,right:`${-Rt}px ${zn}px`}[At],as=`${nn}px ${rt.reference.y+ss-st}px`;return ve.floating.style.setProperty("--transform-origin",R&&tn==="y"&&is?as:cs),{}}},Ea,b),se(()=>{!g&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[g,m]);const ue=d.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:M,elements:W,x:q,y:te,middlewareData:oe,update:H,placement:j,context:me,isPositioned:ae,floatingStyles:Ne}=Uc({rootContext:m,placement:B,middleware:ge,strategy:n,whileElementsMounted:p?void 0:(...le)=>Eo(...le,ue),nodeId:y,externalTree:S}),{sideX:Ge,sideY:ot}=oe.adaptiveOrigin||jt,Xe=ae?n:"fixed",he=d.useMemo(()=>b?{position:Xe,[Ge]:q,[ot]:te}:{position:Xe,...Ne},[b,Xe,Ge,q,ot,te,Ne]),Ie=d.useRef(null);se(()=>{if(!g)return;const le=T.current,ve=typeof le=="function"?le():le,Se=(Po(ve)?ve.current:ve)||null||null;Se!==Ie.current&&(M.setPositionReference(Se),Ie.current=Se)},[g,M,A,T]),d.useEffect(()=>{if(!g)return;const le=T.current;typeof le!="function"&&Po(le)&&le.current!==Ie.current&&(M.setPositionReference(le.current),Ie.current=le.current)},[g,M,A,T]),d.useEffect(()=>{if(p&&g&&W.domReference&&W.floating)return Eo(W.domReference,W.floating,H,ue)},[p,g,W,H,ue]);const ke=ye(j),Vn=$r(o,ke,P),jn=qe(j)||"center",Hn=!!oe.hide?.referenceHidden;se(()=>{E&&g&&ae&&O(ke)},[E,g,ae,ke]);const _n=d.useMemo(()=>({position:"absolute",top:oe.arrow?.y,left:oe.arrow?.x}),[oe.arrow]),Yn=oe.arrow?.centerOffset!==0;return d.useMemo(()=>({positionerStyles:he,arrowStyles:_n,arrowRef:ne,arrowUncentered:Yn,side:Vn,align:jn,physicalSide:ke,anchorHidden:Hn,refs:M,context:me,isPositioned:ae,update:H}),[he,_n,ne,Yn,Vn,jn,ke,Hn,M,me,ae,H])}function Po(e){return e!=null&&"current"in e}const Wr=d.forwardRef(function(t,n){const{cutout:o,...r}=t;let s;if(o){const i=o?.getBoundingClientRect();s=`polygon(
|
|
2
|
+
0% 0%,
|
|
3
|
+
100% 0%,
|
|
4
|
+
100% 100%,
|
|
5
|
+
0% 100%,
|
|
6
|
+
0% 0%,
|
|
7
|
+
${i.left}px ${i.top}px,
|
|
8
|
+
${i.left}px ${i.bottom}px,
|
|
9
|
+
${i.right}px ${i.bottom}px,
|
|
10
|
+
${i.right}px ${i.top}px,
|
|
11
|
+
${i.left}px ${i.top}px
|
|
12
|
+
)`}return ee.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),Sa=d.createContext(void 0);function wa(e){return d.useContext(Sa)}const Vr="ArrowUp",jr="ArrowDown",Hr="ArrowLeft",_r="ArrowRight",Yr="Home",Ur="End",Ca=new Set([Hr,_r]),Ta=new Set([Vr,jr]),Oa=new Set([...Ca,...Ta]);[...Oa];const zr=new Set([Vr,jr,Hr,_r,Yr,Ur]);function qr(e){return e==="starting"?hs:je}function tl({children:e,variant:t="primary",size:n="md",onClick:o,disabled:r=!1,className:s="",as:i="button",...a}){const c="inline-flex items-center justify-center font-medium transition-all duration-200 rounded-md focus:outline-none focus:ring-2 focus:ring-oai-blue/30 active:scale-[0.98] active:duration-100",l={primary:"bg-oai-black dark:bg-oai-white text-white dark:text-oai-black border border-transparent hover:bg-oai-gray-800 dark:hover:bg-oai-gray-200 active:bg-oai-gray-900 dark:active:bg-oai-gray-300 disabled:bg-oai-gray-300 dark:disabled:bg-oai-gray-700 disabled:text-oai-gray-500 dark:disabled:text-oai-gray-400 focus:ring-oai-brand/30 transition-colors duration-200",secondary:"bg-oai-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white border border-oai-gray-300 dark:border-oai-gray-700 hover:border-oai-brand hover:text-oai-brand active:bg-oai-gray-50 dark:active:bg-oai-gray-800 active:border-oai-brand-dark disabled:text-oai-gray-400 dark:disabled:text-oai-gray-500 disabled:border-oai-gray-200 dark:disabled:border-oai-gray-700 focus:ring-oai-brand/30 transition-colors duration-200",ghost:"bg-transparent text-oai-gray-600 dark:text-oai-gray-300 border border-transparent hover:text-oai-brand hover:bg-oai-brand-50/50 dark:hover:bg-oai-brand-950/30 active:bg-oai-brand-50 dark:active:bg-oai-brand-900/50 disabled:text-oai-gray-400 dark:disabled:text-oai-gray-500 focus:ring-oai-brand/30 transition-colors duration-200"},u={sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-12 px-6 text-base"},f=r?"cursor-not-allowed opacity-60":"cursor-pointer",p=`${c} ${l[t]} ${u[n]} ${f} ${s}`;return ee.jsx(i,{className:p,onClick:o,disabled:r,...a,children:e})}const Gr=d.createContext(void 0);function Et(e){const t=d.useContext(Gr);if(e===!1&&t===void 0)throw new Error(et(27));return t}const Pa={...kt,...Qt},nl=d.forwardRef(function(t,n){const{render:o,className:r,forceRender:s=!1,...i}=t,{store:a}=Et(),c=a.useState("open"),l=a.useState("nested"),u=a.useState("mounted"),f=a.useState("transitionStatus"),p=d.useMemo(()=>({open:c,transitionStatus:f}),[c,f]);return ze("div",t,{state:p,ref:[a.context.backdropRef,n],stateAttributesMapping:Pa,props:[{role:"presentation",hidden:!u,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:s||!l})});let Ia=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),ka=(function(e){return e[e.open=Oe.open]="open",e[e.closed=Oe.closed]="closed",e[e.startingStyle=Oe.startingStyle]="startingStyle",e[e.endingStyle=Oe.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Xr=d.createContext(void 0);function Kr(){const e=d.useContext(Xr);if(e===void 0)throw new Error(et(26));return e}const Ma={...kt,...Qt,nestedDialogOpen(e){return e?{[ka.nestedDialogOpen]:""}:null}},ol=d.forwardRef(function(t,n){const{className:o,finalFocus:r,initialFocus:s,render:i,...a}=t,{store:c}=Et(),l=c.useState("descriptionElementId"),u=c.useState("disablePointerDismissal"),f=c.useState("floatingRootContext"),p=c.useState("popupProps"),m=c.useState("modal"),g=c.useState("mounted"),h=c.useState("nested"),v=c.useState("nestedOpenDialogCount"),y=c.useState("open"),b=c.useState("openMethod"),E=c.useState("titleElementId"),S=c.useState("transitionStatus"),w=c.useState("role");Kr(),Bn({open:y,ref:c.context.popupRef,onComplete(){y&&c.context.onOpenChangeComplete?.(!0)}});function O(L){return L==="touch"?c.context.popupRef.current:!0}const C=s===void 0?O:s,I=v>0,N=d.useMemo(()=>({open:y,nested:h,transitionStatus:S,nestedDialogOpen:I}),[y,h,S,I]),k=ze("div",t,{state:N,props:[p,{"aria-labelledby":E??void 0,"aria-describedby":l??void 0,role:w,tabIndex:-1,hidden:!g,onKeyDown(L){zr.has(L.key)&&L.stopPropagation()},style:{[Ia.nestedDialogs]:v}},a],ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],stateAttributesMapping:Ma});return ee.jsx(hr,{context:f,openInteractionType:b,disabled:!g,closeOnFocusOut:!u,initialFocus:C,returnFocus:r,modal:m!==!1,restoreFocus:"popup",children:k})}),rl=d.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=Et(),i=s.useState("mounted"),a=s.useState("modal"),c=s.useState("open");return i||o?ee.jsx(Xr.Provider,{value:o,children:ee.jsxs(mr,{ref:n,...r,children:[i&&a===!0&&ee.jsx(Wr,{ref:s.context.internalBackdropRef,inert:Nr(!c)}),t.children]})}):null});function Aa(e){const{store:t,parentContext:n,actionsRef:o}=e,r=t.useState("open"),s=t.useState("disablePointerDismissal"),i=t.useState("modal"),a=t.useState("popupElement"),{openMethod:c,triggerProps:l,reset:u}=Dr(r);Or(t);const{forceUnmount:f}=Pr(r,t,()=>{u()}),p=z(k=>{const L=ce(k);return L.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},L}),m=d.useCallback(()=>{t.setOpen(!1,p(fr))},[t,p]);d.useImperativeHandle(o,()=>({unmount:f,close:m}),[f,m]);const g=Mr({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[h,v]=d.useState(0),y=h===0,b=Fr(g),E=Cr(g,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(k){if("button"in k&&k.button!==0||"touches"in k&&k.touches.length!==1)return!1;const L=Ee(k);if(y&&!s){const A=L;return i&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===A||t.context.backdropRef.current===A||re(A,a)&&!A?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:y});Br(r&&i===!0,a);const{getReferenceProps:S,getFloatingProps:w,getTriggerProps:O}=$n([b,E]);t.useContextCallback("onNestedDialogOpen",k=>{v(k+1)}),t.useContextCallback("onNestedDialogClose",()=>{v(0)}),d.useEffect(()=>(n?.onNestedDialogOpen&&r&&n.onNestedDialogOpen(h),n?.onNestedDialogClose&&!r&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&r&&n.onNestedDialogClose()}),[r,n,h]);const C=d.useMemo(()=>S(l),[S,l]),I=d.useMemo(()=>O(l),[O,l]),N=d.useMemo(()=>w(),[w]);t.useSyncedValues({openMethod:c,activeTriggerProps:C,inactiveTriggerProps:I,popupProps:N,floatingRootContext:g,nestedOpenDialogCount:h})}const Fa={...kr,modal:G(e=>e.modal),nested:G(e=>e.nested),nestedOpenDialogCount:G(e=>e.nestedOpenDialogCount),disablePointerDismissal:G(e=>e.disablePointerDismissal),openMethod:G(e=>e.openMethod),descriptionElementId:G(e=>e.descriptionElementId),titleElementId:G(e=>e.titleElementId),viewportElement:G(e=>e.viewportElement),role:G(e=>e.role)};class La extends On{constructor(t){super(Da(t),{popupRef:d.createRef(),backdropRef:d.createRef(),internalBackdropRef:d.createRef(),triggerElements:new en,onOpenChange:void 0,onOpenChangeComplete:void 0},Fa)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const o={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",o);const r={open:t},s=n.trigger?.id??null;(s||t)&&(r.activeTriggerId=s,r.activeTriggerElement=n.trigger??null),this.update(r)}}function Da(e={}){return{...Ir(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function sl(e){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,disablePointerDismissal:i=!1,modal:a=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:f=null}=e,p=Et(!0),m=!!p,g=Ue(()=>l?.store??new La({open:n??o,activeTriggerId:u!==void 0?u:f,modal:a,disablePointerDismissal:i,nested:m})).current;g.useControlledProp("open",n,o),g.useControlledProp("activeTriggerId",u,f),g.useSyncedValues({disablePointerDismissal:i,nested:m,modal:a}),g.useContextCallback("onOpenChange",r),g.useContextCallback("onOpenChangeComplete",s);const h=g.useState("payload");Aa({store:g,actionsRef:c,parentContext:p?.store.context});const v=d.useMemo(()=>({store:g}),[g]);return ee.jsx(Gr.Provider,{value:v,children:typeof t=="function"?t({payload:h}):t})}let Io=(function(e){return e[e.open=Oe.open]="open",e[e.closed=Oe.closed]="closed",e[e.startingStyle=Oe.startingStyle]="startingStyle",e[e.endingStyle=Oe.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Na={...kt,...Qt,nested(e){return e?{[Io.nested]:""}:null},nestedDialogOpen(e){return e?{[Io.nestedDialogOpen]:""}:null}},il=d.forwardRef(function(t,n){const{className:o,render:r,children:s,...i}=t,a=Kr(),{store:c}=Et(),l=c.useState("open"),u=c.useState("nested"),f=c.useState("transitionStatus"),p=c.useState("nestedOpenDialogCount"),m=c.useState("mounted"),g=p>0,h=d.useMemo(()=>({open:l,nested:u,transitionStatus:f,nestedDialogOpen:g}),[l,u,f,g]);return ze("div",t,{enabled:a||m,state:h,ref:[n,c.useStateSetter("viewportElement")],stateAttributesMapping:Na,props:[{role:"presentation",hidden:!m,children:s},i]})}),cl=d.forwardRef(function(t,n){const{render:o,className:r,id:s,...i}=t,{store:a}=Et(),c=Lr(s);return a.useSyncedValueWithCleanup("titleElementId",c),ze("h2",t,{ref:n,props:[{id:c},i]})}),Zr=d.createContext(void 0);function Mt(e){const t=d.useContext(Zr);if(t===void 0&&!e)throw new Error(et(47));return t}function Ba(){return{...Ir(),disabled:!1,modal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const $a={...kr,disabled:G(e=>e.disabled),instantType:G(e=>e.instantType),openMethod:G(e=>e.openMethod),openChangeReason:G(e=>e.openChangeReason),modal:G(e=>e.modal),stickIfOpen:G(e=>e.stickIfOpen),titleElementId:G(e=>e.titleElementId),descriptionElementId:G(e=>e.descriptionElementId),openOnHover:G(e=>e.openOnHover),closeDelay:G(e=>e.closeDelay),hasViewport:G(e=>e.hasViewport)};class Wn extends On{constructor(t){const n={...Ba(),...t};n.open&&t?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:d.createRef(),backdropRef:d.createRef(),internalBackdropRef:d.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:d.createRef(),beforeContentFocusGuardRef:d.createRef(),stickIfOpenTimeout:new Ye,triggerElements:new en},$a)}setOpen=(t,n)=>{const o=n.reason===xe,r=n.reason===He&&n.event.detail===0,s=!t&&(n.reason===ur||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const i={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",i);const c=()=>{const l={open:t,openChangeReason:n.reason},u=n.trigger?.id??null;(u||t)&&(l.activeTriggerId=u,l.activeTriggerElement=n.trigger??null),this.update(l)};o?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(ms,()=>{this.set("stickIfOpen",!1)}),_e.flushSync(c)):c(),r||s?this.set("instantType",r?"click":"dismiss"):n.reason===wt?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(t,n){const o=Ue(()=>new Wn(n)).current,r=t??o;return Pn(o.disposeEffect),r}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ko({props:e}){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,modal:i=!1,handle:a,triggerId:c,defaultTriggerId:l=null}=e,u=Wn.useStore(a?.store,{open:n??o,modal:i,activeTriggerId:c!==void 0?c:l});u.useControlledProp("open",n,o),u.useControlledProp("activeTriggerId",c,l);const f=u.useState("open"),p=u.useState("positionerElement"),m=u.useState("payload"),g=u.useState("openChangeReason");u.useContextCallback("onOpenChange",r),u.useContextCallback("onOpenChangeComplete",s);const{openMethod:h,triggerProps:v,reset:y}=Dr(f);Or(u);const{forceUnmount:b}=Pr(f,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null}),y()});Br(f&&i===!0&&g!==xe&&h!=="touch",p),d.useEffect(()=>{f||u.context.stickIfOpenTimeout.clear()},[u,f]);const E=d.useCallback(P=>{const V=ce(P);return V.preventUnmountOnClose=()=>{u.set("preventUnmountingOnClose",!0)},V},[u]),S=d.useCallback(()=>{u.setOpen(!1,E(fr))},[u,E]);d.useImperativeHandle(e.actionsRef,()=>({unmount:b,close:S}),[b,S]);const w=Mr({popupStore:u,onOpenChange:u.setOpen}),O=Cr(w,{outsidePressEvent:{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),C=Fr(w),{getReferenceProps:I,getFloatingProps:N,getTriggerProps:k}=$n([O,C]),L=d.useMemo(()=>I(v),[I,v]),A=d.useMemo(()=>k(v),[k,v]),T=d.useMemo(()=>N(),[N]);u.useSyncedValues({modal:i,openMethod:h,activeTriggerProps:L,inactiveTriggerProps:A,popupProps:T,floatingRootContext:w,nested:tt()!=null});const D=d.useMemo(()=>({store:u}),[u]);return ee.jsx(Zr.Provider,{value:D,children:typeof t=="function"?t({payload:m}):t})}function al(e){return Mt(!0)?ee.jsx(ko,{props:e}):ee.jsx(Ni,{children:ee.jsx(ko,{props:e})})}const Wa=300,ll=d.forwardRef(function(t,n){const{render:o,className:r,disabled:s=!1,nativeButton:i=!0,handle:a,payload:c,openOnHover:l=!1,delay:u=Wa,closeDelay:f=0,id:p,...m}=t,g=Mt(!0),h=a?.store??g?.store;if(!h)throw new Error(et(74));const v=Lr(p),y=h.useState("isTriggerActive",v),b=h.useState("floatingRootContext"),E=h.useState("isOpenedByTrigger",v),S=d.useRef(null),{registerTrigger:w,isMountedByThisTrigger:O}=Hc(v,S,h,{payload:c,disabled:s,openOnHover:l,closeDelay:f}),C=h.useState("openChangeReason"),I=h.useState("stickIfOpen"),N=h.useState("openMethod"),k=Jc(b,{enabled:b!=null&&l&&(N!=="touch"||C!==He),mouseOnly:!0,move:!1,handleClose:ta(),restMs:u,delay:{close:f},triggerElementRef:S,isActiveTrigger:y}),L=qi(b,{enabled:b!=null,stickIfOpen:I}),A=$n([L]),T=h.useState("triggerProps",O),D=d.useMemo(()=>({disabled:s,open:E}),[s,E]),{getButtonProps:P,buttonRef:V}=gs({disabled:s,native:i}),B=d.useMemo(()=>({open(K){return K&&C===He?la.open(K):aa.open(K)}}),[C]),x=ze("button",t,{state:D,ref:[V,n,w,S],props:[A.getReferenceProps(),k,T,{[Do]:"",id:v},m,P],stateAttributesMapping:B}),F=d.useRef(null),Q=z(K=>{_e.flushSync(()=>{h.setOpen(!1,ce(wt,K.nativeEvent,K.currentTarget))}),Ii(F.current)?.focus()}),X=z(K=>{const Z=h.select("positionerElement");if(Z&&at(K,Z))h.context.beforeContentFocusGuardRef.current?.focus();else{_e.flushSync(()=>{h.setOpen(!1,ce(wt,K.nativeEvent,K.currentTarget))});let _=Pi(h.context.triggerFocusTargetRef.current||S.current);for(;_!==null&&re(Z,_);){const ne=_;if(_=Fn(_),_===ne)break}_?.focus()}});return y?ee.jsxs(d.Fragment,{children:[ee.jsx(mt,{ref:F,onFocus:Q}),ee.jsx(d.Fragment,{children:x},v),ee.jsx(mt,{ref:h.context.triggerFocusTargetRef,onFocus:X})]}):ee.jsx(d.Fragment,{children:x},v)}),Jr=d.createContext(void 0);function Va(){const e=d.useContext(Jr);if(e===void 0)throw new Error(et(45));return e}const ul=d.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=Mt();return s.useState("mounted")||o?ee.jsx(Jr.Provider,{value:o,children:ee.jsx(mr,{ref:n,...r,renderGuards:!1})}):null}),Qr=d.createContext(void 0);function ja(){const e=d.useContext(Qr);if(!e)throw new Error(et(46));return e}const fl=d.forwardRef(function(t,n){const{render:o,className:r,anchor:s,positionMethod:i="absolute",side:a="bottom",align:c="center",sideOffset:l=0,alignOffset:u=0,collisionBoundary:f="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:g=!1,disableAnchorTracking:h=!1,collisionAvoidance:v=bs,...y}=t,{store:b}=Mt(),E=Va(),S=Li(),w=b.useState("floatingRootContext"),O=b.useState("mounted"),C=b.useState("open"),I=b.useState("openChangeReason"),N=b.useState("activeTriggerElement"),k=b.useState("modal"),L=b.useState("positionerElement"),A=b.useState("instantType"),T=b.useState("transitionStatus"),D=b.useState("hasViewport"),P=d.useRef(null),V=Tr(L,!1,!1),B=xa({anchor:s,floatingRootContext:w,positionMethod:i,mounted:O,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:m,collisionBoundary:f,collisionPadding:p,sticky:g,disableAnchorTracking:h,keepMounted:E,nodeId:S,collisionAvoidance:v,adaptiveOrigin:D?Ra:void 0}),x=d.useMemo(()=>{const _={};return C||(_.pointerEvents="none"),{role:"presentation",hidden:!O,style:{...B.positionerStyles,..._}}},[C,O,B.positionerStyles]),F=d.useMemo(()=>({props:x,...B}),[x,B]),Q=w?.select("domReferenceElement");se(()=>{const _=Q,ne=P.current;if(_&&(P.current=_),ne&&_&&_!==ne){b.set("instantType",void 0);const U=new AbortController;return V(()=>{b.set("instantType","trigger-change")},U.signal),()=>{U.abort()}}},[Q,V,b]);const X=d.useMemo(()=>({open:C,side:F.side,align:F.align,anchorHidden:F.anchorHidden,instant:A}),[C,F.side,F.align,F.anchorHidden,A]),K=d.useCallback(_=>{b.set("positionerElement",_)},[b]),Z=ze("div",t,{state:X,props:[F.props,qr(T),y],ref:[n,K],stateAttributesMapping:kt});return ee.jsxs(Qr.Provider,{value:F,children:[O&&k===!0&&I!==xe&&ee.jsx(Wr,{ref:b.context.internalBackdropRef,inert:Nr(!C),cutout:N}),ee.jsx(Di,{id:S,children:Z})]})}),Ha={...kt,...Qt},dl=d.forwardRef(function(t,n){const{className:o,render:r,initialFocus:s,finalFocus:i,...a}=t,{store:c}=Mt(),l=ja(),u=wa()!=null,f=c.useState("open"),p=c.useState("openMethod"),m=c.useState("instantType"),g=c.useState("transitionStatus"),h=c.useState("popupProps"),v=c.useState("titleElementId"),y=c.useState("descriptionElementId"),b=c.useState("modal"),E=c.useState("mounted"),S=c.useState("openChangeReason"),w=c.useState("activeTriggerElement"),O=c.useState("floatingRootContext");Bn({open:f,ref:c.context.popupRef,onComplete(){f&&c.context.onOpenChangeComplete?.(!0)}});const C=c.useState("disabled"),I=c.useState("openOnHover"),N=c.useState("closeDelay");Xc(O,{enabled:I&&!C,closeDelay:N});function k(P){return P==="touch"?c.context.popupRef.current:!0}const L=s===void 0?k:s,A=d.useMemo(()=>({open:f,side:l.side,align:l.align,instant:m,transitionStatus:g}),[f,l.side,l.align,m,g]),T=d.useCallback(P=>{c.set("popupElement",P)},[c]),D=ze("div",t,{state:A,ref:[n,c.context.popupRef,T],props:[h,{"aria-labelledby":v,"aria-describedby":y,onKeyDown(P){u&&zr.has(P.key)&&P.stopPropagation()}},qr(g),a],stateAttributesMapping:Ha});return ee.jsx(hr,{context:O,openInteractionType:p,modal:b==="trap-focus",disabled:!E||S===xe,initialFocus:L,returnFocus:i,restoreFocus:"popup",previousFocusableElement:be(w)?w:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:D})});export{Qa as $,Ga as A,tl as B,Ja as C,sl as D,Ee as E,wt as F,ni as G,oi as H,Je as I,Lr as J,G as K,$c as L,Dr as M,Hs as N,lr as O,al as P,Bn as Q,Yc as R,St as S,qi as T,Cr as U,$n as V,Ua as W,Bo as X,Bi as Y,la as Z,nt as _,Za as a,aa as a0,mr as a1,Ya as a2,Br as a3,xa as a4,Wr as a5,Nr as a6,kt as a7,wa as a8,In as a9,qs as aa,hr as ab,el as ac,Qt as ad,qr as ae,zr as af,Ka as ag,rl as b,ce as c,nl as d,il as e,ol as f,cl as g,ll as h,ul as i,fl as j,dl as k,Xa as l,za as m,qa as n,Nt as o,vn as p,Fe as q,tt as r,ei as s,yt as t,Et as u,to as v,un as w,it as x,fe as y,re as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as
|
|
1
|
+
import{D as n}from"./main-BkcFhXuV.js";function h({size:o=16,className:l=""}){return n.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:l,children:n.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})})}function d({size:o=16,className:l=""}){return n.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:l,children:n.jsx("path",{d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"})})}function a({size:o=16,className:l=""}){return n.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:l,children:n.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})})}function s({size:o=16,className:l=""}){return n.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:l,children:n.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})})}function v({size:o=16,className:l=""}){return n.jsx("svg",{width:o,height:o,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:l,children:n.jsx("path",{d:"M4.125 20.149c-2.69 5.959 3.036 7.453 7.26 3.966 1.24 3.91 5.898.993 7.569-2.036 3.682-6.678 2.195-13.49 1.813-14.895-2.617-9.582-15.699-9.592-17.95.049-.526 1.687-.535 3.606-.833 5.598-.15 1.005-.256 1.646-.645 2.703-.223.607-.53 1.147-1.014 2.056-.75 1.412-.434 4.138 3.434 2.724v.001ZM11.895 11.332c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.395.9.395 1.578 0 1.283-.493 2.048-1.319 2.048Zm4.416 0c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.396.9.396 1.578 0 1.283-.494 2.048-1.32 2.048Z"})})}function u({size:o=16,className:l=""}){return n.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:l,children:n.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function g({size:o=16,className:l=""}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:l,children:[n.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),n.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]})}function x({size:o=16,className:l=""}){return n.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:l,children:n.jsx("path",{d:"M7 2h10a5 5 0 015 5v10a5 5 0 01-5 5H7a5 5 0 01-5-5V7a5 5 0 015-5zm0 4.5v11h2.35v-4.55h5.3V17.5H17v-11h-2.35v4.1h-5.3V6.5H7z"})})}function f({size:o=16,className:l=""}){return n.jsx("svg",{width:o,height:o,viewBox:"0 0 16 16",fill:"currentColor",className:l,children:n.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}const C={CLAUDE:h,CODEX:d,CURSOR:a,GEMINI:s,GITHUB:f,HERMES:x,KIMI:g,KIRO:v,OPENCODE:u},I={ANTIGRAVITY:"/brand-logos/antigravity.svg",CLAUDE:"/brand-logos/claude-code.svg",CODEX:"/brand-logos/codex.svg",COPILOT:"/brand-logos/copilot.svg",CURSOR:"/brand-logos/cursor.svg",GEMINI:"/brand-logos/gemini.svg",HERMES:"/brand-logos/hermes.svg",KIMI:"/brand-logos/kimi.svg",KIRO:"/brand-logos/kiro.svg",OPENCLAW:"/brand-logos/openclaw.svg",OPENCODE:"/brand-logos/opencode.svg"};function R({provider:o,size:l=16,color:i,className:r=""}){const e=o?.toUpperCase?.()||"",c=I[e];if(c)return n.jsx("img",{src:c,alt:"",width:l,height:l,className:r,style:{width:l,height:l,objectFit:"contain"},"aria-hidden":!0});const t=C[e];return t?n.jsx(t,{size:l,className:r}):n.jsx("div",{className:"rounded-full shrink-0",style:{width:l*.5,height:l*.5,backgroundColor:i}})}export{R as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,b as Y,f as J,al as G,D as n,e as S,H as P,a7 as x,B as s,O as Q,ab as X,am as ee,ac as te,ad as ne,ae as A,an as ae,ao as ie,N as oe,P as se,C as re,T as le,ap as ce,aq as ue,ar as D,as as de,at as ge,au as he}from"./main-BkcFhXuV.js";import{L as be,a as L,u as me}from"./use-limits-display-prefs-D8X45HMo.js";import{S as v,T as k,a as f,b as E,u as _}from"./use-native-settings-BHpLvxeC.js";import{R as pe}from"./refresh-cw-BvjQfCG5.js";import{D as fe}from"./download-DjhGgU2Q.js";import"./Card-CnqcfvmO.js";const ye=e=>!e.isLayoutDirty&&e.willUpdate(!1);function O(){const e=new Set,t=new WeakMap,a=()=>e.forEach(ye);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const xe=l.createContext(null);function ve(){const e=l.useRef(!1);return Y(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ke(){const e=ve(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>J.postRender(i),[i]),t]}const T=e=>e===!0,je=e=>T(e===!0)||e==="id",Ne=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(G),o=l.useContext(xe),[r,c]=ke(),d=l.useRef(null),g=i.id||o;d.current===null&&(je(a)&&g&&(t=t?g+"-"+t:g),d.current={id:t,group:T(a)&&i.group||O()});const h=l.useMemo(()=>({...d.current,forceRender:r}),[c]);return n.jsx(G.Provider,{value:h,children:e})};const Se=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],we=S("grip-vertical",Se);const Ce=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],I=S("languages",Ce);const Ge=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Le=S("log-out",Ge);const Ee=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Oe=S("pencil",Ee),Ie=new Set(["cursor","kiro","copilot"]);function Pe({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:x("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:n.jsx("span",{className:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Ae({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[d,g]=l.useState(null),h=u=>b=>{c(u),b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("text/plain",u)},m=u=>b=>{b.preventDefault(),b.dataTransfer.dropEffect="move",r&&r!==u&&d!==u&&(g(u),o(r,u))},p=()=>{c(null),g(null)},y=u=>{u.preventDefault(),c(null),g(null)};return n.jsx(Ne,{children:n.jsx("div",{className:"flex flex-col",children:t.map(u=>{const b=a[u]!==!1,j=r===u;return n.jsxs(P.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(u),onDragOver:m(u),onDragEnd:p,onDrop:y,className:x("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",j&&"opacity-40"),style:{cursor:j?"grabbing":"grab"},children:[n.jsx(we,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),n.jsx("img",{src:be[u],alt:"",width:18,height:18,className:x("h-[18px] w-[18px] shrink-0 pointer-events-none",Ie.has(u)&&"dark:invert"),draggable:!1}),n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:L[u]}),n.jsx("div",{onMouseDown:N=>N.stopPropagation(),draggable:!1,children:n.jsx(Pe,{checked:b,onChange:()=>i(u),ariaLabel:`${s("limits.settings.toggle_visible")}: ${L[u]}`})})]},u)})})})}function De(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function _e(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function Te(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function Me(e,t,a){const[i,o]=l.useState(()=>X()),r=t&&a&&ee(),c=l.useCallback(async()=>{const d=!i;if(te(d),o(d),!!d)try{await ne(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function Ue(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[d,g]=l.useState(!1),[h,m]=l.useState(null),[p,y]=l.useState(!1),[u,b]=l.useState(""),[j,N]=l.useState(!1),[B,C]=l.useState(""),[H,F]=l.useState(""),[z,$]=l.useState(!1),[V,Z]=l.useState(null),W=l.useMemo(()=>De(e),[e]),K=l.useMemo(()=>_e(e),[e]),q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:N}),[]);return{anonymousOn:i,customDisplayName:h,displayName:W,editingGithub:z,editingName:p,email:K,githubError:V,githubInput:H,githubUrl:B,loadSetters:q,nameInput:u,profileLoading:r,profileSaving:d,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:$,setEditingName:y,setGithubError:Z,setGithubInput:F,setGithubUrl:C,setNameInput:b,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:N,showGithubOn:j}}function Re(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await A({getAccessToken:e});if(!i||!o)return;const r=await ae({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function Be(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await A({getAccessToken:e});if(!c)return!1;const d=await ie({accessToken:c,...a});return r?.(d),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function He(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function Fe(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function ze(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function $e(e,t){const a=l.useCallback(async()=>{const o=e.nameInput.trim().slice(0,50);o&&await t({display_name:o},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(o),e.setEditingName(!1)}})},[t,e]),i=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:a,startEditingName:i}}function Ve(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=Te(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function Ze(){const e=Q(),t=Ue(e.user),a=Me(e.getAccessToken,e.enabled,e.signedIn);Re(e.getAccessToken,e.signedIn,t.loadSetters);const i=Be(e.getAccessToken,t),o=ze(t,i),r=$e(t,i),c=Ve(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,name:He(t,{...o,...r}),github:Fe(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function M({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),n.jsx("button",{type:"button",onClick:t,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:s("settings.account.cancel")})]})}function We({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.displayName")}),n.jsx(M,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function Ke({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:d=>{c(d.target.value),e&&r(null)},onKeyDown:d=>{d.key==="Enter"&&a(),d.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:s("settings.account.githubUrlPlaceholder")}),n.jsx(M,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function U({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function R({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function qe({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(U,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function Ye({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:d,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:p,startEditingName:y}=e,u=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(R,{label:s("settings.account.displayName"),editing:o,hint:u,editor:n.jsx(We,{nameInput:d,setEditingName:m,setNameInput:p,profileSaving:h,handleSaveName:c}),actions:n.jsx(qe,{name:e})})}function Je({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:d,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:p,showGithubOn:y,startEditingGithub:u}=e;return n.jsx(R,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(Ke,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:p}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(U,{label:s("settings.account.edit"),onClick:u}),n.jsx(k,{checked:y,onChange:c,disabled:d||g,ariaLabel:s("settings.account.githubUrl")})]})})}function Qe(){const{openLoginModal:e}=oe();return n.jsx(v,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:s("settings.account.signIn")})]})})}function Xe({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(Ye,{name:e}),n.jsx(Je,{github:t})]})}function et(){const e=Ze();return e.enabled?e.signedIn?n.jsxs(v,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(tt,{onSignOut:e.signOut}),children:[n.jsx(nt,{settings:e}),n.jsx(at,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(it,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(Qe,{}):null}function tt({onSignOut:e}){return n.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[n.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function nt({settings:e}){return e.showLocalCloudSync?n.jsx(f,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function at({checked:e,disabled:t,onChange:a}){return n.jsx(f,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(k,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function it({visible:e,name:t,github:a}){return n.jsx(se,{initial:!1,children:e?n.jsx(P.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:n.jsx(Xe,{name:t,github:a})},"public-profile-fields"):null})}function ot(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:ce},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:ue},{value:"system",label:s("settings.appearance.theme.system"),Icon:D}]}function st(){return[{value:de,label:s("settings.appearance.language.system"),Icon:D},{value:ge,label:s("settings.appearance.language.english"),Icon:I},{value:he,label:s("settings.appearance.language.chinese"),Icon:I}]}function rt(){const{theme:e,setTheme:t}=re(),{locale:a,setLocale:i}=le();return n.jsxs(v,{title:s("settings.section.appearance"),children:[n.jsx(f,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(E,{options:ot(),value:e,onChange:t})}),n.jsx(f,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(E,{options:st(),value:a,onChange:i})})]})}function lt(){const{available:e,settings:t,setSetting:a,runAction:i}=_();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,d=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(v,{title:s("settings.section.menubar"),children:[r?n.jsx(f,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(k,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(f,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(pe,{className:x("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(f,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function ct(){const{available:e,settings:t,runAction:a}=_();return!e||!t?.version?null:n.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[11px] text-oai-gray-500 dark:text-oai-gray-500",children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"})]})}function pt(){const e=me();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(rt,{}),n.jsx(lt,{}),n.jsx(et,{}),n.jsx(v,{title:s("settings.section.limits"),children:n.jsx(Ae,{prefs:e})})]}),n.jsx(ct,{})]})})})}export{pt as SettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as Je,r,av as J,aw as xe,ax as zt,ay as Pt,az as ot,aA as Pe,aB as Ot,aC as On,D as s,a6 as on,aD as At,aE as an,aF as ln,E as cn,F as Fe,aG as Wt,a7 as xt,aH as An,B as A,R as Ln}from"./main-BkcFhXuV.js";import{A as Ut,s as ve,l as at,m as He,n as Be,o as qt,p as un,q as Ue,r as Vn,t as Dn,v as _n,w as Un,x as Kt,y as Fn,z as nt,c as Ce,C as St,E as Hn,F as dn,G as Bn,H as $n,I as ze,J as fn,K as se,L as mn,M as zn,S as Wn,N as F,O as qn,Q as Ft,R as Kn,T as Yn,U as Gn,V as Xn,W as Jn,X as Qn,Y as Ht,Z as Zn,_ as Lt,$ as er,a0 as tr,a1 as nr,a2 as rr,a3 as sr,a4 as or,a5 as ar,a6 as ir,a7 as gn,a8 as lr,a9 as cr,aa as ur,ab as dr,ac as fr,ad as pn,ae as mr,af as gr,ag as Ct,u as pr,D as hr,b as xr,d as yr,e as br,f as wr,g as kr,B as Ve,P as vr,h as Rr,i as Sr,j as Cr,k as Ir}from"./PopoverPopup-DSxDP7iu.js";import{C as Mr}from"./Card-CnqcfvmO.js";import{P as Vt}from"./ProviderIcon-CXJvW9mJ.js";import{R as Nr}from"./refresh-cw-BvjQfCG5.js";import{C as hn}from"./chevron-down-DoncrDIk.js";import{D as jr}from"./download-DjhGgU2Q.js";const Er=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ye=Je("check",Er);const Tr=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Pr=Je("external-link",Tr);const Or=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ge=Je("loader-circle",Or);const Ar=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],xn=Je("plus",Ar);const Lr=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Yt=Je("search",Lr);const Vr=[["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"}]],Dr=Je("trash-2",Vr);function _r(e){const t=r.useRef(!0);t.current&&(t.current=!1,e())}function Gt({controlled:e,default:t,name:n,state:o="value"}){const{current:d}=r.useRef(e!==void 0),[a,i]=r.useState(t),l=d?e:a,y=r.useCallback(h=>{d||i(h)},[]);return[l,y]}function ft(e,t,n){return Math.floor(e/t)!==n}function rt(e,t){return t<0||t>=e.current.length}function It(e,t){return we(e,{disabledIndices:t})}function Xt(e,t){return we(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function we(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:o,amount:d=1}={}){let a=t;do a+=n?-d:d;while(a>=0&&a<=e.current.length-1&&st(e,a,o));return a}function Ur(e,{event:t,orientation:n,loopFocus:o,rtl:d,cols:a,disabledIndices:i,minIndex:l,maxIndex:y,prevIndex:h,stopEvent:f=!1}){let m=h;const x=[],N={};let b=!1;{let c=null,I=-1;e.current.forEach((p,k)=>{if(p==null)return;const T=p.closest('[role="row"]');T&&(b=!0),(T!==c||I===-1)&&(c=T,I+=1,x[I]=[]),x[I].push(k),N[k]=I})}const w=b&&x.length>0&&x.some(c=>c.length!==a);function E(c){if(!w||h===-1)return;const I=N[h];if(I==null)return;const p=x[I].indexOf(h);let k=c==="up"?I-1:I+1;o&&(k<0?k=x.length-1:k>=x.length&&(k=0));const T=new Set;for(;k>=0&&k<x.length&&!T.has(k);){T.add(k);const D=x[k];if(D.length===0){k=c==="up"?k-1:k+1;continue}const Q=Math.min(p,D.length-1);for(let L=Q;L>=0;L-=1){const oe=D[L];if(!st(e,oe,i))return oe}k=c==="up"?k-1:k+1,o&&(k<0?k=x.length-1:k>=x.length&&(k=0))}}if(t.key===Ut){const c=E("up");if(c!==void 0)f&&ve(t),m=c;else{if(f&&ve(t),h===-1)m=y;else if(m=we(e,{startingIndex:m,amount:a,decrement:!0,disabledIndices:i}),o&&(h-a<l||m<0)){const I=h%a,p=y%a,k=y-(p-I);p===I?m=y:m=p>I?k:k-a}rt(e,m)&&(m=h)}}if(t.key===at){const c=E("down");c!==void 0?(f&&ve(t),m=c):(f&&ve(t),h===-1?m=l:(m=we(e,{startingIndex:h,amount:a,disabledIndices:i}),o&&h+a>y&&(m=we(e,{startingIndex:h%a-a,amount:a,disabledIndices:i}))),rt(e,m)&&(m=h))}if(n==="both"){const c=qt(h/a);t.key===(d?He:Be)&&(f&&ve(t),h%a!==a-1?(m=we(e,{startingIndex:h,disabledIndices:i}),o&&ft(m,a,c)&&(m=we(e,{startingIndex:h-h%a-1,disabledIndices:i}))):o&&(m=we(e,{startingIndex:h-h%a-1,disabledIndices:i})),ft(m,a,c)&&(m=h)),t.key===(d?Be:He)&&(f&&ve(t),h%a!==0?(m=we(e,{startingIndex:h,decrement:!0,disabledIndices:i}),o&&ft(m,a,c)&&(m=we(e,{startingIndex:h+(a-h%a),decrement:!0,disabledIndices:i}))):o&&(m=we(e,{startingIndex:h+(a-h%a),decrement:!0,disabledIndices:i})),ft(m,a,c)&&(m=h));const I=qt(y/a)===c;rt(e,m)&&(o&&I?m=t.key===(d?Be:He)?y:we(e,{startingIndex:h-h%a-1,disabledIndices:i}):m=h)}return m}function Fr(e,t,n){const o=[];let d=0;return e.forEach(({width:a,height:i},l)=>{let y=!1;for(n&&(d=0);!y;){const h=[];for(let f=0;f<a;f+=1)for(let m=0;m<i;m+=1)h.push(d+f+m*t);d%t+a<=t&&h.every(f=>o[f]==null)?(h.forEach(f=>{o[f]=l}),y=!0):d+=1}}),[...o]}function Hr(e,t,n,o,d){if(e===-1)return-1;const a=n.indexOf(e),i=t[e];switch(d){case"tl":return a;case"tr":return i?a+i.width-1:a;case"bl":return i?a+(i.height-1)*o:a;case"br":return n.lastIndexOf(e);default:return-1}}function Br(e,t){return t.flatMap((n,o)=>e.includes(n)?[o]:[])}function st(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const o=e.current[t];return o?o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true":!1}const $r="Escape";function bt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function mt(e,t){return bt(t,e===Ut||e===at,e===He||e===Be)}function Mt(e,t,n){return bt(t,e===at,n?e===He:e===Be)||e==="Enter"||e===" "||e===""}function zr(e,t,n){return bt(t,n?e===He:e===Be,e===at)}function Wr(e,t,n,o){const d=n?e===Be:e===He,a=e===Ut;return t==="both"||t==="horizontal"&&o&&o>1?e===$r:bt(t,d,a)}function qr(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),d=n.useState("floatingElement"),a=n.useState("domReferenceElement"),i=n.context.dataRef,{listRef:l,activeIndex:y,onNavigate:h=()=>{},enabled:f=!0,selectedIndex:m=null,allowEscape:x=!1,loopFocus:N=!1,nested:b=!1,rtl:w=!1,virtual:E=!1,focusItemOnOpen:c="auto",focusItemOnHover:I=!0,openOnArrowKeyDown:p=!0,disabledIndices:k=void 0,orientation:T="vertical",parentOrientation:D,cols:Q=1,scrollItemIntoView:L=!0,itemSizes:oe,dense:pe=!1,id:_,resetOnPointerLeave:Y=!0,externalTree:G}=t,X=un(d),ne=Ue(X),q=Vn(),Z=Dn(G);J(()=>{i.current.orientation=T},[i,T]);const S=_n(a),B=r.useRef(c),R=r.useRef(m??-1),M=r.useRef(null),ue=r.useRef(!0),O=xe(g=>{h(R.current===-1?null:R.current,g)}),he=r.useRef(O),re=r.useRef(!!d),P=r.useRef(o),W=r.useRef(!1),ae=r.useRef(!1),ye=Ue(k),H=Ue(o),de=Ue(L),ee=Ue(m),fe=Ue(Y),u=xe(()=>{function g(le){E?Z?.events.emit("virtualfocus",le):Un(le,{sync:W.current,preventScroll:!0})}const U=l.current[R.current],C=ae.current;U&&g(U),(W.current?le=>le():requestAnimationFrame)(()=>{const le=l.current[R.current]||U;if(!le)return;U||g(le);const me=de.current;me&&j&&(C||!ue.current)&&le.scrollIntoView?.(typeof me=="boolean"?{block:"nearest",inline:"nearest"}:me)})});J(()=>{f&&(o&&d?(R.current=m??-1,B.current&&m!=null&&(ae.current=!0,O())):re.current&&(R.current=-1,he.current()))},[f,o,d,m,O]),J(()=>{if(f){if(!o){W.current=!1;return}if(d)if(y==null){if(W.current=!1,ee.current!=null)return;if(re.current&&(R.current=-1,u()),(!P.current||!re.current)&&B.current&&(M.current!=null||B.current===!0&&M.current==null)){let g=0;const U=()=>{l.current[0]==null?(g<2&&(g?requestAnimationFrame:queueMicrotask)(U),g+=1):(R.current=M.current==null||Mt(M.current,T,w)||b?It(l):Xt(l),M.current=null,O())};U()}}else rt(l,y)||(R.current=y,u(),ae.current=!1)}},[f,o,d,y,ee,b,l,T,w,O,u,ye]),J(()=>{if(!f||d||!Z||E||!re.current)return;const g=Z.nodesRef.current,U=g.find(le=>le.id===q)?.context?.elements.floating,C=Kt(Fn(d)),te=g.some(le=>le.context&&nt(le.context.elements.floating,C));U&&!te&&ue.current&&U.focus({preventScroll:!0})},[f,d,Z,q,E]),J(()=>{he.current=O,P.current=o,re.current=!!d}),J(()=>{o||(M.current=null,B.current=c)},[o,c]);const v=y!=null,j=r.useMemo(()=>{function g(C){if(!H.current)return;const te=l.current.indexOf(C.currentTarget);te!==-1&&R.current!==te&&(R.current=te,O(C))}return{onFocus(C){W.current=!0,g(C)},onClick:({currentTarget:C})=>C.focus({preventScroll:!0}),onMouseMove(C){W.current=!0,ae.current=!1,I&&g(C)},onPointerLeave(C){if(!H.current||!ue.current||C.pointerType==="touch")return;W.current=!0;const te=C.relatedTarget;!I||l.current.includes(te)||fe.current&&(R.current=-1,O(C),E||ne.current?.focus({preventScroll:!0}))}}},[H,ne,I,l,O,fe,E]),$=r.useCallback(()=>D??Z?.nodesRef.current.find(g=>g.id===q)?.context?.dataRef?.current.orientation,[q,Z,D]),K=xe(g=>{if(ue.current=!1,W.current=!0,g.which===229||!H.current&&g.currentTarget===ne.current)return;if(b&&Wr(g.key,T,w,Q)){mt(g.key,$())||ve(g),n.setOpen(!1,Ce(St,g.nativeEvent)),zt(a)&&(E?Z?.events.emit("virtualfocus",a):a.focus());return}const U=R.current,C=It(l,k),te=Xt(l,k);if(S||(g.key==="Home"&&(ve(g),R.current=C,O(g)),g.key==="End"&&(ve(g),R.current=te,O(g))),Q>1){const le=oe||Array.from({length:l.current.length},()=>({width:1,height:1})),me=Fr(le,Q,pe),be=me.findIndex(Re=>Re!=null&&!st(l,Re,k)),ke=me.reduce((Re,Me,_e)=>Me!=null&&!st(l,Me,k)?_e:Re,-1),De=me[Ur({current:me.map(Re=>Re!=null?l.current[Re]:null)},{event:g,orientation:T,loopFocus:N,rtl:w,cols:Q,disabledIndices:Br([...(typeof k!="function"?k:null)||l.current.map((Re,Me)=>st(l,Me,k)?Me:void 0),void 0],me),minIndex:be,maxIndex:ke,prevIndex:Hr(R.current>te?C:R.current,le,me,Q,g.key===at?"bl":g.key===(w?He:Be)?"tr":"tl"),stopEvent:!0})];if(De!=null&&(R.current=De,O(g)),T==="both")return}if(mt(g.key,T)){if(ve(g),o&&!E&&Kt(g.currentTarget.ownerDocument)===g.currentTarget){R.current=Mt(g.key,T,w)?C:te,O(g);return}Mt(g.key,T,w)?N?U>=te?x&&U!==l.current.length?R.current=-1:(W.current=!1,R.current=C):R.current=we(l,{startingIndex:U,disabledIndices:k}):R.current=Math.min(te,we(l,{startingIndex:U,disabledIndices:k})):N?U<=C?x&&U!==-1?R.current=l.current.length:(W.current=!1,R.current=te):R.current=we(l,{startingIndex:U,decrement:!0,disabledIndices:k}):R.current=Math.max(C,we(l,{startingIndex:U,decrement:!0,disabledIndices:k})),rt(l,R.current)&&(R.current=-1),O(g)}}),ie=r.useMemo(()=>E&&o&&v&&{"aria-activedescendant":`${_}-${y}`},[E,o,v,_,y]),ce=r.useMemo(()=>({"aria-orientation":T==="both"?void 0:T,...S?{}:ie,onKeyDown(g){if(g.key==="Tab"&&g.shiftKey&&o&&!E){const U=Hn(g.nativeEvent);if(U&&!nt(ne.current,U))return;ve(g),n.setOpen(!1,Ce(dn,g.nativeEvent)),zt(a)&&a.focus();return}K(g)},onPointerMove(){ue.current=!0}}),[ie,K,ne,T,S,n,o,E,a]),Ie=r.useMemo(()=>{function g(C){c==="auto"&&Bn(C.nativeEvent)&&(B.current=!E)}function U(C){B.current=c,c==="auto"&&$n(C.nativeEvent)&&(B.current=!0)}return{onKeyDown(C){const te=n.select("open");ue.current=!1;const le=C.key.startsWith("Arrow"),me=zr(C.key,$(),w),be=mt(C.key,T),ke=(b?me:be)||C.key==="Enter"||C.key.trim()==="";if(E&&te)return K(C);if(!(!te&&!p&&le)){if(ke){const De=mt(C.key,$());M.current=b&&De?null:C.key}if(b){me&&(ve(C),te?(R.current=It(l,ye.current),O(C)):n.setOpen(!0,Ce(St,C.nativeEvent,C.currentTarget)));return}be&&(ee.current!=null&&(R.current=ee.current),ve(C),!te&&p?n.setOpen(!0,Ce(St,C.nativeEvent,C.currentTarget)):K(C),te&&O(C))}},onFocus(C){n.select("open")&&!E&&(R.current=-1,O(C))},onPointerDown:U,onPointerEnter:U,onMouseDown:g,onClick:g}},[K,ye,c,l,b,O,n,p,T,$,w,ee,E]),Ee=r.useMemo(()=>({...ie,...Ie}),[ie,Ie]);return r.useMemo(()=>f?{reference:Ee,floating:ce,item:j,trigger:Ie}:{},[f,Ee,ce,Ie,j])}function Kr(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),d=n.context.dataRef,{listRef:a,activeIndex:i,onMatch:l,onTypingChange:y,enabled:h=!0,findMatch:f=null,resetMs:m=750,ignoreKeys:x=Pt,selectedIndex:N=null}=t,b=ze(),w=r.useRef(""),E=r.useRef(N??i??-1),c=r.useRef(null);J(()=>{o&&(b.clear(),c.current=null,w.current="")},[o,b]),J(()=>{o&&w.current===""&&(E.current=N??i??-1)},[o,N,i]);const I=xe(D=>{D?d.current.typing||(d.current.typing=D,y?.(D)):d.current.typing&&(d.current.typing=D,y?.(D))}),p=xe(D=>{function Q(Y,G,X){const ne=f?f(G,X):G.find(q=>q?.toLocaleLowerCase().indexOf(X.toLocaleLowerCase())===0);return ne?Y.indexOf(ne):-1}const L=a.current;if(w.current.length>0&&w.current[0]!==" "&&(Q(L,L,w.current)===-1?I(!1):D.key===" "&&ve(D)),L==null||x.includes(D.key)||D.key.length!==1||D.ctrlKey||D.metaKey||D.altKey)return;o&&D.key!==" "&&(ve(D),I(!0)),L.every(Y=>Y?Y[0]?.toLocaleLowerCase()!==Y[1]?.toLocaleLowerCase():!0)&&w.current===D.key&&(w.current="",E.current=c.current),w.current+=D.key,b.start(m,()=>{w.current="",E.current=c.current,I(!1)});const pe=E.current,_=Q(L,[...L.slice((pe||0)+1),...L.slice(0,(pe||0)+1)],w.current);_!==-1?(l?.(_),c.current=_):D.key!==" "&&(w.current="",I(!1))}),k=r.useMemo(()=>({onKeyDown:p}),[p]),T=r.useMemo(()=>({onKeyDown:p,onKeyUp(D){D.key===" "&&I(!1)}}),[p,I]);return r.useMemo(()=>h?{reference:k,floating:T}:{},[h,k,T])}const yn=r.createContext(null),bn=r.createContext(null);function $e(){const e=r.useContext(yn);if(e===null)throw new Error(ot(60));return e}function wn(){const e=r.useContext(bn);if(e===null)throw new Error(ot(61));return e}let Jt=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Yr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Gr={valid(e){return e===null?null:e?{[Jt.valid]:""}:{[Jt.invalid]:""}}},Xr=r.createContext({invalid:void 0,name:void 0,validityData:{state:Yr,errors:[],error:"",value:"",initialValue:null},setValidityData:Pe,disabled:void 0,touched:!1,setTouched:Pe,dirty:!1,setDirty:Pe,filled:!1,setFilled:Pe,focused:!1,setFocused:Pe,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=Ot)=>e,getInputValidationProps:(e=Ot)=>e,inputRef:{current:null},commit:async()=>{}}});function Bt(e=!0){const t=r.useContext(Xr);if(t.setValidityData===Pe&&!e)throw new Error(ot(28));return t}const Jr=r.createContext({controlId:void 0,setControlId:Pe,labelId:void 0,setLabelId:Pe,messageIds:[],setMessageIds:Pe,getDescriptionProps:e=>e});function kn(){return r.useContext(Jr)}function vn(e={}){const{id:t,implicit:n=!1,controlRef:o}=e,{controlId:d,setControlId:a}=kn(),i=fn(t);return J(()=>{if(!(!n&&!t||a===Pe)){if(n){const l=o?.current;On(l)&&l.closest("label")!=null?a(t??null):a(d??i)}else t&&a(t);return()=>{t&&a(void 0)}}},[t,o,d,a,n,i]),d??i}const Qr=(e,t)=>Object.is(e,t);function Xe(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Nt(e,t,n){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Xe(o,t,n))}function Dt(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Xe(o,t,n))}function Zr(e,t,n){return e.filter(o=>!Xe(o,t,n))}function _t(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Rn(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function es(e){if(!Array.isArray(e))return e!=null&&!("null"in e);if(Rn(e)){for(const t of e)for(const n of t.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(const t of e)if(t&&t.value==null&&t.label!=null)return!0;return!1}function ts(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return _t(e)}function Ke(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?_t(e.value):_t(e)}function Sn(e,t,n){function o(){return ts(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const d=Rn(t)?t.flatMap(a=>a.items):t;if(e==null||typeof e!="object"){const a=d.find(i=>i.value===e);return a&&a.label!=null?a.label:o()}if("value"in e){const a=d.find(i=>i&&i.value===e.value);if(a&&a.label!=null)return a.label}}return o()}function ns(e,t,n){return e.reduce((o,d,a)=>(a>0&&o.push(", "),o.push(s.jsx(r.Fragment,{children:Sn(d,t,n)},a)),o),[])}const V={id:se(e=>e.id),modal:se(e=>e.modal),multiple:se(e=>e.multiple),items:se(e=>e.items),itemToStringLabel:se(e=>e.itemToStringLabel),itemToStringValue:se(e=>e.itemToStringValue),isItemEqualToValue:se(e=>e.isItemEqualToValue),value:se(e=>e.value),hasSelectedValue:se(e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Ke(t,o)!==""}),hasNullItemLabel:se((e,t)=>t?es(e.items):!1),open:se(e=>e.open),mounted:se(e=>e.mounted),forceMount:se(e=>e.forceMount),transitionStatus:se(e=>e.transitionStatus),openMethod:se(e=>e.openMethod),activeIndex:se(e=>e.activeIndex),selectedIndex:se(e=>e.selectedIndex),isActive:se((e,t)=>e.activeIndex===t),isSelected:se((e,t,n)=>{const o=e.isItemEqualToValue,d=e.value;return e.multiple?Array.isArray(d)&&d.some(a=>Xe(a,n,o)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Xe(d,n,o)}),isSelectedByFocus:se((e,t)=>e.selectedIndex===t),popupProps:se(e=>e.popupProps),triggerProps:se(e=>e.triggerProps),triggerElement:se(e=>e.triggerElement),positionerElement:se(e=>e.positionerElement),listElement:se(e=>e.listElement),scrollUpArrowVisible:se(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:se(e=>e.scrollDownArrowVisible),hasScrollArrows:se(e=>e.hasScrollArrows)},rs=r.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Pe,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Cn(){return r.useContext(rs)}function ss(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function os(e){const{enabled:t=!0,value:n,id:o,name:d,controlRef:a,commit:i}=e,{formRef:l}=Cn(),{invalid:y,markedDirtyRef:h,validityData:f,setValidityData:m}=Bt(),x=xe(e.getValue);J(()=>{if(!t)return;let N=n;N===void 0&&(N=x()),f.initialValue===null&&N!==null&&m(b=>({...b,initialValue:N}))},[t,m,n,f.initialValue,x]),J(()=>{!t||!o||l.current.fields.set(o,{getValue:x,name:d,controlRef:a,validityData:ss(f,y),validate(N=!0){let b=n;b===void 0&&(b=x()),h.current=!0,N?on.flushSync(()=>i(b)):i(b)}})},[i,a,t,l,x,o,y,h,d,f,n]),J(()=>{const N=l.current.fields;return()=>{o&&N.delete(o)}},[l,o])}function as(e,t){const n=r.useRef(e),o=xe(t);J(()=>{n.current!==e&&o(n.current)},[e,o]),J(()=>{n.current=e},[e])}function is(e){const{id:t,value:n,defaultValue:o=null,onValueChange:d,open:a,defaultOpen:i=!1,onOpenChange:l,name:y,disabled:h=!1,readOnly:f=!1,required:m=!1,modal:x=!0,actionsRef:N,inputRef:b,onOpenChangeComplete:w,items:E,multiple:c=!1,itemToStringLabel:I,itemToStringValue:p,isItemEqualToValue:k=Qr,highlightItemOnHover:T=!0,children:D}=e,{clearErrors:Q}=Cn(),{setDirty:L,setTouched:oe,setFocused:pe,shouldValidateOnChange:_,validityData:Y,setFilled:G,name:X,disabled:ne,validation:q,validationMode:Z}=Bt(),S=vn({id:t}),B=ne||h,R=X??y,[M,ue]=Gt({controlled:n,default:c?o??Pt:o,name:"Select",state:"value"}),[O,he]=Gt({controlled:a,default:i,name:"Select",state:"open"}),re=r.useRef([]),P=r.useRef([]),W=r.useRef(null),ae=r.useRef(null),ye=r.useRef(0),H=r.useRef(null),de=r.useRef([]),ee=r.useRef(!1),fe=r.useRef(!1),u=r.useRef(null),v=r.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),j=r.useRef(!1),{mounted:$,setMounted:K,transitionStatus:ie}=mn(O),{openMethod:ce,triggerProps:Ie,reset:Ee}=zn(O),g=At(()=>new Wn({id:S,modal:x,multiple:c,itemToStringLabel:I,itemToStringValue:p,isItemEqualToValue:k,value:M,open:O,mounted:$,transitionStatus:ie,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,U=F(g,V.activeIndex),C=F(g,V.selectedIndex),te=F(g,V.triggerElement),le=F(g,V.positionerElement),me=r.useMemo(()=>c&&Array.isArray(M)&&M.length===0?"":Ke(M,p),[c,M,p]),be=r.useMemo(()=>c&&Array.isArray(M)?M.map(z=>Ke(z,p)):Ke(M,p),[c,M,p]),ke=Ue(g.state.triggerElement);os({id:S,commit:q.commit,value:M,controlRef:ke,name:R,getValue:()=>be});const De=r.useRef(M);J(()=>{M!==De.current&&g.set("forceMount",!0)},[g,M]),J(()=>{G(c?Array.isArray(M)&&M.length>0:M!=null)},[c,M,G]),J(function(){if(O)return;const ge=de.current;if(c){const je=Array.isArray(M)?M:[];if(je.length===0){g.set("selectedIndex",null);return}const Se=je[je.length-1],dt=Dt(ge,Se,k);g.set("selectedIndex",dt===-1?null:dt);return}const Ne=Dt(ge,M,k);g.set("selectedIndex",Ne===-1?null:Ne)},[c,O,M,de,k,g]),as(M,()=>{Q(R),L(M!==Y.initialValue),_()?q.commit(M):q.commit(M,!0)});const Re=xe((z,ge)=>{if(l?.(z,ge),!ge.isCanceled&&(he(z),!z&&(ge.reason===dn||ge.reason===qn)&&(oe(!0),pe(!1),Z==="onBlur"&&q.commit(M)),!z&&g.state.activeIndex!==null)){const Ne=re.current[g.state.activeIndex];queueMicrotask(()=>{Ne?.setAttribute("tabindex","-1")})}}),Me=xe(()=>{K(!1),g.set("activeIndex",null),Ee(),w?.(!1)});Ft({enabled:!N,open:O,ref:W,onComplete(){O||Me()}}),r.useImperativeHandle(N,()=>({unmount:Me}),[Me]);const _e=xe((z,ge)=>{d?.(z,ge),!ge.isCanceled&&ue(z)}),Oe=xe(()=>{const z=g.state.listElement||W.current;if(!z)return;const ge=z.scrollTop,Ne=z.scrollTop+z.clientHeight,je=ge>1,Se=Ne<z.scrollHeight-1;g.state.scrollUpArrowVisible!==je&&g.set("scrollUpArrowVisible",je),g.state.scrollDownArrowVisible!==Se&&g.set("scrollDownArrowVisible",Se)}),Ae=Kn({open:O,onOpenChange:Re,elements:{reference:te,floating:le}}),it=Yn(Ae,{enabled:!f&&!B,event:"mousedown"}),Ze=Gn(Ae,{bubbles:!1}),Le=qr(Ae,{enabled:!f&&!B,listRef:re,activeIndex:U,selectedIndex:C,disabledIndices:Pt,onNavigate(z){z===null&&!O||g.set("activeIndex",z)},focusItemOnHover:!1}),kt=Kr(Ae,{enabled:!f&&!B&&(O||!c),listRef:P,activeIndex:U,selectedIndex:C,onMatch(z){O?g.set("activeIndex",z):_e(de.current[z],Ce("none"))},onTypingChange(z){ee.current=z}}),{getReferenceProps:We,getFloatingProps:qe,getItemProps:lt}=Xn([it,Ze,Le,kt]),et=r.useMemo(()=>an(We(),Ie,S?{id:S}:Ot),[We,Ie,S]);_r(()=>{g.update({popupProps:qe(),triggerProps:et})}),J(()=>{g.update({id:S,modal:x,multiple:c,value:M,open:O,mounted:$,transitionStatus:ie,popupProps:qe(),triggerProps:et,items:E,itemToStringLabel:I,itemToStringValue:p,isItemEqualToValue:k,openMethod:ce})},[g,S,x,c,M,O,$,ie,qe,et,E,I,p,k,ce]);const ct=r.useMemo(()=>({store:g,name:R,required:m,disabled:B,readOnly:f,multiple:c,itemToStringLabel:I,itemToStringValue:p,highlightItemOnHover:T,setValue:_e,setOpen:Re,listRef:re,popupRef:W,scrollHandlerRef:ae,handleScrollArrowVisibility:Oe,scrollArrowsMountedCountRef:ye,getItemProps:lt,events:Ae.context.events,valueRef:H,valuesRef:de,labelsRef:P,typingRef:ee,selectionRef:v,selectedItemTextRef:u,validation:q,onOpenChangeComplete:w,keyboardActiveRef:fe,alignItemWithTriggerActiveRef:j,initialValueRef:De}),[g,R,m,B,f,c,I,p,T,_e,Re,lt,Ae.context.events,q,w,Oe]),ut=ln(b,q.inputRef),vt=c&&Array.isArray(M)&&M.length>0,Rt=r.useMemo(()=>!c||!Array.isArray(M)||!R?null:M.map(z=>{const ge=Ke(z,p);return s.jsx("input",{type:"hidden",name:R,value:ge},ge)}),[c,M,R,p]);return s.jsx(yn.Provider,{value:ct,children:s.jsxs(bn.Provider,{value:Ae,children:[D,s.jsx("input",{...q.getInputValidationProps({onFocus(){g.state.triggerElement?.focus({focusVisible:!0})},onChange(z){if(z.nativeEvent.defaultPrevented)return;const ge=z.target.value,Ne=Ce(Ht,z.nativeEvent);function je(){if(c)return;const Se=de.current.find(dt=>Ke(dt,p).toLowerCase()===ge.toLowerCase());Se!=null&&(L(Se!==Y.initialValue),_e(Se,Ne),_()&&q.commit(Se))}g.set("forceMount",!0),queueMicrotask(je)}}),name:c?void 0:R,value:me,disabled:B,required:m&&!vt,readOnly:f,ref:ut,style:R?Jn:Qn,tabIndex:-1,"aria-hidden":!0}),Rt]})})}function ls(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),o=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||o.content!=="none"))return t;const a=parseFloat(n.width)||0,i=parseFloat(n.height)||0,l=parseFloat(o.width)||0,y=parseFloat(o.height)||0,h=Math.max(t.width,a,l),f=Math.max(t.height,i,y),m=h-t.width,x=f-t.height;return{left:t.left-m/2,right:t.right+m/2,top:t.top-x/2,bottom:t.bottom+x/2}}const gt=2,cs=400,Qt=200,us={...Zn,...Gr,value:()=>null},ds=r.forwardRef(function(t,n){const{render:o,className:d,id:a,disabled:i=!1,nativeButton:l=!0,...y}=t,{setTouched:h,setFocused:f,validationMode:m,state:x,disabled:N}=Bt(),{labelId:b}=kn(),{store:w,setOpen:E,selectionRef:c,validation:I,readOnly:p,required:k,alignItemWithTriggerActiveRef:T,disabled:D,keyboardActiveRef:Q}=$e(),L=N||D||i,oe=F(w,V.open),pe=F(w,V.value),_=F(w,V.triggerProps),Y=F(w,V.positionerElement),G=F(w,V.listElement),X=F(w,V.id),ne=F(w,V.hasSelectedValue),q=!ne&&oe,Z=F(w,V.hasNullItemLabel,q),S=a??X;vn({id:S});const B=Ue(Y),R=r.useRef(null),{getButtonProps:M,buttonRef:ue}=cn({disabled:L,native:l}),O=xe(ee=>{w.set("triggerElement",ee)}),he=ln(n,R,ue,O),re=ze(),P=ze(),W=ze(),ae=ze();r.useEffect(()=>{if(oe)return!(ne||Z)?W.start(cs,()=>{c.current.allowUnselectedMouseUp=!0,c.current.allowSelectedMouseUp=!0}):ae.start(Qt,()=>{c.current.allowUnselectedMouseUp=!0,W.start(Qt,()=>{c.current.allowSelectedMouseUp=!0})}),()=>{W.clear(),ae.clear()};c.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},P.clear()},[oe,ne,Z,c,P,W,ae]);const ye=r.useMemo(()=>G?.id??un(Y)?.id,[G,Y]),H=an(_,{id:S,role:"combobox","aria-expanded":oe?"true":"false","aria-haspopup":"listbox","aria-controls":oe?ye:void 0,"aria-labelledby":b,"aria-readonly":p||void 0,"aria-required":k||void 0,tabIndex:L?-1:0,ref:he,onFocus(ee){f(!0),oe&&T.current&&E(!1,Ce(Ht,ee.nativeEvent)),re.start(0,()=>{w.set("forceMount",!0)})},onBlur(ee){nt(Y,ee.relatedTarget)||(h(!0),f(!1),m==="onBlur"&&I.commit(pe))},onPointerMove(){Q.current=!1},onKeyDown(){Q.current=!0},onMouseDown(ee){if(oe)return;const fe=Lt(ee.currentTarget);function u(v){if(!R.current)return;const j=v.target;if(nt(R.current,j)||nt(B.current,j)||j===R.current)return;const $=ls(R.current);v.clientX>=$.left-gt&&v.clientX<=$.right+gt&&v.clientY>=$.top-gt&&v.clientY<=$.bottom+gt||E(!1,Ce(er,v))}P.start(0,()=>{fe.addEventListener("mouseup",u,{once:!0})})}},I.getValidationProps,y,M);H.role="combobox";const de=r.useMemo(()=>({...x,open:oe,disabled:L,value:pe,readOnly:p,placeholder:!ne}),[x,oe,L,pe,p,ne]);return Fe("button",t,{ref:[n,R],state:de,stateAttributesMapping:us,props:H})}),fs={value:()=>null},ms=r.forwardRef(function(t,n){const{className:o,render:d,children:a,placeholder:i,...l}=t,{store:y,valueRef:h}=$e(),f=F(y,V.value),m=F(y,V.items),x=F(y,V.itemToStringLabel),N=F(y,V.hasSelectedValue),b=!N&&i!=null&&a==null,w=F(y,V.hasNullItemLabel,b),E=r.useMemo(()=>({value:f,placeholder:!N}),[f,N]);let c=null;return typeof a=="function"?c=a(f):a!=null?c=a:!N&&i!=null&&!w?c=i:Array.isArray(f)?c=ns(f,m,x):c=Sn(f,m,x),Fe("span",t,{state:E,ref:[n,h],props:[{children:c},l],stateAttributesMapping:fs})}),gs=r.forwardRef(function(t,n){const{className:o,render:d,...a}=t,{store:i}=$e(),l=F(i,V.open),y=r.useMemo(()=>({open:l}),[l]);return Fe("span",t,{state:y,ref:n,props:[{"aria-hidden":!0,children:"▼"},a],stateAttributesMapping:tr})}),ps=r.createContext(void 0),hs=r.forwardRef(function(t,n){const{store:o}=$e(),d=F(o,V.mounted),a=F(o,V.forceMount);return d||a?s.jsx(ps.Provider,{value:!0,children:s.jsx(nr,{ref:n,...t})}):null}),In=r.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function xs(){return r.useContext(In)}function ys(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:d}=e,a=xe(d),i=r.useRef(0),l=At(ws).current,y=At(bs).current,[h,f]=r.useState(0),m=r.useRef(h),x=xe((c,I)=>{y.set(c,I??null),m.current+=1,f(m.current)}),N=xe(c=>{y.delete(c),m.current+=1,f(m.current)}),b=r.useMemo(()=>{const c=new Map;return Array.from(y.keys()).filter(p=>p.isConnected).sort(ks).forEach((p,k)=>{const T=y.get(p)??{};c.set(p,{...T,index:k})}),c},[y,h]);J(()=>{if(typeof MutationObserver!="function"||b.size===0)return;const c=new MutationObserver(I=>{const p=new Set,k=T=>p.has(T)?p.delete(T):p.add(T);I.forEach(T=>{T.removedNodes.forEach(k),T.addedNodes.forEach(k)}),p.size===0&&(m.current+=1,f(m.current))});return b.forEach((I,p)=>{p.parentElement&&c.observe(p.parentElement,{childList:!0})}),()=>{c.disconnect()}},[b]),J(()=>{m.current===h&&(n.current.length!==b.size&&(n.current.length=b.size),o&&o.current.length!==b.size&&(o.current.length=b.size),i.current=b.size),a(b)},[a,b,n,o,h]),J(()=>()=>{n.current=[]},[n]),J(()=>()=>{o&&(o.current=[])},[o]);const w=xe(c=>(l.add(c),()=>{l.delete(c)}));J(()=>{l.forEach(c=>c(b))},[l,b]);const E=r.useMemo(()=>({register:x,unregister:N,subscribeMapChange:w,elementsRef:n,labelsRef:o,nextIndexRef:i}),[x,N,w,n,o,i]);return s.jsx(In.Provider,{value:E,children:t})}function bs(){return new Map}function ws(){return new Set}function ks(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Mn=r.createContext(void 0);function vs(){const e=r.useContext(Mn);if(!e)throw new Error(ot(59));return e}function yt(e,t){e&&Object.assign(e.style,t)}const Rs={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Ss={position:"fixed"},Cs=r.forwardRef(function(t,n){const{anchor:o,positionMethod:d="absolute",className:a,render:i,side:l="bottom",align:y="center",sideOffset:h=0,alignOffset:f=0,collisionBoundary:m="clipping-ancestors",collisionPadding:x,arrowPadding:N=5,sticky:b=!1,disableAnchorTracking:w,alignItemWithTrigger:E=!0,collisionAvoidance:c=rr,...I}=t,{store:p,listRef:k,labelsRef:T,alignItemWithTriggerActiveRef:D,selectedItemTextRef:Q,valuesRef:L,initialValueRef:oe,popupRef:pe,setValue:_}=$e(),Y=wn(),G=F(p,V.open),X=F(p,V.mounted),ne=F(p,V.modal),q=F(p,V.value),Z=F(p,V.openMethod),S=F(p,V.positionerElement),B=F(p,V.triggerElement),R=F(p,V.isItemEqualToValue),M=r.useRef(null),ue=r.useRef(null),[O,he]=r.useState(E),re=X&&O&&Z!=="touch";!X&&O!==E&&he(E),J(()=>{X||(V.scrollUpArrowVisible(p.state)&&p.set("scrollUpArrowVisible",!1),V.scrollDownArrowVisible(p.state)&&p.set("scrollDownArrowVisible",!1))},[p,X]),r.useImperativeHandle(D,()=>re),sr((re||ne)&&G&&Z!=="touch",B);const P=or({anchor:o,floatingRootContext:Y,positionMethod:d,mounted:X,side:l,sideOffset:h,align:y,alignOffset:f,arrowPadding:N,collisionBoundary:m,collisionPadding:x,sticky:b,disableAnchorTracking:w??re,collisionAvoidance:c,keepMounted:!0}),W=re?"none":P.side,ae=re?Ss:P.positionerStyles,ye=r.useMemo(()=>{const j={};return G||(j.pointerEvents="none"),{role:"presentation",hidden:!X,style:{...ae,...j}}},[G,X,ae]),H=r.useMemo(()=>({open:G,side:W,align:P.align,anchorHidden:P.anchorHidden}),[G,W,P.align,P.anchorHidden]),de=xe(j=>{p.set("positionerElement",j)}),ee=Fe("div",t,{ref:[n,de],state:H,stateAttributesMapping:gn,props:[ye,I]}),fe=r.useRef(0),u=xe(j=>{if(j.size===0&&fe.current===0||L.current.length===0)return;const $=fe.current;if(fe.current=j.size,j.size===$)return;const K=Ce(Ht);if($!==0&&!p.state.multiple&&q!==null&&Dt(L.current,q,R)===-1){const ce=oe.current,Ee=ce!=null&&Nt(L.current,ce,R)?ce:null;_(Ee,K),Ee===null&&(p.set("selectedIndex",null),Q.current=null)}if($!==0&&p.state.multiple&&Array.isArray(q)){const ie=q.filter(ce=>Nt(L.current,ce,R));(ie.length!==q.length||ie.some(ce=>!Nt(q,ce,R)))&&(_(ie,K),ie.length===0&&(p.set("selectedIndex",null),Q.current=null))}if(G&&re){p.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ie={height:""};yt(S,ie),yt(pe.current,ie)}}),v=r.useMemo(()=>({...P,side:W,alignItemWithTriggerActive:re,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:M,scrollDownArrowRef:ue}),[P,W,re,he]);return s.jsx(ys,{elementsRef:k,labelsRef:T,onMapChange:u,children:s.jsxs(Mn.Provider,{value:v,children:[X&&ne&&s.jsx(ar,{inert:ir(!G),cutout:B}),ee]})})});function Nn(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const pt="base-ui-disable-scrollbar",Zt={className:pt,getElement(e){return s.jsx("style",{nonce:e,href:pt,precedence:"base-ui:low",children:`.${pt}{scrollbar-width:none}.${pt}::-webkit-scrollbar{display:none}`})}};function Is(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Ms=r.createContext(void 0),Ns={disableStyleElements:!1};function js(){return r.useContext(Ms)??Ns}const Es={...gn,...pn},Ts=r.forwardRef(function(t,n){const{render:o,className:d,...a}=t,{store:i,popupRef:l,onOpenChangeComplete:y,setOpen:h,valueRef:f,selectedItemTextRef:m,keyboardActiveRef:x,multiple:N,handleScrollArrowVisibility:b,scrollHandlerRef:w,highlightItemOnHover:E}=$e(),{side:c,align:I,alignItemWithTriggerActive:p,setControlledAlignItemWithTrigger:k,scrollDownArrowRef:T,scrollUpArrowRef:D}=vs(),Q=lr()!=null,L=wn(),{nonce:oe,disableStyleElements:pe}=js(),_=ze(),Y=F(i,V.id),G=F(i,V.open),X=F(i,V.mounted),ne=F(i,V.popupProps),q=F(i,V.transitionStatus),Z=F(i,V.triggerElement),S=F(i,V.positionerElement),B=F(i,V.listElement),R=r.useRef(0),M=r.useRef(!1),ue=r.useRef(0),O=r.useRef(!1),he=r.useRef({}),re=cr(),P=xe(H=>{if(!S||!l.current||!O.current)return;if(M.current||!p){b();return}const de=S.style.top==="0px",ee=S.style.bottom==="0px",fe=S.getBoundingClientRect().height,u=Lt(S),v=getComputedStyle(S),j=parseFloat(v.marginTop),$=parseFloat(v.marginBottom),K=en(getComputedStyle(l.current)),ie=u.documentElement.clientHeight-j-$,ce=H.scrollTop,Ie=H.scrollHeight,Ee=H.clientHeight,g=Ie-Ee;let U=0,C=null,te=!1;if(de){const le=g-ce,me=fe+le,be=Math.min(me,ie);U=be,be!==ie?C=g:te=!0}else if(ee){const le=ce-0,me=fe+le,be=Math.min(me,ie),ke=me-ie;U=be,be!==ie?C=0:(te=!0,ce<g&&(C=ce-(le-ke)))}U!==0&&(S.style.height=`${U}px`),C!=null&&(H.scrollTop=C),(te||U>=K)&&(M.current=!0),b()});r.useImperativeHandle(w,()=>P,[P]),Ft({open:G,ref:l,onComplete(){G&&y?.(!0)}});const W=r.useMemo(()=>({open:G,transitionStatus:q,side:c,align:I}),[G,q,c,I]);J(()=>{!S||!l.current||Object.keys(he.current).length||(he.current={top:S.style.top||"0",left:S.style.left||"0",right:S.style.right,height:S.style.height,bottom:S.style.bottom,minHeight:S.style.minHeight,maxHeight:S.style.maxHeight,marginTop:S.style.marginTop,marginBottom:S.style.marginBottom})},[l,S]),J(()=>{G||p||(O.current=!1,M.current=!1,R.current=0,ue.current=0,yt(S,he.current))},[G,p,S,l]),J(()=>{const H=l.current;if(!(!G||!Z||!S||!H||i.state.transitionStatus==="ending")){if(!p){O.current=!0,re.request(b),H.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const de=Os(H);H.style.removeProperty("--transform-origin");try{const ee=getComputedStyle(S),fe=getComputedStyle(H),u=Lt(Z),v=Wt(S),j=Z.getBoundingClientRect(),$=S.getBoundingClientRect(),K=j.left,ie=j.height,ce=B||H,Ie=ce.scrollHeight,Ee=parseFloat(fe.borderBottomWidth),g=parseFloat(ee.marginTop)||10,U=parseFloat(ee.marginBottom)||10,C=parseFloat(ee.minHeight)||100,te=en(fe),le=5,me=5,be=20,ke=u.documentElement.clientHeight-g-U,De=u.documentElement.clientWidth,Re=ke-j.bottom+ie,Me=m.current,_e=f.current;let Oe,Ae=0,it=0;if(Me&&_e){const z=_e.getBoundingClientRect();Oe=Me.getBoundingClientRect();const ge=z.left-K,Ne=Oe.left-$.left,je=z.top-j.top+z.height/2,Se=Oe.top-$.top+Oe.height/2;Ae=ge-Ne,it=Se-je}const Ze=Re+it+U+Ee;let Le=Math.min(ke,Ze);const kt=ke-g-U,We=Ze-Le,qe=Math.max(le,K+Ae),lt=De-me,et=Math.max(0,qe+$.width-lt);S.style.left=`${qe-et}px`,S.style.height=`${Le}px`,S.style.maxHeight="auto",S.style.marginTop=`${g}px`,S.style.marginBottom=`${U}px`,H.style.height="100%";const ct=ce.scrollHeight-ce.clientHeight,ut=We>=ct;ut&&(Le=Math.min(ke,$.height)-(We-ct));const vt=j.top<be||j.bottom>ke-be||Le<Math.min(Ie,C),Rt=(v.visualViewport?.scale??1)!==1&&ur;if(vt||Rt){O.current=!0,yt(S,he.current),on.flushSync(()=>k(!1));return}if(ut){const z=Math.max(0,ke-Ze);S.style.top=$.height>=kt?"0":`${z}px`,S.style.height=`${Le}px`,ce.scrollTop=ce.scrollHeight-ce.clientHeight,R.current=Math.max(C,Le)}else S.style.bottom="0",R.current=Math.max(C,Le),ce.scrollTop=We;if(Oe){const z=$.top,ge=$.height,Ne=Oe.top+Oe.height/2,je=ge>0?(Ne-z)/ge*100:50,Se=Is(je,0,100);H.style.setProperty("--transform-origin",`50% ${Se}%`)}(R.current===ke||Le>=te)&&(M.current=!0),b(),setTimeout(()=>{O.current=!0})}finally{de()}})}},[i,G,S,Z,f,m,l,b,p,k,re,T,D,B]),r.useEffect(()=>{if(!p||!S||!G)return;const H=Wt(S);function de(ee){h(!1,Ce(fr,ee))}return H.addEventListener("resize",de),()=>{H.removeEventListener("resize",de)}},[h,p,S,G]);const ae={...B?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":N||void 0,id:`${Y}-list`},onKeyDown(H){x.current=!0,Q&&gr.has(H.key)&&H.stopPropagation()},onMouseMove(){x.current=!1},onPointerLeave(H){if(!E||Nn(H)||H.pointerType==="touch")return;const de=H.currentTarget;_.start(0,()=>{i.set("activeIndex",null),de.focus({preventScroll:!0})})},onScroll(H){B||w.current?.(H.currentTarget)},...p&&{style:B?{height:"100%"}:Rs}},ye=Fe("div",t,{ref:[n,l],state:W,stateAttributesMapping:Es,props:[ne,ae,mr(q),{className:!B&&p?Zt.className:void 0},a]});return s.jsxs(r.Fragment,{children:[!pe&&Zt.getElement(oe),s.jsx(dr,{context:L,modal:!1,disabled:!X,restoreFocus:!0,children:ye})]})});function en(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}const tn={transform:"none",scale:"1",translate:"0 0"};function Ps(e,t,n){n?e.setProperty(t,n):e.removeProperty(t)}function Os(e){const{style:t}=e,n={},o=Object.keys(tn);for(const d of o)n[d]=t.getPropertyValue(d),t.setProperty(d,tn[d]);return()=>{for(const d of o)Ps(t,d,n[d])}}let jn=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function As(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:d,index:a}=e,{register:i,unregister:l,subscribeMapChange:y,elementsRef:h,labelsRef:f,nextIndexRef:m}=xs(),x=r.useRef(-1),[N,b]=r.useState(a??(d===jn.GuessFromOrder?()=>{if(x.current===-1){const c=m.current;m.current+=1,x.current=c}return x.current}:-1)),w=r.useRef(null),E=r.useCallback(c=>{if(w.current=c,N!==-1&&c!==null&&(h.current[N]=c,f)){const I=t!==void 0;f.current[N]=I?t:o?.current?.textContent??c.textContent}},[N,h,f,t,o]);return J(()=>{if(a!=null)return;const c=w.current;if(c)return i(c,n),()=>{l(c)}},[a,i,l,n]),J(()=>{if(a==null)return y(c=>{const I=w.current?c.get(w.current)?.index:null;I!=null&&b(I)})},[a,y,b]),r.useMemo(()=>({ref:E,index:N}),[N,E])}const En=r.createContext(void 0);function $t(){const e=r.useContext(En);if(!e)throw new Error(ot(57));return e}const jt=r.memo(r.forwardRef(function(t,n){const{render:o,className:d,value:a=null,label:i,disabled:l=!1,nativeButton:y=!1,...h}=t,f=r.useRef(null),m=As({label:i,textRef:f,indexGuessBehavior:jn.GuessFromOrder}),{store:x,getItemProps:N,setOpen:b,setValue:w,selectionRef:E,typingRef:c,valuesRef:I,keyboardActiveRef:p,multiple:k,highlightItemOnHover:T}=$e(),D=ze(),Q=F(x,V.isActive,m.index),L=F(x,V.isSelected,m.index,a),oe=F(x,V.isSelectedByFocus,m.index),pe=F(x,V.isItemEqualToValue),_=m.index,Y=_!==-1,G=r.useRef(null),X=Ue(_);J(()=>{if(!Y)return;const P=I.current;return P[_]=a,()=>{delete P[_]}},[Y,_,a,I]),J(()=>{if(!Y)return;const P=x.state.value;let W=P;k&&Array.isArray(P)&&P.length>0&&(W=P[P.length-1]),W!==void 0&&Xe(W,a,pe)&&x.set("selectedIndex",_)},[Y,_,k,pe,x,a]);const ne=r.useMemo(()=>({disabled:l,selected:L,highlighted:Q}),[l,L,Q]),q=N({active:Q,selected:L});q.onFocus=void 0,q.id=void 0;const Z=r.useRef(null),S=r.useRef("mouse"),B=r.useRef(!1),{getButtonProps:R,buttonRef:M}=cn({disabled:l,focusableWhenDisabled:!0,native:y});function ue(P){const W=x.state.value;if(k){const ae=Array.isArray(W)?W:[],ye=L?Zr(ae,a,pe):[...ae,a];w(ye,Ce(Ct,P))}else w(a,Ce(Ct,P)),b(!1,Ce(Ct,P))}const O={role:"option","aria-selected":L,tabIndex:Q?0:-1,onFocus(){x.set("activeIndex",_)},onMouseEnter(){!p.current&&x.state.selectedIndex===null&&x.set("activeIndex",_)},onMouseMove(){T&&x.set("activeIndex",_)},onMouseLeave(P){!T||p.current||Nn(P)||D.start(0,()=>{x.state.activeIndex===_&&x.set("activeIndex",null)})},onTouchStart(){E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(P){Z.current=P.key,x.set("activeIndex",_)},onClick(P){B.current=!1,!(P.type==="keydown"&&Z.current===null)&&(l||Z.current===" "&&c.current||S.current!=="touch"&&!Q||(Z.current=null,ue(P.nativeEvent)))},onPointerEnter(P){S.current=P.pointerType},onPointerDown(P){S.current=P.pointerType,B.current=!0},onMouseUp(P){if(l)return;if(B.current){B.current=!1;return}const W=!E.current.allowSelectedMouseUp&&L,ae=!E.current.allowUnselectedMouseUp&&!L;W||ae||S.current!=="touch"&&!Q||ue(P.nativeEvent)}},he=Fe("div",t,{ref:[M,n,m.ref,G],state:ne,props:[q,O,h,R]}),re=r.useMemo(()=>({selected:L,indexRef:X,textRef:f,selectedByFocus:oe,hasRegistered:Y}),[L,X,f,oe,Y]);return s.jsx(En.Provider,{value:re,children:he})})),Et=r.forwardRef(function(t,n){const o=t.keepMounted??!1,{selected:d}=$t();return o||d?s.jsx(Ls,{...t,ref:n}):null}),Ls=r.memo(r.forwardRef((e,t)=>{const{render:n,className:o,keepMounted:d,...a}=e,{selected:i}=$t(),l=r.useRef(null),{transitionStatus:y,setMounted:h}=mn(i),f=r.useMemo(()=>({selected:i,transitionStatus:y}),[i,y]),m=Fe("span",e,{ref:[t,l],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:pn});return Ft({open:i,ref:l,onComplete(){i||h(!1)}}),m})),Tt=r.memo(r.forwardRef(function(t,n){const{indexRef:o,textRef:d,selectedByFocus:a,hasRegistered:i}=$t(),{selectedItemTextRef:l}=$e(),{className:y,render:h,...f}=t,m=r.useCallback(N=>{if(!N||!i)return;const b=l.current===null||!l.current.isConnected;(a||b&&o.current===0)&&(l.current=N)},[l,o,a,i]);return Fe("div",t,{ref:[m,n,d],props:f})})),Vs=r.forwardRef(function(t,n){const{render:o,className:d,id:a,...i}=t,{store:l}=pr(),y=fn(a);return l.useSyncedValueWithCleanup("descriptionElementId",y),Fe("p",t,{ref:n,props:[{id:y},i]})});function Ds({open:e,title:t,description:n,confirmLabel:o,cancelLabel:d,destructive:a=!1,busy:i=!1,onConfirm:l,onCancel:y}){return s.jsx(hr,{open:e,onOpenChange:h=>{!h&&!i&&y?.()},children:s.jsxs(xr,{children:[s.jsx(yr,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),s.jsx(br,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:s.jsxs(wr,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[s.jsx(kr,{className:"text-base font-semibold text-oai-black dark:text-white",children:t}),n?s.jsx(Vs,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:n}):null,s.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[s.jsx(Ve,{type:"button",variant:"secondary",size:"sm",disabled:i,onClick:()=>y?.(),children:d}),s.jsx(Ve,{type:"button",size:"sm",disabled:i,onClick:()=>l?.(),className:xt(a&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:o})]})]})})]})})}function Tn({value:e,onChange:t,placeholder:n,disabled:o=!1,type:d="text",label:a,error:i,className:l="",...y}){const x=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${o?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${i?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${l}`;return s.jsxs("div",{className:"w-full",children:[a&&s.jsx("label",{className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:a}),s.jsx("input",{type:d,value:e,onChange:t,placeholder:n,disabled:o,className:x,...y}),i&&s.jsx("p",{className:"mt-1.5 text-sm text-oai-error",children:i})]})}const Pn="tokentracker-skills";async function wt(e){const t=new URL(`/functions/${Pn}`,window.location.origin);if(e)for(const[d,a]of Object.entries(e))a!=null&&a!==""&&t.searchParams.set(d,String(a));const n=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(o?.error||`Request failed with HTTP ${n.status}`);return o}async function Qe(e){const t=await An(),n=await fetch(`/functions/${Pn}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...t},cache:"no-store",body:JSON.stringify(e)}),o=await n.json().catch(()=>null);if(!n.ok||o?.ok===!1)throw new Error(o?.error||`Request failed with HTTP ${n.status}`);return o}function _s(){return wt({mode:"installed"})}function Us(e={}){return wt({mode:"discover",...e.force?{force:1}:{}})}function Fs(e,t=0,n=20){return wt({mode:"search",q:e,offset:t,limit:n})}function Hs(){return wt({mode:"repos"})}function Bs(e,t){return Qe({action:"install",skill:e,targets:t})}function $s(e){return Qe({action:"uninstall",id:e})}function zs(e){return Qe({action:"restore",id:e})}function Ws(e,t){return Qe({action:"delete_local",directory:e,targets:t||[]})}function qs(e){return Qe({action:"add_repo",repo:e})}function Ks(e,t){return Qe({action:"remove_repo",owner:e,name:t})}const nn=["claude","codex"],tt="all",Te="skillssh";function ht(e){return`${e.repoOwner||"local"}/${e.repoName||"local"}:${e.directory}`}function rn(e){return`install:${ht(e)}`}function sn(e){return`remove:${e.id||e.directory}`}const Ys={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Gs=Ln.memo(function({skill:t,installed:n,installing:o,allTargets:d,defaultTargets:a,onInstall:i}){const[l,y]=r.useState(()=>(a||[]).filter(b=>d.some(w=>w.id===b))),h=b=>{y(w=>w.includes(b)?w.filter(E=>E!==b):[...w,b])},f=t.repoOwner&&t.repoName?`${t.repoOwner}/${t.repoName}`:null,m=t.installs!=null?A("skills.card.installs",{count:Number(t.installs||0).toLocaleString()}):null,x=[f,m].filter(Boolean).join(" · "),N=l.length?l.map(b=>d.find(w=>w.id===b)?.label||b).join(", "):A("skills.action.choose_targets");return s.jsxs(Mr,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[t.readmeUrl?s.jsxs("a",{href:t.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:t.readmeUrl,children:[s.jsx("span",{className:"truncate",children:t.name||t.directory}),s.jsx(Pr,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):s.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:t.name||t.directory}),x?s.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:x}):null]}),n?s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-emerald-50 px-2 py-1 text-xs font-medium text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300",children:[s.jsx(Ye,{className:"h-3 w-3","aria-hidden":!0}),A("skills.card.installed")]}):null]}),t.description?s.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:t.description}):null,s.jsx("div",{className:"mt-auto pt-5",children:n?s.jsxs(Ve,{type:"button",size:"sm",disabled:!0,className:"w-full",children:[s.jsx(Ye,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),A("skills.card.installed")]}):s.jsxs("div",{className:"flex",children:[s.jsxs(Ve,{type:"button",size:"sm",onClick:()=>i(t,l),disabled:o||l.length===0,className:"flex-1 !rounded-r-none",title:N,children:[o?s.jsx(Ge,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(jr,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),l.length>1?A("skills.action.install_to",{count:l.length}):A("skills.action.install")]}),s.jsxs(vr,{children:[s.jsx(Rr,{disabled:o,"aria-label":A("skills.action.choose_targets"),title:N,className:"inline-flex h-8 items-center justify-center rounded-r-md border-l border-white/20 bg-oai-black px-2 text-white hover:bg-oai-gray-800 disabled:cursor-not-allowed disabled:opacity-60 dark:border-oai-black/20 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:s.jsx(hn,{className:"h-3.5 w-3.5","aria-hidden":!0})}),s.jsx(Sr,{children:s.jsx(Cr,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:s.jsxs(Ir,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[s.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:A("skills.target.menu_label")}),d.map(b=>{const w=l.includes(b.id);return s.jsxs("button",{type:"button",onClick:()=>h(b.id),className:xt("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm",w?"bg-oai-gray-100 dark:bg-oai-gray-800":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900"),children:[s.jsx(Vt,{provider:b.id,size:16,className:w?"":"grayscale opacity-40"}),s.jsx("span",{className:"flex-1 text-left",children:b.label}),w?s.jsx(Ye,{className:"h-3.5 w-3.5 text-emerald-500","aria-hidden":!0}):null]},b.id)})]})})})]})]})})]})});function Xs({repos:e,repoInput:t,onRepoInput:n,busyKey:o,onAdd:d,onRemove:a}){return s.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[s.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[s.jsx(Tn,{value:t,onChange:i=>n(i.target.value),placeholder:A("skills.repo.placeholder"),className:"min-w-0 flex-1"}),s.jsxs(Ve,{type:"button",variant:"secondary",size:"md",onClick:d,disabled:o==="repo:add",className:"shrink-0 whitespace-nowrap",children:[o==="repo:add"?s.jsx(Ge,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):s.jsx(xn,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),A("skills.repo.add")]})]}),e.length?s.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(i=>{const l=o===`repo:${i.owner}/${i.name}`;return s.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[i.owner,"/",i.name]}),s.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i.branch})]}),s.jsxs(Ve,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:()=>a(i),className:"shrink-0",children:[l?s.jsx(Ge,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):s.jsx(Dr,{className:"h-3.5 w-3.5","aria-hidden":!0}),s.jsx("span",{className:"sr-only",children:A("skills.repo.remove")})]})]},`${i.owner}/${i.name}`)})}):null]})}function Js(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function ao(){const[e,t]=r.useState(Js),[n,o]=r.useState({skills:[],targets:[]}),[d,a]=r.useState([]),[i,l]=r.useState([]),[y,h]=r.useState([]),[f,m]=r.useState(tt),[x,N]=r.useState(""),[b,w]=r.useState(""),[E,c]=r.useState(""),[I,p]=r.useState(!1),[k,T]=r.useState(""),[D,Q]=r.useState(!0),[L,oe]=r.useState(!1),[pe,_]=r.useState(""),[Y,G]=r.useState(null),[X,ne]=r.useState(null),q=r.useMemo(()=>{const u=new Set;for(const v of n.skills||[])u.add(ht(v).toLowerCase()),v.repoOwner&&v.repoName&&u.add(`${v.repoOwner}/${v.repoName}:${v.sourceDirectory||v.directory}`.toLowerCase());return u},[n.skills]),Z=r.useCallback(async()=>{const u=await _s();o({skills:u.skills||[],targets:u.targets||[]})},[]),S=r.useCallback(async()=>{const u=await Hs();h(u.repos||[])},[]),B=r.useCallback(async({force:u=!1}={})=>{oe(!0);try{const v=await Us({force:u});a(v.skills||[])}finally{oe(!1)}},[]),R=r.useCallback(async()=>{Q(!0),_("");try{await Promise.all([Z(),S()])}catch(u){_(u?.message||A("skills.error.generic"))}finally{Q(!1)}},[Z,S]),M=r.useCallback(async()=>{await R(),e==="browse"&&f!==Te&&B({force:!0}).catch(u=>_(u?.message||A("skills.error.generic")))},[B,R,f,e]);r.useEffect(()=>{R()},[R]),r.useEffect(()=>{e==="browse"&&f!==Te&&d.length===0&&B().catch(u=>_(u?.message||A("skills.error.generic")))},[d.length,B,f,e]),r.useEffect(()=>{if(!X)return;const u=setTimeout(()=>ne(v=>v?.key===X.key?null:v),X.ttlMs||5e3);return()=>clearTimeout(u)},[X]),r.useEffect(()=>{const u=setTimeout(()=>w(x),200);return()=>clearTimeout(u)},[x]),r.useEffect(()=>{if(typeof window>"u")return;const u=new URLSearchParams(window.location.search),v=u.get("tab");if(e==="my"){if(!v)return;u.delete("tab")}else{if(v===e)return;u.set("tab",e)}const j=u.toString(),$=`${window.location.pathname}${j?`?${j}`:""}${window.location.hash}`;window.history.replaceState({},"",$)},[e]);const ue=async(u,v)=>{T(u),_("");try{await v(),await Z()}catch(j){_(j?.message||A("skills.error.generic"))}finally{T("")}},O=(u,v)=>{const j=(v&&v.length?v:nn).filter($=>(n.targets||[]).some(K=>K.id===$));ue(rn(u),async()=>{await Bs(u,j);const $=j.map(K=>(n.targets||[]).find(ie=>ie.id===K)?.label||K).join(", ");ne({key:`${Date.now()}:install:${ht(u)}`,message:A("skills.toast.installed",{name:u.name||u.directory,targets:$||A("skills.target.none")}),ttlMs:4e3})})},he=()=>{const u=Y;u&&(G(null),ue(sn(u),async()=>{let v=null;u.managed?v=await $s(u.id):await Ws(u.directory,u.targets||[]);const j=!!(v?.trashed&&u.managed&&u.id);ne({key:`${Date.now()}:${u.id||u.directory}`,message:A("skills.toast.removed",{name:u.name||u.directory}),undo:j?async()=>{try{await zs(u.id),await Z(),ne(null)}catch($){_($?.message||A("skills.error.generic"))}}:null,ttlMs:5e3})}))},re=async()=>{const u=x.trim();if(!(u.length<2)){T("search"),_("");try{const v=await Fs(u);l(v.skills||[])}catch(v){_(v?.message||A("skills.error.generic"))}finally{T("")}}},P=async()=>{const u=E.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[v,j]=u.split("/");if(!v||!j){_(A("skills.repo.invalid"));return}await ue("repo:add",async()=>{await qs({owner:v,name:j,branch:"main",enabled:!0}),c(""),await S(),await B()})},W=async u=>{await ue(`repo:${u.owner}/${u.name}`,async()=>{await Ks(u.owner,u.name),await S(),await B()})},ae=n.targets||[];n.skills;const ye=r.useMemo(()=>{const u=f===Te?i:d,v=f===Te||f===tt?u:u.filter(K=>`${K.repoOwner}/${K.repoName}`===f),j=b.trim().toLowerCase();return(f===Te||!j?v:v.filter(K=>(K.name||"").toLowerCase().includes(j)||(K.directory||"").toLowerCase().includes(j)||(K.description||"").toLowerCase().includes(j))).map(K=>({...K,installed:q.has(ht(K).toLowerCase())}))},[b,d,q,i,f]),H=s.jsx("div",{className:"flex h-64 items-center justify-center",children:s.jsx(Ge,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),de=s.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[s.jsx(Ge,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),s.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:A("skills.browse.loading_hint")})]}),ee=(u,v=null)=>s.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[s.jsx("p",{children:A(u)}),v]});let fe;if(D)fe=H;else if(e==="my")fe=s.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[ae.length>0?s.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:s.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...ae,...ae].map((u,v)=>s.jsx("span",{className:"shrink-0 px-3",children:s.jsx(Vt,{provider:u.id,size:30})},`b-${v}`))})}),s.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:s.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...ae,...ae].map((u,v)=>s.jsx("span",{className:"shrink-0 px-3",children:s.jsx(Vt,{provider:u.id,size:30})},`c-${v}`))})}),s.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20",style:{background:"linear-gradient(to right, var(--oai-white) 0%, transparent 100%)"}}),s.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20",style:{background:"linear-gradient(to left, var(--oai-white) 0%, transparent 100%)"}})]}):null,s.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:A("skills.empty.my")}),s.jsx(Ve,{type:"button",size:"sm",onClick:()=>t("browse"),children:A("skills.empty.my_cta")})]});else{const u=f===Te,v=y.length===0&&!u;let j;v?j=s.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:s.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:A("skills.browse.empty_sources")})}):L&&!u?j=de:u&&x.trim().length<2?j=s.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:A("skills.browse.hint_skillssh")}):ye.length?j=s.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:ye.map(K=>s.jsx("div",{style:Ys,children:s.jsx(Gs,{skill:K,installed:!!K.installed,installing:k===rn(K),allTargets:ae,defaultTargets:nn,onInstall:O})},K.id||K.key))}):u?j=ee("skills.empty.search"):j=ee("skills.empty.browse");const $=v||I?s.jsx("div",{className:"mb-5",children:s.jsx(Xs,{repos:y,repoInput:E,onRepoInput:c,busyKey:k,onAdd:P,onRemove:W})}):null;fe=s.jsxs(s.Fragment,{children:[$,j]})}return s.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[s.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:s.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[s.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[s.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:A("skills.page.title")}),s.jsxs(Ve,{type:"button",variant:"secondary",size:"sm",onClick:M,disabled:D||L,children:[s.jsx(Nr,{className:xt("mr-1.5 h-3.5 w-3.5",(D||L)&&"animate-spin"),"aria-hidden":!0}),A("skills.action.refresh")]})]}),s.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",A("skills.tab.my")],["browse",A("skills.tab.browse")]].map(([u,v])=>s.jsx("button",{type:"button","aria-pressed":e===u,onClick:()=>t(u),className:xt("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",e===u?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:v},u))}),pe?s.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:pe}):null,e==="browse"?s.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row",children:[s.jsxs(is,{value:f,onValueChange:m,children:[s.jsxs(ds,{"aria-label":A("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[s.jsx(ms,{children:u=>u===tt?A("skills.source.all"):u===Te?A("skills.source.skillssh"):u}),s.jsx(gs,{className:"text-oai-gray-400",children:s.jsx(hn,{className:"h-4 w-4","aria-hidden":!0})})]}),s.jsx(hs,{children:s.jsx(Cs,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:s.jsxs(Ts,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[s.jsxs(jt,{value:tt,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[s.jsx(Tt,{children:A("skills.source.all")}),s.jsx(Et,{children:s.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),y.map(u=>{const v=`${u.owner}/${u.name}`;return s.jsxs(jt,{value:v,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[s.jsx(Tt,{children:v}),s.jsx(Et,{children:s.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},v)}),s.jsxs(jt,{value:Te,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[s.jsx(Tt,{children:A("skills.source.skillssh")}),s.jsx(Et,{children:s.jsx(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]})})})]}),s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Yt,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),s.jsx(Tn,{value:x,onChange:u=>N(u.target.value),onKeyDown:u=>{u.key==="Enter"&&f===Te&&re()},placeholder:f===Te?A("skills.browse.placeholder_skillssh"):f===tt?A("skills.browse.placeholder_all"):A("skills.browse.placeholder_repo",{repo:f}),className:"pl-9"})]}),f===Te?s.jsxs(Ve,{type:"button",onClick:re,disabled:x.trim().length<2||k==="search",children:[k==="search"?s.jsx(Ge,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):s.jsx(Yt,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),A("skills.action.search")]}):null,s.jsxs(Ve,{type:"button",variant:"secondary",size:"sm",onClick:()=>p(u=>!u),"aria-expanded":I,className:"!h-10 shrink-0 whitespace-nowrap",children:[s.jsx(xn,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),A("skills.browse.manage_sources"),s.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:y.length})]})]}):null,fe]})}),s.jsx(Ds,{open:!!Y,title:A("skills.confirm.remove_title",{name:Y?.name||Y?.directory||""}),description:Y?Y.managed?A("skills.confirm.remove_managed"):A("skills.confirm.remove_local"):"",confirmLabel:A("skills.action.remove"),cancelLabel:A("shared.action.cancel"),destructive:!0,busy:k===sn(Y||{}),onCancel:()=>G(null),onConfirm:he}),X?s.jsx("div",{className:"pointer-events-none fixed inset-x-0 bottom-6 z-[90] flex justify-center px-4",children:s.jsxs("div",{className:"pointer-events-auto flex max-w-md items-center gap-3 rounded-full bg-oai-black px-4 py-2 text-sm text-white shadow-lg dark:bg-white dark:text-oai-black",children:[s.jsx("span",{children:X.message}),X.undo?s.jsx("button",{type:"button",onClick:X.undo,className:"rounded-full px-2 py-0.5 text-xs font-semibold uppercase tracking-wide hover:bg-white/10 dark:hover:bg-oai-black/10",children:A("shared.action.undo")}):null]})}):null]})}export{ao as SkillsPage};
|