vibora 2.6.2 → 2.6.3
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.
|
@@ -23,7 +23,7 @@ Error generating stack: `+C.message+`
|
|
|
23
23
|
`:"",E=S&&!S.startsWith(`
|
|
24
24
|
`)?`
|
|
25
25
|
`:"",T=y+k+x+E+S;t(T)}else t(e+(e?`
|
|
26
|
-
`:"")+x)}catch(x){Qt.error("Failed to upload image"),Ct.kanban.error("Upload error",{error:String(x)})}finally{a(!1)}return}}};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs("div",{className:"relative",children:[w.jsx(mR,{ref:o,value:e,onChange:h=>t(h.target.value),onPaste:u,className:Ne(s&&"opacity-50",n),disabled:s||r,...i}),s&&w.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50 rounded-md",children:w.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})})]}),l.length>0&&w.jsx("div",{className:"flex flex-wrap gap-2",children:l.map((h,d)=>w.jsx("a",{href:HD(h),target:"_blank",rel:"noopener noreferrer",className:"block",children:w.jsx("img",{src:HD(h),alt:`Attachment ${d+1}`,className:"h-16 w-auto rounded border object-cover hover:opacity-80 transition-opacity"})},d))})]})}function uH({className:e,...t}){return w.jsx("label",{"data-slot":"label",className:Ne("gap-2 text-xs/relaxed leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed",e),...t})}const cse=O.forwardRef(function(t,n){const{className:r,render:i,orientation:s="horizontal",...a}=t,o=O.useMemo(()=>({orientation:s}),[s]);return ct("div",t,{state:o,ref:n,props:[{role:"separator","aria-orientation":s},a]})});function use({className:e,orientation:t="horizontal",...n}){return w.jsx(cse,{"data-slot":"separator",orientation:t,className:Ne("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",e),...n})}function Vm({className:e,...t}){return w.jsx("div",{"data-slot":"field-group",className:Ne("gap-4 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4 group/field-group @container/field-group flex w-full flex-col",e),...t})}const dse=Dl("data-[invalid=true]:text-destructive gap-2 group/field flex w-full",{variants:{orientation:{vertical:"flex-col [&>*]:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center [&>[data-slot=field-label]]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function yr({className:e,orientation:t="vertical",...n}){return w.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:Ne(dse({orientation:t}),e),...n})}function br({className:e,...t}){return w.jsx(uH,{"data-slot":"field-label",className:Ne("has-data-checked:bg-primary/5 dark:has-data-checked:bg-primary/10 gap-2 group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-2 group/field-label peer/field-label flex w-fit leading-snug","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...t})}function Vc({className:e,...t}){return w.jsx("p",{"data-slot":"field-description",className:Ne("text-muted-foreground text-left text-xs/relaxed [[data-variant=legend]+&]:-mt-1.5 leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance","last:mt-0 nth-last-2:-mt-1","[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",e),...t})}function dH(e){const t=O.useRef(!0);t.current&&(t.current=!1,e())}const fH=O.createContext(null),hH=O.createContext(null);function Lo(){const e=O.useContext(fH);if(e===null)throw new Error(qt(60));return e}function pH(){const e=O.useContext(hH);if(e===null)throw new Error(qt(61));return e}const mH=(e,t)=>Object.is(e,t);function Sa(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ac(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:Sa(r,t,n))}function Bd(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:Sa(r,t,n))}function gH(e,t,n){return e.filter(r=>!Sa(r,t,n))}function Lk(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function vH(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function pr(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Lk(e)}function Vs(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Lk(e.value):Lk(e)}function fse(e,t,n){if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??pr(e,n);if(Array.isArray(t)){const r=vH(t)?t.flatMap(i=>i.items):t;if(e==null){const i=r.find(s=>s.value==null);return i&&i.label!=null?i.label:pr(e,n)}if(typeof e!="object"){const i=r.find(s=>s&&s.value===e);return i&&i.label!=null?i.label:pr(e,n)}if("value"in e){const i=r.find(s=>s&&s.value===e.value);if(i&&i.label!=null)return i.label}}return pr(e,n)}function hse(e,t){return!Array.isArray(e)||e.length===0?"":e.map(n=>pr(n,t)).join(", ")}const xt={id:Te(e=>e.id),modal:Te(e=>e.modal),multiple:Te(e=>e.multiple),items:Te(e=>e.items),itemToStringLabel:Te(e=>e.itemToStringLabel),itemToStringValue:Te(e=>e.itemToStringValue),isItemEqualToValue:Te(e=>e.isItemEqualToValue),value:Te(e=>e.value),open:Te(e=>e.open),mounted:Te(e=>e.mounted),forceMount:Te(e=>e.forceMount),transitionStatus:Te(e=>e.transitionStatus),openMethod:Te(e=>e.openMethod),activeIndex:Te(e=>e.activeIndex),selectedIndex:Te(e=>e.selectedIndex),isActive:Te((e,t)=>e.activeIndex===t),isSelected:Te((e,t,n)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(s=>Sa(s,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Sa(i,n,r)}),isSelectedByFocus:Te((e,t)=>e.selectedIndex===t),popupProps:Te(e=>e.popupProps),triggerProps:Te(e=>e.triggerProps),triggerElement:Te(e=>e.triggerElement),positionerElement:Te(e=>e.positionerElement),listElement:Te(e=>e.listElement),scrollUpArrowVisible:Te(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Te(e=>e.scrollDownArrowVisible),hasScrollArrows:Te(e=>e.hasScrollArrows),serializedValue:Te(e=>{const{multiple:t,value:n,itemToStringValue:r}=e;return t&&Array.isArray(n)&&n.length===0?"":Vs(n,r)})};function Pc(e,t){const n=O.useRef(e),r=Ie(t);ze(()=>{n.current!==e&&r(n.current)},[e,r]),ze(()=>{n.current=e},[e])}function pse(e){const{id:t,value:n,defaultValue:r=null,onValueChange:i,open:s,defaultOpen:a=!1,onOpenChange:o,name:l,disabled:u=!1,readOnly:h=!1,required:d=!1,modal:p=!0,actionsRef:v,inputRef:x,onOpenChangeComplete:b,items:g,multiple:_=!1,itemToStringLabel:y,itemToStringValue:S,isItemEqualToValue:k=mH,highlightItemOnHover:E=!0,children:T}=e,{clearErrors:A}=Fm(),{setDirty:R,shouldValidateOnChange:M,validityData:B,setFilled:D,name:z,disabled:I,validation:W}=Ms(),{controlId:U}=Fl(),H=W0({id:t}),V=I||u,q=z??l,[N,G]=Qi({controlled:n,default:_?r??ci:r,name:"Select",state:"value"}),[L,$]=Qi({controlled:s,default:a,name:"Select",state:"open"}),F=O.useRef([]),Q=O.useRef([]),ee=O.useRef(null),ie=O.useRef(null),X=O.useRef(0),K=O.useRef(null),J=O.useRef([]),ne=O.useRef(!1),re=O.useRef(!1),Z=O.useRef(null),ae=O.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ue=O.useRef(!1),{mounted:fe,setMounted:he,transitionStatus:le}=eo(L),{openMethod:Le,triggerProps:ke,reset:Be}=U0(L),_e=zr(()=>new Uc({id:H,modal:p,multiple:_,itemToStringLabel:y,itemToStringValue:S,isItemEqualToValue:k,value:N,open:L,mounted:fe,transitionStatus:le,items:g,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Re=De(_e,xt.activeIndex),ge=De(_e,xt.selectedIndex),Se=De(_e,xt.triggerElement),we=De(_e,xt.positionerElement),We=O.useMemo(()=>_&&Array.isArray(N)&&N.length===0?"":Vs(N,S),[_,N,S]),it=O.useMemo(()=>_&&Array.isArray(N)?N.map(ht=>Vs(ht,S)):Vs(N,S),[_,N,S]),Ae=Rn(_e.state.triggerElement);Um({id:H,commit:W.commit,value:N,controlRef:Ae,name:q,getValue:()=>it});const Ve=O.useRef(N);ze(()=>{N!==Ve.current&&_e.set("forceMount",!0)},[_e,N]),ze(()=>{D(N!==null)},[N,D]),ze(function(){if(L)return;const jt=J.current;if(_){const Ot=Array.isArray(N)?N:[];if(Ot.length===0){_e.set("selectedIndex",null);return}const tt=Ot[Ot.length-1],Yt=Bd(jt,tt,k);_e.set("selectedIndex",Yt===-1?null:Yt);return}const Tt=Bd(jt,N,k);_e.set("selectedIndex",Tt===-1?null:Tt)},[_,L,N,J,k,_e]),Pc(N,()=>{A(q),R(N!==B.initialValue),M()?W.commit(N):W.commit(N,!0)});const qe=Ie((ht,jt)=>{if(o?.(ht,jt),!jt.isCanceled&&($(ht),!ht&&_e.state.activeIndex!==null)){const Tt=F.current[_e.state.activeIndex];queueMicrotask(()=>{Tt?.setAttribute("tabindex","-1")})}}),mt=Ie(()=>{he(!1),_e.set("activeIndex",null),Be(),b?.(!1)});Jr({enabled:!v,open:L,ref:ee,onComplete(){L||mt()}}),O.useImperativeHandle(v,()=>({unmount:mt}),[mt]);const Ge=Ie((ht,jt)=>{i?.(ht,jt),!jt.isCanceled&&G(ht)}),Xe=Ie(()=>{const ht=_e.state.listElement||ee.current;if(!ht)return;const jt=ht.scrollTop,Tt=ht.scrollTop+ht.clientHeight,Ot=jt>1,tt=Tt<ht.scrollHeight-1;_e.state.scrollUpArrowVisible!==Ot&&_e.set("scrollUpArrowVisible",Ot),_e.state.scrollDownArrowVisible!==tt&&_e.set("scrollDownArrowVisible",tt)}),Oe=M0({open:L,onOpenChange:qe,elements:{reference:Se,floating:we}}),st=Sf(Oe,{enabled:!h&&!V,event:"mousedown"}),ut=Dm(Oe,{bubbles:!1}),Ze=rR(Oe,{enabled:!h&&!V,listRef:F,activeIndex:Re,selectedIndex:ge,disabledIndices:ci,onNavigate(ht){ht===null&&!L||_e.set("activeIndex",ht)},focusItemOnHover:!1}),at=iR(Oe,{enabled:!h&&!V&&(L||!_),listRef:Q,activeIndex:Re,selectedIndex:ge,onMatch(ht){L?_e.set("activeIndex",ht):Ge(J.current[ht],Ue("none"))},onTypingChange(ht){ne.current=ht}}),{getReferenceProps:It,getFloatingProps:ft,getItemProps:_n}=du([st,ut,Ze,at]),Mt=O.useMemo(()=>Ro(It(),ke),[It,ke]);dH(()=>{_e.update({popupProps:ft(),triggerProps:Mt})}),ze(()=>{_e.update({id:H,modal:p,multiple:_,value:N,open:L,mounted:fe,transitionStatus:le,popupProps:ft(),triggerProps:Mt,items:g,itemToStringLabel:y,itemToStringValue:S,isItemEqualToValue:k,openMethod:Le})},[_e,H,p,_,N,L,fe,le,ft,Mt,g,y,S,k,Le]);const Et=O.useMemo(()=>({store:_e,name:q,required:d,disabled:V,readOnly:h,multiple:_,itemToStringLabel:y,itemToStringValue:S,highlightItemOnHover:E,setValue:Ge,setOpen:qe,listRef:F,popupRef:ee,scrollHandlerRef:ie,handleScrollArrowVisibility:Xe,scrollArrowsMountedCountRef:X,getItemProps:_n,events:Oe.context.events,valueRef:K,valuesRef:J,labelsRef:Q,typingRef:ne,selectionRef:ae,selectedItemTextRef:Z,validation:W,onOpenChangeComplete:b,keyboardActiveRef:re,alignItemWithTriggerActiveRef:ue,initialValueRef:Ve}),[_e,q,d,V,h,_,y,S,E,Ge,qe,_n,Oe.context.events,W,b,Xe]),et=As(x,W.inputRef),zt=_&&Array.isArray(N)&&N.length>0,Kt=O.useMemo(()=>!_||!Array.isArray(N)||!q?null:N.map(ht=>{const jt=Vs(ht,S);return w.jsx("input",{type:"hidden",name:q,value:jt},jt)}),[_,N,q,S]);return w.jsx(fH.Provider,{value:Et,children:w.jsxs(hH.Provider,{value:Oe,children:[T,w.jsx("input",{...W.getInputValidationProps({onFocus(){_e.state.triggerElement?.focus()},onChange(ht){if(ht.nativeEvent.defaultPrevented)return;const jt=ht.target.value,Tt=Ue(gr,ht.nativeEvent);function Ot(){if(_)return;const tt=J.current.find(Yt=>Vs(Yt,S).toLowerCase()===jt.toLowerCase());tt!=null&&(R(tt!==B.initialValue),Ge(tt,Tt),M()&&W.commit(tt))}_e.set("forceMount",!0),queueMicrotask(Ot)}}),id:t||U||void 0,name:_?void 0:q,value:We,disabled:V,required:d&&!zt,readOnly:h,ref:et,style:xf,tabIndex:-1,"aria-hidden":!0}),Kt]})})}function gR(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||r.content!=="none"))return t;const s=parseFloat(n.width)||0,a=parseFloat(n.height)||0,o=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=Math.max(t.width,s,o),h=Math.max(t.height,a,l),d=u-t.width,p=h-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const zv=2,mse={...Nd,...mu,value:()=>null},gse=O.forwardRef(function(t,n){const{render:r,className:i,disabled:s=!1,nativeButton:a=!0,...o}=t,{setTouched:l,setFocused:u,validationMode:h,state:d,disabled:p}=Ms(),{labelId:v}=Fl(),{store:x,setOpen:b,selectionRef:g,validation:_,readOnly:y,alignItemWithTriggerActiveRef:S,disabled:k,keyboardActiveRef:E}=Lo(),T=p||k||s,A=De(x,xt.open),R=De(x,xt.value),M=De(x,xt.triggerProps),B=De(x,xt.positionerElement),D=De(x,xt.listElement),z=De(x,xt.serializedValue),I=Rn(B),W=O.useRef(null),U=fn(),H=fn(),{getButtonProps:V,buttonRef:q}=fi({disabled:T,native:a}),N=Ie(ie=>{x.set("triggerElement",ie)}),G=As(n,W,q,N),L=fn(),$=fn();O.useEffect(()=>{if(A)return $.start(200,()=>{g.current.allowUnselectedMouseUp=!0,L.start(200,()=>{g.current.allowSelectedMouseUp=!0})}),()=>{L.clear(),$.clear()};g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},H.clear()},[A,g,H,L,$]);const F=O.useMemo(()=>D?.id??Pp(B)?.id,[D,B]),Q=Ro(M,{role:"combobox","aria-expanded":A?"true":"false","aria-haspopup":"listbox","aria-controls":A?F:void 0,"aria-labelledby":v,"aria-readonly":y||void 0,tabIndex:T?-1:0,ref:G,onFocus(ie){u(!0),A&&S.current&&b(!1,Ue(Xs,ie.nativeEvent)),U.start(0,()=>{x.set("forceMount",!0)})},onBlur(){l(!0),u(!1),h==="onBlur"&&_.commit(R)},onPointerMove(){E.current=!1},onKeyDown(){E.current=!0},onMouseDown(ie){if(A)return;const X=Hr(ie.currentTarget);function K(J){if(!W.current)return;const ne=J.target;if(lt(W.current,ne)||lt(I.current,ne)||ne===W.current)return;const re=gR(W.current);J.clientX>=re.left-zv&&J.clientX<=re.right+zv&&J.clientY>=re.top-zv&&J.clientY<=re.bottom+zv||b(!1,Ue(tz,J))}H.start(0,()=>{X.addEventListener("mouseup",K,{once:!0})})}},_.getValidationProps,o,V);Q.role="combobox";const ee=O.useMemo(()=>({...d,open:A,disabled:T,value:R,readOnly:y,placeholder:!z}),[d,A,T,R,y,z]);return ct("button",t,{ref:[n,W],state:ee,stateAttributesMapping:mse,props:Q})}),vse={value:()=>null},yse=O.forwardRef(function(t,n){const{className:r,render:i,children:s,...a}=t,{store:o,valueRef:l}=Lo(),u=De(o,xt.value),h=De(o,xt.items),d=De(o,xt.itemToStringLabel),p=De(o,xt.serializedValue),v=O.useMemo(()=>({value:u,placeholder:!p}),[u,p]),x=typeof s=="function"?s(u):s??(Array.isArray(u)?hse(u,d):fse(u,h,d));return ct("span",t,{state:v,ref:[n,l],props:[{children:x},a],stateAttributesMapping:vse})}),bse=O.forwardRef(function(t,n){const{className:r,render:i,...s}=t,{store:a}=Lo(),o=De(a,xt.open),l=O.useMemo(()=>({open:o}),[o]);return ct("span",t,{state:l,ref:n,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:oR})}),_se=O.createContext(void 0),xse=O.forwardRef(function(t,n){const{store:r}=Lo(),i=De(r,xt.mounted),s=De(r,xt.forceMount);return i||s?w.jsx(_se.Provider,{value:!0,children:w.jsx(Lm,{ref:n,...t})}):null}),yH=O.createContext(void 0);function vR(){const e=O.useContext(yH);if(!e)throw new Error(qt(59));return e}function Zy(e,t){e&&Object.assign(e.style,t)}const bH={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Sse={position:"fixed"},wse=O.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:s,render:a,side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:v=5,sticky:x=!1,disableAnchorTracking:b,alignItemWithTrigger:g=!0,collisionAvoidance:_=C0,...y}=t,{store:S,listRef:k,labelsRef:E,alignItemWithTriggerActiveRef:T,selectedItemTextRef:A,valuesRef:R,initialValueRef:M,popupRef:B,setValue:D}=Lo(),z=pH(),I=De(S,xt.open),W=De(S,xt.mounted),U=De(S,xt.modal),H=De(S,xt.value),V=De(S,xt.openMethod),q=De(S,xt.positionerElement),N=De(S,xt.triggerElement),G=De(S,xt.isItemEqualToValue),L=O.useRef(null),$=O.useRef(null),[F,Q]=O.useState(g),ee=W&&F&&V!=="touch";!W&&F!==g&&Q(g),ze(()=>{W||(xt.scrollUpArrowVisible(S.state)&&S.set("scrollUpArrowVisible",!1),xt.scrollDownArrowVisible(S.state)&&S.set("scrollDownArrowVisible",!1))},[S,W]),O.useImperativeHandle(T,()=>ee),F0((ee||U)&&I&&V!=="touch",N);const ie=N0({anchor:r,floatingRootContext:z,positionMethod:i,mounted:W,side:o,sideOffset:u,align:l,alignOffset:h,arrowPadding:v,collisionBoundary:d,collisionPadding:p,sticky:x,disableAnchorTracking:b??ee,collisionAvoidance:_,keepMounted:!0}),X=ee?"none":ie.side,K=ee?Sse:ie.positionerStyles,J=O.useMemo(()=>{const he={};return I||(he.pointerEvents="none"),{role:"presentation",hidden:!W,style:{...K,...he}}},[I,W,K]),ne=O.useMemo(()=>({open:I,side:X,align:ie.align,anchorHidden:ie.anchorHidden}),[I,X,ie.align,ie.anchorHidden]),re=Ie(he=>{S.set("positionerElement",he)}),Z=ct("div",t,{ref:[n,re],state:ne,stateAttributesMapping:to,props:[J,y]}),ae=O.useRef(0),ue=Ie(he=>{if(he.size===0&&ae.current===0||R.current.length===0)return;const le=ae.current;if(ae.current=he.size,he.size===le)return;const Le=Ue(gr);if(le!==0&&!S.state.multiple&&H!==null&&Bd(R.current,H,G)===-1){const Be=M.current,Re=Be!=null&&Ac(R.current,Be,G)?Be:null;D(Re,Le),Re===null&&(S.set("selectedIndex",null),A.current=null)}if(le!==0&&S.state.multiple&&Array.isArray(H)){const ke=H.filter(Be=>Ac(R.current,Be,G));(ke.length!==H.length||ke.some(Be=>!Ac(H,Be,G)))&&(D(ke,Le),ke.length===0&&(S.set("selectedIndex",null),A.current=null))}if(I&&ee){S.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ke={height:""};Zy(q,ke),Zy(B.current,ke)}}),fe=O.useMemo(()=>({...ie,side:X,alignItemWithTriggerActive:ee,setControlledAlignItemWithTrigger:Q,scrollUpArrowRef:L,scrollDownArrowRef:$}),[ie,X,ee,Q]);return w.jsx(Im,{elementsRef:k,labelsRef:E,onMapChange:ue,children:w.jsxs(yH.Provider,{value:fe,children:[W&&U&&w.jsx(H0,{inert:wf(!I),cutout:N}),Z]})})});function _H(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const Hv="base-ui-disable-scrollbar",Dp={className:Hv,element:w.jsx("style",{href:Hv,precedence:"base-ui:low",children:`.${Hv}{scrollbar-width:none}.${Hv}::-webkit-scrollbar{display:none}`})},Cse=O.createContext(void 0);function yR(e){return O.useContext(Cse)}const Ese={...to,...Ls},kse=O.forwardRef(function(t,n){const{render:r,className:i,...s}=t,{store:a,popupRef:o,onOpenChangeComplete:l,setOpen:u,valueRef:h,selectedItemTextRef:d,keyboardActiveRef:p,multiple:v,handleScrollArrowVisibility:x,scrollHandlerRef:b}=Lo(),{side:g,align:_,alignItemWithTriggerActive:y,setControlledAlignItemWithTrigger:S,scrollDownArrowRef:k,scrollUpArrowRef:E}=vR(),T=yR()!=null,A=pH(),R=fn(),M=De(a,xt.id),B=De(a,xt.open),D=De(a,xt.mounted),z=De(a,xt.popupProps),I=De(a,xt.transitionStatus),W=De(a,xt.triggerElement),U=De(a,xt.positionerElement),H=De(a,xt.listElement),V=O.useRef(0),q=O.useRef(!1),N=O.useRef(0),G=O.useRef(!1),L=O.useRef({}),$=Tl(),F=Ie(X=>{if(!U||!o.current||!G.current)return;if(q.current||!y){x();return}const K=U.style.top==="0px",J=U.style.bottom==="0px",ne=U.getBoundingClientRect().height,re=Hr(U),Z=getComputedStyle(U),ae=parseFloat(Z.marginTop),ue=parseFloat(Z.marginBottom),fe=re.documentElement.clientHeight-ae-ue,he=X.scrollTop,le=X.scrollHeight,Le=X.clientHeight,ke=le-Le;let Be=null,_e=null,Re=!1;if(K){const ge=ke-he,Se=ne+ge,we=Math.min(Se,fe);Be=we,we!==fe?_e=ke:Re=!0}else if(J){const ge=he-0,Se=ne+ge,we=Math.min(Se,fe),We=Se-fe;Be=we,we!==fe?_e=0:(Re=!0,he<ke&&(_e=he-(ge-We)))}Be!=null&&(U.style.height=`${Be}px`),_e!=null&&(X.scrollTop=_e),Re&&(q.current=!0),x()});O.useImperativeHandle(b,()=>F,[F]),Jr({open:B,ref:o,onComplete(){B&&l?.(!0)}});const Q=O.useMemo(()=>({open:B,transitionStatus:I,side:g,align:_}),[B,I,g,_]);ze(()=>{!U||!o.current||Object.keys(L.current).length||(L.current={top:U.style.top||"0",left:U.style.left||"0",right:U.style.right,height:U.style.height,bottom:U.style.bottom,minHeight:U.style.minHeight,maxHeight:U.style.maxHeight,marginTop:U.style.marginTop,marginBottom:U.style.marginBottom})},[o,U]),ze(()=>{D||y||(G.current=!1,q.current=!1,V.current=0,N.current=0,Zy(U,L.current))},[D,y,U,o]),ze(()=>{const X=o.current;if(!(!D||!W||!U||!X)){if(!y){G.current=!0,$.request(x);return}queueMicrotask(()=>{const K=getComputedStyle(U),J=getComputedStyle(X),ne=Hr(W),re=Yn(U),Z=W.getBoundingClientRect(),ae=U.getBoundingClientRect(),ue=Z.left,fe=Z.height,he=H||X,le=he.scrollHeight,Le=parseFloat(J.borderBottomWidth),ke=parseFloat(K.marginTop)||10,Be=parseFloat(K.marginBottom)||10,_e=parseFloat(K.minHeight)||100,Re=5,ge=5,Se=20,we=ne.documentElement.clientHeight-ke-Be,We=ne.documentElement.clientWidth,it=we-Z.bottom+fe,Ae=d.current,Ve=h.current;let qe=0,mt=0;if(Ae&&Ve){const Et=Ve.getBoundingClientRect(),et=Ae.getBoundingClientRect(),zt=Et.left-ue,Kt=et.left-ae.left,ht=Et.top-Z.top+Et.height/2,jt=et.top-ae.top+et.height/2;qe=zt-Kt,mt=jt-ht}const Ge=it+mt+Be+Le;let Xe=Math.min(we,Ge);const Oe=we-ke-Be,st=Ge-Xe,ut=Math.max(Re,ue+qe),Ze=We-ge,at=Math.max(0,ut+ae.width-Ze);U.style.left=`${ut-at}px`,U.style.height=`${Xe}px`,U.style.maxHeight="auto",U.style.marginTop=`${ke}px`,U.style.marginBottom=`${Be}px`,X.style.height="100%";const It=he.scrollHeight-he.clientHeight,ft=st>=It;ft&&(Xe=Math.min(we,ae.height)-(st-It));const _n=Z.top<Se||Z.bottom>we-Se||Xe<Math.min(le,_e),Mt=(re.visualViewport?.scale??1)!==1&&UO;if(_n||Mt){G.current=!0,Zy(U,L.current),cr.flushSync(()=>S(!1));return}if(ft){const Et=Math.max(0,we-Ge);U.style.top=ae.height>=Oe?"0":`${Et}px`,U.style.height=`${Xe}px`,he.scrollTop=he.scrollHeight-he.clientHeight,V.current=Math.max(_e,Xe)}else U.style.bottom="0",V.current=Math.max(_e,Xe),he.scrollTop=st;V.current===we&&(q.current=!0),x(),setTimeout(()=>{G.current=!0})})}},[a,D,U,W,h,d,o,x,y,S,$,k,E,H]),O.useEffect(()=>{if(!y||!U||!D)return;const X=Yn(U);function K(J){u(!1,Ue(rte,J))}return X.addEventListener("resize",K),()=>{X.removeEventListener("resize",K)}},[u,y,U,D]);const ee={...H?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":v||void 0,id:`${M}-list`},onKeyDown(X){p.current=!0,T&&sR.has(X.key)&&X.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(X){if(_H(X)||X.pointerType==="touch")return;const K=X.currentTarget;R.start(0,()=>{a.set("activeIndex",null),K.focus({preventScroll:!0})})},onScroll(X){H||b.current?.(X.currentTarget)},...y&&{style:H?{height:"100%"}:bH}},ie=ct("div",t,{ref:[n,o],state:Q,stateAttributesMapping:Ese,props:[z,ee,B0(I),{className:!H&&y?Dp.className:void 0},s]});return w.jsxs(O.Fragment,{children:[Dp.element,w.jsx(O0,{context:A,modal:!1,disabled:!D,restoreFocus:!0,children:ie})]})}),Tse=O.forwardRef(function(t,n){const{className:r,render:i,...s}=t,{store:a,scrollHandlerRef:o}=Lo(),{alignItemWithTriggerActive:l}=vR(),u=De(a,xt.hasScrollArrows),h=De(a,xt.openMethod),d=De(a,xt.multiple),v={id:`${De(a,xt.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(b){o.current?.(b.currentTarget)},...l&&{style:bH},className:u&&h!=="touch"?Dp.className:void 0},x=Ie(b=>{a.set("listElement",b)});return ct("div",t,{ref:[n,x],props:[v,s]})}),xH=O.createContext(void 0);function bR(){const e=O.useContext(xH);if(!e)throw new Error(qt(57));return e}const Ose=O.memo(O.forwardRef(function(t,n){const{render:r,className:i,value:s=null,label:a,disabled:o=!1,nativeButton:l=!1,...u}=t,h=O.useRef(null),d=Cf({label:a,textRef:h,indexGuessBehavior:aR.GuessFromOrder}),{store:p,getItemProps:v,setOpen:x,setValue:b,selectionRef:g,typingRef:_,valuesRef:y,keyboardActiveRef:S,multiple:k,highlightItemOnHover:E}=Lo(),T=fn(),A=De(p,xt.isActive,d.index),R=De(p,xt.isSelected,d.index,s),M=De(p,xt.isSelectedByFocus,d.index),B=De(p,xt.isItemEqualToValue),D=d.index,z=D!==-1,I=O.useRef(null),W=Rn(D);ze(()=>{if(!z)return;const ie=y.current;return ie[D]=s,()=>{delete ie[D]}},[z,D,s,y]),ze(()=>{if(!z)return;const ie=p.state.value;let X=ie;k&&Array.isArray(ie)&&ie.length>0&&(X=ie[ie.length-1]),X!==void 0&&Sa(X,s,B)&&p.set("selectedIndex",D)},[z,D,k,B,p,s]);const U=O.useMemo(()=>({disabled:o,selected:R,highlighted:A}),[o,R,A]),H=v({active:A,selected:R});H.onFocus=void 0,H.id=void 0;const V=O.useRef(null),q=O.useRef("mouse"),N=O.useRef(!1),{getButtonProps:G,buttonRef:L}=fi({disabled:o,focusableWhenDisabled:!0,native:l});function $(ie){const X=p.state.value;if(k){const K=Array.isArray(X)?X:[],J=R?gH(K,s,B):[...K,s];b(J,Ue(Fc,ie))}else b(s,Ue(Fc,ie)),x(!1,Ue(Fc,ie))}const F={role:"option","aria-selected":R,"aria-disabled":o||void 0,tabIndex:A?0:-1,onFocus(){p.set("activeIndex",D)},onMouseEnter(){!S.current&&p.state.selectedIndex===null&&p.set("activeIndex",D)},onMouseMove(){E&&p.set("activeIndex",D)},onMouseLeave(ie){!E||S.current||_H(ie)||T.start(0,()=>{p.state.activeIndex===D&&p.set("activeIndex",null)})},onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(ie){V.current=ie.key,p.set("activeIndex",D)},onClick(ie){N.current=!1,!(ie.type==="keydown"&&V.current===null)&&(o||V.current===" "&&_.current||q.current!=="touch"&&!A||(V.current=null,$(ie.nativeEvent)))},onPointerEnter(ie){q.current=ie.pointerType},onPointerDown(ie){q.current=ie.pointerType,N.current=!0},onMouseUp(ie){if(o)return;if(N.current){N.current=!1;return}const X=!g.current.allowSelectedMouseUp&&R,K=!g.current.allowUnselectedMouseUp&&!R;X||K||q.current!=="touch"&&!A||$(ie.nativeEvent)}},Q=ct("div",t,{ref:[L,n,d.ref,I],state:U,props:[H,F,u,G]}),ee=O.useMemo(()=>({selected:R,indexRef:W,textRef:h,selectedByFocus:M,hasRegistered:z}),[R,W,h,M,z]);return w.jsx(xH.Provider,{value:ee,children:Q})})),Rse=O.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=bR();return r||i?w.jsx(Ase,{...t,ref:n}):null}),Ase=O.memo(O.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...s}=e,{selected:a}=bR(),o=O.useRef(null),{transitionStatus:l,setMounted:u}=eo(a),h=O.useMemo(()=>({selected:a,transitionStatus:l}),[a,l]),d=ct("span",e,{ref:[t,o],state:h,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:Ls});return Jr({open:a,ref:o,onComplete(){a||u(!1)}}),d})),Pse=O.memo(O.forwardRef(function(t,n){const{indexRef:r,textRef:i,selectedByFocus:s,hasRegistered:a}=bR(),{selectedItemTextRef:o}=Lo(),{className:l,render:u,...h}=t,d=O.useCallback(v=>{if(!v||!a)return;const x=o.current===null||!o.current.isConnected;(s||x&&r.current===0)&&(o.current=v)},[o,r,s,a]);return ct("div",t,{ref:[d,n,i],props:h})})),SH=O.forwardRef(function(t,n){const{render:r,className:i,direction:s,keepMounted:a=!1,...o}=t,{store:l,popupRef:u,listRef:h,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:p}=Lo(),{side:v,scrollDownArrowRef:x,scrollUpArrowRef:b}=vR(),g=s==="up"?xt.scrollUpArrowVisible:xt.scrollDownArrowVisible,_=De(l,g),y=De(l,xt.openMethod),S=_&&y!=="touch",k=fn(),E=s==="up"?b:x,{transitionStatus:T,setMounted:A}=eo(S);ze(()=>(p.current+=1,l.state.hasScrollArrows||l.set("hasScrollArrows",!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set("hasScrollArrows",!1)}),[l,p]),Jr({open:S,ref:E,onComplete(){S||A(!1)}});const R=O.useMemo(()=>({direction:s,visible:S,side:v,transitionStatus:T}),[s,S,v,T]),B=ct("div",t,{ref:[n,E],state:R,props:[{"aria-hidden":!0,children:s==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(z){if(z.movementX===0&&z.movementY===0||k.isStarted())return;l.set("activeIndex",null);function I(){const W=l.state.listElement??u.current;if(!W)return;l.set("activeIndex",null),d();const U=W.scrollTop===0,H=Math.round(W.scrollTop+W.clientHeight)>=W.scrollHeight;if(h.current.length===0&&(s==="up"?l.set("scrollUpArrowVisible",!U):l.set("scrollDownArrowVisible",!H)),s==="up"&&U||s==="down"&&H){k.clear();return}if((l.state.listElement||u.current)&&h.current&&h.current.length>0){const q=h.current,N=E.current?.offsetHeight||0;if(s==="up"){let G=0;const L=W.scrollTop+N;for(let F=0;F<q.length;F+=1){const Q=q[F];if(Q&&Q.offsetTop>=L){G=F;break}}const $=Math.max(0,G-1);if($<G){const F=q[$];F&&(W.scrollTop=Math.max(0,F.offsetTop-N))}else W.scrollTop=0}else{let G=q.length-1;const L=W.scrollTop+W.clientHeight-N;for(let F=0;F<q.length;F+=1){const Q=q[F];if(Q&&Q.offsetTop+Q.offsetHeight>L){G=Math.max(0,F-1);break}}const $=Math.min(q.length-1,G+1);if($>G){const F=q[$];F&&(W.scrollTop=F.offsetTop+F.offsetHeight-W.clientHeight+N)}else W.scrollTop=W.scrollHeight-W.clientHeight}}k.start(40,I)}k.start(40,I)},onMouseLeave(){k.clear()}},o]});return S||a?B:null}),Mse=O.forwardRef(function(t,n){return w.jsx(SH,{...t,ref:n,direction:"down"})}),jse=O.forwardRef(function(t,n){return w.jsx(SH,{...t,ref:n,direction:"up"})}),qi=pse;function Gi({className:e,...t}){return w.jsx(yse,{"data-slot":"select-value",className:Ne("flex flex-1 text-left",e),...t})}function Ki({className:e,size:t="default",children:n,...r}){return w.jsxs(gse,{"data-slot":"select-trigger","data-size":t,className:Ne("border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r,children:[n,w.jsx(bse,{render:w.jsx(me,{icon:Xz,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})})]})}function Yi({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:s=0,alignItemWithTrigger:a=!0,...o}){return w.jsx(xse,{children:w.jsx(wse,{side:n,sideOffset:r,align:i,alignOffset:s,alignItemWithTrigger:a,className:"isolate z-50",children:w.jsxs(kse,{"data-slot":"select-content",className:Ne("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 rounded-lg shadow-md ring-1 duration-100 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto",e),...o,children:[w.jsx(Lse,{}),w.jsx(Tse,{children:t}),w.jsx(Dse,{})]})})})}function dn({className:e,children:t,...n}){return w.jsxs(Ose,{"data-slot":"select-item",className:Ne("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[w.jsx(Pse,{className:"flex flex-1 gap-2 shrink-0 whitespace-nowrap",children:t}),w.jsx(Rse,{render:w.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:w.jsx(me,{icon:fu,strokeWidth:2,className:"pointer-events-none"})})]})}function Lse({className:e,...t}){return w.jsx(jse,{"data-slot":"select-scroll-up-button",className:Ne("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 top-0 w-full",e),...t,children:w.jsx(me,{icon:cR,strokeWidth:2})})}function Dse({className:e,...t}){return w.jsx(Mse,{"data-slot":"select-scroll-down-button",className:Ne("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 bottom-0 w-full",e),...t,children:w.jsx(me,{icon:$m,strokeWidth:2})})}const wH=O.createContext(void 0);function _R(){const e=O.useContext(wH);if(e===void 0)throw new Error(qt(64));return e}let Ise=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const xR={tabActivationDirection:e=>({[Ise.activationDirection]:e})},Nse=O.forwardRef(function(t,n){const{className:r,defaultValue:i=0,onValueChange:s,orientation:a="horizontal",render:o,value:l,...u}=t,h=Bl(),d=Object.hasOwn(t,"defaultValue"),p=O.useRef([]),[v,x]=O.useState(()=>new Map),[b,g]=Qi({controlled:l,default:i,name:"Tabs",state:"value"}),_=l!==void 0,[y,S]=O.useState(()=>new Map),[k,E]=O.useState("none"),T=Ie((V,q)=>{s?.(V,q),!q.isCanceled&&(g(V),E(q.activationDirection))}),A=Ie((V,q)=>{x(N=>{if(N.get(V)===q)return N;const G=new Map(N);return G.set(V,q),G})}),R=Ie((V,q)=>{x(N=>{if(!N.has(V)||N.get(V)!==q)return N;const G=new Map(N);return G.delete(V),G})}),M=O.useCallback(V=>v.get(V),[v]),B=O.useCallback(V=>{for(const q of y.values())if(V===q?.value)return q?.id},[y]),D=O.useCallback(V=>{if(V===void 0)return null;for(const[q,N]of y.entries())if(N!=null&&V===(N.value??N.index))return q;return null},[y]),z=O.useMemo(()=>({direction:h,getTabElementBySelectedValue:D,getTabIdByPanelValue:B,getTabPanelIdByValue:M,onValueChange:T,orientation:a,registerMountedTabPanel:A,setTabMap:S,unregisterMountedTabPanel:R,tabActivationDirection:k,value:b}),[h,D,B,M,T,a,A,S,R,k,b]),I=O.useMemo(()=>{for(const V of y.values())if(V!=null&&V.value===b)return V},[y,b]),W=O.useMemo(()=>{for(const V of y.values())if(V!=null&&!V.disabled)return V.value},[y]);ze(()=>{if(_||y.size===0)return;const V=I?.disabled,q=I==null&&b!==null;if(d&&V&&b===i||!V&&!q)return;const G=W??null;b!==G&&(g(G),E("none"))},[i,W,d,_,I,E,g,y,b]);const H=ct("div",t,{state:{orientation:a,tabActivationDirection:k},ref:n,props:u,stateAttributesMapping:xR});return w.jsx(wH.Provider,{value:z,children:w.jsx(Im,{elementsRef:p,children:H})})}),CH=O.createContext(void 0);function Bse(){const e=O.useContext(CH);if(e===void 0)throw new Error(qt(65));return e}const $se=O.forwardRef(function(t,n){const{className:r,disabled:i=!1,render:s,value:a,id:o,nativeButton:l=!0,...u}=t,{value:h,getTabPanelIdByValue:d,orientation:p}=_R(),{activateOnFocus:v,highlightedTabIndex:x,onTabActivation:b,setHighlightedTabIndex:g,tabsListElement:_}=Bse(),y=Fr(o),S=O.useMemo(()=>({disabled:i,id:y,value:a}),[i,y,a]),{compositeProps:k,compositeRef:E,index:T}=Nz({metadata:S}),A=a===h,R=O.useRef(!1);ze(()=>{if(R.current){R.current=!1;return}if(!(A&&T>-1&&x!==T))return;const N=_;if(N!=null){const G=_s(Hr(N));if(G&<(N,G))return}i||g(T)},[A,T,x,g,i,_]);const{getButtonProps:M,buttonRef:B}=fi({disabled:i,native:l,focusableWhenDisabled:!0}),D=d(a),z=O.useRef(!1),I=O.useRef(!1);function W(N){A||i||b(a,Ue(gr,N.nativeEvent,void 0,{activationDirection:"none"}))}function U(N){A||(T>-1&&!i&&g(T),!i&&v&&(!z.current||z.current&&I.current)&&b(a,Ue(gr,N.nativeEvent,void 0,{activationDirection:"none"})))}function H(N){if(A||i)return;z.current=!0;function G(){z.current=!1,I.current=!1}(!N.button||N.button===0)&&(I.current=!0,Hr(N.currentTarget).addEventListener("pointerup",G,{once:!0}))}const V=O.useMemo(()=>({disabled:i,active:A,orientation:p}),[i,A,p]);return ct("button",t,{state:V,ref:[n,B,E],props:[k,{role:"tab","aria-controls":D,"aria-selected":A,id:y,onClick:W,onFocus:U,onPointerDown:H,[Mz]:A?"":void 0,onKeyDownCapture(){R.current=!0}},u,M]})});let zse=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const Hse=O.forwardRef(function(t,n){const{className:r,value:i,render:s,keepMounted:a=!1,...o}=t,{value:l,getTabIdByPanelValue:u,orientation:h,tabActivationDirection:d,registerMountedTabPanel:p,unregisterMountedTabPanel:v}=_R(),x=Fr(),b=O.useMemo(()=>({id:x,value:i}),[x,i]),{ref:g,index:_}=Cf({metadata:b}),y=i!==l,S=u(i),k=O.useMemo(()=>({hidden:y,orientation:h,tabActivationDirection:d}),[y,h,d]),E=ct("div",t,{state:k,ref:[n,g],props:[{"aria-labelledby":S,hidden:y,id:x??void 0,role:"tabpanel",tabIndex:y?-1:0,[zse.index]:_},o],stateAttributesMapping:xR});return ze(()=>{if(!(y&&!a)&&x!=null)return p(i,x),()=>{v(i,x)}},[y,a,i,x,p,v]),!y||a?E:null}),Fse=O.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:i,loopFocus:s=!0,render:a,...o}=t,{getTabElementBySelectedValue:l,onValueChange:u,orientation:h,value:d,setTabMap:p,tabActivationDirection:v}=_R(),[x,b]=O.useState(0),[g,_]=O.useState(null),y=Use(d,h,g,l),S=Ie((A,R)=>{if(A!==d){const M=y(A);R.activationDirection=M,u(A,R)}}),k=O.useMemo(()=>({orientation:h,tabActivationDirection:v}),[h,v]),E={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},T=O.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:x,onTabActivation:S,setHighlightedTabIndex:b,tabsListElement:g,value:d}),[r,x,S,b,g,d]);return w.jsx(CH.Provider,{value:T,children:w.jsx(D0,{render:a,className:i,state:k,refs:[n,_],props:[E,o],stateAttributesMapping:xR,highlightedIndex:x,enableHomeAndEndKeys:!0,loopFocus:s,orientation:h,onHighlightedIndexChange:b,onMapChange:p,disabledIndices:ci})})});function FD(e,t){const{left:n,top:r}=e.getBoundingClientRect(),{left:i,top:s}=t.getBoundingClientRect(),a=n-i,o=r-s;return{left:a,top:o}}function Use(e,t,n,r){const[i,s]=O.useState(null);return ze(()=>{if(e==null||n==null){s(null);return}const a=r(e);if(a==null){s(null);return}const{left:o,top:l}=FD(a,n);s(t==="horizontal"?o:l)},[t,r,n,e]),O.useCallback(a=>{if(a===e)return"none";if(a==null)return s(null),"none";if(a!=null&&n!=null){const o=r(a);if(o!=null){const{left:l,top:u}=FD(o,n);if(i==null)return s(t==="horizontal"?l:u),"none";if(t==="horizontal"){if(l<i)return s(l),"left";if(l>i)return s(l),"right"}else{if(u<i)return s(u),"up";if(u>i)return s(u),"down"}}}return"none"},[r,t,i,n,e])}function Ol({className:e,orientation:t="horizontal",...n}){return w.jsx(Nse,{"data-slot":"tabs","data-orientation":t,className:Ne("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",e),...n})}const Vse=Dl("rounded-lg p-[3px] group-data-horizontal/tabs:h-8 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Rl({className:e,variant:t="default",...n}){return w.jsx(Fse,{"data-slot":"tabs-list","data-variant":t,className:Ne(Vse({variant:t}),e),...n})}function Yr({className:e,...t}){return w.jsx($se,{"data-slot":"tabs-trigger",className:Ne("gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium group-data-vertical/tabs:py-[calc(--spacing(1.25))] [&_svg:not([class*='size-'])]:size-3.5 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function wi({className:e,...t}){return w.jsx(Hse,{"data-slot":"tabs-content",className:Ne("text-xs/relaxed flex-1 min-h-0 outline-none",e),...t})}function Wse(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:s,actionsRef:a,handle:o,triggerId:l,defaultTriggerId:u=null}=e,h=Oa(),d=!!h,p=zr(()=>o?.store??new rH({open:n??r,activeTriggerId:l!==void 0?l:u,modal:!0,disablePointerDismissal:!0,nested:d,role:"alertdialog"})).current;p.useControlledProp("open",n,r),p.useControlledProp("activeTriggerId",l,u),p.useSyncedValue("nested",d),p.useContextCallback("onOpenChange",i),p.useContextCallback("onOpenChangeComplete",s);const v=p.useState("payload");nH({store:p,actionsRef:a,parentContext:h?.store.context});const x=O.useMemo(()=>({store:p}),[p]);return w.jsx(hR.Provider,{value:x,children:typeof t=="function"?t({payload:v}):t})}const EH=O.createContext(void 0),kH=O.createContext(void 0),TH=O.createContext(void 0),OH=O.createContext("");function Ra(){const e=O.useContext(EH);if(!e)throw new Error(qt(22));return e}function q0(){const e=O.useContext(kH);if(!e)throw new Error(qt(23));return e}function gu(){const e=O.useContext(TH);if(!e)throw new Error(qt(24));return e}function SR(){return O.useContext(OH)}const Ye={id:Te(e=>e.id),query:Te(e=>e.query),items:Te(e=>e.items),selectedValue:Te(e=>e.selectedValue),open:Te(e=>e.open),mounted:Te(e=>e.mounted),forceMounted:Te(e=>e.forceMounted),inline:Te(e=>e.inline),activeIndex:Te(e=>e.activeIndex),selectedIndex:Te(e=>e.selectedIndex),isActive:Te((e,t)=>e.activeIndex===t),isSelected:Te((e,t)=>{const n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(i=>Sa(i,t,n)):Sa(r,t,n)}),transitionStatus:Te(e=>e.transitionStatus),popupProps:Te(e=>e.popupProps),inputProps:Te(e=>e.inputProps),triggerProps:Te(e=>e.triggerProps),getItemProps:Te(e=>e.getItemProps),positionerElement:Te(e=>e.positionerElement),listElement:Te(e=>e.listElement),triggerElement:Te(e=>e.triggerElement),inputElement:Te(e=>e.inputElement),popupSide:Te(e=>e.popupSide),openMethod:Te(e=>e.openMethod),inputInsidePopup:Te(e=>e.inputInsidePopup),selectionMode:Te(e=>e.selectionMode),listRef:Te(e=>e.listRef),labelsRef:Te(e=>e.labelsRef),popupRef:Te(e=>e.popupRef),emptyRef:Te(e=>e.emptyRef),inputRef:Te(e=>e.inputRef),keyboardActiveRef:Te(e=>e.keyboardActiveRef),chipsContainerRef:Te(e=>e.chipsContainerRef),clearRef:Te(e=>e.clearRef),valuesRef:Te(e=>e.valuesRef),allValuesRef:Te(e=>e.allValuesRef),name:Te(e=>e.name),disabled:Te(e=>e.disabled),readOnly:Te(e=>e.readOnly),required:Te(e=>e.required),grid:Te(e=>e.grid),isGrouped:Te(e=>e.isGrouped),virtualized:Te(e=>e.virtualized),onOpenChangeComplete:Te(e=>e.onOpenChangeComplete),openOnInputClick:Te(e=>e.openOnInputClick),itemToStringLabel:Te(e=>e.itemToStringLabel),isItemEqualToValue:Te(e=>e.isItemEqualToValue),modal:Te(e=>e.modal),autoHighlight:Te(e=>e.autoHighlight),submitOnItemClick:Te(e=>e.submitOnItemClick)};function qse(e,t){return(n,r)=>{if(n==null)return!1;const i=pr(n,t);return e.contains(i,r)}}function Gse(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;const s=pr(r,t),a=n!=null?pr(n,t):"";return a&&e.contains(a,i)&&a.length===i.length?!0:e.contains(s,i)}}const UD=new Map;function RH(e){return Array.isArray(e)?e.map(t=>RH(t)).join(","):e==null?"":String(e)}function Kse(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${RH(e.locale)}|${JSON.stringify(t)}`,r=UD.get(n);if(r)return r;const i=new Intl.Collator(e.locale,t),s={contains(a,o,l){if(!o)return!0;const u=pr(a,l);for(let h=0;h<=u.length-o.length;h+=1)if(i.compare(u.slice(h,h+o.length),o)===0)return!0;return!1},startsWith(a,o,l){if(!o)return!0;const u=pr(a,l);return i.compare(u.slice(0,o.length),o)===0},endsWith(a,o,l){if(!o)return!0;const u=pr(a,l),h=o.length;return u.length>=h&&i.compare(u.slice(u.length-h),o)===0}};return UD.set(n,s),s}const Yse=Kse,AH=Symbol("none"),dc={value:AH,index:-1};function Xse(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:s,defaultInputValue:a,inputValue:o,selectionMode:l="none",onItemHighlighted:u,name:h,disabled:d=!1,readOnly:p=!1,required:v=!1,inputRef:x,grid:b=!1,items:g,filteredItems:_,filter:y,openOnInputClick:S=!0,autoHighlight:k=!1,keepHighlight:E=!1,highlightItemOnHover:T=!0,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:M=mH,virtualized:B=!1,inline:D=!1,fillInputOnItemPress:z=!0,modal:I=!1,limit:W=-1,autoComplete:U="list",locale:H,submitOnItemClick:V=!1}=e,{clearErrors:q}=Fm(),{setDirty:N,validityData:G,shouldValidateOnChange:L,setFilled:$,name:F,disabled:Q,validation:ee}=Ms(),ie=W0({id:t}),X=Yse({locale:H}),[K,J]=O.useState(!1),[ne,re]=O.useState(null),Z=O.useRef([]),ae=O.useRef([]),ue=O.useRef(null),fe=O.useRef(null),he=O.useRef(null),le=O.useRef(!0),Le=O.useRef(!1),ke=O.useRef(null),Be=O.useRef(null),_e=O.useRef(null),Re=O.useRef(dc),ge=O.useRef(null),Se=O.useRef([]),we=O.useRef([]),We=Q||d,it=F??h,Ae=l==="multiple",Ve=l==="single",qe=o!==void 0||a!==void 0,mt=g!==void 0,Ge=_!==void 0;let Xe;k==="always"?Xe="always":Xe=k?"input-change":!1;const[Oe,st]=Qi({controlled:i,default:Ae?r??ci:r,name:"Combobox",state:"selectedValue"}),ut=O.useMemo(()=>y===null?()=>!0:y!==void 0?y:Ve&&!K?Gse(X,A,Oe):qse(X,A),[y,Ve,Oe,K,X,A]),Ze=zr(()=>qe?a??"":Ve?pr(Oe,A):"").current,[at,It]=Qi({controlled:o,default:Ze,name:"Combobox",state:"inputValue"}),[ft,_n]=Qi({controlled:e.open,default:e.defaultOpen,name:"Combobox",state:"open"}),Mt=vH(g),Et=ne??(at===""?"":String(at).trim()),et=Ve?pr(Oe,A):"",zt=Ve&&!K&&Et!==""&&et!==""&&et.length===Et.length&&X.contains(et,Et),Kt=zt?"":Et,ht=mt&&Ge&&zt,jt=O.useMemo(()=>g?Mt?g.flatMap(Ke=>Ke.items):g:ci,[g,Mt]),Tt=O.useMemo(()=>{if(_&&!ht)return _;if(!g)return ci;if(Mt){const dt=g,Rt=[];let xn=0;for(const Bn of dt){if(W>-1&&xn>=W)break;const er=Kt===""?Bn.items:Bn.items.filter(Uo=>ut(Uo,Kt,A));if(er.length===0)continue;const Ho=W>-1?W-xn:1/0,Fo=er.slice(0,Ho);if(Fo.length>0){const Uo={...Bn,items:Fo};Rt.push(Uo),xn+=Fo.length}}return Rt}if(Kt==="")return W>-1?jt.slice(0,W):jt;const Ke=[];for(const dt of jt){if(W>-1&&Ke.length>=W)break;ut(dt,Kt,A)&&Ke.push(dt)}return Ke},[_,ht,g,Mt,Kt,W,ut,A,jt]),Ot=O.useMemo(()=>Mt?Tt.flatMap(dt=>dt.items):Tt,[Tt,Mt]),tt=zr(()=>new Uc({id:ie,selectedValue:Oe,open:ft,filter:ut,query:Et,items:g,selectionMode:l,listRef:Z,labelsRef:ae,popupRef:ue,emptyRef:he,inputRef:fe,keyboardActiveRef:le,chipsContainerRef:ke,clearRef:Be,valuesRef:Se,allValuesRef:we,selectionEventRef:_e,name:it,disabled:We,readOnly:p,required:v,grid:b,isGrouped:Mt,virtualized:B,openOnInputClick:S,itemToStringLabel:A,isItemEqualToValue:M,modal:I,autoHighlight:Xe,submitOnItemClick:V,hasInputValue:qe,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:D,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:n||$n,setOpen:$n,setInputValue:$n,setSelectedValue:$n,setIndices:$n,onItemHighlighted:$n,handleSelection:$n,getItemProps:()=>Pn,forceMount:$n,requestSubmit:$n})).current,Yt=l==="none"?at:Oe,Hn=O.useMemo(()=>l==="none"?Yt:Array.isArray(Oe)?Oe.map(Ke=>Vs(Ke,R)):Vs(Oe,R),[Yt,R,l,Oe]),Xn=Ie(u),Jn=Ie(n),ti=De(tt,Ye.activeIndex),$o=De(tt,Ye.selectedIndex),Ar=De(tt,Ye.positionerElement),jn=De(tt,Ye.listElement),Nn=De(tt,Ye.triggerElement),pi=De(tt,Ye.inputElement),Ur=De(tt,Ye.inline),es=De(tt,Ye.inputInsidePopup),ja=Rn(Nn),{mounted:wt,setMounted:io,transitionStatus:so}=eo(ft),{openMethod:ts,triggerProps:ns,reset:zo}=U0(ft);Um({id:ie,name:it,commit:ee.commit,value:Yt,controlRef:es?ja:fe,getValue:()=>Hn});const Pi=Ie(()=>{g?ae.current=Ot.map(Ke=>pr(Ke,A)):tt.set("forceMounted",!0)}),Fn=O.useRef(Oe);ze(()=>{Oe!==Fn.current&&Pi()},[Pi,Oe]);const Pr=Ie(Ke=>{tt.update(Ke);const dt=Ke.type||"none";if(Ke.activeIndex!==void 0)if(Ke.activeIndex===null)Re.current!==dc&&(Re.current=dc,Xn(void 0,Wh(dt,void 0,{index:-1})));else{const Rt=Se.current[Ke.activeIndex];Re.current={value:Rt,index:Ke.activeIndex},Xn(Rt,Wh(dt,void 0,{index:Ke.activeIndex}))}}),Mr=Ie((Ke,dt)=>{if(Le.current=dt.reason===cl,e.onInputValueChange?.(Ke,dt),!dt.isCanceled){if(dt.reason===Tc){const Rt=Ke.trim()!=="";Rt&&J(!0),ge.current={hasQuery:Rt},Rt&&Xe&&tt.state.activeIndex==null&&tt.set("activeIndex",0)}It(Ke)}}),ni=Ie((Ke,dt)=>{ft!==Ke&&(dt.reason==="escape-key"&&mt&&Ot.length===0&&!tt.state.emptyRef.current&&dt.allowPropagation(),e.onOpenChange?.(Ke,dt),!dt.isCanceled&&(!Ke&&K&&(Ve?(re(Et),Et===""&&J(!1)):Ae&&(Ur||es?Pr({activeIndex:null}):re(Et),Mr("",Ue(cl,dt.event)))),_n(Ke)))}),Mi=Ie((Ke,dt)=>{if(s?.(Ke,dt),dt.isCanceled)return;st(Ke),(l==="none"&&ue.current&&z||Ve&&!tt.state.inputInsidePopup)&&Mr(pr(Ke,A),Ue(dt.reason,dt.event)),Ve&&Ke!=null&&dt.reason!==Tc&&K&&re(Et)}),qf=Ie((Ke,dt)=>{let Rt=dt;if(Rt===void 0){if(ti===null)return;Rt=Se.current[ti]}const xn=Gn(Ke),Bn=_e.current??Ke;_e.current=null;const er=Ue(Fc,Bn),Ho=xn?.closest("a")?.getAttribute("href");if(Ho){Ho.startsWith("#")&&ni(!1,er);return}if(Ae){const Fo=Array.isArray(Oe)?Oe:[],Ns=Ac(Fo,Rt,tt.state.isItemEqualToValue)?gH(Fo,Rt,tt.state.isItemEqualToValue):[...Fo,Rt];if(Mi(Ns,er),!(fe.current?fe.current.value.trim()!=="":!1))return;tt.state.inputInsidePopup?Mr("",Ue(cl,er.event)):ni(!1,er)}else Mi(Rt,er),ni(!1,er)}),La=Ie(()=>{if(!tt.state.submitOnItemClick)return;const Ke=tt.state.inputElement?.form;Ke&&typeof Ke.requestSubmit=="function"&&Ke.requestSubmit()}),Da=Ie(()=>{if(io(!1),Jn?.(!1),J(!1),zo(),re(null),Pr(l==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ae&&fe.current&&fe.current.value!==""&&!Le.current&&Mr("",Ue(cl)),Ve)if(tt.state.inputInsidePopup)fe.current&&fe.current.value!==""&&Mr("",Ue(cl));else{const Ke=pr(Oe,A);fe.current&&fe.current.value!==Ke&&Mr(Ke,Ue(Ke===""?cl:gr))}}),Gf=O.useMemo(()=>Ur&&Ar?{current:Ar.closest('[role="dialog"]')}:ue,[Ur,Ar]);Jr({enabled:!e.actionsRef,open:ft,ref:Gf,onComplete(){ft||Da()}}),O.useImperativeHandle(e.actionsRef,()=>({unmount:Da}),[Da]),ze(function(){if(ft||l==="none")return;const dt=g?jt:we.current;if(Ae){const Rt=Array.isArray(Oe)?Oe:[],xn=Rt[Rt.length-1],Bn=Bd(dt,xn,M);Pr({selectedIndex:Bn===-1?null:Bn})}else{const Rt=Bd(dt,Oe,M);Pr({selectedIndex:Rt===-1?null:Rt})}},[ft,Oe,g,l,jt,Ae,M,Pr]),ze(()=>{g&&(Se.current=Ot,Z.current.length=Ot.length)},[g,Ot]),ze(()=>{const Ke=ge.current;if(Ke&&(Ke.hasQuery?Xe&&tt.set("activeIndex",0):Xe==="always"&&tt.set("activeIndex",0),ge.current=null),!ft&&!Ur)return;const Rt=mt||Ge?Ot:Se.current,xn=tt.state.activeIndex;if(xn==null){if(Xe==="always"&&Rt.length>0){tt.set("activeIndex",0);return}Re.current!==dc&&(Re.current=dc,tt.state.onItemHighlighted(void 0,Wh(gr,void 0,{index:-1})));return}if(xn>=Rt.length){Re.current!==dc&&(Re.current=dc,tt.state.onItemHighlighted(void 0,Wh(gr,void 0,{index:-1}))),tt.set("activeIndex",null);return}const Bn=Rt[xn],er=Re.current.value,Ho=er!==AH&&tt.state.isItemEqualToValue(Bn,er);(Re.current.index!==xn||!Ho)&&(Re.current={value:Bn,index:xn},tt.state.onItemHighlighted(Bn,Wh(gr,void 0,{index:xn})))},[ti,Xe,Ge,mt,Ot,Ur,ft,tt]),ze(()=>{if(!g||l==="none")return;const Ke=jt;if(Ae){const xn=Array.isArray(Oe)?Oe:ci,Bn=xn.filter(er=>Ac(Ke,er,tt.state.isItemEqualToValue));Bn.length!==xn.length&&st(Bn);return}if(Oe==null?!0:Ac(Ke,Oe,tt.state.isItemEqualToValue))return;let Rt=null;if(r!=null&&Ac(Ke,r,tt.state.isItemEqualToValue)&&(Rt=r),st(Rt),!tt.state.inputInsidePopup){const xn=pr(Rt,A);fe.current&&fe.current.value!==xn&&Mr(xn,Ue(gr))}},[g,jt,Ae,l,Oe,r,st,A,tt,Mr]),ze(()=>{if(l==="none"){$(String(at)!=="");return}$(Ae?Array.isArray(Oe)&&Oe.length>0:Oe!=null)},[$,l,at,Oe,Ae]),O.useEffect(()=>{mt&&Xe&&Ot.length===0&&Pr({activeIndex:null})},[mt,Xe,Ot.length,Pr]),Pc(Et,()=>{!ft||Et===""||Et===String(Ze)||J(!0)}),Pc(Oe,()=>{if(l!=="none"&&(q(it),N(Oe!==G.initialValue),L()?ee.commit(Oe):ee.commit(Oe,!0),Ae&&tt.state.selectedIndex!==null&&(!Array.isArray(Oe)||Oe.length===0)&&Pr({activeIndex:null,selectedIndex:null}),Ve&&!qe&&!es)){const Ke=pr(Oe,A);at!==Ke&&Mr(Ke,Ue(gr))}}),Pc(at,()=>{l==="none"&&(q(it),N(at!==G.initialValue),L()?ee.commit(at):ee.commit(at,!0))}),Pc(g,()=>{if(!Ve||qe||es||K)return;const Ke=pr(Oe,A);at!==Ke&&Mr(Ke,Ue(gr))});const Is=M0({open:Ur?!0:ft,onOpenChange:ni,elements:{reference:es?Nn:pi,floating:Ar}});let ji,ri;Ur||(ji=b?"grid":"listbox",ri=ft?"true":"false");const Vr=O.useMemo(()=>{const Ke=pi?.tagName==="INPUT",dt=Ke||ft,Rt=Ke?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return dt&&(Rt.role="combobox",Rt["aria-expanded"]=ri,Rt["aria-haspopup"]=ji,Rt["aria-controls"]=ft?jn?.id:void 0,Rt["aria-autocomplete"]=U),{reference:Rt,floating:{role:"presentation"}}},[pi,ft,ri,ji,jn?.id,U]),Me=Sf(Is,{enabled:!p&&!We&&S,event:"mousedown-only",toggle:!1,touchOpenDelay:es?0:50}),bt=Dm(Is,{enabled:!p&&!We&&!Ur,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Ur?!0:void 0,outsidePress(Ke){const dt=Gn(Ke);return!lt(Nn,dt)&&!lt(Be.current,dt)&&!lt(ke.current,dt)}}),Wr=rR(Is,{enabled:!p&&!We,id:ie,listRef:Z,activeIndex:ti,selectedIndex:$o,virtual:!0,loopFocus:!0,allowEscape:!Xe,focusItemOnOpen:K||l==="none"&&!Xe?!1:"auto",focusItemOnHover:T,resetOnPointerLeave:!E,cols:b?2:1,orientation:b?"horizontal":void 0,disabledIndices:ci,onNavigate(Ke,dt){!dt&&!ft||so==="ending"||Pr(dt?{activeIndex:Ke,type:le.current?"keyboard":"pointer"}:{activeIndex:Ke})}}),{getReferenceProps:rs,getFloatingProps:ii,getItemProps:Eu}=du([Vr,Me,bt,Wr]);dH(()=>{tt.update({inline:D,popupProps:ii(),inputProps:rs(),triggerProps:ns,getItemProps:Eu,setOpen:ni,setInputValue:Mr,setSelectedValue:Mi,setIndices:Pr,onItemHighlighted:Xn,handleSelection:qf,forceMount:Pi,requestSubmit:La})}),ze(()=>{tt.update({id:ie,selectedValue:Oe,open:ft,mounted:wt,transitionStatus:so,items:g,inline:D,popupProps:ii(),inputProps:rs(),triggerProps:ns,openMethod:ts,getItemProps:Eu,selectionMode:l,name:it,disabled:We,readOnly:p,required:v,grid:b,isGrouped:Mt,virtualized:B,onOpenChangeComplete:Jn,openOnInputClick:S,itemToStringLabel:A,modal:I,autoHighlight:Xe,isItemEqualToValue:M,submitOnItemClick:V,hasInputValue:qe,requestSubmit:La})},[tt,ie,Oe,ft,wt,so,g,ii,rs,Eu,ts,ns,l,it,We,p,v,ee,b,Mt,B,Jn,S,A,I,M,V,qe,D,La,Xe]);const mi=As(x,ee.inputRef),Kf=O.useMemo(()=>({query:Et,filteredItems:Tt,flatFilteredItems:Ot}),[Et,Tt,Ot]),lg=O.useMemo(()=>Array.isArray(Yt)?"":Vs(Yt,R),[Yt,R]),Yf=Ae&&Array.isArray(Oe)&&Oe.length>0,Ia=O.useMemo(()=>!Ae||!Array.isArray(Oe)||!it?null:Oe.map(Ke=>{const dt=Vs(Ke,R);return w.jsx("input",{type:"hidden",name:it,value:dt},dt)}),[Ae,Oe,it,R]),cg=w.jsxs(O.Fragment,{children:[e.children,w.jsx("input",{...ee.getInputValidationProps({onFocus(){if(es){Nn?.focus();return}(fe.current||Nn)?.focus()},onChange(Ke){if(Ke.nativeEvent.defaultPrevented)return;const dt=Ke.target.value,Rt=Ue(Tc,Ke.nativeEvent);function xn(){if(Ae)return;if(l==="none"){N(dt!==G.initialValue),Mr(dt,Rt),L()&&ee.commit(dt);return}const Bn=Se.current.find(er=>Vs(er,R).toLowerCase()===dt.toLowerCase());Bn!=null&&(N(Bn!==G.initialValue),Mi?.(Bn,Rt),L()&&ee.commit(Bn))}g?xn():(Pi(),queueMicrotask(xn))}}),id:ie,name:Ae||l==="none"?void 0:it,disabled:We,required:v&&!Yf,readOnly:p,value:lg,ref:mi,style:xf,tabIndex:-1,"aria-hidden":!0}),Ia]});return w.jsx(EH.Provider,{value:tt,children:w.jsx(kH.Provider,{value:Is,children:w.jsx(TH.Provider,{value:Kf,children:w.jsx(OH.Provider,{value:at,children:cg})})})})}const Fv=2,Qse={...Nd,...mu},Zse=O.forwardRef(function(t,n){const{render:r,className:i,nativeButton:s=!0,disabled:a=!1,...o}=t,{state:l,disabled:u,setTouched:h,setFocused:d,validationMode:p,validation:v}=Ms(),{labelId:x}=Fl(),b=Ra(),g=De(b,Ye.selectionMode),_=De(b,Ye.disabled),y=De(b,Ye.readOnly),S=De(b,Ye.listElement),k=De(b,Ye.triggerProps),E=De(b,Ye.triggerElement),T=De(b,Ye.inputInsidePopup),A=De(b,Ye.open),R=De(b,Ye.selectedValue),M=De(b,Ye.activeIndex),B=De(b,Ye.selectedIndex),D=q0(),z=SR(),I=fn(),W=u||_||a,U=O.useRef("");function H(ee){U.current=ee.pointerType}const V=D.select("domReferenceElement");O.useEffect(()=>{T&&E&&E!==V&&D.set("domReferenceElement",E)},[E,V,D,T]);const{reference:q}=iR(D,{enabled:!A&&!y&&!_&&g==="single",listRef:b.state.labelsRef,activeIndex:M,selectedIndex:B,onMatch(ee){const ie=b.state.valuesRef.current[ee];ie!==void 0&&b.state.setSelectedValue(ie,Ue("none"))}}),{reference:N}=Sf(D,{enabled:!y&&!_,event:"mousedown"}),{buttonRef:G,getButtonProps:L}=fi({native:s,disabled:W}),$=O.useMemo(()=>({...l,open:A,disabled:W}),[l,A,W]),F=Ie(ee=>{b.set("triggerElement",ee)});return ct("button",t,{ref:[n,G,F],state:$,props:[k,N,q,{tabIndex:T?0:-1,disabled:W,role:T?"combobox":void 0,"aria-expanded":A?"true":"false","aria-haspopup":T?"dialog":"listbox","aria-controls":A?S?.id:void 0,"aria-readonly":y||void 0,"aria-labelledby":x,onPointerDown:H,onPointerEnter:H,onFocus(){d(!0),!(W||y)&&I.start(0,b.state.forceMount)},onBlur(){if(h(!0),d(!1),p==="onBlur"){const ee=g==="none"?z:R;v.commit(ee)}},onMouseDown(ee){if(W||y||(T||D.set("domReferenceElement",ee.currentTarget),b.state.forceMount(),U.current!=="touch"&&(b.state.inputRef.current?.focus(),T||ee.preventDefault()),A))return;const ie=Hr(ee.currentTarget);function X(K){if(!E)return;const J=Gn(K),ne=b.state.positionerElement,re=b.state.listElement;if(lt(E,J)||lt(ne,J)||lt(re,J)||J===E)return;const Z=gR(E),ae=K.clientX>=Z.left-Fv&&K.clientX<=Z.right+Fv,ue=K.clientY>=Z.top-Fv&&K.clientY<=Z.bottom+Fv;ae&&ue||b.state.setOpen(!1,Ue("cancel-open",K))}T&&ie.addEventListener("mouseup",X,{once:!0})},onKeyDown(ee){W||y||(ee.key==="ArrowDown"||ee.key==="ArrowUp")&&(qn(ee),b.state.setOpen(!0,Ue(_d,ee.nativeEvent)),b.state.inputRef.current?.focus())}},v?v.getValidationProps(o):o,L],stateAttributesMapping:Qse})}),Jse=O.createContext(void 0);function eoe(){return O.useContext(Jse)}const PH=O.createContext(void 0);function wR(e){const t=O.useContext(PH);if(t===void 0&&!e)throw new Error(qt(21));return t}const toe={...Nd,...mu,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},noe=O.forwardRef(function(t,n){const{render:r,className:i,disabled:s=!1,id:a,...o}=t,{state:l,disabled:u,setTouched:h,setFocused:d,validationMode:p,validation:v}=Ms(),{labelId:x}=Fl(),b=eoe(),_=!!wR(!0),y=Ra(),{filteredItems:S}=gu(),k=SR(),E=Fr(a),T=Bl(),A=De(y,Ye.disabled),R=De(y,Ye.readOnly),M=De(y,Ye.name),B=De(y,Ye.selectionMode),D=De(y,Ye.autoHighlight),z=De(y,Ye.inputProps),I=De(y,Ye.triggerProps),W=De(y,Ye.open),U=De(y,Ye.mounted),H=De(y,Ye.selectedValue),V=De(y,Ye.popupSide),q=De(y,Ye.positionerElement),N=!!D,G=U&&q?V:null,L=u||A||s,$=S.length===0,[F,Q]=O.useState(null),ee=O.useRef(!1),ie=Ie(ne=>{const re=_||y.state.inline;re&&!y.state.hasInputValue&&y.state.setInputValue("",Ue(gr)),y.update({inputElement:ne,inputInsidePopup:re})}),X=O.useMemo(()=>({...l,open:W,disabled:L,readOnly:R,popupSide:G,listEmpty:$}),[l,W,L,R,G,$]);function K(ne){if(!b)return;let re;const{highlightedChipIndex:Z}=b;if(Z!==void 0){if(ne.key==="ArrowLeft")ne.preventDefault(),Z>0?re=Z-1:re=void 0;else if(ne.key==="ArrowRight")ne.preventDefault(),Z<H.length-1?re=Z+1:re=void 0;else if(ne.key==="Backspace"||ne.key==="Delete"){ne.preventDefault();const ae=Z>=H.length-1?H.length-2:Z;re=ae>=0?ae:void 0,y.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return re}return ne.key==="ArrowLeft"&&(ne.currentTarget.selectionStart??0)===0&&H.length>0?(ne.preventDefault(),re=Math.max(H.length-1,0)):ne.key==="Backspace"&&ne.currentTarget.value===""&&H.length>0&&(y.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),ne.preventDefault()),re}return ct("input",t,{state:X,ref:[n,y.state.inputRef,ie],props:[z,I,{type:"text",value:t.value??F??k,"aria-readonly":R||void 0,"aria-labelledby":x,disabled:L,readOnly:R,...B==="none"&&M&&{name:M},id:E,onFocus(){d(!0)},onBlur(){if(h(!0),d(!1),p==="onBlur"){const ne=B==="none"?k:H;v.commit(ne)}},onCompositionStart(ne){zy||(ee.current=!0,Q(ne.currentTarget.value))},onCompositionEnd(ne){ee.current=!1;const re=ne.currentTarget.value;Q(null),y.state.setInputValue(re,Ue(Tc,ne.nativeEvent))},onChange(ne){if(ee.current){const ue=ne.currentTarget.value;Q(ue),ue===""&&!y.state.openOnInputClick&&!y.state.inputInsidePopup&&y.state.setOpen(!1,Ue(cl,ne.nativeEvent));const fe=ue.trim(),he=N&&fe!=="";!R&&!L&&fe!==""&&(y.state.setOpen(!0,Ue(Tc,ne.nativeEvent)),N||y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"})),W&&y.state.activeIndex!==null&&!he&&y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"});return}y.state.setInputValue(ne.currentTarget.value,Ue(Tc,ne.nativeEvent));const re=ne.currentTarget.value==="",Z=Ue(cl,ne.nativeEvent);re&&!y.state.inputInsidePopup&&(B==="single"&&y.state.setSelectedValue(null,Z),y.state.openOnInputClick||y.state.setOpen(!1,Z));const ae=ne.currentTarget.value.trim();!R&&!L&&ae!==""&&(y.state.setOpen(!0,Ue(Tc,ne.nativeEvent)),N||y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"})),W&&y.state.activeIndex!==null&&!N&&y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(ne){if(L||R||ne.ctrlKey||ne.shiftKey||ne.altKey||ne.metaKey)return;y.state.keyboardActiveRef.current=!0;const re=ne.currentTarget,Z=re.scrollWidth-re.clientWidth,ae=T==="rtl";if(ne.key==="Home"){qn(ne);const fe=eD&&ae?re.value.length:0;re.setSelectionRange(fe,fe),re.scrollLeft=0;return}if(ne.key==="End"){qn(ne);const fe=eD&&ae?0:re.value.length;re.setSelectionRange(fe,fe),re.scrollLeft=ae?-Z:Z;return}if(!U&&ne.key==="Escape"){const fe=B==="multiple"&&Array.isArray(H)?H.length===0:H===null,he=Ue(T0,ne.nativeEvent),le=B==="multiple"?[]:null;y.state.setInputValue("",he),y.state.setSelectedValue(le,he),!fe&&!y.state.inline&&!he.isPropagationAllowed&&ne.stopPropagation();return}if(b&&ne.key==="Backspace"&&re.value===""&&b.highlightedChipIndex===void 0&&Array.isArray(H)&&H.length>0){const fe=H.slice(0,-1);y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"}),y.state.setSelectedValue(fe,Ue(gr,ne.nativeEvent));return}const ue=K(ne);if(b?.setHighlightedChipIndex(ue),ue!==void 0?b?.chipsRef.current[ue]?.focus():y.state.inputRef.current?.focus(),ne.which!==229&&ne.key==="Enter"&&W){const fe=y.state.activeIndex,he=ne.nativeEvent;if(fe===null){y.state.setOpen(!1,Ue(gr,he));return}qn(ne);const le=y.state.listRef.current[fe];le&&(y.state.selectionEventRef.current=he,le.click(),y.state.selectionEventRef.current=null)}},onPointerMove(){y.state.keyboardActiveRef.current=!1},onPointerDown(){y.state.keyboardActiveRef.current=!1}},v?v.getValidationProps(o):o],stateAttributesMapping:toe})}),roe={...Ls,...oR},ioe=O.forwardRef(function(t,n){const{render:r,className:i,disabled:s=!1,nativeButton:a=!0,keepMounted:o=!1,...l}=t,{disabled:u}=Ms(),h=Ra(),d=De(h,Ye.selectionMode),p=De(h,Ye.disabled),v=De(h,Ye.readOnly),x=De(h,Ye.open),b=De(h,Ye.selectedValue),g=SR();let _=!1;d==="none"?_=g!=="":d==="single"?_=b!=null:_=Array.isArray(b)&&b.length>0;const y=u||p||s,{buttonRef:S,getButtonProps:k}=fi({native:a,disabled:y}),{mounted:E,transitionStatus:T,setMounted:A}=eo(_),R=O.useMemo(()=>({disabled:y,open:x,transitionStatus:T}),[y,x,T]);Jr({open:_,ref:h.state.clearRef,onComplete(){_||A(!1)}});const M=ct("button",t,{state:R,ref:[n,S,h.state.clearRef],props:[{tabIndex:-1,children:"x",disabled:y,"aria-readonly":v||void 0,onMouseDown(D){D.preventDefault()},onClick(D){if(y||v)return;const z=h.state.keyboardActiveRef;h.state.setInputValue("",Ue(aD,D.nativeEvent)),d!=="none"?(h.state.setSelectedValue(Array.isArray(b)?[]:null,Ue(aD,D.nativeEvent)),h.state.setIndices({activeIndex:null,selectedIndex:null,type:z.current?"keyboard":"pointer"})):h.state.setIndices({activeIndex:null,type:z.current?"keyboard":"pointer"}),h.state.inputRef.current?.focus()}},l,k],stateAttributesMapping:roe});return o||E?M:null}),soe=O.createContext(null);function ooe(){return O.useContext(soe)}function aoe(e){const{children:t}=e,{filteredItems:n}=gu(),r=ooe(),i=r?r.items:n;return i?w.jsx(O.Fragment,{children:i.map(t)}):null}const loe=O.forwardRef(function(t,n){var r;const{render:i,className:s,children:a,...o}=t,l=Ra(),u=q0(),h=!!wR(!0),{filteredItems:d}=gu(),p=De(l,Ye.items),v=De(l,Ye.labelsRef),x=De(l,Ye.listRef),b=De(l,Ye.selectionMode),g=De(l,Ye.grid),_=De(l,Ye.popupProps),y=De(l,Ye.disabled),S=De(l,Ye.readOnly),k=De(l,Ye.virtualized),E=b==="multiple",T=d.length===0,A=Ie(I=>{l.set("positionerElement",I)}),R=Ie(I=>{l.set("listElement",I)}),M=O.useMemo(()=>typeof a=="function"?r||(r=w.jsx(aoe,{children:a})):a,[a]),B=O.useMemo(()=>({empty:T}),[T]),D=u.useState("floatingId"),z=ct("div",t,{state:B,ref:[n,R,h?null:A],props:[_,{children:M,tabIndex:-1,id:D,role:g?"grid":"listbox","aria-multiselectable":E?"true":void 0,onKeyDown(I){if(!(y||S)&&I.key==="Enter"){const W=l.state.activeIndex;if(W==null)return;qn(I);const U=I.nativeEvent,H=l.state.listRef.current[W];H&&(l.state.selectionEventRef.current=U,H.click(),l.state.selectionEventRef.current=null)}},onKeyDownCapture(){l.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.state.keyboardActiveRef.current=!1}},o]});return k?z:w.jsx(Im,{elementsRef:x,labelsRef:p?void 0:v,children:z})}),MH=O.createContext(void 0);function coe(){const e=O.useContext(MH);if(e===void 0)throw new Error(qt(20));return e}const uoe=O.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,s=Ra(),a=De(s,Ye.mounted),o=De(s,Ye.forceMounted);return a||r||o?w.jsx(MH.Provider,{value:r,children:w.jsx(Lm,{ref:n,...i})}):null}),doe=O.forwardRef(function(t,n){const{render:r,className:i,anchor:s,positionMethod:a="absolute",side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:v=5,sticky:x=!1,disableAnchorTracking:b=!1,collisionAvoidance:g=C0,..._}=t,y=Ra(),{filteredItems:S}=gu(),k=q0(),E=coe(),T=De(y,Ye.modal),A=De(y,Ye.open),R=De(y,Ye.mounted),M=De(y,Ye.openMethod),B=De(y,Ye.triggerElement),D=De(y,Ye.inputElement),z=De(y,Ye.inputInsidePopup),I=S.length===0,U=N0({anchor:s??(z?B:D),floatingRootContext:k,positionMethod:a,mounted:R,side:o,sideOffset:u,align:l,alignOffset:h,arrowPadding:v,collisionBoundary:d,collisionPadding:p,sticky:x,disableAnchorTracking:b,keepMounted:E,collisionAvoidance:g,lazyFlip:!0});F0(A&&T&&M!=="touch",B);const H=O.useMemo(()=>{const L={...U.positionerStyles};return A||(L.pointerEvents="none"),{role:"presentation",hidden:!R,style:L}},[A,R,U.positionerStyles]),V=O.useMemo(()=>({open:A,side:U.side,align:U.align,anchorHidden:U.anchorHidden,empty:I}),[A,U.side,U.align,U.anchorHidden,I]);ze(()=>{y.set("popupSide",U.side)},[y,U.side]);const q=O.useMemo(()=>({side:U.side,align:U.align,arrowRef:U.arrowRef,arrowUncentered:U.arrowUncentered,arrowStyles:U.arrowStyles,anchorHidden:U.anchorHidden,isPositioned:U.isPositioned}),[U.side,U.align,U.arrowRef,U.arrowUncentered,U.arrowStyles,U.anchorHidden,U.isPositioned]),N=Ie(L=>{y.set("positionerElement",L)}),G=ct("div",t,{state:V,ref:[n,N],props:[H,_],stateAttributesMapping:to});return w.jsxs(PH.Provider,{value:q,children:[R&&T&&w.jsx(H0,{inert:wf(!A),cutout:D??B}),G]})}),foe={...to,...Ls},hoe=O.forwardRef(function(t,n){const{render:r,className:i,initialFocus:s,finalFocus:a,...o}=t,l=Ra(),u=wR(),h=q0(),{filteredItems:d}=gu(),p=De(l,Ye.mounted),v=De(l,Ye.open),x=De(l,Ye.openMethod),b=De(l,Ye.transitionStatus),g=De(l,Ye.inputInsidePopup),_=De(l,Ye.inputElement),y=d.length===0;Jr({open:v,ref:l.state.popupRef,onComplete(){v&&l.state.onOpenChangeComplete(!0)}});const S=O.useMemo(()=>({open:v,side:u.side,align:u.align,anchorHidden:u.anchorHidden,transitionStatus:b,empty:y}),[v,u.side,u.align,u.anchorHidden,b,y]),k=ct("div",t,{state:S,ref:[n,l.state.popupRef],props:[{role:g?"dialog":"presentation",tabIndex:-1,onFocus(R){const M=Gn(R.nativeEvent);x!=="touch"&&(lt(l.state.listElement,M)||M===R.currentTarget)&&l.state.inputRef.current?.focus()}},B0(b),o],stateAttributesMapping:foe}),T=s===void 0?g?R=>R==="touch"?l.state.popupRef.current:_:!1:s;let A;return a!=null?A=a:A=g?void 0:!1,w.jsx(O0,{context:h,disabled:!p,modal:!g,openInteractionType:x,initialFocus:T,returnFocus:A,children:k})}),jH=O.createContext(void 0);function LH(){const e=O.useContext(jH);if(!e)throw new Error(qt(19));return e}const poe=O.createContext(!1);function moe(){return O.useContext(poe)}const goe=O.memo(O.forwardRef(function(t,n){const{render:r,className:i,value:s=null,index:a,disabled:o=!1,nativeButton:l=!1,...u}=t,h=O.useRef(!1),d=O.useRef(null),p=Cf({index:a,textRef:d,indexGuessBehavior:aR.GuessFromOrder}),v=Ra(),x=moe(),{flatFilteredItems:b}=gu(),g=De(v,Ye.open),_=De(v,Ye.selectionMode),y=De(v,Ye.readOnly),S=De(v,Ye.virtualized),k=De(v,Ye.isItemEqualToValue),E=_!=="none",T=a??(S?Bd(b,s,k):p.index),A=p.index!==-1,R=De(v,Ye.id),M=De(v,Ye.isActive,T),B=De(v,Ye.isSelected,s),D=De(v,Ye.items),z=De(v,Ye.getItemProps),I=O.useRef(null),W=R!=null&&A?`${R}-${T}`:void 0,U=B&&E;ze(()=>{if(!(A&&(S||a!=null)))return;const ee=v.state.listRef.current;return ee[T]=I.current,()=>{delete ee[T]}},[A,S,T,a,v]),ze(()=>{if(!A||D)return;const Q=v.state.valuesRef.current;return Q[T]=s,_!=="none"&&v.state.allValuesRef.current.push(s),()=>{delete Q[T]}},[A,D,T,s,v,_]),ze(()=>{if(!g){h.current=!1;return}if(!A||D)return;const Q=v.state.selectedValue,ee=Array.isArray(Q)?Q[Q.length-1]:Q;Sa(ee,s,k)&&v.set("selectedIndex",T)},[A,D,g,v,T,s,k]);const H=O.useMemo(()=>({disabled:o,selected:U,highlighted:M}),[o,U,M]),V=z({active:M,selected:U});V.id=void 0,V.onFocus=void 0;const{getButtonProps:q,buttonRef:N}=fi({disabled:o,focusableWhenDisabled:!0,native:l});function G(Q){function ee(){v.state.handleSelection(Q,s)}v.state.submitOnItemClick?(cr.flushSync(ee),v.state.requestSubmit()):ee()}const L={id:W,role:x?"gridcell":"option","aria-disabled":o||void 0,"aria-selected":E?U:void 0,tabIndex:void 0,onPointerDownCapture(Q){h.current=!0,Q.preventDefault()},onClick(Q){o||y||G(Q.nativeEvent)},onMouseUp(Q){const ee=h.current;h.current=!1,!(o||y||Q.button!==0||ee||!M)&&G(Q.nativeEvent)}},$=ct("div",t,{ref:[N,n,p.ref,I],state:H,props:[V,L,u,q]}),F=O.useMemo(()=>({selected:U,textRef:d}),[U,d]);return w.jsx(jH.Provider,{value:F,children:$})})),voe=O.forwardRef(function(t,n){const{render:r,className:i,children:s,...a}=t,{filteredItems:o}=gu(),l=Ra(),u=o.length===0?s:null;return ct("div",t,{ref:[n,l.state.emptyRef],props:[{children:u,role:"status","aria-live":"polite","aria-atomic":!0},a]})});let VD=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});function DH(e){return O.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[VD.checked]:""}:{[VD.unchecked]:""}},...mu}),[e.indeterminate])}const IH=O.createContext(void 0);function yoe(){const e=O.useContext(IH);if(e===void 0)throw new Error(qt(14));return e}const boe="data-parent",_oe=O.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:s=!1,disabled:a=!1,id:o,indeterminate:l=!1,inputRef:u,name:h,onCheckedChange:d,parent:p=!1,readOnly:v=!1,render:x,required:b=!1,uncheckedValue:g,value:_,nativeButton:y=!1,...S}=t,{clearErrors:k}=Fm(),{disabled:E,name:T,setDirty:A,setFilled:R,setFocused:M,setTouched:B,state:D,validationMode:z,validityData:I,shouldValidateOnChange:W,validation:U}=Ms(),H=Pie(),{labelId:V,controlId:q,setControlId:N,getDescriptionProps:G}=Fl(),L=jie(),$=L?.parent,F=$&&L.allValues,Q=E||H.disabled||L?.disabled||a,ee=T??h,ie=_??ee,X=Fr(),K=Fr();let J=q;F?J=p?K:`${$.id}-${ie}`:o&&(J=o);let ne={};F&&(p?ne=L.parent.getParentProps():ie&&(ne=L.parent.getChildProps(ie)));const re=Ie(d),{checked:Z=r,indeterminate:ae=l,onCheckedChange:ue,...fe}=ne,he=L?.value,le=L?.setValue,Le=L?.defaultValue,ke=O.useRef(null),{getButtonProps:Be,buttonRef:_e}=fi({disabled:Q,native:y}),Re=L?.validation??U,[ge,Se]=Qi({controlled:ie&&he&&!p?he.includes(ie):Z,default:ie&&Le&&!p?Le.includes(ie):s,name:"Checkbox",state:"checked"});ze(()=>{if(N!==$n)return N(J),()=>{N(void 0)}},[J,L,N,p]),Um({enabled:!L,id:X,commit:Re.commit,value:ge,controlRef:ke,name:ee,getValue:()=>ge});const we=O.useRef(null),We=As(u,we,Re.inputRef);ze(()=>{we.current&&(we.current.indeterminate=ae,ge&&R(!0))},[ge,ae,R]),Pc(ge,()=>{L&&!p||(k(ee),R(ge),A(ge!==I.initialValue),W()?Re.commit(ge):Re.commit(ge,!0))});const it=Ro({checked:ge,disabled:Q,name:p?void 0:ee,id:J??void 0,required:b,ref:We,style:xf,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Xe){if(Xe.nativeEvent.defaultPrevented)return;const Oe=Xe.target.checked,st=Ue(gr,Xe.nativeEvent);if(ue?.(Oe,st),re(Oe,st),!st.isCanceled&&(Se(Oe),ie&&he&&le&&!p)){const ut=Oe?[...he,ie]:he.filter(Ze=>Ze!==ie);le(ut,st)}},onFocus(){ke.current?.focus()}},_!==void 0?{value:(L?ge&&_:_)||""}:Pn,G,L?Re.getValidationProps:Re.getInputValidationProps),Ae=F?!!Z:ge,Ve=F&&ae||l;O.useEffect(()=>{$&&ie&&$.disabledStatesRef.current.set(ie,Q)},[$,Q,ie]);const qe=O.useMemo(()=>({...D,checked:Ae,disabled:Q,readOnly:v,required:b,indeterminate:Ve}),[D,Ae,Q,v,b,Ve]),mt=DH(qe),Ge=ct("span",t,{state:qe,ref:[_e,ke,n,L?.registerControlRef],props:[{id:X,role:"checkbox","aria-checked":ae?"mixed":ge,"aria-readonly":v||void 0,"aria-required":b||void 0,"aria-labelledby":V,[boe]:p?"":void 0,onFocus(){M(!0)},onBlur(){const Xe=we.current;Xe&&(B(!0),M(!1),z==="onBlur"&&Re.commit(L?he:Xe.checked))},onClick(Xe){v||Q||(Xe.preventDefault(),we.current?.click())}},G,Re.getValidationProps,S,fe,Be],stateAttributesMapping:mt});return w.jsxs(IH.Provider,{value:qe,children:[Ge,!ge&&!L&&ee&&!p&&g!==void 0&&w.jsx("input",{type:"hidden",name:ee,value:g}),w.jsx("input",{...it})]})}),xoe=O.forwardRef(function(t,n){const{render:r,className:i,keepMounted:s=!1,...a}=t,o=yoe(),l=o.checked||o.indeterminate,{transitionStatus:u,setMounted:h}=eo(l),d=O.useRef(null),p=O.useMemo(()=>({...o,transitionStatus:u}),[o,u]);Jr({open:l,ref:d,onComplete(){l||h(!1)}});const v=DH(o),x=O.useMemo(()=>({...v,...Ls,...mu}),[v]),b=s||l,g=ct("span",t,{enabled:b,ref:[n,d],state:p,stateAttributesMapping:x,props:a});return b?g:null});function Soe(e){const{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,...s}=e;return w.jsx(Xse,{...s,selectionMode:t?"multiple":"single",selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i})}const woe=O.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=LH();return r||i?w.jsx(Coe,{...t,ref:n}):null}),Coe=O.memo(O.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...s}=e,{selected:a}=LH(),o=O.useRef(null),{transitionStatus:l,setMounted:u}=eo(a),h=O.useMemo(()=>({selected:a,transitionStatus:l}),[a,l]),d=ct("span",e,{ref:[t,o],state:h,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:Ls});return Jr({open:a,ref:o,onComplete(){a||u(!1)}}),d})),Eoe=O.createContext(void 0);function G0(e=!0){const t=O.useContext(Eoe);if(t===void 0&&!e)throw new Error(qt(25));return t}const NH=O.createContext(void 0);function CR(e){const t=O.useContext(NH);if(t===void 0&&!e)throw new Error(qt(33));return t}const BH=O.createContext(void 0);function Ul(e){const t=O.useContext(BH);if(t===void 0&&!e)throw new Error(qt(36));return t}const $H={type:"regular-item"};function zH(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:s,nativeButton:a,itemMetadata:o,nodeId:l}=e,u=O.useRef(null),h=G0(!0),d=h!==void 0,{events:p}=s.useState("floatingTreeRoot"),{getButtonProps:v,buttonRef:x}=fi({disabled:n,focusableWhenDisabled:!0,native:a}),b=O.useCallback(_=>Ro({id:i,role:"menuitem",tabIndex:r?0:-1,onMouseMove(y){l&&p.emit("itemhover",{nodeId:l,target:y.currentTarget})},onMouseEnter(){o.type==="submenu-trigger"&&o.setActive()},onKeyUp(y){y.key===" "&&s.context.typingRef.current&&y.preventBaseUIHandler()},onClick(y){t&&p.emit("close",{domEvent:y,reason:Fc})},onMouseUp(y){if(h){const S=h.initialCursorPointRef.current;if(h.initialCursorPointRef.current=null,d&&S&&Math.abs(y.clientX-S.x)<=1&&Math.abs(y.clientY-S.y)<=1)return}u.current&&s.context.allowMouseUpTriggerRef.current&&(!d||y.button===2)&&o.type==="regular-item"&&u.current.click()}},_,v),[i,r,v,t,p,s,d,h,o,l]),g=As(u,x);return O.useMemo(()=>({getItemProps:b,itemRef:g}),[b,g])}let WD=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const HH={checked(e){return e?{[WD.checked]:""}:{[WD.unchecked]:""}},...Ls},koe=O.forwardRef(function(t,n){const{render:r,className:i,id:s,label:a,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!0,...h}=t,d=Cf({label:a}),p=CR(!0),v=Fr(s),{store:x}=Ul(),b=x.useState("isActive",d.index),g=x.useState("itemProps"),{getItemProps:_,itemRef:y}=zH({closeOnClick:u,disabled:l,highlighted:b,id:v,store:x,nativeButton:o,nodeId:p?.nodeId,itemMetadata:$H}),S=O.useMemo(()=>({disabled:l,highlighted:b}),[l,b]);return ct("div",t,{state:S,props:[g,h,_],ref:[y,n,d.ref]})}),Toe={...to,...Ls},Ooe=O.forwardRef(function(t,n){const{render:r,className:i,finalFocus:s,...a}=t,{store:o}=Ul(),{side:l,align:u}=CR(),h=yR()!=null,d=o.useState("open"),p=o.useState("transitionStatus"),v=o.useState("popupProps"),x=o.useState("mounted"),b=o.useState("instantType"),g=o.useState("activeTriggerElement"),_=o.useState("parent"),y=o.useState("lastOpenChangeReason"),S=o.useState("rootId"),k=o.useState("floatingRootContext"),E=o.useState("floatingTreeRoot"),T=o.useState("closeDelay"),A=o.useState("activeTriggerElement");Jr({open:d,ref:o.context.popupRef,onComplete(){d&&o.context.onOpenChangeComplete?.(!0)}}),O.useEffect(()=>{function I(W){o.setOpen(!1,Ue(W.reason,W.domEvent))}return E.events.on("close",I),()=>{E.events.off("close",I)}},[E.events,o]);const R=o.useState("hoverEnabled"),M=o.useState("disabled");Pne(k,{enabled:R&&!M&&_.type!=="context-menu"&&_.type!=="menubar",closeDelay:T});const B=O.useMemo(()=>({transitionStatus:p,side:l,align:u,open:d,nested:_.type==="menu",instant:b}),[p,l,u,d,_.type,b]),D=ct("div",t,{state:B,ref:[n,o.context.popupRef],stateAttributesMapping:Toe,props:[v,{onKeyDown(I){h&&sR.has(I.key)&&I.stopPropagation()}},B0(p),a,{"data-rootownerid":S}]});let z=_.type===void 0||_.type==="context-menu";return(g||_.type==="menubar"&&y!==k0)&&(z=!0),w.jsx(O0,{context:k,modal:!1,disabled:!x,returnFocus:s===void 0?z:s,initialFocus:_.type!=="menu",restoreFocus:!0,externalTree:_.type!=="menubar"?E:void 0,previousFocusableElement:A,nextFocusableElement:_.type===void 0?o.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?o.context.beforeContentFocusGuardRef:void 0,children:D})}),FH=O.createContext(void 0);function Roe(){const e=O.useContext(FH);if(e===void 0)throw new Error(qt(32));return e}const Aoe=O.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:s}=Ul();return s.useState("mounted")||r?w.jsx(FH.Provider,{value:r,children:w.jsx(Lm,{ref:n,...i})}):null}),Poe=O.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:s,render:a,side:o,align:l,sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:v=5,sticky:x=!1,disableAnchorTracking:b=!1,collisionAvoidance:g=C0,..._}=t,{store:y}=Ul(),S=Roe(),k=G0(!0),E=y.useState("parent"),T=y.useState("floatingRootContext"),A=y.useState("floatingTreeRoot"),R=y.useState("mounted"),M=y.useState("open"),B=y.useState("modal"),D=y.useState("activeTriggerElement"),z=y.useState("lastOpenChangeReason"),I=y.useState("floatingNodeId"),W=y.useState("floatingParentNodeId");let U=r,H=u,V=h,q=l,N=g;E.type==="context-menu"&&(U=r??E.context?.anchor,q=q??"start",!o&&q!=="center"&&(V=t.alignOffset??2,H=t.sideOffset??-5));let G=o,L=q;E.type==="menu"?(G=G??"inline-end",L=L??"start",N=t.collisionAvoidance??f$):E.type==="menubar"&&(G=G??"bottom",L=L??"start");const $=E.type==="context-menu",F=N0({anchor:U,floatingRootContext:T,positionMethod:k?"fixed":i,mounted:R,side:G,sideOffset:H,align:L,alignOffset:V,arrowPadding:$?0:v,collisionBoundary:d,collisionPadding:p,sticky:x,nodeId:I,keepMounted:S,disableAnchorTracking:b,collisionAvoidance:N,shiftCrossAxis:$,externalTree:A}),Q=O.useMemo(()=>{const ne={};return M||(ne.pointerEvents="none"),{role:"presentation",hidden:!R,style:{...F.positionerStyles,...ne}}},[M,R,F.positionerStyles]);O.useEffect(()=>{function ne(re){re.open?(re.parentNodeId===I&&y.set("hoverEnabled",!1),re.nodeId!==I&&re.parentNodeId===y.select("floatingParentNodeId")&&y.setOpen(!1,Ue(ap))):re.parentNodeId===I&&re.reason!==ap&&y.set("hoverEnabled",!0)}return A.events.on("menuopenchange",ne),()=>{A.events.off("menuopenchange",ne)}},[y,A.events,I]),O.useEffect(()=>{if(y.select("floatingParentNodeId")==null)return;function ne(re){if(re.open||re.nodeId!==y.select("floatingParentNodeId"))return;const Z=re.reason??ap;y.setOpen(!1,Ue(Z))}return A.events.on("menuopenchange",ne),()=>{A.events.off("menuopenchange",ne)}},[A.events,y]),O.useEffect(()=>{function ne(re){!M||re.nodeId!==y.select("floatingParentNodeId")||re.target&&D&&D!==re.target&&y.setOpen(!1,Ue(ap))}return A.events.on("itemhover",ne),()=>{A.events.off("itemhover",ne)}},[A.events,M,D,y]),O.useEffect(()=>{const ne={open:M,nodeId:I,parentNodeId:W,reason:y.select("lastOpenChangeReason")};A.events.emit("menuopenchange",ne)},[A.events,M,y,I,W]);const ee=O.useMemo(()=>({open:M,side:F.side,align:F.align,anchorHidden:F.anchorHidden,nested:E.type==="menu"}),[M,F.side,F.align,F.anchorHidden,E.type]),ie=O.useMemo(()=>({side:F.side,align:F.align,arrowRef:F.arrowRef,arrowUncentered:F.arrowUncentered,arrowStyles:F.arrowStyles,nodeId:F.context.nodeId}),[F.side,F.align,F.arrowRef,F.arrowUncentered,F.arrowStyles,F.context.nodeId]),X=ct("div",t,{state:ee,stateAttributesMapping:to,ref:[n,y.useStateSetter("positionerElement")],props:[Q,_]}),K=R&&E.type!=="menu"&&(E.type!=="menubar"&&B&&z!==Kn||E.type==="menubar"&&E.context.modal);let J=null;return E.type==="menubar"?J=E.context.contentElement:E.type===void 0&&(J=D),w.jsxs(NH.Provider,{value:ie,children:[K&&w.jsx(H0,{ref:E.type==="context-menu"||E.type==="nested-context-menu"?E.context.internalBackdropRef:null,inert:wf(!M),cutout:J}),w.jsx(J$,{id:I,children:w.jsx(Im,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:X})})]})}),UH=O.createContext(void 0);function Moe(){const e=O.useContext(UH);if(e===void 0)throw new Error(qt(34));return e}const joe=O.memo(O.forwardRef(function(t,n){const{render:r,className:i,value:s,defaultValue:a,onValueChange:o,disabled:l=!1,...u}=t,[h,d]=Qi({controlled:s,default:a,name:"MenuRadioGroup"}),p=Ie(o),v=Ie((_,y)=>{p?.(_,y),!y.isCanceled&&d(_)}),x=O.useMemo(()=>({disabled:l}),[l]),b=ct("div",t,{state:x,ref:n,props:{role:"group","aria-disabled":l||void 0,...u}}),g=O.useMemo(()=>({value:h,setValue:v,disabled:l}),[h,v,l]);return w.jsx(UH.Provider,{value:g,children:b})})),VH=O.createContext(void 0);function Loe(){const e=O.useContext(VH);if(e===void 0)throw new Error(qt(35));return e}const Doe=O.forwardRef(function(t,n){const{render:r,className:i,id:s,label:a,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!1,value:h,...d}=t,p=Cf({label:a}),v=CR(!0),x=Fr(s),{store:b}=Ul(),g=b.useState("isActive",p.index),_=b.useState("itemProps"),{value:y,setValue:S,disabled:k}=Moe(),E=k||l,T=y===h,{getItemProps:A,itemRef:R}=zH({closeOnClick:u,disabled:E,highlighted:g,id:x,store:b,nativeButton:o,nodeId:v?.nodeId,itemMetadata:$H}),M=O.useMemo(()=>({disabled:E,highlighted:g,checked:T}),[E,g,T]),B=Ie(z=>{const I={...Ue(Fc,z.nativeEvent),preventUnmountOnClose:()=>{}};S(h,I)}),D=ct("div",t,{state:M,stateAttributesMapping:HH,props:[_,{role:"menuitemradio","aria-checked":T,onClick:B},d,A],ref:[R,n,p.ref]});return w.jsx(VH.Provider,{value:M,children:D})}),Ioe=O.forwardRef(function(t,n){const{render:r,className:i,keepMounted:s=!1,...a}=t,o=Loe(),l=O.useRef(null),{transitionStatus:u,setMounted:h}=eo(o.checked);Jr({open:o.checked,ref:l,onComplete(){o.checked||h(!1)}});const d=O.useMemo(()=>({checked:o.checked,disabled:o.disabled,highlighted:o.highlighted,transitionStatus:u}),[o.checked,o.disabled,o.highlighted,u]);return ct("span",t,{state:d,stateAttributesMapping:HH,ref:[n,l],props:{"aria-hidden":!0,...a},enabled:s||o.checked})}),Noe=O.createContext(null);function WH(e){return O.useContext(Noe)}const Boe={...xz,disabled:Te(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Te(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Te(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Te(e=>e.stickIfOpen),parent:Te(e=>e.parent),rootId:Te(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Te(e=>e.activeIndex),isActive:Te((e,t)=>e.activeIndex===t),hoverEnabled:Te(e=>e.hoverEnabled),instantType:Te(e=>e.instantType),lastOpenChangeReason:Te(e=>e.openChangeReason),floatingTreeRoot:Te(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Te(e=>e.floatingNodeId),floatingParentNodeId:Te(e=>e.floatingParentNodeId),itemProps:Te(e=>e.itemProps),closeDelay:Te(e=>e.closeDelay),keyboardEventRelay:Te(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class ER extends tR{constructor(t){super({...$oe(),...t},{positionerRef:O.createRef(),popupRef:O.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:O.createRef(),beforeContentFocusGuardRef:O.createRef(),onOpenChangeComplete:void 0,triggerElements:new A0},Boe),this.observe(Te(n=>n.allowMouseEnter),(n,r)=>{this.state.parent.type==="menu"&&n!==r&&this.state.parent.store.set("allowMouseEnter",n)}),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){this.unsubscribeParentListener=n.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}static useStore(t,n){return zr(()=>t??new ER(n)).current}unsubscribeParentListener=null}function $oe(){return{..._z(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new QO,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Pn,keyboardEventRelay:void 0,closeDelay:0}}const zoe=O.createContext(void 0);function Hoe(){return O.useContext(zoe)}function Foe(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:s=!1,disabled:a=!1,modal:o,loopFocus:l=!0,orientation:u="vertical",actionsRef:h,closeParentOnEsc:d=!1,handle:p,triggerId:v,defaultTriggerId:x=null,highlightItemOnHover:b=!0}=e,g=G0(!0),_=Ul(!0),y=WH(),S=Hoe(),k=O.useMemo(()=>S&&_?{type:"menu",store:_.store}:y?{type:"menubar",context:y}:g&&!_?{type:"context-menu",context:g}:{type:void 0},[g,_,y,S]),E=ER.useStore(p?.store,{parent:k}),T=E.useState("floatingTreeRoot"),A=ZO(T),R=Zs();ze(()=>{g&&!_?E.update({parent:{type:"context-menu",context:g},floatingNodeId:A,floatingParentNodeId:R}):_&&E.update({floatingNodeId:A,floatingParentNodeId:R})},[g,_,A,R,E]),E.useControlledProp("open",n,s),E.useControlledProp("activeTriggerId",v,x),E.useContextCallback("onOpenChangeComplete",i);const M=E.useState("open"),B=E.useState("activeTriggerElement"),D=E.useState("positionerElement"),z=E.useState("hoverEnabled"),I=E.useState("modal"),W=E.useState("disabled"),U=E.useState("lastOpenChangeReason"),H=E.useState("parent"),V=E.useState("activeIndex"),q=E.useState("payload"),N=E.useState("floatingParentNodeId"),G=O.useRef(null),L=N!=null;let $;E.useSyncedValues({disabled:a,modal:H.type===void 0?o:void 0,rootId:Nl()});const{openMethod:F,triggerProps:Q,reset:ee}=U0(M);yz(E);const{forceUnmount:ie}=bz(M,E,()=>{E.update({allowMouseEnter:!1,stickIfOpen:!0}),ee()}),X=O.useRef(H.type!=="context-menu"),K=fn();O.useEffect(()=>{if(M||(G.current=null),H.type==="context-menu"){if(!M){K.clear(),X.current=!1;return}K.start(500,()=>{X.current=!0})}},[K,M,H.type]),F0(M&&I&&U!==Kn&&F!=="touch",D),ze(()=>{!M&&!z&&E.set("hoverEnabled",!0)},[M,z,E]);const J=O.useRef(!0),ne=fn(),re=Ie((Oe,st)=>{const ut=st.reason;if(M===Oe&&st.trigger===B||(st.preventUnmountOnClose=()=>{E.set("preventUnmountingOnClose",!0)},!Oe&&st.trigger==null&&(st.trigger=B??void 0),r?.(Oe,st),st.isCanceled))return;const Ze={open:Oe,nativeEvent:st.event,reason:st.reason,nested:L};$?.emit("openchange",Ze);const at=st.event;if(Oe===!1&&at?.type==="click"&&at.pointerType==="touch"&&!J.current)return;if(!Oe&&V!==null){const Mt=E.context.itemDomElements.current[V];queueMicrotask(()=>{Mt?.setAttribute("tabindex","-1")})}Oe&&ut===qy?(J.current=!1,ne.start(300,()=>{J.current=!0})):(J.current=!0,ne.clear());const It=(ut===kl||ut===Fc)&&at.detail===0&&at?.isTrusted,ft=!Oe&&(ut===T0||ut==null);function _n(){const Mt={open:Oe,openChangeReason:ut};G.current=st.event??null;const Et=st.trigger?.id??null;(Et||Oe)&&(Mt.activeTriggerId=Et,Mt.activeTriggerElement=st.trigger??null),E.update(Mt)}ut===Kn?cr.flushSync(_n):_n(),H.type==="menubar"&&(ut===qy||ut===Xs||ut===Kn||ut===_d||ut===ap)?E.set("instantType","group"):It||ft?E.set("instantType",It?"click":"dismiss"):E.set("instantType",void 0)}),Z=O.useCallback(Oe=>{const st=Ue(Oe);return st.preventUnmountOnClose=()=>{E.set("preventUnmountingOnClose",!0)},st},[E]),ae=O.useCallback(()=>{E.setOpen(!1,Z(nz))},[E,Z]);O.useImperativeHandle(h,()=>({unmount:ie,close:ae}),[ie,ae]);let ue;H.type==="context-menu"&&(ue=H.context),O.useImperativeHandle(ue?.positionerRef,()=>D,[D]),O.useImperativeHandle(ue?.actionsRef,()=>({setOpen:re}),[re]);const fe=Sz({popupStore:E,onOpenChange:re});$=fe.context.events,O.useEffect(()=>{const Oe=({open:st,eventDetails:ut})=>re(st,ut);return $.on("setOpen",Oe),()=>{$?.off("setOpen",Oe)}},[$,re]);const he=Dm(fe,{enabled:!W,bubbles:d&&H.type==="menu",outsidePress(){return H.type!=="context-menu"||G.current?.type==="contextmenu"?!0:X.current},externalTree:L?T:void 0}),le=Cz(fe,{role:"menu"}),Le=Bl(),ke=O.useCallback(Oe=>{E.select("activeIndex")!==Oe&&E.set("activeIndex",Oe)},[E]),Be=rR(fe,{enabled:!W,listRef:E.context.itemDomElements,activeIndex:V,nested:H.type!==void 0,loopFocus:l,orientation:u,parentOrientation:H.type==="menubar"?H.context.orientation:void 0,rtl:Le==="rtl",disabledIndices:ci,onNavigate:ke,openOnArrowKeyDown:H.type!=="context-menu",externalTree:L?T:void 0,focusItemOnHover:b}),_e=O.useCallback(Oe=>{E.context.typingRef.current=Oe},[E]),Re=iR(fe,{listRef:E.context.itemLabels,activeIndex:V,resetMs:_J,onMatch:Oe=>{M&&Oe!==V&&E.set("activeIndex",Oe)},onTypingChange:_e}),{getReferenceProps:ge,getFloatingProps:Se,getItemProps:we,getTriggerProps:We}=du([he,le,Be,Re]),it=O.useMemo(()=>{const Oe=Ro(ge(),{onMouseEnter(){E.set("hoverEnabled",!0)},onMouseMove(){E.set("allowMouseEnter",!0)}},Q);return delete Oe.role,Oe},[ge,E,Q]),Ae=O.useMemo(()=>{const Oe=We();if(!Oe)return Oe;const st=Ro(Oe,Q);return delete st.role,delete st["aria-controls"],st},[We,Q]),Ve=Tl(),qe=O.useMemo(()=>Se({onMouseEnter(){H.type==="menu"&&Ve.request(()=>E.set("hoverEnabled",!1))},onMouseMove(){E.set("allowMouseEnter",!0)},onClick(){E.select("hoverEnabled")&&E.set("hoverEnabled",!1)},onKeyDown(Oe){const st=E.select("keyboardEventRelay");st&&!Oe.isPropagationStopped()&&st(Oe)}}),[Se,H.type,Ve,E]),mt=O.useMemo(()=>we(),[we]);E.useSyncedValues({floatingRootContext:fe,activeTriggerProps:it,inactiveTriggerProps:Ae,popupProps:qe,itemProps:mt});const Ge=O.useMemo(()=>({store:E,parent:k}),[E,k]),Xe=w.jsx(BH.Provider,{value:Ge,children:typeof t=="function"?t({payload:q}):t});return H.type===void 0||H.type==="context-menu"?w.jsx(ez,{externalTree:T,children:Xe}):Xe}function qH(e){if(Cn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!So(e))return qH(Oo(e))}function Uoe(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,i=O.useRef(!1);return O.useMemo(()=>t?{onMouseDown:s=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,Hr(s.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:s=>{i.current&&(i.current=!1,s.preventBaseUIHandler())}}:Pn,[t,n,r])}const Uv=2,Voe=O.forwardRef(function(t,n){const{render:r,className:i,disabled:s=!1,nativeButton:a=!0,id:o,openOnHover:l,delay:u=100,closeDelay:h=0,handle:d,payload:p,...v}=t,x=Ul(!0),b=d?.store??x?.store;if(!b)throw new Error(qt(85));const g=Fr(o),_=b.useState("isTriggerActive",g),y=b.useState("floatingRootContext"),S=b.useState("isOpenedByTrigger",g),k=O.useRef(null),E=qoe(),T=$O(!0),A=Js(),R=O.useMemo(()=>A??new QO,[A]),M=ZO(R),B=Zs(),{registerTrigger:D,isMountedByThisTrigger:z}=vz(g,k,b,{payload:p,closeDelay:h,parent:E,floatingTreeRoot:R,floatingNodeId:M,floatingParentNodeId:B,keyboardEventRelay:T?.relayKeyboardEvent}),I=b.useState("disabled"),W=s||I||E.type==="menubar"&&E.context.disabled,{getButtonProps:U,buttonRef:H}=fi({disabled:W,native:a});O.useEffect(()=>{!S&&E.type===void 0&&(b.context.allowMouseUpTriggerRef.current=!1)},[b,S,E.type]);const V=O.useRef(null),q=fn(),N=Ie(le=>{if(!V.current)return;q.clear(),b.context.allowMouseUpTriggerRef.current=!1;const Le=le.target;if(lt(V.current,Le)||lt(b.select("positionerElement"),Le)||Le===V.current||Le!=null&&qH(Le)===b.select("rootId"))return;const ke=gR(V.current);le.clientX>=ke.left-Uv&&le.clientX<=ke.right+Uv&&le.clientY>=ke.top-Uv&&le.clientY<=ke.bottom+Uv||R.events.emit("close",{domEvent:le,reason:tz})});O.useEffect(()=>{S&&b.select("lastOpenChangeReason")===Kn&&Hr(V.current).addEventListener("mouseup",N,{once:!0})},[S,N,b]);const G=E.type==="menubar"&&E.context.hasSubmenuOpen,$=Lne(y,{enabled:(l??G??!1)&&!W&&E.type!=="context-menu"&&(E.type!=="menubar"||G&&!z),handleClose:Ez({blockPointerEvents:E.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:E.type===void 0?u:void 0,delay:{close:h},triggerElementRef:k,externalTree:R,isActiveTrigger:_}),F=Woe(S,b.select("lastOpenChangeReason")),Q=Sf(y,{enabled:!W&&E.type!=="context-menu",event:S&&E.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:E.type===void 0?F:!1}),ee=Tne(y,{enabled:!W&&(E.type!=="menubar"&&S||G)}),ie=Uoe({open:S,enabled:E.type==="menubar",mouseDownAction:"open"}),X=du([Q,ee]),K=E.type==="menubar",J=O.useMemo(()=>({disabled:W,open:S}),[W,S]),ne=b.useState("triggerProps",z),re=[V,n,H,D,k],Z=[X.getReferenceProps(),$??Pn,ne,{"aria-haspopup":"menu",id:g,onMouseDown:le=>{if(b.select("open"))return;q.start(200,()=>{b.context.allowMouseUpTriggerRef.current=!0}),Hr(le.currentTarget).addEventListener("mouseup",N,{once:!0})}},K?{role:"menuitem"}:{},ie,v,U],ae=O.useRef(null),ue=Ie(le=>{cr.flushSync(()=>{b.setOpen(!1,Ue(Xs,le.nativeEvent,le.currentTarget))}),Zee(ae.current)?.focus()}),fe=Ie(le=>{const Le=b.select("positionerElement");if(Le&&Ys(le,Le))b.context.beforeContentFocusGuardRef.current?.focus();else{cr.flushSync(()=>{b.setOpen(!1,Ue(Xs,le.nativeEvent,le.currentTarget))});let ke=Qee(k.current);for(;ke!==null&<(Le,ke)||ke?.hasAttribute("aria-hidden");){const Be=ke;if(ke=jm(ke),ke===Be)break}ke?.focus()}}),he=ct("button",t,{enabled:!K,stateAttributesMapping:Nd,state:J,ref:re,props:Z});return K?w.jsx(I0,{tag:"button",render:r,className:i,state:J,refs:re,props:Z,stateAttributesMapping:Nd}):S?w.jsxs(O.Fragment,{children:[w.jsx(Ao,{ref:ae,onFocus:ue},`${g}-pre-focus-guard`),w.jsx(O.Fragment,{children:he},g),w.jsx(Ao,{ref:b.context.triggerFocusTargetRef,onFocus:fe},`${g}-post-focus-guard`)]}):w.jsx(O.Fragment,{children:he},g)});function Woe(e,t){const n=fn(),[r,i]=O.useState(!1);return ze(()=>{e&&t==="trigger-hover"?(i(!0),n.start(u$,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function qoe(){const e=G0(!0),t=Ul(!0),n=WH();return O.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}function la(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const GH=O.createContext(void 0);function K0(){const e=O.useContext(GH);if(e===void 0)throw new Error(qt(53));return e}let Jy=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const Vv=500,qD=16;function Ss(e,t,n){if(!e)return 0;const r=getComputedStyle(e),i=n==="x"?"Inline":"Block";return n==="x"&&t==="margin"?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}let Goe=(function(e){return e.orientation="data-orientation",e.hovering="data-hovering",e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({}),od=(function(e){return e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});const kR={hasOverflowX:e=>e?{[od.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[od.hasOverflowY]:""}:null,overflowXStart:e=>e?{[od.overflowXStart]:""}:null,overflowXEnd:e=>e?{[od.overflowXEnd]:""}:null,overflowYStart:e=>e?{[od.overflowYStart]:""}:null,overflowYEnd:e=>e?{[od.overflowYEnd]:""}:null,cornerHidden:()=>null},GD={width:0,height:0},Koe={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Yoe=O.forwardRef(function(t,n){const{render:r,className:i,overflowEdgeThreshold:s,...a}=t,[o,l]=O.useState(!1),[u,h]=O.useState(!1),[d,p]=O.useState(!1),[v,x]=O.useState(GD),[b,g]=O.useState(GD),[_,y]=O.useState(!1),[S,k]=O.useState(Koe),E=Fr(),T=O.useRef(null),A=O.useRef(null),R=O.useRef(null),M=O.useRef(null),B=O.useRef(null),D=O.useRef(null),z=O.useRef(null),I=O.useRef(!1),W=O.useRef(0),U=O.useRef(0),H=O.useRef(0),V=O.useRef(0),q=O.useRef("vertical"),N=fn(),G=fn(),L=O.useRef({x:0,y:0}),[$,F]=O.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),Q=Xoe(s),ee=Ie(ue=>{const fe=ue.x-L.current.x,he=ue.y-L.current.y;L.current=ue,he!==0&&(p(!0),N.start(Vv,()=>{p(!1)})),fe!==0&&(h(!0),G.start(Vv,()=>{h(!1)}))}),ie=Ie(ue=>{ue.button===0&&(I.current=!0,W.current=ue.clientY,U.current=ue.clientX,q.current=ue.currentTarget.getAttribute(Goe.orientation),A.current&&(H.current=A.current.scrollTop,V.current=A.current.scrollLeft),B.current&&q.current==="vertical"&&B.current.setPointerCapture(ue.pointerId),D.current&&q.current==="horizontal"&&D.current.setPointerCapture(ue.pointerId))}),X=Ie(ue=>{if(!I.current)return;const fe=ue.clientY-W.current,he=ue.clientX-U.current;if(A.current){const le=A.current.scrollHeight,Le=A.current.clientHeight,ke=A.current.scrollWidth,Be=A.current.clientWidth;if(B.current&&R.current&&q.current==="vertical"){const _e=Ss(R.current,"padding","y"),Re=Ss(B.current,"margin","y"),ge=B.current.offsetHeight,Se=R.current.offsetHeight-ge-_e-Re,we=fe/Se;A.current.scrollTop=H.current+we*(le-Le),ue.preventDefault(),p(!0),N.start(Vv,()=>{p(!1)})}if(D.current&&M.current&&q.current==="horizontal"){const _e=Ss(M.current,"padding","x"),Re=Ss(D.current,"margin","x"),ge=D.current.offsetWidth,Se=M.current.offsetWidth-ge-_e-Re,we=he/Se;A.current.scrollLeft=V.current+we*(ke-Be),ue.preventDefault(),h(!0),G.start(Vv,()=>{h(!1)})}}}),K=Ie(ue=>{I.current=!1,B.current&&q.current==="vertical"&&B.current.releasePointerCapture(ue.pointerId),D.current&&q.current==="horizontal"&&D.current.releasePointerCapture(ue.pointerId)});function J(ue){const fe=ue.pointerType==="touch";if(y(fe),!fe){const he=lt(T.current,ue.target);l(he)}}const ne=O.useMemo(()=>({hasOverflowX:!$.scrollbarXHidden,hasOverflowY:!$.scrollbarYHidden,overflowXStart:S.xStart,overflowXEnd:S.xEnd,overflowYStart:S.yStart,overflowYEnd:S.yEnd,cornerHidden:$.cornerHidden}),[$.scrollbarXHidden,$.scrollbarYHidden,$.cornerHidden,S]),re={role:"presentation",onPointerEnter:J,onPointerMove:J,onPointerDown({pointerType:ue}){y(ue==="touch")},onPointerLeave(){l(!1)},style:{position:"relative",[Jy.scrollAreaCornerHeight]:`${v.height}px`,[Jy.scrollAreaCornerWidth]:`${v.width}px`}},Z=ct("div",t,{state:ne,ref:[n,T],props:[re,a],stateAttributesMapping:kR}),ae=O.useMemo(()=>({handlePointerDown:ie,handlePointerMove:X,handlePointerUp:K,handleScroll:ee,cornerSize:v,setCornerSize:x,thumbSize:b,setThumbSize:g,touchModality:_,cornerRef:z,scrollingX:u,setScrollingX:h,scrollingY:d,setScrollingY:p,hovering:o,setHovering:l,viewportRef:A,rootRef:T,scrollbarYRef:R,scrollbarXRef:M,thumbYRef:B,thumbXRef:D,rootId:E,hiddenState:$,setHiddenState:F,overflowEdges:S,setOverflowEdges:k,viewportState:ne,overflowEdgeThreshold:Q}),[ie,X,K,ee,v,b,_,z,u,h,d,p,o,l,A,T,R,M,B,D,E,$,S,ne,Q]);return w.jsxs(GH.Provider,{value:ae,children:[Dp.element,Z]})});function Xoe(e){if(typeof e=="number"){const t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}const Qoe=O.createContext(void 0);function Zoe(e,t){if(typeof IntersectionObserver>"u")return()=>{};const n=new IntersectionObserver(r=>{r.forEach(i=>{i.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}let ml=(function(e){return e.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",e.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",e.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",e.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",e})({}),KD=!1;function Joe(){KD||UO||(typeof CSS<"u"&&"registerProperty"in CSS&&[ml.scrollAreaOverflowXStart,ml.scrollAreaOverflowXEnd,ml.scrollAreaOverflowYStart,ml.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),KD=!0)}const eae=O.forwardRef(function(t,n){const{render:r,className:i,...s}=t,{viewportRef:a,scrollbarYRef:o,scrollbarXRef:l,thumbYRef:u,thumbXRef:h,cornerRef:d,setCornerSize:p,setThumbSize:v,rootId:x,setHiddenState:b,hiddenState:g,handleScroll:_,setHovering:y,setOverflowEdges:S,overflowEdges:k,overflowEdgeThreshold:E}=K0(),T=Bl(),A=O.useRef(!0),R=fn(),M=fn();function B(){const V=a.current,q=o.current,N=l.current,G=u.current,L=h.current,$=d.current;if(!V)return;const F=V.scrollHeight,Q=V.scrollWidth,ee=V.clientHeight,ie=V.clientWidth,X=V.scrollTop,K=V.scrollLeft;if(F===0||Q===0)return;const J=ee>=F,ne=ie>=Q,re=ie/Q,Z=ee/F,ae=Math.max(0,Q-ie),ue=Math.max(0,F-ee);let fe=0,he=0;ne||(T==="rtl"?fe=la(-K,0,ae):fe=la(K,0,ae),he=ae-fe);const le=J?0:la(X,0,ue),Le=J?0:ue-le,ke=ne?0:ie,Be=J?0:ee,_e=Ss(N,"padding","x"),Re=Ss(q,"padding","y"),ge=Ss(L,"margin","x"),Se=Ss(G,"margin","y"),we=ke-_e-ge,We=Be-Re-Se,it=N?Math.min(N.offsetWidth,we):we,Ae=q?Math.min(q.offsetHeight,We):We,Ve=Math.max(qD,it*re),qe=Math.max(qD,Ae*Z);if(v(Ze=>Ze.height===qe&&Ze.width===Ve?Ze:{width:Ve,height:qe}),q&&G){const Ze=q.offsetHeight-qe-Re-Se,at=F-ee,It=at===0?0:X/at,ft=Math.min(Ze,Math.max(0,It*Ze));G.style.transform=`translate3d(0,${ft}px,0)`}if(N&&L){const Ze=N.offsetWidth-Ve-_e-ge,at=Q-ie,It=at===0?0:K/at,ft=T==="rtl"?la(It*Ze,-Ze,0):la(It*Ze,0,Ze);L.style.transform=`translate3d(${ft}px,0,0)`}const mt=la(fe,0,ae),Ge=la(he,0,ae),Xe=la(le,0,ue),Oe=la(Le,0,ue),st=[[ml.scrollAreaOverflowXStart,mt],[ml.scrollAreaOverflowXEnd,Ge],[ml.scrollAreaOverflowYStart,Xe],[ml.scrollAreaOverflowYEnd,Oe]];for(const[Ze,at]of st)V.style.setProperty(Ze,`${at}px`);if($){if(ne||J)p({width:0,height:0});else if(!ne&&!J){const Ze=q?.offsetWidth||0,at=N?.offsetHeight||0;p({width:Ze,height:at})}}b(Ze=>{const at=J||ne;return Ze.scrollbarYHidden===J&&Ze.scrollbarXHidden===ne&&Ze.cornerHidden===at?Ze:{scrollbarYHidden:J,scrollbarXHidden:ne,cornerHidden:at}});const ut={xStart:!ne&&mt>E.xStart,xEnd:!ne&&Ge>E.xEnd,yStart:!J&&Xe>E.yStart,yEnd:!J&&Oe>E.yEnd};S(Ze=>Ze.xStart===ut.xStart&&Ze.xEnd===ut.xEnd&&Ze.yStart===ut.yStart&&Ze.yEnd===ut.yEnd?Ze:ut)}const D=Ie(()=>{cr.flushSync(B)});ze(()=>a.current?(Joe(),Zoe(a.current,D)):void 0,[D,a]),ze(()=>{queueMicrotask(D)},[D,g,T]),ze(()=>{a.current?.matches(":hover")&&y(!0)},[a,y]),O.useEffect(()=>{const V=a.current;if(typeof ResizeObserver>"u"||!V)return;const q=new ResizeObserver(D);return q.observe(V),M.start(0,()=>{Promise.all(V.getAnimations({subtree:!0}).map(N=>N.finished)).then(D).catch(()=>{})}),()=>{q.disconnect(),M.clear()}},[D,a,M]);function z(){A.current=!1}const I={role:"presentation",...x&&{"data-id":`${x}-viewport`},...(!g.scrollbarXHidden||!g.scrollbarYHidden)&&{tabIndex:0},className:Dp.className,style:{overflow:"scroll"},onScroll(){a.current&&(D(),A.current||_({x:a.current.scrollLeft,y:a.current.scrollTop}),R.start(100,()=>{A.current=!0}))},onWheel:z,onTouchMove:z,onPointerMove:z,onPointerEnter:z,onKeyDown:z},W=O.useMemo(()=>({hasOverflowX:!g.scrollbarXHidden,hasOverflowY:!g.scrollbarYHidden,overflowXStart:k.xStart,overflowXEnd:k.xEnd,overflowYStart:k.yStart,overflowYEnd:k.yEnd,cornerHidden:g.cornerHidden}),[g.scrollbarXHidden,g.scrollbarYHidden,g.cornerHidden,k]),U=ct("div",t,{ref:[n,a],state:W,props:[I,s],stateAttributesMapping:kR}),H=O.useMemo(()=>({computeThumbPosition:D}),[D]);return w.jsx(Qoe.Provider,{value:H,children:U})}),KH=O.createContext(void 0);function tae(){const e=O.useContext(KH);if(e===void 0)throw new Error(qt(54));return e}let eb=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const nae=O.forwardRef(function(t,n){const{render:r,className:i,orientation:s="vertical",keepMounted:a=!1,...o}=t,{hovering:l,scrollingX:u,scrollingY:h,hiddenState:d,overflowEdges:p,scrollbarYRef:v,scrollbarXRef:x,viewportRef:b,thumbYRef:g,thumbXRef:_,handlePointerDown:y,handlePointerUp:S,rootId:k,thumbSize:E}=K0(),T=O.useMemo(()=>({hovering:l,scrolling:{horizontal:u,vertical:h}[s],orientation:s,hasOverflowX:!d.scrollbarXHidden,hasOverflowY:!d.scrollbarYHidden,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:d.cornerHidden}),[l,u,h,s,d,p]),A=Bl();O.useEffect(()=>{const I=b.current,W=s==="vertical"?v.current:x.current;if(!W)return;function U(H){if(!(!I||!W||H.ctrlKey)){if(H.preventDefault(),s==="vertical"){if(I.scrollTop===0&&H.deltaY<0)return}else if(I.scrollLeft===0&&H.deltaX<0)return;if(s==="vertical"){if(I.scrollTop===I.scrollHeight-I.clientHeight&&H.deltaY>0)return}else if(I.scrollLeft===I.scrollWidth-I.clientWidth&&H.deltaX>0)return;s==="vertical"?I.scrollTop+=H.deltaY:I.scrollLeft+=H.deltaX}}return W.addEventListener("wheel",U,{passive:!1}),()=>{W.removeEventListener("wheel",U)}},[s,x,v,b]);const R={...k&&{"data-id":`${k}-scrollbar`},onPointerDown(I){if(I.button===0&&I.currentTarget===I.target&&b.current){if(g.current&&v.current&&s==="vertical"){const W=Ss(g.current,"margin","y"),U=Ss(v.current,"padding","y"),H=g.current.offsetHeight,V=v.current.getBoundingClientRect(),q=I.clientY-V.top-H/2-U+W/2,N=b.current.scrollHeight,G=b.current.clientHeight,L=v.current.offsetHeight-H-U-W,F=q/L*(N-G);b.current.scrollTop=F}if(_.current&&x.current&&s==="horizontal"){const W=Ss(_.current,"margin","x"),U=Ss(x.current,"padding","x"),H=_.current.offsetWidth,V=x.current.getBoundingClientRect(),q=I.clientX-V.left-H/2-U+W/2,N=b.current.scrollWidth,G=b.current.clientWidth,L=x.current.offsetWidth-H-U-W,$=q/L;let F;A==="rtl"?(F=(1-$)*(N-G),b.current.scrollLeft<=0&&(F=-F)):F=$*(N-G),b.current.scrollLeft=F}y(I)}},onPointerUp:S,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...s==="vertical"&&{top:0,bottom:`var(${Jy.scrollAreaCornerHeight})`,insetInlineEnd:0,[eb.scrollAreaThumbHeight]:`${E.height}px`},...s==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${Jy.scrollAreaCornerWidth})`,bottom:0,[eb.scrollAreaThumbWidth]:`${E.width}px`}}},M=ct("div",t,{ref:[n,s==="vertical"?v:x],state:T,props:[R,o],stateAttributesMapping:kR}),B=O.useMemo(()=>({orientation:s}),[s]),D=s==="vertical"?d.scrollbarYHidden:d.scrollbarXHidden;return a||!D?w.jsx(KH.Provider,{value:B,children:M}):null}),rae=O.forwardRef(function(t,n){const{render:r,className:i,...s}=t,{thumbYRef:a,thumbXRef:o,handlePointerDown:l,handlePointerMove:u,handlePointerUp:h,setScrollingX:d,setScrollingY:p}=K0(),{orientation:v}=tae(),x=O.useMemo(()=>({orientation:v}),[v]);return ct("div",t,{ref:[n,v==="vertical"?a:o],state:x,props:[{onPointerDown:l,onPointerMove:u,onPointerUp(g){v==="vertical"&&p(!1),v==="horizontal"&&d(!1),h(g)},style:{...v==="vertical"&&{height:`var(${eb.scrollAreaThumbHeight})`},...v==="horizontal"&&{width:`var(${eb.scrollAreaThumbWidth})`}}},s]})}),iae=O.forwardRef(function(t,n){const{render:r,className:i,...s}=t,{cornerRef:a,cornerSize:o,hiddenState:l}=K0(),u=ct("div",t,{ref:[n,a],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},s]});return l.cornerHidden?null:u}),YH=O.createContext(void 0);function sae(){const e=O.useContext(YH);if(e===void 0)throw new Error(qt(63));return e}let YD=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const XH={...mu,checked(e){return e?{[YD.checked]:""}:{[YD.unchecked]:""}}},oae=O.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:s,id:a,inputRef:o,name:l,nativeButton:u=!1,onCheckedChange:h,readOnly:d=!1,required:p=!1,disabled:v=!1,render:x,uncheckedValue:b,...g}=t,{clearErrors:_}=Fm(),{state:y,setTouched:S,setDirty:k,validityData:E,setFilled:T,setFocused:A,shouldValidateOnChange:R,validationMode:M,disabled:B,name:D,validation:z}=Ms(),{labelId:I}=Fl(),W=B||v,U=D??l,H=Ie(h),V=O.useRef(null),q=As(V,o,z.inputRef),N=O.useRef(null),G=Fr(),L=W0({id:a,implicit:!1,controlRef:N}),[$,F]=Qi({controlled:r,default:!!s,name:"Switch",state:"checked"});Um({id:G,commit:z.commit,value:$,controlRef:N,name:U,getValue:()=>$}),ze(()=>{V.current&&T(V.current.checked)},[V,T]),Pc($,()=>{_(U),k($!==E.initialValue),T($),R()?z.commit($):z.commit($,!0)});const{getButtonProps:Q,buttonRef:ee}=fi({disabled:W,native:u}),ie={id:G,role:"switch","aria-checked":$,"aria-readonly":d||void 0,"aria-labelledby":I,onFocus(){W||A(!0)},onBlur(){const ne=V.current;!ne||W||(S(!0),A(!1),M==="onBlur"&&z.commit(ne.checked))},onClick(ne){d||W||(ne.preventDefault(),V?.current?.click())}},X=O.useMemo(()=>Ro({checked:$,disabled:W,id:L,name:U,required:p,style:xf,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:q,onChange(ne){if(ne.nativeEvent.defaultPrevented)return;const re=ne.target.checked,Z=Ue(gr,ne.nativeEvent);H?.(re,Z),!Z.isCanceled&&F(re)},onFocus(){N.current?.focus()}},z.getInputValidationProps),[$,W,q,L,U,H,p,F,z]),K=O.useMemo(()=>({...y,checked:$,disabled:W,readOnly:d,required:p}),[y,$,W,d,p]),J=ct("span",t,{state:K,ref:[n,N,ee],props:[ie,z.getValidationProps,g,Q],stateAttributesMapping:XH});return w.jsxs(YH.Provider,{value:K,children:[J,!$&&U&&b!==void 0&&w.jsx("input",{type:"hidden",name:U,value:b}),w.jsx("input",{...X})]})}),aae=O.forwardRef(function(t,n){const{render:r,className:i,...s}=t,{state:a}=Ms(),o=sae(),l={...a,...o};return ct("span",t,{state:l,ref:n,stateAttributesMapping:XH,props:s})}),QH=O.createContext(void 0);function lae(e=!0){const t=O.useContext(QH);if(t===void 0&&!e)throw new Error(qt(7));return t}const cae=O.forwardRef(function(t,n){const{className:r,defaultPressed:i=!1,disabled:s=!1,form:a,onPressedChange:o,pressed:l,render:u,type:h,value:d,nativeButton:p=!0,...v}=t,x=Fr(d||void 0),b=lae(),g=b?.value??[],_=b?void 0:i,y=(s||b?.disabled)??!1,[S,k]=Qi({controlled:b?g?.indexOf(x)>-1:l,default:_,name:"Toggle",state:"pressed"}),E=Ie((z,I)=>{x&&b?.setGroupValue?.(x,z,I),o?.(z,I)}),{getButtonProps:T,buttonRef:A}=fi({disabled:y,native:p}),R=O.useMemo(()=>({disabled:y,pressed:S}),[y,S]),M=[A,n],B=[{"aria-pressed":S,onClick(z){const I=!S,W=Ue(gr,z.nativeEvent);E(I,W),!W.isCanceled&&k(I)}},v,T],D=ct("button",t,{enabled:!b,state:R,ref:M,props:B});return b?w.jsx(I0,{tag:"button",render:u,className:r,state:R,refs:M,props:B}):D});let uae=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const XD={multiple(e){return e?{[uae.multiple]:""}:null}},dae=O.forwardRef(function(t,n){const{defaultValue:r,disabled:i=!1,loopFocus:s=!0,onValueChange:a,orientation:o="horizontal",multiple:l=!1,value:u,className:h,render:d,...p}=t,v=yR(),x=O.useMemo(()=>{if(u===void 0)return r??[]},[u,r]),b=(v?.disabled??!1)||i,[g,_]=Qi({controlled:u,default:x,name:"ToggleGroup",state:"value"}),y=Ie((A,R,M)=>{let B;if(l?(B=g.slice(),R?B.push(A):B.splice(g.indexOf(A),1)):B=R?[A]:[],Array.isArray(B)){if(a?.(B,M),M.isCanceled)return;_(B)}}),S=O.useMemo(()=>({disabled:b,multiple:l,orientation:o}),[b,o,l]),k=O.useMemo(()=>({disabled:b,orientation:o,setGroupValue:y,value:g}),[b,o,y,g]),E={role:"group"},T=ct("div",t,{enabled:!!v,state:S,ref:n,props:[E,p],stateAttributesMapping:XD});return w.jsx(QH.Provider,{value:k,children:v?T:w.jsx(D0,{render:d,className:h,state:S,refs:[n],props:[E,p],stateAttributesMapping:XD,loopFocus:s})})});function fae(e){return ct(e.defaultTagName??"div",e,e)}function hae({className:e,...t}){return w.jsx("div",{"data-slot":"input-group",role:"group",className:Ne("border-input bg-input/20 dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 h-7 rounded-md border transition-colors has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:ring-[2px] has-[[data-slot][aria-invalid=true]]:ring-[2px] has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0 group/input-group relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto",e),...t})}const pae=Dl("text-muted-foreground **:data-[slot=kbd]:bg-muted-foreground/10 h-auto gap-1 py-2 text-xs/relaxed font-medium group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5 flex cursor-text items-center justify-center select-none",{variants:{align:{"inline-start":"pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem] order-first","inline-end":"pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem] order-last","block-start":"px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start","block-end":"px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start"}},defaultVariants:{align:"inline-start"}});function mae({className:e,align:t="inline-start",...n}){return w.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Ne(pae({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const gae=Dl("gap-2 rounded-md text-xs/relaxed shadow-none flex items-center",{variants:{size:{xs:"h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3",sm:"","icon-xs":"size-6 p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function ZH({className:e,type:t="button",variant:n="ghost",size:r="xs",...i}){return w.jsx(He,{type:t,"data-size":r,variant:n,className:Ne(gae({size:r}),e),...i})}function vae({className:e,...t}){return w.jsx(Xt,{"data-slot":"input-group-control",className:Ne("rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent flex-1",e),...t})}const yae=Soe;function bae({className:e,children:t,...n}){return w.jsxs(Zse,{"data-slot":"combobox-trigger",className:Ne("[&_svg:not([class*='size-'])]:size-3.5",e),...n,children:[t,w.jsx(me,{icon:$m,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})]})}function _ae({className:e,...t}){return w.jsx(ioe,{"data-slot":"combobox-clear",render:w.jsx(ZH,{variant:"ghost",size:"icon-xs"}),className:Ne(e),...t,children:w.jsx(me,{icon:Ps,strokeWidth:2,className:"pointer-events-none"})})}function xae({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...s}){return w.jsxs(hae,{className:Ne("w-auto",e),children:[w.jsx(noe,{render:w.jsx(vae,{disabled:n}),...s}),w.jsxs(mae,{align:"inline-end",children:[r&&w.jsx(ZH,{size:"icon-xs",variant:"ghost",render:w.jsx(bae,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:n}),i&&w.jsx(_ae,{disabled:n})]}),t]})}function Sae({className:e,side:t="bottom",sideOffset:n=6,align:r="start",alignOffset:i=0,anchor:s,...a}){return w.jsx(uoe,{children:w.jsx(doe,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:s,className:"isolate z-50",children:w.jsx(hoe,{"data-slot":"combobox-content","data-chips":!!s,className:Ne("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 *:data-[slot=input-group]:bg-input/20 dark:bg-popover max-h-72 min-w-32 overflow-hidden rounded-lg shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:shadow-none group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)",e),...a})})})}function wae({className:e,...t}){return w.jsx(loe,{"data-slot":"combobox-list",className:Ne("no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto p-1 data-empty:p-0 overflow-y-auto overscroll-contain",e),...t})}function Cae({className:e,children:t,...n}){return w.jsxs(goe,{"data-slot":"combobox-item",className:Ne("data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[t,w.jsx(woe,{render:w.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:w.jsx(me,{icon:fu,strokeWidth:2,className:"pointer-events-none"})})]})}function Eae({className:e,...t}){return w.jsx(voe,{"data-slot":"combobox-empty",className:Ne("text-muted-foreground hidden w-full justify-center py-2 text-center text-xs/relaxed group-data-empty/combobox-content:flex",e),...t})}const kae=Dl("hover:text-foreground hover:bg-accent/20 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aria-pressed:bg-accent aria-pressed:text-accent-foreground aria-pressed:hover:bg-accent data-[state=on]:bg-accent data-[state=on]:text-accent-foreground data-[state=on]:hover:bg-accent gap-1 rounded-md text-xs font-medium transition-all [&_svg:not([class*='size-'])]:size-3.5 group/toggle inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border-input hover:bg-accent/20 border bg-transparent"},size:{default:"h-7 min-w-7 px-2",sm:"h-6 min-w-6 rounded-[min(var(--radius-md),8px)] px-1.5 text-[0.625rem] [&_svg:not([class*='size-'])]:size-3",lg:"h-8 min-w-8 px-2"}},defaultVariants:{variant:"default",size:"default"}}),JH=O.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function Tae({className:e,variant:t,size:n,spacing:r=0,orientation:i="horizontal",children:s,...a}){return w.jsx(dae,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:Ne("rounded-md data-[size=sm]:rounded-[min(var(--radius-md),8px)] group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",e),...a,children:w.jsx(JH.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:s})})}function QD({className:e,children:t,variant:n="default",size:r="default",...i}){const s=O.useContext(JH);return w.jsx(cae,{"data-slot":"toggle-group-item","data-variant":s.variant||n,"data-size":s.size||r,"data-spacing":s.spacing,className:Ne("group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md shrink-0 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",kae({variant:s.variant||n,size:s.size||r}),e),...i,children:t})}async function $t(e,t){const n=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t?.headers}});if(n.status===401)throw window.dispatchEvent(new CustomEvent("vibora:auth-required")),new Error("Authentication required");if(!n.ok){const r=await n.json().catch(()=>({error:"Request failed"}));throw new Error(r.error||"Request failed")}return n.json()}const iu="";function TR(){return Mn({queryKey:["tasks"],queryFn:()=>$t(`${iu}/api/tasks`)})}function eF(e){return Mn({queryKey:["tasks",e],queryFn:()=>$t(`${iu}/api/tasks/${e}`),enabled:!!e})}function Oae(){const e=Sr();return zn({mutationFn:t=>$t(`${iu}/api/tasks`,{method:"POST",body:JSON.stringify({...t,status:"IN_PROGRESS"})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function Rae(){const e=Sr();return zn({mutationFn:({taskId:t,status:n,position:r})=>$t(`${iu}/api/tasks/${t}/status`,{method:"PATCH",body:JSON.stringify({status:n,position:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function OR(){const e=Sr();return zn({mutationFn:({taskId:t,updates:n})=>$t(`${iu}/api/tasks/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{taskId:n})=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["tasks",n]})}})}function tF(){const e=Sr();return zn({mutationFn:({taskId:t,deleteLinkedWorktree:n})=>{const r=n?`${iu}/api/tasks/${t}?deleteLinkedWorktree=true`:`${iu}/api/tasks/${t}`;return $t(r,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}const kf="";function Aae(e){return Mn({queryKey:["fs","list",e],queryFn:()=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return $t(`${kf}/api/fs/list${t}`)},enabled:e!==null})}function Pae(e){return Mn({queryKey:["git","branches",e],queryFn:()=>$t(`${kf}/api/git/branches?repo=${encodeURIComponent(e)}`),enabled:!!e})}function Mae(e,t={}){const{staged:n=!1,ignoreWhitespace:r=!1,includeUntracked:i=!1}=t;return Mn({queryKey:["git","diff",e,n,r,i],queryFn:()=>{const s=new URLSearchParams({path:e,...n&&{staged:"true"},...r&&{ignoreWhitespace:"true"},...i&&{includeUntracked:"true"}});return $t(`${kf}/api/git/diff?${s}`)},enabled:!!e,refetchInterval:5e3})}function jae(e){return Mn({queryKey:["fs","tree",e],queryFn:()=>$t(`${kf}/api/fs/tree?root=${encodeURIComponent(e)}`),enabled:!!e,staleTime:1e4})}function Lae(e,t,n){return Mn({queryKey:["fs","read",e,t,n?.maxLines],queryFn:()=>{const r=new URLSearchParams({path:t,root:e,...n?.maxLines});return $t(`${kf}/api/fs/read?${r}`)},enabled:!!e&&!!t})}async function Dae(e){return $t(`${kf}/api/fs/is-git-repo?path=${encodeURIComponent(e)}`)}const Do="",Bt={PORT:"server.port",WORKTREE_BASE_PATH:"worktree_base_path",DEFAULT_GIT_REPOS_DIR:"paths.defaultGitReposDir",BASIC_AUTH_USERNAME:"authentication.username",BASIC_AUTH_PASSWORD:"authentication.password",EDITOR_APP:"editor.app",EDITOR_HOST:"editor.host",EDITOR_SSH_PORT:"editor.sshPort",LINEAR_API_KEY:"integrations.linearApiKey",GITHUB_PAT:"integrations.githubPat",LANGUAGE:"appearance.language",THEME:"appearance.theme",SYNC_CLAUDE_CODE_THEME:"appearance.syncClaudeCodeTheme",CLAUDE_CODE_LIGHT_THEME:"appearance.claudeCodeLightTheme",CLAUDE_CODE_DARK_THEME:"appearance.claudeCodeDarkTheme"},Iae=7777;function hi(e){return Mn({queryKey:["config",e],queryFn:()=>$t(`${Do}/api/config/${e}`)})}function nF(){const e=hi(Bt.PORT);return{...e,data:e.data?.value??Iae,isDefault:e.data?.isDefault??!0}}function rF(){const e=hi(Bt.WORKTREE_BASE_PATH);return{...e,data:e.data?.value??""}}function RR(){const e=hi(Bt.DEFAULT_GIT_REPOS_DIR);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Y0(){const e=hi(Bt.EDITOR_APP);return{...e,data:e.data?.value??"vscode",isDefault:e.data?.isDefault??!0}}function X0(){const e=hi(Bt.EDITOR_HOST);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Q0(){const e=hi(Bt.EDITOR_SSH_PORT);return{...e,data:e.data?.value??22,isDefault:e.data?.isDefault??!0}}function Nae(){const e=hi(Bt.LINEAR_API_KEY);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Bae(){const e=hi(Bt.GITHUB_PAT);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function $ae(){const e=hi(Bt.LANGUAGE);return{...e,data:e.data?.value??null,isDefault:e.data?.isDefault??!0}}function zae(){const e=hi(Bt.THEME);return{...e,data:e.data?.value??"system",isDefault:e.data?.isDefault??!0}}function Hae(){const e=hi(Bt.SYNC_CLAUDE_CODE_THEME);return{...e,data:!!e.data?.value,isDefault:e.data?.isDefault??!0}}const ZD=["light","light-ansi","light-daltonized","dark","dark-ansi","dark-daltonized"];function Fae(){const e=hi(Bt.CLAUDE_CODE_LIGHT_THEME);return{...e,data:e.data?.value??"light-ansi",isDefault:e.data?.isDefault??!0}}function Uae(){const e=hi(Bt.CLAUDE_CODE_DARK_THEME);return{...e,data:e.data?.value??"dark-ansi",isDefault:e.data?.isDefault??!0}}function Vae(){const e=hi(Bt.BASIC_AUTH_USERNAME);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Wae(){const e=hi(Bt.BASIC_AUTH_PASSWORD);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function AR(){const e=Sr();return zn({mutationFn:({key:t,value:n})=>$t(`${Do}/api/config/${t}`,{method:"PUT",body:JSON.stringify({value:n})}),onSuccess:(t,{key:n})=>{e.invalidateQueries({queryKey:["config",n]}),n===Bt.GITHUB_PAT&&(e.invalidateQueries({queryKey:["github-user"]}),e.invalidateQueries({queryKey:["github-prs"]}),e.invalidateQueries({queryKey:["github-issues"]}),e.invalidateQueries({queryKey:["github-orgs"]}))}})}function qae(){const e=Sr();return zn({mutationFn:t=>$t(`${Do}/api/config/${t}`,{method:"DELETE"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["config",n]})}})}function Gae(){return Mn({queryKey:["config","notifications"],queryFn:()=>$t(`${Do}/api/config/notifications`)})}function Kae(){const e=Sr();return zn({mutationFn:t=>$t(`${Do}/api/config/notifications`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","notifications"]})}})}function Yae(){return zn({mutationFn:e=>$t(`${Do}/api/config/notifications/test/${e}`,{method:"POST"})})}function Xae(){return Mn({queryKey:["config","z-ai"],queryFn:()=>$t(`${Do}/api/config/z-ai`)})}function Qae(){const e=Sr();return zn({mutationFn:t=>$t(`${Do}/api/config/z-ai`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","z-ai"]}),e.invalidateQueries({queryKey:["monitoring","claude-usage"]})}})}function iF(){return Mn({queryKey:["config","developer-mode"],queryFn:()=>$t(`${Do}/api/config/developer-mode`),staleTime:1/0})}function Zae(){return zn({mutationFn:()=>$t(`${Do}/api/config/restart`,{method:"POST"})})}const Wm="";function PR(){return Mn({queryKey:["repositories"],queryFn:()=>$t(`${Wm}/api/repositories`)})}function Jae(e){return Mn({queryKey:["repositories",e],queryFn:()=>$t(`${Wm}/api/repositories/${e}`),enabled:!!e})}function sF(){const e=Sr();return zn({mutationFn:t=>$t(`${Wm}/api/repositories`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function ele(){const e=Sr();return zn({mutationFn:({id:t,updates:n})=>$t(`${Wm}/api/repositories/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{id:n})=>{e.invalidateQueries({queryKey:["repositories"]}),e.invalidateQueries({queryKey:["repositories",n]})}})}function oF(){const e=Sr();return zn({mutationFn:t=>$t(`${Wm}/api/repositories/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function $d({className:e,children:t,...n}){return w.jsxs(Yoe,{"data-slot":"scroll-area",className:Ne("relative",e),...n,children:[w.jsx(eae,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),w.jsx(tle,{}),w.jsx(iae,{})]})}function tle({className:e,orientation:t="vertical",...n}){return w.jsx(nae,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Ne("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none",e),...n,children:w.jsx(rae,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function MR({open:e,onOpenChange:t,onSelect:n,initialPath:r}){const[i,s]=O.useState(r||null),[a,o]=O.useState(""),[l,u]=O.useState("");O.useEffect(()=>{e&&(s(r||null),o(""),u(""))},[e,r]);const{data:h,isLoading:d,error:p}=Aae(e?i??"":null),v=S=>{h&&(s(h.path+"/"+S),u(""))},x=()=>{h?.parent&&h.parent!==h.path&&(s(h.parent),u(""))},b=()=>{s(null),u("")},g=()=>{a.trim()&&(s(a.trim()),u(""))},_=S=>{n(S),t(!1)},y=h?.entries.filter(S=>S.name.toLowerCase().includes(l.toLowerCase()));return w.jsx(zl,{open:e,onOpenChange:t,children:w.jsxs(Hl,{className:"sm:max-w-lg overflow-hidden",children:[w.jsxs(hu,{children:[w.jsx(pu,{children:"Select Git Repository"}),w.jsx(V0,{children:"Choose an existing git repository"})]}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Click folder names to navigate • Use action buttons to select"}),w.jsx(use,{}),w.jsxs("div",{className:"space-y-1",children:[w.jsx("label",{className:"text-xs font-medium",children:"Enter path manually:"}),w.jsxs("div",{className:"flex gap-2",children:[w.jsx(Xt,{value:a,onChange:S=>o(S.target.value),placeholder:"/path/to/your/project",onKeyDown:S=>S.key==="Enter"&&g(),className:"flex-1"}),w.jsx(He,{variant:"outline",size:"sm",onClick:g,children:"Go"})]})]}),w.jsxs("div",{className:"space-y-1",children:[w.jsx("label",{className:"text-xs font-medium",children:"Search current directory:"}),w.jsxs("div",{className:"relative",children:[w.jsx(me,{icon:Gz,size:14,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),w.jsx(Xt,{value:l,onChange:S=>u(S.target.value),placeholder:"Filter folders and files...",className:"pl-8"})]})]}),w.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[w.jsx(He,{variant:"outline",size:"icon-sm",onClick:b,title:"Home",className:"shrink-0",children:w.jsx(me,{icon:Ure,size:14,strokeWidth:2})}),w.jsx(He,{variant:"outline",size:"icon-sm",onClick:x,disabled:!h||h.parent===h.path,title:"Parent directory",className:"shrink-0",children:w.jsx(me,{icon:cR,size:14,strokeWidth:2})}),w.jsx("code",{className:"min-w-0 flex-1 text-xs bg-muted/50 px-2 py-1 rounded truncate overflow-hidden",children:h?.path||"~"}),w.jsxs(He,{variant:"outline",size:"sm",onClick:()=>h&&_(h.path),disabled:!h,className:"shrink-0 max-sm:px-2",title:"Select current directory",children:[w.jsx(me,{icon:Rk,size:14,strokeWidth:2,className:"sm:hidden"}),w.jsx("span",{className:"max-sm:hidden",children:"Select Current"})]})]}),w.jsx($d,{className:"h-64 border rounded-md",children:w.jsxs("div",{className:"p-1",children:[d&&w.jsx("div",{className:"text-muted-foreground text-xs p-3",children:"Loading..."}),p&&w.jsx("div",{className:"text-destructive text-xs p-3",children:p.message}),h&&y&&w.jsxs(w.Fragment,{children:[y.length===0&&w.jsx("div",{className:"text-muted-foreground text-xs p-3",children:l?"No matches found":"Empty directory"}),y.map(S=>w.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted group",children:S.type==="directory"?w.jsxs(w.Fragment,{children:[w.jsx(me,{icon:S.isGitRepo?Rk:Es,size:16,strokeWidth:2,className:(S.isGitRepo,"text-accent")}),w.jsx("button",{onClick:()=>v(S.name),className:"flex-1 text-left text-xs truncate hover:underline",children:S.name}),S.isGitRepo&&w.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-accent/50 text-accent font-medium shrink-0",children:[w.jsx("span",{className:"max-sm:hidden",children:"git repo"}),w.jsx("span",{className:"sm:hidden",children:"git"})]})]}):w.jsxs(w.Fragment,{children:[w.jsx("span",{className:"w-4"}),w.jsx("span",{className:"flex-1 text-xs text-muted-foreground truncate",children:S.name})]})},S.name))]})]})}),w.jsxs(Hm,{children:[w.jsx(pR,{render:w.jsx(He,{variant:"outline"}),children:"Cancel"}),w.jsx(He,{onClick:()=>h&&_(h.path),disabled:!h,children:"Select Path"})]})]})})}function nle(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function rle(e){const t=nle(e);if(!t)return"";const n=Math.random().toString(36).substring(2,6);return`${t}-${n}`}function jR({open:e,onOpenChange:t,defaultRepository:n,showTrigger:r=!0}={}){const{t:i}=Zt("tasks"),{t:s}=Zt("common"),[a,o]=O.useState(!1),l=e??a,u=t??o,[h,d]=O.useState(!1),[p,v]=O.useState(""),[x,b]=O.useState(""),[g,_]=O.useState(""),[y,S]=O.useState(""),[k,E]=O.useState(""),[T,A]=O.useState(""),[R,M]=O.useState("default"),[B,D]=O.useState(!1),[z,I]=O.useState(null),[W,U]=O.useState("browse"),[H,V]=O.useState(""),[q,N]=O.useState(null),[G,L]=O.useState(!1),$=Ta(),F=Oae(),Q=sF(),{data:ee}=rF(),{data:ie}=RR(),{data:X}=PR(),{data:K,isLoading:J}=Pae(g||null),ne=z?X?.find(le=>le.id===z):null,re=O.useMemo(()=>{if(!X)return[];if(ne&&H===ne.displayName||!H.trim())return X;const le=H.toLowerCase();return X.filter(Le=>Le.displayName.toLowerCase().includes(le)||Le.path.toLowerCase().includes(le))},[X,H,ne]);O.useEffect(()=>{X&&X.length>0?U("saved"):U("browse")},[X]),O.useEffect(()=>{if(l){if(n)I(n.id),_(n.path),V(n.displayName),U("saved");else if(X&&X.length>0){const le=X[0];I(le.id),_(le.path),V(le.displayName),U("saved")}}},[l,n,X]),O.useEffect(()=>{S(K?K.current||K.branches[0]||"main":"")},[K,g]);const Z=le=>{v(le),A(rle(le))},ae=async le=>{N(null),L(!0);try{if(!(await Dae(le)).isGitRepo){N(i("createModal.errors.notGitRepo")),L(!1);return}if(_(le),I(null),!X?.find(Be=>Be.path===le)){const Be=le.split("/").pop()||"Unknown";Q.mutate({path:le,displayName:Be})}}catch(Le){N(Le instanceof Error?Le.message:i("createModal.errors.validationFailed"))}finally{L(!1)}},ue=le=>{if(le.preventDefault(),!p.trim()||!g)return;const Le=g.split("/").pop()||"repo",ke=k.trim()||T,Be=`${ee}/${ke}`;F.mutate({title:p.trim(),description:x.trim(),repoPath:g,repoName:Le,baseBranch:y||"main",branch:ke,worktreePath:Be,copyFiles:ne?.copyFiles||void 0,startupScript:ne?.startupScript||void 0},{onSuccess:_e=>{const Re=x.trim()?{aiMode:R,description:x.trim()}:{aiMode:R};u(!1),v(""),b(""),_(""),S(""),E(""),A(""),M("default"),D(!1),I(null),V(""),N(null),U(X&&X.length>0?"saved":"browse"),$({to:"/tasks/$taskId",params:{taskId:_e.id},state:Re})}})},fe=k.trim()||T,he=fe?`${ee}/${fe}`:"";return w.jsxs(w.Fragment,{children:[w.jsxs(zl,{open:l,onOpenChange:u,children:[r&&w.jsxs(oH,{render:w.jsx(He,{size:"sm"}),children:[w.jsx(me,{icon:$l,size:16,strokeWidth:2,"data-slot":"icon"}),i("newTask")]}),w.jsx(Hl,{className:"sm:max-w-md max-h-[80dvh] flex flex-col overflow-hidden",children:w.jsxs("form",{onSubmit:ue,className:"flex flex-col min-h-0 flex-1",children:[w.jsxs(hu,{className:"shrink-0",children:[w.jsx(pu,{children:i("createModal.title")}),w.jsx(V0,{children:i("createModal.description")})]}),w.jsxs(Vm,{className:"mt-4 pb-4 overflow-y-auto min-h-0 flex-1",children:[w.jsxs(yr,{children:[w.jsx(br,{htmlFor:"title",children:i("createModal.fields.title")}),w.jsx(Xt,{id:"title",value:p,onChange:le=>Z(le.target.value),placeholder:i("createModal.fields.titlePlaceholder"),required:!0})]}),w.jsxs(yr,{children:[w.jsx(br,{htmlFor:"description",children:i("createModal.fields.description")}),w.jsx(cH,{id:"description",value:x,onValueChange:le=>{b(le),B||M(le.trim()?"plan":"default")},placeholder:i("createModal.fields.descriptionPlaceholder"),rows:2})]}),w.jsxs(yr,{children:[w.jsx(br,{children:i("createModal.fields.aiMode")}),w.jsxs(Tae,{value:[R],onValueChange:le=>{const Le=Array.isArray(le)?le[0]:le;Le&&(M(Le),D(!0))},className:"w-full",variant:"outline",children:[w.jsx(QD,{value:"plan",className:"flex-1",children:i("createModal.aiModes.plan")}),w.jsx(QD,{value:"default",className:"flex-1",children:i("createModal.aiModes.default")})]})]}),w.jsxs(yr,{children:[w.jsx(br,{children:i("createModal.fields.repository")}),w.jsxs(Ol,{value:W,onValueChange:le=>{U(le),N(null)},children:[w.jsxs(Rl,{children:[w.jsx(Yr,{value:"saved",disabled:!X?.length,children:i("createModal.tabs.saved")}),w.jsx(Yr,{value:"browse",children:i("createModal.tabs.browse")})]}),w.jsx(wi,{value:"saved",className:"mt-2",children:w.jsxs(yae,{value:z||"",onValueChange:le=>{const Le=X?.find(ke=>ke.id===le);Le&&(I(le),_(Le.path),V(Le.displayName),N(null))},inputValue:H,onInputValueChange:le=>{V(le),ne&&le!==ne.displayName&&I(null)},itemToStringLabel:le=>X?.find(Le=>Le.id===le)?.displayName||"",children:[w.jsx(xae,{placeholder:i("createModal.searchRepositories"),className:"w-full"}),w.jsx(Sae,{children:w.jsxs(wae,{children:[w.jsx(Eae,{children:i("createModal.noRepositoriesFound")}),re.map(le=>w.jsx(Cae,{value:le.id,children:le.displayName},le.id))]})})]})}),w.jsx(wi,{value:"browse",className:"mt-2",children:w.jsxs(He,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>d(!0),disabled:G,children:[w.jsx(me,{icon:Es,size:14,strokeWidth:2,className:"mr-2"}),G?w.jsx("span",{className:"text-muted-foreground",children:s("status.validating")}):g&&!z?w.jsx("span",{className:"truncate",children:g}):w.jsx("span",{className:"text-muted-foreground group-hover/button:text-accent-foreground",children:i("createModal.selectFolder")})]})})]}),q&&w.jsx("p",{className:"text-sm text-destructive",children:q}),g&&!q&&w.jsx(Vc,{className:"font-mono text-xs truncate",children:g})]}),w.jsxs(yr,{children:[w.jsx(br,{htmlFor:"baseBranch",children:i("createModal.fields.baseBranch")}),w.jsxs(qi,{value:y,onValueChange:le=>S(le??""),disabled:!g||J,children:[w.jsx(Ki,{className:"w-full",children:w.jsx(Gi,{children:y||w.jsx("span",{className:"text-muted-foreground",children:i(g?J?"createModal.loadingBranches":"createModal.selectBranch":"createModal.selectRepositoryFirst")})})}),w.jsx(Yi,{children:K?.branches.map(le=>w.jsxs(dn,{value:le,children:[le,le===K.current&&w.jsx("span",{className:"text-muted-foreground ml-2",children:i("createModal.current")})]},le))})]})]}),w.jsxs(yr,{children:[w.jsx(br,{htmlFor:"branch",children:i("createModal.fields.branchName")}),w.jsx(Xt,{id:"branch",value:k,onChange:le=>E(le.target.value),placeholder:T||i("createModal.fields.branchPlaceholder")}),he&&w.jsxs(Vc,{children:[i("createModal.worktreePrefix")," ",he]}),!k.trim()&&T&&w.jsx(Vc,{children:i("createModal.branchAutoGenerated",{branch:T})})]})]}),w.jsxs(Hm,{className:"mt-4 shrink-0",children:[w.jsx(pR,{render:w.jsx(He,{variant:"outline",type:"button",className:"border-destructive text-destructive hover:bg-destructive hover:text-white"}),children:s("buttons.cancel")}),w.jsx(He,{type:"submit",disabled:F.isPending||!p.trim()||!g,children:F.isPending?s("status.creating"):i("createModal.createTask")})]})]})})]}),w.jsx(MR,{open:h,onOpenChange:d,onSelect:ae,initialPath:ie||void 0})]})}const JD=[{to:"/tasks",icon:Qy,labelKey:"header.tasks",matchPrefix:!0},{to:"/terminals",icon:uR,labelKey:"header.terminals",matchPrefix:!1},{to:"/worktrees",icon:Wz,labelKey:"header.worktrees",matchPrefix:!0},{to:"/repositories",icon:Uz,labelKey:"header.repositories",matchPrefix:!0},{to:"/review",icon:Xy,labelKey:"header.review",matchPrefix:!0},{to:"/monitoring",icon:Dre,labelKey:"header.monitoring",matchPrefix:!0}];function ile({onNewTaskRef:e,onOpenCommandPalette:t}){const{t:n}=Zt("navigation"),{location:r}=xr(),i=r.pathname,[s,a]=O.useState(!1),o=(l,u)=>u?i.startsWith(l):i===l;return O.useEffect(()=>{e?.(()=>a(!0))},[e]),w.jsxs("header",{className:"sticky top-0 z-10 flex h-12 shrink-0 items-center justify-between border-b border-border bg-card px-4 max-sm:px-2",children:[w.jsxs("div",{className:"flex min-w-0 items-center gap-4 max-sm:gap-2",children:[w.jsx(eie,{className:"lg:hidden",children:w.jsx(tie,{children:w.jsxs(nie,{children:[w.jsxs(iie,{className:"bg-transparent hover:bg-muted/50 data-open:bg-muted/50 gap-1 px-2",children:[w.jsx(me,{icon:Yre,size:16,strokeWidth:2}),w.jsx("span",{className:"sr-only",children:"Menu"})]}),w.jsx(sie,{className:"min-w-48",children:JD.map(l=>w.jsxs(aie,{href:l.to,active:o(l.to,l.matchPrefix),render:w.jsx(di,{to:l.to}),children:[w.jsx(me,{icon:l.icon,size:16,strokeWidth:2}),n(l.labelKey)]},l.to))})]})})}),w.jsx("nav",{className:"hidden items-center gap-1 lg:flex",children:JD.map(l=>{const u=o(l.to,l.matchPrefix);return w.jsx(di,{to:l.to,children:w.jsxs(He,{variant:u?"secondary":"ghost",size:"sm",className:u?"dark:bg-transparent text-destructive":void 0,children:[w.jsx(me,{icon:l.icon,size:16,strokeWidth:2,"data-slot":"icon"}),n(l.labelKey)]})},l.to)})})]}),w.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[w.jsx(jR,{open:s,onOpenChange:a}),w.jsx(He,{variant:"ghost",size:"icon-sm",onClick:t,title:n("header.commandPalette",{shortcut:"⌘K"}),children:w.jsx(me,{icon:Ok,size:16,strokeWidth:2})}),w.jsx(di,{to:"/settings",children:w.jsx(He,{variant:i==="/settings"?"secondary":"ghost",size:"icon-sm",className:i==="/settings"?"dark:bg-transparent text-destructive":void 0,children:w.jsx(me,{icon:Kz,size:16,strokeWidth:2})})})]})]})}function sle(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}const ole=10,ale=2e3;function lle(){const e=Sr(),t=O.useRef(null),n=O.useRef(void 0),r=O.useRef(0),i=O.useRef(void 0),s=O.useCallback(o=>{try{const l=JSON.parse(o.data);if(l.type==="task:updated")e.invalidateQueries({queryKey:["tasks"]});else if(l.type==="notification"&&"payload"in l){const{title:u,message:h,notificationType:d,playSound:p}=l.payload;switch(d){case"success":Qt.success(u,{description:h});break;case"error":Qt.error(u,{description:h});break;case"warning":Qt.warning(u,{description:h});break;default:Qt.info(u,{description:h});break}if(p){const v=new Audio("/api/uploads/sound");v.onerror=()=>{new Audio("/sounds/goat-bleat.mp3").play().catch(()=>{})},v.play().catch(()=>{new Audio("/sounds/goat-bleat.mp3").play().catch(()=>{})})}window.parent!==window&&window.parent.postMessage({type:"vibora:notification",title:u,message:h,notificationType:d},"*")}}catch{}},[e]),a=O.useCallback(()=>{const o=t.current;if(o&&(o.readyState===WebSocket.CONNECTING||o.readyState===WebSocket.OPEN))return;const l=sle(),u=new WebSocket(l);t.current=u,u.onopen=()=>{r.current=0},u.onmessage=s,u.onclose=()=>{t.current===u&&(t.current=null),r.current<ole&&(r.current++,n.current=setTimeout(()=>{i.current?.()},ale))},u.onerror=()=>{}},[s]);i.current=a,O.useEffect(()=>(a(),()=>{n.current&&clearTimeout(n.current);const o=t.current;o&&(o.readyState===WebSocket.OPEN&&o.close(),t.current=null)}),[a])}const cle={save:"Save Changes",cancel:"Cancel",delete:"Delete",create:"Create",reset:"Reset to default",browse:"Browse",clearFilters:"Clear filters"},ule={loading:"Loading...",saving:"Saving...",saved:"Saved",error:"Error",calculating:"calculating...",validating:"Validating...",creating:"Creating...",deleting:"Deleting...",loggingIn:"Logging in..."},dle={justNow:"just now",minuteAgo:"1 minute ago",minutesAgo:"{{count}} minutes ago",hourAgo:"1 hour ago",hoursAgo:"{{count}} hours ago",dayAgo:"1 day ago",daysAgo:"{{count}} days ago"},fle={one:"{{count}} result",other:"{{count}} results"},hle={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled",ORPHANED:"Orphaned"},ple={loginTitle:"Login to Vibora",username:"Username",password:"Password",login:"Login",loginFailed:"Login failed"},mle={buttons:cle,status:ule,time:dle,results:fle,statuses:hle,auth:ple},gle={tasks:"Tasks",terminals:"Terminals",worktrees:"Worktrees",repositories:"Repositories",review:"Review",monitoring:"Monitoring",settings:"Settings",commandPalette:"Command Palette ({{shortcut}})"},vle={placeholder:"Type a command or search...",noResults:"No commands found.",categories:{navigation:"Navigation",actions:"Actions"},commands:{goToTasks:"Go to Tasks",goToTerminals:"Go to Terminals",goToTaskTerminals:"Go to Task Terminals",goToWorktrees:"Go to Worktrees",goToRepositories:"Go to Repositories",goToSettings:"Go to Settings",newTask:"New Task",keyboardShortcuts:"Keyboard Shortcuts"}},yle={title:"Keyboard Shortcuts",groups:{navigation:"Navigation",actions:"Actions",general:"General"},labels:{goToTasks:"Go to Tasks",goToTerminals:"Go to Terminals",goToTaskTerminals:"Go to Task Terminals",goToWorktrees:"Go to Worktrees",goToRepositories:"Go to Repositories",goToSettings:"Go to Settings",commandPalette:"Command Palette",newTask:"New Task",keyboardShortcuts:"Keyboard Shortcuts",closeModal:"Close Modal"}},ble={header:gle,commandPalette:vle,shortcuts:yle},_le="Tasks",xle="Search",Sle="All Repos",wle="New Task",Cle={title:"Create New Task",description:"Create a new task with a git worktree for isolated development.",fields:{title:"Title",titlePlaceholder:"Add user authentication",description:"Description",descriptionPlaceholder:"Implement OAuth2 login flow...",aiMode:"AI Mode",repository:"Repository",baseBranch:"Base Branch",branchName:"Branch Name",branchPlaceholder:"auto-generated-from-title"},aiModes:{plan:"Plan",default:"Default"},tabs:{saved:"Repos",browse:"Browse"},worktreePrefix:"Worktree:",branchAutoGenerated:'Will use "{{branch}}" if left empty.',selectFolder:"Select folder...",searchRepositories:"Search repositories...",noRepositoriesFound:"No repositories found",selectRepositoryFirst:"Select repository first",loadingBranches:"Loading branches...",selectBranch:"Select branch",current:"(current)",createTask:"Create Task",errors:{notGitRepo:"Selected folder is not a git repository",validationFailed:"Failed to validate repository"}},Ele={title:_le,searchPlaceholder:xle,allRepos:Sle,newTask:wle,createModal:Cle},kle="Settings",Tle={server:"Server",serverDefaults:"Server & Defaults",paths:"Paths",authentication:"Authentication",editor:"Editor",integrations:"Integrations",zai:"z.ai",notifications:"Notifications",appearance:"Appearance",developer:"Developer"},Ole={port:{label:"Port",description:"Requires restart"},startupCommand:{label:"Startup Command",description:"Command for new task terminals"},gitReposDir:{label:"Git Repos Directory",description:"Starting directory for repo picker"},editor:{app:{label:"Editor",description:"Code editor for opening worktrees",options:{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}},host:{label:"Remote Host",description:"For SSH URLs when code is on a remote machine",placeholder:"e.g., my-server.tailnet.ts.net"},sshPort:{label:"SSH Port",description:"Remote SSH port (default 22)"}},linear:{label:"Linear",description:"API key for ticket sync"},github:{label:"GitHub",description:"PAT for Issues & PRs"},auth:{username:"Username",password:"Password",usernamePlaceholder:"Leave empty to disable",passwordPlaceholder:"Leave empty to disable",passwordSet:"Enter new password to change",description:"Set both username and password to enable basic authentication. Leave empty to disable."},zai:{enable:"Enable",apiKey:"API Key",description:"Configures Claude Code to use z.ai proxy",modelMappings:"Model Mappings",haiku:"Haiku",sonnet:"Sonnet",opus:"Opus"},language:{label:"Language",description:"Interface language",options:{auto:"Auto-detect",en:"English",zh:"Chinese (Simplified)"}},theme:{label:"Theme",description:"Color theme for the interface",options:{system:"System",light:"Light",dark:"Dark"}},syncClaudeTheme:{label:"Sync Claude Code",description:"Automatically update Claude Code's theme when Vibora switches between light and dark mode"},claudeCodeTheme:{light:"Light mode",dark:"Dark mode",options:{light:"Light","light-ansi":"Light ANSI","light-daltonized":"Light (colorblind)",dark:"Dark","dark-ansi":"Dark ANSI","dark-daltonized":"Dark (colorblind)"}}},Rle={enable:"Enable Notifications",sound:"Sound",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"App Token",userKey:"User Key",testSuccess:"{{channel}} test successful",testFailed:"{{channel}} test failed: {{error}}",uploadSound:"Upload custom sound",deleteSound:"Remove custom sound",testSound:"Test sound",soundUploaded:"Custom sound uploaded",soundUploadFailed:"Failed to upload sound: {{error}}",soundDeleted:"Custom sound removed",soundDeleteFailed:"Failed to remove custom sound",customSoundActive:"Custom sound active"},Ale={restartButton:"Restart Vibora",restarting:"Restarting...",restartDescription:"Rebuild and restart the Vibora server. If the build fails, the server will continue running.",restartFailed:"Restart failed",checkLogs:"Build may have failed. Check journalctl --user -u vibora-dev for details."},Ple={title:"Unsaved Changes",description:"You have unsaved changes that will be lost if you leave this page.",stay:"Stay",leave:"Leave"},Mle={title:kle,sections:Tle,fields:Ole,notifications:Rle,developer:Ale,unsavedChanges:Ple},jle="Review",Lle={pullRequests:"Pull Requests",issues:"Issues"},Dle={pr:{created:"Created by me",assigned:"Assigned to me",reviewRequested:"Review requests",mentioned:"Mentioned"},issue:{assigned:"Assigned to me",created:"Created by me",mentioned:"Mentioned"},allOrgs:"All Orgs",allOrganizations:"All Organizations",viboraReposOnly:"Vibora repos only"},Ile={tokenRequired:"GitHub Token Required",tokenDescription:"To view your issues and pull requests, add a GitHub Personal Access Token in Settings.",requiredScopes:"Required scopes:",scopes:{repo:"(for private repositories)",readUser:"(for user info)",readOrg:"(for organization list)"},generateToken:"Generate Token",goToSettings:"Go to Settings"},Nle={loading:"Loading...",failedToLoad:"Failed to load pull requests",empty:{all:"No open pull requests",created:"No pull requests created by you",assigned:"No pull requests assigned to you",reviewRequested:"No pull requests awaiting your review",mentioned:"No pull requests mentioning you"},draft:"Draft"},Ble={loading:"Loading...",failedToLoad:"Failed to load issues",empty:{assigned:"No issues assigned to you",created:"No issues created by you",mentioned:"No issues mentioning you"}},$le={title:jle,tabs:Lle,filters:Dle,github:Ile,prs:Nle,issues:Ble},zle="Worktrees",Hle={total:"{{count}} total",orphaned:"{{count}} orphaned"},Fle={button:"Clean up ({{count}})",title:"Delete Completed Worktrees",description:"This will permanently delete {{count}} worktree(s).",linkedTasksWillBeDeleted:"Their linked tasks will also be deleted.",alsoDeleteLinkedTasks:"Also delete linked tasks",done:"Done",canceled:"Canceled",cannotUndo:"This action cannot be undone."},Ule={noMatch:"No worktrees match the selected filters.",noWorktrees:"No worktrees found. Worktrees are created when you create tasks."},Vle={failedToLoad:"Failed to load worktrees: {{message}}"},Wle={title:zle,summary:Hle,cleanup:Fle,delete:{title:"Delete Worktree",description:"This will permanently delete the worktree directory at",linkedTaskWillBeDeleted:'The linked task "{{title}}" will also be deleted.',alsoDeleteLinkedTask:'Also delete linked task "{{title}}"',cannotUndo:"This action cannot be undone.",button:"Delete {{count}}"},empty:Ule,error:Vle},qle="Monitoring",Gle={claude:"Claude Instances",system:"System Metrics",processes:"Processes",vibora:"Vibora Servers",usage:"Usage Limits"},Kle={showAllInstances:"Show all instances",instanceCount:"{{count}} instance(s) running",totalRam:"{{ram}} MB total",headers:{terminal:"Terminal",task:"Task",ram:"RAM",actions:"Actions",pid:"PID",workingDirectory:"Working Dir",source:"Source"},noTask:"(no task)",kill:"Kill",killing:"Killing...",source:{vibora:"Vibora: {{name}}",external:"External"},empty:"No Claude instances running",emptyVibora:" in Vibora terminals",error:"Failed to load Claude instances: {{message}}"},Yle={cpuUsage:"CPU Usage",memoryUsage:"Memory Usage",memoryLabels:{used:"Used",cache:"Cache / Buffers"},diskUsage:"Disk Usage ({{path}})",error:"Failed to load system metrics: {{message}}"},Xle={topProcesses:"Top Processes",sortBy:{memory:"By Memory",cpu:"By CPU"},headers:{pid:"PID",name:"Name",command:"Command",memory:"Memory"},empty:"No processes found",error:"Failed to load processes: {{message}}",containers:"Containers",containersEmpty:"No containers running",containersUnavailable:"Docker/Podman not available"},Qle={description:"Running Vibora dev servers",instanceCount:"{{count}} instance(s) running",headers:{port:"Port",mode:"Mode",directory:"Directory",ram:"RAM",actions:"Actions"},mode:{dev:"Dev",prod:"Prod"},vite:"Vite",kill:"Kill",killing:"Killing...",empty:"No Vibora instances running",error:"Failed to load Vibora instances: {{message}}"},Zle={fiveHourBlock:"5-Hour Block",sevenDayRolling:"7-Day Rolling",opusWeekly:"Opus Weekly",sonnetWeekly:"Sonnet Weekly",resetsIn:"Resets in {{time}}",resetsAt:"Resets {{time}}",weekProgress:"{{percent}}% through week",unavailable:"Claude Code usage data not available. Make sure you're logged in to Claude Code.",error:"Failed to load usage data: {{message}}"},Jle={title:qle,tabs:Gle,claude:Kle,system:Yle,processes:Xle,vibora:Qle,usage:Zle},ece="Task Terminals",tce="New Terminal",nce="All Repos",rce={taskTerminals:ece,newTerminal:tce,allRepos:nce},ice="Repositories",sce="{{count}} total",oce="New Task",ace="Add Repository",lce={openInVSCode:"Open in VS Code"},cce={title:"Add Repository",description:"Add a git repository for quick access when creating tasks.",fields:{path:"Repository Path",pathPlaceholder:"Select repository...",displayName:"Display Name",startupScript:"Startup Script",startupScriptPlaceholder:"npm install && npm run dev",startupScriptDescription:"Command to run in the terminal when creating a worktree.",copyFiles:"Copy Files",copyFilesPlaceholder:".env, config.local.json",copyFilesDescription:"Comma-separated glob patterns for files to copy into new worktrees."},adding:"Adding...",cancel:"Cancel"},uce={noRepositories:"No repositories added yet. Add a repository for quick access when creating tasks."},dce={failedToLoad:"Failed to load repositories: {{message}}"},fce={title:ice,total:sce,newTask:oce,addRepository:ace,card:lce,delete:{title:"Delete Repository",description:'This will remove "{{name}}" from Vibora. The actual repository files will not be affected.',button:"Delete",deleting:"Deleting..."},addModal:cce,empty:uce,error:dce},hce={save:"保存更改",cancel:"取消",delete:"删除",create:"创建",reset:"重置为默认值",browse:"浏览",clearFilters:"清除筛选"},pce={loading:"加载中...",saving:"保存中...",saved:"已保存",error:"错误",calculating:"计算中...",validating:"验证中...",creating:"创建中...",deleting:"删除中...",loggingIn:"登录中..."},mce={justNow:"刚刚",minuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",hourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",dayAgo:"1 天前",daysAgo:"{{count}} 天前"},gce={one:"{{count}} 个结果",other:"{{count}} 个结果"},vce={IN_PROGRESS:"进行中",IN_REVIEW:"审核中",DONE:"已完成",CANCELED:"已取消",ORPHANED:"孤立"},yce={loginTitle:"登录 Vibora",username:"用户名",password:"密码",login:"登录",loginFailed:"登录失败"},bce={buttons:hce,status:pce,time:mce,results:gce,statuses:vce,auth:yce},_ce={tasks:"任务",terminals:"终端",worktrees:"工作树",repositories:"仓库",review:"审核",monitoring:"监控",settings:"设置",commandPalette:"命令面板 ({{shortcut}})"},xce={placeholder:"输入命令或搜索...",noResults:"未找到命令",categories:{navigation:"导航",actions:"操作"},commands:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",newTask:"新建任务",keyboardShortcuts:"键盘快捷键"}},Sce={title:"键盘快捷键",groups:{navigation:"导航",actions:"操作",general:"通用"},labels:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",commandPalette:"命令面板",newTask:"新建任务",keyboardShortcuts:"键盘快捷键",closeModal:"关闭弹窗"}},wce={header:_ce,commandPalette:xce,shortcuts:Sce},Cce="任务",Ece="搜索",kce="全部仓库",Tce="新建任务",Oce={title:"创建新任务",description:"创建一个带有 Git 工作树的新任务,用于隔离开发。",fields:{title:"标题",titlePlaceholder:"添加用户认证",description:"描述",descriptionPlaceholder:"实现 OAuth2 登录流程...",aiMode:"AI 模式",repository:"仓库",baseBranch:"基础分支",branchName:"分支名称",branchPlaceholder:"自动生成分支名"},aiModes:{plan:"计划",default:"默认"},tabs:{saved:"仓库",browse:"浏览"},worktreePrefix:"工作树:",branchAutoGenerated:'留空将使用 "{{branch}}"。',selectFolder:"选择文件夹...",searchRepositories:"搜索仓库...",noRepositoriesFound:"未找到仓库",selectRepositoryFirst:"请先选择仓库",loadingBranches:"加载分支中...",selectBranch:"选择分支",current:"(当前)",createTask:"创建任务",errors:{notGitRepo:"所选文件夹不是 Git 仓库",validationFailed:"验证仓库失败"}},Rce={title:Cce,searchPlaceholder:Ece,allRepos:kce,newTask:Tce,createModal:Oce},Ace="设置",Pce={server:"服务器",serverDefaults:"服务器与默认设置",paths:"路径",authentication:"身份验证",editor:"编辑器",integrations:"集成",zai:"z.ai",notifications:"通知",appearance:"外观",developer:"开发者"},Mce={port:{label:"端口",description:"需要重启"},startupCommand:{label:"启动命令",description:"新任务终端的命令"},gitReposDir:{label:"Git 仓库目录",description:"仓库选择器的起始目录"},editor:{app:{label:"编辑器",description:"用于打开工作树的代码编辑器",options:{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}},host:{label:"远程主机",description:"代码在远程机器上时使用的 SSH 地址",placeholder:"例如:my-server.tailnet.ts.net"},sshPort:{label:"SSH 端口",description:"远程 SSH 端口(默认 22)"}},linear:{label:"Linear",description:"用于工单同步的 API 密钥"},github:{label:"GitHub",description:"用于 Issues 和 PR 的个人访问令牌"},auth:{username:"用户名",password:"密码",usernamePlaceholder:"留空以禁用",passwordPlaceholder:"留空以禁用",passwordSet:"输入新密码以更改",description:"同时设置用户名和密码以启用基本身份验证。留空以禁用。"},zai:{enable:"启用",apiKey:"API 密钥",description:"配置 Claude Code 使用 z.ai 代理",modelMappings:"模型映射",haiku:"Haiku",sonnet:"Sonnet",opus:"Opus"},language:{label:"语言",description:"界面语言",options:{auto:"自动检测",en:"English",zh:"简体中文"}},theme:{label:"主题",description:"界面颜色主题",options:{system:"跟随系统",light:"浅色",dark:"深色"}},syncClaudeTheme:{label:"同步 Claude Code",description:"当 Vibora 在浅色和深色模式之间切换时自动更新 Claude Code 的主题"},claudeCodeTheme:{light:"浅色模式",dark:"深色模式",options:{light:"浅色","light-ansi":"浅色 ANSI","light-daltonized":"浅色(色盲友好)",dark:"深色","dark-ansi":"深色 ANSI","dark-daltonized":"深色(色盲友好)"}}},jce={enable:"启用通知",sound:"声音",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"应用令牌",userKey:"用户密钥",testSuccess:"{{channel}} 测试成功",testFailed:"{{channel}} 测试失败:{{error}}",uploadSound:"上传自定义声音",deleteSound:"删除自定义声音",testSound:"测试声音",soundUploaded:"自定义声音已上传",soundUploadFailed:"上传声音失败:{{error}}",soundDeleted:"自定义声音已删除",soundDeleteFailed:"删除自定义声音失败",customSoundActive:"使用自定义声音"},Lce={restartButton:"重启 Vibora",restarting:"重启中...",restartDescription:"重新构建并重启 Vibora 服务器。如果构建失败,服务器将继续运行。",restartFailed:"重启失败",checkLogs:"构建可能失败。运行 journalctl --user -u vibora-dev 查看详情。"},Dce={title:"未保存的更改",description:"您有未保存的更改,离开此页面将丢失这些更改。",stay:"留下",leave:"离开"},Ice={title:Ace,sections:Pce,fields:Mce,notifications:jce,developer:Lce,unsavedChanges:Dce},Nce="审核",Bce={pullRequests:"拉取请求",issues:"问题"},$ce={pr:{created:"我创建的",assigned:"分配给我的",reviewRequested:"待我审核",mentioned:"提及我的"},issue:{assigned:"分配给我的",created:"我创建的",mentioned:"提及我的"},allOrgs:"所有组织",allOrganizations:"所有组织",viboraReposOnly:"仅 Vibora 仓库"},zce={tokenRequired:"需要 GitHub 令牌",tokenDescription:"要查看您的问题和拉取请求,请在设置中添加 GitHub 个人访问令牌。",requiredScopes:"所需权限:",scopes:{repo:"(用于私有仓库)",readUser:"(用于用户信息)",readOrg:"(用于组织列表)"},generateToken:"生成令牌",goToSettings:"前往设置"},Hce={loading:"加载中...",failedToLoad:"加载拉取请求失败",empty:{all:"没有打开的拉取请求",created:"没有您创建的拉取请求",assigned:"没有分配给您的拉取请求",reviewRequested:"没有等待您审核的拉取请求",mentioned:"没有提及您的拉取请求"},draft:"草稿"},Fce={loading:"加载中...",failedToLoad:"加载问题失败",empty:{assigned:"没有分配给您的问题",created:"没有您创建的问题",mentioned:"没有提及您的问题"}},Uce={title:Nce,tabs:Bce,filters:$ce,github:zce,prs:Hce,issues:Fce},Vce="工作树",Wce={total:"共 {{count}} 个",orphaned:"{{count}} 个孤立"},qce={button:"清理 ({{count}})",title:"删除已完成的工作树",description:"这将永久删除 {{count}} 个工作树。",linkedTasksWillBeDeleted:"关联的任务也将被删除。",alsoDeleteLinkedTasks:"同时删除关联的任务",done:"已完成",canceled:"已取消",cannotUndo:"此操作无法撤销。"},Gce={noMatch:"没有匹配所选筛选条件的工作树。",noWorktrees:"未找到工作树。工作树在创建任务时自动生成。"},Kce={failedToLoad:"加载工作树失败:{{message}}"},Yce={title:Vce,summary:Wce,cleanup:qce,delete:{title:"删除工作树",description:"这将永久删除位于以下位置的工作树目录",linkedTaskWillBeDeleted:'关联的任务 "{{title}}" 也将被删除。',alsoDeleteLinkedTask:'同时删除关联的任务 "{{title}}"',cannotUndo:"此操作无法撤销。",button:"删除 {{count}} 个"},empty:Gce,error:Kce},Xce="监控",Qce={claude:"Claude 实例",system:"系统指标",processes:"进程",vibora:"Vibora 服务器",usage:"使用限额"},Zce={showAllInstances:"显示所有实例",instanceCount:"{{count}} 个实例运行中",totalRam:"总计 {{ram}} MB",headers:{terminal:"终端",task:"任务",ram:"内存",actions:"操作",pid:"PID",workingDirectory:"工作目录",source:"来源"},noTask:"(无任务)",kill:"终止",killing:"终止中...",source:{vibora:"Vibora: {{name}}",external:"外部"},empty:"没有 Claude 实例运行中",emptyVibora:" (在 Vibora 终端中)",error:"加载 Claude 实例失败:{{message}}"},Jce={cpuUsage:"CPU 使用率",memoryUsage:"内存使用率",memoryLabels:{used:"已使用",cache:"缓存/缓冲区"},diskUsage:"磁盘使用率 ({{path}})",error:"加载系统指标失败:{{message}}"},eue={topProcesses:"热门进程",sortBy:{memory:"按内存",cpu:"按 CPU"},headers:{pid:"PID",name:"名称",command:"命令",memory:"内存"},empty:"未找到进程",error:"加载进程失败:{{message}}",containers:"容器",containersEmpty:"没有容器运行中",containersUnavailable:"Docker/Podman 不可用"},tue={description:"运行中的 Vibora 开发服务器",instanceCount:"{{count}} 个实例运行中",headers:{port:"端口",mode:"模式",directory:"目录",ram:"内存",actions:"操作"},mode:{dev:"开发",prod:"生产"},vite:"Vite",kill:"终止",killing:"终止中...",empty:"没有 Vibora 实例运行中",error:"加载 Vibora 实例失败:{{message}}"},nue={fiveHourBlock:"5小时配额",sevenDayRolling:"7天滚动配额",opusWeekly:"Opus 周配额",sonnetWeekly:"Sonnet 周配额",resetsIn:"{{time}}后重置",resetsAt:"{{time}}重置",weekProgress:"本周已过 {{percent}}%",unavailable:"Claude Code 使用数据不可用。请确保已登录 Claude Code。",error:"加载使用数据失败:{{message}}"},rue={title:Xce,tabs:Qce,claude:Zce,system:Jce,processes:eue,vibora:tue,usage:nue},iue="任务终端",sue="新建终端",oue="全部仓库",aue={taskTerminals:iue,newTerminal:sue,allRepos:oue},lue="仓库",cue="共 {{count}} 个",uue="新建任务",due="添加仓库",fue={openInVSCode:"在 VS Code 中打开"},hue={title:"添加仓库",description:"添加一个 Git 仓库,以便在创建任务时快速访问。",fields:{path:"仓库路径",pathPlaceholder:"选择仓库...",displayName:"显示名称",startupScript:"启动脚本",startupScriptPlaceholder:"npm install && npm run dev",startupScriptDescription:"创建工作树时在终端中运行的命令。",copyFiles:"复制文件",copyFilesPlaceholder:".env, config.local.json",copyFilesDescription:"用逗号分隔的 glob 模式,用于复制文件到新的工作树。"},adding:"添加中...",cancel:"取消"},pue={noRepositories:"尚未添加任何仓库。添加一个仓库以便在创建任务时快速访问。"},mue={failedToLoad:"加载仓库失败:{{message}}"},gue={title:lue,total:cue,newTask:uue,addRepository:due,card:fue,delete:{title:"删除仓库",description:'这将从 Vibora 中移除 "{{name}}"。实际的仓库文件不会受到影响。',button:"删除",deleting:"删除中..."},addModal:hue,empty:pue,error:mue},vue="common",Dk=["en","zh"],yue={en:{common:mle,navigation:ble,tasks:Ele,settings:Mle,review:$le,worktrees:Wle,monitoring:Jle,terminals:rce,repositories:fce},zh:{common:bce,navigation:wce,tasks:Rce,settings:Ice,review:Uce,worktrees:Yce,monitoring:rue,terminals:aue,repositories:gue}};function bue(){if(typeof window<"u"){const e=localStorage.getItem("vibora-language");if(e&&Dk.includes(e))return e;const t=navigator.language.split("-")[0];if(Dk.includes(t))return t}return"en"}ei.use(HZ).init({resources:yue,lng:bue(),fallbackLng:"en",defaultNS:vue,ns:["common","navigation","tasks","settings","review","worktrees","monitoring","terminals","repositories"],interpolation:{escapeValue:!1}});ei.on("languageChanged",e=>{typeof window<"u"&&localStorage.setItem("vibora-language",e)});function aF(){const{i18n:e}=Zt(),{data:t,isSuccess:n}=$ae(),r=AR();O.useEffect(()=>{n&&t&&t!==e.language&&e.changeLanguage(t)},[n,t,e]);const i=O.useCallback(async s=>{if(s)await e.changeLanguage(s);else{const a=navigator.language.split("-")[0],o=Dk.includes(a)?a:"en";await e.changeLanguage(o)}r.mutate({key:Bt.LANGUAGE,value:s??""})},[e,r]);return{language:e.language,savedLanguage:t,changeLanguage:i,isUpdating:r.isPending}}function lF(){const{setTheme:e,resolvedTheme:t,theme:n}=Am(),{data:r,isSuccess:i}=zae(),{data:s}=Hae(),a=AR(),o=O.useRef(void 0),l=O.useRef(void 0),u=O.useRef(!1);O.useEffect(()=>{i&&r&&r!==n&&e(r)},[i,r,n,e]),O.useEffect(()=>{if(!t)return;const d=t==="dark"?"/logo-dark.jpg":"/logo-light.jpg";let p=document.querySelector('link[rel="icon"]');p||(p=document.createElement("link"),p.rel="icon",document.head.appendChild(p)),p.type="image/jpeg",p.href=d},[t]),O.useEffect(()=>{const d=t&&t!==o.current,p=u.current&&s&&l.current===!1;o.current=t,l.current=s,u.current=!0,t&&s&&(d||p)&&$t("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:t})}).catch(()=>{})},[t,s]);const h=O.useCallback(d=>{e(d),a.mutate({key:Bt.THEME,value:d==="system"?"":d})},[e,a]);return{theme:n??"system",resolvedTheme:t,savedTheme:r,syncClaudeCode:s,changeTheme:h,isUpdating:a.isPending}}let ES=!1;const eI={activeTabId:null,focusedTerminals:{},currentView:null,currentTaskId:null,isTabVisible:null,viewUpdatedAt:null};function _ue(){const e=Sr(),t=O.useRef(void 0),n=O.useRef({}),{data:r=eI,isLoading:i}=Mn({queryKey:["terminal-view-state"],queryFn:async()=>{const p=await fetch("/api/terminal-view-state");if(!p.ok)throw new Error("Failed to fetch terminal view state");return p.json()},staleTime:2e3}),s=zn({mutationFn:async p=>{const v=await fetch("/api/terminal-view-state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!v.ok)throw new Error("Failed to update terminal view state");return v.json()},onSuccess:p=>{e.setQueryData(["terminal-view-state"],p)}}),a=O.useRef(s);a.current=s;const o=O.useCallback(p=>{const v=n.current;n.current={...v,...p,focusedTerminals:p.focusedTerminals||v.focusedTerminals?{...v.focusedTerminals,...p.focusedTerminals}:void 0};const x=n.current;e.setQueryData(["terminal-view-state"],b=>{const g=b??eI;return{activeTabId:g.activeTabId,focusedTerminals:{...g.focusedTerminals,...x.focusedTerminals},currentView:x.currentView!==void 0?x.currentView:g.currentView,currentTaskId:x.currentTaskId!==void 0?x.currentTaskId:g.currentTaskId,isTabVisible:x.isTabVisible!==void 0?x.isTabVisible:g.isTabVisible,viewUpdatedAt:x.viewUpdatedAt!==void 0?x.viewUpdatedAt:g.viewUpdatedAt}}),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{a.current.mutate(n.current),n.current={}},500)},[e]),l=O.useCallback((p,v)=>{if(v===null){const x=e.getQueryData(["terminal-view-state"]);if(x){const{[p]:b,...g}=x.focusedTerminals;o({focusedTerminals:g})}}else o({focusedTerminals:{[p]:v}})},[e,o]),u=O.useCallback(p=>r.focusedTerminals[p]??null,[r.focusedTerminals]),h=O.useRef(!1);O.useEffect(()=>{if(ES){h.current=!1;return}ES=!0,h.current=!0;const p=()=>{o({isTabVisible:document.visibilityState==="visible",viewUpdatedAt:new Date().toISOString()})};return document.addEventListener("visibilitychange",p),p(),()=>{document.removeEventListener("visibilitychange",p),h.current&&(ES=!1)}},[o]);const d=O.useCallback((p,v)=>{o({currentView:p,currentTaskId:v,viewUpdatedAt:new Date().toISOString()})},[o]);return{viewState:r,isLoading:i,getFocusedTerminal:u,setFocusedTerminal:l,updateViewTracking:d}}const cF=O.createContext(null);function xue({children:e}){const[t,n]=O.useState(!1),[r,i]=O.useState(!1),s=O.useCallback(u=>{n(u)},[]),a=O.useCallback(u=>{i(u)},[]),o=O.useMemo(()=>!t,[t]),l=O.useMemo(()=>({terminalFocused:t,setTerminalFocused:s,modalOpen:r,setModalOpen:a,shortcutsEnabled:o}),[t,s,r,a,o]);return w.jsx(cF.Provider,{value:l,children:e})}function LR(){const e=O.useContext(cF);if(!e)throw new Error("useKeyboardContext must be used within a KeyboardProvider");return e}function Sue(){return navigator.platform.toUpperCase().indexOf("MAC")>=0}function uF(e){const t=e.toLowerCase().split("+"),n=t.pop()||"";return{meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl"),alt:t.includes("alt")||t.includes("option"),shift:t.includes("shift"),key:n}}function wue(e,t){const n=uF(t);if(n.meta!==e.metaKey||n.ctrl!==e.ctrlKey||n.alt!==e.altKey||n.shift!==e.shiftKey)return!1;const r=e.key.toLowerCase(),i=n.key.toLowerCase();return i==="escape"?r==="escape":i==="enter"?r==="enter":i==="space"?r===" ":i==="backspace"?r==="backspace":i==="delete"?r==="delete":i==="tab"?r==="tab":i==="arrowup"?r==="arrowup":i==="arrowdown"?r==="arrowdown":i==="arrowleft"?r==="arrowleft":i==="arrowright"?r==="arrowright":/^[0-9]$/.test(i)?r===i:i==="/"&&!n.shift?r==="/":i==="/"&&n.shift||i==="?"?r==="?":i===","?r===",":i==="\\"?r==="\\":r===i}function dF(e){const t=uF(e),n=[],r=Sue();t.ctrl&&n.push("Ctrl"),t.alt&&n.push(r?"Option":"Alt"),t.shift&&n.push("Shift"),t.meta&&n.push(r?"Cmd":"Ctrl");let i=t.key.toUpperCase();return i==="ESCAPE"&&(i="Esc"),i==="ENTER"&&(i="Enter"),i==="SPACE"&&(i="Space"),i==="BACKSPACE"&&(i="Backspace"),i==="DELETE"&&(i="Delete"),i==="ARROWUP"&&(i="↑"),i==="ARROWDOWN"&&(i="↓"),i==="ARROWLEFT"&&(i="←"),i==="ARROWRIGHT"&&(i="→"),i===","&&(i=","),i==="/"&&(i="/"),i==="?"&&(i="?"),i==="\\"&&(i="\\"),n.push(i),n.join("+")}function Cue(e){if(!e||!(e instanceof HTMLElement))return!1;const t=e.tagName.toLowerCase();return!!(t==="input"||t==="textarea"||e.isContentEditable)}function ca(e,t,n={}){const{shortcutsEnabled:r}=LR(),{ignoreContext:i=!1,allowInInput:s=!1,allowInTerminal:a=!1,deps:o=[],enabled:l=!0}=n,u=O.useRef(t);u.current=t;const h=Array.isArray(e)?e:[e],d=O.useCallback(p=>{!i&&!r&&!a||!l||!s&&Cue(p.target)&&!h.some(b=>b.toLowerCase()==="escape")||!h.some(x=>wue(p,x))||(p.preventDefault(),p.stopPropagation(),u.current(p))},[r,i,s,a,l,...h,...o]);O.useEffect(()=>(document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}),[d])}function Sc(e,t){const n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return 100;if(n.startsWith(r))return 80;if(n.includes(r))return 60;let i=0,s=0,a=0;for(;i<n.length&&s<r.length;)n[i]===r[s]&&(a+=1,s++),i++;return s===r.length?a:0}function Eue(e,t){return t.trim()?e.map(r=>{let i=Sc(r.label,t);if(r.keywords)for(const s of r.keywords){const a=Sc(s,t);a>i&&(i=a)}return{command:r,score:i}}).filter(({score:r})=>r>0).sort((r,i)=>i.score-r.score).map(({command:r})=>r):e}function kue(e){const t=new Map;for(const n of e){const r=t.get(n.category)||[];r.push(n),t.set(n.category,r)}return t}function Tue({open:e,onOpenChange:t,onNewTask:n,onShowShortcuts:r}){const{t:i}=Zt("navigation"),[s,a]=O.useState(!1),o=e??s,l=t??a,[u,h]=O.useState(""),[d,p]=O.useState(0),v=O.useRef(null),x=O.useRef(null),b=Ta(),g=O.useMemo(()=>[{id:"goto-tasks",label:i("commandPalette.commands.goToTasks"),shortcut:"meta+1",keywords:["kanban","board","home"],category:"navigation",icon:w.jsx(me,{icon:Qy,size:16,strokeWidth:2}),action:()=>{b({to:"/tasks"}),l(!1)}},{id:"goto-terminals",label:i("commandPalette.commands.goToTerminals"),shortcut:"meta+2",keywords:["shell","console","cli"],category:"navigation",icon:w.jsx(me,{icon:uR,size:16,strokeWidth:2}),action:()=>{b({to:"/terminals"}),l(!1)}},{id:"goto-task-terminals",label:i("commandPalette.commands.goToTaskTerminals"),shortcut:"meta+i",keywords:["tasks","shell","console","cli"],category:"navigation",icon:w.jsx(me,{icon:Qy,size:16,strokeWidth:2}),action:()=>{b({to:"/terminals",search:{tab:"all-tasks"}}),l(!1)}},{id:"goto-worktrees",label:i("commandPalette.commands.goToWorktrees"),shortcut:"meta+3",keywords:["git","branches"],category:"navigation",icon:w.jsx(me,{icon:Wz,size:16,strokeWidth:2}),action:()=>{b({to:"/worktrees"}),l(!1)}},{id:"goto-repositories",label:i("commandPalette.commands.goToRepositories"),shortcut:"meta+4",keywords:["repos","git","projects"],category:"navigation",icon:w.jsx(me,{icon:Uz,size:16,strokeWidth:2}),action:()=>{b({to:"/repositories"}),l(!1)}},{id:"goto-settings",label:i("commandPalette.commands.goToSettings"),shortcut:"meta+,",keywords:["preferences","config","configuration"],category:"navigation",icon:w.jsx(me,{icon:Kz,size:16,strokeWidth:2}),action:()=>{b({to:"/settings"}),l(!1)}},{id:"new-task",label:i("commandPalette.commands.newTask"),shortcut:"meta+j",keywords:["create","add"],category:"actions",icon:w.jsx(me,{icon:$l,size:16,strokeWidth:2}),action:()=>{l(!1),n?.()}},{id:"show-shortcuts",label:i("commandPalette.commands.keyboardShortcuts"),shortcut:"meta+/",keywords:["help","hotkeys","keys"],category:"actions",icon:w.jsx(me,{icon:Fre,size:16,strokeWidth:2}),action:()=>{l(!1),r?.()}}],[b,n,r,l,i]),_=O.useMemo(()=>Eue(g,u),[g,u]),y=O.useMemo(()=>kue(_),[_]),S=O.useMemo(()=>{const T=[],A=["navigation","actions"];for(const R of A){const M=y.get(R);M&&T.push(...M)}return T},[y]);O.useEffect(()=>{p(0)},[u]),O.useEffect(()=>{if(!x.current)return;const T=x.current.querySelector('[data-selected="true"]');T&&T.scrollIntoView({block:"nearest"})},[d]),ca("meta+k",()=>l(!0),{allowInInput:!0,allowInTerminal:!0}),ca("meta+1",()=>b({to:"/tasks"}),{allowInInput:!0,allowInTerminal:!0}),ca("meta+2",()=>b({to:"/terminals"}),{allowInInput:!0,allowInTerminal:!0}),ca("meta+i",()=>{b({to:"/terminals",search:{tab:"all-tasks"}})},{allowInInput:!0,allowInTerminal:!0}),ca("meta+3",()=>b({to:"/worktrees"}),{allowInInput:!0,allowInTerminal:!0}),ca("meta+4",()=>b({to:"/repositories"}),{allowInInput:!0,allowInTerminal:!0}),ca("meta+,",()=>b({to:"/settings"}),{allowInInput:!0,allowInTerminal:!0}),ca("meta+j",()=>{n?.()},{allowInInput:!1,deps:[n]}),ca("meta+/",()=>{r?.()},{allowInInput:!0,allowInTerminal:!0,deps:[r]});const k=O.useCallback(T=>{switch(T.key){case"ArrowDown":T.preventDefault(),p(A=>Math.min(A+1,S.length-1));break;case"ArrowUp":T.preventDefault(),p(A=>Math.max(A-1,0));break;case"Enter":T.preventDefault(),S[d]&&S[d].action();break;case"Escape":T.preventDefault(),l(!1);break}},[S,d,l]);O.useEffect(()=>{o&&(h(""),p(0),setTimeout(()=>v.current?.focus(),50))},[o]);let E=0;return w.jsx(zl,{open:o,onOpenChange:l,children:w.jsxs(Hl,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden",showCloseButton:!1,onKeyDown:k,children:[w.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[w.jsx("span",{className:"text-muted-foreground mr-2",children:">"}),w.jsx(Xt,{ref:v,value:u,onChange:T=>h(T.target.value),placeholder:i("commandPalette.placeholder"),className:"border-0 ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 px-0 h-12"}),w.jsx("kbd",{className:"pointer-events-none ml-2 inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:"Esc"})]}),w.jsx("div",{ref:x,className:"max-h-80 overflow-y-auto p-2",children:_.length===0?w.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:i("commandPalette.noResults")}):w.jsx(w.Fragment,{children:["navigation","actions"].map(T=>{const A=y.get(T);return!A||A.length===0?null:w.jsxs("div",{className:"mb-2 last:mb-0",children:[w.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:i(`commandPalette.categories.${T}`)}),A.map(R=>{const M=E++,B=M===d;return w.jsxs("button",{"data-selected":B,onClick:()=>R.action(),onMouseEnter:()=>p(M),className:Ne("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm",B?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[R.icon&&w.jsx("span",{className:"text-muted-foreground",children:R.icon}),w.jsx("span",{className:"flex-1 text-left",children:R.label}),R.shortcut&&w.jsx("kbd",{className:"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:dF(R.shortcut)})]},R.id)})]},T)})})})]})})}const tI={sm:"w-8 h-8",md:"w-9 h-9 md:w-12 md:h-12",lg:"w-12 h-12 md:w-16 md:h-16"};function Oue({className:e,rows:t=100,cols:n=10,tileClassName:r,tileSize:i="md"}){return w.jsx("div",{className:Ne("relative z-0 flex w-full h-full justify-center",e),children:Array.from({length:t}).map((s,a)=>w.jsx("div",{className:Ne(tI[i],"border-l dark:border-neutral-900 border-neutral-200 relative",r),children:Array.from({length:n}).map((o,l)=>w.jsx("div",{className:Ne(tI[i],"border-r border-t dark:border-neutral-900 border-neutral-200 relative hover:bg-tile transition-colors",r)},`col-${l}`))},`row-${a}`))})}const Rue=["/","/tasks","/terminals","/worktrees","/repositories","/review","/monitoring","/settings"];function Aue(){const e=xr({select:n=>n.location.pathname});return Rue.some(n=>e===n||e.startsWith(n+"/"))?w.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none -z-10",children:w.jsx(Oue,{rows:100,cols:50,tileSize:"sm"})}):null}const Pue=[{titleKey:"navigation",items:[{labelKey:"goToTasks",shortcut:"meta+1"},{labelKey:"goToTerminals",shortcut:"meta+2"},{labelKey:"goToTaskTerminals",shortcut:"meta+i"},{labelKey:"goToWorktrees",shortcut:"meta+3"},{labelKey:"goToRepositories",shortcut:"meta+4"},{labelKey:"goToSettings",shortcut:"meta+,"}]},{titleKey:"actions",items:[{labelKey:"commandPalette",shortcut:"meta+k"},{labelKey:"newTask",shortcut:"meta+j"},{labelKey:"keyboardShortcuts",shortcut:"meta+/"}]},{titleKey:"general",items:[{labelKey:"closeModal",shortcut:"escape"}]}];function Mue({open:e,onOpenChange:t}){const{t:n}=Zt("navigation");return w.jsx(zl,{open:e,onOpenChange:t,children:w.jsxs(Hl,{className:"sm:max-w-md",children:[w.jsx(hu,{children:w.jsx(pu,{children:n("shortcuts.title")})}),w.jsx("div",{className:"space-y-4 mt-2",children:Pue.map(r=>w.jsxs("div",{children:[w.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:n(`shortcuts.groups.${r.titleKey}`)}),w.jsx("div",{className:"space-y-1",children:r.items.map(i=>w.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[w.jsx("span",{className:"text-sm",children:n(`shortcuts.labels.${i.labelKey}`)}),w.jsx("kbd",{className:"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:dF(i.shortcut)})]},i.shortcut))})]},r.titleKey))})]})})}const jue=({...e})=>{const{resolvedTheme:t}=Am();return w.jsx(ase,{theme:t,className:"toaster group",icons:{success:w.jsx(me,{icon:Ire,strokeWidth:2,className:"size-4"}),info:w.jsx(me,{icon:Wre,strokeWidth:2,className:"size-4"}),warning:w.jsx(me,{icon:Ef,strokeWidth:2,className:"size-4"}),error:w.jsx(me,{icon:Xre,strokeWidth:2,className:"size-4"}),loading:w.jsx(me,{icon:An,strokeWidth:2,className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e})},no=aQ({component:$ue});function Lue(){return lle(),null}function Due(){return aF(),null}function Iue(){return lF(),null}function Nue(){const e=xr({select:n=>n.location}),{updateViewTracking:t}=_ue();return O.useEffect(()=>{const n=e.pathname;let r="other",i=null;n.startsWith("/tasks/")?(r="task-detail",i=n.split("/")[2]||null):n==="/terminals"&&(r="terminals"),t(r,i)},[e.pathname,t]),null}function Bue(){const e=xr({select:t=>t.location});return O.useEffect(()=>{window.parent!==window&&window.parent.postMessage({type:"vibora:route",pathname:e.pathname,search:e.search},"*")},[e.pathname,e.search]),null}function $ue(){const[e,t]=O.useState(null),[n,r]=O.useState(!1),[i,s]=O.useState(!1),a=O.useCallback(h=>{t(()=>h)},[]),o=O.useCallback(()=>{e?.()},[e]),l=O.useCallback(()=>{r(!0)},[]),u=O.useCallback(()=>{s(!0)},[]);return w.jsx(xue,{children:w.jsxs("div",{className:"flex h-screen flex-col overflow-x-hidden bg-background text-foreground",children:[w.jsx(Lue,{}),w.jsx(Due,{}),w.jsx(Iue,{}),w.jsx(Nue,{}),w.jsx(Bue,{}),w.jsx(ile,{onNewTaskRef:a,onOpenCommandPalette:u}),w.jsxs("main",{className:"isolate flex-1 overflow-hidden relative",children:[w.jsx(Aue,{}),w.jsx(B7,{})]}),w.jsx(Tue,{open:i,onOpenChange:s,onNewTask:o,onShowShortcuts:l}),w.jsx(Mue,{open:n,onOpenChange:r}),w.jsx(jue,{position:"bottom-right"})]})})}const zue=Rs("/")({beforeLoad:()=>{throw S7({to:"/tasks"})}}),fF="";function Hue(){const[e,t]=O.useState(new Map),[n,r]=O.useState(null),[i,s]=O.useState(!0),[a,o]=O.useState(!1),[l,u]=O.useState(null),h=O.useRef(null),d=O.useRef(0),p=O.useCallback(()=>{h.current?.close(),s(!0),o(!1),u(null),t(new Map),r(null);const x=new EventSource(`${fF}/api/worktrees`);h.current=x,x.addEventListener("worktree:basic",b=>{const g=JSON.parse(b.data);d.current=g.length,t(new Map(g.map(_=>[_.path,{..._,size:0,sizeFormatted:"...",branch:"..."}]))),s(!1),o(g.length>0)}),x.addEventListener("worktree:details",b=>{const g=JSON.parse(b.data);t(_=>{const y=new Map(_),S=y.get(g.path);return S&&y.set(g.path,{...S,size:g.size,sizeFormatted:g.sizeFormatted,branch:g.branch}),y}),d.current--,d.current<=0&&o(!1)}),x.addEventListener("worktree:complete",b=>{const g=JSON.parse(b.data);r(g),o(!1),x.close()}),x.addEventListener("worktree:error",b=>{const{path:g}=JSON.parse(b.data);Ct.viewer.error("Error loading worktree details",{path:g}),d.current--,d.current<=0&&o(!1)}),x.onerror=()=>{u(new Error("Connection lost")),s(!1),o(!1),x.close()}},[]);return O.useEffect(()=>(p(),()=>{h.current?.close()}),[p]),{worktrees:O.useMemo(()=>Array.from(e.values()).sort((b,g)=>b.isOrphaned!==g.isOrphaned?b.isOrphaned?-1:1:new Date(g.lastModified).getTime()-new Date(b.lastModified).getTime()),[e]),summary:n,isLoading:i,isLoadingDetails:a,error:l,refetch:p}}function Fue(){const e=Sr();return zn({mutationFn:({worktreePath:t,repoPath:n,deleteLinkedTask:r})=>$t(`${fF}/api/worktrees`,{method:"DELETE",body:JSON.stringify({worktreePath:t,repoPath:n,deleteLinkedTask:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worktrees"]}),e.invalidateQueries({queryKey:["tasks"]})}})}const Uue=Dl("h-5 gap-1 rounded-full border border-transparent px-2 py-0.5 text-[0.625rem] font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-2.5! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground bg-input/20 dark:bg-input/30",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Wc({className:e,variant:t="default",render:n,...r}){return fae({defaultTagName:"span",props:Ro({className:Ne(Uue({className:e,variant:t}))},r),render:n,state:{slot:"badge",variant:t}})}function Zi({className:e,size:t="default",...n}){return w.jsx("div",{"data-slot":"card","data-size":t,className:Ne("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-lg py-4 text-xs/relaxed ring-1 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg group/card flex flex-col",e),...n})}function Vue({className:e,...t}){return w.jsx("div",{"data-slot":"card-header",className:Ne("gap-1 rounded-t-lg px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",e),...t})}function Wue({className:e,...t}){return w.jsx("div",{"data-slot":"card-title",className:Ne("text-sm font-medium",e),...t})}function qm({className:e,...t}){return w.jsx("div",{"data-slot":"card-content",className:Ne("px-4 group-data-[size=sm]/card:px-3",e),...t})}function Tf({...e}){return w.jsx(Wse,{"data-slot":"alert-dialog",...e})}function Of({...e}){return w.jsx(sH,{"data-slot":"alert-dialog-trigger",...e})}function que({...e}){return w.jsx(tH,{"data-slot":"alert-dialog-portal",...e})}function Gue({className:e,...t}){return w.jsx(Qz,{"data-slot":"alert-dialog-overlay",className:Ne("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50",e),...t})}function Rf({className:e,size:t="default",...n}){return w.jsxs(que,{children:[w.jsx(Gue,{}),w.jsx(eH,{"data-slot":"alert-dialog-content","data-size":t,className:Ne("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-3 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",e),...n})]})}function Af({className:e,...t}){return w.jsx("div",{"data-slot":"alert-dialog-header",className:Ne("grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Pf({className:e,...t}){return w.jsx("div",{"data-slot":"alert-dialog-footer",className:Ne("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function Mf({className:e,...t}){return w.jsx(iH,{"data-slot":"alert-dialog-title",className:Ne("text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function jf({className:e,...t}){return w.jsx(Zz,{"data-slot":"alert-dialog-description",className:Ne("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...t})}function hF({className:e,...t}){return w.jsx(He,{"data-slot":"alert-dialog-action",className:Ne(e),...t})}function Lf({className:e,variant:t="outline",size:n="default",...r}){return w.jsx(z0,{"data-slot":"alert-dialog-cancel",className:Ne(e),render:w.jsx(He,{variant:t,size:n}),...r})}const Gm=O.forwardRef(({className:e,...t},n)=>w.jsx(_oe,{ref:n,className:Ne("peer size-4 shrink-0 rounded border border-input ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-checked:bg-primary data-checked:border-primary data-checked:text-primary-foreground","flex items-center justify-center transition-colors",e),...t,children:w.jsx(xoe,{className:"flex items-center justify-center",children:w.jsx(me,{icon:fu,size:12,strokeWidth:3})})}));Gm.displayName="Checkbox";const Ik={IN_PROGRESS:"bg-muted-foreground/20 text-muted-foreground",IN_REVIEW:"bg-primary/20 text-primary",DONE:"bg-accent/20 text-accent",CANCELED:"bg-destructive/20 text-destructive",ORPHANED:"bg-destructive/20 text-destructive"},Kue=Rs("/worktrees/")({component:Zue});function Yue(){const{t:e}=Zt("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),s=Math.floor(i/1e3),a=Math.floor(s/60),o=Math.floor(a/60),l=Math.floor(o/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):o>0?o===1?e("time.hourAgo"):e("time.hoursAgo",{count:o}):a>0?a===1?e("time.minuteAgo"):e("time.minutesAgo",{count:a}):e("time.justNow")}}function nI({className:e}){return w.jsx("span",{className:`inline-block animate-pulse rounded bg-muted ${e}`})}function Xue({worktree:e,onDelete:t}){const{t:n}=Zt("common"),{t:r}=Zt("worktrees"),i=Yue(),[s,a]=O.useState(!1),[o,l]=O.useState(!1),[u,h]=O.useState(!1),d=e.sizeFormatted==="..."||e.branch==="...",p=!e.isOrphaned&&e.taskId,v=async()=>{l(!0);try{await t(e,u),a(!1)}catch{}finally{l(!1)}},x=b=>{a(b),b||h(!1)};return w.jsx(Zi,{className:"transition-colors hover:border-border/80",children:w.jsxs(qm,{className:"flex items-start justify-between gap-4 py-4",children:[w.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("span",{className:"truncate font-medium",children:e.name}),e.isOrphaned?w.jsx(Wc,{className:Ne("shrink-0",Ik.ORPHANED),children:n("statuses.ORPHANED")}):e.taskStatus?w.jsx(Wc,{className:Ne("shrink-0",Ik[e.taskStatus]),children:n(`statuses.${e.taskStatus}`)}):null]}),w.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx(me,{icon:Es,size:12,strokeWidth:2,className:"shrink-0"}),w.jsx("span",{className:"truncate font-mono",children:e.path})]}),w.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx(me,{icon:Ak,size:12,strokeWidth:2,className:"shrink-0"}),e.branch==="..."?w.jsx(nI,{className:"h-3 w-16"}):w.jsx("span",{className:"font-mono",children:e.branch})]}),w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx(me,{icon:Hre,size:12,strokeWidth:2,className:"shrink-0"}),e.sizeFormatted==="..."?w.jsx(nI,{className:"h-3 w-12"}):w.jsx("span",{children:e.sizeFormatted})]}),w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx(me,{icon:Lre,size:12,strokeWidth:2,className:"shrink-0"}),w.jsx("span",{children:i(e.lastModified)})]})]}),e.taskId&&e.taskTitle&&w.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:w.jsxs(di,{to:"/tasks/$taskId",params:{taskId:e.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[w.jsx("span",{className:"truncate",children:e.taskTitle}),w.jsx(me,{icon:$0,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),w.jsxs(Tf,{open:s,onOpenChange:x,children:[w.jsx(Of,{render:w.jsx(He,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:d}),children:w.jsx(me,{icon:zm,size:14,strokeWidth:2})}),w.jsxs(Rf,{children:[w.jsxs(Af,{children:[w.jsx(Mf,{children:r("delete.title")}),w.jsxs(jf,{children:[r("delete.description")," ",w.jsx("span",{className:"font-mono",children:e.name}),".",u&&p&&w.jsxs(w.Fragment,{children:[" ",r("delete.linkedTaskWillBeDeleted",{title:e.taskTitle})]})," ",r("delete.cannotUndo")]}),p&&w.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[w.jsx(Gm,{checked:u,onCheckedChange:b=>h(b===!0),disabled:o}),r("delete.alsoDeleteLinkedTask",{title:e.taskTitle})]})]}),w.jsxs(Pf,{children:[w.jsx(Lf,{disabled:o,children:n("buttons.cancel")}),w.jsxs(He,{variant:"destructive",onClick:v,disabled:o,className:"gap-2",children:[o&&w.jsx(me,{icon:An,size:14,strokeWidth:2,className:"animate-spin"}),n(o?"status.deleting":"buttons.delete")]})]})]})]})]})})}const Que=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function Zue(){const{t:e}=Zt("common"),{t}=Zt("worktrees"),{worktrees:n,summary:r,isLoading:i,isLoadingDetails:s,error:a,refetch:o}=Hue(),l=Fue(),[u,h]=O.useState(new Set),[d,p]=O.useState(!1),[v,x]=O.useState(!1),[b,g]=O.useState(!1),_=R=>{h(M=>{const B=new Set(M);return B.has(R)?B.delete(R):B.add(R),B})},y=()=>{h(new Set)},S=O.useMemo(()=>u.size===0?n:n.filter(R=>!!(R.isOrphaned&&u.has("ORPHANED")||R.taskStatus&&u.has(R.taskStatus))),[n,u]),k=O.useMemo(()=>n.filter(R=>R.taskStatus==="DONE"||R.taskStatus==="CANCELED"),[n]),E=async()=>{if(k.length!==0){x(!0);try{for(const R of k)await l.mutateAsync({worktreePath:R.path,repoPath:R.repoPath,deleteLinkedTask:b});p(!1),o()}catch{}finally{x(!1)}}},T=R=>{p(R),R||g(!1)},A=async(R,M)=>{await l.mutateAsync({worktreePath:R.path,repoPath:R.repoPath,deleteLinkedTask:M}),o()};return w.jsxs("div",{className:"flex h-full flex-col",children:[w.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border bg-background px-4 py-2",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsxs("div",{className:"flex items-center gap-4",children:[w.jsx("h1",{className:"text-sm font-medium",children:t("title")}),(r||n.length>0)&&w.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[w.jsx("span",{children:t("summary.total",{count:r?.total??n.length})}),(r?.orphaned??n.filter(R=>R.isOrphaned).length)>0&&w.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:r?.orphaned??n.filter(R=>R.isOrphaned).length})}),s?w.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):r?w.jsx("span",{children:r.totalSizeFormatted}):null]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[k.length>0&&w.jsxs(Tf,{open:d,onOpenChange:T,children:[w.jsxs(Of,{render:w.jsx(He,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:s}),children:[w.jsx(me,{icon:Nre,size:12,strokeWidth:2}),t("cleanup.button",{count:k.length})]}),w.jsxs(Rf,{children:[w.jsxs(Af,{children:[w.jsx(Mf,{children:t("cleanup.title")}),w.jsxs(jf,{children:[t("cleanup.description",{count:k.length}),b&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),w.jsxs("div",{className:"space-y-3",children:[w.jsxs("p",{className:"text-sm text-muted-foreground",children:[k.filter(R=>R.taskStatus==="DONE").length>0&&w.jsxs("span",{className:"mr-3",children:[w.jsx("span",{className:"font-medium text-accent",children:k.filter(R=>R.taskStatus==="DONE").length})," ",t("cleanup.done")]}),k.filter(R=>R.taskStatus==="CANCELED").length>0&&w.jsxs("span",{children:[w.jsx("span",{className:"font-medium text-destructive",children:k.filter(R=>R.taskStatus==="CANCELED").length})," ",t("cleanup.canceled")]})]}),w.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[w.jsx(Gm,{checked:b,onCheckedChange:R=>g(R===!0),disabled:v}),t("cleanup.alsoDeleteLinkedTasks")]}),w.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),w.jsxs(Pf,{children:[w.jsx(Lf,{disabled:v,children:e("buttons.cancel")}),w.jsxs(He,{variant:"destructive",onClick:E,disabled:v,className:"gap-2",children:[v&&w.jsx(me,{icon:An,size:14,strokeWidth:2,className:"animate-spin"}),v?e("status.deleting"):t("delete.button",{count:k.length})]})]})]})]}),u.size>0&&w.jsxs(He,{variant:"ghost",size:"sm",onClick:y,className:"gap-1.5 text-xs",children:[w.jsx(me,{icon:Ps,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),w.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:Que.map(R=>{const M=u.has(R);return w.jsx("button",{onClick:()=>_(R),className:Ne("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",M?Ik[R]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${R}`)},R)})})]}),w.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i&&w.jsx("div",{className:"flex items-center justify-center py-12",children:w.jsx(me,{icon:An,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),a&&w.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[w.jsx(me,{icon:Ef,size:20,strokeWidth:2}),w.jsx("span",{className:"text-sm",children:t("error.failedToLoad",{message:a.message})})]}),!i&&!a&&S.length===0&&w.jsx("div",{className:"py-12 text-muted-foreground",children:w.jsx("p",{className:"text-sm",children:u.size>0?t("empty.noMatch"):t("empty.noWorktrees")})}),!i&&w.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:S.map(R=>w.jsx(Xue,{worktree:R,onDelete:A},R.path))})]})]})}function yn(e,t="Assertion error"){if(!e)throw Error(t)}function zd({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function Nk(e,t){return t.sort(e==="horizontal"?Jue:ede)}function Jue(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function ede(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function pF(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function tde({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,s=Number.MAX_VALUE;for(const a of t){const{x:o,y:l}=pF(r,a),u=e==="horizontal"?o:l;u<s&&(s=u,i=a)}return yn(i,"No rect found"),i}function mF(e){const{element:t,orientation:n,panels:r,separators:i}=e,s=Nk(n,Array.from(t.children).filter(h=>h instanceof HTMLElement).map(h=>({element:h}))).map(({element:h})=>h),a=[];let o=!1,l,u=[];for(const h of s)if(h.hasAttribute("data-panel")){const d=r.find(p=>p.element===h);if(d){if(l){const p=l.element.getBoundingClientRect(),v=h.getBoundingClientRect();let x;if(o){const b=n==="horizontal"?new DOMRect(p.right,p.top,0,p.height):new DOMRect(p.left,p.bottom,p.width,0),g=n==="horizontal"?new DOMRect(v.left,v.top,0,v.height):new DOMRect(v.left,v.top,v.width,0);switch(u.length){case 0:{x=[b,g];break}case 1:{const _=u[0],y=tde({orientation:n,rects:[p,v],targetRect:_.element.getBoundingClientRect()});x=[_,y===p?g:b];break}default:{x=u;break}}}else u.length?x=u:x=[n==="horizontal"?new DOMRect(p.right,v.top,v.left-p.right,v.height):new DOMRect(v.left,p.bottom,v.width,v.top-p.bottom)];for(const b of x)a.push({group:e,groupSize:zd({group:e}),panels:[l,d],separator:"width"in b?void 0:b,rect:"width"in b?b:b.element.getBoundingClientRect()})}o=!1,l=d,u=[]}}else if(h.hasAttribute("data-separator")){const d=i.find(p=>p.element===h);d?u.push(d):(l=void 0,u=[])}else o=!0;return a}function nde(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function rde(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function ide(e){return e/100*window.innerHeight}function sde(e){return e/100*window.innerWidth}function ode(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function Wv({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,s]=ode(n);switch(s){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=rde(t,i);break}case"em":{r=nde(t,i);break}case"vh":{r=ide(i);break}case"vw":{r=sde(i);break}}return r}function Gs(e){return parseFloat(e.toFixed(3))}function rI(e){const{panels:t}=e,n=zd({group:e});return n===0?t.map(r=>({collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:i,panelConstraints:s}=r;let a=0;if(s.collapsedSize){const h=Wv({groupSize:n,panelElement:i,styleProp:s.collapsedSize});a=Gs(h/n*100)}let o;if(s.defaultSize){const h=Wv({groupSize:n,panelElement:i,styleProp:s.defaultSize});o=Gs(h/n*100)}let l=0;if(s.minSize){const h=Wv({groupSize:n,panelElement:i,styleProp:s.minSize});l=Gs(h/n*100)}let u=100;if(s.maxSize){const h=Wv({groupSize:n,panelElement:i,styleProp:s.maxSize});u=Gs(h/n*100)}return{collapsedSize:a,collapsible:s.collapsible===!0,defaultSize:o,minSize:l,maxSize:u,panelId:r.id}})}class ade{#e={};addListener(t,n){const r=this.#e[t];return r===void 0?this.#e[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=this.#e[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let i=!1,s=null;const a=Array.from(r);for(let o=0;o<a.length;o++){const l=a[o];try{l.call(null,n)}catch(u){s===null&&(i=!0,s=u)}}if(i)throw s}}removeAllListeners(){this.#e={}}removeListener(t,n){const r=this.#e[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}function ai(e,t,n=0){return Math.abs(Gs(e)-Gs(t))<=n}let ms={cursorFlags:0,interactionState:{state:"inactive"},mountedGroups:new Map};const qc=new ade;function Io(){return ms}function ks(e){const t=typeof e=="function"?e(ms):e;if(ms===t)return ms;const n=ms;return ms={...ms,...t},t.cursorFlags!==void 0&&qc.emit("cursorFlagsChange",ms.cursorFlags),t.interactionState!==void 0&&qc.emit("interactionStateChange",ms.interactionState),t.mountedGroups!==void 0&&(ms.mountedGroups.forEach((r,i)=>{r.derivedPanelConstraints.forEach(s=>{if(s.collapsible){const{layout:a}=n.mountedGroups.get(i)??{};if(a){const o=ai(s.collapsedSize,r.layout[s.panelId]),l=ai(s.collapsedSize,a[s.panelId]);o&&!l&&(i.inMemoryLastExpandedPanelSizes[s.panelId]=a[s.panelId])}}})}),qc.emit("mountedGroupsChange",ms.mountedGroups)),ms}const lde=e=>e,kS=()=>{},gF=1,vF=2,yF=4,bF=8,iI={coarse:10,precise:5};function cde({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.disableCursor)switch(s.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(r===0&&i===0)return null;switch(n){case"active":{const s=(e&gF)!==0,a=(e&vF)!==0,o=(e&yF)!==0,l=(e&bF)!==0;if(e){if(s)return o?"se-resize":l?"ne-resize":"e-resize";if(a)return o?"sw-resize":l?"nw-resize":"w-resize";if(o)return"s-resize";if(l)return"n-resize"}break}}return r>0&&i>0?"move":r>0?"ew-resize":"ns-resize"}let TS,fo;function DR(){fo===void 0&&(fo=new CSSStyleSheet,document.adoptedStyleSheets=[fo]);const{cursorFlags:e,interactionState:t}=Io();switch(t.state){case"active":case"hover":{const n=cde({cursorFlags:e,groups:t.hitRegions.map(i=>i.group),state:t.state}),r=`*{cursor: ${n} !important; ${t.state==="active"?"touch-action: none;":""} }`;if(TS===r)return;TS=r,n?fo.cssRules.length===0?fo.insertRule(r):fo.replaceSync(r):fo.cssRules.length===1&&fo.deleteRule(0);break}case"inactive":{TS=void 0,fo.cssRules.length===1&&fo.deleteRule(0);break}}}function ude(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Ip(e,t){return ai(e,t)?0:e>t?1:-1}function hd({panelConstraints:e,size:t}){const{collapsedSize:n=0,collapsible:r,maxSize:i=100,minSize:s=0}=e;if(Ip(t,s)<0)if(r){const a=(n+s)/2;Ip(t,a)<0?t=n:t=s}else t=s;return t=Math.min(i,t),t=Gs(t),t}function Np({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:s}){if(ai(e,0))return t;const a=Object.values(t),o=Object.values(i),l=[...a],[u,h]=r;yn(u!=null,"Invalid first pivot index"),yn(h!=null,"Invalid second pivot index");let d=0;if(s==="keyboard"){{const x=e<0?h:u,b=n[x];yn(b,`Panel constraints not found for index ${x}`);const{collapsedSize:g=0,collapsible:_,minSize:y=0}=b;if(_){const S=a[x];if(yn(S!=null,`Previous layout not found for panel index ${x}`),ai(S,g)){const k=y-S;Ip(k,Math.abs(e))>0&&(e=e<0?0-k:k)}}}{const x=e<0?u:h,b=n[x];yn(b,`No panel constraints found for index ${x}`);const{collapsedSize:g=0,collapsible:_,minSize:y=0}=b;if(_){const S=a[x];if(yn(S!=null,`Previous layout not found for panel index ${x}`),ai(S,y)){const k=S-g;Ip(k,Math.abs(e))>0&&(e=e<0?0-k:k)}}}}{const x=e<0?1:-1;let b=e<0?h:u,g=0;for(;;){const y=a[b];yn(y!=null,`Previous layout not found for panel index ${b}`);const S=hd({panelConstraints:n[b],size:100})-y;if(g+=S,b+=x,b<0||b>=n.length)break}const _=Math.min(Math.abs(e),Math.abs(g));e=e<0?0-_:_}{let x=e<0?u:h;for(;x>=0&&x<n.length;){const b=Math.abs(e)-Math.abs(d),g=a[x];yn(g!=null,`Previous layout not found for panel index ${x}`);const _=g-b,y=hd({panelConstraints:n[x],size:_});if(!ai(g,y)&&(d+=g-y,l[x]=y,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?x--:x++}}if(ude(o,l))return i;{const x=e<0?h:u,b=a[x];yn(b!=null,`Previous layout not found for panel index ${x}`);const g=b+d,_=hd({panelConstraints:n[x],size:g});if(l[x]=_,!ai(_,g)){let y=g-_,S=e<0?h:u;for(;S>=0&&S<n.length;){const k=l[S];yn(k!=null,`Previous layout not found for panel index ${S}`);const E=k+y,T=hd({panelConstraints:n[S],size:E});if(ai(k,T)||(y-=T-k,l[S]=T),ai(y,0))break;e>0?S--:S++}}}const p=Object.values(l).reduce((x,b)=>b+x,0);if(!ai(p,100,.1))return i;const v=Object.keys(i);return l.reduce((x,b,g)=>(x[v[g]]=b,x),{})}function Df(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Ip(e[n],t[n])!==0)return!1;return!0}function _F({event:e,hitRegions:t,initialLayoutMap:n,mountedGroups:r,pointerDownAtPoint:i}){let s=0;const a=new Map(r);t.forEach(o=>{const{group:l,groupSize:u}=o,{disableCursor:h,orientation:d,panels:p}=l;let v=0;i?d==="horizontal"?v=(e.clientX-i.x)/u*100:v=(e.clientY-i.y)/u*100:d==="horizontal"?v=e.clientX<0?-100:100:v=e.clientY<0?-100:100;const x=n.get(l),{defaultLayoutDeferred:b,derivedPanelConstraints:g,layout:_,separatorToPanels:y}=r.get(l)??{defaultLayoutDeferred:!1};if(g&&x&&_&&y){const S=Np({delta:v,initialLayout:x,panelConstraints:g,pivotIndices:o.panels.map(k=>p.indexOf(k)),prevLayout:_,trigger:"mouse-or-touch"});if(Df(S,_)){if(v!==0&&!h)switch(d){case"horizontal":{s|=v<0?gF:vF;break}case"vertical":{s|=v<0?yF:bF;break}}}else{a.set(o.group,{defaultLayoutDeferred:b,derivedPanelConstraints:g,layout:S,separatorToPanels:y});const k=o.group.panels.map(({id:E})=>E).join(",");o.group.inMemoryLayouts[k]=S}}}),ks({cursorFlags:s,mountedGroups:a}),DR()}function sI(e){if(e.defaultPrevented||e.relatedTarget!==null||e.clientX===0&&e.clientY===0)return;const{interactionState:t,mountedGroups:n}=Io();t.state==="active"&&t.hitRegions.forEach(r=>{e.currentTarget===r.group.element&&_F({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n})})}function Sy(e){const t=e.parentElement;yn(t,"Parent group element not found");const{mountedGroups:n}=Io();for(const[r]of n)if(r.element===t)return r;throw Error("Could not find parent Group for separator element")}function su({layout:e,panelConstraints:t}){const n=[...Object.values(e)],r=n.reduce((a,o)=>a+o,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(a=>`${a}%`).join(", ")}`);if(!ai(r,100)&&n.length>0)for(let a=0;a<t.length;a++){const o=n[a];yn(o!=null,`No layout data found for index ${a}`);const l=100/r*o;n[a]=l}let i=0;for(let a=0;a<t.length;a++){const o=n[a];yn(o!=null,`No layout data found for index ${a}`);const l=hd({panelConstraints:t[a],size:o});o!=l&&(i+=o-l,n[a]=l)}if(!ai(i,0))for(let a=0;a<t.length;a++){const o=n[a];yn(o!=null,`No layout data found for index ${a}`);const l=o+i,u=hd({panelConstraints:t[a],size:l});if(o!==u&&(i-=u-o,n[a]=u,ai(i,0)))break}const s=Object.keys(e);return n.reduce((a,o,l)=>(a[s[l]]=o,a),{})}function xF({groupId:e}){const t=()=>{const{mountedGroups:n}=Io();for(const[r,i]of n)if(r.id===e)return{group:r,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:s,layout:a,separatorToPanels:o}=t(),l=su({layout:n,panelConstraints:i});return r?a:(Df(a,l)||ks(u=>({mountedGroups:new Map(u.mountedGroups).set(s,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:l,separatorToPanels:o})})),l)}}}function SF(e){const{mountedGroups:t}=Io(),n=t.get(e);return yn(n,`Mounted Group ${e.id} not found`),n}function fc(e,t){const n=Sy(e),r=SF(n),i=n.separators.find(h=>h.element===e);yn(i,"Matching separator not found");const s=r.separatorToPanels.get(i);yn(s,"Matching panels not found");const a=s.map(h=>n.panels.indexOf(h)),o=xF({groupId:n.id}).getLayout(),l=Np({delta:t,initialLayout:o,panelConstraints:r.derivedPanelConstraints,pivotIndices:a,prevLayout:o,trigger:"keyboard"}),u=su({layout:l,panelConstraints:r.derivedPanelConstraints});Df(o,u)||ks(h=>({mountedGroups:new Map(h.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:u,separatorToPanels:r.separatorToPanels})}))}function oI(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Sy(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&fc(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&fc(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&fc(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&fc(t,-5);break}case"End":{e.preventDefault(),fc(t,100);break}case"Enter":{e.preventDefault();const r=Sy(t),{derivedPanelConstraints:i,layout:s,separatorToPanels:a}=SF(r),o=r.separators.find(d=>d.element===t);yn(o,"Matching separator not found");const l=a.get(o);yn(l,"Matching panels not found");const u=l[0],h=i.find(d=>d.panelId===u.id);if(yn(h,"Panel metadata not found"),h.collapsible){const d=s[u.id],p=h.collapsedSize===d?r.inMemoryLastExpandedPanelSizes[u.id]??h.minSize:h.collapsedSize;fc(t,p-d)}break}case"F6":{e.preventDefault();const r=Sy(t).separators.map(a=>a.element),i=Array.from(r).findIndex(a=>a===e.currentTarget);yn(i!==null,"Index not found");const s=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[s].focus();break}case"Home":{e.preventDefault(),fc(t,-100);break}}}function dde(e,t,n){let r,i={x:1/0,y:1/0};for(const s of t){const a=pF(n,s.rect);switch(e){case"horizontal":{a.x<=i.x&&(r=s,i=a);break}case"vertical":{a.y<=i.y&&(r=s,i=a);break}}}return r?{distance:i,hitRegion:r}:void 0}let qv;function fde(){return qv===void 0&&(typeof matchMedia=="function"?qv=!!matchMedia("(pointer:coarse)").matches:qv=!1),qv}function hde(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:cI(e),b:cI(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;yn(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:lI(aI(n.a)),b:lI(aI(n.b))};if(i.a===i.b){const s=r.childNodes,a={a:n.a.at(-1),b:n.b.at(-1)};let o=s.length;for(;o--;){const l=s[o];if(l===a.a)return 1;if(l===a.b)return-1}}return Math.sign(i.a-i.b)}const pde=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function mde(e){const t=getComputedStyle(wF(e)??e).display;return t==="flex"||t==="inline-flex"}function gde(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||mde(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||pde.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function aI(e){let t=e.length;for(;t--;){const n=e[t];if(yn(n,"Missing node"),gde(n))return n}return null}function lI(e){return e&&Number(getComputedStyle(e).zIndex)||0}function cI(e){const t=[];for(;e;)t.push(e),e=wF(e);return t}function wF(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}function vde(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function yde({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!(n instanceof HTMLElement)||n.contains(e)||e.contains(n))return!0;if(hde(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(vde(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function CF(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const s=fde()?iI.coarse:iI.precise,a=mF(i),o=dde(i.orientation,a,{x:e.clientX,y:e.clientY});o&&o.distance.x<=s&&o.distance.y<=s&&yde({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function uI(e){if(e.defaultPrevented)return;const{mountedGroups:t}=Io(),n=CF(e,t),r=new Set,i=new Set,s=new Set,a=new Map;let o=!1;n.forEach(l=>{r.add(l.group),l.panels.forEach(h=>{i.add(h)}),l.separator&&(s.add(l.separator),o||(o=!0,l.separator.element.focus()));const u=t.get(l.group);u&&a.set(l.group,u.layout)}),ks({interactionState:{hitRegions:n,initialLayoutMap:a,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}}),n.length&&e.preventDefault()}function dI(e){if(e.defaultPrevented)return;const{interactionState:t,mountedGroups:n}=Io();switch(t.state){case"active":{if(e.type!=="pointerleave"&&e.buttons===0){ks(r=>r.interactionState.state==="inactive"?r:{cursorFlags:0,interactionState:{state:"inactive"}});return}_F({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint});break}default:{const r=CF(e,n);r.length===0?t.state!=="inactive"&&ks({interactionState:{state:"inactive"}}):ks({interactionState:{hitRegions:r,state:"hover"}}),DR();break}}}function fI(e){if(e.defaultPrevented)return;e.preventDefault();const{interactionState:t}=Io();t.state==="active"&&(ks({cursorFlags:0,interactionState:{state:"inactive"}}),DR())}function hI(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const a=Gs(s.defaultSize);n+=a,r[s.panelId]=a}else r[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=Gs((100-n)/i);for(const a of e)a.defaultSize===void 0&&(r[a.panelId]=s)}return r}function bde(e,t,n){const r=n[0];if(!r)return;const i=e.panels.find(a=>a.element===t);if(!i||!i.onResize)return;const s=zd({group:e});i.onResize({asPercentage:Gs(r.inlineSize/s*100),inPixels:r.inlineSize},i.id)}function _de(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function xde(e){let t=!0;const n=new Set,r=new Set,i=new ResizeObserver(v=>{for(const x of v){const{borderBoxSize:b,target:g}=x;if(g===e.element){if(t){if(zd({group:e})===0)return;ks(_=>{const y=_.mountedGroups.get(e);if(y){const S=rI(e),k=y.defaultLayoutDeferred?hI(S):y.layout,E=su({layout:k,panelConstraints:S});return!y.defaultLayoutDeferred&&Df(k,E)&&_de(y.derivedPanelConstraints,S)?_:{mountedGroups:new Map(_.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,layout:E,separatorToPanels:y.separatorToPanels})}}return _})}}else bde(e,g,b)}});i.observe(e.element),e.panels.forEach(v=>{yn(!n.has(v.id),`Panel ids must be unique; id "${v.id}" was used more than once`),n.add(v.id),v.onResize&&i.observe(v.element)});const s=zd({group:e}),a=rI(e),o=e.panels.map(({id:v})=>v).join(",");let l=e.defaultLayout;l&&e.panels.length!==Object.keys(l).length&&(l=void 0);const u=e.inMemoryLayouts[o]??l??hI(a),h=su({layout:u,panelConstraints:a}),d=mF(e),p=ks(v=>{const x=new Map;return d.forEach(b=>{b.separator&&x.set(b.separator,b.panels)}),{mountedGroups:new Map(v.mountedGroups).set(e,{defaultLayoutDeferred:s===0,derivedPanelConstraints:a,layout:h,separatorToPanels:x})}});return e.element.addEventListener("pointerleave",sI),e.separators.forEach(v=>{yn(!r.has(v.id),`Separator ids must be unique; id "${v.id}" was used more than once`),r.add(v.id),v.element.addEventListener("keydown",oI)}),p.mountedGroups.size===1&&(window.addEventListener("pointerdown",uI),window.addEventListener("pointermove",dI),window.addEventListener("pointerup",fI)),function(){t=!1;const v=ks(x=>{const b=new Map(x.mountedGroups);return b.delete(e),{mountedGroups:b}});e.element.removeEventListener("pointerleave",sI),e.separators.forEach(x=>{x.element.removeEventListener("keydown",oI)}),v.mountedGroups.size===0&&(window.removeEventListener("pointerdown",uI),window.removeEventListener("pointermove",dI),window.removeEventListener("pointerup",fI)),i.disconnect()}}function IR(e){const t=O.useId();return`${e??t}`}const vu=typeof window<"u"?O.useLayoutEffect:O.useEffect;function NR(e){const t=O.useRef(e);return vu(()=>{t.current=e},[e]),O.useCallback(n=>t.current?.(n),[t])}function BR(...e){return NR(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Sde(e){const t=O.useRef({...e});return vu(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const EF="--react-resizable-panels--panel--pointer-events";function kF(e,t){const n=e.replace(/[^a-zA-Z0-9\-_]/g,""),r=t.replace(/[^a-zA-Z0-9\-_]/g,"");return`--react-resizable-panels--${n}--${r}`}const TF=O.createContext(null);function wde(e,t){const n=O.useRef({getLayout:()=>({}),setLayout:lde});O.useImperativeHandle(t,()=>n.current,[]),vu(()=>{Object.assign(n.current,xF({groupId:e}))})}function Cde({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:s,groupRef:a,id:o,onLayoutChange:l,orientation:u="horizontal",style:h,...d}){const p=O.useRef({}),v=NR(U=>{Df(p.current,U)||(p.current=U,l?.(U))}),x=IR(o),[b,g]=O.useState(!1),[_,y]=O.useState(null),[S,k]=O.useState(n??{}),[E,T]=O.useState([]),[A,R]=O.useState([]),M=O.useRef({lastExpandedPanelSizes:{},layouts:{}}),B=BR(y,s);wde(x,a);const D=O.useMemo(()=>({id:x,orientation:u,registerPanel:U=>(T(H=>Nk(u,[...H,U])),()=>{T(H=>H.filter(V=>V!==U))}),registerSeparator:U=>(R(H=>Nk(u,[...H,U])),()=>{R(H=>H.filter(V=>V!==U))})}),[x,u]),z=Sde({defaultLayout:n,disableCursor:r}),I=O.useRef(null);vu(()=>{if(_===null)return;const U={defaultLayout:z.defaultLayout,disableCursor:!!z.disableCursor,disabled:!!i,element:_,id:x,inMemoryLastExpandedPanelSizes:M.current.lastExpandedPanelSizes,inMemoryLayouts:M.current.layouts,orientation:u,panels:E,separators:A};I.current=U;const H=xde(U),V=Io().mountedGroups.get(U);if(V){const{defaultLayoutDeferred:G,derivedPanelConstraints:L,layout:$}=V;!G&&L.length>0&&(k($),v?.($))}const q=qc.addListener("interactionStateChange",G=>{G.state==="active"?g(G.hitRegions.some(L=>L.group===U)):g(!1)}),N=qc.addListener("mountedGroupsChange",G=>{const L=G.get(U);if(L){const{defaultLayoutDeferred:$,derivedPanelConstraints:F,layout:Q}=L;if($||F.length===0)return;k(Q),v?.(Q)}});return()=>{I.current=null,H(),q(),N()}},[i,_,x,v,u,E,A,z]),O.useEffect(()=>{const U=I.current;U&&(U.defaultLayout=n,U.disableCursor=!!r)});const W={[EF]:b?"none":void 0};for(const U in S){const H=kF(x,U),V=S[U];W[H]=V}return w.jsx(TF.Provider,{value:D,children:w.jsx("div",{...d,"aria-orientation":u,className:t,"data-group":!0,"data-testid":x,id:x,ref:B,style:{...h,...W,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap"},children:e})})}function $R(){const e=O.useContext(TF);return yn(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Ede({groupId:e,panelId:t}){const n=()=>{const{mountedGroups:o}=Io();for(const[l,{defaultLayoutDeferred:u,derivedPanelConstraints:h,layout:d,separatorToPanels:p}]of o)if(l.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:l,layout:d,separatorToPanels:p};throw Error(`Group ${e} not found`)},r=()=>{const o=n().derivedPanelConstraints.find(l=>l.panelId===t);if(o!==void 0)return o;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const o=n().group.panels.find(l=>l.id===t);if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const o=n().layout[t];if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},a=o=>{const l=s();if(o===l)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:d,layout:p,separatorToPanels:v}=n(),x=d.panels.findIndex(y=>y.id===t),b=x===d.panels.length-1,g=Np({delta:b?l-o:o-l,initialLayout:p,panelConstraints:h,pivotIndices:b?[x-1,x]:[x,x+1],prevLayout:p,trigger:"imperative-api"}),_=su({layout:g,panelConstraints:h});Df(p,_)||ks(y=>({mountedGroups:new Map(y.mountedGroups).set(d,{defaultLayoutDeferred:u,derivedPanelConstraints:h,layout:_,separatorToPanels:v})}))};return{collapse:()=>{const{collapsible:o,collapsedSize:l}=r(),u=s();o&&u!==l&&a(l)},expand:()=>{const{collapsible:o,collapsedSize:l,minSize:u}=r(),h=s();o&&h===l&&a(u)},getSize:()=>{const{group:o}=n(),l=s(),{element:u}=i(),h=o.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:l,inPixels:h}},isCollapsed:()=>{const{collapsible:o,collapsedSize:l}=r(),u=s();return o&&ai(l,u)},resize:o=>{if(s()!==o){let l;switch(typeof o){case"number":{const{group:u}=n(),h=zd({group:u});l=Gs(o/h*100);break}case"string":{l=parseFloat(o);break}}a(l)}}}}function kde(e,t){const{id:n}=$R(),r=O.useRef({collapse:kS,expand:kS,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:kS});O.useImperativeHandle(t,()=>r.current,[]),vu(()=>{Object.assign(r.current,Ede({groupId:n,panelId:e}))})}function Tde({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,elementRef:s,id:a,maxSize:o="100%",minSize:l="0%",onResize:u,panelRef:h,style:d,...p}){const v=!!a,x=IR(a),[b,g]=O.useState(null),_=BR(g,s),{id:y,registerPanel:S}=$R(),k=u!==null,E=NR(A=>{u?.(A,a)});vu(()=>{if(b!==null)return S({element:b,id:x,idIsStable:v,onResize:k?E:void 0,panelConstraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:o,minSize:l}})},[n,r,i,b,k,x,v,o,l,E,S]),kde(x,h);const T=kF(y,x);return w.jsx("div",{...p,"data-panel":!0,"data-testid":x,id:x,ref:_,style:{...Ode,flexBasis:0,flexGrow:`var(${T}, 1)`,flexShrink:1,overflow:"hidden",pointerEvents:`var(${EF})`},children:w.jsx("div",{className:t,style:{width:"100%",height:"100%",...d},children:e})})}const Ode={minHeight:"unset",maxHeight:"unset",height:"unset",minWidth:"unset",maxWidth:"unset",width:"unset",flex:"unset",flexBasis:"unset",flexShrink:"unset",flexGrow:"unset",border:"unset",borderWidth:"unset",padding:"unset",margin:"unset"};function Rde({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,s;const a=e[n],o=t.find(l=>l.panelId===n);if(o){const l=o.maxSize,u=s=o.collapsible?o.collapsedSize:o.minSize,h=[r,r+1];s=su({layout:Np({delta:u-a,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n],i=su({layout:Np({delta:l-a,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:a}}function Ade({children:e,className:t,elementRef:n,id:r,style:i,...s}){const a=IR(r),[o,l]=O.useState({}),[u,h]=O.useState("inactive"),[d,p]=O.useState(null),v=BR(p,n),{id:x,orientation:b,registerSeparator:g}=$R(),_=b==="horizontal"?"vertical":"horizontal";return vu(()=>{if(d!==null){const y={element:d,id:a},S=g(y),k=qc.addListener("interactionStateChange",T=>{h(T.state!=="inactive"&&T.hitRegions.some(A=>A.separator===y)?T.state:"inactive")}),E=qc.addListener("mountedGroupsChange",T=>{T.forEach(({derivedPanelConstraints:A,layout:R,separatorToPanels:M},B)=>{if(B.id===x){const D=M.get(y);if(D){const z=D[0],I=B.panels.indexOf(z);l(Rde({layout:R,panelConstraints:A,panelId:z.id,panelIndex:I}))}}})});return()=>{k(),E(),S()}}},[d,x,a,g]),w.jsx("div",{...s,"aria-controls":o.valueControls,"aria-orientation":_,"aria-valuemax":o.valueMax,"aria-valuemin":o.valueMin,"aria-valuenow":o.valueNow,children:e,className:t,"data-separator":u,"data-testid":a,id:a,ref:v,role:"separator",style:{flexBasis:"auto",...i,flexGrow:0,flexShrink:0},tabIndex:0})}function wc({className:e,direction:t,...n}){return w.jsx(Cde,{"data-slot":"resizable-panel-group",orientation:t,className:Ne("flex h-full w-full data-[orientation=vertical]:flex-col",e),...n})}function ys({...e}){return w.jsx(Tde,{"data-slot":"resizable-panel",...e})}function Cc({withHandle:e,className:t,...n}){return w.jsx(Ade,{"data-slot":"resizable-handle",className:Ne("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[orientation=vertical]:h-px data-[orientation=vertical]:w-full data-[orientation=vertical]:after:left-0 data-[orientation=vertical]:after:h-1 data-[orientation=vertical]:after:w-full data-[orientation=vertical]:after:translate-x-0 data-[orientation=vertical]:after:-translate-y-1/2 [&[data-orientation=vertical]>div]:rotate-90",t),...n,children:e&&w.jsx("div",{className:"bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"})})}var OS={exports:{}},pI;function Pde(){return pI||(pI=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(a,o,l){var u=this&&this.__decorate||function(y,S,k,E){var T,A=arguments.length,R=A<3?S:E===null?E=Object.getOwnPropertyDescriptor(S,k):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,S,k,E);else for(var M=y.length-1;M>=0;M--)(T=y[M])&&(R=(A<3?T(R):A>3?T(S,k,R):T(S,k))||R);return A>3&&R&&Object.defineProperty(S,k,R),R},h=this&&this.__param||function(y,S){return function(k,E){S(k,E,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=l(9042),p=l(9924),v=l(844),x=l(4725),b=l(2585),g=l(3656);let _=o.AccessibilityManager=class extends v.Disposable{constructor(y,S,k,E){super(),this._terminal=y,this._coreBrowserService=k,this._renderService=E,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let T=0;T<this._terminal.rows;T++)this._rowElements[T]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[T]);if(this._topBoundaryFocusListener=T=>this._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
26
|
+
`:"")+x)}catch(x){Qt.error("Failed to upload image"),Ct.kanban.error("Upload error",{error:String(x)})}finally{a(!1)}return}}};return w.jsxs("div",{className:"space-y-2",children:[w.jsxs("div",{className:"relative",children:[w.jsx(mR,{ref:o,value:e,onChange:h=>t(h.target.value),onPaste:u,className:Ne(s&&"opacity-50",n),disabled:s||r,...i}),s&&w.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50 rounded-md",children:w.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})})]}),l.length>0&&w.jsx("div",{className:"flex flex-wrap gap-2",children:l.map((h,d)=>w.jsx("a",{href:HD(h),target:"_blank",rel:"noopener noreferrer",className:"block",children:w.jsx("img",{src:HD(h),alt:`Attachment ${d+1}`,className:"h-16 w-auto rounded border object-cover hover:opacity-80 transition-opacity"})},d))})]})}function uH({className:e,...t}){return w.jsx("label",{"data-slot":"label",className:Ne("gap-2 text-xs/relaxed leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed",e),...t})}const cse=O.forwardRef(function(t,n){const{className:r,render:i,orientation:s="horizontal",...a}=t,o=O.useMemo(()=>({orientation:s}),[s]);return ct("div",t,{state:o,ref:n,props:[{role:"separator","aria-orientation":s},a]})});function use({className:e,orientation:t="horizontal",...n}){return w.jsx(cse,{"data-slot":"separator",orientation:t,className:Ne("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",e),...n})}function Vm({className:e,...t}){return w.jsx("div",{"data-slot":"field-group",className:Ne("gap-4 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4 group/field-group @container/field-group flex w-full flex-col",e),...t})}const dse=Dl("data-[invalid=true]:text-destructive gap-2 group/field flex w-full",{variants:{orientation:{vertical:"flex-col [&>*]:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center [&>[data-slot=field-label]]:flex-auto has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});function yr({className:e,orientation:t="vertical",...n}){return w.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:Ne(dse({orientation:t}),e),...n})}function br({className:e,...t}){return w.jsx(uH,{"data-slot":"field-label",className:Ne("has-data-checked:bg-primary/5 dark:has-data-checked:bg-primary/10 gap-2 group-data-[disabled=true]/field:opacity-50 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-2 group/field-label peer/field-label flex w-fit leading-snug","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...t})}function Vc({className:e,...t}){return w.jsx("p",{"data-slot":"field-description",className:Ne("text-muted-foreground text-left text-xs/relaxed [[data-variant=legend]+&]:-mt-1.5 leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance","last:mt-0 nth-last-2:-mt-1","[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",e),...t})}function dH(e){const t=O.useRef(!0);t.current&&(t.current=!1,e())}const fH=O.createContext(null),hH=O.createContext(null);function Lo(){const e=O.useContext(fH);if(e===null)throw new Error(qt(60));return e}function pH(){const e=O.useContext(hH);if(e===null)throw new Error(qt(61));return e}const mH=(e,t)=>Object.is(e,t);function Sa(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ac(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:Sa(r,t,n))}function Bd(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:Sa(r,t,n))}function gH(e,t,n){return e.filter(r=>!Sa(r,t,n))}function Lk(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function vH(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function pr(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Lk(e)}function Vs(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Lk(e.value):Lk(e)}function fse(e,t,n){if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??pr(e,n);if(Array.isArray(t)){const r=vH(t)?t.flatMap(i=>i.items):t;if(e==null){const i=r.find(s=>s.value==null);return i&&i.label!=null?i.label:pr(e,n)}if(typeof e!="object"){const i=r.find(s=>s&&s.value===e);return i&&i.label!=null?i.label:pr(e,n)}if("value"in e){const i=r.find(s=>s&&s.value===e.value);if(i&&i.label!=null)return i.label}}return pr(e,n)}function hse(e,t){return!Array.isArray(e)||e.length===0?"":e.map(n=>pr(n,t)).join(", ")}const xt={id:Te(e=>e.id),modal:Te(e=>e.modal),multiple:Te(e=>e.multiple),items:Te(e=>e.items),itemToStringLabel:Te(e=>e.itemToStringLabel),itemToStringValue:Te(e=>e.itemToStringValue),isItemEqualToValue:Te(e=>e.isItemEqualToValue),value:Te(e=>e.value),open:Te(e=>e.open),mounted:Te(e=>e.mounted),forceMount:Te(e=>e.forceMount),transitionStatus:Te(e=>e.transitionStatus),openMethod:Te(e=>e.openMethod),activeIndex:Te(e=>e.activeIndex),selectedIndex:Te(e=>e.selectedIndex),isActive:Te((e,t)=>e.activeIndex===t),isSelected:Te((e,t,n)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(s=>Sa(s,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Sa(i,n,r)}),isSelectedByFocus:Te((e,t)=>e.selectedIndex===t),popupProps:Te(e=>e.popupProps),triggerProps:Te(e=>e.triggerProps),triggerElement:Te(e=>e.triggerElement),positionerElement:Te(e=>e.positionerElement),listElement:Te(e=>e.listElement),scrollUpArrowVisible:Te(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Te(e=>e.scrollDownArrowVisible),hasScrollArrows:Te(e=>e.hasScrollArrows),serializedValue:Te(e=>{const{multiple:t,value:n,itemToStringValue:r}=e;return t&&Array.isArray(n)&&n.length===0?"":Vs(n,r)})};function Pc(e,t){const n=O.useRef(e),r=Ie(t);ze(()=>{n.current!==e&&r(n.current)},[e,r]),ze(()=>{n.current=e},[e])}function pse(e){const{id:t,value:n,defaultValue:r=null,onValueChange:i,open:s,defaultOpen:a=!1,onOpenChange:o,name:l,disabled:u=!1,readOnly:h=!1,required:d=!1,modal:p=!0,actionsRef:v,inputRef:x,onOpenChangeComplete:b,items:g,multiple:_=!1,itemToStringLabel:y,itemToStringValue:S,isItemEqualToValue:k=mH,highlightItemOnHover:E=!0,children:T}=e,{clearErrors:A}=Fm(),{setDirty:R,shouldValidateOnChange:M,validityData:B,setFilled:D,name:z,disabled:I,validation:W}=Ms(),{controlId:U}=Fl(),H=W0({id:t}),V=I||u,q=z??l,[N,G]=Qi({controlled:n,default:_?r??ci:r,name:"Select",state:"value"}),[L,$]=Qi({controlled:s,default:a,name:"Select",state:"open"}),F=O.useRef([]),Q=O.useRef([]),ee=O.useRef(null),ie=O.useRef(null),X=O.useRef(0),K=O.useRef(null),J=O.useRef([]),ne=O.useRef(!1),re=O.useRef(!1),Z=O.useRef(null),ae=O.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ue=O.useRef(!1),{mounted:fe,setMounted:he,transitionStatus:le}=eo(L),{openMethod:Le,triggerProps:ke,reset:Be}=U0(L),_e=zr(()=>new Uc({id:H,modal:p,multiple:_,itemToStringLabel:y,itemToStringValue:S,isItemEqualToValue:k,value:N,open:L,mounted:fe,transitionStatus:le,items:g,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Re=De(_e,xt.activeIndex),ge=De(_e,xt.selectedIndex),Se=De(_e,xt.triggerElement),we=De(_e,xt.positionerElement),We=O.useMemo(()=>_&&Array.isArray(N)&&N.length===0?"":Vs(N,S),[_,N,S]),it=O.useMemo(()=>_&&Array.isArray(N)?N.map(ht=>Vs(ht,S)):Vs(N,S),[_,N,S]),Ae=Rn(_e.state.triggerElement);Um({id:H,commit:W.commit,value:N,controlRef:Ae,name:q,getValue:()=>it});const Ve=O.useRef(N);ze(()=>{N!==Ve.current&&_e.set("forceMount",!0)},[_e,N]),ze(()=>{D(N!==null)},[N,D]),ze(function(){if(L)return;const jt=J.current;if(_){const Ot=Array.isArray(N)?N:[];if(Ot.length===0){_e.set("selectedIndex",null);return}const tt=Ot[Ot.length-1],Yt=Bd(jt,tt,k);_e.set("selectedIndex",Yt===-1?null:Yt);return}const Tt=Bd(jt,N,k);_e.set("selectedIndex",Tt===-1?null:Tt)},[_,L,N,J,k,_e]),Pc(N,()=>{A(q),R(N!==B.initialValue),M()?W.commit(N):W.commit(N,!0)});const qe=Ie((ht,jt)=>{if(o?.(ht,jt),!jt.isCanceled&&($(ht),!ht&&_e.state.activeIndex!==null)){const Tt=F.current[_e.state.activeIndex];queueMicrotask(()=>{Tt?.setAttribute("tabindex","-1")})}}),mt=Ie(()=>{he(!1),_e.set("activeIndex",null),Be(),b?.(!1)});Jr({enabled:!v,open:L,ref:ee,onComplete(){L||mt()}}),O.useImperativeHandle(v,()=>({unmount:mt}),[mt]);const Ge=Ie((ht,jt)=>{i?.(ht,jt),!jt.isCanceled&&G(ht)}),Xe=Ie(()=>{const ht=_e.state.listElement||ee.current;if(!ht)return;const jt=ht.scrollTop,Tt=ht.scrollTop+ht.clientHeight,Ot=jt>1,tt=Tt<ht.scrollHeight-1;_e.state.scrollUpArrowVisible!==Ot&&_e.set("scrollUpArrowVisible",Ot),_e.state.scrollDownArrowVisible!==tt&&_e.set("scrollDownArrowVisible",tt)}),Oe=M0({open:L,onOpenChange:qe,elements:{reference:Se,floating:we}}),st=Sf(Oe,{enabled:!h&&!V,event:"mousedown"}),ut=Dm(Oe,{bubbles:!1}),Ze=rR(Oe,{enabled:!h&&!V,listRef:F,activeIndex:Re,selectedIndex:ge,disabledIndices:ci,onNavigate(ht){ht===null&&!L||_e.set("activeIndex",ht)},focusItemOnHover:!1}),at=iR(Oe,{enabled:!h&&!V&&(L||!_),listRef:Q,activeIndex:Re,selectedIndex:ge,onMatch(ht){L?_e.set("activeIndex",ht):Ge(J.current[ht],Ue("none"))},onTypingChange(ht){ne.current=ht}}),{getReferenceProps:It,getFloatingProps:ft,getItemProps:_n}=du([st,ut,Ze,at]),Mt=O.useMemo(()=>Ro(It(),ke),[It,ke]);dH(()=>{_e.update({popupProps:ft(),triggerProps:Mt})}),ze(()=>{_e.update({id:H,modal:p,multiple:_,value:N,open:L,mounted:fe,transitionStatus:le,popupProps:ft(),triggerProps:Mt,items:g,itemToStringLabel:y,itemToStringValue:S,isItemEqualToValue:k,openMethod:Le})},[_e,H,p,_,N,L,fe,le,ft,Mt,g,y,S,k,Le]);const Et=O.useMemo(()=>({store:_e,name:q,required:d,disabled:V,readOnly:h,multiple:_,itemToStringLabel:y,itemToStringValue:S,highlightItemOnHover:E,setValue:Ge,setOpen:qe,listRef:F,popupRef:ee,scrollHandlerRef:ie,handleScrollArrowVisibility:Xe,scrollArrowsMountedCountRef:X,getItemProps:_n,events:Oe.context.events,valueRef:K,valuesRef:J,labelsRef:Q,typingRef:ne,selectionRef:ae,selectedItemTextRef:Z,validation:W,onOpenChangeComplete:b,keyboardActiveRef:re,alignItemWithTriggerActiveRef:ue,initialValueRef:Ve}),[_e,q,d,V,h,_,y,S,E,Ge,qe,_n,Oe.context.events,W,b,Xe]),et=As(x,W.inputRef),zt=_&&Array.isArray(N)&&N.length>0,Kt=O.useMemo(()=>!_||!Array.isArray(N)||!q?null:N.map(ht=>{const jt=Vs(ht,S);return w.jsx("input",{type:"hidden",name:q,value:jt},jt)}),[_,N,q,S]);return w.jsx(fH.Provider,{value:Et,children:w.jsxs(hH.Provider,{value:Oe,children:[T,w.jsx("input",{...W.getInputValidationProps({onFocus(){_e.state.triggerElement?.focus()},onChange(ht){if(ht.nativeEvent.defaultPrevented)return;const jt=ht.target.value,Tt=Ue(gr,ht.nativeEvent);function Ot(){if(_)return;const tt=J.current.find(Yt=>Vs(Yt,S).toLowerCase()===jt.toLowerCase());tt!=null&&(R(tt!==B.initialValue),Ge(tt,Tt),M()&&W.commit(tt))}_e.set("forceMount",!0),queueMicrotask(Ot)}}),id:t||U||void 0,name:_?void 0:q,value:We,disabled:V,required:d&&!zt,readOnly:h,ref:et,style:xf,tabIndex:-1,"aria-hidden":!0}),Kt]})})}function gR(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||r.content!=="none"))return t;const s=parseFloat(n.width)||0,a=parseFloat(n.height)||0,o=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=Math.max(t.width,s,o),h=Math.max(t.height,a,l),d=u-t.width,p=h-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const zv=2,mse={...Nd,...mu,value:()=>null},gse=O.forwardRef(function(t,n){const{render:r,className:i,disabled:s=!1,nativeButton:a=!0,...o}=t,{setTouched:l,setFocused:u,validationMode:h,state:d,disabled:p}=Ms(),{labelId:v}=Fl(),{store:x,setOpen:b,selectionRef:g,validation:_,readOnly:y,alignItemWithTriggerActiveRef:S,disabled:k,keyboardActiveRef:E}=Lo(),T=p||k||s,A=De(x,xt.open),R=De(x,xt.value),M=De(x,xt.triggerProps),B=De(x,xt.positionerElement),D=De(x,xt.listElement),z=De(x,xt.serializedValue),I=Rn(B),W=O.useRef(null),U=fn(),H=fn(),{getButtonProps:V,buttonRef:q}=fi({disabled:T,native:a}),N=Ie(ie=>{x.set("triggerElement",ie)}),G=As(n,W,q,N),L=fn(),$=fn();O.useEffect(()=>{if(A)return $.start(200,()=>{g.current.allowUnselectedMouseUp=!0,L.start(200,()=>{g.current.allowSelectedMouseUp=!0})}),()=>{L.clear(),$.clear()};g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},H.clear()},[A,g,H,L,$]);const F=O.useMemo(()=>D?.id??Pp(B)?.id,[D,B]),Q=Ro(M,{role:"combobox","aria-expanded":A?"true":"false","aria-haspopup":"listbox","aria-controls":A?F:void 0,"aria-labelledby":v,"aria-readonly":y||void 0,tabIndex:T?-1:0,ref:G,onFocus(ie){u(!0),A&&S.current&&b(!1,Ue(Xs,ie.nativeEvent)),U.start(0,()=>{x.set("forceMount",!0)})},onBlur(){l(!0),u(!1),h==="onBlur"&&_.commit(R)},onPointerMove(){E.current=!1},onKeyDown(){E.current=!0},onMouseDown(ie){if(A)return;const X=Hr(ie.currentTarget);function K(J){if(!W.current)return;const ne=J.target;if(lt(W.current,ne)||lt(I.current,ne)||ne===W.current)return;const re=gR(W.current);J.clientX>=re.left-zv&&J.clientX<=re.right+zv&&J.clientY>=re.top-zv&&J.clientY<=re.bottom+zv||b(!1,Ue(tz,J))}H.start(0,()=>{X.addEventListener("mouseup",K,{once:!0})})}},_.getValidationProps,o,V);Q.role="combobox";const ee=O.useMemo(()=>({...d,open:A,disabled:T,value:R,readOnly:y,placeholder:!z}),[d,A,T,R,y,z]);return ct("button",t,{ref:[n,W],state:ee,stateAttributesMapping:mse,props:Q})}),vse={value:()=>null},yse=O.forwardRef(function(t,n){const{className:r,render:i,children:s,...a}=t,{store:o,valueRef:l}=Lo(),u=De(o,xt.value),h=De(o,xt.items),d=De(o,xt.itemToStringLabel),p=De(o,xt.serializedValue),v=O.useMemo(()=>({value:u,placeholder:!p}),[u,p]),x=typeof s=="function"?s(u):s??(Array.isArray(u)?hse(u,d):fse(u,h,d));return ct("span",t,{state:v,ref:[n,l],props:[{children:x},a],stateAttributesMapping:vse})}),bse=O.forwardRef(function(t,n){const{className:r,render:i,...s}=t,{store:a}=Lo(),o=De(a,xt.open),l=O.useMemo(()=>({open:o}),[o]);return ct("span",t,{state:l,ref:n,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:oR})}),_se=O.createContext(void 0),xse=O.forwardRef(function(t,n){const{store:r}=Lo(),i=De(r,xt.mounted),s=De(r,xt.forceMount);return i||s?w.jsx(_se.Provider,{value:!0,children:w.jsx(Lm,{ref:n,...t})}):null}),yH=O.createContext(void 0);function vR(){const e=O.useContext(yH);if(!e)throw new Error(qt(59));return e}function Zy(e,t){e&&Object.assign(e.style,t)}const bH={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Sse={position:"fixed"},wse=O.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:s,render:a,side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:v=5,sticky:x=!1,disableAnchorTracking:b,alignItemWithTrigger:g=!0,collisionAvoidance:_=C0,...y}=t,{store:S,listRef:k,labelsRef:E,alignItemWithTriggerActiveRef:T,selectedItemTextRef:A,valuesRef:R,initialValueRef:M,popupRef:B,setValue:D}=Lo(),z=pH(),I=De(S,xt.open),W=De(S,xt.mounted),U=De(S,xt.modal),H=De(S,xt.value),V=De(S,xt.openMethod),q=De(S,xt.positionerElement),N=De(S,xt.triggerElement),G=De(S,xt.isItemEqualToValue),L=O.useRef(null),$=O.useRef(null),[F,Q]=O.useState(g),ee=W&&F&&V!=="touch";!W&&F!==g&&Q(g),ze(()=>{W||(xt.scrollUpArrowVisible(S.state)&&S.set("scrollUpArrowVisible",!1),xt.scrollDownArrowVisible(S.state)&&S.set("scrollDownArrowVisible",!1))},[S,W]),O.useImperativeHandle(T,()=>ee),F0((ee||U)&&I&&V!=="touch",N);const ie=N0({anchor:r,floatingRootContext:z,positionMethod:i,mounted:W,side:o,sideOffset:u,align:l,alignOffset:h,arrowPadding:v,collisionBoundary:d,collisionPadding:p,sticky:x,disableAnchorTracking:b??ee,collisionAvoidance:_,keepMounted:!0}),X=ee?"none":ie.side,K=ee?Sse:ie.positionerStyles,J=O.useMemo(()=>{const he={};return I||(he.pointerEvents="none"),{role:"presentation",hidden:!W,style:{...K,...he}}},[I,W,K]),ne=O.useMemo(()=>({open:I,side:X,align:ie.align,anchorHidden:ie.anchorHidden}),[I,X,ie.align,ie.anchorHidden]),re=Ie(he=>{S.set("positionerElement",he)}),Z=ct("div",t,{ref:[n,re],state:ne,stateAttributesMapping:to,props:[J,y]}),ae=O.useRef(0),ue=Ie(he=>{if(he.size===0&&ae.current===0||R.current.length===0)return;const le=ae.current;if(ae.current=he.size,he.size===le)return;const Le=Ue(gr);if(le!==0&&!S.state.multiple&&H!==null&&Bd(R.current,H,G)===-1){const Be=M.current,Re=Be!=null&&Ac(R.current,Be,G)?Be:null;D(Re,Le),Re===null&&(S.set("selectedIndex",null),A.current=null)}if(le!==0&&S.state.multiple&&Array.isArray(H)){const ke=H.filter(Be=>Ac(R.current,Be,G));(ke.length!==H.length||ke.some(Be=>!Ac(H,Be,G)))&&(D(ke,Le),ke.length===0&&(S.set("selectedIndex",null),A.current=null))}if(I&&ee){S.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ke={height:""};Zy(q,ke),Zy(B.current,ke)}}),fe=O.useMemo(()=>({...ie,side:X,alignItemWithTriggerActive:ee,setControlledAlignItemWithTrigger:Q,scrollUpArrowRef:L,scrollDownArrowRef:$}),[ie,X,ee,Q]);return w.jsx(Im,{elementsRef:k,labelsRef:E,onMapChange:ue,children:w.jsxs(yH.Provider,{value:fe,children:[W&&U&&w.jsx(H0,{inert:wf(!I),cutout:N}),Z]})})});function _H(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const Hv="base-ui-disable-scrollbar",Dp={className:Hv,element:w.jsx("style",{href:Hv,precedence:"base-ui:low",children:`.${Hv}{scrollbar-width:none}.${Hv}::-webkit-scrollbar{display:none}`})},Cse=O.createContext(void 0);function yR(e){return O.useContext(Cse)}const Ese={...to,...Ls},kse=O.forwardRef(function(t,n){const{render:r,className:i,...s}=t,{store:a,popupRef:o,onOpenChangeComplete:l,setOpen:u,valueRef:h,selectedItemTextRef:d,keyboardActiveRef:p,multiple:v,handleScrollArrowVisibility:x,scrollHandlerRef:b}=Lo(),{side:g,align:_,alignItemWithTriggerActive:y,setControlledAlignItemWithTrigger:S,scrollDownArrowRef:k,scrollUpArrowRef:E}=vR(),T=yR()!=null,A=pH(),R=fn(),M=De(a,xt.id),B=De(a,xt.open),D=De(a,xt.mounted),z=De(a,xt.popupProps),I=De(a,xt.transitionStatus),W=De(a,xt.triggerElement),U=De(a,xt.positionerElement),H=De(a,xt.listElement),V=O.useRef(0),q=O.useRef(!1),N=O.useRef(0),G=O.useRef(!1),L=O.useRef({}),$=Tl(),F=Ie(X=>{if(!U||!o.current||!G.current)return;if(q.current||!y){x();return}const K=U.style.top==="0px",J=U.style.bottom==="0px",ne=U.getBoundingClientRect().height,re=Hr(U),Z=getComputedStyle(U),ae=parseFloat(Z.marginTop),ue=parseFloat(Z.marginBottom),fe=re.documentElement.clientHeight-ae-ue,he=X.scrollTop,le=X.scrollHeight,Le=X.clientHeight,ke=le-Le;let Be=null,_e=null,Re=!1;if(K){const ge=ke-he,Se=ne+ge,we=Math.min(Se,fe);Be=we,we!==fe?_e=ke:Re=!0}else if(J){const ge=he-0,Se=ne+ge,we=Math.min(Se,fe),We=Se-fe;Be=we,we!==fe?_e=0:(Re=!0,he<ke&&(_e=he-(ge-We)))}Be!=null&&(U.style.height=`${Be}px`),_e!=null&&(X.scrollTop=_e),Re&&(q.current=!0),x()});O.useImperativeHandle(b,()=>F,[F]),Jr({open:B,ref:o,onComplete(){B&&l?.(!0)}});const Q=O.useMemo(()=>({open:B,transitionStatus:I,side:g,align:_}),[B,I,g,_]);ze(()=>{!U||!o.current||Object.keys(L.current).length||(L.current={top:U.style.top||"0",left:U.style.left||"0",right:U.style.right,height:U.style.height,bottom:U.style.bottom,minHeight:U.style.minHeight,maxHeight:U.style.maxHeight,marginTop:U.style.marginTop,marginBottom:U.style.marginBottom})},[o,U]),ze(()=>{D||y||(G.current=!1,q.current=!1,V.current=0,N.current=0,Zy(U,L.current))},[D,y,U,o]),ze(()=>{const X=o.current;if(!(!D||!W||!U||!X)){if(!y){G.current=!0,$.request(x);return}queueMicrotask(()=>{const K=getComputedStyle(U),J=getComputedStyle(X),ne=Hr(W),re=Yn(U),Z=W.getBoundingClientRect(),ae=U.getBoundingClientRect(),ue=Z.left,fe=Z.height,he=H||X,le=he.scrollHeight,Le=parseFloat(J.borderBottomWidth),ke=parseFloat(K.marginTop)||10,Be=parseFloat(K.marginBottom)||10,_e=parseFloat(K.minHeight)||100,Re=5,ge=5,Se=20,we=ne.documentElement.clientHeight-ke-Be,We=ne.documentElement.clientWidth,it=we-Z.bottom+fe,Ae=d.current,Ve=h.current;let qe=0,mt=0;if(Ae&&Ve){const Et=Ve.getBoundingClientRect(),et=Ae.getBoundingClientRect(),zt=Et.left-ue,Kt=et.left-ae.left,ht=Et.top-Z.top+Et.height/2,jt=et.top-ae.top+et.height/2;qe=zt-Kt,mt=jt-ht}const Ge=it+mt+Be+Le;let Xe=Math.min(we,Ge);const Oe=we-ke-Be,st=Ge-Xe,ut=Math.max(Re,ue+qe),Ze=We-ge,at=Math.max(0,ut+ae.width-Ze);U.style.left=`${ut-at}px`,U.style.height=`${Xe}px`,U.style.maxHeight="auto",U.style.marginTop=`${ke}px`,U.style.marginBottom=`${Be}px`,X.style.height="100%";const It=he.scrollHeight-he.clientHeight,ft=st>=It;ft&&(Xe=Math.min(we,ae.height)-(st-It));const _n=Z.top<Se||Z.bottom>we-Se||Xe<Math.min(le,_e),Mt=(re.visualViewport?.scale??1)!==1&&UO;if(_n||Mt){G.current=!0,Zy(U,L.current),cr.flushSync(()=>S(!1));return}if(ft){const Et=Math.max(0,we-Ge);U.style.top=ae.height>=Oe?"0":`${Et}px`,U.style.height=`${Xe}px`,he.scrollTop=he.scrollHeight-he.clientHeight,V.current=Math.max(_e,Xe)}else U.style.bottom="0",V.current=Math.max(_e,Xe),he.scrollTop=st;V.current===we&&(q.current=!0),x(),setTimeout(()=>{G.current=!0})})}},[a,D,U,W,h,d,o,x,y,S,$,k,E,H]),O.useEffect(()=>{if(!y||!U||!D)return;const X=Yn(U);function K(J){u(!1,Ue(rte,J))}return X.addEventListener("resize",K),()=>{X.removeEventListener("resize",K)}},[u,y,U,D]);const ee={...H?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":v||void 0,id:`${M}-list`},onKeyDown(X){p.current=!0,T&&sR.has(X.key)&&X.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(X){if(_H(X)||X.pointerType==="touch")return;const K=X.currentTarget;R.start(0,()=>{a.set("activeIndex",null),K.focus({preventScroll:!0})})},onScroll(X){H||b.current?.(X.currentTarget)},...y&&{style:H?{height:"100%"}:bH}},ie=ct("div",t,{ref:[n,o],state:Q,stateAttributesMapping:Ese,props:[z,ee,B0(I),{className:!H&&y?Dp.className:void 0},s]});return w.jsxs(O.Fragment,{children:[Dp.element,w.jsx(O0,{context:A,modal:!1,disabled:!D,restoreFocus:!0,children:ie})]})}),Tse=O.forwardRef(function(t,n){const{className:r,render:i,...s}=t,{store:a,scrollHandlerRef:o}=Lo(),{alignItemWithTriggerActive:l}=vR(),u=De(a,xt.hasScrollArrows),h=De(a,xt.openMethod),d=De(a,xt.multiple),v={id:`${De(a,xt.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(b){o.current?.(b.currentTarget)},...l&&{style:bH},className:u&&h!=="touch"?Dp.className:void 0},x=Ie(b=>{a.set("listElement",b)});return ct("div",t,{ref:[n,x],props:[v,s]})}),xH=O.createContext(void 0);function bR(){const e=O.useContext(xH);if(!e)throw new Error(qt(57));return e}const Ose=O.memo(O.forwardRef(function(t,n){const{render:r,className:i,value:s=null,label:a,disabled:o=!1,nativeButton:l=!1,...u}=t,h=O.useRef(null),d=Cf({label:a,textRef:h,indexGuessBehavior:aR.GuessFromOrder}),{store:p,getItemProps:v,setOpen:x,setValue:b,selectionRef:g,typingRef:_,valuesRef:y,keyboardActiveRef:S,multiple:k,highlightItemOnHover:E}=Lo(),T=fn(),A=De(p,xt.isActive,d.index),R=De(p,xt.isSelected,d.index,s),M=De(p,xt.isSelectedByFocus,d.index),B=De(p,xt.isItemEqualToValue),D=d.index,z=D!==-1,I=O.useRef(null),W=Rn(D);ze(()=>{if(!z)return;const ie=y.current;return ie[D]=s,()=>{delete ie[D]}},[z,D,s,y]),ze(()=>{if(!z)return;const ie=p.state.value;let X=ie;k&&Array.isArray(ie)&&ie.length>0&&(X=ie[ie.length-1]),X!==void 0&&Sa(X,s,B)&&p.set("selectedIndex",D)},[z,D,k,B,p,s]);const U=O.useMemo(()=>({disabled:o,selected:R,highlighted:A}),[o,R,A]),H=v({active:A,selected:R});H.onFocus=void 0,H.id=void 0;const V=O.useRef(null),q=O.useRef("mouse"),N=O.useRef(!1),{getButtonProps:G,buttonRef:L}=fi({disabled:o,focusableWhenDisabled:!0,native:l});function $(ie){const X=p.state.value;if(k){const K=Array.isArray(X)?X:[],J=R?gH(K,s,B):[...K,s];b(J,Ue(Fc,ie))}else b(s,Ue(Fc,ie)),x(!1,Ue(Fc,ie))}const F={role:"option","aria-selected":R,"aria-disabled":o||void 0,tabIndex:A?0:-1,onFocus(){p.set("activeIndex",D)},onMouseEnter(){!S.current&&p.state.selectedIndex===null&&p.set("activeIndex",D)},onMouseMove(){E&&p.set("activeIndex",D)},onMouseLeave(ie){!E||S.current||_H(ie)||T.start(0,()=>{p.state.activeIndex===D&&p.set("activeIndex",null)})},onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(ie){V.current=ie.key,p.set("activeIndex",D)},onClick(ie){N.current=!1,!(ie.type==="keydown"&&V.current===null)&&(o||V.current===" "&&_.current||q.current!=="touch"&&!A||(V.current=null,$(ie.nativeEvent)))},onPointerEnter(ie){q.current=ie.pointerType},onPointerDown(ie){q.current=ie.pointerType,N.current=!0},onMouseUp(ie){if(o)return;if(N.current){N.current=!1;return}const X=!g.current.allowSelectedMouseUp&&R,K=!g.current.allowUnselectedMouseUp&&!R;X||K||q.current!=="touch"&&!A||$(ie.nativeEvent)}},Q=ct("div",t,{ref:[L,n,d.ref,I],state:U,props:[H,F,u,G]}),ee=O.useMemo(()=>({selected:R,indexRef:W,textRef:h,selectedByFocus:M,hasRegistered:z}),[R,W,h,M,z]);return w.jsx(xH.Provider,{value:ee,children:Q})})),Rse=O.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=bR();return r||i?w.jsx(Ase,{...t,ref:n}):null}),Ase=O.memo(O.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...s}=e,{selected:a}=bR(),o=O.useRef(null),{transitionStatus:l,setMounted:u}=eo(a),h=O.useMemo(()=>({selected:a,transitionStatus:l}),[a,l]),d=ct("span",e,{ref:[t,o],state:h,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:Ls});return Jr({open:a,ref:o,onComplete(){a||u(!1)}}),d})),Pse=O.memo(O.forwardRef(function(t,n){const{indexRef:r,textRef:i,selectedByFocus:s,hasRegistered:a}=bR(),{selectedItemTextRef:o}=Lo(),{className:l,render:u,...h}=t,d=O.useCallback(v=>{if(!v||!a)return;const x=o.current===null||!o.current.isConnected;(s||x&&r.current===0)&&(o.current=v)},[o,r,s,a]);return ct("div",t,{ref:[d,n,i],props:h})})),SH=O.forwardRef(function(t,n){const{render:r,className:i,direction:s,keepMounted:a=!1,...o}=t,{store:l,popupRef:u,listRef:h,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:p}=Lo(),{side:v,scrollDownArrowRef:x,scrollUpArrowRef:b}=vR(),g=s==="up"?xt.scrollUpArrowVisible:xt.scrollDownArrowVisible,_=De(l,g),y=De(l,xt.openMethod),S=_&&y!=="touch",k=fn(),E=s==="up"?b:x,{transitionStatus:T,setMounted:A}=eo(S);ze(()=>(p.current+=1,l.state.hasScrollArrows||l.set("hasScrollArrows",!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set("hasScrollArrows",!1)}),[l,p]),Jr({open:S,ref:E,onComplete(){S||A(!1)}});const R=O.useMemo(()=>({direction:s,visible:S,side:v,transitionStatus:T}),[s,S,v,T]),B=ct("div",t,{ref:[n,E],state:R,props:[{"aria-hidden":!0,children:s==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(z){if(z.movementX===0&&z.movementY===0||k.isStarted())return;l.set("activeIndex",null);function I(){const W=l.state.listElement??u.current;if(!W)return;l.set("activeIndex",null),d();const U=W.scrollTop===0,H=Math.round(W.scrollTop+W.clientHeight)>=W.scrollHeight;if(h.current.length===0&&(s==="up"?l.set("scrollUpArrowVisible",!U):l.set("scrollDownArrowVisible",!H)),s==="up"&&U||s==="down"&&H){k.clear();return}if((l.state.listElement||u.current)&&h.current&&h.current.length>0){const q=h.current,N=E.current?.offsetHeight||0;if(s==="up"){let G=0;const L=W.scrollTop+N;for(let F=0;F<q.length;F+=1){const Q=q[F];if(Q&&Q.offsetTop>=L){G=F;break}}const $=Math.max(0,G-1);if($<G){const F=q[$];F&&(W.scrollTop=Math.max(0,F.offsetTop-N))}else W.scrollTop=0}else{let G=q.length-1;const L=W.scrollTop+W.clientHeight-N;for(let F=0;F<q.length;F+=1){const Q=q[F];if(Q&&Q.offsetTop+Q.offsetHeight>L){G=Math.max(0,F-1);break}}const $=Math.min(q.length-1,G+1);if($>G){const F=q[$];F&&(W.scrollTop=F.offsetTop+F.offsetHeight-W.clientHeight+N)}else W.scrollTop=W.scrollHeight-W.clientHeight}}k.start(40,I)}k.start(40,I)},onMouseLeave(){k.clear()}},o]});return S||a?B:null}),Mse=O.forwardRef(function(t,n){return w.jsx(SH,{...t,ref:n,direction:"down"})}),jse=O.forwardRef(function(t,n){return w.jsx(SH,{...t,ref:n,direction:"up"})}),qi=pse;function Gi({className:e,...t}){return w.jsx(yse,{"data-slot":"select-value",className:Ne("flex flex-1 text-left",e),...t})}function Ki({className:e,size:t="default",children:n,...r}){return w.jsxs(gse,{"data-slot":"select-trigger","data-size":t,className:Ne("border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r,children:[n,w.jsx(bse,{render:w.jsx(me,{icon:Xz,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})})]})}function Yi({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:s=0,alignItemWithTrigger:a=!0,...o}){return w.jsx(xse,{children:w.jsx(wse,{side:n,sideOffset:r,align:i,alignOffset:s,alignItemWithTrigger:a,className:"isolate z-50",children:w.jsxs(kse,{"data-slot":"select-content",className:Ne("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 rounded-lg shadow-md ring-1 duration-100 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto",e),...o,children:[w.jsx(Lse,{}),w.jsx(Tse,{children:t}),w.jsx(Dse,{})]})})})}function dn({className:e,children:t,...n}){return w.jsxs(Ose,{"data-slot":"select-item",className:Ne("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[w.jsx(Pse,{className:"flex flex-1 gap-2 shrink-0 whitespace-nowrap",children:t}),w.jsx(Rse,{render:w.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:w.jsx(me,{icon:fu,strokeWidth:2,className:"pointer-events-none"})})]})}function Lse({className:e,...t}){return w.jsx(jse,{"data-slot":"select-scroll-up-button",className:Ne("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 top-0 w-full",e),...t,children:w.jsx(me,{icon:cR,strokeWidth:2})})}function Dse({className:e,...t}){return w.jsx(Mse,{"data-slot":"select-scroll-down-button",className:Ne("bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-3.5 bottom-0 w-full",e),...t,children:w.jsx(me,{icon:$m,strokeWidth:2})})}const wH=O.createContext(void 0);function _R(){const e=O.useContext(wH);if(e===void 0)throw new Error(qt(64));return e}let Ise=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const xR={tabActivationDirection:e=>({[Ise.activationDirection]:e})},Nse=O.forwardRef(function(t,n){const{className:r,defaultValue:i=0,onValueChange:s,orientation:a="horizontal",render:o,value:l,...u}=t,h=Bl(),d=Object.hasOwn(t,"defaultValue"),p=O.useRef([]),[v,x]=O.useState(()=>new Map),[b,g]=Qi({controlled:l,default:i,name:"Tabs",state:"value"}),_=l!==void 0,[y,S]=O.useState(()=>new Map),[k,E]=O.useState("none"),T=Ie((V,q)=>{s?.(V,q),!q.isCanceled&&(g(V),E(q.activationDirection))}),A=Ie((V,q)=>{x(N=>{if(N.get(V)===q)return N;const G=new Map(N);return G.set(V,q),G})}),R=Ie((V,q)=>{x(N=>{if(!N.has(V)||N.get(V)!==q)return N;const G=new Map(N);return G.delete(V),G})}),M=O.useCallback(V=>v.get(V),[v]),B=O.useCallback(V=>{for(const q of y.values())if(V===q?.value)return q?.id},[y]),D=O.useCallback(V=>{if(V===void 0)return null;for(const[q,N]of y.entries())if(N!=null&&V===(N.value??N.index))return q;return null},[y]),z=O.useMemo(()=>({direction:h,getTabElementBySelectedValue:D,getTabIdByPanelValue:B,getTabPanelIdByValue:M,onValueChange:T,orientation:a,registerMountedTabPanel:A,setTabMap:S,unregisterMountedTabPanel:R,tabActivationDirection:k,value:b}),[h,D,B,M,T,a,A,S,R,k,b]),I=O.useMemo(()=>{for(const V of y.values())if(V!=null&&V.value===b)return V},[y,b]),W=O.useMemo(()=>{for(const V of y.values())if(V!=null&&!V.disabled)return V.value},[y]);ze(()=>{if(_||y.size===0)return;const V=I?.disabled,q=I==null&&b!==null;if(d&&V&&b===i||!V&&!q)return;const G=W??null;b!==G&&(g(G),E("none"))},[i,W,d,_,I,E,g,y,b]);const H=ct("div",t,{state:{orientation:a,tabActivationDirection:k},ref:n,props:u,stateAttributesMapping:xR});return w.jsx(wH.Provider,{value:z,children:w.jsx(Im,{elementsRef:p,children:H})})}),CH=O.createContext(void 0);function Bse(){const e=O.useContext(CH);if(e===void 0)throw new Error(qt(65));return e}const $se=O.forwardRef(function(t,n){const{className:r,disabled:i=!1,render:s,value:a,id:o,nativeButton:l=!0,...u}=t,{value:h,getTabPanelIdByValue:d,orientation:p}=_R(),{activateOnFocus:v,highlightedTabIndex:x,onTabActivation:b,setHighlightedTabIndex:g,tabsListElement:_}=Bse(),y=Fr(o),S=O.useMemo(()=>({disabled:i,id:y,value:a}),[i,y,a]),{compositeProps:k,compositeRef:E,index:T}=Nz({metadata:S}),A=a===h,R=O.useRef(!1);ze(()=>{if(R.current){R.current=!1;return}if(!(A&&T>-1&&x!==T))return;const N=_;if(N!=null){const G=_s(Hr(N));if(G&<(N,G))return}i||g(T)},[A,T,x,g,i,_]);const{getButtonProps:M,buttonRef:B}=fi({disabled:i,native:l,focusableWhenDisabled:!0}),D=d(a),z=O.useRef(!1),I=O.useRef(!1);function W(N){A||i||b(a,Ue(gr,N.nativeEvent,void 0,{activationDirection:"none"}))}function U(N){A||(T>-1&&!i&&g(T),!i&&v&&(!z.current||z.current&&I.current)&&b(a,Ue(gr,N.nativeEvent,void 0,{activationDirection:"none"})))}function H(N){if(A||i)return;z.current=!0;function G(){z.current=!1,I.current=!1}(!N.button||N.button===0)&&(I.current=!0,Hr(N.currentTarget).addEventListener("pointerup",G,{once:!0}))}const V=O.useMemo(()=>({disabled:i,active:A,orientation:p}),[i,A,p]);return ct("button",t,{state:V,ref:[n,B,E],props:[k,{role:"tab","aria-controls":D,"aria-selected":A,id:y,onClick:W,onFocus:U,onPointerDown:H,[Mz]:A?"":void 0,onKeyDownCapture(){R.current=!0}},u,M]})});let zse=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const Hse=O.forwardRef(function(t,n){const{className:r,value:i,render:s,keepMounted:a=!1,...o}=t,{value:l,getTabIdByPanelValue:u,orientation:h,tabActivationDirection:d,registerMountedTabPanel:p,unregisterMountedTabPanel:v}=_R(),x=Fr(),b=O.useMemo(()=>({id:x,value:i}),[x,i]),{ref:g,index:_}=Cf({metadata:b}),y=i!==l,S=u(i),k=O.useMemo(()=>({hidden:y,orientation:h,tabActivationDirection:d}),[y,h,d]),E=ct("div",t,{state:k,ref:[n,g],props:[{"aria-labelledby":S,hidden:y,id:x??void 0,role:"tabpanel",tabIndex:y?-1:0,[zse.index]:_},o],stateAttributesMapping:xR});return ze(()=>{if(!(y&&!a)&&x!=null)return p(i,x),()=>{v(i,x)}},[y,a,i,x,p,v]),!y||a?E:null}),Fse=O.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:i,loopFocus:s=!0,render:a,...o}=t,{getTabElementBySelectedValue:l,onValueChange:u,orientation:h,value:d,setTabMap:p,tabActivationDirection:v}=_R(),[x,b]=O.useState(0),[g,_]=O.useState(null),y=Use(d,h,g,l),S=Ie((A,R)=>{if(A!==d){const M=y(A);R.activationDirection=M,u(A,R)}}),k=O.useMemo(()=>({orientation:h,tabActivationDirection:v}),[h,v]),E={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},T=O.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:x,onTabActivation:S,setHighlightedTabIndex:b,tabsListElement:g,value:d}),[r,x,S,b,g,d]);return w.jsx(CH.Provider,{value:T,children:w.jsx(D0,{render:a,className:i,state:k,refs:[n,_],props:[E,o],stateAttributesMapping:xR,highlightedIndex:x,enableHomeAndEndKeys:!0,loopFocus:s,orientation:h,onHighlightedIndexChange:b,onMapChange:p,disabledIndices:ci})})});function FD(e,t){const{left:n,top:r}=e.getBoundingClientRect(),{left:i,top:s}=t.getBoundingClientRect(),a=n-i,o=r-s;return{left:a,top:o}}function Use(e,t,n,r){const[i,s]=O.useState(null);return ze(()=>{if(e==null||n==null){s(null);return}const a=r(e);if(a==null){s(null);return}const{left:o,top:l}=FD(a,n);s(t==="horizontal"?o:l)},[t,r,n,e]),O.useCallback(a=>{if(a===e)return"none";if(a==null)return s(null),"none";if(a!=null&&n!=null){const o=r(a);if(o!=null){const{left:l,top:u}=FD(o,n);if(i==null)return s(t==="horizontal"?l:u),"none";if(t==="horizontal"){if(l<i)return s(l),"left";if(l>i)return s(l),"right"}else{if(u<i)return s(u),"up";if(u>i)return s(u),"down"}}}return"none"},[r,t,i,n,e])}function Ol({className:e,orientation:t="horizontal",...n}){return w.jsx(Nse,{"data-slot":"tabs","data-orientation":t,className:Ne("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",e),...n})}const Vse=Dl("rounded-lg p-[3px] group-data-horizontal/tabs:h-8 data-[variant=line]:rounded-none group/tabs-list text-muted-foreground inline-flex w-fit items-center justify-center group-data-[orientation=vertical]/tabs:h-fit group-data-[orientation=vertical]/tabs:flex-col",{variants:{variant:{default:"bg-muted",line:"gap-1 bg-transparent"}},defaultVariants:{variant:"default"}});function Rl({className:e,variant:t="default",...n}){return w.jsx(Fse,{"data-slot":"tabs-list","data-variant":t,className:Ne(Vse({variant:t}),e),...n})}function Yr({className:e,...t}){return w.jsx($se,{"data-slot":"tabs-trigger",className:Ne("gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-xs font-medium group-data-vertical/tabs:py-[calc(--spacing(1.25))] [&_svg:not([class*='size-'])]:size-3.5 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground/60 hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center whitespace-nowrap transition-all group-data-[orientation=vertical]/tabs:w-full group-data-[orientation=vertical]/tabs:justify-start focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0","group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent","data-active:bg-background dark:data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 data-active:text-foreground","after:bg-foreground after:absolute after:opacity-0 after:transition-opacity group-data-[orientation=horizontal]/tabs:after:inset-x-0 group-data-[orientation=horizontal]/tabs:after:bottom-[-5px] group-data-[orientation=horizontal]/tabs:after:h-0.5 group-data-[orientation=vertical]/tabs:after:inset-y-0 group-data-[orientation=vertical]/tabs:after:-right-1 group-data-[orientation=vertical]/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",e),...t})}function wi({className:e,...t}){return w.jsx(Hse,{"data-slot":"tabs-content",className:Ne("text-xs/relaxed flex-1 min-h-0 outline-none",e),...t})}function Wse(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:s,actionsRef:a,handle:o,triggerId:l,defaultTriggerId:u=null}=e,h=Oa(),d=!!h,p=zr(()=>o?.store??new rH({open:n??r,activeTriggerId:l!==void 0?l:u,modal:!0,disablePointerDismissal:!0,nested:d,role:"alertdialog"})).current;p.useControlledProp("open",n,r),p.useControlledProp("activeTriggerId",l,u),p.useSyncedValue("nested",d),p.useContextCallback("onOpenChange",i),p.useContextCallback("onOpenChangeComplete",s);const v=p.useState("payload");nH({store:p,actionsRef:a,parentContext:h?.store.context});const x=O.useMemo(()=>({store:p}),[p]);return w.jsx(hR.Provider,{value:x,children:typeof t=="function"?t({payload:v}):t})}const EH=O.createContext(void 0),kH=O.createContext(void 0),TH=O.createContext(void 0),OH=O.createContext("");function Ra(){const e=O.useContext(EH);if(!e)throw new Error(qt(22));return e}function q0(){const e=O.useContext(kH);if(!e)throw new Error(qt(23));return e}function gu(){const e=O.useContext(TH);if(!e)throw new Error(qt(24));return e}function SR(){return O.useContext(OH)}const Ye={id:Te(e=>e.id),query:Te(e=>e.query),items:Te(e=>e.items),selectedValue:Te(e=>e.selectedValue),open:Te(e=>e.open),mounted:Te(e=>e.mounted),forceMounted:Te(e=>e.forceMounted),inline:Te(e=>e.inline),activeIndex:Te(e=>e.activeIndex),selectedIndex:Te(e=>e.selectedIndex),isActive:Te((e,t)=>e.activeIndex===t),isSelected:Te((e,t)=>{const n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(i=>Sa(i,t,n)):Sa(r,t,n)}),transitionStatus:Te(e=>e.transitionStatus),popupProps:Te(e=>e.popupProps),inputProps:Te(e=>e.inputProps),triggerProps:Te(e=>e.triggerProps),getItemProps:Te(e=>e.getItemProps),positionerElement:Te(e=>e.positionerElement),listElement:Te(e=>e.listElement),triggerElement:Te(e=>e.triggerElement),inputElement:Te(e=>e.inputElement),popupSide:Te(e=>e.popupSide),openMethod:Te(e=>e.openMethod),inputInsidePopup:Te(e=>e.inputInsidePopup),selectionMode:Te(e=>e.selectionMode),listRef:Te(e=>e.listRef),labelsRef:Te(e=>e.labelsRef),popupRef:Te(e=>e.popupRef),emptyRef:Te(e=>e.emptyRef),inputRef:Te(e=>e.inputRef),keyboardActiveRef:Te(e=>e.keyboardActiveRef),chipsContainerRef:Te(e=>e.chipsContainerRef),clearRef:Te(e=>e.clearRef),valuesRef:Te(e=>e.valuesRef),allValuesRef:Te(e=>e.allValuesRef),name:Te(e=>e.name),disabled:Te(e=>e.disabled),readOnly:Te(e=>e.readOnly),required:Te(e=>e.required),grid:Te(e=>e.grid),isGrouped:Te(e=>e.isGrouped),virtualized:Te(e=>e.virtualized),onOpenChangeComplete:Te(e=>e.onOpenChangeComplete),openOnInputClick:Te(e=>e.openOnInputClick),itemToStringLabel:Te(e=>e.itemToStringLabel),isItemEqualToValue:Te(e=>e.isItemEqualToValue),modal:Te(e=>e.modal),autoHighlight:Te(e=>e.autoHighlight),submitOnItemClick:Te(e=>e.submitOnItemClick)};function qse(e,t){return(n,r)=>{if(n==null)return!1;const i=pr(n,t);return e.contains(i,r)}}function Gse(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;const s=pr(r,t),a=n!=null?pr(n,t):"";return a&&e.contains(a,i)&&a.length===i.length?!0:e.contains(s,i)}}const UD=new Map;function RH(e){return Array.isArray(e)?e.map(t=>RH(t)).join(","):e==null?"":String(e)}function Kse(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${RH(e.locale)}|${JSON.stringify(t)}`,r=UD.get(n);if(r)return r;const i=new Intl.Collator(e.locale,t),s={contains(a,o,l){if(!o)return!0;const u=pr(a,l);for(let h=0;h<=u.length-o.length;h+=1)if(i.compare(u.slice(h,h+o.length),o)===0)return!0;return!1},startsWith(a,o,l){if(!o)return!0;const u=pr(a,l);return i.compare(u.slice(0,o.length),o)===0},endsWith(a,o,l){if(!o)return!0;const u=pr(a,l),h=o.length;return u.length>=h&&i.compare(u.slice(u.length-h),o)===0}};return UD.set(n,s),s}const Yse=Kse,AH=Symbol("none"),dc={value:AH,index:-1};function Xse(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:s,defaultInputValue:a,inputValue:o,selectionMode:l="none",onItemHighlighted:u,name:h,disabled:d=!1,readOnly:p=!1,required:v=!1,inputRef:x,grid:b=!1,items:g,filteredItems:_,filter:y,openOnInputClick:S=!0,autoHighlight:k=!1,keepHighlight:E=!1,highlightItemOnHover:T=!0,itemToStringLabel:A,itemToStringValue:R,isItemEqualToValue:M=mH,virtualized:B=!1,inline:D=!1,fillInputOnItemPress:z=!0,modal:I=!1,limit:W=-1,autoComplete:U="list",locale:H,submitOnItemClick:V=!1}=e,{clearErrors:q}=Fm(),{setDirty:N,validityData:G,shouldValidateOnChange:L,setFilled:$,name:F,disabled:Q,validation:ee}=Ms(),ie=W0({id:t}),X=Yse({locale:H}),[K,J]=O.useState(!1),[ne,re]=O.useState(null),Z=O.useRef([]),ae=O.useRef([]),ue=O.useRef(null),fe=O.useRef(null),he=O.useRef(null),le=O.useRef(!0),Le=O.useRef(!1),ke=O.useRef(null),Be=O.useRef(null),_e=O.useRef(null),Re=O.useRef(dc),ge=O.useRef(null),Se=O.useRef([]),we=O.useRef([]),We=Q||d,it=F??h,Ae=l==="multiple",Ve=l==="single",qe=o!==void 0||a!==void 0,mt=g!==void 0,Ge=_!==void 0;let Xe;k==="always"?Xe="always":Xe=k?"input-change":!1;const[Oe,st]=Qi({controlled:i,default:Ae?r??ci:r,name:"Combobox",state:"selectedValue"}),ut=O.useMemo(()=>y===null?()=>!0:y!==void 0?y:Ve&&!K?Gse(X,A,Oe):qse(X,A),[y,Ve,Oe,K,X,A]),Ze=zr(()=>qe?a??"":Ve?pr(Oe,A):"").current,[at,It]=Qi({controlled:o,default:Ze,name:"Combobox",state:"inputValue"}),[ft,_n]=Qi({controlled:e.open,default:e.defaultOpen,name:"Combobox",state:"open"}),Mt=vH(g),Et=ne??(at===""?"":String(at).trim()),et=Ve?pr(Oe,A):"",zt=Ve&&!K&&Et!==""&&et!==""&&et.length===Et.length&&X.contains(et,Et),Kt=zt?"":Et,ht=mt&&Ge&&zt,jt=O.useMemo(()=>g?Mt?g.flatMap(Ke=>Ke.items):g:ci,[g,Mt]),Tt=O.useMemo(()=>{if(_&&!ht)return _;if(!g)return ci;if(Mt){const dt=g,Rt=[];let xn=0;for(const Bn of dt){if(W>-1&&xn>=W)break;const er=Kt===""?Bn.items:Bn.items.filter(Uo=>ut(Uo,Kt,A));if(er.length===0)continue;const Ho=W>-1?W-xn:1/0,Fo=er.slice(0,Ho);if(Fo.length>0){const Uo={...Bn,items:Fo};Rt.push(Uo),xn+=Fo.length}}return Rt}if(Kt==="")return W>-1?jt.slice(0,W):jt;const Ke=[];for(const dt of jt){if(W>-1&&Ke.length>=W)break;ut(dt,Kt,A)&&Ke.push(dt)}return Ke},[_,ht,g,Mt,Kt,W,ut,A,jt]),Ot=O.useMemo(()=>Mt?Tt.flatMap(dt=>dt.items):Tt,[Tt,Mt]),tt=zr(()=>new Uc({id:ie,selectedValue:Oe,open:ft,filter:ut,query:Et,items:g,selectionMode:l,listRef:Z,labelsRef:ae,popupRef:ue,emptyRef:he,inputRef:fe,keyboardActiveRef:le,chipsContainerRef:ke,clearRef:Be,valuesRef:Se,allValuesRef:we,selectionEventRef:_e,name:it,disabled:We,readOnly:p,required:v,grid:b,isGrouped:Mt,virtualized:B,openOnInputClick:S,itemToStringLabel:A,isItemEqualToValue:M,modal:I,autoHighlight:Xe,submitOnItemClick:V,hasInputValue:qe,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:D,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:n||$n,setOpen:$n,setInputValue:$n,setSelectedValue:$n,setIndices:$n,onItemHighlighted:$n,handleSelection:$n,getItemProps:()=>Pn,forceMount:$n,requestSubmit:$n})).current,Yt=l==="none"?at:Oe,Hn=O.useMemo(()=>l==="none"?Yt:Array.isArray(Oe)?Oe.map(Ke=>Vs(Ke,R)):Vs(Oe,R),[Yt,R,l,Oe]),Xn=Ie(u),Jn=Ie(n),ti=De(tt,Ye.activeIndex),$o=De(tt,Ye.selectedIndex),Ar=De(tt,Ye.positionerElement),jn=De(tt,Ye.listElement),Nn=De(tt,Ye.triggerElement),pi=De(tt,Ye.inputElement),Ur=De(tt,Ye.inline),es=De(tt,Ye.inputInsidePopup),ja=Rn(Nn),{mounted:wt,setMounted:io,transitionStatus:so}=eo(ft),{openMethod:ts,triggerProps:ns,reset:zo}=U0(ft);Um({id:ie,name:it,commit:ee.commit,value:Yt,controlRef:es?ja:fe,getValue:()=>Hn});const Pi=Ie(()=>{g?ae.current=Ot.map(Ke=>pr(Ke,A)):tt.set("forceMounted",!0)}),Fn=O.useRef(Oe);ze(()=>{Oe!==Fn.current&&Pi()},[Pi,Oe]);const Pr=Ie(Ke=>{tt.update(Ke);const dt=Ke.type||"none";if(Ke.activeIndex!==void 0)if(Ke.activeIndex===null)Re.current!==dc&&(Re.current=dc,Xn(void 0,Wh(dt,void 0,{index:-1})));else{const Rt=Se.current[Ke.activeIndex];Re.current={value:Rt,index:Ke.activeIndex},Xn(Rt,Wh(dt,void 0,{index:Ke.activeIndex}))}}),Mr=Ie((Ke,dt)=>{if(Le.current=dt.reason===cl,e.onInputValueChange?.(Ke,dt),!dt.isCanceled){if(dt.reason===Tc){const Rt=Ke.trim()!=="";Rt&&J(!0),ge.current={hasQuery:Rt},Rt&&Xe&&tt.state.activeIndex==null&&tt.set("activeIndex",0)}It(Ke)}}),ni=Ie((Ke,dt)=>{ft!==Ke&&(dt.reason==="escape-key"&&mt&&Ot.length===0&&!tt.state.emptyRef.current&&dt.allowPropagation(),e.onOpenChange?.(Ke,dt),!dt.isCanceled&&(!Ke&&K&&(Ve?(re(Et),Et===""&&J(!1)):Ae&&(Ur||es?Pr({activeIndex:null}):re(Et),Mr("",Ue(cl,dt.event)))),_n(Ke)))}),Mi=Ie((Ke,dt)=>{if(s?.(Ke,dt),dt.isCanceled)return;st(Ke),(l==="none"&&ue.current&&z||Ve&&!tt.state.inputInsidePopup)&&Mr(pr(Ke,A),Ue(dt.reason,dt.event)),Ve&&Ke!=null&&dt.reason!==Tc&&K&&re(Et)}),qf=Ie((Ke,dt)=>{let Rt=dt;if(Rt===void 0){if(ti===null)return;Rt=Se.current[ti]}const xn=Gn(Ke),Bn=_e.current??Ke;_e.current=null;const er=Ue(Fc,Bn),Ho=xn?.closest("a")?.getAttribute("href");if(Ho){Ho.startsWith("#")&&ni(!1,er);return}if(Ae){const Fo=Array.isArray(Oe)?Oe:[],Ns=Ac(Fo,Rt,tt.state.isItemEqualToValue)?gH(Fo,Rt,tt.state.isItemEqualToValue):[...Fo,Rt];if(Mi(Ns,er),!(fe.current?fe.current.value.trim()!=="":!1))return;tt.state.inputInsidePopup?Mr("",Ue(cl,er.event)):ni(!1,er)}else Mi(Rt,er),ni(!1,er)}),La=Ie(()=>{if(!tt.state.submitOnItemClick)return;const Ke=tt.state.inputElement?.form;Ke&&typeof Ke.requestSubmit=="function"&&Ke.requestSubmit()}),Da=Ie(()=>{if(io(!1),Jn?.(!1),J(!1),zo(),re(null),Pr(l==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ae&&fe.current&&fe.current.value!==""&&!Le.current&&Mr("",Ue(cl)),Ve)if(tt.state.inputInsidePopup)fe.current&&fe.current.value!==""&&Mr("",Ue(cl));else{const Ke=pr(Oe,A);fe.current&&fe.current.value!==Ke&&Mr(Ke,Ue(Ke===""?cl:gr))}}),Gf=O.useMemo(()=>Ur&&Ar?{current:Ar.closest('[role="dialog"]')}:ue,[Ur,Ar]);Jr({enabled:!e.actionsRef,open:ft,ref:Gf,onComplete(){ft||Da()}}),O.useImperativeHandle(e.actionsRef,()=>({unmount:Da}),[Da]),ze(function(){if(ft||l==="none")return;const dt=g?jt:we.current;if(Ae){const Rt=Array.isArray(Oe)?Oe:[],xn=Rt[Rt.length-1],Bn=Bd(dt,xn,M);Pr({selectedIndex:Bn===-1?null:Bn})}else{const Rt=Bd(dt,Oe,M);Pr({selectedIndex:Rt===-1?null:Rt})}},[ft,Oe,g,l,jt,Ae,M,Pr]),ze(()=>{g&&(Se.current=Ot,Z.current.length=Ot.length)},[g,Ot]),ze(()=>{const Ke=ge.current;if(Ke&&(Ke.hasQuery?Xe&&tt.set("activeIndex",0):Xe==="always"&&tt.set("activeIndex",0),ge.current=null),!ft&&!Ur)return;const Rt=mt||Ge?Ot:Se.current,xn=tt.state.activeIndex;if(xn==null){if(Xe==="always"&&Rt.length>0){tt.set("activeIndex",0);return}Re.current!==dc&&(Re.current=dc,tt.state.onItemHighlighted(void 0,Wh(gr,void 0,{index:-1})));return}if(xn>=Rt.length){Re.current!==dc&&(Re.current=dc,tt.state.onItemHighlighted(void 0,Wh(gr,void 0,{index:-1}))),tt.set("activeIndex",null);return}const Bn=Rt[xn],er=Re.current.value,Ho=er!==AH&&tt.state.isItemEqualToValue(Bn,er);(Re.current.index!==xn||!Ho)&&(Re.current={value:Bn,index:xn},tt.state.onItemHighlighted(Bn,Wh(gr,void 0,{index:xn})))},[ti,Xe,Ge,mt,Ot,Ur,ft,tt]),ze(()=>{if(!g||l==="none")return;const Ke=jt;if(Ae){const xn=Array.isArray(Oe)?Oe:ci,Bn=xn.filter(er=>Ac(Ke,er,tt.state.isItemEqualToValue));Bn.length!==xn.length&&st(Bn);return}if(Oe==null?!0:Ac(Ke,Oe,tt.state.isItemEqualToValue))return;let Rt=null;if(r!=null&&Ac(Ke,r,tt.state.isItemEqualToValue)&&(Rt=r),st(Rt),!tt.state.inputInsidePopup){const xn=pr(Rt,A);fe.current&&fe.current.value!==xn&&Mr(xn,Ue(gr))}},[g,jt,Ae,l,Oe,r,st,A,tt,Mr]),ze(()=>{if(l==="none"){$(String(at)!=="");return}$(Ae?Array.isArray(Oe)&&Oe.length>0:Oe!=null)},[$,l,at,Oe,Ae]),O.useEffect(()=>{mt&&Xe&&Ot.length===0&&Pr({activeIndex:null})},[mt,Xe,Ot.length,Pr]),Pc(Et,()=>{!ft||Et===""||Et===String(Ze)||J(!0)}),Pc(Oe,()=>{if(l!=="none"&&(q(it),N(Oe!==G.initialValue),L()?ee.commit(Oe):ee.commit(Oe,!0),Ae&&tt.state.selectedIndex!==null&&(!Array.isArray(Oe)||Oe.length===0)&&Pr({activeIndex:null,selectedIndex:null}),Ve&&!qe&&!es)){const Ke=pr(Oe,A);at!==Ke&&Mr(Ke,Ue(gr))}}),Pc(at,()=>{l==="none"&&(q(it),N(at!==G.initialValue),L()?ee.commit(at):ee.commit(at,!0))}),Pc(g,()=>{if(!Ve||qe||es||K)return;const Ke=pr(Oe,A);at!==Ke&&Mr(Ke,Ue(gr))});const Is=M0({open:Ur?!0:ft,onOpenChange:ni,elements:{reference:es?Nn:pi,floating:Ar}});let ji,ri;Ur||(ji=b?"grid":"listbox",ri=ft?"true":"false");const Vr=O.useMemo(()=>{const Ke=pi?.tagName==="INPUT",dt=Ke||ft,Rt=Ke?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return dt&&(Rt.role="combobox",Rt["aria-expanded"]=ri,Rt["aria-haspopup"]=ji,Rt["aria-controls"]=ft?jn?.id:void 0,Rt["aria-autocomplete"]=U),{reference:Rt,floating:{role:"presentation"}}},[pi,ft,ri,ji,jn?.id,U]),Me=Sf(Is,{enabled:!p&&!We&&S,event:"mousedown-only",toggle:!1,touchOpenDelay:es?0:50}),bt=Dm(Is,{enabled:!p&&!We&&!Ur,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Ur?!0:void 0,outsidePress(Ke){const dt=Gn(Ke);return!lt(Nn,dt)&&!lt(Be.current,dt)&&!lt(ke.current,dt)}}),Wr=rR(Is,{enabled:!p&&!We,id:ie,listRef:Z,activeIndex:ti,selectedIndex:$o,virtual:!0,loopFocus:!0,allowEscape:!Xe,focusItemOnOpen:K||l==="none"&&!Xe?!1:"auto",focusItemOnHover:T,resetOnPointerLeave:!E,cols:b?2:1,orientation:b?"horizontal":void 0,disabledIndices:ci,onNavigate(Ke,dt){!dt&&!ft||so==="ending"||Pr(dt?{activeIndex:Ke,type:le.current?"keyboard":"pointer"}:{activeIndex:Ke})}}),{getReferenceProps:rs,getFloatingProps:ii,getItemProps:Eu}=du([Vr,Me,bt,Wr]);dH(()=>{tt.update({inline:D,popupProps:ii(),inputProps:rs(),triggerProps:ns,getItemProps:Eu,setOpen:ni,setInputValue:Mr,setSelectedValue:Mi,setIndices:Pr,onItemHighlighted:Xn,handleSelection:qf,forceMount:Pi,requestSubmit:La})}),ze(()=>{tt.update({id:ie,selectedValue:Oe,open:ft,mounted:wt,transitionStatus:so,items:g,inline:D,popupProps:ii(),inputProps:rs(),triggerProps:ns,openMethod:ts,getItemProps:Eu,selectionMode:l,name:it,disabled:We,readOnly:p,required:v,grid:b,isGrouped:Mt,virtualized:B,onOpenChangeComplete:Jn,openOnInputClick:S,itemToStringLabel:A,modal:I,autoHighlight:Xe,isItemEqualToValue:M,submitOnItemClick:V,hasInputValue:qe,requestSubmit:La})},[tt,ie,Oe,ft,wt,so,g,ii,rs,Eu,ts,ns,l,it,We,p,v,ee,b,Mt,B,Jn,S,A,I,M,V,qe,D,La,Xe]);const mi=As(x,ee.inputRef),Kf=O.useMemo(()=>({query:Et,filteredItems:Tt,flatFilteredItems:Ot}),[Et,Tt,Ot]),lg=O.useMemo(()=>Array.isArray(Yt)?"":Vs(Yt,R),[Yt,R]),Yf=Ae&&Array.isArray(Oe)&&Oe.length>0,Ia=O.useMemo(()=>!Ae||!Array.isArray(Oe)||!it?null:Oe.map(Ke=>{const dt=Vs(Ke,R);return w.jsx("input",{type:"hidden",name:it,value:dt},dt)}),[Ae,Oe,it,R]),cg=w.jsxs(O.Fragment,{children:[e.children,w.jsx("input",{...ee.getInputValidationProps({onFocus(){if(es){Nn?.focus();return}(fe.current||Nn)?.focus()},onChange(Ke){if(Ke.nativeEvent.defaultPrevented)return;const dt=Ke.target.value,Rt=Ue(Tc,Ke.nativeEvent);function xn(){if(Ae)return;if(l==="none"){N(dt!==G.initialValue),Mr(dt,Rt),L()&&ee.commit(dt);return}const Bn=Se.current.find(er=>Vs(er,R).toLowerCase()===dt.toLowerCase());Bn!=null&&(N(Bn!==G.initialValue),Mi?.(Bn,Rt),L()&&ee.commit(Bn))}g?xn():(Pi(),queueMicrotask(xn))}}),id:ie,name:Ae||l==="none"?void 0:it,disabled:We,required:v&&!Yf,readOnly:p,value:lg,ref:mi,style:xf,tabIndex:-1,"aria-hidden":!0}),Ia]});return w.jsx(EH.Provider,{value:tt,children:w.jsx(kH.Provider,{value:Is,children:w.jsx(TH.Provider,{value:Kf,children:w.jsx(OH.Provider,{value:at,children:cg})})})})}const Fv=2,Qse={...Nd,...mu},Zse=O.forwardRef(function(t,n){const{render:r,className:i,nativeButton:s=!0,disabled:a=!1,...o}=t,{state:l,disabled:u,setTouched:h,setFocused:d,validationMode:p,validation:v}=Ms(),{labelId:x}=Fl(),b=Ra(),g=De(b,Ye.selectionMode),_=De(b,Ye.disabled),y=De(b,Ye.readOnly),S=De(b,Ye.listElement),k=De(b,Ye.triggerProps),E=De(b,Ye.triggerElement),T=De(b,Ye.inputInsidePopup),A=De(b,Ye.open),R=De(b,Ye.selectedValue),M=De(b,Ye.activeIndex),B=De(b,Ye.selectedIndex),D=q0(),z=SR(),I=fn(),W=u||_||a,U=O.useRef("");function H(ee){U.current=ee.pointerType}const V=D.select("domReferenceElement");O.useEffect(()=>{T&&E&&E!==V&&D.set("domReferenceElement",E)},[E,V,D,T]);const{reference:q}=iR(D,{enabled:!A&&!y&&!_&&g==="single",listRef:b.state.labelsRef,activeIndex:M,selectedIndex:B,onMatch(ee){const ie=b.state.valuesRef.current[ee];ie!==void 0&&b.state.setSelectedValue(ie,Ue("none"))}}),{reference:N}=Sf(D,{enabled:!y&&!_,event:"mousedown"}),{buttonRef:G,getButtonProps:L}=fi({native:s,disabled:W}),$=O.useMemo(()=>({...l,open:A,disabled:W}),[l,A,W]),F=Ie(ee=>{b.set("triggerElement",ee)});return ct("button",t,{ref:[n,G,F],state:$,props:[k,N,q,{tabIndex:T?0:-1,disabled:W,role:T?"combobox":void 0,"aria-expanded":A?"true":"false","aria-haspopup":T?"dialog":"listbox","aria-controls":A?S?.id:void 0,"aria-readonly":y||void 0,"aria-labelledby":x,onPointerDown:H,onPointerEnter:H,onFocus(){d(!0),!(W||y)&&I.start(0,b.state.forceMount)},onBlur(){if(h(!0),d(!1),p==="onBlur"){const ee=g==="none"?z:R;v.commit(ee)}},onMouseDown(ee){if(W||y||(T||D.set("domReferenceElement",ee.currentTarget),b.state.forceMount(),U.current!=="touch"&&(b.state.inputRef.current?.focus(),T||ee.preventDefault()),A))return;const ie=Hr(ee.currentTarget);function X(K){if(!E)return;const J=Gn(K),ne=b.state.positionerElement,re=b.state.listElement;if(lt(E,J)||lt(ne,J)||lt(re,J)||J===E)return;const Z=gR(E),ae=K.clientX>=Z.left-Fv&&K.clientX<=Z.right+Fv,ue=K.clientY>=Z.top-Fv&&K.clientY<=Z.bottom+Fv;ae&&ue||b.state.setOpen(!1,Ue("cancel-open",K))}T&&ie.addEventListener("mouseup",X,{once:!0})},onKeyDown(ee){W||y||(ee.key==="ArrowDown"||ee.key==="ArrowUp")&&(qn(ee),b.state.setOpen(!0,Ue(_d,ee.nativeEvent)),b.state.inputRef.current?.focus())}},v?v.getValidationProps(o):o,L],stateAttributesMapping:Qse})}),Jse=O.createContext(void 0);function eoe(){return O.useContext(Jse)}const PH=O.createContext(void 0);function wR(e){const t=O.useContext(PH);if(t===void 0&&!e)throw new Error(qt(21));return t}const toe={...Nd,...mu,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},noe=O.forwardRef(function(t,n){const{render:r,className:i,disabled:s=!1,id:a,...o}=t,{state:l,disabled:u,setTouched:h,setFocused:d,validationMode:p,validation:v}=Ms(),{labelId:x}=Fl(),b=eoe(),_=!!wR(!0),y=Ra(),{filteredItems:S}=gu(),k=SR(),E=Fr(a),T=Bl(),A=De(y,Ye.disabled),R=De(y,Ye.readOnly),M=De(y,Ye.name),B=De(y,Ye.selectionMode),D=De(y,Ye.autoHighlight),z=De(y,Ye.inputProps),I=De(y,Ye.triggerProps),W=De(y,Ye.open),U=De(y,Ye.mounted),H=De(y,Ye.selectedValue),V=De(y,Ye.popupSide),q=De(y,Ye.positionerElement),N=!!D,G=U&&q?V:null,L=u||A||s,$=S.length===0,[F,Q]=O.useState(null),ee=O.useRef(!1),ie=Ie(ne=>{const re=_||y.state.inline;re&&!y.state.hasInputValue&&y.state.setInputValue("",Ue(gr)),y.update({inputElement:ne,inputInsidePopup:re})}),X=O.useMemo(()=>({...l,open:W,disabled:L,readOnly:R,popupSide:G,listEmpty:$}),[l,W,L,R,G,$]);function K(ne){if(!b)return;let re;const{highlightedChipIndex:Z}=b;if(Z!==void 0){if(ne.key==="ArrowLeft")ne.preventDefault(),Z>0?re=Z-1:re=void 0;else if(ne.key==="ArrowRight")ne.preventDefault(),Z<H.length-1?re=Z+1:re=void 0;else if(ne.key==="Backspace"||ne.key==="Delete"){ne.preventDefault();const ae=Z>=H.length-1?H.length-2:Z;re=ae>=0?ae:void 0,y.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return re}return ne.key==="ArrowLeft"&&(ne.currentTarget.selectionStart??0)===0&&H.length>0?(ne.preventDefault(),re=Math.max(H.length-1,0)):ne.key==="Backspace"&&ne.currentTarget.value===""&&H.length>0&&(y.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),ne.preventDefault()),re}return ct("input",t,{state:X,ref:[n,y.state.inputRef,ie],props:[z,I,{type:"text",value:t.value??F??k,"aria-readonly":R||void 0,"aria-labelledby":x,disabled:L,readOnly:R,...B==="none"&&M&&{name:M},id:E,onFocus(){d(!0)},onBlur(){if(h(!0),d(!1),p==="onBlur"){const ne=B==="none"?k:H;v.commit(ne)}},onCompositionStart(ne){zy||(ee.current=!0,Q(ne.currentTarget.value))},onCompositionEnd(ne){ee.current=!1;const re=ne.currentTarget.value;Q(null),y.state.setInputValue(re,Ue(Tc,ne.nativeEvent))},onChange(ne){if(ee.current){const ue=ne.currentTarget.value;Q(ue),ue===""&&!y.state.openOnInputClick&&!y.state.inputInsidePopup&&y.state.setOpen(!1,Ue(cl,ne.nativeEvent));const fe=ue.trim(),he=N&&fe!=="";!R&&!L&&fe!==""&&(y.state.setOpen(!0,Ue(Tc,ne.nativeEvent)),N||y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"})),W&&y.state.activeIndex!==null&&!he&&y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"});return}y.state.setInputValue(ne.currentTarget.value,Ue(Tc,ne.nativeEvent));const re=ne.currentTarget.value==="",Z=Ue(cl,ne.nativeEvent);re&&!y.state.inputInsidePopup&&(B==="single"&&y.state.setSelectedValue(null,Z),y.state.openOnInputClick||y.state.setOpen(!1,Z));const ae=ne.currentTarget.value.trim();!R&&!L&&ae!==""&&(y.state.setOpen(!0,Ue(Tc,ne.nativeEvent)),N||y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"})),W&&y.state.activeIndex!==null&&!N&&y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(ne){if(L||R||ne.ctrlKey||ne.shiftKey||ne.altKey||ne.metaKey)return;y.state.keyboardActiveRef.current=!0;const re=ne.currentTarget,Z=re.scrollWidth-re.clientWidth,ae=T==="rtl";if(ne.key==="Home"){qn(ne);const fe=eD&&ae?re.value.length:0;re.setSelectionRange(fe,fe),re.scrollLeft=0;return}if(ne.key==="End"){qn(ne);const fe=eD&&ae?0:re.value.length;re.setSelectionRange(fe,fe),re.scrollLeft=ae?-Z:Z;return}if(!U&&ne.key==="Escape"){const fe=B==="multiple"&&Array.isArray(H)?H.length===0:H===null,he=Ue(T0,ne.nativeEvent),le=B==="multiple"?[]:null;y.state.setInputValue("",he),y.state.setSelectedValue(le,he),!fe&&!y.state.inline&&!he.isPropagationAllowed&&ne.stopPropagation();return}if(b&&ne.key==="Backspace"&&re.value===""&&b.highlightedChipIndex===void 0&&Array.isArray(H)&&H.length>0){const fe=H.slice(0,-1);y.state.setIndices({activeIndex:null,selectedIndex:null,type:y.state.keyboardActiveRef.current?"keyboard":"pointer"}),y.state.setSelectedValue(fe,Ue(gr,ne.nativeEvent));return}const ue=K(ne);if(b?.setHighlightedChipIndex(ue),ue!==void 0?b?.chipsRef.current[ue]?.focus():y.state.inputRef.current?.focus(),ne.which!==229&&ne.key==="Enter"&&W){const fe=y.state.activeIndex,he=ne.nativeEvent;if(fe===null){y.state.setOpen(!1,Ue(gr,he));return}qn(ne);const le=y.state.listRef.current[fe];le&&(y.state.selectionEventRef.current=he,le.click(),y.state.selectionEventRef.current=null)}},onPointerMove(){y.state.keyboardActiveRef.current=!1},onPointerDown(){y.state.keyboardActiveRef.current=!1}},v?v.getValidationProps(o):o],stateAttributesMapping:toe})}),roe={...Ls,...oR},ioe=O.forwardRef(function(t,n){const{render:r,className:i,disabled:s=!1,nativeButton:a=!0,keepMounted:o=!1,...l}=t,{disabled:u}=Ms(),h=Ra(),d=De(h,Ye.selectionMode),p=De(h,Ye.disabled),v=De(h,Ye.readOnly),x=De(h,Ye.open),b=De(h,Ye.selectedValue),g=SR();let _=!1;d==="none"?_=g!=="":d==="single"?_=b!=null:_=Array.isArray(b)&&b.length>0;const y=u||p||s,{buttonRef:S,getButtonProps:k}=fi({native:a,disabled:y}),{mounted:E,transitionStatus:T,setMounted:A}=eo(_),R=O.useMemo(()=>({disabled:y,open:x,transitionStatus:T}),[y,x,T]);Jr({open:_,ref:h.state.clearRef,onComplete(){_||A(!1)}});const M=ct("button",t,{state:R,ref:[n,S,h.state.clearRef],props:[{tabIndex:-1,children:"x",disabled:y,"aria-readonly":v||void 0,onMouseDown(D){D.preventDefault()},onClick(D){if(y||v)return;const z=h.state.keyboardActiveRef;h.state.setInputValue("",Ue(aD,D.nativeEvent)),d!=="none"?(h.state.setSelectedValue(Array.isArray(b)?[]:null,Ue(aD,D.nativeEvent)),h.state.setIndices({activeIndex:null,selectedIndex:null,type:z.current?"keyboard":"pointer"})):h.state.setIndices({activeIndex:null,type:z.current?"keyboard":"pointer"}),h.state.inputRef.current?.focus()}},l,k],stateAttributesMapping:roe});return o||E?M:null}),soe=O.createContext(null);function ooe(){return O.useContext(soe)}function aoe(e){const{children:t}=e,{filteredItems:n}=gu(),r=ooe(),i=r?r.items:n;return i?w.jsx(O.Fragment,{children:i.map(t)}):null}const loe=O.forwardRef(function(t,n){var r;const{render:i,className:s,children:a,...o}=t,l=Ra(),u=q0(),h=!!wR(!0),{filteredItems:d}=gu(),p=De(l,Ye.items),v=De(l,Ye.labelsRef),x=De(l,Ye.listRef),b=De(l,Ye.selectionMode),g=De(l,Ye.grid),_=De(l,Ye.popupProps),y=De(l,Ye.disabled),S=De(l,Ye.readOnly),k=De(l,Ye.virtualized),E=b==="multiple",T=d.length===0,A=Ie(I=>{l.set("positionerElement",I)}),R=Ie(I=>{l.set("listElement",I)}),M=O.useMemo(()=>typeof a=="function"?r||(r=w.jsx(aoe,{children:a})):a,[a]),B=O.useMemo(()=>({empty:T}),[T]),D=u.useState("floatingId"),z=ct("div",t,{state:B,ref:[n,R,h?null:A],props:[_,{children:M,tabIndex:-1,id:D,role:g?"grid":"listbox","aria-multiselectable":E?"true":void 0,onKeyDown(I){if(!(y||S)&&I.key==="Enter"){const W=l.state.activeIndex;if(W==null)return;qn(I);const U=I.nativeEvent,H=l.state.listRef.current[W];H&&(l.state.selectionEventRef.current=U,H.click(),l.state.selectionEventRef.current=null)}},onKeyDownCapture(){l.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.state.keyboardActiveRef.current=!1}},o]});return k?z:w.jsx(Im,{elementsRef:x,labelsRef:p?void 0:v,children:z})}),MH=O.createContext(void 0);function coe(){const e=O.useContext(MH);if(e===void 0)throw new Error(qt(20));return e}const uoe=O.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,s=Ra(),a=De(s,Ye.mounted),o=De(s,Ye.forceMounted);return a||r||o?w.jsx(MH.Provider,{value:r,children:w.jsx(Lm,{ref:n,...i})}):null}),doe=O.forwardRef(function(t,n){const{render:r,className:i,anchor:s,positionMethod:a="absolute",side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:v=5,sticky:x=!1,disableAnchorTracking:b=!1,collisionAvoidance:g=C0,..._}=t,y=Ra(),{filteredItems:S}=gu(),k=q0(),E=coe(),T=De(y,Ye.modal),A=De(y,Ye.open),R=De(y,Ye.mounted),M=De(y,Ye.openMethod),B=De(y,Ye.triggerElement),D=De(y,Ye.inputElement),z=De(y,Ye.inputInsidePopup),I=S.length===0,U=N0({anchor:s??(z?B:D),floatingRootContext:k,positionMethod:a,mounted:R,side:o,sideOffset:u,align:l,alignOffset:h,arrowPadding:v,collisionBoundary:d,collisionPadding:p,sticky:x,disableAnchorTracking:b,keepMounted:E,collisionAvoidance:g,lazyFlip:!0});F0(A&&T&&M!=="touch",B);const H=O.useMemo(()=>{const L={...U.positionerStyles};return A||(L.pointerEvents="none"),{role:"presentation",hidden:!R,style:L}},[A,R,U.positionerStyles]),V=O.useMemo(()=>({open:A,side:U.side,align:U.align,anchorHidden:U.anchorHidden,empty:I}),[A,U.side,U.align,U.anchorHidden,I]);ze(()=>{y.set("popupSide",U.side)},[y,U.side]);const q=O.useMemo(()=>({side:U.side,align:U.align,arrowRef:U.arrowRef,arrowUncentered:U.arrowUncentered,arrowStyles:U.arrowStyles,anchorHidden:U.anchorHidden,isPositioned:U.isPositioned}),[U.side,U.align,U.arrowRef,U.arrowUncentered,U.arrowStyles,U.anchorHidden,U.isPositioned]),N=Ie(L=>{y.set("positionerElement",L)}),G=ct("div",t,{state:V,ref:[n,N],props:[H,_],stateAttributesMapping:to});return w.jsxs(PH.Provider,{value:q,children:[R&&T&&w.jsx(H0,{inert:wf(!A),cutout:D??B}),G]})}),foe={...to,...Ls},hoe=O.forwardRef(function(t,n){const{render:r,className:i,initialFocus:s,finalFocus:a,...o}=t,l=Ra(),u=wR(),h=q0(),{filteredItems:d}=gu(),p=De(l,Ye.mounted),v=De(l,Ye.open),x=De(l,Ye.openMethod),b=De(l,Ye.transitionStatus),g=De(l,Ye.inputInsidePopup),_=De(l,Ye.inputElement),y=d.length===0;Jr({open:v,ref:l.state.popupRef,onComplete(){v&&l.state.onOpenChangeComplete(!0)}});const S=O.useMemo(()=>({open:v,side:u.side,align:u.align,anchorHidden:u.anchorHidden,transitionStatus:b,empty:y}),[v,u.side,u.align,u.anchorHidden,b,y]),k=ct("div",t,{state:S,ref:[n,l.state.popupRef],props:[{role:g?"dialog":"presentation",tabIndex:-1,onFocus(R){const M=Gn(R.nativeEvent);x!=="touch"&&(lt(l.state.listElement,M)||M===R.currentTarget)&&l.state.inputRef.current?.focus()}},B0(b),o],stateAttributesMapping:foe}),T=s===void 0?g?R=>R==="touch"?l.state.popupRef.current:_:!1:s;let A;return a!=null?A=a:A=g?void 0:!1,w.jsx(O0,{context:h,disabled:!p,modal:!g,openInteractionType:x,initialFocus:T,returnFocus:A,children:k})}),jH=O.createContext(void 0);function LH(){const e=O.useContext(jH);if(!e)throw new Error(qt(19));return e}const poe=O.createContext(!1);function moe(){return O.useContext(poe)}const goe=O.memo(O.forwardRef(function(t,n){const{render:r,className:i,value:s=null,index:a,disabled:o=!1,nativeButton:l=!1,...u}=t,h=O.useRef(!1),d=O.useRef(null),p=Cf({index:a,textRef:d,indexGuessBehavior:aR.GuessFromOrder}),v=Ra(),x=moe(),{flatFilteredItems:b}=gu(),g=De(v,Ye.open),_=De(v,Ye.selectionMode),y=De(v,Ye.readOnly),S=De(v,Ye.virtualized),k=De(v,Ye.isItemEqualToValue),E=_!=="none",T=a??(S?Bd(b,s,k):p.index),A=p.index!==-1,R=De(v,Ye.id),M=De(v,Ye.isActive,T),B=De(v,Ye.isSelected,s),D=De(v,Ye.items),z=De(v,Ye.getItemProps),I=O.useRef(null),W=R!=null&&A?`${R}-${T}`:void 0,U=B&&E;ze(()=>{if(!(A&&(S||a!=null)))return;const ee=v.state.listRef.current;return ee[T]=I.current,()=>{delete ee[T]}},[A,S,T,a,v]),ze(()=>{if(!A||D)return;const Q=v.state.valuesRef.current;return Q[T]=s,_!=="none"&&v.state.allValuesRef.current.push(s),()=>{delete Q[T]}},[A,D,T,s,v,_]),ze(()=>{if(!g){h.current=!1;return}if(!A||D)return;const Q=v.state.selectedValue,ee=Array.isArray(Q)?Q[Q.length-1]:Q;Sa(ee,s,k)&&v.set("selectedIndex",T)},[A,D,g,v,T,s,k]);const H=O.useMemo(()=>({disabled:o,selected:U,highlighted:M}),[o,U,M]),V=z({active:M,selected:U});V.id=void 0,V.onFocus=void 0;const{getButtonProps:q,buttonRef:N}=fi({disabled:o,focusableWhenDisabled:!0,native:l});function G(Q){function ee(){v.state.handleSelection(Q,s)}v.state.submitOnItemClick?(cr.flushSync(ee),v.state.requestSubmit()):ee()}const L={id:W,role:x?"gridcell":"option","aria-disabled":o||void 0,"aria-selected":E?U:void 0,tabIndex:void 0,onPointerDownCapture(Q){h.current=!0,Q.preventDefault()},onClick(Q){o||y||G(Q.nativeEvent)},onMouseUp(Q){const ee=h.current;h.current=!1,!(o||y||Q.button!==0||ee||!M)&&G(Q.nativeEvent)}},$=ct("div",t,{ref:[N,n,p.ref,I],state:H,props:[V,L,u,q]}),F=O.useMemo(()=>({selected:U,textRef:d}),[U,d]);return w.jsx(jH.Provider,{value:F,children:$})})),voe=O.forwardRef(function(t,n){const{render:r,className:i,children:s,...a}=t,{filteredItems:o}=gu(),l=Ra(),u=o.length===0?s:null;return ct("div",t,{ref:[n,l.state.emptyRef],props:[{children:u,role:"status","aria-live":"polite","aria-atomic":!0},a]})});let VD=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});function DH(e){return O.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[VD.checked]:""}:{[VD.unchecked]:""}},...mu}),[e.indeterminate])}const IH=O.createContext(void 0);function yoe(){const e=O.useContext(IH);if(e===void 0)throw new Error(qt(14));return e}const boe="data-parent",_oe=O.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:s=!1,disabled:a=!1,id:o,indeterminate:l=!1,inputRef:u,name:h,onCheckedChange:d,parent:p=!1,readOnly:v=!1,render:x,required:b=!1,uncheckedValue:g,value:_,nativeButton:y=!1,...S}=t,{clearErrors:k}=Fm(),{disabled:E,name:T,setDirty:A,setFilled:R,setFocused:M,setTouched:B,state:D,validationMode:z,validityData:I,shouldValidateOnChange:W,validation:U}=Ms(),H=Pie(),{labelId:V,controlId:q,setControlId:N,getDescriptionProps:G}=Fl(),L=jie(),$=L?.parent,F=$&&L.allValues,Q=E||H.disabled||L?.disabled||a,ee=T??h,ie=_??ee,X=Fr(),K=Fr();let J=q;F?J=p?K:`${$.id}-${ie}`:o&&(J=o);let ne={};F&&(p?ne=L.parent.getParentProps():ie&&(ne=L.parent.getChildProps(ie)));const re=Ie(d),{checked:Z=r,indeterminate:ae=l,onCheckedChange:ue,...fe}=ne,he=L?.value,le=L?.setValue,Le=L?.defaultValue,ke=O.useRef(null),{getButtonProps:Be,buttonRef:_e}=fi({disabled:Q,native:y}),Re=L?.validation??U,[ge,Se]=Qi({controlled:ie&&he&&!p?he.includes(ie):Z,default:ie&&Le&&!p?Le.includes(ie):s,name:"Checkbox",state:"checked"});ze(()=>{if(N!==$n)return N(J),()=>{N(void 0)}},[J,L,N,p]),Um({enabled:!L,id:X,commit:Re.commit,value:ge,controlRef:ke,name:ee,getValue:()=>ge});const we=O.useRef(null),We=As(u,we,Re.inputRef);ze(()=>{we.current&&(we.current.indeterminate=ae,ge&&R(!0))},[ge,ae,R]),Pc(ge,()=>{L&&!p||(k(ee),R(ge),A(ge!==I.initialValue),W()?Re.commit(ge):Re.commit(ge,!0))});const it=Ro({checked:ge,disabled:Q,name:p?void 0:ee,id:J??void 0,required:b,ref:We,style:xf,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Xe){if(Xe.nativeEvent.defaultPrevented)return;const Oe=Xe.target.checked,st=Ue(gr,Xe.nativeEvent);if(ue?.(Oe,st),re(Oe,st),!st.isCanceled&&(Se(Oe),ie&&he&&le&&!p)){const ut=Oe?[...he,ie]:he.filter(Ze=>Ze!==ie);le(ut,st)}},onFocus(){ke.current?.focus()}},_!==void 0?{value:(L?ge&&_:_)||""}:Pn,G,L?Re.getValidationProps:Re.getInputValidationProps),Ae=F?!!Z:ge,Ve=F&&ae||l;O.useEffect(()=>{$&&ie&&$.disabledStatesRef.current.set(ie,Q)},[$,Q,ie]);const qe=O.useMemo(()=>({...D,checked:Ae,disabled:Q,readOnly:v,required:b,indeterminate:Ve}),[D,Ae,Q,v,b,Ve]),mt=DH(qe),Ge=ct("span",t,{state:qe,ref:[_e,ke,n,L?.registerControlRef],props:[{id:X,role:"checkbox","aria-checked":ae?"mixed":ge,"aria-readonly":v||void 0,"aria-required":b||void 0,"aria-labelledby":V,[boe]:p?"":void 0,onFocus(){M(!0)},onBlur(){const Xe=we.current;Xe&&(B(!0),M(!1),z==="onBlur"&&Re.commit(L?he:Xe.checked))},onClick(Xe){v||Q||(Xe.preventDefault(),we.current?.click())}},G,Re.getValidationProps,S,fe,Be],stateAttributesMapping:mt});return w.jsxs(IH.Provider,{value:qe,children:[Ge,!ge&&!L&&ee&&!p&&g!==void 0&&w.jsx("input",{type:"hidden",name:ee,value:g}),w.jsx("input",{...it})]})}),xoe=O.forwardRef(function(t,n){const{render:r,className:i,keepMounted:s=!1,...a}=t,o=yoe(),l=o.checked||o.indeterminate,{transitionStatus:u,setMounted:h}=eo(l),d=O.useRef(null),p=O.useMemo(()=>({...o,transitionStatus:u}),[o,u]);Jr({open:l,ref:d,onComplete(){l||h(!1)}});const v=DH(o),x=O.useMemo(()=>({...v,...Ls,...mu}),[v]),b=s||l,g=ct("span",t,{enabled:b,ref:[n,d],state:p,stateAttributesMapping:x,props:a});return b?g:null});function Soe(e){const{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,...s}=e;return w.jsx(Xse,{...s,selectionMode:t?"multiple":"single",selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i})}const woe=O.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=LH();return r||i?w.jsx(Coe,{...t,ref:n}):null}),Coe=O.memo(O.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...s}=e,{selected:a}=LH(),o=O.useRef(null),{transitionStatus:l,setMounted:u}=eo(a),h=O.useMemo(()=>({selected:a,transitionStatus:l}),[a,l]),d=ct("span",e,{ref:[t,o],state:h,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:Ls});return Jr({open:a,ref:o,onComplete(){a||u(!1)}}),d})),Eoe=O.createContext(void 0);function G0(e=!0){const t=O.useContext(Eoe);if(t===void 0&&!e)throw new Error(qt(25));return t}const NH=O.createContext(void 0);function CR(e){const t=O.useContext(NH);if(t===void 0&&!e)throw new Error(qt(33));return t}const BH=O.createContext(void 0);function Ul(e){const t=O.useContext(BH);if(t===void 0&&!e)throw new Error(qt(36));return t}const $H={type:"regular-item"};function zH(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:s,nativeButton:a,itemMetadata:o,nodeId:l}=e,u=O.useRef(null),h=G0(!0),d=h!==void 0,{events:p}=s.useState("floatingTreeRoot"),{getButtonProps:v,buttonRef:x}=fi({disabled:n,focusableWhenDisabled:!0,native:a}),b=O.useCallback(_=>Ro({id:i,role:"menuitem",tabIndex:r?0:-1,onMouseMove(y){l&&p.emit("itemhover",{nodeId:l,target:y.currentTarget})},onMouseEnter(){o.type==="submenu-trigger"&&o.setActive()},onKeyUp(y){y.key===" "&&s.context.typingRef.current&&y.preventBaseUIHandler()},onClick(y){t&&p.emit("close",{domEvent:y,reason:Fc})},onMouseUp(y){if(h){const S=h.initialCursorPointRef.current;if(h.initialCursorPointRef.current=null,d&&S&&Math.abs(y.clientX-S.x)<=1&&Math.abs(y.clientY-S.y)<=1)return}u.current&&s.context.allowMouseUpTriggerRef.current&&(!d||y.button===2)&&o.type==="regular-item"&&u.current.click()}},_,v),[i,r,v,t,p,s,d,h,o,l]),g=As(u,x);return O.useMemo(()=>({getItemProps:b,itemRef:g}),[b,g])}let WD=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const HH={checked(e){return e?{[WD.checked]:""}:{[WD.unchecked]:""}},...Ls},koe=O.forwardRef(function(t,n){const{render:r,className:i,id:s,label:a,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!0,...h}=t,d=Cf({label:a}),p=CR(!0),v=Fr(s),{store:x}=Ul(),b=x.useState("isActive",d.index),g=x.useState("itemProps"),{getItemProps:_,itemRef:y}=zH({closeOnClick:u,disabled:l,highlighted:b,id:v,store:x,nativeButton:o,nodeId:p?.nodeId,itemMetadata:$H}),S=O.useMemo(()=>({disabled:l,highlighted:b}),[l,b]);return ct("div",t,{state:S,props:[g,h,_],ref:[y,n,d.ref]})}),Toe={...to,...Ls},Ooe=O.forwardRef(function(t,n){const{render:r,className:i,finalFocus:s,...a}=t,{store:o}=Ul(),{side:l,align:u}=CR(),h=yR()!=null,d=o.useState("open"),p=o.useState("transitionStatus"),v=o.useState("popupProps"),x=o.useState("mounted"),b=o.useState("instantType"),g=o.useState("activeTriggerElement"),_=o.useState("parent"),y=o.useState("lastOpenChangeReason"),S=o.useState("rootId"),k=o.useState("floatingRootContext"),E=o.useState("floatingTreeRoot"),T=o.useState("closeDelay"),A=o.useState("activeTriggerElement");Jr({open:d,ref:o.context.popupRef,onComplete(){d&&o.context.onOpenChangeComplete?.(!0)}}),O.useEffect(()=>{function I(W){o.setOpen(!1,Ue(W.reason,W.domEvent))}return E.events.on("close",I),()=>{E.events.off("close",I)}},[E.events,o]);const R=o.useState("hoverEnabled"),M=o.useState("disabled");Pne(k,{enabled:R&&!M&&_.type!=="context-menu"&&_.type!=="menubar",closeDelay:T});const B=O.useMemo(()=>({transitionStatus:p,side:l,align:u,open:d,nested:_.type==="menu",instant:b}),[p,l,u,d,_.type,b]),D=ct("div",t,{state:B,ref:[n,o.context.popupRef],stateAttributesMapping:Toe,props:[v,{onKeyDown(I){h&&sR.has(I.key)&&I.stopPropagation()}},B0(p),a,{"data-rootownerid":S}]});let z=_.type===void 0||_.type==="context-menu";return(g||_.type==="menubar"&&y!==k0)&&(z=!0),w.jsx(O0,{context:k,modal:!1,disabled:!x,returnFocus:s===void 0?z:s,initialFocus:_.type!=="menu",restoreFocus:!0,externalTree:_.type!=="menubar"?E:void 0,previousFocusableElement:A,nextFocusableElement:_.type===void 0?o.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?o.context.beforeContentFocusGuardRef:void 0,children:D})}),FH=O.createContext(void 0);function Roe(){const e=O.useContext(FH);if(e===void 0)throw new Error(qt(32));return e}const Aoe=O.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:s}=Ul();return s.useState("mounted")||r?w.jsx(FH.Provider,{value:r,children:w.jsx(Lm,{ref:n,...i})}):null}),Poe=O.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:s,render:a,side:o,align:l,sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:v=5,sticky:x=!1,disableAnchorTracking:b=!1,collisionAvoidance:g=C0,..._}=t,{store:y}=Ul(),S=Roe(),k=G0(!0),E=y.useState("parent"),T=y.useState("floatingRootContext"),A=y.useState("floatingTreeRoot"),R=y.useState("mounted"),M=y.useState("open"),B=y.useState("modal"),D=y.useState("activeTriggerElement"),z=y.useState("lastOpenChangeReason"),I=y.useState("floatingNodeId"),W=y.useState("floatingParentNodeId");let U=r,H=u,V=h,q=l,N=g;E.type==="context-menu"&&(U=r??E.context?.anchor,q=q??"start",!o&&q!=="center"&&(V=t.alignOffset??2,H=t.sideOffset??-5));let G=o,L=q;E.type==="menu"?(G=G??"inline-end",L=L??"start",N=t.collisionAvoidance??f$):E.type==="menubar"&&(G=G??"bottom",L=L??"start");const $=E.type==="context-menu",F=N0({anchor:U,floatingRootContext:T,positionMethod:k?"fixed":i,mounted:R,side:G,sideOffset:H,align:L,alignOffset:V,arrowPadding:$?0:v,collisionBoundary:d,collisionPadding:p,sticky:x,nodeId:I,keepMounted:S,disableAnchorTracking:b,collisionAvoidance:N,shiftCrossAxis:$,externalTree:A}),Q=O.useMemo(()=>{const ne={};return M||(ne.pointerEvents="none"),{role:"presentation",hidden:!R,style:{...F.positionerStyles,...ne}}},[M,R,F.positionerStyles]);O.useEffect(()=>{function ne(re){re.open?(re.parentNodeId===I&&y.set("hoverEnabled",!1),re.nodeId!==I&&re.parentNodeId===y.select("floatingParentNodeId")&&y.setOpen(!1,Ue(ap))):re.parentNodeId===I&&re.reason!==ap&&y.set("hoverEnabled",!0)}return A.events.on("menuopenchange",ne),()=>{A.events.off("menuopenchange",ne)}},[y,A.events,I]),O.useEffect(()=>{if(y.select("floatingParentNodeId")==null)return;function ne(re){if(re.open||re.nodeId!==y.select("floatingParentNodeId"))return;const Z=re.reason??ap;y.setOpen(!1,Ue(Z))}return A.events.on("menuopenchange",ne),()=>{A.events.off("menuopenchange",ne)}},[A.events,y]),O.useEffect(()=>{function ne(re){!M||re.nodeId!==y.select("floatingParentNodeId")||re.target&&D&&D!==re.target&&y.setOpen(!1,Ue(ap))}return A.events.on("itemhover",ne),()=>{A.events.off("itemhover",ne)}},[A.events,M,D,y]),O.useEffect(()=>{const ne={open:M,nodeId:I,parentNodeId:W,reason:y.select("lastOpenChangeReason")};A.events.emit("menuopenchange",ne)},[A.events,M,y,I,W]);const ee=O.useMemo(()=>({open:M,side:F.side,align:F.align,anchorHidden:F.anchorHidden,nested:E.type==="menu"}),[M,F.side,F.align,F.anchorHidden,E.type]),ie=O.useMemo(()=>({side:F.side,align:F.align,arrowRef:F.arrowRef,arrowUncentered:F.arrowUncentered,arrowStyles:F.arrowStyles,nodeId:F.context.nodeId}),[F.side,F.align,F.arrowRef,F.arrowUncentered,F.arrowStyles,F.context.nodeId]),X=ct("div",t,{state:ee,stateAttributesMapping:to,ref:[n,y.useStateSetter("positionerElement")],props:[Q,_]}),K=R&&E.type!=="menu"&&(E.type!=="menubar"&&B&&z!==Kn||E.type==="menubar"&&E.context.modal);let J=null;return E.type==="menubar"?J=E.context.contentElement:E.type===void 0&&(J=D),w.jsxs(NH.Provider,{value:ie,children:[K&&w.jsx(H0,{ref:E.type==="context-menu"||E.type==="nested-context-menu"?E.context.internalBackdropRef:null,inert:wf(!M),cutout:J}),w.jsx(J$,{id:I,children:w.jsx(Im,{elementsRef:y.context.itemDomElements,labelsRef:y.context.itemLabels,children:X})})]})}),UH=O.createContext(void 0);function Moe(){const e=O.useContext(UH);if(e===void 0)throw new Error(qt(34));return e}const joe=O.memo(O.forwardRef(function(t,n){const{render:r,className:i,value:s,defaultValue:a,onValueChange:o,disabled:l=!1,...u}=t,[h,d]=Qi({controlled:s,default:a,name:"MenuRadioGroup"}),p=Ie(o),v=Ie((_,y)=>{p?.(_,y),!y.isCanceled&&d(_)}),x=O.useMemo(()=>({disabled:l}),[l]),b=ct("div",t,{state:x,ref:n,props:{role:"group","aria-disabled":l||void 0,...u}}),g=O.useMemo(()=>({value:h,setValue:v,disabled:l}),[h,v,l]);return w.jsx(UH.Provider,{value:g,children:b})})),VH=O.createContext(void 0);function Loe(){const e=O.useContext(VH);if(e===void 0)throw new Error(qt(35));return e}const Doe=O.forwardRef(function(t,n){const{render:r,className:i,id:s,label:a,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!1,value:h,...d}=t,p=Cf({label:a}),v=CR(!0),x=Fr(s),{store:b}=Ul(),g=b.useState("isActive",p.index),_=b.useState("itemProps"),{value:y,setValue:S,disabled:k}=Moe(),E=k||l,T=y===h,{getItemProps:A,itemRef:R}=zH({closeOnClick:u,disabled:E,highlighted:g,id:x,store:b,nativeButton:o,nodeId:v?.nodeId,itemMetadata:$H}),M=O.useMemo(()=>({disabled:E,highlighted:g,checked:T}),[E,g,T]),B=Ie(z=>{const I={...Ue(Fc,z.nativeEvent),preventUnmountOnClose:()=>{}};S(h,I)}),D=ct("div",t,{state:M,stateAttributesMapping:HH,props:[_,{role:"menuitemradio","aria-checked":T,onClick:B},d,A],ref:[R,n,p.ref]});return w.jsx(VH.Provider,{value:M,children:D})}),Ioe=O.forwardRef(function(t,n){const{render:r,className:i,keepMounted:s=!1,...a}=t,o=Loe(),l=O.useRef(null),{transitionStatus:u,setMounted:h}=eo(o.checked);Jr({open:o.checked,ref:l,onComplete(){o.checked||h(!1)}});const d=O.useMemo(()=>({checked:o.checked,disabled:o.disabled,highlighted:o.highlighted,transitionStatus:u}),[o.checked,o.disabled,o.highlighted,u]);return ct("span",t,{state:d,stateAttributesMapping:HH,ref:[n,l],props:{"aria-hidden":!0,...a},enabled:s||o.checked})}),Noe=O.createContext(null);function WH(e){return O.useContext(Noe)}const Boe={...xz,disabled:Te(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Te(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Te(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Te(e=>e.stickIfOpen),parent:Te(e=>e.parent),rootId:Te(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Te(e=>e.activeIndex),isActive:Te((e,t)=>e.activeIndex===t),hoverEnabled:Te(e=>e.hoverEnabled),instantType:Te(e=>e.instantType),lastOpenChangeReason:Te(e=>e.openChangeReason),floatingTreeRoot:Te(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Te(e=>e.floatingNodeId),floatingParentNodeId:Te(e=>e.floatingParentNodeId),itemProps:Te(e=>e.itemProps),closeDelay:Te(e=>e.closeDelay),keyboardEventRelay:Te(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class ER extends tR{constructor(t){super({...$oe(),...t},{positionerRef:O.createRef(),popupRef:O.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:O.createRef(),beforeContentFocusGuardRef:O.createRef(),onOpenChangeComplete:void 0,triggerElements:new A0},Boe),this.observe(Te(n=>n.allowMouseEnter),(n,r)=>{this.state.parent.type==="menu"&&n!==r&&this.state.parent.store.set("allowMouseEnter",n)}),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){this.unsubscribeParentListener=n.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}static useStore(t,n){return zr(()=>t??new ER(n)).current}unsubscribeParentListener=null}function $oe(){return{..._z(),disabled:!1,modal:!0,allowMouseEnter:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new QO,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Pn,keyboardEventRelay:void 0,closeDelay:0}}const zoe=O.createContext(void 0);function Hoe(){return O.useContext(zoe)}function Foe(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:s=!1,disabled:a=!1,modal:o,loopFocus:l=!0,orientation:u="vertical",actionsRef:h,closeParentOnEsc:d=!1,handle:p,triggerId:v,defaultTriggerId:x=null,highlightItemOnHover:b=!0}=e,g=G0(!0),_=Ul(!0),y=WH(),S=Hoe(),k=O.useMemo(()=>S&&_?{type:"menu",store:_.store}:y?{type:"menubar",context:y}:g&&!_?{type:"context-menu",context:g}:{type:void 0},[g,_,y,S]),E=ER.useStore(p?.store,{parent:k}),T=E.useState("floatingTreeRoot"),A=ZO(T),R=Zs();ze(()=>{g&&!_?E.update({parent:{type:"context-menu",context:g},floatingNodeId:A,floatingParentNodeId:R}):_&&E.update({floatingNodeId:A,floatingParentNodeId:R})},[g,_,A,R,E]),E.useControlledProp("open",n,s),E.useControlledProp("activeTriggerId",v,x),E.useContextCallback("onOpenChangeComplete",i);const M=E.useState("open"),B=E.useState("activeTriggerElement"),D=E.useState("positionerElement"),z=E.useState("hoverEnabled"),I=E.useState("modal"),W=E.useState("disabled"),U=E.useState("lastOpenChangeReason"),H=E.useState("parent"),V=E.useState("activeIndex"),q=E.useState("payload"),N=E.useState("floatingParentNodeId"),G=O.useRef(null),L=N!=null;let $;E.useSyncedValues({disabled:a,modal:H.type===void 0?o:void 0,rootId:Nl()});const{openMethod:F,triggerProps:Q,reset:ee}=U0(M);yz(E);const{forceUnmount:ie}=bz(M,E,()=>{E.update({allowMouseEnter:!1,stickIfOpen:!0}),ee()}),X=O.useRef(H.type!=="context-menu"),K=fn();O.useEffect(()=>{if(M||(G.current=null),H.type==="context-menu"){if(!M){K.clear(),X.current=!1;return}K.start(500,()=>{X.current=!0})}},[K,M,H.type]),F0(M&&I&&U!==Kn&&F!=="touch",D),ze(()=>{!M&&!z&&E.set("hoverEnabled",!0)},[M,z,E]);const J=O.useRef(!0),ne=fn(),re=Ie((Oe,st)=>{const ut=st.reason;if(M===Oe&&st.trigger===B||(st.preventUnmountOnClose=()=>{E.set("preventUnmountingOnClose",!0)},!Oe&&st.trigger==null&&(st.trigger=B??void 0),r?.(Oe,st),st.isCanceled))return;const Ze={open:Oe,nativeEvent:st.event,reason:st.reason,nested:L};$?.emit("openchange",Ze);const at=st.event;if(Oe===!1&&at?.type==="click"&&at.pointerType==="touch"&&!J.current)return;if(!Oe&&V!==null){const Mt=E.context.itemDomElements.current[V];queueMicrotask(()=>{Mt?.setAttribute("tabindex","-1")})}Oe&&ut===qy?(J.current=!1,ne.start(300,()=>{J.current=!0})):(J.current=!0,ne.clear());const It=(ut===kl||ut===Fc)&&at.detail===0&&at?.isTrusted,ft=!Oe&&(ut===T0||ut==null);function _n(){const Mt={open:Oe,openChangeReason:ut};G.current=st.event??null;const Et=st.trigger?.id??null;(Et||Oe)&&(Mt.activeTriggerId=Et,Mt.activeTriggerElement=st.trigger??null),E.update(Mt)}ut===Kn?cr.flushSync(_n):_n(),H.type==="menubar"&&(ut===qy||ut===Xs||ut===Kn||ut===_d||ut===ap)?E.set("instantType","group"):It||ft?E.set("instantType",It?"click":"dismiss"):E.set("instantType",void 0)}),Z=O.useCallback(Oe=>{const st=Ue(Oe);return st.preventUnmountOnClose=()=>{E.set("preventUnmountingOnClose",!0)},st},[E]),ae=O.useCallback(()=>{E.setOpen(!1,Z(nz))},[E,Z]);O.useImperativeHandle(h,()=>({unmount:ie,close:ae}),[ie,ae]);let ue;H.type==="context-menu"&&(ue=H.context),O.useImperativeHandle(ue?.positionerRef,()=>D,[D]),O.useImperativeHandle(ue?.actionsRef,()=>({setOpen:re}),[re]);const fe=Sz({popupStore:E,onOpenChange:re});$=fe.context.events,O.useEffect(()=>{const Oe=({open:st,eventDetails:ut})=>re(st,ut);return $.on("setOpen",Oe),()=>{$?.off("setOpen",Oe)}},[$,re]);const he=Dm(fe,{enabled:!W,bubbles:d&&H.type==="menu",outsidePress(){return H.type!=="context-menu"||G.current?.type==="contextmenu"?!0:X.current},externalTree:L?T:void 0}),le=Cz(fe,{role:"menu"}),Le=Bl(),ke=O.useCallback(Oe=>{E.select("activeIndex")!==Oe&&E.set("activeIndex",Oe)},[E]),Be=rR(fe,{enabled:!W,listRef:E.context.itemDomElements,activeIndex:V,nested:H.type!==void 0,loopFocus:l,orientation:u,parentOrientation:H.type==="menubar"?H.context.orientation:void 0,rtl:Le==="rtl",disabledIndices:ci,onNavigate:ke,openOnArrowKeyDown:H.type!=="context-menu",externalTree:L?T:void 0,focusItemOnHover:b}),_e=O.useCallback(Oe=>{E.context.typingRef.current=Oe},[E]),Re=iR(fe,{listRef:E.context.itemLabels,activeIndex:V,resetMs:_J,onMatch:Oe=>{M&&Oe!==V&&E.set("activeIndex",Oe)},onTypingChange:_e}),{getReferenceProps:ge,getFloatingProps:Se,getItemProps:we,getTriggerProps:We}=du([he,le,Be,Re]),it=O.useMemo(()=>{const Oe=Ro(ge(),{onMouseEnter(){E.set("hoverEnabled",!0)},onMouseMove(){E.set("allowMouseEnter",!0)}},Q);return delete Oe.role,Oe},[ge,E,Q]),Ae=O.useMemo(()=>{const Oe=We();if(!Oe)return Oe;const st=Ro(Oe,Q);return delete st.role,delete st["aria-controls"],st},[We,Q]),Ve=Tl(),qe=O.useMemo(()=>Se({onMouseEnter(){H.type==="menu"&&Ve.request(()=>E.set("hoverEnabled",!1))},onMouseMove(){E.set("allowMouseEnter",!0)},onClick(){E.select("hoverEnabled")&&E.set("hoverEnabled",!1)},onKeyDown(Oe){const st=E.select("keyboardEventRelay");st&&!Oe.isPropagationStopped()&&st(Oe)}}),[Se,H.type,Ve,E]),mt=O.useMemo(()=>we(),[we]);E.useSyncedValues({floatingRootContext:fe,activeTriggerProps:it,inactiveTriggerProps:Ae,popupProps:qe,itemProps:mt});const Ge=O.useMemo(()=>({store:E,parent:k}),[E,k]),Xe=w.jsx(BH.Provider,{value:Ge,children:typeof t=="function"?t({payload:q}):t});return H.type===void 0||H.type==="context-menu"?w.jsx(ez,{externalTree:T,children:Xe}):Xe}function qH(e){if(Cn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!So(e))return qH(Oo(e))}function Uoe(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,i=O.useRef(!1);return O.useMemo(()=>t?{onMouseDown:s=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,Hr(s.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:s=>{i.current&&(i.current=!1,s.preventBaseUIHandler())}}:Pn,[t,n,r])}const Uv=2,Voe=O.forwardRef(function(t,n){const{render:r,className:i,disabled:s=!1,nativeButton:a=!0,id:o,openOnHover:l,delay:u=100,closeDelay:h=0,handle:d,payload:p,...v}=t,x=Ul(!0),b=d?.store??x?.store;if(!b)throw new Error(qt(85));const g=Fr(o),_=b.useState("isTriggerActive",g),y=b.useState("floatingRootContext"),S=b.useState("isOpenedByTrigger",g),k=O.useRef(null),E=qoe(),T=$O(!0),A=Js(),R=O.useMemo(()=>A??new QO,[A]),M=ZO(R),B=Zs(),{registerTrigger:D,isMountedByThisTrigger:z}=vz(g,k,b,{payload:p,closeDelay:h,parent:E,floatingTreeRoot:R,floatingNodeId:M,floatingParentNodeId:B,keyboardEventRelay:T?.relayKeyboardEvent}),I=b.useState("disabled"),W=s||I||E.type==="menubar"&&E.context.disabled,{getButtonProps:U,buttonRef:H}=fi({disabled:W,native:a});O.useEffect(()=>{!S&&E.type===void 0&&(b.context.allowMouseUpTriggerRef.current=!1)},[b,S,E.type]);const V=O.useRef(null),q=fn(),N=Ie(le=>{if(!V.current)return;q.clear(),b.context.allowMouseUpTriggerRef.current=!1;const Le=le.target;if(lt(V.current,Le)||lt(b.select("positionerElement"),Le)||Le===V.current||Le!=null&&qH(Le)===b.select("rootId"))return;const ke=gR(V.current);le.clientX>=ke.left-Uv&&le.clientX<=ke.right+Uv&&le.clientY>=ke.top-Uv&&le.clientY<=ke.bottom+Uv||R.events.emit("close",{domEvent:le,reason:tz})});O.useEffect(()=>{S&&b.select("lastOpenChangeReason")===Kn&&Hr(V.current).addEventListener("mouseup",N,{once:!0})},[S,N,b]);const G=E.type==="menubar"&&E.context.hasSubmenuOpen,$=Lne(y,{enabled:(l??G??!1)&&!W&&E.type!=="context-menu"&&(E.type!=="menubar"||G&&!z),handleClose:Ez({blockPointerEvents:E.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:E.type===void 0?u:void 0,delay:{close:h},triggerElementRef:k,externalTree:R,isActiveTrigger:_}),F=Woe(S,b.select("lastOpenChangeReason")),Q=Sf(y,{enabled:!W&&E.type!=="context-menu",event:S&&E.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:E.type===void 0?F:!1}),ee=Tne(y,{enabled:!W&&(E.type!=="menubar"&&S||G)}),ie=Uoe({open:S,enabled:E.type==="menubar",mouseDownAction:"open"}),X=du([Q,ee]),K=E.type==="menubar",J=O.useMemo(()=>({disabled:W,open:S}),[W,S]),ne=b.useState("triggerProps",z),re=[V,n,H,D,k],Z=[X.getReferenceProps(),$??Pn,ne,{"aria-haspopup":"menu",id:g,onMouseDown:le=>{if(b.select("open"))return;q.start(200,()=>{b.context.allowMouseUpTriggerRef.current=!0}),Hr(le.currentTarget).addEventListener("mouseup",N,{once:!0})}},K?{role:"menuitem"}:{},ie,v,U],ae=O.useRef(null),ue=Ie(le=>{cr.flushSync(()=>{b.setOpen(!1,Ue(Xs,le.nativeEvent,le.currentTarget))}),Zee(ae.current)?.focus()}),fe=Ie(le=>{const Le=b.select("positionerElement");if(Le&&Ys(le,Le))b.context.beforeContentFocusGuardRef.current?.focus();else{cr.flushSync(()=>{b.setOpen(!1,Ue(Xs,le.nativeEvent,le.currentTarget))});let ke=Qee(k.current);for(;ke!==null&<(Le,ke)||ke?.hasAttribute("aria-hidden");){const Be=ke;if(ke=jm(ke),ke===Be)break}ke?.focus()}}),he=ct("button",t,{enabled:!K,stateAttributesMapping:Nd,state:J,ref:re,props:Z});return K?w.jsx(I0,{tag:"button",render:r,className:i,state:J,refs:re,props:Z,stateAttributesMapping:Nd}):S?w.jsxs(O.Fragment,{children:[w.jsx(Ao,{ref:ae,onFocus:ue},`${g}-pre-focus-guard`),w.jsx(O.Fragment,{children:he},g),w.jsx(Ao,{ref:b.context.triggerFocusTargetRef,onFocus:fe},`${g}-post-focus-guard`)]}):w.jsx(O.Fragment,{children:he},g)});function Woe(e,t){const n=fn(),[r,i]=O.useState(!1);return ze(()=>{e&&t==="trigger-hover"?(i(!0),n.start(u$,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function qoe(){const e=G0(!0),t=Ul(!0),n=WH();return O.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}function la(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const GH=O.createContext(void 0);function K0(){const e=O.useContext(GH);if(e===void 0)throw new Error(qt(53));return e}let Jy=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const Vv=500,qD=16;function Ss(e,t,n){if(!e)return 0;const r=getComputedStyle(e),i=n==="x"?"Inline":"Block";return n==="x"&&t==="margin"?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}let Goe=(function(e){return e.orientation="data-orientation",e.hovering="data-hovering",e.scrolling="data-scrolling",e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({}),od=(function(e){return e.hasOverflowX="data-has-overflow-x",e.hasOverflowY="data-has-overflow-y",e.overflowXStart="data-overflow-x-start",e.overflowXEnd="data-overflow-x-end",e.overflowYStart="data-overflow-y-start",e.overflowYEnd="data-overflow-y-end",e})({});const kR={hasOverflowX:e=>e?{[od.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[od.hasOverflowY]:""}:null,overflowXStart:e=>e?{[od.overflowXStart]:""}:null,overflowXEnd:e=>e?{[od.overflowXEnd]:""}:null,overflowYStart:e=>e?{[od.overflowYStart]:""}:null,overflowYEnd:e=>e?{[od.overflowYEnd]:""}:null,cornerHidden:()=>null},GD={width:0,height:0},Koe={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Yoe=O.forwardRef(function(t,n){const{render:r,className:i,overflowEdgeThreshold:s,...a}=t,[o,l]=O.useState(!1),[u,h]=O.useState(!1),[d,p]=O.useState(!1),[v,x]=O.useState(GD),[b,g]=O.useState(GD),[_,y]=O.useState(!1),[S,k]=O.useState(Koe),E=Fr(),T=O.useRef(null),A=O.useRef(null),R=O.useRef(null),M=O.useRef(null),B=O.useRef(null),D=O.useRef(null),z=O.useRef(null),I=O.useRef(!1),W=O.useRef(0),U=O.useRef(0),H=O.useRef(0),V=O.useRef(0),q=O.useRef("vertical"),N=fn(),G=fn(),L=O.useRef({x:0,y:0}),[$,F]=O.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),Q=Xoe(s),ee=Ie(ue=>{const fe=ue.x-L.current.x,he=ue.y-L.current.y;L.current=ue,he!==0&&(p(!0),N.start(Vv,()=>{p(!1)})),fe!==0&&(h(!0),G.start(Vv,()=>{h(!1)}))}),ie=Ie(ue=>{ue.button===0&&(I.current=!0,W.current=ue.clientY,U.current=ue.clientX,q.current=ue.currentTarget.getAttribute(Goe.orientation),A.current&&(H.current=A.current.scrollTop,V.current=A.current.scrollLeft),B.current&&q.current==="vertical"&&B.current.setPointerCapture(ue.pointerId),D.current&&q.current==="horizontal"&&D.current.setPointerCapture(ue.pointerId))}),X=Ie(ue=>{if(!I.current)return;const fe=ue.clientY-W.current,he=ue.clientX-U.current;if(A.current){const le=A.current.scrollHeight,Le=A.current.clientHeight,ke=A.current.scrollWidth,Be=A.current.clientWidth;if(B.current&&R.current&&q.current==="vertical"){const _e=Ss(R.current,"padding","y"),Re=Ss(B.current,"margin","y"),ge=B.current.offsetHeight,Se=R.current.offsetHeight-ge-_e-Re,we=fe/Se;A.current.scrollTop=H.current+we*(le-Le),ue.preventDefault(),p(!0),N.start(Vv,()=>{p(!1)})}if(D.current&&M.current&&q.current==="horizontal"){const _e=Ss(M.current,"padding","x"),Re=Ss(D.current,"margin","x"),ge=D.current.offsetWidth,Se=M.current.offsetWidth-ge-_e-Re,we=he/Se;A.current.scrollLeft=V.current+we*(ke-Be),ue.preventDefault(),h(!0),G.start(Vv,()=>{h(!1)})}}}),K=Ie(ue=>{I.current=!1,B.current&&q.current==="vertical"&&B.current.releasePointerCapture(ue.pointerId),D.current&&q.current==="horizontal"&&D.current.releasePointerCapture(ue.pointerId)});function J(ue){const fe=ue.pointerType==="touch";if(y(fe),!fe){const he=lt(T.current,ue.target);l(he)}}const ne=O.useMemo(()=>({hasOverflowX:!$.scrollbarXHidden,hasOverflowY:!$.scrollbarYHidden,overflowXStart:S.xStart,overflowXEnd:S.xEnd,overflowYStart:S.yStart,overflowYEnd:S.yEnd,cornerHidden:$.cornerHidden}),[$.scrollbarXHidden,$.scrollbarYHidden,$.cornerHidden,S]),re={role:"presentation",onPointerEnter:J,onPointerMove:J,onPointerDown({pointerType:ue}){y(ue==="touch")},onPointerLeave(){l(!1)},style:{position:"relative",[Jy.scrollAreaCornerHeight]:`${v.height}px`,[Jy.scrollAreaCornerWidth]:`${v.width}px`}},Z=ct("div",t,{state:ne,ref:[n,T],props:[re,a],stateAttributesMapping:kR}),ae=O.useMemo(()=>({handlePointerDown:ie,handlePointerMove:X,handlePointerUp:K,handleScroll:ee,cornerSize:v,setCornerSize:x,thumbSize:b,setThumbSize:g,touchModality:_,cornerRef:z,scrollingX:u,setScrollingX:h,scrollingY:d,setScrollingY:p,hovering:o,setHovering:l,viewportRef:A,rootRef:T,scrollbarYRef:R,scrollbarXRef:M,thumbYRef:B,thumbXRef:D,rootId:E,hiddenState:$,setHiddenState:F,overflowEdges:S,setOverflowEdges:k,viewportState:ne,overflowEdgeThreshold:Q}),[ie,X,K,ee,v,b,_,z,u,h,d,p,o,l,A,T,R,M,B,D,E,$,S,ne,Q]);return w.jsxs(GH.Provider,{value:ae,children:[Dp.element,Z]})});function Xoe(e){if(typeof e=="number"){const t=Math.max(0,e);return{xStart:t,xEnd:t,yStart:t,yEnd:t}}return{xStart:Math.max(0,e?.xStart||0),xEnd:Math.max(0,e?.xEnd||0),yStart:Math.max(0,e?.yStart||0),yEnd:Math.max(0,e?.yEnd||0)}}const Qoe=O.createContext(void 0);function Zoe(e,t){if(typeof IntersectionObserver>"u")return()=>{};const n=new IntersectionObserver(r=>{r.forEach(i=>{i.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}let ml=(function(e){return e.scrollAreaOverflowXStart="--scroll-area-overflow-x-start",e.scrollAreaOverflowXEnd="--scroll-area-overflow-x-end",e.scrollAreaOverflowYStart="--scroll-area-overflow-y-start",e.scrollAreaOverflowYEnd="--scroll-area-overflow-y-end",e})({}),KD=!1;function Joe(){KD||UO||(typeof CSS<"u"&&"registerProperty"in CSS&&[ml.scrollAreaOverflowXStart,ml.scrollAreaOverflowXEnd,ml.scrollAreaOverflowYStart,ml.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),KD=!0)}const eae=O.forwardRef(function(t,n){const{render:r,className:i,...s}=t,{viewportRef:a,scrollbarYRef:o,scrollbarXRef:l,thumbYRef:u,thumbXRef:h,cornerRef:d,setCornerSize:p,setThumbSize:v,rootId:x,setHiddenState:b,hiddenState:g,handleScroll:_,setHovering:y,setOverflowEdges:S,overflowEdges:k,overflowEdgeThreshold:E}=K0(),T=Bl(),A=O.useRef(!0),R=fn(),M=fn();function B(){const V=a.current,q=o.current,N=l.current,G=u.current,L=h.current,$=d.current;if(!V)return;const F=V.scrollHeight,Q=V.scrollWidth,ee=V.clientHeight,ie=V.clientWidth,X=V.scrollTop,K=V.scrollLeft;if(F===0||Q===0)return;const J=ee>=F,ne=ie>=Q,re=ie/Q,Z=ee/F,ae=Math.max(0,Q-ie),ue=Math.max(0,F-ee);let fe=0,he=0;ne||(T==="rtl"?fe=la(-K,0,ae):fe=la(K,0,ae),he=ae-fe);const le=J?0:la(X,0,ue),Le=J?0:ue-le,ke=ne?0:ie,Be=J?0:ee,_e=Ss(N,"padding","x"),Re=Ss(q,"padding","y"),ge=Ss(L,"margin","x"),Se=Ss(G,"margin","y"),we=ke-_e-ge,We=Be-Re-Se,it=N?Math.min(N.offsetWidth,we):we,Ae=q?Math.min(q.offsetHeight,We):We,Ve=Math.max(qD,it*re),qe=Math.max(qD,Ae*Z);if(v(Ze=>Ze.height===qe&&Ze.width===Ve?Ze:{width:Ve,height:qe}),q&&G){const Ze=q.offsetHeight-qe-Re-Se,at=F-ee,It=at===0?0:X/at,ft=Math.min(Ze,Math.max(0,It*Ze));G.style.transform=`translate3d(0,${ft}px,0)`}if(N&&L){const Ze=N.offsetWidth-Ve-_e-ge,at=Q-ie,It=at===0?0:K/at,ft=T==="rtl"?la(It*Ze,-Ze,0):la(It*Ze,0,Ze);L.style.transform=`translate3d(${ft}px,0,0)`}const mt=la(fe,0,ae),Ge=la(he,0,ae),Xe=la(le,0,ue),Oe=la(Le,0,ue),st=[[ml.scrollAreaOverflowXStart,mt],[ml.scrollAreaOverflowXEnd,Ge],[ml.scrollAreaOverflowYStart,Xe],[ml.scrollAreaOverflowYEnd,Oe]];for(const[Ze,at]of st)V.style.setProperty(Ze,`${at}px`);if($){if(ne||J)p({width:0,height:0});else if(!ne&&!J){const Ze=q?.offsetWidth||0,at=N?.offsetHeight||0;p({width:Ze,height:at})}}b(Ze=>{const at=J||ne;return Ze.scrollbarYHidden===J&&Ze.scrollbarXHidden===ne&&Ze.cornerHidden===at?Ze:{scrollbarYHidden:J,scrollbarXHidden:ne,cornerHidden:at}});const ut={xStart:!ne&&mt>E.xStart,xEnd:!ne&&Ge>E.xEnd,yStart:!J&&Xe>E.yStart,yEnd:!J&&Oe>E.yEnd};S(Ze=>Ze.xStart===ut.xStart&&Ze.xEnd===ut.xEnd&&Ze.yStart===ut.yStart&&Ze.yEnd===ut.yEnd?Ze:ut)}const D=Ie(()=>{cr.flushSync(B)});ze(()=>a.current?(Joe(),Zoe(a.current,D)):void 0,[D,a]),ze(()=>{queueMicrotask(D)},[D,g,T]),ze(()=>{a.current?.matches(":hover")&&y(!0)},[a,y]),O.useEffect(()=>{const V=a.current;if(typeof ResizeObserver>"u"||!V)return;const q=new ResizeObserver(D);return q.observe(V),M.start(0,()=>{Promise.all(V.getAnimations({subtree:!0}).map(N=>N.finished)).then(D).catch(()=>{})}),()=>{q.disconnect(),M.clear()}},[D,a,M]);function z(){A.current=!1}const I={role:"presentation",...x&&{"data-id":`${x}-viewport`},...(!g.scrollbarXHidden||!g.scrollbarYHidden)&&{tabIndex:0},className:Dp.className,style:{overflow:"scroll"},onScroll(){a.current&&(D(),A.current||_({x:a.current.scrollLeft,y:a.current.scrollTop}),R.start(100,()=>{A.current=!0}))},onWheel:z,onTouchMove:z,onPointerMove:z,onPointerEnter:z,onKeyDown:z},W=O.useMemo(()=>({hasOverflowX:!g.scrollbarXHidden,hasOverflowY:!g.scrollbarYHidden,overflowXStart:k.xStart,overflowXEnd:k.xEnd,overflowYStart:k.yStart,overflowYEnd:k.yEnd,cornerHidden:g.cornerHidden}),[g.scrollbarXHidden,g.scrollbarYHidden,g.cornerHidden,k]),U=ct("div",t,{ref:[n,a],state:W,props:[I,s],stateAttributesMapping:kR}),H=O.useMemo(()=>({computeThumbPosition:D}),[D]);return w.jsx(Qoe.Provider,{value:H,children:U})}),KH=O.createContext(void 0);function tae(){const e=O.useContext(KH);if(e===void 0)throw new Error(qt(54));return e}let eb=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const nae=O.forwardRef(function(t,n){const{render:r,className:i,orientation:s="vertical",keepMounted:a=!1,...o}=t,{hovering:l,scrollingX:u,scrollingY:h,hiddenState:d,overflowEdges:p,scrollbarYRef:v,scrollbarXRef:x,viewportRef:b,thumbYRef:g,thumbXRef:_,handlePointerDown:y,handlePointerUp:S,rootId:k,thumbSize:E}=K0(),T=O.useMemo(()=>({hovering:l,scrolling:{horizontal:u,vertical:h}[s],orientation:s,hasOverflowX:!d.scrollbarXHidden,hasOverflowY:!d.scrollbarYHidden,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:d.cornerHidden}),[l,u,h,s,d,p]),A=Bl();O.useEffect(()=>{const I=b.current,W=s==="vertical"?v.current:x.current;if(!W)return;function U(H){if(!(!I||!W||H.ctrlKey)){if(H.preventDefault(),s==="vertical"){if(I.scrollTop===0&&H.deltaY<0)return}else if(I.scrollLeft===0&&H.deltaX<0)return;if(s==="vertical"){if(I.scrollTop===I.scrollHeight-I.clientHeight&&H.deltaY>0)return}else if(I.scrollLeft===I.scrollWidth-I.clientWidth&&H.deltaX>0)return;s==="vertical"?I.scrollTop+=H.deltaY:I.scrollLeft+=H.deltaX}}return W.addEventListener("wheel",U,{passive:!1}),()=>{W.removeEventListener("wheel",U)}},[s,x,v,b]);const R={...k&&{"data-id":`${k}-scrollbar`},onPointerDown(I){if(I.button===0&&I.currentTarget===I.target&&b.current){if(g.current&&v.current&&s==="vertical"){const W=Ss(g.current,"margin","y"),U=Ss(v.current,"padding","y"),H=g.current.offsetHeight,V=v.current.getBoundingClientRect(),q=I.clientY-V.top-H/2-U+W/2,N=b.current.scrollHeight,G=b.current.clientHeight,L=v.current.offsetHeight-H-U-W,F=q/L*(N-G);b.current.scrollTop=F}if(_.current&&x.current&&s==="horizontal"){const W=Ss(_.current,"margin","x"),U=Ss(x.current,"padding","x"),H=_.current.offsetWidth,V=x.current.getBoundingClientRect(),q=I.clientX-V.left-H/2-U+W/2,N=b.current.scrollWidth,G=b.current.clientWidth,L=x.current.offsetWidth-H-U-W,$=q/L;let F;A==="rtl"?(F=(1-$)*(N-G),b.current.scrollLeft<=0&&(F=-F)):F=$*(N-G),b.current.scrollLeft=F}y(I)}},onPointerUp:S,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...s==="vertical"&&{top:0,bottom:`var(${Jy.scrollAreaCornerHeight})`,insetInlineEnd:0,[eb.scrollAreaThumbHeight]:`${E.height}px`},...s==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${Jy.scrollAreaCornerWidth})`,bottom:0,[eb.scrollAreaThumbWidth]:`${E.width}px`}}},M=ct("div",t,{ref:[n,s==="vertical"?v:x],state:T,props:[R,o],stateAttributesMapping:kR}),B=O.useMemo(()=>({orientation:s}),[s]),D=s==="vertical"?d.scrollbarYHidden:d.scrollbarXHidden;return a||!D?w.jsx(KH.Provider,{value:B,children:M}):null}),rae=O.forwardRef(function(t,n){const{render:r,className:i,...s}=t,{thumbYRef:a,thumbXRef:o,handlePointerDown:l,handlePointerMove:u,handlePointerUp:h,setScrollingX:d,setScrollingY:p}=K0(),{orientation:v}=tae(),x=O.useMemo(()=>({orientation:v}),[v]);return ct("div",t,{ref:[n,v==="vertical"?a:o],state:x,props:[{onPointerDown:l,onPointerMove:u,onPointerUp(g){v==="vertical"&&p(!1),v==="horizontal"&&d(!1),h(g)},style:{...v==="vertical"&&{height:`var(${eb.scrollAreaThumbHeight})`},...v==="horizontal"&&{width:`var(${eb.scrollAreaThumbWidth})`}}},s]})}),iae=O.forwardRef(function(t,n){const{render:r,className:i,...s}=t,{cornerRef:a,cornerSize:o,hiddenState:l}=K0(),u=ct("div",t,{ref:[n,a],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},s]});return l.cornerHidden?null:u}),YH=O.createContext(void 0);function sae(){const e=O.useContext(YH);if(e===void 0)throw new Error(qt(63));return e}let YD=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const XH={...mu,checked(e){return e?{[YD.checked]:""}:{[YD.unchecked]:""}}},oae=O.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:s,id:a,inputRef:o,name:l,nativeButton:u=!1,onCheckedChange:h,readOnly:d=!1,required:p=!1,disabled:v=!1,render:x,uncheckedValue:b,...g}=t,{clearErrors:_}=Fm(),{state:y,setTouched:S,setDirty:k,validityData:E,setFilled:T,setFocused:A,shouldValidateOnChange:R,validationMode:M,disabled:B,name:D,validation:z}=Ms(),{labelId:I}=Fl(),W=B||v,U=D??l,H=Ie(h),V=O.useRef(null),q=As(V,o,z.inputRef),N=O.useRef(null),G=Fr(),L=W0({id:a,implicit:!1,controlRef:N}),[$,F]=Qi({controlled:r,default:!!s,name:"Switch",state:"checked"});Um({id:G,commit:z.commit,value:$,controlRef:N,name:U,getValue:()=>$}),ze(()=>{V.current&&T(V.current.checked)},[V,T]),Pc($,()=>{_(U),k($!==E.initialValue),T($),R()?z.commit($):z.commit($,!0)});const{getButtonProps:Q,buttonRef:ee}=fi({disabled:W,native:u}),ie={id:G,role:"switch","aria-checked":$,"aria-readonly":d||void 0,"aria-labelledby":I,onFocus(){W||A(!0)},onBlur(){const ne=V.current;!ne||W||(S(!0),A(!1),M==="onBlur"&&z.commit(ne.checked))},onClick(ne){d||W||(ne.preventDefault(),V?.current?.click())}},X=O.useMemo(()=>Ro({checked:$,disabled:W,id:L,name:U,required:p,style:xf,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:q,onChange(ne){if(ne.nativeEvent.defaultPrevented)return;const re=ne.target.checked,Z=Ue(gr,ne.nativeEvent);H?.(re,Z),!Z.isCanceled&&F(re)},onFocus(){N.current?.focus()}},z.getInputValidationProps),[$,W,q,L,U,H,p,F,z]),K=O.useMemo(()=>({...y,checked:$,disabled:W,readOnly:d,required:p}),[y,$,W,d,p]),J=ct("span",t,{state:K,ref:[n,N,ee],props:[ie,z.getValidationProps,g,Q],stateAttributesMapping:XH});return w.jsxs(YH.Provider,{value:K,children:[J,!$&&U&&b!==void 0&&w.jsx("input",{type:"hidden",name:U,value:b}),w.jsx("input",{...X})]})}),aae=O.forwardRef(function(t,n){const{render:r,className:i,...s}=t,{state:a}=Ms(),o=sae(),l={...a,...o};return ct("span",t,{state:l,ref:n,stateAttributesMapping:XH,props:s})}),QH=O.createContext(void 0);function lae(e=!0){const t=O.useContext(QH);if(t===void 0&&!e)throw new Error(qt(7));return t}const cae=O.forwardRef(function(t,n){const{className:r,defaultPressed:i=!1,disabled:s=!1,form:a,onPressedChange:o,pressed:l,render:u,type:h,value:d,nativeButton:p=!0,...v}=t,x=Fr(d||void 0),b=lae(),g=b?.value??[],_=b?void 0:i,y=(s||b?.disabled)??!1,[S,k]=Qi({controlled:b?g?.indexOf(x)>-1:l,default:_,name:"Toggle",state:"pressed"}),E=Ie((z,I)=>{x&&b?.setGroupValue?.(x,z,I),o?.(z,I)}),{getButtonProps:T,buttonRef:A}=fi({disabled:y,native:p}),R=O.useMemo(()=>({disabled:y,pressed:S}),[y,S]),M=[A,n],B=[{"aria-pressed":S,onClick(z){const I=!S,W=Ue(gr,z.nativeEvent);E(I,W),!W.isCanceled&&k(I)}},v,T],D=ct("button",t,{enabled:!b,state:R,ref:M,props:B});return b?w.jsx(I0,{tag:"button",render:u,className:r,state:R,refs:M,props:B}):D});let uae=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const XD={multiple(e){return e?{[uae.multiple]:""}:null}},dae=O.forwardRef(function(t,n){const{defaultValue:r,disabled:i=!1,loopFocus:s=!0,onValueChange:a,orientation:o="horizontal",multiple:l=!1,value:u,className:h,render:d,...p}=t,v=yR(),x=O.useMemo(()=>{if(u===void 0)return r??[]},[u,r]),b=(v?.disabled??!1)||i,[g,_]=Qi({controlled:u,default:x,name:"ToggleGroup",state:"value"}),y=Ie((A,R,M)=>{let B;if(l?(B=g.slice(),R?B.push(A):B.splice(g.indexOf(A),1)):B=R?[A]:[],Array.isArray(B)){if(a?.(B,M),M.isCanceled)return;_(B)}}),S=O.useMemo(()=>({disabled:b,multiple:l,orientation:o}),[b,o,l]),k=O.useMemo(()=>({disabled:b,orientation:o,setGroupValue:y,value:g}),[b,o,y,g]),E={role:"group"},T=ct("div",t,{enabled:!!v,state:S,ref:n,props:[E,p],stateAttributesMapping:XD});return w.jsx(QH.Provider,{value:k,children:v?T:w.jsx(D0,{render:d,className:h,state:S,refs:[n],props:[E,p],stateAttributesMapping:XD,loopFocus:s})})});function fae(e){return ct(e.defaultTagName??"div",e,e)}function hae({className:e,...t}){return w.jsx("div",{"data-slot":"input-group",role:"group",className:Ne("border-input bg-input/20 dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 h-7 rounded-md border transition-colors has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:ring-[2px] has-[[data-slot][aria-invalid=true]]:ring-[2px] has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0 group/input-group relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto",e),...t})}const pae=Dl("text-muted-foreground **:data-[slot=kbd]:bg-muted-foreground/10 h-auto gap-1 py-2 text-xs/relaxed font-medium group-data-[disabled=true]/input-group:opacity-50 **:data-[slot=kbd]:rounded-[calc(var(--radius-sm)-2px)] **:data-[slot=kbd]:px-1 **:data-[slot=kbd]:text-[0.625rem] [&>svg:not([class*='size-'])]:size-3.5 flex cursor-text items-center justify-center select-none",{variants:{align:{"inline-start":"pl-2 has-[>button]:ml-[-0.275rem] has-[>kbd]:ml-[-0.275rem] order-first","inline-end":"pr-2 has-[>button]:mr-[-0.275rem] has-[>kbd]:mr-[-0.275rem] order-last","block-start":"px-2 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2 order-first w-full justify-start","block-end":"px-2 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2 order-last w-full justify-start"}},defaultVariants:{align:"inline-start"}});function mae({className:e,align:t="inline-start",...n}){return w.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Ne(pae({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const gae=Dl("gap-2 rounded-md text-xs/relaxed shadow-none flex items-center",{variants:{size:{xs:"h-5 gap-1 rounded-[calc(var(--radius-sm)-2px)] px-1 [&>svg:not([class*='size-'])]:size-3",sm:"","icon-xs":"size-6 p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function ZH({className:e,type:t="button",variant:n="ghost",size:r="xs",...i}){return w.jsx(He,{type:t,"data-size":r,variant:n,className:Ne(gae({size:r}),e),...i})}function vae({className:e,...t}){return w.jsx(Xt,{"data-slot":"input-group-control",className:Ne("rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent flex-1",e),...t})}const yae=Soe;function bae({className:e,children:t,...n}){return w.jsxs(Zse,{"data-slot":"combobox-trigger",className:Ne("[&_svg:not([class*='size-'])]:size-3.5",e),...n,children:[t,w.jsx(me,{icon:$m,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})]})}function _ae({className:e,...t}){return w.jsx(ioe,{"data-slot":"combobox-clear",render:w.jsx(ZH,{variant:"ghost",size:"icon-xs"}),className:Ne(e),...t,children:w.jsx(me,{icon:Ps,strokeWidth:2,className:"pointer-events-none"})})}function xae({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...s}){return w.jsxs(hae,{className:Ne("w-auto",e),children:[w.jsx(noe,{render:w.jsx(vae,{disabled:n}),...s}),w.jsxs(mae,{align:"inline-end",children:[r&&w.jsx(ZH,{size:"icon-xs",variant:"ghost",render:w.jsx(bae,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:n}),i&&w.jsx(_ae,{disabled:n})]}),t]})}function Sae({className:e,side:t="bottom",sideOffset:n=6,align:r="start",alignOffset:i=0,anchor:s,...a}){return w.jsx(uoe,{children:w.jsx(doe,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:s,className:"isolate z-50",children:w.jsx(hoe,{"data-slot":"combobox-content","data-chips":!!s,className:Ne("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 *:data-[slot=input-group]:bg-input/20 dark:bg-popover max-h-72 min-w-32 overflow-hidden rounded-lg shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:shadow-none group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)",e),...a})})})}function wae({className:e,...t}){return w.jsx(loe,{"data-slot":"combobox-list",className:Ne("no-scrollbar max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] scroll-py-1 overflow-y-auto p-1 data-empty:p-0 overflow-y-auto overscroll-contain",e),...t})}function Cae({className:e,children:t,...n}){return w.jsxs(goe,{"data-slot":"combobox-item",className:Ne("data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[t,w.jsx(woe,{render:w.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:w.jsx(me,{icon:fu,strokeWidth:2,className:"pointer-events-none"})})]})}function Eae({className:e,...t}){return w.jsx(voe,{"data-slot":"combobox-empty",className:Ne("text-muted-foreground hidden w-full justify-center py-2 text-center text-xs/relaxed group-data-empty/combobox-content:flex",e),...t})}const kae=Dl("hover:text-foreground hover:bg-accent/20 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive aria-pressed:bg-accent aria-pressed:text-accent-foreground aria-pressed:hover:bg-accent data-[state=on]:bg-accent data-[state=on]:text-accent-foreground data-[state=on]:hover:bg-accent gap-1 rounded-md text-xs font-medium transition-all [&_svg:not([class*='size-'])]:size-3.5 group/toggle inline-flex items-center justify-center whitespace-nowrap outline-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{variant:{default:"bg-transparent",outline:"border-input hover:bg-accent/20 border bg-transparent"},size:{default:"h-7 min-w-7 px-2",sm:"h-6 min-w-6 rounded-[min(var(--radius-md),8px)] px-1.5 text-[0.625rem] [&_svg:not([class*='size-'])]:size-3",lg:"h-8 min-w-8 px-2"}},defaultVariants:{variant:"default",size:"default"}}),JH=O.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function Tae({className:e,variant:t,size:n,spacing:r=0,orientation:i="horizontal",children:s,...a}){return w.jsx(dae,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:Ne("rounded-md data-[size=sm]:rounded-[min(var(--radius-md),8px)] group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",e),...a,children:w.jsx(JH.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:s})})}function QD({className:e,children:t,variant:n="default",size:r="default",...i}){const s=O.useContext(JH);return w.jsx(cae,{"data-slot":"toggle-group-item","data-variant":s.variant||n,"data-size":s.size||r,"data-spacing":s.spacing,className:Ne("group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-md group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-md group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-md group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-md shrink-0 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",kae({variant:s.variant||n,size:s.size||r}),e),...i,children:t})}async function $t(e,t){const n=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t?.headers}});if(n.status===401)throw window.dispatchEvent(new CustomEvent("vibora:auth-required")),new Error("Authentication required");if(!n.ok){const r=await n.json().catch(()=>({error:"Request failed"}));throw new Error(r.error||"Request failed")}return n.json()}const iu="";function TR(){return Mn({queryKey:["tasks"],queryFn:()=>$t(`${iu}/api/tasks`)})}function eF(e){return Mn({queryKey:["tasks",e],queryFn:()=>$t(`${iu}/api/tasks/${e}`),enabled:!!e})}function Oae(){const e=Sr();return zn({mutationFn:t=>$t(`${iu}/api/tasks`,{method:"POST",body:JSON.stringify({...t,status:"IN_PROGRESS"})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function Rae(){const e=Sr();return zn({mutationFn:({taskId:t,status:n,position:r})=>$t(`${iu}/api/tasks/${t}/status`,{method:"PATCH",body:JSON.stringify({status:n,position:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function OR(){const e=Sr();return zn({mutationFn:({taskId:t,updates:n})=>$t(`${iu}/api/tasks/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{taskId:n})=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["tasks",n]})}})}function tF(){const e=Sr();return zn({mutationFn:({taskId:t,deleteLinkedWorktree:n})=>{const r=n?`${iu}/api/tasks/${t}?deleteLinkedWorktree=true`:`${iu}/api/tasks/${t}`;return $t(r,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}const kf="";function Aae(e){return Mn({queryKey:["fs","list",e],queryFn:()=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return $t(`${kf}/api/fs/list${t}`)},enabled:e!==null})}function Pae(e){return Mn({queryKey:["git","branches",e],queryFn:()=>$t(`${kf}/api/git/branches?repo=${encodeURIComponent(e)}`),enabled:!!e})}function Mae(e,t={}){const{staged:n=!1,ignoreWhitespace:r=!1,includeUntracked:i=!1}=t;return Mn({queryKey:["git","diff",e,n,r,i],queryFn:()=>{const s=new URLSearchParams({path:e,...n&&{staged:"true"},...r&&{ignoreWhitespace:"true"},...i&&{includeUntracked:"true"}});return $t(`${kf}/api/git/diff?${s}`)},enabled:!!e,refetchInterval:5e3})}function jae(e){return Mn({queryKey:["fs","tree",e],queryFn:()=>$t(`${kf}/api/fs/tree?root=${encodeURIComponent(e)}`),enabled:!!e,staleTime:1e4})}function Lae(e,t,n){return Mn({queryKey:["fs","read",e,t,n?.maxLines],queryFn:()=>{const r=new URLSearchParams({path:t,root:e,...n?.maxLines});return $t(`${kf}/api/fs/read?${r}`)},enabled:!!e&&!!t})}async function Dae(e){return $t(`${kf}/api/fs/is-git-repo?path=${encodeURIComponent(e)}`)}const Do="",Bt={PORT:"server.port",WORKTREE_BASE_PATH:"worktree_base_path",DEFAULT_GIT_REPOS_DIR:"paths.defaultGitReposDir",BASIC_AUTH_USERNAME:"authentication.username",BASIC_AUTH_PASSWORD:"authentication.password",EDITOR_APP:"editor.app",EDITOR_HOST:"editor.host",EDITOR_SSH_PORT:"editor.sshPort",LINEAR_API_KEY:"integrations.linearApiKey",GITHUB_PAT:"integrations.githubPat",LANGUAGE:"appearance.language",THEME:"appearance.theme",SYNC_CLAUDE_CODE_THEME:"appearance.syncClaudeCodeTheme",CLAUDE_CODE_LIGHT_THEME:"appearance.claudeCodeLightTheme",CLAUDE_CODE_DARK_THEME:"appearance.claudeCodeDarkTheme"},Iae=7777;function hi(e){return Mn({queryKey:["config",e],queryFn:()=>$t(`${Do}/api/config/${e}`)})}function nF(){const e=hi(Bt.PORT);return{...e,data:e.data?.value??Iae,isDefault:e.data?.isDefault??!0}}function rF(){const e=hi(Bt.WORKTREE_BASE_PATH);return{...e,data:e.data?.value??""}}function RR(){const e=hi(Bt.DEFAULT_GIT_REPOS_DIR);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Y0(){const e=hi(Bt.EDITOR_APP);return{...e,data:e.data?.value??"vscode",isDefault:e.data?.isDefault??!0}}function X0(){const e=hi(Bt.EDITOR_HOST);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Q0(){const e=hi(Bt.EDITOR_SSH_PORT);return{...e,data:e.data?.value??22,isDefault:e.data?.isDefault??!0}}function Nae(){const e=hi(Bt.LINEAR_API_KEY);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Bae(){const e=hi(Bt.GITHUB_PAT);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function $ae(){const e=hi(Bt.LANGUAGE);return{...e,data:e.data?.value??null,isDefault:e.data?.isDefault??!0}}function zae(){const e=hi(Bt.THEME);return{...e,data:e.data?.value??"system",isDefault:e.data?.isDefault??!0}}function Hae(){const e=hi(Bt.SYNC_CLAUDE_CODE_THEME);return{...e,data:!!e.data?.value,isDefault:e.data?.isDefault??!0}}const ZD=["light","light-ansi","light-daltonized","dark","dark-ansi","dark-daltonized"];function Fae(){const e=hi(Bt.CLAUDE_CODE_LIGHT_THEME);return{...e,data:e.data?.value??"light-ansi",isDefault:e.data?.isDefault??!0}}function Uae(){const e=hi(Bt.CLAUDE_CODE_DARK_THEME);return{...e,data:e.data?.value??"dark-ansi",isDefault:e.data?.isDefault??!0}}function Vae(){const e=hi(Bt.BASIC_AUTH_USERNAME);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Wae(){const e=hi(Bt.BASIC_AUTH_PASSWORD);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function AR(){const e=Sr();return zn({mutationFn:({key:t,value:n})=>$t(`${Do}/api/config/${t}`,{method:"PUT",body:JSON.stringify({value:n})}),onSuccess:(t,{key:n})=>{e.invalidateQueries({queryKey:["config",n]}),n===Bt.GITHUB_PAT&&(e.invalidateQueries({queryKey:["github-user"]}),e.invalidateQueries({queryKey:["github-prs"]}),e.invalidateQueries({queryKey:["github-issues"]}),e.invalidateQueries({queryKey:["github-orgs"]}))}})}function qae(){const e=Sr();return zn({mutationFn:t=>$t(`${Do}/api/config/${t}`,{method:"DELETE"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["config",n]})}})}function Gae(){return Mn({queryKey:["config","notifications"],queryFn:()=>$t(`${Do}/api/config/notifications`)})}function Kae(){const e=Sr();return zn({mutationFn:t=>$t(`${Do}/api/config/notifications`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","notifications"]})}})}function Yae(){return zn({mutationFn:e=>$t(`${Do}/api/config/notifications/test/${e}`,{method:"POST"})})}function Xae(){return Mn({queryKey:["config","z-ai"],queryFn:()=>$t(`${Do}/api/config/z-ai`)})}function Qae(){const e=Sr();return zn({mutationFn:t=>$t(`${Do}/api/config/z-ai`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","z-ai"]}),e.invalidateQueries({queryKey:["monitoring","claude-usage"]})}})}function iF(){return Mn({queryKey:["config","developer-mode"],queryFn:()=>$t(`${Do}/api/config/developer-mode`),staleTime:1/0})}function Zae(){return zn({mutationFn:()=>$t(`${Do}/api/config/restart`,{method:"POST"})})}const Wm="";function PR(){return Mn({queryKey:["repositories"],queryFn:()=>$t(`${Wm}/api/repositories`)})}function Jae(e){return Mn({queryKey:["repositories",e],queryFn:()=>$t(`${Wm}/api/repositories/${e}`),enabled:!!e})}function sF(){const e=Sr();return zn({mutationFn:t=>$t(`${Wm}/api/repositories`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function ele(){const e=Sr();return zn({mutationFn:({id:t,updates:n})=>$t(`${Wm}/api/repositories/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{id:n})=>{e.invalidateQueries({queryKey:["repositories"]}),e.invalidateQueries({queryKey:["repositories",n]})}})}function oF(){const e=Sr();return zn({mutationFn:t=>$t(`${Wm}/api/repositories/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function $d({className:e,children:t,...n}){return w.jsxs(Yoe,{"data-slot":"scroll-area",className:Ne("relative",e),...n,children:[w.jsx(eae,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),w.jsx(tle,{}),w.jsx(iae,{})]})}function tle({className:e,orientation:t="vertical",...n}){return w.jsx(nae,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Ne("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none",e),...n,children:w.jsx(rae,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function MR({open:e,onOpenChange:t,onSelect:n,initialPath:r}){const[i,s]=O.useState(r||null),[a,o]=O.useState(""),[l,u]=O.useState("");O.useEffect(()=>{e&&(s(r||null),o(""),u(""))},[e,r]);const{data:h,isLoading:d,error:p}=Aae(e?i??"":null),v=S=>{h&&(s(h.path+"/"+S),u(""))},x=()=>{h?.parent&&h.parent!==h.path&&(s(h.parent),u(""))},b=()=>{s(null),u("")},g=()=>{a.trim()&&(s(a.trim()),u(""))},_=S=>{n(S),t(!1)},y=h?.entries.filter(S=>S.name.toLowerCase().includes(l.toLowerCase()));return w.jsx(zl,{open:e,onOpenChange:t,children:w.jsxs(Hl,{className:"sm:max-w-lg overflow-hidden",children:[w.jsxs(hu,{children:[w.jsx(pu,{children:"Select Git Repository"}),w.jsx(V0,{children:"Choose an existing git repository"})]}),w.jsx("p",{className:"text-xs text-muted-foreground",children:"Click folder names to navigate • Use action buttons to select"}),w.jsx(use,{}),w.jsxs("div",{className:"space-y-1",children:[w.jsx("label",{className:"text-xs font-medium",children:"Enter path manually:"}),w.jsxs("div",{className:"flex gap-2",children:[w.jsx(Xt,{value:a,onChange:S=>o(S.target.value),placeholder:"/path/to/your/project",onKeyDown:S=>S.key==="Enter"&&g(),className:"flex-1"}),w.jsx(He,{variant:"outline",size:"sm",onClick:g,children:"Go"})]})]}),w.jsxs("div",{className:"space-y-1",children:[w.jsx("label",{className:"text-xs font-medium",children:"Search current directory:"}),w.jsxs("div",{className:"relative",children:[w.jsx(me,{icon:Gz,size:14,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),w.jsx(Xt,{value:l,onChange:S=>u(S.target.value),placeholder:"Filter folders and files...",className:"pl-8"})]})]}),w.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[w.jsx(He,{variant:"outline",size:"icon-sm",onClick:b,title:"Home",className:"shrink-0",children:w.jsx(me,{icon:Ure,size:14,strokeWidth:2})}),w.jsx(He,{variant:"outline",size:"icon-sm",onClick:x,disabled:!h||h.parent===h.path,title:"Parent directory",className:"shrink-0",children:w.jsx(me,{icon:cR,size:14,strokeWidth:2})}),w.jsx("code",{className:"min-w-0 flex-1 text-xs bg-muted/50 px-2 py-1 rounded truncate overflow-hidden",children:h?.path||"~"}),w.jsxs(He,{variant:"outline",size:"sm",onClick:()=>h&&_(h.path),disabled:!h,className:"shrink-0 max-sm:px-2",title:"Select current directory",children:[w.jsx(me,{icon:Rk,size:14,strokeWidth:2,className:"sm:hidden"}),w.jsx("span",{className:"max-sm:hidden",children:"Select Current"})]})]}),w.jsx($d,{className:"h-64 border rounded-md",children:w.jsxs("div",{className:"p-1",children:[d&&w.jsx("div",{className:"text-muted-foreground text-xs p-3",children:"Loading..."}),p&&w.jsx("div",{className:"text-destructive text-xs p-3",children:p.message}),h&&y&&w.jsxs(w.Fragment,{children:[y.length===0&&w.jsx("div",{className:"text-muted-foreground text-xs p-3",children:l?"No matches found":"Empty directory"}),y.map(S=>w.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted group",children:S.type==="directory"?w.jsxs(w.Fragment,{children:[w.jsx(me,{icon:S.isGitRepo?Rk:Es,size:16,strokeWidth:2,className:(S.isGitRepo,"text-accent")}),w.jsx("button",{onClick:()=>v(S.name),className:"flex-1 text-left text-xs truncate hover:underline",children:S.name}),S.isGitRepo&&w.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-accent/50 text-accent font-medium shrink-0",children:[w.jsx("span",{className:"max-sm:hidden",children:"git repo"}),w.jsx("span",{className:"sm:hidden",children:"git"})]})]}):w.jsxs(w.Fragment,{children:[w.jsx("span",{className:"w-4"}),w.jsx("span",{className:"flex-1 text-xs text-muted-foreground truncate",children:S.name})]})},S.name))]})]})}),w.jsxs(Hm,{children:[w.jsx(pR,{render:w.jsx(He,{variant:"outline"}),children:"Cancel"}),w.jsx(He,{onClick:()=>h&&_(h.path),disabled:!h,children:"Select Path"})]})]})})}function nle(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function rle(e){const t=nle(e);if(!t)return"";const n=Math.random().toString(36).substring(2,6);return`${t}-${n}`}function jR({open:e,onOpenChange:t,defaultRepository:n,showTrigger:r=!0}={}){const{t:i}=Zt("tasks"),{t:s}=Zt("common"),[a,o]=O.useState(!1),l=e??a,u=t??o,[h,d]=O.useState(!1),[p,v]=O.useState(""),[x,b]=O.useState(""),[g,_]=O.useState(""),[y,S]=O.useState(""),[k,E]=O.useState(""),[T,A]=O.useState(""),[R,M]=O.useState("default"),[B,D]=O.useState(!1),[z,I]=O.useState(null),[W,U]=O.useState("browse"),[H,V]=O.useState(""),[q,N]=O.useState(null),[G,L]=O.useState(!1),$=Ta(),F=Oae(),Q=sF(),{data:ee}=rF(),{data:ie}=RR(),{data:X}=PR(),{data:K,isLoading:J}=Pae(g||null),ne=z?X?.find(le=>le.id===z):null,re=O.useMemo(()=>{if(!X)return[];if(ne&&H===ne.displayName||!H.trim())return X;const le=H.toLowerCase();return X.filter(Le=>Le.displayName.toLowerCase().includes(le)||Le.path.toLowerCase().includes(le))},[X,H,ne]);O.useEffect(()=>{X&&X.length>0?U("saved"):U("browse")},[X]),O.useEffect(()=>{if(l){if(n)I(n.id),_(n.path),V(n.displayName),U("saved");else if(X&&X.length>0){const le=X[0];I(le.id),_(le.path),V(le.displayName),U("saved")}}},[l,n,X]),O.useEffect(()=>{S(K?K.current||K.branches[0]||"main":"")},[K,g]);const Z=le=>{v(le),A(rle(le))},ae=async le=>{N(null),L(!0);try{if(!(await Dae(le)).isGitRepo){N(i("createModal.errors.notGitRepo")),L(!1);return}if(_(le),I(null),!X?.find(Be=>Be.path===le)){const Be=le.split("/").pop()||"Unknown";Q.mutate({path:le,displayName:Be})}}catch(Le){N(Le instanceof Error?Le.message:i("createModal.errors.validationFailed"))}finally{L(!1)}},ue=le=>{if(le.preventDefault(),!p.trim()||!g)return;const Le=g.split("/").pop()||"repo",ke=k.trim()||T,Be=`${ee}/${ke}`;F.mutate({title:p.trim(),description:x.trim(),repoPath:g,repoName:Le,baseBranch:y||"main",branch:ke,worktreePath:Be,copyFiles:ne?.copyFiles||void 0,startupScript:ne?.startupScript||void 0},{onSuccess:_e=>{const Re=x.trim()?{aiMode:R,description:x.trim()}:{aiMode:R};u(!1),v(""),b(""),_(""),S(""),E(""),A(""),M("default"),D(!1),I(null),V(""),N(null),U(X&&X.length>0?"saved":"browse"),$({to:"/tasks/$taskId",params:{taskId:_e.id},state:Re})}})},fe=k.trim()||T,he=fe?`${ee}/${fe}`:"";return w.jsxs(w.Fragment,{children:[w.jsxs(zl,{open:l,onOpenChange:u,children:[r&&w.jsxs(oH,{render:w.jsx(He,{size:"sm"}),children:[w.jsx(me,{icon:$l,size:16,strokeWidth:2,"data-slot":"icon"}),i("newTask")]}),w.jsx(Hl,{className:"sm:max-w-md max-h-[80dvh] flex flex-col overflow-hidden",children:w.jsxs("form",{onSubmit:ue,className:"flex flex-col min-h-0 flex-1",children:[w.jsxs(hu,{className:"shrink-0",children:[w.jsx(pu,{children:i("createModal.title")}),w.jsx(V0,{children:i("createModal.description")})]}),w.jsxs(Vm,{className:"mt-4 pb-4 overflow-y-auto min-h-0 flex-1",children:[w.jsxs(yr,{children:[w.jsx(br,{htmlFor:"title",children:i("createModal.fields.title")}),w.jsx(Xt,{id:"title",value:p,onChange:le=>Z(le.target.value),placeholder:i("createModal.fields.titlePlaceholder"),required:!0})]}),w.jsxs(yr,{children:[w.jsx(br,{htmlFor:"description",children:i("createModal.fields.description")}),w.jsx(cH,{id:"description",value:x,onValueChange:le=>{b(le),B||M(le.trim()?"plan":"default")},placeholder:i("createModal.fields.descriptionPlaceholder"),rows:2})]}),w.jsxs(yr,{children:[w.jsx(br,{children:i("createModal.fields.aiMode")}),w.jsxs(Tae,{value:[R],onValueChange:le=>{const Le=Array.isArray(le)?le[0]:le;Le&&(M(Le),D(!0))},className:"w-full",variant:"outline",children:[w.jsx(QD,{value:"plan",className:"flex-1",children:i("createModal.aiModes.plan")}),w.jsx(QD,{value:"default",className:"flex-1",children:i("createModal.aiModes.default")})]})]}),w.jsxs(yr,{children:[w.jsx(br,{children:i("createModal.fields.repository")}),w.jsxs(Ol,{value:W,onValueChange:le=>{U(le),N(null)},children:[w.jsxs(Rl,{children:[w.jsx(Yr,{value:"saved",disabled:!X?.length,children:i("createModal.tabs.saved")}),w.jsx(Yr,{value:"browse",children:i("createModal.tabs.browse")})]}),w.jsx(wi,{value:"saved",className:"mt-2",children:w.jsxs(yae,{value:z||"",onValueChange:le=>{const Le=X?.find(ke=>ke.id===le);Le&&(I(le),_(Le.path),V(Le.displayName),N(null))},inputValue:H,onInputValueChange:le=>{V(le),ne&&le!==ne.displayName&&I(null)},itemToStringLabel:le=>X?.find(Le=>Le.id===le)?.displayName||"",children:[w.jsx(xae,{placeholder:i("createModal.searchRepositories"),className:"w-full"}),w.jsx(Sae,{children:w.jsxs(wae,{children:[w.jsx(Eae,{children:i("createModal.noRepositoriesFound")}),re.map(le=>w.jsx(Cae,{value:le.id,children:le.displayName},le.id))]})})]})}),w.jsx(wi,{value:"browse",className:"mt-2",children:w.jsxs(He,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>d(!0),disabled:G,children:[w.jsx(me,{icon:Es,size:14,strokeWidth:2,className:"mr-2"}),G?w.jsx("span",{className:"text-muted-foreground",children:s("status.validating")}):g&&!z?w.jsx("span",{className:"truncate",children:g}):w.jsx("span",{className:"text-muted-foreground group-hover/button:text-accent-foreground",children:i("createModal.selectFolder")})]})})]}),q&&w.jsx("p",{className:"text-sm text-destructive",children:q}),g&&!q&&w.jsx(Vc,{className:"font-mono text-xs truncate",children:g})]}),w.jsxs(yr,{children:[w.jsx(br,{htmlFor:"baseBranch",children:i("createModal.fields.baseBranch")}),w.jsxs(qi,{value:y,onValueChange:le=>S(le??""),disabled:!g||J,children:[w.jsx(Ki,{className:"w-full",children:w.jsx(Gi,{children:y||w.jsx("span",{className:"text-muted-foreground",children:i(g?J?"createModal.loadingBranches":"createModal.selectBranch":"createModal.selectRepositoryFirst")})})}),w.jsx(Yi,{children:K?.branches.map(le=>w.jsxs(dn,{value:le,children:[le,le===K.current&&w.jsx("span",{className:"text-muted-foreground ml-2",children:i("createModal.current")})]},le))})]})]}),w.jsxs(yr,{children:[w.jsx(br,{htmlFor:"branch",children:i("createModal.fields.branchName")}),w.jsx(Xt,{id:"branch",value:k,onChange:le=>E(le.target.value),placeholder:T||i("createModal.fields.branchPlaceholder")}),he&&w.jsxs(Vc,{children:[i("createModal.worktreePrefix")," ",he]}),!k.trim()&&T&&w.jsx(Vc,{children:i("createModal.branchAutoGenerated",{branch:T})})]})]}),w.jsxs(Hm,{className:"mt-4 shrink-0",children:[w.jsx(pR,{render:w.jsx(He,{variant:"outline",type:"button",className:"border-destructive text-destructive hover:bg-destructive hover:text-white"}),children:s("buttons.cancel")}),w.jsx(He,{type:"submit",disabled:F.isPending||!p.trim()||!g,children:F.isPending?s("status.creating"):i("createModal.createTask")})]})]})})]}),w.jsx(MR,{open:h,onOpenChange:d,onSelect:ae,initialPath:ie||void 0})]})}const JD=[{to:"/tasks",icon:Qy,labelKey:"header.tasks",matchPrefix:!0},{to:"/terminals",icon:uR,labelKey:"header.terminals",matchPrefix:!1},{to:"/worktrees",icon:Wz,labelKey:"header.worktrees",matchPrefix:!0},{to:"/repositories",icon:Uz,labelKey:"header.repositories",matchPrefix:!0},{to:"/review",icon:Xy,labelKey:"header.review",matchPrefix:!0},{to:"/monitoring",icon:Dre,labelKey:"header.monitoring",matchPrefix:!0}];function ile({onNewTaskRef:e,onOpenCommandPalette:t}){const{t:n}=Zt("navigation"),{location:r}=xr(),i=r.pathname,[s,a]=O.useState(!1),o=(l,u)=>u?i.startsWith(l):i===l;return O.useEffect(()=>{e?.(()=>a(!0))},[e]),w.jsxs("header",{className:"sticky top-0 z-10 flex h-12 shrink-0 items-center justify-between border-b border-border bg-card px-4 max-sm:px-2",children:[w.jsxs("div",{className:"flex min-w-0 items-center gap-4 max-sm:gap-2",children:[w.jsx(eie,{className:"lg:hidden",children:w.jsx(tie,{children:w.jsxs(nie,{children:[w.jsxs(iie,{className:"bg-transparent hover:bg-muted/50 data-open:bg-muted/50 gap-1 px-2",children:[w.jsx(me,{icon:Yre,size:16,strokeWidth:2}),w.jsx("span",{className:"sr-only",children:"Menu"})]}),w.jsx(sie,{className:"min-w-48",children:JD.map(l=>w.jsxs(aie,{href:l.to,active:o(l.to,l.matchPrefix),render:w.jsx(di,{to:l.to}),children:[w.jsx(me,{icon:l.icon,size:16,strokeWidth:2}),n(l.labelKey)]},l.to))})]})})}),w.jsx("nav",{className:"hidden items-center gap-1 lg:flex",children:JD.map(l=>{const u=o(l.to,l.matchPrefix);return w.jsx(di,{to:l.to,children:w.jsxs(He,{variant:u?"secondary":"ghost",size:"sm",className:u?"dark:bg-transparent text-destructive":void 0,children:[w.jsx(me,{icon:l.icon,size:16,strokeWidth:2,"data-slot":"icon"}),n(l.labelKey)]})},l.to)})})]}),w.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[w.jsx(jR,{open:s,onOpenChange:a}),w.jsx(He,{variant:"ghost",size:"icon-sm",onClick:t,title:n("header.commandPalette",{shortcut:"⌘K"}),children:w.jsx(me,{icon:Ok,size:16,strokeWidth:2})}),w.jsx(di,{to:"/settings",children:w.jsx(He,{variant:i==="/settings"?"secondary":"ghost",size:"icon-sm",className:i==="/settings"?"dark:bg-transparent text-destructive":void 0,children:w.jsx(me,{icon:Kz,size:16,strokeWidth:2})})})]})]})}function sle(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}const ole=10,ale=2e3;function lle(){const e=Sr(),t=O.useRef(null),n=O.useRef(void 0),r=O.useRef(0),i=O.useRef(void 0),s=O.useCallback(o=>{try{const l=JSON.parse(o.data);if(l.type==="task:updated")e.invalidateQueries({queryKey:["tasks"]});else if(l.type==="notification"&&"payload"in l){const{title:u,message:h,notificationType:d,playSound:p}=l.payload;switch(d){case"success":Qt.success(u,{description:h});break;case"error":Qt.error(u,{description:h});break;case"warning":Qt.warning(u,{description:h});break;default:Qt.info(u,{description:h});break}if(p){const x=localStorage.getItem("vibora:lastSoundPlayed"),b=Date.now();if(x&&b-parseInt(x)<1e3)return;localStorage.setItem("vibora:lastSoundPlayed",String(b));let g=!1;const _=()=>{if(g)return;g=!0,new Audio("/sounds/goat-bleat.mp3").play().catch(()=>{})},y=new Audio("/api/uploads/sound");y.onerror=_,y.play().catch(_)}window.parent!==window&&window.parent.postMessage({type:"vibora:notification",title:u,message:h,notificationType:d},"*")}}catch{}},[e]),a=O.useCallback(()=>{const o=t.current;if(o&&(o.readyState===WebSocket.CONNECTING||o.readyState===WebSocket.OPEN))return;const l=sle(),u=new WebSocket(l);t.current=u,u.onopen=()=>{r.current=0},u.onmessage=s,u.onclose=()=>{t.current===u&&(t.current=null),r.current<ole&&(r.current++,n.current=setTimeout(()=>{i.current?.()},ale))},u.onerror=()=>{}},[s]);i.current=a,O.useEffect(()=>(a(),()=>{n.current&&clearTimeout(n.current);const o=t.current;o&&(o.readyState===WebSocket.OPEN&&o.close(),t.current=null)}),[a])}const cle={save:"Save Changes",cancel:"Cancel",delete:"Delete",create:"Create",reset:"Reset to default",browse:"Browse",clearFilters:"Clear filters"},ule={loading:"Loading...",saving:"Saving...",saved:"Saved",error:"Error",calculating:"calculating...",validating:"Validating...",creating:"Creating...",deleting:"Deleting...",loggingIn:"Logging in..."},dle={justNow:"just now",minuteAgo:"1 minute ago",minutesAgo:"{{count}} minutes ago",hourAgo:"1 hour ago",hoursAgo:"{{count}} hours ago",dayAgo:"1 day ago",daysAgo:"{{count}} days ago"},fle={one:"{{count}} result",other:"{{count}} results"},hle={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled",ORPHANED:"Orphaned"},ple={loginTitle:"Login to Vibora",username:"Username",password:"Password",login:"Login",loginFailed:"Login failed"},mle={buttons:cle,status:ule,time:dle,results:fle,statuses:hle,auth:ple},gle={tasks:"Tasks",terminals:"Terminals",worktrees:"Worktrees",repositories:"Repositories",review:"Review",monitoring:"Monitoring",settings:"Settings",commandPalette:"Command Palette ({{shortcut}})"},vle={placeholder:"Type a command or search...",noResults:"No commands found.",categories:{navigation:"Navigation",actions:"Actions"},commands:{goToTasks:"Go to Tasks",goToTerminals:"Go to Terminals",goToTaskTerminals:"Go to Task Terminals",goToWorktrees:"Go to Worktrees",goToRepositories:"Go to Repositories",goToSettings:"Go to Settings",newTask:"New Task",keyboardShortcuts:"Keyboard Shortcuts"}},yle={title:"Keyboard Shortcuts",groups:{navigation:"Navigation",actions:"Actions",general:"General"},labels:{goToTasks:"Go to Tasks",goToTerminals:"Go to Terminals",goToTaskTerminals:"Go to Task Terminals",goToWorktrees:"Go to Worktrees",goToRepositories:"Go to Repositories",goToSettings:"Go to Settings",commandPalette:"Command Palette",newTask:"New Task",keyboardShortcuts:"Keyboard Shortcuts",closeModal:"Close Modal"}},ble={header:gle,commandPalette:vle,shortcuts:yle},_le="Tasks",xle="Search",Sle="All Repos",wle="New Task",Cle={title:"Create New Task",description:"Create a new task with a git worktree for isolated development.",fields:{title:"Title",titlePlaceholder:"Add user authentication",description:"Description",descriptionPlaceholder:"Implement OAuth2 login flow...",aiMode:"AI Mode",repository:"Repository",baseBranch:"Base Branch",branchName:"Branch Name",branchPlaceholder:"auto-generated-from-title"},aiModes:{plan:"Plan",default:"Default"},tabs:{saved:"Repos",browse:"Browse"},worktreePrefix:"Worktree:",branchAutoGenerated:'Will use "{{branch}}" if left empty.',selectFolder:"Select folder...",searchRepositories:"Search repositories...",noRepositoriesFound:"No repositories found",selectRepositoryFirst:"Select repository first",loadingBranches:"Loading branches...",selectBranch:"Select branch",current:"(current)",createTask:"Create Task",errors:{notGitRepo:"Selected folder is not a git repository",validationFailed:"Failed to validate repository"}},Ele={title:_le,searchPlaceholder:xle,allRepos:Sle,newTask:wle,createModal:Cle},kle="Settings",Tle={server:"Server",serverDefaults:"Server & Defaults",paths:"Paths",authentication:"Authentication",editor:"Editor",integrations:"Integrations",zai:"z.ai",notifications:"Notifications",appearance:"Appearance",developer:"Developer"},Ole={port:{label:"Port",description:"Requires restart"},startupCommand:{label:"Startup Command",description:"Command for new task terminals"},gitReposDir:{label:"Git Repos Directory",description:"Starting directory for repo picker"},editor:{app:{label:"Editor",description:"Code editor for opening worktrees",options:{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}},host:{label:"Remote Host",description:"For SSH URLs when code is on a remote machine",placeholder:"e.g., my-server.tailnet.ts.net"},sshPort:{label:"SSH Port",description:"Remote SSH port (default 22)"}},linear:{label:"Linear",description:"API key for ticket sync"},github:{label:"GitHub",description:"PAT for Issues & PRs"},auth:{username:"Username",password:"Password",usernamePlaceholder:"Leave empty to disable",passwordPlaceholder:"Leave empty to disable",passwordSet:"Enter new password to change",description:"Set both username and password to enable basic authentication. Leave empty to disable."},zai:{enable:"Enable",apiKey:"API Key",description:"Configures Claude Code to use z.ai proxy",modelMappings:"Model Mappings",haiku:"Haiku",sonnet:"Sonnet",opus:"Opus"},language:{label:"Language",description:"Interface language",options:{auto:"Auto-detect",en:"English",zh:"Chinese (Simplified)"}},theme:{label:"Theme",description:"Color theme for the interface",options:{system:"System",light:"Light",dark:"Dark"}},syncClaudeTheme:{label:"Sync Claude Code",description:"Automatically update Claude Code's theme when Vibora switches between light and dark mode"},claudeCodeTheme:{light:"Light mode",dark:"Dark mode",options:{light:"Light","light-ansi":"Light ANSI","light-daltonized":"Light (colorblind)",dark:"Dark","dark-ansi":"Dark ANSI","dark-daltonized":"Dark (colorblind)"}}},Rle={enable:"Enable Notifications",sound:"Sound",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"App Token",userKey:"User Key",testSuccess:"{{channel}} test successful",testFailed:"{{channel}} test failed: {{error}}",uploadSound:"Upload custom sound",deleteSound:"Remove custom sound",testSound:"Test sound",soundUploaded:"Custom sound uploaded",soundUploadFailed:"Failed to upload sound: {{error}}",soundDeleted:"Custom sound removed",soundDeleteFailed:"Failed to remove custom sound",customSoundActive:"Custom sound active"},Ale={restartButton:"Restart Vibora",restarting:"Restarting...",restartDescription:"Rebuild and restart the Vibora server. If the build fails, the server will continue running.",restartFailed:"Restart failed",checkLogs:"Build may have failed. Check journalctl --user -u vibora-dev for details."},Ple={title:"Unsaved Changes",description:"You have unsaved changes that will be lost if you leave this page.",stay:"Stay",leave:"Leave"},Mle={title:kle,sections:Tle,fields:Ole,notifications:Rle,developer:Ale,unsavedChanges:Ple},jle="Review",Lle={pullRequests:"Pull Requests",issues:"Issues"},Dle={pr:{created:"Created by me",assigned:"Assigned to me",reviewRequested:"Review requests",mentioned:"Mentioned"},issue:{assigned:"Assigned to me",created:"Created by me",mentioned:"Mentioned"},allOrgs:"All Orgs",allOrganizations:"All Organizations",viboraReposOnly:"Vibora repos only"},Ile={tokenRequired:"GitHub Token Required",tokenDescription:"To view your issues and pull requests, add a GitHub Personal Access Token in Settings.",requiredScopes:"Required scopes:",scopes:{repo:"(for private repositories)",readUser:"(for user info)",readOrg:"(for organization list)"},generateToken:"Generate Token",goToSettings:"Go to Settings"},Nle={loading:"Loading...",failedToLoad:"Failed to load pull requests",empty:{all:"No open pull requests",created:"No pull requests created by you",assigned:"No pull requests assigned to you",reviewRequested:"No pull requests awaiting your review",mentioned:"No pull requests mentioning you"},draft:"Draft"},Ble={loading:"Loading...",failedToLoad:"Failed to load issues",empty:{assigned:"No issues assigned to you",created:"No issues created by you",mentioned:"No issues mentioning you"}},$le={title:jle,tabs:Lle,filters:Dle,github:Ile,prs:Nle,issues:Ble},zle="Worktrees",Hle={total:"{{count}} total",orphaned:"{{count}} orphaned"},Fle={button:"Clean up ({{count}})",title:"Delete Completed Worktrees",description:"This will permanently delete {{count}} worktree(s).",linkedTasksWillBeDeleted:"Their linked tasks will also be deleted.",alsoDeleteLinkedTasks:"Also delete linked tasks",done:"Done",canceled:"Canceled",cannotUndo:"This action cannot be undone."},Ule={noMatch:"No worktrees match the selected filters.",noWorktrees:"No worktrees found. Worktrees are created when you create tasks."},Vle={failedToLoad:"Failed to load worktrees: {{message}}"},Wle={title:zle,summary:Hle,cleanup:Fle,delete:{title:"Delete Worktree",description:"This will permanently delete the worktree directory at",linkedTaskWillBeDeleted:'The linked task "{{title}}" will also be deleted.',alsoDeleteLinkedTask:'Also delete linked task "{{title}}"',cannotUndo:"This action cannot be undone.",button:"Delete {{count}}"},empty:Ule,error:Vle},qle="Monitoring",Gle={claude:"Claude Instances",system:"System Metrics",processes:"Processes",vibora:"Vibora Servers",usage:"Usage Limits"},Kle={showAllInstances:"Show all instances",instanceCount:"{{count}} instance(s) running",totalRam:"{{ram}} MB total",headers:{terminal:"Terminal",task:"Task",ram:"RAM",actions:"Actions",pid:"PID",workingDirectory:"Working Dir",source:"Source"},noTask:"(no task)",kill:"Kill",killing:"Killing...",source:{vibora:"Vibora: {{name}}",external:"External"},empty:"No Claude instances running",emptyVibora:" in Vibora terminals",error:"Failed to load Claude instances: {{message}}"},Yle={cpuUsage:"CPU Usage",memoryUsage:"Memory Usage",memoryLabels:{used:"Used",cache:"Cache / Buffers"},diskUsage:"Disk Usage ({{path}})",error:"Failed to load system metrics: {{message}}"},Xle={topProcesses:"Top Processes",sortBy:{memory:"By Memory",cpu:"By CPU"},headers:{pid:"PID",name:"Name",command:"Command",memory:"Memory"},empty:"No processes found",error:"Failed to load processes: {{message}}",containers:"Containers",containersEmpty:"No containers running",containersUnavailable:"Docker/Podman not available"},Qle={description:"Running Vibora dev servers",instanceCount:"{{count}} instance(s) running",headers:{port:"Port",mode:"Mode",directory:"Directory",ram:"RAM",actions:"Actions"},mode:{dev:"Dev",prod:"Prod"},vite:"Vite",kill:"Kill",killing:"Killing...",empty:"No Vibora instances running",error:"Failed to load Vibora instances: {{message}}"},Zle={fiveHourBlock:"5-Hour Block",sevenDayRolling:"7-Day Rolling",opusWeekly:"Opus Weekly",sonnetWeekly:"Sonnet Weekly",resetsIn:"Resets in {{time}}",resetsAt:"Resets {{time}}",weekProgress:"{{percent}}% through week",unavailable:"Claude Code usage data not available. Make sure you're logged in to Claude Code.",error:"Failed to load usage data: {{message}}"},Jle={title:qle,tabs:Gle,claude:Kle,system:Yle,processes:Xle,vibora:Qle,usage:Zle},ece="Task Terminals",tce="New Terminal",nce="All Repos",rce={taskTerminals:ece,newTerminal:tce,allRepos:nce},ice="Repositories",sce="{{count}} total",oce="New Task",ace="Add Repository",lce={openInVSCode:"Open in VS Code"},cce={title:"Add Repository",description:"Add a git repository for quick access when creating tasks.",fields:{path:"Repository Path",pathPlaceholder:"Select repository...",displayName:"Display Name",startupScript:"Startup Script",startupScriptPlaceholder:"npm install && npm run dev",startupScriptDescription:"Command to run in the terminal when creating a worktree.",copyFiles:"Copy Files",copyFilesPlaceholder:".env, config.local.json",copyFilesDescription:"Comma-separated glob patterns for files to copy into new worktrees."},adding:"Adding...",cancel:"Cancel"},uce={noRepositories:"No repositories added yet. Add a repository for quick access when creating tasks."},dce={failedToLoad:"Failed to load repositories: {{message}}"},fce={title:ice,total:sce,newTask:oce,addRepository:ace,card:lce,delete:{title:"Delete Repository",description:'This will remove "{{name}}" from Vibora. The actual repository files will not be affected.',button:"Delete",deleting:"Deleting..."},addModal:cce,empty:uce,error:dce},hce={save:"保存更改",cancel:"取消",delete:"删除",create:"创建",reset:"重置为默认值",browse:"浏览",clearFilters:"清除筛选"},pce={loading:"加载中...",saving:"保存中...",saved:"已保存",error:"错误",calculating:"计算中...",validating:"验证中...",creating:"创建中...",deleting:"删除中...",loggingIn:"登录中..."},mce={justNow:"刚刚",minuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",hourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",dayAgo:"1 天前",daysAgo:"{{count}} 天前"},gce={one:"{{count}} 个结果",other:"{{count}} 个结果"},vce={IN_PROGRESS:"进行中",IN_REVIEW:"审核中",DONE:"已完成",CANCELED:"已取消",ORPHANED:"孤立"},yce={loginTitle:"登录 Vibora",username:"用户名",password:"密码",login:"登录",loginFailed:"登录失败"},bce={buttons:hce,status:pce,time:mce,results:gce,statuses:vce,auth:yce},_ce={tasks:"任务",terminals:"终端",worktrees:"工作树",repositories:"仓库",review:"审核",monitoring:"监控",settings:"设置",commandPalette:"命令面板 ({{shortcut}})"},xce={placeholder:"输入命令或搜索...",noResults:"未找到命令",categories:{navigation:"导航",actions:"操作"},commands:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",newTask:"新建任务",keyboardShortcuts:"键盘快捷键"}},Sce={title:"键盘快捷键",groups:{navigation:"导航",actions:"操作",general:"通用"},labels:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",commandPalette:"命令面板",newTask:"新建任务",keyboardShortcuts:"键盘快捷键",closeModal:"关闭弹窗"}},wce={header:_ce,commandPalette:xce,shortcuts:Sce},Cce="任务",Ece="搜索",kce="全部仓库",Tce="新建任务",Oce={title:"创建新任务",description:"创建一个带有 Git 工作树的新任务,用于隔离开发。",fields:{title:"标题",titlePlaceholder:"添加用户认证",description:"描述",descriptionPlaceholder:"实现 OAuth2 登录流程...",aiMode:"AI 模式",repository:"仓库",baseBranch:"基础分支",branchName:"分支名称",branchPlaceholder:"自动生成分支名"},aiModes:{plan:"计划",default:"默认"},tabs:{saved:"仓库",browse:"浏览"},worktreePrefix:"工作树:",branchAutoGenerated:'留空将使用 "{{branch}}"。',selectFolder:"选择文件夹...",searchRepositories:"搜索仓库...",noRepositoriesFound:"未找到仓库",selectRepositoryFirst:"请先选择仓库",loadingBranches:"加载分支中...",selectBranch:"选择分支",current:"(当前)",createTask:"创建任务",errors:{notGitRepo:"所选文件夹不是 Git 仓库",validationFailed:"验证仓库失败"}},Rce={title:Cce,searchPlaceholder:Ece,allRepos:kce,newTask:Tce,createModal:Oce},Ace="设置",Pce={server:"服务器",serverDefaults:"服务器与默认设置",paths:"路径",authentication:"身份验证",editor:"编辑器",integrations:"集成",zai:"z.ai",notifications:"通知",appearance:"外观",developer:"开发者"},Mce={port:{label:"端口",description:"需要重启"},startupCommand:{label:"启动命令",description:"新任务终端的命令"},gitReposDir:{label:"Git 仓库目录",description:"仓库选择器的起始目录"},editor:{app:{label:"编辑器",description:"用于打开工作树的代码编辑器",options:{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}},host:{label:"远程主机",description:"代码在远程机器上时使用的 SSH 地址",placeholder:"例如:my-server.tailnet.ts.net"},sshPort:{label:"SSH 端口",description:"远程 SSH 端口(默认 22)"}},linear:{label:"Linear",description:"用于工单同步的 API 密钥"},github:{label:"GitHub",description:"用于 Issues 和 PR 的个人访问令牌"},auth:{username:"用户名",password:"密码",usernamePlaceholder:"留空以禁用",passwordPlaceholder:"留空以禁用",passwordSet:"输入新密码以更改",description:"同时设置用户名和密码以启用基本身份验证。留空以禁用。"},zai:{enable:"启用",apiKey:"API 密钥",description:"配置 Claude Code 使用 z.ai 代理",modelMappings:"模型映射",haiku:"Haiku",sonnet:"Sonnet",opus:"Opus"},language:{label:"语言",description:"界面语言",options:{auto:"自动检测",en:"English",zh:"简体中文"}},theme:{label:"主题",description:"界面颜色主题",options:{system:"跟随系统",light:"浅色",dark:"深色"}},syncClaudeTheme:{label:"同步 Claude Code",description:"当 Vibora 在浅色和深色模式之间切换时自动更新 Claude Code 的主题"},claudeCodeTheme:{light:"浅色模式",dark:"深色模式",options:{light:"浅色","light-ansi":"浅色 ANSI","light-daltonized":"浅色(色盲友好)",dark:"深色","dark-ansi":"深色 ANSI","dark-daltonized":"深色(色盲友好)"}}},jce={enable:"启用通知",sound:"声音",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"应用令牌",userKey:"用户密钥",testSuccess:"{{channel}} 测试成功",testFailed:"{{channel}} 测试失败:{{error}}",uploadSound:"上传自定义声音",deleteSound:"删除自定义声音",testSound:"测试声音",soundUploaded:"自定义声音已上传",soundUploadFailed:"上传声音失败:{{error}}",soundDeleted:"自定义声音已删除",soundDeleteFailed:"删除自定义声音失败",customSoundActive:"使用自定义声音"},Lce={restartButton:"重启 Vibora",restarting:"重启中...",restartDescription:"重新构建并重启 Vibora 服务器。如果构建失败,服务器将继续运行。",restartFailed:"重启失败",checkLogs:"构建可能失败。运行 journalctl --user -u vibora-dev 查看详情。"},Dce={title:"未保存的更改",description:"您有未保存的更改,离开此页面将丢失这些更改。",stay:"留下",leave:"离开"},Ice={title:Ace,sections:Pce,fields:Mce,notifications:jce,developer:Lce,unsavedChanges:Dce},Nce="审核",Bce={pullRequests:"拉取请求",issues:"问题"},$ce={pr:{created:"我创建的",assigned:"分配给我的",reviewRequested:"待我审核",mentioned:"提及我的"},issue:{assigned:"分配给我的",created:"我创建的",mentioned:"提及我的"},allOrgs:"所有组织",allOrganizations:"所有组织",viboraReposOnly:"仅 Vibora 仓库"},zce={tokenRequired:"需要 GitHub 令牌",tokenDescription:"要查看您的问题和拉取请求,请在设置中添加 GitHub 个人访问令牌。",requiredScopes:"所需权限:",scopes:{repo:"(用于私有仓库)",readUser:"(用于用户信息)",readOrg:"(用于组织列表)"},generateToken:"生成令牌",goToSettings:"前往设置"},Hce={loading:"加载中...",failedToLoad:"加载拉取请求失败",empty:{all:"没有打开的拉取请求",created:"没有您创建的拉取请求",assigned:"没有分配给您的拉取请求",reviewRequested:"没有等待您审核的拉取请求",mentioned:"没有提及您的拉取请求"},draft:"草稿"},Fce={loading:"加载中...",failedToLoad:"加载问题失败",empty:{assigned:"没有分配给您的问题",created:"没有您创建的问题",mentioned:"没有提及您的问题"}},Uce={title:Nce,tabs:Bce,filters:$ce,github:zce,prs:Hce,issues:Fce},Vce="工作树",Wce={total:"共 {{count}} 个",orphaned:"{{count}} 个孤立"},qce={button:"清理 ({{count}})",title:"删除已完成的工作树",description:"这将永久删除 {{count}} 个工作树。",linkedTasksWillBeDeleted:"关联的任务也将被删除。",alsoDeleteLinkedTasks:"同时删除关联的任务",done:"已完成",canceled:"已取消",cannotUndo:"此操作无法撤销。"},Gce={noMatch:"没有匹配所选筛选条件的工作树。",noWorktrees:"未找到工作树。工作树在创建任务时自动生成。"},Kce={failedToLoad:"加载工作树失败:{{message}}"},Yce={title:Vce,summary:Wce,cleanup:qce,delete:{title:"删除工作树",description:"这将永久删除位于以下位置的工作树目录",linkedTaskWillBeDeleted:'关联的任务 "{{title}}" 也将被删除。',alsoDeleteLinkedTask:'同时删除关联的任务 "{{title}}"',cannotUndo:"此操作无法撤销。",button:"删除 {{count}} 个"},empty:Gce,error:Kce},Xce="监控",Qce={claude:"Claude 实例",system:"系统指标",processes:"进程",vibora:"Vibora 服务器",usage:"使用限额"},Zce={showAllInstances:"显示所有实例",instanceCount:"{{count}} 个实例运行中",totalRam:"总计 {{ram}} MB",headers:{terminal:"终端",task:"任务",ram:"内存",actions:"操作",pid:"PID",workingDirectory:"工作目录",source:"来源"},noTask:"(无任务)",kill:"终止",killing:"终止中...",source:{vibora:"Vibora: {{name}}",external:"外部"},empty:"没有 Claude 实例运行中",emptyVibora:" (在 Vibora 终端中)",error:"加载 Claude 实例失败:{{message}}"},Jce={cpuUsage:"CPU 使用率",memoryUsage:"内存使用率",memoryLabels:{used:"已使用",cache:"缓存/缓冲区"},diskUsage:"磁盘使用率 ({{path}})",error:"加载系统指标失败:{{message}}"},eue={topProcesses:"热门进程",sortBy:{memory:"按内存",cpu:"按 CPU"},headers:{pid:"PID",name:"名称",command:"命令",memory:"内存"},empty:"未找到进程",error:"加载进程失败:{{message}}",containers:"容器",containersEmpty:"没有容器运行中",containersUnavailable:"Docker/Podman 不可用"},tue={description:"运行中的 Vibora 开发服务器",instanceCount:"{{count}} 个实例运行中",headers:{port:"端口",mode:"模式",directory:"目录",ram:"内存",actions:"操作"},mode:{dev:"开发",prod:"生产"},vite:"Vite",kill:"终止",killing:"终止中...",empty:"没有 Vibora 实例运行中",error:"加载 Vibora 实例失败:{{message}}"},nue={fiveHourBlock:"5小时配额",sevenDayRolling:"7天滚动配额",opusWeekly:"Opus 周配额",sonnetWeekly:"Sonnet 周配额",resetsIn:"{{time}}后重置",resetsAt:"{{time}}重置",weekProgress:"本周已过 {{percent}}%",unavailable:"Claude Code 使用数据不可用。请确保已登录 Claude Code。",error:"加载使用数据失败:{{message}}"},rue={title:Xce,tabs:Qce,claude:Zce,system:Jce,processes:eue,vibora:tue,usage:nue},iue="任务终端",sue="新建终端",oue="全部仓库",aue={taskTerminals:iue,newTerminal:sue,allRepos:oue},lue="仓库",cue="共 {{count}} 个",uue="新建任务",due="添加仓库",fue={openInVSCode:"在 VS Code 中打开"},hue={title:"添加仓库",description:"添加一个 Git 仓库,以便在创建任务时快速访问。",fields:{path:"仓库路径",pathPlaceholder:"选择仓库...",displayName:"显示名称",startupScript:"启动脚本",startupScriptPlaceholder:"npm install && npm run dev",startupScriptDescription:"创建工作树时在终端中运行的命令。",copyFiles:"复制文件",copyFilesPlaceholder:".env, config.local.json",copyFilesDescription:"用逗号分隔的 glob 模式,用于复制文件到新的工作树。"},adding:"添加中...",cancel:"取消"},pue={noRepositories:"尚未添加任何仓库。添加一个仓库以便在创建任务时快速访问。"},mue={failedToLoad:"加载仓库失败:{{message}}"},gue={title:lue,total:cue,newTask:uue,addRepository:due,card:fue,delete:{title:"删除仓库",description:'这将从 Vibora 中移除 "{{name}}"。实际的仓库文件不会受到影响。',button:"删除",deleting:"删除中..."},addModal:hue,empty:pue,error:mue},vue="common",Dk=["en","zh"],yue={en:{common:mle,navigation:ble,tasks:Ele,settings:Mle,review:$le,worktrees:Wle,monitoring:Jle,terminals:rce,repositories:fce},zh:{common:bce,navigation:wce,tasks:Rce,settings:Ice,review:Uce,worktrees:Yce,monitoring:rue,terminals:aue,repositories:gue}};function bue(){if(typeof window<"u"){const e=localStorage.getItem("vibora-language");if(e&&Dk.includes(e))return e;const t=navigator.language.split("-")[0];if(Dk.includes(t))return t}return"en"}ei.use(HZ).init({resources:yue,lng:bue(),fallbackLng:"en",defaultNS:vue,ns:["common","navigation","tasks","settings","review","worktrees","monitoring","terminals","repositories"],interpolation:{escapeValue:!1}});ei.on("languageChanged",e=>{typeof window<"u"&&localStorage.setItem("vibora-language",e)});function aF(){const{i18n:e}=Zt(),{data:t,isSuccess:n}=$ae(),r=AR();O.useEffect(()=>{n&&t&&t!==e.language&&e.changeLanguage(t)},[n,t,e]);const i=O.useCallback(async s=>{if(s)await e.changeLanguage(s);else{const a=navigator.language.split("-")[0],o=Dk.includes(a)?a:"en";await e.changeLanguage(o)}r.mutate({key:Bt.LANGUAGE,value:s??""})},[e,r]);return{language:e.language,savedLanguage:t,changeLanguage:i,isUpdating:r.isPending}}function lF(){const{setTheme:e,resolvedTheme:t,theme:n}=Am(),{data:r,isSuccess:i}=zae(),{data:s}=Hae(),a=AR(),o=O.useRef(void 0),l=O.useRef(void 0),u=O.useRef(!1);O.useEffect(()=>{i&&r&&r!==n&&e(r)},[i,r,n,e]),O.useEffect(()=>{if(!t)return;const d=t==="dark"?"/logo-dark.jpg":"/logo-light.jpg";let p=document.querySelector('link[rel="icon"]');p||(p=document.createElement("link"),p.rel="icon",document.head.appendChild(p)),p.type="image/jpeg",p.href=d},[t]),O.useEffect(()=>{const d=t&&t!==o.current,p=u.current&&s&&l.current===!1;o.current=t,l.current=s,u.current=!0,t&&s&&(d||p)&&$t("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:t})}).catch(()=>{})},[t,s]);const h=O.useCallback(d=>{e(d),a.mutate({key:Bt.THEME,value:d==="system"?"":d})},[e,a]);return{theme:n??"system",resolvedTheme:t,savedTheme:r,syncClaudeCode:s,changeTheme:h,isUpdating:a.isPending}}let ES=!1;const eI={activeTabId:null,focusedTerminals:{},currentView:null,currentTaskId:null,isTabVisible:null,viewUpdatedAt:null};function _ue(){const e=Sr(),t=O.useRef(void 0),n=O.useRef({}),{data:r=eI,isLoading:i}=Mn({queryKey:["terminal-view-state"],queryFn:async()=>{const p=await fetch("/api/terminal-view-state");if(!p.ok)throw new Error("Failed to fetch terminal view state");return p.json()},staleTime:2e3}),s=zn({mutationFn:async p=>{const v=await fetch("/api/terminal-view-state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!v.ok)throw new Error("Failed to update terminal view state");return v.json()},onSuccess:p=>{e.setQueryData(["terminal-view-state"],p)}}),a=O.useRef(s);a.current=s;const o=O.useCallback(p=>{const v=n.current;n.current={...v,...p,focusedTerminals:p.focusedTerminals||v.focusedTerminals?{...v.focusedTerminals,...p.focusedTerminals}:void 0};const x=n.current;e.setQueryData(["terminal-view-state"],b=>{const g=b??eI;return{activeTabId:g.activeTabId,focusedTerminals:{...g.focusedTerminals,...x.focusedTerminals},currentView:x.currentView!==void 0?x.currentView:g.currentView,currentTaskId:x.currentTaskId!==void 0?x.currentTaskId:g.currentTaskId,isTabVisible:x.isTabVisible!==void 0?x.isTabVisible:g.isTabVisible,viewUpdatedAt:x.viewUpdatedAt!==void 0?x.viewUpdatedAt:g.viewUpdatedAt}}),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{a.current.mutate(n.current),n.current={}},500)},[e]),l=O.useCallback((p,v)=>{if(v===null){const x=e.getQueryData(["terminal-view-state"]);if(x){const{[p]:b,...g}=x.focusedTerminals;o({focusedTerminals:g})}}else o({focusedTerminals:{[p]:v}})},[e,o]),u=O.useCallback(p=>r.focusedTerminals[p]??null,[r.focusedTerminals]),h=O.useRef(!1);O.useEffect(()=>{if(ES){h.current=!1;return}ES=!0,h.current=!0;const p=()=>{o({isTabVisible:document.visibilityState==="visible",viewUpdatedAt:new Date().toISOString()})};return document.addEventListener("visibilitychange",p),p(),()=>{document.removeEventListener("visibilitychange",p),h.current&&(ES=!1)}},[o]);const d=O.useCallback((p,v)=>{o({currentView:p,currentTaskId:v,viewUpdatedAt:new Date().toISOString()})},[o]);return{viewState:r,isLoading:i,getFocusedTerminal:u,setFocusedTerminal:l,updateViewTracking:d}}const cF=O.createContext(null);function xue({children:e}){const[t,n]=O.useState(!1),[r,i]=O.useState(!1),s=O.useCallback(u=>{n(u)},[]),a=O.useCallback(u=>{i(u)},[]),o=O.useMemo(()=>!t,[t]),l=O.useMemo(()=>({terminalFocused:t,setTerminalFocused:s,modalOpen:r,setModalOpen:a,shortcutsEnabled:o}),[t,s,r,a,o]);return w.jsx(cF.Provider,{value:l,children:e})}function LR(){const e=O.useContext(cF);if(!e)throw new Error("useKeyboardContext must be used within a KeyboardProvider");return e}function Sue(){return navigator.platform.toUpperCase().indexOf("MAC")>=0}function uF(e){const t=e.toLowerCase().split("+"),n=t.pop()||"";return{meta:t.includes("meta")||t.includes("cmd"),ctrl:t.includes("ctrl"),alt:t.includes("alt")||t.includes("option"),shift:t.includes("shift"),key:n}}function wue(e,t){const n=uF(t);if(n.meta!==e.metaKey||n.ctrl!==e.ctrlKey||n.alt!==e.altKey||n.shift!==e.shiftKey)return!1;const r=e.key.toLowerCase(),i=n.key.toLowerCase();return i==="escape"?r==="escape":i==="enter"?r==="enter":i==="space"?r===" ":i==="backspace"?r==="backspace":i==="delete"?r==="delete":i==="tab"?r==="tab":i==="arrowup"?r==="arrowup":i==="arrowdown"?r==="arrowdown":i==="arrowleft"?r==="arrowleft":i==="arrowright"?r==="arrowright":/^[0-9]$/.test(i)?r===i:i==="/"&&!n.shift?r==="/":i==="/"&&n.shift||i==="?"?r==="?":i===","?r===",":i==="\\"?r==="\\":r===i}function dF(e){const t=uF(e),n=[],r=Sue();t.ctrl&&n.push("Ctrl"),t.alt&&n.push(r?"Option":"Alt"),t.shift&&n.push("Shift"),t.meta&&n.push(r?"Cmd":"Ctrl");let i=t.key.toUpperCase();return i==="ESCAPE"&&(i="Esc"),i==="ENTER"&&(i="Enter"),i==="SPACE"&&(i="Space"),i==="BACKSPACE"&&(i="Backspace"),i==="DELETE"&&(i="Delete"),i==="ARROWUP"&&(i="↑"),i==="ARROWDOWN"&&(i="↓"),i==="ARROWLEFT"&&(i="←"),i==="ARROWRIGHT"&&(i="→"),i===","&&(i=","),i==="/"&&(i="/"),i==="?"&&(i="?"),i==="\\"&&(i="\\"),n.push(i),n.join("+")}function Cue(e){if(!e||!(e instanceof HTMLElement))return!1;const t=e.tagName.toLowerCase();return!!(t==="input"||t==="textarea"||e.isContentEditable)}function ca(e,t,n={}){const{shortcutsEnabled:r}=LR(),{ignoreContext:i=!1,allowInInput:s=!1,allowInTerminal:a=!1,deps:o=[],enabled:l=!0}=n,u=O.useRef(t);u.current=t;const h=Array.isArray(e)?e:[e],d=O.useCallback(p=>{!i&&!r&&!a||!l||!s&&Cue(p.target)&&!h.some(b=>b.toLowerCase()==="escape")||!h.some(x=>wue(p,x))||(p.preventDefault(),p.stopPropagation(),u.current(p))},[r,i,s,a,l,...h,...o]);O.useEffect(()=>(document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}),[d])}function Sc(e,t){const n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return 100;if(n.startsWith(r))return 80;if(n.includes(r))return 60;let i=0,s=0,a=0;for(;i<n.length&&s<r.length;)n[i]===r[s]&&(a+=1,s++),i++;return s===r.length?a:0}function Eue(e,t){return t.trim()?e.map(r=>{let i=Sc(r.label,t);if(r.keywords)for(const s of r.keywords){const a=Sc(s,t);a>i&&(i=a)}return{command:r,score:i}}).filter(({score:r})=>r>0).sort((r,i)=>i.score-r.score).map(({command:r})=>r):e}function kue(e){const t=new Map;for(const n of e){const r=t.get(n.category)||[];r.push(n),t.set(n.category,r)}return t}function Tue({open:e,onOpenChange:t,onNewTask:n,onShowShortcuts:r}){const{t:i}=Zt("navigation"),[s,a]=O.useState(!1),o=e??s,l=t??a,[u,h]=O.useState(""),[d,p]=O.useState(0),v=O.useRef(null),x=O.useRef(null),b=Ta(),g=O.useMemo(()=>[{id:"goto-tasks",label:i("commandPalette.commands.goToTasks"),shortcut:"meta+1",keywords:["kanban","board","home"],category:"navigation",icon:w.jsx(me,{icon:Qy,size:16,strokeWidth:2}),action:()=>{b({to:"/tasks"}),l(!1)}},{id:"goto-terminals",label:i("commandPalette.commands.goToTerminals"),shortcut:"meta+2",keywords:["shell","console","cli"],category:"navigation",icon:w.jsx(me,{icon:uR,size:16,strokeWidth:2}),action:()=>{b({to:"/terminals"}),l(!1)}},{id:"goto-task-terminals",label:i("commandPalette.commands.goToTaskTerminals"),shortcut:"meta+i",keywords:["tasks","shell","console","cli"],category:"navigation",icon:w.jsx(me,{icon:Qy,size:16,strokeWidth:2}),action:()=>{b({to:"/terminals",search:{tab:"all-tasks"}}),l(!1)}},{id:"goto-worktrees",label:i("commandPalette.commands.goToWorktrees"),shortcut:"meta+3",keywords:["git","branches"],category:"navigation",icon:w.jsx(me,{icon:Wz,size:16,strokeWidth:2}),action:()=>{b({to:"/worktrees"}),l(!1)}},{id:"goto-repositories",label:i("commandPalette.commands.goToRepositories"),shortcut:"meta+4",keywords:["repos","git","projects"],category:"navigation",icon:w.jsx(me,{icon:Uz,size:16,strokeWidth:2}),action:()=>{b({to:"/repositories"}),l(!1)}},{id:"goto-settings",label:i("commandPalette.commands.goToSettings"),shortcut:"meta+,",keywords:["preferences","config","configuration"],category:"navigation",icon:w.jsx(me,{icon:Kz,size:16,strokeWidth:2}),action:()=>{b({to:"/settings"}),l(!1)}},{id:"new-task",label:i("commandPalette.commands.newTask"),shortcut:"meta+j",keywords:["create","add"],category:"actions",icon:w.jsx(me,{icon:$l,size:16,strokeWidth:2}),action:()=>{l(!1),n?.()}},{id:"show-shortcuts",label:i("commandPalette.commands.keyboardShortcuts"),shortcut:"meta+/",keywords:["help","hotkeys","keys"],category:"actions",icon:w.jsx(me,{icon:Fre,size:16,strokeWidth:2}),action:()=>{l(!1),r?.()}}],[b,n,r,l,i]),_=O.useMemo(()=>Eue(g,u),[g,u]),y=O.useMemo(()=>kue(_),[_]),S=O.useMemo(()=>{const T=[],A=["navigation","actions"];for(const R of A){const M=y.get(R);M&&T.push(...M)}return T},[y]);O.useEffect(()=>{p(0)},[u]),O.useEffect(()=>{if(!x.current)return;const T=x.current.querySelector('[data-selected="true"]');T&&T.scrollIntoView({block:"nearest"})},[d]),ca("meta+k",()=>l(!0),{allowInInput:!0,allowInTerminal:!0}),ca("meta+1",()=>b({to:"/tasks"}),{allowInInput:!0,allowInTerminal:!0}),ca("meta+2",()=>b({to:"/terminals"}),{allowInInput:!0,allowInTerminal:!0}),ca("meta+i",()=>{b({to:"/terminals",search:{tab:"all-tasks"}})},{allowInInput:!0,allowInTerminal:!0}),ca("meta+3",()=>b({to:"/worktrees"}),{allowInInput:!0,allowInTerminal:!0}),ca("meta+4",()=>b({to:"/repositories"}),{allowInInput:!0,allowInTerminal:!0}),ca("meta+,",()=>b({to:"/settings"}),{allowInInput:!0,allowInTerminal:!0}),ca("meta+j",()=>{n?.()},{allowInInput:!1,deps:[n]}),ca("meta+/",()=>{r?.()},{allowInInput:!0,allowInTerminal:!0,deps:[r]});const k=O.useCallback(T=>{switch(T.key){case"ArrowDown":T.preventDefault(),p(A=>Math.min(A+1,S.length-1));break;case"ArrowUp":T.preventDefault(),p(A=>Math.max(A-1,0));break;case"Enter":T.preventDefault(),S[d]&&S[d].action();break;case"Escape":T.preventDefault(),l(!1);break}},[S,d,l]);O.useEffect(()=>{o&&(h(""),p(0),setTimeout(()=>v.current?.focus(),50))},[o]);let E=0;return w.jsx(zl,{open:o,onOpenChange:l,children:w.jsxs(Hl,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden",showCloseButton:!1,onKeyDown:k,children:[w.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[w.jsx("span",{className:"text-muted-foreground mr-2",children:">"}),w.jsx(Xt,{ref:v,value:u,onChange:T=>h(T.target.value),placeholder:i("commandPalette.placeholder"),className:"border-0 ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 px-0 h-12"}),w.jsx("kbd",{className:"pointer-events-none ml-2 inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:"Esc"})]}),w.jsx("div",{ref:x,className:"max-h-80 overflow-y-auto p-2",children:_.length===0?w.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:i("commandPalette.noResults")}):w.jsx(w.Fragment,{children:["navigation","actions"].map(T=>{const A=y.get(T);return!A||A.length===0?null:w.jsxs("div",{className:"mb-2 last:mb-0",children:[w.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:i(`commandPalette.categories.${T}`)}),A.map(R=>{const M=E++,B=M===d;return w.jsxs("button",{"data-selected":B,onClick:()=>R.action(),onMouseEnter:()=>p(M),className:Ne("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm",B?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[R.icon&&w.jsx("span",{className:"text-muted-foreground",children:R.icon}),w.jsx("span",{className:"flex-1 text-left",children:R.label}),R.shortcut&&w.jsx("kbd",{className:"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:dF(R.shortcut)})]},R.id)})]},T)})})})]})})}const tI={sm:"w-8 h-8",md:"w-9 h-9 md:w-12 md:h-12",lg:"w-12 h-12 md:w-16 md:h-16"};function Oue({className:e,rows:t=100,cols:n=10,tileClassName:r,tileSize:i="md"}){return w.jsx("div",{className:Ne("relative z-0 flex w-full h-full justify-center",e),children:Array.from({length:t}).map((s,a)=>w.jsx("div",{className:Ne(tI[i],"border-l dark:border-neutral-900 border-neutral-200 relative",r),children:Array.from({length:n}).map((o,l)=>w.jsx("div",{className:Ne(tI[i],"border-r border-t dark:border-neutral-900 border-neutral-200 relative hover:bg-tile transition-colors",r)},`col-${l}`))},`row-${a}`))})}const Rue=["/","/tasks","/terminals","/worktrees","/repositories","/review","/monitoring","/settings"];function Aue(){const e=xr({select:n=>n.location.pathname});return Rue.some(n=>e===n||e.startsWith(n+"/"))?w.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none -z-10",children:w.jsx(Oue,{rows:100,cols:50,tileSize:"sm"})}):null}const Pue=[{titleKey:"navigation",items:[{labelKey:"goToTasks",shortcut:"meta+1"},{labelKey:"goToTerminals",shortcut:"meta+2"},{labelKey:"goToTaskTerminals",shortcut:"meta+i"},{labelKey:"goToWorktrees",shortcut:"meta+3"},{labelKey:"goToRepositories",shortcut:"meta+4"},{labelKey:"goToSettings",shortcut:"meta+,"}]},{titleKey:"actions",items:[{labelKey:"commandPalette",shortcut:"meta+k"},{labelKey:"newTask",shortcut:"meta+j"},{labelKey:"keyboardShortcuts",shortcut:"meta+/"}]},{titleKey:"general",items:[{labelKey:"closeModal",shortcut:"escape"}]}];function Mue({open:e,onOpenChange:t}){const{t:n}=Zt("navigation");return w.jsx(zl,{open:e,onOpenChange:t,children:w.jsxs(Hl,{className:"sm:max-w-md",children:[w.jsx(hu,{children:w.jsx(pu,{children:n("shortcuts.title")})}),w.jsx("div",{className:"space-y-4 mt-2",children:Pue.map(r=>w.jsxs("div",{children:[w.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:n(`shortcuts.groups.${r.titleKey}`)}),w.jsx("div",{className:"space-y-1",children:r.items.map(i=>w.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[w.jsx("span",{className:"text-sm",children:n(`shortcuts.labels.${i.labelKey}`)}),w.jsx("kbd",{className:"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground",children:dF(i.shortcut)})]},i.shortcut))})]},r.titleKey))})]})})}const jue=({...e})=>{const{resolvedTheme:t}=Am();return w.jsx(ase,{theme:t,className:"toaster group",icons:{success:w.jsx(me,{icon:Ire,strokeWidth:2,className:"size-4"}),info:w.jsx(me,{icon:Wre,strokeWidth:2,className:"size-4"}),warning:w.jsx(me,{icon:Ef,strokeWidth:2,className:"size-4"}),error:w.jsx(me,{icon:Xre,strokeWidth:2,className:"size-4"}),loading:w.jsx(me,{icon:An,strokeWidth:2,className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},toastOptions:{classNames:{toast:"cn-toast"}},...e})},no=aQ({component:$ue});function Lue(){return lle(),null}function Due(){return aF(),null}function Iue(){return lF(),null}function Nue(){const e=xr({select:n=>n.location}),{updateViewTracking:t}=_ue();return O.useEffect(()=>{const n=e.pathname;let r="other",i=null;n.startsWith("/tasks/")?(r="task-detail",i=n.split("/")[2]||null):n==="/terminals"&&(r="terminals"),t(r,i)},[e.pathname,t]),null}function Bue(){const e=xr({select:t=>t.location});return O.useEffect(()=>{window.parent!==window&&window.parent.postMessage({type:"vibora:route",pathname:e.pathname,search:e.search},"*")},[e.pathname,e.search]),null}function $ue(){const[e,t]=O.useState(null),[n,r]=O.useState(!1),[i,s]=O.useState(!1),a=O.useCallback(h=>{t(()=>h)},[]),o=O.useCallback(()=>{e?.()},[e]),l=O.useCallback(()=>{r(!0)},[]),u=O.useCallback(()=>{s(!0)},[]);return w.jsx(xue,{children:w.jsxs("div",{className:"flex h-screen flex-col overflow-x-hidden bg-background text-foreground",children:[w.jsx(Lue,{}),w.jsx(Due,{}),w.jsx(Iue,{}),w.jsx(Nue,{}),w.jsx(Bue,{}),w.jsx(ile,{onNewTaskRef:a,onOpenCommandPalette:u}),w.jsxs("main",{className:"isolate flex-1 overflow-hidden relative",children:[w.jsx(Aue,{}),w.jsx(B7,{})]}),w.jsx(Tue,{open:i,onOpenChange:s,onNewTask:o,onShowShortcuts:l}),w.jsx(Mue,{open:n,onOpenChange:r}),w.jsx(jue,{position:"bottom-right"})]})})}const zue=Rs("/")({beforeLoad:()=>{throw S7({to:"/tasks"})}}),fF="";function Hue(){const[e,t]=O.useState(new Map),[n,r]=O.useState(null),[i,s]=O.useState(!0),[a,o]=O.useState(!1),[l,u]=O.useState(null),h=O.useRef(null),d=O.useRef(0),p=O.useCallback(()=>{h.current?.close(),s(!0),o(!1),u(null),t(new Map),r(null);const x=new EventSource(`${fF}/api/worktrees`);h.current=x,x.addEventListener("worktree:basic",b=>{const g=JSON.parse(b.data);d.current=g.length,t(new Map(g.map(_=>[_.path,{..._,size:0,sizeFormatted:"...",branch:"..."}]))),s(!1),o(g.length>0)}),x.addEventListener("worktree:details",b=>{const g=JSON.parse(b.data);t(_=>{const y=new Map(_),S=y.get(g.path);return S&&y.set(g.path,{...S,size:g.size,sizeFormatted:g.sizeFormatted,branch:g.branch}),y}),d.current--,d.current<=0&&o(!1)}),x.addEventListener("worktree:complete",b=>{const g=JSON.parse(b.data);r(g),o(!1),x.close()}),x.addEventListener("worktree:error",b=>{const{path:g}=JSON.parse(b.data);Ct.viewer.error("Error loading worktree details",{path:g}),d.current--,d.current<=0&&o(!1)}),x.onerror=()=>{u(new Error("Connection lost")),s(!1),o(!1),x.close()}},[]);return O.useEffect(()=>(p(),()=>{h.current?.close()}),[p]),{worktrees:O.useMemo(()=>Array.from(e.values()).sort((b,g)=>b.isOrphaned!==g.isOrphaned?b.isOrphaned?-1:1:new Date(g.lastModified).getTime()-new Date(b.lastModified).getTime()),[e]),summary:n,isLoading:i,isLoadingDetails:a,error:l,refetch:p}}function Fue(){const e=Sr();return zn({mutationFn:({worktreePath:t,repoPath:n,deleteLinkedTask:r})=>$t(`${fF}/api/worktrees`,{method:"DELETE",body:JSON.stringify({worktreePath:t,repoPath:n,deleteLinkedTask:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worktrees"]}),e.invalidateQueries({queryKey:["tasks"]})}})}const Uue=Dl("h-5 gap-1 rounded-full border border-transparent px-2 py-0.5 text-[0.625rem] font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-2.5! inline-flex items-center justify-center w-fit whitespace-nowrap shrink-0 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-colors overflow-hidden group/badge",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 [a]:hover:bg-destructive/20 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 text-destructive dark:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground bg-input/20 dark:bg-input/30",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Wc({className:e,variant:t="default",render:n,...r}){return fae({defaultTagName:"span",props:Ro({className:Ne(Uue({className:e,variant:t}))},r),render:n,state:{slot:"badge",variant:t}})}function Zi({className:e,size:t="default",...n}){return w.jsx("div",{"data-slot":"card","data-size":t,className:Ne("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-lg py-4 text-xs/relaxed ring-1 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg group/card flex flex-col",e),...n})}function Vue({className:e,...t}){return w.jsx("div",{"data-slot":"card-header",className:Ne("gap-1 rounded-t-lg px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]",e),...t})}function Wue({className:e,...t}){return w.jsx("div",{"data-slot":"card-title",className:Ne("text-sm font-medium",e),...t})}function qm({className:e,...t}){return w.jsx("div",{"data-slot":"card-content",className:Ne("px-4 group-data-[size=sm]/card:px-3",e),...t})}function Tf({...e}){return w.jsx(Wse,{"data-slot":"alert-dialog",...e})}function Of({...e}){return w.jsx(sH,{"data-slot":"alert-dialog-trigger",...e})}function que({...e}){return w.jsx(tH,{"data-slot":"alert-dialog-portal",...e})}function Gue({className:e,...t}){return w.jsx(Qz,{"data-slot":"alert-dialog-overlay",className:Ne("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/80 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50",e),...t})}function Rf({className:e,size:t="default",...n}){return w.jsxs(que,{children:[w.jsx(Gue,{}),w.jsx(eH,{"data-slot":"alert-dialog-content","data-size":t,className:Ne("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-3 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",e),...n})]})}function Af({className:e,...t}){return w.jsx("div",{"data-slot":"alert-dialog-header",className:Ne("grid grid-rows-[auto_1fr] place-items-center gap-1 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-4 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Pf({className:e,...t}){return w.jsx("div",{"data-slot":"alert-dialog-footer",className:Ne("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function Mf({className:e,...t}){return w.jsx(iH,{"data-slot":"alert-dialog-title",className:Ne("text-sm font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function jf({className:e,...t}){return w.jsx(Zz,{"data-slot":"alert-dialog-description",className:Ne("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...t})}function hF({className:e,...t}){return w.jsx(He,{"data-slot":"alert-dialog-action",className:Ne(e),...t})}function Lf({className:e,variant:t="outline",size:n="default",...r}){return w.jsx(z0,{"data-slot":"alert-dialog-cancel",className:Ne(e),render:w.jsx(He,{variant:t,size:n}),...r})}const Gm=O.forwardRef(({className:e,...t},n)=>w.jsx(_oe,{ref:n,className:Ne("peer size-4 shrink-0 rounded border border-input ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50","data-checked:bg-primary data-checked:border-primary data-checked:text-primary-foreground","flex items-center justify-center transition-colors",e),...t,children:w.jsx(xoe,{className:"flex items-center justify-center",children:w.jsx(me,{icon:fu,size:12,strokeWidth:3})})}));Gm.displayName="Checkbox";const Ik={IN_PROGRESS:"bg-muted-foreground/20 text-muted-foreground",IN_REVIEW:"bg-primary/20 text-primary",DONE:"bg-accent/20 text-accent",CANCELED:"bg-destructive/20 text-destructive",ORPHANED:"bg-destructive/20 text-destructive"},Kue=Rs("/worktrees/")({component:Zue});function Yue(){const{t:e}=Zt("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),s=Math.floor(i/1e3),a=Math.floor(s/60),o=Math.floor(a/60),l=Math.floor(o/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):o>0?o===1?e("time.hourAgo"):e("time.hoursAgo",{count:o}):a>0?a===1?e("time.minuteAgo"):e("time.minutesAgo",{count:a}):e("time.justNow")}}function nI({className:e}){return w.jsx("span",{className:`inline-block animate-pulse rounded bg-muted ${e}`})}function Xue({worktree:e,onDelete:t}){const{t:n}=Zt("common"),{t:r}=Zt("worktrees"),i=Yue(),[s,a]=O.useState(!1),[o,l]=O.useState(!1),[u,h]=O.useState(!1),d=e.sizeFormatted==="..."||e.branch==="...",p=!e.isOrphaned&&e.taskId,v=async()=>{l(!0);try{await t(e,u),a(!1)}catch{}finally{l(!1)}},x=b=>{a(b),b||h(!1)};return w.jsx(Zi,{className:"transition-colors hover:border-border/80",children:w.jsxs(qm,{className:"flex items-start justify-between gap-4 py-4",children:[w.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[w.jsxs("div",{className:"flex items-center gap-2",children:[w.jsx("span",{className:"truncate font-medium",children:e.name}),e.isOrphaned?w.jsx(Wc,{className:Ne("shrink-0",Ik.ORPHANED),children:n("statuses.ORPHANED")}):e.taskStatus?w.jsx(Wc,{className:Ne("shrink-0",Ik[e.taskStatus]),children:n(`statuses.${e.taskStatus}`)}):null]}),w.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx(me,{icon:Es,size:12,strokeWidth:2,className:"shrink-0"}),w.jsx("span",{className:"truncate font-mono",children:e.path})]}),w.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx(me,{icon:Ak,size:12,strokeWidth:2,className:"shrink-0"}),e.branch==="..."?w.jsx(nI,{className:"h-3 w-16"}):w.jsx("span",{className:"font-mono",children:e.branch})]}),w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx(me,{icon:Hre,size:12,strokeWidth:2,className:"shrink-0"}),e.sizeFormatted==="..."?w.jsx(nI,{className:"h-3 w-12"}):w.jsx("span",{children:e.sizeFormatted})]}),w.jsxs("div",{className:"flex items-center gap-1.5",children:[w.jsx(me,{icon:Lre,size:12,strokeWidth:2,className:"shrink-0"}),w.jsx("span",{children:i(e.lastModified)})]})]}),e.taskId&&e.taskTitle&&w.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:w.jsxs(di,{to:"/tasks/$taskId",params:{taskId:e.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[w.jsx("span",{className:"truncate",children:e.taskTitle}),w.jsx(me,{icon:$0,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),w.jsxs(Tf,{open:s,onOpenChange:x,children:[w.jsx(Of,{render:w.jsx(He,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:d}),children:w.jsx(me,{icon:zm,size:14,strokeWidth:2})}),w.jsxs(Rf,{children:[w.jsxs(Af,{children:[w.jsx(Mf,{children:r("delete.title")}),w.jsxs(jf,{children:[r("delete.description")," ",w.jsx("span",{className:"font-mono",children:e.name}),".",u&&p&&w.jsxs(w.Fragment,{children:[" ",r("delete.linkedTaskWillBeDeleted",{title:e.taskTitle})]})," ",r("delete.cannotUndo")]}),p&&w.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[w.jsx(Gm,{checked:u,onCheckedChange:b=>h(b===!0),disabled:o}),r("delete.alsoDeleteLinkedTask",{title:e.taskTitle})]})]}),w.jsxs(Pf,{children:[w.jsx(Lf,{disabled:o,children:n("buttons.cancel")}),w.jsxs(He,{variant:"destructive",onClick:v,disabled:o,className:"gap-2",children:[o&&w.jsx(me,{icon:An,size:14,strokeWidth:2,className:"animate-spin"}),n(o?"status.deleting":"buttons.delete")]})]})]})]})]})})}const Que=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function Zue(){const{t:e}=Zt("common"),{t}=Zt("worktrees"),{worktrees:n,summary:r,isLoading:i,isLoadingDetails:s,error:a,refetch:o}=Hue(),l=Fue(),[u,h]=O.useState(new Set),[d,p]=O.useState(!1),[v,x]=O.useState(!1),[b,g]=O.useState(!1),_=R=>{h(M=>{const B=new Set(M);return B.has(R)?B.delete(R):B.add(R),B})},y=()=>{h(new Set)},S=O.useMemo(()=>u.size===0?n:n.filter(R=>!!(R.isOrphaned&&u.has("ORPHANED")||R.taskStatus&&u.has(R.taskStatus))),[n,u]),k=O.useMemo(()=>n.filter(R=>R.taskStatus==="DONE"||R.taskStatus==="CANCELED"),[n]),E=async()=>{if(k.length!==0){x(!0);try{for(const R of k)await l.mutateAsync({worktreePath:R.path,repoPath:R.repoPath,deleteLinkedTask:b});p(!1),o()}catch{}finally{x(!1)}}},T=R=>{p(R),R||g(!1)},A=async(R,M)=>{await l.mutateAsync({worktreePath:R.path,repoPath:R.repoPath,deleteLinkedTask:M}),o()};return w.jsxs("div",{className:"flex h-full flex-col",children:[w.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border bg-background px-4 py-2",children:[w.jsxs("div",{className:"flex items-center justify-between",children:[w.jsxs("div",{className:"flex items-center gap-4",children:[w.jsx("h1",{className:"text-sm font-medium",children:t("title")}),(r||n.length>0)&&w.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[w.jsx("span",{children:t("summary.total",{count:r?.total??n.length})}),(r?.orphaned??n.filter(R=>R.isOrphaned).length)>0&&w.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:r?.orphaned??n.filter(R=>R.isOrphaned).length})}),s?w.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):r?w.jsx("span",{children:r.totalSizeFormatted}):null]})]}),w.jsxs("div",{className:"flex items-center gap-2",children:[k.length>0&&w.jsxs(Tf,{open:d,onOpenChange:T,children:[w.jsxs(Of,{render:w.jsx(He,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:s}),children:[w.jsx(me,{icon:Nre,size:12,strokeWidth:2}),t("cleanup.button",{count:k.length})]}),w.jsxs(Rf,{children:[w.jsxs(Af,{children:[w.jsx(Mf,{children:t("cleanup.title")}),w.jsxs(jf,{children:[t("cleanup.description",{count:k.length}),b&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),w.jsxs("div",{className:"space-y-3",children:[w.jsxs("p",{className:"text-sm text-muted-foreground",children:[k.filter(R=>R.taskStatus==="DONE").length>0&&w.jsxs("span",{className:"mr-3",children:[w.jsx("span",{className:"font-medium text-accent",children:k.filter(R=>R.taskStatus==="DONE").length})," ",t("cleanup.done")]}),k.filter(R=>R.taskStatus==="CANCELED").length>0&&w.jsxs("span",{children:[w.jsx("span",{className:"font-medium text-destructive",children:k.filter(R=>R.taskStatus==="CANCELED").length})," ",t("cleanup.canceled")]})]}),w.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[w.jsx(Gm,{checked:b,onCheckedChange:R=>g(R===!0),disabled:v}),t("cleanup.alsoDeleteLinkedTasks")]}),w.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),w.jsxs(Pf,{children:[w.jsx(Lf,{disabled:v,children:e("buttons.cancel")}),w.jsxs(He,{variant:"destructive",onClick:E,disabled:v,className:"gap-2",children:[v&&w.jsx(me,{icon:An,size:14,strokeWidth:2,className:"animate-spin"}),v?e("status.deleting"):t("delete.button",{count:k.length})]})]})]})]}),u.size>0&&w.jsxs(He,{variant:"ghost",size:"sm",onClick:y,className:"gap-1.5 text-xs",children:[w.jsx(me,{icon:Ps,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),w.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:Que.map(R=>{const M=u.has(R);return w.jsx("button",{onClick:()=>_(R),className:Ne("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",M?Ik[R]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${R}`)},R)})})]}),w.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i&&w.jsx("div",{className:"flex items-center justify-center py-12",children:w.jsx(me,{icon:An,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),a&&w.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[w.jsx(me,{icon:Ef,size:20,strokeWidth:2}),w.jsx("span",{className:"text-sm",children:t("error.failedToLoad",{message:a.message})})]}),!i&&!a&&S.length===0&&w.jsx("div",{className:"py-12 text-muted-foreground",children:w.jsx("p",{className:"text-sm",children:u.size>0?t("empty.noMatch"):t("empty.noWorktrees")})}),!i&&w.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:S.map(R=>w.jsx(Xue,{worktree:R,onDelete:A},R.path))})]})]})}function yn(e,t="Assertion error"){if(!e)throw Error(t)}function zd({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function Nk(e,t){return t.sort(e==="horizontal"?Jue:ede)}function Jue(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function ede(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function pF(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function tde({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,s=Number.MAX_VALUE;for(const a of t){const{x:o,y:l}=pF(r,a),u=e==="horizontal"?o:l;u<s&&(s=u,i=a)}return yn(i,"No rect found"),i}function mF(e){const{element:t,orientation:n,panels:r,separators:i}=e,s=Nk(n,Array.from(t.children).filter(h=>h instanceof HTMLElement).map(h=>({element:h}))).map(({element:h})=>h),a=[];let o=!1,l,u=[];for(const h of s)if(h.hasAttribute("data-panel")){const d=r.find(p=>p.element===h);if(d){if(l){const p=l.element.getBoundingClientRect(),v=h.getBoundingClientRect();let x;if(o){const b=n==="horizontal"?new DOMRect(p.right,p.top,0,p.height):new DOMRect(p.left,p.bottom,p.width,0),g=n==="horizontal"?new DOMRect(v.left,v.top,0,v.height):new DOMRect(v.left,v.top,v.width,0);switch(u.length){case 0:{x=[b,g];break}case 1:{const _=u[0],y=tde({orientation:n,rects:[p,v],targetRect:_.element.getBoundingClientRect()});x=[_,y===p?g:b];break}default:{x=u;break}}}else u.length?x=u:x=[n==="horizontal"?new DOMRect(p.right,v.top,v.left-p.right,v.height):new DOMRect(v.left,p.bottom,v.width,v.top-p.bottom)];for(const b of x)a.push({group:e,groupSize:zd({group:e}),panels:[l,d],separator:"width"in b?void 0:b,rect:"width"in b?b:b.element.getBoundingClientRect()})}o=!1,l=d,u=[]}}else if(h.hasAttribute("data-separator")){const d=i.find(p=>p.element===h);d?u.push(d):(l=void 0,u=[])}else o=!0;return a}function nde(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function rde(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function ide(e){return e/100*window.innerHeight}function sde(e){return e/100*window.innerWidth}function ode(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function Wv({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,s]=ode(n);switch(s){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=rde(t,i);break}case"em":{r=nde(t,i);break}case"vh":{r=ide(i);break}case"vw":{r=sde(i);break}}return r}function Gs(e){return parseFloat(e.toFixed(3))}function rI(e){const{panels:t}=e,n=zd({group:e});return n===0?t.map(r=>({collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:i,panelConstraints:s}=r;let a=0;if(s.collapsedSize){const h=Wv({groupSize:n,panelElement:i,styleProp:s.collapsedSize});a=Gs(h/n*100)}let o;if(s.defaultSize){const h=Wv({groupSize:n,panelElement:i,styleProp:s.defaultSize});o=Gs(h/n*100)}let l=0;if(s.minSize){const h=Wv({groupSize:n,panelElement:i,styleProp:s.minSize});l=Gs(h/n*100)}let u=100;if(s.maxSize){const h=Wv({groupSize:n,panelElement:i,styleProp:s.maxSize});u=Gs(h/n*100)}return{collapsedSize:a,collapsible:s.collapsible===!0,defaultSize:o,minSize:l,maxSize:u,panelId:r.id}})}class ade{#e={};addListener(t,n){const r=this.#e[t];return r===void 0?this.#e[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=this.#e[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let i=!1,s=null;const a=Array.from(r);for(let o=0;o<a.length;o++){const l=a[o];try{l.call(null,n)}catch(u){s===null&&(i=!0,s=u)}}if(i)throw s}}removeAllListeners(){this.#e={}}removeListener(t,n){const r=this.#e[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}function ai(e,t,n=0){return Math.abs(Gs(e)-Gs(t))<=n}let ms={cursorFlags:0,interactionState:{state:"inactive"},mountedGroups:new Map};const qc=new ade;function Io(){return ms}function ks(e){const t=typeof e=="function"?e(ms):e;if(ms===t)return ms;const n=ms;return ms={...ms,...t},t.cursorFlags!==void 0&&qc.emit("cursorFlagsChange",ms.cursorFlags),t.interactionState!==void 0&&qc.emit("interactionStateChange",ms.interactionState),t.mountedGroups!==void 0&&(ms.mountedGroups.forEach((r,i)=>{r.derivedPanelConstraints.forEach(s=>{if(s.collapsible){const{layout:a}=n.mountedGroups.get(i)??{};if(a){const o=ai(s.collapsedSize,r.layout[s.panelId]),l=ai(s.collapsedSize,a[s.panelId]);o&&!l&&(i.inMemoryLastExpandedPanelSizes[s.panelId]=a[s.panelId])}}})}),qc.emit("mountedGroupsChange",ms.mountedGroups)),ms}const lde=e=>e,kS=()=>{},gF=1,vF=2,yF=4,bF=8,iI={coarse:10,precise:5};function cde({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.disableCursor)switch(s.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(r===0&&i===0)return null;switch(n){case"active":{const s=(e&gF)!==0,a=(e&vF)!==0,o=(e&yF)!==0,l=(e&bF)!==0;if(e){if(s)return o?"se-resize":l?"ne-resize":"e-resize";if(a)return o?"sw-resize":l?"nw-resize":"w-resize";if(o)return"s-resize";if(l)return"n-resize"}break}}return r>0&&i>0?"move":r>0?"ew-resize":"ns-resize"}let TS,fo;function DR(){fo===void 0&&(fo=new CSSStyleSheet,document.adoptedStyleSheets=[fo]);const{cursorFlags:e,interactionState:t}=Io();switch(t.state){case"active":case"hover":{const n=cde({cursorFlags:e,groups:t.hitRegions.map(i=>i.group),state:t.state}),r=`*{cursor: ${n} !important; ${t.state==="active"?"touch-action: none;":""} }`;if(TS===r)return;TS=r,n?fo.cssRules.length===0?fo.insertRule(r):fo.replaceSync(r):fo.cssRules.length===1&&fo.deleteRule(0);break}case"inactive":{TS=void 0,fo.cssRules.length===1&&fo.deleteRule(0);break}}}function ude(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Ip(e,t){return ai(e,t)?0:e>t?1:-1}function hd({panelConstraints:e,size:t}){const{collapsedSize:n=0,collapsible:r,maxSize:i=100,minSize:s=0}=e;if(Ip(t,s)<0)if(r){const a=(n+s)/2;Ip(t,a)<0?t=n:t=s}else t=s;return t=Math.min(i,t),t=Gs(t),t}function Np({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:s}){if(ai(e,0))return t;const a=Object.values(t),o=Object.values(i),l=[...a],[u,h]=r;yn(u!=null,"Invalid first pivot index"),yn(h!=null,"Invalid second pivot index");let d=0;if(s==="keyboard"){{const x=e<0?h:u,b=n[x];yn(b,`Panel constraints not found for index ${x}`);const{collapsedSize:g=0,collapsible:_,minSize:y=0}=b;if(_){const S=a[x];if(yn(S!=null,`Previous layout not found for panel index ${x}`),ai(S,g)){const k=y-S;Ip(k,Math.abs(e))>0&&(e=e<0?0-k:k)}}}{const x=e<0?u:h,b=n[x];yn(b,`No panel constraints found for index ${x}`);const{collapsedSize:g=0,collapsible:_,minSize:y=0}=b;if(_){const S=a[x];if(yn(S!=null,`Previous layout not found for panel index ${x}`),ai(S,y)){const k=S-g;Ip(k,Math.abs(e))>0&&(e=e<0?0-k:k)}}}}{const x=e<0?1:-1;let b=e<0?h:u,g=0;for(;;){const y=a[b];yn(y!=null,`Previous layout not found for panel index ${b}`);const S=hd({panelConstraints:n[b],size:100})-y;if(g+=S,b+=x,b<0||b>=n.length)break}const _=Math.min(Math.abs(e),Math.abs(g));e=e<0?0-_:_}{let x=e<0?u:h;for(;x>=0&&x<n.length;){const b=Math.abs(e)-Math.abs(d),g=a[x];yn(g!=null,`Previous layout not found for panel index ${x}`);const _=g-b,y=hd({panelConstraints:n[x],size:_});if(!ai(g,y)&&(d+=g-y,l[x]=y,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?x--:x++}}if(ude(o,l))return i;{const x=e<0?h:u,b=a[x];yn(b!=null,`Previous layout not found for panel index ${x}`);const g=b+d,_=hd({panelConstraints:n[x],size:g});if(l[x]=_,!ai(_,g)){let y=g-_,S=e<0?h:u;for(;S>=0&&S<n.length;){const k=l[S];yn(k!=null,`Previous layout not found for panel index ${S}`);const E=k+y,T=hd({panelConstraints:n[S],size:E});if(ai(k,T)||(y-=T-k,l[S]=T),ai(y,0))break;e>0?S--:S++}}}const p=Object.values(l).reduce((x,b)=>b+x,0);if(!ai(p,100,.1))return i;const v=Object.keys(i);return l.reduce((x,b,g)=>(x[v[g]]=b,x),{})}function Df(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Ip(e[n],t[n])!==0)return!1;return!0}function _F({event:e,hitRegions:t,initialLayoutMap:n,mountedGroups:r,pointerDownAtPoint:i}){let s=0;const a=new Map(r);t.forEach(o=>{const{group:l,groupSize:u}=o,{disableCursor:h,orientation:d,panels:p}=l;let v=0;i?d==="horizontal"?v=(e.clientX-i.x)/u*100:v=(e.clientY-i.y)/u*100:d==="horizontal"?v=e.clientX<0?-100:100:v=e.clientY<0?-100:100;const x=n.get(l),{defaultLayoutDeferred:b,derivedPanelConstraints:g,layout:_,separatorToPanels:y}=r.get(l)??{defaultLayoutDeferred:!1};if(g&&x&&_&&y){const S=Np({delta:v,initialLayout:x,panelConstraints:g,pivotIndices:o.panels.map(k=>p.indexOf(k)),prevLayout:_,trigger:"mouse-or-touch"});if(Df(S,_)){if(v!==0&&!h)switch(d){case"horizontal":{s|=v<0?gF:vF;break}case"vertical":{s|=v<0?yF:bF;break}}}else{a.set(o.group,{defaultLayoutDeferred:b,derivedPanelConstraints:g,layout:S,separatorToPanels:y});const k=o.group.panels.map(({id:E})=>E).join(",");o.group.inMemoryLayouts[k]=S}}}),ks({cursorFlags:s,mountedGroups:a}),DR()}function sI(e){if(e.defaultPrevented||e.relatedTarget!==null||e.clientX===0&&e.clientY===0)return;const{interactionState:t,mountedGroups:n}=Io();t.state==="active"&&t.hitRegions.forEach(r=>{e.currentTarget===r.group.element&&_F({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n})})}function Sy(e){const t=e.parentElement;yn(t,"Parent group element not found");const{mountedGroups:n}=Io();for(const[r]of n)if(r.element===t)return r;throw Error("Could not find parent Group for separator element")}function su({layout:e,panelConstraints:t}){const n=[...Object.values(e)],r=n.reduce((a,o)=>a+o,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(a=>`${a}%`).join(", ")}`);if(!ai(r,100)&&n.length>0)for(let a=0;a<t.length;a++){const o=n[a];yn(o!=null,`No layout data found for index ${a}`);const l=100/r*o;n[a]=l}let i=0;for(let a=0;a<t.length;a++){const o=n[a];yn(o!=null,`No layout data found for index ${a}`);const l=hd({panelConstraints:t[a],size:o});o!=l&&(i+=o-l,n[a]=l)}if(!ai(i,0))for(let a=0;a<t.length;a++){const o=n[a];yn(o!=null,`No layout data found for index ${a}`);const l=o+i,u=hd({panelConstraints:t[a],size:l});if(o!==u&&(i-=u-o,n[a]=u,ai(i,0)))break}const s=Object.keys(e);return n.reduce((a,o,l)=>(a[s[l]]=o,a),{})}function xF({groupId:e}){const t=()=>{const{mountedGroups:n}=Io();for(const[r,i]of n)if(r.id===e)return{group:r,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:s,layout:a,separatorToPanels:o}=t(),l=su({layout:n,panelConstraints:i});return r?a:(Df(a,l)||ks(u=>({mountedGroups:new Map(u.mountedGroups).set(s,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:l,separatorToPanels:o})})),l)}}}function SF(e){const{mountedGroups:t}=Io(),n=t.get(e);return yn(n,`Mounted Group ${e.id} not found`),n}function fc(e,t){const n=Sy(e),r=SF(n),i=n.separators.find(h=>h.element===e);yn(i,"Matching separator not found");const s=r.separatorToPanels.get(i);yn(s,"Matching panels not found");const a=s.map(h=>n.panels.indexOf(h)),o=xF({groupId:n.id}).getLayout(),l=Np({delta:t,initialLayout:o,panelConstraints:r.derivedPanelConstraints,pivotIndices:a,prevLayout:o,trigger:"keyboard"}),u=su({layout:l,panelConstraints:r.derivedPanelConstraints});Df(o,u)||ks(h=>({mountedGroups:new Map(h.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:u,separatorToPanels:r.separatorToPanels})}))}function oI(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Sy(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&fc(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&fc(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&fc(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&fc(t,-5);break}case"End":{e.preventDefault(),fc(t,100);break}case"Enter":{e.preventDefault();const r=Sy(t),{derivedPanelConstraints:i,layout:s,separatorToPanels:a}=SF(r),o=r.separators.find(d=>d.element===t);yn(o,"Matching separator not found");const l=a.get(o);yn(l,"Matching panels not found");const u=l[0],h=i.find(d=>d.panelId===u.id);if(yn(h,"Panel metadata not found"),h.collapsible){const d=s[u.id],p=h.collapsedSize===d?r.inMemoryLastExpandedPanelSizes[u.id]??h.minSize:h.collapsedSize;fc(t,p-d)}break}case"F6":{e.preventDefault();const r=Sy(t).separators.map(a=>a.element),i=Array.from(r).findIndex(a=>a===e.currentTarget);yn(i!==null,"Index not found");const s=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[s].focus();break}case"Home":{e.preventDefault(),fc(t,-100);break}}}function dde(e,t,n){let r,i={x:1/0,y:1/0};for(const s of t){const a=pF(n,s.rect);switch(e){case"horizontal":{a.x<=i.x&&(r=s,i=a);break}case"vertical":{a.y<=i.y&&(r=s,i=a);break}}}return r?{distance:i,hitRegion:r}:void 0}let qv;function fde(){return qv===void 0&&(typeof matchMedia=="function"?qv=!!matchMedia("(pointer:coarse)").matches:qv=!1),qv}function hde(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:cI(e),b:cI(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;yn(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:lI(aI(n.a)),b:lI(aI(n.b))};if(i.a===i.b){const s=r.childNodes,a={a:n.a.at(-1),b:n.b.at(-1)};let o=s.length;for(;o--;){const l=s[o];if(l===a.a)return 1;if(l===a.b)return-1}}return Math.sign(i.a-i.b)}const pde=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function mde(e){const t=getComputedStyle(wF(e)??e).display;return t==="flex"||t==="inline-flex"}function gde(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||mde(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||pde.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function aI(e){let t=e.length;for(;t--;){const n=e[t];if(yn(n,"Missing node"),gde(n))return n}return null}function lI(e){return e&&Number(getComputedStyle(e).zIndex)||0}function cI(e){const t=[];for(;e;)t.push(e),e=wF(e);return t}function wF(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}function vde(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function yde({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!(n instanceof HTMLElement)||n.contains(e)||e.contains(n))return!0;if(hde(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(vde(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function CF(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const s=fde()?iI.coarse:iI.precise,a=mF(i),o=dde(i.orientation,a,{x:e.clientX,y:e.clientY});o&&o.distance.x<=s&&o.distance.y<=s&&yde({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function uI(e){if(e.defaultPrevented)return;const{mountedGroups:t}=Io(),n=CF(e,t),r=new Set,i=new Set,s=new Set,a=new Map;let o=!1;n.forEach(l=>{r.add(l.group),l.panels.forEach(h=>{i.add(h)}),l.separator&&(s.add(l.separator),o||(o=!0,l.separator.element.focus()));const u=t.get(l.group);u&&a.set(l.group,u.layout)}),ks({interactionState:{hitRegions:n,initialLayoutMap:a,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}}),n.length&&e.preventDefault()}function dI(e){if(e.defaultPrevented)return;const{interactionState:t,mountedGroups:n}=Io();switch(t.state){case"active":{if(e.type!=="pointerleave"&&e.buttons===0){ks(r=>r.interactionState.state==="inactive"?r:{cursorFlags:0,interactionState:{state:"inactive"}});return}_F({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint});break}default:{const r=CF(e,n);r.length===0?t.state!=="inactive"&&ks({interactionState:{state:"inactive"}}):ks({interactionState:{hitRegions:r,state:"hover"}}),DR();break}}}function fI(e){if(e.defaultPrevented)return;e.preventDefault();const{interactionState:t}=Io();t.state==="active"&&(ks({cursorFlags:0,interactionState:{state:"inactive"}}),DR())}function hI(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const a=Gs(s.defaultSize);n+=a,r[s.panelId]=a}else r[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=Gs((100-n)/i);for(const a of e)a.defaultSize===void 0&&(r[a.panelId]=s)}return r}function bde(e,t,n){const r=n[0];if(!r)return;const i=e.panels.find(a=>a.element===t);if(!i||!i.onResize)return;const s=zd({group:e});i.onResize({asPercentage:Gs(r.inlineSize/s*100),inPixels:r.inlineSize},i.id)}function _de(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function xde(e){let t=!0;const n=new Set,r=new Set,i=new ResizeObserver(v=>{for(const x of v){const{borderBoxSize:b,target:g}=x;if(g===e.element){if(t){if(zd({group:e})===0)return;ks(_=>{const y=_.mountedGroups.get(e);if(y){const S=rI(e),k=y.defaultLayoutDeferred?hI(S):y.layout,E=su({layout:k,panelConstraints:S});return!y.defaultLayoutDeferred&&Df(k,E)&&_de(y.derivedPanelConstraints,S)?_:{mountedGroups:new Map(_.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,layout:E,separatorToPanels:y.separatorToPanels})}}return _})}}else bde(e,g,b)}});i.observe(e.element),e.panels.forEach(v=>{yn(!n.has(v.id),`Panel ids must be unique; id "${v.id}" was used more than once`),n.add(v.id),v.onResize&&i.observe(v.element)});const s=zd({group:e}),a=rI(e),o=e.panels.map(({id:v})=>v).join(",");let l=e.defaultLayout;l&&e.panels.length!==Object.keys(l).length&&(l=void 0);const u=e.inMemoryLayouts[o]??l??hI(a),h=su({layout:u,panelConstraints:a}),d=mF(e),p=ks(v=>{const x=new Map;return d.forEach(b=>{b.separator&&x.set(b.separator,b.panels)}),{mountedGroups:new Map(v.mountedGroups).set(e,{defaultLayoutDeferred:s===0,derivedPanelConstraints:a,layout:h,separatorToPanels:x})}});return e.element.addEventListener("pointerleave",sI),e.separators.forEach(v=>{yn(!r.has(v.id),`Separator ids must be unique; id "${v.id}" was used more than once`),r.add(v.id),v.element.addEventListener("keydown",oI)}),p.mountedGroups.size===1&&(window.addEventListener("pointerdown",uI),window.addEventListener("pointermove",dI),window.addEventListener("pointerup",fI)),function(){t=!1;const v=ks(x=>{const b=new Map(x.mountedGroups);return b.delete(e),{mountedGroups:b}});e.element.removeEventListener("pointerleave",sI),e.separators.forEach(x=>{x.element.removeEventListener("keydown",oI)}),v.mountedGroups.size===0&&(window.removeEventListener("pointerdown",uI),window.removeEventListener("pointermove",dI),window.removeEventListener("pointerup",fI)),i.disconnect()}}function IR(e){const t=O.useId();return`${e??t}`}const vu=typeof window<"u"?O.useLayoutEffect:O.useEffect;function NR(e){const t=O.useRef(e);return vu(()=>{t.current=e},[e]),O.useCallback(n=>t.current?.(n),[t])}function BR(...e){return NR(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Sde(e){const t=O.useRef({...e});return vu(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const EF="--react-resizable-panels--panel--pointer-events";function kF(e,t){const n=e.replace(/[^a-zA-Z0-9\-_]/g,""),r=t.replace(/[^a-zA-Z0-9\-_]/g,"");return`--react-resizable-panels--${n}--${r}`}const TF=O.createContext(null);function wde(e,t){const n=O.useRef({getLayout:()=>({}),setLayout:lde});O.useImperativeHandle(t,()=>n.current,[]),vu(()=>{Object.assign(n.current,xF({groupId:e}))})}function Cde({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:s,groupRef:a,id:o,onLayoutChange:l,orientation:u="horizontal",style:h,...d}){const p=O.useRef({}),v=NR(U=>{Df(p.current,U)||(p.current=U,l?.(U))}),x=IR(o),[b,g]=O.useState(!1),[_,y]=O.useState(null),[S,k]=O.useState(n??{}),[E,T]=O.useState([]),[A,R]=O.useState([]),M=O.useRef({lastExpandedPanelSizes:{},layouts:{}}),B=BR(y,s);wde(x,a);const D=O.useMemo(()=>({id:x,orientation:u,registerPanel:U=>(T(H=>Nk(u,[...H,U])),()=>{T(H=>H.filter(V=>V!==U))}),registerSeparator:U=>(R(H=>Nk(u,[...H,U])),()=>{R(H=>H.filter(V=>V!==U))})}),[x,u]),z=Sde({defaultLayout:n,disableCursor:r}),I=O.useRef(null);vu(()=>{if(_===null)return;const U={defaultLayout:z.defaultLayout,disableCursor:!!z.disableCursor,disabled:!!i,element:_,id:x,inMemoryLastExpandedPanelSizes:M.current.lastExpandedPanelSizes,inMemoryLayouts:M.current.layouts,orientation:u,panels:E,separators:A};I.current=U;const H=xde(U),V=Io().mountedGroups.get(U);if(V){const{defaultLayoutDeferred:G,derivedPanelConstraints:L,layout:$}=V;!G&&L.length>0&&(k($),v?.($))}const q=qc.addListener("interactionStateChange",G=>{G.state==="active"?g(G.hitRegions.some(L=>L.group===U)):g(!1)}),N=qc.addListener("mountedGroupsChange",G=>{const L=G.get(U);if(L){const{defaultLayoutDeferred:$,derivedPanelConstraints:F,layout:Q}=L;if($||F.length===0)return;k(Q),v?.(Q)}});return()=>{I.current=null,H(),q(),N()}},[i,_,x,v,u,E,A,z]),O.useEffect(()=>{const U=I.current;U&&(U.defaultLayout=n,U.disableCursor=!!r)});const W={[EF]:b?"none":void 0};for(const U in S){const H=kF(x,U),V=S[U];W[H]=V}return w.jsx(TF.Provider,{value:D,children:w.jsx("div",{...d,"aria-orientation":u,className:t,"data-group":!0,"data-testid":x,id:x,ref:B,style:{...h,...W,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap"},children:e})})}function $R(){const e=O.useContext(TF);return yn(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Ede({groupId:e,panelId:t}){const n=()=>{const{mountedGroups:o}=Io();for(const[l,{defaultLayoutDeferred:u,derivedPanelConstraints:h,layout:d,separatorToPanels:p}]of o)if(l.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:l,layout:d,separatorToPanels:p};throw Error(`Group ${e} not found`)},r=()=>{const o=n().derivedPanelConstraints.find(l=>l.panelId===t);if(o!==void 0)return o;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const o=n().group.panels.find(l=>l.id===t);if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const o=n().layout[t];if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},a=o=>{const l=s();if(o===l)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:d,layout:p,separatorToPanels:v}=n(),x=d.panels.findIndex(y=>y.id===t),b=x===d.panels.length-1,g=Np({delta:b?l-o:o-l,initialLayout:p,panelConstraints:h,pivotIndices:b?[x-1,x]:[x,x+1],prevLayout:p,trigger:"imperative-api"}),_=su({layout:g,panelConstraints:h});Df(p,_)||ks(y=>({mountedGroups:new Map(y.mountedGroups).set(d,{defaultLayoutDeferred:u,derivedPanelConstraints:h,layout:_,separatorToPanels:v})}))};return{collapse:()=>{const{collapsible:o,collapsedSize:l}=r(),u=s();o&&u!==l&&a(l)},expand:()=>{const{collapsible:o,collapsedSize:l,minSize:u}=r(),h=s();o&&h===l&&a(u)},getSize:()=>{const{group:o}=n(),l=s(),{element:u}=i(),h=o.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:l,inPixels:h}},isCollapsed:()=>{const{collapsible:o,collapsedSize:l}=r(),u=s();return o&&ai(l,u)},resize:o=>{if(s()!==o){let l;switch(typeof o){case"number":{const{group:u}=n(),h=zd({group:u});l=Gs(o/h*100);break}case"string":{l=parseFloat(o);break}}a(l)}}}}function kde(e,t){const{id:n}=$R(),r=O.useRef({collapse:kS,expand:kS,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:kS});O.useImperativeHandle(t,()=>r.current,[]),vu(()=>{Object.assign(r.current,Ede({groupId:n,panelId:e}))})}function Tde({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,elementRef:s,id:a,maxSize:o="100%",minSize:l="0%",onResize:u,panelRef:h,style:d,...p}){const v=!!a,x=IR(a),[b,g]=O.useState(null),_=BR(g,s),{id:y,registerPanel:S}=$R(),k=u!==null,E=NR(A=>{u?.(A,a)});vu(()=>{if(b!==null)return S({element:b,id:x,idIsStable:v,onResize:k?E:void 0,panelConstraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:o,minSize:l}})},[n,r,i,b,k,x,v,o,l,E,S]),kde(x,h);const T=kF(y,x);return w.jsx("div",{...p,"data-panel":!0,"data-testid":x,id:x,ref:_,style:{...Ode,flexBasis:0,flexGrow:`var(${T}, 1)`,flexShrink:1,overflow:"hidden",pointerEvents:`var(${EF})`},children:w.jsx("div",{className:t,style:{width:"100%",height:"100%",...d},children:e})})}const Ode={minHeight:"unset",maxHeight:"unset",height:"unset",minWidth:"unset",maxWidth:"unset",width:"unset",flex:"unset",flexBasis:"unset",flexShrink:"unset",flexGrow:"unset",border:"unset",borderWidth:"unset",padding:"unset",margin:"unset"};function Rde({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,s;const a=e[n],o=t.find(l=>l.panelId===n);if(o){const l=o.maxSize,u=s=o.collapsible?o.collapsedSize:o.minSize,h=[r,r+1];s=su({layout:Np({delta:u-a,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n],i=su({layout:Np({delta:l-a,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:a}}function Ade({children:e,className:t,elementRef:n,id:r,style:i,...s}){const a=IR(r),[o,l]=O.useState({}),[u,h]=O.useState("inactive"),[d,p]=O.useState(null),v=BR(p,n),{id:x,orientation:b,registerSeparator:g}=$R(),_=b==="horizontal"?"vertical":"horizontal";return vu(()=>{if(d!==null){const y={element:d,id:a},S=g(y),k=qc.addListener("interactionStateChange",T=>{h(T.state!=="inactive"&&T.hitRegions.some(A=>A.separator===y)?T.state:"inactive")}),E=qc.addListener("mountedGroupsChange",T=>{T.forEach(({derivedPanelConstraints:A,layout:R,separatorToPanels:M},B)=>{if(B.id===x){const D=M.get(y);if(D){const z=D[0],I=B.panels.indexOf(z);l(Rde({layout:R,panelConstraints:A,panelId:z.id,panelIndex:I}))}}})});return()=>{k(),E(),S()}}},[d,x,a,g]),w.jsx("div",{...s,"aria-controls":o.valueControls,"aria-orientation":_,"aria-valuemax":o.valueMax,"aria-valuemin":o.valueMin,"aria-valuenow":o.valueNow,children:e,className:t,"data-separator":u,"data-testid":a,id:a,ref:v,role:"separator",style:{flexBasis:"auto",...i,flexGrow:0,flexShrink:0},tabIndex:0})}function wc({className:e,direction:t,...n}){return w.jsx(Cde,{"data-slot":"resizable-panel-group",orientation:t,className:Ne("flex h-full w-full data-[orientation=vertical]:flex-col",e),...n})}function ys({...e}){return w.jsx(Tde,{"data-slot":"resizable-panel",...e})}function Cc({withHandle:e,className:t,...n}){return w.jsx(Ade,{"data-slot":"resizable-handle",className:Ne("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[orientation=vertical]:h-px data-[orientation=vertical]:w-full data-[orientation=vertical]:after:left-0 data-[orientation=vertical]:after:h-1 data-[orientation=vertical]:after:w-full data-[orientation=vertical]:after:translate-x-0 data-[orientation=vertical]:after:-translate-y-1/2 [&[data-orientation=vertical]>div]:rotate-90",t),...n,children:e&&w.jsx("div",{className:"bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"})})}var OS={exports:{}},pI;function Pde(){return pI||(pI=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(a,o,l){var u=this&&this.__decorate||function(y,S,k,E){var T,A=arguments.length,R=A<3?S:E===null?E=Object.getOwnPropertyDescriptor(S,k):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(y,S,k,E);else for(var M=y.length-1;M>=0;M--)(T=y[M])&&(R=(A<3?T(R):A>3?T(S,k,R):T(S,k))||R);return A>3&&R&&Object.defineProperty(S,k,R),R},h=this&&this.__param||function(y,S){return function(k,E){S(k,E,y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=l(9042),p=l(9924),v=l(844),x=l(4725),b=l(2585),g=l(3656);let _=o.AccessibilityManager=class extends v.Disposable{constructor(y,S,k,E){super(),this._terminal=y,this._coreBrowserService=k,this._renderService=E,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let T=0;T<this._terminal.rows;T++)this._rowElements[T]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[T]);if(this._topBoundaryFocusListener=T=>this._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
27
27
|
`)))),this.register(this._terminal.onA11yTab((T=>this._handleTab(T)))),this.register(this._terminal.onKey((T=>this._handleKey(T.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,g.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(y){for(let S=0;S<y;S++)this._handleChar(" ")}_handleChar(y){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==y&&(this._charsToAnnounce+=y):this._charsToAnnounce+=y,y===`
|
|
28
28
|
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(y){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(y)||this._charsToConsume.push(y)}_refreshRows(y,S){this._liveRegionDebouncer.refresh(y,S,this._terminal.rows)}_renderRows(y,S){const k=this._terminal.buffer,E=k.lines.length.toString();for(let T=y;T<=S;T++){const A=k.lines.get(k.ydisp+T),R=[],M=A?.translateToString(!0,void 0,void 0,R)||"",B=(k.ydisp+T+1).toString(),D=this._rowElements[T];D&&(M.length===0?(D.innerText=" ",this._rowColumns.set(D,[0,1])):(D.textContent=M,this._rowColumns.set(D,R)),D.setAttribute("aria-posinset",B),D.setAttribute("aria-setsize",E))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(y,S){const k=y.target,E=this._rowElements[S===0?1:this._rowElements.length-2];if(k.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||y.relatedTarget!==E)return;let T,A;if(S===0?(T=k,A=this._rowElements.pop(),this._rowContainer.removeChild(A)):(T=this._rowElements.shift(),A=k,this._rowContainer.removeChild(T)),T.removeEventListener("focus",this._topBoundaryFocusListener),A.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const R=this._createAccessibilityTreeNode();this._rowElements.unshift(R),this._rowContainer.insertAdjacentElement("afterbegin",R)}else{const R=this._createAccessibilityTreeNode();this._rowElements.push(R),this._rowContainer.appendChild(R)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),y.preventDefault(),y.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const y=document.getSelection();if(!y)return;if(y.isCollapsed)return void(this._rowContainer.contains(y.anchorNode)&&this._terminal.clearSelection());if(!y.anchorNode||!y.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:y.anchorNode,offset:y.anchorOffset},k={node:y.focusNode,offset:y.focusOffset};if((S.node.compareDocumentPosition(k.node)&Node.DOCUMENT_POSITION_PRECEDING||S.node===k.node&&S.offset>k.offset)&&([S,k]=[k,S]),S.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(S={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(S.node))return;const E=this._rowElements.slice(-1)[0];if(k.node.compareDocumentPosition(E)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(k={node:E,offset:E.textContent?.length??0}),!this._rowContainer.contains(k.node))return;const T=({node:M,offset:B})=>{const D=M instanceof Text?M.parentNode:M;let z=parseInt(D?.getAttribute("aria-posinset"),10)-1;if(isNaN(z))return console.warn("row is invalid. Race condition?"),null;const I=this._rowColumns.get(D);if(!I)return console.warn("columns is null. Race condition?"),null;let W=B<I.length?I[B]:I.slice(-1)[0]+1;return W>=this._terminal.cols&&(++z,W=0),{row:z,column:W}},A=T(S),R=T(k);if(A&&R){if(A.row>R.row||A.row===R.row&&A.column>=R.column)throw new Error("invalid range");this._terminal.select(A.column,A.row,(R.row-A.row)*this._terminal.cols-A.column+R.column)}}_handleResize(y){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;S<this._terminal.rows;S++)this._rowElements[S]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[S]);for(;this._rowElements.length>y;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const y=this._coreBrowserService.mainDocument.createElement("div");return y.setAttribute("role","listitem"),y.tabIndex=-1,this._refreshRowDimensions(y),y}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let y=0;y<this._terminal.rows;y++)this._refreshRowDimensions(this._rowElements[y])}}_refreshRowDimensions(y){y.style.height=`${this._renderService.dimensions.css.cell.height}px`}};o.AccessibilityManager=_=u([h(1,b.IInstantiationService),h(2,x.ICoreBrowserService),h(3,x.IRenderService)],_)},3614:(a,o)=>{function l(p){return p.replace(/\r?\n/g,"\r")}function u(p,v){return v?"\x1B[200~"+p+"\x1B[201~":p}function h(p,v,x,b){p=u(p=l(p),x.decPrivateModes.bracketedPasteMode&&b.rawOptions.ignoreBracketedPasteMode!==!0),x.triggerDataEvent(p,!0),v.value=""}function d(p,v,x){const b=x.getBoundingClientRect(),g=p.clientX-b.left-10,_=p.clientY-b.top-10;v.style.width="20px",v.style.height="20px",v.style.left=`${g}px`,v.style.top=`${_}px`,v.style.zIndex="1000",v.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=l,o.bracketTextForPaste=u,o.copyHandler=function(p,v){p.clipboardData&&p.clipboardData.setData("text/plain",v.selectionText),p.preventDefault()},o.handlePasteEvent=function(p,v,x,b){p.stopPropagation(),p.clipboardData&&h(p.clipboardData.getData("text/plain"),v,x,b)},o.paste=h,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(p,v,x,b,g){d(p,v,x),g&&b.rightClickSelect(p),v.value=b.selectionText,v.select()}},7239:(a,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const u=l(1505);o.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(h,d,p){this._css.set(h,d,p)}getCss(h,d){return this._css.get(h,d)}setColor(h,d,p){this._color.set(h,d,p)}getColor(h,d){return this._color.get(h,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(l,u,h,d){l.addEventListener(u,h,d);let p=!1;return{dispose:()=>{p||(p=!0,l.removeEventListener(u,h,d))}}}},3551:function(a,o,l){var u=this&&this.__decorate||function(_,y,S,k){var E,T=arguments.length,A=T<3?y:k===null?k=Object.getOwnPropertyDescriptor(y,S):k;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,y,S,k);else for(var R=_.length-1;R>=0;R--)(E=_[R])&&(A=(T<3?E(A):T>3?E(y,S,A):E(y,S))||A);return T>3&&A&&Object.defineProperty(y,S,A),A},h=this&&this.__param||function(_,y){return function(S,k){y(S,k,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=l(3656),p=l(8460),v=l(844),x=l(2585),b=l(4725);let g=o.Linkifier=class extends v.Disposable{get currentLink(){return this._currentLink}constructor(_,y,S,k,E){super(),this._element=_,this._mouseService=y,this._renderService=S,this._bufferService=k,this._linkProviderService=E,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,v.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,v.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(_){this._lastMouseEvent=_;const y=this._positionFromMouseEvent(_,this._element,this._mouseService);if(!y)return;this._isMouseOut=!1;const S=_.composedPath();for(let k=0;k<S.length;k++){const E=S[k];if(E.classList.contains("xterm"))break;if(E.classList.contains("xterm-hover"))return}this._lastBufferCell&&y.x===this._lastBufferCell.x&&y.y===this._lastBufferCell.y||(this._handleHover(y),this._lastBufferCell=y)}_handleHover(_){if(this._activeLine!==_.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(_,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,_)||(this._clearCurrentLink(),this._askForLink(_,!0))}_askForLink(_,y){this._activeProviderReplies&&y||(this._activeProviderReplies?.forEach((k=>{k?.forEach((E=>{E.link.dispose&&E.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=_.y);let S=!1;for(const[k,E]of this._linkProviderService.linkProviders.entries())y?this._activeProviderReplies?.get(k)&&(S=this._checkLinkProviderResult(k,_,S)):E.provideLinks(_.y,(T=>{if(this._isMouseOut)return;const A=T?.map((R=>({link:R})));this._activeProviderReplies?.set(k,A),S=this._checkLinkProviderResult(k,_,S),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(_.y,this._activeProviderReplies)}))}_removeIntersectingLinks(_,y){const S=new Set;for(let k=0;k<y.size;k++){const E=y.get(k);if(E)for(let T=0;T<E.length;T++){const A=E[T],R=A.link.range.start.y<_?0:A.link.range.start.x,M=A.link.range.end.y>_?this._bufferService.cols:A.link.range.end.x;for(let B=R;B<=M;B++){if(S.has(B)){E.splice(T--,1);break}S.add(B)}}}}_checkLinkProviderResult(_,y,S){if(!this._activeProviderReplies)return S;const k=this._activeProviderReplies.get(_);let E=!1;for(let T=0;T<_;T++)this._activeProviderReplies.has(T)&&!this._activeProviderReplies.get(T)||(E=!0);if(!E&&k){const T=k.find((A=>this._linkAtPosition(A.link,y)));T&&(S=!0,this._handleNewLink(T))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let T=0;T<this._activeProviderReplies.size;T++){const A=this._activeProviderReplies.get(T)?.find((R=>this._linkAtPosition(R.link,y)));if(A){S=!0,this._handleNewLink(A);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(_){if(!this._currentLink)return;const y=this._positionFromMouseEvent(_,this._element,this._mouseService);y&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,y)&&this._currentLink.link.activate(_,this._currentLink.link.text)}_clearCurrentLink(_,y){this._currentLink&&this._lastMouseEvent&&(!_||!y||this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=y)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,v.disposeArray)(this._linkCacheDisposables))}_handleNewLink(_){if(!this._lastMouseEvent)return;const y=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);y&&this._linkAtPosition(_.link,y)&&(this._currentLink=_,this._currentLink.state={decorations:{underline:_.link.decorations===void 0||_.link.decorations.underline,pointerCursor:_.link.decorations===void 0||_.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,_.link,this._lastMouseEvent),_.link.decorations={},Object.defineProperties(_.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:S=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:S=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(_.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const k=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,E=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=k&&this._currentLink.link.range.end.y<=E&&(this._clearCurrentLink(k,E),this._lastMouseEvent)){const T=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);T&&this._askForLink(T,!1)}}))))}_linkHover(_,y,S){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!0),this._currentLink.state.decorations.pointerCursor&&_.classList.add("xterm-cursor-pointer")),y.hover&&y.hover(S,y.text)}_fireUnderlineEvent(_,y){const S=_.range,k=this._bufferService.buffer.ydisp,E=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-k-1,S.end.x,S.end.y-k-1,void 0);(y?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(E)}_linkLeave(_,y,S){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(y,!1),this._currentLink.state.decorations.pointerCursor&&_.classList.remove("xterm-cursor-pointer")),y.leave&&y.leave(S,y.text)}_linkAtPosition(_,y){const S=_.range.start.y*this._bufferService.cols+_.range.start.x,k=_.range.end.y*this._bufferService.cols+_.range.end.x,E=y.y*this._bufferService.cols+y.x;return S<=E&&E<=k}_positionFromMouseEvent(_,y,S){const k=S.getCoords(_,y,this._bufferService.cols,this._bufferService.rows);if(k)return{x:k[0],y:k[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(_,y,S,k,E){return{x1:_,y1:y,x2:S,y2:k,cols:this._bufferService.cols,fg:E}}};o.Linkifier=g=u([h(1,b.IMouseService),h(2,b.IRenderService),h(3,x.IBufferService),h(4,b.ILinkProviderService)],g)},9042:(a,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(a,o,l){var u=this&&this.__decorate||function(b,g,_,y){var S,k=arguments.length,E=k<3?g:y===null?y=Object.getOwnPropertyDescriptor(g,_):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(b,g,_,y);else for(var T=b.length-1;T>=0;T--)(S=b[T])&&(E=(k<3?S(E):k>3?S(g,_,E):S(g,_))||E);return k>3&&E&&Object.defineProperty(g,_,E),E},h=this&&this.__param||function(b,g){return function(_,y){g(_,y,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=l(511),p=l(2585);let v=o.OscLinkProvider=class{constructor(b,g,_){this._bufferService=b,this._optionsService=g,this._oscLinkService=_}provideLinks(b,g){const _=this._bufferService.buffer.lines.get(b-1);if(!_)return void g(void 0);const y=[],S=this._optionsService.rawOptions.linkHandler,k=new d.CellData,E=_.getTrimmedLength();let T=-1,A=-1,R=!1;for(let M=0;M<E;M++)if(A!==-1||_.hasContent(M)){if(_.loadCell(M,k),k.hasExtendedAttrs()&&k.extended.urlId){if(A===-1){A=M,T=k.extended.urlId;continue}R=k.extended.urlId!==T}else A!==-1&&(R=!0);if(R||A!==-1&&M===E-1){const B=this._oscLinkService.getLinkData(T)?.uri;if(B){const D={start:{x:A+1,y:b},end:{x:M+(R||M!==E-1?0:1),y:b}};let z=!1;if(!S?.allowNonHttpProtocols)try{const I=new URL(B);["http:","https:"].includes(I.protocol)||(z=!0)}catch{z=!0}z||y.push({text:B,range:D,activate:(I,W)=>S?S.activate(I,W,D):x(0,W),hover:(I,W)=>S?.hover?.(I,W,D),leave:(I,W)=>S?.leave?.(I,W,D)})}R=!1,k.hasExtendedAttrs()&&k.extended.urlId?(A=M,T=k.extended.urlId):(A=-1,T=-1)}}g(y)}};function x(b,g){if(confirm(`Do you want to navigate to ${g}?
|
|
29
29
|
|