vibora 3.2.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,7 +22,7 @@ Error generating stack: `+A.message+`
|
|
|
22
22
|
`:"",w=x&&!x.startsWith(`
|
|
23
23
|
`)?`
|
|
24
24
|
`:"",C=b+T+S+w+x;t(C)}else t(e+(e?`
|
|
25
|
-
`:"")+S)}catch(S){dn.error("Failed to upload image"),Gt.kanban.error("Upload error",{error:String(S)})}finally{s(!1)}return}}};return y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"relative",children:[y.jsx(Dx,{ref:o,value:e,onChange:f=>t(f.target.value),onPaste:u,className:We(a&&"opacity-50",n),disabled:a||r,...i}),a&&y.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50 rounded-md",children:y.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})})]}),l.length>0&&y.jsx("div",{className:"flex flex-wrap gap-2",children:l.map((f,d)=>y.jsx("a",{href:P$(f),target:"_blank",rel:"noopener noreferrer",className:"block",children:y.jsx("img",{src:P$(f),alt:`Attachment ${d+1}`,className:"h-16 w-auto rounded border object-cover hover:opacity-80 transition-opacity"})},d))})]})}function tte({className:e,...t}){return y.jsx("label",{"data-slot":"label",className:We("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 C_e=k.forwardRef(function(t,n){const{className:r,render:i,orientation:a="horizontal",...s}=t,o=k.useMemo(()=>({orientation:a}),[a]);return Tt("div",t,{state:o,ref:n,props:[{role:"separator","aria-orientation":a},s]})});function A_e({className:e,orientation:t="horizontal",...n}){return y.jsx(C_e,{"data-slot":"separator",orientation:t,className:We("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 nu({className:e,...t}){return y.jsx("div",{"data-slot":"field-group",className:We("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 k_e=Qc("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 Dn({className:e,orientation:t="vertical",...n}){return y.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:We(k_e({orientation:t}),e),...n})}function Ln({className:e,...t}){return y.jsx(tte,{"data-slot":"field-label",className:We("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 Yi({className:e,...t}){return y.jsx("p",{"data-slot":"field-description",className:We("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 nte(e){const t=k.useRef(!0);t.current&&(t.current=!1,e())}const rte=k.createContext(null),ite=k.createContext(null);function dl(){const e=k.useContext(rte);if(e===null)throw new Error(bn(60));return e}function ate(){const e=k.useContext(ite);if(e===null)throw new Error(bn(61));return e}const ste=(e,t)=>Object.is(e,t);function du(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Gd(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:du(r,t,n))}function Lp(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:du(r,t,n))}function ote(e,t,n){return e.filter(r=>!du(r,t,n))}function $N(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function lte(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Kr(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 $N(e)}function no(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?$N(e.value):$N(e)}function O_e(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]??Kr(e,n);if(Array.isArray(t)){const r=lte(t)?t.flatMap(i=>i.items):t;if(e==null){const i=r.find(a=>a.value==null);return i&&i.label!=null?i.label:Kr(e,n)}if(typeof e!="object"){const i=r.find(a=>a&&a.value===e);return i&&i.label!=null?i.label:Kr(e,n)}if("value"in e){const i=r.find(a=>a&&a.value===e.value);if(i&&i.label!=null)return i.label}}return Kr(e,n)}function R_e(e,t){return!Array.isArray(e)||e.length===0?"":e.map(n=>Kr(n,t)).join(", ")}const Ht={id:Ue(e=>e.id),modal:Ue(e=>e.modal),multiple:Ue(e=>e.multiple),items:Ue(e=>e.items),itemToStringLabel:Ue(e=>e.itemToStringLabel),itemToStringValue:Ue(e=>e.itemToStringValue),isItemEqualToValue:Ue(e=>e.isItemEqualToValue),value:Ue(e=>e.value),open:Ue(e=>e.open),mounted:Ue(e=>e.mounted),forceMount:Ue(e=>e.forceMount),transitionStatus:Ue(e=>e.transitionStatus),openMethod:Ue(e=>e.openMethod),activeIndex:Ue(e=>e.activeIndex),selectedIndex:Ue(e=>e.selectedIndex),isActive:Ue((e,t)=>e.activeIndex===t),isSelected:Ue((e,t,n)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(a=>du(a,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:du(i,n,r)}),isSelectedByFocus:Ue((e,t)=>e.selectedIndex===t),popupProps:Ue(e=>e.popupProps),triggerProps:Ue(e=>e.triggerProps),triggerElement:Ue(e=>e.triggerElement),positionerElement:Ue(e=>e.positionerElement),listElement:Ue(e=>e.listElement),scrollUpArrowVisible:Ue(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Ue(e=>e.scrollDownArrowVisible),hasScrollArrows:Ue(e=>e.hasScrollArrows),serializedValue:Ue(e=>{const{multiple:t,value:n,itemToStringValue:r}=e;return t&&Array.isArray(n)&&n.length===0?"":no(n,r)})};function qd(e,t){const n=k.useRef(e),r=Xe(t);rt(()=>{n.current!==e&&r(n.current)},[e,r]),rt(()=>{n.current=e},[e])}function I_e(e){const{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:s=!1,onOpenChange:o,name:l,disabled:u=!1,readOnly:f=!1,required:d=!1,modal:p=!0,actionsRef:m,inputRef:S,onOpenChangeComplete:E,items:g,multiple:_=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:T=ste,highlightItemOnHover:w=!0,children:C}=e,{clearErrors:R}=Iy(),{setDirty:O,shouldValidateOnChange:I,validityData:D,setFilled:P,name:H,disabled:M,validation:W}=$s(),{controlId:V}=nd(),$=Nx({id:t}),q=M||u,K=H??l,[U,F]=ns({controlled:n,default:_?r??Zi:r,name:"Select",state:"value"}),[B,Y]=ns({controlled:a,default:s,name:"Select",state:"open"}),z=k.useRef([]),J=k.useRef([]),ee=k.useRef(null),te=k.useRef(null),Z=k.useRef(0),G=k.useRef(null),Q=k.useRef([]),ae=k.useRef(!1),se=k.useRef(!1),ne=k.useRef(null),ye=k.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),Ee=k.useRef(!1),{mounted:he,setMounted:_e,transitionStatus:be}=vo(B),{openMethod:Ke,triggerProps:Se,reset:$e}=Ix(B),Te=Ei(()=>new sf({id:$,modal:p,multiple:_,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:T,value:U,open:B,mounted:he,transitionStatus:be,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,we=qe(Te,Ht.activeIndex),le=qe(Te,Ht.selectedIndex),me=qe(Te,Ht.triggerElement),Ne=qe(Te,Ht.positionerElement),pe=k.useMemo(()=>_&&Array.isArray(U)&&U.length===0?"":no(U,x),[_,U,x]),De=k.useMemo(()=>_&&Array.isArray(U)?U.map(yt=>no(yt,x)):no(U,x),[_,U,x]),Ce=ar(Te.state.triggerElement);Ny({id:$,commit:W.commit,value:U,controlRef:Ce,name:K,getValue:()=>De});const ze=k.useRef(U);rt(()=>{U!==ze.current&&Te.set("forceMount",!0)},[Te,U]),rt(()=>{P(U!==null)},[U,P]),rt(function(){if(B)return;const Bt=Q.current;if(_){const Ut=Array.isArray(U)?U:[];if(Ut.length===0){Te.set("selectedIndex",null);return}const pt=Ut[Ut.length-1],ln=Lp(Bt,pt,T);Te.set("selectedIndex",ln===-1?null:ln);return}const jt=Lp(Bt,U,T);Te.set("selectedIndex",jt===-1?null:jt)},[_,B,U,Q,T,Te]),qd(U,()=>{R(K),O(U!==D.initialValue),I()?W.commit(U):W.commit(U,!0)});const Ze=Xe((yt,Bt)=>{if(o?.(yt,Bt),!Bt.isCanceled&&(Y(yt),!yt&&Te.state.activeIndex!==null)){const jt=z.current[Te.state.activeIndex];queueMicrotask(()=>{jt?.setAttribute("tabindex","-1")})}}),gt=Xe(()=>{_e(!1),Te.set("activeIndex",null),$e(),E?.(!1)});ji({enabled:!m,open:B,ref:ee,onComplete(){B||gt()}}),k.useImperativeHandle(m,()=>({unmount:gt}),[gt]);const it=Xe((yt,Bt)=>{i?.(yt,Bt),!Bt.isCanceled&&F(yt)}),ot=Xe(()=>{const yt=Te.state.listElement||ee.current;if(!yt)return;const Bt=yt.scrollTop,jt=yt.scrollTop+yt.clientHeight,Ut=Bt>1,pt=jt<yt.scrollHeight-1;Te.state.scrollUpArrowVisible!==Ut&&Te.set("scrollUpArrowVisible",Ut),Te.state.scrollDownArrowVisible!==pt&&Te.set("scrollDownArrowVisible",pt)}),Me=yx({open:B,onOpenChange:Ze,elements:{reference:me,floating:Ne}}),ft=Tm(Me,{enabled:!f&&!q,event:"mousedown"}),Oe=xy(Me,{bubbles:!1}),Fe=FP(Me,{enabled:!f&&!q,listRef:z,activeIndex:we,selectedIndex:le,disabledIndices:Zi,onNavigate(yt){yt===null&&!B||Te.set("activeIndex",yt)},focusItemOnHover:!1}),Je=BP(Me,{enabled:!f&&!q&&(B||!_),listRef:J,activeIndex:we,selectedIndex:le,onMatch(yt){B?Te.set("activeIndex",yt):it(Q.current[yt],st("none"))},onTypingChange(yt){ae.current=yt}}),{getReferenceProps:lt,getFloatingProps:ht,getItemProps:vn}=Ff([ft,Oe,Fe,Je]),Dt=k.useMemo(()=>tl(lt(),Se),[lt,Se]);nte(()=>{Te.update({popupProps:ht(),triggerProps:Dt})}),rt(()=>{Te.update({id:$,modal:p,multiple:_,value:U,open:B,mounted:he,transitionStatus:be,popupProps:ht(),triggerProps:Dt,items:g,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:T,openMethod:Ke})},[Te,$,p,_,U,B,he,be,ht,Dt,g,b,x,T,Ke]);const Ot=k.useMemo(()=>({store:Te,name:K,required:d,disabled:q,readOnly:f,multiple:_,itemToStringLabel:b,itemToStringValue:x,highlightItemOnHover:w,setValue:it,setOpen:Ze,listRef:z,popupRef:ee,scrollHandlerRef:te,handleScrollArrowVisibility:ot,scrollArrowsMountedCountRef:Z,getItemProps:vn,events:Me.context.events,valueRef:G,valuesRef:Q,labelsRef:J,typingRef:ae,selectionRef:ye,selectedItemTextRef:ne,validation:W,onOpenChangeComplete:E,keyboardActiveRef:se,alignItemWithTriggerActiveRef:Ee,initialValueRef:ze}),[Te,K,d,q,f,_,b,x,w,it,Ze,vn,Me.context.events,W,E,ot]),ct=Us(S,W.inputRef),en=_&&Array.isArray(U)&&U.length>0,Lt=k.useMemo(()=>!_||!Array.isArray(U)||!K?null:U.map(yt=>{const Bt=no(yt,x);return y.jsx("input",{type:"hidden",name:K,value:Bt},Bt)}),[_,U,K,x]);return y.jsx(rte.Provider,{value:Ot,children:y.jsxs(ite.Provider,{value:Me,children:[C,y.jsx("input",{...W.getInputValidationProps({onFocus(){Te.state.triggerElement?.focus()},onChange(yt){if(yt.nativeEvent.defaultPrevented)return;const Bt=yt.target.value,jt=st(Yr,yt.nativeEvent);function Ut(){if(_)return;const pt=Q.current.find(ln=>no(ln,x).toLowerCase()===Bt.toLowerCase());pt!=null&&(O(pt!==D.initialValue),it(pt,jt),I()&&W.commit(pt))}Te.set("forceMount",!0),queueMicrotask(Ut)}}),id:t||V||void 0,name:_?void 0:K,value:pe,disabled:q,required:d&&!en,readOnly:f,ref:ct,style:wm,tabIndex:-1,"aria-hidden":!0}),Lt]})})}function QP(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 a=parseFloat(n.width)||0,s=parseFloat(n.height)||0,o=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=Math.max(t.width,a,o),f=Math.max(t.height,s,l),d=u-t.width,p=f-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const J1=2,N_e={...Np,...$f,value:()=>null},D_e=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,...o}=t,{setTouched:l,setFocused:u,validationMode:f,state:d,disabled:p}=$s(),{labelId:m}=nd(),{store:S,setOpen:E,selectionRef:g,validation:_,readOnly:b,alignItemWithTriggerActiveRef:x,disabled:T,keyboardActiveRef:w}=dl(),C=p||T||a,R=qe(S,Ht.open),O=qe(S,Ht.value),I=qe(S,Ht.triggerProps),D=qe(S,Ht.positionerElement),P=qe(S,Ht.listElement),H=qe(S,Ht.serializedValue),M=ar(D),W=k.useRef(null),V=Bn(),$=Bn(),{getButtonProps:q,buttonRef:K}=oa({disabled:C,native:s}),U=Xe(te=>{S.set("triggerElement",te)}),F=Us(n,W,K,U),B=Bn(),Y=Bn();k.useEffect(()=>{if(R)return Y.start(200,()=>{g.current.allowUnselectedMouseUp=!0,B.start(200,()=>{g.current.allowSelectedMouseUp=!0})}),()=>{B.clear(),Y.clear()};g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},$.clear()},[R,g,$,B,Y]);const z=k.useMemo(()=>P?.id??lv(D)?.id,[P,D]),J=tl(I,{role:"combobox","aria-expanded":R?"true":"false","aria-haspopup":"listbox","aria-controls":R?z:void 0,"aria-labelledby":m,"aria-readonly":b||void 0,tabIndex:C?-1:0,ref:F,onFocus(te){u(!0),R&&x.current&&E(!1,st(ho,te.nativeEvent)),V.start(0,()=>{S.set("forceMount",!0)})},onBlur(){l(!0),u(!1),f==="onBlur"&&_.commit(O)},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(te){if(R)return;const Z=Si(te.currentTarget);function G(Q){if(!W.current)return;const ae=Q.target;if(wt(W.current,ae)||wt(M.current,ae)||ae===W.current)return;const se=QP(W.current);Q.clientX>=se.left-J1&&Q.clientX<=se.right+J1&&Q.clientY>=se.top-J1&&Q.clientY<=se.bottom+J1||E(!1,st(zJ,Q))}$.start(0,()=>{Z.addEventListener("mouseup",G,{once:!0})})}},_.getValidationProps,o,q);J.role="combobox";const ee=k.useMemo(()=>({...d,open:R,disabled:C,value:O,readOnly:b,placeholder:!H}),[d,R,C,O,b,H]);return Tt("button",t,{ref:[n,W],state:ee,stateAttributesMapping:N_e,props:J})}),L_e={value:()=>null},P_e=k.forwardRef(function(t,n){const{className:r,render:i,children:a,...s}=t,{store:o,valueRef:l}=dl(),u=qe(o,Ht.value),f=qe(o,Ht.items),d=qe(o,Ht.itemToStringLabel),p=qe(o,Ht.serializedValue),m=k.useMemo(()=>({value:u,placeholder:!p}),[u,p]),S=typeof a=="function"?a(u):a??(Array.isArray(u)?R_e(u,d):O_e(u,f,d));return Tt("span",t,{state:m,ref:[n,l],props:[{children:S},s],stateAttributesMapping:L_e})}),M_e=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s}=dl(),o=qe(s,Ht.open),l=k.useMemo(()=>({open:o}),[o]);return Tt("span",t,{state:l,ref:n,props:[{"aria-hidden":!0,children:"▼"},a],stateAttributesMapping:$P})}),j_e=k.createContext(void 0),F_e=k.forwardRef(function(t,n){const{store:r}=dl(),i=qe(r,Ht.mounted),a=qe(r,Ht.forceMount);return i||a?y.jsx(j_e.Provider,{value:!0,children:y.jsx(Sy,{ref:n,...t})}):null}),ute=k.createContext(void 0);function JP(){const e=k.useContext(ute);if(!e)throw new Error(bn(59));return e}function CE(e,t){e&&Object.assign(e.style,t)}const cte={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},B_e={position:"fixed"},U_e=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:m=5,sticky:S=!1,disableAnchorTracking:E,alignItemWithTrigger:g=!0,collisionAvoidance:_=dx,...b}=t,{store:x,listRef:T,labelsRef:w,alignItemWithTriggerActiveRef:C,selectedItemTextRef:R,valuesRef:O,initialValueRef:I,popupRef:D,setValue:P}=dl(),H=ate(),M=qe(x,Ht.open),W=qe(x,Ht.mounted),V=qe(x,Ht.modal),$=qe(x,Ht.value),q=qe(x,Ht.openMethod),K=qe(x,Ht.positionerElement),U=qe(x,Ht.triggerElement),F=qe(x,Ht.isItemEqualToValue),B=k.useRef(null),Y=k.useRef(null),[z,J]=k.useState(g),ee=W&&z&&q!=="touch";!W&&z!==g&&J(g),rt(()=>{W||(Ht.scrollUpArrowVisible(x.state)&&x.set("scrollUpArrowVisible",!1),Ht.scrollDownArrowVisible(x.state)&&x.set("scrollDownArrowVisible",!1))},[x,W]),k.useImperativeHandle(C,()=>ee),Rx((ee||V)&&M&&q!=="touch",U);const te=wx({anchor:r,floatingRootContext:H,positionMethod:i,mounted:W,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:S,disableAnchorTracking:E??ee,collisionAvoidance:_,keepMounted:!0}),Z=ee?"none":te.side,G=ee?B_e:te.positionerStyles,Q=k.useMemo(()=>{const _e={};return M||(_e.pointerEvents="none"),{role:"presentation",hidden:!W,style:{...G,..._e}}},[M,W,G]),ae=k.useMemo(()=>({open:M,side:Z,align:te.align,anchorHidden:te.anchorHidden}),[M,Z,te.align,te.anchorHidden]),se=Xe(_e=>{x.set("positionerElement",_e)}),ne=Tt("div",t,{ref:[n,se],state:ae,stateAttributesMapping:yo,props:[Q,b]}),ye=k.useRef(0),Ee=Xe(_e=>{if(_e.size===0&&ye.current===0||O.current.length===0)return;const be=ye.current;if(ye.current=_e.size,_e.size===be)return;const Ke=st(Yr);if(be!==0&&!x.state.multiple&&$!==null&&Lp(O.current,$,F)===-1){const $e=I.current,we=$e!=null&&Gd(O.current,$e,F)?$e:null;P(we,Ke),we===null&&(x.set("selectedIndex",null),R.current=null)}if(be!==0&&x.state.multiple&&Array.isArray($)){const Se=$.filter($e=>Gd(O.current,$e,F));(Se.length!==$.length||Se.some($e=>!Gd($,$e,F)))&&(P(Se,Ke),Se.length===0&&(x.set("selectedIndex",null),R.current=null))}if(M&&ee){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Se={height:""};CE(K,Se),CE(D.current,Se)}}),he=k.useMemo(()=>({...te,side:Z,alignItemWithTriggerActive:ee,setControlledAlignItemWithTrigger:J,scrollUpArrowRef:B,scrollDownArrowRef:Y}),[te,Z,ee,J]);return y.jsx(wy,{elementsRef:T,labelsRef:w,onMapChange:Ee,children:y.jsxs(ute.Provider,{value:he,children:[W&&V&&y.jsx(Ox,{inert:Cm(!M),cutout:U}),ne]})})});function dte(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 e_="base-ui-disable-scrollbar",fv={className:e_,element:y.jsx("style",{href:e_,precedence:"base-ui:low",children:`.${e_}{scrollbar-width:none}.${e_}::-webkit-scrollbar{display:none}`})},$_e=k.createContext(void 0);function eM(e){return k.useContext($_e)}const H_e={...yo,...zs},z_e=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{store:s,popupRef:o,onOpenChangeComplete:l,setOpen:u,valueRef:f,selectedItemTextRef:d,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:S,scrollHandlerRef:E}=dl(),{side:g,align:_,alignItemWithTriggerActive:b,setControlledAlignItemWithTrigger:x,scrollDownArrowRef:T,scrollUpArrowRef:w}=JP(),C=eM()!=null,R=ate(),O=Bn(),I=qe(s,Ht.id),D=qe(s,Ht.open),P=qe(s,Ht.mounted),H=qe(s,Ht.popupProps),M=qe(s,Ht.transitionStatus),W=qe(s,Ht.triggerElement),V=qe(s,Ht.positionerElement),$=qe(s,Ht.listElement),q=k.useRef(0),K=k.useRef(!1),U=k.useRef(0),F=k.useRef(!1),B=k.useRef({}),Y=Nc(),z=Xe(Z=>{if(!V||!o.current||!F.current)return;if(K.current||!b){S();return}const G=V.style.top==="0px",Q=V.style.bottom==="0px",ae=V.getBoundingClientRect().height,se=Si(V),ne=getComputedStyle(V),ye=parseFloat(ne.marginTop),Ee=parseFloat(ne.marginBottom),he=se.documentElement.clientHeight-ye-Ee,_e=Z.scrollTop,be=Z.scrollHeight,Ke=Z.clientHeight,Se=be-Ke;let $e=null,Te=null,we=!1;if(G){const le=Se-_e,me=ae+le,Ne=Math.min(me,he);$e=Ne,Ne!==he?Te=Se:we=!0}else if(Q){const le=_e-0,me=ae+le,Ne=Math.min(me,he),pe=me-he;$e=Ne,Ne!==he?Te=0:(we=!0,_e<Se&&(Te=_e-(le-pe)))}$e!=null&&(V.style.height=`${$e}px`),Te!=null&&(Z.scrollTop=Te),we&&(K.current=!0),S()});k.useImperativeHandle(E,()=>z,[z]),ji({open:D,ref:o,onComplete(){D&&l?.(!0)}});const J=k.useMemo(()=>({open:D,transitionStatus:M,side:g,align:_}),[D,M,g,_]);rt(()=>{!V||!o.current||Object.keys(B.current).length||(B.current={top:V.style.top||"0",left:V.style.left||"0",right:V.style.right,height:V.style.height,bottom:V.style.bottom,minHeight:V.style.minHeight,maxHeight:V.style.maxHeight,marginTop:V.style.marginTop,marginBottom:V.style.marginBottom})},[o,V]),rt(()=>{P||b||(F.current=!1,K.current=!1,q.current=0,U.current=0,CE(V,B.current))},[P,b,V,o]),rt(()=>{const Z=o.current;if(!(!P||!W||!V||!Z)){if(!b){F.current=!0,Y.request(S);return}queueMicrotask(()=>{const G=getComputedStyle(V),Q=getComputedStyle(Z),ae=Si(W),se=Ar(V),ne=W.getBoundingClientRect(),ye=V.getBoundingClientRect(),Ee=ne.left,he=ne.height,_e=$||Z,be=_e.scrollHeight,Ke=parseFloat(Q.borderBottomWidth),Se=parseFloat(G.marginTop)||10,$e=parseFloat(G.marginBottom)||10,Te=parseFloat(G.minHeight)||100,we=5,le=5,me=20,Ne=ae.documentElement.clientHeight-Se-$e,pe=ae.documentElement.clientWidth,De=Ne-ne.bottom+he,Ce=d.current,ze=f.current;let Ze=0,gt=0;if(Ce&&ze){const Ot=ze.getBoundingClientRect(),ct=Ce.getBoundingClientRect(),en=Ot.left-Ee,Lt=ct.left-ye.left,yt=Ot.top-ne.top+Ot.height/2,Bt=ct.top-ye.top+ct.height/2;Ze=en-Lt,gt=Bt-yt}const it=De+gt+$e+Ke;let ot=Math.min(Ne,it);const Me=Ne-Se-$e,ft=it-ot,Oe=Math.max(we,Ee+Ze),Fe=pe-le,Je=Math.max(0,Oe+ye.width-Fe);V.style.left=`${Oe-Je}px`,V.style.height=`${ot}px`,V.style.maxHeight="auto",V.style.marginTop=`${Se}px`,V.style.marginBottom=`${$e}px`,Z.style.height="100%";const lt=_e.scrollHeight-_e.clientHeight,ht=ft>=lt;ht&&(ot=Math.min(Ne,ye.height)-(ft-lt));const vn=ne.top<me||ne.bottom>Ne-me||ot<Math.min(be,Te),Dt=(se.visualViewport?.scale??1)!==1&&wP;if(vn||Dt){F.current=!0,CE(V,B.current),Nr.flushSync(()=>x(!1));return}if(ht){const Ot=Math.max(0,Ne-it);V.style.top=ye.height>=Me?"0":`${Ot}px`,V.style.height=`${ot}px`,_e.scrollTop=_e.scrollHeight-_e.clientHeight,q.current=Math.max(Te,ot)}else V.style.bottom="0",q.current=Math.max(Te,ot),_e.scrollTop=ft;q.current===Ne&&(K.current=!0),S(),setTimeout(()=>{F.current=!0})})}},[s,P,V,W,f,d,o,S,b,x,Y,T,w,$]),k.useEffect(()=>{if(!b||!V||!P)return;const Z=Ar(V);function G(Q){u(!1,st(mve,Q))}return Z.addEventListener("resize",G),()=>{Z.removeEventListener("resize",G)}},[u,b,V,P]);const ee={...$?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":m||void 0,id:`${I}-list`},onKeyDown(Z){p.current=!0,C&&UP.has(Z.key)&&Z.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(Z){if(dte(Z)||Z.pointerType==="touch")return;const G=Z.currentTarget;O.start(0,()=>{s.set("activeIndex",null),G.focus({preventScroll:!0})})},onScroll(Z){$||E.current?.(Z.currentTarget)},...b&&{style:$?{height:"100%"}:cte}},te=Tt("div",t,{ref:[n,o],state:J,stateAttributesMapping:H_e,props:[H,ee,Tx(M),{className:!$&&b?fv.className:void 0},a]});return y.jsxs(k.Fragment,{children:[fv.element,y.jsx(mx,{context:R,modal:!1,disabled:!P,restoreFocus:!0,children:te})]})}),V_e=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s,scrollHandlerRef:o}=dl(),{alignItemWithTriggerActive:l}=JP(),u=qe(s,Ht.hasScrollArrows),f=qe(s,Ht.openMethod),d=qe(s,Ht.multiple),m={id:`${qe(s,Ht.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(E){o.current?.(E.currentTarget)},...l&&{style:cte},className:u&&f!=="touch"?fv.className:void 0},S=Xe(E=>{s.set("listElement",E)});return Tt("div",t,{ref:[n,S],props:[m,a]})}),fte=k.createContext(void 0);function tM(){const e=k.useContext(fte);if(!e)throw new Error(bn(57));return e}const W_e=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,label:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(null),d=Am({label:s,textRef:f,indexGuessBehavior:HP.GuessFromOrder}),{store:p,getItemProps:m,setOpen:S,setValue:E,selectionRef:g,typingRef:_,valuesRef:b,keyboardActiveRef:x,multiple:T,highlightItemOnHover:w}=dl(),C=Bn(),R=qe(p,Ht.isActive,d.index),O=qe(p,Ht.isSelected,d.index,a),I=qe(p,Ht.isSelectedByFocus,d.index),D=qe(p,Ht.isItemEqualToValue),P=d.index,H=P!==-1,M=k.useRef(null),W=ar(P);rt(()=>{if(!H)return;const te=b.current;return te[P]=a,()=>{delete te[P]}},[H,P,a,b]),rt(()=>{if(!H)return;const te=p.state.value;let Z=te;T&&Array.isArray(te)&&te.length>0&&(Z=te[te.length-1]),Z!==void 0&&du(Z,a,D)&&p.set("selectedIndex",P)},[H,P,T,D,p,a]);const V=k.useMemo(()=>({disabled:o,selected:O,highlighted:R}),[o,O,R]),$=m({active:R,selected:O});$.onFocus=void 0,$.id=void 0;const q=k.useRef(null),K=k.useRef("mouse"),U=k.useRef(!1),{getButtonProps:F,buttonRef:B}=oa({disabled:o,focusableWhenDisabled:!0,native:l});function Y(te){const Z=p.state.value;if(T){const G=Array.isArray(Z)?Z:[],Q=O?ote(G,a,D):[...G,a];E(Q,st(af,te))}else E(a,st(af,te)),S(!1,st(af,te))}const z={role:"option","aria-selected":O,"aria-disabled":o||void 0,tabIndex:R?0:-1,onFocus(){p.set("activeIndex",P)},onMouseEnter(){!x.current&&p.state.selectedIndex===null&&p.set("activeIndex",P)},onMouseMove(){w&&p.set("activeIndex",P)},onMouseLeave(te){!w||x.current||dte(te)||C.start(0,()=>{p.state.activeIndex===P&&p.set("activeIndex",null)})},onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(te){q.current=te.key,p.set("activeIndex",P)},onClick(te){U.current=!1,!(te.type==="keydown"&&q.current===null)&&(o||q.current===" "&&_.current||K.current!=="touch"&&!R||(q.current=null,Y(te.nativeEvent)))},onPointerEnter(te){K.current=te.pointerType},onPointerDown(te){K.current=te.pointerType,U.current=!0},onMouseUp(te){if(o)return;if(U.current){U.current=!1;return}const Z=!g.current.allowSelectedMouseUp&&O,G=!g.current.allowUnselectedMouseUp&&!O;Z||G||K.current!=="touch"&&!R||Y(te.nativeEvent)}},J=Tt("div",t,{ref:[B,n,d.ref,M],state:V,props:[$,z,u,F]}),ee=k.useMemo(()=>({selected:O,indexRef:W,textRef:f,selectedByFocus:I,hasRegistered:H}),[O,W,f,I,H]);return y.jsx(fte.Provider,{value:ee,children:J})})),G_e=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=tM();return r||i?y.jsx(q_e,{...t,ref:n}):null}),q_e=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=tM(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=vo(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=Tt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:zs});return ji({open:s,ref:o,onComplete(){s||u(!1)}}),d})),K_e=k.memo(k.forwardRef(function(t,n){const{indexRef:r,textRef:i,selectedByFocus:a,hasRegistered:s}=tM(),{selectedItemTextRef:o}=dl(),{className:l,render:u,...f}=t,d=k.useCallback(m=>{if(!m||!s)return;const S=o.current===null||!o.current.isConnected;(a||S&&r.current===0)&&(o.current=m)},[o,r,a,s]);return Tt("div",t,{ref:[d,n,i],props:f})})),hte=k.forwardRef(function(t,n){const{render:r,className:i,direction:a,keepMounted:s=!1,...o}=t,{store:l,popupRef:u,listRef:f,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:p}=dl(),{side:m,scrollDownArrowRef:S,scrollUpArrowRef:E}=JP(),g=a==="up"?Ht.scrollUpArrowVisible:Ht.scrollDownArrowVisible,_=qe(l,g),b=qe(l,Ht.openMethod),x=_&&b!=="touch",T=Bn(),w=a==="up"?E:S,{transitionStatus:C,setMounted:R}=vo(x);rt(()=>(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]),ji({open:x,ref:w,onComplete(){x||R(!1)}});const O=k.useMemo(()=>({direction:a,visible:x,side:m,transitionStatus:C}),[a,x,m,C]),D=Tt("div",t,{ref:[n,w],state:O,props:[{"aria-hidden":!0,children:a==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(H){if(H.movementX===0&&H.movementY===0||T.isStarted())return;l.set("activeIndex",null);function M(){const W=l.state.listElement??u.current;if(!W)return;l.set("activeIndex",null),d();const V=W.scrollTop===0,$=Math.round(W.scrollTop+W.clientHeight)>=W.scrollHeight;if(f.current.length===0&&(a==="up"?l.set("scrollUpArrowVisible",!V):l.set("scrollDownArrowVisible",!$)),a==="up"&&V||a==="down"&&$){T.clear();return}if((l.state.listElement||u.current)&&f.current&&f.current.length>0){const K=f.current,U=w.current?.offsetHeight||0;if(a==="up"){let F=0;const B=W.scrollTop+U;for(let z=0;z<K.length;z+=1){const J=K[z];if(J&&J.offsetTop>=B){F=z;break}}const Y=Math.max(0,F-1);if(Y<F){const z=K[Y];z&&(W.scrollTop=Math.max(0,z.offsetTop-U))}else W.scrollTop=0}else{let F=K.length-1;const B=W.scrollTop+W.clientHeight-U;for(let z=0;z<K.length;z+=1){const J=K[z];if(J&&J.offsetTop+J.offsetHeight>B){F=Math.max(0,z-1);break}}const Y=Math.min(K.length-1,F+1);if(Y>F){const z=K[Y];z&&(W.scrollTop=z.offsetTop+z.offsetHeight-W.clientHeight+U)}else W.scrollTop=W.scrollHeight-W.clientHeight}}T.start(40,M)}T.start(40,M)},onMouseLeave(){T.clear()}},o]});return x||s?D:null}),Y_e=k.forwardRef(function(t,n){return y.jsx(hte,{...t,ref:n,direction:"down"})}),X_e=k.forwardRef(function(t,n){return y.jsx(hte,{...t,ref:n,direction:"up"})}),Qi=I_e;function Ji({className:e,...t}){return y.jsx(P_e,{"data-slot":"select-value",className:We("flex flex-1 text-left",e),...t})}function ea({className:e,size:t="default",children:n,...r}){return y.jsxs(D_e,{"data-slot":"select-trigger","data-size":t,className:We("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,y.jsx(M_e,{render:y.jsx(ve,{icon:Bee,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})})]})}function ta({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:a=0,alignItemWithTrigger:s=!0,...o}){return y.jsx(F_e,{children:y.jsx(U_e,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:s,className:"isolate z-50",children:y.jsxs(z_e,{"data-slot":"select-content",className:We("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:[y.jsx(Z_e,{}),y.jsx(V_e,{children:t}),y.jsx(Q_e,{})]})})})}function Nn({className:e,children:t,...n}){return y.jsxs(W_e,{"data-slot":"select-item",className:We("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:[y.jsx(K_e,{className:"flex flex-1 gap-2 shrink-0 whitespace-nowrap",children:t}),y.jsx(G_e,{render:y.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:y.jsx(ve,{icon:_u,strokeWidth:2,className:"pointer-events-none"})})]})}function Z_e({className:e,...t}){return y.jsx(X_e,{"data-slot":"select-scroll-up-button",className:We("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:y.jsx(ve,{icon:WP,strokeWidth:2})})}function Q_e({className:e,...t}){return y.jsx(Y_e,{"data-slot":"select-scroll-down-button",className:We("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:y.jsx(ve,{icon:Ay,strokeWidth:2})})}const pte=k.createContext(void 0);function nM(){const e=k.useContext(pte);if(e===void 0)throw new Error(bn(64));return e}let J_e=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const rM={tabActivationDirection:e=>({[J_e.activationDirection]:e})},eEe=k.forwardRef(function(t,n){const{className:r,defaultValue:i=0,onValueChange:a,orientation:s="horizontal",render:o,value:l,...u}=t,f=td(),d=Object.hasOwn(t,"defaultValue"),p=k.useRef([]),[m,S]=k.useState(()=>new Map),[E,g]=ns({controlled:l,default:i,name:"Tabs",state:"value"}),_=l!==void 0,[b,x]=k.useState(()=>new Map),[T,w]=k.useState("none"),C=Xe((q,K)=>{a?.(q,K),!K.isCanceled&&(g(q),w(K.activationDirection))}),R=Xe((q,K)=>{S(U=>{if(U.get(q)===K)return U;const F=new Map(U);return F.set(q,K),F})}),O=Xe((q,K)=>{S(U=>{if(!U.has(q)||U.get(q)!==K)return U;const F=new Map(U);return F.delete(q),F})}),I=k.useCallback(q=>m.get(q),[m]),D=k.useCallback(q=>{for(const K of b.values())if(q===K?.value)return K?.id},[b]),P=k.useCallback(q=>{if(q===void 0)return null;for(const[K,U]of b.entries())if(U!=null&&q===(U.value??U.index))return K;return null},[b]),H=k.useMemo(()=>({direction:f,getTabElementBySelectedValue:P,getTabIdByPanelValue:D,getTabPanelIdByValue:I,onValueChange:C,orientation:s,registerMountedTabPanel:R,setTabMap:x,unregisterMountedTabPanel:O,tabActivationDirection:T,value:E}),[f,P,D,I,C,s,R,x,O,T,E]),M=k.useMemo(()=>{for(const q of b.values())if(q!=null&&q.value===E)return q},[b,E]),W=k.useMemo(()=>{for(const q of b.values())if(q!=null&&!q.disabled)return q.value},[b]);rt(()=>{if(_||b.size===0)return;const q=M?.disabled,K=M==null&&E!==null;if(d&&q&&E===i||!q&&!K)return;const F=W??null;E!==F&&(g(F),w("none"))},[i,W,d,_,M,w,g,b,E]);const $=Tt("div",t,{state:{orientation:s,tabActivationDirection:T},ref:n,props:u,stateAttributesMapping:rM});return y.jsx(pte.Provider,{value:H,children:y.jsx(wy,{elementsRef:p,children:$})})}),mte=k.createContext(void 0);function tEe(){const e=k.useContext(mte);if(e===void 0)throw new Error(bn(65));return e}const nEe=k.forwardRef(function(t,n){const{className:r,disabled:i=!1,render:a,value:s,id:o,nativeButton:l=!0,...u}=t,{value:f,getTabPanelIdByValue:d,orientation:p}=nM(),{activateOnFocus:m,highlightedTabIndex:S,onTabActivation:E,setHighlightedTabIndex:g,tabsListElement:_}=tEe(),b=xi(o),x=k.useMemo(()=>({disabled:i,id:b,value:s}),[i,b,s]),{compositeProps:T,compositeRef:w,index:C}=Tee({metadata:x}),R=s===f,O=k.useRef(!1);rt(()=>{if(O.current){O.current=!1;return}if(!(R&&C>-1&&S!==C))return;const U=_;if(U!=null){const F=Os(Si(U));if(F&&wt(U,F))return}i||g(C)},[R,C,S,g,i,_]);const{getButtonProps:I,buttonRef:D}=oa({disabled:i,native:l,focusableWhenDisabled:!0}),P=d(s),H=k.useRef(!1),M=k.useRef(!1);function W(U){R||i||E(s,st(Yr,U.nativeEvent,void 0,{activationDirection:"none"}))}function V(U){R||(C>-1&&!i&&g(C),!i&&m&&(!H.current||H.current&&M.current)&&E(s,st(Yr,U.nativeEvent,void 0,{activationDirection:"none"})))}function $(U){if(R||i)return;H.current=!0;function F(){H.current=!1,M.current=!1}(!U.button||U.button===0)&&(M.current=!0,Si(U.currentTarget).addEventListener("pointerup",F,{once:!0}))}const q=k.useMemo(()=>({disabled:i,active:R,orientation:p}),[i,R,p]);return Tt("button",t,{state:q,ref:[n,D,w],props:[T,{role:"tab","aria-controls":P,"aria-selected":R,id:b,onClick:W,onFocus:V,onPointerDown:$,[_ee]:R?"":void 0,onKeyDownCapture(){O.current=!0}},u,I]})});let rEe=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const iEe=k.forwardRef(function(t,n){const{className:r,value:i,render:a,keepMounted:s=!1,...o}=t,{value:l,getTabIdByPanelValue:u,orientation:f,tabActivationDirection:d,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=nM(),S=xi(),E=k.useMemo(()=>({id:S,value:i}),[S,i]),{ref:g,index:_}=Am({metadata:E}),b=i!==l,x=u(i),T=k.useMemo(()=>({hidden:b,orientation:f,tabActivationDirection:d}),[b,f,d]),w=Tt("div",t,{state:T,ref:[n,g],props:[{"aria-labelledby":x,hidden:b,id:S??void 0,role:"tabpanel",tabIndex:b?-1:0,[rEe.index]:_},o],stateAttributesMapping:rM});return rt(()=>{if(!(b&&!s)&&S!=null)return p(i,S),()=>{m(i,S)}},[b,s,i,S,p,m]),!b||s?w:null}),aEe=k.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:i,loopFocus:a=!0,render:s,...o}=t,{getTabElementBySelectedValue:l,onValueChange:u,orientation:f,value:d,setTabMap:p,tabActivationDirection:m}=nM(),[S,E]=k.useState(0),[g,_]=k.useState(null),b=sEe(d,f,g,l),x=Xe((R,O)=>{if(R!==d){const I=b(R);O.activationDirection=I,u(R,O)}}),T=k.useMemo(()=>({orientation:f,tabActivationDirection:m}),[f,m]),w={"aria-orientation":f==="vertical"?"vertical":void 0,role:"tablist"},C=k.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:S,onTabActivation:x,setHighlightedTabIndex:E,tabsListElement:g,value:d}),[r,S,x,E,g,d]);return y.jsx(mte.Provider,{value:C,children:y.jsx(Sx,{render:s,className:i,state:T,refs:[n,_],props:[w,o],stateAttributesMapping:rM,highlightedIndex:S,enableHomeAndEndKeys:!0,loopFocus:a,orientation:f,onHighlightedIndexChange:E,onMapChange:p,disabledIndices:Zi})})});function M$(e,t){const{left:n,top:r}=e.getBoundingClientRect(),{left:i,top:a}=t.getBoundingClientRect(),s=n-i,o=r-a;return{left:s,top:o}}function sEe(e,t,n,r){const[i,a]=k.useState(null);return rt(()=>{if(e==null||n==null){a(null);return}const s=r(e);if(s==null){a(null);return}const{left:o,top:l}=M$(s,n);a(t==="horizontal"?o:l)},[t,r,n,e]),k.useCallback(s=>{if(s===e)return"none";if(s==null)return a(null),"none";if(s!=null&&n!=null){const o=r(s);if(o!=null){const{left:l,top:u}=M$(o,n);if(i==null)return a(t==="horizontal"?l:u),"none";if(t==="horizontal"){if(l<i)return a(l),"left";if(l>i)return a(l),"right"}else{if(u<i)return a(u),"up";if(u>i)return a(u),"down"}}}return"none"},[r,t,i,n,e])}function Dc({className:e,orientation:t="horizontal",...n}){return y.jsx(eEe,{"data-slot":"tabs","data-orientation":t,className:We("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",e),...n})}const oEe=Qc("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 Lc({className:e,variant:t="default",...n}){return y.jsx(aEe,{"data-slot":"tabs-list","data-variant":t,className:We(oEe({variant:t}),e),...n})}function Ii({className:e,...t}){return y.jsx(nEe,{"data-slot":"tabs-trigger",className:We("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 _a({className:e,...t}){return y.jsx(iEe,{"data-slot":"tabs-content",className:We("text-xs/relaxed flex-1 min-h-0 outline-none",e),...t})}function lEe(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:s,handle:o,triggerId:l,defaultTriggerId:u=null}=e,f=Eu(),d=!!f,p=Ei(()=>o?.store??new Yee({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",a);const m=p.useState("payload");Kee({store:p,actionsRef:s,parentContext:f?.store.context});const S=k.useMemo(()=>({store:p}),[p]);return y.jsx(XP.Provider,{value:S,children:typeof t=="function"?t({payload:m}):t})}const gte=k.createContext(void 0),bte=k.createContext(void 0),vte=k.createContext(void 0),yte=k.createContext("");function wu(){const e=k.useContext(gte);if(!e)throw new Error(bn(22));return e}function Lx(){const e=k.useContext(bte);if(!e)throw new Error(bn(23));return e}function Hf(){const e=k.useContext(vte);if(!e)throw new Error(bn(24));return e}function iM(){return k.useContext(yte)}const mt={id:Ue(e=>e.id),query:Ue(e=>e.query),items:Ue(e=>e.items),selectedValue:Ue(e=>e.selectedValue),open:Ue(e=>e.open),mounted:Ue(e=>e.mounted),forceMounted:Ue(e=>e.forceMounted),inline:Ue(e=>e.inline),activeIndex:Ue(e=>e.activeIndex),selectedIndex:Ue(e=>e.selectedIndex),isActive:Ue((e,t)=>e.activeIndex===t),isSelected:Ue((e,t)=>{const n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(i=>du(i,t,n)):du(r,t,n)}),transitionStatus:Ue(e=>e.transitionStatus),popupProps:Ue(e=>e.popupProps),inputProps:Ue(e=>e.inputProps),triggerProps:Ue(e=>e.triggerProps),getItemProps:Ue(e=>e.getItemProps),positionerElement:Ue(e=>e.positionerElement),listElement:Ue(e=>e.listElement),triggerElement:Ue(e=>e.triggerElement),inputElement:Ue(e=>e.inputElement),popupSide:Ue(e=>e.popupSide),openMethod:Ue(e=>e.openMethod),inputInsidePopup:Ue(e=>e.inputInsidePopup),selectionMode:Ue(e=>e.selectionMode),listRef:Ue(e=>e.listRef),labelsRef:Ue(e=>e.labelsRef),popupRef:Ue(e=>e.popupRef),emptyRef:Ue(e=>e.emptyRef),inputRef:Ue(e=>e.inputRef),keyboardActiveRef:Ue(e=>e.keyboardActiveRef),chipsContainerRef:Ue(e=>e.chipsContainerRef),clearRef:Ue(e=>e.clearRef),valuesRef:Ue(e=>e.valuesRef),allValuesRef:Ue(e=>e.allValuesRef),name:Ue(e=>e.name),disabled:Ue(e=>e.disabled),readOnly:Ue(e=>e.readOnly),required:Ue(e=>e.required),grid:Ue(e=>e.grid),isGrouped:Ue(e=>e.isGrouped),virtualized:Ue(e=>e.virtualized),onOpenChangeComplete:Ue(e=>e.onOpenChangeComplete),openOnInputClick:Ue(e=>e.openOnInputClick),itemToStringLabel:Ue(e=>e.itemToStringLabel),isItemEqualToValue:Ue(e=>e.isItemEqualToValue),modal:Ue(e=>e.modal),autoHighlight:Ue(e=>e.autoHighlight),submitOnItemClick:Ue(e=>e.submitOnItemClick)};function uEe(e,t){return(n,r)=>{if(n==null)return!1;const i=Kr(n,t);return e.contains(i,r)}}function cEe(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;const a=Kr(r,t),s=n!=null?Kr(n,t):"";return s&&e.contains(s,i)&&s.length===i.length?!0:e.contains(a,i)}}const j$=new Map;function _te(e){return Array.isArray(e)?e.map(t=>_te(t)).join(","):e==null?"":String(e)}function dEe(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${_te(e.locale)}|${JSON.stringify(t)}`,r=j$.get(n);if(r)return r;const i=new Intl.Collator(e.locale,t),a={contains(s,o,l){if(!o)return!0;const u=Kr(s,l);for(let f=0;f<=u.length-o.length;f+=1)if(i.compare(u.slice(f,f+o.length),o)===0)return!0;return!1},startsWith(s,o,l){if(!o)return!0;const u=Kr(s,l);return i.compare(u.slice(0,o.length),o)===0},endsWith(s,o,l){if(!o)return!0;const u=Kr(s,l),f=o.length;return u.length>=f&&i.compare(u.slice(u.length-f),o)===0}};return j$.set(n,a),a}const fEe=dEe,Ete=Symbol("none"),Rd={value:Ete,index:-1};function hEe(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:s,inputValue:o,selectionMode:l="none",onItemHighlighted:u,name:f,disabled:d=!1,readOnly:p=!1,required:m=!1,inputRef:S,grid:E=!1,items:g,filteredItems:_,filter:b,openOnInputClick:x=!0,autoHighlight:T=!1,keepHighlight:w=!1,highlightItemOnHover:C=!0,itemToStringLabel:R,itemToStringValue:O,isItemEqualToValue:I=ste,virtualized:D=!1,inline:P=!1,fillInputOnItemPress:H=!0,modal:M=!1,limit:W=-1,autoComplete:V="list",locale:$,submitOnItemClick:q=!1}=e,{clearErrors:K}=Iy(),{setDirty:U,validityData:F,shouldValidateOnChange:B,setFilled:Y,name:z,disabled:J,validation:ee}=$s(),te=Nx({id:t}),Z=fEe({locale:$}),[G,Q]=k.useState(!1),[ae,se]=k.useState(null),ne=k.useRef([]),ye=k.useRef([]),Ee=k.useRef(null),he=k.useRef(null),_e=k.useRef(null),be=k.useRef(!0),Ke=k.useRef(!1),Se=k.useRef(null),$e=k.useRef(null),Te=k.useRef(null),we=k.useRef(Rd),le=k.useRef(null),me=k.useRef([]),Ne=k.useRef([]),pe=J||d,De=z??f,Ce=l==="multiple",ze=l==="single",Ze=o!==void 0||s!==void 0,gt=g!==void 0,it=_!==void 0;let ot;T==="always"?ot="always":ot=T?"input-change":!1;const[Me,ft]=ns({controlled:i,default:Ce?r??Zi:r,name:"Combobox",state:"selectedValue"}),Oe=k.useMemo(()=>b===null?()=>!0:b!==void 0?b:ze&&!G?cEe(Z,R,Me):uEe(Z,R),[b,ze,Me,G,Z,R]),Fe=Ei(()=>Ze?s??"":ze?Kr(Me,R):"").current,[Je,lt]=ns({controlled:o,default:Fe,name:"Combobox",state:"inputValue"}),[ht,vn]=ns({controlled:e.open,default:e.defaultOpen,name:"Combobox",state:"open"}),Dt=lte(g),Ot=ae??(Je===""?"":String(Je).trim()),ct=ze?Kr(Me,R):"",en=ze&&!G&&Ot!==""&&ct!==""&&ct.length===Ot.length&&Z.contains(ct,Ot),Lt=en?"":Ot,yt=gt&&it&&en,Bt=k.useMemo(()=>g?Dt?g.flatMap(dt=>dt.items):g:Zi,[g,Dt]),jt=k.useMemo(()=>{if(_&&!yt)return _;if(!g)return Zi;if(Dt){const Ct=g,qt=[];let Kn=0;for(const gr of Ct){if(W>-1&&Kn>=W)break;const Lr=Lt===""?gr.items:gr.items.filter(wl=>Oe(wl,Lt,R));if(Lr.length===0)continue;const Sl=W>-1?W-Kn:1/0,xl=Lr.slice(0,Sl);if(xl.length>0){const wl={...gr,items:xl};qt.push(wl),Kn+=xl.length}}return qt}if(Lt==="")return W>-1?Bt.slice(0,W):Bt;const dt=[];for(const Ct of Bt){if(W>-1&&dt.length>=W)break;Oe(Ct,Lt,R)&&dt.push(Ct)}return dt},[_,yt,g,Dt,Lt,W,Oe,R,Bt]),Ut=k.useMemo(()=>Dt?jt.flatMap(Ct=>Ct.items):jt,[jt,Dt]),pt=Ei(()=>new sf({id:te,selectedValue:Me,open:ht,filter:Oe,query:Ot,items:g,selectionMode:l,listRef:ne,labelsRef:ye,popupRef:Ee,emptyRef:_e,inputRef:he,keyboardActiveRef:be,chipsContainerRef:Se,clearRef:$e,valuesRef:me,allValuesRef:Ne,selectionEventRef:Te,name:De,disabled:pe,readOnly:p,required:m,grid:E,isGrouped:Dt,virtualized:D,openOnInputClick:x,itemToStringLabel:R,isItemEqualToValue:I,modal:M,autoHighlight:ot,submitOnItemClick:q,hasInputValue:Ze,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:P,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:n||br,setOpen:br,setInputValue:br,setSelectedValue:br,setIndices:br,onItemHighlighted:br,handleSelection:br,getItemProps:()=>sr,forceMount:br,requestSubmit:br})).current,ln=l==="none"?Je:Me,yr=k.useMemo(()=>l==="none"?ln:Array.isArray(Me)?Me.map(dt=>no(dt,O)):no(Me,O),[ln,O,l,Me]),kr=Xe(u),Dr=Xe(n),$i=qe(pt,mt.activeIndex),_l=qe(pt,mt.selectedIndex),ci=qe(pt,mt.positionerElement),lr=qe(pt,mt.listElement),mr=qe(pt,mt.triggerElement),ua=qe(pt,mt.inputElement),Ci=qe(pt,mt.inline),ls=qe(pt,mt.inputInsidePopup),Iu=ar(mr),{mounted:Vt,setMounted:Co,transitionStatus:Ao}=vo(ht),{openMethod:us,triggerProps:cs,reset:El}=Ix(ht);Ny({id:te,name:De,commit:ee.commit,value:ln,controlRef:ls?Iu:he,getValue:()=>yr});const Pa=Xe(()=>{g?ye.current=Ut.map(dt=>Kr(dt,R)):pt.set("forceMounted",!0)}),_r=k.useRef(Me);rt(()=>{Me!==_r.current&&Pa()},[Pa,Me]);const di=Xe(dt=>{pt.update(dt);const Ct=dt.type||"none";if(dt.activeIndex!==void 0)if(dt.activeIndex===null)we.current!==Rd&&(we.current=Rd,kr(void 0,Jg(Ct,void 0,{index:-1})));else{const qt=me.current[dt.activeIndex];we.current={value:qt,index:dt.activeIndex},kr(qt,Jg(Ct,void 0,{index:dt.activeIndex}))}}),fi=Xe((dt,Ct)=>{if(Ke.current=Ct.reason===cc,e.onInputValueChange?.(dt,Ct),!Ct.isCanceled){if(Ct.reason===zd){const qt=dt.trim()!=="";qt&&Q(!0),le.current={hasQuery:qt},qt&&ot&&pt.state.activeIndex==null&&pt.set("activeIndex",0)}lt(dt)}}),Hi=Xe((dt,Ct)=>{ht!==dt&&(Ct.reason==="escape-key"&>&&Ut.length===0&&!pt.state.emptyRef.current&&Ct.allowPropagation(),e.onOpenChange?.(dt,Ct),!Ct.isCanceled&&(!dt&&G&&(ze?(se(Ot),Ot===""&&Q(!1)):Ce&&(Ci||ls?di({activeIndex:null}):se(Ot),fi("",st(cc,Ct.event)))),vn(dt)))}),Ma=Xe((dt,Ct)=>{if(a?.(dt,Ct),Ct.isCanceled)return;ft(dt),(l==="none"&&Ee.current&&H||ze&&!pt.state.inputInsidePopup)&&fi(Kr(dt,R),st(Ct.reason,Ct.event)),ze&&dt!=null&&Ct.reason!==zd&&G&&se(Ot)}),eg=Xe((dt,Ct)=>{let qt=Ct;if(qt===void 0){if($i===null)return;qt=me.current[$i]}const Kn=Tr(dt),gr=Te.current??dt;Te.current=null;const Lr=st(af,gr),Sl=Kn?.closest("a")?.getAttribute("href");if(Sl){Sl.startsWith("#")&&Hi(!1,Lr);return}if(Ce){const xl=Array.isArray(Me)?Me:[],Ks=Gd(xl,qt,pt.state.isItemEqualToValue)?ote(xl,qt,pt.state.isItemEqualToValue):[...xl,qt];if(Ma(Ks,Lr),!(he.current?he.current.value.trim()!=="":!1))return;pt.state.inputInsidePopup?fi("",st(cc,Lr.event)):Hi(!1,Lr)}else Ma(qt,Lr),Hi(!1,Lr)}),Nu=Xe(()=>{if(!pt.state.submitOnItemClick)return;const dt=pt.state.inputElement?.form;dt&&typeof dt.requestSubmit=="function"&&dt.requestSubmit()}),Du=Xe(()=>{if(Co(!1),Dr?.(!1),Q(!1),El(),se(null),di(l==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ce&&he.current&&he.current.value!==""&&!Ke.current&&fi("",st(cc)),ze)if(pt.state.inputInsidePopup)he.current&&he.current.value!==""&&fi("",st(cc));else{const dt=Kr(Me,R);he.current&&he.current.value!==dt&&fi(dt,st(dt===""?cc:Yr))}}),tg=k.useMemo(()=>Ci&&ci?{current:ci.closest('[role="dialog"]')}:Ee,[Ci,ci]);ji({enabled:!e.actionsRef,open:ht,ref:tg,onComplete(){ht||Du()}}),k.useImperativeHandle(e.actionsRef,()=>({unmount:Du}),[Du]),rt(function(){if(ht||l==="none")return;const Ct=g?Bt:Ne.current;if(Ce){const qt=Array.isArray(Me)?Me:[],Kn=qt[qt.length-1],gr=Lp(Ct,Kn,I);di({selectedIndex:gr===-1?null:gr})}else{const qt=Lp(Ct,Me,I);di({selectedIndex:qt===-1?null:qt})}},[ht,Me,g,l,Bt,Ce,I,di]),rt(()=>{g&&(me.current=Ut,ne.current.length=Ut.length)},[g,Ut]),rt(()=>{const dt=le.current;if(dt&&(dt.hasQuery?ot&&pt.set("activeIndex",0):ot==="always"&&pt.set("activeIndex",0),le.current=null),!ht&&!Ci)return;const qt=gt||it?Ut:me.current,Kn=pt.state.activeIndex;if(Kn==null){if(ot==="always"&&qt.length>0){pt.set("activeIndex",0);return}we.current!==Rd&&(we.current=Rd,pt.state.onItemHighlighted(void 0,Jg(Yr,void 0,{index:-1})));return}if(Kn>=qt.length){we.current!==Rd&&(we.current=Rd,pt.state.onItemHighlighted(void 0,Jg(Yr,void 0,{index:-1}))),pt.set("activeIndex",null);return}const gr=qt[Kn],Lr=we.current.value,Sl=Lr!==Ete&&pt.state.isItemEqualToValue(gr,Lr);(we.current.index!==Kn||!Sl)&&(we.current={value:gr,index:Kn},pt.state.onItemHighlighted(gr,Jg(Yr,void 0,{index:Kn})))},[$i,ot,it,gt,Ut,Ci,ht,pt]),rt(()=>{if(!g||l==="none")return;const dt=Bt;if(Ce){const Kn=Array.isArray(Me)?Me:Zi,gr=Kn.filter(Lr=>Gd(dt,Lr,pt.state.isItemEqualToValue));gr.length!==Kn.length&&ft(gr);return}if(Me==null?!0:Gd(dt,Me,pt.state.isItemEqualToValue))return;let qt=null;if(r!=null&&Gd(dt,r,pt.state.isItemEqualToValue)&&(qt=r),ft(qt),!pt.state.inputInsidePopup){const Kn=Kr(qt,R);he.current&&he.current.value!==Kn&&fi(Kn,st(Yr))}},[g,Bt,Ce,l,Me,r,ft,R,pt,fi]),rt(()=>{if(l==="none"){Y(String(Je)!=="");return}Y(Ce?Array.isArray(Me)&&Me.length>0:Me!=null)},[Y,l,Je,Me,Ce]),k.useEffect(()=>{gt&&ot&&Ut.length===0&&di({activeIndex:null})},[gt,ot,Ut.length,di]),qd(Ot,()=>{!ht||Ot===""||Ot===String(Fe)||Q(!0)}),qd(Me,()=>{if(l!=="none"&&(K(De),U(Me!==F.initialValue),B()?ee.commit(Me):ee.commit(Me,!0),Ce&&pt.state.selectedIndex!==null&&(!Array.isArray(Me)||Me.length===0)&&di({activeIndex:null,selectedIndex:null}),ze&&!Ze&&!ls)){const dt=Kr(Me,R);Je!==dt&&fi(dt,st(Yr))}}),qd(Je,()=>{l==="none"&&(K(De),U(Je!==F.initialValue),B()?ee.commit(Je):ee.commit(Je,!0))}),qd(g,()=>{if(!ze||Ze||ls||G)return;const dt=Kr(Me,R);Je!==dt&&fi(dt,st(Yr))});const qs=yx({open:Ci?!0:ht,onOpenChange:Hi,elements:{reference:ls?mr:ua,floating:ci}});let ja,zi;Ci||(ja=E?"grid":"listbox",zi=ht?"true":"false");const Ai=k.useMemo(()=>{const dt=ua?.tagName==="INPUT",Ct=dt||ht,qt=dt?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return Ct&&(qt.role="combobox",qt["aria-expanded"]=zi,qt["aria-haspopup"]=ja,qt["aria-controls"]=ht?lr?.id:void 0,qt["aria-autocomplete"]=V),{reference:qt,floating:{role:"presentation"}}},[ua,ht,zi,ja,lr?.id,V]),Ve=Tm(qs,{enabled:!p&&!pe&&x,event:"mousedown-only",toggle:!1,touchOpenDelay:ls?0:50}),Ft=xy(qs,{enabled:!p&&!pe&&!Ci,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Ci?!0:void 0,outsidePress(dt){const Ct=Tr(dt);return!wt(mr,Ct)&&!wt($e.current,Ct)&&!wt(Se.current,Ct)}}),ki=FP(qs,{enabled:!p&&!pe,id:te,listRef:ne,activeIndex:$i,selectedIndex:_l,virtual:!0,loopFocus:!0,allowEscape:!ot,focusItemOnOpen:G||l==="none"&&!ot?!1:"auto",focusItemOnHover:C,resetOnPointerLeave:!w,cols:E?2:1,orientation:E?"horizontal":void 0,disabledIndices:Zi,onNavigate(dt,Ct){!Ct&&!ht||Ao==="ending"||di(Ct?{activeIndex:dt,type:be.current?"keyboard":"pointer"}:{activeIndex:dt})}}),{getReferenceProps:ds,getFloatingProps:Vi,getItemProps:oh}=Ff([Ai,Ve,Ft,ki]);nte(()=>{pt.update({inline:P,popupProps:Vi(),inputProps:ds(),triggerProps:cs,getItemProps:oh,setOpen:Hi,setInputValue:fi,setSelectedValue:Ma,setIndices:di,onItemHighlighted:kr,handleSelection:eg,forceMount:Pa,requestSubmit:Nu})}),rt(()=>{pt.update({id:te,selectedValue:Me,open:ht,mounted:Vt,transitionStatus:Ao,items:g,inline:P,popupProps:Vi(),inputProps:ds(),triggerProps:cs,openMethod:us,getItemProps:oh,selectionMode:l,name:De,disabled:pe,readOnly:p,required:m,grid:E,isGrouped:Dt,virtualized:D,onOpenChangeComplete:Dr,openOnInputClick:x,itemToStringLabel:R,modal:M,autoHighlight:ot,isItemEqualToValue:I,submitOnItemClick:q,hasInputValue:Ze,requestSubmit:Nu})},[pt,te,Me,ht,Vt,Ao,g,Vi,ds,oh,us,cs,l,De,pe,p,m,ee,E,Dt,D,Dr,x,R,M,I,q,Ze,P,Nu,ot]);const ca=Us(S,ee.inputRef),ng=k.useMemo(()=>({query:Ot,filteredItems:jt,flatFilteredItems:Ut}),[Ot,jt,Ut]),E0=k.useMemo(()=>Array.isArray(ln)?"":no(ln,O),[ln,O]),rg=Ce&&Array.isArray(Me)&&Me.length>0,Lu=k.useMemo(()=>!Ce||!Array.isArray(Me)||!De?null:Me.map(dt=>{const Ct=no(dt,O);return y.jsx("input",{type:"hidden",name:De,value:Ct},Ct)}),[Ce,Me,De,O]),S0=y.jsxs(k.Fragment,{children:[e.children,y.jsx("input",{...ee.getInputValidationProps({onFocus(){if(ls){mr?.focus();return}(he.current||mr)?.focus()},onChange(dt){if(dt.nativeEvent.defaultPrevented)return;const Ct=dt.target.value,qt=st(zd,dt.nativeEvent);function Kn(){if(Ce)return;if(l==="none"){U(Ct!==F.initialValue),fi(Ct,qt),B()&&ee.commit(Ct);return}const gr=me.current.find(Lr=>no(Lr,O).toLowerCase()===Ct.toLowerCase());gr!=null&&(U(gr!==F.initialValue),Ma?.(gr,qt),B()&&ee.commit(gr))}g?Kn():(Pa(),queueMicrotask(Kn))}}),id:te,name:Ce||l==="none"?void 0:De,disabled:pe,required:m&&!rg,readOnly:p,value:E0,ref:ca,style:wm,tabIndex:-1,"aria-hidden":!0}),Lu]});return y.jsx(gte.Provider,{value:pt,children:y.jsx(bte.Provider,{value:qs,children:y.jsx(vte.Provider,{value:ng,children:y.jsx(yte.Provider,{value:Je,children:S0})})})})}const t_=2,pEe={...Np,...$f},mEe=k.forwardRef(function(t,n){const{render:r,className:i,nativeButton:a=!0,disabled:s=!1,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=$s(),{labelId:S}=nd(),E=wu(),g=qe(E,mt.selectionMode),_=qe(E,mt.disabled),b=qe(E,mt.readOnly),x=qe(E,mt.listElement),T=qe(E,mt.triggerProps),w=qe(E,mt.triggerElement),C=qe(E,mt.inputInsidePopup),R=qe(E,mt.open),O=qe(E,mt.selectedValue),I=qe(E,mt.activeIndex),D=qe(E,mt.selectedIndex),P=Lx(),H=iM(),M=Bn(),W=u||_||s,V=k.useRef("");function $(ee){V.current=ee.pointerType}const q=P.select("domReferenceElement");k.useEffect(()=>{C&&w&&w!==q&&P.set("domReferenceElement",w)},[w,q,P,C]);const{reference:K}=BP(P,{enabled:!R&&!b&&!_&&g==="single",listRef:E.state.labelsRef,activeIndex:I,selectedIndex:D,onMatch(ee){const te=E.state.valuesRef.current[ee];te!==void 0&&E.state.setSelectedValue(te,st("none"))}}),{reference:U}=Tm(P,{enabled:!b&&!_,event:"mousedown"}),{buttonRef:F,getButtonProps:B}=oa({native:a,disabled:W}),Y=k.useMemo(()=>({...l,open:R,disabled:W}),[l,R,W]),z=Xe(ee=>{E.set("triggerElement",ee)});return Tt("button",t,{ref:[n,F,z],state:Y,props:[T,U,K,{tabIndex:C?0:-1,disabled:W,role:C?"combobox":void 0,"aria-expanded":R?"true":"false","aria-haspopup":C?"dialog":"listbox","aria-controls":R?x?.id:void 0,"aria-readonly":b||void 0,"aria-labelledby":S,onPointerDown:$,onPointerEnter:$,onFocus(){d(!0),!(W||b)&&M.start(0,E.state.forceMount)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const ee=g==="none"?H:O;m.commit(ee)}},onMouseDown(ee){if(W||b||(C||P.set("domReferenceElement",ee.currentTarget),E.state.forceMount(),V.current!=="touch"&&(E.state.inputRef.current?.focus(),C||ee.preventDefault()),R))return;const te=Si(ee.currentTarget);function Z(G){if(!w)return;const Q=Tr(G),ae=E.state.positionerElement,se=E.state.listElement;if(wt(w,Q)||wt(ae,Q)||wt(se,Q)||Q===w)return;const ne=QP(w),ye=G.clientX>=ne.left-t_&&G.clientX<=ne.right+t_,Ee=G.clientY>=ne.top-t_&&G.clientY<=ne.bottom+t_;ye&&Ee||E.state.setOpen(!1,st("cancel-open",G))}C&&te.addEventListener("mouseup",Z,{once:!0})},onKeyDown(ee){W||b||(ee.key==="ArrowDown"||ee.key==="ArrowUp")&&(wr(ee),E.state.setOpen(!0,st(pp,ee.nativeEvent)),E.state.inputRef.current?.focus())}},m?m.getValidationProps(o):o,B],stateAttributesMapping:pEe})}),gEe=k.createContext(void 0);function bEe(){return k.useContext(gEe)}const Ste=k.createContext(void 0);function aM(e){const t=k.useContext(Ste);if(t===void 0&&!e)throw new Error(bn(21));return t}const vEe={...Np,...$f,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},yEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,id:s,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=$s(),{labelId:S}=nd(),E=bEe(),_=!!aM(!0),b=wu(),{filteredItems:x}=Hf(),T=iM(),w=xi(s),C=td(),R=qe(b,mt.disabled),O=qe(b,mt.readOnly),I=qe(b,mt.name),D=qe(b,mt.selectionMode),P=qe(b,mt.autoHighlight),H=qe(b,mt.inputProps),M=qe(b,mt.triggerProps),W=qe(b,mt.open),V=qe(b,mt.mounted),$=qe(b,mt.selectedValue),q=qe(b,mt.popupSide),K=qe(b,mt.positionerElement),U=!!P,F=V&&K?q:null,B=u||R||a,Y=x.length===0,[z,J]=k.useState(null),ee=k.useRef(!1),te=Xe(ae=>{const se=_||b.state.inline;se&&!b.state.hasInputValue&&b.state.setInputValue("",st(Yr)),b.update({inputElement:ae,inputInsidePopup:se})}),Z=k.useMemo(()=>({...l,open:W,disabled:B,readOnly:O,popupSide:F,listEmpty:Y}),[l,W,B,O,F,Y]);function G(ae){if(!E)return;let se;const{highlightedChipIndex:ne}=E;if(ne!==void 0){if(ae.key==="ArrowLeft")ae.preventDefault(),ne>0?se=ne-1:se=void 0;else if(ae.key==="ArrowRight")ae.preventDefault(),ne<$.length-1?se=ne+1:se=void 0;else if(ae.key==="Backspace"||ae.key==="Delete"){ae.preventDefault();const ye=ne>=$.length-1?$.length-2:ne;se=ye>=0?ye:void 0,b.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return se}return ae.key==="ArrowLeft"&&(ae.currentTarget.selectionStart??0)===0&&$.length>0?(ae.preventDefault(),se=Math.max($.length-1,0)):ae.key==="Backspace"&&ae.currentTarget.value===""&&$.length>0&&(b.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),ae.preventDefault()),se}return Tt("input",t,{state:Z,ref:[n,b.state.inputRef,te],props:[H,M,{type:"text",value:t.value??z??T,"aria-readonly":O||void 0,"aria-labelledby":S,disabled:B,readOnly:O,...D==="none"&&I&&{name:I},id:w,onFocus(){d(!0)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const ae=D==="none"?T:$;m.commit(ae)}},onCompositionStart(ae){pE||(ee.current=!0,J(ae.currentTarget.value))},onCompositionEnd(ae){ee.current=!1;const se=ae.currentTarget.value;J(null),b.state.setInputValue(se,st(zd,ae.nativeEvent))},onChange(ae){if(ee.current){const Ee=ae.currentTarget.value;J(Ee),Ee===""&&!b.state.openOnInputClick&&!b.state.inputInsidePopup&&b.state.setOpen(!1,st(cc,ae.nativeEvent));const he=Ee.trim(),_e=U&&he!=="";!O&&!B&&he!==""&&(b.state.setOpen(!0,st(zd,ae.nativeEvent)),U||b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})),W&&b.state.activeIndex!==null&&!_e&&b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"});return}b.state.setInputValue(ae.currentTarget.value,st(zd,ae.nativeEvent));const se=ae.currentTarget.value==="",ne=st(cc,ae.nativeEvent);se&&!b.state.inputInsidePopup&&(D==="single"&&b.state.setSelectedValue(null,ne),b.state.openOnInputClick||b.state.setOpen(!1,ne));const ye=ae.currentTarget.value.trim();!O&&!B&&ye!==""&&(b.state.setOpen(!0,st(zd,ae.nativeEvent)),U||b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})),W&&b.state.activeIndex!==null&&!U&&b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(ae){if(B||O||ae.ctrlKey||ae.shiftKey||ae.altKey||ae.metaKey)return;b.state.keyboardActiveRef.current=!0;const se=ae.currentTarget,ne=se.scrollWidth-se.clientWidth,ye=C==="rtl";if(ae.key==="Home"){wr(ae);const he=K7&&ye?se.value.length:0;se.setSelectionRange(he,he),se.scrollLeft=0;return}if(ae.key==="End"){wr(ae);const he=K7&&ye?0:se.value.length;se.setSelectionRange(he,he),se.scrollLeft=ye?-ne:ne;return}if(!V&&ae.key==="Escape"){const he=D==="multiple"&&Array.isArray($)?$.length===0:$===null,_e=st(px,ae.nativeEvent),be=D==="multiple"?[]:null;b.state.setInputValue("",_e),b.state.setSelectedValue(be,_e),!he&&!b.state.inline&&!_e.isPropagationAllowed&&ae.stopPropagation();return}if(E&&ae.key==="Backspace"&&se.value===""&&E.highlightedChipIndex===void 0&&Array.isArray($)&&$.length>0){const he=$.slice(0,-1);b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"}),b.state.setSelectedValue(he,st(Yr,ae.nativeEvent));return}const Ee=G(ae);if(E?.setHighlightedChipIndex(Ee),Ee!==void 0?E?.chipsRef.current[Ee]?.focus():b.state.inputRef.current?.focus(),ae.which!==229&&ae.key==="Enter"&&W){const he=b.state.activeIndex,_e=ae.nativeEvent;if(he===null){b.state.setOpen(!1,st(Yr,_e));return}wr(ae);const be=b.state.listRef.current[he];be&&(b.state.selectionEventRef.current=_e,be.click(),b.state.selectionEventRef.current=null)}},onPointerMove(){b.state.keyboardActiveRef.current=!1},onPointerDown(){b.state.keyboardActiveRef.current=!1}},m?m.getValidationProps(o):o],stateAttributesMapping:vEe})}),_Ee={...zs,...$P},EEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,keepMounted:o=!1,...l}=t,{disabled:u}=$s(),f=wu(),d=qe(f,mt.selectionMode),p=qe(f,mt.disabled),m=qe(f,mt.readOnly),S=qe(f,mt.open),E=qe(f,mt.selectedValue),g=iM();let _=!1;d==="none"?_=g!=="":d==="single"?_=E!=null:_=Array.isArray(E)&&E.length>0;const b=u||p||a,{buttonRef:x,getButtonProps:T}=oa({native:s,disabled:b}),{mounted:w,transitionStatus:C,setMounted:R}=vo(_),O=k.useMemo(()=>({disabled:b,open:S,transitionStatus:C}),[b,S,C]);ji({open:_,ref:f.state.clearRef,onComplete(){_||R(!1)}});const I=Tt("button",t,{state:O,ref:[n,x,f.state.clearRef],props:[{tabIndex:-1,children:"x",disabled:b,"aria-readonly":m||void 0,onMouseDown(P){P.preventDefault()},onClick(P){if(b||m)return;const H=f.state.keyboardActiveRef;f.state.setInputValue("",st(t$,P.nativeEvent)),d!=="none"?(f.state.setSelectedValue(Array.isArray(E)?[]:null,st(t$,P.nativeEvent)),f.state.setIndices({activeIndex:null,selectedIndex:null,type:H.current?"keyboard":"pointer"})):f.state.setIndices({activeIndex:null,type:H.current?"keyboard":"pointer"}),f.state.inputRef.current?.focus()}},l,T],stateAttributesMapping:_Ee});return o||w?I:null}),SEe=k.createContext(null);function xEe(){return k.useContext(SEe)}function wEe(e){const{children:t}=e,{filteredItems:n}=Hf(),r=xEe(),i=r?r.items:n;return i?y.jsx(k.Fragment,{children:i.map(t)}):null}const TEe=k.forwardRef(function(t,n){var r;const{render:i,className:a,children:s,...o}=t,l=wu(),u=Lx(),f=!!aM(!0),{filteredItems:d}=Hf(),p=qe(l,mt.items),m=qe(l,mt.labelsRef),S=qe(l,mt.listRef),E=qe(l,mt.selectionMode),g=qe(l,mt.grid),_=qe(l,mt.popupProps),b=qe(l,mt.disabled),x=qe(l,mt.readOnly),T=qe(l,mt.virtualized),w=E==="multiple",C=d.length===0,R=Xe(M=>{l.set("positionerElement",M)}),O=Xe(M=>{l.set("listElement",M)}),I=k.useMemo(()=>typeof s=="function"?r||(r=y.jsx(wEe,{children:s})):s,[s]),D=k.useMemo(()=>({empty:C}),[C]),P=u.useState("floatingId"),H=Tt("div",t,{state:D,ref:[n,O,f?null:R],props:[_,{children:I,tabIndex:-1,id:P,role:g?"grid":"listbox","aria-multiselectable":w?"true":void 0,onKeyDown(M){if(!(b||x)&&M.key==="Enter"){const W=l.state.activeIndex;if(W==null)return;wr(M);const V=M.nativeEvent,$=l.state.listRef.current[W];$&&(l.state.selectionEventRef.current=V,$.click(),l.state.selectionEventRef.current=null)}},onKeyDownCapture(){l.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.state.keyboardActiveRef.current=!1}},o]});return T?H:y.jsx(wy,{elementsRef:S,labelsRef:p?void 0:m,children:H})}),xte=k.createContext(void 0);function CEe(){const e=k.useContext(xte);if(e===void 0)throw new Error(bn(20));return e}const AEe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,a=wu(),s=qe(a,mt.mounted),o=qe(a,mt.forceMounted);return s||r||o?y.jsx(xte.Provider,{value:r,children:y.jsx(Sy,{ref:n,...i})}):null}),kEe=k.forwardRef(function(t,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:S=!1,disableAnchorTracking:E=!1,collisionAvoidance:g=dx,..._}=t,b=wu(),{filteredItems:x}=Hf(),T=Lx(),w=CEe(),C=qe(b,mt.modal),R=qe(b,mt.open),O=qe(b,mt.mounted),I=qe(b,mt.openMethod),D=qe(b,mt.triggerElement),P=qe(b,mt.inputElement),H=qe(b,mt.inputInsidePopup),M=x.length===0,V=wx({anchor:a??(H?D:P),floatingRootContext:T,positionMethod:s,mounted:O,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:S,disableAnchorTracking:E,keepMounted:w,collisionAvoidance:g,lazyFlip:!0});Rx(R&&C&&I!=="touch",D);const $=k.useMemo(()=>{const B={...V.positionerStyles};return R||(B.pointerEvents="none"),{role:"presentation",hidden:!O,style:B}},[R,O,V.positionerStyles]),q=k.useMemo(()=>({open:R,side:V.side,align:V.align,anchorHidden:V.anchorHidden,empty:M}),[R,V.side,V.align,V.anchorHidden,M]);rt(()=>{b.set("popupSide",V.side)},[b,V.side]);const K=k.useMemo(()=>({side:V.side,align:V.align,arrowRef:V.arrowRef,arrowUncentered:V.arrowUncentered,arrowStyles:V.arrowStyles,anchorHidden:V.anchorHidden,isPositioned:V.isPositioned}),[V.side,V.align,V.arrowRef,V.arrowUncentered,V.arrowStyles,V.anchorHidden,V.isPositioned]),U=Xe(B=>{b.set("positionerElement",B)}),F=Tt("div",t,{state:q,ref:[n,U],props:[$,_],stateAttributesMapping:yo});return y.jsxs(Ste.Provider,{value:K,children:[O&&C&&y.jsx(Ox,{inert:Cm(!R),cutout:P??D}),F]})}),OEe={...yo,...zs},REe=k.forwardRef(function(t,n){const{render:r,className:i,initialFocus:a,finalFocus:s,...o}=t,l=wu(),u=aM(),f=Lx(),{filteredItems:d}=Hf(),p=qe(l,mt.mounted),m=qe(l,mt.open),S=qe(l,mt.openMethod),E=qe(l,mt.transitionStatus),g=qe(l,mt.inputInsidePopup),_=qe(l,mt.inputElement),b=d.length===0;ji({open:m,ref:l.state.popupRef,onComplete(){m&&l.state.onOpenChangeComplete(!0)}});const x=k.useMemo(()=>({open:m,side:u.side,align:u.align,anchorHidden:u.anchorHidden,transitionStatus:E,empty:b}),[m,u.side,u.align,u.anchorHidden,E,b]),T=Tt("div",t,{state:x,ref:[n,l.state.popupRef],props:[{role:g?"dialog":"presentation",tabIndex:-1,onFocus(O){const I=Tr(O.nativeEvent);S!=="touch"&&(wt(l.state.listElement,I)||I===O.currentTarget)&&l.state.inputRef.current?.focus()}},Tx(E),o],stateAttributesMapping:OEe}),C=a===void 0?g?O=>O==="touch"?l.state.popupRef.current:_:!1:a;let R;return s!=null?R=s:R=g?void 0:!1,y.jsx(mx,{context:f,disabled:!p,modal:!g,openInteractionType:S,initialFocus:C,returnFocus:R,children:T})}),wte=k.createContext(void 0);function Tte(){const e=k.useContext(wte);if(!e)throw new Error(bn(19));return e}const IEe=k.createContext(!1);function NEe(){return k.useContext(IEe)}const DEe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,index:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(!1),d=k.useRef(null),p=Am({index:s,textRef:d,indexGuessBehavior:HP.GuessFromOrder}),m=wu(),S=NEe(),{flatFilteredItems:E}=Hf(),g=qe(m,mt.open),_=qe(m,mt.selectionMode),b=qe(m,mt.readOnly),x=qe(m,mt.virtualized),T=qe(m,mt.isItemEqualToValue),w=_!=="none",C=s??(x?Lp(E,a,T):p.index),R=p.index!==-1,O=qe(m,mt.id),I=qe(m,mt.isActive,C),D=qe(m,mt.isSelected,a),P=qe(m,mt.items),H=qe(m,mt.getItemProps),M=k.useRef(null),W=O!=null&&R?`${O}-${C}`:void 0,V=D&&w;rt(()=>{if(!(R&&(x||s!=null)))return;const ee=m.state.listRef.current;return ee[C]=M.current,()=>{delete ee[C]}},[R,x,C,s,m]),rt(()=>{if(!R||P)return;const J=m.state.valuesRef.current;return J[C]=a,_!=="none"&&m.state.allValuesRef.current.push(a),()=>{delete J[C]}},[R,P,C,a,m,_]),rt(()=>{if(!g){f.current=!1;return}if(!R||P)return;const J=m.state.selectedValue,ee=Array.isArray(J)?J[J.length-1]:J;du(ee,a,T)&&m.set("selectedIndex",C)},[R,P,g,m,C,a,T]);const $=k.useMemo(()=>({disabled:o,selected:V,highlighted:I}),[o,V,I]),q=H({active:I,selected:V});q.id=void 0,q.onFocus=void 0;const{getButtonProps:K,buttonRef:U}=oa({disabled:o,focusableWhenDisabled:!0,native:l});function F(J){function ee(){m.state.handleSelection(J,a)}m.state.submitOnItemClick?(Nr.flushSync(ee),m.state.requestSubmit()):ee()}const B={id:W,role:S?"gridcell":"option","aria-disabled":o||void 0,"aria-selected":w?V:void 0,tabIndex:void 0,onPointerDownCapture(J){f.current=!0,J.preventDefault()},onClick(J){o||b||F(J.nativeEvent)},onMouseUp(J){const ee=f.current;f.current=!1,!(o||b||J.button!==0||ee||!I)&&F(J.nativeEvent)}},Y=Tt("div",t,{ref:[U,n,p.ref,M],state:$,props:[q,B,u,K]}),z=k.useMemo(()=>({selected:V,textRef:d}),[V,d]);return y.jsx(wte.Provider,{value:z,children:Y})})),LEe=k.forwardRef(function(t,n){const{render:r,className:i,children:a,...s}=t,{filteredItems:o}=Hf(),l=wu(),u=o.length===0?a:null;return Tt("div",t,{ref:[n,l.state.emptyRef],props:[{children:u,role:"status","aria-live":"polite","aria-atomic":!0},s]})});let F$=(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 Cte(e){return k.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[F$.checked]:""}:{[F$.unchecked]:""}},...$f}),[e.indeterminate])}const Ate=k.createContext(void 0);function PEe(){const e=k.useContext(Ate);if(e===void 0)throw new Error(bn(14));return e}const MEe="data-parent",jEe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a=!1,disabled:s=!1,id:o,indeterminate:l=!1,inputRef:u,name:f,onCheckedChange:d,parent:p=!1,readOnly:m=!1,render:S,required:E=!1,uncheckedValue:g,value:_,nativeButton:b=!1,...x}=t,{clearErrors:T}=Iy(),{disabled:w,name:C,setDirty:R,setFilled:O,setFocused:I,setTouched:D,state:P,validationMode:H,validityData:M,shouldValidateOnChange:W,validation:V}=$s(),$=E_e(),{labelId:q,controlId:K,setControlId:U,getDescriptionProps:F}=nd(),B=x_e(),Y=B?.parent,z=Y&&B.allValues,J=w||$.disabled||B?.disabled||s,ee=C??f,te=_??ee,Z=xi(),G=xi();let Q=K;z?Q=p?G:`${Y.id}-${te}`:o&&(Q=o);let ae={};z&&(p?ae=B.parent.getParentProps():te&&(ae=B.parent.getChildProps(te)));const se=Xe(d),{checked:ne=r,indeterminate:ye=l,onCheckedChange:Ee,...he}=ae,_e=B?.value,be=B?.setValue,Ke=B?.defaultValue,Se=k.useRef(null),{getButtonProps:$e,buttonRef:Te}=oa({disabled:J,native:b}),we=B?.validation??V,[le,me]=ns({controlled:te&&_e&&!p?_e.includes(te):ne,default:te&&Ke&&!p?Ke.includes(te):a,name:"Checkbox",state:"checked"});rt(()=>{if(U!==br)return U(Q),()=>{U(void 0)}},[Q,B,U,p]),Ny({enabled:!B,id:Z,commit:we.commit,value:le,controlRef:Se,name:ee,getValue:()=>le});const Ne=k.useRef(null),pe=Us(u,Ne,we.inputRef);rt(()=>{Ne.current&&(Ne.current.indeterminate=ye,le&&O(!0))},[le,ye,O]),qd(le,()=>{B&&!p||(T(ee),O(le),R(le!==M.initialValue),W()?we.commit(le):we.commit(le,!0))});const De=tl({checked:le,disabled:J,name:p?void 0:ee,id:Q??void 0,required:E,ref:pe,style:wm,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(ot){if(ot.nativeEvent.defaultPrevented)return;const Me=ot.target.checked,ft=st(Yr,ot.nativeEvent);if(Ee?.(Me,ft),se(Me,ft),!ft.isCanceled&&(me(Me),te&&_e&&be&&!p)){const Oe=Me?[..._e,te]:_e.filter(Fe=>Fe!==te);be(Oe,ft)}},onFocus(){Se.current?.focus()}},_!==void 0?{value:(B?le&&_:_)||""}:sr,F,B?we.getValidationProps:we.getInputValidationProps),Ce=z?!!ne:le,ze=z&&ye||l;k.useEffect(()=>{Y&&te&&Y.disabledStatesRef.current.set(te,J)},[Y,J,te]);const Ze=k.useMemo(()=>({...P,checked:Ce,disabled:J,readOnly:m,required:E,indeterminate:ze}),[P,Ce,J,m,E,ze]),gt=Cte(Ze),it=Tt("span",t,{state:Ze,ref:[Te,Se,n,B?.registerControlRef],props:[{id:Z,role:"checkbox","aria-checked":ye?"mixed":le,"aria-readonly":m||void 0,"aria-required":E||void 0,"aria-labelledby":q,[MEe]:p?"":void 0,onFocus(){I(!0)},onBlur(){const ot=Ne.current;ot&&(D(!0),I(!1),H==="onBlur"&&we.commit(B?_e:ot.checked))},onClick(ot){m||J||(ot.preventDefault(),Ne.current?.click())}},F,we.getValidationProps,x,he,$e],stateAttributesMapping:gt});return y.jsxs(Ate.Provider,{value:Ze,children:[it,!le&&!B&&ee&&!p&&g!==void 0&&y.jsx("input",{type:"hidden",name:ee,value:g}),y.jsx("input",{...De})]})}),FEe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=PEe(),l=o.checked||o.indeterminate,{transitionStatus:u,setMounted:f}=vo(l),d=k.useRef(null),p=k.useMemo(()=>({...o,transitionStatus:u}),[o,u]);ji({open:l,ref:d,onComplete(){l||f(!1)}});const m=Cte(o),S=k.useMemo(()=>({...m,...zs,...$f}),[m]),E=a||l,g=Tt("span",t,{enabled:E,ref:[n,d],state:p,stateAttributesMapping:S,props:s});return E?g:null});function BEe(e){const{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,...a}=e;return y.jsx(hEe,{...a,selectionMode:t?"multiple":"single",selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i})}const UEe=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=Tte();return r||i?y.jsx($Ee,{...t,ref:n}):null}),$Ee=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=Tte(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=vo(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=Tt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:zs});return ji({open:s,ref:o,onComplete(){s||u(!1)}}),d})),HEe=k.createContext(void 0);function Px(e=!0){const t=k.useContext(HEe);if(t===void 0&&!e)throw new Error(bn(25));return t}const kte=k.createContext(void 0);function sM(e){const t=k.useContext(kte);if(t===void 0&&!e)throw new Error(bn(33));return t}const Ote=k.createContext(void 0);function rd(e){const t=k.useContext(Ote);if(t===void 0&&!e)throw new Error(bn(36));return t}const Rte={type:"regular-item"};function Ite(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,nativeButton:s,itemMetadata:o,nodeId:l}=e,u=k.useRef(null),f=Px(!0),d=f!==void 0,{events:p}=a.useState("floatingTreeRoot"),{getButtonProps:m,buttonRef:S}=oa({disabled:n,focusableWhenDisabled:!0,native:s}),E=k.useCallback(_=>tl({id:i,role:"menuitem",tabIndex:r?0:-1,onMouseMove(b){l&&p.emit("itemhover",{nodeId:l,target:b.currentTarget})},onMouseEnter(){o.type==="submenu-trigger"&&o.setActive()},onKeyUp(b){b.key===" "&&a.context.typingRef.current&&b.preventBaseUIHandler()},onClick(b){t&&p.emit("close",{domEvent:b,reason:af})},onMouseUp(b){if(f){const x=f.initialCursorPointRef.current;if(f.initialCursorPointRef.current=null,d&&x&&Math.abs(b.clientX-x.x)<=1&&Math.abs(b.clientY-x.y)<=1)return}u.current&&a.context.allowMouseUpTriggerRef.current&&(!d||b.button===2)&&o.type==="regular-item"&&u.current.click()}},_,m),[i,r,m,t,p,a,d,f,o,l]),g=Us(u,S);return k.useMemo(()=>({getItemProps:E,itemRef:g}),[E,g])}let B$=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const Nte={checked(e){return e?{[B$.checked]:""}:{[B$.unchecked]:""}},...zs},zEe=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!0,...f}=t,d=Am({label:s}),p=sM(!0),m=xi(a),{store:S}=rd(),E=S.useState("isActive",d.index),g=S.useState("itemProps"),{getItemProps:_,itemRef:b}=Ite({closeOnClick:u,disabled:l,highlighted:E,id:m,store:S,nativeButton:o,nodeId:p?.nodeId,itemMetadata:Rte}),x=k.useMemo(()=>({disabled:l,highlighted:E}),[l,E]);return Tt("div",t,{state:x,props:[g,f,_],ref:[b,n,d.ref]})}),VEe={...yo,...zs},WEe=k.forwardRef(function(t,n){const{render:r,className:i,finalFocus:a,...s}=t,{store:o}=rd(),{side:l,align:u}=sM(),f=eM()!=null,d=o.useState("open"),p=o.useState("transitionStatus"),m=o.useState("popupProps"),S=o.useState("mounted"),E=o.useState("instantType"),g=o.useState("activeTriggerElement"),_=o.useState("parent"),b=o.useState("lastOpenChangeReason"),x=o.useState("rootId"),T=o.useState("floatingRootContext"),w=o.useState("floatingTreeRoot"),C=o.useState("closeDelay"),R=o.useState("activeTriggerElement");ji({open:d,ref:o.context.popupRef,onComplete(){d&&o.context.onOpenChangeComplete?.(!0)}}),k.useEffect(()=>{function M(W){o.setOpen(!1,st(W.reason,W.domEvent))}return w.events.on("close",M),()=>{w.events.off("close",M)}},[w.events,o]);const O=o.useState("hoverEnabled"),I=o.useState("disabled");zye(T,{enabled:O&&!I&&_.type!=="context-menu"&&_.type!=="menubar",closeDelay:C});const D=k.useMemo(()=>({transitionStatus:p,side:l,align:u,open:d,nested:_.type==="menu",instant:E}),[p,l,u,d,_.type,E]),P=Tt("div",t,{state:D,ref:[n,o.context.popupRef],stateAttributesMapping:VEe,props:[m,{onKeyDown(M){f&&UP.has(M.key)&&M.stopPropagation()}},Tx(p),s,{"data-rootownerid":x}]});let H=_.type===void 0||_.type==="context-menu";return(g||_.type==="menubar"&&b!==hx)&&(H=!0),y.jsx(mx,{context:T,modal:!1,disabled:!S,returnFocus:a===void 0?H:a,initialFocus:_.type!=="menu",restoreFocus:!0,externalTree:_.type!=="menubar"?w:void 0,previousFocusableElement:R,nextFocusableElement:_.type===void 0?o.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?o.context.beforeContentFocusGuardRef:void 0,children:P})}),Dte=k.createContext(void 0);function GEe(){const e=k.useContext(Dte);if(e===void 0)throw new Error(bn(32));return e}const qEe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:a}=rd();return a.useState("mounted")||r?y.jsx(Dte.Provider,{value:r,children:y.jsx(Sy,{ref:n,...i})}):null}),KEe=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o,align:l,sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:S=!1,disableAnchorTracking:E=!1,collisionAvoidance:g=dx,..._}=t,{store:b}=rd(),x=GEe(),T=Px(!0),w=b.useState("parent"),C=b.useState("floatingRootContext"),R=b.useState("floatingTreeRoot"),O=b.useState("mounted"),I=b.useState("open"),D=b.useState("modal"),P=b.useState("activeTriggerElement"),H=b.useState("lastOpenChangeReason"),M=b.useState("floatingNodeId"),W=b.useState("floatingParentNodeId");let V=r,$=u,q=f,K=l,U=g;w.type==="context-menu"&&(V=r??w.context?.anchor,K=K??"start",!o&&K!=="center"&&(q=t.alignOffset??2,$=t.sideOffset??-5));let F=o,B=K;w.type==="menu"?(F=F??"inline-end",B=B??"start",U=t.collisionAvoidance??eJ):w.type==="menubar"&&(F=F??"bottom",B=B??"start");const Y=w.type==="context-menu",z=wx({anchor:V,floatingRootContext:C,positionMethod:T?"fixed":i,mounted:O,side:F,sideOffset:$,align:B,alignOffset:q,arrowPadding:Y?0:m,collisionBoundary:d,collisionPadding:p,sticky:S,nodeId:M,keepMounted:x,disableAnchorTracking:E,collisionAvoidance:U,shiftCrossAxis:Y,externalTree:R}),J=k.useMemo(()=>{const ae={};return I||(ae.pointerEvents="none"),{role:"presentation",hidden:!O,style:{...z.positionerStyles,...ae}}},[I,O,z.positionerStyles]);k.useEffect(()=>{function ae(se){se.open?(se.parentNodeId===M&&b.set("hoverEnabled",!1),se.nodeId!==M&&se.parentNodeId===b.select("floatingParentNodeId")&&b.setOpen(!1,st(xb))):se.parentNodeId===M&&se.reason!==xb&&b.set("hoverEnabled",!0)}return R.events.on("menuopenchange",ae),()=>{R.events.off("menuopenchange",ae)}},[b,R.events,M]),k.useEffect(()=>{if(b.select("floatingParentNodeId")==null)return;function ae(se){if(se.open||se.nodeId!==b.select("floatingParentNodeId"))return;const ne=se.reason??xb;b.setOpen(!1,st(ne))}return R.events.on("menuopenchange",ae),()=>{R.events.off("menuopenchange",ae)}},[R.events,b]),k.useEffect(()=>{function ae(se){!I||se.nodeId!==b.select("floatingParentNodeId")||se.target&&P&&P!==se.target&&b.setOpen(!1,st(xb))}return R.events.on("itemhover",ae),()=>{R.events.off("itemhover",ae)}},[R.events,I,P,b]),k.useEffect(()=>{const ae={open:I,nodeId:M,parentNodeId:W,reason:b.select("lastOpenChangeReason")};R.events.emit("menuopenchange",ae)},[R.events,I,b,M,W]);const ee=k.useMemo(()=>({open:I,side:z.side,align:z.align,anchorHidden:z.anchorHidden,nested:w.type==="menu"}),[I,z.side,z.align,z.anchorHidden,w.type]),te=k.useMemo(()=>({side:z.side,align:z.align,arrowRef:z.arrowRef,arrowUncentered:z.arrowUncentered,arrowStyles:z.arrowStyles,nodeId:z.context.nodeId}),[z.side,z.align,z.arrowRef,z.arrowUncentered,z.arrowStyles,z.context.nodeId]),Z=Tt("div",t,{state:ee,stateAttributesMapping:yo,ref:[n,b.useStateSetter("positionerElement")],props:[J,_]}),G=O&&w.type!=="menu"&&(w.type!=="menubar"&&D&&H!==Cr||w.type==="menubar"&&w.context.modal);let Q=null;return w.type==="menubar"?Q=w.context.contentElement:w.type===void 0&&(Q=P),y.jsxs(kte.Provider,{value:te,children:[G&&y.jsx(Ox,{ref:w.type==="context-menu"||w.type==="nested-context-menu"?w.context.internalBackdropRef:null,inert:Cm(!I),cutout:Q}),y.jsx($J,{id:M,children:y.jsx(wy,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:Z})})]})}),Lte=k.createContext(void 0);function YEe(){const e=k.useContext(Lte);if(e===void 0)throw new Error(bn(34));return e}const XEe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a,defaultValue:s,onValueChange:o,disabled:l=!1,...u}=t,[f,d]=ns({controlled:a,default:s,name:"MenuRadioGroup"}),p=Xe(o),m=Xe((_,b)=>{p?.(_,b),!b.isCanceled&&d(_)}),S=k.useMemo(()=>({disabled:l}),[l]),E=Tt("div",t,{state:S,ref:n,props:{role:"group","aria-disabled":l||void 0,...u}}),g=k.useMemo(()=>({value:f,setValue:m,disabled:l}),[f,m,l]);return y.jsx(Lte.Provider,{value:g,children:E})})),Pte=k.createContext(void 0);function ZEe(){const e=k.useContext(Pte);if(e===void 0)throw new Error(bn(35));return e}const QEe=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!1,value:f,...d}=t,p=Am({label:s}),m=sM(!0),S=xi(a),{store:E}=rd(),g=E.useState("isActive",p.index),_=E.useState("itemProps"),{value:b,setValue:x,disabled:T}=YEe(),w=T||l,C=b===f,{getItemProps:R,itemRef:O}=Ite({closeOnClick:u,disabled:w,highlighted:g,id:S,store:E,nativeButton:o,nodeId:m?.nodeId,itemMetadata:Rte}),I=k.useMemo(()=>({disabled:w,highlighted:g,checked:C}),[w,g,C]),D=Xe(H=>{const M={...st(af,H.nativeEvent),preventUnmountOnClose:()=>{}};x(f,M)}),P=Tt("div",t,{state:I,stateAttributesMapping:Nte,props:[_,{role:"menuitemradio","aria-checked":C,onClick:D},d,R],ref:[O,n,p.ref]});return y.jsx(Pte.Provider,{value:I,children:P})}),JEe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=ZEe(),l=k.useRef(null),{transitionStatus:u,setMounted:f}=vo(o.checked);ji({open:o.checked,ref:l,onComplete(){o.checked||f(!1)}});const d=k.useMemo(()=>({checked:o.checked,disabled:o.disabled,highlighted:o.highlighted,transitionStatus:u}),[o.checked,o.disabled,o.highlighted,u]);return Tt("span",t,{state:d,stateAttributesMapping:Nte,ref:[n,l],props:{"aria-hidden":!0,...s},enabled:a||o.checked})}),eSe=k.createContext(null);function Mte(e){return k.useContext(eSe)}const tSe={...uee,disabled:Ue(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Ue(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Ue(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Ue(e=>e.stickIfOpen),parent:Ue(e=>e.parent),rootId:Ue(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Ue(e=>e.activeIndex),isActive:Ue((e,t)=>e.activeIndex===t),hoverEnabled:Ue(e=>e.hoverEnabled),instantType:Ue(e=>e.instantType),lastOpenChangeReason:Ue(e=>e.openChangeReason),floatingTreeRoot:Ue(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Ue(e=>e.floatingNodeId),floatingParentNodeId:Ue(e=>e.floatingParentNodeId),itemProps:Ue(e=>e.itemProps),closeDelay:Ue(e=>e.closeDelay),keyboardEventRelay:Ue(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class oM extends MP{constructor(t){super({...nSe(),...t},{positionerRef:k.createRef(),popupRef:k.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:k.createRef(),beforeContentFocusGuardRef:k.createRef(),onOpenChangeComplete:void 0,triggerElements:new bx},tSe),this.observe(Ue(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 Ei(()=>t??new oM(n)).current}unsubscribeParentListener=null}function nSe(){return{...lee(),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 NP,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:sr,keyboardEventRelay:void 0,closeDelay:0}}const rSe=k.createContext(void 0);function iSe(){return k.useContext(rSe)}function aSe(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:s=!1,modal:o,loopFocus:l=!0,orientation:u="vertical",actionsRef:f,closeParentOnEsc:d=!1,handle:p,triggerId:m,defaultTriggerId:S=null,highlightItemOnHover:E=!0}=e,g=Px(!0),_=rd(!0),b=Mte(),x=iSe(),T=k.useMemo(()=>x&&_?{type:"menu",store:_.store}:b?{type:"menubar",context:b}:g&&!_?{type:"context-menu",context:g}:{type:void 0},[g,_,b,x]),w=oM.useStore(p?.store,{parent:T}),C=w.useState("floatingTreeRoot"),R=DP(C),O=go();rt(()=>{g&&!_?w.update({parent:{type:"context-menu",context:g},floatingNodeId:R,floatingParentNodeId:O}):_&&w.update({floatingNodeId:R,floatingParentNodeId:O})},[g,_,R,O,w]),w.useControlledProp("open",n,a),w.useControlledProp("activeTriggerId",m,S),w.useContextCallback("onOpenChangeComplete",i);const I=w.useState("open"),D=w.useState("activeTriggerElement"),P=w.useState("positionerElement"),H=w.useState("hoverEnabled"),M=w.useState("modal"),W=w.useState("disabled"),V=w.useState("lastOpenChangeReason"),$=w.useState("parent"),q=w.useState("activeIndex"),K=w.useState("payload"),U=w.useState("floatingParentNodeId"),F=k.useRef(null),B=U!=null;let Y;w.useSyncedValues({disabled:s,modal:$.type===void 0?o:void 0,rootId:ed()});const{openMethod:z,triggerProps:J,reset:ee}=Ix(I);see(w);const{forceUnmount:te}=oee(I,w,()=>{w.update({allowMouseEnter:!1,stickIfOpen:!0}),ee()}),Z=k.useRef($.type!=="context-menu"),G=Bn();k.useEffect(()=>{if(I||(F.current=null),$.type==="context-menu"){if(!I){G.clear(),Z.current=!1;return}G.start(500,()=>{Z.current=!0})}},[G,I,$.type]),Rx(I&&M&&V!==Cr&&z!=="touch",P),rt(()=>{!I&&!H&&w.set("hoverEnabled",!0)},[I,H,w]);const Q=k.useRef(!0),ae=Bn(),se=Xe((Me,ft)=>{const Oe=ft.reason;if(I===Me&&ft.trigger===D||(ft.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},!Me&&ft.trigger==null&&(ft.trigger=D??void 0),r?.(Me,ft),ft.isCanceled))return;const Fe={open:Me,nativeEvent:ft.event,reason:ft.reason,nested:B};Y?.emit("openchange",Fe);const Je=ft.event;if(Me===!1&&Je?.type==="click"&&Je.pointerType==="touch"&&!Q.current)return;if(!Me&&q!==null){const Dt=w.context.itemDomElements.current[q];queueMicrotask(()=>{Dt?.setAttribute("tabindex","-1")})}Me&&Oe===_E?(Q.current=!1,ae.start(300,()=>{Q.current=!0})):(Q.current=!0,ae.clear());const lt=(Oe===Ic||Oe===af)&&Je.detail===0&&Je?.isTrusted,ht=!Me&&(Oe===px||Oe==null);function vn(){const Dt={open:Me,openChangeReason:Oe};F.current=ft.event??null;const Ot=ft.trigger?.id??null;(Ot||Me)&&(Dt.activeTriggerId=Ot,Dt.activeTriggerElement=ft.trigger??null),w.update(Dt)}Oe===Cr?Nr.flushSync(vn):vn(),$.type==="menubar"&&(Oe===_E||Oe===ho||Oe===Cr||Oe===pp||Oe===xb)?w.set("instantType","group"):lt||ht?w.set("instantType",lt?"click":"dismiss"):w.set("instantType",void 0)}),ne=k.useCallback(Me=>{const ft=st(Me);return ft.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},ft},[w]),ye=k.useCallback(()=>{w.setOpen(!1,ne(VJ))},[w,ne]);k.useImperativeHandle(f,()=>({unmount:te,close:ye}),[te,ye]);let Ee;$.type==="context-menu"&&(Ee=$.context),k.useImperativeHandle(Ee?.positionerRef,()=>P,[P]),k.useImperativeHandle(Ee?.actionsRef,()=>({setOpen:se}),[se]);const he=cee({popupStore:w,onOpenChange:se});Y=he.context.events,k.useEffect(()=>{const Me=({open:ft,eventDetails:Oe})=>se(ft,Oe);return Y.on("setOpen",Me),()=>{Y?.off("setOpen",Me)}},[Y,se]);const _e=xy(he,{enabled:!W,bubbles:d&&$.type==="menu",outsidePress(){return $.type!=="context-menu"||F.current?.type==="contextmenu"?!0:Z.current},externalTree:B?C:void 0}),be=fee(he,{role:"menu"}),Ke=td(),Se=k.useCallback(Me=>{w.select("activeIndex")!==Me&&w.set("activeIndex",Me)},[w]),$e=FP(he,{enabled:!W,listRef:w.context.itemDomElements,activeIndex:q,nested:$.type!==void 0,loopFocus:l,orientation:u,parentOrientation:$.type==="menubar"?$.context.orientation:void 0,rtl:Ke==="rtl",disabledIndices:Zi,onNavigate:Se,openOnArrowKeyDown:$.type!=="context-menu",externalTree:B?C:void 0,focusItemOnHover:E}),Te=k.useCallback(Me=>{w.context.typingRef.current=Me},[w]),we=BP(he,{listRef:w.context.itemLabels,activeIndex:q,resetMs:Nge,onMatch:Me=>{I&&Me!==q&&w.set("activeIndex",Me)},onTypingChange:Te}),{getReferenceProps:le,getFloatingProps:me,getItemProps:Ne,getTriggerProps:pe}=Ff([_e,be,$e,we]),De=k.useMemo(()=>{const Me=tl(le(),{onMouseEnter(){w.set("hoverEnabled",!0)},onMouseMove(){w.set("allowMouseEnter",!0)}},J);return delete Me.role,Me},[le,w,J]),Ce=k.useMemo(()=>{const Me=pe();if(!Me)return Me;const ft=tl(Me,J);return delete ft.role,delete ft["aria-controls"],ft},[pe,J]),ze=Nc(),Ze=k.useMemo(()=>me({onMouseEnter(){$.type==="menu"&&ze.request(()=>w.set("hoverEnabled",!1))},onMouseMove(){w.set("allowMouseEnter",!0)},onClick(){w.select("hoverEnabled")&&w.set("hoverEnabled",!1)},onKeyDown(Me){const ft=w.select("keyboardEventRelay");ft&&!Me.isPropagationStopped()&&ft(Me)}}),[me,$.type,ze,w]),gt=k.useMemo(()=>Ne(),[Ne]);w.useSyncedValues({floatingRootContext:he,activeTriggerProps:De,inactiveTriggerProps:Ce,popupProps:Ze,itemProps:gt});const it=k.useMemo(()=>({store:w,parent:T}),[w,T]),ot=y.jsx(Ote.Provider,{value:it,children:typeof t=="function"?t({payload:K}):t});return $.type===void 0||$.type==="context-menu"?y.jsx(HJ,{externalTree:C,children:ot}):ot}function jte(e){if(Qn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!Wo(e))return jte(el(e))}function sSe(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,i=k.useRef(!1);return k.useMemo(()=>t?{onMouseDown:a=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,Si(a.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:a=>{i.current&&(i.current=!1,a.preventBaseUIHandler())}}:sr,[t,n,r])}const n_=2,oSe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,id:o,openOnHover:l,delay:u=100,closeDelay:f=0,handle:d,payload:p,...m}=t,S=rd(!0),E=d?.store??S?.store;if(!E)throw new Error(bn(85));const g=xi(o),_=E.useState("isTriggerActive",g),b=E.useState("floatingRootContext"),x=E.useState("isOpenedByTrigger",g),T=k.useRef(null),w=uSe(),C=_P(!0),R=bo(),O=k.useMemo(()=>R??new NP,[R]),I=DP(O),D=go(),{registerTrigger:P,isMountedByThisTrigger:H}=aee(g,T,E,{payload:p,closeDelay:f,parent:w,floatingTreeRoot:O,floatingNodeId:I,floatingParentNodeId:D,keyboardEventRelay:C?.relayKeyboardEvent}),M=E.useState("disabled"),W=a||M||w.type==="menubar"&&w.context.disabled,{getButtonProps:V,buttonRef:$}=oa({disabled:W,native:s});k.useEffect(()=>{!x&&w.type===void 0&&(E.context.allowMouseUpTriggerRef.current=!1)},[E,x,w.type]);const q=k.useRef(null),K=Bn(),U=Xe(be=>{if(!q.current)return;K.clear(),E.context.allowMouseUpTriggerRef.current=!1;const Ke=be.target;if(wt(q.current,Ke)||wt(E.select("positionerElement"),Ke)||Ke===q.current||Ke!=null&&jte(Ke)===E.select("rootId"))return;const Se=QP(q.current);be.clientX>=Se.left-n_&&be.clientX<=Se.right+n_&&be.clientY>=Se.top-n_&&be.clientY<=Se.bottom+n_||O.events.emit("close",{domEvent:be,reason:zJ})});k.useEffect(()=>{x&&E.select("lastOpenChangeReason")===Cr&&Si(q.current).addEventListener("mouseup",U,{once:!0})},[x,U,E]);const F=w.type==="menubar"&&w.context.hasSubmenuOpen,Y=Gye(b,{enabled:(l??F??!1)&&!W&&w.type!=="context-menu"&&(w.type!=="menubar"||F&&!H),handleClose:hee({blockPointerEvents:w.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:w.type===void 0?u:void 0,delay:{close:f},triggerElementRef:T,externalTree:O,isActiveTrigger:_}),z=lSe(x,E.select("lastOpenChangeReason")),J=Tm(b,{enabled:!W&&w.type!=="context-menu",event:x&&w.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0?z:!1}),ee=Bye(b,{enabled:!W&&(w.type!=="menubar"&&x||F)}),te=sSe({open:x,enabled:w.type==="menubar",mouseDownAction:"open"}),Z=Ff([J,ee]),G=w.type==="menubar",Q=k.useMemo(()=>({disabled:W,open:x}),[W,x]),ae=E.useState("triggerProps",H),se=[q,n,$,P,T],ne=[Z.getReferenceProps(),Y??sr,ae,{"aria-haspopup":"menu",id:g,onMouseDown:be=>{if(E.select("open"))return;K.start(200,()=>{E.context.allowMouseUpTriggerRef.current=!0}),Si(be.currentTarget).addEventListener("mouseup",U,{once:!0})}},G?{role:"menuitem"}:{},te,m,V],ye=k.useRef(null),Ee=Xe(be=>{Nr.flushSync(()=>{E.setOpen(!1,st(ho,be.nativeEvent,be.currentTarget))}),cve(ye.current)?.focus()}),he=Xe(be=>{const Ke=E.select("positionerElement");if(Ke&&oo(be,Ke))E.context.beforeContentFocusGuardRef.current?.focus();else{Nr.flushSync(()=>{E.setOpen(!1,st(ho,be.nativeEvent,be.currentTarget))});let Se=uve(T.current);for(;Se!==null&&wt(Ke,Se)||Se?.hasAttribute("aria-hidden");){const $e=Se;if(Se=Ey(Se),Se===$e)break}Se?.focus()}}),_e=Tt("button",t,{enabled:!G,stateAttributesMapping:Np,state:Q,ref:se,props:ne});return G?y.jsx(xx,{tag:"button",render:r,className:i,state:Q,refs:se,props:ne,stateAttributesMapping:Np}):x?y.jsxs(k.Fragment,{children:[y.jsx(nl,{ref:ye,onFocus:Ee},`${g}-pre-focus-guard`),y.jsx(k.Fragment,{children:_e},g),y.jsx(nl,{ref:E.context.triggerFocusTargetRef,onFocus:he},`${g}-post-focus-guard`)]}):y.jsx(k.Fragment,{children:_e},g)});function lSe(e,t){const n=Bn(),[r,i]=k.useState(!1);return rt(()=>{e&&t==="trigger-hover"?(i(!0),n.start(QQ,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function uSe(){const e=Px(!0),t=rd(!0),n=Mte();return k.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}function zl(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Fte=k.createContext(void 0);function Mx(){const e=k.useContext(Fte);if(e===void 0)throw new Error(bn(53));return e}let AE=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const r_=500,U$=16;function Ds(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 cSe=(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})({}),Hh=(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 lM={hasOverflowX:e=>e?{[Hh.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[Hh.hasOverflowY]:""}:null,overflowXStart:e=>e?{[Hh.overflowXStart]:""}:null,overflowXEnd:e=>e?{[Hh.overflowXEnd]:""}:null,overflowYStart:e=>e?{[Hh.overflowYStart]:""}:null,overflowYEnd:e=>e?{[Hh.overflowYEnd]:""}:null,cornerHidden:()=>null},$$={width:0,height:0},dSe={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},fSe=k.forwardRef(function(t,n){const{render:r,className:i,overflowEdgeThreshold:a,...s}=t,[o,l]=k.useState(!1),[u,f]=k.useState(!1),[d,p]=k.useState(!1),[m,S]=k.useState($$),[E,g]=k.useState($$),[_,b]=k.useState(!1),[x,T]=k.useState(dSe),w=xi(),C=k.useRef(null),R=k.useRef(null),O=k.useRef(null),I=k.useRef(null),D=k.useRef(null),P=k.useRef(null),H=k.useRef(null),M=k.useRef(!1),W=k.useRef(0),V=k.useRef(0),$=k.useRef(0),q=k.useRef(0),K=k.useRef("vertical"),U=Bn(),F=Bn(),B=k.useRef({x:0,y:0}),[Y,z]=k.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),J=hSe(a),ee=Xe(Ee=>{const he=Ee.x-B.current.x,_e=Ee.y-B.current.y;B.current=Ee,_e!==0&&(p(!0),U.start(r_,()=>{p(!1)})),he!==0&&(f(!0),F.start(r_,()=>{f(!1)}))}),te=Xe(Ee=>{Ee.button===0&&(M.current=!0,W.current=Ee.clientY,V.current=Ee.clientX,K.current=Ee.currentTarget.getAttribute(cSe.orientation),R.current&&($.current=R.current.scrollTop,q.current=R.current.scrollLeft),D.current&&K.current==="vertical"&&D.current.setPointerCapture(Ee.pointerId),P.current&&K.current==="horizontal"&&P.current.setPointerCapture(Ee.pointerId))}),Z=Xe(Ee=>{if(!M.current)return;const he=Ee.clientY-W.current,_e=Ee.clientX-V.current;if(R.current){const be=R.current.scrollHeight,Ke=R.current.clientHeight,Se=R.current.scrollWidth,$e=R.current.clientWidth;if(D.current&&O.current&&K.current==="vertical"){const Te=Ds(O.current,"padding","y"),we=Ds(D.current,"margin","y"),le=D.current.offsetHeight,me=O.current.offsetHeight-le-Te-we,Ne=he/me;R.current.scrollTop=$.current+Ne*(be-Ke),Ee.preventDefault(),p(!0),U.start(r_,()=>{p(!1)})}if(P.current&&I.current&&K.current==="horizontal"){const Te=Ds(I.current,"padding","x"),we=Ds(P.current,"margin","x"),le=P.current.offsetWidth,me=I.current.offsetWidth-le-Te-we,Ne=_e/me;R.current.scrollLeft=q.current+Ne*(Se-$e),Ee.preventDefault(),f(!0),F.start(r_,()=>{f(!1)})}}}),G=Xe(Ee=>{M.current=!1,D.current&&K.current==="vertical"&&D.current.releasePointerCapture(Ee.pointerId),P.current&&K.current==="horizontal"&&P.current.releasePointerCapture(Ee.pointerId)});function Q(Ee){const he=Ee.pointerType==="touch";if(b(he),!he){const _e=wt(C.current,Ee.target);l(_e)}}const ae=k.useMemo(()=>({hasOverflowX:!Y.scrollbarXHidden,hasOverflowY:!Y.scrollbarYHidden,overflowXStart:x.xStart,overflowXEnd:x.xEnd,overflowYStart:x.yStart,overflowYEnd:x.yEnd,cornerHidden:Y.cornerHidden}),[Y.scrollbarXHidden,Y.scrollbarYHidden,Y.cornerHidden,x]),se={role:"presentation",onPointerEnter:Q,onPointerMove:Q,onPointerDown({pointerType:Ee}){b(Ee==="touch")},onPointerLeave(){l(!1)},style:{position:"relative",[AE.scrollAreaCornerHeight]:`${m.height}px`,[AE.scrollAreaCornerWidth]:`${m.width}px`}},ne=Tt("div",t,{state:ae,ref:[n,C],props:[se,s],stateAttributesMapping:lM}),ye=k.useMemo(()=>({handlePointerDown:te,handlePointerMove:Z,handlePointerUp:G,handleScroll:ee,cornerSize:m,setCornerSize:S,thumbSize:E,setThumbSize:g,touchModality:_,cornerRef:H,scrollingX:u,setScrollingX:f,scrollingY:d,setScrollingY:p,hovering:o,setHovering:l,viewportRef:R,rootRef:C,scrollbarYRef:O,scrollbarXRef:I,thumbYRef:D,thumbXRef:P,rootId:w,hiddenState:Y,setHiddenState:z,overflowEdges:x,setOverflowEdges:T,viewportState:ae,overflowEdgeThreshold:J}),[te,Z,G,ee,m,E,_,H,u,f,d,p,o,l,R,C,O,I,D,P,w,Y,x,ae,J]);return y.jsxs(Fte.Provider,{value:ye,children:[fv.element,ne]})});function hSe(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 pSe=k.createContext(void 0);function mSe(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 vc=(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})({}),H$=!1;function gSe(){H$||wP||(typeof CSS<"u"&&"registerProperty"in CSS&&[vc.scrollAreaOverflowXStart,vc.scrollAreaOverflowXEnd,vc.scrollAreaOverflowYStart,vc.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),H$=!0)}const bSe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{viewportRef:s,scrollbarYRef:o,scrollbarXRef:l,thumbYRef:u,thumbXRef:f,cornerRef:d,setCornerSize:p,setThumbSize:m,rootId:S,setHiddenState:E,hiddenState:g,handleScroll:_,setHovering:b,setOverflowEdges:x,overflowEdges:T,overflowEdgeThreshold:w}=Mx(),C=td(),R=k.useRef(!0),O=Bn(),I=Bn();function D(){const q=s.current,K=o.current,U=l.current,F=u.current,B=f.current,Y=d.current;if(!q)return;const z=q.scrollHeight,J=q.scrollWidth,ee=q.clientHeight,te=q.clientWidth,Z=q.scrollTop,G=q.scrollLeft;if(z===0||J===0)return;const Q=ee>=z,ae=te>=J,se=te/J,ne=ee/z,ye=Math.max(0,J-te),Ee=Math.max(0,z-ee);let he=0,_e=0;ae||(C==="rtl"?he=zl(-G,0,ye):he=zl(G,0,ye),_e=ye-he);const be=Q?0:zl(Z,0,Ee),Ke=Q?0:Ee-be,Se=ae?0:te,$e=Q?0:ee,Te=Ds(U,"padding","x"),we=Ds(K,"padding","y"),le=Ds(B,"margin","x"),me=Ds(F,"margin","y"),Ne=Se-Te-le,pe=$e-we-me,De=U?Math.min(U.offsetWidth,Ne):Ne,Ce=K?Math.min(K.offsetHeight,pe):pe,ze=Math.max(U$,De*se),Ze=Math.max(U$,Ce*ne);if(m(Fe=>Fe.height===Ze&&Fe.width===ze?Fe:{width:ze,height:Ze}),K&&F){const Fe=K.offsetHeight-Ze-we-me,Je=z-ee,lt=Je===0?0:Z/Je,ht=Math.min(Fe,Math.max(0,lt*Fe));F.style.transform=`translate3d(0,${ht}px,0)`}if(U&&B){const Fe=U.offsetWidth-ze-Te-le,Je=J-te,lt=Je===0?0:G/Je,ht=C==="rtl"?zl(lt*Fe,-Fe,0):zl(lt*Fe,0,Fe);B.style.transform=`translate3d(${ht}px,0,0)`}const gt=zl(he,0,ye),it=zl(_e,0,ye),ot=zl(be,0,Ee),Me=zl(Ke,0,Ee),ft=[[vc.scrollAreaOverflowXStart,gt],[vc.scrollAreaOverflowXEnd,it],[vc.scrollAreaOverflowYStart,ot],[vc.scrollAreaOverflowYEnd,Me]];for(const[Fe,Je]of ft)q.style.setProperty(Fe,`${Je}px`);if(Y){if(ae||Q)p({width:0,height:0});else if(!ae&&!Q){const Fe=K?.offsetWidth||0,Je=U?.offsetHeight||0;p({width:Fe,height:Je})}}E(Fe=>{const Je=Q||ae;return Fe.scrollbarYHidden===Q&&Fe.scrollbarXHidden===ae&&Fe.cornerHidden===Je?Fe:{scrollbarYHidden:Q,scrollbarXHidden:ae,cornerHidden:Je}});const Oe={xStart:!ae&>>w.xStart,xEnd:!ae&&it>w.xEnd,yStart:!Q&&ot>w.yStart,yEnd:!Q&&Me>w.yEnd};x(Fe=>Fe.xStart===Oe.xStart&&Fe.xEnd===Oe.xEnd&&Fe.yStart===Oe.yStart&&Fe.yEnd===Oe.yEnd?Fe:Oe)}const P=Xe(()=>{Nr.flushSync(D)});rt(()=>s.current?(gSe(),mSe(s.current,P)):void 0,[P,s]),rt(()=>{queueMicrotask(P)},[P,g,C]),rt(()=>{s.current?.matches(":hover")&&b(!0)},[s,b]),k.useEffect(()=>{const q=s.current;if(typeof ResizeObserver>"u"||!q)return;const K=new ResizeObserver(P);return K.observe(q),I.start(0,()=>{Promise.all(q.getAnimations({subtree:!0}).map(U=>U.finished)).then(P).catch(()=>{})}),()=>{K.disconnect(),I.clear()}},[P,s,I]);function H(){R.current=!1}const M={role:"presentation",...S&&{"data-id":`${S}-viewport`},...(!g.scrollbarXHidden||!g.scrollbarYHidden)&&{tabIndex:0},className:fv.className,style:{overflow:"scroll"},onScroll(){s.current&&(P(),R.current||_({x:s.current.scrollLeft,y:s.current.scrollTop}),O.start(100,()=>{R.current=!0}))},onWheel:H,onTouchMove:H,onPointerMove:H,onPointerEnter:H,onKeyDown:H},W=k.useMemo(()=>({hasOverflowX:!g.scrollbarXHidden,hasOverflowY:!g.scrollbarYHidden,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:g.cornerHidden}),[g.scrollbarXHidden,g.scrollbarYHidden,g.cornerHidden,T]),V=Tt("div",t,{ref:[n,s],state:W,props:[M,a],stateAttributesMapping:lM}),$=k.useMemo(()=>({computeThumbPosition:P}),[P]);return y.jsx(pSe.Provider,{value:$,children:V})}),Bte=k.createContext(void 0);function vSe(){const e=k.useContext(Bte);if(e===void 0)throw new Error(bn(54));return e}let kE=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const ySe=k.forwardRef(function(t,n){const{render:r,className:i,orientation:a="vertical",keepMounted:s=!1,...o}=t,{hovering:l,scrollingX:u,scrollingY:f,hiddenState:d,overflowEdges:p,scrollbarYRef:m,scrollbarXRef:S,viewportRef:E,thumbYRef:g,thumbXRef:_,handlePointerDown:b,handlePointerUp:x,rootId:T,thumbSize:w}=Mx(),C=k.useMemo(()=>({hovering:l,scrolling:{horizontal:u,vertical:f}[a],orientation:a,hasOverflowX:!d.scrollbarXHidden,hasOverflowY:!d.scrollbarYHidden,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:d.cornerHidden}),[l,u,f,a,d,p]),R=td();k.useEffect(()=>{const M=E.current,W=a==="vertical"?m.current:S.current;if(!W)return;function V($){if(!(!M||!W||$.ctrlKey)){if($.preventDefault(),a==="vertical"){if(M.scrollTop===0&&$.deltaY<0)return}else if(M.scrollLeft===0&&$.deltaX<0)return;if(a==="vertical"){if(M.scrollTop===M.scrollHeight-M.clientHeight&&$.deltaY>0)return}else if(M.scrollLeft===M.scrollWidth-M.clientWidth&&$.deltaX>0)return;a==="vertical"?M.scrollTop+=$.deltaY:M.scrollLeft+=$.deltaX}}return W.addEventListener("wheel",V,{passive:!1}),()=>{W.removeEventListener("wheel",V)}},[a,S,m,E]);const O={...T&&{"data-id":`${T}-scrollbar`},onPointerDown(M){if(M.button===0&&M.currentTarget===M.target&&E.current){if(g.current&&m.current&&a==="vertical"){const W=Ds(g.current,"margin","y"),V=Ds(m.current,"padding","y"),$=g.current.offsetHeight,q=m.current.getBoundingClientRect(),K=M.clientY-q.top-$/2-V+W/2,U=E.current.scrollHeight,F=E.current.clientHeight,B=m.current.offsetHeight-$-V-W,z=K/B*(U-F);E.current.scrollTop=z}if(_.current&&S.current&&a==="horizontal"){const W=Ds(_.current,"margin","x"),V=Ds(S.current,"padding","x"),$=_.current.offsetWidth,q=S.current.getBoundingClientRect(),K=M.clientX-q.left-$/2-V+W/2,U=E.current.scrollWidth,F=E.current.clientWidth,B=S.current.offsetWidth-$-V-W,Y=K/B;let z;R==="rtl"?(z=(1-Y)*(U-F),E.current.scrollLeft<=0&&(z=-z)):z=Y*(U-F),E.current.scrollLeft=z}b(M)}},onPointerUp:x,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...a==="vertical"&&{top:0,bottom:`var(${AE.scrollAreaCornerHeight})`,insetInlineEnd:0,[kE.scrollAreaThumbHeight]:`${w.height}px`},...a==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${AE.scrollAreaCornerWidth})`,bottom:0,[kE.scrollAreaThumbWidth]:`${w.width}px`}}},I=Tt("div",t,{ref:[n,a==="vertical"?m:S],state:C,props:[O,o],stateAttributesMapping:lM}),D=k.useMemo(()=>({orientation:a}),[a]),P=a==="vertical"?d.scrollbarYHidden:d.scrollbarXHidden;return s||!P?y.jsx(Bte.Provider,{value:D,children:I}):null}),_Se=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{thumbYRef:s,thumbXRef:o,handlePointerDown:l,handlePointerMove:u,handlePointerUp:f,setScrollingX:d,setScrollingY:p}=Mx(),{orientation:m}=vSe(),S=k.useMemo(()=>({orientation:m}),[m]);return Tt("div",t,{ref:[n,m==="vertical"?s:o],state:S,props:[{onPointerDown:l,onPointerMove:u,onPointerUp(g){m==="vertical"&&p(!1),m==="horizontal"&&d(!1),f(g)},style:{...m==="vertical"&&{height:`var(${kE.scrollAreaThumbHeight})`},...m==="horizontal"&&{width:`var(${kE.scrollAreaThumbWidth})`}}},a]})}),ESe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{cornerRef:s,cornerSize:o,hiddenState:l}=Mx(),u=Tt("div",t,{ref:[n,s],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},a]});return l.cornerHidden?null:u}),Ute=k.createContext(void 0);function SSe(){const e=k.useContext(Ute);if(e===void 0)throw new Error(bn(63));return e}let z$=(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 $te={...$f,checked(e){return e?{[z$.checked]:""}:{[z$.unchecked]:""}}},xSe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a,id:s,inputRef:o,name:l,nativeButton:u=!1,onCheckedChange:f,readOnly:d=!1,required:p=!1,disabled:m=!1,render:S,uncheckedValue:E,...g}=t,{clearErrors:_}=Iy(),{state:b,setTouched:x,setDirty:T,validityData:w,setFilled:C,setFocused:R,shouldValidateOnChange:O,validationMode:I,disabled:D,name:P,validation:H}=$s(),{labelId:M}=nd(),W=D||m,V=P??l,$=Xe(f),q=k.useRef(null),K=Us(q,o,H.inputRef),U=k.useRef(null),F=xi(),B=Nx({id:s,implicit:!1,controlRef:U}),[Y,z]=ns({controlled:r,default:!!a,name:"Switch",state:"checked"});Ny({id:F,commit:H.commit,value:Y,controlRef:U,name:V,getValue:()=>Y}),rt(()=>{q.current&&C(q.current.checked)},[q,C]),qd(Y,()=>{_(V),T(Y!==w.initialValue),C(Y),O()?H.commit(Y):H.commit(Y,!0)});const{getButtonProps:J,buttonRef:ee}=oa({disabled:W,native:u}),te={id:F,role:"switch","aria-checked":Y,"aria-readonly":d||void 0,"aria-labelledby":M,onFocus(){W||R(!0)},onBlur(){const ae=q.current;!ae||W||(x(!0),R(!1),I==="onBlur"&&H.commit(ae.checked))},onClick(ae){d||W||(ae.preventDefault(),q?.current?.click())}},Z=k.useMemo(()=>tl({checked:Y,disabled:W,id:B,name:V,required:p,style:wm,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:K,onChange(ae){if(ae.nativeEvent.defaultPrevented)return;const se=ae.target.checked,ne=st(Yr,ae.nativeEvent);$?.(se,ne),!ne.isCanceled&&z(se)},onFocus(){U.current?.focus()}},H.getInputValidationProps),[Y,W,K,B,V,$,p,z,H]),G=k.useMemo(()=>({...b,checked:Y,disabled:W,readOnly:d,required:p}),[b,Y,W,d,p]),Q=Tt("span",t,{state:G,ref:[n,U,ee],props:[te,H.getValidationProps,g,J],stateAttributesMapping:$te});return y.jsxs(Ute.Provider,{value:G,children:[Q,!Y&&V&&E!==void 0&&y.jsx("input",{type:"hidden",name:V,value:E}),y.jsx("input",{...Z})]})}),wSe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{state:s}=$s(),o=SSe(),l={...s,...o};return Tt("span",t,{state:l,ref:n,stateAttributesMapping:$te,props:a})}),Hte=k.createContext(void 0);function TSe(e=!0){const t=k.useContext(Hte);if(t===void 0&&!e)throw new Error(bn(7));return t}const CSe=k.forwardRef(function(t,n){const{className:r,defaultPressed:i=!1,disabled:a=!1,form:s,onPressedChange:o,pressed:l,render:u,type:f,value:d,nativeButton:p=!0,...m}=t,S=xi(d||void 0),E=TSe(),g=E?.value??[],_=E?void 0:i,b=(a||E?.disabled)??!1,[x,T]=ns({controlled:E?g?.indexOf(S)>-1:l,default:_,name:"Toggle",state:"pressed"}),w=Xe((H,M)=>{S&&E?.setGroupValue?.(S,H,M),o?.(H,M)}),{getButtonProps:C,buttonRef:R}=oa({disabled:b,native:p}),O=k.useMemo(()=>({disabled:b,pressed:x}),[b,x]),I=[R,n],D=[{"aria-pressed":x,onClick(H){const M=!x,W=st(Yr,H.nativeEvent);w(M,W),!W.isCanceled&&T(M)}},m,C],P=Tt("button",t,{enabled:!E,state:O,ref:I,props:D});return E?y.jsx(xx,{tag:"button",render:u,className:r,state:O,refs:I,props:D}):P});let ASe=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const V$={multiple(e){return e?{[ASe.multiple]:""}:null}},kSe=k.forwardRef(function(t,n){const{defaultValue:r,disabled:i=!1,loopFocus:a=!0,onValueChange:s,orientation:o="horizontal",multiple:l=!1,value:u,className:f,render:d,...p}=t,m=eM(),S=k.useMemo(()=>{if(u===void 0)return r??[]},[u,r]),E=(m?.disabled??!1)||i,[g,_]=ns({controlled:u,default:S,name:"ToggleGroup",state:"value"}),b=Xe((R,O,I)=>{let D;if(l?(D=g.slice(),O?D.push(R):D.splice(g.indexOf(R),1)):D=O?[R]:[],Array.isArray(D)){if(s?.(D,I),I.isCanceled)return;_(D)}}),x=k.useMemo(()=>({disabled:E,multiple:l,orientation:o}),[E,o,l]),T=k.useMemo(()=>({disabled:E,orientation:o,setGroupValue:b,value:g}),[E,o,b,g]),w={role:"group"},C=Tt("div",t,{enabled:!!m,state:x,ref:n,props:[w,p],stateAttributesMapping:V$});return y.jsx(Hte.Provider,{value:T,children:m?C:y.jsx(Sx,{render:d,className:f,state:x,refs:[n],props:[w,p],stateAttributesMapping:V$,loopFocus:a})})});function OSe(e){return Tt(e.defaultTagName??"div",e,e)}function RSe({className:e,...t}){return y.jsx("div",{"data-slot":"input-group",role:"group",className:We("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=input-group-control]:focus-visible]:ring-inset 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 has-[[data-slot][aria-invalid=true]]:ring-inset 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 ISe=Qc("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 NSe({className:e,align:t="inline-start",...n}){return y.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:We(ISe({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const DSe=Qc("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 zte({className:e,type:t="button",variant:n="ghost",size:r="xs",...i}){return y.jsx(Ye,{type:t,"data-size":r,variant:n,className:We(DSe({size:r}),e),...i})}function LSe({className:e,...t}){return y.jsx(sn,{"data-slot":"input-group-control",className:We("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 PSe=BEe;function MSe({className:e,children:t,...n}){return y.jsxs(mEe,{"data-slot":"combobox-trigger",className:We("[&_svg:not([class*='size-'])]:size-3.5",e),...n,children:[t,y.jsx(ve,{icon:Ay,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})]})}function jSe({className:e,...t}){return y.jsx(EEe,{"data-slot":"combobox-clear",render:y.jsx(zte,{variant:"ghost",size:"icon-xs"}),className:We(e),...t,children:y.jsx(ve,{icon:aa,strokeWidth:2,className:"pointer-events-none"})})}function FSe({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return y.jsxs(RSe,{className:We("w-auto",e),children:[y.jsx(yEe,{render:y.jsx(LSe,{disabled:n}),...a}),y.jsxs(NSe,{align:"inline-end",children:[r&&y.jsx(zte,{size:"icon-xs",variant:"ghost",render:y.jsx(MSe,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:n}),i&&y.jsx(jSe,{disabled:n})]}),t]})}function BSe({className:e,side:t="bottom",sideOffset:n=6,align:r="start",alignOffset:i=0,anchor:a,...s}){return y.jsx(AEe,{children:y.jsx(kEe,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:"isolate z-50",children:y.jsx(REe,{"data-slot":"combobox-content","data-chips":!!a,className:We("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),...s})})})}function USe({className:e,...t}){return y.jsx(TEe,{"data-slot":"combobox-list",className:We("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 $Se({className:e,children:t,...n}){return y.jsxs(DEe,{"data-slot":"combobox-item",className:We("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,y.jsx(UEe,{render:y.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:y.jsx(ve,{icon:_u,strokeWidth:2,className:"pointer-events-none"})})]})}function HSe({className:e,...t}){return y.jsx(LEe,{"data-slot":"combobox-empty",className:We("text-muted-foreground hidden w-full justify-center py-2 text-center text-xs/relaxed group-data-empty/combobox-content:flex",e),...t})}const zSe=Qc("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"}}),Vte=k.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function VSe({className:e,variant:t,size:n,spacing:r=0,orientation:i="horizontal",children:a,...s}){return y.jsx(kSe,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:We("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),...s,children:y.jsx(Vte.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function W$({className:e,children:t,variant:n="default",size:r="default",...i}){const a=k.useContext(Vte);return y.jsx(CSe,{"data-slot":"toggle-group-item","data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:We("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",zSe({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}async function Zt(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 wf="";function uM(){return or({queryKey:["tasks"],queryFn:()=>Zt(`${wf}/api/tasks`)})}function Wte(e){return or({queryKey:["tasks",e],queryFn:()=>Zt(`${wf}/api/tasks/${e}`),enabled:!!e})}function WSe(){const e=zr();return pr({mutationFn:t=>Zt(`${wf}/api/tasks`,{method:"POST",body:JSON.stringify({...t,status:"IN_PROGRESS"})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function GSe(){const e=zr();return pr({mutationFn:({taskId:t,status:n,position:r})=>Zt(`${wf}/api/tasks/${t}/status`,{method:"PATCH",body:JSON.stringify({status:n,position:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function cM(){const e=zr();return pr({mutationFn:({taskId:t,updates:n})=>Zt(`${wf}/api/tasks/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{taskId:n})=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["tasks",n]})}})}function Gte(){const e=zr();return pr({mutationFn:({taskId:t,deleteLinkedWorktree:n})=>{const r=n?`${wf}/api/tasks/${t}?deleteLinkedWorktree=true`:`${wf}/api/tasks/${t}`;return Zt(r,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}const Dy="";function qSe(e){return or({queryKey:["fs","list",e],queryFn:()=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return Zt(`${Dy}/api/fs/list${t}`)},enabled:e!==null})}function KSe(e){return or({queryKey:["git","branches",e],queryFn:()=>Zt(`${Dy}/api/git/branches?repo=${encodeURIComponent(e)}`),enabled:!!e})}function YSe(e,t={}){const{staged:n=!1,ignoreWhitespace:r=!1,includeUntracked:i=!1}=t;return or({queryKey:["git","diff",e,n,r,i],queryFn:()=>{const a=new URLSearchParams({path:e,...n&&{staged:"true"},...r&&{ignoreWhitespace:"true"},...i&&{includeUntracked:"true"}});return Zt(`${Dy}/api/git/diff?${a}`)},enabled:!!e,refetchInterval:5e3})}function XSe(e){return or({queryKey:["git","status",e],queryFn:()=>Zt(`${Dy}/api/git/status?path=${encodeURIComponent(e)}`),enabled:!!e,refetchInterval:5e3})}async function ZSe(e){return Zt(`${Dy}/api/fs/is-git-repo?path=${encodeURIComponent(e)}`)}const fl="",nn={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"},QSe=7777;function la(e){return or({queryKey:["config",e],queryFn:()=>Zt(`${fl}/api/config/${e}`)})}function qte(){const e=la(nn.PORT);return{...e,data:e.data?.value??QSe,isDefault:e.data?.isDefault??!0}}function JSe(){const e=la(nn.WORKTREE_BASE_PATH);return{...e,data:e.data?.value??""}}function jx(){const e=la(nn.DEFAULT_GIT_REPOS_DIR);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Fx(){const e=la(nn.EDITOR_APP);return{...e,data:e.data?.value??"vscode",isDefault:e.data?.isDefault??!0}}function Bx(){const e=la(nn.EDITOR_HOST);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Ux(){const e=la(nn.EDITOR_SSH_PORT);return{...e,data:e.data?.value??22,isDefault:e.data?.isDefault??!0}}function exe(){const e=la(nn.LINEAR_API_KEY);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function txe(){const e=la(nn.GITHUB_PAT);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function nxe(){const e=la(nn.LANGUAGE);return{...e,data:e.data?.value??null,isDefault:e.data?.isDefault??!0}}function rxe(){const e=la(nn.THEME);return{...e,data:e.data?.value??"system",isDefault:e.data?.isDefault??!0}}function ixe(){const e=la(nn.SYNC_CLAUDE_CODE_THEME);return{...e,data:!!e.data?.value,isDefault:e.data?.isDefault??!0}}const G$=["light","light-ansi","light-daltonized","dark","dark-ansi","dark-daltonized"];function axe(){const e=la(nn.CLAUDE_CODE_LIGHT_THEME);return{...e,data:e.data?.value??"light-ansi",isDefault:e.data?.isDefault??!0}}function sxe(){const e=la(nn.CLAUDE_CODE_DARK_THEME);return{...e,data:e.data?.value??"dark-ansi",isDefault:e.data?.isDefault??!0}}function oxe(){const e=la(nn.BASIC_AUTH_USERNAME);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function lxe(){const e=la(nn.BASIC_AUTH_PASSWORD);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function dM(){const e=zr();return pr({mutationFn:({key:t,value:n})=>Zt(`${fl}/api/config/${t}`,{method:"PUT",body:JSON.stringify({value:n})}),onSuccess:(t,{key:n})=>{e.invalidateQueries({queryKey:["config",n]}),n===nn.GITHUB_PAT&&(e.invalidateQueries({queryKey:["github-user"]}),e.invalidateQueries({queryKey:["github-prs"]}),e.invalidateQueries({queryKey:["github-issues"]}),e.invalidateQueries({queryKey:["github-orgs"]}))}})}function uxe(){const e=zr();return pr({mutationFn:t=>Zt(`${fl}/api/config/${t}`,{method:"DELETE"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["config",n]})}})}function cxe(){return or({queryKey:["config","notifications"],queryFn:()=>Zt(`${fl}/api/config/notifications`)})}function dxe(){const e=zr();return pr({mutationFn:t=>Zt(`${fl}/api/config/notifications`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","notifications"]})}})}function fxe(){return pr({mutationFn:e=>Zt(`${fl}/api/config/notifications/test/${e}`,{method:"POST"})})}function hxe(){return or({queryKey:["config","z-ai"],queryFn:()=>Zt(`${fl}/api/config/z-ai`)})}function pxe(){const e=zr();return pr({mutationFn:t=>Zt(`${fl}/api/config/z-ai`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","z-ai"]}),e.invalidateQueries({queryKey:["monitoring","claude-usage"]})}})}function Kte(){return or({queryKey:["config","developer-mode"],queryFn:()=>Zt(`${fl}/api/config/developer-mode`),staleTime:1/0})}function mxe(){return pr({mutationFn:()=>Zt(`${fl}/api/config/restart`,{method:"POST"})})}const Ly="";function Py(){return or({queryKey:["repositories"],queryFn:()=>Zt(`${Ly}/api/repositories`)})}function gxe(e){return or({queryKey:["repositories",e],queryFn:()=>Zt(`${Ly}/api/repositories/${e}`),enabled:!!e})}function Yte(){const e=zr();return pr({mutationFn:t=>Zt(`${Ly}/api/repositories`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function bxe(){const e=zr();return pr({mutationFn:({id:t,updates:n})=>Zt(`${Ly}/api/repositories/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{id:n})=>{e.invalidateQueries({queryKey:["repositories"]}),e.invalidateQueries({queryKey:["repositories",n]})}})}function Xte(){const e=zr();return pr({mutationFn:t=>Zt(`${Ly}/api/repositories/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function My({className:e,children:t,...n}){return y.jsxs(fSe,{"data-slot":"scroll-area",className:We("relative",e),...n,children:[y.jsx(bSe,{"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}),y.jsx(vxe,{}),y.jsx(ESe,{})]})}function vxe({className:e,orientation:t="vertical",...n}){return y.jsx(ySe,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:We("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:y.jsx(_Se,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function jy({open:e,onOpenChange:t,onSelect:n,initialPath:r}){const[i,a]=k.useState(r||null),[s,o]=k.useState(""),[l,u]=k.useState("");k.useEffect(()=>{e&&(a(r||null),o(""),u(""))},[e,r]);const{data:f,isLoading:d,error:p}=qSe(e?i??"":null),m=x=>{f&&(a(f.path+"/"+x),u(""))},S=()=>{f?.parent&&f.parent!==f.path&&(a(f.parent),u(""))},E=()=>{a(null),u("")},g=()=>{s.trim()&&(a(s.trim()),u(""))},_=x=>{n(x),t(!1)},b=f?.entries.filter(x=>x.name.toLowerCase().includes(l.toLowerCase()));return y.jsx(ul,{open:e,onOpenChange:t,children:y.jsxs(cl,{className:"sm:max-w-lg overflow-hidden",children:[y.jsxs(Su,{children:[y.jsx(xu,{children:"Select Git Repository"}),y.jsx(Ry,{children:"Choose an existing git repository"})]}),y.jsx("p",{className:"text-xs text-muted-foreground",children:"Click folder names to navigate • Use action buttons to select"}),y.jsx(A_e,{}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{className:"text-xs font-medium",children:"Enter path manually:"}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx(sn,{value:s,onChange:x=>o(x.target.value),placeholder:"/path/to/your/project",onKeyDown:x=>x.key==="Enter"&&g(),className:"flex-1"}),y.jsx(Ye,{variant:"outline",size:"sm",onClick:g,children:"Go"})]})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{className:"text-xs font-medium",children:"Search current directory:"}),y.jsxs("div",{className:"relative",children:[y.jsx(ve,{icon:Mee,size:14,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),y.jsx(sn,{value:l,onChange:x=>u(x.target.value),placeholder:"Filter folders and files...",className:"pl-8"})]})]}),y.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y.jsx(Ye,{variant:"outline",size:"icon-sm",onClick:E,title:"Home",className:"shrink-0",children:y.jsx(ve,{icon:t1e,size:14,strokeWidth:2})}),y.jsx(Ye,{variant:"outline",size:"icon-sm",onClick:S,disabled:!f||f.parent===f.path,title:"Parent directory",className:"shrink-0",children:y.jsx(ve,{icon:WP,size:14,strokeWidth:2})}),y.jsx("code",{className:"min-w-0 flex-1 text-xs bg-muted/50 px-2 py-1 rounded truncate overflow-hidden",children:f?.path||"~"}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:()=>f&&_(f.path),disabled:!f,className:"shrink-0 max-sm:px-2",title:"Select current directory",children:[y.jsx(ve,{icon:MN,size:14,strokeWidth:2,className:"sm:hidden"}),y.jsx("span",{className:"max-sm:hidden",children:"Select Current"})]})]}),y.jsx(My,{className:"h-64 border rounded-md",children:y.jsxs("div",{className:"p-1",children:[d&&y.jsx("div",{className:"text-muted-foreground text-xs p-3",children:"Loading..."}),p&&y.jsx("div",{className:"text-destructive text-xs p-3",children:p.message}),f&&b&&y.jsxs(y.Fragment,{children:[b.length===0&&y.jsx("div",{className:"text-muted-foreground text-xs p-3",children:l?"No matches found":"Empty directory"}),b.map(x=>y.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted group",children:x.type==="directory"?y.jsxs(y.Fragment,{children:[y.jsx(ve,{icon:x.isGitRepo?MN:Pi,size:16,strokeWidth:2,className:(x.isGitRepo,"text-accent")}),y.jsx("button",{onClick:()=>m(x.name),className:"flex-1 text-left text-xs truncate hover:underline",children:x.name}),x.isGitRepo&&y.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-accent/50 text-accent font-medium shrink-0",children:[y.jsx("span",{className:"max-sm:hidden",children:"git repo"}),y.jsx("span",{className:"sm:hidden",children:"git"})]})]}):y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"w-4"}),y.jsx("span",{className:"flex-1 text-xs text-muted-foreground truncate",children:x.name})]})},x.name))]})]})}),y.jsxs(Uf,{children:[y.jsx(Oy,{render:y.jsx(Ye,{variant:"outline"}),children:"Cancel"}),y.jsx(Ye,{onClick:()=>f&&_(f.path),disabled:!f,children:"Select Path"})]})]})})}function yxe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function _xe(e){const t=yxe(e);if(!t)return"";const n=Math.random().toString(36).substring(2,6);return`${t}-${n}`}function fM({open:e,onOpenChange:t,defaultRepository:n,showTrigger:r=!0}={}){const{t:i}=an("tasks"),{t:a}=an("common"),[s,o]=k.useState(!1),l=e??s,u=t??o,[f,d]=k.useState(!1),[p,m]=k.useState(""),[S,E]=k.useState(""),[g,_]=k.useState(""),[b,x]=k.useState(""),[T,w]=k.useState(""),[C,R]=k.useState(""),[O,I]=k.useState("default"),[D,P]=k.useState(!1),[H,M]=k.useState(null),[W,V]=k.useState("browse"),[$,q]=k.useState(""),[K,U]=k.useState(null),[F,B]=k.useState(!1),Y=ss(),z=WSe(),J=Yte(),ee=k.useRef(null),{data:te}=JSe(),{data:Z}=jx(),{data:G}=Py(),{data:Q,isLoading:ae}=KSe(g||null),se=H?G?.find(Se=>Se.id===H):null,ne=k.useMemo(()=>{if(!G)return[];if(se&&$===se.displayName||!$.trim())return G;const Se=$.toLowerCase();return G.filter($e=>$e.displayName.toLowerCase().includes(Se)||$e.path.toLowerCase().includes(Se))},[G,$,se]);k.useEffect(()=>{G&&G.length>0?V("saved"):V("browse")},[G]),k.useEffect(()=>{if(l){if(n)M(n.id),_(n.path),q(n.displayName),V("saved");else if(G&&G.length>0){const Se=G[0];M(Se.id),_(Se.path),q(Se.displayName),V("saved")}}},[l,n,G]),k.useEffect(()=>{x(Q?Q.current||Q.branches[0]||"main":"")},[Q,g]);const ye=Se=>{m(Se),R(_xe(Se))},Ee=async Se=>{U(null),B(!0);try{if(!(await ZSe(Se)).isGitRepo){U(i("createModal.errors.notGitRepo")),B(!1);return}if(_(Se),M(null),!G?.find(we=>we.path===Se)){const we=Se.split("/").pop()||"Unknown";J.mutate({path:Se,displayName:we})}}catch($e){U($e instanceof Error?$e.message:i("createModal.errors.validationFailed"))}finally{B(!1)}},he=Se=>{if(Se.preventDefault(),!p.trim()||!g)return;const $e=g.split("/").pop()||"repo",Te=T.trim()||C,we=`${te}/${Te}`;z.mutate({title:p.trim(),description:S.trim(),aiMode:O,repoPath:g,repoName:$e,baseBranch:b||"main",branch:Te,worktreePath:we,copyFiles:se?.copyFiles||void 0,startupScript:se?.startupScript||void 0},{onSuccess:le=>{const me=S.trim()?{aiMode:O,description:S.trim()}:{aiMode:O};u(!1),m(""),E(""),_(""),x(""),w(""),R(""),I("default"),P(!1),M(null),q(""),U(null),V(G&&G.length>0?"saved":"browse"),Y({to:"/tasks/$taskId",params:{taskId:le.id},state:me})},onError:le=>{dn.error(i("createModal.errors.createFailed"),{description:le instanceof Error?le.message:String(le)})}})},_e=!z.isPending&&!!p.trim()&&!!g;Ts("meta+enter",()=>{ee.current&&ee.current.requestSubmit()},{enabled:l&&_e,allowInInput:!0,ignoreContext:!0,deps:[l,_e]});const be=T.trim()||C,Ke=be?`${te}/${be}`:"";return y.jsxs(y.Fragment,{children:[y.jsxs(ul,{open:l,onOpenChange:u,children:[r&&y.jsxs(ZP,{render:y.jsx(Ye,{size:"sm"}),children:[y.jsx(ve,{icon:qP,size:16,strokeWidth:2,"data-slot":"icon",className:"-translate-y-px"}),i("newTask")]}),y.jsx(cl,{className:"sm:max-w-md max-h-[80dvh] flex flex-col overflow-hidden",children:y.jsxs("form",{ref:ee,onSubmit:he,className:"flex flex-col min-h-0 flex-1",children:[y.jsxs(Su,{className:"shrink-0",children:[y.jsx(xu,{children:i("createModal.title")}),y.jsx(Ry,{children:i("createModal.description")})]}),y.jsxs(nu,{className:"mt-4 pb-4 overflow-y-auto min-h-0 flex-1",children:[y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"title",children:i("createModal.fields.title")}),y.jsx(sn,{id:"title",value:p,onChange:Se=>ye(Se.target.value),placeholder:i("createModal.fields.titlePlaceholder"),required:!0})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"description",children:i("createModal.fields.description")}),y.jsx(ete,{id:"description",value:S,onValueChange:Se=>{E(Se),D||I(Se.trim()?"plan":"default")},placeholder:i("createModal.fields.descriptionPlaceholder"),rows:2})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{children:i("createModal.fields.aiMode")}),y.jsxs(VSe,{value:[O],onValueChange:Se=>{const $e=Array.isArray(Se)?Se[0]:Se;$e&&(I($e),P(!0))},className:"w-full",variant:"outline",children:[y.jsx(W$,{value:"plan",className:"flex-1",children:i("createModal.aiModes.plan")}),y.jsx(W$,{value:"default",className:"flex-1",children:i("createModal.aiModes.default")})]})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{children:i("createModal.fields.repository")}),y.jsxs(Dc,{value:W,onValueChange:Se=>{V(Se),U(null)},children:[y.jsxs(Lc,{children:[y.jsx(Ii,{value:"saved",disabled:!G?.length,children:i("createModal.tabs.saved")}),y.jsx(Ii,{value:"browse",children:i("createModal.tabs.browse")})]}),y.jsx(_a,{value:"saved",className:"mt-2",children:y.jsxs(PSe,{value:H||"",onValueChange:Se=>{const $e=G?.find(Te=>Te.id===Se);$e&&(M(Se),_($e.path),q($e.displayName),U(null))},inputValue:$,onInputValueChange:Se=>{q(Se),se&&Se!==se.displayName&&M(null)},itemToStringLabel:Se=>G?.find($e=>$e.id===Se)?.displayName||"",children:[y.jsx(FSe,{placeholder:i("createModal.searchRepositories"),className:"w-full"}),y.jsx(BSe,{children:y.jsxs(USe,{children:[y.jsx(HSe,{children:i("createModal.noRepositoriesFound")}),ne.map(Se=>y.jsx($Se,{value:Se.id,children:Se.displayName},Se.id))]})})]})}),y.jsx(_a,{value:"browse",className:"mt-2",children:y.jsxs(Ye,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>d(!0),disabled:F,children:[y.jsx(ve,{icon:Pi,size:14,strokeWidth:2,className:"mr-2"}),F?y.jsx("span",{className:"text-muted-foreground",children:a("status.validating")}):g&&!H?y.jsx("span",{className:"truncate",children:g}):y.jsx("span",{className:"text-muted-foreground group-hover/button:text-accent-foreground",children:i("createModal.selectFolder")})]})})]}),K&&y.jsx("p",{className:"text-sm text-destructive",children:K}),g&&!K&&y.jsx(Yi,{className:"font-mono text-xs truncate",children:g})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"baseBranch",children:i("createModal.fields.baseBranch")}),y.jsxs(Qi,{value:b,onValueChange:Se=>x(Se??""),disabled:!g||ae,children:[y.jsx(ea,{className:"w-full",children:y.jsx(Ji,{children:b||y.jsx("span",{className:"text-muted-foreground",children:i(g?ae?"createModal.loadingBranches":"createModal.selectBranch":"createModal.selectRepositoryFirst")})})}),y.jsx(ta,{children:Q?.branches.map(Se=>y.jsxs(Nn,{value:Se,children:[Se,Se===Q.current&&y.jsx("span",{className:"text-muted-foreground ml-2",children:i("createModal.current")})]},Se))})]})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"branch",children:i("createModal.fields.branchName")}),y.jsx(sn,{id:"branch",value:T,onChange:Se=>w(Se.target.value),placeholder:C||i("createModal.fields.branchPlaceholder")}),Ke&&y.jsxs(Yi,{children:[i("createModal.worktreePrefix")," ",Ke]}),!T.trim()&&C&&y.jsx(Yi,{children:i("createModal.branchAutoGenerated",{branch:C})})]})]}),y.jsxs(Uf,{className:"mt-4 shrink-0",children:[y.jsx(Oy,{render:y.jsx(Ye,{variant:"outline",type:"button",className:"border-destructive text-destructive hover:bg-destructive hover:text-white"}),children:a("buttons.cancel")}),y.jsx(Ye,{type:"submit",disabled:z.isPending||!p.trim()||!g,children:z.isPending?a("status.creating"):i("createModal.createTask")})]})]})})]}),y.jsx(jy,{open:f,onOpenChange:d,onSelect:Ee,initialPath:Z||void 0})]})}const q$=[{to:"/tasks",icon:Dp,labelKey:"header.tasks",matchPrefix:!0},{to:"/terminals",icon:Cx,labelKey:"header.terminals",matchPrefix:!1},{to:"/repositories",icon:FN,labelKey:"header.repositories",matchPrefix:!0},{to:"/review",icon:TE,labelKey:"header.review",matchPrefix:!0},{to:"/monitoring",icon:G0e,labelKey:"header.monitoring",matchPrefix:!0}];function Exe({onNewTaskRef:e,onOpenCommandPalette:t}){const{t:n}=an("navigation"),{location:r}=ei(),i=r.pathname,[a,s]=k.useState(!1),o=(l,u)=>u?i.startsWith(l):i===l;return k.useEffect(()=>{e?.(()=>s(!0))},[e]),y.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:[y.jsxs("div",{className:"flex min-w-0 items-center gap-4 max-sm:gap-2",children:[y.jsx(h1e,{className:"lg:hidden",children:y.jsx(p1e,{children:y.jsxs(m1e,{children:[y.jsxs(b1e,{className:"bg-transparent hover:bg-muted/50 data-open:bg-muted/50 gap-1 px-2",children:[y.jsx(ve,{icon:o1e,size:16,strokeWidth:2}),y.jsx("span",{className:"sr-only",children:"Menu"})]}),y.jsx(v1e,{className:"min-w-48",children:q$.map(l=>y.jsxs(_1e,{href:l.to,active:o(l.to,l.matchPrefix),render:y.jsx(Li,{to:l.to}),children:[y.jsx(ve,{icon:l.icon,size:16,strokeWidth:2}),n(l.labelKey)]},l.to))})]})})}),y.jsx("nav",{className:"hidden items-center gap-1 lg:flex",children:q$.map(l=>{const u=o(l.to,l.matchPrefix);return y.jsxs(Li,{to:l.to,className:We("relative flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium transition-colors",u?"bg-background text-foreground":"text-foreground/60 hover:text-foreground","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-foreground after:transition-opacity",u?"after:opacity-100":"after:opacity-0"),children:[y.jsx(ve,{icon:l.icon,size:16,strokeWidth:2,"data-slot":"icon"}),n(l.labelKey)]},l.to)})})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.jsx(fM,{open:a,onOpenChange:s}),y.jsx(Ye,{variant:"ghost",size:"icon-sm",onClick:t,title:n("header.commandPalette",{shortcut:"⌘K"}),children:y.jsx(ve,{icon:PN,size:16,strokeWidth:2})}),y.jsx(Li,{to:"/settings",className:We("relative flex items-center justify-center rounded-md p-1.5 transition-colors",i==="/settings"?"bg-background text-foreground":"text-foreground/60 hover:text-foreground","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-foreground after:transition-opacity",i==="/settings"?"after:opacity-100":"after:opacity-0"),children:y.jsx(ve,{icon:jee,size:16,strokeWidth:2})})]})]})}function Sxe(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}const xxe=10,wxe=2e3;function Txe(){const e=zr(),{resolvedTheme:t}=Pf(),n=k.useRef(null),r=k.useRef(void 0),i=k.useRef(0),a=k.useRef(void 0),s=k.useCallback(l=>{try{const u=JSON.parse(l.data);if(u.type==="task:updated")e.invalidateQueries({queryKey:["tasks"]});else if(u.type==="notification"&&"payload"in u){const{id:f,title:d,message:p,notificationType:m,playSound:S,isCustomSound:E}=u.payload,_=S&&!E?"/goat.jpeg":t==="dark"?"/logo-dark.jpg":"/logo-light.jpg",b=y.jsx("img",{src:_,alt:"",className:"size-8 shrink-0 aspect-square rounded-sm object-cover"});switch(m){case"success":dn.success(d,{description:p,icon:b});break;case"error":dn.error(d,{description:p,icon:b});break;case"warning":dn.warning(d,{description:p,icon:b});break;default:dn.info(d,{description:p,icon:b});break}if("Notification"in window&&window.parent===window&&Notification.permission==="granted"&&new Notification(d,{body:p,icon:_,tag:f}),S){const T=localStorage.getItem("vibora:lastSoundPlayed"),w=Date.now();if(T&&w-parseInt(T)<1e3)return;localStorage.setItem("vibora:lastSoundPlayed",String(w));let C=!1;const R=()=>{if(C)return;C=!0,new Audio("/sounds/goat-bleat.mp3").play().catch(()=>{})},O=new Audio("/api/uploads/sound");O.onerror=R,O.play().catch(R)}window.parent!==window&&window.parent.postMessage({type:"vibora:notification",title:d,message:p,notificationType:m},"*")}}catch{}},[e,t]),o=k.useCallback(()=>{const l=n.current;if(l&&(l.readyState===WebSocket.CONNECTING||l.readyState===WebSocket.OPEN))return;const u=Sxe(),f=new WebSocket(u);n.current=f,f.onopen=()=>{i.current=0},f.onmessage=s,f.onclose=()=>{n.current===f&&(n.current=null),i.current<xxe&&(i.current++,r.current=setTimeout(()=>{a.current?.()},wxe))},f.onerror=()=>{}},[s]);a.current=o,k.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]),k.useEffect(()=>(o(),()=>{r.current&&clearTimeout(r.current);const l=n.current;l&&(l.readyState===WebSocket.OPEN&&l.close(),n.current=null)}),[o])}const Cxe={save:"Save Changes",cancel:"Cancel",delete:"Delete",create:"Create",reset:"Reset to default",browse:"Browse",clearFilters:"Clear filters"},Axe={loading:"Loading...",saving:"Saving...",saved:"Saved",error:"Error",calculating:"calculating...",validating:"Validating...",creating:"Creating...",deleting:"Deleting...",loggingIn:"Logging in..."},kxe={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"},Oxe={one:"{{count}} result",other:"{{count}} results"},Rxe={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled",ORPHANED:"Orphaned"},Ixe={loginTitle:"Login to Vibora",username:"Username",password:"Password",login:"Login",loginFailed:"Login failed"},Nxe={buttons:Cxe,status:Axe,time:kxe,results:Oxe,statuses:Rxe,auth:Ixe},Dxe={tasks:"Tasks",terminals:"Terminals",worktrees:"Worktrees",repositories:"Repositories",review:"Review",monitoring:"Monitoring",settings:"Settings",commandPalette:"Command Palette ({{shortcut}})"},Lxe={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"}},Pxe={title:"Keyboard Shortcuts",groups:{navigation:"Navigation",actions:"Actions",terminals:"Terminals (Desktop)",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",newTerminal:"New Terminal",closeTerminal:"Close Terminal",submitForm:"Submit Form"}},Mxe={header:Dxe,commandPalette:Lxe,shortcuts:Pxe},jxe="Tasks",Fxe="Search",Bxe="All Repos",Uxe="New Task",$xe={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",createFailed:"Failed to create task"}},Hxe={title:jxe,searchPlaceholder:Fxe,allRepos:Bxe,newTask:Uxe,createModal:$xe},zxe="Settings",Vxe={server:"Server",serverDefaults:"Server & Defaults",paths:"Paths",authentication:"Authentication",editor:"Editor",integrations:"Integrations",zai:"z.ai",notifications:"Notifications",appearance:"Appearance",developer:"Developer"},Wxe={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)"}}},Gxe={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"},qxe={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 for details."},Kxe={title:"Unsaved Changes",description:"You have unsaved changes that will be lost if you leave this page.",stay:"Stay",leave:"Leave"},Yxe={title:zxe,sections:Vxe,fields:Wxe,notifications:Gxe,developer:qxe,unsavedChanges:Kxe},Xxe="Review",Zxe={pullRequests:"Pull Requests",issues:"Issues"},Qxe={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"},Jxe={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"},ewe={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"},twe={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"}},nwe={title:Xxe,tabs:Zxe,filters:Qxe,github:Jxe,prs:ewe,issues:twe},rwe="Worktrees",iwe={total:"{{count}} total",orphaned:"{{count}} orphaned"},awe={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."},swe={noMatch:"No worktrees match the selected filters.",noWorktrees:"No worktrees found. Worktrees are created when you create tasks."},owe={failedToLoad:"Failed to load worktrees: {{message}}"},lwe={title:rwe,summary:iwe,cleanup:awe,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:swe,error:owe},uwe="Monitoring",cwe={claude:"Claude Instances",system:"System Metrics",processes:"Processes",vibora:"Vibora Servers",worktrees:"Worktrees",usage:"Usage Limits"},dwe={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}}"},fwe={cpuUsage:"CPU Usage",memoryUsage:"Memory Usage",memoryLabels:{used:"Used",cache:"Cache / Buffers"},diskUsage:"Disk Usage ({{path}})",error:"Failed to load system metrics: {{message}}"},hwe={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"},pwe={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}}"},mwe={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}}"},gwe={title:uwe,tabs:cwe,claude:dwe,system:fwe,processes:hwe,vibora:pwe,usage:mwe},bwe="Tasks",vwe="New Terminal",ywe="All Repos",_we={title:"Edit Tab",name:"Name",namePlaceholder:"Tab name",directory:"Directory",directoryPlaceholder:"Select a directory...",clearDirectory:"Clear directory",cancel:"Cancel",save:"Save"},Ewe={title:"New Tab",create:"Create"},Swe={taskTerminals:bwe,newTerminal:vwe,allRepos:ywe,editTab:_we,newTab:Ewe},xwe="Repositories",wwe="{{count}} total",Twe="New Task",Cwe="Tasks",Awe="Terminal",kwe="Editor",Owe="Settings",Rwe="Add Repository",Iwe="Open in Terminal",Nwe="Open in {{editor}}",Dwe={openInVSCode:"Open in VS Code"},Lwe={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.",isCopierTemplate:"Use as Copier Template",isCopierTemplateDescription:"Mark as a template for creating new projects."},adding:"Adding...",cancel:"Cancel"},Pwe={button:"New Project",title:"Create New Project",back:"Back",next:"Next",create:"Create Project",steps:{template:{description:"Select a template to create your project from.",savedTemplates:"Saved Templates",selectTemplate:"Select a template...",or:"or",customUrl:"Custom Template URL/Path",customUrlHelp:"Git URL or local path to a Copier template."},questions:{description:"Configure your project.",noQuestions:"This template has no configuration questions."},output:{description:"Choose where to create your project.",projectName:"Project Name",outputDirectory:"Output Directory",selectDirectory:"Select directory...",willCreate:"Will create"},creating:{description:"Creating your project...",inProgress:"Running Copier..."}}},Mwe={noRepositories:"No repositories added yet. Add a repository for quick access when creating tasks."},jwe={failedToLoad:"Failed to load repositories: {{message}}"},Fwe={title:xwe,total:wwe,newTask:Twe,viewTasks:Cwe,terminal:Awe,editor:kwe,settings:Owe,addRepository:Rwe,openInTerminal:Iwe,openInEditor:Nwe,card:Dwe,delete:{title:"Delete Repository",description:'This will remove "{{name}}" from Vibora. The actual repository files will not be affected.',button:"Delete",deleting:"Deleting..."},addModal:Lwe,newProject:Pwe,empty:Mwe,error:jwe},Bwe={save:"保存更改",cancel:"取消",delete:"删除",create:"创建",reset:"重置为默认值",browse:"浏览",clearFilters:"清除筛选"},Uwe={loading:"加载中...",saving:"保存中...",saved:"已保存",error:"错误",calculating:"计算中...",validating:"验证中...",creating:"创建中...",deleting:"删除中...",loggingIn:"登录中..."},$we={justNow:"刚刚",minuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",hourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",dayAgo:"1 天前",daysAgo:"{{count}} 天前"},Hwe={one:"{{count}} 个结果",other:"{{count}} 个结果"},zwe={IN_PROGRESS:"进行中",IN_REVIEW:"审核中",DONE:"已完成",CANCELED:"已取消",ORPHANED:"孤立"},Vwe={loginTitle:"登录 Vibora",username:"用户名",password:"密码",login:"登录",loginFailed:"登录失败"},Wwe={buttons:Bwe,status:Uwe,time:$we,results:Hwe,statuses:zwe,auth:Vwe},Gwe={tasks:"任务",terminals:"终端",worktrees:"工作树",repositories:"仓库",review:"审核",monitoring:"监控",settings:"设置",commandPalette:"命令面板 ({{shortcut}})"},qwe={placeholder:"输入命令或搜索...",noResults:"未找到命令",categories:{navigation:"导航",actions:"操作"},commands:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",newTask:"新建任务",keyboardShortcuts:"键盘快捷键"}},Kwe={title:"键盘快捷键",groups:{navigation:"导航",actions:"操作",general:"通用"},labels:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",commandPalette:"命令面板",newTask:"新建任务",keyboardShortcuts:"键盘快捷键",closeModal:"关闭弹窗"}},Ywe={header:Gwe,commandPalette:qwe,shortcuts:Kwe},Xwe="任务",Zwe="搜索",Qwe="全部仓库",Jwe="新建任务",eTe={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:"验证仓库失败",createFailed:"创建任务失败"}},tTe={title:Xwe,searchPlaceholder:Zwe,allRepos:Qwe,newTask:Jwe,createModal:eTe},nTe="设置",rTe={server:"服务器",serverDefaults:"服务器与默认设置",paths:"路径",authentication:"身份验证",editor:"编辑器",integrations:"集成",zai:"z.ai",notifications:"通知",appearance:"外观",developer:"开发者"},iTe={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":"深色(色盲友好)"}}},aTe={enable:"启用通知",sound:"声音",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"应用令牌",userKey:"用户密钥",testSuccess:"{{channel}} 测试成功",testFailed:"{{channel}} 测试失败:{{error}}",uploadSound:"上传自定义声音",deleteSound:"删除自定义声音",testSound:"测试声音",soundUploaded:"自定义声音已上传",soundUploadFailed:"上传声音失败:{{error}}",soundDeleted:"自定义声音已删除",soundDeleteFailed:"删除自定义声音失败",customSoundActive:"使用自定义声音"},sTe={restartButton:"重启 Vibora",restarting:"重启中...",restartDescription:"重新构建并重启 Vibora 服务器。如果构建失败,服务器将继续运行。",restartFailed:"重启失败",checkLogs:"构建可能失败。运行 journalctl --user -u vibora 查看详情。"},oTe={title:"未保存的更改",description:"您有未保存的更改,离开此页面将丢失这些更改。",stay:"留下",leave:"离开"},lTe={title:nTe,sections:rTe,fields:iTe,notifications:aTe,developer:sTe,unsavedChanges:oTe},uTe="审核",cTe={pullRequests:"拉取请求",issues:"问题"},dTe={pr:{created:"我创建的",assigned:"分配给我的",reviewRequested:"待我审核",mentioned:"提及我的"},issue:{assigned:"分配给我的",created:"我创建的",mentioned:"提及我的"},allOrgs:"所有组织",allOrganizations:"所有组织",viboraReposOnly:"仅 Vibora 仓库"},fTe={tokenRequired:"需要 GitHub 令牌",tokenDescription:"要查看您的问题和拉取请求,请在设置中添加 GitHub 个人访问令牌。",requiredScopes:"所需权限:",scopes:{repo:"(用于私有仓库)",readUser:"(用于用户信息)",readOrg:"(用于组织列表)"},generateToken:"生成令牌",goToSettings:"前往设置"},hTe={loading:"加载中...",failedToLoad:"加载拉取请求失败",empty:{all:"没有打开的拉取请求",created:"没有您创建的拉取请求",assigned:"没有分配给您的拉取请求",reviewRequested:"没有等待您审核的拉取请求",mentioned:"没有提及您的拉取请求"},draft:"草稿"},pTe={loading:"加载中...",failedToLoad:"加载问题失败",empty:{assigned:"没有分配给您的问题",created:"没有您创建的问题",mentioned:"没有提及您的问题"}},mTe={title:uTe,tabs:cTe,filters:dTe,github:fTe,prs:hTe,issues:pTe},gTe="工作树",bTe={total:"共 {{count}} 个",orphaned:"{{count}} 个孤立"},vTe={button:"清理 ({{count}})",title:"删除已完成的工作树",description:"这将永久删除 {{count}} 个工作树。",linkedTasksWillBeDeleted:"关联的任务也将被删除。",alsoDeleteLinkedTasks:"同时删除关联的任务",done:"已完成",canceled:"已取消",cannotUndo:"此操作无法撤销。"},yTe={noMatch:"没有匹配所选筛选条件的工作树。",noWorktrees:"未找到工作树。工作树在创建任务时自动生成。"},_Te={failedToLoad:"加载工作树失败:{{message}}"},ETe={title:gTe,summary:bTe,cleanup:vTe,delete:{title:"删除工作树",description:"这将永久删除位于以下位置的工作树目录",linkedTaskWillBeDeleted:'关联的任务 "{{title}}" 也将被删除。',alsoDeleteLinkedTask:'同时删除关联的任务 "{{title}}"',cannotUndo:"此操作无法撤销。",button:"删除 {{count}} 个"},empty:yTe,error:_Te},STe="监控",xTe={claude:"Claude 实例",system:"系统指标",processes:"进程",vibora:"Vibora 服务器",usage:"使用限额"},wTe={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}}"},TTe={cpuUsage:"CPU 使用率",memoryUsage:"内存使用率",memoryLabels:{used:"已使用",cache:"缓存/缓冲区"},diskUsage:"磁盘使用率 ({{path}})",error:"加载系统指标失败:{{message}}"},CTe={topProcesses:"热门进程",sortBy:{memory:"按内存",cpu:"按 CPU"},headers:{pid:"PID",name:"名称",command:"命令",memory:"内存"},empty:"未找到进程",error:"加载进程失败:{{message}}",containers:"容器",containersEmpty:"没有容器运行中",containersUnavailable:"Docker/Podman 不可用"},ATe={description:"运行中的 Vibora 开发服务器",instanceCount:"{{count}} 个实例运行中",headers:{port:"端口",mode:"模式",directory:"目录",ram:"内存",actions:"操作"},mode:{dev:"开发",prod:"生产"},vite:"Vite",kill:"终止",killing:"终止中...",empty:"没有 Vibora 实例运行中",error:"加载 Vibora 实例失败:{{message}}"},kTe={fiveHourBlock:"5小时配额",sevenDayRolling:"7天滚动配额",opusWeekly:"Opus 周配额",sonnetWeekly:"Sonnet 周配额",resetsIn:"{{time}}后重置",resetsAt:"{{time}}重置",weekProgress:"本周已过 {{percent}}%",unavailable:"Claude Code 使用数据不可用。请确保已登录 Claude Code。",error:"加载使用数据失败:{{message}}"},OTe={title:STe,tabs:xTe,claude:wTe,system:TTe,processes:CTe,vibora:ATe,usage:kTe},RTe="任务",ITe="新建终端",NTe="全部仓库",DTe={taskTerminals:RTe,newTerminal:ITe,allRepos:NTe},LTe="仓库",PTe="共 {{count}} 个",MTe="新建任务",jTe="添加仓库",FTe={openInVSCode:"在 VS Code 中打开"},BTe={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:"取消"},UTe={noRepositories:"尚未添加任何仓库。添加一个仓库以便在创建任务时快速访问。"},$Te={failedToLoad:"加载仓库失败:{{message}}"},HTe={title:LTe,total:PTe,newTask:MTe,addRepository:jTe,card:FTe,delete:{title:"删除仓库",description:'这将从 Vibora 中移除 "{{name}}"。实际的仓库文件不会受到影响。',button:"删除",deleting:"删除中..."},addModal:BTe,empty:UTe,error:$Te},zTe="common",HN=["en","zh"],VTe={en:{common:Nxe,navigation:Mxe,tasks:Hxe,settings:Yxe,review:nwe,worktrees:lwe,monitoring:gwe,terminals:Swe,repositories:Fwe},zh:{common:Wwe,navigation:Ywe,tasks:tTe,settings:lTe,review:mTe,worktrees:ETe,monitoring:OTe,terminals:DTe,repositories:HTe}};function WTe(){if(typeof window<"u"){const e=localStorage.getItem("vibora-language");if(e&&HN.includes(e))return e;const t=navigator.language.split("-")[0];if(HN.includes(t))return t}return"en"}Fi.use(Jme).init({resources:VTe,lng:WTe(),fallbackLng:"en",defaultNS:zTe,ns:["common","navigation","tasks","settings","review","worktrees","monitoring","terminals","repositories"],interpolation:{escapeValue:!1}});Fi.on("languageChanged",e=>{typeof window<"u"&&localStorage.setItem("vibora-language",e)});function Zte(){const{i18n:e}=an(),{data:t,isSuccess:n}=nxe(),r=dM();k.useEffect(()=>{n&&t&&t!==e.language&&e.changeLanguage(t)},[n,t,e]);const i=k.useCallback(async a=>{if(a)await e.changeLanguage(a);else{const s=navigator.language.split("-")[0],o=HN.includes(s)?s:"en";await e.changeLanguage(o)}r.mutate({key:nn.LANGUAGE,value:a??""})},[e,r]);return{language:e.language,savedLanguage:t,changeLanguage:i,isUpdating:r.isPending}}function Qte(){const{setTheme:e,resolvedTheme:t,theme:n}=Pf(),{data:r,isSuccess:i}=rxe(),{data:a}=ixe(),s=dM(),o=k.useRef(void 0),l=k.useRef(!1);k.useEffect(()=>{i&&r&&r!==n&&e(r)},[i,r,n,e]),k.useEffect(()=>{if(!t)return;const f=t==="dark"?"/logo-dark.jpg":"/logo-light.jpg";let d=document.querySelector('link[rel="icon"]');d||(d=document.createElement("link"),d.rel="icon",document.head.appendChild(d)),d.type="image/jpeg",d.href=f},[t]),k.useEffect(()=>{const f=l.current&&a&&o.current===!1;o.current=a,l.current=!0,t&&f&&Zt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:t})}).catch(()=>{})},[a,t]);const u=k.useCallback(f=>{if(e(f),s.mutate({key:nn.THEME,value:f==="system"?"":f}),a){const d=f==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":f;Zt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:d})}).catch(()=>{})}},[e,s,a]);return{theme:n??"system",resolvedTheme:t,savedTheme:r,syncClaudeCode:a,changeTheme:u,isUpdating:s.isPending}}let ZA=!1;const K$={activeTabId:null,focusedTerminals:{},currentView:null,currentTaskId:null,isTabVisible:null,viewUpdatedAt:null};function Jte(){const e=zr(),t=k.useRef(void 0),n=k.useRef({}),{data:r=K$,isLoading:i}=or({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}),a=pr({mutationFn:async p=>{const m=await fetch("/api/terminal-view-state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!m.ok)throw new Error("Failed to update terminal view state");return m.json()},onSuccess:p=>{e.setQueryData(["terminal-view-state"],p)}}),s=k.useRef(a);s.current=a;const o=k.useCallback(p=>{const m=n.current;n.current={...m,...p,focusedTerminals:p.focusedTerminals||m.focusedTerminals?{...m.focusedTerminals,...p.focusedTerminals}:void 0};const S=n.current;e.setQueryData(["terminal-view-state"],E=>{const g=E??K$;return{activeTabId:S.activeTabId!==void 0?S.activeTabId:g.activeTabId,focusedTerminals:{...g.focusedTerminals,...S.focusedTerminals},currentView:S.currentView!==void 0?S.currentView:g.currentView,currentTaskId:S.currentTaskId!==void 0?S.currentTaskId:g.currentTaskId,isTabVisible:S.isTabVisible!==void 0?S.isTabVisible:g.isTabVisible,viewUpdatedAt:S.viewUpdatedAt!==void 0?S.viewUpdatedAt:g.viewUpdatedAt}}),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{s.current.mutate(n.current),n.current={}},500)},[e]),l=k.useCallback((p,m)=>{if(m===null){const S=e.getQueryData(["terminal-view-state"]);if(S){const{[p]:E,...g}=S.focusedTerminals;o({focusedTerminals:g})}}else o({focusedTerminals:{[p]:m}})},[e,o]),u=k.useCallback(p=>r.focusedTerminals[p]??null,[r.focusedTerminals]),f=k.useRef(!1);k.useEffect(()=>{if(ZA){f.current=!1;return}ZA=!0,f.current=!0;const p=()=>{o({isTabVisible:document.visibilityState==="visible",viewUpdatedAt:new Date().toISOString()})};return document.addEventListener("visibilitychange",p),p(),()=>{document.removeEventListener("visibilitychange",p),f.current&&(ZA=!1)}},[o]);const d=k.useCallback((p,m,S)=>{o({currentView:p,currentTaskId:m,activeTabId:S,viewUpdatedAt:new Date().toISOString()})},[o]);return{viewState:r,isLoading:i,getFocusedTerminal:u,setFocusedTerminal:l,updateViewTracking:d}}function Kl(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,a=0,s=0;for(;i<n.length&&a<r.length;)n[i]===r[a]&&(s+=1,a++),i++;return a===r.length?s:0}function GTe(e,t){return t.trim()?e.map(r=>{let i=Kl(r.label,t);if(r.keywords)for(const a of r.keywords){const s=Kl(a,t);s>i&&(i=s)}return{command:r,score:i}}).filter(({score:r})=>r>0).sort((r,i)=>i.score-r.score).map(({command:r})=>r):e}function qTe(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 KTe({open:e,onOpenChange:t,onNewTask:n,onShowShortcuts:r}){const{t:i}=an("navigation"),[a,s]=k.useState(!1),o=e??a,l=t??s,[u,f]=k.useState(""),[d,p]=k.useState(0),m=k.useRef(null),S=k.useRef(null),E=ss(),g=k.useMemo(()=>[{id:"goto-tasks",label:i("commandPalette.commands.goToTasks"),shortcut:"meta+1",keywords:["kanban","board","home"],category:"navigation",icon:y.jsx(ve,{icon:Dp,size:16,strokeWidth:2}),action:()=>{E({to:"/tasks"}),l(!1)}},{id:"goto-terminals",label:i("commandPalette.commands.goToTerminals"),shortcut:"meta+2",keywords:["shell","console","cli"],category:"navigation",icon:y.jsx(ve,{icon:K0e,size:16,strokeWidth:2}),action:()=>{E({to:"/terminals"}),l(!1)}},{id:"goto-task-terminals",label:i("commandPalette.commands.goToTaskTerminals"),shortcut:"meta+i",keywords:["tasks","shell","console","cli"],category:"navigation",icon:y.jsx(ve,{icon:Dp,size:16,strokeWidth:2}),action:()=>{E({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:y.jsx(ve,{icon:J0e,size:16,strokeWidth:2}),action:()=>{E({to:"/worktrees"}),l(!1)}},{id:"goto-repositories",label:i("commandPalette.commands.goToRepositories"),shortcut:"meta+4",keywords:["repos","git","projects"],category:"navigation",icon:y.jsx(ve,{icon:Y0e,size:16,strokeWidth:2}),action:()=>{E({to:"/repositories"}),l(!1)}},{id:"goto-settings",label:i("commandPalette.commands.goToSettings"),shortcut:"meta+,",keywords:["preferences","config","configuration"],category:"navigation",icon:y.jsx(ve,{icon:jee,size:16,strokeWidth:2}),action:()=>{E({to:"/settings"}),l(!1)}},{id:"new-task",label:i("commandPalette.commands.newTask"),shortcut:"meta+j",keywords:["create","add"],category:"actions",icon:y.jsx(ve,{icon:Ax,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:y.jsx(ve,{icon:e1e,size:16,strokeWidth:2}),action:()=>{l(!1),r?.()}}],[E,n,r,l,i]),_=k.useMemo(()=>GTe(g,u),[g,u]),b=k.useMemo(()=>qTe(_),[_]),x=k.useMemo(()=>{const C=[],R=["navigation","actions"];for(const O of R){const I=b.get(O);I&&C.push(...I)}return C},[b]);k.useEffect(()=>{p(0)},[u]),k.useEffect(()=>{if(!S.current)return;const C=S.current.querySelector('[data-selected="true"]');C&&C.scrollIntoView({block:"nearest"})},[d]),Ts("meta+k",()=>l(!0),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+1",()=>E({to:"/tasks"}),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+2",()=>E({to:"/terminals"}),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+i",()=>{E({to:"/terminals",search:{tab:"all-tasks"}})},{allowInInput:!0,allowInTerminal:!0}),Ts("meta+3",()=>E({to:"/worktrees"}),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+4",()=>E({to:"/repositories"}),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+,",()=>E({to:"/settings"}),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+j",()=>{n?.()},{allowInInput:!1,deps:[n]}),Ts("meta+/",()=>{r?.()},{allowInInput:!0,allowInTerminal:!0,deps:[r]});const T=k.useCallback(C=>{switch(C.key){case"ArrowDown":C.preventDefault(),p(R=>Math.min(R+1,x.length-1));break;case"ArrowUp":C.preventDefault(),p(R=>Math.max(R-1,0));break;case"Enter":C.preventDefault(),x[d]&&x[d].action();break;case"Escape":C.preventDefault(),l(!1);break}},[x,d,l]);k.useEffect(()=>{o&&(f(""),p(0),setTimeout(()=>m.current?.focus(),50))},[o]);let w=0;return y.jsx(ul,{open:o,onOpenChange:l,children:y.jsxs(cl,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden",showCloseButton:!1,onKeyDown:T,children:[y.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[y.jsx("span",{className:"text-muted-foreground mr-2",children:">"}),y.jsx(sn,{ref:m,value:u,onChange:C=>f(C.target.value),placeholder:i("commandPalette.placeholder"),className:"border-0 ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 px-0 h-12"}),y.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"})]}),y.jsx("div",{ref:S,className:"max-h-80 overflow-y-auto p-2",children:_.length===0?y.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:i("commandPalette.noResults")}):y.jsx(y.Fragment,{children:["navigation","actions"].map(C=>{const R=b.get(C);return!R||R.length===0?null:y.jsxs("div",{className:"mb-2 last:mb-0",children:[y.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:i(`commandPalette.categories.${C}`)}),R.map(O=>{const I=w++,D=I===d;return y.jsxs("button",{"data-selected":D,onClick:()=>O.action(),onMouseEnter:()=>p(I),className:We("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm",D?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[O.icon&&y.jsx("span",{className:"text-muted-foreground",children:O.icon}),y.jsx("span",{className:"flex-1 text-left",children:O.label}),O.shortcut&&y.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:$ee(O.shortcut)})]},O.id)})]},C)})})})]})})}const Y$={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 YTe({className:e,rows:t=100,cols:n=10,tileClassName:r,tileSize:i="md"}){return y.jsx("div",{className:We("relative z-0 flex w-full h-full justify-center",e),children:Array.from({length:t}).map((a,s)=>y.jsx("div",{className:We(Y$[i],"border-l dark:border-neutral-900 border-neutral-200 relative",r),children:Array.from({length:n}).map((o,l)=>y.jsx("div",{className:We(Y$[i],"border-r border-t dark:border-neutral-900 border-neutral-200 relative hover:bg-tile transition-colors",r)},`col-${l}`))},`row-${s}`))})}const XTe=["/","/tasks","/terminals","/worktrees","/repositories","/review","/monitoring","/settings"];function ZTe(){const e=ei({select:n=>n.location.pathname});return XTe.some(n=>e===n||e.startsWith(n+"/"))?y.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none -z-10",children:y.jsx(YTe,{rows:100,cols:50,tileSize:"sm"})}):null}const QTe=[{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:"terminals",items:[{labelKey:"newTerminal",shortcut:"meta+d"},{labelKey:"closeTerminal",shortcut:"meta+w"}]},{titleKey:"general",items:[{labelKey:"closeModal",shortcut:"escape"},{labelKey:"submitForm",shortcut:"meta+enter"}]}];function JTe({open:e,onOpenChange:t}){const{t:n}=an("navigation");return y.jsx(ul,{open:e,onOpenChange:t,children:y.jsxs(cl,{className:"sm:max-w-md",children:[y.jsx(Su,{children:y.jsx(xu,{children:n("shortcuts.title")})}),y.jsx("div",{className:"space-y-4 mt-2",children:QTe.map(r=>y.jsxs("div",{children:[y.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:n(`shortcuts.groups.${r.titleKey}`)}),y.jsx("div",{className:"space-y-1",children:r.items.map(i=>y.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[y.jsx("span",{className:"text-sm",children:n(`shortcuts.labels.${i.labelKey}`)}),y.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:$ee(i.shortcut)})]},i.shortcut))})]},r.titleKey))})]})})}const eCe=({...e})=>{const{resolvedTheme:t}=Pf();return y.jsx(q1e,{theme:t,className:"toaster group",icons:{success:y.jsx(ve,{icon:q0e,strokeWidth:2,className:"size-4"}),info:y.jsx(ve,{icon:r1e,strokeWidth:2,className:"size-4"}),warning:y.jsx(ve,{icon:Bf,strokeWidth:2,className:"size-4"}),error:y.jsx(ve,{icon:l1e,strokeWidth:2,className:"size-4"}),loading:y.jsx(ve,{icon:xn,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})},_o=ype({component:sCe});function tCe(){return Txe(),null}function nCe(){return Zte(),null}function rCe(){return Qte(),null}function iCe(){const e=ei({select:n=>n.location}),{updateViewTracking:t}=Jte();return k.useEffect(()=>{const n=e.pathname;let r="other",i=null,a=null;n.startsWith("/tasks/")?(r="task-detail",i=n.split("/")[2]||null):n==="/terminals"&&(r="terminals",a=new URLSearchParams(e.search).get("tab")),t(r,i,a)},[e.pathname,e.search,t]),null}function aCe(){const e=ei({select:t=>t.location});return k.useEffect(()=>{window.parent!==window&&window.parent.postMessage({type:"vibora:route",pathname:e.pathname,search:e.search},"*")},[e.pathname,e.search]),null}function sCe(){const[e,t]=k.useState(null),[n,r]=k.useState(!1),[i,a]=k.useState(!1),s=k.useCallback(f=>{t(()=>f)},[]),o=k.useCallback(()=>{e?.()},[e]),l=k.useCallback(()=>{r(!0)},[]),u=k.useCallback(()=>{a(!0)},[]);return y.jsx(Z1e,{children:y.jsxs("div",{className:"flex h-screen flex-col overflow-x-hidden bg-background text-foreground",children:[y.jsx(tCe,{}),y.jsx(nCe,{}),y.jsx(rCe,{}),y.jsx(iCe,{}),y.jsx(aCe,{}),y.jsx(Exe,{onNewTaskRef:s,onOpenCommandPalette:u}),y.jsxs("main",{className:"isolate flex-1 overflow-hidden relative",children:[y.jsx(ZTe,{}),y.jsx(AQ,{})]}),y.jsx(KTe,{open:i,onOpenChange:a,onNewTask:o,onShowShortcuts:l}),y.jsx(JTe,{open:n,onOpenChange:r}),y.jsx(eCe,{position:"bottom-right"})]})})}const oCe=Bs("/")({beforeLoad:()=>{throw dQ({to:"/tasks"})}}),ene="";function tne(){const[e,t]=k.useState(new Map),[n,r]=k.useState(null),[i,a]=k.useState(!0),[s,o]=k.useState(!1),[l,u]=k.useState(null),f=k.useRef(null),d=k.useRef(0),p=k.useCallback(()=>{f.current?.close(),a(!0),o(!1),u(null),t(new Map),r(null);const S=new EventSource(`${ene}/api/worktrees`);f.current=S,S.addEventListener("worktree:basic",E=>{const g=JSON.parse(E.data);d.current=g.length,t(new Map(g.map(_=>[_.path,{..._,size:0,sizeFormatted:"...",branch:"..."}]))),a(!1),o(g.length>0)}),S.addEventListener("worktree:details",E=>{const g=JSON.parse(E.data);t(_=>{const b=new Map(_),x=b.get(g.path);return x&&b.set(g.path,{...x,size:g.size,sizeFormatted:g.sizeFormatted,branch:g.branch}),b}),d.current--,d.current<=0&&o(!1)}),S.addEventListener("worktree:complete",E=>{const g=JSON.parse(E.data);r(g),o(!1),S.close()}),S.addEventListener("worktree:error",E=>{const{path:g}=JSON.parse(E.data);Gt.viewer.error("Error loading worktree details",{path:g}),d.current--,d.current<=0&&o(!1)}),S.onerror=()=>{u(new Error("Connection lost")),a(!1),o(!1),S.close()}},[]);return k.useEffect(()=>(p(),()=>{f.current?.close()}),[p]),{worktrees:k.useMemo(()=>Array.from(e.values()).sort((E,g)=>E.isOrphaned!==g.isOrphaned?E.isOrphaned?-1:1:new Date(g.lastModified).getTime()-new Date(E.lastModified).getTime()),[e]),summary:n,isLoading:i,isLoadingDetails:s,error:l,refetch:p}}function nne(){const e=zr();return pr({mutationFn:({worktreePath:t,repoPath:n,deleteLinkedTask:r})=>Zt(`${ene}/api/worktrees`,{method:"DELETE",body:JSON.stringify({worktreePath:t,repoPath:n,deleteLinkedTask:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worktrees"]}),e.invalidateQueries({queryKey:["tasks"]})}})}const lCe=Qc("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 lo({className:e,variant:t="default",render:n,...r}){return OSe({defaultTagName:"span",props:tl({className:We(lCe({className:e,variant:t}))},r),render:n,state:{slot:"badge",variant:t}})}function Aa({className:e,size:t="default",...n}){return y.jsx("div",{"data-slot":"card","data-size":t,className:We("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 uCe({className:e,...t}){return y.jsx("div",{"data-slot":"card-header",className:We("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 cCe({className:e,...t}){return y.jsx("div",{"data-slot":"card-title",className:We("text-sm font-medium",e),...t})}function Tf({className:e,...t}){return y.jsx("div",{"data-slot":"card-content",className:We("px-4 group-data-[size=sm]/card:px-3",e),...t})}function Bc({...e}){return y.jsx(lEe,{"data-slot":"alert-dialog",...e})}function Uc({...e}){return y.jsx(Zee,{"data-slot":"alert-dialog-trigger",...e})}function dCe({...e}){return y.jsx(qee,{"data-slot":"alert-dialog-portal",...e})}function fCe({className:e,...t}){return y.jsx(zee,{"data-slot":"alert-dialog-overlay",className:We("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 $c({className:e,size:t="default",...n}){return y.jsxs(dCe,{children:[y.jsx(fCe,{}),y.jsx(Gee,{"data-slot":"alert-dialog-content","data-size":t,className:We("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 Hc({className:e,...t}){return y.jsx("div",{"data-slot":"alert-dialog-header",className:We("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 zc({className:e,...t}){return y.jsx("div",{"data-slot":"alert-dialog-footer",className:We("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 Vc({className:e,...t}){return y.jsx(Xee,{"data-slot":"alert-dialog-title",className:We("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 Wc({className:e,...t}){return y.jsx(Vee,{"data-slot":"alert-dialog-description",className:We("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...t})}function rne({className:e,...t}){return y.jsx(Ye,{"data-slot":"alert-dialog-action",className:We(e),...t})}function Gc({className:e,variant:t="outline",size:n="default",...r}){return y.jsx(kx,{"data-slot":"alert-dialog-cancel",className:We(e),render:y.jsx(Ye,{variant:t,size:n}),...r})}const rl=k.forwardRef(({className:e,...t},n)=>y.jsx(jEe,{ref:n,className:We("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:y.jsx(FEe,{className:"flex items-center justify-center",children:y.jsx(ve,{icon:_u,size:12,strokeWidth:3})})}));rl.displayName="Checkbox";const zN={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"},hCe=Bs("/worktrees/")({component:bCe});function pCe(){const{t:e}=an("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),s=Math.floor(a/60),o=Math.floor(s/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}):s>0?s===1?e("time.minuteAgo"):e("time.minutesAgo",{count:s}):e("time.justNow")}}function X$({className:e}){return y.jsx("span",{className:`inline-block animate-pulse rounded bg-muted ${e}`})}function mCe({worktree:e,onDelete:t}){const{t:n}=an("common"),{t:r}=an("worktrees"),i=pCe(),[a,s]=k.useState(!1),[o,l]=k.useState(!1),[u,f]=k.useState(!1),d=e.sizeFormatted==="..."||e.branch==="...",p=!e.isOrphaned&&e.taskId,m=async()=>{l(!0);try{await t(e,u),s(!1)}catch{}finally{l(!1)}},S=E=>{s(E),E||f(!1)};return y.jsx(Aa,{className:"transition-colors hover:border-border/80",children:y.jsxs(Tf,{className:"flex items-start justify-between gap-4 py-4",children:[y.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"truncate font-medium",children:e.name}),e.isOrphaned?y.jsx(lo,{className:We("shrink-0",zN.ORPHANED),children:n("statuses.ORPHANED")}):e.taskStatus?y.jsx(lo,{className:We("shrink-0",zN[e.taskStatus]),children:n(`statuses.${e.taskStatus}`)}):null]}),y.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(ve,{icon:Pi,size:12,strokeWidth:2,className:"shrink-0"}),y.jsx("span",{className:"truncate font-mono",children:e.path})]}),y.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(ve,{icon:wE,size:12,strokeWidth:2,className:"shrink-0"}),e.branch==="..."?y.jsx(X$,{className:"h-3 w-16"}):y.jsx("span",{className:"font-mono",children:e.branch})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(ve,{icon:Lee,size:12,strokeWidth:2,className:"shrink-0"}),e.sizeFormatted==="..."?y.jsx(X$,{className:"h-3 w-12"}):y.jsx("span",{children:e.sizeFormatted})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(ve,{icon:Iee,size:12,strokeWidth:2,className:"shrink-0"}),y.jsx("span",{children:i(e.lastModified)})]})]}),e.taskId&&e.taskTitle&&y.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:y.jsxs(Li,{to:"/tasks/$taskId",params:{taskId:e.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[y.jsx("span",{className:"truncate",children:e.taskTitle}),y.jsx(ve,{icon:ky,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),y.jsxs(Bc,{open:a,onOpenChange:S,children:[y.jsx(Uc,{render:y.jsx(Ye,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:d}),children:y.jsx(ve,{icon:km,size:14,strokeWidth:2})}),y.jsxs($c,{children:[y.jsxs(Hc,{children:[y.jsx(Vc,{children:r("delete.title")}),y.jsxs(Wc,{children:[r("delete.description")," ",y.jsx("span",{className:"font-mono",children:e.name}),".",u&&p&&y.jsxs(y.Fragment,{children:[" ",r("delete.linkedTaskWillBeDeleted",{title:e.taskTitle})]})," ",r("delete.cannotUndo")]}),p&&y.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[y.jsx(rl,{checked:u,onCheckedChange:E=>f(E===!0),disabled:o}),r("delete.alsoDeleteLinkedTask",{title:e.taskTitle})]})]}),y.jsxs(zc,{children:[y.jsx(Gc,{disabled:o,children:n("buttons.cancel")}),y.jsxs(Ye,{variant:"destructive",onClick:m,disabled:o,className:"gap-2",children:[o&&y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}),n(o?"status.deleting":"buttons.delete")]})]})]})]})]})})}const gCe=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function bCe(){const{t:e}=an("common"),{t}=an("worktrees"),{worktrees:n,summary:r,isLoading:i,isLoadingDetails:a,error:s,refetch:o}=tne(),l=nne(),[u,f]=k.useState(new Set),[d,p]=k.useState(!1),[m,S]=k.useState(!1),[E,g]=k.useState(!1),_=O=>{f(I=>{const D=new Set(I);return D.has(O)?D.delete(O):D.add(O),D})},b=()=>{f(new Set)},x=k.useMemo(()=>u.size===0?n:n.filter(O=>!!(O.isOrphaned&&u.has("ORPHANED")||O.taskStatus&&u.has(O.taskStatus))),[n,u]),T=k.useMemo(()=>n.filter(O=>O.taskStatus==="DONE"||O.taskStatus==="CANCELED"),[n]),w=async()=>{if(T.length!==0){S(!0);try{for(const O of T)await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:E});p(!1),o()}catch{}finally{S(!1)}}},C=O=>{p(O),O||g(!1)},R=async(O,I)=>{await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:I}),o()};return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border bg-background px-4 py-2",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsxs("div",{className:"flex items-center gap-4",children:[y.jsx("h1",{className:"text-sm font-medium",children:t("title")}),(r||n.length>0)&&y.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[y.jsx("span",{children:t("summary.total",{count:r?.total??n.length})}),(r?.orphaned??n.filter(O=>O.isOrphaned).length)>0&&y.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:r?.orphaned??n.filter(O=>O.isOrphaned).length})}),a?y.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):r?y.jsx("span",{children:r.totalSizeFormatted}):null]})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[T.length>0&&y.jsxs(Bc,{open:d,onOpenChange:C,children:[y.jsxs(Uc,{render:y.jsx(Ye,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:a}),children:[y.jsx(ve,{icon:Nee,size:12,strokeWidth:2}),t("cleanup.button",{count:T.length})]}),y.jsxs($c,{children:[y.jsxs(Hc,{children:[y.jsx(Vc,{children:t("cleanup.title")}),y.jsxs(Wc,{children:[t("cleanup.description",{count:T.length}),E&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),y.jsxs("div",{className:"space-y-3",children:[y.jsxs("p",{className:"text-sm text-muted-foreground",children:[T.filter(O=>O.taskStatus==="DONE").length>0&&y.jsxs("span",{className:"mr-3",children:[y.jsx("span",{className:"font-medium text-accent",children:T.filter(O=>O.taskStatus==="DONE").length})," ",t("cleanup.done")]}),T.filter(O=>O.taskStatus==="CANCELED").length>0&&y.jsxs("span",{children:[y.jsx("span",{className:"font-medium text-destructive",children:T.filter(O=>O.taskStatus==="CANCELED").length})," ",t("cleanup.canceled")]})]}),y.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[y.jsx(rl,{checked:E,onCheckedChange:O=>g(O===!0),disabled:m}),t("cleanup.alsoDeleteLinkedTasks")]}),y.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),y.jsxs(zc,{children:[y.jsx(Gc,{disabled:m,children:e("buttons.cancel")}),y.jsxs(Ye,{variant:"destructive",onClick:w,disabled:m,className:"gap-2",children:[m&&y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}),m?e("status.deleting"):t("delete.button",{count:T.length})]})]})]})]}),u.size>0&&y.jsxs(Ye,{variant:"ghost",size:"sm",onClick:b,className:"gap-1.5 text-xs",children:[y.jsx(ve,{icon:aa,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),y.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:gCe.map(O=>{const I=u.has(O);return y.jsx("button",{onClick:()=>_(O),className:We("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",I?zN[O]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${O}`)},O)})})]}),y.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i&&y.jsx("div",{className:"flex items-center justify-center py-12",children:y.jsx(ve,{icon:xn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),s&&y.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[y.jsx(ve,{icon:Bf,size:20,strokeWidth:2}),y.jsx("span",{className:"text-sm",children:t("error.failedToLoad",{message:s.message})})]}),!i&&!s&&x.length===0&&y.jsx("div",{className:"py-12 text-muted-foreground",children:y.jsx("p",{className:"text-sm",children:u.size>0?t("empty.noMatch"):t("empty.noWorktrees")})}),!i&&y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:x.map(O=>y.jsx(mCe,{worktree:O,onDelete:R},O.path))})]})]})}function rn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var vCe={};function $x(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:vCe}var ine=Object.assign,OE=Object.getOwnPropertyDescriptor,qo=Object.defineProperty,Hx=Object.prototype,VN=[];Object.freeze(VN);var hM={};Object.freeze(hM);var yCe=typeof Proxy<"u",_Ce=Object.toString();function ane(){yCe||rn("Proxy not available")}function sne(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var np=function(){};function is(e){return typeof e=="function"}function Cf(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function zx(e){return e!==null&&typeof e=="object"}function qc(e){if(!zx(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===_Ce}function one(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Vx(e,t,n){qo(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function lne(e,t,n){qo(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function id(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return zx(r)&&r[n]===!0}}function Om(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function ECe(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function Yl(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var une=typeof Object.getOwnPropertySymbols<"u";function SCe(e){var t=Object.keys(e);if(!une)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return Hx.propertyIsEnumerable.call(e,r)})):t}var Wx=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:une?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function cne(e){return e===null?null:typeof e=="object"?""+e:e}function ru(e,t){return Hx.hasOwnProperty.call(e,t)}var xCe=Object.getOwnPropertyDescriptors||function(t){var n={};return Wx(t).forEach(function(r){n[r]=OE(t,r)}),n};function Ja(e,t){return!!(e&t)}function es(e,t,n){return n?e|=t:e&=~t,e}function Z$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function wCe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,CCe(r.key),r)}}function Rm(e,t,n){return t&&wCe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rp(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=ACe(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
25
|
+
`:"")+S)}catch(S){dn.error("Failed to upload image"),Gt.kanban.error("Upload error",{error:String(S)})}finally{s(!1)}return}}};return y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"relative",children:[y.jsx(Dx,{ref:o,value:e,onChange:f=>t(f.target.value),onPaste:u,className:We(a&&"opacity-50",n),disabled:a||r,...i}),a&&y.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50 rounded-md",children:y.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})})]}),l.length>0&&y.jsx("div",{className:"flex flex-wrap gap-2",children:l.map((f,d)=>y.jsx("a",{href:P$(f),target:"_blank",rel:"noopener noreferrer",className:"block",children:y.jsx("img",{src:P$(f),alt:`Attachment ${d+1}`,className:"h-16 w-auto rounded border object-cover hover:opacity-80 transition-opacity"})},d))})]})}function tte({className:e,...t}){return y.jsx("label",{"data-slot":"label",className:We("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 C_e=k.forwardRef(function(t,n){const{className:r,render:i,orientation:a="horizontal",...s}=t,o=k.useMemo(()=>({orientation:a}),[a]);return Tt("div",t,{state:o,ref:n,props:[{role:"separator","aria-orientation":a},s]})});function A_e({className:e,orientation:t="horizontal",...n}){return y.jsx(C_e,{"data-slot":"separator",orientation:t,className:We("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 nu({className:e,...t}){return y.jsx("div",{"data-slot":"field-group",className:We("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 k_e=Qc("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 Dn({className:e,orientation:t="vertical",...n}){return y.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:We(k_e({orientation:t}),e),...n})}function Ln({className:e,...t}){return y.jsx(tte,{"data-slot":"field-label",className:We("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 Yi({className:e,...t}){return y.jsx("p",{"data-slot":"field-description",className:We("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 nte(e){const t=k.useRef(!0);t.current&&(t.current=!1,e())}const rte=k.createContext(null),ite=k.createContext(null);function dl(){const e=k.useContext(rte);if(e===null)throw new Error(bn(60));return e}function ate(){const e=k.useContext(ite);if(e===null)throw new Error(bn(61));return e}const ste=(e,t)=>Object.is(e,t);function du(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Gd(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:du(r,t,n))}function Lp(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:du(r,t,n))}function ote(e,t,n){return e.filter(r=>!du(r,t,n))}function $N(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function lte(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Kr(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 $N(e)}function no(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?$N(e.value):$N(e)}function O_e(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]??Kr(e,n);if(Array.isArray(t)){const r=lte(t)?t.flatMap(i=>i.items):t;if(e==null){const i=r.find(a=>a.value==null);return i&&i.label!=null?i.label:Kr(e,n)}if(typeof e!="object"){const i=r.find(a=>a&&a.value===e);return i&&i.label!=null?i.label:Kr(e,n)}if("value"in e){const i=r.find(a=>a&&a.value===e.value);if(i&&i.label!=null)return i.label}}return Kr(e,n)}function R_e(e,t){return!Array.isArray(e)||e.length===0?"":e.map(n=>Kr(n,t)).join(", ")}const Ht={id:Ue(e=>e.id),modal:Ue(e=>e.modal),multiple:Ue(e=>e.multiple),items:Ue(e=>e.items),itemToStringLabel:Ue(e=>e.itemToStringLabel),itemToStringValue:Ue(e=>e.itemToStringValue),isItemEqualToValue:Ue(e=>e.isItemEqualToValue),value:Ue(e=>e.value),open:Ue(e=>e.open),mounted:Ue(e=>e.mounted),forceMount:Ue(e=>e.forceMount),transitionStatus:Ue(e=>e.transitionStatus),openMethod:Ue(e=>e.openMethod),activeIndex:Ue(e=>e.activeIndex),selectedIndex:Ue(e=>e.selectedIndex),isActive:Ue((e,t)=>e.activeIndex===t),isSelected:Ue((e,t,n)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(a=>du(a,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:du(i,n,r)}),isSelectedByFocus:Ue((e,t)=>e.selectedIndex===t),popupProps:Ue(e=>e.popupProps),triggerProps:Ue(e=>e.triggerProps),triggerElement:Ue(e=>e.triggerElement),positionerElement:Ue(e=>e.positionerElement),listElement:Ue(e=>e.listElement),scrollUpArrowVisible:Ue(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Ue(e=>e.scrollDownArrowVisible),hasScrollArrows:Ue(e=>e.hasScrollArrows),serializedValue:Ue(e=>{const{multiple:t,value:n,itemToStringValue:r}=e;return t&&Array.isArray(n)&&n.length===0?"":no(n,r)})};function qd(e,t){const n=k.useRef(e),r=Xe(t);rt(()=>{n.current!==e&&r(n.current)},[e,r]),rt(()=>{n.current=e},[e])}function I_e(e){const{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:s=!1,onOpenChange:o,name:l,disabled:u=!1,readOnly:f=!1,required:d=!1,modal:p=!0,actionsRef:m,inputRef:S,onOpenChangeComplete:E,items:g,multiple:_=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:T=ste,highlightItemOnHover:w=!0,children:C}=e,{clearErrors:R}=Iy(),{setDirty:O,shouldValidateOnChange:I,validityData:D,setFilled:P,name:H,disabled:M,validation:W}=$s(),{controlId:V}=nd(),$=Nx({id:t}),q=M||u,K=H??l,[U,F]=ns({controlled:n,default:_?r??Zi:r,name:"Select",state:"value"}),[B,Y]=ns({controlled:a,default:s,name:"Select",state:"open"}),z=k.useRef([]),J=k.useRef([]),ee=k.useRef(null),te=k.useRef(null),Z=k.useRef(0),G=k.useRef(null),Q=k.useRef([]),ae=k.useRef(!1),se=k.useRef(!1),ne=k.useRef(null),ye=k.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),Ee=k.useRef(!1),{mounted:he,setMounted:_e,transitionStatus:be}=vo(B),{openMethod:Ke,triggerProps:Se,reset:$e}=Ix(B),Te=Ei(()=>new sf({id:$,modal:p,multiple:_,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:T,value:U,open:B,mounted:he,transitionStatus:be,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,we=qe(Te,Ht.activeIndex),le=qe(Te,Ht.selectedIndex),me=qe(Te,Ht.triggerElement),Ne=qe(Te,Ht.positionerElement),pe=k.useMemo(()=>_&&Array.isArray(U)&&U.length===0?"":no(U,x),[_,U,x]),De=k.useMemo(()=>_&&Array.isArray(U)?U.map(yt=>no(yt,x)):no(U,x),[_,U,x]),Ce=ar(Te.state.triggerElement);Ny({id:$,commit:W.commit,value:U,controlRef:Ce,name:K,getValue:()=>De});const ze=k.useRef(U);rt(()=>{U!==ze.current&&Te.set("forceMount",!0)},[Te,U]),rt(()=>{P(U!==null)},[U,P]),rt(function(){if(B)return;const Bt=Q.current;if(_){const Ut=Array.isArray(U)?U:[];if(Ut.length===0){Te.set("selectedIndex",null);return}const pt=Ut[Ut.length-1],ln=Lp(Bt,pt,T);Te.set("selectedIndex",ln===-1?null:ln);return}const jt=Lp(Bt,U,T);Te.set("selectedIndex",jt===-1?null:jt)},[_,B,U,Q,T,Te]),qd(U,()=>{R(K),O(U!==D.initialValue),I()?W.commit(U):W.commit(U,!0)});const Ze=Xe((yt,Bt)=>{if(o?.(yt,Bt),!Bt.isCanceled&&(Y(yt),!yt&&Te.state.activeIndex!==null)){const jt=z.current[Te.state.activeIndex];queueMicrotask(()=>{jt?.setAttribute("tabindex","-1")})}}),gt=Xe(()=>{_e(!1),Te.set("activeIndex",null),$e(),E?.(!1)});ji({enabled:!m,open:B,ref:ee,onComplete(){B||gt()}}),k.useImperativeHandle(m,()=>({unmount:gt}),[gt]);const it=Xe((yt,Bt)=>{i?.(yt,Bt),!Bt.isCanceled&&F(yt)}),ot=Xe(()=>{const yt=Te.state.listElement||ee.current;if(!yt)return;const Bt=yt.scrollTop,jt=yt.scrollTop+yt.clientHeight,Ut=Bt>1,pt=jt<yt.scrollHeight-1;Te.state.scrollUpArrowVisible!==Ut&&Te.set("scrollUpArrowVisible",Ut),Te.state.scrollDownArrowVisible!==pt&&Te.set("scrollDownArrowVisible",pt)}),Me=yx({open:B,onOpenChange:Ze,elements:{reference:me,floating:Ne}}),ft=Tm(Me,{enabled:!f&&!q,event:"mousedown"}),Oe=xy(Me,{bubbles:!1}),Fe=FP(Me,{enabled:!f&&!q,listRef:z,activeIndex:we,selectedIndex:le,disabledIndices:Zi,onNavigate(yt){yt===null&&!B||Te.set("activeIndex",yt)},focusItemOnHover:!1}),Je=BP(Me,{enabled:!f&&!q&&(B||!_),listRef:J,activeIndex:we,selectedIndex:le,onMatch(yt){B?Te.set("activeIndex",yt):it(Q.current[yt],st("none"))},onTypingChange(yt){ae.current=yt}}),{getReferenceProps:lt,getFloatingProps:ht,getItemProps:vn}=Ff([ft,Oe,Fe,Je]),Dt=k.useMemo(()=>tl(lt(),Se),[lt,Se]);nte(()=>{Te.update({popupProps:ht(),triggerProps:Dt})}),rt(()=>{Te.update({id:$,modal:p,multiple:_,value:U,open:B,mounted:he,transitionStatus:be,popupProps:ht(),triggerProps:Dt,items:g,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:T,openMethod:Ke})},[Te,$,p,_,U,B,he,be,ht,Dt,g,b,x,T,Ke]);const Ot=k.useMemo(()=>({store:Te,name:K,required:d,disabled:q,readOnly:f,multiple:_,itemToStringLabel:b,itemToStringValue:x,highlightItemOnHover:w,setValue:it,setOpen:Ze,listRef:z,popupRef:ee,scrollHandlerRef:te,handleScrollArrowVisibility:ot,scrollArrowsMountedCountRef:Z,getItemProps:vn,events:Me.context.events,valueRef:G,valuesRef:Q,labelsRef:J,typingRef:ae,selectionRef:ye,selectedItemTextRef:ne,validation:W,onOpenChangeComplete:E,keyboardActiveRef:se,alignItemWithTriggerActiveRef:Ee,initialValueRef:ze}),[Te,K,d,q,f,_,b,x,w,it,Ze,vn,Me.context.events,W,E,ot]),ct=Us(S,W.inputRef),en=_&&Array.isArray(U)&&U.length>0,Lt=k.useMemo(()=>!_||!Array.isArray(U)||!K?null:U.map(yt=>{const Bt=no(yt,x);return y.jsx("input",{type:"hidden",name:K,value:Bt},Bt)}),[_,U,K,x]);return y.jsx(rte.Provider,{value:Ot,children:y.jsxs(ite.Provider,{value:Me,children:[C,y.jsx("input",{...W.getInputValidationProps({onFocus(){Te.state.triggerElement?.focus()},onChange(yt){if(yt.nativeEvent.defaultPrevented)return;const Bt=yt.target.value,jt=st(Yr,yt.nativeEvent);function Ut(){if(_)return;const pt=Q.current.find(ln=>no(ln,x).toLowerCase()===Bt.toLowerCase());pt!=null&&(O(pt!==D.initialValue),it(pt,jt),I()&&W.commit(pt))}Te.set("forceMount",!0),queueMicrotask(Ut)}}),id:t||V||void 0,name:_?void 0:K,value:pe,disabled:q,required:d&&!en,readOnly:f,ref:ct,style:wm,tabIndex:-1,"aria-hidden":!0}),Lt]})})}function QP(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 a=parseFloat(n.width)||0,s=parseFloat(n.height)||0,o=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=Math.max(t.width,a,o),f=Math.max(t.height,s,l),d=u-t.width,p=f-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const J1=2,N_e={...Np,...$f,value:()=>null},D_e=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,...o}=t,{setTouched:l,setFocused:u,validationMode:f,state:d,disabled:p}=$s(),{labelId:m}=nd(),{store:S,setOpen:E,selectionRef:g,validation:_,readOnly:b,alignItemWithTriggerActiveRef:x,disabled:T,keyboardActiveRef:w}=dl(),C=p||T||a,R=qe(S,Ht.open),O=qe(S,Ht.value),I=qe(S,Ht.triggerProps),D=qe(S,Ht.positionerElement),P=qe(S,Ht.listElement),H=qe(S,Ht.serializedValue),M=ar(D),W=k.useRef(null),V=Bn(),$=Bn(),{getButtonProps:q,buttonRef:K}=oa({disabled:C,native:s}),U=Xe(te=>{S.set("triggerElement",te)}),F=Us(n,W,K,U),B=Bn(),Y=Bn();k.useEffect(()=>{if(R)return Y.start(200,()=>{g.current.allowUnselectedMouseUp=!0,B.start(200,()=>{g.current.allowSelectedMouseUp=!0})}),()=>{B.clear(),Y.clear()};g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},$.clear()},[R,g,$,B,Y]);const z=k.useMemo(()=>P?.id??lv(D)?.id,[P,D]),J=tl(I,{role:"combobox","aria-expanded":R?"true":"false","aria-haspopup":"listbox","aria-controls":R?z:void 0,"aria-labelledby":m,"aria-readonly":b||void 0,tabIndex:C?-1:0,ref:F,onFocus(te){u(!0),R&&x.current&&E(!1,st(ho,te.nativeEvent)),V.start(0,()=>{S.set("forceMount",!0)})},onBlur(){l(!0),u(!1),f==="onBlur"&&_.commit(O)},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(te){if(R)return;const Z=Si(te.currentTarget);function G(Q){if(!W.current)return;const ae=Q.target;if(wt(W.current,ae)||wt(M.current,ae)||ae===W.current)return;const se=QP(W.current);Q.clientX>=se.left-J1&&Q.clientX<=se.right+J1&&Q.clientY>=se.top-J1&&Q.clientY<=se.bottom+J1||E(!1,st(zJ,Q))}$.start(0,()=>{Z.addEventListener("mouseup",G,{once:!0})})}},_.getValidationProps,o,q);J.role="combobox";const ee=k.useMemo(()=>({...d,open:R,disabled:C,value:O,readOnly:b,placeholder:!H}),[d,R,C,O,b,H]);return Tt("button",t,{ref:[n,W],state:ee,stateAttributesMapping:N_e,props:J})}),L_e={value:()=>null},P_e=k.forwardRef(function(t,n){const{className:r,render:i,children:a,...s}=t,{store:o,valueRef:l}=dl(),u=qe(o,Ht.value),f=qe(o,Ht.items),d=qe(o,Ht.itemToStringLabel),p=qe(o,Ht.serializedValue),m=k.useMemo(()=>({value:u,placeholder:!p}),[u,p]),S=typeof a=="function"?a(u):a??(Array.isArray(u)?R_e(u,d):O_e(u,f,d));return Tt("span",t,{state:m,ref:[n,l],props:[{children:S},s],stateAttributesMapping:L_e})}),M_e=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s}=dl(),o=qe(s,Ht.open),l=k.useMemo(()=>({open:o}),[o]);return Tt("span",t,{state:l,ref:n,props:[{"aria-hidden":!0,children:"▼"},a],stateAttributesMapping:$P})}),j_e=k.createContext(void 0),F_e=k.forwardRef(function(t,n){const{store:r}=dl(),i=qe(r,Ht.mounted),a=qe(r,Ht.forceMount);return i||a?y.jsx(j_e.Provider,{value:!0,children:y.jsx(Sy,{ref:n,...t})}):null}),ute=k.createContext(void 0);function JP(){const e=k.useContext(ute);if(!e)throw new Error(bn(59));return e}function CE(e,t){e&&Object.assign(e.style,t)}const cte={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},B_e={position:"fixed"},U_e=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:m=5,sticky:S=!1,disableAnchorTracking:E,alignItemWithTrigger:g=!0,collisionAvoidance:_=dx,...b}=t,{store:x,listRef:T,labelsRef:w,alignItemWithTriggerActiveRef:C,selectedItemTextRef:R,valuesRef:O,initialValueRef:I,popupRef:D,setValue:P}=dl(),H=ate(),M=qe(x,Ht.open),W=qe(x,Ht.mounted),V=qe(x,Ht.modal),$=qe(x,Ht.value),q=qe(x,Ht.openMethod),K=qe(x,Ht.positionerElement),U=qe(x,Ht.triggerElement),F=qe(x,Ht.isItemEqualToValue),B=k.useRef(null),Y=k.useRef(null),[z,J]=k.useState(g),ee=W&&z&&q!=="touch";!W&&z!==g&&J(g),rt(()=>{W||(Ht.scrollUpArrowVisible(x.state)&&x.set("scrollUpArrowVisible",!1),Ht.scrollDownArrowVisible(x.state)&&x.set("scrollDownArrowVisible",!1))},[x,W]),k.useImperativeHandle(C,()=>ee),Rx((ee||V)&&M&&q!=="touch",U);const te=wx({anchor:r,floatingRootContext:H,positionMethod:i,mounted:W,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:S,disableAnchorTracking:E??ee,collisionAvoidance:_,keepMounted:!0}),Z=ee?"none":te.side,G=ee?B_e:te.positionerStyles,Q=k.useMemo(()=>{const _e={};return M||(_e.pointerEvents="none"),{role:"presentation",hidden:!W,style:{...G,..._e}}},[M,W,G]),ae=k.useMemo(()=>({open:M,side:Z,align:te.align,anchorHidden:te.anchorHidden}),[M,Z,te.align,te.anchorHidden]),se=Xe(_e=>{x.set("positionerElement",_e)}),ne=Tt("div",t,{ref:[n,se],state:ae,stateAttributesMapping:yo,props:[Q,b]}),ye=k.useRef(0),Ee=Xe(_e=>{if(_e.size===0&&ye.current===0||O.current.length===0)return;const be=ye.current;if(ye.current=_e.size,_e.size===be)return;const Ke=st(Yr);if(be!==0&&!x.state.multiple&&$!==null&&Lp(O.current,$,F)===-1){const $e=I.current,we=$e!=null&&Gd(O.current,$e,F)?$e:null;P(we,Ke),we===null&&(x.set("selectedIndex",null),R.current=null)}if(be!==0&&x.state.multiple&&Array.isArray($)){const Se=$.filter($e=>Gd(O.current,$e,F));(Se.length!==$.length||Se.some($e=>!Gd($,$e,F)))&&(P(Se,Ke),Se.length===0&&(x.set("selectedIndex",null),R.current=null))}if(M&&ee){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Se={height:""};CE(K,Se),CE(D.current,Se)}}),he=k.useMemo(()=>({...te,side:Z,alignItemWithTriggerActive:ee,setControlledAlignItemWithTrigger:J,scrollUpArrowRef:B,scrollDownArrowRef:Y}),[te,Z,ee,J]);return y.jsx(wy,{elementsRef:T,labelsRef:w,onMapChange:Ee,children:y.jsxs(ute.Provider,{value:he,children:[W&&V&&y.jsx(Ox,{inert:Cm(!M),cutout:U}),ne]})})});function dte(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 e_="base-ui-disable-scrollbar",fv={className:e_,element:y.jsx("style",{href:e_,precedence:"base-ui:low",children:`.${e_}{scrollbar-width:none}.${e_}::-webkit-scrollbar{display:none}`})},$_e=k.createContext(void 0);function eM(e){return k.useContext($_e)}const H_e={...yo,...zs},z_e=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{store:s,popupRef:o,onOpenChangeComplete:l,setOpen:u,valueRef:f,selectedItemTextRef:d,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:S,scrollHandlerRef:E}=dl(),{side:g,align:_,alignItemWithTriggerActive:b,setControlledAlignItemWithTrigger:x,scrollDownArrowRef:T,scrollUpArrowRef:w}=JP(),C=eM()!=null,R=ate(),O=Bn(),I=qe(s,Ht.id),D=qe(s,Ht.open),P=qe(s,Ht.mounted),H=qe(s,Ht.popupProps),M=qe(s,Ht.transitionStatus),W=qe(s,Ht.triggerElement),V=qe(s,Ht.positionerElement),$=qe(s,Ht.listElement),q=k.useRef(0),K=k.useRef(!1),U=k.useRef(0),F=k.useRef(!1),B=k.useRef({}),Y=Nc(),z=Xe(Z=>{if(!V||!o.current||!F.current)return;if(K.current||!b){S();return}const G=V.style.top==="0px",Q=V.style.bottom==="0px",ae=V.getBoundingClientRect().height,se=Si(V),ne=getComputedStyle(V),ye=parseFloat(ne.marginTop),Ee=parseFloat(ne.marginBottom),he=se.documentElement.clientHeight-ye-Ee,_e=Z.scrollTop,be=Z.scrollHeight,Ke=Z.clientHeight,Se=be-Ke;let $e=null,Te=null,we=!1;if(G){const le=Se-_e,me=ae+le,Ne=Math.min(me,he);$e=Ne,Ne!==he?Te=Se:we=!0}else if(Q){const le=_e-0,me=ae+le,Ne=Math.min(me,he),pe=me-he;$e=Ne,Ne!==he?Te=0:(we=!0,_e<Se&&(Te=_e-(le-pe)))}$e!=null&&(V.style.height=`${$e}px`),Te!=null&&(Z.scrollTop=Te),we&&(K.current=!0),S()});k.useImperativeHandle(E,()=>z,[z]),ji({open:D,ref:o,onComplete(){D&&l?.(!0)}});const J=k.useMemo(()=>({open:D,transitionStatus:M,side:g,align:_}),[D,M,g,_]);rt(()=>{!V||!o.current||Object.keys(B.current).length||(B.current={top:V.style.top||"0",left:V.style.left||"0",right:V.style.right,height:V.style.height,bottom:V.style.bottom,minHeight:V.style.minHeight,maxHeight:V.style.maxHeight,marginTop:V.style.marginTop,marginBottom:V.style.marginBottom})},[o,V]),rt(()=>{P||b||(F.current=!1,K.current=!1,q.current=0,U.current=0,CE(V,B.current))},[P,b,V,o]),rt(()=>{const Z=o.current;if(!(!P||!W||!V||!Z)){if(!b){F.current=!0,Y.request(S);return}queueMicrotask(()=>{const G=getComputedStyle(V),Q=getComputedStyle(Z),ae=Si(W),se=Ar(V),ne=W.getBoundingClientRect(),ye=V.getBoundingClientRect(),Ee=ne.left,he=ne.height,_e=$||Z,be=_e.scrollHeight,Ke=parseFloat(Q.borderBottomWidth),Se=parseFloat(G.marginTop)||10,$e=parseFloat(G.marginBottom)||10,Te=parseFloat(G.minHeight)||100,we=5,le=5,me=20,Ne=ae.documentElement.clientHeight-Se-$e,pe=ae.documentElement.clientWidth,De=Ne-ne.bottom+he,Ce=d.current,ze=f.current;let Ze=0,gt=0;if(Ce&&ze){const Ot=ze.getBoundingClientRect(),ct=Ce.getBoundingClientRect(),en=Ot.left-Ee,Lt=ct.left-ye.left,yt=Ot.top-ne.top+Ot.height/2,Bt=ct.top-ye.top+ct.height/2;Ze=en-Lt,gt=Bt-yt}const it=De+gt+$e+Ke;let ot=Math.min(Ne,it);const Me=Ne-Se-$e,ft=it-ot,Oe=Math.max(we,Ee+Ze),Fe=pe-le,Je=Math.max(0,Oe+ye.width-Fe);V.style.left=`${Oe-Je}px`,V.style.height=`${ot}px`,V.style.maxHeight="auto",V.style.marginTop=`${Se}px`,V.style.marginBottom=`${$e}px`,Z.style.height="100%";const lt=_e.scrollHeight-_e.clientHeight,ht=ft>=lt;ht&&(ot=Math.min(Ne,ye.height)-(ft-lt));const vn=ne.top<me||ne.bottom>Ne-me||ot<Math.min(be,Te),Dt=(se.visualViewport?.scale??1)!==1&&wP;if(vn||Dt){F.current=!0,CE(V,B.current),Nr.flushSync(()=>x(!1));return}if(ht){const Ot=Math.max(0,Ne-it);V.style.top=ye.height>=Me?"0":`${Ot}px`,V.style.height=`${ot}px`,_e.scrollTop=_e.scrollHeight-_e.clientHeight,q.current=Math.max(Te,ot)}else V.style.bottom="0",q.current=Math.max(Te,ot),_e.scrollTop=ft;q.current===Ne&&(K.current=!0),S(),setTimeout(()=>{F.current=!0})})}},[s,P,V,W,f,d,o,S,b,x,Y,T,w,$]),k.useEffect(()=>{if(!b||!V||!P)return;const Z=Ar(V);function G(Q){u(!1,st(mve,Q))}return Z.addEventListener("resize",G),()=>{Z.removeEventListener("resize",G)}},[u,b,V,P]);const ee={...$?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":m||void 0,id:`${I}-list`},onKeyDown(Z){p.current=!0,C&&UP.has(Z.key)&&Z.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(Z){if(dte(Z)||Z.pointerType==="touch")return;const G=Z.currentTarget;O.start(0,()=>{s.set("activeIndex",null),G.focus({preventScroll:!0})})},onScroll(Z){$||E.current?.(Z.currentTarget)},...b&&{style:$?{height:"100%"}:cte}},te=Tt("div",t,{ref:[n,o],state:J,stateAttributesMapping:H_e,props:[H,ee,Tx(M),{className:!$&&b?fv.className:void 0},a]});return y.jsxs(k.Fragment,{children:[fv.element,y.jsx(mx,{context:R,modal:!1,disabled:!P,restoreFocus:!0,children:te})]})}),V_e=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s,scrollHandlerRef:o}=dl(),{alignItemWithTriggerActive:l}=JP(),u=qe(s,Ht.hasScrollArrows),f=qe(s,Ht.openMethod),d=qe(s,Ht.multiple),m={id:`${qe(s,Ht.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(E){o.current?.(E.currentTarget)},...l&&{style:cte},className:u&&f!=="touch"?fv.className:void 0},S=Xe(E=>{s.set("listElement",E)});return Tt("div",t,{ref:[n,S],props:[m,a]})}),fte=k.createContext(void 0);function tM(){const e=k.useContext(fte);if(!e)throw new Error(bn(57));return e}const W_e=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,label:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(null),d=Am({label:s,textRef:f,indexGuessBehavior:HP.GuessFromOrder}),{store:p,getItemProps:m,setOpen:S,setValue:E,selectionRef:g,typingRef:_,valuesRef:b,keyboardActiveRef:x,multiple:T,highlightItemOnHover:w}=dl(),C=Bn(),R=qe(p,Ht.isActive,d.index),O=qe(p,Ht.isSelected,d.index,a),I=qe(p,Ht.isSelectedByFocus,d.index),D=qe(p,Ht.isItemEqualToValue),P=d.index,H=P!==-1,M=k.useRef(null),W=ar(P);rt(()=>{if(!H)return;const te=b.current;return te[P]=a,()=>{delete te[P]}},[H,P,a,b]),rt(()=>{if(!H)return;const te=p.state.value;let Z=te;T&&Array.isArray(te)&&te.length>0&&(Z=te[te.length-1]),Z!==void 0&&du(Z,a,D)&&p.set("selectedIndex",P)},[H,P,T,D,p,a]);const V=k.useMemo(()=>({disabled:o,selected:O,highlighted:R}),[o,O,R]),$=m({active:R,selected:O});$.onFocus=void 0,$.id=void 0;const q=k.useRef(null),K=k.useRef("mouse"),U=k.useRef(!1),{getButtonProps:F,buttonRef:B}=oa({disabled:o,focusableWhenDisabled:!0,native:l});function Y(te){const Z=p.state.value;if(T){const G=Array.isArray(Z)?Z:[],Q=O?ote(G,a,D):[...G,a];E(Q,st(af,te))}else E(a,st(af,te)),S(!1,st(af,te))}const z={role:"option","aria-selected":O,"aria-disabled":o||void 0,tabIndex:R?0:-1,onFocus(){p.set("activeIndex",P)},onMouseEnter(){!x.current&&p.state.selectedIndex===null&&p.set("activeIndex",P)},onMouseMove(){w&&p.set("activeIndex",P)},onMouseLeave(te){!w||x.current||dte(te)||C.start(0,()=>{p.state.activeIndex===P&&p.set("activeIndex",null)})},onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(te){q.current=te.key,p.set("activeIndex",P)},onClick(te){U.current=!1,!(te.type==="keydown"&&q.current===null)&&(o||q.current===" "&&_.current||K.current!=="touch"&&!R||(q.current=null,Y(te.nativeEvent)))},onPointerEnter(te){K.current=te.pointerType},onPointerDown(te){K.current=te.pointerType,U.current=!0},onMouseUp(te){if(o)return;if(U.current){U.current=!1;return}const Z=!g.current.allowSelectedMouseUp&&O,G=!g.current.allowUnselectedMouseUp&&!O;Z||G||K.current!=="touch"&&!R||Y(te.nativeEvent)}},J=Tt("div",t,{ref:[B,n,d.ref,M],state:V,props:[$,z,u,F]}),ee=k.useMemo(()=>({selected:O,indexRef:W,textRef:f,selectedByFocus:I,hasRegistered:H}),[O,W,f,I,H]);return y.jsx(fte.Provider,{value:ee,children:J})})),G_e=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=tM();return r||i?y.jsx(q_e,{...t,ref:n}):null}),q_e=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=tM(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=vo(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=Tt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:zs});return ji({open:s,ref:o,onComplete(){s||u(!1)}}),d})),K_e=k.memo(k.forwardRef(function(t,n){const{indexRef:r,textRef:i,selectedByFocus:a,hasRegistered:s}=tM(),{selectedItemTextRef:o}=dl(),{className:l,render:u,...f}=t,d=k.useCallback(m=>{if(!m||!s)return;const S=o.current===null||!o.current.isConnected;(a||S&&r.current===0)&&(o.current=m)},[o,r,a,s]);return Tt("div",t,{ref:[d,n,i],props:f})})),hte=k.forwardRef(function(t,n){const{render:r,className:i,direction:a,keepMounted:s=!1,...o}=t,{store:l,popupRef:u,listRef:f,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:p}=dl(),{side:m,scrollDownArrowRef:S,scrollUpArrowRef:E}=JP(),g=a==="up"?Ht.scrollUpArrowVisible:Ht.scrollDownArrowVisible,_=qe(l,g),b=qe(l,Ht.openMethod),x=_&&b!=="touch",T=Bn(),w=a==="up"?E:S,{transitionStatus:C,setMounted:R}=vo(x);rt(()=>(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]),ji({open:x,ref:w,onComplete(){x||R(!1)}});const O=k.useMemo(()=>({direction:a,visible:x,side:m,transitionStatus:C}),[a,x,m,C]),D=Tt("div",t,{ref:[n,w],state:O,props:[{"aria-hidden":!0,children:a==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(H){if(H.movementX===0&&H.movementY===0||T.isStarted())return;l.set("activeIndex",null);function M(){const W=l.state.listElement??u.current;if(!W)return;l.set("activeIndex",null),d();const V=W.scrollTop===0,$=Math.round(W.scrollTop+W.clientHeight)>=W.scrollHeight;if(f.current.length===0&&(a==="up"?l.set("scrollUpArrowVisible",!V):l.set("scrollDownArrowVisible",!$)),a==="up"&&V||a==="down"&&$){T.clear();return}if((l.state.listElement||u.current)&&f.current&&f.current.length>0){const K=f.current,U=w.current?.offsetHeight||0;if(a==="up"){let F=0;const B=W.scrollTop+U;for(let z=0;z<K.length;z+=1){const J=K[z];if(J&&J.offsetTop>=B){F=z;break}}const Y=Math.max(0,F-1);if(Y<F){const z=K[Y];z&&(W.scrollTop=Math.max(0,z.offsetTop-U))}else W.scrollTop=0}else{let F=K.length-1;const B=W.scrollTop+W.clientHeight-U;for(let z=0;z<K.length;z+=1){const J=K[z];if(J&&J.offsetTop+J.offsetHeight>B){F=Math.max(0,z-1);break}}const Y=Math.min(K.length-1,F+1);if(Y>F){const z=K[Y];z&&(W.scrollTop=z.offsetTop+z.offsetHeight-W.clientHeight+U)}else W.scrollTop=W.scrollHeight-W.clientHeight}}T.start(40,M)}T.start(40,M)},onMouseLeave(){T.clear()}},o]});return x||s?D:null}),Y_e=k.forwardRef(function(t,n){return y.jsx(hte,{...t,ref:n,direction:"down"})}),X_e=k.forwardRef(function(t,n){return y.jsx(hte,{...t,ref:n,direction:"up"})}),Qi=I_e;function Ji({className:e,...t}){return y.jsx(P_e,{"data-slot":"select-value",className:We("flex flex-1 text-left",e),...t})}function ea({className:e,size:t="default",children:n,...r}){return y.jsxs(D_e,{"data-slot":"select-trigger","data-size":t,className:We("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,y.jsx(M_e,{render:y.jsx(ve,{icon:Bee,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})})]})}function ta({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:a=0,alignItemWithTrigger:s=!0,...o}){return y.jsx(F_e,{children:y.jsx(U_e,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:s,className:"isolate z-50",children:y.jsxs(z_e,{"data-slot":"select-content",className:We("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:[y.jsx(Z_e,{}),y.jsx(V_e,{children:t}),y.jsx(Q_e,{})]})})})}function Nn({className:e,children:t,...n}){return y.jsxs(W_e,{"data-slot":"select-item",className:We("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:[y.jsx(K_e,{className:"flex flex-1 gap-2 shrink-0 whitespace-nowrap",children:t}),y.jsx(G_e,{render:y.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:y.jsx(ve,{icon:_u,strokeWidth:2,className:"pointer-events-none"})})]})}function Z_e({className:e,...t}){return y.jsx(X_e,{"data-slot":"select-scroll-up-button",className:We("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:y.jsx(ve,{icon:WP,strokeWidth:2})})}function Q_e({className:e,...t}){return y.jsx(Y_e,{"data-slot":"select-scroll-down-button",className:We("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:y.jsx(ve,{icon:Ay,strokeWidth:2})})}const pte=k.createContext(void 0);function nM(){const e=k.useContext(pte);if(e===void 0)throw new Error(bn(64));return e}let J_e=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const rM={tabActivationDirection:e=>({[J_e.activationDirection]:e})},eEe=k.forwardRef(function(t,n){const{className:r,defaultValue:i=0,onValueChange:a,orientation:s="horizontal",render:o,value:l,...u}=t,f=td(),d=Object.hasOwn(t,"defaultValue"),p=k.useRef([]),[m,S]=k.useState(()=>new Map),[E,g]=ns({controlled:l,default:i,name:"Tabs",state:"value"}),_=l!==void 0,[b,x]=k.useState(()=>new Map),[T,w]=k.useState("none"),C=Xe((q,K)=>{a?.(q,K),!K.isCanceled&&(g(q),w(K.activationDirection))}),R=Xe((q,K)=>{S(U=>{if(U.get(q)===K)return U;const F=new Map(U);return F.set(q,K),F})}),O=Xe((q,K)=>{S(U=>{if(!U.has(q)||U.get(q)!==K)return U;const F=new Map(U);return F.delete(q),F})}),I=k.useCallback(q=>m.get(q),[m]),D=k.useCallback(q=>{for(const K of b.values())if(q===K?.value)return K?.id},[b]),P=k.useCallback(q=>{if(q===void 0)return null;for(const[K,U]of b.entries())if(U!=null&&q===(U.value??U.index))return K;return null},[b]),H=k.useMemo(()=>({direction:f,getTabElementBySelectedValue:P,getTabIdByPanelValue:D,getTabPanelIdByValue:I,onValueChange:C,orientation:s,registerMountedTabPanel:R,setTabMap:x,unregisterMountedTabPanel:O,tabActivationDirection:T,value:E}),[f,P,D,I,C,s,R,x,O,T,E]),M=k.useMemo(()=>{for(const q of b.values())if(q!=null&&q.value===E)return q},[b,E]),W=k.useMemo(()=>{for(const q of b.values())if(q!=null&&!q.disabled)return q.value},[b]);rt(()=>{if(_||b.size===0)return;const q=M?.disabled,K=M==null&&E!==null;if(d&&q&&E===i||!q&&!K)return;const F=W??null;E!==F&&(g(F),w("none"))},[i,W,d,_,M,w,g,b,E]);const $=Tt("div",t,{state:{orientation:s,tabActivationDirection:T},ref:n,props:u,stateAttributesMapping:rM});return y.jsx(pte.Provider,{value:H,children:y.jsx(wy,{elementsRef:p,children:$})})}),mte=k.createContext(void 0);function tEe(){const e=k.useContext(mte);if(e===void 0)throw new Error(bn(65));return e}const nEe=k.forwardRef(function(t,n){const{className:r,disabled:i=!1,render:a,value:s,id:o,nativeButton:l=!0,...u}=t,{value:f,getTabPanelIdByValue:d,orientation:p}=nM(),{activateOnFocus:m,highlightedTabIndex:S,onTabActivation:E,setHighlightedTabIndex:g,tabsListElement:_}=tEe(),b=xi(o),x=k.useMemo(()=>({disabled:i,id:b,value:s}),[i,b,s]),{compositeProps:T,compositeRef:w,index:C}=Tee({metadata:x}),R=s===f,O=k.useRef(!1);rt(()=>{if(O.current){O.current=!1;return}if(!(R&&C>-1&&S!==C))return;const U=_;if(U!=null){const F=Os(Si(U));if(F&&wt(U,F))return}i||g(C)},[R,C,S,g,i,_]);const{getButtonProps:I,buttonRef:D}=oa({disabled:i,native:l,focusableWhenDisabled:!0}),P=d(s),H=k.useRef(!1),M=k.useRef(!1);function W(U){R||i||E(s,st(Yr,U.nativeEvent,void 0,{activationDirection:"none"}))}function V(U){R||(C>-1&&!i&&g(C),!i&&m&&(!H.current||H.current&&M.current)&&E(s,st(Yr,U.nativeEvent,void 0,{activationDirection:"none"})))}function $(U){if(R||i)return;H.current=!0;function F(){H.current=!1,M.current=!1}(!U.button||U.button===0)&&(M.current=!0,Si(U.currentTarget).addEventListener("pointerup",F,{once:!0}))}const q=k.useMemo(()=>({disabled:i,active:R,orientation:p}),[i,R,p]);return Tt("button",t,{state:q,ref:[n,D,w],props:[T,{role:"tab","aria-controls":P,"aria-selected":R,id:b,onClick:W,onFocus:V,onPointerDown:$,[_ee]:R?"":void 0,onKeyDownCapture(){O.current=!0}},u,I]})});let rEe=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const iEe=k.forwardRef(function(t,n){const{className:r,value:i,render:a,keepMounted:s=!1,...o}=t,{value:l,getTabIdByPanelValue:u,orientation:f,tabActivationDirection:d,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=nM(),S=xi(),E=k.useMemo(()=>({id:S,value:i}),[S,i]),{ref:g,index:_}=Am({metadata:E}),b=i!==l,x=u(i),T=k.useMemo(()=>({hidden:b,orientation:f,tabActivationDirection:d}),[b,f,d]),w=Tt("div",t,{state:T,ref:[n,g],props:[{"aria-labelledby":x,hidden:b,id:S??void 0,role:"tabpanel",tabIndex:b?-1:0,[rEe.index]:_},o],stateAttributesMapping:rM});return rt(()=>{if(!(b&&!s)&&S!=null)return p(i,S),()=>{m(i,S)}},[b,s,i,S,p,m]),!b||s?w:null}),aEe=k.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:i,loopFocus:a=!0,render:s,...o}=t,{getTabElementBySelectedValue:l,onValueChange:u,orientation:f,value:d,setTabMap:p,tabActivationDirection:m}=nM(),[S,E]=k.useState(0),[g,_]=k.useState(null),b=sEe(d,f,g,l),x=Xe((R,O)=>{if(R!==d){const I=b(R);O.activationDirection=I,u(R,O)}}),T=k.useMemo(()=>({orientation:f,tabActivationDirection:m}),[f,m]),w={"aria-orientation":f==="vertical"?"vertical":void 0,role:"tablist"},C=k.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:S,onTabActivation:x,setHighlightedTabIndex:E,tabsListElement:g,value:d}),[r,S,x,E,g,d]);return y.jsx(mte.Provider,{value:C,children:y.jsx(Sx,{render:s,className:i,state:T,refs:[n,_],props:[w,o],stateAttributesMapping:rM,highlightedIndex:S,enableHomeAndEndKeys:!0,loopFocus:a,orientation:f,onHighlightedIndexChange:E,onMapChange:p,disabledIndices:Zi})})});function M$(e,t){const{left:n,top:r}=e.getBoundingClientRect(),{left:i,top:a}=t.getBoundingClientRect(),s=n-i,o=r-a;return{left:s,top:o}}function sEe(e,t,n,r){const[i,a]=k.useState(null);return rt(()=>{if(e==null||n==null){a(null);return}const s=r(e);if(s==null){a(null);return}const{left:o,top:l}=M$(s,n);a(t==="horizontal"?o:l)},[t,r,n,e]),k.useCallback(s=>{if(s===e)return"none";if(s==null)return a(null),"none";if(s!=null&&n!=null){const o=r(s);if(o!=null){const{left:l,top:u}=M$(o,n);if(i==null)return a(t==="horizontal"?l:u),"none";if(t==="horizontal"){if(l<i)return a(l),"left";if(l>i)return a(l),"right"}else{if(u<i)return a(u),"up";if(u>i)return a(u),"down"}}}return"none"},[r,t,i,n,e])}function Dc({className:e,orientation:t="horizontal",...n}){return y.jsx(eEe,{"data-slot":"tabs","data-orientation":t,className:We("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",e),...n})}const oEe=Qc("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 Lc({className:e,variant:t="default",...n}){return y.jsx(aEe,{"data-slot":"tabs-list","data-variant":t,className:We(oEe({variant:t}),e),...n})}function Ii({className:e,...t}){return y.jsx(nEe,{"data-slot":"tabs-trigger",className:We("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 _a({className:e,...t}){return y.jsx(iEe,{"data-slot":"tabs-content",className:We("text-xs/relaxed flex-1 min-h-0 outline-none",e),...t})}function lEe(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:s,handle:o,triggerId:l,defaultTriggerId:u=null}=e,f=Eu(),d=!!f,p=Ei(()=>o?.store??new Yee({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",a);const m=p.useState("payload");Kee({store:p,actionsRef:s,parentContext:f?.store.context});const S=k.useMemo(()=>({store:p}),[p]);return y.jsx(XP.Provider,{value:S,children:typeof t=="function"?t({payload:m}):t})}const gte=k.createContext(void 0),bte=k.createContext(void 0),vte=k.createContext(void 0),yte=k.createContext("");function wu(){const e=k.useContext(gte);if(!e)throw new Error(bn(22));return e}function Lx(){const e=k.useContext(bte);if(!e)throw new Error(bn(23));return e}function Hf(){const e=k.useContext(vte);if(!e)throw new Error(bn(24));return e}function iM(){return k.useContext(yte)}const mt={id:Ue(e=>e.id),query:Ue(e=>e.query),items:Ue(e=>e.items),selectedValue:Ue(e=>e.selectedValue),open:Ue(e=>e.open),mounted:Ue(e=>e.mounted),forceMounted:Ue(e=>e.forceMounted),inline:Ue(e=>e.inline),activeIndex:Ue(e=>e.activeIndex),selectedIndex:Ue(e=>e.selectedIndex),isActive:Ue((e,t)=>e.activeIndex===t),isSelected:Ue((e,t)=>{const n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(i=>du(i,t,n)):du(r,t,n)}),transitionStatus:Ue(e=>e.transitionStatus),popupProps:Ue(e=>e.popupProps),inputProps:Ue(e=>e.inputProps),triggerProps:Ue(e=>e.triggerProps),getItemProps:Ue(e=>e.getItemProps),positionerElement:Ue(e=>e.positionerElement),listElement:Ue(e=>e.listElement),triggerElement:Ue(e=>e.triggerElement),inputElement:Ue(e=>e.inputElement),popupSide:Ue(e=>e.popupSide),openMethod:Ue(e=>e.openMethod),inputInsidePopup:Ue(e=>e.inputInsidePopup),selectionMode:Ue(e=>e.selectionMode),listRef:Ue(e=>e.listRef),labelsRef:Ue(e=>e.labelsRef),popupRef:Ue(e=>e.popupRef),emptyRef:Ue(e=>e.emptyRef),inputRef:Ue(e=>e.inputRef),keyboardActiveRef:Ue(e=>e.keyboardActiveRef),chipsContainerRef:Ue(e=>e.chipsContainerRef),clearRef:Ue(e=>e.clearRef),valuesRef:Ue(e=>e.valuesRef),allValuesRef:Ue(e=>e.allValuesRef),name:Ue(e=>e.name),disabled:Ue(e=>e.disabled),readOnly:Ue(e=>e.readOnly),required:Ue(e=>e.required),grid:Ue(e=>e.grid),isGrouped:Ue(e=>e.isGrouped),virtualized:Ue(e=>e.virtualized),onOpenChangeComplete:Ue(e=>e.onOpenChangeComplete),openOnInputClick:Ue(e=>e.openOnInputClick),itemToStringLabel:Ue(e=>e.itemToStringLabel),isItemEqualToValue:Ue(e=>e.isItemEqualToValue),modal:Ue(e=>e.modal),autoHighlight:Ue(e=>e.autoHighlight),submitOnItemClick:Ue(e=>e.submitOnItemClick)};function uEe(e,t){return(n,r)=>{if(n==null)return!1;const i=Kr(n,t);return e.contains(i,r)}}function cEe(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;const a=Kr(r,t),s=n!=null?Kr(n,t):"";return s&&e.contains(s,i)&&s.length===i.length?!0:e.contains(a,i)}}const j$=new Map;function _te(e){return Array.isArray(e)?e.map(t=>_te(t)).join(","):e==null?"":String(e)}function dEe(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${_te(e.locale)}|${JSON.stringify(t)}`,r=j$.get(n);if(r)return r;const i=new Intl.Collator(e.locale,t),a={contains(s,o,l){if(!o)return!0;const u=Kr(s,l);for(let f=0;f<=u.length-o.length;f+=1)if(i.compare(u.slice(f,f+o.length),o)===0)return!0;return!1},startsWith(s,o,l){if(!o)return!0;const u=Kr(s,l);return i.compare(u.slice(0,o.length),o)===0},endsWith(s,o,l){if(!o)return!0;const u=Kr(s,l),f=o.length;return u.length>=f&&i.compare(u.slice(u.length-f),o)===0}};return j$.set(n,a),a}const fEe=dEe,Ete=Symbol("none"),Rd={value:Ete,index:-1};function hEe(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:s,inputValue:o,selectionMode:l="none",onItemHighlighted:u,name:f,disabled:d=!1,readOnly:p=!1,required:m=!1,inputRef:S,grid:E=!1,items:g,filteredItems:_,filter:b,openOnInputClick:x=!0,autoHighlight:T=!1,keepHighlight:w=!1,highlightItemOnHover:C=!0,itemToStringLabel:R,itemToStringValue:O,isItemEqualToValue:I=ste,virtualized:D=!1,inline:P=!1,fillInputOnItemPress:H=!0,modal:M=!1,limit:W=-1,autoComplete:V="list",locale:$,submitOnItemClick:q=!1}=e,{clearErrors:K}=Iy(),{setDirty:U,validityData:F,shouldValidateOnChange:B,setFilled:Y,name:z,disabled:J,validation:ee}=$s(),te=Nx({id:t}),Z=fEe({locale:$}),[G,Q]=k.useState(!1),[ae,se]=k.useState(null),ne=k.useRef([]),ye=k.useRef([]),Ee=k.useRef(null),he=k.useRef(null),_e=k.useRef(null),be=k.useRef(!0),Ke=k.useRef(!1),Se=k.useRef(null),$e=k.useRef(null),Te=k.useRef(null),we=k.useRef(Rd),le=k.useRef(null),me=k.useRef([]),Ne=k.useRef([]),pe=J||d,De=z??f,Ce=l==="multiple",ze=l==="single",Ze=o!==void 0||s!==void 0,gt=g!==void 0,it=_!==void 0;let ot;T==="always"?ot="always":ot=T?"input-change":!1;const[Me,ft]=ns({controlled:i,default:Ce?r??Zi:r,name:"Combobox",state:"selectedValue"}),Oe=k.useMemo(()=>b===null?()=>!0:b!==void 0?b:ze&&!G?cEe(Z,R,Me):uEe(Z,R),[b,ze,Me,G,Z,R]),Fe=Ei(()=>Ze?s??"":ze?Kr(Me,R):"").current,[Je,lt]=ns({controlled:o,default:Fe,name:"Combobox",state:"inputValue"}),[ht,vn]=ns({controlled:e.open,default:e.defaultOpen,name:"Combobox",state:"open"}),Dt=lte(g),Ot=ae??(Je===""?"":String(Je).trim()),ct=ze?Kr(Me,R):"",en=ze&&!G&&Ot!==""&&ct!==""&&ct.length===Ot.length&&Z.contains(ct,Ot),Lt=en?"":Ot,yt=gt&&it&&en,Bt=k.useMemo(()=>g?Dt?g.flatMap(dt=>dt.items):g:Zi,[g,Dt]),jt=k.useMemo(()=>{if(_&&!yt)return _;if(!g)return Zi;if(Dt){const Ct=g,qt=[];let Kn=0;for(const gr of Ct){if(W>-1&&Kn>=W)break;const Lr=Lt===""?gr.items:gr.items.filter(wl=>Oe(wl,Lt,R));if(Lr.length===0)continue;const Sl=W>-1?W-Kn:1/0,xl=Lr.slice(0,Sl);if(xl.length>0){const wl={...gr,items:xl};qt.push(wl),Kn+=xl.length}}return qt}if(Lt==="")return W>-1?Bt.slice(0,W):Bt;const dt=[];for(const Ct of Bt){if(W>-1&&dt.length>=W)break;Oe(Ct,Lt,R)&&dt.push(Ct)}return dt},[_,yt,g,Dt,Lt,W,Oe,R,Bt]),Ut=k.useMemo(()=>Dt?jt.flatMap(Ct=>Ct.items):jt,[jt,Dt]),pt=Ei(()=>new sf({id:te,selectedValue:Me,open:ht,filter:Oe,query:Ot,items:g,selectionMode:l,listRef:ne,labelsRef:ye,popupRef:Ee,emptyRef:_e,inputRef:he,keyboardActiveRef:be,chipsContainerRef:Se,clearRef:$e,valuesRef:me,allValuesRef:Ne,selectionEventRef:Te,name:De,disabled:pe,readOnly:p,required:m,grid:E,isGrouped:Dt,virtualized:D,openOnInputClick:x,itemToStringLabel:R,isItemEqualToValue:I,modal:M,autoHighlight:ot,submitOnItemClick:q,hasInputValue:Ze,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:P,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:n||br,setOpen:br,setInputValue:br,setSelectedValue:br,setIndices:br,onItemHighlighted:br,handleSelection:br,getItemProps:()=>sr,forceMount:br,requestSubmit:br})).current,ln=l==="none"?Je:Me,yr=k.useMemo(()=>l==="none"?ln:Array.isArray(Me)?Me.map(dt=>no(dt,O)):no(Me,O),[ln,O,l,Me]),kr=Xe(u),Dr=Xe(n),$i=qe(pt,mt.activeIndex),_l=qe(pt,mt.selectedIndex),ci=qe(pt,mt.positionerElement),lr=qe(pt,mt.listElement),mr=qe(pt,mt.triggerElement),ua=qe(pt,mt.inputElement),Ci=qe(pt,mt.inline),ls=qe(pt,mt.inputInsidePopup),Iu=ar(mr),{mounted:Vt,setMounted:Co,transitionStatus:Ao}=vo(ht),{openMethod:us,triggerProps:cs,reset:El}=Ix(ht);Ny({id:te,name:De,commit:ee.commit,value:ln,controlRef:ls?Iu:he,getValue:()=>yr});const Pa=Xe(()=>{g?ye.current=Ut.map(dt=>Kr(dt,R)):pt.set("forceMounted",!0)}),_r=k.useRef(Me);rt(()=>{Me!==_r.current&&Pa()},[Pa,Me]);const di=Xe(dt=>{pt.update(dt);const Ct=dt.type||"none";if(dt.activeIndex!==void 0)if(dt.activeIndex===null)we.current!==Rd&&(we.current=Rd,kr(void 0,Jg(Ct,void 0,{index:-1})));else{const qt=me.current[dt.activeIndex];we.current={value:qt,index:dt.activeIndex},kr(qt,Jg(Ct,void 0,{index:dt.activeIndex}))}}),fi=Xe((dt,Ct)=>{if(Ke.current=Ct.reason===cc,e.onInputValueChange?.(dt,Ct),!Ct.isCanceled){if(Ct.reason===zd){const qt=dt.trim()!=="";qt&&Q(!0),le.current={hasQuery:qt},qt&&ot&&pt.state.activeIndex==null&&pt.set("activeIndex",0)}lt(dt)}}),Hi=Xe((dt,Ct)=>{ht!==dt&&(Ct.reason==="escape-key"&>&&Ut.length===0&&!pt.state.emptyRef.current&&Ct.allowPropagation(),e.onOpenChange?.(dt,Ct),!Ct.isCanceled&&(!dt&&G&&(ze?(se(Ot),Ot===""&&Q(!1)):Ce&&(Ci||ls?di({activeIndex:null}):se(Ot),fi("",st(cc,Ct.event)))),vn(dt)))}),Ma=Xe((dt,Ct)=>{if(a?.(dt,Ct),Ct.isCanceled)return;ft(dt),(l==="none"&&Ee.current&&H||ze&&!pt.state.inputInsidePopup)&&fi(Kr(dt,R),st(Ct.reason,Ct.event)),ze&&dt!=null&&Ct.reason!==zd&&G&&se(Ot)}),eg=Xe((dt,Ct)=>{let qt=Ct;if(qt===void 0){if($i===null)return;qt=me.current[$i]}const Kn=Tr(dt),gr=Te.current??dt;Te.current=null;const Lr=st(af,gr),Sl=Kn?.closest("a")?.getAttribute("href");if(Sl){Sl.startsWith("#")&&Hi(!1,Lr);return}if(Ce){const xl=Array.isArray(Me)?Me:[],Ks=Gd(xl,qt,pt.state.isItemEqualToValue)?ote(xl,qt,pt.state.isItemEqualToValue):[...xl,qt];if(Ma(Ks,Lr),!(he.current?he.current.value.trim()!=="":!1))return;pt.state.inputInsidePopup?fi("",st(cc,Lr.event)):Hi(!1,Lr)}else Ma(qt,Lr),Hi(!1,Lr)}),Nu=Xe(()=>{if(!pt.state.submitOnItemClick)return;const dt=pt.state.inputElement?.form;dt&&typeof dt.requestSubmit=="function"&&dt.requestSubmit()}),Du=Xe(()=>{if(Co(!1),Dr?.(!1),Q(!1),El(),se(null),di(l==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ce&&he.current&&he.current.value!==""&&!Ke.current&&fi("",st(cc)),ze)if(pt.state.inputInsidePopup)he.current&&he.current.value!==""&&fi("",st(cc));else{const dt=Kr(Me,R);he.current&&he.current.value!==dt&&fi(dt,st(dt===""?cc:Yr))}}),tg=k.useMemo(()=>Ci&&ci?{current:ci.closest('[role="dialog"]')}:Ee,[Ci,ci]);ji({enabled:!e.actionsRef,open:ht,ref:tg,onComplete(){ht||Du()}}),k.useImperativeHandle(e.actionsRef,()=>({unmount:Du}),[Du]),rt(function(){if(ht||l==="none")return;const Ct=g?Bt:Ne.current;if(Ce){const qt=Array.isArray(Me)?Me:[],Kn=qt[qt.length-1],gr=Lp(Ct,Kn,I);di({selectedIndex:gr===-1?null:gr})}else{const qt=Lp(Ct,Me,I);di({selectedIndex:qt===-1?null:qt})}},[ht,Me,g,l,Bt,Ce,I,di]),rt(()=>{g&&(me.current=Ut,ne.current.length=Ut.length)},[g,Ut]),rt(()=>{const dt=le.current;if(dt&&(dt.hasQuery?ot&&pt.set("activeIndex",0):ot==="always"&&pt.set("activeIndex",0),le.current=null),!ht&&!Ci)return;const qt=gt||it?Ut:me.current,Kn=pt.state.activeIndex;if(Kn==null){if(ot==="always"&&qt.length>0){pt.set("activeIndex",0);return}we.current!==Rd&&(we.current=Rd,pt.state.onItemHighlighted(void 0,Jg(Yr,void 0,{index:-1})));return}if(Kn>=qt.length){we.current!==Rd&&(we.current=Rd,pt.state.onItemHighlighted(void 0,Jg(Yr,void 0,{index:-1}))),pt.set("activeIndex",null);return}const gr=qt[Kn],Lr=we.current.value,Sl=Lr!==Ete&&pt.state.isItemEqualToValue(gr,Lr);(we.current.index!==Kn||!Sl)&&(we.current={value:gr,index:Kn},pt.state.onItemHighlighted(gr,Jg(Yr,void 0,{index:Kn})))},[$i,ot,it,gt,Ut,Ci,ht,pt]),rt(()=>{if(!g||l==="none")return;const dt=Bt;if(Ce){const Kn=Array.isArray(Me)?Me:Zi,gr=Kn.filter(Lr=>Gd(dt,Lr,pt.state.isItemEqualToValue));gr.length!==Kn.length&&ft(gr);return}if(Me==null?!0:Gd(dt,Me,pt.state.isItemEqualToValue))return;let qt=null;if(r!=null&&Gd(dt,r,pt.state.isItemEqualToValue)&&(qt=r),ft(qt),!pt.state.inputInsidePopup){const Kn=Kr(qt,R);he.current&&he.current.value!==Kn&&fi(Kn,st(Yr))}},[g,Bt,Ce,l,Me,r,ft,R,pt,fi]),rt(()=>{if(l==="none"){Y(String(Je)!=="");return}Y(Ce?Array.isArray(Me)&&Me.length>0:Me!=null)},[Y,l,Je,Me,Ce]),k.useEffect(()=>{gt&&ot&&Ut.length===0&&di({activeIndex:null})},[gt,ot,Ut.length,di]),qd(Ot,()=>{!ht||Ot===""||Ot===String(Fe)||Q(!0)}),qd(Me,()=>{if(l!=="none"&&(K(De),U(Me!==F.initialValue),B()?ee.commit(Me):ee.commit(Me,!0),Ce&&pt.state.selectedIndex!==null&&(!Array.isArray(Me)||Me.length===0)&&di({activeIndex:null,selectedIndex:null}),ze&&!Ze&&!ls)){const dt=Kr(Me,R);Je!==dt&&fi(dt,st(Yr))}}),qd(Je,()=>{l==="none"&&(K(De),U(Je!==F.initialValue),B()?ee.commit(Je):ee.commit(Je,!0))}),qd(g,()=>{if(!ze||Ze||ls||G)return;const dt=Kr(Me,R);Je!==dt&&fi(dt,st(Yr))});const qs=yx({open:Ci?!0:ht,onOpenChange:Hi,elements:{reference:ls?mr:ua,floating:ci}});let ja,zi;Ci||(ja=E?"grid":"listbox",zi=ht?"true":"false");const Ai=k.useMemo(()=>{const dt=ua?.tagName==="INPUT",Ct=dt||ht,qt=dt?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return Ct&&(qt.role="combobox",qt["aria-expanded"]=zi,qt["aria-haspopup"]=ja,qt["aria-controls"]=ht?lr?.id:void 0,qt["aria-autocomplete"]=V),{reference:qt,floating:{role:"presentation"}}},[ua,ht,zi,ja,lr?.id,V]),Ve=Tm(qs,{enabled:!p&&!pe&&x,event:"mousedown-only",toggle:!1,touchOpenDelay:ls?0:50}),Ft=xy(qs,{enabled:!p&&!pe&&!Ci,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Ci?!0:void 0,outsidePress(dt){const Ct=Tr(dt);return!wt(mr,Ct)&&!wt($e.current,Ct)&&!wt(Se.current,Ct)}}),ki=FP(qs,{enabled:!p&&!pe,id:te,listRef:ne,activeIndex:$i,selectedIndex:_l,virtual:!0,loopFocus:!0,allowEscape:!ot,focusItemOnOpen:G||l==="none"&&!ot?!1:"auto",focusItemOnHover:C,resetOnPointerLeave:!w,cols:E?2:1,orientation:E?"horizontal":void 0,disabledIndices:Zi,onNavigate(dt,Ct){!Ct&&!ht||Ao==="ending"||di(Ct?{activeIndex:dt,type:be.current?"keyboard":"pointer"}:{activeIndex:dt})}}),{getReferenceProps:ds,getFloatingProps:Vi,getItemProps:oh}=Ff([Ai,Ve,Ft,ki]);nte(()=>{pt.update({inline:P,popupProps:Vi(),inputProps:ds(),triggerProps:cs,getItemProps:oh,setOpen:Hi,setInputValue:fi,setSelectedValue:Ma,setIndices:di,onItemHighlighted:kr,handleSelection:eg,forceMount:Pa,requestSubmit:Nu})}),rt(()=>{pt.update({id:te,selectedValue:Me,open:ht,mounted:Vt,transitionStatus:Ao,items:g,inline:P,popupProps:Vi(),inputProps:ds(),triggerProps:cs,openMethod:us,getItemProps:oh,selectionMode:l,name:De,disabled:pe,readOnly:p,required:m,grid:E,isGrouped:Dt,virtualized:D,onOpenChangeComplete:Dr,openOnInputClick:x,itemToStringLabel:R,modal:M,autoHighlight:ot,isItemEqualToValue:I,submitOnItemClick:q,hasInputValue:Ze,requestSubmit:Nu})},[pt,te,Me,ht,Vt,Ao,g,Vi,ds,oh,us,cs,l,De,pe,p,m,ee,E,Dt,D,Dr,x,R,M,I,q,Ze,P,Nu,ot]);const ca=Us(S,ee.inputRef),ng=k.useMemo(()=>({query:Ot,filteredItems:jt,flatFilteredItems:Ut}),[Ot,jt,Ut]),E0=k.useMemo(()=>Array.isArray(ln)?"":no(ln,O),[ln,O]),rg=Ce&&Array.isArray(Me)&&Me.length>0,Lu=k.useMemo(()=>!Ce||!Array.isArray(Me)||!De?null:Me.map(dt=>{const Ct=no(dt,O);return y.jsx("input",{type:"hidden",name:De,value:Ct},Ct)}),[Ce,Me,De,O]),S0=y.jsxs(k.Fragment,{children:[e.children,y.jsx("input",{...ee.getInputValidationProps({onFocus(){if(ls){mr?.focus();return}(he.current||mr)?.focus()},onChange(dt){if(dt.nativeEvent.defaultPrevented)return;const Ct=dt.target.value,qt=st(zd,dt.nativeEvent);function Kn(){if(Ce)return;if(l==="none"){U(Ct!==F.initialValue),fi(Ct,qt),B()&&ee.commit(Ct);return}const gr=me.current.find(Lr=>no(Lr,O).toLowerCase()===Ct.toLowerCase());gr!=null&&(U(gr!==F.initialValue),Ma?.(gr,qt),B()&&ee.commit(gr))}g?Kn():(Pa(),queueMicrotask(Kn))}}),id:te,name:Ce||l==="none"?void 0:De,disabled:pe,required:m&&!rg,readOnly:p,value:E0,ref:ca,style:wm,tabIndex:-1,"aria-hidden":!0}),Lu]});return y.jsx(gte.Provider,{value:pt,children:y.jsx(bte.Provider,{value:qs,children:y.jsx(vte.Provider,{value:ng,children:y.jsx(yte.Provider,{value:Je,children:S0})})})})}const t_=2,pEe={...Np,...$f},mEe=k.forwardRef(function(t,n){const{render:r,className:i,nativeButton:a=!0,disabled:s=!1,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=$s(),{labelId:S}=nd(),E=wu(),g=qe(E,mt.selectionMode),_=qe(E,mt.disabled),b=qe(E,mt.readOnly),x=qe(E,mt.listElement),T=qe(E,mt.triggerProps),w=qe(E,mt.triggerElement),C=qe(E,mt.inputInsidePopup),R=qe(E,mt.open),O=qe(E,mt.selectedValue),I=qe(E,mt.activeIndex),D=qe(E,mt.selectedIndex),P=Lx(),H=iM(),M=Bn(),W=u||_||s,V=k.useRef("");function $(ee){V.current=ee.pointerType}const q=P.select("domReferenceElement");k.useEffect(()=>{C&&w&&w!==q&&P.set("domReferenceElement",w)},[w,q,P,C]);const{reference:K}=BP(P,{enabled:!R&&!b&&!_&&g==="single",listRef:E.state.labelsRef,activeIndex:I,selectedIndex:D,onMatch(ee){const te=E.state.valuesRef.current[ee];te!==void 0&&E.state.setSelectedValue(te,st("none"))}}),{reference:U}=Tm(P,{enabled:!b&&!_,event:"mousedown"}),{buttonRef:F,getButtonProps:B}=oa({native:a,disabled:W}),Y=k.useMemo(()=>({...l,open:R,disabled:W}),[l,R,W]),z=Xe(ee=>{E.set("triggerElement",ee)});return Tt("button",t,{ref:[n,F,z],state:Y,props:[T,U,K,{tabIndex:C?0:-1,disabled:W,role:C?"combobox":void 0,"aria-expanded":R?"true":"false","aria-haspopup":C?"dialog":"listbox","aria-controls":R?x?.id:void 0,"aria-readonly":b||void 0,"aria-labelledby":S,onPointerDown:$,onPointerEnter:$,onFocus(){d(!0),!(W||b)&&M.start(0,E.state.forceMount)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const ee=g==="none"?H:O;m.commit(ee)}},onMouseDown(ee){if(W||b||(C||P.set("domReferenceElement",ee.currentTarget),E.state.forceMount(),V.current!=="touch"&&(E.state.inputRef.current?.focus(),C||ee.preventDefault()),R))return;const te=Si(ee.currentTarget);function Z(G){if(!w)return;const Q=Tr(G),ae=E.state.positionerElement,se=E.state.listElement;if(wt(w,Q)||wt(ae,Q)||wt(se,Q)||Q===w)return;const ne=QP(w),ye=G.clientX>=ne.left-t_&&G.clientX<=ne.right+t_,Ee=G.clientY>=ne.top-t_&&G.clientY<=ne.bottom+t_;ye&&Ee||E.state.setOpen(!1,st("cancel-open",G))}C&&te.addEventListener("mouseup",Z,{once:!0})},onKeyDown(ee){W||b||(ee.key==="ArrowDown"||ee.key==="ArrowUp")&&(wr(ee),E.state.setOpen(!0,st(pp,ee.nativeEvent)),E.state.inputRef.current?.focus())}},m?m.getValidationProps(o):o,B],stateAttributesMapping:pEe})}),gEe=k.createContext(void 0);function bEe(){return k.useContext(gEe)}const Ste=k.createContext(void 0);function aM(e){const t=k.useContext(Ste);if(t===void 0&&!e)throw new Error(bn(21));return t}const vEe={...Np,...$f,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},yEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,id:s,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=$s(),{labelId:S}=nd(),E=bEe(),_=!!aM(!0),b=wu(),{filteredItems:x}=Hf(),T=iM(),w=xi(s),C=td(),R=qe(b,mt.disabled),O=qe(b,mt.readOnly),I=qe(b,mt.name),D=qe(b,mt.selectionMode),P=qe(b,mt.autoHighlight),H=qe(b,mt.inputProps),M=qe(b,mt.triggerProps),W=qe(b,mt.open),V=qe(b,mt.mounted),$=qe(b,mt.selectedValue),q=qe(b,mt.popupSide),K=qe(b,mt.positionerElement),U=!!P,F=V&&K?q:null,B=u||R||a,Y=x.length===0,[z,J]=k.useState(null),ee=k.useRef(!1),te=Xe(ae=>{const se=_||b.state.inline;se&&!b.state.hasInputValue&&b.state.setInputValue("",st(Yr)),b.update({inputElement:ae,inputInsidePopup:se})}),Z=k.useMemo(()=>({...l,open:W,disabled:B,readOnly:O,popupSide:F,listEmpty:Y}),[l,W,B,O,F,Y]);function G(ae){if(!E)return;let se;const{highlightedChipIndex:ne}=E;if(ne!==void 0){if(ae.key==="ArrowLeft")ae.preventDefault(),ne>0?se=ne-1:se=void 0;else if(ae.key==="ArrowRight")ae.preventDefault(),ne<$.length-1?se=ne+1:se=void 0;else if(ae.key==="Backspace"||ae.key==="Delete"){ae.preventDefault();const ye=ne>=$.length-1?$.length-2:ne;se=ye>=0?ye:void 0,b.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return se}return ae.key==="ArrowLeft"&&(ae.currentTarget.selectionStart??0)===0&&$.length>0?(ae.preventDefault(),se=Math.max($.length-1,0)):ae.key==="Backspace"&&ae.currentTarget.value===""&&$.length>0&&(b.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),ae.preventDefault()),se}return Tt("input",t,{state:Z,ref:[n,b.state.inputRef,te],props:[H,M,{type:"text",value:t.value??z??T,"aria-readonly":O||void 0,"aria-labelledby":S,disabled:B,readOnly:O,...D==="none"&&I&&{name:I},id:w,onFocus(){d(!0)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const ae=D==="none"?T:$;m.commit(ae)}},onCompositionStart(ae){pE||(ee.current=!0,J(ae.currentTarget.value))},onCompositionEnd(ae){ee.current=!1;const se=ae.currentTarget.value;J(null),b.state.setInputValue(se,st(zd,ae.nativeEvent))},onChange(ae){if(ee.current){const Ee=ae.currentTarget.value;J(Ee),Ee===""&&!b.state.openOnInputClick&&!b.state.inputInsidePopup&&b.state.setOpen(!1,st(cc,ae.nativeEvent));const he=Ee.trim(),_e=U&&he!=="";!O&&!B&&he!==""&&(b.state.setOpen(!0,st(zd,ae.nativeEvent)),U||b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})),W&&b.state.activeIndex!==null&&!_e&&b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"});return}b.state.setInputValue(ae.currentTarget.value,st(zd,ae.nativeEvent));const se=ae.currentTarget.value==="",ne=st(cc,ae.nativeEvent);se&&!b.state.inputInsidePopup&&(D==="single"&&b.state.setSelectedValue(null,ne),b.state.openOnInputClick||b.state.setOpen(!1,ne));const ye=ae.currentTarget.value.trim();!O&&!B&&ye!==""&&(b.state.setOpen(!0,st(zd,ae.nativeEvent)),U||b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})),W&&b.state.activeIndex!==null&&!U&&b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(ae){if(B||O||ae.ctrlKey||ae.shiftKey||ae.altKey||ae.metaKey)return;b.state.keyboardActiveRef.current=!0;const se=ae.currentTarget,ne=se.scrollWidth-se.clientWidth,ye=C==="rtl";if(ae.key==="Home"){wr(ae);const he=K7&&ye?se.value.length:0;se.setSelectionRange(he,he),se.scrollLeft=0;return}if(ae.key==="End"){wr(ae);const he=K7&&ye?0:se.value.length;se.setSelectionRange(he,he),se.scrollLeft=ye?-ne:ne;return}if(!V&&ae.key==="Escape"){const he=D==="multiple"&&Array.isArray($)?$.length===0:$===null,_e=st(px,ae.nativeEvent),be=D==="multiple"?[]:null;b.state.setInputValue("",_e),b.state.setSelectedValue(be,_e),!he&&!b.state.inline&&!_e.isPropagationAllowed&&ae.stopPropagation();return}if(E&&ae.key==="Backspace"&&se.value===""&&E.highlightedChipIndex===void 0&&Array.isArray($)&&$.length>0){const he=$.slice(0,-1);b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"}),b.state.setSelectedValue(he,st(Yr,ae.nativeEvent));return}const Ee=G(ae);if(E?.setHighlightedChipIndex(Ee),Ee!==void 0?E?.chipsRef.current[Ee]?.focus():b.state.inputRef.current?.focus(),ae.which!==229&&ae.key==="Enter"&&W){const he=b.state.activeIndex,_e=ae.nativeEvent;if(he===null){b.state.setOpen(!1,st(Yr,_e));return}wr(ae);const be=b.state.listRef.current[he];be&&(b.state.selectionEventRef.current=_e,be.click(),b.state.selectionEventRef.current=null)}},onPointerMove(){b.state.keyboardActiveRef.current=!1},onPointerDown(){b.state.keyboardActiveRef.current=!1}},m?m.getValidationProps(o):o],stateAttributesMapping:vEe})}),_Ee={...zs,...$P},EEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,keepMounted:o=!1,...l}=t,{disabled:u}=$s(),f=wu(),d=qe(f,mt.selectionMode),p=qe(f,mt.disabled),m=qe(f,mt.readOnly),S=qe(f,mt.open),E=qe(f,mt.selectedValue),g=iM();let _=!1;d==="none"?_=g!=="":d==="single"?_=E!=null:_=Array.isArray(E)&&E.length>0;const b=u||p||a,{buttonRef:x,getButtonProps:T}=oa({native:s,disabled:b}),{mounted:w,transitionStatus:C,setMounted:R}=vo(_),O=k.useMemo(()=>({disabled:b,open:S,transitionStatus:C}),[b,S,C]);ji({open:_,ref:f.state.clearRef,onComplete(){_||R(!1)}});const I=Tt("button",t,{state:O,ref:[n,x,f.state.clearRef],props:[{tabIndex:-1,children:"x",disabled:b,"aria-readonly":m||void 0,onMouseDown(P){P.preventDefault()},onClick(P){if(b||m)return;const H=f.state.keyboardActiveRef;f.state.setInputValue("",st(t$,P.nativeEvent)),d!=="none"?(f.state.setSelectedValue(Array.isArray(E)?[]:null,st(t$,P.nativeEvent)),f.state.setIndices({activeIndex:null,selectedIndex:null,type:H.current?"keyboard":"pointer"})):f.state.setIndices({activeIndex:null,type:H.current?"keyboard":"pointer"}),f.state.inputRef.current?.focus()}},l,T],stateAttributesMapping:_Ee});return o||w?I:null}),SEe=k.createContext(null);function xEe(){return k.useContext(SEe)}function wEe(e){const{children:t}=e,{filteredItems:n}=Hf(),r=xEe(),i=r?r.items:n;return i?y.jsx(k.Fragment,{children:i.map(t)}):null}const TEe=k.forwardRef(function(t,n){var r;const{render:i,className:a,children:s,...o}=t,l=wu(),u=Lx(),f=!!aM(!0),{filteredItems:d}=Hf(),p=qe(l,mt.items),m=qe(l,mt.labelsRef),S=qe(l,mt.listRef),E=qe(l,mt.selectionMode),g=qe(l,mt.grid),_=qe(l,mt.popupProps),b=qe(l,mt.disabled),x=qe(l,mt.readOnly),T=qe(l,mt.virtualized),w=E==="multiple",C=d.length===0,R=Xe(M=>{l.set("positionerElement",M)}),O=Xe(M=>{l.set("listElement",M)}),I=k.useMemo(()=>typeof s=="function"?r||(r=y.jsx(wEe,{children:s})):s,[s]),D=k.useMemo(()=>({empty:C}),[C]),P=u.useState("floatingId"),H=Tt("div",t,{state:D,ref:[n,O,f?null:R],props:[_,{children:I,tabIndex:-1,id:P,role:g?"grid":"listbox","aria-multiselectable":w?"true":void 0,onKeyDown(M){if(!(b||x)&&M.key==="Enter"){const W=l.state.activeIndex;if(W==null)return;wr(M);const V=M.nativeEvent,$=l.state.listRef.current[W];$&&(l.state.selectionEventRef.current=V,$.click(),l.state.selectionEventRef.current=null)}},onKeyDownCapture(){l.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.state.keyboardActiveRef.current=!1}},o]});return T?H:y.jsx(wy,{elementsRef:S,labelsRef:p?void 0:m,children:H})}),xte=k.createContext(void 0);function CEe(){const e=k.useContext(xte);if(e===void 0)throw new Error(bn(20));return e}const AEe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,a=wu(),s=qe(a,mt.mounted),o=qe(a,mt.forceMounted);return s||r||o?y.jsx(xte.Provider,{value:r,children:y.jsx(Sy,{ref:n,...i})}):null}),kEe=k.forwardRef(function(t,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:S=!1,disableAnchorTracking:E=!1,collisionAvoidance:g=dx,..._}=t,b=wu(),{filteredItems:x}=Hf(),T=Lx(),w=CEe(),C=qe(b,mt.modal),R=qe(b,mt.open),O=qe(b,mt.mounted),I=qe(b,mt.openMethod),D=qe(b,mt.triggerElement),P=qe(b,mt.inputElement),H=qe(b,mt.inputInsidePopup),M=x.length===0,V=wx({anchor:a??(H?D:P),floatingRootContext:T,positionMethod:s,mounted:O,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:S,disableAnchorTracking:E,keepMounted:w,collisionAvoidance:g,lazyFlip:!0});Rx(R&&C&&I!=="touch",D);const $=k.useMemo(()=>{const B={...V.positionerStyles};return R||(B.pointerEvents="none"),{role:"presentation",hidden:!O,style:B}},[R,O,V.positionerStyles]),q=k.useMemo(()=>({open:R,side:V.side,align:V.align,anchorHidden:V.anchorHidden,empty:M}),[R,V.side,V.align,V.anchorHidden,M]);rt(()=>{b.set("popupSide",V.side)},[b,V.side]);const K=k.useMemo(()=>({side:V.side,align:V.align,arrowRef:V.arrowRef,arrowUncentered:V.arrowUncentered,arrowStyles:V.arrowStyles,anchorHidden:V.anchorHidden,isPositioned:V.isPositioned}),[V.side,V.align,V.arrowRef,V.arrowUncentered,V.arrowStyles,V.anchorHidden,V.isPositioned]),U=Xe(B=>{b.set("positionerElement",B)}),F=Tt("div",t,{state:q,ref:[n,U],props:[$,_],stateAttributesMapping:yo});return y.jsxs(Ste.Provider,{value:K,children:[O&&C&&y.jsx(Ox,{inert:Cm(!R),cutout:P??D}),F]})}),OEe={...yo,...zs},REe=k.forwardRef(function(t,n){const{render:r,className:i,initialFocus:a,finalFocus:s,...o}=t,l=wu(),u=aM(),f=Lx(),{filteredItems:d}=Hf(),p=qe(l,mt.mounted),m=qe(l,mt.open),S=qe(l,mt.openMethod),E=qe(l,mt.transitionStatus),g=qe(l,mt.inputInsidePopup),_=qe(l,mt.inputElement),b=d.length===0;ji({open:m,ref:l.state.popupRef,onComplete(){m&&l.state.onOpenChangeComplete(!0)}});const x=k.useMemo(()=>({open:m,side:u.side,align:u.align,anchorHidden:u.anchorHidden,transitionStatus:E,empty:b}),[m,u.side,u.align,u.anchorHidden,E,b]),T=Tt("div",t,{state:x,ref:[n,l.state.popupRef],props:[{role:g?"dialog":"presentation",tabIndex:-1,onFocus(O){const I=Tr(O.nativeEvent);S!=="touch"&&(wt(l.state.listElement,I)||I===O.currentTarget)&&l.state.inputRef.current?.focus()}},Tx(E),o],stateAttributesMapping:OEe}),C=a===void 0?g?O=>O==="touch"?l.state.popupRef.current:_:!1:a;let R;return s!=null?R=s:R=g?void 0:!1,y.jsx(mx,{context:f,disabled:!p,modal:!g,openInteractionType:S,initialFocus:C,returnFocus:R,children:T})}),wte=k.createContext(void 0);function Tte(){const e=k.useContext(wte);if(!e)throw new Error(bn(19));return e}const IEe=k.createContext(!1);function NEe(){return k.useContext(IEe)}const DEe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,index:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(!1),d=k.useRef(null),p=Am({index:s,textRef:d,indexGuessBehavior:HP.GuessFromOrder}),m=wu(),S=NEe(),{flatFilteredItems:E}=Hf(),g=qe(m,mt.open),_=qe(m,mt.selectionMode),b=qe(m,mt.readOnly),x=qe(m,mt.virtualized),T=qe(m,mt.isItemEqualToValue),w=_!=="none",C=s??(x?Lp(E,a,T):p.index),R=p.index!==-1,O=qe(m,mt.id),I=qe(m,mt.isActive,C),D=qe(m,mt.isSelected,a),P=qe(m,mt.items),H=qe(m,mt.getItemProps),M=k.useRef(null),W=O!=null&&R?`${O}-${C}`:void 0,V=D&&w;rt(()=>{if(!(R&&(x||s!=null)))return;const ee=m.state.listRef.current;return ee[C]=M.current,()=>{delete ee[C]}},[R,x,C,s,m]),rt(()=>{if(!R||P)return;const J=m.state.valuesRef.current;return J[C]=a,_!=="none"&&m.state.allValuesRef.current.push(a),()=>{delete J[C]}},[R,P,C,a,m,_]),rt(()=>{if(!g){f.current=!1;return}if(!R||P)return;const J=m.state.selectedValue,ee=Array.isArray(J)?J[J.length-1]:J;du(ee,a,T)&&m.set("selectedIndex",C)},[R,P,g,m,C,a,T]);const $=k.useMemo(()=>({disabled:o,selected:V,highlighted:I}),[o,V,I]),q=H({active:I,selected:V});q.id=void 0,q.onFocus=void 0;const{getButtonProps:K,buttonRef:U}=oa({disabled:o,focusableWhenDisabled:!0,native:l});function F(J){function ee(){m.state.handleSelection(J,a)}m.state.submitOnItemClick?(Nr.flushSync(ee),m.state.requestSubmit()):ee()}const B={id:W,role:S?"gridcell":"option","aria-disabled":o||void 0,"aria-selected":w?V:void 0,tabIndex:void 0,onPointerDownCapture(J){f.current=!0,J.preventDefault()},onClick(J){o||b||F(J.nativeEvent)},onMouseUp(J){const ee=f.current;f.current=!1,!(o||b||J.button!==0||ee||!I)&&F(J.nativeEvent)}},Y=Tt("div",t,{ref:[U,n,p.ref,M],state:$,props:[q,B,u,K]}),z=k.useMemo(()=>({selected:V,textRef:d}),[V,d]);return y.jsx(wte.Provider,{value:z,children:Y})})),LEe=k.forwardRef(function(t,n){const{render:r,className:i,children:a,...s}=t,{filteredItems:o}=Hf(),l=wu(),u=o.length===0?a:null;return Tt("div",t,{ref:[n,l.state.emptyRef],props:[{children:u,role:"status","aria-live":"polite","aria-atomic":!0},s]})});let F$=(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 Cte(e){return k.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[F$.checked]:""}:{[F$.unchecked]:""}},...$f}),[e.indeterminate])}const Ate=k.createContext(void 0);function PEe(){const e=k.useContext(Ate);if(e===void 0)throw new Error(bn(14));return e}const MEe="data-parent",jEe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a=!1,disabled:s=!1,id:o,indeterminate:l=!1,inputRef:u,name:f,onCheckedChange:d,parent:p=!1,readOnly:m=!1,render:S,required:E=!1,uncheckedValue:g,value:_,nativeButton:b=!1,...x}=t,{clearErrors:T}=Iy(),{disabled:w,name:C,setDirty:R,setFilled:O,setFocused:I,setTouched:D,state:P,validationMode:H,validityData:M,shouldValidateOnChange:W,validation:V}=$s(),$=E_e(),{labelId:q,controlId:K,setControlId:U,getDescriptionProps:F}=nd(),B=x_e(),Y=B?.parent,z=Y&&B.allValues,J=w||$.disabled||B?.disabled||s,ee=C??f,te=_??ee,Z=xi(),G=xi();let Q=K;z?Q=p?G:`${Y.id}-${te}`:o&&(Q=o);let ae={};z&&(p?ae=B.parent.getParentProps():te&&(ae=B.parent.getChildProps(te)));const se=Xe(d),{checked:ne=r,indeterminate:ye=l,onCheckedChange:Ee,...he}=ae,_e=B?.value,be=B?.setValue,Ke=B?.defaultValue,Se=k.useRef(null),{getButtonProps:$e,buttonRef:Te}=oa({disabled:J,native:b}),we=B?.validation??V,[le,me]=ns({controlled:te&&_e&&!p?_e.includes(te):ne,default:te&&Ke&&!p?Ke.includes(te):a,name:"Checkbox",state:"checked"});rt(()=>{if(U!==br)return U(Q),()=>{U(void 0)}},[Q,B,U,p]),Ny({enabled:!B,id:Z,commit:we.commit,value:le,controlRef:Se,name:ee,getValue:()=>le});const Ne=k.useRef(null),pe=Us(u,Ne,we.inputRef);rt(()=>{Ne.current&&(Ne.current.indeterminate=ye,le&&O(!0))},[le,ye,O]),qd(le,()=>{B&&!p||(T(ee),O(le),R(le!==M.initialValue),W()?we.commit(le):we.commit(le,!0))});const De=tl({checked:le,disabled:J,name:p?void 0:ee,id:Q??void 0,required:E,ref:pe,style:wm,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(ot){if(ot.nativeEvent.defaultPrevented)return;const Me=ot.target.checked,ft=st(Yr,ot.nativeEvent);if(Ee?.(Me,ft),se(Me,ft),!ft.isCanceled&&(me(Me),te&&_e&&be&&!p)){const Oe=Me?[..._e,te]:_e.filter(Fe=>Fe!==te);be(Oe,ft)}},onFocus(){Se.current?.focus()}},_!==void 0?{value:(B?le&&_:_)||""}:sr,F,B?we.getValidationProps:we.getInputValidationProps),Ce=z?!!ne:le,ze=z&&ye||l;k.useEffect(()=>{Y&&te&&Y.disabledStatesRef.current.set(te,J)},[Y,J,te]);const Ze=k.useMemo(()=>({...P,checked:Ce,disabled:J,readOnly:m,required:E,indeterminate:ze}),[P,Ce,J,m,E,ze]),gt=Cte(Ze),it=Tt("span",t,{state:Ze,ref:[Te,Se,n,B?.registerControlRef],props:[{id:Z,role:"checkbox","aria-checked":ye?"mixed":le,"aria-readonly":m||void 0,"aria-required":E||void 0,"aria-labelledby":q,[MEe]:p?"":void 0,onFocus(){I(!0)},onBlur(){const ot=Ne.current;ot&&(D(!0),I(!1),H==="onBlur"&&we.commit(B?_e:ot.checked))},onClick(ot){m||J||(ot.preventDefault(),Ne.current?.click())}},F,we.getValidationProps,x,he,$e],stateAttributesMapping:gt});return y.jsxs(Ate.Provider,{value:Ze,children:[it,!le&&!B&&ee&&!p&&g!==void 0&&y.jsx("input",{type:"hidden",name:ee,value:g}),y.jsx("input",{...De})]})}),FEe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=PEe(),l=o.checked||o.indeterminate,{transitionStatus:u,setMounted:f}=vo(l),d=k.useRef(null),p=k.useMemo(()=>({...o,transitionStatus:u}),[o,u]);ji({open:l,ref:d,onComplete(){l||f(!1)}});const m=Cte(o),S=k.useMemo(()=>({...m,...zs,...$f}),[m]),E=a||l,g=Tt("span",t,{enabled:E,ref:[n,d],state:p,stateAttributesMapping:S,props:s});return E?g:null});function BEe(e){const{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,...a}=e;return y.jsx(hEe,{...a,selectionMode:t?"multiple":"single",selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i})}const UEe=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=Tte();return r||i?y.jsx($Ee,{...t,ref:n}):null}),$Ee=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=Tte(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=vo(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=Tt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:zs});return ji({open:s,ref:o,onComplete(){s||u(!1)}}),d})),HEe=k.createContext(void 0);function Px(e=!0){const t=k.useContext(HEe);if(t===void 0&&!e)throw new Error(bn(25));return t}const kte=k.createContext(void 0);function sM(e){const t=k.useContext(kte);if(t===void 0&&!e)throw new Error(bn(33));return t}const Ote=k.createContext(void 0);function rd(e){const t=k.useContext(Ote);if(t===void 0&&!e)throw new Error(bn(36));return t}const Rte={type:"regular-item"};function Ite(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,nativeButton:s,itemMetadata:o,nodeId:l}=e,u=k.useRef(null),f=Px(!0),d=f!==void 0,{events:p}=a.useState("floatingTreeRoot"),{getButtonProps:m,buttonRef:S}=oa({disabled:n,focusableWhenDisabled:!0,native:s}),E=k.useCallback(_=>tl({id:i,role:"menuitem",tabIndex:r?0:-1,onMouseMove(b){l&&p.emit("itemhover",{nodeId:l,target:b.currentTarget})},onMouseEnter(){o.type==="submenu-trigger"&&o.setActive()},onKeyUp(b){b.key===" "&&a.context.typingRef.current&&b.preventBaseUIHandler()},onClick(b){t&&p.emit("close",{domEvent:b,reason:af})},onMouseUp(b){if(f){const x=f.initialCursorPointRef.current;if(f.initialCursorPointRef.current=null,d&&x&&Math.abs(b.clientX-x.x)<=1&&Math.abs(b.clientY-x.y)<=1)return}u.current&&a.context.allowMouseUpTriggerRef.current&&(!d||b.button===2)&&o.type==="regular-item"&&u.current.click()}},_,m),[i,r,m,t,p,a,d,f,o,l]),g=Us(u,S);return k.useMemo(()=>({getItemProps:E,itemRef:g}),[E,g])}let B$=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const Nte={checked(e){return e?{[B$.checked]:""}:{[B$.unchecked]:""}},...zs},zEe=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!0,...f}=t,d=Am({label:s}),p=sM(!0),m=xi(a),{store:S}=rd(),E=S.useState("isActive",d.index),g=S.useState("itemProps"),{getItemProps:_,itemRef:b}=Ite({closeOnClick:u,disabled:l,highlighted:E,id:m,store:S,nativeButton:o,nodeId:p?.nodeId,itemMetadata:Rte}),x=k.useMemo(()=>({disabled:l,highlighted:E}),[l,E]);return Tt("div",t,{state:x,props:[g,f,_],ref:[b,n,d.ref]})}),VEe={...yo,...zs},WEe=k.forwardRef(function(t,n){const{render:r,className:i,finalFocus:a,...s}=t,{store:o}=rd(),{side:l,align:u}=sM(),f=eM()!=null,d=o.useState("open"),p=o.useState("transitionStatus"),m=o.useState("popupProps"),S=o.useState("mounted"),E=o.useState("instantType"),g=o.useState("activeTriggerElement"),_=o.useState("parent"),b=o.useState("lastOpenChangeReason"),x=o.useState("rootId"),T=o.useState("floatingRootContext"),w=o.useState("floatingTreeRoot"),C=o.useState("closeDelay"),R=o.useState("activeTriggerElement");ji({open:d,ref:o.context.popupRef,onComplete(){d&&o.context.onOpenChangeComplete?.(!0)}}),k.useEffect(()=>{function M(W){o.setOpen(!1,st(W.reason,W.domEvent))}return w.events.on("close",M),()=>{w.events.off("close",M)}},[w.events,o]);const O=o.useState("hoverEnabled"),I=o.useState("disabled");zye(T,{enabled:O&&!I&&_.type!=="context-menu"&&_.type!=="menubar",closeDelay:C});const D=k.useMemo(()=>({transitionStatus:p,side:l,align:u,open:d,nested:_.type==="menu",instant:E}),[p,l,u,d,_.type,E]),P=Tt("div",t,{state:D,ref:[n,o.context.popupRef],stateAttributesMapping:VEe,props:[m,{onKeyDown(M){f&&UP.has(M.key)&&M.stopPropagation()}},Tx(p),s,{"data-rootownerid":x}]});let H=_.type===void 0||_.type==="context-menu";return(g||_.type==="menubar"&&b!==hx)&&(H=!0),y.jsx(mx,{context:T,modal:!1,disabled:!S,returnFocus:a===void 0?H:a,initialFocus:_.type!=="menu",restoreFocus:!0,externalTree:_.type!=="menubar"?w:void 0,previousFocusableElement:R,nextFocusableElement:_.type===void 0?o.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?o.context.beforeContentFocusGuardRef:void 0,children:P})}),Dte=k.createContext(void 0);function GEe(){const e=k.useContext(Dte);if(e===void 0)throw new Error(bn(32));return e}const qEe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:a}=rd();return a.useState("mounted")||r?y.jsx(Dte.Provider,{value:r,children:y.jsx(Sy,{ref:n,...i})}):null}),KEe=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o,align:l,sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:S=!1,disableAnchorTracking:E=!1,collisionAvoidance:g=dx,..._}=t,{store:b}=rd(),x=GEe(),T=Px(!0),w=b.useState("parent"),C=b.useState("floatingRootContext"),R=b.useState("floatingTreeRoot"),O=b.useState("mounted"),I=b.useState("open"),D=b.useState("modal"),P=b.useState("activeTriggerElement"),H=b.useState("lastOpenChangeReason"),M=b.useState("floatingNodeId"),W=b.useState("floatingParentNodeId");let V=r,$=u,q=f,K=l,U=g;w.type==="context-menu"&&(V=r??w.context?.anchor,K=K??"start",!o&&K!=="center"&&(q=t.alignOffset??2,$=t.sideOffset??-5));let F=o,B=K;w.type==="menu"?(F=F??"inline-end",B=B??"start",U=t.collisionAvoidance??eJ):w.type==="menubar"&&(F=F??"bottom",B=B??"start");const Y=w.type==="context-menu",z=wx({anchor:V,floatingRootContext:C,positionMethod:T?"fixed":i,mounted:O,side:F,sideOffset:$,align:B,alignOffset:q,arrowPadding:Y?0:m,collisionBoundary:d,collisionPadding:p,sticky:S,nodeId:M,keepMounted:x,disableAnchorTracking:E,collisionAvoidance:U,shiftCrossAxis:Y,externalTree:R}),J=k.useMemo(()=>{const ae={};return I||(ae.pointerEvents="none"),{role:"presentation",hidden:!O,style:{...z.positionerStyles,...ae}}},[I,O,z.positionerStyles]);k.useEffect(()=>{function ae(se){se.open?(se.parentNodeId===M&&b.set("hoverEnabled",!1),se.nodeId!==M&&se.parentNodeId===b.select("floatingParentNodeId")&&b.setOpen(!1,st(xb))):se.parentNodeId===M&&se.reason!==xb&&b.set("hoverEnabled",!0)}return R.events.on("menuopenchange",ae),()=>{R.events.off("menuopenchange",ae)}},[b,R.events,M]),k.useEffect(()=>{if(b.select("floatingParentNodeId")==null)return;function ae(se){if(se.open||se.nodeId!==b.select("floatingParentNodeId"))return;const ne=se.reason??xb;b.setOpen(!1,st(ne))}return R.events.on("menuopenchange",ae),()=>{R.events.off("menuopenchange",ae)}},[R.events,b]),k.useEffect(()=>{function ae(se){!I||se.nodeId!==b.select("floatingParentNodeId")||se.target&&P&&P!==se.target&&b.setOpen(!1,st(xb))}return R.events.on("itemhover",ae),()=>{R.events.off("itemhover",ae)}},[R.events,I,P,b]),k.useEffect(()=>{const ae={open:I,nodeId:M,parentNodeId:W,reason:b.select("lastOpenChangeReason")};R.events.emit("menuopenchange",ae)},[R.events,I,b,M,W]);const ee=k.useMemo(()=>({open:I,side:z.side,align:z.align,anchorHidden:z.anchorHidden,nested:w.type==="menu"}),[I,z.side,z.align,z.anchorHidden,w.type]),te=k.useMemo(()=>({side:z.side,align:z.align,arrowRef:z.arrowRef,arrowUncentered:z.arrowUncentered,arrowStyles:z.arrowStyles,nodeId:z.context.nodeId}),[z.side,z.align,z.arrowRef,z.arrowUncentered,z.arrowStyles,z.context.nodeId]),Z=Tt("div",t,{state:ee,stateAttributesMapping:yo,ref:[n,b.useStateSetter("positionerElement")],props:[J,_]}),G=O&&w.type!=="menu"&&(w.type!=="menubar"&&D&&H!==Cr||w.type==="menubar"&&w.context.modal);let Q=null;return w.type==="menubar"?Q=w.context.contentElement:w.type===void 0&&(Q=P),y.jsxs(kte.Provider,{value:te,children:[G&&y.jsx(Ox,{ref:w.type==="context-menu"||w.type==="nested-context-menu"?w.context.internalBackdropRef:null,inert:Cm(!I),cutout:Q}),y.jsx($J,{id:M,children:y.jsx(wy,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:Z})})]})}),Lte=k.createContext(void 0);function YEe(){const e=k.useContext(Lte);if(e===void 0)throw new Error(bn(34));return e}const XEe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a,defaultValue:s,onValueChange:o,disabled:l=!1,...u}=t,[f,d]=ns({controlled:a,default:s,name:"MenuRadioGroup"}),p=Xe(o),m=Xe((_,b)=>{p?.(_,b),!b.isCanceled&&d(_)}),S=k.useMemo(()=>({disabled:l}),[l]),E=Tt("div",t,{state:S,ref:n,props:{role:"group","aria-disabled":l||void 0,...u}}),g=k.useMemo(()=>({value:f,setValue:m,disabled:l}),[f,m,l]);return y.jsx(Lte.Provider,{value:g,children:E})})),Pte=k.createContext(void 0);function ZEe(){const e=k.useContext(Pte);if(e===void 0)throw new Error(bn(35));return e}const QEe=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!1,value:f,...d}=t,p=Am({label:s}),m=sM(!0),S=xi(a),{store:E}=rd(),g=E.useState("isActive",p.index),_=E.useState("itemProps"),{value:b,setValue:x,disabled:T}=YEe(),w=T||l,C=b===f,{getItemProps:R,itemRef:O}=Ite({closeOnClick:u,disabled:w,highlighted:g,id:S,store:E,nativeButton:o,nodeId:m?.nodeId,itemMetadata:Rte}),I=k.useMemo(()=>({disabled:w,highlighted:g,checked:C}),[w,g,C]),D=Xe(H=>{const M={...st(af,H.nativeEvent),preventUnmountOnClose:()=>{}};x(f,M)}),P=Tt("div",t,{state:I,stateAttributesMapping:Nte,props:[_,{role:"menuitemradio","aria-checked":C,onClick:D},d,R],ref:[O,n,p.ref]});return y.jsx(Pte.Provider,{value:I,children:P})}),JEe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=ZEe(),l=k.useRef(null),{transitionStatus:u,setMounted:f}=vo(o.checked);ji({open:o.checked,ref:l,onComplete(){o.checked||f(!1)}});const d=k.useMemo(()=>({checked:o.checked,disabled:o.disabled,highlighted:o.highlighted,transitionStatus:u}),[o.checked,o.disabled,o.highlighted,u]);return Tt("span",t,{state:d,stateAttributesMapping:Nte,ref:[n,l],props:{"aria-hidden":!0,...s},enabled:a||o.checked})}),eSe=k.createContext(null);function Mte(e){return k.useContext(eSe)}const tSe={...uee,disabled:Ue(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Ue(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Ue(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Ue(e=>e.stickIfOpen),parent:Ue(e=>e.parent),rootId:Ue(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Ue(e=>e.activeIndex),isActive:Ue((e,t)=>e.activeIndex===t),hoverEnabled:Ue(e=>e.hoverEnabled),instantType:Ue(e=>e.instantType),lastOpenChangeReason:Ue(e=>e.openChangeReason),floatingTreeRoot:Ue(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Ue(e=>e.floatingNodeId),floatingParentNodeId:Ue(e=>e.floatingParentNodeId),itemProps:Ue(e=>e.itemProps),closeDelay:Ue(e=>e.closeDelay),keyboardEventRelay:Ue(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class oM extends MP{constructor(t){super({...nSe(),...t},{positionerRef:k.createRef(),popupRef:k.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:k.createRef(),beforeContentFocusGuardRef:k.createRef(),onOpenChangeComplete:void 0,triggerElements:new bx},tSe),this.observe(Ue(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 Ei(()=>t??new oM(n)).current}unsubscribeParentListener=null}function nSe(){return{...lee(),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 NP,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:sr,keyboardEventRelay:void 0,closeDelay:0}}const rSe=k.createContext(void 0);function iSe(){return k.useContext(rSe)}function aSe(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:s=!1,modal:o,loopFocus:l=!0,orientation:u="vertical",actionsRef:f,closeParentOnEsc:d=!1,handle:p,triggerId:m,defaultTriggerId:S=null,highlightItemOnHover:E=!0}=e,g=Px(!0),_=rd(!0),b=Mte(),x=iSe(),T=k.useMemo(()=>x&&_?{type:"menu",store:_.store}:b?{type:"menubar",context:b}:g&&!_?{type:"context-menu",context:g}:{type:void 0},[g,_,b,x]),w=oM.useStore(p?.store,{parent:T}),C=w.useState("floatingTreeRoot"),R=DP(C),O=go();rt(()=>{g&&!_?w.update({parent:{type:"context-menu",context:g},floatingNodeId:R,floatingParentNodeId:O}):_&&w.update({floatingNodeId:R,floatingParentNodeId:O})},[g,_,R,O,w]),w.useControlledProp("open",n,a),w.useControlledProp("activeTriggerId",m,S),w.useContextCallback("onOpenChangeComplete",i);const I=w.useState("open"),D=w.useState("activeTriggerElement"),P=w.useState("positionerElement"),H=w.useState("hoverEnabled"),M=w.useState("modal"),W=w.useState("disabled"),V=w.useState("lastOpenChangeReason"),$=w.useState("parent"),q=w.useState("activeIndex"),K=w.useState("payload"),U=w.useState("floatingParentNodeId"),F=k.useRef(null),B=U!=null;let Y;w.useSyncedValues({disabled:s,modal:$.type===void 0?o:void 0,rootId:ed()});const{openMethod:z,triggerProps:J,reset:ee}=Ix(I);see(w);const{forceUnmount:te}=oee(I,w,()=>{w.update({allowMouseEnter:!1,stickIfOpen:!0}),ee()}),Z=k.useRef($.type!=="context-menu"),G=Bn();k.useEffect(()=>{if(I||(F.current=null),$.type==="context-menu"){if(!I){G.clear(),Z.current=!1;return}G.start(500,()=>{Z.current=!0})}},[G,I,$.type]),Rx(I&&M&&V!==Cr&&z!=="touch",P),rt(()=>{!I&&!H&&w.set("hoverEnabled",!0)},[I,H,w]);const Q=k.useRef(!0),ae=Bn(),se=Xe((Me,ft)=>{const Oe=ft.reason;if(I===Me&&ft.trigger===D||(ft.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},!Me&&ft.trigger==null&&(ft.trigger=D??void 0),r?.(Me,ft),ft.isCanceled))return;const Fe={open:Me,nativeEvent:ft.event,reason:ft.reason,nested:B};Y?.emit("openchange",Fe);const Je=ft.event;if(Me===!1&&Je?.type==="click"&&Je.pointerType==="touch"&&!Q.current)return;if(!Me&&q!==null){const Dt=w.context.itemDomElements.current[q];queueMicrotask(()=>{Dt?.setAttribute("tabindex","-1")})}Me&&Oe===_E?(Q.current=!1,ae.start(300,()=>{Q.current=!0})):(Q.current=!0,ae.clear());const lt=(Oe===Ic||Oe===af)&&Je.detail===0&&Je?.isTrusted,ht=!Me&&(Oe===px||Oe==null);function vn(){const Dt={open:Me,openChangeReason:Oe};F.current=ft.event??null;const Ot=ft.trigger?.id??null;(Ot||Me)&&(Dt.activeTriggerId=Ot,Dt.activeTriggerElement=ft.trigger??null),w.update(Dt)}Oe===Cr?Nr.flushSync(vn):vn(),$.type==="menubar"&&(Oe===_E||Oe===ho||Oe===Cr||Oe===pp||Oe===xb)?w.set("instantType","group"):lt||ht?w.set("instantType",lt?"click":"dismiss"):w.set("instantType",void 0)}),ne=k.useCallback(Me=>{const ft=st(Me);return ft.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},ft},[w]),ye=k.useCallback(()=>{w.setOpen(!1,ne(VJ))},[w,ne]);k.useImperativeHandle(f,()=>({unmount:te,close:ye}),[te,ye]);let Ee;$.type==="context-menu"&&(Ee=$.context),k.useImperativeHandle(Ee?.positionerRef,()=>P,[P]),k.useImperativeHandle(Ee?.actionsRef,()=>({setOpen:se}),[se]);const he=cee({popupStore:w,onOpenChange:se});Y=he.context.events,k.useEffect(()=>{const Me=({open:ft,eventDetails:Oe})=>se(ft,Oe);return Y.on("setOpen",Me),()=>{Y?.off("setOpen",Me)}},[Y,se]);const _e=xy(he,{enabled:!W,bubbles:d&&$.type==="menu",outsidePress(){return $.type!=="context-menu"||F.current?.type==="contextmenu"?!0:Z.current},externalTree:B?C:void 0}),be=fee(he,{role:"menu"}),Ke=td(),Se=k.useCallback(Me=>{w.select("activeIndex")!==Me&&w.set("activeIndex",Me)},[w]),$e=FP(he,{enabled:!W,listRef:w.context.itemDomElements,activeIndex:q,nested:$.type!==void 0,loopFocus:l,orientation:u,parentOrientation:$.type==="menubar"?$.context.orientation:void 0,rtl:Ke==="rtl",disabledIndices:Zi,onNavigate:Se,openOnArrowKeyDown:$.type!=="context-menu",externalTree:B?C:void 0,focusItemOnHover:E}),Te=k.useCallback(Me=>{w.context.typingRef.current=Me},[w]),we=BP(he,{listRef:w.context.itemLabels,activeIndex:q,resetMs:Nge,onMatch:Me=>{I&&Me!==q&&w.set("activeIndex",Me)},onTypingChange:Te}),{getReferenceProps:le,getFloatingProps:me,getItemProps:Ne,getTriggerProps:pe}=Ff([_e,be,$e,we]),De=k.useMemo(()=>{const Me=tl(le(),{onMouseEnter(){w.set("hoverEnabled",!0)},onMouseMove(){w.set("allowMouseEnter",!0)}},J);return delete Me.role,Me},[le,w,J]),Ce=k.useMemo(()=>{const Me=pe();if(!Me)return Me;const ft=tl(Me,J);return delete ft.role,delete ft["aria-controls"],ft},[pe,J]),ze=Nc(),Ze=k.useMemo(()=>me({onMouseEnter(){$.type==="menu"&&ze.request(()=>w.set("hoverEnabled",!1))},onMouseMove(){w.set("allowMouseEnter",!0)},onClick(){w.select("hoverEnabled")&&w.set("hoverEnabled",!1)},onKeyDown(Me){const ft=w.select("keyboardEventRelay");ft&&!Me.isPropagationStopped()&&ft(Me)}}),[me,$.type,ze,w]),gt=k.useMemo(()=>Ne(),[Ne]);w.useSyncedValues({floatingRootContext:he,activeTriggerProps:De,inactiveTriggerProps:Ce,popupProps:Ze,itemProps:gt});const it=k.useMemo(()=>({store:w,parent:T}),[w,T]),ot=y.jsx(Ote.Provider,{value:it,children:typeof t=="function"?t({payload:K}):t});return $.type===void 0||$.type==="context-menu"?y.jsx(HJ,{externalTree:C,children:ot}):ot}function jte(e){if(Qn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!Wo(e))return jte(el(e))}function sSe(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,i=k.useRef(!1);return k.useMemo(()=>t?{onMouseDown:a=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,Si(a.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:a=>{i.current&&(i.current=!1,a.preventBaseUIHandler())}}:sr,[t,n,r])}const n_=2,oSe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,id:o,openOnHover:l,delay:u=100,closeDelay:f=0,handle:d,payload:p,...m}=t,S=rd(!0),E=d?.store??S?.store;if(!E)throw new Error(bn(85));const g=xi(o),_=E.useState("isTriggerActive",g),b=E.useState("floatingRootContext"),x=E.useState("isOpenedByTrigger",g),T=k.useRef(null),w=uSe(),C=_P(!0),R=bo(),O=k.useMemo(()=>R??new NP,[R]),I=DP(O),D=go(),{registerTrigger:P,isMountedByThisTrigger:H}=aee(g,T,E,{payload:p,closeDelay:f,parent:w,floatingTreeRoot:O,floatingNodeId:I,floatingParentNodeId:D,keyboardEventRelay:C?.relayKeyboardEvent}),M=E.useState("disabled"),W=a||M||w.type==="menubar"&&w.context.disabled,{getButtonProps:V,buttonRef:$}=oa({disabled:W,native:s});k.useEffect(()=>{!x&&w.type===void 0&&(E.context.allowMouseUpTriggerRef.current=!1)},[E,x,w.type]);const q=k.useRef(null),K=Bn(),U=Xe(be=>{if(!q.current)return;K.clear(),E.context.allowMouseUpTriggerRef.current=!1;const Ke=be.target;if(wt(q.current,Ke)||wt(E.select("positionerElement"),Ke)||Ke===q.current||Ke!=null&&jte(Ke)===E.select("rootId"))return;const Se=QP(q.current);be.clientX>=Se.left-n_&&be.clientX<=Se.right+n_&&be.clientY>=Se.top-n_&&be.clientY<=Se.bottom+n_||O.events.emit("close",{domEvent:be,reason:zJ})});k.useEffect(()=>{x&&E.select("lastOpenChangeReason")===Cr&&Si(q.current).addEventListener("mouseup",U,{once:!0})},[x,U,E]);const F=w.type==="menubar"&&w.context.hasSubmenuOpen,Y=Gye(b,{enabled:(l??F??!1)&&!W&&w.type!=="context-menu"&&(w.type!=="menubar"||F&&!H),handleClose:hee({blockPointerEvents:w.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:w.type===void 0?u:void 0,delay:{close:f},triggerElementRef:T,externalTree:O,isActiveTrigger:_}),z=lSe(x,E.select("lastOpenChangeReason")),J=Tm(b,{enabled:!W&&w.type!=="context-menu",event:x&&w.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0?z:!1}),ee=Bye(b,{enabled:!W&&(w.type!=="menubar"&&x||F)}),te=sSe({open:x,enabled:w.type==="menubar",mouseDownAction:"open"}),Z=Ff([J,ee]),G=w.type==="menubar",Q=k.useMemo(()=>({disabled:W,open:x}),[W,x]),ae=E.useState("triggerProps",H),se=[q,n,$,P,T],ne=[Z.getReferenceProps(),Y??sr,ae,{"aria-haspopup":"menu",id:g,onMouseDown:be=>{if(E.select("open"))return;K.start(200,()=>{E.context.allowMouseUpTriggerRef.current=!0}),Si(be.currentTarget).addEventListener("mouseup",U,{once:!0})}},G?{role:"menuitem"}:{},te,m,V],ye=k.useRef(null),Ee=Xe(be=>{Nr.flushSync(()=>{E.setOpen(!1,st(ho,be.nativeEvent,be.currentTarget))}),cve(ye.current)?.focus()}),he=Xe(be=>{const Ke=E.select("positionerElement");if(Ke&&oo(be,Ke))E.context.beforeContentFocusGuardRef.current?.focus();else{Nr.flushSync(()=>{E.setOpen(!1,st(ho,be.nativeEvent,be.currentTarget))});let Se=uve(T.current);for(;Se!==null&&wt(Ke,Se)||Se?.hasAttribute("aria-hidden");){const $e=Se;if(Se=Ey(Se),Se===$e)break}Se?.focus()}}),_e=Tt("button",t,{enabled:!G,stateAttributesMapping:Np,state:Q,ref:se,props:ne});return G?y.jsx(xx,{tag:"button",render:r,className:i,state:Q,refs:se,props:ne,stateAttributesMapping:Np}):x?y.jsxs(k.Fragment,{children:[y.jsx(nl,{ref:ye,onFocus:Ee},`${g}-pre-focus-guard`),y.jsx(k.Fragment,{children:_e},g),y.jsx(nl,{ref:E.context.triggerFocusTargetRef,onFocus:he},`${g}-post-focus-guard`)]}):y.jsx(k.Fragment,{children:_e},g)});function lSe(e,t){const n=Bn(),[r,i]=k.useState(!1);return rt(()=>{e&&t==="trigger-hover"?(i(!0),n.start(QQ,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function uSe(){const e=Px(!0),t=rd(!0),n=Mte();return k.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}function zl(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Fte=k.createContext(void 0);function Mx(){const e=k.useContext(Fte);if(e===void 0)throw new Error(bn(53));return e}let AE=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const r_=500,U$=16;function Ds(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 cSe=(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})({}),Hh=(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 lM={hasOverflowX:e=>e?{[Hh.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[Hh.hasOverflowY]:""}:null,overflowXStart:e=>e?{[Hh.overflowXStart]:""}:null,overflowXEnd:e=>e?{[Hh.overflowXEnd]:""}:null,overflowYStart:e=>e?{[Hh.overflowYStart]:""}:null,overflowYEnd:e=>e?{[Hh.overflowYEnd]:""}:null,cornerHidden:()=>null},$$={width:0,height:0},dSe={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},fSe=k.forwardRef(function(t,n){const{render:r,className:i,overflowEdgeThreshold:a,...s}=t,[o,l]=k.useState(!1),[u,f]=k.useState(!1),[d,p]=k.useState(!1),[m,S]=k.useState($$),[E,g]=k.useState($$),[_,b]=k.useState(!1),[x,T]=k.useState(dSe),w=xi(),C=k.useRef(null),R=k.useRef(null),O=k.useRef(null),I=k.useRef(null),D=k.useRef(null),P=k.useRef(null),H=k.useRef(null),M=k.useRef(!1),W=k.useRef(0),V=k.useRef(0),$=k.useRef(0),q=k.useRef(0),K=k.useRef("vertical"),U=Bn(),F=Bn(),B=k.useRef({x:0,y:0}),[Y,z]=k.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),J=hSe(a),ee=Xe(Ee=>{const he=Ee.x-B.current.x,_e=Ee.y-B.current.y;B.current=Ee,_e!==0&&(p(!0),U.start(r_,()=>{p(!1)})),he!==0&&(f(!0),F.start(r_,()=>{f(!1)}))}),te=Xe(Ee=>{Ee.button===0&&(M.current=!0,W.current=Ee.clientY,V.current=Ee.clientX,K.current=Ee.currentTarget.getAttribute(cSe.orientation),R.current&&($.current=R.current.scrollTop,q.current=R.current.scrollLeft),D.current&&K.current==="vertical"&&D.current.setPointerCapture(Ee.pointerId),P.current&&K.current==="horizontal"&&P.current.setPointerCapture(Ee.pointerId))}),Z=Xe(Ee=>{if(!M.current)return;const he=Ee.clientY-W.current,_e=Ee.clientX-V.current;if(R.current){const be=R.current.scrollHeight,Ke=R.current.clientHeight,Se=R.current.scrollWidth,$e=R.current.clientWidth;if(D.current&&O.current&&K.current==="vertical"){const Te=Ds(O.current,"padding","y"),we=Ds(D.current,"margin","y"),le=D.current.offsetHeight,me=O.current.offsetHeight-le-Te-we,Ne=he/me;R.current.scrollTop=$.current+Ne*(be-Ke),Ee.preventDefault(),p(!0),U.start(r_,()=>{p(!1)})}if(P.current&&I.current&&K.current==="horizontal"){const Te=Ds(I.current,"padding","x"),we=Ds(P.current,"margin","x"),le=P.current.offsetWidth,me=I.current.offsetWidth-le-Te-we,Ne=_e/me;R.current.scrollLeft=q.current+Ne*(Se-$e),Ee.preventDefault(),f(!0),F.start(r_,()=>{f(!1)})}}}),G=Xe(Ee=>{M.current=!1,D.current&&K.current==="vertical"&&D.current.releasePointerCapture(Ee.pointerId),P.current&&K.current==="horizontal"&&P.current.releasePointerCapture(Ee.pointerId)});function Q(Ee){const he=Ee.pointerType==="touch";if(b(he),!he){const _e=wt(C.current,Ee.target);l(_e)}}const ae=k.useMemo(()=>({hasOverflowX:!Y.scrollbarXHidden,hasOverflowY:!Y.scrollbarYHidden,overflowXStart:x.xStart,overflowXEnd:x.xEnd,overflowYStart:x.yStart,overflowYEnd:x.yEnd,cornerHidden:Y.cornerHidden}),[Y.scrollbarXHidden,Y.scrollbarYHidden,Y.cornerHidden,x]),se={role:"presentation",onPointerEnter:Q,onPointerMove:Q,onPointerDown({pointerType:Ee}){b(Ee==="touch")},onPointerLeave(){l(!1)},style:{position:"relative",[AE.scrollAreaCornerHeight]:`${m.height}px`,[AE.scrollAreaCornerWidth]:`${m.width}px`}},ne=Tt("div",t,{state:ae,ref:[n,C],props:[se,s],stateAttributesMapping:lM}),ye=k.useMemo(()=>({handlePointerDown:te,handlePointerMove:Z,handlePointerUp:G,handleScroll:ee,cornerSize:m,setCornerSize:S,thumbSize:E,setThumbSize:g,touchModality:_,cornerRef:H,scrollingX:u,setScrollingX:f,scrollingY:d,setScrollingY:p,hovering:o,setHovering:l,viewportRef:R,rootRef:C,scrollbarYRef:O,scrollbarXRef:I,thumbYRef:D,thumbXRef:P,rootId:w,hiddenState:Y,setHiddenState:z,overflowEdges:x,setOverflowEdges:T,viewportState:ae,overflowEdgeThreshold:J}),[te,Z,G,ee,m,E,_,H,u,f,d,p,o,l,R,C,O,I,D,P,w,Y,x,ae,J]);return y.jsxs(Fte.Provider,{value:ye,children:[fv.element,ne]})});function hSe(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 pSe=k.createContext(void 0);function mSe(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 vc=(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})({}),H$=!1;function gSe(){H$||wP||(typeof CSS<"u"&&"registerProperty"in CSS&&[vc.scrollAreaOverflowXStart,vc.scrollAreaOverflowXEnd,vc.scrollAreaOverflowYStart,vc.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),H$=!0)}const bSe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{viewportRef:s,scrollbarYRef:o,scrollbarXRef:l,thumbYRef:u,thumbXRef:f,cornerRef:d,setCornerSize:p,setThumbSize:m,rootId:S,setHiddenState:E,hiddenState:g,handleScroll:_,setHovering:b,setOverflowEdges:x,overflowEdges:T,overflowEdgeThreshold:w}=Mx(),C=td(),R=k.useRef(!0),O=Bn(),I=Bn();function D(){const q=s.current,K=o.current,U=l.current,F=u.current,B=f.current,Y=d.current;if(!q)return;const z=q.scrollHeight,J=q.scrollWidth,ee=q.clientHeight,te=q.clientWidth,Z=q.scrollTop,G=q.scrollLeft;if(z===0||J===0)return;const Q=ee>=z,ae=te>=J,se=te/J,ne=ee/z,ye=Math.max(0,J-te),Ee=Math.max(0,z-ee);let he=0,_e=0;ae||(C==="rtl"?he=zl(-G,0,ye):he=zl(G,0,ye),_e=ye-he);const be=Q?0:zl(Z,0,Ee),Ke=Q?0:Ee-be,Se=ae?0:te,$e=Q?0:ee,Te=Ds(U,"padding","x"),we=Ds(K,"padding","y"),le=Ds(B,"margin","x"),me=Ds(F,"margin","y"),Ne=Se-Te-le,pe=$e-we-me,De=U?Math.min(U.offsetWidth,Ne):Ne,Ce=K?Math.min(K.offsetHeight,pe):pe,ze=Math.max(U$,De*se),Ze=Math.max(U$,Ce*ne);if(m(Fe=>Fe.height===Ze&&Fe.width===ze?Fe:{width:ze,height:Ze}),K&&F){const Fe=K.offsetHeight-Ze-we-me,Je=z-ee,lt=Je===0?0:Z/Je,ht=Math.min(Fe,Math.max(0,lt*Fe));F.style.transform=`translate3d(0,${ht}px,0)`}if(U&&B){const Fe=U.offsetWidth-ze-Te-le,Je=J-te,lt=Je===0?0:G/Je,ht=C==="rtl"?zl(lt*Fe,-Fe,0):zl(lt*Fe,0,Fe);B.style.transform=`translate3d(${ht}px,0,0)`}const gt=zl(he,0,ye),it=zl(_e,0,ye),ot=zl(be,0,Ee),Me=zl(Ke,0,Ee),ft=[[vc.scrollAreaOverflowXStart,gt],[vc.scrollAreaOverflowXEnd,it],[vc.scrollAreaOverflowYStart,ot],[vc.scrollAreaOverflowYEnd,Me]];for(const[Fe,Je]of ft)q.style.setProperty(Fe,`${Je}px`);if(Y){if(ae||Q)p({width:0,height:0});else if(!ae&&!Q){const Fe=K?.offsetWidth||0,Je=U?.offsetHeight||0;p({width:Fe,height:Je})}}E(Fe=>{const Je=Q||ae;return Fe.scrollbarYHidden===Q&&Fe.scrollbarXHidden===ae&&Fe.cornerHidden===Je?Fe:{scrollbarYHidden:Q,scrollbarXHidden:ae,cornerHidden:Je}});const Oe={xStart:!ae&>>w.xStart,xEnd:!ae&&it>w.xEnd,yStart:!Q&&ot>w.yStart,yEnd:!Q&&Me>w.yEnd};x(Fe=>Fe.xStart===Oe.xStart&&Fe.xEnd===Oe.xEnd&&Fe.yStart===Oe.yStart&&Fe.yEnd===Oe.yEnd?Fe:Oe)}const P=Xe(()=>{Nr.flushSync(D)});rt(()=>s.current?(gSe(),mSe(s.current,P)):void 0,[P,s]),rt(()=>{queueMicrotask(P)},[P,g,C]),rt(()=>{s.current?.matches(":hover")&&b(!0)},[s,b]),k.useEffect(()=>{const q=s.current;if(typeof ResizeObserver>"u"||!q)return;const K=new ResizeObserver(P);return K.observe(q),I.start(0,()=>{Promise.all(q.getAnimations({subtree:!0}).map(U=>U.finished)).then(P).catch(()=>{})}),()=>{K.disconnect(),I.clear()}},[P,s,I]);function H(){R.current=!1}const M={role:"presentation",...S&&{"data-id":`${S}-viewport`},...(!g.scrollbarXHidden||!g.scrollbarYHidden)&&{tabIndex:0},className:fv.className,style:{overflow:"scroll"},onScroll(){s.current&&(P(),R.current||_({x:s.current.scrollLeft,y:s.current.scrollTop}),O.start(100,()=>{R.current=!0}))},onWheel:H,onTouchMove:H,onPointerMove:H,onPointerEnter:H,onKeyDown:H},W=k.useMemo(()=>({hasOverflowX:!g.scrollbarXHidden,hasOverflowY:!g.scrollbarYHidden,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:g.cornerHidden}),[g.scrollbarXHidden,g.scrollbarYHidden,g.cornerHidden,T]),V=Tt("div",t,{ref:[n,s],state:W,props:[M,a],stateAttributesMapping:lM}),$=k.useMemo(()=>({computeThumbPosition:P}),[P]);return y.jsx(pSe.Provider,{value:$,children:V})}),Bte=k.createContext(void 0);function vSe(){const e=k.useContext(Bte);if(e===void 0)throw new Error(bn(54));return e}let kE=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const ySe=k.forwardRef(function(t,n){const{render:r,className:i,orientation:a="vertical",keepMounted:s=!1,...o}=t,{hovering:l,scrollingX:u,scrollingY:f,hiddenState:d,overflowEdges:p,scrollbarYRef:m,scrollbarXRef:S,viewportRef:E,thumbYRef:g,thumbXRef:_,handlePointerDown:b,handlePointerUp:x,rootId:T,thumbSize:w}=Mx(),C=k.useMemo(()=>({hovering:l,scrolling:{horizontal:u,vertical:f}[a],orientation:a,hasOverflowX:!d.scrollbarXHidden,hasOverflowY:!d.scrollbarYHidden,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:d.cornerHidden}),[l,u,f,a,d,p]),R=td();k.useEffect(()=>{const M=E.current,W=a==="vertical"?m.current:S.current;if(!W)return;function V($){if(!(!M||!W||$.ctrlKey)){if($.preventDefault(),a==="vertical"){if(M.scrollTop===0&&$.deltaY<0)return}else if(M.scrollLeft===0&&$.deltaX<0)return;if(a==="vertical"){if(M.scrollTop===M.scrollHeight-M.clientHeight&&$.deltaY>0)return}else if(M.scrollLeft===M.scrollWidth-M.clientWidth&&$.deltaX>0)return;a==="vertical"?M.scrollTop+=$.deltaY:M.scrollLeft+=$.deltaX}}return W.addEventListener("wheel",V,{passive:!1}),()=>{W.removeEventListener("wheel",V)}},[a,S,m,E]);const O={...T&&{"data-id":`${T}-scrollbar`},onPointerDown(M){if(M.button===0&&M.currentTarget===M.target&&E.current){if(g.current&&m.current&&a==="vertical"){const W=Ds(g.current,"margin","y"),V=Ds(m.current,"padding","y"),$=g.current.offsetHeight,q=m.current.getBoundingClientRect(),K=M.clientY-q.top-$/2-V+W/2,U=E.current.scrollHeight,F=E.current.clientHeight,B=m.current.offsetHeight-$-V-W,z=K/B*(U-F);E.current.scrollTop=z}if(_.current&&S.current&&a==="horizontal"){const W=Ds(_.current,"margin","x"),V=Ds(S.current,"padding","x"),$=_.current.offsetWidth,q=S.current.getBoundingClientRect(),K=M.clientX-q.left-$/2-V+W/2,U=E.current.scrollWidth,F=E.current.clientWidth,B=S.current.offsetWidth-$-V-W,Y=K/B;let z;R==="rtl"?(z=(1-Y)*(U-F),E.current.scrollLeft<=0&&(z=-z)):z=Y*(U-F),E.current.scrollLeft=z}b(M)}},onPointerUp:x,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...a==="vertical"&&{top:0,bottom:`var(${AE.scrollAreaCornerHeight})`,insetInlineEnd:0,[kE.scrollAreaThumbHeight]:`${w.height}px`},...a==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${AE.scrollAreaCornerWidth})`,bottom:0,[kE.scrollAreaThumbWidth]:`${w.width}px`}}},I=Tt("div",t,{ref:[n,a==="vertical"?m:S],state:C,props:[O,o],stateAttributesMapping:lM}),D=k.useMemo(()=>({orientation:a}),[a]),P=a==="vertical"?d.scrollbarYHidden:d.scrollbarXHidden;return s||!P?y.jsx(Bte.Provider,{value:D,children:I}):null}),_Se=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{thumbYRef:s,thumbXRef:o,handlePointerDown:l,handlePointerMove:u,handlePointerUp:f,setScrollingX:d,setScrollingY:p}=Mx(),{orientation:m}=vSe(),S=k.useMemo(()=>({orientation:m}),[m]);return Tt("div",t,{ref:[n,m==="vertical"?s:o],state:S,props:[{onPointerDown:l,onPointerMove:u,onPointerUp(g){m==="vertical"&&p(!1),m==="horizontal"&&d(!1),f(g)},style:{...m==="vertical"&&{height:`var(${kE.scrollAreaThumbHeight})`},...m==="horizontal"&&{width:`var(${kE.scrollAreaThumbWidth})`}}},a]})}),ESe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{cornerRef:s,cornerSize:o,hiddenState:l}=Mx(),u=Tt("div",t,{ref:[n,s],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},a]});return l.cornerHidden?null:u}),Ute=k.createContext(void 0);function SSe(){const e=k.useContext(Ute);if(e===void 0)throw new Error(bn(63));return e}let z$=(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 $te={...$f,checked(e){return e?{[z$.checked]:""}:{[z$.unchecked]:""}}},xSe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a,id:s,inputRef:o,name:l,nativeButton:u=!1,onCheckedChange:f,readOnly:d=!1,required:p=!1,disabled:m=!1,render:S,uncheckedValue:E,...g}=t,{clearErrors:_}=Iy(),{state:b,setTouched:x,setDirty:T,validityData:w,setFilled:C,setFocused:R,shouldValidateOnChange:O,validationMode:I,disabled:D,name:P,validation:H}=$s(),{labelId:M}=nd(),W=D||m,V=P??l,$=Xe(f),q=k.useRef(null),K=Us(q,o,H.inputRef),U=k.useRef(null),F=xi(),B=Nx({id:s,implicit:!1,controlRef:U}),[Y,z]=ns({controlled:r,default:!!a,name:"Switch",state:"checked"});Ny({id:F,commit:H.commit,value:Y,controlRef:U,name:V,getValue:()=>Y}),rt(()=>{q.current&&C(q.current.checked)},[q,C]),qd(Y,()=>{_(V),T(Y!==w.initialValue),C(Y),O()?H.commit(Y):H.commit(Y,!0)});const{getButtonProps:J,buttonRef:ee}=oa({disabled:W,native:u}),te={id:F,role:"switch","aria-checked":Y,"aria-readonly":d||void 0,"aria-labelledby":M,onFocus(){W||R(!0)},onBlur(){const ae=q.current;!ae||W||(x(!0),R(!1),I==="onBlur"&&H.commit(ae.checked))},onClick(ae){d||W||(ae.preventDefault(),q?.current?.click())}},Z=k.useMemo(()=>tl({checked:Y,disabled:W,id:B,name:V,required:p,style:wm,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:K,onChange(ae){if(ae.nativeEvent.defaultPrevented)return;const se=ae.target.checked,ne=st(Yr,ae.nativeEvent);$?.(se,ne),!ne.isCanceled&&z(se)},onFocus(){U.current?.focus()}},H.getInputValidationProps),[Y,W,K,B,V,$,p,z,H]),G=k.useMemo(()=>({...b,checked:Y,disabled:W,readOnly:d,required:p}),[b,Y,W,d,p]),Q=Tt("span",t,{state:G,ref:[n,U,ee],props:[te,H.getValidationProps,g,J],stateAttributesMapping:$te});return y.jsxs(Ute.Provider,{value:G,children:[Q,!Y&&V&&E!==void 0&&y.jsx("input",{type:"hidden",name:V,value:E}),y.jsx("input",{...Z})]})}),wSe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{state:s}=$s(),o=SSe(),l={...s,...o};return Tt("span",t,{state:l,ref:n,stateAttributesMapping:$te,props:a})}),Hte=k.createContext(void 0);function TSe(e=!0){const t=k.useContext(Hte);if(t===void 0&&!e)throw new Error(bn(7));return t}const CSe=k.forwardRef(function(t,n){const{className:r,defaultPressed:i=!1,disabled:a=!1,form:s,onPressedChange:o,pressed:l,render:u,type:f,value:d,nativeButton:p=!0,...m}=t,S=xi(d||void 0),E=TSe(),g=E?.value??[],_=E?void 0:i,b=(a||E?.disabled)??!1,[x,T]=ns({controlled:E?g?.indexOf(S)>-1:l,default:_,name:"Toggle",state:"pressed"}),w=Xe((H,M)=>{S&&E?.setGroupValue?.(S,H,M),o?.(H,M)}),{getButtonProps:C,buttonRef:R}=oa({disabled:b,native:p}),O=k.useMemo(()=>({disabled:b,pressed:x}),[b,x]),I=[R,n],D=[{"aria-pressed":x,onClick(H){const M=!x,W=st(Yr,H.nativeEvent);w(M,W),!W.isCanceled&&T(M)}},m,C],P=Tt("button",t,{enabled:!E,state:O,ref:I,props:D});return E?y.jsx(xx,{tag:"button",render:u,className:r,state:O,refs:I,props:D}):P});let ASe=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const V$={multiple(e){return e?{[ASe.multiple]:""}:null}},kSe=k.forwardRef(function(t,n){const{defaultValue:r,disabled:i=!1,loopFocus:a=!0,onValueChange:s,orientation:o="horizontal",multiple:l=!1,value:u,className:f,render:d,...p}=t,m=eM(),S=k.useMemo(()=>{if(u===void 0)return r??[]},[u,r]),E=(m?.disabled??!1)||i,[g,_]=ns({controlled:u,default:S,name:"ToggleGroup",state:"value"}),b=Xe((R,O,I)=>{let D;if(l?(D=g.slice(),O?D.push(R):D.splice(g.indexOf(R),1)):D=O?[R]:[],Array.isArray(D)){if(s?.(D,I),I.isCanceled)return;_(D)}}),x=k.useMemo(()=>({disabled:E,multiple:l,orientation:o}),[E,o,l]),T=k.useMemo(()=>({disabled:E,orientation:o,setGroupValue:b,value:g}),[E,o,b,g]),w={role:"group"},C=Tt("div",t,{enabled:!!m,state:x,ref:n,props:[w,p],stateAttributesMapping:V$});return y.jsx(Hte.Provider,{value:T,children:m?C:y.jsx(Sx,{render:d,className:f,state:x,refs:[n],props:[w,p],stateAttributesMapping:V$,loopFocus:a})})});function OSe(e){return Tt(e.defaultTagName??"div",e,e)}function RSe({className:e,...t}){return y.jsx("div",{"data-slot":"input-group",role:"group",className:We("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=input-group-control]:focus-visible]:ring-inset 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 has-[[data-slot][aria-invalid=true]]:ring-inset 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 ISe=Qc("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 NSe({className:e,align:t="inline-start",...n}){return y.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:We(ISe({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const DSe=Qc("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 zte({className:e,type:t="button",variant:n="ghost",size:r="xs",...i}){return y.jsx(Ye,{type:t,"data-size":r,variant:n,className:We(DSe({size:r}),e),...i})}function LSe({className:e,...t}){return y.jsx(sn,{"data-slot":"input-group-control",className:We("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 PSe=BEe;function MSe({className:e,children:t,...n}){return y.jsxs(mEe,{"data-slot":"combobox-trigger",className:We("[&_svg:not([class*='size-'])]:size-3.5",e),...n,children:[t,y.jsx(ve,{icon:Ay,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})]})}function jSe({className:e,...t}){return y.jsx(EEe,{"data-slot":"combobox-clear",render:y.jsx(zte,{variant:"ghost",size:"icon-xs"}),className:We(e),...t,children:y.jsx(ve,{icon:aa,strokeWidth:2,className:"pointer-events-none"})})}function FSe({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return y.jsxs(RSe,{className:We("w-auto",e),children:[y.jsx(yEe,{render:y.jsx(LSe,{disabled:n}),...a}),y.jsxs(NSe,{align:"inline-end",children:[r&&y.jsx(zte,{size:"icon-xs",variant:"ghost",render:y.jsx(MSe,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:n}),i&&y.jsx(jSe,{disabled:n})]}),t]})}function BSe({className:e,side:t="bottom",sideOffset:n=6,align:r="start",alignOffset:i=0,anchor:a,...s}){return y.jsx(AEe,{children:y.jsx(kEe,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:"isolate z-50",children:y.jsx(REe,{"data-slot":"combobox-content","data-chips":!!a,className:We("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),...s})})})}function USe({className:e,...t}){return y.jsx(TEe,{"data-slot":"combobox-list",className:We("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 $Se({className:e,children:t,...n}){return y.jsxs(DEe,{"data-slot":"combobox-item",className:We("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,y.jsx(UEe,{render:y.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:y.jsx(ve,{icon:_u,strokeWidth:2,className:"pointer-events-none"})})]})}function HSe({className:e,...t}){return y.jsx(LEe,{"data-slot":"combobox-empty",className:We("text-muted-foreground hidden w-full justify-center py-2 text-center text-xs/relaxed group-data-empty/combobox-content:flex",e),...t})}const zSe=Qc("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"}}),Vte=k.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function VSe({className:e,variant:t,size:n,spacing:r=0,orientation:i="horizontal",children:a,...s}){return y.jsx(kSe,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:We("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),...s,children:y.jsx(Vte.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function W$({className:e,children:t,variant:n="default",size:r="default",...i}){const a=k.useContext(Vte);return y.jsx(CSe,{"data-slot":"toggle-group-item","data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:We("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",zSe({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}async function Zt(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 wf="";function uM(){return or({queryKey:["tasks"],queryFn:()=>Zt(`${wf}/api/tasks`)})}function Wte(e){return or({queryKey:["tasks",e],queryFn:()=>Zt(`${wf}/api/tasks/${e}`),enabled:!!e})}function WSe(){const e=zr();return pr({mutationFn:t=>Zt(`${wf}/api/tasks`,{method:"POST",body:JSON.stringify({...t,status:"IN_PROGRESS"})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function GSe(){const e=zr();return pr({mutationFn:({taskId:t,status:n,position:r})=>Zt(`${wf}/api/tasks/${t}/status`,{method:"PATCH",body:JSON.stringify({status:n,position:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function cM(){const e=zr();return pr({mutationFn:({taskId:t,updates:n})=>Zt(`${wf}/api/tasks/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{taskId:n})=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["tasks",n]})}})}function Gte(){const e=zr();return pr({mutationFn:({taskId:t,deleteLinkedWorktree:n})=>{const r=n?`${wf}/api/tasks/${t}?deleteLinkedWorktree=true`:`${wf}/api/tasks/${t}`;return Zt(r,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}const Dy="";function qSe(e){return or({queryKey:["fs","list",e],queryFn:()=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return Zt(`${Dy}/api/fs/list${t}`)},enabled:e!==null})}function KSe(e){return or({queryKey:["git","branches",e],queryFn:()=>Zt(`${Dy}/api/git/branches?repo=${encodeURIComponent(e)}`),enabled:!!e})}function YSe(e,t={}){const{staged:n=!1,ignoreWhitespace:r=!1,includeUntracked:i=!1}=t;return or({queryKey:["git","diff",e,n,r,i],queryFn:()=>{const a=new URLSearchParams({path:e,...n&&{staged:"true"},...r&&{ignoreWhitespace:"true"},...i&&{includeUntracked:"true"}});return Zt(`${Dy}/api/git/diff?${a}`)},enabled:!!e,refetchInterval:5e3})}function XSe(e){return or({queryKey:["git","status",e],queryFn:()=>Zt(`${Dy}/api/git/status?path=${encodeURIComponent(e)}`),enabled:!!e,refetchInterval:5e3})}async function ZSe(e){return Zt(`${Dy}/api/fs/is-git-repo?path=${encodeURIComponent(e)}`)}const fl="",nn={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"},QSe=7777;function la(e){return or({queryKey:["config",e],queryFn:()=>Zt(`${fl}/api/config/${e}`)})}function qte(){const e=la(nn.PORT);return{...e,data:e.data?.value??QSe,isDefault:e.data?.isDefault??!0}}function JSe(){const e=la(nn.WORKTREE_BASE_PATH);return{...e,data:e.data?.value??""}}function jx(){const e=la(nn.DEFAULT_GIT_REPOS_DIR);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Fx(){const e=la(nn.EDITOR_APP);return{...e,data:e.data?.value??"vscode",isDefault:e.data?.isDefault??!0}}function Bx(){const e=la(nn.EDITOR_HOST);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Ux(){const e=la(nn.EDITOR_SSH_PORT);return{...e,data:e.data?.value??22,isDefault:e.data?.isDefault??!0}}function exe(){const e=la(nn.LINEAR_API_KEY);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function txe(){const e=la(nn.GITHUB_PAT);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function nxe(){const e=la(nn.LANGUAGE);return{...e,data:e.data?.value??null,isDefault:e.data?.isDefault??!0}}function rxe(){const e=la(nn.THEME);return{...e,data:e.data?.value??"system",isDefault:e.data?.isDefault??!0}}function ixe(){const e=la(nn.SYNC_CLAUDE_CODE_THEME);return{...e,data:!!e.data?.value,isDefault:e.data?.isDefault??!0}}const G$=["light","light-ansi","light-daltonized","dark","dark-ansi","dark-daltonized"];function axe(){const e=la(nn.CLAUDE_CODE_LIGHT_THEME);return{...e,data:e.data?.value??"light-ansi",isDefault:e.data?.isDefault??!0}}function sxe(){const e=la(nn.CLAUDE_CODE_DARK_THEME);return{...e,data:e.data?.value??"dark-ansi",isDefault:e.data?.isDefault??!0}}function oxe(){const e=la(nn.BASIC_AUTH_USERNAME);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function lxe(){const e=la(nn.BASIC_AUTH_PASSWORD);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function dM(){const e=zr();return pr({mutationFn:({key:t,value:n})=>Zt(`${fl}/api/config/${t}`,{method:"PUT",body:JSON.stringify({value:n})}),onSuccess:(t,{key:n})=>{e.invalidateQueries({queryKey:["config",n]}),n===nn.GITHUB_PAT&&(e.invalidateQueries({queryKey:["github-user"]}),e.invalidateQueries({queryKey:["github-prs"]}),e.invalidateQueries({queryKey:["github-issues"]}),e.invalidateQueries({queryKey:["github-orgs"]}))}})}function uxe(){const e=zr();return pr({mutationFn:t=>Zt(`${fl}/api/config/${t}`,{method:"DELETE"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["config",n]})}})}function cxe(){return or({queryKey:["config","notifications"],queryFn:()=>Zt(`${fl}/api/config/notifications`)})}function dxe(){const e=zr();return pr({mutationFn:t=>Zt(`${fl}/api/config/notifications`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","notifications"]})}})}function fxe(){return pr({mutationFn:e=>Zt(`${fl}/api/config/notifications/test/${e}`,{method:"POST"})})}function hxe(){return or({queryKey:["config","z-ai"],queryFn:()=>Zt(`${fl}/api/config/z-ai`)})}function pxe(){const e=zr();return pr({mutationFn:t=>Zt(`${fl}/api/config/z-ai`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","z-ai"]}),e.invalidateQueries({queryKey:["monitoring","claude-usage"]})}})}function Kte(){return or({queryKey:["config","developer-mode"],queryFn:()=>Zt(`${fl}/api/config/developer-mode`),staleTime:1/0})}function mxe(){return pr({mutationFn:()=>Zt(`${fl}/api/config/restart`,{method:"POST"})})}const Ly="";function Py(){return or({queryKey:["repositories"],queryFn:()=>Zt(`${Ly}/api/repositories`)})}function gxe(e){return or({queryKey:["repositories",e],queryFn:()=>Zt(`${Ly}/api/repositories/${e}`),enabled:!!e})}function Yte(){const e=zr();return pr({mutationFn:t=>Zt(`${Ly}/api/repositories`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function bxe(){const e=zr();return pr({mutationFn:({id:t,updates:n})=>Zt(`${Ly}/api/repositories/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{id:n})=>{e.invalidateQueries({queryKey:["repositories"]}),e.invalidateQueries({queryKey:["repositories",n]})}})}function Xte(){const e=zr();return pr({mutationFn:t=>Zt(`${Ly}/api/repositories/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function My({className:e,children:t,...n}){return y.jsxs(fSe,{"data-slot":"scroll-area",className:We("relative",e),...n,children:[y.jsx(bSe,{"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}),y.jsx(vxe,{}),y.jsx(ESe,{})]})}function vxe({className:e,orientation:t="vertical",...n}){return y.jsx(ySe,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:We("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:y.jsx(_Se,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function jy({open:e,onOpenChange:t,onSelect:n,initialPath:r}){const[i,a]=k.useState(r||null),[s,o]=k.useState(""),[l,u]=k.useState("");k.useEffect(()=>{e&&(a(r||null),o(""),u(""))},[e,r]);const{data:f,isLoading:d,error:p}=qSe(e?i??"":null),m=x=>{f&&(a(f.path+"/"+x),u(""))},S=()=>{f?.parent&&f.parent!==f.path&&(a(f.parent),u(""))},E=()=>{a(null),u("")},g=()=>{s.trim()&&(a(s.trim()),u(""))},_=x=>{n(x),t(!1)},b=f?.entries.filter(x=>x.name.toLowerCase().includes(l.toLowerCase()));return y.jsx(ul,{open:e,onOpenChange:t,children:y.jsxs(cl,{className:"sm:max-w-lg overflow-hidden",children:[y.jsxs(Su,{children:[y.jsx(xu,{children:"Select Git Repository"}),y.jsx(Ry,{children:"Choose an existing git repository"})]}),y.jsx("p",{className:"text-xs text-muted-foreground",children:"Click folder names to navigate • Use action buttons to select"}),y.jsx(A_e,{}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{className:"text-xs font-medium",children:"Enter path manually:"}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx(sn,{value:s,onChange:x=>o(x.target.value),placeholder:"/path/to/your/project",onKeyDown:x=>x.key==="Enter"&&g(),className:"flex-1"}),y.jsx(Ye,{variant:"outline",size:"sm",onClick:g,children:"Go"})]})]}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("label",{className:"text-xs font-medium",children:"Search current directory:"}),y.jsxs("div",{className:"relative",children:[y.jsx(ve,{icon:Mee,size:14,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),y.jsx(sn,{value:l,onChange:x=>u(x.target.value),placeholder:"Filter folders and files...",className:"pl-8"})]})]}),y.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[y.jsx(Ye,{variant:"outline",size:"icon-sm",onClick:E,title:"Home",className:"shrink-0",children:y.jsx(ve,{icon:t1e,size:14,strokeWidth:2})}),y.jsx(Ye,{variant:"outline",size:"icon-sm",onClick:S,disabled:!f||f.parent===f.path,title:"Parent directory",className:"shrink-0",children:y.jsx(ve,{icon:WP,size:14,strokeWidth:2})}),y.jsx("code",{className:"min-w-0 flex-1 text-xs bg-muted/50 px-2 py-1 rounded truncate overflow-hidden",children:f?.path||"~"}),y.jsxs(Ye,{variant:"outline",size:"sm",onClick:()=>f&&_(f.path),disabled:!f,className:"shrink-0 max-sm:px-2",title:"Select current directory",children:[y.jsx(ve,{icon:MN,size:14,strokeWidth:2,className:"sm:hidden"}),y.jsx("span",{className:"max-sm:hidden",children:"Select Current"})]})]}),y.jsx(My,{className:"h-64 border rounded-md",children:y.jsxs("div",{className:"p-1",children:[d&&y.jsx("div",{className:"text-muted-foreground text-xs p-3",children:"Loading..."}),p&&y.jsx("div",{className:"text-destructive text-xs p-3",children:p.message}),f&&b&&y.jsxs(y.Fragment,{children:[b.length===0&&y.jsx("div",{className:"text-muted-foreground text-xs p-3",children:l?"No matches found":"Empty directory"}),b.map(x=>y.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted group",children:x.type==="directory"?y.jsxs(y.Fragment,{children:[y.jsx(ve,{icon:x.isGitRepo?MN:Pi,size:16,strokeWidth:2,className:(x.isGitRepo,"text-accent")}),y.jsx("button",{onClick:()=>m(x.name),className:"flex-1 text-left text-xs truncate hover:underline",children:x.name}),x.isGitRepo&&y.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-accent/50 text-accent font-medium shrink-0",children:[y.jsx("span",{className:"max-sm:hidden",children:"git repo"}),y.jsx("span",{className:"sm:hidden",children:"git"})]})]}):y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"w-4"}),y.jsx("span",{className:"flex-1 text-xs text-muted-foreground truncate",children:x.name})]})},x.name))]})]})}),y.jsxs(Uf,{children:[y.jsx(Oy,{render:y.jsx(Ye,{variant:"outline"}),children:"Cancel"}),y.jsx(Ye,{onClick:()=>f&&_(f.path),disabled:!f,children:"Select Path"})]})]})})}function yxe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function _xe(e){const t=yxe(e);if(!t)return"";const n=Math.random().toString(36).substring(2,6);return`${t}-${n}`}function fM({open:e,onOpenChange:t,defaultRepository:n,showTrigger:r=!0}={}){const{t:i}=an("tasks"),{t:a}=an("common"),[s,o]=k.useState(!1),l=e??s,u=t??o,[f,d]=k.useState(!1),[p,m]=k.useState(""),[S,E]=k.useState(""),[g,_]=k.useState(""),[b,x]=k.useState(""),[T,w]=k.useState(""),[C,R]=k.useState(""),[O,I]=k.useState("default"),[D,P]=k.useState(!1),[H,M]=k.useState(null),[W,V]=k.useState("browse"),[$,q]=k.useState(""),[K,U]=k.useState(null),[F,B]=k.useState(!1),Y=ss(),z=WSe(),J=Yte(),ee=k.useRef(null),{data:te}=JSe(),{data:Z}=jx(),{data:G}=Py(),{data:Q,isLoading:ae}=KSe(g||null),se=H?G?.find(Se=>Se.id===H):null,ne=k.useMemo(()=>{if(!G)return[];if(se&&$===se.displayName||!$.trim())return G;const Se=$.toLowerCase();return G.filter($e=>$e.displayName.toLowerCase().includes(Se)||$e.path.toLowerCase().includes(Se))},[G,$,se]);k.useEffect(()=>{G&&G.length>0?V("saved"):V("browse")},[G]),k.useEffect(()=>{if(l){if(n)M(n.id),_(n.path),q(n.displayName),V("saved");else if(G&&G.length>0){const Se=G[0];M(Se.id),_(Se.path),q(Se.displayName),V("saved")}}},[l,n,G]),k.useEffect(()=>{x(Q?Q.current||Q.branches[0]||"main":"")},[Q,g]);const ye=Se=>{m(Se),R(_xe(Se))},Ee=async Se=>{U(null),B(!0);try{if(!(await ZSe(Se)).isGitRepo){U(i("createModal.errors.notGitRepo")),B(!1);return}if(_(Se),M(null),!G?.find(we=>we.path===Se)){const we=Se.split("/").pop()||"Unknown";J.mutate({path:Se,displayName:we})}}catch($e){U($e instanceof Error?$e.message:i("createModal.errors.validationFailed"))}finally{B(!1)}},he=Se=>{if(Se.preventDefault(),!p.trim()||!g)return;const $e=g.split("/").pop()||"repo",Te=T.trim()||C,we=`${te}/${Te}`;z.mutate({title:p.trim(),description:S.trim(),aiMode:O,repoPath:g,repoName:$e,baseBranch:b||"main",branch:Te,worktreePath:we,copyFiles:se?.copyFiles||void 0,startupScript:se?.startupScript||void 0},{onSuccess:le=>{const me=S.trim()?{aiMode:O,description:S.trim()}:{aiMode:O};u(!1),m(""),E(""),_(""),x(""),w(""),R(""),I("default"),P(!1),M(null),q(""),U(null),V(G&&G.length>0?"saved":"browse"),Y({to:"/tasks/$taskId",params:{taskId:le.id},state:me})},onError:le=>{dn.error(i("createModal.errors.createFailed"),{description:le instanceof Error?le.message:String(le)})}})},_e=!z.isPending&&!!p.trim()&&!!g;Ts("meta+enter",()=>{ee.current&&ee.current.requestSubmit()},{enabled:l&&_e,allowInInput:!0,ignoreContext:!0,deps:[l,_e]});const be=T.trim()||C,Ke=be?`${te}/${be}`:"";return y.jsxs(y.Fragment,{children:[y.jsxs(ul,{open:l,onOpenChange:u,children:[r&&y.jsxs(ZP,{render:y.jsx(Ye,{size:"sm"}),children:[y.jsx(ve,{icon:qP,size:16,strokeWidth:2,"data-slot":"icon",className:"-translate-y-px"}),i("newTask")]}),y.jsx(cl,{className:"sm:max-w-md max-h-[80dvh] flex flex-col overflow-hidden",children:y.jsxs("form",{ref:ee,onSubmit:he,className:"flex flex-col min-h-0 flex-1",children:[y.jsxs(Su,{className:"shrink-0",children:[y.jsx(xu,{children:i("createModal.title")}),y.jsx(Ry,{children:i("createModal.description")})]}),y.jsxs(nu,{className:"mt-4 pb-4 overflow-y-auto min-h-0 flex-1",children:[y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"title",children:i("createModal.fields.title")}),y.jsx(sn,{id:"title",value:p,onChange:Se=>ye(Se.target.value),placeholder:i("createModal.fields.titlePlaceholder"),required:!0})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"description",children:i("createModal.fields.description")}),y.jsx(ete,{id:"description",value:S,onValueChange:Se=>{E(Se),D||I(Se.trim()?"plan":"default")},placeholder:i("createModal.fields.descriptionPlaceholder"),rows:2})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{children:i("createModal.fields.aiMode")}),y.jsxs(VSe,{value:[O],onValueChange:Se=>{const $e=Array.isArray(Se)?Se[0]:Se;$e&&(I($e),P(!0))},className:"w-full",variant:"outline",children:[y.jsx(W$,{value:"plan",className:"flex-1",children:i("createModal.aiModes.plan")}),y.jsx(W$,{value:"default",className:"flex-1",children:i("createModal.aiModes.default")})]})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{children:i("createModal.fields.repository")}),y.jsxs(Dc,{value:W,onValueChange:Se=>{V(Se),U(null)},children:[y.jsxs(Lc,{children:[y.jsx(Ii,{value:"saved",disabled:!G?.length,children:i("createModal.tabs.saved")}),y.jsx(Ii,{value:"browse",children:i("createModal.tabs.browse")})]}),y.jsx(_a,{value:"saved",className:"mt-2",children:y.jsxs(PSe,{value:H||"",onValueChange:Se=>{const $e=G?.find(Te=>Te.id===Se);$e&&(M(Se),_($e.path),q($e.displayName),U(null))},inputValue:$,onInputValueChange:Se=>{q(Se),se&&Se!==se.displayName&&M(null)},itemToStringLabel:Se=>G?.find($e=>$e.id===Se)?.displayName||"",children:[y.jsx(FSe,{placeholder:i("createModal.searchRepositories"),className:"w-full"}),y.jsx(BSe,{children:y.jsxs(USe,{children:[y.jsx(HSe,{children:i("createModal.noRepositoriesFound")}),ne.map(Se=>y.jsx($Se,{value:Se.id,children:Se.displayName},Se.id))]})})]})}),y.jsx(_a,{value:"browse",className:"mt-2",children:y.jsxs(Ye,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>d(!0),disabled:F,children:[y.jsx(ve,{icon:Pi,size:14,strokeWidth:2,className:"mr-2"}),F?y.jsx("span",{className:"text-muted-foreground",children:a("status.validating")}):g&&!H?y.jsx("span",{className:"truncate",children:g}):y.jsx("span",{className:"text-muted-foreground group-hover/button:text-accent-foreground",children:i("createModal.selectFolder")})]})})]}),K&&y.jsx("p",{className:"text-sm text-destructive",children:K}),g&&!K&&y.jsx(Yi,{className:"font-mono text-xs truncate",children:g})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"baseBranch",children:i("createModal.fields.baseBranch")}),y.jsxs(Qi,{value:b,onValueChange:Se=>x(Se??""),disabled:!g||ae,children:[y.jsx(ea,{className:"w-full",children:y.jsx(Ji,{children:b||y.jsx("span",{className:"text-muted-foreground",children:i(g?ae?"createModal.loadingBranches":"createModal.selectBranch":"createModal.selectRepositoryFirst")})})}),y.jsx(ta,{children:Q?.branches.map(Se=>y.jsxs(Nn,{value:Se,children:[Se,Se===Q.current&&y.jsx("span",{className:"text-muted-foreground ml-2",children:i("createModal.current")})]},Se))})]})]}),y.jsxs(Dn,{children:[y.jsx(Ln,{htmlFor:"branch",children:i("createModal.fields.branchName")}),y.jsx(sn,{id:"branch",value:T,onChange:Se=>w(Se.target.value),placeholder:C||i("createModal.fields.branchPlaceholder")}),Ke&&y.jsxs(Yi,{children:[i("createModal.worktreePrefix")," ",Ke]}),!T.trim()&&C&&y.jsx(Yi,{children:i("createModal.branchAutoGenerated",{branch:C})})]})]}),y.jsxs(Uf,{className:"mt-4 shrink-0",children:[y.jsx(Oy,{render:y.jsx(Ye,{variant:"outline",type:"button",className:"border-destructive text-destructive hover:bg-destructive hover:text-white"}),children:a("buttons.cancel")}),y.jsx(Ye,{type:"submit",disabled:z.isPending||!p.trim()||!g,children:z.isPending?a("status.creating"):i("createModal.createTask")})]})]})})]}),y.jsx(jy,{open:f,onOpenChange:d,onSelect:Ee,initialPath:Z||void 0})]})}const q$=[{to:"/tasks",icon:Dp,labelKey:"header.tasks",matchPrefix:!0},{to:"/terminals",icon:Cx,labelKey:"header.terminals",matchPrefix:!1},{to:"/repositories",icon:FN,labelKey:"header.repositories",matchPrefix:!0},{to:"/review",icon:TE,labelKey:"header.review",matchPrefix:!0},{to:"/monitoring",icon:G0e,labelKey:"header.monitoring",matchPrefix:!0}];function Exe({onNewTaskRef:e,onOpenCommandPalette:t}){const{t:n}=an("navigation"),{location:r}=ei(),i=r.pathname,[a,s]=k.useState(!1),o=(l,u)=>u?i.startsWith(l):i===l;return k.useEffect(()=>{e?.(()=>s(!0))},[e]),y.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:[y.jsxs("div",{className:"flex min-w-0 items-center gap-4 max-sm:gap-2",children:[y.jsx(h1e,{className:"lg:hidden",children:y.jsx(p1e,{children:y.jsxs(m1e,{children:[y.jsxs(b1e,{className:"bg-transparent hover:bg-muted/50 data-open:bg-muted/50 gap-1 px-2",children:[y.jsx(ve,{icon:o1e,size:16,strokeWidth:2}),y.jsx("span",{className:"sr-only",children:"Menu"})]}),y.jsx(v1e,{className:"min-w-48",children:q$.map(l=>y.jsxs(_1e,{href:l.to,active:o(l.to,l.matchPrefix),render:y.jsx(Li,{to:l.to}),children:[y.jsx(ve,{icon:l.icon,size:16,strokeWidth:2}),n(l.labelKey)]},l.to))})]})})}),y.jsx("nav",{className:"hidden items-center gap-1 lg:flex",children:q$.map(l=>{const u=o(l.to,l.matchPrefix);return y.jsxs(Li,{to:l.to,className:We("relative flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium transition-colors",u?"bg-background text-foreground":"text-foreground/60 hover:text-foreground","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-foreground after:transition-opacity",u?"after:opacity-100":"after:opacity-0"),children:[y.jsx(ve,{icon:l.icon,size:16,strokeWidth:2,"data-slot":"icon"}),n(l.labelKey)]},l.to)})})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.jsx(fM,{open:a,onOpenChange:s}),y.jsx(Ye,{variant:"ghost",size:"icon-sm",onClick:t,title:n("header.commandPalette",{shortcut:"⌘K"}),children:y.jsx(ve,{icon:PN,size:16,strokeWidth:2})}),y.jsx(Li,{to:"/settings",className:We("relative flex items-center justify-center rounded-md p-1.5 transition-colors",i==="/settings"?"bg-background text-foreground":"text-foreground/60 hover:text-foreground","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-foreground after:transition-opacity",i==="/settings"?"after:opacity-100":"after:opacity-0"),children:y.jsx(ve,{icon:jee,size:16,strokeWidth:2})})]})]})}function Sxe(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}const xxe=10,wxe=2e3;function Txe(){const e=zr(),{resolvedTheme:t}=Pf(),n=k.useRef(null),r=k.useRef(void 0),i=k.useRef(0),a=k.useRef(void 0),s=k.useCallback(l=>{try{const u=JSON.parse(l.data);if(u.type==="task:updated")e.invalidateQueries({queryKey:["tasks"]});else if(u.type==="notification"&&"payload"in u){const{id:f,title:d,message:p,notificationType:m,playSound:S,isCustomSound:E}=u.payload,_=S&&!E?"/goat.jpeg":t==="dark"?"/logo-dark.jpg":"/logo-light.jpg",b=y.jsx("img",{src:_,alt:"",className:"size-8 shrink-0 aspect-square rounded-sm object-cover"});switch(m){case"success":dn.success(d,{description:p,icon:b});break;case"error":dn.error(d,{description:p,icon:b});break;case"warning":dn.warning(d,{description:p,icon:b});break;default:dn.info(d,{description:p,icon:b});break}if("Notification"in window&&window.parent===window&&Notification.permission==="granted"&&new Notification(d,{body:p,icon:_,tag:f}),S){const w="vibora:lastSoundPlayed",C=Date.now(),R=localStorage.getItem(w);if(R){const I=parseInt(R.split(":")[0]);if(C-I<1e3)return}const O=`${C}:${Math.random().toString(36).slice(2)}`;localStorage.setItem(w,O),setTimeout(()=>{if(localStorage.getItem(w)!==O)return;let I=!1;const D=()=>{if(I)return;I=!0,new Audio("/sounds/goat-bleat.mp3").play().catch(()=>{})},P=new Audio("/api/uploads/sound");P.onerror=D,P.play().catch(D)},50)}window.parent!==window&&window.parent.postMessage({type:"vibora:notification",title:d,message:p,notificationType:m},"*")}}catch{}},[e,t]),o=k.useCallback(()=>{const l=n.current;if(l&&(l.readyState===WebSocket.CONNECTING||l.readyState===WebSocket.OPEN))return;const u=Sxe(),f=new WebSocket(u);n.current=f,f.onopen=()=>{i.current=0},f.onmessage=s,f.onclose=()=>{n.current===f&&(n.current=null),i.current<xxe&&(i.current++,r.current=setTimeout(()=>{a.current?.()},wxe))},f.onerror=()=>{}},[s]);a.current=o,k.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]),k.useEffect(()=>(o(),()=>{r.current&&clearTimeout(r.current);const l=n.current;l&&(l.readyState===WebSocket.OPEN&&l.close(),n.current=null)}),[o])}const Cxe={save:"Save Changes",cancel:"Cancel",delete:"Delete",create:"Create",reset:"Reset to default",browse:"Browse",clearFilters:"Clear filters"},Axe={loading:"Loading...",saving:"Saving...",saved:"Saved",error:"Error",calculating:"calculating...",validating:"Validating...",creating:"Creating...",deleting:"Deleting...",loggingIn:"Logging in..."},kxe={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"},Oxe={one:"{{count}} result",other:"{{count}} results"},Rxe={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled",ORPHANED:"Orphaned"},Ixe={loginTitle:"Login to Vibora",username:"Username",password:"Password",login:"Login",loginFailed:"Login failed"},Nxe={buttons:Cxe,status:Axe,time:kxe,results:Oxe,statuses:Rxe,auth:Ixe},Dxe={tasks:"Tasks",terminals:"Terminals",worktrees:"Worktrees",repositories:"Repositories",review:"Review",monitoring:"Monitoring",settings:"Settings",commandPalette:"Command Palette ({{shortcut}})"},Lxe={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"}},Pxe={title:"Keyboard Shortcuts",groups:{navigation:"Navigation",actions:"Actions",terminals:"Terminals (Desktop)",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",newTerminal:"New Terminal",closeTerminal:"Close Terminal",submitForm:"Submit Form"}},Mxe={header:Dxe,commandPalette:Lxe,shortcuts:Pxe},jxe="Tasks",Fxe="Search",Bxe="All Repos",Uxe="New Task",$xe={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",createFailed:"Failed to create task"}},Hxe={title:jxe,searchPlaceholder:Fxe,allRepos:Bxe,newTask:Uxe,createModal:$xe},zxe="Settings",Vxe={server:"Server",serverDefaults:"Server & Defaults",paths:"Paths",authentication:"Authentication",editor:"Editor",integrations:"Integrations",zai:"z.ai",notifications:"Notifications",appearance:"Appearance",developer:"Developer"},Wxe={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)"}}},Gxe={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"},qxe={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 for details."},Kxe={title:"Unsaved Changes",description:"You have unsaved changes that will be lost if you leave this page.",stay:"Stay",leave:"Leave"},Yxe={title:zxe,sections:Vxe,fields:Wxe,notifications:Gxe,developer:qxe,unsavedChanges:Kxe},Xxe="Review",Zxe={pullRequests:"Pull Requests",issues:"Issues"},Qxe={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"},Jxe={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"},ewe={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"},twe={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"}},nwe={title:Xxe,tabs:Zxe,filters:Qxe,github:Jxe,prs:ewe,issues:twe},rwe="Worktrees",iwe={total:"{{count}} total",orphaned:"{{count}} orphaned"},awe={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."},swe={noMatch:"No worktrees match the selected filters.",noWorktrees:"No worktrees found. Worktrees are created when you create tasks."},owe={failedToLoad:"Failed to load worktrees: {{message}}"},lwe={title:rwe,summary:iwe,cleanup:awe,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:swe,error:owe},uwe="Monitoring",cwe={claude:"Claude Instances",system:"System Metrics",processes:"Processes",vibora:"Vibora Servers",worktrees:"Worktrees",usage:"Usage Limits"},dwe={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}}"},fwe={cpuUsage:"CPU Usage",memoryUsage:"Memory Usage",memoryLabels:{used:"Used",cache:"Cache / Buffers"},diskUsage:"Disk Usage ({{path}})",error:"Failed to load system metrics: {{message}}"},hwe={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"},pwe={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}}"},mwe={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}}"},gwe={title:uwe,tabs:cwe,claude:dwe,system:fwe,processes:hwe,vibora:pwe,usage:mwe},bwe="Tasks",vwe="New Terminal",ywe="All Repos",_we={title:"Edit Tab",name:"Name",namePlaceholder:"Tab name",directory:"Directory",directoryPlaceholder:"Select a directory...",clearDirectory:"Clear directory",cancel:"Cancel",save:"Save"},Ewe={title:"New Tab",create:"Create"},Swe={taskTerminals:bwe,newTerminal:vwe,allRepos:ywe,editTab:_we,newTab:Ewe},xwe="Repositories",wwe="{{count}} total",Twe="New Task",Cwe="Tasks",Awe="Terminal",kwe="Editor",Owe="Settings",Rwe="Add Repository",Iwe="Open in Terminal",Nwe="Open in {{editor}}",Dwe={openInVSCode:"Open in VS Code"},Lwe={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.",isCopierTemplate:"Use as Copier Template",isCopierTemplateDescription:"Mark as a template for creating new projects."},adding:"Adding...",cancel:"Cancel"},Pwe={button:"New Project",title:"Create New Project",back:"Back",next:"Next",create:"Create Project",steps:{template:{description:"Select a template to create your project from.",savedTemplates:"Saved Templates",selectTemplate:"Select a template...",or:"or",customUrl:"Custom Template URL/Path",customUrlHelp:"Git URL or local path to a Copier template."},questions:{description:"Configure your project.",noQuestions:"This template has no configuration questions."},output:{description:"Choose where to create your project.",projectName:"Project Name",outputDirectory:"Output Directory",selectDirectory:"Select directory...",willCreate:"Will create"},creating:{description:"Creating your project...",inProgress:"Running Copier..."}}},Mwe={noRepositories:"No repositories added yet. Add a repository for quick access when creating tasks."},jwe={failedToLoad:"Failed to load repositories: {{message}}"},Fwe={title:xwe,total:wwe,newTask:Twe,viewTasks:Cwe,terminal:Awe,editor:kwe,settings:Owe,addRepository:Rwe,openInTerminal:Iwe,openInEditor:Nwe,card:Dwe,delete:{title:"Delete Repository",description:'This will remove "{{name}}" from Vibora. The actual repository files will not be affected.',button:"Delete",deleting:"Deleting..."},addModal:Lwe,newProject:Pwe,empty:Mwe,error:jwe},Bwe={save:"保存更改",cancel:"取消",delete:"删除",create:"创建",reset:"重置为默认值",browse:"浏览",clearFilters:"清除筛选"},Uwe={loading:"加载中...",saving:"保存中...",saved:"已保存",error:"错误",calculating:"计算中...",validating:"验证中...",creating:"创建中...",deleting:"删除中...",loggingIn:"登录中..."},$we={justNow:"刚刚",minuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",hourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",dayAgo:"1 天前",daysAgo:"{{count}} 天前"},Hwe={one:"{{count}} 个结果",other:"{{count}} 个结果"},zwe={IN_PROGRESS:"进行中",IN_REVIEW:"审核中",DONE:"已完成",CANCELED:"已取消",ORPHANED:"孤立"},Vwe={loginTitle:"登录 Vibora",username:"用户名",password:"密码",login:"登录",loginFailed:"登录失败"},Wwe={buttons:Bwe,status:Uwe,time:$we,results:Hwe,statuses:zwe,auth:Vwe},Gwe={tasks:"任务",terminals:"终端",worktrees:"工作树",repositories:"仓库",review:"审核",monitoring:"监控",settings:"设置",commandPalette:"命令面板 ({{shortcut}})"},qwe={placeholder:"输入命令或搜索...",noResults:"未找到命令",categories:{navigation:"导航",actions:"操作"},commands:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",newTask:"新建任务",keyboardShortcuts:"键盘快捷键"}},Kwe={title:"键盘快捷键",groups:{navigation:"导航",actions:"操作",general:"通用"},labels:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",commandPalette:"命令面板",newTask:"新建任务",keyboardShortcuts:"键盘快捷键",closeModal:"关闭弹窗"}},Ywe={header:Gwe,commandPalette:qwe,shortcuts:Kwe},Xwe="任务",Zwe="搜索",Qwe="全部仓库",Jwe="新建任务",eTe={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:"验证仓库失败",createFailed:"创建任务失败"}},tTe={title:Xwe,searchPlaceholder:Zwe,allRepos:Qwe,newTask:Jwe,createModal:eTe},nTe="设置",rTe={server:"服务器",serverDefaults:"服务器与默认设置",paths:"路径",authentication:"身份验证",editor:"编辑器",integrations:"集成",zai:"z.ai",notifications:"通知",appearance:"外观",developer:"开发者"},iTe={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":"深色(色盲友好)"}}},aTe={enable:"启用通知",sound:"声音",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"应用令牌",userKey:"用户密钥",testSuccess:"{{channel}} 测试成功",testFailed:"{{channel}} 测试失败:{{error}}",uploadSound:"上传自定义声音",deleteSound:"删除自定义声音",testSound:"测试声音",soundUploaded:"自定义声音已上传",soundUploadFailed:"上传声音失败:{{error}}",soundDeleted:"自定义声音已删除",soundDeleteFailed:"删除自定义声音失败",customSoundActive:"使用自定义声音"},sTe={restartButton:"重启 Vibora",restarting:"重启中...",restartDescription:"重新构建并重启 Vibora 服务器。如果构建失败,服务器将继续运行。",restartFailed:"重启失败",checkLogs:"构建可能失败。运行 journalctl --user -u vibora 查看详情。"},oTe={title:"未保存的更改",description:"您有未保存的更改,离开此页面将丢失这些更改。",stay:"留下",leave:"离开"},lTe={title:nTe,sections:rTe,fields:iTe,notifications:aTe,developer:sTe,unsavedChanges:oTe},uTe="审核",cTe={pullRequests:"拉取请求",issues:"问题"},dTe={pr:{created:"我创建的",assigned:"分配给我的",reviewRequested:"待我审核",mentioned:"提及我的"},issue:{assigned:"分配给我的",created:"我创建的",mentioned:"提及我的"},allOrgs:"所有组织",allOrganizations:"所有组织",viboraReposOnly:"仅 Vibora 仓库"},fTe={tokenRequired:"需要 GitHub 令牌",tokenDescription:"要查看您的问题和拉取请求,请在设置中添加 GitHub 个人访问令牌。",requiredScopes:"所需权限:",scopes:{repo:"(用于私有仓库)",readUser:"(用于用户信息)",readOrg:"(用于组织列表)"},generateToken:"生成令牌",goToSettings:"前往设置"},hTe={loading:"加载中...",failedToLoad:"加载拉取请求失败",empty:{all:"没有打开的拉取请求",created:"没有您创建的拉取请求",assigned:"没有分配给您的拉取请求",reviewRequested:"没有等待您审核的拉取请求",mentioned:"没有提及您的拉取请求"},draft:"草稿"},pTe={loading:"加载中...",failedToLoad:"加载问题失败",empty:{assigned:"没有分配给您的问题",created:"没有您创建的问题",mentioned:"没有提及您的问题"}},mTe={title:uTe,tabs:cTe,filters:dTe,github:fTe,prs:hTe,issues:pTe},gTe="工作树",bTe={total:"共 {{count}} 个",orphaned:"{{count}} 个孤立"},vTe={button:"清理 ({{count}})",title:"删除已完成的工作树",description:"这将永久删除 {{count}} 个工作树。",linkedTasksWillBeDeleted:"关联的任务也将被删除。",alsoDeleteLinkedTasks:"同时删除关联的任务",done:"已完成",canceled:"已取消",cannotUndo:"此操作无法撤销。"},yTe={noMatch:"没有匹配所选筛选条件的工作树。",noWorktrees:"未找到工作树。工作树在创建任务时自动生成。"},_Te={failedToLoad:"加载工作树失败:{{message}}"},ETe={title:gTe,summary:bTe,cleanup:vTe,delete:{title:"删除工作树",description:"这将永久删除位于以下位置的工作树目录",linkedTaskWillBeDeleted:'关联的任务 "{{title}}" 也将被删除。',alsoDeleteLinkedTask:'同时删除关联的任务 "{{title}}"',cannotUndo:"此操作无法撤销。",button:"删除 {{count}} 个"},empty:yTe,error:_Te},STe="监控",xTe={claude:"Claude 实例",system:"系统指标",processes:"进程",vibora:"Vibora 服务器",usage:"使用限额"},wTe={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}}"},TTe={cpuUsage:"CPU 使用率",memoryUsage:"内存使用率",memoryLabels:{used:"已使用",cache:"缓存/缓冲区"},diskUsage:"磁盘使用率 ({{path}})",error:"加载系统指标失败:{{message}}"},CTe={topProcesses:"热门进程",sortBy:{memory:"按内存",cpu:"按 CPU"},headers:{pid:"PID",name:"名称",command:"命令",memory:"内存"},empty:"未找到进程",error:"加载进程失败:{{message}}",containers:"容器",containersEmpty:"没有容器运行中",containersUnavailable:"Docker/Podman 不可用"},ATe={description:"运行中的 Vibora 开发服务器",instanceCount:"{{count}} 个实例运行中",headers:{port:"端口",mode:"模式",directory:"目录",ram:"内存",actions:"操作"},mode:{dev:"开发",prod:"生产"},vite:"Vite",kill:"终止",killing:"终止中...",empty:"没有 Vibora 实例运行中",error:"加载 Vibora 实例失败:{{message}}"},kTe={fiveHourBlock:"5小时配额",sevenDayRolling:"7天滚动配额",opusWeekly:"Opus 周配额",sonnetWeekly:"Sonnet 周配额",resetsIn:"{{time}}后重置",resetsAt:"{{time}}重置",weekProgress:"本周已过 {{percent}}%",unavailable:"Claude Code 使用数据不可用。请确保已登录 Claude Code。",error:"加载使用数据失败:{{message}}"},OTe={title:STe,tabs:xTe,claude:wTe,system:TTe,processes:CTe,vibora:ATe,usage:kTe},RTe="任务",ITe="新建终端",NTe="全部仓库",DTe={taskTerminals:RTe,newTerminal:ITe,allRepos:NTe},LTe="仓库",PTe="共 {{count}} 个",MTe="新建任务",jTe="添加仓库",FTe={openInVSCode:"在 VS Code 中打开"},BTe={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:"取消"},UTe={noRepositories:"尚未添加任何仓库。添加一个仓库以便在创建任务时快速访问。"},$Te={failedToLoad:"加载仓库失败:{{message}}"},HTe={title:LTe,total:PTe,newTask:MTe,addRepository:jTe,card:FTe,delete:{title:"删除仓库",description:'这将从 Vibora 中移除 "{{name}}"。实际的仓库文件不会受到影响。',button:"删除",deleting:"删除中..."},addModal:BTe,empty:UTe,error:$Te},zTe="common",HN=["en","zh"],VTe={en:{common:Nxe,navigation:Mxe,tasks:Hxe,settings:Yxe,review:nwe,worktrees:lwe,monitoring:gwe,terminals:Swe,repositories:Fwe},zh:{common:Wwe,navigation:Ywe,tasks:tTe,settings:lTe,review:mTe,worktrees:ETe,monitoring:OTe,terminals:DTe,repositories:HTe}};function WTe(){if(typeof window<"u"){const e=localStorage.getItem("vibora-language");if(e&&HN.includes(e))return e;const t=navigator.language.split("-")[0];if(HN.includes(t))return t}return"en"}Fi.use(Jme).init({resources:VTe,lng:WTe(),fallbackLng:"en",defaultNS:zTe,ns:["common","navigation","tasks","settings","review","worktrees","monitoring","terminals","repositories"],interpolation:{escapeValue:!1}});Fi.on("languageChanged",e=>{typeof window<"u"&&localStorage.setItem("vibora-language",e)});function Zte(){const{i18n:e}=an(),{data:t,isSuccess:n}=nxe(),r=dM();k.useEffect(()=>{n&&t&&t!==e.language&&e.changeLanguage(t)},[n,t,e]);const i=k.useCallback(async a=>{if(a)await e.changeLanguage(a);else{const s=navigator.language.split("-")[0],o=HN.includes(s)?s:"en";await e.changeLanguage(o)}r.mutate({key:nn.LANGUAGE,value:a??""})},[e,r]);return{language:e.language,savedLanguage:t,changeLanguage:i,isUpdating:r.isPending}}function Qte(){const{setTheme:e,resolvedTheme:t,theme:n}=Pf(),{data:r,isSuccess:i}=rxe(),{data:a}=ixe(),s=dM(),o=k.useRef(void 0),l=k.useRef(!1);k.useEffect(()=>{i&&r&&r!==n&&e(r)},[i,r,n,e]),k.useEffect(()=>{if(!t)return;const f=t==="dark"?"/logo-dark.jpg":"/logo-light.jpg";let d=document.querySelector('link[rel="icon"]');d||(d=document.createElement("link"),d.rel="icon",document.head.appendChild(d)),d.type="image/jpeg",d.href=f},[t]),k.useEffect(()=>{const f=l.current&&a&&o.current===!1;o.current=a,l.current=!0,t&&f&&Zt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:t})}).catch(()=>{})},[a,t]);const u=k.useCallback(f=>{if(e(f),s.mutate({key:nn.THEME,value:f==="system"?"":f}),a){const d=f==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":f;Zt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:d})}).catch(()=>{})}},[e,s,a]);return{theme:n??"system",resolvedTheme:t,savedTheme:r,syncClaudeCode:a,changeTheme:u,isUpdating:s.isPending}}let ZA=!1;const K$={activeTabId:null,focusedTerminals:{},currentView:null,currentTaskId:null,isTabVisible:null,viewUpdatedAt:null};function Jte(){const e=zr(),t=k.useRef(void 0),n=k.useRef({}),{data:r=K$,isLoading:i}=or({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}),a=pr({mutationFn:async p=>{const m=await fetch("/api/terminal-view-state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!m.ok)throw new Error("Failed to update terminal view state");return m.json()},onSuccess:p=>{e.setQueryData(["terminal-view-state"],p)}}),s=k.useRef(a);s.current=a;const o=k.useCallback(p=>{const m=n.current;n.current={...m,...p,focusedTerminals:p.focusedTerminals||m.focusedTerminals?{...m.focusedTerminals,...p.focusedTerminals}:void 0};const S=n.current;e.setQueryData(["terminal-view-state"],E=>{const g=E??K$;return{activeTabId:S.activeTabId!==void 0?S.activeTabId:g.activeTabId,focusedTerminals:{...g.focusedTerminals,...S.focusedTerminals},currentView:S.currentView!==void 0?S.currentView:g.currentView,currentTaskId:S.currentTaskId!==void 0?S.currentTaskId:g.currentTaskId,isTabVisible:S.isTabVisible!==void 0?S.isTabVisible:g.isTabVisible,viewUpdatedAt:S.viewUpdatedAt!==void 0?S.viewUpdatedAt:g.viewUpdatedAt}}),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{s.current.mutate(n.current),n.current={}},500)},[e]),l=k.useCallback((p,m)=>{if(m===null){const S=e.getQueryData(["terminal-view-state"]);if(S){const{[p]:E,...g}=S.focusedTerminals;o({focusedTerminals:g})}}else o({focusedTerminals:{[p]:m}})},[e,o]),u=k.useCallback(p=>r.focusedTerminals[p]??null,[r.focusedTerminals]),f=k.useRef(!1);k.useEffect(()=>{if(ZA){f.current=!1;return}ZA=!0,f.current=!0;const p=()=>{o({isTabVisible:document.visibilityState==="visible",viewUpdatedAt:new Date().toISOString()})};return document.addEventListener("visibilitychange",p),p(),()=>{document.removeEventListener("visibilitychange",p),f.current&&(ZA=!1)}},[o]);const d=k.useCallback((p,m,S)=>{o({currentView:p,currentTaskId:m,activeTabId:S,viewUpdatedAt:new Date().toISOString()})},[o]);return{viewState:r,isLoading:i,getFocusedTerminal:u,setFocusedTerminal:l,updateViewTracking:d}}function Kl(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,a=0,s=0;for(;i<n.length&&a<r.length;)n[i]===r[a]&&(s+=1,a++),i++;return a===r.length?s:0}function GTe(e,t){return t.trim()?e.map(r=>{let i=Kl(r.label,t);if(r.keywords)for(const a of r.keywords){const s=Kl(a,t);s>i&&(i=s)}return{command:r,score:i}}).filter(({score:r})=>r>0).sort((r,i)=>i.score-r.score).map(({command:r})=>r):e}function qTe(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 KTe({open:e,onOpenChange:t,onNewTask:n,onShowShortcuts:r}){const{t:i}=an("navigation"),[a,s]=k.useState(!1),o=e??a,l=t??s,[u,f]=k.useState(""),[d,p]=k.useState(0),m=k.useRef(null),S=k.useRef(null),E=ss(),g=k.useMemo(()=>[{id:"goto-tasks",label:i("commandPalette.commands.goToTasks"),shortcut:"meta+1",keywords:["kanban","board","home"],category:"navigation",icon:y.jsx(ve,{icon:Dp,size:16,strokeWidth:2}),action:()=>{E({to:"/tasks"}),l(!1)}},{id:"goto-terminals",label:i("commandPalette.commands.goToTerminals"),shortcut:"meta+2",keywords:["shell","console","cli"],category:"navigation",icon:y.jsx(ve,{icon:K0e,size:16,strokeWidth:2}),action:()=>{E({to:"/terminals"}),l(!1)}},{id:"goto-task-terminals",label:i("commandPalette.commands.goToTaskTerminals"),shortcut:"meta+i",keywords:["tasks","shell","console","cli"],category:"navigation",icon:y.jsx(ve,{icon:Dp,size:16,strokeWidth:2}),action:()=>{E({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:y.jsx(ve,{icon:J0e,size:16,strokeWidth:2}),action:()=>{E({to:"/worktrees"}),l(!1)}},{id:"goto-repositories",label:i("commandPalette.commands.goToRepositories"),shortcut:"meta+4",keywords:["repos","git","projects"],category:"navigation",icon:y.jsx(ve,{icon:Y0e,size:16,strokeWidth:2}),action:()=>{E({to:"/repositories"}),l(!1)}},{id:"goto-settings",label:i("commandPalette.commands.goToSettings"),shortcut:"meta+,",keywords:["preferences","config","configuration"],category:"navigation",icon:y.jsx(ve,{icon:jee,size:16,strokeWidth:2}),action:()=>{E({to:"/settings"}),l(!1)}},{id:"new-task",label:i("commandPalette.commands.newTask"),shortcut:"meta+j",keywords:["create","add"],category:"actions",icon:y.jsx(ve,{icon:Ax,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:y.jsx(ve,{icon:e1e,size:16,strokeWidth:2}),action:()=>{l(!1),r?.()}}],[E,n,r,l,i]),_=k.useMemo(()=>GTe(g,u),[g,u]),b=k.useMemo(()=>qTe(_),[_]),x=k.useMemo(()=>{const C=[],R=["navigation","actions"];for(const O of R){const I=b.get(O);I&&C.push(...I)}return C},[b]);k.useEffect(()=>{p(0)},[u]),k.useEffect(()=>{if(!S.current)return;const C=S.current.querySelector('[data-selected="true"]');C&&C.scrollIntoView({block:"nearest"})},[d]),Ts("meta+k",()=>l(!0),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+1",()=>E({to:"/tasks"}),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+2",()=>E({to:"/terminals"}),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+i",()=>{E({to:"/terminals",search:{tab:"all-tasks"}})},{allowInInput:!0,allowInTerminal:!0}),Ts("meta+3",()=>E({to:"/worktrees"}),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+4",()=>E({to:"/repositories"}),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+,",()=>E({to:"/settings"}),{allowInInput:!0,allowInTerminal:!0}),Ts("meta+j",()=>{n?.()},{allowInInput:!1,deps:[n]}),Ts("meta+/",()=>{r?.()},{allowInInput:!0,allowInTerminal:!0,deps:[r]});const T=k.useCallback(C=>{switch(C.key){case"ArrowDown":C.preventDefault(),p(R=>Math.min(R+1,x.length-1));break;case"ArrowUp":C.preventDefault(),p(R=>Math.max(R-1,0));break;case"Enter":C.preventDefault(),x[d]&&x[d].action();break;case"Escape":C.preventDefault(),l(!1);break}},[x,d,l]);k.useEffect(()=>{o&&(f(""),p(0),setTimeout(()=>m.current?.focus(),50))},[o]);let w=0;return y.jsx(ul,{open:o,onOpenChange:l,children:y.jsxs(cl,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden",showCloseButton:!1,onKeyDown:T,children:[y.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[y.jsx("span",{className:"text-muted-foreground mr-2",children:">"}),y.jsx(sn,{ref:m,value:u,onChange:C=>f(C.target.value),placeholder:i("commandPalette.placeholder"),className:"border-0 ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 px-0 h-12"}),y.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"})]}),y.jsx("div",{ref:S,className:"max-h-80 overflow-y-auto p-2",children:_.length===0?y.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:i("commandPalette.noResults")}):y.jsx(y.Fragment,{children:["navigation","actions"].map(C=>{const R=b.get(C);return!R||R.length===0?null:y.jsxs("div",{className:"mb-2 last:mb-0",children:[y.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:i(`commandPalette.categories.${C}`)}),R.map(O=>{const I=w++,D=I===d;return y.jsxs("button",{"data-selected":D,onClick:()=>O.action(),onMouseEnter:()=>p(I),className:We("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm",D?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[O.icon&&y.jsx("span",{className:"text-muted-foreground",children:O.icon}),y.jsx("span",{className:"flex-1 text-left",children:O.label}),O.shortcut&&y.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:$ee(O.shortcut)})]},O.id)})]},C)})})})]})})}const Y$={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 YTe({className:e,rows:t=100,cols:n=10,tileClassName:r,tileSize:i="md"}){return y.jsx("div",{className:We("relative z-0 flex w-full h-full justify-center",e),children:Array.from({length:t}).map((a,s)=>y.jsx("div",{className:We(Y$[i],"border-l dark:border-neutral-900 border-neutral-200 relative",r),children:Array.from({length:n}).map((o,l)=>y.jsx("div",{className:We(Y$[i],"border-r border-t dark:border-neutral-900 border-neutral-200 relative hover:bg-tile transition-colors",r)},`col-${l}`))},`row-${s}`))})}const XTe=["/","/tasks","/terminals","/worktrees","/repositories","/review","/monitoring","/settings"];function ZTe(){const e=ei({select:n=>n.location.pathname});return XTe.some(n=>e===n||e.startsWith(n+"/"))?y.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none -z-10",children:y.jsx(YTe,{rows:100,cols:50,tileSize:"sm"})}):null}const QTe=[{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:"terminals",items:[{labelKey:"newTerminal",shortcut:"meta+d"},{labelKey:"closeTerminal",shortcut:"meta+w"}]},{titleKey:"general",items:[{labelKey:"closeModal",shortcut:"escape"},{labelKey:"submitForm",shortcut:"meta+enter"}]}];function JTe({open:e,onOpenChange:t}){const{t:n}=an("navigation");return y.jsx(ul,{open:e,onOpenChange:t,children:y.jsxs(cl,{className:"sm:max-w-md",children:[y.jsx(Su,{children:y.jsx(xu,{children:n("shortcuts.title")})}),y.jsx("div",{className:"space-y-4 mt-2",children:QTe.map(r=>y.jsxs("div",{children:[y.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:n(`shortcuts.groups.${r.titleKey}`)}),y.jsx("div",{className:"space-y-1",children:r.items.map(i=>y.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[y.jsx("span",{className:"text-sm",children:n(`shortcuts.labels.${i.labelKey}`)}),y.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:$ee(i.shortcut)})]},i.shortcut))})]},r.titleKey))})]})})}const eCe=({...e})=>{const{resolvedTheme:t}=Pf();return y.jsx(q1e,{theme:t,className:"toaster group",icons:{success:y.jsx(ve,{icon:q0e,strokeWidth:2,className:"size-4"}),info:y.jsx(ve,{icon:r1e,strokeWidth:2,className:"size-4"}),warning:y.jsx(ve,{icon:Bf,strokeWidth:2,className:"size-4"}),error:y.jsx(ve,{icon:l1e,strokeWidth:2,className:"size-4"}),loading:y.jsx(ve,{icon:xn,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})},_o=ype({component:sCe});function tCe(){return Txe(),null}function nCe(){return Zte(),null}function rCe(){return Qte(),null}function iCe(){const e=ei({select:n=>n.location}),{updateViewTracking:t}=Jte();return k.useEffect(()=>{const n=e.pathname;let r="other",i=null,a=null;n.startsWith("/tasks/")?(r="task-detail",i=n.split("/")[2]||null):n==="/terminals"&&(r="terminals",a=new URLSearchParams(e.search).get("tab")),t(r,i,a)},[e.pathname,e.search,t]),null}function aCe(){const e=ei({select:t=>t.location});return k.useEffect(()=>{window.parent!==window&&window.parent.postMessage({type:"vibora:route",pathname:e.pathname,search:e.search},"*")},[e.pathname,e.search]),null}function sCe(){const[e,t]=k.useState(null),[n,r]=k.useState(!1),[i,a]=k.useState(!1),s=k.useCallback(f=>{t(()=>f)},[]),o=k.useCallback(()=>{e?.()},[e]),l=k.useCallback(()=>{r(!0)},[]),u=k.useCallback(()=>{a(!0)},[]);return y.jsx(Z1e,{children:y.jsxs("div",{className:"flex h-screen flex-col overflow-x-hidden bg-background text-foreground",children:[y.jsx(tCe,{}),y.jsx(nCe,{}),y.jsx(rCe,{}),y.jsx(iCe,{}),y.jsx(aCe,{}),y.jsx(Exe,{onNewTaskRef:s,onOpenCommandPalette:u}),y.jsxs("main",{className:"isolate flex-1 overflow-hidden relative",children:[y.jsx(ZTe,{}),y.jsx(AQ,{})]}),y.jsx(KTe,{open:i,onOpenChange:a,onNewTask:o,onShowShortcuts:l}),y.jsx(JTe,{open:n,onOpenChange:r}),y.jsx(eCe,{position:"bottom-right"})]})})}const oCe=Bs("/")({beforeLoad:()=>{throw dQ({to:"/tasks"})}}),ene="";function tne(){const[e,t]=k.useState(new Map),[n,r]=k.useState(null),[i,a]=k.useState(!0),[s,o]=k.useState(!1),[l,u]=k.useState(null),f=k.useRef(null),d=k.useRef(0),p=k.useCallback(()=>{f.current?.close(),a(!0),o(!1),u(null),t(new Map),r(null);const S=new EventSource(`${ene}/api/worktrees`);f.current=S,S.addEventListener("worktree:basic",E=>{const g=JSON.parse(E.data);d.current=g.length,t(new Map(g.map(_=>[_.path,{..._,size:0,sizeFormatted:"...",branch:"..."}]))),a(!1),o(g.length>0)}),S.addEventListener("worktree:details",E=>{const g=JSON.parse(E.data);t(_=>{const b=new Map(_),x=b.get(g.path);return x&&b.set(g.path,{...x,size:g.size,sizeFormatted:g.sizeFormatted,branch:g.branch}),b}),d.current--,d.current<=0&&o(!1)}),S.addEventListener("worktree:complete",E=>{const g=JSON.parse(E.data);r(g),o(!1),S.close()}),S.addEventListener("worktree:error",E=>{const{path:g}=JSON.parse(E.data);Gt.viewer.error("Error loading worktree details",{path:g}),d.current--,d.current<=0&&o(!1)}),S.onerror=()=>{u(new Error("Connection lost")),a(!1),o(!1),S.close()}},[]);return k.useEffect(()=>(p(),()=>{f.current?.close()}),[p]),{worktrees:k.useMemo(()=>Array.from(e.values()).sort((E,g)=>E.isOrphaned!==g.isOrphaned?E.isOrphaned?-1:1:new Date(g.lastModified).getTime()-new Date(E.lastModified).getTime()),[e]),summary:n,isLoading:i,isLoadingDetails:s,error:l,refetch:p}}function nne(){const e=zr();return pr({mutationFn:({worktreePath:t,repoPath:n,deleteLinkedTask:r})=>Zt(`${ene}/api/worktrees`,{method:"DELETE",body:JSON.stringify({worktreePath:t,repoPath:n,deleteLinkedTask:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worktrees"]}),e.invalidateQueries({queryKey:["tasks"]})}})}const lCe=Qc("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 lo({className:e,variant:t="default",render:n,...r}){return OSe({defaultTagName:"span",props:tl({className:We(lCe({className:e,variant:t}))},r),render:n,state:{slot:"badge",variant:t}})}function Aa({className:e,size:t="default",...n}){return y.jsx("div",{"data-slot":"card","data-size":t,className:We("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 uCe({className:e,...t}){return y.jsx("div",{"data-slot":"card-header",className:We("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 cCe({className:e,...t}){return y.jsx("div",{"data-slot":"card-title",className:We("text-sm font-medium",e),...t})}function Tf({className:e,...t}){return y.jsx("div",{"data-slot":"card-content",className:We("px-4 group-data-[size=sm]/card:px-3",e),...t})}function Bc({...e}){return y.jsx(lEe,{"data-slot":"alert-dialog",...e})}function Uc({...e}){return y.jsx(Zee,{"data-slot":"alert-dialog-trigger",...e})}function dCe({...e}){return y.jsx(qee,{"data-slot":"alert-dialog-portal",...e})}function fCe({className:e,...t}){return y.jsx(zee,{"data-slot":"alert-dialog-overlay",className:We("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 $c({className:e,size:t="default",...n}){return y.jsxs(dCe,{children:[y.jsx(fCe,{}),y.jsx(Gee,{"data-slot":"alert-dialog-content","data-size":t,className:We("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 Hc({className:e,...t}){return y.jsx("div",{"data-slot":"alert-dialog-header",className:We("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 zc({className:e,...t}){return y.jsx("div",{"data-slot":"alert-dialog-footer",className:We("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 Vc({className:e,...t}){return y.jsx(Xee,{"data-slot":"alert-dialog-title",className:We("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 Wc({className:e,...t}){return y.jsx(Vee,{"data-slot":"alert-dialog-description",className:We("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...t})}function rne({className:e,...t}){return y.jsx(Ye,{"data-slot":"alert-dialog-action",className:We(e),...t})}function Gc({className:e,variant:t="outline",size:n="default",...r}){return y.jsx(kx,{"data-slot":"alert-dialog-cancel",className:We(e),render:y.jsx(Ye,{variant:t,size:n}),...r})}const rl=k.forwardRef(({className:e,...t},n)=>y.jsx(jEe,{ref:n,className:We("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:y.jsx(FEe,{className:"flex items-center justify-center",children:y.jsx(ve,{icon:_u,size:12,strokeWidth:3})})}));rl.displayName="Checkbox";const zN={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"},hCe=Bs("/worktrees/")({component:bCe});function pCe(){const{t:e}=an("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),s=Math.floor(a/60),o=Math.floor(s/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}):s>0?s===1?e("time.minuteAgo"):e("time.minutesAgo",{count:s}):e("time.justNow")}}function X$({className:e}){return y.jsx("span",{className:`inline-block animate-pulse rounded bg-muted ${e}`})}function mCe({worktree:e,onDelete:t}){const{t:n}=an("common"),{t:r}=an("worktrees"),i=pCe(),[a,s]=k.useState(!1),[o,l]=k.useState(!1),[u,f]=k.useState(!1),d=e.sizeFormatted==="..."||e.branch==="...",p=!e.isOrphaned&&e.taskId,m=async()=>{l(!0);try{await t(e,u),s(!1)}catch{}finally{l(!1)}},S=E=>{s(E),E||f(!1)};return y.jsx(Aa,{className:"transition-colors hover:border-border/80",children:y.jsxs(Tf,{className:"flex items-start justify-between gap-4 py-4",children:[y.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"truncate font-medium",children:e.name}),e.isOrphaned?y.jsx(lo,{className:We("shrink-0",zN.ORPHANED),children:n("statuses.ORPHANED")}):e.taskStatus?y.jsx(lo,{className:We("shrink-0",zN[e.taskStatus]),children:n(`statuses.${e.taskStatus}`)}):null]}),y.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(ve,{icon:Pi,size:12,strokeWidth:2,className:"shrink-0"}),y.jsx("span",{className:"truncate font-mono",children:e.path})]}),y.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(ve,{icon:wE,size:12,strokeWidth:2,className:"shrink-0"}),e.branch==="..."?y.jsx(X$,{className:"h-3 w-16"}):y.jsx("span",{className:"font-mono",children:e.branch})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(ve,{icon:Lee,size:12,strokeWidth:2,className:"shrink-0"}),e.sizeFormatted==="..."?y.jsx(X$,{className:"h-3 w-12"}):y.jsx("span",{children:e.sizeFormatted})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(ve,{icon:Iee,size:12,strokeWidth:2,className:"shrink-0"}),y.jsx("span",{children:i(e.lastModified)})]})]}),e.taskId&&e.taskTitle&&y.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:y.jsxs(Li,{to:"/tasks/$taskId",params:{taskId:e.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[y.jsx("span",{className:"truncate",children:e.taskTitle}),y.jsx(ve,{icon:ky,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),y.jsxs(Bc,{open:a,onOpenChange:S,children:[y.jsx(Uc,{render:y.jsx(Ye,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:d}),children:y.jsx(ve,{icon:km,size:14,strokeWidth:2})}),y.jsxs($c,{children:[y.jsxs(Hc,{children:[y.jsx(Vc,{children:r("delete.title")}),y.jsxs(Wc,{children:[r("delete.description")," ",y.jsx("span",{className:"font-mono",children:e.name}),".",u&&p&&y.jsxs(y.Fragment,{children:[" ",r("delete.linkedTaskWillBeDeleted",{title:e.taskTitle})]})," ",r("delete.cannotUndo")]}),p&&y.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[y.jsx(rl,{checked:u,onCheckedChange:E=>f(E===!0),disabled:o}),r("delete.alsoDeleteLinkedTask",{title:e.taskTitle})]})]}),y.jsxs(zc,{children:[y.jsx(Gc,{disabled:o,children:n("buttons.cancel")}),y.jsxs(Ye,{variant:"destructive",onClick:m,disabled:o,className:"gap-2",children:[o&&y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}),n(o?"status.deleting":"buttons.delete")]})]})]})]})]})})}const gCe=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function bCe(){const{t:e}=an("common"),{t}=an("worktrees"),{worktrees:n,summary:r,isLoading:i,isLoadingDetails:a,error:s,refetch:o}=tne(),l=nne(),[u,f]=k.useState(new Set),[d,p]=k.useState(!1),[m,S]=k.useState(!1),[E,g]=k.useState(!1),_=O=>{f(I=>{const D=new Set(I);return D.has(O)?D.delete(O):D.add(O),D})},b=()=>{f(new Set)},x=k.useMemo(()=>u.size===0?n:n.filter(O=>!!(O.isOrphaned&&u.has("ORPHANED")||O.taskStatus&&u.has(O.taskStatus))),[n,u]),T=k.useMemo(()=>n.filter(O=>O.taskStatus==="DONE"||O.taskStatus==="CANCELED"),[n]),w=async()=>{if(T.length!==0){S(!0);try{for(const O of T)await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:E});p(!1),o()}catch{}finally{S(!1)}}},C=O=>{p(O),O||g(!1)},R=async(O,I)=>{await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:I}),o()};return y.jsxs("div",{className:"flex h-full flex-col",children:[y.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border bg-background px-4 py-2",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsxs("div",{className:"flex items-center gap-4",children:[y.jsx("h1",{className:"text-sm font-medium",children:t("title")}),(r||n.length>0)&&y.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[y.jsx("span",{children:t("summary.total",{count:r?.total??n.length})}),(r?.orphaned??n.filter(O=>O.isOrphaned).length)>0&&y.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:r?.orphaned??n.filter(O=>O.isOrphaned).length})}),a?y.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):r?y.jsx("span",{children:r.totalSizeFormatted}):null]})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[T.length>0&&y.jsxs(Bc,{open:d,onOpenChange:C,children:[y.jsxs(Uc,{render:y.jsx(Ye,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:a}),children:[y.jsx(ve,{icon:Nee,size:12,strokeWidth:2}),t("cleanup.button",{count:T.length})]}),y.jsxs($c,{children:[y.jsxs(Hc,{children:[y.jsx(Vc,{children:t("cleanup.title")}),y.jsxs(Wc,{children:[t("cleanup.description",{count:T.length}),E&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),y.jsxs("div",{className:"space-y-3",children:[y.jsxs("p",{className:"text-sm text-muted-foreground",children:[T.filter(O=>O.taskStatus==="DONE").length>0&&y.jsxs("span",{className:"mr-3",children:[y.jsx("span",{className:"font-medium text-accent",children:T.filter(O=>O.taskStatus==="DONE").length})," ",t("cleanup.done")]}),T.filter(O=>O.taskStatus==="CANCELED").length>0&&y.jsxs("span",{children:[y.jsx("span",{className:"font-medium text-destructive",children:T.filter(O=>O.taskStatus==="CANCELED").length})," ",t("cleanup.canceled")]})]}),y.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[y.jsx(rl,{checked:E,onCheckedChange:O=>g(O===!0),disabled:m}),t("cleanup.alsoDeleteLinkedTasks")]}),y.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),y.jsxs(zc,{children:[y.jsx(Gc,{disabled:m,children:e("buttons.cancel")}),y.jsxs(Ye,{variant:"destructive",onClick:w,disabled:m,className:"gap-2",children:[m&&y.jsx(ve,{icon:xn,size:14,strokeWidth:2,className:"animate-spin"}),m?e("status.deleting"):t("delete.button",{count:T.length})]})]})]})]}),u.size>0&&y.jsxs(Ye,{variant:"ghost",size:"sm",onClick:b,className:"gap-1.5 text-xs",children:[y.jsx(ve,{icon:aa,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),y.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:gCe.map(O=>{const I=u.has(O);return y.jsx("button",{onClick:()=>_(O),className:We("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",I?zN[O]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${O}`)},O)})})]}),y.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i&&y.jsx("div",{className:"flex items-center justify-center py-12",children:y.jsx(ve,{icon:xn,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),s&&y.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[y.jsx(ve,{icon:Bf,size:20,strokeWidth:2}),y.jsx("span",{className:"text-sm",children:t("error.failedToLoad",{message:s.message})})]}),!i&&!s&&x.length===0&&y.jsx("div",{className:"py-12 text-muted-foreground",children:y.jsx("p",{className:"text-sm",children:u.size>0?t("empty.noMatch"):t("empty.noWorktrees")})}),!i&&y.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:x.map(O=>y.jsx(mCe,{worktree:O,onDelete:R},O.path))})]})]})}function rn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var vCe={};function $x(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:vCe}var ine=Object.assign,OE=Object.getOwnPropertyDescriptor,qo=Object.defineProperty,Hx=Object.prototype,VN=[];Object.freeze(VN);var hM={};Object.freeze(hM);var yCe=typeof Proxy<"u",_Ce=Object.toString();function ane(){yCe||rn("Proxy not available")}function sne(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var np=function(){};function is(e){return typeof e=="function"}function Cf(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function zx(e){return e!==null&&typeof e=="object"}function qc(e){if(!zx(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===_Ce}function one(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Vx(e,t,n){qo(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function lne(e,t,n){qo(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function id(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return zx(r)&&r[n]===!0}}function Om(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function ECe(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function Yl(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var une=typeof Object.getOwnPropertySymbols<"u";function SCe(e){var t=Object.keys(e);if(!une)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return Hx.propertyIsEnumerable.call(e,r)})):t}var Wx=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:une?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function cne(e){return e===null?null:typeof e=="object"?""+e:e}function ru(e,t){return Hx.hasOwnProperty.call(e,t)}var xCe=Object.getOwnPropertyDescriptors||function(t){var n={};return Wx(t).forEach(function(r){n[r]=OE(t,r)}),n};function Ja(e,t){return!!(e&t)}function es(e,t,n){return n?e|=t:e&=~t,e}function Z$(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function wCe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,CCe(r.key),r)}}function Rm(e,t,n){return t&&wCe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function rp(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=ACe(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
26
26
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kc(){return Kc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Kc.apply(null,arguments)}function dne(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,WN(e,t)}function WN(e,t){return WN=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},WN(e,t)}function TCe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function CCe(e){var t=TCe(e,"string");return typeof t=="symbol"?t:t+""}function ACe(e,t){if(e){if(typeof e=="string")return Z$(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Z$(e,t):void 0}}var Ho=Symbol("mobx-stored-annotations");function Ko(e){function t(n,r){if(By(r))return e.decorate_20223_(n,r);Fy(n,r,e)}return Object.assign(t,e)}function Fy(e,t,n){ru(e,Ho)||Vx(e,Ho,Kc({},e[Ho])),LCe(n)||(e[Ho][t]=n)}function kCe(e){return ru(e,Ho)||Vx(e,Ho,Kc({},e[Ho])),e[Ho]}function By(e){return typeof e=="object"&&typeof e.kind=="string"}var Mt=Symbol("mobx administration"),ad=(function(){function e(n){n===void 0&&(n="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=kn.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return kne(this)},t.reportChanged=function(){Ea(),One(this),Sa()},t.toString=function(){return this.name_},Rm(e,[{key:"isBeingObserved",get:function(){return Ja(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=es(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Ja(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=es(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Ja(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=es(this.flags_,e.diffValueMask_,r===1)}}])})();ad.isBeingObservedMask_=1;ad.isPendingUnobservationMask_=2;ad.diffValueMask_=4;var pM=id("Atom",ad);function RE(e,t,n){t===void 0&&(t=np),n===void 0&&(n=np);var r=new ad(e);return t!==np&&FAe(r,t),n!==np&&jne(r,n),r}function OCe(e,t){return ere(e,t)}function RCe(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Pp={structural:OCe,default:RCe};function Af(e,t,n){return Hne(e)?e:Array.isArray(e)?dr.array(e,{name:n}):qc(e)?dr.object(e,void 0,{name:n}):Om(e)?dr.map(e,{name:n}):Yl(e)?dr.set(e,{name:n}):typeof e=="function"&&!Mp(e)&&!pv(e)?one(e)?jp(e):hv(n,e):e}function ICe(e,t,n){if(e==null||So(e)||hl(e)||Vs(e)||na(e))return e;if(Array.isArray(e))return dr.array(e,{name:n,deep:!1});if(qc(e))return dr.object(e,void 0,{name:n,deep:!1});if(Om(e))return dr.map(e,{name:n,deep:!1});if(Yl(e))return dr.set(e,{name:n,deep:!1})}function Gx(e){return e}function NCe(e,t){return ere(e,t)?t:e}var DCe="override";function LCe(e){return e.annotationType_===DCe}function Uy(e,t){return{annotationType_:e,options_:t,make_:PCe,extend_:MCe,decorate_20223_:jCe}}function PCe(e,t,n,r){var i;if((i=this.options_)!=null&&i.bound)return this.extend_(e,t,n,!1)===null?0:1;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(Mp(n.value))return 1;var a=fne(e,this,t,n,!1);return qo(r,t,a),2}function MCe(e,t,n,r){var i=fne(e,this,t,n);return e.defineProperty_(t,i,r)}function jCe(e,t){var n=t.kind,r=t.name,i=t.addInitializer,a=this,s=function(u){var f,d,p,m;return Yc((f=(d=a.options_)==null?void 0:d.name)!=null?f:r.toString(),u,(p=(m=a.options_)==null?void 0:m.autoAction)!=null?p:!1)};if(n=="field")return function(l){var u,f=l;return Mp(f)||(f=s(f)),(u=a.options_)!=null&&u.bound&&(f=f.bind(this),f.isMobxAction=!0),f};if(n=="method"){var o;return Mp(e)||(e=s(e)),(o=this.options_)!=null&&o.bound&&i(function(){var l=this,u=l[r].bind(l);u.isMobxAction=!0,l[r]=u}),e}rn("Cannot apply '"+a.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
|
|
27
27
|
'`+a.annotationType_+"' can only be used on properties with a function value."))}function FCe(e,t,n,r){t.annotationType_,r.value}function fne(e,t,n,r,i){var a,s,o,l,u,f,d;i===void 0&&(i=ut.safeDescriptors),FCe(e,t,n,r);var p=r.value;if((a=t.options_)!=null&&a.bound){var m;p=p.bind((m=e.proxy_)!=null?m:e.target_)}return{value:Yc((s=(o=t.options_)==null?void 0:o.name)!=null?s:n.toString(),p,(l=(u=t.options_)==null?void 0:u.autoAction)!=null?l:!1,(f=t.options_)!=null&&f.bound?(d=e.proxy_)!=null?d:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function hne(e,t){return{annotationType_:e,options_:t,make_:BCe,extend_:UCe,decorate_20223_:$Ce}}function BCe(e,t,n,r){var i;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!ru(e.target_,t)||!pv(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(pv(n.value))return 1;var a=pne(e,this,t,n,!1,!1);return qo(r,t,a),2}function UCe(e,t,n,r){var i,a=pne(e,this,t,n,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,a,r)}function $Ce(e,t){var n,r=t.name,i=t.addInitializer;return pv(e)||(e=jp(e)),(n=this.options_)!=null&&n.bound&&i(function(){var a=this,s=a[r].bind(a);s.isMobXFlow=!0,a[r]=s}),e}function HCe(e,t,n,r){t.annotationType_,r.value}function pne(e,t,n,r,i,a){a===void 0&&(a=ut.safeDescriptors),HCe(e,t,n,r);var s=r.value;if(pv(s)||(s=jp(s)),i){var o;s=s.bind((o=e.proxy_)!=null?o:e.target_),s.isMobXFlow=!0}return{value:s,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function mM(e,t){return{annotationType_:e,options_:t,make_:zCe,extend_:VCe,decorate_20223_:WCe}}function zCe(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function VCe(e,t,n,r){return GCe(e,this,t,n),e.defineComputedProperty_(t,Kc({},this.options_,{get:n.get,set:n.set}),r)}function WCe(e,t){var n=this,r=t.name,i=t.addInitializer;return i(function(){var a=Nm(this)[Mt],s=Kc({},n.options_,{get:e,context:this});s.name||(s.name="ObservableObject."+r.toString()),a.values_.set(r,new mo(s))}),function(){return this[Mt].getObservablePropValue_(r)}}function GCe(e,t,n,r){t.annotationType_,r.get}function qx(e,t){return{annotationType_:e,options_:t,make_:qCe,extend_:KCe,decorate_20223_:YCe}}function qCe(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function KCe(e,t,n,r){var i,a;return XCe(e,this),e.defineObservableProperty_(t,n.value,(i=(a=this.options_)==null?void 0:a.enhancer)!=null?i:Af,r)}function YCe(e,t){var n=this,r=t.kind,i=t.name,a=new WeakSet;function s(o,l){var u,f,d=Nm(o)[Mt],p=new Pc(l,(u=(f=n.options_)==null?void 0:f.enhancer)!=null?u:Af,"ObservableObject."+i.toString(),!1);d.values_.set(i,p),a.add(o)}if(r=="accessor")return{get:function(){return a.has(this)||s(this,e.get.call(this)),this[Mt].getObservablePropValue_(i)},set:function(l){return a.has(this)||s(this,l),this[Mt].setObservablePropValue_(i,l)},init:function(l){return a.has(this)||s(this,l),l}}}function XCe(e,t,n,r){t.annotationType_}var ZCe="true",QCe=mne();function mne(e){return{annotationType_:ZCe,options_:e,make_:JCe,extend_:eAe,decorate_20223_:tAe}}function JCe(e,t,n,r){var i,a;if(n.get)return Im.make_(e,t,n,r);if(n.set){var s=Mp(n.set)?n.set:Yc(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:ut.safeDescriptors?e.isPlainObject_:!0,set:s})===null?0:2:(qo(r,t,{configurable:!0,set:s}),2)}if(r!==e.target_&&typeof n.value=="function"){var o;if(one(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?jp.bound:jp;return u.make_(e,t,n,r)}var f=(o=this.options_)!=null&&o.autoBind?hv.bound:hv;return f.make_(e,t,n,r)}var d=((i=this.options_)==null?void 0:i.deep)===!1?dr.ref:dr;if(typeof n.value=="function"&&(a=this.options_)!=null&&a.autoBind){var p;n.value=n.value.bind((p=e.proxy_)!=null?p:e.target_)}return d.make_(e,t,n,r)}function eAe(e,t,n,r){var i,a;if(n.get)return Im.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:ut.safeDescriptors?e.isPlainObject_:!0,set:Yc(t.toString(),n.set)},r);if(typeof n.value=="function"&&(i=this.options_)!=null&&i.autoBind){var s;n.value=n.value.bind((s=e.proxy_)!=null?s:e.target_)}var o=((a=this.options_)==null?void 0:a.deep)===!1?dr.ref:dr;return o.extend_(e,t,n,r)}function tAe(e,t){rn("'"+this.annotationType_+"' cannot be used as a decorator")}var nAe="observable",rAe="observable.ref",iAe="observable.shallow",aAe="observable.struct",gne={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(gne);function i_(e){return e||gne}var GN=qx(nAe),sAe=qx(rAe,{enhancer:Gx}),oAe=qx(iAe,{enhancer:ICe}),lAe=qx(aAe,{enhancer:NCe}),bne=Ko(GN);function a_(e){return e.deep===!0?Af:e.deep===!1?Gx:cAe(e.defaultDecorator)}function uAe(e){var t;return e?(t=e.defaultDecorator)!=null?t:mne(e):void 0}function cAe(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Af}function vne(e,t,n){if(By(t))return GN.decorate_20223_(e,t);if(Cf(t)){Fy(e,t,GN);return}return Hne(e)?e:qc(e)?dr.object(e,t,n):Array.isArray(e)?dr.array(e,t):Om(e)?dr.map(e,t):Yl(e)?dr.set(e,t):typeof e=="object"&&e!==null?e:dr.box(e,t)}ine(vne,bne);var dAe={box:function(t,n){var r=i_(n);return new Pc(t,a_(r),r.name,!0,r.equals)},array:function(t,n){var r=i_(n);return(ut.useProxies===!1||r.proxy===!1?pke:ike)(t,a_(r),r.name)},map:function(t,n){var r=i_(n);return new _M(t,a_(r),r.name)},set:function(t,n){var r=i_(n);return new Yne(t,a_(r),r.name)},object:function(t,n,r){return Vf(function(){return HAe(ut.useProxies===!1||r?.proxy===!1?Nm({},r):tke({},r),t,n)})},ref:Ko(sAe),shallow:Ko(oAe),deep:bne,struct:Ko(lAe)},dr=ine(vne,dAe),yne="computed",fAe="computed.struct",qN=mM(yne),hAe=mM(fAe,{equals:Pp.structural}),Im=function(t,n){if(By(n))return qN.decorate_20223_(t,n);if(Cf(n))return Fy(t,n,qN);if(qc(t))return Ko(mM(yne,t));var r=qc(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new mo(r)};Object.assign(Im,qN);Im.struct=Ko(hAe);var Q$,J$,IE=0,pAe=1,mAe=(Q$=(J$=OE(function(){},"name"))==null?void 0:J$.configurable)!=null?Q$:!1,eH={value:"action",configurable:!0,writable:!1,enumerable:!1};function Yc(e,t,n,r){n===void 0&&(n=!1);function i(){return _ne(e,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},mAe&&(eH.value=e,qo(i,"name",eH)),i}function _ne(e,t,n,r,i){var a=gAe(e,t);try{return n.apply(r,i)}catch(s){throw a.error_=s,s}finally{bAe(a)}}function gAe(e,t,n,r){var i=!1,a=0,s=ut.trackingDerivation,o=!t||!s;Ea();var l=ut.allowStateChanges;o&&(zf(),l=Kx(!0));var u=gM(!0),f={runAsAction_:o,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:i,startTime_:a,actionId_:pAe++,parentActionId_:IE};return IE=f.actionId_,f}function bAe(e){IE!==e.actionId_&&rn(30),IE=e.parentActionId_,e.error_!==void 0&&(ut.suppressReactionErrors=!0),Yx(e.prevAllowStateChanges_),Pb(e.prevAllowStateReads_),Sa(),e.runAsAction_&&iu(e.prevDerivation_),ut.suppressReactionErrors=!1}function Ene(e,t){var n=Kx(e);try{return t()}finally{Yx(n)}}function Kx(e){var t=ut.allowStateChanges;return ut.allowStateChanges=e,t}function Yx(e){ut.allowStateChanges=e}var Pc=(function(e){function t(r,i,a,s,o){var l;return a===void 0&&(a="ObservableValue"),o===void 0&&(o=Pp.default),l=e.call(this,a)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=i,l.name_=a,l.equals=o,l.value_=i(r,void 0,a),l}dne(t,e);var n=t.prototype;return n.dehanceValue=function(i){return this.dehancer!==void 0?this.dehancer(i):i},n.set=function(i){this.value_,i=this.prepareNewValue_(i),i!==ut.UNCHANGED&&this.setNewValue_(i)},n.prepareNewValue_=function(i){if(Rs(this)){var a=Is(this,{object:this,type:Yo,newValue:i});if(!a)return ut.UNCHANGED;i=a.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?ut.UNCHANGED:i},n.setNewValue_=function(i){var a=this.value_;this.value_=i,this.reportChanged(),uo(this)&&co(this,{type:Yo,object:this,newValue:i,oldValue:a})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(i){return $y(this,i)},n.observe_=function(i,a){return a&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:Yo,newValue:this.value_,oldValue:void 0}),Hy(this,i)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return cne(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t})(ad),vAe=id("ObservableValue",Pc),mo=(function(){function e(n){this.dependenciesState_=kn.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=kn.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new DE(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=NE.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||rn(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=Yc("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Pp.structural:Pp.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){wAe(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&rn(32,this.name_,this.derivation),ut.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)KN(this)&&(this.warnAboutUntrackedRead_(),Ea(),this.value_=this.computeValue_(!1),Sa());else if(kne(this),KN(this)){var r=ut.trackingContext;this.keepAlive_&&!r&&(ut.trackingContext=this),this.trackAndCompute()&&xAe(this),ut.trackingContext=r}var i=this.value_;if(z_(i))throw i.cause;return i},t.set=function(r){if(this.setter_){this.isRunningSetter&&rn(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else rn(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,i=this.dependenciesState_===kn.NOT_TRACKING_,a=this.computeValue_(!0),s=i||z_(r)||z_(a)||!this.equals_(r,a);return s&&(this.value_=a),s},t.computeValue_=function(r){this.isComputing=!0;var i=Kx(!1),a;if(r)a=Sne(this,this.derivation,this.scope_);else if(ut.disableErrorBoundaries===!0)a=this.derivation.call(this.scope_);else try{a=this.derivation.call(this.scope_)}catch(s){a=new DE(s)}return Yx(i),this.isComputing=!1,a},t.suspend_=function(){this.keepAlive_||(YN(this),this.value_=void 0)},t.observe_=function(r,i){var a=this,s=!0,o=void 0;return Pne(function(){var l=a.get();if(!s||i){var u=zf();r({observableKind:"computed",debugObjectName:a.name_,type:Yo,object:a,newValue:l,oldValue:o}),iu(u)}s=!1,o=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return cne(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Rm(e,[{key:"isComputing",get:function(){return Ja(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=es(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return Ja(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=es(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return Ja(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=es(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Ja(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=es(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Ja(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=es(this.flags_,e.diffValueMask_,r===1)}}])})();mo.isComputingMask_=1;mo.isRunningSetterMask_=2;mo.isBeingObservedMask_=4;mo.isPendingUnobservationMask_=8;mo.diffValueMask_=16;var Xx=id("ComputedValue",mo),kn;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(kn||(kn={}));var NE;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(NE||(NE={}));var DE=function(t){this.cause=void 0,this.cause=t};function z_(e){return e instanceof DE}function KN(e){switch(e.dependenciesState_){case kn.UP_TO_DATE_:return!1;case kn.NOT_TRACKING_:case kn.STALE_:return!0;case kn.POSSIBLY_STALE_:{for(var t=gM(!0),n=zf(),r=e.observing_,i=r.length,a=0;a<i;a++){var s=r[a];if(Xx(s)){if(ut.disableErrorBoundaries)s.get();else try{s.get()}catch{return iu(n),Pb(t),!0}if(e.dependenciesState_===kn.STALE_)return iu(n),Pb(t),!0}}return wne(e),iu(n),Pb(t),!1}}}function Sne(e,t,n){var r=gM(!0);wne(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++ut.runId;var i=ut.trackingDerivation;ut.trackingDerivation=e,ut.inBatch++;var a;if(ut.disableErrorBoundaries===!0)a=t.call(n);else try{a=t.call(n)}catch(s){a=new DE(s)}return ut.inBatch--,ut.trackingDerivation=i,yAe(e),Pb(r),a}function yAe(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=kn.UP_TO_DATE_,i=0,a=e.unboundDepsCount_,s=0;s<a;s++){var o=n[s];o.diffValue===0&&(o.diffValue=1,i!==s&&(n[i]=o),i++),o.dependenciesState_>r&&(r=o.dependenciesState_)}for(n.length=i,e.newObserving_=null,a=t.length;a--;){var l=t[a];l.diffValue===0&&Cne(l,e),l.diffValue=0}for(;i--;){var u=n[i];u.diffValue===1&&(u.diffValue=0,SAe(u,e))}r!==kn.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function YN(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Cne(t[n],e);e.dependenciesState_=kn.NOT_TRACKING_}function xne(e){var t=zf();try{return e()}finally{iu(t)}}function zf(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function iu(e){ut.trackingDerivation=e}function gM(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function Pb(e){ut.allowStateReads=e}function wne(e){if(e.dependenciesState_!==kn.UP_TO_DATE_){e.dependenciesState_=kn.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=kn.UP_TO_DATE_}}var V_=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},W_=!0,Tne=!1,ut=(function(){var e=$x();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(W_=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new V_().version&&(W_=!1),W_?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new V_):(setTimeout(function(){Tne||rn(35)},1),new V_)})();function _Ae(){if((ut.pendingReactions.length||ut.inBatch||ut.isRunningReactions)&&rn(36),Tne=!0,W_){var e=$x();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),ut=new V_}}function EAe(){return ut}function SAe(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Cne(e,t){e.observers_.delete(t),e.observers_.size===0&&Ane(e)}function Ane(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,ut.pendingUnobservations.push(e))}function Ea(){ut.inBatch++}function Sa(){if(--ut.inBatch===0){Rne();for(var e=ut.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof mo&&n.suspend_())}ut.pendingUnobservations=[]}}function kne(e){var t=ut.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&ut.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&ut.inBatch>0&&Ane(e),!1)}function One(e){e.lowestObserverState_!==kn.STALE_&&(e.lowestObserverState_=kn.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===kn.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=kn.STALE_}))}function xAe(e){e.lowestObserverState_!==kn.STALE_&&(e.lowestObserverState_=kn.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===kn.POSSIBLY_STALE_?t.dependenciesState_=kn.STALE_:t.dependenciesState_===kn.UP_TO_DATE_&&(e.lowestObserverState_=kn.UP_TO_DATE_)}))}function wAe(e){e.lowestObserverState_===kn.UP_TO_DATE_&&(e.lowestObserverState_=kn.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===kn.UP_TO_DATE_&&(t.dependenciesState_=kn.POSSIBLY_STALE_,t.onBecomeStale_())}))}var il=(function(){function e(n,r,i,a){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=kn.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=NE.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=i,this.requiresObservable_=a}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,ut.pendingReactions.push(this),Rne())},t.runReaction_=function(){if(!this.isDisposed){Ea(),this.isScheduled=!1;var r=ut.trackingContext;if(ut.trackingContext=this,KN(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(i){this.reportExceptionInDerivation_(i)}}ut.trackingContext=r,Sa()}},t.track=function(r){if(!this.isDisposed){Ea(),this.isRunning=!0;var i=ut.trackingContext;ut.trackingContext=this;var a=Sne(this,r,void 0);ut.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&YN(this),z_(a)&&this.reportExceptionInDerivation_(a.cause),Sa()}},t.reportExceptionInDerivation_=function(r){var i=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(ut.disableErrorBoundaries)throw r;var a="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(a,r),ut.globalReactionErrorHandlers.forEach(function(s){return s(r,i)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Ea(),YN(this),Sa()))},t.getDisposer_=function(r){var i=this,a=function s(){i.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",s)};return r==null||r.addEventListener==null||r.addEventListener("abort",a),a[Mt]=this,"dispose"in Symbol&&typeof Symbol.dispose=="symbol"&&(a[Symbol.dispose]=a),a},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},Rm(e,[{key:"isDisposed",get:function(){return Ja(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=es(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return Ja(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=es(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return Ja(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=es(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return Ja(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=es(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return Ja(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=es(this.flags_,e.diffValueMask_,r===1)}}])})();il.isDisposedMask_=1;il.isScheduledMask_=2;il.isTrackPendingMask_=4;il.isRunningMask_=8;il.diffValueMask_=16;var TAe=100,XN=function(t){return t()};function Rne(){ut.inBatch>0||ut.isRunningReactions||XN(CAe)}function CAe(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===TAe&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}ut.isRunningReactions=!1}var LE=id("Reaction",il);function AAe(e){var t=XN;XN=function(r){return e(function(){return t(r)})}}function Mb(){return!1}function kAe(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var Ine="action",OAe="action.bound",Nne="autoAction",RAe="autoAction.bound",Dne="<unnamed action>",ZN=Uy(Ine),IAe=Uy(OAe,{bound:!0}),QN=Uy(Nne,{autoAction:!0}),NAe=Uy(RAe,{autoAction:!0,bound:!0});function Lne(e){var t=function(r,i){if(is(r))return Yc(r.name||Dne,r,e);if(is(i))return Yc(r,i,e);if(By(i))return(e?QN:ZN).decorate_20223_(r,i);if(Cf(i))return Fy(r,i,e?QN:ZN);if(Cf(r))return Ko(Uy(e?Nne:Ine,{name:r,autoAction:e}))};return t}var Qr=Lne(!1);Object.assign(Qr,ZN);var hv=Lne(!0);Object.assign(hv,QN);Qr.bound=Ko(IAe);hv.bound=Ko(NAe);function tH(e){return _ne(e.name||Dne,!1,e,this,void 0)}function Mp(e){return is(e)&&e.isMobxAction===!0}function Pne(e,t){var n,r,i,a;t===void 0&&(t=hM);var s=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",o=!t.scheduler&&!t.delay,l;if(o)l=new il(s,function(){this.track(d)},t.onError,t.requiresObservable);else{var u=Mne(t),f=!1;l=new il(s,function(){f||(f=!0,u(function(){f=!1,l.isDisposed||l.track(d)}))},t.onError,t.requiresObservable)}function d(){e(l)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||l.schedule_(),l.getDisposer_((a=t)==null?void 0:a.signal)}var DAe=function(t){return t()};function Mne(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:DAe}function LAe(e,t,n){var r,i,a;n===void 0&&(n=hM);var s=(r=n.name)!=null?r:"Reaction",o=Qr(s,n.onError?PAe(n.onError,t):t),l=!n.scheduler&&!n.delay,u=Mne(n),f=!0,d=!1,p,m=n.compareStructural?Pp.structural:n.equals||Pp.default,S=new il(s,function(){f||l?E():d||(d=!0,u(E))},n.onError,n.requiresObservable);function E(){if(d=!1,!S.isDisposed){var g=!1,_=p;S.track(function(){var b=Ene(!1,function(){return e(S)});g=f||!m(p,b),p=b}),(f&&n.fireImmediately||!f&&g)&&o(p,_,S),f=!1}}return(i=n)!=null&&(i=i.signal)!=null&&i.aborted||S.schedule_(),S.getDisposer_((a=n)==null?void 0:a.signal)}function PAe(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}var MAe="onBO",jAe="onBUO";function FAe(e,t,n){return Fne(MAe,e,t,n)}function jne(e,t,n){return Fne(jAe,e,t,n)}function Fne(e,t,n,r){var i=Fp(t),a=is(r)?r:n,s=e+"L";return i[s]?i[s].add(a):i[s]=new Set([a]),function(){var o=i[s];o&&(o.delete(a),o.size===0&&delete i[s])}}var BAe="never",s_="always",UAe="observed";function $Ae(e){e.isolateGlobalState===!0&&_Ae();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(ut.useProxies=t===s_?!0:t===BAe?!1:typeof Proxy<"u"),t==="ifavailable"&&(ut.verifyProxies=!0),n!==void 0){var r=n===s_?s_:n===UAe;ut.enforceActions=r,ut.allowStateChanges=!(r===!0||r===s_)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(ut[i]=!!e[i])}),ut.allowStateReads=!ut.observableRequiresReaction,e.reactionScheduler&&AAe(e.reactionScheduler)}function HAe(e,t,n,r){var i=xCe(t);return Vf(function(){var a=Nm(e,r)[Mt];Wx(i).forEach(function(s){a.extend_(s,i[s],n&&s in n?n[s]:!0)})}),e}function zAe(e,t){return Bne(Fp(e,t))}function Bne(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=VAe(e.observing_).map(Bne)),t}function VAe(e){return Array.from(new Set(e))}var WAe=0;function Une(){this.message="FLOW_CANCELLED"}Une.prototype=Object.create(Error.prototype);var QA=hne("flow"),GAe=hne("flow.bound",{bound:!0}),jp=Object.assign(function(t,n){if(By(n))return QA.decorate_20223_(t,n);if(Cf(n))return Fy(t,n,QA);var r=t,i=r.name||"<unnamed flow>",a=function(){var o=this,l=arguments,u=++WAe,f=Qr(i+" - runid: "+u+" - init",r).apply(o,l),d,p=void 0,m=new Promise(function(S,E){var g=0;d=E;function _(T){p=void 0;var w;try{w=Qr(i+" - runid: "+u+" - yield "+g++,f.next).call(f,T)}catch(C){return E(C)}x(w)}function b(T){p=void 0;var w;try{w=Qr(i+" - runid: "+u+" - yield "+g++,f.throw).call(f,T)}catch(C){return E(C)}x(w)}function x(T){if(is(T?.then)){T.then(x,E);return}return T.done?S(T.value):(p=Promise.resolve(T.value),p.then(_,b))}_(void 0)});return m.cancel=Qr(i+" - runid: "+u+" - cancel",function(){try{p&&nH(p);var S=f.return(void 0),E=Promise.resolve(S.value);E.then(np,np),nH(E),d(new Une)}catch(g){d(g)}}),m};return a.isMobXFlow=!0,a},QA);jp.bound=Ko(GAe);function nH(e){is(e.cancel)&&e.cancel()}function pv(e){return e?.isMobXFlow===!0}function $ne(e,t,n){var r;return Vs(e)||hl(e)||vAe(e)?r=al(e):So(e)&&(r=al(e,t)),r.dehancer=typeof t=="function"?t:n,function(){r.dehancer=void 0}}function bM(e,t,n){return is(n)?KAe(e,t,n):qAe(e,t)}function qAe(e,t){return al(e).intercept_(t)}function KAe(e,t,n){return al(e,t).intercept_(n)}function YAe(e,t){return e?So(e)||!!e[Mt]||pM(e)||LE(e)||Xx(e):!1}function Hne(e){return YAe(e)}function PE(e){if(So(e))return e[Mt].keys_();if(Vs(e)||na(e))return Array.from(e.keys());if(hl(e))return e.map(function(t,n){return n});rn(5)}function zne(e){if(So(e))return PE(e).map(function(t){return e[t]});if(Vs(e))return PE(e).map(function(t){return e.get(t)});if(na(e))return Array.from(e.values());if(hl(e))return e.slice();rn(6)}function XAe(e){if(So(e))return PE(e).map(function(t){return[t,e[t]]});if(Vs(e))return PE(e).map(function(t){return[t,e.get(t)]});if(na(e))return Array.from(e.entries());if(hl(e))return e.map(function(t,n){return[n,t]});rn(7)}function Vne(e,t,n){if(arguments.length===2&&!na(e)){Ea();var r=t;try{for(var i in r)Vne(e,i,r[i])}finally{Sa()}return}So(e)?e[Mt].set_(t,n):Vs(e)?e.set(t,n):na(e)?e.add(t):hl(e)?(typeof t!="number"&&(t=parseInt(t,10)),t<0&&rn("Invalid index: '"+t+"'"),Ea(),t>=e.length&&(e.length=t+1),e[t]=n,Sa()):rn(8)}function Wne(e,t,n){if(So(e))return e[Mt].defineProperty_(t,n);rn(39)}function vM(e,t,n,r){return is(n)?QAe(e,t,n,r):ZAe(e,t,n)}function ZAe(e,t,n){return al(e).observe_(t,n)}function QAe(e,t,n,r){return al(e,t).observe_(n,r)}function Xl(e,t){t===void 0&&(t=void 0),Ea();try{return e.apply(t)}finally{Sa()}}function rH(e,t,n){return arguments.length===1||t&&typeof t=="object"?JAe(e,t):Gne(e,t,{})}function Gne(e,t,n){var r;if(typeof n.timeout=="number"){var i=new Error("WHEN_TIMEOUT");r=setTimeout(function(){if(!s[Mt].isDisposed)if(s(),n.onError)n.onError(i);else throw i},n.timeout)}n.name="When";var a=Yc("When-effect",t),s=Pne(function(o){var l=Ene(!1,e);l&&(o.dispose(),r&&clearTimeout(r),a())},n);return s}function JAe(e,t){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var r,i,a=new Promise(function(s,o){var l,u=Gne(e,s,Kc({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},t==null||(l=t.signal)==null||l.addEventListener==null||l.addEventListener("abort",i)}).finally(function(){var s;return t==null||(s=t.signal)==null||s.removeEventListener==null?void 0:s.removeEventListener("abort",i)});return a.cancel=r,a}function zh(e){return e[Mt]}var eke={has:function(t,n){return zh(t).has_(n)},get:function(t,n){return zh(t).get_(n)},set:function(t,n,r){var i;return Cf(n)?(i=zh(t).set_(n,r,!0))!=null?i:!0:!1},deleteProperty:function(t,n){var r;return Cf(n)?(r=zh(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var i;return(i=zh(t).defineProperty_(n,r))!=null?i:!0},ownKeys:function(t){return zh(t).ownKeys_()},preventExtensions:function(t){rn(13)}};function tke(e,t){var n,r;return ane(),e=Nm(e,t),(r=(n=e[Mt]).proxy_)!=null?r:n.proxy_=new Proxy(e,eke)}function Rs(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function $y(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),sne(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Is(e,t){var n=zf();try{for(var r=[].concat(e.interceptors_||[]),i=0,a=r.length;i<a&&(t=r[i](t),t&&!t.type&&rn(14),!!t);i++);return t}finally{iu(n)}}function uo(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Hy(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),sne(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function co(e,t){var n=zf(),r=e.changeListeners_;if(r){r=r.slice();for(var i=0,a=r.length;i<a;i++)r[i](t);iu(n)}}function qne(e,t,n){return Vf(function(){var r,i=Nm(e,n)[Mt];(r=t)!=null||(t=kCe(e)),Wx(t).forEach(function(a){return i.make_(a,t[a])})}),e}var iH="splice",Yo="update",nke=1e4,rke={get:function(t,n){var r=t[Mt];return n===Mt?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):ru(ME,n)?ME[n]:t[n]},set:function(t,n,r){var i=t[Mt];return n==="length"&&i.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:i.set_(parseInt(n),r),!0},preventExtensions:function(){rn(15)}},yM=(function(){function e(n,r,i,a){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=a,this.atom_=new ad(n),this.enhancer_=function(s,o){return r(s,o,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return $y(this,r)},t.observe_=function(r,i){return i===void 0&&(i=!1),i&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Hy(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&rn("Out of range: "+r);var i=this.values_.length;if(r!==i)if(r>i){for(var a=new Array(r-i),s=0;s<r-i;s++)a[s]=void 0;this.spliceWithArray_(i,0,a)}else this.spliceWithArray_(r,i-r)},t.updateArrayLength_=function(r,i){r!==this.lastKnownLength_&&rn(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&Jne(r+i+1)},t.spliceWithArray_=function(r,i,a){var s=this;this.atom_;var o=this.values_.length;if(r===void 0?r=0:r>o?r=o:r<0&&(r=Math.max(0,o+r)),arguments.length===1?i=o-r:i==null?i=0:i=Math.max(0,Math.min(i,o-r)),a===void 0&&(a=VN),Rs(this)){var l=Is(this,{object:this.proxy_,type:iH,index:r,removedCount:i,added:a});if(!l)return VN;i=l.removedCount,a=l.added}if(a=a.length===0?a:a.map(function(d){return s.enhancer_(d,void 0)}),this.legacyMode_){var u=a.length-i;this.updateArrayLength_(o,u)}var f=this.spliceItemsIntoValues_(r,i,a);return(i!==0||a.length!==0)&&this.notifyArraySplice_(r,a,f),this.dehanceValues_(f)},t.spliceItemsIntoValues_=function(r,i,a){if(a.length<nke){var s;return(s=this.values_).splice.apply(s,[r,i].concat(a))}else{var o=this.values_.slice(r,r+i),l=this.values_.slice(r+i);this.values_.length+=a.length-i;for(var u=0;u<a.length;u++)this.values_[r+u]=a[u];for(var f=0;f<l.length;f++)this.values_[r+a.length+f]=l[f];return o}},t.notifyArrayChildUpdate_=function(r,i,a){var s=!this.owned_&&Mb(),o=uo(this),l=o||s?{observableKind:"array",object:this.proxy_,type:Yo,debugObjectName:this.atom_.name_,index:r,newValue:i,oldValue:a}:null;this.atom_.reportChanged(),o&&co(this,l)},t.notifyArraySplice_=function(r,i,a){var s=!this.owned_&&Mb(),o=uo(this),l=o||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:iH,index:r,removed:a,added:i,removedCount:a.length,addedCount:i.length}:null;this.atom_.reportChanged(),o&&co(this,l)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,i){var a=this.values_;if(this.legacyMode_&&r>a.length&&rn(17,r,a.length),r<a.length){this.atom_;var s=a[r];if(Rs(this)){var o=Is(this,{type:Yo,object:this.proxy_,index:r,newValue:i});if(!o)return;i=o.newValue}i=this.enhancer_(i,s);var l=i!==s;l&&(a[r]=i,this.notifyArrayChildUpdate_(r,i,s))}else{for(var u=new Array(r+1-a.length),f=0;f<u.length-1;f++)u[f]=void 0;u[u.length-1]=i,this.spliceWithArray_(a.length,0,u)}},e})();function ike(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),ane(),Vf(function(){var i=new yM(n,t,r,!1);lne(i.values_,Mt,i);var a=new Proxy(i.values_,rke);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var ME={clear:function(){return this.splice(0)},replace:function(t){var n=this[Mt];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a];var s=this[Mt];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(t);case 2:return s.spliceWithArray_(t,n)}return s.spliceWithArray_(t,n,i)},spliceWithArray:function(t,n,r){return this[Mt].spliceWithArray_(t,n,r)},push:function(){for(var t=this[Mt],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[Mt].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[Mt],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return ut.trackingDerivation&&rn(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){ut.trackingDerivation&&rn(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[Mt],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};Jn("at",os);Jn("concat",os);Jn("flat",os);Jn("includes",os);Jn("indexOf",os);Jn("join",os);Jn("lastIndexOf",os);Jn("slice",os);Jn("toString",os);Jn("toLocaleString",os);Jn("toSorted",os);Jn("toSpliced",os);Jn("with",os);Jn("every",Eo);Jn("filter",Eo);Jn("find",Eo);Jn("findIndex",Eo);Jn("findLast",Eo);Jn("findLastIndex",Eo);Jn("flatMap",Eo);Jn("forEach",Eo);Jn("map",Eo);Jn("some",Eo);Jn("toReversed",Eo);Jn("reduce",Kne);Jn("reduceRight",Kne);function Jn(e,t){typeof Array.prototype[e]=="function"&&(ME[e]=t(e))}function os(e){return function(){var t=this[Mt];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Eo(e){return function(t,n){var r=this,i=this[Mt];i.atom_.reportObserved();var a=i.dehanceValues_(i.values_);return a[e](function(s,o){return t.call(n,s,o,r)})}}function Kne(e){return function(){var t=this,n=this[Mt];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(a,s,o){return i(a,s,o,t)},r[e].apply(r,arguments)}}var ake=id("ObservableArrayAdministration",yM);function hl(e){return zx(e)&&ake(e[Mt])}var ske={},yc="add",jE="delete",_M=(function(){function e(n,r,i){var a=this;r===void 0&&(r=Af),i===void 0&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Mt]=ske,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=i,is(Map)||rn(18),Vf(function(){a.keysAtom_=RE("ObservableMap.keys()"),a.data_=new Map,a.hasMap_=new Map,n&&a.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var i=this;if(!ut.trackingDerivation)return this.has_(r);var a=this.hasMap_.get(r);if(!a){var s=a=new Pc(this.has_(r),Gx,"ObservableMap.key?",!1);this.hasMap_.set(r,s),jne(s,function(){return i.hasMap_.delete(r)})}return a.get()},t.set=function(r,i){var a=this.has_(r);if(Rs(this)){var s=Is(this,{type:a?Yo:yc,object:this,newValue:i,name:r});if(!s)return this;i=s.newValue}return a?this.updateValue_(r,i):this.addValue_(r,i),this},t.delete=function(r){var i=this;if(this.keysAtom_,Rs(this)){var a=Is(this,{type:jE,object:this,name:r});if(!a)return!1}if(this.has_(r)){var s=Mb(),o=uo(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:jE,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return Xl(function(){var u;i.keysAtom_.reportChanged(),(u=i.hasMap_.get(r))==null||u.setNewValue_(!1);var f=i.data_.get(r);f.setNewValue_(void 0),i.data_.delete(r)}),o&&co(this,l),!0}return!1},t.updateValue_=function(r,i){var a=this.data_.get(r);if(i=a.prepareNewValue_(i),i!==ut.UNCHANGED){var s=Mb(),o=uo(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:Yo,object:this,oldValue:a.value_,name:r,newValue:i}:null;a.setNewValue_(i),o&&co(this,l)}},t.addValue_=function(r,i){var a=this;this.keysAtom_,Xl(function(){var u,f=new Pc(i,a.enhancer_,"ObservableMap.key",!1);a.data_.set(r,f),i=f.value_,(u=a.hasMap_.get(r))==null||u.setNewValue_(!0),a.keysAtom_.reportChanged()});var s=Mb(),o=uo(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:yc,object:this,name:r,newValue:i}:null;o&&co(this,l)},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,i=this.keys();return aH({next:function(){var s=i.next(),o=s.done,l=s.value;return{done:o,value:o?void 0:r.get(l)}}})},t.entries=function(){var r=this,i=this.keys();return aH({next:function(){var s=i.next(),o=s.done,l=s.value;return{done:o,value:o?void 0:[l,r.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,i){for(var a=rp(this),s;!(s=a()).done;){var o=s.value,l=o[0],u=o[1];r.call(i,u,l,this)}},t.merge=function(r){var i=this;return Vs(r)&&(r=new Map(r)),Xl(function(){qc(r)?SCe(r).forEach(function(a){return i.set(a,r[a])}):Array.isArray(r)?r.forEach(function(a){var s=a[0],o=a[1];return i.set(s,o)}):Om(r)?(ECe(r)||rn(19,r),r.forEach(function(a,s){return i.set(s,a)})):r!=null&&rn(20,r)}),this},t.clear=function(){var r=this;Xl(function(){xne(function(){for(var i=rp(r.keys()),a;!(a=i()).done;){var s=a.value;r.delete(s)}})})},t.replace=function(r){var i=this;return Xl(function(){for(var a=oke(r),s=new Map,o=!1,l=rp(i.data_.keys()),u;!(u=l()).done;){var f=u.value;if(!a.has(f)){var d=i.delete(f);if(d)o=!0;else{var p=i.data_.get(f);s.set(f,p)}}}for(var m=rp(a.entries()),S;!(S=m()).done;){var E=S.value,g=E[0],_=E[1],b=i.data_.has(g);if(i.set(g,_),i.data_.has(g)){var x=i.data_.get(g);s.set(g,x),b||(o=!0)}}if(!o)if(i.data_.size!==s.size)i.keysAtom_.reportChanged();else for(var T=i.data_.keys(),w=s.keys(),C=T.next(),R=w.next();!C.done;){if(C.value!==R.value){i.keysAtom_.reportChanged();break}C=T.next(),R=w.next()}i.data_=s}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,i){return Hy(this,r)},t.intercept_=function(r){return $y(this,r)},Rm(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])})(),Vs=id("ObservableMap",_M);function aH(e){return e[Symbol.toStringTag]="MapIterator",SM(e)}function oke(e){if(Om(e)||Vs(e))return e;if(Array.isArray(e))return new Map(e);if(qc(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return rn(21,e)}var lke={},Yne=(function(){function e(n,r,i){var a=this;r===void 0&&(r=Af),i===void 0&&(i="ObservableSet"),this.name_=void 0,this[Mt]=lke,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=i,is(Set)||rn(22),this.enhancer_=function(s,o){return r(s,o,i)},Vf(function(){a.atom_=RE(a.name_),n&&a.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;Xl(function(){xne(function(){for(var i=rp(r.data_.values()),a;!(a=i()).done;){var s=a.value;r.delete(s)}})})},t.forEach=function(r,i){for(var a=rp(this),s;!(s=a()).done;){var o=s.value;r.call(i,o,o,this)}},t.add=function(r){var i=this;if(this.atom_,Rs(this)){var a=Is(this,{type:yc,object:this,newValue:r});if(!a)return this;r=a.newValue}if(!this.has(r)){Xl(function(){i.data_.add(i.enhancer_(r,void 0)),i.atom_.reportChanged()});var s=!1,o=uo(this),l=o||s?{observableKind:"set",debugObjectName:this.name_,type:yc,object:this,newValue:r}:null;o&&co(this,l)}return this},t.delete=function(r){var i=this;if(Rs(this)){var a=Is(this,{type:jE,object:this,oldValue:r});if(!a)return!1}if(this.has(r)){var s=!1,o=uo(this),l=o||s?{observableKind:"set",debugObjectName:this.name_,type:jE,object:this,oldValue:r}:null;return Xl(function(){i.atom_.reportChanged(),i.data_.delete(r)}),o&&co(this,l),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return sH({next:function(){var a=r.next(),s=a.value,o=a.done;return o?{value:void 0,done:o}:{value:[s,s],done:o}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,i=this.data_.values();return sH({next:function(){var s=i.next(),o=s.value,l=s.done;return l?{value:void 0,done:l}:{value:r.dehanceValue_(o),done:l}}})},t.intersection=function(r){if(Yl(r)&&!na(r))return r.intersection(this);var i=new Set(this);return i.intersection(r)},t.union=function(r){if(Yl(r)&&!na(r))return r.union(this);var i=new Set(this);return i.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(Yl(r)&&!na(r))return r.symmetricDifference(this);var i=new Set(this);return i.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(Yl(r)&&!na(r))return r.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(r)},t.replace=function(r){var i=this;return na(r)&&(r=new Set(r)),Xl(function(){Array.isArray(r)?(i.clear(),r.forEach(function(a){return i.add(a)})):Yl(r)?(i.clear(),r.forEach(function(a){return i.add(a)})):r!=null&&rn("Cannot initialize set from "+r)}),this},t.observe_=function(r,i){return Hy(this,r)},t.intercept_=function(r){return $y(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Rm(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])})(),na=id("ObservableSet",Yne);function sH(e){return e[Symbol.toStringTag]="SetIterator",SM(e)}var oH=Object.create(null),lH="remove",Xne=(function(){function e(n,r,i,a){r===void 0&&(r=new Map),a===void 0&&(a=QCe),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=r,this.name_=i,this.defaultAnnotation_=a,this.keysAtom_=new ad("ObservableObject.keys"),this.isPlainObject_=qc(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,i){var a=this.values_.get(r);if(a instanceof mo)return a.set(i),!0;if(Rs(this)){var s=Is(this,{type:Yo,object:this.proxy_||this.target_,name:r,newValue:i});if(!s)return null;i=s.newValue}if(i=a.prepareNewValue_(i),i!==ut.UNCHANGED){var o=uo(this),l=!1,u=o||l?{type:Yo,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:a.value_,name:r,newValue:i}:null;a.setNewValue_(i),o&&co(this,u)}return!0},t.get_=function(r){return ut.trackingDerivation&&!ru(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,i,a){return a===void 0&&(a=!1),ru(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,i):a?Reflect.set(this.target_,r,i):(this.target_[r]=i,!0):this.extend_(r,{value:i,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,a)},t.has_=function(r){if(!ut.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(r);return i||(i=new Pc(r in this.target_,Gx,"ObservableObject.key?",!1),this.pendingKeys_.set(r,i)),i.get()},t.make_=function(r,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(!(r in this.target_)){var a;if((a=this.target_[Ho])!=null&&a[r])return;rn(1,i.annotationType_,this.name_+"."+r.toString())}for(var s=this.target_;s&&s!==Hx;){var o=OE(s,r);if(o){var l=i.make_(this,r,o,s);if(l===0)return;if(l===1)break}s=Object.getPrototypeOf(s)}cH(this,i,r)}},t.extend_=function(r,i,a,s){if(s===void 0&&(s=!1),a===!0&&(a=this.defaultAnnotation_),a===!1)return this.defineProperty_(r,i,s);var o=a.extend_(this,r,i,s);return o&&cH(this,a,r),o},t.defineProperty_=function(r,i,a){a===void 0&&(a=!1),this.keysAtom_;try{Ea();var s=this.delete_(r);if(!s)return s;if(Rs(this)){var o=Is(this,{object:this.proxy_||this.target_,name:r,type:yc,newValue:i.value});if(!o)return null;var l=o.newValue;i.value!==l&&(i=Kc({},i,{value:l}))}if(a){if(!Reflect.defineProperty(this.target_,r,i))return!1}else qo(this.target_,r,i);this.notifyPropertyAddition_(r,i.value)}finally{Sa()}return!0},t.defineObservableProperty_=function(r,i,a,s){s===void 0&&(s=!1),this.keysAtom_;try{Ea();var o=this.delete_(r);if(!o)return o;if(Rs(this)){var l=Is(this,{object:this.proxy_||this.target_,name:r,type:yc,newValue:i});if(!l)return null;i=l.newValue}var u=uH(r),f={configurable:ut.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(s){if(!Reflect.defineProperty(this.target_,r,f))return!1}else qo(this.target_,r,f);var d=new Pc(i,a,"ObservableObject.key",!1);this.values_.set(r,d),this.notifyPropertyAddition_(r,d.value_)}finally{Sa()}return!0},t.defineComputedProperty_=function(r,i,a){a===void 0&&(a=!1),this.keysAtom_;try{Ea();var s=this.delete_(r);if(!s)return s;if(Rs(this)){var o=Is(this,{object:this.proxy_||this.target_,name:r,type:yc,newValue:void 0});if(!o)return null}i.name||(i.name="ObservableObject.key"),i.context=this.proxy_||this.target_;var l=uH(r),u={configurable:ut.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(a){if(!Reflect.defineProperty(this.target_,r,u))return!1}else qo(this.target_,r,u);this.values_.set(r,new mo(i)),this.notifyPropertyAddition_(r,void 0)}finally{Sa()}return!0},t.delete_=function(r,i){if(i===void 0&&(i=!1),this.keysAtom_,!ru(this.target_,r))return!0;if(Rs(this)){var a=Is(this,{object:this.proxy_||this.target_,name:r,type:lH});if(!a)return null}try{var s;Ea();var o=uo(this),l=!1,u=this.values_.get(r),f=void 0;if(!u&&(o||l)){var d;f=(d=OE(this.target_,r))==null?void 0:d.value}if(i){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(u&&(this.values_.delete(r),u instanceof Pc&&(f=u.value_),One(u)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(r in this.target_),o||l){var p={type:lH,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:f,name:r};o&&co(this,p)}}finally{Sa()}return!0},t.observe_=function(r,i){return Hy(this,r)},t.intercept_=function(r){return $y(this,r)},t.notifyPropertyAddition_=function(r,i){var a,s=uo(this),o=!1;if(s||o){var l=s||o?{type:yc,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:i}:null;s&&co(this,l)}(a=this.pendingKeys_)==null||(a=a.get(r))==null||a.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Wx(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e})();function Nm(e,t){var n;if(ru(e,Mt))return e;var r=(n=t?.name)!=null?n:"ObservableObject",i=new Xne(e,new Map,String(r),uAe(t));return Vx(e,Mt,i),e}var uke=id("ObservableObjectAdministration",Xne);function uH(e){return oH[e]||(oH[e]={get:function(){return this[Mt].getObservablePropValue_(e)},set:function(n){return this[Mt].setObservablePropValue_(e,n)}})}function So(e){return zx(e)?uke(e[Mt]):!1}function cH(e,t,n){var r;(r=e.target_[Ho])==null||delete r[n]}var cke=Qne(0),dke=(function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1})(),JA=0,Zne=function(){};function fke(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}fke(Zne,Array.prototype);var EM=(function(e){function t(r,i,a,s){var o;return a===void 0&&(a="ObservableArray"),s===void 0&&(s=!1),o=e.call(this)||this,Vf(function(){var l=new yM(a,i,s,!0);l.proxy_=o,lne(o,Mt,l),r&&r.length&&o.spliceWithArray(0,0,r),dke&&Object.defineProperty(o,"0",cke)}),o}dne(t,e);var n=t.prototype;return n.concat=function(){this[Mt].atom_.reportObserved();for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];return Array.prototype.concat.apply(this.slice(),a.map(function(o){return hl(o)?o.slice():o}))},n[Symbol.iterator]=function(){var r=this,i=0;return SM({next:function(){return i<r.length?{value:r[i++],done:!1}:{done:!0,value:void 0}}})},Rm(t,[{key:"length",get:function(){return this[Mt].getArrayLength_()},set:function(i){this[Mt].setArrayLength_(i)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])})(Zne);Object.entries(ME).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&Vx(EM.prototype,t,n)});function Qne(e){return{enumerable:!1,configurable:!0,get:function(){return this[Mt].get_(e)},set:function(n){this[Mt].set_(e,n)}}}function hke(e){qo(EM.prototype,""+e,Qne(e))}function Jne(e){if(e>JA){for(var t=JA;t<e+100;t++)hke(t);JA=e}}Jne(1e3);function pke(e,t,n){return new EM(e,t,n)}function Fp(e,t){if(typeof e=="object"&&e!==null){if(hl(e))return t!==void 0&&rn(23),e[Mt].atom_;if(na(e))return e.atom_;if(Vs(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||rn(25,t,JN(e)),n}if(So(e)){if(!t)return rn(26);var r=e[Mt].values_.get(t);return r||rn(27,t,JN(e)),r}if(pM(e)||Xx(e)||LE(e))return e}else if(is(e)&&LE(e[Mt]))return e[Mt];rn(28)}function al(e,t){if(e||rn(29),t!==void 0)return al(Fp(e,t));if(pM(e)||Xx(e)||LE(e)||Vs(e)||na(e))return e;if(e[Mt])return e[Mt];rn(24,e)}function JN(e,t){var n;if(t!==void 0)n=Fp(e,t);else{if(Mp(e))return e.name;So(e)||Vs(e)||na(e)?n=al(e):n=Fp(e)}return n.name_}function Vf(e){var t=zf(),n=Kx(!0);Ea();try{return e()}finally{Sa(),Yx(n),iu(t)}}var dH=Hx.toString;function ere(e,t,n){return n===void 0&&(n=-1),eD(e,t,n)}function eD(e,t,n,r,i){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var a=typeof e;if(a!=="function"&&a!=="object"&&typeof t!="object")return!1;var s=dH.call(e);if(s!==dH.call(t))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=fH(e),t=fH(t);var o=s==="[object Array]";if(!o){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(is(l)&&l instanceof l&&is(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],i=i||[];for(var f=r.length;f--;)if(r[f]===e)return i[f]===t;if(r.push(e),i.push(t),o){if(f=e.length,f!==t.length)return!1;for(;f--;)if(!eD(e[f],t[f],n-1,r,i))return!1}else{var d=Object.keys(e),p=d.length;if(Object.keys(t).length!==p)return!1;for(var m=0;m<p;m++){var S=d[m];if(!(ru(t,S)&&eD(e[S],t[S],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function fH(e){return hl(e)?e.slice():Om(e)||Vs(e)||Yl(e)||na(e)?Array.from(e.entries()):e}var hH,mke=((hH=$x().Iterator)==null?void 0:hH.prototype)||{};function SM(e){return e[Symbol.iterator]=gke,Object.assign(Object.create(mke),e)}function gke(){return this}["Symbol","Map","Set"].forEach(function(e){var t=$x();typeof t[e]>"u"&&rn("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:kAe,extras:{getDebugName:JN},$mobx:Mt});if(!k.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!qne)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function bke(e){e()}function vke(e){e||(e=bke),$Ae({reactionScheduler:e})}function yke(e){return zAe(e)}var _ke=1e4,Eke=1e4,Ske=(function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=_ke),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var i=Date.now();n.registrations.forEach(function(a,s){i-a.registeredAt>=r&&(n.finalize(a.value),n.registrations.delete(s))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){this.registrations.set(r,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,Eke))}}),e})(),xke=typeof FinalizationRegistry<"u"?FinalizationRegistry:Ske,tD=new xke(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null});function pH(e){e.reaction=new il("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function wke(e,t){t===void 0&&(t="observed");var n=oe.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(o){return tD.unregister(r),r.onStoreChange=o,r.reaction||(pH(r),r.stateVersion=Symbol()),function(){var l;r.onStoreChange=null,(l=r.reaction)===null||l===void 0||l.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var i=n.current;i.reaction||(pH(i),tD.register(n,i,i)),oe.useDebugValue(i.reaction,yke),bP.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot);var a,s;if(i.reaction.track(function(){try{a=e()}catch(o){s=o}}),s)throw s;return a}var ek,tk,tre=typeof Symbol=="function"&&Symbol.for,Tke=(tk=(ek=Object.getOwnPropertyDescriptor(function(){},"name"))===null||ek===void 0?void 0:ek.configurable)!==null&&tk!==void 0?tk:!1,mH=tre?Symbol.for("react.forward_ref"):typeof k.forwardRef=="function"&&k.forwardRef(function(e){return null}).$$typeof,gH=tre?Symbol.for("react.memo"):typeof k.memo=="function"&&k.memo(function(e){return null}).$$typeof;function xM(e,t){var n;if(gH&&e.$$typeof===gH)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=(n=void 0)!==null&&n!==void 0?n:!1,i=e,a=e.displayName||e.name;if(mH&&e.$$typeof===mH&&(r=!0,i=e.render,typeof i!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var s=function(o,l){return wke(function(){return i(o,l)},a)};return s.displayName=e.displayName,Tke&&Object.defineProperty(s,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(s.contextTypes=e.contextTypes),r&&(s=k.forwardRef(s)),s=k.memo(s),Ake(e,s),s}var Cke={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function Ake(e,t){Object.keys(e).forEach(function(n){Cke[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var nk;vke(Nr.unstable_batchedUpdates);nk=tD.finalizeAllImmediately;function Wn(e,t="Assertion error"){if(!e)throw Error(t)}function Bp({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 nD(e,t){return t.sort(e==="horizontal"?kke:Oke)}function kke(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function Oke(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function nre(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 Rke({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,a=Number.MAX_VALUE;for(const s of t){const{x:o,y:l}=nre(r,s),u=e==="horizontal"?o:l;u<a&&(a=u,i=s)}return Wn(i,"No rect found"),i}function rre(e){const{element:t,orientation:n,panels:r,separators:i}=e,a=nD(n,Array.from(t.children).filter(f=>f instanceof HTMLElement).map(f=>({element:f}))).map(({element:f})=>f),s=[];let o=!1,l,u=[];for(const f of a)if(f.hasAttribute("data-panel")){const d=r.find(p=>p.element===f);if(d){if(l){const p=l.element.getBoundingClientRect(),m=f.getBoundingClientRect();let S;if(o){const E=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(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(u.length){case 0:{S=[E,g];break}case 1:{const _=u[0],b=Rke({orientation:n,rects:[p,m],targetRect:_.element.getBoundingClientRect()});S=[_,b===p?g:E];break}default:{S=u;break}}}else u.length?S=u:S=[n==="horizontal"?new DOMRect(p.right,m.top,m.left-p.right,m.height):new DOMRect(m.left,p.bottom,m.width,m.top-p.bottom)];for(const E of S)s.push({group:e,groupSize:Bp({group:e}),panels:[l,d],separator:"width"in E?void 0:E,rect:"width"in E?E:E.element.getBoundingClientRect()})}o=!1,l=d,u=[]}}else if(f.hasAttribute("data-separator")){const d=i.find(p=>p.element===f);d?u.push(d):(l=void 0,u=[])}else o=!0;return s}function Ike(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function Nke(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function Dke(e){return e/100*window.innerHeight}function Lke(e){return e/100*window.innerWidth}function Pke(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 o_({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,a]=Pke(n);switch(a){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=Nke(t,i);break}case"em":{r=Ike(t,i);break}case"vh":{r=Dke(i);break}case"vw":{r=Lke(i);break}}return r}function ao(e){return parseFloat(e.toFixed(3))}function bH(e){const{panels:t}=e,n=Bp({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:a}=r;let s=0;if(a.collapsedSize){const f=o_({groupSize:n,panelElement:i,styleProp:a.collapsedSize});s=ao(f/n*100)}let o;if(a.defaultSize){const f=o_({groupSize:n,panelElement:i,styleProp:a.defaultSize});o=ao(f/n*100)}let l=0;if(a.minSize){const f=o_({groupSize:n,panelElement:i,styleProp:a.minSize});l=ao(f/n*100)}let u=100;if(a.maxSize){const f=o_({groupSize:n,panelElement:i,styleProp:a.maxSize});u=ao(f/n*100)}return{collapsedSize:s,collapsible:a.collapsible===!0,defaultSize:o,minSize:l,maxSize:u,panelId:r.id}})}class Mke{#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,a=null;const s=Array.from(r);for(let o=0;o<s.length;o++){const l=s[o];try{l.call(null,n)}catch(u){a===null&&(i=!0,a=u)}}if(i)throw a}}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 Ki(e,t,n=0){return Math.abs(ao(e)-ao(t))<=n}let xs={cursorFlags:0,interactionState:{state:"inactive"},mountedGroups:new Map};const of=new Mke;function pl(){return xs}function Ms(e){const t=typeof e=="function"?e(xs):e;if(xs===t)return xs;const n=xs;return xs={...xs,...t},t.cursorFlags!==void 0&&of.emit("cursorFlagsChange",xs.cursorFlags),t.interactionState!==void 0&&of.emit("interactionStateChange",xs.interactionState),t.mountedGroups!==void 0&&(xs.mountedGroups.forEach((r,i)=>{r.derivedPanelConstraints.forEach(a=>{if(a.collapsible){const{layout:s}=n.mountedGroups.get(i)??{};if(s){const o=Ki(a.collapsedSize,r.layout[a.panelId]),l=Ki(a.collapsedSize,s[a.panelId]);o&&!l&&(i.inMemoryLastExpandedPanelSizes[a.panelId]=s[a.panelId])}}})}),of.emit("mountedGroupsChange",xs.mountedGroups)),xs}const jke=e=>e,rk=()=>{},ire=1,are=2,sre=4,ore=8,vH={coarse:10,precise:5};function Fke({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(a=>{if(!a.disableCursor)switch(a.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(r===0&&i===0)return null;switch(n){case"active":{const a=(e&ire)!==0,s=(e&are)!==0,o=(e&sre)!==0,l=(e&ore)!==0;if(e){if(a)return o?"se-resize":l?"ne-resize":"e-resize";if(s)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 ik,Do;function wM(){Do===void 0&&(Do=new CSSStyleSheet,document.adoptedStyleSheets=[Do]);const{cursorFlags:e,interactionState:t}=pl();switch(t.state){case"active":case"hover":{const n=Fke({cursorFlags:e,groups:t.hitRegions.map(i=>i.group),state:t.state}),r=`*{cursor: ${n} !important; ${t.state==="active"?"touch-action: none;":""} }`;if(ik===r)return;ik=r,n?Do.cssRules.length===0?Do.insertRule(r):Do.replaceSync(r):Do.cssRules.length===1&&Do.deleteRule(0);break}case"inactive":{ik=void 0,Do.cssRules.length===1&&Do.deleteRule(0);break}}}function Bke(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 mv(e,t){return Ki(e,t)?0:e>t?1:-1}function ip({panelConstraints:e,size:t}){const{collapsedSize:n=0,collapsible:r,maxSize:i=100,minSize:a=0}=e;if(mv(t,a)<0)if(r){const s=(n+a)/2;mv(t,s)<0?t=n:t=a}else t=a;return t=Math.min(i,t),t=ao(t),t}function gv({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Ki(e,0))return t;const s=Object.values(t),o=Object.values(i),l=[...s],[u,f]=r;Wn(u!=null,"Invalid first pivot index"),Wn(f!=null,"Invalid second pivot index");let d=0;if(a==="keyboard"){{const S=e<0?f:u,E=n[S];Wn(E,`Panel constraints not found for index ${S}`);const{collapsedSize:g=0,collapsible:_,minSize:b=0}=E;if(_){const x=s[S];if(Wn(x!=null,`Previous layout not found for panel index ${S}`),Ki(x,g)){const T=b-x;mv(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}{const S=e<0?u:f,E=n[S];Wn(E,`No panel constraints found for index ${S}`);const{collapsedSize:g=0,collapsible:_,minSize:b=0}=E;if(_){const x=s[S];if(Wn(x!=null,`Previous layout not found for panel index ${S}`),Ki(x,b)){const T=x-g;mv(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}}{const S=e<0?1:-1;let E=e<0?f:u,g=0;for(;;){const b=s[E];Wn(b!=null,`Previous layout not found for panel index ${E}`);const x=ip({panelConstraints:n[E],size:100})-b;if(g+=x,E+=S,E<0||E>=n.length)break}const _=Math.min(Math.abs(e),Math.abs(g));e=e<0?0-_:_}{let S=e<0?u:f;for(;S>=0&&S<n.length;){const E=Math.abs(e)-Math.abs(d),g=s[S];Wn(g!=null,`Previous layout not found for panel index ${S}`);const _=g-E,b=ip({panelConstraints:n[S],size:_});if(!Ki(g,b)&&(d+=g-b,l[S]=b,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?S--:S++}}if(Bke(o,l))return i;{const S=e<0?f:u,E=s[S];Wn(E!=null,`Previous layout not found for panel index ${S}`);const g=E+d,_=ip({panelConstraints:n[S],size:g});if(l[S]=_,!Ki(_,g)){let b=g-_,x=e<0?f:u;for(;x>=0&&x<n.length;){const T=l[x];Wn(T!=null,`Previous layout not found for panel index ${x}`);const w=T+b,C=ip({panelConstraints:n[x],size:w});if(Ki(T,C)||(b-=C-T,l[x]=C),Ki(b,0))break;e>0?x--:x++}}}const p=Object.values(l).reduce((S,E)=>E+S,0);if(!Ki(p,100,.1))return i;const m=Object.keys(i);return l.reduce((S,E,g)=>(S[m[g]]=E,S),{})}function Dm(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||mv(e[n],t[n])!==0)return!1;return!0}function lre({event:e,hitRegions:t,initialLayoutMap:n,mountedGroups:r,pointerDownAtPoint:i}){let a=0;const s=new Map(r);t.forEach(o=>{const{group:l,groupSize:u}=o,{disableCursor:f,orientation:d,panels:p}=l;let m=0;i?d==="horizontal"?m=(e.clientX-i.x)/u*100:m=(e.clientY-i.y)/u*100:d==="horizontal"?m=e.clientX<0?-100:100:m=e.clientY<0?-100:100;const S=n.get(l),{defaultLayoutDeferred:E,derivedPanelConstraints:g,layout:_,separatorToPanels:b}=r.get(l)??{defaultLayoutDeferred:!1};if(g&&S&&_&&b){const x=gv({delta:m,initialLayout:S,panelConstraints:g,pivotIndices:o.panels.map(T=>p.indexOf(T)),prevLayout:_,trigger:"mouse-or-touch"});if(Dm(x,_)){if(m!==0&&!f)switch(d){case"horizontal":{a|=m<0?ire:are;break}case"vertical":{a|=m<0?sre:ore;break}}}else{s.set(o.group,{defaultLayoutDeferred:E,derivedPanelConstraints:g,layout:x,separatorToPanels:b});const T=o.group.panels.map(({id:w})=>w).join(",");o.group.inMemoryLayouts[T]=x}}}),Ms({cursorFlags:a,mountedGroups:s}),wM()}function yH(e){if(e.defaultPrevented||e.relatedTarget!==null||e.clientX===0&&e.clientY===0)return;const{interactionState:t,mountedGroups:n}=pl();t.state==="active"&&t.hitRegions.forEach(r=>{e.currentTarget===r.group.element&&lre({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n})})}function G_(e){const t=e.parentElement;Wn(t,"Parent group element not found");const{mountedGroups:n}=pl();for(const[r]of n)if(r.element===t)return r;throw Error("Could not find parent Group for separator element")}function kf({layout:e,panelConstraints:t}){const n=[...Object.values(e)],r=n.reduce((s,o)=>s+o,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!Ki(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=100/r*o;n[s]=l}let i=0;for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=ip({panelConstraints:t[s],size:o});o!=l&&(i+=o-l,n[s]=l)}if(!Ki(i,0))for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=o+i,u=ip({panelConstraints:t[s],size:l});if(o!==u&&(i-=u-o,n[s]=u,Ki(i,0)))break}const a=Object.keys(e);return n.reduce((s,o,l)=>(s[a[l]]=o,s),{})}function ure({groupId:e}){const t=()=>{const{mountedGroups:n}=pl();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:a,layout:s,separatorToPanels:o}=t(),l=kf({layout:n,panelConstraints:i});return r?s:(Dm(s,l)||Ms(u=>({mountedGroups:new Map(u.mountedGroups).set(a,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:l,separatorToPanels:o})})),l)}}}function cre(e){const{mountedGroups:t}=pl(),n=t.get(e);return Wn(n,`Mounted Group ${e.id} not found`),n}function Id(e,t){const n=G_(e),r=cre(n),i=n.separators.find(f=>f.element===e);Wn(i,"Matching separator not found");const a=r.separatorToPanels.get(i);Wn(a,"Matching panels not found");const s=a.map(f=>n.panels.indexOf(f)),o=ure({groupId:n.id}).getLayout(),l=gv({delta:t,initialLayout:o,panelConstraints:r.derivedPanelConstraints,pivotIndices:s,prevLayout:o,trigger:"keyboard"}),u=kf({layout:l,panelConstraints:r.derivedPanelConstraints});Dm(o,u)||Ms(f=>({mountedGroups:new Map(f.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:u,separatorToPanels:r.separatorToPanels})}))}function _H(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=G_(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Id(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Id(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Id(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Id(t,-5);break}case"End":{e.preventDefault(),Id(t,100);break}case"Enter":{e.preventDefault();const r=G_(t),{derivedPanelConstraints:i,layout:a,separatorToPanels:s}=cre(r),o=r.separators.find(d=>d.element===t);Wn(o,"Matching separator not found");const l=s.get(o);Wn(l,"Matching panels not found");const u=l[0],f=i.find(d=>d.panelId===u.id);if(Wn(f,"Panel metadata not found"),f.collapsible){const d=a[u.id],p=f.collapsedSize===d?r.inMemoryLastExpandedPanelSizes[u.id]??f.minSize:f.collapsedSize;Id(t,p-d)}break}case"F6":{e.preventDefault();const r=G_(t).separators.map(s=>s.element),i=Array.from(r).findIndex(s=>s===e.currentTarget);Wn(i!==null,"Index not found");const a=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[a].focus();break}case"Home":{e.preventDefault(),Id(t,-100);break}}}function Uke(e,t,n){let r,i={x:1/0,y:1/0};for(const a of t){const s=nre(n,a.rect);switch(e){case"horizontal":{s.x<=i.x&&(r=a,i=s);break}case"vertical":{s.y<=i.y&&(r=a,i=s);break}}}return r?{distance:i,hitRegion:r}:void 0}let l_;function $ke(){return l_===void 0&&(typeof matchMedia=="function"?l_=!!matchMedia("(pointer:coarse)").matches:l_=!1),l_}function Hke(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:xH(e),b:xH(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Wn(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:SH(EH(n.a)),b:SH(EH(n.b))};if(i.a===i.b){const a=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let o=a.length;for(;o--;){const l=a[o];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(i.a-i.b)}const zke=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Vke(e){const t=getComputedStyle(dre(e)??e).display;return t==="flex"||t==="inline-flex"}function Wke(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Vke(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"||zke.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function EH(e){let t=e.length;for(;t--;){const n=e[t];if(Wn(n,"Missing node"),Wke(n))return n}return null}function SH(e){return e&&Number(getComputedStyle(e).zIndex)||0}function xH(e){const t=[];for(;e;)t.push(e),e=dre(e);return t}function dre(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}function Gke(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 qke({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!(n instanceof HTMLElement)||n.contains(e)||e.contains(n))return!0;if(Hke(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Gke(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function fre(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const a=$ke()?vH.coarse:vH.precise,s=rre(i),o=Uke(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=a&&o.distance.y<=a&&qke({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function wH(e){if(e.defaultPrevented)return;const{mountedGroups:t}=pl(),n=fre(e,t),r=new Set,i=new Set,a=new Set,s=new Map;let o=!1;n.forEach(l=>{r.add(l.group),l.panels.forEach(f=>{i.add(f)}),l.separator&&(a.add(l.separator),o||(o=!0,l.separator.element.focus()));const u=t.get(l.group);u&&s.set(l.group,u.layout)}),Ms({interactionState:{hitRegions:n,initialLayoutMap:s,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}}),n.length&&e.preventDefault()}function TH(e){if(e.defaultPrevented)return;const{interactionState:t,mountedGroups:n}=pl();switch(t.state){case"active":{if(e.type!=="pointerleave"&&e.buttons===0){Ms(r=>r.interactionState.state==="inactive"?r:{cursorFlags:0,interactionState:{state:"inactive"}});return}lre({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint});break}default:{const r=fre(e,n);r.length===0?t.state!=="inactive"&&Ms({interactionState:{state:"inactive"}}):Ms({interactionState:{hitRegions:r,state:"hover"}}),wM();break}}}function CH(e){if(e.defaultPrevented)return;e.preventDefault();const{interactionState:t}=pl();t.state==="active"&&(Ms({cursorFlags:0,interactionState:{state:"inactive"}}),wM())}function AH(e){let t=0,n=0;const r={};for(const a of e)if(a.defaultSize!==void 0){t++;const s=ao(a.defaultSize);n+=s,r[a.panelId]=s}else r[a.panelId]=void 0;const i=e.length-t;if(i!==0){const a=ao((100-n)/i);for(const s of e)s.defaultSize===void 0&&(r[s.panelId]=a)}return r}function Kke(e,t,n){const r=n[0];if(!r)return;const i=e.panels.find(s=>s.element===t);if(!i||!i.onResize)return;const a=Bp({group:e});i.onResize({asPercentage:ao(r.inlineSize/a*100),inPixels:r.inlineSize},i.id)}function Yke(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 Xke(e){let t=!0;const n=new Set,r=new Set,i=new ResizeObserver(m=>{for(const S of m){const{borderBoxSize:E,target:g}=S;if(g===e.element){if(t){if(Bp({group:e})===0)return;Ms(_=>{const b=_.mountedGroups.get(e);if(b){const x=bH(e),T=b.defaultLayoutDeferred?AH(x):b.layout,w=kf({layout:T,panelConstraints:x});return!b.defaultLayoutDeferred&&Dm(T,w)&&Yke(b.derivedPanelConstraints,x)?_:{mountedGroups:new Map(_.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:x,layout:w,separatorToPanels:b.separatorToPanels})}}return _})}}else Kke(e,g,E)}});i.observe(e.element),e.panels.forEach(m=>{Wn(!n.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),n.add(m.id),m.onResize&&i.observe(m.element)});const a=Bp({group:e}),s=bH(e),o=e.panels.map(({id:m})=>m).join(",");let l=e.defaultLayout;l&&e.panels.length!==Object.keys(l).length&&(l=void 0);const u=e.inMemoryLayouts[o]??l??AH(s),f=kf({layout:u,panelConstraints:s}),d=rre(e),p=Ms(m=>{const S=new Map;return d.forEach(E=>{E.separator&&S.set(E.separator,E.panels)}),{mountedGroups:new Map(m.mountedGroups).set(e,{defaultLayoutDeferred:a===0,derivedPanelConstraints:s,layout:f,separatorToPanels:S})}});return e.element.addEventListener("pointerleave",yH),e.separators.forEach(m=>{Wn(!r.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.element.addEventListener("keydown",_H)}),p.mountedGroups.size===1&&(window.addEventListener("pointerdown",wH),window.addEventListener("pointermove",TH),window.addEventListener("pointerup",CH)),function(){t=!1;const m=Ms(S=>{const E=new Map(S.mountedGroups);return E.delete(e),{mountedGroups:E}});e.element.removeEventListener("pointerleave",yH),e.separators.forEach(S=>{S.element.removeEventListener("keydown",_H)}),m.mountedGroups.size===0&&(window.removeEventListener("pointerdown",wH),window.removeEventListener("pointermove",TH),window.removeEventListener("pointerup",CH)),i.disconnect()}}function TM(e){const t=k.useId();return`${e??t}`}const Wf=typeof window<"u"?k.useLayoutEffect:k.useEffect;function CM(e){const t=k.useRef(e);return Wf(()=>{t.current=e},[e]),k.useCallback(n=>t.current?.(n),[t])}function AM(...e){return CM(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function Zke(e){const t=k.useRef({...e});return Wf(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const hre="--react-resizable-panels--panel--pointer-events";function pre(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 mre=k.createContext(null);function Qke(e,t){const n=k.useRef({getLayout:()=>({}),setLayout:jke});k.useImperativeHandle(t,()=>n.current,[]),Wf(()=>{Object.assign(n.current,ure({groupId:e}))})}function Jke({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:s,id:o,onLayoutChange:l,orientation:u="horizontal",style:f,...d}){const p=k.useRef({}),m=CM(V=>{Dm(p.current,V)||(p.current=V,l?.(V))}),S=TM(o),[E,g]=k.useState(!1),[_,b]=k.useState(null),[x,T]=k.useState(n??{}),[w,C]=k.useState([]),[R,O]=k.useState([]),I=k.useRef({lastExpandedPanelSizes:{},layouts:{}}),D=AM(b,a);Qke(S,s);const P=k.useMemo(()=>({id:S,orientation:u,registerPanel:V=>(C($=>nD(u,[...$,V])),()=>{C($=>$.filter(q=>q!==V))}),registerSeparator:V=>(O($=>nD(u,[...$,V])),()=>{O($=>$.filter(q=>q!==V))})}),[S,u]),H=Zke({defaultLayout:n,disableCursor:r}),M=k.useRef(null);Wf(()=>{if(_===null)return;const V={defaultLayout:H.defaultLayout,disableCursor:!!H.disableCursor,disabled:!!i,element:_,id:S,inMemoryLastExpandedPanelSizes:I.current.lastExpandedPanelSizes,inMemoryLayouts:I.current.layouts,orientation:u,panels:w,separators:R};M.current=V;const $=Xke(V),q=pl().mountedGroups.get(V);if(q){const{defaultLayoutDeferred:F,derivedPanelConstraints:B,layout:Y}=q;!F&&B.length>0&&(T(Y),m?.(Y))}const K=of.addListener("interactionStateChange",F=>{F.state==="active"?g(F.hitRegions.some(B=>B.group===V)):g(!1)}),U=of.addListener("mountedGroupsChange",F=>{const B=F.get(V);if(B){const{defaultLayoutDeferred:Y,derivedPanelConstraints:z,layout:J}=B;if(Y||z.length===0)return;T(J),m?.(J)}});return()=>{M.current=null,$(),K(),U()}},[i,_,S,m,u,w,R,H]),k.useEffect(()=>{const V=M.current;V&&(V.defaultLayout=n,V.disableCursor=!!r)});const W={[hre]:E?"none":void 0};for(const V in x){const $=pre(S,V),q=x[V];W[$]=q}return y.jsx(mre.Provider,{value:P,children:y.jsx("div",{...d,"aria-orientation":u,className:t,"data-group":!0,"data-testid":S,id:S,ref:D,style:{...f,...W,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap"},children:e})})}function kM(){const e=k.useContext(mre);return Wn(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function eOe({groupId:e,panelId:t}){const n=()=>{const{mountedGroups:o}=pl();for(const[l,{defaultLayoutDeferred:u,derivedPanelConstraints:f,layout:d,separatorToPanels:p}]of o)if(l.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:f,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}`)},a=()=>{const o=n().layout[t];if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},s=o=>{const l=a();if(o===l)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:f,group:d,layout:p,separatorToPanels:m}=n(),S=d.panels.findIndex(b=>b.id===t),E=S===d.panels.length-1,g=gv({delta:E?l-o:o-l,initialLayout:p,panelConstraints:f,pivotIndices:E?[S-1,S]:[S,S+1],prevLayout:p,trigger:"imperative-api"}),_=kf({layout:g,panelConstraints:f});Dm(p,_)||Ms(b=>({mountedGroups:new Map(b.mountedGroups).set(d,{defaultLayoutDeferred:u,derivedPanelConstraints:f,layout:_,separatorToPanels:m})}))};return{collapse:()=>{const{collapsible:o,collapsedSize:l}=r(),u=a();o&&u!==l&&s(l)},expand:()=>{const{collapsible:o,collapsedSize:l,minSize:u}=r(),f=a();o&&f===l&&s(u)},getSize:()=>{const{group:o}=n(),l=a(),{element:u}=i(),f=o.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:l,inPixels:f}},isCollapsed:()=>{const{collapsible:o,collapsedSize:l}=r(),u=a();return o&&Ki(l,u)},resize:o=>{if(a()!==o){let l;switch(typeof o){case"number":{const{group:u}=n(),f=Bp({group:u});l=ao(o/f*100);break}case"string":{l=parseFloat(o);break}}s(l)}}}}function tOe(e,t){const{id:n}=kM(),r=k.useRef({collapse:rk,expand:rk,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:rk});k.useImperativeHandle(t,()=>r.current,[]),Wf(()=>{Object.assign(r.current,eOe({groupId:n,panelId:e}))})}function nOe({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,elementRef:a,id:s,maxSize:o="100%",minSize:l="0%",onResize:u,panelRef:f,style:d,...p}){const m=!!s,S=TM(s),[E,g]=k.useState(null),_=AM(g,a),{id:b,registerPanel:x}=kM(),T=u!==null,w=CM(R=>{u?.(R,s)});Wf(()=>{if(E!==null)return x({element:E,id:S,idIsStable:m,onResize:T?w:void 0,panelConstraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:o,minSize:l}})},[n,r,i,E,T,S,m,o,l,w,x]),tOe(S,f);const C=pre(b,S);return y.jsx("div",{...p,"data-panel":!0,"data-testid":S,id:S,ref:_,style:{...rOe,flexBasis:0,flexGrow:`var(${C}, 1)`,flexShrink:1,overflow:"hidden",pointerEvents:`var(${hre})`},children:y.jsx("div",{className:t,style:{width:"100%",height:"100%",...d},children:e})})}const rOe={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 iOe({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a;const s=e[n],o=t.find(l=>l.panelId===n);if(o){const l=o.maxSize,u=a=o.collapsible?o.collapsedSize:o.minSize,f=[r,r+1];a=kf({layout:gv({delta:u-s,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n],i=kf({layout:gv({delta:l-s,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:s}}function aOe({children:e,className:t,elementRef:n,id:r,style:i,...a}){const s=TM(r),[o,l]=k.useState({}),[u,f]=k.useState("inactive"),[d,p]=k.useState(null),m=AM(p,n),{id:S,orientation:E,registerSeparator:g}=kM(),_=E==="horizontal"?"vertical":"horizontal";return Wf(()=>{if(d!==null){const b={element:d,id:s},x=g(b),T=of.addListener("interactionStateChange",C=>{f(C.state!=="inactive"&&C.hitRegions.some(R=>R.separator===b)?C.state:"inactive")}),w=of.addListener("mountedGroupsChange",C=>{C.forEach(({derivedPanelConstraints:R,layout:O,separatorToPanels:I},D)=>{if(D.id===S){const P=I.get(b);if(P){const H=P[0],M=D.panels.indexOf(H);l(iOe({layout:O,panelConstraints:R,panelId:H.id,panelIndex:M}))}}})});return()=>{T(),w(),x()}}},[d,S,s,g]),y.jsx("div",{...a,"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":s,id:s,ref:m,role:"separator",style:{flexBasis:"auto",...i,flexGrow:0,flexShrink:0},tabIndex:0})}function Zh({className:e,direction:t,...n}){return y.jsx(Jke,{"data-slot":"resizable-panel-group",orientation:t,className:We("flex h-full w-full data-[orientation=vertical]:flex-col",e),...n})}function Mo({...e}){return y.jsx(nOe,{"data-slot":"resizable-panel",...e})}function Qh({withHandle:e,className:t,...n}){return y.jsx(aOe,{"data-slot":"resizable-handle",className:We("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&&y.jsx("div",{className:"bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"})})}var ak={exports:{}},kH;function sOe(){return kH||(kH=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(s,o,l){var u=this&&this.__decorate||function(b,x,T,w){var C,R=arguments.length,O=R<3?x:w===null?w=Object.getOwnPropertyDescriptor(x,T):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(b,x,T,w);else for(var I=b.length-1;I>=0;I--)(C=b[I])&&(O=(R<3?C(O):R>3?C(x,T,O):C(x,T))||O);return R>3&&O&&Object.defineProperty(x,T,O),O},f=this&&this.__param||function(b,x){return function(T,w){x(T,w,b)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=l(9042),p=l(9924),m=l(844),S=l(4725),E=l(2585),g=l(3656);let _=o.AccessibilityManager=class extends m.Disposable{constructor(b,x,T,w){super(),this._terminal=b,this._coreBrowserService=T,this._renderService=w,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 C=0;C<this._terminal.rows;C++)this._rowElements[C]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[C]);if(this._topBoundaryFocusListener=C=>this._handleBoundaryFocus(C,0),this._bottomBoundaryFocusListener=C=>this._handleBoundaryFocus(C,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((C=>this._handleResize(C.rows)))),this.register(this._terminal.onRender((C=>this._refreshRows(C.start,C.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((C=>this._handleChar(C)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
|
|
28
28
|
`)))),this.register(this._terminal.onA11yTab((C=>this._handleTab(C)))),this.register(this._terminal.onKey((C=>this._handleKey(C.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,m.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(b){for(let x=0;x<b;x++)this._handleChar(" ")}_handleChar(b){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==b&&(this._charsToAnnounce+=b):this._charsToAnnounce+=b,b===`
|