vibora 3.0.2 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,12 +18,12 @@ Error generating stack: `+C.message+`
18
18
  ${o.right}px ${o.bottom}px,
19
19
  ${o.right}px ${o.top}px,
20
20
  ${o.left}px ${o.top}px
21
- )`}return y.jsx("div",{ref:r,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),JV=k.forwardRef(function(t,r){const{keepMounted:n=!1,...i}=t,{store:s}=Pl(),o=s.useState("mounted"),a=s.useState("modal");return o||n?y.jsx(QV.Provider,{value:n,children:y.jsxs(Rv,{ref:r,...i,children:[o&&a===!0&&y.jsx(cx,{ref:s.context.internalBackdropRef,inert:fp(!open)}),t.children]})}):null});let Q3={},Z3={},J3="";function Uce(e){if(typeof document>"u")return!1;const t=ri(e);return cn(t).innerWidth-t.documentElement.clientWidth>0}function Vce(e){const t=ri(e),r=t.documentElement,n=t.body,i=Dd(r)?r:n,s=i.style.overflow;return i.style.overflow="hidden",()=>{i.style.overflow=s}}function Wce(e){const t=ri(e),r=t.documentElement,n=t.body,i=cn(r);let s=0,o=0;const a=na.create(),l=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(YP&&(i.visualViewport?.scale??1)!==1)return()=>{};function u(){const p=i.getComputedStyle(r),v=i.getComputedStyle(n),m=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=r.scrollTop,o=r.scrollLeft,Q3={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},J3=r.style.scrollBehavior,Z3={position:n.style.position,height:n.style.height,width:n.style.width,boxSizing:n.style.boxSizing,overflowY:n.style.overflowY,overflowX:n.style.overflowX,scrollBehavior:n.style.scrollBehavior};const x=r.scrollHeight>r.clientHeight,b=r.scrollWidth>r.clientWidth,w=p.overflowY==="scroll"||v.overflowY==="scroll",O=p.overflowX==="scroll"||v.overflowX==="scroll",E=Math.max(0,i.innerWidth-r.clientWidth),T=Math.max(0,i.innerHeight-r.clientHeight),R=parseFloat(v.marginTop)+parseFloat(v.marginBottom),A=parseFloat(v.marginLeft)+parseFloat(v.marginRight),j=Dd(r)?r:n;if(l){r.style.scrollbarGutter=m,j.style.overflowY="hidden",j.style.overflowX="hidden";return}Object.assign(r.style,{scrollbarGutter:m,overflowY:"hidden",overflowX:"hidden"}),(x||w)&&(r.style.overflowY="scroll"),(b||O)&&(r.style.overflowX="scroll"),Object.assign(n.style,{position:"relative",height:R||T?`calc(100dvh - ${R+T}px)`:"100dvh",width:A||E?`calc(100vw - ${A+E}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),n.scrollTop=s,n.scrollLeft=o,r.setAttribute("data-base-ui-scroll-locked",""),r.style.scrollBehavior="unset"}function h(){Object.assign(r.style,Q3),Object.assign(n.style,Z3),l||(r.scrollTop=s,r.scrollLeft=o,r.removeAttribute("data-base-ui-scroll-locked"),r.style.scrollBehavior=J3)}function d(){h(),a.request(u)}return u(),i.addEventListener("resize",d),()=>{a.cancel(),h(),typeof i.removeEventListener=="function"&&i.removeEventListener("resize",d)}}class qce{lockCount=0;restore=null;timeoutLock=Cd.create();timeoutUnlock=Cd.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const n=ri(t).documentElement,i=cn(n).getComputedStyle(n).overflowY;if(i==="hidden"||i==="clip"){this.restore=Zr;return}const s=Vse||!Uce(t);this.restore=s?Vce(t):Wce(t)}}const Gce=new qce;function ux(e=!0,t=null){He(()=>{if(e)return Gce.acquire(t)},[e,t])}function Kce(e){const t=k.useRef(""),r=k.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:k.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i&&e(i,i.pointerType),e(i,t.current),t.current=""},[e]),onPointerDown:r}}function dx(e){const[t,r]=k.useState(null),n=Be((a,l)=>{e||r(l)}),i=k.useCallback(()=>{r(null)},[]),{onClick:s,onPointerDown:o}=Kce(n);return k.useMemo(()=>({openMethod:t,reset:i,triggerProps:{onClick:s,onPointerDown:o}}),[t,i,s,o])}function eW(e){const{store:t,parentContext:r,actionsRef:n}=e,i=t.useState("open"),s=t.useState("disablePointerDismissal"),o=t.useState("modal"),a=t.useState("popupElement"),{openMethod:l,triggerProps:u,reset:h}=dx(i);hV(t);const{forceUnmount:d}=pV(i,t,()=>{h()}),p=Be(I=>{const L=Ue(I);return L.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},L}),v=k.useCallback(()=>{t.setOpen(!1,p(QU))},[t,p]);k.useImperativeHandle(n,()=>({unmount:d,close:v}),[d,v]);const S=vV({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[_,m]=k.useState(0),x=_===0,b=bV(S),w=Pv(S,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:o==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(I){if("button"in I&&I.button!==0||"touches"in I&&I.touches.length!==1)return!1;const L=an(I);if(x&&!s){const z=L;return o&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===z||t.context.backdropRef.current===z||ut(z,a)&&!z?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:x});ux(i&&o===!0,a);const{getReferenceProps:O,getFloatingProps:E,getTriggerProps:T}=Nd([b,w]);t.useContextCallback("onNestedDialogOpen",I=>{m(I+1)}),t.useContextCallback("onNestedDialogClose",()=>{m(0)}),k.useEffect(()=>(r?.onNestedDialogOpen&&i&&r.onNestedDialogOpen(_),r?.onNestedDialogClose&&!i&&r.onNestedDialogClose(),()=>{r?.onNestedDialogClose&&i&&r.onNestedDialogClose()}),[i,r,_]);const R=k.useMemo(()=>O(u),[O,u]),A=k.useMemo(()=>T(u),[T,u]),j=k.useMemo(()=>E(),[E]);t.useSyncedValues({openMethod:l,activeTriggerProps:R,inactiveTriggerProps:A,popupProps:j,floatingRootContext:S,nestedOpenDialogCount:_})}const Yce={...gV,modal:ke(e=>e.modal),nested:ke(e=>e.nested),nestedOpenDialogCount:ke(e=>e.nestedOpenDialogCount),disablePointerDismissal:ke(e=>e.disablePointerDismissal),openMethod:ke(e=>e.openMethod),descriptionElementId:ke(e=>e.descriptionElementId),titleElementId:ke(e=>e.titleElementId),viewportElement:ke(e=>e.viewportElement),role:ke(e=>e.role)};class tW extends aj{constructor(t){super(Xce(t),{popupRef:k.createRef(),backdropRef:k.createRef(),internalBackdropRef:k.createRef(),triggerElements:new Q1,onOpenChange:void 0,onOpenChangeComplete:void 0},Yce)}setOpen=(t,r)=>{if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,r),r.isCanceled)return;const n={open:t,nativeEvent:r.event,reason:r.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",n);const i={open:t},s=r.trigger?.id??null;(s||t)&&(i.activeTriggerId=s,i.activeTriggerElement=r.trigger??null),this.update(i)}}function Xce(e={}){return{...mV(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function Qce(e){const{children:t,open:r,defaultOpen:n=!1,onOpenChange:i,onOpenChangeComplete:s,disablePointerDismissal:o=!1,modal:a=!0,actionsRef:l,handle:u,triggerId:h,defaultTriggerId:d=null}=e,p=Pl(!0),v=!!p,S=ti(()=>u?.store??new tW({open:r??n,activeTriggerId:h!==void 0?h:d,modal:a,disablePointerDismissal:o,nested:v})).current;S.useControlledProp("open",r,n),S.useControlledProp("activeTriggerId",h,d),S.useSyncedValues({disablePointerDismissal:o,nested:v,modal:a}),S.useContextCallback("onOpenChange",i),S.useContextCallback("onOpenChangeComplete",s);const _=S.useState("payload");eW({store:S,actionsRef:l,parentContext:p?.store.context});const m=k.useMemo(()=>({store:S}),[S]);return y.jsx(Sj.Provider,{value:m,children:typeof t=="function"?t({payload:_}):t})}const rW=k.forwardRef(function(t,r){const{render:n,className:i,id:s,...o}=t,{store:a}=Pl(),l=ni(s);return a.useSyncedValueWithCleanup("titleElementId",l),dt("h2",t,{ref:r,props:[{id:l},o]})}),nW=k.forwardRef(function(t,r){const{render:n,className:i,disabled:s=!1,nativeButton:o=!0,id:a,payload:l,handle:u,...h}=t,d=Pl(!0),p=u?.store??d?.store;if(!p)throw new Error(er(79));const v=ni(a),S=p.useState("floatingRootContext"),_=p.useState("isOpenedByTrigger",v),m=k.useRef(null),{registerTrigger:x,isMountedByThisTrigger:b}=fV(v,m,p,{payload:l}),{getButtonProps:w,buttonRef:O}=Di({disabled:s,native:o}),E=dp(S,{enabled:S!=null}),T=Nd([E]),R=k.useMemo(()=>({disabled:s,open:_}),[s,_]),A=p.useState("triggerProps",b);return dt("button",t,{state:R,ref:[O,r,x,m],props:[T.getReferenceProps(),A,{[oU]:"",id:v},h,w],stateAttributesMapping:fj})});function Ta({...e}){return y.jsx(Qce,{"data-slot":"dialog",...e})}function wj({...e}){return y.jsx(nW,{"data-slot":"dialog-trigger",...e})}function Zce({...e}){return y.jsx(JV,{"data-slot":"dialog-portal",...e})}function Nv({...e}){return y.jsx(lx,{"data-slot":"dialog-close",...e})}function Jce({className:e,...t}){return y.jsx(YV,{"data-slot":"dialog-overlay",className:Me("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 ka({className:e,children:t,showCloseButton:r=!0,...n}){return y.jsxs(Zce,{children:[y.jsx(Jce,{}),y.jsxs(ZV,{"data-slot":"dialog-content",className:Me("bg-background 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 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-xs/relaxed ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none",e),...n,children:[t,r&&y.jsxs(lx,{"data-slot":"dialog-close",render:y.jsx(Ne,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[y.jsx(pe,{icon:es,strokeWidth:2}),y.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function jl({className:e,...t}){return y.jsx("div",{"data-slot":"dialog-header",className:Me("gap-1 flex flex-col",e),...t})}function $d({className:e,showCloseButton:t=!1,children:r,...n}){return y.jsxs("div",{"data-slot":"dialog-footer",className:Me("gap-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...n,children:[r,t&&y.jsx(lx,{render:y.jsx(Ne,{variant:"outline"}),children:"Close"})]})}function Ml({className:e,...t}){return y.jsx(rW,{"data-slot":"dialog-title",className:Me("text-sm font-medium",e),...t})}function Bv({className:e,...t}){return y.jsx(XV,{"data-slot":"dialog-description",className:Me("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed *:[a]:underline *:[a]:underline-offset-3",e),...t})}let e4=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const eue={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},zd={valid(e){return e===null?null:e?{[e4.valid]:""}:{[e4.invalid]:""}}},tue=k.createContext({invalid:void 0,name:void 0,validityData:{state:eue,errors:[],error:"",value:"",initialValue:null},setValidityData:Zr,disabled:void 0,touched:!1,setTouched:Zr,dirty:!1,setDirty:Zr,filled:!1,setFilled:Zr,focused:!1,setFocused:Zr,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=Ur)=>e,getInputValidationProps:(e=Ur)=>e,inputRef:{current:null},commit:async()=>{}}});function uo(e=!0){const t=k.useContext(tue);if(t.setValidityData===Zr&&!e)throw new Error(er(28));return t}const rue=k.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Zr,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function $v(){return k.useContext(rue)}const nue=k.createContext({controlId:void 0,setControlId:Zr,labelId:void 0,setLabelId:Zr,messageIds:[],setMessageIds:Zr,getDescriptionProps:e=>e});function au(){return k.useContext(nue)}function iue(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function fx(e={}){const{id:t,implicit:r=!1,controlRef:n}=e,{controlId:i,setControlId:s}=au(),o=ni(t);return He(()=>{if(!(!r&&!t||s===Zr)){if(r){const a=n?.current;cr(a)&&a.closest("label")!=null?s(t??null):s(i??o)}else t&&s(t);return()=>{t&&s(void 0)}}},[t,n,i,s,r,o]),i??o}function zv(e){const{enabled:t=!0,value:r,id:n,name:i,controlRef:s,commit:o}=e,{formRef:a}=$v(),{invalid:l,markedDirtyRef:u,validityData:h,setValidityData:d}=uo(),p=Be(e.getValue);He(()=>{if(!t)return;let v=r;v===void 0&&(v=p()),h.initialValue===null&&v!==null&&d(S=>({...S,initialValue:v}))},[t,d,r,h.initialValue,p]),He(()=>{!t||!n||a.current.fields.set(n,{getValue:p,name:i,controlRef:s,validityData:iue(h,l),validate(){let v=r;v===void 0&&(v=p()),u.current=!0,hn.flushSync(()=>o(v))}})},[o,s,t,a,p,n,l,u,i,h,r]),He(()=>{const v=a.current.fields;return()=>{n&&v.delete(n)}},[a,n])}const sue=k.forwardRef(function(t,r){const{render:n,className:i,id:s,name:o,value:a,disabled:l=!1,onValueChange:u,defaultValue:h,...d}=t,{state:p,name:v,disabled:S}=uo(),_=S||l,m=v??o,x=k.useMemo(()=>({...p,disabled:_}),[p,_]),{setTouched:b,setDirty:w,validityData:O,setFocused:E,setFilled:T,validationMode:R,validation:A}=uo(),{labelId:j}=au(),I=fx({id:s});He(()=>{const $=a!=null;A.inputRef.current?.value||$&&a!==""?T(!0):$&&a===""&&T(!1)},[A.inputRef,T,a]);const[L,z]=Os({controlled:a,default:h,name:"FieldControl",state:"value"}),D=a!==void 0,V=Be(($,F)=>{u?.($,F),!F.isCanceled&&z($)});return zv({id:I,name:m,commit:A.commit,value:L,getValue:()=>A.inputRef.current?.value,controlRef:A.inputRef}),dt("input",t,{ref:r,state:x,props:[{id:I,disabled:_,name:m,ref:A.inputRef,"aria-labelledby":j,...D?{value:L}:{defaultValue:h},onChange($){const F=$.currentTarget.value;V(F,Ue(Pn,$.nativeEvent)),w(F!==O.initialValue),T(F!=="")},onFocus(){E(!0)},onBlur($){b(!0),E(!1),R==="onBlur"&&A.commit($.currentTarget.value)},onKeyDown($){$.currentTarget.tagName==="INPUT"&&$.key==="Enter"&&(b(!0),A.commit($.currentTarget.value))}},A.getInputValidationProps(),d],stateAttributesMapping:zd})}),oue=k.createContext({disabled:!1});function aue(){return k.useContext(oue)}const lue=k.createContext(void 0);function cue(e=!0){const t=k.useContext(lue);if(t===void 0&&!e)throw new Error(er(3));return t}const uue=k.forwardRef(function(t,r){return y.jsx(sue,{ref:r,...t})});function qt({className:e,type:t,...r}){return y.jsx(uue,{type:t,"data-slot":"input",className:Me("bg-input/20 dark:bg-input/30 border-input 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 h-7 rounded-md border px-2 py-0.5 text-sm transition-colors file:h-6 file:text-xs/relaxed file:font-medium focus-visible:ring-[2px] aria-invalid:ring-[2px] md:text-xs/relaxed file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",e),...r})}function hx({className:e,...t}){return y.jsx("textarea",{"data-slot":"textarea",className:Me("border-input bg-input/20 dark:bg-input/30 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 resize-none rounded-md border px-2 py-2 text-sm transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] md:text-xs/relaxed placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...t})}async function iW(e){const t=new FormData;t.append("file",e);const r=await fetch("/api/uploads",{method:"POST",body:t});if(!r.ok)throw new Error("Failed to upload image");return(await r.json()).path}function due(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const fue=e=>{switch(e){case"success":return mue;case"info":return vue;case"warning":return gue;case"error":return yue;default:return null}},hue=Array(12).fill(0),pue=({visible:e,className:t})=>se.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},se.createElement("div",{className:"sonner-spinner"},hue.map((r,n)=>se.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),mue=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),gue=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),vue=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),yue=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),bue=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},se.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),se.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),_ue=()=>{const[e,t]=se.useState(document.hidden);return se.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let EA=1;class xue{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:n,...i}=t,s=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:EA++,o=this.toasts.find(l=>l.id===s),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...t,id:s,title:n}),{...l,...t,id:s,dismissible:a,title:n}):l):this.addToast({title:n,...i,dismissible:a,id:s}),s},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const i=Promise.resolve(t instanceof Function?t():t);let s=n!==void 0,o;const a=i.then(async u=>{if(o=["resolve",u],se.isValidElement(u))s=!1,this.create({id:n,type:"default",message:u});else if(wue(u)&&!u.ok){s=!1;const d=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,p=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description,S=typeof d=="object"&&!se.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:p,...S})}else if(u instanceof Error){s=!1;const d=typeof r.error=="function"?await r.error(u):r.error,p=typeof r.description=="function"?await r.description(u):r.description,S=typeof d=="object"&&!se.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:p,...S})}else if(r.success!==void 0){s=!1;const d=typeof r.success=="function"?await r.success(u):r.success,p=typeof r.description=="function"?await r.description(u):r.description,S=typeof d=="object"&&!se.isValidElement(d)?d:{message:d};this.create({id:n,type:"success",description:p,...S})}}).catch(async u=>{if(o=["reject",u],r.error!==void 0){s=!1;const h=typeof r.error=="function"?await r.error(u):r.error,d=typeof r.description=="function"?await r.description(u):r.description,v=typeof h=="object"&&!se.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:d,...v})}}).finally(()=>{s&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),l=()=>new Promise((u,h)=>a.then(()=>o[0]==="reject"?h(o[1]):u(o[1])).catch(h));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,r)=>{const n=r?.id||EA++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Wi=new xue,Sue=(e,t)=>{const r=t?.id||EA++;return Wi.addToast({title:e,...t,id:r}),r},wue=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Cue=Sue,Eue=()=>Wi.toasts,Oue=()=>Wi.getActiveToasts(),Jt=Object.assign(Cue,{success:Wi.success,info:Wi.info,warning:Wi.warning,error:Wi.error,custom:Wi.custom,message:Wi.message,promise:Wi.promise,dismiss:Wi.dismiss,loading:Wi.loading},{getHistory:Eue,getToasts:Oue});due("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Fb(e){return e.label!==void 0}const Tue=3,kue="24px",Aue="16px",t4=4e3,Rue=356,Pue=14,jue=45,Mue=200;function Qo(...e){return e.filter(Boolean).join(" ")}function Lue(e){const[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}const Due=e=>{var t,r,n,i,s,o,a,l,u;const{invert:h,toast:d,unstyled:p,interacting:v,setHeights:S,visibleToasts:_,heights:m,index:x,toasts:b,expanded:w,removeToast:O,defaultRichColors:E,closeButton:T,style:R,cancelButtonStyle:A,actionButtonStyle:j,className:I="",descriptionClassName:L="",duration:z,position:D,gap:V,expandByDefault:H,classNames:$,icons:F,closeButtonAriaLabel:W="Close toast"}=e,[B,G]=se.useState(null),[N,U]=se.useState(null),[Y,Q]=se.useState(!1),[J,re]=se.useState(!1),[X,q]=se.useState(!1),[Z,te]=se.useState(!1),[ne,ie]=se.useState(!1),[me,ye]=se.useState(0),[ue,he]=se.useState(0),fe=se.useRef(d.duration||z||t4),$e=se.useRef(null),ve=se.useRef(null),De=x===0,_e=x+1<=_,ae=d.type,ce=d.dismissible!==!1,be=d.className||"",Ee=d.descriptionClassName||"",Ve=se.useMemo(()=>m.findIndex(tt=>tt.toastId===d.id)||0,[m,d.id]),st=se.useMemo(()=>{var tt;return(tt=d.closeButton)!=null?tt:T},[d.closeButton,T]),Re=se.useMemo(()=>d.duration||z||t4,[d.duration,z]),We=se.useRef(0),Ge=se.useRef(0),vt=se.useRef(0),Ke=se.useRef(null),[Qe,Ae]=D.split("-"),ot=se.useMemo(()=>m.reduce((tt,Gt,rr)=>rr>=Ve?tt:tt+Gt.height,0),[m,Ve]),ft=_ue(),Je=d.invert||h,lt=ae==="loading";Ge.current=se.useMemo(()=>Ve*V+ot,[Ve,ot]),se.useEffect(()=>{fe.current=Re},[Re]),se.useEffect(()=>{Q(!0)},[]),se.useEffect(()=>{const tt=ve.current;if(tt){const Gt=tt.getBoundingClientRect().height;return he(Gt),S(rr=>[{toastId:d.id,height:Gt,position:d.position},...rr]),()=>S(rr=>rr.filter(mt=>mt.toastId!==d.id))}},[S,d.id]),se.useLayoutEffect(()=>{if(!Y)return;const tt=ve.current,Gt=tt.style.height;tt.style.height="auto";const rr=tt.getBoundingClientRect().height;tt.style.height=Gt,he(rr),S(mt=>mt.find(Rt=>Rt.toastId===d.id)?mt.map(Rt=>Rt.toastId===d.id?{...Rt,height:rr}:Rt):[{toastId:d.id,height:rr,position:d.position},...mt])},[Y,d.title,d.description,S,d.id,d.jsx,d.action,d.cancel]);const Ht=se.useCallback(()=>{re(!0),ye(Ge.current),S(tt=>tt.filter(Gt=>Gt.toastId!==d.id)),setTimeout(()=>{O(d)},Mue)},[d,O,S,Ge]);se.useEffect(()=>{if(d.promise&&ae==="loading"||d.duration===1/0||d.type==="loading")return;let tt;return w||v||ft?(()=>{if(vt.current<We.current){const mt=new Date().getTime()-We.current;fe.current=fe.current-mt}vt.current=new Date().getTime()})():fe.current!==1/0&&(We.current=new Date().getTime(),tt=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),Ht()},fe.current)),()=>clearTimeout(tt)},[w,v,d,ae,ft,Ht]),se.useEffect(()=>{d.delete&&(Ht(),d.onDismiss==null||d.onDismiss.call(d,d))},[Ht,d.delete]);function pt(){var tt;if(F?.loading){var Gt;return se.createElement("div",{className:Qo($?.loader,d==null||(Gt=d.classNames)==null?void 0:Gt.loader,"sonner-loader"),"data-visible":ae==="loading"},F.loading)}return se.createElement(pue,{className:Qo($?.loader,d==null||(tt=d.classNames)==null?void 0:tt.loader),visible:ae==="loading"})}const Pr=d.icon||F?.[ae]||fue(ae);var It,kt;return se.createElement("li",{tabIndex:0,ref:ve,className:Qo(I,be,$?.toast,d==null||(t=d.classNames)==null?void 0:t.toast,$?.default,$?.[ae],d==null||(r=d.classNames)==null?void 0:r[ae]),"data-sonner-toast":"","data-rich-colors":(It=d.richColors)!=null?It:E,"data-styled":!(d.jsx||d.unstyled||p),"data-mounted":Y,"data-promise":!!d.promise,"data-swiped":ne,"data-removed":J,"data-visible":_e,"data-y-position":Qe,"data-x-position":Ae,"data-index":x,"data-front":De,"data-swiping":X,"data-dismissible":ce,"data-type":ae,"data-invert":Je,"data-swipe-out":Z,"data-swipe-direction":N,"data-expanded":!!(w||H&&Y),"data-testid":d.testId,style:{"--index":x,"--toasts-before":x,"--z-index":b.length-x,"--offset":`${J?me:Ge.current}px`,"--initial-height":H?"auto":`${ue}px`,...R,...d.style},onDragEnd:()=>{q(!1),G(null),Ke.current=null},onPointerDown:tt=>{tt.button!==2&&(lt||!ce||($e.current=new Date,ye(Ge.current),tt.target.setPointerCapture(tt.pointerId),tt.target.tagName!=="BUTTON"&&(q(!0),Ke.current={x:tt.clientX,y:tt.clientY})))},onPointerUp:()=>{var tt,Gt,rr;if(Z||!ce)return;Ke.current=null;const mt=Number(((tt=ve.current)==null?void 0:tt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Nt=Number(((Gt=ve.current)==null?void 0:Gt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Rt=new Date().getTime()-((rr=$e.current)==null?void 0:rr.getTime()),Pt=B==="x"?mt:Nt,rt=Math.abs(Pt)/Rt;if(Math.abs(Pt)>=jue||rt>.11){ye(Ge.current),d.onDismiss==null||d.onDismiss.call(d,d),U(B==="x"?mt>0?"right":"left":Nt>0?"down":"up"),Ht(),te(!0);return}else{var nr,en;(nr=ve.current)==null||nr.style.setProperty("--swipe-amount-x","0px"),(en=ve.current)==null||en.style.setProperty("--swipe-amount-y","0px")}ie(!1),q(!1),G(null)},onPointerMove:tt=>{var Gt,rr,mt;if(!Ke.current||!ce||((Gt=window.getSelection())==null?void 0:Gt.toString().length)>0)return;const Rt=tt.clientY-Ke.current.y,Pt=tt.clientX-Ke.current.x;var rt;const nr=(rt=e.swipeDirections)!=null?rt:Lue(D);!B&&(Math.abs(Pt)>1||Math.abs(Rt)>1)&&G(Math.abs(Pt)>Math.abs(Rt)?"x":"y");let en={x:0,y:0};const un=pn=>1/(1.5+Math.abs(pn)/20);if(B==="y"){if(nr.includes("top")||nr.includes("bottom"))if(nr.includes("top")&&Rt<0||nr.includes("bottom")&&Rt>0)en.y=Rt;else{const pn=Rt*un(Rt);en.y=Math.abs(pn)<Math.abs(Rt)?pn:Rt}}else if(B==="x"&&(nr.includes("left")||nr.includes("right")))if(nr.includes("left")&&Pt<0||nr.includes("right")&&Pt>0)en.x=Pt;else{const pn=Pt*un(Pt);en.x=Math.abs(pn)<Math.abs(Pt)?pn:Pt}(Math.abs(en.x)>0||Math.abs(en.y)>0)&&ie(!0),(rr=ve.current)==null||rr.style.setProperty("--swipe-amount-x",`${en.x}px`),(mt=ve.current)==null||mt.style.setProperty("--swipe-amount-y",`${en.y}px`)}},st&&!d.jsx&&ae!=="loading"?se.createElement("button",{"aria-label":W,"data-disabled":lt,"data-close-button":!0,onClick:lt||!ce?()=>{}:()=>{Ht(),d.onDismiss==null||d.onDismiss.call(d,d)},className:Qo($?.closeButton,d==null||(n=d.classNames)==null?void 0:n.closeButton)},(kt=F?.close)!=null?kt:bue):null,(ae||d.icon||d.promise)&&d.icon!==null&&(F?.[ae]!==null||d.icon)?se.createElement("div",{"data-icon":"",className:Qo($?.icon,d==null||(i=d.classNames)==null?void 0:i.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||pt():null,d.type!=="loading"?Pr:null):null,se.createElement("div",{"data-content":"",className:Qo($?.content,d==null||(s=d.classNames)==null?void 0:s.content)},se.createElement("div",{"data-title":"",className:Qo($?.title,d==null||(o=d.classNames)==null?void 0:o.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?se.createElement("div",{"data-description":"",className:Qo(L,Ee,$?.description,d==null||(a=d.classNames)==null?void 0:a.description)},typeof d.description=="function"?d.description():d.description):null),se.isValidElement(d.cancel)?d.cancel:d.cancel&&Fb(d.cancel)?se.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||A,onClick:tt=>{Fb(d.cancel)&&ce&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,tt),Ht())},className:Qo($?.cancelButton,d==null||(l=d.classNames)==null?void 0:l.cancelButton)},d.cancel.label):null,se.isValidElement(d.action)?d.action:d.action&&Fb(d.action)?se.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||j,onClick:tt=>{Fb(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,tt),!tt.defaultPrevented&&Ht())},className:Qo($?.actionButton,d==null||(u=d.classNames)==null?void 0:u.actionButton)},d.action.label):null)};function r4(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Iue(e,t){const r={};return[e,t].forEach((n,i)=>{const s=i===1,o=s?"--mobile-offset":"--offset",a=s?Aue:kue;function l(u){["top","right","bottom","left"].forEach(h=>{r[`${o}-${h}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?l(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${o}-${u}`]=a:r[`${o}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):l(a)}),r}const Nue=se.forwardRef(function(t,r){const{id:n,invert:i,position:s="bottom-right",hotkey:o=["altKey","KeyT"],expand:a,closeButton:l,className:u,offset:h,mobileOffset:d,theme:p="light",richColors:v,duration:S,style:_,visibleToasts:m=Tue,toastOptions:x,dir:b=r4(),gap:w=Pue,icons:O,containerAriaLabel:E="Notifications"}=t,[T,R]=se.useState([]),A=se.useMemo(()=>n?T.filter(Y=>Y.toasterId===n):T.filter(Y=>!Y.toasterId),[T,n]),j=se.useMemo(()=>Array.from(new Set([s].concat(A.filter(Y=>Y.position).map(Y=>Y.position)))),[A,s]),[I,L]=se.useState([]),[z,D]=se.useState(!1),[V,H]=se.useState(!1),[$,F]=se.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=se.useRef(null),B=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),G=se.useRef(null),N=se.useRef(!1),U=se.useCallback(Y=>{R(Q=>{var J;return(J=Q.find(re=>re.id===Y.id))!=null&&J.delete||Wi.dismiss(Y.id),Q.filter(({id:re})=>re!==Y.id)})},[]);return se.useEffect(()=>Wi.subscribe(Y=>{if(Y.dismiss){requestAnimationFrame(()=>{R(Q=>Q.map(J=>J.id===Y.id?{...J,delete:!0}:J))});return}setTimeout(()=>{wre.flushSync(()=>{R(Q=>{const J=Q.findIndex(re=>re.id===Y.id);return J!==-1?[...Q.slice(0,J),{...Q[J],...Y},...Q.slice(J+1)]:[Y,...Q]})})})}),[T]),se.useEffect(()=>{if(p!=="system"){F(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?F("dark"):F("light")),typeof window>"u")return;const Y=window.matchMedia("(prefers-color-scheme: dark)");try{Y.addEventListener("change",({matches:Q})=>{F(Q?"dark":"light")})}catch{Y.addListener(({matches:J})=>{try{F(J?"dark":"light")}catch(re){console.error(re)}})}},[p]),se.useEffect(()=>{T.length<=1&&D(!1)},[T]),se.useEffect(()=>{const Y=Q=>{var J;if(o.every(q=>Q[q]||Q.code===q)){var X;D(!0),(X=W.current)==null||X.focus()}Q.code==="Escape"&&(document.activeElement===W.current||(J=W.current)!=null&&J.contains(document.activeElement))&&D(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[o]),se.useEffect(()=>{if(W.current)return()=>{G.current&&(G.current.focus({preventScroll:!0}),G.current=null,N.current=!1)}},[W.current]),se.createElement("section",{ref:r,"aria-label":`${E} ${B}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},j.map((Y,Q)=>{var J;const[re,X]=Y.split("-");return A.length?se.createElement("ol",{key:Y,dir:b==="auto"?r4():b,tabIndex:-1,ref:W,className:u,"data-sonner-toaster":!0,"data-sonner-theme":$,"data-y-position":re,"data-x-position":X,style:{"--front-toast-height":`${((J=I[0])==null?void 0:J.height)||0}px`,"--width":`${Rue}px`,"--gap":`${w}px`,..._,...Iue(h,d)},onBlur:q=>{N.current&&!q.currentTarget.contains(q.relatedTarget)&&(N.current=!1,G.current&&(G.current.focus({preventScroll:!0}),G.current=null))},onFocus:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||N.current||(N.current=!0,G.current=q.relatedTarget)},onMouseEnter:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{V||D(!1)},onDragEnd:()=>D(!1),onPointerDown:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||H(!0)},onPointerUp:()=>H(!1)},A.filter(q=>!q.position&&Q===0||q.position===Y).map((q,Z)=>{var te,ne;return se.createElement(Due,{key:q.id,icons:O,index:Z,toast:q,defaultRichColors:v,duration:(te=x?.duration)!=null?te:S,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:i,visibleToasts:m,closeButton:(ne=x?.closeButton)!=null?ne:l,interacting:V,position:Y,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:U,toasts:A.filter(ie=>ie.position==q.position),heights:I.filter(ie=>ie.position==q.position),setHeights:L,expandByDefault:a,gap:w,expanded:z,swipeDirections:t.swipeDirections})})):null}))});let oE=[];typeof window<"u"&&window.addEventListener("beforeunload",()=>{if(oE.length>0){const e=JSON.stringify({entries:oE});navigator.sendBeacon("/api/logs",e),oE=[]}});const sW={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},child:()=>sW};function Df(e){return sW}const Tt={terminal:Df(),terminalsView:Df(),ws:Df(),taskTerminal:Df(),kanban:Df(),viewer:Df()};function Bue(e){const t=/\/[\w\-/.]+\.(png|jpg|jpeg|gif|webp|svg)/gi;return[...e.match(t)||[]]}function n4(e){return`/api/uploads/${e.split("/").pop()}`}function oW({value:e,onValueChange:t,className:r,disabled:n,...i}){const[s,o]=k.useState(!1),a=k.useRef(null),l=Bue(e),u=async h=>{const d=h.clipboardData?.items;if(d){for(const p of d)if(p.type.startsWith("image/")){h.preventDefault();const v=p.getAsFile();if(!v)return;o(!0);try{const S=await iW(v),_=a.current;if(_){const m=_.selectionStart,x=_.selectionEnd,b=e.slice(0,m),w=e.slice(x),O=b&&!b.endsWith(`
21
+ )`}return y.jsx("div",{ref:r,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),JV=k.forwardRef(function(t,r){const{keepMounted:n=!1,...i}=t,{store:s}=Pl(),o=s.useState("mounted"),a=s.useState("modal");return o||n?y.jsx(QV.Provider,{value:n,children:y.jsxs(Rv,{ref:r,...i,children:[o&&a===!0&&y.jsx(cx,{ref:s.context.internalBackdropRef,inert:fp(!open)}),t.children]})}):null});let Q3={},Z3={},J3="";function Uce(e){if(typeof document>"u")return!1;const t=ri(e);return cn(t).innerWidth-t.documentElement.clientWidth>0}function Vce(e){const t=ri(e),r=t.documentElement,n=t.body,i=Dd(r)?r:n,s=i.style.overflow;return i.style.overflow="hidden",()=>{i.style.overflow=s}}function Wce(e){const t=ri(e),r=t.documentElement,n=t.body,i=cn(r);let s=0,o=0;const a=na.create(),l=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(YP&&(i.visualViewport?.scale??1)!==1)return()=>{};function u(){const p=i.getComputedStyle(r),v=i.getComputedStyle(n),m=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=r.scrollTop,o=r.scrollLeft,Q3={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},J3=r.style.scrollBehavior,Z3={position:n.style.position,height:n.style.height,width:n.style.width,boxSizing:n.style.boxSizing,overflowY:n.style.overflowY,overflowX:n.style.overflowX,scrollBehavior:n.style.scrollBehavior};const x=r.scrollHeight>r.clientHeight,b=r.scrollWidth>r.clientWidth,w=p.overflowY==="scroll"||v.overflowY==="scroll",O=p.overflowX==="scroll"||v.overflowX==="scroll",E=Math.max(0,i.innerWidth-r.clientWidth),T=Math.max(0,i.innerHeight-r.clientHeight),R=parseFloat(v.marginTop)+parseFloat(v.marginBottom),A=parseFloat(v.marginLeft)+parseFloat(v.marginRight),j=Dd(r)?r:n;if(l){r.style.scrollbarGutter=m,j.style.overflowY="hidden",j.style.overflowX="hidden";return}Object.assign(r.style,{scrollbarGutter:m,overflowY:"hidden",overflowX:"hidden"}),(x||w)&&(r.style.overflowY="scroll"),(b||O)&&(r.style.overflowX="scroll"),Object.assign(n.style,{position:"relative",height:R||T?`calc(100dvh - ${R+T}px)`:"100dvh",width:A||E?`calc(100vw - ${A+E}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),n.scrollTop=s,n.scrollLeft=o,r.setAttribute("data-base-ui-scroll-locked",""),r.style.scrollBehavior="unset"}function h(){Object.assign(r.style,Q3),Object.assign(n.style,Z3),l||(r.scrollTop=s,r.scrollLeft=o,r.removeAttribute("data-base-ui-scroll-locked"),r.style.scrollBehavior=J3)}function d(){h(),a.request(u)}return u(),i.addEventListener("resize",d),()=>{a.cancel(),h(),typeof i.removeEventListener=="function"&&i.removeEventListener("resize",d)}}class qce{lockCount=0;restore=null;timeoutLock=Cd.create();timeoutUnlock=Cd.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const n=ri(t).documentElement,i=cn(n).getComputedStyle(n).overflowY;if(i==="hidden"||i==="clip"){this.restore=Zr;return}const s=Vse||!Uce(t);this.restore=s?Vce(t):Wce(t)}}const Gce=new qce;function ux(e=!0,t=null){He(()=>{if(e)return Gce.acquire(t)},[e,t])}function Kce(e){const t=k.useRef(""),r=k.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:k.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i&&e(i,i.pointerType),e(i,t.current),t.current=""},[e]),onPointerDown:r}}function dx(e){const[t,r]=k.useState(null),n=Be((a,l)=>{e||r(l)}),i=k.useCallback(()=>{r(null)},[]),{onClick:s,onPointerDown:o}=Kce(n);return k.useMemo(()=>({openMethod:t,reset:i,triggerProps:{onClick:s,onPointerDown:o}}),[t,i,s,o])}function eW(e){const{store:t,parentContext:r,actionsRef:n}=e,i=t.useState("open"),s=t.useState("disablePointerDismissal"),o=t.useState("modal"),a=t.useState("popupElement"),{openMethod:l,triggerProps:u,reset:h}=dx(i);hV(t);const{forceUnmount:d}=pV(i,t,()=>{h()}),p=Be(I=>{const L=Ue(I);return L.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},L}),v=k.useCallback(()=>{t.setOpen(!1,p(QU))},[t,p]);k.useImperativeHandle(n,()=>({unmount:d,close:v}),[d,v]);const S=vV({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[_,m]=k.useState(0),x=_===0,b=bV(S),w=Pv(S,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:o==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(I){if("button"in I&&I.button!==0||"touches"in I&&I.touches.length!==1)return!1;const L=an(I);if(x&&!s){const z=L;return o&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===z||t.context.backdropRef.current===z||ut(z,a)&&!z?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:x});ux(i&&o===!0,a);const{getReferenceProps:O,getFloatingProps:E,getTriggerProps:T}=Nd([b,w]);t.useContextCallback("onNestedDialogOpen",I=>{m(I+1)}),t.useContextCallback("onNestedDialogClose",()=>{m(0)}),k.useEffect(()=>(r?.onNestedDialogOpen&&i&&r.onNestedDialogOpen(_),r?.onNestedDialogClose&&!i&&r.onNestedDialogClose(),()=>{r?.onNestedDialogClose&&i&&r.onNestedDialogClose()}),[i,r,_]);const R=k.useMemo(()=>O(u),[O,u]),A=k.useMemo(()=>T(u),[T,u]),j=k.useMemo(()=>E(),[E]);t.useSyncedValues({openMethod:l,activeTriggerProps:R,inactiveTriggerProps:A,popupProps:j,floatingRootContext:S,nestedOpenDialogCount:_})}const Yce={...gV,modal:ke(e=>e.modal),nested:ke(e=>e.nested),nestedOpenDialogCount:ke(e=>e.nestedOpenDialogCount),disablePointerDismissal:ke(e=>e.disablePointerDismissal),openMethod:ke(e=>e.openMethod),descriptionElementId:ke(e=>e.descriptionElementId),titleElementId:ke(e=>e.titleElementId),viewportElement:ke(e=>e.viewportElement),role:ke(e=>e.role)};class tW extends aj{constructor(t){super(Xce(t),{popupRef:k.createRef(),backdropRef:k.createRef(),internalBackdropRef:k.createRef(),triggerElements:new Q1,onOpenChange:void 0,onOpenChangeComplete:void 0},Yce)}setOpen=(t,r)=>{if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,r),r.isCanceled)return;const n={open:t,nativeEvent:r.event,reason:r.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",n);const i={open:t},s=r.trigger?.id??null;(s||t)&&(i.activeTriggerId=s,i.activeTriggerElement=r.trigger??null),this.update(i)}}function Xce(e={}){return{...mV(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function Qce(e){const{children:t,open:r,defaultOpen:n=!1,onOpenChange:i,onOpenChangeComplete:s,disablePointerDismissal:o=!1,modal:a=!0,actionsRef:l,handle:u,triggerId:h,defaultTriggerId:d=null}=e,p=Pl(!0),v=!!p,S=ti(()=>u?.store??new tW({open:r??n,activeTriggerId:h!==void 0?h:d,modal:a,disablePointerDismissal:o,nested:v})).current;S.useControlledProp("open",r,n),S.useControlledProp("activeTriggerId",h,d),S.useSyncedValues({disablePointerDismissal:o,nested:v,modal:a}),S.useContextCallback("onOpenChange",i),S.useContextCallback("onOpenChangeComplete",s);const _=S.useState("payload");eW({store:S,actionsRef:l,parentContext:p?.store.context});const m=k.useMemo(()=>({store:S}),[S]);return y.jsx(Sj.Provider,{value:m,children:typeof t=="function"?t({payload:_}):t})}const rW=k.forwardRef(function(t,r){const{render:n,className:i,id:s,...o}=t,{store:a}=Pl(),l=ni(s);return a.useSyncedValueWithCleanup("titleElementId",l),dt("h2",t,{ref:r,props:[{id:l},o]})}),nW=k.forwardRef(function(t,r){const{render:n,className:i,disabled:s=!1,nativeButton:o=!0,id:a,payload:l,handle:u,...h}=t,d=Pl(!0),p=u?.store??d?.store;if(!p)throw new Error(er(79));const v=ni(a),S=p.useState("floatingRootContext"),_=p.useState("isOpenedByTrigger",v),m=k.useRef(null),{registerTrigger:x,isMountedByThisTrigger:b}=fV(v,m,p,{payload:l}),{getButtonProps:w,buttonRef:O}=Di({disabled:s,native:o}),E=dp(S,{enabled:S!=null}),T=Nd([E]),R=k.useMemo(()=>({disabled:s,open:_}),[s,_]),A=p.useState("triggerProps",b);return dt("button",t,{state:R,ref:[O,r,x,m],props:[T.getReferenceProps(),A,{[oU]:"",id:v},h,w],stateAttributesMapping:fj})});function Ta({...e}){return y.jsx(Qce,{"data-slot":"dialog",...e})}function wj({...e}){return y.jsx(nW,{"data-slot":"dialog-trigger",...e})}function Zce({...e}){return y.jsx(JV,{"data-slot":"dialog-portal",...e})}function Nv({...e}){return y.jsx(lx,{"data-slot":"dialog-close",...e})}function Jce({className:e,...t}){return y.jsx(YV,{"data-slot":"dialog-overlay",className:Me("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 ka({className:e,children:t,showCloseButton:r=!0,...n}){return y.jsxs(Zce,{children:[y.jsx(Jce,{}),y.jsxs(ZV,{"data-slot":"dialog-content",className:Me("bg-background 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 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-4 rounded-xl p-4 text-xs/relaxed ring-1 duration-100 sm:max-w-sm fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none",e),...n,children:[t,r&&y.jsxs(lx,{"data-slot":"dialog-close",render:y.jsx(Ne,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[y.jsx(pe,{icon:es,strokeWidth:2}),y.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function jl({className:e,...t}){return y.jsx("div",{"data-slot":"dialog-header",className:Me("gap-1 flex flex-col",e),...t})}function $d({className:e,showCloseButton:t=!1,children:r,...n}){return y.jsxs("div",{"data-slot":"dialog-footer",className:Me("gap-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...n,children:[r,t&&y.jsx(lx,{render:y.jsx(Ne,{variant:"outline"}),children:"Close"})]})}function Ml({className:e,...t}){return y.jsx(rW,{"data-slot":"dialog-title",className:Me("text-sm font-medium",e),...t})}function Bv({className:e,...t}){return y.jsx(XV,{"data-slot":"dialog-description",className:Me("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed *:[a]:underline *:[a]:underline-offset-3",e),...t})}let e4=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const eue={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},zd={valid(e){return e===null?null:e?{[e4.valid]:""}:{[e4.invalid]:""}}},tue=k.createContext({invalid:void 0,name:void 0,validityData:{state:eue,errors:[],error:"",value:"",initialValue:null},setValidityData:Zr,disabled:void 0,touched:!1,setTouched:Zr,dirty:!1,setDirty:Zr,filled:!1,setFilled:Zr,focused:!1,setFocused:Zr,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=Ur)=>e,getInputValidationProps:(e=Ur)=>e,inputRef:{current:null},commit:async()=>{}}});function uo(e=!0){const t=k.useContext(tue);if(t.setValidityData===Zr&&!e)throw new Error(er(28));return t}const rue=k.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Zr,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function $v(){return k.useContext(rue)}const nue=k.createContext({controlId:void 0,setControlId:Zr,labelId:void 0,setLabelId:Zr,messageIds:[],setMessageIds:Zr,getDescriptionProps:e=>e});function au(){return k.useContext(nue)}function iue(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function fx(e={}){const{id:t,implicit:r=!1,controlRef:n}=e,{controlId:i,setControlId:s}=au(),o=ni(t);return He(()=>{if(!(!r&&!t||s===Zr)){if(r){const a=n?.current;cr(a)&&a.closest("label")!=null?s(t??null):s(i??o)}else t&&s(t);return()=>{t&&s(void 0)}}},[t,n,i,s,r,o]),i??o}function zv(e){const{enabled:t=!0,value:r,id:n,name:i,controlRef:s,commit:o}=e,{formRef:a}=$v(),{invalid:l,markedDirtyRef:u,validityData:h,setValidityData:d}=uo(),p=Be(e.getValue);He(()=>{if(!t)return;let v=r;v===void 0&&(v=p()),h.initialValue===null&&v!==null&&d(S=>({...S,initialValue:v}))},[t,d,r,h.initialValue,p]),He(()=>{!t||!n||a.current.fields.set(n,{getValue:p,name:i,controlRef:s,validityData:iue(h,l),validate(){let v=r;v===void 0&&(v=p()),u.current=!0,hn.flushSync(()=>o(v))}})},[o,s,t,a,p,n,l,u,i,h,r]),He(()=>{const v=a.current.fields;return()=>{n&&v.delete(n)}},[a,n])}const sue=k.forwardRef(function(t,r){const{render:n,className:i,id:s,name:o,value:a,disabled:l=!1,onValueChange:u,defaultValue:h,...d}=t,{state:p,name:v,disabled:S}=uo(),_=S||l,m=v??o,x=k.useMemo(()=>({...p,disabled:_}),[p,_]),{setTouched:b,setDirty:w,validityData:O,setFocused:E,setFilled:T,validationMode:R,validation:A}=uo(),{labelId:j}=au(),I=fx({id:s});He(()=>{const $=a!=null;A.inputRef.current?.value||$&&a!==""?T(!0):$&&a===""&&T(!1)},[A.inputRef,T,a]);const[L,z]=Os({controlled:a,default:h,name:"FieldControl",state:"value"}),D=a!==void 0,V=Be(($,F)=>{u?.($,F),!F.isCanceled&&z($)});return zv({id:I,name:m,commit:A.commit,value:L,getValue:()=>A.inputRef.current?.value,controlRef:A.inputRef}),dt("input",t,{ref:r,state:x,props:[{id:I,disabled:_,name:m,ref:A.inputRef,"aria-labelledby":j,...D?{value:L}:{defaultValue:h},onChange($){const F=$.currentTarget.value;V(F,Ue(Pn,$.nativeEvent)),w(F!==O.initialValue),T(F!=="")},onFocus(){E(!0)},onBlur($){b(!0),E(!1),R==="onBlur"&&A.commit($.currentTarget.value)},onKeyDown($){$.currentTarget.tagName==="INPUT"&&$.key==="Enter"&&(b(!0),A.commit($.currentTarget.value))}},A.getInputValidationProps(),d],stateAttributesMapping:zd})}),oue=k.createContext({disabled:!1});function aue(){return k.useContext(oue)}const lue=k.createContext(void 0);function cue(e=!0){const t=k.useContext(lue);if(t===void 0&&!e)throw new Error(er(3));return t}const uue=k.forwardRef(function(t,r){return y.jsx(sue,{ref:r,...t})});function qt({className:e,type:t,...r}){return y.jsx(uue,{type:t,"data-slot":"input",className:Me("bg-input/20 dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/30 focus-visible:ring-inset aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 aria-invalid:ring-inset h-7 rounded-md border px-2 py-0.5 text-sm transition-colors file:h-6 file:text-xs/relaxed file:font-medium focus-visible:ring-[2px] aria-invalid:ring-[2px] md:text-xs/relaxed file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",e),...r})}function hx({className:e,...t}){return y.jsx("textarea",{"data-slot":"textarea",className:Me("border-input bg-input/20 dark:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/30 focus-visible:ring-inset aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 aria-invalid:ring-inset resize-none rounded-md border px-2 py-2 text-sm transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] md:text-xs/relaxed placeholder:text-muted-foreground flex field-sizing-content min-h-16 w-full outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...t})}async function iW(e){const t=new FormData;t.append("file",e);const r=await fetch("/api/uploads",{method:"POST",body:t});if(!r.ok)throw new Error("Failed to upload image");return(await r.json()).path}function due(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const fue=e=>{switch(e){case"success":return mue;case"info":return vue;case"warning":return gue;case"error":return yue;default:return null}},hue=Array(12).fill(0),pue=({visible:e,className:t})=>se.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},se.createElement("div",{className:"sonner-spinner"},hue.map((r,n)=>se.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),mue=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),gue=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),vue=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),yue=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),bue=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},se.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),se.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),_ue=()=>{const[e,t]=se.useState(document.hidden);return se.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let EA=1;class xue{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:n,...i}=t,s=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:EA++,o=this.toasts.find(l=>l.id===s),a=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...t,id:s,title:n}),{...l,...t,id:s,dismissible:a,title:n}):l):this.addToast({title:n,...i,dismissible:a,id:s}),s},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const i=Promise.resolve(t instanceof Function?t():t);let s=n!==void 0,o;const a=i.then(async u=>{if(o=["resolve",u],se.isValidElement(u))s=!1,this.create({id:n,type:"default",message:u});else if(wue(u)&&!u.ok){s=!1;const d=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,p=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description,S=typeof d=="object"&&!se.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:p,...S})}else if(u instanceof Error){s=!1;const d=typeof r.error=="function"?await r.error(u):r.error,p=typeof r.description=="function"?await r.description(u):r.description,S=typeof d=="object"&&!se.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:p,...S})}else if(r.success!==void 0){s=!1;const d=typeof r.success=="function"?await r.success(u):r.success,p=typeof r.description=="function"?await r.description(u):r.description,S=typeof d=="object"&&!se.isValidElement(d)?d:{message:d};this.create({id:n,type:"success",description:p,...S})}}).catch(async u=>{if(o=["reject",u],r.error!==void 0){s=!1;const h=typeof r.error=="function"?await r.error(u):r.error,d=typeof r.description=="function"?await r.description(u):r.description,v=typeof h=="object"&&!se.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:d,...v})}}).finally(()=>{s&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),l=()=>new Promise((u,h)=>a.then(()=>o[0]==="reject"?h(o[1]):u(o[1])).catch(h));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,r)=>{const n=r?.id||EA++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Wi=new xue,Sue=(e,t)=>{const r=t?.id||EA++;return Wi.addToast({title:e,...t,id:r}),r},wue=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Cue=Sue,Eue=()=>Wi.toasts,Oue=()=>Wi.getActiveToasts(),Jt=Object.assign(Cue,{success:Wi.success,info:Wi.info,warning:Wi.warning,error:Wi.error,custom:Wi.custom,message:Wi.message,promise:Wi.promise,dismiss:Wi.dismiss,loading:Wi.loading},{getHistory:Eue,getToasts:Oue});due("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Fb(e){return e.label!==void 0}const Tue=3,kue="24px",Aue="16px",t4=4e3,Rue=356,Pue=14,jue=45,Mue=200;function Qo(...e){return e.filter(Boolean).join(" ")}function Lue(e){const[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}const Due=e=>{var t,r,n,i,s,o,a,l,u;const{invert:h,toast:d,unstyled:p,interacting:v,setHeights:S,visibleToasts:_,heights:m,index:x,toasts:b,expanded:w,removeToast:O,defaultRichColors:E,closeButton:T,style:R,cancelButtonStyle:A,actionButtonStyle:j,className:I="",descriptionClassName:L="",duration:z,position:D,gap:V,expandByDefault:H,classNames:$,icons:F,closeButtonAriaLabel:W="Close toast"}=e,[B,G]=se.useState(null),[N,U]=se.useState(null),[Y,Q]=se.useState(!1),[J,re]=se.useState(!1),[X,q]=se.useState(!1),[Z,te]=se.useState(!1),[ne,ie]=se.useState(!1),[me,ye]=se.useState(0),[ue,he]=se.useState(0),fe=se.useRef(d.duration||z||t4),$e=se.useRef(null),ve=se.useRef(null),De=x===0,_e=x+1<=_,ae=d.type,ce=d.dismissible!==!1,be=d.className||"",Ee=d.descriptionClassName||"",Ve=se.useMemo(()=>m.findIndex(tt=>tt.toastId===d.id)||0,[m,d.id]),st=se.useMemo(()=>{var tt;return(tt=d.closeButton)!=null?tt:T},[d.closeButton,T]),Re=se.useMemo(()=>d.duration||z||t4,[d.duration,z]),We=se.useRef(0),Ge=se.useRef(0),vt=se.useRef(0),Ke=se.useRef(null),[Qe,Ae]=D.split("-"),ot=se.useMemo(()=>m.reduce((tt,Gt,rr)=>rr>=Ve?tt:tt+Gt.height,0),[m,Ve]),ft=_ue(),Je=d.invert||h,lt=ae==="loading";Ge.current=se.useMemo(()=>Ve*V+ot,[Ve,ot]),se.useEffect(()=>{fe.current=Re},[Re]),se.useEffect(()=>{Q(!0)},[]),se.useEffect(()=>{const tt=ve.current;if(tt){const Gt=tt.getBoundingClientRect().height;return he(Gt),S(rr=>[{toastId:d.id,height:Gt,position:d.position},...rr]),()=>S(rr=>rr.filter(mt=>mt.toastId!==d.id))}},[S,d.id]),se.useLayoutEffect(()=>{if(!Y)return;const tt=ve.current,Gt=tt.style.height;tt.style.height="auto";const rr=tt.getBoundingClientRect().height;tt.style.height=Gt,he(rr),S(mt=>mt.find(Rt=>Rt.toastId===d.id)?mt.map(Rt=>Rt.toastId===d.id?{...Rt,height:rr}:Rt):[{toastId:d.id,height:rr,position:d.position},...mt])},[Y,d.title,d.description,S,d.id,d.jsx,d.action,d.cancel]);const Ht=se.useCallback(()=>{re(!0),ye(Ge.current),S(tt=>tt.filter(Gt=>Gt.toastId!==d.id)),setTimeout(()=>{O(d)},Mue)},[d,O,S,Ge]);se.useEffect(()=>{if(d.promise&&ae==="loading"||d.duration===1/0||d.type==="loading")return;let tt;return w||v||ft?(()=>{if(vt.current<We.current){const mt=new Date().getTime()-We.current;fe.current=fe.current-mt}vt.current=new Date().getTime()})():fe.current!==1/0&&(We.current=new Date().getTime(),tt=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),Ht()},fe.current)),()=>clearTimeout(tt)},[w,v,d,ae,ft,Ht]),se.useEffect(()=>{d.delete&&(Ht(),d.onDismiss==null||d.onDismiss.call(d,d))},[Ht,d.delete]);function pt(){var tt;if(F?.loading){var Gt;return se.createElement("div",{className:Qo($?.loader,d==null||(Gt=d.classNames)==null?void 0:Gt.loader,"sonner-loader"),"data-visible":ae==="loading"},F.loading)}return se.createElement(pue,{className:Qo($?.loader,d==null||(tt=d.classNames)==null?void 0:tt.loader),visible:ae==="loading"})}const Pr=d.icon||F?.[ae]||fue(ae);var It,kt;return se.createElement("li",{tabIndex:0,ref:ve,className:Qo(I,be,$?.toast,d==null||(t=d.classNames)==null?void 0:t.toast,$?.default,$?.[ae],d==null||(r=d.classNames)==null?void 0:r[ae]),"data-sonner-toast":"","data-rich-colors":(It=d.richColors)!=null?It:E,"data-styled":!(d.jsx||d.unstyled||p),"data-mounted":Y,"data-promise":!!d.promise,"data-swiped":ne,"data-removed":J,"data-visible":_e,"data-y-position":Qe,"data-x-position":Ae,"data-index":x,"data-front":De,"data-swiping":X,"data-dismissible":ce,"data-type":ae,"data-invert":Je,"data-swipe-out":Z,"data-swipe-direction":N,"data-expanded":!!(w||H&&Y),"data-testid":d.testId,style:{"--index":x,"--toasts-before":x,"--z-index":b.length-x,"--offset":`${J?me:Ge.current}px`,"--initial-height":H?"auto":`${ue}px`,...R,...d.style},onDragEnd:()=>{q(!1),G(null),Ke.current=null},onPointerDown:tt=>{tt.button!==2&&(lt||!ce||($e.current=new Date,ye(Ge.current),tt.target.setPointerCapture(tt.pointerId),tt.target.tagName!=="BUTTON"&&(q(!0),Ke.current={x:tt.clientX,y:tt.clientY})))},onPointerUp:()=>{var tt,Gt,rr;if(Z||!ce)return;Ke.current=null;const mt=Number(((tt=ve.current)==null?void 0:tt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Nt=Number(((Gt=ve.current)==null?void 0:Gt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Rt=new Date().getTime()-((rr=$e.current)==null?void 0:rr.getTime()),Pt=B==="x"?mt:Nt,rt=Math.abs(Pt)/Rt;if(Math.abs(Pt)>=jue||rt>.11){ye(Ge.current),d.onDismiss==null||d.onDismiss.call(d,d),U(B==="x"?mt>0?"right":"left":Nt>0?"down":"up"),Ht(),te(!0);return}else{var nr,en;(nr=ve.current)==null||nr.style.setProperty("--swipe-amount-x","0px"),(en=ve.current)==null||en.style.setProperty("--swipe-amount-y","0px")}ie(!1),q(!1),G(null)},onPointerMove:tt=>{var Gt,rr,mt;if(!Ke.current||!ce||((Gt=window.getSelection())==null?void 0:Gt.toString().length)>0)return;const Rt=tt.clientY-Ke.current.y,Pt=tt.clientX-Ke.current.x;var rt;const nr=(rt=e.swipeDirections)!=null?rt:Lue(D);!B&&(Math.abs(Pt)>1||Math.abs(Rt)>1)&&G(Math.abs(Pt)>Math.abs(Rt)?"x":"y");let en={x:0,y:0};const un=pn=>1/(1.5+Math.abs(pn)/20);if(B==="y"){if(nr.includes("top")||nr.includes("bottom"))if(nr.includes("top")&&Rt<0||nr.includes("bottom")&&Rt>0)en.y=Rt;else{const pn=Rt*un(Rt);en.y=Math.abs(pn)<Math.abs(Rt)?pn:Rt}}else if(B==="x"&&(nr.includes("left")||nr.includes("right")))if(nr.includes("left")&&Pt<0||nr.includes("right")&&Pt>0)en.x=Pt;else{const pn=Pt*un(Pt);en.x=Math.abs(pn)<Math.abs(Pt)?pn:Pt}(Math.abs(en.x)>0||Math.abs(en.y)>0)&&ie(!0),(rr=ve.current)==null||rr.style.setProperty("--swipe-amount-x",`${en.x}px`),(mt=ve.current)==null||mt.style.setProperty("--swipe-amount-y",`${en.y}px`)}},st&&!d.jsx&&ae!=="loading"?se.createElement("button",{"aria-label":W,"data-disabled":lt,"data-close-button":!0,onClick:lt||!ce?()=>{}:()=>{Ht(),d.onDismiss==null||d.onDismiss.call(d,d)},className:Qo($?.closeButton,d==null||(n=d.classNames)==null?void 0:n.closeButton)},(kt=F?.close)!=null?kt:bue):null,(ae||d.icon||d.promise)&&d.icon!==null&&(F?.[ae]!==null||d.icon)?se.createElement("div",{"data-icon":"",className:Qo($?.icon,d==null||(i=d.classNames)==null?void 0:i.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||pt():null,d.type!=="loading"?Pr:null):null,se.createElement("div",{"data-content":"",className:Qo($?.content,d==null||(s=d.classNames)==null?void 0:s.content)},se.createElement("div",{"data-title":"",className:Qo($?.title,d==null||(o=d.classNames)==null?void 0:o.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?se.createElement("div",{"data-description":"",className:Qo(L,Ee,$?.description,d==null||(a=d.classNames)==null?void 0:a.description)},typeof d.description=="function"?d.description():d.description):null),se.isValidElement(d.cancel)?d.cancel:d.cancel&&Fb(d.cancel)?se.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||A,onClick:tt=>{Fb(d.cancel)&&ce&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,tt),Ht())},className:Qo($?.cancelButton,d==null||(l=d.classNames)==null?void 0:l.cancelButton)},d.cancel.label):null,se.isValidElement(d.action)?d.action:d.action&&Fb(d.action)?se.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||j,onClick:tt=>{Fb(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,tt),!tt.defaultPrevented&&Ht())},className:Qo($?.actionButton,d==null||(u=d.classNames)==null?void 0:u.actionButton)},d.action.label):null)};function r4(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function Iue(e,t){const r={};return[e,t].forEach((n,i)=>{const s=i===1,o=s?"--mobile-offset":"--offset",a=s?Aue:kue;function l(u){["top","right","bottom","left"].forEach(h=>{r[`${o}-${h}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?l(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${o}-${u}`]=a:r[`${o}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):l(a)}),r}const Nue=se.forwardRef(function(t,r){const{id:n,invert:i,position:s="bottom-right",hotkey:o=["altKey","KeyT"],expand:a,closeButton:l,className:u,offset:h,mobileOffset:d,theme:p="light",richColors:v,duration:S,style:_,visibleToasts:m=Tue,toastOptions:x,dir:b=r4(),gap:w=Pue,icons:O,containerAriaLabel:E="Notifications"}=t,[T,R]=se.useState([]),A=se.useMemo(()=>n?T.filter(Y=>Y.toasterId===n):T.filter(Y=>!Y.toasterId),[T,n]),j=se.useMemo(()=>Array.from(new Set([s].concat(A.filter(Y=>Y.position).map(Y=>Y.position)))),[A,s]),[I,L]=se.useState([]),[z,D]=se.useState(!1),[V,H]=se.useState(!1),[$,F]=se.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=se.useRef(null),B=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),G=se.useRef(null),N=se.useRef(!1),U=se.useCallback(Y=>{R(Q=>{var J;return(J=Q.find(re=>re.id===Y.id))!=null&&J.delete||Wi.dismiss(Y.id),Q.filter(({id:re})=>re!==Y.id)})},[]);return se.useEffect(()=>Wi.subscribe(Y=>{if(Y.dismiss){requestAnimationFrame(()=>{R(Q=>Q.map(J=>J.id===Y.id?{...J,delete:!0}:J))});return}setTimeout(()=>{wre.flushSync(()=>{R(Q=>{const J=Q.findIndex(re=>re.id===Y.id);return J!==-1?[...Q.slice(0,J),{...Q[J],...Y},...Q.slice(J+1)]:[Y,...Q]})})})}),[T]),se.useEffect(()=>{if(p!=="system"){F(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?F("dark"):F("light")),typeof window>"u")return;const Y=window.matchMedia("(prefers-color-scheme: dark)");try{Y.addEventListener("change",({matches:Q})=>{F(Q?"dark":"light")})}catch{Y.addListener(({matches:J})=>{try{F(J?"dark":"light")}catch(re){console.error(re)}})}},[p]),se.useEffect(()=>{T.length<=1&&D(!1)},[T]),se.useEffect(()=>{const Y=Q=>{var J;if(o.every(q=>Q[q]||Q.code===q)){var X;D(!0),(X=W.current)==null||X.focus()}Q.code==="Escape"&&(document.activeElement===W.current||(J=W.current)!=null&&J.contains(document.activeElement))&&D(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[o]),se.useEffect(()=>{if(W.current)return()=>{G.current&&(G.current.focus({preventScroll:!0}),G.current=null,N.current=!1)}},[W.current]),se.createElement("section",{ref:r,"aria-label":`${E} ${B}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},j.map((Y,Q)=>{var J;const[re,X]=Y.split("-");return A.length?se.createElement("ol",{key:Y,dir:b==="auto"?r4():b,tabIndex:-1,ref:W,className:u,"data-sonner-toaster":!0,"data-sonner-theme":$,"data-y-position":re,"data-x-position":X,style:{"--front-toast-height":`${((J=I[0])==null?void 0:J.height)||0}px`,"--width":`${Rue}px`,"--gap":`${w}px`,..._,...Iue(h,d)},onBlur:q=>{N.current&&!q.currentTarget.contains(q.relatedTarget)&&(N.current=!1,G.current&&(G.current.focus({preventScroll:!0}),G.current=null))},onFocus:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||N.current||(N.current=!0,G.current=q.relatedTarget)},onMouseEnter:()=>D(!0),onMouseMove:()=>D(!0),onMouseLeave:()=>{V||D(!1)},onDragEnd:()=>D(!1),onPointerDown:q=>{q.target instanceof HTMLElement&&q.target.dataset.dismissible==="false"||H(!0)},onPointerUp:()=>H(!1)},A.filter(q=>!q.position&&Q===0||q.position===Y).map((q,Z)=>{var te,ne;return se.createElement(Due,{key:q.id,icons:O,index:Z,toast:q,defaultRichColors:v,duration:(te=x?.duration)!=null?te:S,className:x?.className,descriptionClassName:x?.descriptionClassName,invert:i,visibleToasts:m,closeButton:(ne=x?.closeButton)!=null?ne:l,interacting:V,position:Y,style:x?.style,unstyled:x?.unstyled,classNames:x?.classNames,cancelButtonStyle:x?.cancelButtonStyle,actionButtonStyle:x?.actionButtonStyle,closeButtonAriaLabel:x?.closeButtonAriaLabel,removeToast:U,toasts:A.filter(ie=>ie.position==q.position),heights:I.filter(ie=>ie.position==q.position),setHeights:L,expandByDefault:a,gap:w,expanded:z,swipeDirections:t.swipeDirections})})):null}))});let oE=[];typeof window<"u"&&window.addEventListener("beforeunload",()=>{if(oE.length>0){const e=JSON.stringify({entries:oE});navigator.sendBeacon("/api/logs",e),oE=[]}});const sW={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},child:()=>sW};function Df(e){return sW}const Tt={terminal:Df(),terminalsView:Df(),ws:Df(),taskTerminal:Df(),kanban:Df(),viewer:Df()};function Bue(e){const t=/\/[\w\-/.]+\.(png|jpg|jpeg|gif|webp|svg)/gi;return[...e.match(t)||[]]}function n4(e){return`/api/uploads/${e.split("/").pop()}`}function oW({value:e,onValueChange:t,className:r,disabled:n,...i}){const[s,o]=k.useState(!1),a=k.useRef(null),l=Bue(e),u=async h=>{const d=h.clipboardData?.items;if(d){for(const p of d)if(p.type.startsWith("image/")){h.preventDefault();const v=p.getAsFile();if(!v)return;o(!0);try{const S=await iW(v),_=a.current;if(_){const m=_.selectionStart,x=_.selectionEnd,b=e.slice(0,m),w=e.slice(x),O=b&&!b.endsWith(`
22
22
  `)?`
23
23
  `:"",E=w&&!w.startsWith(`
24
24
  `)?`
25
25
  `:"",T=b+O+S+E+w;t(T)}else t(e+(e?`
26
- `:"")+S)}catch(S){Jt.error("Failed to upload image"),Tt.kanban.error("Upload error",{error:String(S)})}finally{o(!1)}return}}};return y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"relative",children:[y.jsx(hx,{ref:a,value:e,onChange:h=>t(h.target.value),onPaste:u,className:Me(s&&"opacity-50",r),disabled:s||n,...i}),s&&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((h,d)=>y.jsx("a",{href:n4(h),target:"_blank",rel:"noopener noreferrer",className:"block",children:y.jsx("img",{src:n4(h),alt:`Attachment ${d+1}`,className:"h-16 w-auto rounded border object-cover hover:opacity-80 transition-opacity"})},d))})]})}function aW({className:e,...t}){return y.jsx("label",{"data-slot":"label",className:Me("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 $ue=k.forwardRef(function(t,r){const{className:n,render:i,orientation:s="horizontal",...o}=t,a=k.useMemo(()=>({orientation:s}),[s]);return dt("div",t,{state:a,ref:r,props:[{role:"separator","aria-orientation":s},o]})});function zue({className:e,orientation:t="horizontal",...r}){return y.jsx($ue,{"data-slot":"separator",orientation:t,className:Me("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),...r})}function pl({className:e,...t}){return y.jsx("div",{"data-slot":"field-group",className:Me("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 Hue=nu("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 mr({className:e,orientation:t="vertical",...r}){return y.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:Me(Hue({orientation:t}),e),...r})}function gr({className:e,...t}){return y.jsx(aW,{"data-slot":"field-label",className:Me("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 Oi({className:e,...t}){return y.jsx("p",{"data-slot":"field-description",className:Me("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 lW(e){const t=k.useRef(!0);t.current&&(t.current=!1,e())}const cW=k.createContext(null),uW=k.createContext(null);function Aa(){const e=k.useContext(cW);if(e===null)throw new Error(er(60));return e}function dW(){const e=k.useContext(uW);if(e===null)throw new Error(er(61));return e}const fW=(e,t)=>Object.is(e,t);function wl(e,t,r){return e==null||t==null?Object.is(e,t):r(e,t)}function Zu(e,t,r){return!e||e.length===0?!1:e.some(n=>n===void 0?!1:wl(n,t,r))}function _h(e,t,r){return!e||e.length===0?-1:e.findIndex(n=>n===void 0?!1:wl(n,t,r))}function hW(e,t,r){return e.filter(n=>!wl(n,t,r))}function OA(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function pW(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function An(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 OA(e)}function Eo(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?OA(e.value):OA(e)}function Fue(e,t,r){if(r&&e!=null)return r(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??An(e,r);if(Array.isArray(t)){const n=pW(t)?t.flatMap(i=>i.items):t;if(e==null){const i=n.find(s=>s.value==null);return i&&i.label!=null?i.label:An(e,r)}if(typeof e!="object"){const i=n.find(s=>s&&s.value===e);return i&&i.label!=null?i.label:An(e,r)}if("value"in e){const i=n.find(s=>s&&s.value===e.value);if(i&&i.label!=null)return i.label}}return An(e,r)}function Uue(e,t){return!Array.isArray(e)||e.length===0?"":e.map(r=>An(r,t)).join(", ")}const Ct={id:ke(e=>e.id),modal:ke(e=>e.modal),multiple:ke(e=>e.multiple),items:ke(e=>e.items),itemToStringLabel:ke(e=>e.itemToStringLabel),itemToStringValue:ke(e=>e.itemToStringValue),isItemEqualToValue:ke(e=>e.isItemEqualToValue),value:ke(e=>e.value),open:ke(e=>e.open),mounted:ke(e=>e.mounted),forceMount:ke(e=>e.forceMount),transitionStatus:ke(e=>e.transitionStatus),openMethod:ke(e=>e.openMethod),activeIndex:ke(e=>e.activeIndex),selectedIndex:ke(e=>e.selectedIndex),isActive:ke((e,t)=>e.activeIndex===t),isSelected:ke((e,t,r)=>{const n=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(s=>wl(s,r,n)):e.selectedIndex===t&&e.selectedIndex!==null?!0:wl(i,r,n)}),isSelectedByFocus:ke((e,t)=>e.selectedIndex===t),popupProps:ke(e=>e.popupProps),triggerProps:ke(e=>e.triggerProps),triggerElement:ke(e=>e.triggerElement),positionerElement:ke(e=>e.positionerElement),listElement:ke(e=>e.listElement),scrollUpArrowVisible:ke(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:ke(e=>e.scrollDownArrowVisible),hasScrollArrows:ke(e=>e.hasScrollArrows),serializedValue:ke(e=>{const{multiple:t,value:r,itemToStringValue:n}=e;return t&&Array.isArray(r)&&r.length===0?"":Eo(r,n)})};function Ju(e,t){const r=k.useRef(e),n=Be(t);He(()=>{r.current!==e&&n(r.current)},[e,n]),He(()=>{r.current=e},[e])}function Vue(e){const{id:t,value:r,defaultValue:n=null,onValueChange:i,open:s,defaultOpen:o=!1,onOpenChange:a,name:l,disabled:u=!1,readOnly:h=!1,required:d=!1,modal:p=!0,actionsRef:v,inputRef:S,onOpenChangeComplete:_,items:m,multiple:x=!1,itemToStringLabel:b,itemToStringValue:w,isItemEqualToValue:O=fW,highlightItemOnHover:E=!0,children:T}=e,{clearErrors:R}=$v(),{setDirty:A,shouldValidateOnChange:j,validityData:I,setFilled:L,name:z,disabled:D,validation:V}=uo(),{controlId:H}=au(),$=fx({id:t}),F=D||u,W=z??l,[B,G]=Os({controlled:r,default:x?n??ki:n,name:"Select",state:"value"}),[N,U]=Os({controlled:s,default:o,name:"Select",state:"open"}),Y=k.useRef([]),Q=k.useRef([]),J=k.useRef(null),re=k.useRef(null),X=k.useRef(0),q=k.useRef(null),Z=k.useRef([]),te=k.useRef(!1),ne=k.useRef(!1),ie=k.useRef(null),me=k.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ye=k.useRef(!1),{mounted:ue,setMounted:he,transitionStatus:fe}=$o(N),{openMethod:$e,triggerProps:ve,reset:De}=dx(N),_e=ti(()=>new dd({id:$,modal:p,multiple:x,itemToStringLabel:b,itemToStringValue:w,isItemEqualToValue:O,value:B,open:N,mounted:ue,transitionStatus:fe,items:m,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ae=Ie(_e,Ct.activeIndex),ce=Ie(_e,Ct.selectedIndex),be=Ie(_e,Ct.triggerElement),Ee=Ie(_e,Ct.positionerElement),Ve=k.useMemo(()=>x&&Array.isArray(B)&&B.length===0?"":Eo(B,w),[x,B,w]),st=k.useMemo(()=>x&&Array.isArray(B)?B.map(mt=>Eo(mt,w)):Eo(B,w),[x,B,w]),Re=Fr(_e.state.triggerElement);zv({id:$,commit:V.commit,value:B,controlRef:Re,name:W,getValue:()=>st});const We=k.useRef(B);He(()=>{B!==We.current&&_e.set("forceMount",!0)},[_e,B]),He(()=>{L(B!==null)},[B,L]),He(function(){if(N)return;const Nt=Z.current;if(x){const Pt=Array.isArray(B)?B:[];if(Pt.length===0){_e.set("selectedIndex",null);return}const rt=Pt[Pt.length-1],nr=_h(Nt,rt,O);_e.set("selectedIndex",nr===-1?null:nr);return}const Rt=_h(Nt,B,O);_e.set("selectedIndex",Rt===-1?null:Rt)},[x,N,B,Z,O,_e]),Ju(B,()=>{R(W),A(B!==I.initialValue),j()?V.commit(B):V.commit(B,!0)});const Ge=Be((mt,Nt)=>{if(a?.(mt,Nt),!Nt.isCanceled&&(U(mt),!mt&&_e.state.activeIndex!==null)){const Rt=Y.current[_e.state.activeIndex];queueMicrotask(()=>{Rt?.setAttribute("tabindex","-1")})}}),vt=Be(()=>{he(!1),_e.set("activeIndex",null),De(),_?.(!1)});gi({enabled:!v,open:N,ref:J,onComplete(){N||vt()}}),k.useImperativeHandle(v,()=>({unmount:vt}),[vt]);const Ke=Be((mt,Nt)=>{i?.(mt,Nt),!Nt.isCanceled&&G(mt)}),Qe=Be(()=>{const mt=_e.state.listElement||J.current;if(!mt)return;const Nt=mt.scrollTop,Rt=mt.scrollTop+mt.clientHeight,Pt=Nt>1,rt=Rt<mt.scrollHeight-1;_e.state.scrollUpArrowVisible!==Pt&&_e.set("scrollUpArrowVisible",Pt),_e.state.scrollDownArrowVisible!==rt&&_e.set("scrollDownArrowVisible",rt)}),Ae=J1({open:N,onOpenChange:Ge,elements:{reference:be,floating:Ee}}),ot=dp(Ae,{enabled:!h&&!F,event:"mousedown"}),ft=Pv(Ae,{bubbles:!1}),Je=cj(Ae,{enabled:!h&&!F,listRef:Y,activeIndex:ae,selectedIndex:ce,disabledIndices:ki,onNavigate(mt){mt===null&&!N||_e.set("activeIndex",mt)},focusItemOnHover:!1}),lt=uj(Ae,{enabled:!h&&!F&&(N||!x),listRef:Q,activeIndex:ae,selectedIndex:ce,onMatch(mt){N?_e.set("activeIndex",mt):Ke(Z.current[mt],Ue("none"))},onTypingChange(mt){te.current=mt}}),{getReferenceProps:Ht,getFloatingProps:pt,getItemProps:Pr}=Nd([ot,ft,Je,lt]),It=k.useMemo(()=>ya(Ht(),ve),[Ht,ve]);lW(()=>{_e.update({popupProps:pt(),triggerProps:It})}),He(()=>{_e.update({id:$,modal:p,multiple:x,value:B,open:N,mounted:ue,transitionStatus:fe,popupProps:pt(),triggerProps:It,items:m,itemToStringLabel:b,itemToStringValue:w,isItemEqualToValue:O,openMethod:$e})},[_e,$,p,x,B,N,ue,fe,pt,It,m,b,w,O,$e]);const kt=k.useMemo(()=>({store:_e,name:W,required:d,disabled:F,readOnly:h,multiple:x,itemToStringLabel:b,itemToStringValue:w,highlightItemOnHover:E,setValue:Ke,setOpen:Ge,listRef:Y,popupRef:J,scrollHandlerRef:re,handleScrollArrowVisibility:Qe,scrollArrowsMountedCountRef:X,getItemProps:Pr,events:Ae.context.events,valueRef:q,valuesRef:Z,labelsRef:Q,typingRef:te,selectionRef:me,selectedItemTextRef:ie,validation:V,onOpenChangeComplete:_,keyboardActiveRef:ne,alignItemWithTriggerActiveRef:ye,initialValueRef:We}),[_e,W,d,F,h,x,b,w,E,Ke,Ge,Pr,Ae.context.events,V,_,Qe]),tt=co(S,V.inputRef),Gt=x&&Array.isArray(B)&&B.length>0,rr=k.useMemo(()=>!x||!Array.isArray(B)||!W?null:B.map(mt=>{const Nt=Eo(mt,w);return y.jsx("input",{type:"hidden",name:W,value:Nt},Nt)}),[x,B,W,w]);return y.jsx(cW.Provider,{value:kt,children:y.jsxs(uW.Provider,{value:Ae,children:[T,y.jsx("input",{...V.getInputValidationProps({onFocus(){_e.state.triggerElement?.focus()},onChange(mt){if(mt.nativeEvent.defaultPrevented)return;const Nt=mt.target.value,Rt=Ue(Pn,mt.nativeEvent);function Pt(){if(x)return;const rt=Z.current.find(nr=>Eo(nr,w).toLowerCase()===Nt.toLowerCase());rt!=null&&(A(rt!==I.initialValue),Ke(rt,Rt),j()&&V.commit(rt))}_e.set("forceMount",!0),queueMicrotask(Pt)}}),id:t||H||void 0,name:x?void 0:W,value:Ve,disabled:F,required:d&&!Gt,readOnly:h,ref:tt,style:up,tabIndex:-1,"aria-hidden":!0}),rr]})})}function Cj(e){const t=e.getBoundingClientRect(),r=window.getComputedStyle(e,"::before"),n=window.getComputedStyle(e,"::after");if(!(r.content!=="none"||n.content!=="none"))return t;const s=parseFloat(r.width)||0,o=parseFloat(r.height)||0,a=parseFloat(n.width)||0,l=parseFloat(n.height)||0,u=Math.max(t.width,s,a),h=Math.max(t.height,o,l),d=u-t.width,p=h-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const Ub=2,Wue={...yh,...zd,value:()=>null},que=k.forwardRef(function(t,r){const{render:n,className:i,disabled:s=!1,nativeButton:o=!0,...a}=t,{setTouched:l,setFocused:u,validationMode:h,state:d,disabled:p}=uo(),{labelId:v}=au(),{store:S,setOpen:_,selectionRef:m,validation:x,readOnly:b,alignItemWithTriggerActiveRef:w,disabled:O,keyboardActiveRef:E}=Aa(),T=p||O||s,R=Ie(S,Ct.open),A=Ie(S,Ct.value),j=Ie(S,Ct.triggerProps),I=Ie(S,Ct.positionerElement),L=Ie(S,Ct.listElement),z=Ie(S,Ct.serializedValue),D=Fr(I),V=k.useRef(null),H=Sr(),$=Sr(),{getButtonProps:F,buttonRef:W}=Di({disabled:T,native:o}),B=Be(re=>{S.set("triggerElement",re)}),G=co(r,V,W,B),N=Sr(),U=Sr();k.useEffect(()=>{if(R)return U.start(200,()=>{m.current.allowUnselectedMouseUp=!0,N.start(200,()=>{m.current.allowSelectedMouseUp=!0})}),()=>{N.clear(),U.clear()};m.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},$.clear()},[R,m,$,N,U]);const Y=k.useMemo(()=>L?.id??xg(I)?.id,[L,I]),Q=ya(j,{role:"combobox","aria-expanded":R?"true":"false","aria-haspopup":"listbox","aria-controls":R?Y:void 0,"aria-labelledby":v,"aria-readonly":b||void 0,tabIndex:T?-1:0,ref:G,onFocus(re){u(!0),R&&w.current&&_(!1,Ue(Lo,re.nativeEvent)),H.start(0,()=>{S.set("forceMount",!0)})},onBlur(){l(!0),u(!1),h==="onBlur"&&x.commit(A)},onPointerMove(){E.current=!1},onKeyDown(){E.current=!0},onMouseDown(re){if(R)return;const X=ri(re.currentTarget);function q(Z){if(!V.current)return;const te=Z.target;if(ut(V.current,te)||ut(D.current,te)||te===V.current)return;const ne=Cj(V.current);Z.clientX>=ne.left-Ub&&Z.clientX<=ne.right+Ub&&Z.clientY>=ne.top-Ub&&Z.clientY<=ne.bottom+Ub||_(!1,Ue(XU,Z))}$.start(0,()=>{X.addEventListener("mouseup",q,{once:!0})})}},x.getValidationProps,a,F);Q.role="combobox";const J=k.useMemo(()=>({...d,open:R,disabled:T,value:A,readOnly:b,placeholder:!z}),[d,R,T,A,b,z]);return dt("button",t,{ref:[r,V],state:J,stateAttributesMapping:Wue,props:Q})}),Gue={value:()=>null},Kue=k.forwardRef(function(t,r){const{className:n,render:i,children:s,...o}=t,{store:a,valueRef:l}=Aa(),u=Ie(a,Ct.value),h=Ie(a,Ct.items),d=Ie(a,Ct.itemToStringLabel),p=Ie(a,Ct.serializedValue),v=k.useMemo(()=>({value:u,placeholder:!p}),[u,p]),S=typeof s=="function"?s(u):s??(Array.isArray(u)?Uue(u,d):Fue(u,h,d));return dt("span",t,{state:v,ref:[r,l],props:[{children:S},o],stateAttributesMapping:Gue})}),Yue=k.forwardRef(function(t,r){const{className:n,render:i,...s}=t,{store:o}=Aa(),a=Ie(o,Ct.open),l=k.useMemo(()=>({open:a}),[a]);return dt("span",t,{state:l,ref:r,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:fj})}),Xue=k.createContext(void 0),Que=k.forwardRef(function(t,r){const{store:n}=Aa(),i=Ie(n,Ct.mounted),s=Ie(n,Ct.forceMount);return i||s?y.jsx(Xue.Provider,{value:!0,children:y.jsx(Rv,{ref:r,...t})}):null}),mW=k.createContext(void 0);function Ej(){const e=k.useContext(mW);if(!e)throw new Error(er(59));return e}function o_(e,t){e&&Object.assign(e.style,t)}const gW={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Zue={position:"fixed"},Jue=k.forwardRef(function(t,r){const{anchor:n,positionMethod:i="absolute",className:s,render:o,side:a="bottom",align:l="center",sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:_,alignItemWithTrigger:m=!0,collisionAvoidance:x=W1,...b}=t,{store:w,listRef:O,labelsRef:E,alignItemWithTriggerActiveRef:T,selectedItemTextRef:R,valuesRef:A,initialValueRef:j,popupRef:I,setValue:L}=Aa(),z=dW(),D=Ie(w,Ct.open),V=Ie(w,Ct.mounted),H=Ie(w,Ct.modal),$=Ie(w,Ct.value),F=Ie(w,Ct.openMethod),W=Ie(w,Ct.positionerElement),B=Ie(w,Ct.triggerElement),G=Ie(w,Ct.isItemEqualToValue),N=k.useRef(null),U=k.useRef(null),[Y,Q]=k.useState(m),J=V&&Y&&F!=="touch";!V&&Y!==m&&Q(m),He(()=>{V||(Ct.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),Ct.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,V]),k.useImperativeHandle(T,()=>J),ux((J||H)&&D&&F!=="touch",B);const re=ix({anchor:n,floatingRootContext:z,positionMethod:i,mounted:V,side:a,sideOffset:u,align:l,alignOffset:h,arrowPadding:v,collisionBoundary:d,collisionPadding:p,sticky:S,disableAnchorTracking:_??J,collisionAvoidance:x,keepMounted:!0}),X=J?"none":re.side,q=J?Zue:re.positionerStyles,Z=k.useMemo(()=>{const he={};return D||(he.pointerEvents="none"),{role:"presentation",hidden:!V,style:{...q,...he}}},[D,V,q]),te=k.useMemo(()=>({open:D,side:X,align:re.align,anchorHidden:re.anchorHidden}),[D,X,re.align,re.anchorHidden]),ne=Be(he=>{w.set("positionerElement",he)}),ie=dt("div",t,{ref:[r,ne],state:te,stateAttributesMapping:zo,props:[Z,b]}),me=k.useRef(0),ye=Be(he=>{if(he.size===0&&me.current===0||A.current.length===0)return;const fe=me.current;if(me.current=he.size,he.size===fe)return;const $e=Ue(Pn);if(fe!==0&&!w.state.multiple&&$!==null&&_h(A.current,$,G)===-1){const De=j.current,ae=De!=null&&Zu(A.current,De,G)?De:null;L(ae,$e),ae===null&&(w.set("selectedIndex",null),R.current=null)}if(fe!==0&&w.state.multiple&&Array.isArray($)){const ve=$.filter(De=>Zu(A.current,De,G));(ve.length!==$.length||ve.some(De=>!Zu($,De,G)))&&(L(ve,$e),ve.length===0&&(w.set("selectedIndex",null),R.current=null))}if(D&&J){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ve={height:""};o_(W,ve),o_(I.current,ve)}}),ue=k.useMemo(()=>({...re,side:X,alignItemWithTriggerActive:J,setControlledAlignItemWithTrigger:Q,scrollUpArrowRef:N,scrollDownArrowRef:U}),[re,X,J,Q]);return y.jsx(jv,{elementsRef:O,labelsRef:E,onMapChange:ye,children:y.jsxs(mW.Provider,{value:ue,children:[V&&H&&y.jsx(cx,{inert:fp(!D),cutout:B}),ie]})})});function vW(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 Vb="base-ui-disable-scrollbar",Eg={className:Vb,element:y.jsx("style",{href:Vb,precedence:"base-ui:low",children:`.${Vb}{scrollbar-width:none}.${Vb}::-webkit-scrollbar{display:none}`})},ede=k.createContext(void 0);function Oj(e){return k.useContext(ede)}const tde={...zo,...ho},rde=k.forwardRef(function(t,r){const{render:n,className:i,...s}=t,{store:o,popupRef:a,onOpenChangeComplete:l,setOpen:u,valueRef:h,selectedItemTextRef:d,keyboardActiveRef:p,multiple:v,handleScrollArrowVisibility:S,scrollHandlerRef:_}=Aa(),{side:m,align:x,alignItemWithTriggerActive:b,setControlledAlignItemWithTrigger:w,scrollDownArrowRef:O,scrollUpArrowRef:E}=Ej(),T=Oj()!=null,R=dW(),A=Sr(),j=Ie(o,Ct.id),I=Ie(o,Ct.open),L=Ie(o,Ct.mounted),z=Ie(o,Ct.popupProps),D=Ie(o,Ct.transitionStatus),V=Ie(o,Ct.triggerElement),H=Ie(o,Ct.positionerElement),$=Ie(o,Ct.listElement),F=k.useRef(0),W=k.useRef(!1),B=k.useRef(0),G=k.useRef(!1),N=k.useRef({}),U=Ic(),Y=Be(X=>{if(!H||!a.current||!G.current)return;if(W.current||!b){S();return}const q=H.style.top==="0px",Z=H.style.bottom==="0px",te=H.getBoundingClientRect().height,ne=ri(H),ie=getComputedStyle(H),me=parseFloat(ie.marginTop),ye=parseFloat(ie.marginBottom),ue=ne.documentElement.clientHeight-me-ye,he=X.scrollTop,fe=X.scrollHeight,$e=X.clientHeight,ve=fe-$e;let De=null,_e=null,ae=!1;if(q){const ce=ve-he,be=te+ce,Ee=Math.min(be,ue);De=Ee,Ee!==ue?_e=ve:ae=!0}else if(Z){const ce=he-0,be=te+ce,Ee=Math.min(be,ue),Ve=be-ue;De=Ee,Ee!==ue?_e=0:(ae=!0,he<ve&&(_e=he-(ce-Ve)))}De!=null&&(H.style.height=`${De}px`),_e!=null&&(X.scrollTop=_e),ae&&(W.current=!0),S()});k.useImperativeHandle(_,()=>Y,[Y]),gi({open:I,ref:a,onComplete(){I&&l?.(!0)}});const Q=k.useMemo(()=>({open:I,transitionStatus:D,side:m,align:x}),[I,D,m,x]);He(()=>{!H||!a.current||Object.keys(N.current).length||(N.current={top:H.style.top||"0",left:H.style.left||"0",right:H.style.right,height:H.style.height,bottom:H.style.bottom,minHeight:H.style.minHeight,maxHeight:H.style.maxHeight,marginTop:H.style.marginTop,marginBottom:H.style.marginBottom})},[a,H]),He(()=>{L||b||(G.current=!1,W.current=!1,F.current=0,B.current=0,o_(H,N.current))},[L,b,H,a]),He(()=>{const X=a.current;if(!(!L||!V||!H||!X)){if(!b){G.current=!0,U.request(S);return}queueMicrotask(()=>{const q=getComputedStyle(H),Z=getComputedStyle(X),te=ri(V),ne=cn(H),ie=V.getBoundingClientRect(),me=H.getBoundingClientRect(),ye=ie.left,ue=ie.height,he=$||X,fe=he.scrollHeight,$e=parseFloat(Z.borderBottomWidth),ve=parseFloat(q.marginTop)||10,De=parseFloat(q.marginBottom)||10,_e=parseFloat(q.minHeight)||100,ae=5,ce=5,be=20,Ee=te.documentElement.clientHeight-ve-De,Ve=te.documentElement.clientWidth,st=Ee-ie.bottom+ue,Re=d.current,We=h.current;let Ge=0,vt=0;if(Re&&We){const kt=We.getBoundingClientRect(),tt=Re.getBoundingClientRect(),Gt=kt.left-ye,rr=tt.left-me.left,mt=kt.top-ie.top+kt.height/2,Nt=tt.top-me.top+tt.height/2;Ge=Gt-rr,vt=Nt-mt}const Ke=st+vt+De+$e;let Qe=Math.min(Ee,Ke);const Ae=Ee-ve-De,ot=Ke-Qe,ft=Math.max(ae,ye+Ge),Je=Ve-ce,lt=Math.max(0,ft+me.width-Je);H.style.left=`${ft-lt}px`,H.style.height=`${Qe}px`,H.style.maxHeight="auto",H.style.marginTop=`${ve}px`,H.style.marginBottom=`${De}px`,X.style.height="100%";const Ht=he.scrollHeight-he.clientHeight,pt=ot>=Ht;pt&&(Qe=Math.min(Ee,me.height)-(ot-Ht));const Pr=ie.top<be||ie.bottom>Ee-be||Qe<Math.min(fe,_e),It=(ne.visualViewport?.scale??1)!==1&&YP;if(Pr||It){G.current=!0,o_(H,N.current),hn.flushSync(()=>w(!1));return}if(pt){const kt=Math.max(0,Ee-Ke);H.style.top=me.height>=Ae?"0":`${kt}px`,H.style.height=`${Qe}px`,he.scrollTop=he.scrollHeight-he.clientHeight,F.current=Math.max(_e,Qe)}else H.style.bottom="0",F.current=Math.max(_e,Qe),he.scrollTop=ot;F.current===Ee&&(W.current=!0),S(),setTimeout(()=>{G.current=!0})})}},[o,L,H,V,h,d,a,S,b,w,U,O,E,$]),k.useEffect(()=>{if(!b||!H||!L)return;const X=cn(H);function q(Z){u(!1,Ue(Roe,Z))}return X.addEventListener("resize",q),()=>{X.removeEventListener("resize",q)}},[u,b,H,L]);const J={...$?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":v||void 0,id:`${j}-list`},onKeyDown(X){p.current=!0,T&&dj.has(X.key)&&X.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(X){if(vW(X)||X.pointerType==="touch")return;const q=X.currentTarget;A.start(0,()=>{o.set("activeIndex",null),q.focus({preventScroll:!0})})},onScroll(X){$||_.current?.(X.currentTarget)},...b&&{style:$?{height:"100%"}:gW}},re=dt("div",t,{ref:[r,a],state:Q,stateAttributesMapping:tde,props:[z,J,sx(D),{className:!$&&b?Eg.className:void 0},s]});return y.jsxs(k.Fragment,{children:[Eg.element,y.jsx(Y1,{context:R,modal:!1,disabled:!L,restoreFocus:!0,children:re})]})}),nde=k.forwardRef(function(t,r){const{className:n,render:i,...s}=t,{store:o,scrollHandlerRef:a}=Aa(),{alignItemWithTriggerActive:l}=Ej(),u=Ie(o,Ct.hasScrollArrows),h=Ie(o,Ct.openMethod),d=Ie(o,Ct.multiple),v={id:`${Ie(o,Ct.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(_){a.current?.(_.currentTarget)},...l&&{style:gW},className:u&&h!=="touch"?Eg.className:void 0},S=Be(_=>{o.set("listElement",_)});return dt("div",t,{ref:[r,S],props:[v,s]})}),yW=k.createContext(void 0);function Tj(){const e=k.useContext(yW);if(!e)throw new Error(er(57));return e}const ide=k.memo(k.forwardRef(function(t,r){const{render:n,className:i,value:s=null,label:o,disabled:a=!1,nativeButton:l=!1,...u}=t,h=k.useRef(null),d=hp({label:o,textRef:h,indexGuessBehavior:hj.GuessFromOrder}),{store:p,getItemProps:v,setOpen:S,setValue:_,selectionRef:m,typingRef:x,valuesRef:b,keyboardActiveRef:w,multiple:O,highlightItemOnHover:E}=Aa(),T=Sr(),R=Ie(p,Ct.isActive,d.index),A=Ie(p,Ct.isSelected,d.index,s),j=Ie(p,Ct.isSelectedByFocus,d.index),I=Ie(p,Ct.isItemEqualToValue),L=d.index,z=L!==-1,D=k.useRef(null),V=Fr(L);He(()=>{if(!z)return;const re=b.current;return re[L]=s,()=>{delete re[L]}},[z,L,s,b]),He(()=>{if(!z)return;const re=p.state.value;let X=re;O&&Array.isArray(re)&&re.length>0&&(X=re[re.length-1]),X!==void 0&&wl(X,s,I)&&p.set("selectedIndex",L)},[z,L,O,I,p,s]);const H=k.useMemo(()=>({disabled:a,selected:A,highlighted:R}),[a,A,R]),$=v({active:R,selected:A});$.onFocus=void 0,$.id=void 0;const F=k.useRef(null),W=k.useRef("mouse"),B=k.useRef(!1),{getButtonProps:G,buttonRef:N}=Di({disabled:a,focusableWhenDisabled:!0,native:l});function U(re){const X=p.state.value;if(O){const q=Array.isArray(X)?X:[],Z=A?hW(q,s,I):[...q,s];_(Z,Ue(ud,re))}else _(s,Ue(ud,re)),S(!1,Ue(ud,re))}const Y={role:"option","aria-selected":A,"aria-disabled":a||void 0,tabIndex:R?0:-1,onFocus(){p.set("activeIndex",L)},onMouseEnter(){!w.current&&p.state.selectedIndex===null&&p.set("activeIndex",L)},onMouseMove(){E&&p.set("activeIndex",L)},onMouseLeave(re){!E||w.current||vW(re)||T.start(0,()=>{p.state.activeIndex===L&&p.set("activeIndex",null)})},onTouchStart(){m.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(re){F.current=re.key,p.set("activeIndex",L)},onClick(re){B.current=!1,!(re.type==="keydown"&&F.current===null)&&(a||F.current===" "&&x.current||W.current!=="touch"&&!R||(F.current=null,U(re.nativeEvent)))},onPointerEnter(re){W.current=re.pointerType},onPointerDown(re){W.current=re.pointerType,B.current=!0},onMouseUp(re){if(a)return;if(B.current){B.current=!1;return}const X=!m.current.allowSelectedMouseUp&&A,q=!m.current.allowUnselectedMouseUp&&!A;X||q||W.current!=="touch"&&!R||U(re.nativeEvent)}},Q=dt("div",t,{ref:[N,r,d.ref,D],state:H,props:[$,Y,u,G]}),J=k.useMemo(()=>({selected:A,indexRef:V,textRef:h,selectedByFocus:j,hasRegistered:z}),[A,V,h,j,z]);return y.jsx(yW.Provider,{value:J,children:Q})})),sde=k.forwardRef(function(t,r){const n=t.keepMounted??!1,{selected:i}=Tj();return n||i?y.jsx(ode,{...t,ref:r}):null}),ode=k.memo(k.forwardRef((e,t)=>{const{render:r,className:n,keepMounted:i,...s}=e,{selected:o}=Tj(),a=k.useRef(null),{transitionStatus:l,setMounted:u}=$o(o),h=k.useMemo(()=>({selected:o,transitionStatus:l}),[o,l]),d=dt("span",e,{ref:[t,a],state:h,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:ho});return gi({open:o,ref:a,onComplete(){o||u(!1)}}),d})),ade=k.memo(k.forwardRef(function(t,r){const{indexRef:n,textRef:i,selectedByFocus:s,hasRegistered:o}=Tj(),{selectedItemTextRef:a}=Aa(),{className:l,render:u,...h}=t,d=k.useCallback(v=>{if(!v||!o)return;const S=a.current===null||!a.current.isConnected;(s||S&&n.current===0)&&(a.current=v)},[a,n,s,o]);return dt("div",t,{ref:[d,r,i],props:h})})),bW=k.forwardRef(function(t,r){const{render:n,className:i,direction:s,keepMounted:o=!1,...a}=t,{store:l,popupRef:u,listRef:h,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:p}=Aa(),{side:v,scrollDownArrowRef:S,scrollUpArrowRef:_}=Ej(),m=s==="up"?Ct.scrollUpArrowVisible:Ct.scrollDownArrowVisible,x=Ie(l,m),b=Ie(l,Ct.openMethod),w=x&&b!=="touch",O=Sr(),E=s==="up"?_:S,{transitionStatus:T,setMounted:R}=$o(w);He(()=>(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]),gi({open:w,ref:E,onComplete(){w||R(!1)}});const A=k.useMemo(()=>({direction:s,visible:w,side:v,transitionStatus:T}),[s,w,v,T]),I=dt("div",t,{ref:[r,E],state:A,props:[{"aria-hidden":!0,children:s==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(z){if(z.movementX===0&&z.movementY===0||O.isStarted())return;l.set("activeIndex",null);function D(){const V=l.state.listElement??u.current;if(!V)return;l.set("activeIndex",null),d();const H=V.scrollTop===0,$=Math.round(V.scrollTop+V.clientHeight)>=V.scrollHeight;if(h.current.length===0&&(s==="up"?l.set("scrollUpArrowVisible",!H):l.set("scrollDownArrowVisible",!$)),s==="up"&&H||s==="down"&&$){O.clear();return}if((l.state.listElement||u.current)&&h.current&&h.current.length>0){const W=h.current,B=E.current?.offsetHeight||0;if(s==="up"){let G=0;const N=V.scrollTop+B;for(let Y=0;Y<W.length;Y+=1){const Q=W[Y];if(Q&&Q.offsetTop>=N){G=Y;break}}const U=Math.max(0,G-1);if(U<G){const Y=W[U];Y&&(V.scrollTop=Math.max(0,Y.offsetTop-B))}else V.scrollTop=0}else{let G=W.length-1;const N=V.scrollTop+V.clientHeight-B;for(let Y=0;Y<W.length;Y+=1){const Q=W[Y];if(Q&&Q.offsetTop+Q.offsetHeight>N){G=Math.max(0,Y-1);break}}const U=Math.min(W.length-1,G+1);if(U>G){const Y=W[U];Y&&(V.scrollTop=Y.offsetTop+Y.offsetHeight-V.clientHeight+B)}else V.scrollTop=V.scrollHeight-V.clientHeight}}O.start(40,D)}O.start(40,D)},onMouseLeave(){O.clear()}},a]});return w||o?I:null}),lde=k.forwardRef(function(t,r){return y.jsx(bW,{...t,ref:r,direction:"down"})}),cde=k.forwardRef(function(t,r){return y.jsx(bW,{...t,ref:r,direction:"up"})}),Ai=Vue;function Ri({className:e,...t}){return y.jsx(Kue,{"data-slot":"select-value",className:Me("flex flex-1 text-left",e),...t})}function Pi({className:e,size:t="default",children:r,...n}){return y.jsxs(que,{"data-slot":"select-trigger","data-size":t,className:Me("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),...n,children:[r,y.jsx(Yue,{render:y.jsx(pe,{icon:WV,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})})]})}function ji({className:e,children:t,side:r="bottom",sideOffset:n=4,align:i="center",alignOffset:s=0,alignItemWithTrigger:o=!0,...a}){return y.jsx(Que,{children:y.jsx(Jue,{side:r,sideOffset:n,align:i,alignOffset:s,alignItemWithTrigger:o,className:"isolate z-50",children:y.jsxs(rde,{"data-slot":"select-content",className:Me("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),...a,children:[y.jsx(ude,{}),y.jsx(nde,{children:t}),y.jsx(dde,{})]})})})}function pr({className:e,children:t,...r}){return y.jsxs(ide,{"data-slot":"select-item",className:Me("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),...r,children:[y.jsx(ade,{className:"flex flex-1 gap-2 shrink-0 whitespace-nowrap",children:t}),y.jsx(sde,{render:y.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:y.jsx(pe,{icon:Rl,strokeWidth:2,className:"pointer-events-none"})})]})}function ude({className:e,...t}){return y.jsx(cde,{"data-slot":"select-scroll-up-button",className:Me("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(pe,{icon:gj,strokeWidth:2})})}function dde({className:e,...t}){return y.jsx(lde,{"data-slot":"select-scroll-down-button",className:Me("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(pe,{icon:Dv,strokeWidth:2})})}const _W=k.createContext(void 0);function kj(){const e=k.useContext(_W);if(e===void 0)throw new Error(er(64));return e}let fde=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const Aj={tabActivationDirection:e=>({[fde.activationDirection]:e})},hde=k.forwardRef(function(t,r){const{className:n,defaultValue:i=0,onValueChange:s,orientation:o="horizontal",render:a,value:l,...u}=t,h=ou(),d=Object.hasOwn(t,"defaultValue"),p=k.useRef([]),[v,S]=k.useState(()=>new Map),[_,m]=Os({controlled:l,default:i,name:"Tabs",state:"value"}),x=l!==void 0,[b,w]=k.useState(()=>new Map),[O,E]=k.useState("none"),T=Be((F,W)=>{s?.(F,W),!W.isCanceled&&(m(F),E(W.activationDirection))}),R=Be((F,W)=>{S(B=>{if(B.get(F)===W)return B;const G=new Map(B);return G.set(F,W),G})}),A=Be((F,W)=>{S(B=>{if(!B.has(F)||B.get(F)!==W)return B;const G=new Map(B);return G.delete(F),G})}),j=k.useCallback(F=>v.get(F),[v]),I=k.useCallback(F=>{for(const W of b.values())if(F===W?.value)return W?.id},[b]),L=k.useCallback(F=>{if(F===void 0)return null;for(const[W,B]of b.entries())if(B!=null&&F===(B.value??B.index))return W;return null},[b]),z=k.useMemo(()=>({direction:h,getTabElementBySelectedValue:L,getTabIdByPanelValue:I,getTabPanelIdByValue:j,onValueChange:T,orientation:o,registerMountedTabPanel:R,setTabMap:w,unregisterMountedTabPanel:A,tabActivationDirection:O,value:_}),[h,L,I,j,T,o,R,w,A,O,_]),D=k.useMemo(()=>{for(const F of b.values())if(F!=null&&F.value===_)return F},[b,_]),V=k.useMemo(()=>{for(const F of b.values())if(F!=null&&!F.disabled)return F.value},[b]);He(()=>{if(x||b.size===0)return;const F=D?.disabled,W=D==null&&_!==null;if(d&&F&&_===i||!F&&!W)return;const G=V??null;_!==G&&(m(G),E("none"))},[i,V,d,x,D,E,m,b,_]);const $=dt("div",t,{state:{orientation:o,tabActivationDirection:O},ref:r,props:u,stateAttributesMapping:Aj});return y.jsx(_W.Provider,{value:z,children:y.jsx(jv,{elementsRef:p,children:$})})}),xW=k.createContext(void 0);function pde(){const e=k.useContext(xW);if(e===void 0)throw new Error(er(65));return e}const mde=k.forwardRef(function(t,r){const{className:n,disabled:i=!1,render:s,value:o,id:a,nativeButton:l=!0,...u}=t,{value:h,getTabPanelIdByValue:d,orientation:p}=kj(),{activateOnFocus:v,highlightedTabIndex:S,onTabActivation:_,setHighlightedTabIndex:m,tabsListElement:x}=pde(),b=ni(a),w=k.useMemo(()=>({disabled:i,id:b,value:o}),[i,b,o]),{compositeProps:O,compositeRef:E,index:T}=jV({metadata:w}),R=o===h,A=k.useRef(!1);He(()=>{if(A.current){A.current=!1;return}if(!(R&&T>-1&&S!==T))return;const B=x;if(B!=null){const G=Zs(ri(B));if(G&&ut(B,G))return}i||m(T)},[R,T,S,m,i,x]);const{getButtonProps:j,buttonRef:I}=Di({disabled:i,native:l,focusableWhenDisabled:!0}),L=d(o),z=k.useRef(!1),D=k.useRef(!1);function V(B){R||i||_(o,Ue(Pn,B.nativeEvent,void 0,{activationDirection:"none"}))}function H(B){R||(T>-1&&!i&&m(T),!i&&v&&(!z.current||z.current&&D.current)&&_(o,Ue(Pn,B.nativeEvent,void 0,{activationDirection:"none"})))}function $(B){if(R||i)return;z.current=!0;function G(){z.current=!1,D.current=!1}(!B.button||B.button===0)&&(D.current=!0,ri(B.currentTarget).addEventListener("pointerup",G,{once:!0}))}const F=k.useMemo(()=>({disabled:i,active:R,orientation:p}),[i,R,p]);return dt("button",t,{state:F,ref:[r,I,E],props:[O,{role:"tab","aria-controls":L,"aria-selected":R,id:b,onClick:V,onFocus:H,onPointerDown:$,[TV]:R?"":void 0,onKeyDownCapture(){A.current=!0}},u,j]})});let gde=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const vde=k.forwardRef(function(t,r){const{className:n,value:i,render:s,keepMounted:o=!1,...a}=t,{value:l,getTabIdByPanelValue:u,orientation:h,tabActivationDirection:d,registerMountedTabPanel:p,unregisterMountedTabPanel:v}=kj(),S=ni(),_=k.useMemo(()=>({id:S,value:i}),[S,i]),{ref:m,index:x}=hp({metadata:_}),b=i!==l,w=u(i),O=k.useMemo(()=>({hidden:b,orientation:h,tabActivationDirection:d}),[b,h,d]),E=dt("div",t,{state:O,ref:[r,m],props:[{"aria-labelledby":w,hidden:b,id:S??void 0,role:"tabpanel",tabIndex:b?-1:0,[gde.index]:x},a],stateAttributesMapping:Aj});return He(()=>{if(!(b&&!o)&&S!=null)return p(i,S),()=>{v(i,S)}},[b,o,i,S,p,v]),!b||o?E:null}),yde=k.forwardRef(function(t,r){const{activateOnFocus:n=!1,className:i,loopFocus:s=!0,render:o,...a}=t,{getTabElementBySelectedValue:l,onValueChange:u,orientation:h,value:d,setTabMap:p,tabActivationDirection:v}=kj(),[S,_]=k.useState(0),[m,x]=k.useState(null),b=bde(d,h,m,l),w=Be((R,A)=>{if(R!==d){const j=b(R);A.activationDirection=j,u(R,A)}}),O=k.useMemo(()=>({orientation:h,tabActivationDirection:v}),[h,v]),E={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},T=k.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:S,onTabActivation:w,setHighlightedTabIndex:_,tabsListElement:m,value:d}),[n,S,w,_,m,d]);return y.jsx(xW.Provider,{value:T,children:y.jsx(rx,{render:o,className:i,state:O,refs:[r,x],props:[E,a],stateAttributesMapping:Aj,highlightedIndex:S,enableHomeAndEndKeys:!0,loopFocus:s,orientation:h,onHighlightedIndexChange:_,onMapChange:p,disabledIndices:ki})})});function i4(e,t){const{left:r,top:n}=e.getBoundingClientRect(),{left:i,top:s}=t.getBoundingClientRect(),o=r-i,a=n-s;return{left:o,top:a}}function bde(e,t,r,n){const[i,s]=k.useState(null);return He(()=>{if(e==null||r==null){s(null);return}const o=n(e);if(o==null){s(null);return}const{left:a,top:l}=i4(o,r);s(t==="horizontal"?a:l)},[t,n,r,e]),k.useCallback(o=>{if(o===e)return"none";if(o==null)return s(null),"none";if(o!=null&&r!=null){const a=n(o);if(a!=null){const{left:l,top:u}=i4(a,r);if(i==null)return s(t==="horizontal"?l:u),"none";if(t==="horizontal"){if(l<i)return s(l),"left";if(l>i)return s(l),"right"}else{if(u<i)return s(u),"up";if(u>i)return s(u),"down"}}}return"none"},[n,t,i,r,e])}function Nc({className:e,orientation:t="horizontal",...r}){return y.jsx(hde,{"data-slot":"tabs","data-orientation":t,className:Me("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",e),...r})}const _de=nu("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 Bc({className:e,variant:t="default",...r}){return y.jsx(yde,{"data-slot":"tabs-list","data-variant":t,className:Me(_de({variant:t}),e),...r})}function ui({className:e,...t}){return y.jsx(mde,{"data-slot":"tabs-trigger",className:Me("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 qi({className:e,...t}){return y.jsx(vde,{"data-slot":"tabs-content",className:Me("text-xs/relaxed flex-1 min-h-0 outline-none",e),...t})}function xde(e){const{children:t,open:r,defaultOpen:n=!1,onOpenChange:i,onOpenChangeComplete:s,actionsRef:o,handle:a,triggerId:l,defaultTriggerId:u=null}=e,h=Pl(),d=!!h,p=ti(()=>a?.store??new tW({open:r??n,activeTriggerId:l!==void 0?l:u,modal:!0,disablePointerDismissal:!0,nested:d,role:"alertdialog"})).current;p.useControlledProp("open",r,n),p.useControlledProp("activeTriggerId",l,u),p.useSyncedValue("nested",d),p.useContextCallback("onOpenChange",i),p.useContextCallback("onOpenChangeComplete",s);const v=p.useState("payload");eW({store:p,actionsRef:o,parentContext:h?.store.context});const S=k.useMemo(()=>({store:p}),[p]);return y.jsx(Sj.Provider,{value:S,children:typeof t=="function"?t({payload:v}):t})}const SW=k.createContext(void 0),wW=k.createContext(void 0),CW=k.createContext(void 0),EW=k.createContext("");function Ll(){const e=k.useContext(SW);if(!e)throw new Error(er(22));return e}function px(){const e=k.useContext(wW);if(!e)throw new Error(er(23));return e}function Hd(){const e=k.useContext(CW);if(!e)throw new Error(er(24));return e}function Rj(){return k.useContext(EW)}const Xe={id:ke(e=>e.id),query:ke(e=>e.query),items:ke(e=>e.items),selectedValue:ke(e=>e.selectedValue),open:ke(e=>e.open),mounted:ke(e=>e.mounted),forceMounted:ke(e=>e.forceMounted),inline:ke(e=>e.inline),activeIndex:ke(e=>e.activeIndex),selectedIndex:ke(e=>e.selectedIndex),isActive:ke((e,t)=>e.activeIndex===t),isSelected:ke((e,t)=>{const r=e.isItemEqualToValue,n=e.selectedValue;return Array.isArray(n)?n.some(i=>wl(i,t,r)):wl(n,t,r)}),transitionStatus:ke(e=>e.transitionStatus),popupProps:ke(e=>e.popupProps),inputProps:ke(e=>e.inputProps),triggerProps:ke(e=>e.triggerProps),getItemProps:ke(e=>e.getItemProps),positionerElement:ke(e=>e.positionerElement),listElement:ke(e=>e.listElement),triggerElement:ke(e=>e.triggerElement),inputElement:ke(e=>e.inputElement),popupSide:ke(e=>e.popupSide),openMethod:ke(e=>e.openMethod),inputInsidePopup:ke(e=>e.inputInsidePopup),selectionMode:ke(e=>e.selectionMode),listRef:ke(e=>e.listRef),labelsRef:ke(e=>e.labelsRef),popupRef:ke(e=>e.popupRef),emptyRef:ke(e=>e.emptyRef),inputRef:ke(e=>e.inputRef),keyboardActiveRef:ke(e=>e.keyboardActiveRef),chipsContainerRef:ke(e=>e.chipsContainerRef),clearRef:ke(e=>e.clearRef),valuesRef:ke(e=>e.valuesRef),allValuesRef:ke(e=>e.allValuesRef),name:ke(e=>e.name),disabled:ke(e=>e.disabled),readOnly:ke(e=>e.readOnly),required:ke(e=>e.required),grid:ke(e=>e.grid),isGrouped:ke(e=>e.isGrouped),virtualized:ke(e=>e.virtualized),onOpenChangeComplete:ke(e=>e.onOpenChangeComplete),openOnInputClick:ke(e=>e.openOnInputClick),itemToStringLabel:ke(e=>e.itemToStringLabel),isItemEqualToValue:ke(e=>e.isItemEqualToValue),modal:ke(e=>e.modal),autoHighlight:ke(e=>e.autoHighlight),submitOnItemClick:ke(e=>e.submitOnItemClick)};function Sde(e,t){return(r,n)=>{if(r==null)return!1;const i=An(r,t);return e.contains(i,n)}}function wde(e,t,r){return(n,i)=>{if(n==null)return!1;if(!i)return!0;const s=An(n,t),o=r!=null?An(r,t):"";return o&&e.contains(o,i)&&o.length===i.length?!0:e.contains(s,i)}}const s4=new Map;function OW(e){return Array.isArray(e)?e.map(t=>OW(t)).join(","):e==null?"":String(e)}function Cde(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},r=`${OW(e.locale)}|${JSON.stringify(t)}`,n=s4.get(r);if(n)return n;const i=new Intl.Collator(e.locale,t),s={contains(o,a,l){if(!a)return!0;const u=An(o,l);for(let h=0;h<=u.length-a.length;h+=1)if(i.compare(u.slice(h,h+a.length),a)===0)return!0;return!1},startsWith(o,a,l){if(!a)return!0;const u=An(o,l);return i.compare(u.slice(0,a.length),a)===0},endsWith(o,a,l){if(!a)return!0;const u=An(o,l),h=a.length;return u.length>=h&&i.compare(u.slice(u.length-h),a)===0}};return s4.set(r,s),s}const Ede=Cde,TW=Symbol("none"),Mu={value:TW,index:-1};function Ode(e){const{id:t,onOpenChangeComplete:r,defaultSelectedValue:n=null,selectedValue:i,onSelectedValueChange:s,defaultInputValue:o,inputValue:a,selectionMode:l="none",onItemHighlighted:u,name:h,disabled:d=!1,readOnly:p=!1,required:v=!1,inputRef:S,grid:_=!1,items:m,filteredItems:x,filter:b,openOnInputClick:w=!0,autoHighlight:O=!1,keepHighlight:E=!1,highlightItemOnHover:T=!0,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:j=fW,virtualized:I=!1,inline:L=!1,fillInputOnItemPress:z=!0,modal:D=!1,limit:V=-1,autoComplete:H="list",locale:$,submitOnItemClick:F=!1}=e,{clearErrors:W}=$v(),{setDirty:B,validityData:G,shouldValidateOnChange:N,setFilled:U,name:Y,disabled:Q,validation:J}=uo(),re=fx({id:t}),X=Ede({locale:$}),[q,Z]=k.useState(!1),[te,ne]=k.useState(null),ie=k.useRef([]),me=k.useRef([]),ye=k.useRef(null),ue=k.useRef(null),he=k.useRef(null),fe=k.useRef(!0),$e=k.useRef(!1),ve=k.useRef(null),De=k.useRef(null),_e=k.useRef(null),ae=k.useRef(Mu),ce=k.useRef(null),be=k.useRef([]),Ee=k.useRef([]),Ve=Q||d,st=Y??h,Re=l==="multiple",We=l==="single",Ge=a!==void 0||o!==void 0,vt=m!==void 0,Ke=x!==void 0;let Qe;O==="always"?Qe="always":Qe=O?"input-change":!1;const[Ae,ot]=Os({controlled:i,default:Re?n??ki:n,name:"Combobox",state:"selectedValue"}),ft=k.useMemo(()=>b===null?()=>!0:b!==void 0?b:We&&!q?wde(X,R,Ae):Sde(X,R),[b,We,Ae,q,X,R]),Je=ti(()=>Ge?o??"":We?An(Ae,R):"").current,[lt,Ht]=Os({controlled:a,default:Je,name:"Combobox",state:"inputValue"}),[pt,Pr]=Os({controlled:e.open,default:e.defaultOpen,name:"Combobox",state:"open"}),It=pW(m),kt=te??(lt===""?"":String(lt).trim()),tt=We?An(Ae,R):"",Gt=We&&!q&&kt!==""&&tt!==""&&tt.length===kt.length&&X.contains(tt,kt),rr=Gt?"":kt,mt=vt&&Ke&&Gt,Nt=k.useMemo(()=>m?It?m.flatMap(Ye=>Ye.items):m:ki,[m,It]),Rt=k.useMemo(()=>{if(x&&!mt)return x;if(!m)return ki;if(It){const ht=m,jt=[];let jr=0;for(const Qr of ht){if(V>-1&&jr>=V)break;const mn=rr===""?Qr.items:Qr.items.filter($a=>ft($a,rr,R));if(mn.length===0)continue;const Na=V>-1?V-jr:1/0,Ba=mn.slice(0,Na);if(Ba.length>0){const $a={...Qr,items:Ba};jt.push($a),jr+=Ba.length}}return jt}if(rr==="")return V>-1?Nt.slice(0,V):Nt;const Ye=[];for(const ht of Nt){if(V>-1&&Ye.length>=V)break;ft(ht,rr,R)&&Ye.push(ht)}return Ye},[x,mt,m,It,rr,V,ft,R,Nt]),Pt=k.useMemo(()=>It?Rt.flatMap(ht=>ht.items):Rt,[Rt,It]),rt=ti(()=>new dd({id:re,selectedValue:Ae,open:pt,filter:ft,query:kt,items:m,selectionMode:l,listRef:ie,labelsRef:me,popupRef:ye,emptyRef:he,inputRef:ue,keyboardActiveRef:fe,chipsContainerRef:ve,clearRef:De,valuesRef:be,allValuesRef:Ee,selectionEventRef:_e,name:st,disabled:Ve,readOnly:p,required:v,grid:_,isGrouped:It,virtualized:I,openOnInputClick:w,itemToStringLabel:R,isItemEqualToValue:j,modal:D,autoHighlight:Qe,submitOnItemClick:F,hasInputValue:Ge,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:L,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:r||Zr,setOpen:Zr,setInputValue:Zr,setSelectedValue:Zr,setIndices:Zr,onItemHighlighted:Zr,handleSelection:Zr,getItemProps:()=>Ur,forceMount:Zr,requestSubmit:Zr})).current,nr=l==="none"?lt:Ae,en=k.useMemo(()=>l==="none"?nr:Array.isArray(Ae)?Ae.map(Ye=>Eo(Ye,A)):Eo(Ae,A),[nr,A,l,Ae]),un=Be(u),pn=Be(r),yi=Ie(rt,Xe.activeIndex),Da=Ie(rt,Xe.selectedIndex),Vn=Ie(rt,Xe.positionerElement),Vr=Ie(rt,Xe.listElement),Xr=Ie(rt,Xe.triggerElement),Ni=Ie(rt,Xe.inputElement),ii=Ie(rt,Xe.inline),Ps=Ie(rt,Xe.inputInsidePopup),$l=Fr(Xr),{mounted:Ot,setMounted:Wo,transitionStatus:qo}=$o(pt),{openMethod:js,triggerProps:Ms,reset:Ia}=dx(pt);zv({id:re,name:st,commit:J.commit,value:nr,controlRef:Ps?$l:ue,getValue:()=>en});const as=Be(()=>{m?me.current=Pt.map(Ye=>An(Ye,R)):rt.set("forceMounted",!0)}),tn=k.useRef(Ae);He(()=>{Ae!==tn.current&&as()},[as,Ae]);const Wn=Be(Ye=>{rt.update(Ye);const ht=Ye.type||"none";if(Ye.activeIndex!==void 0)if(Ye.activeIndex===null)ae.current!==Mu&&(ae.current=Mu,un(void 0,Rm(ht,void 0,{index:-1})));else{const jt=be.current[Ye.activeIndex];ae.current={value:jt,index:Ye.activeIndex},un(jt,Rm(ht,void 0,{index:Ye.activeIndex}))}}),qn=Be((Ye,ht)=>{if($e.current=ht.reason===mc,e.onInputValueChange?.(Ye,ht),!ht.isCanceled){if(ht.reason===Yu){const jt=Ye.trim()!=="";jt&&Z(!0),ce.current={hasQuery:jt},jt&&Qe&&rt.state.activeIndex==null&&rt.set("activeIndex",0)}Ht(Ye)}}),bi=Be((Ye,ht)=>{pt!==Ye&&(ht.reason==="escape-key"&&vt&&Pt.length===0&&!rt.state.emptyRef.current&&ht.allowPropagation(),e.onOpenChange?.(Ye,ht),!ht.isCanceled&&(!Ye&&q&&(We?(ne(kt),kt===""&&Z(!1)):Re&&(ii||Ps?Wn({activeIndex:null}):ne(kt),qn("",Ue(mc,ht.event)))),Pr(Ye)))}),ls=Be((Ye,ht)=>{if(s?.(Ye,ht),ht.isCanceled)return;ot(Ye),(l==="none"&&ye.current&&z||We&&!rt.state.inputInsidePopup)&&qn(An(Ye,R),Ue(ht.reason,ht.event)),We&&Ye!=null&&ht.reason!==Yu&&q&&ne(kt)}),Pp=Be((Ye,ht)=>{let jt=ht;if(jt===void 0){if(yi===null)return;jt=be.current[yi]}const jr=an(Ye),Qr=_e.current??Ye;_e.current=null;const mn=Ue(ud,Qr),Na=jr?.closest("a")?.getAttribute("href");if(Na){Na.startsWith("#")&&bi(!1,mn);return}if(Re){const Ba=Array.isArray(Ae)?Ae:[],vo=Zu(Ba,jt,rt.state.isItemEqualToValue)?hW(Ba,jt,rt.state.isItemEqualToValue):[...Ba,jt];if(ls(vo,mn),!(ue.current?ue.current.value.trim()!=="":!1))return;rt.state.inputInsidePopup?qn("",Ue(mc,mn.event)):bi(!1,mn)}else ls(jt,mn),bi(!1,mn)}),zl=Be(()=>{if(!rt.state.submitOnItemClick)return;const Ye=rt.state.inputElement?.form;Ye&&typeof Ye.requestSubmit=="function"&&Ye.requestSubmit()}),Hl=Be(()=>{if(Wo(!1),pn?.(!1),Z(!1),Ia(),ne(null),Wn(l==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Re&&ue.current&&ue.current.value!==""&&!$e.current&&qn("",Ue(mc)),We)if(rt.state.inputInsidePopup)ue.current&&ue.current.value!==""&&qn("",Ue(mc));else{const Ye=An(Ae,R);ue.current&&ue.current.value!==Ye&&qn(Ye,Ue(Ye===""?mc:Pn))}}),jp=k.useMemo(()=>ii&&Vn?{current:Vn.closest('[role="dialog"]')}:ye,[ii,Vn]);gi({enabled:!e.actionsRef,open:pt,ref:jp,onComplete(){pt||Hl()}}),k.useImperativeHandle(e.actionsRef,()=>({unmount:Hl}),[Hl]),He(function(){if(pt||l==="none")return;const ht=m?Nt:Ee.current;if(Re){const jt=Array.isArray(Ae)?Ae:[],jr=jt[jt.length-1],Qr=_h(ht,jr,j);Wn({selectedIndex:Qr===-1?null:Qr})}else{const jt=_h(ht,Ae,j);Wn({selectedIndex:jt===-1?null:jt})}},[pt,Ae,m,l,Nt,Re,j,Wn]),He(()=>{m&&(be.current=Pt,ie.current.length=Pt.length)},[m,Pt]),He(()=>{const Ye=ce.current;if(Ye&&(Ye.hasQuery?Qe&&rt.set("activeIndex",0):Qe==="always"&&rt.set("activeIndex",0),ce.current=null),!pt&&!ii)return;const jt=vt||Ke?Pt:be.current,jr=rt.state.activeIndex;if(jr==null){if(Qe==="always"&&jt.length>0){rt.set("activeIndex",0);return}ae.current!==Mu&&(ae.current=Mu,rt.state.onItemHighlighted(void 0,Rm(Pn,void 0,{index:-1})));return}if(jr>=jt.length){ae.current!==Mu&&(ae.current=Mu,rt.state.onItemHighlighted(void 0,Rm(Pn,void 0,{index:-1}))),rt.set("activeIndex",null);return}const Qr=jt[jr],mn=ae.current.value,Na=mn!==TW&&rt.state.isItemEqualToValue(Qr,mn);(ae.current.index!==jr||!Na)&&(ae.current={value:Qr,index:jr},rt.state.onItemHighlighted(Qr,Rm(Pn,void 0,{index:jr})))},[yi,Qe,Ke,vt,Pt,ii,pt,rt]),He(()=>{if(!m||l==="none")return;const Ye=Nt;if(Re){const jr=Array.isArray(Ae)?Ae:ki,Qr=jr.filter(mn=>Zu(Ye,mn,rt.state.isItemEqualToValue));Qr.length!==jr.length&&ot(Qr);return}if(Ae==null?!0:Zu(Ye,Ae,rt.state.isItemEqualToValue))return;let jt=null;if(n!=null&&Zu(Ye,n,rt.state.isItemEqualToValue)&&(jt=n),ot(jt),!rt.state.inputInsidePopup){const jr=An(jt,R);ue.current&&ue.current.value!==jr&&qn(jr,Ue(Pn))}},[m,Nt,Re,l,Ae,n,ot,R,rt,qn]),He(()=>{if(l==="none"){U(String(lt)!=="");return}U(Re?Array.isArray(Ae)&&Ae.length>0:Ae!=null)},[U,l,lt,Ae,Re]),k.useEffect(()=>{vt&&Qe&&Pt.length===0&&Wn({activeIndex:null})},[vt,Qe,Pt.length,Wn]),Ju(kt,()=>{!pt||kt===""||kt===String(Je)||Z(!0)}),Ju(Ae,()=>{if(l!=="none"&&(W(st),B(Ae!==G.initialValue),N()?J.commit(Ae):J.commit(Ae,!0),Re&&rt.state.selectedIndex!==null&&(!Array.isArray(Ae)||Ae.length===0)&&Wn({activeIndex:null,selectedIndex:null}),We&&!Ge&&!Ps)){const Ye=An(Ae,R);lt!==Ye&&qn(Ye,Ue(Pn))}}),Ju(lt,()=>{l==="none"&&(W(st),B(lt!==G.initialValue),N()?J.commit(lt):J.commit(lt,!0))}),Ju(m,()=>{if(!We||Ge||Ps||q)return;const Ye=An(Ae,R);lt!==Ye&&qn(Ye,Ue(Pn))});const go=J1({open:ii?!0:pt,onOpenChange:bi,elements:{reference:Ps?Xr:Ni,floating:Vn}});let cs,_i;ii||(cs=_?"grid":"listbox",_i=pt?"true":"false");const si=k.useMemo(()=>{const Ye=Ni?.tagName==="INPUT",ht=Ye||pt,jt=Ye?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return ht&&(jt.role="combobox",jt["aria-expanded"]=_i,jt["aria-haspopup"]=cs,jt["aria-controls"]=pt?Vr?.id:void 0,jt["aria-autocomplete"]=H),{reference:jt,floating:{role:"presentation"}}},[Ni,pt,_i,cs,Vr?.id,H]),je=dp(go,{enabled:!p&&!Ve&&w,event:"mousedown-only",toggle:!1,touchOpenDelay:Ps?0:50}),St=Pv(go,{enabled:!p&&!Ve&&!ii,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:ii?!0:void 0,outsidePress(Ye){const ht=an(Ye);return!ut(Xr,ht)&&!ut(De.current,ht)&&!ut(ve.current,ht)}}),oi=cj(go,{enabled:!p&&!Ve,id:re,listRef:ie,activeIndex:yi,selectedIndex:Da,virtual:!0,loopFocus:!0,allowEscape:!Qe,focusItemOnOpen:q||l==="none"&&!Qe?!1:"auto",focusItemOnHover:T,resetOnPointerLeave:!E,cols:_?2:1,orientation:_?"horizontal":void 0,disabledIndices:ki,onNavigate(Ye,ht){!ht&&!pt||qo==="ending"||Wn(ht?{activeIndex:Ye,type:fe.current?"keyboard":"pointer"}:{activeIndex:Ye})}}),{getReferenceProps:Ls,getFloatingProps:xi,getItemProps:ef}=Nd([si,je,St,oi]);lW(()=>{rt.update({inline:L,popupProps:xi(),inputProps:Ls(),triggerProps:Ms,getItemProps:ef,setOpen:bi,setInputValue:qn,setSelectedValue:ls,setIndices:Wn,onItemHighlighted:un,handleSelection:Pp,forceMount:as,requestSubmit:zl})}),He(()=>{rt.update({id:re,selectedValue:Ae,open:pt,mounted:Ot,transitionStatus:qo,items:m,inline:L,popupProps:xi(),inputProps:Ls(),triggerProps:Ms,openMethod:js,getItemProps:ef,selectionMode:l,name:st,disabled:Ve,readOnly:p,required:v,grid:_,isGrouped:It,virtualized:I,onOpenChangeComplete:pn,openOnInputClick:w,itemToStringLabel:R,modal:D,autoHighlight:Qe,isItemEqualToValue:j,submitOnItemClick:F,hasInputValue:Ge,requestSubmit:zl})},[rt,re,Ae,pt,Ot,qo,m,xi,Ls,ef,js,Ms,l,st,Ve,p,v,J,_,It,I,pn,w,R,D,j,F,Ge,L,zl,Qe]);const Bi=co(S,J.inputRef),Mp=k.useMemo(()=>({query:kt,filteredItems:Rt,flatFilteredItems:Pt}),[kt,Rt,Pt]),dy=k.useMemo(()=>Array.isArray(nr)?"":Eo(nr,A),[nr,A]),Lp=Re&&Array.isArray(Ae)&&Ae.length>0,Fl=k.useMemo(()=>!Re||!Array.isArray(Ae)||!st?null:Ae.map(Ye=>{const ht=Eo(Ye,A);return y.jsx("input",{type:"hidden",name:st,value:ht},ht)}),[Re,Ae,st,A]),fy=y.jsxs(k.Fragment,{children:[e.children,y.jsx("input",{...J.getInputValidationProps({onFocus(){if(Ps){Xr?.focus();return}(ue.current||Xr)?.focus()},onChange(Ye){if(Ye.nativeEvent.defaultPrevented)return;const ht=Ye.target.value,jt=Ue(Yu,Ye.nativeEvent);function jr(){if(Re)return;if(l==="none"){B(ht!==G.initialValue),qn(ht,jt),N()&&J.commit(ht);return}const Qr=be.current.find(mn=>Eo(mn,A).toLowerCase()===ht.toLowerCase());Qr!=null&&(B(Qr!==G.initialValue),ls?.(Qr,jt),N()&&J.commit(Qr))}m?jr():(as(),queueMicrotask(jr))}}),id:re,name:Re||l==="none"?void 0:st,disabled:Ve,required:v&&!Lp,readOnly:p,value:dy,ref:Bi,style:up,tabIndex:-1,"aria-hidden":!0}),Fl]});return y.jsx(SW.Provider,{value:rt,children:y.jsx(wW.Provider,{value:go,children:y.jsx(CW.Provider,{value:Mp,children:y.jsx(EW.Provider,{value:lt,children:fy})})})})}const Wb=2,Tde={...yh,...zd},kde=k.forwardRef(function(t,r){const{render:n,className:i,nativeButton:s=!0,disabled:o=!1,...a}=t,{state:l,disabled:u,setTouched:h,setFocused:d,validationMode:p,validation:v}=uo(),{labelId:S}=au(),_=Ll(),m=Ie(_,Xe.selectionMode),x=Ie(_,Xe.disabled),b=Ie(_,Xe.readOnly),w=Ie(_,Xe.listElement),O=Ie(_,Xe.triggerProps),E=Ie(_,Xe.triggerElement),T=Ie(_,Xe.inputInsidePopup),R=Ie(_,Xe.open),A=Ie(_,Xe.selectedValue),j=Ie(_,Xe.activeIndex),I=Ie(_,Xe.selectedIndex),L=px(),z=Rj(),D=Sr(),V=u||x||o,H=k.useRef("");function $(J){H.current=J.pointerType}const F=L.select("domReferenceElement");k.useEffect(()=>{T&&E&&E!==F&&L.set("domReferenceElement",E)},[E,F,L,T]);const{reference:W}=uj(L,{enabled:!R&&!b&&!x&&m==="single",listRef:_.state.labelsRef,activeIndex:j,selectedIndex:I,onMatch(J){const re=_.state.valuesRef.current[J];re!==void 0&&_.state.setSelectedValue(re,Ue("none"))}}),{reference:B}=dp(L,{enabled:!b&&!x,event:"mousedown"}),{buttonRef:G,getButtonProps:N}=Di({native:s,disabled:V}),U=k.useMemo(()=>({...l,open:R,disabled:V}),[l,R,V]),Y=Be(J=>{_.set("triggerElement",J)});return dt("button",t,{ref:[r,G,Y],state:U,props:[O,B,W,{tabIndex:T?0:-1,disabled:V,role:T?"combobox":void 0,"aria-expanded":R?"true":"false","aria-haspopup":T?"dialog":"listbox","aria-controls":R?w?.id:void 0,"aria-readonly":b||void 0,"aria-labelledby":S,onPointerDown:$,onPointerEnter:$,onFocus(){d(!0),!(V||b)&&D.start(0,_.state.forceMount)},onBlur(){if(h(!0),d(!1),p==="onBlur"){const J=m==="none"?z:A;v.commit(J)}},onMouseDown(J){if(V||b||(T||L.set("domReferenceElement",J.currentTarget),_.state.forceMount(),H.current!=="touch"&&(_.state.inputRef.current?.focus(),T||J.preventDefault()),R))return;const re=ri(J.currentTarget);function X(q){if(!E)return;const Z=an(q),te=_.state.positionerElement,ne=_.state.listElement;if(ut(E,Z)||ut(te,Z)||ut(ne,Z)||Z===E)return;const ie=Cj(E),me=q.clientX>=ie.left-Wb&&q.clientX<=ie.right+Wb,ye=q.clientY>=ie.top-Wb&&q.clientY<=ie.bottom+Wb;me&&ye||_.state.setOpen(!1,Ue("cancel-open",q))}T&&re.addEventListener("mouseup",X,{once:!0})},onKeyDown(J){V||b||(J.key==="ArrowDown"||J.key==="ArrowUp")&&(on(J),_.state.setOpen(!0,Ue(eh,J.nativeEvent)),_.state.inputRef.current?.focus())}},v?v.getValidationProps(a):a,N],stateAttributesMapping:Tde})}),Ade=k.createContext(void 0);function Rde(){return k.useContext(Ade)}const kW=k.createContext(void 0);function Pj(e){const t=k.useContext(kW);if(t===void 0&&!e)throw new Error(er(21));return t}const Pde={...yh,...zd,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},jde=k.forwardRef(function(t,r){const{render:n,className:i,disabled:s=!1,id:o,...a}=t,{state:l,disabled:u,setTouched:h,setFocused:d,validationMode:p,validation:v}=uo(),{labelId:S}=au(),_=Rde(),x=!!Pj(!0),b=Ll(),{filteredItems:w}=Hd(),O=Rj(),E=ni(o),T=ou(),R=Ie(b,Xe.disabled),A=Ie(b,Xe.readOnly),j=Ie(b,Xe.name),I=Ie(b,Xe.selectionMode),L=Ie(b,Xe.autoHighlight),z=Ie(b,Xe.inputProps),D=Ie(b,Xe.triggerProps),V=Ie(b,Xe.open),H=Ie(b,Xe.mounted),$=Ie(b,Xe.selectedValue),F=Ie(b,Xe.popupSide),W=Ie(b,Xe.positionerElement),B=!!L,G=H&&W?F:null,N=u||R||s,U=w.length===0,[Y,Q]=k.useState(null),J=k.useRef(!1),re=Be(te=>{const ne=x||b.state.inline;ne&&!b.state.hasInputValue&&b.state.setInputValue("",Ue(Pn)),b.update({inputElement:te,inputInsidePopup:ne})}),X=k.useMemo(()=>({...l,open:V,disabled:N,readOnly:A,popupSide:G,listEmpty:U}),[l,V,N,A,G,U]);function q(te){if(!_)return;let ne;const{highlightedChipIndex:ie}=_;if(ie!==void 0){if(te.key==="ArrowLeft")te.preventDefault(),ie>0?ne=ie-1:ne=void 0;else if(te.key==="ArrowRight")te.preventDefault(),ie<$.length-1?ne=ie+1:ne=void 0;else if(te.key==="Backspace"||te.key==="Delete"){te.preventDefault();const me=ie>=$.length-1?$.length-2:ie;ne=me>=0?me:void 0,b.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return ne}return te.key==="ArrowLeft"&&(te.currentTarget.selectionStart??0)===0&&$.length>0?(te.preventDefault(),ne=Math.max($.length-1,0)):te.key==="Backspace"&&te.currentTarget.value===""&&$.length>0&&(b.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),te.preventDefault()),ne}return dt("input",t,{state:X,ref:[r,b.state.inputRef,re],props:[z,D,{type:"text",value:t.value??Y??O,"aria-readonly":A||void 0,"aria-labelledby":S,disabled:N,readOnly:A,...I==="none"&&j&&{name:j},id:E,onFocus(){d(!0)},onBlur(){if(h(!0),d(!1),p==="onBlur"){const te=I==="none"?O:$;v.commit(te)}},onCompositionStart(te){K0||(J.current=!0,Q(te.currentTarget.value))},onCompositionEnd(te){J.current=!1;const ne=te.currentTarget.value;Q(null),b.state.setInputValue(ne,Ue(Yu,te.nativeEvent))},onChange(te){if(J.current){const ye=te.currentTarget.value;Q(ye),ye===""&&!b.state.openOnInputClick&&!b.state.inputInsidePopup&&b.state.setOpen(!1,Ue(mc,te.nativeEvent));const ue=ye.trim(),he=B&&ue!=="";!A&&!N&&ue!==""&&(b.state.setOpen(!0,Ue(Yu,te.nativeEvent)),B||b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&b.state.activeIndex!==null&&!he&&b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"});return}b.state.setInputValue(te.currentTarget.value,Ue(Yu,te.nativeEvent));const ne=te.currentTarget.value==="",ie=Ue(mc,te.nativeEvent);ne&&!b.state.inputInsidePopup&&(I==="single"&&b.state.setSelectedValue(null,ie),b.state.openOnInputClick||b.state.setOpen(!1,ie));const me=te.currentTarget.value.trim();!A&&!N&&me!==""&&(b.state.setOpen(!0,Ue(Yu,te.nativeEvent)),B||b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&b.state.activeIndex!==null&&!B&&b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(te){if(N||A||te.ctrlKey||te.shiftKey||te.altKey||te.metaKey)return;b.state.keyboardActiveRef.current=!0;const ne=te.currentTarget,ie=ne.scrollWidth-ne.clientWidth,me=T==="rtl";if(te.key==="Home"){on(te);const ue=g3&&me?ne.value.length:0;ne.setSelectionRange(ue,ue),ne.scrollLeft=0;return}if(te.key==="End"){on(te);const ue=g3&&me?0:ne.value.length;ne.setSelectionRange(ue,ue),ne.scrollLeft=me?-ie:ie;return}if(!H&&te.key==="Escape"){const ue=I==="multiple"&&Array.isArray($)?$.length===0:$===null,he=Ue(K1,te.nativeEvent),fe=I==="multiple"?[]:null;b.state.setInputValue("",he),b.state.setSelectedValue(fe,he),!ue&&!b.state.inline&&!he.isPropagationAllowed&&te.stopPropagation();return}if(_&&te.key==="Backspace"&&ne.value===""&&_.highlightedChipIndex===void 0&&Array.isArray($)&&$.length>0){const ue=$.slice(0,-1);b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"}),b.state.setSelectedValue(ue,Ue(Pn,te.nativeEvent));return}const ye=q(te);if(_?.setHighlightedChipIndex(ye),ye!==void 0?_?.chipsRef.current[ye]?.focus():b.state.inputRef.current?.focus(),te.which!==229&&te.key==="Enter"&&V){const ue=b.state.activeIndex,he=te.nativeEvent;if(ue===null){b.state.setOpen(!1,Ue(Pn,he));return}on(te);const fe=b.state.listRef.current[ue];fe&&(b.state.selectionEventRef.current=he,fe.click(),b.state.selectionEventRef.current=null)}},onPointerMove(){b.state.keyboardActiveRef.current=!1},onPointerDown(){b.state.keyboardActiveRef.current=!1}},v?v.getValidationProps(a):a],stateAttributesMapping:Pde})}),Mde={...ho,...fj},Lde=k.forwardRef(function(t,r){const{render:n,className:i,disabled:s=!1,nativeButton:o=!0,keepMounted:a=!1,...l}=t,{disabled:u}=uo(),h=Ll(),d=Ie(h,Xe.selectionMode),p=Ie(h,Xe.disabled),v=Ie(h,Xe.readOnly),S=Ie(h,Xe.open),_=Ie(h,Xe.selectedValue),m=Rj();let x=!1;d==="none"?x=m!=="":d==="single"?x=_!=null:x=Array.isArray(_)&&_.length>0;const b=u||p||s,{buttonRef:w,getButtonProps:O}=Di({native:o,disabled:b}),{mounted:E,transitionStatus:T,setMounted:R}=$o(x),A=k.useMemo(()=>({disabled:b,open:S,transitionStatus:T}),[b,S,T]);gi({open:x,ref:h.state.clearRef,onComplete(){x||R(!1)}});const j=dt("button",t,{state:A,ref:[r,w,h.state.clearRef],props:[{tabIndex:-1,children:"x",disabled:b,"aria-readonly":v||void 0,onMouseDown(L){L.preventDefault()},onClick(L){if(b||v)return;const z=h.state.keyboardActiveRef;h.state.setInputValue("",Ue(w3,L.nativeEvent)),d!=="none"?(h.state.setSelectedValue(Array.isArray(_)?[]:null,Ue(w3,L.nativeEvent)),h.state.setIndices({activeIndex:null,selectedIndex:null,type:z.current?"keyboard":"pointer"})):h.state.setIndices({activeIndex:null,type:z.current?"keyboard":"pointer"}),h.state.inputRef.current?.focus()}},l,O],stateAttributesMapping:Mde});return a||E?j:null}),Dde=k.createContext(null);function Ide(){return k.useContext(Dde)}function Nde(e){const{children:t}=e,{filteredItems:r}=Hd(),n=Ide(),i=n?n.items:r;return i?y.jsx(k.Fragment,{children:i.map(t)}):null}const Bde=k.forwardRef(function(t,r){var n;const{render:i,className:s,children:o,...a}=t,l=Ll(),u=px(),h=!!Pj(!0),{filteredItems:d}=Hd(),p=Ie(l,Xe.items),v=Ie(l,Xe.labelsRef),S=Ie(l,Xe.listRef),_=Ie(l,Xe.selectionMode),m=Ie(l,Xe.grid),x=Ie(l,Xe.popupProps),b=Ie(l,Xe.disabled),w=Ie(l,Xe.readOnly),O=Ie(l,Xe.virtualized),E=_==="multiple",T=d.length===0,R=Be(D=>{l.set("positionerElement",D)}),A=Be(D=>{l.set("listElement",D)}),j=k.useMemo(()=>typeof o=="function"?n||(n=y.jsx(Nde,{children:o})):o,[o]),I=k.useMemo(()=>({empty:T}),[T]),L=u.useState("floatingId"),z=dt("div",t,{state:I,ref:[r,A,h?null:R],props:[x,{children:j,tabIndex:-1,id:L,role:m?"grid":"listbox","aria-multiselectable":E?"true":void 0,onKeyDown(D){if(!(b||w)&&D.key==="Enter"){const V=l.state.activeIndex;if(V==null)return;on(D);const H=D.nativeEvent,$=l.state.listRef.current[V];$&&(l.state.selectionEventRef.current=H,$.click(),l.state.selectionEventRef.current=null)}},onKeyDownCapture(){l.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.state.keyboardActiveRef.current=!1}},a]});return O?z:y.jsx(jv,{elementsRef:S,labelsRef:p?void 0:v,children:z})}),AW=k.createContext(void 0);function $de(){const e=k.useContext(AW);if(e===void 0)throw new Error(er(20));return e}const zde=k.forwardRef(function(t,r){const{keepMounted:n=!1,...i}=t,s=Ll(),o=Ie(s,Xe.mounted),a=Ie(s,Xe.forceMounted);return o||n||a?y.jsx(AW.Provider,{value:n,children:y.jsx(Rv,{ref:r,...i})}):null}),Hde=k.forwardRef(function(t,r){const{render:n,className:i,anchor:s,positionMethod:o="absolute",side:a="bottom",align:l="center",sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:_=!1,collisionAvoidance:m=W1,...x}=t,b=Ll(),{filteredItems:w}=Hd(),O=px(),E=$de(),T=Ie(b,Xe.modal),R=Ie(b,Xe.open),A=Ie(b,Xe.mounted),j=Ie(b,Xe.openMethod),I=Ie(b,Xe.triggerElement),L=Ie(b,Xe.inputElement),z=Ie(b,Xe.inputInsidePopup),D=w.length===0,H=ix({anchor:s??(z?I:L),floatingRootContext:O,positionMethod:o,mounted:A,side:a,sideOffset:u,align:l,alignOffset:h,arrowPadding:v,collisionBoundary:d,collisionPadding:p,sticky:S,disableAnchorTracking:_,keepMounted:E,collisionAvoidance:m,lazyFlip:!0});ux(R&&T&&j!=="touch",I);const $=k.useMemo(()=>{const N={...H.positionerStyles};return R||(N.pointerEvents="none"),{role:"presentation",hidden:!A,style:N}},[R,A,H.positionerStyles]),F=k.useMemo(()=>({open:R,side:H.side,align:H.align,anchorHidden:H.anchorHidden,empty:D}),[R,H.side,H.align,H.anchorHidden,D]);He(()=>{b.set("popupSide",H.side)},[b,H.side]);const W=k.useMemo(()=>({side:H.side,align:H.align,arrowRef:H.arrowRef,arrowUncentered:H.arrowUncentered,arrowStyles:H.arrowStyles,anchorHidden:H.anchorHidden,isPositioned:H.isPositioned}),[H.side,H.align,H.arrowRef,H.arrowUncentered,H.arrowStyles,H.anchorHidden,H.isPositioned]),B=Be(N=>{b.set("positionerElement",N)}),G=dt("div",t,{state:F,ref:[r,B],props:[$,x],stateAttributesMapping:zo});return y.jsxs(kW.Provider,{value:W,children:[A&&T&&y.jsx(cx,{inert:fp(!R),cutout:L??I}),G]})}),Fde={...zo,...ho},Ude=k.forwardRef(function(t,r){const{render:n,className:i,initialFocus:s,finalFocus:o,...a}=t,l=Ll(),u=Pj(),h=px(),{filteredItems:d}=Hd(),p=Ie(l,Xe.mounted),v=Ie(l,Xe.open),S=Ie(l,Xe.openMethod),_=Ie(l,Xe.transitionStatus),m=Ie(l,Xe.inputInsidePopup),x=Ie(l,Xe.inputElement),b=d.length===0;gi({open:v,ref:l.state.popupRef,onComplete(){v&&l.state.onOpenChangeComplete(!0)}});const w=k.useMemo(()=>({open:v,side:u.side,align:u.align,anchorHidden:u.anchorHidden,transitionStatus:_,empty:b}),[v,u.side,u.align,u.anchorHidden,_,b]),O=dt("div",t,{state:w,ref:[r,l.state.popupRef],props:[{role:m?"dialog":"presentation",tabIndex:-1,onFocus(A){const j=an(A.nativeEvent);S!=="touch"&&(ut(l.state.listElement,j)||j===A.currentTarget)&&l.state.inputRef.current?.focus()}},sx(_),a],stateAttributesMapping:Fde}),T=s===void 0?m?A=>A==="touch"?l.state.popupRef.current:x:!1:s;let R;return o!=null?R=o:R=m?void 0:!1,y.jsx(Y1,{context:h,disabled:!p,modal:!m,openInteractionType:S,initialFocus:T,returnFocus:R,children:O})}),RW=k.createContext(void 0);function PW(){const e=k.useContext(RW);if(!e)throw new Error(er(19));return e}const Vde=k.createContext(!1);function Wde(){return k.useContext(Vde)}const qde=k.memo(k.forwardRef(function(t,r){const{render:n,className:i,value:s=null,index:o,disabled:a=!1,nativeButton:l=!1,...u}=t,h=k.useRef(!1),d=k.useRef(null),p=hp({index:o,textRef:d,indexGuessBehavior:hj.GuessFromOrder}),v=Ll(),S=Wde(),{flatFilteredItems:_}=Hd(),m=Ie(v,Xe.open),x=Ie(v,Xe.selectionMode),b=Ie(v,Xe.readOnly),w=Ie(v,Xe.virtualized),O=Ie(v,Xe.isItemEqualToValue),E=x!=="none",T=o??(w?_h(_,s,O):p.index),R=p.index!==-1,A=Ie(v,Xe.id),j=Ie(v,Xe.isActive,T),I=Ie(v,Xe.isSelected,s),L=Ie(v,Xe.items),z=Ie(v,Xe.getItemProps),D=k.useRef(null),V=A!=null&&R?`${A}-${T}`:void 0,H=I&&E;He(()=>{if(!(R&&(w||o!=null)))return;const J=v.state.listRef.current;return J[T]=D.current,()=>{delete J[T]}},[R,w,T,o,v]),He(()=>{if(!R||L)return;const Q=v.state.valuesRef.current;return Q[T]=s,x!=="none"&&v.state.allValuesRef.current.push(s),()=>{delete Q[T]}},[R,L,T,s,v,x]),He(()=>{if(!m){h.current=!1;return}if(!R||L)return;const Q=v.state.selectedValue,J=Array.isArray(Q)?Q[Q.length-1]:Q;wl(J,s,O)&&v.set("selectedIndex",T)},[R,L,m,v,T,s,O]);const $=k.useMemo(()=>({disabled:a,selected:H,highlighted:j}),[a,H,j]),F=z({active:j,selected:H});F.id=void 0,F.onFocus=void 0;const{getButtonProps:W,buttonRef:B}=Di({disabled:a,focusableWhenDisabled:!0,native:l});function G(Q){function J(){v.state.handleSelection(Q,s)}v.state.submitOnItemClick?(hn.flushSync(J),v.state.requestSubmit()):J()}const N={id:V,role:S?"gridcell":"option","aria-disabled":a||void 0,"aria-selected":E?H:void 0,tabIndex:void 0,onPointerDownCapture(Q){h.current=!0,Q.preventDefault()},onClick(Q){a||b||G(Q.nativeEvent)},onMouseUp(Q){const J=h.current;h.current=!1,!(a||b||Q.button!==0||J||!j)&&G(Q.nativeEvent)}},U=dt("div",t,{ref:[B,r,p.ref,D],state:$,props:[F,N,u,W]}),Y=k.useMemo(()=>({selected:H,textRef:d}),[H,d]);return y.jsx(RW.Provider,{value:Y,children:U})})),Gde=k.forwardRef(function(t,r){const{render:n,className:i,children:s,...o}=t,{filteredItems:a}=Hd(),l=Ll(),u=a.length===0?s:null;return dt("div",t,{ref:[r,l.state.emptyRef],props:[{children:u,role:"status","aria-live":"polite","aria-atomic":!0},o]})});let o4=(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 jW(e){return k.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[o4.checked]:""}:{[o4.unchecked]:""}},...zd}),[e.indeterminate])}const MW=k.createContext(void 0);function Kde(){const e=k.useContext(MW);if(e===void 0)throw new Error(er(14));return e}const Yde="data-parent",Xde=k.forwardRef(function(t,r){const{checked:n,className:i,defaultChecked:s=!1,disabled:o=!1,id:a,indeterminate:l=!1,inputRef:u,name:h,onCheckedChange:d,parent:p=!1,readOnly:v=!1,render:S,required:_=!1,uncheckedValue:m,value:x,nativeButton:b=!1,...w}=t,{clearErrors:O}=$v(),{disabled:E,name:T,setDirty:R,setFilled:A,setFocused:j,setTouched:I,state:L,validationMode:z,validityData:D,shouldValidateOnChange:V,validation:H}=uo(),$=aue(),{labelId:F,controlId:W,setControlId:B,getDescriptionProps:G}=au(),N=cue(),U=N?.parent,Y=U&&N.allValues,Q=E||$.disabled||N?.disabled||o,J=T??h,re=x??J,X=ni(),q=ni();let Z=W;Y?Z=p?q:`${U.id}-${re}`:a&&(Z=a);let te={};Y&&(p?te=N.parent.getParentProps():re&&(te=N.parent.getChildProps(re)));const ne=Be(d),{checked:ie=n,indeterminate:me=l,onCheckedChange:ye,...ue}=te,he=N?.value,fe=N?.setValue,$e=N?.defaultValue,ve=k.useRef(null),{getButtonProps:De,buttonRef:_e}=Di({disabled:Q,native:b}),ae=N?.validation??H,[ce,be]=Os({controlled:re&&he&&!p?he.includes(re):ie,default:re&&$e&&!p?$e.includes(re):s,name:"Checkbox",state:"checked"});He(()=>{if(B!==Zr)return B(Z),()=>{B(void 0)}},[Z,N,B,p]),zv({enabled:!N,id:X,commit:ae.commit,value:ce,controlRef:ve,name:J,getValue:()=>ce});const Ee=k.useRef(null),Ve=co(u,Ee,ae.inputRef);He(()=>{Ee.current&&(Ee.current.indeterminate=me,ce&&A(!0))},[ce,me,A]),Ju(ce,()=>{N&&!p||(O(J),A(ce),R(ce!==D.initialValue),V()?ae.commit(ce):ae.commit(ce,!0))});const st=ya({checked:ce,disabled:Q,name:p?void 0:J,id:Z??void 0,required:_,ref:Ve,style:up,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Qe){if(Qe.nativeEvent.defaultPrevented)return;const Ae=Qe.target.checked,ot=Ue(Pn,Qe.nativeEvent);if(ye?.(Ae,ot),ne(Ae,ot),!ot.isCanceled&&(be(Ae),re&&he&&fe&&!p)){const ft=Ae?[...he,re]:he.filter(Je=>Je!==re);fe(ft,ot)}},onFocus(){ve.current?.focus()}},x!==void 0?{value:(N?ce&&x:x)||""}:Ur,G,N?ae.getValidationProps:ae.getInputValidationProps),Re=Y?!!ie:ce,We=Y&&me||l;k.useEffect(()=>{U&&re&&U.disabledStatesRef.current.set(re,Q)},[U,Q,re]);const Ge=k.useMemo(()=>({...L,checked:Re,disabled:Q,readOnly:v,required:_,indeterminate:We}),[L,Re,Q,v,_,We]),vt=jW(Ge),Ke=dt("span",t,{state:Ge,ref:[_e,ve,r,N?.registerControlRef],props:[{id:X,role:"checkbox","aria-checked":me?"mixed":ce,"aria-readonly":v||void 0,"aria-required":_||void 0,"aria-labelledby":F,[Yde]:p?"":void 0,onFocus(){j(!0)},onBlur(){const Qe=Ee.current;Qe&&(I(!0),j(!1),z==="onBlur"&&ae.commit(N?he:Qe.checked))},onClick(Qe){v||Q||(Qe.preventDefault(),Ee.current?.click())}},G,ae.getValidationProps,w,ue,De],stateAttributesMapping:vt});return y.jsxs(MW.Provider,{value:Ge,children:[Ke,!ce&&!N&&J&&!p&&m!==void 0&&y.jsx("input",{type:"hidden",name:J,value:m}),y.jsx("input",{...st})]})}),Qde=k.forwardRef(function(t,r){const{render:n,className:i,keepMounted:s=!1,...o}=t,a=Kde(),l=a.checked||a.indeterminate,{transitionStatus:u,setMounted:h}=$o(l),d=k.useRef(null),p=k.useMemo(()=>({...a,transitionStatus:u}),[a,u]);gi({open:l,ref:d,onComplete(){l||h(!1)}});const v=jW(a),S=k.useMemo(()=>({...v,...ho,...zd}),[v]),_=s||l,m=dt("span",t,{enabled:_,ref:[r,d],state:p,stateAttributesMapping:S,props:o});return _?m:null});function Zde(e){const{multiple:t=!1,defaultValue:r,value:n,onValueChange:i,...s}=e;return y.jsx(Ode,{...s,selectionMode:t?"multiple":"single",selectedValue:n,defaultSelectedValue:r,onSelectedValueChange:i})}const Jde=k.forwardRef(function(t,r){const n=t.keepMounted??!1,{selected:i}=PW();return n||i?y.jsx(efe,{...t,ref:r}):null}),efe=k.memo(k.forwardRef((e,t)=>{const{render:r,className:n,keepMounted:i,...s}=e,{selected:o}=PW(),a=k.useRef(null),{transitionStatus:l,setMounted:u}=$o(o),h=k.useMemo(()=>({selected:o,transitionStatus:l}),[o,l]),d=dt("span",e,{ref:[t,a],state:h,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:ho});return gi({open:o,ref:a,onComplete(){o||u(!1)}}),d})),tfe=k.createContext(void 0);function mx(e=!0){const t=k.useContext(tfe);if(t===void 0&&!e)throw new Error(er(25));return t}const LW=k.createContext(void 0);function jj(e){const t=k.useContext(LW);if(t===void 0&&!e)throw new Error(er(33));return t}const DW=k.createContext(void 0);function lu(e){const t=k.useContext(DW);if(t===void 0&&!e)throw new Error(er(36));return t}const IW={type:"regular-item"};function NW(e){const{closeOnClick:t,disabled:r=!1,highlighted:n,id:i,store:s,nativeButton:o,itemMetadata:a,nodeId:l}=e,u=k.useRef(null),h=mx(!0),d=h!==void 0,{events:p}=s.useState("floatingTreeRoot"),{getButtonProps:v,buttonRef:S}=Di({disabled:r,focusableWhenDisabled:!0,native:o}),_=k.useCallback(x=>ya({id:i,role:"menuitem",tabIndex:n?0:-1,onMouseMove(b){l&&p.emit("itemhover",{nodeId:l,target:b.currentTarget})},onMouseEnter(){a.type==="submenu-trigger"&&a.setActive()},onKeyUp(b){b.key===" "&&s.context.typingRef.current&&b.preventBaseUIHandler()},onClick(b){t&&p.emit("close",{domEvent:b,reason:ud})},onMouseUp(b){if(h){const w=h.initialCursorPointRef.current;if(h.initialCursorPointRef.current=null,d&&w&&Math.abs(b.clientX-w.x)<=1&&Math.abs(b.clientY-w.y)<=1)return}u.current&&s.context.allowMouseUpTriggerRef.current&&(!d||b.button===2)&&a.type==="regular-item"&&u.current.click()}},x,v),[i,n,v,t,p,s,d,h,a,l]),m=co(u,S);return k.useMemo(()=>({getItemProps:_,itemRef:m}),[_,m])}let a4=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const BW={checked(e){return e?{[a4.checked]:""}:{[a4.unchecked]:""}},...ho},rfe=k.forwardRef(function(t,r){const{render:n,className:i,id:s,label:o,nativeButton:a=!1,disabled:l=!1,closeOnClick:u=!0,...h}=t,d=hp({label:o}),p=jj(!0),v=ni(s),{store:S}=lu(),_=S.useState("isActive",d.index),m=S.useState("itemProps"),{getItemProps:x,itemRef:b}=NW({closeOnClick:u,disabled:l,highlighted:_,id:v,store:S,nativeButton:a,nodeId:p?.nodeId,itemMetadata:IW}),w=k.useMemo(()=>({disabled:l,highlighted:_}),[l,_]);return dt("div",t,{state:w,props:[m,h,x],ref:[b,r,d.ref]})}),nfe={...zo,...ho},ife=k.forwardRef(function(t,r){const{render:n,className:i,finalFocus:s,...o}=t,{store:a}=lu(),{side:l,align:u}=jj(),h=Oj()!=null,d=a.useState("open"),p=a.useState("transitionStatus"),v=a.useState("popupProps"),S=a.useState("mounted"),_=a.useState("instantType"),m=a.useState("activeTriggerElement"),x=a.useState("parent"),b=a.useState("lastOpenChangeReason"),w=a.useState("rootId"),O=a.useState("floatingRootContext"),E=a.useState("floatingTreeRoot"),T=a.useState("closeDelay"),R=a.useState("activeTriggerElement");gi({open:d,ref:a.context.popupRef,onComplete(){d&&a.context.onOpenChangeComplete?.(!0)}}),k.useEffect(()=>{function D(V){a.setOpen(!1,Ue(V.reason,V.domEvent))}return E.events.on("close",D),()=>{E.events.off("close",D)}},[E.events,a]);const A=a.useState("hoverEnabled"),j=a.useState("disabled");ile(O,{enabled:A&&!j&&x.type!=="context-menu"&&x.type!=="menubar",closeDelay:T});const I=k.useMemo(()=>({transitionStatus:p,side:l,align:u,open:d,nested:x.type==="menu",instant:_}),[p,l,u,d,x.type,_]),L=dt("div",t,{state:I,ref:[r,a.context.popupRef],stateAttributesMapping:nfe,props:[v,{onKeyDown(D){h&&dj.has(D.key)&&D.stopPropagation()}},sx(p),o,{"data-rootownerid":w}]});let z=x.type===void 0||x.type==="context-menu";return(m||x.type==="menubar"&&b!==G1)&&(z=!0),y.jsx(Y1,{context:O,modal:!1,disabled:!S,returnFocus:s===void 0?z:s,initialFocus:x.type!=="menu",restoreFocus:!0,externalTree:x.type!=="menubar"?E:void 0,previousFocusableElement:R,nextFocusableElement:x.type===void 0?a.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:x.type===void 0?a.context.beforeContentFocusGuardRef:void 0,children:L})}),$W=k.createContext(void 0);function sfe(){const e=k.useContext($W);if(e===void 0)throw new Error(er(32));return e}const ofe=k.forwardRef(function(t,r){const{keepMounted:n=!1,...i}=t,{store:s}=lu();return s.useState("mounted")||n?y.jsx($W.Provider,{value:n,children:y.jsx(Rv,{ref:r,...i})}):null}),afe=k.forwardRef(function(t,r){const{anchor:n,positionMethod:i="absolute",className:s,render:o,side:a,align:l,sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:_=!1,collisionAvoidance:m=W1,...x}=t,{store:b}=lu(),w=sfe(),O=mx(!0),E=b.useState("parent"),T=b.useState("floatingRootContext"),R=b.useState("floatingTreeRoot"),A=b.useState("mounted"),j=b.useState("open"),I=b.useState("modal"),L=b.useState("activeTriggerElement"),z=b.useState("lastOpenChangeReason"),D=b.useState("floatingNodeId"),V=b.useState("floatingParentNodeId");let H=n,$=u,F=h,W=l,B=m;E.type==="context-menu"&&(H=n??E.context?.anchor,W=W??"start",!a&&W!=="center"&&(F=t.alignOffset??2,$=t.sideOffset??-5));let G=a,N=W;E.type==="menu"?(G=G??"inline-end",N=N??"start",B=t.collisionAvoidance??aU):E.type==="menubar"&&(G=G??"bottom",N=N??"start");const U=E.type==="context-menu",Y=ix({anchor:H,floatingRootContext:T,positionMethod:O?"fixed":i,mounted:A,side:G,sideOffset:$,align:N,alignOffset:F,arrowPadding:U?0:v,collisionBoundary:d,collisionPadding:p,sticky:S,nodeId:D,keepMounted:w,disableAnchorTracking:_,collisionAvoidance:B,shiftCrossAxis:U,externalTree:R}),Q=k.useMemo(()=>{const te={};return j||(te.pointerEvents="none"),{role:"presentation",hidden:!A,style:{...Y.positionerStyles,...te}}},[j,A,Y.positionerStyles]);k.useEffect(()=>{function te(ne){ne.open?(ne.parentNodeId===D&&b.set("hoverEnabled",!1),ne.nodeId!==D&&ne.parentNodeId===b.select("floatingParentNodeId")&&b.setOpen(!1,Ue(Gm))):ne.parentNodeId===D&&ne.reason!==Gm&&b.set("hoverEnabled",!0)}return R.events.on("menuopenchange",te),()=>{R.events.off("menuopenchange",te)}},[b,R.events,D]),k.useEffect(()=>{if(b.select("floatingParentNodeId")==null)return;function te(ne){if(ne.open||ne.nodeId!==b.select("floatingParentNodeId"))return;const ie=ne.reason??Gm;b.setOpen(!1,Ue(ie))}return R.events.on("menuopenchange",te),()=>{R.events.off("menuopenchange",te)}},[R.events,b]),k.useEffect(()=>{function te(ne){!j||ne.nodeId!==b.select("floatingParentNodeId")||ne.target&&L&&L!==ne.target&&b.setOpen(!1,Ue(Gm))}return R.events.on("itemhover",te),()=>{R.events.off("itemhover",te)}},[R.events,j,L,b]),k.useEffect(()=>{const te={open:j,nodeId:D,parentNodeId:V,reason:b.select("lastOpenChangeReason")};R.events.emit("menuopenchange",te)},[R.events,j,b,D,V]);const J=k.useMemo(()=>({open:j,side:Y.side,align:Y.align,anchorHidden:Y.anchorHidden,nested:E.type==="menu"}),[j,Y.side,Y.align,Y.anchorHidden,E.type]),re=k.useMemo(()=>({side:Y.side,align:Y.align,arrowRef:Y.arrowRef,arrowUncentered:Y.arrowUncentered,arrowStyles:Y.arrowStyles,nodeId:Y.context.nodeId}),[Y.side,Y.align,Y.arrowRef,Y.arrowUncentered,Y.arrowStyles,Y.context.nodeId]),X=dt("div",t,{state:J,stateAttributesMapping:zo,ref:[r,b.useStateSetter("positionerElement")],props:[Q,x]}),q=A&&E.type!=="menu"&&(E.type!=="menubar"&&I&&z!==ln||E.type==="menubar"&&E.context.modal);let Z=null;return E.type==="menubar"?Z=E.context.contentElement:E.type===void 0&&(Z=L),y.jsxs(LW.Provider,{value:re,children:[q&&y.jsx(cx,{ref:E.type==="context-menu"||E.type==="nested-context-menu"?E.context.internalBackdropRef:null,inert:fp(!j),cutout:Z}),y.jsx(KU,{id:D,children:y.jsx(jv,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:X})})]})}),zW=k.createContext(void 0);function lfe(){const e=k.useContext(zW);if(e===void 0)throw new Error(er(34));return e}const cfe=k.memo(k.forwardRef(function(t,r){const{render:n,className:i,value:s,defaultValue:o,onValueChange:a,disabled:l=!1,...u}=t,[h,d]=Os({controlled:s,default:o,name:"MenuRadioGroup"}),p=Be(a),v=Be((x,b)=>{p?.(x,b),!b.isCanceled&&d(x)}),S=k.useMemo(()=>({disabled:l}),[l]),_=dt("div",t,{state:S,ref:r,props:{role:"group","aria-disabled":l||void 0,...u}}),m=k.useMemo(()=>({value:h,setValue:v,disabled:l}),[h,v,l]);return y.jsx(zW.Provider,{value:m,children:_})})),HW=k.createContext(void 0);function ufe(){const e=k.useContext(HW);if(e===void 0)throw new Error(er(35));return e}const dfe=k.forwardRef(function(t,r){const{render:n,className:i,id:s,label:o,nativeButton:a=!1,disabled:l=!1,closeOnClick:u=!1,value:h,...d}=t,p=hp({label:o}),v=jj(!0),S=ni(s),{store:_}=lu(),m=_.useState("isActive",p.index),x=_.useState("itemProps"),{value:b,setValue:w,disabled:O}=lfe(),E=O||l,T=b===h,{getItemProps:R,itemRef:A}=NW({closeOnClick:u,disabled:E,highlighted:m,id:S,store:_,nativeButton:a,nodeId:v?.nodeId,itemMetadata:IW}),j=k.useMemo(()=>({disabled:E,highlighted:m,checked:T}),[E,m,T]),I=Be(z=>{const D={...Ue(ud,z.nativeEvent),preventUnmountOnClose:()=>{}};w(h,D)}),L=dt("div",t,{state:j,stateAttributesMapping:BW,props:[x,{role:"menuitemradio","aria-checked":T,onClick:I},d,R],ref:[A,r,p.ref]});return y.jsx(HW.Provider,{value:j,children:L})}),ffe=k.forwardRef(function(t,r){const{render:n,className:i,keepMounted:s=!1,...o}=t,a=ufe(),l=k.useRef(null),{transitionStatus:u,setMounted:h}=$o(a.checked);gi({open:a.checked,ref:l,onComplete(){a.checked||h(!1)}});const d=k.useMemo(()=>({checked:a.checked,disabled:a.disabled,highlighted:a.highlighted,transitionStatus:u}),[a.checked,a.disabled,a.highlighted,u]);return dt("span",t,{state:d,stateAttributesMapping:BW,ref:[r,l],props:{"aria-hidden":!0,...o},enabled:s||a.checked})}),hfe=k.createContext(null);function FW(e){return k.useContext(hfe)}const pfe={...gV,disabled:ke(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:ke(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:ke(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:ke(e=>e.stickIfOpen),parent:ke(e=>e.parent),rootId:ke(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:ke(e=>e.activeIndex),isActive:ke((e,t)=>e.activeIndex===t),hoverEnabled:ke(e=>e.hoverEnabled),instantType:ke(e=>e.instantType),lastOpenChangeReason:ke(e=>e.openChangeReason),floatingTreeRoot:ke(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:ke(e=>e.floatingNodeId),floatingParentNodeId:ke(e=>e.floatingParentNodeId),itemProps:ke(e=>e.itemProps),closeDelay:ke(e=>e.closeDelay),keyboardEventRelay:ke(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Mj extends aj{constructor(t){super({...mfe(),...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 Q1},pfe),this.observe(ke(r=>r.allowMouseEnter),(r,n)=>{this.state.parent.type==="menu"&&r!==n&&this.state.parent.store.set("allowMouseEnter",r)}),this.unsubscribeParentListener=this.observe("parent",r=>{if(this.unsubscribeParentListener?.(),r.type==="menu"){this.unsubscribeParentListener=r.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=r.store.context.allowMouseUpTriggerRef;return}r.type!==void 0&&(this.context.allowMouseUpTriggerRef=r.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,r){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:r})}static useStore(t,r){return ti(()=>t??new Mj(r)).current}unsubscribeParentListener=null}function mfe(){return{...mV(),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 nj,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Ur,keyboardEventRelay:void 0,closeDelay:0}}const gfe=k.createContext(void 0);function vfe(){return k.useContext(gfe)}function yfe(e){const{children:t,open:r,onOpenChange:n,onOpenChangeComplete:i,defaultOpen:s=!1,disabled:o=!1,modal:a,loopFocus:l=!0,orientation:u="vertical",actionsRef:h,closeParentOnEsc:d=!1,handle:p,triggerId:v,defaultTriggerId:S=null,highlightItemOnHover:_=!0}=e,m=mx(!0),x=lu(!0),b=FW(),w=vfe(),O=k.useMemo(()=>w&&x?{type:"menu",store:x.store}:b?{type:"menubar",context:b}:m&&!x?{type:"context-menu",context:m}:{type:void 0},[m,x,b,w]),E=Mj.useStore(p?.store,{parent:O}),T=E.useState("floatingTreeRoot"),R=ij(T),A=No();He(()=>{m&&!x?E.update({parent:{type:"context-menu",context:m},floatingNodeId:R,floatingParentNodeId:A}):x&&E.update({floatingNodeId:R,floatingParentNodeId:A})},[m,x,R,A,E]),E.useControlledProp("open",r,s),E.useControlledProp("activeTriggerId",v,S),E.useContextCallback("onOpenChangeComplete",i);const j=E.useState("open"),I=E.useState("activeTriggerElement"),L=E.useState("positionerElement"),z=E.useState("hoverEnabled"),D=E.useState("modal"),V=E.useState("disabled"),H=E.useState("lastOpenChangeReason"),$=E.useState("parent"),F=E.useState("activeIndex"),W=E.useState("payload"),B=E.useState("floatingParentNodeId"),G=k.useRef(null),N=B!=null;let U;E.useSyncedValues({disabled:o,modal:$.type===void 0?a:void 0,rootId:su()});const{openMethod:Y,triggerProps:Q,reset:J}=dx(j);hV(E);const{forceUnmount:re}=pV(j,E,()=>{E.update({allowMouseEnter:!1,stickIfOpen:!0}),J()}),X=k.useRef($.type!=="context-menu"),q=Sr();k.useEffect(()=>{if(j||(G.current=null),$.type==="context-menu"){if(!j){q.clear(),X.current=!1;return}q.start(500,()=>{X.current=!0})}},[q,j,$.type]),ux(j&&D&&H!==ln&&Y!=="touch",L),He(()=>{!j&&!z&&E.set("hoverEnabled",!0)},[j,z,E]);const Z=k.useRef(!0),te=Sr(),ne=Be((Ae,ot)=>{const ft=ot.reason;if(j===Ae&&ot.trigger===I||(ot.preventUnmountOnClose=()=>{E.set("preventUnmountingOnClose",!0)},!Ae&&ot.trigger==null&&(ot.trigger=I??void 0),n?.(Ae,ot),ot.isCanceled))return;const Je={open:Ae,nativeEvent:ot.event,reason:ot.reason,nested:N};U?.emit("openchange",Je);const lt=ot.event;if(Ae===!1&&lt?.type==="click"&&lt.pointerType==="touch"&&!Z.current)return;if(!Ae&&F!==null){const It=E.context.itemDomElements.current[F];queueMicrotask(()=>{It?.setAttribute("tabindex","-1")})}Ae&&ft===e_?(Z.current=!1,te.start(300,()=>{Z.current=!0})):(Z.current=!0,te.clear());const Ht=(ft===Dc||ft===ud)&&lt.detail===0&&lt?.isTrusted,pt=!Ae&&(ft===K1||ft==null);function Pr(){const It={open:Ae,openChangeReason:ft};G.current=ot.event??null;const kt=ot.trigger?.id??null;(kt||Ae)&&(It.activeTriggerId=kt,It.activeTriggerElement=ot.trigger??null),E.update(It)}ft===ln?hn.flushSync(Pr):Pr(),$.type==="menubar"&&(ft===e_||ft===Lo||ft===ln||ft===eh||ft===Gm)?E.set("instantType","group"):Ht||pt?E.set("instantType",Ht?"click":"dismiss"):E.set("instantType",void 0)}),ie=k.useCallback(Ae=>{const ot=Ue(Ae);return ot.preventUnmountOnClose=()=>{E.set("preventUnmountingOnClose",!0)},ot},[E]),me=k.useCallback(()=>{E.setOpen(!1,ie(QU))},[E,ie]);k.useImperativeHandle(h,()=>({unmount:re,close:me}),[re,me]);let ye;$.type==="context-menu"&&(ye=$.context),k.useImperativeHandle(ye?.positionerRef,()=>L,[L]),k.useImperativeHandle(ye?.actionsRef,()=>({setOpen:ne}),[ne]);const ue=vV({popupStore:E,onOpenChange:ne});U=ue.context.events,k.useEffect(()=>{const Ae=({open:ot,eventDetails:ft})=>ne(ot,ft);return U.on("setOpen",Ae),()=>{U?.off("setOpen",Ae)}},[U,ne]);const he=Pv(ue,{enabled:!V,bubbles:d&&$.type==="menu",outsidePress(){return $.type!=="context-menu"||G.current?.type==="contextmenu"?!0:X.current},externalTree:N?T:void 0}),fe=bV(ue,{role:"menu"}),$e=ou(),ve=k.useCallback(Ae=>{E.select("activeIndex")!==Ae&&E.set("activeIndex",Ae)},[E]),De=cj(ue,{enabled:!V,listRef:E.context.itemDomElements,activeIndex:F,nested:$.type!==void 0,loopFocus:l,orientation:u,parentOrientation:$.type==="menubar"?$.context.orientation:void 0,rtl:$e==="rtl",disabledIndices:ki,onNavigate:ve,openOnArrowKeyDown:$.type!=="context-menu",externalTree:N?T:void 0,focusItemOnHover:_}),_e=k.useCallback(Ae=>{E.context.typingRef.current=Ae},[E]),ae=uj(ue,{listRef:E.context.itemLabels,activeIndex:F,resetMs:Gie,onMatch:Ae=>{j&&Ae!==F&&E.set("activeIndex",Ae)},onTypingChange:_e}),{getReferenceProps:ce,getFloatingProps:be,getItemProps:Ee,getTriggerProps:Ve}=Nd([he,fe,De,ae]),st=k.useMemo(()=>{const Ae=ya(ce(),{onMouseEnter(){E.set("hoverEnabled",!0)},onMouseMove(){E.set("allowMouseEnter",!0)}},Q);return delete Ae.role,Ae},[ce,E,Q]),Re=k.useMemo(()=>{const Ae=Ve();if(!Ae)return Ae;const ot=ya(Ae,Q);return delete ot.role,delete ot["aria-controls"],ot},[Ve,Q]),We=Ic(),Ge=k.useMemo(()=>be({onMouseEnter(){$.type==="menu"&&We.request(()=>E.set("hoverEnabled",!1))},onMouseMove(){E.set("allowMouseEnter",!0)},onClick(){E.select("hoverEnabled")&&E.set("hoverEnabled",!1)},onKeyDown(Ae){const ot=E.select("keyboardEventRelay");ot&&!Ae.isPropagationStopped()&&ot(Ae)}}),[be,$.type,We,E]),vt=k.useMemo(()=>Ee(),[Ee]);E.useSyncedValues({floatingRootContext:ue,activeTriggerProps:st,inactiveTriggerProps:Re,popupProps:Ge,itemProps:vt});const Ke=k.useMemo(()=>({store:E,parent:O}),[E,O]),Qe=y.jsx(DW.Provider,{value:Ke,children:typeof t=="function"?t({payload:W}):t});return $.type===void 0||$.type==="context-menu"?y.jsx(YU,{externalTree:T,children:Qe}):Qe}function UW(e){if(Dr(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!la(e))return UW(va(e))}function bfe(e){const{enabled:t=!0,mouseDownAction:r,open:n}=e,i=k.useRef(!1);return k.useMemo(()=>t?{onMouseDown:s=>{(r==="open"&&!n||r==="close"&&n)&&(i.current=!0,ri(s.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:s=>{i.current&&(i.current=!1,s.preventBaseUIHandler())}}:Ur,[t,r,n])}const qb=2,_fe=k.forwardRef(function(t,r){const{render:n,className:i,disabled:s=!1,nativeButton:o=!0,id:a,openOnHover:l,delay:u=100,closeDelay:h=0,handle:d,payload:p,...v}=t,S=lu(!0),_=d?.store??S?.store;if(!_)throw new Error(er(85));const m=ni(a),x=_.useState("isTriggerActive",m),b=_.useState("floatingRootContext"),w=_.useState("isOpenedByTrigger",m),O=k.useRef(null),E=Sfe(),T=WP(!0),R=Bo(),A=k.useMemo(()=>R??new nj,[R]),j=ij(A),I=No(),{registerTrigger:L,isMountedByThisTrigger:z}=fV(m,O,_,{payload:p,closeDelay:h,parent:E,floatingTreeRoot:A,floatingNodeId:j,floatingParentNodeId:I,keyboardEventRelay:T?.relayKeyboardEvent}),D=_.useState("disabled"),V=s||D||E.type==="menubar"&&E.context.disabled,{getButtonProps:H,buttonRef:$}=Di({disabled:V,native:o});k.useEffect(()=>{!w&&E.type===void 0&&(_.context.allowMouseUpTriggerRef.current=!1)},[_,w,E.type]);const F=k.useRef(null),W=Sr(),B=Be(fe=>{if(!F.current)return;W.clear(),_.context.allowMouseUpTriggerRef.current=!1;const $e=fe.target;if(ut(F.current,$e)||ut(_.select("positionerElement"),$e)||$e===F.current||$e!=null&&UW($e)===_.select("rootId"))return;const ve=Cj(F.current);fe.clientX>=ve.left-qb&&fe.clientX<=ve.right+qb&&fe.clientY>=ve.top-qb&&fe.clientY<=ve.bottom+qb||A.events.emit("close",{domEvent:fe,reason:XU})});k.useEffect(()=>{w&&_.select("lastOpenChangeReason")===ln&&ri(F.current).addEventListener("mouseup",B,{once:!0})},[w,B,_]);const G=E.type==="menubar"&&E.context.hasSubmenuOpen,U=ale(b,{enabled:(l??G??!1)&&!V&&E.type!=="context-menu"&&(E.type!=="menubar"||G&&!z),handleClose:_V({blockPointerEvents:E.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:E.type===void 0?u:void 0,delay:{close:h},triggerElementRef:O,externalTree:A,isActiveTrigger:x}),Y=xfe(w,_.select("lastOpenChangeReason")),Q=dp(b,{enabled:!V&&E.type!=="context-menu",event:w&&E.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:E.type===void 0?Y:!1}),J=ele(b,{enabled:!V&&(E.type!=="menubar"&&w||G)}),re=bfe({open:w,enabled:E.type==="menubar",mouseDownAction:"open"}),X=Nd([Q,J]),q=E.type==="menubar",Z=k.useMemo(()=>({disabled:V,open:w}),[V,w]),te=_.useState("triggerProps",z),ne=[F,r,$,L,O],ie=[X.getReferenceProps(),U??Ur,te,{"aria-haspopup":"menu",id:m,onMouseDown:fe=>{if(_.select("open"))return;W.start(200,()=>{_.context.allowMouseUpTriggerRef.current=!0}),ri(fe.currentTarget).addEventListener("mouseup",B,{once:!0})}},q?{role:"menuitem"}:{},re,v,H],me=k.useRef(null),ye=Be(fe=>{hn.flushSync(()=>{_.setOpen(!1,Ue(Lo,fe.nativeEvent,fe.currentTarget))}),Eoe(me.current)?.focus()}),ue=Be(fe=>{const $e=_.select("positionerElement");if($e&&Ro(fe,$e))_.context.beforeContentFocusGuardRef.current?.focus();else{hn.flushSync(()=>{_.setOpen(!1,Ue(Lo,fe.nativeEvent,fe.currentTarget))});let ve=Coe(O.current);for(;ve!==null&&ut($e,ve)||ve?.hasAttribute("aria-hidden");){const De=ve;if(ve=Av(ve),ve===De)break}ve?.focus()}}),he=dt("button",t,{enabled:!q,stateAttributesMapping:yh,state:Z,ref:ne,props:ie});return q?y.jsx(nx,{tag:"button",render:n,className:i,state:Z,refs:ne,props:ie,stateAttributesMapping:yh}):w?y.jsxs(k.Fragment,{children:[y.jsx(ba,{ref:me,onFocus:ye},`${m}-pre-focus-guard`),y.jsx(k.Fragment,{children:he},m),y.jsx(ba,{ref:_.context.triggerFocusTargetRef,onFocus:ue},`${m}-post-focus-guard`)]}):y.jsx(k.Fragment,{children:he},m)});function xfe(e,t){const r=Sr(),[n,i]=k.useState(!1);return He(()=>{e&&t==="trigger-hover"?(i(!0),r.start(sU,()=>{i(!1)})):e||(r.clear(),i(!1))},[e,t,r]),n}function Sfe(){const e=mx(!0),t=lu(!0),r=FW();return k.useMemo(()=>r?{type:"menubar",context:r}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,r])}function il(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}const VW=k.createContext(void 0);function gx(){const e=k.useContext(VW);if(e===void 0)throw new Error(er(53));return e}let a_=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const Gb=500,l4=16;function ro(e,t,r){if(!e)return 0;const n=getComputedStyle(e),i=r==="x"?"Inline":"Block";return r==="x"&&t==="margin"?parseFloat(n[`${t}InlineStart`])*2:parseFloat(n[`${t}${i}Start`])+parseFloat(n[`${t}${i}End`])}let wfe=(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})({}),If=(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 Lj={hasOverflowX:e=>e?{[If.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[If.hasOverflowY]:""}:null,overflowXStart:e=>e?{[If.overflowXStart]:""}:null,overflowXEnd:e=>e?{[If.overflowXEnd]:""}:null,overflowYStart:e=>e?{[If.overflowYStart]:""}:null,overflowYEnd:e=>e?{[If.overflowYEnd]:""}:null,cornerHidden:()=>null},c4={width:0,height:0},Cfe={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Efe=k.forwardRef(function(t,r){const{render:n,className:i,overflowEdgeThreshold:s,...o}=t,[a,l]=k.useState(!1),[u,h]=k.useState(!1),[d,p]=k.useState(!1),[v,S]=k.useState(c4),[_,m]=k.useState(c4),[x,b]=k.useState(!1),[w,O]=k.useState(Cfe),E=ni(),T=k.useRef(null),R=k.useRef(null),A=k.useRef(null),j=k.useRef(null),I=k.useRef(null),L=k.useRef(null),z=k.useRef(null),D=k.useRef(!1),V=k.useRef(0),H=k.useRef(0),$=k.useRef(0),F=k.useRef(0),W=k.useRef("vertical"),B=Sr(),G=Sr(),N=k.useRef({x:0,y:0}),[U,Y]=k.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),Q=Ofe(s),J=Be(ye=>{const ue=ye.x-N.current.x,he=ye.y-N.current.y;N.current=ye,he!==0&&(p(!0),B.start(Gb,()=>{p(!1)})),ue!==0&&(h(!0),G.start(Gb,()=>{h(!1)}))}),re=Be(ye=>{ye.button===0&&(D.current=!0,V.current=ye.clientY,H.current=ye.clientX,W.current=ye.currentTarget.getAttribute(wfe.orientation),R.current&&($.current=R.current.scrollTop,F.current=R.current.scrollLeft),I.current&&W.current==="vertical"&&I.current.setPointerCapture(ye.pointerId),L.current&&W.current==="horizontal"&&L.current.setPointerCapture(ye.pointerId))}),X=Be(ye=>{if(!D.current)return;const ue=ye.clientY-V.current,he=ye.clientX-H.current;if(R.current){const fe=R.current.scrollHeight,$e=R.current.clientHeight,ve=R.current.scrollWidth,De=R.current.clientWidth;if(I.current&&A.current&&W.current==="vertical"){const _e=ro(A.current,"padding","y"),ae=ro(I.current,"margin","y"),ce=I.current.offsetHeight,be=A.current.offsetHeight-ce-_e-ae,Ee=ue/be;R.current.scrollTop=$.current+Ee*(fe-$e),ye.preventDefault(),p(!0),B.start(Gb,()=>{p(!1)})}if(L.current&&j.current&&W.current==="horizontal"){const _e=ro(j.current,"padding","x"),ae=ro(L.current,"margin","x"),ce=L.current.offsetWidth,be=j.current.offsetWidth-ce-_e-ae,Ee=he/be;R.current.scrollLeft=F.current+Ee*(ve-De),ye.preventDefault(),h(!0),G.start(Gb,()=>{h(!1)})}}}),q=Be(ye=>{D.current=!1,I.current&&W.current==="vertical"&&I.current.releasePointerCapture(ye.pointerId),L.current&&W.current==="horizontal"&&L.current.releasePointerCapture(ye.pointerId)});function Z(ye){const ue=ye.pointerType==="touch";if(b(ue),!ue){const he=ut(T.current,ye.target);l(he)}}const te=k.useMemo(()=>({hasOverflowX:!U.scrollbarXHidden,hasOverflowY:!U.scrollbarYHidden,overflowXStart:w.xStart,overflowXEnd:w.xEnd,overflowYStart:w.yStart,overflowYEnd:w.yEnd,cornerHidden:U.cornerHidden}),[U.scrollbarXHidden,U.scrollbarYHidden,U.cornerHidden,w]),ne={role:"presentation",onPointerEnter:Z,onPointerMove:Z,onPointerDown({pointerType:ye}){b(ye==="touch")},onPointerLeave(){l(!1)},style:{position:"relative",[a_.scrollAreaCornerHeight]:`${v.height}px`,[a_.scrollAreaCornerWidth]:`${v.width}px`}},ie=dt("div",t,{state:te,ref:[r,T],props:[ne,o],stateAttributesMapping:Lj}),me=k.useMemo(()=>({handlePointerDown:re,handlePointerMove:X,handlePointerUp:q,handleScroll:J,cornerSize:v,setCornerSize:S,thumbSize:_,setThumbSize:m,touchModality:x,cornerRef:z,scrollingX:u,setScrollingX:h,scrollingY:d,setScrollingY:p,hovering:a,setHovering:l,viewportRef:R,rootRef:T,scrollbarYRef:A,scrollbarXRef:j,thumbYRef:I,thumbXRef:L,rootId:E,hiddenState:U,setHiddenState:Y,overflowEdges:w,setOverflowEdges:O,viewportState:te,overflowEdgeThreshold:Q}),[re,X,q,J,v,_,x,z,u,h,d,p,a,l,R,T,A,j,I,L,E,U,w,te,Q]);return y.jsxs(VW.Provider,{value:me,children:[Eg.element,ie]})});function Ofe(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 Tfe=k.createContext(void 0);function kfe(e,t){if(typeof IntersectionObserver>"u")return()=>{};const r=new IntersectionObserver(n=>{n.forEach(i=>{i.intersectionRatio>0&&(t(),r.disconnect())})});return r.observe(e),()=>{r.disconnect()}}let wc=(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})({}),u4=!1;function Afe(){u4||YP||(typeof CSS<"u"&&"registerProperty"in CSS&&[wc.scrollAreaOverflowXStart,wc.scrollAreaOverflowXEnd,wc.scrollAreaOverflowYStart,wc.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),u4=!0)}const Rfe=k.forwardRef(function(t,r){const{render:n,className:i,...s}=t,{viewportRef:o,scrollbarYRef:a,scrollbarXRef:l,thumbYRef:u,thumbXRef:h,cornerRef:d,setCornerSize:p,setThumbSize:v,rootId:S,setHiddenState:_,hiddenState:m,handleScroll:x,setHovering:b,setOverflowEdges:w,overflowEdges:O,overflowEdgeThreshold:E}=gx(),T=ou(),R=k.useRef(!0),A=Sr(),j=Sr();function I(){const F=o.current,W=a.current,B=l.current,G=u.current,N=h.current,U=d.current;if(!F)return;const Y=F.scrollHeight,Q=F.scrollWidth,J=F.clientHeight,re=F.clientWidth,X=F.scrollTop,q=F.scrollLeft;if(Y===0||Q===0)return;const Z=J>=Y,te=re>=Q,ne=re/Q,ie=J/Y,me=Math.max(0,Q-re),ye=Math.max(0,Y-J);let ue=0,he=0;te||(T==="rtl"?ue=il(-q,0,me):ue=il(q,0,me),he=me-ue);const fe=Z?0:il(X,0,ye),$e=Z?0:ye-fe,ve=te?0:re,De=Z?0:J,_e=ro(B,"padding","x"),ae=ro(W,"padding","y"),ce=ro(N,"margin","x"),be=ro(G,"margin","y"),Ee=ve-_e-ce,Ve=De-ae-be,st=B?Math.min(B.offsetWidth,Ee):Ee,Re=W?Math.min(W.offsetHeight,Ve):Ve,We=Math.max(l4,st*ne),Ge=Math.max(l4,Re*ie);if(v(Je=>Je.height===Ge&&Je.width===We?Je:{width:We,height:Ge}),W&&G){const Je=W.offsetHeight-Ge-ae-be,lt=Y-J,Ht=lt===0?0:X/lt,pt=Math.min(Je,Math.max(0,Ht*Je));G.style.transform=`translate3d(0,${pt}px,0)`}if(B&&N){const Je=B.offsetWidth-We-_e-ce,lt=Q-re,Ht=lt===0?0:q/lt,pt=T==="rtl"?il(Ht*Je,-Je,0):il(Ht*Je,0,Je);N.style.transform=`translate3d(${pt}px,0,0)`}const vt=il(ue,0,me),Ke=il(he,0,me),Qe=il(fe,0,ye),Ae=il($e,0,ye),ot=[[wc.scrollAreaOverflowXStart,vt],[wc.scrollAreaOverflowXEnd,Ke],[wc.scrollAreaOverflowYStart,Qe],[wc.scrollAreaOverflowYEnd,Ae]];for(const[Je,lt]of ot)F.style.setProperty(Je,`${lt}px`);if(U){if(te||Z)p({width:0,height:0});else if(!te&&!Z){const Je=W?.offsetWidth||0,lt=B?.offsetHeight||0;p({width:Je,height:lt})}}_(Je=>{const lt=Z||te;return Je.scrollbarYHidden===Z&&Je.scrollbarXHidden===te&&Je.cornerHidden===lt?Je:{scrollbarYHidden:Z,scrollbarXHidden:te,cornerHidden:lt}});const ft={xStart:!te&&vt>E.xStart,xEnd:!te&&Ke>E.xEnd,yStart:!Z&&Qe>E.yStart,yEnd:!Z&&Ae>E.yEnd};w(Je=>Je.xStart===ft.xStart&&Je.xEnd===ft.xEnd&&Je.yStart===ft.yStart&&Je.yEnd===ft.yEnd?Je:ft)}const L=Be(()=>{hn.flushSync(I)});He(()=>o.current?(Afe(),kfe(o.current,L)):void 0,[L,o]),He(()=>{queueMicrotask(L)},[L,m,T]),He(()=>{o.current?.matches(":hover")&&b(!0)},[o,b]),k.useEffect(()=>{const F=o.current;if(typeof ResizeObserver>"u"||!F)return;const W=new ResizeObserver(L);return W.observe(F),j.start(0,()=>{Promise.all(F.getAnimations({subtree:!0}).map(B=>B.finished)).then(L).catch(()=>{})}),()=>{W.disconnect(),j.clear()}},[L,o,j]);function z(){R.current=!1}const D={role:"presentation",...S&&{"data-id":`${S}-viewport`},...(!m.scrollbarXHidden||!m.scrollbarYHidden)&&{tabIndex:0},className:Eg.className,style:{overflow:"scroll"},onScroll(){o.current&&(L(),R.current||x({x:o.current.scrollLeft,y:o.current.scrollTop}),A.start(100,()=>{R.current=!0}))},onWheel:z,onTouchMove:z,onPointerMove:z,onPointerEnter:z,onKeyDown:z},V=k.useMemo(()=>({hasOverflowX:!m.scrollbarXHidden,hasOverflowY:!m.scrollbarYHidden,overflowXStart:O.xStart,overflowXEnd:O.xEnd,overflowYStart:O.yStart,overflowYEnd:O.yEnd,cornerHidden:m.cornerHidden}),[m.scrollbarXHidden,m.scrollbarYHidden,m.cornerHidden,O]),H=dt("div",t,{ref:[r,o],state:V,props:[D,s],stateAttributesMapping:Lj}),$=k.useMemo(()=>({computeThumbPosition:L}),[L]);return y.jsx(Tfe.Provider,{value:$,children:H})}),WW=k.createContext(void 0);function Pfe(){const e=k.useContext(WW);if(e===void 0)throw new Error(er(54));return e}let l_=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const jfe=k.forwardRef(function(t,r){const{render:n,className:i,orientation:s="vertical",keepMounted:o=!1,...a}=t,{hovering:l,scrollingX:u,scrollingY:h,hiddenState:d,overflowEdges:p,scrollbarYRef:v,scrollbarXRef:S,viewportRef:_,thumbYRef:m,thumbXRef:x,handlePointerDown:b,handlePointerUp:w,rootId:O,thumbSize:E}=gx(),T=k.useMemo(()=>({hovering:l,scrolling:{horizontal:u,vertical:h}[s],orientation:s,hasOverflowX:!d.scrollbarXHidden,hasOverflowY:!d.scrollbarYHidden,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:d.cornerHidden}),[l,u,h,s,d,p]),R=ou();k.useEffect(()=>{const D=_.current,V=s==="vertical"?v.current:S.current;if(!V)return;function H($){if(!(!D||!V||$.ctrlKey)){if($.preventDefault(),s==="vertical"){if(D.scrollTop===0&&$.deltaY<0)return}else if(D.scrollLeft===0&&$.deltaX<0)return;if(s==="vertical"){if(D.scrollTop===D.scrollHeight-D.clientHeight&&$.deltaY>0)return}else if(D.scrollLeft===D.scrollWidth-D.clientWidth&&$.deltaX>0)return;s==="vertical"?D.scrollTop+=$.deltaY:D.scrollLeft+=$.deltaX}}return V.addEventListener("wheel",H,{passive:!1}),()=>{V.removeEventListener("wheel",H)}},[s,S,v,_]);const A={...O&&{"data-id":`${O}-scrollbar`},onPointerDown(D){if(D.button===0&&D.currentTarget===D.target&&_.current){if(m.current&&v.current&&s==="vertical"){const V=ro(m.current,"margin","y"),H=ro(v.current,"padding","y"),$=m.current.offsetHeight,F=v.current.getBoundingClientRect(),W=D.clientY-F.top-$/2-H+V/2,B=_.current.scrollHeight,G=_.current.clientHeight,N=v.current.offsetHeight-$-H-V,Y=W/N*(B-G);_.current.scrollTop=Y}if(x.current&&S.current&&s==="horizontal"){const V=ro(x.current,"margin","x"),H=ro(S.current,"padding","x"),$=x.current.offsetWidth,F=S.current.getBoundingClientRect(),W=D.clientX-F.left-$/2-H+V/2,B=_.current.scrollWidth,G=_.current.clientWidth,N=S.current.offsetWidth-$-H-V,U=W/N;let Y;R==="rtl"?(Y=(1-U)*(B-G),_.current.scrollLeft<=0&&(Y=-Y)):Y=U*(B-G),_.current.scrollLeft=Y}b(D)}},onPointerUp:w,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...s==="vertical"&&{top:0,bottom:`var(${a_.scrollAreaCornerHeight})`,insetInlineEnd:0,[l_.scrollAreaThumbHeight]:`${E.height}px`},...s==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${a_.scrollAreaCornerWidth})`,bottom:0,[l_.scrollAreaThumbWidth]:`${E.width}px`}}},j=dt("div",t,{ref:[r,s==="vertical"?v:S],state:T,props:[A,a],stateAttributesMapping:Lj}),I=k.useMemo(()=>({orientation:s}),[s]),L=s==="vertical"?d.scrollbarYHidden:d.scrollbarXHidden;return o||!L?y.jsx(WW.Provider,{value:I,children:j}):null}),Mfe=k.forwardRef(function(t,r){const{render:n,className:i,...s}=t,{thumbYRef:o,thumbXRef:a,handlePointerDown:l,handlePointerMove:u,handlePointerUp:h,setScrollingX:d,setScrollingY:p}=gx(),{orientation:v}=Pfe(),S=k.useMemo(()=>({orientation:v}),[v]);return dt("div",t,{ref:[r,v==="vertical"?o:a],state:S,props:[{onPointerDown:l,onPointerMove:u,onPointerUp(m){v==="vertical"&&p(!1),v==="horizontal"&&d(!1),h(m)},style:{...v==="vertical"&&{height:`var(${l_.scrollAreaThumbHeight})`},...v==="horizontal"&&{width:`var(${l_.scrollAreaThumbWidth})`}}},s]})}),Lfe=k.forwardRef(function(t,r){const{render:n,className:i,...s}=t,{cornerRef:o,cornerSize:a,hiddenState:l}=gx(),u=dt("div",t,{ref:[r,o],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:a.width,height:a.height}},s]});return l.cornerHidden?null:u}),qW=k.createContext(void 0);function Dfe(){const e=k.useContext(qW);if(e===void 0)throw new Error(er(63));return e}let d4=(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 GW={...zd,checked(e){return e?{[d4.checked]:""}:{[d4.unchecked]:""}}},Ife=k.forwardRef(function(t,r){const{checked:n,className:i,defaultChecked:s,id:o,inputRef:a,name:l,nativeButton:u=!1,onCheckedChange:h,readOnly:d=!1,required:p=!1,disabled:v=!1,render:S,uncheckedValue:_,...m}=t,{clearErrors:x}=$v(),{state:b,setTouched:w,setDirty:O,validityData:E,setFilled:T,setFocused:R,shouldValidateOnChange:A,validationMode:j,disabled:I,name:L,validation:z}=uo(),{labelId:D}=au(),V=I||v,H=L??l,$=Be(h),F=k.useRef(null),W=co(F,a,z.inputRef),B=k.useRef(null),G=ni(),N=fx({id:o,implicit:!1,controlRef:B}),[U,Y]=Os({controlled:n,default:!!s,name:"Switch",state:"checked"});zv({id:G,commit:z.commit,value:U,controlRef:B,name:H,getValue:()=>U}),He(()=>{F.current&&T(F.current.checked)},[F,T]),Ju(U,()=>{x(H),O(U!==E.initialValue),T(U),A()?z.commit(U):z.commit(U,!0)});const{getButtonProps:Q,buttonRef:J}=Di({disabled:V,native:u}),re={id:G,role:"switch","aria-checked":U,"aria-readonly":d||void 0,"aria-labelledby":D,onFocus(){V||R(!0)},onBlur(){const te=F.current;!te||V||(w(!0),R(!1),j==="onBlur"&&z.commit(te.checked))},onClick(te){d||V||(te.preventDefault(),F?.current?.click())}},X=k.useMemo(()=>ya({checked:U,disabled:V,id:N,name:H,required:p,style:up,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:W,onChange(te){if(te.nativeEvent.defaultPrevented)return;const ne=te.target.checked,ie=Ue(Pn,te.nativeEvent);$?.(ne,ie),!ie.isCanceled&&Y(ne)},onFocus(){B.current?.focus()}},z.getInputValidationProps),[U,V,W,N,H,$,p,Y,z]),q=k.useMemo(()=>({...b,checked:U,disabled:V,readOnly:d,required:p}),[b,U,V,d,p]),Z=dt("span",t,{state:q,ref:[r,B,J],props:[re,z.getValidationProps,m,Q],stateAttributesMapping:GW});return y.jsxs(qW.Provider,{value:q,children:[Z,!U&&H&&_!==void 0&&y.jsx("input",{type:"hidden",name:H,value:_}),y.jsx("input",{...X})]})}),Nfe=k.forwardRef(function(t,r){const{render:n,className:i,...s}=t,{state:o}=uo(),a=Dfe(),l={...o,...a};return dt("span",t,{state:l,ref:r,stateAttributesMapping:GW,props:s})}),KW=k.createContext(void 0);function Bfe(e=!0){const t=k.useContext(KW);if(t===void 0&&!e)throw new Error(er(7));return t}const $fe=k.forwardRef(function(t,r){const{className:n,defaultPressed:i=!1,disabled:s=!1,form:o,onPressedChange:a,pressed:l,render:u,type:h,value:d,nativeButton:p=!0,...v}=t,S=ni(d||void 0),_=Bfe(),m=_?.value??[],x=_?void 0:i,b=(s||_?.disabled)??!1,[w,O]=Os({controlled:_?m?.indexOf(S)>-1:l,default:x,name:"Toggle",state:"pressed"}),E=Be((z,D)=>{S&&_?.setGroupValue?.(S,z,D),a?.(z,D)}),{getButtonProps:T,buttonRef:R}=Di({disabled:b,native:p}),A=k.useMemo(()=>({disabled:b,pressed:w}),[b,w]),j=[R,r],I=[{"aria-pressed":w,onClick(z){const D=!w,V=Ue(Pn,z.nativeEvent);E(D,V),!V.isCanceled&&O(D)}},v,T],L=dt("button",t,{enabled:!_,state:A,ref:j,props:I});return _?y.jsx(nx,{tag:"button",render:u,className:n,state:A,refs:j,props:I}):L});let zfe=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const f4={multiple(e){return e?{[zfe.multiple]:""}:null}},Hfe=k.forwardRef(function(t,r){const{defaultValue:n,disabled:i=!1,loopFocus:s=!0,onValueChange:o,orientation:a="horizontal",multiple:l=!1,value:u,className:h,render:d,...p}=t,v=Oj(),S=k.useMemo(()=>{if(u===void 0)return n??[]},[u,n]),_=(v?.disabled??!1)||i,[m,x]=Os({controlled:u,default:S,name:"ToggleGroup",state:"value"}),b=Be((R,A,j)=>{let I;if(l?(I=m.slice(),A?I.push(R):I.splice(m.indexOf(R),1)):I=A?[R]:[],Array.isArray(I)){if(o?.(I,j),j.isCanceled)return;x(I)}}),w=k.useMemo(()=>({disabled:_,multiple:l,orientation:a}),[_,a,l]),O=k.useMemo(()=>({disabled:_,orientation:a,setGroupValue:b,value:m}),[_,a,b,m]),E={role:"group"},T=dt("div",t,{enabled:!!v,state:w,ref:r,props:[E,p],stateAttributesMapping:f4});return y.jsx(KW.Provider,{value:O,children:v?T:y.jsx(rx,{render:d,className:h,state:w,refs:[r],props:[E,p],stateAttributesMapping:f4,loopFocus:s})})});function Ffe(e){return dt(e.defaultTagName??"div",e,e)}function Ufe({className:e,...t}){return y.jsx("div",{"data-slot":"input-group",role:"group",className:Me("border-input bg-input/20 dark:bg-input/30 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/30 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 h-7 rounded-md border transition-colors has-data-[align=block-end]:rounded-md has-data-[align=block-start]:rounded-md has-[[data-slot=input-group-control]:focus-visible]:ring-[2px] has-[[data-slot][aria-invalid=true]]:ring-[2px] has-[textarea]:rounded-md has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5 [[data-slot=combobox-content]_&]:focus-within:border-inherit [[data-slot=combobox-content]_&]:focus-within:ring-0 group/input-group relative flex w-full min-w-0 items-center outline-none has-[>textarea]:h-auto",e),...t})}const Vfe=nu("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 Wfe({className:e,align:t="inline-start",...r}){return y.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Me(Vfe({align:t}),e),onClick:n=>{n.target.closest("button")||n.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}const qfe=nu("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 YW({className:e,type:t="button",variant:r="ghost",size:n="xs",...i}){return y.jsx(Ne,{type:t,"data-size":n,variant:r,className:Me(qfe({size:n}),e),...i})}function Gfe({className:e,...t}){return y.jsx(qt,{"data-slot":"input-group-control",className:Me("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 Kfe=Zde;function Yfe({className:e,children:t,...r}){return y.jsxs(kde,{"data-slot":"combobox-trigger",className:Me("[&_svg:not([class*='size-'])]:size-3.5",e),...r,children:[t,y.jsx(pe,{icon:Dv,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})]})}function Xfe({className:e,...t}){return y.jsx(Lde,{"data-slot":"combobox-clear",render:y.jsx(YW,{variant:"ghost",size:"icon-xs"}),className:Me(e),...t,children:y.jsx(pe,{icon:es,strokeWidth:2,className:"pointer-events-none"})})}function Qfe({className:e,children:t,disabled:r=!1,showTrigger:n=!0,showClear:i=!1,...s}){return y.jsxs(Ufe,{className:Me("w-auto",e),children:[y.jsx(jde,{render:y.jsx(Gfe,{disabled:r}),...s}),y.jsxs(Wfe,{align:"inline-end",children:[n&&y.jsx(YW,{size:"icon-xs",variant:"ghost",render:y.jsx(Yfe,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:r}),i&&y.jsx(Xfe,{disabled:r})]}),t]})}function Zfe({className:e,side:t="bottom",sideOffset:r=6,align:n="start",alignOffset:i=0,anchor:s,...o}){return y.jsx(zde,{children:y.jsx(Hde,{side:t,sideOffset:r,align:n,alignOffset:i,anchor:s,className:"isolate z-50",children:y.jsx(Ude,{"data-slot":"combobox-content","data-chips":!!s,className:Me("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),...o})})})}function Jfe({className:e,...t}){return y.jsx(Bde,{"data-slot":"combobox-list",className:Me("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 ehe({className:e,children:t,...r}){return y.jsxs(qde,{"data-slot":"combobox-item",className:Me("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),...r,children:[t,y.jsx(Jde,{render:y.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:y.jsx(pe,{icon:Rl,strokeWidth:2,className:"pointer-events-none"})})]})}function the({className:e,...t}){return y.jsx(Gde,{"data-slot":"combobox-empty",className:Me("text-muted-foreground hidden w-full justify-center py-2 text-center text-xs/relaxed group-data-empty/combobox-content:flex",e),...t})}const rhe=nu("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"}}),XW=k.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function nhe({className:e,variant:t,size:r,spacing:n=0,orientation:i="horizontal",children:s,...o}){return y.jsx(Hfe,{"data-slot":"toggle-group","data-variant":t,"data-size":r,"data-spacing":n,"data-orientation":i,style:{"--gap":n},className:Me("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),...o,children:y.jsx(XW.Provider,{value:{variant:t,size:r,spacing:n,orientation:i},children:s})})}function h4({className:e,children:t,variant:r="default",size:n="default",...i}){const s=k.useContext(XW);return y.jsx($fe,{"data-slot":"toggle-group-item","data-variant":s.variant||r,"data-size":s.size||n,"data-spacing":s.spacing,className:Me("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",rhe({variant:s.variant||r,size:s.size||n}),e),...i,children:t})}async function Dt(e,t){const r=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t?.headers}});if(r.status===401)throw window.dispatchEvent(new CustomEvent("vibora:auth-required")),new Error("Authentication required");if(!r.ok){const n=await r.json().catch(()=>({error:"Request failed"}));throw new Error(n.error||"Request failed")}return r.json()}const Td="";function Dj(){return Rr({queryKey:["tasks"],queryFn:()=>Dt(`${Td}/api/tasks`)})}function QW(e){return Rr({queryKey:["tasks",e],queryFn:()=>Dt(`${Td}/api/tasks/${e}`),enabled:!!e})}function ihe(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Td}/api/tasks`,{method:"POST",body:JSON.stringify({...t,status:"IN_PROGRESS"})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function she(){const e=Cn();return Yr({mutationFn:({taskId:t,status:r,position:n})=>Dt(`${Td}/api/tasks/${t}/status`,{method:"PATCH",body:JSON.stringify({status:r,position:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function Ij(){const e=Cn();return Yr({mutationFn:({taskId:t,updates:r})=>Dt(`${Td}/api/tasks/${t}`,{method:"PATCH",body:JSON.stringify(r)}),onSuccess:(t,{taskId:r})=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["tasks",r]})}})}function ZW(){const e=Cn();return Yr({mutationFn:({taskId:t,deleteLinkedWorktree:r})=>{const n=r?`${Td}/api/tasks/${t}?deleteLinkedWorktree=true`:`${Td}/api/tasks/${t}`;return Dt(n,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}const Fd="";function ohe(e){return Rr({queryKey:["fs","list",e],queryFn:()=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return Dt(`${Fd}/api/fs/list${t}`)},enabled:e!==null})}function ahe(e){return Rr({queryKey:["git","branches",e],queryFn:()=>Dt(`${Fd}/api/git/branches?repo=${encodeURIComponent(e)}`),enabled:!!e})}function lhe(e,t={}){const{staged:r=!1,ignoreWhitespace:n=!1,includeUntracked:i=!1}=t;return Rr({queryKey:["git","diff",e,r,n,i],queryFn:()=>{const s=new URLSearchParams({path:e,...r&&{staged:"true"},...n&&{ignoreWhitespace:"true"},...i&&{includeUntracked:"true"}});return Dt(`${Fd}/api/git/diff?${s}`)},enabled:!!e,refetchInterval:5e3})}function che(e){return Rr({queryKey:["git","status",e],queryFn:()=>Dt(`${Fd}/api/git/status?path=${encodeURIComponent(e)}`),enabled:!!e,refetchInterval:5e3})}function uhe(e){return Rr({queryKey:["fs","tree",e],queryFn:()=>Dt(`${Fd}/api/fs/tree?root=${encodeURIComponent(e)}`),enabled:!!e,staleTime:1e4})}function dhe(e,t,r){return Rr({queryKey:["fs","read",e,t,r?.maxLines],queryFn:()=>{const n=new URLSearchParams({path:t,root:e,...r?.maxLines});return Dt(`${Fd}/api/fs/read?${n}`)},enabled:!!e&&!!t})}async function fhe(e){return Dt(`${Fd}/api/fs/is-git-repo?path=${encodeURIComponent(e)}`)}const Ra="",Ut={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"},hhe=7777;function Ii(e){return Rr({queryKey:["config",e],queryFn:()=>Dt(`${Ra}/api/config/${e}`)})}function JW(){const e=Ii(Ut.PORT);return{...e,data:e.data?.value??hhe,isDefault:e.data?.isDefault??!0}}function phe(){const e=Ii(Ut.WORKTREE_BASE_PATH);return{...e,data:e.data?.value??""}}function vx(){const e=Ii(Ut.DEFAULT_GIT_REPOS_DIR);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function yx(){const e=Ii(Ut.EDITOR_APP);return{...e,data:e.data?.value??"vscode",isDefault:e.data?.isDefault??!0}}function bx(){const e=Ii(Ut.EDITOR_HOST);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function _x(){const e=Ii(Ut.EDITOR_SSH_PORT);return{...e,data:e.data?.value??22,isDefault:e.data?.isDefault??!0}}function mhe(){const e=Ii(Ut.LINEAR_API_KEY);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function ghe(){const e=Ii(Ut.GITHUB_PAT);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function vhe(){const e=Ii(Ut.LANGUAGE);return{...e,data:e.data?.value??null,isDefault:e.data?.isDefault??!0}}function yhe(){const e=Ii(Ut.THEME);return{...e,data:e.data?.value??"system",isDefault:e.data?.isDefault??!0}}function bhe(){const e=Ii(Ut.SYNC_CLAUDE_CODE_THEME);return{...e,data:!!e.data?.value,isDefault:e.data?.isDefault??!0}}const p4=["light","light-ansi","light-daltonized","dark","dark-ansi","dark-daltonized"];function _he(){const e=Ii(Ut.CLAUDE_CODE_LIGHT_THEME);return{...e,data:e.data?.value??"light-ansi",isDefault:e.data?.isDefault??!0}}function xhe(){const e=Ii(Ut.CLAUDE_CODE_DARK_THEME);return{...e,data:e.data?.value??"dark-ansi",isDefault:e.data?.isDefault??!0}}function She(){const e=Ii(Ut.BASIC_AUTH_USERNAME);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function whe(){const e=Ii(Ut.BASIC_AUTH_PASSWORD);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Nj(){const e=Cn();return Yr({mutationFn:({key:t,value:r})=>Dt(`${Ra}/api/config/${t}`,{method:"PUT",body:JSON.stringify({value:r})}),onSuccess:(t,{key:r})=>{e.invalidateQueries({queryKey:["config",r]}),r===Ut.GITHUB_PAT&&(e.invalidateQueries({queryKey:["github-user"]}),e.invalidateQueries({queryKey:["github-prs"]}),e.invalidateQueries({queryKey:["github-issues"]}),e.invalidateQueries({queryKey:["github-orgs"]}))}})}function Che(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Ra}/api/config/${t}`,{method:"DELETE"}),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:["config",r]})}})}function Ehe(){return Rr({queryKey:["config","notifications"],queryFn:()=>Dt(`${Ra}/api/config/notifications`)})}function Ohe(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Ra}/api/config/notifications`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","notifications"]})}})}function The(){return Yr({mutationFn:e=>Dt(`${Ra}/api/config/notifications/test/${e}`,{method:"POST"})})}function khe(){return Rr({queryKey:["config","z-ai"],queryFn:()=>Dt(`${Ra}/api/config/z-ai`)})}function Ahe(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Ra}/api/config/z-ai`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","z-ai"]}),e.invalidateQueries({queryKey:["monitoring","claude-usage"]})}})}function eq(){return Rr({queryKey:["config","developer-mode"],queryFn:()=>Dt(`${Ra}/api/config/developer-mode`),staleTime:1/0})}function Rhe(){return Yr({mutationFn:()=>Dt(`${Ra}/api/config/restart`,{method:"POST"})})}const Hv="";function Fv(){return Rr({queryKey:["repositories"],queryFn:()=>Dt(`${Hv}/api/repositories`)})}function Phe(e){return Rr({queryKey:["repositories",e],queryFn:()=>Dt(`${Hv}/api/repositories/${e}`),enabled:!!e})}function tq(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Hv}/api/repositories`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function jhe(){const e=Cn();return Yr({mutationFn:({id:t,updates:r})=>Dt(`${Hv}/api/repositories/${t}`,{method:"PATCH",body:JSON.stringify(r)}),onSuccess:(t,{id:r})=>{e.invalidateQueries({queryKey:["repositories"]}),e.invalidateQueries({queryKey:["repositories",r]})}})}function rq(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Hv}/api/repositories/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function xh({className:e,children:t,...r}){return y.jsxs(Efe,{"data-slot":"scroll-area",className:Me("relative",e),...r,children:[y.jsx(Rfe,{"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(Mhe,{}),y.jsx(Lfe,{})]})}function Mhe({className:e,orientation:t="vertical",...r}){return y.jsx(jfe,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Me("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),...r,children:y.jsx(Mfe,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function Uv({open:e,onOpenChange:t,onSelect:r,initialPath:n}){const[i,s]=k.useState(n||null),[o,a]=k.useState(""),[l,u]=k.useState("");k.useEffect(()=>{e&&(s(n||null),a(""),u(""))},[e,n]);const{data:h,isLoading:d,error:p}=ohe(e?i??"":null),v=w=>{h&&(s(h.path+"/"+w),u(""))},S=()=>{h?.parent&&h.parent!==h.path&&(s(h.parent),u(""))},_=()=>{s(null),u("")},m=()=>{o.trim()&&(s(o.trim()),u(""))},x=w=>{r(w),t(!1)},b=h?.entries.filter(w=>w.name.toLowerCase().includes(l.toLowerCase()));return y.jsx(Ta,{open:e,onOpenChange:t,children:y.jsxs(ka,{className:"sm:max-w-lg overflow-hidden",children:[y.jsxs(jl,{children:[y.jsx(Ml,{children:"Select Git Repository"}),y.jsx(Bv,{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(zue,{}),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(qt,{value:o,onChange:w=>a(w.target.value),placeholder:"/path/to/your/project",onKeyDown:w=>w.key==="Enter"&&m(),className:"flex-1"}),y.jsx(Ne,{variant:"outline",size:"sm",onClick:m,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(pe,{icon:UV,size:14,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),y.jsx(qt,{value:l,onChange:w=>u(w.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(Ne,{variant:"outline",size:"icon-sm",onClick:_,title:"Home",className:"shrink-0",children:y.jsx(pe,{icon:gce,size:14,strokeWidth:2})}),y.jsx(Ne,{variant:"outline",size:"icon-sm",onClick:S,disabled:!h||h.parent===h.path,title:"Parent directory",className:"shrink-0",children:y.jsx(pe,{icon:gj,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:h?.path||"~"}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:()=>h&&x(h.path),disabled:!h,className:"shrink-0 max-sm:px-2",title:"Select current directory",children:[y.jsx(pe,{icon:xA,size:14,strokeWidth:2,className:"sm:hidden"}),y.jsx("span",{className:"max-sm:hidden",children:"Select Current"})]})]}),y.jsx(xh,{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}),h&&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(w=>y.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted group",children:w.type==="directory"?y.jsxs(y.Fragment,{children:[y.jsx(pe,{icon:w.isGitRepo?xA:pi,size:16,strokeWidth:2,className:(w.isGitRepo,"text-accent")}),y.jsx("button",{onClick:()=>v(w.name),className:"flex-1 text-left text-xs truncate hover:underline",children:w.name}),w.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:w.name})]})},w.name))]})]})}),y.jsxs($d,{children:[y.jsx(Nv,{render:y.jsx(Ne,{variant:"outline"}),children:"Cancel"}),y.jsx(Ne,{onClick:()=>h&&x(h.path),disabled:!h,children:"Select Path"})]})]})})}function Lhe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Dhe(e){const t=Lhe(e);if(!t)return"";const r=Math.random().toString(36).substring(2,6);return`${t}-${r}`}function Bj({open:e,onOpenChange:t,defaultRepository:r,showTrigger:n=!0}={}){const{t:i}=Wt("tasks"),{t:s}=Wt("common"),[o,a]=k.useState(!1),l=e??o,u=t??a,[h,d]=k.useState(!1),[p,v]=k.useState(""),[S,_]=k.useState(""),[m,x]=k.useState(""),[b,w]=k.useState(""),[O,E]=k.useState(""),[T,R]=k.useState(""),[A,j]=k.useState("default"),[I,L]=k.useState(!1),[z,D]=k.useState(null),[V,H]=k.useState("browse"),[$,F]=k.useState(""),[W,B]=k.useState(null),[G,N]=k.useState(!1),U=As(),Y=ihe(),Q=tq(),J=k.useRef(null),{data:re}=phe(),{data:X}=vx(),{data:q}=Fv(),{data:Z,isLoading:te}=ahe(m||null),ne=z?q?.find(ve=>ve.id===z):null,ie=k.useMemo(()=>{if(!q)return[];if(ne&&$===ne.displayName||!$.trim())return q;const ve=$.toLowerCase();return q.filter(De=>De.displayName.toLowerCase().includes(ve)||De.path.toLowerCase().includes(ve))},[q,$,ne]);k.useEffect(()=>{q&&q.length>0?H("saved"):H("browse")},[q]),k.useEffect(()=>{if(l){if(r)D(r.id),x(r.path),F(r.displayName),H("saved");else if(q&&q.length>0){const ve=q[0];D(ve.id),x(ve.path),F(ve.displayName),H("saved")}}},[l,r,q]),k.useEffect(()=>{w(Z?Z.current||Z.branches[0]||"main":"")},[Z,m]);const me=ve=>{v(ve),R(Dhe(ve))},ye=async ve=>{B(null),N(!0);try{if(!(await fhe(ve)).isGitRepo){B(i("createModal.errors.notGitRepo")),N(!1);return}if(x(ve),D(null),!q?.find(ae=>ae.path===ve)){const ae=ve.split("/").pop()||"Unknown";Q.mutate({path:ve,displayName:ae})}}catch(De){B(De instanceof Error?De.message:i("createModal.errors.validationFailed"))}finally{N(!1)}},ue=ve=>{if(ve.preventDefault(),!p.trim()||!m)return;const De=m.split("/").pop()||"repo",_e=O.trim()||T,ae=`${re}/${_e}`;Y.mutate({title:p.trim(),description:S.trim(),repoPath:m,repoName:De,baseBranch:b||"main",branch:_e,worktreePath:ae,copyFiles:ne?.copyFiles||void 0,startupScript:ne?.startupScript||void 0},{onSuccess:ce=>{const be=S.trim()?{aiMode:A,description:S.trim()}:{aiMode:A};u(!1),v(""),_(""),x(""),w(""),E(""),R(""),j("default"),L(!1),D(null),F(""),B(null),H(q&&q.length>0?"saved":"browse"),U({to:"/tasks/$taskId",params:{taskId:ce.id},state:be})}})},he=!Y.isPending&&!!p.trim()&&!!m;Ys("meta+enter",()=>{J.current&&J.current.requestSubmit()},{enabled:l&&he,allowInInput:!0,ignoreContext:!0,deps:[l,he]});const fe=O.trim()||T,$e=fe?`${re}/${fe}`:"";return y.jsxs(y.Fragment,{children:[y.jsxs(Ta,{open:l,onOpenChange:u,children:[n&&y.jsxs(wj,{render:y.jsx(Ne,{size:"sm"}),children:[y.jsx(pe,{icon:bj,size:16,strokeWidth:2,"data-slot":"icon",className:"-translate-y-px"}),i("newTask")]}),y.jsx(ka,{className:"sm:max-w-md max-h-[80dvh] flex flex-col overflow-hidden",children:y.jsxs("form",{ref:J,onSubmit:ue,className:"flex flex-col min-h-0 flex-1",children:[y.jsxs(jl,{className:"shrink-0",children:[y.jsx(Ml,{children:i("createModal.title")}),y.jsx(Bv,{children:i("createModal.description")})]}),y.jsxs(pl,{className:"mt-4 pb-4 overflow-y-auto min-h-0 flex-1",children:[y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"title",children:i("createModal.fields.title")}),y.jsx(qt,{id:"title",value:p,onChange:ve=>me(ve.target.value),placeholder:i("createModal.fields.titlePlaceholder"),required:!0})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"description",children:i("createModal.fields.description")}),y.jsx(oW,{id:"description",value:S,onValueChange:ve=>{_(ve),I||j(ve.trim()?"plan":"default")},placeholder:i("createModal.fields.descriptionPlaceholder"),rows:2})]}),y.jsxs(mr,{children:[y.jsx(gr,{children:i("createModal.fields.aiMode")}),y.jsxs(nhe,{value:[A],onValueChange:ve=>{const De=Array.isArray(ve)?ve[0]:ve;De&&(j(De),L(!0))},className:"w-full",variant:"outline",children:[y.jsx(h4,{value:"plan",className:"flex-1",children:i("createModal.aiModes.plan")}),y.jsx(h4,{value:"default",className:"flex-1",children:i("createModal.aiModes.default")})]})]}),y.jsxs(mr,{children:[y.jsx(gr,{children:i("createModal.fields.repository")}),y.jsxs(Nc,{value:V,onValueChange:ve=>{H(ve),B(null)},children:[y.jsxs(Bc,{children:[y.jsx(ui,{value:"saved",disabled:!q?.length,children:i("createModal.tabs.saved")}),y.jsx(ui,{value:"browse",children:i("createModal.tabs.browse")})]}),y.jsx(qi,{value:"saved",className:"mt-2",children:y.jsxs(Kfe,{value:z||"",onValueChange:ve=>{const De=q?.find(_e=>_e.id===ve);De&&(D(ve),x(De.path),F(De.displayName),B(null))},inputValue:$,onInputValueChange:ve=>{F(ve),ne&&ve!==ne.displayName&&D(null)},itemToStringLabel:ve=>q?.find(De=>De.id===ve)?.displayName||"",children:[y.jsx(Qfe,{placeholder:i("createModal.searchRepositories"),className:"w-full"}),y.jsx(Zfe,{children:y.jsxs(Jfe,{children:[y.jsx(the,{children:i("createModal.noRepositoriesFound")}),ie.map(ve=>y.jsx(ehe,{value:ve.id,children:ve.displayName},ve.id))]})})]})}),y.jsx(qi,{value:"browse",className:"mt-2",children:y.jsxs(Ne,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>d(!0),disabled:G,children:[y.jsx(pe,{icon:pi,size:14,strokeWidth:2,className:"mr-2"}),G?y.jsx("span",{className:"text-muted-foreground",children:s("status.validating")}):m&&!z?y.jsx("span",{className:"truncate",children:m}):y.jsx("span",{className:"text-muted-foreground group-hover/button:text-accent-foreground",children:i("createModal.selectFolder")})]})})]}),W&&y.jsx("p",{className:"text-sm text-destructive",children:W}),m&&!W&&y.jsx(Oi,{className:"font-mono text-xs truncate",children:m})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"baseBranch",children:i("createModal.fields.baseBranch")}),y.jsxs(Ai,{value:b,onValueChange:ve=>w(ve??""),disabled:!m||te,children:[y.jsx(Pi,{className:"w-full",children:y.jsx(Ri,{children:b||y.jsx("span",{className:"text-muted-foreground",children:i(m?te?"createModal.loadingBranches":"createModal.selectBranch":"createModal.selectRepositoryFirst")})})}),y.jsx(ji,{children:Z?.branches.map(ve=>y.jsxs(pr,{value:ve,children:[ve,ve===Z.current&&y.jsx("span",{className:"text-muted-foreground ml-2",children:i("createModal.current")})]},ve))})]})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"branch",children:i("createModal.fields.branchName")}),y.jsx(qt,{id:"branch",value:O,onChange:ve=>E(ve.target.value),placeholder:T||i("createModal.fields.branchPlaceholder")}),$e&&y.jsxs(Oi,{children:[i("createModal.worktreePrefix")," ",$e]}),!O.trim()&&T&&y.jsx(Oi,{children:i("createModal.branchAutoGenerated",{branch:T})})]})]}),y.jsxs($d,{className:"mt-4 shrink-0",children:[y.jsx(Nv,{render:y.jsx(Ne,{variant:"outline",type:"button",className:"border-destructive text-destructive hover:bg-destructive hover:text-white"}),children:s("buttons.cancel")}),y.jsx(Ne,{type:"submit",disabled:Y.isPending||!p.trim()||!m,children:Y.isPending?s("status.creating"):i("createModal.createTask")})]})]})})]}),y.jsx(Uv,{open:h,onOpenChange:d,onSelect:ye,initialPath:X||void 0})]})}const m4=[{to:"/tasks",icon:bh,labelKey:"header.tasks",matchPrefix:!0},{to:"/terminals",icon:ox,labelKey:"header.terminals",matchPrefix:!1},{to:"/repositories",icon:wA,labelKey:"header.repositories",matchPrefix:!0},{to:"/review",icon:s_,labelKey:"header.review",matchPrefix:!0},{to:"/monitoring",icon:ace,labelKey:"header.monitoring",matchPrefix:!0}];function Ihe({onNewTaskRef:e,onOpenCommandPalette:t}){const{t:r}=Wt("navigation"),{location:n}=In(),i=n.pathname,[s,o]=k.useState(!1),a=(l,u)=>u?i.startsWith(l):i===l;return k.useEffect(()=>{e?.(()=>o(!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(Oce,{className:"lg:hidden",children:y.jsx(Tce,{children:y.jsxs(kce,{children:[y.jsxs(Rce,{className:"bg-transparent hover:bg-muted/50 data-open:bg-muted/50 gap-1 px-2",children:[y.jsx(pe,{icon:Sce,size:16,strokeWidth:2}),y.jsx("span",{className:"sr-only",children:"Menu"})]}),y.jsx(Pce,{className:"min-w-48",children:m4.map(l=>y.jsxs(Mce,{href:l.to,active:a(l.to,l.matchPrefix),render:y.jsx(hi,{to:l.to}),children:[y.jsx(pe,{icon:l.icon,size:16,strokeWidth:2}),r(l.labelKey)]},l.to))})]})})}),y.jsx("nav",{className:"hidden items-center gap-1 lg:flex",children:m4.map(l=>{const u=a(l.to,l.matchPrefix);return y.jsxs(hi,{to:l.to,className:Me("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(pe,{icon:l.icon,size:16,strokeWidth:2,"data-slot":"icon"}),r(l.labelKey)]},l.to)})})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.jsx(Bj,{open:s,onOpenChange:o}),y.jsx(Ne,{variant:"ghost",size:"icon-sm",onClick:t,title:r("header.commandPalette",{shortcut:"⌘K"}),children:y.jsx(pe,{icon:_A,size:16,strokeWidth:2})}),y.jsx(hi,{to:"/settings",className:Me("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(pe,{icon:VV,size:16,strokeWidth:2})})]})]})}function Nhe(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}const Bhe=10,$he=2e3;function zhe(){const e=Cn(),{resolvedTheme:t}=op(),r=k.useRef(null),n=k.useRef(void 0),i=k.useRef(0),s=k.useRef(void 0),o=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:h,title:d,message:p,notificationType:v,playSound:S,isCustomSound:_}=u.payload,x=S&&!_?"/goat.jpeg":t==="dark"?"/logo-dark.jpg":"/logo-light.jpg",b=y.jsx("img",{src:x,alt:"",className:"size-8 shrink-0 aspect-square rounded-sm object-cover"});switch(v){case"success":Jt.success(d,{description:p,icon:b});break;case"error":Jt.error(d,{description:p,icon:b});break;case"warning":Jt.warning(d,{description:p,icon:b});break;default:Jt.info(d,{description:p,icon:b});break}if("Notification"in window&&window.parent===window&&Notification.permission==="granted"&&new Notification(d,{body:p,icon:x,tag:h}),S){const O=localStorage.getItem("vibora:lastSoundPlayed"),E=Date.now();if(O&&E-parseInt(O)<1e3)return;localStorage.setItem("vibora:lastSoundPlayed",String(E));let T=!1;const R=()=>{if(T)return;T=!0,new Audio("/sounds/goat-bleat.mp3").play().catch(()=>{})},A=new Audio("/api/uploads/sound");A.onerror=R,A.play().catch(R)}window.parent!==window&&window.parent.postMessage({type:"vibora:notification",title:d,message:p,notificationType:v},"*")}}catch{}},[e,t]),a=k.useCallback(()=>{const l=r.current;if(l&&(l.readyState===WebSocket.CONNECTING||l.readyState===WebSocket.OPEN))return;const u=Nhe(),h=new WebSocket(u);r.current=h,h.onopen=()=>{i.current=0},h.onmessage=o,h.onclose=()=>{r.current===h&&(r.current=null),i.current<Bhe&&(i.current++,n.current=setTimeout(()=>{s.current?.()},$he))},h.onerror=()=>{}},[o]);s.current=a,k.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]),k.useEffect(()=>(a(),()=>{n.current&&clearTimeout(n.current);const l=r.current;l&&(l.readyState===WebSocket.OPEN&&l.close(),r.current=null)}),[a])}const Hhe={save:"Save Changes",cancel:"Cancel",delete:"Delete",create:"Create",reset:"Reset to default",browse:"Browse",clearFilters:"Clear filters"},Fhe={loading:"Loading...",saving:"Saving...",saved:"Saved",error:"Error",calculating:"calculating...",validating:"Validating...",creating:"Creating...",deleting:"Deleting...",loggingIn:"Logging in..."},Uhe={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"},Vhe={one:"{{count}} result",other:"{{count}} results"},Whe={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled",ORPHANED:"Orphaned"},qhe={loginTitle:"Login to Vibora",username:"Username",password:"Password",login:"Login",loginFailed:"Login failed"},Ghe={buttons:Hhe,status:Fhe,time:Uhe,results:Vhe,statuses:Whe,auth:qhe},Khe={tasks:"Tasks",terminals:"Terminals",worktrees:"Worktrees",repositories:"Repositories",review:"Review",monitoring:"Monitoring",settings:"Settings",commandPalette:"Command Palette ({{shortcut}})"},Yhe={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"}},Xhe={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"}},Qhe={header:Khe,commandPalette:Yhe,shortcuts:Xhe},Zhe="Tasks",Jhe="Search",epe="All Repos",tpe="New Task",rpe={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"}},npe={title:Zhe,searchPlaceholder:Jhe,allRepos:epe,newTask:tpe,createModal:rpe},ipe="Settings",spe={server:"Server",serverDefaults:"Server & Defaults",paths:"Paths",authentication:"Authentication",editor:"Editor",integrations:"Integrations",zai:"z.ai",notifications:"Notifications",appearance:"Appearance",developer:"Developer"},ope={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)"}}},ape={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"},lpe={restartButton:"Restart Vibora",restarting:"Restarting...",restartDescription:"Rebuild and restart the Vibora server. If the build fails, the server will continue running.",restartFailed:"Restart failed",checkLogs:"Build may have failed. Check journalctl --user -u vibora-dev for details."},cpe={title:"Unsaved Changes",description:"You have unsaved changes that will be lost if you leave this page.",stay:"Stay",leave:"Leave"},upe={title:ipe,sections:spe,fields:ope,notifications:ape,developer:lpe,unsavedChanges:cpe},dpe="Review",fpe={pullRequests:"Pull Requests",issues:"Issues"},hpe={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"},ppe={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"},mpe={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"},gpe={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"}},vpe={title:dpe,tabs:fpe,filters:hpe,github:ppe,prs:mpe,issues:gpe},ype="Worktrees",bpe={total:"{{count}} total",orphaned:"{{count}} orphaned"},_pe={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."},xpe={noMatch:"No worktrees match the selected filters.",noWorktrees:"No worktrees found. Worktrees are created when you create tasks."},Spe={failedToLoad:"Failed to load worktrees: {{message}}"},wpe={title:ype,summary:bpe,cleanup:_pe,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:xpe,error:Spe},Cpe="Monitoring",Epe={claude:"Claude Instances",system:"System Metrics",processes:"Processes",vibora:"Vibora Servers",worktrees:"Worktrees",usage:"Usage Limits"},Ope={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}}"},Tpe={cpuUsage:"CPU Usage",memoryUsage:"Memory Usage",memoryLabels:{used:"Used",cache:"Cache / Buffers"},diskUsage:"Disk Usage ({{path}})",error:"Failed to load system metrics: {{message}}"},kpe={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"},Ape={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}}"},Rpe={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}}"},Ppe={title:Cpe,tabs:Epe,claude:Ope,system:Tpe,processes:kpe,vibora:Ape,usage:Rpe},jpe="Tasks",Mpe="New Terminal",Lpe="All Repos",Dpe={title:"Edit Tab",name:"Name",namePlaceholder:"Tab name",directory:"Directory",directoryPlaceholder:"Select a directory...",clearDirectory:"Clear directory",cancel:"Cancel",save:"Save"},Ipe={title:"New Tab",create:"Create"},Npe={taskTerminals:jpe,newTerminal:Mpe,allRepos:Lpe,editTab:Dpe,newTab:Ipe},Bpe="Repositories",$pe="{{count}} total",zpe="New Task",Hpe="Tasks",Fpe="Terminal",Upe="Editor",Vpe="Settings",Wpe="Add Repository",qpe="Open in Terminal",Gpe="Open in {{editor}}",Kpe={openInVSCode:"Open in VS Code"},Ype={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"},Xpe={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..."}}},Qpe={noRepositories:"No repositories added yet. Add a repository for quick access when creating tasks."},Zpe={failedToLoad:"Failed to load repositories: {{message}}"},Jpe={title:Bpe,total:$pe,newTask:zpe,viewTasks:Hpe,terminal:Fpe,editor:Upe,settings:Vpe,addRepository:Wpe,openInTerminal:qpe,openInEditor:Gpe,card:Kpe,delete:{title:"Delete Repository",description:'This will remove "{{name}}" from Vibora. The actual repository files will not be affected.',button:"Delete",deleting:"Deleting..."},addModal:Ype,newProject:Xpe,empty:Qpe,error:Zpe},eme={save:"保存更改",cancel:"取消",delete:"删除",create:"创建",reset:"重置为默认值",browse:"浏览",clearFilters:"清除筛选"},tme={loading:"加载中...",saving:"保存中...",saved:"已保存",error:"错误",calculating:"计算中...",validating:"验证中...",creating:"创建中...",deleting:"删除中...",loggingIn:"登录中..."},rme={justNow:"刚刚",minuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",hourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",dayAgo:"1 天前",daysAgo:"{{count}} 天前"},nme={one:"{{count}} 个结果",other:"{{count}} 个结果"},ime={IN_PROGRESS:"进行中",IN_REVIEW:"审核中",DONE:"已完成",CANCELED:"已取消",ORPHANED:"孤立"},sme={loginTitle:"登录 Vibora",username:"用户名",password:"密码",login:"登录",loginFailed:"登录失败"},ome={buttons:eme,status:tme,time:rme,results:nme,statuses:ime,auth:sme},ame={tasks:"任务",terminals:"终端",worktrees:"工作树",repositories:"仓库",review:"审核",monitoring:"监控",settings:"设置",commandPalette:"命令面板 ({{shortcut}})"},lme={placeholder:"输入命令或搜索...",noResults:"未找到命令",categories:{navigation:"导航",actions:"操作"},commands:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",newTask:"新建任务",keyboardShortcuts:"键盘快捷键"}},cme={title:"键盘快捷键",groups:{navigation:"导航",actions:"操作",general:"通用"},labels:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",commandPalette:"命令面板",newTask:"新建任务",keyboardShortcuts:"键盘快捷键",closeModal:"关闭弹窗"}},ume={header:ame,commandPalette:lme,shortcuts:cme},dme="任务",fme="搜索",hme="全部仓库",pme="新建任务",mme={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:"验证仓库失败"}},gme={title:dme,searchPlaceholder:fme,allRepos:hme,newTask:pme,createModal:mme},vme="设置",yme={server:"服务器",serverDefaults:"服务器与默认设置",paths:"路径",authentication:"身份验证",editor:"编辑器",integrations:"集成",zai:"z.ai",notifications:"通知",appearance:"外观",developer:"开发者"},bme={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":"深色(色盲友好)"}}},_me={enable:"启用通知",sound:"声音",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"应用令牌",userKey:"用户密钥",testSuccess:"{{channel}} 测试成功",testFailed:"{{channel}} 测试失败:{{error}}",uploadSound:"上传自定义声音",deleteSound:"删除自定义声音",testSound:"测试声音",soundUploaded:"自定义声音已上传",soundUploadFailed:"上传声音失败:{{error}}",soundDeleted:"自定义声音已删除",soundDeleteFailed:"删除自定义声音失败",customSoundActive:"使用自定义声音"},xme={restartButton:"重启 Vibora",restarting:"重启中...",restartDescription:"重新构建并重启 Vibora 服务器。如果构建失败,服务器将继续运行。",restartFailed:"重启失败",checkLogs:"构建可能失败。运行 journalctl --user -u vibora-dev 查看详情。"},Sme={title:"未保存的更改",description:"您有未保存的更改,离开此页面将丢失这些更改。",stay:"留下",leave:"离开"},wme={title:vme,sections:yme,fields:bme,notifications:_me,developer:xme,unsavedChanges:Sme},Cme="审核",Eme={pullRequests:"拉取请求",issues:"问题"},Ome={pr:{created:"我创建的",assigned:"分配给我的",reviewRequested:"待我审核",mentioned:"提及我的"},issue:{assigned:"分配给我的",created:"我创建的",mentioned:"提及我的"},allOrgs:"所有组织",allOrganizations:"所有组织",viboraReposOnly:"仅 Vibora 仓库"},Tme={tokenRequired:"需要 GitHub 令牌",tokenDescription:"要查看您的问题和拉取请求,请在设置中添加 GitHub 个人访问令牌。",requiredScopes:"所需权限:",scopes:{repo:"(用于私有仓库)",readUser:"(用于用户信息)",readOrg:"(用于组织列表)"},generateToken:"生成令牌",goToSettings:"前往设置"},kme={loading:"加载中...",failedToLoad:"加载拉取请求失败",empty:{all:"没有打开的拉取请求",created:"没有您创建的拉取请求",assigned:"没有分配给您的拉取请求",reviewRequested:"没有等待您审核的拉取请求",mentioned:"没有提及您的拉取请求"},draft:"草稿"},Ame={loading:"加载中...",failedToLoad:"加载问题失败",empty:{assigned:"没有分配给您的问题",created:"没有您创建的问题",mentioned:"没有提及您的问题"}},Rme={title:Cme,tabs:Eme,filters:Ome,github:Tme,prs:kme,issues:Ame},Pme="工作树",jme={total:"共 {{count}} 个",orphaned:"{{count}} 个孤立"},Mme={button:"清理 ({{count}})",title:"删除已完成的工作树",description:"这将永久删除 {{count}} 个工作树。",linkedTasksWillBeDeleted:"关联的任务也将被删除。",alsoDeleteLinkedTasks:"同时删除关联的任务",done:"已完成",canceled:"已取消",cannotUndo:"此操作无法撤销。"},Lme={noMatch:"没有匹配所选筛选条件的工作树。",noWorktrees:"未找到工作树。工作树在创建任务时自动生成。"},Dme={failedToLoad:"加载工作树失败:{{message}}"},Ime={title:Pme,summary:jme,cleanup:Mme,delete:{title:"删除工作树",description:"这将永久删除位于以下位置的工作树目录",linkedTaskWillBeDeleted:'关联的任务 "{{title}}" 也将被删除。',alsoDeleteLinkedTask:'同时删除关联的任务 "{{title}}"',cannotUndo:"此操作无法撤销。",button:"删除 {{count}} 个"},empty:Lme,error:Dme},Nme="监控",Bme={claude:"Claude 实例",system:"系统指标",processes:"进程",vibora:"Vibora 服务器",usage:"使用限额"},$me={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}}"},zme={cpuUsage:"CPU 使用率",memoryUsage:"内存使用率",memoryLabels:{used:"已使用",cache:"缓存/缓冲区"},diskUsage:"磁盘使用率 ({{path}})",error:"加载系统指标失败:{{message}}"},Hme={topProcesses:"热门进程",sortBy:{memory:"按内存",cpu:"按 CPU"},headers:{pid:"PID",name:"名称",command:"命令",memory:"内存"},empty:"未找到进程",error:"加载进程失败:{{message}}",containers:"容器",containersEmpty:"没有容器运行中",containersUnavailable:"Docker/Podman 不可用"},Fme={description:"运行中的 Vibora 开发服务器",instanceCount:"{{count}} 个实例运行中",headers:{port:"端口",mode:"模式",directory:"目录",ram:"内存",actions:"操作"},mode:{dev:"开发",prod:"生产"},vite:"Vite",kill:"终止",killing:"终止中...",empty:"没有 Vibora 实例运行中",error:"加载 Vibora 实例失败:{{message}}"},Ume={fiveHourBlock:"5小时配额",sevenDayRolling:"7天滚动配额",opusWeekly:"Opus 周配额",sonnetWeekly:"Sonnet 周配额",resetsIn:"{{time}}后重置",resetsAt:"{{time}}重置",weekProgress:"本周已过 {{percent}}%",unavailable:"Claude Code 使用数据不可用。请确保已登录 Claude Code。",error:"加载使用数据失败:{{message}}"},Vme={title:Nme,tabs:Bme,claude:$me,system:zme,processes:Hme,vibora:Fme,usage:Ume},Wme="任务",qme="新建终端",Gme="全部仓库",Kme={taskTerminals:Wme,newTerminal:qme,allRepos:Gme},Yme="仓库",Xme="共 {{count}} 个",Qme="新建任务",Zme="添加仓库",Jme={openInVSCode:"在 VS Code 中打开"},ege={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:"取消"},tge={noRepositories:"尚未添加任何仓库。添加一个仓库以便在创建任务时快速访问。"},rge={failedToLoad:"加载仓库失败:{{message}}"},nge={title:Yme,total:Xme,newTask:Qme,addRepository:Zme,card:Jme,delete:{title:"删除仓库",description:'这将从 Vibora 中移除 "{{name}}"。实际的仓库文件不会受到影响。',button:"删除",deleting:"删除中..."},addModal:ege,empty:tge,error:rge},ige="common",TA=["en","zh"],sge={en:{common:Ghe,navigation:Qhe,tasks:npe,settings:upe,review:vpe,worktrees:wpe,monitoring:Ppe,terminals:Npe,repositories:Jpe},zh:{common:ome,navigation:ume,tasks:gme,settings:wme,review:Rme,worktrees:Ime,monitoring:Vme,terminals:Kme,repositories:nge}};function oge(){if(typeof window<"u"){const e=localStorage.getItem("vibora-language");if(e&&TA.includes(e))return e;const t=navigator.language.split("-")[0];if(TA.includes(t))return t}return"en"}vi.use(pie).init({resources:sge,lng:oge(),fallbackLng:"en",defaultNS:ige,ns:["common","navigation","tasks","settings","review","worktrees","monitoring","terminals","repositories"],interpolation:{escapeValue:!1}});vi.on("languageChanged",e=>{typeof window<"u"&&localStorage.setItem("vibora-language",e)});function nq(){const{i18n:e}=Wt(),{data:t,isSuccess:r}=vhe(),n=Nj();k.useEffect(()=>{r&&t&&t!==e.language&&e.changeLanguage(t)},[r,t,e]);const i=k.useCallback(async s=>{if(s)await e.changeLanguage(s);else{const o=navigator.language.split("-")[0],a=TA.includes(o)?o:"en";await e.changeLanguage(a)}n.mutate({key:Ut.LANGUAGE,value:s??""})},[e,n]);return{language:e.language,savedLanguage:t,changeLanguage:i,isUpdating:n.isPending}}function iq(){const{setTheme:e,resolvedTheme:t,theme:r}=op(),{data:n,isSuccess:i}=yhe(),{data:s}=bhe(),o=Nj(),a=k.useRef(void 0),l=k.useRef(!1);k.useEffect(()=>{i&&n&&n!==r&&e(n)},[i,n,r,e]),k.useEffect(()=>{if(!t)return;const h=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=h},[t]),k.useEffect(()=>{const h=l.current&&s&&a.current===!1;a.current=s,l.current=!0,t&&h&&Dt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:t})}).catch(()=>{})},[s,t]);const u=k.useCallback(h=>{if(e(h),o.mutate({key:Ut.THEME,value:h==="system"?"":h}),s){const d=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h;Dt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:d})}).catch(()=>{})}},[e,o,s]);return{theme:r??"system",resolvedTheme:t,savedTheme:n,syncClaudeCode:s,changeTheme:u,isUpdating:o.isPending}}let aE=!1;const g4={activeTabId:null,focusedTerminals:{},currentView:null,currentTaskId:null,isTabVisible:null,viewUpdatedAt:null};function sq(){const e=Cn(),t=k.useRef(void 0),r=k.useRef({}),{data:n=g4,isLoading:i}=Rr({queryKey:["terminal-view-state"],queryFn:async()=>{const p=await fetch("/api/terminal-view-state");if(!p.ok)throw new Error("Failed to fetch terminal view state");return p.json()},staleTime:2e3}),s=Yr({mutationFn:async p=>{const v=await fetch("/api/terminal-view-state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!v.ok)throw new Error("Failed to update terminal view state");return v.json()},onSuccess:p=>{e.setQueryData(["terminal-view-state"],p)}}),o=k.useRef(s);o.current=s;const a=k.useCallback(p=>{const v=r.current;r.current={...v,...p,focusedTerminals:p.focusedTerminals||v.focusedTerminals?{...v.focusedTerminals,...p.focusedTerminals}:void 0};const S=r.current;e.setQueryData(["terminal-view-state"],_=>{const m=_??g4;return{activeTabId:S.activeTabId!==void 0?S.activeTabId:m.activeTabId,focusedTerminals:{...m.focusedTerminals,...S.focusedTerminals},currentView:S.currentView!==void 0?S.currentView:m.currentView,currentTaskId:S.currentTaskId!==void 0?S.currentTaskId:m.currentTaskId,isTabVisible:S.isTabVisible!==void 0?S.isTabVisible:m.isTabVisible,viewUpdatedAt:S.viewUpdatedAt!==void 0?S.viewUpdatedAt:m.viewUpdatedAt}}),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{o.current.mutate(r.current),r.current={}},500)},[e]),l=k.useCallback((p,v)=>{if(v===null){const S=e.getQueryData(["terminal-view-state"]);if(S){const{[p]:_,...m}=S.focusedTerminals;a({focusedTerminals:m})}}else a({focusedTerminals:{[p]:v}})},[e,a]),u=k.useCallback(p=>n.focusedTerminals[p]??null,[n.focusedTerminals]),h=k.useRef(!1);k.useEffect(()=>{if(aE){h.current=!1;return}aE=!0,h.current=!0;const p=()=>{a({isTabVisible:document.visibilityState==="visible",viewUpdatedAt:new Date().toISOString()})};return document.addEventListener("visibilitychange",p),p(),()=>{document.removeEventListener("visibilitychange",p),h.current&&(aE=!1)}},[a]);const d=k.useCallback((p,v,S)=>{a({currentView:p,currentTaskId:v,activeTabId:S,viewUpdatedAt:new Date().toISOString()})},[a]);return{viewState:n,isLoading:i,getFocusedTerminal:u,setFocusedTerminal:l,updateViewTracking:d}}function Vu(e,t){const r=e.toLowerCase(),n=t.toLowerCase();if(r===n)return 100;if(r.startsWith(n))return 80;if(r.includes(n))return 60;let i=0,s=0,o=0;for(;i<r.length&&s<n.length;)r[i]===n[s]&&(o+=1,s++),i++;return s===n.length?o:0}function age(e,t){return t.trim()?e.map(n=>{let i=Vu(n.label,t);if(n.keywords)for(const s of n.keywords){const o=Vu(s,t);o>i&&(i=o)}return{command:n,score:i}}).filter(({score:n})=>n>0).sort((n,i)=>i.score-n.score).map(({command:n})=>n):e}function lge(e){const t=new Map;for(const r of e){const n=t.get(r.category)||[];n.push(r),t.set(r.category,n)}return t}function cge({open:e,onOpenChange:t,onNewTask:r,onShowShortcuts:n}){const{t:i}=Wt("navigation"),[s,o]=k.useState(!1),a=e??s,l=t??o,[u,h]=k.useState(""),[d,p]=k.useState(0),v=k.useRef(null),S=k.useRef(null),_=As(),m=k.useMemo(()=>[{id:"goto-tasks",label:i("commandPalette.commands.goToTasks"),shortcut:"meta+1",keywords:["kanban","board","home"],category:"navigation",icon:y.jsx(pe,{icon:bh,size:16,strokeWidth:2}),action:()=>{_({to:"/tasks"}),l(!1)}},{id:"goto-terminals",label:i("commandPalette.commands.goToTerminals"),shortcut:"meta+2",keywords:["shell","console","cli"],category:"navigation",icon:y.jsx(pe,{icon:cce,size:16,strokeWidth:2}),action:()=>{_({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(pe,{icon:bh,size:16,strokeWidth:2}),action:()=>{_({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(pe,{icon:pce,size:16,strokeWidth:2}),action:()=>{_({to:"/worktrees"}),l(!1)}},{id:"goto-repositories",label:i("commandPalette.commands.goToRepositories"),shortcut:"meta+4",keywords:["repos","git","projects"],category:"navigation",icon:y.jsx(pe,{icon:uce,size:16,strokeWidth:2}),action:()=>{_({to:"/repositories"}),l(!1)}},{id:"goto-settings",label:i("commandPalette.commands.goToSettings"),shortcut:"meta+,",keywords:["preferences","config","configuration"],category:"navigation",icon:y.jsx(pe,{icon:VV,size:16,strokeWidth:2}),action:()=>{_({to:"/settings"}),l(!1)}},{id:"new-task",label:i("commandPalette.commands.newTask"),shortcut:"meta+j",keywords:["create","add"],category:"actions",icon:y.jsx(pe,{icon:ax,size:16,strokeWidth:2}),action:()=>{l(!1),r?.()}},{id:"show-shortcuts",label:i("commandPalette.commands.keyboardShortcuts"),shortcut:"meta+/",keywords:["help","hotkeys","keys"],category:"actions",icon:y.jsx(pe,{icon:mce,size:16,strokeWidth:2}),action:()=>{l(!1),n?.()}}],[_,r,n,l,i]),x=k.useMemo(()=>age(m,u),[m,u]),b=k.useMemo(()=>lge(x),[x]),w=k.useMemo(()=>{const T=[],R=["navigation","actions"];for(const A of R){const j=b.get(A);j&&T.push(...j)}return T},[b]);k.useEffect(()=>{p(0)},[u]),k.useEffect(()=>{if(!S.current)return;const T=S.current.querySelector('[data-selected="true"]');T&&T.scrollIntoView({block:"nearest"})},[d]),Ys("meta+k",()=>l(!0),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+1",()=>_({to:"/tasks"}),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+2",()=>_({to:"/terminals"}),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+i",()=>{_({to:"/terminals",search:{tab:"all-tasks"}})},{allowInInput:!0,allowInTerminal:!0}),Ys("meta+3",()=>_({to:"/worktrees"}),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+4",()=>_({to:"/repositories"}),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+,",()=>_({to:"/settings"}),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+j",()=>{r?.()},{allowInInput:!1,deps:[r]}),Ys("meta+/",()=>{n?.()},{allowInInput:!0,allowInTerminal:!0,deps:[n]});const O=k.useCallback(T=>{switch(T.key){case"ArrowDown":T.preventDefault(),p(R=>Math.min(R+1,w.length-1));break;case"ArrowUp":T.preventDefault(),p(R=>Math.max(R-1,0));break;case"Enter":T.preventDefault(),w[d]&&w[d].action();break;case"Escape":T.preventDefault(),l(!1);break}},[w,d,l]);k.useEffect(()=>{a&&(h(""),p(0),setTimeout(()=>v.current?.focus(),50))},[a]);let E=0;return y.jsx(Ta,{open:a,onOpenChange:l,children:y.jsxs(ka,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden",showCloseButton:!1,onKeyDown:O,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(qt,{ref:v,value:u,onChange:T=>h(T.target.value),placeholder:i("commandPalette.placeholder"),className:"border-0 ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 px-0 h-12"}),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:x.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(T=>{const R=b.get(T);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.${T}`)}),R.map(A=>{const j=E++,I=j===d;return y.jsxs("button",{"data-selected":I,onClick:()=>A.action(),onMouseEnter:()=>p(j),className:Me("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm",I?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[A.icon&&y.jsx("span",{className:"text-muted-foreground",children:A.icon}),y.jsx("span",{className:"flex-1 text-left",children:A.label}),A.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:GV(A.shortcut)})]},A.id)})]},T)})})})]})})}const v4={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 uge({className:e,rows:t=100,cols:r=10,tileClassName:n,tileSize:i="md"}){return y.jsx("div",{className:Me("relative z-0 flex w-full h-full justify-center",e),children:Array.from({length:t}).map((s,o)=>y.jsx("div",{className:Me(v4[i],"border-l dark:border-neutral-900 border-neutral-200 relative",n),children:Array.from({length:r}).map((a,l)=>y.jsx("div",{className:Me(v4[i],"border-r border-t dark:border-neutral-900 border-neutral-200 relative hover:bg-tile transition-colors",n)},`col-${l}`))},`row-${o}`))})}const dge=["/","/tasks","/terminals","/worktrees","/repositories","/review","/monitoring","/settings"];function fge(){const e=In({select:r=>r.location.pathname});return dge.some(r=>e===r||e.startsWith(r+"/"))?y.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none -z-10",children:y.jsx(uge,{rows:100,cols:50,tileSize:"sm"})}):null}const hge=[{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 pge({open:e,onOpenChange:t}){const{t:r}=Wt("navigation");return y.jsx(Ta,{open:e,onOpenChange:t,children:y.jsxs(ka,{className:"sm:max-w-md",children:[y.jsx(jl,{children:y.jsx(Ml,{children:r("shortcuts.title")})}),y.jsx("div",{className:"space-y-4 mt-2",children:hge.map(n=>y.jsxs("div",{children:[y.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:r(`shortcuts.groups.${n.titleKey}`)}),y.jsx("div",{className:"space-y-1",children:n.items.map(i=>y.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[y.jsx("span",{className:"text-sm",children:r(`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:GV(i.shortcut)})]},i.shortcut))})]},n.titleKey))})]})})}const mge=({...e})=>{const{resolvedTheme:t}=op();return y.jsx(Nue,{theme:t,className:"toaster group",icons:{success:y.jsx(pe,{icon:lce,strokeWidth:2,className:"size-4"}),info:y.jsx(pe,{icon:yce,strokeWidth:2,className:"size-4"}),warning:y.jsx(pe,{icon:Bd,strokeWidth:2,className:"size-4"}),error:y.jsx(pe,{icon:wce,strokeWidth:2,className:"size-4"}),loading:y.jsx(pe,{icon:sr,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})},Ho=Lre({component:xge});function gge(){return zhe(),null}function vge(){return nq(),null}function yge(){return iq(),null}function bge(){const e=In({select:r=>r.location}),{updateViewTracking:t}=sq();return k.useEffect(()=>{const r=e.pathname;let n="other",i=null,s=null;r.startsWith("/tasks/")?(n="task-detail",i=r.split("/")[2]||null):r==="/terminals"&&(n="terminals",s=new URLSearchParams(e.search).get("tab")),t(n,i,s)},[e.pathname,e.search,t]),null}function _ge(){const e=In({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 xge(){const[e,t]=k.useState(null),[r,n]=k.useState(!1),[i,s]=k.useState(!1),o=k.useCallback(h=>{t(()=>h)},[]),a=k.useCallback(()=>{e?.()},[e]),l=k.useCallback(()=>{n(!0)},[]),u=k.useCallback(()=>{s(!0)},[]);return y.jsx(Nce,{children:y.jsxs("div",{className:"flex h-screen flex-col overflow-x-hidden bg-background text-foreground",children:[y.jsx(gge,{}),y.jsx(vge,{}),y.jsx(yge,{}),y.jsx(bge,{}),y.jsx(_ge,{}),y.jsx(Ihe,{onNewTaskRef:o,onOpenCommandPalette:u}),y.jsxs("main",{className:"isolate flex-1 overflow-hidden relative",children:[y.jsx(fge,{}),y.jsx(LF,{})]}),y.jsx(cge,{open:i,onOpenChange:s,onNewTask:a,onShowShortcuts:l}),y.jsx(pge,{open:r,onOpenChange:n}),y.jsx(mge,{position:"bottom-right"})]})})}const Sge=lo("/")({beforeLoad:()=>{throw yF({to:"/tasks"})}}),oq="";function aq(){const[e,t]=k.useState(new Map),[r,n]=k.useState(null),[i,s]=k.useState(!0),[o,a]=k.useState(!1),[l,u]=k.useState(null),h=k.useRef(null),d=k.useRef(0),p=k.useCallback(()=>{h.current?.close(),s(!0),a(!1),u(null),t(new Map),n(null);const S=new EventSource(`${oq}/api/worktrees`);h.current=S,S.addEventListener("worktree:basic",_=>{const m=JSON.parse(_.data);d.current=m.length,t(new Map(m.map(x=>[x.path,{...x,size:0,sizeFormatted:"...",branch:"..."}]))),s(!1),a(m.length>0)}),S.addEventListener("worktree:details",_=>{const m=JSON.parse(_.data);t(x=>{const b=new Map(x),w=b.get(m.path);return w&&b.set(m.path,{...w,size:m.size,sizeFormatted:m.sizeFormatted,branch:m.branch}),b}),d.current--,d.current<=0&&a(!1)}),S.addEventListener("worktree:complete",_=>{const m=JSON.parse(_.data);n(m),a(!1),S.close()}),S.addEventListener("worktree:error",_=>{const{path:m}=JSON.parse(_.data);Tt.viewer.error("Error loading worktree details",{path:m}),d.current--,d.current<=0&&a(!1)}),S.onerror=()=>{u(new Error("Connection lost")),s(!1),a(!1),S.close()}},[]);return k.useEffect(()=>(p(),()=>{h.current?.close()}),[p]),{worktrees:k.useMemo(()=>Array.from(e.values()).sort((_,m)=>_.isOrphaned!==m.isOrphaned?_.isOrphaned?-1:1:new Date(m.lastModified).getTime()-new Date(_.lastModified).getTime()),[e]),summary:r,isLoading:i,isLoadingDetails:o,error:l,refetch:p}}function lq(){const e=Cn();return Yr({mutationFn:({worktreePath:t,repoPath:r,deleteLinkedTask:n})=>Dt(`${oq}/api/worktrees`,{method:"DELETE",body:JSON.stringify({worktreePath:t,repoPath:r,deleteLinkedTask:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worktrees"]}),e.invalidateQueries({queryKey:["tasks"]})}})}const wge=nu("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 Po({className:e,variant:t="default",render:r,...n}){return Ffe({defaultTagName:"span",props:ya({className:Me(wge({className:e,variant:t}))},n),render:r,state:{slot:"badge",variant:t}})}function Zi({className:e,size:t="default",...r}){return y.jsx("div",{"data-slot":"card","data-size":t,className:Me("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),...r})}function Cge({className:e,...t}){return y.jsx("div",{"data-slot":"card-header",className:Me("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 Ege({className:e,...t}){return y.jsx("div",{"data-slot":"card-title",className:Me("text-sm font-medium",e),...t})}function mp({className:e,...t}){return y.jsx("div",{"data-slot":"card-content",className:Me("px-4 group-data-[size=sm]/card:px-3",e),...t})}function Uc({...e}){return y.jsx(xde,{"data-slot":"alert-dialog",...e})}function Vc({...e}){return y.jsx(nW,{"data-slot":"alert-dialog-trigger",...e})}function Oge({...e}){return y.jsx(JV,{"data-slot":"alert-dialog-portal",...e})}function Tge({className:e,...t}){return y.jsx(YV,{"data-slot":"alert-dialog-overlay",className:Me("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 Wc({className:e,size:t="default",...r}){return y.jsxs(Oge,{children:[y.jsx(Tge,{}),y.jsx(ZV,{"data-slot":"alert-dialog-content","data-size":t,className:Me("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),...r})]})}function qc({className:e,...t}){return y.jsx("div",{"data-slot":"alert-dialog-header",className:Me("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 Gc({className:e,...t}){return y.jsx("div",{"data-slot":"alert-dialog-footer",className:Me("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 Kc({className:e,...t}){return y.jsx(rW,{"data-slot":"alert-dialog-title",className:Me("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 Yc({className:e,...t}){return y.jsx(XV,{"data-slot":"alert-dialog-description",className:Me("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...t})}function cq({className:e,...t}){return y.jsx(Ne,{"data-slot":"alert-dialog-action",className:Me(e),...t})}function Xc({className:e,variant:t="outline",size:r="default",...n}){return y.jsx(lx,{"data-slot":"alert-dialog-cancel",className:Me(e),render:y.jsx(Ne,{variant:t,size:r}),...n})}const _a=k.forwardRef(({className:e,...t},r)=>y.jsx(Xde,{ref:r,className:Me("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(Qde,{className:"flex items-center justify-center",children:y.jsx(pe,{icon:Rl,size:12,strokeWidth:3})})}));_a.displayName="Checkbox";const kA={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"},kge=lo("/worktrees/")({component:jge});function Age(){const{t:e}=Wt("common");return t=>{const r=new Date(t),i=new Date().getTime()-r.getTime(),s=Math.floor(i/1e3),o=Math.floor(s/60),a=Math.floor(o/60),l=Math.floor(a/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):a>0?a===1?e("time.hourAgo"):e("time.hoursAgo",{count:a}):o>0?o===1?e("time.minuteAgo"):e("time.minutesAgo",{count:o}):e("time.justNow")}}function y4({className:e}){return y.jsx("span",{className:`inline-block animate-pulse rounded bg-muted ${e}`})}function Rge({worktree:e,onDelete:t}){const{t:r}=Wt("common"),{t:n}=Wt("worktrees"),i=Age(),[s,o]=k.useState(!1),[a,l]=k.useState(!1),[u,h]=k.useState(!1),d=e.sizeFormatted==="..."||e.branch==="...",p=!e.isOrphaned&&e.taskId,v=async()=>{l(!0);try{await t(e,u),o(!1)}catch{}finally{l(!1)}},S=_=>{o(_),_||h(!1)};return y.jsx(Zi,{className:"transition-colors hover:border-border/80",children:y.jsxs(mp,{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(Po,{className:Me("shrink-0",kA.ORPHANED),children:r("statuses.ORPHANED")}):e.taskStatus?y.jsx(Po,{className:Me("shrink-0",kA[e.taskStatus]),children:r(`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(pe,{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(pe,{icon:i_,size:12,strokeWidth:2,className:"shrink-0"}),e.branch==="..."?y.jsx(y4,{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(pe,{icon:HV,size:12,strokeWidth:2,className:"shrink-0"}),e.sizeFormatted==="..."?y.jsx(y4,{className:"h-3 w-12"}):y.jsx("span",{children:e.sizeFormatted})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(pe,{icon:BV,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(hi,{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(pe,{icon:Iv,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),y.jsxs(Uc,{open:s,onOpenChange:S,children:[y.jsx(Vc,{render:y.jsx(Ne,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:d}),children:y.jsx(pe,{icon:pp,size:14,strokeWidth:2})}),y.jsxs(Wc,{children:[y.jsxs(qc,{children:[y.jsx(Kc,{children:n("delete.title")}),y.jsxs(Yc,{children:[n("delete.description")," ",y.jsx("span",{className:"font-mono",children:e.name}),".",u&&p&&y.jsxs(y.Fragment,{children:[" ",n("delete.linkedTaskWillBeDeleted",{title:e.taskTitle})]})," ",n("delete.cannotUndo")]}),p&&y.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[y.jsx(_a,{checked:u,onCheckedChange:_=>h(_===!0),disabled:a}),n("delete.alsoDeleteLinkedTask",{title:e.taskTitle})]})]}),y.jsxs(Gc,{children:[y.jsx(Xc,{disabled:a,children:r("buttons.cancel")}),y.jsxs(Ne,{variant:"destructive",onClick:v,disabled:a,className:"gap-2",children:[a&&y.jsx(pe,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}),r(a?"status.deleting":"buttons.delete")]})]})]})]})]})})}const Pge=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function jge(){const{t:e}=Wt("common"),{t}=Wt("worktrees"),{worktrees:r,summary:n,isLoading:i,isLoadingDetails:s,error:o,refetch:a}=aq(),l=lq(),[u,h]=k.useState(new Set),[d,p]=k.useState(!1),[v,S]=k.useState(!1),[_,m]=k.useState(!1),x=A=>{h(j=>{const I=new Set(j);return I.has(A)?I.delete(A):I.add(A),I})},b=()=>{h(new Set)},w=k.useMemo(()=>u.size===0?r:r.filter(A=>!!(A.isOrphaned&&u.has("ORPHANED")||A.taskStatus&&u.has(A.taskStatus))),[r,u]),O=k.useMemo(()=>r.filter(A=>A.taskStatus==="DONE"||A.taskStatus==="CANCELED"),[r]),E=async()=>{if(O.length!==0){S(!0);try{for(const A of O)await l.mutateAsync({worktreePath:A.path,repoPath:A.repoPath,deleteLinkedTask:_});p(!1),a()}catch{}finally{S(!1)}}},T=A=>{p(A),A||m(!1)},R=async(A,j)=>{await l.mutateAsync({worktreePath:A.path,repoPath:A.repoPath,deleteLinkedTask:j}),a()};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")}),(n||r.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:n?.total??r.length})}),(n?.orphaned??r.filter(A=>A.isOrphaned).length)>0&&y.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:n?.orphaned??r.filter(A=>A.isOrphaned).length})}),s?y.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):n?y.jsx("span",{children:n.totalSizeFormatted}):null]})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[O.length>0&&y.jsxs(Uc,{open:d,onOpenChange:T,children:[y.jsxs(Vc,{render:y.jsx(Ne,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:s}),children:[y.jsx(pe,{icon:$V,size:12,strokeWidth:2}),t("cleanup.button",{count:O.length})]}),y.jsxs(Wc,{children:[y.jsxs(qc,{children:[y.jsx(Kc,{children:t("cleanup.title")}),y.jsxs(Yc,{children:[t("cleanup.description",{count:O.length}),_&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),y.jsxs("div",{className:"space-y-3",children:[y.jsxs("p",{className:"text-sm text-muted-foreground",children:[O.filter(A=>A.taskStatus==="DONE").length>0&&y.jsxs("span",{className:"mr-3",children:[y.jsx("span",{className:"font-medium text-accent",children:O.filter(A=>A.taskStatus==="DONE").length})," ",t("cleanup.done")]}),O.filter(A=>A.taskStatus==="CANCELED").length>0&&y.jsxs("span",{children:[y.jsx("span",{className:"font-medium text-destructive",children:O.filter(A=>A.taskStatus==="CANCELED").length})," ",t("cleanup.canceled")]})]}),y.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[y.jsx(_a,{checked:_,onCheckedChange:A=>m(A===!0),disabled:v}),t("cleanup.alsoDeleteLinkedTasks")]}),y.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),y.jsxs(Gc,{children:[y.jsx(Xc,{disabled:v,children:e("buttons.cancel")}),y.jsxs(Ne,{variant:"destructive",onClick:E,disabled:v,className:"gap-2",children:[v&&y.jsx(pe,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}),v?e("status.deleting"):t("delete.button",{count:O.length})]})]})]})]}),u.size>0&&y.jsxs(Ne,{variant:"ghost",size:"sm",onClick:b,className:"gap-1.5 text-xs",children:[y.jsx(pe,{icon:es,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),y.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:Pge.map(A=>{const j=u.has(A);return y.jsx("button",{onClick:()=>x(A),className:Me("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",j?kA[A]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${A}`)},A)})})]}),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(pe,{icon:sr,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),o&&y.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[y.jsx(pe,{icon:Bd,size:20,strokeWidth:2}),y.jsx("span",{className:"text-sm",children:t("error.failedToLoad",{message:o.message})})]}),!i&&!o&&w.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:w.map(A=>y.jsx(Rge,{worktree:A,onDelete:R},A.path))})]})]})}function Vt(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(r.length?" "+r.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var Mge={};function xx(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:Mge}var uq=Object.assign,c_=Object.getOwnPropertyDescriptor,ua=Object.defineProperty,Sx=Object.prototype,AA=[];Object.freeze(AA);var $j={};Object.freeze($j);var Lge=typeof Proxy<"u",Dge=Object.toString();function dq(){Lge||Vt("Proxy not available")}function fq(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Vf=function(){};function Ts(e){return typeof e=="function"}function kd(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function wx(e){return e!==null&&typeof e=="object"}function Qc(e){if(!wx(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r.toString()===Dge}function hq(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Cx(e,t,r){ua(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function pq(e,t,r){ua(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function cu(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return wx(n)&&n[r]===!0}}function gp(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function Ige(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function cl(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var mq=typeof Object.getOwnPropertySymbols<"u";function Nge(e){var t=Object.keys(e);if(!mq)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return Sx.propertyIsEnumerable.call(e,n)})):t}var Ex=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:mq?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function gq(e){return e===null?null:typeof e=="object"?""+e:e}function ml(e,t){return Sx.hasOwnProperty.call(e,t)}var Bge=Object.getOwnPropertyDescriptors||function(t){var r={};return Ex(t).forEach(function(n){r[n]=c_(t,n)}),r};function ws(e,t){return!!(e&t)}function Cs(e,t,r){return r?e|=t:e&=~t,e}function b4(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function $ge(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Hge(n.key),n)}}function vp(e,t,r){return t&&$ge(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Wf(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=Fge(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
26
+ `:"")+S)}catch(S){Jt.error("Failed to upload image"),Tt.kanban.error("Upload error",{error:String(S)})}finally{o(!1)}return}}};return y.jsxs("div",{className:"space-y-2",children:[y.jsxs("div",{className:"relative",children:[y.jsx(hx,{ref:a,value:e,onChange:h=>t(h.target.value),onPaste:u,className:Me(s&&"opacity-50",r),disabled:s||n,...i}),s&&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((h,d)=>y.jsx("a",{href:n4(h),target:"_blank",rel:"noopener noreferrer",className:"block",children:y.jsx("img",{src:n4(h),alt:`Attachment ${d+1}`,className:"h-16 w-auto rounded border object-cover hover:opacity-80 transition-opacity"})},d))})]})}function aW({className:e,...t}){return y.jsx("label",{"data-slot":"label",className:Me("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 $ue=k.forwardRef(function(t,r){const{className:n,render:i,orientation:s="horizontal",...o}=t,a=k.useMemo(()=>({orientation:s}),[s]);return dt("div",t,{state:a,ref:r,props:[{role:"separator","aria-orientation":s},o]})});function zue({className:e,orientation:t="horizontal",...r}){return y.jsx($ue,{"data-slot":"separator",orientation:t,className:Me("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),...r})}function pl({className:e,...t}){return y.jsx("div",{"data-slot":"field-group",className:Me("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 Hue=nu("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 mr({className:e,orientation:t="vertical",...r}){return y.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:Me(Hue({orientation:t}),e),...r})}function gr({className:e,...t}){return y.jsx(aW,{"data-slot":"field-label",className:Me("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 Oi({className:e,...t}){return y.jsx("p",{"data-slot":"field-description",className:Me("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 lW(e){const t=k.useRef(!0);t.current&&(t.current=!1,e())}const cW=k.createContext(null),uW=k.createContext(null);function Aa(){const e=k.useContext(cW);if(e===null)throw new Error(er(60));return e}function dW(){const e=k.useContext(uW);if(e===null)throw new Error(er(61));return e}const fW=(e,t)=>Object.is(e,t);function wl(e,t,r){return e==null||t==null?Object.is(e,t):r(e,t)}function Zu(e,t,r){return!e||e.length===0?!1:e.some(n=>n===void 0?!1:wl(n,t,r))}function _h(e,t,r){return!e||e.length===0?-1:e.findIndex(n=>n===void 0?!1:wl(n,t,r))}function hW(e,t,r){return e.filter(n=>!wl(n,t,r))}function OA(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function pW(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function An(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 OA(e)}function Eo(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?OA(e.value):OA(e)}function Fue(e,t,r){if(r&&e!=null)return r(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??An(e,r);if(Array.isArray(t)){const n=pW(t)?t.flatMap(i=>i.items):t;if(e==null){const i=n.find(s=>s.value==null);return i&&i.label!=null?i.label:An(e,r)}if(typeof e!="object"){const i=n.find(s=>s&&s.value===e);return i&&i.label!=null?i.label:An(e,r)}if("value"in e){const i=n.find(s=>s&&s.value===e.value);if(i&&i.label!=null)return i.label}}return An(e,r)}function Uue(e,t){return!Array.isArray(e)||e.length===0?"":e.map(r=>An(r,t)).join(", ")}const Ct={id:ke(e=>e.id),modal:ke(e=>e.modal),multiple:ke(e=>e.multiple),items:ke(e=>e.items),itemToStringLabel:ke(e=>e.itemToStringLabel),itemToStringValue:ke(e=>e.itemToStringValue),isItemEqualToValue:ke(e=>e.isItemEqualToValue),value:ke(e=>e.value),open:ke(e=>e.open),mounted:ke(e=>e.mounted),forceMount:ke(e=>e.forceMount),transitionStatus:ke(e=>e.transitionStatus),openMethod:ke(e=>e.openMethod),activeIndex:ke(e=>e.activeIndex),selectedIndex:ke(e=>e.selectedIndex),isActive:ke((e,t)=>e.activeIndex===t),isSelected:ke((e,t,r)=>{const n=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(s=>wl(s,r,n)):e.selectedIndex===t&&e.selectedIndex!==null?!0:wl(i,r,n)}),isSelectedByFocus:ke((e,t)=>e.selectedIndex===t),popupProps:ke(e=>e.popupProps),triggerProps:ke(e=>e.triggerProps),triggerElement:ke(e=>e.triggerElement),positionerElement:ke(e=>e.positionerElement),listElement:ke(e=>e.listElement),scrollUpArrowVisible:ke(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:ke(e=>e.scrollDownArrowVisible),hasScrollArrows:ke(e=>e.hasScrollArrows),serializedValue:ke(e=>{const{multiple:t,value:r,itemToStringValue:n}=e;return t&&Array.isArray(r)&&r.length===0?"":Eo(r,n)})};function Ju(e,t){const r=k.useRef(e),n=Be(t);He(()=>{r.current!==e&&n(r.current)},[e,n]),He(()=>{r.current=e},[e])}function Vue(e){const{id:t,value:r,defaultValue:n=null,onValueChange:i,open:s,defaultOpen:o=!1,onOpenChange:a,name:l,disabled:u=!1,readOnly:h=!1,required:d=!1,modal:p=!0,actionsRef:v,inputRef:S,onOpenChangeComplete:_,items:m,multiple:x=!1,itemToStringLabel:b,itemToStringValue:w,isItemEqualToValue:O=fW,highlightItemOnHover:E=!0,children:T}=e,{clearErrors:R}=$v(),{setDirty:A,shouldValidateOnChange:j,validityData:I,setFilled:L,name:z,disabled:D,validation:V}=uo(),{controlId:H}=au(),$=fx({id:t}),F=D||u,W=z??l,[B,G]=Os({controlled:r,default:x?n??ki:n,name:"Select",state:"value"}),[N,U]=Os({controlled:s,default:o,name:"Select",state:"open"}),Y=k.useRef([]),Q=k.useRef([]),J=k.useRef(null),re=k.useRef(null),X=k.useRef(0),q=k.useRef(null),Z=k.useRef([]),te=k.useRef(!1),ne=k.useRef(!1),ie=k.useRef(null),me=k.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),ye=k.useRef(!1),{mounted:ue,setMounted:he,transitionStatus:fe}=$o(N),{openMethod:$e,triggerProps:ve,reset:De}=dx(N),_e=ti(()=>new dd({id:$,modal:p,multiple:x,itemToStringLabel:b,itemToStringValue:w,isItemEqualToValue:O,value:B,open:N,mounted:ue,transitionStatus:fe,items:m,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,ae=Ie(_e,Ct.activeIndex),ce=Ie(_e,Ct.selectedIndex),be=Ie(_e,Ct.triggerElement),Ee=Ie(_e,Ct.positionerElement),Ve=k.useMemo(()=>x&&Array.isArray(B)&&B.length===0?"":Eo(B,w),[x,B,w]),st=k.useMemo(()=>x&&Array.isArray(B)?B.map(mt=>Eo(mt,w)):Eo(B,w),[x,B,w]),Re=Fr(_e.state.triggerElement);zv({id:$,commit:V.commit,value:B,controlRef:Re,name:W,getValue:()=>st});const We=k.useRef(B);He(()=>{B!==We.current&&_e.set("forceMount",!0)},[_e,B]),He(()=>{L(B!==null)},[B,L]),He(function(){if(N)return;const Nt=Z.current;if(x){const Pt=Array.isArray(B)?B:[];if(Pt.length===0){_e.set("selectedIndex",null);return}const rt=Pt[Pt.length-1],nr=_h(Nt,rt,O);_e.set("selectedIndex",nr===-1?null:nr);return}const Rt=_h(Nt,B,O);_e.set("selectedIndex",Rt===-1?null:Rt)},[x,N,B,Z,O,_e]),Ju(B,()=>{R(W),A(B!==I.initialValue),j()?V.commit(B):V.commit(B,!0)});const Ge=Be((mt,Nt)=>{if(a?.(mt,Nt),!Nt.isCanceled&&(U(mt),!mt&&_e.state.activeIndex!==null)){const Rt=Y.current[_e.state.activeIndex];queueMicrotask(()=>{Rt?.setAttribute("tabindex","-1")})}}),vt=Be(()=>{he(!1),_e.set("activeIndex",null),De(),_?.(!1)});gi({enabled:!v,open:N,ref:J,onComplete(){N||vt()}}),k.useImperativeHandle(v,()=>({unmount:vt}),[vt]);const Ke=Be((mt,Nt)=>{i?.(mt,Nt),!Nt.isCanceled&&G(mt)}),Qe=Be(()=>{const mt=_e.state.listElement||J.current;if(!mt)return;const Nt=mt.scrollTop,Rt=mt.scrollTop+mt.clientHeight,Pt=Nt>1,rt=Rt<mt.scrollHeight-1;_e.state.scrollUpArrowVisible!==Pt&&_e.set("scrollUpArrowVisible",Pt),_e.state.scrollDownArrowVisible!==rt&&_e.set("scrollDownArrowVisible",rt)}),Ae=J1({open:N,onOpenChange:Ge,elements:{reference:be,floating:Ee}}),ot=dp(Ae,{enabled:!h&&!F,event:"mousedown"}),ft=Pv(Ae,{bubbles:!1}),Je=cj(Ae,{enabled:!h&&!F,listRef:Y,activeIndex:ae,selectedIndex:ce,disabledIndices:ki,onNavigate(mt){mt===null&&!N||_e.set("activeIndex",mt)},focusItemOnHover:!1}),lt=uj(Ae,{enabled:!h&&!F&&(N||!x),listRef:Q,activeIndex:ae,selectedIndex:ce,onMatch(mt){N?_e.set("activeIndex",mt):Ke(Z.current[mt],Ue("none"))},onTypingChange(mt){te.current=mt}}),{getReferenceProps:Ht,getFloatingProps:pt,getItemProps:Pr}=Nd([ot,ft,Je,lt]),It=k.useMemo(()=>ya(Ht(),ve),[Ht,ve]);lW(()=>{_e.update({popupProps:pt(),triggerProps:It})}),He(()=>{_e.update({id:$,modal:p,multiple:x,value:B,open:N,mounted:ue,transitionStatus:fe,popupProps:pt(),triggerProps:It,items:m,itemToStringLabel:b,itemToStringValue:w,isItemEqualToValue:O,openMethod:$e})},[_e,$,p,x,B,N,ue,fe,pt,It,m,b,w,O,$e]);const kt=k.useMemo(()=>({store:_e,name:W,required:d,disabled:F,readOnly:h,multiple:x,itemToStringLabel:b,itemToStringValue:w,highlightItemOnHover:E,setValue:Ke,setOpen:Ge,listRef:Y,popupRef:J,scrollHandlerRef:re,handleScrollArrowVisibility:Qe,scrollArrowsMountedCountRef:X,getItemProps:Pr,events:Ae.context.events,valueRef:q,valuesRef:Z,labelsRef:Q,typingRef:te,selectionRef:me,selectedItemTextRef:ie,validation:V,onOpenChangeComplete:_,keyboardActiveRef:ne,alignItemWithTriggerActiveRef:ye,initialValueRef:We}),[_e,W,d,F,h,x,b,w,E,Ke,Ge,Pr,Ae.context.events,V,_,Qe]),tt=co(S,V.inputRef),Gt=x&&Array.isArray(B)&&B.length>0,rr=k.useMemo(()=>!x||!Array.isArray(B)||!W?null:B.map(mt=>{const Nt=Eo(mt,w);return y.jsx("input",{type:"hidden",name:W,value:Nt},Nt)}),[x,B,W,w]);return y.jsx(cW.Provider,{value:kt,children:y.jsxs(uW.Provider,{value:Ae,children:[T,y.jsx("input",{...V.getInputValidationProps({onFocus(){_e.state.triggerElement?.focus()},onChange(mt){if(mt.nativeEvent.defaultPrevented)return;const Nt=mt.target.value,Rt=Ue(Pn,mt.nativeEvent);function Pt(){if(x)return;const rt=Z.current.find(nr=>Eo(nr,w).toLowerCase()===Nt.toLowerCase());rt!=null&&(A(rt!==I.initialValue),Ke(rt,Rt),j()&&V.commit(rt))}_e.set("forceMount",!0),queueMicrotask(Pt)}}),id:t||H||void 0,name:x?void 0:W,value:Ve,disabled:F,required:d&&!Gt,readOnly:h,ref:tt,style:up,tabIndex:-1,"aria-hidden":!0}),rr]})})}function Cj(e){const t=e.getBoundingClientRect(),r=window.getComputedStyle(e,"::before"),n=window.getComputedStyle(e,"::after");if(!(r.content!=="none"||n.content!=="none"))return t;const s=parseFloat(r.width)||0,o=parseFloat(r.height)||0,a=parseFloat(n.width)||0,l=parseFloat(n.height)||0,u=Math.max(t.width,s,a),h=Math.max(t.height,o,l),d=u-t.width,p=h-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const Ub=2,Wue={...yh,...zd,value:()=>null},que=k.forwardRef(function(t,r){const{render:n,className:i,disabled:s=!1,nativeButton:o=!0,...a}=t,{setTouched:l,setFocused:u,validationMode:h,state:d,disabled:p}=uo(),{labelId:v}=au(),{store:S,setOpen:_,selectionRef:m,validation:x,readOnly:b,alignItemWithTriggerActiveRef:w,disabled:O,keyboardActiveRef:E}=Aa(),T=p||O||s,R=Ie(S,Ct.open),A=Ie(S,Ct.value),j=Ie(S,Ct.triggerProps),I=Ie(S,Ct.positionerElement),L=Ie(S,Ct.listElement),z=Ie(S,Ct.serializedValue),D=Fr(I),V=k.useRef(null),H=Sr(),$=Sr(),{getButtonProps:F,buttonRef:W}=Di({disabled:T,native:o}),B=Be(re=>{S.set("triggerElement",re)}),G=co(r,V,W,B),N=Sr(),U=Sr();k.useEffect(()=>{if(R)return U.start(200,()=>{m.current.allowUnselectedMouseUp=!0,N.start(200,()=>{m.current.allowSelectedMouseUp=!0})}),()=>{N.clear(),U.clear()};m.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},$.clear()},[R,m,$,N,U]);const Y=k.useMemo(()=>L?.id??xg(I)?.id,[L,I]),Q=ya(j,{role:"combobox","aria-expanded":R?"true":"false","aria-haspopup":"listbox","aria-controls":R?Y:void 0,"aria-labelledby":v,"aria-readonly":b||void 0,tabIndex:T?-1:0,ref:G,onFocus(re){u(!0),R&&w.current&&_(!1,Ue(Lo,re.nativeEvent)),H.start(0,()=>{S.set("forceMount",!0)})},onBlur(){l(!0),u(!1),h==="onBlur"&&x.commit(A)},onPointerMove(){E.current=!1},onKeyDown(){E.current=!0},onMouseDown(re){if(R)return;const X=ri(re.currentTarget);function q(Z){if(!V.current)return;const te=Z.target;if(ut(V.current,te)||ut(D.current,te)||te===V.current)return;const ne=Cj(V.current);Z.clientX>=ne.left-Ub&&Z.clientX<=ne.right+Ub&&Z.clientY>=ne.top-Ub&&Z.clientY<=ne.bottom+Ub||_(!1,Ue(XU,Z))}$.start(0,()=>{X.addEventListener("mouseup",q,{once:!0})})}},x.getValidationProps,a,F);Q.role="combobox";const J=k.useMemo(()=>({...d,open:R,disabled:T,value:A,readOnly:b,placeholder:!z}),[d,R,T,A,b,z]);return dt("button",t,{ref:[r,V],state:J,stateAttributesMapping:Wue,props:Q})}),Gue={value:()=>null},Kue=k.forwardRef(function(t,r){const{className:n,render:i,children:s,...o}=t,{store:a,valueRef:l}=Aa(),u=Ie(a,Ct.value),h=Ie(a,Ct.items),d=Ie(a,Ct.itemToStringLabel),p=Ie(a,Ct.serializedValue),v=k.useMemo(()=>({value:u,placeholder:!p}),[u,p]),S=typeof s=="function"?s(u):s??(Array.isArray(u)?Uue(u,d):Fue(u,h,d));return dt("span",t,{state:v,ref:[r,l],props:[{children:S},o],stateAttributesMapping:Gue})}),Yue=k.forwardRef(function(t,r){const{className:n,render:i,...s}=t,{store:o}=Aa(),a=Ie(o,Ct.open),l=k.useMemo(()=>({open:a}),[a]);return dt("span",t,{state:l,ref:r,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:fj})}),Xue=k.createContext(void 0),Que=k.forwardRef(function(t,r){const{store:n}=Aa(),i=Ie(n,Ct.mounted),s=Ie(n,Ct.forceMount);return i||s?y.jsx(Xue.Provider,{value:!0,children:y.jsx(Rv,{ref:r,...t})}):null}),mW=k.createContext(void 0);function Ej(){const e=k.useContext(mW);if(!e)throw new Error(er(59));return e}function o_(e,t){e&&Object.assign(e.style,t)}const gW={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Zue={position:"fixed"},Jue=k.forwardRef(function(t,r){const{anchor:n,positionMethod:i="absolute",className:s,render:o,side:a="bottom",align:l="center",sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:_,alignItemWithTrigger:m=!0,collisionAvoidance:x=W1,...b}=t,{store:w,listRef:O,labelsRef:E,alignItemWithTriggerActiveRef:T,selectedItemTextRef:R,valuesRef:A,initialValueRef:j,popupRef:I,setValue:L}=Aa(),z=dW(),D=Ie(w,Ct.open),V=Ie(w,Ct.mounted),H=Ie(w,Ct.modal),$=Ie(w,Ct.value),F=Ie(w,Ct.openMethod),W=Ie(w,Ct.positionerElement),B=Ie(w,Ct.triggerElement),G=Ie(w,Ct.isItemEqualToValue),N=k.useRef(null),U=k.useRef(null),[Y,Q]=k.useState(m),J=V&&Y&&F!=="touch";!V&&Y!==m&&Q(m),He(()=>{V||(Ct.scrollUpArrowVisible(w.state)&&w.set("scrollUpArrowVisible",!1),Ct.scrollDownArrowVisible(w.state)&&w.set("scrollDownArrowVisible",!1))},[w,V]),k.useImperativeHandle(T,()=>J),ux((J||H)&&D&&F!=="touch",B);const re=ix({anchor:n,floatingRootContext:z,positionMethod:i,mounted:V,side:a,sideOffset:u,align:l,alignOffset:h,arrowPadding:v,collisionBoundary:d,collisionPadding:p,sticky:S,disableAnchorTracking:_??J,collisionAvoidance:x,keepMounted:!0}),X=J?"none":re.side,q=J?Zue:re.positionerStyles,Z=k.useMemo(()=>{const he={};return D||(he.pointerEvents="none"),{role:"presentation",hidden:!V,style:{...q,...he}}},[D,V,q]),te=k.useMemo(()=>({open:D,side:X,align:re.align,anchorHidden:re.anchorHidden}),[D,X,re.align,re.anchorHidden]),ne=Be(he=>{w.set("positionerElement",he)}),ie=dt("div",t,{ref:[r,ne],state:te,stateAttributesMapping:zo,props:[Z,b]}),me=k.useRef(0),ye=Be(he=>{if(he.size===0&&me.current===0||A.current.length===0)return;const fe=me.current;if(me.current=he.size,he.size===fe)return;const $e=Ue(Pn);if(fe!==0&&!w.state.multiple&&$!==null&&_h(A.current,$,G)===-1){const De=j.current,ae=De!=null&&Zu(A.current,De,G)?De:null;L(ae,$e),ae===null&&(w.set("selectedIndex",null),R.current=null)}if(fe!==0&&w.state.multiple&&Array.isArray($)){const ve=$.filter(De=>Zu(A.current,De,G));(ve.length!==$.length||ve.some(De=>!Zu($,De,G)))&&(L(ve,$e),ve.length===0&&(w.set("selectedIndex",null),R.current=null))}if(D&&J){w.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ve={height:""};o_(W,ve),o_(I.current,ve)}}),ue=k.useMemo(()=>({...re,side:X,alignItemWithTriggerActive:J,setControlledAlignItemWithTrigger:Q,scrollUpArrowRef:N,scrollDownArrowRef:U}),[re,X,J,Q]);return y.jsx(jv,{elementsRef:O,labelsRef:E,onMapChange:ye,children:y.jsxs(mW.Provider,{value:ue,children:[V&&H&&y.jsx(cx,{inert:fp(!D),cutout:B}),ie]})})});function vW(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 Vb="base-ui-disable-scrollbar",Eg={className:Vb,element:y.jsx("style",{href:Vb,precedence:"base-ui:low",children:`.${Vb}{scrollbar-width:none}.${Vb}::-webkit-scrollbar{display:none}`})},ede=k.createContext(void 0);function Oj(e){return k.useContext(ede)}const tde={...zo,...ho},rde=k.forwardRef(function(t,r){const{render:n,className:i,...s}=t,{store:o,popupRef:a,onOpenChangeComplete:l,setOpen:u,valueRef:h,selectedItemTextRef:d,keyboardActiveRef:p,multiple:v,handleScrollArrowVisibility:S,scrollHandlerRef:_}=Aa(),{side:m,align:x,alignItemWithTriggerActive:b,setControlledAlignItemWithTrigger:w,scrollDownArrowRef:O,scrollUpArrowRef:E}=Ej(),T=Oj()!=null,R=dW(),A=Sr(),j=Ie(o,Ct.id),I=Ie(o,Ct.open),L=Ie(o,Ct.mounted),z=Ie(o,Ct.popupProps),D=Ie(o,Ct.transitionStatus),V=Ie(o,Ct.triggerElement),H=Ie(o,Ct.positionerElement),$=Ie(o,Ct.listElement),F=k.useRef(0),W=k.useRef(!1),B=k.useRef(0),G=k.useRef(!1),N=k.useRef({}),U=Ic(),Y=Be(X=>{if(!H||!a.current||!G.current)return;if(W.current||!b){S();return}const q=H.style.top==="0px",Z=H.style.bottom==="0px",te=H.getBoundingClientRect().height,ne=ri(H),ie=getComputedStyle(H),me=parseFloat(ie.marginTop),ye=parseFloat(ie.marginBottom),ue=ne.documentElement.clientHeight-me-ye,he=X.scrollTop,fe=X.scrollHeight,$e=X.clientHeight,ve=fe-$e;let De=null,_e=null,ae=!1;if(q){const ce=ve-he,be=te+ce,Ee=Math.min(be,ue);De=Ee,Ee!==ue?_e=ve:ae=!0}else if(Z){const ce=he-0,be=te+ce,Ee=Math.min(be,ue),Ve=be-ue;De=Ee,Ee!==ue?_e=0:(ae=!0,he<ve&&(_e=he-(ce-Ve)))}De!=null&&(H.style.height=`${De}px`),_e!=null&&(X.scrollTop=_e),ae&&(W.current=!0),S()});k.useImperativeHandle(_,()=>Y,[Y]),gi({open:I,ref:a,onComplete(){I&&l?.(!0)}});const Q=k.useMemo(()=>({open:I,transitionStatus:D,side:m,align:x}),[I,D,m,x]);He(()=>{!H||!a.current||Object.keys(N.current).length||(N.current={top:H.style.top||"0",left:H.style.left||"0",right:H.style.right,height:H.style.height,bottom:H.style.bottom,minHeight:H.style.minHeight,maxHeight:H.style.maxHeight,marginTop:H.style.marginTop,marginBottom:H.style.marginBottom})},[a,H]),He(()=>{L||b||(G.current=!1,W.current=!1,F.current=0,B.current=0,o_(H,N.current))},[L,b,H,a]),He(()=>{const X=a.current;if(!(!L||!V||!H||!X)){if(!b){G.current=!0,U.request(S);return}queueMicrotask(()=>{const q=getComputedStyle(H),Z=getComputedStyle(X),te=ri(V),ne=cn(H),ie=V.getBoundingClientRect(),me=H.getBoundingClientRect(),ye=ie.left,ue=ie.height,he=$||X,fe=he.scrollHeight,$e=parseFloat(Z.borderBottomWidth),ve=parseFloat(q.marginTop)||10,De=parseFloat(q.marginBottom)||10,_e=parseFloat(q.minHeight)||100,ae=5,ce=5,be=20,Ee=te.documentElement.clientHeight-ve-De,Ve=te.documentElement.clientWidth,st=Ee-ie.bottom+ue,Re=d.current,We=h.current;let Ge=0,vt=0;if(Re&&We){const kt=We.getBoundingClientRect(),tt=Re.getBoundingClientRect(),Gt=kt.left-ye,rr=tt.left-me.left,mt=kt.top-ie.top+kt.height/2,Nt=tt.top-me.top+tt.height/2;Ge=Gt-rr,vt=Nt-mt}const Ke=st+vt+De+$e;let Qe=Math.min(Ee,Ke);const Ae=Ee-ve-De,ot=Ke-Qe,ft=Math.max(ae,ye+Ge),Je=Ve-ce,lt=Math.max(0,ft+me.width-Je);H.style.left=`${ft-lt}px`,H.style.height=`${Qe}px`,H.style.maxHeight="auto",H.style.marginTop=`${ve}px`,H.style.marginBottom=`${De}px`,X.style.height="100%";const Ht=he.scrollHeight-he.clientHeight,pt=ot>=Ht;pt&&(Qe=Math.min(Ee,me.height)-(ot-Ht));const Pr=ie.top<be||ie.bottom>Ee-be||Qe<Math.min(fe,_e),It=(ne.visualViewport?.scale??1)!==1&&YP;if(Pr||It){G.current=!0,o_(H,N.current),hn.flushSync(()=>w(!1));return}if(pt){const kt=Math.max(0,Ee-Ke);H.style.top=me.height>=Ae?"0":`${kt}px`,H.style.height=`${Qe}px`,he.scrollTop=he.scrollHeight-he.clientHeight,F.current=Math.max(_e,Qe)}else H.style.bottom="0",F.current=Math.max(_e,Qe),he.scrollTop=ot;F.current===Ee&&(W.current=!0),S(),setTimeout(()=>{G.current=!0})})}},[o,L,H,V,h,d,a,S,b,w,U,O,E,$]),k.useEffect(()=>{if(!b||!H||!L)return;const X=cn(H);function q(Z){u(!1,Ue(Roe,Z))}return X.addEventListener("resize",q),()=>{X.removeEventListener("resize",q)}},[u,b,H,L]);const J={...$?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":v||void 0,id:`${j}-list`},onKeyDown(X){p.current=!0,T&&dj.has(X.key)&&X.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(X){if(vW(X)||X.pointerType==="touch")return;const q=X.currentTarget;A.start(0,()=>{o.set("activeIndex",null),q.focus({preventScroll:!0})})},onScroll(X){$||_.current?.(X.currentTarget)},...b&&{style:$?{height:"100%"}:gW}},re=dt("div",t,{ref:[r,a],state:Q,stateAttributesMapping:tde,props:[z,J,sx(D),{className:!$&&b?Eg.className:void 0},s]});return y.jsxs(k.Fragment,{children:[Eg.element,y.jsx(Y1,{context:R,modal:!1,disabled:!L,restoreFocus:!0,children:re})]})}),nde=k.forwardRef(function(t,r){const{className:n,render:i,...s}=t,{store:o,scrollHandlerRef:a}=Aa(),{alignItemWithTriggerActive:l}=Ej(),u=Ie(o,Ct.hasScrollArrows),h=Ie(o,Ct.openMethod),d=Ie(o,Ct.multiple),v={id:`${Ie(o,Ct.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(_){a.current?.(_.currentTarget)},...l&&{style:gW},className:u&&h!=="touch"?Eg.className:void 0},S=Be(_=>{o.set("listElement",_)});return dt("div",t,{ref:[r,S],props:[v,s]})}),yW=k.createContext(void 0);function Tj(){const e=k.useContext(yW);if(!e)throw new Error(er(57));return e}const ide=k.memo(k.forwardRef(function(t,r){const{render:n,className:i,value:s=null,label:o,disabled:a=!1,nativeButton:l=!1,...u}=t,h=k.useRef(null),d=hp({label:o,textRef:h,indexGuessBehavior:hj.GuessFromOrder}),{store:p,getItemProps:v,setOpen:S,setValue:_,selectionRef:m,typingRef:x,valuesRef:b,keyboardActiveRef:w,multiple:O,highlightItemOnHover:E}=Aa(),T=Sr(),R=Ie(p,Ct.isActive,d.index),A=Ie(p,Ct.isSelected,d.index,s),j=Ie(p,Ct.isSelectedByFocus,d.index),I=Ie(p,Ct.isItemEqualToValue),L=d.index,z=L!==-1,D=k.useRef(null),V=Fr(L);He(()=>{if(!z)return;const re=b.current;return re[L]=s,()=>{delete re[L]}},[z,L,s,b]),He(()=>{if(!z)return;const re=p.state.value;let X=re;O&&Array.isArray(re)&&re.length>0&&(X=re[re.length-1]),X!==void 0&&wl(X,s,I)&&p.set("selectedIndex",L)},[z,L,O,I,p,s]);const H=k.useMemo(()=>({disabled:a,selected:A,highlighted:R}),[a,A,R]),$=v({active:R,selected:A});$.onFocus=void 0,$.id=void 0;const F=k.useRef(null),W=k.useRef("mouse"),B=k.useRef(!1),{getButtonProps:G,buttonRef:N}=Di({disabled:a,focusableWhenDisabled:!0,native:l});function U(re){const X=p.state.value;if(O){const q=Array.isArray(X)?X:[],Z=A?hW(q,s,I):[...q,s];_(Z,Ue(ud,re))}else _(s,Ue(ud,re)),S(!1,Ue(ud,re))}const Y={role:"option","aria-selected":A,"aria-disabled":a||void 0,tabIndex:R?0:-1,onFocus(){p.set("activeIndex",L)},onMouseEnter(){!w.current&&p.state.selectedIndex===null&&p.set("activeIndex",L)},onMouseMove(){E&&p.set("activeIndex",L)},onMouseLeave(re){!E||w.current||vW(re)||T.start(0,()=>{p.state.activeIndex===L&&p.set("activeIndex",null)})},onTouchStart(){m.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(re){F.current=re.key,p.set("activeIndex",L)},onClick(re){B.current=!1,!(re.type==="keydown"&&F.current===null)&&(a||F.current===" "&&x.current||W.current!=="touch"&&!R||(F.current=null,U(re.nativeEvent)))},onPointerEnter(re){W.current=re.pointerType},onPointerDown(re){W.current=re.pointerType,B.current=!0},onMouseUp(re){if(a)return;if(B.current){B.current=!1;return}const X=!m.current.allowSelectedMouseUp&&A,q=!m.current.allowUnselectedMouseUp&&!A;X||q||W.current!=="touch"&&!R||U(re.nativeEvent)}},Q=dt("div",t,{ref:[N,r,d.ref,D],state:H,props:[$,Y,u,G]}),J=k.useMemo(()=>({selected:A,indexRef:V,textRef:h,selectedByFocus:j,hasRegistered:z}),[A,V,h,j,z]);return y.jsx(yW.Provider,{value:J,children:Q})})),sde=k.forwardRef(function(t,r){const n=t.keepMounted??!1,{selected:i}=Tj();return n||i?y.jsx(ode,{...t,ref:r}):null}),ode=k.memo(k.forwardRef((e,t)=>{const{render:r,className:n,keepMounted:i,...s}=e,{selected:o}=Tj(),a=k.useRef(null),{transitionStatus:l,setMounted:u}=$o(o),h=k.useMemo(()=>({selected:o,transitionStatus:l}),[o,l]),d=dt("span",e,{ref:[t,a],state:h,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:ho});return gi({open:o,ref:a,onComplete(){o||u(!1)}}),d})),ade=k.memo(k.forwardRef(function(t,r){const{indexRef:n,textRef:i,selectedByFocus:s,hasRegistered:o}=Tj(),{selectedItemTextRef:a}=Aa(),{className:l,render:u,...h}=t,d=k.useCallback(v=>{if(!v||!o)return;const S=a.current===null||!a.current.isConnected;(s||S&&n.current===0)&&(a.current=v)},[a,n,s,o]);return dt("div",t,{ref:[d,r,i],props:h})})),bW=k.forwardRef(function(t,r){const{render:n,className:i,direction:s,keepMounted:o=!1,...a}=t,{store:l,popupRef:u,listRef:h,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:p}=Aa(),{side:v,scrollDownArrowRef:S,scrollUpArrowRef:_}=Ej(),m=s==="up"?Ct.scrollUpArrowVisible:Ct.scrollDownArrowVisible,x=Ie(l,m),b=Ie(l,Ct.openMethod),w=x&&b!=="touch",O=Sr(),E=s==="up"?_:S,{transitionStatus:T,setMounted:R}=$o(w);He(()=>(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]),gi({open:w,ref:E,onComplete(){w||R(!1)}});const A=k.useMemo(()=>({direction:s,visible:w,side:v,transitionStatus:T}),[s,w,v,T]),I=dt("div",t,{ref:[r,E],state:A,props:[{"aria-hidden":!0,children:s==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(z){if(z.movementX===0&&z.movementY===0||O.isStarted())return;l.set("activeIndex",null);function D(){const V=l.state.listElement??u.current;if(!V)return;l.set("activeIndex",null),d();const H=V.scrollTop===0,$=Math.round(V.scrollTop+V.clientHeight)>=V.scrollHeight;if(h.current.length===0&&(s==="up"?l.set("scrollUpArrowVisible",!H):l.set("scrollDownArrowVisible",!$)),s==="up"&&H||s==="down"&&$){O.clear();return}if((l.state.listElement||u.current)&&h.current&&h.current.length>0){const W=h.current,B=E.current?.offsetHeight||0;if(s==="up"){let G=0;const N=V.scrollTop+B;for(let Y=0;Y<W.length;Y+=1){const Q=W[Y];if(Q&&Q.offsetTop>=N){G=Y;break}}const U=Math.max(0,G-1);if(U<G){const Y=W[U];Y&&(V.scrollTop=Math.max(0,Y.offsetTop-B))}else V.scrollTop=0}else{let G=W.length-1;const N=V.scrollTop+V.clientHeight-B;for(let Y=0;Y<W.length;Y+=1){const Q=W[Y];if(Q&&Q.offsetTop+Q.offsetHeight>N){G=Math.max(0,Y-1);break}}const U=Math.min(W.length-1,G+1);if(U>G){const Y=W[U];Y&&(V.scrollTop=Y.offsetTop+Y.offsetHeight-V.clientHeight+B)}else V.scrollTop=V.scrollHeight-V.clientHeight}}O.start(40,D)}O.start(40,D)},onMouseLeave(){O.clear()}},a]});return w||o?I:null}),lde=k.forwardRef(function(t,r){return y.jsx(bW,{...t,ref:r,direction:"down"})}),cde=k.forwardRef(function(t,r){return y.jsx(bW,{...t,ref:r,direction:"up"})}),Ai=Vue;function Ri({className:e,...t}){return y.jsx(Kue,{"data-slot":"select-value",className:Me("flex flex-1 text-left",e),...t})}function Pi({className:e,size:t="default",children:r,...n}){return y.jsxs(que,{"data-slot":"select-trigger","data-size":t,className:Me("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),...n,children:[r,y.jsx(Yue,{render:y.jsx(pe,{icon:WV,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})})]})}function ji({className:e,children:t,side:r="bottom",sideOffset:n=4,align:i="center",alignOffset:s=0,alignItemWithTrigger:o=!0,...a}){return y.jsx(Que,{children:y.jsx(Jue,{side:r,sideOffset:n,align:i,alignOffset:s,alignItemWithTrigger:o,className:"isolate z-50",children:y.jsxs(rde,{"data-slot":"select-content",className:Me("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),...a,children:[y.jsx(ude,{}),y.jsx(nde,{children:t}),y.jsx(dde,{})]})})})}function pr({className:e,children:t,...r}){return y.jsxs(ide,{"data-slot":"select-item",className:Me("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),...r,children:[y.jsx(ade,{className:"flex flex-1 gap-2 shrink-0 whitespace-nowrap",children:t}),y.jsx(sde,{render:y.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:y.jsx(pe,{icon:Rl,strokeWidth:2,className:"pointer-events-none"})})]})}function ude({className:e,...t}){return y.jsx(cde,{"data-slot":"select-scroll-up-button",className:Me("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(pe,{icon:gj,strokeWidth:2})})}function dde({className:e,...t}){return y.jsx(lde,{"data-slot":"select-scroll-down-button",className:Me("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(pe,{icon:Dv,strokeWidth:2})})}const _W=k.createContext(void 0);function kj(){const e=k.useContext(_W);if(e===void 0)throw new Error(er(64));return e}let fde=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const Aj={tabActivationDirection:e=>({[fde.activationDirection]:e})},hde=k.forwardRef(function(t,r){const{className:n,defaultValue:i=0,onValueChange:s,orientation:o="horizontal",render:a,value:l,...u}=t,h=ou(),d=Object.hasOwn(t,"defaultValue"),p=k.useRef([]),[v,S]=k.useState(()=>new Map),[_,m]=Os({controlled:l,default:i,name:"Tabs",state:"value"}),x=l!==void 0,[b,w]=k.useState(()=>new Map),[O,E]=k.useState("none"),T=Be((F,W)=>{s?.(F,W),!W.isCanceled&&(m(F),E(W.activationDirection))}),R=Be((F,W)=>{S(B=>{if(B.get(F)===W)return B;const G=new Map(B);return G.set(F,W),G})}),A=Be((F,W)=>{S(B=>{if(!B.has(F)||B.get(F)!==W)return B;const G=new Map(B);return G.delete(F),G})}),j=k.useCallback(F=>v.get(F),[v]),I=k.useCallback(F=>{for(const W of b.values())if(F===W?.value)return W?.id},[b]),L=k.useCallback(F=>{if(F===void 0)return null;for(const[W,B]of b.entries())if(B!=null&&F===(B.value??B.index))return W;return null},[b]),z=k.useMemo(()=>({direction:h,getTabElementBySelectedValue:L,getTabIdByPanelValue:I,getTabPanelIdByValue:j,onValueChange:T,orientation:o,registerMountedTabPanel:R,setTabMap:w,unregisterMountedTabPanel:A,tabActivationDirection:O,value:_}),[h,L,I,j,T,o,R,w,A,O,_]),D=k.useMemo(()=>{for(const F of b.values())if(F!=null&&F.value===_)return F},[b,_]),V=k.useMemo(()=>{for(const F of b.values())if(F!=null&&!F.disabled)return F.value},[b]);He(()=>{if(x||b.size===0)return;const F=D?.disabled,W=D==null&&_!==null;if(d&&F&&_===i||!F&&!W)return;const G=V??null;_!==G&&(m(G),E("none"))},[i,V,d,x,D,E,m,b,_]);const $=dt("div",t,{state:{orientation:o,tabActivationDirection:O},ref:r,props:u,stateAttributesMapping:Aj});return y.jsx(_W.Provider,{value:z,children:y.jsx(jv,{elementsRef:p,children:$})})}),xW=k.createContext(void 0);function pde(){const e=k.useContext(xW);if(e===void 0)throw new Error(er(65));return e}const mde=k.forwardRef(function(t,r){const{className:n,disabled:i=!1,render:s,value:o,id:a,nativeButton:l=!0,...u}=t,{value:h,getTabPanelIdByValue:d,orientation:p}=kj(),{activateOnFocus:v,highlightedTabIndex:S,onTabActivation:_,setHighlightedTabIndex:m,tabsListElement:x}=pde(),b=ni(a),w=k.useMemo(()=>({disabled:i,id:b,value:o}),[i,b,o]),{compositeProps:O,compositeRef:E,index:T}=jV({metadata:w}),R=o===h,A=k.useRef(!1);He(()=>{if(A.current){A.current=!1;return}if(!(R&&T>-1&&S!==T))return;const B=x;if(B!=null){const G=Zs(ri(B));if(G&&ut(B,G))return}i||m(T)},[R,T,S,m,i,x]);const{getButtonProps:j,buttonRef:I}=Di({disabled:i,native:l,focusableWhenDisabled:!0}),L=d(o),z=k.useRef(!1),D=k.useRef(!1);function V(B){R||i||_(o,Ue(Pn,B.nativeEvent,void 0,{activationDirection:"none"}))}function H(B){R||(T>-1&&!i&&m(T),!i&&v&&(!z.current||z.current&&D.current)&&_(o,Ue(Pn,B.nativeEvent,void 0,{activationDirection:"none"})))}function $(B){if(R||i)return;z.current=!0;function G(){z.current=!1,D.current=!1}(!B.button||B.button===0)&&(D.current=!0,ri(B.currentTarget).addEventListener("pointerup",G,{once:!0}))}const F=k.useMemo(()=>({disabled:i,active:R,orientation:p}),[i,R,p]);return dt("button",t,{state:F,ref:[r,I,E],props:[O,{role:"tab","aria-controls":L,"aria-selected":R,id:b,onClick:V,onFocus:H,onPointerDown:$,[TV]:R?"":void 0,onKeyDownCapture(){A.current=!0}},u,j]})});let gde=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const vde=k.forwardRef(function(t,r){const{className:n,value:i,render:s,keepMounted:o=!1,...a}=t,{value:l,getTabIdByPanelValue:u,orientation:h,tabActivationDirection:d,registerMountedTabPanel:p,unregisterMountedTabPanel:v}=kj(),S=ni(),_=k.useMemo(()=>({id:S,value:i}),[S,i]),{ref:m,index:x}=hp({metadata:_}),b=i!==l,w=u(i),O=k.useMemo(()=>({hidden:b,orientation:h,tabActivationDirection:d}),[b,h,d]),E=dt("div",t,{state:O,ref:[r,m],props:[{"aria-labelledby":w,hidden:b,id:S??void 0,role:"tabpanel",tabIndex:b?-1:0,[gde.index]:x},a],stateAttributesMapping:Aj});return He(()=>{if(!(b&&!o)&&S!=null)return p(i,S),()=>{v(i,S)}},[b,o,i,S,p,v]),!b||o?E:null}),yde=k.forwardRef(function(t,r){const{activateOnFocus:n=!1,className:i,loopFocus:s=!0,render:o,...a}=t,{getTabElementBySelectedValue:l,onValueChange:u,orientation:h,value:d,setTabMap:p,tabActivationDirection:v}=kj(),[S,_]=k.useState(0),[m,x]=k.useState(null),b=bde(d,h,m,l),w=Be((R,A)=>{if(R!==d){const j=b(R);A.activationDirection=j,u(R,A)}}),O=k.useMemo(()=>({orientation:h,tabActivationDirection:v}),[h,v]),E={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},T=k.useMemo(()=>({activateOnFocus:n,highlightedTabIndex:S,onTabActivation:w,setHighlightedTabIndex:_,tabsListElement:m,value:d}),[n,S,w,_,m,d]);return y.jsx(xW.Provider,{value:T,children:y.jsx(rx,{render:o,className:i,state:O,refs:[r,x],props:[E,a],stateAttributesMapping:Aj,highlightedIndex:S,enableHomeAndEndKeys:!0,loopFocus:s,orientation:h,onHighlightedIndexChange:_,onMapChange:p,disabledIndices:ki})})});function i4(e,t){const{left:r,top:n}=e.getBoundingClientRect(),{left:i,top:s}=t.getBoundingClientRect(),o=r-i,a=n-s;return{left:o,top:a}}function bde(e,t,r,n){const[i,s]=k.useState(null);return He(()=>{if(e==null||r==null){s(null);return}const o=n(e);if(o==null){s(null);return}const{left:a,top:l}=i4(o,r);s(t==="horizontal"?a:l)},[t,n,r,e]),k.useCallback(o=>{if(o===e)return"none";if(o==null)return s(null),"none";if(o!=null&&r!=null){const a=n(o);if(a!=null){const{left:l,top:u}=i4(a,r);if(i==null)return s(t==="horizontal"?l:u),"none";if(t==="horizontal"){if(l<i)return s(l),"left";if(l>i)return s(l),"right"}else{if(u<i)return s(u),"up";if(u>i)return s(u),"down"}}}return"none"},[n,t,i,r,e])}function Nc({className:e,orientation:t="horizontal",...r}){return y.jsx(hde,{"data-slot":"tabs","data-orientation":t,className:Me("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",e),...r})}const _de=nu("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 Bc({className:e,variant:t="default",...r}){return y.jsx(yde,{"data-slot":"tabs-list","data-variant":t,className:Me(_de({variant:t}),e),...r})}function ui({className:e,...t}){return y.jsx(mde,{"data-slot":"tabs-trigger",className:Me("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 qi({className:e,...t}){return y.jsx(vde,{"data-slot":"tabs-content",className:Me("text-xs/relaxed flex-1 min-h-0 outline-none",e),...t})}function xde(e){const{children:t,open:r,defaultOpen:n=!1,onOpenChange:i,onOpenChangeComplete:s,actionsRef:o,handle:a,triggerId:l,defaultTriggerId:u=null}=e,h=Pl(),d=!!h,p=ti(()=>a?.store??new tW({open:r??n,activeTriggerId:l!==void 0?l:u,modal:!0,disablePointerDismissal:!0,nested:d,role:"alertdialog"})).current;p.useControlledProp("open",r,n),p.useControlledProp("activeTriggerId",l,u),p.useSyncedValue("nested",d),p.useContextCallback("onOpenChange",i),p.useContextCallback("onOpenChangeComplete",s);const v=p.useState("payload");eW({store:p,actionsRef:o,parentContext:h?.store.context});const S=k.useMemo(()=>({store:p}),[p]);return y.jsx(Sj.Provider,{value:S,children:typeof t=="function"?t({payload:v}):t})}const SW=k.createContext(void 0),wW=k.createContext(void 0),CW=k.createContext(void 0),EW=k.createContext("");function Ll(){const e=k.useContext(SW);if(!e)throw new Error(er(22));return e}function px(){const e=k.useContext(wW);if(!e)throw new Error(er(23));return e}function Hd(){const e=k.useContext(CW);if(!e)throw new Error(er(24));return e}function Rj(){return k.useContext(EW)}const Xe={id:ke(e=>e.id),query:ke(e=>e.query),items:ke(e=>e.items),selectedValue:ke(e=>e.selectedValue),open:ke(e=>e.open),mounted:ke(e=>e.mounted),forceMounted:ke(e=>e.forceMounted),inline:ke(e=>e.inline),activeIndex:ke(e=>e.activeIndex),selectedIndex:ke(e=>e.selectedIndex),isActive:ke((e,t)=>e.activeIndex===t),isSelected:ke((e,t)=>{const r=e.isItemEqualToValue,n=e.selectedValue;return Array.isArray(n)?n.some(i=>wl(i,t,r)):wl(n,t,r)}),transitionStatus:ke(e=>e.transitionStatus),popupProps:ke(e=>e.popupProps),inputProps:ke(e=>e.inputProps),triggerProps:ke(e=>e.triggerProps),getItemProps:ke(e=>e.getItemProps),positionerElement:ke(e=>e.positionerElement),listElement:ke(e=>e.listElement),triggerElement:ke(e=>e.triggerElement),inputElement:ke(e=>e.inputElement),popupSide:ke(e=>e.popupSide),openMethod:ke(e=>e.openMethod),inputInsidePopup:ke(e=>e.inputInsidePopup),selectionMode:ke(e=>e.selectionMode),listRef:ke(e=>e.listRef),labelsRef:ke(e=>e.labelsRef),popupRef:ke(e=>e.popupRef),emptyRef:ke(e=>e.emptyRef),inputRef:ke(e=>e.inputRef),keyboardActiveRef:ke(e=>e.keyboardActiveRef),chipsContainerRef:ke(e=>e.chipsContainerRef),clearRef:ke(e=>e.clearRef),valuesRef:ke(e=>e.valuesRef),allValuesRef:ke(e=>e.allValuesRef),name:ke(e=>e.name),disabled:ke(e=>e.disabled),readOnly:ke(e=>e.readOnly),required:ke(e=>e.required),grid:ke(e=>e.grid),isGrouped:ke(e=>e.isGrouped),virtualized:ke(e=>e.virtualized),onOpenChangeComplete:ke(e=>e.onOpenChangeComplete),openOnInputClick:ke(e=>e.openOnInputClick),itemToStringLabel:ke(e=>e.itemToStringLabel),isItemEqualToValue:ke(e=>e.isItemEqualToValue),modal:ke(e=>e.modal),autoHighlight:ke(e=>e.autoHighlight),submitOnItemClick:ke(e=>e.submitOnItemClick)};function Sde(e,t){return(r,n)=>{if(r==null)return!1;const i=An(r,t);return e.contains(i,n)}}function wde(e,t,r){return(n,i)=>{if(n==null)return!1;if(!i)return!0;const s=An(n,t),o=r!=null?An(r,t):"";return o&&e.contains(o,i)&&o.length===i.length?!0:e.contains(s,i)}}const s4=new Map;function OW(e){return Array.isArray(e)?e.map(t=>OW(t)).join(","):e==null?"":String(e)}function Cde(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},r=`${OW(e.locale)}|${JSON.stringify(t)}`,n=s4.get(r);if(n)return n;const i=new Intl.Collator(e.locale,t),s={contains(o,a,l){if(!a)return!0;const u=An(o,l);for(let h=0;h<=u.length-a.length;h+=1)if(i.compare(u.slice(h,h+a.length),a)===0)return!0;return!1},startsWith(o,a,l){if(!a)return!0;const u=An(o,l);return i.compare(u.slice(0,a.length),a)===0},endsWith(o,a,l){if(!a)return!0;const u=An(o,l),h=a.length;return u.length>=h&&i.compare(u.slice(u.length-h),a)===0}};return s4.set(r,s),s}const Ede=Cde,TW=Symbol("none"),Mu={value:TW,index:-1};function Ode(e){const{id:t,onOpenChangeComplete:r,defaultSelectedValue:n=null,selectedValue:i,onSelectedValueChange:s,defaultInputValue:o,inputValue:a,selectionMode:l="none",onItemHighlighted:u,name:h,disabled:d=!1,readOnly:p=!1,required:v=!1,inputRef:S,grid:_=!1,items:m,filteredItems:x,filter:b,openOnInputClick:w=!0,autoHighlight:O=!1,keepHighlight:E=!1,highlightItemOnHover:T=!0,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:j=fW,virtualized:I=!1,inline:L=!1,fillInputOnItemPress:z=!0,modal:D=!1,limit:V=-1,autoComplete:H="list",locale:$,submitOnItemClick:F=!1}=e,{clearErrors:W}=$v(),{setDirty:B,validityData:G,shouldValidateOnChange:N,setFilled:U,name:Y,disabled:Q,validation:J}=uo(),re=fx({id:t}),X=Ede({locale:$}),[q,Z]=k.useState(!1),[te,ne]=k.useState(null),ie=k.useRef([]),me=k.useRef([]),ye=k.useRef(null),ue=k.useRef(null),he=k.useRef(null),fe=k.useRef(!0),$e=k.useRef(!1),ve=k.useRef(null),De=k.useRef(null),_e=k.useRef(null),ae=k.useRef(Mu),ce=k.useRef(null),be=k.useRef([]),Ee=k.useRef([]),Ve=Q||d,st=Y??h,Re=l==="multiple",We=l==="single",Ge=a!==void 0||o!==void 0,vt=m!==void 0,Ke=x!==void 0;let Qe;O==="always"?Qe="always":Qe=O?"input-change":!1;const[Ae,ot]=Os({controlled:i,default:Re?n??ki:n,name:"Combobox",state:"selectedValue"}),ft=k.useMemo(()=>b===null?()=>!0:b!==void 0?b:We&&!q?wde(X,R,Ae):Sde(X,R),[b,We,Ae,q,X,R]),Je=ti(()=>Ge?o??"":We?An(Ae,R):"").current,[lt,Ht]=Os({controlled:a,default:Je,name:"Combobox",state:"inputValue"}),[pt,Pr]=Os({controlled:e.open,default:e.defaultOpen,name:"Combobox",state:"open"}),It=pW(m),kt=te??(lt===""?"":String(lt).trim()),tt=We?An(Ae,R):"",Gt=We&&!q&&kt!==""&&tt!==""&&tt.length===kt.length&&X.contains(tt,kt),rr=Gt?"":kt,mt=vt&&Ke&&Gt,Nt=k.useMemo(()=>m?It?m.flatMap(Ye=>Ye.items):m:ki,[m,It]),Rt=k.useMemo(()=>{if(x&&!mt)return x;if(!m)return ki;if(It){const ht=m,jt=[];let jr=0;for(const Qr of ht){if(V>-1&&jr>=V)break;const mn=rr===""?Qr.items:Qr.items.filter($a=>ft($a,rr,R));if(mn.length===0)continue;const Na=V>-1?V-jr:1/0,Ba=mn.slice(0,Na);if(Ba.length>0){const $a={...Qr,items:Ba};jt.push($a),jr+=Ba.length}}return jt}if(rr==="")return V>-1?Nt.slice(0,V):Nt;const Ye=[];for(const ht of Nt){if(V>-1&&Ye.length>=V)break;ft(ht,rr,R)&&Ye.push(ht)}return Ye},[x,mt,m,It,rr,V,ft,R,Nt]),Pt=k.useMemo(()=>It?Rt.flatMap(ht=>ht.items):Rt,[Rt,It]),rt=ti(()=>new dd({id:re,selectedValue:Ae,open:pt,filter:ft,query:kt,items:m,selectionMode:l,listRef:ie,labelsRef:me,popupRef:ye,emptyRef:he,inputRef:ue,keyboardActiveRef:fe,chipsContainerRef:ve,clearRef:De,valuesRef:be,allValuesRef:Ee,selectionEventRef:_e,name:st,disabled:Ve,readOnly:p,required:v,grid:_,isGrouped:It,virtualized:I,openOnInputClick:w,itemToStringLabel:R,isItemEqualToValue:j,modal:D,autoHighlight:Qe,submitOnItemClick:F,hasInputValue:Ge,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:L,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:r||Zr,setOpen:Zr,setInputValue:Zr,setSelectedValue:Zr,setIndices:Zr,onItemHighlighted:Zr,handleSelection:Zr,getItemProps:()=>Ur,forceMount:Zr,requestSubmit:Zr})).current,nr=l==="none"?lt:Ae,en=k.useMemo(()=>l==="none"?nr:Array.isArray(Ae)?Ae.map(Ye=>Eo(Ye,A)):Eo(Ae,A),[nr,A,l,Ae]),un=Be(u),pn=Be(r),yi=Ie(rt,Xe.activeIndex),Da=Ie(rt,Xe.selectedIndex),Vn=Ie(rt,Xe.positionerElement),Vr=Ie(rt,Xe.listElement),Xr=Ie(rt,Xe.triggerElement),Ni=Ie(rt,Xe.inputElement),ii=Ie(rt,Xe.inline),Ps=Ie(rt,Xe.inputInsidePopup),$l=Fr(Xr),{mounted:Ot,setMounted:Wo,transitionStatus:qo}=$o(pt),{openMethod:js,triggerProps:Ms,reset:Ia}=dx(pt);zv({id:re,name:st,commit:J.commit,value:nr,controlRef:Ps?$l:ue,getValue:()=>en});const as=Be(()=>{m?me.current=Pt.map(Ye=>An(Ye,R)):rt.set("forceMounted",!0)}),tn=k.useRef(Ae);He(()=>{Ae!==tn.current&&as()},[as,Ae]);const Wn=Be(Ye=>{rt.update(Ye);const ht=Ye.type||"none";if(Ye.activeIndex!==void 0)if(Ye.activeIndex===null)ae.current!==Mu&&(ae.current=Mu,un(void 0,Rm(ht,void 0,{index:-1})));else{const jt=be.current[Ye.activeIndex];ae.current={value:jt,index:Ye.activeIndex},un(jt,Rm(ht,void 0,{index:Ye.activeIndex}))}}),qn=Be((Ye,ht)=>{if($e.current=ht.reason===mc,e.onInputValueChange?.(Ye,ht),!ht.isCanceled){if(ht.reason===Yu){const jt=Ye.trim()!=="";jt&&Z(!0),ce.current={hasQuery:jt},jt&&Qe&&rt.state.activeIndex==null&&rt.set("activeIndex",0)}Ht(Ye)}}),bi=Be((Ye,ht)=>{pt!==Ye&&(ht.reason==="escape-key"&&vt&&Pt.length===0&&!rt.state.emptyRef.current&&ht.allowPropagation(),e.onOpenChange?.(Ye,ht),!ht.isCanceled&&(!Ye&&q&&(We?(ne(kt),kt===""&&Z(!1)):Re&&(ii||Ps?Wn({activeIndex:null}):ne(kt),qn("",Ue(mc,ht.event)))),Pr(Ye)))}),ls=Be((Ye,ht)=>{if(s?.(Ye,ht),ht.isCanceled)return;ot(Ye),(l==="none"&&ye.current&&z||We&&!rt.state.inputInsidePopup)&&qn(An(Ye,R),Ue(ht.reason,ht.event)),We&&Ye!=null&&ht.reason!==Yu&&q&&ne(kt)}),Pp=Be((Ye,ht)=>{let jt=ht;if(jt===void 0){if(yi===null)return;jt=be.current[yi]}const jr=an(Ye),Qr=_e.current??Ye;_e.current=null;const mn=Ue(ud,Qr),Na=jr?.closest("a")?.getAttribute("href");if(Na){Na.startsWith("#")&&bi(!1,mn);return}if(Re){const Ba=Array.isArray(Ae)?Ae:[],vo=Zu(Ba,jt,rt.state.isItemEqualToValue)?hW(Ba,jt,rt.state.isItemEqualToValue):[...Ba,jt];if(ls(vo,mn),!(ue.current?ue.current.value.trim()!=="":!1))return;rt.state.inputInsidePopup?qn("",Ue(mc,mn.event)):bi(!1,mn)}else ls(jt,mn),bi(!1,mn)}),zl=Be(()=>{if(!rt.state.submitOnItemClick)return;const Ye=rt.state.inputElement?.form;Ye&&typeof Ye.requestSubmit=="function"&&Ye.requestSubmit()}),Hl=Be(()=>{if(Wo(!1),pn?.(!1),Z(!1),Ia(),ne(null),Wn(l==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Re&&ue.current&&ue.current.value!==""&&!$e.current&&qn("",Ue(mc)),We)if(rt.state.inputInsidePopup)ue.current&&ue.current.value!==""&&qn("",Ue(mc));else{const Ye=An(Ae,R);ue.current&&ue.current.value!==Ye&&qn(Ye,Ue(Ye===""?mc:Pn))}}),jp=k.useMemo(()=>ii&&Vn?{current:Vn.closest('[role="dialog"]')}:ye,[ii,Vn]);gi({enabled:!e.actionsRef,open:pt,ref:jp,onComplete(){pt||Hl()}}),k.useImperativeHandle(e.actionsRef,()=>({unmount:Hl}),[Hl]),He(function(){if(pt||l==="none")return;const ht=m?Nt:Ee.current;if(Re){const jt=Array.isArray(Ae)?Ae:[],jr=jt[jt.length-1],Qr=_h(ht,jr,j);Wn({selectedIndex:Qr===-1?null:Qr})}else{const jt=_h(ht,Ae,j);Wn({selectedIndex:jt===-1?null:jt})}},[pt,Ae,m,l,Nt,Re,j,Wn]),He(()=>{m&&(be.current=Pt,ie.current.length=Pt.length)},[m,Pt]),He(()=>{const Ye=ce.current;if(Ye&&(Ye.hasQuery?Qe&&rt.set("activeIndex",0):Qe==="always"&&rt.set("activeIndex",0),ce.current=null),!pt&&!ii)return;const jt=vt||Ke?Pt:be.current,jr=rt.state.activeIndex;if(jr==null){if(Qe==="always"&&jt.length>0){rt.set("activeIndex",0);return}ae.current!==Mu&&(ae.current=Mu,rt.state.onItemHighlighted(void 0,Rm(Pn,void 0,{index:-1})));return}if(jr>=jt.length){ae.current!==Mu&&(ae.current=Mu,rt.state.onItemHighlighted(void 0,Rm(Pn,void 0,{index:-1}))),rt.set("activeIndex",null);return}const Qr=jt[jr],mn=ae.current.value,Na=mn!==TW&&rt.state.isItemEqualToValue(Qr,mn);(ae.current.index!==jr||!Na)&&(ae.current={value:Qr,index:jr},rt.state.onItemHighlighted(Qr,Rm(Pn,void 0,{index:jr})))},[yi,Qe,Ke,vt,Pt,ii,pt,rt]),He(()=>{if(!m||l==="none")return;const Ye=Nt;if(Re){const jr=Array.isArray(Ae)?Ae:ki,Qr=jr.filter(mn=>Zu(Ye,mn,rt.state.isItemEqualToValue));Qr.length!==jr.length&&ot(Qr);return}if(Ae==null?!0:Zu(Ye,Ae,rt.state.isItemEqualToValue))return;let jt=null;if(n!=null&&Zu(Ye,n,rt.state.isItemEqualToValue)&&(jt=n),ot(jt),!rt.state.inputInsidePopup){const jr=An(jt,R);ue.current&&ue.current.value!==jr&&qn(jr,Ue(Pn))}},[m,Nt,Re,l,Ae,n,ot,R,rt,qn]),He(()=>{if(l==="none"){U(String(lt)!=="");return}U(Re?Array.isArray(Ae)&&Ae.length>0:Ae!=null)},[U,l,lt,Ae,Re]),k.useEffect(()=>{vt&&Qe&&Pt.length===0&&Wn({activeIndex:null})},[vt,Qe,Pt.length,Wn]),Ju(kt,()=>{!pt||kt===""||kt===String(Je)||Z(!0)}),Ju(Ae,()=>{if(l!=="none"&&(W(st),B(Ae!==G.initialValue),N()?J.commit(Ae):J.commit(Ae,!0),Re&&rt.state.selectedIndex!==null&&(!Array.isArray(Ae)||Ae.length===0)&&Wn({activeIndex:null,selectedIndex:null}),We&&!Ge&&!Ps)){const Ye=An(Ae,R);lt!==Ye&&qn(Ye,Ue(Pn))}}),Ju(lt,()=>{l==="none"&&(W(st),B(lt!==G.initialValue),N()?J.commit(lt):J.commit(lt,!0))}),Ju(m,()=>{if(!We||Ge||Ps||q)return;const Ye=An(Ae,R);lt!==Ye&&qn(Ye,Ue(Pn))});const go=J1({open:ii?!0:pt,onOpenChange:bi,elements:{reference:Ps?Xr:Ni,floating:Vn}});let cs,_i;ii||(cs=_?"grid":"listbox",_i=pt?"true":"false");const si=k.useMemo(()=>{const Ye=Ni?.tagName==="INPUT",ht=Ye||pt,jt=Ye?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return ht&&(jt.role="combobox",jt["aria-expanded"]=_i,jt["aria-haspopup"]=cs,jt["aria-controls"]=pt?Vr?.id:void 0,jt["aria-autocomplete"]=H),{reference:jt,floating:{role:"presentation"}}},[Ni,pt,_i,cs,Vr?.id,H]),je=dp(go,{enabled:!p&&!Ve&&w,event:"mousedown-only",toggle:!1,touchOpenDelay:Ps?0:50}),St=Pv(go,{enabled:!p&&!Ve&&!ii,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:ii?!0:void 0,outsidePress(Ye){const ht=an(Ye);return!ut(Xr,ht)&&!ut(De.current,ht)&&!ut(ve.current,ht)}}),oi=cj(go,{enabled:!p&&!Ve,id:re,listRef:ie,activeIndex:yi,selectedIndex:Da,virtual:!0,loopFocus:!0,allowEscape:!Qe,focusItemOnOpen:q||l==="none"&&!Qe?!1:"auto",focusItemOnHover:T,resetOnPointerLeave:!E,cols:_?2:1,orientation:_?"horizontal":void 0,disabledIndices:ki,onNavigate(Ye,ht){!ht&&!pt||qo==="ending"||Wn(ht?{activeIndex:Ye,type:fe.current?"keyboard":"pointer"}:{activeIndex:Ye})}}),{getReferenceProps:Ls,getFloatingProps:xi,getItemProps:ef}=Nd([si,je,St,oi]);lW(()=>{rt.update({inline:L,popupProps:xi(),inputProps:Ls(),triggerProps:Ms,getItemProps:ef,setOpen:bi,setInputValue:qn,setSelectedValue:ls,setIndices:Wn,onItemHighlighted:un,handleSelection:Pp,forceMount:as,requestSubmit:zl})}),He(()=>{rt.update({id:re,selectedValue:Ae,open:pt,mounted:Ot,transitionStatus:qo,items:m,inline:L,popupProps:xi(),inputProps:Ls(),triggerProps:Ms,openMethod:js,getItemProps:ef,selectionMode:l,name:st,disabled:Ve,readOnly:p,required:v,grid:_,isGrouped:It,virtualized:I,onOpenChangeComplete:pn,openOnInputClick:w,itemToStringLabel:R,modal:D,autoHighlight:Qe,isItemEqualToValue:j,submitOnItemClick:F,hasInputValue:Ge,requestSubmit:zl})},[rt,re,Ae,pt,Ot,qo,m,xi,Ls,ef,js,Ms,l,st,Ve,p,v,J,_,It,I,pn,w,R,D,j,F,Ge,L,zl,Qe]);const Bi=co(S,J.inputRef),Mp=k.useMemo(()=>({query:kt,filteredItems:Rt,flatFilteredItems:Pt}),[kt,Rt,Pt]),dy=k.useMemo(()=>Array.isArray(nr)?"":Eo(nr,A),[nr,A]),Lp=Re&&Array.isArray(Ae)&&Ae.length>0,Fl=k.useMemo(()=>!Re||!Array.isArray(Ae)||!st?null:Ae.map(Ye=>{const ht=Eo(Ye,A);return y.jsx("input",{type:"hidden",name:st,value:ht},ht)}),[Re,Ae,st,A]),fy=y.jsxs(k.Fragment,{children:[e.children,y.jsx("input",{...J.getInputValidationProps({onFocus(){if(Ps){Xr?.focus();return}(ue.current||Xr)?.focus()},onChange(Ye){if(Ye.nativeEvent.defaultPrevented)return;const ht=Ye.target.value,jt=Ue(Yu,Ye.nativeEvent);function jr(){if(Re)return;if(l==="none"){B(ht!==G.initialValue),qn(ht,jt),N()&&J.commit(ht);return}const Qr=be.current.find(mn=>Eo(mn,A).toLowerCase()===ht.toLowerCase());Qr!=null&&(B(Qr!==G.initialValue),ls?.(Qr,jt),N()&&J.commit(Qr))}m?jr():(as(),queueMicrotask(jr))}}),id:re,name:Re||l==="none"?void 0:st,disabled:Ve,required:v&&!Lp,readOnly:p,value:dy,ref:Bi,style:up,tabIndex:-1,"aria-hidden":!0}),Fl]});return y.jsx(SW.Provider,{value:rt,children:y.jsx(wW.Provider,{value:go,children:y.jsx(CW.Provider,{value:Mp,children:y.jsx(EW.Provider,{value:lt,children:fy})})})})}const Wb=2,Tde={...yh,...zd},kde=k.forwardRef(function(t,r){const{render:n,className:i,nativeButton:s=!0,disabled:o=!1,...a}=t,{state:l,disabled:u,setTouched:h,setFocused:d,validationMode:p,validation:v}=uo(),{labelId:S}=au(),_=Ll(),m=Ie(_,Xe.selectionMode),x=Ie(_,Xe.disabled),b=Ie(_,Xe.readOnly),w=Ie(_,Xe.listElement),O=Ie(_,Xe.triggerProps),E=Ie(_,Xe.triggerElement),T=Ie(_,Xe.inputInsidePopup),R=Ie(_,Xe.open),A=Ie(_,Xe.selectedValue),j=Ie(_,Xe.activeIndex),I=Ie(_,Xe.selectedIndex),L=px(),z=Rj(),D=Sr(),V=u||x||o,H=k.useRef("");function $(J){H.current=J.pointerType}const F=L.select("domReferenceElement");k.useEffect(()=>{T&&E&&E!==F&&L.set("domReferenceElement",E)},[E,F,L,T]);const{reference:W}=uj(L,{enabled:!R&&!b&&!x&&m==="single",listRef:_.state.labelsRef,activeIndex:j,selectedIndex:I,onMatch(J){const re=_.state.valuesRef.current[J];re!==void 0&&_.state.setSelectedValue(re,Ue("none"))}}),{reference:B}=dp(L,{enabled:!b&&!x,event:"mousedown"}),{buttonRef:G,getButtonProps:N}=Di({native:s,disabled:V}),U=k.useMemo(()=>({...l,open:R,disabled:V}),[l,R,V]),Y=Be(J=>{_.set("triggerElement",J)});return dt("button",t,{ref:[r,G,Y],state:U,props:[O,B,W,{tabIndex:T?0:-1,disabled:V,role:T?"combobox":void 0,"aria-expanded":R?"true":"false","aria-haspopup":T?"dialog":"listbox","aria-controls":R?w?.id:void 0,"aria-readonly":b||void 0,"aria-labelledby":S,onPointerDown:$,onPointerEnter:$,onFocus(){d(!0),!(V||b)&&D.start(0,_.state.forceMount)},onBlur(){if(h(!0),d(!1),p==="onBlur"){const J=m==="none"?z:A;v.commit(J)}},onMouseDown(J){if(V||b||(T||L.set("domReferenceElement",J.currentTarget),_.state.forceMount(),H.current!=="touch"&&(_.state.inputRef.current?.focus(),T||J.preventDefault()),R))return;const re=ri(J.currentTarget);function X(q){if(!E)return;const Z=an(q),te=_.state.positionerElement,ne=_.state.listElement;if(ut(E,Z)||ut(te,Z)||ut(ne,Z)||Z===E)return;const ie=Cj(E),me=q.clientX>=ie.left-Wb&&q.clientX<=ie.right+Wb,ye=q.clientY>=ie.top-Wb&&q.clientY<=ie.bottom+Wb;me&&ye||_.state.setOpen(!1,Ue("cancel-open",q))}T&&re.addEventListener("mouseup",X,{once:!0})},onKeyDown(J){V||b||(J.key==="ArrowDown"||J.key==="ArrowUp")&&(on(J),_.state.setOpen(!0,Ue(eh,J.nativeEvent)),_.state.inputRef.current?.focus())}},v?v.getValidationProps(a):a,N],stateAttributesMapping:Tde})}),Ade=k.createContext(void 0);function Rde(){return k.useContext(Ade)}const kW=k.createContext(void 0);function Pj(e){const t=k.useContext(kW);if(t===void 0&&!e)throw new Error(er(21));return t}const Pde={...yh,...zd,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},jde=k.forwardRef(function(t,r){const{render:n,className:i,disabled:s=!1,id:o,...a}=t,{state:l,disabled:u,setTouched:h,setFocused:d,validationMode:p,validation:v}=uo(),{labelId:S}=au(),_=Rde(),x=!!Pj(!0),b=Ll(),{filteredItems:w}=Hd(),O=Rj(),E=ni(o),T=ou(),R=Ie(b,Xe.disabled),A=Ie(b,Xe.readOnly),j=Ie(b,Xe.name),I=Ie(b,Xe.selectionMode),L=Ie(b,Xe.autoHighlight),z=Ie(b,Xe.inputProps),D=Ie(b,Xe.triggerProps),V=Ie(b,Xe.open),H=Ie(b,Xe.mounted),$=Ie(b,Xe.selectedValue),F=Ie(b,Xe.popupSide),W=Ie(b,Xe.positionerElement),B=!!L,G=H&&W?F:null,N=u||R||s,U=w.length===0,[Y,Q]=k.useState(null),J=k.useRef(!1),re=Be(te=>{const ne=x||b.state.inline;ne&&!b.state.hasInputValue&&b.state.setInputValue("",Ue(Pn)),b.update({inputElement:te,inputInsidePopup:ne})}),X=k.useMemo(()=>({...l,open:V,disabled:N,readOnly:A,popupSide:G,listEmpty:U}),[l,V,N,A,G,U]);function q(te){if(!_)return;let ne;const{highlightedChipIndex:ie}=_;if(ie!==void 0){if(te.key==="ArrowLeft")te.preventDefault(),ie>0?ne=ie-1:ne=void 0;else if(te.key==="ArrowRight")te.preventDefault(),ie<$.length-1?ne=ie+1:ne=void 0;else if(te.key==="Backspace"||te.key==="Delete"){te.preventDefault();const me=ie>=$.length-1?$.length-2:ie;ne=me>=0?me:void 0,b.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return ne}return te.key==="ArrowLeft"&&(te.currentTarget.selectionStart??0)===0&&$.length>0?(te.preventDefault(),ne=Math.max($.length-1,0)):te.key==="Backspace"&&te.currentTarget.value===""&&$.length>0&&(b.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),te.preventDefault()),ne}return dt("input",t,{state:X,ref:[r,b.state.inputRef,re],props:[z,D,{type:"text",value:t.value??Y??O,"aria-readonly":A||void 0,"aria-labelledby":S,disabled:N,readOnly:A,...I==="none"&&j&&{name:j},id:E,onFocus(){d(!0)},onBlur(){if(h(!0),d(!1),p==="onBlur"){const te=I==="none"?O:$;v.commit(te)}},onCompositionStart(te){K0||(J.current=!0,Q(te.currentTarget.value))},onCompositionEnd(te){J.current=!1;const ne=te.currentTarget.value;Q(null),b.state.setInputValue(ne,Ue(Yu,te.nativeEvent))},onChange(te){if(J.current){const ye=te.currentTarget.value;Q(ye),ye===""&&!b.state.openOnInputClick&&!b.state.inputInsidePopup&&b.state.setOpen(!1,Ue(mc,te.nativeEvent));const ue=ye.trim(),he=B&&ue!=="";!A&&!N&&ue!==""&&(b.state.setOpen(!0,Ue(Yu,te.nativeEvent)),B||b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&b.state.activeIndex!==null&&!he&&b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"});return}b.state.setInputValue(te.currentTarget.value,Ue(Yu,te.nativeEvent));const ne=te.currentTarget.value==="",ie=Ue(mc,te.nativeEvent);ne&&!b.state.inputInsidePopup&&(I==="single"&&b.state.setSelectedValue(null,ie),b.state.openOnInputClick||b.state.setOpen(!1,ie));const me=te.currentTarget.value.trim();!A&&!N&&me!==""&&(b.state.setOpen(!0,Ue(Yu,te.nativeEvent)),B||b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&b.state.activeIndex!==null&&!B&&b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(te){if(N||A||te.ctrlKey||te.shiftKey||te.altKey||te.metaKey)return;b.state.keyboardActiveRef.current=!0;const ne=te.currentTarget,ie=ne.scrollWidth-ne.clientWidth,me=T==="rtl";if(te.key==="Home"){on(te);const ue=g3&&me?ne.value.length:0;ne.setSelectionRange(ue,ue),ne.scrollLeft=0;return}if(te.key==="End"){on(te);const ue=g3&&me?0:ne.value.length;ne.setSelectionRange(ue,ue),ne.scrollLeft=me?-ie:ie;return}if(!H&&te.key==="Escape"){const ue=I==="multiple"&&Array.isArray($)?$.length===0:$===null,he=Ue(K1,te.nativeEvent),fe=I==="multiple"?[]:null;b.state.setInputValue("",he),b.state.setSelectedValue(fe,he),!ue&&!b.state.inline&&!he.isPropagationAllowed&&te.stopPropagation();return}if(_&&te.key==="Backspace"&&ne.value===""&&_.highlightedChipIndex===void 0&&Array.isArray($)&&$.length>0){const ue=$.slice(0,-1);b.state.setIndices({activeIndex:null,selectedIndex:null,type:b.state.keyboardActiveRef.current?"keyboard":"pointer"}),b.state.setSelectedValue(ue,Ue(Pn,te.nativeEvent));return}const ye=q(te);if(_?.setHighlightedChipIndex(ye),ye!==void 0?_?.chipsRef.current[ye]?.focus():b.state.inputRef.current?.focus(),te.which!==229&&te.key==="Enter"&&V){const ue=b.state.activeIndex,he=te.nativeEvent;if(ue===null){b.state.setOpen(!1,Ue(Pn,he));return}on(te);const fe=b.state.listRef.current[ue];fe&&(b.state.selectionEventRef.current=he,fe.click(),b.state.selectionEventRef.current=null)}},onPointerMove(){b.state.keyboardActiveRef.current=!1},onPointerDown(){b.state.keyboardActiveRef.current=!1}},v?v.getValidationProps(a):a],stateAttributesMapping:Pde})}),Mde={...ho,...fj},Lde=k.forwardRef(function(t,r){const{render:n,className:i,disabled:s=!1,nativeButton:o=!0,keepMounted:a=!1,...l}=t,{disabled:u}=uo(),h=Ll(),d=Ie(h,Xe.selectionMode),p=Ie(h,Xe.disabled),v=Ie(h,Xe.readOnly),S=Ie(h,Xe.open),_=Ie(h,Xe.selectedValue),m=Rj();let x=!1;d==="none"?x=m!=="":d==="single"?x=_!=null:x=Array.isArray(_)&&_.length>0;const b=u||p||s,{buttonRef:w,getButtonProps:O}=Di({native:o,disabled:b}),{mounted:E,transitionStatus:T,setMounted:R}=$o(x),A=k.useMemo(()=>({disabled:b,open:S,transitionStatus:T}),[b,S,T]);gi({open:x,ref:h.state.clearRef,onComplete(){x||R(!1)}});const j=dt("button",t,{state:A,ref:[r,w,h.state.clearRef],props:[{tabIndex:-1,children:"x",disabled:b,"aria-readonly":v||void 0,onMouseDown(L){L.preventDefault()},onClick(L){if(b||v)return;const z=h.state.keyboardActiveRef;h.state.setInputValue("",Ue(w3,L.nativeEvent)),d!=="none"?(h.state.setSelectedValue(Array.isArray(_)?[]:null,Ue(w3,L.nativeEvent)),h.state.setIndices({activeIndex:null,selectedIndex:null,type:z.current?"keyboard":"pointer"})):h.state.setIndices({activeIndex:null,type:z.current?"keyboard":"pointer"}),h.state.inputRef.current?.focus()}},l,O],stateAttributesMapping:Mde});return a||E?j:null}),Dde=k.createContext(null);function Ide(){return k.useContext(Dde)}function Nde(e){const{children:t}=e,{filteredItems:r}=Hd(),n=Ide(),i=n?n.items:r;return i?y.jsx(k.Fragment,{children:i.map(t)}):null}const Bde=k.forwardRef(function(t,r){var n;const{render:i,className:s,children:o,...a}=t,l=Ll(),u=px(),h=!!Pj(!0),{filteredItems:d}=Hd(),p=Ie(l,Xe.items),v=Ie(l,Xe.labelsRef),S=Ie(l,Xe.listRef),_=Ie(l,Xe.selectionMode),m=Ie(l,Xe.grid),x=Ie(l,Xe.popupProps),b=Ie(l,Xe.disabled),w=Ie(l,Xe.readOnly),O=Ie(l,Xe.virtualized),E=_==="multiple",T=d.length===0,R=Be(D=>{l.set("positionerElement",D)}),A=Be(D=>{l.set("listElement",D)}),j=k.useMemo(()=>typeof o=="function"?n||(n=y.jsx(Nde,{children:o})):o,[o]),I=k.useMemo(()=>({empty:T}),[T]),L=u.useState("floatingId"),z=dt("div",t,{state:I,ref:[r,A,h?null:R],props:[x,{children:j,tabIndex:-1,id:L,role:m?"grid":"listbox","aria-multiselectable":E?"true":void 0,onKeyDown(D){if(!(b||w)&&D.key==="Enter"){const V=l.state.activeIndex;if(V==null)return;on(D);const H=D.nativeEvent,$=l.state.listRef.current[V];$&&(l.state.selectionEventRef.current=H,$.click(),l.state.selectionEventRef.current=null)}},onKeyDownCapture(){l.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.state.keyboardActiveRef.current=!1}},a]});return O?z:y.jsx(jv,{elementsRef:S,labelsRef:p?void 0:v,children:z})}),AW=k.createContext(void 0);function $de(){const e=k.useContext(AW);if(e===void 0)throw new Error(er(20));return e}const zde=k.forwardRef(function(t,r){const{keepMounted:n=!1,...i}=t,s=Ll(),o=Ie(s,Xe.mounted),a=Ie(s,Xe.forceMounted);return o||n||a?y.jsx(AW.Provider,{value:n,children:y.jsx(Rv,{ref:r,...i})}):null}),Hde=k.forwardRef(function(t,r){const{render:n,className:i,anchor:s,positionMethod:o="absolute",side:a="bottom",align:l="center",sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:_=!1,collisionAvoidance:m=W1,...x}=t,b=Ll(),{filteredItems:w}=Hd(),O=px(),E=$de(),T=Ie(b,Xe.modal),R=Ie(b,Xe.open),A=Ie(b,Xe.mounted),j=Ie(b,Xe.openMethod),I=Ie(b,Xe.triggerElement),L=Ie(b,Xe.inputElement),z=Ie(b,Xe.inputInsidePopup),D=w.length===0,H=ix({anchor:s??(z?I:L),floatingRootContext:O,positionMethod:o,mounted:A,side:a,sideOffset:u,align:l,alignOffset:h,arrowPadding:v,collisionBoundary:d,collisionPadding:p,sticky:S,disableAnchorTracking:_,keepMounted:E,collisionAvoidance:m,lazyFlip:!0});ux(R&&T&&j!=="touch",I);const $=k.useMemo(()=>{const N={...H.positionerStyles};return R||(N.pointerEvents="none"),{role:"presentation",hidden:!A,style:N}},[R,A,H.positionerStyles]),F=k.useMemo(()=>({open:R,side:H.side,align:H.align,anchorHidden:H.anchorHidden,empty:D}),[R,H.side,H.align,H.anchorHidden,D]);He(()=>{b.set("popupSide",H.side)},[b,H.side]);const W=k.useMemo(()=>({side:H.side,align:H.align,arrowRef:H.arrowRef,arrowUncentered:H.arrowUncentered,arrowStyles:H.arrowStyles,anchorHidden:H.anchorHidden,isPositioned:H.isPositioned}),[H.side,H.align,H.arrowRef,H.arrowUncentered,H.arrowStyles,H.anchorHidden,H.isPositioned]),B=Be(N=>{b.set("positionerElement",N)}),G=dt("div",t,{state:F,ref:[r,B],props:[$,x],stateAttributesMapping:zo});return y.jsxs(kW.Provider,{value:W,children:[A&&T&&y.jsx(cx,{inert:fp(!R),cutout:L??I}),G]})}),Fde={...zo,...ho},Ude=k.forwardRef(function(t,r){const{render:n,className:i,initialFocus:s,finalFocus:o,...a}=t,l=Ll(),u=Pj(),h=px(),{filteredItems:d}=Hd(),p=Ie(l,Xe.mounted),v=Ie(l,Xe.open),S=Ie(l,Xe.openMethod),_=Ie(l,Xe.transitionStatus),m=Ie(l,Xe.inputInsidePopup),x=Ie(l,Xe.inputElement),b=d.length===0;gi({open:v,ref:l.state.popupRef,onComplete(){v&&l.state.onOpenChangeComplete(!0)}});const w=k.useMemo(()=>({open:v,side:u.side,align:u.align,anchorHidden:u.anchorHidden,transitionStatus:_,empty:b}),[v,u.side,u.align,u.anchorHidden,_,b]),O=dt("div",t,{state:w,ref:[r,l.state.popupRef],props:[{role:m?"dialog":"presentation",tabIndex:-1,onFocus(A){const j=an(A.nativeEvent);S!=="touch"&&(ut(l.state.listElement,j)||j===A.currentTarget)&&l.state.inputRef.current?.focus()}},sx(_),a],stateAttributesMapping:Fde}),T=s===void 0?m?A=>A==="touch"?l.state.popupRef.current:x:!1:s;let R;return o!=null?R=o:R=m?void 0:!1,y.jsx(Y1,{context:h,disabled:!p,modal:!m,openInteractionType:S,initialFocus:T,returnFocus:R,children:O})}),RW=k.createContext(void 0);function PW(){const e=k.useContext(RW);if(!e)throw new Error(er(19));return e}const Vde=k.createContext(!1);function Wde(){return k.useContext(Vde)}const qde=k.memo(k.forwardRef(function(t,r){const{render:n,className:i,value:s=null,index:o,disabled:a=!1,nativeButton:l=!1,...u}=t,h=k.useRef(!1),d=k.useRef(null),p=hp({index:o,textRef:d,indexGuessBehavior:hj.GuessFromOrder}),v=Ll(),S=Wde(),{flatFilteredItems:_}=Hd(),m=Ie(v,Xe.open),x=Ie(v,Xe.selectionMode),b=Ie(v,Xe.readOnly),w=Ie(v,Xe.virtualized),O=Ie(v,Xe.isItemEqualToValue),E=x!=="none",T=o??(w?_h(_,s,O):p.index),R=p.index!==-1,A=Ie(v,Xe.id),j=Ie(v,Xe.isActive,T),I=Ie(v,Xe.isSelected,s),L=Ie(v,Xe.items),z=Ie(v,Xe.getItemProps),D=k.useRef(null),V=A!=null&&R?`${A}-${T}`:void 0,H=I&&E;He(()=>{if(!(R&&(w||o!=null)))return;const J=v.state.listRef.current;return J[T]=D.current,()=>{delete J[T]}},[R,w,T,o,v]),He(()=>{if(!R||L)return;const Q=v.state.valuesRef.current;return Q[T]=s,x!=="none"&&v.state.allValuesRef.current.push(s),()=>{delete Q[T]}},[R,L,T,s,v,x]),He(()=>{if(!m){h.current=!1;return}if(!R||L)return;const Q=v.state.selectedValue,J=Array.isArray(Q)?Q[Q.length-1]:Q;wl(J,s,O)&&v.set("selectedIndex",T)},[R,L,m,v,T,s,O]);const $=k.useMemo(()=>({disabled:a,selected:H,highlighted:j}),[a,H,j]),F=z({active:j,selected:H});F.id=void 0,F.onFocus=void 0;const{getButtonProps:W,buttonRef:B}=Di({disabled:a,focusableWhenDisabled:!0,native:l});function G(Q){function J(){v.state.handleSelection(Q,s)}v.state.submitOnItemClick?(hn.flushSync(J),v.state.requestSubmit()):J()}const N={id:V,role:S?"gridcell":"option","aria-disabled":a||void 0,"aria-selected":E?H:void 0,tabIndex:void 0,onPointerDownCapture(Q){h.current=!0,Q.preventDefault()},onClick(Q){a||b||G(Q.nativeEvent)},onMouseUp(Q){const J=h.current;h.current=!1,!(a||b||Q.button!==0||J||!j)&&G(Q.nativeEvent)}},U=dt("div",t,{ref:[B,r,p.ref,D],state:$,props:[F,N,u,W]}),Y=k.useMemo(()=>({selected:H,textRef:d}),[H,d]);return y.jsx(RW.Provider,{value:Y,children:U})})),Gde=k.forwardRef(function(t,r){const{render:n,className:i,children:s,...o}=t,{filteredItems:a}=Hd(),l=Ll(),u=a.length===0?s:null;return dt("div",t,{ref:[r,l.state.emptyRef],props:[{children:u,role:"status","aria-live":"polite","aria-atomic":!0},o]})});let o4=(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 jW(e){return k.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[o4.checked]:""}:{[o4.unchecked]:""}},...zd}),[e.indeterminate])}const MW=k.createContext(void 0);function Kde(){const e=k.useContext(MW);if(e===void 0)throw new Error(er(14));return e}const Yde="data-parent",Xde=k.forwardRef(function(t,r){const{checked:n,className:i,defaultChecked:s=!1,disabled:o=!1,id:a,indeterminate:l=!1,inputRef:u,name:h,onCheckedChange:d,parent:p=!1,readOnly:v=!1,render:S,required:_=!1,uncheckedValue:m,value:x,nativeButton:b=!1,...w}=t,{clearErrors:O}=$v(),{disabled:E,name:T,setDirty:R,setFilled:A,setFocused:j,setTouched:I,state:L,validationMode:z,validityData:D,shouldValidateOnChange:V,validation:H}=uo(),$=aue(),{labelId:F,controlId:W,setControlId:B,getDescriptionProps:G}=au(),N=cue(),U=N?.parent,Y=U&&N.allValues,Q=E||$.disabled||N?.disabled||o,J=T??h,re=x??J,X=ni(),q=ni();let Z=W;Y?Z=p?q:`${U.id}-${re}`:a&&(Z=a);let te={};Y&&(p?te=N.parent.getParentProps():re&&(te=N.parent.getChildProps(re)));const ne=Be(d),{checked:ie=n,indeterminate:me=l,onCheckedChange:ye,...ue}=te,he=N?.value,fe=N?.setValue,$e=N?.defaultValue,ve=k.useRef(null),{getButtonProps:De,buttonRef:_e}=Di({disabled:Q,native:b}),ae=N?.validation??H,[ce,be]=Os({controlled:re&&he&&!p?he.includes(re):ie,default:re&&$e&&!p?$e.includes(re):s,name:"Checkbox",state:"checked"});He(()=>{if(B!==Zr)return B(Z),()=>{B(void 0)}},[Z,N,B,p]),zv({enabled:!N,id:X,commit:ae.commit,value:ce,controlRef:ve,name:J,getValue:()=>ce});const Ee=k.useRef(null),Ve=co(u,Ee,ae.inputRef);He(()=>{Ee.current&&(Ee.current.indeterminate=me,ce&&A(!0))},[ce,me,A]),Ju(ce,()=>{N&&!p||(O(J),A(ce),R(ce!==D.initialValue),V()?ae.commit(ce):ae.commit(ce,!0))});const st=ya({checked:ce,disabled:Q,name:p?void 0:J,id:Z??void 0,required:_,ref:Ve,style:up,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(Qe){if(Qe.nativeEvent.defaultPrevented)return;const Ae=Qe.target.checked,ot=Ue(Pn,Qe.nativeEvent);if(ye?.(Ae,ot),ne(Ae,ot),!ot.isCanceled&&(be(Ae),re&&he&&fe&&!p)){const ft=Ae?[...he,re]:he.filter(Je=>Je!==re);fe(ft,ot)}},onFocus(){ve.current?.focus()}},x!==void 0?{value:(N?ce&&x:x)||""}:Ur,G,N?ae.getValidationProps:ae.getInputValidationProps),Re=Y?!!ie:ce,We=Y&&me||l;k.useEffect(()=>{U&&re&&U.disabledStatesRef.current.set(re,Q)},[U,Q,re]);const Ge=k.useMemo(()=>({...L,checked:Re,disabled:Q,readOnly:v,required:_,indeterminate:We}),[L,Re,Q,v,_,We]),vt=jW(Ge),Ke=dt("span",t,{state:Ge,ref:[_e,ve,r,N?.registerControlRef],props:[{id:X,role:"checkbox","aria-checked":me?"mixed":ce,"aria-readonly":v||void 0,"aria-required":_||void 0,"aria-labelledby":F,[Yde]:p?"":void 0,onFocus(){j(!0)},onBlur(){const Qe=Ee.current;Qe&&(I(!0),j(!1),z==="onBlur"&&ae.commit(N?he:Qe.checked))},onClick(Qe){v||Q||(Qe.preventDefault(),Ee.current?.click())}},G,ae.getValidationProps,w,ue,De],stateAttributesMapping:vt});return y.jsxs(MW.Provider,{value:Ge,children:[Ke,!ce&&!N&&J&&!p&&m!==void 0&&y.jsx("input",{type:"hidden",name:J,value:m}),y.jsx("input",{...st})]})}),Qde=k.forwardRef(function(t,r){const{render:n,className:i,keepMounted:s=!1,...o}=t,a=Kde(),l=a.checked||a.indeterminate,{transitionStatus:u,setMounted:h}=$o(l),d=k.useRef(null),p=k.useMemo(()=>({...a,transitionStatus:u}),[a,u]);gi({open:l,ref:d,onComplete(){l||h(!1)}});const v=jW(a),S=k.useMemo(()=>({...v,...ho,...zd}),[v]),_=s||l,m=dt("span",t,{enabled:_,ref:[r,d],state:p,stateAttributesMapping:S,props:o});return _?m:null});function Zde(e){const{multiple:t=!1,defaultValue:r,value:n,onValueChange:i,...s}=e;return y.jsx(Ode,{...s,selectionMode:t?"multiple":"single",selectedValue:n,defaultSelectedValue:r,onSelectedValueChange:i})}const Jde=k.forwardRef(function(t,r){const n=t.keepMounted??!1,{selected:i}=PW();return n||i?y.jsx(efe,{...t,ref:r}):null}),efe=k.memo(k.forwardRef((e,t)=>{const{render:r,className:n,keepMounted:i,...s}=e,{selected:o}=PW(),a=k.useRef(null),{transitionStatus:l,setMounted:u}=$o(o),h=k.useMemo(()=>({selected:o,transitionStatus:l}),[o,l]),d=dt("span",e,{ref:[t,a],state:h,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:ho});return gi({open:o,ref:a,onComplete(){o||u(!1)}}),d})),tfe=k.createContext(void 0);function mx(e=!0){const t=k.useContext(tfe);if(t===void 0&&!e)throw new Error(er(25));return t}const LW=k.createContext(void 0);function jj(e){const t=k.useContext(LW);if(t===void 0&&!e)throw new Error(er(33));return t}const DW=k.createContext(void 0);function lu(e){const t=k.useContext(DW);if(t===void 0&&!e)throw new Error(er(36));return t}const IW={type:"regular-item"};function NW(e){const{closeOnClick:t,disabled:r=!1,highlighted:n,id:i,store:s,nativeButton:o,itemMetadata:a,nodeId:l}=e,u=k.useRef(null),h=mx(!0),d=h!==void 0,{events:p}=s.useState("floatingTreeRoot"),{getButtonProps:v,buttonRef:S}=Di({disabled:r,focusableWhenDisabled:!0,native:o}),_=k.useCallback(x=>ya({id:i,role:"menuitem",tabIndex:n?0:-1,onMouseMove(b){l&&p.emit("itemhover",{nodeId:l,target:b.currentTarget})},onMouseEnter(){a.type==="submenu-trigger"&&a.setActive()},onKeyUp(b){b.key===" "&&s.context.typingRef.current&&b.preventBaseUIHandler()},onClick(b){t&&p.emit("close",{domEvent:b,reason:ud})},onMouseUp(b){if(h){const w=h.initialCursorPointRef.current;if(h.initialCursorPointRef.current=null,d&&w&&Math.abs(b.clientX-w.x)<=1&&Math.abs(b.clientY-w.y)<=1)return}u.current&&s.context.allowMouseUpTriggerRef.current&&(!d||b.button===2)&&a.type==="regular-item"&&u.current.click()}},x,v),[i,n,v,t,p,s,d,h,a,l]),m=co(u,S);return k.useMemo(()=>({getItemProps:_,itemRef:m}),[_,m])}let a4=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const BW={checked(e){return e?{[a4.checked]:""}:{[a4.unchecked]:""}},...ho},rfe=k.forwardRef(function(t,r){const{render:n,className:i,id:s,label:o,nativeButton:a=!1,disabled:l=!1,closeOnClick:u=!0,...h}=t,d=hp({label:o}),p=jj(!0),v=ni(s),{store:S}=lu(),_=S.useState("isActive",d.index),m=S.useState("itemProps"),{getItemProps:x,itemRef:b}=NW({closeOnClick:u,disabled:l,highlighted:_,id:v,store:S,nativeButton:a,nodeId:p?.nodeId,itemMetadata:IW}),w=k.useMemo(()=>({disabled:l,highlighted:_}),[l,_]);return dt("div",t,{state:w,props:[m,h,x],ref:[b,r,d.ref]})}),nfe={...zo,...ho},ife=k.forwardRef(function(t,r){const{render:n,className:i,finalFocus:s,...o}=t,{store:a}=lu(),{side:l,align:u}=jj(),h=Oj()!=null,d=a.useState("open"),p=a.useState("transitionStatus"),v=a.useState("popupProps"),S=a.useState("mounted"),_=a.useState("instantType"),m=a.useState("activeTriggerElement"),x=a.useState("parent"),b=a.useState("lastOpenChangeReason"),w=a.useState("rootId"),O=a.useState("floatingRootContext"),E=a.useState("floatingTreeRoot"),T=a.useState("closeDelay"),R=a.useState("activeTriggerElement");gi({open:d,ref:a.context.popupRef,onComplete(){d&&a.context.onOpenChangeComplete?.(!0)}}),k.useEffect(()=>{function D(V){a.setOpen(!1,Ue(V.reason,V.domEvent))}return E.events.on("close",D),()=>{E.events.off("close",D)}},[E.events,a]);const A=a.useState("hoverEnabled"),j=a.useState("disabled");ile(O,{enabled:A&&!j&&x.type!=="context-menu"&&x.type!=="menubar",closeDelay:T});const I=k.useMemo(()=>({transitionStatus:p,side:l,align:u,open:d,nested:x.type==="menu",instant:_}),[p,l,u,d,x.type,_]),L=dt("div",t,{state:I,ref:[r,a.context.popupRef],stateAttributesMapping:nfe,props:[v,{onKeyDown(D){h&&dj.has(D.key)&&D.stopPropagation()}},sx(p),o,{"data-rootownerid":w}]});let z=x.type===void 0||x.type==="context-menu";return(m||x.type==="menubar"&&b!==G1)&&(z=!0),y.jsx(Y1,{context:O,modal:!1,disabled:!S,returnFocus:s===void 0?z:s,initialFocus:x.type!=="menu",restoreFocus:!0,externalTree:x.type!=="menubar"?E:void 0,previousFocusableElement:R,nextFocusableElement:x.type===void 0?a.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:x.type===void 0?a.context.beforeContentFocusGuardRef:void 0,children:L})}),$W=k.createContext(void 0);function sfe(){const e=k.useContext($W);if(e===void 0)throw new Error(er(32));return e}const ofe=k.forwardRef(function(t,r){const{keepMounted:n=!1,...i}=t,{store:s}=lu();return s.useState("mounted")||n?y.jsx($W.Provider,{value:n,children:y.jsx(Rv,{ref:r,...i})}):null}),afe=k.forwardRef(function(t,r){const{anchor:n,positionMethod:i="absolute",className:s,render:o,side:a,align:l,sideOffset:u=0,alignOffset:h=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:_=!1,collisionAvoidance:m=W1,...x}=t,{store:b}=lu(),w=sfe(),O=mx(!0),E=b.useState("parent"),T=b.useState("floatingRootContext"),R=b.useState("floatingTreeRoot"),A=b.useState("mounted"),j=b.useState("open"),I=b.useState("modal"),L=b.useState("activeTriggerElement"),z=b.useState("lastOpenChangeReason"),D=b.useState("floatingNodeId"),V=b.useState("floatingParentNodeId");let H=n,$=u,F=h,W=l,B=m;E.type==="context-menu"&&(H=n??E.context?.anchor,W=W??"start",!a&&W!=="center"&&(F=t.alignOffset??2,$=t.sideOffset??-5));let G=a,N=W;E.type==="menu"?(G=G??"inline-end",N=N??"start",B=t.collisionAvoidance??aU):E.type==="menubar"&&(G=G??"bottom",N=N??"start");const U=E.type==="context-menu",Y=ix({anchor:H,floatingRootContext:T,positionMethod:O?"fixed":i,mounted:A,side:G,sideOffset:$,align:N,alignOffset:F,arrowPadding:U?0:v,collisionBoundary:d,collisionPadding:p,sticky:S,nodeId:D,keepMounted:w,disableAnchorTracking:_,collisionAvoidance:B,shiftCrossAxis:U,externalTree:R}),Q=k.useMemo(()=>{const te={};return j||(te.pointerEvents="none"),{role:"presentation",hidden:!A,style:{...Y.positionerStyles,...te}}},[j,A,Y.positionerStyles]);k.useEffect(()=>{function te(ne){ne.open?(ne.parentNodeId===D&&b.set("hoverEnabled",!1),ne.nodeId!==D&&ne.parentNodeId===b.select("floatingParentNodeId")&&b.setOpen(!1,Ue(Gm))):ne.parentNodeId===D&&ne.reason!==Gm&&b.set("hoverEnabled",!0)}return R.events.on("menuopenchange",te),()=>{R.events.off("menuopenchange",te)}},[b,R.events,D]),k.useEffect(()=>{if(b.select("floatingParentNodeId")==null)return;function te(ne){if(ne.open||ne.nodeId!==b.select("floatingParentNodeId"))return;const ie=ne.reason??Gm;b.setOpen(!1,Ue(ie))}return R.events.on("menuopenchange",te),()=>{R.events.off("menuopenchange",te)}},[R.events,b]),k.useEffect(()=>{function te(ne){!j||ne.nodeId!==b.select("floatingParentNodeId")||ne.target&&L&&L!==ne.target&&b.setOpen(!1,Ue(Gm))}return R.events.on("itemhover",te),()=>{R.events.off("itemhover",te)}},[R.events,j,L,b]),k.useEffect(()=>{const te={open:j,nodeId:D,parentNodeId:V,reason:b.select("lastOpenChangeReason")};R.events.emit("menuopenchange",te)},[R.events,j,b,D,V]);const J=k.useMemo(()=>({open:j,side:Y.side,align:Y.align,anchorHidden:Y.anchorHidden,nested:E.type==="menu"}),[j,Y.side,Y.align,Y.anchorHidden,E.type]),re=k.useMemo(()=>({side:Y.side,align:Y.align,arrowRef:Y.arrowRef,arrowUncentered:Y.arrowUncentered,arrowStyles:Y.arrowStyles,nodeId:Y.context.nodeId}),[Y.side,Y.align,Y.arrowRef,Y.arrowUncentered,Y.arrowStyles,Y.context.nodeId]),X=dt("div",t,{state:J,stateAttributesMapping:zo,ref:[r,b.useStateSetter("positionerElement")],props:[Q,x]}),q=A&&E.type!=="menu"&&(E.type!=="menubar"&&I&&z!==ln||E.type==="menubar"&&E.context.modal);let Z=null;return E.type==="menubar"?Z=E.context.contentElement:E.type===void 0&&(Z=L),y.jsxs(LW.Provider,{value:re,children:[q&&y.jsx(cx,{ref:E.type==="context-menu"||E.type==="nested-context-menu"?E.context.internalBackdropRef:null,inert:fp(!j),cutout:Z}),y.jsx(KU,{id:D,children:y.jsx(jv,{elementsRef:b.context.itemDomElements,labelsRef:b.context.itemLabels,children:X})})]})}),zW=k.createContext(void 0);function lfe(){const e=k.useContext(zW);if(e===void 0)throw new Error(er(34));return e}const cfe=k.memo(k.forwardRef(function(t,r){const{render:n,className:i,value:s,defaultValue:o,onValueChange:a,disabled:l=!1,...u}=t,[h,d]=Os({controlled:s,default:o,name:"MenuRadioGroup"}),p=Be(a),v=Be((x,b)=>{p?.(x,b),!b.isCanceled&&d(x)}),S=k.useMemo(()=>({disabled:l}),[l]),_=dt("div",t,{state:S,ref:r,props:{role:"group","aria-disabled":l||void 0,...u}}),m=k.useMemo(()=>({value:h,setValue:v,disabled:l}),[h,v,l]);return y.jsx(zW.Provider,{value:m,children:_})})),HW=k.createContext(void 0);function ufe(){const e=k.useContext(HW);if(e===void 0)throw new Error(er(35));return e}const dfe=k.forwardRef(function(t,r){const{render:n,className:i,id:s,label:o,nativeButton:a=!1,disabled:l=!1,closeOnClick:u=!1,value:h,...d}=t,p=hp({label:o}),v=jj(!0),S=ni(s),{store:_}=lu(),m=_.useState("isActive",p.index),x=_.useState("itemProps"),{value:b,setValue:w,disabled:O}=lfe(),E=O||l,T=b===h,{getItemProps:R,itemRef:A}=NW({closeOnClick:u,disabled:E,highlighted:m,id:S,store:_,nativeButton:a,nodeId:v?.nodeId,itemMetadata:IW}),j=k.useMemo(()=>({disabled:E,highlighted:m,checked:T}),[E,m,T]),I=Be(z=>{const D={...Ue(ud,z.nativeEvent),preventUnmountOnClose:()=>{}};w(h,D)}),L=dt("div",t,{state:j,stateAttributesMapping:BW,props:[x,{role:"menuitemradio","aria-checked":T,onClick:I},d,R],ref:[A,r,p.ref]});return y.jsx(HW.Provider,{value:j,children:L})}),ffe=k.forwardRef(function(t,r){const{render:n,className:i,keepMounted:s=!1,...o}=t,a=ufe(),l=k.useRef(null),{transitionStatus:u,setMounted:h}=$o(a.checked);gi({open:a.checked,ref:l,onComplete(){a.checked||h(!1)}});const d=k.useMemo(()=>({checked:a.checked,disabled:a.disabled,highlighted:a.highlighted,transitionStatus:u}),[a.checked,a.disabled,a.highlighted,u]);return dt("span",t,{state:d,stateAttributesMapping:BW,ref:[r,l],props:{"aria-hidden":!0,...o},enabled:s||a.checked})}),hfe=k.createContext(null);function FW(e){return k.useContext(hfe)}const pfe={...gV,disabled:ke(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:ke(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:ke(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:ke(e=>e.stickIfOpen),parent:ke(e=>e.parent),rootId:ke(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:ke(e=>e.activeIndex),isActive:ke((e,t)=>e.activeIndex===t),hoverEnabled:ke(e=>e.hoverEnabled),instantType:ke(e=>e.instantType),lastOpenChangeReason:ke(e=>e.openChangeReason),floatingTreeRoot:ke(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:ke(e=>e.floatingNodeId),floatingParentNodeId:ke(e=>e.floatingParentNodeId),itemProps:ke(e=>e.itemProps),closeDelay:ke(e=>e.closeDelay),keyboardEventRelay:ke(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class Mj extends aj{constructor(t){super({...mfe(),...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 Q1},pfe),this.observe(ke(r=>r.allowMouseEnter),(r,n)=>{this.state.parent.type==="menu"&&r!==n&&this.state.parent.store.set("allowMouseEnter",r)}),this.unsubscribeParentListener=this.observe("parent",r=>{if(this.unsubscribeParentListener?.(),r.type==="menu"){this.unsubscribeParentListener=r.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=r.store.context.allowMouseUpTriggerRef;return}r.type!==void 0&&(this.context.allowMouseUpTriggerRef=r.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,r){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:r})}static useStore(t,r){return ti(()=>t??new Mj(r)).current}unsubscribeParentListener=null}function mfe(){return{...mV(),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 nj,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Ur,keyboardEventRelay:void 0,closeDelay:0}}const gfe=k.createContext(void 0);function vfe(){return k.useContext(gfe)}function yfe(e){const{children:t,open:r,onOpenChange:n,onOpenChangeComplete:i,defaultOpen:s=!1,disabled:o=!1,modal:a,loopFocus:l=!0,orientation:u="vertical",actionsRef:h,closeParentOnEsc:d=!1,handle:p,triggerId:v,defaultTriggerId:S=null,highlightItemOnHover:_=!0}=e,m=mx(!0),x=lu(!0),b=FW(),w=vfe(),O=k.useMemo(()=>w&&x?{type:"menu",store:x.store}:b?{type:"menubar",context:b}:m&&!x?{type:"context-menu",context:m}:{type:void 0},[m,x,b,w]),E=Mj.useStore(p?.store,{parent:O}),T=E.useState("floatingTreeRoot"),R=ij(T),A=No();He(()=>{m&&!x?E.update({parent:{type:"context-menu",context:m},floatingNodeId:R,floatingParentNodeId:A}):x&&E.update({floatingNodeId:R,floatingParentNodeId:A})},[m,x,R,A,E]),E.useControlledProp("open",r,s),E.useControlledProp("activeTriggerId",v,S),E.useContextCallback("onOpenChangeComplete",i);const j=E.useState("open"),I=E.useState("activeTriggerElement"),L=E.useState("positionerElement"),z=E.useState("hoverEnabled"),D=E.useState("modal"),V=E.useState("disabled"),H=E.useState("lastOpenChangeReason"),$=E.useState("parent"),F=E.useState("activeIndex"),W=E.useState("payload"),B=E.useState("floatingParentNodeId"),G=k.useRef(null),N=B!=null;let U;E.useSyncedValues({disabled:o,modal:$.type===void 0?a:void 0,rootId:su()});const{openMethod:Y,triggerProps:Q,reset:J}=dx(j);hV(E);const{forceUnmount:re}=pV(j,E,()=>{E.update({allowMouseEnter:!1,stickIfOpen:!0}),J()}),X=k.useRef($.type!=="context-menu"),q=Sr();k.useEffect(()=>{if(j||(G.current=null),$.type==="context-menu"){if(!j){q.clear(),X.current=!1;return}q.start(500,()=>{X.current=!0})}},[q,j,$.type]),ux(j&&D&&H!==ln&&Y!=="touch",L),He(()=>{!j&&!z&&E.set("hoverEnabled",!0)},[j,z,E]);const Z=k.useRef(!0),te=Sr(),ne=Be((Ae,ot)=>{const ft=ot.reason;if(j===Ae&&ot.trigger===I||(ot.preventUnmountOnClose=()=>{E.set("preventUnmountingOnClose",!0)},!Ae&&ot.trigger==null&&(ot.trigger=I??void 0),n?.(Ae,ot),ot.isCanceled))return;const Je={open:Ae,nativeEvent:ot.event,reason:ot.reason,nested:N};U?.emit("openchange",Je);const lt=ot.event;if(Ae===!1&&lt?.type==="click"&&lt.pointerType==="touch"&&!Z.current)return;if(!Ae&&F!==null){const It=E.context.itemDomElements.current[F];queueMicrotask(()=>{It?.setAttribute("tabindex","-1")})}Ae&&ft===e_?(Z.current=!1,te.start(300,()=>{Z.current=!0})):(Z.current=!0,te.clear());const Ht=(ft===Dc||ft===ud)&&lt.detail===0&&lt?.isTrusted,pt=!Ae&&(ft===K1||ft==null);function Pr(){const It={open:Ae,openChangeReason:ft};G.current=ot.event??null;const kt=ot.trigger?.id??null;(kt||Ae)&&(It.activeTriggerId=kt,It.activeTriggerElement=ot.trigger??null),E.update(It)}ft===ln?hn.flushSync(Pr):Pr(),$.type==="menubar"&&(ft===e_||ft===Lo||ft===ln||ft===eh||ft===Gm)?E.set("instantType","group"):Ht||pt?E.set("instantType",Ht?"click":"dismiss"):E.set("instantType",void 0)}),ie=k.useCallback(Ae=>{const ot=Ue(Ae);return ot.preventUnmountOnClose=()=>{E.set("preventUnmountingOnClose",!0)},ot},[E]),me=k.useCallback(()=>{E.setOpen(!1,ie(QU))},[E,ie]);k.useImperativeHandle(h,()=>({unmount:re,close:me}),[re,me]);let ye;$.type==="context-menu"&&(ye=$.context),k.useImperativeHandle(ye?.positionerRef,()=>L,[L]),k.useImperativeHandle(ye?.actionsRef,()=>({setOpen:ne}),[ne]);const ue=vV({popupStore:E,onOpenChange:ne});U=ue.context.events,k.useEffect(()=>{const Ae=({open:ot,eventDetails:ft})=>ne(ot,ft);return U.on("setOpen",Ae),()=>{U?.off("setOpen",Ae)}},[U,ne]);const he=Pv(ue,{enabled:!V,bubbles:d&&$.type==="menu",outsidePress(){return $.type!=="context-menu"||G.current?.type==="contextmenu"?!0:X.current},externalTree:N?T:void 0}),fe=bV(ue,{role:"menu"}),$e=ou(),ve=k.useCallback(Ae=>{E.select("activeIndex")!==Ae&&E.set("activeIndex",Ae)},[E]),De=cj(ue,{enabled:!V,listRef:E.context.itemDomElements,activeIndex:F,nested:$.type!==void 0,loopFocus:l,orientation:u,parentOrientation:$.type==="menubar"?$.context.orientation:void 0,rtl:$e==="rtl",disabledIndices:ki,onNavigate:ve,openOnArrowKeyDown:$.type!=="context-menu",externalTree:N?T:void 0,focusItemOnHover:_}),_e=k.useCallback(Ae=>{E.context.typingRef.current=Ae},[E]),ae=uj(ue,{listRef:E.context.itemLabels,activeIndex:F,resetMs:Gie,onMatch:Ae=>{j&&Ae!==F&&E.set("activeIndex",Ae)},onTypingChange:_e}),{getReferenceProps:ce,getFloatingProps:be,getItemProps:Ee,getTriggerProps:Ve}=Nd([he,fe,De,ae]),st=k.useMemo(()=>{const Ae=ya(ce(),{onMouseEnter(){E.set("hoverEnabled",!0)},onMouseMove(){E.set("allowMouseEnter",!0)}},Q);return delete Ae.role,Ae},[ce,E,Q]),Re=k.useMemo(()=>{const Ae=Ve();if(!Ae)return Ae;const ot=ya(Ae,Q);return delete ot.role,delete ot["aria-controls"],ot},[Ve,Q]),We=Ic(),Ge=k.useMemo(()=>be({onMouseEnter(){$.type==="menu"&&We.request(()=>E.set("hoverEnabled",!1))},onMouseMove(){E.set("allowMouseEnter",!0)},onClick(){E.select("hoverEnabled")&&E.set("hoverEnabled",!1)},onKeyDown(Ae){const ot=E.select("keyboardEventRelay");ot&&!Ae.isPropagationStopped()&&ot(Ae)}}),[be,$.type,We,E]),vt=k.useMemo(()=>Ee(),[Ee]);E.useSyncedValues({floatingRootContext:ue,activeTriggerProps:st,inactiveTriggerProps:Re,popupProps:Ge,itemProps:vt});const Ke=k.useMemo(()=>({store:E,parent:O}),[E,O]),Qe=y.jsx(DW.Provider,{value:Ke,children:typeof t=="function"?t({payload:W}):t});return $.type===void 0||$.type==="context-menu"?y.jsx(YU,{externalTree:T,children:Qe}):Qe}function UW(e){if(Dr(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!la(e))return UW(va(e))}function bfe(e){const{enabled:t=!0,mouseDownAction:r,open:n}=e,i=k.useRef(!1);return k.useMemo(()=>t?{onMouseDown:s=>{(r==="open"&&!n||r==="close"&&n)&&(i.current=!0,ri(s.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:s=>{i.current&&(i.current=!1,s.preventBaseUIHandler())}}:Ur,[t,r,n])}const qb=2,_fe=k.forwardRef(function(t,r){const{render:n,className:i,disabled:s=!1,nativeButton:o=!0,id:a,openOnHover:l,delay:u=100,closeDelay:h=0,handle:d,payload:p,...v}=t,S=lu(!0),_=d?.store??S?.store;if(!_)throw new Error(er(85));const m=ni(a),x=_.useState("isTriggerActive",m),b=_.useState("floatingRootContext"),w=_.useState("isOpenedByTrigger",m),O=k.useRef(null),E=Sfe(),T=WP(!0),R=Bo(),A=k.useMemo(()=>R??new nj,[R]),j=ij(A),I=No(),{registerTrigger:L,isMountedByThisTrigger:z}=fV(m,O,_,{payload:p,closeDelay:h,parent:E,floatingTreeRoot:A,floatingNodeId:j,floatingParentNodeId:I,keyboardEventRelay:T?.relayKeyboardEvent}),D=_.useState("disabled"),V=s||D||E.type==="menubar"&&E.context.disabled,{getButtonProps:H,buttonRef:$}=Di({disabled:V,native:o});k.useEffect(()=>{!w&&E.type===void 0&&(_.context.allowMouseUpTriggerRef.current=!1)},[_,w,E.type]);const F=k.useRef(null),W=Sr(),B=Be(fe=>{if(!F.current)return;W.clear(),_.context.allowMouseUpTriggerRef.current=!1;const $e=fe.target;if(ut(F.current,$e)||ut(_.select("positionerElement"),$e)||$e===F.current||$e!=null&&UW($e)===_.select("rootId"))return;const ve=Cj(F.current);fe.clientX>=ve.left-qb&&fe.clientX<=ve.right+qb&&fe.clientY>=ve.top-qb&&fe.clientY<=ve.bottom+qb||A.events.emit("close",{domEvent:fe,reason:XU})});k.useEffect(()=>{w&&_.select("lastOpenChangeReason")===ln&&ri(F.current).addEventListener("mouseup",B,{once:!0})},[w,B,_]);const G=E.type==="menubar"&&E.context.hasSubmenuOpen,U=ale(b,{enabled:(l??G??!1)&&!V&&E.type!=="context-menu"&&(E.type!=="menubar"||G&&!z),handleClose:_V({blockPointerEvents:E.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:E.type===void 0?u:void 0,delay:{close:h},triggerElementRef:O,externalTree:A,isActiveTrigger:x}),Y=xfe(w,_.select("lastOpenChangeReason")),Q=dp(b,{enabled:!V&&E.type!=="context-menu",event:w&&E.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:E.type===void 0?Y:!1}),J=ele(b,{enabled:!V&&(E.type!=="menubar"&&w||G)}),re=bfe({open:w,enabled:E.type==="menubar",mouseDownAction:"open"}),X=Nd([Q,J]),q=E.type==="menubar",Z=k.useMemo(()=>({disabled:V,open:w}),[V,w]),te=_.useState("triggerProps",z),ne=[F,r,$,L,O],ie=[X.getReferenceProps(),U??Ur,te,{"aria-haspopup":"menu",id:m,onMouseDown:fe=>{if(_.select("open"))return;W.start(200,()=>{_.context.allowMouseUpTriggerRef.current=!0}),ri(fe.currentTarget).addEventListener("mouseup",B,{once:!0})}},q?{role:"menuitem"}:{},re,v,H],me=k.useRef(null),ye=Be(fe=>{hn.flushSync(()=>{_.setOpen(!1,Ue(Lo,fe.nativeEvent,fe.currentTarget))}),Eoe(me.current)?.focus()}),ue=Be(fe=>{const $e=_.select("positionerElement");if($e&&Ro(fe,$e))_.context.beforeContentFocusGuardRef.current?.focus();else{hn.flushSync(()=>{_.setOpen(!1,Ue(Lo,fe.nativeEvent,fe.currentTarget))});let ve=Coe(O.current);for(;ve!==null&&ut($e,ve)||ve?.hasAttribute("aria-hidden");){const De=ve;if(ve=Av(ve),ve===De)break}ve?.focus()}}),he=dt("button",t,{enabled:!q,stateAttributesMapping:yh,state:Z,ref:ne,props:ie});return q?y.jsx(nx,{tag:"button",render:n,className:i,state:Z,refs:ne,props:ie,stateAttributesMapping:yh}):w?y.jsxs(k.Fragment,{children:[y.jsx(ba,{ref:me,onFocus:ye},`${m}-pre-focus-guard`),y.jsx(k.Fragment,{children:he},m),y.jsx(ba,{ref:_.context.triggerFocusTargetRef,onFocus:ue},`${m}-post-focus-guard`)]}):y.jsx(k.Fragment,{children:he},m)});function xfe(e,t){const r=Sr(),[n,i]=k.useState(!1);return He(()=>{e&&t==="trigger-hover"?(i(!0),r.start(sU,()=>{i(!1)})):e||(r.clear(),i(!1))},[e,t,r]),n}function Sfe(){const e=mx(!0),t=lu(!0),r=FW();return k.useMemo(()=>r?{type:"menubar",context:r}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,r])}function il(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}const VW=k.createContext(void 0);function gx(){const e=k.useContext(VW);if(e===void 0)throw new Error(er(53));return e}let a_=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const Gb=500,l4=16;function ro(e,t,r){if(!e)return 0;const n=getComputedStyle(e),i=r==="x"?"Inline":"Block";return r==="x"&&t==="margin"?parseFloat(n[`${t}InlineStart`])*2:parseFloat(n[`${t}${i}Start`])+parseFloat(n[`${t}${i}End`])}let wfe=(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})({}),If=(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 Lj={hasOverflowX:e=>e?{[If.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[If.hasOverflowY]:""}:null,overflowXStart:e=>e?{[If.overflowXStart]:""}:null,overflowXEnd:e=>e?{[If.overflowXEnd]:""}:null,overflowYStart:e=>e?{[If.overflowYStart]:""}:null,overflowYEnd:e=>e?{[If.overflowYEnd]:""}:null,cornerHidden:()=>null},c4={width:0,height:0},Cfe={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},Efe=k.forwardRef(function(t,r){const{render:n,className:i,overflowEdgeThreshold:s,...o}=t,[a,l]=k.useState(!1),[u,h]=k.useState(!1),[d,p]=k.useState(!1),[v,S]=k.useState(c4),[_,m]=k.useState(c4),[x,b]=k.useState(!1),[w,O]=k.useState(Cfe),E=ni(),T=k.useRef(null),R=k.useRef(null),A=k.useRef(null),j=k.useRef(null),I=k.useRef(null),L=k.useRef(null),z=k.useRef(null),D=k.useRef(!1),V=k.useRef(0),H=k.useRef(0),$=k.useRef(0),F=k.useRef(0),W=k.useRef("vertical"),B=Sr(),G=Sr(),N=k.useRef({x:0,y:0}),[U,Y]=k.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),Q=Ofe(s),J=Be(ye=>{const ue=ye.x-N.current.x,he=ye.y-N.current.y;N.current=ye,he!==0&&(p(!0),B.start(Gb,()=>{p(!1)})),ue!==0&&(h(!0),G.start(Gb,()=>{h(!1)}))}),re=Be(ye=>{ye.button===0&&(D.current=!0,V.current=ye.clientY,H.current=ye.clientX,W.current=ye.currentTarget.getAttribute(wfe.orientation),R.current&&($.current=R.current.scrollTop,F.current=R.current.scrollLeft),I.current&&W.current==="vertical"&&I.current.setPointerCapture(ye.pointerId),L.current&&W.current==="horizontal"&&L.current.setPointerCapture(ye.pointerId))}),X=Be(ye=>{if(!D.current)return;const ue=ye.clientY-V.current,he=ye.clientX-H.current;if(R.current){const fe=R.current.scrollHeight,$e=R.current.clientHeight,ve=R.current.scrollWidth,De=R.current.clientWidth;if(I.current&&A.current&&W.current==="vertical"){const _e=ro(A.current,"padding","y"),ae=ro(I.current,"margin","y"),ce=I.current.offsetHeight,be=A.current.offsetHeight-ce-_e-ae,Ee=ue/be;R.current.scrollTop=$.current+Ee*(fe-$e),ye.preventDefault(),p(!0),B.start(Gb,()=>{p(!1)})}if(L.current&&j.current&&W.current==="horizontal"){const _e=ro(j.current,"padding","x"),ae=ro(L.current,"margin","x"),ce=L.current.offsetWidth,be=j.current.offsetWidth-ce-_e-ae,Ee=he/be;R.current.scrollLeft=F.current+Ee*(ve-De),ye.preventDefault(),h(!0),G.start(Gb,()=>{h(!1)})}}}),q=Be(ye=>{D.current=!1,I.current&&W.current==="vertical"&&I.current.releasePointerCapture(ye.pointerId),L.current&&W.current==="horizontal"&&L.current.releasePointerCapture(ye.pointerId)});function Z(ye){const ue=ye.pointerType==="touch";if(b(ue),!ue){const he=ut(T.current,ye.target);l(he)}}const te=k.useMemo(()=>({hasOverflowX:!U.scrollbarXHidden,hasOverflowY:!U.scrollbarYHidden,overflowXStart:w.xStart,overflowXEnd:w.xEnd,overflowYStart:w.yStart,overflowYEnd:w.yEnd,cornerHidden:U.cornerHidden}),[U.scrollbarXHidden,U.scrollbarYHidden,U.cornerHidden,w]),ne={role:"presentation",onPointerEnter:Z,onPointerMove:Z,onPointerDown({pointerType:ye}){b(ye==="touch")},onPointerLeave(){l(!1)},style:{position:"relative",[a_.scrollAreaCornerHeight]:`${v.height}px`,[a_.scrollAreaCornerWidth]:`${v.width}px`}},ie=dt("div",t,{state:te,ref:[r,T],props:[ne,o],stateAttributesMapping:Lj}),me=k.useMemo(()=>({handlePointerDown:re,handlePointerMove:X,handlePointerUp:q,handleScroll:J,cornerSize:v,setCornerSize:S,thumbSize:_,setThumbSize:m,touchModality:x,cornerRef:z,scrollingX:u,setScrollingX:h,scrollingY:d,setScrollingY:p,hovering:a,setHovering:l,viewportRef:R,rootRef:T,scrollbarYRef:A,scrollbarXRef:j,thumbYRef:I,thumbXRef:L,rootId:E,hiddenState:U,setHiddenState:Y,overflowEdges:w,setOverflowEdges:O,viewportState:te,overflowEdgeThreshold:Q}),[re,X,q,J,v,_,x,z,u,h,d,p,a,l,R,T,A,j,I,L,E,U,w,te,Q]);return y.jsxs(VW.Provider,{value:me,children:[Eg.element,ie]})});function Ofe(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 Tfe=k.createContext(void 0);function kfe(e,t){if(typeof IntersectionObserver>"u")return()=>{};const r=new IntersectionObserver(n=>{n.forEach(i=>{i.intersectionRatio>0&&(t(),r.disconnect())})});return r.observe(e),()=>{r.disconnect()}}let wc=(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})({}),u4=!1;function Afe(){u4||YP||(typeof CSS<"u"&&"registerProperty"in CSS&&[wc.scrollAreaOverflowXStart,wc.scrollAreaOverflowXEnd,wc.scrollAreaOverflowYStart,wc.scrollAreaOverflowYEnd].forEach(e=>{try{CSS.registerProperty({name:e,syntax:"<length>",inherits:!1,initialValue:"0px"})}catch{}}),u4=!0)}const Rfe=k.forwardRef(function(t,r){const{render:n,className:i,...s}=t,{viewportRef:o,scrollbarYRef:a,scrollbarXRef:l,thumbYRef:u,thumbXRef:h,cornerRef:d,setCornerSize:p,setThumbSize:v,rootId:S,setHiddenState:_,hiddenState:m,handleScroll:x,setHovering:b,setOverflowEdges:w,overflowEdges:O,overflowEdgeThreshold:E}=gx(),T=ou(),R=k.useRef(!0),A=Sr(),j=Sr();function I(){const F=o.current,W=a.current,B=l.current,G=u.current,N=h.current,U=d.current;if(!F)return;const Y=F.scrollHeight,Q=F.scrollWidth,J=F.clientHeight,re=F.clientWidth,X=F.scrollTop,q=F.scrollLeft;if(Y===0||Q===0)return;const Z=J>=Y,te=re>=Q,ne=re/Q,ie=J/Y,me=Math.max(0,Q-re),ye=Math.max(0,Y-J);let ue=0,he=0;te||(T==="rtl"?ue=il(-q,0,me):ue=il(q,0,me),he=me-ue);const fe=Z?0:il(X,0,ye),$e=Z?0:ye-fe,ve=te?0:re,De=Z?0:J,_e=ro(B,"padding","x"),ae=ro(W,"padding","y"),ce=ro(N,"margin","x"),be=ro(G,"margin","y"),Ee=ve-_e-ce,Ve=De-ae-be,st=B?Math.min(B.offsetWidth,Ee):Ee,Re=W?Math.min(W.offsetHeight,Ve):Ve,We=Math.max(l4,st*ne),Ge=Math.max(l4,Re*ie);if(v(Je=>Je.height===Ge&&Je.width===We?Je:{width:We,height:Ge}),W&&G){const Je=W.offsetHeight-Ge-ae-be,lt=Y-J,Ht=lt===0?0:X/lt,pt=Math.min(Je,Math.max(0,Ht*Je));G.style.transform=`translate3d(0,${pt}px,0)`}if(B&&N){const Je=B.offsetWidth-We-_e-ce,lt=Q-re,Ht=lt===0?0:q/lt,pt=T==="rtl"?il(Ht*Je,-Je,0):il(Ht*Je,0,Je);N.style.transform=`translate3d(${pt}px,0,0)`}const vt=il(ue,0,me),Ke=il(he,0,me),Qe=il(fe,0,ye),Ae=il($e,0,ye),ot=[[wc.scrollAreaOverflowXStart,vt],[wc.scrollAreaOverflowXEnd,Ke],[wc.scrollAreaOverflowYStart,Qe],[wc.scrollAreaOverflowYEnd,Ae]];for(const[Je,lt]of ot)F.style.setProperty(Je,`${lt}px`);if(U){if(te||Z)p({width:0,height:0});else if(!te&&!Z){const Je=W?.offsetWidth||0,lt=B?.offsetHeight||0;p({width:Je,height:lt})}}_(Je=>{const lt=Z||te;return Je.scrollbarYHidden===Z&&Je.scrollbarXHidden===te&&Je.cornerHidden===lt?Je:{scrollbarYHidden:Z,scrollbarXHidden:te,cornerHidden:lt}});const ft={xStart:!te&&vt>E.xStart,xEnd:!te&&Ke>E.xEnd,yStart:!Z&&Qe>E.yStart,yEnd:!Z&&Ae>E.yEnd};w(Je=>Je.xStart===ft.xStart&&Je.xEnd===ft.xEnd&&Je.yStart===ft.yStart&&Je.yEnd===ft.yEnd?Je:ft)}const L=Be(()=>{hn.flushSync(I)});He(()=>o.current?(Afe(),kfe(o.current,L)):void 0,[L,o]),He(()=>{queueMicrotask(L)},[L,m,T]),He(()=>{o.current?.matches(":hover")&&b(!0)},[o,b]),k.useEffect(()=>{const F=o.current;if(typeof ResizeObserver>"u"||!F)return;const W=new ResizeObserver(L);return W.observe(F),j.start(0,()=>{Promise.all(F.getAnimations({subtree:!0}).map(B=>B.finished)).then(L).catch(()=>{})}),()=>{W.disconnect(),j.clear()}},[L,o,j]);function z(){R.current=!1}const D={role:"presentation",...S&&{"data-id":`${S}-viewport`},...(!m.scrollbarXHidden||!m.scrollbarYHidden)&&{tabIndex:0},className:Eg.className,style:{overflow:"scroll"},onScroll(){o.current&&(L(),R.current||x({x:o.current.scrollLeft,y:o.current.scrollTop}),A.start(100,()=>{R.current=!0}))},onWheel:z,onTouchMove:z,onPointerMove:z,onPointerEnter:z,onKeyDown:z},V=k.useMemo(()=>({hasOverflowX:!m.scrollbarXHidden,hasOverflowY:!m.scrollbarYHidden,overflowXStart:O.xStart,overflowXEnd:O.xEnd,overflowYStart:O.yStart,overflowYEnd:O.yEnd,cornerHidden:m.cornerHidden}),[m.scrollbarXHidden,m.scrollbarYHidden,m.cornerHidden,O]),H=dt("div",t,{ref:[r,o],state:V,props:[D,s],stateAttributesMapping:Lj}),$=k.useMemo(()=>({computeThumbPosition:L}),[L]);return y.jsx(Tfe.Provider,{value:$,children:H})}),WW=k.createContext(void 0);function Pfe(){const e=k.useContext(WW);if(e===void 0)throw new Error(er(54));return e}let l_=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const jfe=k.forwardRef(function(t,r){const{render:n,className:i,orientation:s="vertical",keepMounted:o=!1,...a}=t,{hovering:l,scrollingX:u,scrollingY:h,hiddenState:d,overflowEdges:p,scrollbarYRef:v,scrollbarXRef:S,viewportRef:_,thumbYRef:m,thumbXRef:x,handlePointerDown:b,handlePointerUp:w,rootId:O,thumbSize:E}=gx(),T=k.useMemo(()=>({hovering:l,scrolling:{horizontal:u,vertical:h}[s],orientation:s,hasOverflowX:!d.scrollbarXHidden,hasOverflowY:!d.scrollbarYHidden,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:d.cornerHidden}),[l,u,h,s,d,p]),R=ou();k.useEffect(()=>{const D=_.current,V=s==="vertical"?v.current:S.current;if(!V)return;function H($){if(!(!D||!V||$.ctrlKey)){if($.preventDefault(),s==="vertical"){if(D.scrollTop===0&&$.deltaY<0)return}else if(D.scrollLeft===0&&$.deltaX<0)return;if(s==="vertical"){if(D.scrollTop===D.scrollHeight-D.clientHeight&&$.deltaY>0)return}else if(D.scrollLeft===D.scrollWidth-D.clientWidth&&$.deltaX>0)return;s==="vertical"?D.scrollTop+=$.deltaY:D.scrollLeft+=$.deltaX}}return V.addEventListener("wheel",H,{passive:!1}),()=>{V.removeEventListener("wheel",H)}},[s,S,v,_]);const A={...O&&{"data-id":`${O}-scrollbar`},onPointerDown(D){if(D.button===0&&D.currentTarget===D.target&&_.current){if(m.current&&v.current&&s==="vertical"){const V=ro(m.current,"margin","y"),H=ro(v.current,"padding","y"),$=m.current.offsetHeight,F=v.current.getBoundingClientRect(),W=D.clientY-F.top-$/2-H+V/2,B=_.current.scrollHeight,G=_.current.clientHeight,N=v.current.offsetHeight-$-H-V,Y=W/N*(B-G);_.current.scrollTop=Y}if(x.current&&S.current&&s==="horizontal"){const V=ro(x.current,"margin","x"),H=ro(S.current,"padding","x"),$=x.current.offsetWidth,F=S.current.getBoundingClientRect(),W=D.clientX-F.left-$/2-H+V/2,B=_.current.scrollWidth,G=_.current.clientWidth,N=S.current.offsetWidth-$-H-V,U=W/N;let Y;R==="rtl"?(Y=(1-U)*(B-G),_.current.scrollLeft<=0&&(Y=-Y)):Y=U*(B-G),_.current.scrollLeft=Y}b(D)}},onPointerUp:w,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...s==="vertical"&&{top:0,bottom:`var(${a_.scrollAreaCornerHeight})`,insetInlineEnd:0,[l_.scrollAreaThumbHeight]:`${E.height}px`},...s==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${a_.scrollAreaCornerWidth})`,bottom:0,[l_.scrollAreaThumbWidth]:`${E.width}px`}}},j=dt("div",t,{ref:[r,s==="vertical"?v:S],state:T,props:[A,a],stateAttributesMapping:Lj}),I=k.useMemo(()=>({orientation:s}),[s]),L=s==="vertical"?d.scrollbarYHidden:d.scrollbarXHidden;return o||!L?y.jsx(WW.Provider,{value:I,children:j}):null}),Mfe=k.forwardRef(function(t,r){const{render:n,className:i,...s}=t,{thumbYRef:o,thumbXRef:a,handlePointerDown:l,handlePointerMove:u,handlePointerUp:h,setScrollingX:d,setScrollingY:p}=gx(),{orientation:v}=Pfe(),S=k.useMemo(()=>({orientation:v}),[v]);return dt("div",t,{ref:[r,v==="vertical"?o:a],state:S,props:[{onPointerDown:l,onPointerMove:u,onPointerUp(m){v==="vertical"&&p(!1),v==="horizontal"&&d(!1),h(m)},style:{...v==="vertical"&&{height:`var(${l_.scrollAreaThumbHeight})`},...v==="horizontal"&&{width:`var(${l_.scrollAreaThumbWidth})`}}},s]})}),Lfe=k.forwardRef(function(t,r){const{render:n,className:i,...s}=t,{cornerRef:o,cornerSize:a,hiddenState:l}=gx(),u=dt("div",t,{ref:[r,o],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:a.width,height:a.height}},s]});return l.cornerHidden?null:u}),qW=k.createContext(void 0);function Dfe(){const e=k.useContext(qW);if(e===void 0)throw new Error(er(63));return e}let d4=(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 GW={...zd,checked(e){return e?{[d4.checked]:""}:{[d4.unchecked]:""}}},Ife=k.forwardRef(function(t,r){const{checked:n,className:i,defaultChecked:s,id:o,inputRef:a,name:l,nativeButton:u=!1,onCheckedChange:h,readOnly:d=!1,required:p=!1,disabled:v=!1,render:S,uncheckedValue:_,...m}=t,{clearErrors:x}=$v(),{state:b,setTouched:w,setDirty:O,validityData:E,setFilled:T,setFocused:R,shouldValidateOnChange:A,validationMode:j,disabled:I,name:L,validation:z}=uo(),{labelId:D}=au(),V=I||v,H=L??l,$=Be(h),F=k.useRef(null),W=co(F,a,z.inputRef),B=k.useRef(null),G=ni(),N=fx({id:o,implicit:!1,controlRef:B}),[U,Y]=Os({controlled:n,default:!!s,name:"Switch",state:"checked"});zv({id:G,commit:z.commit,value:U,controlRef:B,name:H,getValue:()=>U}),He(()=>{F.current&&T(F.current.checked)},[F,T]),Ju(U,()=>{x(H),O(U!==E.initialValue),T(U),A()?z.commit(U):z.commit(U,!0)});const{getButtonProps:Q,buttonRef:J}=Di({disabled:V,native:u}),re={id:G,role:"switch","aria-checked":U,"aria-readonly":d||void 0,"aria-labelledby":D,onFocus(){V||R(!0)},onBlur(){const te=F.current;!te||V||(w(!0),R(!1),j==="onBlur"&&z.commit(te.checked))},onClick(te){d||V||(te.preventDefault(),F?.current?.click())}},X=k.useMemo(()=>ya({checked:U,disabled:V,id:N,name:H,required:p,style:up,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:W,onChange(te){if(te.nativeEvent.defaultPrevented)return;const ne=te.target.checked,ie=Ue(Pn,te.nativeEvent);$?.(ne,ie),!ie.isCanceled&&Y(ne)},onFocus(){B.current?.focus()}},z.getInputValidationProps),[U,V,W,N,H,$,p,Y,z]),q=k.useMemo(()=>({...b,checked:U,disabled:V,readOnly:d,required:p}),[b,U,V,d,p]),Z=dt("span",t,{state:q,ref:[r,B,J],props:[re,z.getValidationProps,m,Q],stateAttributesMapping:GW});return y.jsxs(qW.Provider,{value:q,children:[Z,!U&&H&&_!==void 0&&y.jsx("input",{type:"hidden",name:H,value:_}),y.jsx("input",{...X})]})}),Nfe=k.forwardRef(function(t,r){const{render:n,className:i,...s}=t,{state:o}=uo(),a=Dfe(),l={...o,...a};return dt("span",t,{state:l,ref:r,stateAttributesMapping:GW,props:s})}),KW=k.createContext(void 0);function Bfe(e=!0){const t=k.useContext(KW);if(t===void 0&&!e)throw new Error(er(7));return t}const $fe=k.forwardRef(function(t,r){const{className:n,defaultPressed:i=!1,disabled:s=!1,form:o,onPressedChange:a,pressed:l,render:u,type:h,value:d,nativeButton:p=!0,...v}=t,S=ni(d||void 0),_=Bfe(),m=_?.value??[],x=_?void 0:i,b=(s||_?.disabled)??!1,[w,O]=Os({controlled:_?m?.indexOf(S)>-1:l,default:x,name:"Toggle",state:"pressed"}),E=Be((z,D)=>{S&&_?.setGroupValue?.(S,z,D),a?.(z,D)}),{getButtonProps:T,buttonRef:R}=Di({disabled:b,native:p}),A=k.useMemo(()=>({disabled:b,pressed:w}),[b,w]),j=[R,r],I=[{"aria-pressed":w,onClick(z){const D=!w,V=Ue(Pn,z.nativeEvent);E(D,V),!V.isCanceled&&O(D)}},v,T],L=dt("button",t,{enabled:!_,state:A,ref:j,props:I});return _?y.jsx(nx,{tag:"button",render:u,className:n,state:A,refs:j,props:I}):L});let zfe=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const f4={multiple(e){return e?{[zfe.multiple]:""}:null}},Hfe=k.forwardRef(function(t,r){const{defaultValue:n,disabled:i=!1,loopFocus:s=!0,onValueChange:o,orientation:a="horizontal",multiple:l=!1,value:u,className:h,render:d,...p}=t,v=Oj(),S=k.useMemo(()=>{if(u===void 0)return n??[]},[u,n]),_=(v?.disabled??!1)||i,[m,x]=Os({controlled:u,default:S,name:"ToggleGroup",state:"value"}),b=Be((R,A,j)=>{let I;if(l?(I=m.slice(),A?I.push(R):I.splice(m.indexOf(R),1)):I=A?[R]:[],Array.isArray(I)){if(o?.(I,j),j.isCanceled)return;x(I)}}),w=k.useMemo(()=>({disabled:_,multiple:l,orientation:a}),[_,a,l]),O=k.useMemo(()=>({disabled:_,orientation:a,setGroupValue:b,value:m}),[_,a,b,m]),E={role:"group"},T=dt("div",t,{enabled:!!v,state:w,ref:r,props:[E,p],stateAttributesMapping:f4});return y.jsx(KW.Provider,{value:O,children:v?T:y.jsx(rx,{render:d,className:h,state:w,refs:[r],props:[E,p],stateAttributesMapping:f4,loopFocus:s})})});function Ffe(e){return dt(e.defaultTagName??"div",e,e)}function Ufe({className:e,...t}){return y.jsx("div",{"data-slot":"input-group",role:"group",className:Me("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 Vfe=nu("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 Wfe({className:e,align:t="inline-start",...r}){return y.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Me(Vfe({align:t}),e),onClick:n=>{n.target.closest("button")||n.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}const qfe=nu("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 YW({className:e,type:t="button",variant:r="ghost",size:n="xs",...i}){return y.jsx(Ne,{type:t,"data-size":n,variant:r,className:Me(qfe({size:n}),e),...i})}function Gfe({className:e,...t}){return y.jsx(qt,{"data-slot":"input-group-control",className:Me("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 Kfe=Zde;function Yfe({className:e,children:t,...r}){return y.jsxs(kde,{"data-slot":"combobox-trigger",className:Me("[&_svg:not([class*='size-'])]:size-3.5",e),...r,children:[t,y.jsx(pe,{icon:Dv,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})]})}function Xfe({className:e,...t}){return y.jsx(Lde,{"data-slot":"combobox-clear",render:y.jsx(YW,{variant:"ghost",size:"icon-xs"}),className:Me(e),...t,children:y.jsx(pe,{icon:es,strokeWidth:2,className:"pointer-events-none"})})}function Qfe({className:e,children:t,disabled:r=!1,showTrigger:n=!0,showClear:i=!1,...s}){return y.jsxs(Ufe,{className:Me("w-auto",e),children:[y.jsx(jde,{render:y.jsx(Gfe,{disabled:r}),...s}),y.jsxs(Wfe,{align:"inline-end",children:[n&&y.jsx(YW,{size:"icon-xs",variant:"ghost",render:y.jsx(Yfe,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:r}),i&&y.jsx(Xfe,{disabled:r})]}),t]})}function Zfe({className:e,side:t="bottom",sideOffset:r=6,align:n="start",alignOffset:i=0,anchor:s,...o}){return y.jsx(zde,{children:y.jsx(Hde,{side:t,sideOffset:r,align:n,alignOffset:i,anchor:s,className:"isolate z-50",children:y.jsx(Ude,{"data-slot":"combobox-content","data-chips":!!s,className:Me("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),...o})})})}function Jfe({className:e,...t}){return y.jsx(Bde,{"data-slot":"combobox-list",className:Me("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 ehe({className:e,children:t,...r}){return y.jsxs(qde,{"data-slot":"combobox-item",className:Me("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),...r,children:[t,y.jsx(Jde,{render:y.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:y.jsx(pe,{icon:Rl,strokeWidth:2,className:"pointer-events-none"})})]})}function the({className:e,...t}){return y.jsx(Gde,{"data-slot":"combobox-empty",className:Me("text-muted-foreground hidden w-full justify-center py-2 text-center text-xs/relaxed group-data-empty/combobox-content:flex",e),...t})}const rhe=nu("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"}}),XW=k.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function nhe({className:e,variant:t,size:r,spacing:n=0,orientation:i="horizontal",children:s,...o}){return y.jsx(Hfe,{"data-slot":"toggle-group","data-variant":t,"data-size":r,"data-spacing":n,"data-orientation":i,style:{"--gap":n},className:Me("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),...o,children:y.jsx(XW.Provider,{value:{variant:t,size:r,spacing:n,orientation:i},children:s})})}function h4({className:e,children:t,variant:r="default",size:n="default",...i}){const s=k.useContext(XW);return y.jsx($fe,{"data-slot":"toggle-group-item","data-variant":s.variant||r,"data-size":s.size||n,"data-spacing":s.spacing,className:Me("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",rhe({variant:s.variant||r,size:s.size||n}),e),...i,children:t})}async function Dt(e,t){const r=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t?.headers}});if(r.status===401)throw window.dispatchEvent(new CustomEvent("vibora:auth-required")),new Error("Authentication required");if(!r.ok){const n=await r.json().catch(()=>({error:"Request failed"}));throw new Error(n.error||"Request failed")}return r.json()}const Td="";function Dj(){return Rr({queryKey:["tasks"],queryFn:()=>Dt(`${Td}/api/tasks`)})}function QW(e){return Rr({queryKey:["tasks",e],queryFn:()=>Dt(`${Td}/api/tasks/${e}`),enabled:!!e})}function ihe(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Td}/api/tasks`,{method:"POST",body:JSON.stringify({...t,status:"IN_PROGRESS"})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function she(){const e=Cn();return Yr({mutationFn:({taskId:t,status:r,position:n})=>Dt(`${Td}/api/tasks/${t}/status`,{method:"PATCH",body:JSON.stringify({status:r,position:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function Ij(){const e=Cn();return Yr({mutationFn:({taskId:t,updates:r})=>Dt(`${Td}/api/tasks/${t}`,{method:"PATCH",body:JSON.stringify(r)}),onSuccess:(t,{taskId:r})=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["tasks",r]})}})}function ZW(){const e=Cn();return Yr({mutationFn:({taskId:t,deleteLinkedWorktree:r})=>{const n=r?`${Td}/api/tasks/${t}?deleteLinkedWorktree=true`:`${Td}/api/tasks/${t}`;return Dt(n,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}const Fd="";function ohe(e){return Rr({queryKey:["fs","list",e],queryFn:()=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return Dt(`${Fd}/api/fs/list${t}`)},enabled:e!==null})}function ahe(e){return Rr({queryKey:["git","branches",e],queryFn:()=>Dt(`${Fd}/api/git/branches?repo=${encodeURIComponent(e)}`),enabled:!!e})}function lhe(e,t={}){const{staged:r=!1,ignoreWhitespace:n=!1,includeUntracked:i=!1}=t;return Rr({queryKey:["git","diff",e,r,n,i],queryFn:()=>{const s=new URLSearchParams({path:e,...r&&{staged:"true"},...n&&{ignoreWhitespace:"true"},...i&&{includeUntracked:"true"}});return Dt(`${Fd}/api/git/diff?${s}`)},enabled:!!e,refetchInterval:5e3})}function che(e){return Rr({queryKey:["git","status",e],queryFn:()=>Dt(`${Fd}/api/git/status?path=${encodeURIComponent(e)}`),enabled:!!e,refetchInterval:5e3})}function uhe(e){return Rr({queryKey:["fs","tree",e],queryFn:()=>Dt(`${Fd}/api/fs/tree?root=${encodeURIComponent(e)}`),enabled:!!e,staleTime:1e4})}function dhe(e,t,r){return Rr({queryKey:["fs","read",e,t,r?.maxLines],queryFn:()=>{const n=new URLSearchParams({path:t,root:e,...r?.maxLines});return Dt(`${Fd}/api/fs/read?${n}`)},enabled:!!e&&!!t})}async function fhe(e){return Dt(`${Fd}/api/fs/is-git-repo?path=${encodeURIComponent(e)}`)}const Ra="",Ut={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"},hhe=7777;function Ii(e){return Rr({queryKey:["config",e],queryFn:()=>Dt(`${Ra}/api/config/${e}`)})}function JW(){const e=Ii(Ut.PORT);return{...e,data:e.data?.value??hhe,isDefault:e.data?.isDefault??!0}}function phe(){const e=Ii(Ut.WORKTREE_BASE_PATH);return{...e,data:e.data?.value??""}}function vx(){const e=Ii(Ut.DEFAULT_GIT_REPOS_DIR);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function yx(){const e=Ii(Ut.EDITOR_APP);return{...e,data:e.data?.value??"vscode",isDefault:e.data?.isDefault??!0}}function bx(){const e=Ii(Ut.EDITOR_HOST);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function _x(){const e=Ii(Ut.EDITOR_SSH_PORT);return{...e,data:e.data?.value??22,isDefault:e.data?.isDefault??!0}}function mhe(){const e=Ii(Ut.LINEAR_API_KEY);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function ghe(){const e=Ii(Ut.GITHUB_PAT);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function vhe(){const e=Ii(Ut.LANGUAGE);return{...e,data:e.data?.value??null,isDefault:e.data?.isDefault??!0}}function yhe(){const e=Ii(Ut.THEME);return{...e,data:e.data?.value??"system",isDefault:e.data?.isDefault??!0}}function bhe(){const e=Ii(Ut.SYNC_CLAUDE_CODE_THEME);return{...e,data:!!e.data?.value,isDefault:e.data?.isDefault??!0}}const p4=["light","light-ansi","light-daltonized","dark","dark-ansi","dark-daltonized"];function _he(){const e=Ii(Ut.CLAUDE_CODE_LIGHT_THEME);return{...e,data:e.data?.value??"light-ansi",isDefault:e.data?.isDefault??!0}}function xhe(){const e=Ii(Ut.CLAUDE_CODE_DARK_THEME);return{...e,data:e.data?.value??"dark-ansi",isDefault:e.data?.isDefault??!0}}function She(){const e=Ii(Ut.BASIC_AUTH_USERNAME);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function whe(){const e=Ii(Ut.BASIC_AUTH_PASSWORD);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Nj(){const e=Cn();return Yr({mutationFn:({key:t,value:r})=>Dt(`${Ra}/api/config/${t}`,{method:"PUT",body:JSON.stringify({value:r})}),onSuccess:(t,{key:r})=>{e.invalidateQueries({queryKey:["config",r]}),r===Ut.GITHUB_PAT&&(e.invalidateQueries({queryKey:["github-user"]}),e.invalidateQueries({queryKey:["github-prs"]}),e.invalidateQueries({queryKey:["github-issues"]}),e.invalidateQueries({queryKey:["github-orgs"]}))}})}function Che(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Ra}/api/config/${t}`,{method:"DELETE"}),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:["config",r]})}})}function Ehe(){return Rr({queryKey:["config","notifications"],queryFn:()=>Dt(`${Ra}/api/config/notifications`)})}function Ohe(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Ra}/api/config/notifications`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","notifications"]})}})}function The(){return Yr({mutationFn:e=>Dt(`${Ra}/api/config/notifications/test/${e}`,{method:"POST"})})}function khe(){return Rr({queryKey:["config","z-ai"],queryFn:()=>Dt(`${Ra}/api/config/z-ai`)})}function Ahe(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Ra}/api/config/z-ai`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","z-ai"]}),e.invalidateQueries({queryKey:["monitoring","claude-usage"]})}})}function eq(){return Rr({queryKey:["config","developer-mode"],queryFn:()=>Dt(`${Ra}/api/config/developer-mode`),staleTime:1/0})}function Rhe(){return Yr({mutationFn:()=>Dt(`${Ra}/api/config/restart`,{method:"POST"})})}const Hv="";function Fv(){return Rr({queryKey:["repositories"],queryFn:()=>Dt(`${Hv}/api/repositories`)})}function Phe(e){return Rr({queryKey:["repositories",e],queryFn:()=>Dt(`${Hv}/api/repositories/${e}`),enabled:!!e})}function tq(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Hv}/api/repositories`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function jhe(){const e=Cn();return Yr({mutationFn:({id:t,updates:r})=>Dt(`${Hv}/api/repositories/${t}`,{method:"PATCH",body:JSON.stringify(r)}),onSuccess:(t,{id:r})=>{e.invalidateQueries({queryKey:["repositories"]}),e.invalidateQueries({queryKey:["repositories",r]})}})}function rq(){const e=Cn();return Yr({mutationFn:t=>Dt(`${Hv}/api/repositories/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function xh({className:e,children:t,...r}){return y.jsxs(Efe,{"data-slot":"scroll-area",className:Me("relative",e),...r,children:[y.jsx(Rfe,{"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(Mhe,{}),y.jsx(Lfe,{})]})}function Mhe({className:e,orientation:t="vertical",...r}){return y.jsx(jfe,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Me("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),...r,children:y.jsx(Mfe,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function Uv({open:e,onOpenChange:t,onSelect:r,initialPath:n}){const[i,s]=k.useState(n||null),[o,a]=k.useState(""),[l,u]=k.useState("");k.useEffect(()=>{e&&(s(n||null),a(""),u(""))},[e,n]);const{data:h,isLoading:d,error:p}=ohe(e?i??"":null),v=w=>{h&&(s(h.path+"/"+w),u(""))},S=()=>{h?.parent&&h.parent!==h.path&&(s(h.parent),u(""))},_=()=>{s(null),u("")},m=()=>{o.trim()&&(s(o.trim()),u(""))},x=w=>{r(w),t(!1)},b=h?.entries.filter(w=>w.name.toLowerCase().includes(l.toLowerCase()));return y.jsx(Ta,{open:e,onOpenChange:t,children:y.jsxs(ka,{className:"sm:max-w-lg overflow-hidden",children:[y.jsxs(jl,{children:[y.jsx(Ml,{children:"Select Git Repository"}),y.jsx(Bv,{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(zue,{}),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(qt,{value:o,onChange:w=>a(w.target.value),placeholder:"/path/to/your/project",onKeyDown:w=>w.key==="Enter"&&m(),className:"flex-1"}),y.jsx(Ne,{variant:"outline",size:"sm",onClick:m,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(pe,{icon:UV,size:14,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),y.jsx(qt,{value:l,onChange:w=>u(w.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(Ne,{variant:"outline",size:"icon-sm",onClick:_,title:"Home",className:"shrink-0",children:y.jsx(pe,{icon:gce,size:14,strokeWidth:2})}),y.jsx(Ne,{variant:"outline",size:"icon-sm",onClick:S,disabled:!h||h.parent===h.path,title:"Parent directory",className:"shrink-0",children:y.jsx(pe,{icon:gj,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:h?.path||"~"}),y.jsxs(Ne,{variant:"outline",size:"sm",onClick:()=>h&&x(h.path),disabled:!h,className:"shrink-0 max-sm:px-2",title:"Select current directory",children:[y.jsx(pe,{icon:xA,size:14,strokeWidth:2,className:"sm:hidden"}),y.jsx("span",{className:"max-sm:hidden",children:"Select Current"})]})]}),y.jsx(xh,{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}),h&&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(w=>y.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted group",children:w.type==="directory"?y.jsxs(y.Fragment,{children:[y.jsx(pe,{icon:w.isGitRepo?xA:pi,size:16,strokeWidth:2,className:(w.isGitRepo,"text-accent")}),y.jsx("button",{onClick:()=>v(w.name),className:"flex-1 text-left text-xs truncate hover:underline",children:w.name}),w.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:w.name})]})},w.name))]})]})}),y.jsxs($d,{children:[y.jsx(Nv,{render:y.jsx(Ne,{variant:"outline"}),children:"Cancel"}),y.jsx(Ne,{onClick:()=>h&&x(h.path),disabled:!h,children:"Select Path"})]})]})})}function Lhe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Dhe(e){const t=Lhe(e);if(!t)return"";const r=Math.random().toString(36).substring(2,6);return`${t}-${r}`}function Bj({open:e,onOpenChange:t,defaultRepository:r,showTrigger:n=!0}={}){const{t:i}=Wt("tasks"),{t:s}=Wt("common"),[o,a]=k.useState(!1),l=e??o,u=t??a,[h,d]=k.useState(!1),[p,v]=k.useState(""),[S,_]=k.useState(""),[m,x]=k.useState(""),[b,w]=k.useState(""),[O,E]=k.useState(""),[T,R]=k.useState(""),[A,j]=k.useState("default"),[I,L]=k.useState(!1),[z,D]=k.useState(null),[V,H]=k.useState("browse"),[$,F]=k.useState(""),[W,B]=k.useState(null),[G,N]=k.useState(!1),U=As(),Y=ihe(),Q=tq(),J=k.useRef(null),{data:re}=phe(),{data:X}=vx(),{data:q}=Fv(),{data:Z,isLoading:te}=ahe(m||null),ne=z?q?.find(ve=>ve.id===z):null,ie=k.useMemo(()=>{if(!q)return[];if(ne&&$===ne.displayName||!$.trim())return q;const ve=$.toLowerCase();return q.filter(De=>De.displayName.toLowerCase().includes(ve)||De.path.toLowerCase().includes(ve))},[q,$,ne]);k.useEffect(()=>{q&&q.length>0?H("saved"):H("browse")},[q]),k.useEffect(()=>{if(l){if(r)D(r.id),x(r.path),F(r.displayName),H("saved");else if(q&&q.length>0){const ve=q[0];D(ve.id),x(ve.path),F(ve.displayName),H("saved")}}},[l,r,q]),k.useEffect(()=>{w(Z?Z.current||Z.branches[0]||"main":"")},[Z,m]);const me=ve=>{v(ve),R(Dhe(ve))},ye=async ve=>{B(null),N(!0);try{if(!(await fhe(ve)).isGitRepo){B(i("createModal.errors.notGitRepo")),N(!1);return}if(x(ve),D(null),!q?.find(ae=>ae.path===ve)){const ae=ve.split("/").pop()||"Unknown";Q.mutate({path:ve,displayName:ae})}}catch(De){B(De instanceof Error?De.message:i("createModal.errors.validationFailed"))}finally{N(!1)}},ue=ve=>{if(ve.preventDefault(),!p.trim()||!m)return;const De=m.split("/").pop()||"repo",_e=O.trim()||T,ae=`${re}/${_e}`;Y.mutate({title:p.trim(),description:S.trim(),repoPath:m,repoName:De,baseBranch:b||"main",branch:_e,worktreePath:ae,copyFiles:ne?.copyFiles||void 0,startupScript:ne?.startupScript||void 0},{onSuccess:ce=>{const be=S.trim()?{aiMode:A,description:S.trim()}:{aiMode:A};u(!1),v(""),_(""),x(""),w(""),E(""),R(""),j("default"),L(!1),D(null),F(""),B(null),H(q&&q.length>0?"saved":"browse"),U({to:"/tasks/$taskId",params:{taskId:ce.id},state:be})}})},he=!Y.isPending&&!!p.trim()&&!!m;Ys("meta+enter",()=>{J.current&&J.current.requestSubmit()},{enabled:l&&he,allowInInput:!0,ignoreContext:!0,deps:[l,he]});const fe=O.trim()||T,$e=fe?`${re}/${fe}`:"";return y.jsxs(y.Fragment,{children:[y.jsxs(Ta,{open:l,onOpenChange:u,children:[n&&y.jsxs(wj,{render:y.jsx(Ne,{size:"sm"}),children:[y.jsx(pe,{icon:bj,size:16,strokeWidth:2,"data-slot":"icon",className:"-translate-y-px"}),i("newTask")]}),y.jsx(ka,{className:"sm:max-w-md max-h-[80dvh] flex flex-col overflow-hidden",children:y.jsxs("form",{ref:J,onSubmit:ue,className:"flex flex-col min-h-0 flex-1",children:[y.jsxs(jl,{className:"shrink-0",children:[y.jsx(Ml,{children:i("createModal.title")}),y.jsx(Bv,{children:i("createModal.description")})]}),y.jsxs(pl,{className:"mt-4 pb-4 overflow-y-auto min-h-0 flex-1",children:[y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"title",children:i("createModal.fields.title")}),y.jsx(qt,{id:"title",value:p,onChange:ve=>me(ve.target.value),placeholder:i("createModal.fields.titlePlaceholder"),required:!0})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"description",children:i("createModal.fields.description")}),y.jsx(oW,{id:"description",value:S,onValueChange:ve=>{_(ve),I||j(ve.trim()?"plan":"default")},placeholder:i("createModal.fields.descriptionPlaceholder"),rows:2})]}),y.jsxs(mr,{children:[y.jsx(gr,{children:i("createModal.fields.aiMode")}),y.jsxs(nhe,{value:[A],onValueChange:ve=>{const De=Array.isArray(ve)?ve[0]:ve;De&&(j(De),L(!0))},className:"w-full",variant:"outline",children:[y.jsx(h4,{value:"plan",className:"flex-1",children:i("createModal.aiModes.plan")}),y.jsx(h4,{value:"default",className:"flex-1",children:i("createModal.aiModes.default")})]})]}),y.jsxs(mr,{children:[y.jsx(gr,{children:i("createModal.fields.repository")}),y.jsxs(Nc,{value:V,onValueChange:ve=>{H(ve),B(null)},children:[y.jsxs(Bc,{children:[y.jsx(ui,{value:"saved",disabled:!q?.length,children:i("createModal.tabs.saved")}),y.jsx(ui,{value:"browse",children:i("createModal.tabs.browse")})]}),y.jsx(qi,{value:"saved",className:"mt-2",children:y.jsxs(Kfe,{value:z||"",onValueChange:ve=>{const De=q?.find(_e=>_e.id===ve);De&&(D(ve),x(De.path),F(De.displayName),B(null))},inputValue:$,onInputValueChange:ve=>{F(ve),ne&&ve!==ne.displayName&&D(null)},itemToStringLabel:ve=>q?.find(De=>De.id===ve)?.displayName||"",children:[y.jsx(Qfe,{placeholder:i("createModal.searchRepositories"),className:"w-full"}),y.jsx(Zfe,{children:y.jsxs(Jfe,{children:[y.jsx(the,{children:i("createModal.noRepositoriesFound")}),ie.map(ve=>y.jsx(ehe,{value:ve.id,children:ve.displayName},ve.id))]})})]})}),y.jsx(qi,{value:"browse",className:"mt-2",children:y.jsxs(Ne,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>d(!0),disabled:G,children:[y.jsx(pe,{icon:pi,size:14,strokeWidth:2,className:"mr-2"}),G?y.jsx("span",{className:"text-muted-foreground",children:s("status.validating")}):m&&!z?y.jsx("span",{className:"truncate",children:m}):y.jsx("span",{className:"text-muted-foreground group-hover/button:text-accent-foreground",children:i("createModal.selectFolder")})]})})]}),W&&y.jsx("p",{className:"text-sm text-destructive",children:W}),m&&!W&&y.jsx(Oi,{className:"font-mono text-xs truncate",children:m})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"baseBranch",children:i("createModal.fields.baseBranch")}),y.jsxs(Ai,{value:b,onValueChange:ve=>w(ve??""),disabled:!m||te,children:[y.jsx(Pi,{className:"w-full",children:y.jsx(Ri,{children:b||y.jsx("span",{className:"text-muted-foreground",children:i(m?te?"createModal.loadingBranches":"createModal.selectBranch":"createModal.selectRepositoryFirst")})})}),y.jsx(ji,{children:Z?.branches.map(ve=>y.jsxs(pr,{value:ve,children:[ve,ve===Z.current&&y.jsx("span",{className:"text-muted-foreground ml-2",children:i("createModal.current")})]},ve))})]})]}),y.jsxs(mr,{children:[y.jsx(gr,{htmlFor:"branch",children:i("createModal.fields.branchName")}),y.jsx(qt,{id:"branch",value:O,onChange:ve=>E(ve.target.value),placeholder:T||i("createModal.fields.branchPlaceholder")}),$e&&y.jsxs(Oi,{children:[i("createModal.worktreePrefix")," ",$e]}),!O.trim()&&T&&y.jsx(Oi,{children:i("createModal.branchAutoGenerated",{branch:T})})]})]}),y.jsxs($d,{className:"mt-4 shrink-0",children:[y.jsx(Nv,{render:y.jsx(Ne,{variant:"outline",type:"button",className:"border-destructive text-destructive hover:bg-destructive hover:text-white"}),children:s("buttons.cancel")}),y.jsx(Ne,{type:"submit",disabled:Y.isPending||!p.trim()||!m,children:Y.isPending?s("status.creating"):i("createModal.createTask")})]})]})})]}),y.jsx(Uv,{open:h,onOpenChange:d,onSelect:ye,initialPath:X||void 0})]})}const m4=[{to:"/tasks",icon:bh,labelKey:"header.tasks",matchPrefix:!0},{to:"/terminals",icon:ox,labelKey:"header.terminals",matchPrefix:!1},{to:"/repositories",icon:wA,labelKey:"header.repositories",matchPrefix:!0},{to:"/review",icon:s_,labelKey:"header.review",matchPrefix:!0},{to:"/monitoring",icon:ace,labelKey:"header.monitoring",matchPrefix:!0}];function Ihe({onNewTaskRef:e,onOpenCommandPalette:t}){const{t:r}=Wt("navigation"),{location:n}=In(),i=n.pathname,[s,o]=k.useState(!1),a=(l,u)=>u?i.startsWith(l):i===l;return k.useEffect(()=>{e?.(()=>o(!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(Oce,{className:"lg:hidden",children:y.jsx(Tce,{children:y.jsxs(kce,{children:[y.jsxs(Rce,{className:"bg-transparent hover:bg-muted/50 data-open:bg-muted/50 gap-1 px-2",children:[y.jsx(pe,{icon:Sce,size:16,strokeWidth:2}),y.jsx("span",{className:"sr-only",children:"Menu"})]}),y.jsx(Pce,{className:"min-w-48",children:m4.map(l=>y.jsxs(Mce,{href:l.to,active:a(l.to,l.matchPrefix),render:y.jsx(hi,{to:l.to}),children:[y.jsx(pe,{icon:l.icon,size:16,strokeWidth:2}),r(l.labelKey)]},l.to))})]})})}),y.jsx("nav",{className:"hidden items-center gap-1 lg:flex",children:m4.map(l=>{const u=a(l.to,l.matchPrefix);return y.jsxs(hi,{to:l.to,className:Me("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(pe,{icon:l.icon,size:16,strokeWidth:2,"data-slot":"icon"}),r(l.labelKey)]},l.to)})})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.jsx(Bj,{open:s,onOpenChange:o}),y.jsx(Ne,{variant:"ghost",size:"icon-sm",onClick:t,title:r("header.commandPalette",{shortcut:"⌘K"}),children:y.jsx(pe,{icon:_A,size:16,strokeWidth:2})}),y.jsx(hi,{to:"/settings",className:Me("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(pe,{icon:VV,size:16,strokeWidth:2})})]})]})}function Nhe(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}const Bhe=10,$he=2e3;function zhe(){const e=Cn(),{resolvedTheme:t}=op(),r=k.useRef(null),n=k.useRef(void 0),i=k.useRef(0),s=k.useRef(void 0),o=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:h,title:d,message:p,notificationType:v,playSound:S,isCustomSound:_}=u.payload,x=S&&!_?"/goat.jpeg":t==="dark"?"/logo-dark.jpg":"/logo-light.jpg",b=y.jsx("img",{src:x,alt:"",className:"size-8 shrink-0 aspect-square rounded-sm object-cover"});switch(v){case"success":Jt.success(d,{description:p,icon:b});break;case"error":Jt.error(d,{description:p,icon:b});break;case"warning":Jt.warning(d,{description:p,icon:b});break;default:Jt.info(d,{description:p,icon:b});break}if("Notification"in window&&window.parent===window&&Notification.permission==="granted"&&new Notification(d,{body:p,icon:x,tag:h}),S){const O=localStorage.getItem("vibora:lastSoundPlayed"),E=Date.now();if(O&&E-parseInt(O)<1e3)return;localStorage.setItem("vibora:lastSoundPlayed",String(E));let T=!1;const R=()=>{if(T)return;T=!0,new Audio("/sounds/goat-bleat.mp3").play().catch(()=>{})},A=new Audio("/api/uploads/sound");A.onerror=R,A.play().catch(R)}window.parent!==window&&window.parent.postMessage({type:"vibora:notification",title:d,message:p,notificationType:v},"*")}}catch{}},[e,t]),a=k.useCallback(()=>{const l=r.current;if(l&&(l.readyState===WebSocket.CONNECTING||l.readyState===WebSocket.OPEN))return;const u=Nhe(),h=new WebSocket(u);r.current=h,h.onopen=()=>{i.current=0},h.onmessage=o,h.onclose=()=>{r.current===h&&(r.current=null),i.current<Bhe&&(i.current++,n.current=setTimeout(()=>{s.current?.()},$he))},h.onerror=()=>{}},[o]);s.current=a,k.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]),k.useEffect(()=>(a(),()=>{n.current&&clearTimeout(n.current);const l=r.current;l&&(l.readyState===WebSocket.OPEN&&l.close(),r.current=null)}),[a])}const Hhe={save:"Save Changes",cancel:"Cancel",delete:"Delete",create:"Create",reset:"Reset to default",browse:"Browse",clearFilters:"Clear filters"},Fhe={loading:"Loading...",saving:"Saving...",saved:"Saved",error:"Error",calculating:"calculating...",validating:"Validating...",creating:"Creating...",deleting:"Deleting...",loggingIn:"Logging in..."},Uhe={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"},Vhe={one:"{{count}} result",other:"{{count}} results"},Whe={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled",ORPHANED:"Orphaned"},qhe={loginTitle:"Login to Vibora",username:"Username",password:"Password",login:"Login",loginFailed:"Login failed"},Ghe={buttons:Hhe,status:Fhe,time:Uhe,results:Vhe,statuses:Whe,auth:qhe},Khe={tasks:"Tasks",terminals:"Terminals",worktrees:"Worktrees",repositories:"Repositories",review:"Review",monitoring:"Monitoring",settings:"Settings",commandPalette:"Command Palette ({{shortcut}})"},Yhe={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"}},Xhe={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"}},Qhe={header:Khe,commandPalette:Yhe,shortcuts:Xhe},Zhe="Tasks",Jhe="Search",epe="All Repos",tpe="New Task",rpe={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"}},npe={title:Zhe,searchPlaceholder:Jhe,allRepos:epe,newTask:tpe,createModal:rpe},ipe="Settings",spe={server:"Server",serverDefaults:"Server & Defaults",paths:"Paths",authentication:"Authentication",editor:"Editor",integrations:"Integrations",zai:"z.ai",notifications:"Notifications",appearance:"Appearance",developer:"Developer"},ope={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)"}}},ape={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"},lpe={restartButton:"Restart Vibora",restarting:"Restarting...",restartDescription:"Rebuild and restart the Vibora server. If the build fails, the server will continue running.",restartFailed:"Restart failed",checkLogs:"Build may have failed. Check journalctl --user -u vibora-dev for details."},cpe={title:"Unsaved Changes",description:"You have unsaved changes that will be lost if you leave this page.",stay:"Stay",leave:"Leave"},upe={title:ipe,sections:spe,fields:ope,notifications:ape,developer:lpe,unsavedChanges:cpe},dpe="Review",fpe={pullRequests:"Pull Requests",issues:"Issues"},hpe={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"},ppe={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"},mpe={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"},gpe={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"}},vpe={title:dpe,tabs:fpe,filters:hpe,github:ppe,prs:mpe,issues:gpe},ype="Worktrees",bpe={total:"{{count}} total",orphaned:"{{count}} orphaned"},_pe={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."},xpe={noMatch:"No worktrees match the selected filters.",noWorktrees:"No worktrees found. Worktrees are created when you create tasks."},Spe={failedToLoad:"Failed to load worktrees: {{message}}"},wpe={title:ype,summary:bpe,cleanup:_pe,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:xpe,error:Spe},Cpe="Monitoring",Epe={claude:"Claude Instances",system:"System Metrics",processes:"Processes",vibora:"Vibora Servers",worktrees:"Worktrees",usage:"Usage Limits"},Ope={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}}"},Tpe={cpuUsage:"CPU Usage",memoryUsage:"Memory Usage",memoryLabels:{used:"Used",cache:"Cache / Buffers"},diskUsage:"Disk Usage ({{path}})",error:"Failed to load system metrics: {{message}}"},kpe={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"},Ape={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}}"},Rpe={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}}"},Ppe={title:Cpe,tabs:Epe,claude:Ope,system:Tpe,processes:kpe,vibora:Ape,usage:Rpe},jpe="Tasks",Mpe="New Terminal",Lpe="All Repos",Dpe={title:"Edit Tab",name:"Name",namePlaceholder:"Tab name",directory:"Directory",directoryPlaceholder:"Select a directory...",clearDirectory:"Clear directory",cancel:"Cancel",save:"Save"},Ipe={title:"New Tab",create:"Create"},Npe={taskTerminals:jpe,newTerminal:Mpe,allRepos:Lpe,editTab:Dpe,newTab:Ipe},Bpe="Repositories",$pe="{{count}} total",zpe="New Task",Hpe="Tasks",Fpe="Terminal",Upe="Editor",Vpe="Settings",Wpe="Add Repository",qpe="Open in Terminal",Gpe="Open in {{editor}}",Kpe={openInVSCode:"Open in VS Code"},Ype={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"},Xpe={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..."}}},Qpe={noRepositories:"No repositories added yet. Add a repository for quick access when creating tasks."},Zpe={failedToLoad:"Failed to load repositories: {{message}}"},Jpe={title:Bpe,total:$pe,newTask:zpe,viewTasks:Hpe,terminal:Fpe,editor:Upe,settings:Vpe,addRepository:Wpe,openInTerminal:qpe,openInEditor:Gpe,card:Kpe,delete:{title:"Delete Repository",description:'This will remove "{{name}}" from Vibora. The actual repository files will not be affected.',button:"Delete",deleting:"Deleting..."},addModal:Ype,newProject:Xpe,empty:Qpe,error:Zpe},eme={save:"保存更改",cancel:"取消",delete:"删除",create:"创建",reset:"重置为默认值",browse:"浏览",clearFilters:"清除筛选"},tme={loading:"加载中...",saving:"保存中...",saved:"已保存",error:"错误",calculating:"计算中...",validating:"验证中...",creating:"创建中...",deleting:"删除中...",loggingIn:"登录中..."},rme={justNow:"刚刚",minuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",hourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",dayAgo:"1 天前",daysAgo:"{{count}} 天前"},nme={one:"{{count}} 个结果",other:"{{count}} 个结果"},ime={IN_PROGRESS:"进行中",IN_REVIEW:"审核中",DONE:"已完成",CANCELED:"已取消",ORPHANED:"孤立"},sme={loginTitle:"登录 Vibora",username:"用户名",password:"密码",login:"登录",loginFailed:"登录失败"},ome={buttons:eme,status:tme,time:rme,results:nme,statuses:ime,auth:sme},ame={tasks:"任务",terminals:"终端",worktrees:"工作树",repositories:"仓库",review:"审核",monitoring:"监控",settings:"设置",commandPalette:"命令面板 ({{shortcut}})"},lme={placeholder:"输入命令或搜索...",noResults:"未找到命令",categories:{navigation:"导航",actions:"操作"},commands:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",newTask:"新建任务",keyboardShortcuts:"键盘快捷键"}},cme={title:"键盘快捷键",groups:{navigation:"导航",actions:"操作",general:"通用"},labels:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",commandPalette:"命令面板",newTask:"新建任务",keyboardShortcuts:"键盘快捷键",closeModal:"关闭弹窗"}},ume={header:ame,commandPalette:lme,shortcuts:cme},dme="任务",fme="搜索",hme="全部仓库",pme="新建任务",mme={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:"验证仓库失败"}},gme={title:dme,searchPlaceholder:fme,allRepos:hme,newTask:pme,createModal:mme},vme="设置",yme={server:"服务器",serverDefaults:"服务器与默认设置",paths:"路径",authentication:"身份验证",editor:"编辑器",integrations:"集成",zai:"z.ai",notifications:"通知",appearance:"外观",developer:"开发者"},bme={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":"深色(色盲友好)"}}},_me={enable:"启用通知",sound:"声音",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"应用令牌",userKey:"用户密钥",testSuccess:"{{channel}} 测试成功",testFailed:"{{channel}} 测试失败:{{error}}",uploadSound:"上传自定义声音",deleteSound:"删除自定义声音",testSound:"测试声音",soundUploaded:"自定义声音已上传",soundUploadFailed:"上传声音失败:{{error}}",soundDeleted:"自定义声音已删除",soundDeleteFailed:"删除自定义声音失败",customSoundActive:"使用自定义声音"},xme={restartButton:"重启 Vibora",restarting:"重启中...",restartDescription:"重新构建并重启 Vibora 服务器。如果构建失败,服务器将继续运行。",restartFailed:"重启失败",checkLogs:"构建可能失败。运行 journalctl --user -u vibora-dev 查看详情。"},Sme={title:"未保存的更改",description:"您有未保存的更改,离开此页面将丢失这些更改。",stay:"留下",leave:"离开"},wme={title:vme,sections:yme,fields:bme,notifications:_me,developer:xme,unsavedChanges:Sme},Cme="审核",Eme={pullRequests:"拉取请求",issues:"问题"},Ome={pr:{created:"我创建的",assigned:"分配给我的",reviewRequested:"待我审核",mentioned:"提及我的"},issue:{assigned:"分配给我的",created:"我创建的",mentioned:"提及我的"},allOrgs:"所有组织",allOrganizations:"所有组织",viboraReposOnly:"仅 Vibora 仓库"},Tme={tokenRequired:"需要 GitHub 令牌",tokenDescription:"要查看您的问题和拉取请求,请在设置中添加 GitHub 个人访问令牌。",requiredScopes:"所需权限:",scopes:{repo:"(用于私有仓库)",readUser:"(用于用户信息)",readOrg:"(用于组织列表)"},generateToken:"生成令牌",goToSettings:"前往设置"},kme={loading:"加载中...",failedToLoad:"加载拉取请求失败",empty:{all:"没有打开的拉取请求",created:"没有您创建的拉取请求",assigned:"没有分配给您的拉取请求",reviewRequested:"没有等待您审核的拉取请求",mentioned:"没有提及您的拉取请求"},draft:"草稿"},Ame={loading:"加载中...",failedToLoad:"加载问题失败",empty:{assigned:"没有分配给您的问题",created:"没有您创建的问题",mentioned:"没有提及您的问题"}},Rme={title:Cme,tabs:Eme,filters:Ome,github:Tme,prs:kme,issues:Ame},Pme="工作树",jme={total:"共 {{count}} 个",orphaned:"{{count}} 个孤立"},Mme={button:"清理 ({{count}})",title:"删除已完成的工作树",description:"这将永久删除 {{count}} 个工作树。",linkedTasksWillBeDeleted:"关联的任务也将被删除。",alsoDeleteLinkedTasks:"同时删除关联的任务",done:"已完成",canceled:"已取消",cannotUndo:"此操作无法撤销。"},Lme={noMatch:"没有匹配所选筛选条件的工作树。",noWorktrees:"未找到工作树。工作树在创建任务时自动生成。"},Dme={failedToLoad:"加载工作树失败:{{message}}"},Ime={title:Pme,summary:jme,cleanup:Mme,delete:{title:"删除工作树",description:"这将永久删除位于以下位置的工作树目录",linkedTaskWillBeDeleted:'关联的任务 "{{title}}" 也将被删除。',alsoDeleteLinkedTask:'同时删除关联的任务 "{{title}}"',cannotUndo:"此操作无法撤销。",button:"删除 {{count}} 个"},empty:Lme,error:Dme},Nme="监控",Bme={claude:"Claude 实例",system:"系统指标",processes:"进程",vibora:"Vibora 服务器",usage:"使用限额"},$me={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}}"},zme={cpuUsage:"CPU 使用率",memoryUsage:"内存使用率",memoryLabels:{used:"已使用",cache:"缓存/缓冲区"},diskUsage:"磁盘使用率 ({{path}})",error:"加载系统指标失败:{{message}}"},Hme={topProcesses:"热门进程",sortBy:{memory:"按内存",cpu:"按 CPU"},headers:{pid:"PID",name:"名称",command:"命令",memory:"内存"},empty:"未找到进程",error:"加载进程失败:{{message}}",containers:"容器",containersEmpty:"没有容器运行中",containersUnavailable:"Docker/Podman 不可用"},Fme={description:"运行中的 Vibora 开发服务器",instanceCount:"{{count}} 个实例运行中",headers:{port:"端口",mode:"模式",directory:"目录",ram:"内存",actions:"操作"},mode:{dev:"开发",prod:"生产"},vite:"Vite",kill:"终止",killing:"终止中...",empty:"没有 Vibora 实例运行中",error:"加载 Vibora 实例失败:{{message}}"},Ume={fiveHourBlock:"5小时配额",sevenDayRolling:"7天滚动配额",opusWeekly:"Opus 周配额",sonnetWeekly:"Sonnet 周配额",resetsIn:"{{time}}后重置",resetsAt:"{{time}}重置",weekProgress:"本周已过 {{percent}}%",unavailable:"Claude Code 使用数据不可用。请确保已登录 Claude Code。",error:"加载使用数据失败:{{message}}"},Vme={title:Nme,tabs:Bme,claude:$me,system:zme,processes:Hme,vibora:Fme,usage:Ume},Wme="任务",qme="新建终端",Gme="全部仓库",Kme={taskTerminals:Wme,newTerminal:qme,allRepos:Gme},Yme="仓库",Xme="共 {{count}} 个",Qme="新建任务",Zme="添加仓库",Jme={openInVSCode:"在 VS Code 中打开"},ege={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:"取消"},tge={noRepositories:"尚未添加任何仓库。添加一个仓库以便在创建任务时快速访问。"},rge={failedToLoad:"加载仓库失败:{{message}}"},nge={title:Yme,total:Xme,newTask:Qme,addRepository:Zme,card:Jme,delete:{title:"删除仓库",description:'这将从 Vibora 中移除 "{{name}}"。实际的仓库文件不会受到影响。',button:"删除",deleting:"删除中..."},addModal:ege,empty:tge,error:rge},ige="common",TA=["en","zh"],sge={en:{common:Ghe,navigation:Qhe,tasks:npe,settings:upe,review:vpe,worktrees:wpe,monitoring:Ppe,terminals:Npe,repositories:Jpe},zh:{common:ome,navigation:ume,tasks:gme,settings:wme,review:Rme,worktrees:Ime,monitoring:Vme,terminals:Kme,repositories:nge}};function oge(){if(typeof window<"u"){const e=localStorage.getItem("vibora-language");if(e&&TA.includes(e))return e;const t=navigator.language.split("-")[0];if(TA.includes(t))return t}return"en"}vi.use(pie).init({resources:sge,lng:oge(),fallbackLng:"en",defaultNS:ige,ns:["common","navigation","tasks","settings","review","worktrees","monitoring","terminals","repositories"],interpolation:{escapeValue:!1}});vi.on("languageChanged",e=>{typeof window<"u"&&localStorage.setItem("vibora-language",e)});function nq(){const{i18n:e}=Wt(),{data:t,isSuccess:r}=vhe(),n=Nj();k.useEffect(()=>{r&&t&&t!==e.language&&e.changeLanguage(t)},[r,t,e]);const i=k.useCallback(async s=>{if(s)await e.changeLanguage(s);else{const o=navigator.language.split("-")[0],a=TA.includes(o)?o:"en";await e.changeLanguage(a)}n.mutate({key:Ut.LANGUAGE,value:s??""})},[e,n]);return{language:e.language,savedLanguage:t,changeLanguage:i,isUpdating:n.isPending}}function iq(){const{setTheme:e,resolvedTheme:t,theme:r}=op(),{data:n,isSuccess:i}=yhe(),{data:s}=bhe(),o=Nj(),a=k.useRef(void 0),l=k.useRef(!1);k.useEffect(()=>{i&&n&&n!==r&&e(n)},[i,n,r,e]),k.useEffect(()=>{if(!t)return;const h=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=h},[t]),k.useEffect(()=>{const h=l.current&&s&&a.current===!1;a.current=s,l.current=!0,t&&h&&Dt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:t})}).catch(()=>{})},[s,t]);const u=k.useCallback(h=>{if(e(h),o.mutate({key:Ut.THEME,value:h==="system"?"":h}),s){const d=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h;Dt("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:d})}).catch(()=>{})}},[e,o,s]);return{theme:r??"system",resolvedTheme:t,savedTheme:n,syncClaudeCode:s,changeTheme:u,isUpdating:o.isPending}}let aE=!1;const g4={activeTabId:null,focusedTerminals:{},currentView:null,currentTaskId:null,isTabVisible:null,viewUpdatedAt:null};function sq(){const e=Cn(),t=k.useRef(void 0),r=k.useRef({}),{data:n=g4,isLoading:i}=Rr({queryKey:["terminal-view-state"],queryFn:async()=>{const p=await fetch("/api/terminal-view-state");if(!p.ok)throw new Error("Failed to fetch terminal view state");return p.json()},staleTime:2e3}),s=Yr({mutationFn:async p=>{const v=await fetch("/api/terminal-view-state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!v.ok)throw new Error("Failed to update terminal view state");return v.json()},onSuccess:p=>{e.setQueryData(["terminal-view-state"],p)}}),o=k.useRef(s);o.current=s;const a=k.useCallback(p=>{const v=r.current;r.current={...v,...p,focusedTerminals:p.focusedTerminals||v.focusedTerminals?{...v.focusedTerminals,...p.focusedTerminals}:void 0};const S=r.current;e.setQueryData(["terminal-view-state"],_=>{const m=_??g4;return{activeTabId:S.activeTabId!==void 0?S.activeTabId:m.activeTabId,focusedTerminals:{...m.focusedTerminals,...S.focusedTerminals},currentView:S.currentView!==void 0?S.currentView:m.currentView,currentTaskId:S.currentTaskId!==void 0?S.currentTaskId:m.currentTaskId,isTabVisible:S.isTabVisible!==void 0?S.isTabVisible:m.isTabVisible,viewUpdatedAt:S.viewUpdatedAt!==void 0?S.viewUpdatedAt:m.viewUpdatedAt}}),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{o.current.mutate(r.current),r.current={}},500)},[e]),l=k.useCallback((p,v)=>{if(v===null){const S=e.getQueryData(["terminal-view-state"]);if(S){const{[p]:_,...m}=S.focusedTerminals;a({focusedTerminals:m})}}else a({focusedTerminals:{[p]:v}})},[e,a]),u=k.useCallback(p=>n.focusedTerminals[p]??null,[n.focusedTerminals]),h=k.useRef(!1);k.useEffect(()=>{if(aE){h.current=!1;return}aE=!0,h.current=!0;const p=()=>{a({isTabVisible:document.visibilityState==="visible",viewUpdatedAt:new Date().toISOString()})};return document.addEventListener("visibilitychange",p),p(),()=>{document.removeEventListener("visibilitychange",p),h.current&&(aE=!1)}},[a]);const d=k.useCallback((p,v,S)=>{a({currentView:p,currentTaskId:v,activeTabId:S,viewUpdatedAt:new Date().toISOString()})},[a]);return{viewState:n,isLoading:i,getFocusedTerminal:u,setFocusedTerminal:l,updateViewTracking:d}}function Vu(e,t){const r=e.toLowerCase(),n=t.toLowerCase();if(r===n)return 100;if(r.startsWith(n))return 80;if(r.includes(n))return 60;let i=0,s=0,o=0;for(;i<r.length&&s<n.length;)r[i]===n[s]&&(o+=1,s++),i++;return s===n.length?o:0}function age(e,t){return t.trim()?e.map(n=>{let i=Vu(n.label,t);if(n.keywords)for(const s of n.keywords){const o=Vu(s,t);o>i&&(i=o)}return{command:n,score:i}}).filter(({score:n})=>n>0).sort((n,i)=>i.score-n.score).map(({command:n})=>n):e}function lge(e){const t=new Map;for(const r of e){const n=t.get(r.category)||[];n.push(r),t.set(r.category,n)}return t}function cge({open:e,onOpenChange:t,onNewTask:r,onShowShortcuts:n}){const{t:i}=Wt("navigation"),[s,o]=k.useState(!1),a=e??s,l=t??o,[u,h]=k.useState(""),[d,p]=k.useState(0),v=k.useRef(null),S=k.useRef(null),_=As(),m=k.useMemo(()=>[{id:"goto-tasks",label:i("commandPalette.commands.goToTasks"),shortcut:"meta+1",keywords:["kanban","board","home"],category:"navigation",icon:y.jsx(pe,{icon:bh,size:16,strokeWidth:2}),action:()=>{_({to:"/tasks"}),l(!1)}},{id:"goto-terminals",label:i("commandPalette.commands.goToTerminals"),shortcut:"meta+2",keywords:["shell","console","cli"],category:"navigation",icon:y.jsx(pe,{icon:cce,size:16,strokeWidth:2}),action:()=>{_({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(pe,{icon:bh,size:16,strokeWidth:2}),action:()=>{_({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(pe,{icon:pce,size:16,strokeWidth:2}),action:()=>{_({to:"/worktrees"}),l(!1)}},{id:"goto-repositories",label:i("commandPalette.commands.goToRepositories"),shortcut:"meta+4",keywords:["repos","git","projects"],category:"navigation",icon:y.jsx(pe,{icon:uce,size:16,strokeWidth:2}),action:()=>{_({to:"/repositories"}),l(!1)}},{id:"goto-settings",label:i("commandPalette.commands.goToSettings"),shortcut:"meta+,",keywords:["preferences","config","configuration"],category:"navigation",icon:y.jsx(pe,{icon:VV,size:16,strokeWidth:2}),action:()=>{_({to:"/settings"}),l(!1)}},{id:"new-task",label:i("commandPalette.commands.newTask"),shortcut:"meta+j",keywords:["create","add"],category:"actions",icon:y.jsx(pe,{icon:ax,size:16,strokeWidth:2}),action:()=>{l(!1),r?.()}},{id:"show-shortcuts",label:i("commandPalette.commands.keyboardShortcuts"),shortcut:"meta+/",keywords:["help","hotkeys","keys"],category:"actions",icon:y.jsx(pe,{icon:mce,size:16,strokeWidth:2}),action:()=>{l(!1),n?.()}}],[_,r,n,l,i]),x=k.useMemo(()=>age(m,u),[m,u]),b=k.useMemo(()=>lge(x),[x]),w=k.useMemo(()=>{const T=[],R=["navigation","actions"];for(const A of R){const j=b.get(A);j&&T.push(...j)}return T},[b]);k.useEffect(()=>{p(0)},[u]),k.useEffect(()=>{if(!S.current)return;const T=S.current.querySelector('[data-selected="true"]');T&&T.scrollIntoView({block:"nearest"})},[d]),Ys("meta+k",()=>l(!0),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+1",()=>_({to:"/tasks"}),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+2",()=>_({to:"/terminals"}),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+i",()=>{_({to:"/terminals",search:{tab:"all-tasks"}})},{allowInInput:!0,allowInTerminal:!0}),Ys("meta+3",()=>_({to:"/worktrees"}),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+4",()=>_({to:"/repositories"}),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+,",()=>_({to:"/settings"}),{allowInInput:!0,allowInTerminal:!0}),Ys("meta+j",()=>{r?.()},{allowInInput:!1,deps:[r]}),Ys("meta+/",()=>{n?.()},{allowInInput:!0,allowInTerminal:!0,deps:[n]});const O=k.useCallback(T=>{switch(T.key){case"ArrowDown":T.preventDefault(),p(R=>Math.min(R+1,w.length-1));break;case"ArrowUp":T.preventDefault(),p(R=>Math.max(R-1,0));break;case"Enter":T.preventDefault(),w[d]&&w[d].action();break;case"Escape":T.preventDefault(),l(!1);break}},[w,d,l]);k.useEffect(()=>{a&&(h(""),p(0),setTimeout(()=>v.current?.focus(),50))},[a]);let E=0;return y.jsx(Ta,{open:a,onOpenChange:l,children:y.jsxs(ka,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden",showCloseButton:!1,onKeyDown:O,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(qt,{ref:v,value:u,onChange:T=>h(T.target.value),placeholder:i("commandPalette.placeholder"),className:"border-0 ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 px-0 h-12"}),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:x.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(T=>{const R=b.get(T);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.${T}`)}),R.map(A=>{const j=E++,I=j===d;return y.jsxs("button",{"data-selected":I,onClick:()=>A.action(),onMouseEnter:()=>p(j),className:Me("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm",I?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[A.icon&&y.jsx("span",{className:"text-muted-foreground",children:A.icon}),y.jsx("span",{className:"flex-1 text-left",children:A.label}),A.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:GV(A.shortcut)})]},A.id)})]},T)})})})]})})}const v4={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 uge({className:e,rows:t=100,cols:r=10,tileClassName:n,tileSize:i="md"}){return y.jsx("div",{className:Me("relative z-0 flex w-full h-full justify-center",e),children:Array.from({length:t}).map((s,o)=>y.jsx("div",{className:Me(v4[i],"border-l dark:border-neutral-900 border-neutral-200 relative",n),children:Array.from({length:r}).map((a,l)=>y.jsx("div",{className:Me(v4[i],"border-r border-t dark:border-neutral-900 border-neutral-200 relative hover:bg-tile transition-colors",n)},`col-${l}`))},`row-${o}`))})}const dge=["/","/tasks","/terminals","/worktrees","/repositories","/review","/monitoring","/settings"];function fge(){const e=In({select:r=>r.location.pathname});return dge.some(r=>e===r||e.startsWith(r+"/"))?y.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none -z-10",children:y.jsx(uge,{rows:100,cols:50,tileSize:"sm"})}):null}const hge=[{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 pge({open:e,onOpenChange:t}){const{t:r}=Wt("navigation");return y.jsx(Ta,{open:e,onOpenChange:t,children:y.jsxs(ka,{className:"sm:max-w-md",children:[y.jsx(jl,{children:y.jsx(Ml,{children:r("shortcuts.title")})}),y.jsx("div",{className:"space-y-4 mt-2",children:hge.map(n=>y.jsxs("div",{children:[y.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:r(`shortcuts.groups.${n.titleKey}`)}),y.jsx("div",{className:"space-y-1",children:n.items.map(i=>y.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[y.jsx("span",{className:"text-sm",children:r(`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:GV(i.shortcut)})]},i.shortcut))})]},n.titleKey))})]})})}const mge=({...e})=>{const{resolvedTheme:t}=op();return y.jsx(Nue,{theme:t,className:"toaster group",icons:{success:y.jsx(pe,{icon:lce,strokeWidth:2,className:"size-4"}),info:y.jsx(pe,{icon:yce,strokeWidth:2,className:"size-4"}),warning:y.jsx(pe,{icon:Bd,strokeWidth:2,className:"size-4"}),error:y.jsx(pe,{icon:wce,strokeWidth:2,className:"size-4"}),loading:y.jsx(pe,{icon:sr,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})},Ho=Lre({component:xge});function gge(){return zhe(),null}function vge(){return nq(),null}function yge(){return iq(),null}function bge(){const e=In({select:r=>r.location}),{updateViewTracking:t}=sq();return k.useEffect(()=>{const r=e.pathname;let n="other",i=null,s=null;r.startsWith("/tasks/")?(n="task-detail",i=r.split("/")[2]||null):r==="/terminals"&&(n="terminals",s=new URLSearchParams(e.search).get("tab")),t(n,i,s)},[e.pathname,e.search,t]),null}function _ge(){const e=In({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 xge(){const[e,t]=k.useState(null),[r,n]=k.useState(!1),[i,s]=k.useState(!1),o=k.useCallback(h=>{t(()=>h)},[]),a=k.useCallback(()=>{e?.()},[e]),l=k.useCallback(()=>{n(!0)},[]),u=k.useCallback(()=>{s(!0)},[]);return y.jsx(Nce,{children:y.jsxs("div",{className:"flex h-screen flex-col overflow-x-hidden bg-background text-foreground",children:[y.jsx(gge,{}),y.jsx(vge,{}),y.jsx(yge,{}),y.jsx(bge,{}),y.jsx(_ge,{}),y.jsx(Ihe,{onNewTaskRef:o,onOpenCommandPalette:u}),y.jsxs("main",{className:"isolate flex-1 overflow-hidden relative",children:[y.jsx(fge,{}),y.jsx(LF,{})]}),y.jsx(cge,{open:i,onOpenChange:s,onNewTask:a,onShowShortcuts:l}),y.jsx(pge,{open:r,onOpenChange:n}),y.jsx(mge,{position:"bottom-right"})]})})}const Sge=lo("/")({beforeLoad:()=>{throw yF({to:"/tasks"})}}),oq="";function aq(){const[e,t]=k.useState(new Map),[r,n]=k.useState(null),[i,s]=k.useState(!0),[o,a]=k.useState(!1),[l,u]=k.useState(null),h=k.useRef(null),d=k.useRef(0),p=k.useCallback(()=>{h.current?.close(),s(!0),a(!1),u(null),t(new Map),n(null);const S=new EventSource(`${oq}/api/worktrees`);h.current=S,S.addEventListener("worktree:basic",_=>{const m=JSON.parse(_.data);d.current=m.length,t(new Map(m.map(x=>[x.path,{...x,size:0,sizeFormatted:"...",branch:"..."}]))),s(!1),a(m.length>0)}),S.addEventListener("worktree:details",_=>{const m=JSON.parse(_.data);t(x=>{const b=new Map(x),w=b.get(m.path);return w&&b.set(m.path,{...w,size:m.size,sizeFormatted:m.sizeFormatted,branch:m.branch}),b}),d.current--,d.current<=0&&a(!1)}),S.addEventListener("worktree:complete",_=>{const m=JSON.parse(_.data);n(m),a(!1),S.close()}),S.addEventListener("worktree:error",_=>{const{path:m}=JSON.parse(_.data);Tt.viewer.error("Error loading worktree details",{path:m}),d.current--,d.current<=0&&a(!1)}),S.onerror=()=>{u(new Error("Connection lost")),s(!1),a(!1),S.close()}},[]);return k.useEffect(()=>(p(),()=>{h.current?.close()}),[p]),{worktrees:k.useMemo(()=>Array.from(e.values()).sort((_,m)=>_.isOrphaned!==m.isOrphaned?_.isOrphaned?-1:1:new Date(m.lastModified).getTime()-new Date(_.lastModified).getTime()),[e]),summary:r,isLoading:i,isLoadingDetails:o,error:l,refetch:p}}function lq(){const e=Cn();return Yr({mutationFn:({worktreePath:t,repoPath:r,deleteLinkedTask:n})=>Dt(`${oq}/api/worktrees`,{method:"DELETE",body:JSON.stringify({worktreePath:t,repoPath:r,deleteLinkedTask:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worktrees"]}),e.invalidateQueries({queryKey:["tasks"]})}})}const wge=nu("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 Po({className:e,variant:t="default",render:r,...n}){return Ffe({defaultTagName:"span",props:ya({className:Me(wge({className:e,variant:t}))},n),render:r,state:{slot:"badge",variant:t}})}function Zi({className:e,size:t="default",...r}){return y.jsx("div",{"data-slot":"card","data-size":t,className:Me("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),...r})}function Cge({className:e,...t}){return y.jsx("div",{"data-slot":"card-header",className:Me("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 Ege({className:e,...t}){return y.jsx("div",{"data-slot":"card-title",className:Me("text-sm font-medium",e),...t})}function mp({className:e,...t}){return y.jsx("div",{"data-slot":"card-content",className:Me("px-4 group-data-[size=sm]/card:px-3",e),...t})}function Uc({...e}){return y.jsx(xde,{"data-slot":"alert-dialog",...e})}function Vc({...e}){return y.jsx(nW,{"data-slot":"alert-dialog-trigger",...e})}function Oge({...e}){return y.jsx(JV,{"data-slot":"alert-dialog-portal",...e})}function Tge({className:e,...t}){return y.jsx(YV,{"data-slot":"alert-dialog-overlay",className:Me("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 Wc({className:e,size:t="default",...r}){return y.jsxs(Oge,{children:[y.jsx(Tge,{}),y.jsx(ZV,{"data-slot":"alert-dialog-content","data-size":t,className:Me("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),...r})]})}function qc({className:e,...t}){return y.jsx("div",{"data-slot":"alert-dialog-header",className:Me("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 Gc({className:e,...t}){return y.jsx("div",{"data-slot":"alert-dialog-footer",className:Me("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 Kc({className:e,...t}){return y.jsx(rW,{"data-slot":"alert-dialog-title",className:Me("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 Yc({className:e,...t}){return y.jsx(XV,{"data-slot":"alert-dialog-description",className:Me("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...t})}function cq({className:e,...t}){return y.jsx(Ne,{"data-slot":"alert-dialog-action",className:Me(e),...t})}function Xc({className:e,variant:t="outline",size:r="default",...n}){return y.jsx(lx,{"data-slot":"alert-dialog-cancel",className:Me(e),render:y.jsx(Ne,{variant:t,size:r}),...n})}const _a=k.forwardRef(({className:e,...t},r)=>y.jsx(Xde,{ref:r,className:Me("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(Qde,{className:"flex items-center justify-center",children:y.jsx(pe,{icon:Rl,size:12,strokeWidth:3})})}));_a.displayName="Checkbox";const kA={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"},kge=lo("/worktrees/")({component:jge});function Age(){const{t:e}=Wt("common");return t=>{const r=new Date(t),i=new Date().getTime()-r.getTime(),s=Math.floor(i/1e3),o=Math.floor(s/60),a=Math.floor(o/60),l=Math.floor(a/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):a>0?a===1?e("time.hourAgo"):e("time.hoursAgo",{count:a}):o>0?o===1?e("time.minuteAgo"):e("time.minutesAgo",{count:o}):e("time.justNow")}}function y4({className:e}){return y.jsx("span",{className:`inline-block animate-pulse rounded bg-muted ${e}`})}function Rge({worktree:e,onDelete:t}){const{t:r}=Wt("common"),{t:n}=Wt("worktrees"),i=Age(),[s,o]=k.useState(!1),[a,l]=k.useState(!1),[u,h]=k.useState(!1),d=e.sizeFormatted==="..."||e.branch==="...",p=!e.isOrphaned&&e.taskId,v=async()=>{l(!0);try{await t(e,u),o(!1)}catch{}finally{l(!1)}},S=_=>{o(_),_||h(!1)};return y.jsx(Zi,{className:"transition-colors hover:border-border/80",children:y.jsxs(mp,{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(Po,{className:Me("shrink-0",kA.ORPHANED),children:r("statuses.ORPHANED")}):e.taskStatus?y.jsx(Po,{className:Me("shrink-0",kA[e.taskStatus]),children:r(`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(pe,{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(pe,{icon:i_,size:12,strokeWidth:2,className:"shrink-0"}),e.branch==="..."?y.jsx(y4,{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(pe,{icon:HV,size:12,strokeWidth:2,className:"shrink-0"}),e.sizeFormatted==="..."?y.jsx(y4,{className:"h-3 w-12"}):y.jsx("span",{children:e.sizeFormatted})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[y.jsx(pe,{icon:BV,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(hi,{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(pe,{icon:Iv,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),y.jsxs(Uc,{open:s,onOpenChange:S,children:[y.jsx(Vc,{render:y.jsx(Ne,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:d}),children:y.jsx(pe,{icon:pp,size:14,strokeWidth:2})}),y.jsxs(Wc,{children:[y.jsxs(qc,{children:[y.jsx(Kc,{children:n("delete.title")}),y.jsxs(Yc,{children:[n("delete.description")," ",y.jsx("span",{className:"font-mono",children:e.name}),".",u&&p&&y.jsxs(y.Fragment,{children:[" ",n("delete.linkedTaskWillBeDeleted",{title:e.taskTitle})]})," ",n("delete.cannotUndo")]}),p&&y.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[y.jsx(_a,{checked:u,onCheckedChange:_=>h(_===!0),disabled:a}),n("delete.alsoDeleteLinkedTask",{title:e.taskTitle})]})]}),y.jsxs(Gc,{children:[y.jsx(Xc,{disabled:a,children:r("buttons.cancel")}),y.jsxs(Ne,{variant:"destructive",onClick:v,disabled:a,className:"gap-2",children:[a&&y.jsx(pe,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}),r(a?"status.deleting":"buttons.delete")]})]})]})]})]})})}const Pge=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function jge(){const{t:e}=Wt("common"),{t}=Wt("worktrees"),{worktrees:r,summary:n,isLoading:i,isLoadingDetails:s,error:o,refetch:a}=aq(),l=lq(),[u,h]=k.useState(new Set),[d,p]=k.useState(!1),[v,S]=k.useState(!1),[_,m]=k.useState(!1),x=A=>{h(j=>{const I=new Set(j);return I.has(A)?I.delete(A):I.add(A),I})},b=()=>{h(new Set)},w=k.useMemo(()=>u.size===0?r:r.filter(A=>!!(A.isOrphaned&&u.has("ORPHANED")||A.taskStatus&&u.has(A.taskStatus))),[r,u]),O=k.useMemo(()=>r.filter(A=>A.taskStatus==="DONE"||A.taskStatus==="CANCELED"),[r]),E=async()=>{if(O.length!==0){S(!0);try{for(const A of O)await l.mutateAsync({worktreePath:A.path,repoPath:A.repoPath,deleteLinkedTask:_});p(!1),a()}catch{}finally{S(!1)}}},T=A=>{p(A),A||m(!1)},R=async(A,j)=>{await l.mutateAsync({worktreePath:A.path,repoPath:A.repoPath,deleteLinkedTask:j}),a()};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")}),(n||r.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:n?.total??r.length})}),(n?.orphaned??r.filter(A=>A.isOrphaned).length)>0&&y.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:n?.orphaned??r.filter(A=>A.isOrphaned).length})}),s?y.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):n?y.jsx("span",{children:n.totalSizeFormatted}):null]})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[O.length>0&&y.jsxs(Uc,{open:d,onOpenChange:T,children:[y.jsxs(Vc,{render:y.jsx(Ne,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:s}),children:[y.jsx(pe,{icon:$V,size:12,strokeWidth:2}),t("cleanup.button",{count:O.length})]}),y.jsxs(Wc,{children:[y.jsxs(qc,{children:[y.jsx(Kc,{children:t("cleanup.title")}),y.jsxs(Yc,{children:[t("cleanup.description",{count:O.length}),_&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),y.jsxs("div",{className:"space-y-3",children:[y.jsxs("p",{className:"text-sm text-muted-foreground",children:[O.filter(A=>A.taskStatus==="DONE").length>0&&y.jsxs("span",{className:"mr-3",children:[y.jsx("span",{className:"font-medium text-accent",children:O.filter(A=>A.taskStatus==="DONE").length})," ",t("cleanup.done")]}),O.filter(A=>A.taskStatus==="CANCELED").length>0&&y.jsxs("span",{children:[y.jsx("span",{className:"font-medium text-destructive",children:O.filter(A=>A.taskStatus==="CANCELED").length})," ",t("cleanup.canceled")]})]}),y.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[y.jsx(_a,{checked:_,onCheckedChange:A=>m(A===!0),disabled:v}),t("cleanup.alsoDeleteLinkedTasks")]}),y.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),y.jsxs(Gc,{children:[y.jsx(Xc,{disabled:v,children:e("buttons.cancel")}),y.jsxs(Ne,{variant:"destructive",onClick:E,disabled:v,className:"gap-2",children:[v&&y.jsx(pe,{icon:sr,size:14,strokeWidth:2,className:"animate-spin"}),v?e("status.deleting"):t("delete.button",{count:O.length})]})]})]})]}),u.size>0&&y.jsxs(Ne,{variant:"ghost",size:"sm",onClick:b,className:"gap-1.5 text-xs",children:[y.jsx(pe,{icon:es,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),y.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:Pge.map(A=>{const j=u.has(A);return y.jsx("button",{onClick:()=>x(A),className:Me("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",j?kA[A]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${A}`)},A)})})]}),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(pe,{icon:sr,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),o&&y.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[y.jsx(pe,{icon:Bd,size:20,strokeWidth:2}),y.jsx("span",{className:"text-sm",children:t("error.failedToLoad",{message:o.message})})]}),!i&&!o&&w.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:w.map(A=>y.jsx(Rge,{worktree:A,onDelete:R},A.path))})]})]})}function Vt(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(r.length?" "+r.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var Mge={};function xx(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:Mge}var uq=Object.assign,c_=Object.getOwnPropertyDescriptor,ua=Object.defineProperty,Sx=Object.prototype,AA=[];Object.freeze(AA);var $j={};Object.freeze($j);var Lge=typeof Proxy<"u",Dge=Object.toString();function dq(){Lge||Vt("Proxy not available")}function fq(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Vf=function(){};function Ts(e){return typeof e=="function"}function kd(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function wx(e){return e!==null&&typeof e=="object"}function Qc(e){if(!wx(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r.toString()===Dge}function hq(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Cx(e,t,r){ua(e,t,{enumerable:!1,writable:!0,configurable:!0,value:r})}function pq(e,t,r){ua(e,t,{enumerable:!1,writable:!1,configurable:!0,value:r})}function cu(e,t){var r="isMobX"+e;return t.prototype[r]=!0,function(n){return wx(n)&&n[r]===!0}}function gp(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function Ige(e){var t=Object.getPrototypeOf(e),r=Object.getPrototypeOf(t),n=Object.getPrototypeOf(r);return n===null}function cl(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var mq=typeof Object.getOwnPropertySymbols<"u";function Nge(e){var t=Object.keys(e);if(!mq)return t;var r=Object.getOwnPropertySymbols(e);return r.length?[].concat(t,r.filter(function(n){return Sx.propertyIsEnumerable.call(e,n)})):t}var Ex=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:mq?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function gq(e){return e===null?null:typeof e=="object"?""+e:e}function ml(e,t){return Sx.hasOwnProperty.call(e,t)}var Bge=Object.getOwnPropertyDescriptors||function(t){var r={};return Ex(t).forEach(function(n){r[n]=c_(t,n)}),r};function ws(e,t){return!!(e&t)}function Cs(e,t,r){return r?e|=t:e&=~t,e}function b4(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function $ge(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,Hge(n.key),n)}}function vp(e,t,r){return t&&$ge(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Wf(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=Fge(e))||t){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
27
27
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zc(){return Zc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Zc.apply(null,arguments)}function vq(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,RA(e,t)}function RA(e,t){return RA=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,n){return r.__proto__=n,r},RA(e,t)}function zge(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Hge(e){var t=zge(e,"string");return typeof t=="symbol"?t:t+""}function Fge(e,t){if(e){if(typeof e=="string")return b4(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?b4(e,t):void 0}}var sa=Symbol("mobx-stored-annotations");function da(e){function t(r,n){if(Wv(n))return e.decorate_20223_(r,n);Vv(r,n,e)}return Object.assign(t,e)}function Vv(e,t,r){ml(e,sa)||Cx(e,sa,Zc({},e[sa])),Yge(r)||(e[sa][t]=r)}function Uge(e){return ml(e,sa)||Cx(e,sa,Zc({},e[sa])),e[sa]}function Wv(e){return typeof e=="object"&&typeof e.kind=="string"}var xt=Symbol("mobx administration"),uu=(function(){function e(r){r===void 0&&(r="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=ur.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=r}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(n){return n()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(n){return n()})},t.reportObserved=function(){return Lq(this)},t.reportChanged=function(){Gi(),Dq(this),Ki()},t.toString=function(){return this.name_},vp(e,[{key:"isBeingObserved",get:function(){return ws(this.flags_,e.isBeingObservedMask_)},set:function(n){this.flags_=Cs(this.flags_,e.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return ws(this.flags_,e.isPendingUnobservationMask_)},set:function(n){this.flags_=Cs(this.flags_,e.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return ws(this.flags_,e.diffValueMask_)?1:0},set:function(n){this.flags_=Cs(this.flags_,e.diffValueMask_,n===1)}}])})();uu.isBeingObservedMask_=1;uu.isPendingUnobservationMask_=2;uu.diffValueMask_=4;var zj=cu("Atom",uu);function u_(e,t,r){t===void 0&&(t=Vf),r===void 0&&(r=Vf);var n=new uu(e);return t!==Vf&&Jve(n,t),r!==Vf&&Uq(n,r),n}function Vge(e,t){return oG(e,t)}function Wge(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Sh={structural:Vge,default:Wge};function Ad(e,t,r){return Kq(e)?e:Array.isArray(e)?qr.array(e,{name:r}):Qc(e)?qr.object(e,void 0,{name:r}):gp(e)?qr.map(e,{name:r}):cl(e)?qr.set(e,{name:r}):typeof e=="function"&&!wh(e)&&!Tg(e)?hq(e)?Ch(e):Og(r,e):e}function qge(e,t,r){if(e==null||Uo(e)||Pa(e)||po(e)||Mi(e))return e;if(Array.isArray(e))return qr.array(e,{name:r,deep:!1});if(Qc(e))return qr.object(e,void 0,{name:r,deep:!1});if(gp(e))return qr.map(e,{name:r,deep:!1});if(cl(e))return qr.set(e,{name:r,deep:!1})}function Ox(e){return e}function Gge(e,t){return oG(e,t)?t:e}var Kge="override";function Yge(e){return e.annotationType_===Kge}function qv(e,t){return{annotationType_:e,options_:t,make_:Xge,extend_:Qge,decorate_20223_:Zge}}function Xge(e,t,r,n){var i;if((i=this.options_)!=null&&i.bound)return this.extend_(e,t,r,!1)===null?0:1;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if(wh(r.value))return 1;var s=yq(e,this,t,r,!1);return ua(n,t,s),2}function Qge(e,t,r,n){var i=yq(e,this,t,r);return e.defineProperty_(t,i,n)}function Zge(e,t){var r=t.kind,n=t.name,i=t.addInitializer,s=this,o=function(u){var h,d,p,v;return Jc((h=(d=s.options_)==null?void 0:d.name)!=null?h:n.toString(),u,(p=(v=s.options_)==null?void 0:v.autoAction)!=null?p:!1)};if(r=="field")return function(l){var u,h=l;return wh(h)||(h=o(h)),(u=s.options_)!=null&&u.bound&&(h=h.bind(this),h.isMobxAction=!0),h};if(r=="method"){var a;return wh(e)||(e=o(e)),(a=this.options_)!=null&&a.bound&&i(function(){var l=this,u=l[n].bind(l);u.isMobxAction=!0,l[n]=u}),e}Vt("Cannot apply '"+s.annotationType_+"' to '"+String(n)+"' (kind: "+r+"):"+(`
28
28
  '`+s.annotationType_+"' can only be used on properties with a function value."))}function Jge(e,t,r,n){t.annotationType_,n.value}function yq(e,t,r,n,i){var s,o,a,l,u,h,d;i===void 0&&(i=qe.safeDescriptors),Jge(e,t,r,n);var p=n.value;if((s=t.options_)!=null&&s.bound){var v;p=p.bind((v=e.proxy_)!=null?v:e.target_)}return{value:Jc((o=(a=t.options_)==null?void 0:a.name)!=null?o:r.toString(),p,(l=(u=t.options_)==null?void 0:u.autoAction)!=null?l:!1,(h=t.options_)!=null&&h.bound?(d=e.proxy_)!=null?d:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function bq(e,t){return{annotationType_:e,options_:t,make_:eve,extend_:tve,decorate_20223_:rve}}function eve(e,t,r,n){var i;if(n===e.target_)return this.extend_(e,t,r,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!ml(e.target_,t)||!Tg(e.target_[t]))&&this.extend_(e,t,r,!1)===null)return 0;if(Tg(r.value))return 1;var s=_q(e,this,t,r,!1,!1);return ua(n,t,s),2}function tve(e,t,r,n){var i,s=_q(e,this,t,r,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,s,n)}function rve(e,t){var r,n=t.name,i=t.addInitializer;return Tg(e)||(e=Ch(e)),(r=this.options_)!=null&&r.bound&&i(function(){var s=this,o=s[n].bind(s);o.isMobXFlow=!0,s[n]=o}),e}function nve(e,t,r,n){t.annotationType_,n.value}function _q(e,t,r,n,i,s){s===void 0&&(s=qe.safeDescriptors),nve(e,t,r,n);var o=n.value;if(Tg(o)||(o=Ch(o)),i){var a;o=o.bind((a=e.proxy_)!=null?a:e.target_),o.isMobXFlow=!0}return{value:o,configurable:s?e.isPlainObject_:!0,enumerable:!1,writable:!s}}function Hj(e,t){return{annotationType_:e,options_:t,make_:ive,extend_:sve,decorate_20223_:ove}}function ive(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function sve(e,t,r,n){return ave(e,this,t,r),e.defineComputedProperty_(t,Zc({},this.options_,{get:r.get,set:r.set}),n)}function ove(e,t){var r=this,n=t.name,i=t.addInitializer;return i(function(){var s=bp(this)[xt],o=Zc({},r.options_,{get:e,context:this});o.name||(o.name="ObservableObject."+n.toString()),s.values_.set(n,new Io(o))}),function(){return this[xt].getObservablePropValue_(n)}}function ave(e,t,r,n){t.annotationType_,n.get}function Tx(e,t){return{annotationType_:e,options_:t,make_:lve,extend_:cve,decorate_20223_:uve}}function lve(e,t,r){return this.extend_(e,t,r,!1)===null?0:1}function cve(e,t,r,n){var i,s;return dve(e,this),e.defineObservableProperty_(t,r.value,(i=(s=this.options_)==null?void 0:s.enhancer)!=null?i:Ad,n)}function uve(e,t){var r=this,n=t.kind,i=t.name,s=new WeakSet;function o(a,l){var u,h,d=bp(a)[xt],p=new $c(l,(u=(h=r.options_)==null?void 0:h.enhancer)!=null?u:Ad,"ObservableObject."+i.toString(),!1);d.values_.set(i,p),s.add(a)}if(n=="accessor")return{get:function(){return s.has(this)||o(this,e.get.call(this)),this[xt].getObservablePropValue_(i)},set:function(l){return s.has(this)||o(this,l),this[xt].setObservablePropValue_(i,l)},init:function(l){return s.has(this)||o(this,l),l}}}function dve(e,t,r,n){t.annotationType_}var fve="true",hve=xq();function xq(e){return{annotationType_:fve,options_:e,make_:pve,extend_:mve,decorate_20223_:gve}}function pve(e,t,r,n){var i,s;if(r.get)return yp.make_(e,t,r,n);if(r.set){var o=wh(r.set)?r.set:Jc(t.toString(),r.set);return n===e.target_?e.defineProperty_(t,{configurable:qe.safeDescriptors?e.isPlainObject_:!0,set:o})===null?0:2:(ua(n,t,{configurable:!0,set:o}),2)}if(n!==e.target_&&typeof r.value=="function"){var a;if(hq(r.value)){var l,u=(l=this.options_)!=null&&l.autoBind?Ch.bound:Ch;return u.make_(e,t,r,n)}var h=(a=this.options_)!=null&&a.autoBind?Og.bound:Og;return h.make_(e,t,r,n)}var d=((i=this.options_)==null?void 0:i.deep)===!1?qr.ref:qr;if(typeof r.value=="function"&&(s=this.options_)!=null&&s.autoBind){var p;r.value=r.value.bind((p=e.proxy_)!=null?p:e.target_)}return d.make_(e,t,r,n)}function mve(e,t,r,n){var i,s;if(r.get)return yp.extend_(e,t,r,n);if(r.set)return e.defineProperty_(t,{configurable:qe.safeDescriptors?e.isPlainObject_:!0,set:Jc(t.toString(),r.set)},n);if(typeof r.value=="function"&&(i=this.options_)!=null&&i.autoBind){var o;r.value=r.value.bind((o=e.proxy_)!=null?o:e.target_)}var a=((s=this.options_)==null?void 0:s.deep)===!1?qr.ref:qr;return a.extend_(e,t,r,n)}function gve(e,t){Vt("'"+this.annotationType_+"' cannot be used as a decorator")}var vve="observable",yve="observable.ref",bve="observable.shallow",_ve="observable.struct",Sq={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Sq);function Kb(e){return e||Sq}var PA=Tx(vve),xve=Tx(yve,{enhancer:Ox}),Sve=Tx(bve,{enhancer:qge}),wve=Tx(_ve,{enhancer:Gge}),wq=da(PA);function Yb(e){return e.deep===!0?Ad:e.deep===!1?Ox:Eve(e.defaultDecorator)}function Cve(e){var t;return e?(t=e.defaultDecorator)!=null?t:xq(e):void 0}function Eve(e){var t,r;return e&&(t=(r=e.options_)==null?void 0:r.enhancer)!=null?t:Ad}function Cq(e,t,r){if(Wv(t))return PA.decorate_20223_(e,t);if(kd(t)){Vv(e,t,PA);return}return Kq(e)?e:Qc(e)?qr.object(e,t,r):Array.isArray(e)?qr.array(e,t):gp(e)?qr.map(e,t):cl(e)?qr.set(e,t):typeof e=="object"&&e!==null?e:qr.box(e,t)}uq(Cq,wq);var Ove={box:function(t,r){var n=Kb(r);return new $c(t,Yb(n),n.name,!0,n.equals)},array:function(t,r){var n=Kb(r);return(qe.useProxies===!1||n.proxy===!1?Aye:bye)(t,Yb(n),n.name)},map:function(t,r){var n=Kb(r);return new qj(t,Yb(n),n.name)},set:function(t,r){var n=Kb(r);return new tG(t,Yb(n),n.name)},object:function(t,r,n){return Vd(function(){return nye(qe.useProxies===!1||n?.proxy===!1?bp({},n):gye({},n),t,r)})},ref:da(xve),shallow:da(Sve),deep:wq,struct:da(wve)},qr=uq(Cq,Ove),Eq="computed",Tve="computed.struct",jA=Hj(Eq),kve=Hj(Tve,{equals:Sh.structural}),yp=function(t,r){if(Wv(r))return jA.decorate_20223_(t,r);if(kd(r))return Vv(t,r,jA);if(Qc(t))return da(Hj(Eq,t));var n=Qc(r)?r:{};return n.get=t,n.name||(n.name=t.name||""),new Io(n)};Object.assign(yp,jA);yp.struct=da(kve);var _4,x4,d_=0,Ave=1,Rve=(_4=(x4=c_(function(){},"name"))==null?void 0:x4.configurable)!=null?_4:!1,S4={value:"action",configurable:!0,writable:!1,enumerable:!1};function Jc(e,t,r,n){r===void 0&&(r=!1);function i(){return Oq(e,r,t,n||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},Rve&&(S4.value=e,ua(i,"name",S4)),i}function Oq(e,t,r,n,i){var s=Pve(e,t);try{return r.apply(n,i)}catch(o){throw s.error_=o,o}finally{jve(s)}}function Pve(e,t,r,n){var i=!1,s=0,o=qe.trackingDerivation,a=!t||!o;Gi();var l=qe.allowStateChanges;a&&(Ud(),l=kx(!0));var u=Fj(!0),h={runAsAction_:a,prevDerivation_:o,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:i,startTime_:s,actionId_:Ave++,parentActionId_:d_};return d_=h.actionId_,h}function jve(e){d_!==e.actionId_&&Vt(30),d_=e.parentActionId_,e.error_!==void 0&&(qe.suppressReactionErrors=!0),Ax(e.prevAllowStateChanges_),ig(e.prevAllowStateReads_),Ki(),e.runAsAction_&&gl(e.prevDerivation_),qe.suppressReactionErrors=!1}function Tq(e,t){var r=kx(e);try{return t()}finally{Ax(r)}}function kx(e){var t=qe.allowStateChanges;return qe.allowStateChanges=e,t}function Ax(e){qe.allowStateChanges=e}var $c=(function(e){function t(n,i,s,o,a){var l;return s===void 0&&(s="ObservableValue"),a===void 0&&(a=Sh.default),l=e.call(this,s)||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_=s,l.equals=a,l.value_=i(n,void 0,s),l}vq(t,e);var r=t.prototype;return r.dehanceValue=function(i){return this.dehancer!==void 0?this.dehancer(i):i},r.set=function(i){this.value_,i=this.prepareNewValue_(i),i!==qe.UNCHANGED&&this.setNewValue_(i)},r.prepareNewValue_=function(i){if(Js(this)){var s=eo(this,{object:this,type:fa,newValue:i});if(!s)return qe.UNCHANGED;i=s.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?qe.UNCHANGED:i},r.setNewValue_=function(i){var s=this.value_;this.value_=i,this.reportChanged(),jo(this)&&Mo(this,{type:fa,object:this,newValue:i,oldValue:s})},r.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},r.intercept_=function(i){return Gv(this,i)},r.observe_=function(i,s){return s&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:fa,newValue:this.value_,oldValue:void 0}),Kv(this,i)},r.raw=function(){return this.value_},r.toJSON=function(){return this.get()},r.toString=function(){return this.name_+"["+this.value_+"]"},r.valueOf=function(){return gq(this.get())},r[Symbol.toPrimitive]=function(){return this.valueOf()},t})(uu),Mve=cu("ObservableValue",$c),Io=(function(){function e(r){this.dependenciesState_=ur.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=ur.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new h_(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=f_.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,r.get||Vt(31),this.derivation=r.get,this.name_=r.name||"ComputedValue",r.set&&(this.setter_=Jc("ComputedValue-setter",r.set)),this.equals_=r.equals||(r.compareStructural||r.struct?Sh.structural:Sh.default),this.scope_=r.context,this.requiresReaction_=r.requiresReaction,this.keepAlive_=!!r.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){$ve(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(n){return n()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(n){return n()})},t.get=function(){if(this.isComputing&&Vt(32,this.name_,this.derivation),qe.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)MA(this)&&(this.warnAboutUntrackedRead_(),Gi(),this.value_=this.computeValue_(!1),Ki());else if(Lq(this),MA(this)){var n=qe.trackingContext;this.keepAlive_&&!n&&(qe.trackingContext=this),this.trackAndCompute()&&Bve(this),qe.trackingContext=n}var i=this.value_;if(T0(i))throw i.cause;return i},t.set=function(n){if(this.setter_){this.isRunningSetter&&Vt(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,n)}finally{this.isRunningSetter=!1}}else Vt(34,this.name_)},t.trackAndCompute=function(){var n=this.value_,i=this.dependenciesState_===ur.NOT_TRACKING_,s=this.computeValue_(!0),o=i||T0(n)||T0(s)||!this.equals_(n,s);return o&&(this.value_=s),o},t.computeValue_=function(n){this.isComputing=!0;var i=kx(!1),s;if(n)s=kq(this,this.derivation,this.scope_);else if(qe.disableErrorBoundaries===!0)s=this.derivation.call(this.scope_);else try{s=this.derivation.call(this.scope_)}catch(o){s=new h_(o)}return Ax(i),this.isComputing=!1,s},t.suspend_=function(){this.keepAlive_||(LA(this),this.value_=void 0)},t.observe_=function(n,i){var s=this,o=!0,a=void 0;return Hq(function(){var l=s.get();if(!o||i){var u=Ud();n({observableKind:"computed",debugObjectName:s.name_,type:fa,object:s,newValue:l,oldValue:a}),gl(u)}o=!1,a=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return gq(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},vp(e,[{key:"isComputing",get:function(){return ws(this.flags_,e.isComputingMask_)},set:function(n){this.flags_=Cs(this.flags_,e.isComputingMask_,n)}},{key:"isRunningSetter",get:function(){return ws(this.flags_,e.isRunningSetterMask_)},set:function(n){this.flags_=Cs(this.flags_,e.isRunningSetterMask_,n)}},{key:"isBeingObserved",get:function(){return ws(this.flags_,e.isBeingObservedMask_)},set:function(n){this.flags_=Cs(this.flags_,e.isBeingObservedMask_,n)}},{key:"isPendingUnobservation",get:function(){return ws(this.flags_,e.isPendingUnobservationMask_)},set:function(n){this.flags_=Cs(this.flags_,e.isPendingUnobservationMask_,n)}},{key:"diffValue",get:function(){return ws(this.flags_,e.diffValueMask_)?1:0},set:function(n){this.flags_=Cs(this.flags_,e.diffValueMask_,n===1)}}])})();Io.isComputingMask_=1;Io.isRunningSetterMask_=2;Io.isBeingObservedMask_=4;Io.isPendingUnobservationMask_=8;Io.diffValueMask_=16;var Rx=cu("ComputedValue",Io),ur;(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_"})(ur||(ur={}));var f_;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(f_||(f_={}));var h_=function(t){this.cause=void 0,this.cause=t};function T0(e){return e instanceof h_}function MA(e){switch(e.dependenciesState_){case ur.UP_TO_DATE_:return!1;case ur.NOT_TRACKING_:case ur.STALE_:return!0;case ur.POSSIBLY_STALE_:{for(var t=Fj(!0),r=Ud(),n=e.observing_,i=n.length,s=0;s<i;s++){var o=n[s];if(Rx(o)){if(qe.disableErrorBoundaries)o.get();else try{o.get()}catch{return gl(r),ig(t),!0}if(e.dependenciesState_===ur.STALE_)return gl(r),ig(t),!0}}return Rq(e),gl(r),ig(t),!1}}}function kq(e,t,r){var n=Fj(!0);Rq(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++qe.runId;var i=qe.trackingDerivation;qe.trackingDerivation=e,qe.inBatch++;var s;if(qe.disableErrorBoundaries===!0)s=t.call(r);else try{s=t.call(r)}catch(o){s=new h_(o)}return qe.inBatch--,qe.trackingDerivation=i,Lve(e),ig(n),s}function Lve(e){for(var t=e.observing_,r=e.observing_=e.newObserving_,n=ur.UP_TO_DATE_,i=0,s=e.unboundDepsCount_,o=0;o<s;o++){var a=r[o];a.diffValue===0&&(a.diffValue=1,i!==o&&(r[i]=a),i++),a.dependenciesState_>n&&(n=a.dependenciesState_)}for(r.length=i,e.newObserving_=null,s=t.length;s--;){var l=t[s];l.diffValue===0&&jq(l,e),l.diffValue=0}for(;i--;){var u=r[i];u.diffValue===1&&(u.diffValue=0,Nve(u,e))}n!==ur.UP_TO_DATE_&&(e.dependenciesState_=n,e.onBecomeStale_())}function LA(e){var t=e.observing_;e.observing_=[];for(var r=t.length;r--;)jq(t[r],e);e.dependenciesState_=ur.NOT_TRACKING_}function Aq(e){var t=Ud();try{return e()}finally{gl(t)}}function Ud(){var e=qe.trackingDerivation;return qe.trackingDerivation=null,e}function gl(e){qe.trackingDerivation=e}function Fj(e){var t=qe.allowStateReads;return qe.allowStateReads=e,t}function ig(e){qe.allowStateReads=e}function Rq(e){if(e.dependenciesState_!==ur.UP_TO_DATE_){e.dependenciesState_=ur.UP_TO_DATE_;for(var t=e.observing_,r=t.length;r--;)t[r].lowestObserverState_=ur.UP_TO_DATE_}}var k0=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},A0=!0,Pq=!1,qe=(function(){var e=xx();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(A0=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new k0().version&&(A0=!1),A0?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new k0):(setTimeout(function(){Pq||Vt(35)},1),new k0)})();function Dve(){if((qe.pendingReactions.length||qe.inBatch||qe.isRunningReactions)&&Vt(36),Pq=!0,A0){var e=xx();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),qe=new k0}}function Ive(){return qe}function Nve(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function jq(e,t){e.observers_.delete(t),e.observers_.size===0&&Mq(e)}function Mq(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,qe.pendingUnobservations.push(e))}function Gi(){qe.inBatch++}function Ki(){if(--qe.inBatch===0){Iq();for(var e=qe.pendingUnobservations,t=0;t<e.length;t++){var r=e[t];r.isPendingUnobservation=!1,r.observers_.size===0&&(r.isBeingObserved&&(r.isBeingObserved=!1,r.onBUO()),r instanceof Io&&r.suspend_())}qe.pendingUnobservations=[]}}function Lq(e){var t=qe.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&qe.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&qe.inBatch>0&&Mq(e),!1)}function Dq(e){e.lowestObserverState_!==ur.STALE_&&(e.lowestObserverState_=ur.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ur.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=ur.STALE_}))}function Bve(e){e.lowestObserverState_!==ur.STALE_&&(e.lowestObserverState_=ur.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ur.POSSIBLY_STALE_?t.dependenciesState_=ur.STALE_:t.dependenciesState_===ur.UP_TO_DATE_&&(e.lowestObserverState_=ur.UP_TO_DATE_)}))}function $ve(e){e.lowestObserverState_===ur.UP_TO_DATE_&&(e.lowestObserverState_=ur.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ur.UP_TO_DATE_&&(t.dependenciesState_=ur.POSSIBLY_STALE_,t.onBecomeStale_())}))}var xa=(function(){function e(r,n,i,s){r===void 0&&(r="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=ur.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=f_.NONE,this.name_=r,this.onInvalidate_=n,this.errorHandler_=i,this.requiresObservable_=s}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,qe.pendingReactions.push(this),Iq())},t.runReaction_=function(){if(!this.isDisposed){Gi(),this.isScheduled=!1;var n=qe.trackingContext;if(qe.trackingContext=this,MA(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(i){this.reportExceptionInDerivation_(i)}}qe.trackingContext=n,Ki()}},t.track=function(n){if(!this.isDisposed){Gi(),this.isRunning=!0;var i=qe.trackingContext;qe.trackingContext=this;var s=kq(this,n,void 0);qe.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&LA(this),T0(s)&&this.reportExceptionInDerivation_(s.cause),Ki()}},t.reportExceptionInDerivation_=function(n){var i=this;if(this.errorHandler_){this.errorHandler_(n,this);return}if(qe.disableErrorBoundaries)throw n;var s="[mobx] uncaught error in '"+this+"'";qe.suppressReactionErrors||console.error(s,n),qe.globalReactionErrorHandlers.forEach(function(o){return o(n,i)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Gi(),LA(this),Ki()))},t.getDisposer_=function(n){var i=this,s=function o(){i.dispose(),n==null||n.removeEventListener==null||n.removeEventListener("abort",o)};return n==null||n.addEventListener==null||n.addEventListener("abort",s),s[xt]=this,"dispose"in Symbol&&typeof Symbol.dispose=="symbol"&&(s[Symbol.dispose]=s),s},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(n){},vp(e,[{key:"isDisposed",get:function(){return ws(this.flags_,e.isDisposedMask_)},set:function(n){this.flags_=Cs(this.flags_,e.isDisposedMask_,n)}},{key:"isScheduled",get:function(){return ws(this.flags_,e.isScheduledMask_)},set:function(n){this.flags_=Cs(this.flags_,e.isScheduledMask_,n)}},{key:"isTrackPending",get:function(){return ws(this.flags_,e.isTrackPendingMask_)},set:function(n){this.flags_=Cs(this.flags_,e.isTrackPendingMask_,n)}},{key:"isRunning",get:function(){return ws(this.flags_,e.isRunningMask_)},set:function(n){this.flags_=Cs(this.flags_,e.isRunningMask_,n)}},{key:"diffValue",get:function(){return ws(this.flags_,e.diffValueMask_)?1:0},set:function(n){this.flags_=Cs(this.flags_,e.diffValueMask_,n===1)}}])})();xa.isDisposedMask_=1;xa.isScheduledMask_=2;xa.isTrackPendingMask_=4;xa.isRunningMask_=8;xa.diffValueMask_=16;var zve=100,DA=function(t){return t()};function Iq(){qe.inBatch>0||qe.isRunningReactions||DA(Hve)}function Hve(){qe.isRunningReactions=!0;for(var e=qe.pendingReactions,t=0;e.length>0;){++t===zve&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var r=e.splice(0),n=0,i=r.length;n<i;n++)r[n].runReaction_()}qe.isRunningReactions=!1}var p_=cu("Reaction",xa);function Fve(e){var t=DA;DA=function(n){return e(function(){return t(n)})}}function sg(){return!1}function Uve(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var Nq="action",Vve="action.bound",Bq="autoAction",Wve="autoAction.bound",$q="<unnamed action>",IA=qv(Nq),qve=qv(Vve,{bound:!0}),NA=qv(Bq,{autoAction:!0}),Gve=qv(Wve,{autoAction:!0,bound:!0});function zq(e){var t=function(n,i){if(Ts(n))return Jc(n.name||$q,n,e);if(Ts(i))return Jc(n,i,e);if(Wv(i))return(e?NA:IA).decorate_20223_(n,i);if(kd(i))return Vv(n,i,e?NA:IA);if(kd(n))return da(qv(e?Bq:Nq,{name:n,autoAction:e}))};return t}var Ln=zq(!1);Object.assign(Ln,IA);var Og=zq(!0);Object.assign(Og,NA);Ln.bound=da(qve);Og.bound=da(Gve);function w4(e){return Oq(e.name||$q,!1,e,this,void 0)}function wh(e){return Ts(e)&&e.isMobxAction===!0}function Hq(e,t){var r,n,i,s;t===void 0&&(t=$j);var o=(r=(n=t)==null?void 0:n.name)!=null?r:"Autorun",a=!t.scheduler&&!t.delay,l;if(a)l=new xa(o,function(){this.track(d)},t.onError,t.requiresObservable);else{var u=Fq(t),h=!1;l=new xa(o,function(){h||(h=!0,u(function(){h=!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_((s=t)==null?void 0:s.signal)}var Kve=function(t){return t()};function Fq(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Kve}function Yve(e,t,r){var n,i,s;r===void 0&&(r=$j);var o=(n=r.name)!=null?n:"Reaction",a=Ln(o,r.onError?Xve(r.onError,t):t),l=!r.scheduler&&!r.delay,u=Fq(r),h=!0,d=!1,p,v=r.compareStructural?Sh.structural:r.equals||Sh.default,S=new xa(o,function(){h||l?_():d||(d=!0,u(_))},r.onError,r.requiresObservable);function _(){if(d=!1,!S.isDisposed){var m=!1,x=p;S.track(function(){var b=Tq(!1,function(){return e(S)});m=h||!v(p,b),p=b}),(h&&r.fireImmediately||!h&&m)&&a(p,x,S),h=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||S.schedule_(),S.getDisposer_((s=r)==null?void 0:s.signal)}function Xve(e,t){return function(){try{return t.apply(this,arguments)}catch(r){e.call(this,r)}}}var Qve="onBO",Zve="onBUO";function Jve(e,t,r){return Vq(Qve,e,t,r)}function Uq(e,t,r){return Vq(Zve,e,t,r)}function Vq(e,t,r,n){var i=Eh(t),s=Ts(n)?n:r,o=e+"L";return i[o]?i[o].add(s):i[o]=new Set([s]),function(){var a=i[o];a&&(a.delete(s),a.size===0&&delete i[o])}}var eye="never",Xb="always",tye="observed";function rye(e){e.isolateGlobalState===!0&&Dve();var t=e.useProxies,r=e.enforceActions;if(t!==void 0&&(qe.useProxies=t===Xb?!0:t===eye?!1:typeof Proxy<"u"),t==="ifavailable"&&(qe.verifyProxies=!0),r!==void 0){var n=r===Xb?Xb:r===tye;qe.enforceActions=n,qe.allowStateChanges=!(n===!0||n===Xb)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(qe[i]=!!e[i])}),qe.allowStateReads=!qe.observableRequiresReaction,e.reactionScheduler&&Fve(e.reactionScheduler)}function nye(e,t,r,n){var i=Bge(t);return Vd(function(){var s=bp(e,n)[xt];Ex(i).forEach(function(o){s.extend_(o,i[o],r&&o in r?r[o]:!0)})}),e}function iye(e,t){return Wq(Eh(e,t))}function Wq(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=sye(e.observing_).map(Wq)),t}function sye(e){return Array.from(new Set(e))}var oye=0;function qq(){this.message="FLOW_CANCELLED"}qq.prototype=Object.create(Error.prototype);var lE=bq("flow"),aye=bq("flow.bound",{bound:!0}),Ch=Object.assign(function(t,r){if(Wv(r))return lE.decorate_20223_(t,r);if(kd(r))return Vv(t,r,lE);var n=t,i=n.name||"<unnamed flow>",s=function(){var a=this,l=arguments,u=++oye,h=Ln(i+" - runid: "+u+" - init",n).apply(a,l),d,p=void 0,v=new Promise(function(S,_){var m=0;d=_;function x(O){p=void 0;var E;try{E=Ln(i+" - runid: "+u+" - yield "+m++,h.next).call(h,O)}catch(T){return _(T)}w(E)}function b(O){p=void 0;var E;try{E=Ln(i+" - runid: "+u+" - yield "+m++,h.throw).call(h,O)}catch(T){return _(T)}w(E)}function w(O){if(Ts(O?.then)){O.then(w,_);return}return O.done?S(O.value):(p=Promise.resolve(O.value),p.then(x,b))}x(void 0)});return v.cancel=Ln(i+" - runid: "+u+" - cancel",function(){try{p&&C4(p);var S=h.return(void 0),_=Promise.resolve(S.value);_.then(Vf,Vf),C4(_),d(new qq)}catch(m){d(m)}}),v};return s.isMobXFlow=!0,s},lE);Ch.bound=da(aye);function C4(e){Ts(e.cancel)&&e.cancel()}function Tg(e){return e?.isMobXFlow===!0}function Gq(e,t,r){var n;return po(e)||Pa(e)||Mve(e)?n=Sa(e):Uo(e)&&(n=Sa(e,t)),n.dehancer=typeof t=="function"?t:r,function(){n.dehancer=void 0}}function Uj(e,t,r){return Ts(r)?cye(e,t,r):lye(e,t)}function lye(e,t){return Sa(e).intercept_(t)}function cye(e,t,r){return Sa(e,t).intercept_(r)}function uye(e,t){return e?Uo(e)||!!e[xt]||zj(e)||p_(e)||Rx(e):!1}function Kq(e){return uye(e)}function m_(e){if(Uo(e))return e[xt].keys_();if(po(e)||Mi(e))return Array.from(e.keys());if(Pa(e))return e.map(function(t,r){return r});Vt(5)}function Yq(e){if(Uo(e))return m_(e).map(function(t){return e[t]});if(po(e))return m_(e).map(function(t){return e.get(t)});if(Mi(e))return Array.from(e.values());if(Pa(e))return e.slice();Vt(6)}function dye(e){if(Uo(e))return m_(e).map(function(t){return[t,e[t]]});if(po(e))return m_(e).map(function(t){return[t,e.get(t)]});if(Mi(e))return Array.from(e.entries());if(Pa(e))return e.map(function(t,r){return[r,t]});Vt(7)}function Xq(e,t,r){if(arguments.length===2&&!Mi(e)){Gi();var n=t;try{for(var i in n)Xq(e,i,n[i])}finally{Ki()}return}Uo(e)?e[xt].set_(t,r):po(e)?e.set(t,r):Mi(e)?e.add(t):Pa(e)?(typeof t!="number"&&(t=parseInt(t,10)),t<0&&Vt("Invalid index: '"+t+"'"),Gi(),t>=e.length&&(e.length=t+1),e[t]=r,Ki()):Vt(8)}function Qq(e,t,r){if(Uo(e))return e[xt].defineProperty_(t,r);Vt(39)}function Vj(e,t,r,n){return Ts(r)?hye(e,t,r,n):fye(e,t,r)}function fye(e,t,r){return Sa(e).observe_(t,r)}function hye(e,t,r,n){return Sa(e,t).observe_(r,n)}function ul(e,t){t===void 0&&(t=void 0),Gi();try{return e.apply(t)}finally{Ki()}}function E4(e,t,r){return arguments.length===1||t&&typeof t=="object"?pye(e,t):Zq(e,t,{})}function Zq(e,t,r){var n;if(typeof r.timeout=="number"){var i=new Error("WHEN_TIMEOUT");n=setTimeout(function(){if(!o[xt].isDisposed)if(o(),r.onError)r.onError(i);else throw i},r.timeout)}r.name="When";var s=Jc("When-effect",t),o=Hq(function(a){var l=Tq(!1,e);l&&(a.dispose(),n&&clearTimeout(n),s())},r);return o}function pye(e,t){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var n,i,s=new Promise(function(o,a){var l,u=Zq(e,o,Zc({},t,{onError:a}));n=function(){u(),a(new Error("WHEN_CANCELLED"))},i=function(){u(),a(new Error("WHEN_ABORTED"))},t==null||(l=t.signal)==null||l.addEventListener==null||l.addEventListener("abort",i)}).finally(function(){var o;return t==null||(o=t.signal)==null||o.removeEventListener==null?void 0:o.removeEventListener("abort",i)});return s.cancel=n,s}function Nf(e){return e[xt]}var mye={has:function(t,r){return Nf(t).has_(r)},get:function(t,r){return Nf(t).get_(r)},set:function(t,r,n){var i;return kd(r)?(i=Nf(t).set_(r,n,!0))!=null?i:!0:!1},deleteProperty:function(t,r){var n;return kd(r)?(n=Nf(t).delete_(r,!0))!=null?n:!0:!1},defineProperty:function(t,r,n){var i;return(i=Nf(t).defineProperty_(r,n))!=null?i:!0},ownKeys:function(t){return Nf(t).ownKeys_()},preventExtensions:function(t){Vt(13)}};function gye(e,t){var r,n;return dq(),e=bp(e,t),(n=(r=e[xt]).proxy_)!=null?n:r.proxy_=new Proxy(e,mye)}function Js(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Gv(e,t){var r=e.interceptors_||(e.interceptors_=[]);return r.push(t),fq(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function eo(e,t){var r=Ud();try{for(var n=[].concat(e.interceptors_||[]),i=0,s=n.length;i<s&&(t=n[i](t),t&&!t.type&&Vt(14),!!t);i++);return t}finally{gl(r)}}function jo(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Kv(e,t){var r=e.changeListeners_||(e.changeListeners_=[]);return r.push(t),fq(function(){var n=r.indexOf(t);n!==-1&&r.splice(n,1)})}function Mo(e,t){var r=Ud(),n=e.changeListeners_;if(n){n=n.slice();for(var i=0,s=n.length;i<s;i++)n[i](t);gl(r)}}function Jq(e,t,r){return Vd(function(){var n,i=bp(e,r)[xt];(n=t)!=null||(t=Uge(e)),Ex(t).forEach(function(s){return i.make_(s,t[s])})}),e}var O4="splice",fa="update",vye=1e4,yye={get:function(t,r){var n=t[xt];return r===xt?n:r==="length"?n.getArrayLength_():typeof r=="string"&&!isNaN(r)?n.get_(parseInt(r)):ml(g_,r)?g_[r]:t[r]},set:function(t,r,n){var i=t[xt];return r==="length"&&i.setArrayLength_(n),typeof r=="symbol"||isNaN(r)?t[r]=n:i.set_(parseInt(r),n),!0},preventExtensions:function(){Vt(15)}},Wj=(function(){function e(r,n,i,s){r===void 0&&(r="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_=s,this.atom_=new uu(r),this.enhancer_=function(o,a){return n(o,a,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.dehanceValues_=function(n){return this.dehancer!==void 0&&n.length>0?n.map(this.dehancer):n},t.intercept_=function(n){return Gv(this,n)},t.observe_=function(n,i){return i===void 0&&(i=!1),i&&n({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Kv(this,n)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(n){(typeof n!="number"||isNaN(n)||n<0)&&Vt("Out of range: "+n);var i=this.values_.length;if(n!==i)if(n>i){for(var s=new Array(n-i),o=0;o<n-i;o++)s[o]=void 0;this.spliceWithArray_(i,0,s)}else this.spliceWithArray_(n,i-n)},t.updateArrayLength_=function(n,i){n!==this.lastKnownLength_&&Vt(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&sG(n+i+1)},t.spliceWithArray_=function(n,i,s){var o=this;this.atom_;var a=this.values_.length;if(n===void 0?n=0:n>a?n=a:n<0&&(n=Math.max(0,a+n)),arguments.length===1?i=a-n:i==null?i=0:i=Math.max(0,Math.min(i,a-n)),s===void 0&&(s=AA),Js(this)){var l=eo(this,{object:this.proxy_,type:O4,index:n,removedCount:i,added:s});if(!l)return AA;i=l.removedCount,s=l.added}if(s=s.length===0?s:s.map(function(d){return o.enhancer_(d,void 0)}),this.legacyMode_){var u=s.length-i;this.updateArrayLength_(a,u)}var h=this.spliceItemsIntoValues_(n,i,s);return(i!==0||s.length!==0)&&this.notifyArraySplice_(n,s,h),this.dehanceValues_(h)},t.spliceItemsIntoValues_=function(n,i,s){if(s.length<vye){var o;return(o=this.values_).splice.apply(o,[n,i].concat(s))}else{var a=this.values_.slice(n,n+i),l=this.values_.slice(n+i);this.values_.length+=s.length-i;for(var u=0;u<s.length;u++)this.values_[n+u]=s[u];for(var h=0;h<l.length;h++)this.values_[n+s.length+h]=l[h];return a}},t.notifyArrayChildUpdate_=function(n,i,s){var o=!this.owned_&&sg(),a=jo(this),l=a||o?{observableKind:"array",object:this.proxy_,type:fa,debugObjectName:this.atom_.name_,index:n,newValue:i,oldValue:s}:null;this.atom_.reportChanged(),a&&Mo(this,l)},t.notifyArraySplice_=function(n,i,s){var o=!this.owned_&&sg(),a=jo(this),l=a||o?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:O4,index:n,removed:s,added:i,removedCount:s.length,addedCount:i.length}:null;this.atom_.reportChanged(),a&&Mo(this,l)},t.get_=function(n){if(this.legacyMode_&&n>=this.values_.length){console.warn("[mobx] Out of bounds read: "+n);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[n])},t.set_=function(n,i){var s=this.values_;if(this.legacyMode_&&n>s.length&&Vt(17,n,s.length),n<s.length){this.atom_;var o=s[n];if(Js(this)){var a=eo(this,{type:fa,object:this.proxy_,index:n,newValue:i});if(!a)return;i=a.newValue}i=this.enhancer_(i,o);var l=i!==o;l&&(s[n]=i,this.notifyArrayChildUpdate_(n,i,o))}else{for(var u=new Array(n+1-s.length),h=0;h<u.length-1;h++)u[h]=void 0;u[u.length-1]=i,this.spliceWithArray_(s.length,0,u)}},e})();function bye(e,t,r,n){return r===void 0&&(r="ObservableArray"),n===void 0&&(n=!1),dq(),Vd(function(){var i=new Wj(r,t,n,!1);pq(i.values_,xt,i);var s=new Proxy(i.values_,yye);return i.proxy_=s,e&&e.length&&i.spliceWithArray_(0,0,e),s})}var g_={clear:function(){return this.splice(0)},replace:function(t){var r=this[xt];return r.spliceWithArray_(0,r.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,r){for(var n=arguments.length,i=new Array(n>2?n-2:0),s=2;s<n;s++)i[s-2]=arguments[s];var o=this[xt];switch(arguments.length){case 0:return[];case 1:return o.spliceWithArray_(t);case 2:return o.spliceWithArray_(t,r)}return o.spliceWithArray_(t,r,i)},spliceWithArray:function(t,r,n){return this[xt].spliceWithArray_(t,r,n)},push:function(){for(var t=this[xt],r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return t.spliceWithArray_(t.values_.length,0,n),t.values_.length},pop:function(){return this.splice(Math.max(this[xt].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[xt],r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return t.spliceWithArray_(0,0,n),t.values_.length},reverse:function(){return qe.trackingDerivation&&Vt(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){qe.trackingDerivation&&Vt(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var r=this[xt],n=r.dehanceValues_(r.values_).indexOf(t);return n>-1?(this.splice(n,1),!0):!1}};Ir("at",Rs);Ir("concat",Rs);Ir("flat",Rs);Ir("includes",Rs);Ir("indexOf",Rs);Ir("join",Rs);Ir("lastIndexOf",Rs);Ir("slice",Rs);Ir("toString",Rs);Ir("toLocaleString",Rs);Ir("toSorted",Rs);Ir("toSpliced",Rs);Ir("with",Rs);Ir("every",Fo);Ir("filter",Fo);Ir("find",Fo);Ir("findIndex",Fo);Ir("findLast",Fo);Ir("findLastIndex",Fo);Ir("flatMap",Fo);Ir("forEach",Fo);Ir("map",Fo);Ir("some",Fo);Ir("toReversed",Fo);Ir("reduce",eG);Ir("reduceRight",eG);function Ir(e,t){typeof Array.prototype[e]=="function"&&(g_[e]=t(e))}function Rs(e){return function(){var t=this[xt];t.atom_.reportObserved();var r=t.dehanceValues_(t.values_);return r[e].apply(r,arguments)}}function Fo(e){return function(t,r){var n=this,i=this[xt];i.atom_.reportObserved();var s=i.dehanceValues_(i.values_);return s[e](function(o,a){return t.call(r,o,a,n)})}}function eG(e){return function(){var t=this,r=this[xt];r.atom_.reportObserved();var n=r.dehanceValues_(r.values_),i=arguments[0];return arguments[0]=function(s,o,a){return i(s,o,a,t)},n[e].apply(n,arguments)}}var _ye=cu("ObservableArrayAdministration",Wj);function Pa(e){return wx(e)&&_ye(e[xt])}var xye={},Cc="add",v_="delete",qj=(function(){function e(r,n,i){var s=this;n===void 0&&(n=Ad),i===void 0&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[xt]=xye,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_=n,this.name_=i,Ts(Map)||Vt(18),Vd(function(){s.keysAtom_=u_("ObservableMap.keys()"),s.data_=new Map,s.hasMap_=new Map,r&&s.merge(r)})}var t=e.prototype;return t.has_=function(n){return this.data_.has(n)},t.has=function(n){var i=this;if(!qe.trackingDerivation)return this.has_(n);var s=this.hasMap_.get(n);if(!s){var o=s=new $c(this.has_(n),Ox,"ObservableMap.key?",!1);this.hasMap_.set(n,o),Uq(o,function(){return i.hasMap_.delete(n)})}return s.get()},t.set=function(n,i){var s=this.has_(n);if(Js(this)){var o=eo(this,{type:s?fa:Cc,object:this,newValue:i,name:n});if(!o)return this;i=o.newValue}return s?this.updateValue_(n,i):this.addValue_(n,i),this},t.delete=function(n){var i=this;if(this.keysAtom_,Js(this)){var s=eo(this,{type:v_,object:this,name:n});if(!s)return!1}if(this.has_(n)){var o=sg(),a=jo(this),l=a||o?{observableKind:"map",debugObjectName:this.name_,type:v_,object:this,oldValue:this.data_.get(n).value_,name:n}:null;return ul(function(){var u;i.keysAtom_.reportChanged(),(u=i.hasMap_.get(n))==null||u.setNewValue_(!1);var h=i.data_.get(n);h.setNewValue_(void 0),i.data_.delete(n)}),a&&Mo(this,l),!0}return!1},t.updateValue_=function(n,i){var s=this.data_.get(n);if(i=s.prepareNewValue_(i),i!==qe.UNCHANGED){var o=sg(),a=jo(this),l=a||o?{observableKind:"map",debugObjectName:this.name_,type:fa,object:this,oldValue:s.value_,name:n,newValue:i}:null;s.setNewValue_(i),a&&Mo(this,l)}},t.addValue_=function(n,i){var s=this;this.keysAtom_,ul(function(){var u,h=new $c(i,s.enhancer_,"ObservableMap.key",!1);s.data_.set(n,h),i=h.value_,(u=s.hasMap_.get(n))==null||u.setNewValue_(!0),s.keysAtom_.reportChanged()});var o=sg(),a=jo(this),l=a||o?{observableKind:"map",debugObjectName:this.name_,type:Cc,object:this,name:n,newValue:i}:null;a&&Mo(this,l)},t.get=function(n){return this.has(n)?this.dehanceValue_(this.data_.get(n).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var n=this,i=this.keys();return T4({next:function(){var o=i.next(),a=o.done,l=o.value;return{done:a,value:a?void 0:n.get(l)}}})},t.entries=function(){var n=this,i=this.keys();return T4({next:function(){var o=i.next(),a=o.done,l=o.value;return{done:a,value:a?void 0:[l,n.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(n,i){for(var s=Wf(this),o;!(o=s()).done;){var a=o.value,l=a[0],u=a[1];n.call(i,u,l,this)}},t.merge=function(n){var i=this;return po(n)&&(n=new Map(n)),ul(function(){Qc(n)?Nge(n).forEach(function(s){return i.set(s,n[s])}):Array.isArray(n)?n.forEach(function(s){var o=s[0],a=s[1];return i.set(o,a)}):gp(n)?(Ige(n)||Vt(19,n),n.forEach(function(s,o){return i.set(o,s)})):n!=null&&Vt(20,n)}),this},t.clear=function(){var n=this;ul(function(){Aq(function(){for(var i=Wf(n.keys()),s;!(s=i()).done;){var o=s.value;n.delete(o)}})})},t.replace=function(n){var i=this;return ul(function(){for(var s=Sye(n),o=new Map,a=!1,l=Wf(i.data_.keys()),u;!(u=l()).done;){var h=u.value;if(!s.has(h)){var d=i.delete(h);if(d)a=!0;else{var p=i.data_.get(h);o.set(h,p)}}}for(var v=Wf(s.entries()),S;!(S=v()).done;){var _=S.value,m=_[0],x=_[1],b=i.data_.has(m);if(i.set(m,x),i.data_.has(m)){var w=i.data_.get(m);o.set(m,w),b||(a=!0)}}if(!a)if(i.data_.size!==o.size)i.keysAtom_.reportChanged();else for(var O=i.data_.keys(),E=o.keys(),T=O.next(),R=E.next();!T.done;){if(T.value!==R.value){i.keysAtom_.reportChanged();break}T=O.next(),R=E.next()}i.data_=o}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(n,i){return Kv(this,n)},t.intercept_=function(n){return Gv(this,n)},vp(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])})(),po=cu("ObservableMap",qj);function T4(e){return e[Symbol.toStringTag]="MapIterator",Kj(e)}function Sye(e){if(gp(e)||po(e))return e;if(Array.isArray(e))return new Map(e);if(Qc(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return Vt(21,e)}var wye={},tG=(function(){function e(r,n,i){var s=this;n===void 0&&(n=Ad),i===void 0&&(i="ObservableSet"),this.name_=void 0,this[xt]=wye,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,Ts(Set)||Vt(22),this.enhancer_=function(o,a){return n(o,a,i)},Vd(function(){s.atom_=u_(s.name_),r&&s.replace(r)})}var t=e.prototype;return t.dehanceValue_=function(n){return this.dehancer!==void 0?this.dehancer(n):n},t.clear=function(){var n=this;ul(function(){Aq(function(){for(var i=Wf(n.data_.values()),s;!(s=i()).done;){var o=s.value;n.delete(o)}})})},t.forEach=function(n,i){for(var s=Wf(this),o;!(o=s()).done;){var a=o.value;n.call(i,a,a,this)}},t.add=function(n){var i=this;if(this.atom_,Js(this)){var s=eo(this,{type:Cc,object:this,newValue:n});if(!s)return this;n=s.newValue}if(!this.has(n)){ul(function(){i.data_.add(i.enhancer_(n,void 0)),i.atom_.reportChanged()});var o=!1,a=jo(this),l=a||o?{observableKind:"set",debugObjectName:this.name_,type:Cc,object:this,newValue:n}:null;a&&Mo(this,l)}return this},t.delete=function(n){var i=this;if(Js(this)){var s=eo(this,{type:v_,object:this,oldValue:n});if(!s)return!1}if(this.has(n)){var o=!1,a=jo(this),l=a||o?{observableKind:"set",debugObjectName:this.name_,type:v_,object:this,oldValue:n}:null;return ul(function(){i.atom_.reportChanged(),i.data_.delete(n)}),a&&Mo(this,l),!0}return!1},t.has=function(n){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(n))},t.entries=function(){var n=this.values();return k4({next:function(){var s=n.next(),o=s.value,a=s.done;return a?{value:void 0,done:a}:{value:[o,o],done:a}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var n=this,i=this.data_.values();return k4({next:function(){var o=i.next(),a=o.value,l=o.done;return l?{value:void 0,done:l}:{value:n.dehanceValue_(a),done:l}}})},t.intersection=function(n){if(cl(n)&&!Mi(n))return n.intersection(this);var i=new Set(this);return i.intersection(n)},t.union=function(n){if(cl(n)&&!Mi(n))return n.union(this);var i=new Set(this);return i.union(n)},t.difference=function(n){return new Set(this).difference(n)},t.symmetricDifference=function(n){if(cl(n)&&!Mi(n))return n.symmetricDifference(this);var i=new Set(this);return i.symmetricDifference(n)},t.isSubsetOf=function(n){return new Set(this).isSubsetOf(n)},t.isSupersetOf=function(n){return new Set(this).isSupersetOf(n)},t.isDisjointFrom=function(n){if(cl(n)&&!Mi(n))return n.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(n)},t.replace=function(n){var i=this;return Mi(n)&&(n=new Set(n)),ul(function(){Array.isArray(n)?(i.clear(),n.forEach(function(s){return i.add(s)})):cl(n)?(i.clear(),n.forEach(function(s){return i.add(s)})):n!=null&&Vt("Cannot initialize set from "+n)}),this},t.observe_=function(n,i){return Kv(this,n)},t.intercept_=function(n){return Gv(this,n)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},vp(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])})(),Mi=cu("ObservableSet",tG);function k4(e){return e[Symbol.toStringTag]="SetIterator",Kj(e)}var A4=Object.create(null),R4="remove",rG=(function(){function e(r,n,i,s){n===void 0&&(n=new Map),s===void 0&&(s=hve),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_=r,this.values_=n,this.name_=i,this.defaultAnnotation_=s,this.keysAtom_=new uu("ObservableObject.keys"),this.isPlainObject_=Qc(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(n){return this.values_.get(n).get()},t.setObservablePropValue_=function(n,i){var s=this.values_.get(n);if(s instanceof Io)return s.set(i),!0;if(Js(this)){var o=eo(this,{type:fa,object:this.proxy_||this.target_,name:n,newValue:i});if(!o)return null;i=o.newValue}if(i=s.prepareNewValue_(i),i!==qe.UNCHANGED){var a=jo(this),l=!1,u=a||l?{type:fa,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:s.value_,name:n,newValue:i}:null;s.setNewValue_(i),a&&Mo(this,u)}return!0},t.get_=function(n){return qe.trackingDerivation&&!ml(this.target_,n)&&this.has_(n),this.target_[n]},t.set_=function(n,i,s){return s===void 0&&(s=!1),ml(this.target_,n)?this.values_.has(n)?this.setObservablePropValue_(n,i):s?Reflect.set(this.target_,n,i):(this.target_[n]=i,!0):this.extend_(n,{value:i,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,s)},t.has_=function(n){if(!qe.trackingDerivation)return n in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(n);return i||(i=new $c(n in this.target_,Ox,"ObservableObject.key?",!1),this.pendingKeys_.set(n,i)),i.get()},t.make_=function(n,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(!(n in this.target_)){var s;if((s=this.target_[sa])!=null&&s[n])return;Vt(1,i.annotationType_,this.name_+"."+n.toString())}for(var o=this.target_;o&&o!==Sx;){var a=c_(o,n);if(a){var l=i.make_(this,n,a,o);if(l===0)return;if(l===1)break}o=Object.getPrototypeOf(o)}j4(this,i,n)}},t.extend_=function(n,i,s,o){if(o===void 0&&(o=!1),s===!0&&(s=this.defaultAnnotation_),s===!1)return this.defineProperty_(n,i,o);var a=s.extend_(this,n,i,o);return a&&j4(this,s,n),a},t.defineProperty_=function(n,i,s){s===void 0&&(s=!1),this.keysAtom_;try{Gi();var o=this.delete_(n);if(!o)return o;if(Js(this)){var a=eo(this,{object:this.proxy_||this.target_,name:n,type:Cc,newValue:i.value});if(!a)return null;var l=a.newValue;i.value!==l&&(i=Zc({},i,{value:l}))}if(s){if(!Reflect.defineProperty(this.target_,n,i))return!1}else ua(this.target_,n,i);this.notifyPropertyAddition_(n,i.value)}finally{Ki()}return!0},t.defineObservableProperty_=function(n,i,s,o){o===void 0&&(o=!1),this.keysAtom_;try{Gi();var a=this.delete_(n);if(!a)return a;if(Js(this)){var l=eo(this,{object:this.proxy_||this.target_,name:n,type:Cc,newValue:i});if(!l)return null;i=l.newValue}var u=P4(n),h={configurable:qe.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(o){if(!Reflect.defineProperty(this.target_,n,h))return!1}else ua(this.target_,n,h);var d=new $c(i,s,"ObservableObject.key",!1);this.values_.set(n,d),this.notifyPropertyAddition_(n,d.value_)}finally{Ki()}return!0},t.defineComputedProperty_=function(n,i,s){s===void 0&&(s=!1),this.keysAtom_;try{Gi();var o=this.delete_(n);if(!o)return o;if(Js(this)){var a=eo(this,{object:this.proxy_||this.target_,name:n,type:Cc,newValue:void 0});if(!a)return null}i.name||(i.name="ObservableObject.key"),i.context=this.proxy_||this.target_;var l=P4(n),u={configurable:qe.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(s){if(!Reflect.defineProperty(this.target_,n,u))return!1}else ua(this.target_,n,u);this.values_.set(n,new Io(i)),this.notifyPropertyAddition_(n,void 0)}finally{Ki()}return!0},t.delete_=function(n,i){if(i===void 0&&(i=!1),this.keysAtom_,!ml(this.target_,n))return!0;if(Js(this)){var s=eo(this,{object:this.proxy_||this.target_,name:n,type:R4});if(!s)return null}try{var o;Gi();var a=jo(this),l=!1,u=this.values_.get(n),h=void 0;if(!u&&(a||l)){var d;h=(d=c_(this.target_,n))==null?void 0:d.value}if(i){if(!Reflect.deleteProperty(this.target_,n))return!1}else delete this.target_[n];if(u&&(this.values_.delete(n),u instanceof $c&&(h=u.value_),Dq(u)),this.keysAtom_.reportChanged(),(o=this.pendingKeys_)==null||(o=o.get(n))==null||o.set(n in this.target_),a||l){var p={type:R4,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:h,name:n};a&&Mo(this,p)}}finally{Ki()}return!0},t.observe_=function(n,i){return Kv(this,n)},t.intercept_=function(n){return Gv(this,n)},t.notifyPropertyAddition_=function(n,i){var s,o=jo(this),a=!1;if(o||a){var l=o||a?{type:Cc,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:n,newValue:i}:null;o&&Mo(this,l)}(s=this.pendingKeys_)==null||(s=s.get(n))==null||s.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Ex(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e})();function bp(e,t){var r;if(ml(e,xt))return e;var n=(r=t?.name)!=null?r:"ObservableObject",i=new rG(e,new Map,String(n),Cve(t));return Cx(e,xt,i),e}var Cye=cu("ObservableObjectAdministration",rG);function P4(e){return A4[e]||(A4[e]={get:function(){return this[xt].getObservablePropValue_(e)},set:function(r){return this[xt].setObservablePropValue_(e,r)}})}function Uo(e){return wx(e)?Cye(e[xt]):!1}function j4(e,t,r){var n;(n=e.target_[sa])==null||delete n[r]}var Eye=iG(0),Oye=(function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1})(),cE=0,nG=function(){};function Tye(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Tye(nG,Array.prototype);var Gj=(function(e){function t(n,i,s,o){var a;return s===void 0&&(s="ObservableArray"),o===void 0&&(o=!1),a=e.call(this)||this,Vd(function(){var l=new Wj(s,i,o,!0);l.proxy_=a,pq(a,xt,l),n&&n.length&&a.spliceWithArray(0,0,n),Oye&&Object.defineProperty(a,"0",Eye)}),a}vq(t,e);var r=t.prototype;return r.concat=function(){this[xt].atom_.reportObserved();for(var i=arguments.length,s=new Array(i),o=0;o<i;o++)s[o]=arguments[o];return Array.prototype.concat.apply(this.slice(),s.map(function(a){return Pa(a)?a.slice():a}))},r[Symbol.iterator]=function(){var n=this,i=0;return Kj({next:function(){return i<n.length?{value:n[i++],done:!1}:{done:!0,value:void 0}}})},vp(t,[{key:"length",get:function(){return this[xt].getArrayLength_()},set:function(i){this[xt].setArrayLength_(i)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])})(nG);Object.entries(g_).forEach(function(e){var t=e[0],r=e[1];t!=="concat"&&Cx(Gj.prototype,t,r)});function iG(e){return{enumerable:!1,configurable:!0,get:function(){return this[xt].get_(e)},set:function(r){this[xt].set_(e,r)}}}function kye(e){ua(Gj.prototype,""+e,iG(e))}function sG(e){if(e>cE){for(var t=cE;t<e+100;t++)kye(t);cE=e}}sG(1e3);function Aye(e,t,r){return new Gj(e,t,r)}function Eh(e,t){if(typeof e=="object"&&e!==null){if(Pa(e))return t!==void 0&&Vt(23),e[xt].atom_;if(Mi(e))return e.atom_;if(po(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||Vt(25,t,BA(e)),r}if(Uo(e)){if(!t)return Vt(26);var n=e[xt].values_.get(t);return n||Vt(27,t,BA(e)),n}if(zj(e)||Rx(e)||p_(e))return e}else if(Ts(e)&&p_(e[xt]))return e[xt];Vt(28)}function Sa(e,t){if(e||Vt(29),t!==void 0)return Sa(Eh(e,t));if(zj(e)||Rx(e)||p_(e)||po(e)||Mi(e))return e;if(e[xt])return e[xt];Vt(24,e)}function BA(e,t){var r;if(t!==void 0)r=Eh(e,t);else{if(wh(e))return e.name;Uo(e)||po(e)||Mi(e)?r=Sa(e):r=Eh(e)}return r.name_}function Vd(e){var t=Ud(),r=kx(!0);Gi();try{return e()}finally{Ki(),Ax(r),gl(t)}}var M4=Sx.toString;function oG(e,t,r){return r===void 0&&(r=-1),$A(e,t,r)}function $A(e,t,r,n,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 s=typeof e;if(s!=="function"&&s!=="object"&&typeof t!="object")return!1;var o=M4.call(e);if(o!==M4.call(t))return!1;switch(o){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]":r>=0&&r++;break}e=L4(e),t=L4(t);var a=o==="[object Array]";if(!a){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(Ts(l)&&l instanceof l&&Ts(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(r===0)return!1;r<0&&(r=-1),n=n||[],i=i||[];for(var h=n.length;h--;)if(n[h]===e)return i[h]===t;if(n.push(e),i.push(t),a){if(h=e.length,h!==t.length)return!1;for(;h--;)if(!$A(e[h],t[h],r-1,n,i))return!1}else{var d=Object.keys(e),p=d.length;if(Object.keys(t).length!==p)return!1;for(var v=0;v<p;v++){var S=d[v];if(!(ml(t,S)&&$A(e[S],t[S],r-1,n,i)))return!1}}return n.pop(),i.pop(),!0}function L4(e){return Pa(e)?e.slice():gp(e)||po(e)||cl(e)||Mi(e)?Array.from(e.entries()):e}var D4,Rye=((D4=xx().Iterator)==null?void 0:D4.prototype)||{};function Kj(e){return e[Symbol.iterator]=Pye,Object.assign(Object.create(Rye),e)}function Pye(){return this}["Symbol","Map","Set"].forEach(function(e){var t=xx();typeof t[e]>"u"&&Vt("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Uve,extras:{getDebugName:BA},$mobx:xt});if(!k.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!Jq)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function jye(e){e()}function Mye(e){e||(e=jye),rye({reactionScheduler:e})}function Lye(e){return iye(e)}var Dye=1e4,Iye=1e4,Nye=(function(){function e(t){var r=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(n){n===void 0&&(n=Dye),clearTimeout(r.sweepTimeout),r.sweepTimeout=void 0;var i=Date.now();r.registrations.forEach(function(s,o){i-s.registeredAt>=n&&(r.finalize(s.value),r.registrations.delete(o))}),r.registrations.size>0&&r.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){r.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){this.registrations.set(n,{value:r,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,Iye))}}),e})(),Bye=typeof FinalizationRegistry<"u"?FinalizationRegistry:Nye,zA=new Bye(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null});function I4(e){e.reaction=new xa("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function $ye(e,t){t===void 0&&(t="observed");var r=se.useRef(null);if(!r.current){var n={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(a){return zA.unregister(n),n.onStoreChange=a,n.reaction||(I4(n),n.stateVersion=Symbol()),function(){var l;n.onStoreChange=null,(l=n.reaction)===null||l===void 0||l.dispose(),n.reaction=null}},getSnapshot:function(){return n.stateVersion}};r.current=n}var i=r.current;i.reaction||(I4(i),zA.register(r,i,i)),se.useDebugValue(i.reaction,Lye),FP.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot);var s,o;if(i.reaction.track(function(){try{s=e()}catch(a){o=a}}),o)throw o;return s}var uE,dE,aG=typeof Symbol=="function"&&Symbol.for,zye=(dE=(uE=Object.getOwnPropertyDescriptor(function(){},"name"))===null||uE===void 0?void 0:uE.configurable)!==null&&dE!==void 0?dE:!1,N4=aG?Symbol.for("react.forward_ref"):typeof k.forwardRef=="function"&&k.forwardRef(function(e){return null}).$$typeof,B4=aG?Symbol.for("react.memo"):typeof k.memo=="function"&&k.memo(function(e){return null}).$$typeof;function Hye(e,t){var r;if(B4&&e.$$typeof===B4)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 n=(r=void 0)!==null&&r!==void 0?r:!1,i=e,s=e.displayName||e.name;if(N4&&e.$$typeof===N4&&(n=!0,i=e.render,typeof i!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var o=function(a,l){return $ye(function(){return i(a,l)},s)};return o.displayName=e.displayName,zye&&Object.defineProperty(o,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(o.contextTypes=e.contextTypes),n&&(o=k.forwardRef(o)),o=k.memo(o),Uye(e,o),o}var Fye={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function Uye(e,t){Object.keys(e).forEach(function(r){Fye[r]||Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))})}var fE;Mye(hn.unstable_batchedUpdates);fE=zA.finalizeAllImmediately;function kr(e,t="Assertion error"){if(!e)throw Error(t)}function Oh({group:e}){const{orientation:t,panels:r}=e;return r.reduce((n,i)=>(n+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,n),0)}function HA(e,t){return t.sort(e==="horizontal"?Vye:Wye)}function Vye(e,t){const r=e.element.offsetLeft-t.element.offsetLeft;return r!==0?r:e.element.offsetWidth-t.element.offsetWidth}function Wye(e,t){const r=e.element.offsetTop-t.element.offsetTop;return r!==0?r:e.element.offsetHeight-t.element.offsetHeight}function lG(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 qye({orientation:e,rects:t,targetRect:r}){const n={x:r.x+r.width/2,y:r.y+r.height/2};let i,s=Number.MAX_VALUE;for(const o of t){const{x:a,y:l}=lG(n,o),u=e==="horizontal"?a:l;u<s&&(s=u,i=o)}return kr(i,"No rect found"),i}function cG(e){const{element:t,orientation:r,panels:n,separators:i}=e,s=HA(r,Array.from(t.children).filter(h=>h instanceof HTMLElement).map(h=>({element:h}))).map(({element:h})=>h),o=[];let a=!1,l,u=[];for(const h of s)if(h.hasAttribute("data-panel")){const d=n.find(p=>p.element===h);if(d){if(l){const p=l.element.getBoundingClientRect(),v=h.getBoundingClientRect();let S;if(a){const _=r==="horizontal"?new DOMRect(p.right,p.top,0,p.height):new DOMRect(p.left,p.bottom,p.width,0),m=r==="horizontal"?new DOMRect(v.left,v.top,0,v.height):new DOMRect(v.left,v.top,v.width,0);switch(u.length){case 0:{S=[_,m];break}case 1:{const x=u[0],b=qye({orientation:r,rects:[p,v],targetRect:x.element.getBoundingClientRect()});S=[x,b===p?m:_];break}default:{S=u;break}}}else u.length?S=u:S=[r==="horizontal"?new DOMRect(p.right,v.top,v.left-p.right,v.height):new DOMRect(v.left,p.bottom,v.width,v.top-p.bottom)];for(const _ of S)o.push({group:e,groupSize:Oh({group:e}),panels:[l,d],separator:"width"in _?void 0:_,rect:"width"in _?_:_.element.getBoundingClientRect()})}a=!1,l=d,u=[]}}else if(h.hasAttribute("data-separator")){const d=i.find(p=>p.element===h);d?u.push(d):(l=void 0,u=[])}else a=!0;return o}function Gye(e,t){const r=getComputedStyle(e),n=parseFloat(r.fontSize);return t*n}function Kye(e,t){const r=getComputedStyle(e.ownerDocument.body),n=parseFloat(r.fontSize);return t*n}function Yye(e){return e/100*window.innerHeight}function Xye(e){return e/100*window.innerWidth}function Qye(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 Qb({groupSize:e,panelElement:t,styleProp:r}){let n;const[i,s]=Qye(r);switch(s){case"%":{n=i/100*e;break}case"px":{n=i;break}case"rem":{n=Kye(t,i);break}case"em":{n=Gye(t,i);break}case"vh":{n=Yye(i);break}case"vw":{n=Xye(i);break}}return n}function ko(e){return parseFloat(e.toFixed(3))}function $4(e){const{panels:t}=e,r=Oh({group:e});return r===0?t.map(n=>({collapsedSize:0,collapsible:n.panelConstraints.collapsible===!0,defaultSize:void 0,minSize:0,maxSize:100,panelId:n.id})):t.map(n=>{const{element:i,panelConstraints:s}=n;let o=0;if(s.collapsedSize){const h=Qb({groupSize:r,panelElement:i,styleProp:s.collapsedSize});o=ko(h/r*100)}let a;if(s.defaultSize){const h=Qb({groupSize:r,panelElement:i,styleProp:s.defaultSize});a=ko(h/r*100)}let l=0;if(s.minSize){const h=Qb({groupSize:r,panelElement:i,styleProp:s.minSize});l=ko(h/r*100)}let u=100;if(s.maxSize){const h=Qb({groupSize:r,panelElement:i,styleProp:s.maxSize});u=ko(h/r*100)}return{collapsedSize:o,collapsible:s.collapsible===!0,defaultSize:a,minSize:l,maxSize:u,panelId:n.id}})}class Zye{#e={};addListener(t,r){const n=this.#e[t];return n===void 0?this.#e[t]=[r]:n.includes(r)||n.push(r),()=>{this.removeListener(t,r)}}emit(t,r){const n=this.#e[t];if(n!==void 0)if(n.length===1)n[0].call(null,r);else{let i=!1,s=null;const o=Array.from(n);for(let a=0;a<o.length;a++){const l=o[a];try{l.call(null,r)}catch(u){s===null&&(i=!0,s=u)}}if(i)throw s}}removeAllListeners(){this.#e={}}removeListener(t,r){const n=this.#e[t];if(n!==void 0){const i=n.indexOf(r);i>=0&&n.splice(i,1)}}}function Ei(e,t,r=0){return Math.abs(ko(e)-ko(t))<=r}let qs={cursorFlags:0,interactionState:{state:"inactive"},mountedGroups:new Map};const fd=new Zye;function ja(){return qs}function so(e){const t=typeof e=="function"?e(qs):e;if(qs===t)return qs;const r=qs;return qs={...qs,...t},t.cursorFlags!==void 0&&fd.emit("cursorFlagsChange",qs.cursorFlags),t.interactionState!==void 0&&fd.emit("interactionStateChange",qs.interactionState),t.mountedGroups!==void 0&&(qs.mountedGroups.forEach((n,i)=>{n.derivedPanelConstraints.forEach(s=>{if(s.collapsible){const{layout:o}=r.mountedGroups.get(i)??{};if(o){const a=Ei(s.collapsedSize,n.layout[s.panelId]),l=Ei(s.collapsedSize,o[s.panelId]);a&&!l&&(i.inMemoryLastExpandedPanelSizes[s.panelId]=o[s.panelId])}}})}),fd.emit("mountedGroupsChange",qs.mountedGroups)),qs}const Jye=e=>e,hE=()=>{},uG=1,dG=2,fG=4,hG=8,z4={coarse:10,precise:5};function ebe({cursorFlags:e,groups:t,state:r}){let n=0,i=0;switch(r){case"active":case"hover":t.forEach(s=>{if(!s.disableCursor)switch(s.orientation){case"horizontal":{n++;break}case"vertical":{i++;break}}})}if(n===0&&i===0)return null;switch(r){case"active":{const s=(e&uG)!==0,o=(e&dG)!==0,a=(e&fG)!==0,l=(e&hG)!==0;if(e){if(s)return a?"se-resize":l?"ne-resize":"e-resize";if(o)return a?"sw-resize":l?"nw-resize":"w-resize";if(a)return"s-resize";if(l)return"n-resize"}break}}return n>0&&i>0?"move":n>0?"ew-resize":"ns-resize"}let pE,Zo;function Yj(){Zo===void 0&&(Zo=new CSSStyleSheet,document.adoptedStyleSheets=[Zo]);const{cursorFlags:e,interactionState:t}=ja();switch(t.state){case"active":case"hover":{const r=ebe({cursorFlags:e,groups:t.hitRegions.map(i=>i.group),state:t.state}),n=`*{cursor: ${r} !important; ${t.state==="active"?"touch-action: none;":""} }`;if(pE===n)return;pE=n,r?Zo.cssRules.length===0?Zo.insertRule(n):Zo.replaceSync(n):Zo.cssRules.length===1&&Zo.deleteRule(0);break}case"inactive":{pE=void 0,Zo.cssRules.length===1&&Zo.deleteRule(0);break}}}function tbe(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!=t[r])return!1;return!0}function kg(e,t){return Ei(e,t)?0:e>t?1:-1}function qf({panelConstraints:e,size:t}){const{collapsedSize:r=0,collapsible:n,maxSize:i=100,minSize:s=0}=e;if(kg(t,s)<0)if(n){const o=(r+s)/2;kg(t,o)<0?t=r:t=s}else t=s;return t=Math.min(i,t),t=ko(t),t}function Ag({delta:e,initialLayout:t,panelConstraints:r,pivotIndices:n,prevLayout:i,trigger:s}){if(Ei(e,0))return t;const o=Object.values(t),a=Object.values(i),l=[...o],[u,h]=n;kr(u!=null,"Invalid first pivot index"),kr(h!=null,"Invalid second pivot index");let d=0;if(s==="keyboard"){{const S=e<0?h:u,_=r[S];kr(_,`Panel constraints not found for index ${S}`);const{collapsedSize:m=0,collapsible:x,minSize:b=0}=_;if(x){const w=o[S];if(kr(w!=null,`Previous layout not found for panel index ${S}`),Ei(w,m)){const O=b-w;kg(O,Math.abs(e))>0&&(e=e<0?0-O:O)}}}{const S=e<0?u:h,_=r[S];kr(_,`No panel constraints found for index ${S}`);const{collapsedSize:m=0,collapsible:x,minSize:b=0}=_;if(x){const w=o[S];if(kr(w!=null,`Previous layout not found for panel index ${S}`),Ei(w,b)){const O=w-m;kg(O,Math.abs(e))>0&&(e=e<0?0-O:O)}}}}{const S=e<0?1:-1;let _=e<0?h:u,m=0;for(;;){const b=o[_];kr(b!=null,`Previous layout not found for panel index ${_}`);const w=qf({panelConstraints:r[_],size:100})-b;if(m+=w,_+=S,_<0||_>=r.length)break}const x=Math.min(Math.abs(e),Math.abs(m));e=e<0?0-x:x}{let S=e<0?u:h;for(;S>=0&&S<r.length;){const _=Math.abs(e)-Math.abs(d),m=o[S];kr(m!=null,`Previous layout not found for panel index ${S}`);const x=m-_,b=qf({panelConstraints:r[S],size:x});if(!Ei(m,b)&&(d+=m-b,l[S]=b,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?S--:S++}}if(tbe(a,l))return i;{const S=e<0?h:u,_=o[S];kr(_!=null,`Previous layout not found for panel index ${S}`);const m=_+d,x=qf({panelConstraints:r[S],size:m});if(l[S]=x,!Ei(x,m)){let b=m-x,w=e<0?h:u;for(;w>=0&&w<r.length;){const O=l[w];kr(O!=null,`Previous layout not found for panel index ${w}`);const E=O+b,T=qf({panelConstraints:r[w],size:E});if(Ei(O,T)||(b-=T-O,l[w]=T),Ei(b,0))break;e>0?w--:w++}}}const p=Object.values(l).reduce((S,_)=>_+S,0);if(!Ei(p,100,.1))return i;const v=Object.keys(i);return l.reduce((S,_,m)=>(S[v[m]]=_,S),{})}function _p(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(t[r]===void 0||kg(e[r],t[r])!==0)return!1;return!0}function pG({event:e,hitRegions:t,initialLayoutMap:r,mountedGroups:n,pointerDownAtPoint:i}){let s=0;const o=new Map(n);t.forEach(a=>{const{group:l,groupSize:u}=a,{disableCursor:h,orientation:d,panels:p}=l;let v=0;i?d==="horizontal"?v=(e.clientX-i.x)/u*100:v=(e.clientY-i.y)/u*100:d==="horizontal"?v=e.clientX<0?-100:100:v=e.clientY<0?-100:100;const S=r.get(l),{defaultLayoutDeferred:_,derivedPanelConstraints:m,layout:x,separatorToPanels:b}=n.get(l)??{defaultLayoutDeferred:!1};if(m&&S&&x&&b){const w=Ag({delta:v,initialLayout:S,panelConstraints:m,pivotIndices:a.panels.map(O=>p.indexOf(O)),prevLayout:x,trigger:"mouse-or-touch"});if(_p(w,x)){if(v!==0&&!h)switch(d){case"horizontal":{s|=v<0?uG:dG;break}case"vertical":{s|=v<0?fG:hG;break}}}else{o.set(a.group,{defaultLayoutDeferred:_,derivedPanelConstraints:m,layout:w,separatorToPanels:b});const O=a.group.panels.map(({id:E})=>E).join(",");a.group.inMemoryLayouts[O]=w}}}),so({cursorFlags:s,mountedGroups:o}),Yj()}function H4(e){if(e.defaultPrevented||e.relatedTarget!==null||e.clientX===0&&e.clientY===0)return;const{interactionState:t,mountedGroups:r}=ja();t.state==="active"&&t.hitRegions.forEach(n=>{e.currentTarget===n.group.element&&pG({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:r})})}function R0(e){const t=e.parentElement;kr(t,"Parent group element not found");const{mountedGroups:r}=ja();for(const[n]of r)if(n.element===t)return n;throw Error("Could not find parent Group for separator element")}function Rd({layout:e,panelConstraints:t}){const r=[...Object.values(e)],n=r.reduce((o,a)=>o+a,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(o=>`${o}%`).join(", ")}`);if(!Ei(n,100)&&r.length>0)for(let o=0;o<t.length;o++){const a=r[o];kr(a!=null,`No layout data found for index ${o}`);const l=100/n*a;r[o]=l}let i=0;for(let o=0;o<t.length;o++){const a=r[o];kr(a!=null,`No layout data found for index ${o}`);const l=qf({panelConstraints:t[o],size:a});a!=l&&(i+=a-l,r[o]=l)}if(!Ei(i,0))for(let o=0;o<t.length;o++){const a=r[o];kr(a!=null,`No layout data found for index ${o}`);const l=a+i,u=qf({panelConstraints:t[o],size:l});if(a!==u&&(i-=u-a,r[o]=u,Ei(i,0)))break}const s=Object.keys(e);return r.reduce((o,a,l)=>(o[s[l]]=a,o),{})}function mG({groupId:e}){const t=()=>{const{mountedGroups:r}=ja();for(const[n,i]of r)if(n.id===e)return{group:n,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:r,layout:n}=t();return r?{}:n},setLayout(r){const{defaultLayoutDeferred:n,derivedPanelConstraints:i,group:s,layout:o,separatorToPanels:a}=t(),l=Rd({layout:r,panelConstraints:i});return n?o:(_p(o,l)||so(u=>({mountedGroups:new Map(u.mountedGroups).set(s,{defaultLayoutDeferred:n,derivedPanelConstraints:i,layout:l,separatorToPanels:a})})),l)}}}function gG(e){const{mountedGroups:t}=ja(),r=t.get(e);return kr(r,`Mounted Group ${e.id} not found`),r}function Lu(e,t){const r=R0(e),n=gG(r),i=r.separators.find(h=>h.element===e);kr(i,"Matching separator not found");const s=n.separatorToPanels.get(i);kr(s,"Matching panels not found");const o=s.map(h=>r.panels.indexOf(h)),a=mG({groupId:r.id}).getLayout(),l=Ag({delta:t,initialLayout:a,panelConstraints:n.derivedPanelConstraints,pivotIndices:o,prevLayout:a,trigger:"keyboard"}),u=Rd({layout:l,panelConstraints:n.derivedPanelConstraints});_p(a,u)||so(h=>({mountedGroups:new Map(h.mountedGroups).set(r,{defaultLayoutDeferred:n.defaultLayoutDeferred,derivedPanelConstraints:n.derivedPanelConstraints,layout:u,separatorToPanels:n.separatorToPanels})}))}function F4(e){if(e.defaultPrevented)return;const t=e.currentTarget,r=R0(t);if(!r.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),r.orientation==="vertical"&&Lu(t,5);break}case"ArrowLeft":{e.preventDefault(),r.orientation==="horizontal"&&Lu(t,-5);break}case"ArrowRight":{e.preventDefault(),r.orientation==="horizontal"&&Lu(t,5);break}case"ArrowUp":{e.preventDefault(),r.orientation==="vertical"&&Lu(t,-5);break}case"End":{e.preventDefault(),Lu(t,100);break}case"Enter":{e.preventDefault();const n=R0(t),{derivedPanelConstraints:i,layout:s,separatorToPanels:o}=gG(n),a=n.separators.find(d=>d.element===t);kr(a,"Matching separator not found");const l=o.get(a);kr(l,"Matching panels not found");const u=l[0],h=i.find(d=>d.panelId===u.id);if(kr(h,"Panel metadata not found"),h.collapsible){const d=s[u.id],p=h.collapsedSize===d?n.inMemoryLastExpandedPanelSizes[u.id]??h.minSize:h.collapsedSize;Lu(t,p-d)}break}case"F6":{e.preventDefault();const n=R0(t).separators.map(o=>o.element),i=Array.from(n).findIndex(o=>o===e.currentTarget);kr(i!==null,"Index not found");const s=e.shiftKey?i>0?i-1:n.length-1:i+1<n.length?i+1:0;n[s].focus();break}case"Home":{e.preventDefault(),Lu(t,-100);break}}}function rbe(e,t,r){let n,i={x:1/0,y:1/0};for(const s of t){const o=lG(r,s.rect);switch(e){case"horizontal":{o.x<=i.x&&(n=s,i=o);break}case"vertical":{o.y<=i.y&&(n=s,i=o);break}}}return n?{distance:i,hitRegion:n}:void 0}let Zb;function nbe(){return Zb===void 0&&(typeof matchMedia=="function"?Zb=!!matchMedia("(pointer:coarse)").matches:Zb=!1),Zb}function ibe(e,t){if(e===t)throw new Error("Cannot compare node with itself");const r={a:W4(e),b:W4(t)};let n;for(;r.a.at(-1)===r.b.at(-1);)e=r.a.pop(),t=r.b.pop(),n=e;kr(n,"Stacking order can only be calculated for elements with a common ancestor");const i={a:V4(U4(r.a)),b:V4(U4(r.b))};if(i.a===i.b){const s=n.childNodes,o={a:r.a.at(-1),b:r.b.at(-1)};let a=s.length;for(;a--;){const l=s[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(i.a-i.b)}const sbe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function obe(e){const t=getComputedStyle(vG(e)??e).display;return t==="flex"||t==="inline-flex"}function abe(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||obe(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"||sbe.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function U4(e){let t=e.length;for(;t--;){const r=e[t];if(kr(r,"Missing node"),abe(r))return r}return null}function V4(e){return e&&Number(getComputedStyle(e).zIndex)||0}function W4(e){const t=[];for(;e;)t.push(e),e=vG(e);return t}function vG(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}function lbe(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 cbe({groupElement:e,hitRegion:t,pointerEventTarget:r}){if(!(r instanceof HTMLElement)||r.contains(e)||e.contains(r))return!0;if(ibe(r,e)>0){let n=r;for(;n;){if(n.contains(e))return!0;if(lbe(n.getBoundingClientRect(),t))return!1;n=n.parentElement}}return!0}function yG(e,t){const r=[];return t.forEach((n,i)=>{if(i.disabled)return;const s=nbe()?z4.coarse:z4.precise,o=cG(i),a=rbe(i.orientation,o,{x:e.clientX,y:e.clientY});a&&a.distance.x<=s&&a.distance.y<=s&&cbe({groupElement:i.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&r.push(a.hitRegion)}),r}function q4(e){if(e.defaultPrevented)return;const{mountedGroups:t}=ja(),r=yG(e,t),n=new Set,i=new Set,s=new Set,o=new Map;let a=!1;r.forEach(l=>{n.add(l.group),l.panels.forEach(h=>{i.add(h)}),l.separator&&(s.add(l.separator),a||(a=!0,l.separator.element.focus()));const u=t.get(l.group);u&&o.set(l.group,u.layout)}),so({interactionState:{hitRegions:r,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}}),r.length&&e.preventDefault()}function G4(e){if(e.defaultPrevented)return;const{interactionState:t,mountedGroups:r}=ja();switch(t.state){case"active":{if(e.type!=="pointerleave"&&e.buttons===0){so(n=>n.interactionState.state==="inactive"?n:{cursorFlags:0,interactionState:{state:"inactive"}});return}pG({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:r,pointerDownAtPoint:t.pointerDownAtPoint});break}default:{const n=yG(e,r);n.length===0?t.state!=="inactive"&&so({interactionState:{state:"inactive"}}):so({interactionState:{hitRegions:n,state:"hover"}}),Yj();break}}}function K4(e){if(e.defaultPrevented)return;e.preventDefault();const{interactionState:t}=ja();t.state==="active"&&(so({cursorFlags:0,interactionState:{state:"inactive"}}),Yj())}function Y4(e){let t=0,r=0;const n={};for(const s of e)if(s.defaultSize!==void 0){t++;const o=ko(s.defaultSize);r+=o,n[s.panelId]=o}else n[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=ko((100-r)/i);for(const o of e)o.defaultSize===void 0&&(n[o.panelId]=s)}return n}function ube(e,t,r){const n=r[0];if(!n)return;const i=e.panels.find(o=>o.element===t);if(!i||!i.onResize)return;const s=Oh({group:e});i.onResize({asPercentage:ko(n.inlineSize/s*100),inPixels:n.inlineSize},i.id)}function dbe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function fbe(e){let t=!0;const r=new Set,n=new Set,i=new ResizeObserver(v=>{for(const S of v){const{borderBoxSize:_,target:m}=S;if(m===e.element){if(t){if(Oh({group:e})===0)return;so(x=>{const b=x.mountedGroups.get(e);if(b){const w=$4(e),O=b.defaultLayoutDeferred?Y4(w):b.layout,E=Rd({layout:O,panelConstraints:w});return!b.defaultLayoutDeferred&&_p(O,E)&&dbe(b.derivedPanelConstraints,w)?x:{mountedGroups:new Map(x.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:w,layout:E,separatorToPanels:b.separatorToPanels})}}return x})}}else ube(e,m,_)}});i.observe(e.element),e.panels.forEach(v=>{kr(!r.has(v.id),`Panel ids must be unique; id "${v.id}" was used more than once`),r.add(v.id),v.onResize&&i.observe(v.element)});const s=Oh({group:e}),o=$4(e),a=e.panels.map(({id:v})=>v).join(",");let l=e.defaultLayout;l&&e.panels.length!==Object.keys(l).length&&(l=void 0);const u=e.inMemoryLayouts[a]??l??Y4(o),h=Rd({layout:u,panelConstraints:o}),d=cG(e),p=so(v=>{const S=new Map;return d.forEach(_=>{_.separator&&S.set(_.separator,_.panels)}),{mountedGroups:new Map(v.mountedGroups).set(e,{defaultLayoutDeferred:s===0,derivedPanelConstraints:o,layout:h,separatorToPanels:S})}});return e.element.addEventListener("pointerleave",H4),e.separators.forEach(v=>{kr(!n.has(v.id),`Separator ids must be unique; id "${v.id}" was used more than once`),n.add(v.id),v.element.addEventListener("keydown",F4)}),p.mountedGroups.size===1&&(window.addEventListener("pointerdown",q4),window.addEventListener("pointermove",G4),window.addEventListener("pointerup",K4)),function(){t=!1;const v=so(S=>{const _=new Map(S.mountedGroups);return _.delete(e),{mountedGroups:_}});e.element.removeEventListener("pointerleave",H4),e.separators.forEach(S=>{S.element.removeEventListener("keydown",F4)}),v.mountedGroups.size===0&&(window.removeEventListener("pointerdown",q4),window.removeEventListener("pointermove",G4),window.removeEventListener("pointerup",K4)),i.disconnect()}}function Xj(e){const t=k.useId();return`${e??t}`}const Wd=typeof window<"u"?k.useLayoutEffect:k.useEffect;function Qj(e){const t=k.useRef(e);return Wd(()=>{t.current=e},[e]),k.useCallback(r=>t.current?.(r),[t])}function Zj(...e){return Qj(t=>{e.forEach(r=>{if(r)switch(typeof r){case"function":{r(t);break}case"object":{r.current=t;break}}})})}function hbe(e){const t=k.useRef({...e});return Wd(()=>{for(const r in e)t.current[r]=e[r]},[e]),t.current}const bG="--react-resizable-panels--panel--pointer-events";function _G(e,t){const r=e.replace(/[^a-zA-Z0-9\-_]/g,""),n=t.replace(/[^a-zA-Z0-9\-_]/g,"");return`--react-resizable-panels--${r}--${n}`}const xG=k.createContext(null);function pbe(e,t){const r=k.useRef({getLayout:()=>({}),setLayout:Jye});k.useImperativeHandle(t,()=>r.current,[]),Wd(()=>{Object.assign(r.current,mG({groupId:e}))})}function mbe({children:e,className:t,defaultLayout:r,disableCursor:n,disabled:i,elementRef:s,groupRef:o,id:a,onLayoutChange:l,orientation:u="horizontal",style:h,...d}){const p=k.useRef({}),v=Qj(H=>{_p(p.current,H)||(p.current=H,l?.(H))}),S=Xj(a),[_,m]=k.useState(!1),[x,b]=k.useState(null),[w,O]=k.useState(r??{}),[E,T]=k.useState([]),[R,A]=k.useState([]),j=k.useRef({lastExpandedPanelSizes:{},layouts:{}}),I=Zj(b,s);pbe(S,o);const L=k.useMemo(()=>({id:S,orientation:u,registerPanel:H=>(T($=>HA(u,[...$,H])),()=>{T($=>$.filter(F=>F!==H))}),registerSeparator:H=>(A($=>HA(u,[...$,H])),()=>{A($=>$.filter(F=>F!==H))})}),[S,u]),z=hbe({defaultLayout:r,disableCursor:n}),D=k.useRef(null);Wd(()=>{if(x===null)return;const H={defaultLayout:z.defaultLayout,disableCursor:!!z.disableCursor,disabled:!!i,element:x,id:S,inMemoryLastExpandedPanelSizes:j.current.lastExpandedPanelSizes,inMemoryLayouts:j.current.layouts,orientation:u,panels:E,separators:R};D.current=H;const $=fbe(H),F=ja().mountedGroups.get(H);if(F){const{defaultLayoutDeferred:G,derivedPanelConstraints:N,layout:U}=F;!G&&N.length>0&&(O(U),v?.(U))}const W=fd.addListener("interactionStateChange",G=>{G.state==="active"?m(G.hitRegions.some(N=>N.group===H)):m(!1)}),B=fd.addListener("mountedGroupsChange",G=>{const N=G.get(H);if(N){const{defaultLayoutDeferred:U,derivedPanelConstraints:Y,layout:Q}=N;if(U||Y.length===0)return;O(Q),v?.(Q)}});return()=>{D.current=null,$(),W(),B()}},[i,x,S,v,u,E,R,z]),k.useEffect(()=>{const H=D.current;H&&(H.defaultLayout=r,H.disableCursor=!!n)});const V={[bG]:_?"none":void 0};for(const H in w){const $=_G(S,H),F=w[H];V[$]=F}return y.jsx(xG.Provider,{value:L,children:y.jsx("div",{...d,"aria-orientation":u,className:t,"data-group":!0,"data-testid":S,id:S,ref:I,style:{...h,...V,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap"},children:e})})}function Jj(){const e=k.useContext(xG);return kr(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function gbe({groupId:e,panelId:t}){const r=()=>{const{mountedGroups:a}=ja();for(const[l,{defaultLayoutDeferred:u,derivedPanelConstraints:h,layout:d,separatorToPanels:p}]of a)if(l.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:l,layout:d,separatorToPanels:p};throw Error(`Group ${e} not found`)},n=()=>{const a=r().derivedPanelConstraints.find(l=>l.panelId===t);if(a!==void 0)return a;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const a=r().group.panels.find(l=>l.id===t);if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const a=r().layout[t];if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},o=a=>{const l=s();if(a===l)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:h,group:d,layout:p,separatorToPanels:v}=r(),S=d.panels.findIndex(b=>b.id===t),_=S===d.panels.length-1,m=Ag({delta:_?l-a:a-l,initialLayout:p,panelConstraints:h,pivotIndices:_?[S-1,S]:[S,S+1],prevLayout:p,trigger:"imperative-api"}),x=Rd({layout:m,panelConstraints:h});_p(p,x)||so(b=>({mountedGroups:new Map(b.mountedGroups).set(d,{defaultLayoutDeferred:u,derivedPanelConstraints:h,layout:x,separatorToPanels:v})}))};return{collapse:()=>{const{collapsible:a,collapsedSize:l}=n(),u=s();a&&u!==l&&o(l)},expand:()=>{const{collapsible:a,collapsedSize:l,minSize:u}=n(),h=s();a&&h===l&&o(u)},getSize:()=>{const{group:a}=r(),l=s(),{element:u}=i(),h=a.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:l,inPixels:h}},isCollapsed:()=>{const{collapsible:a,collapsedSize:l}=n(),u=s();return a&&Ei(l,u)},resize:a=>{if(s()!==a){let l;switch(typeof a){case"number":{const{group:u}=r(),h=Oh({group:u});l=ko(a/h*100);break}case"string":{l=parseFloat(a);break}}o(l)}}}}function vbe(e,t){const{id:r}=Jj(),n=k.useRef({collapse:hE,expand:hE,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:hE});k.useImperativeHandle(t,()=>n.current,[]),Wd(()=>{Object.assign(n.current,gbe({groupId:r,panelId:e}))})}function ybe({children:e,className:t,collapsedSize:r="0%",collapsible:n=!1,defaultSize:i,elementRef:s,id:o,maxSize:a="100%",minSize:l="0%",onResize:u,panelRef:h,style:d,...p}){const v=!!o,S=Xj(o),[_,m]=k.useState(null),x=Zj(m,s),{id:b,registerPanel:w}=Jj(),O=u!==null,E=Qj(R=>{u?.(R,o)});Wd(()=>{if(_!==null)return w({element:_,id:S,idIsStable:v,onResize:O?E:void 0,panelConstraints:{collapsedSize:r,collapsible:n,defaultSize:i,maxSize:a,minSize:l}})},[r,n,i,_,O,S,v,a,l,E,w]),vbe(S,h);const T=_G(b,S);return y.jsx("div",{...p,"data-panel":!0,"data-testid":S,id:S,ref:x,style:{...bbe,flexBasis:0,flexGrow:`var(${T}, 1)`,flexShrink:1,overflow:"hidden",pointerEvents:`var(${bG})`},children:y.jsx("div",{className:t,style:{width:"100%",height:"100%",...d},children:e})})}const bbe={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 _be({layout:e,panelConstraints:t,panelId:r,panelIndex:n}){let i,s;const o=e[r],a=t.find(l=>l.panelId===r);if(a){const l=a.maxSize,u=s=a.collapsible?a.collapsedSize:a.minSize,h=[n,n+1];s=Rd({layout:Ag({delta:u-o,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[r],i=Rd({layout:Ag({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[r]}return{valueControls:r,valueMax:i,valueMin:s,valueNow:o}}function xbe({children:e,className:t,elementRef:r,id:n,style:i,...s}){const o=Xj(n),[a,l]=k.useState({}),[u,h]=k.useState("inactive"),[d,p]=k.useState(null),v=Zj(p,r),{id:S,orientation:_,registerSeparator:m}=Jj(),x=_==="horizontal"?"vertical":"horizontal";return Wd(()=>{if(d!==null){const b={element:d,id:o},w=m(b),O=fd.addListener("interactionStateChange",T=>{h(T.state!=="inactive"&&T.hitRegions.some(R=>R.separator===b)?T.state:"inactive")}),E=fd.addListener("mountedGroupsChange",T=>{T.forEach(({derivedPanelConstraints:R,layout:A,separatorToPanels:j},I)=>{if(I.id===S){const L=j.get(b);if(L){const z=L[0],D=I.panels.indexOf(z);l(_be({layout:A,panelConstraints:R,panelId:z.id,panelIndex:D}))}}})});return()=>{O(),E(),w()}}},[d,S,o,m]),y.jsx("div",{...s,"aria-controls":a.valueControls,"aria-orientation":x,"aria-valuemax":a.valueMax,"aria-valuemin":a.valueMin,"aria-valuenow":a.valueNow,children:e,className:t,"data-separator":u,"data-testid":o,id:o,ref:v,role:"separator",style:{flexBasis:"auto",...i,flexGrow:0,flexShrink:0},tabIndex:0})}function Wu({className:e,direction:t,...r}){return y.jsx(mbe,{"data-slot":"resizable-panel-group",orientation:t,className:Me("flex h-full w-full data-[orientation=vertical]:flex-col",e),...r})}function Xs({...e}){return y.jsx(ybe,{"data-slot":"resizable-panel",...e})}function qu({withHandle:e,className:t,...r}){return y.jsx(xbe,{"data-slot":"resizable-handle",className:Me("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),...r,children:e&&y.jsx("div",{className:"bg-border h-6 w-1 rounded-lg z-10 flex shrink-0"})})}var mE={exports:{}},X4;function Sbe(){return X4||(X4=1,(function(e,t){(function(r,n){e.exports=n()})(globalThis,(()=>(()=>{var r={4567:function(o,a,l){var u=this&&this.__decorate||function(b,w,O,E){var T,R=arguments.length,A=R<3?w:E===null?E=Object.getOwnPropertyDescriptor(w,O):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,w,O,E);else for(var j=b.length-1;j>=0;j--)(T=b[j])&&(A=(R<3?T(A):R>3?T(w,O,A):T(w,O))||A);return R>3&&A&&Object.defineProperty(w,O,A),A},h=this&&this.__param||function(b,w){return function(O,E){w(O,E,b)}};Object.defineProperty(a,"__esModule",{value:!0}),a.AccessibilityManager=void 0;const d=l(9042),p=l(9924),v=l(844),S=l(4725),_=l(2585),m=l(3656);let x=a.AccessibilityManager=class extends v.Disposable{constructor(b,w,O,E){super(),this._terminal=b,this._coreBrowserService=O,this._renderService=E,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let T=0;T<this._terminal.rows;T++)this._rowElements[T]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[T]);if(this._topBoundaryFocusListener=T=>this._handleBoundaryFocus(T,0),this._bottomBoundaryFocusListener=T=>this._handleBoundaryFocus(T,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((T=>this._handleResize(T.rows)))),this.register(this._terminal.onRender((T=>this._refreshRows(T.start,T.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((T=>this._handleChar(T)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
29
29
  `)))),this.register(this._terminal.onA11yTab((T=>this._handleTab(T)))),this.register(this._terminal.onKey((T=>this._handleKey(T.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,m.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,v.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(b){for(let w=0;w<b;w++)this._handleChar(" ")}_handleChar(b){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==b&&(this._charsToAnnounce+=b):this._charsToAnnounce+=b,b===`