tokentracker-cli 0.5.97 → 0.5.98
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.
|
@@ -785,7 +785,7 @@ settings.appearance.language.chinese,ui,SettingsPage,SettingsPage,language_chine
|
|
|
785
785
|
${E}px !important;
|
|
786
786
|
${M}px !important;
|
|
787
787
|
}
|
|
788
|
-
`),()=>{o.current?.removeAttribute("data-motion-pop-id"),R.contains(T)&&R.removeChild(T)}},[e]),m.jsx(rX,{isPresent:e,childRef:o,sizeRef:c,pop:a,children:a===!1?t:x.cloneElement(t,{ref:h})})}const aX=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:s,anchorX:o,anchorY:c,root:u})=>{const f=kp(sX),h=x.useId();let p=!0,y=x.useMemo(()=>(p=!1,{id:h,initial:e,isPresent:n,custom:i,onExitComplete:v=>{f.set(v,!0);for(const w of f.values())if(!w)return;r&&r()},register:v=>(f.set(v,!1),()=>f.delete(v))}),[n,f,r]);return a&&p&&(y={...y}),x.useMemo(()=>{f.forEach((v,w)=>f.set(w,!1))},[n]),x.useEffect(()=>{!n&&!f.size&&r&&r()},[n]),t=m.jsx(iX,{pop:s==="popLayout",isPresent:n,anchorX:o,anchorY:c,root:u,children:t}),m.jsx(Hy.Provider,{value:y,children:t})};function sX(){return new Map}function uO(t=!0){const e=x.useContext(Hy);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=e,a=x.useId();x.useEffect(()=>{if(t)return i(a)},[t]);const s=x.useCallback(()=>t&&r&&r(a),[a,r,t]);return!n&&r?[!1,s]:[!0]}const og=t=>t.key||"";function zA(t){const e=[];return x.Children.forEach(t,n=>{x.isValidElement(n)&&e.push(n)}),e}const Ap=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a="sync",propagate:s=!1,anchorX:o="left",anchorY:c="top",root:u})=>{const[f,h]=uO(s),p=x.useMemo(()=>zA(t),[t]),y=s&&!f?[]:p.map(og),v=x.useRef(!0),w=x.useRef(p),b=kp(()=>new Map),_=x.useRef(new Set),[E,M]=x.useState(p),[T,R]=x.useState(p);Vy(()=>{v.current=!1,w.current=p;for(let k=0;k<T.length;k++){const N=og(T[k]);y.includes(N)?(b.delete(N),_.current.delete(N)):b.get(N)!==!0&&b.set(N,!1)}},[T,y.length,y.join("-")]);const A=[];if(p!==E){let k=[...p];for(let N=0;N<T.length;N++){const U=T[N],L=og(U);y.includes(L)||(k.splice(N,0,U),A.push(U))}return a==="wait"&&A.length&&(k=A),R(zA(k)),M(p),null}const{forceRender:P}=x.useContext(Xh);return m.jsx(m.Fragment,{children:T.map(k=>{const N=og(k),U=s&&!f?!1:p===T||y.includes(N),L=()=>{if(_.current.has(N))return;if(b.has(N))_.current.add(N),b.set(N,!0);else return;let z=!0;b.forEach(F=>{F||(z=!1)}),z&&(P?.(),R(w.current),s&&h?.(),r&&r())};return m.jsx(aX,{isPresent:U,initial:!v.current||n?void 0:!1,custom:e,presenceAffectsLayout:i,mode:a,root:u,onExitComplete:U?void 0:L,anchorX:o,anchorY:c,children:k},N)})})},oX=x.createContext(null);function lX(){const t=x.useRef(!1);return Vy(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function cX(){const t=lX(),[e,n]=x.useState(0),r=x.useCallback(()=>{t.current&&n(e+1)},[e]);return[x.useCallback(()=>Wn.postRender(r),[r]),e]}const dO=t=>t===!0,uX=t=>dO(t===!0)||t==="id",dX=({children:t,id:e,inherit:n=!0})=>{const r=x.useContext(Xh),i=x.useContext(oX),[a,s]=cX(),o=x.useRef(null),c=r.id||i;o.current===null&&(uX(n)&&c&&(e=e?c+"-"+e:c),o.current={id:e,group:dO(n)&&r.group||jA()});const u=x.useMemo(()=>({...o.current,forceRender:a}),[s]);return m.jsx(Xh.Provider,{value:u,children:t})},fO=x.createContext({strict:!1}),VA={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let HA=!1;function fX(){if(HA)return;const t={};for(const e in VA)t[e]={isEnabled:n=>VA[e].some(r=>!!n[r])};BI(t),HA=!0}function hO(){return fX(),WY()}function hX(t){const e=hO();for(const n in t)e[n]={...e[n],...t[n]};BI(e)}const pX=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function ey(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||pX.has(t)}let pO=t=>!ey(t);function mX(t){typeof t=="function"&&(pO=e=>e.startsWith("on")?!ey(e):t(e))}try{mX(require("@emotion/is-prop-valid").default)}catch{}function gX(t,e,n){const r={};for(const i in t)i==="values"&&typeof t.values=="object"||Ur(t[i])||(pO(i)||n===!0&&ey(i)||!e&&!ey(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}const Yy=x.createContext({});function yX(t,e){if($y(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Qh(n)?n:void 0,animate:Qh(r)?r:void 0}}return t.inherit!==!1?e:{}}function vX(t){const{initial:e,animate:n}=yX(t,x.useContext(Yy));return x.useMemo(()=>({initial:e,animate:n}),[WA(e),WA(n)])}function WA(t){return Array.isArray(t)?t.join(" "):t}const eE=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function mO(t,e,n){for(const r in e)!Ur(e[r])&&!YI(r,n)&&(t[r]=e[r])}function xX({transformTemplate:t},e){return x.useMemo(()=>{const n=eE();return Jk(n,e,t),Object.assign({},n.vars,n.style)},[e])}function bX(t,e){const n=t.style||{},r={};return mO(r,n,t),Object.assign(r,xX(t,e)),r}function _X(t,e){const n={},r=bX(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const gO=()=>({...eE(),attrs:{}});function wX(t,e,n,r){const i=x.useMemo(()=>{const a=gO();return qI(a,e,KI(r),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};mO(a,t.style,t),i.style={...a,...i.style}}return i}const SX=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function tE(t){return typeof t!="string"||t.includes("-")?!1:!!(SX.indexOf(t)>-1||/[A-Z]/u.test(t))}function kX(t,e,n,{latestValues:r},i,a=!1,s){const c=(s??tE(t)?wX:_X)(e,r,i,t),u=gX(e,typeof t=="string",a),f=t!==x.Fragment?{...u,...c,ref:n}:{},{children:h}=e,p=x.useMemo(()=>Ur(h)?h.get():h,[h]);return x.createElement(t,{...f,children:p})}function EX({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,i){return{latestValues:MX(n,r,i,t),renderState:e()}}function MX(t,e,n,r){const i={},a=r(t,{});for(const p in a)i[p]=p0(a[p]);let{initial:s,animate:o}=t;const c=$y(t),u=UI(t);e&&u&&!c&&t.inherit!==!1&&(s===void 0&&(s=e.initial),o===void 0&&(o=e.animate));let f=n?n.initial===!1:!1;f=f||s===!1;const h=f?o:s;if(h&&typeof h!="boolean"&&!Gy(h)){const p=Array.isArray(h)?h:[h];for(let y=0;y<p.length;y++){const v=Hk(t,p[y]);if(v){const{transitionEnd:w,transition:b,..._}=v;for(const E in _){let M=_[E];if(Array.isArray(M)){const T=f?M.length-1:0;M=M[T]}M!==null&&(i[E]=M)}for(const E in w)i[E]=w[E]}}}return i}const yO=t=>(e,n)=>{const r=x.useContext(Yy),i=x.useContext(Hy),a=()=>EX(t,e,r,i);return n?a():kp(a)},TX=yO({scrapeMotionValuesFromProps:Qk,createRenderState:eE}),CX=yO({scrapeMotionValuesFromProps:ZI,createRenderState:gO}),AX=Symbol.for("motionComponentSymbol");function RX(t,e,n){const r=x.useRef(n);x.useInsertionEffect(()=>{r.current=n});const i=x.useRef(null);return x.useCallback(a=>{a&&t.onMount?.(a);const s=r.current;if(typeof s=="function")if(a){const o=s(a);typeof o=="function"&&(i.current=o)}else i.current?(i.current(),i.current=null):s(a);else s&&(s.current=a);e&&(a?e.mount(a):e.unmount())},[e])}const vO=x.createContext({});function hd(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function PX(t,e,n,r,i,a){const{visualElement:s}=x.useContext(Yy),o=x.useContext(fO),c=x.useContext(Hy),u=x.useContext(Cp),f=u.reducedMotion,h=u.skipAnimations,p=x.useRef(null),y=x.useRef(!1);r=r||o.renderer,!p.current&&r&&(p.current=r(t,{visualState:e,parent:s,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:f,skipAnimations:h,isSVG:a}),y.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));const v=p.current,w=x.useContext(vO);v&&!v.projection&&i&&(v.type==="html"||v.type==="svg")&&NX(p.current,n,i,w);const b=x.useRef(!1);x.useInsertionEffect(()=>{v&&b.current&&v.update(n,c)});const _=n[EI],E=x.useRef(!!_&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return Vy(()=>{y.current=!0,v&&(b.current=!0,window.MotionIsMounted=!0,v.updateFeatures(),v.scheduleRenderMicrotask(),E.current&&v.animationState&&v.animationState.animateChanges())}),x.useEffect(()=>{v&&(!E.current&&v.animationState&&v.animationState.animateChanges(),E.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),E.current=!1),v.enteringChildren=void 0)}),v}function NX(t,e,n,r){const{layoutId:i,layout:a,drag:s,dragConstraints:o,layoutScroll:c,layoutRoot:u,layoutAnchor:f,layoutCrossfade:h}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:xO(t.parent)),t.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!s||o&&hd(o),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:c,layoutRoot:u,layoutAnchor:f})}function xO(t){if(t)return t.options.allowProjection!==!1?t.projection:xO(t.parent)}function Ib(t,{forwardMotionProps:e=!1,type:n}={},r,i){r&&hX(r);const a=n?n==="svg":tE(t),s=a?CX:TX;function o(u,f){let h;const p={...x.useContext(Cp),...u,layoutId:DX(u)},{isStatic:y}=p,v=vX(u),w=s(u,y);if(!y&&typeof window<"u"){LX();const b=IX(p);h=b.MeasureLayout,v.visualElement=PX(t,w,p,i,b.ProjectionNode,a)}return m.jsxs(Yy.Provider,{value:v,children:[h&&v.visualElement?m.jsx(h,{visualElement:v.visualElement,...p}):null,kX(t,u,RX(w,v.visualElement,f),w,y,e,a)]})}o.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const c=x.forwardRef(o);return c[AX]=t,c}function DX({layoutId:t}){const e=x.useContext(Xh).id;return e&&t!==void 0?e+"-"+t:t}function LX(t,e){x.useContext(fO).strict}function IX(t){const e=hO(),{drag:n,layout:r}=e;if(!n&&!r)return{};const i={...n,...r};return{MeasureLayout:n?.isEnabled(t)||r?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function OX(t,e){if(typeof Proxy>"u")return Ib;const n=new Map,r=(a,s)=>Ib(a,s,t,e),i=(a,s)=>r(a,s);return new Proxy(i,{get:(a,s)=>s==="create"?r:(n.has(s)||n.set(s,Ib(s,void 0,t,e)),n.get(s))})}const FX=(t,e)=>e.isSVG??tE(t)?new oq(e):new tq(e,{allowProjection:t!==x.Fragment});class UX extends Il{constructor(e){super(e),e.animationState||(e.animationState=fq(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Gy(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let jX=0;class BX extends Il{constructor(){super(...arguments),this.id=jX++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&r===!1){if(this.isExitComplete){const{initial:a,custom:s}=this.node.getProps();if(typeof a=="string"){const o=Fc(this.node,a,s);if(o){const{transition:c,transitionEnd:u,...f}=o;for(const h in f)this.node.getValue(h)?.jump(f[h])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!e);n&&!e&&i.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const zX={animation:{Feature:UX},exit:{Feature:BX}};function Rp(t){return{point:{x:t.pageX,y:t.pageY}}}const VX=t=>e=>Yk(e)&&t(e,Rp(e));function Ih(t,e,n,r){return ep(t,e,VX(n),r)}const bO=({current:t})=>t?t.ownerDocument.defaultView:null,GA=(t,e)=>Math.abs(t-e);function HX(t,e){const n=GA(t.x,e.x),r=GA(t.y,e.y);return Math.sqrt(n**2+r**2)}const $A=new Set(["auto","scroll"]);class _O{constructor(e,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:a=!1,distanceThreshold:s=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=y=>{this.handleScroll(y.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=lg(this.lastRawMoveEventInfo,this.transformPagePoint));const y=Ob(this.lastMoveEventInfo,this.history),v=this.startEvent!==null,w=HX(y.offset,{x:0,y:0})>=this.distanceThreshold;if(!v&&!w)return;const{point:b}=y,{timestamp:_}=Qr;this.history.push({...b,timestamp:_});const{onStart:E,onMove:M}=this.handlers;v||(E&&E(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),M&&M(this.lastMoveEvent,y)},this.handlePointerMove=(y,v)=>{this.lastMoveEvent=y,this.lastRawMoveEventInfo=v,this.lastMoveEventInfo=lg(v,this.transformPagePoint),Wn.update(this.updatePoint,!0)},this.handlePointerUp=(y,v)=>{this.end();const{onEnd:w,onSessionEnd:b,resumeAnimation:_}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&_&&_(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=Ob(y.type==="pointercancel"?this.lastMoveEventInfo:lg(v,this.transformPagePoint),this.history);this.startEvent&&w&&w(y,E),b&&b(y,E)},!Yk(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=s,this.contextWindow=i||window;const c=Rp(e),u=lg(c,this.transformPagePoint),{point:f}=u,{timestamp:h}=Qr;this.history=[{...f,timestamp:h}];const{onSessionStart:p}=n;p&&p(e,Ob(u,this.history)),this.removeListeners=Ep(Ih(this.contextWindow,"pointermove",this.handlePointerMove),Ih(this.contextWindow,"pointerup",this.handlePointerUp),Ih(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let n=e.parentElement;for(;n;){const r=getComputedStyle(n);($A.has(r.overflowX)||$A.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const r=e===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a={x:i.x-n.x,y:i.y-n.y};a.x===0&&a.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(e,i),Wn.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Ao(this.updatePoint)}}function lg(t,e){return e?{point:e(t.point)}:t}function YA(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Ob({point:t},e){return{point:t,delta:YA(t,wO(e)),offset:YA(t,WX(e)),velocity:GX(e,.1)}}function WX(t){return t[0]}function wO(t){return t[t.length-1]}function GX(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const i=wO(t);for(;n>=0&&(r=t[n],!(i.timestamp-r.timestamp>oa(e)));)n--;if(!r)return{x:0,y:0};r===t[0]&&t.length>2&&i.timestamp-r.timestamp>oa(e)*2&&(r=t[1]);const a=Ea(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const s={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function $X(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?ar(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?ar(n,t,r.max):Math.min(t,n)),t}function qA(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function YX(t,{top:e,left:n,bottom:r,right:i}){return{x:qA(t.x,n,i),y:qA(t.y,e,r)}}function XA(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function qX(t,e){return{x:XA(t.x,e.x),y:XA(t.y,e.y)}}function XX(t,e){let n=.5;const r=ki(t),i=ki(e);return i>r?n=Kh(e.min,e.max-r,t.min):r>i&&(n=Kh(t.min,t.max-i,e.min)),Bs(0,1,n)}function KX(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const l1=.35;function ZX(t=l1){return t===!1?t=0:t===!0&&(t=l1),{x:KA(t,"left","right"),y:KA(t,"top","bottom")}}function KA(t,e,n){return{min:ZA(t,e),max:ZA(t,n)}}function ZA(t,e){return typeof t=="number"?t:t[e]||0}const JX=new WeakMap;class QX{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ir(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const a=h=>{n&&this.snapToCursor(Rp(h).point),this.stopAnimation()},s=(h,p)=>{const{drag:y,dragPropagation:v,onDragStart:w}=this.getProps();if(y&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xY(y),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),bs(_=>{let E=this.getAxisMotionValue(_).get()||0;if(Ns.test(E)){const{projection:M}=this.visualElement;if(M&&M.layout){const T=M.layout.layoutBox[_];T&&(E=ki(T)*(parseFloat(E)/100))}}this.originPoint[_]=E}),w&&Wn.update(()=>w(h,p),!1,!0),e1(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},o=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p;const{dragPropagation:y,dragDirectionLock:v,onDirectionLock:w,onDrag:b}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:_}=p;if(v&&this.currentDirection===null){this.currentDirection=tK(_),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",p.point,_),this.updateAxis("y",p.point,_),this.visualElement.render(),b&&Wn.update(()=>b(h,p),!1,!0)},c=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p,this.stop(h,p),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:f}=this.getProps();this.panSession=new _O(e,{onSessionStart:a,onStart:s,onMove:o,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:f,distanceThreshold:r,contextWindow:bO(this.visualElement),element:this.visualElement.current})}stop(e,n){const r=e||this.latestPointerEvent,i=n||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!i||!r)return;const{velocity:s}=i;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&Wn.postRender(()=>o(r,i))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,r){const{drag:i}=this.getProps();if(!r||!cg(e,i,this.currentDirection))return;const a=this.getAxisMotionValue(e);let s=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(s=$X(s,this.constraints[e],this.elastic[e])),a.set(s)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;e&&hd(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=YX(r.layoutBox,e):this.constraints=!1,this.elastic=ZX(n),i!==this.constraints&&!hd(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&bs(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=KX(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!hd(e))return!1;const r=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const a=XY(r,i.root,this.visualElement.getTransformPagePoint());let s=qX(i.layout.layoutBox,a);if(n){const o=n($Y(s));this.hasMutatedConstraints=!!o,o&&(s=VI(o))}return s}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:a,dragSnapToOrigin:s,onDragTransitionEnd:o}=this.getProps(),c=this.constraints||{},u=bs(f=>{if(!cg(f,n,this.currentDirection))return;let h=c&&c[f]||{};(s===!0||s===f)&&(h={min:0,max:0});const p=i?200:1e6,y=i?40:1e7,v={type:"inertia",velocity:r?e[f]:0,bounceStiffness:p,bounceDamping:y,timeConstant:750,restDelta:1,restSpeed:10,...a,...h};return this.startAxisValueAnimation(f,v)});return Promise.all(u).then(o)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return e1(this.visualElement,e),r.start(Vk(e,r,0,n,this.visualElement,!1))}stopAnimation(){bs(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){bs(n=>{const{drag:r}=this.getProps();if(!cg(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,a=this.getAxisMotionValue(n);if(i&&i.layout){const{min:s,max:o}=i.layout.layoutBox[n],c=a.get()||0;a.set(e[n]-ar(s,o,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!hd(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};bs(s=>{const o=this.getAxisMotionValue(s);if(o&&this.constraints!==!1){const c=o.get();i[s]=XX({min:c,max:c},this.constraints[s])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),bs(s=>{if(!cg(s,e,null))return;const o=this.getAxisMotionValue(s),{min:c,max:u}=this.constraints[s];o.set(ar(c,u,i[s]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;JX.set(this.visualElement,this);const e=this.visualElement.current,n=Ih(e,"pointerdown",u=>{const{drag:f,dragListener:h=!0}=this.getProps(),p=u.target,y=p!==e&&EY(p);f&&h&&!y&&this.start(u)});let r;const i=()=>{const{dragConstraints:u}=this.getProps();hd(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=eK(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,s=a.addEventListener("measure",i);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),Wn.read(i);const o=ep(window,"resize",()=>this.scalePositionWithinConstraints()),c=a.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:f})=>{this.isDragging&&f&&(bs(h=>{const p=this.getAxisMotionValue(h);p&&(this.originPoint[h]+=u[h].translate,p.set(p.get()+u[h].translate))}),this.visualElement.render())}));return()=>{o(),n(),s(),c&&c(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:a=!1,dragElastic:s=l1,dragMomentum:o=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:a,dragElastic:s,dragMomentum:o}}}function JA(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function eK(t,e,n){const r=rA(t,JA(n)),i=rA(e,JA(n));return()=>{r(),i()}}function cg(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function tK(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class nK extends Il{constructor(e){super(e),this.removeGroupControls=Ta,this.removeListeners=Ta,this.controls=new QX(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ta}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Fb=t=>(e,n)=>{t&&Wn.update(()=>t(e,n),!1,!0)};class rK extends Il{constructor(){super(...arguments),this.removePointerDownListener=Ta}onPointerDown(e){this.session=new _O(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:bO(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Fb(e),onStart:Fb(n),onMove:Fb(r),onEnd:(a,s)=>{delete this.session,i&&Wn.postRender(()=>i(a,s))}}}mount(){this.removePointerDownListener=Ih(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Ub=!1;class iK extends x.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:a}=e;a&&(n.group&&n.group.add(a),r&&r.register&&i&&r.register(a),Ub&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),m0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:i,isPresent:a}=this.props,{projection:s}=r;return s&&(s.isPresent=a,e.layoutDependency!==n&&s.setOptions({...s.options,layoutDependency:n}),Ub=!0,i||e.layoutDependency!==n||n===void 0||e.isPresent!==a?s.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?s.promote():s.relegate()||Wn.postRender(()=>{const o=s.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),$k.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=e;Ub=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function SO(t){const[e,n]=uO(),r=x.useContext(Xh);return m.jsx(iK,{...t,layoutGroup:r,switchLayoutGroup:x.useContext(vO),isPresent:e,safeToRemove:n})}const aK={pan:{Feature:rK},drag:{Feature:nK,ProjectionNode:cO,MeasureLayout:SO}};function QA(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,a=r[i];a&&Wn.postRender(()=>a(e,Rp(e)))}class sK extends Il{mount(){const{current:e}=this.node;e&&(this.unmount=_Y(e,(n,r)=>(QA(this.node,r,"Start"),i=>QA(this.node,i,"End"))))}unmount(){}}class oK extends Il{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ep(ep(this.node.current,"focus",()=>this.onFocus()),ep(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function eR(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),a=r[i];a&&Wn.postRender(()=>a(e,Rp(e)))}class lK extends Il{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=TY(e,(i,a)=>(eR(this.node,a,"Start"),(s,{success:o})=>eR(this.node,s,o?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:r?.tap===!1})}unmount(){}}const c1=new WeakMap,jb=new WeakMap,cK=t=>{const e=c1.get(t.target);e&&e(t)},uK=t=>{t.forEach(cK)};function dK({root:t,...e}){const n=t||document;jb.has(n)||jb.set(n,{});const r=jb.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(uK,{root:t,...e})),r[i]}function fK(t,e,n){const r=dK(e);return c1.set(t,n),r.observe(t),()=>{c1.delete(t),r.unobserve(t)}}const hK={some:0,all:1};class pK extends Il{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:a}=e,s={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:hK[i]},o=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,a&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),p=u?f:h;p&&p(c)};this.stopObserver=fK(this.node.current,s,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(mK(e,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function mK({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const gK={inView:{Feature:pK},tap:{Feature:lK},focus:{Feature:oK},hover:{Feature:sK}},yK={layout:{ProjectionNode:cO,MeasureLayout:SO}},vK={...zX,...gK,...aK,...yK},fr=OX(vK,FX);function nE(t){const e=kp(()=>Xc(t)),{isStatic:n}=x.useContext(Cp);if(n){const[,r]=x.useState(t);x.useEffect(()=>e.on("change",r),[])}return e}function kO(t,e){const n=nE(e()),r=()=>n.set(e());return r(),Vy(()=>{const i=()=>Wn.preRender(r,!1,!0),a=t.map(s=>s.on("change",i));return()=>{a.forEach(s=>s()),Ao(r)}}),n}function xK(t){Dh.current=[],t();const e=kO(Dh.current,t);return Dh.current=void 0,e}function EO(t,e,n,r){if(typeof t=="function")return xK(t);const a=typeof e=="function"?e:FY(e,n,r),s=Array.isArray(t)?tR(t,a):tR([t],([c])=>a(c)),o=Array.isArray(t)?void 0:t.accelerate;return o&&!o.isTransformed&&typeof e!="function"&&Array.isArray(n)&&r?.clamp!==!1&&(s.accelerate={...o,times:e,keyframes:n,isTransformed:!0}),s}function tR(t,e){const n=kp(()=>[]);return kO(t,()=>{n.length=0;const r=t.length;for(let i=0;i<r;i++)n[i]=t[i].get();return e(n)})}function bK(t,e={}){const{isStatic:n}=x.useContext(Cp),r=()=>Ur(t)?t.get():t;if(n)return EO(r);const i=nE(r());return x.useInsertionEffect(()=>UY(i,t,e),[i,JSON.stringify(e)]),i}function _K(t,e={}){return bK(t,{type:"spring",...e})}function su(){!Zk.current&&jI();const[t]=x.useState(K0.current);return t}function MO(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=MO(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function wK(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=MO(t))&&(r&&(r+=" "),r+=e);return r}const SK=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},kK=(t,e)=>({classGroupId:t,validator:e}),TO=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),ty="-",nR=[],EK="arbitrary..",MK=t=>{const e=CK(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return TK(s);const o=s.split(ty),c=o[0]===""&&o.length>1?1:0;return CO(o,c,e)},getConflictingClassGroupIds:(s,o)=>{if(o){const c=r[s],u=n[s];return c?u?SK(u,c):c:u||nR}return n[s]||nR}}},CO=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],a=n.nextPart.get(i);if(a){const u=CO(t,e+1,a);if(u)return u}const s=n.validators;if(s===null)return;const o=e===0?t.join(ty):t.slice(e).join(ty),c=s.length;for(let u=0;u<c;u++){const f=s[u];if(f.validator(o))return f.classGroupId}},TK=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?EK+r:void 0})(),CK=t=>{const{theme:e,classGroups:n}=t;return AK(n,e)},AK=(t,e)=>{const n=TO();for(const r in t){const i=t[r];rE(i,n,r,e)}return n},rE=(t,e,n,r)=>{const i=t.length;for(let a=0;a<i;a++){const s=t[a];RK(s,e,n,r)}},RK=(t,e,n,r)=>{if(typeof t=="string"){PK(t,e,n);return}if(typeof t=="function"){NK(t,e,n,r);return}DK(t,e,n,r)},PK=(t,e,n)=>{const r=t===""?e:AO(e,t);r.classGroupId=n},NK=(t,e,n,r)=>{if(LK(t)){rE(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(kK(n,t))},DK=(t,e,n,r)=>{const i=Object.entries(t),a=i.length;for(let s=0;s<a;s++){const[o,c]=i[s];rE(c,AO(e,o),n,r)}},AO=(t,e)=>{let n=t;const r=e.split(ty),i=r.length;for(let a=0;a<i;a++){const s=r[a];let o=n.nextPart.get(s);o||(o=TO(),n.nextPart.set(s,o)),n=o}return n},LK=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,IK=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(a,s)=>{n[a]=s,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(a){let s=n[a];if(s!==void 0)return s;if((s=r[a])!==void 0)return i(a,s),s},set(a,s){a in n?n[a]=s:i(a,s)}}},u1="!",rR=":",OK=[],iR=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),FK=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const a=[];let s=0,o=0,c=0,u;const f=i.length;for(let w=0;w<f;w++){const b=i[w];if(s===0&&o===0){if(b===rR){a.push(i.slice(c,w)),c=w+1;continue}if(b==="/"){u=w;continue}}b==="["?s++:b==="]"?s--:b==="("?o++:b===")"&&o--}const h=a.length===0?i:i.slice(c);let p=h,y=!1;h.endsWith(u1)?(p=h.slice(0,-1),y=!0):h.startsWith(u1)&&(p=h.slice(1),y=!0);const v=u&&u>c?u-c:void 0;return iR(a,y,p,v)};if(e){const i=e+rR,a=r;r=s=>s.startsWith(i)?a(s.slice(i.length)):iR(OK,!1,s,void 0,!0)}if(n){const i=r;r=a=>n({className:a,parseClassName:i})}return r},UK=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let a=0;a<n.length;a++){const s=n[a],o=s[0]==="[",c=e.has(s);o||c?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(s)):i.push(s)}return i.length>0&&(i.sort(),r.push(...i)),r}},jK=t=>({cache:IK(t.cacheSize),parseClassName:FK(t),sortModifiers:UK(t),...MK(t)}),BK=/\s+/,zK=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=e,s=[],o=t.trim().split(BK);let c="";for(let u=o.length-1;u>=0;u-=1){const f=o[u],{isExternal:h,modifiers:p,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:w}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let b=!!w,_=r(b?v.substring(0,w):v);if(!_){if(!b){c=f+(c.length>0?" "+c:c);continue}if(_=r(v),!_){c=f+(c.length>0?" "+c:c);continue}b=!1}const E=p.length===0?"":p.length===1?p[0]:a(p).join(":"),M=y?E+u1:E,T=M+_;if(s.indexOf(T)>-1)continue;s.push(T);const R=i(_,b);for(let A=0;A<R.length;++A){const P=R[A];s.push(M+P)}c=f+(c.length>0?" "+c:c)}return c},VK=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=RO(n))&&(i&&(i+=" "),i+=r);return i},RO=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=RO(t[r]))&&(n&&(n+=" "),n+=e);return n},HK=(t,...e)=>{let n,r,i,a;const s=c=>{const u=e.reduce((f,h)=>h(f),t());return n=jK(u),r=n.cache.get,i=n.cache.set,a=o,o(c)},o=c=>{const u=r(c);if(u)return u;const f=zK(c,n);return i(c,f),f};return a=s,(...c)=>a(VK(...c))},WK=[],Lr=t=>{const e=n=>n[t]||WK;return e.isThemeGetter=!0,e},PO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,NO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,GK=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$K=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,YK=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,qK=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,XK=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,KK=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,el=t=>GK.test(t),bn=t=>!!t&&!Number.isNaN(Number(t)),tl=t=>!!t&&Number.isInteger(Number(t)),Bb=t=>t.endsWith("%")&&bn(t.slice(0,-1)),oo=t=>$K.test(t),DO=()=>!0,ZK=t=>YK.test(t)&&!qK.test(t),iE=()=>!1,JK=t=>XK.test(t),QK=t=>KK.test(t),eZ=t=>!It(t)&&!Ut(t),tZ=t=>Ol(t,OO,iE),It=t=>PO.test(t),lc=t=>Ol(t,FO,ZK),aR=t=>Ol(t,cZ,bn),nZ=t=>Ol(t,jO,DO),rZ=t=>Ol(t,UO,iE),sR=t=>Ol(t,LO,iE),iZ=t=>Ol(t,IO,QK),ug=t=>Ol(t,BO,JK),Ut=t=>NO.test(t),ih=t=>ou(t,FO),aZ=t=>ou(t,UO),oR=t=>ou(t,LO),sZ=t=>ou(t,OO),oZ=t=>ou(t,IO),dg=t=>ou(t,BO,!0),lZ=t=>ou(t,jO,!0),Ol=(t,e,n)=>{const r=PO.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},ou=(t,e,n=!1)=>{const r=NO.exec(t);return r?r[1]?e(r[1]):n:!1},LO=t=>t==="position"||t==="percentage",IO=t=>t==="image"||t==="url",OO=t=>t==="length"||t==="size"||t==="bg-size",FO=t=>t==="length",cZ=t=>t==="number",UO=t=>t==="family-name",jO=t=>t==="number"||t==="weight",BO=t=>t==="shadow",uZ=()=>{const t=Lr("color"),e=Lr("font"),n=Lr("text"),r=Lr("font-weight"),i=Lr("tracking"),a=Lr("leading"),s=Lr("breakpoint"),o=Lr("container"),c=Lr("spacing"),u=Lr("radius"),f=Lr("shadow"),h=Lr("inset-shadow"),p=Lr("text-shadow"),y=Lr("drop-shadow"),v=Lr("blur"),w=Lr("perspective"),b=Lr("aspect"),_=Lr("ease"),E=Lr("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...T(),Ut,It],A=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],k=()=>[Ut,It,c],N=()=>[el,"full","auto",...k()],U=()=>[tl,"none","subgrid",Ut,It],L=()=>["auto",{span:["full",tl,Ut,It]},tl,Ut,It],z=()=>[tl,"auto",Ut,It],F=()=>["auto","min","max","fr",Ut,It],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...k()],Q=()=>[el,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],O=()=>[el,"screen","full","dvw","lvw","svw","min","max","fit",...k()],G=()=>[el,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],Y=()=>[t,Ut,It],H=()=>[...T(),oR,sR,{position:[Ut,It]}],te=()=>["no-repeat",{repeat:["","x","y","space","round"]}],re=()=>["auto","cover","contain",sZ,tZ,{size:[Ut,It]}],ue=()=>[Bb,ih,lc],ce=()=>["","none","full",u,Ut,It],ee=()=>["",bn,ih,lc],le=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Pe=()=>[bn,Bb,oR,sR],be=()=>["","none",v,Ut,It],Ye=()=>["none",bn,Ut,It],he=()=>["none",bn,Ut,It],Ue=()=>[bn,Ut,It],je=()=>[el,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[oo],breakpoint:[oo],color:[DO],container:[oo],"drop-shadow":[oo],ease:["in","out","in-out"],font:[eZ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[oo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[oo],shadow:[oo],spacing:["px",bn],text:[oo],"text-shadow":[oo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",el,It,Ut,b]}],container:["container"],columns:[{columns:[bn,It,Ut,o]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[tl,"auto",Ut,It]}],basis:[{basis:[el,"full","auto",o,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[bn,el,"auto","initial","none",It]}],grow:[{grow:["",bn,Ut,It]}],shrink:[{shrink:["",bn,Ut,It]}],order:[{order:[tl,"first","last","none",Ut,It]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mbs:[{mbs:K()}],mbe:[{mbe:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...O()]}],"min-inline-size":[{"min-inline":["auto",...O()]}],"max-inline-size":[{"max-inline":["none",...O()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[o,"screen",...Q()]}],"min-w":[{"min-w":[o,"screen","none",...Q()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[s]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,ih,lc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,lZ,nZ]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Bb,It]}],"font-family":[{font:[aZ,rZ,e]}],"font-features":[{"font-features":[It]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Ut,It]}],"line-clamp":[{"line-clamp":[bn,"none",Ut,aR]}],leading:[{leading:[a,...k()]}],"list-image":[{"list-image":["none",Ut,It]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ut,It]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Y()}],"text-color":[{text:Y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[bn,"from-font","auto",Ut,lc]}],"text-decoration-color":[{decoration:Y()}],"underline-offset":[{"underline-offset":[bn,"auto",Ut,It]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ut,It]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ut,It]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},tl,Ut,It],radial:["",Ut,It],conic:[tl,Ut,It]},oZ,iZ]}],"bg-color":[{bg:Y()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:Y()}],"gradient-via":[{via:Y()}],"gradient-to":[{to:Y()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-bs":[{"border-bs":ee()}],"border-w-be":[{"border-be":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:Y()}],"border-color-x":[{"border-x":Y()}],"border-color-y":[{"border-y":Y()}],"border-color-s":[{"border-s":Y()}],"border-color-e":[{"border-e":Y()}],"border-color-bs":[{"border-bs":Y()}],"border-color-be":[{"border-be":Y()}],"border-color-t":[{"border-t":Y()}],"border-color-r":[{"border-r":Y()}],"border-color-b":[{"border-b":Y()}],"border-color-l":[{"border-l":Y()}],"divide-color":[{divide:Y()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[bn,Ut,It]}],"outline-w":[{outline:["",bn,ih,lc]}],"outline-color":[{outline:Y()}],shadow:[{shadow:["","none",f,dg,ug]}],"shadow-color":[{shadow:Y()}],"inset-shadow":[{"inset-shadow":["none",h,dg,ug]}],"inset-shadow-color":[{"inset-shadow":Y()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Y()}],"ring-offset-w":[{"ring-offset":[bn,lc]}],"ring-offset-color":[{"ring-offset":Y()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":Y()}],"text-shadow":[{"text-shadow":["none",p,dg,ug]}],"text-shadow-color":[{"text-shadow":Y()}],opacity:[{opacity:[bn,Ut,It]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[bn]}],"mask-image-linear-from-pos":[{"mask-linear-from":Pe()}],"mask-image-linear-to-pos":[{"mask-linear-to":Pe()}],"mask-image-linear-from-color":[{"mask-linear-from":Y()}],"mask-image-linear-to-color":[{"mask-linear-to":Y()}],"mask-image-t-from-pos":[{"mask-t-from":Pe()}],"mask-image-t-to-pos":[{"mask-t-to":Pe()}],"mask-image-t-from-color":[{"mask-t-from":Y()}],"mask-image-t-to-color":[{"mask-t-to":Y()}],"mask-image-r-from-pos":[{"mask-r-from":Pe()}],"mask-image-r-to-pos":[{"mask-r-to":Pe()}],"mask-image-r-from-color":[{"mask-r-from":Y()}],"mask-image-r-to-color":[{"mask-r-to":Y()}],"mask-image-b-from-pos":[{"mask-b-from":Pe()}],"mask-image-b-to-pos":[{"mask-b-to":Pe()}],"mask-image-b-from-color":[{"mask-b-from":Y()}],"mask-image-b-to-color":[{"mask-b-to":Y()}],"mask-image-l-from-pos":[{"mask-l-from":Pe()}],"mask-image-l-to-pos":[{"mask-l-to":Pe()}],"mask-image-l-from-color":[{"mask-l-from":Y()}],"mask-image-l-to-color":[{"mask-l-to":Y()}],"mask-image-x-from-pos":[{"mask-x-from":Pe()}],"mask-image-x-to-pos":[{"mask-x-to":Pe()}],"mask-image-x-from-color":[{"mask-x-from":Y()}],"mask-image-x-to-color":[{"mask-x-to":Y()}],"mask-image-y-from-pos":[{"mask-y-from":Pe()}],"mask-image-y-to-pos":[{"mask-y-to":Pe()}],"mask-image-y-from-color":[{"mask-y-from":Y()}],"mask-image-y-to-color":[{"mask-y-to":Y()}],"mask-image-radial":[{"mask-radial":[Ut,It]}],"mask-image-radial-from-pos":[{"mask-radial-from":Pe()}],"mask-image-radial-to-pos":[{"mask-radial-to":Pe()}],"mask-image-radial-from-color":[{"mask-radial-from":Y()}],"mask-image-radial-to-color":[{"mask-radial-to":Y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[bn]}],"mask-image-conic-from-pos":[{"mask-conic-from":Pe()}],"mask-image-conic-to-pos":[{"mask-conic-to":Pe()}],"mask-image-conic-from-color":[{"mask-conic-from":Y()}],"mask-image-conic-to-color":[{"mask-conic-to":Y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ut,It]}],filter:[{filter:["","none",Ut,It]}],blur:[{blur:be()}],brightness:[{brightness:[bn,Ut,It]}],contrast:[{contrast:[bn,Ut,It]}],"drop-shadow":[{"drop-shadow":["","none",y,dg,ug]}],"drop-shadow-color":[{"drop-shadow":Y()}],grayscale:[{grayscale:["",bn,Ut,It]}],"hue-rotate":[{"hue-rotate":[bn,Ut,It]}],invert:[{invert:["",bn,Ut,It]}],saturate:[{saturate:[bn,Ut,It]}],sepia:[{sepia:["",bn,Ut,It]}],"backdrop-filter":[{"backdrop-filter":["","none",Ut,It]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[bn,Ut,It]}],"backdrop-contrast":[{"backdrop-contrast":[bn,Ut,It]}],"backdrop-grayscale":[{"backdrop-grayscale":["",bn,Ut,It]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[bn,Ut,It]}],"backdrop-invert":[{"backdrop-invert":["",bn,Ut,It]}],"backdrop-opacity":[{"backdrop-opacity":[bn,Ut,It]}],"backdrop-saturate":[{"backdrop-saturate":[bn,Ut,It]}],"backdrop-sepia":[{"backdrop-sepia":["",bn,Ut,It]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ut,It]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[bn,"initial",Ut,It]}],ease:[{ease:["linear","initial",_,Ut,It]}],delay:[{delay:[bn,Ut,It]}],animate:[{animate:["none",E,Ut,It]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Ut,It]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:Ye()}],"rotate-x":[{"rotate-x":Ye()}],"rotate-y":[{"rotate-y":Ye()}],"rotate-z":[{"rotate-z":Ye()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:Ue()}],"skew-x":[{"skew-x":Ue()}],"skew-y":[{"skew-y":Ue()}],transform:[{transform:[Ut,It,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],accent:[{accent:Y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ut,It]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ut,It]}],fill:[{fill:["none",...Y()]}],"stroke-w":[{stroke:[bn,ih,lc,aR]}],stroke:[{stroke:["none",...Y()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},dZ=HK(uZ);function yt(...t){return dZ(wK(t))}const fZ=m.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[m.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),m.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),m.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),m.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),hZ=m.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:m.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),pZ={google:fZ,github:hZ},mZ={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function gZ(t){return mZ[t]||String(t||"").replace(/-/g," ")}function yZ(){au();const{isOpen:t,closeLoginModal:e}=Sp(),{enabled:n,signedIn:r,refreshUser:i,signInWithPassword:a,signUp:s,signInWithOAuth:o,getPublicAuthConfig:c}=as(),[u,f]=x.useState("signin"),[h,p]=x.useState(""),[y,v]=x.useState(""),[w,b]=x.useState(""),[_,E]=x.useState(!1),[M,T]=x.useState(null),[R,A]=x.useState(null),[P,k]=x.useState(!1),[N,U]=x.useState(!0),[L,z]=x.useState([]),[F,V]=x.useState(8);x.useEffect(()=>{t&&(T(null),A(null),f("signin"),p(""),v(""),b(""),k(!1))},[t]),x.useEffect(()=>{if(!t||!n){U(!1);return}let O=!0;return(async()=>{const{data:G,error:Y}=await c();if(O){if(Y||!G)z(["google","github"]);else{const H=Array.isArray(G.oAuthProviders)?G.oAuthProviders:[],te=Array.isArray(G.customOAuthProviders)?G.customOAuthProviders:[];z([...H,...te]),typeof G.passwordMinLength=="number"&&G.passwordMinLength>0&&V(G.passwordMinLength)}U(!1)}})(),()=>{O=!1}},[t,n,c]),x.useEffect(()=>{t&&r&&e()},[t,r,e]);const W=x.useMemo(()=>typeof window>"u"?"":!!window.webkit?.messageHandlers?.nativeOAuth?`${window.location.origin}/auth/callback`:`${window.location.origin}/`,[]),K=x.useCallback(async O=>{T(null),E(!0);try{const{error:G}=await o(O,W);G&&T(G.message||String(G))}finally{E(!1)}},[o,W]),Q=x.useCallback(async O=>{O.preventDefault(),T(null),E(!0);try{if(u==="signup"){const{data:Y,error:H}=await s({email:h.trim(),password:y,name:w.trim()||void 0});if(H){T(H.message||String(H));return}if(Y?.requireEmailVerification){A(B("login.verify_email_pending")),f("signin");return}await i();return}const{error:G}=await a({email:h.trim(),password:y});if(G){T(G.message||String(G));return}await i()}finally{E(!1)}},[u,h,y,w,s,a,i]);return x.useEffect(()=>{if(!t)return;const O=G=>{G.key==="Escape"&&e()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[t,e]),n?m.jsx(Ap,{children:t&&m.jsxs(fr.div,{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[m.jsx(fr.div,{className:"absolute inset-0 bg-black/40 dark:bg-black/60 ",onClick:e,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}),m.jsxs(fr.div,{className:"relative w-full max-w-[420px] rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 p-6 shadow-2xl",initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{duration:.2},onClick:O=>O.stopPropagation(),children:[m.jsx("button",{type:"button",onClick:e,className:"absolute right-4 top-4 text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:m.jsx(Ck,{className:"h-5 w-5"})}),m.jsxs("div",{className:"text-center mb-6",children:[m.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[m.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),m.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white",children:"Token Tracker"})]}),m.jsx("p",{className:"text-sm text-oai-gray-500",children:B("login_modal.subtitle")})]}),R&&m.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:R}),M&&m.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",role:"alert",children:M}),m.jsx("div",{className:"space-y-2.5 mb-5",children:N?m.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900 animate-pulse"}):L.map(O=>m.jsxs("button",{type:"button",disabled:_,onClick:()=>K(O),className:yt("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[pZ[O]||null,B("login.oauth.continue",{provider:gZ(O)})]},O))}),P?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"relative mb-5",children:[m.jsx("div",{className:"absolute inset-0 flex items-center",children:m.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),m.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:m.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:B("login_modal.divider_email")})})]}),m.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[m.jsx("button",{type:"button",className:yt("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",u==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{f("signin"),T(null)},children:B("login.tab.sign_in")}),m.jsx("button",{type:"button",className:yt("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",u==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{f("signup"),T(null)},children:B("login.tab.sign_up")})]}),m.jsxs("form",{onSubmit:Q,className:"space-y-3",children:[u==="signup"&&m.jsxs("div",{children:[m.jsx("label",{htmlFor:"modal-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:B("login.field.name")}),m.jsx("input",{id:"modal-name",type:"text",autoComplete:"name",value:w,onChange:O=>b(O.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:B("login.field.name_placeholder")})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"modal-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:B("login.field.email")}),m.jsx("input",{id:"modal-email",type:"email",autoComplete:"email",required:!0,value:h,onChange:O=>p(O.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"modal-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:B("login.field.password")}),m.jsx("input",{id:"modal-password",type:"password",autoComplete:u==="signup"?"new-password":"current-password",required:!0,minLength:u==="signup"?F:void 0,value:y,onChange:O=>v(O.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),u==="signup"&&m.jsx("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:B("login.password_hint",{min:String(F)})})]}),m.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:B(u==="signup"?"login.submit.sign_up":"login.submit.sign_in")})]})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"relative mb-5",children:[m.jsx("div",{className:"absolute inset-0 flex items-center",children:m.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),m.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:m.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:B("login.divider")})})]}),m.jsxs("button",{type:"button",onClick:()=>k(!0),className:yt("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[m.jsx(V7,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),B("login_modal.continue_email")]})]})]})]})}):null}const vZ={VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function xZ(){if(typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"))return"";const e=typeof import.meta<"u"?vZ:void 0;return(e?.VITE_TOKENTRACKER_BACKEND_BASE_URL||e?.VITE_INSFORGE_BASE_URL||"").trim()}function zO(){return Yc()}function aE(t=""){if(typeof t!="string"||t.length===0)return!1;const e=new URLSearchParams(t),n=String(e.get("screenshot")||"").toLowerCase();return n==="1"||n==="true"}const bZ=300*1e3,_Z=720*60*1e3;function sE(t){return typeof t=="string"&&/^https?:\/\//i.test(t.trim())}function wZ(t,e=Date.now()){if(!t?.token||!t?.deviceId||!t?.issuedAt)return!0;const n=Date.parse(t.issuedAt);return Number.isFinite(n)?n+_Z<=e:!0}async function VO(t,e){const n=Yc();if(!sE(n)||!t)return;const r=n.replace(/\/$/,""),i=Ny(),a={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};i&&(a.apikey=i);try{await fetch(`${r}/functions/tokentracker-leaderboard-refresh`,{method:"POST",headers:a,body:JSON.stringify({period:"week",source:e})})}catch{}}async function SZ(t){const e=Yc();if(!sE(e)||!t)return null;const n=e.replace(/\/$/,""),r=Ny(),i={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};r&&(i.apikey=r);const a=typeof navigator<"u"&&typeof navigator.platform=="string"?navigator.platform:"web",s=await fetch(`${n}/functions/tokentracker-device-token-issue`,{method:"POST",headers:i,body:JSON.stringify({device_name:"Token Tracker (dashboard)",platform:a})});if(!s.ok)return null;const o=await s.json().catch(()=>null),c=typeof o?.token=="string"?o.token:null,u=typeof o?.device_id=="string"?o.device_id:null;return!c||!u?null:{token:c,deviceId:u,issuedAt:typeof o?.created_at=="string"?o.created_at:new Date().toISOString()}}async function lR(t){const{deviceToken:e,insforgeBaseUrl:n}=t,r={deviceToken:e},i=n||Yc();sE(i)&&(r.insforgeBaseUrl=i.trim());const a=await Fy(),s=await fetch("/functions/tokentracker-local-sync",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...a},body:JSON.stringify(r)}),o=await s.json().catch(()=>({}));if(!s.ok){const c=typeof o.error=="string"?o.error:`HTTP ${s.status}`;throw new Error(c)}return o}async function cR(t){const e=await t();if(!e)return null;const n=c3();if(n&&!wZ(n))return n;const r=await SZ(e);return r?(bH(r),r):null}async function HO(t){let e=await t();if(!e)return null;let n=await cR(async()=>e);if(!n)return e;try{return await lR({deviceToken:n.token,insforgeBaseUrl:Yc()}),e}catch(r){if(!c3()||(u3(),e=await t(),!e)||(n=await cR(async()=>e),!n))throw r;return await lR({deviceToken:n.token,insforgeBaseUrl:Yc()}),e}}async function kZ(t){const e=_H();if(Date.now()-e<bZ)return;const n=await HO(t);n&&(d3(Date.now()),await VO(n,"cloud-sync-auto"))}async function WO(t){const e=await HO(t);e&&(d3(Date.now()),await VO(e,"cloud-sync-now"))}function EZ(t){const e=t.replace(/\/+$/,"")||"/";return e==="/share"||e==="/share.html"||e.startsWith("/share/")}function MZ(t){const e=t.replace(/\/+$/,"")||"/";return e==="/login"||e==="/landing"||EZ(e)?!1:e==="/"||e==="/dashboard"||e.startsWith("/leaderboard")}function TZ(){const t=Hi(),e=as(),n=x.useRef(!1);x.useEffect(()=>{if(!o3()||!MZ(t.pathname||"/")||!e.enabled||!e.signedIn||e.loading||!gk())return;let r=!1;const i=window.setTimeout(()=>{(async()=>{if(!(r||n.current)){n.current=!0;try{await kZ(()=>e.getAccessToken())}catch(a){console.warn("[tokentracker] cloud usage sync:",a)}finally{n.current=!1}}})()},2500);return()=>{r=!0,window.clearTimeout(i)}},[t.pathname,e.enabled,e.signedIn,e.loading,e.getAccessToken])}const CZ="modulepreload",AZ=function(t){return"/"+t},uR={},GO=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let c=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=s?.nonce||s?.getAttribute("nonce");i=c(n.map(u=>{if(u=AZ(u),u in uR)return;uR[u]=!0;const f=u.endsWith(".css"),h=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${h}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":CZ,f||(p.as="script"),p.crossOrigin="",p.href=u,o&&p.setAttribute("nonce",o),document.head.appendChild(p),f)return new Promise((y,v)=>{p.addEventListener("load",y),p.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${u}`)))})}))}function a(s){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s}return i.then(s=>{for(const o of s||[])o.status==="rejected"&&a(o.reason);return e().catch(a)})};function RZ({baseUrl:t,accessToken:e,guestAllowed:n=!1,weeks:r=52,weekStartsOn:i="sun",cacheKey:a,timeZone:s,tzOffsetMinutes:o,now:c}={}){const u=x.useMemo(()=>vk({weeks:r,weekStartsOn:i,now:c}),[c,r,i]),[f,h]=x.useState([]),[p,y]=x.useState(null),[v,w]=x.useState("edge"),[b,_]=x.useState(!1),[E,M]=x.useState(null),T=br(),R=Ll(e),A=!n,P=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),k=x.useMemo(()=>{if(!a)return null;const V=Dy({timeZone:s,offsetMinutes:o});return`tokentracker.heatmap.${a}.${r}.${i}.${V}`},[a,s,o,r,i]),N=x.useCallback(()=>{if(!k||typeof window>"u")return null;try{const V=window.localStorage.getItem(k);if(!V)return null;const W=JSON.parse(V);return!W||!W.heatmap?null:W}catch{return null}},[k]),U=x.useCallback(V=>{if(!(!k||typeof window>"u"))try{window.localStorage.setItem(k,JSON.stringify(V))}catch{}},[k]),L=x.useCallback(()=>{if(!(!k||typeof window>"u"))try{window.localStorage.removeItem(k)}catch{}},[k]),z=x.useCallback(async()=>{const V=await Rl(e);if(!(!V&&!T&&!P)){_(!0),M(null);try{try{const O=await fW({baseUrl:t,accessToken:V,weeks:r,to:u.to,weekStartsOn:i,timeZone:s,tzOffsetMinutes:o}),G=Array.isArray(O?.weeks)?O.weeks:[];if(!G.length&&A){const H=N();if(H?.heatmap){y(H.heatmap),h(H.daily||[]),w("cache");return}}if(!G.some(H=>(Array.isArray(H)?H:[]).some(te=>te&&Number.isFinite(Number(te.level))))&&G.length){const H=[];for(const re of G)for(const ue of Array.isArray(re)?re:[])ue?.day&&H.push({day:ue.day,total_tokens:ue.total_tokens??ue.value??0,billable_total_tokens:ue.billable_total_tokens??ue.value??ue.total_tokens??0});const te=B0({dailyRows:H,weeks:r,to:O?.to||u.to,weekStartsOn:i});h(H),y({...te,week_starts_on:i,active_days:H.filter(re=>Number(re?.billable_total_tokens??re?.total_tokens)>0).length,streak_days:wh({dailyRows:H,to:O?.to||u.to})}),w("client"),A?U({heatmap:{...te,week_starts_on:i,active_days:H.filter(re=>Number(re?.billable_total_tokens??re?.total_tokens)>0).length,streak_days:wh({dailyRows:H,to:O?.to||u.to})},daily:H,fetchedAt:new Date().toISOString()}):L();return}y(O||null),h([]),w("edge"),O&&A?U({heatmap:O,daily:[],fetchedAt:new Date().toISOString()}):A||L();return}catch(O){const G=O,Y=G?.status??G?.statusCode;if(Y===401||Y===403)throw O}const W=await bk({baseUrl:t,accessToken:V,from:u.from,to:u.to,timeZone:s,tzOffsetMinutes:o}),K=Array.isArray(W?.data)?W.data:[];h(K);const Q=B0({dailyRows:K,weeks:r,to:u.to,weekStartsOn:i});y({...Q,week_starts_on:i,active_days:K.filter(O=>Number(O?.billable_total_tokens??O?.total_tokens)>0).length,streak_days:wh({dailyRows:K,to:u.to})}),w("client"),A?U({heatmap:{...Q,week_starts_on:i,active_days:K.filter(O=>Number(O?.billable_total_tokens??O?.total_tokens)>0).length,streak_days:wh({dailyRows:K,to:u.to})},daily:K,fetchedAt:new Date().toISOString()}):L()}catch(W){if(A){const K=N();if(K?.heatmap)y(K.heatmap),h(K.daily||[]),w("cache"),M(null);else{const Q=W;M(Q?.message||String(Q)),h([]),y(null),w("edge")}}else{const K=W;M(K?.message||String(K)),h([]),y(null),w("edge")}}finally{_(!1)}}},[e,t,T,n,A,u.from,u.to,N,R,s,o,i,r,L,U,P]);return x.useEffect(()=>{if(!R&&!n&&!T&&!P){h([]),_(!1),M(null),y(null),w("edge");return}if(!A)L(),h([]),M(null),y(null),w("edge");else{const V=N();V?.heatmap&&(y(V.heatmap),h(V.daily||[]),w("cache"))}z()},[e,T,N,z,R,n,A,L,P]),{range:u,daily:f,heatmap:p,source:T?"mock":v==="client"?"edge":v,loading:b,error:E,refresh:z}}function PZ({baseUrl:t,accessToken:e,limit:n=3,from:r,to:i,source:a,timeZone:s,tzOffsetMinutes:o}={}){const[c,u]=x.useState([]),[f,h]=x.useState(!1),[p,y]=x.useState(null),v=br(),w=Ll(e),b=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),_=x.useCallback(async()=>{const E=await Rl(e);if(!E&&!v&&!b){u([]),y(null),h(!1);return}h(!0),y(null);try{const M=await rW({baseUrl:t,accessToken:E,limit:n,from:r,to:i,source:a,timeZone:s,tzOffsetMinutes:o});u(Array.isArray(M?.entries)?M.entries:[])}catch(M){const T=M?.message||String(M);y(T),u([])}finally{h(!1)}},[e,t,r,n,v,a,s,i,o,b]);return x.useEffect(()=>{if(!w&&!v&&!b){u([]),y(null),h(!1);return}_()},[v,_,w,b]),{entries:c,loading:f,error:p,refresh:_}}const NZ=24;function DZ({baseUrl:t,accessToken:e,guestAllowed:n=!1,period:r,from:i,to:a,months:s=NZ,cacheKey:o,timeZone:c,tzOffsetMinutes:u,now:f,sharedRows:h,sharedRange:p}={}){const[y,v]=x.useState([]),[w,b]=x.useState(()=>({from:i,to:a})),[_,E]=x.useState("edge"),[M,T]=x.useState(null),[R,A]=x.useState(!1),[P,k]=x.useState(null),N=br(),U=Ll(e),L=!n,z=Array.isArray(h),F=p?.from||i,V=p?.to||a,W=x.useMemo(()=>r==="day"?"hourly":r==="total"?"monthly":"daily",[r]),K=(()=>{if(!o)return null;const re=LZ(t)||"default",ue=Dy({timeZone:c,offsetMinutes:u});if(W==="hourly")return`tokentracker.trend.${o}.${re}.hourly.${a||i||"day"}.${ue}`;if(W==="monthly")return`tokentracker.trend.${o}.${re}.monthly.${s}.${a||"today"}.${ue}`;const ce=`${i||""}.${a||""}`;return`tokentracker.trend.${o}.${re}.daily.${ce}.${ue}`})(),Q=x.useCallback(()=>{if(!K||typeof window>"u")return null;try{const re=window.localStorage.getItem(K);if(!re)return null;const ue=JSON.parse(re);return!ue||!Array.isArray(ue.rows)?null:ue}catch{return null}},[K]),O=x.useCallback(re=>{if(!(!K||typeof window>"u"))try{window.localStorage.setItem(K,JSON.stringify(re))}catch{}},[K]),G=x.useCallback(()=>{if(!(!K||typeof window>"u"))try{window.localStorage.removeItem(K)}catch{}},[K]),Y=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),H=x.useCallback(async()=>{if(z){v(Array.isArray(h)?h:[]),b({from:F,to:V}),E("shared"),T(null),A(!1),k(null);return}const re=await Rl(e);if(!(!re&&!N&&!Y)){A(!0),k(null);try{let ue;W==="hourly"?ue=await uW({baseUrl:t,accessToken:re,day:a||i,timeZone:c,tzOffsetMinutes:u}):W==="monthly"?ue=await dW({baseUrl:t,accessToken:re,months:s,to:a,timeZone:c,tzOffsetMinutes:u}):ue=await bk({baseUrl:t,accessToken:re,from:i,to:a,timeZone:c,tzOffsetMinutes:u});const ce=ue?.from||i||ue?.day||null,ee=ue?.to||a||ue?.day||null;let le=Array.isArray(ue?.data)?ue.data:[];W==="daily"?le=Vb(le,ce||i,ee||a,{timeZone:c,offsetMinutes:u,now:f}):W==="hourly"?le=Hb(le,{timeZone:c,offsetMinutes:u,now:f}):W==="monthly"&&(le=Wb(le,{timeZone:c,offsetMinutes:u,now:f}));const ve=new Date().toISOString();v(le),b({from:ce,to:ee}),E("edge"),T(ve),L?O({rows:le,from:ce,to:ee,mode:W,fetchedAt:ve}):G()}catch(ue){if(L){const ce=Q();if(ce?.rows){let ee=W==="daily"?Vb(ce.rows||[],ce.from||i,ce.to||a,{timeZone:c,offsetMinutes:u,now:f}):Array.isArray(ce.rows)?ce.rows:[];W==="hourly"?ee=Hb(ee,{timeZone:c,offsetMinutes:u,now:f}):W==="monthly"&&(ee=Wb(ee,{timeZone:c,offsetMinutes:u,now:f})),v(ee),b({from:ce.from||i,to:ce.to||a}),E("cache"),T(ce.fetchedAt||null),k(null)}else{v([]),b({from:i,to:a}),E("edge"),T(null);const ee=ue;k(ee?.message||String(ee))}}else{v([]),b({from:i,to:a}),E("edge"),T(null);const ce=ue;k(ce?.message||String(ce))}}finally{A(!1)}}},[e,t,i,N,n,L,W,s,Q,U,z,F,h,V,c,a,u,f,G,O,Y]);x.useEffect(()=>{if(z){v(Array.isArray(h)?h:[]),b({from:F,to:V}),E("shared"),T(null),A(!1),k(null);return}if(!U&&!n&&!N&&!Y){v([]),b({from:i,to:a}),k(null),A(!1),E("edge"),T(null);return}if(!L)G(),v([]),b({from:i,to:a}),k(null),E("edge"),T(null);else{const re=Q();if(re?.rows){let ue=W==="daily"?Vb(re.rows||[],re.from||i,re.to||a,{timeZone:c,offsetMinutes:u,now:f}):Array.isArray(re.rows)?re.rows:[];W==="hourly"?ue=Hb(ue,{timeZone:c,offsetMinutes:u,now:f}):W==="monthly"&&(ue=Wb(ue,{timeZone:c,offsetMinutes:u,now:f})),v(ue),b({from:re.from||i,to:re.to||a}),E("cache"),T(re.fetchedAt||null)}}H()},[e,N,Q,H,z,F,h,V,U,n,L,G,Y]);const te=N?"mock":_;return{rows:y,from:w.from||i,to:w.to||a,source:te,fetchedAt:M,loading:R,error:P,refresh:H}}function LZ(t){try{return new URL(t).host}catch{return null}}function zb(t){if(!t)return null;const e=String(t).trim(),n=e.split("-");if(n.length!==3)return null;const r=Number(n[0]),i=Number(n[1])-1,a=Number(n[2]);if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))return null;const s=new Date(Date.UTC(r,i,a));return Number.isFinite(s.getTime())&&Hn(s)===e?s:null}function IZ(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function Vb(t,e,n,{timeZone:r,offsetMinutes:i,now:a}={}){const s=zb(e),o=zb(n);if(!s||!o||o<s)return Array.isArray(t)?t:[];const c=a instanceof Date&&Number.isFinite(a.getTime())?a:new Date,u=yk({timeZone:r,offsetMinutes:i,date:c}),f=zb(u),h=f?f.getTime():c.getTime(),p=new Map;for(const v of t||[])v?.day&&p.set(v.day,v);const y=[];for(let v=s;v<=o;v=IZ(v,1)){const w=Hn(v),b=p.get(w),_=v.getTime()>h;if(b){y.push({...b,missing:!1,future:_});continue}y.push({day:w,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!_,future:_})}return y}function Hb(t,{timeZone:e,offsetMinutes:n,now:r}={}){if(!Array.isArray(t))return[];const i=$O({timeZone:e,offsetMinutes:n,now:r});return i?t.map(a=>{const s=a?.hour||a?.label||"",o=OZ(s);if(!o)return{...a,future:!1};const c=o.dayNum>i.dayNum||o.dayNum===i.dayNum&&o.slot>i.slot;return{...a,future:c}}):t}function Wb(t,{timeZone:e,offsetMinutes:n,now:r}={}){if(!Array.isArray(t))return[];const i=$O({timeZone:e,offsetMinutes:n,now:r});return i?t.map(a=>{const s=a?.month||a?.label||"",o=FZ(s);if(!o)return{...a,future:!1};const c=o.year>i.year||o.year===i.year&&o.month>i.month;return{...a,future:c}}):t}function $O({timeZone:t,offsetMinutes:e,now:n}={}){const r=n instanceof Date&&Number.isFinite(n.getTime())?n:new Date;if(t&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const p=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(r).reduce((E,M)=>(M.type&&M.value&&(E[M.type]=M.value),E),{}),y=Number(p.year),v=Number(p.month),w=Number(p.day),b=Number(p.hour),_=Number(p.minute);if(Number.isFinite(y)&&Number.isFinite(v)&&Number.isFinite(w)&&Number.isFinite(b)&&Number.isFinite(_)){const E=b*2+(_>=30?1:0);return{year:y,month:v,day:w,hour:b,minute:_,dayNum:y*1e4+v*100+w,slot:E}}}catch{}if(Number.isFinite(e)){const f=new Date(r.getTime()+e*60*1e3),h=f.getUTCFullYear(),p=f.getUTCMonth()+1,y=f.getUTCDate(),v=f.getUTCHours(),w=f.getUTCMinutes(),b=v*2+(w>=30?1:0);return{year:h,month:p,day:y,hour:v,minute:w,dayNum:h*1e4+p*100+y,slot:b}}const i=r.getFullYear(),a=r.getMonth()+1,s=r.getDate(),o=r.getHours(),c=r.getMinutes(),u=o*2+(c>=30?1:0);return{year:i,month:a,day:s,hour:o,minute:c,dayNum:i*1e4+a*100+s,slot:u}}function OZ(t){if(!t)return null;const e=String(t).trim(),[n,r]=e.split("T");if(!n||!r)return null;const i=n.split("-");if(i.length!==3)return null;const a=Number(i[0]),s=Number(i[1]),o=Number(i[2]);if(!Number.isFinite(a)||!Number.isFinite(s)||!Number.isFinite(o))return null;const c=r.split(":"),u=Number(c[0]),f=Number(c[1]);if(!Number.isFinite(u)||u<0||u>23||!Number.isFinite(f)||f<0||f>59)return null;const h=u*2+(f>=30?1:0);return{dayNum:a*1e4+s*100+o,slot:h}}function FZ(t){if(!t)return null;const n=String(t).trim().split("-");if(n.length!==2)return null;const r=Number(n[0]),i=Number(n[1]);return!Number.isFinite(r)||!Number.isFinite(i)||i<1||i>12?null:{year:r,month:i}}function dR({baseUrl:t,accessToken:e,guestAllowed:n=!1,from:r,to:i,includeDaily:a=!0,cacheKey:s,timeZone:o,tzOffsetMinutes:c,now:u}={}){const[f,h]=x.useState([]),[p,y]=x.useState(null),[v,w]=x.useState(null),[b,_]=x.useState("edge"),[E,M]=x.useState(null),[T,R]=x.useState(!1),[A,P]=x.useState(null),k=br(),N=Ll(e),U=!n,L=(()=>{if(!s)return null;const O=UZ(t)||"default",G=a?"daily":"summary",Y=Dy({timeZone:o,offsetMinutes:c});return`tokentracker.usage.${s}.${O}.${r}.${i}.${G}.${Y}`})(),z=x.useCallback(()=>{if(!L||typeof window>"u")return null;try{const O=window.localStorage.getItem(L);if(!O)return null;const G=JSON.parse(O);return!G||!G.summary?null:G}catch{return null}},[L]),F=x.useCallback(O=>{if(!(!L||typeof window>"u"))try{window.localStorage.setItem(L,JSON.stringify(O))}catch{}},[L]),V=x.useCallback(()=>{if(!(!L||typeof window>"u"))try{window.localStorage.removeItem(L)}catch{}},[L]),W=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),K=x.useCallback(async()=>{const O=await Rl(e);if(!(!O&&!k&&!W)){R(!0),P(null);try{let G=null,Y=null;if(a){const[ce,ee]=await Promise.allSettled([bk({baseUrl:t,accessToken:O,from:r,to:i,timeZone:o,tzOffsetMinutes:c}),xb({baseUrl:t,accessToken:O,from:r,to:i,timeZone:o,tzOffsetMinutes:c,rolling:!0})]);if(ce.status==="rejected")throw ce.reason;G=ce.value,Y=ee.status==="fulfilled"?ee.value:null}else Y=await xb({baseUrl:t,accessToken:O,from:r,to:i,timeZone:o,tzOffsetMinutes:c,rolling:!0});let H=a&&Array.isArray(G?.data)?G.data:[];a&&(H=$b(H,r,i,{timeZone:o,offsetMinutes:c,now:u}));let te=Y?.totals||G?.summary?.totals||null,re=Y?.rolling||G?.summary?.rolling||null;if(a&&!te&&!Y)try{const ce=await xb({baseUrl:t,accessToken:O,from:r,to:i,timeZone:o,tzOffsetMinutes:c,rolling:!0});te=ce?.totals||null,re=ce?.rolling||re}catch{}const ue=new Date().toISOString();h(H),y(te),w(re),_("edge"),M(ue),te&&U?F({summary:te,rolling:re,daily:H,from:r,to:i,includeDaily:a,fetchedAt:ue}):U||V()}catch(G){if(U){const Y=z();if(Y?.summary){y(Y.summary),w(Y.rolling||null);const H=Array.isArray(Y.daily)?Y.daily:[],te=a?$b(H,Y.from||r,Y.to||i,{timeZone:o,offsetMinutes:c,now:u}):H;h(te),_("cache"),M(Y.fetchedAt||null),P(null)}else{const H=G;P(H?.message||String(H)),h([]),y(null),w(null),_("edge"),M(null)}}else{const Y=G;P(Y?.message||String(Y)),h([]),y(null),w(null),_("edge"),M(null)}}finally{R(!1)}}},[e,t,r,a,k,n,U,u,z,N,o,i,c,V,F,W]);return x.useEffect(()=>{const O=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");if(!N&&!n&&!k&&!O){h([]),y(null),w(null),P(null),R(!1),_("edge"),M(null);return}if(!U)V(),h([]),y(null),w(null),P(null),_("edge"),M(null);else{const G=z();if(G?.summary){y(G.summary),w(G.rolling||null);const Y=Array.isArray(G.daily)?G.daily:[],H=a?$b(Y,G.from||r,G.to||i,{timeZone:o,offsetMinutes:c,now:u}):Y;h(H),_("cache"),M(G.fetchedAt||null)}}K()},[e,k,z,K,N,n,U,V,W]),{daily:f,summary:p,rolling:v,source:k?"mock":b,fetchedAt:E,loading:T,error:A,refresh:K}}function UZ(t){try{return new URL(t).host}catch{return null}}function Gb(t){if(!t)return null;const e=String(t).trim(),n=e.split("-");if(n.length!==3)return null;const r=Number(n[0]),i=Number(n[1])-1,a=Number(n[2]);if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))return null;const s=new Date(Date.UTC(r,i,a));return Number.isFinite(s.getTime())&&Hn(s)===e?s:null}function jZ(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function $b(t,e,n,{timeZone:r,offsetMinutes:i,now:a}={}){const s=Gb(e),o=Gb(n);if(!s||!o||o<s)return Array.isArray(t)?t:[];const c=a instanceof Date&&Number.isFinite(a.getTime())?a:new Date,u=yk({timeZone:r,offsetMinutes:i,date:c}),f=Gb(u),h=f?f.getTime():c.getTime(),p=new Map;for(const v of t||[])v?.day&&p.set(v.day,v);const y=[];for(let v=s;v<=o;v=jZ(v,1)){const w=Hn(v),b=p.get(w),_=v.getTime()>h;if(b){y.push({...b,missing:!1,future:_});continue}y.push({day:w,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!_,future:_})}return y}function YO(t){const[e,n]=x.useState(null),[r,i]=x.useState(null),[a,s]=x.useState(!0),o=!!t?.initialRefresh,c=x.useCallback(async()=>{try{const u=await C2({refresh:!0});n(u&&typeof u=="object"?u:null),i(null)}catch(u){i(u?.message||String(u))}},[]);return x.useEffect(()=>{let u=!1;return(async()=>{try{const f=await C2(o?{refresh:!0}:{});if(u)return;n(f&&typeof f=="object"?f:null),i(null)}catch(f){if(u)return;i(f?.message||String(f))}finally{u||s(!1)}})(),()=>{u=!0}},[o]),{data:e,error:r,isLoading:a,refresh:c}}function BZ({baseUrl:t,accessToken:e,guestAllowed:n=!1,from:r,to:i,cacheKey:a,timeZone:s,tzOffsetMinutes:o}={}){const[c,u]=x.useState(null),[f,h]=x.useState("edge"),[p,y]=x.useState(!1),[v,w]=x.useState(null),b=br(),_=Ll(e),E=!n,M=x.useMemo(()=>{if(!a)return null;const U=zZ(t)||"default",L=Dy({timeZone:s,offsetMinutes:o});return`tokentracker.modelBreakdown.${a}.${U}.${r}.${i}.${L}`},[t,a,r,s,i,o]),T=x.useCallback(()=>{if(!M||typeof window>"u")return null;try{const U=window.localStorage.getItem(M);if(!U)return null;const L=JSON.parse(U);return!L||!L.breakdown?null:L}catch{return null}},[M]),R=x.useCallback(U=>{if(!(!M||typeof window>"u"))try{window.localStorage.setItem(M,JSON.stringify(U))}catch{}},[M]),A=x.useCallback(()=>{if(!(!M||typeof window>"u"))try{window.localStorage.removeItem(M)}catch{}},[M]),P=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),k=x.useCallback(async()=>{const U=await Rl(e);if(!(!U&&!b&&!P)){y(!0),w(null);try{const L=await cW({baseUrl:t,accessToken:U,from:r,to:i,timeZone:s,tzOffsetMinutes:o});u(L||null),h("edge"),L&&E?R({breakdown:L,fetchedAt:new Date().toISOString()}):E||A()}catch(L){if(E){const z=T();if(z?.breakdown)u(z.breakdown),h("cache"),w(null);else{u(null),h("edge");const F=L;w(F?.message||String(F))}}else{u(null),h("edge");const z=L;w(z?.message||String(z))}}finally{y(!1)}}},[e,t,r,b,n,E,T,s,i,_,o,A,R,P]);return x.useEffect(()=>{if(!_&&!n&&!b&&!P){u(null),h("edge"),w(null),y(!1);return}if(!E)A(),u(null),h("edge"),w(null);else{const U=T();U?.breakdown&&(u(U.breakdown),h("cache"))}k()},[e,b,T,k,_,n,E,A,P]),{breakdown:c,source:b?"mock":f,loading:p,error:v,refresh:k}}function zZ(t){try{return new URL(t).host}catch{return null}}const qO=new Set(["day","hour","month"]);function VZ(t){return qO.has(t)}function fR(t){if(t==null)return null;const e=String(t).trim();if(!/^[0-9]+$/.test(e))return null;const n=e.replace(/^0+/,"");return n.length===0?"0":n}function HZ(t,e){const n=fR(t),r=fR(e);if(n&&r)return n.length!==r.length?n.length<r.length?-1:1:n===r?0:n<r?-1:1;const i=ti(t),a=ti(e);return i==null&&a==null?0:i==null?1:a==null?-1:i===a?0:i<a?-1:1}function WZ(t,e){const n=typeof t=="string"?t:String(t||""),r=typeof e=="string"?e:String(e||"");return n===r?0:n<r?-1:1}function GZ(t){if(!t)return null;const n=String(t).trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!n)return null;const r=Number(n[1]),i=Number(n[2]),a=Number(n[3]);if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))return null;const s=new Date(Date.UTC(r,i-1,a));return!Number.isFinite(s.getTime())||s.getUTCFullYear()!==r||s.getUTCMonth()+1!==i||s.getUTCDate()!==a?null:s.getTime()}function $Z(t){if(!t)return null;const n=String(t).trim().match(/^(\d{4})-(\d{2})$/);if(!n)return null;const r=Number(n[1]),i=Number(n[2]);if(!Number.isFinite(r)||!Number.isFinite(i)||i<1||i>12)return null;const a=new Date(Date.UTC(r,i-1,1));return Number.isFinite(a.getTime())?a.getTime():null}function YZ(t){if(!t)return null;const n=String(t).trim().match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?Z?$/);if(!n)return null;const r=Number(n[1]),i=Number(n[2]),a=Number(n[3]),s=Number(n[4]),o=Number(n[5]),c=Number(n[6]||0);if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(s)||!Number.isFinite(o)||!Number.isFinite(c)||i<1||i>12||a<1||a>31||s<0||s>23||o<0||o>59||c<0||c>59)return null;const u=new Date(Date.UTC(r,i-1,a,s,o,c));return Number.isFinite(u.getTime())?u.getTime():null}function qZ(t,e,n){const r=n==="hour"?YZ:n==="month"?$Z:GZ,i=r(t),a=r(e);return i!=null&&a!=null?i===a?0:i<a?-1:1:WZ(t,e)}function XO(t,{key:e,dir:n}){const r=n==="asc"?1:-1,i=Array.isArray(t)?t:[],a=qO.has(e)?(o,c)=>qZ(o,c,e):HZ,s=o=>e==="total_tokens"&&o?.billable_total_tokens!=null?o.billable_total_tokens:o?.[e];return i.map((o,c)=>({row:o,index:c})).sort((o,c)=>{const u=s(o.row),f=s(c.row),h=u==null,p=f==null;if(h&&p)return o.index-c.index;if(h)return 1;if(p)return-1;const y=a(u,f);return y!==0?y*r:o.index-c.index}).map(o=>o.row)}function XZ(){return[{key:"day",label:B("daily.sort.date.label"),title:B("daily.sort.date.title")},{key:"total_tokens",label:B("daily.sort.total.label"),title:B("daily.sort.total.title")},{key:"input_tokens",label:B("daily.sort.input.label"),title:B("daily.sort.input.title")},{key:"output_tokens",label:B("daily.sort.output.label"),title:B("daily.sort.output.title")},{key:"cached_input_tokens",label:B("daily.sort.cached.label"),title:B("daily.sort.cached.title")},{key:"reasoning_output_tokens",label:B("daily.sort.reasoning.label"),title:B("daily.sort.reasoning.title")},{key:"conversation_count",label:B("daily.sort.conversations.label"),title:B("daily.sort.conversations.title")}]}function hR(t){const e=VZ(t)?t:"day";return XZ().map((n,r)=>r===0?{...n,key:e}:n)}function pR(t,{key:e,dir:n}){return XO(t,{key:e,dir:n})}const ny=12,KZ=["total_tokens","billable_total_tokens","input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens"];function ZZ(t){if(typeof t=="bigint")return t!==0n;if(typeof t=="number")return Number.isFinite(t)&&t!==0;if(t==null)return!1;const e=String(t).trim();if(!e||!/^-?\d+$/.test(e))return!1;const n=e.startsWith("-")?e.slice(1):e;return/[1-9]/.test(n)}function JZ(t){return KZ.some(e=>ZZ(t?.[e]))}function QZ(t){const e=Array.isArray(t)?t:[];if(!e.length)return[];const n=XO(e,{key:"month",dir:"asc"}),r=n.findIndex(i=>i?.month&&JZ(i));return r===-1?e:n.slice(r)}function eJ(t,e,n=ny){const r=Array.isArray(t)?t:[],i=Number.isFinite(n)&&n>0?n:ny,s=(Number.isFinite(e)&&e>=0?Math.floor(e):0)*i;return r.slice(s,s+i)}function tJ({publicMode:t,screenshotMode:e,forceInstall:n,accessEnabled:r,heatmapLoading:i,activeDays:a,hasActiveDeviceToken:s}={}){return t||e?!1:n?!0:r&&!i&&a===0&&!s}function KO(t){if(typeof t!="string")return null;const e=t.trim();return e?e.toLowerCase():null}function nJ(t){const e=KO(t?.model_id);return e||null}function ZO(t,e){return t?.model?String(t.model):e}function rJ(t,{copyFn:e}={}){const n=typeof e=="function"?e:s=>s,i=(Array.isArray(t?.sources)?t.sources:[]).map(s=>{const o=ti(s?.totals?.billable_total_tokens??s?.totals?.total_tokens)??0,c=ti(s?.totals?.total_cost_usd)??0;return{source:s?.source,totalTokens:Number.isFinite(o)?o:0,totalCost:Number.isFinite(c)?c:0,models:Array.isArray(s?.models)?s.models:[]}}).filter(s=>s.totalTokens>0);if(!i.length)return[];const a=i.reduce((s,o)=>s+o.totalTokens,0);return typeof t?.pricing?.pricing_mode=="string"&&t.pricing.pricing_mode.toUpperCase(),i.slice().sort((s,o)=>o.totalTokens-s.totalTokens).map(s=>{const o=s.source?String(s.source).toUpperCase():n("shared.placeholder.short"),c=a>0?s.totalTokens/a*100:0,u=Number.isFinite(c)?c.toFixed(1):"0.0",f=s.models.map(h=>{const p=ti(h?.totals?.billable_total_tokens??h?.totals?.total_tokens)??0;if(!Number.isFinite(p)||p<=0)return null;const y=s.totalTokens>0?Math.round(p/s.totalTokens*1e3)/10:0,v=ZO(h,n("shared.placeholder.short")),w=nJ(h),b=s.totalCost>0&&s.totalTokens>0?p/s.totalTokens*s.totalCost:null;return{id:w,name:v,share:y,usage:p,cost:b}}).filter(Boolean);return{label:o,totalPercent:String(u),usd:s.totalCost,usage:s.totalTokens,models:f}})}function iJ(t,{limit:e=3,copyFn:n}={}){const r=typeof n=="function"?n:p=>p,i=Array.isArray(t?.sources)?t.sources:[];if(!i.length)return[];const a=new Map,s=new Map,o=new Map;let c=0;for(const p of i){const y=Array.isArray(p?.models)?p.models:[];for(const v of y){const w=ti(v?.totals?.billable_total_tokens)??0;if(!Number.isFinite(w)||w<=0)continue;c+=w;const b=ZO(v,r("shared.placeholder.short")),_=KO(b);if(!_)continue;a.set(_,(a.get(_)||0)+w);const E=o.get(_)||0;w>=E&&(o.set(_,w),s.set(_,b))}}if(!a.size)return[];const u=Array.from(a.values()).reduce((p,y)=>p+y,0),f=c>0?c:u,h=Number.isFinite(e)?Math.max(0,Math.floor(e)):3;return Array.from(a.entries()).map(([p,y])=>{const v=f>0?(y/f*100).toFixed(1):"0.0";return{id:p,name:s.get(p)||r("shared.placeholder.short"),tokens:y,percent:String(v)}}).sort((p,y)=>y.tokens!==p.tokens?y.tokens-p.tokens:String(p.name).localeCompare(String(y.name))).slice(0,h)}function qy(){return typeof window<"u"}function Fl(t){return oE(t)?(t.nodeName||"").toLowerCase():"#document"}function Ar(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function qs(t){var e;return(e=(oE(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function oE(t){return qy()?t instanceof Node||t instanceof Ar(t).Node:!1}function Kn(t){return qy()?t instanceof Element||t instanceof Ar(t).Element:!1}function Tr(t){return qy()?t instanceof HTMLElement||t instanceof Ar(t).HTMLElement:!1}function d1(t){return!qy()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ar(t).ShadowRoot}function lu(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ca(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function aJ(t){return/^(table|td|th)$/.test(Fl(t))}function Xy(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const sJ=/transform|translate|scale|rotate|perspective|filter/,oJ=/paint|layout|strict|content/,cc=t=>!!t&&t!=="none";let Yb;function lE(t){const e=Kn(t)?ca(t):t;return cc(e.transform)||cc(e.translate)||cc(e.scale)||cc(e.rotate)||cc(e.perspective)||!Ky()&&(cc(e.backdropFilter)||cc(e.filter))||sJ.test(e.willChange||"")||oJ.test(e.contain||"")}function lJ(t){let e=Ro(t);for(;Tr(e)&&!ko(e);){if(lE(e))return e;if(Xy(e))return null;e=Ro(e)}return null}function Ky(){return Yb==null&&(Yb=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Yb}function ko(t){return/^(html|body|#document)$/.test(Fl(t))}function ca(t){return Ar(t).getComputedStyle(t)}function Zy(t){return Kn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ro(t){if(Fl(t)==="html")return t;const e=t.assignedSlot||t.parentNode||d1(t)&&t.host||qs(t);return d1(e)?e.host:e}function JO(t){const e=Ro(t);return ko(e)?t.ownerDocument?t.ownerDocument.body:t.body:Tr(e)&&lu(e)?e:JO(e)}function kl(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=JO(t),a=i===((r=t.ownerDocument)==null?void 0:r.body),s=Ar(i);if(a){const o=f1(s);return e.concat(s,s.visualViewport||[],lu(i)?i:[],o&&n?kl(o):[])}else return e.concat(i,kl(i,[],n))}function f1(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const mR={};function Vi(t,e){const n=x.useRef(mR);return n.current===mR&&(n.current=t(e)),n}const qb=zS[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],cJ=qb&&qb!==x.useLayoutEffect?qb:t=>t();function jt(t){const e=Vi(uJ).current;return e.next=t,cJ(e.effect),e.trampoline}function uJ(){const t={next:void 0,callback:dJ,trampoline:(...e)=>t.callback?.(...e),effect:()=>{t.callback=t.next}};return t}function dJ(){}const fJ=()=>{},Yt=typeof document<"u"?x.useLayoutEffect:fJ;function h1(t,e){if(t&&!e)return t;if(!t&&e)return e;if(t||e)return{...t,...e}}const Oh={};function Jy(t,e,n,r,i){let a={...p1(t,Oh)};return e&&(a=kh(a,e)),n&&(a=kh(a,n)),r&&(a=kh(a,r)),i&&(a=kh(a,i)),a}function hJ(t){if(t.length===0)return Oh;if(t.length===1)return p1(t[0],Oh);let e={...p1(t[0],Oh)};for(let n=1;n<t.length;n+=1)e=kh(e,t[n]);return e}function kh(t,e){return QO(e)?e(t):pJ(t,e)}function pJ(t,e){if(!e)return t;for(const n in e){const r=e[n];switch(n){case"style":{t[n]=h1(t.style,r);break}case"className":{t[n]=e4(t.className,r);break}default:mJ(n,r)?t[n]=gJ(t[n],r):t[n]=r}}return t}function mJ(t,e){const n=t.charCodeAt(0),r=t.charCodeAt(1),i=t.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof e=="function"||typeof e>"u")}function QO(t){return typeof t=="function"}function p1(t,e){return QO(t)?t(e):t??Oh}function gJ(t,e){return e?t?n=>{if(yJ(n)){const i=n;m1(i);const a=e(i);return i.baseUIHandlerPrevented||t?.(i),a}const r=e(n);return t?.(n),r}:e:t}function m1(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function e4(t,e){return e?t?e+" "+t:e:t}function yJ(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function Wi(t,...e){const n=new URL("https://base-ui.com/production-error");return n.searchParams.set("code",t.toString()),e.forEach(r=>n.searchParams.append("args[]",r)),`Base UI error #${t}; visit ${n} for the full message.`}const vJ=x.createContext(void 0);function xJ(t=!1){const e=x.useContext(vJ);if(e===void 0&&!t)throw new Error(Wi(16));return e}function bJ(t){const{focusableWhenDisabled:e,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=t,s=r&&e!==!1,o=r&&e===!1;return{props:x.useMemo(()=>{const u={onKeyDown(f){n&&e&&f.key!=="Tab"&&f.preventDefault()}};return r||(u.tabIndex=i,!a&&n&&(u.tabIndex=e?i:-1)),(a&&(e||s)||!a&&n)&&(u["aria-disabled"]=n),a&&(!e||o)&&(u.disabled=n),u},[r,n,e,s,o,a,i])}}function Qy(t={}){const{disabled:e=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=t,a=x.useRef(null),s=xJ(!0)!==void 0,o=jt(()=>{const p=a.current;return!!(p?.tagName==="A"&&p?.href)}),{props:c}=bJ({focusableWhenDisabled:n,disabled:e,composite:s,tabIndex:r,isNativeButton:i}),u=x.useCallback(()=>{const p=a.current;_J(p)&&s&&e&&c.disabled===void 0&&p.disabled&&(p.disabled=!1)},[e,c.disabled,s]);Yt(u,[u]);const f=x.useCallback((p={})=>{const{onClick:y,onMouseDown:v,onKeyUp:w,onKeyDown:b,onPointerDown:_,...E}=p;return Jy({type:i?"button":void 0,onClick(T){if(e){T.preventDefault();return}y?.(T)},onMouseDown(T){e||v?.(T)},onKeyDown(T){if(e||(m1(T),b?.(T)),T.baseUIHandlerPrevented)return;const R=T.target===T.currentTarget&&!i&&!o()&&!e,A=T.key==="Enter",P=T.key===" ";R&&((P||A)&&T.preventDefault(),A&&y?.(T))},onKeyUp(T){e||(m1(T),w?.(T)),!T.baseUIHandlerPrevented&&T.target===T.currentTarget&&!i&&!e&&T.key===" "&&y?.(T)},onPointerDown(T){if(e){T.preventDefault();return}_?.(T)}},i?void 0:{role:"button"},c,E)},[e,c,i,o]),h=jt(p=>{a.current=p,u()});return{getButtonProps:f,buttonRef:h}}function _J(t){return Tr(t)&&t.tagName==="BUTTON"}function Fd(t,e,n,r){const i=Vi(t4).current;return SJ(i,t,e,n,r)&&n4(i,[t,e,n,r]),i.callback}function wJ(t){const e=Vi(t4).current;return kJ(e,t)&&n4(e,t),e.callback}function t4(){return{callback:null,cleanup:null,refs:[]}}function SJ(t,e,n,r,i){return t.refs[0]!==e||t.refs[1]!==n||t.refs[2]!==r||t.refs[3]!==i}function kJ(t,e){return t.refs.length!==e.length||t.refs.some((n,r)=>n!==e[r])}function n4(t,e){if(t.refs=e,e.every(n=>n==null)){t.callback=null;return}t.callback=n=>{if(t.cleanup&&(t.cleanup(),t.cleanup=null),n!=null){const r=Array(e.length).fill(null);for(let i=0;i<e.length;i+=1){const a=e[i];if(a!=null)switch(typeof a){case"function":{const s=a(n);typeof s=="function"&&(r[i]=s);break}case"object":{a.current=n;break}}}t.cleanup=()=>{for(let i=0;i<e.length;i+=1){const a=e[i];if(a!=null)switch(typeof a){case"function":{const s=r[i];typeof s=="function"?s():a(null);break}case"object":{a.current=null;break}}}}}}}const EJ=parseInt(x.version,10);function cE(t){return EJ>=t}function gR(t){if(!x.isValidElement(t))return null;const e=t,n=e.props;return(cE(19)?n?.ref:e.ref)??null}function MJ(t,e){const n={};for(const r in t){const i=t[r];if(e?.hasOwnProperty(r)){const a=e[r](i);a!=null&&Object.assign(n,a);continue}i===!0?n[`data-${r.toLowerCase()}`]="":i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function TJ(t,e){return typeof t=="function"?t(e):t}function CJ(t,e){return typeof t=="function"?t(e):t}function sa(){}const g1=Object.freeze([]),ei=Object.freeze({}),AJ=500,RJ={style:{transition:"none"}},r4="data-base-ui-click-trigger",PJ={fallbackAxisSide:"none"},NJ={fallbackAxisSide:"end"},DJ={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function Xr(t,e,n={}){const r=e.render,i=LJ(e,n);if(n.enabled===!1)return null;const a=n.state??ei;return IJ(t,r,i,a)}function LJ(t,e={}){const{className:n,style:r,render:i}=t,{state:a=ei,ref:s,props:o,stateAttributesMapping:c,enabled:u=!0}=e,f=u?TJ(n,a):void 0,h=u?CJ(r,a):void 0,p=u?MJ(a,c):ei,y=u?h1(p,Array.isArray(o)?hJ(o):o)??ei:ei;return typeof document<"u"&&(u?Array.isArray(s)?y.ref=wJ([y.ref,gR(i),...s]):y.ref=Fd(y.ref,gR(i),s):Fd(null,null)),u?(f!==void 0&&(y.className=e4(y.className,f)),h!==void 0&&(y.style=h1(y.style,h)),y):ei}function IJ(t,e,n,r){if(e){if(typeof e=="function")return e(n,r);const i=Jy(n,e.props);return i.ref=n.ref,x.cloneElement(e,i)}if(t&&typeof t=="string")return OJ(t,n);throw new Error(Wi(8))}function OJ(t,e){return t==="button"?x.createElement("button",{type:"button",...e,key:e.key}):t==="img"?x.createElement("img",{alt:"",...e,key:e.key}):x.createElement(t,e)}function Pp(){const t=x.useContext(I3);if(t===null)throw new Error("useTheme must be used within a ThemeProvider");return t}const uc=12,ah=3,Xb=26,FJ=["#ecfdf5","#a7f3d0","#6ee7b7","#34d399","#10b981"],UJ=["#064e3b","#065f46","#059669","#10b981","#34d399"],jJ=[B("heatmap.month.jan"),B("heatmap.month.feb"),B("heatmap.month.mar"),B("heatmap.month.apr"),B("heatmap.month.may"),B("heatmap.month.jun"),B("heatmap.month.jul"),B("heatmap.month.aug"),B("heatmap.month.sep"),B("heatmap.month.oct"),B("heatmap.month.nov"),B("heatmap.month.dec")];function BJ(t){if(typeof t=="bigint")return t.toLocaleString();if(typeof t=="number")return Number.isFinite(t)?Math.round(t).toLocaleString():"0";if(typeof t=="string"){const e=Number(t);return Number.isFinite(e)?Math.round(e).toLocaleString():t}return"0"}function zJ(t){if(typeof t!="string")return null;const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t.trim());if(!e)return null;const n=new Date(Date.UTC(Number(e[1]),Number(e[2])-1,Number(e[3])));return Number.isFinite(n.getTime())?n:null}function i4(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function VJ(t,e){return Math.floor((Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()))/864e5)}function HJ(t,e){const n=e==="mon"?1:0,r=t.getUTCDay();return i4(t,-((r-n+7)%7))}function WJ(t,e,n){if(!t)return[];const r=zJ(e)||new Date,i=[];for(let u=11;u>=0;u-=1)i.push(new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth()-u,1)));const a=HJ(r,n),s=i4(a,-(t-1)*7),o=[],c=new Set;for(const u of i){const f=Math.floor(VJ(s,u)/7);f<0||f>=t||c.has(f)||(c.add(f),o.push({label:jJ[u.getUTCMonth()],index:f}))}return o}function GJ({heatmap:t,timeZoneLabel:e,timeZoneShortLabel:n,hideLegend:r=!1}){const{resolvedTheme:i}=Pp(),s=i==="dark"?UJ:FJ,o=x.useRef(null);x.useEffect(()=>{const v=o.current;v&&(v.scrollLeft=v.scrollWidth)},[t?.weeks]);const c=t?.week_starts_on==="mon"?"mon":"sun",u=x.useMemo(()=>{const v=Array.isArray(t?.weeks)?t.weeks:[];if(!v.length)return{weeks:[]};const w=[];for(const b of v)for(const _ of Array.isArray(b)?b:[])_?.day&&w.push({day:_.day,total_tokens:_.total_tokens??_.value??0,billable_total_tokens:_.billable_total_tokens??_.value??_.total_tokens??0});return B0({dailyRows:w,weeks:Math.max(52,v.length),to:t?.to,weekStartsOn:c})},[t?.to,t?.weeks,c]),f=u?.weeks||[],h=c==="mon"?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(v=>B(`heatmap.day.${v.toLowerCase()}`)):["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(v=>B(`heatmap.day.${v.toLowerCase()}`)),p=x.useMemo(()=>WJ(f.length,u?.to,c),[u?.to,f.length,c]);if(!f.length)return m.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:B("heatmap.empty")});const y=Xb+f.length*uc+Math.max(0,f.length-1)*ah;return m.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[m.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[m.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:B("heatmap.title")}),m.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400",children:n||B("heatmap.legend.utc")})]}),m.jsx("div",{ref:o,className:"overflow-x-auto overflow-y-hidden heatmap-scroll-thin",children:m.jsxs("div",{style:{minWidth:y},children:[m.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:`${Xb}px repeat(${f.length}, ${uc}px)`,columnGap:ah},children:[m.jsx("span",{}),p.map(v=>m.jsx("span",{style:{gridColumnStart:v.index+2},className:"whitespace-nowrap",children:v.label},`${v.label}-${v.index}`))]}),m.jsxs("div",{className:"grid",style:{gridTemplateColumns:`${Xb}px repeat(${f.length}, ${uc}px)`,columnGap:ah},children:[m.jsx("div",{className:"grid text-[10px] text-oai-gray-400 dark:text-oai-gray-400 sticky left-0 bg-white dark:bg-oai-gray-900 pr-2",style:{gridTemplateRows:`repeat(7, ${uc}px)`,rowGap:ah},children:h.map(v=>m.jsx("span",{className:"leading-none",children:v},v))}),m.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${uc}px)`,gap:ah},children:f.map((v,w)=>(Array.isArray(v)?v:[]).map((b,_)=>{if(!b)return null;const E=b.day||`e-${w}-${_}`,M=Number(b.level)||0,T=s[M]||s[0],R=e||n||B("heatmap.legend.utc");return m.jsx("span",{title:B("heatmap.tooltip",{day:b.day,value:BJ(b.value),unit:B("heatmap.unit.tokens"),tz:R}),className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10",style:{width:uc,height:uc,background:T}},E)}))})]})]})}),!r&&m.jsxs("div",{className:"flex items-center justify-center gap-2 mt-3",children:[m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:B("heatmap.legend.less")}),m.jsx("div",{className:"flex gap-0.5",children:s.map((v,w)=>m.jsx("span",{className:"rounded-[1px]",style:{width:10,height:10,background:v}},w))}),m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:B("heatmap.legend.more")})]})]})}const a4={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},uE={...a4,position:"fixed",top:0,left:0},$J={...a4,position:"absolute"};function YJ(t){const e=x.useRef(!0);e.current&&(e.current=!1,t())}function yR({controlled:t,default:e,name:n,state:r="value"}){const{current:i}=x.useRef(t!==void 0),[a,s]=x.useState(e),o=i?t:a,c=x.useCallback(u=>{i||s(u)},[]);return[o,c]}function Fr(t){const e=Vi(qJ,t).current;return e.next=t,Yt(e.effect),e}function qJ(t){const e={current:t,next:t,effect:()=>{e.current=e.next}};return e}var ry=Symbol("NOT_FOUND");function XJ(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function KJ(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function ZJ(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var vR=t=>Array.isArray(t)?t:[t];function JJ(t){const e=Array.isArray(t[0])?t[0]:t;return ZJ(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function QJ(t,e){const n=[],{length:r}=t;for(let i=0;i<r;i++)n.push(t[i].apply(null,e));return n}function eQ(t){let e;return{get(n){return e&&t(e.key,n)?e.value:ry},put(n,r){e={key:n,value:r}},getEntries(){return e?[e]:[]},clear(){e=void 0}}}function tQ(t,e){let n=[];function r(o){const c=n.findIndex(u=>e(o,u.key));if(c>-1){const u=n[c];return c>0&&(n.splice(c,1),n.unshift(u)),u.value}return ry}function i(o,c){r(o)===ry&&(n.unshift({key:o,value:c}),n.length>t&&n.pop())}function a(){return n}function s(){n=[]}return{get:r,put:i,getEntries:a,clear:s}}var nQ=(t,e)=>t===e;function rQ(t){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:i}=n;for(let a=0;a<i;a++)if(!t(n[a],r[a]))return!1;return!0}}function iQ(t,e){const n=typeof e=="object"?e:{equalityCheck:e},{equalityCheck:r=nQ,maxSize:i=1,resultEqualityCheck:a}=n,s=rQ(r);let o=0;const c=i<=1?eQ(s):tQ(i,s);function u(){let f=c.get(arguments);if(f===ry){if(f=t.apply(null,arguments),o++,a){const p=c.getEntries().find(y=>a(y.value,f));p&&(f=p.value,o!==0&&o--)}c.put(arguments,f)}return f}return u.clearCache=()=>{c.clear(),u.resetResultsCount()},u.resultsCount=()=>o,u.resetResultsCount=()=>{o=0},u}var aQ=class{constructor(t){this.value=t}deref(){return this.value}},sQ=typeof WeakRef<"u"?WeakRef:aQ,oQ=0,xR=1;function fg(){return{s:oQ,v:void 0,o:null,p:null}}function s4(t,e={}){let n=fg();const{resultEqualityCheck:r}=e;let i,a=0;function s(){let o=n;const{length:c}=arguments;for(let h=0,p=c;h<p;h++){const y=arguments[h];if(typeof y=="function"||typeof y=="object"&&y!==null){let v=o.o;v===null&&(o.o=v=new WeakMap);const w=v.get(y);w===void 0?(o=fg(),v.set(y,o)):o=w}else{let v=o.p;v===null&&(o.p=v=new Map);const w=v.get(y);w===void 0?(o=fg(),v.set(y,o)):o=w}}const u=o;let f;if(o.s===xR)f=o.v;else if(f=t.apply(null,arguments),a++,r){const h=i?.deref?.()??i;h!=null&&r(h,f)&&(f=h,a!==0&&a--),i=typeof f=="object"&&f!==null||typeof f=="function"?new sQ(f):f}return u.s=xR,u.v=f,f}return s.clearCache=()=>{n=fg(),s.resetResultsCount()},s.resultsCount=()=>a,s.resetResultsCount=()=>{a=0},s}function o4(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let a=0,s=0,o,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),XJ(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const f={...n,...c},{memoize:h,memoizeOptions:p=[],argsMemoize:y=s4,argsMemoizeOptions:v=[]}=f,w=vR(p),b=vR(v),_=JJ(i),E=h(function(){return a++,u.apply(null,arguments)},...w),M=y(function(){s++;const R=QJ(_,arguments);return o=E.apply(null,R),o},...b);return Object.assign(M,{resultFunc:u,memoizedResultFunc:E,dependencies:_,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>o,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:h,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var lQ=o4(s4),cQ=Object.assign((t,e=lQ)=>{KJ(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(a=>t[a]);return e(r,(...a)=>a.reduce((s,o,c)=>(s[n[c]]=o,s),{}))},{withTypes:()=>cQ});o4({memoize:iQ,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const At=(t,e,n,r,i,a,...s)=>{if(s.length>0)throw new Error(Wi(1));let o;if(t)o=t;else throw new Error("Missing arguments");return o};var Kb={exports:{}},Zb={};var bR;function uQ(){if(bR)return Zb;bR=1;var t=hp();function e(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue;function o(h,p){var y=p(),v=r({inst:{value:y,getSnapshot:p}}),w=v[0].inst,b=v[1];return a(function(){w.value=y,w.getSnapshot=p,c(w)&&b({inst:w})},[h,y,p]),i(function(){return c(w)&&b({inst:w}),h(function(){c(w)&&b({inst:w})})},[h]),s(y),y}function c(h){var p=h.getSnapshot;h=h.value;try{var y=p();return!n(h,y)}catch{return!0}}function u(h,p){return p()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:o;return Zb.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Zb}var _R;function l4(){return _R||(_R=1,Kb.exports=uQ()),Kb.exports}var dQ=l4(),Jb={exports:{}},Qb={};var wR;function fQ(){if(wR)return Qb;wR=1;var t=hp(),e=l4();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,a=t.useRef,s=t.useEffect,o=t.useMemo,c=t.useDebugValue;return Qb.useSyncExternalStoreWithSelector=function(u,f,h,p,y){var v=a(null);if(v.current===null){var w={hasValue:!1,value:null};v.current=w}else w=v.current;v=o(function(){function _(A){if(!E){if(E=!0,M=A,A=p(A),y!==void 0&&w.hasValue){var P=w.value;if(y(P,A))return T=P}return T=A}if(P=T,r(M,A))return P;var k=p(A);return y!==void 0&&y(P,k)?(M=A,P):(M=A,T=k)}var E=!1,M,T,R=h===void 0?null:h;return[function(){return _(f())},R===null?void 0:function(){return _(R())}]},[f,h,p,y]);var b=i(u,v[0],v[1]);return s(function(){w.hasValue=!0,w.value=b},[b]),c(b),b},Qb}var SR;function hQ(){return SR||(SR=1,Jb.exports=fQ()),Jb.exports}var pQ=hQ();const mQ=cE(19),gQ=mQ?yQ:vQ;function mn(t,e,n,r,i){return gQ(t,e,n,r,i)}function yQ(t,e,n,r,i){const a=x.useCallback(()=>e(t.getSnapshot(),n,r,i),[t,e,n,r,i]);return dQ.useSyncExternalStore(t.subscribe,a,a)}function vQ(t,e,n,r,i){return pQ.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getSnapshot,a=>e(a,n,r,i))}class Ed{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(e)}}update(e){for(const n in e)if(!Object.is(this.state[n],e[n])){Ed.prototype.setState.call(this,{...this.state,...e});return}}set(e,n){Object.is(this.state[e],n)||Ed.prototype.setState.call(this,{...this.state,[e]:n})}notifyAll(){const e={...this.state};Ed.prototype.setState.call(this,e)}}class dE extends Ed{constructor(e,n={},r){super(e),this.context=n,this.selectors=r}controlledValues=new Map;useSyncedValue(e,n){x.useDebugValue(e),Yt(()=>{this.state[e]!==n&&this.set(e,n)},[e,n])}useSyncedValueWithCleanup(e,n){const r=this;Yt(()=>(r.state[e]!==n&&r.set(e,n),()=>{r.set(e,void 0)}),[r,e,n])}useSyncedValues(e){const n=this,r=Object.values(e);Yt(()=>{n.update(e)},[n,...r])}useControlledProp(e,n,r){x.useDebugValue(e);const i=this,a=n!==void 0;this.controlledValues.has(e)||(this.controlledValues.set(e,a),!a&&!Object.is(this.state[e],r)&&super.setState({...this.state,[e]:r})),Yt(()=>{a&&!Object.is(i.state[e],n)&&super.setState({...i.state,[e]:n})},[i,e,n,r,a])}set(e,n){this.controlledValues.get(e)!==!0&&super.set(e,n)}update(e){const n={...e};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.update(n)}setState(e){const n={...e};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.setState({...this.state,...n})}select=(e,n,r,i)=>{const a=this.selectors[e];return a(this.state,n,r,i)};useState=(e,n,r,i)=>{x.useDebugValue(e);const a=this.selectors[e];return mn(this,a,n,r,i)};useContextCallback(e,n){x.useDebugValue(e);const r=jt(n??sa);this.context[e]=r}useStateSetter(e){const n=x.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(e,r)}),n.current}observe(e,n){let r;typeof e=="function"?r=e:r=this.selectors[e];let i=r(this.state);return n(i,i,this),this.subscribe(a=>{const s=r(a);if(!Object.is(i,s)){const o=i;i=s,n(s,o,this)}})}}const xQ=[];function fE(t){x.useEffect(t,xQ)}const hg=null;class bQ{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let i=0;i<n.length;i+=1)n[i]?.(e)};request(e){const n=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(e){const n=e-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const pg=new bQ;class Ss{static create(){return new Ss}static request(e){return pg.request(e)}static cancel(e){return pg.cancel(e)}currentId=hg;request(e){this.cancel(),this.currentId=pg.request(()=>{this.currentId=hg,e()})}cancel=()=>{this.currentId!==hg&&(pg.cancel(this.currentId),this.currentId=hg)};disposeEffect=()=>this.cancel}function ev(){const t=Vi(Ss.create).current;return fE(t.disposeEffect),t}const sh=0;class Nl{static create(){return new Nl}currentId=sh;start(e,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=sh,n()},e)}isStarted(){return this.currentId!==sh}clear=()=>{this.currentId!==sh&&(clearTimeout(this.currentId),this.currentId=sh)};disposeEffect=()=>this.clear}function ji(){const t=Vi(Nl.create).current;return fE(t.disposeEffect),t}const rf=typeof navigator<"u",e_=SQ(),c4=EQ(),u4=kQ(),d4=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),f4=e_.platform==="MacIntel"&&e_.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(e_.platform),_Q=rf&&/apple/i.test(navigator.vendor),y1=rf&&/android/i.test(c4)||/android/i.test(u4);rf&&c4.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const wQ=u4.includes("jsdom/");function SQ(){if(!rf)return{platform:"",maxTouchPoints:-1};const t=navigator.userAgentData;return t?.platform?{platform:t.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function kQ(){if(!rf)return"";const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:e,version:n})=>`${e}/${n}`).join(" "):navigator.userAgent}function EQ(){if(!rf)return"";const t=navigator.userAgentData;return t?.platform?t.platform:navigator.platform??""}const v1="data-base-ui-focusable",h4="active",p4="selected",m4="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",El="ArrowLeft",Ml="ArrowRight",hE="ArrowUp",Np="ArrowDown";function gl(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function On(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&d1(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Fi(t){return"composedPath"in t?t.composedPath()[0]:t.target}function za(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function MQ(t){return t.matches("html,body")}function Mr(t){return t?.ownerDocument||document}function g4(t){return Tr(t)&&t.matches(m4)}function x1(t){return t?t.getAttribute("role")==="combobox"&&g4(t):!1}function tp(t){return t?t.hasAttribute(v1)?t:t.querySelector(`[${v1}]`)||t:null}function Uc(t,e,n=!0){return t.filter(i=>i.parentId===e&&(!n||i.context?.open)).flatMap(i=>[i,...Uc(t,i.id,n)])}function kR(t,e){let n=[],r=t.find(i=>i.id===e)?.parentId;for(;r;){const i=t.find(a=>a.id===r);r=i?.parentId,i&&(n=n.concat(i))}return n}function pi(t){t.preventDefault(),t.stopPropagation()}function TQ(t){return"nativeEvent"in t}function y4(t){return t.mozInputSource===0&&t.isTrusted?!0:y1&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function v4(t){return wQ?!1:!y1&&t.width===0&&t.height===0||y1&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function Ud(t,e){const n=["mouse","pen"];return e||n.push("",void 0),n.includes(t)}function x4(t){const e=t.type;return e==="click"||e==="mousedown"||e==="keydown"||e==="keyup"}const CQ=["top","right","bottom","left"],jd=Math.min,ia=Math.max,iy=Math.round,wd=Math.floor,Ds=t=>({x:t,y:t}),AQ={left:"right",right:"left",bottom:"top",top:"bottom"};function b1(t,e,n){return ia(t,jd(e,n))}function Po(t,e){return typeof t=="function"?t(e):t}function Bi(t){return t.split("-")[0]}function Ul(t){return t.split("-")[1]}function pE(t){return t==="x"?"y":"x"}function mE(t){return t==="y"?"height":"width"}function Ma(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function gE(t){return pE(Ma(t))}function RQ(t,e,n){n===void 0&&(n=!1);const r=Ul(t),i=gE(t),a=mE(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(s=ay(s)),[s,ay(s)]}function PQ(t){const e=ay(t);return[_1(t),e,_1(e)]}function _1(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const ER=["left","right"],MR=["right","left"],NQ=["top","bottom"],DQ=["bottom","top"];function LQ(t,e,n){switch(t){case"top":case"bottom":return n?e?MR:ER:e?ER:MR;case"left":case"right":return e?NQ:DQ;default:return[]}}function IQ(t,e,n,r){const i=Ul(t);let a=LQ(Bi(t),n==="start",r);return i&&(a=a.map(s=>s+"-"+i),e&&(a=a.concat(a.map(_1)))),a}function ay(t){const e=Bi(t);return AQ[e]+t.slice(e.length)}function OQ(t){return{top:0,right:0,bottom:0,left:0,...t}}function b4(t){return typeof t!="number"?OQ(t):{top:t,right:t,bottom:t,left:t}}function sy(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function mg(t,e,n){return Math.floor(t/e)!==n}function Fh(t,e){return e<0||e>=t.current.length}function t_(t,e){return fi(t,{disabledIndices:e})}function TR(t,e){return fi(t,{decrement:!0,startingIndex:t.current.length,disabledIndices:e})}function fi(t,{startingIndex:e=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=e;do a+=n?-i:i;while(a>=0&&a<=t.current.length-1&&Uh(t,a,r));return a}function FQ(t,{event:e,orientation:n,loopFocus:r,rtl:i,cols:a,disabledIndices:s,minIndex:o,maxIndex:c,prevIndex:u,stopEvent:f=!1}){let h=u;const p=[],y={};let v=!1;{let _=null,E=-1;t.current.forEach((M,T)=>{if(M==null)return;const R=M.closest('[role="row"]');R&&(v=!0),(R!==_||E===-1)&&(_=R,E+=1,p[E]=[]),p[E].push(T),y[T]=E})}const w=v&&p.length>0&&p.some(_=>_.length!==a);function b(_){if(!w||u===-1)return;const E=y[u];if(E==null)return;const M=p[E].indexOf(u);let T=_==="up"?E-1:E+1;r&&(T<0?T=p.length-1:T>=p.length&&(T=0));const R=new Set;for(;T>=0&&T<p.length&&!R.has(T);){R.add(T);const A=p[T];if(A.length===0){T=_==="up"?T-1:T+1;continue}const P=Math.min(M,A.length-1);for(let k=P;k>=0;k-=1){const N=A[k];if(!Uh(t,N,s))return N}T=_==="up"?T-1:T+1,r&&(T<0?T=p.length-1:T>=p.length&&(T=0))}}if(e.key===hE){const _=b("up");if(_!==void 0)f&&pi(e),h=_;else{if(f&&pi(e),u===-1)h=c;else if(h=fi(t,{startingIndex:h,amount:a,decrement:!0,disabledIndices:s}),r&&(u-a<o||h<0)){const E=u%a,M=c%a,T=c-(M-E);M===E?h=c:h=M>E?T:T-a}Fh(t,h)&&(h=u)}}if(e.key===Np){const _=b("down");_!==void 0?(f&&pi(e),h=_):(f&&pi(e),u===-1?h=o:(h=fi(t,{startingIndex:u,amount:a,disabledIndices:s}),r&&u+a>c&&(h=fi(t,{startingIndex:u%a-a,amount:a,disabledIndices:s}))),Fh(t,h)&&(h=u))}if(n==="both"){const _=wd(u/a);e.key===(i?El:Ml)&&(f&&pi(e),u%a!==a-1?(h=fi(t,{startingIndex:u,disabledIndices:s}),r&&mg(h,a,_)&&(h=fi(t,{startingIndex:u-u%a-1,disabledIndices:s}))):r&&(h=fi(t,{startingIndex:u-u%a-1,disabledIndices:s})),mg(h,a,_)&&(h=u)),e.key===(i?Ml:El)&&(f&&pi(e),u%a!==0?(h=fi(t,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&mg(h,a,_)&&(h=fi(t,{startingIndex:u+(a-u%a),decrement:!0,disabledIndices:s}))):r&&(h=fi(t,{startingIndex:u+(a-u%a),decrement:!0,disabledIndices:s})),mg(h,a,_)&&(h=u));const E=wd(c/a)===_;Fh(t,h)&&(r&&E?h=e.key===(i?Ml:El)?c:fi(t,{startingIndex:u-u%a-1,disabledIndices:s}):h=u)}return h}function UQ(t,e,n){const r=[];let i=0;return t.forEach(({width:a,height:s},o)=>{let c=!1;for(n&&(i=0);!c;){const u=[];for(let f=0;f<a;f+=1)for(let h=0;h<s;h+=1)u.push(i+f+h*e);i%e+a<=e&&u.every(f=>r[f]==null)?(u.forEach(f=>{r[f]=o}),c=!0):i+=1}}),[...r]}function jQ(t,e,n,r,i){if(t===-1)return-1;const a=n.indexOf(t),s=e[t];switch(i){case"tl":return a;case"tr":return s?a+s.width-1:a;case"bl":return s?a+(s.height-1)*r:a;case"br":return n.lastIndexOf(t);default:return-1}}function BQ(t,e){return e.flatMap((n,r)=>t.includes(n)?[r]:[])}function Uh(t,e,n){if(typeof n=="function")return n(e);if(n)return n.includes(e);const r=t.current[e];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}var zQ=["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] *)"],oy=zQ.join(","),_4=typeof Element>"u",Bd=_4?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ly=!_4&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},cy=function(e,n){var r;n===void 0&&(n=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),a=i===""||i==="true",s=a||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):cy(e.parentNode));return s},VQ=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},w4=function(e,n,r){if(cy(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(oy));return n&&Bd.call(e,oy)&&i.unshift(e),i=i.filter(r),i},uy=function(e,n,r){for(var i=[],a=Array.from(e);a.length;){var s=a.shift();if(!cy(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),c=o.length?o:s.children,u=uy(c,!0,r);r.flatten?i.push.apply(i,u):i.push({scopeParent:s,candidates:u})}else{var f=Bd.call(s,oy);f&&r.filter(s)&&(n||!e.includes(s))&&i.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!cy(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&p){var y=uy(h===!0?s.children:h.children,!0,r);r.flatten?i.push.apply(i,y):i.push({scopeParent:s,candidates:y})}else a.unshift.apply(a,s.children)}}return i},S4=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},k4=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||VQ(e))&&!S4(e)?0:e.tabIndex},HQ=function(e,n){var r=k4(e);return r<0&&n&&!S4(e)?0:r},WQ=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},E4=function(e){return e.tagName==="INPUT"},GQ=function(e){return E4(e)&&e.type==="hidden"},$Q=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},YQ=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},qQ=function(e){if(!e.name)return!0;var n=e.form||ly(e),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(e.name));else try{i=r(e.name)}catch(s){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",s.message),!1}var a=YQ(i,e.form);return!a||a===e},XQ=function(e){return E4(e)&&e.type==="radio"},KQ=function(e){return XQ(e)&&!qQ(e)},ZQ=function(e){var n,r=e&&ly(e),i=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==e){var s,o,c;for(a=!!((s=i)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(i)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!a&&i;){var u,f,h;r=ly(i),i=(u=r)===null||u===void 0?void 0:u.host,a=!!((f=i)!==null&&f!==void 0&&(h=f.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return a},CR=function(e){var n=e.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},JQ=function(e,n){var r=n.displayCheck,i=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var a=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!a}if(getComputedStyle(e).visibility==="hidden")return!0;var s=Bd.call(e,"details>summary:first-of-type"),o=s?e.parentElement:e;if(Bd.call(o,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof i=="function"){for(var c=e;e;){var u=e.parentElement,f=ly(e);if(u&&!u.shadowRoot&&i(u)===!0)return CR(e);e.assignedSlot?e=e.assignedSlot:!u&&f!==e.ownerDocument?e=f.host:e=u}e=c}if(ZQ(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return CR(e);return!1},QQ=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return Bd.call(n,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}n=n.parentElement}return!1},w1=function(e,n){return!(n.disabled||GQ(n)||JQ(n,e)||$Q(n)||QQ(n))},S1=function(e,n){return!(KQ(n)||k4(n)<0||!w1(e,n))},eee=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},M4=function(e){var n=[],r=[];return e.forEach(function(i,a){var s=!!i.scopeParent,o=s?i.scopeParent:i,c=HQ(o,s),u=s?M4(i.candidates):o;c===0?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:a,tabIndex:c,item:i,isScope:s,content:u})}),r.sort(WQ).reduce(function(i,a){return a.isScope?i.push.apply(i,a.content):i.push(a.content),i},[]).concat(n)},Dp=function(e,n){n=n||{};var r;return n.getShadowRoot?r=uy([e],n.includeContainer,{filter:S1.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:eee}):r=w4(e,n.includeContainer,S1.bind(null,n)),M4(r)},tee=function(e,n){n=n||{};var r;return n.getShadowRoot?r=uy([e],n.includeContainer,{filter:w1.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=w4(e,n.includeContainer,w1.bind(null,n)),r},T4=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return Bd.call(e,oy)===!1?!1:S1(n,e)};const af=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function C4(t,e){const n=Dp(t,af()),r=n.length;if(r===0)return;const i=gl(Mr(t)),a=n.indexOf(i),s=a===-1?e===1?0:r-1:a+e;return n[s]}function yE(t){return C4(Mr(t).body,1)||t}function A4(t){return C4(Mr(t).body,-1)||t}function R4(t,e){if(!t)return null;const n=Dp(Mr(t).body,af()),r=n.length;if(r===0)return null;const i=n.indexOf(t);if(i===-1)return null;const a=(i+e+r)%r;return n[a]}function nee(t){return R4(t,1)}function ree(t){return R4(t,-1)}function Md(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!On(n,r)}function iee(t){Dp(t,af()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function AR(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const aee={...zS};let RR=0;function see(t,e="mui"){const[n,r]=x.useState(t),i=t||n;return x.useEffect(()=>{n==null&&(RR+=1,r(`${e}-${RR}`))},[n,e]),i}const PR=aee.useId;function sf(t,e){if(PR!==void 0){const n=PR();return t??(e?`${e}-${n}`:n)}return see(t,e)}function P4(){const t=new Map;return{emit(e,n){t.get(e)?.forEach(r=>r(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){t.get(e)?.delete(n)}}}class oee{nodesRef={current:[]};events=P4();addNode(e){this.nodesRef.current.push(e)}removeNode(e){const n=this.nodesRef.current.findIndex(r=>r===e);n!==-1&&this.nodesRef.current.splice(n,1)}}const N4=x.createContext(null),D4=x.createContext(null),jl=()=>x.useContext(N4)?.id||null,cu=t=>{const e=x.useContext(D4);return t??e};function lee(t){const e=sf(),n=cu(t),r=jl();return Yt(()=>{if(!e)return;const i={id:e,parentId:r};return n?.addNode(i),()=>{n?.removeNode(i)}},[n,e,r]),e}function cee(t){const{children:e,id:n}=t,r=jl();return m.jsx(N4.Provider,{value:x.useMemo(()=>({id:n,parentId:r}),[n,r]),children:e})}function uee(t){const{children:e,externalTree:n}=t,r=Vi(()=>n??new oee).current;return m.jsx(D4.Provider,{value:r,children:e})}const tv="none",Tl="trigger-press",aa="trigger-hover",vE="outside-press",n_="item-press",dee="close-press",Kc="focus-out",L4="escape-key",r_="list-navigation",fee="cancel-open",I4="imperative-action",hee="window-resize";function Mn(t,e,n,r){let i=!1,a=!1;const s=ei;return{reason:t,event:e??new Event("base-ui"),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...s}}function np(t){return`data-base-ui-${t}`}function i_(t,e,n){if(n&&!Ud(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function zs(t){return t?.ownerDocument||document}const zd=x.forwardRef(function(e,n){const[r,i]=x.useState();Yt(()=>{_Q&&i("button")},[]);const a={tabIndex:0,role:r};return m.jsx("span",{...e,ref:n,style:uE,"aria-hidden":r?void 0:!0,...a,"data-base-ui-focus-guard":""})});let NR=0;function g0(t,e={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=e;r&&cancelAnimationFrame(NR);const a=()=>t?.focus({preventScroll:n});i?a():NR=requestAnimationFrame(a)}const Td={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function DR(t){return t==="inert"?Td.inert:t==="aria-hidden"?Td["aria-hidden"]:Td.none}let gg=new WeakSet,yg={},a_=0;const O4=t=>t&&(t.host||O4(t.parentNode)),pee=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=O4(n);return t.contains(r)?r:null}).filter(n=>n!=null);function mee(t,e,n,r){const i="data-base-ui-inert",a=r?"inert":n?"aria-hidden":null,s=pee(e,t),o=new Set,c=new Set(s),u=[];yg[i]||(yg[i]=new WeakMap);const f=yg[i];s.forEach(h),p(e),o.clear();function h(y){!y||o.has(y)||(o.add(y),y.parentNode&&h(y.parentNode))}function p(y){!y||c.has(y)||[].forEach.call(y.children,v=>{if(Fl(v)!=="script")if(o.has(v))p(v);else{const w=a?v.getAttribute(a):null,b=w!==null&&w!=="false",_=DR(a),E=(_.get(v)||0)+1,M=(f.get(v)||0)+1;_.set(v,E),f.set(v,M),u.push(v),E===1&&b&&gg.add(v),M===1&&v.setAttribute(i,""),!b&&a&&v.setAttribute(a,a==="inert"?"":"true")}})}return a_+=1,()=>{u.forEach(y=>{const v=DR(a),b=(v.get(y)||0)-1,_=(f.get(y)||0)-1;v.set(y,b),f.set(y,_),b||(!gg.has(y)&&a&&y.removeAttribute(a),gg.delete(y)),_||y.removeAttribute(i)}),a_-=1,a_||(Td.inert=new WeakMap,Td["aria-hidden"]=new WeakMap,Td.none=new WeakMap,gg=new WeakSet,yg={})}}function gee(t,e=!1,n=!1){const r=Mr(t[0]).body;return mee(t.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,e,n)}const F4=x.createContext(null),U4=()=>x.useContext(F4),yee=np("portal");function vee(t={}){const{ref:e,container:n,componentProps:r=ei,elementProps:i,elementState:a}=t,s=sf(),c=U4()?.portalNode,[u,f]=x.useState(null),[h,p]=x.useState(null),y=jt(_=>{_!==null&&p(_)}),v=x.useRef(null);Yt(()=>{if(n===null){v.current&&(v.current=null,p(null),f(null));return}if(s==null)return;const _=(n&&(oE(n)?n:n.current))??c??document.body;if(_==null){v.current&&(v.current=null,p(null),f(null));return}v.current!==_&&(v.current=_,p(null),f(_))},[n,c,s]);const w=Xr("div",r,{ref:[e,y],state:a,props:[{id:s,[yee]:""},i]});return{portalNode:h,portalSubtree:u&&w?gi.createPortal(w,u):null}}const xE=x.forwardRef(function(e,n){const{children:r,container:i,className:a,render:s,renderGuards:o,...c}=e,{portalNode:u,portalSubtree:f}=vee({container:i,ref:n,componentProps:e,elementProps:c}),h=x.useRef(null),p=x.useRef(null),y=x.useRef(null),v=x.useRef(null),[w,b]=x.useState(null),_=w?.modal,E=w?.open,M=typeof o=="boolean"?o:!!w&&!w.modal&&w.open&&!!u;x.useEffect(()=>{if(!u||_)return;function R(A){u&&A.relatedTarget&&Md(A)&&(A.type==="focusin"?AR:iee)(u)}return u.addEventListener("focusin",R,!0),u.addEventListener("focusout",R,!0),()=>{u.removeEventListener("focusin",R,!0),u.removeEventListener("focusout",R,!0)}},[u,_]),x.useEffect(()=>{!u||E||AR(u)},[E,u]);const T=x.useMemo(()=>({beforeOutsideRef:h,afterOutsideRef:p,beforeInsideRef:y,afterInsideRef:v,portalNode:u,setFocusManagerState:b}),[u]);return m.jsxs(x.Fragment,{children:[f,m.jsxs(F4.Provider,{value:T,children:[M&&u&&m.jsx(zd,{"data-type":"outside",ref:h,onFocus:R=>{if(Md(R,u))y.current?.focus();else{const A=w?w.domReference:null;A4(A)?.focus()}}}),M&&u&&m.jsx("span",{"aria-owns":u.id,style:DJ}),u&&gi.createPortal(r,u),M&&u&&m.jsx(zd,{"data-type":"outside",ref:p,onFocus:R=>{if(Md(R,u))v.current?.focus();else{const A=w?w.domReference:null;yE(A)?.focus(),w?.closeOnFocusOut&&w?.onOpenChange(!1,Mn(Kc,R.nativeEvent))}}})]})]})});function go(t){return t==null?t:"current"in t?t.current:t}function xee(t,e){const n=Ar(t.target);return t instanceof n.KeyboardEvent?"keyboard":t instanceof n.FocusEvent?e||"keyboard":"pointerType"in t?t.pointerType||"keyboard":"touches"in t?"touch":t instanceof n.MouseEvent?e||(t.detail===0?"keyboard":"mouse"):""}const LR=20;let bl=[];function bE(){bl=bl.filter(t=>t.isConnected)}function bee(t){bE(),t&&Fl(t)!=="body"&&(bl.push(t),bl.length>LR&&(bl=bl.slice(-LR)))}function s_(){return bE(),bl[bl.length-1]}function _ee(t){if(!t)return null;const e=af();return T4(t,e)?t:Dp(t,e)[0]||t}function wee(t){return!t||!t.isConnected?!1:typeof t.checkVisibility=="function"?t.checkVisibility():ca(t).display!=="none"}function IR(t,e){if(!e.current.includes("floating")&&!t.getAttribute("role")?.includes("dialog"))return;const n=af(),i=tee(t,n).filter(s=>{const o=s.getAttribute("data-tabindex")||"";return T4(s,n)||s.hasAttribute("data-tabindex")&&!o.startsWith("-")}),a=t.getAttribute("tabindex");e.current.includes("floating")||i.length===0?a!=="0"&&t.setAttribute("tabindex","0"):(a!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}function _E(t){const{context:e,children:n,disabled:r=!1,order:i=["content"],initialFocus:a=!0,returnFocus:s=!0,restoreFocus:o=!1,modal:c=!0,closeOnFocusOut:u=!0,openInteractionType:f="",getInsideElements:h=()=>[],nextFocusableElement:p,previousFocusableElement:y,beforeContentFocusGuardRef:v,externalTree:w}=t,b="rootStore"in e?e.rootStore:e,_=b.useState("open"),E=b.useState("domReferenceElement"),M=b.useState("floatingElement"),{events:T,dataRef:R}=b.context,A=jt(()=>R.current.floatingContext?.nodeId),P=jt(h),k=a===!1,N=x1(E)&&k,U=Fr(i),L=Fr(a),z=Fr(s),F=Fr(f),V=cu(w),W=U4(),K=x.useRef(null),Q=x.useRef(null),O=x.useRef(!1),G=x.useRef(!1),Y=x.useRef(!1),H=x.useRef(-1),te=x.useRef(""),re=x.useRef(""),ue=x.useRef(null),ce=x.useRef(null),ee=Fd(ue,v,W?.beforeInsideRef),le=Fd(ce,W?.afterInsideRef),ve=ji(),Pe=ji(),be=ev(),Ye=W!=null,he=tp(M),Ue=jt((_e=he)=>_e?Dp(_e,af()):[]),je=jt(_e=>{const oe=Ue(_e);return U.current.map(()=>oe).filter(Boolean).flat()});x.useEffect(()=>{if(r||!c)return;function _e(J){J.key==="Tab"&&On(he,gl(Mr(he)))&&Ue().length===0&&!N&&pi(J)}const oe=Mr(he);return oe.addEventListener("keydown",_e),()=>{oe.removeEventListener("keydown",_e)}},[r,E,he,c,U,N,Ue,je]),x.useEffect(()=>{if(r||!M)return;function _e(oe){const J=Fi(oe),Ne=Ue().indexOf(J);Ne!==-1&&(H.current=Ne)}return M.addEventListener("focusin",_e),()=>{M.removeEventListener("focusin",_e)}},[r,M,Ue]),x.useEffect(()=>{if(r||!_)return;const _e=Mr(he);function oe(){Y.current=!1}function J(Ne){const De=Fi(Ne),Le=On(M,De)||On(E,De)||On(W?.portalNode,De);Y.current=!Le,re.current=Ne.pointerType||"keyboard"}function ze(){re.current="keyboard"}return _e.addEventListener("pointerdown",J,!0),_e.addEventListener("pointerup",oe,!0),_e.addEventListener("pointercancel",oe,!0),_e.addEventListener("keydown",ze,!0),()=>{_e.removeEventListener("pointerdown",J,!0),_e.removeEventListener("pointerup",oe,!0),_e.removeEventListener("pointercancel",oe,!0),_e.removeEventListener("keydown",ze,!0)}},[r,M,E,he,_,W]),x.useEffect(()=>{if(r||!u)return;function _e(){G.current=!0,Pe.start(0,()=>{G.current=!1})}function oe(De){const Le=De.relatedTarget,$=De.currentTarget,I=Fi(De);queueMicrotask(()=>{const Z=A(),pe=b.context.triggerElements,Se=Le?.hasAttribute(np("focus-guard"))&&[ue.current,ce.current,W?.beforeInsideRef.current,W?.afterInsideRef.current,W?.beforeOutsideRef.current,W?.afterOutsideRef.current,go(y),go(p)].includes(Le),xe=!(On(E,Le)||On(M,Le)||On(Le,M)||On(W?.portalNode,Le)||Le!=null&&pe.hasElement(Le)||pe.hasMatchingElement(Ie=>On(Ie,Le))||Se||V&&(Uc(V.nodesRef.current,Z).find(Ie=>On(Ie.context?.elements.floating,Le)||On(Ie.context?.elements.domReference,Le))||kR(V.nodesRef.current,Z).find(Ie=>[Ie.context?.elements.floating,tp(Ie.context?.elements.floating)].includes(Le)||Ie.context?.elements.domReference===Le)));if($===E&&he&&IR(he,U),o&&$!==E&&!wee(I)&&gl(Mr(he))===Mr(he).body){if(Tr(he)&&(he.focus(),o==="popup")){be.request(()=>{he.focus()});return}const Ie=H.current,He=Ue(),qe=He[Ie]||He[He.length-1]||he;Tr(qe)&&qe.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(N||!c)&&Le&&xe&&!G.current&&(N||Le!==s_())&&(O.current=!0,b.setOpen(!1,Mn(Kc,De)))})}function J(){Y.current||(R.current.insideReactTree=!0,ve.start(0,()=>{R.current.insideReactTree=!1}))}const ze=Tr(E)?E:null,Ne=[];if(!(!M&&!ze))return ze&&(ze.addEventListener("focusout",oe),ze.addEventListener("pointerdown",_e),Ne.push(()=>{ze.removeEventListener("focusout",oe),ze.removeEventListener("pointerdown",_e)})),M&&(M.addEventListener("focusout",oe),W&&(M.addEventListener("focusout",J,!0),Ne.push(()=>{M.removeEventListener("focusout",J,!0)})),Ne.push(()=>{M.removeEventListener("focusout",oe)})),()=>{Ne.forEach(De=>{De()})}},[r,E,M,he,c,V,W,b,u,o,Ue,N,A,U,R,ve,Pe,be,p,y]),x.useEffect(()=>{if(r||!M||!_)return;const _e=Array.from(W?.portalNode?.querySelectorAll(`[${np("portal")}]`)||[]),J=(V?kR(V.nodesRef.current,A()):[]).find(De=>x1(De.context?.elements.domReference||null))?.context?.elements.domReference,ze=[M,J,..._e,...P(),K.current,Q.current,ue.current,ce.current,W?.beforeOutsideRef.current,W?.afterOutsideRef.current,go(y),go(p),N?E:null].filter(De=>De!=null),Ne=gee(ze,c||N);return()=>{Ne()}},[_,r,E,M,c,U,W,N,V,A,P,p,y]),Yt(()=>{if(!_||r||!Tr(he))return;const _e=Mr(he),oe=gl(_e);queueMicrotask(()=>{const J=je(he),ze=L.current,Ne=typeof ze=="function"?ze(F.current||""):ze;if(Ne===void 0||Ne===!1)return;let De;Ne===!0||Ne===null?De=J[0]||he:De=go(Ne),De=De||J[0]||he,!On(he,oe)&&g0(De,{preventScroll:De===he})})},[r,_,he,k,je,L,F]),Yt(()=>{if(r||!he)return;const _e=Mr(he),oe=gl(_e);bee(oe);function J(De){if(De.open||(te.current=xee(De.nativeEvent,re.current)),De.reason===aa&&De.nativeEvent.type==="mouseleave"&&(O.current=!0),De.reason===vE)if(De.nested)O.current=!1;else if(y4(De.nativeEvent)||v4(De.nativeEvent))O.current=!1;else{let Le=!1;document.createElement("div").focus({get preventScroll(){return Le=!0,!1}}),Le?O.current=!1:O.current=!0}}T.on("openchange",J);const ze=_e.createElement("span");ze.setAttribute("tabindex","-1"),ze.setAttribute("aria-hidden","true"),Object.assign(ze.style,uE),Ye&&E&&E.insertAdjacentElement("afterend",ze);function Ne(){const De=z.current;let Le=typeof De=="function"?De(te.current):De;if(Le===void 0||Le===!1)return null;if(Le===null&&(Le=!0),typeof Le=="boolean"){const I=E||s_();return I&&I.isConnected?I:ze}const $=E||s_()||ze;return go(Le)||$}return()=>{T.off("openchange",J);const De=gl(_e),Le=On(M,De)||V&&Uc(V.nodesRef.current,A(),!1).some(I=>On(I.context?.elements.floating,De)),$=Ne();queueMicrotask(()=>{const I=_ee($),Z=typeof z.current!="boolean";z.current&&!O.current&&Tr(I)&&(!(!Z&&I!==De&&De!==_e.body)||Le)&&I.focus({preventScroll:!0}),ze.remove()})}},[r,M,he,z,R,T,V,Ye,E,A]),x.useEffect(()=>{queueMicrotask(()=>{O.current=!1})},[r]),x.useEffect(()=>{if(r||!_)return;function _e(J){Fi(J)?.closest(`[${r4}]`)&&(G.current=!0)}const oe=Mr(he);return oe.addEventListener("pointerdown",_e,!0),()=>{oe.removeEventListener("pointerdown",_e,!0)}},[r,_,he]),Yt(()=>{if(!r&&W)return W.setFocusManagerState({modal:c,closeOnFocusOut:u,open:_,onOpenChange:b.setOpen,domReference:E}),()=>{W.setFocusManagerState(null)}},[r,W,c,_,b,u,E]),Yt(()=>{if(!(r||!he))return IR(he,U),()=>{queueMicrotask(bE)}},[r,he,U]);const et=!r&&(c?!N:!0)&&(Ye||c);return m.jsxs(x.Fragment,{children:[et&&m.jsx(zd,{"data-type":"inside",ref:ee,onFocus:_e=>{if(c){const oe=je();g0(oe[oe.length-1])}else W?.portalNode&&(O.current=!1,Md(_e,W.portalNode)?yE(E)?.focus():go(y??W.beforeOutsideRef)?.focus())}}),n,et&&m.jsx(zd,{"data-type":"inside",ref:le,onFocus:_e=>{c?g0(je()[0]):W?.portalNode&&(u&&(O.current=!0),Md(_e,W.portalNode)?A4(E)?.focus():go(p??W.afterOutsideRef)?.focus())}})]})}function j4(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.context.dataRef,{enabled:i=!0,event:a="click",toggle:s=!0,ignoreMouse:o=!1,stickIfOpen:c=!0,touchOpenDelay:u=0}=e,f=x.useRef(void 0),h=ev(),p=ji(),y=x.useMemo(()=>({onPointerDown(v){f.current=v.pointerType},onMouseDown(v){const w=f.current,b=v.nativeEvent,_=n.select("open");if(v.button!==0||a==="click"||Ud(w,!0)&&o)return;const E=r.current.openEvent,M=E?.type,T=n.select("domReferenceElement")!==v.currentTarget,R=_&&T||!(_&&s&&(!(E&&c)||M==="click"||M==="mousedown"));if(g4(b.target)){const P=Mn(Tl,b,b.target);R&&w==="touch"&&u>0?p.start(u,()=>{n.setOpen(!0,P)}):n.setOpen(R,P);return}const A=v.currentTarget;h.request(()=>{const P=Mn(Tl,b,A);R&&w==="touch"&&u>0?p.start(u,()=>{n.setOpen(!0,P)}):n.setOpen(R,P)})},onClick(v){if(a==="mousedown-only")return;const w=f.current;if(a==="mousedown"&&w){f.current=void 0;return}if(Ud(w,!0)&&o)return;const b=n.select("open"),_=r.current.openEvent,E=n.select("domReferenceElement")!==v.currentTarget,M=b&&E||!(b&&s&&(!(_&&c)||x4(_))),T=Mn(Tl,v.nativeEvent,v.currentTarget);M&&w==="touch"&&u>0?p.start(u,()=>{n.setOpen(!0,T)}):n.setOpen(M,T)},onKeyDown(){f.current=void 0}}),[r,a,o,n,c,s,h,p,u]);return x.useMemo(()=>i?{reference:y}:ei,[i,y])}function OR(t,e,n){let{reference:r,floating:i}=t;const a=Ma(e),s=gE(e),o=mE(s),c=Bi(e),u=a==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,p=r[o]/2-i[o]/2;let y;switch(c){case"top":y={x:f,y:r.y-i.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:h};break;case"left":y={x:r.x-i.width,y:h};break;default:y={x:r.x,y:r.y}}switch(Ul(e)){case"start":y[s]-=p*(n&&u?-1:1);break;case"end":y[s]+=p*(n&&u?-1:1);break}return y}async function See(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:a,rects:s,elements:o,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:p=!1,padding:y=0}=Po(e,t),v=b4(y),b=o[p?h==="floating"?"reference":"floating":h],_=sy(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(b)))==null||n?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(o.floating)),boundary:u,rootBoundary:f,strategy:c})),E=h==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,M=await(a.getOffsetParent==null?void 0:a.getOffsetParent(o.floating)),T=await(a.isElement==null?void 0:a.isElement(M))?await(a.getScale==null?void 0:a.getScale(M))||{x:1,y:1}:{x:1,y:1},R=sy(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:E,offsetParent:M,strategy:c}):E);return{top:(_.top-R.top+v.top)/T.y,bottom:(R.bottom-_.bottom+v.bottom)/T.y,left:(_.left-R.left+v.left)/T.x,right:(R.right-_.right+v.right)/T.x}}const kee=50,Eee=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:s}=n,o=s.detectOverflow?s:{...s,detectOverflow:See},c=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:h}=OR(u,r,c),p=r,y=0;const v={};for(let w=0;w<a.length;w++){const b=a[w];if(!b)continue;const{name:_,fn:E}=b,{x:M,y:T,data:R,reset:A}=await E({x:f,y:h,initialPlacement:r,placement:p,strategy:i,middlewareData:v,rects:u,platform:o,elements:{reference:t,floating:e}});f=M??f,h=T??h,v[_]={...v[_],...R},A&&y<kee&&(y++,typeof A=="object"&&(A.placement&&(p=A.placement),A.rects&&(u=A.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):A.rects),{x:f,y:h}=OR(u,p,c)),w=-1)}return{x:f,y:h,placement:p,strategy:i,middlewareData:v}},Mee=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:a,rects:s,initialPlacement:o,platform:c,elements:u}=e,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:w=!0,...b}=Po(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const _=Bi(i),E=Ma(o),M=Bi(o)===o,T=await(c.isRTL==null?void 0:c.isRTL(u.floating)),R=p||(M||!w?[ay(o)]:PQ(o)),A=v!=="none";!p&&A&&R.push(...IQ(o,w,v,T));const P=[o,...R],k=await c.detectOverflow(e,b),N=[];let U=((r=a.flip)==null?void 0:r.overflows)||[];if(f&&N.push(k[_]),h){const V=RQ(i,s,T);N.push(k[V[0]],k[V[1]])}if(U=[...U,{placement:i,overflows:N}],!N.every(V=>V<=0)){var L,z;const V=(((L=a.flip)==null?void 0:L.index)||0)+1,W=P[V];if(W&&(!(h==="alignment"?E!==Ma(W):!1)||U.every(O=>Ma(O.placement)===E?O.overflows[0]>0:!0)))return{data:{index:V,overflows:U},reset:{placement:W}};let K=(z=U.filter(Q=>Q.overflows[0]<=0).sort((Q,O)=>Q.overflows[1]-O.overflows[1])[0])==null?void 0:z.placement;if(!K)switch(y){case"bestFit":{var F;const Q=(F=U.filter(O=>{if(A){const G=Ma(O.placement);return G===E||G==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(G=>G>0).reduce((G,Y)=>G+Y,0)]).sort((O,G)=>O[1]-G[1])[0])==null?void 0:F[0];Q&&(K=Q);break}case"initialPlacement":K=o;break}if(i!==K)return{reset:{placement:K}}}return{}}}};function FR(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function UR(t){return CQ.some(e=>t[e]>=0)}const Tee=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...a}=Po(t,e);switch(i){case"referenceHidden":{const s=await r.detectOverflow(e,{...a,elementContext:"reference"}),o=FR(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:UR(o)}}}case"escaped":{const s=await r.detectOverflow(e,{...a,altBoundary:!0}),o=FR(s,n.floating);return{data:{escapedOffsets:o,escaped:UR(o)}}}default:return{}}}}},B4=new Set(["left","top"]);async function Cee(t,e){const{placement:n,platform:r,elements:i}=t,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Bi(n),o=Ul(n),c=Ma(n)==="y",u=B4.has(s)?-1:1,f=a&&c?-1:1,h=Po(e,t);let{mainAxis:p,crossAxis:y,alignmentAxis:v}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof v=="number"&&(y=o==="end"?v*-1:v),c?{x:y*f,y:p*u}:{x:p*u,y:y*f}}const Aee=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:a,placement:s,middlewareData:o}=e,c=await Cee(e,t);return s===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:{...c,placement:s}}}}},Ree=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:a}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:c={fn:_=>{let{x:E,y:M}=_;return{x:E,y:M}}},...u}=Po(t,e),f={x:n,y:r},h=await a.detectOverflow(e,u),p=Ma(Bi(i)),y=pE(p);let v=f[y],w=f[p];if(s){const _=y==="y"?"top":"left",E=y==="y"?"bottom":"right",M=v+h[_],T=v-h[E];v=b1(M,v,T)}if(o){const _=p==="y"?"top":"left",E=p==="y"?"bottom":"right",M=w+h[_],T=w-h[E];w=b1(M,w,T)}const b=c.fn({...e,[y]:v,[p]:w});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:s,[p]:o}}}}}},Pee=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:a,middlewareData:s}=e,{offset:o=0,mainAxis:c=!0,crossAxis:u=!0}=Po(t,e),f={x:n,y:r},h=Ma(i),p=pE(h);let y=f[p],v=f[h];const w=Po(o,e),b=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(c){const M=p==="y"?"height":"width",T=a.reference[p]-a.floating[M]+b.mainAxis,R=a.reference[p]+a.reference[M]-b.mainAxis;y<T?y=T:y>R&&(y=R)}if(u){var _,E;const M=p==="y"?"width":"height",T=B4.has(Bi(i)),R=a.reference[h]-a.floating[M]+(T&&((_=s.offset)==null?void 0:_[h])||0)+(T?0:b.crossAxis),A=a.reference[h]+a.reference[M]+(T?0:((E=s.offset)==null?void 0:E[h])||0)-(T?b.crossAxis:0);v<R?v=R:v>A&&(v=A)}return{[p]:y,[h]:v}}}},Nee=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:a,platform:s,elements:o}=e,{apply:c=()=>{},...u}=Po(t,e),f=await s.detectOverflow(e,u),h=Bi(i),p=Ul(i),y=Ma(i)==="y",{width:v,height:w}=a.floating;let b,_;h==="top"||h==="bottom"?(b=h,_=p===(await(s.isRTL==null?void 0:s.isRTL(o.floating))?"start":"end")?"left":"right"):(_=h,b=p==="end"?"top":"bottom");const E=w-f.top-f.bottom,M=v-f.left-f.right,T=jd(w-f[b],E),R=jd(v-f[_],M),A=!e.middlewareData.shift;let P=T,k=R;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(k=M),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(P=E),A&&!p){const U=ia(f.left,0),L=ia(f.right,0),z=ia(f.top,0),F=ia(f.bottom,0);y?k=v-2*(U!==0||L!==0?U+L:ia(f.left,f.right)):P=w-2*(z!==0||F!==0?z+F:ia(f.top,f.bottom))}await c({...e,availableWidth:k,availableHeight:P});const N=await s.getDimensions(o.floating);return v!==N.width||w!==N.height?{reset:{rects:!0}}:{}}}};function z4(t){const e=ca(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Tr(t),a=i?t.offsetWidth:n,s=i?t.offsetHeight:r,o=iy(n)!==a||iy(r)!==s;return o&&(n=a,r=s),{width:n,height:r,$:o}}function wE(t){return Kn(t)?t:t.contextElement}function Cd(t){const e=wE(t);if(!Tr(e))return Ds(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:a}=z4(e);let s=(a?iy(n.width):n.width)/r,o=(a?iy(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!o||!Number.isFinite(o))&&(o=1),{x:s,y:o}}const Dee=Ds(0);function V4(t){const e=Ar(t);return!Ky()||!e.visualViewport?Dee:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Lee(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ar(t)?!1:e}function Zc(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),a=wE(t);let s=Ds(1);e&&(r?Kn(r)&&(s=Cd(r)):s=Cd(t));const o=Lee(a,n,r)?V4(a):Ds(0);let c=(i.left+o.x)/s.x,u=(i.top+o.y)/s.y,f=i.width/s.x,h=i.height/s.y;if(a){const p=Ar(a),y=r&&Kn(r)?Ar(r):r;let v=p,w=f1(v);for(;w&&r&&y!==v;){const b=Cd(w),_=w.getBoundingClientRect(),E=ca(w),M=_.left+(w.clientLeft+parseFloat(E.paddingLeft))*b.x,T=_.top+(w.clientTop+parseFloat(E.paddingTop))*b.y;c*=b.x,u*=b.y,f*=b.x,h*=b.y,c+=M,u+=T,v=Ar(w),w=f1(v)}}return sy({width:f,height:h,x:c,y:u})}function nv(t,e){const n=Zy(t).scrollLeft;return e?e.left+n:Zc(qs(t)).left+n}function H4(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-nv(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function Iee(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const a=i==="fixed",s=qs(r),o=e?Xy(e.floating):!1;if(r===s||o&&a)return n;let c={scrollLeft:0,scrollTop:0},u=Ds(1);const f=Ds(0),h=Tr(r);if((h||!h&&!a)&&((Fl(r)!=="body"||lu(s))&&(c=Zy(r)),h)){const y=Zc(r);u=Cd(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const p=s&&!h&&!a?H4(s,c):Ds(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+p.x,y:n.y*u.y-c.scrollTop*u.y+f.y+p.y}}function Oee(t){return Array.from(t.getClientRects())}function Fee(t){const e=qs(t),n=Zy(t),r=t.ownerDocument.body,i=ia(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=ia(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+nv(t);const o=-n.scrollTop;return ca(r).direction==="rtl"&&(s+=ia(e.clientWidth,r.clientWidth)-i),{width:i,height:a,x:s,y:o}}const jR=25;function Uee(t,e){const n=Ar(t),r=qs(t),i=n.visualViewport;let a=r.clientWidth,s=r.clientHeight,o=0,c=0;if(i){a=i.width,s=i.height;const f=Ky();(!f||f&&e==="fixed")&&(o=i.offsetLeft,c=i.offsetTop)}const u=nv(r);if(u<=0){const f=r.ownerDocument,h=f.body,p=getComputedStyle(h),y=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,v=Math.abs(r.clientWidth-h.clientWidth-y);v<=jR&&(a-=v)}else u<=jR&&(a+=u);return{width:a,height:s,x:o,y:c}}function jee(t,e){const n=Zc(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,a=Tr(t)?Cd(t):Ds(1),s=t.clientWidth*a.x,o=t.clientHeight*a.y,c=i*a.x,u=r*a.y;return{width:s,height:o,x:c,y:u}}function BR(t,e,n){let r;if(e==="viewport")r=Uee(t,n);else if(e==="document")r=Fee(qs(t));else if(Kn(e))r=jee(e,n);else{const i=V4(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return sy(r)}function W4(t,e){const n=Ro(t);return n===e||!Kn(n)||ko(n)?!1:ca(n).position==="fixed"||W4(n,e)}function Bee(t,e){const n=e.get(t);if(n)return n;let r=kl(t,[],!1).filter(o=>Kn(o)&&Fl(o)!=="body"),i=null;const a=ca(t).position==="fixed";let s=a?Ro(t):t;for(;Kn(s)&&!ko(s);){const o=ca(s),c=lE(s);!c&&o.position==="fixed"&&(i=null),(a?!c&&!i:!c&&o.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||lu(s)&&!c&&W4(t,s))?r=r.filter(f=>f!==s):i=o,s=Ro(s)}return e.set(t,r),r}function zee(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?Xy(e)?[]:Bee(e,this._c):[].concat(n),r],o=BR(e,s[0],i);let c=o.top,u=o.right,f=o.bottom,h=o.left;for(let p=1;p<s.length;p++){const y=BR(e,s[p],i);c=ia(y.top,c),u=jd(y.right,u),f=jd(y.bottom,f),h=ia(y.left,h)}return{width:u-h,height:f-c,x:h,y:c}}function Vee(t){const{width:e,height:n}=z4(t);return{width:e,height:n}}function Hee(t,e,n){const r=Tr(e),i=qs(e),a=n==="fixed",s=Zc(t,!0,a,e);let o={scrollLeft:0,scrollTop:0};const c=Ds(0);function u(){c.x=nv(i)}if(r||!r&&!a)if((Fl(e)!=="body"||lu(i))&&(o=Zy(e)),r){const y=Zc(e,!0,a,e);c.x=y.x+e.clientLeft,c.y=y.y+e.clientTop}else i&&u();a&&!r&&i&&u();const f=i&&!r&&!a?H4(i,o):Ds(0),h=s.left+o.scrollLeft-c.x-f.x,p=s.top+o.scrollTop-c.y-f.y;return{x:h,y:p,width:s.width,height:s.height}}function o_(t){return ca(t).position==="static"}function zR(t,e){if(!Tr(t)||ca(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return qs(t)===n&&(n=n.ownerDocument.body),n}function G4(t,e){const n=Ar(t);if(Xy(t))return n;if(!Tr(t)){let i=Ro(t);for(;i&&!ko(i);){if(Kn(i)&&!o_(i))return i;i=Ro(i)}return n}let r=zR(t,e);for(;r&&aJ(r)&&o_(r);)r=zR(r,e);return r&&ko(r)&&o_(r)&&!lE(r)?n:r||lJ(t)||n}const Wee=async function(t){const e=this.getOffsetParent||G4,n=this.getDimensions,r=await n(t.floating);return{reference:Hee(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Gee(t){return ca(t).direction==="rtl"}const $ee={convertOffsetParentRelativeRectToViewportRelativeRect:Iee,getDocumentElement:qs,getClippingRect:zee,getOffsetParent:G4,getElementRects:Wee,getClientRects:Oee,getDimensions:Vee,getScale:Cd,isElement:Kn,isRTL:Gee};function $4(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Yee(t,e){let n=null,r;const i=qs(t);function a(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function s(o,c){o===void 0&&(o=!1),c===void 0&&(c=1),a();const u=t.getBoundingClientRect(),{left:f,top:h,width:p,height:y}=u;if(o||e(),!p||!y)return;const v=wd(h),w=wd(i.clientWidth-(f+p)),b=wd(i.clientHeight-(h+y)),_=wd(f),M={rootMargin:-v+"px "+-w+"px "+-b+"px "+-_+"px",threshold:ia(0,jd(1,c))||1};let T=!0;function R(A){const P=A[0].intersectionRatio;if(P!==c){if(!T)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},1e3)}P===1&&!$4(u,t.getBoundingClientRect())&&s(),T=!1}try{n=new IntersectionObserver(R,{...M,root:i.ownerDocument})}catch{n=new IntersectionObserver(R,M)}n.observe(t)}return s(!0),a}function VR(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=wE(t),f=i||a?[...u?kl(u):[],...e?kl(e):[]]:[];f.forEach(_=>{i&&_.addEventListener("scroll",n,{passive:!0}),a&&_.addEventListener("resize",n)});const h=u&&o?Yee(u,n):null;let p=-1,y=null;s&&(y=new ResizeObserver(_=>{let[E]=_;E&&E.target===u&&y&&e&&(y.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var M;(M=y)==null||M.observe(e)})),n()}),u&&!c&&y.observe(u),e&&y.observe(e));let v,w=c?Zc(t):null;c&&b();function b(){const _=Zc(t);w&&!$4(w,_)&&n(),w=_,v=requestAnimationFrame(b)}return n(),()=>{var _;f.forEach(E=>{i&&E.removeEventListener("scroll",n),a&&E.removeEventListener("resize",n)}),h?.(),(_=y)==null||_.disconnect(),y=null,c&&cancelAnimationFrame(v)}}const qee=Aee,Xee=Ree,Kee=Mee,Zee=Nee,Jee=Tee,Qee=Pee,ete=(t,e,n)=>{const r=new Map,i={platform:$ee,...n},a={...i.platform,_c:r};return Eee(t,e,{...i,platform:a})};var tte=typeof document<"u",nte=function(){},y0=tte?x.useLayoutEffect:nte;function dy(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!dy(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const a=i[r];if(!(a==="_owner"&&t.$$typeof)&&!dy(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function Y4(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function HR(t,e){const n=Y4(t);return Math.round(e*n)/n}function l_(t){const e=x.useRef(t);return y0(()=>{e.current=t}),e}function rte(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:s}={},transform:o=!0,whileElementsMounted:c,open:u}=t,[f,h]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[p,y]=x.useState(r);dy(p,r)||y(r);const[v,w]=x.useState(null),[b,_]=x.useState(null),E=x.useCallback(O=>{O!==A.current&&(A.current=O,w(O))},[]),M=x.useCallback(O=>{O!==P.current&&(P.current=O,_(O))},[]),T=a||v,R=s||b,A=x.useRef(null),P=x.useRef(null),k=x.useRef(f),N=c!=null,U=l_(c),L=l_(i),z=l_(u),F=x.useCallback(()=>{if(!A.current||!P.current)return;const O={placement:e,strategy:n,middleware:p};L.current&&(O.platform=L.current),ete(A.current,P.current,O).then(G=>{const Y={...G,isPositioned:z.current!==!1};V.current&&!dy(k.current,Y)&&(k.current=Y,gi.flushSync(()=>{h(Y)}))})},[p,e,n,L,z]);y0(()=>{u===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,h(O=>({...O,isPositioned:!1})))},[u]);const V=x.useRef(!1);y0(()=>(V.current=!0,()=>{V.current=!1}),[]),y0(()=>{if(T&&(A.current=T),R&&(P.current=R),T&&R){if(U.current)return U.current(T,R,F);F()}},[T,R,F,U,N]);const W=x.useMemo(()=>({reference:A,floating:P,setReference:E,setFloating:M}),[E,M]),K=x.useMemo(()=>({reference:T,floating:R}),[T,R]),Q=x.useMemo(()=>{const O={position:n,left:0,top:0};if(!K.floating)return O;const G=HR(K.floating,f.x),Y=HR(K.floating,f.y);return o?{...O,transform:"translate("+G+"px, "+Y+"px)",...Y4(K.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:Y}},[n,o,K.floating,f.x,f.y]);return x.useMemo(()=>({...f,update:F,refs:W,elements:K,floatingStyles:Q}),[f,F,W,K,Q])}const ite=(t,e)=>{const n=qee(t);return{name:n.name,fn:n.fn,options:[t,e]}},ate=(t,e)=>{const n=Xee(t);return{name:n.name,fn:n.fn,options:[t,e]}},ste=(t,e)=>({fn:Qee(t).fn,options:[t,e]}),ote=(t,e)=>{const n=Kee(t);return{name:n.name,fn:n.fn,options:[t,e]}},lte=(t,e)=>{const n=Zee(t);return{name:n.name,fn:n.fn,options:[t,e]}},cte=(t,e)=>{const n=Jee(t);return{name:n.name,fn:n.fn,options:[t,e]}},ute={intentional:"onClick",sloppy:"onPointerDown"};function dte(t){return{escapeKey:typeof t=="boolean"?t:t?.escapeKey??!1,outsidePress:typeof t=="boolean"?t:t?.outsidePress??!0}}function SE(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),i=n.useState("floatingElement"),a=n.useState("referenceElement"),s=n.useState("domReferenceElement"),{onOpenChange:o,dataRef:c}=n.context,{enabled:u=!0,escapeKey:f=!0,outsidePress:h=!0,outsidePressEvent:p="sloppy",referencePress:y=!1,referencePressEvent:v="sloppy",ancestorScroll:w=!1,bubbles:b,externalTree:_}=e,E=cu(_),M=jt(typeof h=="function"?h:()=>!1),T=typeof h=="function"?M:h,R=x.useRef(!1),{escapeKey:A,outsidePress:P}=dte(b),k=x.useRef(null),N=ji(),U=ji(),L=jt(()=>{U.clear(),c.current.insideReactTree=!1}),z=x.useRef(!1),F=x.useRef(""),V=jt(he=>{F.current=he.pointerType}),W=jt(()=>{const he=F.current,Ue=he==="pen"||!he?"mouse":he,je=typeof p=="function"?p():p;return typeof je=="string"?je:je[Ue]}),K=jt(he=>{if(!r||!u||!f||he.key!=="Escape"||z.current)return;const Ue=c.current.floatingContext?.nodeId,je=E?Uc(E.nodesRef.current,Ue):[];if(!A&&je.length>0){let oe=!0;if(je.forEach(J=>{J.context?.open&&!J.context.dataRef.current.__escapeKeyBubbles&&(oe=!1)}),!oe)return}const et=TQ(he)?he.nativeEvent:he,_e=Mn(L4,et);n.setOpen(!1,_e),!A&&!_e.isPropagationAllowed&&he.stopPropagation()}),Q=jt(he=>{const Ue=W();return Ue==="intentional"&&he.type!=="click"||Ue==="sloppy"&&he.type==="click"}),O=jt(()=>{c.current.insideReactTree=!0,U.start(0,L)}),G=jt((he,Ue=!1)=>{if(Q(he)){L();return}if(c.current.insideReactTree){L();return}if(W()==="intentional"&&Ue||typeof T=="function"&&!T(he))return;const je=Fi(he),et=`[${np("inert")}]`,_e=Mr(n.select("floatingElement")).querySelectorAll(et),oe=n.context.triggerElements;if(je&&(oe.hasElement(je)||oe.hasMatchingElement(Le=>On(Le,je))))return;let J=Kn(je)?je:null;for(;J&&!ko(J);){const Le=Ro(J);if(ko(Le)||!Kn(Le))break;J=Le}if(_e.length&&Kn(je)&&!MQ(je)&&!On(je,n.select("floatingElement"))&&Array.from(_e).every(Le=>!On(J,Le)))return;if(Tr(je)&&!("touches"in he)){const Le=ko(je),$=ca(je),I=/auto|scroll/,Z=Le||I.test($.overflowX),pe=Le||I.test($.overflowY),Se=Z&&je.clientWidth>0&&je.scrollWidth>je.clientWidth,xe=pe&&je.clientHeight>0&&je.scrollHeight>je.clientHeight,Ie=$.direction==="rtl",He=xe&&(Ie?he.offsetX<=je.offsetWidth-je.clientWidth:he.offsetX>je.clientWidth),qe=Se&&he.offsetY>je.clientHeight;if(He||qe)return}const ze=c.current.floatingContext?.nodeId,Ne=E&&Uc(E.nodesRef.current,ze).some(Le=>za(he,Le.context?.elements.floating));if(za(he,n.select("floatingElement"))||za(he,n.select("domReferenceElement"))||Ne)return;const De=E?Uc(E.nodesRef.current,ze):[];if(De.length>0){let Le=!0;if(De.forEach($=>{$.context?.open&&!$.context.dataRef.current.__outsidePressBubbles&&(Le=!1)}),!Le)return}n.setOpen(!1,Mn(vE,he)),L()}),Y=jt(he=>{W()!=="sloppy"||he.pointerType==="touch"||!n.select("open")||!u||za(he,n.select("floatingElement"))||za(he,n.select("domReferenceElement"))||G(he)}),H=jt(he=>{if(W()!=="sloppy"||!n.select("open")||!u||za(he,n.select("floatingElement"))||za(he,n.select("domReferenceElement")))return;const Ue=he.touches[0];Ue&&(k.current={startTime:Date.now(),startX:Ue.clientX,startY:Ue.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},N.start(1e3,()=>{k.current&&(k.current.dismissOnTouchEnd=!1,k.current.dismissOnMouseDown=!1)}))}),te=jt(he=>{const Ue=Fi(he);function je(){H(he),Ue?.removeEventListener(he.type,je)}Ue?.addEventListener(he.type,je)}),re=jt(he=>{const Ue=R.current;if(R.current=!1,N.clear(),he.type==="mousedown"&&k.current&&!k.current.dismissOnMouseDown)return;const je=Fi(he);function et(){he.type==="pointerdown"?Y(he):G(he,Ue),je?.removeEventListener(he.type,et)}je?.addEventListener(he.type,et)}),ue=jt(he=>{if(W()!=="sloppy"||!k.current||za(he,n.select("floatingElement"))||za(he,n.select("domReferenceElement")))return;const Ue=he.touches[0];if(!Ue)return;const je=Math.abs(Ue.clientX-k.current.startX),et=Math.abs(Ue.clientY-k.current.startY),_e=Math.sqrt(je*je+et*et);_e>5&&(k.current.dismissOnTouchEnd=!0),_e>10&&(G(he),N.clear(),k.current=null)}),ce=jt(he=>{const Ue=Fi(he);function je(){ue(he),Ue?.removeEventListener(he.type,je)}Ue?.addEventListener(he.type,je)}),ee=jt(he=>{W()!=="sloppy"||!k.current||za(he,n.select("floatingElement"))||za(he,n.select("domReferenceElement"))||(k.current.dismissOnTouchEnd&&G(he),N.clear(),k.current=null)}),le=jt(he=>{const Ue=Fi(he);function je(){ee(he),Ue?.removeEventListener(he.type,je)}Ue?.addEventListener(he.type,je)});x.useEffect(()=>{if(!r||!u)return;c.current.__escapeKeyBubbles=A,c.current.__outsidePressBubbles=P;const he=new Nl;function Ue(J){n.setOpen(!1,Mn(tv,J))}function je(){he.clear(),z.current=!0}function et(){he.start(Ky()?5:0,()=>{z.current=!1})}const _e=Mr(i);_e.addEventListener("pointerdown",V,!0),f&&(_e.addEventListener("keydown",K),_e.addEventListener("compositionstart",je),_e.addEventListener("compositionend",et)),T&&(_e.addEventListener("click",re,!0),_e.addEventListener("pointerdown",re,!0),_e.addEventListener("touchstart",te,!0),_e.addEventListener("touchmove",ce,!0),_e.addEventListener("touchend",le,!0),_e.addEventListener("mousedown",re,!0));let oe=[];return w&&(Kn(s)&&(oe=kl(s)),Kn(i)&&(oe=oe.concat(kl(i))),!Kn(a)&&a&&a.contextElement&&(oe=oe.concat(kl(a.contextElement)))),oe=oe.filter(J=>J!==_e.defaultView?.visualViewport),oe.forEach(J=>{J.addEventListener("scroll",Ue,{passive:!0})}),()=>{_e.removeEventListener("pointerdown",V,!0),f&&(_e.removeEventListener("keydown",K),_e.removeEventListener("compositionstart",je),_e.removeEventListener("compositionend",et)),T&&(_e.removeEventListener("click",re,!0),_e.removeEventListener("pointerdown",re,!0),_e.removeEventListener("touchstart",te,!0),_e.removeEventListener("touchmove",ce,!0),_e.removeEventListener("touchend",le,!0),_e.removeEventListener("mousedown",re,!0)),oe.forEach(J=>{J.removeEventListener("scroll",Ue)}),he.clear(),R.current=!1}},[c,i,a,s,f,T,r,o,w,u,A,P,K,G,re,Y,te,ce,le,V,n]),x.useEffect(L,[T,L]);const ve=x.useMemo(()=>({onKeyDown:K,...y&&{[ute[v]]:he=>{n.setOpen(!1,Mn(Tl,he.nativeEvent))},...v!=="intentional"&&{onClick(he){n.setOpen(!1,Mn(Tl,he.nativeEvent))}}}}),[K,n,y,v]),Pe=jt(he=>{const Ue=Fi(he.nativeEvent);!On(n.select("floatingElement"),Ue)||he.button!==0||(R.current=!0)}),be=jt(he=>{!r||!u||he.button!==0||(R.current=!0)}),Ye=x.useMemo(()=>({onKeyDown:K,onPointerDown:Pe,onMouseDown:Pe,onMouseUp:Pe,onClickCapture:O,onMouseDownCapture(he){O(),be(he)},onPointerDownCapture(he){O(),be(he)},onMouseUpCapture:O,onTouchEndCapture:O,onTouchMoveCapture:O}),[K,Pe,O,be]);return x.useMemo(()=>u?{reference:ve,floating:Ye,trigger:ve}:{},[u,ve,Ye])}const fte={open:At(t=>t.open),domReferenceElement:At(t=>t.domReferenceElement),referenceElement:At(t=>t.positionReference??t.referenceElement),floatingElement:At(t=>t.floatingElement),floatingId:At(t=>t.floatingId)};class kE extends dE{constructor(e){const{nested:n,noEmit:r,onOpenChange:i,triggerElements:a,...s}=e;super({...s,positionReference:s.referenceElement,domReferenceElement:s.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:P4(),nested:n,noEmit:r,triggerElements:a},fte)}setOpen=(e,n)=>{if((!e||!this.state.open||x4(n.event))&&(this.context.dataRef.current.openEvent=e?n.event:void 0),!this.context.noEmit){const r={open:e,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(e,n)}}function EE(t,e=!1,n=!1){const[r,i]=x.useState(t&&e?"idle":void 0),[a,s]=x.useState(t);return t&&!a&&(s(!0),i("starting")),!t&&a&&r!=="ending"&&!n&&i("ending"),!t&&!a&&r==="ending"&&i(void 0),Yt(()=>{if(!t&&a&&r!=="ending"&&n){const o=Ss.request(()=>{i("ending")});return()=>{Ss.cancel(o)}}},[t,a,r,n]),Yt(()=>{if(!t||e)return;const o=Ss.request(()=>{i(void 0)});return()=>{Ss.cancel(o)}},[e,t]),Yt(()=>{if(!t||!e)return;t&&a&&r!=="idle"&&i("starting");const o=Ss.request(()=>{i("idle")});return()=>{Ss.cancel(o)}},[e,t,a,i,r]),x.useMemo(()=>({mounted:a,setMounted:s,transitionStatus:r}),[a,r])}let rp=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const hte={[rp.startingStyle]:""},pte={[rp.endingStyle]:""},of={transitionStatus(t){return t==="starting"?hte:t==="ending"?pte:null}};function q4(t,e=!1,n=!0){const r=ev();return jt((i,a=null)=>{r.cancel();function s(){gi.flushSync(i)}const o=go(t);if(o==null)return;const c=o;if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{let u=function(){const h=rp.startingStyle;if(!c.hasAttribute(h)){r.request(f);return}const p=new MutationObserver(()=>{c.hasAttribute(h)||(p.disconnect(),f())});p.observe(c,{attributes:!0,attributeFilter:[h]}),a?.addEventListener("abort",()=>p.disconnect(),{once:!0})},f=function(){Promise.all(c.getAnimations().map(h=>h.finished)).then(()=>{a?.aborted||s()}).catch(()=>{const h=c.getAnimations();if(n){if(a?.aborted)return;s()}else h.length>0&&h.some(p=>p.pending||p.playState!=="finished")&&f()})};if(e){u();return}r.request(f)}})}function lf(t){const{enabled:e=!0,open:n,ref:r,onComplete:i}=t,a=jt(i),s=q4(r,n,!1);x.useEffect(()=>{if(!e)return;const o=new AbortController;return s(a,o.signal),()=>{o.abort()}},[e,n,a,s])}function mte(t,e){const n=x.useRef(null),r=x.useRef(null);return x.useCallback(i=>{if(t!==void 0){if(n.current!==null){const a=n.current,s=r.current,o=e.context.triggerElements.getById(a);s&&o===s&&e.context.triggerElements.delete(a),n.current=null,r.current=null}i!==null&&(n.current=t,r.current=i,e.context.triggerElements.add(t,i))}},[e,t])}function gte(t,e,n,r){const i=n.useState("isMountedByTrigger",t),a=mte(t,n),s=jt(o=>{if(a(o),!o||!n.select("open"))return;const c=n.select("activeTriggerId");if(c===t){n.update({activeTriggerElement:o,...r});return}c==null&&n.update({activeTriggerId:t,activeTriggerElement:o,...r})});return Yt(()=>{i&&n.update({activeTriggerElement:e.current,...r})},[i,n,e,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function X4(t){const e=t.useState("open");Yt(()=>{if(e&&!t.select("activeTriggerId")&&t.context.triggerElements.size===1){const n=t.context.triggerElements.entries().next();if(!n.done){const[r,i]=n.value;t.update({activeTriggerId:r,activeTriggerElement:i})}}},[e,t])}function K4(t,e,n){const{mounted:r,setMounted:i,transitionStatus:a}=EE(t);e.useSyncedValues({mounted:r,transitionStatus:a});const s=jt(()=>{i(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),e.context.onOpenChangeComplete?.(!1)}),o=e.useState("preventUnmountingOnClose");return lf({enabled:!o,open:t,ref:e.context.popupRef,onComplete(){t||s()}}),{forceUnmount:s,transitionStatus:a}}class rv{constructor(){this.elements=new Set,this.idMap=new Map}add(e,n){const r=this.idMap.get(e);r!==n&&(r!==void 0&&this.elements.delete(r),this.elements.add(n),this.idMap.set(e,n))}delete(e){const n=this.idMap.get(e);n&&(this.elements.delete(n),this.idMap.delete(e))}hasElement(e){return this.elements.has(e)}hasMatchingElement(e){for(const n of this.elements)if(e(n))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function yte(){return new kE({open:!1,floatingElement:null,referenceElement:null,triggerElements:new rv,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Z4(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:yte(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:ei,inactiveTriggerProps:ei,popupProps:ei}}const J4={open:At(t=>t.open),mounted:At(t=>t.mounted),transitionStatus:At(t=>t.transitionStatus),floatingRootContext:At(t=>t.floatingRootContext),preventUnmountingOnClose:At(t=>t.preventUnmountingOnClose),payload:At(t=>t.payload),activeTriggerId:At(t=>t.activeTriggerId),activeTriggerElement:At(t=>t.mounted?t.activeTriggerElement:null),isTriggerActive:At((t,e)=>e!==void 0&&t.activeTriggerId===e),isOpenedByTrigger:At((t,e)=>e!==void 0&&t.activeTriggerId===e&&t.open),isMountedByTrigger:At((t,e)=>e!==void 0&&t.activeTriggerId===e&&t.mounted),triggerProps:At((t,e)=>e?t.activeTriggerProps:t.inactiveTriggerProps),popupProps:At(t=>t.popupProps),popupElement:At(t=>t.popupElement),positionerElement:At(t=>t.positionerElement)};function Q4(t){const{open:e=!1,onOpenChange:n,elements:r={}}=t,i=sf(),a=jl()!=null,s=Vi(()=>new kE({open:e,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new rv,floatingId:i,nested:a,noEmit:t.noEmit||!1})).current;return Yt(()=>{const o={open:e,floatingId:i};r.reference!==void 0&&(o.referenceElement=r.reference,o.domReferenceElement=Kn(r.reference)?r.reference:null),r.floating!==void 0&&(o.floatingElement=r.floating),s.update(o)},[e,i,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=a,s.context.noEmit=t.noEmit||!1,s}function vte(t={}){const{nodeId:e,externalTree:n}=t,r=Q4(t),i=t.rootContext||r,a={reference:i.useState("referenceElement"),floating:i.useState("floatingElement"),domReference:i.useState("domReferenceElement")},[s,o]=x.useState(null),c=x.useRef(null),u=cu(n);Yt(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);const f=rte({...t,elements:{...a,...s&&{reference:s}}}),h=x.useCallback(P=>{const k=Kn(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;o(k),f.refs.setReference(k)},[f.refs]),[p,y]=x.useState(null),[v,w]=x.useState(null);i.useSyncedValue("referenceElement",p),i.useSyncedValue("domReferenceElement",Kn(p)?p:null),i.useSyncedValue("floatingElement",v);const b=x.useCallback(P=>{(Kn(P)||P===null)&&(c.current=P,y(P)),(Kn(f.refs.reference.current)||f.refs.reference.current===null||P!==null&&!Kn(P))&&f.refs.setReference(P)},[f.refs,y]),_=x.useCallback(P=>{w(P),f.refs.setFloating(P)},[f.refs]),E=x.useMemo(()=>({...f.refs,setReference:b,setFloating:_,setPositionReference:h,domReference:c}),[f.refs,b,_,h]),M=x.useMemo(()=>({...f.elements,domReference:a.domReference}),[f.elements,a.domReference]),T=i.useState("open"),R=i.useState("floatingId"),A=x.useMemo(()=>({...f,dataRef:i.context.dataRef,open:T,onOpenChange:i.setOpen,events:i.context.events,floatingId:R,refs:E,elements:M,nodeId:e,rootStore:i}),[f,E,M,e,i,T,R]);return Yt(()=>{i.context.dataRef.current.floatingContext=A;const P=u?.nodesRef.current.find(k=>k.id===e);P&&(P.context=A)}),x.useMemo(()=>({...f,context:A,refs:E,elements:M,rootStore:i}),[f,E,M,A,i])}function eF(t){const{popupStore:e,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:i}=t,a=sf(),s=jl()!=null,o=e.useState("open"),c=e.useState("activeTriggerElement"),u=e.useState(r?"popupElement":"positionerElement"),f=e.context.triggerElements,h=Vi(()=>new kE({open:o,referenceElement:c,floatingElement:u,triggerElements:f,onOpenChange:i,floatingId:a,nested:s,noEmit:n})).current;return Yt(()=>{const p={open:o,floatingId:a,referenceElement:c,floatingElement:u};Kn(c)&&(p.domReferenceElement=c),h.state.positionReference===h.state.referenceElement&&(p.positionReference=c),h.update(p)},[o,a,c,u,h]),h.context.onOpenChange=i,h.context.nested=s,h.context.noEmit=n,h}const k1=np("safe-polygon"),xte=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${m4}`;function bte(t){return t?!!t.closest(xte):!1}function tF(t){const e=x.useRef(void 0),n=x.useRef(!1),r=x.useRef(void 0),i=x.useRef(!0),a=x.useRef(!1),s=x.useRef(()=>{}),o=x.useRef(!1),c=ji(),u=ji(),f=x.useRef(void 0);return x.useMemo(()=>{const h=t.context.dataRef.current;return h.hoverInteractionState||(h.hoverInteractionState={pointerTypeRef:e,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:i,performedPointerEventsMutationRef:a,unbindMouseMoveRef:s,restTimeoutPendingRef:o,openChangeTimeout:c,restTimeout:u,handleCloseOptionsRef:f}),h.hoverInteractionState},[t,e,n,r,i,a,s,o,c,u,f])}const _te=new Set(["click","mousedown"]);function wte(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),i=n.useState("floatingElement"),a=n.useState("domReferenceElement"),{dataRef:s}=n.context,{enabled:o=!0,closeDelay:c=0,externalTree:u}=e,{pointerTypeRef:f,interactedInsideRef:h,handlerRef:p,performedPointerEventsMutationRef:y,unbindMouseMoveRef:v,restTimeoutPendingRef:w,openChangeTimeout:b,handleCloseOptionsRef:_}=tF(n),E=cu(u),M=jl(),T=jt(()=>h.current?!0:s.current.openEvent?_te.has(s.current.openEvent.type):!1),R=jt(()=>{const U=s.current.openEvent?.type;return U?.includes("mouse")&&U!=="mousedown"}),A=x.useCallback((U,L=!0)=>{const z=Ste(c,f.current);z&&!p.current?b.start(z,()=>n.setOpen(!1,Mn(aa,U))):L&&(b.clear(),n.setOpen(!1,Mn(aa,U)))},[c,p,n,f,b]),P=jt(()=>{v.current(),p.current=void 0}),k=jt(()=>{if(y.current){const U=Mr(i).body;U.style.pointerEvents="",U.removeAttribute(k1),y.current=!1}}),N=jt(U=>{const L=Fi(U);if(!bte(L)){h.current=!1;return}h.current=!0});Yt(()=>{r||(f.current=void 0,w.current=!1,h.current=!1,P(),k())},[r,f,w,h,P,k]),x.useEffect(()=>()=>{P()},[P]),x.useEffect(()=>k,[k]),Yt(()=>{if(o&&r&&_.current?.blockPointerEvents&&R()&&Kn(a)&&i){y.current=!0;const U=Mr(i).body;U.setAttribute(k1,"");const L=a,z=i,F=E?.nodesRef.current.find(V=>V.id===M)?.context?.elements.floating;return F&&(F.style.pointerEvents=""),U.style.pointerEvents="none",L.style.pointerEvents="auto",z.style.pointerEvents="auto",()=>{U.style.pointerEvents="",L.style.pointerEvents="",z.style.pointerEvents=""}}},[o,r,a,i,_,R,E,M,y]),x.useEffect(()=>{if(!o)return;function U(V){if(T()||!s.current.floatingContext||!n.select("open"))return;const W=n.context.triggerElements;V.relatedTarget&&W.hasElement(V.relatedTarget)||(k(),P(),T()||A(V))}function L(V){b.clear(),k(),p.current?.(V),P()}function z(V){T()||A(V,!1)}const F=i;return F&&(F.addEventListener("mouseleave",U),F.addEventListener("mouseenter",L),F.addEventListener("mouseleave",z),F.addEventListener("pointerdown",N,!0)),()=>{F&&(F.removeEventListener("mouseleave",U),F.removeEventListener("mouseenter",L),F.removeEventListener("mouseleave",z),F.removeEventListener("pointerdown",N,!0))}})}function Ste(t,e){return e&&!Ud(e)?0:typeof t=="function"?t():t}function c_(t){return typeof t=="function"?t():t}const kte={current:null};function Ete(t,e={}){const n="rootStore"in t?t.rootStore:t,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:s=0,handleClose:o=null,mouseOnly:c=!1,restMs:u=0,move:f=!0,triggerElementRef:h=kte,externalTree:p,isActiveTrigger:y=!0}=e,v=cu(p),{pointerTypeRef:w,interactedInsideRef:b,handlerRef:_,blockMouseMoveRef:E,performedPointerEventsMutationRef:M,unbindMouseMoveRef:T,restTimeoutPendingRef:R,openChangeTimeout:A,restTimeout:P,handleCloseOptionsRef:k}=tF(n),N=Fr(o),U=Fr(s),L=Fr(u);y&&(k.current=N.current?.__options);const z=jt(()=>b.current?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),F=x.useCallback((Q,O=!0)=>{const G=i_(U.current,"close",w.current);G&&!_.current?A.start(G,()=>n.setOpen(!1,Mn(aa,Q))):O&&(A.clear(),n.setOpen(!1,Mn(aa,Q)))},[U,_,n,w,A]),V=jt(()=>{T.current(),_.current=void 0}),W=jt(()=>{if(M.current){const Q=Mr(n.select("domReferenceElement")).body;Q.style.pointerEvents="",Q.removeAttribute(k1),M.current=!1}});x.useEffect(()=>{if(!a)return;function Q(O){O.open||(A.clear(),P.clear(),E.current=!0,R.current=!1)}return i.on("openchange",Q),()=>{i.off("openchange",Q)}},[a,i,A,P,E,R]);const K=jt(Q=>{if(z()||!r.current.floatingContext)return;const O=n.context.triggerElements;if(Q.relatedTarget&&O.hasElement(Q.relatedTarget))return;const G=h.current;N.current?.({...r.current.floatingContext,tree:v,x:Q.clientX,y:Q.clientY,onClose(){W(),V(),!z()&&G===n.select("domReferenceElement")&&F(Q)}})(Q)});return x.useEffect(()=>{if(!a)return;const Q=h.current??(y?n.select("domReferenceElement"):null);if(!Kn(Q))return;function O(H){if(A.clear(),E.current=!1,c&&!Ud(w.current)||c_(L.current)>0&&!i_(U.current,"open"))return;const te=i_(U.current,"open",w.current),re=n.select("domReferenceElement"),ue=n.context.triggerElements,ce=(ue.hasElement(H.target)||ue.hasMatchingElement(Pe=>On(Pe,H.target)))&&(!re||!On(re,H.target)),ee=H.currentTarget??null,le=n.select("open"),ve=!le||ce;ce&&le?n.setOpen(!0,Mn(aa,H,ee)):te?A.start(te,()=>{ve&&n.setOpen(!0,Mn(aa,H,ee))}):ve&&n.setOpen(!0,Mn(aa,H,ee))}function G(H){if(z()){W();return}T.current();const te=n.select("domReferenceElement"),re=Mr(te);P.clear(),R.current=!1;const ue=n.context.triggerElements;if(H.relatedTarget&&ue.hasElement(H.relatedTarget))return;if(N.current&&r.current.floatingContext){n.select("open")||A.clear();const ee=h.current;_.current=N.current({...r.current.floatingContext,tree:v,x:H.clientX,y:H.clientY,onClose(){W(),V(),!z()&&ee===n.select("domReferenceElement")&&F(H,!0)}});const le=_.current;le(H),re.addEventListener("mousemove",le),T.current=()=>{re.removeEventListener("mousemove",le)};return}(w.current!=="touch"||!On(n.select("floatingElement"),H.relatedTarget))&&F(H)}function Y(H){K(H)}return n.select("open")&&Q.addEventListener("mouseleave",Y),f&&Q.addEventListener("mousemove",O,{once:!0}),Q.addEventListener("mouseenter",O),Q.addEventListener("mouseleave",G),()=>{Q.removeEventListener("mouseleave",Y),f&&Q.removeEventListener("mousemove",O),Q.removeEventListener("mouseenter",O),Q.removeEventListener("mouseleave",G)}},[V,W,E,r,U,F,n,a,N,K,y,z,c,f,w,L,P,R,A,h,v,T,_]),x.useMemo(()=>{function Q(O){w.current=O.pointerType}return{onPointerDown:Q,onPointerEnter:Q,onMouseMove(O){const{nativeEvent:G}=O,Y=O.currentTarget,H=n.select("domReferenceElement"),te=n.context.triggerElements,re=n.select("open"),ue=(te.hasElement(O.target)||te.hasMatchingElement(ee=>On(ee,O.target)))&&(!H||!On(H,O.target));if(c&&!Ud(w.current)||re&&!ue||c_(L.current)===0||!ue&&R.current&&O.movementX**2+O.movementY**2<2)return;P.clear();function ce(){if(R.current=!1,z())return;const ee=n.select("open");!E.current&&(!ee||ue)&&n.setOpen(!0,Mn(aa,G,Y))}w.current==="touch"?gi.flushSync(()=>{ce()}):ue&&re?ce():(R.current=!0,P.start(c_(L.current),ce))}}},[E,z,c,n,w,L,P,R])}function iv(t=[]){const e=t.map(u=>u?.reference),n=t.map(u=>u?.floating),r=t.map(u=>u?.item),i=t.map(u=>u?.trigger),a=x.useCallback(u=>vg(u,t,"reference"),e),s=x.useCallback(u=>vg(u,t,"floating"),n),o=x.useCallback(u=>vg(u,t,"item"),r),c=x.useCallback(u=>vg(u,t,"trigger"),i);return x.useMemo(()=>({getReferenceProps:a,getFloatingProps:s,getItemProps:o,getTriggerProps:c}),[a,s,o,c])}function vg(t,e,n){const r=new Map,i=n==="item",a={};n==="floating"&&(a.tabIndex=-1,a[v1]="");for(const s in t)i&&t&&(s===h4||s===p4)||(a[s]=t[s]);for(let s=0;s<e.length;s+=1){let o;const c=e[s]?.[n];typeof c=="function"?o=t?c(t):null:o=c,o&&WR(a,o,i,r)}return WR(a,t,i,r),a}function WR(t,e,n,r){for(const i in e){const a=e[i];n&&(i===h4||i===p4)||(i.startsWith("on")?(r.has(i)||r.set(i,[]),typeof a=="function"&&(r.get(i)?.push(a),t[i]=(...s)=>r.get(i)?.map(o=>o(...s)).find(o=>o!==void 0))):t[i]=a)}}const Mte="Escape";function av(t,e,n){switch(t){case"vertical":return e;case"horizontal":return n;default:return e||n}}function xg(t,e){return av(e,t===hE||t===Np,t===El||t===Ml)}function u_(t,e,n){return av(e,t===Np,n?t===El:t===Ml)||t==="Enter"||t===" "||t===""}function Tte(t,e,n){return av(e,n?t===El:t===Ml,t===Np)}function Cte(t,e,n,r){const i=n?t===Ml:t===El,a=t===hE;return e==="both"||e==="horizontal"&&r&&r>1?t===Mte:av(e,i,a)}function Ate(t,e){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),i=n.useState("floatingElement"),a=n.useState("domReferenceElement"),s=n.context.dataRef,{listRef:o,activeIndex:c,onNavigate:u=()=>{},enabled:f=!0,selectedIndex:h=null,allowEscape:p=!1,loopFocus:y=!1,nested:v=!1,rtl:w=!1,virtual:b=!1,focusItemOnOpen:_="auto",focusItemOnHover:E=!0,openOnArrowKeyDown:M=!0,disabledIndices:T=void 0,orientation:R="vertical",parentOrientation:A,cols:P=1,scrollItemIntoView:k=!0,itemSizes:N,dense:U=!1,id:L,resetOnPointerLeave:z=!0,externalTree:F}=e,V=tp(i),W=Fr(V),K=jl(),Q=cu(F);Yt(()=>{s.current.orientation=R},[s,R]);const O=x1(a),G=x.useRef(_),Y=x.useRef(h??-1),H=x.useRef(null),te=x.useRef(!0),re=jt($=>{u(Y.current===-1?null:Y.current,$)}),ue=x.useRef(re),ce=x.useRef(!!i),ee=x.useRef(r),le=x.useRef(!1),ve=x.useRef(!1),Pe=Fr(T),be=Fr(r),Ye=Fr(k),he=Fr(h),Ue=Fr(z),je=jt(()=>{function $(Se){b?Q?.events.emit("virtualfocus",Se):g0(Se,{sync:le.current,preventScroll:!0})}const I=o.current[Y.current],Z=ve.current;I&&$(I),(le.current?Se=>Se():requestAnimationFrame)(()=>{const Se=o.current[Y.current]||I;if(!Se)return;I||$(Se);const xe=Ye.current;xe&&_e&&(Z||!te.current)&&Se.scrollIntoView?.(typeof xe=="boolean"?{block:"nearest",inline:"nearest"}:xe)})});Yt(()=>{f&&(r&&i?(Y.current=h??-1,G.current&&h!=null&&(ve.current=!0,re())):ce.current&&(Y.current=-1,ue.current()))},[f,r,i,h,re]),Yt(()=>{if(f){if(!r){le.current=!1;return}if(i)if(c==null){if(le.current=!1,he.current!=null)return;if(ce.current&&(Y.current=-1,je()),(!ee.current||!ce.current)&&G.current&&(H.current!=null||G.current===!0&&H.current==null)){let $=0;const I=()=>{o.current[0]==null?($<2&&($?requestAnimationFrame:queueMicrotask)(I),$+=1):(Y.current=H.current==null||u_(H.current,R,w)||v?t_(o):TR(o),H.current=null,re())};I()}}else Fh(o,c)||(Y.current=c,je(),ve.current=!1)}},[f,r,i,c,he,v,o,R,w,re,je,Pe]),Yt(()=>{if(!f||i||!Q||b||!ce.current)return;const $=Q.nodesRef.current,I=$.find(Se=>Se.id===K)?.context?.elements.floating,Z=gl(Mr(i)),pe=$.some(Se=>Se.context&&On(Se.context.elements.floating,Z));I&&!pe&&te.current&&I.focus({preventScroll:!0})},[f,i,Q,K,b]),Yt(()=>{ue.current=re,ee.current=r,ce.current=!!i}),Yt(()=>{r||(H.current=null,G.current=_)},[r,_]);const et=c!=null,_e=x.useMemo(()=>{function $(Z){if(!be.current)return;const pe=o.current.indexOf(Z.currentTarget);pe!==-1&&Y.current!==pe&&(Y.current=pe,re(Z))}return{onFocus(Z){le.current=!0,$(Z)},onClick:({currentTarget:Z})=>Z.focus({preventScroll:!0}),onMouseMove(Z){le.current=!0,ve.current=!1,E&&$(Z)},onPointerLeave(Z){if(!be.current||!te.current||Z.pointerType==="touch")return;le.current=!0;const pe=Z.relatedTarget;!E||o.current.includes(pe)||Ue.current&&(Y.current=-1,re(Z),b||W.current?.focus({preventScroll:!0}))}}},[be,W,E,o,re,Ue,b]),oe=x.useCallback(()=>A??Q?.nodesRef.current.find($=>$.id===K)?.context?.dataRef?.current.orientation,[K,Q,A]),J=jt($=>{if(te.current=!1,le.current=!0,$.which===229||!be.current&&$.currentTarget===W.current)return;if(v&&Cte($.key,R,w,P)){xg($.key,oe())||pi($),n.setOpen(!1,Mn(r_,$.nativeEvent)),Tr(a)&&(b?Q?.events.emit("virtualfocus",a):a.focus());return}const I=Y.current,Z=t_(o,T),pe=TR(o,T);if(O||($.key==="Home"&&(pi($),Y.current=Z,re($)),$.key==="End"&&(pi($),Y.current=pe,re($))),P>1){const Se=N||Array.from({length:o.current.length},()=>({width:1,height:1})),xe=UQ(Se,P,U),Ie=xe.findIndex(ft=>ft!=null&&!Uh(o,ft,T)),He=xe.reduce((ft,We,Xe)=>We!=null&&!Uh(o,We,T)?Xe:ft,-1),qe=xe[FQ({current:xe.map(ft=>ft!=null?o.current[ft]:null)},{event:$,orientation:R,loopFocus:y,rtl:w,cols:P,disabledIndices:BQ([...(typeof T!="function"?T:null)||o.current.map((ft,We)=>Uh(o,We,T)?We:void 0),void 0],xe),minIndex:Ie,maxIndex:He,prevIndex:jQ(Y.current>pe?Z:Y.current,Se,xe,P,$.key===Np?"bl":$.key===(w?El:Ml)?"tr":"tl"),stopEvent:!0})];if(qe!=null&&(Y.current=qe,re($)),R==="both")return}if(xg($.key,R)){if(pi($),r&&!b&&gl($.currentTarget.ownerDocument)===$.currentTarget){Y.current=u_($.key,R,w)?Z:pe,re($);return}u_($.key,R,w)?y?I>=pe?p&&I!==o.current.length?Y.current=-1:(le.current=!1,Y.current=Z):Y.current=fi(o,{startingIndex:I,disabledIndices:T}):Y.current=Math.min(pe,fi(o,{startingIndex:I,disabledIndices:T})):y?I<=Z?p&&I!==-1?Y.current=o.current.length:(le.current=!1,Y.current=pe):Y.current=fi(o,{startingIndex:I,decrement:!0,disabledIndices:T}):Y.current=Math.max(Z,fi(o,{startingIndex:I,decrement:!0,disabledIndices:T})),Fh(o,Y.current)&&(Y.current=-1),re($)}}),ze=x.useMemo(()=>b&&r&&et&&{"aria-activedescendant":`${L}-${c}`},[b,r,et,L,c]),Ne=x.useMemo(()=>({"aria-orientation":R==="both"?void 0:R,...O?{}:ze,onKeyDown($){if($.key==="Tab"&&$.shiftKey&&r&&!b){const I=Fi($.nativeEvent);if(I&&!On(W.current,I))return;pi($),n.setOpen(!1,Mn(Kc,$.nativeEvent)),Tr(a)&&a.focus();return}J($)},onPointerMove(){te.current=!0}}),[ze,J,W,R,O,n,r,b,a]),De=x.useMemo(()=>{function $(Z){_==="auto"&&y4(Z.nativeEvent)&&(G.current=!b)}function I(Z){G.current=_,_==="auto"&&v4(Z.nativeEvent)&&(G.current=!0)}return{onKeyDown(Z){const pe=n.select("open");te.current=!1;const Se=Z.key.startsWith("Arrow"),xe=Tte(Z.key,oe(),w),Ie=xg(Z.key,R),He=(v?xe:Ie)||Z.key==="Enter"||Z.key.trim()==="";if(b&&pe)return J(Z);if(!(!pe&&!M&&Se)){if(He){const qe=xg(Z.key,oe());H.current=v&&qe?null:Z.key}if(v){xe&&(pi(Z),pe?(Y.current=t_(o,Pe.current),re(Z)):n.setOpen(!0,Mn(r_,Z.nativeEvent,Z.currentTarget)));return}Ie&&(he.current!=null&&(Y.current=he.current),pi(Z),!pe&&M?n.setOpen(!0,Mn(r_,Z.nativeEvent,Z.currentTarget)):J(Z),pe&&re(Z))}},onFocus(Z){n.select("open")&&!b&&(Y.current=-1,re(Z))},onPointerDown:I,onPointerEnter:I,onMouseDown:$,onClick:$}},[J,Pe,_,o,v,re,n,M,R,oe,w,he,b]),Le=x.useMemo(()=>({...ze,...De}),[ze,De]);return x.useMemo(()=>f?{reference:Le,floating:Ne,item:_e,trigger:De}:{},[f,Le,Ne,De,_e])}const Rte=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function nF(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),i=n.useState("floatingId"),a=n.useState("domReferenceElement"),s=n.useState("floatingElement"),{enabled:o=!0,role:c="dialog"}=e,u=sf(),f=a?.id||u,h=x.useMemo(()=>tp(s)?.id||i,[s,i]),p=Rte.get(c)??c,v=jl()!=null,w=x.useMemo(()=>p==="tooltip"||c==="label"?ei:{"aria-haspopup":p==="alertdialog"?"dialog":p,"aria-expanded":"false",...p==="listbox"&&{role:"combobox"},...p==="menu"&&v&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[p,v,c]),b=x.useMemo(()=>p==="tooltip"||c==="label"?{[`aria-${c==="label"?"labelledby":"describedby"}`]:r?h:void 0}:{...w,"aria-expanded":r?"true":"false","aria-controls":r?h:void 0,...p==="menu"&&{id:f}},[p,h,r,f,c,w]),_=x.useMemo(()=>{const M={id:h,...p&&{role:p}};return p==="tooltip"||c==="label"?M:{...M,...p==="menu"&&{"aria-labelledby":f}}},[p,h,f,c]),E=x.useCallback(({active:M,selected:T})=>{const R={role:"option",...M&&{id:`${h}-fui-option`}};switch(c){case"select":case"combobox":return{...R,"aria-selected":T}}return{}},[h,c]);return x.useMemo(()=>o?{reference:b,floating:_,item:E,trigger:w}:{},[o,b,_,w,E])}function Pte(t,e){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),i=n.context.dataRef,{listRef:a,activeIndex:s,onMatch:o,onTypingChange:c,enabled:u=!0,findMatch:f=null,resetMs:h=750,ignoreKeys:p=g1,selectedIndex:y=null}=e,v=ji(),w=x.useRef(""),b=x.useRef(y??s??-1),_=x.useRef(null);Yt(()=>{r&&(v.clear(),_.current=null,w.current="")},[r,v]),Yt(()=>{r&&w.current===""&&(b.current=y??s??-1)},[r,y,s]);const E=jt(A=>{A?i.current.typing||(i.current.typing=A,c?.(A)):i.current.typing&&(i.current.typing=A,c?.(A))}),M=jt(A=>{function P(z,F,V){const W=f?f(F,V):F.find(K=>K?.toLocaleLowerCase().indexOf(V.toLocaleLowerCase())===0);return W?z.indexOf(W):-1}const k=a.current;if(w.current.length>0&&w.current[0]!==" "&&(P(k,k,w.current)===-1?E(!1):A.key===" "&&pi(A)),k==null||p.includes(A.key)||A.key.length!==1||A.ctrlKey||A.metaKey||A.altKey)return;r&&A.key!==" "&&(pi(A),E(!0)),k.every(z=>z?z[0]?.toLocaleLowerCase()!==z[1]?.toLocaleLowerCase():!0)&&w.current===A.key&&(w.current="",b.current=_.current),w.current+=A.key,v.start(h,()=>{w.current="",b.current=_.current,E(!1)});const U=b.current,L=P(k,[...k.slice((U||0)+1),...k.slice(0,(U||0)+1)],w.current);L!==-1?(o?.(L),_.current=L):A.key!==" "&&(w.current="",E(!1))}),T=x.useMemo(()=>({onKeyDown:M}),[M]),R=x.useMemo(()=>({onKeyDown:M,onKeyUp(A){A.key===" "&&E(!1)}}),[M,E]);return x.useMemo(()=>u?{reference:T,floating:R}:{},[u,T,R])}function GR(t,e){const[n,r]=t;let i=!1;const a=e.length;for(let s=0,o=a-1;s<a;o=s++){const[c,u]=e[s]||[0,0],[f,h]=e[o]||[0,0];u>=r!=h>=r&&n<=(f-c)*(r-u)/(h-u)+c&&(i=!i)}return i}function Nte(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function Dte(t={}){const{buffer:e=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=t,i=new Nl;let a=!1,s=null,o=null,c=typeof performance<"u"?performance.now():0;function u(h,p){const y=performance.now(),v=y-c;if(s===null||o===null||v===0)return s=h,o=p,c=y,null;const w=h-s,b=p-o,E=Math.sqrt(w*w+b*b)/v;return s=h,o=p,c=y,E}const f=({x:h,y:p,placement:y,elements:v,onClose:w,nodeId:b,tree:_})=>function(M){function T(){i.clear(),w()}if(i.clear(),!v.domReference||!v.floating||y==null||h==null||p==null)return;const{clientX:R,clientY:A}=M,P=[R,A],k=Fi(M),N=M.type==="mouseleave",U=On(v.floating,k),L=On(v.domReference,k),z=v.domReference.getBoundingClientRect(),F=v.floating.getBoundingClientRect(),V=y.split("-")[0],W=h>F.right-F.width/2,K=p>F.bottom-F.height/2,Q=Nte(P,z),O=F.width>z.width,G=F.height>z.height,Y=(O?z:F).left,H=(O?z:F).right,te=(G?z:F).top,re=(G?z:F).bottom;if(U&&(a=!0,!N))return;if(L&&(a=!1),L&&!N){a=!0;return}if(N&&Kn(M.relatedTarget)&&On(v.floating,M.relatedTarget)||_&&Uc(_.nodesRef.current,b).some(({context:ee})=>ee?.open))return;if(V==="top"&&p>=z.bottom-1||V==="bottom"&&p<=z.top+1||V==="left"&&h>=z.right-1||V==="right"&&h<=z.left+1)return T();let ue=[];switch(V){case"top":ue=[[Y,z.top+1],[Y,F.bottom-1],[H,F.bottom-1],[H,z.top+1]];break;case"bottom":ue=[[Y,F.top+1],[Y,z.bottom-1],[H,z.bottom-1],[H,F.top+1]];break;case"left":ue=[[F.right-1,re],[F.right-1,te],[z.left+1,te],[z.left+1,re]];break;case"right":ue=[[z.right-1,re],[z.right-1,te],[F.left+1,te],[F.left+1,re]];break}function ce([ee,le]){switch(V){case"top":{const ve=[O?ee+e/2:W?ee+e*4:ee-e*4,le+e+1],Pe=[O?ee-e/2:W?ee+e*4:ee-e*4,le+e+1],be=[[F.left,W||O?F.bottom-e:F.top],[F.right,W?O?F.bottom-e:F.top:F.bottom-e]];return[ve,Pe,...be]}case"bottom":{const ve=[O?ee+e/2:W?ee+e*4:ee-e*4,le-e],Pe=[O?ee-e/2:W?ee+e*4:ee-e*4,le-e],be=[[F.left,W||O?F.top+e:F.bottom],[F.right,W?O?F.top+e:F.bottom:F.top+e]];return[ve,Pe,...be]}case"left":{const ve=[ee+e+1,G?le+e/2:K?le+e*4:le-e*4],Pe=[ee+e+1,G?le-e/2:K?le+e*4:le-e*4];return[...[[K||G?F.right-e:F.left,F.top],[K?G?F.right-e:F.left:F.right-e,F.bottom]],ve,Pe]}case"right":{const ve=[ee-e,G?le+e/2:K?le+e*4:le-e*4],Pe=[ee-e,G?le-e/2:K?le+e*4:le-e*4],be=[[K||G?F.left+e:F.right,F.top],[K?G?F.left+e:F.right:F.left+e,F.bottom]];return[ve,Pe,...be]}default:return[]}}if(!GR([R,A],ue)){if(a&&!Q)return T();if(!N&&r){const ee=u(M.clientX,M.clientY);if(ee!==null&&ee<.1)return T()}GR([R,A],ce([h,p]))?!a&&r&&i.start(40,T):T()}};return f.__options={blockPointerEvents:n},f}const rF=x.createContext(null),iF=x.createContext(null);function Bl(){const t=x.useContext(rF);if(t===null)throw new Error(Wi(60));return t}function aF(){const t=x.useContext(iF);if(t===null)throw new Error(Wi(61));return t}let $R=(function(t){return t.disabled="data-disabled",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t})({});const Lte={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ite={valid(t){return t===null?null:t?{[$R.valid]:""}:{[$R.invalid]:""}}},Ote=x.createContext({invalid:void 0,name:void 0,validityData:{state:Lte,errors:[],error:"",value:"",initialValue:null},setValidityData:sa,disabled:void 0,touched:!1,setTouched:sa,dirty:!1,setDirty:sa,filled:!1,setFilled:sa,focused:!1,setFocused:sa,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:(t=ei)=>t,getInputValidationProps:(t=ei)=>t,inputRef:{current:null},commit:async()=>{}}});function ME(t=!0){const e=x.useContext(Ote);if(e.setValidityData===sa&&!t)throw new Error(Wi(28));return e}function sv(t){return sf(t,"base-ui")}const Fte=x.createContext({controlId:void 0,setControlId:sa,labelId:void 0,setLabelId:sa,messageIds:[],setMessageIds:sa,getDescriptionProps:t=>t});function sF(){return x.useContext(Fte)}function oF(t={}){const{id:e,implicit:n=!1,controlRef:r}=t,{controlId:i,setControlId:a}=sF(),s=sv(e);return Yt(()=>{if(!(!n&&!e||a===sa)){if(n){const o=r?.current;Kn(o)&&o.closest("label")!=null?a(e??null):a(i??s)}else e&&a(e);return()=>{e&&a(void 0)}}},[e,r,i,a,n,s]),i??s}const Ute=(t,e)=>Object.is(t,e);function Vd(t,e,n){return t==null||e==null?Object.is(t,e):n(t,e)}function d_(t,e,n){return!t||t.length===0?!1:t.some(r=>r===void 0?!1:Vd(r,e,n))}function E1(t,e,n){return!t||t.length===0?-1:t.findIndex(r=>r===void 0?!1:Vd(r,e,n))}function jte(t,e,n){return t.filter(r=>!Vd(r,e,n))}function M1(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function lF(t){return t!=null&&t.length>0&&typeof t[0]=="object"&&t[0]!=null&&"items"in t[0]}function Bte(t){if(!Array.isArray(t))return t!=null&&!("null"in t);if(lF(t)){for(const e of t)for(const n of e.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(const e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function zte(t,e){if(e&&t!=null)return e(t)??"";if(t&&typeof t=="object"){if("label"in t&&t.label!=null)return String(t.label);if("value"in t)return String(t.value)}return M1(t)}function pd(t,e){return e&&t!=null?e(t)??"":t&&typeof t=="object"&&"value"in t&&"label"in t?M1(t.value):M1(t)}function cF(t,e,n){function r(){return zte(t,n)}if(n&&t!=null)return n(t);if(t&&typeof t=="object"&&"label"in t&&t.label!=null)return t.label;if(e&&!Array.isArray(e))return e[t]??r();if(Array.isArray(e)){const i=lF(e)?e.flatMap(a=>a.items):e;if(t==null||typeof t!="object"){const a=i.find(s=>s.value===t);return a&&a.label!=null?a.label:r()}if("value"in t){const a=i.find(s=>s&&s.value===t.value);if(a&&a.label!=null)return a.label}}return r()}function Vte(t,e,n){return t.reduce((r,i,a)=>(a>0&&r.push(", "),r.push(m.jsx(x.Fragment,{children:cF(i,e,n)},a)),r),[])}const fn={id:At(t=>t.id),modal:At(t=>t.modal),multiple:At(t=>t.multiple),items:At(t=>t.items),itemToStringLabel:At(t=>t.itemToStringLabel),itemToStringValue:At(t=>t.itemToStringValue),isItemEqualToValue:At(t=>t.isItemEqualToValue),value:At(t=>t.value),hasSelectedValue:At(t=>{const{value:e,multiple:n,itemToStringValue:r}=t;return e==null?!1:n&&Array.isArray(e)?e.length>0:pd(e,r)!==""}),hasNullItemLabel:At((t,e)=>e?Bte(t.items):!1),open:At(t=>t.open),mounted:At(t=>t.mounted),forceMount:At(t=>t.forceMount),transitionStatus:At(t=>t.transitionStatus),openMethod:At(t=>t.openMethod),activeIndex:At(t=>t.activeIndex),selectedIndex:At(t=>t.selectedIndex),isActive:At((t,e)=>t.activeIndex===e),isSelected:At((t,e,n)=>{const r=t.isItemEqualToValue,i=t.value;return t.multiple?Array.isArray(i)&&i.some(a=>Vd(a,n,r)):t.selectedIndex===e&&t.selectedIndex!==null?!0:Vd(i,n,r)}),isSelectedByFocus:At((t,e)=>t.selectedIndex===e),popupProps:At(t=>t.popupProps),triggerProps:At(t=>t.triggerProps),triggerElement:At(t=>t.triggerElement),positionerElement:At(t=>t.positionerElement),listElement:At(t=>t.listElement),scrollUpArrowVisible:At(t=>t.scrollUpArrowVisible),scrollDownArrowVisible:At(t=>t.scrollDownArrowVisible),hasScrollArrows:At(t=>t.hasScrollArrows)},Hte=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:sa,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function uF(){return x.useContext(Hte)}function Wte(t,e){return{...t,state:{...t.state,valid:!e&&t.state.valid}}}function Gte(t){const{enabled:e=!0,value:n,id:r,name:i,controlRef:a,commit:s}=t,{formRef:o}=uF(),{invalid:c,markedDirtyRef:u,validityData:f,setValidityData:h}=ME(),p=jt(t.getValue);Yt(()=>{if(!e)return;let y=n;y===void 0&&(y=p()),f.initialValue===null&&y!==null&&h(v=>({...v,initialValue:y}))},[e,h,n,f.initialValue,p]),Yt(()=>{!e||!r||o.current.fields.set(r,{getValue:p,name:i,controlRef:a,validityData:Wte(f,c),validate(y=!0){let v=n;v===void 0&&(v=p()),u.current=!0,y?gi.flushSync(()=>s(v)):s(v)}})},[s,a,e,o,p,r,c,u,i,f,n]),Yt(()=>{const y=o.current.fields;return()=>{r&&y.delete(r)}},[o,r])}function $te(t,e){const n=x.useRef(t),r=jt(e);Yt(()=>{n.current!==t&&r(n.current)},[t,r]),Yt(()=>{n.current=t},[t])}function Yte(t){const e=x.useRef(""),n=x.useCallback(i=>{i.defaultPrevented||(e.current=i.pointerType,t(i,i.pointerType))},[t]);return{onClick:x.useCallback(i=>{if(i.detail===0){t(i,"keyboard");return}"pointerType"in i&&t(i,i.pointerType),t(i,e.current),e.current=""},[t]),onPointerDown:n}}function TE(t){const[e,n]=x.useState(null),r=jt((o,c)=>{t||n(c||(f4?"touch":""))}),i=x.useCallback(()=>{n(null)},[]),{onClick:a,onPointerDown:s}=Yte(r);return x.useMemo(()=>({openMethod:e,reset:i,triggerProps:{onClick:a,onPointerDown:s}}),[e,i,a,s])}function qte(t){const{id:e,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:s=!1,onOpenChange:o,name:c,disabled:u=!1,readOnly:f=!1,required:h=!1,modal:p=!0,actionsRef:y,inputRef:v,onOpenChangeComplete:w,items:b,multiple:_=!1,itemToStringLabel:E,itemToStringValue:M,isItemEqualToValue:T=Ute,highlightItemOnHover:R=!0,children:A}=t,{clearErrors:P}=uF(),{setDirty:k,setTouched:N,setFocused:U,shouldValidateOnChange:L,validityData:z,setFilled:F,name:V,disabled:W,validation:K,validationMode:Q}=ME(),O=oF({id:e}),G=W||u,Y=V??c,[H,te]=yR({controlled:n,default:_?r??g1:r,name:"Select",state:"value"}),[re,ue]=yR({controlled:a,default:s,name:"Select",state:"open"}),ce=x.useRef([]),ee=x.useRef([]),le=x.useRef(null),ve=x.useRef(null),Pe=x.useRef(0),be=x.useRef(null),Ye=x.useRef([]),he=x.useRef(!1),Ue=x.useRef(!1),je=x.useRef(null),et=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),_e=x.useRef(!1),{mounted:oe,setMounted:J,transitionStatus:ze}=EE(re),{openMethod:Ne,triggerProps:De,reset:Le}=TE(re),$=Vi(()=>new Ed({id:O,modal:p,multiple:_,itemToStringLabel:E,itemToStringValue:M,isItemEqualToValue:T,value:H,open:re,mounted:oe,transitionStatus:ze,items:b,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,I=mn($,fn.activeIndex),Z=mn($,fn.selectedIndex),pe=mn($,fn.triggerElement),Se=mn($,fn.positionerElement),xe=x.useMemo(()=>_&&Array.isArray(H)&&H.length===0?"":pd(H,M),[_,H,M]),Ie=x.useMemo(()=>_&&Array.isArray(H)?H.map(St=>pd(St,M)):pd(H,M),[_,H,M]),He=Fr($.state.triggerElement);Gte({id:O,commit:K.commit,value:H,controlRef:He,name:Y,getValue:()=>Ie});const qe=x.useRef(H);Yt(()=>{H!==qe.current&&$.set("forceMount",!0)},[$,H]),Yt(()=>{F(_?Array.isArray(H)&&H.length>0:H!=null)},[_,H,F]),Yt(function(){if(re)return;const Rt=Ye.current;if(_){const xn=Array.isArray(H)?H:[];if(xn.length===0){$.set("selectedIndex",null);return}const ie=xn[xn.length-1],fe=E1(Rt,ie,T);$.set("selectedIndex",fe===-1?null:fe);return}const hn=E1(Rt,H,T);$.set("selectedIndex",hn===-1?null:hn)},[_,re,H,Ye,T,$]),$te(H,()=>{P(Y),k(H!==z.initialValue),L()?K.commit(H):K.commit(H,!0)});const ft=jt((St,Rt)=>{if(o?.(St,Rt),!Rt.isCanceled&&(ue(St),!St&&(Rt.reason===Kc||Rt.reason===vE)&&(N(!0),U(!1),Q==="onBlur"&&K.commit(H)),!St&&$.state.activeIndex!==null)){const hn=ce.current[$.state.activeIndex];queueMicrotask(()=>{hn?.setAttribute("tabindex","-1")})}}),We=jt(()=>{J(!1),$.set("activeIndex",null),Le(),w?.(!1)});lf({enabled:!y,open:re,ref:le,onComplete(){re||We()}}),x.useImperativeHandle(y,()=>({unmount:We}),[We]);const Xe=jt((St,Rt)=>{i?.(St,Rt),!Rt.isCanceled&&te(St)}),nt=jt(()=>{const St=$.state.listElement||le.current;if(!St)return;const Rt=St.scrollTop,hn=St.scrollTop+St.clientHeight,xn=Rt>1,ie=hn<St.scrollHeight-1;$.state.scrollUpArrowVisible!==xn&&$.set("scrollUpArrowVisible",xn),$.state.scrollDownArrowVisible!==ie&&$.set("scrollDownArrowVisible",ie)}),ct=Q4({open:re,onOpenChange:ft,elements:{reference:pe,floating:Se}}),Ke=j4(ct,{enabled:!f&&!G,event:"mousedown"}),gt=SE(ct,{bubbles:!1}),ne=Ate(ct,{enabled:!f&&!G,listRef:ce,activeIndex:I,selectedIndex:Z,disabledIndices:g1,onNavigate(St){St===null&&!re||$.set("activeIndex",St)},focusItemOnHover:!1}),Be=Pte(ct,{enabled:!f&&!G&&(re||!_),listRef:ee,activeIndex:I,selectedIndex:Z,onMatch(St){re?$.set("activeIndex",St):Xe(Ye.current[St],Mn("none"))},onTypingChange(St){he.current=St}}),{getReferenceProps:ke,getFloatingProps:Ae,getItemProps:Ve}=iv([Ke,gt,ne,Be]),ge=x.useMemo(()=>Jy(ke(),De,O?{id:O}:ei),[ke,De,O]);YJ(()=>{$.update({popupProps:Ae(),triggerProps:ge})}),Yt(()=>{$.update({id:O,modal:p,multiple:_,value:H,open:re,mounted:oe,transitionStatus:ze,popupProps:Ae(),triggerProps:ge,items:b,itemToStringLabel:E,itemToStringValue:M,isItemEqualToValue:T,openMethod:Ne})},[$,O,p,_,H,re,oe,ze,Ae,ge,b,E,M,T,Ne]);const ht=x.useMemo(()=>({store:$,name:Y,required:h,disabled:G,readOnly:f,multiple:_,itemToStringLabel:E,itemToStringValue:M,highlightItemOnHover:R,setValue:Xe,setOpen:ft,listRef:ce,popupRef:le,scrollHandlerRef:ve,handleScrollArrowVisibility:nt,scrollArrowsMountedCountRef:Pe,getItemProps:Ve,events:ct.context.events,valueRef:be,valuesRef:Ye,labelsRef:ee,typingRef:he,selectionRef:et,selectedItemTextRef:je,validation:K,onOpenChangeComplete:w,keyboardActiveRef:Ue,alignItemWithTriggerActiveRef:_e,initialValueRef:qe}),[$,Y,h,G,f,_,E,M,R,Xe,ft,Ve,ct.context.events,K,w,nt]),bt=Fd(v,K.inputRef),Kt=_&&Array.isArray(H)&&H.length>0,Bt=x.useMemo(()=>!_||!Array.isArray(H)||!Y?null:H.map(St=>{const Rt=pd(St,M);return m.jsx("input",{type:"hidden",name:Y,value:Rt},Rt)}),[_,H,Y,M]);return m.jsx(rF.Provider,{value:ht,children:m.jsxs(iF.Provider,{value:ct,children:[A,m.jsx("input",{...K.getInputValidationProps({onFocus(){$.state.triggerElement?.focus({focusVisible:!0})},onChange(St){if(St.nativeEvent.defaultPrevented)return;const Rt=St.target.value,hn=Mn(tv,St.nativeEvent);function xn(){if(_)return;const ie=Ye.current.find(fe=>pd(fe,M).toLowerCase()===Rt.toLowerCase());ie!=null&&(k(ie!==z.initialValue),Xe(ie,hn),L()&&K.commit(ie))}$.set("forceMount",!0),queueMicrotask(xn)}}),name:_?void 0:Y,value:xe,disabled:G,required:h&&!Kt,readOnly:f,ref:bt,style:Y?$J:uE,tabIndex:-1,"aria-hidden":!0}),Bt]})})}let Za=(function(t){return t.open="data-open",t.closed="data-closed",t[t.startingStyle=rp.startingStyle]="startingStyle",t[t.endingStyle=rp.endingStyle]="endingStyle",t.anchorHidden="data-anchor-hidden",t})({}),T1=(function(t){return t.popupOpen="data-popup-open",t.pressed="data-pressed",t})({});const Xte={[T1.popupOpen]:""},Kte={[T1.popupOpen]:"",[T1.pressed]:""},Zte={[Za.open]:""},Jte={[Za.closed]:""},Qte={[Za.anchorHidden]:""},dF={open(t){return t?Xte:null}},fF={open(t){return t?Kte:null}},uu={open(t){return t?Zte:Jte},anchorHidden(t){return t?Qte:null}};function ene(t){const e=t.getBoundingClientRect(),n=window.getComputedStyle(t,"::before"),r=window.getComputedStyle(t,"::after");if(!(n.content!=="none"||r.content!=="none"))return e;const a=parseFloat(n.width)||0,s=parseFloat(n.height)||0,o=parseFloat(r.width)||0,c=parseFloat(r.height)||0,u=Math.max(e.width,a,o),f=Math.max(e.height,s,c),h=u-e.width,p=f-e.height;return{left:e.left-h/2,right:e.right+h/2,top:e.top-p/2,bottom:e.bottom+p/2}}const bg=2,tne=400,YR=200,nne={...fF,...Ite,value:()=>null},rne=x.forwardRef(function(e,n){const{render:r,className:i,id:a,disabled:s=!1,nativeButton:o=!0,...c}=e,{setTouched:u,setFocused:f,validationMode:h,state:p,disabled:y}=ME(),{labelId:v}=sF(),{store:w,setOpen:b,selectionRef:_,validation:E,readOnly:M,required:T,alignItemWithTriggerActiveRef:R,disabled:A,keyboardActiveRef:P}=Bl(),k=y||A||s,N=mn(w,fn.open),U=mn(w,fn.value),L=mn(w,fn.triggerProps),z=mn(w,fn.positionerElement),F=mn(w,fn.listElement),V=mn(w,fn.id),W=mn(w,fn.hasSelectedValue),K=!W&&N,Q=mn(w,fn.hasNullItemLabel,K),O=a??V;oF({id:O});const G=Fr(z),Y=x.useRef(null),{getButtonProps:H,buttonRef:te}=Qy({disabled:k,native:o}),re=jt(he=>{w.set("triggerElement",he)}),ue=Fd(n,Y,te,re),ce=ji(),ee=ji(),le=ji(),ve=ji();x.useEffect(()=>{if(N)return!(W||Q)?le.start(tne,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}):ve.start(YR,()=>{_.current.allowUnselectedMouseUp=!0,le.start(YR,()=>{_.current.allowSelectedMouseUp=!0})}),()=>{le.clear(),ve.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},ee.clear()},[N,W,Q,_,ee,le,ve]);const Pe=x.useMemo(()=>F?.id??tp(z)?.id,[F,z]),be=Jy(L,{id:O,role:"combobox","aria-expanded":N?"true":"false","aria-haspopup":"listbox","aria-controls":N?Pe:void 0,"aria-labelledby":v,"aria-readonly":M||void 0,"aria-required":T||void 0,tabIndex:k?-1:0,ref:ue,onFocus(he){f(!0),N&&R.current&&b(!1,Mn(tv,he.nativeEvent)),ce.start(0,()=>{w.set("forceMount",!0)})},onBlur(he){On(z,he.relatedTarget)||(u(!0),f(!1),h==="onBlur"&&E.commit(U))},onPointerMove(){P.current=!1},onKeyDown(){P.current=!0},onMouseDown(he){if(N)return;const Ue=zs(he.currentTarget);function je(et){if(!Y.current)return;const _e=et.target;if(On(Y.current,_e)||On(G.current,_e)||_e===Y.current)return;const oe=ene(Y.current);et.clientX>=oe.left-bg&&et.clientX<=oe.right+bg&&et.clientY>=oe.top-bg&&et.clientY<=oe.bottom+bg||b(!1,Mn(fee,et))}ee.start(0,()=>{Ue.addEventListener("mouseup",je,{once:!0})})}},E.getValidationProps,c,H);be.role="combobox";const Ye=x.useMemo(()=>({...p,open:N,disabled:k,value:U,readOnly:M,placeholder:!W}),[p,N,k,U,M,W]);return Xr("button",e,{ref:[n,Y],state:Ye,stateAttributesMapping:nne,props:be})}),ine={value:()=>null},ane=x.forwardRef(function(e,n){const{className:r,render:i,children:a,placeholder:s,...o}=e,{store:c,valueRef:u}=Bl(),f=mn(c,fn.value),h=mn(c,fn.items),p=mn(c,fn.itemToStringLabel),y=mn(c,fn.hasSelectedValue),v=!y&&s!=null&&a==null,w=mn(c,fn.hasNullItemLabel,v),b=x.useMemo(()=>({value:f,placeholder:!y}),[f,y]);let _=null;return typeof a=="function"?_=a(f):a!=null?_=a:!y&&s!=null&&!w?_=s:Array.isArray(f)?_=Vte(f,h,p):_=cF(f,h,p),Xr("span",e,{state:b,ref:[n,u],props:[{children:_},o],stateAttributesMapping:ine})}),sne=x.forwardRef(function(e,n){const{className:r,render:i,...a}=e,{store:s}=Bl(),o=mn(s,fn.open),c=x.useMemo(()=>({open:o}),[o]);return Xr("span",e,{state:c,ref:n,props:[{"aria-hidden":!0,children:"▼"},a],stateAttributesMapping:dF})}),one=x.createContext(void 0),lne=x.forwardRef(function(e,n){const{store:r}=Bl(),i=mn(r,fn.mounted),a=mn(r,fn.forceMount);return i||a?m.jsx(one.Provider,{value:!0,children:m.jsx(xE,{ref:n,...e})}):null});function CE(t){return cE(19)?t:t?"true":void 0}let qR={},XR={},KR="";function cne(t){if(typeof document>"u")return!1;const e=zs(t);return Ar(e).innerWidth-e.documentElement.clientWidth>0}function une(t){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const r=zs(t).documentElement,i={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY};r.style.scrollbarGutter="stable",r.style.overflowY="scroll";const a=r.offsetWidth;r.style.overflowY="hidden";const s=r.offsetWidth;return Object.assign(r.style,i),a===s}function dne(t){const e=zs(t),n=e.documentElement,r=e.body,i=lu(n)?n:r,a=i.style.overflow;return i.style.overflow="hidden",()=>{i.style.overflow=a}}function fne(t){const e=zs(t),n=e.documentElement,r=e.body,i=Ar(n);let a=0,s=0,o=!1;const c=Ss.create();if(d4&&(i.visualViewport?.scale??1)!==1)return()=>{};function u(){const p=i.getComputedStyle(n),y=i.getComputedStyle(r),b=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";a=n.scrollTop,s=n.scrollLeft,qR={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},KR=n.style.scrollBehavior,XR={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const _=n.scrollHeight>n.clientHeight,E=n.scrollWidth>n.clientWidth,M=p.overflowY==="scroll"||y.overflowY==="scroll",T=p.overflowX==="scroll"||y.overflowX==="scroll",R=Math.max(0,i.innerWidth-r.clientWidth),A=Math.max(0,i.innerHeight-r.clientHeight),P=parseFloat(y.marginTop)+parseFloat(y.marginBottom),k=parseFloat(y.marginLeft)+parseFloat(y.marginRight),N=lu(n)?n:r;if(o=une(t),o){n.style.scrollbarGutter=b,N.style.overflowY="hidden",N.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:b,overflowY:"hidden",overflowX:"hidden"}),(_||M)&&(n.style.overflowY="scroll"),(E||T)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:P||A?`calc(100dvh - ${P+A}px)`:"100dvh",width:k||R?`calc(100vw - ${k+R}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=a,r.scrollLeft=s,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function f(){Object.assign(n.style,qR),Object.assign(r.style,XR),o||(n.scrollTop=a,n.scrollLeft=s,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=KR)}function h(){f(),c.request(u)}return u(),i.addEventListener("resize",h),()=>{c.cancel(),f(),typeof i.removeEventListener=="function"&&i.removeEventListener("resize",h)}}class hne{lockCount=0;restore=null;timeoutLock=Nl.create();timeoutUnlock=Nl.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),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(e){if(this.lockCount===0||this.restore!==null)return;const r=zs(e).documentElement,i=Ar(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=sa;return}const a=f4||!cne(e);this.restore=a?dne(e):fne(e)}}const pne=new hne;function AE(t=!0,e=null){Yt(()=>{if(t)return pne.acquire(e)},[t,e])}const hF=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function mne(){return x.useContext(hF)}function gne(t){const{children:e,elementsRef:n,labelsRef:r,onMapChange:i}=t,a=jt(i),s=x.useRef(0),o=Vi(vne).current,c=Vi(yne).current,[u,f]=x.useState(0),h=x.useRef(u),p=jt((_,E)=>{c.set(_,E??null),h.current+=1,f(h.current)}),y=jt(_=>{c.delete(_),h.current+=1,f(h.current)}),v=x.useMemo(()=>{const _=new Map;return Array.from(c.keys()).filter(M=>M.isConnected).sort(xne).forEach((M,T)=>{const R=c.get(M)??{};_.set(M,{...R,index:T})}),_},[c,u]);Yt(()=>{if(typeof MutationObserver!="function"||v.size===0)return;const _=new MutationObserver(E=>{const M=new Set,T=R=>M.has(R)?M.delete(R):M.add(R);E.forEach(R=>{R.removedNodes.forEach(T),R.addedNodes.forEach(T)}),M.size===0&&(h.current+=1,f(h.current))});return v.forEach((E,M)=>{M.parentElement&&_.observe(M.parentElement,{childList:!0})}),()=>{_.disconnect()}},[v]),Yt(()=>{h.current===u&&(n.current.length!==v.size&&(n.current.length=v.size),r&&r.current.length!==v.size&&(r.current.length=v.size),s.current=v.size),a(v)},[a,v,n,r,u]),Yt(()=>()=>{n.current=[]},[n]),Yt(()=>()=>{r&&(r.current=[])},[r]);const w=jt(_=>(o.add(_),()=>{o.delete(_)}));Yt(()=>{o.forEach(_=>_(v))},[o,v]);const b=x.useMemo(()=>({register:p,unregister:y,subscribeMapChange:w,elementsRef:n,labelsRef:r,nextIndexRef:s}),[p,y,w,n,r,s]);return m.jsx(hF.Provider,{value:b,children:e})}function yne(){return new Map}function vne(){return new Set}function xne(t,e){const n=t.compareDocumentPosition(e);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 bne=x.createContext(void 0);function _ne(){return x.useContext(bne)?.direction??"ltr"}const wne=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:a,platform:s,elements:o,middlewareData:c}=e,{element:u,padding:f=0,offsetParent:h="real"}=Po(t,e)||{};if(u==null)return{};const p=b4(f),y={x:n,y:r},v=gE(i),w=mE(v),b=await s.getDimensions(u),_=v==="y",E=_?"top":"left",M=_?"bottom":"right",T=_?"clientHeight":"clientWidth",R=a.reference[w]+a.reference[v]-y[v]-a.floating[w],A=y[v]-a.reference[v],P=h==="real"?await s.getOffsetParent?.(u):o.floating;let k=o.floating[T]||a.floating[w];(!k||!await s.isElement?.(P))&&(k=o.floating[T]||a.floating[w]);const N=R/2-A/2,U=k/2-b[w]/2-1,L=Math.min(p[E],U),z=Math.min(p[M],U),F=L,V=k-b[w]-z,W=k/2-b[w]/2+N,K=b1(F,W,V),Q=!c.arrow&&Ul(i)!=null&&W!==K&&a.reference[w]/2-(W<F?L:z)-b[w]/2<0,O=Q?W<F?W-F:W-V:0;return{[v]:y[v]+O,data:{[v]:K,centerOffset:W-K-O,...Q&&{alignmentOffset:O}},reset:Q}}}),Sne=(t,e)=>({...wne(t),options:[t,e]}),kne={name:"hide",async fn(t){const{width:e,height:n,x:r,y:i}=t.rects.reference,a=e===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await cte().fn(t)).data?.referenceHidden||a}}}},v0={sideX:"left",sideY:"top"},Ene={name:"adaptiveOrigin",async fn(t){const{x:e,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:s,placement:o}=t,c=Ar(i),u=c.getComputedStyle(i);if(!(u.transitionDuration!=="0s"&&u.transitionDuration!==""))return{x:e,y:n,data:v0};const h=await a.getOffsetParent?.(i);let p={width:0,height:0};if(s==="fixed"&&c?.visualViewport)p={width:c.visualViewport.width,height:c.visualViewport.height};else if(h===c){const E=zs(i);p={width:E.documentElement.clientWidth,height:E.documentElement.clientHeight}}else await a.isElement?.(h)&&(p=await a.getDimensions(h));const y=Bi(o);let v=e,w=n;y==="left"&&(v=p.width-(e+r.width)),y==="top"&&(w=p.height-(n+r.height));const b=y==="left"?"right":v0.sideX,_=y==="top"?"bottom":v0.sideY;return{x:v,y:w,data:{sideX:b,sideY:_}}}};function pF(t,e,n){const r=t==="inline-start"||t==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[e]}function ZR(t,e,n){const{rects:r,placement:i}=t;return{side:pF(e,Bi(i),n),align:Ul(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function mF(t){const{anchor:e,positionMethod:n="absolute",side:r="bottom",sideOffset:i=0,align:a="center",alignOffset:s=0,collisionBoundary:o,collisionPadding:c=5,sticky:u=!1,arrowPadding:f=5,disableAnchorTracking:h=!1,keepMounted:p=!1,floatingRootContext:y,mounted:v,collisionAvoidance:w,shiftCrossAxis:b=!1,nodeId:_,adaptiveOrigin:E,lazyFlip:M=!1,externalTree:T}=t,[R,A]=x.useState(null);!v&&R!==null&&A(null);const P=w.side||"flip",k=w.align||"flip",N=w.fallbackAxisSide||"end",U=typeof e=="function"?e:void 0,L=jt(U),z=U?L:e,F=Fr(e),W=_ne()==="rtl",K=R||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":W?"left":"right","inline-start":W?"right":"left"}[r],Q=a==="center"?K:`${K}-${a}`;let O=c;const G=1,Y=r==="bottom"?G:0,H=r==="top"?G:0,te=r==="right"?G:0,re=r==="left"?G:0;typeof O=="number"?O={top:O+Y,right:O+re,bottom:O+H,left:O+te}:O&&(O={top:(O.top||0)+Y,right:(O.right||0)+re,bottom:(O.bottom||0)+H,left:(O.left||0)+te});const ue={boundary:o==="clipping-ancestors"?"clippingAncestors":o,padding:O},ce=x.useRef(null),ee=Fr(i),le=Fr(s),be=[ite(Ke=>{const gt=ZR(Ke,r,W),ne=typeof ee.current=="function"?ee.current(gt):ee.current,Be=typeof le.current=="function"?le.current(gt):le.current;return{mainAxis:ne,crossAxis:Be,alignmentAxis:Be}},[typeof i!="function"?i:0,typeof s!="function"?s:0,W,r])],Ye=k==="none"&&P!=="shift",he=!Ye&&(u||b||P==="shift"),Ue=P==="none"?null:ote({...ue,padding:{top:O.top+G,right:O.right+G,bottom:O.bottom+G,left:O.left+G},mainAxis:!b&&P==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:N}),je=Ye?null:ate(Ke=>{const gt=zs(Ke.elements.floating).documentElement;return{...ue,rootBoundary:b?{x:0,y:0,width:gt.clientWidth,height:gt.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:he,limiter:u||b?void 0:ste(ne=>{if(!ce.current)return{};const{width:Be,height:ke}=ce.current.getBoundingClientRect(),Ae=Ma(Bi(ne.placement)),Ve=Ae==="y"?Be:ke,ge=Ae==="y"?O.left+O.right:O.top+O.bottom;return{offset:Ve/2+ge/2}})}},[ue,u,b,O,k]);P==="shift"||k==="shift"||a==="center"?be.push(je,Ue):be.push(Ue,je),be.push(lte({...ue,apply({elements:{floating:Ke},rects:{reference:gt},availableWidth:ne,availableHeight:Be}){Object.entries({"--available-width":`${ne}px`,"--available-height":`${Be}px`,"--anchor-width":`${gt.width}px`,"--anchor-height":`${gt.height}px`}).forEach(([ke,Ae])=>{Ke.style.setProperty(ke,Ae)})}}),Sne(()=>({element:ce.current||document.createElement("div"),padding:f,offsetParent:"floating"}),[f]),{name:"transformOrigin",fn(Ke){const{elements:gt,middlewareData:ne,placement:Be,rects:ke,y:Ae}=Ke,Ve=Bi(Be),ge=Ma(Ve),ht=ce.current,bt=ne.arrow?.x||0,Kt=ne.arrow?.y||0,Bt=ht?.clientWidth||0,St=ht?.clientHeight||0,Rt=bt+Bt/2,hn=Kt+St/2,xn=Math.abs(ne.shift?.y||0),ie=ke.reference.height/2,fe=typeof i=="function"?i(ZR(Ke,r,W)):i,Te=xn>fe,$e={top:`${Rt}px calc(100% + ${fe}px)`,bottom:`${Rt}px ${-fe}px`,left:`calc(100% + ${fe}px) ${hn}px`,right:`${-fe}px ${hn}px`}[Ve],Ze=`${Rt}px ${ke.reference.y+ie-Ae}px`;return gt.floating.style.setProperty("--transform-origin",he&&ge==="y"&&Te?Ze:$e),{}}},kne,E),Yt(()=>{!v&&y&&y.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[v,y]);const et=x.useMemo(()=>({elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:_e,elements:oe,x:J,y:ze,middlewareData:Ne,update:De,placement:Le,context:$,isPositioned:I,floatingStyles:Z}=vte({rootContext:y,placement:Q,middleware:be,strategy:n,whileElementsMounted:p?void 0:(...Ke)=>VR(...Ke,et),nodeId:_,externalTree:T}),{sideX:pe,sideY:Se}=Ne.adaptiveOrigin||v0,xe=I?n:"fixed",Ie=x.useMemo(()=>E?{position:xe,[pe]:J,[Se]:ze}:{position:xe,...Z},[E,xe,pe,J,Se,ze,Z]),He=x.useRef(null);Yt(()=>{if(!v)return;const Ke=F.current,gt=typeof Ke=="function"?Ke():Ke,Be=(JR(gt)?gt.current:gt)||null||null;Be!==He.current&&(_e.setPositionReference(Be),He.current=Be)},[v,_e,z,F]),x.useEffect(()=>{if(!v)return;const Ke=F.current;typeof Ke!="function"&&JR(Ke)&&Ke.current!==He.current&&(_e.setPositionReference(Ke.current),He.current=Ke.current)},[v,_e,z,F]),x.useEffect(()=>{if(p&&v&&oe.domReference&&oe.floating)return VR(oe.domReference,oe.floating,De,et)},[p,v,oe,De,et]);const qe=Bi(Le),ft=pF(r,qe,W),We=Ul(Le)||"center",Xe=!!Ne.hide?.referenceHidden;Yt(()=>{M&&v&&I&&A(qe)},[M,v,I,qe]);const nt=x.useMemo(()=>({position:"absolute",top:Ne.arrow?.y,left:Ne.arrow?.x}),[Ne.arrow]),ct=Ne.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Ie,arrowStyles:nt,arrowRef:ce,arrowUncentered:ct,side:ft,align:We,physicalSide:qe,anchorHidden:Xe,refs:_e,context:$,isPositioned:I,update:De}),[Ie,nt,ce,ct,ft,We,qe,Xe,_e,$,I,De])}function JR(t){return t!=null&&"current"in t}const gF=x.createContext(void 0);function Mne(){const t=x.useContext(gF);if(!t)throw new Error(Wi(59));return t}const RE=x.forwardRef(function(e,n){const{cutout:r,...i}=e;let a;if(r){const s=r?.getBoundingClientRect();a=`polygon(
|
|
788
|
+
`),()=>{o.current?.removeAttribute("data-motion-pop-id"),R.contains(T)&&R.removeChild(T)}},[e]),m.jsx(rX,{isPresent:e,childRef:o,sizeRef:c,pop:a,children:a===!1?t:x.cloneElement(t,{ref:h})})}const aX=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:s,anchorX:o,anchorY:c,root:u})=>{const f=kp(sX),h=x.useId();let p=!0,y=x.useMemo(()=>(p=!1,{id:h,initial:e,isPresent:n,custom:i,onExitComplete:v=>{f.set(v,!0);for(const w of f.values())if(!w)return;r&&r()},register:v=>(f.set(v,!1),()=>f.delete(v))}),[n,f,r]);return a&&p&&(y={...y}),x.useMemo(()=>{f.forEach((v,w)=>f.set(w,!1))},[n]),x.useEffect(()=>{!n&&!f.size&&r&&r()},[n]),t=m.jsx(iX,{pop:s==="popLayout",isPresent:n,anchorX:o,anchorY:c,root:u,children:t}),m.jsx(Hy.Provider,{value:y,children:t})};function sX(){return new Map}function uO(t=!0){const e=x.useContext(Hy);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:i}=e,a=x.useId();x.useEffect(()=>{if(t)return i(a)},[t]);const s=x.useCallback(()=>t&&r&&r(a),[a,r,t]);return!n&&r?[!1,s]:[!0]}const og=t=>t.key||"";function zA(t){const e=[];return x.Children.forEach(t,n=>{x.isValidElement(n)&&e.push(n)}),e}const Ap=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a="sync",propagate:s=!1,anchorX:o="left",anchorY:c="top",root:u})=>{const[f,h]=uO(s),p=x.useMemo(()=>zA(t),[t]),y=s&&!f?[]:p.map(og),v=x.useRef(!0),w=x.useRef(p),b=kp(()=>new Map),_=x.useRef(new Set),[E,M]=x.useState(p),[T,R]=x.useState(p);Vy(()=>{v.current=!1,w.current=p;for(let k=0;k<T.length;k++){const N=og(T[k]);y.includes(N)?(b.delete(N),_.current.delete(N)):b.get(N)!==!0&&b.set(N,!1)}},[T,y.length,y.join("-")]);const A=[];if(p!==E){let k=[...p];for(let N=0;N<T.length;N++){const U=T[N],L=og(U);y.includes(L)||(k.splice(N,0,U),A.push(U))}return a==="wait"&&A.length&&(k=A),R(zA(k)),M(p),null}const{forceRender:P}=x.useContext(Xh);return m.jsx(m.Fragment,{children:T.map(k=>{const N=og(k),U=s&&!f?!1:p===T||y.includes(N),L=()=>{if(_.current.has(N))return;if(b.has(N))_.current.add(N),b.set(N,!0);else return;let z=!0;b.forEach(F=>{F||(z=!1)}),z&&(P?.(),R(w.current),s&&h?.(),r&&r())};return m.jsx(aX,{isPresent:U,initial:!v.current||n?void 0:!1,custom:e,presenceAffectsLayout:i,mode:a,root:u,onExitComplete:U?void 0:L,anchorX:o,anchorY:c,children:k},N)})})},oX=x.createContext(null);function lX(){const t=x.useRef(!1);return Vy(()=>(t.current=!0,()=>{t.current=!1}),[]),t}function cX(){const t=lX(),[e,n]=x.useState(0),r=x.useCallback(()=>{t.current&&n(e+1)},[e]);return[x.useCallback(()=>Wn.postRender(r),[r]),e]}const dO=t=>t===!0,uX=t=>dO(t===!0)||t==="id",dX=({children:t,id:e,inherit:n=!0})=>{const r=x.useContext(Xh),i=x.useContext(oX),[a,s]=cX(),o=x.useRef(null),c=r.id||i;o.current===null&&(uX(n)&&c&&(e=e?c+"-"+e:c),o.current={id:e,group:dO(n)&&r.group||jA()});const u=x.useMemo(()=>({...o.current,forceRender:a}),[s]);return m.jsx(Xh.Provider,{value:u,children:t})},fO=x.createContext({strict:!1}),VA={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let HA=!1;function fX(){if(HA)return;const t={};for(const e in VA)t[e]={isEnabled:n=>VA[e].some(r=>!!n[r])};BI(t),HA=!0}function hO(){return fX(),WY()}function hX(t){const e=hO();for(const n in t)e[n]={...e[n],...t[n]};BI(e)}const pX=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function ey(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||pX.has(t)}let pO=t=>!ey(t);function mX(t){typeof t=="function"&&(pO=e=>e.startsWith("on")?!ey(e):t(e))}try{mX(require("@emotion/is-prop-valid").default)}catch{}function gX(t,e,n){const r={};for(const i in t)i==="values"&&typeof t.values=="object"||Ur(t[i])||(pO(i)||n===!0&&ey(i)||!e&&!ey(i)||t.draggable&&i.startsWith("onDrag"))&&(r[i]=t[i]);return r}const Yy=x.createContext({});function yX(t,e){if($y(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Qh(n)?n:void 0,animate:Qh(r)?r:void 0}}return t.inherit!==!1?e:{}}function vX(t){const{initial:e,animate:n}=yX(t,x.useContext(Yy));return x.useMemo(()=>({initial:e,animate:n}),[WA(e),WA(n)])}function WA(t){return Array.isArray(t)?t.join(" "):t}const eE=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function mO(t,e,n){for(const r in e)!Ur(e[r])&&!YI(r,n)&&(t[r]=e[r])}function xX({transformTemplate:t},e){return x.useMemo(()=>{const n=eE();return Jk(n,e,t),Object.assign({},n.vars,n.style)},[e])}function bX(t,e){const n=t.style||{},r={};return mO(r,n,t),Object.assign(r,xX(t,e)),r}function _X(t,e){const n={},r=bX(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const gO=()=>({...eE(),attrs:{}});function wX(t,e,n,r){const i=x.useMemo(()=>{const a=gO();return qI(a,e,KI(r),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};mO(a,t.style,t),i.style={...a,...i.style}}return i}const SX=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function tE(t){return typeof t!="string"||t.includes("-")?!1:!!(SX.indexOf(t)>-1||/[A-Z]/u.test(t))}function kX(t,e,n,{latestValues:r},i,a=!1,s){const c=(s??tE(t)?wX:_X)(e,r,i,t),u=gX(e,typeof t=="string",a),f=t!==x.Fragment?{...u,...c,ref:n}:{},{children:h}=e,p=x.useMemo(()=>Ur(h)?h.get():h,[h]);return x.createElement(t,{...f,children:p})}function EX({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,i){return{latestValues:MX(n,r,i,t),renderState:e()}}function MX(t,e,n,r){const i={},a=r(t,{});for(const p in a)i[p]=p0(a[p]);let{initial:s,animate:o}=t;const c=$y(t),u=UI(t);e&&u&&!c&&t.inherit!==!1&&(s===void 0&&(s=e.initial),o===void 0&&(o=e.animate));let f=n?n.initial===!1:!1;f=f||s===!1;const h=f?o:s;if(h&&typeof h!="boolean"&&!Gy(h)){const p=Array.isArray(h)?h:[h];for(let y=0;y<p.length;y++){const v=Hk(t,p[y]);if(v){const{transitionEnd:w,transition:b,..._}=v;for(const E in _){let M=_[E];if(Array.isArray(M)){const T=f?M.length-1:0;M=M[T]}M!==null&&(i[E]=M)}for(const E in w)i[E]=w[E]}}}return i}const yO=t=>(e,n)=>{const r=x.useContext(Yy),i=x.useContext(Hy),a=()=>EX(t,e,r,i);return n?a():kp(a)},TX=yO({scrapeMotionValuesFromProps:Qk,createRenderState:eE}),CX=yO({scrapeMotionValuesFromProps:ZI,createRenderState:gO}),AX=Symbol.for("motionComponentSymbol");function RX(t,e,n){const r=x.useRef(n);x.useInsertionEffect(()=>{r.current=n});const i=x.useRef(null);return x.useCallback(a=>{a&&t.onMount?.(a);const s=r.current;if(typeof s=="function")if(a){const o=s(a);typeof o=="function"&&(i.current=o)}else i.current?(i.current(),i.current=null):s(a);else s&&(s.current=a);e&&(a?e.mount(a):e.unmount())},[e])}const vO=x.createContext({});function hd(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function PX(t,e,n,r,i,a){const{visualElement:s}=x.useContext(Yy),o=x.useContext(fO),c=x.useContext(Hy),u=x.useContext(Cp),f=u.reducedMotion,h=u.skipAnimations,p=x.useRef(null),y=x.useRef(!1);r=r||o.renderer,!p.current&&r&&(p.current=r(t,{visualState:e,parent:s,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:f,skipAnimations:h,isSVG:a}),y.current&&p.current&&(p.current.manuallyAnimateOnMount=!0));const v=p.current,w=x.useContext(vO);v&&!v.projection&&i&&(v.type==="html"||v.type==="svg")&&NX(p.current,n,i,w);const b=x.useRef(!1);x.useInsertionEffect(()=>{v&&b.current&&v.update(n,c)});const _=n[EI],E=x.useRef(!!_&&typeof window<"u"&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return Vy(()=>{y.current=!0,v&&(b.current=!0,window.MotionIsMounted=!0,v.updateFeatures(),v.scheduleRenderMicrotask(),E.current&&v.animationState&&v.animationState.animateChanges())}),x.useEffect(()=>{v&&(!E.current&&v.animationState&&v.animationState.animateChanges(),E.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),E.current=!1),v.enteringChildren=void 0)}),v}function NX(t,e,n,r){const{layoutId:i,layout:a,drag:s,dragConstraints:o,layoutScroll:c,layoutRoot:u,layoutAnchor:f,layoutCrossfade:h}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:xO(t.parent)),t.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!s||o&&hd(o),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:c,layoutRoot:u,layoutAnchor:f})}function xO(t){if(t)return t.options.allowProjection!==!1?t.projection:xO(t.parent)}function Ib(t,{forwardMotionProps:e=!1,type:n}={},r,i){r&&hX(r);const a=n?n==="svg":tE(t),s=a?CX:TX;function o(u,f){let h;const p={...x.useContext(Cp),...u,layoutId:DX(u)},{isStatic:y}=p,v=vX(u),w=s(u,y);if(!y&&typeof window<"u"){LX();const b=IX(p);h=b.MeasureLayout,v.visualElement=PX(t,w,p,i,b.ProjectionNode,a)}return m.jsxs(Yy.Provider,{value:v,children:[h&&v.visualElement?m.jsx(h,{visualElement:v.visualElement,...p}):null,kX(t,u,RX(w,v.visualElement,f),w,y,e,a)]})}o.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const c=x.forwardRef(o);return c[AX]=t,c}function DX({layoutId:t}){const e=x.useContext(Xh).id;return e&&t!==void 0?e+"-"+t:t}function LX(t,e){x.useContext(fO).strict}function IX(t){const e=hO(),{drag:n,layout:r}=e;if(!n&&!r)return{};const i={...n,...r};return{MeasureLayout:n?.isEnabled(t)||r?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function OX(t,e){if(typeof Proxy>"u")return Ib;const n=new Map,r=(a,s)=>Ib(a,s,t,e),i=(a,s)=>r(a,s);return new Proxy(i,{get:(a,s)=>s==="create"?r:(n.has(s)||n.set(s,Ib(s,void 0,t,e)),n.get(s))})}const FX=(t,e)=>e.isSVG??tE(t)?new oq(e):new tq(e,{allowProjection:t!==x.Fragment});class UX extends Il{constructor(e){super(e),e.animationState||(e.animationState=fq(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Gy(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let jX=0;class BX extends Il{constructor(){super(...arguments),this.id=jX++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&r===!1){if(this.isExitComplete){const{initial:a,custom:s}=this.node.getProps();if(typeof a=="string"){const o=Fc(this.node,a,s);if(o){const{transition:c,transitionEnd:u,...f}=o;for(const h in f)this.node.getValue(h)?.jump(f[h])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const i=this.node.animationState.setActive("exit",!e);n&&!e&&i.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const zX={animation:{Feature:UX},exit:{Feature:BX}};function Rp(t){return{point:{x:t.pageX,y:t.pageY}}}const VX=t=>e=>Yk(e)&&t(e,Rp(e));function Ih(t,e,n,r){return ep(t,e,VX(n),r)}const bO=({current:t})=>t?t.ownerDocument.defaultView:null,GA=(t,e)=>Math.abs(t-e);function HX(t,e){const n=GA(t.x,e.x),r=GA(t.y,e.y);return Math.sqrt(n**2+r**2)}const $A=new Set(["auto","scroll"]);class _O{constructor(e,n,{transformPagePoint:r,contextWindow:i=window,dragSnapToOrigin:a=!1,distanceThreshold:s=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=y=>{this.handleScroll(y.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=lg(this.lastRawMoveEventInfo,this.transformPagePoint));const y=Ob(this.lastMoveEventInfo,this.history),v=this.startEvent!==null,w=HX(y.offset,{x:0,y:0})>=this.distanceThreshold;if(!v&&!w)return;const{point:b}=y,{timestamp:_}=Qr;this.history.push({...b,timestamp:_});const{onStart:E,onMove:M}=this.handlers;v||(E&&E(this.lastMoveEvent,y),this.startEvent=this.lastMoveEvent),M&&M(this.lastMoveEvent,y)},this.handlePointerMove=(y,v)=>{this.lastMoveEvent=y,this.lastRawMoveEventInfo=v,this.lastMoveEventInfo=lg(v,this.transformPagePoint),Wn.update(this.updatePoint,!0)},this.handlePointerUp=(y,v)=>{this.end();const{onEnd:w,onSessionEnd:b,resumeAnimation:_}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&_&&_(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const E=Ob(y.type==="pointercancel"?this.lastMoveEventInfo:lg(v,this.transformPagePoint),this.history);this.startEvent&&w&&w(y,E),b&&b(y,E)},!Yk(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=s,this.contextWindow=i||window;const c=Rp(e),u=lg(c,this.transformPagePoint),{point:f}=u,{timestamp:h}=Qr;this.history=[{...f,timestamp:h}];const{onSessionStart:p}=n;p&&p(e,Ob(u,this.history)),this.removeListeners=Ep(Ih(this.contextWindow,"pointermove",this.handlePointerMove),Ih(this.contextWindow,"pointerup",this.handlePointerUp),Ih(this.contextWindow,"pointercancel",this.handlePointerUp)),o&&this.startScrollTracking(o)}startScrollTracking(e){let n=e.parentElement;for(;n;){const r=getComputedStyle(n);($A.has(r.overflowX)||$A.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const r=e===window,i=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a={x:i.x-n.x,y:i.y-n.y};a.x===0&&a.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(e,i),Wn.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Ao(this.updatePoint)}}function lg(t,e){return e?{point:e(t.point)}:t}function YA(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Ob({point:t},e){return{point:t,delta:YA(t,wO(e)),offset:YA(t,WX(e)),velocity:GX(e,.1)}}function WX(t){return t[0]}function wO(t){return t[t.length-1]}function GX(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const i=wO(t);for(;n>=0&&(r=t[n],!(i.timestamp-r.timestamp>oa(e)));)n--;if(!r)return{x:0,y:0};r===t[0]&&t.length>2&&i.timestamp-r.timestamp>oa(e)*2&&(r=t[1]);const a=Ea(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};const s={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function $X(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?ar(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?ar(n,t,r.max):Math.min(t,n)),t}function qA(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function YX(t,{top:e,left:n,bottom:r,right:i}){return{x:qA(t.x,n,i),y:qA(t.y,e,r)}}function XA(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function qX(t,e){return{x:XA(t.x,e.x),y:XA(t.y,e.y)}}function XX(t,e){let n=.5;const r=ki(t),i=ki(e);return i>r?n=Kh(e.min,e.max-r,t.min):r>i&&(n=Kh(t.min,t.max-i,e.min)),Bs(0,1,n)}function KX(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const l1=.35;function ZX(t=l1){return t===!1?t=0:t===!0&&(t=l1),{x:KA(t,"left","right"),y:KA(t,"top","bottom")}}function KA(t,e,n){return{min:ZA(t,e),max:ZA(t,n)}}function ZA(t,e){return typeof t=="number"?t:t[e]||0}const JX=new WeakMap;class QX{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ir(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const a=h=>{n&&this.snapToCursor(Rp(h).point),this.stopAnimation()},s=(h,p)=>{const{drag:y,dragPropagation:v,onDragStart:w}=this.getProps();if(y&&!v&&(this.openDragLock&&this.openDragLock(),this.openDragLock=xY(y),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),bs(_=>{let E=this.getAxisMotionValue(_).get()||0;if(Ns.test(E)){const{projection:M}=this.visualElement;if(M&&M.layout){const T=M.layout.layoutBox[_];T&&(E=ki(T)*(parseFloat(E)/100))}}this.originPoint[_]=E}),w&&Wn.update(()=>w(h,p),!1,!0),e1(this.visualElement,"transform");const{animationState:b}=this.visualElement;b&&b.setActive("whileDrag",!0)},o=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p;const{dragPropagation:y,dragDirectionLock:v,onDirectionLock:w,onDrag:b}=this.getProps();if(!y&&!this.openDragLock)return;const{offset:_}=p;if(v&&this.currentDirection===null){this.currentDirection=tK(_),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",p.point,_),this.updateAxis("y",p.point,_),this.visualElement.render(),b&&Wn.update(()=>b(h,p),!1,!0)},c=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p,this.stop(h,p),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:f}=this.getProps();this.panSession=new _O(e,{onSessionStart:a,onStart:s,onMove:o,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:f,distanceThreshold:r,contextWindow:bO(this.visualElement),element:this.visualElement.current})}stop(e,n){const r=e||this.latestPointerEvent,i=n||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!i||!r)return;const{velocity:s}=i;this.startAnimation(s);const{onDragEnd:o}=this.getProps();o&&Wn.postRender(()=>o(r,i))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,r){const{drag:i}=this.getProps();if(!r||!cg(e,i,this.currentDirection))return;const a=this.getAxisMotionValue(e);let s=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(s=$X(s,this.constraints[e],this.elastic[e])),a.set(s)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,i=this.constraints;e&&hd(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=YX(r.layoutBox,e):this.constraints=!1,this.elastic=ZX(n),i!==this.constraints&&!hd(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&bs(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=KX(r.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!hd(e))return!1;const r=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const a=XY(r,i.root,this.visualElement.getTransformPagePoint());let s=qX(i.layout.layoutBox,a);if(n){const o=n($Y(s));this.hasMutatedConstraints=!!o,o&&(s=VI(o))}return s}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:a,dragSnapToOrigin:s,onDragTransitionEnd:o}=this.getProps(),c=this.constraints||{},u=bs(f=>{if(!cg(f,n,this.currentDirection))return;let h=c&&c[f]||{};(s===!0||s===f)&&(h={min:0,max:0});const p=i?200:1e6,y=i?40:1e7,v={type:"inertia",velocity:r?e[f]:0,bounceStiffness:p,bounceDamping:y,timeConstant:750,restDelta:1,restSpeed:10,...a,...h};return this.startAxisValueAnimation(f,v)});return Promise.all(u).then(o)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return e1(this.visualElement,e),r.start(Vk(e,r,0,n,this.visualElement,!1))}stopAnimation(){bs(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){bs(n=>{const{drag:r}=this.getProps();if(!cg(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,a=this.getAxisMotionValue(n);if(i&&i.layout){const{min:s,max:o}=i.layout.layoutBox[n],c=a.get()||0;a.set(e[n]-ar(s,o,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!hd(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};bs(s=>{const o=this.getAxisMotionValue(s);if(o&&this.constraints!==!1){const c=o.get();i[s]=XX({min:c,max:c},this.constraints[s])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),bs(s=>{if(!cg(s,e,null))return;const o=this.getAxisMotionValue(s),{min:c,max:u}=this.constraints[s];o.set(ar(c,u,i[s]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;JX.set(this.visualElement,this);const e=this.visualElement.current,n=Ih(e,"pointerdown",u=>{const{drag:f,dragListener:h=!0}=this.getProps(),p=u.target,y=p!==e&&EY(p);f&&h&&!y&&this.start(u)});let r;const i=()=>{const{dragConstraints:u}=this.getProps();hd(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),r||(r=eK(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,s=a.addEventListener("measure",i);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),Wn.read(i);const o=ep(window,"resize",()=>this.scalePositionWithinConstraints()),c=a.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:f})=>{this.isDragging&&f&&(bs(h=>{const p=this.getAxisMotionValue(h);p&&(this.originPoint[h]+=u[h].translate,p.set(p.get()+u[h].translate))}),this.visualElement.render())}));return()=>{o(),n(),s(),c&&c(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:a=!1,dragElastic:s=l1,dragMomentum:o=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:a,dragElastic:s,dragMomentum:o}}}function JA(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function eK(t,e,n){const r=rA(t,JA(n)),i=rA(e,JA(n));return()=>{r(),i()}}function cg(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function tK(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class nK extends Il{constructor(e){super(e),this.removeGroupControls=Ta,this.removeListeners=Ta,this.controls=new QX(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Ta}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Fb=t=>(e,n)=>{t&&Wn.update(()=>t(e,n),!1,!0)};class rK extends Il{constructor(){super(...arguments),this.removePointerDownListener=Ta}onPointerDown(e){this.session=new _O(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:bO(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:Fb(e),onStart:Fb(n),onMove:Fb(r),onEnd:(a,s)=>{delete this.session,i&&Wn.postRender(()=>i(a,s))}}}mount(){this.removePointerDownListener=Ih(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Ub=!1;class iK extends x.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:a}=e;a&&(n.group&&n.group.add(a),r&&r.register&&i&&r.register(a),Ub&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),m0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:i,isPresent:a}=this.props,{projection:s}=r;return s&&(s.isPresent=a,e.layoutDependency!==n&&s.setOptions({...s.options,layoutDependency:n}),Ub=!0,i||e.layoutDependency!==n||n===void 0||e.isPresent!==a?s.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?s.promote():s.relegate()||Wn.postRender(()=>{const o=s.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),$k.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=e;Ub=!0,i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function SO(t){const[e,n]=uO(),r=x.useContext(Xh);return m.jsx(iK,{...t,layoutGroup:r,switchLayoutGroup:x.useContext(vO),isPresent:e,safeToRemove:n})}const aK={pan:{Feature:rK},drag:{Feature:nK,ProjectionNode:cO,MeasureLayout:SO}};function QA(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const i="onHover"+n,a=r[i];a&&Wn.postRender(()=>a(e,Rp(e)))}class sK extends Il{mount(){const{current:e}=this.node;e&&(this.unmount=_Y(e,(n,r)=>(QA(this.node,r,"Start"),i=>QA(this.node,i,"End"))))}unmount(){}}class oK extends Il{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Ep(ep(this.node.current,"focus",()=>this.onFocus()),ep(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function eR(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const i="onTap"+(n==="End"?"":n),a=r[i];a&&Wn.postRender(()=>a(e,Rp(e)))}class lK extends Il{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=TY(e,(i,a)=>(eR(this.node,a,"Start"),(s,{success:o})=>eR(this.node,s,o?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:r?.tap===!1})}unmount(){}}const c1=new WeakMap,jb=new WeakMap,cK=t=>{const e=c1.get(t.target);e&&e(t)},uK=t=>{t.forEach(cK)};function dK({root:t,...e}){const n=t||document;jb.has(n)||jb.set(n,{});const r=jb.get(n),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(uK,{root:t,...e})),r[i]}function fK(t,e,n){const r=dK(e);return c1.set(t,n),r.observe(t),()=>{c1.delete(t),r.unobserve(t)}}const hK={some:0,all:1};class pK extends Il{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:a}=e,s={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:hK[i]},o=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,a&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),p=u?f:h;p&&p(c)};this.stopObserver=fK(this.node.current,s,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(mK(e,n))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}}function mK({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const gK={inView:{Feature:pK},tap:{Feature:lK},focus:{Feature:oK},hover:{Feature:sK}},yK={layout:{ProjectionNode:cO,MeasureLayout:SO}},vK={...zX,...gK,...aK,...yK},fr=OX(vK,FX);function nE(t){const e=kp(()=>Xc(t)),{isStatic:n}=x.useContext(Cp);if(n){const[,r]=x.useState(t);x.useEffect(()=>e.on("change",r),[])}return e}function kO(t,e){const n=nE(e()),r=()=>n.set(e());return r(),Vy(()=>{const i=()=>Wn.preRender(r,!1,!0),a=t.map(s=>s.on("change",i));return()=>{a.forEach(s=>s()),Ao(r)}}),n}function xK(t){Dh.current=[],t();const e=kO(Dh.current,t);return Dh.current=void 0,e}function EO(t,e,n,r){if(typeof t=="function")return xK(t);const a=typeof e=="function"?e:FY(e,n,r),s=Array.isArray(t)?tR(t,a):tR([t],([c])=>a(c)),o=Array.isArray(t)?void 0:t.accelerate;return o&&!o.isTransformed&&typeof e!="function"&&Array.isArray(n)&&r?.clamp!==!1&&(s.accelerate={...o,times:e,keyframes:n,isTransformed:!0}),s}function tR(t,e){const n=kp(()=>[]);return kO(t,()=>{n.length=0;const r=t.length;for(let i=0;i<r;i++)n[i]=t[i].get();return e(n)})}function bK(t,e={}){const{isStatic:n}=x.useContext(Cp),r=()=>Ur(t)?t.get():t;if(n)return EO(r);const i=nE(r());return x.useInsertionEffect(()=>UY(i,t,e),[i,JSON.stringify(e)]),i}function _K(t,e={}){return bK(t,{type:"spring",...e})}function su(){!Zk.current&&jI();const[t]=x.useState(K0.current);return t}function MO(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e<i;e++)t[e]&&(n=MO(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function wK(){for(var t,e,n=0,r="",i=arguments.length;n<i;n++)(t=arguments[n])&&(e=MO(t))&&(r&&(r+=" "),r+=e);return r}const SK=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r<t.length;r++)n[r]=t[r];for(let r=0;r<e.length;r++)n[t.length+r]=e[r];return n},kK=(t,e)=>({classGroupId:t,validator:e}),TO=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),ty="-",nR=[],EK="arbitrary..",MK=t=>{const e=CK(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return TK(s);const o=s.split(ty),c=o[0]===""&&o.length>1?1:0;return CO(o,c,e)},getConflictingClassGroupIds:(s,o)=>{if(o){const c=r[s],u=n[s];return c?u?SK(u,c):c:u||nR}return n[s]||nR}}},CO=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const i=t[e],a=n.nextPart.get(i);if(a){const u=CO(t,e+1,a);if(u)return u}const s=n.validators;if(s===null)return;const o=e===0?t.join(ty):t.slice(e).join(ty),c=s.length;for(let u=0;u<c;u++){const f=s[u];if(f.validator(o))return f.classGroupId}},TK=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?EK+r:void 0})(),CK=t=>{const{theme:e,classGroups:n}=t;return AK(n,e)},AK=(t,e)=>{const n=TO();for(const r in t){const i=t[r];rE(i,n,r,e)}return n},rE=(t,e,n,r)=>{const i=t.length;for(let a=0;a<i;a++){const s=t[a];RK(s,e,n,r)}},RK=(t,e,n,r)=>{if(typeof t=="string"){PK(t,e,n);return}if(typeof t=="function"){NK(t,e,n,r);return}DK(t,e,n,r)},PK=(t,e,n)=>{const r=t===""?e:AO(e,t);r.classGroupId=n},NK=(t,e,n,r)=>{if(LK(t)){rE(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(kK(n,t))},DK=(t,e,n,r)=>{const i=Object.entries(t),a=i.length;for(let s=0;s<a;s++){const[o,c]=i[s];rE(c,AO(e,o),n,r)}},AO=(t,e)=>{let n=t;const r=e.split(ty),i=r.length;for(let a=0;a<i;a++){const s=r[a];let o=n.nextPart.get(s);o||(o=TO(),n.nextPart.set(s,o)),n=o}return n},LK=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,IK=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const i=(a,s)=>{n[a]=s,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(a){let s=n[a];if(s!==void 0)return s;if((s=r[a])!==void 0)return i(a,s),s},set(a,s){a in n?n[a]=s:i(a,s)}}},u1="!",rR=":",OK=[],iR=(t,e,n,r,i)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),FK=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=i=>{const a=[];let s=0,o=0,c=0,u;const f=i.length;for(let w=0;w<f;w++){const b=i[w];if(s===0&&o===0){if(b===rR){a.push(i.slice(c,w)),c=w+1;continue}if(b==="/"){u=w;continue}}b==="["?s++:b==="]"?s--:b==="("?o++:b===")"&&o--}const h=a.length===0?i:i.slice(c);let p=h,y=!1;h.endsWith(u1)?(p=h.slice(0,-1),y=!0):h.startsWith(u1)&&(p=h.slice(1),y=!0);const v=u&&u>c?u-c:void 0;return iR(a,y,p,v)};if(e){const i=e+rR,a=r;r=s=>s.startsWith(i)?a(s.slice(i.length)):iR(OK,!1,s,void 0,!0)}if(n){const i=r;r=a=>n({className:a,parseClassName:i})}return r},UK=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let i=[];for(let a=0;a<n.length;a++){const s=n[a],o=s[0]==="[",c=e.has(s);o||c?(i.length>0&&(i.sort(),r.push(...i),i=[]),r.push(s)):i.push(s)}return i.length>0&&(i.sort(),r.push(...i)),r}},jK=t=>({cache:IK(t.cacheSize),parseClassName:FK(t),sortModifiers:UK(t),...MK(t)}),BK=/\s+/,zK=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=e,s=[],o=t.trim().split(BK);let c="";for(let u=o.length-1;u>=0;u-=1){const f=o[u],{isExternal:h,modifiers:p,hasImportantModifier:y,baseClassName:v,maybePostfixModifierPosition:w}=n(f);if(h){c=f+(c.length>0?" "+c:c);continue}let b=!!w,_=r(b?v.substring(0,w):v);if(!_){if(!b){c=f+(c.length>0?" "+c:c);continue}if(_=r(v),!_){c=f+(c.length>0?" "+c:c);continue}b=!1}const E=p.length===0?"":p.length===1?p[0]:a(p).join(":"),M=y?E+u1:E,T=M+_;if(s.indexOf(T)>-1)continue;s.push(T);const R=i(_,b);for(let A=0;A<R.length;++A){const P=R[A];s.push(M+P)}c=f+(c.length>0?" "+c:c)}return c},VK=(...t)=>{let e=0,n,r,i="";for(;e<t.length;)(n=t[e++])&&(r=RO(n))&&(i&&(i+=" "),i+=r);return i},RO=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=RO(t[r]))&&(n&&(n+=" "),n+=e);return n},HK=(t,...e)=>{let n,r,i,a;const s=c=>{const u=e.reduce((f,h)=>h(f),t());return n=jK(u),r=n.cache.get,i=n.cache.set,a=o,o(c)},o=c=>{const u=r(c);if(u)return u;const f=zK(c,n);return i(c,f),f};return a=s,(...c)=>a(VK(...c))},WK=[],Lr=t=>{const e=n=>n[t]||WK;return e.isThemeGetter=!0,e},PO=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,NO=/^\((?:(\w[\w-]*):)?(.+)\)$/i,GK=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,$K=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,YK=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,qK=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,XK=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,KK=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,el=t=>GK.test(t),bn=t=>!!t&&!Number.isNaN(Number(t)),tl=t=>!!t&&Number.isInteger(Number(t)),Bb=t=>t.endsWith("%")&&bn(t.slice(0,-1)),oo=t=>$K.test(t),DO=()=>!0,ZK=t=>YK.test(t)&&!qK.test(t),iE=()=>!1,JK=t=>XK.test(t),QK=t=>KK.test(t),eZ=t=>!It(t)&&!Ut(t),tZ=t=>Ol(t,OO,iE),It=t=>PO.test(t),lc=t=>Ol(t,FO,ZK),aR=t=>Ol(t,cZ,bn),nZ=t=>Ol(t,jO,DO),rZ=t=>Ol(t,UO,iE),sR=t=>Ol(t,LO,iE),iZ=t=>Ol(t,IO,QK),ug=t=>Ol(t,BO,JK),Ut=t=>NO.test(t),ih=t=>ou(t,FO),aZ=t=>ou(t,UO),oR=t=>ou(t,LO),sZ=t=>ou(t,OO),oZ=t=>ou(t,IO),dg=t=>ou(t,BO,!0),lZ=t=>ou(t,jO,!0),Ol=(t,e,n)=>{const r=PO.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},ou=(t,e,n=!1)=>{const r=NO.exec(t);return r?r[1]?e(r[1]):n:!1},LO=t=>t==="position"||t==="percentage",IO=t=>t==="image"||t==="url",OO=t=>t==="length"||t==="size"||t==="bg-size",FO=t=>t==="length",cZ=t=>t==="number",UO=t=>t==="family-name",jO=t=>t==="number"||t==="weight",BO=t=>t==="shadow",uZ=()=>{const t=Lr("color"),e=Lr("font"),n=Lr("text"),r=Lr("font-weight"),i=Lr("tracking"),a=Lr("leading"),s=Lr("breakpoint"),o=Lr("container"),c=Lr("spacing"),u=Lr("radius"),f=Lr("shadow"),h=Lr("inset-shadow"),p=Lr("text-shadow"),y=Lr("drop-shadow"),v=Lr("blur"),w=Lr("perspective"),b=Lr("aspect"),_=Lr("ease"),E=Lr("animate"),M=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...T(),Ut,It],A=()=>["auto","hidden","clip","visible","scroll"],P=()=>["auto","contain","none"],k=()=>[Ut,It,c],N=()=>[el,"full","auto",...k()],U=()=>[tl,"none","subgrid",Ut,It],L=()=>["auto",{span:["full",tl,Ut,It]},tl,Ut,It],z=()=>[tl,"auto",Ut,It],F=()=>["auto","min","max","fr",Ut,It],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],W=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...k()],Q=()=>[el,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],O=()=>[el,"screen","full","dvw","lvw","svw","min","max","fit",...k()],G=()=>[el,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],Y=()=>[t,Ut,It],H=()=>[...T(),oR,sR,{position:[Ut,It]}],te=()=>["no-repeat",{repeat:["","x","y","space","round"]}],re=()=>["auto","cover","contain",sZ,tZ,{size:[Ut,It]}],ue=()=>[Bb,ih,lc],ce=()=>["","none","full",u,Ut,It],ee=()=>["",bn,ih,lc],le=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Pe=()=>[bn,Bb,oR,sR],be=()=>["","none",v,Ut,It],Ye=()=>["none",bn,Ut,It],he=()=>["none",bn,Ut,It],Ue=()=>[bn,Ut,It],je=()=>[el,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[oo],breakpoint:[oo],color:[DO],container:[oo],"drop-shadow":[oo],ease:["in","out","in-out"],font:[eZ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[oo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[oo],shadow:[oo],spacing:["px",bn],text:[oo],"text-shadow":[oo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",el,It,Ut,b]}],container:["container"],columns:[{columns:[bn,It,Ut,o]}],"break-after":[{"break-after":M()}],"break-before":[{"break-before":M()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:N()}],"inset-x":[{"inset-x":N()}],"inset-y":[{"inset-y":N()}],start:[{"inset-s":N(),start:N()}],end:[{"inset-e":N(),end:N()}],"inset-bs":[{"inset-bs":N()}],"inset-be":[{"inset-be":N()}],top:[{top:N()}],right:[{right:N()}],bottom:[{bottom:N()}],left:[{left:N()}],visibility:["visible","invisible","collapse"],z:[{z:[tl,"auto",Ut,It]}],basis:[{basis:[el,"full","auto",o,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[bn,el,"auto","initial","none",It]}],grow:[{grow:["",bn,Ut,It]}],shrink:[{shrink:["",bn,Ut,It]}],order:[{order:[tl,"first","last","none",Ut,It]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...W(),"normal"]}],"justify-self":[{"justify-self":["auto",...W()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...W(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...W(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...W(),"baseline"]}],"place-self":[{"place-self":["auto",...W()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mbs:[{mbs:K()}],mbe:[{mbe:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...O()]}],"min-inline-size":[{"min-inline":["auto",...O()]}],"max-inline-size":[{"max-inline":["none",...O()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[o,"screen",...Q()]}],"min-w":[{"min-w":[o,"screen","none",...Q()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[s]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",n,ih,lc]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,lZ,nZ]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Bb,It]}],"font-family":[{font:[aZ,rZ,e]}],"font-features":[{"font-features":[It]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[i,Ut,It]}],"line-clamp":[{"line-clamp":[bn,"none",Ut,aR]}],leading:[{leading:[a,...k()]}],"list-image":[{"list-image":["none",Ut,It]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ut,It]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Y()}],"text-color":[{text:Y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[bn,"from-font","auto",Ut,lc]}],"text-decoration-color":[{decoration:Y()}],"underline-offset":[{"underline-offset":[bn,"auto",Ut,It]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ut,It]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ut,It]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:H()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},tl,Ut,It],radial:["",Ut,It],conic:[tl,Ut,It]},oZ,iZ]}],"bg-color":[{bg:Y()}],"gradient-from-pos":[{from:ue()}],"gradient-via-pos":[{via:ue()}],"gradient-to-pos":[{to:ue()}],"gradient-from":[{from:Y()}],"gradient-via":[{via:Y()}],"gradient-to":[{to:Y()}],rounded:[{rounded:ce()}],"rounded-s":[{"rounded-s":ce()}],"rounded-e":[{"rounded-e":ce()}],"rounded-t":[{"rounded-t":ce()}],"rounded-r":[{"rounded-r":ce()}],"rounded-b":[{"rounded-b":ce()}],"rounded-l":[{"rounded-l":ce()}],"rounded-ss":[{"rounded-ss":ce()}],"rounded-se":[{"rounded-se":ce()}],"rounded-ee":[{"rounded-ee":ce()}],"rounded-es":[{"rounded-es":ce()}],"rounded-tl":[{"rounded-tl":ce()}],"rounded-tr":[{"rounded-tr":ce()}],"rounded-br":[{"rounded-br":ce()}],"rounded-bl":[{"rounded-bl":ce()}],"border-w":[{border:ee()}],"border-w-x":[{"border-x":ee()}],"border-w-y":[{"border-y":ee()}],"border-w-s":[{"border-s":ee()}],"border-w-e":[{"border-e":ee()}],"border-w-bs":[{"border-bs":ee()}],"border-w-be":[{"border-be":ee()}],"border-w-t":[{"border-t":ee()}],"border-w-r":[{"border-r":ee()}],"border-w-b":[{"border-b":ee()}],"border-w-l":[{"border-l":ee()}],"divide-x":[{"divide-x":ee()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ee()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:Y()}],"border-color-x":[{"border-x":Y()}],"border-color-y":[{"border-y":Y()}],"border-color-s":[{"border-s":Y()}],"border-color-e":[{"border-e":Y()}],"border-color-bs":[{"border-bs":Y()}],"border-color-be":[{"border-be":Y()}],"border-color-t":[{"border-t":Y()}],"border-color-r":[{"border-r":Y()}],"border-color-b":[{"border-b":Y()}],"border-color-l":[{"border-l":Y()}],"divide-color":[{divide:Y()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[bn,Ut,It]}],"outline-w":[{outline:["",bn,ih,lc]}],"outline-color":[{outline:Y()}],shadow:[{shadow:["","none",f,dg,ug]}],"shadow-color":[{shadow:Y()}],"inset-shadow":[{"inset-shadow":["none",h,dg,ug]}],"inset-shadow-color":[{"inset-shadow":Y()}],"ring-w":[{ring:ee()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Y()}],"ring-offset-w":[{"ring-offset":[bn,lc]}],"ring-offset-color":[{"ring-offset":Y()}],"inset-ring-w":[{"inset-ring":ee()}],"inset-ring-color":[{"inset-ring":Y()}],"text-shadow":[{"text-shadow":["none",p,dg,ug]}],"text-shadow-color":[{"text-shadow":Y()}],opacity:[{opacity:[bn,Ut,It]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[bn]}],"mask-image-linear-from-pos":[{"mask-linear-from":Pe()}],"mask-image-linear-to-pos":[{"mask-linear-to":Pe()}],"mask-image-linear-from-color":[{"mask-linear-from":Y()}],"mask-image-linear-to-color":[{"mask-linear-to":Y()}],"mask-image-t-from-pos":[{"mask-t-from":Pe()}],"mask-image-t-to-pos":[{"mask-t-to":Pe()}],"mask-image-t-from-color":[{"mask-t-from":Y()}],"mask-image-t-to-color":[{"mask-t-to":Y()}],"mask-image-r-from-pos":[{"mask-r-from":Pe()}],"mask-image-r-to-pos":[{"mask-r-to":Pe()}],"mask-image-r-from-color":[{"mask-r-from":Y()}],"mask-image-r-to-color":[{"mask-r-to":Y()}],"mask-image-b-from-pos":[{"mask-b-from":Pe()}],"mask-image-b-to-pos":[{"mask-b-to":Pe()}],"mask-image-b-from-color":[{"mask-b-from":Y()}],"mask-image-b-to-color":[{"mask-b-to":Y()}],"mask-image-l-from-pos":[{"mask-l-from":Pe()}],"mask-image-l-to-pos":[{"mask-l-to":Pe()}],"mask-image-l-from-color":[{"mask-l-from":Y()}],"mask-image-l-to-color":[{"mask-l-to":Y()}],"mask-image-x-from-pos":[{"mask-x-from":Pe()}],"mask-image-x-to-pos":[{"mask-x-to":Pe()}],"mask-image-x-from-color":[{"mask-x-from":Y()}],"mask-image-x-to-color":[{"mask-x-to":Y()}],"mask-image-y-from-pos":[{"mask-y-from":Pe()}],"mask-image-y-to-pos":[{"mask-y-to":Pe()}],"mask-image-y-from-color":[{"mask-y-from":Y()}],"mask-image-y-to-color":[{"mask-y-to":Y()}],"mask-image-radial":[{"mask-radial":[Ut,It]}],"mask-image-radial-from-pos":[{"mask-radial-from":Pe()}],"mask-image-radial-to-pos":[{"mask-radial-to":Pe()}],"mask-image-radial-from-color":[{"mask-radial-from":Y()}],"mask-image-radial-to-color":[{"mask-radial-to":Y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[bn]}],"mask-image-conic-from-pos":[{"mask-conic-from":Pe()}],"mask-image-conic-to-pos":[{"mask-conic-to":Pe()}],"mask-image-conic-from-color":[{"mask-conic-from":Y()}],"mask-image-conic-to-color":[{"mask-conic-to":Y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:H()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ut,It]}],filter:[{filter:["","none",Ut,It]}],blur:[{blur:be()}],brightness:[{brightness:[bn,Ut,It]}],contrast:[{contrast:[bn,Ut,It]}],"drop-shadow":[{"drop-shadow":["","none",y,dg,ug]}],"drop-shadow-color":[{"drop-shadow":Y()}],grayscale:[{grayscale:["",bn,Ut,It]}],"hue-rotate":[{"hue-rotate":[bn,Ut,It]}],invert:[{invert:["",bn,Ut,It]}],saturate:[{saturate:[bn,Ut,It]}],sepia:[{sepia:["",bn,Ut,It]}],"backdrop-filter":[{"backdrop-filter":["","none",Ut,It]}],"backdrop-blur":[{"backdrop-blur":be()}],"backdrop-brightness":[{"backdrop-brightness":[bn,Ut,It]}],"backdrop-contrast":[{"backdrop-contrast":[bn,Ut,It]}],"backdrop-grayscale":[{"backdrop-grayscale":["",bn,Ut,It]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[bn,Ut,It]}],"backdrop-invert":[{"backdrop-invert":["",bn,Ut,It]}],"backdrop-opacity":[{"backdrop-opacity":[bn,Ut,It]}],"backdrop-saturate":[{"backdrop-saturate":[bn,Ut,It]}],"backdrop-sepia":[{"backdrop-sepia":["",bn,Ut,It]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ut,It]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[bn,"initial",Ut,It]}],ease:[{ease:["linear","initial",_,Ut,It]}],delay:[{delay:[bn,Ut,It]}],animate:[{animate:["none",E,Ut,It]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Ut,It]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:Ye()}],"rotate-x":[{"rotate-x":Ye()}],"rotate-y":[{"rotate-y":Ye()}],"rotate-z":[{"rotate-z":Ye()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:Ue()}],"skew-x":[{"skew-x":Ue()}],"skew-y":[{"skew-y":Ue()}],transform:[{transform:[Ut,It,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],accent:[{accent:Y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ut,It]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ut,It]}],fill:[{fill:["none",...Y()]}],"stroke-w":[{stroke:[bn,ih,lc,aR]}],stroke:[{stroke:["none",...Y()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},dZ=HK(uZ);function yt(...t){return dZ(wK(t))}const fZ=m.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[m.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),m.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),m.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),m.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),hZ=m.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:m.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),pZ={google:fZ,github:hZ},mZ={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function gZ(t){return mZ[t]||String(t||"").replace(/-/g," ")}function yZ(){au();const{isOpen:t,closeLoginModal:e}=Sp(),{enabled:n,signedIn:r,refreshUser:i,signInWithPassword:a,signUp:s,signInWithOAuth:o,getPublicAuthConfig:c}=as(),[u,f]=x.useState("signin"),[h,p]=x.useState(""),[y,v]=x.useState(""),[w,b]=x.useState(""),[_,E]=x.useState(!1),[M,T]=x.useState(null),[R,A]=x.useState(null),[P,k]=x.useState(!1),[N,U]=x.useState(!0),[L,z]=x.useState([]),[F,V]=x.useState(8);x.useEffect(()=>{t&&(T(null),A(null),f("signin"),p(""),v(""),b(""),k(!1))},[t]),x.useEffect(()=>{if(!t||!n){U(!1);return}let O=!0;return(async()=>{const{data:G,error:Y}=await c();if(O){if(Y||!G)z(["google","github"]);else{const H=Array.isArray(G.oAuthProviders)?G.oAuthProviders:[],te=Array.isArray(G.customOAuthProviders)?G.customOAuthProviders:[];z([...H,...te]),typeof G.passwordMinLength=="number"&&G.passwordMinLength>0&&V(G.passwordMinLength)}U(!1)}})(),()=>{O=!1}},[t,n,c]),x.useEffect(()=>{t&&r&&e()},[t,r,e]);const W=x.useMemo(()=>typeof window>"u"?"":!!window.webkit?.messageHandlers?.nativeOAuth?`${window.location.origin}/auth/callback`:`${window.location.origin}/`,[]),K=x.useCallback(async O=>{T(null),E(!0);try{const{error:G}=await o(O,W);G&&T(G.message||String(G))}finally{E(!1)}},[o,W]),Q=x.useCallback(async O=>{O.preventDefault(),T(null),E(!0);try{if(u==="signup"){const{data:Y,error:H}=await s({email:h.trim(),password:y,name:w.trim()||void 0});if(H){T(H.message||String(H));return}if(Y?.requireEmailVerification){A(B("login.verify_email_pending")),f("signin");return}await i();return}const{error:G}=await a({email:h.trim(),password:y});if(G){T(G.message||String(G));return}await i()}finally{E(!1)}},[u,h,y,w,s,a,i]);return x.useEffect(()=>{if(!t)return;const O=G=>{G.key==="Escape"&&e()};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[t,e]),n?m.jsx(Ap,{children:t&&m.jsxs(fr.div,{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[m.jsx(fr.div,{className:"absolute inset-0 bg-black/40 dark:bg-black/60 ",onClick:e,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}),m.jsxs(fr.div,{className:"relative w-full max-w-[420px] rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 p-6 shadow-2xl",initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{duration:.2},onClick:O=>O.stopPropagation(),children:[m.jsx("button",{type:"button",onClick:e,className:"absolute right-4 top-4 text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:m.jsx(Ck,{className:"h-5 w-5"})}),m.jsxs("div",{className:"text-center mb-6",children:[m.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[m.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),m.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white",children:"Token Tracker"})]}),m.jsx("p",{className:"text-sm text-oai-gray-500",children:B("login_modal.subtitle")})]}),R&&m.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:R}),M&&m.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",role:"alert",children:M}),m.jsx("div",{className:"space-y-2.5 mb-5",children:N?m.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900 animate-pulse"}):L.map(O=>m.jsxs("button",{type:"button",disabled:_,onClick:()=>K(O),className:yt("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[pZ[O]||null,B("login.oauth.continue",{provider:gZ(O)})]},O))}),P?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"relative mb-5",children:[m.jsx("div",{className:"absolute inset-0 flex items-center",children:m.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),m.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:m.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:B("login_modal.divider_email")})})]}),m.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[m.jsx("button",{type:"button",className:yt("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",u==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{f("signin"),T(null)},children:B("login.tab.sign_in")}),m.jsx("button",{type:"button",className:yt("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",u==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{f("signup"),T(null)},children:B("login.tab.sign_up")})]}),m.jsxs("form",{onSubmit:Q,className:"space-y-3",children:[u==="signup"&&m.jsxs("div",{children:[m.jsx("label",{htmlFor:"modal-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:B("login.field.name")}),m.jsx("input",{id:"modal-name",type:"text",autoComplete:"name",value:w,onChange:O=>b(O.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:B("login.field.name_placeholder")})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"modal-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:B("login.field.email")}),m.jsx("input",{id:"modal-email",type:"email",autoComplete:"email",required:!0,value:h,onChange:O=>p(O.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"modal-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:B("login.field.password")}),m.jsx("input",{id:"modal-password",type:"password",autoComplete:u==="signup"?"new-password":"current-password",required:!0,minLength:u==="signup"?F:void 0,value:y,onChange:O=>v(O.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),u==="signup"&&m.jsx("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:B("login.password_hint",{min:String(F)})})]}),m.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:B(u==="signup"?"login.submit.sign_up":"login.submit.sign_in")})]})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"relative mb-5",children:[m.jsx("div",{className:"absolute inset-0 flex items-center",children:m.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),m.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:m.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:B("login.divider")})})]}),m.jsxs("button",{type:"button",onClick:()=>k(!0),className:yt("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[m.jsx(V7,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),B("login_modal.continue_email")]})]})]})]})}):null}const vZ={VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function xZ(){if(typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"))return"";const e=typeof import.meta<"u"?vZ:void 0;return(e?.VITE_TOKENTRACKER_BACKEND_BASE_URL||e?.VITE_INSFORGE_BASE_URL||"").trim()}function zO(){return Yc()}function aE(t=""){if(typeof t!="string"||t.length===0)return!1;const e=new URLSearchParams(t),n=String(e.get("screenshot")||"").toLowerCase();return n==="1"||n==="true"}const bZ=300*1e3,_Z=720*60*1e3;function sE(t){return typeof t=="string"&&/^https?:\/\//i.test(t.trim())}function wZ(t,e=Date.now()){if(!t?.token||!t?.deviceId||!t?.issuedAt)return!0;const n=Date.parse(t.issuedAt);return Number.isFinite(n)?n+_Z<=e:!0}async function VO(t,e){const n=Yc();if(!sE(n)||!t)return;const r=n.replace(/\/$/,""),i=Ny(),a={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};i&&(a.apikey=i);try{await fetch(`${r}/functions/tokentracker-leaderboard-refresh`,{method:"POST",headers:a,body:JSON.stringify({period:"week",source:e})})}catch{}}async function SZ(t){const e=Yc();if(!sE(e)||!t)return null;const n=e.replace(/\/$/,""),r=Ny(),i={Accept:"application/json","Content-Type":"application/json",Authorization:`Bearer ${t}`};r&&(i.apikey=r);const a=typeof navigator<"u"&&typeof navigator.platform=="string"?navigator.platform:"web",s=await fetch(`${n}/functions/tokentracker-device-token-issue`,{method:"POST",headers:i,body:JSON.stringify({device_name:"Token Tracker (dashboard)",platform:a})});if(!s.ok)return null;const o=await s.json().catch(()=>null),c=typeof o?.token=="string"?o.token:null,u=typeof o?.device_id=="string"?o.device_id:null;return!c||!u?null:{token:c,deviceId:u,issuedAt:typeof o?.created_at=="string"?o.created_at:new Date().toISOString()}}async function lR(t){const{deviceToken:e,insforgeBaseUrl:n}=t,r={deviceToken:e},i=n||Yc();sE(i)&&(r.insforgeBaseUrl=i.trim());const a=await Fy(),s=await fetch("/functions/tokentracker-local-sync",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...a},body:JSON.stringify(r)}),o=await s.json().catch(()=>({}));if(!s.ok){const c=typeof o.error=="string"?o.error:`HTTP ${s.status}`;throw new Error(c)}return o}async function cR(t){const e=await t();if(!e)return null;const n=c3();if(n&&!wZ(n))return n;const r=await SZ(e);return r?(bH(r),r):null}async function HO(t){let e=await t();if(!e)return null;let n=await cR(async()=>e);if(!n)return e;try{return await lR({deviceToken:n.token,insforgeBaseUrl:Yc()}),e}catch(r){if(!c3()||(u3(),e=await t(),!e)||(n=await cR(async()=>e),!n))throw r;return await lR({deviceToken:n.token,insforgeBaseUrl:Yc()}),e}}async function kZ(t){const e=_H();if(Date.now()-e<bZ)return;const n=await HO(t);n&&(d3(Date.now()),await VO(n,"cloud-sync-auto"))}async function WO(t){const e=await HO(t);e&&(d3(Date.now()),await VO(e,"cloud-sync-now"))}function EZ(t){const e=t.replace(/\/+$/,"")||"/";return e==="/share"||e==="/share.html"||e.startsWith("/share/")}function MZ(t){const e=t.replace(/\/+$/,"")||"/";return e==="/login"||e==="/landing"||EZ(e)?!1:e==="/"||e==="/dashboard"||e.startsWith("/leaderboard")}function TZ(){const t=Hi(),e=as(),n=x.useRef(!1);x.useEffect(()=>{if(!o3()||!MZ(t.pathname||"/")||!e.enabled||!e.signedIn||e.loading||!gk())return;let r=!1;const i=window.setTimeout(()=>{(async()=>{if(!(r||n.current)){n.current=!0;try{await kZ(()=>e.getAccessToken())}catch(a){console.warn("[tokentracker] cloud usage sync:",a)}finally{n.current=!1}}})()},2500);return()=>{r=!0,window.clearTimeout(i)}},[t.pathname,e.enabled,e.signedIn,e.loading,e.getAccessToken])}const CZ="modulepreload",AZ=function(t){return"/"+t},uR={},GO=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let c=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),o=s?.nonce||s?.getAttribute("nonce");i=c(n.map(u=>{if(u=AZ(u),u in uR)return;uR[u]=!0;const f=u.endsWith(".css"),h=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${h}`))return;const p=document.createElement("link");if(p.rel=f?"stylesheet":CZ,f||(p.as="script"),p.crossOrigin="",p.href=u,o&&p.setAttribute("nonce",o),document.head.appendChild(p),f)return new Promise((y,v)=>{p.addEventListener("load",y),p.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${u}`)))})}))}function a(s){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s}return i.then(s=>{for(const o of s||[])o.status==="rejected"&&a(o.reason);return e().catch(a)})};function RZ({baseUrl:t,accessToken:e,guestAllowed:n=!1,weeks:r=52,weekStartsOn:i="sun",cacheKey:a,timeZone:s,tzOffsetMinutes:o,now:c}={}){const u=x.useMemo(()=>vk({weeks:r,weekStartsOn:i,now:c}),[c,r,i]),[f,h]=x.useState([]),[p,y]=x.useState(null),[v,w]=x.useState("edge"),[b,_]=x.useState(!1),[E,M]=x.useState(null),T=br(),R=Ll(e),A=!n,P=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),k=x.useMemo(()=>{if(!a)return null;const V=Dy({timeZone:s,offsetMinutes:o});return`tokentracker.heatmap.${a}.${r}.${i}.${V}`},[a,s,o,r,i]),N=x.useCallback(()=>{if(!k||typeof window>"u")return null;try{const V=window.localStorage.getItem(k);if(!V)return null;const W=JSON.parse(V);return!W||!W.heatmap?null:W}catch{return null}},[k]),U=x.useCallback(V=>{if(!(!k||typeof window>"u"))try{window.localStorage.setItem(k,JSON.stringify(V))}catch{}},[k]),L=x.useCallback(()=>{if(!(!k||typeof window>"u"))try{window.localStorage.removeItem(k)}catch{}},[k]),z=x.useCallback(async()=>{const V=await Rl(e);if(!(!V&&!T&&!P)){_(!0),M(null);try{try{const O=await fW({baseUrl:t,accessToken:V,weeks:r,to:u.to,weekStartsOn:i,timeZone:s,tzOffsetMinutes:o}),G=Array.isArray(O?.weeks)?O.weeks:[];if(!G.length&&A){const H=N();if(H?.heatmap){y(H.heatmap),h(H.daily||[]),w("cache");return}}if(!G.some(H=>(Array.isArray(H)?H:[]).some(te=>te&&Number.isFinite(Number(te.level))))&&G.length){const H=[];for(const re of G)for(const ue of Array.isArray(re)?re:[])ue?.day&&H.push({day:ue.day,total_tokens:ue.total_tokens??ue.value??0,billable_total_tokens:ue.billable_total_tokens??ue.value??ue.total_tokens??0});const te=B0({dailyRows:H,weeks:r,to:O?.to||u.to,weekStartsOn:i});h(H),y({...te,week_starts_on:i,active_days:H.filter(re=>Number(re?.billable_total_tokens??re?.total_tokens)>0).length,streak_days:wh({dailyRows:H,to:O?.to||u.to})}),w("client"),A?U({heatmap:{...te,week_starts_on:i,active_days:H.filter(re=>Number(re?.billable_total_tokens??re?.total_tokens)>0).length,streak_days:wh({dailyRows:H,to:O?.to||u.to})},daily:H,fetchedAt:new Date().toISOString()}):L();return}y(O||null),h([]),w("edge"),O&&A?U({heatmap:O,daily:[],fetchedAt:new Date().toISOString()}):A||L();return}catch(O){const G=O,Y=G?.status??G?.statusCode;if(Y===401||Y===403)throw O}const W=await bk({baseUrl:t,accessToken:V,from:u.from,to:u.to,timeZone:s,tzOffsetMinutes:o}),K=Array.isArray(W?.data)?W.data:[];h(K);const Q=B0({dailyRows:K,weeks:r,to:u.to,weekStartsOn:i});y({...Q,week_starts_on:i,active_days:K.filter(O=>Number(O?.billable_total_tokens??O?.total_tokens)>0).length,streak_days:wh({dailyRows:K,to:u.to})}),w("client"),A?U({heatmap:{...Q,week_starts_on:i,active_days:K.filter(O=>Number(O?.billable_total_tokens??O?.total_tokens)>0).length,streak_days:wh({dailyRows:K,to:u.to})},daily:K,fetchedAt:new Date().toISOString()}):L()}catch(W){if(A){const K=N();if(K?.heatmap)y(K.heatmap),h(K.daily||[]),w("cache"),M(null);else{const Q=W;M(Q?.message||String(Q)),h([]),y(null),w("edge")}}else{const K=W;M(K?.message||String(K)),h([]),y(null),w("edge")}}finally{_(!1)}}},[e,t,T,n,A,u.from,u.to,N,R,s,o,i,r,L,U,P]);return x.useEffect(()=>{if(!R&&!n&&!T&&!P){h([]),_(!1),M(null),y(null),w("edge");return}if(!A)L(),h([]),M(null),y(null),w("edge");else{const V=N();V?.heatmap&&(y(V.heatmap),h(V.daily||[]),w("cache"))}z()},[e,T,N,z,R,n,A,L,P]),{range:u,daily:f,heatmap:p,source:T?"mock":v==="client"?"edge":v,loading:b,error:E,refresh:z}}function PZ({baseUrl:t,accessToken:e,limit:n=3,from:r,to:i,source:a,timeZone:s,tzOffsetMinutes:o}={}){const[c,u]=x.useState([]),[f,h]=x.useState(!1),[p,y]=x.useState(null),v=br(),w=Ll(e),b=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),_=x.useCallback(async()=>{const E=await Rl(e);if(!E&&!v&&!b){u([]),y(null),h(!1);return}h(!0),y(null);try{const M=await rW({baseUrl:t,accessToken:E,limit:n,from:r,to:i,source:a,timeZone:s,tzOffsetMinutes:o});u(Array.isArray(M?.entries)?M.entries:[])}catch(M){const T=M?.message||String(M);y(T),u([])}finally{h(!1)}},[e,t,r,n,v,a,s,i,o,b]);return x.useEffect(()=>{if(!w&&!v&&!b){u([]),y(null),h(!1);return}_()},[v,_,w,b]),{entries:c,loading:f,error:p,refresh:_}}const NZ=24;function DZ({baseUrl:t,accessToken:e,guestAllowed:n=!1,period:r,from:i,to:a,months:s=NZ,cacheKey:o,timeZone:c,tzOffsetMinutes:u,now:f,sharedRows:h,sharedRange:p}={}){const[y,v]=x.useState([]),[w,b]=x.useState(()=>({from:i,to:a})),[_,E]=x.useState("edge"),[M,T]=x.useState(null),[R,A]=x.useState(!1),[P,k]=x.useState(null),N=br(),U=Ll(e),L=!n,z=Array.isArray(h),F=p?.from||i,V=p?.to||a,W=x.useMemo(()=>r==="day"?"hourly":r==="total"?"monthly":"daily",[r]),K=(()=>{if(!o)return null;const re=LZ(t)||"default",ue=Dy({timeZone:c,offsetMinutes:u});if(W==="hourly")return`tokentracker.trend.${o}.${re}.hourly.${a||i||"day"}.${ue}`;if(W==="monthly")return`tokentracker.trend.${o}.${re}.monthly.${s}.${a||"today"}.${ue}`;const ce=`${i||""}.${a||""}`;return`tokentracker.trend.${o}.${re}.daily.${ce}.${ue}`})(),Q=x.useCallback(()=>{if(!K||typeof window>"u")return null;try{const re=window.localStorage.getItem(K);if(!re)return null;const ue=JSON.parse(re);return!ue||!Array.isArray(ue.rows)?null:ue}catch{return null}},[K]),O=x.useCallback(re=>{if(!(!K||typeof window>"u"))try{window.localStorage.setItem(K,JSON.stringify(re))}catch{}},[K]),G=x.useCallback(()=>{if(!(!K||typeof window>"u"))try{window.localStorage.removeItem(K)}catch{}},[K]),Y=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),H=x.useCallback(async()=>{if(z){v(Array.isArray(h)?h:[]),b({from:F,to:V}),E("shared"),T(null),A(!1),k(null);return}const re=await Rl(e);if(!(!re&&!N&&!Y)){A(!0),k(null);try{let ue;W==="hourly"?ue=await uW({baseUrl:t,accessToken:re,day:a||i,timeZone:c,tzOffsetMinutes:u}):W==="monthly"?ue=await dW({baseUrl:t,accessToken:re,months:s,to:a,timeZone:c,tzOffsetMinutes:u}):ue=await bk({baseUrl:t,accessToken:re,from:i,to:a,timeZone:c,tzOffsetMinutes:u});const ce=ue?.from||i||ue?.day||null,ee=ue?.to||a||ue?.day||null;let le=Array.isArray(ue?.data)?ue.data:[];W==="daily"?le=Vb(le,ce||i,ee||a,{timeZone:c,offsetMinutes:u,now:f}):W==="hourly"?le=Hb(le,{timeZone:c,offsetMinutes:u,now:f}):W==="monthly"&&(le=Wb(le,{timeZone:c,offsetMinutes:u,now:f}));const ve=new Date().toISOString();v(le),b({from:ce,to:ee}),E("edge"),T(ve),L?O({rows:le,from:ce,to:ee,mode:W,fetchedAt:ve}):G()}catch(ue){if(L){const ce=Q();if(ce?.rows){let ee=W==="daily"?Vb(ce.rows||[],ce.from||i,ce.to||a,{timeZone:c,offsetMinutes:u,now:f}):Array.isArray(ce.rows)?ce.rows:[];W==="hourly"?ee=Hb(ee,{timeZone:c,offsetMinutes:u,now:f}):W==="monthly"&&(ee=Wb(ee,{timeZone:c,offsetMinutes:u,now:f})),v(ee),b({from:ce.from||i,to:ce.to||a}),E("cache"),T(ce.fetchedAt||null),k(null)}else{v([]),b({from:i,to:a}),E("edge"),T(null);const ee=ue;k(ee?.message||String(ee))}}else{v([]),b({from:i,to:a}),E("edge"),T(null);const ce=ue;k(ce?.message||String(ce))}}finally{A(!1)}}},[e,t,i,N,n,L,W,s,Q,U,z,F,h,V,c,a,u,f,G,O,Y]);x.useEffect(()=>{if(z){v(Array.isArray(h)?h:[]),b({from:F,to:V}),E("shared"),T(null),A(!1),k(null);return}if(!U&&!n&&!N&&!Y){v([]),b({from:i,to:a}),k(null),A(!1),E("edge"),T(null);return}if(!L)G(),v([]),b({from:i,to:a}),k(null),E("edge"),T(null);else{const re=Q();if(re?.rows){let ue=W==="daily"?Vb(re.rows||[],re.from||i,re.to||a,{timeZone:c,offsetMinutes:u,now:f}):Array.isArray(re.rows)?re.rows:[];W==="hourly"?ue=Hb(ue,{timeZone:c,offsetMinutes:u,now:f}):W==="monthly"&&(ue=Wb(ue,{timeZone:c,offsetMinutes:u,now:f})),v(ue),b({from:re.from||i,to:re.to||a}),E("cache"),T(re.fetchedAt||null)}}H()},[e,N,Q,H,z,F,h,V,U,n,L,G,Y]);const te=N?"mock":_;return{rows:y,from:w.from||i,to:w.to||a,source:te,fetchedAt:M,loading:R,error:P,refresh:H}}function LZ(t){try{return new URL(t).host}catch{return null}}function zb(t){if(!t)return null;const e=String(t).trim(),n=e.split("-");if(n.length!==3)return null;const r=Number(n[0]),i=Number(n[1])-1,a=Number(n[2]);if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))return null;const s=new Date(Date.UTC(r,i,a));return Number.isFinite(s.getTime())&&Hn(s)===e?s:null}function IZ(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function Vb(t,e,n,{timeZone:r,offsetMinutes:i,now:a}={}){const s=zb(e),o=zb(n);if(!s||!o||o<s)return Array.isArray(t)?t:[];const c=a instanceof Date&&Number.isFinite(a.getTime())?a:new Date,u=yk({timeZone:r,offsetMinutes:i,date:c}),f=zb(u),h=f?f.getTime():c.getTime(),p=new Map;for(const v of t||[])v?.day&&p.set(v.day,v);const y=[];for(let v=s;v<=o;v=IZ(v,1)){const w=Hn(v),b=p.get(w),_=v.getTime()>h;if(b){y.push({...b,missing:!1,future:_});continue}y.push({day:w,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!_,future:_})}return y}function Hb(t,{timeZone:e,offsetMinutes:n,now:r}={}){if(!Array.isArray(t))return[];const i=$O({timeZone:e,offsetMinutes:n,now:r});return i?t.map(a=>{const s=a?.hour||a?.label||"",o=OZ(s);if(!o)return{...a,future:!1};const c=o.dayNum>i.dayNum||o.dayNum===i.dayNum&&o.slot>i.slot;return{...a,future:c}}):t}function Wb(t,{timeZone:e,offsetMinutes:n,now:r}={}){if(!Array.isArray(t))return[];const i=$O({timeZone:e,offsetMinutes:n,now:r});return i?t.map(a=>{const s=a?.month||a?.label||"",o=FZ(s);if(!o)return{...a,future:!1};const c=o.year>i.year||o.year===i.year&&o.month>i.month;return{...a,future:c}}):t}function $O({timeZone:t,offsetMinutes:e,now:n}={}){const r=n instanceof Date&&Number.isFinite(n.getTime())?n:new Date;if(t&&typeof Intl<"u"&&Intl.DateTimeFormat)try{const p=new Intl.DateTimeFormat("en-CA",{timeZone:t,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).formatToParts(r).reduce((E,M)=>(M.type&&M.value&&(E[M.type]=M.value),E),{}),y=Number(p.year),v=Number(p.month),w=Number(p.day),b=Number(p.hour),_=Number(p.minute);if(Number.isFinite(y)&&Number.isFinite(v)&&Number.isFinite(w)&&Number.isFinite(b)&&Number.isFinite(_)){const E=b*2+(_>=30?1:0);return{year:y,month:v,day:w,hour:b,minute:_,dayNum:y*1e4+v*100+w,slot:E}}}catch{}if(Number.isFinite(e)){const f=new Date(r.getTime()+e*60*1e3),h=f.getUTCFullYear(),p=f.getUTCMonth()+1,y=f.getUTCDate(),v=f.getUTCHours(),w=f.getUTCMinutes(),b=v*2+(w>=30?1:0);return{year:h,month:p,day:y,hour:v,minute:w,dayNum:h*1e4+p*100+y,slot:b}}const i=r.getFullYear(),a=r.getMonth()+1,s=r.getDate(),o=r.getHours(),c=r.getMinutes(),u=o*2+(c>=30?1:0);return{year:i,month:a,day:s,hour:o,minute:c,dayNum:i*1e4+a*100+s,slot:u}}function OZ(t){if(!t)return null;const e=String(t).trim(),[n,r]=e.split("T");if(!n||!r)return null;const i=n.split("-");if(i.length!==3)return null;const a=Number(i[0]),s=Number(i[1]),o=Number(i[2]);if(!Number.isFinite(a)||!Number.isFinite(s)||!Number.isFinite(o))return null;const c=r.split(":"),u=Number(c[0]),f=Number(c[1]);if(!Number.isFinite(u)||u<0||u>23||!Number.isFinite(f)||f<0||f>59)return null;const h=u*2+(f>=30?1:0);return{dayNum:a*1e4+s*100+o,slot:h}}function FZ(t){if(!t)return null;const n=String(t).trim().split("-");if(n.length!==2)return null;const r=Number(n[0]),i=Number(n[1]);return!Number.isFinite(r)||!Number.isFinite(i)||i<1||i>12?null:{year:r,month:i}}function dR({baseUrl:t,accessToken:e,guestAllowed:n=!1,from:r,to:i,includeDaily:a=!0,cacheKey:s,timeZone:o,tzOffsetMinutes:c,now:u}={}){const[f,h]=x.useState([]),[p,y]=x.useState(null),[v,w]=x.useState(null),[b,_]=x.useState("edge"),[E,M]=x.useState(null),[T,R]=x.useState(!1),[A,P]=x.useState(null),k=br(),N=Ll(e),U=!n,L=(()=>{if(!s)return null;const O=UZ(t)||"default",G=a?"daily":"summary",Y=Dy({timeZone:o,offsetMinutes:c});return`tokentracker.usage.${s}.${O}.${r}.${i}.${G}.${Y}`})(),z=x.useCallback(()=>{if(!L||typeof window>"u")return null;try{const O=window.localStorage.getItem(L);if(!O)return null;const G=JSON.parse(O);return!G||!G.summary?null:G}catch{return null}},[L]),F=x.useCallback(O=>{if(!(!L||typeof window>"u"))try{window.localStorage.setItem(L,JSON.stringify(O))}catch{}},[L]),V=x.useCallback(()=>{if(!(!L||typeof window>"u"))try{window.localStorage.removeItem(L)}catch{}},[L]),W=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),K=x.useCallback(async()=>{const O=await Rl(e);if(!(!O&&!k&&!W)){R(!0),P(null);try{let G=null,Y=null;if(a){const[ce,ee]=await Promise.allSettled([bk({baseUrl:t,accessToken:O,from:r,to:i,timeZone:o,tzOffsetMinutes:c}),xb({baseUrl:t,accessToken:O,from:r,to:i,timeZone:o,tzOffsetMinutes:c,rolling:!0})]);if(ce.status==="rejected")throw ce.reason;G=ce.value,Y=ee.status==="fulfilled"?ee.value:null}else Y=await xb({baseUrl:t,accessToken:O,from:r,to:i,timeZone:o,tzOffsetMinutes:c,rolling:!0});let H=a&&Array.isArray(G?.data)?G.data:[];a&&(H=$b(H,r,i,{timeZone:o,offsetMinutes:c,now:u}));let te=Y?.totals||G?.summary?.totals||null,re=Y?.rolling||G?.summary?.rolling||null;if(a&&!te&&!Y)try{const ce=await xb({baseUrl:t,accessToken:O,from:r,to:i,timeZone:o,tzOffsetMinutes:c,rolling:!0});te=ce?.totals||null,re=ce?.rolling||re}catch{}const ue=new Date().toISOString();h(H),y(te),w(re),_("edge"),M(ue),te&&U?F({summary:te,rolling:re,daily:H,from:r,to:i,includeDaily:a,fetchedAt:ue}):U||V()}catch(G){if(U){const Y=z();if(Y?.summary){y(Y.summary),w(Y.rolling||null);const H=Array.isArray(Y.daily)?Y.daily:[],te=a?$b(H,Y.from||r,Y.to||i,{timeZone:o,offsetMinutes:c,now:u}):H;h(te),_("cache"),M(Y.fetchedAt||null),P(null)}else{const H=G;P(H?.message||String(H)),h([]),y(null),w(null),_("edge"),M(null)}}else{const Y=G;P(Y?.message||String(Y)),h([]),y(null),w(null),_("edge"),M(null)}}finally{R(!1)}}},[e,t,r,a,k,n,U,u,z,N,o,i,c,V,F,W]);return x.useEffect(()=>{const O=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");if(!N&&!n&&!k&&!O){h([]),y(null),w(null),P(null),R(!1),_("edge"),M(null);return}if(!U)V(),h([]),y(null),w(null),P(null),_("edge"),M(null);else{const G=z();if(G?.summary){y(G.summary),w(G.rolling||null);const Y=Array.isArray(G.daily)?G.daily:[],H=a?$b(Y,G.from||r,G.to||i,{timeZone:o,offsetMinutes:c,now:u}):Y;h(H),_("cache"),M(G.fetchedAt||null)}}K()},[e,k,z,K,N,n,U,V,W]),{daily:f,summary:p,rolling:v,source:k?"mock":b,fetchedAt:E,loading:T,error:A,refresh:K}}function UZ(t){try{return new URL(t).host}catch{return null}}function Gb(t){if(!t)return null;const e=String(t).trim(),n=e.split("-");if(n.length!==3)return null;const r=Number(n[0]),i=Number(n[1])-1,a=Number(n[2]);if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))return null;const s=new Date(Date.UTC(r,i,a));return Number.isFinite(s.getTime())&&Hn(s)===e?s:null}function jZ(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function $b(t,e,n,{timeZone:r,offsetMinutes:i,now:a}={}){const s=Gb(e),o=Gb(n);if(!s||!o||o<s)return Array.isArray(t)?t:[];const c=a instanceof Date&&Number.isFinite(a.getTime())?a:new Date,u=yk({timeZone:r,offsetMinutes:i,date:c}),f=Gb(u),h=f?f.getTime():c.getTime(),p=new Map;for(const v of t||[])v?.day&&p.set(v.day,v);const y=[];for(let v=s;v<=o;v=jZ(v,1)){const w=Hn(v),b=p.get(w),_=v.getTime()>h;if(b){y.push({...b,missing:!1,future:_});continue}y.push({day:w,total_tokens:null,billable_total_tokens:null,input_tokens:null,cached_input_tokens:null,output_tokens:null,reasoning_output_tokens:null,missing:!_,future:_})}return y}function YO(t){const[e,n]=x.useState(null),[r,i]=x.useState(null),[a,s]=x.useState(!0),o=!!t?.initialRefresh,c=x.useCallback(async()=>{try{const u=await C2({refresh:!0});n(u&&typeof u=="object"?u:null),i(null)}catch(u){i(u?.message||String(u))}},[]);return x.useEffect(()=>{let u=!1;return(async()=>{try{const f=await C2(o?{refresh:!0}:{});if(u)return;n(f&&typeof f=="object"?f:null),i(null)}catch(f){if(u)return;i(f?.message||String(f))}finally{u||s(!1)}})(),()=>{u=!0}},[o]),{data:e,error:r,isLoading:a,refresh:c}}function BZ({baseUrl:t,accessToken:e,guestAllowed:n=!1,from:r,to:i,cacheKey:a,timeZone:s,tzOffsetMinutes:o}={}){const[c,u]=x.useState(null),[f,h]=x.useState("edge"),[p,y]=x.useState(!1),[v,w]=x.useState(null),b=br(),_=Ll(e),E=!n,M=x.useMemo(()=>{if(!a)return null;const U=zZ(t)||"default",L=Dy({timeZone:s,offsetMinutes:o});return`tokentracker.modelBreakdown.${a}.${U}.${r}.${i}.${L}`},[t,a,r,s,i,o]),T=x.useCallback(()=>{if(!M||typeof window>"u")return null;try{const U=window.localStorage.getItem(M);if(!U)return null;const L=JSON.parse(U);return!L||!L.breakdown?null:L}catch{return null}},[M]),R=x.useCallback(U=>{if(!(!M||typeof window>"u"))try{window.localStorage.setItem(M,JSON.stringify(U))}catch{}},[M]),A=x.useCallback(()=>{if(!(!M||typeof window>"u"))try{window.localStorage.removeItem(M)}catch{}},[M]),P=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),k=x.useCallback(async()=>{const U=await Rl(e);if(!(!U&&!b&&!P)){y(!0),w(null);try{const L=await cW({baseUrl:t,accessToken:U,from:r,to:i,timeZone:s,tzOffsetMinutes:o});u(L||null),h("edge"),L&&E?R({breakdown:L,fetchedAt:new Date().toISOString()}):E||A()}catch(L){if(E){const z=T();if(z?.breakdown)u(z.breakdown),h("cache"),w(null);else{u(null),h("edge");const F=L;w(F?.message||String(F))}}else{u(null),h("edge");const z=L;w(z?.message||String(z))}}finally{y(!1)}}},[e,t,r,b,n,E,T,s,i,_,o,A,R,P]);return x.useEffect(()=>{if(!_&&!n&&!b&&!P){u(null),h("edge"),w(null),y(!1);return}if(!E)A(),u(null),h("edge"),w(null);else{const U=T();U?.breakdown&&(u(U.breakdown),h("cache"))}k()},[e,b,T,k,_,n,E,A,P]),{breakdown:c,source:b?"mock":f,loading:p,error:v,refresh:k}}function zZ(t){try{return new URL(t).host}catch{return null}}const qO=new Set(["day","hour","month"]);function VZ(t){return qO.has(t)}function fR(t){if(t==null)return null;const e=String(t).trim();if(!/^[0-9]+$/.test(e))return null;const n=e.replace(/^0+/,"");return n.length===0?"0":n}function HZ(t,e){const n=fR(t),r=fR(e);if(n&&r)return n.length!==r.length?n.length<r.length?-1:1:n===r?0:n<r?-1:1;const i=ti(t),a=ti(e);return i==null&&a==null?0:i==null?1:a==null?-1:i===a?0:i<a?-1:1}function WZ(t,e){const n=typeof t=="string"?t:String(t||""),r=typeof e=="string"?e:String(e||"");return n===r?0:n<r?-1:1}function GZ(t){if(!t)return null;const n=String(t).trim().match(/^(\d{4})-(\d{2})-(\d{2})$/);if(!n)return null;const r=Number(n[1]),i=Number(n[2]),a=Number(n[3]);if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))return null;const s=new Date(Date.UTC(r,i-1,a));return!Number.isFinite(s.getTime())||s.getUTCFullYear()!==r||s.getUTCMonth()+1!==i||s.getUTCDate()!==a?null:s.getTime()}function $Z(t){if(!t)return null;const n=String(t).trim().match(/^(\d{4})-(\d{2})$/);if(!n)return null;const r=Number(n[1]),i=Number(n[2]);if(!Number.isFinite(r)||!Number.isFinite(i)||i<1||i>12)return null;const a=new Date(Date.UTC(r,i-1,1));return Number.isFinite(a.getTime())?a.getTime():null}function YZ(t){if(!t)return null;const n=String(t).trim().match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?Z?$/);if(!n)return null;const r=Number(n[1]),i=Number(n[2]),a=Number(n[3]),s=Number(n[4]),o=Number(n[5]),c=Number(n[6]||0);if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(s)||!Number.isFinite(o)||!Number.isFinite(c)||i<1||i>12||a<1||a>31||s<0||s>23||o<0||o>59||c<0||c>59)return null;const u=new Date(Date.UTC(r,i-1,a,s,o,c));return Number.isFinite(u.getTime())?u.getTime():null}function qZ(t,e,n){const r=n==="hour"?YZ:n==="month"?$Z:GZ,i=r(t),a=r(e);return i!=null&&a!=null?i===a?0:i<a?-1:1:WZ(t,e)}function XO(t,{key:e,dir:n}){const r=n==="asc"?1:-1,i=Array.isArray(t)?t:[],a=qO.has(e)?(o,c)=>qZ(o,c,e):HZ,s=o=>e==="total_tokens"&&o?.billable_total_tokens!=null?o.billable_total_tokens:o?.[e];return i.map((o,c)=>({row:o,index:c})).sort((o,c)=>{const u=s(o.row),f=s(c.row),h=u==null,p=f==null;if(h&&p)return o.index-c.index;if(h)return 1;if(p)return-1;const y=a(u,f);return y!==0?y*r:o.index-c.index}).map(o=>o.row)}function XZ(){return[{key:"day",label:B("daily.sort.date.label"),title:B("daily.sort.date.title")},{key:"total_tokens",label:B("daily.sort.total.label"),title:B("daily.sort.total.title")},{key:"input_tokens",label:B("daily.sort.input.label"),title:B("daily.sort.input.title")},{key:"output_tokens",label:B("daily.sort.output.label"),title:B("daily.sort.output.title")},{key:"cached_input_tokens",label:B("daily.sort.cached.label"),title:B("daily.sort.cached.title")},{key:"reasoning_output_tokens",label:B("daily.sort.reasoning.label"),title:B("daily.sort.reasoning.title")},{key:"conversation_count",label:B("daily.sort.conversations.label"),title:B("daily.sort.conversations.title")}]}function hR(t){const e=VZ(t)?t:"day";return XZ().map((n,r)=>r===0?{...n,key:e}:n)}function pR(t,{key:e,dir:n}){return XO(t,{key:e,dir:n})}const ny=12,KZ=["total_tokens","billable_total_tokens","input_tokens","cached_input_tokens","cache_creation_input_tokens","output_tokens","reasoning_output_tokens"];function ZZ(t){if(typeof t=="bigint")return t!==0n;if(typeof t=="number")return Number.isFinite(t)&&t!==0;if(t==null)return!1;const e=String(t).trim();if(!e||!/^-?\d+$/.test(e))return!1;const n=e.startsWith("-")?e.slice(1):e;return/[1-9]/.test(n)}function JZ(t){return KZ.some(e=>ZZ(t?.[e]))}function QZ(t){const e=Array.isArray(t)?t:[];if(!e.length)return[];const n=XO(e,{key:"month",dir:"asc"}),r=n.findIndex(i=>i?.month&&JZ(i));return r===-1?e:n.slice(r)}function eJ(t,e,n=ny){const r=Array.isArray(t)?t:[],i=Number.isFinite(n)&&n>0?n:ny,s=(Number.isFinite(e)&&e>=0?Math.floor(e):0)*i;return r.slice(s,s+i)}function tJ({publicMode:t,screenshotMode:e,forceInstall:n,accessEnabled:r,heatmapLoading:i,activeDays:a,hasActiveDeviceToken:s}={}){return t||e?!1:n?!0:r&&!i&&a===0&&!s}function KO(t){if(typeof t!="string")return null;const e=t.trim();return e?e.toLowerCase():null}function nJ(t){const e=KO(t?.model_id);return e||null}function ZO(t,e){return t?.model?String(t.model):e}function rJ(t,{copyFn:e}={}){const n=typeof e=="function"?e:s=>s,i=(Array.isArray(t?.sources)?t.sources:[]).map(s=>{const o=ti(s?.totals?.billable_total_tokens??s?.totals?.total_tokens)??0,c=ti(s?.totals?.total_cost_usd)??0;return{source:s?.source,totalTokens:Number.isFinite(o)?o:0,totalCost:Number.isFinite(c)?c:0,models:Array.isArray(s?.models)?s.models:[]}}).filter(s=>s.totalTokens>0);if(!i.length)return[];const a=i.reduce((s,o)=>s+o.totalTokens,0);return typeof t?.pricing?.pricing_mode=="string"&&t.pricing.pricing_mode.toUpperCase(),i.slice().sort((s,o)=>o.totalTokens-s.totalTokens).map(s=>{const o=s.source?String(s.source).toUpperCase():n("shared.placeholder.short"),c=a>0?s.totalTokens/a*100:0,u=Number.isFinite(c)?c.toFixed(1):"0.0",f=s.models.map(h=>{const p=ti(h?.totals?.billable_total_tokens??h?.totals?.total_tokens)??0;if(!Number.isFinite(p)||p<=0)return null;const y=s.totalTokens>0?Math.round(p/s.totalTokens*1e3)/10:0,v=ZO(h,n("shared.placeholder.short")),w=nJ(h),b=s.totalCost>0&&s.totalTokens>0?p/s.totalTokens*s.totalCost:null;return{id:w,name:v,share:y,usage:p,cost:b}}).filter(Boolean);return{label:o,totalPercent:String(u),usd:s.totalCost,usage:s.totalTokens,models:f}})}function iJ(t,{limit:e=3,copyFn:n}={}){const r=typeof n=="function"?n:p=>p,i=Array.isArray(t?.sources)?t.sources:[];if(!i.length)return[];const a=new Map,s=new Map,o=new Map;let c=0;for(const p of i){const y=Array.isArray(p?.models)?p.models:[];for(const v of y){const w=ti(v?.totals?.billable_total_tokens)??0;if(!Number.isFinite(w)||w<=0)continue;c+=w;const b=ZO(v,r("shared.placeholder.short")),_=KO(b);if(!_)continue;a.set(_,(a.get(_)||0)+w);const E=o.get(_)||0;w>=E&&(o.set(_,w),s.set(_,b))}}if(!a.size)return[];const u=Array.from(a.values()).reduce((p,y)=>p+y,0),f=c>0?c:u,h=Number.isFinite(e)?Math.max(0,Math.floor(e)):3;return Array.from(a.entries()).map(([p,y])=>{const v=f>0?(y/f*100).toFixed(1):"0.0";return{id:p,name:s.get(p)||r("shared.placeholder.short"),tokens:y,percent:String(v)}}).sort((p,y)=>y.tokens!==p.tokens?y.tokens-p.tokens:String(p.name).localeCompare(String(y.name))).slice(0,h)}function qy(){return typeof window<"u"}function Fl(t){return oE(t)?(t.nodeName||"").toLowerCase():"#document"}function Ar(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function qs(t){var e;return(e=(oE(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function oE(t){return qy()?t instanceof Node||t instanceof Ar(t).Node:!1}function Kn(t){return qy()?t instanceof Element||t instanceof Ar(t).Element:!1}function Tr(t){return qy()?t instanceof HTMLElement||t instanceof Ar(t).HTMLElement:!1}function d1(t){return!qy()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ar(t).ShadowRoot}function lu(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ca(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function aJ(t){return/^(table|td|th)$/.test(Fl(t))}function Xy(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const sJ=/transform|translate|scale|rotate|perspective|filter/,oJ=/paint|layout|strict|content/,cc=t=>!!t&&t!=="none";let Yb;function lE(t){const e=Kn(t)?ca(t):t;return cc(e.transform)||cc(e.translate)||cc(e.scale)||cc(e.rotate)||cc(e.perspective)||!Ky()&&(cc(e.backdropFilter)||cc(e.filter))||sJ.test(e.willChange||"")||oJ.test(e.contain||"")}function lJ(t){let e=Ro(t);for(;Tr(e)&&!ko(e);){if(lE(e))return e;if(Xy(e))return null;e=Ro(e)}return null}function Ky(){return Yb==null&&(Yb=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Yb}function ko(t){return/^(html|body|#document)$/.test(Fl(t))}function ca(t){return Ar(t).getComputedStyle(t)}function Zy(t){return Kn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ro(t){if(Fl(t)==="html")return t;const e=t.assignedSlot||t.parentNode||d1(t)&&t.host||qs(t);return d1(e)?e.host:e}function JO(t){const e=Ro(t);return ko(e)?t.ownerDocument?t.ownerDocument.body:t.body:Tr(e)&&lu(e)?e:JO(e)}function kl(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=JO(t),a=i===((r=t.ownerDocument)==null?void 0:r.body),s=Ar(i);if(a){const o=f1(s);return e.concat(s,s.visualViewport||[],lu(i)?i:[],o&&n?kl(o):[])}else return e.concat(i,kl(i,[],n))}function f1(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const mR={};function Vi(t,e){const n=x.useRef(mR);return n.current===mR&&(n.current=t(e)),n}const qb=zS[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],cJ=qb&&qb!==x.useLayoutEffect?qb:t=>t();function jt(t){const e=Vi(uJ).current;return e.next=t,cJ(e.effect),e.trampoline}function uJ(){const t={next:void 0,callback:dJ,trampoline:(...e)=>t.callback?.(...e),effect:()=>{t.callback=t.next}};return t}function dJ(){}const fJ=()=>{},Yt=typeof document<"u"?x.useLayoutEffect:fJ;function h1(t,e){if(t&&!e)return t;if(!t&&e)return e;if(t||e)return{...t,...e}}const Oh={};function Jy(t,e,n,r,i){let a={...p1(t,Oh)};return e&&(a=kh(a,e)),n&&(a=kh(a,n)),r&&(a=kh(a,r)),i&&(a=kh(a,i)),a}function hJ(t){if(t.length===0)return Oh;if(t.length===1)return p1(t[0],Oh);let e={...p1(t[0],Oh)};for(let n=1;n<t.length;n+=1)e=kh(e,t[n]);return e}function kh(t,e){return QO(e)?e(t):pJ(t,e)}function pJ(t,e){if(!e)return t;for(const n in e){const r=e[n];switch(n){case"style":{t[n]=h1(t.style,r);break}case"className":{t[n]=e4(t.className,r);break}default:mJ(n,r)?t[n]=gJ(t[n],r):t[n]=r}}return t}function mJ(t,e){const n=t.charCodeAt(0),r=t.charCodeAt(1),i=t.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof e=="function"||typeof e>"u")}function QO(t){return typeof t=="function"}function p1(t,e){return QO(t)?t(e):t??Oh}function gJ(t,e){return e?t?n=>{if(yJ(n)){const i=n;m1(i);const a=e(i);return i.baseUIHandlerPrevented||t?.(i),a}const r=e(n);return t?.(n),r}:e:t}function m1(t){return t.preventBaseUIHandler=()=>{t.baseUIHandlerPrevented=!0},t}function e4(t,e){return e?t?e+" "+t:e:t}function yJ(t){return t!=null&&typeof t=="object"&&"nativeEvent"in t}function Wi(t,...e){const n=new URL("https://base-ui.com/production-error");return n.searchParams.set("code",t.toString()),e.forEach(r=>n.searchParams.append("args[]",r)),`Base UI error #${t}; visit ${n} for the full message.`}const vJ=x.createContext(void 0);function xJ(t=!1){const e=x.useContext(vJ);if(e===void 0&&!t)throw new Error(Wi(16));return e}function bJ(t){const{focusableWhenDisabled:e,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=t,s=r&&e!==!1,o=r&&e===!1;return{props:x.useMemo(()=>{const u={onKeyDown(f){n&&e&&f.key!=="Tab"&&f.preventDefault()}};return r||(u.tabIndex=i,!a&&n&&(u.tabIndex=e?i:-1)),(a&&(e||s)||!a&&n)&&(u["aria-disabled"]=n),a&&(!e||o)&&(u.disabled=n),u},[r,n,e,s,o,a,i])}}function Qy(t={}){const{disabled:e=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0}=t,a=x.useRef(null),s=xJ(!0)!==void 0,o=jt(()=>{const p=a.current;return!!(p?.tagName==="A"&&p?.href)}),{props:c}=bJ({focusableWhenDisabled:n,disabled:e,composite:s,tabIndex:r,isNativeButton:i}),u=x.useCallback(()=>{const p=a.current;_J(p)&&s&&e&&c.disabled===void 0&&p.disabled&&(p.disabled=!1)},[e,c.disabled,s]);Yt(u,[u]);const f=x.useCallback((p={})=>{const{onClick:y,onMouseDown:v,onKeyUp:w,onKeyDown:b,onPointerDown:_,...E}=p;return Jy({type:i?"button":void 0,onClick(T){if(e){T.preventDefault();return}y?.(T)},onMouseDown(T){e||v?.(T)},onKeyDown(T){if(e||(m1(T),b?.(T)),T.baseUIHandlerPrevented)return;const R=T.target===T.currentTarget&&!i&&!o()&&!e,A=T.key==="Enter",P=T.key===" ";R&&((P||A)&&T.preventDefault(),A&&y?.(T))},onKeyUp(T){e||(m1(T),w?.(T)),!T.baseUIHandlerPrevented&&T.target===T.currentTarget&&!i&&!e&&T.key===" "&&y?.(T)},onPointerDown(T){if(e){T.preventDefault();return}_?.(T)}},i?void 0:{role:"button"},c,E)},[e,c,i,o]),h=jt(p=>{a.current=p,u()});return{getButtonProps:f,buttonRef:h}}function _J(t){return Tr(t)&&t.tagName==="BUTTON"}function Fd(t,e,n,r){const i=Vi(t4).current;return SJ(i,t,e,n,r)&&n4(i,[t,e,n,r]),i.callback}function wJ(t){const e=Vi(t4).current;return kJ(e,t)&&n4(e,t),e.callback}function t4(){return{callback:null,cleanup:null,refs:[]}}function SJ(t,e,n,r,i){return t.refs[0]!==e||t.refs[1]!==n||t.refs[2]!==r||t.refs[3]!==i}function kJ(t,e){return t.refs.length!==e.length||t.refs.some((n,r)=>n!==e[r])}function n4(t,e){if(t.refs=e,e.every(n=>n==null)){t.callback=null;return}t.callback=n=>{if(t.cleanup&&(t.cleanup(),t.cleanup=null),n!=null){const r=Array(e.length).fill(null);for(let i=0;i<e.length;i+=1){const a=e[i];if(a!=null)switch(typeof a){case"function":{const s=a(n);typeof s=="function"&&(r[i]=s);break}case"object":{a.current=n;break}}}t.cleanup=()=>{for(let i=0;i<e.length;i+=1){const a=e[i];if(a!=null)switch(typeof a){case"function":{const s=r[i];typeof s=="function"?s():a(null);break}case"object":{a.current=null;break}}}}}}}const EJ=parseInt(x.version,10);function cE(t){return EJ>=t}function gR(t){if(!x.isValidElement(t))return null;const e=t,n=e.props;return(cE(19)?n?.ref:e.ref)??null}function MJ(t,e){const n={};for(const r in t){const i=t[r];if(e?.hasOwnProperty(r)){const a=e[r](i);a!=null&&Object.assign(n,a);continue}i===!0?n[`data-${r.toLowerCase()}`]="":i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function TJ(t,e){return typeof t=="function"?t(e):t}function CJ(t,e){return typeof t=="function"?t(e):t}function sa(){}const g1=Object.freeze([]),ei=Object.freeze({}),AJ=500,RJ={style:{transition:"none"}},r4="data-base-ui-click-trigger",PJ={fallbackAxisSide:"none"},NJ={fallbackAxisSide:"end"},DJ={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function Xr(t,e,n={}){const r=e.render,i=LJ(e,n);if(n.enabled===!1)return null;const a=n.state??ei;return IJ(t,r,i,a)}function LJ(t,e={}){const{className:n,style:r,render:i}=t,{state:a=ei,ref:s,props:o,stateAttributesMapping:c,enabled:u=!0}=e,f=u?TJ(n,a):void 0,h=u?CJ(r,a):void 0,p=u?MJ(a,c):ei,y=u?h1(p,Array.isArray(o)?hJ(o):o)??ei:ei;return typeof document<"u"&&(u?Array.isArray(s)?y.ref=wJ([y.ref,gR(i),...s]):y.ref=Fd(y.ref,gR(i),s):Fd(null,null)),u?(f!==void 0&&(y.className=e4(y.className,f)),h!==void 0&&(y.style=h1(y.style,h)),y):ei}function IJ(t,e,n,r){if(e){if(typeof e=="function")return e(n,r);const i=Jy(n,e.props);return i.ref=n.ref,x.cloneElement(e,i)}if(t&&typeof t=="string")return OJ(t,n);throw new Error(Wi(8))}function OJ(t,e){return t==="button"?x.createElement("button",{type:"button",...e,key:e.key}):t==="img"?x.createElement("img",{alt:"",...e,key:e.key}):x.createElement(t,e)}function Pp(){const t=x.useContext(I3);if(t===null)throw new Error("useTheme must be used within a ThemeProvider");return t}const uc=12,ah=3,Xb=26,FJ=["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],UJ=["#30363d","#065f46","#059669","#10b981","#34d399"],jJ=[B("heatmap.month.jan"),B("heatmap.month.feb"),B("heatmap.month.mar"),B("heatmap.month.apr"),B("heatmap.month.may"),B("heatmap.month.jun"),B("heatmap.month.jul"),B("heatmap.month.aug"),B("heatmap.month.sep"),B("heatmap.month.oct"),B("heatmap.month.nov"),B("heatmap.month.dec")];function BJ(t){if(typeof t=="bigint")return t.toLocaleString();if(typeof t=="number")return Number.isFinite(t)?Math.round(t).toLocaleString():"0";if(typeof t=="string"){const e=Number(t);return Number.isFinite(e)?Math.round(e).toLocaleString():t}return"0"}function zJ(t){if(typeof t!="string")return null;const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t.trim());if(!e)return null;const n=new Date(Date.UTC(Number(e[1]),Number(e[2])-1,Number(e[3])));return Number.isFinite(n.getTime())?n:null}function i4(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function VJ(t,e){return Math.floor((Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()))/864e5)}function HJ(t,e){const n=e==="mon"?1:0,r=t.getUTCDay();return i4(t,-((r-n+7)%7))}function WJ(t,e,n){if(!t)return[];const r=zJ(e)||new Date,i=[];for(let u=11;u>=0;u-=1)i.push(new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth()-u,1)));const a=HJ(r,n),s=i4(a,-(t-1)*7),o=[],c=new Set;for(const u of i){const f=Math.floor(VJ(s,u)/7);f<0||f>=t||c.has(f)||(c.add(f),o.push({label:jJ[u.getUTCMonth()],index:f}))}return o}function GJ({heatmap:t,timeZoneLabel:e,timeZoneShortLabel:n,hideLegend:r=!1}){const{resolvedTheme:i}=Pp(),s=i==="dark"?UJ:FJ,o=x.useRef(null);x.useEffect(()=>{const v=o.current;v&&(v.scrollLeft=v.scrollWidth)},[t?.weeks]);const c=t?.week_starts_on==="mon"?"mon":"sun",u=x.useMemo(()=>{const v=Array.isArray(t?.weeks)?t.weeks:[];if(!v.length)return{weeks:[]};const w=[];for(const b of v)for(const _ of Array.isArray(b)?b:[])_?.day&&w.push({day:_.day,total_tokens:_.total_tokens??_.value??0,billable_total_tokens:_.billable_total_tokens??_.value??_.total_tokens??0});return B0({dailyRows:w,weeks:Math.max(52,v.length),to:t?.to,weekStartsOn:c})},[t?.to,t?.weeks,c]),f=u?.weeks||[],h=c==="mon"?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(v=>B(`heatmap.day.${v.toLowerCase()}`)):["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(v=>B(`heatmap.day.${v.toLowerCase()}`)),p=x.useMemo(()=>WJ(f.length,u?.to,c),[u?.to,f.length,c]);if(!f.length)return m.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:B("heatmap.empty")});const y=Xb+f.length*uc+Math.max(0,f.length-1)*ah;return m.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[m.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[m.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:B("heatmap.title")}),m.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400",children:n||B("heatmap.legend.utc")})]}),m.jsx("div",{ref:o,className:"overflow-x-auto overflow-y-hidden heatmap-scroll-thin",children:m.jsxs("div",{style:{minWidth:y},children:[m.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:`${Xb}px repeat(${f.length}, ${uc}px)`,columnGap:ah},children:[m.jsx("span",{}),p.map(v=>m.jsx("span",{style:{gridColumnStart:v.index+2},className:"whitespace-nowrap",children:v.label},`${v.label}-${v.index}`))]}),m.jsxs("div",{className:"grid",style:{gridTemplateColumns:`${Xb}px repeat(${f.length}, ${uc}px)`,columnGap:ah},children:[m.jsx("div",{className:"grid text-[10px] text-oai-gray-400 dark:text-oai-gray-400 sticky left-0 bg-white dark:bg-oai-gray-900 pr-2",style:{gridTemplateRows:`repeat(7, ${uc}px)`,rowGap:ah},children:h.map(v=>m.jsx("span",{className:"leading-none",children:v},v))}),m.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${uc}px)`,gap:ah},children:f.map((v,w)=>(Array.isArray(v)?v:[]).map((b,_)=>{if(!b)return null;const E=b.day||`e-${w}-${_}`,M=Number(b.level)||0,T=s[M]||s[0],R=e||n||B("heatmap.legend.utc");return m.jsx("span",{title:B("heatmap.tooltip",{day:b.day,value:BJ(b.value),unit:B("heatmap.unit.tokens"),tz:R}),className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10",style:{width:uc,height:uc,background:T}},E)}))})]})]})}),!r&&m.jsxs("div",{className:"flex items-center justify-center gap-2 mt-3",children:[m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:B("heatmap.legend.less")}),m.jsx("div",{className:"flex gap-0.5",children:s.map((v,w)=>m.jsx("span",{className:"rounded-[1px]",style:{width:10,height:10,background:v}},w))}),m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400",children:B("heatmap.legend.more")})]})]})}const a4={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},uE={...a4,position:"fixed",top:0,left:0},$J={...a4,position:"absolute"};function YJ(t){const e=x.useRef(!0);e.current&&(e.current=!1,t())}function yR({controlled:t,default:e,name:n,state:r="value"}){const{current:i}=x.useRef(t!==void 0),[a,s]=x.useState(e),o=i?t:a,c=x.useCallback(u=>{i||s(u)},[]);return[o,c]}function Fr(t){const e=Vi(qJ,t).current;return e.next=t,Yt(e.effect),e}function qJ(t){const e={current:t,next:t,effect:()=>{e.current=e.next}};return e}var ry=Symbol("NOT_FOUND");function XJ(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function KJ(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function ZJ(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var vR=t=>Array.isArray(t)?t:[t];function JJ(t){const e=Array.isArray(t[0])?t[0]:t;return ZJ(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function QJ(t,e){const n=[],{length:r}=t;for(let i=0;i<r;i++)n.push(t[i].apply(null,e));return n}function eQ(t){let e;return{get(n){return e&&t(e.key,n)?e.value:ry},put(n,r){e={key:n,value:r}},getEntries(){return e?[e]:[]},clear(){e=void 0}}}function tQ(t,e){let n=[];function r(o){const c=n.findIndex(u=>e(o,u.key));if(c>-1){const u=n[c];return c>0&&(n.splice(c,1),n.unshift(u)),u.value}return ry}function i(o,c){r(o)===ry&&(n.unshift({key:o,value:c}),n.length>t&&n.pop())}function a(){return n}function s(){n=[]}return{get:r,put:i,getEntries:a,clear:s}}var nQ=(t,e)=>t===e;function rQ(t){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:i}=n;for(let a=0;a<i;a++)if(!t(n[a],r[a]))return!1;return!0}}function iQ(t,e){const n=typeof e=="object"?e:{equalityCheck:e},{equalityCheck:r=nQ,maxSize:i=1,resultEqualityCheck:a}=n,s=rQ(r);let o=0;const c=i<=1?eQ(s):tQ(i,s);function u(){let f=c.get(arguments);if(f===ry){if(f=t.apply(null,arguments),o++,a){const p=c.getEntries().find(y=>a(y.value,f));p&&(f=p.value,o!==0&&o--)}c.put(arguments,f)}return f}return u.clearCache=()=>{c.clear(),u.resetResultsCount()},u.resultsCount=()=>o,u.resetResultsCount=()=>{o=0},u}var aQ=class{constructor(t){this.value=t}deref(){return this.value}},sQ=typeof WeakRef<"u"?WeakRef:aQ,oQ=0,xR=1;function fg(){return{s:oQ,v:void 0,o:null,p:null}}function s4(t,e={}){let n=fg();const{resultEqualityCheck:r}=e;let i,a=0;function s(){let o=n;const{length:c}=arguments;for(let h=0,p=c;h<p;h++){const y=arguments[h];if(typeof y=="function"||typeof y=="object"&&y!==null){let v=o.o;v===null&&(o.o=v=new WeakMap);const w=v.get(y);w===void 0?(o=fg(),v.set(y,o)):o=w}else{let v=o.p;v===null&&(o.p=v=new Map);const w=v.get(y);w===void 0?(o=fg(),v.set(y,o)):o=w}}const u=o;let f;if(o.s===xR)f=o.v;else if(f=t.apply(null,arguments),a++,r){const h=i?.deref?.()??i;h!=null&&r(h,f)&&(f=h,a!==0&&a--),i=typeof f=="object"&&f!==null||typeof f=="function"?new sQ(f):f}return u.s=xR,u.v=f,f}return s.clearCache=()=>{n=fg(),s.resetResultsCount()},s.resultsCount=()=>a,s.resetResultsCount=()=>{a=0},s}function o4(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let a=0,s=0,o,c={},u=i.pop();typeof u=="object"&&(c=u,u=i.pop()),XJ(u,`createSelector expects an output function after the inputs, but received: [${typeof u}]`);const f={...n,...c},{memoize:h,memoizeOptions:p=[],argsMemoize:y=s4,argsMemoizeOptions:v=[]}=f,w=vR(p),b=vR(v),_=JJ(i),E=h(function(){return a++,u.apply(null,arguments)},...w),M=y(function(){s++;const R=QJ(_,arguments);return o=E.apply(null,R),o},...b);return Object.assign(M,{resultFunc:u,memoizedResultFunc:E,dependencies:_,dependencyRecomputations:()=>s,resetDependencyRecomputations:()=>{s=0},lastResult:()=>o,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:h,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var lQ=o4(s4),cQ=Object.assign((t,e=lQ)=>{KJ(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(a=>t[a]);return e(r,(...a)=>a.reduce((s,o,c)=>(s[n[c]]=o,s),{}))},{withTypes:()=>cQ});o4({memoize:iQ,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const At=(t,e,n,r,i,a,...s)=>{if(s.length>0)throw new Error(Wi(1));let o;if(t)o=t;else throw new Error("Missing arguments");return o};var Kb={exports:{}},Zb={};var bR;function uQ(){if(bR)return Zb;bR=1;var t=hp();function e(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue;function o(h,p){var y=p(),v=r({inst:{value:y,getSnapshot:p}}),w=v[0].inst,b=v[1];return a(function(){w.value=y,w.getSnapshot=p,c(w)&&b({inst:w})},[h,y,p]),i(function(){return c(w)&&b({inst:w}),h(function(){c(w)&&b({inst:w})})},[h]),s(y),y}function c(h){var p=h.getSnapshot;h=h.value;try{var y=p();return!n(h,y)}catch{return!0}}function u(h,p){return p()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:o;return Zb.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:f,Zb}var _R;function l4(){return _R||(_R=1,Kb.exports=uQ()),Kb.exports}var dQ=l4(),Jb={exports:{}},Qb={};var wR;function fQ(){if(wR)return Qb;wR=1;var t=hp(),e=l4();function n(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,a=t.useRef,s=t.useEffect,o=t.useMemo,c=t.useDebugValue;return Qb.useSyncExternalStoreWithSelector=function(u,f,h,p,y){var v=a(null);if(v.current===null){var w={hasValue:!1,value:null};v.current=w}else w=v.current;v=o(function(){function _(A){if(!E){if(E=!0,M=A,A=p(A),y!==void 0&&w.hasValue){var P=w.value;if(y(P,A))return T=P}return T=A}if(P=T,r(M,A))return P;var k=p(A);return y!==void 0&&y(P,k)?(M=A,P):(M=A,T=k)}var E=!1,M,T,R=h===void 0?null:h;return[function(){return _(f())},R===null?void 0:function(){return _(R())}]},[f,h,p,y]);var b=i(u,v[0],v[1]);return s(function(){w.hasValue=!0,w.value=b},[b]),c(b),b},Qb}var SR;function hQ(){return SR||(SR=1,Jb.exports=fQ()),Jb.exports}var pQ=hQ();const mQ=cE(19),gQ=mQ?yQ:vQ;function mn(t,e,n,r,i){return gQ(t,e,n,r,i)}function yQ(t,e,n,r,i){const a=x.useCallback(()=>e(t.getSnapshot(),n,r,i),[t,e,n,r,i]);return dQ.useSyncExternalStore(t.subscribe,a,a)}function vQ(t,e,n,r,i){return pQ.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getSnapshot,a=>e(a,n,r,i))}class Ed{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(e)}}update(e){for(const n in e)if(!Object.is(this.state[n],e[n])){Ed.prototype.setState.call(this,{...this.state,...e});return}}set(e,n){Object.is(this.state[e],n)||Ed.prototype.setState.call(this,{...this.state,[e]:n})}notifyAll(){const e={...this.state};Ed.prototype.setState.call(this,e)}}class dE extends Ed{constructor(e,n={},r){super(e),this.context=n,this.selectors=r}controlledValues=new Map;useSyncedValue(e,n){x.useDebugValue(e),Yt(()=>{this.state[e]!==n&&this.set(e,n)},[e,n])}useSyncedValueWithCleanup(e,n){const r=this;Yt(()=>(r.state[e]!==n&&r.set(e,n),()=>{r.set(e,void 0)}),[r,e,n])}useSyncedValues(e){const n=this,r=Object.values(e);Yt(()=>{n.update(e)},[n,...r])}useControlledProp(e,n,r){x.useDebugValue(e);const i=this,a=n!==void 0;this.controlledValues.has(e)||(this.controlledValues.set(e,a),!a&&!Object.is(this.state[e],r)&&super.setState({...this.state,[e]:r})),Yt(()=>{a&&!Object.is(i.state[e],n)&&super.setState({...i.state,[e]:n})},[i,e,n,r,a])}set(e,n){this.controlledValues.get(e)!==!0&&super.set(e,n)}update(e){const n={...e};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.update(n)}setState(e){const n={...e};for(const r in n)if(Object.hasOwn(n,r)&&this.controlledValues.get(r)===!0){delete n[r];continue}super.setState({...this.state,...n})}select=(e,n,r,i)=>{const a=this.selectors[e];return a(this.state,n,r,i)};useState=(e,n,r,i)=>{x.useDebugValue(e);const a=this.selectors[e];return mn(this,a,n,r,i)};useContextCallback(e,n){x.useDebugValue(e);const r=jt(n??sa);this.context[e]=r}useStateSetter(e){const n=x.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(e,r)}),n.current}observe(e,n){let r;typeof e=="function"?r=e:r=this.selectors[e];let i=r(this.state);return n(i,i,this),this.subscribe(a=>{const s=r(a);if(!Object.is(i,s)){const o=i;i=s,n(s,o,this)}})}}const xQ=[];function fE(t){x.useEffect(t,xQ)}const hg=null;class bQ{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let i=0;i<n.length;i+=1)n[i]?.(e)};request(e){const n=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(e){const n=e-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const pg=new bQ;class Ss{static create(){return new Ss}static request(e){return pg.request(e)}static cancel(e){return pg.cancel(e)}currentId=hg;request(e){this.cancel(),this.currentId=pg.request(()=>{this.currentId=hg,e()})}cancel=()=>{this.currentId!==hg&&(pg.cancel(this.currentId),this.currentId=hg)};disposeEffect=()=>this.cancel}function ev(){const t=Vi(Ss.create).current;return fE(t.disposeEffect),t}const sh=0;class Nl{static create(){return new Nl}currentId=sh;start(e,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=sh,n()},e)}isStarted(){return this.currentId!==sh}clear=()=>{this.currentId!==sh&&(clearTimeout(this.currentId),this.currentId=sh)};disposeEffect=()=>this.clear}function ji(){const t=Vi(Nl.create).current;return fE(t.disposeEffect),t}const rf=typeof navigator<"u",e_=SQ(),c4=EQ(),u4=kQ(),d4=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),f4=e_.platform==="MacIntel"&&e_.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(e_.platform),_Q=rf&&/apple/i.test(navigator.vendor),y1=rf&&/android/i.test(c4)||/android/i.test(u4);rf&&c4.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const wQ=u4.includes("jsdom/");function SQ(){if(!rf)return{platform:"",maxTouchPoints:-1};const t=navigator.userAgentData;return t?.platform?{platform:t.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function kQ(){if(!rf)return"";const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(({brand:e,version:n})=>`${e}/${n}`).join(" "):navigator.userAgent}function EQ(){if(!rf)return"";const t=navigator.userAgentData;return t?.platform?t.platform:navigator.platform??""}const v1="data-base-ui-focusable",h4="active",p4="selected",m4="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",El="ArrowLeft",Ml="ArrowRight",hE="ArrowUp",Np="ArrowDown";function gl(t){let e=t.activeElement;for(;e?.shadowRoot?.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function On(t,e){if(!t||!e)return!1;const n=e.getRootNode?.();if(t.contains(e))return!0;if(n&&d1(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Fi(t){return"composedPath"in t?t.composedPath()[0]:t.target}function za(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function MQ(t){return t.matches("html,body")}function Mr(t){return t?.ownerDocument||document}function g4(t){return Tr(t)&&t.matches(m4)}function x1(t){return t?t.getAttribute("role")==="combobox"&&g4(t):!1}function tp(t){return t?t.hasAttribute(v1)?t:t.querySelector(`[${v1}]`)||t:null}function Uc(t,e,n=!0){return t.filter(i=>i.parentId===e&&(!n||i.context?.open)).flatMap(i=>[i,...Uc(t,i.id,n)])}function kR(t,e){let n=[],r=t.find(i=>i.id===e)?.parentId;for(;r;){const i=t.find(a=>a.id===r);r=i?.parentId,i&&(n=n.concat(i))}return n}function pi(t){t.preventDefault(),t.stopPropagation()}function TQ(t){return"nativeEvent"in t}function y4(t){return t.mozInputSource===0&&t.isTrusted?!0:y1&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function v4(t){return wQ?!1:!y1&&t.width===0&&t.height===0||y1&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function Ud(t,e){const n=["mouse","pen"];return e||n.push("",void 0),n.includes(t)}function x4(t){const e=t.type;return e==="click"||e==="mousedown"||e==="keydown"||e==="keyup"}const CQ=["top","right","bottom","left"],jd=Math.min,ia=Math.max,iy=Math.round,wd=Math.floor,Ds=t=>({x:t,y:t}),AQ={left:"right",right:"left",bottom:"top",top:"bottom"};function b1(t,e,n){return ia(t,jd(e,n))}function Po(t,e){return typeof t=="function"?t(e):t}function Bi(t){return t.split("-")[0]}function Ul(t){return t.split("-")[1]}function pE(t){return t==="x"?"y":"x"}function mE(t){return t==="y"?"height":"width"}function Ma(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function gE(t){return pE(Ma(t))}function RQ(t,e,n){n===void 0&&(n=!1);const r=Ul(t),i=gE(t),a=mE(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(s=ay(s)),[s,ay(s)]}function PQ(t){const e=ay(t);return[_1(t),e,_1(e)]}function _1(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const ER=["left","right"],MR=["right","left"],NQ=["top","bottom"],DQ=["bottom","top"];function LQ(t,e,n){switch(t){case"top":case"bottom":return n?e?MR:ER:e?ER:MR;case"left":case"right":return e?NQ:DQ;default:return[]}}function IQ(t,e,n,r){const i=Ul(t);let a=LQ(Bi(t),n==="start",r);return i&&(a=a.map(s=>s+"-"+i),e&&(a=a.concat(a.map(_1)))),a}function ay(t){const e=Bi(t);return AQ[e]+t.slice(e.length)}function OQ(t){return{top:0,right:0,bottom:0,left:0,...t}}function b4(t){return typeof t!="number"?OQ(t):{top:t,right:t,bottom:t,left:t}}function sy(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function mg(t,e,n){return Math.floor(t/e)!==n}function Fh(t,e){return e<0||e>=t.current.length}function t_(t,e){return fi(t,{disabledIndices:e})}function TR(t,e){return fi(t,{decrement:!0,startingIndex:t.current.length,disabledIndices:e})}function fi(t,{startingIndex:e=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=e;do a+=n?-i:i;while(a>=0&&a<=t.current.length-1&&Uh(t,a,r));return a}function FQ(t,{event:e,orientation:n,loopFocus:r,rtl:i,cols:a,disabledIndices:s,minIndex:o,maxIndex:c,prevIndex:u,stopEvent:f=!1}){let h=u;const p=[],y={};let v=!1;{let _=null,E=-1;t.current.forEach((M,T)=>{if(M==null)return;const R=M.closest('[role="row"]');R&&(v=!0),(R!==_||E===-1)&&(_=R,E+=1,p[E]=[]),p[E].push(T),y[T]=E})}const w=v&&p.length>0&&p.some(_=>_.length!==a);function b(_){if(!w||u===-1)return;const E=y[u];if(E==null)return;const M=p[E].indexOf(u);let T=_==="up"?E-1:E+1;r&&(T<0?T=p.length-1:T>=p.length&&(T=0));const R=new Set;for(;T>=0&&T<p.length&&!R.has(T);){R.add(T);const A=p[T];if(A.length===0){T=_==="up"?T-1:T+1;continue}const P=Math.min(M,A.length-1);for(let k=P;k>=0;k-=1){const N=A[k];if(!Uh(t,N,s))return N}T=_==="up"?T-1:T+1,r&&(T<0?T=p.length-1:T>=p.length&&(T=0))}}if(e.key===hE){const _=b("up");if(_!==void 0)f&&pi(e),h=_;else{if(f&&pi(e),u===-1)h=c;else if(h=fi(t,{startingIndex:h,amount:a,decrement:!0,disabledIndices:s}),r&&(u-a<o||h<0)){const E=u%a,M=c%a,T=c-(M-E);M===E?h=c:h=M>E?T:T-a}Fh(t,h)&&(h=u)}}if(e.key===Np){const _=b("down");_!==void 0?(f&&pi(e),h=_):(f&&pi(e),u===-1?h=o:(h=fi(t,{startingIndex:u,amount:a,disabledIndices:s}),r&&u+a>c&&(h=fi(t,{startingIndex:u%a-a,amount:a,disabledIndices:s}))),Fh(t,h)&&(h=u))}if(n==="both"){const _=wd(u/a);e.key===(i?El:Ml)&&(f&&pi(e),u%a!==a-1?(h=fi(t,{startingIndex:u,disabledIndices:s}),r&&mg(h,a,_)&&(h=fi(t,{startingIndex:u-u%a-1,disabledIndices:s}))):r&&(h=fi(t,{startingIndex:u-u%a-1,disabledIndices:s})),mg(h,a,_)&&(h=u)),e.key===(i?Ml:El)&&(f&&pi(e),u%a!==0?(h=fi(t,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&mg(h,a,_)&&(h=fi(t,{startingIndex:u+(a-u%a),decrement:!0,disabledIndices:s}))):r&&(h=fi(t,{startingIndex:u+(a-u%a),decrement:!0,disabledIndices:s})),mg(h,a,_)&&(h=u));const E=wd(c/a)===_;Fh(t,h)&&(r&&E?h=e.key===(i?Ml:El)?c:fi(t,{startingIndex:u-u%a-1,disabledIndices:s}):h=u)}return h}function UQ(t,e,n){const r=[];let i=0;return t.forEach(({width:a,height:s},o)=>{let c=!1;for(n&&(i=0);!c;){const u=[];for(let f=0;f<a;f+=1)for(let h=0;h<s;h+=1)u.push(i+f+h*e);i%e+a<=e&&u.every(f=>r[f]==null)?(u.forEach(f=>{r[f]=o}),c=!0):i+=1}}),[...r]}function jQ(t,e,n,r,i){if(t===-1)return-1;const a=n.indexOf(t),s=e[t];switch(i){case"tl":return a;case"tr":return s?a+s.width-1:a;case"bl":return s?a+(s.height-1)*r:a;case"br":return n.lastIndexOf(t);default:return-1}}function BQ(t,e){return e.flatMap((n,r)=>t.includes(n)?[r]:[])}function Uh(t,e,n){if(typeof n=="function")return n(e);if(n)return n.includes(e);const r=t.current[e];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}var zQ=["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] *)"],oy=zQ.join(","),_4=typeof Element>"u",Bd=_4?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ly=!_4&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},cy=function(e,n){var r;n===void 0&&(n=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),a=i===""||i==="true",s=a||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):cy(e.parentNode));return s},VQ=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},w4=function(e,n,r){if(cy(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(oy));return n&&Bd.call(e,oy)&&i.unshift(e),i=i.filter(r),i},uy=function(e,n,r){for(var i=[],a=Array.from(e);a.length;){var s=a.shift();if(!cy(s,!1))if(s.tagName==="SLOT"){var o=s.assignedElements(),c=o.length?o:s.children,u=uy(c,!0,r);r.flatten?i.push.apply(i,u):i.push({scopeParent:s,candidates:u})}else{var f=Bd.call(s,oy);f&&r.filter(s)&&(n||!e.includes(s))&&i.push(s);var h=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!cy(h,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(h&&p){var y=uy(h===!0?s.children:h.children,!0,r);r.flatten?i.push.apply(i,y):i.push({scopeParent:s,candidates:y})}else a.unshift.apply(a,s.children)}}return i},S4=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},k4=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||VQ(e))&&!S4(e)?0:e.tabIndex},HQ=function(e,n){var r=k4(e);return r<0&&n&&!S4(e)?0:r},WQ=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},E4=function(e){return e.tagName==="INPUT"},GQ=function(e){return E4(e)&&e.type==="hidden"},$Q=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},YQ=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},qQ=function(e){if(!e.name)return!0;var n=e.form||ly(e),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(e.name));else try{i=r(e.name)}catch(s){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",s.message),!1}var a=YQ(i,e.form);return!a||a===e},XQ=function(e){return E4(e)&&e.type==="radio"},KQ=function(e){return XQ(e)&&!qQ(e)},ZQ=function(e){var n,r=e&&ly(e),i=(n=r)===null||n===void 0?void 0:n.host,a=!1;if(r&&r!==e){var s,o,c;for(a=!!((s=i)!==null&&s!==void 0&&(o=s.ownerDocument)!==null&&o!==void 0&&o.contains(i)||e!=null&&(c=e.ownerDocument)!==null&&c!==void 0&&c.contains(e));!a&&i;){var u,f,h;r=ly(i),i=(u=r)===null||u===void 0?void 0:u.host,a=!!((f=i)!==null&&f!==void 0&&(h=f.ownerDocument)!==null&&h!==void 0&&h.contains(i))}}return a},CR=function(e){var n=e.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},JQ=function(e,n){var r=n.displayCheck,i=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var a=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!a}if(getComputedStyle(e).visibility==="hidden")return!0;var s=Bd.call(e,"details>summary:first-of-type"),o=s?e.parentElement:e;if(Bd.call(o,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof i=="function"){for(var c=e;e;){var u=e.parentElement,f=ly(e);if(u&&!u.shadowRoot&&i(u)===!0)return CR(e);e.assignedSlot?e=e.assignedSlot:!u&&f!==e.ownerDocument?e=f.host:e=u}e=c}if(ZQ(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return CR(e);return!1},QQ=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return Bd.call(n,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}n=n.parentElement}return!1},w1=function(e,n){return!(n.disabled||GQ(n)||JQ(n,e)||$Q(n)||QQ(n))},S1=function(e,n){return!(KQ(n)||k4(n)<0||!w1(e,n))},eee=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},M4=function(e){var n=[],r=[];return e.forEach(function(i,a){var s=!!i.scopeParent,o=s?i.scopeParent:i,c=HQ(o,s),u=s?M4(i.candidates):o;c===0?s?n.push.apply(n,u):n.push(o):r.push({documentOrder:a,tabIndex:c,item:i,isScope:s,content:u})}),r.sort(WQ).reduce(function(i,a){return a.isScope?i.push.apply(i,a.content):i.push(a.content),i},[]).concat(n)},Dp=function(e,n){n=n||{};var r;return n.getShadowRoot?r=uy([e],n.includeContainer,{filter:S1.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:eee}):r=w4(e,n.includeContainer,S1.bind(null,n)),M4(r)},tee=function(e,n){n=n||{};var r;return n.getShadowRoot?r=uy([e],n.includeContainer,{filter:w1.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=w4(e,n.includeContainer,w1.bind(null,n)),r},T4=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return Bd.call(e,oy)===!1?!1:S1(n,e)};const af=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function C4(t,e){const n=Dp(t,af()),r=n.length;if(r===0)return;const i=gl(Mr(t)),a=n.indexOf(i),s=a===-1?e===1?0:r-1:a+e;return n[s]}function yE(t){return C4(Mr(t).body,1)||t}function A4(t){return C4(Mr(t).body,-1)||t}function R4(t,e){if(!t)return null;const n=Dp(Mr(t).body,af()),r=n.length;if(r===0)return null;const i=n.indexOf(t);if(i===-1)return null;const a=(i+e+r)%r;return n[a]}function nee(t){return R4(t,1)}function ree(t){return R4(t,-1)}function Md(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!On(n,r)}function iee(t){Dp(t,af()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function AR(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const aee={...zS};let RR=0;function see(t,e="mui"){const[n,r]=x.useState(t),i=t||n;return x.useEffect(()=>{n==null&&(RR+=1,r(`${e}-${RR}`))},[n,e]),i}const PR=aee.useId;function sf(t,e){if(PR!==void 0){const n=PR();return t??(e?`${e}-${n}`:n)}return see(t,e)}function P4(){const t=new Map;return{emit(e,n){t.get(e)?.forEach(r=>r(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){t.get(e)?.delete(n)}}}class oee{nodesRef={current:[]};events=P4();addNode(e){this.nodesRef.current.push(e)}removeNode(e){const n=this.nodesRef.current.findIndex(r=>r===e);n!==-1&&this.nodesRef.current.splice(n,1)}}const N4=x.createContext(null),D4=x.createContext(null),jl=()=>x.useContext(N4)?.id||null,cu=t=>{const e=x.useContext(D4);return t??e};function lee(t){const e=sf(),n=cu(t),r=jl();return Yt(()=>{if(!e)return;const i={id:e,parentId:r};return n?.addNode(i),()=>{n?.removeNode(i)}},[n,e,r]),e}function cee(t){const{children:e,id:n}=t,r=jl();return m.jsx(N4.Provider,{value:x.useMemo(()=>({id:n,parentId:r}),[n,r]),children:e})}function uee(t){const{children:e,externalTree:n}=t,r=Vi(()=>n??new oee).current;return m.jsx(D4.Provider,{value:r,children:e})}const tv="none",Tl="trigger-press",aa="trigger-hover",vE="outside-press",n_="item-press",dee="close-press",Kc="focus-out",L4="escape-key",r_="list-navigation",fee="cancel-open",I4="imperative-action",hee="window-resize";function Mn(t,e,n,r){let i=!1,a=!1;const s=ei;return{reason:t,event:e??new Event("base-ui"),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...s}}function np(t){return`data-base-ui-${t}`}function i_(t,e,n){if(n&&!Ud(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function zs(t){return t?.ownerDocument||document}const zd=x.forwardRef(function(e,n){const[r,i]=x.useState();Yt(()=>{_Q&&i("button")},[]);const a={tabIndex:0,role:r};return m.jsx("span",{...e,ref:n,style:uE,"aria-hidden":r?void 0:!0,...a,"data-base-ui-focus-guard":""})});let NR=0;function g0(t,e={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=e;r&&cancelAnimationFrame(NR);const a=()=>t?.focus({preventScroll:n});i?a():NR=requestAnimationFrame(a)}const Td={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function DR(t){return t==="inert"?Td.inert:t==="aria-hidden"?Td["aria-hidden"]:Td.none}let gg=new WeakSet,yg={},a_=0;const O4=t=>t&&(t.host||O4(t.parentNode)),pee=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=O4(n);return t.contains(r)?r:null}).filter(n=>n!=null);function mee(t,e,n,r){const i="data-base-ui-inert",a=r?"inert":n?"aria-hidden":null,s=pee(e,t),o=new Set,c=new Set(s),u=[];yg[i]||(yg[i]=new WeakMap);const f=yg[i];s.forEach(h),p(e),o.clear();function h(y){!y||o.has(y)||(o.add(y),y.parentNode&&h(y.parentNode))}function p(y){!y||c.has(y)||[].forEach.call(y.children,v=>{if(Fl(v)!=="script")if(o.has(v))p(v);else{const w=a?v.getAttribute(a):null,b=w!==null&&w!=="false",_=DR(a),E=(_.get(v)||0)+1,M=(f.get(v)||0)+1;_.set(v,E),f.set(v,M),u.push(v),E===1&&b&&gg.add(v),M===1&&v.setAttribute(i,""),!b&&a&&v.setAttribute(a,a==="inert"?"":"true")}})}return a_+=1,()=>{u.forEach(y=>{const v=DR(a),b=(v.get(y)||0)-1,_=(f.get(y)||0)-1;v.set(y,b),f.set(y,_),b||(!gg.has(y)&&a&&y.removeAttribute(a),gg.delete(y)),_||y.removeAttribute(i)}),a_-=1,a_||(Td.inert=new WeakMap,Td["aria-hidden"]=new WeakMap,Td.none=new WeakMap,gg=new WeakSet,yg={})}}function gee(t,e=!1,n=!1){const r=Mr(t[0]).body;return mee(t.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,e,n)}const F4=x.createContext(null),U4=()=>x.useContext(F4),yee=np("portal");function vee(t={}){const{ref:e,container:n,componentProps:r=ei,elementProps:i,elementState:a}=t,s=sf(),c=U4()?.portalNode,[u,f]=x.useState(null),[h,p]=x.useState(null),y=jt(_=>{_!==null&&p(_)}),v=x.useRef(null);Yt(()=>{if(n===null){v.current&&(v.current=null,p(null),f(null));return}if(s==null)return;const _=(n&&(oE(n)?n:n.current))??c??document.body;if(_==null){v.current&&(v.current=null,p(null),f(null));return}v.current!==_&&(v.current=_,p(null),f(_))},[n,c,s]);const w=Xr("div",r,{ref:[e,y],state:a,props:[{id:s,[yee]:""},i]});return{portalNode:h,portalSubtree:u&&w?gi.createPortal(w,u):null}}const xE=x.forwardRef(function(e,n){const{children:r,container:i,className:a,render:s,renderGuards:o,...c}=e,{portalNode:u,portalSubtree:f}=vee({container:i,ref:n,componentProps:e,elementProps:c}),h=x.useRef(null),p=x.useRef(null),y=x.useRef(null),v=x.useRef(null),[w,b]=x.useState(null),_=w?.modal,E=w?.open,M=typeof o=="boolean"?o:!!w&&!w.modal&&w.open&&!!u;x.useEffect(()=>{if(!u||_)return;function R(A){u&&A.relatedTarget&&Md(A)&&(A.type==="focusin"?AR:iee)(u)}return u.addEventListener("focusin",R,!0),u.addEventListener("focusout",R,!0),()=>{u.removeEventListener("focusin",R,!0),u.removeEventListener("focusout",R,!0)}},[u,_]),x.useEffect(()=>{!u||E||AR(u)},[E,u]);const T=x.useMemo(()=>({beforeOutsideRef:h,afterOutsideRef:p,beforeInsideRef:y,afterInsideRef:v,portalNode:u,setFocusManagerState:b}),[u]);return m.jsxs(x.Fragment,{children:[f,m.jsxs(F4.Provider,{value:T,children:[M&&u&&m.jsx(zd,{"data-type":"outside",ref:h,onFocus:R=>{if(Md(R,u))y.current?.focus();else{const A=w?w.domReference:null;A4(A)?.focus()}}}),M&&u&&m.jsx("span",{"aria-owns":u.id,style:DJ}),u&&gi.createPortal(r,u),M&&u&&m.jsx(zd,{"data-type":"outside",ref:p,onFocus:R=>{if(Md(R,u))v.current?.focus();else{const A=w?w.domReference:null;yE(A)?.focus(),w?.closeOnFocusOut&&w?.onOpenChange(!1,Mn(Kc,R.nativeEvent))}}})]})]})});function go(t){return t==null?t:"current"in t?t.current:t}function xee(t,e){const n=Ar(t.target);return t instanceof n.KeyboardEvent?"keyboard":t instanceof n.FocusEvent?e||"keyboard":"pointerType"in t?t.pointerType||"keyboard":"touches"in t?"touch":t instanceof n.MouseEvent?e||(t.detail===0?"keyboard":"mouse"):""}const LR=20;let bl=[];function bE(){bl=bl.filter(t=>t.isConnected)}function bee(t){bE(),t&&Fl(t)!=="body"&&(bl.push(t),bl.length>LR&&(bl=bl.slice(-LR)))}function s_(){return bE(),bl[bl.length-1]}function _ee(t){if(!t)return null;const e=af();return T4(t,e)?t:Dp(t,e)[0]||t}function wee(t){return!t||!t.isConnected?!1:typeof t.checkVisibility=="function"?t.checkVisibility():ca(t).display!=="none"}function IR(t,e){if(!e.current.includes("floating")&&!t.getAttribute("role")?.includes("dialog"))return;const n=af(),i=tee(t,n).filter(s=>{const o=s.getAttribute("data-tabindex")||"";return T4(s,n)||s.hasAttribute("data-tabindex")&&!o.startsWith("-")}),a=t.getAttribute("tabindex");e.current.includes("floating")||i.length===0?a!=="0"&&t.setAttribute("tabindex","0"):(a!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}function _E(t){const{context:e,children:n,disabled:r=!1,order:i=["content"],initialFocus:a=!0,returnFocus:s=!0,restoreFocus:o=!1,modal:c=!0,closeOnFocusOut:u=!0,openInteractionType:f="",getInsideElements:h=()=>[],nextFocusableElement:p,previousFocusableElement:y,beforeContentFocusGuardRef:v,externalTree:w}=t,b="rootStore"in e?e.rootStore:e,_=b.useState("open"),E=b.useState("domReferenceElement"),M=b.useState("floatingElement"),{events:T,dataRef:R}=b.context,A=jt(()=>R.current.floatingContext?.nodeId),P=jt(h),k=a===!1,N=x1(E)&&k,U=Fr(i),L=Fr(a),z=Fr(s),F=Fr(f),V=cu(w),W=U4(),K=x.useRef(null),Q=x.useRef(null),O=x.useRef(!1),G=x.useRef(!1),Y=x.useRef(!1),H=x.useRef(-1),te=x.useRef(""),re=x.useRef(""),ue=x.useRef(null),ce=x.useRef(null),ee=Fd(ue,v,W?.beforeInsideRef),le=Fd(ce,W?.afterInsideRef),ve=ji(),Pe=ji(),be=ev(),Ye=W!=null,he=tp(M),Ue=jt((_e=he)=>_e?Dp(_e,af()):[]),je=jt(_e=>{const oe=Ue(_e);return U.current.map(()=>oe).filter(Boolean).flat()});x.useEffect(()=>{if(r||!c)return;function _e(J){J.key==="Tab"&&On(he,gl(Mr(he)))&&Ue().length===0&&!N&&pi(J)}const oe=Mr(he);return oe.addEventListener("keydown",_e),()=>{oe.removeEventListener("keydown",_e)}},[r,E,he,c,U,N,Ue,je]),x.useEffect(()=>{if(r||!M)return;function _e(oe){const J=Fi(oe),Ne=Ue().indexOf(J);Ne!==-1&&(H.current=Ne)}return M.addEventListener("focusin",_e),()=>{M.removeEventListener("focusin",_e)}},[r,M,Ue]),x.useEffect(()=>{if(r||!_)return;const _e=Mr(he);function oe(){Y.current=!1}function J(Ne){const De=Fi(Ne),Le=On(M,De)||On(E,De)||On(W?.portalNode,De);Y.current=!Le,re.current=Ne.pointerType||"keyboard"}function ze(){re.current="keyboard"}return _e.addEventListener("pointerdown",J,!0),_e.addEventListener("pointerup",oe,!0),_e.addEventListener("pointercancel",oe,!0),_e.addEventListener("keydown",ze,!0),()=>{_e.removeEventListener("pointerdown",J,!0),_e.removeEventListener("pointerup",oe,!0),_e.removeEventListener("pointercancel",oe,!0),_e.removeEventListener("keydown",ze,!0)}},[r,M,E,he,_,W]),x.useEffect(()=>{if(r||!u)return;function _e(){G.current=!0,Pe.start(0,()=>{G.current=!1})}function oe(De){const Le=De.relatedTarget,$=De.currentTarget,I=Fi(De);queueMicrotask(()=>{const Z=A(),pe=b.context.triggerElements,Se=Le?.hasAttribute(np("focus-guard"))&&[ue.current,ce.current,W?.beforeInsideRef.current,W?.afterInsideRef.current,W?.beforeOutsideRef.current,W?.afterOutsideRef.current,go(y),go(p)].includes(Le),xe=!(On(E,Le)||On(M,Le)||On(Le,M)||On(W?.portalNode,Le)||Le!=null&&pe.hasElement(Le)||pe.hasMatchingElement(Ie=>On(Ie,Le))||Se||V&&(Uc(V.nodesRef.current,Z).find(Ie=>On(Ie.context?.elements.floating,Le)||On(Ie.context?.elements.domReference,Le))||kR(V.nodesRef.current,Z).find(Ie=>[Ie.context?.elements.floating,tp(Ie.context?.elements.floating)].includes(Le)||Ie.context?.elements.domReference===Le)));if($===E&&he&&IR(he,U),o&&$!==E&&!wee(I)&&gl(Mr(he))===Mr(he).body){if(Tr(he)&&(he.focus(),o==="popup")){be.request(()=>{he.focus()});return}const Ie=H.current,He=Ue(),qe=He[Ie]||He[He.length-1]||he;Tr(qe)&&qe.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(N||!c)&&Le&&xe&&!G.current&&(N||Le!==s_())&&(O.current=!0,b.setOpen(!1,Mn(Kc,De)))})}function J(){Y.current||(R.current.insideReactTree=!0,ve.start(0,()=>{R.current.insideReactTree=!1}))}const ze=Tr(E)?E:null,Ne=[];if(!(!M&&!ze))return ze&&(ze.addEventListener("focusout",oe),ze.addEventListener("pointerdown",_e),Ne.push(()=>{ze.removeEventListener("focusout",oe),ze.removeEventListener("pointerdown",_e)})),M&&(M.addEventListener("focusout",oe),W&&(M.addEventListener("focusout",J,!0),Ne.push(()=>{M.removeEventListener("focusout",J,!0)})),Ne.push(()=>{M.removeEventListener("focusout",oe)})),()=>{Ne.forEach(De=>{De()})}},[r,E,M,he,c,V,W,b,u,o,Ue,N,A,U,R,ve,Pe,be,p,y]),x.useEffect(()=>{if(r||!M||!_)return;const _e=Array.from(W?.portalNode?.querySelectorAll(`[${np("portal")}]`)||[]),J=(V?kR(V.nodesRef.current,A()):[]).find(De=>x1(De.context?.elements.domReference||null))?.context?.elements.domReference,ze=[M,J,..._e,...P(),K.current,Q.current,ue.current,ce.current,W?.beforeOutsideRef.current,W?.afterOutsideRef.current,go(y),go(p),N?E:null].filter(De=>De!=null),Ne=gee(ze,c||N);return()=>{Ne()}},[_,r,E,M,c,U,W,N,V,A,P,p,y]),Yt(()=>{if(!_||r||!Tr(he))return;const _e=Mr(he),oe=gl(_e);queueMicrotask(()=>{const J=je(he),ze=L.current,Ne=typeof ze=="function"?ze(F.current||""):ze;if(Ne===void 0||Ne===!1)return;let De;Ne===!0||Ne===null?De=J[0]||he:De=go(Ne),De=De||J[0]||he,!On(he,oe)&&g0(De,{preventScroll:De===he})})},[r,_,he,k,je,L,F]),Yt(()=>{if(r||!he)return;const _e=Mr(he),oe=gl(_e);bee(oe);function J(De){if(De.open||(te.current=xee(De.nativeEvent,re.current)),De.reason===aa&&De.nativeEvent.type==="mouseleave"&&(O.current=!0),De.reason===vE)if(De.nested)O.current=!1;else if(y4(De.nativeEvent)||v4(De.nativeEvent))O.current=!1;else{let Le=!1;document.createElement("div").focus({get preventScroll(){return Le=!0,!1}}),Le?O.current=!1:O.current=!0}}T.on("openchange",J);const ze=_e.createElement("span");ze.setAttribute("tabindex","-1"),ze.setAttribute("aria-hidden","true"),Object.assign(ze.style,uE),Ye&&E&&E.insertAdjacentElement("afterend",ze);function Ne(){const De=z.current;let Le=typeof De=="function"?De(te.current):De;if(Le===void 0||Le===!1)return null;if(Le===null&&(Le=!0),typeof Le=="boolean"){const I=E||s_();return I&&I.isConnected?I:ze}const $=E||s_()||ze;return go(Le)||$}return()=>{T.off("openchange",J);const De=gl(_e),Le=On(M,De)||V&&Uc(V.nodesRef.current,A(),!1).some(I=>On(I.context?.elements.floating,De)),$=Ne();queueMicrotask(()=>{const I=_ee($),Z=typeof z.current!="boolean";z.current&&!O.current&&Tr(I)&&(!(!Z&&I!==De&&De!==_e.body)||Le)&&I.focus({preventScroll:!0}),ze.remove()})}},[r,M,he,z,R,T,V,Ye,E,A]),x.useEffect(()=>{queueMicrotask(()=>{O.current=!1})},[r]),x.useEffect(()=>{if(r||!_)return;function _e(J){Fi(J)?.closest(`[${r4}]`)&&(G.current=!0)}const oe=Mr(he);return oe.addEventListener("pointerdown",_e,!0),()=>{oe.removeEventListener("pointerdown",_e,!0)}},[r,_,he]),Yt(()=>{if(!r&&W)return W.setFocusManagerState({modal:c,closeOnFocusOut:u,open:_,onOpenChange:b.setOpen,domReference:E}),()=>{W.setFocusManagerState(null)}},[r,W,c,_,b,u,E]),Yt(()=>{if(!(r||!he))return IR(he,U),()=>{queueMicrotask(bE)}},[r,he,U]);const et=!r&&(c?!N:!0)&&(Ye||c);return m.jsxs(x.Fragment,{children:[et&&m.jsx(zd,{"data-type":"inside",ref:ee,onFocus:_e=>{if(c){const oe=je();g0(oe[oe.length-1])}else W?.portalNode&&(O.current=!1,Md(_e,W.portalNode)?yE(E)?.focus():go(y??W.beforeOutsideRef)?.focus())}}),n,et&&m.jsx(zd,{"data-type":"inside",ref:le,onFocus:_e=>{c?g0(je()[0]):W?.portalNode&&(u&&(O.current=!0),Md(_e,W.portalNode)?A4(E)?.focus():go(p??W.afterOutsideRef)?.focus())}})]})}function j4(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.context.dataRef,{enabled:i=!0,event:a="click",toggle:s=!0,ignoreMouse:o=!1,stickIfOpen:c=!0,touchOpenDelay:u=0}=e,f=x.useRef(void 0),h=ev(),p=ji(),y=x.useMemo(()=>({onPointerDown(v){f.current=v.pointerType},onMouseDown(v){const w=f.current,b=v.nativeEvent,_=n.select("open");if(v.button!==0||a==="click"||Ud(w,!0)&&o)return;const E=r.current.openEvent,M=E?.type,T=n.select("domReferenceElement")!==v.currentTarget,R=_&&T||!(_&&s&&(!(E&&c)||M==="click"||M==="mousedown"));if(g4(b.target)){const P=Mn(Tl,b,b.target);R&&w==="touch"&&u>0?p.start(u,()=>{n.setOpen(!0,P)}):n.setOpen(R,P);return}const A=v.currentTarget;h.request(()=>{const P=Mn(Tl,b,A);R&&w==="touch"&&u>0?p.start(u,()=>{n.setOpen(!0,P)}):n.setOpen(R,P)})},onClick(v){if(a==="mousedown-only")return;const w=f.current;if(a==="mousedown"&&w){f.current=void 0;return}if(Ud(w,!0)&&o)return;const b=n.select("open"),_=r.current.openEvent,E=n.select("domReferenceElement")!==v.currentTarget,M=b&&E||!(b&&s&&(!(_&&c)||x4(_))),T=Mn(Tl,v.nativeEvent,v.currentTarget);M&&w==="touch"&&u>0?p.start(u,()=>{n.setOpen(!0,T)}):n.setOpen(M,T)},onKeyDown(){f.current=void 0}}),[r,a,o,n,c,s,h,p,u]);return x.useMemo(()=>i?{reference:y}:ei,[i,y])}function OR(t,e,n){let{reference:r,floating:i}=t;const a=Ma(e),s=gE(e),o=mE(s),c=Bi(e),u=a==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,p=r[o]/2-i[o]/2;let y;switch(c){case"top":y={x:f,y:r.y-i.height};break;case"bottom":y={x:f,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:h};break;case"left":y={x:r.x-i.width,y:h};break;default:y={x:r.x,y:r.y}}switch(Ul(e)){case"start":y[s]-=p*(n&&u?-1:1);break;case"end":y[s]+=p*(n&&u?-1:1);break}return y}async function See(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:a,rects:s,elements:o,strategy:c}=t,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:h="floating",altBoundary:p=!1,padding:y=0}=Po(e,t),v=b4(y),b=o[p?h==="floating"?"reference":"floating":h],_=sy(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(b)))==null||n?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(o.floating)),boundary:u,rootBoundary:f,strategy:c})),E=h==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,M=await(a.getOffsetParent==null?void 0:a.getOffsetParent(o.floating)),T=await(a.isElement==null?void 0:a.isElement(M))?await(a.getScale==null?void 0:a.getScale(M))||{x:1,y:1}:{x:1,y:1},R=sy(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:E,offsetParent:M,strategy:c}):E);return{top:(_.top-R.top+v.top)/T.y,bottom:(R.bottom-_.bottom+v.bottom)/T.y,left:(_.left-R.left+v.left)/T.x,right:(R.right-_.right+v.right)/T.x}}const kee=50,Eee=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:a=[],platform:s}=n,o=s.detectOverflow?s:{...s,detectOverflow:See},c=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:h}=OR(u,r,c),p=r,y=0;const v={};for(let w=0;w<a.length;w++){const b=a[w];if(!b)continue;const{name:_,fn:E}=b,{x:M,y:T,data:R,reset:A}=await E({x:f,y:h,initialPlacement:r,placement:p,strategy:i,middlewareData:v,rects:u,platform:o,elements:{reference:t,floating:e}});f=M??f,h=T??h,v[_]={...v[_],...R},A&&y<kee&&(y++,typeof A=="object"&&(A.placement&&(p=A.placement),A.rects&&(u=A.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):A.rects),{x:f,y:h}=OR(u,p,c)),w=-1)}return{x:f,y:h,placement:p,strategy:i,middlewareData:v}},Mee=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:a,rects:s,initialPlacement:o,platform:c,elements:u}=e,{mainAxis:f=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:w=!0,...b}=Po(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const _=Bi(i),E=Ma(o),M=Bi(o)===o,T=await(c.isRTL==null?void 0:c.isRTL(u.floating)),R=p||(M||!w?[ay(o)]:PQ(o)),A=v!=="none";!p&&A&&R.push(...IQ(o,w,v,T));const P=[o,...R],k=await c.detectOverflow(e,b),N=[];let U=((r=a.flip)==null?void 0:r.overflows)||[];if(f&&N.push(k[_]),h){const V=RQ(i,s,T);N.push(k[V[0]],k[V[1]])}if(U=[...U,{placement:i,overflows:N}],!N.every(V=>V<=0)){var L,z;const V=(((L=a.flip)==null?void 0:L.index)||0)+1,W=P[V];if(W&&(!(h==="alignment"?E!==Ma(W):!1)||U.every(O=>Ma(O.placement)===E?O.overflows[0]>0:!0)))return{data:{index:V,overflows:U},reset:{placement:W}};let K=(z=U.filter(Q=>Q.overflows[0]<=0).sort((Q,O)=>Q.overflows[1]-O.overflows[1])[0])==null?void 0:z.placement;if(!K)switch(y){case"bestFit":{var F;const Q=(F=U.filter(O=>{if(A){const G=Ma(O.placement);return G===E||G==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(G=>G>0).reduce((G,Y)=>G+Y,0)]).sort((O,G)=>O[1]-G[1])[0])==null?void 0:F[0];Q&&(K=Q);break}case"initialPlacement":K=o;break}if(i!==K)return{reset:{placement:K}}}return{}}}};function FR(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function UR(t){return CQ.some(e=>t[e]>=0)}const Tee=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:i="referenceHidden",...a}=Po(t,e);switch(i){case"referenceHidden":{const s=await r.detectOverflow(e,{...a,elementContext:"reference"}),o=FR(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:UR(o)}}}case"escaped":{const s=await r.detectOverflow(e,{...a,altBoundary:!0}),o=FR(s,n.floating);return{data:{escapedOffsets:o,escaped:UR(o)}}}default:return{}}}}},B4=new Set(["left","top"]);async function Cee(t,e){const{placement:n,platform:r,elements:i}=t,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Bi(n),o=Ul(n),c=Ma(n)==="y",u=B4.has(s)?-1:1,f=a&&c?-1:1,h=Po(e,t);let{mainAxis:p,crossAxis:y,alignmentAxis:v}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return o&&typeof v=="number"&&(y=o==="end"?v*-1:v),c?{x:y*f,y:p*u}:{x:p*u,y:y*f}}const Aee=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:a,placement:s,middlewareData:o}=e,c=await Cee(e,t);return s===((n=o.offset)==null?void 0:n.placement)&&(r=o.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:{...c,placement:s}}}}},Ree=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:a}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:c={fn:_=>{let{x:E,y:M}=_;return{x:E,y:M}}},...u}=Po(t,e),f={x:n,y:r},h=await a.detectOverflow(e,u),p=Ma(Bi(i)),y=pE(p);let v=f[y],w=f[p];if(s){const _=y==="y"?"top":"left",E=y==="y"?"bottom":"right",M=v+h[_],T=v-h[E];v=b1(M,v,T)}if(o){const _=p==="y"?"top":"left",E=p==="y"?"bottom":"right",M=w+h[_],T=w-h[E];w=b1(M,w,T)}const b=c.fn({...e,[y]:v,[p]:w});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[y]:s,[p]:o}}}}}},Pee=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:a,middlewareData:s}=e,{offset:o=0,mainAxis:c=!0,crossAxis:u=!0}=Po(t,e),f={x:n,y:r},h=Ma(i),p=pE(h);let y=f[p],v=f[h];const w=Po(o,e),b=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(c){const M=p==="y"?"height":"width",T=a.reference[p]-a.floating[M]+b.mainAxis,R=a.reference[p]+a.reference[M]-b.mainAxis;y<T?y=T:y>R&&(y=R)}if(u){var _,E;const M=p==="y"?"width":"height",T=B4.has(Bi(i)),R=a.reference[h]-a.floating[M]+(T&&((_=s.offset)==null?void 0:_[h])||0)+(T?0:b.crossAxis),A=a.reference[h]+a.reference[M]+(T?0:((E=s.offset)==null?void 0:E[h])||0)-(T?b.crossAxis:0);v<R?v=R:v>A&&(v=A)}return{[p]:y,[h]:v}}}},Nee=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:a,platform:s,elements:o}=e,{apply:c=()=>{},...u}=Po(t,e),f=await s.detectOverflow(e,u),h=Bi(i),p=Ul(i),y=Ma(i)==="y",{width:v,height:w}=a.floating;let b,_;h==="top"||h==="bottom"?(b=h,_=p===(await(s.isRTL==null?void 0:s.isRTL(o.floating))?"start":"end")?"left":"right"):(_=h,b=p==="end"?"top":"bottom");const E=w-f.top-f.bottom,M=v-f.left-f.right,T=jd(w-f[b],E),R=jd(v-f[_],M),A=!e.middlewareData.shift;let P=T,k=R;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(k=M),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(P=E),A&&!p){const U=ia(f.left,0),L=ia(f.right,0),z=ia(f.top,0),F=ia(f.bottom,0);y?k=v-2*(U!==0||L!==0?U+L:ia(f.left,f.right)):P=w-2*(z!==0||F!==0?z+F:ia(f.top,f.bottom))}await c({...e,availableWidth:k,availableHeight:P});const N=await s.getDimensions(o.floating);return v!==N.width||w!==N.height?{reset:{rects:!0}}:{}}}};function z4(t){const e=ca(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Tr(t),a=i?t.offsetWidth:n,s=i?t.offsetHeight:r,o=iy(n)!==a||iy(r)!==s;return o&&(n=a,r=s),{width:n,height:r,$:o}}function wE(t){return Kn(t)?t:t.contextElement}function Cd(t){const e=wE(t);if(!Tr(e))return Ds(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:a}=z4(e);let s=(a?iy(n.width):n.width)/r,o=(a?iy(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!o||!Number.isFinite(o))&&(o=1),{x:s,y:o}}const Dee=Ds(0);function V4(t){const e=Ar(t);return!Ky()||!e.visualViewport?Dee:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Lee(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ar(t)?!1:e}function Zc(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),a=wE(t);let s=Ds(1);e&&(r?Kn(r)&&(s=Cd(r)):s=Cd(t));const o=Lee(a,n,r)?V4(a):Ds(0);let c=(i.left+o.x)/s.x,u=(i.top+o.y)/s.y,f=i.width/s.x,h=i.height/s.y;if(a){const p=Ar(a),y=r&&Kn(r)?Ar(r):r;let v=p,w=f1(v);for(;w&&r&&y!==v;){const b=Cd(w),_=w.getBoundingClientRect(),E=ca(w),M=_.left+(w.clientLeft+parseFloat(E.paddingLeft))*b.x,T=_.top+(w.clientTop+parseFloat(E.paddingTop))*b.y;c*=b.x,u*=b.y,f*=b.x,h*=b.y,c+=M,u+=T,v=Ar(w),w=f1(v)}}return sy({width:f,height:h,x:c,y:u})}function nv(t,e){const n=Zy(t).scrollLeft;return e?e.left+n:Zc(qs(t)).left+n}function H4(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-nv(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function Iee(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const a=i==="fixed",s=qs(r),o=e?Xy(e.floating):!1;if(r===s||o&&a)return n;let c={scrollLeft:0,scrollTop:0},u=Ds(1);const f=Ds(0),h=Tr(r);if((h||!h&&!a)&&((Fl(r)!=="body"||lu(s))&&(c=Zy(r)),h)){const y=Zc(r);u=Cd(r),f.x=y.x+r.clientLeft,f.y=y.y+r.clientTop}const p=s&&!h&&!a?H4(s,c):Ds(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+f.x+p.x,y:n.y*u.y-c.scrollTop*u.y+f.y+p.y}}function Oee(t){return Array.from(t.getClientRects())}function Fee(t){const e=qs(t),n=Zy(t),r=t.ownerDocument.body,i=ia(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=ia(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+nv(t);const o=-n.scrollTop;return ca(r).direction==="rtl"&&(s+=ia(e.clientWidth,r.clientWidth)-i),{width:i,height:a,x:s,y:o}}const jR=25;function Uee(t,e){const n=Ar(t),r=qs(t),i=n.visualViewport;let a=r.clientWidth,s=r.clientHeight,o=0,c=0;if(i){a=i.width,s=i.height;const f=Ky();(!f||f&&e==="fixed")&&(o=i.offsetLeft,c=i.offsetTop)}const u=nv(r);if(u<=0){const f=r.ownerDocument,h=f.body,p=getComputedStyle(h),y=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,v=Math.abs(r.clientWidth-h.clientWidth-y);v<=jR&&(a-=v)}else u<=jR&&(a+=u);return{width:a,height:s,x:o,y:c}}function jee(t,e){const n=Zc(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,a=Tr(t)?Cd(t):Ds(1),s=t.clientWidth*a.x,o=t.clientHeight*a.y,c=i*a.x,u=r*a.y;return{width:s,height:o,x:c,y:u}}function BR(t,e,n){let r;if(e==="viewport")r=Uee(t,n);else if(e==="document")r=Fee(qs(t));else if(Kn(e))r=jee(e,n);else{const i=V4(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return sy(r)}function W4(t,e){const n=Ro(t);return n===e||!Kn(n)||ko(n)?!1:ca(n).position==="fixed"||W4(n,e)}function Bee(t,e){const n=e.get(t);if(n)return n;let r=kl(t,[],!1).filter(o=>Kn(o)&&Fl(o)!=="body"),i=null;const a=ca(t).position==="fixed";let s=a?Ro(t):t;for(;Kn(s)&&!ko(s);){const o=ca(s),c=lE(s);!c&&o.position==="fixed"&&(i=null),(a?!c&&!i:!c&&o.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||lu(s)&&!c&&W4(t,s))?r=r.filter(f=>f!==s):i=o,s=Ro(s)}return e.set(t,r),r}function zee(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?Xy(e)?[]:Bee(e,this._c):[].concat(n),r],o=BR(e,s[0],i);let c=o.top,u=o.right,f=o.bottom,h=o.left;for(let p=1;p<s.length;p++){const y=BR(e,s[p],i);c=ia(y.top,c),u=jd(y.right,u),f=jd(y.bottom,f),h=ia(y.left,h)}return{width:u-h,height:f-c,x:h,y:c}}function Vee(t){const{width:e,height:n}=z4(t);return{width:e,height:n}}function Hee(t,e,n){const r=Tr(e),i=qs(e),a=n==="fixed",s=Zc(t,!0,a,e);let o={scrollLeft:0,scrollTop:0};const c=Ds(0);function u(){c.x=nv(i)}if(r||!r&&!a)if((Fl(e)!=="body"||lu(i))&&(o=Zy(e)),r){const y=Zc(e,!0,a,e);c.x=y.x+e.clientLeft,c.y=y.y+e.clientTop}else i&&u();a&&!r&&i&&u();const f=i&&!r&&!a?H4(i,o):Ds(0),h=s.left+o.scrollLeft-c.x-f.x,p=s.top+o.scrollTop-c.y-f.y;return{x:h,y:p,width:s.width,height:s.height}}function o_(t){return ca(t).position==="static"}function zR(t,e){if(!Tr(t)||ca(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return qs(t)===n&&(n=n.ownerDocument.body),n}function G4(t,e){const n=Ar(t);if(Xy(t))return n;if(!Tr(t)){let i=Ro(t);for(;i&&!ko(i);){if(Kn(i)&&!o_(i))return i;i=Ro(i)}return n}let r=zR(t,e);for(;r&&aJ(r)&&o_(r);)r=zR(r,e);return r&&ko(r)&&o_(r)&&!lE(r)?n:r||lJ(t)||n}const Wee=async function(t){const e=this.getOffsetParent||G4,n=this.getDimensions,r=await n(t.floating);return{reference:Hee(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Gee(t){return ca(t).direction==="rtl"}const $ee={convertOffsetParentRelativeRectToViewportRelativeRect:Iee,getDocumentElement:qs,getClippingRect:zee,getOffsetParent:G4,getElementRects:Wee,getClientRects:Oee,getDimensions:Vee,getScale:Cd,isElement:Kn,isRTL:Gee};function $4(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Yee(t,e){let n=null,r;const i=qs(t);function a(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function s(o,c){o===void 0&&(o=!1),c===void 0&&(c=1),a();const u=t.getBoundingClientRect(),{left:f,top:h,width:p,height:y}=u;if(o||e(),!p||!y)return;const v=wd(h),w=wd(i.clientWidth-(f+p)),b=wd(i.clientHeight-(h+y)),_=wd(f),M={rootMargin:-v+"px "+-w+"px "+-b+"px "+-_+"px",threshold:ia(0,jd(1,c))||1};let T=!0;function R(A){const P=A[0].intersectionRatio;if(P!==c){if(!T)return s();P?s(!1,P):r=setTimeout(()=>{s(!1,1e-7)},1e3)}P===1&&!$4(u,t.getBoundingClientRect())&&s(),T=!1}try{n=new IntersectionObserver(R,{...M,root:i.ownerDocument})}catch{n=new IntersectionObserver(R,M)}n.observe(t)}return s(!0),a}function VR(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=wE(t),f=i||a?[...u?kl(u):[],...e?kl(e):[]]:[];f.forEach(_=>{i&&_.addEventListener("scroll",n,{passive:!0}),a&&_.addEventListener("resize",n)});const h=u&&o?Yee(u,n):null;let p=-1,y=null;s&&(y=new ResizeObserver(_=>{let[E]=_;E&&E.target===u&&y&&e&&(y.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var M;(M=y)==null||M.observe(e)})),n()}),u&&!c&&y.observe(u),e&&y.observe(e));let v,w=c?Zc(t):null;c&&b();function b(){const _=Zc(t);w&&!$4(w,_)&&n(),w=_,v=requestAnimationFrame(b)}return n(),()=>{var _;f.forEach(E=>{i&&E.removeEventListener("scroll",n),a&&E.removeEventListener("resize",n)}),h?.(),(_=y)==null||_.disconnect(),y=null,c&&cancelAnimationFrame(v)}}const qee=Aee,Xee=Ree,Kee=Mee,Zee=Nee,Jee=Tee,Qee=Pee,ete=(t,e,n)=>{const r=new Map,i={platform:$ee,...n},a={...i.platform,_c:r};return Eee(t,e,{...i,platform:a})};var tte=typeof document<"u",nte=function(){},y0=tte?x.useLayoutEffect:nte;function dy(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!dy(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const a=i[r];if(!(a==="_owner"&&t.$$typeof)&&!dy(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function Y4(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function HR(t,e){const n=Y4(t);return Math.round(e*n)/n}function l_(t){const e=x.useRef(t);return y0(()=>{e.current=t}),e}function rte(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:a,floating:s}={},transform:o=!0,whileElementsMounted:c,open:u}=t,[f,h]=x.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[p,y]=x.useState(r);dy(p,r)||y(r);const[v,w]=x.useState(null),[b,_]=x.useState(null),E=x.useCallback(O=>{O!==A.current&&(A.current=O,w(O))},[]),M=x.useCallback(O=>{O!==P.current&&(P.current=O,_(O))},[]),T=a||v,R=s||b,A=x.useRef(null),P=x.useRef(null),k=x.useRef(f),N=c!=null,U=l_(c),L=l_(i),z=l_(u),F=x.useCallback(()=>{if(!A.current||!P.current)return;const O={placement:e,strategy:n,middleware:p};L.current&&(O.platform=L.current),ete(A.current,P.current,O).then(G=>{const Y={...G,isPositioned:z.current!==!1};V.current&&!dy(k.current,Y)&&(k.current=Y,gi.flushSync(()=>{h(Y)}))})},[p,e,n,L,z]);y0(()=>{u===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,h(O=>({...O,isPositioned:!1})))},[u]);const V=x.useRef(!1);y0(()=>(V.current=!0,()=>{V.current=!1}),[]),y0(()=>{if(T&&(A.current=T),R&&(P.current=R),T&&R){if(U.current)return U.current(T,R,F);F()}},[T,R,F,U,N]);const W=x.useMemo(()=>({reference:A,floating:P,setReference:E,setFloating:M}),[E,M]),K=x.useMemo(()=>({reference:T,floating:R}),[T,R]),Q=x.useMemo(()=>{const O={position:n,left:0,top:0};if(!K.floating)return O;const G=HR(K.floating,f.x),Y=HR(K.floating,f.y);return o?{...O,transform:"translate("+G+"px, "+Y+"px)",...Y4(K.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:G,top:Y}},[n,o,K.floating,f.x,f.y]);return x.useMemo(()=>({...f,update:F,refs:W,elements:K,floatingStyles:Q}),[f,F,W,K,Q])}const ite=(t,e)=>{const n=qee(t);return{name:n.name,fn:n.fn,options:[t,e]}},ate=(t,e)=>{const n=Xee(t);return{name:n.name,fn:n.fn,options:[t,e]}},ste=(t,e)=>({fn:Qee(t).fn,options:[t,e]}),ote=(t,e)=>{const n=Kee(t);return{name:n.name,fn:n.fn,options:[t,e]}},lte=(t,e)=>{const n=Zee(t);return{name:n.name,fn:n.fn,options:[t,e]}},cte=(t,e)=>{const n=Jee(t);return{name:n.name,fn:n.fn,options:[t,e]}},ute={intentional:"onClick",sloppy:"onPointerDown"};function dte(t){return{escapeKey:typeof t=="boolean"?t:t?.escapeKey??!1,outsidePress:typeof t=="boolean"?t:t?.outsidePress??!0}}function SE(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),i=n.useState("floatingElement"),a=n.useState("referenceElement"),s=n.useState("domReferenceElement"),{onOpenChange:o,dataRef:c}=n.context,{enabled:u=!0,escapeKey:f=!0,outsidePress:h=!0,outsidePressEvent:p="sloppy",referencePress:y=!1,referencePressEvent:v="sloppy",ancestorScroll:w=!1,bubbles:b,externalTree:_}=e,E=cu(_),M=jt(typeof h=="function"?h:()=>!1),T=typeof h=="function"?M:h,R=x.useRef(!1),{escapeKey:A,outsidePress:P}=dte(b),k=x.useRef(null),N=ji(),U=ji(),L=jt(()=>{U.clear(),c.current.insideReactTree=!1}),z=x.useRef(!1),F=x.useRef(""),V=jt(he=>{F.current=he.pointerType}),W=jt(()=>{const he=F.current,Ue=he==="pen"||!he?"mouse":he,je=typeof p=="function"?p():p;return typeof je=="string"?je:je[Ue]}),K=jt(he=>{if(!r||!u||!f||he.key!=="Escape"||z.current)return;const Ue=c.current.floatingContext?.nodeId,je=E?Uc(E.nodesRef.current,Ue):[];if(!A&&je.length>0){let oe=!0;if(je.forEach(J=>{J.context?.open&&!J.context.dataRef.current.__escapeKeyBubbles&&(oe=!1)}),!oe)return}const et=TQ(he)?he.nativeEvent:he,_e=Mn(L4,et);n.setOpen(!1,_e),!A&&!_e.isPropagationAllowed&&he.stopPropagation()}),Q=jt(he=>{const Ue=W();return Ue==="intentional"&&he.type!=="click"||Ue==="sloppy"&&he.type==="click"}),O=jt(()=>{c.current.insideReactTree=!0,U.start(0,L)}),G=jt((he,Ue=!1)=>{if(Q(he)){L();return}if(c.current.insideReactTree){L();return}if(W()==="intentional"&&Ue||typeof T=="function"&&!T(he))return;const je=Fi(he),et=`[${np("inert")}]`,_e=Mr(n.select("floatingElement")).querySelectorAll(et),oe=n.context.triggerElements;if(je&&(oe.hasElement(je)||oe.hasMatchingElement(Le=>On(Le,je))))return;let J=Kn(je)?je:null;for(;J&&!ko(J);){const Le=Ro(J);if(ko(Le)||!Kn(Le))break;J=Le}if(_e.length&&Kn(je)&&!MQ(je)&&!On(je,n.select("floatingElement"))&&Array.from(_e).every(Le=>!On(J,Le)))return;if(Tr(je)&&!("touches"in he)){const Le=ko(je),$=ca(je),I=/auto|scroll/,Z=Le||I.test($.overflowX),pe=Le||I.test($.overflowY),Se=Z&&je.clientWidth>0&&je.scrollWidth>je.clientWidth,xe=pe&&je.clientHeight>0&&je.scrollHeight>je.clientHeight,Ie=$.direction==="rtl",He=xe&&(Ie?he.offsetX<=je.offsetWidth-je.clientWidth:he.offsetX>je.clientWidth),qe=Se&&he.offsetY>je.clientHeight;if(He||qe)return}const ze=c.current.floatingContext?.nodeId,Ne=E&&Uc(E.nodesRef.current,ze).some(Le=>za(he,Le.context?.elements.floating));if(za(he,n.select("floatingElement"))||za(he,n.select("domReferenceElement"))||Ne)return;const De=E?Uc(E.nodesRef.current,ze):[];if(De.length>0){let Le=!0;if(De.forEach($=>{$.context?.open&&!$.context.dataRef.current.__outsidePressBubbles&&(Le=!1)}),!Le)return}n.setOpen(!1,Mn(vE,he)),L()}),Y=jt(he=>{W()!=="sloppy"||he.pointerType==="touch"||!n.select("open")||!u||za(he,n.select("floatingElement"))||za(he,n.select("domReferenceElement"))||G(he)}),H=jt(he=>{if(W()!=="sloppy"||!n.select("open")||!u||za(he,n.select("floatingElement"))||za(he,n.select("domReferenceElement")))return;const Ue=he.touches[0];Ue&&(k.current={startTime:Date.now(),startX:Ue.clientX,startY:Ue.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},N.start(1e3,()=>{k.current&&(k.current.dismissOnTouchEnd=!1,k.current.dismissOnMouseDown=!1)}))}),te=jt(he=>{const Ue=Fi(he);function je(){H(he),Ue?.removeEventListener(he.type,je)}Ue?.addEventListener(he.type,je)}),re=jt(he=>{const Ue=R.current;if(R.current=!1,N.clear(),he.type==="mousedown"&&k.current&&!k.current.dismissOnMouseDown)return;const je=Fi(he);function et(){he.type==="pointerdown"?Y(he):G(he,Ue),je?.removeEventListener(he.type,et)}je?.addEventListener(he.type,et)}),ue=jt(he=>{if(W()!=="sloppy"||!k.current||za(he,n.select("floatingElement"))||za(he,n.select("domReferenceElement")))return;const Ue=he.touches[0];if(!Ue)return;const je=Math.abs(Ue.clientX-k.current.startX),et=Math.abs(Ue.clientY-k.current.startY),_e=Math.sqrt(je*je+et*et);_e>5&&(k.current.dismissOnTouchEnd=!0),_e>10&&(G(he),N.clear(),k.current=null)}),ce=jt(he=>{const Ue=Fi(he);function je(){ue(he),Ue?.removeEventListener(he.type,je)}Ue?.addEventListener(he.type,je)}),ee=jt(he=>{W()!=="sloppy"||!k.current||za(he,n.select("floatingElement"))||za(he,n.select("domReferenceElement"))||(k.current.dismissOnTouchEnd&&G(he),N.clear(),k.current=null)}),le=jt(he=>{const Ue=Fi(he);function je(){ee(he),Ue?.removeEventListener(he.type,je)}Ue?.addEventListener(he.type,je)});x.useEffect(()=>{if(!r||!u)return;c.current.__escapeKeyBubbles=A,c.current.__outsidePressBubbles=P;const he=new Nl;function Ue(J){n.setOpen(!1,Mn(tv,J))}function je(){he.clear(),z.current=!0}function et(){he.start(Ky()?5:0,()=>{z.current=!1})}const _e=Mr(i);_e.addEventListener("pointerdown",V,!0),f&&(_e.addEventListener("keydown",K),_e.addEventListener("compositionstart",je),_e.addEventListener("compositionend",et)),T&&(_e.addEventListener("click",re,!0),_e.addEventListener("pointerdown",re,!0),_e.addEventListener("touchstart",te,!0),_e.addEventListener("touchmove",ce,!0),_e.addEventListener("touchend",le,!0),_e.addEventListener("mousedown",re,!0));let oe=[];return w&&(Kn(s)&&(oe=kl(s)),Kn(i)&&(oe=oe.concat(kl(i))),!Kn(a)&&a&&a.contextElement&&(oe=oe.concat(kl(a.contextElement)))),oe=oe.filter(J=>J!==_e.defaultView?.visualViewport),oe.forEach(J=>{J.addEventListener("scroll",Ue,{passive:!0})}),()=>{_e.removeEventListener("pointerdown",V,!0),f&&(_e.removeEventListener("keydown",K),_e.removeEventListener("compositionstart",je),_e.removeEventListener("compositionend",et)),T&&(_e.removeEventListener("click",re,!0),_e.removeEventListener("pointerdown",re,!0),_e.removeEventListener("touchstart",te,!0),_e.removeEventListener("touchmove",ce,!0),_e.removeEventListener("touchend",le,!0),_e.removeEventListener("mousedown",re,!0)),oe.forEach(J=>{J.removeEventListener("scroll",Ue)}),he.clear(),R.current=!1}},[c,i,a,s,f,T,r,o,w,u,A,P,K,G,re,Y,te,ce,le,V,n]),x.useEffect(L,[T,L]);const ve=x.useMemo(()=>({onKeyDown:K,...y&&{[ute[v]]:he=>{n.setOpen(!1,Mn(Tl,he.nativeEvent))},...v!=="intentional"&&{onClick(he){n.setOpen(!1,Mn(Tl,he.nativeEvent))}}}}),[K,n,y,v]),Pe=jt(he=>{const Ue=Fi(he.nativeEvent);!On(n.select("floatingElement"),Ue)||he.button!==0||(R.current=!0)}),be=jt(he=>{!r||!u||he.button!==0||(R.current=!0)}),Ye=x.useMemo(()=>({onKeyDown:K,onPointerDown:Pe,onMouseDown:Pe,onMouseUp:Pe,onClickCapture:O,onMouseDownCapture(he){O(),be(he)},onPointerDownCapture(he){O(),be(he)},onMouseUpCapture:O,onTouchEndCapture:O,onTouchMoveCapture:O}),[K,Pe,O,be]);return x.useMemo(()=>u?{reference:ve,floating:Ye,trigger:ve}:{},[u,ve,Ye])}const fte={open:At(t=>t.open),domReferenceElement:At(t=>t.domReferenceElement),referenceElement:At(t=>t.positionReference??t.referenceElement),floatingElement:At(t=>t.floatingElement),floatingId:At(t=>t.floatingId)};class kE extends dE{constructor(e){const{nested:n,noEmit:r,onOpenChange:i,triggerElements:a,...s}=e;super({...s,positionReference:s.referenceElement,domReferenceElement:s.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:P4(),nested:n,noEmit:r,triggerElements:a},fte)}setOpen=(e,n)=>{if((!e||!this.state.open||x4(n.event))&&(this.context.dataRef.current.openEvent=e?n.event:void 0),!this.context.noEmit){const r={open:e,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(e,n)}}function EE(t,e=!1,n=!1){const[r,i]=x.useState(t&&e?"idle":void 0),[a,s]=x.useState(t);return t&&!a&&(s(!0),i("starting")),!t&&a&&r!=="ending"&&!n&&i("ending"),!t&&!a&&r==="ending"&&i(void 0),Yt(()=>{if(!t&&a&&r!=="ending"&&n){const o=Ss.request(()=>{i("ending")});return()=>{Ss.cancel(o)}}},[t,a,r,n]),Yt(()=>{if(!t||e)return;const o=Ss.request(()=>{i(void 0)});return()=>{Ss.cancel(o)}},[e,t]),Yt(()=>{if(!t||!e)return;t&&a&&r!=="idle"&&i("starting");const o=Ss.request(()=>{i("idle")});return()=>{Ss.cancel(o)}},[e,t,a,i,r]),x.useMemo(()=>({mounted:a,setMounted:s,transitionStatus:r}),[a,r])}let rp=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const hte={[rp.startingStyle]:""},pte={[rp.endingStyle]:""},of={transitionStatus(t){return t==="starting"?hte:t==="ending"?pte:null}};function q4(t,e=!1,n=!0){const r=ev();return jt((i,a=null)=>{r.cancel();function s(){gi.flushSync(i)}const o=go(t);if(o==null)return;const c=o;if(typeof c.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)i();else{let u=function(){const h=rp.startingStyle;if(!c.hasAttribute(h)){r.request(f);return}const p=new MutationObserver(()=>{c.hasAttribute(h)||(p.disconnect(),f())});p.observe(c,{attributes:!0,attributeFilter:[h]}),a?.addEventListener("abort",()=>p.disconnect(),{once:!0})},f=function(){Promise.all(c.getAnimations().map(h=>h.finished)).then(()=>{a?.aborted||s()}).catch(()=>{const h=c.getAnimations();if(n){if(a?.aborted)return;s()}else h.length>0&&h.some(p=>p.pending||p.playState!=="finished")&&f()})};if(e){u();return}r.request(f)}})}function lf(t){const{enabled:e=!0,open:n,ref:r,onComplete:i}=t,a=jt(i),s=q4(r,n,!1);x.useEffect(()=>{if(!e)return;const o=new AbortController;return s(a,o.signal),()=>{o.abort()}},[e,n,a,s])}function mte(t,e){const n=x.useRef(null),r=x.useRef(null);return x.useCallback(i=>{if(t!==void 0){if(n.current!==null){const a=n.current,s=r.current,o=e.context.triggerElements.getById(a);s&&o===s&&e.context.triggerElements.delete(a),n.current=null,r.current=null}i!==null&&(n.current=t,r.current=i,e.context.triggerElements.add(t,i))}},[e,t])}function gte(t,e,n,r){const i=n.useState("isMountedByTrigger",t),a=mte(t,n),s=jt(o=>{if(a(o),!o||!n.select("open"))return;const c=n.select("activeTriggerId");if(c===t){n.update({activeTriggerElement:o,...r});return}c==null&&n.update({activeTriggerId:t,activeTriggerElement:o,...r})});return Yt(()=>{i&&n.update({activeTriggerElement:e.current,...r})},[i,n,e,...Object.values(r)]),{registerTrigger:s,isMountedByThisTrigger:i}}function X4(t){const e=t.useState("open");Yt(()=>{if(e&&!t.select("activeTriggerId")&&t.context.triggerElements.size===1){const n=t.context.triggerElements.entries().next();if(!n.done){const[r,i]=n.value;t.update({activeTriggerId:r,activeTriggerElement:i})}}},[e,t])}function K4(t,e,n){const{mounted:r,setMounted:i,transitionStatus:a}=EE(t);e.useSyncedValues({mounted:r,transitionStatus:a});const s=jt(()=>{i(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),e.context.onOpenChangeComplete?.(!1)}),o=e.useState("preventUnmountingOnClose");return lf({enabled:!o,open:t,ref:e.context.popupRef,onComplete(){t||s()}}),{forceUnmount:s,transitionStatus:a}}class rv{constructor(){this.elements=new Set,this.idMap=new Map}add(e,n){const r=this.idMap.get(e);r!==n&&(r!==void 0&&this.elements.delete(r),this.elements.add(n),this.idMap.set(e,n))}delete(e){const n=this.idMap.get(e);n&&(this.elements.delete(n),this.idMap.delete(e))}hasElement(e){return this.elements.has(e)}hasMatchingElement(e){for(const n of this.elements)if(e(n))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function yte(){return new kE({open:!1,floatingElement:null,referenceElement:null,triggerElements:new rv,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Z4(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:yte(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:ei,inactiveTriggerProps:ei,popupProps:ei}}const J4={open:At(t=>t.open),mounted:At(t=>t.mounted),transitionStatus:At(t=>t.transitionStatus),floatingRootContext:At(t=>t.floatingRootContext),preventUnmountingOnClose:At(t=>t.preventUnmountingOnClose),payload:At(t=>t.payload),activeTriggerId:At(t=>t.activeTriggerId),activeTriggerElement:At(t=>t.mounted?t.activeTriggerElement:null),isTriggerActive:At((t,e)=>e!==void 0&&t.activeTriggerId===e),isOpenedByTrigger:At((t,e)=>e!==void 0&&t.activeTriggerId===e&&t.open),isMountedByTrigger:At((t,e)=>e!==void 0&&t.activeTriggerId===e&&t.mounted),triggerProps:At((t,e)=>e?t.activeTriggerProps:t.inactiveTriggerProps),popupProps:At(t=>t.popupProps),popupElement:At(t=>t.popupElement),positionerElement:At(t=>t.positionerElement)};function Q4(t){const{open:e=!1,onOpenChange:n,elements:r={}}=t,i=sf(),a=jl()!=null,s=Vi(()=>new kE({open:e,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:r.triggers??new rv,floatingId:i,nested:a,noEmit:t.noEmit||!1})).current;return Yt(()=>{const o={open:e,floatingId:i};r.reference!==void 0&&(o.referenceElement=r.reference,o.domReferenceElement=Kn(r.reference)?r.reference:null),r.floating!==void 0&&(o.floatingElement=r.floating),s.update(o)},[e,i,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=a,s.context.noEmit=t.noEmit||!1,s}function vte(t={}){const{nodeId:e,externalTree:n}=t,r=Q4(t),i=t.rootContext||r,a={reference:i.useState("referenceElement"),floating:i.useState("floatingElement"),domReference:i.useState("domReferenceElement")},[s,o]=x.useState(null),c=x.useRef(null),u=cu(n);Yt(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);const f=rte({...t,elements:{...a,...s&&{reference:s}}}),h=x.useCallback(P=>{const k=Kn(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;o(k),f.refs.setReference(k)},[f.refs]),[p,y]=x.useState(null),[v,w]=x.useState(null);i.useSyncedValue("referenceElement",p),i.useSyncedValue("domReferenceElement",Kn(p)?p:null),i.useSyncedValue("floatingElement",v);const b=x.useCallback(P=>{(Kn(P)||P===null)&&(c.current=P,y(P)),(Kn(f.refs.reference.current)||f.refs.reference.current===null||P!==null&&!Kn(P))&&f.refs.setReference(P)},[f.refs,y]),_=x.useCallback(P=>{w(P),f.refs.setFloating(P)},[f.refs]),E=x.useMemo(()=>({...f.refs,setReference:b,setFloating:_,setPositionReference:h,domReference:c}),[f.refs,b,_,h]),M=x.useMemo(()=>({...f.elements,domReference:a.domReference}),[f.elements,a.domReference]),T=i.useState("open"),R=i.useState("floatingId"),A=x.useMemo(()=>({...f,dataRef:i.context.dataRef,open:T,onOpenChange:i.setOpen,events:i.context.events,floatingId:R,refs:E,elements:M,nodeId:e,rootStore:i}),[f,E,M,e,i,T,R]);return Yt(()=>{i.context.dataRef.current.floatingContext=A;const P=u?.nodesRef.current.find(k=>k.id===e);P&&(P.context=A)}),x.useMemo(()=>({...f,context:A,refs:E,elements:M,rootStore:i}),[f,E,M,A,i])}function eF(t){const{popupStore:e,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:i}=t,a=sf(),s=jl()!=null,o=e.useState("open"),c=e.useState("activeTriggerElement"),u=e.useState(r?"popupElement":"positionerElement"),f=e.context.triggerElements,h=Vi(()=>new kE({open:o,referenceElement:c,floatingElement:u,triggerElements:f,onOpenChange:i,floatingId:a,nested:s,noEmit:n})).current;return Yt(()=>{const p={open:o,floatingId:a,referenceElement:c,floatingElement:u};Kn(c)&&(p.domReferenceElement=c),h.state.positionReference===h.state.referenceElement&&(p.positionReference=c),h.update(p)},[o,a,c,u,h]),h.context.onOpenChange=i,h.context.nested=s,h.context.noEmit=n,h}const k1=np("safe-polygon"),xte=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${m4}`;function bte(t){return t?!!t.closest(xte):!1}function tF(t){const e=x.useRef(void 0),n=x.useRef(!1),r=x.useRef(void 0),i=x.useRef(!0),a=x.useRef(!1),s=x.useRef(()=>{}),o=x.useRef(!1),c=ji(),u=ji(),f=x.useRef(void 0);return x.useMemo(()=>{const h=t.context.dataRef.current;return h.hoverInteractionState||(h.hoverInteractionState={pointerTypeRef:e,interactedInsideRef:n,handlerRef:r,blockMouseMoveRef:i,performedPointerEventsMutationRef:a,unbindMouseMoveRef:s,restTimeoutPendingRef:o,openChangeTimeout:c,restTimeout:u,handleCloseOptionsRef:f}),h.hoverInteractionState},[t,e,n,r,i,a,s,o,c,u,f])}const _te=new Set(["click","mousedown"]);function wte(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),i=n.useState("floatingElement"),a=n.useState("domReferenceElement"),{dataRef:s}=n.context,{enabled:o=!0,closeDelay:c=0,externalTree:u}=e,{pointerTypeRef:f,interactedInsideRef:h,handlerRef:p,performedPointerEventsMutationRef:y,unbindMouseMoveRef:v,restTimeoutPendingRef:w,openChangeTimeout:b,handleCloseOptionsRef:_}=tF(n),E=cu(u),M=jl(),T=jt(()=>h.current?!0:s.current.openEvent?_te.has(s.current.openEvent.type):!1),R=jt(()=>{const U=s.current.openEvent?.type;return U?.includes("mouse")&&U!=="mousedown"}),A=x.useCallback((U,L=!0)=>{const z=Ste(c,f.current);z&&!p.current?b.start(z,()=>n.setOpen(!1,Mn(aa,U))):L&&(b.clear(),n.setOpen(!1,Mn(aa,U)))},[c,p,n,f,b]),P=jt(()=>{v.current(),p.current=void 0}),k=jt(()=>{if(y.current){const U=Mr(i).body;U.style.pointerEvents="",U.removeAttribute(k1),y.current=!1}}),N=jt(U=>{const L=Fi(U);if(!bte(L)){h.current=!1;return}h.current=!0});Yt(()=>{r||(f.current=void 0,w.current=!1,h.current=!1,P(),k())},[r,f,w,h,P,k]),x.useEffect(()=>()=>{P()},[P]),x.useEffect(()=>k,[k]),Yt(()=>{if(o&&r&&_.current?.blockPointerEvents&&R()&&Kn(a)&&i){y.current=!0;const U=Mr(i).body;U.setAttribute(k1,"");const L=a,z=i,F=E?.nodesRef.current.find(V=>V.id===M)?.context?.elements.floating;return F&&(F.style.pointerEvents=""),U.style.pointerEvents="none",L.style.pointerEvents="auto",z.style.pointerEvents="auto",()=>{U.style.pointerEvents="",L.style.pointerEvents="",z.style.pointerEvents=""}}},[o,r,a,i,_,R,E,M,y]),x.useEffect(()=>{if(!o)return;function U(V){if(T()||!s.current.floatingContext||!n.select("open"))return;const W=n.context.triggerElements;V.relatedTarget&&W.hasElement(V.relatedTarget)||(k(),P(),T()||A(V))}function L(V){b.clear(),k(),p.current?.(V),P()}function z(V){T()||A(V,!1)}const F=i;return F&&(F.addEventListener("mouseleave",U),F.addEventListener("mouseenter",L),F.addEventListener("mouseleave",z),F.addEventListener("pointerdown",N,!0)),()=>{F&&(F.removeEventListener("mouseleave",U),F.removeEventListener("mouseenter",L),F.removeEventListener("mouseleave",z),F.removeEventListener("pointerdown",N,!0))}})}function Ste(t,e){return e&&!Ud(e)?0:typeof t=="function"?t():t}function c_(t){return typeof t=="function"?t():t}const kte={current:null};function Ete(t,e={}){const n="rootStore"in t?t.rootStore:t,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:s=0,handleClose:o=null,mouseOnly:c=!1,restMs:u=0,move:f=!0,triggerElementRef:h=kte,externalTree:p,isActiveTrigger:y=!0}=e,v=cu(p),{pointerTypeRef:w,interactedInsideRef:b,handlerRef:_,blockMouseMoveRef:E,performedPointerEventsMutationRef:M,unbindMouseMoveRef:T,restTimeoutPendingRef:R,openChangeTimeout:A,restTimeout:P,handleCloseOptionsRef:k}=tF(n),N=Fr(o),U=Fr(s),L=Fr(u);y&&(k.current=N.current?.__options);const z=jt(()=>b.current?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),F=x.useCallback((Q,O=!0)=>{const G=i_(U.current,"close",w.current);G&&!_.current?A.start(G,()=>n.setOpen(!1,Mn(aa,Q))):O&&(A.clear(),n.setOpen(!1,Mn(aa,Q)))},[U,_,n,w,A]),V=jt(()=>{T.current(),_.current=void 0}),W=jt(()=>{if(M.current){const Q=Mr(n.select("domReferenceElement")).body;Q.style.pointerEvents="",Q.removeAttribute(k1),M.current=!1}});x.useEffect(()=>{if(!a)return;function Q(O){O.open||(A.clear(),P.clear(),E.current=!0,R.current=!1)}return i.on("openchange",Q),()=>{i.off("openchange",Q)}},[a,i,A,P,E,R]);const K=jt(Q=>{if(z()||!r.current.floatingContext)return;const O=n.context.triggerElements;if(Q.relatedTarget&&O.hasElement(Q.relatedTarget))return;const G=h.current;N.current?.({...r.current.floatingContext,tree:v,x:Q.clientX,y:Q.clientY,onClose(){W(),V(),!z()&&G===n.select("domReferenceElement")&&F(Q)}})(Q)});return x.useEffect(()=>{if(!a)return;const Q=h.current??(y?n.select("domReferenceElement"):null);if(!Kn(Q))return;function O(H){if(A.clear(),E.current=!1,c&&!Ud(w.current)||c_(L.current)>0&&!i_(U.current,"open"))return;const te=i_(U.current,"open",w.current),re=n.select("domReferenceElement"),ue=n.context.triggerElements,ce=(ue.hasElement(H.target)||ue.hasMatchingElement(Pe=>On(Pe,H.target)))&&(!re||!On(re,H.target)),ee=H.currentTarget??null,le=n.select("open"),ve=!le||ce;ce&&le?n.setOpen(!0,Mn(aa,H,ee)):te?A.start(te,()=>{ve&&n.setOpen(!0,Mn(aa,H,ee))}):ve&&n.setOpen(!0,Mn(aa,H,ee))}function G(H){if(z()){W();return}T.current();const te=n.select("domReferenceElement"),re=Mr(te);P.clear(),R.current=!1;const ue=n.context.triggerElements;if(H.relatedTarget&&ue.hasElement(H.relatedTarget))return;if(N.current&&r.current.floatingContext){n.select("open")||A.clear();const ee=h.current;_.current=N.current({...r.current.floatingContext,tree:v,x:H.clientX,y:H.clientY,onClose(){W(),V(),!z()&&ee===n.select("domReferenceElement")&&F(H,!0)}});const le=_.current;le(H),re.addEventListener("mousemove",le),T.current=()=>{re.removeEventListener("mousemove",le)};return}(w.current!=="touch"||!On(n.select("floatingElement"),H.relatedTarget))&&F(H)}function Y(H){K(H)}return n.select("open")&&Q.addEventListener("mouseleave",Y),f&&Q.addEventListener("mousemove",O,{once:!0}),Q.addEventListener("mouseenter",O),Q.addEventListener("mouseleave",G),()=>{Q.removeEventListener("mouseleave",Y),f&&Q.removeEventListener("mousemove",O),Q.removeEventListener("mouseenter",O),Q.removeEventListener("mouseleave",G)}},[V,W,E,r,U,F,n,a,N,K,y,z,c,f,w,L,P,R,A,h,v,T,_]),x.useMemo(()=>{function Q(O){w.current=O.pointerType}return{onPointerDown:Q,onPointerEnter:Q,onMouseMove(O){const{nativeEvent:G}=O,Y=O.currentTarget,H=n.select("domReferenceElement"),te=n.context.triggerElements,re=n.select("open"),ue=(te.hasElement(O.target)||te.hasMatchingElement(ee=>On(ee,O.target)))&&(!H||!On(H,O.target));if(c&&!Ud(w.current)||re&&!ue||c_(L.current)===0||!ue&&R.current&&O.movementX**2+O.movementY**2<2)return;P.clear();function ce(){if(R.current=!1,z())return;const ee=n.select("open");!E.current&&(!ee||ue)&&n.setOpen(!0,Mn(aa,G,Y))}w.current==="touch"?gi.flushSync(()=>{ce()}):ue&&re?ce():(R.current=!0,P.start(c_(L.current),ce))}}},[E,z,c,n,w,L,P,R])}function iv(t=[]){const e=t.map(u=>u?.reference),n=t.map(u=>u?.floating),r=t.map(u=>u?.item),i=t.map(u=>u?.trigger),a=x.useCallback(u=>vg(u,t,"reference"),e),s=x.useCallback(u=>vg(u,t,"floating"),n),o=x.useCallback(u=>vg(u,t,"item"),r),c=x.useCallback(u=>vg(u,t,"trigger"),i);return x.useMemo(()=>({getReferenceProps:a,getFloatingProps:s,getItemProps:o,getTriggerProps:c}),[a,s,o,c])}function vg(t,e,n){const r=new Map,i=n==="item",a={};n==="floating"&&(a.tabIndex=-1,a[v1]="");for(const s in t)i&&t&&(s===h4||s===p4)||(a[s]=t[s]);for(let s=0;s<e.length;s+=1){let o;const c=e[s]?.[n];typeof c=="function"?o=t?c(t):null:o=c,o&&WR(a,o,i,r)}return WR(a,t,i,r),a}function WR(t,e,n,r){for(const i in e){const a=e[i];n&&(i===h4||i===p4)||(i.startsWith("on")?(r.has(i)||r.set(i,[]),typeof a=="function"&&(r.get(i)?.push(a),t[i]=(...s)=>r.get(i)?.map(o=>o(...s)).find(o=>o!==void 0))):t[i]=a)}}const Mte="Escape";function av(t,e,n){switch(t){case"vertical":return e;case"horizontal":return n;default:return e||n}}function xg(t,e){return av(e,t===hE||t===Np,t===El||t===Ml)}function u_(t,e,n){return av(e,t===Np,n?t===El:t===Ml)||t==="Enter"||t===" "||t===""}function Tte(t,e,n){return av(e,n?t===El:t===Ml,t===Np)}function Cte(t,e,n,r){const i=n?t===Ml:t===El,a=t===hE;return e==="both"||e==="horizontal"&&r&&r>1?t===Mte:av(e,i,a)}function Ate(t,e){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),i=n.useState("floatingElement"),a=n.useState("domReferenceElement"),s=n.context.dataRef,{listRef:o,activeIndex:c,onNavigate:u=()=>{},enabled:f=!0,selectedIndex:h=null,allowEscape:p=!1,loopFocus:y=!1,nested:v=!1,rtl:w=!1,virtual:b=!1,focusItemOnOpen:_="auto",focusItemOnHover:E=!0,openOnArrowKeyDown:M=!0,disabledIndices:T=void 0,orientation:R="vertical",parentOrientation:A,cols:P=1,scrollItemIntoView:k=!0,itemSizes:N,dense:U=!1,id:L,resetOnPointerLeave:z=!0,externalTree:F}=e,V=tp(i),W=Fr(V),K=jl(),Q=cu(F);Yt(()=>{s.current.orientation=R},[s,R]);const O=x1(a),G=x.useRef(_),Y=x.useRef(h??-1),H=x.useRef(null),te=x.useRef(!0),re=jt($=>{u(Y.current===-1?null:Y.current,$)}),ue=x.useRef(re),ce=x.useRef(!!i),ee=x.useRef(r),le=x.useRef(!1),ve=x.useRef(!1),Pe=Fr(T),be=Fr(r),Ye=Fr(k),he=Fr(h),Ue=Fr(z),je=jt(()=>{function $(Se){b?Q?.events.emit("virtualfocus",Se):g0(Se,{sync:le.current,preventScroll:!0})}const I=o.current[Y.current],Z=ve.current;I&&$(I),(le.current?Se=>Se():requestAnimationFrame)(()=>{const Se=o.current[Y.current]||I;if(!Se)return;I||$(Se);const xe=Ye.current;xe&&_e&&(Z||!te.current)&&Se.scrollIntoView?.(typeof xe=="boolean"?{block:"nearest",inline:"nearest"}:xe)})});Yt(()=>{f&&(r&&i?(Y.current=h??-1,G.current&&h!=null&&(ve.current=!0,re())):ce.current&&(Y.current=-1,ue.current()))},[f,r,i,h,re]),Yt(()=>{if(f){if(!r){le.current=!1;return}if(i)if(c==null){if(le.current=!1,he.current!=null)return;if(ce.current&&(Y.current=-1,je()),(!ee.current||!ce.current)&&G.current&&(H.current!=null||G.current===!0&&H.current==null)){let $=0;const I=()=>{o.current[0]==null?($<2&&($?requestAnimationFrame:queueMicrotask)(I),$+=1):(Y.current=H.current==null||u_(H.current,R,w)||v?t_(o):TR(o),H.current=null,re())};I()}}else Fh(o,c)||(Y.current=c,je(),ve.current=!1)}},[f,r,i,c,he,v,o,R,w,re,je,Pe]),Yt(()=>{if(!f||i||!Q||b||!ce.current)return;const $=Q.nodesRef.current,I=$.find(Se=>Se.id===K)?.context?.elements.floating,Z=gl(Mr(i)),pe=$.some(Se=>Se.context&&On(Se.context.elements.floating,Z));I&&!pe&&te.current&&I.focus({preventScroll:!0})},[f,i,Q,K,b]),Yt(()=>{ue.current=re,ee.current=r,ce.current=!!i}),Yt(()=>{r||(H.current=null,G.current=_)},[r,_]);const et=c!=null,_e=x.useMemo(()=>{function $(Z){if(!be.current)return;const pe=o.current.indexOf(Z.currentTarget);pe!==-1&&Y.current!==pe&&(Y.current=pe,re(Z))}return{onFocus(Z){le.current=!0,$(Z)},onClick:({currentTarget:Z})=>Z.focus({preventScroll:!0}),onMouseMove(Z){le.current=!0,ve.current=!1,E&&$(Z)},onPointerLeave(Z){if(!be.current||!te.current||Z.pointerType==="touch")return;le.current=!0;const pe=Z.relatedTarget;!E||o.current.includes(pe)||Ue.current&&(Y.current=-1,re(Z),b||W.current?.focus({preventScroll:!0}))}}},[be,W,E,o,re,Ue,b]),oe=x.useCallback(()=>A??Q?.nodesRef.current.find($=>$.id===K)?.context?.dataRef?.current.orientation,[K,Q,A]),J=jt($=>{if(te.current=!1,le.current=!0,$.which===229||!be.current&&$.currentTarget===W.current)return;if(v&&Cte($.key,R,w,P)){xg($.key,oe())||pi($),n.setOpen(!1,Mn(r_,$.nativeEvent)),Tr(a)&&(b?Q?.events.emit("virtualfocus",a):a.focus());return}const I=Y.current,Z=t_(o,T),pe=TR(o,T);if(O||($.key==="Home"&&(pi($),Y.current=Z,re($)),$.key==="End"&&(pi($),Y.current=pe,re($))),P>1){const Se=N||Array.from({length:o.current.length},()=>({width:1,height:1})),xe=UQ(Se,P,U),Ie=xe.findIndex(ft=>ft!=null&&!Uh(o,ft,T)),He=xe.reduce((ft,We,Xe)=>We!=null&&!Uh(o,We,T)?Xe:ft,-1),qe=xe[FQ({current:xe.map(ft=>ft!=null?o.current[ft]:null)},{event:$,orientation:R,loopFocus:y,rtl:w,cols:P,disabledIndices:BQ([...(typeof T!="function"?T:null)||o.current.map((ft,We)=>Uh(o,We,T)?We:void 0),void 0],xe),minIndex:Ie,maxIndex:He,prevIndex:jQ(Y.current>pe?Z:Y.current,Se,xe,P,$.key===Np?"bl":$.key===(w?El:Ml)?"tr":"tl"),stopEvent:!0})];if(qe!=null&&(Y.current=qe,re($)),R==="both")return}if(xg($.key,R)){if(pi($),r&&!b&&gl($.currentTarget.ownerDocument)===$.currentTarget){Y.current=u_($.key,R,w)?Z:pe,re($);return}u_($.key,R,w)?y?I>=pe?p&&I!==o.current.length?Y.current=-1:(le.current=!1,Y.current=Z):Y.current=fi(o,{startingIndex:I,disabledIndices:T}):Y.current=Math.min(pe,fi(o,{startingIndex:I,disabledIndices:T})):y?I<=Z?p&&I!==-1?Y.current=o.current.length:(le.current=!1,Y.current=pe):Y.current=fi(o,{startingIndex:I,decrement:!0,disabledIndices:T}):Y.current=Math.max(Z,fi(o,{startingIndex:I,decrement:!0,disabledIndices:T})),Fh(o,Y.current)&&(Y.current=-1),re($)}}),ze=x.useMemo(()=>b&&r&&et&&{"aria-activedescendant":`${L}-${c}`},[b,r,et,L,c]),Ne=x.useMemo(()=>({"aria-orientation":R==="both"?void 0:R,...O?{}:ze,onKeyDown($){if($.key==="Tab"&&$.shiftKey&&r&&!b){const I=Fi($.nativeEvent);if(I&&!On(W.current,I))return;pi($),n.setOpen(!1,Mn(Kc,$.nativeEvent)),Tr(a)&&a.focus();return}J($)},onPointerMove(){te.current=!0}}),[ze,J,W,R,O,n,r,b,a]),De=x.useMemo(()=>{function $(Z){_==="auto"&&y4(Z.nativeEvent)&&(G.current=!b)}function I(Z){G.current=_,_==="auto"&&v4(Z.nativeEvent)&&(G.current=!0)}return{onKeyDown(Z){const pe=n.select("open");te.current=!1;const Se=Z.key.startsWith("Arrow"),xe=Tte(Z.key,oe(),w),Ie=xg(Z.key,R),He=(v?xe:Ie)||Z.key==="Enter"||Z.key.trim()==="";if(b&&pe)return J(Z);if(!(!pe&&!M&&Se)){if(He){const qe=xg(Z.key,oe());H.current=v&&qe?null:Z.key}if(v){xe&&(pi(Z),pe?(Y.current=t_(o,Pe.current),re(Z)):n.setOpen(!0,Mn(r_,Z.nativeEvent,Z.currentTarget)));return}Ie&&(he.current!=null&&(Y.current=he.current),pi(Z),!pe&&M?n.setOpen(!0,Mn(r_,Z.nativeEvent,Z.currentTarget)):J(Z),pe&&re(Z))}},onFocus(Z){n.select("open")&&!b&&(Y.current=-1,re(Z))},onPointerDown:I,onPointerEnter:I,onMouseDown:$,onClick:$}},[J,Pe,_,o,v,re,n,M,R,oe,w,he,b]),Le=x.useMemo(()=>({...ze,...De}),[ze,De]);return x.useMemo(()=>f?{reference:Le,floating:Ne,item:_e,trigger:De}:{},[f,Le,Ne,De,_e])}const Rte=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function nF(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),i=n.useState("floatingId"),a=n.useState("domReferenceElement"),s=n.useState("floatingElement"),{enabled:o=!0,role:c="dialog"}=e,u=sf(),f=a?.id||u,h=x.useMemo(()=>tp(s)?.id||i,[s,i]),p=Rte.get(c)??c,v=jl()!=null,w=x.useMemo(()=>p==="tooltip"||c==="label"?ei:{"aria-haspopup":p==="alertdialog"?"dialog":p,"aria-expanded":"false",...p==="listbox"&&{role:"combobox"},...p==="menu"&&v&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[p,v,c]),b=x.useMemo(()=>p==="tooltip"||c==="label"?{[`aria-${c==="label"?"labelledby":"describedby"}`]:r?h:void 0}:{...w,"aria-expanded":r?"true":"false","aria-controls":r?h:void 0,...p==="menu"&&{id:f}},[p,h,r,f,c,w]),_=x.useMemo(()=>{const M={id:h,...p&&{role:p}};return p==="tooltip"||c==="label"?M:{...M,...p==="menu"&&{"aria-labelledby":f}}},[p,h,f,c]),E=x.useCallback(({active:M,selected:T})=>{const R={role:"option",...M&&{id:`${h}-fui-option`}};switch(c){case"select":case"combobox":return{...R,"aria-selected":T}}return{}},[h,c]);return x.useMemo(()=>o?{reference:b,floating:_,item:E,trigger:w}:{},[o,b,_,w,E])}function Pte(t,e){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),i=n.context.dataRef,{listRef:a,activeIndex:s,onMatch:o,onTypingChange:c,enabled:u=!0,findMatch:f=null,resetMs:h=750,ignoreKeys:p=g1,selectedIndex:y=null}=e,v=ji(),w=x.useRef(""),b=x.useRef(y??s??-1),_=x.useRef(null);Yt(()=>{r&&(v.clear(),_.current=null,w.current="")},[r,v]),Yt(()=>{r&&w.current===""&&(b.current=y??s??-1)},[r,y,s]);const E=jt(A=>{A?i.current.typing||(i.current.typing=A,c?.(A)):i.current.typing&&(i.current.typing=A,c?.(A))}),M=jt(A=>{function P(z,F,V){const W=f?f(F,V):F.find(K=>K?.toLocaleLowerCase().indexOf(V.toLocaleLowerCase())===0);return W?z.indexOf(W):-1}const k=a.current;if(w.current.length>0&&w.current[0]!==" "&&(P(k,k,w.current)===-1?E(!1):A.key===" "&&pi(A)),k==null||p.includes(A.key)||A.key.length!==1||A.ctrlKey||A.metaKey||A.altKey)return;r&&A.key!==" "&&(pi(A),E(!0)),k.every(z=>z?z[0]?.toLocaleLowerCase()!==z[1]?.toLocaleLowerCase():!0)&&w.current===A.key&&(w.current="",b.current=_.current),w.current+=A.key,v.start(h,()=>{w.current="",b.current=_.current,E(!1)});const U=b.current,L=P(k,[...k.slice((U||0)+1),...k.slice(0,(U||0)+1)],w.current);L!==-1?(o?.(L),_.current=L):A.key!==" "&&(w.current="",E(!1))}),T=x.useMemo(()=>({onKeyDown:M}),[M]),R=x.useMemo(()=>({onKeyDown:M,onKeyUp(A){A.key===" "&&E(!1)}}),[M,E]);return x.useMemo(()=>u?{reference:T,floating:R}:{},[u,T,R])}function GR(t,e){const[n,r]=t;let i=!1;const a=e.length;for(let s=0,o=a-1;s<a;o=s++){const[c,u]=e[s]||[0,0],[f,h]=e[o]||[0,0];u>=r!=h>=r&&n<=(f-c)*(r-u)/(h-u)+c&&(i=!i)}return i}function Nte(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function Dte(t={}){const{buffer:e=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=t,i=new Nl;let a=!1,s=null,o=null,c=typeof performance<"u"?performance.now():0;function u(h,p){const y=performance.now(),v=y-c;if(s===null||o===null||v===0)return s=h,o=p,c=y,null;const w=h-s,b=p-o,E=Math.sqrt(w*w+b*b)/v;return s=h,o=p,c=y,E}const f=({x:h,y:p,placement:y,elements:v,onClose:w,nodeId:b,tree:_})=>function(M){function T(){i.clear(),w()}if(i.clear(),!v.domReference||!v.floating||y==null||h==null||p==null)return;const{clientX:R,clientY:A}=M,P=[R,A],k=Fi(M),N=M.type==="mouseleave",U=On(v.floating,k),L=On(v.domReference,k),z=v.domReference.getBoundingClientRect(),F=v.floating.getBoundingClientRect(),V=y.split("-")[0],W=h>F.right-F.width/2,K=p>F.bottom-F.height/2,Q=Nte(P,z),O=F.width>z.width,G=F.height>z.height,Y=(O?z:F).left,H=(O?z:F).right,te=(G?z:F).top,re=(G?z:F).bottom;if(U&&(a=!0,!N))return;if(L&&(a=!1),L&&!N){a=!0;return}if(N&&Kn(M.relatedTarget)&&On(v.floating,M.relatedTarget)||_&&Uc(_.nodesRef.current,b).some(({context:ee})=>ee?.open))return;if(V==="top"&&p>=z.bottom-1||V==="bottom"&&p<=z.top+1||V==="left"&&h>=z.right-1||V==="right"&&h<=z.left+1)return T();let ue=[];switch(V){case"top":ue=[[Y,z.top+1],[Y,F.bottom-1],[H,F.bottom-1],[H,z.top+1]];break;case"bottom":ue=[[Y,F.top+1],[Y,z.bottom-1],[H,z.bottom-1],[H,F.top+1]];break;case"left":ue=[[F.right-1,re],[F.right-1,te],[z.left+1,te],[z.left+1,re]];break;case"right":ue=[[z.right-1,re],[z.right-1,te],[F.left+1,te],[F.left+1,re]];break}function ce([ee,le]){switch(V){case"top":{const ve=[O?ee+e/2:W?ee+e*4:ee-e*4,le+e+1],Pe=[O?ee-e/2:W?ee+e*4:ee-e*4,le+e+1],be=[[F.left,W||O?F.bottom-e:F.top],[F.right,W?O?F.bottom-e:F.top:F.bottom-e]];return[ve,Pe,...be]}case"bottom":{const ve=[O?ee+e/2:W?ee+e*4:ee-e*4,le-e],Pe=[O?ee-e/2:W?ee+e*4:ee-e*4,le-e],be=[[F.left,W||O?F.top+e:F.bottom],[F.right,W?O?F.top+e:F.bottom:F.top+e]];return[ve,Pe,...be]}case"left":{const ve=[ee+e+1,G?le+e/2:K?le+e*4:le-e*4],Pe=[ee+e+1,G?le-e/2:K?le+e*4:le-e*4];return[...[[K||G?F.right-e:F.left,F.top],[K?G?F.right-e:F.left:F.right-e,F.bottom]],ve,Pe]}case"right":{const ve=[ee-e,G?le+e/2:K?le+e*4:le-e*4],Pe=[ee-e,G?le-e/2:K?le+e*4:le-e*4],be=[[K||G?F.left+e:F.right,F.top],[K?G?F.left+e:F.right:F.left+e,F.bottom]];return[ve,Pe,...be]}default:return[]}}if(!GR([R,A],ue)){if(a&&!Q)return T();if(!N&&r){const ee=u(M.clientX,M.clientY);if(ee!==null&&ee<.1)return T()}GR([R,A],ce([h,p]))?!a&&r&&i.start(40,T):T()}};return f.__options={blockPointerEvents:n},f}const rF=x.createContext(null),iF=x.createContext(null);function Bl(){const t=x.useContext(rF);if(t===null)throw new Error(Wi(60));return t}function aF(){const t=x.useContext(iF);if(t===null)throw new Error(Wi(61));return t}let $R=(function(t){return t.disabled="data-disabled",t.valid="data-valid",t.invalid="data-invalid",t.touched="data-touched",t.dirty="data-dirty",t.filled="data-filled",t.focused="data-focused",t})({});const Lte={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ite={valid(t){return t===null?null:t?{[$R.valid]:""}:{[$R.invalid]:""}}},Ote=x.createContext({invalid:void 0,name:void 0,validityData:{state:Lte,errors:[],error:"",value:"",initialValue:null},setValidityData:sa,disabled:void 0,touched:!1,setTouched:sa,dirty:!1,setDirty:sa,filled:!1,setFilled:sa,focused:!1,setFocused:sa,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:(t=ei)=>t,getInputValidationProps:(t=ei)=>t,inputRef:{current:null},commit:async()=>{}}});function ME(t=!0){const e=x.useContext(Ote);if(e.setValidityData===sa&&!t)throw new Error(Wi(28));return e}function sv(t){return sf(t,"base-ui")}const Fte=x.createContext({controlId:void 0,setControlId:sa,labelId:void 0,setLabelId:sa,messageIds:[],setMessageIds:sa,getDescriptionProps:t=>t});function sF(){return x.useContext(Fte)}function oF(t={}){const{id:e,implicit:n=!1,controlRef:r}=t,{controlId:i,setControlId:a}=sF(),s=sv(e);return Yt(()=>{if(!(!n&&!e||a===sa)){if(n){const o=r?.current;Kn(o)&&o.closest("label")!=null?a(e??null):a(i??s)}else e&&a(e);return()=>{e&&a(void 0)}}},[e,r,i,a,n,s]),i??s}const Ute=(t,e)=>Object.is(t,e);function Vd(t,e,n){return t==null||e==null?Object.is(t,e):n(t,e)}function d_(t,e,n){return!t||t.length===0?!1:t.some(r=>r===void 0?!1:Vd(r,e,n))}function E1(t,e,n){return!t||t.length===0?-1:t.findIndex(r=>r===void 0?!1:Vd(r,e,n))}function jte(t,e,n){return t.filter(r=>!Vd(r,e,n))}function M1(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function lF(t){return t!=null&&t.length>0&&typeof t[0]=="object"&&t[0]!=null&&"items"in t[0]}function Bte(t){if(!Array.isArray(t))return t!=null&&!("null"in t);if(lF(t)){for(const e of t)for(const n of e.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(const e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function zte(t,e){if(e&&t!=null)return e(t)??"";if(t&&typeof t=="object"){if("label"in t&&t.label!=null)return String(t.label);if("value"in t)return String(t.value)}return M1(t)}function pd(t,e){return e&&t!=null?e(t)??"":t&&typeof t=="object"&&"value"in t&&"label"in t?M1(t.value):M1(t)}function cF(t,e,n){function r(){return zte(t,n)}if(n&&t!=null)return n(t);if(t&&typeof t=="object"&&"label"in t&&t.label!=null)return t.label;if(e&&!Array.isArray(e))return e[t]??r();if(Array.isArray(e)){const i=lF(e)?e.flatMap(a=>a.items):e;if(t==null||typeof t!="object"){const a=i.find(s=>s.value===t);return a&&a.label!=null?a.label:r()}if("value"in t){const a=i.find(s=>s&&s.value===t.value);if(a&&a.label!=null)return a.label}}return r()}function Vte(t,e,n){return t.reduce((r,i,a)=>(a>0&&r.push(", "),r.push(m.jsx(x.Fragment,{children:cF(i,e,n)},a)),r),[])}const fn={id:At(t=>t.id),modal:At(t=>t.modal),multiple:At(t=>t.multiple),items:At(t=>t.items),itemToStringLabel:At(t=>t.itemToStringLabel),itemToStringValue:At(t=>t.itemToStringValue),isItemEqualToValue:At(t=>t.isItemEqualToValue),value:At(t=>t.value),hasSelectedValue:At(t=>{const{value:e,multiple:n,itemToStringValue:r}=t;return e==null?!1:n&&Array.isArray(e)?e.length>0:pd(e,r)!==""}),hasNullItemLabel:At((t,e)=>e?Bte(t.items):!1),open:At(t=>t.open),mounted:At(t=>t.mounted),forceMount:At(t=>t.forceMount),transitionStatus:At(t=>t.transitionStatus),openMethod:At(t=>t.openMethod),activeIndex:At(t=>t.activeIndex),selectedIndex:At(t=>t.selectedIndex),isActive:At((t,e)=>t.activeIndex===e),isSelected:At((t,e,n)=>{const r=t.isItemEqualToValue,i=t.value;return t.multiple?Array.isArray(i)&&i.some(a=>Vd(a,n,r)):t.selectedIndex===e&&t.selectedIndex!==null?!0:Vd(i,n,r)}),isSelectedByFocus:At((t,e)=>t.selectedIndex===e),popupProps:At(t=>t.popupProps),triggerProps:At(t=>t.triggerProps),triggerElement:At(t=>t.triggerElement),positionerElement:At(t=>t.positionerElement),listElement:At(t=>t.listElement),scrollUpArrowVisible:At(t=>t.scrollUpArrowVisible),scrollDownArrowVisible:At(t=>t.scrollDownArrowVisible),hasScrollArrows:At(t=>t.hasScrollArrows)},Hte=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:sa,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function uF(){return x.useContext(Hte)}function Wte(t,e){return{...t,state:{...t.state,valid:!e&&t.state.valid}}}function Gte(t){const{enabled:e=!0,value:n,id:r,name:i,controlRef:a,commit:s}=t,{formRef:o}=uF(),{invalid:c,markedDirtyRef:u,validityData:f,setValidityData:h}=ME(),p=jt(t.getValue);Yt(()=>{if(!e)return;let y=n;y===void 0&&(y=p()),f.initialValue===null&&y!==null&&h(v=>({...v,initialValue:y}))},[e,h,n,f.initialValue,p]),Yt(()=>{!e||!r||o.current.fields.set(r,{getValue:p,name:i,controlRef:a,validityData:Wte(f,c),validate(y=!0){let v=n;v===void 0&&(v=p()),u.current=!0,y?gi.flushSync(()=>s(v)):s(v)}})},[s,a,e,o,p,r,c,u,i,f,n]),Yt(()=>{const y=o.current.fields;return()=>{r&&y.delete(r)}},[o,r])}function $te(t,e){const n=x.useRef(t),r=jt(e);Yt(()=>{n.current!==t&&r(n.current)},[t,r]),Yt(()=>{n.current=t},[t])}function Yte(t){const e=x.useRef(""),n=x.useCallback(i=>{i.defaultPrevented||(e.current=i.pointerType,t(i,i.pointerType))},[t]);return{onClick:x.useCallback(i=>{if(i.detail===0){t(i,"keyboard");return}"pointerType"in i&&t(i,i.pointerType),t(i,e.current),e.current=""},[t]),onPointerDown:n}}function TE(t){const[e,n]=x.useState(null),r=jt((o,c)=>{t||n(c||(f4?"touch":""))}),i=x.useCallback(()=>{n(null)},[]),{onClick:a,onPointerDown:s}=Yte(r);return x.useMemo(()=>({openMethod:e,reset:i,triggerProps:{onClick:a,onPointerDown:s}}),[e,i,a,s])}function qte(t){const{id:e,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:s=!1,onOpenChange:o,name:c,disabled:u=!1,readOnly:f=!1,required:h=!1,modal:p=!0,actionsRef:y,inputRef:v,onOpenChangeComplete:w,items:b,multiple:_=!1,itemToStringLabel:E,itemToStringValue:M,isItemEqualToValue:T=Ute,highlightItemOnHover:R=!0,children:A}=t,{clearErrors:P}=uF(),{setDirty:k,setTouched:N,setFocused:U,shouldValidateOnChange:L,validityData:z,setFilled:F,name:V,disabled:W,validation:K,validationMode:Q}=ME(),O=oF({id:e}),G=W||u,Y=V??c,[H,te]=yR({controlled:n,default:_?r??g1:r,name:"Select",state:"value"}),[re,ue]=yR({controlled:a,default:s,name:"Select",state:"open"}),ce=x.useRef([]),ee=x.useRef([]),le=x.useRef(null),ve=x.useRef(null),Pe=x.useRef(0),be=x.useRef(null),Ye=x.useRef([]),he=x.useRef(!1),Ue=x.useRef(!1),je=x.useRef(null),et=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),_e=x.useRef(!1),{mounted:oe,setMounted:J,transitionStatus:ze}=EE(re),{openMethod:Ne,triggerProps:De,reset:Le}=TE(re),$=Vi(()=>new Ed({id:O,modal:p,multiple:_,itemToStringLabel:E,itemToStringValue:M,isItemEqualToValue:T,value:H,open:re,mounted:oe,transitionStatus:ze,items:b,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,I=mn($,fn.activeIndex),Z=mn($,fn.selectedIndex),pe=mn($,fn.triggerElement),Se=mn($,fn.positionerElement),xe=x.useMemo(()=>_&&Array.isArray(H)&&H.length===0?"":pd(H,M),[_,H,M]),Ie=x.useMemo(()=>_&&Array.isArray(H)?H.map(St=>pd(St,M)):pd(H,M),[_,H,M]),He=Fr($.state.triggerElement);Gte({id:O,commit:K.commit,value:H,controlRef:He,name:Y,getValue:()=>Ie});const qe=x.useRef(H);Yt(()=>{H!==qe.current&&$.set("forceMount",!0)},[$,H]),Yt(()=>{F(_?Array.isArray(H)&&H.length>0:H!=null)},[_,H,F]),Yt(function(){if(re)return;const Rt=Ye.current;if(_){const xn=Array.isArray(H)?H:[];if(xn.length===0){$.set("selectedIndex",null);return}const ie=xn[xn.length-1],fe=E1(Rt,ie,T);$.set("selectedIndex",fe===-1?null:fe);return}const hn=E1(Rt,H,T);$.set("selectedIndex",hn===-1?null:hn)},[_,re,H,Ye,T,$]),$te(H,()=>{P(Y),k(H!==z.initialValue),L()?K.commit(H):K.commit(H,!0)});const ft=jt((St,Rt)=>{if(o?.(St,Rt),!Rt.isCanceled&&(ue(St),!St&&(Rt.reason===Kc||Rt.reason===vE)&&(N(!0),U(!1),Q==="onBlur"&&K.commit(H)),!St&&$.state.activeIndex!==null)){const hn=ce.current[$.state.activeIndex];queueMicrotask(()=>{hn?.setAttribute("tabindex","-1")})}}),We=jt(()=>{J(!1),$.set("activeIndex",null),Le(),w?.(!1)});lf({enabled:!y,open:re,ref:le,onComplete(){re||We()}}),x.useImperativeHandle(y,()=>({unmount:We}),[We]);const Xe=jt((St,Rt)=>{i?.(St,Rt),!Rt.isCanceled&&te(St)}),nt=jt(()=>{const St=$.state.listElement||le.current;if(!St)return;const Rt=St.scrollTop,hn=St.scrollTop+St.clientHeight,xn=Rt>1,ie=hn<St.scrollHeight-1;$.state.scrollUpArrowVisible!==xn&&$.set("scrollUpArrowVisible",xn),$.state.scrollDownArrowVisible!==ie&&$.set("scrollDownArrowVisible",ie)}),ct=Q4({open:re,onOpenChange:ft,elements:{reference:pe,floating:Se}}),Ke=j4(ct,{enabled:!f&&!G,event:"mousedown"}),gt=SE(ct,{bubbles:!1}),ne=Ate(ct,{enabled:!f&&!G,listRef:ce,activeIndex:I,selectedIndex:Z,disabledIndices:g1,onNavigate(St){St===null&&!re||$.set("activeIndex",St)},focusItemOnHover:!1}),Be=Pte(ct,{enabled:!f&&!G&&(re||!_),listRef:ee,activeIndex:I,selectedIndex:Z,onMatch(St){re?$.set("activeIndex",St):Xe(Ye.current[St],Mn("none"))},onTypingChange(St){he.current=St}}),{getReferenceProps:ke,getFloatingProps:Ae,getItemProps:Ve}=iv([Ke,gt,ne,Be]),ge=x.useMemo(()=>Jy(ke(),De,O?{id:O}:ei),[ke,De,O]);YJ(()=>{$.update({popupProps:Ae(),triggerProps:ge})}),Yt(()=>{$.update({id:O,modal:p,multiple:_,value:H,open:re,mounted:oe,transitionStatus:ze,popupProps:Ae(),triggerProps:ge,items:b,itemToStringLabel:E,itemToStringValue:M,isItemEqualToValue:T,openMethod:Ne})},[$,O,p,_,H,re,oe,ze,Ae,ge,b,E,M,T,Ne]);const ht=x.useMemo(()=>({store:$,name:Y,required:h,disabled:G,readOnly:f,multiple:_,itemToStringLabel:E,itemToStringValue:M,highlightItemOnHover:R,setValue:Xe,setOpen:ft,listRef:ce,popupRef:le,scrollHandlerRef:ve,handleScrollArrowVisibility:nt,scrollArrowsMountedCountRef:Pe,getItemProps:Ve,events:ct.context.events,valueRef:be,valuesRef:Ye,labelsRef:ee,typingRef:he,selectionRef:et,selectedItemTextRef:je,validation:K,onOpenChangeComplete:w,keyboardActiveRef:Ue,alignItemWithTriggerActiveRef:_e,initialValueRef:qe}),[$,Y,h,G,f,_,E,M,R,Xe,ft,Ve,ct.context.events,K,w,nt]),bt=Fd(v,K.inputRef),Kt=_&&Array.isArray(H)&&H.length>0,Bt=x.useMemo(()=>!_||!Array.isArray(H)||!Y?null:H.map(St=>{const Rt=pd(St,M);return m.jsx("input",{type:"hidden",name:Y,value:Rt},Rt)}),[_,H,Y,M]);return m.jsx(rF.Provider,{value:ht,children:m.jsxs(iF.Provider,{value:ct,children:[A,m.jsx("input",{...K.getInputValidationProps({onFocus(){$.state.triggerElement?.focus({focusVisible:!0})},onChange(St){if(St.nativeEvent.defaultPrevented)return;const Rt=St.target.value,hn=Mn(tv,St.nativeEvent);function xn(){if(_)return;const ie=Ye.current.find(fe=>pd(fe,M).toLowerCase()===Rt.toLowerCase());ie!=null&&(k(ie!==z.initialValue),Xe(ie,hn),L()&&K.commit(ie))}$.set("forceMount",!0),queueMicrotask(xn)}}),name:_?void 0:Y,value:xe,disabled:G,required:h&&!Kt,readOnly:f,ref:bt,style:Y?$J:uE,tabIndex:-1,"aria-hidden":!0}),Bt]})})}let Za=(function(t){return t.open="data-open",t.closed="data-closed",t[t.startingStyle=rp.startingStyle]="startingStyle",t[t.endingStyle=rp.endingStyle]="endingStyle",t.anchorHidden="data-anchor-hidden",t})({}),T1=(function(t){return t.popupOpen="data-popup-open",t.pressed="data-pressed",t})({});const Xte={[T1.popupOpen]:""},Kte={[T1.popupOpen]:"",[T1.pressed]:""},Zte={[Za.open]:""},Jte={[Za.closed]:""},Qte={[Za.anchorHidden]:""},dF={open(t){return t?Xte:null}},fF={open(t){return t?Kte:null}},uu={open(t){return t?Zte:Jte},anchorHidden(t){return t?Qte:null}};function ene(t){const e=t.getBoundingClientRect(),n=window.getComputedStyle(t,"::before"),r=window.getComputedStyle(t,"::after");if(!(n.content!=="none"||r.content!=="none"))return e;const a=parseFloat(n.width)||0,s=parseFloat(n.height)||0,o=parseFloat(r.width)||0,c=parseFloat(r.height)||0,u=Math.max(e.width,a,o),f=Math.max(e.height,s,c),h=u-e.width,p=f-e.height;return{left:e.left-h/2,right:e.right+h/2,top:e.top-p/2,bottom:e.bottom+p/2}}const bg=2,tne=400,YR=200,nne={...fF,...Ite,value:()=>null},rne=x.forwardRef(function(e,n){const{render:r,className:i,id:a,disabled:s=!1,nativeButton:o=!0,...c}=e,{setTouched:u,setFocused:f,validationMode:h,state:p,disabled:y}=ME(),{labelId:v}=sF(),{store:w,setOpen:b,selectionRef:_,validation:E,readOnly:M,required:T,alignItemWithTriggerActiveRef:R,disabled:A,keyboardActiveRef:P}=Bl(),k=y||A||s,N=mn(w,fn.open),U=mn(w,fn.value),L=mn(w,fn.triggerProps),z=mn(w,fn.positionerElement),F=mn(w,fn.listElement),V=mn(w,fn.id),W=mn(w,fn.hasSelectedValue),K=!W&&N,Q=mn(w,fn.hasNullItemLabel,K),O=a??V;oF({id:O});const G=Fr(z),Y=x.useRef(null),{getButtonProps:H,buttonRef:te}=Qy({disabled:k,native:o}),re=jt(he=>{w.set("triggerElement",he)}),ue=Fd(n,Y,te,re),ce=ji(),ee=ji(),le=ji(),ve=ji();x.useEffect(()=>{if(N)return!(W||Q)?le.start(tne,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}):ve.start(YR,()=>{_.current.allowUnselectedMouseUp=!0,le.start(YR,()=>{_.current.allowSelectedMouseUp=!0})}),()=>{le.clear(),ve.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},ee.clear()},[N,W,Q,_,ee,le,ve]);const Pe=x.useMemo(()=>F?.id??tp(z)?.id,[F,z]),be=Jy(L,{id:O,role:"combobox","aria-expanded":N?"true":"false","aria-haspopup":"listbox","aria-controls":N?Pe:void 0,"aria-labelledby":v,"aria-readonly":M||void 0,"aria-required":T||void 0,tabIndex:k?-1:0,ref:ue,onFocus(he){f(!0),N&&R.current&&b(!1,Mn(tv,he.nativeEvent)),ce.start(0,()=>{w.set("forceMount",!0)})},onBlur(he){On(z,he.relatedTarget)||(u(!0),f(!1),h==="onBlur"&&E.commit(U))},onPointerMove(){P.current=!1},onKeyDown(){P.current=!0},onMouseDown(he){if(N)return;const Ue=zs(he.currentTarget);function je(et){if(!Y.current)return;const _e=et.target;if(On(Y.current,_e)||On(G.current,_e)||_e===Y.current)return;const oe=ene(Y.current);et.clientX>=oe.left-bg&&et.clientX<=oe.right+bg&&et.clientY>=oe.top-bg&&et.clientY<=oe.bottom+bg||b(!1,Mn(fee,et))}ee.start(0,()=>{Ue.addEventListener("mouseup",je,{once:!0})})}},E.getValidationProps,c,H);be.role="combobox";const Ye=x.useMemo(()=>({...p,open:N,disabled:k,value:U,readOnly:M,placeholder:!W}),[p,N,k,U,M,W]);return Xr("button",e,{ref:[n,Y],state:Ye,stateAttributesMapping:nne,props:be})}),ine={value:()=>null},ane=x.forwardRef(function(e,n){const{className:r,render:i,children:a,placeholder:s,...o}=e,{store:c,valueRef:u}=Bl(),f=mn(c,fn.value),h=mn(c,fn.items),p=mn(c,fn.itemToStringLabel),y=mn(c,fn.hasSelectedValue),v=!y&&s!=null&&a==null,w=mn(c,fn.hasNullItemLabel,v),b=x.useMemo(()=>({value:f,placeholder:!y}),[f,y]);let _=null;return typeof a=="function"?_=a(f):a!=null?_=a:!y&&s!=null&&!w?_=s:Array.isArray(f)?_=Vte(f,h,p):_=cF(f,h,p),Xr("span",e,{state:b,ref:[n,u],props:[{children:_},o],stateAttributesMapping:ine})}),sne=x.forwardRef(function(e,n){const{className:r,render:i,...a}=e,{store:s}=Bl(),o=mn(s,fn.open),c=x.useMemo(()=>({open:o}),[o]);return Xr("span",e,{state:c,ref:n,props:[{"aria-hidden":!0,children:"▼"},a],stateAttributesMapping:dF})}),one=x.createContext(void 0),lne=x.forwardRef(function(e,n){const{store:r}=Bl(),i=mn(r,fn.mounted),a=mn(r,fn.forceMount);return i||a?m.jsx(one.Provider,{value:!0,children:m.jsx(xE,{ref:n,...e})}):null});function CE(t){return cE(19)?t:t?"true":void 0}let qR={},XR={},KR="";function cne(t){if(typeof document>"u")return!1;const e=zs(t);return Ar(e).innerWidth-e.documentElement.clientWidth>0}function une(t){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const r=zs(t).documentElement,i={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY};r.style.scrollbarGutter="stable",r.style.overflowY="scroll";const a=r.offsetWidth;r.style.overflowY="hidden";const s=r.offsetWidth;return Object.assign(r.style,i),a===s}function dne(t){const e=zs(t),n=e.documentElement,r=e.body,i=lu(n)?n:r,a=i.style.overflow;return i.style.overflow="hidden",()=>{i.style.overflow=a}}function fne(t){const e=zs(t),n=e.documentElement,r=e.body,i=Ar(n);let a=0,s=0,o=!1;const c=Ss.create();if(d4&&(i.visualViewport?.scale??1)!==1)return()=>{};function u(){const p=i.getComputedStyle(n),y=i.getComputedStyle(r),b=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";a=n.scrollTop,s=n.scrollLeft,qR={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},KR=n.style.scrollBehavior,XR={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const _=n.scrollHeight>n.clientHeight,E=n.scrollWidth>n.clientWidth,M=p.overflowY==="scroll"||y.overflowY==="scroll",T=p.overflowX==="scroll"||y.overflowX==="scroll",R=Math.max(0,i.innerWidth-r.clientWidth),A=Math.max(0,i.innerHeight-r.clientHeight),P=parseFloat(y.marginTop)+parseFloat(y.marginBottom),k=parseFloat(y.marginLeft)+parseFloat(y.marginRight),N=lu(n)?n:r;if(o=une(t),o){n.style.scrollbarGutter=b,N.style.overflowY="hidden",N.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:b,overflowY:"hidden",overflowX:"hidden"}),(_||M)&&(n.style.overflowY="scroll"),(E||T)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:P||A?`calc(100dvh - ${P+A}px)`:"100dvh",width:k||R?`calc(100vw - ${k+R}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=a,r.scrollLeft=s,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function f(){Object.assign(n.style,qR),Object.assign(r.style,XR),o||(n.scrollTop=a,n.scrollLeft=s,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=KR)}function h(){f(),c.request(u)}return u(),i.addEventListener("resize",h),()=>{c.cancel(),f(),typeof i.removeEventListener=="function"&&i.removeEventListener("resize",h)}}class hne{lockCount=0;restore=null;timeoutLock=Nl.create();timeoutUnlock=Nl.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),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(e){if(this.lockCount===0||this.restore!==null)return;const r=zs(e).documentElement,i=Ar(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=sa;return}const a=f4||!cne(e);this.restore=a?dne(e):fne(e)}}const pne=new hne;function AE(t=!0,e=null){Yt(()=>{if(t)return pne.acquire(e)},[t,e])}const hF=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function mne(){return x.useContext(hF)}function gne(t){const{children:e,elementsRef:n,labelsRef:r,onMapChange:i}=t,a=jt(i),s=x.useRef(0),o=Vi(vne).current,c=Vi(yne).current,[u,f]=x.useState(0),h=x.useRef(u),p=jt((_,E)=>{c.set(_,E??null),h.current+=1,f(h.current)}),y=jt(_=>{c.delete(_),h.current+=1,f(h.current)}),v=x.useMemo(()=>{const _=new Map;return Array.from(c.keys()).filter(M=>M.isConnected).sort(xne).forEach((M,T)=>{const R=c.get(M)??{};_.set(M,{...R,index:T})}),_},[c,u]);Yt(()=>{if(typeof MutationObserver!="function"||v.size===0)return;const _=new MutationObserver(E=>{const M=new Set,T=R=>M.has(R)?M.delete(R):M.add(R);E.forEach(R=>{R.removedNodes.forEach(T),R.addedNodes.forEach(T)}),M.size===0&&(h.current+=1,f(h.current))});return v.forEach((E,M)=>{M.parentElement&&_.observe(M.parentElement,{childList:!0})}),()=>{_.disconnect()}},[v]),Yt(()=>{h.current===u&&(n.current.length!==v.size&&(n.current.length=v.size),r&&r.current.length!==v.size&&(r.current.length=v.size),s.current=v.size),a(v)},[a,v,n,r,u]),Yt(()=>()=>{n.current=[]},[n]),Yt(()=>()=>{r&&(r.current=[])},[r]);const w=jt(_=>(o.add(_),()=>{o.delete(_)}));Yt(()=>{o.forEach(_=>_(v))},[o,v]);const b=x.useMemo(()=>({register:p,unregister:y,subscribeMapChange:w,elementsRef:n,labelsRef:r,nextIndexRef:s}),[p,y,w,n,r,s]);return m.jsx(hF.Provider,{value:b,children:e})}function yne(){return new Map}function vne(){return new Set}function xne(t,e){const n=t.compareDocumentPosition(e);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 bne=x.createContext(void 0);function _ne(){return x.useContext(bne)?.direction??"ltr"}const wne=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:a,platform:s,elements:o,middlewareData:c}=e,{element:u,padding:f=0,offsetParent:h="real"}=Po(t,e)||{};if(u==null)return{};const p=b4(f),y={x:n,y:r},v=gE(i),w=mE(v),b=await s.getDimensions(u),_=v==="y",E=_?"top":"left",M=_?"bottom":"right",T=_?"clientHeight":"clientWidth",R=a.reference[w]+a.reference[v]-y[v]-a.floating[w],A=y[v]-a.reference[v],P=h==="real"?await s.getOffsetParent?.(u):o.floating;let k=o.floating[T]||a.floating[w];(!k||!await s.isElement?.(P))&&(k=o.floating[T]||a.floating[w]);const N=R/2-A/2,U=k/2-b[w]/2-1,L=Math.min(p[E],U),z=Math.min(p[M],U),F=L,V=k-b[w]-z,W=k/2-b[w]/2+N,K=b1(F,W,V),Q=!c.arrow&&Ul(i)!=null&&W!==K&&a.reference[w]/2-(W<F?L:z)-b[w]/2<0,O=Q?W<F?W-F:W-V:0;return{[v]:y[v]+O,data:{[v]:K,centerOffset:W-K-O,...Q&&{alignmentOffset:O}},reset:Q}}}),Sne=(t,e)=>({...wne(t),options:[t,e]}),kne={name:"hide",async fn(t){const{width:e,height:n,x:r,y:i}=t.rects.reference,a=e===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await cte().fn(t)).data?.referenceHidden||a}}}},v0={sideX:"left",sideY:"top"},Ene={name:"adaptiveOrigin",async fn(t){const{x:e,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:s,placement:o}=t,c=Ar(i),u=c.getComputedStyle(i);if(!(u.transitionDuration!=="0s"&&u.transitionDuration!==""))return{x:e,y:n,data:v0};const h=await a.getOffsetParent?.(i);let p={width:0,height:0};if(s==="fixed"&&c?.visualViewport)p={width:c.visualViewport.width,height:c.visualViewport.height};else if(h===c){const E=zs(i);p={width:E.documentElement.clientWidth,height:E.documentElement.clientHeight}}else await a.isElement?.(h)&&(p=await a.getDimensions(h));const y=Bi(o);let v=e,w=n;y==="left"&&(v=p.width-(e+r.width)),y==="top"&&(w=p.height-(n+r.height));const b=y==="left"?"right":v0.sideX,_=y==="top"?"bottom":v0.sideY;return{x:v,y:w,data:{sideX:b,sideY:_}}}};function pF(t,e,n){const r=t==="inline-start"||t==="inline-end";return{top:"top",right:r?n?"inline-start":"inline-end":"right",bottom:"bottom",left:r?n?"inline-end":"inline-start":"left"}[e]}function ZR(t,e,n){const{rects:r,placement:i}=t;return{side:pF(e,Bi(i),n),align:Ul(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function mF(t){const{anchor:e,positionMethod:n="absolute",side:r="bottom",sideOffset:i=0,align:a="center",alignOffset:s=0,collisionBoundary:o,collisionPadding:c=5,sticky:u=!1,arrowPadding:f=5,disableAnchorTracking:h=!1,keepMounted:p=!1,floatingRootContext:y,mounted:v,collisionAvoidance:w,shiftCrossAxis:b=!1,nodeId:_,adaptiveOrigin:E,lazyFlip:M=!1,externalTree:T}=t,[R,A]=x.useState(null);!v&&R!==null&&A(null);const P=w.side||"flip",k=w.align||"flip",N=w.fallbackAxisSide||"end",U=typeof e=="function"?e:void 0,L=jt(U),z=U?L:e,F=Fr(e),W=_ne()==="rtl",K=R||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":W?"left":"right","inline-start":W?"right":"left"}[r],Q=a==="center"?K:`${K}-${a}`;let O=c;const G=1,Y=r==="bottom"?G:0,H=r==="top"?G:0,te=r==="right"?G:0,re=r==="left"?G:0;typeof O=="number"?O={top:O+Y,right:O+re,bottom:O+H,left:O+te}:O&&(O={top:(O.top||0)+Y,right:(O.right||0)+re,bottom:(O.bottom||0)+H,left:(O.left||0)+te});const ue={boundary:o==="clipping-ancestors"?"clippingAncestors":o,padding:O},ce=x.useRef(null),ee=Fr(i),le=Fr(s),be=[ite(Ke=>{const gt=ZR(Ke,r,W),ne=typeof ee.current=="function"?ee.current(gt):ee.current,Be=typeof le.current=="function"?le.current(gt):le.current;return{mainAxis:ne,crossAxis:Be,alignmentAxis:Be}},[typeof i!="function"?i:0,typeof s!="function"?s:0,W,r])],Ye=k==="none"&&P!=="shift",he=!Ye&&(u||b||P==="shift"),Ue=P==="none"?null:ote({...ue,padding:{top:O.top+G,right:O.right+G,bottom:O.bottom+G,left:O.left+G},mainAxis:!b&&P==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:N}),je=Ye?null:ate(Ke=>{const gt=zs(Ke.elements.floating).documentElement;return{...ue,rootBoundary:b?{x:0,y:0,width:gt.clientWidth,height:gt.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:he,limiter:u||b?void 0:ste(ne=>{if(!ce.current)return{};const{width:Be,height:ke}=ce.current.getBoundingClientRect(),Ae=Ma(Bi(ne.placement)),Ve=Ae==="y"?Be:ke,ge=Ae==="y"?O.left+O.right:O.top+O.bottom;return{offset:Ve/2+ge/2}})}},[ue,u,b,O,k]);P==="shift"||k==="shift"||a==="center"?be.push(je,Ue):be.push(Ue,je),be.push(lte({...ue,apply({elements:{floating:Ke},rects:{reference:gt},availableWidth:ne,availableHeight:Be}){Object.entries({"--available-width":`${ne}px`,"--available-height":`${Be}px`,"--anchor-width":`${gt.width}px`,"--anchor-height":`${gt.height}px`}).forEach(([ke,Ae])=>{Ke.style.setProperty(ke,Ae)})}}),Sne(()=>({element:ce.current||document.createElement("div"),padding:f,offsetParent:"floating"}),[f]),{name:"transformOrigin",fn(Ke){const{elements:gt,middlewareData:ne,placement:Be,rects:ke,y:Ae}=Ke,Ve=Bi(Be),ge=Ma(Ve),ht=ce.current,bt=ne.arrow?.x||0,Kt=ne.arrow?.y||0,Bt=ht?.clientWidth||0,St=ht?.clientHeight||0,Rt=bt+Bt/2,hn=Kt+St/2,xn=Math.abs(ne.shift?.y||0),ie=ke.reference.height/2,fe=typeof i=="function"?i(ZR(Ke,r,W)):i,Te=xn>fe,$e={top:`${Rt}px calc(100% + ${fe}px)`,bottom:`${Rt}px ${-fe}px`,left:`calc(100% + ${fe}px) ${hn}px`,right:`${-fe}px ${hn}px`}[Ve],Ze=`${Rt}px ${ke.reference.y+ie-Ae}px`;return gt.floating.style.setProperty("--transform-origin",he&&ge==="y"&&Te?Ze:$e),{}}},kne,E),Yt(()=>{!v&&y&&y.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[v,y]);const et=x.useMemo(()=>({elementResize:!h&&typeof ResizeObserver<"u",layoutShift:!h&&typeof IntersectionObserver<"u"}),[h]),{refs:_e,elements:oe,x:J,y:ze,middlewareData:Ne,update:De,placement:Le,context:$,isPositioned:I,floatingStyles:Z}=vte({rootContext:y,placement:Q,middleware:be,strategy:n,whileElementsMounted:p?void 0:(...Ke)=>VR(...Ke,et),nodeId:_,externalTree:T}),{sideX:pe,sideY:Se}=Ne.adaptiveOrigin||v0,xe=I?n:"fixed",Ie=x.useMemo(()=>E?{position:xe,[pe]:J,[Se]:ze}:{position:xe,...Z},[E,xe,pe,J,Se,ze,Z]),He=x.useRef(null);Yt(()=>{if(!v)return;const Ke=F.current,gt=typeof Ke=="function"?Ke():Ke,Be=(JR(gt)?gt.current:gt)||null||null;Be!==He.current&&(_e.setPositionReference(Be),He.current=Be)},[v,_e,z,F]),x.useEffect(()=>{if(!v)return;const Ke=F.current;typeof Ke!="function"&&JR(Ke)&&Ke.current!==He.current&&(_e.setPositionReference(Ke.current),He.current=Ke.current)},[v,_e,z,F]),x.useEffect(()=>{if(p&&v&&oe.domReference&&oe.floating)return VR(oe.domReference,oe.floating,De,et)},[p,v,oe,De,et]);const qe=Bi(Le),ft=pF(r,qe,W),We=Ul(Le)||"center",Xe=!!Ne.hide?.referenceHidden;Yt(()=>{M&&v&&I&&A(qe)},[M,v,I,qe]);const nt=x.useMemo(()=>({position:"absolute",top:Ne.arrow?.y,left:Ne.arrow?.x}),[Ne.arrow]),ct=Ne.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Ie,arrowStyles:nt,arrowRef:ce,arrowUncentered:ct,side:ft,align:We,physicalSide:qe,anchorHidden:Xe,refs:_e,context:$,isPositioned:I,update:De}),[Ie,nt,ce,ct,ft,We,qe,Xe,_e,$,I,De])}function JR(t){return t!=null&&"current"in t}const gF=x.createContext(void 0);function Mne(){const t=x.useContext(gF);if(!t)throw new Error(Wi(59));return t}const RE=x.forwardRef(function(e,n){const{cutout:r,...i}=e;let a;if(r){const s=r?.getBoundingClientRect();a=`polygon(
|
|
789
789
|
0% 0%,
|
|
790
790
|
100% 0%,
|
|
791
791
|
100% 100%,
|