vibora 4.4.1 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,18 +17,18 @@ Error generating stack: `+A.message+`
17
17
  ${s.right}px ${s.bottom}px,
18
18
  ${s.right}px ${s.top}px,
19
19
  ${s.left}px ${s.top}px
20
- )`}return b.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:a}})}),_te=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:a}=Au(),s=a.useState("mounted"),o=a.useState("modal");return s||r?b.jsx(vte.Provider,{value:r,children:b.jsxs(Ly,{ref:n,...i,children:[s&&o===!0&&b.jsx(Kx,{ref:a.context.internalBackdropRef,inert:Am(!open)}),t.children]})}):null});let tz={},nz={},rz="";function L_e(e){if(typeof document>"u")return!1;const t=Ci(e);return Er(t).innerWidth-t.documentElement.clientWidth>0}function P_e(e){const t=Ci(e),n=t.documentElement,r=t.body,i=$f(n)?n:r,a=i.style.overflow;return i.style.overflow="hidden",()=>{i.style.overflow=a}}function M_e(e){const t=Ci(e),n=t.documentElement,r=t.body,i=Er(n);let a=0,s=0;const o=Wo.create(),l=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(jP&&(i.visualViewport?.scale??1)!==1)return()=>{};function u(){const p=i.getComputedStyle(n),m=i.getComputedStyle(r),g=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";a=n.scrollTop,s=n.scrollLeft,tz={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},rz=n.style.scrollBehavior,nz={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const _=n.scrollHeight>n.clientHeight,v=n.scrollWidth>n.clientWidth,x=p.overflowY==="scroll"||m.overflowY==="scroll",T=p.overflowX==="scroll"||m.overflowX==="scroll",w=Math.max(0,i.innerWidth-n.clientWidth),C=Math.max(0,i.innerHeight-n.clientHeight),R=parseFloat(m.marginTop)+parseFloat(m.marginBottom),O=parseFloat(m.marginLeft)+parseFloat(m.marginRight),N=$f(n)?n:r;if(l){n.style.scrollbarGutter=g,N.style.overflowY="hidden",N.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:g,overflowY:"hidden",overflowX:"hidden"}),(_||x)&&(n.style.overflowY="scroll"),(v||T)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:R||C?`calc(100dvh - ${R+C}px)`:"100dvh",width:O||w?`calc(100vw - ${O+w}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=a,r.scrollLeft=s,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function f(){Object.assign(n.style,tz),Object.assign(r.style,nz),l||(n.scrollTop=a,n.scrollLeft=s,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=rz)}function d(){f(),o.request(u)}return u(),i.addEventListener("resize",d),()=>{o.cancel(),f(),typeof i.removeEventListener=="function"&&i.removeEventListener("resize",d)}}class j_e{lockCount=0;restore=null;timeoutLock=Uc.create();timeoutUnlock=Uc.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 r=Ci(t).documentElement,i=Er(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=yr;return}const a=ive||!L_e(t);this.restore=a?P_e(t):M_e(t)}}const F_e=new j_e;function Yx(e=!0,t=null){Je(()=>{if(e)return F_e.acquire(t)},[e,t])}function B_e(e){const t=k.useRef(""),n=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:n}}function Xx(e){const[t,n]=k.useState(null),r=Xe((o,l)=>{e||n(l)}),i=k.useCallback(()=>{n(null)},[]),{onClick:a,onPointerDown:s}=B_e(r);return k.useMemo(()=>({openMethod:t,reset:i,triggerProps:{onClick:a,onPointerDown:s}}),[t,i,a,s])}function Ete(e){const{store:t,parentContext:n,actionsRef:r}=e,i=t.useState("open"),a=t.useState("disablePointerDismissal"),s=t.useState("modal"),o=t.useState("popupElement"),{openMethod:l,triggerProps:u,reset:f}=Xx(i);JP(t);const{forceUnmount:d}=eM(i,t,()=>{f()}),p=Xe(L=>{const D=it(L);return D.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},D}),m=k.useCallback(()=>{t.setOpen(!1,p(qP))},[t,p]);k.useImperativeHandle(r,()=>({unmount:d,close:m}),[d,m]);const y=rM({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[S,g]=k.useState(0),_=S===0,v=Mee(y),x=Cm(y,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(L){if("button"in L&&L.button!==0||"touches"in L&&L.touches.length!==1)return!1;const D=_r(L);if(_&&!a){const z=D;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===z||t.context.backdropRef.current===z||Tt(z,o)&&!z?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:_});Yx(i&&s===!0,o);const{getReferenceProps:T,getFloatingProps:w,getTriggerProps:C}=Qc([v,x]);t.useContextCallback("onNestedDialogOpen",L=>{g(L+1)}),t.useContextCallback("onNestedDialogClose",()=>{g(0)}),k.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(S),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,S]);const R=k.useMemo(()=>T(u),[T,u]),O=k.useMemo(()=>C(u),[C,u]),N=k.useMemo(()=>w(),[w]);t.useSyncedValues({openMethod:l,activeTriggerProps:R,inactiveTriggerProps:O,popupProps:N,floatingRootContext:y,nestedOpenDialogCount:S})}const U_e={...nM,modal:Be(e=>e.modal),nested:Be(e=>e.nested),nestedOpenDialogCount:Be(e=>e.nestedOpenDialogCount),disablePointerDismissal:Be(e=>e.disablePointerDismissal),openMethod:Be(e=>e.openMethod),descriptionElementId:Be(e=>e.descriptionElementId),titleElementId:Be(e=>e.titleElementId),viewportElement:Be(e=>e.viewportElement),role:Be(e=>e.role)};class Ste extends jx{constructor(t){super($_e(t),{popupRef:k.createRef(),backdropRef:k.createRef(),internalBackdropRef:k.createRef(),triggerElements:new Py,onOpenChange:void 0,onOpenChangeComplete:void 0},U_e)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const r={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",r);const i={open:t},a=n.trigger?.id??null;(a||t)&&(i.activeTriggerId=a,i.activeTriggerElement=n.trigger??null),this.update(i)}}function $_e(e={}){return{...tM(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function z_e(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:s=!1,modal:o=!0,actionsRef:l,handle:u,triggerId:f,defaultTriggerId:d=null}=e,p=Au(!0),m=!!p,y=di(()=>u?.store??new Ste({open:n??r,activeTriggerId:f!==void 0?f:d,modal:o,disablePointerDismissal:s,nested:m})).current;y.useControlledProp("open",n,r),y.useControlledProp("activeTriggerId",f,d),y.useSyncedValues({disablePointerDismissal:s,nested:m,modal:o}),y.useContextCallback("onOpenChange",i),y.useContextCallback("onOpenChangeComplete",a);const S=y.useState("payload");Ete({store:y,actionsRef:l,parentContext:p?.store.context});const g=k.useMemo(()=>({store:y}),[y]);return b.jsx(gM.Provider,{value:g,children:typeof t=="function"?t({payload:S}):t})}const xte=k.forwardRef(function(t,n){const{render:r,className:i,id:a,...s}=t,{store:o}=Au(),l=fi(a);return o.useSyncedValueWithCleanup("titleElementId",l),xt("h2",t,{ref:n,props:[{id:l},s]})}),wte=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,id:o,payload:l,handle:u,...f}=t,d=Au(!0),p=u?.store??d?.store;if(!p)throw new Error(rn(79));const m=fi(o),y=p.useState("floatingRootContext"),S=p.useState("isOpenedByTrigger",m),g=k.useRef(null),{registerTrigger:_,isMountedByThisTrigger:v}=QP(m,g,p,{payload:l}),{getButtonProps:x,buttonRef:T}=aa({disabled:a,native:s}),w=Tm(y,{enabled:y!=null}),C=Qc([w]),R=k.useMemo(()=>({disabled:a,open:S}),[a,S]),O=p.useState("triggerProps",v);return xt("button",t,{state:R,ref:[T,n,_,g],props:[C.getReferenceProps(),O,{[AJ]:"",id:m},f,x],stateAttributesMapping:Hx})});function ku({...e}){return b.jsx(z_e,{"data-slot":"dialog",...e})}function Tte({...e}){return b.jsx(wte,{"data-slot":"dialog-trigger",...e})}function H_e({...e}){return b.jsx(_te,{"data-slot":"dialog-portal",...e})}function Rm({...e}){return b.jsx(qx,{"data-slot":"dialog-close",...e})}function W_e({className:e,...t}){return b.jsx(gte,{"data-slot":"dialog-overlay",className:Ue("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 Ou({className:e,children:t,showCloseButton:n=!0,...r}){return b.jsxs(H_e,{children:[b.jsx(W_e,{}),b.jsxs(yte,{"data-slot":"dialog-content",className:Ue("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),...r,children:[t,n&&b.jsxs(qx,{"data-slot":"dialog-close",render:b.jsx(Ke,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[b.jsx(fe,{icon:ci,strokeWidth:2}),b.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Jc({className:e,...t}){return b.jsx("div",{"data-slot":"dialog-header",className:Ue("gap-1 flex flex-col",e),...t})}function Hf({className:e,showCloseButton:t=!1,children:n,...r}){return b.jsxs("div",{"data-slot":"dialog-footer",className:Ue("gap-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...r,children:[n,t&&b.jsx(qx,{render:b.jsx(Ke,{variant:"outline"}),children:"Close"})]})}function ed({className:e,...t}){return b.jsx(xte,{"data-slot":"dialog-title",className:Ue("text-sm font-medium",e),...t})}function zy({className:e,...t}){return b.jsx(bte,{"data-slot":"dialog-description",className:Ue("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed *:[a]:underline *:[a]:underline-offset-3",e),...t})}let iz=(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 V_e={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Wf={valid(e){return e===null?null:e?{[iz.valid]:""}:{[iz.invalid]:""}}},G_e=k.createContext({invalid:void 0,name:void 0,validityData:{state:V_e,errors:[],error:"",value:"",initialValue:null},setValidityData:yr,disabled:void 0,touched:!1,setTouched:yr,dirty:!1,setDirty:yr,filled:!1,setFilled:yr,focused:!1,setFocused:yr,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=Jn)=>e,getInputValidationProps:(e=Jn)=>e,inputRef:{current:null},commit:async()=>{}}});function Fs(e=!0){const t=k.useContext(G_e);if(t.setValidityData===yr&&!e)throw new Error(rn(28));return t}const q_e=k.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:yr,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Hy(){return k.useContext(q_e)}const K_e=k.createContext({controlId:void 0,setControlId:yr,labelId:void 0,setLabelId:yr,messageIds:[],setMessageIds:yr,getDescriptionProps:e=>e});function td(){return k.useContext(K_e)}function Y_e(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Zx(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,setControlId:a}=td(),s=fi(t);return Je(()=>{if(!(!n&&!t||a===yr)){if(n){const o=r?.current;An(o)&&o.closest("label")!=null?a(t??null):a(i??s)}else t&&a(t);return()=>{t&&a(void 0)}}},[t,r,i,a,n,s]),i??s}function Wy(e){const{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:s}=e,{formRef:o}=Hy(),{invalid:l,markedDirtyRef:u,validityData:f,setValidityData:d}=Fs(),p=Xe(e.getValue);Je(()=>{if(!t)return;let m=n;m===void 0&&(m=p()),f.initialValue===null&&m!==null&&d(y=>({...y,initialValue:m}))},[t,d,n,f.initialValue,p]),Je(()=>{!t||!r||o.current.fields.set(r,{getValue:p,name:i,controlRef:a,validityData:Y_e(f,l),validate(){let m=n;m===void 0&&(m=p()),u.current=!0,xr.flushSync(()=>s(m))}})},[s,a,t,o,p,r,l,u,i,f,n]),Je(()=>{const m=o.current.fields;return()=>{r&&m.delete(r)}},[o,r])}const X_e=k.forwardRef(function(t,n){const{render:r,className:i,id:a,name:s,value:o,disabled:l=!1,onValueChange:u,defaultValue:f,...d}=t,{state:p,name:m,disabled:y}=Fs(),S=y||l,g=m??s,_=k.useMemo(()=>({...p,disabled:S}),[p,S]),{setTouched:v,setDirty:x,validityData:T,setFocused:w,setFilled:C,validationMode:R,validation:O}=Fs(),{labelId:N}=td(),L=Zx({id:a});Je(()=>{const $=o!=null;O.inputRef.current?.value||$&&o!==""?C(!0):$&&o===""&&C(!1)},[O.inputRef,C,o]);const[D,z]=Ja({controlled:o,default:f,name:"FieldControl",state:"value"}),M=o!==void 0,V=Xe(($,q)=>{u?.($,q),!q.isCanceled&&z($)});return Wy({id:L,name:g,commit:O.commit,value:D,getValue:()=>O.inputRef.current?.value,controlRef:O.inputRef}),xt("input",t,{ref:n,state:_,props:[{id:L,disabled:S,name:g,ref:O.inputRef,"aria-labelledby":N,...M?{value:D}:{defaultValue:f},onChange($){const q=$.currentTarget.value;V(q,it(Dr,$.nativeEvent)),x(q!==T.initialValue),C(q!=="")},onFocus(){w(!0)},onBlur($){v(!0),w(!1),R==="onBlur"&&O.commit($.currentTarget.value)},onKeyDown($){$.currentTarget.tagName==="INPUT"&&$.key==="Enter"&&(v(!0),O.commit($.currentTarget.value))}},O.getInputValidationProps(),d],stateAttributesMapping:Wf})}),Z_e=k.createContext({disabled:!1});function Q_e(){return k.useContext(Z_e)}const J_e=k.createContext(void 0);function eEe(e=!0){const t=k.useContext(J_e);if(t===void 0&&!e)throw new Error(rn(3));return t}const tEe=k.forwardRef(function(t,n){return b.jsx(X_e,{ref:n,...t})});function vn({className:e,type:t,...n}){return b.jsx(tEe,{type:t,"data-slot":"input",className:Ue("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),...n})}function bM({className:e,...t}){return b.jsx("textarea",{"data-slot":"textarea",className:Ue("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 Cte(e){const t=new FormData;t.append("file",e);const n=await fetch("/api/uploads",{method:"POST",body:t});if(!n.ok)throw new Error("Failed to upload image");return(await n.json()).path}let hk=[];typeof window<"u"&&window.addEventListener("beforeunload",()=>{if(hk.length>0){const e=JSON.stringify({entries:hk});navigator.sendBeacon("/api/logs",e),hk=[]}});const Ate={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},child:()=>Ate};function Dd(e){return Ate}const kt={terminal:Dd(),terminalsView:Dd(),ws:Dd(),taskTerminal:Dd(),repoTerminal:Dd(),kanban:Dd(),viewer:Dd()};function nEe(e){const t=/\/[\w\-/.]+\.(png|jpg|jpeg|gif|webp|svg)/gi;return[...e.match(t)||[]]}function az(e){return`/api/uploads/${e.split("/").pop()}`}function kte({value:e,onValueChange:t,className:n,disabled:r,...i}){const[a,s]=k.useState(!1),o=k.useRef(null),l=nEe(e),u=async f=>{const d=f.clipboardData?.items;if(d){for(const p of d)if(p.type.startsWith("image/")){f.preventDefault();const m=p.getAsFile();if(!m)return;s(!0);try{const y=await Cte(m),S=o.current;if(S){const g=S.selectionStart,_=S.selectionEnd,v=e.slice(0,g),x=e.slice(_),T=v&&!v.endsWith(`
20
+ )`}return b.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:a}})}),_te=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:a}=Au(),s=a.useState("mounted"),o=a.useState("modal");return s||r?b.jsx(vte.Provider,{value:r,children:b.jsxs(Ly,{ref:n,...i,children:[s&&o===!0&&b.jsx(Kx,{ref:a.context.internalBackdropRef,inert:Am(!open)}),t.children]})}):null});let tz={},nz={},rz="";function L_e(e){if(typeof document>"u")return!1;const t=Ci(e);return Er(t).innerWidth-t.documentElement.clientWidth>0}function P_e(e){const t=Ci(e),n=t.documentElement,r=t.body,i=$f(n)?n:r,a=i.style.overflow;return i.style.overflow="hidden",()=>{i.style.overflow=a}}function M_e(e){const t=Ci(e),n=t.documentElement,r=t.body,i=Er(n);let a=0,s=0;const o=Wo.create(),l=typeof CSS<"u"&&CSS.supports?.("scrollbar-gutter","stable");if(jP&&(i.visualViewport?.scale??1)!==1)return()=>{};function u(){const p=i.getComputedStyle(n),m=i.getComputedStyle(r),g=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";a=n.scrollTop,s=n.scrollLeft,tz={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},rz=n.style.scrollBehavior,nz={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const _=n.scrollHeight>n.clientHeight,v=n.scrollWidth>n.clientWidth,x=p.overflowY==="scroll"||m.overflowY==="scroll",T=p.overflowX==="scroll"||m.overflowX==="scroll",w=Math.max(0,i.innerWidth-n.clientWidth),C=Math.max(0,i.innerHeight-n.clientHeight),R=parseFloat(m.marginTop)+parseFloat(m.marginBottom),O=parseFloat(m.marginLeft)+parseFloat(m.marginRight),N=$f(n)?n:r;if(l){n.style.scrollbarGutter=g,N.style.overflowY="hidden",N.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:g,overflowY:"hidden",overflowX:"hidden"}),(_||x)&&(n.style.overflowY="scroll"),(v||T)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:R||C?`calc(100dvh - ${R+C}px)`:"100dvh",width:O||w?`calc(100vw - ${O+w}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=a,r.scrollLeft=s,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function f(){Object.assign(n.style,tz),Object.assign(r.style,nz),l||(n.scrollTop=a,n.scrollLeft=s,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=rz)}function d(){f(),o.request(u)}return u(),i.addEventListener("resize",d),()=>{o.cancel(),f(),typeof i.removeEventListener=="function"&&i.removeEventListener("resize",d)}}class j_e{lockCount=0;restore=null;timeoutLock=Uc.create();timeoutUnlock=Uc.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 r=Ci(t).documentElement,i=Er(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=yr;return}const a=ive||!L_e(t);this.restore=a?P_e(t):M_e(t)}}const F_e=new j_e;function Yx(e=!0,t=null){Je(()=>{if(e)return F_e.acquire(t)},[e,t])}function B_e(e){const t=k.useRef(""),n=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:n}}function Xx(e){const[t,n]=k.useState(null),r=Xe((o,l)=>{e||n(l)}),i=k.useCallback(()=>{n(null)},[]),{onClick:a,onPointerDown:s}=B_e(r);return k.useMemo(()=>({openMethod:t,reset:i,triggerProps:{onClick:a,onPointerDown:s}}),[t,i,a,s])}function Ete(e){const{store:t,parentContext:n,actionsRef:r}=e,i=t.useState("open"),a=t.useState("disablePointerDismissal"),s=t.useState("modal"),o=t.useState("popupElement"),{openMethod:l,triggerProps:u,reset:f}=Xx(i);JP(t);const{forceUnmount:d}=eM(i,t,()=>{f()}),p=Xe(L=>{const D=it(L);return D.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},D}),m=k.useCallback(()=>{t.setOpen(!1,p(qP))},[t,p]);k.useImperativeHandle(r,()=>({unmount:d,close:m}),[d,m]);const y=rM({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[S,g]=k.useState(0),_=S===0,v=Mee(y),x=Cm(y,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(L){if("button"in L&&L.button!==0||"touches"in L&&L.touches.length!==1)return!1;const D=_r(L);if(_&&!a){const z=D;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===z||t.context.backdropRef.current===z||Tt(z,o)&&!z?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:_});Yx(i&&s===!0,o);const{getReferenceProps:T,getFloatingProps:w,getTriggerProps:C}=Qc([v,x]);t.useContextCallback("onNestedDialogOpen",L=>{g(L+1)}),t.useContextCallback("onNestedDialogClose",()=>{g(0)}),k.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(S),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,S]);const R=k.useMemo(()=>T(u),[T,u]),O=k.useMemo(()=>C(u),[C,u]),N=k.useMemo(()=>w(),[w]);t.useSyncedValues({openMethod:l,activeTriggerProps:R,inactiveTriggerProps:O,popupProps:N,floatingRootContext:y,nestedOpenDialogCount:S})}const U_e={...nM,modal:Be(e=>e.modal),nested:Be(e=>e.nested),nestedOpenDialogCount:Be(e=>e.nestedOpenDialogCount),disablePointerDismissal:Be(e=>e.disablePointerDismissal),openMethod:Be(e=>e.openMethod),descriptionElementId:Be(e=>e.descriptionElementId),titleElementId:Be(e=>e.titleElementId),viewportElement:Be(e=>e.viewportElement),role:Be(e=>e.role)};class Ste extends jx{constructor(t){super($_e(t),{popupRef:k.createRef(),backdropRef:k.createRef(),internalBackdropRef:k.createRef(),triggerElements:new Py,onOpenChange:void 0,onOpenChangeComplete:void 0},U_e)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const r={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",r);const i={open:t},a=n.trigger?.id??null;(a||t)&&(i.activeTriggerId=a,i.activeTriggerElement=n.trigger??null),this.update(i)}}function $_e(e={}){return{...tM(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function z_e(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:s=!1,modal:o=!0,actionsRef:l,handle:u,triggerId:f,defaultTriggerId:d=null}=e,p=Au(!0),m=!!p,y=di(()=>u?.store??new Ste({open:n??r,activeTriggerId:f!==void 0?f:d,modal:o,disablePointerDismissal:s,nested:m})).current;y.useControlledProp("open",n,r),y.useControlledProp("activeTriggerId",f,d),y.useSyncedValues({disablePointerDismissal:s,nested:m,modal:o}),y.useContextCallback("onOpenChange",i),y.useContextCallback("onOpenChangeComplete",a);const S=y.useState("payload");Ete({store:y,actionsRef:l,parentContext:p?.store.context});const g=k.useMemo(()=>({store:y}),[y]);return b.jsx(gM.Provider,{value:g,children:typeof t=="function"?t({payload:S}):t})}const xte=k.forwardRef(function(t,n){const{render:r,className:i,id:a,...s}=t,{store:o}=Au(),l=fi(a);return o.useSyncedValueWithCleanup("titleElementId",l),xt("h2",t,{ref:n,props:[{id:l},s]})}),wte=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,id:o,payload:l,handle:u,...f}=t,d=Au(!0),p=u?.store??d?.store;if(!p)throw new Error(rn(79));const m=fi(o),y=p.useState("floatingRootContext"),S=p.useState("isOpenedByTrigger",m),g=k.useRef(null),{registerTrigger:_,isMountedByThisTrigger:v}=QP(m,g,p,{payload:l}),{getButtonProps:x,buttonRef:T}=aa({disabled:a,native:s}),w=Tm(y,{enabled:y!=null}),C=Qc([w]),R=k.useMemo(()=>({disabled:a,open:S}),[a,S]),O=p.useState("triggerProps",v);return xt("button",t,{state:R,ref:[T,n,_,g],props:[C.getReferenceProps(),O,{[AJ]:"",id:m},f,x],stateAttributesMapping:Hx})});function ku({...e}){return b.jsx(z_e,{"data-slot":"dialog",...e})}function Tte({...e}){return b.jsx(wte,{"data-slot":"dialog-trigger",...e})}function H_e({...e}){return b.jsx(_te,{"data-slot":"dialog-portal",...e})}function Rm({...e}){return b.jsx(qx,{"data-slot":"dialog-close",...e})}function W_e({className:e,...t}){return b.jsx(gte,{"data-slot":"dialog-overlay",className:Ue("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 Ou({className:e,children:t,showCloseButton:n=!0,...r}){return b.jsxs(H_e,{children:[b.jsx(W_e,{}),b.jsxs(yte,{"data-slot":"dialog-content",className:Ue("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),...r,children:[t,n&&b.jsxs(qx,{"data-slot":"dialog-close",render:b.jsx(Ke,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[b.jsx(fe,{icon:ci,strokeWidth:2}),b.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Jc({className:e,...t}){return b.jsx("div",{"data-slot":"dialog-header",className:Ue("gap-1 flex flex-col",e),...t})}function Hf({className:e,showCloseButton:t=!1,children:n,...r}){return b.jsxs("div",{"data-slot":"dialog-footer",className:Ue("gap-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...r,children:[n,t&&b.jsx(qx,{render:b.jsx(Ke,{variant:"outline"}),children:"Close"})]})}function ed({className:e,...t}){return b.jsx(xte,{"data-slot":"dialog-title",className:Ue("text-sm font-medium",e),...t})}function zy({className:e,...t}){return b.jsx(bte,{"data-slot":"dialog-description",className:Ue("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed *:[a]:underline *:[a]:underline-offset-3",e),...t})}let iz=(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 V_e={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Wf={valid(e){return e===null?null:e?{[iz.valid]:""}:{[iz.invalid]:""}}},G_e=k.createContext({invalid:void 0,name:void 0,validityData:{state:V_e,errors:[],error:"",value:"",initialValue:null},setValidityData:yr,disabled:void 0,touched:!1,setTouched:yr,dirty:!1,setDirty:yr,filled:!1,setFilled:yr,focused:!1,setFocused:yr,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=Jn)=>e,getInputValidationProps:(e=Jn)=>e,inputRef:{current:null},commit:async()=>{}}});function Fs(e=!0){const t=k.useContext(G_e);if(t.setValidityData===yr&&!e)throw new Error(rn(28));return t}const q_e=k.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:yr,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Hy(){return k.useContext(q_e)}const K_e=k.createContext({controlId:void 0,setControlId:yr,labelId:void 0,setLabelId:yr,messageIds:[],setMessageIds:yr,getDescriptionProps:e=>e});function td(){return k.useContext(K_e)}function Y_e(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function Zx(e={}){const{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,setControlId:a}=td(),s=fi(t);return Je(()=>{if(!(!n&&!t||a===yr)){if(n){const o=r?.current;An(o)&&o.closest("label")!=null?a(t??null):a(i??s)}else t&&a(t);return()=>{t&&a(void 0)}}},[t,r,i,a,n,s]),i??s}function Wy(e){const{enabled:t=!0,value:n,id:r,name:i,controlRef:a,commit:s}=e,{formRef:o}=Hy(),{invalid:l,markedDirtyRef:u,validityData:f,setValidityData:d}=Fs(),p=Xe(e.getValue);Je(()=>{if(!t)return;let m=n;m===void 0&&(m=p()),f.initialValue===null&&m!==null&&d(y=>({...y,initialValue:m}))},[t,d,n,f.initialValue,p]),Je(()=>{!t||!r||o.current.fields.set(r,{getValue:p,name:i,controlRef:a,validityData:Y_e(f,l),validate(){let m=n;m===void 0&&(m=p()),u.current=!0,xr.flushSync(()=>s(m))}})},[s,a,t,o,p,r,l,u,i,f,n]),Je(()=>{const m=o.current.fields;return()=>{r&&m.delete(r)}},[o,r])}const X_e=k.forwardRef(function(t,n){const{render:r,className:i,id:a,name:s,value:o,disabled:l=!1,onValueChange:u,defaultValue:f,...d}=t,{state:p,name:m,disabled:y}=Fs(),S=y||l,g=m??s,_=k.useMemo(()=>({...p,disabled:S}),[p,S]),{setTouched:v,setDirty:x,validityData:T,setFocused:w,setFilled:C,validationMode:R,validation:O}=Fs(),{labelId:N}=td(),L=Zx({id:a});Je(()=>{const $=o!=null;O.inputRef.current?.value||$&&o!==""?C(!0):$&&o===""&&C(!1)},[O.inputRef,C,o]);const[D,z]=Ja({controlled:o,default:f,name:"FieldControl",state:"value"}),M=o!==void 0,V=Xe(($,q)=>{u?.($,q),!q.isCanceled&&z($)});return Wy({id:L,name:g,commit:O.commit,value:D,getValue:()=>O.inputRef.current?.value,controlRef:O.inputRef}),xt("input",t,{ref:n,state:_,props:[{id:L,disabled:S,name:g,ref:O.inputRef,"aria-labelledby":N,...M?{value:D}:{defaultValue:f},onChange($){const q=$.currentTarget.value;V(q,it(Dr,$.nativeEvent)),x(q!==T.initialValue),C(q!=="")},onFocus(){w(!0)},onBlur($){v(!0),w(!1),R==="onBlur"&&O.commit($.currentTarget.value)},onKeyDown($){$.currentTarget.tagName==="INPUT"&&$.key==="Enter"&&(v(!0),O.commit($.currentTarget.value))}},O.getInputValidationProps(),d],stateAttributesMapping:Wf})}),Z_e=k.createContext({disabled:!1});function Q_e(){return k.useContext(Z_e)}const J_e=k.createContext(void 0);function eEe(e=!0){const t=k.useContext(J_e);if(t===void 0&&!e)throw new Error(rn(3));return t}const tEe=k.forwardRef(function(t,n){return b.jsx(X_e,{ref:n,...t})});function vn({className:e,type:t,...n}){return b.jsx(tEe,{type:t,"data-slot":"input",className:Ue("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),...n})}function bM({className:e,...t}){return b.jsx("textarea",{"data-slot":"textarea",className:Ue("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 Cte(e){const t=new FormData;t.append("file",e);const n=await fetch("/api/uploads",{method:"POST",body:t});if(!n.ok)throw new Error("Failed to upload image");return(await n.json()).path}let hk=[];typeof window<"u"&&window.addEventListener("beforeunload",()=>{if(hk.length>0){const e=JSON.stringify({entries:hk});navigator.sendBeacon("/api/logs",e),hk=[]}});const Ate={debug:()=>{},info:()=>{},warn:()=>{},error:()=>{},child:()=>Ate};function Dd(e){return Ate}const At={terminal:Dd(),terminalsView:Dd(),ws:Dd(),taskTerminal:Dd(),repoTerminal:Dd(),kanban:Dd(),viewer:Dd()};function nEe(e){const t=/\/[\w\-/.]+\.(png|jpg|jpeg|gif|webp|svg)/gi;return[...e.match(t)||[]]}function az(e){return`/api/uploads/${e.split("/").pop()}`}function kte({value:e,onValueChange:t,className:n,disabled:r,...i}){const[a,s]=k.useState(!1),o=k.useRef(null),l=nEe(e),u=async f=>{const d=f.clipboardData?.items;if(d){for(const p of d)if(p.type.startsWith("image/")){f.preventDefault();const m=p.getAsFile();if(!m)return;s(!0);try{const y=await Cte(m),S=o.current;if(S){const g=S.selectionStart,_=S.selectionEnd,v=e.slice(0,g),x=e.slice(_),T=v&&!v.endsWith(`
21
21
  `)?`
22
22
  `:"",w=x&&!x.startsWith(`
23
23
  `)?`
24
24
  `:"",C=v+T+y+w+x;t(C)}else t(e+(e?`
25
- `:"")+y)}catch(y){ln.error("Failed to upload image"),kt.kanban.error("Upload error",{error:String(y)})}finally{s(!1)}return}}};return b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"relative",children:[b.jsx(bM,{ref:o,value:e,onChange:f=>t(f.target.value),onPaste:u,className:Ue(a&&"opacity-50",n),disabled:a||r,...i}),a&&b.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50 rounded-md",children:b.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})})]}),l.length>0&&b.jsx("div",{className:"flex flex-wrap gap-2",children:l.map((f,d)=>b.jsx("a",{href:az(f),target:"_blank",rel:"noopener noreferrer",className:"block",children:b.jsx("img",{src:az(f),alt:`Attachment ${d+1}`,className:"h-16 w-auto rounded border object-cover hover:opacity-80 transition-opacity"})},d))})]})}function Ote({className:e,...t}){return b.jsx("label",{"data-slot":"label",className:Ue("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 rEe=k.forwardRef(function(t,n){const{className:r,render:i,orientation:a="horizontal",...s}=t,o=k.useMemo(()=>({orientation:a}),[a]);return xt("div",t,{state:o,ref:n,props:[{role:"separator","aria-orientation":a},s]})});function iEe({className:e,orientation:t="horizontal",...n}){return b.jsx(rEe,{"data-slot":"separator",orientation:t,className:Ue("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",e),...n})}function pf({className:e,...t}){return b.jsx("div",{"data-slot":"field-group",className:Ue("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 aEe=Yc("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 ir({className:e,orientation:t="vertical",...n}){return b.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:Ue(aEe({orientation:t}),e),...n})}function ar({className:e,...t}){return b.jsx(Ote,{"data-slot":"field-label",className:Ue("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 qa({className:e,...t}){return b.jsx("p",{"data-slot":"field-description",className:Ue("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 Rte(e){const t=k.useRef(!0);t.current&&(t.current=!1,e())}const Nte=k.createContext(null),Ite=k.createContext(null);function pl(){const e=k.useContext(Nte);if(e===null)throw new Error(rn(60));return e}function Dte(){const e=k.useContext(Ite);if(e===null)throw new Error(rn(61));return e}const Lte=(e,t)=>Object.is(e,t);function bu(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Qd(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:bu(r,t,n))}function Lp(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:bu(r,t,n))}function Pte(e,t,n){return e.filter(r=>!bu(r,t,n))}function QI(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Mte(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Xr(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 QI(e)}function to(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?QI(e.value):QI(e)}function sEe(e,t,n){if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??Xr(e,n);if(Array.isArray(t)){const r=Mte(t)?t.flatMap(i=>i.items):t;if(e==null){const i=r.find(a=>a.value==null);return i&&i.label!=null?i.label:Xr(e,n)}if(typeof e!="object"){const i=r.find(a=>a&&a.value===e);return i&&i.label!=null?i.label:Xr(e,n)}if("value"in e){const i=r.find(a=>a&&a.value===e.value);if(i&&i.label!=null)return i.label}}return Xr(e,n)}function oEe(e,t){return!Array.isArray(e)||e.length===0?"":e.map(n=>Xr(n,t)).join(", ")}const Wt={id:Be(e=>e.id),modal:Be(e=>e.modal),multiple:Be(e=>e.multiple),items:Be(e=>e.items),itemToStringLabel:Be(e=>e.itemToStringLabel),itemToStringValue:Be(e=>e.itemToStringValue),isItemEqualToValue:Be(e=>e.isItemEqualToValue),value:Be(e=>e.value),open:Be(e=>e.open),mounted:Be(e=>e.mounted),forceMount:Be(e=>e.forceMount),transitionStatus:Be(e=>e.transitionStatus),openMethod:Be(e=>e.openMethod),activeIndex:Be(e=>e.activeIndex),selectedIndex:Be(e=>e.selectedIndex),isActive:Be((e,t)=>e.activeIndex===t),isSelected:Be((e,t,n)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(a=>bu(a,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:bu(i,n,r)}),isSelectedByFocus:Be((e,t)=>e.selectedIndex===t),popupProps:Be(e=>e.popupProps),triggerProps:Be(e=>e.triggerProps),triggerElement:Be(e=>e.triggerElement),positionerElement:Be(e=>e.positionerElement),listElement:Be(e=>e.listElement),scrollUpArrowVisible:Be(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Be(e=>e.scrollDownArrowVisible),hasScrollArrows:Be(e=>e.hasScrollArrows),serializedValue:Be(e=>{const{multiple:t,value:n,itemToStringValue:r}=e;return t&&Array.isArray(n)&&n.length===0?"":to(n,r)})};function Jd(e,t){const n=k.useRef(e),r=Xe(t);Je(()=>{n.current!==e&&r(n.current)},[e,r]),Je(()=>{n.current=e},[e])}function lEe(e){const{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:s=!1,onOpenChange:o,name:l,disabled:u=!1,readOnly:f=!1,required:d=!1,modal:p=!0,actionsRef:m,inputRef:y,onOpenChangeComplete:S,items:g,multiple:_=!1,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T=Lte,highlightItemOnHover:w=!0,children:C}=e,{clearErrors:R}=Hy(),{setDirty:O,shouldValidateOnChange:N,validityData:L,setFilled:D,name:z,disabled:M,validation:V}=Fs(),{controlId:W}=td(),$=Zx({id:t}),q=M||u,Y=z??l,[B,j]=Ja({controlled:n,default:_?r??ea:r,name:"Select",state:"value"}),[U,K]=Ja({controlled:a,default:s,name:"Select",state:"open"}),H=k.useRef([]),J=k.useRef([]),se=k.useRef(null),ae=k.useRef(null),Q=k.useRef(0),G=k.useRef(null),Z=k.useRef([]),ee=k.useRef(!1),ne=k.useRef(!1),te=k.useRef(null),be=k.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),_e=k.useRef(!1),{mounted:he,setMounted:ye,transitionStatus:Ee}=Co(U),{openMethod:xe,triggerProps:ve,reset:De}=Xx(U),Te=di(()=>new hf({id:$,modal:p,multiple:_,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T,value:B,open:U,mounted:he,transitionStatus:Ee,items:g,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,pe=Ye(Te,Wt.activeIndex),ce=Ye(Te,Wt.selectedIndex),Re=Ye(Te,Wt.triggerElement),Pe=Ye(Te,Wt.positionerElement),ge=k.useMemo(()=>_&&Array.isArray(B)&&B.length===0?"":to(B,x),[_,B,x]),Le=k.useMemo(()=>_&&Array.isArray(B)?B.map(yt=>to(yt,x)):to(B,x),[_,B,x]),Ce=lr(Te.state.triggerElement);Wy({id:$,commit:V.commit,value:B,controlRef:Ce,name:Y,getValue:()=>Le});const Ve=k.useRef(B);Je(()=>{B!==Ve.current&&Te.set("forceMount",!0)},[Te,B]),Je(()=>{D(B!==null)},[B,D]),Je(function(){if(U)return;const Bt=Z.current;if(_){const zt=Array.isArray(B)?B:[];if(zt.length===0){Te.set("selectedIndex",null);return}const ft=zt[zt.length-1],yn=Lp(Bt,ft,T);Te.set("selectedIndex",yn===-1?null:yn);return}const Ut=Lp(Bt,B,T);Te.set("selectedIndex",Ut===-1?null:Ut)},[_,U,B,Z,T,Te]),Jd(B,()=>{R(Y),O(B!==L.initialValue),N()?V.commit(B):V.commit(B,!0)});const Ze=Xe((yt,Bt)=>{if(o?.(yt,Bt),!Bt.isCanceled&&(K(yt),!yt&&Te.state.activeIndex!==null)){const Ut=H.current[Te.state.activeIndex];queueMicrotask(()=>{Ut?.setAttribute("tabindex","-1")})}}),gt=Xe(()=>{ye(!1),Te.set("activeIndex",null),De(),S?.(!1)});Ai({enabled:!m,open:U,ref:se,onComplete(){U||gt()}}),k.useImperativeHandle(m,()=>({unmount:gt}),[gt]);const st=Xe((yt,Bt)=>{i?.(yt,Bt),!Bt.isCanceled&&j(yt)}),ot=Xe(()=>{const yt=Te.state.listElement||se.current;if(!yt)return;const Bt=yt.scrollTop,Ut=yt.scrollTop+yt.clientHeight,zt=Bt>1,ft=Ut<yt.scrollHeight-1;Te.state.scrollUpArrowVisible!==zt&&Te.set("scrollUpArrowVisible",zt),Te.state.scrollDownArrowVisible!==ft&&Te.set("scrollDownArrowVisible",ft)}),Fe=Bx({open:U,onOpenChange:Ze,elements:{reference:Re,floating:Pe}}),ht=Tm(Fe,{enabled:!f&&!q,event:"mousedown"}),Ne=Cm(Fe,{bubbles:!1}),ze=iM(Fe,{enabled:!f&&!q,listRef:H,activeIndex:pe,selectedIndex:ce,disabledIndices:ea,onNavigate(yt){yt===null&&!U||Te.set("activeIndex",yt)},focusItemOnHover:!1}),et=aM(Fe,{enabled:!f&&!q&&(U||!_),listRef:J,activeIndex:pe,selectedIndex:ce,onMatch(yt){U?Te.set("activeIndex",yt):st(Z.current[yt],it("none"))},onTypingChange(yt){ee.current=yt}}),{getReferenceProps:lt,getFloatingProps:pt,getItemProps:gn}=Qc([ht,Ne,ze,et]),Ft=k.useMemo(()=>sl(lt(),ve),[lt,ve]);Rte(()=>{Te.update({popupProps:pt(),triggerProps:Ft})}),Je(()=>{Te.update({id:$,modal:p,multiple:_,value:B,open:U,mounted:he,transitionStatus:Ee,popupProps:pt(),triggerProps:Ft,items:g,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T,openMethod:xe})},[Te,$,p,_,B,U,he,Ee,pt,Ft,g,v,x,T,xe]);const Nt=k.useMemo(()=>({store:Te,name:Y,required:d,disabled:q,readOnly:f,multiple:_,itemToStringLabel:v,itemToStringValue:x,highlightItemOnHover:w,setValue:st,setOpen:Ze,listRef:H,popupRef:se,scrollHandlerRef:ae,handleScrollArrowVisibility:ot,scrollArrowsMountedCountRef:Q,getItemProps:gn,events:Fe.context.events,valueRef:G,valuesRef:Z,labelsRef:J,typingRef:ee,selectionRef:be,selectedItemTextRef:te,validation:V,onOpenChangeComplete:S,keyboardActiveRef:ne,alignItemWithTriggerActiveRef:_e,initialValueRef:Ve}),[Te,Y,d,q,f,_,v,x,w,st,Ze,gn,Fe.context.events,V,S,ot]),ct=js(y,V.inputRef),nn=_&&Array.isArray(B)&&B.length>0,Lt=k.useMemo(()=>!_||!Array.isArray(B)||!Y?null:B.map(yt=>{const Bt=to(yt,x);return b.jsx("input",{type:"hidden",name:Y,value:Bt},Bt)}),[_,B,Y,x]);return b.jsx(Nte.Provider,{value:Nt,children:b.jsxs(Ite.Provider,{value:Fe,children:[C,b.jsx("input",{...V.getInputValidationProps({onFocus(){Te.state.triggerElement?.focus()},onChange(yt){if(yt.nativeEvent.defaultPrevented)return;const Bt=yt.target.value,Ut=it(Dr,yt.nativeEvent);function zt(){if(_)return;const ft=Z.current.find(yn=>to(yn,x).toLowerCase()===Bt.toLowerCase());ft!=null&&(O(ft!==L.initialValue),st(ft,Ut),N()&&V.commit(ft))}Te.set("forceMount",!0),queueMicrotask(zt)}}),id:t||W||void 0,name:_?void 0:Y,value:ge,disabled:q,required:d&&!nn,readOnly:f,ref:ct,style:wm,tabIndex:-1,"aria-hidden":!0}),Lt]})})}function vM(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||r.content!=="none"))return t;const a=parseFloat(n.width)||0,s=parseFloat(n.height)||0,o=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=Math.max(t.width,a,o),f=Math.max(t.height,s,l),d=u-t.width,p=f-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const h_=2,uEe={...Ip,...Wf,value:()=>null},cEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,...o}=t,{setTouched:l,setFocused:u,validationMode:f,state:d,disabled:p}=Fs(),{labelId:m}=td(),{store:y,setOpen:S,selectionRef:g,validation:_,readOnly:v,alignItemWithTriggerActiveRef:x,disabled:T,keyboardActiveRef:w}=pl(),C=p||T||a,R=Ye(y,Wt.open),O=Ye(y,Wt.value),N=Ye(y,Wt.triggerProps),L=Ye(y,Wt.positionerElement),D=Ye(y,Wt.listElement),z=Ye(y,Wt.serializedValue),M=lr(L),V=k.useRef(null),W=Pn(),$=Pn(),{getButtonProps:q,buttonRef:Y}=aa({disabled:C,native:s}),B=Xe(ae=>{y.set("triggerElement",ae)}),j=js(n,V,Y,B),U=Pn(),K=Pn();k.useEffect(()=>{if(R)return K.start(200,()=>{g.current.allowUnselectedMouseUp=!0,U.start(200,()=>{g.current.allowSelectedMouseUp=!0})}),()=>{U.clear(),K.clear()};g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},$.clear()},[R,g,$,U,K]);const H=k.useMemo(()=>D?.id??mv(L)?.id,[D,L]),J=sl(N,{role:"combobox","aria-expanded":R?"true":"false","aria-haspopup":"listbox","aria-controls":R?H:void 0,"aria-labelledby":m,"aria-readonly":v||void 0,tabIndex:C?-1:0,ref:j,onFocus(ae){u(!0),R&&x.current&&S(!1,it(ho,ae.nativeEvent)),W.start(0,()=>{y.set("forceMount",!0)})},onBlur(){l(!0),u(!1),f==="onBlur"&&_.commit(O)},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(ae){if(R)return;const Q=Ci(ae.currentTarget);function G(Z){if(!V.current)return;const ee=Z.target;if(Tt(V.current,ee)||Tt(M.current,ee)||ee===V.current)return;const ne=vM(V.current);Z.clientX>=ne.left-h_&&Z.clientX<=ne.right+h_&&Z.clientY>=ne.top-h_&&Z.clientY<=ne.bottom+h_||S(!1,it(gee,Z))}$.start(0,()=>{Q.addEventListener("mouseup",G,{once:!0})})}},_.getValidationProps,o,q);J.role="combobox";const se=k.useMemo(()=>({...d,open:R,disabled:C,value:O,readOnly:v,placeholder:!z}),[d,R,C,O,v,z]);return xt("button",t,{ref:[n,V],state:se,stateAttributesMapping:uEe,props:J})}),dEe={value:()=>null},fEe=k.forwardRef(function(t,n){const{className:r,render:i,children:a,...s}=t,{store:o,valueRef:l}=pl(),u=Ye(o,Wt.value),f=Ye(o,Wt.items),d=Ye(o,Wt.itemToStringLabel),p=Ye(o,Wt.serializedValue),m=k.useMemo(()=>({value:u,placeholder:!p}),[u,p]),y=typeof a=="function"?a(u):a??(Array.isArray(u)?oEe(u,d):sEe(u,f,d));return xt("span",t,{state:m,ref:[n,l],props:[{children:y},s],stateAttributesMapping:dEe})}),hEe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s}=pl(),o=Ye(s,Wt.open),l=k.useMemo(()=>({open:o}),[o]);return xt("span",t,{state:l,ref:n,props:[{"aria-hidden":!0,children:"▼"},a],stateAttributesMapping:Hx})}),pEe=k.createContext(void 0),mEe=k.forwardRef(function(t,n){const{store:r}=pl(),i=Ye(r,Wt.mounted),a=Ye(r,Wt.forceMount);return i||a?b.jsx(pEe.Provider,{value:!0,children:b.jsx(Ly,{ref:n,...t})}):null}),jte=k.createContext(void 0);function yM(){const e=k.useContext(jte);if(!e)throw new Error(rn(59));return e}function qE(e,t){e&&Object.assign(e.style,t)}const Fte={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},gEe={position:"fixed"},bEe=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:m=5,sticky:y=!1,disableAnchorTracking:S,alignItemWithTrigger:g=!0,collisionAvoidance:_=Ix,...v}=t,{store:x,listRef:T,labelsRef:w,alignItemWithTriggerActiveRef:C,selectedItemTextRef:R,valuesRef:O,initialValueRef:N,popupRef:L,setValue:D}=pl(),z=Dte(),M=Ye(x,Wt.open),V=Ye(x,Wt.mounted),W=Ye(x,Wt.modal),$=Ye(x,Wt.value),q=Ye(x,Wt.openMethod),Y=Ye(x,Wt.positionerElement),B=Ye(x,Wt.triggerElement),j=Ye(x,Wt.isItemEqualToValue),U=k.useRef(null),K=k.useRef(null),[H,J]=k.useState(g),se=V&&H&&q!=="touch";!V&&H!==g&&J(g),Je(()=>{V||(Wt.scrollUpArrowVisible(x.state)&&x.set("scrollUpArrowVisible",!1),Wt.scrollDownArrowVisible(x.state)&&x.set("scrollDownArrowVisible",!1))},[x,V]),k.useImperativeHandle(C,()=>se),Yx((se||W)&&M&&q!=="touch",B);const ae=By({anchor:r,floatingRootContext:z,positionMethod:i,mounted:V,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:y,disableAnchorTracking:S??se,collisionAvoidance:_,keepMounted:!0}),Q=se?"none":ae.side,G=se?gEe:ae.positionerStyles,Z=k.useMemo(()=>{const ye={};return M||(ye.pointerEvents="none"),{role:"presentation",hidden:!V,style:{...G,...ye}}},[M,V,G]),ee=k.useMemo(()=>({open:M,side:Q,align:ae.align,anchorHidden:ae.anchorHidden}),[M,Q,ae.align,ae.anchorHidden]),ne=Xe(ye=>{x.set("positionerElement",ye)}),te=xt("div",t,{ref:[n,ne],state:ee,stateAttributesMapping:ka,props:[Z,v]}),be=k.useRef(0),_e=Xe(ye=>{if(ye.size===0&&be.current===0||O.current.length===0)return;const Ee=be.current;if(be.current=ye.size,ye.size===Ee)return;const xe=it(Dr);if(Ee!==0&&!x.state.multiple&&$!==null&&Lp(O.current,$,j)===-1){const De=N.current,pe=De!=null&&Qd(O.current,De,j)?De:null;D(pe,xe),pe===null&&(x.set("selectedIndex",null),R.current=null)}if(Ee!==0&&x.state.multiple&&Array.isArray($)){const ve=$.filter(De=>Qd(O.current,De,j));(ve.length!==$.length||ve.some(De=>!Qd($,De,j)))&&(D(ve,xe),ve.length===0&&(x.set("selectedIndex",null),R.current=null))}if(M&&se){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ve={height:""};qE(Y,ve),qE(L.current,ve)}}),he=k.useMemo(()=>({...ae,side:Q,alignItemWithTriggerActive:se,setControlledAlignItemWithTrigger:J,scrollUpArrowRef:U,scrollDownArrowRef:K}),[ae,Q,se,J]);return b.jsx(My,{elementsRef:T,labelsRef:w,onMapChange:_e,children:b.jsxs(jte.Provider,{value:he,children:[V&&W&&b.jsx(Kx,{inert:Am(!M),cutout:B}),te]})})});function Bte(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 p_="base-ui-disable-scrollbar",Sv={className:p_,element:b.jsx("style",{href:p_,precedence:"base-ui:low",children:`.${p_}{scrollbar-width:none}.${p_}::-webkit-scrollbar{display:none}`})},vEe=k.createContext(void 0);function _M(e){return k.useContext(vEe)}const yEe={...ka,...is},_Ee=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{store:s,popupRef:o,onOpenChangeComplete:l,setOpen:u,valueRef:f,selectedItemTextRef:d,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:y,scrollHandlerRef:S}=pl(),{side:g,align:_,alignItemWithTriggerActive:v,setControlledAlignItemWithTrigger:x,scrollDownArrowRef:T,scrollUpArrowRef:w}=yM(),C=_M()!=null,R=Dte(),O=Pn(),N=Ye(s,Wt.id),L=Ye(s,Wt.open),D=Ye(s,Wt.mounted),z=Ye(s,Wt.popupProps),M=Ye(s,Wt.transitionStatus),V=Ye(s,Wt.triggerElement),W=Ye(s,Wt.positionerElement),$=Ye(s,Wt.listElement),q=k.useRef(0),Y=k.useRef(!1),B=k.useRef(0),j=k.useRef(!1),U=k.useRef({}),K=au(),H=Xe(Q=>{if(!W||!o.current||!j.current)return;if(Y.current||!v){y();return}const G=W.style.top==="0px",Z=W.style.bottom==="0px",ee=W.getBoundingClientRect().height,ne=Ci(W),te=getComputedStyle(W),be=parseFloat(te.marginTop),_e=parseFloat(te.marginBottom),he=ne.documentElement.clientHeight-be-_e,ye=Q.scrollTop,Ee=Q.scrollHeight,xe=Q.clientHeight,ve=Ee-xe;let De=null,Te=null,pe=!1;if(G){const ce=ve-ye,Re=ee+ce,Pe=Math.min(Re,he);De=Pe,Pe!==he?Te=ve:pe=!0}else if(Z){const ce=ye-0,Re=ee+ce,Pe=Math.min(Re,he),ge=Re-he;De=Pe,Pe!==he?Te=0:(pe=!0,ye<ve&&(Te=ye-(ce-ge)))}De!=null&&(W.style.height=`${De}px`),Te!=null&&(Q.scrollTop=Te),pe&&(Y.current=!0),y()});k.useImperativeHandle(S,()=>H,[H]),Ai({open:L,ref:o,onComplete(){L&&l?.(!0)}});const J=k.useMemo(()=>({open:L,transitionStatus:M,side:g,align:_}),[L,M,g,_]);Je(()=>{!W||!o.current||Object.keys(U.current).length||(U.current={top:W.style.top||"0",left:W.style.left||"0",right:W.style.right,height:W.style.height,bottom:W.style.bottom,minHeight:W.style.minHeight,maxHeight:W.style.maxHeight,marginTop:W.style.marginTop,marginBottom:W.style.marginBottom})},[o,W]),Je(()=>{D||v||(j.current=!1,Y.current=!1,q.current=0,B.current=0,qE(W,U.current))},[D,v,W,o]),Je(()=>{const Q=o.current;if(!(!D||!V||!W||!Q)){if(!v){j.current=!0,K.request(y);return}queueMicrotask(()=>{const G=getComputedStyle(W),Z=getComputedStyle(Q),ee=Ci(V),ne=Er(W),te=V.getBoundingClientRect(),be=W.getBoundingClientRect(),_e=te.left,he=te.height,ye=$||Q,Ee=ye.scrollHeight,xe=parseFloat(Z.borderBottomWidth),ve=parseFloat(G.marginTop)||10,De=parseFloat(G.marginBottom)||10,Te=parseFloat(G.minHeight)||100,pe=5,ce=5,Re=20,Pe=ee.documentElement.clientHeight-ve-De,ge=ee.documentElement.clientWidth,Le=Pe-te.bottom+he,Ce=d.current,Ve=f.current;let Ze=0,gt=0;if(Ce&&Ve){const Nt=Ve.getBoundingClientRect(),ct=Ce.getBoundingClientRect(),nn=Nt.left-_e,Lt=ct.left-be.left,yt=Nt.top-te.top+Nt.height/2,Bt=ct.top-be.top+ct.height/2;Ze=nn-Lt,gt=Bt-yt}const st=Le+gt+De+xe;let ot=Math.min(Pe,st);const Fe=Pe-ve-De,ht=st-ot,Ne=Math.max(pe,_e+Ze),ze=ge-ce,et=Math.max(0,Ne+be.width-ze);W.style.left=`${Ne-et}px`,W.style.height=`${ot}px`,W.style.maxHeight="auto",W.style.marginTop=`${ve}px`,W.style.marginBottom=`${De}px`,Q.style.height="100%";const lt=ye.scrollHeight-ye.clientHeight,pt=ht>=lt;pt&&(ot=Math.min(Pe,be.height)-(ht-lt));const gn=te.top<Re||te.bottom>Pe-Re||ot<Math.min(Ee,Te),Ft=(ne.visualViewport?.scale??1)!==1&&jP;if(gn||Ft){j.current=!0,qE(W,U.current),xr.flushSync(()=>x(!1));return}if(pt){const Nt=Math.max(0,Pe-st);W.style.top=be.height>=Fe?"0":`${Nt}px`,W.style.height=`${ot}px`,ye.scrollTop=ye.scrollHeight-ye.clientHeight,q.current=Math.max(Te,ot)}else W.style.bottom="0",q.current=Math.max(Te,ot),ye.scrollTop=ht;q.current===Pe&&(Y.current=!0),y(),setTimeout(()=>{j.current=!0})})}},[s,D,W,V,f,d,o,y,v,x,K,T,w,$]),k.useEffect(()=>{if(!v||!W||!D)return;const Q=Er(W);function G(Z){u(!1,it(Vve,Z))}return Q.addEventListener("resize",G),()=>{Q.removeEventListener("resize",G)}},[u,v,W,D]);const se={...$?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(Q){p.current=!0,C&&oM.has(Q.key)&&Q.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(Q){if(Bte(Q)||Q.pointerType==="touch")return;const G=Q.currentTarget;O.start(0,()=>{s.set("activeIndex",null),G.focus({preventScroll:!0})})},onScroll(Q){$||S.current?.(Q.currentTarget)},...v&&{style:$?{height:"100%"}:Fte}},ae=xt("div",t,{ref:[n,o],state:J,stateAttributesMapping:yEe,props:[z,se,Om(M),{className:!$&&v?Sv.className:void 0},a]});return b.jsxs(k.Fragment,{children:[Sv.element,b.jsx(Px,{context:R,modal:!1,disabled:!D,restoreFocus:!0,children:ae})]})}),EEe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s,scrollHandlerRef:o}=pl(),{alignItemWithTriggerActive:l}=yM(),u=Ye(s,Wt.hasScrollArrows),f=Ye(s,Wt.openMethod),d=Ye(s,Wt.multiple),m={id:`${Ye(s,Wt.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(S){o.current?.(S.currentTarget)},...l&&{style:Fte},className:u&&f!=="touch"?Sv.className:void 0},y=Xe(S=>{s.set("listElement",S)});return xt("div",t,{ref:[n,y],props:[m,a]})}),Ute=k.createContext(void 0);function EM(){const e=k.useContext(Ute);if(!e)throw new Error(rn(57));return e}const SEe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,label:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(null),d=km({label:s,textRef:f,indexGuessBehavior:lM.GuessFromOrder}),{store:p,getItemProps:m,setOpen:y,setValue:S,selectionRef:g,typingRef:_,valuesRef:v,keyboardActiveRef:x,multiple:T,highlightItemOnHover:w}=pl(),C=Pn(),R=Ye(p,Wt.isActive,d.index),O=Ye(p,Wt.isSelected,d.index,a),N=Ye(p,Wt.isSelectedByFocus,d.index),L=Ye(p,Wt.isItemEqualToValue),D=d.index,z=D!==-1,M=k.useRef(null),V=lr(D);Je(()=>{if(!z)return;const ae=v.current;return ae[D]=a,()=>{delete ae[D]}},[z,D,a,v]),Je(()=>{if(!z)return;const ae=p.state.value;let Q=ae;T&&Array.isArray(ae)&&ae.length>0&&(Q=ae[ae.length-1]),Q!==void 0&&bu(Q,a,L)&&p.set("selectedIndex",D)},[z,D,T,L,p,a]);const W=k.useMemo(()=>({disabled:o,selected:O,highlighted:R}),[o,O,R]),$=m({active:R,selected:O});$.onFocus=void 0,$.id=void 0;const q=k.useRef(null),Y=k.useRef("mouse"),B=k.useRef(!1),{getButtonProps:j,buttonRef:U}=aa({disabled:o,focusableWhenDisabled:!0,native:l});function K(ae){const Q=p.state.value;if(T){const G=Array.isArray(Q)?Q:[],Z=O?Pte(G,a,L):[...G,a];S(Z,it(df,ae))}else S(a,it(df,ae)),y(!1,it(df,ae))}const H={role:"option","aria-selected":O,"aria-disabled":o||void 0,tabIndex:R?0:-1,onFocus(){p.set("activeIndex",D)},onMouseEnter(){!x.current&&p.state.selectedIndex===null&&p.set("activeIndex",D)},onMouseMove(){w&&p.set("activeIndex",D)},onMouseLeave(ae){!w||x.current||Bte(ae)||C.start(0,()=>{p.state.activeIndex===D&&p.set("activeIndex",null)})},onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(ae){q.current=ae.key,p.set("activeIndex",D)},onClick(ae){B.current=!1,!(ae.type==="keydown"&&q.current===null)&&(o||q.current===" "&&_.current||Y.current!=="touch"&&!R||(q.current=null,K(ae.nativeEvent)))},onPointerEnter(ae){Y.current=ae.pointerType},onPointerDown(ae){Y.current=ae.pointerType,B.current=!0},onMouseUp(ae){if(o)return;if(B.current){B.current=!1;return}const Q=!g.current.allowSelectedMouseUp&&O,G=!g.current.allowUnselectedMouseUp&&!O;Q||G||Y.current!=="touch"&&!R||K(ae.nativeEvent)}},J=xt("div",t,{ref:[U,n,d.ref,M],state:W,props:[$,H,u,j]}),se=k.useMemo(()=>({selected:O,indexRef:V,textRef:f,selectedByFocus:N,hasRegistered:z}),[O,V,f,N,z]);return b.jsx(Ute.Provider,{value:se,children:J})})),xEe=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=EM();return r||i?b.jsx(wEe,{...t,ref:n}):null}),wEe=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=EM(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=Co(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=xt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:is});return Ai({open:s,ref:o,onComplete(){s||u(!1)}}),d})),TEe=k.memo(k.forwardRef(function(t,n){const{indexRef:r,textRef:i,selectedByFocus:a,hasRegistered:s}=EM(),{selectedItemTextRef:o}=pl(),{className:l,render:u,...f}=t,d=k.useCallback(m=>{if(!m||!s)return;const y=o.current===null||!o.current.isConnected;(a||y&&r.current===0)&&(o.current=m)},[o,r,a,s]);return xt("div",t,{ref:[d,n,i],props:f})})),$te=k.forwardRef(function(t,n){const{render:r,className:i,direction:a,keepMounted:s=!1,...o}=t,{store:l,popupRef:u,listRef:f,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:p}=pl(),{side:m,scrollDownArrowRef:y,scrollUpArrowRef:S}=yM(),g=a==="up"?Wt.scrollUpArrowVisible:Wt.scrollDownArrowVisible,_=Ye(l,g),v=Ye(l,Wt.openMethod),x=_&&v!=="touch",T=Pn(),w=a==="up"?S:y,{transitionStatus:C,setMounted:R}=Co(x);Je(()=>(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]),Ai({open:x,ref:w,onComplete(){x||R(!1)}});const O=k.useMemo(()=>({direction:a,visible:x,side:m,transitionStatus:C}),[a,x,m,C]),L=xt("div",t,{ref:[n,w],state:O,props:[{"aria-hidden":!0,children:a==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(z){if(z.movementX===0&&z.movementY===0||T.isStarted())return;l.set("activeIndex",null);function M(){const V=l.state.listElement??u.current;if(!V)return;l.set("activeIndex",null),d();const W=V.scrollTop===0,$=Math.round(V.scrollTop+V.clientHeight)>=V.scrollHeight;if(f.current.length===0&&(a==="up"?l.set("scrollUpArrowVisible",!W):l.set("scrollDownArrowVisible",!$)),a==="up"&&W||a==="down"&&$){T.clear();return}if((l.state.listElement||u.current)&&f.current&&f.current.length>0){const Y=f.current,B=w.current?.offsetHeight||0;if(a==="up"){let j=0;const U=V.scrollTop+B;for(let H=0;H<Y.length;H+=1){const J=Y[H];if(J&&J.offsetTop>=U){j=H;break}}const K=Math.max(0,j-1);if(K<j){const H=Y[K];H&&(V.scrollTop=Math.max(0,H.offsetTop-B))}else V.scrollTop=0}else{let j=Y.length-1;const U=V.scrollTop+V.clientHeight-B;for(let H=0;H<Y.length;H+=1){const J=Y[H];if(J&&J.offsetTop+J.offsetHeight>U){j=Math.max(0,H-1);break}}const K=Math.min(Y.length-1,j+1);if(K>j){const H=Y[K];H&&(V.scrollTop=H.offsetTop+H.offsetHeight-V.clientHeight+B)}else V.scrollTop=V.scrollHeight-V.clientHeight}}T.start(40,M)}T.start(40,M)},onMouseLeave(){T.clear()}},o]});return x||s?L:null}),CEe=k.forwardRef(function(t,n){return b.jsx($te,{...t,ref:n,direction:"down"})}),AEe=k.forwardRef(function(t,n){return b.jsx($te,{...t,ref:n,direction:"up"})}),ji=lEe;function Fi({className:e,...t}){return b.jsx(fEe,{"data-slot":"select-value",className:Ue("flex flex-1 text-left",e),...t})}function Bi({className:e,size:t="default",children:n,...r}){return b.jsxs(cEe,{"data-slot":"select-trigger","data-size":t,className:Ue("border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r,children:[n,b.jsx(hEe,{render:b.jsx(fe,{icon:dte,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})})]})}function Ui({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:a=0,alignItemWithTrigger:s=!0,...o}){return b.jsx(mEe,{children:b.jsx(bEe,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:s,className:"isolate z-50",children:b.jsxs(_Ee,{"data-slot":"select-content",className:Ue("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 rounded-lg shadow-md ring-1 duration-100 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto",e),...o,children:[b.jsx(kEe,{}),b.jsx(EEe,{children:t}),b.jsx(OEe,{})]})})})}function Cn({className:e,children:t,...n}){return b.jsxs(SEe,{"data-slot":"select-item",className:Ue("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[b.jsx(TEe,{className:"flex flex-1 gap-2 shrink-0 whitespace-nowrap",children:t}),b.jsx(xEe,{render:b.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:b.jsx(fe,{icon:hl,strokeWidth:2,className:"pointer-events-none"})})]})}function kEe({className:e,...t}){return b.jsx(AEe,{"data-slot":"select-scroll-up-button",className:Ue("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:b.jsx(fe,{icon:dM,strokeWidth:2})})}function OEe({className:e,...t}){return b.jsx(CEe,{"data-slot":"select-scroll-down-button",className:Ue("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:b.jsx(fe,{icon:Uy,strokeWidth:2})})}const zte=k.createContext(void 0);function SM(){const e=k.useContext(zte);if(e===void 0)throw new Error(rn(64));return e}let REe=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const xM={tabActivationDirection:e=>({[REe.activationDirection]:e})},NEe=k.forwardRef(function(t,n){const{className:r,defaultValue:i=0,onValueChange:a,orientation:s="horizontal",render:o,value:l,...u}=t,f=Cu(),d=Object.hasOwn(t,"defaultValue"),p=k.useRef([]),[m,y]=k.useState(()=>new Map),[S,g]=Ja({controlled:l,default:i,name:"Tabs",state:"value"}),_=l!==void 0,[v,x]=k.useState(()=>new Map),[T,w]=k.useState("none"),C=Xe((q,Y)=>{a?.(q,Y),!Y.isCanceled&&(g(q),w(Y.activationDirection))}),R=Xe((q,Y)=>{y(B=>{if(B.get(q)===Y)return B;const j=new Map(B);return j.set(q,Y),j})}),O=Xe((q,Y)=>{y(B=>{if(!B.has(q)||B.get(q)!==Y)return B;const j=new Map(B);return j.delete(q),j})}),N=k.useCallback(q=>m.get(q),[m]),L=k.useCallback(q=>{for(const Y of v.values())if(q===Y?.value)return Y?.id},[v]),D=k.useCallback(q=>{if(q===void 0)return null;for(const[Y,B]of v.entries())if(B!=null&&q===(B.value??B.index))return Y;return null},[v]),z=k.useMemo(()=>({direction:f,getTabElementBySelectedValue:D,getTabIdByPanelValue:L,getTabPanelIdByValue:N,onValueChange:C,orientation:s,registerMountedTabPanel:R,setTabMap:x,unregisterMountedTabPanel:O,tabActivationDirection:T,value:S}),[f,D,L,N,C,s,R,x,O,T,S]),M=k.useMemo(()=>{for(const q of v.values())if(q!=null&&q.value===S)return q},[v,S]),V=k.useMemo(()=>{for(const q of v.values())if(q!=null&&!q.disabled)return q.value},[v]);Je(()=>{if(_||v.size===0)return;const q=M?.disabled,Y=M==null&&S!==null;if(d&&q&&S===i||!q&&!Y)return;const j=V??null;S!==j&&(g(j),w("none"))},[i,V,d,_,M,w,g,v,S]);const $=xt("div",t,{state:{orientation:s,tabActivationDirection:T},ref:n,props:u,stateAttributesMapping:xM});return b.jsx(zte.Provider,{value:z,children:b.jsx(My,{elementsRef:p,children:$})})}),Hte=k.createContext(void 0);function IEe(){const e=k.useContext(Hte);if(e===void 0)throw new Error(rn(65));return e}const DEe=k.forwardRef(function(t,n){const{className:r,disabled:i=!1,render:a,value:s,id:o,nativeButton:l=!0,...u}=t,{value:f,getTabPanelIdByValue:d,orientation:p}=SM(),{activateOnFocus:m,highlightedTabIndex:y,onTabActivation:S,setHighlightedTabIndex:g,tabsListElement:_}=IEe(),v=fi(o),x=k.useMemo(()=>({disabled:i,id:v,value:s}),[i,v,s]),{compositeProps:T,compositeRef:w,index:C}=Kee({metadata:x}),R=s===f,O=k.useRef(!1);Je(()=>{if(O.current){O.current=!1;return}if(!(R&&C>-1&&y!==C))return;const B=_;if(B!=null){const j=Cs(Ci(B));if(j&&Tt(B,j))return}i||g(C)},[R,C,y,g,i,_]);const{getButtonProps:N,buttonRef:L}=aa({disabled:i,native:l,focusableWhenDisabled:!0}),D=d(s),z=k.useRef(!1),M=k.useRef(!1);function V(B){R||i||S(s,it(Dr,B.nativeEvent,void 0,{activationDirection:"none"}))}function W(B){R||(C>-1&&!i&&g(C),!i&&m&&(!z.current||z.current&&M.current)&&S(s,it(Dr,B.nativeEvent,void 0,{activationDirection:"none"})))}function $(B){if(R||i)return;z.current=!0;function j(){z.current=!1,M.current=!1}(!B.button||B.button===0)&&(M.current=!0,Ci(B.currentTarget).addEventListener("pointerup",j,{once:!0}))}const q=k.useMemo(()=>({disabled:i,active:R,orientation:p}),[i,R,p]);return xt("button",t,{state:q,ref:[n,L,w],props:[T,{role:"tab","aria-controls":D,"aria-selected":R,id:v,onClick:V,onFocus:W,onPointerDown:$,[Hee]:R?"":void 0,onKeyDownCapture(){O.current=!0}},u,N]})});let LEe=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const PEe=k.forwardRef(function(t,n){const{className:r,value:i,render:a,keepMounted:s=!1,...o}=t,{value:l,getTabIdByPanelValue:u,orientation:f,tabActivationDirection:d,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=SM(),y=fi(),S=k.useMemo(()=>({id:y,value:i}),[y,i]),{ref:g,index:_}=km({metadata:S}),v=i!==l,x=u(i),T=k.useMemo(()=>({hidden:v,orientation:f,tabActivationDirection:d}),[v,f,d]),w=xt("div",t,{state:T,ref:[n,g],props:[{"aria-labelledby":x,hidden:v,id:y??void 0,role:"tabpanel",tabIndex:v?-1:0,[LEe.index]:_},o],stateAttributesMapping:xM});return Je(()=>{if(!(v&&!s)&&y!=null)return p(i,y),()=>{m(i,y)}},[v,s,i,y,p,m]),!v||s?w:null}),MEe=k.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:i,loopFocus:a=!0,render:s,...o}=t,{getTabElementBySelectedValue:l,onValueChange:u,orientation:f,value:d,setTabMap:p,tabActivationDirection:m}=SM(),[y,S]=k.useState(0),[g,_]=k.useState(null),v=jEe(d,f,g,l),x=Xe((R,O)=>{if(R!==d){const N=v(R);O.activationDirection=N,u(R,O)}}),T=k.useMemo(()=>({orientation:f,tabActivationDirection:m}),[f,m]),w={"aria-orientation":f==="vertical"?"vertical":void 0,role:"tablist"},C=k.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:y,onTabActivation:x,setHighlightedTabIndex:S,tabsListElement:g,value:d}),[r,y,x,S,g,d]);return b.jsx(Hte.Provider,{value:C,children:b.jsx(zx,{render:s,className:i,state:T,refs:[n,_],props:[w,o],stateAttributesMapping:xM,highlightedIndex:y,enableHomeAndEndKeys:!0,loopFocus:a,orientation:f,onHighlightedIndexChange:S,onMapChange:p,disabledIndices:ea})})});function sz(e,t){const{left:n,top:r}=e.getBoundingClientRect(),{left:i,top:a}=t.getBoundingClientRect(),s=n-i,o=r-a;return{left:s,top:o}}function jEe(e,t,n,r){const[i,a]=k.useState(null);return Je(()=>{if(e==null||n==null){a(null);return}const s=r(e);if(s==null){a(null);return}const{left:o,top:l}=sz(s,n);a(t==="horizontal"?o:l)},[t,r,n,e]),k.useCallback(s=>{if(s===e)return"none";if(s==null)return a(null),"none";if(s!=null&&n!=null){const o=r(s);if(o!=null){const{left:l,top:u}=sz(o,n);if(i==null)return a(t==="horizontal"?l:u),"none";if(t==="horizontal"){if(l<i)return a(l),"left";if(l>i)return a(l),"right"}else{if(u<i)return a(u),"up";if(u>i)return a(u),"down"}}}return"none"},[r,t,i,n,e])}function su({className:e,orientation:t="horizontal",...n}){return b.jsx(NEe,{"data-slot":"tabs","data-orientation":t,className:Ue("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",e),...n})}const FEe=Yc("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 ou({className:e,variant:t="default",...n}){return b.jsx(MEe,{"data-slot":"tabs-list","data-variant":t,className:Ue(FEe({variant:t}),e),...n})}function li({className:e,...t}){return b.jsx(DEe,{"data-slot":"tabs-trigger",className:Ue("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 Pi({className:e,...t}){return b.jsx(PEe,{"data-slot":"tabs-content",className:Ue("text-xs/relaxed flex-1 min-h-0 outline-none",e),...t})}function BEe(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:s,handle:o,triggerId:l,defaultTriggerId:u=null}=e,f=Au(),d=!!f,p=di(()=>o?.store??new Ste({open:n??r,activeTriggerId:l!==void 0?l:u,modal:!0,disablePointerDismissal:!0,nested:d,role:"alertdialog"})).current;p.useControlledProp("open",n,r),p.useControlledProp("activeTriggerId",l,u),p.useSyncedValue("nested",d),p.useContextCallback("onOpenChange",i),p.useContextCallback("onOpenChangeComplete",a);const m=p.useState("payload");Ete({store:p,actionsRef:s,parentContext:f?.store.context});const y=k.useMemo(()=>({store:p}),[p]);return b.jsx(gM.Provider,{value:y,children:typeof t=="function"?t({payload:m}):t})}const Wte=k.createContext(void 0),Vte=k.createContext(void 0),Gte=k.createContext(void 0),qte=k.createContext("");function Ru(){const e=k.useContext(Wte);if(!e)throw new Error(rn(22));return e}function Qx(){const e=k.useContext(Vte);if(!e)throw new Error(rn(23));return e}function Vf(){const e=k.useContext(Gte);if(!e)throw new Error(rn(24));return e}function wM(){return k.useContext(qte)}const mt={id:Be(e=>e.id),query:Be(e=>e.query),items:Be(e=>e.items),selectedValue:Be(e=>e.selectedValue),open:Be(e=>e.open),mounted:Be(e=>e.mounted),forceMounted:Be(e=>e.forceMounted),inline:Be(e=>e.inline),activeIndex:Be(e=>e.activeIndex),selectedIndex:Be(e=>e.selectedIndex),isActive:Be((e,t)=>e.activeIndex===t),isSelected:Be((e,t)=>{const n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(i=>bu(i,t,n)):bu(r,t,n)}),transitionStatus:Be(e=>e.transitionStatus),popupProps:Be(e=>e.popupProps),inputProps:Be(e=>e.inputProps),triggerProps:Be(e=>e.triggerProps),getItemProps:Be(e=>e.getItemProps),positionerElement:Be(e=>e.positionerElement),listElement:Be(e=>e.listElement),triggerElement:Be(e=>e.triggerElement),inputElement:Be(e=>e.inputElement),popupSide:Be(e=>e.popupSide),openMethod:Be(e=>e.openMethod),inputInsidePopup:Be(e=>e.inputInsidePopup),selectionMode:Be(e=>e.selectionMode),listRef:Be(e=>e.listRef),labelsRef:Be(e=>e.labelsRef),popupRef:Be(e=>e.popupRef),emptyRef:Be(e=>e.emptyRef),inputRef:Be(e=>e.inputRef),keyboardActiveRef:Be(e=>e.keyboardActiveRef),chipsContainerRef:Be(e=>e.chipsContainerRef),clearRef:Be(e=>e.clearRef),valuesRef:Be(e=>e.valuesRef),allValuesRef:Be(e=>e.allValuesRef),name:Be(e=>e.name),disabled:Be(e=>e.disabled),readOnly:Be(e=>e.readOnly),required:Be(e=>e.required),grid:Be(e=>e.grid),isGrouped:Be(e=>e.isGrouped),virtualized:Be(e=>e.virtualized),onOpenChangeComplete:Be(e=>e.onOpenChangeComplete),openOnInputClick:Be(e=>e.openOnInputClick),itemToStringLabel:Be(e=>e.itemToStringLabel),isItemEqualToValue:Be(e=>e.isItemEqualToValue),modal:Be(e=>e.modal),autoHighlight:Be(e=>e.autoHighlight),submitOnItemClick:Be(e=>e.submitOnItemClick)};function UEe(e,t){return(n,r)=>{if(n==null)return!1;const i=Xr(n,t);return e.contains(i,r)}}function $Ee(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;const a=Xr(r,t),s=n!=null?Xr(n,t):"";return s&&e.contains(s,i)&&s.length===i.length?!0:e.contains(a,i)}}const oz=new Map;function Kte(e){return Array.isArray(e)?e.map(t=>Kte(t)).join(","):e==null?"":String(e)}function zEe(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${Kte(e.locale)}|${JSON.stringify(t)}`,r=oz.get(n);if(r)return r;const i=new Intl.Collator(e.locale,t),a={contains(s,o,l){if(!o)return!0;const u=Xr(s,l);for(let f=0;f<=u.length-o.length;f+=1)if(i.compare(u.slice(f,f+o.length),o)===0)return!0;return!1},startsWith(s,o,l){if(!o)return!0;const u=Xr(s,l);return i.compare(u.slice(0,o.length),o)===0},endsWith(s,o,l){if(!o)return!0;const u=Xr(s,l),f=o.length;return u.length>=f&&i.compare(u.slice(u.length-f),o)===0}};return oz.set(n,a),a}const HEe=zEe,Yte=Symbol("none"),Ld={value:Yte,index:-1};function WEe(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:s,inputValue:o,selectionMode:l="none",onItemHighlighted:u,name:f,disabled:d=!1,readOnly:p=!1,required:m=!1,inputRef:y,grid:S=!1,items:g,filteredItems:_,filter:v,openOnInputClick:x=!0,autoHighlight:T=!1,keepHighlight:w=!1,highlightItemOnHover:C=!0,itemToStringLabel:R,itemToStringValue:O,isItemEqualToValue:N=Lte,virtualized:L=!1,inline:D=!1,fillInputOnItemPress:z=!0,modal:M=!1,limit:V=-1,autoComplete:W="list",locale:$,submitOnItemClick:q=!1}=e,{clearErrors:Y}=Hy(),{setDirty:B,validityData:j,shouldValidateOnChange:U,setFilled:K,name:H,disabled:J,validation:se}=Fs(),ae=Zx({id:t}),Q=HEe({locale:$}),[G,Z]=k.useState(!1),[ee,ne]=k.useState(null),te=k.useRef([]),be=k.useRef([]),_e=k.useRef(null),he=k.useRef(null),ye=k.useRef(null),Ee=k.useRef(!0),xe=k.useRef(!1),ve=k.useRef(null),De=k.useRef(null),Te=k.useRef(null),pe=k.useRef(Ld),ce=k.useRef(null),Re=k.useRef([]),Pe=k.useRef([]),ge=J||d,Le=H??f,Ce=l==="multiple",Ve=l==="single",Ze=o!==void 0||s!==void 0,gt=g!==void 0,st=_!==void 0;let ot;T==="always"?ot="always":ot=T?"input-change":!1;const[Fe,ht]=Ja({controlled:i,default:Ce?r??ea:r,name:"Combobox",state:"selectedValue"}),Ne=k.useMemo(()=>v===null?()=>!0:v!==void 0?v:Ve&&!G?$Ee(Q,R,Fe):UEe(Q,R),[v,Ve,Fe,G,Q,R]),ze=di(()=>Ze?s??"":Ve?Xr(Fe,R):"").current,[et,lt]=Ja({controlled:o,default:ze,name:"Combobox",state:"inputValue"}),[pt,gn]=Ja({controlled:e.open,default:e.defaultOpen,name:"Combobox",state:"open"}),Ft=Mte(g),Nt=ee??(et===""?"":String(et).trim()),ct=Ve?Xr(Fe,R):"",nn=Ve&&!G&&Nt!==""&&ct!==""&&ct.length===Nt.length&&Q.contains(ct,Nt),Lt=nn?"":Nt,yt=gt&&st&&nn,Bt=k.useMemo(()=>g?Ft?g.flatMap(dt=>dt.items):g:ea,[g,Ft]),Ut=k.useMemo(()=>{if(_&&!yt)return _;if(!g)return ea;if(Ft){const Ct=g,qt=[];let Kn=0;for(const vr of Ct){if(V>-1&&Kn>=V)break;const Mr=Lt===""?vr.items:vr.items.filter(Rl=>Ne(Rl,Lt,R));if(Mr.length===0)continue;const kl=V>-1?V-Kn:1/0,Ol=Mr.slice(0,kl);if(Ol.length>0){const Rl={...vr,items:Ol};qt.push(Rl),Kn+=Ol.length}}return qt}if(Lt==="")return V>-1?Bt.slice(0,V):Bt;const dt=[];for(const Ct of Bt){if(V>-1&&dt.length>=V)break;Ne(Ct,Lt,R)&&dt.push(Ct)}return dt},[_,yt,g,Ft,Lt,V,Ne,R,Bt]),zt=k.useMemo(()=>Ft?Ut.flatMap(Ct=>Ct.items):Ut,[Ut,Ft]),ft=di(()=>new hf({id:ae,selectedValue:Fe,open:pt,filter:Ne,query:Nt,items:g,selectionMode:l,listRef:te,labelsRef:be,popupRef:_e,emptyRef:ye,inputRef:he,keyboardActiveRef:Ee,chipsContainerRef:ve,clearRef:De,valuesRef:Re,allValuesRef:Pe,selectionEventRef:Te,name:Le,disabled:ge,readOnly:p,required:m,grid:S,isGrouped:Ft,virtualized:L,openOnInputClick:x,itemToStringLabel:R,isItemEqualToValue:N,modal:M,autoHighlight:ot,submitOnItemClick:q,hasInputValue:Ze,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:D,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:n||yr,setOpen:yr,setInputValue:yr,setSelectedValue:yr,setIndices:yr,onItemHighlighted:yr,handleSelection:yr,getItemProps:()=>Jn,forceMount:yr,requestSubmit:yr})).current,yn=l==="none"?et:Fe,mr=k.useMemo(()=>l==="none"?yn:Array.isArray(Fe)?Fe.map(dt=>to(dt,O)):to(Fe,O),[yn,O,l,Fe]),Vr=Xe(u),Pr=Xe(n),Ki=Ye(ft,mt.activeIndex),Kt=Ye(ft,mt.selectedIndex),Ri=Ye(ft,mt.positionerElement),gr=Ye(ft,mt.listElement),br=Ye(ft,mt.triggerElement),ss=Ye(ft,mt.inputElement),Yi=Ye(ft,mt.inline),Ws=Ye(ft,mt.inputInsidePopup),ig=lr(br),{mounted:hd,setMounted:xl,transitionStatus:wl}=Co(pt),{openMethod:Vs,triggerProps:os,reset:Tl}=Xx(pt);Wy({id:ae,name:Le,commit:se.commit,value:yn,controlRef:Ws?ig:he,getValue:()=>mr});const Ni=Xe(()=>{g?be.current=zt.map(dt=>Xr(dt,R)):ft.set("forceMounted",!0)}),Tr=k.useRef(Fe);Je(()=>{Fe!==Tr.current&&Ni()},[Ni,Fe]);const mi=Xe(dt=>{ft.update(dt);const Ct=dt.type||"none";if(dt.activeIndex!==void 0)if(dt.activeIndex===null)pe.current!==Ld&&(pe.current=Ld,Vr(void 0,ib(Ct,void 0,{index:-1})));else{const qt=Re.current[dt.activeIndex];pe.current={value:qt,index:dt.activeIndex},Vr(qt,ib(Ct,void 0,{index:dt.activeIndex}))}}),Ge=Xe((dt,Ct)=>{if(xe.current=Ct.reason===gc,e.onInputValueChange?.(dt,Ct),!Ct.isCanceled){if(Ct.reason===Yd){const qt=dt.trim()!=="";qt&&Z(!0),ce.current={hasQuery:qt},qt&&ot&&ft.state.activeIndex==null&&ft.set("activeIndex",0)}lt(dt)}}),Rt=Xe((dt,Ct)=>{pt!==dt&&(Ct.reason==="escape-key"&&gt&&zt.length===0&&!ft.state.emptyRef.current&&Ct.allowPropagation(),e.onOpenChange?.(dt,Ct),!Ct.isCanceled&&(!dt&&G&&(Ve?(ne(Nt),Nt===""&&Z(!1)):Ce&&(Yi||Ws?mi({activeIndex:null}):ne(Nt),Ge("",it(gc,Ct.event)))),gn(dt)))}),Cr=Xe((dt,Ct)=>{if(a?.(dt,Ct),Ct.isCanceled)return;ht(dt),(l==="none"&&_e.current&&z||Ve&&!ft.state.inputInsidePopup)&&Ge(Xr(dt,R),it(Ct.reason,Ct.event)),Ve&&dt!=null&&Ct.reason!==Yd&&G&&ne(Nt)}),Cl=Xe((dt,Ct)=>{let qt=Ct;if(qt===void 0){if(Ki===null)return;qt=Re.current[Ki]}const Kn=_r(dt),vr=Te.current??dt;Te.current=null;const Mr=it(df,vr),kl=Kn?.closest("a")?.getAttribute("href");if(kl){kl.startsWith("#")&&Rt(!1,Mr);return}if(Ce){const Ol=Array.isArray(Fe)?Fe:[],Gs=Qd(Ol,qt,ft.state.isItemEqualToValue)?Pte(Ol,qt,ft.state.isItemEqualToValue):[...Ol,qt];if(Cr(Gs,Mr),!(he.current?he.current.value.trim()!=="":!1))return;ft.state.inputInsidePopup?Ge("",it(gc,Mr.event)):Rt(!1,Mr)}else Cr(qt,Mr),Rt(!1,Mr)}),Ia=Xe(()=>{if(!ft.state.submitOnItemClick)return;const dt=ft.state.inputElement?.form;dt&&typeof dt.requestSubmit=="function"&&dt.requestSubmit()}),pd=Xe(()=>{if(xl(!1),Pr?.(!1),Z(!1),Tl(),ne(null),mi(l==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ce&&he.current&&he.current.value!==""&&!xe.current&&Ge("",it(gc)),Ve)if(ft.state.inputInsidePopup)he.current&&he.current.value!==""&&Ge("",it(gc));else{const dt=Xr(Fe,R);he.current&&he.current.value!==dt&&Ge(dt,it(dt===""?gc:Dr))}}),OT=k.useMemo(()=>Yi&&Ri?{current:Ri.closest('[role="dialog"]')}:_e,[Yi,Ri]);Ai({enabled:!e.actionsRef,open:pt,ref:OT,onComplete(){pt||pd()}}),k.useImperativeHandle(e.actionsRef,()=>({unmount:pd}),[pd]),Je(function(){if(pt||l==="none")return;const Ct=g?Bt:Pe.current;if(Ce){const qt=Array.isArray(Fe)?Fe:[],Kn=qt[qt.length-1],vr=Lp(Ct,Kn,N);mi({selectedIndex:vr===-1?null:vr})}else{const qt=Lp(Ct,Fe,N);mi({selectedIndex:qt===-1?null:qt})}},[pt,Fe,g,l,Bt,Ce,N,mi]),Je(()=>{g&&(Re.current=zt,te.current.length=zt.length)},[g,zt]),Je(()=>{const dt=ce.current;if(dt&&(dt.hasQuery?ot&&ft.set("activeIndex",0):ot==="always"&&ft.set("activeIndex",0),ce.current=null),!pt&&!Yi)return;const qt=gt||st?zt:Re.current,Kn=ft.state.activeIndex;if(Kn==null){if(ot==="always"&&qt.length>0){ft.set("activeIndex",0);return}pe.current!==Ld&&(pe.current=Ld,ft.state.onItemHighlighted(void 0,ib(Dr,void 0,{index:-1})));return}if(Kn>=qt.length){pe.current!==Ld&&(pe.current=Ld,ft.state.onItemHighlighted(void 0,ib(Dr,void 0,{index:-1}))),ft.set("activeIndex",null);return}const vr=qt[Kn],Mr=pe.current.value,kl=Mr!==Yte&&ft.state.isItemEqualToValue(vr,Mr);(pe.current.index!==Kn||!kl)&&(pe.current={value:vr,index:Kn},ft.state.onItemHighlighted(vr,ib(Dr,void 0,{index:Kn})))},[Ki,ot,st,gt,zt,Yi,pt,ft]),Je(()=>{if(!g||l==="none")return;const dt=Bt;if(Ce){const Kn=Array.isArray(Fe)?Fe:ea,vr=Kn.filter(Mr=>Qd(dt,Mr,ft.state.isItemEqualToValue));vr.length!==Kn.length&&ht(vr);return}if(Fe==null?!0:Qd(dt,Fe,ft.state.isItemEqualToValue))return;let qt=null;if(r!=null&&Qd(dt,r,ft.state.isItemEqualToValue)&&(qt=r),ht(qt),!ft.state.inputInsidePopup){const Kn=Xr(qt,R);he.current&&he.current.value!==Kn&&Ge(Kn,it(Dr))}},[g,Bt,Ce,l,Fe,r,ht,R,ft,Ge]),Je(()=>{if(l==="none"){K(String(et)!=="");return}K(Ce?Array.isArray(Fe)&&Fe.length>0:Fe!=null)},[K,l,et,Fe,Ce]),k.useEffect(()=>{gt&&ot&&zt.length===0&&mi({activeIndex:null})},[gt,ot,zt.length,mi]),Jd(Nt,()=>{!pt||Nt===""||Nt===String(ze)||Z(!0)}),Jd(Fe,()=>{if(l!=="none"&&(Y(Le),B(Fe!==j.initialValue),U()?se.commit(Fe):se.commit(Fe,!0),Ce&&ft.state.selectedIndex!==null&&(!Array.isArray(Fe)||Fe.length===0)&&mi({activeIndex:null,selectedIndex:null}),Ve&&!Ze&&!Ws)){const dt=Xr(Fe,R);et!==dt&&Ge(dt,it(Dr))}}),Jd(et,()=>{l==="none"&&(Y(Le),B(et!==j.initialValue),U()?se.commit(et):se.commit(et,!0))}),Jd(g,()=>{if(!Ve||Ze||Ws||G)return;const dt=Xr(Fe,R);et!==dt&&Ge(dt,it(Dr))});const Al=Bx({open:Yi?!0:pt,onOpenChange:Rt,elements:{reference:Ws?br:ss,floating:Ri}});let ju,Da;Yi||(ju=S?"grid":"listbox",Da=pt?"true":"false");const sa=k.useMemo(()=>{const dt=ss?.tagName==="INPUT",Ct=dt||pt,qt=dt?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return Ct&&(qt.role="combobox",qt["aria-expanded"]=Da,qt["aria-haspopup"]=ju,qt["aria-controls"]=pt?gr?.id:void 0,qt["aria-autocomplete"]=W),{reference:qt,floating:{role:"presentation"}}},[ss,pt,Da,ju,gr?.id,W]),L0=Tm(Al,{enabled:!p&&!ge&&x,event:"mousedown-only",toggle:!1,touchOpenDelay:Ws?0:50}),RT=Cm(Al,{enabled:!p&&!ge&&!Yi,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Yi?!0:void 0,outsidePress(dt){const Ct=_r(dt);return!Tt(br,Ct)&&!Tt(De.current,Ct)&&!Tt(ve.current,Ct)}}),ag=iM(Al,{enabled:!p&&!ge,id:ae,listRef:te,activeIndex:Ki,selectedIndex:Kt,virtual:!0,loopFocus:!0,allowEscape:!ot,focusItemOnOpen:G||l==="none"&&!ot?!1:"auto",focusItemOnHover:C,resetOnPointerLeave:!w,cols:S?2:1,orientation:S?"horizontal":void 0,disabledIndices:ea,onNavigate(dt,Ct){!Ct&&!pt||wl==="ending"||mi(Ct?{activeIndex:dt,type:Ee.current?"keyboard":"pointer"}:{activeIndex:dt})}}),{getReferenceProps:ch,getFloatingProps:Fu,getItemProps:sg}=Qc([sa,L0,RT,ag]);Rte(()=>{ft.update({inline:D,popupProps:Fu(),inputProps:ch(),triggerProps:os,getItemProps:sg,setOpen:Rt,setInputValue:Ge,setSelectedValue:Cr,setIndices:mi,onItemHighlighted:Vr,handleSelection:Cl,forceMount:Ni,requestSubmit:Ia})}),Je(()=>{ft.update({id:ae,selectedValue:Fe,open:pt,mounted:hd,transitionStatus:wl,items:g,inline:D,popupProps:Fu(),inputProps:ch(),triggerProps:os,openMethod:Vs,getItemProps:sg,selectionMode:l,name:Le,disabled:ge,readOnly:p,required:m,grid:S,isGrouped:Ft,virtualized:L,onOpenChangeComplete:Pr,openOnInputClick:x,itemToStringLabel:R,modal:M,autoHighlight:ot,isItemEqualToValue:N,submitOnItemClick:q,hasInputValue:Ze,requestSubmit:Ia})},[ft,ae,Fe,pt,hd,wl,g,Fu,ch,sg,Vs,os,l,Le,ge,p,m,se,S,Ft,L,Pr,x,R,M,N,q,Ze,D,Ia,ot]);const oa=js(y,se.inputRef),og=k.useMemo(()=>({query:Nt,filteredItems:Ut,flatFilteredItems:zt}),[Nt,Ut,zt]),P0=k.useMemo(()=>Array.isArray(yn)?"":to(yn,O),[yn,O]),lg=Ce&&Array.isArray(Fe)&&Fe.length>0,Bu=k.useMemo(()=>!Ce||!Array.isArray(Fe)||!Le?null:Fe.map(dt=>{const Ct=to(dt,O);return b.jsx("input",{type:"hidden",name:Le,value:Ct},Ct)}),[Ce,Fe,Le,O]),M0=b.jsxs(k.Fragment,{children:[e.children,b.jsx("input",{...se.getInputValidationProps({onFocus(){if(Ws){br?.focus();return}(he.current||br)?.focus()},onChange(dt){if(dt.nativeEvent.defaultPrevented)return;const Ct=dt.target.value,qt=it(Yd,dt.nativeEvent);function Kn(){if(Ce)return;if(l==="none"){B(Ct!==j.initialValue),Ge(Ct,qt),U()&&se.commit(Ct);return}const vr=Re.current.find(Mr=>to(Mr,O).toLowerCase()===Ct.toLowerCase());vr!=null&&(B(vr!==j.initialValue),Cr?.(vr,qt),U()&&se.commit(vr))}g?Kn():(Ni(),queueMicrotask(Kn))}}),id:ae,name:Ce||l==="none"?void 0:Le,disabled:ge,required:m&&!lg,readOnly:p,value:P0,ref:oa,style:wm,tabIndex:-1,"aria-hidden":!0}),Bu]});return b.jsx(Wte.Provider,{value:ft,children:b.jsx(Vte.Provider,{value:Al,children:b.jsx(Gte.Provider,{value:og,children:b.jsx(qte.Provider,{value:et,children:M0})})})})}const m_=2,VEe={...Ip,...Wf},GEe=k.forwardRef(function(t,n){const{render:r,className:i,nativeButton:a=!0,disabled:s=!1,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=Fs(),{labelId:y}=td(),S=Ru(),g=Ye(S,mt.selectionMode),_=Ye(S,mt.disabled),v=Ye(S,mt.readOnly),x=Ye(S,mt.listElement),T=Ye(S,mt.triggerProps),w=Ye(S,mt.triggerElement),C=Ye(S,mt.inputInsidePopup),R=Ye(S,mt.open),O=Ye(S,mt.selectedValue),N=Ye(S,mt.activeIndex),L=Ye(S,mt.selectedIndex),D=Qx(),z=wM(),M=Pn(),V=u||_||s,W=k.useRef("");function $(se){W.current=se.pointerType}const q=D.select("domReferenceElement");k.useEffect(()=>{C&&w&&w!==q&&D.set("domReferenceElement",w)},[w,q,D,C]);const{reference:Y}=aM(D,{enabled:!R&&!v&&!_&&g==="single",listRef:S.state.labelsRef,activeIndex:N,selectedIndex:L,onMatch(se){const ae=S.state.valuesRef.current[se];ae!==void 0&&S.state.setSelectedValue(ae,it("none"))}}),{reference:B}=Tm(D,{enabled:!v&&!_,event:"mousedown"}),{buttonRef:j,getButtonProps:U}=aa({native:a,disabled:V}),K=k.useMemo(()=>({...l,open:R,disabled:V}),[l,R,V]),H=Xe(se=>{S.set("triggerElement",se)});return xt("button",t,{ref:[n,j,H],state:K,props:[T,B,Y,{tabIndex:C?0:-1,disabled:V,role:C?"combobox":void 0,"aria-expanded":R?"true":"false","aria-haspopup":C?"dialog":"listbox","aria-controls":R?x?.id:void 0,"aria-readonly":v||void 0,"aria-labelledby":y,onPointerDown:$,onPointerEnter:$,onFocus(){d(!0),!(V||v)&&M.start(0,S.state.forceMount)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const se=g==="none"?z:O;m.commit(se)}},onMouseDown(se){if(V||v||(C||D.set("domReferenceElement",se.currentTarget),S.state.forceMount(),W.current!=="touch"&&(S.state.inputRef.current?.focus(),C||se.preventDefault()),R))return;const ae=Ci(se.currentTarget);function Q(G){if(!w)return;const Z=_r(G),ee=S.state.positionerElement,ne=S.state.listElement;if(Tt(w,Z)||Tt(ee,Z)||Tt(ne,Z)||Z===w)return;const te=vM(w),be=G.clientX>=te.left-m_&&G.clientX<=te.right+m_,_e=G.clientY>=te.top-m_&&G.clientY<=te.bottom+m_;be&&_e||S.state.setOpen(!1,it("cancel-open",G))}C&&ae.addEventListener("mouseup",Q,{once:!0})},onKeyDown(se){V||v||(se.key==="ArrowDown"||se.key==="ArrowUp")&&(Rr(se),S.state.setOpen(!0,it(mp,se.nativeEvent)),S.state.inputRef.current?.focus())}},m?m.getValidationProps(o):o,U],stateAttributesMapping:VEe})}),qEe=k.createContext(void 0);function KEe(){return k.useContext(qEe)}const Xte=k.createContext(void 0);function TM(e){const t=k.useContext(Xte);if(t===void 0&&!e)throw new Error(rn(21));return t}const YEe={...Ip,...Wf,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},XEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,id:s,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=Fs(),{labelId:y}=td(),S=KEe(),_=!!TM(!0),v=Ru(),{filteredItems:x}=Vf(),T=wM(),w=fi(s),C=Cu(),R=Ye(v,mt.disabled),O=Ye(v,mt.readOnly),N=Ye(v,mt.name),L=Ye(v,mt.selectionMode),D=Ye(v,mt.autoHighlight),z=Ye(v,mt.inputProps),M=Ye(v,mt.triggerProps),V=Ye(v,mt.open),W=Ye(v,mt.mounted),$=Ye(v,mt.selectedValue),q=Ye(v,mt.popupSide),Y=Ye(v,mt.positionerElement),B=!!D,j=W&&Y?q:null,U=u||R||a,K=x.length===0,[H,J]=k.useState(null),se=k.useRef(!1),ae=Xe(ee=>{const ne=_||v.state.inline;ne&&!v.state.hasInputValue&&v.state.setInputValue("",it(Dr)),v.update({inputElement:ee,inputInsidePopup:ne})}),Q=k.useMemo(()=>({...l,open:V,disabled:U,readOnly:O,popupSide:j,listEmpty:K}),[l,V,U,O,j,K]);function G(ee){if(!S)return;let ne;const{highlightedChipIndex:te}=S;if(te!==void 0){if(ee.key==="ArrowLeft")ee.preventDefault(),te>0?ne=te-1:ne=void 0;else if(ee.key==="ArrowRight")ee.preventDefault(),te<$.length-1?ne=te+1:ne=void 0;else if(ee.key==="Backspace"||ee.key==="Delete"){ee.preventDefault();const be=te>=$.length-1?$.length-2:te;ne=be>=0?be:void 0,v.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return ne}return ee.key==="ArrowLeft"&&(ee.currentTarget.selectionStart??0)===0&&$.length>0?(ee.preventDefault(),ne=Math.max($.length-1,0)):ee.key==="Backspace"&&ee.currentTarget.value===""&&$.length>0&&(v.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),ee.preventDefault()),ne}return xt("input",t,{state:Q,ref:[n,v.state.inputRef,ae],props:[z,M,{type:"text",value:t.value??H??T,"aria-readonly":O||void 0,"aria-labelledby":y,disabled:U,readOnly:O,...L==="none"&&N&&{name:N},id:w,onFocus(){d(!0)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const ee=L==="none"?T:$;m.commit(ee)}},onCompositionStart(ee){DE||(se.current=!0,J(ee.currentTarget.value))},onCompositionEnd(ee){se.current=!1;const ne=ee.currentTarget.value;J(null),v.state.setInputValue(ne,it(Yd,ee.nativeEvent))},onChange(ee){if(se.current){const _e=ee.currentTarget.value;J(_e),_e===""&&!v.state.openOnInputClick&&!v.state.inputInsidePopup&&v.state.setOpen(!1,it(gc,ee.nativeEvent));const he=_e.trim(),ye=B&&he!=="";!O&&!U&&he!==""&&(v.state.setOpen(!0,it(Yd,ee.nativeEvent)),B||v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&v.state.activeIndex!==null&&!ye&&v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"});return}v.state.setInputValue(ee.currentTarget.value,it(Yd,ee.nativeEvent));const ne=ee.currentTarget.value==="",te=it(gc,ee.nativeEvent);ne&&!v.state.inputInsidePopup&&(L==="single"&&v.state.setSelectedValue(null,te),v.state.openOnInputClick||v.state.setOpen(!1,te));const be=ee.currentTarget.value.trim();!O&&!U&&be!==""&&(v.state.setOpen(!0,it(Yd,ee.nativeEvent)),B||v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&v.state.activeIndex!==null&&!B&&v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(ee){if(U||O||ee.ctrlKey||ee.shiftKey||ee.altKey||ee.metaKey)return;v.state.keyboardActiveRef.current=!0;const ne=ee.currentTarget,te=ne.scrollWidth-ne.clientWidth,be=C==="rtl";if(ee.key==="Home"){Rr(ee);const he=b$&&be?ne.value.length:0;ne.setSelectionRange(he,he),ne.scrollLeft=0;return}if(ee.key==="End"){Rr(ee);const he=b$&&be?0:ne.value.length;ne.setSelectionRange(he,he),ne.scrollLeft=be?-te:te;return}if(!W&&ee.key==="Escape"){const he=L==="multiple"&&Array.isArray($)?$.length===0:$===null,ye=it(Dy,ee.nativeEvent),Ee=L==="multiple"?[]:null;v.state.setInputValue("",ye),v.state.setSelectedValue(Ee,ye),!he&&!v.state.inline&&!ye.isPropagationAllowed&&ee.stopPropagation();return}if(S&&ee.key==="Backspace"&&ne.value===""&&S.highlightedChipIndex===void 0&&Array.isArray($)&&$.length>0){const he=$.slice(0,-1);v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"}),v.state.setSelectedValue(he,it(Dr,ee.nativeEvent));return}const _e=G(ee);if(S?.setHighlightedChipIndex(_e),_e!==void 0?S?.chipsRef.current[_e]?.focus():v.state.inputRef.current?.focus(),ee.which!==229&&ee.key==="Enter"&&V){const he=v.state.activeIndex,ye=ee.nativeEvent;if(he===null){v.state.setOpen(!1,it(Dr,ye));return}Rr(ee);const Ee=v.state.listRef.current[he];Ee&&(v.state.selectionEventRef.current=ye,Ee.click(),v.state.selectionEventRef.current=null)}},onPointerMove(){v.state.keyboardActiveRef.current=!1},onPointerDown(){v.state.keyboardActiveRef.current=!1}},m?m.getValidationProps(o):o],stateAttributesMapping:YEe})}),ZEe={...is,...Hx},QEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,keepMounted:o=!1,...l}=t,{disabled:u}=Fs(),f=Ru(),d=Ye(f,mt.selectionMode),p=Ye(f,mt.disabled),m=Ye(f,mt.readOnly),y=Ye(f,mt.open),S=Ye(f,mt.selectedValue),g=wM();let _=!1;d==="none"?_=g!=="":d==="single"?_=S!=null:_=Array.isArray(S)&&S.length>0;const v=u||p||a,{buttonRef:x,getButtonProps:T}=aa({native:s,disabled:v}),{mounted:w,transitionStatus:C,setMounted:R}=Co(_),O=k.useMemo(()=>({disabled:v,open:y,transitionStatus:C}),[v,y,C]);Ai({open:_,ref:f.state.clearRef,onComplete(){_||R(!1)}});const N=xt("button",t,{state:O,ref:[n,x,f.state.clearRef],props:[{tabIndex:-1,children:"x",disabled:v,"aria-readonly":m||void 0,onMouseDown(D){D.preventDefault()},onClick(D){if(v||m)return;const z=f.state.keyboardActiveRef;f.state.setInputValue("",it(w$,D.nativeEvent)),d!=="none"?(f.state.setSelectedValue(Array.isArray(S)?[]:null,it(w$,D.nativeEvent)),f.state.setIndices({activeIndex:null,selectedIndex:null,type:z.current?"keyboard":"pointer"})):f.state.setIndices({activeIndex:null,type:z.current?"keyboard":"pointer"}),f.state.inputRef.current?.focus()}},l,T],stateAttributesMapping:ZEe});return o||w?N:null}),JEe=k.createContext(null);function eSe(){return k.useContext(JEe)}function tSe(e){const{children:t}=e,{filteredItems:n}=Vf(),r=eSe(),i=r?r.items:n;return i?b.jsx(k.Fragment,{children:i.map(t)}):null}const nSe=k.forwardRef(function(t,n){var r;const{render:i,className:a,children:s,...o}=t,l=Ru(),u=Qx(),f=!!TM(!0),{filteredItems:d}=Vf(),p=Ye(l,mt.items),m=Ye(l,mt.labelsRef),y=Ye(l,mt.listRef),S=Ye(l,mt.selectionMode),g=Ye(l,mt.grid),_=Ye(l,mt.popupProps),v=Ye(l,mt.disabled),x=Ye(l,mt.readOnly),T=Ye(l,mt.virtualized),w=S==="multiple",C=d.length===0,R=Xe(M=>{l.set("positionerElement",M)}),O=Xe(M=>{l.set("listElement",M)}),N=k.useMemo(()=>typeof s=="function"?r||(r=b.jsx(tSe,{children:s})):s,[s]),L=k.useMemo(()=>({empty:C}),[C]),D=u.useState("floatingId"),z=xt("div",t,{state:L,ref:[n,O,f?null:R],props:[_,{children:N,tabIndex:-1,id:D,role:g?"grid":"listbox","aria-multiselectable":w?"true":void 0,onKeyDown(M){if(!(v||x)&&M.key==="Enter"){const V=l.state.activeIndex;if(V==null)return;Rr(M);const W=M.nativeEvent,$=l.state.listRef.current[V];$&&(l.state.selectionEventRef.current=W,$.click(),l.state.selectionEventRef.current=null)}},onKeyDownCapture(){l.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.state.keyboardActiveRef.current=!1}},o]});return T?z:b.jsx(My,{elementsRef:y,labelsRef:p?void 0:m,children:z})}),Zte=k.createContext(void 0);function rSe(){const e=k.useContext(Zte);if(e===void 0)throw new Error(rn(20));return e}const iSe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,a=Ru(),s=Ye(a,mt.mounted),o=Ye(a,mt.forceMounted);return s||r||o?b.jsx(Zte.Provider,{value:r,children:b.jsx(Ly,{ref:n,...i})}):null}),aSe=k.forwardRef(function(t,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:y=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=Ix,..._}=t,v=Ru(),{filteredItems:x}=Vf(),T=Qx(),w=rSe(),C=Ye(v,mt.modal),R=Ye(v,mt.open),O=Ye(v,mt.mounted),N=Ye(v,mt.openMethod),L=Ye(v,mt.triggerElement),D=Ye(v,mt.inputElement),z=Ye(v,mt.inputInsidePopup),M=x.length===0,W=By({anchor:a??(z?L:D),floatingRootContext:T,positionMethod:s,mounted:O,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:y,disableAnchorTracking:S,keepMounted:w,collisionAvoidance:g,lazyFlip:!0});Yx(R&&C&&N!=="touch",L);const $=k.useMemo(()=>{const U={...W.positionerStyles};return R||(U.pointerEvents="none"),{role:"presentation",hidden:!O,style:U}},[R,O,W.positionerStyles]),q=k.useMemo(()=>({open:R,side:W.side,align:W.align,anchorHidden:W.anchorHidden,empty:M}),[R,W.side,W.align,W.anchorHidden,M]);Je(()=>{v.set("popupSide",W.side)},[v,W.side]);const Y=k.useMemo(()=>({side:W.side,align:W.align,arrowRef:W.arrowRef,arrowUncentered:W.arrowUncentered,arrowStyles:W.arrowStyles,anchorHidden:W.anchorHidden,isPositioned:W.isPositioned}),[W.side,W.align,W.arrowRef,W.arrowUncentered,W.arrowStyles,W.anchorHidden,W.isPositioned]),B=Xe(U=>{v.set("positionerElement",U)}),j=xt("div",t,{state:q,ref:[n,B],props:[$,_],stateAttributesMapping:ka});return b.jsxs(Xte.Provider,{value:Y,children:[O&&C&&b.jsx(Kx,{inert:Am(!R),cutout:D??L}),j]})}),sSe={...ka,...is},oSe=k.forwardRef(function(t,n){const{render:r,className:i,initialFocus:a,finalFocus:s,...o}=t,l=Ru(),u=TM(),f=Qx(),{filteredItems:d}=Vf(),p=Ye(l,mt.mounted),m=Ye(l,mt.open),y=Ye(l,mt.openMethod),S=Ye(l,mt.transitionStatus),g=Ye(l,mt.inputInsidePopup),_=Ye(l,mt.inputElement),v=d.length===0;Ai({open:m,ref:l.state.popupRef,onComplete(){m&&l.state.onOpenChangeComplete(!0)}});const x=k.useMemo(()=>({open:m,side:u.side,align:u.align,anchorHidden:u.anchorHidden,transitionStatus:S,empty:v}),[m,u.side,u.align,u.anchorHidden,S,v]),T=xt("div",t,{state:x,ref:[n,l.state.popupRef],props:[{role:g?"dialog":"presentation",tabIndex:-1,onFocus(O){const N=_r(O.nativeEvent);y!=="touch"&&(Tt(l.state.listElement,N)||N===O.currentTarget)&&l.state.inputRef.current?.focus()}},Om(S),o],stateAttributesMapping:sSe}),C=a===void 0?g?O=>O==="touch"?l.state.popupRef.current:_:!1:a;let R;return s!=null?R=s:R=g?void 0:!1,b.jsx(Px,{context:f,disabled:!p,modal:!g,openInteractionType:y,initialFocus:C,returnFocus:R,children:T})}),Qte=k.createContext(void 0);function Jte(){const e=k.useContext(Qte);if(!e)throw new Error(rn(19));return e}const lSe=k.createContext(!1);function uSe(){return k.useContext(lSe)}const cSe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,index:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(!1),d=k.useRef(null),p=km({index:s,textRef:d,indexGuessBehavior:lM.GuessFromOrder}),m=Ru(),y=uSe(),{flatFilteredItems:S}=Vf(),g=Ye(m,mt.open),_=Ye(m,mt.selectionMode),v=Ye(m,mt.readOnly),x=Ye(m,mt.virtualized),T=Ye(m,mt.isItemEqualToValue),w=_!=="none",C=s??(x?Lp(S,a,T):p.index),R=p.index!==-1,O=Ye(m,mt.id),N=Ye(m,mt.isActive,C),L=Ye(m,mt.isSelected,a),D=Ye(m,mt.items),z=Ye(m,mt.getItemProps),M=k.useRef(null),V=O!=null&&R?`${O}-${C}`:void 0,W=L&&w;Je(()=>{if(!(R&&(x||s!=null)))return;const se=m.state.listRef.current;return se[C]=M.current,()=>{delete se[C]}},[R,x,C,s,m]),Je(()=>{if(!R||D)return;const J=m.state.valuesRef.current;return J[C]=a,_!=="none"&&m.state.allValuesRef.current.push(a),()=>{delete J[C]}},[R,D,C,a,m,_]),Je(()=>{if(!g){f.current=!1;return}if(!R||D)return;const J=m.state.selectedValue,se=Array.isArray(J)?J[J.length-1]:J;bu(se,a,T)&&m.set("selectedIndex",C)},[R,D,g,m,C,a,T]);const $=k.useMemo(()=>({disabled:o,selected:W,highlighted:N}),[o,W,N]),q=z({active:N,selected:W});q.id=void 0,q.onFocus=void 0;const{getButtonProps:Y,buttonRef:B}=aa({disabled:o,focusableWhenDisabled:!0,native:l});function j(J){function se(){m.state.handleSelection(J,a)}m.state.submitOnItemClick?(xr.flushSync(se),m.state.requestSubmit()):se()}const U={id:V,role:y?"gridcell":"option","aria-disabled":o||void 0,"aria-selected":w?W:void 0,tabIndex:void 0,onPointerDownCapture(J){f.current=!0,J.preventDefault()},onClick(J){o||v||j(J.nativeEvent)},onMouseUp(J){const se=f.current;f.current=!1,!(o||v||J.button!==0||se||!N)&&j(J.nativeEvent)}},K=xt("div",t,{ref:[B,n,p.ref,M],state:$,props:[q,U,u,Y]}),H=k.useMemo(()=>({selected:W,textRef:d}),[W,d]);return b.jsx(Qte.Provider,{value:H,children:K})})),dSe=k.forwardRef(function(t,n){const{render:r,className:i,children:a,...s}=t,{filteredItems:o}=Vf(),l=Ru(),u=o.length===0?a:null;return xt("div",t,{ref:[n,l.state.emptyRef],props:[{children:u,role:"status","aria-live":"polite","aria-atomic":!0},s]})});let lz=(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 ene(e){return k.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[lz.checked]:""}:{[lz.unchecked]:""}},...Wf}),[e.indeterminate])}const tne=k.createContext(void 0);function fSe(){const e=k.useContext(tne);if(e===void 0)throw new Error(rn(14));return e}const hSe="data-parent",pSe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a=!1,disabled:s=!1,id:o,indeterminate:l=!1,inputRef:u,name:f,onCheckedChange:d,parent:p=!1,readOnly:m=!1,render:y,required:S=!1,uncheckedValue:g,value:_,nativeButton:v=!1,...x}=t,{clearErrors:T}=Hy(),{disabled:w,name:C,setDirty:R,setFilled:O,setFocused:N,setTouched:L,state:D,validationMode:z,validityData:M,shouldValidateOnChange:V,validation:W}=Fs(),$=Q_e(),{labelId:q,controlId:Y,setControlId:B,getDescriptionProps:j}=td(),U=eEe(),K=U?.parent,H=K&&U.allValues,J=w||$.disabled||U?.disabled||s,se=C??f,ae=_??se,Q=fi(),G=fi();let Z=Y;H?Z=p?G:`${K.id}-${ae}`:o&&(Z=o);let ee={};H&&(p?ee=U.parent.getParentProps():ae&&(ee=U.parent.getChildProps(ae)));const ne=Xe(d),{checked:te=r,indeterminate:be=l,onCheckedChange:_e,...he}=ee,ye=U?.value,Ee=U?.setValue,xe=U?.defaultValue,ve=k.useRef(null),{getButtonProps:De,buttonRef:Te}=aa({disabled:J,native:v}),pe=U?.validation??W,[ce,Re]=Ja({controlled:ae&&ye&&!p?ye.includes(ae):te,default:ae&&xe&&!p?xe.includes(ae):a,name:"Checkbox",state:"checked"});Je(()=>{if(B!==yr)return B(Z),()=>{B(void 0)}},[Z,U,B,p]),Wy({enabled:!U,id:Q,commit:pe.commit,value:ce,controlRef:ve,name:se,getValue:()=>ce});const Pe=k.useRef(null),ge=js(u,Pe,pe.inputRef);Je(()=>{Pe.current&&(Pe.current.indeterminate=be,ce&&O(!0))},[ce,be,O]),Jd(ce,()=>{U&&!p||(T(se),O(ce),R(ce!==M.initialValue),V()?pe.commit(ce):pe.commit(ce,!0))});const Le=sl({checked:ce,disabled:J,name:p?void 0:se,id:Z??void 0,required:S,ref:ge,style:wm,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(ot){if(ot.nativeEvent.defaultPrevented)return;const Fe=ot.target.checked,ht=it(Dr,ot.nativeEvent);if(_e?.(Fe,ht),ne(Fe,ht),!ht.isCanceled&&(Re(Fe),ae&&ye&&Ee&&!p)){const Ne=Fe?[...ye,ae]:ye.filter(ze=>ze!==ae);Ee(Ne,ht)}},onFocus(){ve.current?.focus()}},_!==void 0?{value:(U?ce&&_:_)||""}:Jn,j,U?pe.getValidationProps:pe.getInputValidationProps),Ce=H?!!te:ce,Ve=H&&be||l;k.useEffect(()=>{K&&ae&&K.disabledStatesRef.current.set(ae,J)},[K,J,ae]);const Ze=k.useMemo(()=>({...D,checked:Ce,disabled:J,readOnly:m,required:S,indeterminate:Ve}),[D,Ce,J,m,S,Ve]),gt=ene(Ze),st=xt("span",t,{state:Ze,ref:[Te,ve,n,U?.registerControlRef],props:[{id:Q,role:"checkbox","aria-checked":be?"mixed":ce,"aria-readonly":m||void 0,"aria-required":S||void 0,"aria-labelledby":q,[hSe]:p?"":void 0,onFocus(){N(!0)},onBlur(){const ot=Pe.current;ot&&(L(!0),N(!1),z==="onBlur"&&pe.commit(U?ye:ot.checked))},onClick(ot){m||J||(ot.preventDefault(),Pe.current?.click())}},j,pe.getValidationProps,x,he,De],stateAttributesMapping:gt});return b.jsxs(tne.Provider,{value:Ze,children:[st,!ce&&!U&&se&&!p&&g!==void 0&&b.jsx("input",{type:"hidden",name:se,value:g}),b.jsx("input",{...Le})]})}),mSe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=fSe(),l=o.checked||o.indeterminate,{transitionStatus:u,setMounted:f}=Co(l),d=k.useRef(null),p=k.useMemo(()=>({...o,transitionStatus:u}),[o,u]);Ai({open:l,ref:d,onComplete(){l||f(!1)}});const m=ene(o),y=k.useMemo(()=>({...m,...is,...Wf}),[m]),S=a||l,g=xt("span",t,{enabled:S,ref:[n,d],state:p,stateAttributesMapping:y,props:s});return S?g:null});function gSe(e){const{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,...a}=e;return b.jsx(WEe,{...a,selectionMode:t?"multiple":"single",selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i})}const bSe=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=Jte();return r||i?b.jsx(vSe,{...t,ref:n}):null}),vSe=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=Jte(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=Co(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=xt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:is});return Ai({open:s,ref:o,onComplete(){s||u(!1)}}),d})),ySe=k.createContext(void 0);function Jx(e=!0){const t=k.useContext(ySe);if(t===void 0&&!e)throw new Error(rn(25));return t}const nne=k.createContext(void 0);function CM(e){const t=k.useContext(nne);if(t===void 0&&!e)throw new Error(rn(33));return t}const rne=k.createContext(void 0);function nd(e){const t=k.useContext(rne);if(t===void 0&&!e)throw new Error(rn(36));return t}const ine={type:"regular-item"};function ane(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,nativeButton:s,itemMetadata:o,nodeId:l}=e,u=k.useRef(null),f=Jx(!0),d=f!==void 0,{events:p}=a.useState("floatingTreeRoot"),{getButtonProps:m,buttonRef:y}=aa({disabled:n,focusableWhenDisabled:!0,native:s}),S=k.useCallback(_=>sl({id:i,role:"menuitem",tabIndex:r?0:-1,onMouseMove(v){l&&p.emit("itemhover",{nodeId:l,target:v.currentTarget})},onMouseEnter(){o.type==="submenu-trigger"&&o.setActive()},onKeyUp(v){v.key===" "&&a.context.typingRef.current&&v.preventBaseUIHandler()},onClick(v){t&&p.emit("close",{domEvent:v,reason:df})},onMouseUp(v){if(f){const x=f.initialCursorPointRef.current;if(f.initialCursorPointRef.current=null,d&&x&&Math.abs(v.clientX-x.x)<=1&&Math.abs(v.clientY-x.y)<=1)return}u.current&&a.context.allowMouseUpTriggerRef.current&&(!d||v.button===2)&&o.type==="regular-item"&&u.current.click()}},_,m),[i,r,m,t,p,a,d,f,o,l]),g=js(u,y);return k.useMemo(()=>({getItemProps:S,itemRef:g}),[S,g])}let uz=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const sne={checked(e){return e?{[uz.checked]:""}:{[uz.unchecked]:""}},...is},_Se=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!0,...f}=t,d=km({label:s}),p=CM(!0),m=fi(a),{store:y}=nd(),S=y.useState("isActive",d.index),g=y.useState("itemProps"),{getItemProps:_,itemRef:v}=ane({closeOnClick:u,disabled:l,highlighted:S,id:m,store:y,nativeButton:o,nodeId:p?.nodeId,itemMetadata:ine}),x=k.useMemo(()=>({disabled:l,highlighted:S}),[l,S]);return xt("div",t,{state:x,props:[g,f,_],ref:[v,n,d.ref]})}),ESe={...ka,...is},SSe=k.forwardRef(function(t,n){const{render:r,className:i,finalFocus:a,...s}=t,{store:o}=nd(),{side:l,align:u}=CM(),f=_M()!=null,d=o.useState("open"),p=o.useState("transitionStatus"),m=o.useState("popupProps"),y=o.useState("mounted"),S=o.useState("instantType"),g=o.useState("activeTriggerElement"),_=o.useState("parent"),v=o.useState("lastOpenChangeReason"),x=o.useState("rootId"),T=o.useState("floatingRootContext"),w=o.useState("floatingTreeRoot"),C=o.useState("closeDelay"),R=o.useState("activeTriggerElement");Ai({open:d,ref:o.context.popupRef,onComplete(){d&&o.context.onOpenChangeComplete?.(!0)}}),k.useEffect(()=>{function M(V){o.setOpen(!1,it(V.reason,V.domEvent))}return w.events.on("close",M),()=>{w.events.off("close",M)}},[w.events,o]);const O=o.useState("hoverEnabled"),N=o.useState("disabled");Lee(T,{enabled:O&&!N&&_.type!=="context-menu"&&_.type!=="menubar",closeDelay:C});const L=k.useMemo(()=>({transitionStatus:p,side:l,align:u,open:d,nested:_.type==="menu",instant:S}),[p,l,u,d,_.type,S]),D=xt("div",t,{state:L,ref:[n,o.context.popupRef],stateAttributesMapping:ESe,props:[m,{onKeyDown(M){f&&oM.has(M.key)&&M.stopPropagation()}},Om(p),s,{"data-rootownerid":x}]});let z=_.type===void 0||_.type==="context-menu";return(g||_.type==="menubar"&&v!==Lx)&&(z=!0),b.jsx(Px,{context:T,modal:!1,disabled:!y,returnFocus:a===void 0?z:a,initialFocus:_.type!=="menu",restoreFocus:!0,externalTree:_.type!=="menubar"?w:void 0,previousFocusableElement:R,nextFocusableElement:_.type===void 0?o.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?o.context.beforeContentFocusGuardRef:void 0,children:D})}),one=k.createContext(void 0);function xSe(){const e=k.useContext(one);if(e===void 0)throw new Error(rn(32));return e}const wSe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:a}=nd();return a.useState("mounted")||r?b.jsx(one.Provider,{value:r,children:b.jsx(Ly,{ref:n,...i})}):null}),TSe=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o,align:l,sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:y=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=Ix,..._}=t,{store:v}=nd(),x=xSe(),T=Jx(!0),w=v.useState("parent"),C=v.useState("floatingRootContext"),R=v.useState("floatingTreeRoot"),O=v.useState("mounted"),N=v.useState("open"),L=v.useState("modal"),D=v.useState("activeTriggerElement"),z=v.useState("lastOpenChangeReason"),M=v.useState("floatingNodeId"),V=v.useState("floatingParentNodeId");let W=r,$=u,q=f,Y=l,B=g;w.type==="context-menu"&&(W=r??w.context?.anchor,Y=Y??"start",!o&&Y!=="center"&&(q=t.alignOffset??2,$=t.sideOffset??-5));let j=o,U=Y;w.type==="menu"?(j=j??"inline-end",U=U??"start",B=t.collisionAvoidance??LP):w.type==="menubar"&&(j=j??"bottom",U=U??"start");const K=w.type==="context-menu",H=By({anchor:W,floatingRootContext:C,positionMethod:T?"fixed":i,mounted:O,side:j,sideOffset:$,align:U,alignOffset:q,arrowPadding:K?0:m,collisionBoundary:d,collisionPadding:p,sticky:y,nodeId:M,keepMounted:x,disableAnchorTracking:S,collisionAvoidance:B,shiftCrossAxis:K,externalTree:R}),J=k.useMemo(()=>{const ee={};return N||(ee.pointerEvents="none"),{role:"presentation",hidden:!O,style:{...H.positionerStyles,...ee}}},[N,O,H.positionerStyles]);k.useEffect(()=>{function ee(ne){ne.open?(ne.parentNodeId===M&&v.set("hoverEnabled",!1),ne.nodeId!==M&&ne.parentNodeId===v.select("floatingParentNodeId")&&v.setOpen(!1,it(kb))):ne.parentNodeId===M&&ne.reason!==kb&&v.set("hoverEnabled",!0)}return R.events.on("menuopenchange",ee),()=>{R.events.off("menuopenchange",ee)}},[v,R.events,M]),k.useEffect(()=>{if(v.select("floatingParentNodeId")==null)return;function ee(ne){if(ne.open||ne.nodeId!==v.select("floatingParentNodeId"))return;const te=ne.reason??kb;v.setOpen(!1,it(te))}return R.events.on("menuopenchange",ee),()=>{R.events.off("menuopenchange",ee)}},[R.events,v]),k.useEffect(()=>{function ee(ne){!N||ne.nodeId!==v.select("floatingParentNodeId")||ne.target&&D&&D!==ne.target&&v.setOpen(!1,it(kb))}return R.events.on("itemhover",ee),()=>{R.events.off("itemhover",ee)}},[R.events,N,D,v]),k.useEffect(()=>{const ee={open:N,nodeId:M,parentNodeId:V,reason:v.select("lastOpenChangeReason")};R.events.emit("menuopenchange",ee)},[R.events,N,v,M,V]);const se=k.useMemo(()=>({open:N,side:H.side,align:H.align,anchorHidden:H.anchorHidden,nested:w.type==="menu"}),[N,H.side,H.align,H.anchorHidden,w.type]),ae=k.useMemo(()=>({side:H.side,align:H.align,arrowRef:H.arrowRef,arrowUncentered:H.arrowUncentered,arrowStyles:H.arrowStyles,nodeId:H.context.nodeId}),[H.side,H.align,H.arrowRef,H.arrowUncentered,H.arrowStyles,H.context.nodeId]),Q=xt("div",t,{state:se,stateAttributesMapping:ka,ref:[n,v.useStateSetter("positionerElement")],props:[J,_]}),G=O&&w.type!=="menu"&&(w.type!=="menubar"&&L&&z!==dr||w.type==="menubar"&&w.context.modal);let Z=null;return w.type==="menubar"?Z=w.context.contentElement:w.type===void 0&&(Z=D),b.jsxs(nne.Provider,{value:ae,children:[G&&b.jsx(Kx,{ref:w.type==="context-menu"||w.type==="nested-context-menu"?w.context.internalBackdropRef:null,inert:Am(!N),cutout:Z}),b.jsx(pee,{id:M,children:b.jsx(My,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:Q})})]})}),lne=k.createContext(void 0);function CSe(){const e=k.useContext(lne);if(e===void 0)throw new Error(rn(34));return e}const ASe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a,defaultValue:s,onValueChange:o,disabled:l=!1,...u}=t,[f,d]=Ja({controlled:a,default:s,name:"MenuRadioGroup"}),p=Xe(o),m=Xe((_,v)=>{p?.(_,v),!v.isCanceled&&d(_)}),y=k.useMemo(()=>({disabled:l}),[l]),S=xt("div",t,{state:y,ref:n,props:{role:"group","aria-disabled":l||void 0,...u}}),g=k.useMemo(()=>({value:f,setValue:m,disabled:l}),[f,m,l]);return b.jsx(lne.Provider,{value:g,children:S})})),une=k.createContext(void 0);function kSe(){const e=k.useContext(une);if(e===void 0)throw new Error(rn(35));return e}const OSe=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!1,value:f,...d}=t,p=km({label:s}),m=CM(!0),y=fi(a),{store:S}=nd(),g=S.useState("isActive",p.index),_=S.useState("itemProps"),{value:v,setValue:x,disabled:T}=CSe(),w=T||l,C=v===f,{getItemProps:R,itemRef:O}=ane({closeOnClick:u,disabled:w,highlighted:g,id:y,store:S,nativeButton:o,nodeId:m?.nodeId,itemMetadata:ine}),N=k.useMemo(()=>({disabled:w,highlighted:g,checked:C}),[w,g,C]),L=Xe(z=>{const M={...it(df,z.nativeEvent),preventUnmountOnClose:()=>{}};x(f,M)}),D=xt("div",t,{state:N,stateAttributesMapping:sne,props:[_,{role:"menuitemradio","aria-checked":C,onClick:L},d,R],ref:[O,n,p.ref]});return b.jsx(une.Provider,{value:N,children:D})}),RSe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=kSe(),l=k.useRef(null),{transitionStatus:u,setMounted:f}=Co(o.checked);Ai({open:o.checked,ref:l,onComplete(){o.checked||f(!1)}});const d=k.useMemo(()=>({checked:o.checked,disabled:o.disabled,highlighted:o.highlighted,transitionStatus:u}),[o.checked,o.disabled,o.highlighted,u]);return xt("span",t,{state:d,stateAttributesMapping:sne,ref:[n,l],props:{"aria-hidden":!0,...s},enabled:a||o.checked})}),NSe=k.createContext(null);function cne(e){return k.useContext(NSe)}const ISe={...nM,disabled:Be(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Be(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Be(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Be(e=>e.stickIfOpen),parent:Be(e=>e.parent),rootId:Be(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Be(e=>e.activeIndex),isActive:Be((e,t)=>e.activeIndex===t),hoverEnabled:Be(e=>e.hoverEnabled),instantType:Be(e=>e.instantType),lastOpenChangeReason:Be(e=>e.openChangeReason),floatingTreeRoot:Be(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Be(e=>e.floatingNodeId),floatingParentNodeId:Be(e=>e.floatingParentNodeId),itemProps:Be(e=>e.itemProps),closeDelay:Be(e=>e.closeDelay),keyboardEventRelay:Be(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class AM extends jx{constructor(t){super({...DSe(),...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 Py},ISe),this.observe(Be(n=>n.allowMouseEnter),(n,r)=>{this.state.parent.type==="menu"&&n!==r&&this.state.parent.store.set("allowMouseEnter",n)}),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){this.unsubscribeParentListener=n.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}static useStore(t,n){return di(()=>t??new AM(n)).current}unsubscribeParentListener=null}function DSe(){return{...tM(),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 VP,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Jn,keyboardEventRelay:void 0,closeDelay:0}}const LSe=k.createContext(void 0);function PSe(){return k.useContext(LSe)}function MSe(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:s=!1,modal:o,loopFocus:l=!0,orientation:u="vertical",actionsRef:f,closeParentOnEsc:d=!1,handle:p,triggerId:m,defaultTriggerId:y=null,highlightItemOnHover:S=!0}=e,g=Jx(!0),_=nd(!0),v=cne(),x=PSe(),T=k.useMemo(()=>x&&_?{type:"menu",store:_.store}:v?{type:"menubar",context:v}:g&&!_?{type:"context-menu",context:g}:{type:void 0},[g,_,v,x]),w=AM.useStore(p?.store,{parent:T}),C=w.useState("floatingTreeRoot"),R=GP(C),O=wo();Je(()=>{g&&!_?w.update({parent:{type:"context-menu",context:g},floatingNodeId:R,floatingParentNodeId:O}):_&&w.update({floatingNodeId:R,floatingParentNodeId:O})},[g,_,R,O,w]),w.useControlledProp("open",n,a),w.useControlledProp("activeTriggerId",m,y),w.useContextCallback("onOpenChangeComplete",i);const N=w.useState("open"),L=w.useState("activeTriggerElement"),D=w.useState("positionerElement"),z=w.useState("hoverEnabled"),M=w.useState("modal"),V=w.useState("disabled"),W=w.useState("lastOpenChangeReason"),$=w.useState("parent"),q=w.useState("activeIndex"),Y=w.useState("payload"),B=w.useState("floatingParentNodeId"),j=k.useRef(null),U=B!=null;let K;w.useSyncedValues({disabled:s,modal:$.type===void 0?o:void 0,rootId:Zc()});const{openMethod:H,triggerProps:J,reset:se}=Xx(N);JP(w);const{forceUnmount:ae}=eM(N,w,()=>{w.update({allowMouseEnter:!1,stickIfOpen:!0}),se()}),Q=k.useRef($.type!=="context-menu"),G=Pn();k.useEffect(()=>{if(N||(j.current=null),$.type==="context-menu"){if(!N){G.clear(),Q.current=!1;return}G.start(500,()=>{Q.current=!0})}},[G,N,$.type]),Yx(N&&M&&W!==dr&&H!=="touch",D),Je(()=>{!N&&!z&&w.set("hoverEnabled",!0)},[N,z,w]);const Z=k.useRef(!0),ee=Pn(),ne=Xe((Fe,ht)=>{const Ne=ht.reason;if(N===Fe&&ht.trigger===L||(ht.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},!Fe&&ht.trigger==null&&(ht.trigger=L??void 0),r?.(Fe,ht),ht.isCanceled))return;const ze={open:Fe,nativeEvent:ht.event,reason:ht.reason,nested:U};K?.emit("openchange",ze);const et=ht.event;if(Fe===!1&&et?.type==="click"&&et.pointerType==="touch"&&!Z.current)return;if(!Fe&&q!==null){const Ft=w.context.itemDomElements.current[q];queueMicrotask(()=>{Ft?.setAttribute("tabindex","-1")})}Fe&&Ne===bv?(Z.current=!1,ee.start(300,()=>{Z.current=!0})):(Z.current=!0,ee.clear());const lt=(Ne===iu||Ne===df)&&et.detail===0&&et?.isTrusted,pt=!Fe&&(Ne===Dy||Ne==null);function gn(){const Ft={open:Fe,openChangeReason:Ne};j.current=ht.event??null;const Nt=ht.trigger?.id??null;(Nt||Fe)&&(Ft.activeTriggerId=Nt,Ft.activeTriggerElement=ht.trigger??null),w.update(Ft)}Ne===dr?xr.flushSync(gn):gn(),$.type==="menubar"&&(Ne===bv||Ne===ho||Ne===dr||Ne===mp||Ne===kb)?w.set("instantType","group"):lt||pt?w.set("instantType",lt?"click":"dismiss"):w.set("instantType",void 0)}),te=k.useCallback(Fe=>{const ht=it(Fe);return ht.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},ht},[w]),be=k.useCallback(()=>{w.setOpen(!1,te(qP))},[w,te]);k.useImperativeHandle(f,()=>({unmount:ae,close:be}),[ae,be]);let _e;$.type==="context-menu"&&(_e=$.context),k.useImperativeHandle(_e?.positionerRef,()=>D,[D]),k.useImperativeHandle(_e?.actionsRef,()=>({setOpen:ne}),[ne]);const he=rM({popupStore:w,onOpenChange:ne});K=he.context.events,k.useEffect(()=>{const Fe=({open:ht,eventDetails:Ne})=>ne(ht,Ne);return K.on("setOpen",Fe),()=>{K?.off("setOpen",Fe)}},[K,ne]);const ye=Cm(he,{enabled:!V,bubbles:d&&$.type==="menu",outsidePress(){return $.type!=="context-menu"||j.current?.type==="contextmenu"?!0:Q.current},externalTree:U?C:void 0}),Ee=Mee(he,{role:"menu"}),xe=Cu(),ve=k.useCallback(Fe=>{w.select("activeIndex")!==Fe&&w.set("activeIndex",Fe)},[w]),De=iM(he,{enabled:!V,listRef:w.context.itemDomElements,activeIndex:q,nested:$.type!==void 0,loopFocus:l,orientation:u,parentOrientation:$.type==="menubar"?$.context.orientation:void 0,rtl:xe==="rtl",disabledIndices:ea,onNavigate:ve,openOnArrowKeyDown:$.type!=="context-menu",externalTree:U?C:void 0,focusItemOnHover:S}),Te=k.useCallback(Fe=>{w.context.typingRef.current=Fe},[w]),pe=aM(he,{listRef:w.context.itemLabels,activeIndex:q,resetMs:obe,onMatch:Fe=>{N&&Fe!==q&&w.set("activeIndex",Fe)},onTypingChange:Te}),{getReferenceProps:ce,getFloatingProps:Re,getItemProps:Pe,getTriggerProps:ge}=Qc([ye,Ee,De,pe]),Le=k.useMemo(()=>{const Fe=sl(ce(),{onMouseEnter(){w.set("hoverEnabled",!0)},onMouseMove(){w.set("allowMouseEnter",!0)}},J);return delete Fe.role,Fe},[ce,w,J]),Ce=k.useMemo(()=>{const Fe=ge();if(!Fe)return Fe;const ht=sl(Fe,J);return delete ht.role,delete ht["aria-controls"],ht},[ge,J]),Ve=au(),Ze=k.useMemo(()=>Re({onMouseEnter(){$.type==="menu"&&Ve.request(()=>w.set("hoverEnabled",!1))},onMouseMove(){w.set("allowMouseEnter",!0)},onClick(){w.select("hoverEnabled")&&w.set("hoverEnabled",!1)},onKeyDown(Fe){const ht=w.select("keyboardEventRelay");ht&&!Fe.isPropagationStopped()&&ht(Fe)}}),[Re,$.type,Ve,w]),gt=k.useMemo(()=>Pe(),[Pe]);w.useSyncedValues({floatingRootContext:he,activeTriggerProps:Le,inactiveTriggerProps:Ce,popupProps:Ze,itemProps:gt});const st=k.useMemo(()=>({store:w,parent:T}),[w,T]),ot=b.jsx(rne.Provider,{value:st,children:typeof t=="function"?t({payload:Y}):t});return $.type===void 0||$.type==="context-menu"?b.jsx(mee,{externalTree:C,children:ot}):ot}function dne(e){if(Qn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!Xo(e))return dne(al(e))}function jSe(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,i=k.useRef(!1);return k.useMemo(()=>t?{onMouseDown:a=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,Ci(a.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:a=>{i.current&&(i.current=!1,a.preventBaseUIHandler())}}:Jn,[t,n,r])}const g_=2,FSe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,id:o,openOnHover:l,delay:u=100,closeDelay:f=0,handle:d,payload:p,...m}=t,y=nd(!0),S=d?.store??y?.store;if(!S)throw new Error(rn(85));const g=fi(o),_=S.useState("isTriggerActive",g),v=S.useState("floatingRootContext"),x=S.useState("isOpenedByTrigger",g),T=k.useRef(null),w=USe(),C=IP(!0),R=To(),O=k.useMemo(()=>R??new VP,[R]),N=GP(O),L=wo(),{registerTrigger:D,isMountedByThisTrigger:z}=QP(g,T,S,{payload:p,closeDelay:f,parent:w,floatingTreeRoot:O,floatingNodeId:N,floatingParentNodeId:L,keyboardEventRelay:C?.relayKeyboardEvent}),M=S.useState("disabled"),V=a||M||w.type==="menubar"&&w.context.disabled,{getButtonProps:W,buttonRef:$}=aa({disabled:V,native:s});k.useEffect(()=>{!x&&w.type===void 0&&(S.context.allowMouseUpTriggerRef.current=!1)},[S,x,w.type]);const q=k.useRef(null),Y=Pn(),B=Xe(Ee=>{if(!q.current)return;Y.clear(),S.context.allowMouseUpTriggerRef.current=!1;const xe=Ee.target;if(Tt(q.current,xe)||Tt(S.select("positionerElement"),xe)||xe===q.current||xe!=null&&dne(xe)===S.select("rootId"))return;const ve=vM(q.current);Ee.clientX>=ve.left-g_&&Ee.clientX<=ve.right+g_&&Ee.clientY>=ve.top-g_&&Ee.clientY<=ve.bottom+g_||O.events.emit("close",{domEvent:Ee,reason:gee})});k.useEffect(()=>{x&&S.select("lastOpenChangeReason")===dr&&Ci(q.current).addEventListener("mouseup",B,{once:!0})},[x,B,S]);const j=w.type==="menubar"&&w.context.hasSubmenuOpen,K=Pee(v,{enabled:(l??j??!1)&&!V&&w.type!=="context-menu"&&(w.type!=="menubar"||j&&!z),handleClose:sM({blockPointerEvents:w.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:w.type===void 0?u:void 0,delay:{close:f},triggerElementRef:T,externalTree:O,isActiveTrigger:_}),H=BSe(x,S.select("lastOpenChangeReason")),J=Tm(v,{enabled:!V&&w.type!=="context-menu",event:x&&w.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0?H:!1}),se=Iee(v,{enabled:!V&&(w.type!=="menubar"&&x||j)}),ae=jSe({open:x,enabled:w.type==="menubar",mouseDownAction:"open"}),Q=Qc([J,se]),G=w.type==="menubar",Z=k.useMemo(()=>({disabled:V,open:x}),[V,x]),ee=S.useState("triggerProps",z),ne=[q,n,$,D,T],te=[Q.getReferenceProps(),K??Jn,ee,{"aria-haspopup":"menu",id:g,onMouseDown:Ee=>{if(S.select("open"))return;Y.start(200,()=>{S.context.allowMouseUpTriggerRef.current=!0}),Ci(Ee.currentTarget).addEventListener("mouseup",B,{once:!0})}},G?{role:"menuitem"}:{},ae,m,W],be=k.useRef(null),_e=Xe(Ee=>{xr.flushSync(()=>{S.setOpen(!1,it(ho,Ee.nativeEvent,Ee.currentTarget))}),Bve(be.current)?.focus()}),he=Xe(Ee=>{const xe=S.select("positionerElement");if(xe&&oo(Ee,xe))S.context.beforeContentFocusGuardRef.current?.focus();else{xr.flushSync(()=>{S.setOpen(!1,it(ho,Ee.nativeEvent,Ee.currentTarget))});let ve=Fve(T.current);for(;ve!==null&&Tt(xe,ve)||ve?.hasAttribute("aria-hidden");){const De=ve;if(ve=Iy(ve),ve===De)break}ve?.focus()}}),ye=xt("button",t,{enabled:!G,stateAttributesMapping:Ip,state:Z,ref:ne,props:te});return G?b.jsx(Wx,{tag:"button",render:r,className:i,state:Z,refs:ne,props:te,stateAttributesMapping:Ip}):x?b.jsxs(k.Fragment,{children:[b.jsx(ol,{ref:be,onFocus:_e},`${g}-pre-focus-guard`),b.jsx(k.Fragment,{children:ye},g),b.jsx(ol,{ref:S.context.triggerFocusTargetRef,onFocus:he},`${g}-post-focus-guard`)]}):b.jsx(k.Fragment,{children:ye},g)});function BSe(e,t){const n=Pn(),[r,i]=k.useState(!1);return Je(()=>{e&&t==="trigger-hover"?(i(!0),n.start(CJ,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function USe(){const e=Jx(!0),t=nd(!0),n=cne();return k.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}function Kl(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const $Se=typeof ResizeObserver<"u",zSe=()=>!0;function HSe(e){const{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=zSe,onMeasureLayout:s,onMeasureLayoutComplete:o,side:l,direction:u}=e,f=k.useRef(!0),d=ZP(t,!0,!1),p=au(),m=k.useRef(null),y=Xe(s),S=Xe(o),g=k.useMemo(()=>{let _=l==="top",v=l==="left";return u==="rtl"?(_=_||l==="inline-end",v=v||l==="inline-end"):(_=_||l==="inline-start",v=v||l==="inline-start"),_?{position:"absolute",[l==="top"?"bottom":"top"]:"0",[v?"right":"left"]:"0"}:Jn},[l,u]);Je(()=>{if(!i||!a()||!$Se){f.current=!0,m.current=null;return}if(!t||!n)return;Object.entries(g).forEach(([N,L])=>{t.style.setProperty(N,L)});const _=new ResizeObserver(N=>{const L=N[0];L&&(m.current===null?m.current={width:Math.ceil(L.borderBoxSize[0].inlineSize),height:Math.ceil(L.borderBoxSize[0].blockSize)}:(m.current.width=Math.ceil(L.borderBoxSize[0].inlineSize),m.current.height=Math.ceil(L.borderBoxSize[0].blockSize)))});_.observe(t),t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto");const v=ab(t,"position","static"),x=ab(t,"transform","none"),T=ab(t,"scale","1"),w=ab(n,"--available-width","max-content"),C=ab(n,"--available-height","max-content");if(y?.(),f.current||m.current===null){n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const N=yv(t);return n.style.setProperty("--positioner-width",`${N.width}px`),n.style.setProperty("--positioner-height",`${N.height}px`),v(),x(),T(),w(),C(),S?.(null,N),f.current=!1,()=>{_.disconnect()}}t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto"),n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const R=yv(t);t.style.setProperty("--popup-width",`${m.current.width}px`),t.style.setProperty("--popup-height",`${m.current.height}px`),v(),x(),w(),C(),S?.(m.current,R),n.style.setProperty("--positioner-width",`${R.width}px`),n.style.setProperty("--positioner-height",`${R.height}px`);const O=new AbortController;return p.request(()=>{t.style.setProperty("--popup-width",`${R.width}px`),t.style.setProperty("--popup-height",`${R.height}px`),d(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},O.signal)}),()=>{_.disconnect(),O.abort(),p.cancel()}},[r,t,n,d,p,a,i,y,S,g])}function ab(e,t,n){const r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}const WSe=k.forwardRef(function(t,n){const{children:r,container:i,className:a,render:s,...o}=t,{portalNode:l,portalSubtree:u}=Eee({container:i,ref:n,componentProps:t,elementProps:o});return!u&&!l?null:b.jsxs(k.Fragment,{children:[u,l&&xr.createPortal(r,l)]})}),fne=k.createContext(void 0);function ew(){const e=k.useContext(fne);if(e===void 0)throw new Error(rn(53));return e}let KE=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const b_=500,cz=16;function Rs(e,t,n){if(!e)return 0;const r=getComputedStyle(e),i=n==="x"?"Inline":"Block";return n==="x"&&t==="margin"?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}let VSe=(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})({}),Wh=(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 kM={hasOverflowX:e=>e?{[Wh.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[Wh.hasOverflowY]:""}:null,overflowXStart:e=>e?{[Wh.overflowXStart]:""}:null,overflowXEnd:e=>e?{[Wh.overflowXEnd]:""}:null,overflowYStart:e=>e?{[Wh.overflowYStart]:""}:null,overflowYEnd:e=>e?{[Wh.overflowYEnd]:""}:null,cornerHidden:()=>null},dz={width:0,height:0},GSe={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},qSe=k.forwardRef(function(t,n){const{render:r,className:i,overflowEdgeThreshold:a,...s}=t,[o,l]=k.useState(!1),[u,f]=k.useState(!1),[d,p]=k.useState(!1),[m,y]=k.useState(dz),[S,g]=k.useState(dz),[_,v]=k.useState(!1),[x,T]=k.useState(GSe),w=fi(),C=k.useRef(null),R=k.useRef(null),O=k.useRef(null),N=k.useRef(null),L=k.useRef(null),D=k.useRef(null),z=k.useRef(null),M=k.useRef(!1),V=k.useRef(0),W=k.useRef(0),$=k.useRef(0),q=k.useRef(0),Y=k.useRef("vertical"),B=Pn(),j=Pn(),U=k.useRef({x:0,y:0}),[K,H]=k.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),J=KSe(a),se=Xe(_e=>{const he=_e.x-U.current.x,ye=_e.y-U.current.y;U.current=_e,ye!==0&&(p(!0),B.start(b_,()=>{p(!1)})),he!==0&&(f(!0),j.start(b_,()=>{f(!1)}))}),ae=Xe(_e=>{_e.button===0&&(M.current=!0,V.current=_e.clientY,W.current=_e.clientX,Y.current=_e.currentTarget.getAttribute(VSe.orientation),R.current&&($.current=R.current.scrollTop,q.current=R.current.scrollLeft),L.current&&Y.current==="vertical"&&L.current.setPointerCapture(_e.pointerId),D.current&&Y.current==="horizontal"&&D.current.setPointerCapture(_e.pointerId))}),Q=Xe(_e=>{if(!M.current)return;const he=_e.clientY-V.current,ye=_e.clientX-W.current;if(R.current){const Ee=R.current.scrollHeight,xe=R.current.clientHeight,ve=R.current.scrollWidth,De=R.current.clientWidth;if(L.current&&O.current&&Y.current==="vertical"){const Te=Rs(O.current,"padding","y"),pe=Rs(L.current,"margin","y"),ce=L.current.offsetHeight,Re=O.current.offsetHeight-ce-Te-pe,Pe=he/Re;R.current.scrollTop=$.current+Pe*(Ee-xe),_e.preventDefault(),p(!0),B.start(b_,()=>{p(!1)})}if(D.current&&N.current&&Y.current==="horizontal"){const Te=Rs(N.current,"padding","x"),pe=Rs(D.current,"margin","x"),ce=D.current.offsetWidth,Re=N.current.offsetWidth-ce-Te-pe,Pe=ye/Re;R.current.scrollLeft=q.current+Pe*(ve-De),_e.preventDefault(),f(!0),j.start(b_,()=>{f(!1)})}}}),G=Xe(_e=>{M.current=!1,L.current&&Y.current==="vertical"&&L.current.releasePointerCapture(_e.pointerId),D.current&&Y.current==="horizontal"&&D.current.releasePointerCapture(_e.pointerId)});function Z(_e){const he=_e.pointerType==="touch";if(v(he),!he){const ye=Tt(C.current,_e.target);l(ye)}}const ee=k.useMemo(()=>({hasOverflowX:!K.scrollbarXHidden,hasOverflowY:!K.scrollbarYHidden,overflowXStart:x.xStart,overflowXEnd:x.xEnd,overflowYStart:x.yStart,overflowYEnd:x.yEnd,cornerHidden:K.cornerHidden}),[K.scrollbarXHidden,K.scrollbarYHidden,K.cornerHidden,x]),ne={role:"presentation",onPointerEnter:Z,onPointerMove:Z,onPointerDown({pointerType:_e}){v(_e==="touch")},onPointerLeave(){l(!1)},style:{position:"relative",[KE.scrollAreaCornerHeight]:`${m.height}px`,[KE.scrollAreaCornerWidth]:`${m.width}px`}},te=xt("div",t,{state:ee,ref:[n,C],props:[ne,s],stateAttributesMapping:kM}),be=k.useMemo(()=>({handlePointerDown:ae,handlePointerMove:Q,handlePointerUp:G,handleScroll:se,cornerSize:m,setCornerSize:y,thumbSize:S,setThumbSize:g,touchModality:_,cornerRef:z,scrollingX:u,setScrollingX:f,scrollingY:d,setScrollingY:p,hovering:o,setHovering:l,viewportRef:R,rootRef:C,scrollbarYRef:O,scrollbarXRef:N,thumbYRef:L,thumbXRef:D,rootId:w,hiddenState:K,setHiddenState:H,overflowEdges:x,setOverflowEdges:T,viewportState:ee,overflowEdgeThreshold:J}),[ae,Q,G,se,m,S,_,z,u,f,d,p,o,l,R,C,O,N,L,D,w,K,x,ee,J]);return b.jsxs(fne.Provider,{value:be,children:[Sv.element,te]})});function KSe(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 YSe=k.createContext(void 0);function XSe(e,t){if(typeof IntersectionObserver>"u")return()=>{};const n=new IntersectionObserver(r=>{r.forEach(i=>{i.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}let 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})({}),fz=!1;function ZSe(){fz||jP||(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{}}),fz=!0)}const QSe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{viewportRef:s,scrollbarYRef:o,scrollbarXRef:l,thumbYRef:u,thumbXRef:f,cornerRef:d,setCornerSize:p,setThumbSize:m,rootId:y,setHiddenState:S,hiddenState:g,handleScroll:_,setHovering:v,setOverflowEdges:x,overflowEdges:T,overflowEdgeThreshold:w}=ew(),C=Cu(),R=k.useRef(!0),O=Pn(),N=Pn();function L(){const q=s.current,Y=o.current,B=l.current,j=u.current,U=f.current,K=d.current;if(!q)return;const H=q.scrollHeight,J=q.scrollWidth,se=q.clientHeight,ae=q.clientWidth,Q=q.scrollTop,G=q.scrollLeft;if(H===0||J===0)return;const Z=se>=H,ee=ae>=J,ne=ae/J,te=se/H,be=Math.max(0,J-ae),_e=Math.max(0,H-se);let he=0,ye=0;ee||(C==="rtl"?he=Kl(-G,0,be):he=Kl(G,0,be),ye=be-he);const Ee=Z?0:Kl(Q,0,_e),xe=Z?0:_e-Ee,ve=ee?0:ae,De=Z?0:se,Te=Rs(B,"padding","x"),pe=Rs(Y,"padding","y"),ce=Rs(U,"margin","x"),Re=Rs(j,"margin","y"),Pe=ve-Te-ce,ge=De-pe-Re,Le=B?Math.min(B.offsetWidth,Pe):Pe,Ce=Y?Math.min(Y.offsetHeight,ge):ge,Ve=Math.max(cz,Le*ne),Ze=Math.max(cz,Ce*te);if(m(ze=>ze.height===Ze&&ze.width===Ve?ze:{width:Ve,height:Ze}),Y&&j){const ze=Y.offsetHeight-Ze-pe-Re,et=H-se,lt=et===0?0:Q/et,pt=Math.min(ze,Math.max(0,lt*ze));j.style.transform=`translate3d(0,${pt}px,0)`}if(B&&U){const ze=B.offsetWidth-Ve-Te-ce,et=J-ae,lt=et===0?0:G/et,pt=C==="rtl"?Kl(lt*ze,-ze,0):Kl(lt*ze,0,ze);U.style.transform=`translate3d(${pt}px,0,0)`}const gt=Kl(he,0,be),st=Kl(ye,0,be),ot=Kl(Ee,0,_e),Fe=Kl(xe,0,_e),ht=[[wc.scrollAreaOverflowXStart,gt],[wc.scrollAreaOverflowXEnd,st],[wc.scrollAreaOverflowYStart,ot],[wc.scrollAreaOverflowYEnd,Fe]];for(const[ze,et]of ht)q.style.setProperty(ze,`${et}px`);if(K){if(ee||Z)p({width:0,height:0});else if(!ee&&!Z){const ze=Y?.offsetWidth||0,et=B?.offsetHeight||0;p({width:ze,height:et})}}S(ze=>{const et=Z||ee;return ze.scrollbarYHidden===Z&&ze.scrollbarXHidden===ee&&ze.cornerHidden===et?ze:{scrollbarYHidden:Z,scrollbarXHidden:ee,cornerHidden:et}});const Ne={xStart:!ee&&gt>w.xStart,xEnd:!ee&&st>w.xEnd,yStart:!Z&&ot>w.yStart,yEnd:!Z&&Fe>w.yEnd};x(ze=>ze.xStart===Ne.xStart&&ze.xEnd===Ne.xEnd&&ze.yStart===Ne.yStart&&ze.yEnd===Ne.yEnd?ze:Ne)}const D=Xe(()=>{xr.flushSync(L)});Je(()=>s.current?(ZSe(),XSe(s.current,D)):void 0,[D,s]),Je(()=>{queueMicrotask(D)},[D,g,C]),Je(()=>{s.current?.matches(":hover")&&v(!0)},[s,v]),k.useEffect(()=>{const q=s.current;if(typeof ResizeObserver>"u"||!q)return;const Y=new ResizeObserver(D);return Y.observe(q),N.start(0,()=>{Promise.all(q.getAnimations({subtree:!0}).map(B=>B.finished)).then(D).catch(()=>{})}),()=>{Y.disconnect(),N.clear()}},[D,s,N]);function z(){R.current=!1}const M={role:"presentation",...y&&{"data-id":`${y}-viewport`},...(!g.scrollbarXHidden||!g.scrollbarYHidden)&&{tabIndex:0},className:Sv.className,style:{overflow:"scroll"},onScroll(){s.current&&(D(),R.current||_({x:s.current.scrollLeft,y:s.current.scrollTop}),O.start(100,()=>{R.current=!0}))},onWheel:z,onTouchMove:z,onPointerMove:z,onPointerEnter:z,onKeyDown:z},V=k.useMemo(()=>({hasOverflowX:!g.scrollbarXHidden,hasOverflowY:!g.scrollbarYHidden,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:g.cornerHidden}),[g.scrollbarXHidden,g.scrollbarYHidden,g.cornerHidden,T]),W=xt("div",t,{ref:[n,s],state:V,props:[M,a],stateAttributesMapping:kM}),$=k.useMemo(()=>({computeThumbPosition:D}),[D]);return b.jsx(YSe.Provider,{value:$,children:W})}),hne=k.createContext(void 0);function JSe(){const e=k.useContext(hne);if(e===void 0)throw new Error(rn(54));return e}let YE=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const exe=k.forwardRef(function(t,n){const{render:r,className:i,orientation:a="vertical",keepMounted:s=!1,...o}=t,{hovering:l,scrollingX:u,scrollingY:f,hiddenState:d,overflowEdges:p,scrollbarYRef:m,scrollbarXRef:y,viewportRef:S,thumbYRef:g,thumbXRef:_,handlePointerDown:v,handlePointerUp:x,rootId:T,thumbSize:w}=ew(),C=k.useMemo(()=>({hovering:l,scrolling:{horizontal:u,vertical:f}[a],orientation:a,hasOverflowX:!d.scrollbarXHidden,hasOverflowY:!d.scrollbarYHidden,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:d.cornerHidden}),[l,u,f,a,d,p]),R=Cu();k.useEffect(()=>{const M=S.current,V=a==="vertical"?m.current:y.current;if(!V)return;function W($){if(!(!M||!V||$.ctrlKey)){if($.preventDefault(),a==="vertical"){if(M.scrollTop===0&&$.deltaY<0)return}else if(M.scrollLeft===0&&$.deltaX<0)return;if(a==="vertical"){if(M.scrollTop===M.scrollHeight-M.clientHeight&&$.deltaY>0)return}else if(M.scrollLeft===M.scrollWidth-M.clientWidth&&$.deltaX>0)return;a==="vertical"?M.scrollTop+=$.deltaY:M.scrollLeft+=$.deltaX}}return V.addEventListener("wheel",W,{passive:!1}),()=>{V.removeEventListener("wheel",W)}},[a,y,m,S]);const O={...T&&{"data-id":`${T}-scrollbar`},onPointerDown(M){if(M.button===0&&M.currentTarget===M.target&&S.current){if(g.current&&m.current&&a==="vertical"){const V=Rs(g.current,"margin","y"),W=Rs(m.current,"padding","y"),$=g.current.offsetHeight,q=m.current.getBoundingClientRect(),Y=M.clientY-q.top-$/2-W+V/2,B=S.current.scrollHeight,j=S.current.clientHeight,U=m.current.offsetHeight-$-W-V,H=Y/U*(B-j);S.current.scrollTop=H}if(_.current&&y.current&&a==="horizontal"){const V=Rs(_.current,"margin","x"),W=Rs(y.current,"padding","x"),$=_.current.offsetWidth,q=y.current.getBoundingClientRect(),Y=M.clientX-q.left-$/2-W+V/2,B=S.current.scrollWidth,j=S.current.clientWidth,U=y.current.offsetWidth-$-W-V,K=Y/U;let H;R==="rtl"?(H=(1-K)*(B-j),S.current.scrollLeft<=0&&(H=-H)):H=K*(B-j),S.current.scrollLeft=H}v(M)}},onPointerUp:x,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...a==="vertical"&&{top:0,bottom:`var(${KE.scrollAreaCornerHeight})`,insetInlineEnd:0,[YE.scrollAreaThumbHeight]:`${w.height}px`},...a==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${KE.scrollAreaCornerWidth})`,bottom:0,[YE.scrollAreaThumbWidth]:`${w.width}px`}}},N=xt("div",t,{ref:[n,a==="vertical"?m:y],state:C,props:[O,o],stateAttributesMapping:kM}),L=k.useMemo(()=>({orientation:a}),[a]),D=a==="vertical"?d.scrollbarYHidden:d.scrollbarXHidden;return s||!D?b.jsx(hne.Provider,{value:L,children:N}):null}),txe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{thumbYRef:s,thumbXRef:o,handlePointerDown:l,handlePointerMove:u,handlePointerUp:f,setScrollingX:d,setScrollingY:p}=ew(),{orientation:m}=JSe(),y=k.useMemo(()=>({orientation:m}),[m]);return xt("div",t,{ref:[n,m==="vertical"?s:o],state:y,props:[{onPointerDown:l,onPointerMove:u,onPointerUp(g){m==="vertical"&&p(!1),m==="horizontal"&&d(!1),f(g)},style:{...m==="vertical"&&{height:`var(${YE.scrollAreaThumbHeight})`},...m==="horizontal"&&{width:`var(${YE.scrollAreaThumbWidth})`}}},a]})}),nxe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{cornerRef:s,cornerSize:o,hiddenState:l}=ew(),u=xt("div",t,{ref:[n,s],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},a]});return l.cornerHidden?null:u}),pne=k.createContext(void 0);function rxe(){const e=k.useContext(pne);if(e===void 0)throw new Error(rn(63));return e}let hz=(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 mne={...Wf,checked(e){return e?{[hz.checked]:""}:{[hz.unchecked]:""}}},ixe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a,id:s,inputRef:o,name:l,nativeButton:u=!1,onCheckedChange:f,readOnly:d=!1,required:p=!1,disabled:m=!1,render:y,uncheckedValue:S,...g}=t,{clearErrors:_}=Hy(),{state:v,setTouched:x,setDirty:T,validityData:w,setFilled:C,setFocused:R,shouldValidateOnChange:O,validationMode:N,disabled:L,name:D,validation:z}=Fs(),{labelId:M}=td(),V=L||m,W=D??l,$=Xe(f),q=k.useRef(null),Y=js(q,o,z.inputRef),B=k.useRef(null),j=fi(),U=Zx({id:s,implicit:!1,controlRef:B}),[K,H]=Ja({controlled:r,default:!!a,name:"Switch",state:"checked"});Wy({id:j,commit:z.commit,value:K,controlRef:B,name:W,getValue:()=>K}),Je(()=>{q.current&&C(q.current.checked)},[q,C]),Jd(K,()=>{_(W),T(K!==w.initialValue),C(K),O()?z.commit(K):z.commit(K,!0)});const{getButtonProps:J,buttonRef:se}=aa({disabled:V,native:u}),ae={id:j,role:"switch","aria-checked":K,"aria-readonly":d||void 0,"aria-labelledby":M,onFocus(){V||R(!0)},onBlur(){const ee=q.current;!ee||V||(x(!0),R(!1),N==="onBlur"&&z.commit(ee.checked))},onClick(ee){d||V||(ee.preventDefault(),q?.current?.click())}},Q=k.useMemo(()=>sl({checked:K,disabled:V,id:U,name:W,required:p,style:wm,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:Y,onChange(ee){if(ee.nativeEvent.defaultPrevented)return;const ne=ee.target.checked,te=it(Dr,ee.nativeEvent);$?.(ne,te),!te.isCanceled&&H(ne)},onFocus(){B.current?.focus()}},z.getInputValidationProps),[K,V,Y,U,W,$,p,H,z]),G=k.useMemo(()=>({...v,checked:K,disabled:V,readOnly:d,required:p}),[v,K,V,d,p]),Z=xt("span",t,{state:G,ref:[n,B,se],props:[ae,z.getValidationProps,g,J],stateAttributesMapping:mne});return b.jsxs(pne.Provider,{value:G,children:[Z,!K&&W&&S!==void 0&&b.jsx("input",{type:"hidden",name:W,value:S}),b.jsx("input",{...Q})]})}),axe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{state:s}=Fs(),o=rxe(),l={...s,...o};return xt("span",t,{state:l,ref:n,stateAttributesMapping:mne,props:a})}),gne=k.createContext(void 0);function sxe(e=!0){const t=k.useContext(gne);if(t===void 0&&!e)throw new Error(rn(7));return t}const oxe=k.forwardRef(function(t,n){const{className:r,defaultPressed:i=!1,disabled:a=!1,form:s,onPressedChange:o,pressed:l,render:u,type:f,value:d,nativeButton:p=!0,...m}=t,y=fi(d||void 0),S=sxe(),g=S?.value??[],_=S?void 0:i,v=(a||S?.disabled)??!1,[x,T]=Ja({controlled:S?g?.indexOf(y)>-1:l,default:_,name:"Toggle",state:"pressed"}),w=Xe((z,M)=>{y&&S?.setGroupValue?.(y,z,M),o?.(z,M)}),{getButtonProps:C,buttonRef:R}=aa({disabled:v,native:p}),O=k.useMemo(()=>({disabled:v,pressed:x}),[v,x]),N=[R,n],L=[{"aria-pressed":x,onClick(z){const M=!x,V=it(Dr,z.nativeEvent);w(M,V),!V.isCanceled&&T(M)}},m,C],D=xt("button",t,{enabled:!S,state:O,ref:N,props:L});return S?b.jsx(Wx,{tag:"button",render:u,className:r,state:O,refs:N,props:L}):D});let lxe=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const pz={multiple(e){return e?{[lxe.multiple]:""}:null}},uxe=k.forwardRef(function(t,n){const{defaultValue:r,disabled:i=!1,loopFocus:a=!0,onValueChange:s,orientation:o="horizontal",multiple:l=!1,value:u,className:f,render:d,...p}=t,m=_M(),y=k.useMemo(()=>{if(u===void 0)return r??[]},[u,r]),S=(m?.disabled??!1)||i,[g,_]=Ja({controlled:u,default:y,name:"ToggleGroup",state:"value"}),v=Xe((R,O,N)=>{let L;if(l?(L=g.slice(),O?L.push(R):L.splice(g.indexOf(R),1)):L=O?[R]:[],Array.isArray(L)){if(s?.(L,N),N.isCanceled)return;_(L)}}),x=k.useMemo(()=>({disabled:S,multiple:l,orientation:o}),[S,o,l]),T=k.useMemo(()=>({disabled:S,orientation:o,setGroupValue:v,value:g}),[S,o,v,g]),w={role:"group"},C=xt("div",t,{enabled:!!m,state:x,ref:n,props:[w,p],stateAttributesMapping:pz});return b.jsx(gne.Provider,{value:T,children:m?C:b.jsx(zx,{render:d,className:f,state:x,refs:[n],props:[w,p],stateAttributesMapping:pz,loopFocus:a})})}),bne=k.createContext(void 0);function Vy(e){const t=k.useContext(bne);if(t===void 0&&!e)throw new Error(rn(72));return t}const cxe={...nM,disabled:Be(e=>e.disabled),instantType:Be(e=>e.instantType),isInstantPhase:Be(e=>e.isInstantPhase),trackCursorAxis:Be(e=>e.trackCursorAxis),disableHoverablePopup:Be(e=>e.disableHoverablePopup),lastOpenChangeReason:Be(e=>e.openChangeReason),closeDelay:Be(e=>e.closeDelay)};class OM extends jx{constructor(t){super({...dxe(),...t},{popupRef:k.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Py},cxe)}setOpen=(t,n)=>{const r=n.reason,i=r===dr,a=t&&r===bv,s=!t&&(r===iu||r===Dy);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const o=()=>{const l={open:t,openChangeReason:r};a?l.instantType="focus":s?l.instantType="dismiss":r===dr&&(l.instantType=void 0);const u=n.trigger?.id??null;(u||t)&&(l.activeTriggerId=u,l.activeTriggerElement=n.trigger??null),this.update(l)};i?xr.flushSync(o):o()};static useStore(t,n){const r=di(()=>t??new OM(n)).current,i=rM({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=i,r}}function dxe(){return{...tM(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function fxe(e){const{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a="none",actionsRef:s,onOpenChange:o,onOpenChangeComplete:l,handle:u,triggerId:f,defaultTriggerId:d=null,children:p}=e,m=OM.useStore(u?.store,{open:r??n,activeTriggerId:f!==void 0?f:d});m.useControlledProp("open",r,n),m.useControlledProp("activeTriggerId",f,d),m.useContextCallback("onOpenChange",o),m.useContextCallback("onOpenChangeComplete",l);const y=m.useState("open"),S=m.useState("activeTriggerId"),g=m.useState("payload");m.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i});const _=!t&&y;Je(()=>{y&&t&&m.setOpen(!1,it(Wve))},[y,t,m]),m.useSyncedValue("disabled",t),JP(m);const{forceUnmount:v,transitionStatus:x}=eM(_,m),T=m.useState("isInstantPhase"),w=m.useState("instantType"),C=m.useState("lastOpenChangeReason"),R=k.useRef(null);Je(()=>{x==="ending"&&C===Dr||x!=="ending"&&T?(w!=="delay"&&(R.current=w),m.set("instantType","delay")):R.current!==null&&(m.set("instantType",R.current),R.current=null)},[x,T,C,w,m]),Je(()=>{_&&S==null&&m.set("payload",void 0)},[m,S,_]);const O=k.useCallback(()=>{m.setOpen(!1,hxe(m,qP))},[m]);k.useImperativeHandle(s,()=>({unmount:v,close:O}),[v,O]);const N=m.useState("floatingRootContext"),L=Iee(N,{enabled:!t}),D=Cm(N,{enabled:!t,referencePress:!0}),z=oye(N,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),{getReferenceProps:M,getFloatingProps:V,getTriggerProps:W}=Qc([L,D,z]),$=k.useMemo(()=>M(),[M]),q=k.useMemo(()=>W(),[W]),Y=k.useMemo(()=>V(),[V]);return m.useSyncedValues({floatingRootContext:N,activeTriggerProps:$,inactiveTriggerProps:q,popupProps:Y}),b.jsx(bne.Provider,{value:m,children:typeof p=="function"?p({payload:g}):p})}function hxe(e,t){const n=it(t);return n.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},n}const vne=k.createContext(void 0);function pxe(){return k.useContext(vne)}const mxe=600,gxe=k.forwardRef(function(t,n){const{className:r,render:i,handle:a,payload:s,disabled:o,delay:l,closeDelay:u,id:f,...d}=t,p=Vy(!0),m=a?.store??p;if(!m)throw new Error(rn(82));const y=fi(f),S=m.useState("isTriggerActive",y),g=m.useState("floatingRootContext"),_=m.useState("isOpenedByTrigger",y),v=k.useRef(null),x=l??mxe,T=u??0,{registerTrigger:w,isMountedByThisTrigger:C}=QP(y,v,m,{payload:s,closeDelay:T}),R=pxe(),{delayRef:O,isInstantPhase:N,hasProvider:L}=Xve(g,{open:_});m.useSyncedValue("isInstantPhase",N);const D=m.useState("disabled"),z=o??D,M=m.useState("trackCursorAxis"),V=m.useState("disableHoverablePopup"),W=Pee(g,{enabled:!z,mouseOnly:!0,move:!1,handleClose:!V&&M!=="both"?sM():null,restMs(){const B=R?.delay,j=typeof O.current=="object"?O.current.open:void 0;let U=x;return L&&(j!==0?U=l??B??x:U=0),U},delay(){const B=typeof O.current=="object"?O.current.close:void 0;let j=T;return u==null&&L&&(j=B),{close:j}},triggerElementRef:v,isActiveTrigger:S}),$=k.useMemo(()=>({open:_}),[_]),q=m.useState("triggerProps",C);return xt("button",t,{state:$,ref:[n,w,v],props:[W,q,{id:y},d],stateAttributesMapping:Hx})}),yne=k.createContext(void 0);function bxe(){const e=k.useContext(yne);if(e===void 0)throw new Error(rn(70));return e}const vxe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t;return Vy().useState("mounted")||r?b.jsx(yne.Provider,{value:r,children:b.jsx(WSe,{ref:n,...i})}):null}),_ne=k.createContext(void 0);function Ene(){const e=k.useContext(_ne);if(e===void 0)throw new Error(rn(71));return e}const yxe=k.forwardRef(function(t,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="top",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:y=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=LP,..._}=t,v=Vy(),x=bxe(),T=v.useState("open"),w=v.useState("mounted"),C=v.useState("trackCursorAxis"),R=v.useState("disableHoverablePopup"),O=v.useState("floatingRootContext"),N=v.useState("instantType"),L=v.useState("transitionStatus"),D=By({anchor:a,positionMethod:s,floatingRootContext:O,mounted:w,side:o,sideOffset:u,align:l,alignOffset:f,collisionBoundary:d,collisionPadding:p,sticky:y,arrowPadding:m,disableAnchorTracking:S,keepMounted:x,collisionAvoidance:g,adaptiveOrigin:Xee}),z=k.useMemo(()=>{const $={};return(!T||C==="both"||R)&&($.pointerEvents="none"),{role:"presentation",hidden:!w,style:{...D.positionerStyles,...$}}},[T,C,R,w,D.positionerStyles]),M=k.useMemo(()=>({open:T,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:C!=="none"?"tracking-cursor":N}),[T,D.side,D.align,D.anchorHidden,C,N]),V=k.useMemo(()=>({...M,arrowRef:D.arrowRef,arrowStyles:D.arrowStyles,arrowUncentered:D.arrowUncentered}),[M,D.arrowRef,D.arrowStyles,D.arrowUncentered]),W=xt("div",t,{state:M,props:[z,Om(L),_],ref:[n,v.useStateSetter("positionerElement")],stateAttributesMapping:ka});return b.jsx(_ne.Provider,{value:V,children:W})}),_xe={...ka,...is},Exe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,s=Vy(),{side:o,align:l}=Ene(),u=s.useState("open"),f=s.useState("mounted"),d=s.useState("instantType"),p=s.useState("transitionStatus"),m=s.useState("popupProps"),y=s.useState("payload"),S=s.useState("popupElement"),g=s.useState("positionerElement"),_=s.useState("floatingRootContext"),v=Cu();Ai({open:u,ref:s.context.popupRef,onComplete(){u&&s.context.onOpenChangeComplete?.(!0)}});function x(){_.context.events.emit("measure-layout")}function T(L,D){_.context.events.emit("measure-layout-complete",{previousDimensions:L,nextDimensions:D})}const w=k.useCallback(()=>s.context.triggerElements.size>1,[s]);HSe({popupElement:S,positionerElement:g,mounted:f,content:y,enabled:w,onMeasureLayout:x,onMeasureLayoutComplete:T,side:o,direction:v});const C=s.useState("disabled"),R=s.useState("closeDelay");Lee(_,{enabled:!C,closeDelay:R});const O=k.useMemo(()=>({open:u,side:o,align:l,instant:d,transitionStatus:p}),[u,o,l,d,p]);return xt("div",t,{state:O,ref:[n,s.context.popupRef,s.useStateSetter("popupElement")],props:[m,Om(p),a],stateAttributesMapping:_xe})}),Sxe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,o=Vy().useState("instantType"),{open:l,arrowRef:u,side:f,align:d,arrowUncentered:p,arrowStyles:m}=Ene(),y=k.useMemo(()=>({open:l,side:f,align:d,uncentered:p,instant:o}),[l,f,d,p,o]);return xt("div",t,{state:y,ref:[n,u],props:[{style:m,"aria-hidden":!0},a],stateAttributesMapping:ka})}),xxe=function(t){const{delay:n,closeDelay:r,timeout:i=400}=t,a=k.useMemo(()=>({delay:n,closeDelay:r}),[n,r]),s=k.useMemo(()=>({open:n,close:r}),[n,r]);return b.jsx(vne.Provider,{value:a,children:b.jsx(Yve,{delay:s,timeoutMs:i,children:t.children})})};function wxe(e){return xt(e.defaultTagName??"div",e,e)}function Txe({className:e,...t}){return b.jsx("div",{"data-slot":"input-group",role:"group",className:Ue("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 Cxe=Yc("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 Axe({className:e,align:t="inline-start",...n}){return b.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Ue(Cxe({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const kxe=Yc("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 Sne({className:e,type:t="button",variant:n="ghost",size:r="xs",...i}){return b.jsx(Ke,{type:t,"data-size":r,variant:n,className:Ue(kxe({size:r}),e),...i})}function Oxe({className:e,...t}){return b.jsx(vn,{"data-slot":"input-group-control",className:Ue("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 Rxe=gSe;function Nxe({className:e,children:t,...n}){return b.jsxs(GEe,{"data-slot":"combobox-trigger",className:Ue("[&_svg:not([class*='size-'])]:size-3.5",e),...n,children:[t,b.jsx(fe,{icon:Uy,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})]})}function Ixe({className:e,...t}){return b.jsx(QEe,{"data-slot":"combobox-clear",render:b.jsx(Sne,{variant:"ghost",size:"icon-xs"}),className:Ue(e),...t,children:b.jsx(fe,{icon:ci,strokeWidth:2,className:"pointer-events-none"})})}function Dxe({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return b.jsxs(Txe,{className:Ue("w-auto",e),children:[b.jsx(XEe,{render:b.jsx(Oxe,{disabled:n}),...a}),b.jsxs(Axe,{align:"inline-end",children:[r&&b.jsx(Sne,{size:"icon-xs",variant:"ghost",render:b.jsx(Nxe,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:n}),i&&b.jsx(Ixe,{disabled:n})]}),t]})}function Lxe({className:e,side:t="bottom",sideOffset:n=6,align:r="start",alignOffset:i=0,anchor:a,...s}){return b.jsx(iSe,{children:b.jsx(aSe,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:"isolate z-50",children:b.jsx(oSe,{"data-slot":"combobox-content","data-chips":!!a,className:Ue("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 *:data-[slot=input-group]:bg-input/20 dark:bg-popover max-h-72 min-w-32 overflow-hidden rounded-lg shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:shadow-none group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)",e),...s})})})}function Pxe({className:e,...t}){return b.jsx(nSe,{"data-slot":"combobox-list",className:Ue("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 Mxe({className:e,children:t,...n}){return b.jsxs(cSe,{"data-slot":"combobox-item",className:Ue("data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[t,b.jsx(bSe,{render:b.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:b.jsx(fe,{icon:hl,strokeWidth:2,className:"pointer-events-none"})})]})}function jxe({className:e,...t}){return b.jsx(dSe,{"data-slot":"combobox-empty",className:Ue("text-muted-foreground hidden w-full justify-center py-2 text-center text-xs/relaxed group-data-empty/combobox-content:flex",e),...t})}const Fxe=Yc("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"}}),xne=k.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function Bxe({className:e,variant:t,size:n,spacing:r=0,orientation:i="horizontal",children:a,...s}){return b.jsx(uxe,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:Ue("rounded-md data-[size=sm]:rounded-[min(var(--radius-md),8px)] group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",e),...s,children:b.jsx(xne.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function mz({className:e,children:t,variant:n="default",size:r="default",...i}){const a=k.useContext(xne);return b.jsx(oxe,{"data-slot":"toggle-group-item","data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:Ue("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",Fxe({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}async function $t(e,t){const n=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t?.headers}});if(!n.ok){const r=await n.json().catch(()=>({error:"Request failed"}));throw new Error(r.error||"Request failed")}return n.json()}const zc="";function RM(){return qn({queryKey:["tasks"],queryFn:()=>$t(`${zc}/api/tasks`)})}function wne(e){return qn({queryKey:["tasks",e],queryFn:()=>$t(`${zc}/api/tasks/${e}`),enabled:!!e})}function Uxe(){const e=wr();return zn({mutationFn:t=>$t(`${zc}/api/tasks`,{method:"POST",body:JSON.stringify({...t,status:"IN_PROGRESS"})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function $xe(){const e=wr();return zn({mutationFn:({taskId:t,status:n,position:r})=>$t(`${zc}/api/tasks/${t}/status`,{method:"PATCH",body:JSON.stringify({status:n,position:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function NM(){const e=wr();return zn({mutationFn:({taskId:t,updates:n})=>$t(`${zc}/api/tasks/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{taskId:n})=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["tasks",n]})}})}function IM(){const e=wr();return zn({mutationFn:({taskId:t,deleteLinkedWorktree:n})=>{const r=n?`${zc}/api/tasks/${t}?deleteLinkedWorktree=true`:`${zc}/api/tasks/${t}`;return $t(r,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}function zxe(){const e=wr();return zn({mutationFn:({ids:t,deleteLinkedWorktrees:n})=>$t(`${zc}/api/tasks/bulk`,{method:"DELETE",body:JSON.stringify({ids:t,deleteLinkedWorktrees:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}const Gy="";function Hxe(e){return qn({queryKey:["fs","list",e],queryFn:()=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return $t(`${Gy}/api/fs/list${t}`)},enabled:e!==null})}function Wxe(e){return qn({queryKey:["git","branches",e],queryFn:()=>$t(`${Gy}/api/git/branches?repo=${encodeURIComponent(e)}`),enabled:!!e})}function Vxe(e,t={}){const{staged:n=!1,ignoreWhitespace:r=!1,includeUntracked:i=!1}=t;return qn({queryKey:["git","diff",e,n,r,i],queryFn:()=>{const a=new URLSearchParams({path:e,...n&&{staged:"true"},...r&&{ignoreWhitespace:"true"},...i&&{includeUntracked:"true"}});return $t(`${Gy}/api/git/diff?${a}`)},enabled:!!e,refetchInterval:5e3})}function Gxe(e){return qn({queryKey:["git","status",e],queryFn:()=>$t(`${Gy}/api/git/status?path=${encodeURIComponent(e)}`),enabled:!!e,refetchInterval:5e3})}async function qxe(e){return $t(`${Gy}/api/fs/is-git-repo?path=${encodeURIComponent(e)}`)}const ml="",In={PORT:"server.port",WORKTREE_BASE_PATH:"worktree_base_path",DEFAULT_GIT_REPOS_DIR:"paths.defaultGitReposDir",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",SYNC_CLAUDE_CODE_THEME:"appearance.syncClaudeCodeTheme",CLAUDE_CODE_LIGHT_THEME:"appearance.claudeCodeLightTheme",CLAUDE_CODE_DARK_THEME:"appearance.claudeCodeDarkTheme"},Kxe=7777;function Us(e){return qn({queryKey:["config",e],queryFn:()=>$t(`${ml}/api/config/${e}`)})}function Tne(){const e=Us(In.PORT);return{...e,data:e.data?.value??Kxe,isDefault:e.data?.isDefault??!0}}function Yxe(){const e=Us(In.WORKTREE_BASE_PATH);return{...e,data:e.data?.value??""}}function qy(){const e=Us(In.DEFAULT_GIT_REPOS_DIR);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function DM(){const e=Us(In.EDITOR_APP);return{...e,data:e.data?.value??"vscode",isDefault:e.data?.isDefault??!0}}function LM(){const e=Us(In.EDITOR_HOST);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function PM(){const e=Us(In.EDITOR_SSH_PORT);return{...e,data:e.data?.value??22,isDefault:e.data?.isDefault??!0}}function Xxe(){const e=Us(In.LINEAR_API_KEY);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Zxe(){const e=Us(In.GITHUB_PAT);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Qxe(){const e=Us(In.LANGUAGE);return{...e,data:e.data?.value??null,isDefault:e.data?.isDefault??!0}}function Jxe(){const e=Us(In.SYNC_CLAUDE_CODE_THEME);return{...e,data:!!e.data?.value,isDefault:e.data?.isDefault??!0}}const gz=["light","light-ansi","light-daltonized","dark","dark-ansi","dark-daltonized"];function ewe(){const e=Us(In.CLAUDE_CODE_LIGHT_THEME);return{...e,data:e.data?.value??"light-ansi",isDefault:e.data?.isDefault??!0}}function twe(){const e=Us(In.CLAUDE_CODE_DARK_THEME);return{...e,data:e.data?.value??"dark-ansi",isDefault:e.data?.isDefault??!0}}function Cne(){const e=wr();return zn({mutationFn:({key:t,value:n})=>$t(`${ml}/api/config/${t}`,{method:"PUT",body:JSON.stringify({value:n})}),onSuccess:(t,{key:n})=>{e.invalidateQueries({queryKey:["config",n]}),n===In.GITHUB_PAT&&(e.invalidateQueries({queryKey:["github-user"]}),e.invalidateQueries({queryKey:["github-prs"]}),e.invalidateQueries({queryKey:["github-issues"]}),e.invalidateQueries({queryKey:["github-orgs"]}))}})}function nwe(){const e=wr();return zn({mutationFn:t=>$t(`${ml}/api/config/${t}`,{method:"DELETE"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["config",n]})}})}function rwe(){return qn({queryKey:["config","notifications"],queryFn:()=>$t(`${ml}/api/config/notifications`)})}function iwe(){const e=wr();return zn({mutationFn:t=>$t(`${ml}/api/config/notifications`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","notifications"]})}})}function awe(){return zn({mutationFn:e=>$t(`${ml}/api/config/notifications/test/${e}`,{method:"POST"})})}function swe(){return qn({queryKey:["config","z-ai"],queryFn:()=>$t(`${ml}/api/config/z-ai`)})}function owe(){const e=wr();return zn({mutationFn:t=>$t(`${ml}/api/config/z-ai`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","z-ai"]}),e.invalidateQueries({queryKey:["monitoring","claude-usage"]})}})}function Ane(){return qn({queryKey:["config","developer-mode"],queryFn:()=>$t(`${ml}/api/config/developer-mode`),staleTime:1/0})}function lwe(){return zn({mutationFn:()=>$t(`${ml}/api/config/restart`,{method:"POST"})})}const rd="";function Ky(){return qn({queryKey:["repositories"],queryFn:()=>$t(`${rd}/api/repositories`)})}function uwe(e){return qn({queryKey:["repositories",e],queryFn:()=>$t(`${rd}/api/repositories/${e}`),enabled:!!e})}function kne(){const e=wr();return zn({mutationFn:t=>$t(`${rd}/api/repositories`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function cwe(){const e=wr();return zn({mutationFn:t=>$t(`${rd}/api/repositories/clone`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function dwe(){const e=wr();return zn({mutationFn:({id:t,updates:n})=>$t(`${rd}/api/repositories/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{id:n})=>{e.invalidateQueries({queryKey:["repositories"]}),e.invalidateQueries({queryKey:["repositories",n]})}})}function One(){const e=wr();return zn({mutationFn:t=>$t(`${rd}/api/repositories/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function fwe(){return zn({mutationFn:e=>$t(`${rd}/api/repositories/scan`,{method:"POST",body:JSON.stringify(e?{directory:e}:{})})})}function hwe(){const e=wr();return zn({mutationFn:t=>$t(`${rd}/api/repositories/bulk`,{method:"POST",body:JSON.stringify({repositories:t})}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function Yy({className:e,children:t,...n}){return b.jsxs(qSe,{"data-slot":"scroll-area",className:Ue("relative",e),...n,children:[b.jsx(QSe,{"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}),b.jsx(pwe,{}),b.jsx(nxe,{})]})}function pwe({className:e,orientation:t="vertical",...n}){return b.jsx(exe,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Ue("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none",e),...n,children:b.jsx(txe,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function Nm({open:e,onOpenChange:t,onSelect:n,initialPath:r}){const[i,a]=k.useState(r||null),[s,o]=k.useState(""),[l,u]=k.useState("");k.useEffect(()=>{e&&(a(r||null),o(""),u(""))},[e,r]);const{data:f,isLoading:d,error:p}=Hxe(e?i??"":null),m=x=>{f&&(a(f.path+"/"+x),u(""))},y=()=>{f?.parent&&f.parent!==f.path&&(a(f.parent),u(""))},S=()=>{a(null),u("")},g=()=>{s.trim()&&(a(s.trim()),u(""))},_=x=>{n(x),t(!1)},v=f?.entries.filter(x=>x.name.toLowerCase().includes(l.toLowerCase()));return b.jsx(ku,{open:e,onOpenChange:t,children:b.jsxs(Ou,{className:"sm:max-w-lg overflow-hidden",children:[b.jsxs(Jc,{children:[b.jsx(ed,{children:"Select Git Repository"}),b.jsx(zy,{children:"Choose an existing git repository"})]}),b.jsx("p",{className:"text-xs text-muted-foreground",children:"Click folder names to navigate • Use action buttons to select"}),b.jsx(iEe,{}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs font-medium",children:"Enter path manually:"}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(vn,{value:s,onChange:x=>o(x.target.value),placeholder:"/path/to/your/project",onKeyDown:x=>x.key==="Enter"&&g(),className:"flex-1"}),b.jsx(Ke,{variant:"outline",size:"sm",onClick:g,children:"Go"})]})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs font-medium",children:"Search current directory:"}),b.jsxs("div",{className:"relative",children:[b.jsx(fe,{icon:Gx,size:14,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(vn,{value:l,onChange:x=>u(x.target.value),placeholder:"Filter folders and files...",className:"pl-8"})]})]}),b.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b.jsx(Ke,{variant:"outline",size:"icon-sm",onClick:S,title:"Home",className:"shrink-0",children:b.jsx(fe,{icon:I1e,size:14,strokeWidth:2})}),b.jsx(Ke,{variant:"outline",size:"icon-sm",onClick:y,disabled:!f||f.parent===f.path,title:"Parent directory",className:"shrink-0",children:b.jsx(fe,{icon:dM,size:14,strokeWidth:2})}),b.jsx("code",{className:"min-w-0 flex-1 text-xs bg-muted/50 px-2 py-1 rounded truncate overflow-hidden",children:f?.path||"~"}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:()=>f&&_(f.path),disabled:!f,className:"shrink-0 max-sm:px-2",title:"Select current directory",children:[b.jsx(fe,{icon:YI,size:14,strokeWidth:2,className:"sm:hidden"}),b.jsx("span",{className:"max-sm:hidden",children:"Select Current"})]})]}),b.jsx(Yy,{className:"h-64 border rounded-md",children:b.jsxs("div",{className:"p-1",children:[d&&b.jsx("div",{className:"text-muted-foreground text-xs p-3",children:"Loading..."}),p&&b.jsx("div",{className:"text-destructive text-xs p-3",children:p.message}),f&&v&&b.jsxs(b.Fragment,{children:[v.length===0&&b.jsx("div",{className:"text-muted-foreground text-xs p-3",children:l?"No matches found":"Empty directory"}),v.map(x=>b.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted group",children:x.type==="directory"?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:x.isGitRepo?YI:Hi,size:16,strokeWidth:2,className:(x.isGitRepo,"text-accent")}),b.jsx("button",{onClick:()=>m(x.name),className:"flex-1 text-left text-xs truncate hover:underline",children:x.name}),x.isGitRepo&&b.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-accent/50 text-accent font-medium shrink-0",children:[b.jsx("span",{className:"max-sm:hidden",children:"git repo"}),b.jsx("span",{className:"sm:hidden",children:"git"})]})]}):b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"w-4"}),b.jsx("span",{className:"flex-1 text-xs text-muted-foreground truncate",children:x.name})]})},x.name))]})]})}),b.jsxs(Hf,{children:[b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline"}),children:"Cancel"}),b.jsx(Ke,{onClick:()=>f&&_(f.path),disabled:!f,children:"Select Path"})]})]})})}function mwe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function gwe(e){const t=mwe(e);if(!t)return"";const n=Math.random().toString(36).substring(2,6);return`${t}-${n}`}function MM({open:e,onOpenChange:t,defaultRepository:n,showTrigger:r=!0}={}){const{t:i}=tn("tasks"),{t:a}=tn("common"),[s,o]=k.useState(!1),l=e??s,u=t??o,[f,d]=k.useState(!1),[p,m]=k.useState(""),[y,S]=k.useState(""),[g,_]=k.useState(""),[v,x]=k.useState(""),[T,w]=k.useState(""),[C,R]=k.useState(""),[O,N]=k.useState("default"),[L,D]=k.useState(!1),[z,M]=k.useState(null),[V,W]=k.useState("browse"),[$,q]=k.useState(""),[Y,B]=k.useState(null),[j,U]=k.useState(!1),K=Wi(),H=Uxe(),J=kne(),se=k.useRef(null),{data:ae}=Yxe(),{data:Q}=qy(),{data:G}=Ky(),{data:Z,isLoading:ee}=Wxe(g||null),ne=z?G?.find(ve=>ve.id===z):null,te=k.useMemo(()=>{if(!G)return[];if(ne&&$===ne.displayName||!$.trim())return G;const ve=$.toLowerCase();return G.filter(De=>De.displayName.toLowerCase().includes(ve)||De.path.toLowerCase().includes(ve))},[G,$,ne]);k.useEffect(()=>{G&&G.length>0?W("saved"):W("browse")},[G]),k.useEffect(()=>{if(l){if(n)M(n.id),_(n.path),q(n.displayName),W("saved");else if(G&&G.length>0){const ve=G[0];M(ve.id),_(ve.path),q(ve.displayName),W("saved")}}},[l,n,G]),k.useEffect(()=>{x(Z?Z.current||Z.branches[0]||"main":"")},[Z,g]);const be=ve=>{m(ve),R(gwe(ve))},_e=async ve=>{B(null),U(!0);try{if(!(await qxe(ve)).isGitRepo){B(i("createModal.errors.notGitRepo")),U(!1);return}if(_(ve),M(null),!G?.find(pe=>pe.path===ve)){const pe=ve.split("/").pop()||"Unknown";J.mutate({path:ve,displayName:pe})}}catch(De){B(De instanceof Error?De.message:i("createModal.errors.validationFailed"))}finally{U(!1)}},he=ve=>{if(ve.preventDefault(),!p.trim()||!g)return;const De=g.split("/").pop()||"repo",Te=T.trim()||C,pe=`${ae}/${Te}`;H.mutate({title:p.trim(),description:y.trim(),aiMode:O,repoPath:g,repoName:De,baseBranch:v||"main",branch:Te,worktreePath:pe,copyFiles:ne?.copyFiles||void 0,startupScript:ne?.startupScript||void 0},{onSuccess:ce=>{const Re=y.trim()?{aiMode:O,description:y.trim()}:{aiMode:O};u(!1),m(""),S(""),_(""),x(""),w(""),R(""),N("default"),D(!1),M(null),q(""),B(null),W(G&&G.length>0?"saved":"browse"),K({to:"/tasks/$taskId",params:{taskId:ce.id},state:Re})},onError:ce=>{ln.error(i("createModal.errors.createFailed"),{description:ce instanceof Error?ce.message:String(ce)})}})},ye=!H.isPending&&!!p.trim()&&!!g;Es("meta+enter",()=>{se.current&&se.current.requestSubmit()},{enabled:l&&ye,allowInInput:!0,ignoreContext:!0,deps:[l,ye]});const Ee=T.trim()||C,xe=Ee?`${ae}/${Ee}`:"";return b.jsxs(b.Fragment,{children:[b.jsxs(ku,{open:l,onOpenChange:u,children:[r&&b.jsxs(Tte,{render:b.jsx(Ke,{size:"sm"}),children:[b.jsx(fe,{icon:pM,size:16,strokeWidth:2,"data-slot":"icon",className:"-translate-y-px"}),i("newTask")]}),b.jsx(Ou,{className:"sm:max-w-md max-h-[80dvh] flex flex-col overflow-hidden",children:b.jsxs("form",{ref:se,onSubmit:he,className:"flex flex-col min-h-0 flex-1",children:[b.jsxs(Jc,{className:"shrink-0",children:[b.jsx(ed,{children:i("createModal.title")}),b.jsx(zy,{children:i("createModal.description")})]}),b.jsxs(pf,{className:"mt-4 pb-4 overflow-y-auto min-h-0 flex-1",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"title",children:i("createModal.fields.title")}),b.jsx(vn,{id:"title",value:p,onChange:ve=>be(ve.target.value),placeholder:i("createModal.fields.titlePlaceholder"),required:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"description",children:i("createModal.fields.description")}),b.jsx(kte,{id:"description",value:y,onValueChange:ve=>{S(ve),L||N(ve.trim()?"plan":"default")},placeholder:i("createModal.fields.descriptionPlaceholder"),rows:2})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:i("createModal.fields.aiMode")}),b.jsxs(Bxe,{value:[O],onValueChange:ve=>{const De=Array.isArray(ve)?ve[0]:ve;De&&(N(De),D(!0))},className:"w-full",variant:"outline",children:[b.jsx(mz,{value:"plan",className:"flex-1",children:i("createModal.aiModes.plan")}),b.jsx(mz,{value:"default",className:"flex-1",children:i("createModal.aiModes.default")})]})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:i("createModal.fields.repository")}),b.jsxs(su,{value:V,onValueChange:ve=>{W(ve),B(null)},children:[b.jsxs(ou,{children:[b.jsx(li,{value:"saved",disabled:!G?.length,children:i("createModal.tabs.saved")}),b.jsx(li,{value:"browse",children:i("createModal.tabs.browse")})]}),b.jsx(Pi,{value:"saved",className:"mt-2",children:b.jsxs(Rxe,{value:z||"",onValueChange:ve=>{const De=G?.find(Te=>Te.id===ve);De&&(M(ve),_(De.path),q(De.displayName),B(null))},inputValue:$,onInputValueChange:ve=>{q(ve),ne&&ve!==ne.displayName&&M(null)},itemToStringLabel:ve=>G?.find(De=>De.id===ve)?.displayName||"",children:[b.jsx(Dxe,{placeholder:i("createModal.searchRepositories"),className:"w-full"}),b.jsx(Lxe,{children:b.jsxs(Pxe,{children:[b.jsx(jxe,{children:i("createModal.noRepositoriesFound")}),te.map(ve=>b.jsx(Mxe,{value:ve.id,children:ve.displayName},ve.id))]})})]})}),b.jsx(Pi,{value:"browse",className:"mt-2",children:b.jsxs(Ke,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>d(!0),disabled:j,children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2,className:"mr-2"}),j?b.jsx("span",{className:"text-muted-foreground",children:a("status.validating")}):g&&!z?b.jsx("span",{className:"truncate",children:g}):b.jsx("span",{className:"text-muted-foreground group-hover/button:text-accent-foreground",children:i("createModal.selectFolder")})]})})]}),Y&&b.jsx("p",{className:"text-sm text-destructive",children:Y}),g&&!Y&&b.jsx(qa,{className:"font-mono text-xs truncate",children:g})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"baseBranch",children:i("createModal.fields.baseBranch")}),b.jsxs(ji,{value:v,onValueChange:ve=>x(ve??""),disabled:!g||ee,children:[b.jsx(Bi,{className:"w-full",children:b.jsx(Fi,{children:v||b.jsx("span",{className:"text-muted-foreground",children:i(g?ee?"createModal.loadingBranches":"createModal.selectBranch":"createModal.selectRepositoryFirst")})})}),b.jsx(Ui,{children:Z?.branches.map(ve=>b.jsxs(Cn,{value:ve,children:[ve,ve===Z.current&&b.jsx("span",{className:"text-muted-foreground ml-2",children:i("createModal.current")})]},ve))})]})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"branch",children:i("createModal.fields.branchName")}),b.jsx(vn,{id:"branch",value:T,onChange:ve=>w(ve.target.value),placeholder:C||i("createModal.fields.branchPlaceholder")}),xe&&b.jsxs(qa,{children:[i("createModal.worktreePrefix")," ",xe]}),!T.trim()&&C&&b.jsx(qa,{children:i("createModal.branchAutoGenerated",{branch:C})})]})]}),b.jsxs(Hf,{className:"mt-4 shrink-0",children:[b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline",type:"button",className:"border-destructive text-destructive hover:bg-destructive hover:text-white"}),children:a("buttons.cancel")}),b.jsx(Ke,{type:"submit",disabled:H.isPending||!p.trim()||!g,children:H.isPending?a("status.creating"):i("createModal.createTask")})]})]})})]}),b.jsx(Nm,{open:f,onOpenChange:d,onSelect:_e,initialPath:Q||void 0})]})}const bz=[{to:"/tasks",icon:Dp,labelKey:"header.tasks",matchPrefix:!0},{to:"/terminals",icon:fM,labelKey:"header.terminals",matchPrefix:!1},{to:"/repositories",icon:np,labelKey:"header.repositories",matchPrefix:!0},{to:"/review",icon:Ub,labelKey:"header.review",matchPrefix:!0},{to:"/monitoring",icon:S1e,labelKey:"header.monitoring",matchPrefix:!0}];function bwe({onNewTaskRef:e,onOpenCommandPalette:t}){const{t:n}=tn("navigation"),{location:r}=ti(),i=r.pathname,[a,s]=k.useState(!1),o=(l,u)=>u?i.startsWith(l):i===l;return k.useEffect(()=>{e?.(()=>s(!0))},[e]),b.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:[b.jsxs("div",{className:"flex min-w-0 items-center gap-4 max-sm:gap-2",children:[b.jsx(W1e,{className:"md:hidden",children:b.jsx(V1e,{children:b.jsxs(G1e,{children:[b.jsxs(K1e,{className:"bg-transparent hover:bg-muted/50 data-open:bg-muted/50 gap-1 px-2",children:[b.jsx(fe,{icon:ute,size:16,strokeWidth:2}),b.jsx("span",{className:"sr-only",children:"Menu"})]}),b.jsx(Y1e,{className:"min-w-48",children:bz.map(l=>b.jsxs(Z1e,{href:l.to,active:o(l.to,l.matchPrefix),render:b.jsx(wi,{to:l.to}),children:[b.jsx(fe,{icon:l.icon,size:16,strokeWidth:2}),n(l.labelKey)]},l.to))})]})})}),b.jsx("nav",{className:"hidden items-center gap-1 md:flex",children:bz.map(l=>{const u=o(l.to,l.matchPrefix);return b.jsxs(wi,{to:l.to,className:Ue("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:[b.jsx(fe,{icon:l.icon,size:16,strokeWidth:2,"data-slot":"icon"}),n(l.labelKey)]},l.to)})})]}),b.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[b.jsx(MM,{open:a,onOpenChange:s}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:t,title:n("header.commandPalette",{shortcut:"⌘K"}),children:b.jsx(fe,{icon:KI,size:16,strokeWidth:2})}),b.jsx(wi,{to:"/settings",className:Ue("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:b.jsx(fe,{icon:cte,size:16,strokeWidth:2})})]})]})}function vwe(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}const ywe=10,_we=2e3;function Ewe(){const e=wr(),t=Wi(),{resolvedTheme:n}=qc(),r=k.useRef(null),i=k.useRef(void 0),a=k.useRef(0),s=k.useRef(void 0),o=k.useCallback(u=>{try{const f=JSON.parse(u.data);if(f.type==="task:updated")e.invalidateQueries({queryKey:["tasks"]});else if(f.type==="notification"&&"payload"in f){let d=function(){const N=_&&!v?"/goat.jpeg":n==="dark"?"/logo-dark.jpg":"/logo-light.jpg",D={description:y,icon:b.jsx("img",{src:N,alt:"",className:"size-8 shrink-0 aspect-square rounded-sm object-cover"}),...g&&{action:{label:"View",onClick:()=>t({to:"/tasks/$taskId",params:{taskId:g}})}}};switch(S){case"success":ln.success(m,D);break;case"error":ln.error(m,D);break;case"warning":ln.warning(m,D);break;default:ln.info(m,D);break}if("Notification"in window&&window.parent===window&&Notification.permission==="granted"&&new Notification(m,{body:y,icon:N,tag:p}),_){const V="vibora:lastSoundPlayed",W=Date.now(),$=localStorage.getItem(V);if($){const Y=parseInt($.split(":")[0]);if(W-Y<1e3)return}const q=`${W}:${Math.random().toString(36).slice(2)}`;localStorage.setItem(V,q),setTimeout(()=>{if(localStorage.getItem(V)!==q)return;let Y=!1;const B=()=>{if(Y)return;Y=!0,new Audio("/sounds/goat-bleat.mp3").play().catch(()=>{})},j=new Audio("/api/uploads/sound");j.onerror=B,j.play().catch(B)},50)}window.parent!==window&&window.parent.postMessage({type:"vibora:notification",title:m,message:y,notificationType:S},"*")};const{id:p,title:m,message:y,notificationType:S,taskId:g,playSound:_,isCustomSound:v}=f.payload,x=`vibora:notification:${p}`,T=50,w=1e4;if(localStorage.getItem(x))return;const R=`${Date.now()}:${Math.random().toString(36).slice(2)}`;localStorage.setItem(x,R),setTimeout(()=>{localStorage.getItem(x)===R&&(setTimeout(()=>localStorage.removeItem(x),w),d())},T)}}catch{}},[e,t,n]),l=k.useCallback(()=>{const u=r.current;if(u&&(u.readyState===WebSocket.CONNECTING||u.readyState===WebSocket.OPEN))return;const f=vwe(),d=new WebSocket(f);r.current=d,d.onopen=()=>{a.current=0},d.onmessage=o,d.onclose=()=>{r.current===d&&(r.current=null),a.current<ywe&&(a.current++,i.current=setTimeout(()=>{s.current?.()},_we))},d.onerror=()=>{}},[o]);s.current=l,k.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]),k.useEffect(()=>(l(),()=>{i.current&&clearTimeout(i.current);const u=r.current;u&&(u.readyState===WebSocket.OPEN&&u.close(),r.current=null)}),[l])}const Swe={save:"Save Changes",cancel:"Cancel",delete:"Delete",create:"Create",reset:"Reset to default",browse:"Browse",clearFilters:"Clear filters"},xwe={loading:"Loading...",saving:"Saving...",saved:"Saved",error:"Error",calculating:"calculating...",validating:"Validating...",creating:"Creating...",deleting:"Deleting...",loggingIn:"Logging in..."},wwe={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"},Twe={one:"{{count}} result",other:"{{count}} results"},Cwe={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled",ORPHANED:"Orphaned"},Awe={loginTitle:"Login to Vibora",username:"Username",password:"Password",login:"Login",loginFailed:"Login failed"},kwe={buttons:Swe,status:xwe,time:wwe,results:Twe,statuses:Cwe,auth:Awe},Owe={tasks:"Tasks",terminals:"Terminals",worktrees:"Worktrees",repositories:"Repositories",review:"Review",monitoring:"Monitoring",settings:"Settings",commandPalette:"Command Palette ({{shortcut}})"},Rwe={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"}},Nwe={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"}},Iwe={header:Owe,commandPalette:Rwe,shortcuts:Nwe},Dwe="Tasks",Lwe="Search",Pwe="All Repos",Mwe="New Task",jwe={title:"Create New Task",description:"Create a new task with a git worktree for isolated development.",fields:{title:"Title",titlePlaceholder:"Add user authentication",description:"Description",descriptionPlaceholder:"Implement OAuth2 login flow...",aiMode:"AI Mode",repository:"Repository",baseBranch:"Base Branch",branchName:"Branch Name",branchPlaceholder:"auto-generated-from-title"},aiModes:{plan:"Plan",default:"Default"},tabs:{saved:"Repos",browse:"Browse"},worktreePrefix:"Worktree:",branchAutoGenerated:'Will use "{{branch}}" if left empty.',selectFolder:"Select folder...",searchRepositories:"Search repositories...",noRepositoriesFound:"No repositories found",selectRepositoryFirst:"Select repository first",loadingBranches:"Loading branches...",selectBranch:"Select branch",current:"(current)",createTask:"Create Task",errors:{notGitRepo:"Selected folder is not a git repository",validationFailed:"Failed to validate repository",createFailed:"Failed to create task"}},Fwe={title:Dwe,searchPlaceholder:Lwe,allRepos:Pwe,newTask:Mwe,createModal:jwe},Bwe="Settings",Uwe={server:"Server",serverDefaults:"Server & Defaults",paths:"Paths",editor:"Editor",integrations:"Integrations",zai:"z.ai",notifications:"Notifications",appearance:"Appearance",developer:"Developer"},$we={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"},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)"}}},zwe={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"},Hwe={restartButton:"Restart Vibora",restarting:"Restarting...",restartDescription:"Rebuild and restart the Vibora server. If the build fails, the server will continue running.",restartFailed:"Restart failed",checkLogs:"Build may have failed. Check journalctl --user -u vibora for details."},Wwe={title:"Unsaved Changes",description:"You have unsaved changes that will be lost if you leave this page.",stay:"Stay",leave:"Leave"},Vwe={title:Bwe,sections:Uwe,fields:$we,notifications:zwe,developer:Hwe,unsavedChanges:Wwe},Gwe="Review",qwe={pullRequests:"Pull Requests",issues:"Issues"},Kwe={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"},Ywe={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"},Xwe={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"},Zwe={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"}},Qwe={title:Gwe,tabs:qwe,filters:Kwe,github:Ywe,prs:Xwe,issues:Zwe},Jwe="Worktrees",eTe={total:"{{count}} total",orphaned:"{{count}} orphaned"},tTe={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."},nTe={noMatch:"No worktrees match the selected filters.",noWorktrees:"No worktrees found. Worktrees are created when you create tasks."},rTe={failedToLoad:"Failed to load worktrees: {{message}}"},iTe={title:Jwe,summary:eTe,cleanup:tTe,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:nTe,error:rTe},aTe="Monitoring",sTe={claude:"Claude Instances",system:"System Metrics",processes:"Processes",vibora:"Vibora Servers",worktrees:"Worktrees",usage:"Usage Limits"},oTe={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...",killSelected:"Kill {{count}} selected",source:{vibora:"Vibora: {{name}}",external:"External"},empty:"No Claude instances running",emptyVibora:" in Vibora terminals",error:"Failed to load Claude instances: {{message}}"},lTe={cpuUsage:"CPU Usage",memoryUsage:"Memory Usage",memoryLabels:{used:"Used",cache:"Cache / Buffers"},diskUsage:"Disk Usage ({{path}})",error:"Failed to load system metrics: {{message}}"},uTe={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"},cTe={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}}"},dTe={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}}"},fTe={title:aTe,tabs:sTe,claude:oTe,system:lTe,processes:uTe,vibora:cTe,usage:dTe},hTe="Tasks",pTe="New Terminal",mTe="All Repos",gTe={title:"Edit Tab",name:"Name",namePlaceholder:"Tab name",directory:"Directory",directoryPlaceholder:"Select a directory...",clearDirectory:"Clear directory",cancel:"Cancel",save:"Save"},bTe={title:"New Tab",create:"Create"},vTe={taskTerminals:hTe,newTerminal:pTe,allRepos:mTe,editTab:gTe,newTab:bTe},yTe="Repositories",_Te="{{count}} total",ETe="Search repositories...",STe="New Task",xTe="Tasks",wTe="Terminal",TTe="Editor",CTe="Settings",ATe="Add Repository",kTe="Scan Directory",OTe="Open in Terminal",RTe="Open in {{editor}}",NTe={openInVSCode:"Open in VS Code"},ITe={title:"Add Repository",description:"Add a git repository from a URL or local path.",inputLabel:"Repository URL or path",inputPlaceholder:"https://github.com/user/repo or /local/path",browse:"Browse...",willCloneTo:"Will clone to",cloning:"Cloning repository...",adding:"Adding...",cloneFailed:"Failed to clone repository",createFailed:"Failed to add repository",cancel:"Cancel",add:"Add",retry:"Retry",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."}},DTe={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.",help:"Copier generates new projects from templates, letting you scaffold applications with pre-configured settings.",learnMore:"Learn more about Copier",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",trustTemplate:"Trust this template",trustWarning:"This template runs code during project creation. Only enable if you trust the source."},creating:{description:"Creating your project...",inProgress:"Running Copier..."}}},LTe={title:"Scan Directory for Repositories",description:"Find and add multiple git repositories from a directory.",directoryLabel:"Directory to scan",directoryPlaceholder:"Enter directory path",browse:"Browse...",scan:"Scan",foundRepos:"Found {{count}} repositories",selectAll:"Select all",selectNone:"Select none",noReposFound:"No git repositories found in this directory.",alreadyAdded:"Already added",adding:"Adding repositories...",scanFailed:"Failed to scan directory",addFailed:"Failed to add repositories",cancel:"Cancel",addSelected:"Add {{count}} selected"},PTe={noRepositories:"No repositories added yet. Add a repository for quick access when creating tasks.",noMatches:"No repositories match your search."},MTe={failedToLoad:"Failed to load repositories: {{message}}"},jTe={title:yTe,total:_Te,searchPlaceholder:ETe,newTask:STe,viewTasks:xTe,terminal:wTe,editor:TTe,settings:CTe,addRepository:ATe,scanDirectory:kTe,openInTerminal:OTe,openInEditor:RTe,card:NTe,delete:{title:"Delete Repository",description:'This will remove "{{name}}" from Vibora. The actual repository files will not be affected.',button:"Delete",deleting:"Deleting..."},addModal:ITe,newProject:DTe,bulkAdd:LTe,empty:PTe,error:MTe},FTe={save:"保存更改",cancel:"取消",delete:"删除",create:"创建",reset:"重置为默认值",browse:"浏览",clearFilters:"清除筛选"},BTe={loading:"加载中...",saving:"保存中...",saved:"已保存",error:"错误",calculating:"计算中...",validating:"验证中...",creating:"创建中...",deleting:"删除中...",loggingIn:"登录中..."},UTe={justNow:"刚刚",minuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",hourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",dayAgo:"1 天前",daysAgo:"{{count}} 天前"},$Te={one:"{{count}} 个结果",other:"{{count}} 个结果"},zTe={IN_PROGRESS:"进行中",IN_REVIEW:"审核中",DONE:"已完成",CANCELED:"已取消",ORPHANED:"孤立"},HTe={loginTitle:"登录 Vibora",username:"用户名",password:"密码",login:"登录",loginFailed:"登录失败"},WTe={buttons:FTe,status:BTe,time:UTe,results:$Te,statuses:zTe,auth:HTe},VTe={tasks:"任务",terminals:"终端",worktrees:"工作树",repositories:"仓库",review:"审核",monitoring:"监控",settings:"设置",commandPalette:"命令面板 ({{shortcut}})"},GTe={placeholder:"输入命令或搜索...",noResults:"未找到命令",categories:{navigation:"导航",actions:"操作"},commands:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",newTask:"新建任务",keyboardShortcuts:"键盘快捷键"}},qTe={title:"键盘快捷键",groups:{navigation:"导航",actions:"操作",general:"通用"},labels:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",commandPalette:"命令面板",newTask:"新建任务",keyboardShortcuts:"键盘快捷键",closeModal:"关闭弹窗"}},KTe={header:VTe,commandPalette:GTe,shortcuts:qTe},YTe="任务",XTe="搜索",ZTe="全部仓库",QTe="新建任务",JTe={title:"创建新任务",description:"创建一个带有 Git 工作树的新任务,用于隔离开发。",fields:{title:"标题",titlePlaceholder:"添加用户认证",description:"描述",descriptionPlaceholder:"实现 OAuth2 登录流程...",aiMode:"AI 模式",repository:"仓库",baseBranch:"基础分支",branchName:"分支名称",branchPlaceholder:"自动生成分支名"},aiModes:{plan:"计划",default:"默认"},tabs:{saved:"仓库",browse:"浏览"},worktreePrefix:"工作树:",branchAutoGenerated:'留空将使用 "{{branch}}"。',selectFolder:"选择文件夹...",searchRepositories:"搜索仓库...",noRepositoriesFound:"未找到仓库",selectRepositoryFirst:"请先选择仓库",loadingBranches:"加载分支中...",selectBranch:"选择分支",current:"(当前)",createTask:"创建任务",errors:{notGitRepo:"所选文件夹不是 Git 仓库",validationFailed:"验证仓库失败",createFailed:"创建任务失败"}},eCe={title:YTe,searchPlaceholder:XTe,allRepos:ZTe,newTask:QTe,createModal:JTe},tCe="设置",nCe={server:"服务器",serverDefaults:"服务器与默认设置",paths:"路径",editor:"编辑器",integrations:"集成",zai:"z.ai",notifications:"通知",appearance:"外观",developer:"开发者"},rCe={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 的个人访问令牌"},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":"深色(色盲友好)"}}},iCe={enable:"启用通知",sound:"声音",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"应用令牌",userKey:"用户密钥",testSuccess:"{{channel}} 测试成功",testFailed:"{{channel}} 测试失败:{{error}}",uploadSound:"上传自定义声音",deleteSound:"删除自定义声音",testSound:"测试声音",soundUploaded:"自定义声音已上传",soundUploadFailed:"上传声音失败:{{error}}",soundDeleted:"自定义声音已删除",soundDeleteFailed:"删除自定义声音失败",customSoundActive:"使用自定义声音"},aCe={restartButton:"重启 Vibora",restarting:"重启中...",restartDescription:"重新构建并重启 Vibora 服务器。如果构建失败,服务器将继续运行。",restartFailed:"重启失败",checkLogs:"构建可能失败。运行 journalctl --user -u vibora 查看详情。"},sCe={title:"未保存的更改",description:"您有未保存的更改,离开此页面将丢失这些更改。",stay:"留下",leave:"离开"},oCe={title:tCe,sections:nCe,fields:rCe,notifications:iCe,developer:aCe,unsavedChanges:sCe},lCe="审核",uCe={pullRequests:"拉取请求",issues:"问题"},cCe={pr:{created:"我创建的",assigned:"分配给我的",reviewRequested:"待我审核",mentioned:"提及我的"},issue:{assigned:"分配给我的",created:"我创建的",mentioned:"提及我的"},allOrgs:"所有组织",allOrganizations:"所有组织",viboraReposOnly:"仅 Vibora 仓库"},dCe={tokenRequired:"需要 GitHub 令牌",tokenDescription:"要查看您的问题和拉取请求,请在设置中添加 GitHub 个人访问令牌。",requiredScopes:"所需权限:",scopes:{repo:"(用于私有仓库)",readUser:"(用于用户信息)",readOrg:"(用于组织列表)"},generateToken:"生成令牌",goToSettings:"前往设置"},fCe={loading:"加载中...",failedToLoad:"加载拉取请求失败",empty:{all:"没有打开的拉取请求",created:"没有您创建的拉取请求",assigned:"没有分配给您的拉取请求",reviewRequested:"没有等待您审核的拉取请求",mentioned:"没有提及您的拉取请求"},draft:"草稿"},hCe={loading:"加载中...",failedToLoad:"加载问题失败",empty:{assigned:"没有分配给您的问题",created:"没有您创建的问题",mentioned:"没有提及您的问题"}},pCe={title:lCe,tabs:uCe,filters:cCe,github:dCe,prs:fCe,issues:hCe},mCe="工作树",gCe={total:"共 {{count}} 个",orphaned:"{{count}} 个孤立"},bCe={button:"清理 ({{count}})",title:"删除已完成的工作树",description:"这将永久删除 {{count}} 个工作树。",linkedTasksWillBeDeleted:"关联的任务也将被删除。",alsoDeleteLinkedTasks:"同时删除关联的任务",done:"已完成",canceled:"已取消",cannotUndo:"此操作无法撤销。"},vCe={noMatch:"没有匹配所选筛选条件的工作树。",noWorktrees:"未找到工作树。工作树在创建任务时自动生成。"},yCe={failedToLoad:"加载工作树失败:{{message}}"},_Ce={title:mCe,summary:gCe,cleanup:bCe,delete:{title:"删除工作树",description:"这将永久删除位于以下位置的工作树目录",linkedTaskWillBeDeleted:'关联的任务 "{{title}}" 也将被删除。',alsoDeleteLinkedTask:'同时删除关联的任务 "{{title}}"',cannotUndo:"此操作无法撤销。",button:"删除 {{count}} 个"},empty:vCe,error:yCe},ECe="监控",SCe={claude:"Claude 实例",system:"系统指标",processes:"进程",vibora:"Vibora 服务器",usage:"使用限额"},xCe={showAllInstances:"显示所有实例",instanceCount:"{{count}} 个实例运行中",totalRam:"总计 {{ram}} MB",headers:{terminal:"终端",task:"任务",ram:"内存",actions:"操作",pid:"PID",workingDirectory:"工作目录",source:"来源"},noTask:"(无任务)",kill:"终止",killing:"终止中...",killSelected:"终止 {{count}} 个已选",source:{vibora:"Vibora: {{name}}",external:"外部"},empty:"没有 Claude 实例运行中",emptyVibora:" (在 Vibora 终端中)",error:"加载 Claude 实例失败:{{message}}"},wCe={cpuUsage:"CPU 使用率",memoryUsage:"内存使用率",memoryLabels:{used:"已使用",cache:"缓存/缓冲区"},diskUsage:"磁盘使用率 ({{path}})",error:"加载系统指标失败:{{message}}"},TCe={topProcesses:"热门进程",sortBy:{memory:"按内存",cpu:"按 CPU"},headers:{pid:"PID",name:"名称",command:"命令",memory:"内存"},empty:"未找到进程",error:"加载进程失败:{{message}}",containers:"容器",containersEmpty:"没有容器运行中",containersUnavailable:"Docker/Podman 不可用"},CCe={description:"运行中的 Vibora 开发服务器",instanceCount:"{{count}} 个实例运行中",headers:{port:"端口",mode:"模式",directory:"目录",ram:"内存",actions:"操作"},mode:{dev:"开发",prod:"生产"},vite:"Vite",kill:"终止",killing:"终止中...",empty:"没有 Vibora 实例运行中",error:"加载 Vibora 实例失败:{{message}}"},ACe={fiveHourBlock:"5小时配额",sevenDayRolling:"7天滚动配额",opusWeekly:"Opus 周配额",sonnetWeekly:"Sonnet 周配额",resetsIn:"{{time}}后重置",resetsAt:"{{time}}重置",weekProgress:"本周已过 {{percent}}%",unavailable:"Claude Code 使用数据不可用。请确保已登录 Claude Code。",error:"加载使用数据失败:{{message}}"},kCe={title:ECe,tabs:SCe,claude:xCe,system:wCe,processes:TCe,vibora:CCe,usage:ACe},OCe="任务",RCe="新建终端",NCe="全部仓库",ICe={taskTerminals:OCe,newTerminal:RCe,allRepos:NCe},DCe="仓库",LCe="共 {{count}} 个",PCe="搜索仓库...",MCe="新建任务",jCe="添加仓库",FCe="扫描目录",BCe={openInVSCode:"在 VS Code 中打开"},UCe={title:"添加仓库",description:"从 URL 或本地路径添加 Git 仓库。",inputLabel:"仓库 URL 或路径",inputPlaceholder:"https://github.com/user/repo 或 /local/path",browse:"浏览...",willCloneTo:"将克隆到",cloning:"正在克隆仓库...",adding:"添加中...",cloneFailed:"克隆仓库失败",createFailed:"添加仓库失败",cancel:"取消",add:"添加",retry:"重试",fields:{path:"仓库路径",pathPlaceholder:"选择仓库...",displayName:"显示名称",startupScript:"启动脚本",startupScriptPlaceholder:"npm install && npm run dev",startupScriptDescription:"创建工作树时在终端中运行的命令。",copyFiles:"复制文件",copyFilesPlaceholder:".env, config.local.json",copyFilesDescription:"用逗号分隔的 glob 模式,用于复制文件到新的工作树。"}},$Ce={title:"扫描目录中的仓库",description:"从目录中查找并添加多个 Git 仓库。",directoryLabel:"要扫描的目录",directoryPlaceholder:"输入目录路径",browse:"浏览...",scan:"扫描",foundRepos:"找到 {{count}} 个仓库",selectAll:"全选",selectNone:"取消全选",noReposFound:"此目录中未找到 Git 仓库。",alreadyAdded:"已添加",adding:"正在添加仓库...",scanFailed:"扫描目录失败",addFailed:"添加仓库失败",cancel:"取消",addSelected:"添加 {{count}} 个选中项"},zCe={button:"新建项目",title:"创建新项目",back:"返回",next:"下一步",create:"创建项目",steps:{template:{description:"选择一个模板来创建您的项目。",help:"Copier 从模板生成新项目,让您可以使用预配置的设置快速搭建应用程序。",learnMore:"了解更多关于 Copier",savedTemplates:"已保存的模板",selectTemplate:"选择模板...",or:"或",customUrl:"自定义模板 URL/路径",customUrlHelp:"Copier 模板的 Git URL 或本地路径。"},questions:{description:"配置您的项目。",noQuestions:"此模板没有配置问题。"},output:{description:"选择项目创建位置。",projectName:"项目名称",outputDirectory:"输出目录",selectDirectory:"选择目录...",willCreate:"将创建"},creating:{description:"正在创建您的项目...",inProgress:"正在运行 Copier..."}}},HCe={noRepositories:"尚未添加任何仓库。添加一个仓库以便在创建任务时快速访问。",noMatches:"没有匹配的仓库。"},WCe={failedToLoad:"加载仓库失败:{{message}}"},VCe={title:DCe,total:LCe,searchPlaceholder:PCe,newTask:MCe,addRepository:jCe,scanDirectory:FCe,card:BCe,delete:{title:"删除仓库",description:'这将从 Vibora 中移除 "{{name}}"。实际的仓库文件不会受到影响。',button:"删除",deleting:"删除中..."},addModal:UCe,bulkAdd:$Ce,newProject:zCe,empty:HCe,error:WCe},GCe="common",JI=["en","zh"],qCe={en:{common:kwe,navigation:Iwe,tasks:Fwe,settings:Vwe,review:Qwe,worktrees:iTe,monitoring:fTe,terminals:vTe,repositories:jTe},zh:{common:WTe,navigation:KTe,tasks:eCe,settings:oCe,review:pCe,worktrees:_Ce,monitoring:kCe,terminals:ICe,repositories:VCe}};function KCe(){if(typeof window<"u"){const e=localStorage.getItem("vibora-language");if(e&&JI.includes(e))return e;const t=navigator.language.split("-")[0];if(JI.includes(t))return t}return"en"}Vi.use(kge).init({resources:qCe,lng:KCe(),fallbackLng:"en",defaultNS:GCe,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 Rne(){const{i18n:e}=tn(),{data:t,isSuccess:n}=Qxe(),r=Cne();k.useEffect(()=>{n&&t&&t!==e.language&&e.changeLanguage(t)},[n,t,e]);const i=k.useCallback(async a=>{if(a)await e.changeLanguage(a);else{const s=navigator.language.split("-")[0],o=JI.includes(s)?s:"en";await e.changeLanguage(o)}r.mutate({key:In.LANGUAGE,value:a??""})},[e,r]);return{language:e.language,savedLanguage:t,changeLanguage:i,isUpdating:r.isPending}}function sn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var YCe={};function tw(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:YCe}var Nne=Object.assign,XE=Object.getOwnPropertyDescriptor,Qo=Object.defineProperty,nw=Object.prototype,eD=[];Object.freeze(eD);var jM={};Object.freeze(jM);var XCe=typeof Proxy<"u",ZCe=Object.toString();function Ine(){XCe||sn("Proxy not available")}function Dne(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var rp=function(){};function ns(e){return typeof e=="function"}function Nf(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function rw(e){return e!==null&&typeof e=="object"}function Hc(e){if(!rw(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===ZCe}function Lne(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function iw(e,t,n){Qo(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Pne(e,t,n){Qo(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function id(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return rw(r)&&r[n]===!0}}function Im(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function QCe(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function Zl(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Mne=typeof Object.getOwnPropertySymbols<"u";function JCe(e){var t=Object.keys(e);if(!Mne)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return nw.propertyIsEnumerable.call(e,r)})):t}var aw=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Mne?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function jne(e){return e===null?null:typeof e=="object"?""+e:e}function lu(e,t){return nw.hasOwnProperty.call(e,t)}var eAe=Object.getOwnPropertyDescriptors||function(t){var n={};return aw(t).forEach(function(r){n[r]=XE(t,r)}),n};function Xa(e,t){return!!(e&t)}function Za(e,t,n){return n?e|=t:e&=~t,e}function vz(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tAe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,rAe(r.key),r)}}function Dm(e,t,n){return t&&tAe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ip(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=iAe(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
25
+ `:"")+y)}catch(y){ln.error("Failed to upload image"),At.kanban.error("Upload error",{error:String(y)})}finally{s(!1)}return}}};return b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"relative",children:[b.jsx(bM,{ref:o,value:e,onChange:f=>t(f.target.value),onPaste:u,className:Ue(a&&"opacity-50",n),disabled:a||r,...i}),a&&b.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50 rounded-md",children:b.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})})]}),l.length>0&&b.jsx("div",{className:"flex flex-wrap gap-2",children:l.map((f,d)=>b.jsx("a",{href:az(f),target:"_blank",rel:"noopener noreferrer",className:"block",children:b.jsx("img",{src:az(f),alt:`Attachment ${d+1}`,className:"h-16 w-auto rounded border object-cover hover:opacity-80 transition-opacity"})},d))})]})}function Ote({className:e,...t}){return b.jsx("label",{"data-slot":"label",className:Ue("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 rEe=k.forwardRef(function(t,n){const{className:r,render:i,orientation:a="horizontal",...s}=t,o=k.useMemo(()=>({orientation:a}),[a]);return xt("div",t,{state:o,ref:n,props:[{role:"separator","aria-orientation":a},s]})});function iEe({className:e,orientation:t="horizontal",...n}){return b.jsx(rEe,{"data-slot":"separator",orientation:t,className:Ue("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",e),...n})}function pf({className:e,...t}){return b.jsx("div",{"data-slot":"field-group",className:Ue("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 aEe=Yc("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 ir({className:e,orientation:t="vertical",...n}){return b.jsx("div",{role:"group","data-slot":"field","data-orientation":t,className:Ue(aEe({orientation:t}),e),...n})}function ar({className:e,...t}){return b.jsx(Ote,{"data-slot":"field-label",className:Ue("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 qa({className:e,...t}){return b.jsx("p",{"data-slot":"field-description",className:Ue("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 Rte(e){const t=k.useRef(!0);t.current&&(t.current=!1,e())}const Nte=k.createContext(null),Ite=k.createContext(null);function pl(){const e=k.useContext(Nte);if(e===null)throw new Error(rn(60));return e}function Dte(){const e=k.useContext(Ite);if(e===null)throw new Error(rn(61));return e}const Lte=(e,t)=>Object.is(e,t);function bu(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Qd(e,t,n){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:bu(r,t,n))}function Lp(e,t,n){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:bu(r,t,n))}function Pte(e,t,n){return e.filter(r=>!bu(r,t,n))}function QI(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Mte(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Xr(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 QI(e)}function to(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?QI(e.value):QI(e)}function sEe(e,t,n){if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??Xr(e,n);if(Array.isArray(t)){const r=Mte(t)?t.flatMap(i=>i.items):t;if(e==null){const i=r.find(a=>a.value==null);return i&&i.label!=null?i.label:Xr(e,n)}if(typeof e!="object"){const i=r.find(a=>a&&a.value===e);return i&&i.label!=null?i.label:Xr(e,n)}if("value"in e){const i=r.find(a=>a&&a.value===e.value);if(i&&i.label!=null)return i.label}}return Xr(e,n)}function oEe(e,t){return!Array.isArray(e)||e.length===0?"":e.map(n=>Xr(n,t)).join(", ")}const Wt={id:Be(e=>e.id),modal:Be(e=>e.modal),multiple:Be(e=>e.multiple),items:Be(e=>e.items),itemToStringLabel:Be(e=>e.itemToStringLabel),itemToStringValue:Be(e=>e.itemToStringValue),isItemEqualToValue:Be(e=>e.isItemEqualToValue),value:Be(e=>e.value),open:Be(e=>e.open),mounted:Be(e=>e.mounted),forceMount:Be(e=>e.forceMount),transitionStatus:Be(e=>e.transitionStatus),openMethod:Be(e=>e.openMethod),activeIndex:Be(e=>e.activeIndex),selectedIndex:Be(e=>e.selectedIndex),isActive:Be((e,t)=>e.activeIndex===t),isSelected:Be((e,t,n)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(a=>bu(a,n,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:bu(i,n,r)}),isSelectedByFocus:Be((e,t)=>e.selectedIndex===t),popupProps:Be(e=>e.popupProps),triggerProps:Be(e=>e.triggerProps),triggerElement:Be(e=>e.triggerElement),positionerElement:Be(e=>e.positionerElement),listElement:Be(e=>e.listElement),scrollUpArrowVisible:Be(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Be(e=>e.scrollDownArrowVisible),hasScrollArrows:Be(e=>e.hasScrollArrows),serializedValue:Be(e=>{const{multiple:t,value:n,itemToStringValue:r}=e;return t&&Array.isArray(n)&&n.length===0?"":to(n,r)})};function Jd(e,t){const n=k.useRef(e),r=Xe(t);Je(()=>{n.current!==e&&r(n.current)},[e,r]),Je(()=>{n.current=e},[e])}function lEe(e){const{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:s=!1,onOpenChange:o,name:l,disabled:u=!1,readOnly:f=!1,required:d=!1,modal:p=!0,actionsRef:m,inputRef:y,onOpenChangeComplete:S,items:g,multiple:_=!1,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T=Lte,highlightItemOnHover:w=!0,children:C}=e,{clearErrors:R}=Hy(),{setDirty:O,shouldValidateOnChange:N,validityData:L,setFilled:D,name:z,disabled:M,validation:V}=Fs(),{controlId:W}=td(),$=Zx({id:t}),q=M||u,Y=z??l,[B,j]=Ja({controlled:n,default:_?r??ea:r,name:"Select",state:"value"}),[U,K]=Ja({controlled:a,default:s,name:"Select",state:"open"}),H=k.useRef([]),J=k.useRef([]),se=k.useRef(null),ae=k.useRef(null),Q=k.useRef(0),G=k.useRef(null),Z=k.useRef([]),ee=k.useRef(!1),ne=k.useRef(!1),te=k.useRef(null),be=k.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),_e=k.useRef(!1),{mounted:he,setMounted:ye,transitionStatus:Ee}=Co(U),{openMethod:xe,triggerProps:ve,reset:De}=Xx(U),Te=di(()=>new hf({id:$,modal:p,multiple:_,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T,value:B,open:U,mounted:he,transitionStatus:Ee,items:g,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,pe=Ye(Te,Wt.activeIndex),ce=Ye(Te,Wt.selectedIndex),Re=Ye(Te,Wt.triggerElement),Pe=Ye(Te,Wt.positionerElement),ge=k.useMemo(()=>_&&Array.isArray(B)&&B.length===0?"":to(B,x),[_,B,x]),Le=k.useMemo(()=>_&&Array.isArray(B)?B.map(yt=>to(yt,x)):to(B,x),[_,B,x]),Ce=lr(Te.state.triggerElement);Wy({id:$,commit:V.commit,value:B,controlRef:Ce,name:Y,getValue:()=>Le});const Ve=k.useRef(B);Je(()=>{B!==Ve.current&&Te.set("forceMount",!0)},[Te,B]),Je(()=>{D(B!==null)},[B,D]),Je(function(){if(U)return;const Bt=Z.current;if(_){const zt=Array.isArray(B)?B:[];if(zt.length===0){Te.set("selectedIndex",null);return}const ft=zt[zt.length-1],yn=Lp(Bt,ft,T);Te.set("selectedIndex",yn===-1?null:yn);return}const Ut=Lp(Bt,B,T);Te.set("selectedIndex",Ut===-1?null:Ut)},[_,U,B,Z,T,Te]),Jd(B,()=>{R(Y),O(B!==L.initialValue),N()?V.commit(B):V.commit(B,!0)});const Ze=Xe((yt,Bt)=>{if(o?.(yt,Bt),!Bt.isCanceled&&(K(yt),!yt&&Te.state.activeIndex!==null)){const Ut=H.current[Te.state.activeIndex];queueMicrotask(()=>{Ut?.setAttribute("tabindex","-1")})}}),gt=Xe(()=>{ye(!1),Te.set("activeIndex",null),De(),S?.(!1)});Ai({enabled:!m,open:U,ref:se,onComplete(){U||gt()}}),k.useImperativeHandle(m,()=>({unmount:gt}),[gt]);const st=Xe((yt,Bt)=>{i?.(yt,Bt),!Bt.isCanceled&&j(yt)}),ot=Xe(()=>{const yt=Te.state.listElement||se.current;if(!yt)return;const Bt=yt.scrollTop,Ut=yt.scrollTop+yt.clientHeight,zt=Bt>1,ft=Ut<yt.scrollHeight-1;Te.state.scrollUpArrowVisible!==zt&&Te.set("scrollUpArrowVisible",zt),Te.state.scrollDownArrowVisible!==ft&&Te.set("scrollDownArrowVisible",ft)}),Fe=Bx({open:U,onOpenChange:Ze,elements:{reference:Re,floating:Pe}}),ht=Tm(Fe,{enabled:!f&&!q,event:"mousedown"}),Ne=Cm(Fe,{bubbles:!1}),ze=iM(Fe,{enabled:!f&&!q,listRef:H,activeIndex:pe,selectedIndex:ce,disabledIndices:ea,onNavigate(yt){yt===null&&!U||Te.set("activeIndex",yt)},focusItemOnHover:!1}),et=aM(Fe,{enabled:!f&&!q&&(U||!_),listRef:J,activeIndex:pe,selectedIndex:ce,onMatch(yt){U?Te.set("activeIndex",yt):st(Z.current[yt],it("none"))},onTypingChange(yt){ee.current=yt}}),{getReferenceProps:lt,getFloatingProps:pt,getItemProps:gn}=Qc([ht,Ne,ze,et]),Ft=k.useMemo(()=>sl(lt(),ve),[lt,ve]);Rte(()=>{Te.update({popupProps:pt(),triggerProps:Ft})}),Je(()=>{Te.update({id:$,modal:p,multiple:_,value:B,open:U,mounted:he,transitionStatus:Ee,popupProps:pt(),triggerProps:Ft,items:g,itemToStringLabel:v,itemToStringValue:x,isItemEqualToValue:T,openMethod:xe})},[Te,$,p,_,B,U,he,Ee,pt,Ft,g,v,x,T,xe]);const Nt=k.useMemo(()=>({store:Te,name:Y,required:d,disabled:q,readOnly:f,multiple:_,itemToStringLabel:v,itemToStringValue:x,highlightItemOnHover:w,setValue:st,setOpen:Ze,listRef:H,popupRef:se,scrollHandlerRef:ae,handleScrollArrowVisibility:ot,scrollArrowsMountedCountRef:Q,getItemProps:gn,events:Fe.context.events,valueRef:G,valuesRef:Z,labelsRef:J,typingRef:ee,selectionRef:be,selectedItemTextRef:te,validation:V,onOpenChangeComplete:S,keyboardActiveRef:ne,alignItemWithTriggerActiveRef:_e,initialValueRef:Ve}),[Te,Y,d,q,f,_,v,x,w,st,Ze,gn,Fe.context.events,V,S,ot]),ct=js(y,V.inputRef),nn=_&&Array.isArray(B)&&B.length>0,Lt=k.useMemo(()=>!_||!Array.isArray(B)||!Y?null:B.map(yt=>{const Bt=to(yt,x);return b.jsx("input",{type:"hidden",name:Y,value:Bt},Bt)}),[_,B,Y,x]);return b.jsx(Nte.Provider,{value:Nt,children:b.jsxs(Ite.Provider,{value:Fe,children:[C,b.jsx("input",{...V.getInputValidationProps({onFocus(){Te.state.triggerElement?.focus()},onChange(yt){if(yt.nativeEvent.defaultPrevented)return;const Bt=yt.target.value,Ut=it(Dr,yt.nativeEvent);function zt(){if(_)return;const ft=Z.current.find(yn=>to(yn,x).toLowerCase()===Bt.toLowerCase());ft!=null&&(O(ft!==L.initialValue),st(ft,Ut),N()&&V.commit(ft))}Te.set("forceMount",!0),queueMicrotask(zt)}}),id:t||W||void 0,name:_?void 0:Y,value:ge,disabled:q,required:d&&!nn,readOnly:f,ref:ct,style:wm,tabIndex:-1,"aria-hidden":!0}),Lt]})})}function vM(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),r=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||r.content!=="none"))return t;const a=parseFloat(n.width)||0,s=parseFloat(n.height)||0,o=parseFloat(r.width)||0,l=parseFloat(r.height)||0,u=Math.max(t.width,a,o),f=Math.max(t.height,s,l),d=u-t.width,p=f-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-p/2,bottom:t.bottom+p/2}}const h_=2,uEe={...Ip,...Wf,value:()=>null},cEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,...o}=t,{setTouched:l,setFocused:u,validationMode:f,state:d,disabled:p}=Fs(),{labelId:m}=td(),{store:y,setOpen:S,selectionRef:g,validation:_,readOnly:v,alignItemWithTriggerActiveRef:x,disabled:T,keyboardActiveRef:w}=pl(),C=p||T||a,R=Ye(y,Wt.open),O=Ye(y,Wt.value),N=Ye(y,Wt.triggerProps),L=Ye(y,Wt.positionerElement),D=Ye(y,Wt.listElement),z=Ye(y,Wt.serializedValue),M=lr(L),V=k.useRef(null),W=Pn(),$=Pn(),{getButtonProps:q,buttonRef:Y}=aa({disabled:C,native:s}),B=Xe(ae=>{y.set("triggerElement",ae)}),j=js(n,V,Y,B),U=Pn(),K=Pn();k.useEffect(()=>{if(R)return K.start(200,()=>{g.current.allowUnselectedMouseUp=!0,U.start(200,()=>{g.current.allowSelectedMouseUp=!0})}),()=>{U.clear(),K.clear()};g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},$.clear()},[R,g,$,U,K]);const H=k.useMemo(()=>D?.id??mv(L)?.id,[D,L]),J=sl(N,{role:"combobox","aria-expanded":R?"true":"false","aria-haspopup":"listbox","aria-controls":R?H:void 0,"aria-labelledby":m,"aria-readonly":v||void 0,tabIndex:C?-1:0,ref:j,onFocus(ae){u(!0),R&&x.current&&S(!1,it(ho,ae.nativeEvent)),W.start(0,()=>{y.set("forceMount",!0)})},onBlur(){l(!0),u(!1),f==="onBlur"&&_.commit(O)},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(ae){if(R)return;const Q=Ci(ae.currentTarget);function G(Z){if(!V.current)return;const ee=Z.target;if(Tt(V.current,ee)||Tt(M.current,ee)||ee===V.current)return;const ne=vM(V.current);Z.clientX>=ne.left-h_&&Z.clientX<=ne.right+h_&&Z.clientY>=ne.top-h_&&Z.clientY<=ne.bottom+h_||S(!1,it(gee,Z))}$.start(0,()=>{Q.addEventListener("mouseup",G,{once:!0})})}},_.getValidationProps,o,q);J.role="combobox";const se=k.useMemo(()=>({...d,open:R,disabled:C,value:O,readOnly:v,placeholder:!z}),[d,R,C,O,v,z]);return xt("button",t,{ref:[n,V],state:se,stateAttributesMapping:uEe,props:J})}),dEe={value:()=>null},fEe=k.forwardRef(function(t,n){const{className:r,render:i,children:a,...s}=t,{store:o,valueRef:l}=pl(),u=Ye(o,Wt.value),f=Ye(o,Wt.items),d=Ye(o,Wt.itemToStringLabel),p=Ye(o,Wt.serializedValue),m=k.useMemo(()=>({value:u,placeholder:!p}),[u,p]),y=typeof a=="function"?a(u):a??(Array.isArray(u)?oEe(u,d):sEe(u,f,d));return xt("span",t,{state:m,ref:[n,l],props:[{children:y},s],stateAttributesMapping:dEe})}),hEe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s}=pl(),o=Ye(s,Wt.open),l=k.useMemo(()=>({open:o}),[o]);return xt("span",t,{state:l,ref:n,props:[{"aria-hidden":!0,children:"▼"},a],stateAttributesMapping:Hx})}),pEe=k.createContext(void 0),mEe=k.forwardRef(function(t,n){const{store:r}=pl(),i=Ye(r,Wt.mounted),a=Ye(r,Wt.forceMount);return i||a?b.jsx(pEe.Provider,{value:!0,children:b.jsx(Ly,{ref:n,...t})}):null}),jte=k.createContext(void 0);function yM(){const e=k.useContext(jte);if(!e)throw new Error(rn(59));return e}function qE(e,t){e&&Object.assign(e.style,t)}const Fte={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},gEe={position:"fixed"},bEe=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p,arrowPadding:m=5,sticky:y=!1,disableAnchorTracking:S,alignItemWithTrigger:g=!0,collisionAvoidance:_=Ix,...v}=t,{store:x,listRef:T,labelsRef:w,alignItemWithTriggerActiveRef:C,selectedItemTextRef:R,valuesRef:O,initialValueRef:N,popupRef:L,setValue:D}=pl(),z=Dte(),M=Ye(x,Wt.open),V=Ye(x,Wt.mounted),W=Ye(x,Wt.modal),$=Ye(x,Wt.value),q=Ye(x,Wt.openMethod),Y=Ye(x,Wt.positionerElement),B=Ye(x,Wt.triggerElement),j=Ye(x,Wt.isItemEqualToValue),U=k.useRef(null),K=k.useRef(null),[H,J]=k.useState(g),se=V&&H&&q!=="touch";!V&&H!==g&&J(g),Je(()=>{V||(Wt.scrollUpArrowVisible(x.state)&&x.set("scrollUpArrowVisible",!1),Wt.scrollDownArrowVisible(x.state)&&x.set("scrollDownArrowVisible",!1))},[x,V]),k.useImperativeHandle(C,()=>se),Yx((se||W)&&M&&q!=="touch",B);const ae=By({anchor:r,floatingRootContext:z,positionMethod:i,mounted:V,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:y,disableAnchorTracking:S??se,collisionAvoidance:_,keepMounted:!0}),Q=se?"none":ae.side,G=se?gEe:ae.positionerStyles,Z=k.useMemo(()=>{const ye={};return M||(ye.pointerEvents="none"),{role:"presentation",hidden:!V,style:{...G,...ye}}},[M,V,G]),ee=k.useMemo(()=>({open:M,side:Q,align:ae.align,anchorHidden:ae.anchorHidden}),[M,Q,ae.align,ae.anchorHidden]),ne=Xe(ye=>{x.set("positionerElement",ye)}),te=xt("div",t,{ref:[n,ne],state:ee,stateAttributesMapping:ka,props:[Z,v]}),be=k.useRef(0),_e=Xe(ye=>{if(ye.size===0&&be.current===0||O.current.length===0)return;const Ee=be.current;if(be.current=ye.size,ye.size===Ee)return;const xe=it(Dr);if(Ee!==0&&!x.state.multiple&&$!==null&&Lp(O.current,$,j)===-1){const De=N.current,pe=De!=null&&Qd(O.current,De,j)?De:null;D(pe,xe),pe===null&&(x.set("selectedIndex",null),R.current=null)}if(Ee!==0&&x.state.multiple&&Array.isArray($)){const ve=$.filter(De=>Qd(O.current,De,j));(ve.length!==$.length||ve.some(De=>!Qd($,De,j)))&&(D(ve,xe),ve.length===0&&(x.set("selectedIndex",null),R.current=null))}if(M&&se){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ve={height:""};qE(Y,ve),qE(L.current,ve)}}),he=k.useMemo(()=>({...ae,side:Q,alignItemWithTriggerActive:se,setControlledAlignItemWithTrigger:J,scrollUpArrowRef:U,scrollDownArrowRef:K}),[ae,Q,se,J]);return b.jsx(My,{elementsRef:T,labelsRef:w,onMapChange:_e,children:b.jsxs(jte.Provider,{value:he,children:[V&&W&&b.jsx(Kx,{inert:Am(!M),cutout:B}),te]})})});function Bte(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 p_="base-ui-disable-scrollbar",Sv={className:p_,element:b.jsx("style",{href:p_,precedence:"base-ui:low",children:`.${p_}{scrollbar-width:none}.${p_}::-webkit-scrollbar{display:none}`})},vEe=k.createContext(void 0);function _M(e){return k.useContext(vEe)}const yEe={...ka,...is},_Ee=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{store:s,popupRef:o,onOpenChangeComplete:l,setOpen:u,valueRef:f,selectedItemTextRef:d,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:y,scrollHandlerRef:S}=pl(),{side:g,align:_,alignItemWithTriggerActive:v,setControlledAlignItemWithTrigger:x,scrollDownArrowRef:T,scrollUpArrowRef:w}=yM(),C=_M()!=null,R=Dte(),O=Pn(),N=Ye(s,Wt.id),L=Ye(s,Wt.open),D=Ye(s,Wt.mounted),z=Ye(s,Wt.popupProps),M=Ye(s,Wt.transitionStatus),V=Ye(s,Wt.triggerElement),W=Ye(s,Wt.positionerElement),$=Ye(s,Wt.listElement),q=k.useRef(0),Y=k.useRef(!1),B=k.useRef(0),j=k.useRef(!1),U=k.useRef({}),K=au(),H=Xe(Q=>{if(!W||!o.current||!j.current)return;if(Y.current||!v){y();return}const G=W.style.top==="0px",Z=W.style.bottom==="0px",ee=W.getBoundingClientRect().height,ne=Ci(W),te=getComputedStyle(W),be=parseFloat(te.marginTop),_e=parseFloat(te.marginBottom),he=ne.documentElement.clientHeight-be-_e,ye=Q.scrollTop,Ee=Q.scrollHeight,xe=Q.clientHeight,ve=Ee-xe;let De=null,Te=null,pe=!1;if(G){const ce=ve-ye,Re=ee+ce,Pe=Math.min(Re,he);De=Pe,Pe!==he?Te=ve:pe=!0}else if(Z){const ce=ye-0,Re=ee+ce,Pe=Math.min(Re,he),ge=Re-he;De=Pe,Pe!==he?Te=0:(pe=!0,ye<ve&&(Te=ye-(ce-ge)))}De!=null&&(W.style.height=`${De}px`),Te!=null&&(Q.scrollTop=Te),pe&&(Y.current=!0),y()});k.useImperativeHandle(S,()=>H,[H]),Ai({open:L,ref:o,onComplete(){L&&l?.(!0)}});const J=k.useMemo(()=>({open:L,transitionStatus:M,side:g,align:_}),[L,M,g,_]);Je(()=>{!W||!o.current||Object.keys(U.current).length||(U.current={top:W.style.top||"0",left:W.style.left||"0",right:W.style.right,height:W.style.height,bottom:W.style.bottom,minHeight:W.style.minHeight,maxHeight:W.style.maxHeight,marginTop:W.style.marginTop,marginBottom:W.style.marginBottom})},[o,W]),Je(()=>{D||v||(j.current=!1,Y.current=!1,q.current=0,B.current=0,qE(W,U.current))},[D,v,W,o]),Je(()=>{const Q=o.current;if(!(!D||!V||!W||!Q)){if(!v){j.current=!0,K.request(y);return}queueMicrotask(()=>{const G=getComputedStyle(W),Z=getComputedStyle(Q),ee=Ci(V),ne=Er(W),te=V.getBoundingClientRect(),be=W.getBoundingClientRect(),_e=te.left,he=te.height,ye=$||Q,Ee=ye.scrollHeight,xe=parseFloat(Z.borderBottomWidth),ve=parseFloat(G.marginTop)||10,De=parseFloat(G.marginBottom)||10,Te=parseFloat(G.minHeight)||100,pe=5,ce=5,Re=20,Pe=ee.documentElement.clientHeight-ve-De,ge=ee.documentElement.clientWidth,Le=Pe-te.bottom+he,Ce=d.current,Ve=f.current;let Ze=0,gt=0;if(Ce&&Ve){const Nt=Ve.getBoundingClientRect(),ct=Ce.getBoundingClientRect(),nn=Nt.left-_e,Lt=ct.left-be.left,yt=Nt.top-te.top+Nt.height/2,Bt=ct.top-be.top+ct.height/2;Ze=nn-Lt,gt=Bt-yt}const st=Le+gt+De+xe;let ot=Math.min(Pe,st);const Fe=Pe-ve-De,ht=st-ot,Ne=Math.max(pe,_e+Ze),ze=ge-ce,et=Math.max(0,Ne+be.width-ze);W.style.left=`${Ne-et}px`,W.style.height=`${ot}px`,W.style.maxHeight="auto",W.style.marginTop=`${ve}px`,W.style.marginBottom=`${De}px`,Q.style.height="100%";const lt=ye.scrollHeight-ye.clientHeight,pt=ht>=lt;pt&&(ot=Math.min(Pe,be.height)-(ht-lt));const gn=te.top<Re||te.bottom>Pe-Re||ot<Math.min(Ee,Te),Ft=(ne.visualViewport?.scale??1)!==1&&jP;if(gn||Ft){j.current=!0,qE(W,U.current),xr.flushSync(()=>x(!1));return}if(pt){const Nt=Math.max(0,Pe-st);W.style.top=be.height>=Fe?"0":`${Nt}px`,W.style.height=`${ot}px`,ye.scrollTop=ye.scrollHeight-ye.clientHeight,q.current=Math.max(Te,ot)}else W.style.bottom="0",q.current=Math.max(Te,ot),ye.scrollTop=ht;q.current===Pe&&(Y.current=!0),y(),setTimeout(()=>{j.current=!0})})}},[s,D,W,V,f,d,o,y,v,x,K,T,w,$]),k.useEffect(()=>{if(!v||!W||!D)return;const Q=Er(W);function G(Z){u(!1,it(Vve,Z))}return Q.addEventListener("resize",G),()=>{Q.removeEventListener("resize",G)}},[u,v,W,D]);const se={...$?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(Q){p.current=!0,C&&oM.has(Q.key)&&Q.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(Q){if(Bte(Q)||Q.pointerType==="touch")return;const G=Q.currentTarget;O.start(0,()=>{s.set("activeIndex",null),G.focus({preventScroll:!0})})},onScroll(Q){$||S.current?.(Q.currentTarget)},...v&&{style:$?{height:"100%"}:Fte}},ae=xt("div",t,{ref:[n,o],state:J,stateAttributesMapping:yEe,props:[z,se,Om(M),{className:!$&&v?Sv.className:void 0},a]});return b.jsxs(k.Fragment,{children:[Sv.element,b.jsx(Px,{context:R,modal:!1,disabled:!D,restoreFocus:!0,children:ae})]})}),EEe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,{store:s,scrollHandlerRef:o}=pl(),{alignItemWithTriggerActive:l}=yM(),u=Ye(s,Wt.hasScrollArrows),f=Ye(s,Wt.openMethod),d=Ye(s,Wt.multiple),m={id:`${Ye(s,Wt.id)}-list`,role:"listbox","aria-multiselectable":d||void 0,onScroll(S){o.current?.(S.currentTarget)},...l&&{style:Fte},className:u&&f!=="touch"?Sv.className:void 0},y=Xe(S=>{s.set("listElement",S)});return xt("div",t,{ref:[n,y],props:[m,a]})}),Ute=k.createContext(void 0);function EM(){const e=k.useContext(Ute);if(!e)throw new Error(rn(57));return e}const SEe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,label:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(null),d=km({label:s,textRef:f,indexGuessBehavior:lM.GuessFromOrder}),{store:p,getItemProps:m,setOpen:y,setValue:S,selectionRef:g,typingRef:_,valuesRef:v,keyboardActiveRef:x,multiple:T,highlightItemOnHover:w}=pl(),C=Pn(),R=Ye(p,Wt.isActive,d.index),O=Ye(p,Wt.isSelected,d.index,a),N=Ye(p,Wt.isSelectedByFocus,d.index),L=Ye(p,Wt.isItemEqualToValue),D=d.index,z=D!==-1,M=k.useRef(null),V=lr(D);Je(()=>{if(!z)return;const ae=v.current;return ae[D]=a,()=>{delete ae[D]}},[z,D,a,v]),Je(()=>{if(!z)return;const ae=p.state.value;let Q=ae;T&&Array.isArray(ae)&&ae.length>0&&(Q=ae[ae.length-1]),Q!==void 0&&bu(Q,a,L)&&p.set("selectedIndex",D)},[z,D,T,L,p,a]);const W=k.useMemo(()=>({disabled:o,selected:O,highlighted:R}),[o,O,R]),$=m({active:R,selected:O});$.onFocus=void 0,$.id=void 0;const q=k.useRef(null),Y=k.useRef("mouse"),B=k.useRef(!1),{getButtonProps:j,buttonRef:U}=aa({disabled:o,focusableWhenDisabled:!0,native:l});function K(ae){const Q=p.state.value;if(T){const G=Array.isArray(Q)?Q:[],Z=O?Pte(G,a,L):[...G,a];S(Z,it(df,ae))}else S(a,it(df,ae)),y(!1,it(df,ae))}const H={role:"option","aria-selected":O,"aria-disabled":o||void 0,tabIndex:R?0:-1,onFocus(){p.set("activeIndex",D)},onMouseEnter(){!x.current&&p.state.selectedIndex===null&&p.set("activeIndex",D)},onMouseMove(){w&&p.set("activeIndex",D)},onMouseLeave(ae){!w||x.current||Bte(ae)||C.start(0,()=>{p.state.activeIndex===D&&p.set("activeIndex",null)})},onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(ae){q.current=ae.key,p.set("activeIndex",D)},onClick(ae){B.current=!1,!(ae.type==="keydown"&&q.current===null)&&(o||q.current===" "&&_.current||Y.current!=="touch"&&!R||(q.current=null,K(ae.nativeEvent)))},onPointerEnter(ae){Y.current=ae.pointerType},onPointerDown(ae){Y.current=ae.pointerType,B.current=!0},onMouseUp(ae){if(o)return;if(B.current){B.current=!1;return}const Q=!g.current.allowSelectedMouseUp&&O,G=!g.current.allowUnselectedMouseUp&&!O;Q||G||Y.current!=="touch"&&!R||K(ae.nativeEvent)}},J=xt("div",t,{ref:[U,n,d.ref,M],state:W,props:[$,H,u,j]}),se=k.useMemo(()=>({selected:O,indexRef:V,textRef:f,selectedByFocus:N,hasRegistered:z}),[O,V,f,N,z]);return b.jsx(Ute.Provider,{value:se,children:J})})),xEe=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=EM();return r||i?b.jsx(wEe,{...t,ref:n}):null}),wEe=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=EM(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=Co(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=xt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:is});return Ai({open:s,ref:o,onComplete(){s||u(!1)}}),d})),TEe=k.memo(k.forwardRef(function(t,n){const{indexRef:r,textRef:i,selectedByFocus:a,hasRegistered:s}=EM(),{selectedItemTextRef:o}=pl(),{className:l,render:u,...f}=t,d=k.useCallback(m=>{if(!m||!s)return;const y=o.current===null||!o.current.isConnected;(a||y&&r.current===0)&&(o.current=m)},[o,r,a,s]);return xt("div",t,{ref:[d,n,i],props:f})})),$te=k.forwardRef(function(t,n){const{render:r,className:i,direction:a,keepMounted:s=!1,...o}=t,{store:l,popupRef:u,listRef:f,handleScrollArrowVisibility:d,scrollArrowsMountedCountRef:p}=pl(),{side:m,scrollDownArrowRef:y,scrollUpArrowRef:S}=yM(),g=a==="up"?Wt.scrollUpArrowVisible:Wt.scrollDownArrowVisible,_=Ye(l,g),v=Ye(l,Wt.openMethod),x=_&&v!=="touch",T=Pn(),w=a==="up"?S:y,{transitionStatus:C,setMounted:R}=Co(x);Je(()=>(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]),Ai({open:x,ref:w,onComplete(){x||R(!1)}});const O=k.useMemo(()=>({direction:a,visible:x,side:m,transitionStatus:C}),[a,x,m,C]),L=xt("div",t,{ref:[n,w],state:O,props:[{"aria-hidden":!0,children:a==="up"?"▲":"▼",style:{position:"absolute"},onMouseMove(z){if(z.movementX===0&&z.movementY===0||T.isStarted())return;l.set("activeIndex",null);function M(){const V=l.state.listElement??u.current;if(!V)return;l.set("activeIndex",null),d();const W=V.scrollTop===0,$=Math.round(V.scrollTop+V.clientHeight)>=V.scrollHeight;if(f.current.length===0&&(a==="up"?l.set("scrollUpArrowVisible",!W):l.set("scrollDownArrowVisible",!$)),a==="up"&&W||a==="down"&&$){T.clear();return}if((l.state.listElement||u.current)&&f.current&&f.current.length>0){const Y=f.current,B=w.current?.offsetHeight||0;if(a==="up"){let j=0;const U=V.scrollTop+B;for(let H=0;H<Y.length;H+=1){const J=Y[H];if(J&&J.offsetTop>=U){j=H;break}}const K=Math.max(0,j-1);if(K<j){const H=Y[K];H&&(V.scrollTop=Math.max(0,H.offsetTop-B))}else V.scrollTop=0}else{let j=Y.length-1;const U=V.scrollTop+V.clientHeight-B;for(let H=0;H<Y.length;H+=1){const J=Y[H];if(J&&J.offsetTop+J.offsetHeight>U){j=Math.max(0,H-1);break}}const K=Math.min(Y.length-1,j+1);if(K>j){const H=Y[K];H&&(V.scrollTop=H.offsetTop+H.offsetHeight-V.clientHeight+B)}else V.scrollTop=V.scrollHeight-V.clientHeight}}T.start(40,M)}T.start(40,M)},onMouseLeave(){T.clear()}},o]});return x||s?L:null}),CEe=k.forwardRef(function(t,n){return b.jsx($te,{...t,ref:n,direction:"down"})}),AEe=k.forwardRef(function(t,n){return b.jsx($te,{...t,ref:n,direction:"up"})}),ji=lEe;function Fi({className:e,...t}){return b.jsx(fEe,{"data-slot":"select-value",className:Ue("flex flex-1 text-left",e),...t})}function Bi({className:e,size:t="default",children:n,...r}){return b.jsxs(cEe,{"data-slot":"select-trigger","data-size":t,className:Ue("border-input data-[placeholder]:text-muted-foreground bg-input/20 dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/30 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-md border px-2 py-1.5 text-xs/relaxed transition-colors focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-7 data-[size=sm]:h-6 *:data-[slot=select-value]:flex *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-3.5 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r,children:[n,b.jsx(hEe,{render:b.jsx(fe,{icon:dte,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})})]})}function Ui({className:e,children:t,side:n="bottom",sideOffset:r=4,align:i="center",alignOffset:a=0,alignItemWithTrigger:s=!0,...o}){return b.jsx(mEe,{children:b.jsx(bEe,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:s,className:"isolate z-50",children:b.jsxs(_Ee,{"data-slot":"select-content",className:Ue("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 min-w-32 rounded-lg shadow-md ring-1 duration-100 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto",e),...o,children:[b.jsx(kEe,{}),b.jsx(EEe,{children:t}),b.jsx(OEe,{})]})})})}function Cn({className:e,children:t,...n}){return b.jsxs(SEe,{"data-slot":"select-item",className:Ue("focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[b.jsx(TEe,{className:"flex flex-1 gap-2 shrink-0 whitespace-nowrap",children:t}),b.jsx(xEe,{render:b.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:b.jsx(fe,{icon:hl,strokeWidth:2,className:"pointer-events-none"})})]})}function kEe({className:e,...t}){return b.jsx(AEe,{"data-slot":"select-scroll-up-button",className:Ue("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:b.jsx(fe,{icon:dM,strokeWidth:2})})}function OEe({className:e,...t}){return b.jsx(CEe,{"data-slot":"select-scroll-down-button",className:Ue("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:b.jsx(fe,{icon:Uy,strokeWidth:2})})}const zte=k.createContext(void 0);function SM(){const e=k.useContext(zte);if(e===void 0)throw new Error(rn(64));return e}let REe=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const xM={tabActivationDirection:e=>({[REe.activationDirection]:e})},NEe=k.forwardRef(function(t,n){const{className:r,defaultValue:i=0,onValueChange:a,orientation:s="horizontal",render:o,value:l,...u}=t,f=Cu(),d=Object.hasOwn(t,"defaultValue"),p=k.useRef([]),[m,y]=k.useState(()=>new Map),[S,g]=Ja({controlled:l,default:i,name:"Tabs",state:"value"}),_=l!==void 0,[v,x]=k.useState(()=>new Map),[T,w]=k.useState("none"),C=Xe((q,Y)=>{a?.(q,Y),!Y.isCanceled&&(g(q),w(Y.activationDirection))}),R=Xe((q,Y)=>{y(B=>{if(B.get(q)===Y)return B;const j=new Map(B);return j.set(q,Y),j})}),O=Xe((q,Y)=>{y(B=>{if(!B.has(q)||B.get(q)!==Y)return B;const j=new Map(B);return j.delete(q),j})}),N=k.useCallback(q=>m.get(q),[m]),L=k.useCallback(q=>{for(const Y of v.values())if(q===Y?.value)return Y?.id},[v]),D=k.useCallback(q=>{if(q===void 0)return null;for(const[Y,B]of v.entries())if(B!=null&&q===(B.value??B.index))return Y;return null},[v]),z=k.useMemo(()=>({direction:f,getTabElementBySelectedValue:D,getTabIdByPanelValue:L,getTabPanelIdByValue:N,onValueChange:C,orientation:s,registerMountedTabPanel:R,setTabMap:x,unregisterMountedTabPanel:O,tabActivationDirection:T,value:S}),[f,D,L,N,C,s,R,x,O,T,S]),M=k.useMemo(()=>{for(const q of v.values())if(q!=null&&q.value===S)return q},[v,S]),V=k.useMemo(()=>{for(const q of v.values())if(q!=null&&!q.disabled)return q.value},[v]);Je(()=>{if(_||v.size===0)return;const q=M?.disabled,Y=M==null&&S!==null;if(d&&q&&S===i||!q&&!Y)return;const j=V??null;S!==j&&(g(j),w("none"))},[i,V,d,_,M,w,g,v,S]);const $=xt("div",t,{state:{orientation:s,tabActivationDirection:T},ref:n,props:u,stateAttributesMapping:xM});return b.jsx(zte.Provider,{value:z,children:b.jsx(My,{elementsRef:p,children:$})})}),Hte=k.createContext(void 0);function IEe(){const e=k.useContext(Hte);if(e===void 0)throw new Error(rn(65));return e}const DEe=k.forwardRef(function(t,n){const{className:r,disabled:i=!1,render:a,value:s,id:o,nativeButton:l=!0,...u}=t,{value:f,getTabPanelIdByValue:d,orientation:p}=SM(),{activateOnFocus:m,highlightedTabIndex:y,onTabActivation:S,setHighlightedTabIndex:g,tabsListElement:_}=IEe(),v=fi(o),x=k.useMemo(()=>({disabled:i,id:v,value:s}),[i,v,s]),{compositeProps:T,compositeRef:w,index:C}=Kee({metadata:x}),R=s===f,O=k.useRef(!1);Je(()=>{if(O.current){O.current=!1;return}if(!(R&&C>-1&&y!==C))return;const B=_;if(B!=null){const j=Cs(Ci(B));if(j&&Tt(B,j))return}i||g(C)},[R,C,y,g,i,_]);const{getButtonProps:N,buttonRef:L}=aa({disabled:i,native:l,focusableWhenDisabled:!0}),D=d(s),z=k.useRef(!1),M=k.useRef(!1);function V(B){R||i||S(s,it(Dr,B.nativeEvent,void 0,{activationDirection:"none"}))}function W(B){R||(C>-1&&!i&&g(C),!i&&m&&(!z.current||z.current&&M.current)&&S(s,it(Dr,B.nativeEvent,void 0,{activationDirection:"none"})))}function $(B){if(R||i)return;z.current=!0;function j(){z.current=!1,M.current=!1}(!B.button||B.button===0)&&(M.current=!0,Ci(B.currentTarget).addEventListener("pointerup",j,{once:!0}))}const q=k.useMemo(()=>({disabled:i,active:R,orientation:p}),[i,R,p]);return xt("button",t,{state:q,ref:[n,L,w],props:[T,{role:"tab","aria-controls":D,"aria-selected":R,id:v,onClick:V,onFocus:W,onPointerDown:$,[Hee]:R?"":void 0,onKeyDownCapture(){O.current=!0}},u,N]})});let LEe=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const PEe=k.forwardRef(function(t,n){const{className:r,value:i,render:a,keepMounted:s=!1,...o}=t,{value:l,getTabIdByPanelValue:u,orientation:f,tabActivationDirection:d,registerMountedTabPanel:p,unregisterMountedTabPanel:m}=SM(),y=fi(),S=k.useMemo(()=>({id:y,value:i}),[y,i]),{ref:g,index:_}=km({metadata:S}),v=i!==l,x=u(i),T=k.useMemo(()=>({hidden:v,orientation:f,tabActivationDirection:d}),[v,f,d]),w=xt("div",t,{state:T,ref:[n,g],props:[{"aria-labelledby":x,hidden:v,id:y??void 0,role:"tabpanel",tabIndex:v?-1:0,[LEe.index]:_},o],stateAttributesMapping:xM});return Je(()=>{if(!(v&&!s)&&y!=null)return p(i,y),()=>{m(i,y)}},[v,s,i,y,p,m]),!v||s?w:null}),MEe=k.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:i,loopFocus:a=!0,render:s,...o}=t,{getTabElementBySelectedValue:l,onValueChange:u,orientation:f,value:d,setTabMap:p,tabActivationDirection:m}=SM(),[y,S]=k.useState(0),[g,_]=k.useState(null),v=jEe(d,f,g,l),x=Xe((R,O)=>{if(R!==d){const N=v(R);O.activationDirection=N,u(R,O)}}),T=k.useMemo(()=>({orientation:f,tabActivationDirection:m}),[f,m]),w={"aria-orientation":f==="vertical"?"vertical":void 0,role:"tablist"},C=k.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:y,onTabActivation:x,setHighlightedTabIndex:S,tabsListElement:g,value:d}),[r,y,x,S,g,d]);return b.jsx(Hte.Provider,{value:C,children:b.jsx(zx,{render:s,className:i,state:T,refs:[n,_],props:[w,o],stateAttributesMapping:xM,highlightedIndex:y,enableHomeAndEndKeys:!0,loopFocus:a,orientation:f,onHighlightedIndexChange:S,onMapChange:p,disabledIndices:ea})})});function sz(e,t){const{left:n,top:r}=e.getBoundingClientRect(),{left:i,top:a}=t.getBoundingClientRect(),s=n-i,o=r-a;return{left:s,top:o}}function jEe(e,t,n,r){const[i,a]=k.useState(null);return Je(()=>{if(e==null||n==null){a(null);return}const s=r(e);if(s==null){a(null);return}const{left:o,top:l}=sz(s,n);a(t==="horizontal"?o:l)},[t,r,n,e]),k.useCallback(s=>{if(s===e)return"none";if(s==null)return a(null),"none";if(s!=null&&n!=null){const o=r(s);if(o!=null){const{left:l,top:u}=sz(o,n);if(i==null)return a(t==="horizontal"?l:u),"none";if(t==="horizontal"){if(l<i)return a(l),"left";if(l>i)return a(l),"right"}else{if(u<i)return a(u),"up";if(u>i)return a(u),"down"}}}return"none"},[r,t,i,n,e])}function su({className:e,orientation:t="horizontal",...n}){return b.jsx(NEe,{"data-slot":"tabs","data-orientation":t,className:Ue("gap-2 group/tabs flex data-[orientation=horizontal]:flex-col",e),...n})}const FEe=Yc("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 ou({className:e,variant:t="default",...n}){return b.jsx(MEe,{"data-slot":"tabs-list","data-variant":t,className:Ue(FEe({variant:t}),e),...n})}function li({className:e,...t}){return b.jsx(DEe,{"data-slot":"tabs-trigger",className:Ue("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 Pi({className:e,...t}){return b.jsx(PEe,{"data-slot":"tabs-content",className:Ue("text-xs/relaxed flex-1 min-h-0 outline-none",e),...t})}function BEe(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:s,handle:o,triggerId:l,defaultTriggerId:u=null}=e,f=Au(),d=!!f,p=di(()=>o?.store??new Ste({open:n??r,activeTriggerId:l!==void 0?l:u,modal:!0,disablePointerDismissal:!0,nested:d,role:"alertdialog"})).current;p.useControlledProp("open",n,r),p.useControlledProp("activeTriggerId",l,u),p.useSyncedValue("nested",d),p.useContextCallback("onOpenChange",i),p.useContextCallback("onOpenChangeComplete",a);const m=p.useState("payload");Ete({store:p,actionsRef:s,parentContext:f?.store.context});const y=k.useMemo(()=>({store:p}),[p]);return b.jsx(gM.Provider,{value:y,children:typeof t=="function"?t({payload:m}):t})}const Wte=k.createContext(void 0),Vte=k.createContext(void 0),Gte=k.createContext(void 0),qte=k.createContext("");function Ru(){const e=k.useContext(Wte);if(!e)throw new Error(rn(22));return e}function Qx(){const e=k.useContext(Vte);if(!e)throw new Error(rn(23));return e}function Vf(){const e=k.useContext(Gte);if(!e)throw new Error(rn(24));return e}function wM(){return k.useContext(qte)}const mt={id:Be(e=>e.id),query:Be(e=>e.query),items:Be(e=>e.items),selectedValue:Be(e=>e.selectedValue),open:Be(e=>e.open),mounted:Be(e=>e.mounted),forceMounted:Be(e=>e.forceMounted),inline:Be(e=>e.inline),activeIndex:Be(e=>e.activeIndex),selectedIndex:Be(e=>e.selectedIndex),isActive:Be((e,t)=>e.activeIndex===t),isSelected:Be((e,t)=>{const n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(i=>bu(i,t,n)):bu(r,t,n)}),transitionStatus:Be(e=>e.transitionStatus),popupProps:Be(e=>e.popupProps),inputProps:Be(e=>e.inputProps),triggerProps:Be(e=>e.triggerProps),getItemProps:Be(e=>e.getItemProps),positionerElement:Be(e=>e.positionerElement),listElement:Be(e=>e.listElement),triggerElement:Be(e=>e.triggerElement),inputElement:Be(e=>e.inputElement),popupSide:Be(e=>e.popupSide),openMethod:Be(e=>e.openMethod),inputInsidePopup:Be(e=>e.inputInsidePopup),selectionMode:Be(e=>e.selectionMode),listRef:Be(e=>e.listRef),labelsRef:Be(e=>e.labelsRef),popupRef:Be(e=>e.popupRef),emptyRef:Be(e=>e.emptyRef),inputRef:Be(e=>e.inputRef),keyboardActiveRef:Be(e=>e.keyboardActiveRef),chipsContainerRef:Be(e=>e.chipsContainerRef),clearRef:Be(e=>e.clearRef),valuesRef:Be(e=>e.valuesRef),allValuesRef:Be(e=>e.allValuesRef),name:Be(e=>e.name),disabled:Be(e=>e.disabled),readOnly:Be(e=>e.readOnly),required:Be(e=>e.required),grid:Be(e=>e.grid),isGrouped:Be(e=>e.isGrouped),virtualized:Be(e=>e.virtualized),onOpenChangeComplete:Be(e=>e.onOpenChangeComplete),openOnInputClick:Be(e=>e.openOnInputClick),itemToStringLabel:Be(e=>e.itemToStringLabel),isItemEqualToValue:Be(e=>e.isItemEqualToValue),modal:Be(e=>e.modal),autoHighlight:Be(e=>e.autoHighlight),submitOnItemClick:Be(e=>e.submitOnItemClick)};function UEe(e,t){return(n,r)=>{if(n==null)return!1;const i=Xr(n,t);return e.contains(i,r)}}function $Ee(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;const a=Xr(r,t),s=n!=null?Xr(n,t):"";return s&&e.contains(s,i)&&s.length===i.length?!0:e.contains(a,i)}}const oz=new Map;function Kte(e){return Array.isArray(e)?e.map(t=>Kte(t)).join(","):e==null?"":String(e)}function zEe(e={}){const t={usage:"search",sensitivity:"base",ignorePunctuation:!0,...e},n=`${Kte(e.locale)}|${JSON.stringify(t)}`,r=oz.get(n);if(r)return r;const i=new Intl.Collator(e.locale,t),a={contains(s,o,l){if(!o)return!0;const u=Xr(s,l);for(let f=0;f<=u.length-o.length;f+=1)if(i.compare(u.slice(f,f+o.length),o)===0)return!0;return!1},startsWith(s,o,l){if(!o)return!0;const u=Xr(s,l);return i.compare(u.slice(0,o.length),o)===0},endsWith(s,o,l){if(!o)return!0;const u=Xr(s,l),f=o.length;return u.length>=f&&i.compare(u.slice(u.length-f),o)===0}};return oz.set(n,a),a}const HEe=zEe,Yte=Symbol("none"),Ld={value:Yte,index:-1};function WEe(e){const{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:s,inputValue:o,selectionMode:l="none",onItemHighlighted:u,name:f,disabled:d=!1,readOnly:p=!1,required:m=!1,inputRef:y,grid:S=!1,items:g,filteredItems:_,filter:v,openOnInputClick:x=!0,autoHighlight:T=!1,keepHighlight:w=!1,highlightItemOnHover:C=!0,itemToStringLabel:R,itemToStringValue:O,isItemEqualToValue:N=Lte,virtualized:L=!1,inline:D=!1,fillInputOnItemPress:z=!0,modal:M=!1,limit:V=-1,autoComplete:W="list",locale:$,submitOnItemClick:q=!1}=e,{clearErrors:Y}=Hy(),{setDirty:B,validityData:j,shouldValidateOnChange:U,setFilled:K,name:H,disabled:J,validation:se}=Fs(),ae=Zx({id:t}),Q=HEe({locale:$}),[G,Z]=k.useState(!1),[ee,ne]=k.useState(null),te=k.useRef([]),be=k.useRef([]),_e=k.useRef(null),he=k.useRef(null),ye=k.useRef(null),Ee=k.useRef(!0),xe=k.useRef(!1),ve=k.useRef(null),De=k.useRef(null),Te=k.useRef(null),pe=k.useRef(Ld),ce=k.useRef(null),Re=k.useRef([]),Pe=k.useRef([]),ge=J||d,Le=H??f,Ce=l==="multiple",Ve=l==="single",Ze=o!==void 0||s!==void 0,gt=g!==void 0,st=_!==void 0;let ot;T==="always"?ot="always":ot=T?"input-change":!1;const[Fe,ht]=Ja({controlled:i,default:Ce?r??ea:r,name:"Combobox",state:"selectedValue"}),Ne=k.useMemo(()=>v===null?()=>!0:v!==void 0?v:Ve&&!G?$Ee(Q,R,Fe):UEe(Q,R),[v,Ve,Fe,G,Q,R]),ze=di(()=>Ze?s??"":Ve?Xr(Fe,R):"").current,[et,lt]=Ja({controlled:o,default:ze,name:"Combobox",state:"inputValue"}),[pt,gn]=Ja({controlled:e.open,default:e.defaultOpen,name:"Combobox",state:"open"}),Ft=Mte(g),Nt=ee??(et===""?"":String(et).trim()),ct=Ve?Xr(Fe,R):"",nn=Ve&&!G&&Nt!==""&&ct!==""&&ct.length===Nt.length&&Q.contains(ct,Nt),Lt=nn?"":Nt,yt=gt&&st&&nn,Bt=k.useMemo(()=>g?Ft?g.flatMap(dt=>dt.items):g:ea,[g,Ft]),Ut=k.useMemo(()=>{if(_&&!yt)return _;if(!g)return ea;if(Ft){const Ct=g,qt=[];let Kn=0;for(const vr of Ct){if(V>-1&&Kn>=V)break;const Mr=Lt===""?vr.items:vr.items.filter(Rl=>Ne(Rl,Lt,R));if(Mr.length===0)continue;const kl=V>-1?V-Kn:1/0,Ol=Mr.slice(0,kl);if(Ol.length>0){const Rl={...vr,items:Ol};qt.push(Rl),Kn+=Ol.length}}return qt}if(Lt==="")return V>-1?Bt.slice(0,V):Bt;const dt=[];for(const Ct of Bt){if(V>-1&&dt.length>=V)break;Ne(Ct,Lt,R)&&dt.push(Ct)}return dt},[_,yt,g,Ft,Lt,V,Ne,R,Bt]),zt=k.useMemo(()=>Ft?Ut.flatMap(Ct=>Ct.items):Ut,[Ut,Ft]),ft=di(()=>new hf({id:ae,selectedValue:Fe,open:pt,filter:Ne,query:Nt,items:g,selectionMode:l,listRef:te,labelsRef:be,popupRef:_e,emptyRef:ye,inputRef:he,keyboardActiveRef:Ee,chipsContainerRef:ve,clearRef:De,valuesRef:Re,allValuesRef:Pe,selectionEventRef:Te,name:Le,disabled:ge,readOnly:p,required:m,grid:S,isGrouped:Ft,virtualized:L,openOnInputClick:x,itemToStringLabel:R,isItemEqualToValue:N,modal:M,autoHighlight:ot,submitOnItemClick:q,hasInputValue:Ze,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:D,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:n||yr,setOpen:yr,setInputValue:yr,setSelectedValue:yr,setIndices:yr,onItemHighlighted:yr,handleSelection:yr,getItemProps:()=>Jn,forceMount:yr,requestSubmit:yr})).current,yn=l==="none"?et:Fe,mr=k.useMemo(()=>l==="none"?yn:Array.isArray(Fe)?Fe.map(dt=>to(dt,O)):to(Fe,O),[yn,O,l,Fe]),Vr=Xe(u),Pr=Xe(n),Ki=Ye(ft,mt.activeIndex),Kt=Ye(ft,mt.selectedIndex),Ri=Ye(ft,mt.positionerElement),gr=Ye(ft,mt.listElement),br=Ye(ft,mt.triggerElement),ss=Ye(ft,mt.inputElement),Yi=Ye(ft,mt.inline),Ws=Ye(ft,mt.inputInsidePopup),ig=lr(br),{mounted:hd,setMounted:xl,transitionStatus:wl}=Co(pt),{openMethod:Vs,triggerProps:os,reset:Tl}=Xx(pt);Wy({id:ae,name:Le,commit:se.commit,value:yn,controlRef:Ws?ig:he,getValue:()=>mr});const Ni=Xe(()=>{g?be.current=zt.map(dt=>Xr(dt,R)):ft.set("forceMounted",!0)}),Tr=k.useRef(Fe);Je(()=>{Fe!==Tr.current&&Ni()},[Ni,Fe]);const mi=Xe(dt=>{ft.update(dt);const Ct=dt.type||"none";if(dt.activeIndex!==void 0)if(dt.activeIndex===null)pe.current!==Ld&&(pe.current=Ld,Vr(void 0,ib(Ct,void 0,{index:-1})));else{const qt=Re.current[dt.activeIndex];pe.current={value:qt,index:dt.activeIndex},Vr(qt,ib(Ct,void 0,{index:dt.activeIndex}))}}),Ge=Xe((dt,Ct)=>{if(xe.current=Ct.reason===gc,e.onInputValueChange?.(dt,Ct),!Ct.isCanceled){if(Ct.reason===Yd){const qt=dt.trim()!=="";qt&&Z(!0),ce.current={hasQuery:qt},qt&&ot&&ft.state.activeIndex==null&&ft.set("activeIndex",0)}lt(dt)}}),Rt=Xe((dt,Ct)=>{pt!==dt&&(Ct.reason==="escape-key"&&gt&&zt.length===0&&!ft.state.emptyRef.current&&Ct.allowPropagation(),e.onOpenChange?.(dt,Ct),!Ct.isCanceled&&(!dt&&G&&(Ve?(ne(Nt),Nt===""&&Z(!1)):Ce&&(Yi||Ws?mi({activeIndex:null}):ne(Nt),Ge("",it(gc,Ct.event)))),gn(dt)))}),Cr=Xe((dt,Ct)=>{if(a?.(dt,Ct),Ct.isCanceled)return;ht(dt),(l==="none"&&_e.current&&z||Ve&&!ft.state.inputInsidePopup)&&Ge(Xr(dt,R),it(Ct.reason,Ct.event)),Ve&&dt!=null&&Ct.reason!==Yd&&G&&ne(Nt)}),Cl=Xe((dt,Ct)=>{let qt=Ct;if(qt===void 0){if(Ki===null)return;qt=Re.current[Ki]}const Kn=_r(dt),vr=Te.current??dt;Te.current=null;const Mr=it(df,vr),kl=Kn?.closest("a")?.getAttribute("href");if(kl){kl.startsWith("#")&&Rt(!1,Mr);return}if(Ce){const Ol=Array.isArray(Fe)?Fe:[],Gs=Qd(Ol,qt,ft.state.isItemEqualToValue)?Pte(Ol,qt,ft.state.isItemEqualToValue):[...Ol,qt];if(Cr(Gs,Mr),!(he.current?he.current.value.trim()!=="":!1))return;ft.state.inputInsidePopup?Ge("",it(gc,Mr.event)):Rt(!1,Mr)}else Cr(qt,Mr),Rt(!1,Mr)}),Ia=Xe(()=>{if(!ft.state.submitOnItemClick)return;const dt=ft.state.inputElement?.form;dt&&typeof dt.requestSubmit=="function"&&dt.requestSubmit()}),pd=Xe(()=>{if(xl(!1),Pr?.(!1),Z(!1),Tl(),ne(null),mi(l==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Ce&&he.current&&he.current.value!==""&&!xe.current&&Ge("",it(gc)),Ve)if(ft.state.inputInsidePopup)he.current&&he.current.value!==""&&Ge("",it(gc));else{const dt=Xr(Fe,R);he.current&&he.current.value!==dt&&Ge(dt,it(dt===""?gc:Dr))}}),OT=k.useMemo(()=>Yi&&Ri?{current:Ri.closest('[role="dialog"]')}:_e,[Yi,Ri]);Ai({enabled:!e.actionsRef,open:pt,ref:OT,onComplete(){pt||pd()}}),k.useImperativeHandle(e.actionsRef,()=>({unmount:pd}),[pd]),Je(function(){if(pt||l==="none")return;const Ct=g?Bt:Pe.current;if(Ce){const qt=Array.isArray(Fe)?Fe:[],Kn=qt[qt.length-1],vr=Lp(Ct,Kn,N);mi({selectedIndex:vr===-1?null:vr})}else{const qt=Lp(Ct,Fe,N);mi({selectedIndex:qt===-1?null:qt})}},[pt,Fe,g,l,Bt,Ce,N,mi]),Je(()=>{g&&(Re.current=zt,te.current.length=zt.length)},[g,zt]),Je(()=>{const dt=ce.current;if(dt&&(dt.hasQuery?ot&&ft.set("activeIndex",0):ot==="always"&&ft.set("activeIndex",0),ce.current=null),!pt&&!Yi)return;const qt=gt||st?zt:Re.current,Kn=ft.state.activeIndex;if(Kn==null){if(ot==="always"&&qt.length>0){ft.set("activeIndex",0);return}pe.current!==Ld&&(pe.current=Ld,ft.state.onItemHighlighted(void 0,ib(Dr,void 0,{index:-1})));return}if(Kn>=qt.length){pe.current!==Ld&&(pe.current=Ld,ft.state.onItemHighlighted(void 0,ib(Dr,void 0,{index:-1}))),ft.set("activeIndex",null);return}const vr=qt[Kn],Mr=pe.current.value,kl=Mr!==Yte&&ft.state.isItemEqualToValue(vr,Mr);(pe.current.index!==Kn||!kl)&&(pe.current={value:vr,index:Kn},ft.state.onItemHighlighted(vr,ib(Dr,void 0,{index:Kn})))},[Ki,ot,st,gt,zt,Yi,pt,ft]),Je(()=>{if(!g||l==="none")return;const dt=Bt;if(Ce){const Kn=Array.isArray(Fe)?Fe:ea,vr=Kn.filter(Mr=>Qd(dt,Mr,ft.state.isItemEqualToValue));vr.length!==Kn.length&&ht(vr);return}if(Fe==null?!0:Qd(dt,Fe,ft.state.isItemEqualToValue))return;let qt=null;if(r!=null&&Qd(dt,r,ft.state.isItemEqualToValue)&&(qt=r),ht(qt),!ft.state.inputInsidePopup){const Kn=Xr(qt,R);he.current&&he.current.value!==Kn&&Ge(Kn,it(Dr))}},[g,Bt,Ce,l,Fe,r,ht,R,ft,Ge]),Je(()=>{if(l==="none"){K(String(et)!=="");return}K(Ce?Array.isArray(Fe)&&Fe.length>0:Fe!=null)},[K,l,et,Fe,Ce]),k.useEffect(()=>{gt&&ot&&zt.length===0&&mi({activeIndex:null})},[gt,ot,zt.length,mi]),Jd(Nt,()=>{!pt||Nt===""||Nt===String(ze)||Z(!0)}),Jd(Fe,()=>{if(l!=="none"&&(Y(Le),B(Fe!==j.initialValue),U()?se.commit(Fe):se.commit(Fe,!0),Ce&&ft.state.selectedIndex!==null&&(!Array.isArray(Fe)||Fe.length===0)&&mi({activeIndex:null,selectedIndex:null}),Ve&&!Ze&&!Ws)){const dt=Xr(Fe,R);et!==dt&&Ge(dt,it(Dr))}}),Jd(et,()=>{l==="none"&&(Y(Le),B(et!==j.initialValue),U()?se.commit(et):se.commit(et,!0))}),Jd(g,()=>{if(!Ve||Ze||Ws||G)return;const dt=Xr(Fe,R);et!==dt&&Ge(dt,it(Dr))});const Al=Bx({open:Yi?!0:pt,onOpenChange:Rt,elements:{reference:Ws?br:ss,floating:Ri}});let ju,Da;Yi||(ju=S?"grid":"listbox",Da=pt?"true":"false");const sa=k.useMemo(()=>{const dt=ss?.tagName==="INPUT",Ct=dt||pt,qt=dt?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return Ct&&(qt.role="combobox",qt["aria-expanded"]=Da,qt["aria-haspopup"]=ju,qt["aria-controls"]=pt?gr?.id:void 0,qt["aria-autocomplete"]=W),{reference:qt,floating:{role:"presentation"}}},[ss,pt,Da,ju,gr?.id,W]),L0=Tm(Al,{enabled:!p&&!ge&&x,event:"mousedown-only",toggle:!1,touchOpenDelay:Ws?0:50}),RT=Cm(Al,{enabled:!p&&!ge&&!Yi,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Yi?!0:void 0,outsidePress(dt){const Ct=_r(dt);return!Tt(br,Ct)&&!Tt(De.current,Ct)&&!Tt(ve.current,Ct)}}),ag=iM(Al,{enabled:!p&&!ge,id:ae,listRef:te,activeIndex:Ki,selectedIndex:Kt,virtual:!0,loopFocus:!0,allowEscape:!ot,focusItemOnOpen:G||l==="none"&&!ot?!1:"auto",focusItemOnHover:C,resetOnPointerLeave:!w,cols:S?2:1,orientation:S?"horizontal":void 0,disabledIndices:ea,onNavigate(dt,Ct){!Ct&&!pt||wl==="ending"||mi(Ct?{activeIndex:dt,type:Ee.current?"keyboard":"pointer"}:{activeIndex:dt})}}),{getReferenceProps:ch,getFloatingProps:Fu,getItemProps:sg}=Qc([sa,L0,RT,ag]);Rte(()=>{ft.update({inline:D,popupProps:Fu(),inputProps:ch(),triggerProps:os,getItemProps:sg,setOpen:Rt,setInputValue:Ge,setSelectedValue:Cr,setIndices:mi,onItemHighlighted:Vr,handleSelection:Cl,forceMount:Ni,requestSubmit:Ia})}),Je(()=>{ft.update({id:ae,selectedValue:Fe,open:pt,mounted:hd,transitionStatus:wl,items:g,inline:D,popupProps:Fu(),inputProps:ch(),triggerProps:os,openMethod:Vs,getItemProps:sg,selectionMode:l,name:Le,disabled:ge,readOnly:p,required:m,grid:S,isGrouped:Ft,virtualized:L,onOpenChangeComplete:Pr,openOnInputClick:x,itemToStringLabel:R,modal:M,autoHighlight:ot,isItemEqualToValue:N,submitOnItemClick:q,hasInputValue:Ze,requestSubmit:Ia})},[ft,ae,Fe,pt,hd,wl,g,Fu,ch,sg,Vs,os,l,Le,ge,p,m,se,S,Ft,L,Pr,x,R,M,N,q,Ze,D,Ia,ot]);const oa=js(y,se.inputRef),og=k.useMemo(()=>({query:Nt,filteredItems:Ut,flatFilteredItems:zt}),[Nt,Ut,zt]),P0=k.useMemo(()=>Array.isArray(yn)?"":to(yn,O),[yn,O]),lg=Ce&&Array.isArray(Fe)&&Fe.length>0,Bu=k.useMemo(()=>!Ce||!Array.isArray(Fe)||!Le?null:Fe.map(dt=>{const Ct=to(dt,O);return b.jsx("input",{type:"hidden",name:Le,value:Ct},Ct)}),[Ce,Fe,Le,O]),M0=b.jsxs(k.Fragment,{children:[e.children,b.jsx("input",{...se.getInputValidationProps({onFocus(){if(Ws){br?.focus();return}(he.current||br)?.focus()},onChange(dt){if(dt.nativeEvent.defaultPrevented)return;const Ct=dt.target.value,qt=it(Yd,dt.nativeEvent);function Kn(){if(Ce)return;if(l==="none"){B(Ct!==j.initialValue),Ge(Ct,qt),U()&&se.commit(Ct);return}const vr=Re.current.find(Mr=>to(Mr,O).toLowerCase()===Ct.toLowerCase());vr!=null&&(B(vr!==j.initialValue),Cr?.(vr,qt),U()&&se.commit(vr))}g?Kn():(Ni(),queueMicrotask(Kn))}}),id:ae,name:Ce||l==="none"?void 0:Le,disabled:ge,required:m&&!lg,readOnly:p,value:P0,ref:oa,style:wm,tabIndex:-1,"aria-hidden":!0}),Bu]});return b.jsx(Wte.Provider,{value:ft,children:b.jsx(Vte.Provider,{value:Al,children:b.jsx(Gte.Provider,{value:og,children:b.jsx(qte.Provider,{value:et,children:M0})})})})}const m_=2,VEe={...Ip,...Wf},GEe=k.forwardRef(function(t,n){const{render:r,className:i,nativeButton:a=!0,disabled:s=!1,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=Fs(),{labelId:y}=td(),S=Ru(),g=Ye(S,mt.selectionMode),_=Ye(S,mt.disabled),v=Ye(S,mt.readOnly),x=Ye(S,mt.listElement),T=Ye(S,mt.triggerProps),w=Ye(S,mt.triggerElement),C=Ye(S,mt.inputInsidePopup),R=Ye(S,mt.open),O=Ye(S,mt.selectedValue),N=Ye(S,mt.activeIndex),L=Ye(S,mt.selectedIndex),D=Qx(),z=wM(),M=Pn(),V=u||_||s,W=k.useRef("");function $(se){W.current=se.pointerType}const q=D.select("domReferenceElement");k.useEffect(()=>{C&&w&&w!==q&&D.set("domReferenceElement",w)},[w,q,D,C]);const{reference:Y}=aM(D,{enabled:!R&&!v&&!_&&g==="single",listRef:S.state.labelsRef,activeIndex:N,selectedIndex:L,onMatch(se){const ae=S.state.valuesRef.current[se];ae!==void 0&&S.state.setSelectedValue(ae,it("none"))}}),{reference:B}=Tm(D,{enabled:!v&&!_,event:"mousedown"}),{buttonRef:j,getButtonProps:U}=aa({native:a,disabled:V}),K=k.useMemo(()=>({...l,open:R,disabled:V}),[l,R,V]),H=Xe(se=>{S.set("triggerElement",se)});return xt("button",t,{ref:[n,j,H],state:K,props:[T,B,Y,{tabIndex:C?0:-1,disabled:V,role:C?"combobox":void 0,"aria-expanded":R?"true":"false","aria-haspopup":C?"dialog":"listbox","aria-controls":R?x?.id:void 0,"aria-readonly":v||void 0,"aria-labelledby":y,onPointerDown:$,onPointerEnter:$,onFocus(){d(!0),!(V||v)&&M.start(0,S.state.forceMount)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const se=g==="none"?z:O;m.commit(se)}},onMouseDown(se){if(V||v||(C||D.set("domReferenceElement",se.currentTarget),S.state.forceMount(),W.current!=="touch"&&(S.state.inputRef.current?.focus(),C||se.preventDefault()),R))return;const ae=Ci(se.currentTarget);function Q(G){if(!w)return;const Z=_r(G),ee=S.state.positionerElement,ne=S.state.listElement;if(Tt(w,Z)||Tt(ee,Z)||Tt(ne,Z)||Z===w)return;const te=vM(w),be=G.clientX>=te.left-m_&&G.clientX<=te.right+m_,_e=G.clientY>=te.top-m_&&G.clientY<=te.bottom+m_;be&&_e||S.state.setOpen(!1,it("cancel-open",G))}C&&ae.addEventListener("mouseup",Q,{once:!0})},onKeyDown(se){V||v||(se.key==="ArrowDown"||se.key==="ArrowUp")&&(Rr(se),S.state.setOpen(!0,it(mp,se.nativeEvent)),S.state.inputRef.current?.focus())}},m?m.getValidationProps(o):o,U],stateAttributesMapping:VEe})}),qEe=k.createContext(void 0);function KEe(){return k.useContext(qEe)}const Xte=k.createContext(void 0);function TM(e){const t=k.useContext(Xte);if(t===void 0&&!e)throw new Error(rn(21));return t}const YEe={...Ip,...Wf,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":""}:null},XEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,id:s,...o}=t,{state:l,disabled:u,setTouched:f,setFocused:d,validationMode:p,validation:m}=Fs(),{labelId:y}=td(),S=KEe(),_=!!TM(!0),v=Ru(),{filteredItems:x}=Vf(),T=wM(),w=fi(s),C=Cu(),R=Ye(v,mt.disabled),O=Ye(v,mt.readOnly),N=Ye(v,mt.name),L=Ye(v,mt.selectionMode),D=Ye(v,mt.autoHighlight),z=Ye(v,mt.inputProps),M=Ye(v,mt.triggerProps),V=Ye(v,mt.open),W=Ye(v,mt.mounted),$=Ye(v,mt.selectedValue),q=Ye(v,mt.popupSide),Y=Ye(v,mt.positionerElement),B=!!D,j=W&&Y?q:null,U=u||R||a,K=x.length===0,[H,J]=k.useState(null),se=k.useRef(!1),ae=Xe(ee=>{const ne=_||v.state.inline;ne&&!v.state.hasInputValue&&v.state.setInputValue("",it(Dr)),v.update({inputElement:ee,inputInsidePopup:ne})}),Q=k.useMemo(()=>({...l,open:V,disabled:U,readOnly:O,popupSide:j,listEmpty:K}),[l,V,U,O,j,K]);function G(ee){if(!S)return;let ne;const{highlightedChipIndex:te}=S;if(te!==void 0){if(ee.key==="ArrowLeft")ee.preventDefault(),te>0?ne=te-1:ne=void 0;else if(ee.key==="ArrowRight")ee.preventDefault(),te<$.length-1?ne=te+1:ne=void 0;else if(ee.key==="Backspace"||ee.key==="Delete"){ee.preventDefault();const be=te>=$.length-1?$.length-2:te;ne=be>=0?be:void 0,v.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return ne}return ee.key==="ArrowLeft"&&(ee.currentTarget.selectionStart??0)===0&&$.length>0?(ee.preventDefault(),ne=Math.max($.length-1,0)):ee.key==="Backspace"&&ee.currentTarget.value===""&&$.length>0&&(v.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),ee.preventDefault()),ne}return xt("input",t,{state:Q,ref:[n,v.state.inputRef,ae],props:[z,M,{type:"text",value:t.value??H??T,"aria-readonly":O||void 0,"aria-labelledby":y,disabled:U,readOnly:O,...L==="none"&&N&&{name:N},id:w,onFocus(){d(!0)},onBlur(){if(f(!0),d(!1),p==="onBlur"){const ee=L==="none"?T:$;m.commit(ee)}},onCompositionStart(ee){DE||(se.current=!0,J(ee.currentTarget.value))},onCompositionEnd(ee){se.current=!1;const ne=ee.currentTarget.value;J(null),v.state.setInputValue(ne,it(Yd,ee.nativeEvent))},onChange(ee){if(se.current){const _e=ee.currentTarget.value;J(_e),_e===""&&!v.state.openOnInputClick&&!v.state.inputInsidePopup&&v.state.setOpen(!1,it(gc,ee.nativeEvent));const he=_e.trim(),ye=B&&he!=="";!O&&!U&&he!==""&&(v.state.setOpen(!0,it(Yd,ee.nativeEvent)),B||v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&v.state.activeIndex!==null&&!ye&&v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"});return}v.state.setInputValue(ee.currentTarget.value,it(Yd,ee.nativeEvent));const ne=ee.currentTarget.value==="",te=it(gc,ee.nativeEvent);ne&&!v.state.inputInsidePopup&&(L==="single"&&v.state.setSelectedValue(null,te),v.state.openOnInputClick||v.state.setOpen(!1,te));const be=ee.currentTarget.value.trim();!O&&!U&&be!==""&&(v.state.setOpen(!0,it(Yd,ee.nativeEvent)),B||v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})),V&&v.state.activeIndex!==null&&!B&&v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(ee){if(U||O||ee.ctrlKey||ee.shiftKey||ee.altKey||ee.metaKey)return;v.state.keyboardActiveRef.current=!0;const ne=ee.currentTarget,te=ne.scrollWidth-ne.clientWidth,be=C==="rtl";if(ee.key==="Home"){Rr(ee);const he=b$&&be?ne.value.length:0;ne.setSelectionRange(he,he),ne.scrollLeft=0;return}if(ee.key==="End"){Rr(ee);const he=b$&&be?0:ne.value.length;ne.setSelectionRange(he,he),ne.scrollLeft=be?-te:te;return}if(!W&&ee.key==="Escape"){const he=L==="multiple"&&Array.isArray($)?$.length===0:$===null,ye=it(Dy,ee.nativeEvent),Ee=L==="multiple"?[]:null;v.state.setInputValue("",ye),v.state.setSelectedValue(Ee,ye),!he&&!v.state.inline&&!ye.isPropagationAllowed&&ee.stopPropagation();return}if(S&&ee.key==="Backspace"&&ne.value===""&&S.highlightedChipIndex===void 0&&Array.isArray($)&&$.length>0){const he=$.slice(0,-1);v.state.setIndices({activeIndex:null,selectedIndex:null,type:v.state.keyboardActiveRef.current?"keyboard":"pointer"}),v.state.setSelectedValue(he,it(Dr,ee.nativeEvent));return}const _e=G(ee);if(S?.setHighlightedChipIndex(_e),_e!==void 0?S?.chipsRef.current[_e]?.focus():v.state.inputRef.current?.focus(),ee.which!==229&&ee.key==="Enter"&&V){const he=v.state.activeIndex,ye=ee.nativeEvent;if(he===null){v.state.setOpen(!1,it(Dr,ye));return}Rr(ee);const Ee=v.state.listRef.current[he];Ee&&(v.state.selectionEventRef.current=ye,Ee.click(),v.state.selectionEventRef.current=null)}},onPointerMove(){v.state.keyboardActiveRef.current=!1},onPointerDown(){v.state.keyboardActiveRef.current=!1}},m?m.getValidationProps(o):o],stateAttributesMapping:YEe})}),ZEe={...is,...Hx},QEe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,keepMounted:o=!1,...l}=t,{disabled:u}=Fs(),f=Ru(),d=Ye(f,mt.selectionMode),p=Ye(f,mt.disabled),m=Ye(f,mt.readOnly),y=Ye(f,mt.open),S=Ye(f,mt.selectedValue),g=wM();let _=!1;d==="none"?_=g!=="":d==="single"?_=S!=null:_=Array.isArray(S)&&S.length>0;const v=u||p||a,{buttonRef:x,getButtonProps:T}=aa({native:s,disabled:v}),{mounted:w,transitionStatus:C,setMounted:R}=Co(_),O=k.useMemo(()=>({disabled:v,open:y,transitionStatus:C}),[v,y,C]);Ai({open:_,ref:f.state.clearRef,onComplete(){_||R(!1)}});const N=xt("button",t,{state:O,ref:[n,x,f.state.clearRef],props:[{tabIndex:-1,children:"x",disabled:v,"aria-readonly":m||void 0,onMouseDown(D){D.preventDefault()},onClick(D){if(v||m)return;const z=f.state.keyboardActiveRef;f.state.setInputValue("",it(w$,D.nativeEvent)),d!=="none"?(f.state.setSelectedValue(Array.isArray(S)?[]:null,it(w$,D.nativeEvent)),f.state.setIndices({activeIndex:null,selectedIndex:null,type:z.current?"keyboard":"pointer"})):f.state.setIndices({activeIndex:null,type:z.current?"keyboard":"pointer"}),f.state.inputRef.current?.focus()}},l,T],stateAttributesMapping:ZEe});return o||w?N:null}),JEe=k.createContext(null);function eSe(){return k.useContext(JEe)}function tSe(e){const{children:t}=e,{filteredItems:n}=Vf(),r=eSe(),i=r?r.items:n;return i?b.jsx(k.Fragment,{children:i.map(t)}):null}const nSe=k.forwardRef(function(t,n){var r;const{render:i,className:a,children:s,...o}=t,l=Ru(),u=Qx(),f=!!TM(!0),{filteredItems:d}=Vf(),p=Ye(l,mt.items),m=Ye(l,mt.labelsRef),y=Ye(l,mt.listRef),S=Ye(l,mt.selectionMode),g=Ye(l,mt.grid),_=Ye(l,mt.popupProps),v=Ye(l,mt.disabled),x=Ye(l,mt.readOnly),T=Ye(l,mt.virtualized),w=S==="multiple",C=d.length===0,R=Xe(M=>{l.set("positionerElement",M)}),O=Xe(M=>{l.set("listElement",M)}),N=k.useMemo(()=>typeof s=="function"?r||(r=b.jsx(tSe,{children:s})):s,[s]),L=k.useMemo(()=>({empty:C}),[C]),D=u.useState("floatingId"),z=xt("div",t,{state:L,ref:[n,O,f?null:R],props:[_,{children:N,tabIndex:-1,id:D,role:g?"grid":"listbox","aria-multiselectable":w?"true":void 0,onKeyDown(M){if(!(v||x)&&M.key==="Enter"){const V=l.state.activeIndex;if(V==null)return;Rr(M);const W=M.nativeEvent,$=l.state.listRef.current[V];$&&(l.state.selectionEventRef.current=W,$.click(),l.state.selectionEventRef.current=null)}},onKeyDownCapture(){l.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){l.state.keyboardActiveRef.current=!1}},o]});return T?z:b.jsx(My,{elementsRef:y,labelsRef:p?void 0:m,children:z})}),Zte=k.createContext(void 0);function rSe(){const e=k.useContext(Zte);if(e===void 0)throw new Error(rn(20));return e}const iSe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,a=Ru(),s=Ye(a,mt.mounted),o=Ye(a,mt.forceMounted);return s||r||o?b.jsx(Zte.Provider,{value:r,children:b.jsx(Ly,{ref:n,...i})}):null}),aSe=k.forwardRef(function(t,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="bottom",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:y=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=Ix,..._}=t,v=Ru(),{filteredItems:x}=Vf(),T=Qx(),w=rSe(),C=Ye(v,mt.modal),R=Ye(v,mt.open),O=Ye(v,mt.mounted),N=Ye(v,mt.openMethod),L=Ye(v,mt.triggerElement),D=Ye(v,mt.inputElement),z=Ye(v,mt.inputInsidePopup),M=x.length===0,W=By({anchor:a??(z?L:D),floatingRootContext:T,positionMethod:s,mounted:O,side:o,sideOffset:u,align:l,alignOffset:f,arrowPadding:m,collisionBoundary:d,collisionPadding:p,sticky:y,disableAnchorTracking:S,keepMounted:w,collisionAvoidance:g,lazyFlip:!0});Yx(R&&C&&N!=="touch",L);const $=k.useMemo(()=>{const U={...W.positionerStyles};return R||(U.pointerEvents="none"),{role:"presentation",hidden:!O,style:U}},[R,O,W.positionerStyles]),q=k.useMemo(()=>({open:R,side:W.side,align:W.align,anchorHidden:W.anchorHidden,empty:M}),[R,W.side,W.align,W.anchorHidden,M]);Je(()=>{v.set("popupSide",W.side)},[v,W.side]);const Y=k.useMemo(()=>({side:W.side,align:W.align,arrowRef:W.arrowRef,arrowUncentered:W.arrowUncentered,arrowStyles:W.arrowStyles,anchorHidden:W.anchorHidden,isPositioned:W.isPositioned}),[W.side,W.align,W.arrowRef,W.arrowUncentered,W.arrowStyles,W.anchorHidden,W.isPositioned]),B=Xe(U=>{v.set("positionerElement",U)}),j=xt("div",t,{state:q,ref:[n,B],props:[$,_],stateAttributesMapping:ka});return b.jsxs(Xte.Provider,{value:Y,children:[O&&C&&b.jsx(Kx,{inert:Am(!R),cutout:D??L}),j]})}),sSe={...ka,...is},oSe=k.forwardRef(function(t,n){const{render:r,className:i,initialFocus:a,finalFocus:s,...o}=t,l=Ru(),u=TM(),f=Qx(),{filteredItems:d}=Vf(),p=Ye(l,mt.mounted),m=Ye(l,mt.open),y=Ye(l,mt.openMethod),S=Ye(l,mt.transitionStatus),g=Ye(l,mt.inputInsidePopup),_=Ye(l,mt.inputElement),v=d.length===0;Ai({open:m,ref:l.state.popupRef,onComplete(){m&&l.state.onOpenChangeComplete(!0)}});const x=k.useMemo(()=>({open:m,side:u.side,align:u.align,anchorHidden:u.anchorHidden,transitionStatus:S,empty:v}),[m,u.side,u.align,u.anchorHidden,S,v]),T=xt("div",t,{state:x,ref:[n,l.state.popupRef],props:[{role:g?"dialog":"presentation",tabIndex:-1,onFocus(O){const N=_r(O.nativeEvent);y!=="touch"&&(Tt(l.state.listElement,N)||N===O.currentTarget)&&l.state.inputRef.current?.focus()}},Om(S),o],stateAttributesMapping:sSe}),C=a===void 0?g?O=>O==="touch"?l.state.popupRef.current:_:!1:a;let R;return s!=null?R=s:R=g?void 0:!1,b.jsx(Px,{context:f,disabled:!p,modal:!g,openInteractionType:y,initialFocus:C,returnFocus:R,children:T})}),Qte=k.createContext(void 0);function Jte(){const e=k.useContext(Qte);if(!e)throw new Error(rn(19));return e}const lSe=k.createContext(!1);function uSe(){return k.useContext(lSe)}const cSe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a=null,index:s,disabled:o=!1,nativeButton:l=!1,...u}=t,f=k.useRef(!1),d=k.useRef(null),p=km({index:s,textRef:d,indexGuessBehavior:lM.GuessFromOrder}),m=Ru(),y=uSe(),{flatFilteredItems:S}=Vf(),g=Ye(m,mt.open),_=Ye(m,mt.selectionMode),v=Ye(m,mt.readOnly),x=Ye(m,mt.virtualized),T=Ye(m,mt.isItemEqualToValue),w=_!=="none",C=s??(x?Lp(S,a,T):p.index),R=p.index!==-1,O=Ye(m,mt.id),N=Ye(m,mt.isActive,C),L=Ye(m,mt.isSelected,a),D=Ye(m,mt.items),z=Ye(m,mt.getItemProps),M=k.useRef(null),V=O!=null&&R?`${O}-${C}`:void 0,W=L&&w;Je(()=>{if(!(R&&(x||s!=null)))return;const se=m.state.listRef.current;return se[C]=M.current,()=>{delete se[C]}},[R,x,C,s,m]),Je(()=>{if(!R||D)return;const J=m.state.valuesRef.current;return J[C]=a,_!=="none"&&m.state.allValuesRef.current.push(a),()=>{delete J[C]}},[R,D,C,a,m,_]),Je(()=>{if(!g){f.current=!1;return}if(!R||D)return;const J=m.state.selectedValue,se=Array.isArray(J)?J[J.length-1]:J;bu(se,a,T)&&m.set("selectedIndex",C)},[R,D,g,m,C,a,T]);const $=k.useMemo(()=>({disabled:o,selected:W,highlighted:N}),[o,W,N]),q=z({active:N,selected:W});q.id=void 0,q.onFocus=void 0;const{getButtonProps:Y,buttonRef:B}=aa({disabled:o,focusableWhenDisabled:!0,native:l});function j(J){function se(){m.state.handleSelection(J,a)}m.state.submitOnItemClick?(xr.flushSync(se),m.state.requestSubmit()):se()}const U={id:V,role:y?"gridcell":"option","aria-disabled":o||void 0,"aria-selected":w?W:void 0,tabIndex:void 0,onPointerDownCapture(J){f.current=!0,J.preventDefault()},onClick(J){o||v||j(J.nativeEvent)},onMouseUp(J){const se=f.current;f.current=!1,!(o||v||J.button!==0||se||!N)&&j(J.nativeEvent)}},K=xt("div",t,{ref:[B,n,p.ref,M],state:$,props:[q,U,u,Y]}),H=k.useMemo(()=>({selected:W,textRef:d}),[W,d]);return b.jsx(Qte.Provider,{value:H,children:K})})),dSe=k.forwardRef(function(t,n){const{render:r,className:i,children:a,...s}=t,{filteredItems:o}=Vf(),l=Ru(),u=o.length===0?a:null;return xt("div",t,{ref:[n,l.state.emptyRef],props:[{children:u,role:"status","aria-live":"polite","aria-atomic":!0},s]})});let lz=(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 ene(e){return k.useMemo(()=>({checked(t){return e.indeterminate?{}:t?{[lz.checked]:""}:{[lz.unchecked]:""}},...Wf}),[e.indeterminate])}const tne=k.createContext(void 0);function fSe(){const e=k.useContext(tne);if(e===void 0)throw new Error(rn(14));return e}const hSe="data-parent",pSe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a=!1,disabled:s=!1,id:o,indeterminate:l=!1,inputRef:u,name:f,onCheckedChange:d,parent:p=!1,readOnly:m=!1,render:y,required:S=!1,uncheckedValue:g,value:_,nativeButton:v=!1,...x}=t,{clearErrors:T}=Hy(),{disabled:w,name:C,setDirty:R,setFilled:O,setFocused:N,setTouched:L,state:D,validationMode:z,validityData:M,shouldValidateOnChange:V,validation:W}=Fs(),$=Q_e(),{labelId:q,controlId:Y,setControlId:B,getDescriptionProps:j}=td(),U=eEe(),K=U?.parent,H=K&&U.allValues,J=w||$.disabled||U?.disabled||s,se=C??f,ae=_??se,Q=fi(),G=fi();let Z=Y;H?Z=p?G:`${K.id}-${ae}`:o&&(Z=o);let ee={};H&&(p?ee=U.parent.getParentProps():ae&&(ee=U.parent.getChildProps(ae)));const ne=Xe(d),{checked:te=r,indeterminate:be=l,onCheckedChange:_e,...he}=ee,ye=U?.value,Ee=U?.setValue,xe=U?.defaultValue,ve=k.useRef(null),{getButtonProps:De,buttonRef:Te}=aa({disabled:J,native:v}),pe=U?.validation??W,[ce,Re]=Ja({controlled:ae&&ye&&!p?ye.includes(ae):te,default:ae&&xe&&!p?xe.includes(ae):a,name:"Checkbox",state:"checked"});Je(()=>{if(B!==yr)return B(Z),()=>{B(void 0)}},[Z,U,B,p]),Wy({enabled:!U,id:Q,commit:pe.commit,value:ce,controlRef:ve,name:se,getValue:()=>ce});const Pe=k.useRef(null),ge=js(u,Pe,pe.inputRef);Je(()=>{Pe.current&&(Pe.current.indeterminate=be,ce&&O(!0))},[ce,be,O]),Jd(ce,()=>{U&&!p||(T(se),O(ce),R(ce!==M.initialValue),V()?pe.commit(ce):pe.commit(ce,!0))});const Le=sl({checked:ce,disabled:J,name:p?void 0:se,id:Z??void 0,required:S,ref:ge,style:wm,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(ot){if(ot.nativeEvent.defaultPrevented)return;const Fe=ot.target.checked,ht=it(Dr,ot.nativeEvent);if(_e?.(Fe,ht),ne(Fe,ht),!ht.isCanceled&&(Re(Fe),ae&&ye&&Ee&&!p)){const Ne=Fe?[...ye,ae]:ye.filter(ze=>ze!==ae);Ee(Ne,ht)}},onFocus(){ve.current?.focus()}},_!==void 0?{value:(U?ce&&_:_)||""}:Jn,j,U?pe.getValidationProps:pe.getInputValidationProps),Ce=H?!!te:ce,Ve=H&&be||l;k.useEffect(()=>{K&&ae&&K.disabledStatesRef.current.set(ae,J)},[K,J,ae]);const Ze=k.useMemo(()=>({...D,checked:Ce,disabled:J,readOnly:m,required:S,indeterminate:Ve}),[D,Ce,J,m,S,Ve]),gt=ene(Ze),st=xt("span",t,{state:Ze,ref:[Te,ve,n,U?.registerControlRef],props:[{id:Q,role:"checkbox","aria-checked":be?"mixed":ce,"aria-readonly":m||void 0,"aria-required":S||void 0,"aria-labelledby":q,[hSe]:p?"":void 0,onFocus(){N(!0)},onBlur(){const ot=Pe.current;ot&&(L(!0),N(!1),z==="onBlur"&&pe.commit(U?ye:ot.checked))},onClick(ot){m||J||(ot.preventDefault(),Pe.current?.click())}},j,pe.getValidationProps,x,he,De],stateAttributesMapping:gt});return b.jsxs(tne.Provider,{value:Ze,children:[st,!ce&&!U&&se&&!p&&g!==void 0&&b.jsx("input",{type:"hidden",name:se,value:g}),b.jsx("input",{...Le})]})}),mSe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=fSe(),l=o.checked||o.indeterminate,{transitionStatus:u,setMounted:f}=Co(l),d=k.useRef(null),p=k.useMemo(()=>({...o,transitionStatus:u}),[o,u]);Ai({open:l,ref:d,onComplete(){l||f(!1)}});const m=ene(o),y=k.useMemo(()=>({...m,...is,...Wf}),[m]),S=a||l,g=xt("span",t,{enabled:S,ref:[n,d],state:p,stateAttributesMapping:y,props:s});return S?g:null});function gSe(e){const{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,...a}=e;return b.jsx(WEe,{...a,selectionMode:t?"multiple":"single",selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i})}const bSe=k.forwardRef(function(t,n){const r=t.keepMounted??!1,{selected:i}=Jte();return r||i?b.jsx(vSe,{...t,ref:n}):null}),vSe=k.memo(k.forwardRef((e,t)=>{const{render:n,className:r,keepMounted:i,...a}=e,{selected:s}=Jte(),o=k.useRef(null),{transitionStatus:l,setMounted:u}=Co(s),f=k.useMemo(()=>({selected:s,transitionStatus:l}),[s,l]),d=xt("span",e,{ref:[t,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:is});return Ai({open:s,ref:o,onComplete(){s||u(!1)}}),d})),ySe=k.createContext(void 0);function Jx(e=!0){const t=k.useContext(ySe);if(t===void 0&&!e)throw new Error(rn(25));return t}const nne=k.createContext(void 0);function CM(e){const t=k.useContext(nne);if(t===void 0&&!e)throw new Error(rn(33));return t}const rne=k.createContext(void 0);function nd(e){const t=k.useContext(rne);if(t===void 0&&!e)throw new Error(rn(36));return t}const ine={type:"regular-item"};function ane(e){const{closeOnClick:t,disabled:n=!1,highlighted:r,id:i,store:a,nativeButton:s,itemMetadata:o,nodeId:l}=e,u=k.useRef(null),f=Jx(!0),d=f!==void 0,{events:p}=a.useState("floatingTreeRoot"),{getButtonProps:m,buttonRef:y}=aa({disabled:n,focusableWhenDisabled:!0,native:s}),S=k.useCallback(_=>sl({id:i,role:"menuitem",tabIndex:r?0:-1,onMouseMove(v){l&&p.emit("itemhover",{nodeId:l,target:v.currentTarget})},onMouseEnter(){o.type==="submenu-trigger"&&o.setActive()},onKeyUp(v){v.key===" "&&a.context.typingRef.current&&v.preventBaseUIHandler()},onClick(v){t&&p.emit("close",{domEvent:v,reason:df})},onMouseUp(v){if(f){const x=f.initialCursorPointRef.current;if(f.initialCursorPointRef.current=null,d&&x&&Math.abs(v.clientX-x.x)<=1&&Math.abs(v.clientY-x.y)<=1)return}u.current&&a.context.allowMouseUpTriggerRef.current&&(!d||v.button===2)&&o.type==="regular-item"&&u.current.click()}},_,m),[i,r,m,t,p,a,d,f,o,l]),g=js(u,y);return k.useMemo(()=>({getItemProps:S,itemRef:g}),[S,g])}let uz=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const sne={checked(e){return e?{[uz.checked]:""}:{[uz.unchecked]:""}},...is},_Se=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!0,...f}=t,d=km({label:s}),p=CM(!0),m=fi(a),{store:y}=nd(),S=y.useState("isActive",d.index),g=y.useState("itemProps"),{getItemProps:_,itemRef:v}=ane({closeOnClick:u,disabled:l,highlighted:S,id:m,store:y,nativeButton:o,nodeId:p?.nodeId,itemMetadata:ine}),x=k.useMemo(()=>({disabled:l,highlighted:S}),[l,S]);return xt("div",t,{state:x,props:[g,f,_],ref:[v,n,d.ref]})}),ESe={...ka,...is},SSe=k.forwardRef(function(t,n){const{render:r,className:i,finalFocus:a,...s}=t,{store:o}=nd(),{side:l,align:u}=CM(),f=_M()!=null,d=o.useState("open"),p=o.useState("transitionStatus"),m=o.useState("popupProps"),y=o.useState("mounted"),S=o.useState("instantType"),g=o.useState("activeTriggerElement"),_=o.useState("parent"),v=o.useState("lastOpenChangeReason"),x=o.useState("rootId"),T=o.useState("floatingRootContext"),w=o.useState("floatingTreeRoot"),C=o.useState("closeDelay"),R=o.useState("activeTriggerElement");Ai({open:d,ref:o.context.popupRef,onComplete(){d&&o.context.onOpenChangeComplete?.(!0)}}),k.useEffect(()=>{function M(V){o.setOpen(!1,it(V.reason,V.domEvent))}return w.events.on("close",M),()=>{w.events.off("close",M)}},[w.events,o]);const O=o.useState("hoverEnabled"),N=o.useState("disabled");Lee(T,{enabled:O&&!N&&_.type!=="context-menu"&&_.type!=="menubar",closeDelay:C});const L=k.useMemo(()=>({transitionStatus:p,side:l,align:u,open:d,nested:_.type==="menu",instant:S}),[p,l,u,d,_.type,S]),D=xt("div",t,{state:L,ref:[n,o.context.popupRef],stateAttributesMapping:ESe,props:[m,{onKeyDown(M){f&&oM.has(M.key)&&M.stopPropagation()}},Om(p),s,{"data-rootownerid":x}]});let z=_.type===void 0||_.type==="context-menu";return(g||_.type==="menubar"&&v!==Lx)&&(z=!0),b.jsx(Px,{context:T,modal:!1,disabled:!y,returnFocus:a===void 0?z:a,initialFocus:_.type!=="menu",restoreFocus:!0,externalTree:_.type!=="menubar"?w:void 0,previousFocusableElement:R,nextFocusableElement:_.type===void 0?o.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?o.context.beforeContentFocusGuardRef:void 0,children:D})}),one=k.createContext(void 0);function xSe(){const e=k.useContext(one);if(e===void 0)throw new Error(rn(32));return e}const wSe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t,{store:a}=nd();return a.useState("mounted")||r?b.jsx(one.Provider,{value:r,children:b.jsx(Ly,{ref:n,...i})}):null}),TSe=k.forwardRef(function(t,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o,align:l,sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:y=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=Ix,..._}=t,{store:v}=nd(),x=xSe(),T=Jx(!0),w=v.useState("parent"),C=v.useState("floatingRootContext"),R=v.useState("floatingTreeRoot"),O=v.useState("mounted"),N=v.useState("open"),L=v.useState("modal"),D=v.useState("activeTriggerElement"),z=v.useState("lastOpenChangeReason"),M=v.useState("floatingNodeId"),V=v.useState("floatingParentNodeId");let W=r,$=u,q=f,Y=l,B=g;w.type==="context-menu"&&(W=r??w.context?.anchor,Y=Y??"start",!o&&Y!=="center"&&(q=t.alignOffset??2,$=t.sideOffset??-5));let j=o,U=Y;w.type==="menu"?(j=j??"inline-end",U=U??"start",B=t.collisionAvoidance??LP):w.type==="menubar"&&(j=j??"bottom",U=U??"start");const K=w.type==="context-menu",H=By({anchor:W,floatingRootContext:C,positionMethod:T?"fixed":i,mounted:O,side:j,sideOffset:$,align:U,alignOffset:q,arrowPadding:K?0:m,collisionBoundary:d,collisionPadding:p,sticky:y,nodeId:M,keepMounted:x,disableAnchorTracking:S,collisionAvoidance:B,shiftCrossAxis:K,externalTree:R}),J=k.useMemo(()=>{const ee={};return N||(ee.pointerEvents="none"),{role:"presentation",hidden:!O,style:{...H.positionerStyles,...ee}}},[N,O,H.positionerStyles]);k.useEffect(()=>{function ee(ne){ne.open?(ne.parentNodeId===M&&v.set("hoverEnabled",!1),ne.nodeId!==M&&ne.parentNodeId===v.select("floatingParentNodeId")&&v.setOpen(!1,it(kb))):ne.parentNodeId===M&&ne.reason!==kb&&v.set("hoverEnabled",!0)}return R.events.on("menuopenchange",ee),()=>{R.events.off("menuopenchange",ee)}},[v,R.events,M]),k.useEffect(()=>{if(v.select("floatingParentNodeId")==null)return;function ee(ne){if(ne.open||ne.nodeId!==v.select("floatingParentNodeId"))return;const te=ne.reason??kb;v.setOpen(!1,it(te))}return R.events.on("menuopenchange",ee),()=>{R.events.off("menuopenchange",ee)}},[R.events,v]),k.useEffect(()=>{function ee(ne){!N||ne.nodeId!==v.select("floatingParentNodeId")||ne.target&&D&&D!==ne.target&&v.setOpen(!1,it(kb))}return R.events.on("itemhover",ee),()=>{R.events.off("itemhover",ee)}},[R.events,N,D,v]),k.useEffect(()=>{const ee={open:N,nodeId:M,parentNodeId:V,reason:v.select("lastOpenChangeReason")};R.events.emit("menuopenchange",ee)},[R.events,N,v,M,V]);const se=k.useMemo(()=>({open:N,side:H.side,align:H.align,anchorHidden:H.anchorHidden,nested:w.type==="menu"}),[N,H.side,H.align,H.anchorHidden,w.type]),ae=k.useMemo(()=>({side:H.side,align:H.align,arrowRef:H.arrowRef,arrowUncentered:H.arrowUncentered,arrowStyles:H.arrowStyles,nodeId:H.context.nodeId}),[H.side,H.align,H.arrowRef,H.arrowUncentered,H.arrowStyles,H.context.nodeId]),Q=xt("div",t,{state:se,stateAttributesMapping:ka,ref:[n,v.useStateSetter("positionerElement")],props:[J,_]}),G=O&&w.type!=="menu"&&(w.type!=="menubar"&&L&&z!==dr||w.type==="menubar"&&w.context.modal);let Z=null;return w.type==="menubar"?Z=w.context.contentElement:w.type===void 0&&(Z=D),b.jsxs(nne.Provider,{value:ae,children:[G&&b.jsx(Kx,{ref:w.type==="context-menu"||w.type==="nested-context-menu"?w.context.internalBackdropRef:null,inert:Am(!N),cutout:Z}),b.jsx(pee,{id:M,children:b.jsx(My,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:Q})})]})}),lne=k.createContext(void 0);function CSe(){const e=k.useContext(lne);if(e===void 0)throw new Error(rn(34));return e}const ASe=k.memo(k.forwardRef(function(t,n){const{render:r,className:i,value:a,defaultValue:s,onValueChange:o,disabled:l=!1,...u}=t,[f,d]=Ja({controlled:a,default:s,name:"MenuRadioGroup"}),p=Xe(o),m=Xe((_,v)=>{p?.(_,v),!v.isCanceled&&d(_)}),y=k.useMemo(()=>({disabled:l}),[l]),S=xt("div",t,{state:y,ref:n,props:{role:"group","aria-disabled":l||void 0,...u}}),g=k.useMemo(()=>({value:f,setValue:m,disabled:l}),[f,m,l]);return b.jsx(lne.Provider,{value:g,children:S})})),une=k.createContext(void 0);function kSe(){const e=k.useContext(une);if(e===void 0)throw new Error(rn(35));return e}const OSe=k.forwardRef(function(t,n){const{render:r,className:i,id:a,label:s,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!1,value:f,...d}=t,p=km({label:s}),m=CM(!0),y=fi(a),{store:S}=nd(),g=S.useState("isActive",p.index),_=S.useState("itemProps"),{value:v,setValue:x,disabled:T}=CSe(),w=T||l,C=v===f,{getItemProps:R,itemRef:O}=ane({closeOnClick:u,disabled:w,highlighted:g,id:y,store:S,nativeButton:o,nodeId:m?.nodeId,itemMetadata:ine}),N=k.useMemo(()=>({disabled:w,highlighted:g,checked:C}),[w,g,C]),L=Xe(z=>{const M={...it(df,z.nativeEvent),preventUnmountOnClose:()=>{}};x(f,M)}),D=xt("div",t,{state:N,stateAttributesMapping:sne,props:[_,{role:"menuitemradio","aria-checked":C,onClick:L},d,R],ref:[O,n,p.ref]});return b.jsx(une.Provider,{value:N,children:D})}),RSe=k.forwardRef(function(t,n){const{render:r,className:i,keepMounted:a=!1,...s}=t,o=kSe(),l=k.useRef(null),{transitionStatus:u,setMounted:f}=Co(o.checked);Ai({open:o.checked,ref:l,onComplete(){o.checked||f(!1)}});const d=k.useMemo(()=>({checked:o.checked,disabled:o.disabled,highlighted:o.highlighted,transitionStatus:u}),[o.checked,o.disabled,o.highlighted,u]);return xt("span",t,{state:d,stateAttributesMapping:sne,ref:[n,l],props:{"aria-hidden":!0,...s},enabled:a||o.checked})}),NSe=k.createContext(null);function cne(e){return k.useContext(NSe)}const ISe={...nM,disabled:Be(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Be(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Be(e=>e.parent.type==="menu"?e.parent.store.select("allowMouseEnter"):e.allowMouseEnter),stickIfOpen:Be(e=>e.stickIfOpen),parent:Be(e=>e.parent),rootId:Be(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Be(e=>e.activeIndex),isActive:Be((e,t)=>e.activeIndex===t),hoverEnabled:Be(e=>e.hoverEnabled),instantType:Be(e=>e.instantType),lastOpenChangeReason:Be(e=>e.openChangeReason),floatingTreeRoot:Be(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Be(e=>e.floatingNodeId),floatingParentNodeId:Be(e=>e.floatingParentNodeId),itemProps:Be(e=>e.itemProps),closeDelay:Be(e=>e.closeDelay),keyboardEventRelay:Be(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class AM extends jx{constructor(t){super({...DSe(),...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 Py},ISe),this.observe(Be(n=>n.allowMouseEnter),(n,r)=>{this.state.parent.type==="menu"&&n!==r&&this.state.parent.store.set("allowMouseEnter",n)}),this.unsubscribeParentListener=this.observe("parent",n=>{if(this.unsubscribeParentListener?.(),n.type==="menu"){this.unsubscribeParentListener=n.store.subscribe(()=>{this.notifyAll()}),this.context.allowMouseUpTriggerRef=n.store.context.allowMouseUpTriggerRef;return}n.type!==void 0&&(this.context.allowMouseUpTriggerRef=n.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,n){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:n})}static useStore(t,n){return di(()=>t??new AM(n)).current}unsubscribeParentListener=null}function DSe(){return{...tM(),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 VP,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Jn,keyboardEventRelay:void 0,closeDelay:0}}const LSe=k.createContext(void 0);function PSe(){return k.useContext(LSe)}function MSe(e){const{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:s=!1,modal:o,loopFocus:l=!0,orientation:u="vertical",actionsRef:f,closeParentOnEsc:d=!1,handle:p,triggerId:m,defaultTriggerId:y=null,highlightItemOnHover:S=!0}=e,g=Jx(!0),_=nd(!0),v=cne(),x=PSe(),T=k.useMemo(()=>x&&_?{type:"menu",store:_.store}:v?{type:"menubar",context:v}:g&&!_?{type:"context-menu",context:g}:{type:void 0},[g,_,v,x]),w=AM.useStore(p?.store,{parent:T}),C=w.useState("floatingTreeRoot"),R=GP(C),O=wo();Je(()=>{g&&!_?w.update({parent:{type:"context-menu",context:g},floatingNodeId:R,floatingParentNodeId:O}):_&&w.update({floatingNodeId:R,floatingParentNodeId:O})},[g,_,R,O,w]),w.useControlledProp("open",n,a),w.useControlledProp("activeTriggerId",m,y),w.useContextCallback("onOpenChangeComplete",i);const N=w.useState("open"),L=w.useState("activeTriggerElement"),D=w.useState("positionerElement"),z=w.useState("hoverEnabled"),M=w.useState("modal"),V=w.useState("disabled"),W=w.useState("lastOpenChangeReason"),$=w.useState("parent"),q=w.useState("activeIndex"),Y=w.useState("payload"),B=w.useState("floatingParentNodeId"),j=k.useRef(null),U=B!=null;let K;w.useSyncedValues({disabled:s,modal:$.type===void 0?o:void 0,rootId:Zc()});const{openMethod:H,triggerProps:J,reset:se}=Xx(N);JP(w);const{forceUnmount:ae}=eM(N,w,()=>{w.update({allowMouseEnter:!1,stickIfOpen:!0}),se()}),Q=k.useRef($.type!=="context-menu"),G=Pn();k.useEffect(()=>{if(N||(j.current=null),$.type==="context-menu"){if(!N){G.clear(),Q.current=!1;return}G.start(500,()=>{Q.current=!0})}},[G,N,$.type]),Yx(N&&M&&W!==dr&&H!=="touch",D),Je(()=>{!N&&!z&&w.set("hoverEnabled",!0)},[N,z,w]);const Z=k.useRef(!0),ee=Pn(),ne=Xe((Fe,ht)=>{const Ne=ht.reason;if(N===Fe&&ht.trigger===L||(ht.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},!Fe&&ht.trigger==null&&(ht.trigger=L??void 0),r?.(Fe,ht),ht.isCanceled))return;const ze={open:Fe,nativeEvent:ht.event,reason:ht.reason,nested:U};K?.emit("openchange",ze);const et=ht.event;if(Fe===!1&&et?.type==="click"&&et.pointerType==="touch"&&!Z.current)return;if(!Fe&&q!==null){const Ft=w.context.itemDomElements.current[q];queueMicrotask(()=>{Ft?.setAttribute("tabindex","-1")})}Fe&&Ne===bv?(Z.current=!1,ee.start(300,()=>{Z.current=!0})):(Z.current=!0,ee.clear());const lt=(Ne===iu||Ne===df)&&et.detail===0&&et?.isTrusted,pt=!Fe&&(Ne===Dy||Ne==null);function gn(){const Ft={open:Fe,openChangeReason:Ne};j.current=ht.event??null;const Nt=ht.trigger?.id??null;(Nt||Fe)&&(Ft.activeTriggerId=Nt,Ft.activeTriggerElement=ht.trigger??null),w.update(Ft)}Ne===dr?xr.flushSync(gn):gn(),$.type==="menubar"&&(Ne===bv||Ne===ho||Ne===dr||Ne===mp||Ne===kb)?w.set("instantType","group"):lt||pt?w.set("instantType",lt?"click":"dismiss"):w.set("instantType",void 0)}),te=k.useCallback(Fe=>{const ht=it(Fe);return ht.preventUnmountOnClose=()=>{w.set("preventUnmountingOnClose",!0)},ht},[w]),be=k.useCallback(()=>{w.setOpen(!1,te(qP))},[w,te]);k.useImperativeHandle(f,()=>({unmount:ae,close:be}),[ae,be]);let _e;$.type==="context-menu"&&(_e=$.context),k.useImperativeHandle(_e?.positionerRef,()=>D,[D]),k.useImperativeHandle(_e?.actionsRef,()=>({setOpen:ne}),[ne]);const he=rM({popupStore:w,onOpenChange:ne});K=he.context.events,k.useEffect(()=>{const Fe=({open:ht,eventDetails:Ne})=>ne(ht,Ne);return K.on("setOpen",Fe),()=>{K?.off("setOpen",Fe)}},[K,ne]);const ye=Cm(he,{enabled:!V,bubbles:d&&$.type==="menu",outsidePress(){return $.type!=="context-menu"||j.current?.type==="contextmenu"?!0:Q.current},externalTree:U?C:void 0}),Ee=Mee(he,{role:"menu"}),xe=Cu(),ve=k.useCallback(Fe=>{w.select("activeIndex")!==Fe&&w.set("activeIndex",Fe)},[w]),De=iM(he,{enabled:!V,listRef:w.context.itemDomElements,activeIndex:q,nested:$.type!==void 0,loopFocus:l,orientation:u,parentOrientation:$.type==="menubar"?$.context.orientation:void 0,rtl:xe==="rtl",disabledIndices:ea,onNavigate:ve,openOnArrowKeyDown:$.type!=="context-menu",externalTree:U?C:void 0,focusItemOnHover:S}),Te=k.useCallback(Fe=>{w.context.typingRef.current=Fe},[w]),pe=aM(he,{listRef:w.context.itemLabels,activeIndex:q,resetMs:obe,onMatch:Fe=>{N&&Fe!==q&&w.set("activeIndex",Fe)},onTypingChange:Te}),{getReferenceProps:ce,getFloatingProps:Re,getItemProps:Pe,getTriggerProps:ge}=Qc([ye,Ee,De,pe]),Le=k.useMemo(()=>{const Fe=sl(ce(),{onMouseEnter(){w.set("hoverEnabled",!0)},onMouseMove(){w.set("allowMouseEnter",!0)}},J);return delete Fe.role,Fe},[ce,w,J]),Ce=k.useMemo(()=>{const Fe=ge();if(!Fe)return Fe;const ht=sl(Fe,J);return delete ht.role,delete ht["aria-controls"],ht},[ge,J]),Ve=au(),Ze=k.useMemo(()=>Re({onMouseEnter(){$.type==="menu"&&Ve.request(()=>w.set("hoverEnabled",!1))},onMouseMove(){w.set("allowMouseEnter",!0)},onClick(){w.select("hoverEnabled")&&w.set("hoverEnabled",!1)},onKeyDown(Fe){const ht=w.select("keyboardEventRelay");ht&&!Fe.isPropagationStopped()&&ht(Fe)}}),[Re,$.type,Ve,w]),gt=k.useMemo(()=>Pe(),[Pe]);w.useSyncedValues({floatingRootContext:he,activeTriggerProps:Le,inactiveTriggerProps:Ce,popupProps:Ze,itemProps:gt});const st=k.useMemo(()=>({store:w,parent:T}),[w,T]),ot=b.jsx(rne.Provider,{value:st,children:typeof t=="function"?t({payload:Y}):t});return $.type===void 0||$.type==="context-menu"?b.jsx(mee,{externalTree:C,children:ot}):ot}function dne(e){if(Qn(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!Xo(e))return dne(al(e))}function jSe(e){const{enabled:t=!0,mouseDownAction:n,open:r}=e,i=k.useRef(!1);return k.useMemo(()=>t?{onMouseDown:a=>{(n==="open"&&!r||n==="close"&&r)&&(i.current=!0,Ci(a.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:a=>{i.current&&(i.current=!1,a.preventBaseUIHandler())}}:Jn,[t,n,r])}const g_=2,FSe=k.forwardRef(function(t,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,id:o,openOnHover:l,delay:u=100,closeDelay:f=0,handle:d,payload:p,...m}=t,y=nd(!0),S=d?.store??y?.store;if(!S)throw new Error(rn(85));const g=fi(o),_=S.useState("isTriggerActive",g),v=S.useState("floatingRootContext"),x=S.useState("isOpenedByTrigger",g),T=k.useRef(null),w=USe(),C=IP(!0),R=To(),O=k.useMemo(()=>R??new VP,[R]),N=GP(O),L=wo(),{registerTrigger:D,isMountedByThisTrigger:z}=QP(g,T,S,{payload:p,closeDelay:f,parent:w,floatingTreeRoot:O,floatingNodeId:N,floatingParentNodeId:L,keyboardEventRelay:C?.relayKeyboardEvent}),M=S.useState("disabled"),V=a||M||w.type==="menubar"&&w.context.disabled,{getButtonProps:W,buttonRef:$}=aa({disabled:V,native:s});k.useEffect(()=>{!x&&w.type===void 0&&(S.context.allowMouseUpTriggerRef.current=!1)},[S,x,w.type]);const q=k.useRef(null),Y=Pn(),B=Xe(Ee=>{if(!q.current)return;Y.clear(),S.context.allowMouseUpTriggerRef.current=!1;const xe=Ee.target;if(Tt(q.current,xe)||Tt(S.select("positionerElement"),xe)||xe===q.current||xe!=null&&dne(xe)===S.select("rootId"))return;const ve=vM(q.current);Ee.clientX>=ve.left-g_&&Ee.clientX<=ve.right+g_&&Ee.clientY>=ve.top-g_&&Ee.clientY<=ve.bottom+g_||O.events.emit("close",{domEvent:Ee,reason:gee})});k.useEffect(()=>{x&&S.select("lastOpenChangeReason")===dr&&Ci(q.current).addEventListener("mouseup",B,{once:!0})},[x,B,S]);const j=w.type==="menubar"&&w.context.hasSubmenuOpen,K=Pee(v,{enabled:(l??j??!1)&&!V&&w.type!=="context-menu"&&(w.type!=="menubar"||j&&!z),handleClose:sM({blockPointerEvents:w.type!=="menubar"}),mouseOnly:!0,move:!1,restMs:w.type===void 0?u:void 0,delay:{close:f},triggerElementRef:T,externalTree:O,isActiveTrigger:_}),H=BSe(x,S.select("lastOpenChangeReason")),J=Tm(v,{enabled:!V&&w.type!=="context-menu",event:x&&w.type==="menubar"?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0?H:!1}),se=Iee(v,{enabled:!V&&(w.type!=="menubar"&&x||j)}),ae=jSe({open:x,enabled:w.type==="menubar",mouseDownAction:"open"}),Q=Qc([J,se]),G=w.type==="menubar",Z=k.useMemo(()=>({disabled:V,open:x}),[V,x]),ee=S.useState("triggerProps",z),ne=[q,n,$,D,T],te=[Q.getReferenceProps(),K??Jn,ee,{"aria-haspopup":"menu",id:g,onMouseDown:Ee=>{if(S.select("open"))return;Y.start(200,()=>{S.context.allowMouseUpTriggerRef.current=!0}),Ci(Ee.currentTarget).addEventListener("mouseup",B,{once:!0})}},G?{role:"menuitem"}:{},ae,m,W],be=k.useRef(null),_e=Xe(Ee=>{xr.flushSync(()=>{S.setOpen(!1,it(ho,Ee.nativeEvent,Ee.currentTarget))}),Bve(be.current)?.focus()}),he=Xe(Ee=>{const xe=S.select("positionerElement");if(xe&&oo(Ee,xe))S.context.beforeContentFocusGuardRef.current?.focus();else{xr.flushSync(()=>{S.setOpen(!1,it(ho,Ee.nativeEvent,Ee.currentTarget))});let ve=Fve(T.current);for(;ve!==null&&Tt(xe,ve)||ve?.hasAttribute("aria-hidden");){const De=ve;if(ve=Iy(ve),ve===De)break}ve?.focus()}}),ye=xt("button",t,{enabled:!G,stateAttributesMapping:Ip,state:Z,ref:ne,props:te});return G?b.jsx(Wx,{tag:"button",render:r,className:i,state:Z,refs:ne,props:te,stateAttributesMapping:Ip}):x?b.jsxs(k.Fragment,{children:[b.jsx(ol,{ref:be,onFocus:_e},`${g}-pre-focus-guard`),b.jsx(k.Fragment,{children:ye},g),b.jsx(ol,{ref:S.context.triggerFocusTargetRef,onFocus:he},`${g}-post-focus-guard`)]}):b.jsx(k.Fragment,{children:ye},g)});function BSe(e,t){const n=Pn(),[r,i]=k.useState(!1);return Je(()=>{e&&t==="trigger-hover"?(i(!0),n.start(CJ,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function USe(){const e=Jx(!0),t=nd(!0),n=cne();return k.useMemo(()=>n?{type:"menubar",context:n}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,n])}function Kl(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const $Se=typeof ResizeObserver<"u",zSe=()=>!0;function HSe(e){const{popupElement:t,positionerElement:n,content:r,mounted:i,enabled:a=zSe,onMeasureLayout:s,onMeasureLayoutComplete:o,side:l,direction:u}=e,f=k.useRef(!0),d=ZP(t,!0,!1),p=au(),m=k.useRef(null),y=Xe(s),S=Xe(o),g=k.useMemo(()=>{let _=l==="top",v=l==="left";return u==="rtl"?(_=_||l==="inline-end",v=v||l==="inline-end"):(_=_||l==="inline-start",v=v||l==="inline-start"),_?{position:"absolute",[l==="top"?"bottom":"top"]:"0",[v?"right":"left"]:"0"}:Jn},[l,u]);Je(()=>{if(!i||!a()||!$Se){f.current=!0,m.current=null;return}if(!t||!n)return;Object.entries(g).forEach(([N,L])=>{t.style.setProperty(N,L)});const _=new ResizeObserver(N=>{const L=N[0];L&&(m.current===null?m.current={width:Math.ceil(L.borderBoxSize[0].inlineSize),height:Math.ceil(L.borderBoxSize[0].blockSize)}:(m.current.width=Math.ceil(L.borderBoxSize[0].inlineSize),m.current.height=Math.ceil(L.borderBoxSize[0].blockSize)))});_.observe(t),t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto");const v=ab(t,"position","static"),x=ab(t,"transform","none"),T=ab(t,"scale","1"),w=ab(n,"--available-width","max-content"),C=ab(n,"--available-height","max-content");if(y?.(),f.current||m.current===null){n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const N=yv(t);return n.style.setProperty("--positioner-width",`${N.width}px`),n.style.setProperty("--positioner-height",`${N.height}px`),v(),x(),T(),w(),C(),S?.(null,N),f.current=!1,()=>{_.disconnect()}}t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto"),n.style.setProperty("--positioner-width","max-content"),n.style.setProperty("--positioner-height","max-content");const R=yv(t);t.style.setProperty("--popup-width",`${m.current.width}px`),t.style.setProperty("--popup-height",`${m.current.height}px`),v(),x(),w(),C(),S?.(m.current,R),n.style.setProperty("--positioner-width",`${R.width}px`),n.style.setProperty("--positioner-height",`${R.height}px`);const O=new AbortController;return p.request(()=>{t.style.setProperty("--popup-width",`${R.width}px`),t.style.setProperty("--popup-height",`${R.height}px`),d(()=>{t.style.setProperty("--popup-width","auto"),t.style.setProperty("--popup-height","auto")},O.signal)}),()=>{_.disconnect(),O.abort(),p.cancel()}},[r,t,n,d,p,a,i,y,S,g])}function ab(e,t,n){const r=e.style.getPropertyValue(t);return e.style.setProperty(t,n),()=>{e.style.setProperty(t,r)}}const WSe=k.forwardRef(function(t,n){const{children:r,container:i,className:a,render:s,...o}=t,{portalNode:l,portalSubtree:u}=Eee({container:i,ref:n,componentProps:t,elementProps:o});return!u&&!l?null:b.jsxs(k.Fragment,{children:[u,l&&xr.createPortal(r,l)]})}),fne=k.createContext(void 0);function ew(){const e=k.useContext(fne);if(e===void 0)throw new Error(rn(53));return e}let KE=(function(e){return e.scrollAreaCornerHeight="--scroll-area-corner-height",e.scrollAreaCornerWidth="--scroll-area-corner-width",e})({});const b_=500,cz=16;function Rs(e,t,n){if(!e)return 0;const r=getComputedStyle(e),i=n==="x"?"Inline":"Block";return n==="x"&&t==="margin"?parseFloat(r[`${t}InlineStart`])*2:parseFloat(r[`${t}${i}Start`])+parseFloat(r[`${t}${i}End`])}let VSe=(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})({}),Wh=(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 kM={hasOverflowX:e=>e?{[Wh.hasOverflowX]:""}:null,hasOverflowY:e=>e?{[Wh.hasOverflowY]:""}:null,overflowXStart:e=>e?{[Wh.overflowXStart]:""}:null,overflowXEnd:e=>e?{[Wh.overflowXEnd]:""}:null,overflowYStart:e=>e?{[Wh.overflowYStart]:""}:null,overflowYEnd:e=>e?{[Wh.overflowYEnd]:""}:null,cornerHidden:()=>null},dz={width:0,height:0},GSe={xStart:!1,xEnd:!1,yStart:!1,yEnd:!1},qSe=k.forwardRef(function(t,n){const{render:r,className:i,overflowEdgeThreshold:a,...s}=t,[o,l]=k.useState(!1),[u,f]=k.useState(!1),[d,p]=k.useState(!1),[m,y]=k.useState(dz),[S,g]=k.useState(dz),[_,v]=k.useState(!1),[x,T]=k.useState(GSe),w=fi(),C=k.useRef(null),R=k.useRef(null),O=k.useRef(null),N=k.useRef(null),L=k.useRef(null),D=k.useRef(null),z=k.useRef(null),M=k.useRef(!1),V=k.useRef(0),W=k.useRef(0),$=k.useRef(0),q=k.useRef(0),Y=k.useRef("vertical"),B=Pn(),j=Pn(),U=k.useRef({x:0,y:0}),[K,H]=k.useState({scrollbarYHidden:!1,scrollbarXHidden:!1,cornerHidden:!1}),J=KSe(a),se=Xe(_e=>{const he=_e.x-U.current.x,ye=_e.y-U.current.y;U.current=_e,ye!==0&&(p(!0),B.start(b_,()=>{p(!1)})),he!==0&&(f(!0),j.start(b_,()=>{f(!1)}))}),ae=Xe(_e=>{_e.button===0&&(M.current=!0,V.current=_e.clientY,W.current=_e.clientX,Y.current=_e.currentTarget.getAttribute(VSe.orientation),R.current&&($.current=R.current.scrollTop,q.current=R.current.scrollLeft),L.current&&Y.current==="vertical"&&L.current.setPointerCapture(_e.pointerId),D.current&&Y.current==="horizontal"&&D.current.setPointerCapture(_e.pointerId))}),Q=Xe(_e=>{if(!M.current)return;const he=_e.clientY-V.current,ye=_e.clientX-W.current;if(R.current){const Ee=R.current.scrollHeight,xe=R.current.clientHeight,ve=R.current.scrollWidth,De=R.current.clientWidth;if(L.current&&O.current&&Y.current==="vertical"){const Te=Rs(O.current,"padding","y"),pe=Rs(L.current,"margin","y"),ce=L.current.offsetHeight,Re=O.current.offsetHeight-ce-Te-pe,Pe=he/Re;R.current.scrollTop=$.current+Pe*(Ee-xe),_e.preventDefault(),p(!0),B.start(b_,()=>{p(!1)})}if(D.current&&N.current&&Y.current==="horizontal"){const Te=Rs(N.current,"padding","x"),pe=Rs(D.current,"margin","x"),ce=D.current.offsetWidth,Re=N.current.offsetWidth-ce-Te-pe,Pe=ye/Re;R.current.scrollLeft=q.current+Pe*(ve-De),_e.preventDefault(),f(!0),j.start(b_,()=>{f(!1)})}}}),G=Xe(_e=>{M.current=!1,L.current&&Y.current==="vertical"&&L.current.releasePointerCapture(_e.pointerId),D.current&&Y.current==="horizontal"&&D.current.releasePointerCapture(_e.pointerId)});function Z(_e){const he=_e.pointerType==="touch";if(v(he),!he){const ye=Tt(C.current,_e.target);l(ye)}}const ee=k.useMemo(()=>({hasOverflowX:!K.scrollbarXHidden,hasOverflowY:!K.scrollbarYHidden,overflowXStart:x.xStart,overflowXEnd:x.xEnd,overflowYStart:x.yStart,overflowYEnd:x.yEnd,cornerHidden:K.cornerHidden}),[K.scrollbarXHidden,K.scrollbarYHidden,K.cornerHidden,x]),ne={role:"presentation",onPointerEnter:Z,onPointerMove:Z,onPointerDown({pointerType:_e}){v(_e==="touch")},onPointerLeave(){l(!1)},style:{position:"relative",[KE.scrollAreaCornerHeight]:`${m.height}px`,[KE.scrollAreaCornerWidth]:`${m.width}px`}},te=xt("div",t,{state:ee,ref:[n,C],props:[ne,s],stateAttributesMapping:kM}),be=k.useMemo(()=>({handlePointerDown:ae,handlePointerMove:Q,handlePointerUp:G,handleScroll:se,cornerSize:m,setCornerSize:y,thumbSize:S,setThumbSize:g,touchModality:_,cornerRef:z,scrollingX:u,setScrollingX:f,scrollingY:d,setScrollingY:p,hovering:o,setHovering:l,viewportRef:R,rootRef:C,scrollbarYRef:O,scrollbarXRef:N,thumbYRef:L,thumbXRef:D,rootId:w,hiddenState:K,setHiddenState:H,overflowEdges:x,setOverflowEdges:T,viewportState:ee,overflowEdgeThreshold:J}),[ae,Q,G,se,m,S,_,z,u,f,d,p,o,l,R,C,O,N,L,D,w,K,x,ee,J]);return b.jsxs(fne.Provider,{value:be,children:[Sv.element,te]})});function KSe(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 YSe=k.createContext(void 0);function XSe(e,t){if(typeof IntersectionObserver>"u")return()=>{};const n=new IntersectionObserver(r=>{r.forEach(i=>{i.intersectionRatio>0&&(t(),n.disconnect())})});return n.observe(e),()=>{n.disconnect()}}let 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})({}),fz=!1;function ZSe(){fz||jP||(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{}}),fz=!0)}const QSe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{viewportRef:s,scrollbarYRef:o,scrollbarXRef:l,thumbYRef:u,thumbXRef:f,cornerRef:d,setCornerSize:p,setThumbSize:m,rootId:y,setHiddenState:S,hiddenState:g,handleScroll:_,setHovering:v,setOverflowEdges:x,overflowEdges:T,overflowEdgeThreshold:w}=ew(),C=Cu(),R=k.useRef(!0),O=Pn(),N=Pn();function L(){const q=s.current,Y=o.current,B=l.current,j=u.current,U=f.current,K=d.current;if(!q)return;const H=q.scrollHeight,J=q.scrollWidth,se=q.clientHeight,ae=q.clientWidth,Q=q.scrollTop,G=q.scrollLeft;if(H===0||J===0)return;const Z=se>=H,ee=ae>=J,ne=ae/J,te=se/H,be=Math.max(0,J-ae),_e=Math.max(0,H-se);let he=0,ye=0;ee||(C==="rtl"?he=Kl(-G,0,be):he=Kl(G,0,be),ye=be-he);const Ee=Z?0:Kl(Q,0,_e),xe=Z?0:_e-Ee,ve=ee?0:ae,De=Z?0:se,Te=Rs(B,"padding","x"),pe=Rs(Y,"padding","y"),ce=Rs(U,"margin","x"),Re=Rs(j,"margin","y"),Pe=ve-Te-ce,ge=De-pe-Re,Le=B?Math.min(B.offsetWidth,Pe):Pe,Ce=Y?Math.min(Y.offsetHeight,ge):ge,Ve=Math.max(cz,Le*ne),Ze=Math.max(cz,Ce*te);if(m(ze=>ze.height===Ze&&ze.width===Ve?ze:{width:Ve,height:Ze}),Y&&j){const ze=Y.offsetHeight-Ze-pe-Re,et=H-se,lt=et===0?0:Q/et,pt=Math.min(ze,Math.max(0,lt*ze));j.style.transform=`translate3d(0,${pt}px,0)`}if(B&&U){const ze=B.offsetWidth-Ve-Te-ce,et=J-ae,lt=et===0?0:G/et,pt=C==="rtl"?Kl(lt*ze,-ze,0):Kl(lt*ze,0,ze);U.style.transform=`translate3d(${pt}px,0,0)`}const gt=Kl(he,0,be),st=Kl(ye,0,be),ot=Kl(Ee,0,_e),Fe=Kl(xe,0,_e),ht=[[wc.scrollAreaOverflowXStart,gt],[wc.scrollAreaOverflowXEnd,st],[wc.scrollAreaOverflowYStart,ot],[wc.scrollAreaOverflowYEnd,Fe]];for(const[ze,et]of ht)q.style.setProperty(ze,`${et}px`);if(K){if(ee||Z)p({width:0,height:0});else if(!ee&&!Z){const ze=Y?.offsetWidth||0,et=B?.offsetHeight||0;p({width:ze,height:et})}}S(ze=>{const et=Z||ee;return ze.scrollbarYHidden===Z&&ze.scrollbarXHidden===ee&&ze.cornerHidden===et?ze:{scrollbarYHidden:Z,scrollbarXHidden:ee,cornerHidden:et}});const Ne={xStart:!ee&&gt>w.xStart,xEnd:!ee&&st>w.xEnd,yStart:!Z&&ot>w.yStart,yEnd:!Z&&Fe>w.yEnd};x(ze=>ze.xStart===Ne.xStart&&ze.xEnd===Ne.xEnd&&ze.yStart===Ne.yStart&&ze.yEnd===Ne.yEnd?ze:Ne)}const D=Xe(()=>{xr.flushSync(L)});Je(()=>s.current?(ZSe(),XSe(s.current,D)):void 0,[D,s]),Je(()=>{queueMicrotask(D)},[D,g,C]),Je(()=>{s.current?.matches(":hover")&&v(!0)},[s,v]),k.useEffect(()=>{const q=s.current;if(typeof ResizeObserver>"u"||!q)return;const Y=new ResizeObserver(D);return Y.observe(q),N.start(0,()=>{Promise.all(q.getAnimations({subtree:!0}).map(B=>B.finished)).then(D).catch(()=>{})}),()=>{Y.disconnect(),N.clear()}},[D,s,N]);function z(){R.current=!1}const M={role:"presentation",...y&&{"data-id":`${y}-viewport`},...(!g.scrollbarXHidden||!g.scrollbarYHidden)&&{tabIndex:0},className:Sv.className,style:{overflow:"scroll"},onScroll(){s.current&&(D(),R.current||_({x:s.current.scrollLeft,y:s.current.scrollTop}),O.start(100,()=>{R.current=!0}))},onWheel:z,onTouchMove:z,onPointerMove:z,onPointerEnter:z,onKeyDown:z},V=k.useMemo(()=>({hasOverflowX:!g.scrollbarXHidden,hasOverflowY:!g.scrollbarYHidden,overflowXStart:T.xStart,overflowXEnd:T.xEnd,overflowYStart:T.yStart,overflowYEnd:T.yEnd,cornerHidden:g.cornerHidden}),[g.scrollbarXHidden,g.scrollbarYHidden,g.cornerHidden,T]),W=xt("div",t,{ref:[n,s],state:V,props:[M,a],stateAttributesMapping:kM}),$=k.useMemo(()=>({computeThumbPosition:D}),[D]);return b.jsx(YSe.Provider,{value:$,children:W})}),hne=k.createContext(void 0);function JSe(){const e=k.useContext(hne);if(e===void 0)throw new Error(rn(54));return e}let YE=(function(e){return e.scrollAreaThumbHeight="--scroll-area-thumb-height",e.scrollAreaThumbWidth="--scroll-area-thumb-width",e})({});const exe=k.forwardRef(function(t,n){const{render:r,className:i,orientation:a="vertical",keepMounted:s=!1,...o}=t,{hovering:l,scrollingX:u,scrollingY:f,hiddenState:d,overflowEdges:p,scrollbarYRef:m,scrollbarXRef:y,viewportRef:S,thumbYRef:g,thumbXRef:_,handlePointerDown:v,handlePointerUp:x,rootId:T,thumbSize:w}=ew(),C=k.useMemo(()=>({hovering:l,scrolling:{horizontal:u,vertical:f}[a],orientation:a,hasOverflowX:!d.scrollbarXHidden,hasOverflowY:!d.scrollbarYHidden,overflowXStart:p.xStart,overflowXEnd:p.xEnd,overflowYStart:p.yStart,overflowYEnd:p.yEnd,cornerHidden:d.cornerHidden}),[l,u,f,a,d,p]),R=Cu();k.useEffect(()=>{const M=S.current,V=a==="vertical"?m.current:y.current;if(!V)return;function W($){if(!(!M||!V||$.ctrlKey)){if($.preventDefault(),a==="vertical"){if(M.scrollTop===0&&$.deltaY<0)return}else if(M.scrollLeft===0&&$.deltaX<0)return;if(a==="vertical"){if(M.scrollTop===M.scrollHeight-M.clientHeight&&$.deltaY>0)return}else if(M.scrollLeft===M.scrollWidth-M.clientWidth&&$.deltaX>0)return;a==="vertical"?M.scrollTop+=$.deltaY:M.scrollLeft+=$.deltaX}}return V.addEventListener("wheel",W,{passive:!1}),()=>{V.removeEventListener("wheel",W)}},[a,y,m,S]);const O={...T&&{"data-id":`${T}-scrollbar`},onPointerDown(M){if(M.button===0&&M.currentTarget===M.target&&S.current){if(g.current&&m.current&&a==="vertical"){const V=Rs(g.current,"margin","y"),W=Rs(m.current,"padding","y"),$=g.current.offsetHeight,q=m.current.getBoundingClientRect(),Y=M.clientY-q.top-$/2-W+V/2,B=S.current.scrollHeight,j=S.current.clientHeight,U=m.current.offsetHeight-$-W-V,H=Y/U*(B-j);S.current.scrollTop=H}if(_.current&&y.current&&a==="horizontal"){const V=Rs(_.current,"margin","x"),W=Rs(y.current,"padding","x"),$=_.current.offsetWidth,q=y.current.getBoundingClientRect(),Y=M.clientX-q.left-$/2-W+V/2,B=S.current.scrollWidth,j=S.current.clientWidth,U=y.current.offsetWidth-$-W-V,K=Y/U;let H;R==="rtl"?(H=(1-K)*(B-j),S.current.scrollLeft<=0&&(H=-H)):H=K*(B-j),S.current.scrollLeft=H}v(M)}},onPointerUp:x,style:{position:"absolute",touchAction:"none",WebkitUserSelect:"none",userSelect:"none",...a==="vertical"&&{top:0,bottom:`var(${KE.scrollAreaCornerHeight})`,insetInlineEnd:0,[YE.scrollAreaThumbHeight]:`${w.height}px`},...a==="horizontal"&&{insetInlineStart:0,insetInlineEnd:`var(${KE.scrollAreaCornerWidth})`,bottom:0,[YE.scrollAreaThumbWidth]:`${w.width}px`}}},N=xt("div",t,{ref:[n,a==="vertical"?m:y],state:C,props:[O,o],stateAttributesMapping:kM}),L=k.useMemo(()=>({orientation:a}),[a]),D=a==="vertical"?d.scrollbarYHidden:d.scrollbarXHidden;return s||!D?b.jsx(hne.Provider,{value:L,children:N}):null}),txe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{thumbYRef:s,thumbXRef:o,handlePointerDown:l,handlePointerMove:u,handlePointerUp:f,setScrollingX:d,setScrollingY:p}=ew(),{orientation:m}=JSe(),y=k.useMemo(()=>({orientation:m}),[m]);return xt("div",t,{ref:[n,m==="vertical"?s:o],state:y,props:[{onPointerDown:l,onPointerMove:u,onPointerUp(g){m==="vertical"&&p(!1),m==="horizontal"&&d(!1),f(g)},style:{...m==="vertical"&&{height:`var(${YE.scrollAreaThumbHeight})`},...m==="horizontal"&&{width:`var(${YE.scrollAreaThumbWidth})`}}},a]})}),nxe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{cornerRef:s,cornerSize:o,hiddenState:l}=ew(),u=xt("div",t,{ref:[n,s],props:[{style:{position:"absolute",bottom:0,insetInlineEnd:0,width:o.width,height:o.height}},a]});return l.cornerHidden?null:u}),pne=k.createContext(void 0);function rxe(){const e=k.useContext(pne);if(e===void 0)throw new Error(rn(63));return e}let hz=(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 mne={...Wf,checked(e){return e?{[hz.checked]:""}:{[hz.unchecked]:""}}},ixe=k.forwardRef(function(t,n){const{checked:r,className:i,defaultChecked:a,id:s,inputRef:o,name:l,nativeButton:u=!1,onCheckedChange:f,readOnly:d=!1,required:p=!1,disabled:m=!1,render:y,uncheckedValue:S,...g}=t,{clearErrors:_}=Hy(),{state:v,setTouched:x,setDirty:T,validityData:w,setFilled:C,setFocused:R,shouldValidateOnChange:O,validationMode:N,disabled:L,name:D,validation:z}=Fs(),{labelId:M}=td(),V=L||m,W=D??l,$=Xe(f),q=k.useRef(null),Y=js(q,o,z.inputRef),B=k.useRef(null),j=fi(),U=Zx({id:s,implicit:!1,controlRef:B}),[K,H]=Ja({controlled:r,default:!!a,name:"Switch",state:"checked"});Wy({id:j,commit:z.commit,value:K,controlRef:B,name:W,getValue:()=>K}),Je(()=>{q.current&&C(q.current.checked)},[q,C]),Jd(K,()=>{_(W),T(K!==w.initialValue),C(K),O()?z.commit(K):z.commit(K,!0)});const{getButtonProps:J,buttonRef:se}=aa({disabled:V,native:u}),ae={id:j,role:"switch","aria-checked":K,"aria-readonly":d||void 0,"aria-labelledby":M,onFocus(){V||R(!0)},onBlur(){const ee=q.current;!ee||V||(x(!0),R(!1),N==="onBlur"&&z.commit(ee.checked))},onClick(ee){d||V||(ee.preventDefault(),q?.current?.click())}},Q=k.useMemo(()=>sl({checked:K,disabled:V,id:U,name:W,required:p,style:wm,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:Y,onChange(ee){if(ee.nativeEvent.defaultPrevented)return;const ne=ee.target.checked,te=it(Dr,ee.nativeEvent);$?.(ne,te),!te.isCanceled&&H(ne)},onFocus(){B.current?.focus()}},z.getInputValidationProps),[K,V,Y,U,W,$,p,H,z]),G=k.useMemo(()=>({...v,checked:K,disabled:V,readOnly:d,required:p}),[v,K,V,d,p]),Z=xt("span",t,{state:G,ref:[n,B,se],props:[ae,z.getValidationProps,g,J],stateAttributesMapping:mne});return b.jsxs(pne.Provider,{value:G,children:[Z,!K&&W&&S!==void 0&&b.jsx("input",{type:"hidden",name:W,value:S}),b.jsx("input",{...Q})]})}),axe=k.forwardRef(function(t,n){const{render:r,className:i,...a}=t,{state:s}=Fs(),o=rxe(),l={...s,...o};return xt("span",t,{state:l,ref:n,stateAttributesMapping:mne,props:a})}),gne=k.createContext(void 0);function sxe(e=!0){const t=k.useContext(gne);if(t===void 0&&!e)throw new Error(rn(7));return t}const oxe=k.forwardRef(function(t,n){const{className:r,defaultPressed:i=!1,disabled:a=!1,form:s,onPressedChange:o,pressed:l,render:u,type:f,value:d,nativeButton:p=!0,...m}=t,y=fi(d||void 0),S=sxe(),g=S?.value??[],_=S?void 0:i,v=(a||S?.disabled)??!1,[x,T]=Ja({controlled:S?g?.indexOf(y)>-1:l,default:_,name:"Toggle",state:"pressed"}),w=Xe((z,M)=>{y&&S?.setGroupValue?.(y,z,M),o?.(z,M)}),{getButtonProps:C,buttonRef:R}=aa({disabled:v,native:p}),O=k.useMemo(()=>({disabled:v,pressed:x}),[v,x]),N=[R,n],L=[{"aria-pressed":x,onClick(z){const M=!x,V=it(Dr,z.nativeEvent);w(M,V),!V.isCanceled&&T(M)}},m,C],D=xt("button",t,{enabled:!S,state:O,ref:N,props:L});return S?b.jsx(Wx,{tag:"button",render:u,className:r,state:O,refs:N,props:L}):D});let lxe=(function(e){return e.disabled="data-disabled",e.orientation="data-orientation",e.multiple="data-multiple",e})({});const pz={multiple(e){return e?{[lxe.multiple]:""}:null}},uxe=k.forwardRef(function(t,n){const{defaultValue:r,disabled:i=!1,loopFocus:a=!0,onValueChange:s,orientation:o="horizontal",multiple:l=!1,value:u,className:f,render:d,...p}=t,m=_M(),y=k.useMemo(()=>{if(u===void 0)return r??[]},[u,r]),S=(m?.disabled??!1)||i,[g,_]=Ja({controlled:u,default:y,name:"ToggleGroup",state:"value"}),v=Xe((R,O,N)=>{let L;if(l?(L=g.slice(),O?L.push(R):L.splice(g.indexOf(R),1)):L=O?[R]:[],Array.isArray(L)){if(s?.(L,N),N.isCanceled)return;_(L)}}),x=k.useMemo(()=>({disabled:S,multiple:l,orientation:o}),[S,o,l]),T=k.useMemo(()=>({disabled:S,orientation:o,setGroupValue:v,value:g}),[S,o,v,g]),w={role:"group"},C=xt("div",t,{enabled:!!m,state:x,ref:n,props:[w,p],stateAttributesMapping:pz});return b.jsx(gne.Provider,{value:T,children:m?C:b.jsx(zx,{render:d,className:f,state:x,refs:[n],props:[w,p],stateAttributesMapping:pz,loopFocus:a})})}),bne=k.createContext(void 0);function Vy(e){const t=k.useContext(bne);if(t===void 0&&!e)throw new Error(rn(72));return t}const cxe={...nM,disabled:Be(e=>e.disabled),instantType:Be(e=>e.instantType),isInstantPhase:Be(e=>e.isInstantPhase),trackCursorAxis:Be(e=>e.trackCursorAxis),disableHoverablePopup:Be(e=>e.disableHoverablePopup),lastOpenChangeReason:Be(e=>e.openChangeReason),closeDelay:Be(e=>e.closeDelay)};class OM extends jx{constructor(t){super({...dxe(),...t},{popupRef:k.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Py},cxe)}setOpen=(t,n)=>{const r=n.reason,i=r===dr,a=t&&r===bv,s=!t&&(r===iu||r===Dy);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(t,n),n.isCanceled)return;const o=()=>{const l={open:t,openChangeReason:r};a?l.instantType="focus":s?l.instantType="dismiss":r===dr&&(l.instantType=void 0);const u=n.trigger?.id??null;(u||t)&&(l.activeTriggerId=u,l.activeTriggerElement=n.trigger??null),this.update(l)};i?xr.flushSync(o):o()};static useStore(t,n){const r=di(()=>t??new OM(n)).current,i=rM({popupStore:r,onOpenChange:r.setOpen});return r.state.floatingRootContext=i,r}}function dxe(){return{...tM(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0}}function fxe(e){const{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a="none",actionsRef:s,onOpenChange:o,onOpenChangeComplete:l,handle:u,triggerId:f,defaultTriggerId:d=null,children:p}=e,m=OM.useStore(u?.store,{open:r??n,activeTriggerId:f!==void 0?f:d});m.useControlledProp("open",r,n),m.useControlledProp("activeTriggerId",f,d),m.useContextCallback("onOpenChange",o),m.useContextCallback("onOpenChangeComplete",l);const y=m.useState("open"),S=m.useState("activeTriggerId"),g=m.useState("payload");m.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i});const _=!t&&y;Je(()=>{y&&t&&m.setOpen(!1,it(Wve))},[y,t,m]),m.useSyncedValue("disabled",t),JP(m);const{forceUnmount:v,transitionStatus:x}=eM(_,m),T=m.useState("isInstantPhase"),w=m.useState("instantType"),C=m.useState("lastOpenChangeReason"),R=k.useRef(null);Je(()=>{x==="ending"&&C===Dr||x!=="ending"&&T?(w!=="delay"&&(R.current=w),m.set("instantType","delay")):R.current!==null&&(m.set("instantType",R.current),R.current=null)},[x,T,C,w,m]),Je(()=>{_&&S==null&&m.set("payload",void 0)},[m,S,_]);const O=k.useCallback(()=>{m.setOpen(!1,hxe(m,qP))},[m]);k.useImperativeHandle(s,()=>({unmount:v,close:O}),[v,O]);const N=m.useState("floatingRootContext"),L=Iee(N,{enabled:!t}),D=Cm(N,{enabled:!t,referencePress:!0}),z=oye(N,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),{getReferenceProps:M,getFloatingProps:V,getTriggerProps:W}=Qc([L,D,z]),$=k.useMemo(()=>M(),[M]),q=k.useMemo(()=>W(),[W]),Y=k.useMemo(()=>V(),[V]);return m.useSyncedValues({floatingRootContext:N,activeTriggerProps:$,inactiveTriggerProps:q,popupProps:Y}),b.jsx(bne.Provider,{value:m,children:typeof p=="function"?p({payload:g}):p})}function hxe(e,t){const n=it(t);return n.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},n}const vne=k.createContext(void 0);function pxe(){return k.useContext(vne)}const mxe=600,gxe=k.forwardRef(function(t,n){const{className:r,render:i,handle:a,payload:s,disabled:o,delay:l,closeDelay:u,id:f,...d}=t,p=Vy(!0),m=a?.store??p;if(!m)throw new Error(rn(82));const y=fi(f),S=m.useState("isTriggerActive",y),g=m.useState("floatingRootContext"),_=m.useState("isOpenedByTrigger",y),v=k.useRef(null),x=l??mxe,T=u??0,{registerTrigger:w,isMountedByThisTrigger:C}=QP(y,v,m,{payload:s,closeDelay:T}),R=pxe(),{delayRef:O,isInstantPhase:N,hasProvider:L}=Xve(g,{open:_});m.useSyncedValue("isInstantPhase",N);const D=m.useState("disabled"),z=o??D,M=m.useState("trackCursorAxis"),V=m.useState("disableHoverablePopup"),W=Pee(g,{enabled:!z,mouseOnly:!0,move:!1,handleClose:!V&&M!=="both"?sM():null,restMs(){const B=R?.delay,j=typeof O.current=="object"?O.current.open:void 0;let U=x;return L&&(j!==0?U=l??B??x:U=0),U},delay(){const B=typeof O.current=="object"?O.current.close:void 0;let j=T;return u==null&&L&&(j=B),{close:j}},triggerElementRef:v,isActiveTrigger:S}),$=k.useMemo(()=>({open:_}),[_]),q=m.useState("triggerProps",C);return xt("button",t,{state:$,ref:[n,w,v],props:[W,q,{id:y},d],stateAttributesMapping:Hx})}),yne=k.createContext(void 0);function bxe(){const e=k.useContext(yne);if(e===void 0)throw new Error(rn(70));return e}const vxe=k.forwardRef(function(t,n){const{keepMounted:r=!1,...i}=t;return Vy().useState("mounted")||r?b.jsx(yne.Provider,{value:r,children:b.jsx(WSe,{ref:n,...i})}):null}),_ne=k.createContext(void 0);function Ene(){const e=k.useContext(_ne);if(e===void 0)throw new Error(rn(71));return e}const yxe=k.forwardRef(function(t,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="top",align:l="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:d="clipping-ancestors",collisionPadding:p=5,arrowPadding:m=5,sticky:y=!1,disableAnchorTracking:S=!1,collisionAvoidance:g=LP,..._}=t,v=Vy(),x=bxe(),T=v.useState("open"),w=v.useState("mounted"),C=v.useState("trackCursorAxis"),R=v.useState("disableHoverablePopup"),O=v.useState("floatingRootContext"),N=v.useState("instantType"),L=v.useState("transitionStatus"),D=By({anchor:a,positionMethod:s,floatingRootContext:O,mounted:w,side:o,sideOffset:u,align:l,alignOffset:f,collisionBoundary:d,collisionPadding:p,sticky:y,arrowPadding:m,disableAnchorTracking:S,keepMounted:x,collisionAvoidance:g,adaptiveOrigin:Xee}),z=k.useMemo(()=>{const $={};return(!T||C==="both"||R)&&($.pointerEvents="none"),{role:"presentation",hidden:!w,style:{...D.positionerStyles,...$}}},[T,C,R,w,D.positionerStyles]),M=k.useMemo(()=>({open:T,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:C!=="none"?"tracking-cursor":N}),[T,D.side,D.align,D.anchorHidden,C,N]),V=k.useMemo(()=>({...M,arrowRef:D.arrowRef,arrowStyles:D.arrowStyles,arrowUncentered:D.arrowUncentered}),[M,D.arrowRef,D.arrowStyles,D.arrowUncentered]),W=xt("div",t,{state:M,props:[z,Om(L),_],ref:[n,v.useStateSetter("positionerElement")],stateAttributesMapping:ka});return b.jsx(_ne.Provider,{value:V,children:W})}),_xe={...ka,...is},Exe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,s=Vy(),{side:o,align:l}=Ene(),u=s.useState("open"),f=s.useState("mounted"),d=s.useState("instantType"),p=s.useState("transitionStatus"),m=s.useState("popupProps"),y=s.useState("payload"),S=s.useState("popupElement"),g=s.useState("positionerElement"),_=s.useState("floatingRootContext"),v=Cu();Ai({open:u,ref:s.context.popupRef,onComplete(){u&&s.context.onOpenChangeComplete?.(!0)}});function x(){_.context.events.emit("measure-layout")}function T(L,D){_.context.events.emit("measure-layout-complete",{previousDimensions:L,nextDimensions:D})}const w=k.useCallback(()=>s.context.triggerElements.size>1,[s]);HSe({popupElement:S,positionerElement:g,mounted:f,content:y,enabled:w,onMeasureLayout:x,onMeasureLayoutComplete:T,side:o,direction:v});const C=s.useState("disabled"),R=s.useState("closeDelay");Lee(_,{enabled:!C,closeDelay:R});const O=k.useMemo(()=>({open:u,side:o,align:l,instant:d,transitionStatus:p}),[u,o,l,d,p]);return xt("div",t,{state:O,ref:[n,s.context.popupRef,s.useStateSetter("popupElement")],props:[m,Om(p),a],stateAttributesMapping:_xe})}),Sxe=k.forwardRef(function(t,n){const{className:r,render:i,...a}=t,o=Vy().useState("instantType"),{open:l,arrowRef:u,side:f,align:d,arrowUncentered:p,arrowStyles:m}=Ene(),y=k.useMemo(()=>({open:l,side:f,align:d,uncentered:p,instant:o}),[l,f,d,p,o]);return xt("div",t,{state:y,ref:[n,u],props:[{style:m,"aria-hidden":!0},a],stateAttributesMapping:ka})}),xxe=function(t){const{delay:n,closeDelay:r,timeout:i=400}=t,a=k.useMemo(()=>({delay:n,closeDelay:r}),[n,r]),s=k.useMemo(()=>({open:n,close:r}),[n,r]);return b.jsx(vne.Provider,{value:a,children:b.jsx(Yve,{delay:s,timeoutMs:i,children:t.children})})};function wxe(e){return xt(e.defaultTagName??"div",e,e)}function Txe({className:e,...t}){return b.jsx("div",{"data-slot":"input-group",role:"group",className:Ue("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 Cxe=Yc("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 Axe({className:e,align:t="inline-start",...n}){return b.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Ue(Cxe({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const kxe=Yc("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 Sne({className:e,type:t="button",variant:n="ghost",size:r="xs",...i}){return b.jsx(Ke,{type:t,"data-size":r,variant:n,className:Ue(kxe({size:r}),e),...i})}function Oxe({className:e,...t}){return b.jsx(vn,{"data-slot":"input-group-control",className:Ue("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 Rxe=gSe;function Nxe({className:e,children:t,...n}){return b.jsxs(GEe,{"data-slot":"combobox-trigger",className:Ue("[&_svg:not([class*='size-'])]:size-3.5",e),...n,children:[t,b.jsx(fe,{icon:Uy,strokeWidth:2,className:"text-muted-foreground size-3.5 pointer-events-none"})]})}function Ixe({className:e,...t}){return b.jsx(QEe,{"data-slot":"combobox-clear",render:b.jsx(Sne,{variant:"ghost",size:"icon-xs"}),className:Ue(e),...t,children:b.jsx(fe,{icon:ci,strokeWidth:2,className:"pointer-events-none"})})}function Dxe({className:e,children:t,disabled:n=!1,showTrigger:r=!0,showClear:i=!1,...a}){return b.jsxs(Txe,{className:Ue("w-auto",e),children:[b.jsx(XEe,{render:b.jsx(Oxe,{disabled:n}),...a}),b.jsxs(Axe,{align:"inline-end",children:[r&&b.jsx(Sne,{size:"icon-xs",variant:"ghost",render:b.jsx(Nxe,{}),"data-slot":"input-group-button",className:"group-has-data-[slot=combobox-clear]/input-group:hidden data-pressed:bg-transparent",disabled:n}),i&&b.jsx(Ixe,{disabled:n})]}),t]})}function Lxe({className:e,side:t="bottom",sideOffset:n=6,align:r="start",alignOffset:i=0,anchor:a,...s}){return b.jsx(iSe,{children:b.jsx(aSe,{side:t,sideOffset:n,align:r,alignOffset:i,anchor:a,className:"isolate z-50",children:b.jsx(oSe,{"data-slot":"combobox-content","data-chips":!!a,className:Ue("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/10 *:data-[slot=input-group]:bg-input/20 dark:bg-popover max-h-72 min-w-32 overflow-hidden rounded-lg shadow-md ring-1 duration-100 *:data-[slot=input-group]:m-1 *:data-[slot=input-group]:mb-0 *:data-[slot=input-group]:h-7 *:data-[slot=input-group]:border-none *:data-[slot=input-group]:shadow-none group/combobox-content relative max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) min-w-[calc(var(--anchor-width)+--spacing(7))] origin-(--transform-origin) data-[chips=true]:min-w-(--anchor-width)",e),...s})})})}function Pxe({className:e,...t}){return b.jsx(nSe,{"data-slot":"combobox-list",className:Ue("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 Mxe({className:e,children:t,...n}){return b.jsxs(cSe,{"data-slot":"combobox-item",className:Ue("data-highlighted:bg-accent data-highlighted:text-accent-foreground not-data-[variant=destructive]:data-highlighted:**:text-accent-foreground min-h-7 gap-2 rounded-md px-2 py-1 text-xs/relaxed [&_svg:not([class*='size-'])]:size-3.5 relative flex w-full cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[t,b.jsx(bSe,{render:b.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center"}),children:b.jsx(fe,{icon:hl,strokeWidth:2,className:"pointer-events-none"})})]})}function jxe({className:e,...t}){return b.jsx(dSe,{"data-slot":"combobox-empty",className:Ue("text-muted-foreground hidden w-full justify-center py-2 text-center text-xs/relaxed group-data-empty/combobox-content:flex",e),...t})}const Fxe=Yc("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"}}),xne=k.createContext({size:"default",variant:"default",spacing:0,orientation:"horizontal"});function Bxe({className:e,variant:t,size:n,spacing:r=0,orientation:i="horizontal",children:a,...s}){return b.jsx(uxe,{"data-slot":"toggle-group","data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:Ue("rounded-md data-[size=sm]:rounded-[min(var(--radius-md),8px)] group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",e),...s,children:b.jsx(xne.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function mz({className:e,children:t,variant:n="default",size:r="default",...i}){const a=k.useContext(xne);return b.jsx(oxe,{"data-slot":"toggle-group-item","data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:Ue("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",Fxe({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}async function $t(e,t){const n=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t?.headers}});if(!n.ok){const r=await n.json().catch(()=>({error:"Request failed"}));throw new Error(r.error||"Request failed")}return n.json()}const zc="";function RM(){return qn({queryKey:["tasks"],queryFn:()=>$t(`${zc}/api/tasks`)})}function wne(e){return qn({queryKey:["tasks",e],queryFn:()=>$t(`${zc}/api/tasks/${e}`),enabled:!!e})}function Uxe(){const e=wr();return zn({mutationFn:t=>$t(`${zc}/api/tasks`,{method:"POST",body:JSON.stringify({...t,status:"IN_PROGRESS"})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function $xe(){const e=wr();return zn({mutationFn:({taskId:t,status:n,position:r})=>$t(`${zc}/api/tasks/${t}/status`,{method:"PATCH",body:JSON.stringify({status:n,position:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]})}})}function NM(){const e=wr();return zn({mutationFn:({taskId:t,updates:n})=>$t(`${zc}/api/tasks/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{taskId:n})=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["tasks",n]})}})}function IM(){const e=wr();return zn({mutationFn:({taskId:t,deleteLinkedWorktree:n})=>{const r=n?`${zc}/api/tasks/${t}?deleteLinkedWorktree=true`:`${zc}/api/tasks/${t}`;return $t(r,{method:"DELETE"})},onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}function zxe(){const e=wr();return zn({mutationFn:({ids:t,deleteLinkedWorktrees:n})=>$t(`${zc}/api/tasks/bulk`,{method:"DELETE",body:JSON.stringify({ids:t,deleteLinkedWorktrees:n})}),onSuccess:()=>{e.invalidateQueries({queryKey:["tasks"]}),e.invalidateQueries({queryKey:["worktrees"]})}})}const Gy="";function Hxe(e){return qn({queryKey:["fs","list",e],queryFn:()=>{const t=e?`?path=${encodeURIComponent(e)}`:"";return $t(`${Gy}/api/fs/list${t}`)},enabled:e!==null})}function Wxe(e){return qn({queryKey:["git","branches",e],queryFn:()=>$t(`${Gy}/api/git/branches?repo=${encodeURIComponent(e)}`),enabled:!!e})}function Vxe(e,t={}){const{staged:n=!1,ignoreWhitespace:r=!1,includeUntracked:i=!1}=t;return qn({queryKey:["git","diff",e,n,r,i],queryFn:()=>{const a=new URLSearchParams({path:e,...n&&{staged:"true"},...r&&{ignoreWhitespace:"true"},...i&&{includeUntracked:"true"}});return $t(`${Gy}/api/git/diff?${a}`)},enabled:!!e,refetchInterval:5e3})}function Gxe(e){return qn({queryKey:["git","status",e],queryFn:()=>$t(`${Gy}/api/git/status?path=${encodeURIComponent(e)}`),enabled:!!e,refetchInterval:5e3})}async function qxe(e){return $t(`${Gy}/api/fs/is-git-repo?path=${encodeURIComponent(e)}`)}const ml="",In={PORT:"server.port",WORKTREE_BASE_PATH:"worktree_base_path",DEFAULT_GIT_REPOS_DIR:"paths.defaultGitReposDir",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",SYNC_CLAUDE_CODE_THEME:"appearance.syncClaudeCodeTheme",CLAUDE_CODE_LIGHT_THEME:"appearance.claudeCodeLightTheme",CLAUDE_CODE_DARK_THEME:"appearance.claudeCodeDarkTheme"},Kxe=7777;function Us(e){return qn({queryKey:["config",e],queryFn:()=>$t(`${ml}/api/config/${e}`)})}function Tne(){const e=Us(In.PORT);return{...e,data:e.data?.value??Kxe,isDefault:e.data?.isDefault??!0}}function Yxe(){const e=Us(In.WORKTREE_BASE_PATH);return{...e,data:e.data?.value??""}}function qy(){const e=Us(In.DEFAULT_GIT_REPOS_DIR);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function DM(){const e=Us(In.EDITOR_APP);return{...e,data:e.data?.value??"vscode",isDefault:e.data?.isDefault??!0}}function LM(){const e=Us(In.EDITOR_HOST);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function PM(){const e=Us(In.EDITOR_SSH_PORT);return{...e,data:e.data?.value??22,isDefault:e.data?.isDefault??!0}}function Xxe(){const e=Us(In.LINEAR_API_KEY);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Zxe(){const e=Us(In.GITHUB_PAT);return{...e,data:e.data?.value??"",isDefault:e.data?.isDefault??!0}}function Qxe(){const e=Us(In.LANGUAGE);return{...e,data:e.data?.value??null,isDefault:e.data?.isDefault??!0}}function Jxe(){const e=Us(In.SYNC_CLAUDE_CODE_THEME);return{...e,data:!!e.data?.value,isDefault:e.data?.isDefault??!0}}const gz=["light","light-ansi","light-daltonized","dark","dark-ansi","dark-daltonized"];function ewe(){const e=Us(In.CLAUDE_CODE_LIGHT_THEME);return{...e,data:e.data?.value??"light-ansi",isDefault:e.data?.isDefault??!0}}function twe(){const e=Us(In.CLAUDE_CODE_DARK_THEME);return{...e,data:e.data?.value??"dark-ansi",isDefault:e.data?.isDefault??!0}}function Cne(){const e=wr();return zn({mutationFn:({key:t,value:n})=>$t(`${ml}/api/config/${t}`,{method:"PUT",body:JSON.stringify({value:n})}),onSuccess:(t,{key:n})=>{e.invalidateQueries({queryKey:["config",n]}),n===In.GITHUB_PAT&&(e.invalidateQueries({queryKey:["github-user"]}),e.invalidateQueries({queryKey:["github-prs"]}),e.invalidateQueries({queryKey:["github-issues"]}),e.invalidateQueries({queryKey:["github-orgs"]}))}})}function nwe(){const e=wr();return zn({mutationFn:t=>$t(`${ml}/api/config/${t}`,{method:"DELETE"}),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["config",n]})}})}function rwe(){return qn({queryKey:["config","notifications"],queryFn:()=>$t(`${ml}/api/config/notifications`)})}function iwe(){const e=wr();return zn({mutationFn:t=>$t(`${ml}/api/config/notifications`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","notifications"]})}})}function awe(){return zn({mutationFn:e=>$t(`${ml}/api/config/notifications/test/${e}`,{method:"POST"})})}function swe(){return qn({queryKey:["config","z-ai"],queryFn:()=>$t(`${ml}/api/config/z-ai`)})}function owe(){const e=wr();return zn({mutationFn:t=>$t(`${ml}/api/config/z-ai`,{method:"PUT",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["config","z-ai"]}),e.invalidateQueries({queryKey:["monitoring","claude-usage"]})}})}function Ane(){return qn({queryKey:["config","developer-mode"],queryFn:()=>$t(`${ml}/api/config/developer-mode`),staleTime:1/0})}function lwe(){return zn({mutationFn:()=>$t(`${ml}/api/config/restart`,{method:"POST"})})}const rd="";function Ky(){return qn({queryKey:["repositories"],queryFn:()=>$t(`${rd}/api/repositories`)})}function uwe(e){return qn({queryKey:["repositories",e],queryFn:()=>$t(`${rd}/api/repositories/${e}`),enabled:!!e})}function kne(){const e=wr();return zn({mutationFn:t=>$t(`${rd}/api/repositories`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function cwe(){const e=wr();return zn({mutationFn:t=>$t(`${rd}/api/repositories/clone`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function dwe(){const e=wr();return zn({mutationFn:({id:t,updates:n})=>$t(`${rd}/api/repositories/${t}`,{method:"PATCH",body:JSON.stringify(n)}),onSuccess:(t,{id:n})=>{e.invalidateQueries({queryKey:["repositories"]}),e.invalidateQueries({queryKey:["repositories",n]})}})}function One(){const e=wr();return zn({mutationFn:t=>$t(`${rd}/api/repositories/${t}`,{method:"DELETE"}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function fwe(){return zn({mutationFn:e=>$t(`${rd}/api/repositories/scan`,{method:"POST",body:JSON.stringify(e?{directory:e}:{})})})}function hwe(){const e=wr();return zn({mutationFn:t=>$t(`${rd}/api/repositories/bulk`,{method:"POST",body:JSON.stringify({repositories:t})}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function Yy({className:e,children:t,...n}){return b.jsxs(qSe,{"data-slot":"scroll-area",className:Ue("relative",e),...n,children:[b.jsx(QSe,{"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}),b.jsx(pwe,{}),b.jsx(nxe,{})]})}function pwe({className:e,orientation:t="vertical",...n}){return b.jsx(exe,{"data-slot":"scroll-area-scrollbar","data-orientation":t,orientation:t,className:Ue("data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none",e),...n,children:b.jsx(txe,{"data-slot":"scroll-area-thumb",className:"rounded-full bg-border relative flex-1"})})}function Nm({open:e,onOpenChange:t,onSelect:n,initialPath:r}){const[i,a]=k.useState(r||null),[s,o]=k.useState(""),[l,u]=k.useState("");k.useEffect(()=>{e&&(a(r||null),o(""),u(""))},[e,r]);const{data:f,isLoading:d,error:p}=Hxe(e?i??"":null),m=x=>{f&&(a(f.path+"/"+x),u(""))},y=()=>{f?.parent&&f.parent!==f.path&&(a(f.parent),u(""))},S=()=>{a(null),u("")},g=()=>{s.trim()&&(a(s.trim()),u(""))},_=x=>{n(x),t(!1)},v=f?.entries.filter(x=>x.name.toLowerCase().includes(l.toLowerCase()));return b.jsx(ku,{open:e,onOpenChange:t,children:b.jsxs(Ou,{className:"sm:max-w-lg overflow-hidden",children:[b.jsxs(Jc,{children:[b.jsx(ed,{children:"Select Git Repository"}),b.jsx(zy,{children:"Choose an existing git repository"})]}),b.jsx("p",{className:"text-xs text-muted-foreground",children:"Click folder names to navigate • Use action buttons to select"}),b.jsx(iEe,{}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs font-medium",children:"Enter path manually:"}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(vn,{value:s,onChange:x=>o(x.target.value),placeholder:"/path/to/your/project",onKeyDown:x=>x.key==="Enter"&&g(),className:"flex-1"}),b.jsx(Ke,{variant:"outline",size:"sm",onClick:g,children:"Go"})]})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsx("label",{className:"text-xs font-medium",children:"Search current directory:"}),b.jsxs("div",{className:"relative",children:[b.jsx(fe,{icon:Gx,size:14,strokeWidth:2,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(vn,{value:l,onChange:x=>u(x.target.value),placeholder:"Filter folders and files...",className:"pl-8"})]})]}),b.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b.jsx(Ke,{variant:"outline",size:"icon-sm",onClick:S,title:"Home",className:"shrink-0",children:b.jsx(fe,{icon:I1e,size:14,strokeWidth:2})}),b.jsx(Ke,{variant:"outline",size:"icon-sm",onClick:y,disabled:!f||f.parent===f.path,title:"Parent directory",className:"shrink-0",children:b.jsx(fe,{icon:dM,size:14,strokeWidth:2})}),b.jsx("code",{className:"min-w-0 flex-1 text-xs bg-muted/50 px-2 py-1 rounded truncate overflow-hidden",children:f?.path||"~"}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:()=>f&&_(f.path),disabled:!f,className:"shrink-0 max-sm:px-2",title:"Select current directory",children:[b.jsx(fe,{icon:YI,size:14,strokeWidth:2,className:"sm:hidden"}),b.jsx("span",{className:"max-sm:hidden",children:"Select Current"})]})]}),b.jsx(Yy,{className:"h-64 border rounded-md",children:b.jsxs("div",{className:"p-1",children:[d&&b.jsx("div",{className:"text-muted-foreground text-xs p-3",children:"Loading..."}),p&&b.jsx("div",{className:"text-destructive text-xs p-3",children:p.message}),f&&v&&b.jsxs(b.Fragment,{children:[v.length===0&&b.jsx("div",{className:"text-muted-foreground text-xs p-3",children:l?"No matches found":"Empty directory"}),v.map(x=>b.jsx("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded hover:bg-muted group",children:x.type==="directory"?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:x.isGitRepo?YI:Hi,size:16,strokeWidth:2,className:(x.isGitRepo,"text-accent")}),b.jsx("button",{onClick:()=>m(x.name),className:"flex-1 text-left text-xs truncate hover:underline",children:x.name}),x.isGitRepo&&b.jsxs("span",{className:"text-[10px] px-1.5 py-0.5 rounded border border-accent/50 text-accent font-medium shrink-0",children:[b.jsx("span",{className:"max-sm:hidden",children:"git repo"}),b.jsx("span",{className:"sm:hidden",children:"git"})]})]}):b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"w-4"}),b.jsx("span",{className:"flex-1 text-xs text-muted-foreground truncate",children:x.name})]})},x.name))]})]})}),b.jsxs(Hf,{children:[b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline"}),children:"Cancel"}),b.jsx(Ke,{onClick:()=>f&&_(f.path),disabled:!f,children:"Select Path"})]})]})})}function mwe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function gwe(e){const t=mwe(e);if(!t)return"";const n=Math.random().toString(36).substring(2,6);return`${t}-${n}`}function MM({open:e,onOpenChange:t,defaultRepository:n,showTrigger:r=!0}={}){const{t:i}=tn("tasks"),{t:a}=tn("common"),[s,o]=k.useState(!1),l=e??s,u=t??o,[f,d]=k.useState(!1),[p,m]=k.useState(""),[y,S]=k.useState(""),[g,_]=k.useState(""),[v,x]=k.useState(""),[T,w]=k.useState(""),[C,R]=k.useState(""),[O,N]=k.useState("default"),[L,D]=k.useState(!1),[z,M]=k.useState(null),[V,W]=k.useState("browse"),[$,q]=k.useState(""),[Y,B]=k.useState(null),[j,U]=k.useState(!1),K=Wi(),H=Uxe(),J=kne(),se=k.useRef(null),{data:ae}=Yxe(),{data:Q}=qy(),{data:G}=Ky(),{data:Z,isLoading:ee}=Wxe(g||null),ne=z?G?.find(ve=>ve.id===z):null,te=k.useMemo(()=>{if(!G)return[];if(ne&&$===ne.displayName||!$.trim())return G;const ve=$.toLowerCase();return G.filter(De=>De.displayName.toLowerCase().includes(ve)||De.path.toLowerCase().includes(ve))},[G,$,ne]);k.useEffect(()=>{G&&G.length>0?W("saved"):W("browse")},[G]),k.useEffect(()=>{if(l){if(n)M(n.id),_(n.path),q(n.displayName),W("saved");else if(G&&G.length>0){const ve=G[0];M(ve.id),_(ve.path),q(ve.displayName),W("saved")}}},[l,n,G]),k.useEffect(()=>{x(Z?Z.current||Z.branches[0]||"main":"")},[Z,g]);const be=ve=>{m(ve),R(gwe(ve))},_e=async ve=>{B(null),U(!0);try{if(!(await qxe(ve)).isGitRepo){B(i("createModal.errors.notGitRepo")),U(!1);return}if(_(ve),M(null),!G?.find(pe=>pe.path===ve)){const pe=ve.split("/").pop()||"Unknown";J.mutate({path:ve,displayName:pe})}}catch(De){B(De instanceof Error?De.message:i("createModal.errors.validationFailed"))}finally{U(!1)}},he=ve=>{if(ve.preventDefault(),!p.trim()||!g)return;const De=g.split("/").pop()||"repo",Te=T.trim()||C,pe=`${ae}/${Te}`;H.mutate({title:p.trim(),description:y.trim(),aiMode:O,repoPath:g,repoName:De,baseBranch:v||"main",branch:Te,worktreePath:pe,copyFiles:ne?.copyFiles||void 0,startupScript:ne?.startupScript||void 0},{onSuccess:ce=>{const Re=y.trim()?{aiMode:O,description:y.trim()}:{aiMode:O};u(!1),m(""),S(""),_(""),x(""),w(""),R(""),N("default"),D(!1),M(null),q(""),B(null),W(G&&G.length>0?"saved":"browse"),K({to:"/tasks/$taskId",params:{taskId:ce.id},state:Re})},onError:ce=>{ln.error(i("createModal.errors.createFailed"),{description:ce instanceof Error?ce.message:String(ce)})}})},ye=!H.isPending&&!!p.trim()&&!!g;Es("meta+enter",()=>{se.current&&se.current.requestSubmit()},{enabled:l&&ye,allowInInput:!0,ignoreContext:!0,deps:[l,ye]});const Ee=T.trim()||C,xe=Ee?`${ae}/${Ee}`:"";return b.jsxs(b.Fragment,{children:[b.jsxs(ku,{open:l,onOpenChange:u,children:[r&&b.jsxs(Tte,{render:b.jsx(Ke,{size:"sm"}),children:[b.jsx(fe,{icon:pM,size:16,strokeWidth:2,"data-slot":"icon",className:"-translate-y-px"}),i("newTask")]}),b.jsx(Ou,{className:"sm:max-w-md max-h-[80dvh] flex flex-col overflow-hidden",children:b.jsxs("form",{ref:se,onSubmit:he,className:"flex flex-col min-h-0 flex-1",children:[b.jsxs(Jc,{className:"shrink-0",children:[b.jsx(ed,{children:i("createModal.title")}),b.jsx(zy,{children:i("createModal.description")})]}),b.jsxs(pf,{className:"mt-4 pb-4 overflow-y-auto min-h-0 flex-1",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"title",children:i("createModal.fields.title")}),b.jsx(vn,{id:"title",value:p,onChange:ve=>be(ve.target.value),placeholder:i("createModal.fields.titlePlaceholder"),required:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"description",children:i("createModal.fields.description")}),b.jsx(kte,{id:"description",value:y,onValueChange:ve=>{S(ve),L||N(ve.trim()?"plan":"default")},placeholder:i("createModal.fields.descriptionPlaceholder"),rows:2})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:i("createModal.fields.aiMode")}),b.jsxs(Bxe,{value:[O],onValueChange:ve=>{const De=Array.isArray(ve)?ve[0]:ve;De&&(N(De),D(!0))},className:"w-full",variant:"outline",children:[b.jsx(mz,{value:"plan",className:"flex-1",children:i("createModal.aiModes.plan")}),b.jsx(mz,{value:"default",className:"flex-1",children:i("createModal.aiModes.default")})]})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:i("createModal.fields.repository")}),b.jsxs(su,{value:V,onValueChange:ve=>{W(ve),B(null)},children:[b.jsxs(ou,{children:[b.jsx(li,{value:"saved",disabled:!G?.length,children:i("createModal.tabs.saved")}),b.jsx(li,{value:"browse",children:i("createModal.tabs.browse")})]}),b.jsx(Pi,{value:"saved",className:"mt-2",children:b.jsxs(Rxe,{value:z||"",onValueChange:ve=>{const De=G?.find(Te=>Te.id===ve);De&&(M(ve),_(De.path),q(De.displayName),B(null))},inputValue:$,onInputValueChange:ve=>{q(ve),ne&&ve!==ne.displayName&&M(null)},itemToStringLabel:ve=>G?.find(De=>De.id===ve)?.displayName||"",children:[b.jsx(Dxe,{placeholder:i("createModal.searchRepositories"),className:"w-full"}),b.jsx(Lxe,{children:b.jsxs(Pxe,{children:[b.jsx(jxe,{children:i("createModal.noRepositoriesFound")}),te.map(ve=>b.jsx(Mxe,{value:ve.id,children:ve.displayName},ve.id))]})})]})}),b.jsx(Pi,{value:"browse",className:"mt-2",children:b.jsxs(Ke,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>d(!0),disabled:j,children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2,className:"mr-2"}),j?b.jsx("span",{className:"text-muted-foreground",children:a("status.validating")}):g&&!z?b.jsx("span",{className:"truncate",children:g}):b.jsx("span",{className:"text-muted-foreground group-hover/button:text-accent-foreground",children:i("createModal.selectFolder")})]})})]}),Y&&b.jsx("p",{className:"text-sm text-destructive",children:Y}),g&&!Y&&b.jsx(qa,{className:"font-mono text-xs truncate",children:g})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"baseBranch",children:i("createModal.fields.baseBranch")}),b.jsxs(ji,{value:v,onValueChange:ve=>x(ve??""),disabled:!g||ee,children:[b.jsx(Bi,{className:"w-full",children:b.jsx(Fi,{children:v||b.jsx("span",{className:"text-muted-foreground",children:i(g?ee?"createModal.loadingBranches":"createModal.selectBranch":"createModal.selectRepositoryFirst")})})}),b.jsx(Ui,{children:Z?.branches.map(ve=>b.jsxs(Cn,{value:ve,children:[ve,ve===Z.current&&b.jsx("span",{className:"text-muted-foreground ml-2",children:i("createModal.current")})]},ve))})]})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"branch",children:i("createModal.fields.branchName")}),b.jsx(vn,{id:"branch",value:T,onChange:ve=>w(ve.target.value),placeholder:C||i("createModal.fields.branchPlaceholder")}),xe&&b.jsxs(qa,{children:[i("createModal.worktreePrefix")," ",xe]}),!T.trim()&&C&&b.jsx(qa,{children:i("createModal.branchAutoGenerated",{branch:C})})]})]}),b.jsxs(Hf,{className:"mt-4 shrink-0",children:[b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline",type:"button",className:"border-destructive text-destructive hover:bg-destructive hover:text-white"}),children:a("buttons.cancel")}),b.jsx(Ke,{type:"submit",disabled:H.isPending||!p.trim()||!g,children:H.isPending?a("status.creating"):i("createModal.createTask")})]})]})})]}),b.jsx(Nm,{open:f,onOpenChange:d,onSelect:_e,initialPath:Q||void 0})]})}const bz=[{to:"/tasks",icon:Dp,labelKey:"header.tasks",matchPrefix:!0},{to:"/terminals",icon:fM,labelKey:"header.terminals",matchPrefix:!1},{to:"/repositories",icon:np,labelKey:"header.repositories",matchPrefix:!0},{to:"/review",icon:Ub,labelKey:"header.review",matchPrefix:!0},{to:"/monitoring",icon:S1e,labelKey:"header.monitoring",matchPrefix:!0}];function bwe({onNewTaskRef:e,onOpenCommandPalette:t}){const{t:n}=tn("navigation"),{location:r}=ti(),i=r.pathname,[a,s]=k.useState(!1),o=(l,u)=>u?i.startsWith(l):i===l;return k.useEffect(()=>{e?.(()=>s(!0))},[e]),b.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:[b.jsxs("div",{className:"flex min-w-0 items-center gap-4 max-sm:gap-2",children:[b.jsx(W1e,{className:"md:hidden",children:b.jsx(V1e,{children:b.jsxs(G1e,{children:[b.jsxs(K1e,{className:"bg-transparent hover:bg-muted/50 data-open:bg-muted/50 gap-1 px-2",children:[b.jsx(fe,{icon:ute,size:16,strokeWidth:2}),b.jsx("span",{className:"sr-only",children:"Menu"})]}),b.jsx(Y1e,{className:"min-w-48",children:bz.map(l=>b.jsxs(Z1e,{href:l.to,active:o(l.to,l.matchPrefix),render:b.jsx(wi,{to:l.to}),children:[b.jsx(fe,{icon:l.icon,size:16,strokeWidth:2}),n(l.labelKey)]},l.to))})]})})}),b.jsx("nav",{className:"hidden items-center gap-1 md:flex",children:bz.map(l=>{const u=o(l.to,l.matchPrefix);return b.jsxs(wi,{to:l.to,className:Ue("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:[b.jsx(fe,{icon:l.icon,size:16,strokeWidth:2,"data-slot":"icon"}),n(l.labelKey)]},l.to)})})]}),b.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[b.jsx(MM,{open:a,onOpenChange:s}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:t,title:n("header.commandPalette",{shortcut:"⌘K"}),children:b.jsx(fe,{icon:KI,size:16,strokeWidth:2})}),b.jsx(wi,{to:"/settings",className:Ue("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:b.jsx(fe,{icon:cte,size:16,strokeWidth:2})})]})]})}function vwe(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}const ywe=10,_we=2e3;function Ewe(){const e=wr(),t=Wi(),{resolvedTheme:n}=qc(),r=k.useRef(null),i=k.useRef(void 0),a=k.useRef(0),s=k.useRef(void 0),o=k.useCallback(u=>{try{const f=JSON.parse(u.data);if(f.type==="task:updated")e.invalidateQueries({queryKey:["tasks"]});else if(f.type==="notification"&&"payload"in f){let d=function(){const N=_&&!v?"/goat.jpeg":n==="dark"?"/logo-dark.jpg":"/logo-light.jpg",D={description:y,icon:b.jsx("img",{src:N,alt:"",className:"size-8 shrink-0 aspect-square rounded-sm object-cover"}),...g&&{action:{label:"View",onClick:()=>t({to:"/tasks/$taskId",params:{taskId:g}})}}};switch(S){case"success":ln.success(m,D);break;case"error":ln.error(m,D);break;case"warning":ln.warning(m,D);break;default:ln.info(m,D);break}if("Notification"in window&&window.parent===window&&Notification.permission==="granted"&&new Notification(m,{body:y,icon:N,tag:p}),_){const V="vibora:lastSoundPlayed",W=Date.now(),$=localStorage.getItem(V);if($){const Y=parseInt($.split(":")[0]);if(W-Y<1e3)return}const q=`${W}:${Math.random().toString(36).slice(2)}`;localStorage.setItem(V,q),setTimeout(()=>{if(localStorage.getItem(V)!==q)return;let Y=!1;const B=()=>{if(Y)return;Y=!0,new Audio("/sounds/goat-bleat.mp3").play().catch(()=>{})},j=new Audio("/api/uploads/sound");j.onerror=B,j.play().catch(B)},50)}window.parent!==window&&window.parent.postMessage({type:"vibora:notification",title:m,message:y,notificationType:S},"*")};const{id:p,title:m,message:y,notificationType:S,taskId:g,playSound:_,isCustomSound:v}=f.payload,x=`vibora:notification:${p}`,T=50,w=1e4;if(localStorage.getItem(x))return;const R=`${Date.now()}:${Math.random().toString(36).slice(2)}`;localStorage.setItem(x,R),setTimeout(()=>{localStorage.getItem(x)===R&&(setTimeout(()=>localStorage.removeItem(x),w),d())},T)}}catch{}},[e,t,n]),l=k.useCallback(()=>{const u=r.current;if(u&&(u.readyState===WebSocket.CONNECTING||u.readyState===WebSocket.OPEN))return;const f=vwe(),d=new WebSocket(f);r.current=d,d.onopen=()=>{a.current=0},d.onmessage=o,d.onclose=()=>{r.current===d&&(r.current=null),a.current<ywe&&(a.current++,i.current=setTimeout(()=>{s.current?.()},_we))},d.onerror=()=>{}},[o]);s.current=l,k.useEffect(()=>{"Notification"in window&&Notification.permission==="default"&&Notification.requestPermission()},[]),k.useEffect(()=>(l(),()=>{i.current&&clearTimeout(i.current);const u=r.current;u&&(u.readyState===WebSocket.OPEN&&u.close(),r.current=null)}),[l])}const Swe={save:"Save Changes",cancel:"Cancel",delete:"Delete",create:"Create",reset:"Reset to default",browse:"Browse",clearFilters:"Clear filters"},xwe={loading:"Loading...",saving:"Saving...",saved:"Saved",error:"Error",calculating:"calculating...",validating:"Validating...",creating:"Creating...",deleting:"Deleting...",loggingIn:"Logging in..."},wwe={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"},Twe={one:"{{count}} result",other:"{{count}} results"},Cwe={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled",ORPHANED:"Orphaned"},Awe={loginTitle:"Login to Vibora",username:"Username",password:"Password",login:"Login",loginFailed:"Login failed"},kwe={buttons:Swe,status:xwe,time:wwe,results:Twe,statuses:Cwe,auth:Awe},Owe={tasks:"Tasks",terminals:"Terminals",worktrees:"Worktrees",repositories:"Repositories",review:"Review",monitoring:"Monitoring",settings:"Settings",commandPalette:"Command Palette ({{shortcut}})"},Rwe={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"}},Nwe={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"}},Iwe={header:Owe,commandPalette:Rwe,shortcuts:Nwe},Dwe="Tasks",Lwe="Search",Pwe="All Repos",Mwe="New Task",jwe={title:"Create New Task",description:"Create a new task with a git worktree for isolated development.",fields:{title:"Title",titlePlaceholder:"Add user authentication",description:"Description",descriptionPlaceholder:"Implement OAuth2 login flow...",aiMode:"AI Mode",repository:"Repository",baseBranch:"Base Branch",branchName:"Branch Name",branchPlaceholder:"auto-generated-from-title"},aiModes:{plan:"Plan",default:"Default"},tabs:{saved:"Repos",browse:"Browse"},worktreePrefix:"Worktree:",branchAutoGenerated:'Will use "{{branch}}" if left empty.',selectFolder:"Select folder...",searchRepositories:"Search repositories...",noRepositoriesFound:"No repositories found",selectRepositoryFirst:"Select repository first",loadingBranches:"Loading branches...",selectBranch:"Select branch",current:"(current)",createTask:"Create Task",errors:{notGitRepo:"Selected folder is not a git repository",validationFailed:"Failed to validate repository",createFailed:"Failed to create task"}},Fwe={title:Dwe,searchPlaceholder:Lwe,allRepos:Pwe,newTask:Mwe,createModal:jwe},Bwe="Settings",Uwe={server:"Server",serverDefaults:"Server & Defaults",paths:"Paths",editor:"Editor",integrations:"Integrations",zai:"z.ai",notifications:"Notifications",appearance:"Appearance",developer:"Developer"},$we={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"},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)"}}},zwe={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"},Hwe={restartButton:"Restart Vibora",restarting:"Restarting...",restartDescription:"Rebuild and restart the Vibora server. If the build fails, the server will continue running.",restartFailed:"Restart failed",checkLogs:"Build may have failed. Check journalctl --user -u vibora for details."},Wwe={title:"Unsaved Changes",description:"You have unsaved changes that will be lost if you leave this page.",stay:"Stay",leave:"Leave"},Vwe={title:Bwe,sections:Uwe,fields:$we,notifications:zwe,developer:Hwe,unsavedChanges:Wwe},Gwe="Review",qwe={pullRequests:"Pull Requests",issues:"Issues"},Kwe={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"},Ywe={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"},Xwe={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"},Zwe={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"}},Qwe={title:Gwe,tabs:qwe,filters:Kwe,github:Ywe,prs:Xwe,issues:Zwe},Jwe="Worktrees",eTe={total:"{{count}} total",orphaned:"{{count}} orphaned"},tTe={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."},nTe={noMatch:"No worktrees match the selected filters.",noWorktrees:"No worktrees found. Worktrees are created when you create tasks."},rTe={failedToLoad:"Failed to load worktrees: {{message}}"},iTe={title:Jwe,summary:eTe,cleanup:tTe,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:nTe,error:rTe},aTe="Monitoring",sTe={claude:"Claude Instances",system:"System Metrics",processes:"Processes",vibora:"Vibora Servers",worktrees:"Worktrees",usage:"Usage Limits"},oTe={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...",killSelected:"Kill {{count}} selected",source:{vibora:"Vibora: {{name}}",external:"External"},empty:"No Claude instances running",emptyVibora:" in Vibora terminals",error:"Failed to load Claude instances: {{message}}"},lTe={cpuUsage:"CPU Usage",memoryUsage:"Memory Usage",memoryLabels:{used:"Used",cache:"Cache / Buffers"},diskUsage:"Disk Usage ({{path}})",error:"Failed to load system metrics: {{message}}"},uTe={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"},cTe={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}}"},dTe={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}}"},fTe={title:aTe,tabs:sTe,claude:oTe,system:lTe,processes:uTe,vibora:cTe,usage:dTe},hTe="Tasks",pTe="New Terminal",mTe="All Repos",gTe={title:"Edit Tab",name:"Name",namePlaceholder:"Tab name",directory:"Directory",directoryPlaceholder:"Select a directory...",clearDirectory:"Clear directory",cancel:"Cancel",save:"Save"},bTe={title:"New Tab",create:"Create"},vTe={taskTerminals:hTe,newTerminal:pTe,allRepos:mTe,editTab:gTe,newTab:bTe},yTe="Repositories",_Te="{{count}} total",ETe="Search repositories...",STe="New Task",xTe="Tasks",wTe="Terminal",TTe="Editor",CTe="Settings",ATe="Add Repository",kTe="Scan Directory",OTe="Open in Terminal",RTe="Open in {{editor}}",NTe={openInVSCode:"Open in VS Code"},ITe={title:"Add Repository",description:"Add a git repository from a URL or local path.",inputLabel:"Repository URL or path",inputPlaceholder:"https://github.com/user/repo or /local/path",browse:"Browse...",willCloneTo:"Will clone to",cloning:"Cloning repository...",adding:"Adding...",cloneFailed:"Failed to clone repository",createFailed:"Failed to add repository",cancel:"Cancel",add:"Add",retry:"Retry",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."}},DTe={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.",help:"Copier generates new projects from templates, letting you scaffold applications with pre-configured settings.",learnMore:"Learn more about Copier",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",trustTemplate:"Trust this template",trustWarning:"This template runs code during project creation. Only enable if you trust the source."},creating:{description:"Creating your project...",inProgress:"Running Copier..."}}},LTe={title:"Scan Directory for Repositories",description:"Find and add multiple git repositories from a directory.",directoryLabel:"Directory to scan",directoryPlaceholder:"Enter directory path",browse:"Browse...",scan:"Scan",foundRepos:"Found {{count}} repositories",selectAll:"Select all",selectNone:"Select none",noReposFound:"No git repositories found in this directory.",alreadyAdded:"Already added",adding:"Adding repositories...",scanFailed:"Failed to scan directory",addFailed:"Failed to add repositories",cancel:"Cancel",addSelected:"Add {{count}} selected"},PTe={noRepositories:"No repositories added yet. Add a repository for quick access when creating tasks.",noMatches:"No repositories match your search."},MTe={failedToLoad:"Failed to load repositories: {{message}}"},jTe={title:yTe,total:_Te,searchPlaceholder:ETe,newTask:STe,viewTasks:xTe,terminal:wTe,editor:TTe,settings:CTe,addRepository:ATe,scanDirectory:kTe,openInTerminal:OTe,openInEditor:RTe,card:NTe,delete:{title:"Delete Repository",description:'This will remove "{{name}}" from Vibora. The actual repository files will not be affected.',button:"Delete",deleting:"Deleting..."},addModal:ITe,newProject:DTe,bulkAdd:LTe,empty:PTe,error:MTe},FTe={save:"保存更改",cancel:"取消",delete:"删除",create:"创建",reset:"重置为默认值",browse:"浏览",clearFilters:"清除筛选"},BTe={loading:"加载中...",saving:"保存中...",saved:"已保存",error:"错误",calculating:"计算中...",validating:"验证中...",creating:"创建中...",deleting:"删除中...",loggingIn:"登录中..."},UTe={justNow:"刚刚",minuteAgo:"1 分钟前",minutesAgo:"{{count}} 分钟前",hourAgo:"1 小时前",hoursAgo:"{{count}} 小时前",dayAgo:"1 天前",daysAgo:"{{count}} 天前"},$Te={one:"{{count}} 个结果",other:"{{count}} 个结果"},zTe={IN_PROGRESS:"进行中",IN_REVIEW:"审核中",DONE:"已完成",CANCELED:"已取消",ORPHANED:"孤立"},HTe={loginTitle:"登录 Vibora",username:"用户名",password:"密码",login:"登录",loginFailed:"登录失败"},WTe={buttons:FTe,status:BTe,time:UTe,results:$Te,statuses:zTe,auth:HTe},VTe={tasks:"任务",terminals:"终端",worktrees:"工作树",repositories:"仓库",review:"审核",monitoring:"监控",settings:"设置",commandPalette:"命令面板 ({{shortcut}})"},GTe={placeholder:"输入命令或搜索...",noResults:"未找到命令",categories:{navigation:"导航",actions:"操作"},commands:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",newTask:"新建任务",keyboardShortcuts:"键盘快捷键"}},qTe={title:"键盘快捷键",groups:{navigation:"导航",actions:"操作",general:"通用"},labels:{goToTasks:"前往任务",goToTerminals:"前往终端",goToTaskTerminals:"前往任务终端",goToWorktrees:"前往工作树",goToRepositories:"前往仓库",goToSettings:"前往设置",commandPalette:"命令面板",newTask:"新建任务",keyboardShortcuts:"键盘快捷键",closeModal:"关闭弹窗"}},KTe={header:VTe,commandPalette:GTe,shortcuts:qTe},YTe="任务",XTe="搜索",ZTe="全部仓库",QTe="新建任务",JTe={title:"创建新任务",description:"创建一个带有 Git 工作树的新任务,用于隔离开发。",fields:{title:"标题",titlePlaceholder:"添加用户认证",description:"描述",descriptionPlaceholder:"实现 OAuth2 登录流程...",aiMode:"AI 模式",repository:"仓库",baseBranch:"基础分支",branchName:"分支名称",branchPlaceholder:"自动生成分支名"},aiModes:{plan:"计划",default:"默认"},tabs:{saved:"仓库",browse:"浏览"},worktreePrefix:"工作树:",branchAutoGenerated:'留空将使用 "{{branch}}"。',selectFolder:"选择文件夹...",searchRepositories:"搜索仓库...",noRepositoriesFound:"未找到仓库",selectRepositoryFirst:"请先选择仓库",loadingBranches:"加载分支中...",selectBranch:"选择分支",current:"(当前)",createTask:"创建任务",errors:{notGitRepo:"所选文件夹不是 Git 仓库",validationFailed:"验证仓库失败",createFailed:"创建任务失败"}},eCe={title:YTe,searchPlaceholder:XTe,allRepos:ZTe,newTask:QTe,createModal:JTe},tCe="设置",nCe={server:"服务器",serverDefaults:"服务器与默认设置",paths:"路径",editor:"编辑器",integrations:"集成",zai:"z.ai",notifications:"通知",appearance:"外观",developer:"开发者"},rCe={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 的个人访问令牌"},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":"深色(色盲友好)"}}},iCe={enable:"启用通知",sound:"声音",slack:"Slack",discord:"Discord",pushover:"Pushover",appToken:"应用令牌",userKey:"用户密钥",testSuccess:"{{channel}} 测试成功",testFailed:"{{channel}} 测试失败:{{error}}",uploadSound:"上传自定义声音",deleteSound:"删除自定义声音",testSound:"测试声音",soundUploaded:"自定义声音已上传",soundUploadFailed:"上传声音失败:{{error}}",soundDeleted:"自定义声音已删除",soundDeleteFailed:"删除自定义声音失败",customSoundActive:"使用自定义声音"},aCe={restartButton:"重启 Vibora",restarting:"重启中...",restartDescription:"重新构建并重启 Vibora 服务器。如果构建失败,服务器将继续运行。",restartFailed:"重启失败",checkLogs:"构建可能失败。运行 journalctl --user -u vibora 查看详情。"},sCe={title:"未保存的更改",description:"您有未保存的更改,离开此页面将丢失这些更改。",stay:"留下",leave:"离开"},oCe={title:tCe,sections:nCe,fields:rCe,notifications:iCe,developer:aCe,unsavedChanges:sCe},lCe="审核",uCe={pullRequests:"拉取请求",issues:"问题"},cCe={pr:{created:"我创建的",assigned:"分配给我的",reviewRequested:"待我审核",mentioned:"提及我的"},issue:{assigned:"分配给我的",created:"我创建的",mentioned:"提及我的"},allOrgs:"所有组织",allOrganizations:"所有组织",viboraReposOnly:"仅 Vibora 仓库"},dCe={tokenRequired:"需要 GitHub 令牌",tokenDescription:"要查看您的问题和拉取请求,请在设置中添加 GitHub 个人访问令牌。",requiredScopes:"所需权限:",scopes:{repo:"(用于私有仓库)",readUser:"(用于用户信息)",readOrg:"(用于组织列表)"},generateToken:"生成令牌",goToSettings:"前往设置"},fCe={loading:"加载中...",failedToLoad:"加载拉取请求失败",empty:{all:"没有打开的拉取请求",created:"没有您创建的拉取请求",assigned:"没有分配给您的拉取请求",reviewRequested:"没有等待您审核的拉取请求",mentioned:"没有提及您的拉取请求"},draft:"草稿"},hCe={loading:"加载中...",failedToLoad:"加载问题失败",empty:{assigned:"没有分配给您的问题",created:"没有您创建的问题",mentioned:"没有提及您的问题"}},pCe={title:lCe,tabs:uCe,filters:cCe,github:dCe,prs:fCe,issues:hCe},mCe="工作树",gCe={total:"共 {{count}} 个",orphaned:"{{count}} 个孤立"},bCe={button:"清理 ({{count}})",title:"删除已完成的工作树",description:"这将永久删除 {{count}} 个工作树。",linkedTasksWillBeDeleted:"关联的任务也将被删除。",alsoDeleteLinkedTasks:"同时删除关联的任务",done:"已完成",canceled:"已取消",cannotUndo:"此操作无法撤销。"},vCe={noMatch:"没有匹配所选筛选条件的工作树。",noWorktrees:"未找到工作树。工作树在创建任务时自动生成。"},yCe={failedToLoad:"加载工作树失败:{{message}}"},_Ce={title:mCe,summary:gCe,cleanup:bCe,delete:{title:"删除工作树",description:"这将永久删除位于以下位置的工作树目录",linkedTaskWillBeDeleted:'关联的任务 "{{title}}" 也将被删除。',alsoDeleteLinkedTask:'同时删除关联的任务 "{{title}}"',cannotUndo:"此操作无法撤销。",button:"删除 {{count}} 个"},empty:vCe,error:yCe},ECe="监控",SCe={claude:"Claude 实例",system:"系统指标",processes:"进程",vibora:"Vibora 服务器",usage:"使用限额"},xCe={showAllInstances:"显示所有实例",instanceCount:"{{count}} 个实例运行中",totalRam:"总计 {{ram}} MB",headers:{terminal:"终端",task:"任务",ram:"内存",actions:"操作",pid:"PID",workingDirectory:"工作目录",source:"来源"},noTask:"(无任务)",kill:"终止",killing:"终止中...",killSelected:"终止 {{count}} 个已选",source:{vibora:"Vibora: {{name}}",external:"外部"},empty:"没有 Claude 实例运行中",emptyVibora:" (在 Vibora 终端中)",error:"加载 Claude 实例失败:{{message}}"},wCe={cpuUsage:"CPU 使用率",memoryUsage:"内存使用率",memoryLabels:{used:"已使用",cache:"缓存/缓冲区"},diskUsage:"磁盘使用率 ({{path}})",error:"加载系统指标失败:{{message}}"},TCe={topProcesses:"热门进程",sortBy:{memory:"按内存",cpu:"按 CPU"},headers:{pid:"PID",name:"名称",command:"命令",memory:"内存"},empty:"未找到进程",error:"加载进程失败:{{message}}",containers:"容器",containersEmpty:"没有容器运行中",containersUnavailable:"Docker/Podman 不可用"},CCe={description:"运行中的 Vibora 开发服务器",instanceCount:"{{count}} 个实例运行中",headers:{port:"端口",mode:"模式",directory:"目录",ram:"内存",actions:"操作"},mode:{dev:"开发",prod:"生产"},vite:"Vite",kill:"终止",killing:"终止中...",empty:"没有 Vibora 实例运行中",error:"加载 Vibora 实例失败:{{message}}"},ACe={fiveHourBlock:"5小时配额",sevenDayRolling:"7天滚动配额",opusWeekly:"Opus 周配额",sonnetWeekly:"Sonnet 周配额",resetsIn:"{{time}}后重置",resetsAt:"{{time}}重置",weekProgress:"本周已过 {{percent}}%",unavailable:"Claude Code 使用数据不可用。请确保已登录 Claude Code。",error:"加载使用数据失败:{{message}}"},kCe={title:ECe,tabs:SCe,claude:xCe,system:wCe,processes:TCe,vibora:CCe,usage:ACe},OCe="任务",RCe="新建终端",NCe="全部仓库",ICe={taskTerminals:OCe,newTerminal:RCe,allRepos:NCe},DCe="仓库",LCe="共 {{count}} 个",PCe="搜索仓库...",MCe="新建任务",jCe="添加仓库",FCe="扫描目录",BCe={openInVSCode:"在 VS Code 中打开"},UCe={title:"添加仓库",description:"从 URL 或本地路径添加 Git 仓库。",inputLabel:"仓库 URL 或路径",inputPlaceholder:"https://github.com/user/repo 或 /local/path",browse:"浏览...",willCloneTo:"将克隆到",cloning:"正在克隆仓库...",adding:"添加中...",cloneFailed:"克隆仓库失败",createFailed:"添加仓库失败",cancel:"取消",add:"添加",retry:"重试",fields:{path:"仓库路径",pathPlaceholder:"选择仓库...",displayName:"显示名称",startupScript:"启动脚本",startupScriptPlaceholder:"npm install && npm run dev",startupScriptDescription:"创建工作树时在终端中运行的命令。",copyFiles:"复制文件",copyFilesPlaceholder:".env, config.local.json",copyFilesDescription:"用逗号分隔的 glob 模式,用于复制文件到新的工作树。"}},$Ce={title:"扫描目录中的仓库",description:"从目录中查找并添加多个 Git 仓库。",directoryLabel:"要扫描的目录",directoryPlaceholder:"输入目录路径",browse:"浏览...",scan:"扫描",foundRepos:"找到 {{count}} 个仓库",selectAll:"全选",selectNone:"取消全选",noReposFound:"此目录中未找到 Git 仓库。",alreadyAdded:"已添加",adding:"正在添加仓库...",scanFailed:"扫描目录失败",addFailed:"添加仓库失败",cancel:"取消",addSelected:"添加 {{count}} 个选中项"},zCe={button:"新建项目",title:"创建新项目",back:"返回",next:"下一步",create:"创建项目",steps:{template:{description:"选择一个模板来创建您的项目。",help:"Copier 从模板生成新项目,让您可以使用预配置的设置快速搭建应用程序。",learnMore:"了解更多关于 Copier",savedTemplates:"已保存的模板",selectTemplate:"选择模板...",or:"或",customUrl:"自定义模板 URL/路径",customUrlHelp:"Copier 模板的 Git URL 或本地路径。"},questions:{description:"配置您的项目。",noQuestions:"此模板没有配置问题。"},output:{description:"选择项目创建位置。",projectName:"项目名称",outputDirectory:"输出目录",selectDirectory:"选择目录...",willCreate:"将创建"},creating:{description:"正在创建您的项目...",inProgress:"正在运行 Copier..."}}},HCe={noRepositories:"尚未添加任何仓库。添加一个仓库以便在创建任务时快速访问。",noMatches:"没有匹配的仓库。"},WCe={failedToLoad:"加载仓库失败:{{message}}"},VCe={title:DCe,total:LCe,searchPlaceholder:PCe,newTask:MCe,addRepository:jCe,scanDirectory:FCe,card:BCe,delete:{title:"删除仓库",description:'这将从 Vibora 中移除 "{{name}}"。实际的仓库文件不会受到影响。',button:"删除",deleting:"删除中..."},addModal:UCe,bulkAdd:$Ce,newProject:zCe,empty:HCe,error:WCe},GCe="common",JI=["en","zh"],qCe={en:{common:kwe,navigation:Iwe,tasks:Fwe,settings:Vwe,review:Qwe,worktrees:iTe,monitoring:fTe,terminals:vTe,repositories:jTe},zh:{common:WTe,navigation:KTe,tasks:eCe,settings:oCe,review:pCe,worktrees:_Ce,monitoring:kCe,terminals:ICe,repositories:VCe}};function KCe(){if(typeof window<"u"){const e=localStorage.getItem("vibora-language");if(e&&JI.includes(e))return e;const t=navigator.language.split("-")[0];if(JI.includes(t))return t}return"en"}Vi.use(kge).init({resources:qCe,lng:KCe(),fallbackLng:"en",defaultNS:GCe,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 Rne(){const{i18n:e}=tn(),{data:t,isSuccess:n}=Qxe(),r=Cne();k.useEffect(()=>{n&&t&&t!==e.language&&e.changeLanguage(t)},[n,t,e]);const i=k.useCallback(async a=>{if(a)await e.changeLanguage(a);else{const s=navigator.language.split("-")[0],o=JI.includes(s)?s:"en";await e.changeLanguage(o)}r.mutate({key:In.LANGUAGE,value:a??""})},[e,r]);return{language:e.language,savedLanguage:t,changeLanguage:i,isUpdating:r.isPending}}function sn(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var YCe={};function tw(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:YCe}var Nne=Object.assign,XE=Object.getOwnPropertyDescriptor,Qo=Object.defineProperty,nw=Object.prototype,eD=[];Object.freeze(eD);var jM={};Object.freeze(jM);var XCe=typeof Proxy<"u",ZCe=Object.toString();function Ine(){XCe||sn("Proxy not available")}function Dne(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var rp=function(){};function ns(e){return typeof e=="function"}function Nf(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function rw(e){return e!==null&&typeof e=="object"}function Hc(e){if(!rw(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n.toString()===ZCe}function Lne(e){var t=e?.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function iw(e,t,n){Qo(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Pne(e,t,n){Qo(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function id(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return rw(r)&&r[n]===!0}}function Im(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function QCe(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function Zl(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Mne=typeof Object.getOwnPropertySymbols<"u";function JCe(e){var t=Object.keys(e);if(!Mne)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return nw.propertyIsEnumerable.call(e,r)})):t}var aw=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Mne?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function jne(e){return e===null?null:typeof e=="object"?""+e:e}function lu(e,t){return nw.hasOwnProperty.call(e,t)}var eAe=Object.getOwnPropertyDescriptors||function(t){var n={};return aw(t).forEach(function(r){n[r]=XE(t,r)}),n};function Xa(e,t){return!!(e&t)}function Za(e,t,n){return n?e|=t:e&=~t,e}function vz(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function tAe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,rAe(r.key),r)}}function Dm(e,t,n){return t&&tAe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ip(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=iAe(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
26
26
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Wc(){return Wc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Wc.apply(null,arguments)}function Fne(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,tD(e,t)}function tD(e,t){return tD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},tD(e,t)}function nAe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function rAe(e){var t=nAe(e,"string");return typeof t=="symbol"?t:t+""}function iAe(e,t){if(e){if(typeof e=="string")return vz(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vz(e,t):void 0}}var qo=Symbol("mobx-stored-annotations");function Jo(e){function t(n,r){if(Zy(r))return e.decorate_20223_(n,r);Xy(n,r,e)}return Object.assign(t,e)}function Xy(e,t,n){lu(e,qo)||iw(e,qo,Wc({},e[qo])),dAe(n)||(e[qo][t]=n)}function aAe(e){return lu(e,qo)||iw(e,qo,Wc({},e[qo])),e[qo]}function Zy(e){return typeof e=="object"&&typeof e.kind=="string"}var jt=Symbol("mobx administration"),ad=(function(){function e(n){n===void 0&&(n="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=kn.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return tre(this)},t.reportChanged=function(){ba(),nre(this),va()},t.toString=function(){return this.name_},Dm(e,[{key:"isBeingObserved",get:function(){return Xa(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Za(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Xa(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Za(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Xa(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Za(this.flags_,e.diffValueMask_,r===1)}}])})();ad.isBeingObservedMask_=1;ad.isPendingUnobservationMask_=2;ad.diffValueMask_=4;var FM=id("Atom",ad);function ZE(e,t,n){t===void 0&&(t=rp),n===void 0&&(n=rp);var r=new ad(e);return t!==rp&&pke(r,t),n!==rp&&cre(r,n),r}function sAe(e,t){return Are(e,t)}function oAe(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Pp={structural:sAe,default:oAe};function If(e,t,n){return mre(e)?e:Array.isArray(e)?fr.array(e,{name:n}):Hc(e)?fr.object(e,void 0,{name:n}):Im(e)?fr.map(e,{name:n}):Zl(e)?fr.set(e,{name:n}):typeof e=="function"&&!Mp(e)&&!wv(e)?Lne(e)?jp(e):xv(n,e):e}function lAe(e,t,n){if(e==null||ko(e)||gl(e)||$s(e)||ta(e))return e;if(Array.isArray(e))return fr.array(e,{name:n,deep:!1});if(Hc(e))return fr.object(e,void 0,{name:n,deep:!1});if(Im(e))return fr.map(e,{name:n,deep:!1});if(Zl(e))return fr.set(e,{name:n,deep:!1})}function sw(e){return e}function uAe(e,t){return Are(e,t)?t:e}var cAe="override";function dAe(e){return e.annotationType_===cAe}function Qy(e,t){return{annotationType_:e,options_:t,make_:fAe,extend_:hAe,decorate_20223_:pAe}}function fAe(e,t,n,r){var i;if((i=this.options_)!=null&&i.bound)return this.extend_(e,t,n,!1)===null?0:1;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(Mp(n.value))return 1;var a=Bne(e,this,t,n,!1);return Qo(r,t,a),2}function hAe(e,t,n,r){var i=Bne(e,this,t,n);return e.defineProperty_(t,i,r)}function pAe(e,t){var n=t.kind,r=t.name,i=t.addInitializer,a=this,s=function(u){var f,d,p,m;return Vc((f=(d=a.options_)==null?void 0:d.name)!=null?f:r.toString(),u,(p=(m=a.options_)==null?void 0:m.autoAction)!=null?p:!1)};if(n=="field")return function(l){var u,f=l;return Mp(f)||(f=s(f)),(u=a.options_)!=null&&u.bound&&(f=f.bind(this),f.isMobxAction=!0),f};if(n=="method"){var o;return Mp(e)||(e=s(e)),(o=this.options_)!=null&&o.bound&&i(function(){var l=this,u=l[r].bind(l);u.isMobxAction=!0,l[r]=u}),e}sn("Cannot apply '"+a.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
27
27
  '`+a.annotationType_+"' can only be used on properties with a function value."))}function mAe(e,t,n,r){t.annotationType_,r.value}function Bne(e,t,n,r,i){var a,s,o,l,u,f,d;i===void 0&&(i=ut.safeDescriptors),mAe(e,t,n,r);var p=r.value;if((a=t.options_)!=null&&a.bound){var m;p=p.bind((m=e.proxy_)!=null?m:e.target_)}return{value:Vc((s=(o=t.options_)==null?void 0:o.name)!=null?s:n.toString(),p,(l=(u=t.options_)==null?void 0:u.autoAction)!=null?l:!1,(f=t.options_)!=null&&f.bound?(d=e.proxy_)!=null?d:e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function Une(e,t){return{annotationType_:e,options_:t,make_:gAe,extend_:bAe,decorate_20223_:vAe}}function gAe(e,t,n,r){var i;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((i=this.options_)!=null&&i.bound&&(!lu(e.target_,t)||!wv(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(wv(n.value))return 1;var a=$ne(e,this,t,n,!1,!1);return Qo(r,t,a),2}function bAe(e,t,n,r){var i,a=$ne(e,this,t,n,(i=this.options_)==null?void 0:i.bound);return e.defineProperty_(t,a,r)}function vAe(e,t){var n,r=t.name,i=t.addInitializer;return wv(e)||(e=jp(e)),(n=this.options_)!=null&&n.bound&&i(function(){var a=this,s=a[r].bind(a);s.isMobXFlow=!0,a[r]=s}),e}function yAe(e,t,n,r){t.annotationType_,r.value}function $ne(e,t,n,r,i,a){a===void 0&&(a=ut.safeDescriptors),yAe(e,t,n,r);var s=r.value;if(wv(s)||(s=jp(s)),i){var o;s=s.bind((o=e.proxy_)!=null?o:e.target_),s.isMobXFlow=!0}return{value:s,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function BM(e,t){return{annotationType_:e,options_:t,make_:_Ae,extend_:EAe,decorate_20223_:SAe}}function _Ae(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function EAe(e,t,n,r){return xAe(e,this,t,n),e.defineComputedProperty_(t,Wc({},this.options_,{get:n.get,set:n.set}),r)}function SAe(e,t){var n=this,r=t.name,i=t.addInitializer;return i(function(){var a=Pm(this)[jt],s=Wc({},n.options_,{get:e,context:this});s.name||(s.name="ObservableObject."+r.toString()),a.values_.set(r,new mo(s))}),function(){return this[jt].getObservablePropValue_(r)}}function xAe(e,t,n,r){t.annotationType_,r.get}function ow(e,t){return{annotationType_:e,options_:t,make_:wAe,extend_:TAe,decorate_20223_:CAe}}function wAe(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function TAe(e,t,n,r){var i,a;return AAe(e,this),e.defineObservableProperty_(t,n.value,(i=(a=this.options_)==null?void 0:a.enhancer)!=null?i:If,r)}function CAe(e,t){var n=this,r=t.kind,i=t.name,a=new WeakSet;function s(o,l){var u,f,d=Pm(o)[jt],p=new jc(l,(u=(f=n.options_)==null?void 0:f.enhancer)!=null?u:If,"ObservableObject."+i.toString(),!1);d.values_.set(i,p),a.add(o)}if(r=="accessor")return{get:function(){return a.has(this)||s(this,e.get.call(this)),this[jt].getObservablePropValue_(i)},set:function(l){return a.has(this)||s(this,l),this[jt].setObservablePropValue_(i,l)},init:function(l){return a.has(this)||s(this,l),l}}}function AAe(e,t,n,r){t.annotationType_}var kAe="true",OAe=zne();function zne(e){return{annotationType_:kAe,options_:e,make_:RAe,extend_:NAe,decorate_20223_:IAe}}function RAe(e,t,n,r){var i,a;if(n.get)return Lm.make_(e,t,n,r);if(n.set){var s=Mp(n.set)?n.set:Vc(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:ut.safeDescriptors?e.isPlainObject_:!0,set:s})===null?0:2:(Qo(r,t,{configurable:!0,set:s}),2)}if(r!==e.target_&&typeof n.value=="function"){var o;if(Lne(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?jp.bound:jp;return u.make_(e,t,n,r)}var f=(o=this.options_)!=null&&o.autoBind?xv.bound:xv;return f.make_(e,t,n,r)}var d=((i=this.options_)==null?void 0:i.deep)===!1?fr.ref:fr;if(typeof n.value=="function"&&(a=this.options_)!=null&&a.autoBind){var p;n.value=n.value.bind((p=e.proxy_)!=null?p:e.target_)}return d.make_(e,t,n,r)}function NAe(e,t,n,r){var i,a;if(n.get)return Lm.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:ut.safeDescriptors?e.isPlainObject_:!0,set:Vc(t.toString(),n.set)},r);if(typeof n.value=="function"&&(i=this.options_)!=null&&i.autoBind){var s;n.value=n.value.bind((s=e.proxy_)!=null?s:e.target_)}var o=((a=this.options_)==null?void 0:a.deep)===!1?fr.ref:fr;return o.extend_(e,t,n,r)}function IAe(e,t){sn("'"+this.annotationType_+"' cannot be used as a decorator")}var DAe="observable",LAe="observable.ref",PAe="observable.shallow",MAe="observable.struct",Hne={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Hne);function v_(e){return e||Hne}var nD=ow(DAe),jAe=ow(LAe,{enhancer:sw}),FAe=ow(PAe,{enhancer:lAe}),BAe=ow(MAe,{enhancer:uAe}),Wne=Jo(nD);function y_(e){return e.deep===!0?If:e.deep===!1?sw:$Ae(e.defaultDecorator)}function UAe(e){var t;return e?(t=e.defaultDecorator)!=null?t:zne(e):void 0}function $Ae(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:If}function Vne(e,t,n){if(Zy(t))return nD.decorate_20223_(e,t);if(Nf(t)){Xy(e,t,nD);return}return mre(e)?e:Hc(e)?fr.object(e,t,n):Array.isArray(e)?fr.array(e,t):Im(e)?fr.map(e,t):Zl(e)?fr.set(e,t):typeof e=="object"&&e!==null?e:fr.box(e,t)}Nne(Vne,Wne);var zAe={box:function(t,n){var r=v_(n);return new jc(t,y_(r),r.name,!0,r.equals)},array:function(t,n){var r=v_(n);return(ut.useProxies===!1||r.proxy===!1?Wke:Lke)(t,y_(r),r.name)},map:function(t,n){var r=v_(n);return new VM(t,y_(r),r.name)},set:function(t,n){var r=v_(n);return new Sre(t,y_(r),r.name)},object:function(t,n,r){return qf(function(){return vke(ut.useProxies===!1||r?.proxy===!1?Pm({},r):Nke({},r),t,n)})},ref:Jo(jAe),shallow:Jo(FAe),deep:Wne,struct:Jo(BAe)},fr=Nne(Vne,zAe),Gne="computed",HAe="computed.struct",rD=BM(Gne),WAe=BM(HAe,{equals:Pp.structural}),Lm=function(t,n){if(Zy(n))return rD.decorate_20223_(t,n);if(Nf(n))return Xy(t,n,rD);if(Hc(t))return Jo(BM(Gne,t));var r=Hc(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new mo(r)};Object.assign(Lm,rD);Lm.struct=Jo(WAe);var yz,_z,QE=0,VAe=1,GAe=(yz=(_z=XE(function(){},"name"))==null?void 0:_z.configurable)!=null?yz:!1,Ez={value:"action",configurable:!0,writable:!1,enumerable:!1};function Vc(e,t,n,r){n===void 0&&(n=!1);function i(){return qne(e,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=function(){return t.toString()},GAe&&(Ez.value=e,Qo(i,"name",Ez)),i}function qne(e,t,n,r,i){var a=qAe(e,t);try{return n.apply(r,i)}catch(s){throw a.error_=s,s}finally{KAe(a)}}function qAe(e,t,n,r){var i=!1,a=0,s=ut.trackingDerivation,o=!t||!s;ba();var l=ut.allowStateChanges;o&&(Gf(),l=lw(!0));var u=UM(!0),f={runAsAction_:o,prevDerivation_:s,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:i,startTime_:a,actionId_:VAe++,parentActionId_:QE};return QE=f.actionId_,f}function KAe(e){QE!==e.actionId_&&sn(30),QE=e.parentActionId_,e.error_!==void 0&&(ut.suppressReactionErrors=!0),uw(e.prevAllowStateChanges_),$b(e.prevAllowStateReads_),va(),e.runAsAction_&&uu(e.prevDerivation_),ut.suppressReactionErrors=!1}function Kne(e,t){var n=lw(e);try{return t()}finally{uw(n)}}function lw(e){var t=ut.allowStateChanges;return ut.allowStateChanges=e,t}function uw(e){ut.allowStateChanges=e}var jc=(function(e){function t(r,i,a,s,o){var l;return a===void 0&&(a="ObservableValue"),o===void 0&&(o=Pp.default),l=e.call(this,a)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=i,l.name_=a,l.equals=o,l.value_=i(r,void 0,a),l}Fne(t,e);var n=t.prototype;return n.dehanceValue=function(i){return this.dehancer!==void 0?this.dehancer(i):i},n.set=function(i){this.value_,i=this.prepareNewValue_(i),i!==ut.UNCHANGED&&this.setNewValue_(i)},n.prepareNewValue_=function(i){if(As(this)){var a=ks(this,{object:this,type:el,newValue:i});if(!a)return ut.UNCHANGED;i=a.newValue}return i=this.enhancer(i,this.value_,this.name_),this.equals(this.value_,i)?ut.UNCHANGED:i},n.setNewValue_=function(i){var a=this.value_;this.value_=i,this.reportChanged(),lo(this)&&uo(this,{type:el,object:this,newValue:i,oldValue:a})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(i){return Jy(this,i)},n.observe_=function(i,a){return a&&i({observableKind:"value",debugObjectName:this.name_,object:this,type:el,newValue:this.value_,oldValue:void 0}),e0(this,i)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return jne(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t})(ad),YAe=id("ObservableValue",jc),mo=(function(){function e(n){this.dependenciesState_=kn.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=kn.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new eS(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=JE.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||sn(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=Vc("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Pp.structural:Pp.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){tke(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&sn(32,this.name_,this.derivation),ut.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)iD(this)&&(this.warnAboutUntrackedRead_(),ba(),this.value_=this.computeValue_(!1),va());else if(tre(this),iD(this)){var r=ut.trackingContext;this.keepAlive_&&!r&&(ut.trackingContext=this),this.trackAndCompute()&&eke(this),ut.trackingContext=r}var i=this.value_;if(aE(i))throw i.cause;return i},t.set=function(r){if(this.setter_){this.isRunningSetter&&sn(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else sn(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,i=this.dependenciesState_===kn.NOT_TRACKING_,a=this.computeValue_(!0),s=i||aE(r)||aE(a)||!this.equals_(r,a);return s&&(this.value_=a),s},t.computeValue_=function(r){this.isComputing=!0;var i=lw(!1),a;if(r)a=Yne(this,this.derivation,this.scope_);else if(ut.disableErrorBoundaries===!0)a=this.derivation.call(this.scope_);else try{a=this.derivation.call(this.scope_)}catch(s){a=new eS(s)}return uw(i),this.isComputing=!1,a},t.suspend_=function(){this.keepAlive_||(aD(this),this.value_=void 0)},t.observe_=function(r,i){var a=this,s=!0,o=void 0;return lre(function(){var l=a.get();if(!s||i){var u=Gf();r({observableKind:"computed",debugObjectName:a.name_,type:el,object:a,newValue:l,oldValue:o}),uu(u)}s=!1,o=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return jne(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Dm(e,[{key:"isComputing",get:function(){return Xa(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=Za(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return Xa(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=Za(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return Xa(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=Za(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return Xa(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=Za(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return Xa(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Za(this.flags_,e.diffValueMask_,r===1)}}])})();mo.isComputingMask_=1;mo.isRunningSetterMask_=2;mo.isBeingObservedMask_=4;mo.isPendingUnobservationMask_=8;mo.diffValueMask_=16;var cw=id("ComputedValue",mo),kn;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(kn||(kn={}));var JE;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(JE||(JE={}));var eS=function(t){this.cause=void 0,this.cause=t};function aE(e){return e instanceof eS}function iD(e){switch(e.dependenciesState_){case kn.UP_TO_DATE_:return!1;case kn.NOT_TRACKING_:case kn.STALE_:return!0;case kn.POSSIBLY_STALE_:{for(var t=UM(!0),n=Gf(),r=e.observing_,i=r.length,a=0;a<i;a++){var s=r[a];if(cw(s)){if(ut.disableErrorBoundaries)s.get();else try{s.get()}catch{return uu(n),$b(t),!0}if(e.dependenciesState_===kn.STALE_)return uu(n),$b(t),!0}}return Zne(e),uu(n),$b(t),!1}}}function Yne(e,t,n){var r=UM(!0);Zne(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++ut.runId;var i=ut.trackingDerivation;ut.trackingDerivation=e,ut.inBatch++;var a;if(ut.disableErrorBoundaries===!0)a=t.call(n);else try{a=t.call(n)}catch(s){a=new eS(s)}return ut.inBatch--,ut.trackingDerivation=i,XAe(e),$b(r),a}function XAe(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=kn.UP_TO_DATE_,i=0,a=e.unboundDepsCount_,s=0;s<a;s++){var o=n[s];o.diffValue===0&&(o.diffValue=1,i!==s&&(n[i]=o),i++),o.dependenciesState_>r&&(r=o.dependenciesState_)}for(n.length=i,e.newObserving_=null,a=t.length;a--;){var l=t[a];l.diffValue===0&&Jne(l,e),l.diffValue=0}for(;i--;){var u=n[i];u.diffValue===1&&(u.diffValue=0,JAe(u,e))}r!==kn.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function aD(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Jne(t[n],e);e.dependenciesState_=kn.NOT_TRACKING_}function Xne(e){var t=Gf();try{return e()}finally{uu(t)}}function Gf(){var e=ut.trackingDerivation;return ut.trackingDerivation=null,e}function uu(e){ut.trackingDerivation=e}function UM(e){var t=ut.allowStateReads;return ut.allowStateReads=e,t}function $b(e){ut.allowStateReads=e}function Zne(e){if(e.dependenciesState_!==kn.UP_TO_DATE_){e.dependenciesState_=kn.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=kn.UP_TO_DATE_}}var sE=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},oE=!0,Qne=!1,ut=(function(){var e=tw();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(oE=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new sE().version&&(oE=!1),oE?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new sE):(setTimeout(function(){Qne||sn(35)},1),new sE)})();function ZAe(){if((ut.pendingReactions.length||ut.inBatch||ut.isRunningReactions)&&sn(36),Qne=!0,oE){var e=tw();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),ut=new sE}}function QAe(){return ut}function JAe(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Jne(e,t){e.observers_.delete(t),e.observers_.size===0&&ere(e)}function ere(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,ut.pendingUnobservations.push(e))}function ba(){ut.inBatch++}function va(){if(--ut.inBatch===0){rre();for(var e=ut.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof mo&&n.suspend_())}ut.pendingUnobservations=[]}}function tre(e){var t=ut.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&ut.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&ut.inBatch>0&&ere(e),!1)}function nre(e){e.lowestObserverState_!==kn.STALE_&&(e.lowestObserverState_=kn.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===kn.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=kn.STALE_}))}function eke(e){e.lowestObserverState_!==kn.STALE_&&(e.lowestObserverState_=kn.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===kn.POSSIBLY_STALE_?t.dependenciesState_=kn.STALE_:t.dependenciesState_===kn.UP_TO_DATE_&&(e.lowestObserverState_=kn.UP_TO_DATE_)}))}function tke(e){e.lowestObserverState_===kn.UP_TO_DATE_&&(e.lowestObserverState_=kn.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===kn.UP_TO_DATE_&&(t.dependenciesState_=kn.POSSIBLY_STALE_,t.onBecomeStale_())}))}var ll=(function(){function e(n,r,i,a){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=kn.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=JE.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=i,this.requiresObservable_=a}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,ut.pendingReactions.push(this),rre())},t.runReaction_=function(){if(!this.isDisposed){ba(),this.isScheduled=!1;var r=ut.trackingContext;if(ut.trackingContext=this,iD(this)){this.isTrackPending=!0;try{this.onInvalidate_()}catch(i){this.reportExceptionInDerivation_(i)}}ut.trackingContext=r,va()}},t.track=function(r){if(!this.isDisposed){ba(),this.isRunning=!0;var i=ut.trackingContext;ut.trackingContext=this;var a=Yne(this,r,void 0);ut.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&aD(this),aE(a)&&this.reportExceptionInDerivation_(a.cause),va()}},t.reportExceptionInDerivation_=function(r){var i=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(ut.disableErrorBoundaries)throw r;var a="[mobx] uncaught error in '"+this+"'";ut.suppressReactionErrors||console.error(a,r),ut.globalReactionErrorHandlers.forEach(function(s){return s(r,i)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(ba(),aD(this),va()))},t.getDisposer_=function(r){var i=this,a=function s(){i.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",s)};return r==null||r.addEventListener==null||r.addEventListener("abort",a),a[jt]=this,"dispose"in Symbol&&typeof Symbol.dispose=="symbol"&&(a[Symbol.dispose]=a),a},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},Dm(e,[{key:"isDisposed",get:function(){return Xa(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=Za(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return Xa(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=Za(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return Xa(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=Za(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return Xa(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=Za(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return Xa(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=Za(this.flags_,e.diffValueMask_,r===1)}}])})();ll.isDisposedMask_=1;ll.isScheduledMask_=2;ll.isTrackPendingMask_=4;ll.isRunningMask_=8;ll.diffValueMask_=16;var nke=100,sD=function(t){return t()};function rre(){ut.inBatch>0||ut.isRunningReactions||sD(rke)}function rke(){ut.isRunningReactions=!0;for(var e=ut.pendingReactions,t=0;e.length>0;){++t===nke&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}ut.isRunningReactions=!1}var tS=id("Reaction",ll);function ike(e){var t=sD;sD=function(r){return e(function(){return t(r)})}}function zb(){return!1}function ake(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var ire="action",ske="action.bound",are="autoAction",oke="autoAction.bound",sre="<unnamed action>",oD=Qy(ire),lke=Qy(ske,{bound:!0}),lD=Qy(are,{autoAction:!0}),uke=Qy(oke,{autoAction:!0,bound:!0});function ore(e){var t=function(r,i){if(ns(r))return Vc(r.name||sre,r,e);if(ns(i))return Vc(r,i,e);if(Zy(i))return(e?lD:oD).decorate_20223_(r,i);if(Nf(i))return Xy(r,i,e?lD:oD);if(Nf(r))return Jo(Qy(e?are:ire,{name:r,autoAction:e}))};return t}var Jr=ore(!1);Object.assign(Jr,oD);var xv=ore(!0);Object.assign(xv,lD);Jr.bound=Jo(lke);xv.bound=Jo(uke);function Sz(e){return qne(e.name||sre,!1,e,this,void 0)}function Mp(e){return ns(e)&&e.isMobxAction===!0}function lre(e,t){var n,r,i,a;t===void 0&&(t=jM);var s=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",o=!t.scheduler&&!t.delay,l;if(o)l=new ll(s,function(){this.track(d)},t.onError,t.requiresObservable);else{var u=ure(t),f=!1;l=new ll(s,function(){f||(f=!0,u(function(){f=!1,l.isDisposed||l.track(d)}))},t.onError,t.requiresObservable)}function d(){e(l)}return(i=t)!=null&&(i=i.signal)!=null&&i.aborted||l.schedule_(),l.getDisposer_((a=t)==null?void 0:a.signal)}var cke=function(t){return t()};function ure(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:cke}function $M(e,t,n){var r,i,a;n===void 0&&(n=jM);var s=(r=n.name)!=null?r:"Reaction",o=Jr(s,n.onError?dke(n.onError,t):t),l=!n.scheduler&&!n.delay,u=ure(n),f=!0,d=!1,p,m=n.compareStructural?Pp.structural:n.equals||Pp.default,y=new ll(s,function(){f||l?S():d||(d=!0,u(S))},n.onError,n.requiresObservable);function S(){if(d=!1,!y.isDisposed){var g=!1,_=p;y.track(function(){var v=Kne(!1,function(){return e(y)});g=f||!m(p,v),p=v}),(f&&n.fireImmediately||!f&&g)&&o(p,_,y),f=!1}}return(i=n)!=null&&(i=i.signal)!=null&&i.aborted||y.schedule_(),y.getDisposer_((a=n)==null?void 0:a.signal)}function dke(e,t){return function(){try{return t.apply(this,arguments)}catch(n){e.call(this,n)}}}var fke="onBO",hke="onBUO";function pke(e,t,n){return dre(fke,e,t,n)}function cre(e,t,n){return dre(hke,e,t,n)}function dre(e,t,n,r){var i=Fp(t),a=ns(r)?r:n,s=e+"L";return i[s]?i[s].add(a):i[s]=new Set([a]),function(){var o=i[s];o&&(o.delete(a),o.size===0&&delete i[s])}}var mke="never",__="always",gke="observed";function bke(e){e.isolateGlobalState===!0&&ZAe();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(ut.useProxies=t===__?!0:t===mke?!1:typeof Proxy<"u"),t==="ifavailable"&&(ut.verifyProxies=!0),n!==void 0){var r=n===__?__:n===gke;ut.enforceActions=r,ut.allowStateChanges=!(r===!0||r===__)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(i){i in e&&(ut[i]=!!e[i])}),ut.allowStateReads=!ut.observableRequiresReaction,e.reactionScheduler&&ike(e.reactionScheduler)}function vke(e,t,n,r){var i=eAe(t);return qf(function(){var a=Pm(e,r)[jt];aw(i).forEach(function(s){a.extend_(s,i[s],n&&s in n?n[s]:!0)})}),e}function yke(e,t){return fre(Fp(e,t))}function fre(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=_ke(e.observing_).map(fre)),t}function _ke(e){return Array.from(new Set(e))}var Eke=0;function hre(){this.message="FLOW_CANCELLED"}hre.prototype=Object.create(Error.prototype);var pk=Une("flow"),Ske=Une("flow.bound",{bound:!0}),jp=Object.assign(function(t,n){if(Zy(n))return pk.decorate_20223_(t,n);if(Nf(n))return Xy(t,n,pk);var r=t,i=r.name||"<unnamed flow>",a=function(){var o=this,l=arguments,u=++Eke,f=Jr(i+" - runid: "+u+" - init",r).apply(o,l),d,p=void 0,m=new Promise(function(y,S){var g=0;d=S;function _(T){p=void 0;var w;try{w=Jr(i+" - runid: "+u+" - yield "+g++,f.next).call(f,T)}catch(C){return S(C)}x(w)}function v(T){p=void 0;var w;try{w=Jr(i+" - runid: "+u+" - yield "+g++,f.throw).call(f,T)}catch(C){return S(C)}x(w)}function x(T){if(ns(T?.then)){T.then(x,S);return}return T.done?y(T.value):(p=Promise.resolve(T.value),p.then(_,v))}_(void 0)});return m.cancel=Jr(i+" - runid: "+u+" - cancel",function(){try{p&&xz(p);var y=f.return(void 0),S=Promise.resolve(y.value);S.then(rp,rp),xz(S),d(new hre)}catch(g){d(g)}}),m};return a.isMobXFlow=!0,a},pk);jp.bound=Jo(Ske);function xz(e){ns(e.cancel)&&e.cancel()}function wv(e){return e?.isMobXFlow===!0}function pre(e,t,n){var r;return $s(e)||gl(e)||YAe(e)?r=ul(e):ko(e)&&(r=ul(e,t)),r.dehancer=typeof t=="function"?t:n,function(){r.dehancer=void 0}}function zM(e,t,n){return ns(n)?wke(e,t,n):xke(e,t)}function xke(e,t){return ul(e).intercept_(t)}function wke(e,t,n){return ul(e,t).intercept_(n)}function Tke(e,t){return e?ko(e)||!!e[jt]||FM(e)||tS(e)||cw(e):!1}function mre(e){return Tke(e)}function nS(e){if(ko(e))return e[jt].keys_();if($s(e)||ta(e))return Array.from(e.keys());if(gl(e))return e.map(function(t,n){return n});sn(5)}function gre(e){if(ko(e))return nS(e).map(function(t){return e[t]});if($s(e))return nS(e).map(function(t){return e.get(t)});if(ta(e))return Array.from(e.values());if(gl(e))return e.slice();sn(6)}function Cke(e){if(ko(e))return nS(e).map(function(t){return[t,e[t]]});if($s(e))return nS(e).map(function(t){return[t,e.get(t)]});if(ta(e))return Array.from(e.entries());if(gl(e))return e.map(function(t,n){return[n,t]});sn(7)}function bre(e,t,n){if(arguments.length===2&&!ta(e)){ba();var r=t;try{for(var i in r)bre(e,i,r[i])}finally{va()}return}ko(e)?e[jt].set_(t,n):$s(e)?e.set(t,n):ta(e)?e.add(t):gl(e)?(typeof t!="number"&&(t=parseInt(t,10)),t<0&&sn("Invalid index: '"+t+"'"),ba(),t>=e.length&&(e.length=t+1),e[t]=n,va()):sn(8)}function vre(e,t,n){if(ko(e))return e[jt].defineProperty_(t,n);sn(39)}function HM(e,t,n,r){return ns(n)?kke(e,t,n,r):Ake(e,t,n)}function Ake(e,t,n){return ul(e).observe_(t,n)}function kke(e,t,n,r){return ul(e,t).observe_(n,r)}function Ql(e,t){t===void 0&&(t=void 0),ba();try{return e.apply(t)}finally{va()}}function wz(e,t,n){return arguments.length===1||t&&typeof t=="object"?Oke(e,t):yre(e,t,{})}function yre(e,t,n){var r;if(typeof n.timeout=="number"){var i=new Error("WHEN_TIMEOUT");r=setTimeout(function(){if(!s[jt].isDisposed)if(s(),n.onError)n.onError(i);else throw i},n.timeout)}n.name="When";var a=Vc("When-effect",t),s=lre(function(o){var l=Kne(!1,e);l&&(o.dispose(),r&&clearTimeout(r),a())},n);return s}function Oke(e,t){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)return Object.assign(Promise.reject(new Error("WHEN_ABORTED")),{cancel:function(){return null}});var r,i,a=new Promise(function(s,o){var l,u=yre(e,s,Wc({},t,{onError:o}));r=function(){u(),o(new Error("WHEN_CANCELLED"))},i=function(){u(),o(new Error("WHEN_ABORTED"))},t==null||(l=t.signal)==null||l.addEventListener==null||l.addEventListener("abort",i)}).finally(function(){var s;return t==null||(s=t.signal)==null||s.removeEventListener==null?void 0:s.removeEventListener("abort",i)});return a.cancel=r,a}function Vh(e){return e[jt]}var Rke={has:function(t,n){return Vh(t).has_(n)},get:function(t,n){return Vh(t).get_(n)},set:function(t,n,r){var i;return Nf(n)?(i=Vh(t).set_(n,r,!0))!=null?i:!0:!1},deleteProperty:function(t,n){var r;return Nf(n)?(r=Vh(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var i;return(i=Vh(t).defineProperty_(n,r))!=null?i:!0},ownKeys:function(t){return Vh(t).ownKeys_()},preventExtensions:function(t){sn(13)}};function Nke(e,t){var n,r;return Ine(),e=Pm(e,t),(r=(n=e[jt]).proxy_)!=null?r:n.proxy_=new Proxy(e,Rke)}function As(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Jy(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),Dne(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function ks(e,t){var n=Gf();try{for(var r=[].concat(e.interceptors_||[]),i=0,a=r.length;i<a&&(t=r[i](t),t&&!t.type&&sn(14),!!t);i++);return t}finally{uu(n)}}function lo(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function e0(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),Dne(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function uo(e,t){var n=Gf(),r=e.changeListeners_;if(r){r=r.slice();for(var i=0,a=r.length;i<a;i++)r[i](t);uu(n)}}function _re(e,t,n){return qf(function(){var r,i=Pm(e,n)[jt];(r=t)!=null||(t=aAe(e)),aw(t).forEach(function(a){return i.make_(a,t[a])})}),e}var Tz="splice",el="update",Ike=1e4,Dke={get:function(t,n){var r=t[jt];return n===jt?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):lu(rS,n)?rS[n]:t[n]},set:function(t,n,r){var i=t[jt];return n==="length"&&i.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:i.set_(parseInt(n),r),!0},preventExtensions:function(){sn(15)}},WM=(function(){function e(n,r,i,a){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=i,this.legacyMode_=a,this.atom_=new ad(n),this.enhancer_=function(s,o){return r(s,o,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return Jy(this,r)},t.observe_=function(r,i){return i===void 0&&(i=!1),i&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),e0(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&sn("Out of range: "+r);var i=this.values_.length;if(r!==i)if(r>i){for(var a=new Array(r-i),s=0;s<r-i;s++)a[s]=void 0;this.spliceWithArray_(i,0,a)}else this.spliceWithArray_(r,i-r)},t.updateArrayLength_=function(r,i){r!==this.lastKnownLength_&&sn(16),this.lastKnownLength_+=i,this.legacyMode_&&i>0&&Cre(r+i+1)},t.spliceWithArray_=function(r,i,a){var s=this;this.atom_;var o=this.values_.length;if(r===void 0?r=0:r>o?r=o:r<0&&(r=Math.max(0,o+r)),arguments.length===1?i=o-r:i==null?i=0:i=Math.max(0,Math.min(i,o-r)),a===void 0&&(a=eD),As(this)){var l=ks(this,{object:this.proxy_,type:Tz,index:r,removedCount:i,added:a});if(!l)return eD;i=l.removedCount,a=l.added}if(a=a.length===0?a:a.map(function(d){return s.enhancer_(d,void 0)}),this.legacyMode_){var u=a.length-i;this.updateArrayLength_(o,u)}var f=this.spliceItemsIntoValues_(r,i,a);return(i!==0||a.length!==0)&&this.notifyArraySplice_(r,a,f),this.dehanceValues_(f)},t.spliceItemsIntoValues_=function(r,i,a){if(a.length<Ike){var s;return(s=this.values_).splice.apply(s,[r,i].concat(a))}else{var o=this.values_.slice(r,r+i),l=this.values_.slice(r+i);this.values_.length+=a.length-i;for(var u=0;u<a.length;u++)this.values_[r+u]=a[u];for(var f=0;f<l.length;f++)this.values_[r+a.length+f]=l[f];return o}},t.notifyArrayChildUpdate_=function(r,i,a){var s=!this.owned_&&zb(),o=lo(this),l=o||s?{observableKind:"array",object:this.proxy_,type:el,debugObjectName:this.atom_.name_,index:r,newValue:i,oldValue:a}:null;this.atom_.reportChanged(),o&&uo(this,l)},t.notifyArraySplice_=function(r,i,a){var s=!this.owned_&&zb(),o=lo(this),l=o||s?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Tz,index:r,removed:a,added:i,removedCount:a.length,addedCount:i.length}:null;this.atom_.reportChanged(),o&&uo(this,l)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,i){var a=this.values_;if(this.legacyMode_&&r>a.length&&sn(17,r,a.length),r<a.length){this.atom_;var s=a[r];if(As(this)){var o=ks(this,{type:el,object:this.proxy_,index:r,newValue:i});if(!o)return;i=o.newValue}i=this.enhancer_(i,s);var l=i!==s;l&&(a[r]=i,this.notifyArrayChildUpdate_(r,i,s))}else{for(var u=new Array(r+1-a.length),f=0;f<u.length-1;f++)u[f]=void 0;u[u.length-1]=i,this.spliceWithArray_(a.length,0,u)}},e})();function Lke(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),Ine(),qf(function(){var i=new WM(n,t,r,!1);Pne(i.values_,jt,i);var a=new Proxy(i.values_,Dke);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var rS={clear:function(){return this.splice(0)},replace:function(t){var n=this[jt];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a];var s=this[jt];switch(arguments.length){case 0:return[];case 1:return s.spliceWithArray_(t);case 2:return s.spliceWithArray_(t,n)}return s.spliceWithArray_(t,n,i)},spliceWithArray:function(t,n,r){return this[jt].spliceWithArray_(t,n,r)},push:function(){for(var t=this[jt],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[jt].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[jt],n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return ut.trackingDerivation&&sn(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){ut.trackingDerivation&&sn(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[jt],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};er("at",as);er("concat",as);er("flat",as);er("includes",as);er("indexOf",as);er("join",as);er("lastIndexOf",as);er("slice",as);er("toString",as);er("toLocaleString",as);er("toSorted",as);er("toSpliced",as);er("with",as);er("every",Ao);er("filter",Ao);er("find",Ao);er("findIndex",Ao);er("findLast",Ao);er("findLastIndex",Ao);er("flatMap",Ao);er("forEach",Ao);er("map",Ao);er("some",Ao);er("toReversed",Ao);er("reduce",Ere);er("reduceRight",Ere);function er(e,t){typeof Array.prototype[e]=="function"&&(rS[e]=t(e))}function as(e){return function(){var t=this[jt];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Ao(e){return function(t,n){var r=this,i=this[jt];i.atom_.reportObserved();var a=i.dehanceValues_(i.values_);return a[e](function(s,o){return t.call(n,s,o,r)})}}function Ere(e){return function(){var t=this,n=this[jt];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(a,s,o){return i(a,s,o,t)},r[e].apply(r,arguments)}}var Pke=id("ObservableArrayAdministration",WM);function gl(e){return rw(e)&&Pke(e[jt])}var Mke={},Tc="add",iS="delete",VM=(function(){function e(n,r,i){var a=this;r===void 0&&(r=If),i===void 0&&(i="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[jt]=Mke,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=r,this.name_=i,ns(Map)||sn(18),qf(function(){a.keysAtom_=ZE("ObservableMap.keys()"),a.data_=new Map,a.hasMap_=new Map,n&&a.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var i=this;if(!ut.trackingDerivation)return this.has_(r);var a=this.hasMap_.get(r);if(!a){var s=a=new jc(this.has_(r),sw,"ObservableMap.key?",!1);this.hasMap_.set(r,s),cre(s,function(){return i.hasMap_.delete(r)})}return a.get()},t.set=function(r,i){var a=this.has_(r);if(As(this)){var s=ks(this,{type:a?el:Tc,object:this,newValue:i,name:r});if(!s)return this;i=s.newValue}return a?this.updateValue_(r,i):this.addValue_(r,i),this},t.delete=function(r){var i=this;if(this.keysAtom_,As(this)){var a=ks(this,{type:iS,object:this,name:r});if(!a)return!1}if(this.has_(r)){var s=zb(),o=lo(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:iS,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return Ql(function(){var u;i.keysAtom_.reportChanged(),(u=i.hasMap_.get(r))==null||u.setNewValue_(!1);var f=i.data_.get(r);f.setNewValue_(void 0),i.data_.delete(r)}),o&&uo(this,l),!0}return!1},t.updateValue_=function(r,i){var a=this.data_.get(r);if(i=a.prepareNewValue_(i),i!==ut.UNCHANGED){var s=zb(),o=lo(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:el,object:this,oldValue:a.value_,name:r,newValue:i}:null;a.setNewValue_(i),o&&uo(this,l)}},t.addValue_=function(r,i){var a=this;this.keysAtom_,Ql(function(){var u,f=new jc(i,a.enhancer_,"ObservableMap.key",!1);a.data_.set(r,f),i=f.value_,(u=a.hasMap_.get(r))==null||u.setNewValue_(!0),a.keysAtom_.reportChanged()});var s=zb(),o=lo(this),l=o||s?{observableKind:"map",debugObjectName:this.name_,type:Tc,object:this,name:r,newValue:i}:null;o&&uo(this,l)},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,i=this.keys();return Cz({next:function(){var s=i.next(),o=s.done,l=s.value;return{done:o,value:o?void 0:r.get(l)}}})},t.entries=function(){var r=this,i=this.keys();return Cz({next:function(){var s=i.next(),o=s.done,l=s.value;return{done:o,value:o?void 0:[l,r.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,i){for(var a=ip(this),s;!(s=a()).done;){var o=s.value,l=o[0],u=o[1];r.call(i,u,l,this)}},t.merge=function(r){var i=this;return $s(r)&&(r=new Map(r)),Ql(function(){Hc(r)?JCe(r).forEach(function(a){return i.set(a,r[a])}):Array.isArray(r)?r.forEach(function(a){var s=a[0],o=a[1];return i.set(s,o)}):Im(r)?(QCe(r)||sn(19,r),r.forEach(function(a,s){return i.set(s,a)})):r!=null&&sn(20,r)}),this},t.clear=function(){var r=this;Ql(function(){Xne(function(){for(var i=ip(r.keys()),a;!(a=i()).done;){var s=a.value;r.delete(s)}})})},t.replace=function(r){var i=this;return Ql(function(){for(var a=jke(r),s=new Map,o=!1,l=ip(i.data_.keys()),u;!(u=l()).done;){var f=u.value;if(!a.has(f)){var d=i.delete(f);if(d)o=!0;else{var p=i.data_.get(f);s.set(f,p)}}}for(var m=ip(a.entries()),y;!(y=m()).done;){var S=y.value,g=S[0],_=S[1],v=i.data_.has(g);if(i.set(g,_),i.data_.has(g)){var x=i.data_.get(g);s.set(g,x),v||(o=!0)}}if(!o)if(i.data_.size!==s.size)i.keysAtom_.reportChanged();else for(var T=i.data_.keys(),w=s.keys(),C=T.next(),R=w.next();!C.done;){if(C.value!==R.value){i.keysAtom_.reportChanged();break}C=T.next(),R=w.next()}i.data_=s}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,i){return e0(this,r)},t.intercept_=function(r){return Jy(this,r)},Dm(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])})(),$s=id("ObservableMap",VM);function Cz(e){return e[Symbol.toStringTag]="MapIterator",qM(e)}function jke(e){if(Im(e)||$s(e))return e;if(Array.isArray(e))return new Map(e);if(Hc(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return sn(21,e)}var Fke={},Sre=(function(){function e(n,r,i){var a=this;r===void 0&&(r=If),i===void 0&&(i="ObservableSet"),this.name_=void 0,this[jt]=Fke,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,ns(Set)||sn(22),this.enhancer_=function(s,o){return r(s,o,i)},qf(function(){a.atom_=ZE(a.name_),n&&a.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;Ql(function(){Xne(function(){for(var i=ip(r.data_.values()),a;!(a=i()).done;){var s=a.value;r.delete(s)}})})},t.forEach=function(r,i){for(var a=ip(this),s;!(s=a()).done;){var o=s.value;r.call(i,o,o,this)}},t.add=function(r){var i=this;if(this.atom_,As(this)){var a=ks(this,{type:Tc,object:this,newValue:r});if(!a)return this;r=a.newValue}if(!this.has(r)){Ql(function(){i.data_.add(i.enhancer_(r,void 0)),i.atom_.reportChanged()});var s=!1,o=lo(this),l=o||s?{observableKind:"set",debugObjectName:this.name_,type:Tc,object:this,newValue:r}:null;o&&uo(this,l)}return this},t.delete=function(r){var i=this;if(As(this)){var a=ks(this,{type:iS,object:this,oldValue:r});if(!a)return!1}if(this.has(r)){var s=!1,o=lo(this),l=o||s?{observableKind:"set",debugObjectName:this.name_,type:iS,object:this,oldValue:r}:null;return Ql(function(){i.atom_.reportChanged(),i.data_.delete(r)}),o&&uo(this,l),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=this.values();return Az({next:function(){var a=r.next(),s=a.value,o=a.done;return o?{value:void 0,done:o}:{value:[s,s],done:o}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,i=this.data_.values();return Az({next:function(){var s=i.next(),o=s.value,l=s.done;return l?{value:void 0,done:l}:{value:r.dehanceValue_(o),done:l}}})},t.intersection=function(r){if(Zl(r)&&!ta(r))return r.intersection(this);var i=new Set(this);return i.intersection(r)},t.union=function(r){if(Zl(r)&&!ta(r))return r.union(this);var i=new Set(this);return i.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(Zl(r)&&!ta(r))return r.symmetricDifference(this);var i=new Set(this);return i.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(Zl(r)&&!ta(r))return r.isDisjointFrom(this);var i=new Set(this);return i.isDisjointFrom(r)},t.replace=function(r){var i=this;return ta(r)&&(r=new Set(r)),Ql(function(){Array.isArray(r)?(i.clear(),r.forEach(function(a){return i.add(a)})):Zl(r)?(i.clear(),r.forEach(function(a){return i.add(a)})):r!=null&&sn("Cannot initialize set from "+r)}),this},t.observe_=function(r,i){return e0(this,r)},t.intercept_=function(r){return Jy(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Dm(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])})(),ta=id("ObservableSet",Sre);function Az(e){return e[Symbol.toStringTag]="SetIterator",qM(e)}var kz=Object.create(null),Oz="remove",xre=(function(){function e(n,r,i,a){r===void 0&&(r=new Map),a===void 0&&(a=OAe),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=r,this.name_=i,this.defaultAnnotation_=a,this.keysAtom_=new ad("ObservableObject.keys"),this.isPlainObject_=Hc(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,i){var a=this.values_.get(r);if(a instanceof mo)return a.set(i),!0;if(As(this)){var s=ks(this,{type:el,object:this.proxy_||this.target_,name:r,newValue:i});if(!s)return null;i=s.newValue}if(i=a.prepareNewValue_(i),i!==ut.UNCHANGED){var o=lo(this),l=!1,u=o||l?{type:el,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:a.value_,name:r,newValue:i}:null;a.setNewValue_(i),o&&uo(this,u)}return!0},t.get_=function(r){return ut.trackingDerivation&&!lu(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,i,a){return a===void 0&&(a=!1),lu(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,i):a?Reflect.set(this.target_,r,i):(this.target_[r]=i,!0):this.extend_(r,{value:i,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,a)},t.has_=function(r){if(!ut.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var i=this.pendingKeys_.get(r);return i||(i=new jc(r in this.target_,sw,"ObservableObject.key?",!1),this.pendingKeys_.set(r,i)),i.get()},t.make_=function(r,i){if(i===!0&&(i=this.defaultAnnotation_),i!==!1){if(!(r in this.target_)){var a;if((a=this.target_[qo])!=null&&a[r])return;sn(1,i.annotationType_,this.name_+"."+r.toString())}for(var s=this.target_;s&&s!==nw;){var o=XE(s,r);if(o){var l=i.make_(this,r,o,s);if(l===0)return;if(l===1)break}s=Object.getPrototypeOf(s)}Nz(this,i,r)}},t.extend_=function(r,i,a,s){if(s===void 0&&(s=!1),a===!0&&(a=this.defaultAnnotation_),a===!1)return this.defineProperty_(r,i,s);var o=a.extend_(this,r,i,s);return o&&Nz(this,a,r),o},t.defineProperty_=function(r,i,a){a===void 0&&(a=!1),this.keysAtom_;try{ba();var s=this.delete_(r);if(!s)return s;if(As(this)){var o=ks(this,{object:this.proxy_||this.target_,name:r,type:Tc,newValue:i.value});if(!o)return null;var l=o.newValue;i.value!==l&&(i=Wc({},i,{value:l}))}if(a){if(!Reflect.defineProperty(this.target_,r,i))return!1}else Qo(this.target_,r,i);this.notifyPropertyAddition_(r,i.value)}finally{va()}return!0},t.defineObservableProperty_=function(r,i,a,s){s===void 0&&(s=!1),this.keysAtom_;try{ba();var o=this.delete_(r);if(!o)return o;if(As(this)){var l=ks(this,{object:this.proxy_||this.target_,name:r,type:Tc,newValue:i});if(!l)return null;i=l.newValue}var u=Rz(r),f={configurable:ut.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(s){if(!Reflect.defineProperty(this.target_,r,f))return!1}else Qo(this.target_,r,f);var d=new jc(i,a,"ObservableObject.key",!1);this.values_.set(r,d),this.notifyPropertyAddition_(r,d.value_)}finally{va()}return!0},t.defineComputedProperty_=function(r,i,a){a===void 0&&(a=!1),this.keysAtom_;try{ba();var s=this.delete_(r);if(!s)return s;if(As(this)){var o=ks(this,{object:this.proxy_||this.target_,name:r,type:Tc,newValue:void 0});if(!o)return null}i.name||(i.name="ObservableObject.key"),i.context=this.proxy_||this.target_;var l=Rz(r),u={configurable:ut.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(a){if(!Reflect.defineProperty(this.target_,r,u))return!1}else Qo(this.target_,r,u);this.values_.set(r,new mo(i)),this.notifyPropertyAddition_(r,void 0)}finally{va()}return!0},t.delete_=function(r,i){if(i===void 0&&(i=!1),this.keysAtom_,!lu(this.target_,r))return!0;if(As(this)){var a=ks(this,{object:this.proxy_||this.target_,name:r,type:Oz});if(!a)return null}try{var s;ba();var o=lo(this),l=!1,u=this.values_.get(r),f=void 0;if(!u&&(o||l)){var d;f=(d=XE(this.target_,r))==null?void 0:d.value}if(i){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(u&&(this.values_.delete(r),u instanceof jc&&(f=u.value_),nre(u)),this.keysAtom_.reportChanged(),(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(r in this.target_),o||l){var p={type:Oz,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:f,name:r};o&&uo(this,p)}}finally{va()}return!0},t.observe_=function(r,i){return e0(this,r)},t.intercept_=function(r){return Jy(this,r)},t.notifyPropertyAddition_=function(r,i){var a,s=lo(this),o=!1;if(s||o){var l=s||o?{type:Tc,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:i}:null;s&&uo(this,l)}(a=this.pendingKeys_)==null||(a=a.get(r))==null||a.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),aw(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e})();function Pm(e,t){var n;if(lu(e,jt))return e;var r=(n=t?.name)!=null?n:"ObservableObject",i=new xre(e,new Map,String(r),UAe(t));return iw(e,jt,i),e}var Bke=id("ObservableObjectAdministration",xre);function Rz(e){return kz[e]||(kz[e]={get:function(){return this[jt].getObservablePropValue_(e)},set:function(n){return this[jt].setObservablePropValue_(e,n)}})}function ko(e){return rw(e)?Bke(e[jt]):!1}function Nz(e,t,n){var r;(r=e.target_[qo])==null||delete r[n]}var Uke=Tre(0),$ke=(function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1})(),mk=0,wre=function(){};function zke(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}zke(wre,Array.prototype);var GM=(function(e){function t(r,i,a,s){var o;return a===void 0&&(a="ObservableArray"),s===void 0&&(s=!1),o=e.call(this)||this,qf(function(){var l=new WM(a,i,s,!0);l.proxy_=o,Pne(o,jt,l),r&&r.length&&o.spliceWithArray(0,0,r),$ke&&Object.defineProperty(o,"0",Uke)}),o}Fne(t,e);var n=t.prototype;return n.concat=function(){this[jt].atom_.reportObserved();for(var i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];return Array.prototype.concat.apply(this.slice(),a.map(function(o){return gl(o)?o.slice():o}))},n[Symbol.iterator]=function(){var r=this,i=0;return qM({next:function(){return i<r.length?{value:r[i++],done:!1}:{done:!0,value:void 0}}})},Dm(t,[{key:"length",get:function(){return this[jt].getArrayLength_()},set:function(i){this[jt].setArrayLength_(i)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])})(wre);Object.entries(rS).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&iw(GM.prototype,t,n)});function Tre(e){return{enumerable:!1,configurable:!0,get:function(){return this[jt].get_(e)},set:function(n){this[jt].set_(e,n)}}}function Hke(e){Qo(GM.prototype,""+e,Tre(e))}function Cre(e){if(e>mk){for(var t=mk;t<e+100;t++)Hke(t);mk=e}}Cre(1e3);function Wke(e,t,n){return new GM(e,t,n)}function Fp(e,t){if(typeof e=="object"&&e!==null){if(gl(e))return t!==void 0&&sn(23),e[jt].atom_;if(ta(e))return e.atom_;if($s(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||sn(25,t,uD(e)),n}if(ko(e)){if(!t)return sn(26);var r=e[jt].values_.get(t);return r||sn(27,t,uD(e)),r}if(FM(e)||cw(e)||tS(e))return e}else if(ns(e)&&tS(e[jt]))return e[jt];sn(28)}function ul(e,t){if(e||sn(29),t!==void 0)return ul(Fp(e,t));if(FM(e)||cw(e)||tS(e)||$s(e)||ta(e))return e;if(e[jt])return e[jt];sn(24,e)}function uD(e,t){var n;if(t!==void 0)n=Fp(e,t);else{if(Mp(e))return e.name;ko(e)||$s(e)||ta(e)?n=ul(e):n=Fp(e)}return n.name_}function qf(e){var t=Gf(),n=lw(!0);ba();try{return e()}finally{va(),uw(n),uu(t)}}var Iz=nw.toString;function Are(e,t,n){return n===void 0&&(n=-1),cD(e,t,n)}function cD(e,t,n,r,i){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var a=typeof e;if(a!=="function"&&a!=="object"&&typeof t!="object")return!1;var s=Iz.call(e);if(s!==Iz.call(t))return!1;switch(s){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=Dz(e),t=Dz(t);var o=s==="[object Array]";if(!o){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(ns(l)&&l instanceof l&&ns(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],i=i||[];for(var f=r.length;f--;)if(r[f]===e)return i[f]===t;if(r.push(e),i.push(t),o){if(f=e.length,f!==t.length)return!1;for(;f--;)if(!cD(e[f],t[f],n-1,r,i))return!1}else{var d=Object.keys(e),p=d.length;if(Object.keys(t).length!==p)return!1;for(var m=0;m<p;m++){var y=d[m];if(!(lu(t,y)&&cD(e[y],t[y],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function Dz(e){return gl(e)?e.slice():Im(e)||$s(e)||Zl(e)||ta(e)?Array.from(e.entries()):e}var Lz,Vke=((Lz=tw().Iterator)==null?void 0:Lz.prototype)||{};function qM(e){return e[Symbol.iterator]=Gke,Object.assign(Object.create(Vke),e)}function Gke(){return this}["Symbol","Map","Set"].forEach(function(e){var t=tw();typeof t[e]>"u"&&sn("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:ake,extras:{getDebugName:uD},$mobx:jt});var Pz={},qke="warn";function Kke(){return qke}var Qr;(function(e){e.afterCreate="afterCreate",e.afterAttach="afterAttach",e.afterCreationFinalization="afterCreationFinalization",e.beforeDetach="beforeDetach",e.beforeDestroy="beforeDestroy"})(Qr||(Qr={}));var dD=function(e,t){return dD=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},dD(e,t)};function tr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");dD(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var ya=function(){return ya=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},ya.apply(this,arguments)};function Yke(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Hb(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function vu(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],s;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(o){s={error:o}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return a}function yu(e,t,n){if(arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function kre(e){return On(e).type}function Xke(e,t){return On(e).onPatch(t)}function Tv(e,t){On(e).applyPatches(Ure(t))}function Mz(e,t){var n={patches:[],inversePatches:[]},r={},i,a={get recording(){return!!i},get patches(){return r.patches||(r.patches=n.patches.slice()),r.patches},get reversedInversePatches(){return r.reversedInversePatches||(r.reversedInversePatches=n.inversePatches.slice().reverse()),r.reversedInversePatches},get inversePatches(){return r.inversePatches||(r.inversePatches=n.inversePatches.slice()),r.inversePatches},stop:function(){i&&(i(),i=void 0)},resume:function(){i||(i=Xke(e,function(s,o){n.patches.push(s),n.inversePatches.push(o),r.patches=void 0,r.inversePatches=void 0,r.reversedInversePatches=void 0}))},replay:function(s){Tv(s||e,n.patches)},undo:function(s){Tv(s||e,n.inversePatches.slice().reverse())}};return a.resume(),a}function Zke(e,t){t===void 0&&(t=!0);var n=On(e);return t?n.snapshot:n.type.getSnapshot(n,!1)}function Ore(e){return On(e).root.storedValue}function Qke(e){return On(e).path}function Jke(e){return On(e).identifier}function aS(e){var t=On(e);t.isRoot?t.die():t.parent.removeChild(t.subpath)}function eOe(e){var t=On(e),n=t.root.environment;if(!n)throw new St("Failed to find the environment of ".concat(t," ").concat(t.path));return n}var Rre=(function(){function e(t,n,r,i){Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"environment",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_escapedSubpath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subpath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subpathUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pathUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storedValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"aliveAtom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_state",{enumerable:!0,configurable:!0,writable:!0,value:Si.INITIALIZING}),Object.defineProperty(this,"_hookSubscribers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_parent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pathAtom",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.environment=i,this.baseSetParent(n,r)}return Object.defineProperty(e.prototype,"subpath",{get:function(){return this._subpath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subpathUponDeath",{get:function(){return this._subpathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pathUponDeath",{get:function(){return this._pathUponDeath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.type.getValue(this)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},set:function(t){var n=this.isAlive;this._state=t;var r=this.isAlive;this.aliveAtom&&n!==r&&this.aliveAtom.reportChanged()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fireInternalHook",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this._hookSubscribers&&this._hookSubscribers.emit(t,this,t)}}),Object.defineProperty(e.prototype,"registerHook",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return this._hookSubscribers||(this._hookSubscribers=new Hre),this._hookSubscribers.register(t,n)}}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getReconciliationType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type}}),Object.defineProperty(e.prototype,"baseSetParent",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){this._parent=t,this._subpath=n,this._escapedSubpath=void 0,this.pathAtom&&this.pathAtom.reportChanged()}}),Object.defineProperty(e.prototype,"path",{get:function(){return this.getEscapedPath(!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getEscapedPath",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return t&&(this.pathAtom||(this.pathAtom=ZE("path")),this.pathAtom.reportObserved()),this.parent?(this._escapedSubpath===void 0&&(this._escapedSubpath=this._subpath?gf(this._subpath):""),this.parent.getEscapedPath(t)+"/"+this._escapedSubpath):""}}),Object.defineProperty(e.prototype,"isRoot",{get:function(){return this.parent===null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAlive",{get:function(){return this.state!==Si.DEAD},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDetaching",{get:function(){return this.state===Si.DETACHING},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"observableIsAlive",{get:function(){return this.aliveAtom||(this.aliveAtom=ZE("alive")),this.aliveAtom.reportObserved(),this.isAlive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseFinalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(this.state===Si.CREATED){if(this.parent){if(this.parent.state!==Si.FINALIZED)return;this.fireHook(Qr.afterAttach)}this.state=Si.FINALIZED,t&&t()}}}),Object.defineProperty(e.prototype,"baseFinalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._hookSubscribers&&this._hookSubscribers.clearAll(),this._subpathUponDeath=this._subpath,this._pathUponDeath=this.getEscapedPath(!1),this.baseSetParent(null,""),this.state=Si.DEAD}}),Object.defineProperty(e.prototype,"baseAboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.fireHook(Qr.beforeDestroy)}}),e})(),Cv=(function(e){tr(t,e);function t(n,r,i,a,s){var o=e.call(this,n,r,i,a)||this;try{o.storedValue=n.createNewInstance(s)}catch(l){throw o.state=Si.DEAD,l}return o.state=Si.CREATED,o.finalizeCreation(),o}return Object.defineProperty(t.prototype,"root",{get:function(){if(!this.parent)throw new St("This scalar node is not part of a tree");return this.parent.root},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this.parent!==n,a=this.subpath!==r;!i&&!a||(this.environment=void 0,this.baseSetParent(this.parent,r))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this.getSnapshot()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=(this.isAlive?this.path:this.pathUponDeath)||"<root>";return"".concat(this.type.name,"@").concat(n).concat(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===Si.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeCreation()}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseAboutToDie()}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this.fireInternalHook(n)}}),t})(Rre);Cv.prototype.die=Jr(Cv.prototype.die);var tOe=1,Qs;(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.CREATING=1]="CREATING",e[e.CREATED=2]="CREATED"})(Qs||(Qs={}));var Ha;(function(e){e.Dispose="dispose",e.Patch="patch",e.Snapshot="snapshot"})(Ha||(Ha={}));var nOe={onError:function(e){throw e}},Ta=(function(e){tr(t,e);function t(n,r,i,a,s){var o=e.call(this,n,r,i,a)||this;if(Object.defineProperty(o,"nodeId",{enumerable:!0,configurable:!0,writable:!0,value:++tOe}),Object.defineProperty(o,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"unnormalizedIdentifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"identifierCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"isProtectionEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"hasSnapshotPostProcessor",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_applyPatches",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_applySnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_autoUnbox",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(o,"_isRunningAction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_hasSnapshotReaction",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_observableInstanceState",{enumerable:!0,configurable:!0,writable:!0,value:Qs.UNINITIALIZED}),Object.defineProperty(o,"_childNodes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_initialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_cachedInitialSnapshotCreated",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(o,"_snapshotComputed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_snapshotUponDeath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(o,"_internalEvents",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),o._snapshotComputed=Lm(function(){return o.getSnapshot()}),o.unbox=o.unbox.bind(o),o._initialSnapshot=s,o.identifierAttribute=n.identifierAttribute,r||(o.identifierCache=new hOe),o._childNodes=n.initializeChildNodes(o,o._initialSnapshot),o.identifier=null,o.unnormalizedIdentifier=null,o.identifierAttribute&&o._initialSnapshot){var l=o._initialSnapshot[o.identifierAttribute];if(l===void 0){var u=o._childNodes[o.identifierAttribute];u&&(l=u.value)}if(typeof l!="string"&&typeof l!="number")throw new St("Instance identifier '".concat(o.identifierAttribute,"' for type '").concat(o.type.name,"' must be a string or a number"));o.identifier=t0(l),o.unnormalizedIdentifier=l}return r?r.root.identifierCache.addNodeToCache(o):o.identifierCache.addNodeToCache(o),o}return Object.defineProperty(t.prototype,"applyPatches",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this.createObservableInstanceIfNeeded(),this._applyPatches(n)}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this.createObservableInstanceIfNeeded(),this._applySnapshot(n)}}),Object.defineProperty(t.prototype,"createObservableInstanceIfNeeded",{enumerable:!1,configurable:!0,writable:!0,value:function(n){n===void 0&&(n=!0),this._observableInstanceState===Qs.UNINITIALIZED&&this.createObservableInstance(n)}}),Object.defineProperty(t.prototype,"createObservableInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r,i,a,s;n===void 0&&(n=!0),this._observableInstanceState=Qs.CREATING;for(var o=[],l=this.parent;l&&l._observableInstanceState===Qs.UNINITIALIZED;)o.unshift(l),l=l.parent;try{for(var u=Hb(o),f=u.next();!f.done;f=u.next()){var d=f.value;d.createObservableInstanceIfNeeded(!1)}}catch(S){r={error:S}}finally{try{f&&!f.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}var p=this.type;try{this.storedValue=p.createNewInstance(this._childNodes),this.preboot(),this._isRunningAction=!0,p.finalizeNewInstance(this,this.storedValue)}catch(S){throw this.state=Si.DEAD,S}finally{this._isRunningAction=!1}if(this._observableInstanceState=Qs.CREATED,this._snapshotComputed.trackAndCompute(),this.isRoot&&this._addSnapshotReaction(),this._childNodes=$p,this.state=Si.CREATED,n){this.fireHook(Qr.afterCreate),this.finalizeCreation();try{for(var m=Hb(o.reverse()),y=m.next();!y.done;y=m.next()){var d=y.value;d.fireHook(Qr.afterCreate),d.finalizeCreation()}}catch(S){a={error:S}}finally{try{y&&!y.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}}}}),Object.defineProperty(t.prototype,"root",{get:function(){var n=this.parent;return n?n.root:this},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clearParent",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.parent){this.fireHook(Qr.beforeDetach);var n=this.state;this.state=Si.DETACHING;var r=this.root,i=r.environment,a=r.identifierCache.splitCache(this);try{this.parent.removeChild(this.subpath),this.baseSetParent(null,""),this.environment=i,this.identifierCache=a}finally{this.state=n}}}}),Object.defineProperty(t.prototype,"setParent",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=n!==this.parent,a=r!==this.subpath;!i&&!a||(i?(this.environment=void 0,n.root.identifierCache.mergeCache(this),this.baseSetParent(n,r),this.fireHook(Qr.afterAttach)):a&&this.baseSetParent(this.parent,r))}}),Object.defineProperty(t.prototype,"fireHook",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;this.fireInternalHook(n);var i=this.storedValue&&typeof this.storedValue=="object"&&this.storedValue[n];typeof i=="function"&&(Sz?Sz(function(){i.apply(r.storedValue)}):i.apply(this.storedValue))}}),Object.defineProperty(t.prototype,"snapshot",{get:function(){return this.hasSnapshotPostProcessor&&this.createObservableInstanceIfNeeded(),this._snapshotComputed.get()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isAlive?this._observableInstanceState===Qs.CREATED?this._getActualSnapshot():this._getCachedInitialSnapshot():this._snapshotUponDeath}}),Object.defineProperty(t.prototype,"_getActualSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.type.getSnapshot(this)}}),Object.defineProperty(t.prototype,"_getCachedInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this._cachedInitialSnapshotCreated){var n=this.type,r=this._childNodes,i=this._initialSnapshot;this._cachedInitialSnapshot=n.processInitialSnapshot(r,i),this._cachedInitialSnapshotCreated=!0}return this._cachedInitialSnapshot}}),Object.defineProperty(t.prototype,"isRunningAction",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isRunningAction?!0:this.isRoot?!1:this.parent.isRunningAction()}}),Object.defineProperty(t.prototype,"assertAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=Kke();if(!this.isAlive&&r!=="ignore"){var i=this._getAssertAliveError(n);switch(r){case"error":throw new St(i);case"warn":TOe(i)}}}}),Object.defineProperty(t.prototype,"_getAssertAliveError",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.getEscapedPath(!1)||this.pathUponDeath||"",i=n.subpath&&gf(n.subpath)||"",a=n.actionContext||Dre();a&&a.type!=="action"&&a.parentActionEvent&&(a=a.parentActionEvent);var s="";if(a&&a.name!=null){var o=a&&a.context&&Qke(a.context)||r;s="".concat(o,".").concat(a.name,"()")}return"You are trying to read or write to an object that is no longer part of a state tree. (Object type: '".concat(this.type.name,"', Path upon death: '").concat(r,"', Subpath: '").concat(i,"', Action: '").concat(s,"'). Either detach nodes first, or don't use objects after removing / replacing them in the tree.")}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this.assertAlive({subpath:n}),this._autoUnbox=!1;try{return this._observableInstanceState===Qs.CREATED?this.type.getChildNode(this,n):this._childNodes[n]}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.assertAlive($p),this._autoUnbox=!1;try{return this._observableInstanceState===Qs.CREATED?this.type.getChildren(this):Fre(this._childNodes)}finally{this._autoUnbox=!0}}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.type.getChildType(n)}}),Object.defineProperty(t.prototype,"isProtected",{get:function(){return this.root.isProtectionEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"assertWritable",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(this.assertAlive(n),!this.isRunningAction()&&this.isProtected)throw new St("Cannot modify '".concat(this,"', the object is protected and can only be modified by using an action."))}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this.type.removeChild(this,n)}}),Object.defineProperty(t.prototype,"unbox",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n&&(this.assertAlive({subpath:n.subpath||n.subpathUponDeath}),this._autoUnbox?n.value:n)}}),Object.defineProperty(t.prototype,"toString",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=(this.isAlive?this.path:this.pathUponDeath)||"<root>",r=this.identifier?"(id: ".concat(this.identifier,")"):"";return"".concat(this.type.name,"@").concat(n).concat(r).concat(this.isAlive?"":" [dead]")}}),Object.defineProperty(t.prototype,"finalizeCreation",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this;this.baseFinalizeCreation(function(){var r,i;try{for(var a=Hb(n.getChildren()),s=a.next();!s.done;s=a.next()){var o=s.value;o.finalizeCreation()}}catch(l){r={error:l}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}n.fireInternalHook(Qr.afterCreationFinalization)})}}),Object.defineProperty(t.prototype,"detach",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(!this.isAlive)throw new St("Error while detaching, node is not alive.");this.clearParent()}}),Object.defineProperty(t.prototype,"preboot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this;this._applyPatches=Av(this.storedValue,"@APPLY_PATCHES",function(r){r.forEach(function(i){if(!i.path){n.type.applySnapshot(n,i.value);return}var a=DOe(i.path),s=gOe(n,a.slice(0,-1));s.applyPatchLocally(a[a.length-1],i)})}),this._applySnapshot=Av(this.storedValue,"@APPLY_SNAPSHOT",function(r){if(r!==n.snapshot)return n.type.applySnapshot(n,r)}),mf(this.storedValue,"$treenode",this),mf(this.storedValue,"toJSON",mOe)}}),Object.defineProperty(t.prototype,"die",{enumerable:!1,configurable:!0,writable:!0,value:function(){!this.isAlive||this.state===Si.DETACHING||(this.aboutToDie(),this.finalizeDeath())}}),Object.defineProperty(t.prototype,"aboutToDie",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._observableInstanceState!==Qs.UNINITIALIZED&&(this.getChildren().forEach(function(n){n.aboutToDie()}),this.baseAboutToDie(),this._internalEventsEmit(Ha.Dispose),this._internalEventsClear(Ha.Dispose))}}),Object.defineProperty(t.prototype,"finalizeDeath",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.getChildren().forEach(function(r){r.finalizeDeath()}),this.root.identifierCache.notifyDied(this);var n=this.snapshot;this._snapshotUponDeath=n,this._internalEventsClearAll(),this.baseFinalizeDeath()}}),Object.defineProperty(t.prototype,"onSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._addSnapshotReaction(),this._internalEventsRegister(Ha.Snapshot,n)}}),Object.defineProperty(t.prototype,"emitSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this._internalEventsEmit(Ha.Snapshot,n)}}),Object.defineProperty(t.prototype,"onPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._internalEventsRegister(Ha.Patch,n)}}),Object.defineProperty(t.prototype,"emitPatch",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this._internalEventsHasSubscribers(Ha.Patch)){var i=r.path.substr(this.path.length)+(n.path?"/"+n.path:""),a=SOe({},n,{path:i}),s=vu(kOe(a),2),o=s[0],l=s[1];this._internalEventsEmit(Ha.Patch,o,l)}this.parent&&this.parent.emitPatch(n,r)}}),Object.defineProperty(t.prototype,"hasDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._internalEventsHas(Ha.Dispose,n)}}),Object.defineProperty(t.prototype,"addDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!this.hasDisposer(n)){this._internalEventsRegister(Ha.Dispose,n,!0);return}throw new St("cannot add a disposer when it is already registered for execution")}}),Object.defineProperty(t.prototype,"removeDisposer",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!this._internalEventsHas(Ha.Dispose,n))throw new St("cannot remove a disposer which was never registered for execution");this._internalEventsUnregister(Ha.Dispose,n)}}),Object.defineProperty(t.prototype,"removeMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(this.middlewares){var r=this.middlewares.indexOf(n);r>=0&&this.middlewares.splice(r,1)}}}),Object.defineProperty(t.prototype,"addMiddleWare",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;r===void 0&&(r=!0);var a={handler:n,includeHooks:r};return this.middlewares?this.middlewares.push(a):this.middlewares=[a],function(){i.removeMiddleware(a)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){this.assertWritable({subpath:n}),this.createObservableInstanceIfNeeded(),this.type.applyPatchLocally(this,n,r)}}),Object.defineProperty(t.prototype,"_addSnapshotReaction",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this;if(!this._hasSnapshotReaction){var r=$M(function(){return n.snapshot},function(i){return n.emitSnapshot(i)},nOe);this.addDisposer(r),this._hasSnapshotReaction=!0}}}),Object.defineProperty(t.prototype,"_internalEventsHasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return!!this._internalEvents&&this._internalEvents.hasSubscribers(n)}}),Object.defineProperty(t.prototype,"_internalEventsRegister",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){return i===void 0&&(i=!1),this._internalEvents||(this._internalEvents=new Hre),this._internalEvents.register(n,r,i)}}),Object.defineProperty(t.prototype,"_internalEventsHas",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return!!this._internalEvents&&this._internalEvents.has(n,r)}}),Object.defineProperty(t.prototype,"_internalEventsUnregister",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){this._internalEvents&&this._internalEvents.unregister(n,r)}}),Object.defineProperty(t.prototype,"_internalEventsEmit",{enumerable:!1,configurable:!0,writable:!0,value:function(n){for(var r,i=[],a=1;a<arguments.length;a++)i[a-1]=arguments[a];this._internalEvents&&(r=this._internalEvents).emit.apply(r,yu([n],vu(i),!1))}}),Object.defineProperty(t.prototype,"_internalEventsClear",{enumerable:!1,configurable:!0,writable:!0,value:function(n){this._internalEvents&&this._internalEvents.clear(n)}}),Object.defineProperty(t.prototype,"_internalEventsClearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._internalEvents&&this._internalEvents.clearAll()}}),t})(Rre);Ta.prototype.createObservableInstance=Jr(Ta.prototype.createObservableInstance);Ta.prototype.detach=Jr(Ta.prototype.detach);Ta.prototype.die=Jr(Ta.prototype.die);var Nre,_n;(function(e){e[e.String=1]="String",e[e.Number=2]="Number",e[e.Boolean=4]="Boolean",e[e.Date=8]="Date",e[e.Literal=16]="Literal",e[e.Array=32]="Array",e[e.Map=64]="Map",e[e.Object=128]="Object",e[e.Frozen=256]="Frozen",e[e.Optional=512]="Optional",e[e.Reference=1024]="Reference",e[e.Identifier=2048]="Identifier",e[e.Late=4096]="Late",e[e.Refinement=8192]="Refinement",e[e.Union=16384]="Union",e[e.Null=32768]="Null",e[e.Undefined=65536]="Undefined",e[e.Integer=131072]="Integer",e[e.Custom=262144]="Custom",e[e.SnapshotProcessor=524288]="SnapshotProcessor",e[e.Lazy=1048576]="Lazy",e[e.Finite=2097152]="Finite",e[e.Float=4194304]="Float"})(_n||(_n={}));var Ire="cannotDetermine",rOe=Symbol("$type"),_u=(function(){function e(t){Object.defineProperty(this,Nre,{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"C",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"S",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"T",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"N",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isType",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=t}return Object.defineProperty(e.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){return cu(this,t),this.instantiate(null,"",n,t).value}}),Object.defineProperty(e.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){throw new St("unimplemented method")}}),Object.defineProperty(e.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return t===this}}),Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=jre(t);if(r){var i=kre(t);return this.isAssignableFrom(i)?Ca():Oa(n,t)}return this.isValidSnapshot(t,n)}}),Object.defineProperty(e.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return this.validate(t,[{path:"",type:this}]).length===0}}),Object.defineProperty(e.prototype,"Type",{get:function(){throw new St("Factory.Type should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.Type`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"TypeWithoutSTN",{get:function(){throw new St("Factory.TypeWithoutSTN should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.TypeWithoutSTN`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"SnapshotType",{get:function(){throw new St("Factory.SnapshotType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.SnapshotType`")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"CreationType",{get:function(){throw new St("Factory.CreationType should not be actually called. It is just a Type signature that can be used at compile time with Typescript, by using `typeof type.CreationType`")},enumerable:!1,configurable:!0}),e})();Nre=rOe;_u.prototype.create=Jr(_u.prototype.create);var Bp=(function(e){tr(t,e);function t(n){var r=e.call(this,n)||this;return Object.defineProperty(r,"identifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),r}return Object.defineProperty(t.prototype,"create",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return n===void 0&&(n=this.getDefaultSnapshot()),e.prototype.create.call(this,n,r)}}),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.createObservableInstanceIfNeeded(),n.storedValue}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return!n.identifierAttribute||n.identifier===t0(r[n.identifierAttribute])}}),Object.defineProperty(t.prototype,"tryToReconcileNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return n.isDetaching?!1:n.snapshot===r||Sr(r)&&On(r)===n?!0:n.type===this&&$re(r)&&!Sr(r)&&this.isMatchingSnapshotId(n,r)?(n.applySnapshot(r),!0):!1}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.tryToReconcileNode(n,r);if(s)return n.setParent(i,a),n;if(n.die(),Sr(r)&&this.isAssignableFrom(kre(r))){var o=On(r);return o.setParent(i,a),o}return this.instantiate(i,a,void 0,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return null}}),t})(_u);Bp.prototype.create=Jr(Bp.prototype.create);var Kf=(function(e){tr(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n}}),Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(!n.isDetaching&&n.type===this&&n.storedValue===r)return n;var s=this.instantiate(i,a,void 0,r);return n.die(),s}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return null}}),t})(_u);function Eu(e){return typeof e=="object"&&e&&e.isType===!0}var iOe=1,Wb;function Dre(){return Wb}function Lre(){return iOe++}function fD(e,t){var n=On(e.context);e.type==="action"&&n.assertAlive({actionContext:e});var r=n._isRunningAction;n._isRunningAction=!0;var i=Wb;Wb=e;try{return sOe(n,e,t)}finally{Wb=i,n._isRunningAction=r}}function Pre(e){if(e)return e.type==="action"?e:e.parentActionEvent}function Av(e,t,n){var r=function(){var i=Lre(),a=Wb,s=Pre(a);return fD({type:"action",name:t,id:i,args:Wre(arguments),context:e,tree:Ore(e),rootId:a?a.rootId:i,parentId:a?a.id:0,allParentIds:a?yu(yu([],vu(a.allParentIds),!1),[a.id],!1):[],parentEvent:a,parentActionEvent:s},n)};return r._isMSTAction=!0,r._isFlowAction=n._isFlowAction,r}var aOe=(function(){function e(t,n){Object.defineProperty(this,"arrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"inArrayIndex",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"middlewares",{enumerable:!0,configurable:!0,writable:!0,value:[]}),n.$mst_middleware&&this.middlewares.push(n.$mst_middleware);for(var r=t;r;)r.middlewares&&this.middlewares.push(r.middlewares),r=r.parent}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.middlewares.length<=0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getNextMiddleware",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t=this.middlewares[this.arrayIndex];if(t){var n=t[this.inArrayIndex++];return n||(this.arrayIndex++,this.inArrayIndex=0,this.getNextMiddleware())}}}),e})();function sOe(e,t,n){var r=new aOe(e,n);if(r.isEmpty)return Jr(n).apply(null,t.args);var i=null;function a(s){var o=r.getNextMiddleware(),l=o&&o.handler;if(!l)return Jr(n).apply(null,s.args);if(!o.includeHooks&&Qr[s.name])return a(s);function u(d,p){i=a(d),p&&(i=p(i))}function f(d){i=d}return l(s,u,f),i}return a(t)}function oOe(e){try{return JSON.stringify(e)}catch(t){return"<Unserializable: ".concat(t,">")}}function Mre(e){return typeof e=="function"?"<function".concat(e.name?" "+e.name:"",">"):Sr(e)?"<".concat(e,">"):"`".concat(oOe(e),"`")}function lOe(e){return e.length<280?e:"".concat(e.substring(0,272),"......").concat(e.substring(e.length-8))}function uOe(e){var t=e.value,n=e.context[e.context.length-1].type,r=e.context.map(function(o){var l=o.path;return l}).filter(function(o){return o.length>0}).join("/"),i=r.length>0?'at path "/'.concat(r,'" '):"",a=Sr(t)?"value of type ".concat(On(t).type.name,":"):kv(t)?"value":"snapshot",s=n&&Sr(t)&&n.is(On(t).snapshot);return"".concat(i).concat(a," ").concat(Mre(t)," is not assignable ").concat(n?"to type: `".concat(n.name,"`"):"")+(e.message?" (".concat(e.message,")"):"")+(n?YOe(n)||kv(t)?".":", expected an instance of `".concat(n.name,"` or a snapshot like `").concat(n.describe(),"` instead.")+(s?" (Note that a snapshot of the provided value is compatible with the targeted type)":""):".")}function KM(e,t,n){return e.concat([{path:t,type:n}])}function Ca(){return Up}function Oa(e,t,n){return[{context:e,value:t,message:n}]}function dw(e){return e.reduce(function(t,n){return t.concat(n)},[])}function cu(e,t){COe()&&cOe(e,t)}function cOe(e,t){var n=e.validate(t,[{path:"",type:e}]);if(n.length>0)throw new St(dOe(e,t,n))}function dOe(e,t,n){if(n.length!==0)return"Error while converting ".concat(lOe(Mre(t))," to `").concat(e.name,`\`:
28
28
 
29
29
  `)+n.map(uOe).join(`
30
- `)}var fOe=0,hOe=(function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:fOe++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:fr.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:fr.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.lastCacheModificationPerId.get(t);this.lastCacheModificationPerId.set(t,n===void 0?1:n+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.lastCacheModificationPerId.get(t)||0;return"".concat(this.cacheId,"-").concat(n)}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){if(n===void 0&&(n=!0),t.identifierAttribute){var r=t.identifier;this.cache.has(r)||this.cache.set(r,fr.array([],fw));var i=this.cache.get(r);if(i.indexOf(t)!==-1)throw new St("Already registered");i.push(t),n&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this;gre(t.identifierCache.cache).forEach(function(r){return r.forEach(function(i){n.addNodeToCache(i)})})}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(t.identifierAttribute){var n=t.identifier,r=this.cache.get(n);r&&(r.remove(t),r.length||this.cache.delete(n),this.updateLastCacheModificationPerId(t.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this,r=new e,i=t.path+"/";return Cke(this.cache).forEach(function(a){for(var s=vu(a,2),o=s[0],l=s[1],u=!1,f=l.length-1;f>=0;f--){var d=l[f];(d===t||d.path.indexOf(i)===0)&&(r.addNodeToCache(d,!1),l.splice(f,1),l.length||n.cache.delete(o),u=!0)}u&&n.updateLastCacheModificationPerId(o)}),r}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.cache.get(n);return r?r.some(function(i){return t.isAssignableFrom(i.type)}):!1}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.cache.get(n);if(!r)return null;var i=r.filter(function(a){return t.isAssignableFrom(a.type)});switch(i.length){case 0:return null;case 1:return i[0];default:throw new St("Cannot resolve a reference to type '".concat(t.name,"' with id: '").concat(n,"' unambigously, there are multiple candidates: ").concat(i.map(function(a){return a.path}).join(", ")))}}}),e})();function YM(e,t,n,r,i){var a=jre(i);if(a){if(a.parent)throw new St("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(t?t.path:"","/").concat(n,"', but it lives already at '").concat(a.path,"'"));return t&&a.setParent(t,n),a}return new Ta(e,t,n,r,i)}function sd(e,t,n,r,i){return new Cv(e,t,n,r,i)}function pOe(e){return e instanceof Cv||e instanceof Ta}var Si;(function(e){e[e.INITIALIZING=0]="INITIALIZING",e[e.CREATED=1]="CREATED",e[e.FINALIZED=2]="FINALIZED",e[e.DETACHING=3]="DETACHING",e[e.DEAD=4]="DEAD"})(Si||(Si={}));function Sr(e){return!!(e&&e.$treenode)}function On(e){if(!Sr(e))throw new St("Value ".concat(e," is no MST Node"));return e.$treenode}function jre(e){return e&&e.$treenode||null}function mOe(){return On(this).snapshot}function gOe(e,t,n){n===void 0&&(n=!0);var r=e;try{for(var i=0;i<t.length;i++){var a=t[i];if(a===".."){if(r=r.parent,r)continue}else{if(a===".")continue;if(r){if(r instanceof Cv){var s=r.value;Sr(s)&&(r=On(s))}if(r instanceof Ta){var o=r.getChildType(a);if(o&&(r=r.getChildNode(a),r))continue}}}throw new St("Could not resolve '".concat(a,"' in path '").concat(jz(t.slice(0,i))||"/","' while resolving '").concat(jz(t),"'"))}}catch(l){if(!n)return;throw l}return r}function Fre(e){if(!e)return Up;var t=Object.keys(e);if(!t.length)return Up;var n=new Array(t.length);return t.forEach(function(r,i){n[i]=e[r]}),n}var bOe=Object.toString(),Up=Object.freeze([]),$p=Object.freeze({}),fw=QAe().useProxies?{deep:!1}:{deep:!1,proxy:!1};Object.freeze(fw);var St=(function(e){tr(t,e);function t(n){return n===void 0&&(n="Illegal state"),e.call(this,"[mobx-state-tree] ".concat(n))||this}return t})(Error);function vOe(e){return e}var yOe=Number.isInteger;function _Oe(e){return Number(e)===e&&e%1!==0}function EOe(e){return Number.isFinite(e)}function Bre(e){return Array.isArray(e)||gl(e)}function Ure(e){return e?Bre(e)?e:[e]:Up}function SOe(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++){var i=t[r];for(var a in i)e[a]=i[a]}return e}function ap(e){var t;if(e===null||typeof e!="object")return!1;var n=Object.getPrototypeOf(e);return n==null?!0:((t=n.constructor)===null||t===void 0?void 0:t.toString())===bOe}function $re(e){return e!==null&&typeof e=="object"&&!(e instanceof Date)&&!(e instanceof RegExp)}function kv(e,t){return t===void 0&&(t=!0),e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||t&&e instanceof Date}function zre(e){return typeof e!="function"}function xOe(e,t,n){ko(e)?vre(e,t,n):Object.defineProperty(e,t,n)}function mf(e,t,n){xOe(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}var wOe=(function(){function e(){Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}return Object.defineProperty(e.prototype,"hasSubscribers",{get:function(){return this.handlers.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this;return n===void 0&&(n=!1),n?this.handlers.unshift(t):this.handlers.push(t),function(){r.unregister(t)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return this.handlers.indexOf(t)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.handlers.indexOf(t);n>=0&&this.handlers.splice(n,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=this.handlers.slice();r.forEach(function(i){return i.apply(void 0,yu([],vu(t),!1))})}}),e})(),Hre=(function(){function e(){Object.defineProperty(this,"eventHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"hasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.eventHandlers&&this.eventHandlers[t];return!!n&&n.hasSubscribers}}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){r===void 0&&(r=!1),this.eventHandlers||(this.eventHandlers={});var i=this.eventHandlers[t];return i||(i=this.eventHandlers[t]=new wOe),i.register(n,r)}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.eventHandlers&&this.eventHandlers[t];return!!r&&r.has(n)}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.eventHandlers&&this.eventHandlers[t];r&&r.unregister(n)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.eventHandlers&&delete this.eventHandlers[t]}}),Object.defineProperty(e.prototype,"clearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.eventHandlers=void 0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(t){for(var n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var a=this.eventHandlers&&this.eventHandlers[t];a&&(n=a).emit.apply(n,yu([],vu(r),!1))}}),e})();function Wre(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}function gk(e,t){return e.indexOf(t)===0}function TOe(e){console.warn(new Error("[mobx-state-tree] ".concat(e)))}function COe(){return typeof process<"u"&&Pz&&Pz.ENABLE_TYPE_CHECK==="true"}function bk(e){typeof queueMicrotask=="function"?queueMicrotask(e):typeof setImmediate=="function"?setImmediate(e):setTimeout(e,1)}function vk(e){return AOe(e.name,e)}function AOe(e,t){var n=function(){var i=Lre(),a=Dre();if(!a)throw new St("a mst flow must always have a parent context");var s=Pre(a);if(!s)throw new St("a mst flow must always have a parent action context");var o={name:e,id:i,tree:a.tree,context:a.context,parentId:a.id,allParentIds:yu(yu([],vu(a.allParentIds),!1),[a.id],!1),rootId:a.rootId,parentEvent:a,parentActionEvent:s},l=arguments;function u(f,d,p){return f.$mst_middleware=n.$mst_middleware,fD(ya(ya({},o),{type:d,args:[p]}),f)}return new Promise(function(f,d){var p,m=function(){p=t.apply(null,arguments),y(void 0)};m.$mst_middleware=n.$mst_middleware,fD(ya(ya({},o),{type:"flow_spawn",args:Wre(l)}),m);function y(_){var v;try{var x=u(function(T){v=p.next(T)},"flow_resume",_);x instanceof Error&&(v=p.throw(x))}catch(T){bk(function(){u(function(w){d(T)},"flow_throw",T)});return}g(v)}function S(_){var v;try{u(function(x){v=p.throw(x)},"flow_resume_error",_)}catch(x){bk(function(){u(function(T){d(x)},"flow_throw",x)});return}g(v)}function g(_){if(_.done){bk(function(){u(function(v){f(v)},"flow_return",_.value)});return}if(!_.value||typeof _.value.then!="function")throw new St("Only promises can be yielded to `async`, got: "+_);return _.value.then(y,S)}})};return n._isFlowAction=!0,n}function kOe(e){if(!("oldValue"in e))throw new St("Patches without `oldValue` field cannot be inversed");return[OOe(e),ROe(e)]}function OOe(e){switch(e.op){case"add":return{op:"add",path:e.path,value:e.value};case"remove":return{op:"remove",path:e.path};case"replace":return{op:"replace",path:e.path,value:e.value}}}function ROe(e){switch(e.op){case"add":return{op:"remove",path:e.path};case"remove":return{op:"add",path:e.path,value:e.oldValue};case"replace":return{op:"replace",path:e.path,value:e.oldValue}}}function NOe(e){return typeof e=="number"}function gf(e){return NOe(e)===!0?""+e:e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function IOe(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function jz(e){if(e.length===0)return"";var t=function(n){return n.map(gf).join("/")};return e[0]==="."||e[0]===".."?t(e):"/"+t(e)}function DOe(e){var t=e.split("/").map(IOe),n=e===""||e==="."||e===".."||gk(e,"/")||gk(e,"./")||gk(e,"../");if(!n)throw new St("a json path must be either rooted, empty or relative, but got '".concat(e,"'"));return t[0]===""&&t.shift(),t}var yk=Symbol("$preProcessorFailed"),LOe=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,i||n.name)||this;return Object.defineProperty(a,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_processors",{enumerable:!0,configurable:!0,writable:!0,value:r}),a}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.SnapshotProcessor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"snapshotProcessor(".concat(this._subtype.describe(),")")}}),Object.defineProperty(t.prototype,"preProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._processors.preProcessor?this._processors.preProcessor.call(null,n):n}}),Object.defineProperty(t.prototype,"preProcessSnapshotSafe",{enumerable:!1,configurable:!0,writable:!0,value:function(n){try{return this.preProcessSnapshot(n)}catch{return yk}}}),Object.defineProperty(t.prototype,"postProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this._processors.postProcessor?this._processors.postProcessor.call(null,n,r.storedValue):n}}),Object.defineProperty(t.prototype,"_fixNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;POe(n.type,this,"create"),n instanceof Ta&&(n.hasSnapshotPostProcessor=!!this._processors.postProcessor);var i=n.getSnapshot;n.getSnapshot=function(){return r.postProcessSnapshot(i.call(n),n)},t2e(this._subtype)||(n.getReconciliationType=function(){return r})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?a:this.preProcessSnapshot(a),o=this._subtype.instantiate(n,r,i,s);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this._subtype.reconcile(n,Sr(r)?r:this.preProcessSnapshot(r),i,a);return s!==n&&this._fixNode(s),s}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r=!0);var i=this._subtype.getSnapshot(n);return r?this.postProcessSnapshot(i,n):i}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this.preProcessSnapshotSafe(n);return i===yk?Oa(r,n,"Failed to preprocess value"):this._subtype.validate(i,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=Eu(n)?this._subtype:Sr(n)?n:this.preProcessSnapshotSafe(n);return r===yk?!1:this._subtype.validate(r,[{path:"",type:this._subtype}]).length===0}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(!(this._subtype instanceof Bp))return!1;var i=this.preProcessSnapshot(r);return this._subtype.isMatchingSnapshotId(n,i)}}),t})(_u);function POe(e,t){for(var n,r,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];try{for(var s=Hb(i),o=s.next();!o.done;o=s.next()){var l=o.value;e[l]=t[l].bind(t)}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}function MOe(e,t,n){return new LOe(e,t,n)}var Fz="Map.put can only be used to store complex values that have an identifier type attribute";function Vre(e,t){var n,r,i=e.getSubTypes();if(i===Ire)return!1;if(i){var a=Ure(i);try{for(var s=Hb(a),o=s.next();!o.done;o=s.next()){var l=o.value;if(!Vre(l,t))return!1}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}return e instanceof Ov&&t.push(e),!0}var yc;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"})(yc||(yc={}));var jOe=(function(e){tr(t,e);function t(n,r){return e.call(this,n,fr.ref.enhancer,r)||this}return Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.get.call(this,""+n)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.has.call(this,""+n)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.delete.call(this,""+n)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return e.prototype.set.call(this,""+n,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!n)throw new St("Map.put cannot be used to set empty values");if(Sr(n)){var r=On(n);if(r.identifier===null)throw new St(Fz);return this.set(r.identifier,n),n}else if($re(n)){var i=On(this),a=i.type;if(a.identifierMode!==yc.YES)throw new St(Fz);var s=a.mapIdentifierAttribute,o=n[s];if(!XM(o)){var l=this.put(a.getChildType().create(n,i.environment));return this.put(Zke(l))}var u=t0(o);return this.set(u,n),this.get(u)}else throw new St("Map.put can only be used to store complex values")}}),t})(VM),sS=(function(e){tr(t,e);function t(n,r,i){i===void 0&&(i=[]);var a=e.call(this,n)||this;return Object.defineProperty(a,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:yc.UNKNOWN}),Object.defineProperty(a,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Map}),Object.defineProperty(a,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a._determineIdentifierMode(),a.hookInitializers=i,a}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.hookInitializers.length>0?this.hookInitializers.concat(n):[n];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._determineIdentifierMode(),YM(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===yc.UNKNOWN){var n=[];if(Vre(this._subType,n)){var r=n.reduce(function(i,a){if(!a.identifierAttribute)return i;if(i&&i!==a.identifierAttribute)throw new St("The objects in a map should all have the same identifier attribute, expected '".concat(i,"', but child of type '").concat(a.name,"' declared attribute '").concat(a.identifierAttribute,"' as identifier"));return a.identifierAttribute},void 0);r?(this.identifierMode=yc.YES,this.mapIdentifierAttribute=r):this.identifierMode=yc.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r={});var i=n.type._subType,a={};return Object.keys(r).forEach(function(s){a[s]=i.instantiate(n,s,void 0,r[s])}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return new jOe(n,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){pre(r,n.unbox);var i=n.type;i.hookInitializers.forEach(function(a){var s=a(r);Object.keys(s).forEach(function(o){var l=s[o],u=Av(r,o,l);mf(r,o,u)})}),zM(r,this.willChange),HM(r,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return gre(n.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=n.storedValue.get(""+r);if(!i)throw new St("Not a child "+r);return i}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object),i=n.name;r.assertWritable({subpath:i});var a=r.type,s=a._subType;switch(n.type){case"update":{var o=n.newValue,l=n.object.get(i);if(o===l)return null;cu(s,o),n.newValue=s.reconcile(r.getChildNode(i),n.newValue,r,i),a.processIdentifier(i,n.newValue)}break;case"add":cu(s,n.newValue),n.newValue=s.instantiate(r,i,void 0,n.newValue),a.processIdentifier(i,n.newValue);break}return n}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this.identifierMode===yc.YES&&r instanceof Ta){var i=r.identifier;if(i!==n)throw new St("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '".concat(i,"', but expected: '").concat(n,"'"))}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return n.getChildren().forEach(function(i){r[i.subpath]=i.snapshot}),r}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return Object.keys(n).forEach(function(i){r[i]=n[i].getSnapshot()}),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);switch(n.type){case"update":return void r.emitPatch({op:"replace",path:gf(n.name),value:n.newValue.snapshot,oldValue:n.oldValue?n.oldValue.snapshot:void 0},r);case"add":return void r.emitPatch({op:"add",path:gf(n.name),value:n.newValue.snapshot,oldValue:void 0},r);case"delete":var i=n.oldValue.snapshot;return n.oldValue.die(),void r.emitPatch({op:"remove",path:gf(n.name),oldValue:i},r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=n.storedValue;switch(i.op){case"add":case"replace":a.set(r,i.value);break;case"remove":a.delete(r);break}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){cu(this,r);var i=n.storedValue,a={};if(Array.from(i.keys()).forEach(function(o){a[o]=!1}),r)for(var s in r)i.set(s,r[s]),a[""+s]=!0;Object.keys(a).forEach(function(o){a[o]===!1&&i.delete(o)})}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;return ap(n)?dw(Object.keys(n).map(function(a){return i._subType.validate(n[a],KM(r,a,i._subType))})):Oa(r,n,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return $p}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue.delete(r)}}),t})(Bp);sS.prototype.applySnapshot=Jr(sS.prototype.applySnapshot);function FOe(e){return new sS("Map<string, ".concat(e.name,">"),e)}var oS=(function(e){tr(t,e);function t(n,r,i){i===void 0&&(i=[]);var a=e.call(this,n)||this;return Object.defineProperty(a,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Array}),Object.defineProperty(a,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a.hookInitializers=i,a}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.hookInitializers.length>0?this.hookInitializers.concat(n):[n];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return YM(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r=[]);var i=n.type._subType,a={};return r.forEach(function(s,o){var l=""+o;a[l]=i.instantiate(n,l,void 0,s)}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=ya(ya({},fw),{name:this.name});return fr.array(Fre(n),r)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){ul(r).dehancer=n.unbox;var i=n.type;i.hookInitializers.forEach(function(a){var s=a(r);Object.keys(s).forEach(function(o){var l=s[o],u=Av(r,o,l);mf(r,o,u)})}),zM(r,this.willChange),HM(r,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=Number(r);if(i<n.storedValue.length)return n.storedValue[i];throw new St("Not a child: "+r)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);r.assertWritable({subpath:""+n.index});var i=r.type._subType,a=r.getChildren();switch(n.type){case"update":{if(n.newValue===n.object[n.index])return null;var s=Bz(r,i,[a[n.index]],[n.newValue],[n.index]);if(!s)return null;n.newValue=s[0]}break;case"splice":{var o=n.index,l=n.removedCount,u=n.added,f=Bz(r,i,a.slice(o,o+l),u,u.map(function(p,m){return o+m}));if(!f)return null;n.added=f;for(var d=o+l;d<a.length;d++)a[d].setParent(r,""+(d+u.length-l))}break}return n}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.getChildren().map(function(r){return r.snapshot})}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=[];return Object.keys(n).forEach(function(i){r.push(n[i].getSnapshot())}),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);switch(n.type){case"update":return void r.emitPatch({op:"replace",path:""+n.index,value:n.newValue.snapshot,oldValue:n.oldValue?n.oldValue.snapshot:void 0},r);case"splice":if(n.removedCount&&n.addedCount===n.object.length)return void r.emitPatch({op:"replace",path:"",value:r.snapshot,oldValue:n.removed.map(function(a){return a.snapshot})},r);for(var i=n.removedCount-1;i>=0;i--)r.emitPatch({op:"remove",path:""+(n.index+i),oldValue:n.removed[i].snapshot},r);for(var i=0;i<n.addedCount;i++)r.emitPatch({op:"add",path:""+(n.index+i),value:n.added[i].snapshot,oldValue:void 0},r);return}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=n.storedValue,s=r==="-"?a.length:Number(r);switch(i.op){case"replace":a[s]=i.value;break;case"add":a.splice(s,0,i.value);break;case"remove":a.splice(s,1);break}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){cu(this,r);var i=n.storedValue;i.replace(r)}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;return Bre(n)?dw(n.map(function(a,s){return i._subType.validate(a,KM(r,""+s,i._subType))})):Oa(r,n,"Value is not an array")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Up}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue.splice(Number(r),1)}}),t})(Bp);oS.prototype.applySnapshot=Jr(oS.prototype.applySnapshot);function BOe(e){return new oS("".concat(e.name,"[]"),e)}function Bz(e,t,n,r,i){for(var a=!0,s=0;;s++){var o=s<=r.length-1,l=n[s],u=o?r[s]:void 0,f=""+i[s];if(pOe(u)&&(u=u.storedValue),!l&&!o)break;if(!o)a=!1,n.splice(s,1),l instanceof Ta&&l.createObservableInstanceIfNeeded(),l.die(),s--;else if(l)if(Uz(l,u))n[s]=_k(t,e,f,u,l);else{for(var p=void 0,m=s;m<n.length;m++)if(Uz(n[m],u)){p=n.splice(m,1)[0];break}a=!1;var d=_k(t,e,f,u,p);n.splice(s,0,d)}else{if(Sr(u)&&On(u).parent===e)throw new St("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(e.path,"/").concat(f,"', but it lives already at '").concat(On(u).path,"'"));a=!1;var d=_k(t,e,f,u);n.splice(s,0,d)}}return a?null:n}function _k(e,t,n,r,i){cu(e,r);function a(){if(Sr(r)){var o=On(r);if(o.assertAlive($p),o.parent!==null&&o.parent===t)return o.setParent(t,n),o}return i?e.reconcile(i,r,t,n):e.instantiate(t,n,void 0,r)}var s=a();return i&&i!==s&&(i instanceof Ta&&i.createObservableInstanceIfNeeded(),i.die()),s}function Uz(e,t){if(!e.isAlive)return!1;if(Sr(t)){var n=On(t);return n.isAlive&&n===e}if(e.snapshot===t)return!0;if(!(e instanceof Ta))return!1;var r=e.getReconciliationType();return e.identifier!==null&&e.identifierAttribute&&ap(t)&&r.is(t)&&r.isMatchingSnapshotId(e,t)}var $z="preProcessSnapshot",zz="postProcessSnapshot";function UOe(){return On(this).toString()}var Hz={name:"AnonymousModel",properties:{},initializers:Up};function $Oe(e){var t=Object.keys(e),n=new Set;return t.forEach(function(r){if(n.has(r))throw new St("".concat(r," is declared twice in the model. Model should not contain the same keys"));n.add(r)}),t.reduce(function(r,i){if(i in Qr)throw new St("Hook '".concat(i,"' was defined as property. Hooks should be defined as part of the actions"));var a=Object.getOwnPropertyDescriptor(e,i);if("get"in a)throw new St("Getters are not supported as properties. Please use views instead");var s=a.value;if(s==null)throw new St("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");if(kv(s))r[i]=bf(KOe(s),s);else if(s instanceof sS)r[i]=bf(s,{});else if(s instanceof oS)r[i]=bf(s,[]);else if(!Eu(s))throw new St("Invalid type definition for property '".concat(i,"', cannot infer a type from a value like '").concat(s,"' (").concat(typeof s,")"));return r},ya({},e))}var Ov=(function(e){tr(t,e);function t(n){var r=e.call(this,n.name||Hz.name)||this;return Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Object}),Object.defineProperty(r,"initializers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"properties",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"preProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"postProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"propertyNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"named",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return r.cloneAndEnhance({name:i})}}),Object.defineProperty(r,"props",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return r.cloneAndEnhance({properties:i})}}),Object.defineProperty(r,"preProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var a=r.preProcessor;return a?r.cloneAndEnhance({preProcessor:function(s){return a(i(s))}}):r.cloneAndEnhance({preProcessor:i})}}),Object.defineProperty(r,"postProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var a=r.postProcessor;return a?r.cloneAndEnhance({postProcessor:function(s){return i(a(s))}}):r.cloneAndEnhance({postProcessor:i})}}),Object.assign(r,Hz,n),r.properties=$Oe(r.properties),r.properties,r.propertyNames=Object.keys(r.properties),r.identifierAttribute=r._getIdentifierAttribute(),r}return Object.defineProperty(t.prototype,"_getIdentifierAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=void 0;return this.forAllProps(function(r,i){if(i.flags&_n.Identifier){if(n)throw new St("Cannot define property '".concat(r,"' as object identifier, property '").concat(n,"' is already defined as identifier property"));n=r}}),n}}),Object.defineProperty(t.prototype,"cloneAndEnhance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return new t({name:n.name||this.name,properties:Object.assign({},this.properties,n.properties),initializers:this.initializers.concat(n.initializers||[]),preProcessor:n.preProcessor||this.preProcessor,postProcessor:n.postProcessor||this.postProcessor})}}),Object.defineProperty(t.prototype,"actions",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){return r.instantiateActions(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateActions",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!ap(r))throw new St("actions initializer should return a plain object containing actions");Object.getOwnPropertyNames(r).forEach(function(a){if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as an action"));if(a===$z)throw new St("Cannot define action '".concat($z,"', it should be defined using 'type.preProcessSnapshot(fn)' instead"));if(a===zz)throw new St("Cannot define action '".concat(zz,"', it should be defined using 'type.postProcessSnapshot(fn)' instead"));var s=r[a],o=n[a];if(a in Qr&&o){var l=s;s=function(){o.apply(null,arguments),l.apply(null,arguments)}}var u=s.$mst_middleware,f=s.bind(r);f._isFlowAction=s._isFlowAction||!1,f.$mst_middleware=u;var d=Av(n,a,f);r[a]=d,mf(n,a,d)})}}),Object.defineProperty(t.prototype,"volatile",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;if(typeof n!="function")throw new St("You passed an ".concat(typeof n," to volatile state as an argument, when function is expected"));var i=function(a){return r.instantiateVolatileState(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateVolatileState",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!ap(r))throw new St("volatile state initializer should return a plain object containing state");Object.getOwnPropertyNames(r).forEach(function(a){if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as volatile state"));bre(n,a,r[a])})}}),Object.defineProperty(t.prototype,"extend",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){var s=n(a),o=s.actions,l=s.views,u=s.state,f=Yke(s,["actions","views","state"]);for(var d in f)throw new St("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '".concat(d,"'"));return u&&r.instantiateVolatileState(a,u),l&&r.instantiateViews(a,l),o&&r.instantiateActions(a,o),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"views",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){return r.instantiateViews(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateViews",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!ap(r))throw new St("views initializer should return a plain object containing views");Object.getOwnPropertyNames(r).forEach(function(a){var s;if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as a view"));var o=Object.getOwnPropertyDescriptor(r,a);if("get"in o)vre(n,a,o),_re(n,(s={},s[a]=Lm,s));else if(typeof o.value=="function")mf(n,a,o.value);else throw new St("A view member should either be a function or getter based property")})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?a:this.applySnapshotPreProcessor(a);return YM(this,n,r,i,s)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r={});var i=n.type,a={};return i.forAllProps(function(s,o){a[s]=o.instantiate(n,s,void 0,r[s])}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=ya(ya({},fw),{name:this.name});return fr.object(n,$p,r)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){mf(r,"toString",UOe),this.forAllProps(function(i){pre(r,i,n.unbox)}),this.initializers.reduce(function(i,a){return a(i)},r),zM(r,this.willChange),HM(r,this.didChange)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n,i=On(r.object),a=r.name;i.assertWritable({subpath:a});var s=i.type.properties[a];return s&&(cu(s,r.newValue),r.newValue=s.reconcile(i.getChildNode(a),r.newValue,i,a)),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n,i=On(r.object),a=i.type.properties[r.name];if(a){var s=r.oldValue?r.oldValue.snapshot:void 0;i.emitPatch({op:"replace",path:gf(r.name),value:r.newValue.snapshot,oldValue:s},i)}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=[];return this.forAllProps(function(a){i.push(r.getChildNode(n,a))}),i}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i;if(!(r in this.properties))throw new St("Not a value property: "+r);var a=ul(n.storedValue,r),s=(i=a.raw)===null||i===void 0?void 0:i.call(a);if(!s)throw new St("Node not available for property "+r);return s}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;r===void 0&&(r=!0);var a={};return this.forAllProps(function(s,o){var l=Fp(n.storedValue,s);l.reportObserved(),a[s]=i.getChildNode(n,s).snapshot}),r?this.applySnapshotPostProcessor(a):a}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return Object.keys(n).forEach(function(i){r[i]=n[i].getSnapshot()}),this.applySnapshotPostProcessor(r)}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){if(!(i.op==="replace"||i.op==="add"))throw new St("object does not support operation ".concat(i.op));n.storedValue[r]=i.value}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){cu(this,r);var i=this.applySnapshotPreProcessor(r);this.forAllProps(function(a){n.storedValue[a]=i[a]})}}),Object.defineProperty(t.prototype,"applySnapshotPreProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.preProcessor;return r?r.call(null,n):n}}),Object.defineProperty(t.prototype,"applySnapshotPostProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.postProcessor;return r?r.call(null,n):n}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.properties[n]}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this,a=this.applySnapshotPreProcessor(n);return ap(a)?dw(this.propertyNames.map(function(s){return i.properties[s].validate(a[s],KM(r,s,i.properties[s]))})):Oa(r,a,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"forAllProps",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;this.propertyNames.forEach(function(i){return n(i,r.properties[i])})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this;return"{ "+this.propertyNames.map(function(r){return r+": "+n.properties[r].describe()}).join("; ")+" }"}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return $p}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue[r]=void 0}}),t})(Bp);Ov.prototype.applySnapshot=Jr(Ov.prototype.applySnapshot);function zOe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string"?e.shift():"AnonymousModel",r=e.shift()||{};return new Ov({name:n,properties:r})}function HOe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string",r=n?e[0]:"AnonymousModel";return n&&e.shift(),e.reduce(function(i,a){return i.cloneAndEnhance({name:i.name+"_"+a.name,properties:a.properties,initializers:a.initializers,preProcessor:function(s){return a.applySnapshotPreProcessor(i.applySnapshotPreProcessor(s))},postProcessor:function(s){return a.applySnapshotPostProcessor(i.applySnapshotPostProcessor(s))}})}).named(r)}function WOe(e){return Eu(e)&&(e.flags&_n.Object)>0}var Nu=(function(e){tr(t,e);function t(n,r,i,a){a===void 0&&(a=vOe);var s=e.call(this,n)||this;return Object.defineProperty(s,"flags",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"checker",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"initializer",{enumerable:!0,configurable:!0,writable:!0,value:a}),s.flags=r,s}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.initializer(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(kv(n)&&this.checker(n))return Ca();var i=this.name==="Date"?"Date or a unix milliseconds timestamp":this.name;return Oa(r,n,"Value is not a ".concat(i))}}),t})(Kf),Gre=new Nu("string",_n.String,function(e){return typeof e=="string"}),qre=new Nu("number",_n.Number,function(e){return typeof e=="number"}),VOe=new Nu("integer",_n.Integer,function(e){return yOe(e)}),GOe=new Nu("float",_n.Float,function(e){return _Oe(e)}),qOe=new Nu("finite",_n.Finite,function(e){return EOe(e)}),Kre=new Nu("boolean",_n.Boolean,function(e){return typeof e=="boolean"}),Yre=new Nu("null",_n.Null,function(e){return e===null}),Xre=new Nu("undefined",_n.Undefined,function(e){return e===void 0}),Zre=new Nu("Date",_n.Date,function(e){return typeof e=="number"||e instanceof Date},function(e){return e instanceof Date?e:new Date(e)});Zre.getSnapshot=function(e){return e.storedValue.getTime()};var Qre=Zre;function KOe(e){switch(typeof e){case"string":return Gre;case"number":return qre;case"boolean":return Kre;case"object":if(e instanceof Date)return Qre}throw new St("Cannot determine primitive type from value "+e)}function YOe(e){return Eu(e)&&(e.flags&(_n.String|_n.Number|_n.Integer|_n.Boolean|_n.Date))>0}var XOe=(function(e){tr(t,e);function t(n){var r=e.call(this,JSON.stringify(n))||this;return Object.defineProperty(r,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Literal}),r.value=n,r}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.stringify(this.value)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return kv(n)&&n===this.value?Ca():Oa(r,n,"Value is not a literal ".concat(JSON.stringify(this.value)))}}),t})(Kf);function Jre(e){return new XOe(e)}var ZOe=(function(e){tr(t,e);function t(n,r,i,a){var s=e.call(this,n)||this;return Object.defineProperty(s,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_predicate",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_message",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.Refinement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this._subtype.validate(n,r);if(i.length>0)return i;var a=Sr(n)?On(n).snapshot:n;return this._predicate(a)?Ca():Oa(r,n,this._message(n))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t})(_u);function QOe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string"?e.shift():Eu(e[0])?e[0].name:null,r=e[0],i=e[1],a=e[2]?e[2]:function(s){return"Value does not respect the refinement predicate"};return new ZOe(n,r,i,a)}function JOe(e,t){var n=typeof e=="string"?t:e,r=hw.apply(void 0,yu([],vu(n.map(function(i){return Jre(""+i)})),!1));return typeof e=="string"&&(r.name=e),r}var e2e=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,n)||this;return Object.defineProperty(a,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),i=ya({eager:!0,dispatcher:void 0},i),a._dispatcher=i.dispatcher,i.eager||(a._eager=!1),a}return Object.defineProperty(t.prototype,"flags",{get:function(){var n=_n.Union;return this._types.forEach(function(r){n|=r.flags}),n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._types.some(function(r){return r.isAssignableFrom(n)})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map(function(n){return n.describe()}).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.determineType(a,void 0);if(!s)throw new St("No matching type for union "+this.describe());return s.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.determineType(r,n.getReconciliationType());if(!s)throw new St("No matching type for union "+this.describe());return s.reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this._dispatcher?this._dispatcher(n):r?r.is(n)?r:this._types.filter(function(i){return i!==r}).find(function(i){return i.is(n)}):this._types.find(function(i){return i.is(n)})}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this._dispatcher)return this._dispatcher(n).validate(n,r);for(var i=[],a=0,s=0;s<this._types.length;s++){var o=this._types[s],l=o.validate(n,r);if(l.length===0){if(this._eager)return Ca();a++}else i.push(l)}return a===1?Ca():Oa(r,n,"No type is applicable for the union").concat(dw(i))}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),t})(_u);function hw(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Eu(e)?void 0:e,i=Eu(e)?yu([e],vu(t),!1):t,a="("+i.map(function(s){return s.name}).join(" | ")+")";return new e2e(a,i,r)}function t2e(e){return Eu(e)&&(e.flags&_n.Union)>0}var n2e=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,n.name)||this;return Object.defineProperty(a,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"optionalValues",{enumerable:!0,configurable:!0,writable:!0,value:i}),a}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.Optional},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype.describe()+"?"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(this.optionalValues.indexOf(a)>=0){var s=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(n,r,i,s)}return this._subtype.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.reconcile(n,this.optionalValues.indexOf(r)<0&&this._subtype.is(r)?r:this.getDefaultInstanceOrSnapshot(),i,a)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=typeof this._defaultValue=="function"?this._defaultValue():this._defaultValue;return typeof this._defaultValue=="function"&&cu(this,n),n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this.optionalValues.indexOf(n)>=0?Ca():this._subtype.validate(n,r)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t})(_u);function r2e(e,t){if(typeof t!="function"&&Sr(t))throw new St("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead")}function bf(e,t,n){return r2e(e,t),new n2e(e,t,n||i2e)}var i2e=[void 0],a2e=bf(Xre,void 0),s2e=bf(Yre,null);function eie(e){return hw(e,a2e)}function o2e(e){return hw(e,s2e)}var l2e=(function(e){tr(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i}return Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|_n.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!this._subType){var r=void 0;try{r=this._definition()}catch(i){if(i instanceof ReferenceError)r=void 0;else throw i}if(n&&r===void 0)throw new St("Late type seems to be used too early, the definition (still) returns undefined");r&&(this._subType=r)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.getSubType(!0).instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.getSubType(!0).reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this.getSubType(!1);return n?n.name:"<uknown late type>"}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this.getSubType(!1);return i?i.validate(n,r):Ca()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.getSubType(!1);return r?r.isAssignableFrom(n):!1}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this.getSubType(!1);return n||Ire}}),t})(_u);function u2e(e,t){var n=typeof e=="string"?e:"late(".concat(e.toString(),")"),r=typeof e=="string"?t:e;return new l2e(n,r)}function c2e(e,t){return new d2e(e,t)}var d2e=(function(e){tr(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Lazy}),Object.defineProperty(i,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:fr.array()}),wz(function(){return i.pendingNodeList.length>0&&i.pendingNodeList.some(function(a){return a.isAlive&&i.options.shouldLoadPredicate(a.parent?a.parent.value:null)})},function(){i.options.loadType().then(Jr(function(a){i.loadedType=a,i.pendingNodeList.forEach(function(s){s.parent&&i.loadedType&&s.parent.applyPatches([{op:"replace",path:"/".concat(s.subpath),value:s.snapshot}])})}))}),i}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<lazy ".concat(this.name,">")}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this;if(this.loadedType)return this.loadedType.instantiate(n,r,i,a);var o=sd(this,n,r,i,a);return this.pendingNodeList.push(o),wz(function(){return!o.isAlive},function(){return s.pendingNodeList.splice(s.pendingNodeList.indexOf(o),1)}),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this.loadedType?this.loadedType.validate(n,r):zre(n)?Ca():Oa(r,n,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.loadedType?(n.die(),this.loadedType.instantiate(i,a,i.environment,r)):e.prototype.reconcile.call(this,n,r,i,a)}}),t})(Kf),tie=(function(e){tr(t,e);function t(n){var r=e.call(this,n?"frozen(".concat(n.name,")"):"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Frozen}),r}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<any immutable value>"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return zre(n)?this.subType?this.subType.validate(n,r):Ca():Oa(r,n,"Value is not serializable and cannot be frozen")}}),t})(Kf),Wz=new tie;function f2e(e){return arguments.length===0?Wz:Eu(e)?new tie(e):bf(Wz,e)}function h2e(e){switch(e){case Qr.beforeDestroy:return"destroy";case Qr.beforeDetach:return"detach";default:return}}var p2e=(function(){function e(t,n){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),XM(t))this.identifier=t;else if(Sr(t)){var r=On(t);if(!r.identifierAttribute)throw new St("Can only store references with a defined identifier attribute.");var i=r.unnormalizedIdentifier;if(i==null)throw new St("Can only store references to tree nodes with a defined identifier.");this.identifier=i}else throw new St("Can only store references to tree nodes or identifiers, got: '".concat(t,"'"))}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=t0(this.identifier),r=t.root,i=r.identifierCache.getLastCacheModificationPerId(n);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==i){var a=this.targetType,s=r.identifierCache.resolve(a,n);if(!s)throw new m2e("[mobx-state-tree] Failed to resolve reference '".concat(this.identifier,"' to type '").concat(this.targetType.name,"' (from node: ").concat(t.path,")"));this.resolvedReference={node:s,lastCacheModification:i}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e})(),m2e=(function(e){tr(t,e);function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return t})(Error),nie=(function(e){tr(t,e);function t(n,r){var i=e.call(this,"reference(".concat(n.name,")"))||this;return Object.defineProperty(i,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Reference}),i}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.targetType.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return XM(n)?Ca():Oa(r,n,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=r.parent;if(!(!s||!s.isAlive)){var o=s.storedValue;o&&this.onInvalidated({cause:n,parent:o,invalidTarget:a?a.storedValue:void 0,invalidId:i,replaceRef:function(l){Tv(r.root.storedValue,{op:"replace",value:l,path:r.path})},removeRef:function(){WOe(s.type)?this.replaceRef(void 0):Tv(r.root.storedValue,{op:"remove",path:r.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this,a=this.getValue(n);if(a){var s=On(a),o=function(f,d){var p=h2e(d);p&&i.fireInvalidated(p,n,r,s)},l=s.registerHook(Qr.beforeDetach,o),u=s.registerHook(Qr.beforeDestroy,o);return function(){l(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=this;if(this.onInvalidated){var s;n.registerHook(Qr.beforeDestroy,function(){s&&s()});var o=function(l){s&&s();var u=n.parent,f=u&&u.storedValue;if(u&&u.isAlive&&f){var d=void 0;i?d=!!i.get(r,f):d=n.root.identifierCache.has(a.targetType,t0(r)),d?s=a.addTargetNodeWatcher(n,r):l||a.fireInvalidated("invalidSnapshotReference",n,r,null)}};n.state===Si.FINALIZED?o(!0):(n.isRoot||n.root.registerHook(Qr.afterCreationFinalization,function(){n.parent&&n.parent.createObservableInstanceIfNeeded()}),n.registerHook(Qr.afterAttach,function(){o(!1)}))}}}),t})(Kf),g2e=(function(e){tr(t,e);function t(n,r){return e.call(this,n,r)||this}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n.isAlive){var r=n.storedValue;return r.resolvedValue}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n.storedValue;return r.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?Jke(a):a,o=new p2e(a,this.targetType),l=sd(this,n,r,i,o);return o.node=l,this.watchTargetNodeForInvalidations(l,s,void 0),l}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(!n.isDetaching&&n.type===this){var s=Sr(r),o=n.storedValue;if(!s&&o.identifier===r||s&&o.resolvedValue===r)return n.setParent(i,a),n}var l=this.instantiate(i,a,void 0,r);return n.die(),l}}),t})(nie),b2e=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,n,i)||this;return Object.defineProperty(a,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),a}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n.isAlive){var r=this.options.get(n.storedValue,n.parent?n.parent.storedValue:null);return r}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?this.options.set(a,n?n.storedValue:null):a,o=sd(this,n,r,i,s);return this.watchTargetNodeForInvalidations(o,s,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(r)?this.options.set(r,n?n.storedValue:null):r;if(!n.isDetaching&&n.type===this&&n.storedValue===s)return n.setParent(i,a),n;var o=this.instantiate(i,a,void 0,s);return n.die(),o}}),t})(nie);function rie(e,t){var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new b2e(e,{get:n.get,set:n.set},r):new g2e(e,r)}function v2e(e,t){var n=rie(e,ya(ya({},t),{onInvalidated:function(r){t&&t.onInvalidated&&t.onInvalidated(r),r.removeRef()}}));return t&&t.acceptsUndefined===!1?n:eie(n)}var iie=(function(e){tr(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Identifier}),i}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(!n||!(n.type instanceof Ov))throw new St("Identifier types can only be instantiated as direct child of a model type");return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(n.storedValue!==r)throw new St("Tried to change identifier from '".concat(n.storedValue,"' to '").concat(r,"'. Changing identifiers is not allowed."));return n.setParent(i,a),n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return typeof n!==this.validType?Oa(r,n,"Value is not a valid ".concat(this.describe(),", expected a ").concat(this.validType)):Ca()}}),t})(Kf),y2e=(function(e){tr(t,e);function t(){var n=e.call(this,"identifier","string")||this;return Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Identifier}),n}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t})(iie),_2e=(function(e){tr(t,e);function t(){return e.call(this,"identifierNumber","number")||this}return Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t})(iie),E2e=new y2e,S2e=new _2e;function t0(e){return""+e}function XM(e){return typeof e=="string"||typeof e=="number"}function x2e(e){return new w2e(e)}var w2e=(function(e){tr(t,e);function t(n){var r=e.call(this,n.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Custom}),r}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this.options.isTargetType(n))return Ca();var i=this.options.getValidationMessage(n);return i?Oa(r,n,"Invalid value for type '".concat(this.name,"': ").concat(i)):Ca()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.options.toSnapshot(n.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.options.isTargetType(a)?a:this.options.fromSnapshot(a,n&&n.root.environment);return sd(this,n,r,i,s)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=!this.options.isTargetType(r);if(!n.isDetaching){var o=n.type===this&&(s?r===n.snapshot:r===n.storedValue);if(o)return n.setParent(i,a),n}var l=s?this.options.fromSnapshot(r,i.root.environment):r,u=this.instantiate(i,a,void 0,l);return n.die(),u}}),t})(Kf),At={enumeration:JOe,model:zOe,compose:HOe,custom:x2e,reference:rie,safeReference:v2e,union:hw,optional:bf,literal:Jre,maybe:eie,maybeNull:o2e,refinement:QOe,string:Gre,boolean:Kre,number:qre,integer:VOe,float:GOe,finite:qOe,Date:Qre,map:FOe,array:BOe,frozen:f2e,identifier:E2e,identifierNumber:S2e,late:u2e,lazy:c2e,undefined:Xre,null:Yre,snapshotProcessor:MOe};const T2e=At.enumeration("TerminalStatus",["running","exited","error"]),C2e=At.model("Terminal",{id:At.identifier,name:At.string,cwd:At.string,status:T2e,exitCode:At.maybe(At.number),cols:At.number,rows:At.number,createdAt:At.number,tabId:At.maybeNull(At.string),positionInTab:At.optional(At.number,0)}).volatile(()=>({xterm:null,attachCleanup:null,isPending:!1,pendingId:null,isStartingUp:!1})).views(e=>({get isAlive(){return e.status==="running"},get isTabTerminal(){return e.tabId!=null}})).actions(e=>({updateFromServer(t){t.name!==void 0&&(e.name=t.name),t.cwd!==void 0&&(e.cwd=t.cwd),t.status!==void 0&&(e.status=t.status),t.exitCode!==void 0&&(e.exitCode=t.exitCode),t.cols!==void 0&&(e.cols=t.cols),t.rows!==void 0&&(e.rows=t.rows),t.tabId!==void 0&&(e.tabId=t.tabId),t.positionInTab!==void 0&&(e.positionInTab=t.positionInTab)},setXterm(t){e.xterm=t},setAttachCleanup(t){e.attachCleanup=t},markExited(t){e.status="exited",e.exitCode=t},assignToTab(t,n){e.tabId=t,n!==void 0&&(e.positionInTab=n)},rename(t){e.name=t},resize(t,n){e.cols=t,e.rows=n},setPending(t,n){e.isPending=t,n!==void 0&&(e.pendingId=n)},setStartingUp(t){e.isStartingUp=t},cleanup(){e.attachCleanup&&(e.attachCleanup(),e.attachCleanup=null),e.xterm=null}})),A2e=At.model("Tab",{id:At.identifier,name:At.string,position:At.number,directory:At.maybeNull(At.string),createdAt:At.number}).volatile(()=>({isPending:!1})).views(e=>({get terminals(){const t=Ore(e);return t.terminals?.items?t.terminals.items.filter(n=>n.tabId===e.id).sort((n,r)=>n.positionInTab-r.positionInTab):[]},get terminalCount(){return this.terminals.length}})).actions(e=>({updateFromServer(t){t.name!==void 0&&(e.name=t.name),t.directory!==void 0&&(e.directory=t.directory),t.position!==void 0&&(e.position=t.position)},rename(t){e.name=t},setDirectory(t){e.directory=t},setPosition(t){e.position=t},setPending(t){e.isPending=t}})),k2e=At.map(At.string),O2e=At.model("ViewState",{focusedTerminals:At.optional(k2e,{}),currentView:At.maybeNull(At.string),currentTaskId:At.maybeNull(At.string),isTabVisible:At.maybeNull(At.boolean),viewUpdatedAt:At.maybeNull(At.string)}).volatile(()=>({pendingUpdates:{},debounceTimer:null})).views(e=>({getFocusedTerminal(t){return e.focusedTerminals.get(t)??null}})).actions(e=>({setFocusedTerminal(t,n){n===null?e.focusedTerminals.delete(t):e.focusedTerminals.set(t,n)},clearFocusedTerminalForTab(t){e.focusedTerminals.delete(t)},updateViewTracking(t,n){e.currentView=t,e.currentTaskId=n,e.viewUpdatedAt=new Date().toISOString()},setTabVisible(t){e.isTabVisible=t,e.viewUpdatedAt=new Date().toISOString()},hydrateFromServer(t){if(t.focusedTerminals){e.focusedTerminals.clear();for(const[n,r]of Object.entries(t.focusedTerminals))e.focusedTerminals.set(n,r)}t.currentView!==void 0&&(e.currentView=t.currentView),t.currentTaskId!==void 0&&(e.currentTaskId=t.currentTaskId),t.isTabVisible!==void 0&&(e.isTabVisible=t.isTabVisible),t.viewUpdatedAt!==void 0&&(e.viewUpdatedAt=t.viewUpdatedAt)}}));function hD(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}function Vz(){return`temp-${hD()}`}const R2e=At.model("TerminalsStore",{items:At.array(C2e)}).views(e=>({get(t){return e.items.find(n=>n.id===t)},getByTab(t){return e.items.filter(n=>n.tabId===t).sort((n,r)=>n.positionInTab-r.positionInTab)},get taskTerminals(){return e.items.filter(t=>t.tabId==null)},has(t){return e.items.some(n=>n.id===t)}})).actions(e=>({add(t){if(e.items.some(n=>n.id===t.id)){kt.ws.debug("Terminal already exists, skipping add",{id:t.id});return}e.items.push(t)},remove(t){const n=e.items.find(r=>r.id===t);n&&(n.cleanup(),aS(n))},replaceAll(t){for(const n of e.items)n.cleanup();e.items.clear();for(const n of t)e.items.push(n)},clear(){for(const t of e.items)t.cleanup();e.items.clear()}})),N2e=At.model("TabsStore",{items:At.array(A2e)}).views(e=>({get(t){return e.items.find(n=>n.id===t)},get sorted(){return[...e.items].sort((t,n)=>t.position-n.position)},has(t){return e.items.some(n=>n.id===t)},get first(){return this.sorted[0]}})).actions(e=>({add(t){if(e.items.some(n=>n.id===t.id)){kt.ws.debug("Tab already exists, skipping add",{id:t.id});return}e.items.push(t)},remove(t){const n=e.items.find(r=>r.id===t);n&&aS(n)},replaceAll(t){e.items.clear();for(const n of t)e.items.push(n)},clear(){e.items.clear()}})),I2e=At.model("RootStore",{terminals:At.optional(R2e,{items:[]}),tabs:At.optional(N2e,{items:[]}),viewState:At.optional(O2e,{})}).volatile(()=>({connected:!1,initialized:!1,hasEverConnected:!1,reconnectAttempt:0,maxReconnectAttempts:10,newTerminalIds:new Set,pendingUpdates:new Map,onAttachedCallbacks:new Map,terminalsReadyForCallback:new Set,lastFocusedTerminalId:null,terminalsPendingStartup:new Map,pendingTabCreation:null,lastCreatedTabId:null,broadcastedTheme:null})).views(e=>({get isReady(){return e.connected&&e.initialized}})).actions(e=>{const t=()=>eOe(e);return{setConnected(n){const r=e.connected;if(e.connected=n,!n)e.initialized=!1;else if(!r&&n&&(e.hasEverConnected=!0,e.reconnectAttempt=0,e.pendingUpdates.size>0)){t().log.ws.info("Reconnected: clearing stale pending updates",{count:e.pendingUpdates.size});for(const i of e.pendingUpdates.values())if(i.entityType==="terminal"){const a=e.terminals.get(i.tempId);a&&(a.cleanup(),e.terminals.remove(i.tempId)),e.newTerminalIds.delete(i.tempId)}else i.entityType==="tab"&&e.tabs.remove(i.tempId);e.pendingUpdates.clear()}},setInitialized(n){e.initialized=n},setReconnectAttempt(n){e.reconnectAttempt=n},setMaxReconnectAttempts(n){e.maxReconnectAttempts=n},markNewTerminal(n){e.newTerminalIds.add(n)},clearNewTerminal(n){e.newTerminalIds.delete(n)},setLastFocusedTerminal(n){e.lastFocusedTerminalId=n},consumePendingStartup(n){const r=e.terminalsPendingStartup.get(n);return r&&(e.terminalsPendingStartup.delete(n),t().log.ws.info("consumed pending startup",{terminalId:n,taskName:r.taskName})),r},clearStartingUp(n){const r=e.terminals.get(n);r&&(r.setStartingUp(!1),t().log.ws.info("cleared isStartingUp",{terminalId:n}))},setPendingTabCreation(n){e.pendingTabCreation=n},clearLastCreatedTabId(){e.lastCreatedTabId=null},syncTheme(n){t().send({type:"theme:sync",payload:{theme:n}})},clearBroadcastedTheme(){e.broadcastedTheme=null},createTerminal(n){const r=hD(),i=Vz(),a={id:i,name:n.name,cwd:n.cwd??"~",status:"running",cols:n.cols,rows:n.rows,createdAt:Date.now(),tabId:n.tabId??null,positionInTab:n.positionInTab??0},s=Mz(e.terminals);e.terminals.add(a),s.stop();const o=e.terminals.get(i);o?.setPending(!0,i),e.pendingUpdates.set(r,{entityType:"terminal",tempId:i,inversePatches:s.inversePatches,createdAt:Date.now()}),e.newTerminalIds.add(i),n.startup&&(e.terminalsPendingStartup.set(i,n.startup),o?.setStartingUp(!0),t().log.ws.info("createTerminal registered startup",{tempId:i,taskName:n.startup.taskName,isStartingUp:o?.isStartingUp}));const{startup:l,...u}=n;t().send({type:"terminal:create",payload:{...u,requestId:r,tempId:i}}),t().log.ws.debug("createTerminal optimistic",{requestId:r,tempId:i,name:n.name})},destroyTerminal(n,r){t().send({type:"terminal:destroy",payload:{terminalId:n,force:r?.force,reason:r?.reason}});const i=e.terminals.get(n);i&&i.cleanup(),e.terminals.remove(n)},writeToTerminal(n,r){t().send({type:"terminal:input",payload:{terminalId:n,data:r}})},sendInputToTerminal(n,r){t().send({type:"terminal:input",payload:{terminalId:n,data:r}}),setTimeout(()=>{t().send({type:"terminal:input",payload:{terminalId:n,data:"\r"}})},50)},resizeTerminal(n,r,i){t().send({type:"terminal:resize",payload:{terminalId:n,cols:r,rows:i}}),e.terminals.get(n)?.resize(r,i)},renameTerminal(n,r){t().send({type:"terminal:rename",payload:{terminalId:n,name:r}}),e.terminals.get(n)?.rename(r)},attachXterm(n,r,i){const a=e.terminals.get(n);if(!a)return t().log.ws.warn("attachXterm: terminal not found",{terminalId:n}),()=>{};if(a.xterm===r)return t().log.ws.debug("attachXterm: already attached, skipping",{terminalId:n}),i?.onAttached&&(e.terminalsReadyForCallback.has(n)?(e.terminalsReadyForCallback.delete(n),setTimeout(()=>i.onAttached?.(n),0)):e.onAttachedCallbacks.set(n,i.onAttached)),a.attachCleanup||(()=>{});a.attachCleanup&&a.attachCleanup(),a.setXterm(r),r.attachCustomKeyEventHandler(u=>u.type==="keydown"&&u.shiftKey&&u.key==="Enter"?(u.preventDefault(),u.stopPropagation(),t().send({type:"terminal:input",payload:{terminalId:n,data:`
31
- `}}),!1):!0);const s=r.onData(u=>{t().send({type:"terminal:input",payload:{terminalId:n,data:u}})}),o=()=>{this.setLastFocusedTerminal(n)};r.textarea?.addEventListener("focus",o),i?.onAttached&&(e.terminalsReadyForCallback.has(n)?(t().log.ws.debug("attachXterm: terminal already attached, calling callback immediately",{terminalId:n}),e.terminalsReadyForCallback.delete(n),setTimeout(()=>i.onAttached?.(n),0)):(t().log.ws.debug("attachXterm: registering onAttached callback",{terminalId:n,existingCallbacks:Array.from(e.onAttachedCallbacks.keys())}),e.onAttachedCallbacks.set(n,i.onAttached)));const l=()=>{s.dispose(),r.textarea?.removeEventListener("focus",o),e.terminals.get(n)?.setXterm(null)};return a.setAttachCleanup(l),t().send({type:"terminal:attach",payload:{terminalId:n}}),l},requestAttach(n){t().send({type:"terminal:attach",payload:{terminalId:n}})},clearTerminalBuffer(n){t().send({type:"terminal:clearBuffer",payload:{terminalId:n}})},assignTerminalToTab(n,r,i){t().send({type:"terminal:assignTab",payload:{terminalId:n,tabId:r,positionInTab:i}}),e.terminals.get(n)?.assignToTab(r,i)},createTab(n,r,i){const a=hD(),s=Vz(),o=r??e.tabs.items.length,l={id:s,name:n,position:o,directory:i??null,createdAt:Date.now()},u=Mz(e.tabs);e.tabs.add(l),u.stop(),e.tabs.get(s)?.setPending(!0),e.pendingTabCreation=s,e.pendingUpdates.set(a,{entityType:"tab",tempId:s,inversePatches:u.inversePatches,createdAt:Date.now()}),t().send({type:"tab:create",payload:{name:n,position:r,directory:i,requestId:a,tempId:s}}),t().log.ws.debug("createTab optimistic",{requestId:a,tempId:s,name:n})},updateTab(n,r){t().send({type:"tab:update",payload:{tabId:n,...r}}),e.tabs.get(n)?.updateFromServer(r)},deleteTab(n){t().send({type:"tab:delete",payload:{tabId:n}}),e.tabs.remove(n),e.viewState.clearFocusedTerminalForTab(n)},reorderTab(n,r){const i=e.tabs.get(n);if(!i)return;const a=i.position;if(t().send({type:"tab:reorder",payload:{tabId:n,position:r}}),r>a)for(const s of e.tabs.items)s.position>a&&s.position<=r&&s.setPosition(s.position-1);else if(r<a)for(const s of e.tabs.items)s.position>=r&&s.position<a&&s.setPosition(s.position+1);i.setPosition(r)},handleMessage(n){const{type:r,payload:i}=n;switch(r){case"terminals:list":e.terminals.replaceAll(i.terminals);break;case"terminal:created":{const{terminal:a,isNew:s,requestId:o,tempId:l}=i;if(o&&l){const u=e.pendingUpdates.get(o);if(u&&u.tempId===l){e.pendingUpdates.delete(o);const f=e.terminals.get(l);if(f){const d=f.xterm,p=e.onAttachedCallbacks.get(l),m=f.attachCleanup;if(t().log.ws.info("terminal:created optimistic handling",{tempId:l,realId:a.id,hasXterm:!!d,hasCallback:!!p,isNew:s}),m&&m(),f.setXterm(null),f.setAttachCleanup(null),e.onAttachedCallbacks.delete(l),s){const y=f.isStartingUp,S=e.terminals.items.findIndex(v=>v.id===l);S>=0&&aS(e.terminals.items[S]),e.terminals.add(a);const g=e.terminals.get(a.id);y&&g&&(g.setStartingUp(!0),t().log.ws.info("terminal:created transferred isStartingUp",{tempId:l,realId:a.id,isStartingUp:g.isStartingUp})),t().log.ws.info("terminal:created re-attaching xterm",{realId:a.id,hasRealTerminal:!!g,hasXterm:!!d,willAttach:!!(g&&d)}),g&&d?this.attachXterm(a.id,d,{onAttached:p}):p&&(t().log.ws.info("terminal:created preserving callback for later",{realId:a.id}),e.onAttachedCallbacks.set(a.id,p)),e.newTerminalIds.delete(l),e.newTerminalIds.add(a.id);const _=e.terminalsPendingStartup.get(l);_&&(e.terminalsPendingStartup.delete(l),e.terminalsPendingStartup.set(a.id,_),t().log.ws.debug("transferred pending startup",{tempId:l,realId:a.id})),t().log.ws.debug("terminal:created confirmed",{requestId:o,tempId:l,realId:a.id,xtermReattached:!!d,hasPendingStartup:!!_})}else{const y=e.terminals.items.findIndex(g=>g.id===l);y>=0&&aS(e.terminals.items[y]),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l),e.terminals.has(a.id)||e.terminals.add(a),e.terminals.get(a.id)&&d&&this.attachXterm(a.id,d,{onAttached:p}),t().log.ws.debug("terminal:created deduplicated",{requestId:o,tempId:l,existingId:a.id,xtermReattached:!!d})}}break}}e.terminals.add(a),s&&e.newTerminalIds.add(a.id);break}case"terminal:destroyed":{const{terminalId:a}=i;e.terminals.remove(a),e.newTerminalIds.delete(a),e.terminalsReadyForCallback.delete(a),e.onAttachedCallbacks.delete(a);break}case"terminal:output":{const{terminalId:a,data:s}=i,o=e.terminals.get(a);o?.xterm?o.xterm.write(s):t().log.ws.warn("terminal:output but no xterm",{terminalId:a});break}case"terminal:attached":{const{terminalId:a,buffer:s}=i,o=e.terminals.get(a);t().log.ws.info("terminal:attached received",{terminalId:a,hasTerminal:!!o,hasXterm:!!o?.xterm,bufferLength:s?.length??0,hasCallback:e.onAttachedCallbacks.has(a),isReadyForCallback:e.terminalsReadyForCallback.has(a),registeredCallbacks:Array.from(e.onAttachedCallbacks.keys())}),o?.xterm&&(o.xterm.reset(),s&&o.xterm.write(s));const l=e.onAttachedCallbacks.get(a);l?(e.onAttachedCallbacks.delete(a),t().log.ws.debug("terminal:attached calling callback",{terminalId:a}),l(a)):(t().log.ws.debug("terminal:attached no callback yet, marking ready",{terminalId:a}),e.terminalsReadyForCallback.add(a));break}case"terminal:bufferCleared":{const{terminalId:a}=i,s=e.terminals.get(a);s?.xterm&&s.xterm.reset();break}case"terminal:exit":{const{terminalId:a,exitCode:s}=i;e.terminals.get(a)?.markExited(s);break}case"terminal:renamed":{const{terminalId:a,name:s}=i;e.terminals.get(a)?.rename(s);break}case"terminal:tabAssigned":{const{terminalId:a,tabId:s,positionInTab:o}=i;e.terminals.get(a)?.assignToTab(s,o);break}case"tabs:list":e.tabs.replaceAll(i.tabs),e.initialized=!0;break;case"tab:created":{const{tab:a,requestId:s,tempId:o}=i;if(s&&o){const l=e.pendingUpdates.get(s);if(l&&l.tempId===o){e.pendingUpdates.delete(s),e.tabs.get(o)&&(e.tabs.remove(o),e.tabs.add(a),e.pendingTabCreation=null,e.lastCreatedTabId=a.id,t().log.ws.debug("tab:created confirmed",{requestId:s,tempId:o,realId:a.id}));break}}e.tabs.add(a);break}case"tab:updated":{const{tabId:a,name:s,directory:o}=i;e.tabs.get(a)?.updateFromServer({name:s,directory:o});break}case"tab:deleted":{const{tabId:a}=i;e.tabs.remove(a),e.viewState.clearFocusedTerminalForTab(a);break}case"terminal:error":{const{error:a,requestId:s,tempId:o}=i;if(s&&o){const l=e.pendingUpdates.get(s);if(l&&l.tempId===o){e.pendingUpdates.delete(s);for(let u=l.inversePatches.length-1;u>=0;u--)Tv(e.terminals,l.inversePatches[u]);e.newTerminalIds.delete(o),e.terminalsPendingStartup.delete(o),t().log.ws.warn("terminal:error rollback",{requestId:s,tempId:o,error:a});break}}kt.ws.error("Terminal error from server",{error:a});break}case"sync:stale":{const{entityType:a,entityId:s,requestId:o,tempId:l,error:u}=i;if(t().log.ws.warn("sync:stale received",{entityType:a,entityId:s,error:u}),o&&l){const f=e.pendingUpdates.get(o);if(f&&f.tempId===l)if(e.pendingUpdates.delete(o),f.entityType==="terminal"){const d=e.terminals.get(l);d&&(d.cleanup(),e.terminals.remove(l)),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l)}else f.entityType==="tab"&&e.tabs.remove(l)}if(a==="terminal"){if(e.terminals.has(s)){const f=e.terminals.get(s);f&&(f.cleanup(),e.terminals.remove(s))}e.terminalsPendingStartup.delete(s)}else a==="tab"&&e.tabs.has(s)&&(e.tabs.remove(s),e.viewState.clearFocusedTerminalForTab(s));break}case"theme:synced":{const{theme:a}=i;e.broadcastedTheme=a,t().log.ws.debug("theme:synced received",{theme:a});break}}},reset(){e.terminals.clear(),e.tabs.clear(),e.connected=!1,e.initialized=!1,e.newTerminalIds.clear(),e.pendingUpdates.clear(),e.terminalsPendingStartup.clear()}}});function aie(){const e=Mm();return k.useMemo(()=>{const t=(n,r)=>{const i=async a=>{const s=a.clipboardData?.items;if(s){for(const o of s)if(o.type.startsWith("image/")){a.preventDefault(),a.stopPropagation();const l=o.getAsFile();if(!l)return;try{const u=await Cte(l);e.writeToTerminal(r,u)}catch(u){kt.ws.error("Failed to upload image",{error:String(u)})}return}}};return n.addEventListener("paste",i,!0),()=>{n.removeEventListener("paste",i,!0)}};return{get terminals(){return[...e.terminals.items]},get terminalsLoaded(){return e.initialized},get tabs(){return[...e.tabs.sorted]},get connected(){return e.connected},get newTerminalIds(){return e.newTerminalIds},get pendingTabCreation(){return e.pendingTabCreation},get lastCreatedTabId(){return e.lastCreatedTabId},createTerminal:e.createTerminal.bind(e),destroyTerminal:e.destroyTerminal.bind(e),writeToTerminal:e.writeToTerminal.bind(e),sendInputToTerminal:e.sendInputToTerminal.bind(e),resizeTerminal:e.resizeTerminal.bind(e),renameTerminal:e.renameTerminal.bind(e),clearTerminalBuffer:e.clearTerminalBuffer.bind(e),assignTerminalToTab:e.assignTerminalToTab.bind(e),createTab:e.createTab.bind(e),updateTab:e.updateTab.bind(e),deleteTab:e.deleteTab.bind(e),reorderTab:e.reorderTab.bind(e),attachXterm:e.attachXterm.bind(e),setupImagePaste:t,consumePendingStartup:e.consumePendingStartup.bind(e),clearStartingUp:e.clearStartingUp.bind(e),clearLastCreatedTabId:e.clearLastCreatedTabId.bind(e)}},[e])}const Ek="",D2e=At.model("File",{path:At.identifier,content:At.string,originalContent:At.string,mimeType:At.string,size:At.number,lineCount:At.number,truncated:At.boolean,isMarkdownView:At.optional(At.boolean,!1)}).views(e=>({get isDirty(){return e.content!==e.originalContent},get isMarkdown(){return e.path.toLowerCase().endsWith(".md")},get isImage(){return e.mimeType.startsWith("image/")},get isBinary(){return e.mimeType==="application/octet-stream"},get isEditable(){return!e.mimeType.startsWith("image/")&&e.mimeType!=="application/octet-stream"}})).actions(e=>({setContent(t){e.content=t},markSaved(){e.originalContent=e.content},toggleMarkdownView(){e.isMarkdownView=!e.isMarkdownView},setMarkdownView(t){e.isMarkdownView=t}})),L2e=At.model("FilesStore",{selectedFile:At.maybeNull(At.string),expandedDirs:At.array(At.string),openFiles:At.map(D2e)}).volatile(()=>({worktreePath:null,readOnly:!1,isLoading:!1,isSaving:!1,loadError:null,saveError:null,fileTree:null,isLoadingTree:!1,treeError:null})).views(e=>({get currentFile(){if(e.selectedFile)return e.openFiles.get(e.selectedFile)},get isDirty(){return(e.selectedFile?e.openFiles.get(e.selectedFile):void 0)?.isDirty??!1},isFileMarkdownView(t){return e.openFiles.get(t)?.isMarkdownView??!1},isDirExpanded(t){return e.expandedDirs.includes(t)}})).actions(e=>({setWorktreePath(t){e.worktreePath!==t&&(e.worktreePath=t,e.selectedFile=null,e.expandedDirs.clear(),e.openFiles.clear(),e.fileTree=null)},setReadOnly(t){e.readOnly=t},selectFile(t){e.selectedFile=t},toggleDir(t){const n=e.expandedDirs.indexOf(t);n>=0?e.expandedDirs.splice(n,1):e.expandedDirs.push(t)},collapseAll(){e.expandedDirs.clear()},updateContent(t,n){const r=e.openFiles.get(t);r&&r.setContent(n)},toggleMarkdownView(t){const n=e.openFiles.get(t);n&&n.toggleMarkdownView()},_setLoading(t){e.isLoading=t},_setLoadError(t){e.loadError=t},_setSaving(t){e.isSaving=t},_setSaveError(t){e.saveError=t},_setFileTree(t){e.fileTree=t},_setLoadingTree(t){e.isLoadingTree=t},_setTreeError(t){e.treeError=t},_addFile(t){e.openFiles.set(t.path,{path:t.path,content:t.content,originalContent:t.content,mimeType:t.mimeType,size:t.size,lineCount:t.lineCount,truncated:t.truncated,isMarkdownView:!1})},_markFileSaved(t){const n=e.openFiles.get(t);n&&n.markSaved()}})).actions(e=>({loadFileTree:vk(function*(){if(e.worktreePath){e._setLoadingTree(!0),e._setTreeError(null);try{const t=yield $t(`${Ek}/api/fs/tree?root=${encodeURIComponent(e.worktreePath)}`);e._setFileTree(t.entries)}catch(t){e._setTreeError(t instanceof Error?t.message:"Failed to load file tree")}finally{e._setLoadingTree(!1)}}}),loadFile:vk(function*(t){if(e.worktreePath){if(e.openFiles.has(t)){e.selectedFile=t;return}e._setLoading(!0),e._setLoadError(null);try{const n=new URLSearchParams({path:t,root:e.worktreePath}),r=yield $t(`${Ek}/api/fs/read?${n}`);e._addFile({path:t,content:r.content,mimeType:r.mimeType,size:r.size,lineCount:r.lineCount,truncated:r.truncated}),e.selectedFile=t}catch(n){e._setLoadError(n instanceof Error?n.message:"Failed to load file")}finally{e._setLoading(!1)}}}),saveFile:vk(function*(t){if(!e.worktreePath)return;const n=e.openFiles.get(t);if(!(!n||!n.isDirty)){e._setSaving(!0),e._setSaveError(null);try{(yield fetch(`${Ek}/api/fs/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,root:e.worktreePath,content:n.content})}).then(i=>i.ok?i.json():i.json().then(a=>{throw new Error(a.error||"Failed to save file")}))).success&&e._markFileSaved(t)}catch(r){throw e._setSaveError(r instanceof Error?r.message:"Failed to save file"),r}finally{e._setSaving(!1)}}}),closeFile(t){e.openFiles.delete(t),e.selectedFile===t&&(e.selectedFile=null)}}));function P2e(){return L2e.create({selectedFile:null,expandedDirs:[],openFiles:{}})}const sie=k.createContext(null);function M2e(e,t=!1,n){const r=k.useMemo(()=>P2e(),[]),i=k.useRef(!1);return k.useEffect(()=>{r.setWorktreePath(e),r.setReadOnly(t),i.current=!1,e&&r.loadFileTree().then(()=>{n&&!i.current&&(i.current=!0,r.selectFile(n),r.loadFile(n))})},[r,e,t,n]),r}function j2e(){const e=k.useContext(sie);if(!e)throw new Error("useFilesStore must be used within a FilesStoreProvider");return e}function oie(){const e=j2e();return{worktreePath:e.worktreePath,readOnly:e.readOnly,selectedFile:e.selectedFile,currentFile:e.currentFile,expandedDirs:[...e.expandedDirs],fileTree:e.fileTree,isLoading:e.isLoading,isSaving:e.isSaving,isLoadingTree:e.isLoadingTree,loadError:e.loadError,saveError:e.saveError,treeError:e.treeError,isDirty:e.isDirty,selectFile:e.selectFile,loadFile:e.loadFile,saveFile:e.saveFile,closeFile:e.closeFile,updateContent:e.updateContent,toggleDir:e.toggleDir,collapseAll:e.collapseAll,toggleMarkdownView:e.toggleMarkdownView,isFileMarkdownView:e.isFileMarkdownView,isDirExpanded:e.isDirExpanded,refreshTree:e.loadFileTree}}const lie=k.createContext(null);function Mm(){const e=k.useContext(lie);if(!e)throw new Error("useStore must be used within a StoreProvider");return e}function F2e(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}function B2e({children:e,wsUrl:t=F2e(),reconnectInterval:n=2e3,maxReconnectAttempts:r=10}){const i=k.useRef(null),a=k.useRef(0),s=k.useRef(void 0),o=k.useRef(null),[,l]=k.useState({}),u=k.useCallback(d=>{i.current?.readyState===WebSocket.OPEN?(kt.ws.debug("send",{type:d.type}),i.current.send(JSON.stringify(d))):kt.ws.warn("send dropped (WebSocket not open)",{type:d.type,readyState:i.current?.readyState??"no socket"})},[]);if(!o.current){const d={send:u,log:kt};o.current=I2e.create({},d)}const f=o.current;return k.useEffect(()=>{f.setMaxReconnectAttempts(r)},[f,r]),k.useEffect(()=>{let d=!0;const p=()=>{const m=i.current;if(m&&(m.readyState===WebSocket.CONNECTING||m.readyState===WebSocket.OPEN))return;const y=new WebSocket(t);i.current=y,y.onopen=()=>{d&&(kt.ws.info("WebSocket connected"),f.setConnected(!0),a.current=0)},y.onmessage=S=>{if(d)try{const g=JSON.parse(S.data);f.handleMessage(g)}catch(g){kt.ws.error("Failed to parse WebSocket message",{error:String(g)})}},y.onclose=()=>{if(d)if(kt.ws.info("WebSocket disconnected"),f.setConnected(!1),i.current===y&&(i.current=null),a.current<r){a.current++,f.setReconnectAttempt(a.current);const S=n*Math.pow(1.5,a.current-1);kt.ws.info("Scheduling reconnect",{attempt:a.current,delay:S}),s.current=setTimeout(p,S)}else kt.ws.warn("Max reconnect attempts reached"),f.setReconnectAttempt(a.current)},y.onerror=S=>{kt.ws.error("WebSocket error",{event:String(S)})}};return p(),()=>{d=!1,s.current&&clearTimeout(s.current);const m=i.current;m?.readyState===WebSocket.OPEN&&m.close(),i.current=null}},[t,n,r,f]),k.useEffect(()=>{l({})},[]),b.jsx(lie.Provider,{value:f,children:e})}function uie(){const e=Mm(),{setTheme:t,resolvedTheme:n,theme:r}=qc(),{data:i}=Jxe(),a=k.useRef(void 0),s=k.useRef(!1),o=k.useRef(!1);k.useEffect(()=>$M(()=>e.broadcastedTheme,f=>{f&&(o.current=!0,t(f),e.clearBroadcastedTheme(),setTimeout(()=>{o.current=!1},0))},{fireImmediately:!0}),[e,t]),k.useEffect(()=>{if(!n)return;const u=n==="dark"?"/logo-dark.jpg":"/logo-light.jpg";let f=document.querySelector('link[rel="icon"]');f||(f=document.createElement("link"),f.rel="icon",document.head.appendChild(f)),f.type="image/jpeg",f.href=u},[n]),k.useEffect(()=>{const u=s.current&&i&&a.current===!1;a.current=i,s.current=!0,n&&u&&$t("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:n})}).catch(()=>{})},[i,n]);const l=k.useCallback(u=>{if(!o.current&&(t(u),e.syncTheme(u),i)){const f=u==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":u;$t("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:f})}).catch(()=>{})}},[t,e,i]);return{theme:r??"system",resolvedTheme:n,syncClaudeCode:i,changeTheme:l,isUpdating:!1}}let Sk=!1;const Gz={activeTabId:null,focusedTerminals:{},currentView:null,currentTaskId:null,isTabVisible:null,viewUpdatedAt:null};function cie(){const e=wr(),t=k.useRef(void 0),n=k.useRef({}),{data:r=Gz,isLoading:i}=qn({queryKey:["terminal-view-state"],queryFn:async()=>{const p=await fetch("/api/terminal-view-state");if(!p.ok)throw new Error("Failed to fetch terminal view state");return p.json()},staleTime:2e3}),a=zn({mutationFn:async p=>{const m=await fetch("/api/terminal-view-state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!m.ok)throw new Error("Failed to update terminal view state");return m.json()},onSuccess:p=>{e.setQueryData(["terminal-view-state"],p)}}),s=k.useRef(a);s.current=a;const o=k.useCallback(p=>{const m=n.current;n.current={...m,...p,focusedTerminals:p.focusedTerminals||m.focusedTerminals?{...m.focusedTerminals,...p.focusedTerminals}:void 0};const y=n.current;e.setQueryData(["terminal-view-state"],S=>{const g=S??Gz;return{activeTabId:y.activeTabId!==void 0?y.activeTabId:g.activeTabId,focusedTerminals:{...g.focusedTerminals,...y.focusedTerminals},currentView:y.currentView!==void 0?y.currentView:g.currentView,currentTaskId:y.currentTaskId!==void 0?y.currentTaskId:g.currentTaskId,isTabVisible:y.isTabVisible!==void 0?y.isTabVisible:g.isTabVisible,viewUpdatedAt:y.viewUpdatedAt!==void 0?y.viewUpdatedAt:g.viewUpdatedAt}}),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{s.current.mutate(n.current),n.current={}},500)},[e]),l=k.useCallback((p,m)=>{if(m===null){const y=e.getQueryData(["terminal-view-state"]);if(y){const{[p]:S,...g}=y.focusedTerminals;o({focusedTerminals:g})}}else o({focusedTerminals:{[p]:m}})},[e,o]),u=k.useCallback(p=>r.focusedTerminals[p]??null,[r.focusedTerminals]),f=k.useRef(!1);k.useEffect(()=>{if(Sk){f.current=!1;return}Sk=!0,f.current=!0;const p=()=>{o({isTabVisible:document.visibilityState==="visible",viewUpdatedAt:new Date().toISOString()})};return document.addEventListener("visibilitychange",p),p(),()=>{document.removeEventListener("visibilitychange",p),f.current&&(Sk=!1)}},[o]);const d=k.useCallback((p,m,y)=>{o({currentView:p,currentTaskId:m,activeTabId:y,viewUpdatedAt:new Date().toISOString()})},[o]);return{viewState:r,isLoading:i,getFocusedTerminal:u,setFocusedTerminal:l,updateViewTracking:d}}function no(e,t){const n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return 100;if(n.startsWith(r))return 80;if(n.includes(r))return 60;let i=0,a=0,s=0;for(;i<n.length&&a<r.length;)n[i]===r[a]&&(s+=1,a++),i++;return a===r.length?s:0}function U2e(e,t){return t.trim()?e.map(r=>{let i=no(r.label,t);if(r.keywords)for(const a of r.keywords){const s=no(a,t);s>i&&(i=s)}return{command:r,score:i}}).filter(({score:r})=>r>0).sort((r,i)=>i.score-r.score).map(({command:r})=>r):e}function $2e(e){const t=new Map;for(const n of e){const r=t.get(n.category)||[];r.push(n),t.set(n.category,r)}return t}function z2e({open:e,onOpenChange:t,onNewTask:n,onShowShortcuts:r}){const{t:i}=tn("navigation"),[a,s]=k.useState(!1),o=e??a,l=t??s,[u,f]=k.useState(""),[d,p]=k.useState(0),m=k.useRef(null),y=k.useRef(null),S=Wi(),g=k.useMemo(()=>[{id:"goto-tasks",label:i("commandPalette.commands.goToTasks"),shortcut:"meta+1",keywords:["kanban","board","home"],category:"navigation",icon:b.jsx(fe,{icon:Dp,size:16,strokeWidth:2}),action:()=>{S({to:"/tasks"}),l(!1)}},{id:"goto-terminals",label:i("commandPalette.commands.goToTerminals"),shortcut:"meta+2",keywords:["shell","console","cli"],category:"navigation",icon:b.jsx(fe,{icon:x1e,size:16,strokeWidth:2}),action:()=>{S({to:"/terminals"}),l(!1)}},{id:"goto-task-terminals",label:i("commandPalette.commands.goToTaskTerminals"),shortcut:"meta+i",keywords:["tasks","shell","console","cli"],category:"navigation",icon:b.jsx(fe,{icon:Dp,size:16,strokeWidth:2}),action:()=>{S({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:b.jsx(fe,{icon:R1e,size:16,strokeWidth:2}),action:()=>{S({to:"/worktrees"}),l(!1)}},{id:"goto-repositories",label:i("commandPalette.commands.goToRepositories"),shortcut:"meta+4",keywords:["repos","git","projects"],category:"navigation",icon:b.jsx(fe,{icon:T1e,size:16,strokeWidth:2}),action:()=>{S({to:"/repositories"}),l(!1)}},{id:"goto-settings",label:i("commandPalette.commands.goToSettings"),shortcut:"meta+,",keywords:["preferences","config","configuration"],category:"navigation",icon:b.jsx(fe,{icon:cte,size:16,strokeWidth:2}),action:()=>{S({to:"/settings"}),l(!1)}},{id:"new-task",label:i("commandPalette.commands.newTask"),shortcut:"meta+j",keywords:["create","add"],category:"actions",icon:b.jsx(fe,{icon:Ev,size:16,strokeWidth:2}),action:()=>{l(!1),n?.()}},{id:"show-shortcuts",label:i("commandPalette.commands.keyboardShortcuts"),shortcut:"meta+/",keywords:["help","hotkeys","keys"],category:"actions",icon:b.jsx(fe,{icon:ste,size:16,strokeWidth:2}),action:()=>{l(!1),r?.()}}],[S,n,r,l,i]),_=k.useMemo(()=>U2e(g,u),[g,u]),v=k.useMemo(()=>$2e(_),[_]),x=k.useMemo(()=>{const C=[],R=["navigation","actions"];for(const O of R){const N=v.get(O);N&&C.push(...N)}return C},[v]);k.useEffect(()=>{p(0)},[u]),k.useEffect(()=>{if(!y.current)return;const C=y.current.querySelector('[data-selected="true"]');C&&C.scrollIntoView({block:"nearest"})},[d]),Es("meta+k",()=>l(!0),{allowInInput:!0,allowInTerminal:!0}),Es("meta+1",()=>S({to:"/tasks"}),{allowInInput:!0,allowInTerminal:!0}),Es("meta+2",()=>S({to:"/terminals"}),{allowInInput:!0,allowInTerminal:!0}),Es("meta+i",()=>{S({to:"/terminals",search:{tab:"all-tasks"}})},{allowInInput:!0,allowInTerminal:!0}),Es("meta+3",()=>S({to:"/worktrees"}),{allowInInput:!0,allowInTerminal:!0}),Es("meta+4",()=>S({to:"/repositories"}),{allowInInput:!0,allowInTerminal:!0}),Es("meta+,",()=>S({to:"/settings"}),{allowInInput:!0,allowInTerminal:!0}),Es("meta+j",()=>{n?.()},{allowInInput:!1,deps:[n]}),Es("meta+/",()=>{r?.()},{allowInInput:!0,allowInTerminal:!0,deps:[r]});const T=k.useCallback(C=>{switch(C.key){case"ArrowDown":C.preventDefault(),p(R=>Math.min(R+1,x.length-1));break;case"ArrowUp":C.preventDefault(),p(R=>Math.max(R-1,0));break;case"Enter":C.preventDefault(),x[d]&&x[d].action();break;case"Escape":C.preventDefault(),l(!1);break}},[x,d,l]);k.useEffect(()=>{o&&(f(""),p(0),setTimeout(()=>m.current?.focus(),50))},[o]);let w=0;return b.jsx(ku,{open:o,onOpenChange:l,children:b.jsxs(Ou,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden",showCloseButton:!1,onKeyDown:T,children:[b.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[b.jsx("span",{className:"text-muted-foreground mr-2",children:">"}),b.jsx(vn,{ref:m,value:u,onChange:C=>f(C.target.value),placeholder:i("commandPalette.placeholder"),className:"border-0 ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 px-0 h-12"}),b.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"})]}),b.jsx("div",{ref:y,className:"max-h-80 overflow-y-auto p-2",children:_.length===0?b.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:i("commandPalette.noResults")}):b.jsx(b.Fragment,{children:["navigation","actions"].map(C=>{const R=v.get(C);return!R||R.length===0?null:b.jsxs("div",{className:"mb-2 last:mb-0",children:[b.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:i(`commandPalette.categories.${C}`)}),R.map(O=>{const N=w++,L=N===d;return b.jsxs("button",{"data-selected":L,onClick:()=>O.action(),onMouseEnter:()=>p(N),className:Ue("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm",L?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[O.icon&&b.jsx("span",{className:"text-muted-foreground",children:O.icon}),b.jsx("span",{className:"flex-1 text-left",children:O.label}),O.shortcut&&b.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:pte(O.shortcut)})]},O.id)})]},C)})})})]})})}const qz={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 H2e({className:e,rows:t=100,cols:n=10,tileClassName:r,tileSize:i="md"}){return b.jsx("div",{className:Ue("relative z-0 flex w-full h-full justify-center",e),children:Array.from({length:t}).map((a,s)=>b.jsx("div",{className:Ue(qz[i],"border-l dark:border-neutral-900 border-neutral-200 relative",r),children:Array.from({length:n}).map((o,l)=>b.jsx("div",{className:Ue(qz[i],"border-r border-t dark:border-neutral-900 border-neutral-200 relative hover:bg-tile transition-colors",r)},`col-${l}`))},`row-${s}`))})}const W2e=["/","/tasks","/terminals","/worktrees","/repositories","/review","/monitoring","/settings"];function V2e(){const e=ti({select:n=>n.location.pathname});return W2e.some(n=>e===n||e.startsWith(n+"/"))?b.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none -z-10",children:b.jsx(H2e,{rows:100,cols:50,tileSize:"sm"})}):null}if(!k.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!_re)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function G2e(e){e()}function q2e(e){e||(e=G2e),bke({reactionScheduler:e})}function K2e(e){return yke(e)}var Y2e=1e4,X2e=1e4,Z2e=(function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=Y2e),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var i=Date.now();n.registrations.forEach(function(a,s){i-a.registeredAt>=r&&(n.finalize(a.value),n.registrations.delete(s))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){this.registrations.set(r,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,X2e))}}),e})(),Q2e=typeof FinalizationRegistry<"u"?FinalizationRegistry:Z2e,pD=new Q2e(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null});function Kz(e){e.reaction=new ll("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function J2e(e,t){t===void 0&&(t="observed");var n=oe.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(o){return pD.unregister(r),r.onStoreChange=o,r.reaction||(Kz(r),r.stateVersion=Symbol()),function(){var l;r.onStoreChange=null,(l=r.reaction)===null||l===void 0||l.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var i=n.current;i.reaction||(Kz(i),pD.register(n,i,i)),oe.useDebugValue(i.reaction,K2e),OP.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot);var a,s;if(i.reaction.track(function(){try{a=e()}catch(o){s=o}}),s)throw s;return a}var xk,wk,die=typeof Symbol=="function"&&Symbol.for,eRe=(wk=(xk=Object.getOwnPropertyDescriptor(function(){},"name"))===null||xk===void 0?void 0:xk.configurable)!==null&&wk!==void 0?wk:!1,Yz=die?Symbol.for("react.forward_ref"):typeof k.forwardRef=="function"&&k.forwardRef(function(e){return null}).$$typeof,Xz=die?Symbol.for("react.memo"):typeof k.memo=="function"&&k.memo(function(e){return null}).$$typeof;function n0(e,t){var n;if(Xz&&e.$$typeof===Xz)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=(n=void 0)!==null&&n!==void 0?n:!1,i=e,a=e.displayName||e.name;if(Yz&&e.$$typeof===Yz&&(r=!0,i=e.render,typeof i!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var s=function(o,l){return J2e(function(){return i(o,l)},a)};return s.displayName=e.displayName,eRe&&Object.defineProperty(s,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(s.contextTypes=e.contextTypes),r&&(s=k.forwardRef(s)),s=k.memo(s),nRe(e,s),s}var tRe={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function nRe(e,t){Object.keys(e).forEach(function(n){tRe[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Tk;q2e(xr.unstable_batchedUpdates);Tk=pD.finalizeAllImmediately;const rRe=n0(function(){const t=Mm();if(t.connected||!t.hasEverConnected)return null;const n=t.reconnectAttempt>0&&t.reconnectAttempt<t.maxReconnectAttempts,r=t.reconnectAttempt>=t.maxReconnectAttempts;return b.jsx("div",{className:Ue("flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium","border-b",r?"bg-destructive/10 border-destructive/30 text-destructive":"bg-amber-500/10 border-amber-500/30 text-amber-600 dark:text-amber-400"),role:"alert","aria-live":"polite",children:r?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:ts,size:16,strokeWidth:2}),b.jsx("span",{children:"Connection lost. Please check if the server is running."})]}):n?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:en,size:16,strokeWidth:2,className:"animate-spin"}),b.jsxs("span",{children:["Reconnecting... (attempt ",t.reconnectAttempt,"/",t.maxReconnectAttempts,")"]})]}):b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:ts,size:16,strokeWidth:2}),b.jsx("span",{children:"Disconnected from server"})]})})});function iRe(){return qn({queryKey:["system","dependencies"],queryFn:()=>$t("/api/system/dependencies"),staleTime:30*1e3,refetchOnWindowFocus:!0})}const Zz="npm install -g @anthropic/claude-code",aRe="https://docs.anthropic.com/en/docs/claude-code/overview";function sRe(){const{data:e,isLoading:t}=iRe(),[n,r]=k.useState(!1),[i,a]=k.useState(!1),s=k.useCallback(async()=>{try{await navigator.clipboard.writeText(Zz),a(!0),setTimeout(()=>a(!1),2e3)}catch{}},[]),o=k.useCallback(()=>{r(!0)},[]);return t||n||e?.claudeCode?.installed?null:b.jsxs("div",{className:Ue("flex items-center justify-between gap-4 px-4 py-3","border-b bg-amber-500/10 border-amber-500/30"),role:"alert",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx(fe,{icon:ts,size:18,strokeWidth:2,className:"shrink-0 text-amber-600 dark:text-amber-400"}),b.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-4",children:[b.jsx("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:"Claude Code CLI not found"}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("code",{className:"rounded bg-amber-500/20 px-2 py-0.5 text-xs font-mono text-amber-700 dark:text-amber-300",children:Zz}),b.jsx("button",{onClick:s,className:Ue("p-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),title:i?"Copied!":"Copy to clipboard",children:b.jsx(fe,{icon:i?hl:w1e,size:14,strokeWidth:2})})]})]})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("a",{href:aRe,target:"_blank",rel:"noopener noreferrer",className:Ue("text-xs font-medium px-2 py-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),children:"View Docs"}),b.jsx("button",{onClick:o,className:Ue("p-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),title:"Dismiss",children:b.jsx(fe,{icon:ci,size:16,strokeWidth:2})})]})]})}const oRe=[{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 lRe({open:e,onOpenChange:t}){const{t:n}=tn("navigation");return b.jsx(ku,{open:e,onOpenChange:t,children:b.jsxs(Ou,{className:"sm:max-w-md",children:[b.jsx(Jc,{children:b.jsx(ed,{children:n("shortcuts.title")})}),b.jsx("div",{className:"space-y-4 mt-2",children:oRe.map(r=>b.jsxs("div",{children:[b.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:n(`shortcuts.groups.${r.titleKey}`)}),b.jsx("div",{className:"space-y-1",children:r.items.map(i=>b.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[b.jsx("span",{className:"text-sm",children:n(`shortcuts.labels.${i.labelKey}`)}),b.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:pte(i.shortcut)})]},i.shortcut))})]},r.titleKey))})]})})}const uRe=({...e})=>{const{resolvedTheme:t}=qc();return b.jsx(w_e,{theme:t,className:"toaster group",icons:{success:b.jsx(fe,{icon:nte,strokeWidth:2,className:"size-4"}),info:b.jsx(fe,{icon:L1e,strokeWidth:2,className:"size-4"}),warning:b.jsx(fe,{icon:ts,strokeWidth:2,className:"size-4"}),error:b.jsx(fe,{icon:B1e,strokeWidth:2,className:"size-4"}),loading:b.jsx(fe,{icon:en,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})},Oo=Kpe({component:mRe});function cRe(){return Ewe(),null}function dRe(){return Rne(),null}function fRe(){return uie(),null}function hRe(){const e=ti({select:n=>n.location}),{updateViewTracking:t}=cie();return k.useEffect(()=>{const n=e.pathname;let r="other",i=null,a=null;n.startsWith("/tasks/")?(r="task-detail",i=n.split("/")[2]||null):n==="/terminals"&&(r="terminals",a=new URLSearchParams(e.search).get("tab")),t(r,i,a)},[e.pathname,e.search,t]),null}function pRe(){const e=ti({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 mRe(){const[e,t]=k.useState(null),[n,r]=k.useState(!1),[i,a]=k.useState(!1),s=typeof window<"u"&&window.parent!==window,o=k.useCallback(d=>{t(()=>d)},[]),l=k.useCallback(()=>{e?.()},[e]),u=k.useCallback(()=>{r(!0)},[]),f=k.useCallback(()=>{a(!0)},[]);return b.jsx(k_e,{children:b.jsxs("div",{className:"flex h-screen flex-col overflow-x-hidden bg-background text-foreground",children:[b.jsx(cRe,{}),b.jsx(dRe,{}),b.jsx(fRe,{}),b.jsx(hRe,{}),b.jsx(pRe,{}),b.jsx(rRe,{}),b.jsx(sRe,{}),b.jsx(bwe,{onNewTaskRef:o,onOpenCommandPalette:f}),b.jsxs("main",{className:"isolate flex-1 overflow-hidden relative",children:[b.jsx(V2e,{}),b.jsx(tJ,{})]}),b.jsx(z2e,{open:i,onOpenChange:a,onNewTask:l,onShowShortcuts:u}),b.jsx(lRe,{open:n,onOpenChange:r}),b.jsx(uRe,{position:s?"bottom-center":"bottom-right"})]})})}const gRe=Ms("/")({beforeLoad:()=>{throw BQ({to:"/tasks"})}}),mD="";function fie(){const[e,t]=k.useState(new Map),[n,r]=k.useState(null),[i,a]=k.useState(!0),[s,o]=k.useState(!1),[l,u]=k.useState(null),f=k.useRef(null),d=k.useRef(0),p=k.useRef(!1),m=k.useCallback(async()=>{a(!0),u(null);try{const g=await fetch(`${mD}/api/worktrees/json`);if(!g.ok)throw new Error("Failed to fetch worktrees");const _=await g.json();t(new Map(_.worktrees.map(v=>[v.path,{...v,size:v.size||0,sizeFormatted:v.sizeFormatted||"0 B",branch:v.branch||"unknown"}]))),r(_.summary),a(!1),o(!1)}catch(g){u(g instanceof Error?g:new Error("Failed to load worktrees")),a(!1),o(!1)}},[]),y=k.useCallback(()=>{if(p.current){m();return}f.current?.close(),a(!0),o(!1),u(null),t(new Map),r(null);const g=new EventSource(`${mD}/api/worktrees`);f.current=g,g.addEventListener("worktree:basic",_=>{const v=JSON.parse(_.data);d.current=v.length,t(new Map(v.map(x=>[x.path,{...x,size:0,sizeFormatted:"...",branch:"..."}]))),a(!1),o(v.length>0)}),g.addEventListener("worktree:details",_=>{const v=JSON.parse(_.data);t(x=>{const T=new Map(x),w=T.get(v.path);return w&&T.set(v.path,{...w,size:v.size,sizeFormatted:v.sizeFormatted,branch:v.branch}),T}),d.current--,d.current<=0&&o(!1)}),g.addEventListener("worktree:complete",_=>{const v=JSON.parse(_.data);r(v),o(!1),g.close()}),g.addEventListener("worktree:error",_=>{const{path:v}=JSON.parse(_.data);kt.viewer.error("Error loading worktree details",{path:v}),d.current--,d.current<=0&&o(!1)}),g.onerror=()=>{g.close(),kt.viewer.info("SSE connection failed, trying JSON fallback"),p.current=!0,m()}},[m]);return k.useEffect(()=>(y(),()=>{f.current?.close()}),[y]),{worktrees:k.useMemo(()=>Array.from(e.values()).sort((_,v)=>_.isOrphaned!==v.isOrphaned?_.isOrphaned?-1:1:new Date(v.lastModified).getTime()-new Date(_.lastModified).getTime()),[e]),summary:n,isLoading:i,isLoadingDetails:s,error:l,refetch:y}}function hie(){const e=wr();return zn({mutationFn:({worktreePath:t,repoPath:n,deleteLinkedTask:r})=>$t(`${mD}/api/worktrees`,{method:"DELETE",body:JSON.stringify({worktreePath:t,repoPath:n,deleteLinkedTask:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worktrees"]}),e.invalidateQueries({queryKey:["tasks"]})}})}const bRe=Yc("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 co({className:e,variant:t="default",render:n,...r}){return wxe({defaultTagName:"span",props:sl({className:Ue(bRe({className:e,variant:t}))},r),render:n,state:{slot:"badge",variant:t}})}function xa({className:e,size:t="default",...n}){return b.jsx("div",{"data-slot":"card","data-size":t,className:Ue("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-lg py-4 text-xs/relaxed ring-1 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg group/card flex flex-col",e),...n})}function vRe({className:e,...t}){return b.jsx("div",{"data-slot":"card-header",className:Ue("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 yRe({className:e,...t}){return b.jsx("div",{"data-slot":"card-title",className:Ue("text-sm font-medium",e),...t})}function Df({className:e,...t}){return b.jsx("div",{"data-slot":"card-content",className:Ue("px-4 group-data-[size=sm]/card:px-3",e),...t})}function go({...e}){return b.jsx(BEe,{"data-slot":"alert-dialog",...e})}function bo({...e}){return b.jsx(wte,{"data-slot":"alert-dialog-trigger",...e})}function _Re({...e}){return b.jsx(_te,{"data-slot":"alert-dialog-portal",...e})}function ERe({className:e,...t}){return b.jsx(gte,{"data-slot":"alert-dialog-overlay",className:Ue("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 vo({className:e,size:t="default",...n}){return b.jsxs(_Re,{children:[b.jsx(ERe,{}),b.jsx(yte,{"data-slot":"alert-dialog-content","data-size":t,className:Ue("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-3 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",e),...n})]})}function yo({className:e,...t}){return b.jsx("div",{"data-slot":"alert-dialog-header",className:Ue("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 _o({className:e,...t}){return b.jsx("div",{"data-slot":"alert-dialog-footer",className:Ue("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 Eo({className:e,...t}){return b.jsx(xte,{"data-slot":"alert-dialog-title",className:Ue("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 So({className:e,...t}){return b.jsx(bte,{"data-slot":"alert-dialog-description",className:Ue("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...t})}function Rv({className:e,...t}){return b.jsx(Ke,{"data-slot":"alert-dialog-action",className:Ue(e),...t})}function xo({className:e,variant:t="outline",size:n="default",...r}){return b.jsx(qx,{"data-slot":"alert-dialog-cancel",className:Ue(e),render:b.jsx(Ke,{variant:t,size:n}),...r})}const Ti=k.forwardRef(({className:e,...t},n)=>b.jsx(pSe,{ref:n,className:Ue("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:b.jsx(mSe,{className:"flex items-center justify-center",children:b.jsx(fe,{icon:hl,size:12,strokeWidth:3})})}));Ti.displayName="Checkbox";const gD={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"},SRe=Ms("/worktrees/")({component:CRe});function xRe(){const{t:e}=tn("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),s=Math.floor(a/60),o=Math.floor(s/60),l=Math.floor(o/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):o>0?o===1?e("time.hourAgo"):e("time.hoursAgo",{count:o}):s>0?s===1?e("time.minuteAgo"):e("time.minutesAgo",{count:s}):e("time.justNow")}}function Qz({className:e}){return b.jsx("span",{className:`inline-block animate-pulse rounded bg-muted ${e}`})}function wRe({worktree:e,onDelete:t}){const{t:n}=tn("common"),{t:r}=tn("worktrees"),i=xRe(),[a,s]=k.useState(!1),[o,l]=k.useState(!1),[u,f]=k.useState(!1),d=e.sizeFormatted==="..."||e.branch==="...",p=!e.isOrphaned&&e.taskId,m=async()=>{l(!0);try{await t(e,u),s(!1)}catch{}finally{l(!1)}},y=S=>{s(S),S||f(!1)};return b.jsx(xa,{className:"transition-colors hover:border-border/80",children:b.jsxs(Df,{className:"flex items-start justify-between gap-4 py-4",children:[b.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"truncate font-medium",children:e.name}),e.isOrphaned?b.jsx(co,{className:Ue("shrink-0",gD.ORPHANED),children:n("statuses.ORPHANED")}):e.taskStatus?b.jsx(co,{className:Ue("shrink-0",gD[e.taskStatus]),children:n(`statuses.${e.taskStatus}`)}):null]}),b.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Hi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:e.path})]}),b.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vx,size:12,strokeWidth:2,className:"shrink-0"}),e.branch==="..."?b.jsx(Qz,{className:"h-3 w-16"}):b.jsx("span",{className:"font-mono",children:e.branch})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:ate,size:12,strokeWidth:2,className:"shrink-0"}),e.sizeFormatted==="..."?b.jsx(Qz,{className:"h-3 w-12"}):b.jsx("span",{children:e.sizeFormatted})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:tte,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{children:i(e.lastModified)})]})]}),e.taskId&&e.taskTitle&&b.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:b.jsxs(wi,{to:"/tasks/$taskId",params:{taskId:e.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[b.jsx("span",{className:"truncate",children:e.taskTitle}),b.jsx(fe,{icon:$y,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),b.jsxs(go,{open:a,onOpenChange:y,children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:d}),children:b.jsx(fe,{icon:$c,size:14,strokeWidth:2})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:r("delete.title")}),b.jsxs(So,{children:[r("delete.description")," ",b.jsx("span",{className:"font-mono",children:e.name}),".",u&&p&&b.jsxs(b.Fragment,{children:[" ",r("delete.linkedTaskWillBeDeleted",{title:e.taskTitle})]})," ",r("delete.cannotUndo")]}),p&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:u,onCheckedChange:S=>f(S===!0),disabled:o}),r("delete.alsoDeleteLinkedTask",{title:e.taskTitle})]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:o,children:n("buttons.cancel")}),b.jsxs(Ke,{variant:"destructive",onClick:m,disabled:o,className:"gap-2",children:[o&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),n(o?"status.deleting":"buttons.delete")]})]})]})]})]})})}const TRe=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function CRe(){const{t:e}=tn("common"),{t}=tn("worktrees"),{worktrees:n,summary:r,isLoading:i,isLoadingDetails:a,error:s,refetch:o}=fie(),l=hie(),[u,f]=k.useState(new Set),[d,p]=k.useState(!1),[m,y]=k.useState(!1),[S,g]=k.useState(!1),_=O=>{f(N=>{const L=new Set(N);return L.has(O)?L.delete(O):L.add(O),L})},v=()=>{f(new Set)},x=k.useMemo(()=>u.size===0?n:n.filter(O=>!!(O.isOrphaned&&u.has("ORPHANED")||O.taskStatus&&u.has(O.taskStatus))),[n,u]),T=k.useMemo(()=>n.filter(O=>O.taskStatus==="DONE"||O.taskStatus==="CANCELED"),[n]),w=async()=>{if(T.length!==0){y(!0);try{for(const O of T)await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:S});p(!1),o()}catch{}finally{y(!1)}}},C=O=>{p(O),O||g(!1)},R=async(O,N)=>{await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:N}),o()};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsx("h1",{className:"text-sm font-medium",children:t("title")}),(r||n.length>0)&&b.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[b.jsx("span",{children:t("summary.total",{count:r?.total??n.length})}),(r?.orphaned??n.filter(O=>O.isOrphaned).length)>0&&b.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:r?.orphaned??n.filter(O=>O.isOrphaned).length})}),a?b.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):r?b.jsx("span",{children:r.totalSizeFormatted}):null]})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[T.length>0&&b.jsxs(go,{open:d,onOpenChange:C,children:[b.jsxs(bo,{render:b.jsx(Ke,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:a}),children:[b.jsx(fe,{icon:rte,size:12,strokeWidth:2}),t("cleanup.button",{count:T.length})]}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:t("cleanup.title")}),b.jsxs(So,{children:[t("cleanup.description",{count:T.length}),S&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("p",{className:"text-sm text-muted-foreground",children:[T.filter(O=>O.taskStatus==="DONE").length>0&&b.jsxs("span",{className:"mr-3",children:[b.jsx("span",{className:"font-medium text-accent",children:T.filter(O=>O.taskStatus==="DONE").length})," ",t("cleanup.done")]}),T.filter(O=>O.taskStatus==="CANCELED").length>0&&b.jsxs("span",{children:[b.jsx("span",{className:"font-medium text-destructive",children:T.filter(O=>O.taskStatus==="CANCELED").length})," ",t("cleanup.canceled")]})]}),b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:S,onCheckedChange:O=>g(O===!0),disabled:m}),t("cleanup.alsoDeleteLinkedTasks")]}),b.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:m,children:e("buttons.cancel")}),b.jsxs(Ke,{variant:"destructive",onClick:w,disabled:m,className:"gap-2",children:[m&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),m?e("status.deleting"):t("delete.button",{count:T.length})]})]})]})]}),u.size>0&&b.jsxs(Ke,{variant:"ghost",size:"sm",onClick:v,className:"gap-1.5 text-xs",children:[b.jsx(fe,{icon:ci,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),b.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:TRe.map(O=>{const N=u.has(O);return b.jsx("button",{onClick:()=>_(O),className:Ue("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",N?gD[O]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${O}`)},O)})})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),s&&b.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[b.jsx(fe,{icon:ts,size:20,strokeWidth:2}),b.jsx("span",{className:"text-sm",children:t("error.failedToLoad",{message:s.message})})]}),!i&&!s&&x.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:u.size>0?t("empty.noMatch"):t("empty.noWorktrees")})}),!i&&b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:x.map(O=>b.jsx(wRe,{worktree:O,onDelete:R},O.path))})]})]})}function Wn(e,t="Assertion error"){if(!e)throw Error(t)}function zp({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function bD(e,t){return t.sort(e==="horizontal"?ARe:kRe)}function ARe(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function kRe(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function pie(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 ORe({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,a=Number.MAX_VALUE;for(const s of t){const{x:o,y:l}=pie(r,s),u=e==="horizontal"?o:l;u<a&&(a=u,i=s)}return Wn(i,"No rect found"),i}function mie(e){const{element:t,orientation:n,panels:r,separators:i}=e,a=bD(n,Array.from(t.children).filter(f=>f instanceof HTMLElement).map(f=>({element:f}))).map(({element:f})=>f),s=[];let o=!1,l,u=[];for(const f of a)if(f.hasAttribute("data-panel")){const d=r.find(p=>p.element===f);if(d){if(l){const p=l.element.getBoundingClientRect(),m=f.getBoundingClientRect();let y;if(o){const S=n==="horizontal"?new DOMRect(p.right,p.top,0,p.height):new DOMRect(p.left,p.bottom,p.width,0),g=n==="horizontal"?new DOMRect(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(u.length){case 0:{y=[S,g];break}case 1:{const _=u[0],v=ORe({orientation:n,rects:[p,m],targetRect:_.element.getBoundingClientRect()});y=[_,v===p?g:S];break}default:{y=u;break}}}else u.length?y=u:y=[n==="horizontal"?new DOMRect(p.right,m.top,m.left-p.right,m.height):new DOMRect(m.left,p.bottom,m.width,m.top-p.bottom)];for(const S of y)s.push({group:e,groupSize:zp({group:e}),panels:[l,d],separator:"width"in S?void 0:S,rect:"width"in S?S:S.element.getBoundingClientRect()})}o=!1,l=d,u=[]}}else if(f.hasAttribute("data-separator")){const d=i.find(p=>p.element===f);d?u.push(d):(l=void 0,u=[])}else o=!0;return s}function RRe(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function NRe(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function IRe(e){return e/100*window.innerHeight}function DRe(e){return e/100*window.innerWidth}function LRe(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 E_({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,a]=LRe(n);switch(a){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=NRe(t,i);break}case"em":{r=RRe(t,i);break}case"vh":{r=IRe(i);break}case"vw":{r=DRe(i);break}}return r}function ao(e){return parseFloat(e.toFixed(3))}function Jz(e){const{panels:t}=e,n=zp({group:e});return n===0?t.map(r=>({collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:i,panelConstraints:a}=r;let s=0;if(a.collapsedSize){const f=E_({groupSize:n,panelElement:i,styleProp:a.collapsedSize});s=ao(f/n*100)}let o;if(a.defaultSize){const f=E_({groupSize:n,panelElement:i,styleProp:a.defaultSize});o=ao(f/n*100)}let l=0;if(a.minSize){const f=E_({groupSize:n,panelElement:i,styleProp:a.minSize});l=ao(f/n*100)}let u=100;if(a.maxSize){const f=E_({groupSize:n,panelElement:i,styleProp:a.maxSize});u=ao(f/n*100)}return{collapsedSize:s,collapsible:a.collapsible===!0,defaultSize:o,minSize:l,maxSize:u,panelId:r.id}})}class PRe{#e={};addListener(t,n){const r=this.#e[t];return r===void 0?this.#e[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=this.#e[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let i=!1,a=null;const s=Array.from(r);for(let o=0;o<s.length;o++){const l=s[o];try{l.call(null,n)}catch(u){a===null&&(i=!0,a=u)}}if(i)throw a}}removeAllListeners(){this.#e={}}removeListener(t,n){const r=this.#e[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}function Qi(e,t,n=0){return Math.abs(ao(e)-ao(t))<=n}let ys={cursorFlags:0,interactionState:{state:"inactive"},mountedGroups:new Map};const vf=new PRe;function bl(){return ys}function Ds(e){const t=typeof e=="function"?e(ys):e;if(ys===t)return ys;const n=ys;return ys={...ys,...t},t.cursorFlags!==void 0&&vf.emit("cursorFlagsChange",ys.cursorFlags),t.interactionState!==void 0&&vf.emit("interactionStateChange",ys.interactionState),t.mountedGroups!==void 0&&(ys.mountedGroups.forEach((r,i)=>{r.derivedPanelConstraints.forEach(a=>{if(a.collapsible){const{layout:s}=n.mountedGroups.get(i)??{};if(s){const o=Qi(a.collapsedSize,r.layout[a.panelId]),l=Qi(a.collapsedSize,s[a.panelId]);o&&!l&&(i.inMemoryLastExpandedPanelSizes[a.panelId]=s[a.panelId])}}})}),vf.emit("mountedGroupsChange",ys.mountedGroups)),ys}const MRe=e=>e,Ck=()=>{},gie=1,bie=2,vie=4,yie=8,eH={coarse:10,precise:5};function jRe({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(a=>{if(!a.disableCursor)switch(a.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(r===0&&i===0)return null;switch(n){case"active":{const a=(e&gie)!==0,s=(e&bie)!==0,o=(e&vie)!==0,l=(e&yie)!==0;if(e){if(a)return o?"se-resize":l?"ne-resize":"e-resize";if(s)return o?"sw-resize":l?"nw-resize":"w-resize";if(o)return"s-resize";if(l)return"n-resize"}break}}return r>0&&i>0?"move":r>0?"ew-resize":"ns-resize"}let Ak,Fo;function ZM(){Fo===void 0&&(Fo=new CSSStyleSheet,document.adoptedStyleSheets=[Fo]);const{cursorFlags:e,interactionState:t}=bl();switch(t.state){case"active":case"hover":{const n=jRe({cursorFlags:e,groups:t.hitRegions.map(i=>i.group),state:t.state}),r=`*{cursor: ${n} !important; ${t.state==="active"?"touch-action: none;":""} }`;if(Ak===r)return;Ak=r,n?Fo.cssRules.length===0?Fo.insertRule(r):Fo.replaceSync(r):Fo.cssRules.length===1&&Fo.deleteRule(0);break}case"inactive":{Ak=void 0,Fo.cssRules.length===1&&Fo.deleteRule(0);break}}}function FRe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Nv(e,t){return Qi(e,t)?0:e>t?1:-1}function sp({panelConstraints:e,size:t}){const{collapsedSize:n=0,collapsible:r,maxSize:i=100,minSize:a=0}=e;if(Nv(t,a)<0)if(r){const s=(n+a)/2;Nv(t,s)<0?t=n:t=a}else t=a;return t=Math.min(i,t),t=ao(t),t}function Iv({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Qi(e,0))return t;const s=Object.values(t),o=Object.values(i),l=[...s],[u,f]=r;Wn(u!=null,"Invalid first pivot index"),Wn(f!=null,"Invalid second pivot index");let d=0;if(a==="keyboard"){{const y=e<0?f:u,S=n[y];Wn(S,`Panel constraints not found for index ${y}`);const{collapsedSize:g=0,collapsible:_,minSize:v=0}=S;if(_){const x=s[y];if(Wn(x!=null,`Previous layout not found for panel index ${y}`),Qi(x,g)){const T=v-x;Nv(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}{const y=e<0?u:f,S=n[y];Wn(S,`No panel constraints found for index ${y}`);const{collapsedSize:g=0,collapsible:_,minSize:v=0}=S;if(_){const x=s[y];if(Wn(x!=null,`Previous layout not found for panel index ${y}`),Qi(x,v)){const T=x-g;Nv(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}}{const y=e<0?1:-1;let S=e<0?f:u,g=0;for(;;){const v=s[S];Wn(v!=null,`Previous layout not found for panel index ${S}`);const x=sp({panelConstraints:n[S],size:100})-v;if(g+=x,S+=y,S<0||S>=n.length)break}const _=Math.min(Math.abs(e),Math.abs(g));e=e<0?0-_:_}{let y=e<0?u:f;for(;y>=0&&y<n.length;){const S=Math.abs(e)-Math.abs(d),g=s[y];Wn(g!=null,`Previous layout not found for panel index ${y}`);const _=g-S,v=sp({panelConstraints:n[y],size:_});if(!Qi(g,v)&&(d+=g-v,l[y]=v,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?y--:y++}}if(FRe(o,l))return i;{const y=e<0?f:u,S=s[y];Wn(S!=null,`Previous layout not found for panel index ${y}`);const g=S+d,_=sp({panelConstraints:n[y],size:g});if(l[y]=_,!Qi(_,g)){let v=g-_,x=e<0?f:u;for(;x>=0&&x<n.length;){const T=l[x];Wn(T!=null,`Previous layout not found for panel index ${x}`);const w=T+v,C=sp({panelConstraints:n[x],size:w});if(Qi(T,C)||(v-=C-T,l[x]=C),Qi(v,0))break;e>0?x--:x++}}}const p=Object.values(l).reduce((y,S)=>S+y,0);if(!Qi(p,100,.1))return i;const m=Object.keys(i);return l.reduce((y,S,g)=>(y[m[g]]=S,y),{})}function jm(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Nv(e[n],t[n])!==0)return!1;return!0}function _ie({event:e,hitRegions:t,initialLayoutMap:n,mountedGroups:r,pointerDownAtPoint:i}){let a=0;const s=new Map(r);t.forEach(o=>{const{group:l,groupSize:u}=o,{disableCursor:f,orientation:d,panels:p}=l;let m=0;i?d==="horizontal"?m=(e.clientX-i.x)/u*100:m=(e.clientY-i.y)/u*100:d==="horizontal"?m=e.clientX<0?-100:100:m=e.clientY<0?-100:100;const y=n.get(l),{defaultLayoutDeferred:S,derivedPanelConstraints:g,layout:_,separatorToPanels:v}=r.get(l)??{defaultLayoutDeferred:!1};if(g&&y&&_&&v){const x=Iv({delta:m,initialLayout:y,panelConstraints:g,pivotIndices:o.panels.map(T=>p.indexOf(T)),prevLayout:_,trigger:"mouse-or-touch"});if(jm(x,_)){if(m!==0&&!f)switch(d){case"horizontal":{a|=m<0?gie:bie;break}case"vertical":{a|=m<0?vie:yie;break}}}else{s.set(o.group,{defaultLayoutDeferred:S,derivedPanelConstraints:g,layout:x,separatorToPanels:v});const T=o.group.panels.map(({id:w})=>w).join(",");o.group.inMemoryLayouts[T]=x}}}),Ds({cursorFlags:a,mountedGroups:s}),ZM()}function tH(e){if(e.defaultPrevented||e.relatedTarget!==null||e.clientX===0&&e.clientY===0)return;const{interactionState:t,mountedGroups:n}=bl();t.state==="active"&&t.hitRegions.forEach(r=>{e.currentTarget===r.group.element&&_ie({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n})})}function lE(e){const t=e.parentElement;Wn(t,"Parent group element not found");const{mountedGroups:n}=bl();for(const[r]of n)if(r.element===t)return r;throw Error("Could not find parent Group for separator element")}function Lf({layout:e,panelConstraints:t}){const n=[...Object.values(e)],r=n.reduce((s,o)=>s+o,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!Qi(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=100/r*o;n[s]=l}let i=0;for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=sp({panelConstraints:t[s],size:o});o!=l&&(i+=o-l,n[s]=l)}if(!Qi(i,0))for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=o+i,u=sp({panelConstraints:t[s],size:l});if(o!==u&&(i-=u-o,n[s]=u,Qi(i,0)))break}const a=Object.keys(e);return n.reduce((s,o,l)=>(s[a[l]]=o,s),{})}function Eie({groupId:e}){const t=()=>{const{mountedGroups:n}=bl();for(const[r,i]of n)if(r.id===e)return{group:r,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:a,layout:s,separatorToPanels:o}=t(),l=Lf({layout:n,panelConstraints:i});return r?s:(jm(s,l)||Ds(u=>({mountedGroups:new Map(u.mountedGroups).set(a,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:l,separatorToPanels:o})})),l)}}}function Sie(e){const{mountedGroups:t}=bl(),n=t.get(e);return Wn(n,`Mounted Group ${e.id} not found`),n}function Pd(e,t){const n=lE(e),r=Sie(n),i=n.separators.find(f=>f.element===e);Wn(i,"Matching separator not found");const a=r.separatorToPanels.get(i);Wn(a,"Matching panels not found");const s=a.map(f=>n.panels.indexOf(f)),o=Eie({groupId:n.id}).getLayout(),l=Iv({delta:t,initialLayout:o,panelConstraints:r.derivedPanelConstraints,pivotIndices:s,prevLayout:o,trigger:"keyboard"}),u=Lf({layout:l,panelConstraints:r.derivedPanelConstraints});jm(o,u)||Ds(f=>({mountedGroups:new Map(f.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:u,separatorToPanels:r.separatorToPanels})}))}function nH(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=lE(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Pd(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Pd(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Pd(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Pd(t,-5);break}case"End":{e.preventDefault(),Pd(t,100);break}case"Enter":{e.preventDefault();const r=lE(t),{derivedPanelConstraints:i,layout:a,separatorToPanels:s}=Sie(r),o=r.separators.find(d=>d.element===t);Wn(o,"Matching separator not found");const l=s.get(o);Wn(l,"Matching panels not found");const u=l[0],f=i.find(d=>d.panelId===u.id);if(Wn(f,"Panel metadata not found"),f.collapsible){const d=a[u.id],p=f.collapsedSize===d?r.inMemoryLastExpandedPanelSizes[u.id]??f.minSize:f.collapsedSize;Pd(t,p-d)}break}case"F6":{e.preventDefault();const r=lE(t).separators.map(s=>s.element),i=Array.from(r).findIndex(s=>s===e.currentTarget);Wn(i!==null,"Index not found");const a=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[a].focus();break}case"Home":{e.preventDefault(),Pd(t,-100);break}}}function BRe(e,t,n){let r,i={x:1/0,y:1/0};for(const a of t){const s=pie(n,a.rect);switch(e){case"horizontal":{s.x<=i.x&&(r=a,i=s);break}case"vertical":{s.y<=i.y&&(r=a,i=s);break}}}return r?{distance:i,hitRegion:r}:void 0}let S_;function URe(){return S_===void 0&&(typeof matchMedia=="function"?S_=!!matchMedia("(pointer:coarse)").matches:S_=!1),S_}function $Re(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:aH(e),b:aH(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Wn(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:iH(rH(n.a)),b:iH(rH(n.b))};if(i.a===i.b){const a=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let o=a.length;for(;o--;){const l=a[o];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(i.a-i.b)}const zRe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function HRe(e){const t=getComputedStyle(xie(e)??e).display;return t==="flex"||t==="inline-flex"}function WRe(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||HRe(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"||zRe.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function rH(e){let t=e.length;for(;t--;){const n=e[t];if(Wn(n,"Missing node"),WRe(n))return n}return null}function iH(e){return e&&Number(getComputedStyle(e).zIndex)||0}function aH(e){const t=[];for(;e;)t.push(e),e=xie(e);return t}function xie(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}function VRe(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 GRe({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!(n instanceof HTMLElement)||n.contains(e)||e.contains(n))return!0;if($Re(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(VRe(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function wie(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const a=URe()?eH.coarse:eH.precise,s=mie(i),o=BRe(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=a&&o.distance.y<=a&&GRe({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function sH(e){if(e.defaultPrevented)return;const{mountedGroups:t}=bl(),n=wie(e,t),r=new Set,i=new Set,a=new Set,s=new Map;let o=!1;n.forEach(l=>{r.add(l.group),l.panels.forEach(f=>{i.add(f)}),l.separator&&(a.add(l.separator),o||(o=!0,l.separator.element.focus()));const u=t.get(l.group);u&&s.set(l.group,u.layout)}),Ds({interactionState:{hitRegions:n,initialLayoutMap:s,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}}),n.length&&e.preventDefault()}function oH(e){if(e.defaultPrevented)return;const{interactionState:t,mountedGroups:n}=bl();switch(t.state){case"active":{if(e.type!=="pointerleave"&&e.buttons===0){Ds(r=>r.interactionState.state==="inactive"?r:{cursorFlags:0,interactionState:{state:"inactive"}});return}_ie({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint});break}default:{const r=wie(e,n);r.length===0?t.state!=="inactive"&&Ds({interactionState:{state:"inactive"}}):Ds({interactionState:{hitRegions:r,state:"hover"}}),ZM();break}}}function lH(e){if(e.defaultPrevented)return;e.preventDefault();const{interactionState:t}=bl();t.state==="active"&&(Ds({cursorFlags:0,interactionState:{state:"inactive"}}),ZM())}function uH(e){let t=0,n=0;const r={};for(const a of e)if(a.defaultSize!==void 0){t++;const s=ao(a.defaultSize);n+=s,r[a.panelId]=s}else r[a.panelId]=void 0;const i=e.length-t;if(i!==0){const a=ao((100-n)/i);for(const s of e)s.defaultSize===void 0&&(r[s.panelId]=a)}return r}function qRe(e,t,n){const r=n[0];if(!r)return;const i=e.panels.find(s=>s.element===t);if(!i||!i.onResize)return;const a=zp({group:e});i.onResize({asPercentage:ao(r.inlineSize/a*100),inPixels:r.inlineSize},i.id)}function KRe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function YRe(e){let t=!0;const n=new Set,r=new Set,i=new ResizeObserver(m=>{for(const y of m){const{borderBoxSize:S,target:g}=y;if(g===e.element){if(t){if(zp({group:e})===0)return;Ds(_=>{const v=_.mountedGroups.get(e);if(v){const x=Jz(e),T=v.defaultLayoutDeferred?uH(x):v.layout,w=Lf({layout:T,panelConstraints:x});return!v.defaultLayoutDeferred&&jm(T,w)&&KRe(v.derivedPanelConstraints,x)?_:{mountedGroups:new Map(_.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:x,layout:w,separatorToPanels:v.separatorToPanels})}}return _})}}else qRe(e,g,S)}});i.observe(e.element),e.panels.forEach(m=>{Wn(!n.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),n.add(m.id),m.onResize&&i.observe(m.element)});const a=zp({group:e}),s=Jz(e),o=e.panels.map(({id:m})=>m).join(",");let l=e.defaultLayout;l&&e.panels.length!==Object.keys(l).length&&(l=void 0);const u=e.inMemoryLayouts[o]??l??uH(s),f=Lf({layout:u,panelConstraints:s}),d=mie(e),p=Ds(m=>{const y=new Map;return d.forEach(S=>{S.separator&&y.set(S.separator,S.panels)}),{mountedGroups:new Map(m.mountedGroups).set(e,{defaultLayoutDeferred:a===0,derivedPanelConstraints:s,layout:f,separatorToPanels:y})}});return e.element.addEventListener("pointerleave",tH),e.separators.forEach(m=>{Wn(!r.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.element.addEventListener("keydown",nH)}),p.mountedGroups.size===1&&(window.addEventListener("pointerdown",sH),window.addEventListener("pointermove",oH),window.addEventListener("pointerup",lH)),function(){t=!1;const m=Ds(y=>{const S=new Map(y.mountedGroups);return S.delete(e),{mountedGroups:S}});e.element.removeEventListener("pointerleave",tH),e.separators.forEach(y=>{y.element.removeEventListener("keydown",nH)}),m.mountedGroups.size===0&&(window.removeEventListener("pointerdown",sH),window.removeEventListener("pointermove",oH),window.removeEventListener("pointerup",lH)),i.disconnect()}}function QM(e){const t=k.useId();return`${e??t}`}const Yf=typeof window<"u"?k.useLayoutEffect:k.useEffect;function JM(e){const t=k.useRef(e);return Yf(()=>{t.current=e},[e]),k.useCallback(n=>t.current?.(n),[t])}function e3(...e){return JM(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function XRe(e){const t=k.useRef({...e});return Yf(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const Tie="--react-resizable-panels--panel--pointer-events";function Cie(e,t){const n=e.replace(/[^a-zA-Z0-9\-_]/g,""),r=t.replace(/[^a-zA-Z0-9\-_]/g,"");return`--react-resizable-panels--${n}--${r}`}const Aie=k.createContext(null);function ZRe(e,t){const n=k.useRef({getLayout:()=>({}),setLayout:MRe});k.useImperativeHandle(t,()=>n.current,[]),Yf(()=>{Object.assign(n.current,Eie({groupId:e}))})}function QRe({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:s,id:o,onLayoutChange:l,orientation:u="horizontal",style:f,...d}){const p=k.useRef({}),m=JM(W=>{jm(p.current,W)||(p.current=W,l?.(W))}),y=QM(o),[S,g]=k.useState(!1),[_,v]=k.useState(null),[x,T]=k.useState(n??{}),[w,C]=k.useState([]),[R,O]=k.useState([]),N=k.useRef({lastExpandedPanelSizes:{},layouts:{}}),L=e3(v,a);ZRe(y,s);const D=k.useMemo(()=>({id:y,orientation:u,registerPanel:W=>(C($=>bD(u,[...$,W])),()=>{C($=>$.filter(q=>q!==W))}),registerSeparator:W=>(O($=>bD(u,[...$,W])),()=>{O($=>$.filter(q=>q!==W))})}),[y,u]),z=XRe({defaultLayout:n,disableCursor:r}),M=k.useRef(null);Yf(()=>{if(_===null)return;const W={defaultLayout:z.defaultLayout,disableCursor:!!z.disableCursor,disabled:!!i,element:_,id:y,inMemoryLastExpandedPanelSizes:N.current.lastExpandedPanelSizes,inMemoryLayouts:N.current.layouts,orientation:u,panels:w,separators:R};M.current=W;const $=YRe(W),q=bl().mountedGroups.get(W);if(q){const{defaultLayoutDeferred:j,derivedPanelConstraints:U,layout:K}=q;!j&&U.length>0&&(T(K),m?.(K))}const Y=vf.addListener("interactionStateChange",j=>{j.state==="active"?g(j.hitRegions.some(U=>U.group===W)):g(!1)}),B=vf.addListener("mountedGroupsChange",j=>{const U=j.get(W);if(U){const{defaultLayoutDeferred:K,derivedPanelConstraints:H,layout:J}=U;if(K||H.length===0)return;T(J),m?.(J)}});return()=>{M.current=null,$(),Y(),B()}},[i,_,y,m,u,w,R,z]),k.useEffect(()=>{const W=M.current;W&&(W.defaultLayout=n,W.disableCursor=!!r)});const V={[Tie]:S?"none":void 0};for(const W in x){const $=Cie(y,W),q=x[W];V[$]=q}return b.jsx(Aie.Provider,{value:D,children:b.jsx("div",{...d,"aria-orientation":u,className:t,"data-group":!0,"data-testid":y,id:y,ref:L,style:{...f,...V,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap"},children:e})})}function t3(){const e=k.useContext(Aie);return Wn(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function JRe({groupId:e,panelId:t}){const n=()=>{const{mountedGroups:o}=bl();for(const[l,{defaultLayoutDeferred:u,derivedPanelConstraints:f,layout:d,separatorToPanels:p}]of o)if(l.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:f,group:l,layout:d,separatorToPanels:p};throw Error(`Group ${e} not found`)},r=()=>{const o=n().derivedPanelConstraints.find(l=>l.panelId===t);if(o!==void 0)return o;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const o=n().group.panels.find(l=>l.id===t);if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const o=n().layout[t];if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},s=o=>{const l=a();if(o===l)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:f,group:d,layout:p,separatorToPanels:m}=n(),y=d.panels.findIndex(v=>v.id===t),S=y===d.panels.length-1,g=Iv({delta:S?l-o:o-l,initialLayout:p,panelConstraints:f,pivotIndices:S?[y-1,y]:[y,y+1],prevLayout:p,trigger:"imperative-api"}),_=Lf({layout:g,panelConstraints:f});jm(p,_)||Ds(v=>({mountedGroups:new Map(v.mountedGroups).set(d,{defaultLayoutDeferred:u,derivedPanelConstraints:f,layout:_,separatorToPanels:m})}))};return{collapse:()=>{const{collapsible:o,collapsedSize:l}=r(),u=a();o&&u!==l&&s(l)},expand:()=>{const{collapsible:o,collapsedSize:l,minSize:u}=r(),f=a();o&&f===l&&s(u)},getSize:()=>{const{group:o}=n(),l=a(),{element:u}=i(),f=o.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:l,inPixels:f}},isCollapsed:()=>{const{collapsible:o,collapsedSize:l}=r(),u=a();return o&&Qi(l,u)},resize:o=>{if(a()!==o){let l;switch(typeof o){case"number":{const{group:u}=n(),f=zp({group:u});l=ao(o/f*100);break}case"string":{l=parseFloat(o);break}}s(l)}}}}function eNe(e,t){const{id:n}=t3(),r=k.useRef({collapse:Ck,expand:Ck,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Ck});k.useImperativeHandle(t,()=>r.current,[]),Yf(()=>{Object.assign(r.current,JRe({groupId:n,panelId:e}))})}function tNe({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,elementRef:a,id:s,maxSize:o="100%",minSize:l="0%",onResize:u,panelRef:f,style:d,...p}){const m=!!s,y=QM(s),[S,g]=k.useState(null),_=e3(g,a),{id:v,registerPanel:x}=t3(),T=u!==null,w=JM(R=>{u?.(R,s)});Yf(()=>{if(S!==null)return x({element:S,id:y,idIsStable:m,onResize:T?w:void 0,panelConstraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:o,minSize:l}})},[n,r,i,S,T,y,m,o,l,w,x]),eNe(y,f);const C=Cie(v,y);return b.jsx("div",{...p,"data-panel":!0,"data-testid":y,id:y,ref:_,style:{...nNe,flexBasis:0,flexGrow:`var(${C}, 1)`,flexShrink:1,overflow:"hidden",pointerEvents:`var(${Tie})`},children:b.jsx("div",{className:t,style:{width:"100%",height:"100%",...d},children:e})})}const nNe={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 rNe({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a;const s=e[n],o=t.find(l=>l.panelId===n);if(o){const l=o.maxSize,u=a=o.collapsible?o.collapsedSize:o.minSize,f=[r,r+1];a=Lf({layout:Iv({delta:u-s,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n],i=Lf({layout:Iv({delta:l-s,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:s}}function iNe({children:e,className:t,elementRef:n,id:r,style:i,...a}){const s=QM(r),[o,l]=k.useState({}),[u,f]=k.useState("inactive"),[d,p]=k.useState(null),m=e3(p,n),{id:y,orientation:S,registerSeparator:g}=t3(),_=S==="horizontal"?"vertical":"horizontal";return Yf(()=>{if(d!==null){const v={element:d,id:s},x=g(v),T=vf.addListener("interactionStateChange",C=>{f(C.state!=="inactive"&&C.hitRegions.some(R=>R.separator===v)?C.state:"inactive")}),w=vf.addListener("mountedGroupsChange",C=>{C.forEach(({derivedPanelConstraints:R,layout:O,separatorToPanels:N},L)=>{if(L.id===y){const D=N.get(v);if(D){const z=D[0],M=L.panels.indexOf(z);l(rNe({layout:O,panelConstraints:R,panelId:z.id,panelIndex:M}))}}})});return()=>{T(),w(),x()}}},[d,y,s,g]),b.jsx("div",{...a,"aria-controls":o.valueControls,"aria-orientation":_,"aria-valuemax":o.valueMax,"aria-valuemin":o.valueMin,"aria-valuenow":o.valueNow,children:e,className:t,"data-separator":u,"data-testid":s,id:s,ref:m,role:"separator",style:{flexBasis:"auto",...i,flexGrow:0,flexShrink:0},tabIndex:0})}function Vd({className:e,direction:t,...n}){return b.jsx(QRe,{"data-slot":"resizable-panel-group",orientation:t,className:Ue("flex h-full w-full data-[orientation=vertical]:flex-col",e),...n})}function Ss({...e}){return b.jsx(tNe,{"data-slot":"resizable-panel",...e})}function Gd({withHandle:e,className:t,...n}){return b.jsx(iNe,{"data-slot":"resizable-handle",className:Ue("relative flex w-px items-center justify-center bg-border cursor-grab active:cursor-grabbing group touch-none","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","focus-visible:ring-offset-1 focus-visible:ring-offset-background","data-[orientation=vertical]:h-px data-[orientation=vertical]:w-full data-[orientation=vertical]:cursor-row-resize","[&[data-orientation=vertical]>div]:rotate-90",t),...n,children:e&&b.jsxs("div",{className:"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center gap-1 bg-muted/90 border border-border rounded-full px-1 py-3 opacity-70 group-hover:opacity-100 group-focus:opacity-100 transition-opacity shadow-sm",children:[b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"}),b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"}),b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"})]})})}var kk={exports:{}},cH;function aNe(){return cH||(cH=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(s,o,l){var u=this&&this.__decorate||function(v,x,T,w){var C,R=arguments.length,O=R<3?x:w===null?w=Object.getOwnPropertyDescriptor(x,T):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(v,x,T,w);else for(var N=v.length-1;N>=0;N--)(C=v[N])&&(O=(R<3?C(O):R>3?C(x,T,O):C(x,T))||O);return R>3&&O&&Object.defineProperty(x,T,O),O},f=this&&this.__param||function(v,x){return function(T,w){x(T,w,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=l(9042),p=l(9924),m=l(844),y=l(4725),S=l(2585),g=l(3656);let _=o.AccessibilityManager=class extends m.Disposable{constructor(v,x,T,w){super(),this._terminal=v,this._coreBrowserService=T,this._renderService=w,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let C=0;C<this._terminal.rows;C++)this._rowElements[C]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[C]);if(this._topBoundaryFocusListener=C=>this._handleBoundaryFocus(C,0),this._bottomBoundaryFocusListener=C=>this._handleBoundaryFocus(C,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((C=>this._handleResize(C.rows)))),this.register(this._terminal.onRender((C=>this._refreshRows(C.start,C.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((C=>this._handleChar(C)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
30
+ `)}var fOe=0,hOe=(function(){function e(){Object.defineProperty(this,"cacheId",{enumerable:!0,configurable:!0,writable:!0,value:fOe++}),Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:fr.map()}),Object.defineProperty(this,"lastCacheModificationPerId",{enumerable:!0,configurable:!0,writable:!0,value:fr.map()})}return Object.defineProperty(e.prototype,"updateLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.lastCacheModificationPerId.get(t);this.lastCacheModificationPerId.set(t,n===void 0?1:n+1)}}),Object.defineProperty(e.prototype,"getLastCacheModificationPerId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.lastCacheModificationPerId.get(t)||0;return"".concat(this.cacheId,"-").concat(n)}}),Object.defineProperty(e.prototype,"addNodeToCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){if(n===void 0&&(n=!0),t.identifierAttribute){var r=t.identifier;this.cache.has(r)||this.cache.set(r,fr.array([],fw));var i=this.cache.get(r);if(i.indexOf(t)!==-1)throw new St("Already registered");i.push(t),n&&this.updateLastCacheModificationPerId(r)}}}),Object.defineProperty(e.prototype,"mergeCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this;gre(t.identifierCache.cache).forEach(function(r){return r.forEach(function(i){n.addNodeToCache(i)})})}}),Object.defineProperty(e.prototype,"notifyDied",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(t.identifierAttribute){var n=t.identifier,r=this.cache.get(n);r&&(r.remove(t),r.length||this.cache.delete(n),this.updateLastCacheModificationPerId(t.identifier))}}}),Object.defineProperty(e.prototype,"splitCache",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this,r=new e,i=t.path+"/";return Cke(this.cache).forEach(function(a){for(var s=vu(a,2),o=s[0],l=s[1],u=!1,f=l.length-1;f>=0;f--){var d=l[f];(d===t||d.path.indexOf(i)===0)&&(r.addNodeToCache(d,!1),l.splice(f,1),l.length||n.cache.delete(o),u=!0)}u&&n.updateLastCacheModificationPerId(o)}),r}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.cache.get(n);return r?r.some(function(i){return t.isAssignableFrom(i.type)}):!1}}),Object.defineProperty(e.prototype,"resolve",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.cache.get(n);if(!r)return null;var i=r.filter(function(a){return t.isAssignableFrom(a.type)});switch(i.length){case 0:return null;case 1:return i[0];default:throw new St("Cannot resolve a reference to type '".concat(t.name,"' with id: '").concat(n,"' unambigously, there are multiple candidates: ").concat(i.map(function(a){return a.path}).join(", ")))}}}),e})();function YM(e,t,n,r,i){var a=jre(i);if(a){if(a.parent)throw new St("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(t?t.path:"","/").concat(n,"', but it lives already at '").concat(a.path,"'"));return t&&a.setParent(t,n),a}return new Ta(e,t,n,r,i)}function sd(e,t,n,r,i){return new Cv(e,t,n,r,i)}function pOe(e){return e instanceof Cv||e instanceof Ta}var Si;(function(e){e[e.INITIALIZING=0]="INITIALIZING",e[e.CREATED=1]="CREATED",e[e.FINALIZED=2]="FINALIZED",e[e.DETACHING=3]="DETACHING",e[e.DEAD=4]="DEAD"})(Si||(Si={}));function Sr(e){return!!(e&&e.$treenode)}function On(e){if(!Sr(e))throw new St("Value ".concat(e," is no MST Node"));return e.$treenode}function jre(e){return e&&e.$treenode||null}function mOe(){return On(this).snapshot}function gOe(e,t,n){n===void 0&&(n=!0);var r=e;try{for(var i=0;i<t.length;i++){var a=t[i];if(a===".."){if(r=r.parent,r)continue}else{if(a===".")continue;if(r){if(r instanceof Cv){var s=r.value;Sr(s)&&(r=On(s))}if(r instanceof Ta){var o=r.getChildType(a);if(o&&(r=r.getChildNode(a),r))continue}}}throw new St("Could not resolve '".concat(a,"' in path '").concat(jz(t.slice(0,i))||"/","' while resolving '").concat(jz(t),"'"))}}catch(l){if(!n)return;throw l}return r}function Fre(e){if(!e)return Up;var t=Object.keys(e);if(!t.length)return Up;var n=new Array(t.length);return t.forEach(function(r,i){n[i]=e[r]}),n}var bOe=Object.toString(),Up=Object.freeze([]),$p=Object.freeze({}),fw=QAe().useProxies?{deep:!1}:{deep:!1,proxy:!1};Object.freeze(fw);var St=(function(e){tr(t,e);function t(n){return n===void 0&&(n="Illegal state"),e.call(this,"[mobx-state-tree] ".concat(n))||this}return t})(Error);function vOe(e){return e}var yOe=Number.isInteger;function _Oe(e){return Number(e)===e&&e%1!==0}function EOe(e){return Number.isFinite(e)}function Bre(e){return Array.isArray(e)||gl(e)}function Ure(e){return e?Bre(e)?e:[e]:Up}function SOe(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++){var i=t[r];for(var a in i)e[a]=i[a]}return e}function ap(e){var t;if(e===null||typeof e!="object")return!1;var n=Object.getPrototypeOf(e);return n==null?!0:((t=n.constructor)===null||t===void 0?void 0:t.toString())===bOe}function $re(e){return e!==null&&typeof e=="object"&&!(e instanceof Date)&&!(e instanceof RegExp)}function kv(e,t){return t===void 0&&(t=!0),e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean"||t&&e instanceof Date}function zre(e){return typeof e!="function"}function xOe(e,t,n){ko(e)?vre(e,t,n):Object.defineProperty(e,t,n)}function mf(e,t,n){xOe(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}var wOe=(function(){function e(){Object.defineProperty(this,"handlers",{enumerable:!0,configurable:!0,writable:!0,value:[]})}return Object.defineProperty(e.prototype,"hasSubscribers",{get:function(){return this.handlers.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this;return n===void 0&&(n=!1),n?this.handlers.unshift(t):this.handlers.push(t),function(){r.unregister(t)}}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return this.handlers.indexOf(t)>=0}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.handlers.indexOf(t);n>=0&&this.handlers.splice(n,1)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.handlers.length=0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=this.handlers.slice();r.forEach(function(i){return i.apply(void 0,yu([],vu(t),!1))})}}),e})(),Hre=(function(){function e(){Object.defineProperty(this,"eventHandlers",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"hasSubscribers",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=this.eventHandlers&&this.eventHandlers[t];return!!n&&n.hasSubscribers}}),Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){r===void 0&&(r=!1),this.eventHandlers||(this.eventHandlers={});var i=this.eventHandlers[t];return i||(i=this.eventHandlers[t]=new wOe),i.register(n,r)}}),Object.defineProperty(e.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.eventHandlers&&this.eventHandlers[t];return!!r&&r.has(n)}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n){var r=this.eventHandlers&&this.eventHandlers[t];r&&r.unregister(n)}}),Object.defineProperty(e.prototype,"clear",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.eventHandlers&&delete this.eventHandlers[t]}}),Object.defineProperty(e.prototype,"clearAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.eventHandlers=void 0}}),Object.defineProperty(e.prototype,"emit",{enumerable:!1,configurable:!0,writable:!0,value:function(t){for(var n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var a=this.eventHandlers&&this.eventHandlers[t];a&&(n=a).emit.apply(n,yu([],vu(r),!1))}}),e})();function Wre(e){for(var t=new Array(e.length),n=0;n<e.length;n++)t[n]=e[n];return t}function gk(e,t){return e.indexOf(t)===0}function TOe(e){console.warn(new Error("[mobx-state-tree] ".concat(e)))}function COe(){return typeof process<"u"&&Pz&&Pz.ENABLE_TYPE_CHECK==="true"}function bk(e){typeof queueMicrotask=="function"?queueMicrotask(e):typeof setImmediate=="function"?setImmediate(e):setTimeout(e,1)}function vk(e){return AOe(e.name,e)}function AOe(e,t){var n=function(){var i=Lre(),a=Dre();if(!a)throw new St("a mst flow must always have a parent context");var s=Pre(a);if(!s)throw new St("a mst flow must always have a parent action context");var o={name:e,id:i,tree:a.tree,context:a.context,parentId:a.id,allParentIds:yu(yu([],vu(a.allParentIds),!1),[a.id],!1),rootId:a.rootId,parentEvent:a,parentActionEvent:s},l=arguments;function u(f,d,p){return f.$mst_middleware=n.$mst_middleware,fD(ya(ya({},o),{type:d,args:[p]}),f)}return new Promise(function(f,d){var p,m=function(){p=t.apply(null,arguments),y(void 0)};m.$mst_middleware=n.$mst_middleware,fD(ya(ya({},o),{type:"flow_spawn",args:Wre(l)}),m);function y(_){var v;try{var x=u(function(T){v=p.next(T)},"flow_resume",_);x instanceof Error&&(v=p.throw(x))}catch(T){bk(function(){u(function(w){d(T)},"flow_throw",T)});return}g(v)}function S(_){var v;try{u(function(x){v=p.throw(x)},"flow_resume_error",_)}catch(x){bk(function(){u(function(T){d(x)},"flow_throw",x)});return}g(v)}function g(_){if(_.done){bk(function(){u(function(v){f(v)},"flow_return",_.value)});return}if(!_.value||typeof _.value.then!="function")throw new St("Only promises can be yielded to `async`, got: "+_);return _.value.then(y,S)}})};return n._isFlowAction=!0,n}function kOe(e){if(!("oldValue"in e))throw new St("Patches without `oldValue` field cannot be inversed");return[OOe(e),ROe(e)]}function OOe(e){switch(e.op){case"add":return{op:"add",path:e.path,value:e.value};case"remove":return{op:"remove",path:e.path};case"replace":return{op:"replace",path:e.path,value:e.value}}}function ROe(e){switch(e.op){case"add":return{op:"remove",path:e.path};case"remove":return{op:"add",path:e.path,value:e.oldValue};case"replace":return{op:"replace",path:e.path,value:e.oldValue}}}function NOe(e){return typeof e=="number"}function gf(e){return NOe(e)===!0?""+e:e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function IOe(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function jz(e){if(e.length===0)return"";var t=function(n){return n.map(gf).join("/")};return e[0]==="."||e[0]===".."?t(e):"/"+t(e)}function DOe(e){var t=e.split("/").map(IOe),n=e===""||e==="."||e===".."||gk(e,"/")||gk(e,"./")||gk(e,"../");if(!n)throw new St("a json path must be either rooted, empty or relative, but got '".concat(e,"'"));return t[0]===""&&t.shift(),t}var yk=Symbol("$preProcessorFailed"),LOe=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,i||n.name)||this;return Object.defineProperty(a,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_processors",{enumerable:!0,configurable:!0,writable:!0,value:r}),a}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.SnapshotProcessor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"snapshotProcessor(".concat(this._subtype.describe(),")")}}),Object.defineProperty(t.prototype,"preProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._processors.preProcessor?this._processors.preProcessor.call(null,n):n}}),Object.defineProperty(t.prototype,"preProcessSnapshotSafe",{enumerable:!1,configurable:!0,writable:!0,value:function(n){try{return this.preProcessSnapshot(n)}catch{return yk}}}),Object.defineProperty(t.prototype,"postProcessSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this._processors.postProcessor?this._processors.postProcessor.call(null,n,r.storedValue):n}}),Object.defineProperty(t.prototype,"_fixNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;POe(n.type,this,"create"),n instanceof Ta&&(n.hasSnapshotPostProcessor=!!this._processors.postProcessor);var i=n.getSnapshot;n.getSnapshot=function(){return r.postProcessSnapshot(i.call(n),n)},t2e(this._subtype)||(n.getReconciliationType=function(){return r})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?a:this.preProcessSnapshot(a),o=this._subtype.instantiate(n,r,i,s);return this._fixNode(o),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this._subtype.reconcile(n,Sr(r)?r:this.preProcessSnapshot(r),i,a);return s!==n&&this._fixNode(s),s}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r=!0);var i=this._subtype.getSnapshot(n);return r?this.postProcessSnapshot(i,n):i}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this.preProcessSnapshotSafe(n);return i===yk?Oa(r,n,"Failed to preprocess value"):this._subtype.validate(i,r)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),Object.defineProperty(t.prototype,"is",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=Eu(n)?this._subtype:Sr(n)?n:this.preProcessSnapshotSafe(n);return r===yk?!1:this._subtype.validate(r,[{path:"",type:this._subtype}]).length===0}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isMatchingSnapshotId",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(!(this._subtype instanceof Bp))return!1;var i=this.preProcessSnapshot(r);return this._subtype.isMatchingSnapshotId(n,i)}}),t})(_u);function POe(e,t){for(var n,r,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];try{for(var s=Hb(i),o=s.next();!o.done;o=s.next()){var l=o.value;e[l]=t[l].bind(t)}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}function MOe(e,t,n){return new LOe(e,t,n)}var Fz="Map.put can only be used to store complex values that have an identifier type attribute";function Vre(e,t){var n,r,i=e.getSubTypes();if(i===Ire)return!1;if(i){var a=Ure(i);try{for(var s=Hb(a),o=s.next();!o.done;o=s.next()){var l=o.value;if(!Vre(l,t))return!1}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}return e instanceof Ov&&t.push(e),!0}var yc;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.YES=1]="YES",e[e.NO=2]="NO"})(yc||(yc={}));var jOe=(function(e){tr(t,e);function t(n,r){return e.call(this,n,fr.ref.enhancer,r)||this}return Object.defineProperty(t.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.get.call(this,""+n)}}),Object.defineProperty(t.prototype,"has",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.has.call(this,""+n)}}),Object.defineProperty(t.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return e.prototype.delete.call(this,""+n)}}),Object.defineProperty(t.prototype,"set",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return e.prototype.set.call(this,""+n,r)}}),Object.defineProperty(t.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!n)throw new St("Map.put cannot be used to set empty values");if(Sr(n)){var r=On(n);if(r.identifier===null)throw new St(Fz);return this.set(r.identifier,n),n}else if($re(n)){var i=On(this),a=i.type;if(a.identifierMode!==yc.YES)throw new St(Fz);var s=a.mapIdentifierAttribute,o=n[s];if(!XM(o)){var l=this.put(a.getChildType().create(n,i.environment));return this.put(Zke(l))}var u=t0(o);return this.set(u,n),this.get(u)}else throw new St("Map.put can only be used to store complex values")}}),t})(VM),sS=(function(e){tr(t,e);function t(n,r,i){i===void 0&&(i=[]);var a=e.call(this,n)||this;return Object.defineProperty(a,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"identifierMode",{enumerable:!0,configurable:!0,writable:!0,value:yc.UNKNOWN}),Object.defineProperty(a,"mapIdentifierAttribute",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Map}),Object.defineProperty(a,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a._determineIdentifierMode(),a.hookInitializers=i,a}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.hookInitializers.length>0?this.hookInitializers.concat(n):[n];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._determineIdentifierMode(),YM(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"_determineIdentifierMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this.identifierMode===yc.UNKNOWN){var n=[];if(Vre(this._subType,n)){var r=n.reduce(function(i,a){if(!a.identifierAttribute)return i;if(i&&i!==a.identifierAttribute)throw new St("The objects in a map should all have the same identifier attribute, expected '".concat(i,"', but child of type '").concat(a.name,"' declared attribute '").concat(a.identifierAttribute,"' as identifier"));return a.identifierAttribute},void 0);r?(this.identifierMode=yc.YES,this.mapIdentifierAttribute=r):this.identifierMode=yc.NO}}}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r={});var i=n.type._subType,a={};return Object.keys(r).forEach(function(s){a[s]=i.instantiate(n,s,void 0,r[s])}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return new jOe(n,this.name)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){pre(r,n.unbox);var i=n.type;i.hookInitializers.forEach(function(a){var s=a(r);Object.keys(s).forEach(function(o){var l=s[o],u=Av(r,o,l);mf(r,o,u)})}),zM(r,this.willChange),HM(r,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return gre(n.storedValue)}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=n.storedValue.get(""+r);if(!i)throw new St("Not a child "+r);return i}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object),i=n.name;r.assertWritable({subpath:i});var a=r.type,s=a._subType;switch(n.type){case"update":{var o=n.newValue,l=n.object.get(i);if(o===l)return null;cu(s,o),n.newValue=s.reconcile(r.getChildNode(i),n.newValue,r,i),a.processIdentifier(i,n.newValue)}break;case"add":cu(s,n.newValue),n.newValue=s.instantiate(r,i,void 0,n.newValue),a.processIdentifier(i,n.newValue);break}return n}}),Object.defineProperty(t.prototype,"processIdentifier",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this.identifierMode===yc.YES&&r instanceof Ta){var i=r.identifier;if(i!==n)throw new St("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '".concat(i,"', but expected: '").concat(n,"'"))}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return n.getChildren().forEach(function(i){r[i.subpath]=i.snapshot}),r}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return Object.keys(n).forEach(function(i){r[i]=n[i].getSnapshot()}),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);switch(n.type){case"update":return void r.emitPatch({op:"replace",path:gf(n.name),value:n.newValue.snapshot,oldValue:n.oldValue?n.oldValue.snapshot:void 0},r);case"add":return void r.emitPatch({op:"add",path:gf(n.name),value:n.newValue.snapshot,oldValue:void 0},r);case"delete":var i=n.oldValue.snapshot;return n.oldValue.die(),void r.emitPatch({op:"remove",path:gf(n.name),oldValue:i},r)}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=n.storedValue;switch(i.op){case"add":case"replace":a.set(r,i.value);break;case"remove":a.delete(r);break}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){cu(this,r);var i=n.storedValue,a={};if(Array.from(i.keys()).forEach(function(o){a[o]=!1}),r)for(var s in r)i.set(s,r[s]),a[""+s]=!0;Object.keys(a).forEach(function(o){a[o]===!1&&i.delete(o)})}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;return ap(n)?dw(Object.keys(n).map(function(a){return i._subType.validate(n[a],KM(r,a,i._subType))})):Oa(r,n,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return $p}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue.delete(r)}}),t})(Bp);sS.prototype.applySnapshot=Jr(sS.prototype.applySnapshot);function FOe(e){return new sS("Map<string, ".concat(e.name,">"),e)}var oS=(function(e){tr(t,e);function t(n,r,i){i===void 0&&(i=[]);var a=e.call(this,n)||this;return Object.defineProperty(a,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Array}),Object.defineProperty(a,"hookInitializers",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a.hookInitializers=i,a}return Object.defineProperty(t.prototype,"hooks",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.hookInitializers.length>0?this.hookInitializers.concat(n):[n];return new t(this.name,this._subType,r)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return YM(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r=[]);var i=n.type._subType,a={};return r.forEach(function(s,o){var l=""+o;a[l]=i.instantiate(n,l,void 0,s)}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=ya(ya({},fw),{name:this.name});return fr.array(Fre(n),r)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){ul(r).dehancer=n.unbox;var i=n.type;i.hookInitializers.forEach(function(a){var s=a(r);Object.keys(s).forEach(function(o){var l=s[o],u=Av(r,o,l);mf(r,o,u)})}),zM(r,this.willChange),HM(r,this.didChange)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue.slice()}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=Number(r);if(i<n.storedValue.length)return n.storedValue[i];throw new St("Not a child: "+r)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);r.assertWritable({subpath:""+n.index});var i=r.type._subType,a=r.getChildren();switch(n.type){case"update":{if(n.newValue===n.object[n.index])return null;var s=Bz(r,i,[a[n.index]],[n.newValue],[n.index]);if(!s)return null;n.newValue=s[0]}break;case"splice":{var o=n.index,l=n.removedCount,u=n.added,f=Bz(r,i,a.slice(o,o+l),u,u.map(function(p,m){return o+m}));if(!f)return null;n.added=f;for(var d=o+l;d<a.length;d++)a[d].setParent(r,""+(d+u.length-l))}break}return n}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.getChildren().map(function(r){return r.snapshot})}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=[];return Object.keys(n).forEach(function(i){r.push(n[i].getSnapshot())}),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=On(n.object);switch(n.type){case"update":return void r.emitPatch({op:"replace",path:""+n.index,value:n.newValue.snapshot,oldValue:n.oldValue?n.oldValue.snapshot:void 0},r);case"splice":if(n.removedCount&&n.addedCount===n.object.length)return void r.emitPatch({op:"replace",path:"",value:r.snapshot,oldValue:n.removed.map(function(a){return a.snapshot})},r);for(var i=n.removedCount-1;i>=0;i--)r.emitPatch({op:"remove",path:""+(n.index+i),oldValue:n.removed[i].snapshot},r);for(var i=0;i<n.addedCount;i++)r.emitPatch({op:"add",path:""+(n.index+i),value:n.added[i].snapshot,oldValue:void 0},r);return}}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=n.storedValue,s=r==="-"?a.length:Number(r);switch(i.op){case"replace":a[s]=i.value;break;case"add":a.splice(s,0,i.value);break;case"remove":a.splice(s,1);break}}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){cu(this,r);var i=n.storedValue;i.replace(r)}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subType}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;return Bre(n)?dw(n.map(function(a,s){return i._subType.validate(a,KM(r,""+s,i._subType))})):Oa(r,n,"Value is not an array")}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Up}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue.splice(Number(r),1)}}),t})(Bp);oS.prototype.applySnapshot=Jr(oS.prototype.applySnapshot);function BOe(e){return new oS("".concat(e.name,"[]"),e)}function Bz(e,t,n,r,i){for(var a=!0,s=0;;s++){var o=s<=r.length-1,l=n[s],u=o?r[s]:void 0,f=""+i[s];if(pOe(u)&&(u=u.storedValue),!l&&!o)break;if(!o)a=!1,n.splice(s,1),l instanceof Ta&&l.createObservableInstanceIfNeeded(),l.die(),s--;else if(l)if(Uz(l,u))n[s]=_k(t,e,f,u,l);else{for(var p=void 0,m=s;m<n.length;m++)if(Uz(n[m],u)){p=n.splice(m,1)[0];break}a=!1;var d=_k(t,e,f,u,p);n.splice(s,0,d)}else{if(Sr(u)&&On(u).parent===e)throw new St("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(e.path,"/").concat(f,"', but it lives already at '").concat(On(u).path,"'"));a=!1;var d=_k(t,e,f,u);n.splice(s,0,d)}}return a?null:n}function _k(e,t,n,r,i){cu(e,r);function a(){if(Sr(r)){var o=On(r);if(o.assertAlive($p),o.parent!==null&&o.parent===t)return o.setParent(t,n),o}return i?e.reconcile(i,r,t,n):e.instantiate(t,n,void 0,r)}var s=a();return i&&i!==s&&(i instanceof Ta&&i.createObservableInstanceIfNeeded(),i.die()),s}function Uz(e,t){if(!e.isAlive)return!1;if(Sr(t)){var n=On(t);return n.isAlive&&n===e}if(e.snapshot===t)return!0;if(!(e instanceof Ta))return!1;var r=e.getReconciliationType();return e.identifier!==null&&e.identifierAttribute&&ap(t)&&r.is(t)&&r.isMatchingSnapshotId(e,t)}var $z="preProcessSnapshot",zz="postProcessSnapshot";function UOe(){return On(this).toString()}var Hz={name:"AnonymousModel",properties:{},initializers:Up};function $Oe(e){var t=Object.keys(e),n=new Set;return t.forEach(function(r){if(n.has(r))throw new St("".concat(r," is declared twice in the model. Model should not contain the same keys"));n.add(r)}),t.reduce(function(r,i){if(i in Qr)throw new St("Hook '".concat(i,"' was defined as property. Hooks should be defined as part of the actions"));var a=Object.getOwnPropertyDescriptor(e,i);if("get"in a)throw new St("Getters are not supported as properties. Please use views instead");var s=a.value;if(s==null)throw new St("The default value of an attribute cannot be null or undefined as the type cannot be inferred. Did you mean `types.maybe(someType)`?");if(kv(s))r[i]=bf(KOe(s),s);else if(s instanceof sS)r[i]=bf(s,{});else if(s instanceof oS)r[i]=bf(s,[]);else if(!Eu(s))throw new St("Invalid type definition for property '".concat(i,"', cannot infer a type from a value like '").concat(s,"' (").concat(typeof s,")"));return r},ya({},e))}var Ov=(function(e){tr(t,e);function t(n){var r=e.call(this,n.name||Hz.name)||this;return Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Object}),Object.defineProperty(r,"initializers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"properties",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"preProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"postProcessor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"propertyNames",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"named",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return r.cloneAndEnhance({name:i})}}),Object.defineProperty(r,"props",{enumerable:!0,configurable:!0,writable:!0,value:function(i){return r.cloneAndEnhance({properties:i})}}),Object.defineProperty(r,"preProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var a=r.preProcessor;return a?r.cloneAndEnhance({preProcessor:function(s){return a(i(s))}}):r.cloneAndEnhance({preProcessor:i})}}),Object.defineProperty(r,"postProcessSnapshot",{enumerable:!0,configurable:!0,writable:!0,value:function(i){var a=r.postProcessor;return a?r.cloneAndEnhance({postProcessor:function(s){return i(a(s))}}):r.cloneAndEnhance({postProcessor:i})}}),Object.assign(r,Hz,n),r.properties=$Oe(r.properties),r.properties,r.propertyNames=Object.keys(r.properties),r.identifierAttribute=r._getIdentifierAttribute(),r}return Object.defineProperty(t.prototype,"_getIdentifierAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=void 0;return this.forAllProps(function(r,i){if(i.flags&_n.Identifier){if(n)throw new St("Cannot define property '".concat(r,"' as object identifier, property '").concat(n,"' is already defined as identifier property"));n=r}}),n}}),Object.defineProperty(t.prototype,"cloneAndEnhance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return new t({name:n.name||this.name,properties:Object.assign({},this.properties,n.properties),initializers:this.initializers.concat(n.initializers||[]),preProcessor:n.preProcessor||this.preProcessor,postProcessor:n.postProcessor||this.postProcessor})}}),Object.defineProperty(t.prototype,"actions",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){return r.instantiateActions(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateActions",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!ap(r))throw new St("actions initializer should return a plain object containing actions");Object.getOwnPropertyNames(r).forEach(function(a){if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as an action"));if(a===$z)throw new St("Cannot define action '".concat($z,"', it should be defined using 'type.preProcessSnapshot(fn)' instead"));if(a===zz)throw new St("Cannot define action '".concat(zz,"', it should be defined using 'type.postProcessSnapshot(fn)' instead"));var s=r[a],o=n[a];if(a in Qr&&o){var l=s;s=function(){o.apply(null,arguments),l.apply(null,arguments)}}var u=s.$mst_middleware,f=s.bind(r);f._isFlowAction=s._isFlowAction||!1,f.$mst_middleware=u;var d=Av(n,a,f);r[a]=d,mf(n,a,d)})}}),Object.defineProperty(t.prototype,"volatile",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;if(typeof n!="function")throw new St("You passed an ".concat(typeof n," to volatile state as an argument, when function is expected"));var i=function(a){return r.instantiateVolatileState(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateVolatileState",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!ap(r))throw new St("volatile state initializer should return a plain object containing state");Object.getOwnPropertyNames(r).forEach(function(a){if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as volatile state"));bre(n,a,r[a])})}}),Object.defineProperty(t.prototype,"extend",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){var s=n(a),o=s.actions,l=s.views,u=s.state,f=Yke(s,["actions","views","state"]);for(var d in f)throw new St("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '".concat(d,"'"));return u&&r.instantiateVolatileState(a,u),l&&r.instantiateViews(a,l),o&&r.instantiateActions(a,o),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"views",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=function(a){return r.instantiateViews(a,n(a)),a};return this.cloneAndEnhance({initializers:[i]})}}),Object.defineProperty(t.prototype,"instantiateViews",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;if(!ap(r))throw new St("views initializer should return a plain object containing views");Object.getOwnPropertyNames(r).forEach(function(a){var s;if(a in i.properties)throw new St("'".concat(a,"' is a property and cannot be declared as a view"));var o=Object.getOwnPropertyDescriptor(r,a);if("get"in o)vre(n,a,o),_re(n,(s={},s[a]=Lm,s));else if(typeof o.value=="function")mf(n,a,o.value);else throw new St("A view member should either be a function or getter based property")})}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?a:this.applySnapshotPreProcessor(a);return YM(this,n,r,i,s)}}),Object.defineProperty(t.prototype,"initializeChildNodes",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){r===void 0&&(r={});var i=n.type,a={};return i.forAllProps(function(s,o){a[s]=o.instantiate(n,s,void 0,r[s])}),a}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=ya(ya({},fw),{name:this.name});return fr.object(n,$p,r)}}),Object.defineProperty(t.prototype,"finalizeNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){mf(r,"toString",UOe),this.forAllProps(function(i){pre(r,i,n.unbox)}),this.initializers.reduce(function(i,a){return a(i)},r),zM(r,this.willChange),HM(r,this.didChange)}}),Object.defineProperty(t.prototype,"willChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n,i=On(r.object),a=r.name;i.assertWritable({subpath:a});var s=i.type.properties[a];return s&&(cu(s,r.newValue),r.newValue=s.reconcile(i.getChildNode(a),r.newValue,i,a)),r}}),Object.defineProperty(t.prototype,"didChange",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n,i=On(r.object),a=i.type.properties[r.name];if(a){var s=r.oldValue?r.oldValue.snapshot:void 0;i.emitPatch({op:"replace",path:gf(r.name),value:r.newValue.snapshot,oldValue:s},i)}}}),Object.defineProperty(t.prototype,"getChildren",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this,i=[];return this.forAllProps(function(a){i.push(r.getChildNode(n,a))}),i}}),Object.defineProperty(t.prototype,"getChildNode",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i;if(!(r in this.properties))throw new St("Not a value property: "+r);var a=ul(n.storedValue,r),s=(i=a.raw)===null||i===void 0?void 0:i.call(a);if(!s)throw new St("Node not available for property "+r);return s}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this;r===void 0&&(r=!0);var a={};return this.forAllProps(function(s,o){var l=Fp(n.storedValue,s);l.reportObserved(),a[s]=i.getChildNode(n,s).snapshot}),r?this.applySnapshotPostProcessor(a):a}}),Object.defineProperty(t.prototype,"processInitialSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r={};return Object.keys(n).forEach(function(i){r[i]=n[i].getSnapshot()}),this.applySnapshotPostProcessor(r)}}),Object.defineProperty(t.prototype,"applyPatchLocally",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){if(!(i.op==="replace"||i.op==="add"))throw new St("object does not support operation ".concat(i.op));n.storedValue[r]=i.value}}),Object.defineProperty(t.prototype,"applySnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){cu(this,r);var i=this.applySnapshotPreProcessor(r);this.forAllProps(function(a){n.storedValue[a]=i[a]})}}),Object.defineProperty(t.prototype,"applySnapshotPreProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.preProcessor;return r?r.call(null,n):n}}),Object.defineProperty(t.prototype,"applySnapshotPostProcessor",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.postProcessor;return r?r.call(null,n):n}}),Object.defineProperty(t.prototype,"getChildType",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.properties[n]}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this,a=this.applySnapshotPreProcessor(n);return ap(a)?dw(this.propertyNames.map(function(s){return i.properties[s].validate(a[s],KM(r,s,i.properties[s]))})):Oa(r,a,"Value is not a plain object")}}),Object.defineProperty(t.prototype,"forAllProps",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this;this.propertyNames.forEach(function(i){return n(i,r.properties[i])})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this;return"{ "+this.propertyNames.map(function(r){return r+": "+n.properties[r].describe()}).join("; ")+" }"}}),Object.defineProperty(t.prototype,"getDefaultSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){return $p}}),Object.defineProperty(t.prototype,"removeChild",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){n.storedValue[r]=void 0}}),t})(Bp);Ov.prototype.applySnapshot=Jr(Ov.prototype.applySnapshot);function zOe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string"?e.shift():"AnonymousModel",r=e.shift()||{};return new Ov({name:n,properties:r})}function HOe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string",r=n?e[0]:"AnonymousModel";return n&&e.shift(),e.reduce(function(i,a){return i.cloneAndEnhance({name:i.name+"_"+a.name,properties:a.properties,initializers:a.initializers,preProcessor:function(s){return a.applySnapshotPreProcessor(i.applySnapshotPreProcessor(s))},postProcessor:function(s){return a.applySnapshotPostProcessor(i.applySnapshotPostProcessor(s))}})}).named(r)}function WOe(e){return Eu(e)&&(e.flags&_n.Object)>0}var Nu=(function(e){tr(t,e);function t(n,r,i,a){a===void 0&&(a=vOe);var s=e.call(this,n)||this;return Object.defineProperty(s,"flags",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"checker",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"initializer",{enumerable:!0,configurable:!0,writable:!0,value:a}),s.flags=r,s}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"createNewInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.initializer(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(kv(n)&&this.checker(n))return Ca();var i=this.name==="Date"?"Date or a unix milliseconds timestamp":this.name;return Oa(r,n,"Value is not a ".concat(i))}}),t})(Kf),Gre=new Nu("string",_n.String,function(e){return typeof e=="string"}),qre=new Nu("number",_n.Number,function(e){return typeof e=="number"}),VOe=new Nu("integer",_n.Integer,function(e){return yOe(e)}),GOe=new Nu("float",_n.Float,function(e){return _Oe(e)}),qOe=new Nu("finite",_n.Finite,function(e){return EOe(e)}),Kre=new Nu("boolean",_n.Boolean,function(e){return typeof e=="boolean"}),Yre=new Nu("null",_n.Null,function(e){return e===null}),Xre=new Nu("undefined",_n.Undefined,function(e){return e===void 0}),Zre=new Nu("Date",_n.Date,function(e){return typeof e=="number"||e instanceof Date},function(e){return e instanceof Date?e:new Date(e)});Zre.getSnapshot=function(e){return e.storedValue.getTime()};var Qre=Zre;function KOe(e){switch(typeof e){case"string":return Gre;case"number":return qre;case"boolean":return Kre;case"object":if(e instanceof Date)return Qre}throw new St("Cannot determine primitive type from value "+e)}function YOe(e){return Eu(e)&&(e.flags&(_n.String|_n.Number|_n.Integer|_n.Boolean|_n.Date))>0}var XOe=(function(e){tr(t,e);function t(n){var r=e.call(this,JSON.stringify(n))||this;return Object.defineProperty(r,"value",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Literal}),r.value=n,r}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.stringify(this.value)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return kv(n)&&n===this.value?Ca():Oa(r,n,"Value is not a literal ".concat(JSON.stringify(this.value)))}}),t})(Kf);function Jre(e){return new XOe(e)}var ZOe=(function(e){tr(t,e);function t(n,r,i,a){var s=e.call(this,n)||this;return Object.defineProperty(s,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_predicate",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_message",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.Refinement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this._subtype.validate(n,r);if(i.length>0)return i;var a=Sr(n)?On(n).snapshot:n;return this._predicate(a)?Ca():Oa(r,n,this._message(n))}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t})(_u);function QOe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=typeof e[0]=="string"?e.shift():Eu(e[0])?e[0].name:null,r=e[0],i=e[1],a=e[2]?e[2]:function(s){return"Value does not respect the refinement predicate"};return new ZOe(n,r,i,a)}function JOe(e,t){var n=typeof e=="string"?t:e,r=hw.apply(void 0,yu([],vu(n.map(function(i){return Jre(""+i)})),!1));return typeof e=="string"&&(r.name=e),r}var e2e=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,n)||this;return Object.defineProperty(a,"_types",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"_dispatcher",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_eager",{enumerable:!0,configurable:!0,writable:!0,value:!0}),i=ya({eager:!0,dispatcher:void 0},i),a._dispatcher=i.dispatcher,i.eager||(a._eager=!1),a}return Object.defineProperty(t.prototype,"flags",{get:function(){var n=_n.Union;return this._types.forEach(function(r){n|=r.flags}),n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._types.some(function(r){return r.isAssignableFrom(n)})}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"("+this._types.map(function(n){return n.describe()}).join(" | ")+")"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.determineType(a,void 0);if(!s)throw new St("No matching type for union "+this.describe());return s.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.determineType(r,n.getReconciliationType());if(!s)throw new St("No matching type for union "+this.describe());return s.reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"determineType",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this._dispatcher?this._dispatcher(n):r?r.is(n)?r:this._types.filter(function(i){return i!==r}).find(function(i){return i.is(n)}):this._types.find(function(i){return i.is(n)})}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this._dispatcher)return this._dispatcher(n).validate(n,r);for(var i=[],a=0,s=0;s<this._types.length;s++){var o=this._types[s],l=o.validate(n,r);if(l.length===0){if(this._eager)return Ca();a++}else i.push(l)}return a===1?Ca():Oa(r,n,"No type is applicable for the union").concat(dw(i))}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._types}}),t})(_u);function hw(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Eu(e)?void 0:e,i=Eu(e)?yu([e],vu(t),!1):t,a="("+i.map(function(s){return s.name}).join(" | ")+")";return new e2e(a,i,r)}function t2e(e){return Eu(e)&&(e.flags&_n.Union)>0}var n2e=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,n.name)||this;return Object.defineProperty(a,"_subtype",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_defaultValue",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"optionalValues",{enumerable:!0,configurable:!0,writable:!0,value:i}),a}return Object.defineProperty(t.prototype,"flags",{get:function(){return this._subtype.flags|_n.Optional},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype.describe()+"?"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(this.optionalValues.indexOf(a)>=0){var s=this.getDefaultInstanceOrSnapshot();return this._subtype.instantiate(n,r,i,s)}return this._subtype.instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this._subtype.reconcile(n,this.optionalValues.indexOf(r)<0&&this._subtype.is(r)?r:this.getDefaultInstanceOrSnapshot(),i,a)}}),Object.defineProperty(t.prototype,"getDefaultInstanceOrSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=typeof this._defaultValue=="function"?this._defaultValue():this._defaultValue;return typeof this._defaultValue=="function"&&cu(this,n),n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this.optionalValues.indexOf(n)>=0?Ca():this._subtype.validate(n,r)}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this._subtype.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subtype}}),t})(_u);function r2e(e,t){if(typeof t!="function"&&Sr(t))throw new St("default value cannot be an instance, pass a snapshot or a function that creates an instance/snapshot instead")}function bf(e,t,n){return r2e(e,t),new n2e(e,t,n||i2e)}var i2e=[void 0],a2e=bf(Xre,void 0),s2e=bf(Yre,null);function eie(e){return hw(e,a2e)}function o2e(e){return hw(e,s2e)}var l2e=(function(e){tr(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"_definition",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_subType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),i}return Object.defineProperty(t.prototype,"flags",{get:function(){return(this._subType?this._subType.flags:0)|_n.Late},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"getSubType",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(!this._subType){var r=void 0;try{r=this._definition()}catch(i){if(i instanceof ReferenceError)r=void 0;else throw i}if(n&&r===void 0)throw new St("Late type seems to be used too early, the definition (still) returns undefined");r&&(this._subType=r)}return this._subType}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.getSubType(!0).instantiate(n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.getSubType(!0).reconcile(n,r,i,a)}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this.getSubType(!1);return n?n.name:"<uknown late type>"}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this.getSubType(!1);return i?i.validate(n,r):Ca()}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=this.getSubType(!1);return r?r.isAssignableFrom(n):!1}}),Object.defineProperty(t.prototype,"getSubTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(){var n=this.getSubType(!1);return n||Ire}}),t})(_u);function u2e(e,t){var n=typeof e=="string"?e:"late(".concat(e.toString(),")"),r=typeof e=="string"?t:e;return new l2e(n,r)}function c2e(e,t){return new d2e(e,t)}var d2e=(function(e){tr(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Lazy}),Object.defineProperty(i,"loadedType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(i,"pendingNodeList",{enumerable:!0,configurable:!0,writable:!0,value:fr.array()}),wz(function(){return i.pendingNodeList.length>0&&i.pendingNodeList.some(function(a){return a.isAlive&&i.options.shouldLoadPredicate(a.parent?a.parent.value:null)})},function(){i.options.loadType().then(Jr(function(a){i.loadedType=a,i.pendingNodeList.forEach(function(s){s.parent&&i.loadedType&&s.parent.applyPatches([{op:"replace",path:"/".concat(s.subpath),value:s.snapshot}])})}))}),i}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<lazy ".concat(this.name,">")}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this;if(this.loadedType)return this.loadedType.instantiate(n,r,i,a);var o=sd(this,n,r,i,a);return this.pendingNodeList.push(o),wz(function(){return!o.isAlive},function(){return s.pendingNodeList.splice(s.pendingNodeList.indexOf(o),1)}),o}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return this.loadedType?this.loadedType.validate(n,r):zre(n)?Ca():Oa(r,n,"Value is not serializable and cannot be lazy")}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return this.loadedType?(n.die(),this.loadedType.instantiate(i,a,i.environment,r)):e.prototype.reconcile.call(this,n,r,i,a)}}),t})(Kf),tie=(function(e){tr(t,e);function t(n){var r=e.call(this,n?"frozen(".concat(n.name,")"):"frozen")||this;return Object.defineProperty(r,"subType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Frozen}),r}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"<any immutable value>"}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return zre(n)?this.subType?this.subType.validate(n,r):Ca():Oa(r,n,"Value is not serializable and cannot be frozen")}}),t})(Kf),Wz=new tie;function f2e(e){return arguments.length===0?Wz:Eu(e)?new tie(e):bf(Wz,e)}function h2e(e){switch(e){case Qr.beforeDestroy:return"destroy";case Qr.beforeDetach:return"detach";default:return}}var p2e=(function(){function e(t,n){if(Object.defineProperty(this,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"identifier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"node",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"resolvedReference",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),XM(t))this.identifier=t;else if(Sr(t)){var r=On(t);if(!r.identifierAttribute)throw new St("Can only store references with a defined identifier attribute.");var i=r.unnormalizedIdentifier;if(i==null)throw new St("Can only store references to tree nodes with a defined identifier.");this.identifier=i}else throw new St("Can only store references to tree nodes or identifiers, got: '".concat(t,"'"))}return Object.defineProperty(e.prototype,"updateResolvedReference",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var n=t0(this.identifier),r=t.root,i=r.identifierCache.getLastCacheModificationPerId(n);if(!this.resolvedReference||this.resolvedReference.lastCacheModification!==i){var a=this.targetType,s=r.identifierCache.resolve(a,n);if(!s)throw new m2e("[mobx-state-tree] Failed to resolve reference '".concat(this.identifier,"' to type '").concat(this.targetType.name,"' (from node: ").concat(t.path,")"));this.resolvedReference={node:s,lastCacheModification:i}}}}),Object.defineProperty(e.prototype,"resolvedValue",{get:function(){return this.updateResolvedReference(this.node),this.resolvedReference.node.value},enumerable:!1,configurable:!0}),e})(),m2e=(function(e){tr(t,e);function t(n){var r=e.call(this,n)||this;return Object.setPrototypeOf(r,t.prototype),r}return t})(Error),nie=(function(e){tr(t,e);function t(n,r){var i=e.call(this,"reference(".concat(n.name,")"))||this;return Object.defineProperty(i,"targetType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"onInvalidated",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Reference}),i}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isAssignableFrom",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.targetType.isAssignableFrom(n)}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return XM(n)?Ca():Oa(r,n,"Value is not a valid identifier, which is a string or a number")}}),Object.defineProperty(t.prototype,"fireInvalidated",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=r.parent;if(!(!s||!s.isAlive)){var o=s.storedValue;o&&this.onInvalidated({cause:n,parent:o,invalidTarget:a?a.storedValue:void 0,invalidId:i,replaceRef:function(l){Tv(r.root.storedValue,{op:"replace",value:l,path:r.path})},removeRef:function(){WOe(s.type)?this.replaceRef(void 0):Tv(r.root.storedValue,{op:"remove",path:r.path})}})}}}),Object.defineProperty(t.prototype,"addTargetNodeWatcher",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){var i=this,a=this.getValue(n);if(a){var s=On(a),o=function(f,d){var p=h2e(d);p&&i.fireInvalidated(p,n,r,s)},l=s.registerHook(Qr.beforeDetach,o),u=s.registerHook(Qr.beforeDestroy,o);return function(){l(),u()}}}}),Object.defineProperty(t.prototype,"watchTargetNodeForInvalidations",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i){var a=this;if(this.onInvalidated){var s;n.registerHook(Qr.beforeDestroy,function(){s&&s()});var o=function(l){s&&s();var u=n.parent,f=u&&u.storedValue;if(u&&u.isAlive&&f){var d=void 0;i?d=!!i.get(r,f):d=n.root.identifierCache.has(a.targetType,t0(r)),d?s=a.addTargetNodeWatcher(n,r):l||a.fireInvalidated("invalidSnapshotReference",n,r,null)}};n.state===Si.FINALIZED?o(!0):(n.isRoot||n.root.registerHook(Qr.afterCreationFinalization,function(){n.parent&&n.parent.createObservableInstanceIfNeeded()}),n.registerHook(Qr.afterAttach,function(){o(!1)}))}}}),t})(Kf),g2e=(function(e){tr(t,e);function t(n,r){return e.call(this,n,r)||this}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n.isAlive){var r=n.storedValue;return r.resolvedValue}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){var r=n.storedValue;return r.identifier}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?Jke(a):a,o=new p2e(a,this.targetType),l=sd(this,n,r,i,o);return o.node=l,this.watchTargetNodeForInvalidations(l,s,void 0),l}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(!n.isDetaching&&n.type===this){var s=Sr(r),o=n.storedValue;if(!s&&o.identifier===r||s&&o.resolvedValue===r)return n.setParent(i,a),n}var l=this.instantiate(i,a,void 0,r);return n.die(),l}}),t})(nie),b2e=(function(e){tr(t,e);function t(n,r,i){var a=e.call(this,n,i)||this;return Object.defineProperty(a,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),a}return Object.defineProperty(t.prototype,"getValue",{enumerable:!1,configurable:!0,writable:!0,value:function(n){if(n.isAlive){var r=this.options.get(n.storedValue,n.parent?n.parent.storedValue:null);return r}}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(a)?this.options.set(a,n?n.storedValue:null):a,o=sd(this,n,r,i,s);return this.watchTargetNodeForInvalidations(o,s,this.options),o}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=Sr(r)?this.options.set(r,n?n.storedValue:null):r;if(!n.isDetaching&&n.type===this&&n.storedValue===s)return n.setParent(i,a),n;var o=this.instantiate(i,a,void 0,s);return n.die(),o}}),t})(nie);function rie(e,t){var n=t||void 0,r=t?t.onInvalidated:void 0;return n&&(n.get||n.set)?new b2e(e,{get:n.get,set:n.set},r):new g2e(e,r)}function v2e(e,t){var n=rie(e,ya(ya({},t),{onInvalidated:function(r){t&&t.onInvalidated&&t.onInvalidated(r),r.removeRef()}}));return t&&t.acceptsUndefined===!1?n:eie(n)}var iie=(function(e){tr(t,e);function t(n,r){var i=e.call(this,n)||this;return Object.defineProperty(i,"validType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Identifier}),i}return Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(!n||!(n.type instanceof Ov))throw new St("Identifier types can only be instantiated as direct child of a model type");return sd(this,n,r,i,a)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){if(n.storedValue!==r)throw new St("Tried to change identifier from '".concat(n.storedValue,"' to '").concat(r,"'. Changing identifiers is not allowed."));return n.setParent(i,a),n}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){return typeof n!==this.validType?Oa(r,n,"Value is not a valid ".concat(this.describe(),", expected a ").concat(this.validType)):Ca()}}),t})(Kf),y2e=(function(e){tr(t,e);function t(){var n=e.call(this,"identifier","string")||this;return Object.defineProperty(n,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Identifier}),n}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifier"}}),t})(iie),_2e=(function(e){tr(t,e);function t(){return e.call(this,"identifierNumber","number")||this}return Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return n.storedValue}}),Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"identifierNumber"}}),t})(iie),E2e=new y2e,S2e=new _2e;function t0(e){return""+e}function XM(e){return typeof e=="string"||typeof e=="number"}function x2e(e){return new w2e(e)}var w2e=(function(e){tr(t,e);function t(n){var r=e.call(this,n.name)||this;return Object.defineProperty(r,"options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(r,"flags",{enumerable:!0,configurable:!0,writable:!0,value:_n.Custom}),r}return Object.defineProperty(t.prototype,"describe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.name}}),Object.defineProperty(t.prototype,"isValidSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r){if(this.options.isTargetType(n))return Ca();var i=this.options.getValidationMessage(n);return i?Oa(r,n,"Invalid value for type '".concat(this.name,"': ").concat(i)):Ca()}}),Object.defineProperty(t.prototype,"getSnapshot",{enumerable:!1,configurable:!0,writable:!0,value:function(n){return this.options.toSnapshot(n.storedValue)}}),Object.defineProperty(t.prototype,"instantiate",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=this.options.isTargetType(a)?a:this.options.fromSnapshot(a,n&&n.root.environment);return sd(this,n,r,i,s)}}),Object.defineProperty(t.prototype,"reconcile",{enumerable:!1,configurable:!0,writable:!0,value:function(n,r,i,a){var s=!this.options.isTargetType(r);if(!n.isDetaching){var o=n.type===this&&(s?r===n.snapshot:r===n.storedValue);if(o)return n.setParent(i,a),n}var l=s?this.options.fromSnapshot(r,i.root.environment):r,u=this.instantiate(i,a,void 0,l);return n.die(),u}}),t})(Kf),kt={enumeration:JOe,model:zOe,compose:HOe,custom:x2e,reference:rie,safeReference:v2e,union:hw,optional:bf,literal:Jre,maybe:eie,maybeNull:o2e,refinement:QOe,string:Gre,boolean:Kre,number:qre,integer:VOe,float:GOe,finite:qOe,Date:Qre,map:FOe,array:BOe,frozen:f2e,identifier:E2e,identifierNumber:S2e,late:u2e,lazy:c2e,undefined:Xre,null:Yre,snapshotProcessor:MOe};const T2e=kt.enumeration("TerminalStatus",["running","exited","error"]),C2e=kt.model("Terminal",{id:kt.identifier,name:kt.string,cwd:kt.string,status:T2e,exitCode:kt.maybe(kt.number),cols:kt.number,rows:kt.number,createdAt:kt.number,tabId:kt.maybeNull(kt.string),positionInTab:kt.optional(kt.number,0)}).volatile(()=>({xterm:null,attachCleanup:null,isPending:!1,pendingId:null,isStartingUp:!1})).views(e=>({get isAlive(){return e.status==="running"},get isTabTerminal(){return e.tabId!=null}})).actions(e=>({updateFromServer(t){t.name!==void 0&&(e.name=t.name),t.cwd!==void 0&&(e.cwd=t.cwd),t.status!==void 0&&(e.status=t.status),t.exitCode!==void 0&&(e.exitCode=t.exitCode),t.cols!==void 0&&(e.cols=t.cols),t.rows!==void 0&&(e.rows=t.rows),t.tabId!==void 0&&(e.tabId=t.tabId),t.positionInTab!==void 0&&(e.positionInTab=t.positionInTab)},setXterm(t){e.xterm=t},setAttachCleanup(t){e.attachCleanup=t},markExited(t){e.status="exited",e.exitCode=t},assignToTab(t,n){e.tabId=t,n!==void 0&&(e.positionInTab=n)},rename(t){e.name=t},resize(t,n){e.cols=t,e.rows=n},setPending(t,n){e.isPending=t,n!==void 0&&(e.pendingId=n)},setStartingUp(t){e.isStartingUp=t},cleanup(){e.attachCleanup&&(e.attachCleanup(),e.attachCleanup=null),e.xterm=null}})),A2e=kt.model("Tab",{id:kt.identifier,name:kt.string,position:kt.number,directory:kt.maybeNull(kt.string),createdAt:kt.number}).volatile(()=>({isPending:!1})).views(e=>({get terminals(){const t=Ore(e);return t.terminals?.items?t.terminals.items.filter(n=>n.tabId===e.id).sort((n,r)=>n.positionInTab-r.positionInTab):[]},get terminalCount(){return this.terminals.length}})).actions(e=>({updateFromServer(t){t.name!==void 0&&(e.name=t.name),t.directory!==void 0&&(e.directory=t.directory),t.position!==void 0&&(e.position=t.position)},rename(t){e.name=t},setDirectory(t){e.directory=t},setPosition(t){e.position=t},setPending(t){e.isPending=t}})),k2e=kt.map(kt.string),O2e=kt.model("ViewState",{focusedTerminals:kt.optional(k2e,{}),currentView:kt.maybeNull(kt.string),currentTaskId:kt.maybeNull(kt.string),isTabVisible:kt.maybeNull(kt.boolean),viewUpdatedAt:kt.maybeNull(kt.string)}).volatile(()=>({pendingUpdates:{},debounceTimer:null})).views(e=>({getFocusedTerminal(t){return e.focusedTerminals.get(t)??null}})).actions(e=>({setFocusedTerminal(t,n){n===null?e.focusedTerminals.delete(t):e.focusedTerminals.set(t,n)},clearFocusedTerminalForTab(t){e.focusedTerminals.delete(t)},updateViewTracking(t,n){e.currentView=t,e.currentTaskId=n,e.viewUpdatedAt=new Date().toISOString()},setTabVisible(t){e.isTabVisible=t,e.viewUpdatedAt=new Date().toISOString()},hydrateFromServer(t){if(t.focusedTerminals){e.focusedTerminals.clear();for(const[n,r]of Object.entries(t.focusedTerminals))e.focusedTerminals.set(n,r)}t.currentView!==void 0&&(e.currentView=t.currentView),t.currentTaskId!==void 0&&(e.currentTaskId=t.currentTaskId),t.isTabVisible!==void 0&&(e.isTabVisible=t.isTabVisible),t.viewUpdatedAt!==void 0&&(e.viewUpdatedAt=t.viewUpdatedAt)}}));function hD(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).substring(2,11)}`}function Vz(){return`temp-${hD()}`}const R2e=kt.model("TerminalsStore",{items:kt.array(C2e)}).views(e=>({get(t){return e.items.find(n=>n.id===t)},getByTab(t){return e.items.filter(n=>n.tabId===t).sort((n,r)=>n.positionInTab-r.positionInTab)},get taskTerminals(){return e.items.filter(t=>t.tabId==null)},has(t){return e.items.some(n=>n.id===t)}})).actions(e=>({add(t){if(e.items.some(n=>n.id===t.id)){At.ws.debug("Terminal already exists, skipping add",{id:t.id});return}e.items.push(t)},remove(t){const n=e.items.find(r=>r.id===t);n&&(n.cleanup(),aS(n))},replaceAll(t){for(const n of e.items)n.cleanup();e.items.clear();for(const n of t)e.items.push(n)},clear(){for(const t of e.items)t.cleanup();e.items.clear()}})),N2e=kt.model("TabsStore",{items:kt.array(A2e)}).views(e=>({get(t){return e.items.find(n=>n.id===t)},get sorted(){return[...e.items].sort((t,n)=>t.position-n.position)},has(t){return e.items.some(n=>n.id===t)},get first(){return this.sorted[0]}})).actions(e=>({add(t){if(e.items.some(n=>n.id===t.id)){At.ws.debug("Tab already exists, skipping add",{id:t.id});return}e.items.push(t)},remove(t){const n=e.items.find(r=>r.id===t);n&&aS(n)},replaceAll(t){e.items.clear();for(const n of t)e.items.push(n)},clear(){e.items.clear()}})),I2e=kt.model("RootStore",{terminals:kt.optional(R2e,{items:[]}),tabs:kt.optional(N2e,{items:[]}),viewState:kt.optional(O2e,{})}).volatile(()=>({connected:!1,initialized:!1,hasEverConnected:!1,reconnectAttempt:0,maxReconnectAttempts:10,newTerminalIds:new Set,pendingUpdates:new Map,onAttachedCallbacks:new Map,terminalsReadyForCallback:new Set,lastFocusedTerminalId:null,terminalsPendingStartup:new Map,pendingTabCreation:null,lastCreatedTabId:null,broadcastedTheme:null})).views(e=>({get isReady(){return e.connected&&e.initialized}})).actions(e=>{const t=()=>eOe(e);return{setConnected(n){const r=e.connected;if(e.connected=n,!n)e.initialized=!1;else if(!r&&n&&(e.hasEverConnected=!0,e.reconnectAttempt=0,e.pendingUpdates.size>0)){t().log.ws.info("Reconnected: clearing stale pending updates",{count:e.pendingUpdates.size});for(const i of e.pendingUpdates.values())if(i.entityType==="terminal"){const a=e.terminals.get(i.tempId);a&&(a.cleanup(),e.terminals.remove(i.tempId)),e.newTerminalIds.delete(i.tempId)}else i.entityType==="tab"&&e.tabs.remove(i.tempId);e.pendingUpdates.clear()}},setInitialized(n){e.initialized=n},setReconnectAttempt(n){e.reconnectAttempt=n},setMaxReconnectAttempts(n){e.maxReconnectAttempts=n},markNewTerminal(n){e.newTerminalIds.add(n)},clearNewTerminal(n){e.newTerminalIds.delete(n)},setLastFocusedTerminal(n){e.lastFocusedTerminalId=n},consumePendingStartup(n){const r=e.terminalsPendingStartup.get(n);return r&&(e.terminalsPendingStartup.delete(n),t().log.ws.info("consumed pending startup",{terminalId:n,taskName:r.taskName})),r},clearStartingUp(n){const r=e.terminals.get(n);r&&(r.setStartingUp(!1),t().log.ws.info("cleared isStartingUp",{terminalId:n}))},setPendingTabCreation(n){e.pendingTabCreation=n},clearLastCreatedTabId(){e.lastCreatedTabId=null},syncTheme(n){t().send({type:"theme:sync",payload:{theme:n}})},clearBroadcastedTheme(){e.broadcastedTheme=null},createTerminal(n){const r=hD(),i=Vz(),a={id:i,name:n.name,cwd:n.cwd??"~",status:"running",cols:n.cols,rows:n.rows,createdAt:Date.now(),tabId:n.tabId??null,positionInTab:n.positionInTab??0},s=Mz(e.terminals);e.terminals.add(a),s.stop();const o=e.terminals.get(i);o?.setPending(!0,i),e.pendingUpdates.set(r,{entityType:"terminal",tempId:i,inversePatches:s.inversePatches,createdAt:Date.now()}),e.newTerminalIds.add(i),n.startup&&(e.terminalsPendingStartup.set(i,n.startup),o?.setStartingUp(!0),t().log.ws.info("createTerminal registered startup",{tempId:i,taskName:n.startup.taskName,isStartingUp:o?.isStartingUp}));const{startup:l,...u}=n;t().send({type:"terminal:create",payload:{...u,requestId:r,tempId:i}}),t().log.ws.debug("createTerminal optimistic",{requestId:r,tempId:i,name:n.name})},destroyTerminal(n,r){t().send({type:"terminal:destroy",payload:{terminalId:n,force:r?.force,reason:r?.reason}});const i=e.terminals.get(n);i&&i.cleanup(),e.terminals.remove(n)},writeToTerminal(n,r){t().send({type:"terminal:input",payload:{terminalId:n,data:r}})},sendInputToTerminal(n,r){t().send({type:"terminal:input",payload:{terminalId:n,data:r}}),setTimeout(()=>{t().send({type:"terminal:input",payload:{terminalId:n,data:"\r"}})},50)},resizeTerminal(n,r,i){t().send({type:"terminal:resize",payload:{terminalId:n,cols:r,rows:i}}),e.terminals.get(n)?.resize(r,i)},renameTerminal(n,r){t().send({type:"terminal:rename",payload:{terminalId:n,name:r}}),e.terminals.get(n)?.rename(r)},attachXterm(n,r,i){const a=e.terminals.get(n);if(!a)return t().log.ws.warn("attachXterm: terminal not found",{terminalId:n}),()=>{};if(a.xterm===r)return t().log.ws.debug("attachXterm: already attached, skipping",{terminalId:n}),i?.onAttached&&(e.terminalsReadyForCallback.has(n)?(e.terminalsReadyForCallback.delete(n),setTimeout(()=>i.onAttached?.(n),0)):e.onAttachedCallbacks.set(n,i.onAttached)),a.attachCleanup||(()=>{});a.attachCleanup&&a.attachCleanup(),a.setXterm(r),r.attachCustomKeyEventHandler(u=>u.type==="keydown"&&u.shiftKey&&u.key==="Enter"?(u.preventDefault(),u.stopPropagation(),t().send({type:"terminal:input",payload:{terminalId:n,data:`
31
+ `}}),!1):!0);const s=r.onData(u=>{t().send({type:"terminal:input",payload:{terminalId:n,data:u}})}),o=()=>{this.setLastFocusedTerminal(n)};r.textarea?.addEventListener("focus",o),i?.onAttached&&(e.terminalsReadyForCallback.has(n)?(t().log.ws.debug("attachXterm: terminal already attached, calling callback immediately",{terminalId:n}),e.terminalsReadyForCallback.delete(n),setTimeout(()=>i.onAttached?.(n),0)):(t().log.ws.debug("attachXterm: registering onAttached callback",{terminalId:n,existingCallbacks:Array.from(e.onAttachedCallbacks.keys())}),e.onAttachedCallbacks.set(n,i.onAttached)));const l=()=>{s.dispose(),r.textarea?.removeEventListener("focus",o),e.terminals.get(n)?.setXterm(null)};return a.setAttachCleanup(l),t().send({type:"terminal:attach",payload:{terminalId:n}}),l},requestAttach(n){t().send({type:"terminal:attach",payload:{terminalId:n}})},clearTerminalBuffer(n){t().send({type:"terminal:clearBuffer",payload:{terminalId:n}})},assignTerminalToTab(n,r,i){t().send({type:"terminal:assignTab",payload:{terminalId:n,tabId:r,positionInTab:i}}),e.terminals.get(n)?.assignToTab(r,i)},createTab(n,r,i,a){const s=hD(),o=Vz(),l=r??e.tabs.items.length,u={id:o,name:n,position:l,directory:i??null,createdAt:Date.now()},f=Mz(e.tabs);e.tabs.add(u),f.stop(),e.tabs.get(o)?.setPending(!0),e.pendingTabCreation=o,e.pendingUpdates.set(s,{entityType:"tab",tempId:o,inversePatches:f.inversePatches,createdAt:Date.now()}),t().send({type:"tab:create",payload:{name:n,position:r,directory:i,adoptTerminalId:a,requestId:s,tempId:o}}),t().log.ws.debug("createTab optimistic",{requestId:s,tempId:o,name:n,adoptTerminalId:a})},updateTab(n,r){t().send({type:"tab:update",payload:{tabId:n,...r}}),e.tabs.get(n)?.updateFromServer(r)},deleteTab(n){t().send({type:"tab:delete",payload:{tabId:n}}),e.tabs.remove(n),e.viewState.clearFocusedTerminalForTab(n)},reorderTab(n,r){const i=e.tabs.get(n);if(!i)return;const a=i.position;if(t().send({type:"tab:reorder",payload:{tabId:n,position:r}}),r>a)for(const s of e.tabs.items)s.position>a&&s.position<=r&&s.setPosition(s.position-1);else if(r<a)for(const s of e.tabs.items)s.position>=r&&s.position<a&&s.setPosition(s.position+1);i.setPosition(r)},handleMessage(n){const{type:r,payload:i}=n;switch(r){case"terminals:list":e.terminals.replaceAll(i.terminals);break;case"terminal:created":{const{terminal:a,isNew:s,requestId:o,tempId:l}=i;if(o&&l){const u=e.pendingUpdates.get(o);if(u&&u.tempId===l){e.pendingUpdates.delete(o);const f=e.terminals.get(l);if(f){const d=f.xterm,p=e.onAttachedCallbacks.get(l),m=f.attachCleanup;if(t().log.ws.info("terminal:created optimistic handling",{tempId:l,realId:a.id,hasXterm:!!d,hasCallback:!!p,isNew:s}),m&&m(),f.setXterm(null),f.setAttachCleanup(null),e.onAttachedCallbacks.delete(l),s){const y=f.isStartingUp,S=e.terminals.items.findIndex(v=>v.id===l);S>=0&&aS(e.terminals.items[S]),e.terminals.add(a);const g=e.terminals.get(a.id);y&&g&&(g.setStartingUp(!0),t().log.ws.info("terminal:created transferred isStartingUp",{tempId:l,realId:a.id,isStartingUp:g.isStartingUp})),t().log.ws.info("terminal:created re-attaching xterm",{realId:a.id,hasRealTerminal:!!g,hasXterm:!!d,willAttach:!!(g&&d)}),g&&d?this.attachXterm(a.id,d,{onAttached:p}):p&&(t().log.ws.info("terminal:created preserving callback for later",{realId:a.id}),e.onAttachedCallbacks.set(a.id,p)),e.newTerminalIds.delete(l),e.newTerminalIds.add(a.id);const _=e.terminalsPendingStartup.get(l);_&&(e.terminalsPendingStartup.delete(l),e.terminalsPendingStartup.set(a.id,_),t().log.ws.debug("transferred pending startup",{tempId:l,realId:a.id})),t().log.ws.debug("terminal:created confirmed",{requestId:o,tempId:l,realId:a.id,xtermReattached:!!d,hasPendingStartup:!!_})}else{const y=e.terminals.items.findIndex(g=>g.id===l);y>=0&&aS(e.terminals.items[y]),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l),e.terminals.has(a.id)||e.terminals.add(a),e.terminals.get(a.id)&&d&&this.attachXterm(a.id,d,{onAttached:p}),t().log.ws.debug("terminal:created deduplicated",{requestId:o,tempId:l,existingId:a.id,xtermReattached:!!d})}}break}}e.terminals.add(a),s&&e.newTerminalIds.add(a.id);break}case"terminal:destroyed":{const{terminalId:a}=i;e.terminals.remove(a),e.newTerminalIds.delete(a),e.terminalsReadyForCallback.delete(a),e.onAttachedCallbacks.delete(a);break}case"terminal:output":{const{terminalId:a,data:s}=i,o=e.terminals.get(a);o?.xterm?o.xterm.write(s):t().log.ws.warn("terminal:output but no xterm",{terminalId:a});break}case"terminal:attached":{const{terminalId:a,buffer:s}=i,o=e.terminals.get(a);t().log.ws.info("terminal:attached received",{terminalId:a,hasTerminal:!!o,hasXterm:!!o?.xterm,bufferLength:s?.length??0,hasCallback:e.onAttachedCallbacks.has(a),isReadyForCallback:e.terminalsReadyForCallback.has(a),registeredCallbacks:Array.from(e.onAttachedCallbacks.keys())}),o?.xterm&&(o.xterm.reset(),s&&o.xterm.write(s));const l=e.onAttachedCallbacks.get(a);l?(e.onAttachedCallbacks.delete(a),t().log.ws.debug("terminal:attached calling callback",{terminalId:a}),l(a)):(t().log.ws.debug("terminal:attached no callback yet, marking ready",{terminalId:a}),e.terminalsReadyForCallback.add(a));break}case"terminal:bufferCleared":{const{terminalId:a}=i,s=e.terminals.get(a);s?.xterm&&s.xterm.reset();break}case"terminal:exit":{const{terminalId:a,exitCode:s}=i;e.terminals.get(a)?.markExited(s);break}case"terminal:renamed":{const{terminalId:a,name:s}=i;e.terminals.get(a)?.rename(s);break}case"terminal:tabAssigned":{const{terminalId:a,tabId:s,positionInTab:o}=i;e.terminals.get(a)?.assignToTab(s,o);break}case"tabs:list":e.tabs.replaceAll(i.tabs),e.initialized=!0;break;case"tab:created":{const{tab:a,requestId:s,tempId:o,adoptTerminalId:l}=i;if(s&&o){const u=e.pendingUpdates.get(s);if(u&&u.tempId===o){e.pendingUpdates.delete(s),e.tabs.get(o)&&(e.tabs.remove(o),e.tabs.add(a),e.pendingTabCreation=null,l||(e.lastCreatedTabId=a.id),t().log.ws.debug("tab:created confirmed",{requestId:s,tempId:o,realId:a.id,adoptTerminalId:l}));break}}e.tabs.add(a);break}case"tab:updated":{const{tabId:a,name:s,directory:o}=i;e.tabs.get(a)?.updateFromServer({name:s,directory:o});break}case"tab:deleted":{const{tabId:a}=i;e.tabs.remove(a),e.viewState.clearFocusedTerminalForTab(a);break}case"terminal:error":{const{error:a,requestId:s,tempId:o}=i;if(s&&o){const l=e.pendingUpdates.get(s);if(l&&l.tempId===o){e.pendingUpdates.delete(s);for(let u=l.inversePatches.length-1;u>=0;u--)Tv(e.terminals,l.inversePatches[u]);e.newTerminalIds.delete(o),e.terminalsPendingStartup.delete(o),t().log.ws.warn("terminal:error rollback",{requestId:s,tempId:o,error:a});break}}At.ws.error("Terminal error from server",{error:a});break}case"sync:stale":{const{entityType:a,entityId:s,requestId:o,tempId:l,error:u}=i;if(t().log.ws.warn("sync:stale received",{entityType:a,entityId:s,error:u}),o&&l){const f=e.pendingUpdates.get(o);if(f&&f.tempId===l)if(e.pendingUpdates.delete(o),f.entityType==="terminal"){const d=e.terminals.get(l);d&&(d.cleanup(),e.terminals.remove(l)),e.newTerminalIds.delete(l),e.terminalsPendingStartup.delete(l)}else f.entityType==="tab"&&e.tabs.remove(l)}if(a==="terminal"){if(e.terminals.has(s)){const f=e.terminals.get(s);f&&(f.cleanup(),e.terminals.remove(s))}e.terminalsPendingStartup.delete(s)}else a==="tab"&&e.tabs.has(s)&&(e.tabs.remove(s),e.viewState.clearFocusedTerminalForTab(s));break}case"theme:synced":{const{theme:a}=i;e.broadcastedTheme=a,t().log.ws.debug("theme:synced received",{theme:a});break}}},reset(){e.terminals.clear(),e.tabs.clear(),e.connected=!1,e.initialized=!1,e.newTerminalIds.clear(),e.pendingUpdates.clear(),e.terminalsPendingStartup.clear()}}});function aie(){const e=Mm();return k.useMemo(()=>{const t=(n,r)=>{const i=async a=>{const s=a.clipboardData?.items;if(s){for(const o of s)if(o.type.startsWith("image/")){a.preventDefault(),a.stopPropagation();const l=o.getAsFile();if(!l)return;try{const u=await Cte(l);e.writeToTerminal(r,u)}catch(u){At.ws.error("Failed to upload image",{error:String(u)})}return}}};return n.addEventListener("paste",i,!0),()=>{n.removeEventListener("paste",i,!0)}};return{get terminals(){return[...e.terminals.items]},get terminalsLoaded(){return e.initialized},get tabs(){return[...e.tabs.sorted]},get connected(){return e.connected},get newTerminalIds(){return e.newTerminalIds},get pendingTabCreation(){return e.pendingTabCreation},get lastCreatedTabId(){return e.lastCreatedTabId},createTerminal:e.createTerminal.bind(e),destroyTerminal:e.destroyTerminal.bind(e),writeToTerminal:e.writeToTerminal.bind(e),sendInputToTerminal:e.sendInputToTerminal.bind(e),resizeTerminal:e.resizeTerminal.bind(e),renameTerminal:e.renameTerminal.bind(e),clearTerminalBuffer:e.clearTerminalBuffer.bind(e),assignTerminalToTab:e.assignTerminalToTab.bind(e),createTab:e.createTab.bind(e),updateTab:e.updateTab.bind(e),deleteTab:e.deleteTab.bind(e),reorderTab:e.reorderTab.bind(e),attachXterm:e.attachXterm.bind(e),setupImagePaste:t,consumePendingStartup:e.consumePendingStartup.bind(e),clearStartingUp:e.clearStartingUp.bind(e),clearLastCreatedTabId:e.clearLastCreatedTabId.bind(e)}},[e])}const Ek="",D2e=kt.model("File",{path:kt.identifier,content:kt.string,originalContent:kt.string,mimeType:kt.string,size:kt.number,lineCount:kt.number,truncated:kt.boolean,isMarkdownView:kt.optional(kt.boolean,!1)}).views(e=>({get isDirty(){return e.content!==e.originalContent},get isMarkdown(){return e.path.toLowerCase().endsWith(".md")},get isImage(){return e.mimeType.startsWith("image/")},get isBinary(){return e.mimeType==="application/octet-stream"},get isEditable(){return!e.mimeType.startsWith("image/")&&e.mimeType!=="application/octet-stream"}})).actions(e=>({setContent(t){e.content=t},markSaved(){e.originalContent=e.content},toggleMarkdownView(){e.isMarkdownView=!e.isMarkdownView},setMarkdownView(t){e.isMarkdownView=t}})),L2e=kt.model("FilesStore",{selectedFile:kt.maybeNull(kt.string),expandedDirs:kt.array(kt.string),openFiles:kt.map(D2e)}).volatile(()=>({worktreePath:null,readOnly:!1,isLoading:!1,isSaving:!1,loadError:null,saveError:null,fileTree:null,isLoadingTree:!1,treeError:null})).views(e=>({get currentFile(){if(e.selectedFile)return e.openFiles.get(e.selectedFile)},get isDirty(){return(e.selectedFile?e.openFiles.get(e.selectedFile):void 0)?.isDirty??!1},isFileMarkdownView(t){return e.openFiles.get(t)?.isMarkdownView??!1},isDirExpanded(t){return e.expandedDirs.includes(t)}})).actions(e=>({setWorktreePath(t){e.worktreePath!==t&&(e.worktreePath=t,e.selectedFile=null,e.expandedDirs.clear(),e.openFiles.clear(),e.fileTree=null)},setReadOnly(t){e.readOnly=t},selectFile(t){e.selectedFile=t},toggleDir(t){const n=e.expandedDirs.indexOf(t);n>=0?e.expandedDirs.splice(n,1):e.expandedDirs.push(t)},collapseAll(){e.expandedDirs.clear()},updateContent(t,n){const r=e.openFiles.get(t);r&&r.setContent(n)},toggleMarkdownView(t){const n=e.openFiles.get(t);n&&n.toggleMarkdownView()},_setLoading(t){e.isLoading=t},_setLoadError(t){e.loadError=t},_setSaving(t){e.isSaving=t},_setSaveError(t){e.saveError=t},_setFileTree(t){e.fileTree=t},_setLoadingTree(t){e.isLoadingTree=t},_setTreeError(t){e.treeError=t},_addFile(t){e.openFiles.set(t.path,{path:t.path,content:t.content,originalContent:t.content,mimeType:t.mimeType,size:t.size,lineCount:t.lineCount,truncated:t.truncated,isMarkdownView:!1})},_markFileSaved(t){const n=e.openFiles.get(t);n&&n.markSaved()}})).actions(e=>({loadFileTree:vk(function*(){if(e.worktreePath){e._setLoadingTree(!0),e._setTreeError(null);try{const t=yield $t(`${Ek}/api/fs/tree?root=${encodeURIComponent(e.worktreePath)}`);e._setFileTree(t.entries)}catch(t){e._setTreeError(t instanceof Error?t.message:"Failed to load file tree")}finally{e._setLoadingTree(!1)}}}),loadFile:vk(function*(t){if(e.worktreePath){if(e.openFiles.has(t)){e.selectedFile=t;return}e._setLoading(!0),e._setLoadError(null);try{const n=new URLSearchParams({path:t,root:e.worktreePath}),r=yield $t(`${Ek}/api/fs/read?${n}`);e._addFile({path:t,content:r.content,mimeType:r.mimeType,size:r.size,lineCount:r.lineCount,truncated:r.truncated}),e.selectedFile=t}catch(n){e._setLoadError(n instanceof Error?n.message:"Failed to load file")}finally{e._setLoading(!1)}}}),saveFile:vk(function*(t){if(!e.worktreePath)return;const n=e.openFiles.get(t);if(!(!n||!n.isDirty)){e._setSaving(!0),e._setSaveError(null);try{(yield fetch(`${Ek}/api/fs/write`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,root:e.worktreePath,content:n.content})}).then(i=>i.ok?i.json():i.json().then(a=>{throw new Error(a.error||"Failed to save file")}))).success&&e._markFileSaved(t)}catch(r){throw e._setSaveError(r instanceof Error?r.message:"Failed to save file"),r}finally{e._setSaving(!1)}}}),closeFile(t){e.openFiles.delete(t),e.selectedFile===t&&(e.selectedFile=null)}}));function P2e(){return L2e.create({selectedFile:null,expandedDirs:[],openFiles:{}})}const sie=k.createContext(null);function M2e(e,t=!1,n){const r=k.useMemo(()=>P2e(),[]),i=k.useRef(!1);return k.useEffect(()=>{r.setWorktreePath(e),r.setReadOnly(t),i.current=!1,e&&r.loadFileTree().then(()=>{n&&!i.current&&(i.current=!0,r.selectFile(n),r.loadFile(n))})},[r,e,t,n]),r}function j2e(){const e=k.useContext(sie);if(!e)throw new Error("useFilesStore must be used within a FilesStoreProvider");return e}function oie(){const e=j2e();return{worktreePath:e.worktreePath,readOnly:e.readOnly,selectedFile:e.selectedFile,currentFile:e.currentFile,expandedDirs:[...e.expandedDirs],fileTree:e.fileTree,isLoading:e.isLoading,isSaving:e.isSaving,isLoadingTree:e.isLoadingTree,loadError:e.loadError,saveError:e.saveError,treeError:e.treeError,isDirty:e.isDirty,selectFile:e.selectFile,loadFile:e.loadFile,saveFile:e.saveFile,closeFile:e.closeFile,updateContent:e.updateContent,toggleDir:e.toggleDir,collapseAll:e.collapseAll,toggleMarkdownView:e.toggleMarkdownView,isFileMarkdownView:e.isFileMarkdownView,isDirExpanded:e.isDirExpanded,refreshTree:e.loadFileTree}}const lie=k.createContext(null);function Mm(){const e=k.useContext(lie);if(!e)throw new Error("useStore must be used within a StoreProvider");return e}function F2e(){return`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`}function B2e({children:e,wsUrl:t=F2e(),reconnectInterval:n=2e3,maxReconnectAttempts:r=10}){const i=k.useRef(null),a=k.useRef(0),s=k.useRef(void 0),o=k.useRef(null),[,l]=k.useState({}),u=k.useCallback(d=>{i.current?.readyState===WebSocket.OPEN?(At.ws.debug("send",{type:d.type}),i.current.send(JSON.stringify(d))):At.ws.warn("send dropped (WebSocket not open)",{type:d.type,readyState:i.current?.readyState??"no socket"})},[]);if(!o.current){const d={send:u,log:At};o.current=I2e.create({},d)}const f=o.current;return k.useEffect(()=>{f.setMaxReconnectAttempts(r)},[f,r]),k.useEffect(()=>{let d=!0;const p=()=>{const m=i.current;if(m&&(m.readyState===WebSocket.CONNECTING||m.readyState===WebSocket.OPEN))return;const y=new WebSocket(t);i.current=y,y.onopen=()=>{d&&(At.ws.info("WebSocket connected"),f.setConnected(!0),a.current=0)},y.onmessage=S=>{if(d)try{const g=JSON.parse(S.data);f.handleMessage(g)}catch(g){At.ws.error("Failed to parse WebSocket message",{error:String(g)})}},y.onclose=()=>{if(d)if(At.ws.info("WebSocket disconnected"),f.setConnected(!1),i.current===y&&(i.current=null),a.current<r){a.current++,f.setReconnectAttempt(a.current);const S=n*Math.pow(1.5,a.current-1);At.ws.info("Scheduling reconnect",{attempt:a.current,delay:S}),s.current=setTimeout(p,S)}else At.ws.warn("Max reconnect attempts reached"),f.setReconnectAttempt(a.current)},y.onerror=S=>{At.ws.error("WebSocket error",{event:String(S)})}};return p(),()=>{d=!1,s.current&&clearTimeout(s.current);const m=i.current;m?.readyState===WebSocket.OPEN&&m.close(),i.current=null}},[t,n,r,f]),k.useEffect(()=>{l({})},[]),b.jsx(lie.Provider,{value:f,children:e})}function uie(){const e=Mm(),{setTheme:t,resolvedTheme:n,theme:r}=qc(),{data:i}=Jxe(),a=k.useRef(void 0),s=k.useRef(!1),o=k.useRef(!1);k.useEffect(()=>$M(()=>e.broadcastedTheme,f=>{f&&(o.current=!0,t(f),e.clearBroadcastedTheme(),setTimeout(()=>{o.current=!1},0))},{fireImmediately:!0}),[e,t]),k.useEffect(()=>{if(!n)return;const u=n==="dark"?"/logo-dark.jpg":"/logo-light.jpg";let f=document.querySelector('link[rel="icon"]');f||(f=document.createElement("link"),f.rel="icon",document.head.appendChild(f)),f.type="image/jpeg",f.href=u},[n]),k.useEffect(()=>{const u=s.current&&i&&a.current===!1;a.current=i,s.current=!0,n&&u&&$t("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:n})}).catch(()=>{})},[i,n]);const l=k.useCallback(u=>{if(!o.current&&(t(u),e.syncTheme(u),i)){const f=u==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":u;$t("/api/config/sync-claude-theme",{method:"POST",body:JSON.stringify({resolvedTheme:f})}).catch(()=>{})}},[t,e,i]);return{theme:r??"system",resolvedTheme:n,syncClaudeCode:i,changeTheme:l,isUpdating:!1}}let Sk=!1;const Gz={activeTabId:null,focusedTerminals:{},currentView:null,currentTaskId:null,isTabVisible:null,viewUpdatedAt:null};function cie(){const e=wr(),t=k.useRef(void 0),n=k.useRef({}),{data:r=Gz,isLoading:i}=qn({queryKey:["terminal-view-state"],queryFn:async()=>{const p=await fetch("/api/terminal-view-state");if(!p.ok)throw new Error("Failed to fetch terminal view state");return p.json()},staleTime:2e3}),a=zn({mutationFn:async p=>{const m=await fetch("/api/terminal-view-state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(p)});if(!m.ok)throw new Error("Failed to update terminal view state");return m.json()},onSuccess:p=>{e.setQueryData(["terminal-view-state"],p)}}),s=k.useRef(a);s.current=a;const o=k.useCallback(p=>{const m=n.current;n.current={...m,...p,focusedTerminals:p.focusedTerminals||m.focusedTerminals?{...m.focusedTerminals,...p.focusedTerminals}:void 0};const y=n.current;e.setQueryData(["terminal-view-state"],S=>{const g=S??Gz;return{activeTabId:y.activeTabId!==void 0?y.activeTabId:g.activeTabId,focusedTerminals:{...g.focusedTerminals,...y.focusedTerminals},currentView:y.currentView!==void 0?y.currentView:g.currentView,currentTaskId:y.currentTaskId!==void 0?y.currentTaskId:g.currentTaskId,isTabVisible:y.isTabVisible!==void 0?y.isTabVisible:g.isTabVisible,viewUpdatedAt:y.viewUpdatedAt!==void 0?y.viewUpdatedAt:g.viewUpdatedAt}}),t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{s.current.mutate(n.current),n.current={}},500)},[e]),l=k.useCallback((p,m)=>{if(m===null){const y=e.getQueryData(["terminal-view-state"]);if(y){const{[p]:S,...g}=y.focusedTerminals;o({focusedTerminals:g})}}else o({focusedTerminals:{[p]:m}})},[e,o]),u=k.useCallback(p=>r.focusedTerminals[p]??null,[r.focusedTerminals]),f=k.useRef(!1);k.useEffect(()=>{if(Sk){f.current=!1;return}Sk=!0,f.current=!0;const p=()=>{o({isTabVisible:document.visibilityState==="visible",viewUpdatedAt:new Date().toISOString()})};return document.addEventListener("visibilitychange",p),p(),()=>{document.removeEventListener("visibilitychange",p),f.current&&(Sk=!1)}},[o]);const d=k.useCallback((p,m,y)=>{o({currentView:p,currentTaskId:m,activeTabId:y,viewUpdatedAt:new Date().toISOString()})},[o]);return{viewState:r,isLoading:i,getFocusedTerminal:u,setFocusedTerminal:l,updateViewTracking:d}}function no(e,t){const n=e.toLowerCase(),r=t.toLowerCase();if(n===r)return 100;if(n.startsWith(r))return 80;if(n.includes(r))return 60;let i=0,a=0,s=0;for(;i<n.length&&a<r.length;)n[i]===r[a]&&(s+=1,a++),i++;return a===r.length?s:0}function U2e(e,t){return t.trim()?e.map(r=>{let i=no(r.label,t);if(r.keywords)for(const a of r.keywords){const s=no(a,t);s>i&&(i=s)}return{command:r,score:i}}).filter(({score:r})=>r>0).sort((r,i)=>i.score-r.score).map(({command:r})=>r):e}function $2e(e){const t=new Map;for(const n of e){const r=t.get(n.category)||[];r.push(n),t.set(n.category,r)}return t}function z2e({open:e,onOpenChange:t,onNewTask:n,onShowShortcuts:r}){const{t:i}=tn("navigation"),[a,s]=k.useState(!1),o=e??a,l=t??s,[u,f]=k.useState(""),[d,p]=k.useState(0),m=k.useRef(null),y=k.useRef(null),S=Wi(),g=k.useMemo(()=>[{id:"goto-tasks",label:i("commandPalette.commands.goToTasks"),shortcut:"meta+1",keywords:["kanban","board","home"],category:"navigation",icon:b.jsx(fe,{icon:Dp,size:16,strokeWidth:2}),action:()=>{S({to:"/tasks"}),l(!1)}},{id:"goto-terminals",label:i("commandPalette.commands.goToTerminals"),shortcut:"meta+2",keywords:["shell","console","cli"],category:"navigation",icon:b.jsx(fe,{icon:x1e,size:16,strokeWidth:2}),action:()=>{S({to:"/terminals"}),l(!1)}},{id:"goto-task-terminals",label:i("commandPalette.commands.goToTaskTerminals"),shortcut:"meta+i",keywords:["tasks","shell","console","cli"],category:"navigation",icon:b.jsx(fe,{icon:Dp,size:16,strokeWidth:2}),action:()=>{S({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:b.jsx(fe,{icon:R1e,size:16,strokeWidth:2}),action:()=>{S({to:"/worktrees"}),l(!1)}},{id:"goto-repositories",label:i("commandPalette.commands.goToRepositories"),shortcut:"meta+4",keywords:["repos","git","projects"],category:"navigation",icon:b.jsx(fe,{icon:T1e,size:16,strokeWidth:2}),action:()=>{S({to:"/repositories"}),l(!1)}},{id:"goto-settings",label:i("commandPalette.commands.goToSettings"),shortcut:"meta+,",keywords:["preferences","config","configuration"],category:"navigation",icon:b.jsx(fe,{icon:cte,size:16,strokeWidth:2}),action:()=>{S({to:"/settings"}),l(!1)}},{id:"new-task",label:i("commandPalette.commands.newTask"),shortcut:"meta+j",keywords:["create","add"],category:"actions",icon:b.jsx(fe,{icon:Ev,size:16,strokeWidth:2}),action:()=>{l(!1),n?.()}},{id:"show-shortcuts",label:i("commandPalette.commands.keyboardShortcuts"),shortcut:"meta+/",keywords:["help","hotkeys","keys"],category:"actions",icon:b.jsx(fe,{icon:ste,size:16,strokeWidth:2}),action:()=>{l(!1),r?.()}}],[S,n,r,l,i]),_=k.useMemo(()=>U2e(g,u),[g,u]),v=k.useMemo(()=>$2e(_),[_]),x=k.useMemo(()=>{const C=[],R=["navigation","actions"];for(const O of R){const N=v.get(O);N&&C.push(...N)}return C},[v]);k.useEffect(()=>{p(0)},[u]),k.useEffect(()=>{if(!y.current)return;const C=y.current.querySelector('[data-selected="true"]');C&&C.scrollIntoView({block:"nearest"})},[d]),Es("meta+k",()=>l(!0),{allowInInput:!0,allowInTerminal:!0}),Es("meta+1",()=>S({to:"/tasks"}),{allowInInput:!0,allowInTerminal:!0}),Es("meta+2",()=>S({to:"/terminals"}),{allowInInput:!0,allowInTerminal:!0}),Es("meta+i",()=>{S({to:"/terminals",search:{tab:"all-tasks"}})},{allowInInput:!0,allowInTerminal:!0}),Es("meta+3",()=>S({to:"/worktrees"}),{allowInInput:!0,allowInTerminal:!0}),Es("meta+4",()=>S({to:"/repositories"}),{allowInInput:!0,allowInTerminal:!0}),Es("meta+,",()=>S({to:"/settings"}),{allowInInput:!0,allowInTerminal:!0}),Es("meta+j",()=>{n?.()},{allowInInput:!1,deps:[n]}),Es("meta+/",()=>{r?.()},{allowInInput:!0,allowInTerminal:!0,deps:[r]});const T=k.useCallback(C=>{switch(C.key){case"ArrowDown":C.preventDefault(),p(R=>Math.min(R+1,x.length-1));break;case"ArrowUp":C.preventDefault(),p(R=>Math.max(R-1,0));break;case"Enter":C.preventDefault(),x[d]&&x[d].action();break;case"Escape":C.preventDefault(),l(!1);break}},[x,d,l]);k.useEffect(()=>{o&&(f(""),p(0),setTimeout(()=>m.current?.focus(),50))},[o]);let w=0;return b.jsx(ku,{open:o,onOpenChange:l,children:b.jsxs(Ou,{className:"sm:max-w-lg p-0 gap-0 overflow-hidden",showCloseButton:!1,onKeyDown:T,children:[b.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[b.jsx("span",{className:"text-muted-foreground mr-2",children:">"}),b.jsx(vn,{ref:m,value:u,onChange:C=>f(C.target.value),placeholder:i("commandPalette.placeholder"),className:"border-0 ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 px-0 h-12"}),b.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"})]}),b.jsx("div",{ref:y,className:"max-h-80 overflow-y-auto p-2",children:_.length===0?b.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:i("commandPalette.noResults")}):b.jsx(b.Fragment,{children:["navigation","actions"].map(C=>{const R=v.get(C);return!R||R.length===0?null:b.jsxs("div",{className:"mb-2 last:mb-0",children:[b.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:i(`commandPalette.categories.${C}`)}),R.map(O=>{const N=w++,L=N===d;return b.jsxs("button",{"data-selected":L,onClick:()=>O.action(),onMouseEnter:()=>p(N),className:Ue("flex w-full items-center gap-3 rounded-md px-2 py-2 text-sm",L?"bg-accent text-accent-foreground":"text-foreground hover:bg-accent/50"),children:[O.icon&&b.jsx("span",{className:"text-muted-foreground",children:O.icon}),b.jsx("span",{className:"flex-1 text-left",children:O.label}),O.shortcut&&b.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:pte(O.shortcut)})]},O.id)})]},C)})})})]})})}const qz={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 H2e({className:e,rows:t=100,cols:n=10,tileClassName:r,tileSize:i="md"}){return b.jsx("div",{className:Ue("relative z-0 flex w-full h-full justify-center",e),children:Array.from({length:t}).map((a,s)=>b.jsx("div",{className:Ue(qz[i],"border-l dark:border-neutral-900 border-neutral-200 relative",r),children:Array.from({length:n}).map((o,l)=>b.jsx("div",{className:Ue(qz[i],"border-r border-t dark:border-neutral-900 border-neutral-200 relative hover:bg-tile transition-colors",r)},`col-${l}`))},`row-${s}`))})}const W2e=["/","/tasks","/terminals","/worktrees","/repositories","/review","/monitoring","/settings"];function V2e(){const e=ti({select:n=>n.location.pathname});return W2e.some(n=>e===n||e.startsWith(n+"/"))?b.jsx("div",{className:"absolute inset-0 overflow-hidden pointer-events-none -z-10",children:b.jsx(H2e,{rows:100,cols:50,tileSize:"sm"})}):null}if(!k.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!_re)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function G2e(e){e()}function q2e(e){e||(e=G2e),bke({reactionScheduler:e})}function K2e(e){return yke(e)}var Y2e=1e4,X2e=1e4,Z2e=(function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(r){r===void 0&&(r=Y2e),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var i=Date.now();n.registrations.forEach(function(a,s){i-a.registeredAt>=r&&(n.finalize(a.value),n.registrations.delete(s))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,r){this.registrations.set(r,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,X2e))}}),e})(),Q2e=typeof FinalizationRegistry<"u"?FinalizationRegistry:Z2e,pD=new Q2e(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null});function Kz(e){e.reaction=new ll("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function J2e(e,t){t===void 0&&(t="observed");var n=oe.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(o){return pD.unregister(r),r.onStoreChange=o,r.reaction||(Kz(r),r.stateVersion=Symbol()),function(){var l;r.onStoreChange=null,(l=r.reaction)===null||l===void 0||l.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var i=n.current;i.reaction||(Kz(i),pD.register(n,i,i)),oe.useDebugValue(i.reaction,K2e),OP.useSyncExternalStore(i.subscribe,i.getSnapshot,i.getSnapshot);var a,s;if(i.reaction.track(function(){try{a=e()}catch(o){s=o}}),s)throw s;return a}var xk,wk,die=typeof Symbol=="function"&&Symbol.for,eRe=(wk=(xk=Object.getOwnPropertyDescriptor(function(){},"name"))===null||xk===void 0?void 0:xk.configurable)!==null&&wk!==void 0?wk:!1,Yz=die?Symbol.for("react.forward_ref"):typeof k.forwardRef=="function"&&k.forwardRef(function(e){return null}).$$typeof,Xz=die?Symbol.for("react.memo"):typeof k.memo=="function"&&k.memo(function(e){return null}).$$typeof;function n0(e,t){var n;if(Xz&&e.$$typeof===Xz)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var r=(n=void 0)!==null&&n!==void 0?n:!1,i=e,a=e.displayName||e.name;if(Yz&&e.$$typeof===Yz&&(r=!0,i=e.render,typeof i!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var s=function(o,l){return J2e(function(){return i(o,l)},a)};return s.displayName=e.displayName,eRe&&Object.defineProperty(s,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(s.contextTypes=e.contextTypes),r&&(s=k.forwardRef(s)),s=k.memo(s),nRe(e,s),s}var tRe={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function nRe(e,t){Object.keys(e).forEach(function(n){tRe[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Tk;q2e(xr.unstable_batchedUpdates);Tk=pD.finalizeAllImmediately;const rRe=n0(function(){const t=Mm();if(t.connected||!t.hasEverConnected)return null;const n=t.reconnectAttempt>0&&t.reconnectAttempt<t.maxReconnectAttempts,r=t.reconnectAttempt>=t.maxReconnectAttempts;return b.jsx("div",{className:Ue("flex items-center justify-center gap-2 px-4 py-2 text-sm font-medium","border-b",r?"bg-destructive/10 border-destructive/30 text-destructive":"bg-amber-500/10 border-amber-500/30 text-amber-600 dark:text-amber-400"),role:"alert","aria-live":"polite",children:r?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:ts,size:16,strokeWidth:2}),b.jsx("span",{children:"Connection lost. Please check if the server is running."})]}):n?b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:en,size:16,strokeWidth:2,className:"animate-spin"}),b.jsxs("span",{children:["Reconnecting... (attempt ",t.reconnectAttempt,"/",t.maxReconnectAttempts,")"]})]}):b.jsxs(b.Fragment,{children:[b.jsx(fe,{icon:ts,size:16,strokeWidth:2}),b.jsx("span",{children:"Disconnected from server"})]})})});function iRe(){return qn({queryKey:["system","dependencies"],queryFn:()=>$t("/api/system/dependencies"),staleTime:30*1e3,refetchOnWindowFocus:!0})}const Zz="npm install -g @anthropic/claude-code",aRe="https://docs.anthropic.com/en/docs/claude-code/overview";function sRe(){const{data:e,isLoading:t}=iRe(),[n,r]=k.useState(!1),[i,a]=k.useState(!1),s=k.useCallback(async()=>{try{await navigator.clipboard.writeText(Zz),a(!0),setTimeout(()=>a(!1),2e3)}catch{}},[]),o=k.useCallback(()=>{r(!0)},[]);return t||n||e?.claudeCode?.installed?null:b.jsxs("div",{className:Ue("flex items-center justify-between gap-4 px-4 py-3","border-b bg-amber-500/10 border-amber-500/30"),role:"alert",children:[b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx(fe,{icon:ts,size:18,strokeWidth:2,className:"shrink-0 text-amber-600 dark:text-amber-400"}),b.jsxs("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-center sm:gap-4",children:[b.jsx("span",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:"Claude Code CLI not found"}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("code",{className:"rounded bg-amber-500/20 px-2 py-0.5 text-xs font-mono text-amber-700 dark:text-amber-300",children:Zz}),b.jsx("button",{onClick:s,className:Ue("p-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),title:i?"Copied!":"Copy to clipboard",children:b.jsx(fe,{icon:i?hl:w1e,size:14,strokeWidth:2})})]})]})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("a",{href:aRe,target:"_blank",rel:"noopener noreferrer",className:Ue("text-xs font-medium px-2 py-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),children:"View Docs"}),b.jsx("button",{onClick:o,className:Ue("p-1 rounded transition-colors","text-amber-600 hover:text-amber-700 hover:bg-amber-500/20","dark:text-amber-400 dark:hover:text-amber-300"),title:"Dismiss",children:b.jsx(fe,{icon:ci,size:16,strokeWidth:2})})]})]})}const oRe=[{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 lRe({open:e,onOpenChange:t}){const{t:n}=tn("navigation");return b.jsx(ku,{open:e,onOpenChange:t,children:b.jsxs(Ou,{className:"sm:max-w-md",children:[b.jsx(Jc,{children:b.jsx(ed,{children:n("shortcuts.title")})}),b.jsx("div",{className:"space-y-4 mt-2",children:oRe.map(r=>b.jsxs("div",{children:[b.jsx("h3",{className:"text-xs font-medium text-muted-foreground mb-2",children:n(`shortcuts.groups.${r.titleKey}`)}),b.jsx("div",{className:"space-y-1",children:r.items.map(i=>b.jsxs("div",{className:"flex items-center justify-between py-1.5",children:[b.jsx("span",{className:"text-sm",children:n(`shortcuts.labels.${i.labelKey}`)}),b.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:pte(i.shortcut)})]},i.shortcut))})]},r.titleKey))})]})})}const uRe=({...e})=>{const{resolvedTheme:t}=qc();return b.jsx(w_e,{theme:t,className:"toaster group",icons:{success:b.jsx(fe,{icon:nte,strokeWidth:2,className:"size-4"}),info:b.jsx(fe,{icon:L1e,strokeWidth:2,className:"size-4"}),warning:b.jsx(fe,{icon:ts,strokeWidth:2,className:"size-4"}),error:b.jsx(fe,{icon:B1e,strokeWidth:2,className:"size-4"}),loading:b.jsx(fe,{icon:en,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})},Oo=Kpe({component:mRe});function cRe(){return Ewe(),null}function dRe(){return Rne(),null}function fRe(){return uie(),null}function hRe(){const e=ti({select:n=>n.location}),{updateViewTracking:t}=cie();return k.useEffect(()=>{const n=e.pathname;let r="other",i=null,a=null;n.startsWith("/tasks/")?(r="task-detail",i=n.split("/")[2]||null):n==="/terminals"&&(r="terminals",a=new URLSearchParams(e.search).get("tab")),t(r,i,a)},[e.pathname,e.search,t]),null}function pRe(){const e=ti({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 mRe(){const[e,t]=k.useState(null),[n,r]=k.useState(!1),[i,a]=k.useState(!1),s=typeof window<"u"&&window.parent!==window,o=k.useCallback(d=>{t(()=>d)},[]),l=k.useCallback(()=>{e?.()},[e]),u=k.useCallback(()=>{r(!0)},[]),f=k.useCallback(()=>{a(!0)},[]);return b.jsx(k_e,{children:b.jsxs("div",{className:"flex h-screen flex-col overflow-x-hidden bg-background text-foreground",children:[b.jsx(cRe,{}),b.jsx(dRe,{}),b.jsx(fRe,{}),b.jsx(hRe,{}),b.jsx(pRe,{}),b.jsx(rRe,{}),b.jsx(sRe,{}),b.jsx(bwe,{onNewTaskRef:o,onOpenCommandPalette:f}),b.jsxs("main",{className:"isolate flex-1 overflow-hidden relative",children:[b.jsx(V2e,{}),b.jsx(tJ,{})]}),b.jsx(z2e,{open:i,onOpenChange:a,onNewTask:l,onShowShortcuts:u}),b.jsx(lRe,{open:n,onOpenChange:r}),b.jsx(uRe,{position:s?"bottom-center":"bottom-right"})]})})}const gRe=Ms("/")({beforeLoad:()=>{throw BQ({to:"/tasks"})}}),mD="";function fie(){const[e,t]=k.useState(new Map),[n,r]=k.useState(null),[i,a]=k.useState(!0),[s,o]=k.useState(!1),[l,u]=k.useState(null),f=k.useRef(null),d=k.useRef(0),p=k.useRef(!1),m=k.useCallback(async()=>{a(!0),u(null);try{const g=await fetch(`${mD}/api/worktrees/json`);if(!g.ok)throw new Error("Failed to fetch worktrees");const _=await g.json();t(new Map(_.worktrees.map(v=>[v.path,{...v,size:v.size||0,sizeFormatted:v.sizeFormatted||"0 B",branch:v.branch||"unknown"}]))),r(_.summary),a(!1),o(!1)}catch(g){u(g instanceof Error?g:new Error("Failed to load worktrees")),a(!1),o(!1)}},[]),y=k.useCallback(()=>{if(p.current){m();return}f.current?.close(),a(!0),o(!1),u(null),t(new Map),r(null);const g=new EventSource(`${mD}/api/worktrees`);f.current=g,g.addEventListener("worktree:basic",_=>{const v=JSON.parse(_.data);d.current=v.length,t(new Map(v.map(x=>[x.path,{...x,size:0,sizeFormatted:"...",branch:"..."}]))),a(!1),o(v.length>0)}),g.addEventListener("worktree:details",_=>{const v=JSON.parse(_.data);t(x=>{const T=new Map(x),w=T.get(v.path);return w&&T.set(v.path,{...w,size:v.size,sizeFormatted:v.sizeFormatted,branch:v.branch}),T}),d.current--,d.current<=0&&o(!1)}),g.addEventListener("worktree:complete",_=>{const v=JSON.parse(_.data);r(v),o(!1),g.close()}),g.addEventListener("worktree:error",_=>{const{path:v}=JSON.parse(_.data);At.viewer.error("Error loading worktree details",{path:v}),d.current--,d.current<=0&&o(!1)}),g.onerror=()=>{g.close(),At.viewer.info("SSE connection failed, trying JSON fallback"),p.current=!0,m()}},[m]);return k.useEffect(()=>(y(),()=>{f.current?.close()}),[y]),{worktrees:k.useMemo(()=>Array.from(e.values()).sort((_,v)=>_.isOrphaned!==v.isOrphaned?_.isOrphaned?-1:1:new Date(v.lastModified).getTime()-new Date(_.lastModified).getTime()),[e]),summary:n,isLoading:i,isLoadingDetails:s,error:l,refetch:y}}function hie(){const e=wr();return zn({mutationFn:({worktreePath:t,repoPath:n,deleteLinkedTask:r})=>$t(`${mD}/api/worktrees`,{method:"DELETE",body:JSON.stringify({worktreePath:t,repoPath:n,deleteLinkedTask:r})}),onSuccess:()=>{e.invalidateQueries({queryKey:["worktrees"]}),e.invalidateQueries({queryKey:["tasks"]})}})}const bRe=Yc("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 co({className:e,variant:t="default",render:n,...r}){return wxe({defaultTagName:"span",props:sl({className:Ue(bRe({className:e,variant:t}))},r),render:n,state:{slot:"badge",variant:t}})}function xa({className:e,size:t="default",...n}){return b.jsx("div",{"data-slot":"card","data-size":t,className:Ue("ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-lg py-4 text-xs/relaxed ring-1 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 *:[img:first-child]:rounded-t-lg *:[img:last-child]:rounded-b-lg group/card flex flex-col",e),...n})}function vRe({className:e,...t}){return b.jsx("div",{"data-slot":"card-header",className:Ue("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 yRe({className:e,...t}){return b.jsx("div",{"data-slot":"card-title",className:Ue("text-sm font-medium",e),...t})}function Df({className:e,...t}){return b.jsx("div",{"data-slot":"card-content",className:Ue("px-4 group-data-[size=sm]/card:px-3",e),...t})}function go({...e}){return b.jsx(BEe,{"data-slot":"alert-dialog",...e})}function bo({...e}){return b.jsx(wte,{"data-slot":"alert-dialog-trigger",...e})}function _Re({...e}){return b.jsx(_te,{"data-slot":"alert-dialog-portal",...e})}function ERe({className:e,...t}){return b.jsx(gte,{"data-slot":"alert-dialog-overlay",className:Ue("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 vo({className:e,size:t="default",...n}){return b.jsxs(_Re,{children:[b.jsx(ERe,{}),b.jsx(yte,{"data-slot":"alert-dialog-content","data-size":t,className:Ue("data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 bg-background ring-foreground/10 gap-3 rounded-xl p-4 ring-1 duration-100 data-[size=default]:max-w-xs data-[size=sm]:max-w-64 data-[size=default]:sm:max-w-sm group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 outline-none",e),...n})]})}function yo({className:e,...t}){return b.jsx("div",{"data-slot":"alert-dialog-header",className:Ue("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 _o({className:e,...t}){return b.jsx("div",{"data-slot":"alert-dialog-footer",className:Ue("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 Eo({className:e,...t}){return b.jsx(xte,{"data-slot":"alert-dialog-title",className:Ue("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 So({className:e,...t}){return b.jsx(bte,{"data-slot":"alert-dialog-description",className:Ue("text-muted-foreground *:[a]:hover:text-foreground text-xs/relaxed text-balance md:text-pretty *:[a]:underline *:[a]:underline-offset-3",e),...t})}function Rv({className:e,...t}){return b.jsx(Ke,{"data-slot":"alert-dialog-action",className:Ue(e),...t})}function xo({className:e,variant:t="outline",size:n="default",...r}){return b.jsx(qx,{"data-slot":"alert-dialog-cancel",className:Ue(e),render:b.jsx(Ke,{variant:t,size:n}),...r})}const Ti=k.forwardRef(({className:e,...t},n)=>b.jsx(pSe,{ref:n,className:Ue("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:b.jsx(mSe,{className:"flex items-center justify-center",children:b.jsx(fe,{icon:hl,size:12,strokeWidth:3})})}));Ti.displayName="Checkbox";const gD={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"},SRe=Ms("/worktrees/")({component:CRe});function xRe(){const{t:e}=tn("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),s=Math.floor(a/60),o=Math.floor(s/60),l=Math.floor(o/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):o>0?o===1?e("time.hourAgo"):e("time.hoursAgo",{count:o}):s>0?s===1?e("time.minuteAgo"):e("time.minutesAgo",{count:s}):e("time.justNow")}}function Qz({className:e}){return b.jsx("span",{className:`inline-block animate-pulse rounded bg-muted ${e}`})}function wRe({worktree:e,onDelete:t}){const{t:n}=tn("common"),{t:r}=tn("worktrees"),i=xRe(),[a,s]=k.useState(!1),[o,l]=k.useState(!1),[u,f]=k.useState(!1),d=e.sizeFormatted==="..."||e.branch==="...",p=!e.isOrphaned&&e.taskId,m=async()=>{l(!0);try{await t(e,u),s(!1)}catch{}finally{l(!1)}},y=S=>{s(S),S||f(!1)};return b.jsx(xa,{className:"transition-colors hover:border-border/80",children:b.jsxs(Df,{className:"flex items-start justify-between gap-4 py-4",children:[b.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"truncate font-medium",children:e.name}),e.isOrphaned?b.jsx(co,{className:Ue("shrink-0",gD.ORPHANED),children:n("statuses.ORPHANED")}):e.taskStatus?b.jsx(co,{className:Ue("shrink-0",gD[e.taskStatus]),children:n(`statuses.${e.taskStatus}`)}):null]}),b.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Hi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:e.path})]}),b.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vx,size:12,strokeWidth:2,className:"shrink-0"}),e.branch==="..."?b.jsx(Qz,{className:"h-3 w-16"}):b.jsx("span",{className:"font-mono",children:e.branch})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:ate,size:12,strokeWidth:2,className:"shrink-0"}),e.sizeFormatted==="..."?b.jsx(Qz,{className:"h-3 w-12"}):b.jsx("span",{children:e.sizeFormatted})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:tte,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{children:i(e.lastModified)})]})]}),e.taskId&&e.taskTitle&&b.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:b.jsxs(wi,{to:"/tasks/$taskId",params:{taskId:e.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[b.jsx("span",{className:"truncate",children:e.taskTitle}),b.jsx(fe,{icon:$y,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),b.jsxs(go,{open:a,onOpenChange:y,children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:d}),children:b.jsx(fe,{icon:$c,size:14,strokeWidth:2})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:r("delete.title")}),b.jsxs(So,{children:[r("delete.description")," ",b.jsx("span",{className:"font-mono",children:e.name}),".",u&&p&&b.jsxs(b.Fragment,{children:[" ",r("delete.linkedTaskWillBeDeleted",{title:e.taskTitle})]})," ",r("delete.cannotUndo")]}),p&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:u,onCheckedChange:S=>f(S===!0),disabled:o}),r("delete.alsoDeleteLinkedTask",{title:e.taskTitle})]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:o,children:n("buttons.cancel")}),b.jsxs(Ke,{variant:"destructive",onClick:m,disabled:o,className:"gap-2",children:[o&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),n(o?"status.deleting":"buttons.delete")]})]})]})]})]})})}const TRe=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function CRe(){const{t:e}=tn("common"),{t}=tn("worktrees"),{worktrees:n,summary:r,isLoading:i,isLoadingDetails:a,error:s,refetch:o}=fie(),l=hie(),[u,f]=k.useState(new Set),[d,p]=k.useState(!1),[m,y]=k.useState(!1),[S,g]=k.useState(!1),_=O=>{f(N=>{const L=new Set(N);return L.has(O)?L.delete(O):L.add(O),L})},v=()=>{f(new Set)},x=k.useMemo(()=>u.size===0?n:n.filter(O=>!!(O.isOrphaned&&u.has("ORPHANED")||O.taskStatus&&u.has(O.taskStatus))),[n,u]),T=k.useMemo(()=>n.filter(O=>O.taskStatus==="DONE"||O.taskStatus==="CANCELED"),[n]),w=async()=>{if(T.length!==0){y(!0);try{for(const O of T)await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:S});p(!1),o()}catch{}finally{y(!1)}}},C=O=>{p(O),O||g(!1)},R=async(O,N)=>{await l.mutateAsync({worktreePath:O.path,repoPath:O.repoPath,deleteLinkedTask:N}),o()};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 flex-col gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsx("h1",{className:"text-sm font-medium",children:t("title")}),(r||n.length>0)&&b.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[b.jsx("span",{children:t("summary.total",{count:r?.total??n.length})}),(r?.orphaned??n.filter(O=>O.isOrphaned).length)>0&&b.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:r?.orphaned??n.filter(O=>O.isOrphaned).length})}),a?b.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):r?b.jsx("span",{children:r.totalSizeFormatted}):null]})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[T.length>0&&b.jsxs(go,{open:d,onOpenChange:C,children:[b.jsxs(bo,{render:b.jsx(Ke,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:a}),children:[b.jsx(fe,{icon:rte,size:12,strokeWidth:2}),t("cleanup.button",{count:T.length})]}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:t("cleanup.title")}),b.jsxs(So,{children:[t("cleanup.description",{count:T.length}),S&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("p",{className:"text-sm text-muted-foreground",children:[T.filter(O=>O.taskStatus==="DONE").length>0&&b.jsxs("span",{className:"mr-3",children:[b.jsx("span",{className:"font-medium text-accent",children:T.filter(O=>O.taskStatus==="DONE").length})," ",t("cleanup.done")]}),T.filter(O=>O.taskStatus==="CANCELED").length>0&&b.jsxs("span",{children:[b.jsx("span",{className:"font-medium text-destructive",children:T.filter(O=>O.taskStatus==="CANCELED").length})," ",t("cleanup.canceled")]})]}),b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:S,onCheckedChange:O=>g(O===!0),disabled:m}),t("cleanup.alsoDeleteLinkedTasks")]}),b.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:m,children:e("buttons.cancel")}),b.jsxs(Ke,{variant:"destructive",onClick:w,disabled:m,className:"gap-2",children:[m&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),m?e("status.deleting"):t("delete.button",{count:T.length})]})]})]})]}),u.size>0&&b.jsxs(Ke,{variant:"ghost",size:"sm",onClick:v,className:"gap-1.5 text-xs",children:[b.jsx(fe,{icon:ci,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),b.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:TRe.map(O=>{const N=u.has(O);return b.jsx("button",{onClick:()=>_(O),className:Ue("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",N?gD[O]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${O}`)},O)})})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),s&&b.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[b.jsx(fe,{icon:ts,size:20,strokeWidth:2}),b.jsx("span",{className:"text-sm",children:t("error.failedToLoad",{message:s.message})})]}),!i&&!s&&x.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:u.size>0?t("empty.noMatch"):t("empty.noWorktrees")})}),!i&&b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:x.map(O=>b.jsx(wRe,{worktree:O,onDelete:R},O.path))})]})]})}function Wn(e,t="Assertion error"){if(!e)throw Error(t)}function zp({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,i)=>(r+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r),0)}function bD(e,t){return t.sort(e==="horizontal"?ARe:kRe)}function ARe(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function kRe(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function pie(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 ORe({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let i,a=Number.MAX_VALUE;for(const s of t){const{x:o,y:l}=pie(r,s),u=e==="horizontal"?o:l;u<a&&(a=u,i=s)}return Wn(i,"No rect found"),i}function mie(e){const{element:t,orientation:n,panels:r,separators:i}=e,a=bD(n,Array.from(t.children).filter(f=>f instanceof HTMLElement).map(f=>({element:f}))).map(({element:f})=>f),s=[];let o=!1,l,u=[];for(const f of a)if(f.hasAttribute("data-panel")){const d=r.find(p=>p.element===f);if(d){if(l){const p=l.element.getBoundingClientRect(),m=f.getBoundingClientRect();let y;if(o){const S=n==="horizontal"?new DOMRect(p.right,p.top,0,p.height):new DOMRect(p.left,p.bottom,p.width,0),g=n==="horizontal"?new DOMRect(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(u.length){case 0:{y=[S,g];break}case 1:{const _=u[0],v=ORe({orientation:n,rects:[p,m],targetRect:_.element.getBoundingClientRect()});y=[_,v===p?g:S];break}default:{y=u;break}}}else u.length?y=u:y=[n==="horizontal"?new DOMRect(p.right,m.top,m.left-p.right,m.height):new DOMRect(m.left,p.bottom,m.width,m.top-p.bottom)];for(const S of y)s.push({group:e,groupSize:zp({group:e}),panels:[l,d],separator:"width"in S?void 0:S,rect:"width"in S?S:S.element.getBoundingClientRect()})}o=!1,l=d,u=[]}}else if(f.hasAttribute("data-separator")){const d=i.find(p=>p.element===f);d?u.push(d):(l=void 0,u=[])}else o=!0;return s}function RRe(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function NRe(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function IRe(e){return e/100*window.innerHeight}function DRe(e){return e/100*window.innerWidth}function LRe(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 E_({groupSize:e,panelElement:t,styleProp:n}){let r;const[i,a]=LRe(n);switch(a){case"%":{r=i/100*e;break}case"px":{r=i;break}case"rem":{r=NRe(t,i);break}case"em":{r=RRe(t,i);break}case"vh":{r=IRe(i);break}case"vw":{r=DRe(i);break}}return r}function ao(e){return parseFloat(e.toFixed(3))}function Jz(e){const{panels:t}=e,n=zp({group:e});return n===0?t.map(r=>({collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:i,panelConstraints:a}=r;let s=0;if(a.collapsedSize){const f=E_({groupSize:n,panelElement:i,styleProp:a.collapsedSize});s=ao(f/n*100)}let o;if(a.defaultSize){const f=E_({groupSize:n,panelElement:i,styleProp:a.defaultSize});o=ao(f/n*100)}let l=0;if(a.minSize){const f=E_({groupSize:n,panelElement:i,styleProp:a.minSize});l=ao(f/n*100)}let u=100;if(a.maxSize){const f=E_({groupSize:n,panelElement:i,styleProp:a.maxSize});u=ao(f/n*100)}return{collapsedSize:s,collapsible:a.collapsible===!0,defaultSize:o,minSize:l,maxSize:u,panelId:r.id}})}class PRe{#e={};addListener(t,n){const r=this.#e[t];return r===void 0?this.#e[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=this.#e[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let i=!1,a=null;const s=Array.from(r);for(let o=0;o<s.length;o++){const l=s[o];try{l.call(null,n)}catch(u){a===null&&(i=!0,a=u)}}if(i)throw a}}removeAllListeners(){this.#e={}}removeListener(t,n){const r=this.#e[t];if(r!==void 0){const i=r.indexOf(n);i>=0&&r.splice(i,1)}}}function Qi(e,t,n=0){return Math.abs(ao(e)-ao(t))<=n}let ys={cursorFlags:0,interactionState:{state:"inactive"},mountedGroups:new Map};const vf=new PRe;function bl(){return ys}function Ds(e){const t=typeof e=="function"?e(ys):e;if(ys===t)return ys;const n=ys;return ys={...ys,...t},t.cursorFlags!==void 0&&vf.emit("cursorFlagsChange",ys.cursorFlags),t.interactionState!==void 0&&vf.emit("interactionStateChange",ys.interactionState),t.mountedGroups!==void 0&&(ys.mountedGroups.forEach((r,i)=>{r.derivedPanelConstraints.forEach(a=>{if(a.collapsible){const{layout:s}=n.mountedGroups.get(i)??{};if(s){const o=Qi(a.collapsedSize,r.layout[a.panelId]),l=Qi(a.collapsedSize,s[a.panelId]);o&&!l&&(i.inMemoryLastExpandedPanelSizes[a.panelId]=s[a.panelId])}}})}),vf.emit("mountedGroupsChange",ys.mountedGroups)),ys}const MRe=e=>e,Ck=()=>{},gie=1,bie=2,vie=4,yie=8,eH={coarse:10,precise:5};function jRe({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(a=>{if(!a.disableCursor)switch(a.orientation){case"horizontal":{r++;break}case"vertical":{i++;break}}})}if(r===0&&i===0)return null;switch(n){case"active":{const a=(e&gie)!==0,s=(e&bie)!==0,o=(e&vie)!==0,l=(e&yie)!==0;if(e){if(a)return o?"se-resize":l?"ne-resize":"e-resize";if(s)return o?"sw-resize":l?"nw-resize":"w-resize";if(o)return"s-resize";if(l)return"n-resize"}break}}return r>0&&i>0?"move":r>0?"ew-resize":"ns-resize"}let Ak,Fo;function ZM(){Fo===void 0&&(Fo=new CSSStyleSheet,document.adoptedStyleSheets=[Fo]);const{cursorFlags:e,interactionState:t}=bl();switch(t.state){case"active":case"hover":{const n=jRe({cursorFlags:e,groups:t.hitRegions.map(i=>i.group),state:t.state}),r=`*{cursor: ${n} !important; ${t.state==="active"?"touch-action: none;":""} }`;if(Ak===r)return;Ak=r,n?Fo.cssRules.length===0?Fo.insertRule(r):Fo.replaceSync(r):Fo.cssRules.length===1&&Fo.deleteRule(0);break}case"inactive":{Ak=void 0,Fo.cssRules.length===1&&Fo.deleteRule(0);break}}}function FRe(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Nv(e,t){return Qi(e,t)?0:e>t?1:-1}function sp({panelConstraints:e,size:t}){const{collapsedSize:n=0,collapsible:r,maxSize:i=100,minSize:a=0}=e;if(Nv(t,a)<0)if(r){const s=(n+a)/2;Nv(t,s)<0?t=n:t=a}else t=a;return t=Math.min(i,t),t=ao(t),t}function Iv({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Qi(e,0))return t;const s=Object.values(t),o=Object.values(i),l=[...s],[u,f]=r;Wn(u!=null,"Invalid first pivot index"),Wn(f!=null,"Invalid second pivot index");let d=0;if(a==="keyboard"){{const y=e<0?f:u,S=n[y];Wn(S,`Panel constraints not found for index ${y}`);const{collapsedSize:g=0,collapsible:_,minSize:v=0}=S;if(_){const x=s[y];if(Wn(x!=null,`Previous layout not found for panel index ${y}`),Qi(x,g)){const T=v-x;Nv(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}{const y=e<0?u:f,S=n[y];Wn(S,`No panel constraints found for index ${y}`);const{collapsedSize:g=0,collapsible:_,minSize:v=0}=S;if(_){const x=s[y];if(Wn(x!=null,`Previous layout not found for panel index ${y}`),Qi(x,v)){const T=x-g;Nv(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}}{const y=e<0?1:-1;let S=e<0?f:u,g=0;for(;;){const v=s[S];Wn(v!=null,`Previous layout not found for panel index ${S}`);const x=sp({panelConstraints:n[S],size:100})-v;if(g+=x,S+=y,S<0||S>=n.length)break}const _=Math.min(Math.abs(e),Math.abs(g));e=e<0?0-_:_}{let y=e<0?u:f;for(;y>=0&&y<n.length;){const S=Math.abs(e)-Math.abs(d),g=s[y];Wn(g!=null,`Previous layout not found for panel index ${y}`);const _=g-S,v=sp({panelConstraints:n[y],size:_});if(!Qi(g,v)&&(d+=g-v,l[y]=v,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?y--:y++}}if(FRe(o,l))return i;{const y=e<0?f:u,S=s[y];Wn(S!=null,`Previous layout not found for panel index ${y}`);const g=S+d,_=sp({panelConstraints:n[y],size:g});if(l[y]=_,!Qi(_,g)){let v=g-_,x=e<0?f:u;for(;x>=0&&x<n.length;){const T=l[x];Wn(T!=null,`Previous layout not found for panel index ${x}`);const w=T+v,C=sp({panelConstraints:n[x],size:w});if(Qi(T,C)||(v-=C-T,l[x]=C),Qi(v,0))break;e>0?x--:x++}}}const p=Object.values(l).reduce((y,S)=>S+y,0);if(!Qi(p,100,.1))return i;const m=Object.keys(i);return l.reduce((y,S,g)=>(y[m[g]]=S,y),{})}function jm(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||Nv(e[n],t[n])!==0)return!1;return!0}function _ie({event:e,hitRegions:t,initialLayoutMap:n,mountedGroups:r,pointerDownAtPoint:i}){let a=0;const s=new Map(r);t.forEach(o=>{const{group:l,groupSize:u}=o,{disableCursor:f,orientation:d,panels:p}=l;let m=0;i?d==="horizontal"?m=(e.clientX-i.x)/u*100:m=(e.clientY-i.y)/u*100:d==="horizontal"?m=e.clientX<0?-100:100:m=e.clientY<0?-100:100;const y=n.get(l),{defaultLayoutDeferred:S,derivedPanelConstraints:g,layout:_,separatorToPanels:v}=r.get(l)??{defaultLayoutDeferred:!1};if(g&&y&&_&&v){const x=Iv({delta:m,initialLayout:y,panelConstraints:g,pivotIndices:o.panels.map(T=>p.indexOf(T)),prevLayout:_,trigger:"mouse-or-touch"});if(jm(x,_)){if(m!==0&&!f)switch(d){case"horizontal":{a|=m<0?gie:bie;break}case"vertical":{a|=m<0?vie:yie;break}}}else{s.set(o.group,{defaultLayoutDeferred:S,derivedPanelConstraints:g,layout:x,separatorToPanels:v});const T=o.group.panels.map(({id:w})=>w).join(",");o.group.inMemoryLayouts[T]=x}}}),Ds({cursorFlags:a,mountedGroups:s}),ZM()}function tH(e){if(e.defaultPrevented||e.relatedTarget!==null||e.clientX===0&&e.clientY===0)return;const{interactionState:t,mountedGroups:n}=bl();t.state==="active"&&t.hitRegions.forEach(r=>{e.currentTarget===r.group.element&&_ie({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n})})}function lE(e){const t=e.parentElement;Wn(t,"Parent group element not found");const{mountedGroups:n}=bl();for(const[r]of n)if(r.element===t)return r;throw Error("Could not find parent Group for separator element")}function Lf({layout:e,panelConstraints:t}){const n=[...Object.values(e)],r=n.reduce((s,o)=>s+o,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!Qi(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=100/r*o;n[s]=l}let i=0;for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=sp({panelConstraints:t[s],size:o});o!=l&&(i+=o-l,n[s]=l)}if(!Qi(i,0))for(let s=0;s<t.length;s++){const o=n[s];Wn(o!=null,`No layout data found for index ${s}`);const l=o+i,u=sp({panelConstraints:t[s],size:l});if(o!==u&&(i-=u-o,n[s]=u,Qi(i,0)))break}const a=Object.keys(e);return n.reduce((s,o,l)=>(s[a[l]]=o,s),{})}function Eie({groupId:e}){const t=()=>{const{mountedGroups:n}=bl();for(const[r,i]of n)if(r.id===e)return{group:r,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:a,layout:s,separatorToPanels:o}=t(),l=Lf({layout:n,panelConstraints:i});return r?s:(jm(s,l)||Ds(u=>({mountedGroups:new Map(u.mountedGroups).set(a,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:l,separatorToPanels:o})})),l)}}}function Sie(e){const{mountedGroups:t}=bl(),n=t.get(e);return Wn(n,`Mounted Group ${e.id} not found`),n}function Pd(e,t){const n=lE(e),r=Sie(n),i=n.separators.find(f=>f.element===e);Wn(i,"Matching separator not found");const a=r.separatorToPanels.get(i);Wn(a,"Matching panels not found");const s=a.map(f=>n.panels.indexOf(f)),o=Eie({groupId:n.id}).getLayout(),l=Iv({delta:t,initialLayout:o,panelConstraints:r.derivedPanelConstraints,pivotIndices:s,prevLayout:o,trigger:"keyboard"}),u=Lf({layout:l,panelConstraints:r.derivedPanelConstraints});jm(o,u)||Ds(f=>({mountedGroups:new Map(f.mountedGroups).set(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,layout:u,separatorToPanels:r.separatorToPanels})}))}function nH(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=lE(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&Pd(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&Pd(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&Pd(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&Pd(t,-5);break}case"End":{e.preventDefault(),Pd(t,100);break}case"Enter":{e.preventDefault();const r=lE(t),{derivedPanelConstraints:i,layout:a,separatorToPanels:s}=Sie(r),o=r.separators.find(d=>d.element===t);Wn(o,"Matching separator not found");const l=s.get(o);Wn(l,"Matching panels not found");const u=l[0],f=i.find(d=>d.panelId===u.id);if(Wn(f,"Panel metadata not found"),f.collapsible){const d=a[u.id],p=f.collapsedSize===d?r.inMemoryLastExpandedPanelSizes[u.id]??f.minSize:f.collapsedSize;Pd(t,p-d)}break}case"F6":{e.preventDefault();const r=lE(t).separators.map(s=>s.element),i=Array.from(r).findIndex(s=>s===e.currentTarget);Wn(i!==null,"Index not found");const a=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[a].focus();break}case"Home":{e.preventDefault(),Pd(t,-100);break}}}function BRe(e,t,n){let r,i={x:1/0,y:1/0};for(const a of t){const s=pie(n,a.rect);switch(e){case"horizontal":{s.x<=i.x&&(r=a,i=s);break}case"vertical":{s.y<=i.y&&(r=a,i=s);break}}}return r?{distance:i,hitRegion:r}:void 0}let S_;function URe(){return S_===void 0&&(typeof matchMedia=="function"?S_=!!matchMedia("(pointer:coarse)").matches:S_=!1),S_}function $Re(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:aH(e),b:aH(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Wn(r,"Stacking order can only be calculated for elements with a common ancestor");const i={a:iH(rH(n.a)),b:iH(rH(n.b))};if(i.a===i.b){const a=r.childNodes,s={a:n.a.at(-1),b:n.b.at(-1)};let o=a.length;for(;o--;){const l=a[o];if(l===s.a)return 1;if(l===s.b)return-1}}return Math.sign(i.a-i.b)}const zRe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function HRe(e){const t=getComputedStyle(xie(e)??e).display;return t==="flex"||t==="inline-flex"}function WRe(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||HRe(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"||zRe.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function rH(e){let t=e.length;for(;t--;){const n=e[t];if(Wn(n,"Missing node"),WRe(n))return n}return null}function iH(e){return e&&Number(getComputedStyle(e).zIndex)||0}function aH(e){const t=[];for(;e;)t.push(e),e=xie(e);return t}function xie(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}function VRe(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 GRe({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!(n instanceof HTMLElement)||n.contains(e)||e.contains(n))return!0;if($Re(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(VRe(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function wie(e,t){const n=[];return t.forEach((r,i)=>{if(i.disabled)return;const a=URe()?eH.coarse:eH.precise,s=mie(i),o=BRe(i.orientation,s,{x:e.clientX,y:e.clientY});o&&o.distance.x<=a&&o.distance.y<=a&&GRe({groupElement:i.element,hitRegion:o.hitRegion.rect,pointerEventTarget:e.target})&&n.push(o.hitRegion)}),n}function sH(e){if(e.defaultPrevented)return;const{mountedGroups:t}=bl(),n=wie(e,t),r=new Set,i=new Set,a=new Set,s=new Map;let o=!1;n.forEach(l=>{r.add(l.group),l.panels.forEach(f=>{i.add(f)}),l.separator&&(a.add(l.separator),o||(o=!0,l.separator.element.focus()));const u=t.get(l.group);u&&s.set(l.group,u.layout)}),Ds({interactionState:{hitRegions:n,initialLayoutMap:s,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}}),n.length&&e.preventDefault()}function oH(e){if(e.defaultPrevented)return;const{interactionState:t,mountedGroups:n}=bl();switch(t.state){case"active":{if(e.type!=="pointerleave"&&e.buttons===0){Ds(r=>r.interactionState.state==="inactive"?r:{cursorFlags:0,interactionState:{state:"inactive"}});return}_ie({event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint});break}default:{const r=wie(e,n);r.length===0?t.state!=="inactive"&&Ds({interactionState:{state:"inactive"}}):Ds({interactionState:{hitRegions:r,state:"hover"}}),ZM();break}}}function lH(e){if(e.defaultPrevented)return;e.preventDefault();const{interactionState:t}=bl();t.state==="active"&&(Ds({cursorFlags:0,interactionState:{state:"inactive"}}),ZM())}function uH(e){let t=0,n=0;const r={};for(const a of e)if(a.defaultSize!==void 0){t++;const s=ao(a.defaultSize);n+=s,r[a.panelId]=s}else r[a.panelId]=void 0;const i=e.length-t;if(i!==0){const a=ao((100-n)/i);for(const s of e)s.defaultSize===void 0&&(r[s.panelId]=a)}return r}function qRe(e,t,n){const r=n[0];if(!r)return;const i=e.panels.find(s=>s.element===t);if(!i||!i.onResize)return;const a=zp({group:e});i.onResize({asPercentage:ao(r.inlineSize/a*100),inPixels:r.inlineSize},i.id)}function KRe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function YRe(e){let t=!0;const n=new Set,r=new Set,i=new ResizeObserver(m=>{for(const y of m){const{borderBoxSize:S,target:g}=y;if(g===e.element){if(t){if(zp({group:e})===0)return;Ds(_=>{const v=_.mountedGroups.get(e);if(v){const x=Jz(e),T=v.defaultLayoutDeferred?uH(x):v.layout,w=Lf({layout:T,panelConstraints:x});return!v.defaultLayoutDeferred&&jm(T,w)&&KRe(v.derivedPanelConstraints,x)?_:{mountedGroups:new Map(_.mountedGroups).set(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:x,layout:w,separatorToPanels:v.separatorToPanels})}}return _})}}else qRe(e,g,S)}});i.observe(e.element),e.panels.forEach(m=>{Wn(!n.has(m.id),`Panel ids must be unique; id "${m.id}" was used more than once`),n.add(m.id),m.onResize&&i.observe(m.element)});const a=zp({group:e}),s=Jz(e),o=e.panels.map(({id:m})=>m).join(",");let l=e.defaultLayout;l&&e.panels.length!==Object.keys(l).length&&(l=void 0);const u=e.inMemoryLayouts[o]??l??uH(s),f=Lf({layout:u,panelConstraints:s}),d=mie(e),p=Ds(m=>{const y=new Map;return d.forEach(S=>{S.separator&&y.set(S.separator,S.panels)}),{mountedGroups:new Map(m.mountedGroups).set(e,{defaultLayoutDeferred:a===0,derivedPanelConstraints:s,layout:f,separatorToPanels:y})}});return e.element.addEventListener("pointerleave",tH),e.separators.forEach(m=>{Wn(!r.has(m.id),`Separator ids must be unique; id "${m.id}" was used more than once`),r.add(m.id),m.element.addEventListener("keydown",nH)}),p.mountedGroups.size===1&&(window.addEventListener("pointerdown",sH),window.addEventListener("pointermove",oH),window.addEventListener("pointerup",lH)),function(){t=!1;const m=Ds(y=>{const S=new Map(y.mountedGroups);return S.delete(e),{mountedGroups:S}});e.element.removeEventListener("pointerleave",tH),e.separators.forEach(y=>{y.element.removeEventListener("keydown",nH)}),m.mountedGroups.size===0&&(window.removeEventListener("pointerdown",sH),window.removeEventListener("pointermove",oH),window.removeEventListener("pointerup",lH)),i.disconnect()}}function QM(e){const t=k.useId();return`${e??t}`}const Yf=typeof window<"u"?k.useLayoutEffect:k.useEffect;function JM(e){const t=k.useRef(e);return Yf(()=>{t.current=e},[e]),k.useCallback(n=>t.current?.(n),[t])}function e3(...e){return JM(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function XRe(e){const t=k.useRef({...e});return Yf(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const Tie="--react-resizable-panels--panel--pointer-events";function Cie(e,t){const n=e.replace(/[^a-zA-Z0-9\-_]/g,""),r=t.replace(/[^a-zA-Z0-9\-_]/g,"");return`--react-resizable-panels--${n}--${r}`}const Aie=k.createContext(null);function ZRe(e,t){const n=k.useRef({getLayout:()=>({}),setLayout:MRe});k.useImperativeHandle(t,()=>n.current,[]),Yf(()=>{Object.assign(n.current,Eie({groupId:e}))})}function QRe({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:s,id:o,onLayoutChange:l,orientation:u="horizontal",style:f,...d}){const p=k.useRef({}),m=JM(W=>{jm(p.current,W)||(p.current=W,l?.(W))}),y=QM(o),[S,g]=k.useState(!1),[_,v]=k.useState(null),[x,T]=k.useState(n??{}),[w,C]=k.useState([]),[R,O]=k.useState([]),N=k.useRef({lastExpandedPanelSizes:{},layouts:{}}),L=e3(v,a);ZRe(y,s);const D=k.useMemo(()=>({id:y,orientation:u,registerPanel:W=>(C($=>bD(u,[...$,W])),()=>{C($=>$.filter(q=>q!==W))}),registerSeparator:W=>(O($=>bD(u,[...$,W])),()=>{O($=>$.filter(q=>q!==W))})}),[y,u]),z=XRe({defaultLayout:n,disableCursor:r}),M=k.useRef(null);Yf(()=>{if(_===null)return;const W={defaultLayout:z.defaultLayout,disableCursor:!!z.disableCursor,disabled:!!i,element:_,id:y,inMemoryLastExpandedPanelSizes:N.current.lastExpandedPanelSizes,inMemoryLayouts:N.current.layouts,orientation:u,panels:w,separators:R};M.current=W;const $=YRe(W),q=bl().mountedGroups.get(W);if(q){const{defaultLayoutDeferred:j,derivedPanelConstraints:U,layout:K}=q;!j&&U.length>0&&(T(K),m?.(K))}const Y=vf.addListener("interactionStateChange",j=>{j.state==="active"?g(j.hitRegions.some(U=>U.group===W)):g(!1)}),B=vf.addListener("mountedGroupsChange",j=>{const U=j.get(W);if(U){const{defaultLayoutDeferred:K,derivedPanelConstraints:H,layout:J}=U;if(K||H.length===0)return;T(J),m?.(J)}});return()=>{M.current=null,$(),Y(),B()}},[i,_,y,m,u,w,R,z]),k.useEffect(()=>{const W=M.current;W&&(W.defaultLayout=n,W.disableCursor=!!r)});const V={[Tie]:S?"none":void 0};for(const W in x){const $=Cie(y,W),q=x[W];V[$]=q}return b.jsx(Aie.Provider,{value:D,children:b.jsx("div",{...d,"aria-orientation":u,className:t,"data-group":!0,"data-testid":y,id:y,ref:L,style:{...f,...V,display:"flex",flexDirection:u==="horizontal"?"row":"column",flexWrap:"nowrap"},children:e})})}function t3(){const e=k.useContext(Aie);return Wn(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function JRe({groupId:e,panelId:t}){const n=()=>{const{mountedGroups:o}=bl();for(const[l,{defaultLayoutDeferred:u,derivedPanelConstraints:f,layout:d,separatorToPanels:p}]of o)if(l.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:f,group:l,layout:d,separatorToPanels:p};throw Error(`Group ${e} not found`)},r=()=>{const o=n().derivedPanelConstraints.find(l=>l.panelId===t);if(o!==void 0)return o;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const o=n().group.panels.find(l=>l.id===t);if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},a=()=>{const o=n().layout[t];if(o!==void 0)return o;throw Error(`Layout not found for Panel ${t}`)},s=o=>{const l=a();if(o===l)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:f,group:d,layout:p,separatorToPanels:m}=n(),y=d.panels.findIndex(v=>v.id===t),S=y===d.panels.length-1,g=Iv({delta:S?l-o:o-l,initialLayout:p,panelConstraints:f,pivotIndices:S?[y-1,y]:[y,y+1],prevLayout:p,trigger:"imperative-api"}),_=Lf({layout:g,panelConstraints:f});jm(p,_)||Ds(v=>({mountedGroups:new Map(v.mountedGroups).set(d,{defaultLayoutDeferred:u,derivedPanelConstraints:f,layout:_,separatorToPanels:m})}))};return{collapse:()=>{const{collapsible:o,collapsedSize:l}=r(),u=a();o&&u!==l&&s(l)},expand:()=>{const{collapsible:o,collapsedSize:l,minSize:u}=r(),f=a();o&&f===l&&s(u)},getSize:()=>{const{group:o}=n(),l=a(),{element:u}=i(),f=o.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:l,inPixels:f}},isCollapsed:()=>{const{collapsible:o,collapsedSize:l}=r(),u=a();return o&&Qi(l,u)},resize:o=>{if(a()!==o){let l;switch(typeof o){case"number":{const{group:u}=n(),f=zp({group:u});l=ao(o/f*100);break}case"string":{l=parseFloat(o);break}}s(l)}}}}function eNe(e,t){const{id:n}=t3(),r=k.useRef({collapse:Ck,expand:Ck,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Ck});k.useImperativeHandle(t,()=>r.current,[]),Yf(()=>{Object.assign(r.current,JRe({groupId:n,panelId:e}))})}function tNe({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,elementRef:a,id:s,maxSize:o="100%",minSize:l="0%",onResize:u,panelRef:f,style:d,...p}){const m=!!s,y=QM(s),[S,g]=k.useState(null),_=e3(g,a),{id:v,registerPanel:x}=t3(),T=u!==null,w=JM(R=>{u?.(R,s)});Yf(()=>{if(S!==null)return x({element:S,id:y,idIsStable:m,onResize:T?w:void 0,panelConstraints:{collapsedSize:n,collapsible:r,defaultSize:i,maxSize:o,minSize:l}})},[n,r,i,S,T,y,m,o,l,w,x]),eNe(y,f);const C=Cie(v,y);return b.jsx("div",{...p,"data-panel":!0,"data-testid":y,id:y,ref:_,style:{...nNe,flexBasis:0,flexGrow:`var(${C}, 1)`,flexShrink:1,overflow:"hidden",pointerEvents:`var(${Tie})`},children:b.jsx("div",{className:t,style:{width:"100%",height:"100%",...d},children:e})})}const nNe={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 rNe({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a;const s=e[n],o=t.find(l=>l.panelId===n);if(o){const l=o.maxSize,u=a=o.collapsible?o.collapsedSize:o.minSize,f=[r,r+1];a=Lf({layout:Iv({delta:u-s,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n],i=Lf({layout:Iv({delta:l-s,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e,trigger:"keyboard"}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:s}}function iNe({children:e,className:t,elementRef:n,id:r,style:i,...a}){const s=QM(r),[o,l]=k.useState({}),[u,f]=k.useState("inactive"),[d,p]=k.useState(null),m=e3(p,n),{id:y,orientation:S,registerSeparator:g}=t3(),_=S==="horizontal"?"vertical":"horizontal";return Yf(()=>{if(d!==null){const v={element:d,id:s},x=g(v),T=vf.addListener("interactionStateChange",C=>{f(C.state!=="inactive"&&C.hitRegions.some(R=>R.separator===v)?C.state:"inactive")}),w=vf.addListener("mountedGroupsChange",C=>{C.forEach(({derivedPanelConstraints:R,layout:O,separatorToPanels:N},L)=>{if(L.id===y){const D=N.get(v);if(D){const z=D[0],M=L.panels.indexOf(z);l(rNe({layout:O,panelConstraints:R,panelId:z.id,panelIndex:M}))}}})});return()=>{T(),w(),x()}}},[d,y,s,g]),b.jsx("div",{...a,"aria-controls":o.valueControls,"aria-orientation":_,"aria-valuemax":o.valueMax,"aria-valuemin":o.valueMin,"aria-valuenow":o.valueNow,children:e,className:t,"data-separator":u,"data-testid":s,id:s,ref:m,role:"separator",style:{flexBasis:"auto",...i,flexGrow:0,flexShrink:0},tabIndex:0})}function Vd({className:e,direction:t,...n}){return b.jsx(QRe,{"data-slot":"resizable-panel-group",orientation:t,className:Ue("flex h-full w-full data-[orientation=vertical]:flex-col",e),...n})}function Ss({...e}){return b.jsx(tNe,{"data-slot":"resizable-panel",...e})}function Gd({withHandle:e,className:t,...n}){return b.jsx(iNe,{"data-slot":"resizable-handle",className:Ue("relative flex w-px items-center justify-center bg-border cursor-grab active:cursor-grabbing group touch-none","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60","focus-visible:ring-offset-1 focus-visible:ring-offset-background","data-[orientation=vertical]:h-px data-[orientation=vertical]:w-full data-[orientation=vertical]:cursor-row-resize","[&[data-orientation=vertical]>div]:rotate-90",t),...n,children:e&&b.jsxs("div",{className:"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center gap-1 bg-muted/90 border border-border rounded-full px-1 py-3 opacity-70 group-hover:opacity-100 group-focus:opacity-100 transition-opacity shadow-sm",children:[b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"}),b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"}),b.jsx("span",{className:"w-0.5 h-0.5 rounded-full bg-muted-foreground"})]})})}var kk={exports:{}},cH;function aNe(){return cH||(cH=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(s,o,l){var u=this&&this.__decorate||function(v,x,T,w){var C,R=arguments.length,O=R<3?x:w===null?w=Object.getOwnPropertyDescriptor(x,T):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(v,x,T,w);else for(var N=v.length-1;N>=0;N--)(C=v[N])&&(O=(R<3?C(O):R>3?C(x,T,O):C(x,T))||O);return R>3&&O&&Object.defineProperty(x,T,O),O},f=this&&this.__param||function(v,x){return function(T,w){x(T,w,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.AccessibilityManager=void 0;const d=l(9042),p=l(9924),m=l(844),y=l(4725),S=l(2585),g=l(3656);let _=o.AccessibilityManager=class extends m.Disposable{constructor(v,x,T,w){super(),this._terminal=v,this._coreBrowserService=T,this._renderService=w,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let C=0;C<this._terminal.rows;C++)this._rowElements[C]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[C]);if(this._topBoundaryFocusListener=C=>this._handleBoundaryFocus(C,0),this._bottomBoundaryFocusListener=C=>this._handleBoundaryFocus(C,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new p.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((C=>this._handleResize(C.rows)))),this.register(this._terminal.onRender((C=>this._refreshRows(C.start,C.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((C=>this._handleChar(C)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
32
32
  `)))),this.register(this._terminal.onA11yTab((C=>this._handleTab(C)))),this.register(this._terminal.onKey((C=>this._handleKey(C.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,g.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,m.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(v){for(let x=0;x<v;x++)this._handleChar(" ")}_handleChar(v){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==v&&(this._charsToAnnounce+=v):this._charsToAnnounce+=v,v===`
33
33
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=d.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(v){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(v)||this._charsToConsume.push(v)}_refreshRows(v,x){this._liveRegionDebouncer.refresh(v,x,this._terminal.rows)}_renderRows(v,x){const T=this._terminal.buffer,w=T.lines.length.toString();for(let C=v;C<=x;C++){const R=T.lines.get(T.ydisp+C),O=[],N=R?.translateToString(!0,void 0,void 0,O)||"",L=(T.ydisp+C+1).toString(),D=this._rowElements[C];D&&(N.length===0?(D.innerText=" ",this._rowColumns.set(D,[0,1])):(D.textContent=N,this._rowColumns.set(D,O)),D.setAttribute("aria-posinset",L),D.setAttribute("aria-setsize",w))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(v,x){const T=v.target,w=this._rowElements[x===0?1:this._rowElements.length-2];if(T.getAttribute("aria-posinset")===(x===0?"1":`${this._terminal.buffer.lines.length}`)||v.relatedTarget!==w)return;let C,R;if(x===0?(C=T,R=this._rowElements.pop(),this._rowContainer.removeChild(R)):(C=this._rowElements.shift(),R=T,this._rowContainer.removeChild(C)),C.removeEventListener("focus",this._topBoundaryFocusListener),R.removeEventListener("focus",this._bottomBoundaryFocusListener),x===0){const O=this._createAccessibilityTreeNode();this._rowElements.unshift(O),this._rowContainer.insertAdjacentElement("afterbegin",O)}else{const O=this._createAccessibilityTreeNode();this._rowElements.push(O),this._rowContainer.appendChild(O)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(x===0?-1:1),this._rowElements[x===0?1:this._rowElements.length-2].focus(),v.preventDefault(),v.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const v=document.getSelection();if(!v)return;if(v.isCollapsed)return void(this._rowContainer.contains(v.anchorNode)&&this._terminal.clearSelection());if(!v.anchorNode||!v.focusNode)return void console.error("anchorNode and/or focusNode are null");let x={node:v.anchorNode,offset:v.anchorOffset},T={node:v.focusNode,offset:v.focusOffset};if((x.node.compareDocumentPosition(T.node)&Node.DOCUMENT_POSITION_PRECEDING||x.node===T.node&&x.offset>T.offset)&&([x,T]=[T,x]),x.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(x={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(x.node))return;const w=this._rowElements.slice(-1)[0];if(T.node.compareDocumentPosition(w)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(T={node:w,offset:w.textContent?.length??0}),!this._rowContainer.contains(T.node))return;const C=({node:N,offset:L})=>{const D=N instanceof Text?N.parentNode:N;let z=parseInt(D?.getAttribute("aria-posinset"),10)-1;if(isNaN(z))return console.warn("row is invalid. Race condition?"),null;const M=this._rowColumns.get(D);if(!M)return console.warn("columns is null. Race condition?"),null;let V=L<M.length?M[L]:M.slice(-1)[0]+1;return V>=this._terminal.cols&&(++z,V=0),{row:z,column:V}},R=C(x),O=C(T);if(R&&O){if(R.row>O.row||R.row===O.row&&R.column>=O.column)throw new Error("invalid range");this._terminal.select(R.column,R.row,(O.row-R.row)*this._terminal.cols-R.column+O.column)}}_handleResize(v){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let x=this._rowContainer.children.length;x<this._terminal.rows;x++)this._rowElements[x]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[x]);for(;this._rowElements.length>v;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const v=this._coreBrowserService.mainDocument.createElement("div");return v.setAttribute("role","listitem"),v.tabIndex=-1,this._refreshRowDimensions(v),v}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let v=0;v<this._terminal.rows;v++)this._refreshRowDimensions(this._rowElements[v])}}_refreshRowDimensions(v){v.style.height=`${this._renderService.dimensions.css.cell.height}px`}};o.AccessibilityManager=_=u([f(1,S.IInstantiationService),f(2,y.ICoreBrowserService),f(3,y.IRenderService)],_)},3614:(s,o)=>{function l(p){return p.replace(/\r?\n/g,"\r")}function u(p,m){return m?"\x1B[200~"+p+"\x1B[201~":p}function f(p,m,y,S){p=u(p=l(p),y.decPrivateModes.bracketedPasteMode&&S.rawOptions.ignoreBracketedPasteMode!==!0),y.triggerDataEvent(p,!0),m.value=""}function d(p,m,y){const S=y.getBoundingClientRect(),g=p.clientX-S.left-10,_=p.clientY-S.top-10;m.style.width="20px",m.style.height="20px",m.style.left=`${g}px`,m.style.top=`${_}px`,m.style.zIndex="1000",m.focus()}Object.defineProperty(o,"__esModule",{value:!0}),o.rightClickHandler=o.moveTextAreaUnderMouseCursor=o.paste=o.handlePasteEvent=o.copyHandler=o.bracketTextForPaste=o.prepareTextForTerminal=void 0,o.prepareTextForTerminal=l,o.bracketTextForPaste=u,o.copyHandler=function(p,m){p.clipboardData&&p.clipboardData.setData("text/plain",m.selectionText),p.preventDefault()},o.handlePasteEvent=function(p,m,y,S){p.stopPropagation(),p.clipboardData&&f(p.clipboardData.getData("text/plain"),m,y,S)},o.paste=f,o.moveTextAreaUnderMouseCursor=d,o.rightClickHandler=function(p,m,y,S,g){d(p,m,y),g&&S.rightClickSelect(p),m.value=S.selectionText,m.select()}},7239:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ColorContrastCache=void 0;const u=l(1505);o.ColorContrastCache=class{constructor(){this._color=new u.TwoKeyMap,this._css=new u.TwoKeyMap}setCss(f,d,p){this._css.set(f,d,p)}getCss(f,d){return this._css.get(f,d)}setColor(f,d,p){this._color.set(f,d,p)}getColor(f,d){return this._color.get(f,d)}clear(){this._color.clear(),this._css.clear()}}},3656:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.addDisposableDomListener=void 0,o.addDisposableDomListener=function(l,u,f,d){l.addEventListener(u,f,d);let p=!1;return{dispose:()=>{p||(p=!0,l.removeEventListener(u,f,d))}}}},3551:function(s,o,l){var u=this&&this.__decorate||function(_,v,x,T){var w,C=arguments.length,R=C<3?v:T===null?T=Object.getOwnPropertyDescriptor(v,x):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(_,v,x,T);else for(var O=_.length-1;O>=0;O--)(w=_[O])&&(R=(C<3?w(R):C>3?w(v,x,R):w(v,x))||R);return C>3&&R&&Object.defineProperty(v,x,R),R},f=this&&this.__param||function(_,v){return function(x,T){v(x,T,_)}};Object.defineProperty(o,"__esModule",{value:!0}),o.Linkifier=void 0;const d=l(3656),p=l(8460),m=l(844),y=l(2585),S=l(4725);let g=o.Linkifier=class extends m.Disposable{get currentLink(){return this._currentLink}constructor(_,v,x,T,w){super(),this._element=_,this._mouseService=v,this._renderService=x,this._bufferService=T,this._linkProviderService=w,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new p.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new p.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,m.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,m.toDisposable)((()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,d.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,d.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,d.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(_){this._lastMouseEvent=_;const v=this._positionFromMouseEvent(_,this._element,this._mouseService);if(!v)return;this._isMouseOut=!1;const x=_.composedPath();for(let T=0;T<x.length;T++){const w=x[T];if(w.classList.contains("xterm"))break;if(w.classList.contains("xterm-hover"))return}this._lastBufferCell&&v.x===this._lastBufferCell.x&&v.y===this._lastBufferCell.y||(this._handleHover(v),this._lastBufferCell=v)}_handleHover(_){if(this._activeLine!==_.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(_,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,_)||(this._clearCurrentLink(),this._askForLink(_,!0))}_askForLink(_,v){this._activeProviderReplies&&v||(this._activeProviderReplies?.forEach((T=>{T?.forEach((w=>{w.link.dispose&&w.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=_.y);let x=!1;for(const[T,w]of this._linkProviderService.linkProviders.entries())v?this._activeProviderReplies?.get(T)&&(x=this._checkLinkProviderResult(T,_,x)):w.provideLinks(_.y,(C=>{if(this._isMouseOut)return;const R=C?.map((O=>({link:O})));this._activeProviderReplies?.set(T,R),x=this._checkLinkProviderResult(T,_,x),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(_.y,this._activeProviderReplies)}))}_removeIntersectingLinks(_,v){const x=new Set;for(let T=0;T<v.size;T++){const w=v.get(T);if(w)for(let C=0;C<w.length;C++){const R=w[C],O=R.link.range.start.y<_?0:R.link.range.start.x,N=R.link.range.end.y>_?this._bufferService.cols:R.link.range.end.x;for(let L=O;L<=N;L++){if(x.has(L)){w.splice(C--,1);break}x.add(L)}}}}_checkLinkProviderResult(_,v,x){if(!this._activeProviderReplies)return x;const T=this._activeProviderReplies.get(_);let w=!1;for(let C=0;C<_;C++)this._activeProviderReplies.has(C)&&!this._activeProviderReplies.get(C)||(w=!0);if(!w&&T){const C=T.find((R=>this._linkAtPosition(R.link,v)));C&&(x=!0,this._handleNewLink(C))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!x)for(let C=0;C<this._activeProviderReplies.size;C++){const R=this._activeProviderReplies.get(C)?.find((O=>this._linkAtPosition(O.link,v)));if(R){x=!0,this._handleNewLink(R);break}}return x}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(_){if(!this._currentLink)return;const v=this._positionFromMouseEvent(_,this._element,this._mouseService);v&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,v)&&this._currentLink.link.activate(_,this._currentLink.link.text)}_clearCurrentLink(_,v){this._currentLink&&this._lastMouseEvent&&(!_||!v||this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=v)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,m.disposeArray)(this._linkCacheDisposables))}_handleNewLink(_){if(!this._lastMouseEvent)return;const v=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);v&&this._linkAtPosition(_.link,v)&&(this._currentLink=_,this._currentLink.state={decorations:{underline:_.link.decorations===void 0||_.link.decorations.underline,pointerCursor:_.link.decorations===void 0||_.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,_.link,this._lastMouseEvent),_.link.decorations={},Object.defineProperties(_.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:x=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==x&&(this._currentLink.state.decorations.pointerCursor=x,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",x))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:x=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==x&&(this._currentLink.state.decorations.underline=x,this._currentLink.state.isHovered&&this._fireUnderlineEvent(_.link,x))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((x=>{if(!this._currentLink)return;const T=x.start===0?0:x.start+1+this._bufferService.buffer.ydisp,w=this._bufferService.buffer.ydisp+1+x.end;if(this._currentLink.link.range.start.y>=T&&this._currentLink.link.range.end.y<=w&&(this._clearCurrentLink(T,w),this._lastMouseEvent)){const C=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);C&&this._askForLink(C,!1)}}))))}_linkHover(_,v,x){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!0),this._currentLink.state.decorations.pointerCursor&&_.classList.add("xterm-cursor-pointer")),v.hover&&v.hover(x,v.text)}_fireUnderlineEvent(_,v){const x=_.range,T=this._bufferService.buffer.ydisp,w=this._createLinkUnderlineEvent(x.start.x-1,x.start.y-T-1,x.end.x,x.end.y-T-1,void 0);(v?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(w)}_linkLeave(_,v,x){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(v,!1),this._currentLink.state.decorations.pointerCursor&&_.classList.remove("xterm-cursor-pointer")),v.leave&&v.leave(x,v.text)}_linkAtPosition(_,v){const x=_.range.start.y*this._bufferService.cols+_.range.start.x,T=_.range.end.y*this._bufferService.cols+_.range.end.x,w=v.y*this._bufferService.cols+v.x;return x<=w&&w<=T}_positionFromMouseEvent(_,v,x){const T=x.getCoords(_,v,this._bufferService.cols,this._bufferService.rows);if(T)return{x:T[0],y:T[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(_,v,x,T,w){return{x1:_,y1:v,x2:x,y2:T,cols:this._bufferService.cols,fg:w}}};o.Linkifier=g=u([f(1,S.IMouseService),f(2,S.IRenderService),f(3,y.IBufferService),f(4,S.ILinkProviderService)],g)},9042:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.tooMuchOutput=o.promptLabel=void 0,o.promptLabel="Terminal input",o.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(s,o,l){var u=this&&this.__decorate||function(S,g,_,v){var x,T=arguments.length,w=T<3?g:v===null?v=Object.getOwnPropertyDescriptor(g,_):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(S,g,_,v);else for(var C=S.length-1;C>=0;C--)(x=S[C])&&(w=(T<3?x(w):T>3?x(g,_,w):x(g,_))||w);return T>3&&w&&Object.defineProperty(g,_,w),w},f=this&&this.__param||function(S,g){return function(_,v){g(_,v,S)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkProvider=void 0;const d=l(511),p=l(2585);let m=o.OscLinkProvider=class{constructor(S,g,_){this._bufferService=S,this._optionsService=g,this._oscLinkService=_}provideLinks(S,g){const _=this._bufferService.buffer.lines.get(S-1);if(!_)return void g(void 0);const v=[],x=this._optionsService.rawOptions.linkHandler,T=new d.CellData,w=_.getTrimmedLength();let C=-1,R=-1,O=!1;for(let N=0;N<w;N++)if(R!==-1||_.hasContent(N)){if(_.loadCell(N,T),T.hasExtendedAttrs()&&T.extended.urlId){if(R===-1){R=N,C=T.extended.urlId;continue}O=T.extended.urlId!==C}else R!==-1&&(O=!0);if(O||R!==-1&&N===w-1){const L=this._oscLinkService.getLinkData(C)?.uri;if(L){const D={start:{x:R+1,y:S},end:{x:N+(O||N!==w-1?0:1),y:S}};let z=!1;if(!x?.allowNonHttpProtocols)try{const M=new URL(L);["http:","https:"].includes(M.protocol)||(z=!0)}catch{z=!0}z||v.push({text:L,range:D,activate:(M,V)=>x?x.activate(M,V,D):y(0,V),hover:(M,V)=>x?.hover?.(M,V,D),leave:(M,V)=>x?.leave?.(M,V,D)})}O=!1,T.hasExtendedAttrs()&&T.extended.urlId?(R=N,C=T.extended.urlId):(R=-1,C=-1)}}g(v)}};function y(S,g){if(confirm(`Do you want to navigate to ${g}?
34
34
 
@@ -36,12 +36,12 @@ WARNING: This link could potentially be dangerous`)){const _=window.open();if(_)
36
36
  `:`
37
37
  `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(O){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),_.isLinux&&O&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(O){const N=this._getMouseBufferCoords(O),L=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!!(L&&D&&N)&&this._areCoordsInSelection(N,L,D)}isCellInSelection(O,N){const L=this._model.finalSelectionStart,D=this._model.finalSelectionEnd;return!(!L||!D)&&this._areCoordsInSelection([O,N],L,D)}_areCoordsInSelection(O,N,L){return O[1]>N[1]&&O[1]<L[1]||N[1]===L[1]&&O[1]===N[1]&&O[0]>=N[0]&&O[0]<L[0]||N[1]<L[1]&&O[1]===L[1]&&O[0]<L[0]||N[1]<L[1]&&O[1]===N[1]&&O[0]>=N[0]}_selectWordAtCursor(O,N){const L=this._linkifier.currentLink?.link?.range;if(L)return this._model.selectionStart=[L.start.x-1,L.start.y-1],this._model.selectionStartLength=(0,v.getRangeLength)(L,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const D=this._getMouseBufferCoords(O);return!!D&&(this._selectWordAt(D,N),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(O,N){this._model.clearSelection(),O=Math.max(O,0),N=Math.min(N,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,O],this._model.selectionEnd=[this._bufferService.cols,N],this.refresh(),this._onSelectionChange.fire()}_handleTrim(O){this._model.handleTrim(O)&&this.refresh()}_getMouseBufferCoords(O){const N=this._mouseService.getCoords(O,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(N)return N[0]--,N[1]--,N[1]+=this._bufferService.buffer.ydisp,N}_getMouseEventScrollAmount(O){let N=(0,d.getCoordsRelativeToElement)(this._coreBrowserService.window,O,this._screenElement)[1];const L=this._renderService.dimensions.css.canvas.height;return N>=0&&N<=L?0:(N>L&&(N-=L),N=Math.min(Math.max(N,-50),50),N/=50,N/Math.abs(N)+Math.round(14*N))}shouldForceSelection(O){return _.isMac?O.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:O.shiftKey}handleMouseDown(O){if(this._mouseDownTimeStamp=O.timeStamp,(O.button!==2||!this.hasSelection)&&O.button===0){if(!this._enabled){if(!this.shouldForceSelection(O))return;O.stopPropagation()}O.preventDefault(),this._dragScrollAmount=0,this._enabled&&O.shiftKey?this._handleIncrementalClick(O):O.detail===1?this._handleSingleClick(O):O.detail===2?this._handleDoubleClick(O):O.detail===3&&this._handleTripleClick(O),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(O){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(O))}_handleSingleClick(O){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(O)?3:0,this._model.selectionStart=this._getMouseBufferCoords(O),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const N=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);N&&N.length!==this._model.selectionStart[0]&&N.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(O){this._selectWordAtCursor(O,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(O){const N=this._getMouseBufferCoords(O);N&&(this._activeSelectionMode=2,this._selectLineAt(N[1]))}shouldColumnSelect(O){return O.altKey&&!(_.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(O){if(O.stopImmediatePropagation(),!this._model.selectionStart)return;const N=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(O),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(O),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const L=this._bufferService.buffer;if(this._model.selectionEnd[1]<L.lines.length){const D=L.lines.get(this._model.selectionEnd[1]);D&&D.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}N&&N[0]===this._model.selectionEnd[0]&&N[1]===this._model.selectionEnd[1]||this.refresh(!0)}_dragScroll(){if(this._model.selectionEnd&&this._model.selectionStart&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});const O=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(O.ydisp+this._bufferService.rows,O.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=O.ydisp),this.refresh()}}_handleMouseUp(O){const N=O.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&N<500&&O.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const L=this._mouseService.getCoords(O,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(L&&L[0]!==void 0&&L[1]!==void 0){const D=(0,p.moveToCellSequence)(L[0]-1,L[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(D,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const O=this._model.finalSelectionStart,N=this._model.finalSelectionEnd,L=!(!O||!N||O[0]===N[0]&&O[1]===N[1]);L?O&&N&&(this._oldSelectionStart&&this._oldSelectionEnd&&O[0]===this._oldSelectionStart[0]&&O[1]===this._oldSelectionStart[1]&&N[0]===this._oldSelectionEnd[0]&&N[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(O,N,L)):this._oldHasSelection&&this._fireOnSelectionChange(O,N,L)}_fireOnSelectionChange(O,N,L){this._oldSelectionStart=O,this._oldSelectionEnd=N,this._oldHasSelection=L,this._onSelectionChange.fire()}_handleBufferActivate(O){this.clearSelection(),this._trimListener.dispose(),this._trimListener=O.activeBuffer.lines.onTrim((N=>this._handleTrim(N)))}_convertViewportColToCharacterIndex(O,N){let L=N;for(let D=0;N>=D;D++){const z=O.loadCell(D,this._workCell).getChars().length;this._workCell.getWidth()===0?L--:z>1&&N!==D&&(L+=z-1)}return L}setSelection(O,N,L){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[O,N],this._model.selectionStartLength=L,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(O){this._isClickInSelection(O)||(this._selectWordAtCursor(O,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(O,N,L=!0,D=!0){if(O[0]>=this._bufferService.cols)return;const z=this._bufferService.buffer,M=z.lines.get(O[1]);if(!M)return;const V=z.translateBufferLineToString(O[1],!1);let W=this._convertViewportColToCharacterIndex(M,O[0]),$=W;const q=O[0]-W;let Y=0,B=0,j=0,U=0;if(V.charAt(W)===" "){for(;W>0&&V.charAt(W-1)===" ";)W--;for(;$<V.length&&V.charAt($+1)===" ";)$++}else{let J=O[0],se=O[0];M.getWidth(J)===0&&(Y++,J--),M.getWidth(se)===2&&(B++,se++);const ae=M.getString(se).length;for(ae>1&&(U+=ae-1,$+=ae-1);J>0&&W>0&&!this._isCharWordSeparator(M.loadCell(J-1,this._workCell));){M.loadCell(J-1,this._workCell);const Q=this._workCell.getChars().length;this._workCell.getWidth()===0?(Y++,J--):Q>1&&(j+=Q-1,W-=Q-1),W--,J--}for(;se<M.length&&$+1<V.length&&!this._isCharWordSeparator(M.loadCell(se+1,this._workCell));){M.loadCell(se+1,this._workCell);const Q=this._workCell.getChars().length;this._workCell.getWidth()===2?(B++,se++):Q>1&&(U+=Q-1,$+=Q-1),$++,se++}}$++;let K=W+q-Y+j,H=Math.min(this._bufferService.cols,$-W+Y+B-j-U);if(N||V.slice(W,$).trim()!==""){if(L&&K===0&&M.getCodePoint(0)!==32){const J=z.lines.get(O[1]-1);if(J&&M.isWrapped&&J.getCodePoint(this._bufferService.cols-1)!==32){const se=this._getWordAt([this._bufferService.cols-1,O[1]-1],!1,!0,!1);if(se){const ae=this._bufferService.cols-se.start;K-=ae,H+=ae}}}if(D&&K+H===this._bufferService.cols&&M.getCodePoint(this._bufferService.cols-1)!==32){const J=z.lines.get(O[1]+1);if(J?.isWrapped&&J.getCodePoint(0)!==32){const se=this._getWordAt([0,O[1]+1],!1,!1,!0);se&&(H+=se.length)}}return{start:K,length:H}}}_selectWordAt(O,N){const L=this._getWordAt(O,N);if(L){for(;L.start<0;)L.start+=this._bufferService.cols,O[1]--;this._model.selectionStart=[L.start,O[1]],this._model.selectionStartLength=L.length}}_selectToWordAt(O){const N=this._getWordAt(O,!0);if(N){let L=O[1];for(;N.start<0;)N.start+=this._bufferService.cols,L--;if(!this._model.areSelectionValuesReversed())for(;N.start+N.length>this._bufferService.cols;)N.length-=this._bufferService.cols,L++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?N.start:N.start+N.length,L]}}_isCharWordSeparator(O){return O.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(O.getChars())>=0}_selectLineAt(O){const N=this._bufferService.buffer.getWrappedRangeForLine(O),L={start:{x:0,y:N.first},end:{x:this._bufferService.cols-1,y:N.last}};this._model.selectionStart=[0,N.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,v.getRangeLength)(L,this._bufferService.cols)}};o.SelectionService=R=u([f(3,T.IBufferService),f(4,T.ICoreService),f(5,y.IMouseService),f(6,T.IOptionsService),f(7,y.IRenderService),f(8,y.ICoreBrowserService)],R)},4725:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ILinkProviderService=o.IThemeService=o.ICharacterJoinerService=o.ISelectionService=o.IRenderService=o.IMouseService=o.ICoreBrowserService=o.ICharSizeService=void 0;const u=l(8343);o.ICharSizeService=(0,u.createDecorator)("CharSizeService"),o.ICoreBrowserService=(0,u.createDecorator)("CoreBrowserService"),o.IMouseService=(0,u.createDecorator)("MouseService"),o.IRenderService=(0,u.createDecorator)("RenderService"),o.ISelectionService=(0,u.createDecorator)("SelectionService"),o.ICharacterJoinerService=(0,u.createDecorator)("CharacterJoinerService"),o.IThemeService=(0,u.createDecorator)("ThemeService"),o.ILinkProviderService=(0,u.createDecorator)("LinkProviderService")},6731:function(s,o,l){var u=this&&this.__decorate||function(R,O,N,L){var D,z=arguments.length,M=z<3?O:L===null?L=Object.getOwnPropertyDescriptor(O,N):L;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(R,O,N,L);else for(var V=R.length-1;V>=0;V--)(D=R[V])&&(M=(z<3?D(M):z>3?D(O,N,M):D(O,N))||M);return z>3&&M&&Object.defineProperty(O,N,M),M},f=this&&this.__param||function(R,O){return function(N,L){O(N,L,R)}};Object.defineProperty(o,"__esModule",{value:!0}),o.ThemeService=o.DEFAULT_ANSI_COLORS=void 0;const d=l(7239),p=l(8055),m=l(8460),y=l(844),S=l(2585),g=p.css.toColor("#ffffff"),_=p.css.toColor("#000000"),v=p.css.toColor("#ffffff"),x=p.css.toColor("#000000"),T={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};o.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const R=[p.css.toColor("#2e3436"),p.css.toColor("#cc0000"),p.css.toColor("#4e9a06"),p.css.toColor("#c4a000"),p.css.toColor("#3465a4"),p.css.toColor("#75507b"),p.css.toColor("#06989a"),p.css.toColor("#d3d7cf"),p.css.toColor("#555753"),p.css.toColor("#ef2929"),p.css.toColor("#8ae234"),p.css.toColor("#fce94f"),p.css.toColor("#729fcf"),p.css.toColor("#ad7fa8"),p.css.toColor("#34e2e2"),p.css.toColor("#eeeeec")],O=[0,95,135,175,215,255];for(let N=0;N<216;N++){const L=O[N/36%6|0],D=O[N/6%6|0],z=O[N%6];R.push({css:p.channels.toCss(L,D,z),rgba:p.channels.toRgba(L,D,z)})}for(let N=0;N<24;N++){const L=8+10*N;R.push({css:p.channels.toCss(L,L,L),rgba:p.channels.toRgba(L,L,L)})}return R})());let w=o.ThemeService=class extends y.Disposable{get colors(){return this._colors}constructor(R){super(),this._optionsService=R,this._contrastCache=new d.ColorContrastCache,this._halfContrastCache=new d.ColorContrastCache,this._onChangeColors=this.register(new m.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:g,background:_,cursor:v,cursorAccent:x,selectionForeground:void 0,selectionBackgroundTransparent:T,selectionBackgroundOpaque:p.color.blend(_,T),selectionInactiveBackgroundTransparent:T,selectionInactiveBackgroundOpaque:p.color.blend(_,T),ansi:o.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(R={}){const O=this._colors;if(O.foreground=C(R.foreground,g),O.background=C(R.background,_),O.cursor=C(R.cursor,v),O.cursorAccent=C(R.cursorAccent,x),O.selectionBackgroundTransparent=C(R.selectionBackground,T),O.selectionBackgroundOpaque=p.color.blend(O.background,O.selectionBackgroundTransparent),O.selectionInactiveBackgroundTransparent=C(R.selectionInactiveBackground,O.selectionBackgroundTransparent),O.selectionInactiveBackgroundOpaque=p.color.blend(O.background,O.selectionInactiveBackgroundTransparent),O.selectionForeground=R.selectionForeground?C(R.selectionForeground,p.NULL_COLOR):void 0,O.selectionForeground===p.NULL_COLOR&&(O.selectionForeground=void 0),p.color.isOpaque(O.selectionBackgroundTransparent)&&(O.selectionBackgroundTransparent=p.color.opacity(O.selectionBackgroundTransparent,.3)),p.color.isOpaque(O.selectionInactiveBackgroundTransparent)&&(O.selectionInactiveBackgroundTransparent=p.color.opacity(O.selectionInactiveBackgroundTransparent,.3)),O.ansi=o.DEFAULT_ANSI_COLORS.slice(),O.ansi[0]=C(R.black,o.DEFAULT_ANSI_COLORS[0]),O.ansi[1]=C(R.red,o.DEFAULT_ANSI_COLORS[1]),O.ansi[2]=C(R.green,o.DEFAULT_ANSI_COLORS[2]),O.ansi[3]=C(R.yellow,o.DEFAULT_ANSI_COLORS[3]),O.ansi[4]=C(R.blue,o.DEFAULT_ANSI_COLORS[4]),O.ansi[5]=C(R.magenta,o.DEFAULT_ANSI_COLORS[5]),O.ansi[6]=C(R.cyan,o.DEFAULT_ANSI_COLORS[6]),O.ansi[7]=C(R.white,o.DEFAULT_ANSI_COLORS[7]),O.ansi[8]=C(R.brightBlack,o.DEFAULT_ANSI_COLORS[8]),O.ansi[9]=C(R.brightRed,o.DEFAULT_ANSI_COLORS[9]),O.ansi[10]=C(R.brightGreen,o.DEFAULT_ANSI_COLORS[10]),O.ansi[11]=C(R.brightYellow,o.DEFAULT_ANSI_COLORS[11]),O.ansi[12]=C(R.brightBlue,o.DEFAULT_ANSI_COLORS[12]),O.ansi[13]=C(R.brightMagenta,o.DEFAULT_ANSI_COLORS[13]),O.ansi[14]=C(R.brightCyan,o.DEFAULT_ANSI_COLORS[14]),O.ansi[15]=C(R.brightWhite,o.DEFAULT_ANSI_COLORS[15]),R.extendedAnsi){const N=Math.min(O.ansi.length-16,R.extendedAnsi.length);for(let L=0;L<N;L++)O.ansi[L+16]=C(R.extendedAnsi[L],o.DEFAULT_ANSI_COLORS[L+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(R){this._restoreColor(R),this._onChangeColors.fire(this.colors)}_restoreColor(R){if(R!==void 0)switch(R){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[R]=this._restoreColors.ansi[R]}else for(let O=0;O<this._restoreColors.ansi.length;++O)this._colors.ansi[O]=this._restoreColors.ansi[O]}modifyColors(R){R(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function C(R,O){if(R!==void 0)try{return p.css.toColor(R)}catch{}return O}o.ThemeService=w=u([f(0,S.IOptionsService)],w)},6349:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CircularList=void 0;const u=l(8460),f=l(844);class d extends f.Disposable{constructor(m){super(),this._maxLength=m,this.onDeleteEmitter=this.register(new u.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new u.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new u.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(m){if(this._maxLength===m)return;const y=new Array(m);for(let S=0;S<Math.min(m,this.length);S++)y[S]=this._array[this._getCyclicIndex(S)];this._array=y,this._maxLength=m,this._startIndex=0}get length(){return this._length}set length(m){if(m>this._length)for(let y=this._length;y<m;y++)this._array[y]=void 0;this._length=m}get(m){return this._array[this._getCyclicIndex(m)]}set(m,y){this._array[this._getCyclicIndex(m)]=y}push(m){this._array[this._getCyclicIndex(this._length)]=m,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(m,y,...S){if(y){for(let g=m;g<this._length-y;g++)this._array[this._getCyclicIndex(g)]=this._array[this._getCyclicIndex(g+y)];this._length-=y,this.onDeleteEmitter.fire({index:m,amount:y})}for(let g=this._length-1;g>=m;g--)this._array[this._getCyclicIndex(g+S.length)]=this._array[this._getCyclicIndex(g)];for(let g=0;g<S.length;g++)this._array[this._getCyclicIndex(m+g)]=S[g];if(S.length&&this.onInsertEmitter.fire({index:m,amount:S.length}),this._length+S.length>this._maxLength){const g=this._length+S.length-this._maxLength;this._startIndex+=g,this._length=this._maxLength,this.onTrimEmitter.fire(g)}else this._length+=S.length}trimStart(m){m>this._length&&(m=this._length),this._startIndex+=m,this._length-=m,this.onTrimEmitter.fire(m)}shiftElements(m,y,S){if(!(y<=0)){if(m<0||m>=this._length)throw new Error("start argument out of range");if(m+S<0)throw new Error("Cannot shift elements in list beyond index 0");if(S>0){for(let _=y-1;_>=0;_--)this.set(m+_+S,this.get(m+_));const g=m+y+S-this._length;if(g>0)for(this._length+=g;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let g=0;g<y;g++)this.set(m+g+S,this.get(m+g))}}_getCyclicIndex(m){return(this._startIndex+m)%this._maxLength}}o.CircularList=d},1439:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.clone=void 0,o.clone=function l(u,f=5){if(typeof u!="object")return u;const d=Array.isArray(u)?[]:{};for(const p in u)d[p]=f<=1?u[p]:u[p]&&l(u[p],f-1);return d}},8055:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.contrastRatio=o.toPaddedHex=o.rgba=o.rgb=o.css=o.color=o.channels=o.NULL_COLOR=void 0;let l=0,u=0,f=0,d=0;var p,m,y,S,g;function _(x){const T=x.toString(16);return T.length<2?"0"+T:T}function v(x,T){return x<T?(T+.05)/(x+.05):(x+.05)/(T+.05)}o.NULL_COLOR={css:"#00000000",rgba:0},(function(x){x.toCss=function(T,w,C,R){return R!==void 0?`#${_(T)}${_(w)}${_(C)}${_(R)}`:`#${_(T)}${_(w)}${_(C)}`},x.toRgba=function(T,w,C,R=255){return(T<<24|w<<16|C<<8|R)>>>0},x.toColor=function(T,w,C,R){return{css:x.toCss(T,w,C,R),rgba:x.toRgba(T,w,C,R)}}})(p||(o.channels=p={})),(function(x){function T(w,C){return d=Math.round(255*C),[l,u,f]=g.toChannels(w.rgba),{css:p.toCss(l,u,f,d),rgba:p.toRgba(l,u,f,d)}}x.blend=function(w,C){if(d=(255&C.rgba)/255,d===1)return{css:C.css,rgba:C.rgba};const R=C.rgba>>24&255,O=C.rgba>>16&255,N=C.rgba>>8&255,L=w.rgba>>24&255,D=w.rgba>>16&255,z=w.rgba>>8&255;return l=L+Math.round((R-L)*d),u=D+Math.round((O-D)*d),f=z+Math.round((N-z)*d),{css:p.toCss(l,u,f),rgba:p.toRgba(l,u,f)}},x.isOpaque=function(w){return(255&w.rgba)==255},x.ensureContrastRatio=function(w,C,R){const O=g.ensureContrastRatio(w.rgba,C.rgba,R);if(O)return p.toColor(O>>24&255,O>>16&255,O>>8&255)},x.opaque=function(w){const C=(255|w.rgba)>>>0;return[l,u,f]=g.toChannels(C),{css:p.toCss(l,u,f),rgba:C}},x.opacity=T,x.multiplyOpacity=function(w,C){return d=255&w.rgba,T(w,d*C/255)},x.toColorRGB=function(w){return[w.rgba>>24&255,w.rgba>>16&255,w.rgba>>8&255]}})(m||(o.color=m={})),(function(x){let T,w;try{const C=document.createElement("canvas");C.width=1,C.height=1;const R=C.getContext("2d",{willReadFrequently:!0});R&&(T=R,T.globalCompositeOperation="copy",w=T.createLinearGradient(0,0,1,1))}catch{}x.toColor=function(C){if(C.match(/#[\da-f]{3,8}/i))switch(C.length){case 4:return l=parseInt(C.slice(1,2).repeat(2),16),u=parseInt(C.slice(2,3).repeat(2),16),f=parseInt(C.slice(3,4).repeat(2),16),p.toColor(l,u,f);case 5:return l=parseInt(C.slice(1,2).repeat(2),16),u=parseInt(C.slice(2,3).repeat(2),16),f=parseInt(C.slice(3,4).repeat(2),16),d=parseInt(C.slice(4,5).repeat(2),16),p.toColor(l,u,f,d);case 7:return{css:C,rgba:(parseInt(C.slice(1),16)<<8|255)>>>0};case 9:return{css:C,rgba:parseInt(C.slice(1),16)>>>0}}const R=C.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(R)return l=parseInt(R[1]),u=parseInt(R[2]),f=parseInt(R[3]),d=Math.round(255*(R[5]===void 0?1:parseFloat(R[5]))),p.toColor(l,u,f,d);if(!T||!w)throw new Error("css.toColor: Unsupported css format");if(T.fillStyle=w,T.fillStyle=C,typeof T.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(T.fillRect(0,0,1,1),[l,u,f,d]=T.getImageData(0,0,1,1).data,d!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:p.toRgba(l,u,f,d),css:C}}})(y||(o.css=y={})),(function(x){function T(w,C,R){const O=w/255,N=C/255,L=R/255;return .2126*(O<=.03928?O/12.92:Math.pow((O+.055)/1.055,2.4))+.7152*(N<=.03928?N/12.92:Math.pow((N+.055)/1.055,2.4))+.0722*(L<=.03928?L/12.92:Math.pow((L+.055)/1.055,2.4))}x.relativeLuminance=function(w){return T(w>>16&255,w>>8&255,255&w)},x.relativeLuminance2=T})(S||(o.rgb=S={})),(function(x){function T(C,R,O){const N=C>>24&255,L=C>>16&255,D=C>>8&255;let z=R>>24&255,M=R>>16&255,V=R>>8&255,W=v(S.relativeLuminance2(z,M,V),S.relativeLuminance2(N,L,D));for(;W<O&&(z>0||M>0||V>0);)z-=Math.max(0,Math.ceil(.1*z)),M-=Math.max(0,Math.ceil(.1*M)),V-=Math.max(0,Math.ceil(.1*V)),W=v(S.relativeLuminance2(z,M,V),S.relativeLuminance2(N,L,D));return(z<<24|M<<16|V<<8|255)>>>0}function w(C,R,O){const N=C>>24&255,L=C>>16&255,D=C>>8&255;let z=R>>24&255,M=R>>16&255,V=R>>8&255,W=v(S.relativeLuminance2(z,M,V),S.relativeLuminance2(N,L,D));for(;W<O&&(z<255||M<255||V<255);)z=Math.min(255,z+Math.ceil(.1*(255-z))),M=Math.min(255,M+Math.ceil(.1*(255-M))),V=Math.min(255,V+Math.ceil(.1*(255-V))),W=v(S.relativeLuminance2(z,M,V),S.relativeLuminance2(N,L,D));return(z<<24|M<<16|V<<8|255)>>>0}x.blend=function(C,R){if(d=(255&R)/255,d===1)return R;const O=R>>24&255,N=R>>16&255,L=R>>8&255,D=C>>24&255,z=C>>16&255,M=C>>8&255;return l=D+Math.round((O-D)*d),u=z+Math.round((N-z)*d),f=M+Math.round((L-M)*d),p.toRgba(l,u,f)},x.ensureContrastRatio=function(C,R,O){const N=S.relativeLuminance(C>>8),L=S.relativeLuminance(R>>8);if(v(N,L)<O){if(L<N){const M=T(C,R,O),V=v(N,S.relativeLuminance(M>>8));if(V<O){const W=w(C,R,O);return V>v(N,S.relativeLuminance(W>>8))?M:W}return M}const D=w(C,R,O),z=v(N,S.relativeLuminance(D>>8));if(z<O){const M=T(C,R,O);return z>v(N,S.relativeLuminance(M>>8))?D:M}return D}},x.reduceLuminance=T,x.increaseLuminance=w,x.toChannels=function(C){return[C>>24&255,C>>16&255,C>>8&255,255&C]}})(g||(o.rgba=g={})),o.toPaddedHex=_,o.contrastRatio=v},8969:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CoreTerminal=void 0;const u=l(844),f=l(2585),d=l(4348),p=l(7866),m=l(744),y=l(7302),S=l(6975),g=l(8460),_=l(1753),v=l(1480),x=l(7994),T=l(9282),w=l(5435),C=l(5981),R=l(2660);let O=!1;class N extends u.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new g.EventEmitter),this._onScroll.event((D=>{this._onScrollApi?.fire(D.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(D){for(const z in D)this.optionsService.options[z]=D[z]}constructor(D){super(),this._windowsWrappingHeuristics=this.register(new u.MutableDisposable),this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new g.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new g.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new g.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new g.EventEmitter),this._instantiationService=new d.InstantiationService,this.optionsService=this.register(new y.OptionsService(D)),this._instantiationService.setService(f.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(m.BufferService)),this._instantiationService.setService(f.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(p.LogService)),this._instantiationService.setService(f.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(S.CoreService)),this._instantiationService.setService(f.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(_.CoreMouseService)),this._instantiationService.setService(f.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(v.UnicodeService)),this._instantiationService.setService(f.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(x.CharsetService),this._instantiationService.setService(f.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(R.OscLinkService),this._instantiationService.setService(f.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new w.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,g.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,g.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,g.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,g.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((z=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((z=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new C.WriteBuffer(((z,M)=>this._inputHandler.parse(z,M)))),this.register((0,g.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(D,z){this._writeBuffer.write(D,z)}writeSync(D,z){this._logService.logLevel<=f.LogLevelEnum.WARN&&!O&&(this._logService.warn("writeSync is unreliable and will be removed soon."),O=!0),this._writeBuffer.writeSync(D,z)}input(D,z=!0){this.coreService.triggerDataEvent(D,z)}resize(D,z){isNaN(D)||isNaN(z)||(D=Math.max(D,m.MINIMUM_COLS),z=Math.max(z,m.MINIMUM_ROWS),this._bufferService.resize(D,z))}scroll(D,z=!1){this._bufferService.scroll(D,z)}scrollLines(D,z,M){this._bufferService.scrollLines(D,z,M)}scrollPages(D){this.scrollLines(D*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(D){const z=D-this._bufferService.buffer.ydisp;z!==0&&this.scrollLines(z)}registerEscHandler(D,z){return this._inputHandler.registerEscHandler(D,z)}registerDcsHandler(D,z){return this._inputHandler.registerDcsHandler(D,z)}registerCsiHandler(D,z){return this._inputHandler.registerCsiHandler(D,z)}registerOscHandler(D,z){return this._inputHandler.registerOscHandler(D,z)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let D=!1;const z=this.optionsService.rawOptions.windowsPty;z&&z.buildNumber!==void 0&&z.buildNumber!==void 0?D=z.backend==="conpty"&&z.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(D=!0),D?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const D=[];D.push(this.onLineFeed(T.updateWindowsModeWrappedState.bind(null,this._bufferService))),D.push(this.registerCsiHandler({final:"H"},(()=>((0,T.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,u.toDisposable)((()=>{for(const z of D)z.dispose()}))}}}o.CoreTerminal=N},8460:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.runAndSubscribe=o.forwardEvent=o.EventEmitter=void 0,o.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=l=>(this._listeners.push(l),{dispose:()=>{if(!this._disposed){for(let u=0;u<this._listeners.length;u++)if(this._listeners[u]===l)return void this._listeners.splice(u,1)}}})),this._event}fire(l,u){const f=[];for(let d=0;d<this._listeners.length;d++)f.push(this._listeners[d]);for(let d=0;d<f.length;d++)f[d].call(void 0,l,u)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},o.forwardEvent=function(l,u){return l((f=>u.fire(f)))},o.runAndSubscribe=function(l,u){return u(void 0),l((f=>u(f)))}},5435:function(s,o,l){var u=this&&this.__decorate||function(Y,B,j,U){var K,H=arguments.length,J=H<3?B:U===null?U=Object.getOwnPropertyDescriptor(B,j):U;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")J=Reflect.decorate(Y,B,j,U);else for(var se=Y.length-1;se>=0;se--)(K=Y[se])&&(J=(H<3?K(J):H>3?K(B,j,J):K(B,j))||J);return H>3&&J&&Object.defineProperty(B,j,J),J},f=this&&this.__param||function(Y,B){return function(j,U){B(j,U,Y)}};Object.defineProperty(o,"__esModule",{value:!0}),o.InputHandler=o.WindowsOptionsReportType=void 0;const d=l(2584),p=l(7116),m=l(2015),y=l(844),S=l(482),g=l(8437),_=l(8460),v=l(643),x=l(511),T=l(3734),w=l(2585),C=l(1480),R=l(6242),O=l(6351),N=l(5941),L={"(":0,")":1,"*":2,"+":3,"-":1,".":2},D=131072;function z(Y,B){if(Y>24)return B.setWinLines||!1;switch(Y){case 1:return!!B.restoreWin;case 2:return!!B.minimizeWin;case 3:return!!B.setWinPosition;case 4:return!!B.setWinSizePixels;case 5:return!!B.raiseWin;case 6:return!!B.lowerWin;case 7:return!!B.refreshWin;case 8:return!!B.setWinSizeChars;case 9:return!!B.maximizeWin;case 10:return!!B.fullscreenWin;case 11:return!!B.getWinState;case 13:return!!B.getWinPosition;case 14:return!!B.getWinSizePixels;case 15:return!!B.getScreenSizePixels;case 16:return!!B.getCellSizePixels;case 18:return!!B.getWinSizeChars;case 19:return!!B.getScreenSizeChars;case 20:return!!B.getIconTitle;case 21:return!!B.getWinTitle;case 22:return!!B.pushTitle;case 23:return!!B.popTitle;case 24:return!!B.setWinLines}return!1}var M;(function(Y){Y[Y.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",Y[Y.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(M||(o.WindowsOptionsReportType=M={}));let V=0;class W extends y.Disposable{getAttrData(){return this._curAttrData}constructor(B,j,U,K,H,J,se,ae,Q=new m.EscapeSequenceParser){super(),this._bufferService=B,this._charsetService=j,this._coreService=U,this._logService=K,this._optionsService=H,this._oscLinkService=J,this._coreMouseService=se,this._unicodeService=ae,this._parser=Q,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new S.StringToUtf32,this._utf8Decoder=new S.Utf8ToUtf32,this._workCell=new x.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new _.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new _.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new _.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new _.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new _.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new _.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new _.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new _.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new _.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new _.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new _.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new _.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new _.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new $(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((G=>this._activeBuffer=G.activeBuffer))),this._parser.setCsiHandlerFallback(((G,Z)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(G),params:Z.toArray()})})),this._parser.setEscHandlerFallback((G=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(G)})})),this._parser.setExecuteHandlerFallback((G=>{this._logService.debug("Unknown EXECUTE code: ",{code:G})})),this._parser.setOscHandlerFallback(((G,Z,ee)=>{this._logService.debug("Unknown OSC code: ",{identifier:G,action:Z,data:ee})})),this._parser.setDcsHandlerFallback(((G,Z,ee)=>{Z==="HOOK"&&(ee=ee.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(G),action:Z,payload:ee})})),this._parser.setPrintHandler(((G,Z,ee)=>this.print(G,Z,ee))),this._parser.registerCsiHandler({final:"@"},(G=>this.insertChars(G))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(G=>this.scrollLeft(G))),this._parser.registerCsiHandler({final:"A"},(G=>this.cursorUp(G))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(G=>this.scrollRight(G))),this._parser.registerCsiHandler({final:"B"},(G=>this.cursorDown(G))),this._parser.registerCsiHandler({final:"C"},(G=>this.cursorForward(G))),this._parser.registerCsiHandler({final:"D"},(G=>this.cursorBackward(G))),this._parser.registerCsiHandler({final:"E"},(G=>this.cursorNextLine(G))),this._parser.registerCsiHandler({final:"F"},(G=>this.cursorPrecedingLine(G))),this._parser.registerCsiHandler({final:"G"},(G=>this.cursorCharAbsolute(G))),this._parser.registerCsiHandler({final:"H"},(G=>this.cursorPosition(G))),this._parser.registerCsiHandler({final:"I"},(G=>this.cursorForwardTab(G))),this._parser.registerCsiHandler({final:"J"},(G=>this.eraseInDisplay(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(G=>this.eraseInDisplay(G,!0))),this._parser.registerCsiHandler({final:"K"},(G=>this.eraseInLine(G,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(G=>this.eraseInLine(G,!0))),this._parser.registerCsiHandler({final:"L"},(G=>this.insertLines(G))),this._parser.registerCsiHandler({final:"M"},(G=>this.deleteLines(G))),this._parser.registerCsiHandler({final:"P"},(G=>this.deleteChars(G))),this._parser.registerCsiHandler({final:"S"},(G=>this.scrollUp(G))),this._parser.registerCsiHandler({final:"T"},(G=>this.scrollDown(G))),this._parser.registerCsiHandler({final:"X"},(G=>this.eraseChars(G))),this._parser.registerCsiHandler({final:"Z"},(G=>this.cursorBackwardTab(G))),this._parser.registerCsiHandler({final:"`"},(G=>this.charPosAbsolute(G))),this._parser.registerCsiHandler({final:"a"},(G=>this.hPositionRelative(G))),this._parser.registerCsiHandler({final:"b"},(G=>this.repeatPrecedingCharacter(G))),this._parser.registerCsiHandler({final:"c"},(G=>this.sendDeviceAttributesPrimary(G))),this._parser.registerCsiHandler({prefix:">",final:"c"},(G=>this.sendDeviceAttributesSecondary(G))),this._parser.registerCsiHandler({final:"d"},(G=>this.linePosAbsolute(G))),this._parser.registerCsiHandler({final:"e"},(G=>this.vPositionRelative(G))),this._parser.registerCsiHandler({final:"f"},(G=>this.hVPosition(G))),this._parser.registerCsiHandler({final:"g"},(G=>this.tabClear(G))),this._parser.registerCsiHandler({final:"h"},(G=>this.setMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(G=>this.setModePrivate(G))),this._parser.registerCsiHandler({final:"l"},(G=>this.resetMode(G))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(G=>this.resetModePrivate(G))),this._parser.registerCsiHandler({final:"m"},(G=>this.charAttributes(G))),this._parser.registerCsiHandler({final:"n"},(G=>this.deviceStatus(G))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(G=>this.deviceStatusPrivate(G))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(G=>this.softReset(G))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(G=>this.setCursorStyle(G))),this._parser.registerCsiHandler({final:"r"},(G=>this.setScrollRegion(G))),this._parser.registerCsiHandler({final:"s"},(G=>this.saveCursor(G))),this._parser.registerCsiHandler({final:"t"},(G=>this.windowOptions(G))),this._parser.registerCsiHandler({final:"u"},(G=>this.restoreCursor(G))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(G=>this.insertColumns(G))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(G=>this.deleteColumns(G))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(G=>this.selectProtected(G))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(G=>this.requestMode(G,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(G=>this.requestMode(G,!1))),this._parser.setExecuteHandler(d.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(d.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(d.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(d.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(d.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(d.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(d.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(d.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(d.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(d.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new R.OscHandler((G=>(this.setTitle(G),this.setIconName(G),!0)))),this._parser.registerOscHandler(1,new R.OscHandler((G=>this.setIconName(G)))),this._parser.registerOscHandler(2,new R.OscHandler((G=>this.setTitle(G)))),this._parser.registerOscHandler(4,new R.OscHandler((G=>this.setOrReportIndexedColor(G)))),this._parser.registerOscHandler(8,new R.OscHandler((G=>this.setHyperlink(G)))),this._parser.registerOscHandler(10,new R.OscHandler((G=>this.setOrReportFgColor(G)))),this._parser.registerOscHandler(11,new R.OscHandler((G=>this.setOrReportBgColor(G)))),this._parser.registerOscHandler(12,new R.OscHandler((G=>this.setOrReportCursorColor(G)))),this._parser.registerOscHandler(104,new R.OscHandler((G=>this.restoreIndexedColor(G)))),this._parser.registerOscHandler(110,new R.OscHandler((G=>this.restoreFgColor(G)))),this._parser.registerOscHandler(111,new R.OscHandler((G=>this.restoreBgColor(G)))),this._parser.registerOscHandler(112,new R.OscHandler((G=>this.restoreCursorColor(G)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const G in p.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:G},(()=>this.selectCharset("("+G))),this._parser.registerEscHandler({intermediates:")",final:G},(()=>this.selectCharset(")"+G))),this._parser.registerEscHandler({intermediates:"*",final:G},(()=>this.selectCharset("*"+G))),this._parser.registerEscHandler({intermediates:"+",final:G},(()=>this.selectCharset("+"+G))),this._parser.registerEscHandler({intermediates:"-",final:G},(()=>this.selectCharset("-"+G))),this._parser.registerEscHandler({intermediates:".",final:G},(()=>this.selectCharset("."+G))),this._parser.registerEscHandler({intermediates:"/",final:G},(()=>this.selectCharset("/"+G)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((G=>(this._logService.error("Parsing error: ",G),G))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new O.DcsHandler(((G,Z)=>this.requestStatusString(G,Z))))}_preserveStack(B,j,U,K){this._parseStack.paused=!0,this._parseStack.cursorStartX=B,this._parseStack.cursorStartY=j,this._parseStack.decodedLength=U,this._parseStack.position=K}_logSlowResolvingAsync(B){this._logService.logLevel<=w.LogLevelEnum.WARN&&Promise.race([B,new Promise(((j,U)=>setTimeout((()=>U("#SLOW_TIMEOUT")),5e3)))]).catch((j=>{if(j!=="#SLOW_TIMEOUT")throw j;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(B,j){let U,K=this._activeBuffer.x,H=this._activeBuffer.y,J=0;const se=this._parseStack.paused;if(se){if(U=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,j))return this._logSlowResolvingAsync(U),U;K=this._parseStack.cursorStartX,H=this._parseStack.cursorStartY,this._parseStack.paused=!1,B.length>D&&(J=this._parseStack.position+D)}if(this._logService.logLevel<=w.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof B=="string"?` "${B}"`:` "${Array.prototype.map.call(B,(G=>String.fromCharCode(G))).join("")}"`),typeof B=="string"?B.split("").map((G=>G.charCodeAt(0))):B),this._parseBuffer.length<B.length&&this._parseBuffer.length<D&&(this._parseBuffer=new Uint32Array(Math.min(B.length,D))),se||this._dirtyRowTracker.clearRange(),B.length>D)for(let G=J;G<B.length;G+=D){const Z=G+D<B.length?G+D:B.length,ee=typeof B=="string"?this._stringDecoder.decode(B.substring(G,Z),this._parseBuffer):this._utf8Decoder.decode(B.subarray(G,Z),this._parseBuffer);if(U=this._parser.parse(this._parseBuffer,ee))return this._preserveStack(K,H,ee,G),this._logSlowResolvingAsync(U),U}else if(!se){const G=typeof B=="string"?this._stringDecoder.decode(B,this._parseBuffer):this._utf8Decoder.decode(B,this._parseBuffer);if(U=this._parser.parse(this._parseBuffer,G))return this._preserveStack(K,H,G,0),this._logSlowResolvingAsync(U),U}this._activeBuffer.x===K&&this._activeBuffer.y===H||this._onCursorMove.fire();const ae=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),Q=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);Q<this._bufferService.rows&&this._onRequestRefreshRows.fire(Math.min(Q,this._bufferService.rows-1),Math.min(ae,this._bufferService.rows-1))}print(B,j,U){let K,H;const J=this._charsetService.charset,se=this._optionsService.rawOptions.screenReaderMode,ae=this._bufferService.cols,Q=this._coreService.decPrivateModes.wraparound,G=this._coreService.modes.insertMode,Z=this._curAttrData;let ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&U-j>0&&ee.getWidth(this._activeBuffer.x-1)===2&&ee.setCellFromCodepoint(this._activeBuffer.x-1,0,1,Z);let ne=this._parser.precedingJoinState;for(let te=j;te<U;++te){if(K=B[te],K<127&&J){const ye=J[String.fromCharCode(K)];ye&&(K=ye.charCodeAt(0))}const be=this._unicodeService.charProperties(K,ne);H=C.UnicodeService.extractWidth(be);const _e=C.UnicodeService.extractShouldJoin(be),he=_e?C.UnicodeService.extractWidth(ne):0;if(ne=be,se&&this._onA11yChar.fire((0,S.stringFromCodePoint)(K)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+H-he>ae){if(Q){const ye=ee;let Ee=this._activeBuffer.x-he;for(this._activeBuffer.x=he,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),ee=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),he>0&&ee instanceof g.BufferLine&&ee.copyCellsFrom(ye,Ee,0,he,!1);Ee<ae;)ye.setCellFromCodepoint(Ee++,0,1,Z)}else if(this._activeBuffer.x=ae-1,H===2)continue}if(_e&&this._activeBuffer.x){const ye=ee.getWidth(this._activeBuffer.x-1)?1:2;ee.addCodepointToCell(this._activeBuffer.x-ye,K,H);for(let Ee=H-he;--Ee>=0;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,Z)}else if(G&&(ee.insertCells(this._activeBuffer.x,H-he,this._activeBuffer.getNullCell(Z)),ee.getWidth(ae-1)===2&&ee.setCellFromCodepoint(ae-1,v.NULL_CELL_CODE,v.NULL_CELL_WIDTH,Z)),ee.setCellFromCodepoint(this._activeBuffer.x++,K,H,Z),H>0)for(;--H;)ee.setCellFromCodepoint(this._activeBuffer.x++,0,0,Z)}this._parser.precedingJoinState=ne,this._activeBuffer.x<ae&&U-j>0&&ee.getWidth(this._activeBuffer.x)===0&&!ee.hasContent(this._activeBuffer.x)&&ee.setCellFromCodepoint(this._activeBuffer.x,0,1,Z),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(B,j){return B.final!=="t"||B.prefix||B.intermediates?this._parser.registerCsiHandler(B,j):this._parser.registerCsiHandler(B,(U=>!z(U.params[0],this._optionsService.rawOptions.windowOptions)||j(U)))}registerDcsHandler(B,j){return this._parser.registerDcsHandler(B,new O.DcsHandler(j))}registerEscHandler(B,j){return this._parser.registerEscHandler(B,j)}registerOscHandler(B,j){return this._parser.registerOscHandler(B,new R.OscHandler(j))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);B.hasWidth(this._activeBuffer.x)&&!B.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const B=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-B),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(B=this._bufferService.cols-1){this._activeBuffer.x=Math.min(B,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(B,j){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=B,this._activeBuffer.y=this._activeBuffer.scrollTop+j):(this._activeBuffer.x=B,this._activeBuffer.y=j),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(B,j){this._restrictCursor(),this._setCursor(this._activeBuffer.x+B,this._activeBuffer.y+j)}cursorUp(B){const j=this._activeBuffer.y-this._activeBuffer.scrollTop;return j>=0?this._moveCursor(0,-Math.min(j,B.params[0]||1)):this._moveCursor(0,-(B.params[0]||1)),!0}cursorDown(B){const j=this._activeBuffer.scrollBottom-this._activeBuffer.y;return j>=0?this._moveCursor(0,Math.min(j,B.params[0]||1)):this._moveCursor(0,B.params[0]||1),!0}cursorForward(B){return this._moveCursor(B.params[0]||1,0),!0}cursorBackward(B){return this._moveCursor(-(B.params[0]||1),0),!0}cursorNextLine(B){return this.cursorDown(B),this._activeBuffer.x=0,!0}cursorPrecedingLine(B){return this.cursorUp(B),this._activeBuffer.x=0,!0}cursorCharAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(B){return this._setCursor(B.length>=2?(B.params[1]||1)-1:0,(B.params[0]||1)-1),!0}charPosAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(B){return this._moveCursor(B.params[0]||1,0),!0}linePosAbsolute(B){return this._setCursor(this._activeBuffer.x,(B.params[0]||1)-1),!0}vPositionRelative(B){return this._moveCursor(0,B.params[0]||1),!0}hVPosition(B){return this.cursorPosition(B),!0}tabClear(B){const j=B.params[0];return j===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:j===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let j=B.params[0]||1;for(;j--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let j=B.params[0]||1;for(;j--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(B){const j=B.params[0];return j===1&&(this._curAttrData.bg|=536870912),j!==2&&j!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(B,j,U,K=!1,H=!1){const J=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);J.replaceCells(j,U,this._activeBuffer.getNullCell(this._eraseAttrData()),H),K&&(J.isWrapped=!1)}_resetBufferLine(B,j=!1){const U=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);U&&(U.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),j),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+B),U.isWrapped=!1)}eraseInDisplay(B,j=!1){let U;switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:for(U=this._activeBuffer.y,this._dirtyRowTracker.markDirty(U),this._eraseInBufferLine(U++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,j);U<this._bufferService.rows;U++)this._resetBufferLine(U,j);this._dirtyRowTracker.markDirty(U);break;case 1:for(U=this._activeBuffer.y,this._dirtyRowTracker.markDirty(U),this._eraseInBufferLine(U,0,this._activeBuffer.x+1,!0,j),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(U+1).isWrapped=!1);U--;)this._resetBufferLine(U,j);this._dirtyRowTracker.markDirty(0);break;case 2:for(U=this._bufferService.rows,this._dirtyRowTracker.markDirty(U-1);U--;)this._resetBufferLine(U,j);this._dirtyRowTracker.markDirty(0);break;case 3:const K=this._activeBuffer.lines.length-this._bufferService.rows;K>0&&(this._activeBuffer.lines.trimStart(K),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-K,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-K,0),this._onScroll.fire(0))}return!0}eraseInLine(B,j=!1){switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,j);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,j);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,j)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(B){this._restrictCursor();let j=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=this._activeBuffer.ybase+this._activeBuffer.y,K=this._bufferService.rows-1-this._activeBuffer.scrollBottom,H=this._bufferService.rows-1+this._activeBuffer.ybase-K+1;for(;j--;)this._activeBuffer.lines.splice(H-1,1),this._activeBuffer.lines.splice(U,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(B){this._restrictCursor();let j=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const U=this._activeBuffer.ybase+this._activeBuffer.y;let K;for(K=this._bufferService.rows-1-this._activeBuffer.scrollBottom,K=this._bufferService.rows-1+this._activeBuffer.ybase-K;j--;)this._activeBuffer.lines.splice(U,1),this._activeBuffer.lines.splice(K,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(B){this._restrictCursor();const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.insertCells(this._activeBuffer.x,B.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(B){this._restrictCursor();const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.deleteCells(this._activeBuffer.x,B.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(B){let j=B.params[0]||1;for(;j--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(B){let j=B.params[0]||1;for(;j--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(g.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=B.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);K.deleteCells(0,j,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=B.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);K.insertCells(0,j,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=B.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);K.insertCells(this._activeBuffer.x,j,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(B){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const j=B.params[0]||1;for(let U=this._activeBuffer.scrollTop;U<=this._activeBuffer.scrollBottom;++U){const K=this._activeBuffer.lines.get(this._activeBuffer.ybase+U);K.deleteCells(this._activeBuffer.x,j,this._activeBuffer.getNullCell(this._eraseAttrData())),K.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(B){this._restrictCursor();const j=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return j&&(j.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(B.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(B){const j=this._parser.precedingJoinState;if(!j)return!0;const U=B.params[0]||1,K=C.UnicodeService.extractWidth(j),H=this._activeBuffer.x-K,J=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(H),se=new Uint32Array(J.length*U);let ae=0;for(let G=0;G<J.length;){const Z=J.codePointAt(G)||0;se[ae++]=Z,G+=Z>65535?2:1}let Q=ae;for(let G=1;G<U;++G)se.copyWithin(Q,0,ae),Q+=ae;return this.print(se,0,Q),!0}sendDeviceAttributesPrimary(B){return B.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(d.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(d.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(B){return B.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(d.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(d.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(B.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(d.C0.ESC+"[>83;40003;0c")),!0}_is(B){return(this._optionsService.rawOptions.termName+"").indexOf(B)===0}setMode(B){for(let j=0;j<B.length;j++)switch(B.params[j]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(B){for(let j=0;j<B.length;j++)switch(B.params[j]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),this._charsetService.setgCharset(1,p.DEFAULT_CHARSET),this._charsetService.setgCharset(2,p.DEFAULT_CHARSET),this._charsetService.setgCharset(3,p.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(B){for(let j=0;j<B.length;j++)switch(B.params[j]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(B){for(let j=0;j<B.length;j++)switch(B.params[j]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),B.params[j]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(B,j){const U=this._coreService.decPrivateModes,{activeProtocol:K,activeEncoding:H}=this._coreMouseService,J=this._coreService,{buffers:se,cols:ae}=this._bufferService,{active:Q,alt:G}=se,Z=this._optionsService.rawOptions,ee=_e=>_e?1:2,ne=B.params[0];return te=ne,be=j?ne===2?4:ne===4?ee(J.modes.insertMode):ne===12?3:ne===20?ee(Z.convertEol):0:ne===1?ee(U.applicationCursorKeys):ne===3?Z.windowOptions.setWinLines?ae===80?2:ae===132?1:0:0:ne===6?ee(U.origin):ne===7?ee(U.wraparound):ne===8?3:ne===9?ee(K==="X10"):ne===12?ee(Z.cursorBlink):ne===25?ee(!J.isCursorHidden):ne===45?ee(U.reverseWraparound):ne===66?ee(U.applicationKeypad):ne===67?4:ne===1e3?ee(K==="VT200"):ne===1002?ee(K==="DRAG"):ne===1003?ee(K==="ANY"):ne===1004?ee(U.sendFocus):ne===1005?4:ne===1006?ee(H==="SGR"):ne===1015?4:ne===1016?ee(H==="SGR_PIXELS"):ne===1048?1:ne===47||ne===1047||ne===1049?ee(Q===G):ne===2004?ee(U.bracketedPasteMode):0,J.triggerDataEvent(`${d.C0.ESC}[${j?"":"?"}${te};${be}$y`),!0;var te,be}_updateAttrColor(B,j,U,K,H){return j===2?(B|=50331648,B&=-16777216,B|=T.AttributeData.fromColorRGB([U,K,H])):j===5&&(B&=-50331904,B|=33554432|255&U),B}_extractColor(B,j,U){const K=[0,0,-1,0,0,0];let H=0,J=0;do{if(K[J+H]=B.params[j+J],B.hasSubParams(j+J)){const se=B.getSubParams(j+J);let ae=0;do K[1]===5&&(H=1),K[J+ae+1+H]=se[ae];while(++ae<se.length&&ae+J+1+H<K.length);break}if(K[1]===5&&J+H>=2||K[1]===2&&J+H>=5)break;K[1]&&(H=1)}while(++J+j<B.length&&J+H<K.length);for(let se=2;se<K.length;++se)K[se]===-1&&(K[se]=0);switch(K[0]){case 38:U.fg=this._updateAttrColor(U.fg,K[1],K[3],K[4],K[5]);break;case 48:U.bg=this._updateAttrColor(U.bg,K[1],K[3],K[4],K[5]);break;case 58:U.extended=U.extended.clone(),U.extended.underlineColor=this._updateAttrColor(U.extended.underlineColor,K[1],K[3],K[4],K[5])}return J}_processUnderline(B,j){j.extended=j.extended.clone(),(!~B||B>5)&&(B=1),j.extended.underlineStyle=B,j.fg|=268435456,B===0&&(j.fg&=-268435457),j.updateExtended()}_processSGR0(B){B.fg=g.DEFAULT_ATTR_DATA.fg,B.bg=g.DEFAULT_ATTR_DATA.bg,B.extended=B.extended.clone(),B.extended.underlineStyle=0,B.extended.underlineColor&=-67108864,B.updateExtended()}charAttributes(B){if(B.length===1&&B.params[0]===0)return this._processSGR0(this._curAttrData),!0;const j=B.length;let U;const K=this._curAttrData;for(let H=0;H<j;H++)U=B.params[H],U>=30&&U<=37?(K.fg&=-50331904,K.fg|=16777216|U-30):U>=40&&U<=47?(K.bg&=-50331904,K.bg|=16777216|U-40):U>=90&&U<=97?(K.fg&=-50331904,K.fg|=16777224|U-90):U>=100&&U<=107?(K.bg&=-50331904,K.bg|=16777224|U-100):U===0?this._processSGR0(K):U===1?K.fg|=134217728:U===3?K.bg|=67108864:U===4?(K.fg|=268435456,this._processUnderline(B.hasSubParams(H)?B.getSubParams(H)[0]:1,K)):U===5?K.fg|=536870912:U===7?K.fg|=67108864:U===8?K.fg|=1073741824:U===9?K.fg|=2147483648:U===2?K.bg|=134217728:U===21?this._processUnderline(2,K):U===22?(K.fg&=-134217729,K.bg&=-134217729):U===23?K.bg&=-67108865:U===24?(K.fg&=-268435457,this._processUnderline(0,K)):U===25?K.fg&=-536870913:U===27?K.fg&=-67108865:U===28?K.fg&=-1073741825:U===29?K.fg&=2147483647:U===39?(K.fg&=-67108864,K.fg|=16777215&g.DEFAULT_ATTR_DATA.fg):U===49?(K.bg&=-67108864,K.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):U===38||U===48||U===58?H+=this._extractColor(B,H,K):U===53?K.bg|=1073741824:U===55?K.bg&=-1073741825:U===59?(K.extended=K.extended.clone(),K.extended.underlineColor=-1,K.updateExtended()):U===100?(K.fg&=-67108864,K.fg|=16777215&g.DEFAULT_ATTR_DATA.fg,K.bg&=-67108864,K.bg|=16777215&g.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",U);return!0}deviceStatus(B){switch(B.params[0]){case 5:this._coreService.triggerDataEvent(`${d.C0.ESC}[0n`);break;case 6:const j=this._activeBuffer.y+1,U=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[${j};${U}R`)}return!0}deviceStatusPrivate(B){if(B.params[0]===6){const j=this._activeBuffer.y+1,U=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${d.C0.ESC}[?${j};${U}R`)}return!0}softReset(B){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=g.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(B){const j=B.params[0]||1;switch(j){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const U=j%2==1;return this._optionsService.options.cursorBlink=U,!0}setScrollRegion(B){const j=B.params[0]||1;let U;return(B.length<2||(U=B.params[1])>this._bufferService.rows||U===0)&&(U=this._bufferService.rows),U>j&&(this._activeBuffer.scrollTop=j-1,this._activeBuffer.scrollBottom=U-1,this._setCursor(0,0)),!0}windowOptions(B){if(!z(B.params[0],this._optionsService.rawOptions.windowOptions))return!0;const j=B.length>1?B.params[1]:0;switch(B.params[0]){case 14:j!==2&&this._onRequestWindowsOptionsReport.fire(M.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(M.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${d.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:j!==0&&j!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),j!==0&&j!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:j!==0&&j!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),j!==0&&j!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(B){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(B){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(B){return this._windowTitle=B,this._onTitleChange.fire(B),!0}setIconName(B){return this._iconName=B,!0}setOrReportIndexedColor(B){const j=[],U=B.split(";");for(;U.length>1;){const K=U.shift(),H=U.shift();if(/^\d+$/.exec(K)){const J=parseInt(K);if(q(J))if(H==="?")j.push({type:0,index:J});else{const se=(0,N.parseColor)(H);se&&j.push({type:1,index:J,color:se})}}}return j.length&&this._onColor.fire(j),!0}setHyperlink(B){const j=B.split(";");return!(j.length<2)&&(j[1]?this._createHyperlink(j[0],j[1]):!j[0]&&this._finishHyperlink())}_createHyperlink(B,j){this._getCurrentLinkId()&&this._finishHyperlink();const U=B.split(":");let K;const H=U.findIndex((J=>J.startsWith("id=")));return H!==-1&&(K=U[H].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:K,uri:j}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(B,j){const U=B.split(";");for(let K=0;K<U.length&&!(j>=this._specialColors.length);++K,++j)if(U[K]==="?")this._onColor.fire([{type:0,index:this._specialColors[j]}]);else{const H=(0,N.parseColor)(U[K]);H&&this._onColor.fire([{type:1,index:this._specialColors[j],color:H}])}return!0}setOrReportFgColor(B){return this._setOrReportSpecialColor(B,0)}setOrReportBgColor(B){return this._setOrReportSpecialColor(B,1)}setOrReportCursorColor(B){return this._setOrReportSpecialColor(B,2)}restoreIndexedColor(B){if(!B)return this._onColor.fire([{type:2}]),!0;const j=[],U=B.split(";");for(let K=0;K<U.length;++K)if(/^\d+$/.exec(U[K])){const H=parseInt(U[K]);q(H)&&j.push({type:2,index:H})}return j.length&&this._onColor.fire(j),!0}restoreFgColor(B){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(B){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(B){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,p.DEFAULT_CHARSET),!0}selectCharset(B){return B.length!==2?(this.selectDefaultCharset(),!0):(B[0]==="/"||this._charsetService.setgCharset(L[B[0]],p.CHARSETS[B[1]]||p.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const B=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,B,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=g.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=g.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(B){return this._charsetService.setgLevel(B),!0}screenAlignmentPattern(){const B=new x.CellData;B.content=4194373,B.fg=this._curAttrData.fg,B.bg=this._curAttrData.bg,this._setCursor(0,0);for(let j=0;j<this._bufferService.rows;++j){const U=this._activeBuffer.ybase+this._activeBuffer.y+j,K=this._activeBuffer.lines.get(U);K&&(K.fill(B),K.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(B,j){const U=this._bufferService.buffer,K=this._optionsService.rawOptions;return(H=>(this._coreService.triggerDataEvent(`${d.C0.ESC}${H}${d.C0.ESC}\\`),!0))(B==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:B==='"p'?'P1$r61;1"p':B==="r"?`P1$r${U.scrollTop+1};${U.scrollBottom+1}r`:B==="m"?"P1$r0m":B===" q"?`P1$r${{block:2,underline:4,bar:6}[K.cursorStyle]-(K.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(B,j){this._dirtyRowTracker.markRangeDirty(B,j)}}o.InputHandler=W;let $=class{constructor(Y){this._bufferService=Y,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(Y){Y<this.start?this.start=Y:Y>this.end&&(this.end=Y)}markRangeDirty(Y,B){Y>B&&(V=Y,Y=B,B=V),Y<this.start&&(this.start=Y),B>this.end&&(this.end=B)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function q(Y){return 0<=Y&&Y<256}$=u([f(0,w.IBufferService)],$)},844:(s,o)=>{function l(u){for(const f of u)f.dispose();u.length=0}Object.defineProperty(o,"__esModule",{value:!0}),o.getDisposeArrayDisposable=o.disposeArray=o.toDisposable=o.MutableDisposable=o.Disposable=void 0,o.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const u of this._disposables)u.dispose();this._disposables.length=0}register(u){return this._disposables.push(u),u}unregister(u){const f=this._disposables.indexOf(u);f!==-1&&this._disposables.splice(f,1)}},o.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(u){this._isDisposed||u===this._value||(this._value?.dispose(),this._value=u)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}},o.toDisposable=function(u){return{dispose:u}},o.disposeArray=l,o.getDisposeArrayDisposable=function(u){return{dispose:()=>l(u)}}},1505:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.FourKeyMap=o.TwoKeyMap=void 0;class l{constructor(){this._data={}}set(f,d,p){this._data[f]||(this._data[f]={}),this._data[f][d]=p}get(f,d){return this._data[f]?this._data[f][d]:void 0}clear(){this._data={}}}o.TwoKeyMap=l,o.FourKeyMap=class{constructor(){this._data=new l}set(u,f,d,p,m){this._data.get(u,f)||this._data.set(u,f,new l),this._data.get(u,f).set(d,p,m)}get(u,f,d,p){return this._data.get(u,f)?.get(d,p)}clear(){this._data.clear()}}},6114:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.isChromeOS=o.isLinux=o.isWindows=o.isIphone=o.isIpad=o.isMac=o.getSafariVersion=o.isSafari=o.isLegacyEdge=o.isFirefox=o.isNode=void 0,o.isNode=typeof process<"u"&&"title"in process;const l=o.isNode?"node":navigator.userAgent,u=o.isNode?"node":navigator.platform;o.isFirefox=l.includes("Firefox"),o.isLegacyEdge=l.includes("Edge"),o.isSafari=/^((?!chrome|android).)*safari/i.test(l),o.getSafariVersion=function(){if(!o.isSafari)return 0;const f=l.match(/Version\/(\d+)/);return f===null||f.length<2?0:parseInt(f[1])},o.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(u),o.isIpad=u==="iPad",o.isIphone=u==="iPhone",o.isWindows=["Windows","Win16","Win32","WinCE"].includes(u),o.isLinux=u.indexOf("Linux")>=0,o.isChromeOS=/\bCrOS\b/.test(l)},6106:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.SortedList=void 0;let l=0;o.SortedList=class{constructor(u){this._getKey=u,this._array=[]}clear(){this._array.length=0}insert(u){this._array.length!==0?(l=this._search(this._getKey(u)),this._array.splice(l,0,u)):this._array.push(u)}delete(u){if(this._array.length===0)return!1;const f=this._getKey(u);if(f===void 0||(l=this._search(f),l===-1)||this._getKey(this._array[l])!==f)return!1;do if(this._array[l]===u)return this._array.splice(l,1),!0;while(++l<this._array.length&&this._getKey(this._array[l])===f);return!1}*getKeyIterator(u){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do yield this._array[l];while(++l<this._array.length&&this._getKey(this._array[l])===u)}forEachByKey(u,f){if(this._array.length!==0&&(l=this._search(u),!(l<0||l>=this._array.length)&&this._getKey(this._array[l])===u))do f(this._array[l]);while(++l<this._array.length&&this._getKey(this._array[l])===u)}values(){return[...this._array].values()}_search(u){let f=0,d=this._array.length-1;for(;d>=f;){let p=f+d>>1;const m=this._getKey(this._array[p]);if(m>u)d=p-1;else{if(!(m<u)){for(;p>0&&this._getKey(this._array[p-1])===u;)p--;return p}f=p+1}}return f}}},7226:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DebouncedIdleTask=o.IdleTaskQueue=o.PriorityTaskQueue=void 0;const u=l(6114);class f{constructor(){this._tasks=[],this._i=0}enqueue(m){this._tasks.push(m),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(m){this._idleCallback=void 0;let y=0,S=0,g=m.timeRemaining(),_=0;for(;this._i<this._tasks.length;){if(y=Date.now(),this._tasks[this._i]()||this._i++,y=Math.max(1,Date.now()-y),S=Math.max(y,S),_=m.timeRemaining(),1.5*S>_)return g-y<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(g-y))}ms`),void this._start();g=_}this.clear()}}class d extends f{_requestCallback(m){return setTimeout((()=>m(this._createDeadline(16))))}_cancelCallback(m){clearTimeout(m)}_createDeadline(m){const y=Date.now()+m;return{timeRemaining:()=>Math.max(0,y-Date.now())}}}o.PriorityTaskQueue=d,o.IdleTaskQueue=!u.isNode&&"requestIdleCallback"in window?class extends f{_requestCallback(p){return requestIdleCallback(p)}_cancelCallback(p){cancelIdleCallback(p)}}:d,o.DebouncedIdleTask=class{constructor(){this._queue=new o.IdleTaskQueue}set(p){this._queue.clear(),this._queue.enqueue(p)}flush(){this._queue.flush()}}},9282:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.updateWindowsModeWrappedState=void 0;const u=l(643);o.updateWindowsModeWrappedState=function(f){const d=f.buffer.lines.get(f.buffer.ybase+f.buffer.y-1),p=d?.get(f.cols-1),m=f.buffer.lines.get(f.buffer.ybase+f.buffer.y);m&&p&&(m.isWrapped=p[u.CHAR_DATA_CODE_INDEX]!==u.NULL_CELL_CODE&&p[u.CHAR_DATA_CODE_INDEX]!==u.WHITESPACE_CELL_CODE)}},3734:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ExtendedAttrs=o.AttributeData=void 0;class l{constructor(){this.fg=0,this.bg=0,this.extended=new u}static toColorRGB(d){return[d>>>16&255,d>>>8&255,255&d]}static fromColorRGB(d){return(255&d[0])<<16|(255&d[1])<<8|255&d[2]}clone(){const d=new l;return d.fg=this.fg,d.bg=this.bg,d.extended=this.extended.clone(),d}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}o.AttributeData=l;class u{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(d){this._ext=d}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(d){this._ext&=-469762049,this._ext|=d<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(d){this._ext&=-67108864,this._ext|=67108863&d}get urlId(){return this._urlId}set urlId(d){this._urlId=d}get underlineVariantOffset(){const d=(3758096384&this._ext)>>29;return d<0?4294967288^d:d}set underlineVariantOffset(d){this._ext&=536870911,this._ext|=d<<29&3758096384}constructor(d=0,p=0){this._ext=0,this._urlId=0,this._ext=d,this._urlId=p}clone(){return new u(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}o.ExtendedAttrs=u},9092:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Buffer=o.MAX_BUFFER_SIZE=void 0;const u=l(6349),f=l(7226),d=l(3734),p=l(8437),m=l(4634),y=l(511),S=l(643),g=l(4863),_=l(7116);o.MAX_BUFFER_SIZE=4294967295,o.Buffer=class{constructor(v,x,T){this._hasScrollback=v,this._optionsService=x,this._bufferService=T,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=p.DEFAULT_ATTR_DATA.clone(),this.savedCharset=_.DEFAULT_CHARSET,this.markers=[],this._nullCell=y.CellData.fromCharData([0,S.NULL_CELL_CHAR,S.NULL_CELL_WIDTH,S.NULL_CELL_CODE]),this._whitespaceCell=y.CellData.fromCharData([0,S.WHITESPACE_CELL_CHAR,S.WHITESPACE_CELL_WIDTH,S.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new f.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(v){return v?(this._nullCell.fg=v.fg,this._nullCell.bg=v.bg,this._nullCell.extended=v.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new d.ExtendedAttrs),this._nullCell}getWhitespaceCell(v){return v?(this._whitespaceCell.fg=v.fg,this._whitespaceCell.bg=v.bg,this._whitespaceCell.extended=v.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new d.ExtendedAttrs),this._whitespaceCell}getBlankLine(v,x){return new p.BufferLine(this._bufferService.cols,this.getNullCell(v),x)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const v=this.ybase+this.y-this.ydisp;return v>=0&&v<this._rows}_getCorrectBufferLength(v){if(!this._hasScrollback)return v;const x=v+this._optionsService.rawOptions.scrollback;return x>o.MAX_BUFFER_SIZE?o.MAX_BUFFER_SIZE:x}fillViewportRows(v){if(this.lines.length===0){v===void 0&&(v=p.DEFAULT_ATTR_DATA);let x=this._rows;for(;x--;)this.lines.push(this.getBlankLine(v))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new u.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(v,x){const T=this.getNullCell(p.DEFAULT_ATTR_DATA);let w=0;const C=this._getCorrectBufferLength(x);if(C>this.lines.maxLength&&(this.lines.maxLength=C),this.lines.length>0){if(this._cols<v)for(let O=0;O<this.lines.length;O++)w+=+this.lines.get(O).resize(v,T);let R=0;if(this._rows<x)for(let O=this._rows;O<x;O++)this.lines.length<x+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new p.BufferLine(v,T)):this.ybase>0&&this.lines.length<=this.ybase+this.y+R+1?(this.ybase--,R++,this.ydisp>0&&this.ydisp--):this.lines.push(new p.BufferLine(v,T)));else for(let O=this._rows;O>x;O--)this.lines.length>x+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(C<this.lines.maxLength){const O=this.lines.length-C;O>0&&(this.lines.trimStart(O),this.ybase=Math.max(this.ybase-O,0),this.ydisp=Math.max(this.ydisp-O,0),this.savedY=Math.max(this.savedY-O,0)),this.lines.maxLength=C}this.x=Math.min(this.x,v-1),this.y=Math.min(this.y,x-1),R&&(this.y+=R),this.savedX=Math.min(this.savedX,v-1),this.scrollTop=0}if(this.scrollBottom=x-1,this._isReflowEnabled&&(this._reflow(v,x),this._cols>v))for(let R=0;R<this.lines.length;R++)w+=+this.lines.get(R).resize(v,T);this._cols=v,this._rows=x,this._memoryCleanupQueue.clear(),w>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let v=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,v=!1);let x=0;for(;this._memoryCleanupPosition<this.lines.length;)if(x+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),x>100)return!0;return v}get _isReflowEnabled(){const v=this._optionsService.rawOptions.windowsPty;return v&&v.buildNumber?this._hasScrollback&&v.backend==="conpty"&&v.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(v,x){this._cols!==v&&(v>this._cols?this._reflowLarger(v,x):this._reflowSmaller(v,x))}_reflowLarger(v,x){const T=(0,m.reflowLargerGetLinesToRemove)(this.lines,this._cols,v,this.ybase+this.y,this.getNullCell(p.DEFAULT_ATTR_DATA));if(T.length>0){const w=(0,m.reflowLargerCreateNewLayout)(this.lines,T);(0,m.reflowLargerApplyNewLayout)(this.lines,w.layout),this._reflowLargerAdjustViewport(v,x,w.countRemoved)}}_reflowLargerAdjustViewport(v,x,T){const w=this.getNullCell(p.DEFAULT_ATTR_DATA);let C=T;for(;C-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<x&&this.lines.push(new p.BufferLine(v,w))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-T,0)}_reflowSmaller(v,x){const T=this.getNullCell(p.DEFAULT_ATTR_DATA),w=[];let C=0;for(let R=this.lines.length-1;R>=0;R--){let O=this.lines.get(R);if(!O||!O.isWrapped&&O.getTrimmedLength()<=v)continue;const N=[O];for(;O.isWrapped&&R>0;)O=this.lines.get(--R),N.unshift(O);const L=this.ybase+this.y;if(L>=R&&L<R+N.length)continue;const D=N[N.length-1].getTrimmedLength(),z=(0,m.reflowSmallerGetNewLineLengths)(N,this._cols,v),M=z.length-N.length;let V;V=this.ybase===0&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+M):Math.max(0,this.lines.length-this.lines.maxLength+M);const W=[];for(let U=0;U<M;U++){const K=this.getBlankLine(p.DEFAULT_ATTR_DATA,!0);W.push(K)}W.length>0&&(w.push({start:R+N.length+C,newLines:W}),C+=W.length),N.push(...W);let $=z.length-1,q=z[$];q===0&&($--,q=z[$]);let Y=N.length-M-1,B=D;for(;Y>=0;){const U=Math.min(B,q);if(N[$]===void 0)break;if(N[$].copyCellsFrom(N[Y],B-U,q-U,U,!0),q-=U,q===0&&($--,q=z[$]),B-=U,B===0){Y--;const K=Math.max(Y,0);B=(0,m.getWrappedLineTrimmedLength)(N,K,this._cols)}}for(let U=0;U<N.length;U++)z[U]<v&&N[U].setCell(z[U],T);let j=M-V;for(;j-- >0;)this.ybase===0?this.y<x-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+C)-x&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+M,this.ybase+x-1)}if(w.length>0){const R=[],O=[];for(let $=0;$<this.lines.length;$++)O.push(this.lines.get($));const N=this.lines.length;let L=N-1,D=0,z=w[D];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+C);let M=0;for(let $=Math.min(this.lines.maxLength-1,N+C-1);$>=0;$--)if(z&&z.start>L+M){for(let q=z.newLines.length-1;q>=0;q--)this.lines.set($--,z.newLines[q]);$++,R.push({index:L+1,amount:z.newLines.length}),M+=z.newLines.length,z=w[++D]}else this.lines.set($,O[L--]);let V=0;for(let $=R.length-1;$>=0;$--)R[$].index+=V,this.lines.onInsertEmitter.fire(R[$]),V+=R[$].amount;const W=Math.max(0,N+C-this.lines.maxLength);W>0&&this.lines.onTrimEmitter.fire(W)}}translateBufferLineToString(v,x,T=0,w){const C=this.lines.get(v);return C?C.translateToString(x,T,w):""}getWrappedRangeForLine(v){let x=v,T=v;for(;x>0&&this.lines.get(x).isWrapped;)x--;for(;T+1<this.lines.length&&this.lines.get(T+1).isWrapped;)T++;return{first:x,last:T}}setupTabStops(v){for(v!=null?this.tabs[v]||(v=this.prevStop(v)):(this.tabs={},v=0);v<this._cols;v+=this._optionsService.rawOptions.tabStopWidth)this.tabs[v]=!0}prevStop(v){for(v==null&&(v=this.x);!this.tabs[--v]&&v>0;);return v>=this._cols?this._cols-1:v<0?0:v}nextStop(v){for(v==null&&(v=this.x);!this.tabs[++v]&&v<this._cols;);return v>=this._cols?this._cols-1:v<0?0:v}clearMarkers(v){this._isClearing=!0;for(let x=0;x<this.markers.length;x++)this.markers[x].line===v&&(this.markers[x].dispose(),this.markers.splice(x--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let v=0;v<this.markers.length;v++)this.markers[v].dispose(),this.markers.splice(v--,1);this._isClearing=!1}addMarker(v){const x=new g.Marker(v);return this.markers.push(x),x.register(this.lines.onTrim((T=>{x.line-=T,x.line<0&&x.dispose()}))),x.register(this.lines.onInsert((T=>{x.line>=T.index&&(x.line+=T.amount)}))),x.register(this.lines.onDelete((T=>{x.line>=T.index&&x.line<T.index+T.amount&&x.dispose(),x.line>T.index&&(x.line-=T.amount)}))),x.register(x.onDispose((()=>this._removeMarker(x)))),x}_removeMarker(v){this._isClearing||this.markers.splice(this.markers.indexOf(v),1)}}},8437:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLine=o.DEFAULT_ATTR_DATA=void 0;const u=l(3734),f=l(511),d=l(643),p=l(482);o.DEFAULT_ATTR_DATA=Object.freeze(new u.AttributeData);let m=0;class y{constructor(g,_,v=!1){this.isWrapped=v,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*g);const x=_||f.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let T=0;T<g;++T)this.setCell(T,x);this.length=g}get(g){const _=this._data[3*g+0],v=2097151&_;return[this._data[3*g+1],2097152&_?this._combined[g]:v?(0,p.stringFromCodePoint)(v):"",_>>22,2097152&_?this._combined[g].charCodeAt(this._combined[g].length-1):v]}set(g,_){this._data[3*g+1]=_[d.CHAR_DATA_ATTR_INDEX],_[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[g]=_[1],this._data[3*g+0]=2097152|g|_[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*g+0]=_[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(g){return this._data[3*g+0]>>22}hasWidth(g){return 12582912&this._data[3*g+0]}getFg(g){return this._data[3*g+1]}getBg(g){return this._data[3*g+2]}hasContent(g){return 4194303&this._data[3*g+0]}getCodePoint(g){const _=this._data[3*g+0];return 2097152&_?this._combined[g].charCodeAt(this._combined[g].length-1):2097151&_}isCombined(g){return 2097152&this._data[3*g+0]}getString(g){const _=this._data[3*g+0];return 2097152&_?this._combined[g]:2097151&_?(0,p.stringFromCodePoint)(2097151&_):""}isProtected(g){return 536870912&this._data[3*g+2]}loadCell(g,_){return m=3*g,_.content=this._data[m+0],_.fg=this._data[m+1],_.bg=this._data[m+2],2097152&_.content&&(_.combinedData=this._combined[g]),268435456&_.bg&&(_.extended=this._extendedAttrs[g]),_}setCell(g,_){2097152&_.content&&(this._combined[g]=_.combinedData),268435456&_.bg&&(this._extendedAttrs[g]=_.extended),this._data[3*g+0]=_.content,this._data[3*g+1]=_.fg,this._data[3*g+2]=_.bg}setCellFromCodepoint(g,_,v,x){268435456&x.bg&&(this._extendedAttrs[g]=x.extended),this._data[3*g+0]=_|v<<22,this._data[3*g+1]=x.fg,this._data[3*g+2]=x.bg}addCodepointToCell(g,_,v){let x=this._data[3*g+0];2097152&x?this._combined[g]+=(0,p.stringFromCodePoint)(_):2097151&x?(this._combined[g]=(0,p.stringFromCodePoint)(2097151&x)+(0,p.stringFromCodePoint)(_),x&=-2097152,x|=2097152):x=_|4194304,v&&(x&=-12582913,x|=v<<22),this._data[3*g+0]=x}insertCells(g,_,v){if((g%=this.length)&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,v),_<this.length-g){const x=new f.CellData;for(let T=this.length-g-_-1;T>=0;--T)this.setCell(g+_+T,this.loadCell(g+T,x));for(let T=0;T<_;++T)this.setCell(g+T,v)}else for(let x=g;x<this.length;++x)this.setCell(x,v);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,v)}deleteCells(g,_,v){if(g%=this.length,_<this.length-g){const x=new f.CellData;for(let T=0;T<this.length-g-_;++T)this.setCell(g+T,this.loadCell(g+_+T,x));for(let T=this.length-_;T<this.length;++T)this.setCell(T,v)}else for(let x=g;x<this.length;++x)this.setCell(x,v);g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,v),this.getWidth(g)!==0||this.hasContent(g)||this.setCellFromCodepoint(g,0,1,v)}replaceCells(g,_,v,x=!1){if(x)for(g&&this.getWidth(g-1)===2&&!this.isProtected(g-1)&&this.setCellFromCodepoint(g-1,0,1,v),_<this.length&&this.getWidth(_-1)===2&&!this.isProtected(_)&&this.setCellFromCodepoint(_,0,1,v);g<_&&g<this.length;)this.isProtected(g)||this.setCell(g,v),g++;else for(g&&this.getWidth(g-1)===2&&this.setCellFromCodepoint(g-1,0,1,v),_<this.length&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_,0,1,v);g<_&&g<this.length;)this.setCell(g++,v)}resize(g,_){if(g===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const v=3*g;if(g>this.length){if(this._data.buffer.byteLength>=4*v)this._data=new Uint32Array(this._data.buffer,0,v);else{const x=new Uint32Array(v);x.set(this._data),this._data=x}for(let x=this.length;x<g;++x)this.setCell(x,_)}else{this._data=this._data.subarray(0,v);const x=Object.keys(this._combined);for(let w=0;w<x.length;w++){const C=parseInt(x[w],10);C>=g&&delete this._combined[C]}const T=Object.keys(this._extendedAttrs);for(let w=0;w<T.length;w++){const C=parseInt(T[w],10);C>=g&&delete this._extendedAttrs[C]}}return this.length=g,4*v*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const g=new Uint32Array(this._data.length);return g.set(this._data),this._data=g,1}return 0}fill(g,_=!1){if(_)for(let v=0;v<this.length;++v)this.isProtected(v)||this.setCell(v,g);else{this._combined={},this._extendedAttrs={};for(let v=0;v<this.length;++v)this.setCell(v,g)}}copyFrom(g){this.length!==g.length?this._data=new Uint32Array(g._data):this._data.set(g._data),this.length=g.length,this._combined={};for(const _ in g._combined)this._combined[_]=g._combined[_];this._extendedAttrs={};for(const _ in g._extendedAttrs)this._extendedAttrs[_]=g._extendedAttrs[_];this.isWrapped=g.isWrapped}clone(){const g=new y(0);g._data=new Uint32Array(this._data),g.length=this.length;for(const _ in this._combined)g._combined[_]=this._combined[_];for(const _ in this._extendedAttrs)g._extendedAttrs[_]=this._extendedAttrs[_];return g.isWrapped=this.isWrapped,g}getTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0])return g+(this._data[3*g+0]>>22);return 0}getNoBgTrimmedLength(){for(let g=this.length-1;g>=0;--g)if(4194303&this._data[3*g+0]||50331648&this._data[3*g+2])return g+(this._data[3*g+0]>>22);return 0}copyCellsFrom(g,_,v,x,T){const w=g._data;if(T)for(let R=x-1;R>=0;R--){for(let O=0;O<3;O++)this._data[3*(v+R)+O]=w[3*(_+R)+O];268435456&w[3*(_+R)+2]&&(this._extendedAttrs[v+R]=g._extendedAttrs[_+R])}else for(let R=0;R<x;R++){for(let O=0;O<3;O++)this._data[3*(v+R)+O]=w[3*(_+R)+O];268435456&w[3*(_+R)+2]&&(this._extendedAttrs[v+R]=g._extendedAttrs[_+R])}const C=Object.keys(g._combined);for(let R=0;R<C.length;R++){const O=parseInt(C[R],10);O>=_&&(this._combined[O-_+v]=g._combined[O])}}translateToString(g,_,v,x){_=_??0,v=v??this.length,g&&(v=Math.min(v,this.getTrimmedLength())),x&&(x.length=0);let T="";for(;_<v;){const w=this._data[3*_+0],C=2097151&w,R=2097152&w?this._combined[_]:C?(0,p.stringFromCodePoint)(C):d.WHITESPACE_CELL_CHAR;if(T+=R,x)for(let O=0;O<R.length;++O)x.push(_);_+=w>>22||1}return x&&x.push(_),T}}o.BufferLine=y},4841:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.getRangeLength=void 0,o.getRangeLength=function(l,u){if(l.start.y>l.end.y)throw new Error(`Buffer range end (${l.end.x}, ${l.end.y}) cannot be before start (${l.start.x}, ${l.start.y})`);return u*(l.end.y-l.start.y)+(l.end.x-l.start.x+1)}},4634:(s,o)=>{function l(u,f,d){if(f===u.length-1)return u[f].getTrimmedLength();const p=!u[f].hasContent(d-1)&&u[f].getWidth(d-1)===1,m=u[f+1].getWidth(0)===2;return p&&m?d-1:d}Object.defineProperty(o,"__esModule",{value:!0}),o.getWrappedLineTrimmedLength=o.reflowSmallerGetNewLineLengths=o.reflowLargerApplyNewLayout=o.reflowLargerCreateNewLayout=o.reflowLargerGetLinesToRemove=void 0,o.reflowLargerGetLinesToRemove=function(u,f,d,p,m){const y=[];for(let S=0;S<u.length-1;S++){let g=S,_=u.get(++g);if(!_.isWrapped)continue;const v=[u.get(S)];for(;g<u.length&&_.isWrapped;)v.push(_),_=u.get(++g);if(p>=S&&p<g){S+=v.length-1;continue}let x=0,T=l(v,x,f),w=1,C=0;for(;w<v.length;){const O=l(v,w,f),N=O-C,L=d-T,D=Math.min(N,L);v[x].copyCellsFrom(v[w],C,T,D,!1),T+=D,T===d&&(x++,T=0),C+=D,C===O&&(w++,C=0),T===0&&x!==0&&v[x-1].getWidth(d-1)===2&&(v[x].copyCellsFrom(v[x-1],d-1,T++,1,!1),v[x-1].setCell(d-1,m))}v[x].replaceCells(T,d,m);let R=0;for(let O=v.length-1;O>0&&(O>x||v[O].getTrimmedLength()===0);O--)R++;R>0&&(y.push(S+v.length-R),y.push(R)),S+=v.length-1}return y},o.reflowLargerCreateNewLayout=function(u,f){const d=[];let p=0,m=f[p],y=0;for(let S=0;S<u.length;S++)if(m===S){const g=f[++p];u.onDeleteEmitter.fire({index:S-y,amount:g}),S+=g-1,y+=g,m=f[++p]}else d.push(S);return{layout:d,countRemoved:y}},o.reflowLargerApplyNewLayout=function(u,f){const d=[];for(let p=0;p<f.length;p++)d.push(u.get(f[p]));for(let p=0;p<d.length;p++)u.set(p,d[p]);u.length=f.length},o.reflowSmallerGetNewLineLengths=function(u,f,d){const p=[],m=u.map(((_,v)=>l(u,v,f))).reduce(((_,v)=>_+v));let y=0,S=0,g=0;for(;g<m;){if(m-g<d){p.push(m-g);break}y+=d;const _=l(u,S,f);y>_&&(y-=_,S++);const v=u[S].getWidth(y-1)===2;v&&y--;const x=v?d-1:d;p.push(x),g+=x}return p},o.getWrappedLineTrimmedLength=l},5295:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferSet=void 0;const u=l(8460),f=l(844),d=l(9092);class p extends f.Disposable{constructor(y,S){super(),this._optionsService=y,this._bufferService=S,this._onBufferActivate=this.register(new u.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new d.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new d.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(y){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(y),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(y,S){this._normal.resize(y,S),this._alt.resize(y,S),this.setupTabStops(y)}setupTabStops(y){this._normal.setupTabStops(y),this._alt.setupTabStops(y)}}o.BufferSet=p},511:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CellData=void 0;const u=l(482),f=l(643),d=l(3734);class p extends d.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new d.ExtendedAttrs,this.combinedData=""}static fromCharData(y){const S=new p;return S.setFromCharData(y),S}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,u.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(y){this.fg=y[f.CHAR_DATA_ATTR_INDEX],this.bg=0;let S=!1;if(y[f.CHAR_DATA_CHAR_INDEX].length>2)S=!0;else if(y[f.CHAR_DATA_CHAR_INDEX].length===2){const g=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=g&&g<=56319){const _=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=_&&_<=57343?this.content=1024*(g-55296)+_-56320+65536|y[f.CHAR_DATA_WIDTH_INDEX]<<22:S=!0}else S=!0}else this.content=y[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|y[f.CHAR_DATA_WIDTH_INDEX]<<22;S&&(this.combinedData=y[f.CHAR_DATA_CHAR_INDEX],this.content=2097152|y[f.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}o.CellData=p},643:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WHITESPACE_CELL_CODE=o.WHITESPACE_CELL_WIDTH=o.WHITESPACE_CELL_CHAR=o.NULL_CELL_CODE=o.NULL_CELL_WIDTH=o.NULL_CELL_CHAR=o.CHAR_DATA_CODE_INDEX=o.CHAR_DATA_WIDTH_INDEX=o.CHAR_DATA_CHAR_INDEX=o.CHAR_DATA_ATTR_INDEX=o.DEFAULT_EXT=o.DEFAULT_ATTR=o.DEFAULT_COLOR=void 0,o.DEFAULT_COLOR=0,o.DEFAULT_ATTR=256|o.DEFAULT_COLOR<<9,o.DEFAULT_EXT=0,o.CHAR_DATA_ATTR_INDEX=0,o.CHAR_DATA_CHAR_INDEX=1,o.CHAR_DATA_WIDTH_INDEX=2,o.CHAR_DATA_CODE_INDEX=3,o.NULL_CELL_CHAR="",o.NULL_CELL_WIDTH=1,o.NULL_CELL_CODE=0,o.WHITESPACE_CELL_CHAR=" ",o.WHITESPACE_CELL_WIDTH=1,o.WHITESPACE_CELL_CODE=32},4863:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Marker=void 0;const u=l(8460),f=l(844);class d{get id(){return this._id}constructor(m){this.line=m,this.isDisposed=!1,this._disposables=[],this._id=d._nextId++,this._onDispose=this.register(new u.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,f.disposeArray)(this._disposables),this._disposables.length=0)}register(m){return this._disposables.push(m),m}}o.Marker=d,d._nextId=1},7116:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DEFAULT_CHARSET=o.CHARSETS=void 0,o.CHARSETS={},o.DEFAULT_CHARSET=o.CHARSETS.B,o.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},o.CHARSETS.A={"#":"£"},o.CHARSETS.B=void 0,o.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},o.CHARSETS.C=o.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},o.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},o.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},o.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},o.CHARSETS.E=o.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},o.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},o.CHARSETS.H=o.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},o.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(s,o)=>{var l,u,f;Object.defineProperty(o,"__esModule",{value:!0}),o.C1_ESCAPED=o.C1=o.C0=void 0,(function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=`
38
38
  `,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL=""})(l||(o.C0=l={})),(function(d){d.PAD="€",d.HOP="",d.BPH="‚",d.NBH="ƒ",d.IND="„",d.NEL="…",d.SSA="†",d.ESA="‡",d.HTS="ˆ",d.HTJ="‰",d.VTS="Š",d.PLD="‹",d.PLU="Œ",d.RI="",d.SS2="Ž",d.SS3="",d.DCS="",d.PU1="‘",d.PU2="’",d.STS="“",d.CCH="”",d.MW="•",d.SPA="–",d.EPA="—",d.SOS="˜",d.SGCI="™",d.SCI="š",d.CSI="›",d.ST="œ",d.OSC="",d.PM="ž",d.APC="Ÿ"})(u||(o.C1=u={})),(function(d){d.ST=`${l.ESC}\\`})(f||(o.C1_ESCAPED=f={}))},7399:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.evaluateKeyboardEvent=void 0;const u=l(2584),f={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};o.evaluateKeyboardEvent=function(d,p,m,y){const S={type:0,cancel:!1,key:void 0},g=(d.shiftKey?1:0)|(d.altKey?2:0)|(d.ctrlKey?4:0)|(d.metaKey?8:0);switch(d.keyCode){case 0:d.key==="UIKeyInputUpArrow"?S.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A":d.key==="UIKeyInputLeftArrow"?S.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D":d.key==="UIKeyInputRightArrow"?S.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C":d.key==="UIKeyInputDownArrow"&&(S.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B");break;case 8:S.key=d.ctrlKey?"\b":u.C0.DEL,d.altKey&&(S.key=u.C0.ESC+S.key);break;case 9:if(d.shiftKey){S.key=u.C0.ESC+"[Z";break}S.key=u.C0.HT,S.cancel=!0;break;case 13:S.key=d.altKey?u.C0.ESC+u.C0.CR:u.C0.CR,S.cancel=!0;break;case 27:S.key=u.C0.ESC,d.altKey&&(S.key=u.C0.ESC+u.C0.ESC),S.cancel=!0;break;case 37:if(d.metaKey)break;g?(S.key=u.C0.ESC+"[1;"+(g+1)+"D",S.key===u.C0.ESC+"[1;3D"&&(S.key=u.C0.ESC+(m?"b":"[1;5D"))):S.key=p?u.C0.ESC+"OD":u.C0.ESC+"[D";break;case 39:if(d.metaKey)break;g?(S.key=u.C0.ESC+"[1;"+(g+1)+"C",S.key===u.C0.ESC+"[1;3C"&&(S.key=u.C0.ESC+(m?"f":"[1;5C"))):S.key=p?u.C0.ESC+"OC":u.C0.ESC+"[C";break;case 38:if(d.metaKey)break;g?(S.key=u.C0.ESC+"[1;"+(g+1)+"A",m||S.key!==u.C0.ESC+"[1;3A"||(S.key=u.C0.ESC+"[1;5A")):S.key=p?u.C0.ESC+"OA":u.C0.ESC+"[A";break;case 40:if(d.metaKey)break;g?(S.key=u.C0.ESC+"[1;"+(g+1)+"B",m||S.key!==u.C0.ESC+"[1;3B"||(S.key=u.C0.ESC+"[1;5B")):S.key=p?u.C0.ESC+"OB":u.C0.ESC+"[B";break;case 45:d.shiftKey||d.ctrlKey||(S.key=u.C0.ESC+"[2~");break;case 46:S.key=g?u.C0.ESC+"[3;"+(g+1)+"~":u.C0.ESC+"[3~";break;case 36:S.key=g?u.C0.ESC+"[1;"+(g+1)+"H":p?u.C0.ESC+"OH":u.C0.ESC+"[H";break;case 35:S.key=g?u.C0.ESC+"[1;"+(g+1)+"F":p?u.C0.ESC+"OF":u.C0.ESC+"[F";break;case 33:d.shiftKey?S.type=2:d.ctrlKey?S.key=u.C0.ESC+"[5;"+(g+1)+"~":S.key=u.C0.ESC+"[5~";break;case 34:d.shiftKey?S.type=3:d.ctrlKey?S.key=u.C0.ESC+"[6;"+(g+1)+"~":S.key=u.C0.ESC+"[6~";break;case 112:S.key=g?u.C0.ESC+"[1;"+(g+1)+"P":u.C0.ESC+"OP";break;case 113:S.key=g?u.C0.ESC+"[1;"+(g+1)+"Q":u.C0.ESC+"OQ";break;case 114:S.key=g?u.C0.ESC+"[1;"+(g+1)+"R":u.C0.ESC+"OR";break;case 115:S.key=g?u.C0.ESC+"[1;"+(g+1)+"S":u.C0.ESC+"OS";break;case 116:S.key=g?u.C0.ESC+"[15;"+(g+1)+"~":u.C0.ESC+"[15~";break;case 117:S.key=g?u.C0.ESC+"[17;"+(g+1)+"~":u.C0.ESC+"[17~";break;case 118:S.key=g?u.C0.ESC+"[18;"+(g+1)+"~":u.C0.ESC+"[18~";break;case 119:S.key=g?u.C0.ESC+"[19;"+(g+1)+"~":u.C0.ESC+"[19~";break;case 120:S.key=g?u.C0.ESC+"[20;"+(g+1)+"~":u.C0.ESC+"[20~";break;case 121:S.key=g?u.C0.ESC+"[21;"+(g+1)+"~":u.C0.ESC+"[21~";break;case 122:S.key=g?u.C0.ESC+"[23;"+(g+1)+"~":u.C0.ESC+"[23~";break;case 123:S.key=g?u.C0.ESC+"[24;"+(g+1)+"~":u.C0.ESC+"[24~";break;default:if(!d.ctrlKey||d.shiftKey||d.altKey||d.metaKey)if(m&&!y||!d.altKey||d.metaKey)!m||d.altKey||d.ctrlKey||d.shiftKey||!d.metaKey?d.key&&!d.ctrlKey&&!d.altKey&&!d.metaKey&&d.keyCode>=48&&d.key.length===1?S.key=d.key:d.key&&d.ctrlKey&&(d.key==="_"&&(S.key=u.C0.US),d.key==="@"&&(S.key=u.C0.NUL)):d.keyCode===65&&(S.type=1);else{const _=f[d.keyCode],v=_?.[d.shiftKey?1:0];if(v)S.key=u.C0.ESC+v;else if(d.keyCode>=65&&d.keyCode<=90){const x=d.ctrlKey?d.keyCode-64:d.keyCode+32;let T=String.fromCharCode(x);d.shiftKey&&(T=T.toUpperCase()),S.key=u.C0.ESC+T}else if(d.keyCode===32)S.key=u.C0.ESC+(d.ctrlKey?u.C0.NUL:" ");else if(d.key==="Dead"&&d.code.startsWith("Key")){let x=d.code.slice(3,4);d.shiftKey||(x=x.toLowerCase()),S.key=u.C0.ESC+x,S.cancel=!0}}else d.keyCode>=65&&d.keyCode<=90?S.key=String.fromCharCode(d.keyCode-64):d.keyCode===32?S.key=u.C0.NUL:d.keyCode>=51&&d.keyCode<=55?S.key=String.fromCharCode(d.keyCode-51+27):d.keyCode===56?S.key=u.C0.DEL:d.keyCode===219?S.key=u.C0.ESC:d.keyCode===220?S.key=u.C0.FS:d.keyCode===221&&(S.key=u.C0.GS)}return S}},482:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Utf8ToUtf32=o.StringToUtf32=o.utf32ToString=o.stringFromCodePoint=void 0,o.stringFromCodePoint=function(l){return l>65535?(l-=65536,String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):String.fromCharCode(l)},o.utf32ToString=function(l,u=0,f=l.length){let d="";for(let p=u;p<f;++p){let m=l[p];m>65535?(m-=65536,d+=String.fromCharCode(55296+(m>>10))+String.fromCharCode(m%1024+56320)):d+=String.fromCharCode(m)}return d},o.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(l,u){const f=l.length;if(!f)return 0;let d=0,p=0;if(this._interim){const m=l.charCodeAt(p++);56320<=m&&m<=57343?u[d++]=1024*(this._interim-55296)+m-56320+65536:(u[d++]=this._interim,u[d++]=m),this._interim=0}for(let m=p;m<f;++m){const y=l.charCodeAt(m);if(55296<=y&&y<=56319){if(++m>=f)return this._interim=y,d;const S=l.charCodeAt(m);56320<=S&&S<=57343?u[d++]=1024*(y-55296)+S-56320+65536:(u[d++]=y,u[d++]=S)}else y!==65279&&(u[d++]=y)}return d}},o.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(l,u){const f=l.length;if(!f)return 0;let d,p,m,y,S=0,g=0,_=0;if(this.interim[0]){let T=!1,w=this.interim[0];w&=(224&w)==192?31:(240&w)==224?15:7;let C,R=0;for(;(C=63&this.interim[++R])&&R<4;)w<<=6,w|=C;const O=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,N=O-R;for(;_<N;){if(_>=f)return 0;if(C=l[_++],(192&C)!=128){_--,T=!0;break}this.interim[R++]=C,w<<=6,w|=63&C}T||(O===2?w<128?_--:u[S++]=w:O===3?w<2048||w>=55296&&w<=57343||w===65279||(u[S++]=w):w<65536||w>1114111||(u[S++]=w)),this.interim.fill(0)}const v=f-4;let x=_;for(;x<f;){for(;!(!(x<v)||128&(d=l[x])||128&(p=l[x+1])||128&(m=l[x+2])||128&(y=l[x+3]));)u[S++]=d,u[S++]=p,u[S++]=m,u[S++]=y,x+=4;if(d=l[x++],d<128)u[S++]=d;else if((224&d)==192){if(x>=f)return this.interim[0]=d,S;if(p=l[x++],(192&p)!=128){x--;continue}if(g=(31&d)<<6|63&p,g<128){x--;continue}u[S++]=g}else if((240&d)==224){if(x>=f)return this.interim[0]=d,S;if(p=l[x++],(192&p)!=128){x--;continue}if(x>=f)return this.interim[0]=d,this.interim[1]=p,S;if(m=l[x++],(192&m)!=128){x--;continue}if(g=(15&d)<<12|(63&p)<<6|63&m,g<2048||g>=55296&&g<=57343||g===65279)continue;u[S++]=g}else if((248&d)==240){if(x>=f)return this.interim[0]=d,S;if(p=l[x++],(192&p)!=128){x--;continue}if(x>=f)return this.interim[0]=d,this.interim[1]=p,S;if(m=l[x++],(192&m)!=128){x--;continue}if(x>=f)return this.interim[0]=d,this.interim[1]=p,this.interim[2]=m,S;if(y=l[x++],(192&y)!=128){x--;continue}if(g=(7&d)<<18|(63&p)<<12|(63&m)<<6|63&y,g<65536||g>1114111)continue;u[S++]=g}}return S}}},225:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeV6=void 0;const u=l(1480),f=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],d=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let p;o.UnicodeV6=class{constructor(){if(this.version="6",!p){p=new Uint8Array(65536),p.fill(1),p[0]=0,p.fill(0,1,32),p.fill(0,127,160),p.fill(2,4352,4448),p[9001]=2,p[9002]=2,p.fill(2,11904,42192),p[12351]=1,p.fill(2,44032,55204),p.fill(2,63744,64256),p.fill(2,65040,65050),p.fill(2,65072,65136),p.fill(2,65280,65377),p.fill(2,65504,65511);for(let m=0;m<f.length;++m)p.fill(0,f[m][0],f[m][1]+1)}}wcwidth(m){return m<32?0:m<127?1:m<65536?p[m]:(function(y,S){let g,_=0,v=S.length-1;if(y<S[0][0]||y>S[v][1])return!1;for(;v>=_;)if(g=_+v>>1,y>S[g][1])_=g+1;else{if(!(y<S[g][0]))return!0;v=g-1}return!1})(m,d)?0:m>=131072&&m<=196605||m>=196608&&m<=262141?2:1}charProperties(m,y){let S=this.wcwidth(m),g=S===0&&y!==0;if(g){const _=u.UnicodeService.extractWidth(y);_===0?g=!1:_>S&&(S=_)}return u.UnicodeService.createPropertyValue(0,S,g)}}},5981:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.WriteBuffer=void 0;const u=l(8460),f=l(844);class d extends f.Disposable{constructor(m){super(),this._action=m,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(m,y){if(y!==void 0&&this._syncCalls>y)return void(this._syncCalls=0);if(this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let S;for(this._isSyncWriting=!0;S=this._writeBuffer.shift();){this._action(S);const g=this._callbacks.shift();g&&g()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(m,y){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(y),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=m.length,this._writeBuffer.push(m),this._callbacks.push(y)}_innerWrite(m=0,y=!0){const S=m||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const g=this._writeBuffer[this._bufferOffset],_=this._action(g,y);if(_){const x=T=>Date.now()-S>=12?setTimeout((()=>this._innerWrite(0,T))):this._innerWrite(S,T);return void _.catch((T=>(queueMicrotask((()=>{throw T})),Promise.resolve(!1)))).then(x)}const v=this._callbacks[this._bufferOffset];if(v&&v(),this._bufferOffset++,this._pendingData-=g.length,Date.now()-S>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}o.WriteBuffer=d},5941:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.toRgbString=o.parseColor=void 0;const l=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,u=/^[\da-f]+$/;function f(d,p){const m=d.toString(16),y=m.length<2?"0"+m:m;switch(p){case 4:return m[0];case 8:return y;case 12:return(y+y).slice(0,3);default:return y+y}}o.parseColor=function(d){if(!d)return;let p=d.toLowerCase();if(p.indexOf("rgb:")===0){p=p.slice(4);const m=l.exec(p);if(m){const y=m[1]?15:m[4]?255:m[7]?4095:65535;return[Math.round(parseInt(m[1]||m[4]||m[7]||m[10],16)/y*255),Math.round(parseInt(m[2]||m[5]||m[8]||m[11],16)/y*255),Math.round(parseInt(m[3]||m[6]||m[9]||m[12],16)/y*255)]}}else if(p.indexOf("#")===0&&(p=p.slice(1),u.exec(p)&&[3,6,9,12].includes(p.length))){const m=p.length/3,y=[0,0,0];for(let S=0;S<3;++S){const g=parseInt(p.slice(m*S,m*S+m),16);y[S]=m===1?g<<4:m===2?g:m===3?g>>4:g>>8}return y}},o.toRgbString=function(d,p=16){const[m,y,S]=d;return`rgb:${f(m,p)}/${f(y,p)}/${f(S,p)}`}},5770:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.PAYLOAD_LIMIT=void 0,o.PAYLOAD_LIMIT=1e7},6351:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DcsHandler=o.DcsParser=void 0;const u=l(482),f=l(8742),d=l(5770),p=[];o.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=p,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=p}registerHandler(y,S){this._handlers[y]===void 0&&(this._handlers[y]=[]);const g=this._handlers[y];return g.push(S),{dispose:()=>{const _=g.indexOf(S);_!==-1&&g.splice(_,1)}}}clearHandler(y){this._handlers[y]&&delete this._handlers[y]}setHandlerFallback(y){this._handlerFb=y}reset(){if(this._active.length)for(let y=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;y>=0;--y)this._active[y].unhook(!1);this._stack.paused=!1,this._active=p,this._ident=0}hook(y,S){if(this.reset(),this._ident=y,this._active=this._handlers[y]||p,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].hook(S);else this._handlerFb(this._ident,"HOOK",S)}put(y,S,g){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(y,S,g);else this._handlerFb(this._ident,"PUT",(0,u.utf32ToString)(y,S,g))}unhook(y,S=!0){if(this._active.length){let g=!1,_=this._active.length-1,v=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,g=S,v=this._stack.fallThrough,this._stack.paused=!1),!v&&g===!1){for(;_>=0&&(g=this._active[_].unhook(y),g!==!0);_--)if(g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,g;_--}for(;_>=0;_--)if(g=this._active[_].unhook(!1),g instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,g}else this._handlerFb(this._ident,"UNHOOK",y);this._active=p,this._ident=0}};const m=new f.Params;m.addParam(0),o.DcsHandler=class{constructor(y){this._handler=y,this._data="",this._params=m,this._hitLimit=!1}hook(y){this._params=y.length>1||y.params[0]?y.clone():m,this._data="",this._hitLimit=!1}put(y,S,g){this._hitLimit||(this._data+=(0,u.utf32ToString)(y,S,g),this._data.length>d.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(y){let S=!1;if(this._hitLimit)S=!1;else if(y&&(S=this._handler(this._data,this._params),S instanceof Promise))return S.then((g=>(this._params=m,this._data="",this._hitLimit=!1,g)));return this._params=m,this._data="",this._hitLimit=!1,S}}},2015:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.EscapeSequenceParser=o.VT500_TRANSITION_TABLE=o.TransitionTable=void 0;const u=l(844),f=l(8742),d=l(6242),p=l(6351);class m{constructor(_){this.table=new Uint8Array(_)}setDefault(_,v){this.table.fill(_<<4|v)}add(_,v,x,T){this.table[v<<8|_]=x<<4|T}addMany(_,v,x,T){for(let w=0;w<_.length;w++)this.table[v<<8|_[w]]=x<<4|T}}o.TransitionTable=m;const y=160;o.VT500_TRANSITION_TABLE=(function(){const g=new m(4095),_=Array.apply(null,Array(256)).map(((R,O)=>O)),v=(R,O)=>_.slice(R,O),x=v(32,127),T=v(0,24);T.push(25),T.push.apply(T,v(28,32));const w=v(0,14);let C;for(C in g.setDefault(1,0),g.addMany(x,0,2,0),w)g.addMany([24,26,153,154],C,3,0),g.addMany(v(128,144),C,3,0),g.addMany(v(144,152),C,3,0),g.add(156,C,0,0),g.add(27,C,11,1),g.add(157,C,4,8),g.addMany([152,158,159],C,0,7),g.add(155,C,11,3),g.add(144,C,11,9);return g.addMany(T,0,3,0),g.addMany(T,1,3,1),g.add(127,1,0,1),g.addMany(T,8,0,8),g.addMany(T,3,3,3),g.add(127,3,0,3),g.addMany(T,4,3,4),g.add(127,4,0,4),g.addMany(T,6,3,6),g.addMany(T,5,3,5),g.add(127,5,0,5),g.addMany(T,2,3,2),g.add(127,2,0,2),g.add(93,1,4,8),g.addMany(x,8,5,8),g.add(127,8,5,8),g.addMany([156,27,24,26,7],8,6,0),g.addMany(v(28,32),8,0,8),g.addMany([88,94,95],1,0,7),g.addMany(x,7,0,7),g.addMany(T,7,0,7),g.add(156,7,0,0),g.add(127,7,0,7),g.add(91,1,11,3),g.addMany(v(64,127),3,7,0),g.addMany(v(48,60),3,8,4),g.addMany([60,61,62,63],3,9,4),g.addMany(v(48,60),4,8,4),g.addMany(v(64,127),4,7,0),g.addMany([60,61,62,63],4,0,6),g.addMany(v(32,64),6,0,6),g.add(127,6,0,6),g.addMany(v(64,127),6,0,0),g.addMany(v(32,48),3,9,5),g.addMany(v(32,48),5,9,5),g.addMany(v(48,64),5,0,6),g.addMany(v(64,127),5,7,0),g.addMany(v(32,48),4,9,5),g.addMany(v(32,48),1,9,2),g.addMany(v(32,48),2,9,2),g.addMany(v(48,127),2,10,0),g.addMany(v(48,80),1,10,0),g.addMany(v(81,88),1,10,0),g.addMany([89,90,92],1,10,0),g.addMany(v(96,127),1,10,0),g.add(80,1,11,9),g.addMany(T,9,0,9),g.add(127,9,0,9),g.addMany(v(28,32),9,0,9),g.addMany(v(32,48),9,9,12),g.addMany(v(48,60),9,8,10),g.addMany([60,61,62,63],9,9,10),g.addMany(T,11,0,11),g.addMany(v(32,128),11,0,11),g.addMany(v(28,32),11,0,11),g.addMany(T,10,0,10),g.add(127,10,0,10),g.addMany(v(28,32),10,0,10),g.addMany(v(48,60),10,8,10),g.addMany([60,61,62,63],10,0,11),g.addMany(v(32,48),10,9,12),g.addMany(T,12,0,12),g.add(127,12,0,12),g.addMany(v(28,32),12,0,12),g.addMany(v(32,48),12,9,12),g.addMany(v(48,64),12,0,11),g.addMany(v(64,127),12,12,13),g.addMany(v(64,127),10,12,13),g.addMany(v(64,127),9,12,13),g.addMany(T,13,13,13),g.addMany(x,13,13,13),g.add(127,13,0,13),g.addMany([27,156,24,26],13,14,0),g.add(y,0,2,0),g.add(y,8,5,8),g.add(y,6,0,6),g.add(y,11,0,11),g.add(y,13,13,13),g})();class S extends u.Disposable{constructor(_=o.VT500_TRANSITION_TABLE){super(),this._transitions=_,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new f.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(v,x,T)=>{},this._executeHandlerFb=v=>{},this._csiHandlerFb=(v,x)=>{},this._escHandlerFb=v=>{},this._errorHandlerFb=v=>v,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,u.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new d.OscParser),this._dcsParser=this.register(new p.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(_,v=[64,126]){let x=0;if(_.prefix){if(_.prefix.length>1)throw new Error("only one byte as prefix supported");if(x=_.prefix.charCodeAt(0),x&&60>x||x>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(_.intermediates){if(_.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let w=0;w<_.intermediates.length;++w){const C=_.intermediates.charCodeAt(w);if(32>C||C>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");x<<=8,x|=C}}if(_.final.length!==1)throw new Error("final must be a single byte");const T=_.final.charCodeAt(0);if(v[0]>T||T>v[1])throw new Error(`final must be in range ${v[0]} .. ${v[1]}`);return x<<=8,x|=T,x}identToString(_){const v=[];for(;_;)v.push(String.fromCharCode(255&_)),_>>=8;return v.reverse().join("")}setPrintHandler(_){this._printHandler=_}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(_,v){const x=this._identifier(_,[48,126]);this._escHandlers[x]===void 0&&(this._escHandlers[x]=[]);const T=this._escHandlers[x];return T.push(v),{dispose:()=>{const w=T.indexOf(v);w!==-1&&T.splice(w,1)}}}clearEscHandler(_){this._escHandlers[this._identifier(_,[48,126])]&&delete this._escHandlers[this._identifier(_,[48,126])]}setEscHandlerFallback(_){this._escHandlerFb=_}setExecuteHandler(_,v){this._executeHandlers[_.charCodeAt(0)]=v}clearExecuteHandler(_){this._executeHandlers[_.charCodeAt(0)]&&delete this._executeHandlers[_.charCodeAt(0)]}setExecuteHandlerFallback(_){this._executeHandlerFb=_}registerCsiHandler(_,v){const x=this._identifier(_);this._csiHandlers[x]===void 0&&(this._csiHandlers[x]=[]);const T=this._csiHandlers[x];return T.push(v),{dispose:()=>{const w=T.indexOf(v);w!==-1&&T.splice(w,1)}}}clearCsiHandler(_){this._csiHandlers[this._identifier(_)]&&delete this._csiHandlers[this._identifier(_)]}setCsiHandlerFallback(_){this._csiHandlerFb=_}registerDcsHandler(_,v){return this._dcsParser.registerHandler(this._identifier(_),v)}clearDcsHandler(_){this._dcsParser.clearHandler(this._identifier(_))}setDcsHandlerFallback(_){this._dcsParser.setHandlerFallback(_)}registerOscHandler(_,v){return this._oscParser.registerHandler(_,v)}clearOscHandler(_){this._oscParser.clearHandler(_)}setOscHandlerFallback(_){this._oscParser.setHandlerFallback(_)}setErrorHandler(_){this._errorHandler=_}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(_,v,x,T,w){this._parseStack.state=_,this._parseStack.handlers=v,this._parseStack.handlerPos=x,this._parseStack.transition=T,this._parseStack.chunkPos=w}parse(_,v,x){let T,w=0,C=0,R=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,R=this._parseStack.chunkPos+1;else{if(x===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const O=this._parseStack.handlers;let N=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(x===!1&&N>-1){for(;N>=0&&(T=O[N](this._params),T!==!0);N--)if(T instanceof Promise)return this._parseStack.handlerPos=N,T}this._parseStack.handlers=[];break;case 4:if(x===!1&&N>-1){for(;N>=0&&(T=O[N](),T!==!0);N--)if(T instanceof Promise)return this._parseStack.handlerPos=N,T}this._parseStack.handlers=[];break;case 6:if(w=_[this._parseStack.chunkPos],T=this._dcsParser.unhook(w!==24&&w!==26,x),T)return T;w===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(w=_[this._parseStack.chunkPos],T=this._oscParser.end(w!==24&&w!==26,x),T)return T;w===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,R=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let O=R;O<v;++O){switch(w=_[O],C=this._transitions.table[this.currentState<<8|(w<160?w:y)],C>>4){case 2:for(let M=O+1;;++M){if(M>=v||(w=_[M])<32||w>126&&w<y){this._printHandler(_,O,M),O=M-1;break}if(++M>=v||(w=_[M])<32||w>126&&w<y){this._printHandler(_,O,M),O=M-1;break}if(++M>=v||(w=_[M])<32||w>126&&w<y){this._printHandler(_,O,M),O=M-1;break}if(++M>=v||(w=_[M])<32||w>126&&w<y){this._printHandler(_,O,M),O=M-1;break}}break;case 3:this._executeHandlers[w]?this._executeHandlers[w]():this._executeHandlerFb(w),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:O,code:w,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const N=this._csiHandlers[this._collect<<8|w];let L=N?N.length-1:-1;for(;L>=0&&(T=N[L](this._params),T!==!0);L--)if(T instanceof Promise)return this._preserveStack(3,N,L,C,O),T;L<0&&this._csiHandlerFb(this._collect<<8|w,this._params),this.precedingJoinState=0;break;case 8:do switch(w){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(w-48)}while(++O<v&&(w=_[O])>47&&w<60);O--;break;case 9:this._collect<<=8,this._collect|=w;break;case 10:const D=this._escHandlers[this._collect<<8|w];let z=D?D.length-1:-1;for(;z>=0&&(T=D[z](),T!==!0);z--)if(T instanceof Promise)return this._preserveStack(4,D,z,C,O),T;z<0&&this._escHandlerFb(this._collect<<8|w),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|w,this._params);break;case 13:for(let M=O+1;;++M)if(M>=v||(w=_[M])===24||w===26||w===27||w>127&&w<y){this._dcsParser.put(_,O,M),O=M-1;break}break;case 14:if(T=this._dcsParser.unhook(w!==24&&w!==26),T)return this._preserveStack(6,[],0,C,O),T;w===27&&(C|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let M=O+1;;M++)if(M>=v||(w=_[M])<32||w>127&&w<y){this._oscParser.put(_,O,M),O=M-1;break}break;case 6:if(T=this._oscParser.end(w!==24&&w!==26),T)return this._preserveStack(5,[],0,C,O),T;w===27&&(C|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0}this.currentState=15&C}}}o.EscapeSequenceParser=S},6242:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OscHandler=o.OscParser=void 0;const u=l(5770),f=l(482),d=[];o.OscParser=class{constructor(){this._state=0,this._active=d,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(p,m){this._handlers[p]===void 0&&(this._handlers[p]=[]);const y=this._handlers[p];return y.push(m),{dispose:()=>{const S=y.indexOf(m);S!==-1&&y.splice(S,1)}}}clearHandler(p){this._handlers[p]&&delete this._handlers[p]}setHandlerFallback(p){this._handlerFb=p}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=d}reset(){if(this._state===2)for(let p=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;p>=0;--p)this._active[p].end(!1);this._stack.paused=!1,this._active=d,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||d,this._active.length)for(let p=this._active.length-1;p>=0;p--)this._active[p].start();else this._handlerFb(this._id,"START")}_put(p,m,y){if(this._active.length)for(let S=this._active.length-1;S>=0;S--)this._active[S].put(p,m,y);else this._handlerFb(this._id,"PUT",(0,f.utf32ToString)(p,m,y))}start(){this.reset(),this._state=1}put(p,m,y){if(this._state!==3){if(this._state===1)for(;m<y;){const S=p[m++];if(S===59){this._state=2,this._start();break}if(S<48||57<S)return void(this._state=3);this._id===-1&&(this._id=0),this._id=10*this._id+S-48}this._state===2&&y-m>0&&this._put(p,m,y)}}end(p,m=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let y=!1,S=this._active.length-1,g=!1;if(this._stack.paused&&(S=this._stack.loopPosition-1,y=m,g=this._stack.fallThrough,this._stack.paused=!1),!g&&y===!1){for(;S>=0&&(y=this._active[S].end(p),y!==!0);S--)if(y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!1,y;S--}for(;S>=0;S--)if(y=this._active[S].end(!1),y instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=S,this._stack.fallThrough=!0,y}else this._handlerFb(this._id,"END",p);this._active=d,this._id=-1,this._state=0}}},o.OscHandler=class{constructor(p){this._handler=p,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(p,m,y){this._hitLimit||(this._data+=(0,f.utf32ToString)(p,m,y),this._data.length>u.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(p){let m=!1;if(this._hitLimit)m=!1;else if(p&&(m=this._handler(this._data),m instanceof Promise))return m.then((y=>(this._data="",this._hitLimit=!1,y)));return this._data="",this._hitLimit=!1,m}}},8742:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.Params=void 0;const l=2147483647;class u{static fromArray(d){const p=new u;if(!d.length)return p;for(let m=Array.isArray(d[0])?1:0;m<d.length;++m){const y=d[m];if(Array.isArray(y))for(let S=0;S<y.length;++S)p.addSubParam(y[S]);else p.addParam(y)}return p}constructor(d=32,p=32){if(this.maxLength=d,this.maxSubParamsLength=p,p>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(d),this.length=0,this._subParams=new Int32Array(p),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(d),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const d=new u(this.maxLength,this.maxSubParamsLength);return d.params.set(this.params),d.length=this.length,d._subParams.set(this._subParams),d._subParamsLength=this._subParamsLength,d._subParamsIdx.set(this._subParamsIdx),d._rejectDigits=this._rejectDigits,d._rejectSubDigits=this._rejectSubDigits,d._digitIsSub=this._digitIsSub,d}toArray(){const d=[];for(let p=0;p<this.length;++p){d.push(this.params[p]);const m=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-m>0&&d.push(Array.prototype.slice.call(this._subParams,m,y))}return d}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(d){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=d>l?l:d}}addSubParam(d){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(d<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=d>l?l:d,this._subParamsIdx[this.length-1]++}}hasSubParams(d){return(255&this._subParamsIdx[d])-(this._subParamsIdx[d]>>8)>0}getSubParams(d){const p=this._subParamsIdx[d]>>8,m=255&this._subParamsIdx[d];return m-p>0?this._subParams.subarray(p,m):null}getSubParamsAll(){const d={};for(let p=0;p<this.length;++p){const m=this._subParamsIdx[p]>>8,y=255&this._subParamsIdx[p];y-m>0&&(d[p]=this._subParams.slice(m,y))}return d}addDigit(d){let p;if(this._rejectDigits||!(p=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const m=this._digitIsSub?this._subParams:this.params,y=m[p-1];m[p-1]=~y?Math.min(10*y+d,l):d}}o.Params=u},5741:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.AddonManager=void 0,o.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let l=this._addons.length-1;l>=0;l--)this._addons[l].instance.dispose()}loadAddon(l,u){const f={instance:u,dispose:u.dispose,isDisposed:!1};this._addons.push(f),u.dispose=()=>this._wrappedAddonDispose(f),u.activate(l)}_wrappedAddonDispose(l){if(l.isDisposed)return;let u=-1;for(let f=0;f<this._addons.length;f++)if(this._addons[f]===l){u=f;break}if(u===-1)throw new Error("Could not dispose an addon that has not been loaded");l.isDisposed=!0,l.dispose.apply(l.instance),this._addons.splice(u,1)}}},8771:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferApiView=void 0;const u=l(3785),f=l(511);o.BufferApiView=class{constructor(d,p){this._buffer=d,this.type=p}init(d){return this._buffer=d,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(d){const p=this._buffer.lines.get(d);if(p)return new u.BufferLineApiView(p)}getNullCell(){return new f.CellData}}},3785:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferLineApiView=void 0;const u=l(511);o.BufferLineApiView=class{constructor(f){this._line=f}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(f,d){if(!(f<0||f>=this._line.length))return d?(this._line.loadCell(f,d),d):this._line.loadCell(f,new u.CellData)}translateToString(f,d,p){return this._line.translateToString(f,d,p)}}},8285:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.BufferNamespaceApi=void 0;const u=l(8771),f=l(8460),d=l(844);class p extends d.Disposable{constructor(y){super(),this._core=y,this._onBufferChange=this.register(new f.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new u.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new u.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}o.BufferNamespaceApi=p},7975:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.ParserApi=void 0,o.ParserApi=class{constructor(l){this._core=l}registerCsiHandler(l,u){return this._core.registerCsiHandler(l,(f=>u(f.toArray())))}addCsiHandler(l,u){return this.registerCsiHandler(l,u)}registerDcsHandler(l,u){return this._core.registerDcsHandler(l,((f,d)=>u(f,d.toArray())))}addDcsHandler(l,u){return this.registerDcsHandler(l,u)}registerEscHandler(l,u){return this._core.registerEscHandler(l,u)}addEscHandler(l,u){return this.registerEscHandler(l,u)}registerOscHandler(l,u){return this._core.registerOscHandler(l,u)}addOscHandler(l,u){return this.registerOscHandler(l,u)}}},7090:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeApi=void 0,o.UnicodeApi=class{constructor(l){this._core=l}register(l){this._core.unicodeService.register(l)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(l){this._core.unicodeService.activeVersion=l}}},744:function(s,o,l){var u=this&&this.__decorate||function(g,_,v,x){var T,w=arguments.length,C=w<3?_:x===null?x=Object.getOwnPropertyDescriptor(_,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,_,v,x);else for(var R=g.length-1;R>=0;R--)(T=g[R])&&(C=(w<3?T(C):w>3?T(_,v,C):T(_,v))||C);return w>3&&C&&Object.defineProperty(_,v,C),C},f=this&&this.__param||function(g,_){return function(v,x){_(v,x,g)}};Object.defineProperty(o,"__esModule",{value:!0}),o.BufferService=o.MINIMUM_ROWS=o.MINIMUM_COLS=void 0;const d=l(8460),p=l(844),m=l(5295),y=l(2585);o.MINIMUM_COLS=2,o.MINIMUM_ROWS=1;let S=o.BufferService=class extends p.Disposable{get buffer(){return this.buffers.active}constructor(g){super(),this.isUserScrolling=!1,this._onResize=this.register(new d.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(g.rawOptions.cols||0,o.MINIMUM_COLS),this.rows=Math.max(g.rawOptions.rows||0,o.MINIMUM_ROWS),this.buffers=this.register(new m.BufferSet(g,this))}resize(g,_){this.cols=g,this.rows=_,this.buffers.resize(g,_),this._onResize.fire({cols:g,rows:_})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(g,_=!1){const v=this.buffer;let x;x=this._cachedBlankLine,x&&x.length===this.cols&&x.getFg(0)===g.fg&&x.getBg(0)===g.bg||(x=v.getBlankLine(g,_),this._cachedBlankLine=x),x.isWrapped=_;const T=v.ybase+v.scrollTop,w=v.ybase+v.scrollBottom;if(v.scrollTop===0){const C=v.lines.isFull;w===v.lines.length-1?C?v.lines.recycle().copyFrom(x):v.lines.push(x.clone()):v.lines.splice(w+1,0,x.clone()),C?this.isUserScrolling&&(v.ydisp=Math.max(v.ydisp-1,0)):(v.ybase++,this.isUserScrolling||v.ydisp++)}else{const C=w-T+1;v.lines.shiftElements(T+1,C-1,-1),v.lines.set(w,x.clone())}this.isUserScrolling||(v.ydisp=v.ybase),this._onScroll.fire(v.ydisp)}scrollLines(g,_,v){const x=this.buffer;if(g<0){if(x.ydisp===0)return;this.isUserScrolling=!0}else g+x.ydisp>=x.ybase&&(this.isUserScrolling=!1);const T=x.ydisp;x.ydisp=Math.max(Math.min(x.ydisp+g,x.ybase),0),T!==x.ydisp&&(_||this._onScroll.fire(x.ydisp))}};o.BufferService=S=u([f(0,y.IOptionsService)],S)},7994:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.CharsetService=void 0,o.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(l){this.glevel=l,this.charset=this._charsets[l]}setgCharset(l,u){this._charsets[l]=u,this.glevel===l&&(this.charset=u)}}},1753:function(s,o,l){var u=this&&this.__decorate||function(x,T,w,C){var R,O=arguments.length,N=O<3?T:C===null?C=Object.getOwnPropertyDescriptor(T,w):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(x,T,w,C);else for(var L=x.length-1;L>=0;L--)(R=x[L])&&(N=(O<3?R(N):O>3?R(T,w,N):R(T,w))||N);return O>3&&N&&Object.defineProperty(T,w,N),N},f=this&&this.__param||function(x,T){return function(w,C){T(w,C,x)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreMouseService=void 0;const d=l(2585),p=l(8460),m=l(844),y={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:x=>x.button!==4&&x.action===1&&(x.ctrl=!1,x.alt=!1,x.shift=!1,!0)},VT200:{events:19,restrict:x=>x.action!==32},DRAG:{events:23,restrict:x=>x.action!==32||x.button!==3},ANY:{events:31,restrict:x=>!0}};function S(x,T){let w=(x.ctrl?16:0)|(x.shift?4:0)|(x.alt?8:0);return x.button===4?(w|=64,w|=x.action):(w|=3&x.button,4&x.button&&(w|=64),8&x.button&&(w|=128),x.action===32?w|=32:x.action!==0||T||(w|=3)),w}const g=String.fromCharCode,_={DEFAULT:x=>{const T=[S(x,!1)+32,x.col+32,x.row+32];return T[0]>255||T[1]>255||T[2]>255?"":`\x1B[M${g(T[0])}${g(T[1])}${g(T[2])}`},SGR:x=>{const T=x.action===0&&x.button!==4?"m":"M";return`\x1B[<${S(x,!0)};${x.col};${x.row}${T}`},SGR_PIXELS:x=>{const T=x.action===0&&x.button!==4?"m":"M";return`\x1B[<${S(x,!0)};${x.x};${x.y}${T}`}};let v=o.CoreMouseService=class extends m.Disposable{constructor(x,T){super(),this._bufferService=x,this._coreService=T,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new p.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const w of Object.keys(y))this.addProtocol(w,y[w]);for(const w of Object.keys(_))this.addEncoding(w,_[w]);this.reset()}addProtocol(x,T){this._protocols[x]=T}addEncoding(x,T){this._encodings[x]=T}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(x){if(!this._protocols[x])throw new Error(`unknown protocol "${x}"`);this._activeProtocol=x,this._onProtocolChange.fire(this._protocols[x].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(x){if(!this._encodings[x])throw new Error(`unknown encoding "${x}"`);this._activeEncoding=x}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(x){if(x.col<0||x.col>=this._bufferService.cols||x.row<0||x.row>=this._bufferService.rows||x.button===4&&x.action===32||x.button===3&&x.action!==32||x.button!==4&&(x.action===2||x.action===3)||(x.col++,x.row++,x.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,x,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(x))return!1;const T=this._encodings[this._activeEncoding](x);return T&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(T):this._coreService.triggerDataEvent(T,!0)),this._lastEvent=x,!0}explainEvents(x){return{down:!!(1&x),up:!!(2&x),drag:!!(4&x),move:!!(8&x),wheel:!!(16&x)}}_equalEvents(x,T,w){if(w){if(x.x!==T.x||x.y!==T.y)return!1}else if(x.col!==T.col||x.row!==T.row)return!1;return x.button===T.button&&x.action===T.action&&x.ctrl===T.ctrl&&x.alt===T.alt&&x.shift===T.shift}};o.CoreMouseService=v=u([f(0,d.IBufferService),f(1,d.ICoreService)],v)},6975:function(s,o,l){var u=this&&this.__decorate||function(v,x,T,w){var C,R=arguments.length,O=R<3?x:w===null?w=Object.getOwnPropertyDescriptor(x,T):w;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")O=Reflect.decorate(v,x,T,w);else for(var N=v.length-1;N>=0;N--)(C=v[N])&&(O=(R<3?C(O):R>3?C(x,T,O):C(x,T))||O);return R>3&&O&&Object.defineProperty(x,T,O),O},f=this&&this.__param||function(v,x){return function(T,w){x(T,w,v)}};Object.defineProperty(o,"__esModule",{value:!0}),o.CoreService=void 0;const d=l(1439),p=l(8460),m=l(844),y=l(2585),S=Object.freeze({insertMode:!1}),g=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let _=o.CoreService=class extends m.Disposable{constructor(v,x,T){super(),this._bufferService=v,this._logService=x,this._optionsService=T,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new p.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new p.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new p.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new p.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(g)}reset(){this.modes=(0,d.clone)(S),this.decPrivateModes=(0,d.clone)(g)}triggerDataEvent(v,x=!1){if(this._optionsService.rawOptions.disableStdin)return;const T=this._bufferService.buffer;x&&this._optionsService.rawOptions.scrollOnUserInput&&T.ybase!==T.ydisp&&this._onRequestScrollToBottom.fire(),x&&this._onUserInput.fire(),this._logService.debug(`sending data "${v}"`,(()=>v.split("").map((w=>w.charCodeAt(0))))),this._onData.fire(v)}triggerBinaryEvent(v){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${v}"`,(()=>v.split("").map((x=>x.charCodeAt(0))))),this._onBinary.fire(v))}};o.CoreService=_=u([f(0,y.IBufferService),f(1,y.ILogService),f(2,y.IOptionsService)],_)},9074:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.DecorationService=void 0;const u=l(8055),f=l(8460),d=l(844),p=l(6106);let m=0,y=0;class S extends d.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new p.SortedList((v=>v?.marker.line)),this._onDecorationRegistered=this.register(new f.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new f.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,d.toDisposable)((()=>this.reset())))}registerDecoration(v){if(v.marker.isDisposed)return;const x=new g(v);if(x){const T=x.marker.onDispose((()=>x.dispose()));x.onDispose((()=>{x&&(this._decorations.delete(x)&&this._onDecorationRemoved.fire(x),T.dispose())})),this._decorations.insert(x),this._onDecorationRegistered.fire(x)}return x}reset(){for(const v of this._decorations.values())v.dispose();this._decorations.clear()}*getDecorationsAtCell(v,x,T){let w=0,C=0;for(const R of this._decorations.getKeyIterator(x))w=R.options.x??0,C=w+(R.options.width??1),v>=w&&v<C&&(!T||(R.options.layer??"bottom")===T)&&(yield R)}forEachDecorationAtCell(v,x,T,w){this._decorations.forEachByKey(x,(C=>{m=C.options.x??0,y=m+(C.options.width??1),v>=m&&v<y&&(!T||(C.options.layer??"bottom")===T)&&w(C)}))}}o.DecorationService=S;class g extends d.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=u.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=u.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(v){super(),this.options=v,this.onRenderEmitter=this.register(new f.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new f.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=v.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.InstantiationService=o.ServiceCollection=void 0;const u=l(2585),f=l(8343);class d{constructor(...m){this._entries=new Map;for(const[y,S]of m)this.set(y,S)}set(m,y){const S=this._entries.get(m);return this._entries.set(m,y),S}forEach(m){for(const[y,S]of this._entries.entries())m(y,S)}has(m){return this._entries.has(m)}get(m){return this._entries.get(m)}}o.ServiceCollection=d,o.InstantiationService=class{constructor(){this._services=new d,this._services.set(u.IInstantiationService,this)}setService(p,m){this._services.set(p,m)}getService(p){return this._services.get(p)}createInstance(p,...m){const y=(0,f.getServiceDependencies)(p).sort(((_,v)=>_.index-v.index)),S=[];for(const _ of y){const v=this._services.get(_.id);if(!v)throw new Error(`[createInstance] ${p.name} depends on UNKNOWN service ${_.id}.`);S.push(v)}const g=y.length>0?y[0].index:m.length;if(m.length!==g)throw new Error(`[createInstance] First service dependency of ${p.name} at position ${g+1} conflicts with ${m.length} static arguments`);return new p(...m,...S)}}},7866:function(s,o,l){var u=this&&this.__decorate||function(g,_,v,x){var T,w=arguments.length,C=w<3?_:x===null?x=Object.getOwnPropertyDescriptor(_,v):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(g,_,v,x);else for(var R=g.length-1;R>=0;R--)(T=g[R])&&(C=(w<3?T(C):w>3?T(_,v,C):T(_,v))||C);return w>3&&C&&Object.defineProperty(_,v,C),C},f=this&&this.__param||function(g,_){return function(v,x){_(v,x,g)}};Object.defineProperty(o,"__esModule",{value:!0}),o.traceCall=o.setTraceLogger=o.LogService=void 0;const d=l(844),p=l(2585),m={trace:p.LogLevelEnum.TRACE,debug:p.LogLevelEnum.DEBUG,info:p.LogLevelEnum.INFO,warn:p.LogLevelEnum.WARN,error:p.LogLevelEnum.ERROR,off:p.LogLevelEnum.OFF};let y,S=o.LogService=class extends d.Disposable{get logLevel(){return this._logLevel}constructor(g){super(),this._optionsService=g,this._logLevel=p.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),y=this}_updateLogLevel(){this._logLevel=m[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(g){for(let _=0;_<g.length;_++)typeof g[_]=="function"&&(g[_]=g[_]())}_log(g,_,v){this._evalLazyOptionalParams(v),g.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+_,...v)}trace(g,..._){this._logLevel<=p.LogLevelEnum.TRACE&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,g,_)}debug(g,..._){this._logLevel<=p.LogLevelEnum.DEBUG&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,g,_)}info(g,..._){this._logLevel<=p.LogLevelEnum.INFO&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,g,_)}warn(g,..._){this._logLevel<=p.LogLevelEnum.WARN&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,g,_)}error(g,..._){this._logLevel<=p.LogLevelEnum.ERROR&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,g,_)}};o.LogService=S=u([f(0,p.IOptionsService)],S),o.setTraceLogger=function(g){y=g},o.traceCall=function(g,_,v){if(typeof v.value!="function")throw new Error("not supported");const x=v.value;v.value=function(...T){if(y.logLevel!==p.LogLevelEnum.TRACE)return x.apply(this,T);y.trace(`GlyphRenderer#${x.name}(${T.map((C=>JSON.stringify(C))).join(", ")})`);const w=x.apply(this,T);return y.trace(`GlyphRenderer#${x.name} return`,w),w}}},7302:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.OptionsService=o.DEFAULT_OPTIONS=void 0;const u=l(8460),f=l(844),d=l(6114);o.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:d.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const p=["normal","bold","100","200","300","400","500","600","700","800","900"];class m extends f.Disposable{constructor(S){super(),this._onOptionChange=this.register(new u.EventEmitter),this.onOptionChange=this._onOptionChange.event;const g={...o.DEFAULT_OPTIONS};for(const _ in S)if(_ in g)try{const v=S[_];g[_]=this._sanitizeAndValidateOption(_,v)}catch(v){console.error(v)}this.rawOptions=g,this.options={...g},this._setupOptions(),this.register((0,f.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(S,g){return this.onOptionChange((_=>{_===S&&g(this.rawOptions[S])}))}onMultipleOptionChange(S,g){return this.onOptionChange((_=>{S.indexOf(_)!==-1&&g()}))}_setupOptions(){const S=_=>{if(!(_ in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);return this.rawOptions[_]},g=(_,v)=>{if(!(_ in o.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);v=this._sanitizeAndValidateOption(_,v),this.rawOptions[_]!==v&&(this.rawOptions[_]=v,this._onOptionChange.fire(_))};for(const _ in this.rawOptions){const v={get:S.bind(this,_),set:g.bind(this,_)};Object.defineProperty(this.options,_,v)}}_sanitizeAndValidateOption(S,g){switch(S){case"cursorStyle":if(g||(g=o.DEFAULT_OPTIONS[S]),!(function(_){return _==="block"||_==="underline"||_==="bar"})(g))throw new Error(`"${g}" is not a valid value for ${S}`);break;case"wordSeparator":g||(g=o.DEFAULT_OPTIONS[S]);break;case"fontWeight":case"fontWeightBold":if(typeof g=="number"&&1<=g&&g<=1e3)break;g=p.includes(g)?g:o.DEFAULT_OPTIONS[S];break;case"cursorWidth":g=Math.floor(g);case"lineHeight":case"tabStopWidth":if(g<1)throw new Error(`${S} cannot be less than 1, value: ${g}`);break;case"minimumContrastRatio":g=Math.max(1,Math.min(21,Math.round(10*g)/10));break;case"scrollback":if((g=Math.min(g,4294967295))<0)throw new Error(`${S} cannot be less than 0, value: ${g}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(g<=0)throw new Error(`${S} cannot be less than or equal to 0, value: ${g}`);break;case"rows":case"cols":if(!g&&g!==0)throw new Error(`${S} must be numeric, value: ${g}`);break;case"windowsPty":g=g??{}}return g}}o.OptionsService=m},2660:function(s,o,l){var u=this&&this.__decorate||function(m,y,S,g){var _,v=arguments.length,x=v<3?y:g===null?g=Object.getOwnPropertyDescriptor(y,S):g;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")x=Reflect.decorate(m,y,S,g);else for(var T=m.length-1;T>=0;T--)(_=m[T])&&(x=(v<3?_(x):v>3?_(y,S,x):_(y,S))||x);return v>3&&x&&Object.defineProperty(y,S,x),x},f=this&&this.__param||function(m,y){return function(S,g){y(S,g,m)}};Object.defineProperty(o,"__esModule",{value:!0}),o.OscLinkService=void 0;const d=l(2585);let p=o.OscLinkService=class{constructor(m){this._bufferService=m,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(m){const y=this._bufferService.buffer;if(m.id===void 0){const T=y.addMarker(y.ybase+y.y),w={data:m,id:this._nextId++,lines:[T]};return T.onDispose((()=>this._removeMarkerFromLink(w,T))),this._dataByLinkId.set(w.id,w),w.id}const S=m,g=this._getEntryIdKey(S),_=this._entriesWithId.get(g);if(_)return this.addLineToLink(_.id,y.ybase+y.y),_.id;const v=y.addMarker(y.ybase+y.y),x={id:this._nextId++,key:this._getEntryIdKey(S),data:S,lines:[v]};return v.onDispose((()=>this._removeMarkerFromLink(x,v))),this._entriesWithId.set(x.key,x),this._dataByLinkId.set(x.id,x),x.id}addLineToLink(m,y){const S=this._dataByLinkId.get(m);if(S&&S.lines.every((g=>g.line!==y))){const g=this._bufferService.buffer.addMarker(y);S.lines.push(g),g.onDispose((()=>this._removeMarkerFromLink(S,g)))}}getLinkData(m){return this._dataByLinkId.get(m)?.data}_getEntryIdKey(m){return`${m.id};;${m.uri}`}_removeMarkerFromLink(m,y){const S=m.lines.indexOf(y);S!==-1&&(m.lines.splice(S,1),m.lines.length===0&&(m.data.id!==void 0&&this._entriesWithId.delete(m.key),this._dataByLinkId.delete(m.id)))}};o.OscLinkService=p=u([f(0,d.IBufferService)],p)},8343:(s,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.createDecorator=o.getServiceDependencies=o.serviceRegistry=void 0;const l="di$target",u="di$dependencies";o.serviceRegistry=new Map,o.getServiceDependencies=function(f){return f[u]||[]},o.createDecorator=function(f){if(o.serviceRegistry.has(f))return o.serviceRegistry.get(f);const d=function(p,m,y){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(S,g,_){g[l]===g?g[u].push({id:S,index:_}):(g[u]=[{id:S,index:_}],g[l]=g)})(d,p,y)};return d.toString=()=>f,o.serviceRegistry.set(f,d),d}},2585:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.IDecorationService=o.IUnicodeService=o.IOscLinkService=o.IOptionsService=o.ILogService=o.LogLevelEnum=o.IInstantiationService=o.ICharsetService=o.ICoreService=o.ICoreMouseService=o.IBufferService=void 0;const u=l(8343);var f;o.IBufferService=(0,u.createDecorator)("BufferService"),o.ICoreMouseService=(0,u.createDecorator)("CoreMouseService"),o.ICoreService=(0,u.createDecorator)("CoreService"),o.ICharsetService=(0,u.createDecorator)("CharsetService"),o.IInstantiationService=(0,u.createDecorator)("InstantiationService"),(function(d){d[d.TRACE=0]="TRACE",d[d.DEBUG=1]="DEBUG",d[d.INFO=2]="INFO",d[d.WARN=3]="WARN",d[d.ERROR=4]="ERROR",d[d.OFF=5]="OFF"})(f||(o.LogLevelEnum=f={})),o.ILogService=(0,u.createDecorator)("LogService"),o.IOptionsService=(0,u.createDecorator)("OptionsService"),o.IOscLinkService=(0,u.createDecorator)("OscLinkService"),o.IUnicodeService=(0,u.createDecorator)("UnicodeService"),o.IDecorationService=(0,u.createDecorator)("DecorationService")},1480:(s,o,l)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.UnicodeService=void 0;const u=l(8460),f=l(225);class d{static extractShouldJoin(m){return(1&m)!=0}static extractWidth(m){return m>>1&3}static extractCharKind(m){return m>>3}static createPropertyValue(m,y,S=!1){return(16777215&m)<<3|(3&y)<<1|(S?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new u.EventEmitter,this.onChange=this._onChange.event;const m=new f.UnicodeV6;this.register(m),this._active=m.version,this._activeProvider=m}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(m){if(!this._providers[m])throw new Error(`unknown Unicode version "${m}"`);this._active=m,this._activeProvider=this._providers[m],this._onChange.fire(m)}register(m){this._providers[m.version]=m}wcwidth(m){return this._activeProvider.wcwidth(m)}getStringCellWidth(m){let y=0,S=0;const g=m.length;for(let _=0;_<g;++_){let v=m.charCodeAt(_);if(55296<=v&&v<=56319){if(++_>=g)return y+this.wcwidth(v);const w=m.charCodeAt(_);56320<=w&&w<=57343?v=1024*(v-55296)+w-56320+65536:y+=this.wcwidth(w)}const x=this.charProperties(v,S);let T=d.extractWidth(x);d.extractShouldJoin(x)&&(T-=d.extractWidth(S)),y+=T,S=x}return y}charProperties(m,y){return this._activeProvider.charProperties(m,y)}}o.UnicodeService=d}},r={};function i(s){var o=r[s];if(o!==void 0)return o.exports;var l=r[s]={exports:{}};return n[s].call(l.exports,l,l.exports,i),l.exports}var a={};return(()=>{var s=a;Object.defineProperty(s,"__esModule",{value:!0}),s.Terminal=void 0;const o=i(9042),l=i(3236),u=i(844),f=i(5741),d=i(8285),p=i(7975),m=i(7090),y=["cols","rows"];class S extends u.Disposable{constructor(_){super(),this._core=this.register(new l.Terminal(_)),this._addonManager=this.register(new f.AddonManager),this._publicOptions={...this._core.options};const v=T=>this._core.options[T],x=(T,w)=>{this._checkReadonlyOptions(T),this._core.options[T]=w};for(const T in this._core.options){const w={get:v.bind(this,T),set:x.bind(this,T)};Object.defineProperty(this._publicOptions,T,w)}}_checkReadonlyOptions(_){if(y.includes(_))throw new Error(`Option "${_}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new p.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new m.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new d.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const _=this._core.coreService.decPrivateModes;let v="none";switch(this._core.coreMouseService.activeProtocol){case"X10":v="x10";break;case"VT200":v="vt200";break;case"DRAG":v="drag";break;case"ANY":v="any"}return{applicationCursorKeysMode:_.applicationCursorKeys,applicationKeypadMode:_.applicationKeypad,bracketedPasteMode:_.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:v,originMode:_.origin,reverseWraparoundMode:_.reverseWraparound,sendFocusMode:_.sendFocus,wraparoundMode:_.wraparound}}get options(){return this._publicOptions}set options(_){for(const v in _)this._publicOptions[v]=_[v]}blur(){this._core.blur()}focus(){this._core.focus()}input(_,v=!0){this._core.input(_,v)}resize(_,v){this._verifyIntegers(_,v),this._core.resize(_,v)}open(_){this._core.open(_)}attachCustomKeyEventHandler(_){this._core.attachCustomKeyEventHandler(_)}attachCustomWheelEventHandler(_){this._core.attachCustomWheelEventHandler(_)}registerLinkProvider(_){return this._core.registerLinkProvider(_)}registerCharacterJoiner(_){return this._checkProposedApi(),this._core.registerCharacterJoiner(_)}deregisterCharacterJoiner(_){this._checkProposedApi(),this._core.deregisterCharacterJoiner(_)}registerMarker(_=0){return this._verifyIntegers(_),this._core.registerMarker(_)}registerDecoration(_){return this._checkProposedApi(),this._verifyPositiveIntegers(_.x??0,_.width??0,_.height??0),this._core.registerDecoration(_)}hasSelection(){return this._core.hasSelection()}select(_,v,x){this._verifyIntegers(_,v,x),this._core.select(_,v,x)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(_,v){this._verifyIntegers(_,v),this._core.selectLines(_,v)}dispose(){super.dispose()}scrollLines(_){this._verifyIntegers(_),this._core.scrollLines(_)}scrollPages(_){this._verifyIntegers(_),this._core.scrollPages(_)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(_){this._verifyIntegers(_),this._core.scrollToLine(_)}clear(){this._core.clear()}write(_,v){this._core.write(_,v)}writeln(_,v){this._core.write(_),this._core.write(`\r
39
- `,v)}paste(_){this._core.paste(_)}refresh(_,v){this._verifyIntegers(_,v),this._core.refresh(_,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(_){this._addonManager.loadAddon(this,_)}static get strings(){return o}_verifyIntegers(..._){for(const v of _)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(..._){for(const v of _)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}s.Terminal=S})(),a})()))})(kk)),kk.exports}var Oie=aNe(),Ok={exports:{}},dH;function sNe(){return dH||(dH=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(i){this._terminal=i}dispose(){}fit(){const i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;const a=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(a._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const i=this._terminal._core,a=i._renderService.dimensions;if(a.css.cell.width===0||a.css.cell.height===0)return;const s=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(o.getPropertyValue("height")),u=Math.max(0,parseInt(o.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),d=l-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),p=u-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-s;return{cols:Math.max(2,Math.floor(p/a.css.cell.width)),rows:Math.max(1,Math.floor(d/a.css.cell.height))}}}})(),n})()))})(Ok)),Ok.exports}var Rie=sNe(),Rk={exports:{}},fH;function oNe(){return fH||(fH=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={6:(s,o)=>{function l(f){try{const d=new URL(f),p=d.password&&d.username?`${d.protocol}//${d.username}:${d.password}@${d.host}`:d.username?`${d.protocol}//${d.username}@${d.host}`:`${d.protocol}//${d.host}`;return f.toLocaleLowerCase().startsWith(p.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(o,"__esModule",{value:!0}),o.LinkComputer=o.WebLinkProvider=void 0,o.WebLinkProvider=class{constructor(f,d,p,m={}){this._terminal=f,this._regex=d,this._handler=p,this._options=m}provideLinks(f,d){const p=u.computeLink(f,this._regex,this._terminal,this._handler);d(this._addCallbacks(p))}_addCallbacks(f){return f.map((d=>(d.leave=this._options.leave,d.hover=(p,m)=>{if(this._options.hover){const{range:y}=d;this._options.hover(p,m,y)}},d)))}};class u{static computeLink(d,p,m,y){const S=new RegExp(p.source,(p.flags||"")+"g"),[g,_]=u._getWindowedLineStrings(d-1,m),v=g.join("");let x;const T=[];for(;x=S.exec(v);){const w=x[0];if(!l(w))continue;const[C,R]=u._mapStrIdx(m,_,0,x.index),[O,N]=u._mapStrIdx(m,C,R,w.length);if(C===-1||R===-1||O===-1||N===-1)continue;const L={start:{x:R+1,y:C+1},end:{x:N,y:O+1}};T.push({range:L,text:w,activate:y})}return T}static _getWindowedLineStrings(d,p){let m,y=d,S=d,g=0,_="";const v=[];if(m=p.buffer.active.getLine(d)){const x=m.translateToString(!0);if(m.isWrapped&&x[0]!==" "){for(g=0;(m=p.buffer.active.getLine(--y))&&g<2048&&(_=m.translateToString(!0),g+=_.length,v.push(_),m.isWrapped&&_.indexOf(" ")===-1););v.reverse()}for(v.push(x),g=0;(m=p.buffer.active.getLine(++S))&&m.isWrapped&&g<2048&&(_=m.translateToString(!0),g+=_.length,v.push(_),_.indexOf(" ")===-1););}return[v,y]}static _mapStrIdx(d,p,m,y){const S=d.buffer.active,g=S.getNullCell();let _=m;for(;y;){const v=S.getLine(p);if(!v)return[-1,-1];for(let x=_;x<v.length;++x){v.getCell(x,g);const T=g.getChars();if(g.getWidth()&&(y-=T.length||1,x===v.length-1&&T==="")){const w=S.getLine(p+1);w&&w.isWrapped&&(w.getCell(0,g),g.getWidth()===2&&(y+=1))}if(y<0)return[p,x]}p++,_=0}return[p,_]}}o.LinkComputer=u}},r={};function i(s){var o=r[s];if(o!==void 0)return o.exports;var l=r[s]={exports:{}};return n[s](l,l.exports,i),l.exports}var a={};return(()=>{var s=a;Object.defineProperty(s,"__esModule",{value:!0}),s.WebLinksAddon=void 0;const o=i(6),l=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function u(f,d){const p=window.open();if(p){try{p.opener=null}catch{}p.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}s.WebLinksAddon=class{constructor(f=u,d={}){this._handler=f,this._options=d}activate(f){this._terminal=f;const d=this._options,p=d.urlRegex||l;this._linkProvider=this._terminal.registerLinkProvider(new o.WebLinkProvider(this._terminal,p,this._handler,d))}dispose(){this._linkProvider?.dispose()}}})(),a})()))})(Rk)),Rk.exports}var Nie=oNe();function pw(){const[e,t]=k.useState(!1);return k.useEffect(()=>{const n=window.matchMedia("(max-width: 639px)");t(n.matches);const r=i=>t(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const lNe=[{label:"Esc",icon:ci,data:"\x1B"},{label:"Up",icon:dM,data:"\x1B[A"},{label:"Down",icon:Uy,data:"\x1B[B"},{label:"Enter",icon:null,data:"\r"}];function lS({onSend:e}){return pw()?b.jsx("div",{className:"flex shrink-0 items-center justify-center gap-2 border-t border-border bg-card px-3 py-2",children:lNe.map(n=>b.jsxs(Ke,{variant:"outline",className:"h-11 min-w-11 touch-manipulation",onClick:()=>e(n.data),children:[n.icon?b.jsx(fe,{icon:n.icon,size:20,strokeWidth:2}):b.jsx("span",{className:"text-xs font-medium",children:n.label}),b.jsx("span",{className:"sr-only",children:n.label})]},n.label))}):null}const Iie={background:"#faf9f5",foreground:"#2a2a27",cursor:"#2a2a27",cursorAccent:"#faf9f5",selectionBackground:"#d1d5db",black:"#2a2a27",red:"#dd403a",green:"#0d5c63",yellow:"#dd403a",blue:"#0d5c63",magenta:"#5c5c59",cyan:"#0d5c63",white:"#5c5c59",brightBlack:"#5c5c59",brightRed:"#dd403a",brightGreen:"#0d5c63",brightYellow:"#dd403a",brightBlue:"#0d5c63",brightMagenta:"#5c5c59",brightCyan:"#0d5c63",brightWhite:"#5c5c59"},Die={background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#e4e4e7",cursorAccent:"#0a0a0a",selectionBackground:"#3f3f46",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"};function vD({className:e,onReady:t,onResize:n,onContainerReady:r,terminalId:i,setupImagePaste:a,onSend:s,onFocus:o}){const l=k.useRef(null),u=k.useRef(null),f=k.useRef(null),d=k.useRef(n),p=k.useRef(o),m=k.useRef(t),y=k.useRef(r),{setTerminalFocused:S}=mM(),{resolvedTheme:g}=qc(),_=g==="dark",v=_?Die:Iie;k.useEffect(()=>{d.current=n},[n]),k.useEffect(()=>{p.current=o},[o]),k.useEffect(()=>{m.current=t},[t]),k.useEffect(()=>{y.current=r},[r]);const x=k.useCallback(()=>{if(!f.current||!u.current)return;f.current.fit();const{cols:w,rows:C}=u.current;d.current?.(w,C)},[]);k.useEffect(()=>{if(!l.current||u.current)return;const w=new Oie.Terminal({cursorBlink:!0,fontSize:Math.round(13*vc),fontFamily:"JetBrains Mono Variable, PureNerdFont, Menlo, Monaco, monospace",lineHeight:1.2,theme:v}),C=new Rie.FitAddon,R=new Nie.WebLinksAddon;w.loadAddon(C),w.loadAddon(R),w.open(l.current),u.current=w,f.current=C,requestAnimationFrame(()=>{x(),m.current?.(w),l.current&&y.current?.(l.current)});const O=()=>{S(!0),p.current?.()},N=()=>S(!1);w.textarea&&(w.textarea.addEventListener("focus",O),w.textarea.addEventListener("blur",N));const L=setTimeout(()=>{x(),w.refresh(0,w.rows-1)},100),D=()=>{requestAnimationFrame(x)};window.addEventListener("resize",D);const z=()=>{document.visibilityState==="visible"&&requestAnimationFrame(()=>{x(),w.refresh(0,w.rows-1)})};document.addEventListener("visibilitychange",z);const M=new ResizeObserver(D);M.observe(l.current);const V=new IntersectionObserver(W=>{W[0]?.isIntersecting&&requestAnimationFrame(()=>{x(),w.refresh(0,w.rows-1)})},{threshold:.1});return V.observe(l.current),()=>{clearTimeout(L),window.removeEventListener("resize",D),document.removeEventListener("visibilitychange",z),M.disconnect(),V.disconnect(),w.textarea&&(w.textarea.removeEventListener("focus",O),w.textarea.removeEventListener("blur",N)),S(!1),w.dispose(),u.current=null,f.current=null}},[x,S]),k.useEffect(()=>!l.current||!i||!a?void 0:a(l.current,i),[i,a]),k.useEffect(()=>{u.current&&(u.current.options.theme=v)},[v]);const T=k.useCallback(()=>{u.current?.scrollToBottom()},[]);return b.jsxs("div",{className:"flex h-full w-full max-w-full flex-col",children:[b.jsxs("div",{className:"relative min-h-0 flex-1",children:[b.jsx("div",{ref:l,className:Ue("h-full w-full max-w-full overflow-hidden p-2 bg-terminal-background",e)}),b.jsx("button",{onClick:T,className:Ue("absolute top-2 right-5 p-1 transition-colors",_?"text-white/50 hover:text-white/80":"text-black/50 hover:text-black/80"),children:b.jsx(fe,{icon:cM,size:20,strokeWidth:2})})]}),s&&b.jsx(lS,{onSend:s})]})}function uNe({name:e,status:t,exitCode:n,className:r,onRename:i}){const[a,s]=k.useState(!1),[o,l]=k.useState(e),u=k.useRef(null);k.useEffect(()=>{a&&u.current&&(u.current.focus(),u.current.select())},[a]);const f=()=>{i&&(l(e),s(!0))},d=()=>{const m=o.trim();m&&m!==e&&i&&i(m),s(!1)},p=m=>{m.key==="Enter"?d():m.key==="Escape"&&s(!1)};return b.jsxs("div",{className:Ue("flex h-6 items-center gap-2 border-b border-border bg-card px-2 text-xs",r),children:[b.jsx("span",{className:Ue("h-2 w-2 shrink-0 rounded-full",{"bg-accent":t==="running","bg-muted-foreground":t==="exited"&&n===0,"bg-destructive":t==="exited"&&n!==0||t==="error"})}),a?b.jsx("input",{ref:u,type:"text",value:o,onChange:m=>l(m.target.value),onBlur:d,onKeyDown:p,className:"h-4 w-24 rounded border border-border bg-background px-1 text-xs font-medium text-foreground outline-none focus:border-primary"}):b.jsx("span",{className:Ue("font-medium text-foreground",i&&"cursor-pointer hover:text-primary"),onDoubleClick:f,title:i?"Double-click to rename":void 0,children:e}),t==="exited"&&n!==void 0&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"ml-auto text-muted-foreground",children:"·"}),b.jsxs("span",{className:Ue({"text-muted-foreground":n===0,"text-destructive":n!==0}),children:["exit ",n]})]})]})}function uE({...e}){return b.jsx(MSe,{"data-slot":"dropdown-menu",...e})}function cE({...e}){return b.jsx(FSe,{"data-slot":"dropdown-menu-trigger",...e})}function dE({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:i,...a}){return b.jsx(wSe,{children:b.jsx(TSe,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:b.jsx(SSe,{"data-slot":"dropdown-menu-content",className:Ue("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 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden",i),...a})})})}function eo({className:e,inset:t,variant:n="default",...r}){return b.jsx(_Se,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive 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 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r})}function hH({...e}){return b.jsx(ASe,{"data-slot":"dropdown-menu-radio-group",...e})}function pH({className:e,children:t,...n}){return b.jsxs(OSe,{"data-slot":"dropdown-menu-radio-item",className:Ue("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[b.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none","data-slot":"dropdown-menu-radio-item-indicator",children:b.jsx(RSe,{children:b.jsx(fe,{icon:hl,strokeWidth:2})})}),t]})}const cNe="";function Lie(){return zn({mutationFn:async e=>{const t=await fetch(`${cNe}/api/git/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Sync failed")}return t.json()}})}const dNe="";function Pie(){return zn({mutationFn:async e=>{const t=await fetch(`${dNe}/api/git/merge-to-main`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Merge failed")}return t.json()}})}const fNe="";function Mie(){return zn({mutationFn:async e=>{const t=await fetch(`${fNe}/api/git/push`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Push failed")}return t.json()}})}const hNe="";function jie(){return zn({mutationFn:async e=>{const t=await fetch(`${hNe}/api/git/sync-parent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Sync parent failed")}return t.json()}})}const pNe="";function Fie(){return zn({mutationFn:async e=>{const t=await fetch(`${pNe}/api/tasks/${e}/kill-claude`,{method:"POST"});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to kill Claude")}return t.json()}})}function mNe({repoPath:e,worktreePath:t,baseBranch:n,taskId:r,isMobile:i,terminalId:a,sendInputToTerminal:s}){const o=Lie(),l=Pie(),u=Mie(),f=jie(),d=NM(),p=Fie(),m=T=>{a&&s?(s(a,T),ln.info("Sent to Claude Code")):ln.error("No terminal available")},y=async()=>{try{await o.mutateAsync({repoPath:e,worktreePath:t,baseBranch:n}),ln.success("Synced from main")}catch(T){const w=T instanceof Error?T.message:"Sync failed",C=n||"main";ln.error(w,{action:a&&s?{label:"Resolve with Claude",onClick:()=>m(`Rebase this worktree onto the parent repo's ${C} branch. Error: "${w}". Steps: 1) Check for uncommitted changes - stash or commit them first, 2) git fetch origin (in parent repo at ${e}) to ensure ${C} is current, 3) git rebase ${C} (in worktree), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) If stashed, git stash pop. Worktree: ${t}, Parent repo: ${e}.`)}:void 0})}},S=async()=>{try{await l.mutateAsync({repoPath:e,worktreePath:t,baseBranch:n}),ln.success("Merged to main"),p.mutate(r),d.mutate({taskId:r,updates:{status:"DONE"}})}catch(T){const w=T instanceof Error?T.message:"Merge failed",C=n||"main";ln.error(w,{action:a&&s?{label:"Resolve with Claude",onClick:()=>m(`Merge this worktree's branch into the parent repo's ${C}. Error: "${w}". Steps: 1) Ensure all changes in worktree are committed, 2) In parent repo at ${e}, checkout ${C} and pull latest from origin, 3) Squash merge the worktree branch into ${C} (use git merge --squash, then commit), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Push ${C} to origin. Worktree: ${t}, Parent repo: ${e}.`)}:void 0})}},g=async()=>{try{await u.mutateAsync({worktreePath:t}),ln.success("Pushed to origin")}catch(T){const w=T instanceof Error?T.message:"Push failed";ln.error(w,{action:a&&s?{label:"Resolve with Claude",onClick:()=>m(`Push this worktree's branch to origin. Error: "${w}". Steps: 1) Check for uncommitted changes and commit them, 2) If push is rejected, pull the latest changes first and resolve any conflicts, 3) Push to origin again. Worktree: ${t}.`)}:void 0})}},_=async()=>{try{await f.mutateAsync({repoPath:e,baseBranch:n}),ln.success("Parent synced with origin")}catch(T){const w=T instanceof Error?T.message:"Sync parent failed",C=n||"main";ln.error(w,{action:a&&s?{label:"Resolve with Claude",onClick:()=>m(`Sync the parent repo's ${C} branch with origin. Error: "${w}". Steps: 1) git fetch origin, 2) git pull origin ${C} --ff-only, 3) If that fails, rebase with git rebase origin/${C}, 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Once in sync, git push origin ${C}. Work in the parent repo at ${e}, not the worktree.`)}:void 0})}},v=()=>{a&&s&&s(a,"commit")},x=o.isPending||l.isPending||u.isPending||f.isPending;return i?b.jsxs(uE,{children:[b.jsx(cE,{className:"flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground",children:b.jsx(fe,{icon:F1e,size:12,strokeWidth:2,className:x?"animate-pulse":""})}),b.jsxs(dE,{align:"end",children:[b.jsxs(eo,{onClick:y,disabled:o.isPending,children:[b.jsx(fe,{icon:HE,size:12,strokeWidth:2,className:o.isPending?"animate-spin":""}),"Pull from main"]}),b.jsxs(eo,{onClick:S,disabled:l.isPending,children:[b.jsx(fe,{icon:zE,size:12,strokeWidth:2,className:l.isPending?"animate-pulse":""}),"Merge to main"]}),b.jsxs(eo,{onClick:g,disabled:u.isPending,children:[b.jsx(fe,{icon:WE,size:12,strokeWidth:2,className:u.isPending?"animate-pulse":""}),"Push to origin"]}),b.jsxs(eo,{onClick:_,disabled:f.isPending,children:[b.jsx(fe,{icon:GE,size:12,strokeWidth:2,className:f.isPending?"animate-spin":""}),"Sync parent with origin"]}),a&&s&&b.jsxs(eo,{onClick:v,children:[b.jsx(fe,{icon:VE,size:12,strokeWidth:2}),"Commit"]})]})]}):b.jsxs(b.Fragment,{children:[b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:y,disabled:o.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Pull from main",children:b.jsx(fe,{icon:HE,size:12,strokeWidth:2,className:o.isPending?"animate-spin":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:S,disabled:l.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Merge to main",children:b.jsx(fe,{icon:zE,size:12,strokeWidth:2,className:l.isPending?"animate-pulse":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:g,disabled:u.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Push to origin",children:b.jsx(fe,{icon:WE,size:12,strokeWidth:2,className:u.isPending?"animate-pulse":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:_,disabled:f.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Sync parent with origin",children:b.jsx(fe,{icon:GE,size:12,strokeWidth:2,className:f.isPending?"animate-spin":""})}),a&&s&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:v,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Commit",children:b.jsx(fe,{icon:VE,size:12,strokeWidth:2})})]})}function gNe({terminals:e,activeIndex:t,onSelect:n,taskInfoByCwd:r}){const i=k.useRef(null),a=k.useRef(null);k.useEffect(()=>{a.current&&i.current&&a.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[t]);const s=(o,l)=>{if(o.cwd&&r){const u=r.get(o.cwd);if(u)return u.title}return o.name||`Terminal ${l+1}`};return b.jsx("div",{ref:i,className:"flex shrink-0 gap-1 overflow-x-auto border-b border-border bg-card px-2 py-1.5",style:{WebkitOverflowScrolling:"touch"},children:e.map((o,l)=>{const u=l===t,f=s(o,l);return b.jsx("button",{ref:u?a:null,onClick:()=>n(l),className:Ue("shrink-0 rounded-md px-3 py-1.5 text-xs font-medium transition-colors touch-manipulation","max-w-[150px] truncate",u?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"),children:f},o.id)})})}function Vb({worktreePath:e}){const{data:t,isLoading:n}=Gxe(e);if(!e||n||!t)return null;if(t.clean)return b.jsxs(co,{className:"bg-accent/20 text-accent border-transparent",children:[b.jsx(fe,{icon:hl,size:12,strokeWidth:2}),"Clean"]});const r=t.files.length;return b.jsxs(co,{className:"bg-amber-500/20 text-amber-600 dark:text-amber-400 border-transparent",children:[b.jsx(fe,{icon:ts,size:12,strokeWidth:2}),r," ",r===1?"change":"changes"]})}const bNe=n0(function({terminal:t,taskInfo:n,isMobile:r,onClose:i,onReady:a,onResize:s,onRename:o,onContainerReady:l,setupImagePaste:u,onFocus:f,sendInputToTerminal:d,isMaximized:p,onMaximize:m,onMinimize:y,canMaximize:S}){const g=Mm(),{resolvedTheme:_}=qc(),v=_==="dark",x=IM(),T=n?g.terminals.get(t.id):null,w=T?.isStartingUp??!1,C=()=>{n&&x.mutate({taskId:n.taskId,deleteLinkedWorktree:!0})};return k.useEffect(()=>{n&&kt.terminal.info("TerminalPane isStartingUp check",{terminalId:t.id,hasTaskInfo:!!n,hasTerminalModel:!!T,isStartingUp:T?.isStartingUp,isStartingClaude:w})},[t.id,n,T,w,T?.isStartingUp]),b.jsxs("div",{className:"flex h-full min-w-0 flex-col overflow-hidden",children:[b.jsx("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-card",children:n?b.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2 py-1",children:[b.jsxs(wi,{to:"/tasks/$taskId",params:{taskId:n.taskId},className:"flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium text-primary hover:bg-primary/10 truncate",children:[b.jsx(fe,{icon:hM,size:14,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate",children:n.title})]}),!r&&b.jsxs(b.Fragment,{children:[b.jsxs(wi,{to:n.repoId?"/repositories/$repoId":"/repositories",params:n.repoId?{repoId:n.repoId}:void 0,className:"flex items-center gap-1 text-xs font-medium text-foreground shrink-0 cursor-pointer hover:underline",children:[b.jsx(fe,{icon:np,size:12,strokeWidth:2,className:"shrink-0"}),n.repoName]}),t.cwd&&b.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground truncate",children:[b.jsx(fe,{icon:Vx,size:12,strokeWidth:2,className:"shrink-0"}),t.cwd.split("/").pop()]})]}),b.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[b.jsx(Vb,{worktreePath:n.worktreePath}),b.jsx(mNe,{repoPath:n.repoPath,worktreePath:n.worktreePath,baseBranch:n.baseBranch,taskId:n.taskId,isMobile:r,terminalId:t.id,sendInputToTerminal:d}),b.jsxs(go,{children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-xs",className:"h-5 w-5 text-muted-foreground hover:text-destructive",title:"Delete task",disabled:x.isPending}),children:b.jsx(fe,{icon:$c,size:12,strokeWidth:2})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:"Delete Task"}),b.jsx(So,{children:"This will permanently delete this task and its worktree."})]}),b.jsxs(_o,{children:[b.jsx(xo,{children:"Cancel"}),b.jsx(Rv,{onClick:C,variant:"destructive",disabled:x.isPending,children:x.isPending?"Deleting...":"Delete"})]})]})]})]})]}):b.jsxs(b.Fragment,{children:[b.jsx(uNe,{name:t.name,status:t.status,exitCode:t.exitCode,className:"flex-1 border-b-0",onRename:o}),b.jsxs("div",{className:"flex items-center gap-1 mr-1",children:[S&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:p?y:m,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:p?"Restore":"Maximize",children:b.jsx(fe,{icon:p?E1e:j1e,size:12,strokeWidth:2})}),i&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:i,className:"h-5 w-5 text-muted-foreground hover:text-foreground",children:b.jsx(fe,{icon:ci,size:12,strokeWidth:2})})]})]})}),b.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[b.jsx(vD,{onReady:a,onResize:s,onContainerReady:l,terminalId:t.id,setupImagePaste:u,onFocus:f}),w&&b.jsx("div",{className:"pointer-events-auto absolute inset-0 z-10 flex items-center justify-center bg-terminal-background/90",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:Ue("animate-spin",v?"text-white/60":"text-black/60")}),b.jsx("span",{className:Ue("font-mono text-sm",v?"text-white/60":"text-black/60"),children:"Starting Claude Code..."})]})})]})]})});function vNe({onAdd:e}){return b.jsx("div",{className:"flex h-full items-center justify-center bg-terminal-background",children:e?b.jsxs(Ke,{variant:"outline",size:"sm",onClick:e,className:"gap-2",children:[b.jsx(fe,{icon:Ev,size:14,strokeWidth:2}),"New Terminal"]}):b.jsx("p",{className:"text-xs text-muted-foreground",children:"No terminals"})})}function yNe(e){return e<=1?{rows:1,cols:1}:e<=2?{rows:1,cols:2}:e<=4?{rows:2,cols:2}:e<=6?{rows:2,cols:3}:e<=9?{rows:3,cols:3}:{rows:3,cols:4}}function _Ne({terminals:e,onTerminalClose:t,onTerminalAdd:n,onTerminalReady:r,onTerminalResize:i,onTerminalRename:a,onTerminalContainerReady:s,setupImagePaste:o,writeToTerminal:l,sendInputToTerminal:u,taskInfoByCwd:f}){const d=pw(),[p,m]=k.useState(e.length>0?e[0].id:null),[y,S]=k.useState(0),[g,_]=k.useState(null);if(k.useEffect(()=>{y>=e.length&&e.length>0&&S(e.length-1)},[e.length,y]),k.useEffect(()=>{g&&!e.find(O=>O.id===g)&&_(null)},[e,g]),e.length===0)return b.jsx(vNe,{onAdd:n});const{rows:v,cols:x}=yNe(e.length),T=[];for(let O=0;O<v;O++){const N=O*x,L=Math.min(N+x,e.length);N<e.length&&T.push(e.slice(N,L))}const w=O=>{const N=d&&e.length>1?e[y]?.id:p;N&&l&&l(N,O)},C=O=>{const N=O.cwd?f?.get(O.cwd):void 0,L=!N&&e.length>1;return b.jsx(bNe,{terminal:O,taskInfo:N,isMobile:d,onClose:t?()=>t(O.id):void 0,onReady:r?D=>r(O.id,D):void 0,onResize:i?(D,z)=>i(O.id,D,z):void 0,onRename:a?D=>a(O.id,D):void 0,onContainerReady:s?D=>s(O.id,D):void 0,setupImagePaste:o,onFocus:()=>m(O.id),sendInputToTerminal:u,isMaximized:g===O.id,onMaximize:()=>_(O.id),onMinimize:()=>_(null),canMaximize:L})},R=O=>b.jsxs("div",{className:"flex h-full w-full flex-col",children:[b.jsx("div",{className:"min-h-0 flex-1",children:O}),d&&l&&b.jsx(lS,{onSend:w})]});if(d&&e.length>1){const O=e[y]??e[0];return b.jsxs("div",{className:"flex h-full w-full flex-col",children:[b.jsx(gNe,{terminals:e,activeIndex:y,onSelect:S,taskInfoByCwd:f}),b.jsx("div",{className:"min-h-0 flex-1",children:C(O)},O.id),l&&b.jsx(lS,{onSend:w})]})}if(e.length===1)return R(b.jsx("div",{className:"h-full w-full max-w-full min-w-0 overflow-hidden",children:C(e[0])},e[0].id));if(g){const O=e.find(N=>N.id===g);if(O)return R(b.jsx("div",{className:"h-full w-full max-w-full min-w-0 overflow-hidden",children:C(O)},O.id))}return e.length===2?R(b.jsxs(Vd,{direction:d?"vertical":"horizontal",className:"h-full max-w-full",children:[b.jsx(Ss,{defaultSize:50,minSize:15,children:C(e[0])},e[0].id),b.jsx(Gd,{}),b.jsx(Ss,{defaultSize:50,minSize:15,children:C(e[1])},e[1].id)]})):e.length===3?R(b.jsxs(Vd,{direction:"horizontal",className:"h-full max-w-full",children:[b.jsx(Ss,{defaultSize:50,minSize:15,children:C(e[0])},e[0].id),b.jsx(Gd,{}),b.jsx(Ss,{defaultSize:50,minSize:15,children:b.jsxs(Vd,{direction:"vertical",className:"h-full max-w-full",children:[b.jsx(Ss,{defaultSize:50,minSize:15,children:C(e[1])},e[1].id),b.jsx(Gd,{}),b.jsx(Ss,{defaultSize:50,minSize:15,children:C(e[2])},e[2].id)]})})]})):R(b.jsx(Vd,{direction:"vertical",className:"h-full max-w-full",children:T.map((O,N)=>b.jsxs(k.Fragment,{children:[N>0&&b.jsx(Gd,{}),b.jsx(Ss,{defaultSize:100/T.length,minSize:15,children:O.length===1?C(O[0]):b.jsx(Vd,{direction:"horizontal",className:"h-full max-w-full",children:O.map((L,D)=>b.jsxs(k.Fragment,{children:[D>0&&b.jsx(Gd,{}),b.jsx(Ss,{defaultSize:100/x,minSize:15,children:C(L)})]},L.id))})})]},`row-${N}`))}))}function ENe(e){if(Array.isArray(e))return e}function SNe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,s,o=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(l=(r=a.call(n)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(f){u=!0,i=f}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function yD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Bie(e,t){if(e){if(typeof e=="string")return yD(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yD(e,t):void 0}}function xNe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
39
+ `,v)}paste(_){this._core.paste(_)}refresh(_,v){this._verifyIntegers(_,v),this._core.refresh(_,v)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(_){this._addonManager.loadAddon(this,_)}static get strings(){return o}_verifyIntegers(..._){for(const v of _)if(v===1/0||isNaN(v)||v%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(..._){for(const v of _)if(v&&(v===1/0||isNaN(v)||v%1!=0||v<0))throw new Error("This API only accepts positive integers")}}s.Terminal=S})(),a})()))})(kk)),kk.exports}var Oie=aNe(),Ok={exports:{}},dH;function sNe(){return dH||(dH=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(i){this._terminal=i}dispose(){}fit(){const i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;const a=this._terminal._core;this._terminal.rows===i.rows&&this._terminal.cols===i.cols||(a._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const i=this._terminal._core,a=i._renderService.dimensions;if(a.css.cell.width===0||a.css.cell.height===0)return;const s=this._terminal.options.scrollback===0?0:i.viewport.scrollBarWidth,o=window.getComputedStyle(this._terminal.element.parentElement),l=parseInt(o.getPropertyValue("height")),u=Math.max(0,parseInt(o.getPropertyValue("width"))),f=window.getComputedStyle(this._terminal.element),d=l-(parseInt(f.getPropertyValue("padding-top"))+parseInt(f.getPropertyValue("padding-bottom"))),p=u-(parseInt(f.getPropertyValue("padding-right"))+parseInt(f.getPropertyValue("padding-left")))-s;return{cols:Math.max(2,Math.floor(p/a.css.cell.width)),rows:Math.max(1,Math.floor(d/a.css.cell.height))}}}})(),n})()))})(Ok)),Ok.exports}var Rie=sNe(),Rk={exports:{}},fH;function oNe(){return fH||(fH=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={6:(s,o)=>{function l(f){try{const d=new URL(f),p=d.password&&d.username?`${d.protocol}//${d.username}:${d.password}@${d.host}`:d.username?`${d.protocol}//${d.username}@${d.host}`:`${d.protocol}//${d.host}`;return f.toLocaleLowerCase().startsWith(p.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(o,"__esModule",{value:!0}),o.LinkComputer=o.WebLinkProvider=void 0,o.WebLinkProvider=class{constructor(f,d,p,m={}){this._terminal=f,this._regex=d,this._handler=p,this._options=m}provideLinks(f,d){const p=u.computeLink(f,this._regex,this._terminal,this._handler);d(this._addCallbacks(p))}_addCallbacks(f){return f.map((d=>(d.leave=this._options.leave,d.hover=(p,m)=>{if(this._options.hover){const{range:y}=d;this._options.hover(p,m,y)}},d)))}};class u{static computeLink(d,p,m,y){const S=new RegExp(p.source,(p.flags||"")+"g"),[g,_]=u._getWindowedLineStrings(d-1,m),v=g.join("");let x;const T=[];for(;x=S.exec(v);){const w=x[0];if(!l(w))continue;const[C,R]=u._mapStrIdx(m,_,0,x.index),[O,N]=u._mapStrIdx(m,C,R,w.length);if(C===-1||R===-1||O===-1||N===-1)continue;const L={start:{x:R+1,y:C+1},end:{x:N,y:O+1}};T.push({range:L,text:w,activate:y})}return T}static _getWindowedLineStrings(d,p){let m,y=d,S=d,g=0,_="";const v=[];if(m=p.buffer.active.getLine(d)){const x=m.translateToString(!0);if(m.isWrapped&&x[0]!==" "){for(g=0;(m=p.buffer.active.getLine(--y))&&g<2048&&(_=m.translateToString(!0),g+=_.length,v.push(_),m.isWrapped&&_.indexOf(" ")===-1););v.reverse()}for(v.push(x),g=0;(m=p.buffer.active.getLine(++S))&&m.isWrapped&&g<2048&&(_=m.translateToString(!0),g+=_.length,v.push(_),_.indexOf(" ")===-1););}return[v,y]}static _mapStrIdx(d,p,m,y){const S=d.buffer.active,g=S.getNullCell();let _=m;for(;y;){const v=S.getLine(p);if(!v)return[-1,-1];for(let x=_;x<v.length;++x){v.getCell(x,g);const T=g.getChars();if(g.getWidth()&&(y-=T.length||1,x===v.length-1&&T==="")){const w=S.getLine(p+1);w&&w.isWrapped&&(w.getCell(0,g),g.getWidth()===2&&(y+=1))}if(y<0)return[p,x]}p++,_=0}return[p,_]}}o.LinkComputer=u}},r={};function i(s){var o=r[s];if(o!==void 0)return o.exports;var l=r[s]={exports:{}};return n[s](l,l.exports,i),l.exports}var a={};return(()=>{var s=a;Object.defineProperty(s,"__esModule",{value:!0}),s.WebLinksAddon=void 0;const o=i(6),l=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function u(f,d){const p=window.open();if(p){try{p.opener=null}catch{}p.location.href=d}else console.warn("Opening link blocked as opener could not be cleared")}s.WebLinksAddon=class{constructor(f=u,d={}){this._handler=f,this._options=d}activate(f){this._terminal=f;const d=this._options,p=d.urlRegex||l;this._linkProvider=this._terminal.registerLinkProvider(new o.WebLinkProvider(this._terminal,p,this._handler,d))}dispose(){this._linkProvider?.dispose()}}})(),a})()))})(Rk)),Rk.exports}var Nie=oNe();function pw(){const[e,t]=k.useState(!1);return k.useEffect(()=>{const n=window.matchMedia("(max-width: 639px)");t(n.matches);const r=i=>t(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}const lNe=[{label:"Esc",icon:ci,data:"\x1B"},{label:"Up",icon:dM,data:"\x1B[A"},{label:"Down",icon:Uy,data:"\x1B[B"},{label:"Enter",icon:null,data:"\r"}];function lS({onSend:e}){return pw()?b.jsx("div",{className:"flex shrink-0 items-center justify-center gap-2 border-t border-border bg-card px-3 py-2",children:lNe.map(n=>b.jsxs(Ke,{variant:"outline",className:"h-11 min-w-11 touch-manipulation",onClick:()=>e(n.data),children:[n.icon?b.jsx(fe,{icon:n.icon,size:20,strokeWidth:2}):b.jsx("span",{className:"text-xs font-medium",children:n.label}),b.jsx("span",{className:"sr-only",children:n.label})]},n.label))}):null}const Iie={background:"#faf9f5",foreground:"#2a2a27",cursor:"#2a2a27",cursorAccent:"#faf9f5",selectionBackground:"#d1d5db",black:"#2a2a27",red:"#dd403a",green:"#0d5c63",yellow:"#dd403a",blue:"#0d5c63",magenta:"#5c5c59",cyan:"#0d5c63",white:"#5c5c59",brightBlack:"#5c5c59",brightRed:"#dd403a",brightGreen:"#0d5c63",brightYellow:"#dd403a",brightBlue:"#0d5c63",brightMagenta:"#5c5c59",brightCyan:"#0d5c63",brightWhite:"#5c5c59"},Die={background:"#0a0a0a",foreground:"#e4e4e7",cursor:"#e4e4e7",cursorAccent:"#0a0a0a",selectionBackground:"#3f3f46",black:"#18181b",red:"#ef4444",green:"#22c55e",yellow:"#eab308",blue:"#3b82f6",magenta:"#a855f7",cyan:"#06b6d4",white:"#e4e4e7",brightBlack:"#52525b",brightRed:"#f87171",brightGreen:"#4ade80",brightYellow:"#facc15",brightBlue:"#60a5fa",brightMagenta:"#c084fc",brightCyan:"#22d3ee",brightWhite:"#fafafa"};function vD({className:e,onReady:t,onResize:n,onContainerReady:r,terminalId:i,setupImagePaste:a,onSend:s,onFocus:o}){const l=k.useRef(null),u=k.useRef(null),f=k.useRef(null),d=k.useRef(n),p=k.useRef(o),m=k.useRef(t),y=k.useRef(r),{setTerminalFocused:S}=mM(),{resolvedTheme:g}=qc(),_=g==="dark",v=_?Die:Iie;k.useEffect(()=>{d.current=n},[n]),k.useEffect(()=>{p.current=o},[o]),k.useEffect(()=>{m.current=t},[t]),k.useEffect(()=>{y.current=r},[r]);const x=k.useCallback(()=>{if(!f.current||!u.current)return;f.current.fit();const{cols:w,rows:C}=u.current;d.current?.(w,C)},[]);k.useEffect(()=>{if(!l.current||u.current)return;const w=new Oie.Terminal({cursorBlink:!0,fontSize:Math.round(13*vc),fontFamily:"JetBrains Mono Variable, PureNerdFont, Menlo, Monaco, monospace",lineHeight:1.2,theme:v}),C=new Rie.FitAddon,R=new Nie.WebLinksAddon;w.loadAddon(C),w.loadAddon(R),w.open(l.current),u.current=w,f.current=C,requestAnimationFrame(()=>{x(),m.current?.(w),l.current&&y.current?.(l.current)});const O=()=>{S(!0),p.current?.()},N=()=>S(!1);w.textarea&&(w.textarea.addEventListener("focus",O),w.textarea.addEventListener("blur",N));const L=setTimeout(()=>{x(),w.refresh(0,w.rows-1)},100),D=()=>{requestAnimationFrame(x)};window.addEventListener("resize",D);const z=()=>{document.visibilityState==="visible"&&requestAnimationFrame(()=>{x(),w.refresh(0,w.rows-1)})};document.addEventListener("visibilitychange",z);const M=new ResizeObserver(D);M.observe(l.current);const V=new IntersectionObserver(W=>{W[0]?.isIntersecting&&requestAnimationFrame(()=>{x(),w.refresh(0,w.rows-1)})},{threshold:.1});return V.observe(l.current),()=>{clearTimeout(L),window.removeEventListener("resize",D),document.removeEventListener("visibilitychange",z),M.disconnect(),V.disconnect(),w.textarea&&(w.textarea.removeEventListener("focus",O),w.textarea.removeEventListener("blur",N)),S(!1),w.dispose(),u.current=null,f.current=null}},[x,S]),k.useEffect(()=>!l.current||!i||!a?void 0:a(l.current,i),[i,a]),k.useEffect(()=>{u.current&&(u.current.options.theme=v)},[v]);const T=k.useCallback(()=>{u.current?.scrollToBottom()},[]);return b.jsxs("div",{className:"flex h-full w-full max-w-full flex-col",children:[b.jsxs("div",{className:"relative min-h-0 flex-1",children:[b.jsx("div",{ref:l,className:Ue("h-full w-full max-w-full overflow-hidden p-2 bg-terminal-background",e)}),b.jsx("button",{onClick:T,className:Ue("absolute top-2 right-5 p-1 transition-colors",_?"text-white/50 hover:text-white/80":"text-black/50 hover:text-black/80"),children:b.jsx(fe,{icon:cM,size:20,strokeWidth:2})})]}),s&&b.jsx(lS,{onSend:s})]})}function uNe({name:e,status:t,exitCode:n,className:r,onRename:i}){const[a,s]=k.useState(!1),[o,l]=k.useState(e),u=k.useRef(null);k.useEffect(()=>{a&&u.current&&(u.current.focus(),u.current.select())},[a]);const f=()=>{i&&(l(e),s(!0))},d=()=>{const m=o.trim();m&&m!==e&&i&&i(m),s(!1)},p=m=>{m.key==="Enter"?d():m.key==="Escape"&&s(!1)};return b.jsxs("div",{className:Ue("flex h-6 items-center gap-2 border-b border-border bg-card px-2 text-xs",r),children:[b.jsx("span",{className:Ue("h-2 w-2 shrink-0 rounded-full",{"bg-accent":t==="running","bg-muted-foreground":t==="exited"&&n===0,"bg-destructive":t==="exited"&&n!==0||t==="error"})}),a?b.jsx("input",{ref:u,type:"text",value:o,onChange:m=>l(m.target.value),onBlur:d,onKeyDown:p,className:"h-4 w-24 rounded border border-border bg-background px-1 text-xs font-medium text-foreground outline-none focus:border-primary"}):b.jsx("span",{className:Ue("font-medium text-foreground",i&&"cursor-pointer hover:text-primary"),onDoubleClick:f,title:i?"Double-click to rename":void 0,children:e}),t==="exited"&&n!==void 0&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"ml-auto text-muted-foreground",children:"·"}),b.jsxs("span",{className:Ue({"text-muted-foreground":n===0,"text-destructive":n!==0}),children:["exit ",n]})]})]})}function uE({...e}){return b.jsx(MSe,{"data-slot":"dropdown-menu",...e})}function cE({...e}){return b.jsx(FSe,{"data-slot":"dropdown-menu-trigger",...e})}function dE({align:e="start",alignOffset:t=0,side:n="bottom",sideOffset:r=4,className:i,...a}){return b.jsx(wSe,{children:b.jsx(TSe,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:n,sideOffset:r,children:b.jsx(SSe,{"data-slot":"dropdown-menu-content",className:Ue("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 bg-popover text-popover-foreground min-w-32 rounded-lg p-1 shadow-md ring-1 duration-100 z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto outline-none data-closed:overflow-hidden",i),...a})})})}function eo({className:e,inset:t,variant:n="default",...r}){return b.jsx(_Se,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":n,className:Ue("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:text-destructive 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 group/dropdown-menu-item relative flex cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...r})}function hH({...e}){return b.jsx(ASe,{"data-slot":"dropdown-menu-radio-group",...e})}function pH({className:e,children:t,...n}){return b.jsxs(OSe,{"data-slot":"dropdown-menu-radio-item",className:Ue("focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground min-h-7 gap-2 rounded-md py-1.5 pr-8 pl-2 text-xs [&_svg:not([class*='size-'])]:size-3.5 relative flex cursor-default items-center outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...n,children:[b.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center pointer-events-none","data-slot":"dropdown-menu-radio-item-indicator",children:b.jsx(RSe,{children:b.jsx(fe,{icon:hl,strokeWidth:2})})}),t]})}const cNe="";function Lie(){return zn({mutationFn:async e=>{const t=await fetch(`${cNe}/api/git/sync`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Sync failed")}return t.json()}})}const dNe="";function Pie(){return zn({mutationFn:async e=>{const t=await fetch(`${dNe}/api/git/merge-to-main`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Merge failed")}return t.json()}})}const fNe="";function Mie(){return zn({mutationFn:async e=>{const t=await fetch(`${fNe}/api/git/push`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Push failed")}return t.json()}})}const hNe="";function jie(){return zn({mutationFn:async e=>{const t=await fetch(`${hNe}/api/git/sync-parent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const n=await t.json();throw new Error(n.error||"Sync parent failed")}return t.json()}})}const pNe="";function Fie(){return zn({mutationFn:async e=>{const t=await fetch(`${pNe}/api/tasks/${e}/kill-claude`,{method:"POST"});if(!t.ok){const n=await t.json();throw new Error(n.error||"Failed to kill Claude")}return t.json()}})}function mNe({repoPath:e,worktreePath:t,baseBranch:n,taskId:r,isMobile:i,terminalId:a,sendInputToTerminal:s}){const o=Lie(),l=Pie(),u=Mie(),f=jie(),d=NM(),p=Fie(),m=T=>{a&&s?(s(a,T),ln.info("Sent to Claude Code")):ln.error("No terminal available")},y=async()=>{try{await o.mutateAsync({repoPath:e,worktreePath:t,baseBranch:n}),ln.success("Synced from main")}catch(T){const w=T instanceof Error?T.message:"Sync failed",C=n||"main";ln.error(w,{action:a&&s?{label:"Resolve with Claude",onClick:()=>m(`Rebase this worktree onto the parent repo's ${C} branch. Error: "${w}". Steps: 1) Check for uncommitted changes - stash or commit them first, 2) git fetch origin (in parent repo at ${e}) to ensure ${C} is current, 3) git rebase ${C} (in worktree), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) If stashed, git stash pop. Worktree: ${t}, Parent repo: ${e}.`)}:void 0})}},S=async()=>{try{await l.mutateAsync({repoPath:e,worktreePath:t,baseBranch:n}),ln.success("Merged to main"),p.mutate(r),d.mutate({taskId:r,updates:{status:"DONE"}})}catch(T){const w=T instanceof Error?T.message:"Merge failed",C=n||"main";ln.error(w,{action:a&&s?{label:"Resolve with Claude",onClick:()=>m(`Merge this worktree's branch into the parent repo's ${C}. Error: "${w}". Steps: 1) Ensure all changes in worktree are committed, 2) In parent repo at ${e}, checkout ${C} and pull latest from origin, 3) Squash merge the worktree branch into ${C} (use git merge --squash, then commit), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Push ${C} to origin. Worktree: ${t}, Parent repo: ${e}.`)}:void 0})}},g=async()=>{try{await u.mutateAsync({worktreePath:t}),ln.success("Pushed to origin")}catch(T){const w=T instanceof Error?T.message:"Push failed";ln.error(w,{action:a&&s?{label:"Resolve with Claude",onClick:()=>m(`Push this worktree's branch to origin. Error: "${w}". Steps: 1) Check for uncommitted changes and commit them, 2) If push is rejected, pull the latest changes first and resolve any conflicts, 3) Push to origin again. Worktree: ${t}.`)}:void 0})}},_=async()=>{try{await f.mutateAsync({repoPath:e,baseBranch:n}),ln.success("Parent synced with origin")}catch(T){const w=T instanceof Error?T.message:"Sync parent failed",C=n||"main";ln.error(w,{action:a&&s?{label:"Resolve with Claude",onClick:()=>m(`Sync the parent repo's ${C} branch with origin. Error: "${w}". Steps: 1) git fetch origin, 2) git pull origin ${C} --ff-only, 3) If that fails, rebase with git rebase origin/${C}, 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Once in sync, git push origin ${C}. Work in the parent repo at ${e}, not the worktree.`)}:void 0})}},v=()=>{a&&s&&s(a,"commit")},x=o.isPending||l.isPending||u.isPending||f.isPending;return i?b.jsxs(uE,{children:[b.jsx(cE,{className:"flex h-5 w-5 items-center justify-center rounded text-muted-foreground hover:text-foreground",children:b.jsx(fe,{icon:F1e,size:12,strokeWidth:2,className:x?"animate-pulse":""})}),b.jsxs(dE,{align:"end",children:[b.jsxs(eo,{onClick:y,disabled:o.isPending,children:[b.jsx(fe,{icon:HE,size:12,strokeWidth:2,className:o.isPending?"animate-spin":""}),"Pull from main"]}),b.jsxs(eo,{onClick:S,disabled:l.isPending,children:[b.jsx(fe,{icon:zE,size:12,strokeWidth:2,className:l.isPending?"animate-pulse":""}),"Merge to main"]}),b.jsxs(eo,{onClick:g,disabled:u.isPending,children:[b.jsx(fe,{icon:WE,size:12,strokeWidth:2,className:u.isPending?"animate-pulse":""}),"Push to origin"]}),b.jsxs(eo,{onClick:_,disabled:f.isPending,children:[b.jsx(fe,{icon:GE,size:12,strokeWidth:2,className:f.isPending?"animate-spin":""}),"Sync parent with origin"]}),a&&s&&b.jsxs(eo,{onClick:v,children:[b.jsx(fe,{icon:VE,size:12,strokeWidth:2}),"Commit"]})]})]}):b.jsxs(b.Fragment,{children:[b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:y,disabled:o.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Pull from main",children:b.jsx(fe,{icon:HE,size:12,strokeWidth:2,className:o.isPending?"animate-spin":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:S,disabled:l.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Merge to main",children:b.jsx(fe,{icon:zE,size:12,strokeWidth:2,className:l.isPending?"animate-pulse":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:g,disabled:u.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Push to origin",children:b.jsx(fe,{icon:WE,size:12,strokeWidth:2,className:u.isPending?"animate-pulse":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:_,disabled:f.isPending,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Sync parent with origin",children:b.jsx(fe,{icon:GE,size:12,strokeWidth:2,className:f.isPending?"animate-spin":""})}),a&&s&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:v,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:"Commit",children:b.jsx(fe,{icon:VE,size:12,strokeWidth:2})})]})}function gNe({terminals:e,activeIndex:t,onSelect:n,taskInfoByCwd:r}){const i=k.useRef(null),a=k.useRef(null);k.useEffect(()=>{a.current&&i.current&&a.current.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[t]);const s=(o,l)=>{if(o.cwd&&r){const u=r.get(o.cwd);if(u)return u.title}return o.name||`Terminal ${l+1}`};return b.jsx("div",{ref:i,className:"flex shrink-0 gap-1 overflow-x-auto border-b border-border bg-card px-2 py-1.5",style:{WebkitOverflowScrolling:"touch"},children:e.map((o,l)=>{const u=l===t,f=s(o,l);return b.jsx("button",{ref:u?a:null,onClick:()=>n(l),className:Ue("shrink-0 rounded-md px-3 py-1.5 text-xs font-medium transition-colors touch-manipulation","max-w-[150px] truncate",u?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-muted/80"),children:f},o.id)})})}function Vb({worktreePath:e}){const{data:t,isLoading:n}=Gxe(e);if(!e||n||!t)return null;if(t.clean)return b.jsxs(co,{className:"bg-accent/20 text-accent border-transparent",children:[b.jsx(fe,{icon:hl,size:12,strokeWidth:2}),"Clean"]});const r=t.files.length;return b.jsxs(co,{className:"bg-amber-500/20 text-amber-600 dark:text-amber-400 border-transparent",children:[b.jsx(fe,{icon:ts,size:12,strokeWidth:2}),r," ",r===1?"change":"changes"]})}const bNe=n0(function({terminal:t,taskInfo:n,isMobile:r,onClose:i,onReady:a,onResize:s,onRename:o,onContainerReady:l,setupImagePaste:u,onFocus:f,sendInputToTerminal:d,isMaximized:p,onMaximize:m,onMinimize:y,canMaximize:S}){const g=Mm(),{resolvedTheme:_}=qc(),v=_==="dark",x=IM(),T=n?g.terminals.get(t.id):null,w=T?.isStartingUp??!1,C=()=>{n&&x.mutate({taskId:n.taskId,deleteLinkedWorktree:!0})};return k.useEffect(()=>{n&&At.terminal.info("TerminalPane isStartingUp check",{terminalId:t.id,hasTaskInfo:!!n,hasTerminalModel:!!T,isStartingUp:T?.isStartingUp,isStartingClaude:w})},[t.id,n,T,w,T?.isStartingUp]),b.jsxs("div",{className:"flex h-full min-w-0 flex-col overflow-hidden",children:[b.jsx("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-card",children:n?b.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 px-2 py-1",children:[b.jsxs(wi,{to:"/tasks/$taskId",params:{taskId:n.taskId},className:"flex items-center gap-1.5 rounded px-2 py-0.5 text-xs font-medium text-primary hover:bg-primary/10 truncate",children:[b.jsx(fe,{icon:hM,size:14,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate",children:n.title})]}),!r&&b.jsxs(b.Fragment,{children:[b.jsxs(wi,{to:n.repoId?"/repositories/$repoId":"/repositories",params:n.repoId?{repoId:n.repoId}:void 0,className:"flex items-center gap-1 text-xs font-medium text-foreground shrink-0 cursor-pointer hover:underline",children:[b.jsx(fe,{icon:np,size:12,strokeWidth:2,className:"shrink-0"}),n.repoName]}),t.cwd&&b.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground truncate",children:[b.jsx(fe,{icon:Vx,size:12,strokeWidth:2,className:"shrink-0"}),t.cwd.split("/").pop()]})]}),b.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[b.jsx(Vb,{worktreePath:n.worktreePath}),b.jsx(mNe,{repoPath:n.repoPath,worktreePath:n.worktreePath,baseBranch:n.baseBranch,taskId:n.taskId,isMobile:r,terminalId:t.id,sendInputToTerminal:d}),b.jsxs(go,{children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-xs",className:"h-5 w-5 text-muted-foreground hover:text-destructive",title:"Delete task",disabled:x.isPending}),children:b.jsx(fe,{icon:$c,size:12,strokeWidth:2})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:"Delete Task"}),b.jsx(So,{children:"This will permanently delete this task and its worktree."})]}),b.jsxs(_o,{children:[b.jsx(xo,{children:"Cancel"}),b.jsx(Rv,{onClick:C,variant:"destructive",disabled:x.isPending,children:x.isPending?"Deleting...":"Delete"})]})]})]})]})]}):b.jsxs(b.Fragment,{children:[b.jsx(uNe,{name:t.name,status:t.status,exitCode:t.exitCode,className:"flex-1 border-b-0",onRename:o}),b.jsxs("div",{className:"flex items-center gap-1 mr-1",children:[S&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:p?y:m,className:"h-5 w-5 text-muted-foreground hover:text-foreground",title:p?"Restore":"Maximize",children:b.jsx(fe,{icon:p?E1e:j1e,size:12,strokeWidth:2})}),i&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:i,className:"h-5 w-5 text-muted-foreground hover:text-foreground",children:b.jsx(fe,{icon:ci,size:12,strokeWidth:2})})]})]})}),b.jsxs("div",{className:"relative min-h-0 min-w-0 flex-1",children:[b.jsx(vD,{onReady:a,onResize:s,onContainerReady:l,terminalId:t.id,setupImagePaste:u,onFocus:f}),w&&b.jsx("div",{className:"pointer-events-auto absolute inset-0 z-10 flex items-center justify-center bg-terminal-background/90",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:Ue("animate-spin",v?"text-white/60":"text-black/60")}),b.jsx("span",{className:Ue("font-mono text-sm",v?"text-white/60":"text-black/60"),children:"Starting Claude Code..."})]})})]})]})});function vNe({onAdd:e}){return b.jsx("div",{className:"flex h-full items-center justify-center bg-terminal-background",children:e?b.jsxs(Ke,{variant:"outline",size:"sm",onClick:e,className:"gap-2",children:[b.jsx(fe,{icon:Ev,size:14,strokeWidth:2}),"New Terminal"]}):b.jsx("p",{className:"text-xs text-muted-foreground",children:"No terminals"})})}function yNe(e){return e<=1?{rows:1,cols:1}:e<=2?{rows:1,cols:2}:e<=4?{rows:2,cols:2}:e<=6?{rows:2,cols:3}:e<=9?{rows:3,cols:3}:{rows:3,cols:4}}function _Ne({terminals:e,onTerminalClose:t,onTerminalAdd:n,onTerminalReady:r,onTerminalResize:i,onTerminalRename:a,onTerminalContainerReady:s,setupImagePaste:o,writeToTerminal:l,sendInputToTerminal:u,taskInfoByCwd:f}){const d=pw(),[p,m]=k.useState(e.length>0?e[0].id:null),[y,S]=k.useState(0),[g,_]=k.useState(null);if(k.useEffect(()=>{y>=e.length&&e.length>0&&S(e.length-1)},[e.length,y]),k.useEffect(()=>{g&&!e.find(O=>O.id===g)&&_(null)},[e,g]),e.length===0)return b.jsx(vNe,{onAdd:n});const{rows:v,cols:x}=yNe(e.length),T=[];for(let O=0;O<v;O++){const N=O*x,L=Math.min(N+x,e.length);N<e.length&&T.push(e.slice(N,L))}const w=O=>{const N=d&&e.length>1?e[y]?.id:p;N&&l&&l(N,O)},C=O=>{const N=O.cwd?f?.get(O.cwd):void 0,L=!N&&e.length>1;return b.jsx(bNe,{terminal:O,taskInfo:N,isMobile:d,onClose:t?()=>t(O.id):void 0,onReady:r?D=>r(O.id,D):void 0,onResize:i?(D,z)=>i(O.id,D,z):void 0,onRename:a?D=>a(O.id,D):void 0,onContainerReady:s?D=>s(O.id,D):void 0,setupImagePaste:o,onFocus:()=>m(O.id),sendInputToTerminal:u,isMaximized:g===O.id,onMaximize:()=>_(O.id),onMinimize:()=>_(null),canMaximize:L})},R=O=>b.jsxs("div",{className:"flex h-full w-full flex-col",children:[b.jsx("div",{className:"min-h-0 flex-1",children:O}),d&&l&&b.jsx(lS,{onSend:w})]});if(d&&e.length>1){const O=e[y]??e[0];return b.jsxs("div",{className:"flex h-full w-full flex-col",children:[b.jsx(gNe,{terminals:e,activeIndex:y,onSelect:S,taskInfoByCwd:f}),b.jsx("div",{className:"min-h-0 flex-1",children:C(O)},O.id),l&&b.jsx(lS,{onSend:w})]})}if(e.length===1)return R(b.jsx("div",{className:"h-full w-full max-w-full min-w-0 overflow-hidden",children:C(e[0])},e[0].id));if(g){const O=e.find(N=>N.id===g);if(O)return R(b.jsx("div",{className:"h-full w-full max-w-full min-w-0 overflow-hidden",children:C(O)},O.id))}return e.length===2?R(b.jsxs(Vd,{direction:d?"vertical":"horizontal",className:"h-full max-w-full",children:[b.jsx(Ss,{defaultSize:50,minSize:15,children:C(e[0])},e[0].id),b.jsx(Gd,{}),b.jsx(Ss,{defaultSize:50,minSize:15,children:C(e[1])},e[1].id)]})):e.length===3?R(b.jsxs(Vd,{direction:"horizontal",className:"h-full max-w-full",children:[b.jsx(Ss,{defaultSize:50,minSize:15,children:C(e[0])},e[0].id),b.jsx(Gd,{}),b.jsx(Ss,{defaultSize:50,minSize:15,children:b.jsxs(Vd,{direction:"vertical",className:"h-full max-w-full",children:[b.jsx(Ss,{defaultSize:50,minSize:15,children:C(e[1])},e[1].id),b.jsx(Gd,{}),b.jsx(Ss,{defaultSize:50,minSize:15,children:C(e[2])},e[2].id)]})})]})):R(b.jsx(Vd,{direction:"vertical",className:"h-full max-w-full",children:T.map((O,N)=>b.jsxs(k.Fragment,{children:[N>0&&b.jsx(Gd,{}),b.jsx(Ss,{defaultSize:100/T.length,minSize:15,children:O.length===1?C(O[0]):b.jsx(Vd,{direction:"horizontal",className:"h-full max-w-full",children:O.map((L,D)=>b.jsxs(k.Fragment,{children:[D>0&&b.jsx(Gd,{}),b.jsx(Ss,{defaultSize:100/x,minSize:15,children:C(L)})]},L.id))})})]},`row-${N}`))}))}function ENe(e){if(Array.isArray(e))return e}function SNe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,s,o=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(l=(r=a.call(n)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(f){u=!0,i=f}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function yD(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Bie(e,t){if(e){if(typeof e=="string")return yD(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?yD(e,t):void 0}}function xNe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
40
40
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Uie(e,t){return ENe(e)||SNe(e,t)||Bie(e,t)||xNe()}var Nk={},sb={},mH;function $ie(){if(mH)return sb;mH=1,Object.defineProperty(sb,"__esModule",{value:!0}),sb.bind=void 0;function e(t,n){var r=n.type,i=n.listener,a=n.options;return t.addEventListener(r,i,a),function(){t.removeEventListener(r,i,a)}}return sb.bind=e,sb}var Md={},gH;function wNe(){if(gH)return Md;gH=1;var e=Md&&Md.__assign||function(){return e=Object.assign||function(a){for(var s,o=1,l=arguments.length;o<l;o++){s=arguments[o];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(a[u]=s[u])}return a},e.apply(this,arguments)};Object.defineProperty(Md,"__esModule",{value:!0}),Md.bindAll=void 0;var t=$ie();function n(a){if(!(typeof a>"u"))return typeof a=="boolean"?{capture:a}:a}function r(a,s){if(s==null)return a;var o=e(e({},a),{options:e(e({},n(s)),n(a.options))});return o}function i(a,s,o){var l=s.map(function(u){var f=r(u,o);return(0,t.bind)(a,f)});return function(){l.forEach(function(f){return f()})}}return Md.bindAll=i,Md}var bH;function TNe(){return bH||(bH=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bindAll=e.bind=void 0;var t=$ie();Object.defineProperty(e,"bind",{enumerable:!0,get:function(){return t.bind}});var n=wNe();Object.defineProperty(e,"bindAll",{enumerable:!0,get:function(){return n.bindAll}})})(Nk)),Nk}var Hp=TNe(),zie="data-pdnd-honey-pot";function Hie(e){return e instanceof Element&&e.hasAttribute(zie)}function Wie(e){var t=document.elementsFromPoint(e.x,e.y),n=Uie(t,2),r=n[0],i=n[1];return r?Hie(r)?i??null:r:null}function Dv(e){"@babel/helpers - typeof";return Dv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dv(e)}function CNe(e,t){if(Dv(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Dv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ANe(e){var t=CNe(e,"string");return Dv(t)=="symbol"?t:t+""}function r0(e,t,n){return(t=ANe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vie=2147483647;function vH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function yH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?vH(Object(n),!0).forEach(function(r){r0(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Lv=2,_H=Lv/2;function kNe(e){return{x:Math.floor(e.x),y:Math.floor(e.y)}}function ONe(e){return{x:e.x-_H,y:e.y-_H}}function RNe(e){return{x:Math.max(e.x,0),y:Math.max(e.y,0)}}function NNe(e){return{x:Math.min(e.x,window.innerWidth-Lv),y:Math.min(e.y,window.innerHeight-Lv)}}function EH(e){var t=e.client,n=NNe(RNe(ONe(kNe(t))));return DOMRect.fromRect({x:n.x,y:n.y,width:Lv,height:Lv})}function SH(e){var t=e.clientRect;return{left:"".concat(t.left,"px"),top:"".concat(t.top,"px"),width:"".concat(t.width,"px"),height:"".concat(t.height,"px")}}function INe(e){var t=e.client,n=e.clientRect;return t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height}function DNe(e){var t=e.initial,n=document.createElement("div");n.setAttribute(zie,"true");var r=EH({client:t});Object.assign(n.style,yH(yH({backgroundColor:"transparent",position:"fixed",padding:0,margin:0,boxSizing:"border-box"},SH({clientRect:r})),{},{pointerEvents:"auto",zIndex:Vie})),document.body.appendChild(n);var i=Hp.bind(window,{type:"pointermove",listener:function(s){var o={x:s.clientX,y:s.clientY};r=EH({client:o}),Object.assign(n.style,SH({clientRect:r}))},options:{capture:!0}});return function(s){var o=s.current;if(i(),INe({client:o,clientRect:r})){n.remove();return}function l(){u(),n.remove()}var u=Hp.bindAll(window,[{type:"pointerdown",listener:l},{type:"pointermove",listener:l},{type:"focusin",listener:l},{type:"focusout",listener:l},{type:"dragstart",listener:l},{type:"dragenter",listener:l},{type:"dragover",listener:l}],{capture:!0})}}function LNe(){var e=null;function t(){return e=null,Hp.bind(window,{type:"pointermove",listener:function(i){e={x:i.clientX,y:i.clientY}},options:{capture:!0}})}function n(){var r=null;return function(a){var s=a.eventName,o=a.payload;if(s==="onDragStart"){var l=o.location.initial.input,u=e??{x:l.clientX,y:l.clientY};r=DNe({initial:u})}if(s==="onDrop"){var f,d=o.location.current.input;(f=r)===null||f===void 0||f({current:{x:d.clientX,y:d.clientY}}),r=null,e=null}}}return{bindEvents:t,getOnPostDispatch:n}}function PNe(e){if(Array.isArray(e))return yD(e)}function MNe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function jNe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
41
41
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gie(e){return PNe(e)||MNe(e)||Bie(e)||jNe()}function Xf(e){var t=null;return function(){if(!t){for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];var s=e.apply(this,i);t={result:s}}return t.result}}var FNe=Xf(function(){return navigator.userAgent.includes("Firefox")}),i0=Xf(function(){var t=navigator,n=t.userAgent;return n.includes("AppleWebKit")&&!n.includes("Chrome")}),_D={isLeavingWindow:Symbol("leaving"),isEnteringWindow:Symbol("entering")};function BNe(e){var t=e.dragLeave;return i0()?t.hasOwnProperty(_D.isLeavingWindow):!1}(function(){if(typeof window>"u"||!i0())return;function t(){return{enterCount:0,isOverWindow:!1}}var n=t();function r(){n=t()}Hp.bindAll(window,[{type:"dragstart",listener:function(){n.enterCount=0,n.isOverWindow=!0}},{type:"drop",listener:r},{type:"dragend",listener:r},{type:"dragenter",listener:function(a){!n.isOverWindow&&n.enterCount===0&&(a[_D.isEnteringWindow]=!0),n.isOverWindow=!0,n.enterCount++}},{type:"dragleave",listener:function(a){n.enterCount--,n.isOverWindow&&n.enterCount===0&&(a[_D.isLeavingWindow]=!0,n.isOverWindow=!1)}}],{capture:!0})})();function UNe(e){return"nodeName"in e}function $Ne(e){return UNe(e)&&e.ownerDocument!==document}function zNe(e){var t=e.dragLeave,n=t.type,r=t.relatedTarget;return n!=="dragleave"?!1:i0()?BNe({dragLeave:t}):r==null?!0:FNe()?$Ne(r):r instanceof HTMLIFrameElement}function HNe(e){var t=e.onDragEnd;return[{type:"pointermove",listener:(function(){var n=0;return function(){if(n<20){n++;return}t()}})()},{type:"pointerdown",listener:t}]}function Gb(e){return{altKey:e.altKey,button:e.button,buttons:e.buttons,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var WNe=function(t){var n=[],r=null,i=function(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];n=o,!r&&(r=requestAnimationFrame(function(){r=null,t.apply(void 0,n)}))};return i.cancel=function(){r&&(cancelAnimationFrame(r),r=null)},i},Ik=WNe(function(e){return e()}),x_=(function(){var e=null;function t(r){var i=requestAnimationFrame(function(){e=null,r()});e={frameId:i,fn:r}}function n(){e&&(cancelAnimationFrame(e.frameId),e.fn(),e=null)}return{schedule:t,flush:n}})();function VNe(e){var t=e.source,n=e.initial,r=e.dispatchEvent,i={dropTargets:[]};function a(o){r(o),i={dropTargets:o.payload.location.current.dropTargets}}var s={start:function(l){var u=l.nativeSetDragImage,f={current:n,previous:i,initial:n};a({eventName:"onGenerateDragPreview",payload:{source:t,location:f,nativeSetDragImage:u}}),x_.schedule(function(){a({eventName:"onDragStart",payload:{source:t,location:f}})})},dragUpdate:function(l){var u=l.current;x_.flush(),Ik.cancel(),a({eventName:"onDropTargetChange",payload:{source:t,location:{initial:n,previous:i,current:u}}})},drag:function(l){var u=l.current;Ik(function(){x_.flush();var f={initial:n,previous:i,current:u};a({eventName:"onDrag",payload:{source:t,location:f}})})},drop:function(l){var u=l.current,f=l.updatedSourcePayload;x_.flush(),Ik.cancel(),a({eventName:"onDrop",payload:{source:f??t,location:{current:u,previous:i,initial:n}}})}};return s}var ED={isActive:!1};function qie(){return!ED.isActive}function GNe(e){return e.dataTransfer?e.dataTransfer.setDragImage.bind(e.dataTransfer):null}function qNe(e){var t=e.current,n=e.next;if(t.length!==n.length)return!0;for(var r=0;r<t.length;r++)if(t[r].element!==n[r].element)return!0;return!1}function KNe(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=e.dispatchEvent;if(!qie())return;var a=YNe({event:t,dragType:n,getDropTargetsOver:r});ED.isActive=!0;var s={current:a};Dk({event:t,current:a.dropTargets});var o=VNe({source:n.payload,dispatchEvent:i,initial:a});function l(m){var y=qNe({current:s.current.dropTargets,next:m.dropTargets});s.current=m,y&&o.dragUpdate({current:s.current})}function u(m){var y=Gb(m),S=Hie(m.target)?Wie({x:y.clientX,y:y.clientY}):m.target,g=r({target:S,input:y,source:n.payload,current:s.current.dropTargets});g.length&&(m.preventDefault(),Dk({event:m,current:g})),l({dropTargets:g,input:y})}function f(){s.current.dropTargets.length&&l({dropTargets:[],input:s.current.input}),o.drop({current:s.current,updatedSourcePayload:null}),d()}function d(){ED.isActive=!1,p()}var p=Hp.bindAll(window,[{type:"dragover",listener:function(y){u(y),o.drag({current:s.current})}},{type:"dragenter",listener:u},{type:"dragleave",listener:function(y){zNe({dragLeave:y})&&(l({input:s.current.input,dropTargets:[]}),n.startedFrom==="external"&&f())}},{type:"drop",listener:function(y){if(s.current={dropTargets:s.current.dropTargets,input:Gb(y)},!s.current.dropTargets.length){f();return}y.preventDefault(),Dk({event:y,current:s.current.dropTargets}),o.drop({current:s.current,updatedSourcePayload:n.type==="external"?n.getDropPayload(y):null}),d()}},{type:"dragend",listener:function(y){s.current={dropTargets:s.current.dropTargets,input:Gb(y)},f()}}].concat(Gie(HNe({onDragEnd:f}))),{capture:!0});o.start({nativeSetDragImage:GNe(t)})}function Dk(e){var t,n=e.event,r=e.current,i=(t=r[0])===null||t===void 0?void 0:t.dropEffect;i!=null&&n.dataTransfer&&(n.dataTransfer.dropEffect=i)}function YNe(e){var t=e.event,n=e.dragType,r=e.getDropTargetsOver,i=Gb(t);if(n.startedFrom==="external")return{input:i,dropTargets:[]};var a=r({input:i,source:n.payload,target:t.target,current:[]});return{input:i,dropTargets:a}}var xH={canStart:qie,start:KNe},SD=new Map;function XNe(e){var t=e.typeKey,n=e.mount,r=SD.get(t);if(r)return r.usageCount++,r;var i={typeKey:t,unmount:n(),usageCount:1};return SD.set(t,i),i}function ZNe(e){var t=XNe(e);return function(){t.usageCount--,!(t.usageCount>0)&&(t.unmount(),SD.delete(e.typeKey))}}function a0(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(){t.forEach(function(i){return i()})}}function Kie(e,t){var n=t.attribute,r=t.value;return e.setAttribute(n,r),function(){return e.removeAttribute(n)}}function wH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function cc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wH(Object(n),!0).forEach(function(r){r0(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Lk(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=QNe(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
42
42
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||n.return==null||n.return()}finally{if(o)throw a}}}}function QNe(e,t){if(e){if(typeof e=="string")return TH(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?TH(e,t):void 0}}function TH(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Pk(e){return e.slice(0).reverse()}function JNe(e){var t=e.typeKey,n=e.defaultDropEffect,r=new WeakMap,i="data-drop-target-for-".concat(t),a="[".concat(i,"]");function s(m){return r.set(m.element,m),function(){return r.delete(m.element)}}function o(m){var y=a0(Kie(m.element,{attribute:i,value:"true"}),s(m));return Xf(y)}function l(m){var y,S,g,_,v=m.source,x=m.target,T=m.input,w=m.result,C=w===void 0?[]:w;if(x==null)return C;if(!(x instanceof Element))return x instanceof Node?l({source:v,target:x.parentElement,input:T,result:C}):C;var R=x.closest(a);if(R==null)return C;var O=r.get(R);if(O==null)return C;var N={input:T,source:v,element:O.element};if(O.canDrop&&!O.canDrop(N))return l({source:v,target:O.element.parentElement,input:T,result:C});var L=(y=(S=O.getData)===null||S===void 0?void 0:S.call(O,N))!==null&&y!==void 0?y:{},D=(g=(_=O.getDropEffect)===null||_===void 0?void 0:_.call(O,N))!==null&&g!==void 0?g:n,z={data:L,element:O.element,dropEffect:D,isActiveDueToStickiness:!1};return l({source:v,target:O.element.parentElement,input:T,result:[].concat(Gie(C),[z])})}function u(m){var y=m.eventName,S=m.payload,g=Lk(S.location.current.dropTargets),_;try{for(g.s();!(_=g.n()).done;){var v,x=_.value,T=r.get(x.element),w=cc(cc({},S),{},{self:x});T==null||(v=T[y])===null||v===void 0||v.call(T,w)}}catch(C){g.e(C)}finally{g.f()}}var f={onGenerateDragPreview:u,onDrag:u,onDragStart:u,onDrop:u,onDropTargetChange:function(y){var S=y.payload,g=new Set(S.location.current.dropTargets.map(function(q){return q.element})),_=new Set,v=Lk(S.location.previous.dropTargets),x;try{for(v.s();!(x=v.n()).done;){var T,w=x.value;_.add(w.element);var C=r.get(w.element),R=g.has(w.element),O=cc(cc({},S),{},{self:w});if(C==null||(T=C.onDropTargetChange)===null||T===void 0||T.call(C,O),!R){var N;C==null||(N=C.onDragLeave)===null||N===void 0||N.call(C,O)}}}catch(q){v.e(q)}finally{v.f()}var L=Lk(S.location.current.dropTargets),D;try{for(L.s();!(D=L.n()).done;){var z,M,V=D.value;if(!_.has(V.element)){var W=cc(cc({},S),{},{self:V}),$=r.get(V.element);$==null||(z=$.onDropTargetChange)===null||z===void 0||z.call($,W),$==null||(M=$.onDragEnter)===null||M===void 0||M.call($,W)}}}catch(q){L.e(q)}finally{L.f()}}};function d(m){f[m.eventName](m)}function p(m){var y=m.source,S=m.target,g=m.input,_=m.current,v=l({source:y,target:S,input:g});if(v.length>=_.length)return v;for(var x=Pk(_),T=Pk(v),w=[],C=0;C<x.length;C++){var R,O=x[C],N=T[C];if(N!=null){w.push(N);continue}var L=w[C-1],D=x[C-1];if(L?.element!==D?.element)break;var z=r.get(O.element);if(!z)break;var M={input:g,source:y,element:z.element};if(z.canDrop&&!z.canDrop(M)||!((R=z.getIsSticky)!==null&&R!==void 0&&R.call(z,M)))break;w.push(cc(cc({},O),{},{isActiveDueToStickiness:!0}))}return Pk(w)}return{dropTargetForConsumers:o,getIsOver:p,dispatchEvent:d}}function eIe(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=tIe(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
43
43
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||n.return==null||n.return()}finally{if(o)throw a}}}}function tIe(e,t){if(e){if(typeof e=="string")return CH(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?CH(e,t):void 0}}function CH(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function AH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function nIe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?AH(Object(n),!0).forEach(function(r){r0(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rIe(){var e=new Set,t=null;function n(a){t&&(!a.canMonitor||a.canMonitor(t.canMonitorArgs))&&t.active.add(a)}function r(a){var s=nIe({},a);e.add(s),n(s);function o(){e.delete(s),t&&t.active.delete(s)}return Xf(o)}function i(a){var s=a.eventName,o=a.payload;if(s==="onGenerateDragPreview"){t={canMonitorArgs:{initial:o.location.initial,source:o.source},active:new Set};var l=eIe(e),u;try{for(l.s();!(u=l.n()).done;){var f=u.value;n(f)}}catch(g){l.e(g)}finally{l.f()}}if(t){for(var d=Array.from(t.active),p=0,m=d;p<m.length;p++){var y=m[p];if(t.active.has(y)){var S;(S=y[s])===null||S===void 0||S.call(y,o)}}s==="onDrop"&&(t.active.clear(),t=null)}}return{dispatchEvent:i,monitorForConsumers:r}}function iIe(e){var t=e.typeKey,n=e.mount,r=e.dispatchEventToSource,i=e.onPostDispatch,a=e.defaultDropEffect,s=rIe(),o=JNe({typeKey:t,defaultDropEffect:a});function l(d){r?.(d),o.dispatchEvent(d),s.dispatchEvent(d),i?.(d)}function u(d){var p=d.event,m=d.dragType;xH.start({event:p,dragType:m,getDropTargetsOver:o.getIsOver,dispatchEvent:l})}function f(){function d(){var p={canStart:xH.canStart,start:u};return n(p)}return ZNe({typeKey:t,mount:d})}return{registerUsage:f,dropTarget:o.dropTargetForConsumers,monitor:s.monitorForConsumers}}var Yie=Xf(function(){return navigator.userAgent.toLocaleLowerCase().includes("android")}),aIe="pdnd:android-fallback",kH="text/plain",sIe="text/uri-list",oIe="application/vnd.pdnd",uS=new WeakMap;function lIe(e){return uS.set(e.element,e),function(){uS.delete(e.element)}}var OH=LNe(),n3=iIe({typeKey:"element",defaultDropEffect:"move",mount:function(t){return a0(OH.bindEvents(),Hp.bind(document,{type:"dragstart",listener:function(r){var i,a,s,o,l,u;if(t.canStart(r)&&!r.defaultPrevented&&r.dataTransfer){var f=r.target;if(f instanceof HTMLElement){var d=uS.get(f);if(d){var p=Gb(r),m={element:d.element,dragHandle:(i=d.dragHandle)!==null&&i!==void 0?i:null,input:p};if(d.canDrag&&!d.canDrag(m)){r.preventDefault();return}if(d.dragHandle){var y=Wie({x:p.clientX,y:p.clientY});if(!d.dragHandle.contains(y)){r.preventDefault();return}}var S=(a=(s=d.getInitialDataForExternal)===null||s===void 0?void 0:s.call(d,m))!==null&&a!==void 0?a:null;if(S)for(var g=0,_=Object.entries(S);g<_.length;g++){var v=Uie(_[g],2),x=v[0],T=v[1];r.dataTransfer.setData(x,T??"")}Yie()&&!r.dataTransfer.types.includes(kH)&&!r.dataTransfer.types.includes(sIe)&&r.dataTransfer.setData(kH,aIe),r.dataTransfer.setData(oIe,"");var w={element:d.element,dragHandle:(o=d.dragHandle)!==null&&o!==void 0?o:null,data:(l=(u=d.getInitialData)===null||u===void 0?void 0:u.call(d,m))!==null&&l!==void 0?l:{}},C={type:"element",payload:w,startedFrom:"internal"};t.start({event:r,dragType:C})}}}}}))},dispatchEventToSource:function(t){var n,r,i=t.eventName,a=t.payload;(n=uS.get(a.source.element))===null||n===void 0||(r=n[i])===null||r===void 0||r.call(n,a)},onPostDispatch:OH.getOnPostDispatch()}),mw=n3.dropTarget,Xie=n3.monitor;function Zie(e){var t=a0(n3.registerUsage(),lIe(e),Kie(e.element,{attribute:"draggable",value:"true"}));return Xf(t)}function RH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function NH(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?RH(Object(n),!0).forEach(function(r){r0(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RH(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var uIe={top:function(t,n){return Math.abs(n.y-t.top)},right:function(t,n){return Math.abs(t.right-n.x)},bottom:function(t,n){return Math.abs(t.bottom-n.y)},left:function(t,n){return Math.abs(n.x-t.left)}},Qie=Symbol("closestEdge");function Jie(e,t){var n,r,i=t.element,a=t.input,s=t.allowedEdges,o={x:a.clientX,y:a.clientY},l=i.getBoundingClientRect(),u=s.map(function(d){return{edge:d,value:uIe[d](l,o)}}),f=(n=(r=u.sort(function(d,p){return d.value-p.value})[0])===null||r===void 0?void 0:r.edge)!==null&&n!==void 0?n:null;return NH(NH({},e),{},r0({},Qie,f))}function _p(e){var t;return(t=e[Qie])!==null&&t!==void 0?t:null}function cIe({tab:e,isActive:t,canClose:n,onSelect:r,onClose:i,onEdit:a,onReorder:s}){const o=k.useRef(null),[l,u]=k.useState(!1),[f,d]=k.useState(null),p=k.useRef(!1);k.useEffect(()=>{const S=o.current;if(!(!S||!s))return a0(Zie({element:S,getInitialData:()=>({type:"terminal-tab",tabId:e.id,position:e.position}),onDragStart:()=>{u(!0),p.current=!0},onDrop:()=>{u(!1)}}),mw({element:S,getData:({input:g,element:_})=>{const v={type:"terminal-tab",tabId:e.id,position:e.position};return Jie(v,{input:g,element:_,allowedEdges:["left","right"]})},canDrop:({source:g})=>g.data.type==="terminal-tab"&&g.data.tabId!==e.id,onDragEnter:({self:g})=>{d(_p(g.data))},onDrag:({self:g})=>{d(_p(g.data))},onDragLeave:()=>{d(null)},onDrop:({source:g,self:_})=>{d(null);const v=_p(_.data),x=g.data.tabId,T=e.position;let w;v==="left"?w=T:w=T+1,s(x,w)}}))},[e.id,e.position,s]);const m=()=>{p.current=!1},y=()=>{p.current||r(),p.current=!1};return b.jsxs("button",{ref:o,onPointerDown:m,onClick:y,onDoubleClick:a,onContextMenu:S=>{S.preventDefault(),a()},className:Ue("group relative flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs transition-colors max-sm:px-2 max-sm:py-1",t?"bg-background text-foreground":"text-muted-foreground hover:text-foreground","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-foreground after:transition-opacity",t?"after:opacity-100":"after:opacity-0",l&&"opacity-50",s&&"cursor-grab active:cursor-grabbing"),title:e.directory?`${e.name}
44
- ${e.directory}`:e.name,children:[f&&b.jsx("div",{className:Ue("absolute top-0 bottom-0 w-0.5 bg-primary z-10",f==="left"&&"-left-1",f==="right"&&"-right-1")}),e.directory&&b.jsx(fe,{icon:Hi,size:12,strokeWidth:2,className:"shrink-0 opacity-60"}),e.name,n&&b.jsx("button",{onClick:S=>{S.stopPropagation(),i()},onPointerDown:S=>S.stopPropagation(),className:"ml-1 rounded opacity-0 hover:bg-muted group-hover:opacity-100",children:b.jsx(fe,{icon:ci,size:12,strokeWidth:2})})]})}function dIe({tabs:e,activeTabId:t,onTabSelect:n,onTabClose:r,onTabCreate:i,onTabEdit:a,onTabReorder:s}){const o=k.useRef(null),l=k.useRef(null),[u,f]=k.useState(!1),[d,p]=k.useState(!1),[m,y]=k.useState(!0),S=k.useCallback(()=>{const v=o.current;if(!v)return;const{scrollLeft:x,scrollWidth:T,clientWidth:w}=v;f(x>0),p(x+w<T-1)},[]);k.useEffect(()=>{const v=l.current,x=o.current;if(!v||!x)return;const T=new IntersectionObserver(([w])=>{y(w.isIntersecting)},{root:x,threshold:.9});return T.observe(v),()=>T.disconnect()},[]),k.useEffect(()=>{const v=o.current;if(!v)return;S(),v.addEventListener("scroll",S);const x=new ResizeObserver(S);return x.observe(v),()=>{v.removeEventListener("scroll",S),x.disconnect()}},[S]),k.useEffect(()=>{S()},[e,S]);const g=k.useCallback(()=>{o.current?.scrollTo({left:0,behavior:"smooth"})},[]),_=k.useCallback(()=>{const v=o.current;v&&v.scrollTo({left:v.scrollWidth,behavior:"smooth"})},[]);return b.jsxs("div",{className:"flex items-center",children:[u&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:g,className:"shrink-0",children:b.jsx(fe,{icon:Jee,size:14,strokeWidth:2})}),b.jsxs("div",{ref:o,className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-none",children:[e.map(v=>b.jsx(cIe,{tab:v,isActive:v.id===t,canClose:e.length>1,onSelect:()=>n(v.id),onClose:()=>r(v.id),onEdit:()=>a(v),onReorder:s},v.id)),b.jsx("span",{ref:l,children:b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:i,className:"shrink-0",children:b.jsx(fe,{icon:Ev,size:14,strokeWidth:2})})})]}),d&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:_,className:"shrink-0",children:b.jsx(fe,{icon:$y,size:14,strokeWidth:2})}),!m&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:i,className:"shrink-0",children:b.jsx(fe,{icon:Ev,size:14,strokeWidth:2})})]})}function fIe({tab:e,open:t,onOpenChange:n,onSave:r,onCreate:i,defaultName:a=""}){const{t:s}=tn("terminals"),[o,l]=k.useState(""),[u,f]=k.useState(null),[d,p]=k.useState(!1),m=!e&&i;k.useEffect(()=>{t&&(e?(l(e.name),f(e.directory??null)):(l(a),f(null)))},[t,e,a]);const y=()=>{if(m){i(o.trim(),u??void 0),n(!1);return}if(!e)return;const x={};o.trim()&&o.trim()!==e.name&&(x.name=o.trim()),u!==(e.directory??null)&&(x.directory=u),Object.keys(x).length>0&&r(e.id,x),n(!1)},S=x=>{x.key==="Enter"&&(x.preventDefault(),y())},g=()=>{f(null)},_=x=>{f(x)},v=u?u.split("/").pop():null;return b.jsxs(b.Fragment,{children:[b.jsx(ku,{open:t,onOpenChange:n,children:b.jsxs(Ou,{className:"sm:max-w-md",children:[b.jsx(Jc,{children:b.jsx(ed,{children:s(m?"newTab.title":"editTab.title")})}),b.jsxs(pf,{className:"mt-4",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"tabName",children:s("editTab.name")}),b.jsx(vn,{id:"tabName",value:o,onChange:x=>l(x.target.value),onKeyDown:S,placeholder:s("editTab.namePlaceholder"),autoFocus:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:s("editTab.directory")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsxs(Ke,{type:"button",variant:"outline",className:"flex-1 justify-start font-normal",onClick:()=>p(!0),children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2,className:"mr-2 shrink-0"}),v?b.jsx("span",{className:"truncate font-mono text-xs",children:u}):b.jsx("span",{className:"text-muted-foreground",children:s("editTab.directoryPlaceholder")})]}),u&&b.jsx(Ke,{type:"button",variant:"ghost",size:"icon",onClick:g,title:s("editTab.clearDirectory"),children:b.jsx(fe,{icon:ci,size:14,strokeWidth:2})})]})]})]}),b.jsxs(Hf,{className:"mt-4",children:[b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline",type:"button"}),children:s("editTab.cancel")}),b.jsx(Ke,{onClick:y,disabled:!o.trim(),children:s(m?"newTab.create":"editTab.save")})]})]})}),b.jsx(Nm,{open:d,onOpenChange:p,onSelect:_,initialPath:u??void 0})]})}function IH(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode??void 0,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function hIe(e,t){return{id:e.id,name:e.name,layout:"single",position:t,directory:e.directory??void 0}}const Di="all-tasks",DH=["IN_PROGRESS","IN_REVIEW"],LH="vibora:lastTerminalTab",pIe=n0(function(){const{t}=tn("terminals"),n=Wi(),{tab:r,repo:i}=Cx({from:"/terminals/"}),{terminals:a,tabs:s,connected:o,createTerminal:l,destroyTerminal:u,renameTerminal:f,assignTerminalToTab:d,createTab:p,updateTab:m,deleteTab:y,reorderTab:S,attachXterm:g,resizeTerminal:_,setupImagePaste:v,writeToTerminal:x,sendInputToTerminal:T,newTerminalIds:w,pendingTabCreation:C,lastCreatedTabId:R}=aie(),[O,N]=k.useState(null),{getFocusedTerminal:L}=cie(),D=k.useMemo(()=>s.map(pe=>pe.id),[s]),z=r&&(D.includes(r)||r===Di),M=z?r:s[0]?.id??null,V=k.useCallback(pe=>{n({to:"/terminals",search:{tab:pe,repo:pe===Di?i:void 0},replace:!0})},[n,i]),W=k.useCallback(pe=>{n({to:"/terminals",search:ce=>({...ce,repo:pe||void 0}),replace:!0})},[n]),$=Mm();k.useEffect(()=>$M(()=>({lastCreatedTabId:$.lastCreatedTabId,pendingTabCreation:$.pendingTabCreation}),({lastCreatedTabId:ce})=>{ce&&(kt.terminal.info("MobX reaction: lastCreatedTabId changed",{tabId:ce}),V(ce),setTimeout(()=>{$.clearLastCreatedTabId(),ae.current++;const Re=`Terminal ${ae.current}`;kt.terminal.debug("Creating terminal in new tab",{tabId:ce,name:Re}),l({name:Re,cols:80,rows:24,tabId:ce,positionInTab:0})},150))},{fireImmediately:!0}),[$,V,l]),k.useEffect(()=>{if(kt.terminal.debug("Redirect effect running",{tabsLength:s.length,isValidTab:z,pendingTabCreation:C,lastCreatedTabId:R}),s.length!==0&&!(C||R)&&!z){const pe=localStorage.getItem(LH),ce=pe&&(s.some(Re=>Re.id===pe)||pe===Di)?pe:s[0].id;kt.terminal.debug("Redirecting to tab",{targetTab:ce}),n({to:"/terminals",search:{tab:ce},replace:!0})}},[s,z,R,C,n]),k.useEffect(()=>{M&&localStorage.setItem(LH,M)},[M]);const{data:q=[],status:Y}=RM(),{data:B=[]}=Ky(),j=k.useMemo(()=>{const pe=new Map;for(const ce of B)pe.set(ce.path,ce.id);return pe},[B]),U=k.useMemo(()=>new Set(q.filter(pe=>DH.includes(pe.status)&&pe.worktreePath).map(pe=>pe.worktreePath)),[q]),K=k.useMemo(()=>new Set(q.filter(pe=>pe.worktreePath).map(pe=>pe.worktreePath)),[q]),H=k.useMemo(()=>{const pe=new Map;for(const ce of q)ce.worktreePath&&pe.set(ce.worktreePath,{taskId:ce.id,repoId:j.get(ce.repoPath),repoName:ce.repoName,title:ce.title,repoPath:ce.repoPath,worktreePath:ce.worktreePath,baseBranch:ce.baseBranch,branch:ce.branch,prUrl:ce.prUrl});return pe},[q,j]),J=k.useMemo(()=>{const pe=new Set(q.filter(ce=>DH.includes(ce.status)).map(ce=>ce.repoName));return Array.from(pe).sort()},[q]),se=k.useRef(new Map),ae=k.useRef(0),Q=k.useRef(!1),G=k.useRef(!1),Z=k.useMemo(()=>M===Di?a.filter(pe=>pe.cwd&&U.has(pe.cwd)).filter(pe=>i?q.find(Re=>Re.worktreePath===pe.cwd)?.repoName===i:!0).sort((pe,ce)=>{const Re=q.find(ge=>ge.worktreePath===pe.cwd),Pe=q.find(ge=>ge.worktreePath===ce.cwd);return!Re||!Pe?0:new Date(Pe.createdAt).getTime()-new Date(Re.createdAt).getTime()}).map(IH):a.filter(pe=>pe.tabId===M).sort((pe,ce)=>pe.positionInTab-ce.positionInTab).map(IH),[M,a,U,i,q]),ee=k.useCallback(()=>{if(kt.terminal.info("handleTerminalAdd called",{activeTabId:M,connected:o,pendingTerminalCreate:Q.current,terminalCount:a.length}),Q.current){kt.terminal.debug("Skipping terminal creation, already pending");return}Q.current=!0,ae.current++;const pe=`Terminal ${ae.current}`,ce=a.filter(Pe=>Pe.tabId===M),Re=ce.length;kt.terminal.info("Creating terminal",{name:pe,tabId:M,positionInTab:Re,terminalsInTabCount:ce.length}),l({name:pe,cols:80,rows:24,tabId:M??void 0,positionInTab:Re}),setTimeout(()=>{Q.current=!1},500)},[l,M,a,o]);k.useEffect(()=>{if(Y!=="success"){kt.terminalsView.debug("Tab assignment effect skipped",{tasksStatus:Y});return}for(const pe of a)pe.cwd&&K.has(pe.cwd)&&pe.tabId&&(kt.terminalsView.debug("Removing task terminal from regular tab",{terminalId:pe.id,name:pe.name,cwd:pe.cwd,tabId:pe.tabId}),d(pe.id,null))},[a,K,d,Y]);const ne=k.useCallback(pe=>{const ce=se.current.get(pe);ce&&(ce(),se.current.delete(pe)),u(pe,{force:!0,reason:"user_closed"})},[u]),te=k.useCallback((pe,ce)=>{const Re=g(pe,ce);se.current.set(pe,Re),w.has(pe)&&setTimeout(()=>{ce.focus()},50)},[g,w]),be=k.useCallback((pe,ce,Re)=>{_(pe,ce,Re)},[_]),_e=k.useCallback((pe,ce)=>{f(pe,ce)},[f]),he=k.useCallback(()=>{if(G.current){kt.terminal.debug("Skipping tab creation, already pending");return}G.current=!0;const pe=`Tab ${s.length+1}`;kt.terminal.debug("Quick creating tab",{name:pe}),p(pe,void 0,void 0),setTimeout(()=>{G.current=!1},500)},[p,s.length]),ye=k.useCallback((pe,ce)=>{kt.terminal.debug("Reordering tab",{tabId:pe,newPosition:ce}),S(pe,ce)},[S]),Ee=k.useCallback((pe,ce)=>{if(G.current){kt.terminal.debug("Skipping tab creation, already pending");return}G.current=!0,kt.terminal.debug("Creating tab",{name:pe,directory:ce}),p(pe,void 0,ce),setTimeout(()=>{G.current=!1},500)},[p]),xe=k.useCallback(pe=>{const ce=a.filter(Re=>Re.tabId===pe);for(const Re of ce){const Pe=se.current.get(Re.id);Pe&&(Pe(),se.current.delete(Re.id))}y(pe)},[a,y]),ve=s.map(hIe),De=k.useCallback(pe=>{N(pe)},[]),Te=k.useCallback((pe,ce)=>{m(pe,ce)},[m]);return Es("meta+d",ee,{enabled:M!==Di&&o,allowInTerminal:!0,deps:[ee,M,o]}),Es("meta+w",()=>{if(M&&M!==Di){const pe=L(M);pe&&ne(pe)}},{enabled:M!==Di,allowInTerminal:!0,deps:[M,L,ne]}),b.jsxs("div",{className:"flex h-full max-w-full flex-col overflow-hidden",children:[b.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-center justify-between border-b border-border bg-background px-2 py-1",children:[b.jsxs("div",{className:"flex min-w-0 flex-1 items-center",children:[b.jsxs("button",{onClick:()=>V(Di),className:Ue("relative flex shrink-0 items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors max-sm:px-2",M===Di?"bg-primary/10 text-primary":"text-muted-foreground hover:text-primary hover:bg-primary/5","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-primary after:transition-opacity",M===Di?"after:opacity-100":"after:opacity-0"),children:[b.jsx(fe,{icon:Dp,size:12,strokeWidth:2}),b.jsx("span",{className:"max-sm:hidden",children:t("taskTerminals")})]}),b.jsx("div",{className:"mx-2 h-4 w-px shrink-0 bg-border"}),b.jsx("div",{className:"min-w-0 flex-1",children:b.jsx(dIe,{tabs:ve,activeTabId:M??"",onTabSelect:V,onTabClose:xe,onTabCreate:he,onTabEdit:De,onTabReorder:ye})})]}),b.jsxs("div",{className:"flex shrink-0 items-center gap-3 max-sm:gap-1",children:[M===Di&&J.length>1&&b.jsxs(ji,{value:i??"",onValueChange:pe=>W(pe||null),children:[b.jsxs(Bi,{size:"sm",className:"max-sm:w-auto",children:[b.jsx(fe,{icon:ite,size:12,strokeWidth:2,className:"text-muted-foreground"}),b.jsx(Fi,{children:i||t("allRepos")})]}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"",children:t("allRepos")}),J.map(pe=>b.jsx(Cn,{value:pe,children:pe},pe))]})]}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:ee,disabled:!o||M===Di,className:"max-sm:px-2 border-transparent text-primary",children:[b.jsx(fe,{icon:fM,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:t("newTerminal")})]})]})]}),b.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:b.jsx(_Ne,{terminals:Z,onTerminalClose:M===Di?void 0:ne,onTerminalAdd:o&&M!==Di?ee:void 0,onTerminalReady:te,onTerminalResize:be,onTerminalRename:M===Di?void 0:_e,setupImagePaste:v,writeToTerminal:x,sendInputToTerminal:T,taskInfoByCwd:M===Di?H:void 0})}),b.jsx(fIe,{tab:O,open:O!==null,onOpenChange:pe=>{pe||N(null)},onSave:Te,onCreate:Ee,defaultName:`Tab ${s.length+1}`})]})}),mIe=Ms("/terminals/")({component:pIe,validateSearch:e=>({tab:typeof e.tab=="string"?e.tab:void 0,repo:typeof e.repo=="string"?e.repo:void 0})});function gIe(){return{x:0,y:0}}function bIe(e){var t=e.render,n=e.nativeSetDragImage,r=e.getOffset,i=r===void 0?gIe:r,a=document.createElement("div");Object.assign(a.style,{position:"fixed",top:0,left:0,zIndex:Vie,pointerEvents:"none"}),document.body.append(a);var s=t({container:a});queueMicrotask(function(){var u=i({container:a});if(i0()){var f=a.getBoundingClientRect();if(f.width===0)return;a.style.left="-".concat(f.width-1e-4,"px")}n?.(a,u.x,u.y)});function o(){l(),s?.(),document.body.removeChild(a)}var l=Xie({onDragStart:o,onDrop:o})}var vIe=Xf(function(){return i0()&&"ontouchend"in document}),yIe=function(t){var n=t.container,r=n.getBoundingClientRect();return{x:r.width/2,y:r.height/2}};function _Ie(e){return function(n){var r=n.container;if(vIe()||Yie())return yIe({container:r});Object.assign(r.style,{borderInlineStart:"".concat(e.x," solid transparent"),borderTop:"".concat(e.y," solid transparent")});var i=window.getComputedStyle(r);if(i.direction==="rtl"){var a=r.getBoundingClientRect();return{x:a.width,y:0}}return{x:0,y:0}}}const eae=k.createContext(null);function EIe({children:e}){const[t,n]=k.useState(null);return b.jsx(eae.Provider,{value:{activeTask:t,setActiveTask:n},children:e})}function tae(){const e=k.useContext(eae);if(!e)throw new Error("useDrag must be used within DragProvider");return e}const nae=k.createContext(null);function SIe({children:e}){const[t,n]=k.useState(new Set),[r,i]=k.useState(null),a=k.useCallback(u=>{n(f=>{const d=new Set(f);return d.has(u)?d.delete(u):d.add(u),d}),i(u)},[]),s=k.useCallback((u,f)=>{if(!r){n(new Set([u])),i(u);return}const d=f.indexOf(r),p=f.indexOf(u);if(d===-1||p===-1){n(new Set([u])),i(u);return}const[m,y]=d<p?[d,p]:[p,d],S=f.slice(m,y+1);n(g=>{const _=new Set(g);for(const v of S)_.add(v);return _})},[r]),o=k.useCallback(()=>{n(new Set),i(null)},[]),l=k.useCallback(u=>t.has(u),[t]);return b.jsx(nae.Provider,{value:{selectedIds:t,lastSelectedId:r,toggleSelection:a,selectRange:s,clearSelection:o,isSelected:l},children:e})}function r3(){const e=k.useContext(nae);if(!e)throw new Error("useSelection must be used within a SelectionProvider");return e}function xIe(e){return e.match(/\/issue\/([A-Z]+-\d+)/i)?.[1]??null}function rae({task:e,open:t,onOpenChange:n}){const r=NM(),i=IM(),[a,s]=k.useState(e.title),[o,l]=k.useState(!0),[u,f]=k.useState(e.description||""),[d,p]=k.useState(e.prUrl||""),[m,y]=k.useState(e.linearTicketUrl||"");k.useEffect(()=>{t&&(s(e.title),f(e.description||""),p(e.prUrl||""),y(e.linearTicketUrl||""),l(!0))},[t,e]);const S=()=>{const v={},x=a.trim();if(!x)return;x!==e.title&&(v.title=x);const T=u.trim();T!==(e.description||"")&&(v.description=T);const w=d.trim();w!==(e.prUrl||"")&&(v.prUrl=w||null);const C=m.trim();C!==(e.linearTicketUrl||"")&&(v.linearTicketUrl=C||null,v.linearTicketId=C?xIe(C):null),Object.keys(v).length>0&&r.mutate({taskId:e.id,updates:v}),n(!1)},g=v=>{v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),S())},_=()=>{i.mutate({taskId:e.id,deleteLinkedWorktree:o},{onSuccess:()=>{n(!1)}})};return b.jsx(ku,{open:t,onOpenChange:n,children:b.jsxs(Ou,{className:"sm:max-w-md",onKeyDown:g,children:[b.jsx(Jc,{children:b.jsx(ed,{children:"Task Settings"})}),b.jsxs(pf,{className:"mt-4",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-title",children:"Title"}),b.jsx(vn,{id:"config-title",value:a,onChange:v=>s(v.target.value),autoFocus:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-description",children:"Description"}),b.jsx(kte,{id:"config-description",value:u,onValueChange:f,rows:3})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-pr-url",children:"GitHub PR URL"}),b.jsx(vn,{id:"config-pr-url",value:d,onChange:v=>p(v.target.value),placeholder:"https://github.com/owner/repo/pull/123"})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-linear-url",children:"Linear Ticket URL"}),b.jsx(vn,{id:"config-linear-url",value:m,onChange:v=>y(v.target.value),placeholder:"https://linear.app/team/issue/TEAM-123"})]})]}),b.jsxs(Hf,{className:"mt-4 flex-row justify-between sm:justify-between",children:[b.jsxs(go,{children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",className:"text-destructive hover:text-destructive hover:bg-destructive/10",disabled:i.isPending}),children:i.isPending?"Deleting...":"Delete Task"}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:"Delete Task"}),b.jsx(So,{children:"This will permanently delete this task. This action cannot be undone."})]}),b.jsxs("div",{className:"flex items-center gap-2 py-2",children:[b.jsx(Ti,{id:"delete-worktree",checked:o,onCheckedChange:v=>l(v===!0)}),b.jsx("label",{htmlFor:"delete-worktree",className:"text-sm cursor-pointer",children:"Also delete linked worktree"})]}),b.jsxs(_o,{children:[b.jsx(xo,{children:"Cancel"}),b.jsx(Rv,{onClick:_,variant:"destructive",disabled:i.isPending,children:i.isPending?"Deleting...":"Delete"})]})]})]}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(Ke,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),b.jsx(Ke,{onClick:S,disabled:!a.trim(),children:"Save"})]})]})]})})}function iae({task:e,isDragPreview:t}){const{setActiveTask:n}=tae(),{isSelected:r,toggleSelection:i}=r3(),a=Wi(),s=r(e.id),o=k.useRef(null),[l,u]=k.useState(!1),[f,d]=k.useState(null),[p,m]=k.useState(null),[y,S]=k.useState(!1),g=k.useRef(!1);k.useEffect(()=>{const T=o.current;if(!(!T||t))return a0(Zie({element:T,getInitialData:()=>({type:"task",taskId:e.id,status:e.status}),onGenerateDragPreview:({nativeSetDragImage:w})=>{bIe({nativeSetDragImage:w,getOffset:_Ie({x:"16px",y:"8px"}),render:({container:C})=>{m(C)}})},onDragStart:()=>{u(!0),n(e),g.current=!0},onDrop:()=>{u(!1),n(null),m(null)}}),mw({element:T,getData:({input:w,element:C})=>{const R={type:"task",taskId:e.id,status:e.status};return Jie(R,{input:w,element:C,allowedEdges:["top","bottom"]})},canDrop:({source:w})=>w.data.taskId!==e.id,onDragEnter:({self:w})=>{d(_p(w.data))},onDrag:({self:w})=>{d(_p(w.data))},onDragLeave:()=>{d(null)},onDrop:()=>{d(null)}}))},[e,t,n]);const _=()=>{g.current=!1},v=()=>{if(g.current){g.current=!1;return}a({to:"/tasks/$taskId",params:{taskId:e.id}}),g.current=!1},x=b.jsxs("div",{className:"group/card relative",children:[!t&&b.jsx("div",{className:Ue("absolute left-2 top-2 z-20 transition-opacity",s?"opacity-100":"opacity-0 group-hover/card:opacity-100"),onPointerDown:T=>T.stopPropagation(),children:b.jsx(Ti,{checked:s,onCheckedChange:()=>i(e.id)})}),b.jsxs(xa,{ref:t?void 0:o,onPointerDown:_,onClick:v,className:Ue("transition-shadow hover:shadow-md relative cursor-grab active:cursor-grabbing",l&&"opacity-50",s&&"ring-2 ring-primary bg-primary/5"),children:[f&&b.jsx("div",{className:Ue("absolute left-0 right-0 h-0.5 bg-primary z-10",f==="top"&&"-top-1",f==="bottom"&&"-bottom-1")}),b.jsxs(vRe,{className:Ue("p-3 pb-1 flex flex-row items-start justify-between gap-2",!t&&"pl-8"),children:[b.jsx(yRe,{className:"text-sm font-medium leading-tight flex-1",children:e.title}),!t&&b.jsx("button",{type:"button",className:"shrink-0 p-0.5 -m-0.5 rounded hover:bg-muted transition-colors cursor-pointer",onClick:T=>{T.stopPropagation(),S(!0)},onPointerDown:T=>T.stopPropagation(),children:b.jsx(fe,{icon:XI,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),b.jsxs(Df,{className:"p-3 pt-1",children:[e.description&&b.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:e.description}),b.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-muted-foreground/70",children:[b.jsx(fe,{icon:Hi,size:12,strokeWidth:2}),b.jsx("span",{children:e.repoName}),e.prUrl&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/30",children:"•"}),b.jsx(fe,{icon:Ub,size:12,strokeWidth:2,className:"text-foreground"})]}),e.linearTicketId&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/30",children:"•"}),b.jsx(fe,{icon:hM,size:12,strokeWidth:2,className:"text-foreground"})]})]})]})]})]});return b.jsxs(b.Fragment,{children:[x,p&&xr.createPortal(b.jsx("div",{className:"w-72 max-w-[90vw]",children:b.jsx(iae,{task:e,isDragPreview:!0})}),p),b.jsx(rae,{task:e,open:y,onOpenChange:S})]})}const wIe={IN_PROGRESS:"border-t-status-in-progress",IN_REVIEW:"border-t-status-in-review",DONE:"border-t-status-done",CANCELED:"border-t-status-canceled"};function PH({status:e,tasks:t,isMobile:n}){const{t:r}=tn("common"),i=k.useRef(null),[a,s]=k.useState(!1),o=[...t].sort((l,u)=>u.position-l.position);return k.useEffect(()=>{const l=i.current;if(l)return mw({element:l,getData:()=>({type:"column",status:e}),canDrop:({source:u})=>u.data.type==="task",onDragEnter:()=>s(!0),onDragLeave:()=>s(!1),onDrop:()=>s(!1)})},[e]),b.jsxs("div",{ref:i,className:Ue("flex flex-col rounded-lg border border-t-4 bg-card",n?"h-full w-full":"h-full w-72 min-w-52 flex-shrink",wIe[e],a&&"ring-2 ring-primary ring-offset-2 ring-offset-background"),children:[!n&&b.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[b.jsx("h3",{className:"text-sm font-medium",children:r(`statuses.${e}`)}),b.jsx("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-xs font-medium",children:t.length})]}),b.jsx(Yy,{className:"min-h-0 flex-1",children:b.jsx("div",{className:"flex flex-col gap-2 p-2",children:o.map(l=>b.jsx(iae,{task:l},l.id))})})]})}function TIe(){const{selectedIds:e,clearSelection:t}=r3(),n=zxe(),[r,i]=k.useState(!0),a=e.size,s=()=>{n.mutate({ids:Array.from(e),deleteLinkedWorktrees:r},{onSuccess:()=>{t()}})};return a===0?null:b.jsx("div",{className:Ue("fixed inset-x-0 bottom-0 z-40 border-t bg-background/95 backdrop-blur-sm","animate-in slide-in-from-bottom-2 duration-200"),children:b.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between gap-4 px-4 py-3",children:[b.jsxs("span",{className:"text-sm text-muted-foreground",children:[a," task",a!==1?"s":""," selected"]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Ke,{variant:"ghost",size:"sm",onClick:t,children:"Clear"}),b.jsxs(go,{children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"destructive",size:"sm",disabled:n.isPending}),children:n.isPending?"Deleting...":"Delete"}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsxs(Eo,{children:["Delete ",a," Task",a!==1?"s":""]}),b.jsxs(So,{children:["This will permanently delete ",a," task",a!==1?"s":"",". This action cannot be undone."]})]}),b.jsxs("div",{className:"flex items-center gap-2 py-2",children:[b.jsx(Ti,{id:"bulk-delete-worktrees",checked:r,onCheckedChange:o=>i(o===!0)}),b.jsx("label",{htmlFor:"bulk-delete-worktrees",className:"cursor-pointer text-sm",children:"Also delete linked worktrees"})]}),b.jsxs(_o,{children:[b.jsx(xo,{children:"Cancel"}),b.jsx(Rv,{onClick:s,variant:"destructive",disabled:n.isPending,children:n.isPending?"Deleting...":"Delete"})]})]})]})]})]})})}const Mk=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED"];function CIe({status:e}){const{t}=tn("common"),n=k.useRef(null),[r,i]=k.useState(!1);return k.useEffect(()=>{const a=n.current;if(a)return mw({element:a,getData:()=>({type:"column",status:e}),canDrop:({source:s})=>s.data.type==="task",onDragEnter:()=>i(!0),onDragLeave:()=>i(!1),onDrop:()=>i(!1)})},[e]),b.jsx("div",{ref:n,className:Ue("flex-1 rounded-lg border-2 border-dashed px-3 py-2 text-center text-xs font-medium transition-colors",r?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground"),children:t(`statuses.${e}`)})}function AIe({repoFilter:e,searchQuery:t}){const{t:n}=tn("common"),{data:r=[],isLoading:i}=RM(),a=$xe(),{activeTask:s}=tae(),{clearSelection:o,selectedIds:l}=r3(),[u,f]=k.useState("IN_PROGRESS");k.useEffect(()=>{const m=y=>{y.key==="Escape"&&l.size>0&&o()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[o,l.size]);const d=k.useMemo(()=>{let m=r;return e&&(m=m.filter(y=>y.repoName===e)),t?.trim()?m=m.map(y=>({task:y,score:Math.max(no(y.title,t),no(y.description||"",t),no(y.branch||"",t),no(y.linearTicketId||"",t),no(y.prUrl||"",t))})).filter(({score:y})=>y>0).sort((y,S)=>S.score-y.score).map(({task:y})=>y):m=[...m].sort((y,S)=>new Date(S.createdAt).getTime()-new Date(y.createdAt).getTime()),m},[r,e,t]),p=k.useMemo(()=>{const m={IN_PROGRESS:0,IN_REVIEW:0,DONE:0,CANCELED:0};for(const y of d)m[y.status]++;return m},[d]);return k.useEffect(()=>Xie({canMonitor:({source:m})=>m.data.type==="task",onDrop:({source:m,location:y})=>{const S=y.current.dropTargets;if(S.length===0)return;const g=m.data.taskId,_=d.find(T=>T.id===g);if(!_)return;const v=S[0],x=v.data;if(x.type==="column"){const T=x.status;if(T!==_.status){const w=d.filter(C=>C.status===T);a.mutate({taskId:g,status:T,position:w.length})}}else if(x.type==="task"){const T=_p(v.data),w=x.status,C=d.filter(N=>N.status===w).sort((N,L)=>N.position-L.position),R=C.findIndex(N=>N.id===x.taskId);let O=R;T==="bottom"&&(O=R+1),_.status===w&&C.findIndex(L=>L.id===g)<R&&(O=Math.max(0,O-1)),(_.status!==w||O!==_.position)&&a.mutate({taskId:g,status:w,position:O})}}}),[d,a]),i?b.jsx("div",{className:"flex h-full items-center justify-center",children:b.jsx("p",{className:"text-muted-foreground",children:"Loading tasks..."})}):b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"border-b bg-background lg:hidden",children:b.jsx(su,{value:u,onValueChange:m=>f(m),children:b.jsx(ou,{variant:"line",className:"w-full justify-start px-4",children:Mk.map(m=>b.jsxs(li,{value:m,className:"gap-1.5",children:[b.jsx("span",{className:"truncate",children:n(`statuses.${m}`)}),b.jsx("span",{className:"text-muted-foreground",children:p[m]})]},m))})})}),b.jsx("div",{className:"hidden h-full justify-center gap-4 overflow-x-auto p-4 lg:flex",children:Mk.map(m=>b.jsx(PH,{status:m,tasks:d.filter(y=>y.status===m)},m))}),b.jsx("div",{className:"flex-1 overflow-y-auto p-4 lg:hidden",children:b.jsx(PH,{status:u,tasks:d.filter(m=>m.status===u),isMobile:!0})}),s&&b.jsx("div",{className:"fixed inset-x-0 bottom-0 flex gap-2 border-t bg-background/95 p-4 backdrop-blur-sm lg:hidden",children:Mk.filter(m=>m!==u).map(m=>b.jsx(CIe,{status:m},m))}),b.jsx(TIe,{})]})}function kIe(e){return b.jsx(SIe,{children:b.jsx(EIe,{children:b.jsx(AIe,{...e})})})}const aae=Ms("/tasks/")({component:OIe,validateSearch:e=>({repo:typeof e.repo=="string"?e.repo:void 0})});function OIe(){const{t:e}=tn("tasks"),{data:t=[]}=RM(),{repo:n}=aae.useSearch(),r=Wi(),[i,a]=k.useState(""),s=k.useCallback(l=>{r({to:"/tasks",search:l?{repo:l}:{},replace:!0})},[r]),o=k.useMemo(()=>{const l=new Set(t.map(u=>u.repoName));return Array.from(l).sort()},[t]);return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"relative min-w-0 flex-1 sm:max-w-64 sm:flex-none",children:[b.jsx(fe,{icon:Gx,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(vn,{value:i,onChange:l=>a(l.target.value),placeholder:e("searchPlaceholder"),className:"w-full pl-6"})]}),b.jsxs(ji,{value:n??"",onValueChange:l=>s(l||null),children:[b.jsxs(Bi,{size:"sm",className:"shrink-0 gap-1.5",children:[b.jsx(fe,{icon:ite,size:12,strokeWidth:2,className:"text-muted-foreground"}),b.jsx(Fi,{children:n??e("allRepos")})]}),b.jsxs(Ui,{className:"min-w-[160px]",children:[b.jsx(Cn,{value:"",children:e("allRepos")}),o.map(l=>b.jsx(Cn,{value:l,children:l},l))]})]})]}),b.jsx("div",{className:"flex-1 overflow-hidden",children:b.jsx(kIe,{repoFilter:n??null,searchQuery:i})})]})}function zo({className:e,size:t="default",...n}){return b.jsx(ixe,{"data-slot":"switch","data-size":t,className:Ue("data-checked:bg-primary data-unchecked:bg-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 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:b.jsx(axe,{"data-slot":"switch-thumb",className:"bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform"})})}const RIe=Ms("/settings/")({component:NIe});function dc({title:e,children:t}){return b.jsxs("div",{className:"relative rounded-lg border border-border bg-card p-4 pt-6",children:[b.jsx("span",{className:"absolute -top-2.5 left-3 rounded bg-card px-2 text-xs font-medium text-muted-foreground",children:e}),t]})}function NIe(){const{t:e}=tn("settings"),{t}=tn("common"),{data:n,isLoading:r}=Tne(),{data:i,isLoading:a}=qy(),{data:s,isLoading:o}=DM(),{data:l,isLoading:u}=LM(),{data:f,isLoading:d}=PM(),{data:p,isLoading:m}=Xxe(),{data:y,isLoading:S}=Zxe(),{data:g,isLoading:_}=rwe(),{data:v,isLoading:x}=swe(),{data:T}=Ane(),w=lwe(),{savedLanguage:C,changeLanguage:R}=Rne(),{theme:O,syncClaudeCode:N,changeTheme:L}=uie(),{data:D}=ewe(),{data:z}=twe(),M=Cne(),V=nwe(),W=iwe(),$=owe(),q=awe(),[Y,B]=k.useState(""),[j,U]=k.useState(""),[K,H]=k.useState("vscode"),[J,se]=k.useState(""),[ae,Q]=k.useState(""),[G,Z]=k.useState(""),[ee,ne]=k.useState(""),[te,be]=k.useState(!1),[_e,he]=k.useState(!1),[ye,Ee]=k.useState(!1),[xe,ve]=k.useState(!1),[De,Te]=k.useState(!1),[pe,ce]=k.useState(""),[Re,Pe]=k.useState(!1),[ge,Le]=k.useState(""),[Ce,Ve]=k.useState(!1),[Ze,gt]=k.useState(""),[st,ot]=k.useState(""),[Fe,ht]=k.useState(!1),[Ne,ze]=k.useState(""),[et,lt]=k.useState("glm-4.5-air"),[pt,gn]=k.useState("glm-4.7"),[Ft,Nt]=k.useState("glm-4.7"),[ct,nn]=k.useState(!1),[Lt,yt]=k.useState("light-ansi"),[Bt,Ut]=k.useState("dark-ansi"),[zt,ft]=k.useState(!1),[yn,mr]=k.useState(!1),[Vr,Pr]=k.useState(!1),Ki=k.useRef(null);k.useEffect(()=>{n!==void 0&&B(String(n)),i!==void 0&&U(i),s!==void 0&&H(s),l!==void 0&&se(l),f!==void 0&&Q(String(f)),p!==void 0&&Z(p),y!==void 0&&ne(y)},[n,i,s,l,f,p,y]),k.useEffect(()=>{g&&(Ee(g.enabled),ve(g.sound?.enabled??!1),mr(!!g.sound?.customSoundFile),Te(g.slack?.enabled??!1),ce(g.slack?.webhookUrl??""),Pe(g.discord?.enabled??!1),Le(g.discord?.webhookUrl??""),Ve(g.pushover?.enabled??!1),gt(g.pushover?.appToken??""),ot(g.pushover?.userKey??""))},[g]),k.useEffect(()=>{v&&(ht(v.enabled),ze(v.apiKey??""),lt(v.haikuModel),gn(v.sonnetModel),Nt(v.opusModel))},[v]),k.useEffect(()=>{N!==void 0&&nn(N),D!==void 0&&yt(D),z!==void 0&&Ut(z)},[N,D,z]);const Kt=r||a||o||u||d||m||S||_||x,Ri=v&&(Fe!==v.enabled||Ne!==(v.apiKey??"")||et!==v.haikuModel||pt!==v.sonnetModel||Ft!==v.opusModel),gr=ct!==(N??!1)||Lt!==D||Bt!==z,br=g&&(ye!==g.enabled||xe!==(g.sound?.enabled??!1)||De!==(g.slack?.enabled??!1)||pe!==(g.slack?.webhookUrl??"")||Re!==(g.discord?.enabled??!1)||ge!==(g.discord?.webhookUrl??"")||Ce!==(g.pushover?.enabled??!1)||Ze!==(g.pushover?.appToken??"")||st!==(g.pushover?.userKey??"")),ss=K!==s||J!==l||ae!==String(f),Yi=Y!==String(n)||j!==i||G!==p||ee!==y||ss||br||Ri||gr,Ws=async()=>{const Ge=[];if(Y!==String(n)){const Rt=parseInt(Y,10);!isNaN(Rt)&&Rt>=1&&Rt<=65535&&Ge.push(new Promise(Cr=>{M.mutate({key:In.PORT,value:Rt},{onSettled:Cr})}))}if(j!==i&&Ge.push(new Promise(Rt=>{M.mutate({key:In.DEFAULT_GIT_REPOS_DIR,value:j},{onSettled:Rt})})),K!==s&&Ge.push(new Promise(Rt=>{M.mutate({key:In.EDITOR_APP,value:K},{onSettled:Rt})})),J!==l&&Ge.push(new Promise(Rt=>{M.mutate({key:In.EDITOR_HOST,value:J},{onSettled:Rt})})),ae!==String(f)){const Rt=parseInt(ae,10);!isNaN(Rt)&&Rt>=1&&Rt<=65535&&Ge.push(new Promise(Cr=>{M.mutate({key:In.EDITOR_SSH_PORT,value:Rt},{onSettled:Cr})}))}G!==p&&Ge.push(new Promise(Rt=>{M.mutate({key:In.LINEAR_API_KEY,value:G},{onSettled:Rt})})),ee!==y&&Ge.push(new Promise(Rt=>{M.mutate({key:In.GITHUB_PAT,value:ee},{onSettled:Rt})})),br&&Ge.push(new Promise(Rt=>{W.mutate({enabled:ye,sound:{enabled:xe},slack:{enabled:De,webhookUrl:pe},discord:{enabled:Re,webhookUrl:ge},pushover:{enabled:Ce,appToken:Ze,userKey:st}},{onSettled:Rt})})),Ri&&Ge.push(new Promise(Rt=>{$.mutate({enabled:Fe,apiKey:Ne||null,haikuModel:et,sonnetModel:pt,opusModel:Ft},{onSettled:Rt})})),gr&&(ct!==(N??!1)&&Ge.push(new Promise(Rt=>{M.mutate({key:In.SYNC_CLAUDE_CODE_THEME,value:ct},{onSettled:Rt})})),Lt!==D&&Ge.push(new Promise(Rt=>{M.mutate({key:In.CLAUDE_CODE_LIGHT_THEME,value:Lt},{onSettled:Rt})})),Bt!==z&&Ge.push(new Promise(Rt=>{M.mutate({key:In.CLAUDE_CODE_DARK_THEME,value:Bt},{onSettled:Rt})}))),await Promise.all(Ge),he(!0),setTimeout(()=>he(!1),2e3)},ig=()=>{V.mutate(In.PORT,{onSuccess:Ge=>{Ge.value!==null&&B(String(Ge.value))}})},hd=()=>{V.mutate(In.DEFAULT_GIT_REPOS_DIR,{onSuccess:Ge=>{Ge.value&&U(String(Ge.value))}})},xl=()=>{V.mutate(In.EDITOR_APP,{onSuccess:Ge=>{Ge.value!==null&&Ge.value!==void 0&&H(Ge.value)}})},wl=()=>{V.mutate(In.EDITOR_HOST,{onSuccess:Ge=>{se(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Vs=()=>{V.mutate(In.EDITOR_SSH_PORT,{onSuccess:Ge=>{Ge.value!==null&&Ge.value!==void 0&&Q(String(Ge.value))}})},os=()=>{V.mutate(In.LINEAR_API_KEY,{onSuccess:Ge=>{Z(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Tl=()=>{V.mutate(In.GITHUB_PAT,{onSuccess:Ge=>{ne(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Ni=async Ge=>{q.mutate(Ge,{onSuccess:Rt=>{Rt.success?ln.success(e("notifications.testSuccess",{channel:Ge})):ln.error(e("notifications.testFailed",{channel:Ge,error:Rt.error}))},onError:Rt=>{ln.error(e("notifications.testFailed",{channel:Ge,error:Rt.message}))}})},Tr=async Ge=>{const Rt=Ge.target.files?.[0];if(Rt){Pr(!0);try{const Cr=new FormData;Cr.append("file",Rt);const Cl=await fetch("/api/uploads/sound",{method:"POST",body:Cr});if(!Cl.ok){const Ia=await Cl.json();throw new Error(Ia.error||"Upload failed")}mr(!0),ln.success(e("notifications.soundUploaded"))}catch(Cr){ln.error(e("notifications.soundUploadFailed",{error:Cr instanceof Error?Cr.message:"Unknown error"}))}finally{Pr(!1),Ki.current&&(Ki.current.value="")}}},mi=async()=>{try{if(!(await fetch("/api/uploads/sound",{method:"DELETE"})).ok)throw new Error("Delete failed");mr(!1),ln.success(e("notifications.soundDeleted"))}catch{ln.error(e("notifications.soundDeleteFailed"))}};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-2",children:b.jsx("h1",{className:"text-sm font-medium",children:e("title")})}),b.jsx("div",{className:"flex-1 overflow-auto p-6",children:b.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[b.jsx(dc,{title:e("sections.server"),children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.port.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(vn,{type:"number",min:1,max:65535,value:Y,onChange:Ge=>B(Ge.target.value),placeholder:"7777",disabled:Kt,className:"w-24 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:ig,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.port.description")})]})}),b.jsx(dc,{title:e("sections.paths"),children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.gitReposDir.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(vn,{value:j,onChange:Ge=>U(Ge.target.value),placeholder:"~/projects",disabled:Kt,className:"flex-1 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>be(!0),disabled:Kt,title:t("buttons.browse"),children:b.jsx(fe,{icon:Hi,size:14,strokeWidth:2})}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:hd,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.gitReposDir.description")})]})}),b.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[b.jsx(dc,{title:e("sections.editor"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.app.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs(ji,{value:K,onValueChange:Ge=>H(Ge),children:[b.jsx(Bi,{className:"w-32",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"vscode",children:"VS Code"}),b.jsx(Cn,{value:"cursor",children:"Cursor"}),b.jsx(Cn,{value:"windsurf",children:"Windsurf"}),b.jsx(Cn,{value:"zed",children:"Zed"})]})]}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:xl,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.app.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.host.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(vn,{value:J,onChange:Ge=>se(Ge.target.value),placeholder:e("fields.editor.host.placeholder"),disabled:Kt,className:"flex-1 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:wl,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.host.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.sshPort.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(vn,{type:"number",min:1,max:65535,value:ae,onChange:Ge=>Q(Ge.target.value),placeholder:"22",disabled:Kt,className:"w-20 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Vs,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.sshPort.description")})]})]})}),b.jsx(dc,{title:e("sections.integrations"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.linear.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(vn,{type:"password",value:G,onChange:Ge=>Z(Ge.target.value),placeholder:"lin_api_...",disabled:Kt,className:"flex-1 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:os,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.linear.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.github.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(vn,{type:"password",value:ee,onChange:Ge=>ne(Ge.target.value),placeholder:"ghp_...",disabled:Kt,className:"flex-1 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Tl,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.github.description")})]})]})})]}),b.jsx(dc,{title:e("sections.zai"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.enable")}),b.jsx(zo,{checked:Fe,onCheckedChange:ht,disabled:Kt})]}),Fe&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.apiKey")}),b.jsx(vn,{type:"password",value:Ne,onChange:Ge=>ze(Ge.target.value),placeholder:"zai_...",disabled:Kt,className:"flex-1 font-mono text-sm"})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.zai.description")})]}),b.jsxs("div",{className:"space-y-3 border-t border-border pt-4",children:[b.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("fields.zai.modelMappings")}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.haiku")}),b.jsx(vn,{value:et,onChange:Ge=>lt(Ge.target.value),placeholder:"glm-4.5-air",disabled:Kt,className:"flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.sonnet")}),b.jsx(vn,{value:pt,onChange:Ge=>gn(Ge.target.value),placeholder:"glm-4.7",disabled:Kt,className:"flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.opus")}),b.jsx(vn,{value:Ft,onChange:Ge=>Nt(Ge.target.value),placeholder:"glm-4.7",disabled:Kt,className:"flex-1 font-mono text-sm"})]})]})]})]})}),b.jsx(dc,{title:e("sections.notifications"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-40 sm:shrink-0",children:e("notifications.enable")}),b.jsx(zo,{checked:ye,onCheckedChange:Ee,disabled:Kt})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(zo,{checked:xe,onCheckedChange:ve,disabled:Kt||!ye}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.sound")}),b.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[b.jsx("input",{ref:Ki,type:"file",accept:"audio/mpeg,audio/mp3,audio/wav,audio/ogg",className:"hidden",onChange:Tr}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Ki.current?.click(),disabled:Kt||!ye||!xe||Vr,title:e("notifications.uploadSound"),children:Vr?b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:H1e,size:14,strokeWidth:2})}),yn&&b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:mi,disabled:Kt||!ye||!xe,title:e("notifications.deleteSound"),children:b.jsx(fe,{icon:$c,size:14,strokeWidth:2})}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Ni("sound"),disabled:Kt||!ye||!xe||q.isPending,title:e("notifications.testSound"),children:q.isPending?b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:d_,size:14,strokeWidth:2})})]})]}),yn&&b.jsx("p",{className:"ml-10 text-xs text-muted-foreground",children:e("notifications.customSoundActive")})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(zo,{checked:De,onCheckedChange:Te,disabled:Kt||!ye}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.slack")}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Ni("slack"),disabled:Kt||!ye||!De||!pe||q.isPending,title:e("notifications.slack"),children:q.isPending?b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:d_,size:14,strokeWidth:2})})]}),De&&b.jsx(vn,{type:"password",value:pe,onChange:Ge=>ce(Ge.target.value),placeholder:"https://hooks.slack.com/services/...",disabled:Kt||!ye,className:"ml-6 flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(zo,{checked:Re,onCheckedChange:Pe,disabled:Kt||!ye}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.discord")}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Ni("discord"),disabled:Kt||!ye||!Re||!ge||q.isPending,title:e("notifications.discord"),children:q.isPending?b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:d_,size:14,strokeWidth:2})})]}),Re&&b.jsx(vn,{type:"password",value:ge,onChange:Ge=>Le(Ge.target.value),placeholder:"https://discord.com/api/webhooks/...",disabled:Kt||!ye,className:"ml-6 flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(zo,{checked:Ce,onCheckedChange:Ve,disabled:Kt||!ye}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.pushover")}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Ni("pushover"),disabled:Kt||!ye||!Ce||!Ze||!st||q.isPending,title:e("notifications.pushover"),children:q.isPending?b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:d_,size:14,strokeWidth:2})})]}),Ce&&b.jsxs("div",{className:"ml-6 space-y-2",children:[b.jsx(vn,{type:"password",value:Ze,onChange:Ge=>gt(Ge.target.value),placeholder:e("notifications.appToken"),disabled:Kt||!ye,className:"flex-1 font-mono text-sm"}),b.jsx(vn,{type:"password",value:st,onChange:Ge=>ot(Ge.target.value),placeholder:e("notifications.userKey"),disabled:Kt||!ye,className:"flex-1 font-mono text-sm"})]})]})]})}),b.jsx(dc,{title:e("sections.appearance"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.language.label")}),b.jsxs(ji,{value:C??"auto",onValueChange:Ge=>R(Ge==="auto"?null:Ge),children:[b.jsx(Bi,{className:"w-40",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"auto",children:e("fields.language.options.auto")}),b.jsx(Cn,{value:"en",children:e("fields.language.options.en")}),b.jsx(Cn,{value:"zh",children:e("fields.language.options.zh")})]})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.language.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.theme.label")}),b.jsxs(ji,{value:O??"system",onValueChange:Ge=>L(Ge),children:[b.jsx(Bi,{className:"w-40",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"system",children:e("fields.theme.options.system")}),b.jsx(Cn,{value:"light",children:e("fields.theme.options.light")}),b.jsx(Cn,{value:"dark",children:e("fields.theme.options.dark")})]})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.theme.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.syncClaudeTheme.label")}),b.jsx(zo,{checked:ct,onCheckedChange:nn})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.syncClaudeTheme.description")})]}),ct&&b.jsxs("div",{className:"space-y-3 border-t border-border pt-4 sm:ml-32 sm:pl-2",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.light")}),b.jsxs(ji,{value:Lt,onValueChange:Ge=>yt(Ge),children:[b.jsx(Bi,{className:"w-40",children:b.jsx(Fi,{})}),b.jsx(Ui,{children:gz.filter(Ge=>Ge.startsWith("light")).map(Ge=>b.jsx(Cn,{value:Ge,children:e(`fields.claudeCodeTheme.options.${Ge}`)},Ge))})]})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.dark")}),b.jsxs(ji,{value:Bt,onValueChange:Ge=>Ut(Ge),children:[b.jsx(Bi,{className:"w-40",children:b.jsx(Fi,{})}),b.jsx(Ui,{children:gz.filter(Ge=>Ge.startsWith("dark")).map(Ge=>b.jsx(Cn,{value:Ge,children:e(`fields.claudeCodeTheme.options.${Ge}`)},Ge))})]})]})]})]})}),T?.enabled&&b.jsx(dc,{title:e("sections.developer"),children:b.jsx("div",{className:"space-y-1",children:b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[b.jsx("div",{className:"flex-1",children:b.jsx("p",{className:"text-sm text-muted-foreground",children:e("developer.restartDescription")})}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:()=>{const Ge=T?.startedAt;ft(!0),w.mutate(void 0,{onSuccess:()=>{(async()=>{for(let Cl=0;Cl<120;Cl++){await new Promise(Ia=>setTimeout(Ia,500));try{const Ia=await fetch("/api/config/developer-mode");if(Ia.ok&&(await Ia.json()).startedAt!==Ge){window.location.reload();return}}catch{}}ft(!1),ln.error(e("developer.restartFailed"),{description:e("developer.checkLogs")})})()},onError:Rt=>{ft(!1),ln.error(e("developer.restartFailed"),{description:Rt.message})}})},disabled:w.isPending||zt,className:"shrink-0 gap-2",children:[(w.isPending||zt)&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),e(zt?"developer.restarting":"developer.restartButton")]})]})})})]})}),b.jsx("div",{className:"shrink-0 border-t border-border bg-background px-6 py-3",children:b.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-end gap-2",children:[_e&&b.jsxs("span",{className:"flex items-center gap-1 text-xs text-accent",children:[b.jsx(fe,{icon:hl,size:12,strokeWidth:2}),t("status.saved")]}),b.jsx(Ke,{size:"sm",onClick:Ws,disabled:!Yi||Kt||M.isPending,children:t("buttons.save")})]})}),b.jsx(Nm,{open:te,onOpenChange:be,onSelect:Ge=>U(Ge),initialPath:j||void 0})]})}const gw="";function IIe(){return qn({queryKey:["github-user"],queryFn:async()=>{const e=await fetch(`${gw}/api/github/user`);return e.ok?e.json():null},staleTime:600*1e3,retry:!1})}function DIe(){return qn({queryKey:["github-orgs"],queryFn:async()=>{const e=await fetch(`${gw}/api/github/orgs`);return e.ok?e.json():[]},staleTime:600*1e3})}function LIe(e,t,n){return qn({queryKey:["github-issues",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${gw}/api/github/issues?${r}`);if(!i.ok)throw new Error("Failed to fetch issues");return i.json()},staleTime:300*1e3})}function PIe(e,t,n){return qn({queryKey:["github-prs",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${gw}/api/github/prs?${r}`);if(!i.ok)throw new Error("Failed to fetch PRs");return i.json()},staleTime:300*1e3})}function MIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=tn("review"),{t:i}=tn("common"),{data:a,isLoading:s,error:o}=LIe(e,t,n);if(s)return b.jsx("div",{className:"flex h-48 items-center justify-center",children:b.jsx(fe,{icon:en,size:24,className:"animate-spin text-muted-foreground"})});if(o)return b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:ts,size:24}),b.jsx("p",{className:"text-sm",children:r("issues.failedToLoad")}),b.jsx("p",{className:"text-xs",children:o.message})]});const l={assigned:"issues.empty.assigned",created:"issues.empty.created",mentioned:"issues.empty.mentioned"};return a?.length?b.jsxs("div",{className:"space-y-4",children:[b.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>b.jsx(jIe,{issue:u},u.id))})]}):b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:hl,size:24}),b.jsx("p",{className:"text-sm",children:r(l[e])})]})}function jIe({issue:e}){return b.jsx(xa,{className:"transition-colors hover:border-border/80",children:b.jsx(Df,{className:"py-4",children:b.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[b.jsx("div",{className:"flex items-start gap-2",children:b.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),b.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:b.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]})}),e.labels.length>0&&b.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(t=>b.jsx(co,{className:"text-xs",style:{backgroundColor:`#${t.color}20`,color:`#${t.color}`,borderColor:`#${t.color}40`},children:t.name},t.name)),e.labels.length>3&&b.jsxs(co,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}function FIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=tn("review"),{t:i}=tn("common"),{data:a,isLoading:s,error:o}=PIe(e,t,n);if(s)return b.jsx("div",{className:"flex h-48 items-center justify-center",children:b.jsx(fe,{icon:en,size:24,className:"animate-spin text-muted-foreground"})});if(o)return b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:ts,size:24}),b.jsx("p",{className:"text-sm",children:r("prs.failedToLoad")}),b.jsx("p",{className:"text-xs",children:o.message})]});const l={all:"prs.empty.all",created:"prs.empty.created",assigned:"prs.empty.assigned",review_requested:"prs.empty.reviewRequested",mentioned:"prs.empty.mentioned"};return a?.length?b.jsxs("div",{className:"space-y-4",children:[b.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>b.jsx(BIe,{pr:u},u.id))})]}):b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:hl,size:24}),b.jsx("p",{className:"text-sm",children:r(l[e])})]})}function BIe({pr:e}){const{t}=tn("review");return b.jsx(xa,{className:"transition-colors hover:border-border/80",children:b.jsx(Df,{className:"py-4",children:b.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[b.jsx("div",{className:"flex items-start gap-2",children:b.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),b.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[b.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]}),e.draft&&b.jsx(co,{variant:"secondary",className:Ue("text-xs","bg-muted-foreground/20 text-muted-foreground"),children:t("prs.draft")})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[e.author.avatarUrl&&b.jsx("img",{src:e.author.avatarUrl,alt:e.author.login,className:"h-4 w-4 rounded-full"}),b.jsx("span",{className:"text-xs text-muted-foreground",children:e.author.login})]}),e.labels.length>0&&b.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(n=>b.jsx(co,{className:"text-xs",style:{backgroundColor:`#${n.color}20`,color:`#${n.color}`,borderColor:`#${n.color}40`},children:n.name},n.name)),e.labels.length>3&&b.jsxs(co,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}const UIe=Ms("/review/")({component:$Ie});function $Ie(){const{t:e}=tn("review"),[t,n]=k.useState("prs"),[r,i]=k.useState("review_requested"),[a,s]=k.useState("assigned"),[o,l]=k.useState(!1),[u,f]=k.useState(""),{data:d,isLoading:p}=IIe(),{data:m=[]}=DIe();return!p&&!d?b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2"}),b.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:b.jsxs("div",{className:"max-w-md space-y-4 text-center",children:[b.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:b.jsx(fe,{icon:P1e,size:24,className:"text-muted-foreground"})}),b.jsx("h2",{className:"text-lg font-medium",children:e("github.tokenRequired")}),b.jsx("p",{className:"text-sm text-muted-foreground",children:e("github.tokenDescription")}),b.jsxs("div",{className:"rounded-lg border border-border bg-muted/50 p-4 text-left",children:[b.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("github.requiredScopes")}),b.jsxs("ul",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"repo"})," ",e("github.scopes.repo")]}),b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"read:user"})," ",e("github.scopes.readUser")]}),b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"read:org"})," ",e("github.scopes.readOrg")]})]})]}),b.jsxs("div",{className:"flex flex-col gap-2",children:[b.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,read:user,read:org&description=Vibora",target:"_blank",rel:"noopener noreferrer",children:b.jsxs(Ke,{variant:"outline",size:"sm",className:"w-full",children:[b.jsx(fe,{icon:M1e,size:14,"data-slot":"icon"}),e("github.generateToken")]})}),b.jsx(wi,{to:"/settings",children:b.jsx(Ke,{size:"sm",className:"w-full",children:e("github.goToSettings")})})]})]})})]}):b.jsx("div",{className:"flex h-full flex-col",children:b.jsxs(su,{value:t,onValueChange:y=>n(y),className:"flex flex-1 flex-col overflow-hidden",children:[b.jsxs("div",{className:"flex shrink-0 flex-col border-b border-border bg-background sm:flex-row sm:items-center sm:justify-between",children:[b.jsxs("div",{className:"flex items-center justify-between px-4 py-1 max-sm:px-2",children:[b.jsxs(ou,{variant:"line",children:[b.jsx(li,{value:"prs",children:e("tabs.pullRequests")}),b.jsx(li,{value:"issues",children:e("tabs.issues")})]}),b.jsx("label",{className:"flex cursor-pointer items-center gap-2 text-xs sm:hidden",title:e("filters.viboraReposOnly"),children:b.jsx(zo,{checked:o,onCheckedChange:l,disabled:!!u})})]}),b.jsxs("div",{className:"flex items-center gap-2 border-t border-border px-4 py-1.5 sm:gap-4 sm:border-t-0 sm:px-4 sm:py-1",children:[t==="prs"?b.jsxs(ji,{value:r,onValueChange:y=>i(y),children:[b.jsx(Bi,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"created",children:e("filters.pr.created")}),b.jsx(Cn,{value:"assigned",children:e("filters.pr.assigned")}),b.jsx(Cn,{value:"review_requested",children:e("filters.pr.reviewRequested")}),b.jsx(Cn,{value:"mentioned",children:e("filters.pr.mentioned")})]})]}):b.jsxs(ji,{value:a,onValueChange:y=>s(y),children:[b.jsx(Bi,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"assigned",children:e("filters.issue.assigned")}),b.jsx(Cn,{value:"created",children:e("filters.issue.created")}),b.jsx(Cn,{value:"mentioned",children:e("filters.issue.mentioned")})]})]}),b.jsxs(ji,{value:u,onValueChange:y=>f(y||""),children:[b.jsx(Bi,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Fi,{children:u||e("filters.allOrgs")})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"",children:e("filters.allOrganizations")}),m.map(y=>b.jsx(Cn,{value:y.login,children:y.login},y.login))]})]}),b.jsxs("label",{className:"hidden cursor-pointer items-center gap-2 text-xs sm:flex",title:e("filters.viboraReposOnly"),children:[b.jsx(zo,{checked:o,onCheckedChange:l,disabled:!!u}),b.jsx("span",{className:"text-muted-foreground",children:e("filters.viboraReposOnly")})]})]})]}),b.jsx(Pi,{value:"prs",className:"flex-1 overflow-auto p-4",children:b.jsx(FIe,{filter:r,viboraReposOnly:o,org:u||void 0})}),b.jsx(Pi,{value:"issues",className:"flex-1 overflow-auto p-4",children:b.jsx(MIe,{filter:a,viboraReposOnly:o,org:u||void 0})})]})})}function zIe(){const e=Wi(),t=Mm();return{openInTerminal:k.useCallback((r,i)=>{if(kt.ws.info("useOpenInTerminal: openInTerminal called",{directory:r,name:i,connected:t.connected,tabCount:t.tabs.items.length}),!t.connected){kt.ws.warn("useOpenInTerminal: not connected, aborting"),ln.error("Terminal not connected",{description:"Please wait for the connection to establish"});return}const a=t.tabs.items.find(s=>s.directory===r);if(a){kt.ws.info("useOpenInTerminal: navigating to existing tab",{tabId:a.id}),e({to:"/terminals",search:{tab:a.id}});return}kt.ws.info("useOpenInTerminal: creating new tab",{name:i,directory:r}),t.createTab(i,void 0,r),e({to:"/terminals"})},[t,e]),connected:t.connected}}const HIe={vscode:"vscode",cursor:"cursor",windsurf:"windsurf",zed:"zed"};function sae(e,t,n,r){const i=HIe[t];if(!n)return`${i}://file${e}`;const a=r!==22?`${n}:${r}`:n;return`${i}://vscode-remote/ssh-remote+${a}${e}`}function WIe(e){return{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}[e]}function oae(e){window.parent!==window?window.parent.postMessage({type:"vibora:openUrl",url:e},"*"):window.open(e,"_blank")}function VIe({delay:e=0,...t}){return b.jsx(xxe,{"data-slot":"tooltip-provider",delay:e,...t})}function GIe({...e}){return b.jsx(VIe,{children:b.jsx(fxe,{"data-slot":"tooltip",...e})})}function qIe({...e}){return b.jsx(gxe,{"data-slot":"tooltip-trigger",...e})}function KIe({className:e,side:t="top",sideOffset:n=4,align:r="center",alignOffset:i=0,children:a,...s}){return b.jsx(vxe,{children:b.jsx(yxe,{align:r,alignOffset:i,side:t,sideOffset:n,className:"isolate z-50",children:b.jsxs(Exe,{"data-slot":"tooltip-content",className:Ue("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-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 rounded-md px-3 py-1.5 text-xs **:data-[slot=kbd]:rounded-md bg-foreground text-background z-50 w-fit max-w-xs origin-(--transform-origin)",e),...s,children:[a,b.jsx(Sxe,{className:"size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const lae="";function YIe(e){return qn({queryKey:["copier-questions",e],queryFn:()=>$t(`${lae}/api/copier/questions?source=${encodeURIComponent(e)}`),enabled:!!e,staleTime:300*1e3,retry:!1})}function XIe(){const{data:e,...t}=Ky();return{...t,data:e?.filter(n=>n.isCopierTemplate)??[]}}function ZIe(){const e=wr();return zn({mutationFn:t=>$t(`${lae}/api/copier/create`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function QIe(){const{t:e}=tn("repositories"),t=Wi(),[n,r]=k.useState(!1),[i,a]=k.useState("template"),[s,o]=k.useState(!1),[l,u]=k.useState(!1),f=k.useRef(null),[d,p]=k.useState(""),[m,y]=k.useState(""),[S,g]=k.useState({}),[_,v]=k.useState(""),[x,T]=k.useState(""),[w,C]=k.useState(null),[R,O]=k.useState(!1),[N,L]=k.useState(!1),{data:D}=XIe(),{data:z}=qy(),M=d||m,{data:V,isLoading:W,error:$}=YIe(i==="questions"||i==="output"?M:null),q=ZIe();k.useEffect(()=>{n&&(a("template"),p(""),y(""),g({}),v(z||""),T(""),C(null),O(!1),L(!1))},[n,z]),k.useEffect(()=>{V?.questions&&g(G=>{const Z={...G};for(const ee of V.questions)Z[ee.name]===void 0&&ee.default!==void 0&&(Z[ee.name]=ee.default);return Z})},[V]);const Y=k.useCallback(()=>{const G=f.current;if(!G)return;const Z=G.scrollHeight>G.clientHeight&&G.scrollTop+G.clientHeight<G.scrollHeight-10;u(Z)},[]);k.useEffect(()=>{const G=setTimeout(Y,100);return()=>clearTimeout(G)},[i,V,Y]);const B=k.useCallback(()=>{Y()},[Y]),j=()=>{i==="template"?a("questions"):i==="questions"&&a("output")},U=()=>{i==="questions"?a("template"):i==="output"&&a("questions")},K=()=>{a("creating"),C(null),q.mutate({templateSource:M,outputPath:_,answers:S,projectName:x,trust:R},{onSuccess:G=>{r(!1),t({to:"/repositories/$repoId",params:{repoId:G.repositoryId}})},onError:G=>{C(G.message),(G.message.includes("unsafe")||G.message.includes("--trust"))&&L(!0),a("output")}})},H=G=>{const Z=S[G.name],ee=be=>g(_e=>({..._e,[G.name]:be})),te=G.default===void 0||typeof G.default=="string"&&G.default.includes("{{")?`${G.name} *`:G.name;switch(G.type){case"bool":return b.jsxs(ir,{children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Ti,{checked:Z,onCheckedChange:ee}),b.jsx(ar,{className:"cursor-pointer",children:te})]}),G.help&&b.jsx(qa,{children:G.help})]},G.name);case"int":case"float":return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),b.jsx(vn,{type:"number",value:Z,onChange:be=>ee(G.type==="int"?parseInt(be.target.value):parseFloat(be.target.value)),step:G.type==="float"?"any":1}),G.help&&b.jsx(qa,{children:G.help})]},G.name);default:{if(G.choices&&G.choices.length>0)return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),b.jsxs(ji,{value:String(Z??""),onValueChange:ee,children:[b.jsx(Bi,{className:"w-full",children:b.jsx(Fi,{})}),b.jsx(Ui,{children:G.choices.map(_e=>b.jsx(Cn,{value:String(_e.value),children:_e.label},String(_e.value)))})]}),G.help&&b.jsx(qa,{children:G.help})]},G.name);const be=G.type==="yaml"||G.type==="json";return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),be?b.jsx(bM,{value:String(Z??""),onChange:_e=>ee(_e.target.value),rows:4}):b.jsx(vn,{value:String(Z??""),onChange:_e=>ee(_e.target.value)}),G.help&&b.jsx(qa,{children:G.help})]},G.name)}}},J=!!M,se=V?.questions.filter(G=>{if(G.default!==void 0&&!(typeof G.default=="string"&&G.default.includes("{{")))return!1;const ee=S[G.name];return ee==null||ee===""})??[],ae=V&&!W&&se.length===0,Q=x.trim()&&_.trim();return b.jsxs(b.Fragment,{children:[b.jsxs(ku,{open:n,onOpenChange:r,children:[b.jsxs(Tte,{render:b.jsx(Ke,{variant:"outline",size:"sm"}),children:[b.jsx(fe,{icon:k1e,size:16,strokeWidth:2,"data-slot":"icon"}),e("newProject.button")]}),b.jsxs(Ou,{className:"sm:max-w-lg max-h-[80dvh] flex flex-col overflow-hidden",children:[b.jsxs(Jc,{className:"shrink-0",children:[b.jsxs(ed,{className:"flex items-center gap-2",children:[e("newProject.title"),b.jsxs(GIe,{children:[b.jsx(qIe,{className:"text-muted-foreground hover:text-foreground transition-colors",children:b.jsx(fe,{icon:ste,size:16,strokeWidth:2})}),b.jsx(KIe,{side:"bottom",align:"start",className:"max-w-xs",children:b.jsxs("p",{children:[e("newProject.steps.template.help")," ",b.jsx("a",{href:"https://copier.readthedocs.io/",target:"_blank",rel:"noopener noreferrer",className:"underline hover:opacity-80",children:e("newProject.steps.template.learnMore")})]})})]})]}),b.jsxs(zy,{children:[i==="template"&&e("newProject.steps.template.description"),i==="questions"&&e("newProject.steps.questions.description"),i==="output"&&e("newProject.steps.output.description"),i==="creating"&&e("newProject.steps.creating.description")]})]}),b.jsx("div",{className:"flex gap-2 shrink-0 mt-2",children:["template","questions","output"].map((G,Z)=>b.jsx("div",{className:Ue("flex-1 h-1 rounded",i===G||["template","questions","output"].indexOf(i)>Z||i==="creating"?"bg-primary":"bg-muted")},G))}),b.jsxs("div",{ref:f,onScroll:B,className:"flex-1 overflow-y-auto min-h-0 py-4 scrollbar-visible",children:[i==="template"&&b.jsxs(pf,{children:[b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.template.savedTemplates")}),b.jsxs(ji,{value:d,onValueChange:G=>{p(G??""),y("")},children:[b.jsx(Bi,{className:"w-full",children:b.jsx(Fi,{children:d?D?.find(G=>G.id===d)?.displayName:b.jsx("span",{className:"text-muted-foreground",children:e("newProject.steps.template.selectTemplate")})})}),b.jsx(Ui,{children:D?.map(G=>b.jsx(Cn,{value:G.id,children:G.displayName},G.id))})]})]}),b.jsx("div",{className:"text-center text-muted-foreground text-xs py-2",children:e("newProject.steps.template.or")}),b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.template.customUrl")}),b.jsx(vn,{value:m,onChange:G=>{y(G.target.value),p("")},placeholder:"https://github.com/user/template or /path/to/template"}),b.jsx(qa,{children:e("newProject.steps.template.customUrlHelp")})]})]}),i==="questions"&&b.jsxs(pf,{children:[W&&b.jsx("div",{className:"flex items-center justify-center py-8",children:b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),$&&b.jsx("div",{className:"text-destructive text-sm py-4",children:$.message}),V?.questions.map(H),V&&V.questions.length===0&&b.jsx("div",{className:"text-muted-foreground text-sm py-4",children:e("newProject.steps.questions.noQuestions")})]}),i==="output"&&b.jsxs(pf,{children:[b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.output.projectName")}),b.jsx(vn,{value:x,onChange:G=>T(G.target.value),placeholder:"my-new-project"})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.output.outputDirectory")}),b.jsxs(Ke,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>o(!0),children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2,className:"mr-2"}),_||e("newProject.steps.output.selectDirectory")]})]}),x&&_&&b.jsxs(qa,{className:"font-mono text-xs",children:[e("newProject.steps.output.willCreate"),": ",_,"/",x]}),w&&b.jsx("div",{className:"text-destructive text-sm mt-2 p-2 bg-destructive/10 rounded",children:w}),N&&b.jsx(ir,{children:b.jsxs("div",{className:"flex items-start gap-2",children:[b.jsx(Ti,{checked:R,onCheckedChange:G=>O(G===!0),className:"mt-0.5"}),b.jsxs("div",{children:[b.jsx(ar,{className:"cursor-pointer",children:e("newProject.steps.output.trustTemplate")}),b.jsx(qa,{children:e("newProject.steps.output.trustWarning")})]})]})})]}),i==="creating"&&b.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[b.jsx(fe,{icon:en,size:32,strokeWidth:2,className:"animate-spin text-primary"}),b.jsx("span",{className:"text-sm text-muted-foreground",children:e("newProject.steps.creating.inProgress")})]})]}),l&&b.jsx("div",{className:"flex justify-center py-1",children:b.jsx(fe,{icon:cM,size:16,strokeWidth:2,className:"text-muted-foreground animate-bounce"})}),b.jsxs(Hf,{className:"shrink-0",children:[i!=="template"&&i!=="creating"&&b.jsxs(Ke,{variant:"outline",onClick:U,children:[b.jsx(fe,{icon:ete,size:16,strokeWidth:2,"data-slot":"icon"}),e("newProject.back")]}),i==="template"&&b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline"}),children:e("addModal.cancel")}),i==="template"&&b.jsxs(Ke,{onClick:j,disabled:!J,children:[e("newProject.next"),b.jsx(fe,{icon:Z$,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="questions"&&b.jsxs(Ke,{onClick:j,disabled:!ae,children:[e("newProject.next"),b.jsx(fe,{icon:Z$,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="output"&&b.jsx(Ke,{onClick:K,disabled:!Q||q.isPending,children:e("newProject.create")})]})]})]}),b.jsx(Nm,{open:s,onOpenChange:o,onSelect:G=>v(G),initialPath:z||void 0})]})}function JIe(e){return e.startsWith("git@")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("gh:")||e.startsWith("gl:")||e.startsWith("bb:")}function eDe(e){const t=e.replace(/\.git$/,"");if(t.startsWith("git@")){const n=t.match(/:([^/]+\/)?([^/]+)$/);if(n)return n[2]}else if(t.startsWith("gh:")||t.startsWith("gl:")||t.startsWith("bb:")){const n=t.split("/");if(n.length>0)return n[n.length-1]}else{const n=t.split("/");if(n.length>0)return n[n.length-1]}return t}function tDe({open:e,onOpenChange:t,onSuccess:n}){const{t:r}=tn("repositories"),[i,a]=k.useState(""),[s,o]=k.useState(null),[l,u]=k.useState(!1),{data:f}=qy(),d=kne(),p=cwe(),m=k.useMemo(()=>JIe(i.trim()),[i]),y=k.useMemo(()=>m?eDe(i.trim()):null,[i,m]),S=k.useMemo(()=>y&&f?`${f}/${y}`:null,[y,f]),g=d.isPending||p.isPending,_=async T=>{T.preventDefault(),o(null);const w=i.trim();if(w)if(m)p.mutate({url:w},{onSuccess:C=>{a(""),t(!1),n?.(C.id)},onError:C=>{o(C instanceof Error?C.message:r("addModal.cloneFailed"))}});else{const C=w.split("/").pop()||"repo";d.mutate({path:w,displayName:C},{onSuccess:R=>{a(""),t(!1),n?.(R.id)},onError:R=>{o(R instanceof Error?R.message:r("addModal.createFailed"))}})}},v=T=>{a(T),u(!1)},x=T=>{T||(a(""),o(null)),t(T)};return b.jsxs(b.Fragment,{children:[b.jsx(ku,{open:e,onOpenChange:x,children:b.jsxs(Ou,{className:"sm:max-w-md",children:[b.jsxs(Jc,{children:[b.jsx(ed,{children:r("addModal.title")}),b.jsx(zy,{children:r("addModal.description")})]}),b.jsxs("form",{onSubmit:_,className:"space-y-4",children:[b.jsxs("div",{className:"space-y-2",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("addModal.inputLabel")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsxs("div",{className:"relative flex-1",children:[b.jsx(vn,{value:i,onChange:T=>{a(T.target.value),o(null)},placeholder:r("addModal.inputPlaceholder"),disabled:g,className:"pr-8"}),i&&b.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:b.jsx(fe,{icon:m?ote:Hi,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),b.jsx(Ke,{type:"button",variant:"outline",size:"sm",onClick:()=>u(!0),disabled:g,children:r("addModal.browse")})]})]}),m&&S&&b.jsxs("div",{className:"rounded-md bg-muted/50 px-3 py-2 text-xs text-muted-foreground",children:[r("addModal.willCloneTo"),": ",b.jsx("span",{className:"font-mono",children:S})]}),g&&b.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-sm text-muted-foreground",children:[b.jsx(fe,{icon:en,size:16,strokeWidth:2,className:"animate-spin"}),r(m?"addModal.cloning":"addModal.adding")]}),s&&b.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[b.jsx(fe,{icon:ts,size:14,strokeWidth:2,className:"mt-0.5 shrink-0"}),b.jsx("span",{children:s})]}),b.jsxs(Hf,{children:[b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline",disabled:g}),children:r("addModal.cancel")}),b.jsx(Ke,{type:"submit",disabled:!i.trim()||g,children:r(s?"addModal.retry":"addModal.add")})]})]})]})}),b.jsx(Nm,{open:l,onOpenChange:u,onSelect:v,initialPath:f||void 0})]})}function nDe({open:e,onOpenChange:t,onSuccess:n}){const{t:r}=tn("repositories"),[i,a]=k.useState(""),[s,o]=k.useState(!1),[l,u]=k.useState(null),[f,d]=k.useState(new Set),[p,m]=k.useState(null),{data:y}=qy(),S=fwe(),g=hwe(),_=i.trim()||y||"",v=S.isPending||g.isPending,x=k.useMemo(()=>l?.filter(D=>!D.exists)??[],[l]),T=()=>{m(null),u(null),d(new Set),S.mutate(_||void 0,{onSuccess:D=>{u(D.repositories);const z=D.repositories.filter(M=>!M.exists);d(new Set(z.map(M=>M.path)))},onError:D=>{m(D instanceof Error?D.message:r("bulkAdd.scanFailed"))}})},w=D=>{a(D),o(!1),u(null),d(new Set)},C=D=>{d(z=>{const M=new Set(z);return M.has(D)?M.delete(D):M.add(D),M})},R=()=>{d(new Set(x.map(D=>D.path)))},O=()=>{d(new Set)},N=()=>{if(f.size===0)return;const D=Array.from(f).map(z=>{const M=l?.find(V=>V.path===z);return{path:z,displayName:M?.name}});g.mutate(D,{onSuccess:()=>{t(!1),n?.()},onError:z=>{m(z instanceof Error?z.message:r("bulkAdd.addFailed"))}})},L=D=>{D||(a(""),u(null),d(new Set),m(null)),t(D)};return b.jsxs(b.Fragment,{children:[b.jsx(ku,{open:e,onOpenChange:L,children:b.jsxs(Ou,{className:"sm:max-w-lg",children:[b.jsxs(Jc,{children:[b.jsx(ed,{children:r("bulkAdd.title")}),b.jsx(zy,{children:r("bulkAdd.description")})]}),b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-2",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("bulkAdd.directoryLabel")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(vn,{value:i,onChange:D=>{a(D.target.value),m(null),u(null)},placeholder:y||r("bulkAdd.directoryPlaceholder"),disabled:v,className:"flex-1"}),b.jsx(Ke,{type:"button",variant:"outline",size:"sm",onClick:()=>o(!0),disabled:v,children:r("bulkAdd.browse")}),b.jsxs(Ke,{type:"button",size:"sm",onClick:T,disabled:v||!_,children:[S.isPending?b.jsx(fe,{icon:en,size:16,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:Gx,size:16,strokeWidth:2}),r("bulkAdd.scan")]})]})]}),l!==null&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("bulkAdd.foundRepos",{count:l.length})}),x.length>0&&b.jsxs("div",{className:"flex gap-2 text-xs",children:[b.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:R,disabled:v,children:r("bulkAdd.selectAll")}),b.jsx("span",{className:"text-muted-foreground",children:"/"}),b.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:O,disabled:v,children:r("bulkAdd.selectNone")})]})]}),l.length===0?b.jsx("div",{className:"rounded-md bg-muted/50 px-3 py-4 text-center text-sm text-muted-foreground",children:r("bulkAdd.noReposFound")}):b.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:l.map(D=>b.jsxs("div",{className:`flex items-center gap-3 border-b px-3 py-2 last:border-b-0 ${D.exists?"bg-muted/30 opacity-60":""}`,children:[b.jsx(Ti,{checked:f.has(D.path),onCheckedChange:()=>C(D.path),disabled:D.exists||v}),b.jsx(fe,{icon:D.exists?nte:Hi,size:16,strokeWidth:2,className:D.exists?"text-green-500":"text-muted-foreground"}),b.jsxs("div",{className:"min-w-0 flex-1",children:[b.jsx("div",{className:"truncate text-sm font-medium",children:D.name}),b.jsx("div",{className:"truncate text-xs text-muted-foreground",children:D.path})]}),D.exists&&b.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:r("bulkAdd.alreadyAdded")})]},D.path))})]}),g.isPending&&b.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-sm text-muted-foreground",children:[b.jsx(fe,{icon:en,size:16,strokeWidth:2,className:"animate-spin"}),r("bulkAdd.adding")]}),p&&b.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[b.jsx(fe,{icon:ts,size:14,strokeWidth:2,className:"mt-0.5 shrink-0"}),b.jsx("span",{children:p})]})]}),b.jsxs(Hf,{children:[b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline",disabled:v}),children:r("bulkAdd.cancel")}),b.jsx(Ke,{onClick:N,disabled:f.size===0||v,children:r("bulkAdd.addSelected",{count:f.size})})]})]})}),b.jsx(Nm,{open:s,onOpenChange:o,onSelect:w,initialPath:_||void 0})]})}const rDe=Ms("/repositories/")({component:oDe});function iDe({repository:e,onDelete:t,onStartTask:n,onOpenInTerminal:r,onViewTasks:i}){const{t:a}=tn("repositories"),[s,o]=k.useState(!1),[l,u]=k.useState(!1),{data:f}=DM(),{data:d}=LM(),{data:p}=PM(),m=()=>{const S=sae(e.path,f,d,p);oae(S)},y=async()=>{u(!0);try{await t(),o(!1)}catch{}finally{u(!1)}};return b.jsxs(xa,{className:"h-full group transition-colors hover:border-foreground/20",children:[b.jsx(wi,{to:"/repositories/$repoId",params:{repoId:e.id},className:"block",children:b.jsx(Df,{className:"flex flex-col gap-3 py-4",children:b.jsxs("div",{className:"space-y-1",children:[b.jsx("span",{className:"block truncate font-medium group-hover:text-primary transition-colors",children:e.displayName}),b.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[b.jsx(fe,{icon:Hi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:e.path})]})]})})}),b.jsx(Df,{className:"pt-0 pb-4 px-6",children:b.jsxs("div",{className:"mt-auto flex flex-wrap gap-1",children:[b.jsxs(Ke,{variant:"outline",size:"sm",onClick:n,className:"text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:pM,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("newTask")})]}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:i,className:"text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:Dp,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("viewTasks")})]}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground",title:a("openInTerminal"),children:[b.jsx(fe,{icon:fM,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("terminal")})]}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:m,className:"text-muted-foreground hover:text-foreground max-sm:hidden",title:a("openInEditor",{editor:WIe(f)}),children:[b.jsx(fe,{icon:fte,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{children:a("editor")})]}),b.jsxs(go,{open:s,onOpenChange:o,children:[b.jsxs(bo,{render:b.jsx(Ke,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-destructive",title:a("delete.button")}),children:[b.jsx(fe,{icon:$c,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("delete.button")})]}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:a("delete.title")}),b.jsx(So,{children:a("delete.description",{name:e.displayName})})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:l,children:a("addModal.cancel")}),b.jsxs(Ke,{variant:"destructive",onClick:y,disabled:l,className:"gap-2",children:[l&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),a(l?"delete.deleting":"delete.button")]})]})]})]})]})})]})}function aDe(){const{t:e}=tn("repositories"),t=Wi(),[n,r]=k.useState(!1);return b.jsxs(b.Fragment,{children:[b.jsxs(Ke,{size:"sm",onClick:()=>r(!0),children:[b.jsx(fe,{icon:Ev,size:16,strokeWidth:2,"data-slot":"icon"}),e("addRepository")]}),b.jsx(tDe,{open:n,onOpenChange:r,onSuccess:i=>{t({to:"/repositories/$repoId",params:{repoId:i}})}})]})}function sDe(){const{t:e}=tn("repositories"),[t,n]=k.useState(!1);return b.jsxs(b.Fragment,{children:[b.jsxs(Ke,{size:"sm",variant:"outline",onClick:()=>n(!0),children:[b.jsx(fe,{icon:O1e,size:16,strokeWidth:2,"data-slot":"icon"}),e("scanDirectory")]}),b.jsx(nDe,{open:t,onOpenChange:n})]})}function oDe(){const{t:e}=tn("repositories"),t=Wi(),{data:n,isLoading:r,error:i}=Ky(),a=One(),[s,o]=k.useState(null),{openInTerminal:l}=zIe(),[u,f]=k.useState(""),d=k.useMemo(()=>n?u?.trim()?n.map(y=>({repo:y,score:Math.max(no(y.displayName,u),no(y.path,u))})).filter(({score:y})=>y>0).sort((y,S)=>S.score-y.score).map(({repo:y})=>y):n:[],[n,u]),p=async y=>{await a.mutateAsync(y)},m=y=>{t({to:"/tasks",search:{repo:y}})};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsx(aDe,{}),b.jsx(sDe,{}),b.jsx(QIe,{}),b.jsx("div",{className:"flex-1"}),b.jsxs("div",{className:"relative min-w-0 w-48 sm:w-64",children:[b.jsx(fe,{icon:Gx,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(vn,{value:u,onChange:y=>f(y.target.value),placeholder:e("searchPlaceholder"),className:"w-full pl-6"})]})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[r&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),i&&b.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[b.jsx(fe,{icon:ts,size:20,strokeWidth:2}),b.jsx("span",{className:"text-sm",children:e("error.failedToLoad",{message:i.message})})]}),!r&&!i&&n?.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:e("empty.noRepositories")})}),!r&&!i&&n&&n.length>0&&d.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:e("empty.noMatches")})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:d.map(y=>b.jsx(iDe,{repository:y,onDelete:()=>p(y.id),onStartTask:()=>o(y),onOpenInTerminal:()=>l(y.path,y.displayName),onViewTasks:()=>m(y.displayName)},y.id))})]}),b.jsx(MM,{open:s!==null,onOpenChange:y=>!y&&o(null),defaultRepository:s??void 0,showTrigger:!1})]})}var jk,MH;function Ra(){if(MH)return jk;MH=1;var e=Array.isArray;return jk=e,jk}var Fk,jH;function uae(){if(jH)return Fk;jH=1;var e=typeof G1=="object"&&G1&&G1.Object===Object&&G1;return Fk=e,Fk}var Bk,FH;function vl(){if(FH)return Bk;FH=1;var e=uae(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Bk=n,Bk}var Uk,BH;function s0(){if(BH)return Uk;BH=1;var e=vl(),t=e.Symbol;return Uk=t,Uk}var $k,UH;function lDe(){if(UH)return $k;UH=1;var e=s0(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(s){var o=n.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var f=r.call(s);return u&&(o?s[i]=l:delete s[i]),f}return $k=a,$k}var zk,$H;function uDe(){if($H)return zk;$H=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return zk=n,zk}var Hk,zH;function Iu(){if(zH)return Hk;zH=1;var e=s0(),t=lDe(),n=uDe(),r="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function s(o){return o==null?o===void 0?i:r:a&&a in Object(o)?t(o):n(o)}return Hk=s,Hk}var Wk,HH;function Du(){if(HH)return Wk;HH=1;function e(t){return t!=null&&typeof t=="object"}return Wk=e,Wk}var Vk,WH;function Fm(){if(WH)return Vk;WH=1;var e=Iu(),t=Du(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Vk=r,Vk}var Gk,VH;function i3(){if(VH)return Gk;VH=1;var e=Ra(),t=Fm(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,s){if(e(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||t(a)?!0:r.test(a)||!n.test(a)||s!=null&&a in Object(s)}return Gk=i,Gk}var qk,GH;function od(){if(GH)return qk;GH=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return qk=e,qk}var Kk,qH;function a3(){if(qH)return Kk;qH=1;var e=Iu(),t=od(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!t(o))return!1;var l=e(o);return l==r||l==i||l==n||l==a}return Kk=s,Kk}var Yk,KH;function cDe(){if(KH)return Yk;KH=1;var e=vl(),t=e["__core-js_shared__"];return Yk=t,Yk}var Xk,YH;function dDe(){if(YH)return Xk;YH=1;var e=cDe(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return Xk=n,Xk}var Zk,XH;function cae(){if(XH)return Zk;XH=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return Zk=n,Zk}var Qk,ZH;function fDe(){if(ZH)return Qk;ZH=1;var e=a3(),t=dDe(),n=od(),r=cae(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,f=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(p){if(!n(p)||t(p))return!1;var m=e(p)?f:a;return m.test(r(p))}return Qk=d,Qk}var Jk,QH;function hDe(){if(QH)return Jk;QH=1;function e(t,n){return t?.[n]}return Jk=e,Jk}var eO,JH;function Zf(){if(JH)return eO;JH=1;var e=fDe(),t=hDe();function n(r,i){var a=t(r,i);return e(a)?a:void 0}return eO=n,eO}var tO,eW;function bw(){if(eW)return tO;eW=1;var e=Zf(),t=e(Object,"create");return tO=t,tO}var nO,tW;function pDe(){if(tW)return nO;tW=1;var e=bw();function t(){this.__data__=e?e(null):{},this.size=0}return nO=t,nO}var rO,nW;function mDe(){if(nW)return rO;nW=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return rO=e,rO}var iO,rW;function gDe(){if(rW)return iO;rW=1;var e=bw(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(a){var s=this.__data__;if(e){var o=s[a];return o===t?void 0:o}return r.call(s,a)?s[a]:void 0}return iO=i,iO}var aO,iW;function bDe(){if(iW)return aO;iW=1;var e=bw(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return aO=r,aO}var sO,aW;function vDe(){if(aW)return sO;aW=1;var e=bw(),t="__lodash_hash_undefined__";function n(r,i){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=e&&i===void 0?t:i,this}return sO=n,sO}var oO,sW;function yDe(){if(sW)return oO;sW=1;var e=pDe(),t=mDe(),n=gDe(),r=bDe(),i=vDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,oO=a,oO}var lO,oW;function _De(){if(oW)return lO;oW=1;function e(){this.__data__=[],this.size=0}return lO=e,lO}var uO,lW;function s3(){if(lW)return uO;lW=1;function e(t,n){return t===n||t!==t&&n!==n}return uO=e,uO}var cO,uW;function vw(){if(uW)return cO;uW=1;var e=s3();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return cO=t,cO}var dO,cW;function EDe(){if(cW)return dO;cW=1;var e=vw(),t=Array.prototype,n=t.splice;function r(i){var a=this.__data__,s=e(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():n.call(a,s,1),--this.size,!0}return dO=r,dO}var fO,dW;function SDe(){if(dW)return fO;dW=1;var e=vw();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return fO=t,fO}var hO,fW;function xDe(){if(fW)return hO;fW=1;var e=vw();function t(n){return e(this.__data__,n)>-1}return hO=t,hO}var pO,hW;function wDe(){if(hW)return pO;hW=1;var e=vw();function t(n,r){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,r])):i[a][1]=r,this}return pO=t,pO}var mO,pW;function yw(){if(pW)return mO;pW=1;var e=_De(),t=EDe(),n=SDe(),r=xDe(),i=wDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,mO=a,mO}var gO,mW;function o3(){if(mW)return gO;mW=1;var e=Zf(),t=vl(),n=e(t,"Map");return gO=n,gO}var bO,gW;function TDe(){if(gW)return bO;gW=1;var e=yDe(),t=yw(),n=o3();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return bO=r,bO}var vO,bW;function CDe(){if(bW)return vO;bW=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return vO=e,vO}var yO,vW;function _w(){if(vW)return yO;vW=1;var e=CDe();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return yO=t,yO}var _O,yW;function ADe(){if(yW)return _O;yW=1;var e=_w();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return _O=t,_O}var EO,_W;function kDe(){if(_W)return EO;_W=1;var e=_w();function t(n){return e(this,n).get(n)}return EO=t,EO}var SO,EW;function ODe(){if(EW)return SO;EW=1;var e=_w();function t(n){return e(this,n).has(n)}return SO=t,SO}var xO,SW;function RDe(){if(SW)return xO;SW=1;var e=_w();function t(n,r){var i=e(this,n),a=i.size;return i.set(n,r),this.size+=i.size==a?0:1,this}return xO=t,xO}var wO,xW;function l3(){if(xW)return wO;xW=1;var e=TDe(),t=ADe(),n=kDe(),r=ODe(),i=RDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,wO=a,wO}var TO,wW;function dae(){if(wW)return TO;wW=1;var e=l3(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],l=a.cache;if(l.has(o))return l.get(o);var u=r.apply(this,s);return a.cache=l.set(o,u)||l,u};return a.cache=new(n.Cache||e),a}return n.Cache=e,TO=n,TO}var CO,TW;function NDe(){if(TW)return CO;TW=1;var e=dae(),t=500;function n(r){var i=e(r,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return CO=n,CO}var AO,CW;function IDe(){if(CW)return AO;CW=1;var e=NDe(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(s,o,l,u){a.push(l?u.replace(n,"$1"):o||s)}),a});return AO=r,AO}var kO,AW;function u3(){if(AW)return kO;AW=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=Array(i);++r<i;)a[r]=n(t[r],r,t);return a}return kO=e,kO}var OO,kW;function DDe(){if(kW)return OO;kW=1;var e=s0(),t=u3(),n=Ra(),r=Fm(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(n(o))return t(o,s)+"";if(r(o))return a?a.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}return OO=s,OO}var RO,OW;function fae(){if(OW)return RO;OW=1;var e=DDe();function t(n){return n==null?"":e(n)}return RO=t,RO}var NO,RW;function hae(){if(RW)return NO;RW=1;var e=Ra(),t=i3(),n=IDe(),r=fae();function i(a,s){return e(a)?a:t(a,s)?[a]:n(r(a))}return NO=i,NO}var IO,NW;function Ew(){if(NW)return IO;NW=1;var e=Fm();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return IO=t,IO}var DO,IW;function c3(){if(IW)return DO;IW=1;var e=hae(),t=Ew();function n(r,i){i=e(i,r);for(var a=0,s=i.length;r!=null&&a<s;)r=r[t(i[a++])];return a&&a==s?r:void 0}return DO=n,DO}var LO,DW;function pae(){if(DW)return LO;DW=1;var e=c3();function t(n,r,i){var a=n==null?void 0:e(n,r);return a===void 0?i:a}return LO=t,LO}var LDe=pae();const Ls=Sn(LDe);var PO,LW;function PDe(){if(LW)return PO;LW=1;function e(t){return t==null}return PO=e,PO}var MDe=PDe();const fn=Sn(MDe);var MO,PW;function jDe(){if(PW)return MO;PW=1;var e=Iu(),t=Ra(),n=Du(),r="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==r}return MO=i,MO}var FDe=jDe();const Pf=Sn(FDe);var BDe=a3();const Vt=Sn(BDe);var UDe=od();const Bm=Sn(UDe);var jO={exports:{}},Dn={};var MW;function $De(){if(MW)return Dn;MW=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),o=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function S(g){if(typeof g=="object"&&g!==null){var _=g.$$typeof;switch(_){case e:switch(g=g.type,g){case n:case i:case r:case u:case f:return g;default:switch(g=g&&g.$$typeof,g){case o:case s:case l:case p:case d:case a:return g;default:return _}}case t:return _}}}return Dn.ContextConsumer=s,Dn.ContextProvider=a,Dn.Element=e,Dn.ForwardRef=l,Dn.Fragment=n,Dn.Lazy=p,Dn.Memo=d,Dn.Portal=t,Dn.Profiler=i,Dn.StrictMode=r,Dn.Suspense=u,Dn.SuspenseList=f,Dn.isAsyncMode=function(){return!1},Dn.isConcurrentMode=function(){return!1},Dn.isContextConsumer=function(g){return S(g)===s},Dn.isContextProvider=function(g){return S(g)===a},Dn.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},Dn.isForwardRef=function(g){return S(g)===l},Dn.isFragment=function(g){return S(g)===n},Dn.isLazy=function(g){return S(g)===p},Dn.isMemo=function(g){return S(g)===d},Dn.isPortal=function(g){return S(g)===t},Dn.isProfiler=function(g){return S(g)===i},Dn.isStrictMode=function(g){return S(g)===r},Dn.isSuspense=function(g){return S(g)===u},Dn.isSuspenseList=function(g){return S(g)===f},Dn.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===u||g===f||g===m||typeof g=="object"&&g!==null&&(g.$$typeof===p||g.$$typeof===d||g.$$typeof===a||g.$$typeof===s||g.$$typeof===l||g.$$typeof===y||g.getModuleId!==void 0)},Dn.typeOf=S,Dn}var jW;function zDe(){return jW||(jW=1,jO.exports=$De()),jO.exports}var HDe=zDe(),FO,FW;function mae(){if(FW)return FO;FW=1;var e=Iu(),t=Du(),n="[object Number]";function r(i){return typeof i=="number"||t(i)&&e(i)==n}return FO=r,FO}var BO,BW;function WDe(){if(BW)return BO;BW=1;var e=mae();function t(n){return e(n)&&n!=+n}return BO=t,BO}var VDe=WDe();const Um=Sn(VDe);var GDe=mae();const qDe=Sn(GDe);var _a=function(t){return t===0?0:t>0?1:-1},ef=function(t){return Pf(t)&&t.indexOf("%")===t.length-1},at=function(t){return qDe(t)&&!Um(t)},KDe=function(t){return fn(t)},ei=function(t){return at(t)||Pf(t)},YDe=0,o0=function(t){var n=++YDe;return"".concat(t||"").concat(n)},so=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!at(t)&&!Pf(t))return r;var a;if(ef(t)){var s=t.indexOf("%");a=n*parseFloat(t.slice(0,s))/100}else a=+t;return Um(a)&&(a=r),i&&a>n&&(a=n),a},_c=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},XDe=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},i=0;i<n;i++)if(!r[t[i]])r[t[i]]=!0;else return!0;return!1},Ji=function(t,n){return at(t)&&at(n)?function(r){return t+r*(n-t)}:function(){return n}};function cS(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):Ls(r,t))===n})}var ZDe=function(t,n){return at(t)&&at(n)?t-n:Pf(t)&&Pf(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function Ep(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function xD(e){"@babel/helpers - typeof";return xD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xD(e)}var QDe=["viewBox","children"],JDe=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],UW=["points","pathLength"],UO={svg:QDe,polygon:UW,polyline:UW},d3=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],dS=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(k.isValidElement(t)&&(r=t.props),!Bm(r))return null;var i={};return Object.keys(r).forEach(function(a){d3.includes(a)&&(i[a]=n||function(s){return r[a](r,s)})}),i},eLe=function(t,n,r){return function(i){return t(n,r,i),null}},Gc=function(t,n,r){if(!Bm(t)||xD(t)!=="object")return null;var i=null;return Object.keys(t).forEach(function(a){var s=t[a];d3.includes(a)&&typeof s=="function"&&(i||(i={}),i[a]=eLe(s,n,r))}),i},tLe=["children"],nLe=["children"];function $W(e,t){if(e==null)return{};var n=rLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function wD(e){"@babel/helpers - typeof";return wD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wD(e)}var zW={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},du=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},HW=null,$O=null,f3=function e(t){if(t===HW&&Array.isArray($O))return $O;var n=[];return k.Children.forEach(t,function(r){fn(r)||(HDe.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),$O=n,HW=t,n};function Ps(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(i){return du(i)}):r=[du(t)],f3(e).forEach(function(i){var a=Ls(i,"type.displayName")||Ls(i,"type.name");r.indexOf(a)!==-1&&n.push(i)}),n}function Va(e,t){var n=Ps(e,t);return n&&n[0]}var WW=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,i=n.height;return!(!at(r)||r<=0||!at(i)||i<=0)},iLe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],aLe=function(t){return t&&t.type&&Pf(t.type)&&iLe.indexOf(t.type)>=0},sLe=function(t){return t&&wD(t)==="object"&&"clipDot"in t},oLe=function(t,n,r,i){var a,s=(a=UO?.[i])!==null&&a!==void 0?a:[];return n.startsWith("data-")||!Vt(t)&&(i&&s.includes(n)||JDe.includes(n))||r&&d3.includes(n)},Dt=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(k.isValidElement(t)&&(i=t.props),!Bm(i))return null;var a={};return Object.keys(i).forEach(function(s){var o;oLe((o=i)===null||o===void 0?void 0:o[s],s,n,r)&&(a[s]=i[s])}),a},TD=function e(t,n){if(t===n)return!0;var r=k.Children.count(t);if(r!==k.Children.count(n))return!1;if(r===0)return!0;if(r===1)return VW(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i<r;i++){var a=t[i],s=n[i];if(Array.isArray(a)||Array.isArray(s)){if(!e(a,s))return!1}else if(!VW(a,s))return!1}return!0},VW=function(t,n){if(fn(t)&&fn(n))return!0;if(!fn(t)&&!fn(n)){var r=t.props||{},i=r.children,a=$W(r,tLe),s=n.props||{},o=s.children,l=$W(s,nLe);return i&&o?Ep(a,l)&&TD(i,o):!i&&!o?Ep(a,l):!1}return!1},GW=function(t,n){var r=[],i={};return f3(t).forEach(function(a,s){if(aLe(a))r.push(a);else if(a){var o=du(a.type),l=n[o]||{},u=l.handler,f=l.once;if(u&&(!f||!i[o])){var d=u(a,o,s);r.push(d),i[o]=!0}}}),r},lLe=function(t){var n=t&&t.type;return n&&zW[n]?zW[n]:null},uLe=function(t,n){return f3(n).indexOf(t)},cLe=["children","width","height","viewBox","className","style","title","desc"];function CD(){return CD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},CD.apply(this,arguments)}function dLe(e,t){if(e==null)return{};var n=fLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function fLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function AD(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,s=e.style,o=e.title,l=e.desc,u=dLe(e,cLe),f=i||{width:n,height:r,x:0,y:0},d=Zt("recharts-surface",a);return oe.createElement("svg",CD({},Dt(u,!0,"svg"),{className:d,width:n,height:r,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),oe.createElement("title",null,o),oe.createElement("desc",null,l),t)}var hLe=["children","className"];function kD(){return kD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kD.apply(this,arguments)}function pLe(e,t){if(e==null)return{};var n=mLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var xn=oe.forwardRef(function(e,t){var n=e.children,r=e.className,i=pLe(e,hLe),a=Zt("recharts-layer",r);return oe.createElement("g",kD({className:a},Dt(i,!0),{ref:t}),n)}),fu=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a]},zO,qW;function gLe(){if(qW)return zO;qW=1;function e(t,n,r){var i=-1,a=t.length;n<0&&(n=-n>a?0:a+n),r=r>a?a:r,r<0&&(r+=a),a=n>r?0:r-n>>>0,n>>>=0;for(var s=Array(a);++i<a;)s[i]=t[i+n];return s}return zO=e,zO}var HO,KW;function bLe(){if(KW)return HO;KW=1;var e=gLe();function t(n,r,i){var a=n.length;return i=i===void 0?a:i,!r&&i>=a?n:e(n,r,i)}return HO=t,HO}var WO,YW;function gae(){if(YW)return WO;YW=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+e+i+a+"]");function l(u){return o.test(u)}return WO=l,WO}var VO,XW;function vLe(){if(XW)return VO;XW=1;function e(t){return t.split("")}return VO=e,VO}var GO,ZW;function yLe(){if(ZW)return GO;ZW=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="["+e+"]",o="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+o+"|"+l+")",f="[^"+e+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",m="\\u200d",y=u+"?",S="["+a+"]?",g="(?:"+m+"(?:"+[f,d,p].join("|")+")"+S+y+")*",_=S+y+g,v="(?:"+[f+o+"?",o,d,p,s].join("|")+")",x=RegExp(l+"(?="+l+")|"+v+_,"g");function T(w){return w.match(x)||[]}return GO=T,GO}var qO,QW;function _Le(){if(QW)return qO;QW=1;var e=vLe(),t=gae(),n=yLe();function r(i){return t(i)?n(i):e(i)}return qO=r,qO}var KO,JW;function ELe(){if(JW)return KO;JW=1;var e=bLe(),t=gae(),n=_Le(),r=fae();function i(a){return function(s){s=r(s);var o=t(s)?n(s):void 0,l=o?o[0]:s.charAt(0),u=o?e(o,1).join(""):s.slice(1);return l[a]()+u}}return KO=i,KO}var YO,eV;function SLe(){if(eV)return YO;eV=1;var e=ELe(),t=e("toUpperCase");return YO=t,YO}var xLe=SLe();const Sw=Sn(xLe);function Zn(e){return function(){return e}}const bae=Math.cos,fS=Math.sin,Ro=Math.sqrt,hS=Math.PI,xw=2*hS,OD=Math.PI,RD=2*OD,zd=1e-6,wLe=RD-zd;function vae(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function TLe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return vae;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class CLe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?vae:TLe(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,a,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+a},${this._y1=+s}`}arcTo(t,n,r,i,a){if(t=+t,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,o=this._y1,l=r-t,u=i-n,f=s-t,d=o-n,p=f*f+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(p>zd)if(!(Math.abs(d*l-u*f)>zd)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let m=r-s,y=i-o,S=l*l+u*u,g=m*m+y*y,_=Math.sqrt(S),v=Math.sqrt(p),x=a*Math.tan((OD-Math.acos((S+p-g)/(2*_*v)))/2),T=x/v,w=x/_;Math.abs(T-1)>zd&&this._append`L${t+T*f},${n+T*d}`,this._append`A${a},${a},0,0,${+(d*m>f*y)},${this._x1=t+w*l},${this._y1=n+w*u}`}}arc(t,n,r,i,a,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let o=r*Math.cos(i),l=r*Math.sin(i),u=t+o,f=n+l,d=1^s,p=s?i-a:a-i;this._x1===null?this._append`M${u},${f}`:(Math.abs(this._x1-u)>zd||Math.abs(this._y1-f)>zd)&&this._append`L${u},${f}`,r&&(p<0&&(p=p%RD+RD),p>wLe?this._append`A${r},${r},0,1,${d},${t-o},${n-l}A${r},${r},0,1,${d},${this._x1=u},${this._y1=f}`:p>zd&&this._append`A${r},${r},0,${+(p>=OD)},${d},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function h3(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new CLe(t)}function p3(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yae(e){this._context=e}yae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ww(e){return new yae(e)}function _ae(e){return e[0]}function Eae(e){return e[1]}function Sae(e,t){var n=Zn(!0),r=null,i=ww,a=null,s=h3(o);e=typeof e=="function"?e:e===void 0?_ae:Zn(e),t=typeof t=="function"?t:t===void 0?Eae:Zn(t);function o(l){var u,f=(l=p3(l)).length,d,p=!1,m;for(r==null&&(a=i(m=s())),u=0;u<=f;++u)!(u<f&&n(d=l[u],u,l))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+e(d,u,l),+t(d,u,l));if(m)return a=null,m+""||null}return o.x=function(l){return arguments.length?(e=typeof l=="function"?l:Zn(+l),o):e},o.y=function(l){return arguments.length?(t=typeof l=="function"?l:Zn(+l),o):t},o.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Zn(!!l),o):n},o.curve=function(l){return arguments.length?(i=l,r!=null&&(a=i(r)),o):i},o.context=function(l){return arguments.length?(l==null?r=a=null:a=i(r=l),o):r},o}function w_(e,t,n){var r=null,i=Zn(!0),a=null,s=ww,o=null,l=h3(u);e=typeof e=="function"?e:e===void 0?_ae:Zn(+e),t=typeof t=="function"?t:Zn(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?Eae:Zn(+n);function u(d){var p,m,y,S=(d=p3(d)).length,g,_=!1,v,x=new Array(S),T=new Array(S);for(a==null&&(o=s(v=l())),p=0;p<=S;++p){if(!(p<S&&i(g=d[p],p,d))===_)if(_=!_)m=p,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),y=p-1;y>=m;--y)o.point(x[y],T[y]);o.lineEnd(),o.areaEnd()}_&&(x[p]=+e(g,p,d),T[p]=+t(g,p,d),o.point(r?+r(g,p,d):x[p],n?+n(g,p,d):T[p]))}if(v)return o=null,v+""||null}function f(){return Sae().defined(i).curve(s).context(a)}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),r=null,u):e},u.x0=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),u):e},u.x1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:Zn(+d),u):r},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),n=null,u):t},u.y0=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),u):t},u.y1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:Zn(+d),u):n},u.lineX0=u.lineY0=function(){return f().x(e).y(t)},u.lineY1=function(){return f().x(e).y(n)},u.lineX1=function(){return f().x(r).y(t)},u.defined=function(d){return arguments.length?(i=typeof d=="function"?d:Zn(!!d),u):i},u.curve=function(d){return arguments.length?(s=d,a!=null&&(o=s(a)),u):s},u.context=function(d){return arguments.length?(d==null?a=o=null:o=s(a=d),u):a},u}class xae{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function ALe(e){return new xae(e,!0)}function kLe(e){return new xae(e,!1)}const m3={draw(e,t){const n=Ro(t/hS);e.moveTo(n,0),e.arc(0,0,n,0,xw)}},OLe={draw(e,t){const n=Ro(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},wae=Ro(1/3),RLe=wae*2,NLe={draw(e,t){const n=Ro(t/RLe),r=n*wae;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},ILe={draw(e,t){const n=Ro(t),r=-n/2;e.rect(r,r,n,n)}},DLe=.8908130915292852,Tae=fS(hS/10)/fS(7*hS/10),LLe=fS(xw/10)*Tae,PLe=-bae(xw/10)*Tae,MLe={draw(e,t){const n=Ro(t*DLe),r=LLe*n,i=PLe*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const s=xw*a/5,o=bae(s),l=fS(s);e.lineTo(l*n,-o*n),e.lineTo(o*r-l*i,l*r+o*i)}e.closePath()}},XO=Ro(3),jLe={draw(e,t){const n=-Ro(t/(XO*3));e.moveTo(0,n*2),e.lineTo(-XO*n,-n),e.lineTo(XO*n,-n),e.closePath()}},gs=-.5,bs=Ro(3)/2,ND=1/Ro(12),FLe=(ND/2+1)*3,BLe={draw(e,t){const n=Ro(t/FLe),r=n/2,i=n*ND,a=r,s=n*ND+n,o=-a,l=s;e.moveTo(r,i),e.lineTo(a,s),e.lineTo(o,l),e.lineTo(gs*r-bs*i,bs*r+gs*i),e.lineTo(gs*a-bs*s,bs*a+gs*s),e.lineTo(gs*o-bs*l,bs*o+gs*l),e.lineTo(gs*r+bs*i,gs*i-bs*r),e.lineTo(gs*a+bs*s,gs*s-bs*a),e.lineTo(gs*o+bs*l,gs*l-bs*o),e.closePath()}};function ULe(e,t){let n=null,r=h3(i);e=typeof e=="function"?e:Zn(e||m3),t=typeof t=="function"?t:Zn(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Zn(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function pS(){}function mS(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Cae(e){this._context=e}Cae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:mS(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:mS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function $Le(e){return new Cae(e)}function Aae(e){this._context=e}Aae.prototype={areaStart:pS,areaEnd:pS,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:mS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function zLe(e){return new Aae(e)}function kae(e){this._context=e}kae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:mS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function HLe(e){return new kae(e)}function Oae(e){this._context=e}Oae.prototype={areaStart:pS,areaEnd:pS,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function WLe(e){return new Oae(e)}function tV(e){return e<0?-1:1}function nV(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),o=(a*i+s*r)/(r+i);return(tV(a)+tV(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function rV(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ZO(e,t,n){var r=e._x0,i=e._y0,a=e._x1,s=e._y1,o=(a-r)/3;e._context.bezierCurveTo(r+o,i+o*t,a-o,s-o*n,a,s)}function gS(e){this._context=e}gS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ZO(this,this._t0,rV(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,ZO(this,rV(this,n=nV(this,e,t)),n);break;default:ZO(this,this._t0,n=nV(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Rae(e){this._context=new Nae(e)}(Rae.prototype=Object.create(gS.prototype)).point=function(e,t){gS.prototype.point.call(this,t,e)};function Nae(e){this._context=e}Nae.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function VLe(e){return new gS(e)}function GLe(e){return new Rae(e)}function Iae(e){this._context=e}Iae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=iV(e),i=iV(t),a=0,s=1;s<n;++a,++s)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function iV(e){var t,n=e.length-1,r,i=new Array(n),a=new Array(n),s=new Array(n);for(i[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function qLe(e){return new Iae(e)}function Tw(e,t){this._context=e,this._t=t}Tw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function KLe(e){return new Tw(e,.5)}function YLe(e){return new Tw(e,0)}function XLe(e){return new Tw(e,1)}function Wp(e,t){if((s=e.length)>1)for(var n=1,r,i,a=e[t[0]],s,o=a.length;n<s;++n)for(i=a,a=e[t[n]],r=0;r<o;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function ID(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function ZLe(e,t){return e[t]}function QLe(e){const t=[];return t.key=e,t}function JLe(){var e=Zn([]),t=ID,n=Wp,r=ZLe;function i(a){var s=Array.from(e.apply(this,arguments),QLe),o,l=s.length,u=-1,f;for(const d of a)for(o=0,++u;o<l;++o)(s[o][u]=[0,+r(d,s[o].key,u,a)]).data=d;for(o=0,f=p3(t(s));o<l;++o)s[f[o]].index=o;return n(s,f),s}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(Array.from(a)),i):e},i.value=function(a){return arguments.length?(r=typeof a=="function"?a:Zn(+a),i):r},i.order=function(a){return arguments.length?(t=a==null?ID:typeof a=="function"?a:Zn(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(n=a??Wp,i):n},i}function ePe(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,s;i<a;++i){for(s=n=0;n<r;++n)s+=e[n][i][1]||0;if(s)for(n=0;n<r;++n)e[n][i][1]/=s}Wp(e,t)}}function tPe(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var s=0,o=0;s<i;++s)o+=e[s][n][1]||0;r[n][1]+=r[n][0]=-o/2}Wp(e,t)}}function nPe(e,t){if(!(!((s=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,s;r<a;++r){for(var o=0,l=0,u=0;o<s;++o){for(var f=e[t[o]],d=f[r][1]||0,p=f[r-1][1]||0,m=(d-p)/2,y=0;y<o;++y){var S=e[t[y]],g=S[r][1]||0,_=S[r-1][1]||0;m+=g-_}l+=d,u+=m*d}i[r-1][1]+=i[r-1][0]=n,l&&(n-=u/l)}i[r-1][1]+=i[r-1][0]=n,Wp(e,t)}}function Pv(e){"@babel/helpers - typeof";return Pv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pv(e)}var rPe=["type","size","sizeType"];function DD(){return DD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},DD.apply(this,arguments)}function aV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function sV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?aV(Object(n),!0).forEach(function(r){iPe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function iPe(e,t,n){return t=aPe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aPe(e){var t=sPe(e,"string");return Pv(t)=="symbol"?t:t+""}function sPe(e,t){if(Pv(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Pv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oPe(e,t){if(e==null)return{};var n=lPe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function lPe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Dae={symbolCircle:m3,symbolCross:OLe,symbolDiamond:NLe,symbolSquare:ILe,symbolStar:MLe,symbolTriangle:jLe,symbolWye:BLe},uPe=Math.PI/180,cPe=function(t){var n="symbol".concat(Sw(t));return Dae[n]||m3},dPe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*uPe;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},fPe=function(t,n){Dae["symbol".concat(Sw(t))]=n},g3=function(t){var n=t.type,r=n===void 0?"circle":n,i=t.size,a=i===void 0?64:i,s=t.sizeType,o=s===void 0?"area":s,l=oPe(t,rPe),u=sV(sV({},l),{},{type:r,size:a,sizeType:o}),f=function(){var g=cPe(r),_=ULe().type(g).size(dPe(a,o,r));return _()},d=u.className,p=u.cx,m=u.cy,y=Dt(u,!0);return p===+p&&m===+m&&a===+a?oe.createElement("path",DD({},y,{className:Zt("recharts-symbols",d),transform:"translate(".concat(p,", ").concat(m,")"),d:f()})):null};g3.registerSymbol=fPe;function Vp(e){"@babel/helpers - typeof";return Vp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vp(e)}function LD(){return LD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},LD.apply(this,arguments)}function oV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function hPe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oV(Object(n),!0).forEach(function(r){Mv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function pPe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mPe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Pae(r.key),r)}}function gPe(e,t,n){return t&&mPe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function bPe(e,t,n){return t=bS(t),vPe(e,Lae()?Reflect.construct(t,n||[],bS(e).constructor):t.apply(e,n))}function vPe(e,t){if(t&&(Vp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yPe(e)}function yPe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Lae(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Lae=function(){return!!e})()}function bS(e){return bS=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bS(e)}function _Pe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&PD(e,t)}function PD(e,t){return PD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},PD(e,t)}function Mv(e,t,n){return t=Pae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pae(e){var t=EPe(e,"string");return Vp(t)=="symbol"?t:t+""}function EPe(e,t){if(Vp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Vp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var vs=32,b3=(function(e){function t(){return pPe(this,t),bPe(this,t,arguments)}return _Pe(t,e),gPe(t,[{key:"renderIcon",value:function(r){var i=this.props.inactiveColor,a=vs/2,s=vs/6,o=vs/3,l=r.inactive?i:r.color;if(r.type==="plainline")return oe.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:a,x2:vs,y2:a,className:"recharts-legend-icon"});if(r.type==="line")return oe.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(a,"h").concat(o,`
44
+ ${e.directory}`:e.name,children:[f&&b.jsx("div",{className:Ue("absolute top-0 bottom-0 w-0.5 bg-primary z-10",f==="left"&&"-left-1",f==="right"&&"-right-1")}),e.directory&&b.jsx(fe,{icon:Hi,size:12,strokeWidth:2,className:"shrink-0 opacity-60"}),e.name,n&&b.jsx("button",{onClick:S=>{S.stopPropagation(),i()},onPointerDown:S=>S.stopPropagation(),className:"ml-1 rounded opacity-0 hover:bg-muted group-hover:opacity-100",children:b.jsx(fe,{icon:ci,size:12,strokeWidth:2})})]})}function dIe({tabs:e,activeTabId:t,onTabSelect:n,onTabClose:r,onTabCreate:i,onTabEdit:a,onTabReorder:s}){const o=k.useRef(null),l=k.useRef(null),[u,f]=k.useState(!1),[d,p]=k.useState(!1),[m,y]=k.useState(!0),S=k.useCallback(()=>{const v=o.current;if(!v)return;const{scrollLeft:x,scrollWidth:T,clientWidth:w}=v;f(x>0),p(x+w<T-1)},[]);k.useEffect(()=>{const v=l.current,x=o.current;if(!v||!x)return;const T=new IntersectionObserver(([w])=>{y(w.isIntersecting)},{root:x,threshold:.9});return T.observe(v),()=>T.disconnect()},[]),k.useEffect(()=>{const v=o.current;if(!v)return;S(),v.addEventListener("scroll",S);const x=new ResizeObserver(S);return x.observe(v),()=>{v.removeEventListener("scroll",S),x.disconnect()}},[S]),k.useEffect(()=>{S()},[e,S]);const g=k.useCallback(()=>{o.current?.scrollTo({left:0,behavior:"smooth"})},[]),_=k.useCallback(()=>{const v=o.current;v&&v.scrollTo({left:v.scrollWidth,behavior:"smooth"})},[]);return b.jsxs("div",{className:"flex items-center",children:[u&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:g,className:"shrink-0",children:b.jsx(fe,{icon:Jee,size:14,strokeWidth:2})}),b.jsxs("div",{ref:o,className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto scrollbar-none",children:[e.map(v=>b.jsx(cIe,{tab:v,isActive:v.id===t,canClose:e.length>1,onSelect:()=>n(v.id),onClose:()=>r(v.id),onEdit:()=>a(v),onReorder:s},v.id)),b.jsx("span",{ref:l,children:b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:i,className:"shrink-0",children:b.jsx(fe,{icon:Ev,size:14,strokeWidth:2})})})]}),d&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:_,className:"shrink-0",children:b.jsx(fe,{icon:$y,size:14,strokeWidth:2})}),!m&&b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:i,className:"shrink-0",children:b.jsx(fe,{icon:Ev,size:14,strokeWidth:2})})]})}function fIe({tab:e,open:t,onOpenChange:n,onSave:r,onCreate:i,defaultName:a=""}){const{t:s}=tn("terminals"),[o,l]=k.useState(""),[u,f]=k.useState(null),[d,p]=k.useState(!1),m=!e&&i;k.useEffect(()=>{t&&(e?(l(e.name),f(e.directory??null)):(l(a),f(null)))},[t,e,a]);const y=()=>{if(m){i(o.trim(),u??void 0),n(!1);return}if(!e)return;const x={};o.trim()&&o.trim()!==e.name&&(x.name=o.trim()),u!==(e.directory??null)&&(x.directory=u),Object.keys(x).length>0&&r(e.id,x),n(!1)},S=x=>{x.key==="Enter"&&(x.preventDefault(),y())},g=()=>{f(null)},_=x=>{f(x)},v=u?u.split("/").pop():null;return b.jsxs(b.Fragment,{children:[b.jsx(ku,{open:t,onOpenChange:n,children:b.jsxs(Ou,{className:"sm:max-w-md",children:[b.jsx(Jc,{children:b.jsx(ed,{children:s(m?"newTab.title":"editTab.title")})}),b.jsxs(pf,{className:"mt-4",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"tabName",children:s("editTab.name")}),b.jsx(vn,{id:"tabName",value:o,onChange:x=>l(x.target.value),onKeyDown:S,placeholder:s("editTab.namePlaceholder"),autoFocus:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:s("editTab.directory")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsxs(Ke,{type:"button",variant:"outline",className:"flex-1 justify-start font-normal",onClick:()=>p(!0),children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2,className:"mr-2 shrink-0"}),v?b.jsx("span",{className:"truncate font-mono text-xs",children:u}):b.jsx("span",{className:"text-muted-foreground",children:s("editTab.directoryPlaceholder")})]}),u&&b.jsx(Ke,{type:"button",variant:"ghost",size:"icon",onClick:g,title:s("editTab.clearDirectory"),children:b.jsx(fe,{icon:ci,size:14,strokeWidth:2})})]})]})]}),b.jsxs(Hf,{className:"mt-4",children:[b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline",type:"button"}),children:s("editTab.cancel")}),b.jsx(Ke,{onClick:y,disabled:!o.trim(),children:s(m?"newTab.create":"editTab.save")})]})]})}),b.jsx(Nm,{open:d,onOpenChange:p,onSelect:_,initialPath:u??void 0})]})}function IH(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode??void 0,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function hIe(e,t){return{id:e.id,name:e.name,layout:"single",position:t,directory:e.directory??void 0}}const Di="all-tasks",DH=["IN_PROGRESS","IN_REVIEW"],LH="vibora:lastTerminalTab",pIe=n0(function(){const{t}=tn("terminals"),n=Wi(),{tab:r,repo:i}=Cx({from:"/terminals/"}),{terminals:a,tabs:s,connected:o,createTerminal:l,destroyTerminal:u,renameTerminal:f,assignTerminalToTab:d,createTab:p,updateTab:m,deleteTab:y,reorderTab:S,attachXterm:g,resizeTerminal:_,setupImagePaste:v,writeToTerminal:x,sendInputToTerminal:T,newTerminalIds:w,pendingTabCreation:C,lastCreatedTabId:R}=aie(),[O,N]=k.useState(null),{getFocusedTerminal:L}=cie(),D=k.useMemo(()=>s.map(pe=>pe.id),[s]),z=r&&(D.includes(r)||r===Di),M=z?r:s[0]?.id??null,V=k.useCallback(pe=>{n({to:"/terminals",search:{tab:pe,repo:pe===Di?i:void 0},replace:!0})},[n,i]),W=k.useCallback(pe=>{n({to:"/terminals",search:ce=>({...ce,repo:pe||void 0}),replace:!0})},[n]),$=Mm();k.useEffect(()=>$M(()=>({lastCreatedTabId:$.lastCreatedTabId,pendingTabCreation:$.pendingTabCreation}),({lastCreatedTabId:ce})=>{ce&&(At.terminal.info("MobX reaction: lastCreatedTabId changed",{tabId:ce}),V(ce),setTimeout(()=>{$.clearLastCreatedTabId(),ae.current++;const Re=`Terminal ${ae.current}`;At.terminal.debug("Creating terminal in new tab",{tabId:ce,name:Re}),l({name:Re,cols:80,rows:24,tabId:ce,positionInTab:0})},150))},{fireImmediately:!0}),[$,V,l]),k.useEffect(()=>{if(At.terminal.debug("Redirect effect running",{tabsLength:s.length,isValidTab:z,pendingTabCreation:C,lastCreatedTabId:R}),s.length!==0&&!(C||R)&&!z){const pe=localStorage.getItem(LH),ce=pe&&(s.some(Re=>Re.id===pe)||pe===Di)?pe:s[0].id;At.terminal.debug("Redirecting to tab",{targetTab:ce}),n({to:"/terminals",search:{tab:ce},replace:!0})}},[s,z,R,C,n]),k.useEffect(()=>{M&&localStorage.setItem(LH,M)},[M]);const{data:q=[],status:Y}=RM(),{data:B=[]}=Ky(),j=k.useMemo(()=>{const pe=new Map;for(const ce of B)pe.set(ce.path,ce.id);return pe},[B]),U=k.useMemo(()=>new Set(q.filter(pe=>DH.includes(pe.status)&&pe.worktreePath).map(pe=>pe.worktreePath)),[q]),K=k.useMemo(()=>new Set(q.filter(pe=>pe.worktreePath).map(pe=>pe.worktreePath)),[q]),H=k.useMemo(()=>{const pe=new Map;for(const ce of q)ce.worktreePath&&pe.set(ce.worktreePath,{taskId:ce.id,repoId:j.get(ce.repoPath),repoName:ce.repoName,title:ce.title,repoPath:ce.repoPath,worktreePath:ce.worktreePath,baseBranch:ce.baseBranch,branch:ce.branch,prUrl:ce.prUrl});return pe},[q,j]),J=k.useMemo(()=>{const pe=new Set(q.filter(ce=>DH.includes(ce.status)).map(ce=>ce.repoName));return Array.from(pe).sort()},[q]),se=k.useRef(new Map),ae=k.useRef(0),Q=k.useRef(!1),G=k.useRef(!1),Z=k.useMemo(()=>M===Di?a.filter(pe=>pe.cwd&&U.has(pe.cwd)).filter(pe=>i?q.find(Re=>Re.worktreePath===pe.cwd)?.repoName===i:!0).sort((pe,ce)=>{const Re=q.find(ge=>ge.worktreePath===pe.cwd),Pe=q.find(ge=>ge.worktreePath===ce.cwd);return!Re||!Pe?0:new Date(Pe.createdAt).getTime()-new Date(Re.createdAt).getTime()}).map(IH):a.filter(pe=>pe.tabId===M).sort((pe,ce)=>pe.positionInTab-ce.positionInTab).map(IH),[M,a,U,i,q]),ee=k.useCallback(()=>{if(At.terminal.info("handleTerminalAdd called",{activeTabId:M,connected:o,pendingTerminalCreate:Q.current,terminalCount:a.length}),Q.current){At.terminal.debug("Skipping terminal creation, already pending");return}Q.current=!0,ae.current++;const pe=`Terminal ${ae.current}`,ce=a.filter(Pe=>Pe.tabId===M),Re=ce.length;At.terminal.info("Creating terminal",{name:pe,tabId:M,positionInTab:Re,terminalsInTabCount:ce.length}),l({name:pe,cols:80,rows:24,tabId:M??void 0,positionInTab:Re}),setTimeout(()=>{Q.current=!1},500)},[l,M,a,o]);k.useEffect(()=>{if(Y!=="success"){At.terminalsView.debug("Tab assignment effect skipped",{tasksStatus:Y});return}for(const pe of a)pe.cwd&&K.has(pe.cwd)&&pe.tabId&&(At.terminalsView.debug("Removing task terminal from regular tab",{terminalId:pe.id,name:pe.name,cwd:pe.cwd,tabId:pe.tabId}),d(pe.id,null))},[a,K,d,Y]);const ne=k.useCallback(pe=>{const ce=se.current.get(pe);ce&&(ce(),se.current.delete(pe)),u(pe,{force:!0,reason:"user_closed"})},[u]),te=k.useCallback((pe,ce)=>{const Re=g(pe,ce);se.current.set(pe,Re),w.has(pe)&&setTimeout(()=>{ce.focus()},50)},[g,w]),be=k.useCallback((pe,ce,Re)=>{_(pe,ce,Re)},[_]),_e=k.useCallback((pe,ce)=>{f(pe,ce)},[f]),he=k.useCallback(()=>{if(G.current){At.terminal.debug("Skipping tab creation, already pending");return}G.current=!0;const pe=`Tab ${s.length+1}`;At.terminal.debug("Quick creating tab",{name:pe}),p(pe,void 0,void 0),setTimeout(()=>{G.current=!1},500)},[p,s.length]),ye=k.useCallback((pe,ce)=>{At.terminal.debug("Reordering tab",{tabId:pe,newPosition:ce}),S(pe,ce)},[S]),Ee=k.useCallback((pe,ce)=>{if(G.current){At.terminal.debug("Skipping tab creation, already pending");return}G.current=!0,At.terminal.debug("Creating tab",{name:pe,directory:ce}),p(pe,void 0,ce),setTimeout(()=>{G.current=!1},500)},[p]),xe=k.useCallback(pe=>{const ce=a.filter(Re=>Re.tabId===pe);for(const Re of ce){const Pe=se.current.get(Re.id);Pe&&(Pe(),se.current.delete(Re.id))}y(pe)},[a,y]),ve=s.map(hIe),De=k.useCallback(pe=>{N(pe)},[]),Te=k.useCallback((pe,ce)=>{m(pe,ce)},[m]);return Es("meta+d",ee,{enabled:M!==Di&&o,allowInTerminal:!0,deps:[ee,M,o]}),Es("meta+w",()=>{if(M&&M!==Di){const pe=L(M);pe&&ne(pe)}},{enabled:M!==Di,allowInTerminal:!0,deps:[M,L,ne]}),b.jsxs("div",{className:"flex h-full max-w-full flex-col overflow-hidden",children:[b.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-center justify-between border-b border-border bg-background px-2 py-1",children:[b.jsxs("div",{className:"flex min-w-0 flex-1 items-center",children:[b.jsxs("button",{onClick:()=>V(Di),className:Ue("relative flex shrink-0 items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors max-sm:px-2",M===Di?"bg-primary/10 text-primary":"text-muted-foreground hover:text-primary hover:bg-primary/5","after:absolute after:inset-x-0 after:bottom-0 after:h-0.5 after:bg-primary after:transition-opacity",M===Di?"after:opacity-100":"after:opacity-0"),children:[b.jsx(fe,{icon:Dp,size:12,strokeWidth:2}),b.jsx("span",{className:"max-sm:hidden",children:t("taskTerminals")})]}),b.jsx("div",{className:"mx-2 h-4 w-px shrink-0 bg-border"}),b.jsx("div",{className:"min-w-0 flex-1",children:b.jsx(dIe,{tabs:ve,activeTabId:M??"",onTabSelect:V,onTabClose:xe,onTabCreate:he,onTabEdit:De,onTabReorder:ye})})]}),b.jsxs("div",{className:"flex shrink-0 items-center gap-3 max-sm:gap-1",children:[M===Di&&J.length>1&&b.jsxs(ji,{value:i??"",onValueChange:pe=>W(pe||null),children:[b.jsxs(Bi,{size:"sm",className:"max-sm:w-auto",children:[b.jsx(fe,{icon:ite,size:12,strokeWidth:2,className:"text-muted-foreground"}),b.jsx(Fi,{children:i||t("allRepos")})]}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"",children:t("allRepos")}),J.map(pe=>b.jsx(Cn,{value:pe,children:pe},pe))]})]}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:ee,disabled:!o||M===Di,className:"max-sm:px-2 border-transparent text-primary",children:[b.jsx(fe,{icon:fM,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:t("newTerminal")})]})]})]}),b.jsx("div",{className:"min-w-0 flex-1 overflow-hidden",children:b.jsx(_Ne,{terminals:Z,onTerminalClose:M===Di?void 0:ne,onTerminalAdd:o&&M!==Di?ee:void 0,onTerminalReady:te,onTerminalResize:be,onTerminalRename:M===Di?void 0:_e,setupImagePaste:v,writeToTerminal:x,sendInputToTerminal:T,taskInfoByCwd:M===Di?H:void 0})}),b.jsx(fIe,{tab:O,open:O!==null,onOpenChange:pe=>{pe||N(null)},onSave:Te,onCreate:Ee,defaultName:`Tab ${s.length+1}`})]})}),mIe=Ms("/terminals/")({component:pIe,validateSearch:e=>({tab:typeof e.tab=="string"?e.tab:void 0,repo:typeof e.repo=="string"?e.repo:void 0})});function gIe(){return{x:0,y:0}}function bIe(e){var t=e.render,n=e.nativeSetDragImage,r=e.getOffset,i=r===void 0?gIe:r,a=document.createElement("div");Object.assign(a.style,{position:"fixed",top:0,left:0,zIndex:Vie,pointerEvents:"none"}),document.body.append(a);var s=t({container:a});queueMicrotask(function(){var u=i({container:a});if(i0()){var f=a.getBoundingClientRect();if(f.width===0)return;a.style.left="-".concat(f.width-1e-4,"px")}n?.(a,u.x,u.y)});function o(){l(),s?.(),document.body.removeChild(a)}var l=Xie({onDragStart:o,onDrop:o})}var vIe=Xf(function(){return i0()&&"ontouchend"in document}),yIe=function(t){var n=t.container,r=n.getBoundingClientRect();return{x:r.width/2,y:r.height/2}};function _Ie(e){return function(n){var r=n.container;if(vIe()||Yie())return yIe({container:r});Object.assign(r.style,{borderInlineStart:"".concat(e.x," solid transparent"),borderTop:"".concat(e.y," solid transparent")});var i=window.getComputedStyle(r);if(i.direction==="rtl"){var a=r.getBoundingClientRect();return{x:a.width,y:0}}return{x:0,y:0}}}const eae=k.createContext(null);function EIe({children:e}){const[t,n]=k.useState(null);return b.jsx(eae.Provider,{value:{activeTask:t,setActiveTask:n},children:e})}function tae(){const e=k.useContext(eae);if(!e)throw new Error("useDrag must be used within DragProvider");return e}const nae=k.createContext(null);function SIe({children:e}){const[t,n]=k.useState(new Set),[r,i]=k.useState(null),a=k.useCallback(u=>{n(f=>{const d=new Set(f);return d.has(u)?d.delete(u):d.add(u),d}),i(u)},[]),s=k.useCallback((u,f)=>{if(!r){n(new Set([u])),i(u);return}const d=f.indexOf(r),p=f.indexOf(u);if(d===-1||p===-1){n(new Set([u])),i(u);return}const[m,y]=d<p?[d,p]:[p,d],S=f.slice(m,y+1);n(g=>{const _=new Set(g);for(const v of S)_.add(v);return _})},[r]),o=k.useCallback(()=>{n(new Set),i(null)},[]),l=k.useCallback(u=>t.has(u),[t]);return b.jsx(nae.Provider,{value:{selectedIds:t,lastSelectedId:r,toggleSelection:a,selectRange:s,clearSelection:o,isSelected:l},children:e})}function r3(){const e=k.useContext(nae);if(!e)throw new Error("useSelection must be used within a SelectionProvider");return e}function xIe(e){return e.match(/\/issue\/([A-Z]+-\d+)/i)?.[1]??null}function rae({task:e,open:t,onOpenChange:n}){const r=NM(),i=IM(),[a,s]=k.useState(e.title),[o,l]=k.useState(!0),[u,f]=k.useState(e.description||""),[d,p]=k.useState(e.prUrl||""),[m,y]=k.useState(e.linearTicketUrl||"");k.useEffect(()=>{t&&(s(e.title),f(e.description||""),p(e.prUrl||""),y(e.linearTicketUrl||""),l(!0))},[t,e]);const S=()=>{const v={},x=a.trim();if(!x)return;x!==e.title&&(v.title=x);const T=u.trim();T!==(e.description||"")&&(v.description=T);const w=d.trim();w!==(e.prUrl||"")&&(v.prUrl=w||null);const C=m.trim();C!==(e.linearTicketUrl||"")&&(v.linearTicketUrl=C||null,v.linearTicketId=C?xIe(C):null),Object.keys(v).length>0&&r.mutate({taskId:e.id,updates:v}),n(!1)},g=v=>{v.key==="Enter"&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),S())},_=()=>{i.mutate({taskId:e.id,deleteLinkedWorktree:o},{onSuccess:()=>{n(!1)}})};return b.jsx(ku,{open:t,onOpenChange:n,children:b.jsxs(Ou,{className:"sm:max-w-md",onKeyDown:g,children:[b.jsx(Jc,{children:b.jsx(ed,{children:"Task Settings"})}),b.jsxs(pf,{className:"mt-4",children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-title",children:"Title"}),b.jsx(vn,{id:"config-title",value:a,onChange:v=>s(v.target.value),autoFocus:!0})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-description",children:"Description"}),b.jsx(kte,{id:"config-description",value:u,onValueChange:f,rows:3})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-pr-url",children:"GitHub PR URL"}),b.jsx(vn,{id:"config-pr-url",value:d,onChange:v=>p(v.target.value),placeholder:"https://github.com/owner/repo/pull/123"})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"config-linear-url",children:"Linear Ticket URL"}),b.jsx(vn,{id:"config-linear-url",value:m,onChange:v=>y(v.target.value),placeholder:"https://linear.app/team/issue/TEAM-123"})]})]}),b.jsxs(Hf,{className:"mt-4 flex-row justify-between sm:justify-between",children:[b.jsxs(go,{children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",className:"text-destructive hover:text-destructive hover:bg-destructive/10",disabled:i.isPending}),children:i.isPending?"Deleting...":"Delete Task"}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:"Delete Task"}),b.jsx(So,{children:"This will permanently delete this task. This action cannot be undone."})]}),b.jsxs("div",{className:"flex items-center gap-2 py-2",children:[b.jsx(Ti,{id:"delete-worktree",checked:o,onCheckedChange:v=>l(v===!0)}),b.jsx("label",{htmlFor:"delete-worktree",className:"text-sm cursor-pointer",children:"Also delete linked worktree"})]}),b.jsxs(_o,{children:[b.jsx(xo,{children:"Cancel"}),b.jsx(Rv,{onClick:_,variant:"destructive",disabled:i.isPending,children:i.isPending?"Deleting...":"Delete"})]})]})]}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(Ke,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),b.jsx(Ke,{onClick:S,disabled:!a.trim(),children:"Save"})]})]})]})})}function iae({task:e,isDragPreview:t}){const{setActiveTask:n}=tae(),{isSelected:r,toggleSelection:i}=r3(),a=Wi(),s=r(e.id),o=k.useRef(null),[l,u]=k.useState(!1),[f,d]=k.useState(null),[p,m]=k.useState(null),[y,S]=k.useState(!1),g=k.useRef(!1);k.useEffect(()=>{const T=o.current;if(!(!T||t))return a0(Zie({element:T,getInitialData:()=>({type:"task",taskId:e.id,status:e.status}),onGenerateDragPreview:({nativeSetDragImage:w})=>{bIe({nativeSetDragImage:w,getOffset:_Ie({x:"16px",y:"8px"}),render:({container:C})=>{m(C)}})},onDragStart:()=>{u(!0),n(e),g.current=!0},onDrop:()=>{u(!1),n(null),m(null)}}),mw({element:T,getData:({input:w,element:C})=>{const R={type:"task",taskId:e.id,status:e.status};return Jie(R,{input:w,element:C,allowedEdges:["top","bottom"]})},canDrop:({source:w})=>w.data.taskId!==e.id,onDragEnter:({self:w})=>{d(_p(w.data))},onDrag:({self:w})=>{d(_p(w.data))},onDragLeave:()=>{d(null)},onDrop:()=>{d(null)}}))},[e,t,n]);const _=()=>{g.current=!1},v=()=>{if(g.current){g.current=!1;return}a({to:"/tasks/$taskId",params:{taskId:e.id}}),g.current=!1},x=b.jsxs("div",{className:"group/card relative",children:[!t&&b.jsx("div",{className:Ue("absolute left-2 top-2 z-20 transition-opacity",s?"opacity-100":"opacity-0 group-hover/card:opacity-100"),onPointerDown:T=>T.stopPropagation(),children:b.jsx(Ti,{checked:s,onCheckedChange:()=>i(e.id)})}),b.jsxs(xa,{ref:t?void 0:o,onPointerDown:_,onClick:v,className:Ue("transition-shadow hover:shadow-md relative cursor-grab active:cursor-grabbing",l&&"opacity-50",s&&"ring-2 ring-primary bg-primary/5"),children:[f&&b.jsx("div",{className:Ue("absolute left-0 right-0 h-0.5 bg-primary z-10",f==="top"&&"-top-1",f==="bottom"&&"-bottom-1")}),b.jsxs(vRe,{className:Ue("p-3 pb-1 flex flex-row items-start justify-between gap-2",!t&&"pl-8"),children:[b.jsx(yRe,{className:"text-sm font-medium leading-tight flex-1",children:e.title}),!t&&b.jsx("button",{type:"button",className:"shrink-0 p-0.5 -m-0.5 rounded hover:bg-muted transition-colors cursor-pointer",onClick:T=>{T.stopPropagation(),S(!0)},onPointerDown:T=>T.stopPropagation(),children:b.jsx(fe,{icon:XI,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),b.jsxs(Df,{className:"p-3 pt-1",children:[e.description&&b.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:e.description}),b.jsxs("div",{className:"mt-2 flex items-center gap-1 text-xs text-muted-foreground/70",children:[b.jsx(fe,{icon:Hi,size:12,strokeWidth:2}),b.jsx("span",{children:e.repoName}),e.prUrl&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/30",children:"•"}),b.jsx(fe,{icon:Ub,size:12,strokeWidth:2,className:"text-foreground"})]}),e.linearTicketId&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/30",children:"•"}),b.jsx(fe,{icon:hM,size:12,strokeWidth:2,className:"text-foreground"})]})]})]})]})]});return b.jsxs(b.Fragment,{children:[x,p&&xr.createPortal(b.jsx("div",{className:"w-72 max-w-[90vw]",children:b.jsx(iae,{task:e,isDragPreview:!0})}),p),b.jsx(rae,{task:e,open:y,onOpenChange:S})]})}const wIe={IN_PROGRESS:"border-t-status-in-progress",IN_REVIEW:"border-t-status-in-review",DONE:"border-t-status-done",CANCELED:"border-t-status-canceled"};function PH({status:e,tasks:t,isMobile:n}){const{t:r}=tn("common"),i=k.useRef(null),[a,s]=k.useState(!1),o=[...t].sort((l,u)=>u.position-l.position);return k.useEffect(()=>{const l=i.current;if(l)return mw({element:l,getData:()=>({type:"column",status:e}),canDrop:({source:u})=>u.data.type==="task",onDragEnter:()=>s(!0),onDragLeave:()=>s(!1),onDrop:()=>s(!1)})},[e]),b.jsxs("div",{ref:i,className:Ue("flex flex-col rounded-lg border border-t-4 bg-card",n?"h-full w-full":"h-full w-72 min-w-52 flex-shrink",wIe[e],a&&"ring-2 ring-primary ring-offset-2 ring-offset-background"),children:[!n&&b.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[b.jsx("h3",{className:"text-sm font-medium",children:r(`statuses.${e}`)}),b.jsx("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-muted px-1.5 text-xs font-medium",children:t.length})]}),b.jsx(Yy,{className:"min-h-0 flex-1",children:b.jsx("div",{className:"flex flex-col gap-2 p-2",children:o.map(l=>b.jsx(iae,{task:l},l.id))})})]})}function TIe(){const{selectedIds:e,clearSelection:t}=r3(),n=zxe(),[r,i]=k.useState(!0),a=e.size,s=()=>{n.mutate({ids:Array.from(e),deleteLinkedWorktrees:r},{onSuccess:()=>{t()}})};return a===0?null:b.jsx("div",{className:Ue("fixed inset-x-0 bottom-0 z-40 border-t bg-background/95 backdrop-blur-sm","animate-in slide-in-from-bottom-2 duration-200"),children:b.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between gap-4 px-4 py-3",children:[b.jsxs("span",{className:"text-sm text-muted-foreground",children:[a," task",a!==1?"s":""," selected"]}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Ke,{variant:"ghost",size:"sm",onClick:t,children:"Clear"}),b.jsxs(go,{children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"destructive",size:"sm",disabled:n.isPending}),children:n.isPending?"Deleting...":"Delete"}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsxs(Eo,{children:["Delete ",a," Task",a!==1?"s":""]}),b.jsxs(So,{children:["This will permanently delete ",a," task",a!==1?"s":"",". This action cannot be undone."]})]}),b.jsxs("div",{className:"flex items-center gap-2 py-2",children:[b.jsx(Ti,{id:"bulk-delete-worktrees",checked:r,onCheckedChange:o=>i(o===!0)}),b.jsx("label",{htmlFor:"bulk-delete-worktrees",className:"cursor-pointer text-sm",children:"Also delete linked worktrees"})]}),b.jsxs(_o,{children:[b.jsx(xo,{children:"Cancel"}),b.jsx(Rv,{onClick:s,variant:"destructive",disabled:n.isPending,children:n.isPending?"Deleting...":"Delete"})]})]})]})]})]})})}const Mk=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED"];function CIe({status:e}){const{t}=tn("common"),n=k.useRef(null),[r,i]=k.useState(!1);return k.useEffect(()=>{const a=n.current;if(a)return mw({element:a,getData:()=>({type:"column",status:e}),canDrop:({source:s})=>s.data.type==="task",onDragEnter:()=>i(!0),onDragLeave:()=>i(!1),onDrop:()=>i(!1)})},[e]),b.jsx("div",{ref:n,className:Ue("flex-1 rounded-lg border-2 border-dashed px-3 py-2 text-center text-xs font-medium transition-colors",r?"border-primary bg-primary/10 text-primary":"border-muted-foreground/30 text-muted-foreground"),children:t(`statuses.${e}`)})}function AIe({repoFilter:e,searchQuery:t}){const{t:n}=tn("common"),{data:r=[],isLoading:i}=RM(),a=$xe(),{activeTask:s}=tae(),{clearSelection:o,selectedIds:l}=r3(),[u,f]=k.useState("IN_PROGRESS");k.useEffect(()=>{const m=y=>{y.key==="Escape"&&l.size>0&&o()};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[o,l.size]);const d=k.useMemo(()=>{let m=r;return e&&(m=m.filter(y=>y.repoName===e)),t?.trim()?m=m.map(y=>({task:y,score:Math.max(no(y.title,t),no(y.description||"",t),no(y.branch||"",t),no(y.linearTicketId||"",t),no(y.prUrl||"",t))})).filter(({score:y})=>y>0).sort((y,S)=>S.score-y.score).map(({task:y})=>y):m=[...m].sort((y,S)=>new Date(S.createdAt).getTime()-new Date(y.createdAt).getTime()),m},[r,e,t]),p=k.useMemo(()=>{const m={IN_PROGRESS:0,IN_REVIEW:0,DONE:0,CANCELED:0};for(const y of d)m[y.status]++;return m},[d]);return k.useEffect(()=>Xie({canMonitor:({source:m})=>m.data.type==="task",onDrop:({source:m,location:y})=>{const S=y.current.dropTargets;if(S.length===0)return;const g=m.data.taskId,_=d.find(T=>T.id===g);if(!_)return;const v=S[0],x=v.data;if(x.type==="column"){const T=x.status;if(T!==_.status){const w=d.filter(C=>C.status===T);a.mutate({taskId:g,status:T,position:w.length})}}else if(x.type==="task"){const T=_p(v.data),w=x.status,C=d.filter(N=>N.status===w).sort((N,L)=>N.position-L.position),R=C.findIndex(N=>N.id===x.taskId);let O=R;T==="bottom"&&(O=R+1),_.status===w&&C.findIndex(L=>L.id===g)<R&&(O=Math.max(0,O-1)),(_.status!==w||O!==_.position)&&a.mutate({taskId:g,status:w,position:O})}}}),[d,a]),i?b.jsx("div",{className:"flex h-full items-center justify-center",children:b.jsx("p",{className:"text-muted-foreground",children:"Loading tasks..."})}):b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"border-b bg-background lg:hidden",children:b.jsx(su,{value:u,onValueChange:m=>f(m),children:b.jsx(ou,{variant:"line",className:"w-full justify-start px-4",children:Mk.map(m=>b.jsxs(li,{value:m,className:"gap-1.5",children:[b.jsx("span",{className:"truncate",children:n(`statuses.${m}`)}),b.jsx("span",{className:"text-muted-foreground",children:p[m]})]},m))})})}),b.jsx("div",{className:"hidden h-full justify-center gap-4 overflow-x-auto p-4 lg:flex",children:Mk.map(m=>b.jsx(PH,{status:m,tasks:d.filter(y=>y.status===m)},m))}),b.jsx("div",{className:"flex-1 overflow-y-auto p-4 lg:hidden",children:b.jsx(PH,{status:u,tasks:d.filter(m=>m.status===u),isMobile:!0})}),s&&b.jsx("div",{className:"fixed inset-x-0 bottom-0 flex gap-2 border-t bg-background/95 p-4 backdrop-blur-sm lg:hidden",children:Mk.filter(m=>m!==u).map(m=>b.jsx(CIe,{status:m},m))}),b.jsx(TIe,{})]})}function kIe(e){return b.jsx(SIe,{children:b.jsx(EIe,{children:b.jsx(AIe,{...e})})})}const aae=Ms("/tasks/")({component:OIe,validateSearch:e=>({repo:typeof e.repo=="string"?e.repo:void 0})});function OIe(){const{t:e}=tn("tasks"),{data:t=[]}=RM(),{repo:n}=aae.useSearch(),r=Wi(),[i,a]=k.useState(""),s=k.useCallback(l=>{r({to:"/tasks",search:l?{repo:l}:{},replace:!0})},[r]),o=k.useMemo(()=>{const l=new Set(t.map(u=>u.repoName));return Array.from(l).sort()},[t]);return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"relative min-w-0 flex-1 sm:max-w-64 sm:flex-none",children:[b.jsx(fe,{icon:Gx,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(vn,{value:i,onChange:l=>a(l.target.value),placeholder:e("searchPlaceholder"),className:"w-full pl-6"})]}),b.jsxs(ji,{value:n??"",onValueChange:l=>s(l||null),children:[b.jsxs(Bi,{size:"sm",className:"shrink-0 gap-1.5",children:[b.jsx(fe,{icon:ite,size:12,strokeWidth:2,className:"text-muted-foreground"}),b.jsx(Fi,{children:n??e("allRepos")})]}),b.jsxs(Ui,{className:"min-w-[160px]",children:[b.jsx(Cn,{value:"",children:e("allRepos")}),o.map(l=>b.jsx(Cn,{value:l,children:l},l))]})]})]}),b.jsx("div",{className:"flex-1 overflow-hidden",children:b.jsx(kIe,{repoFilter:n??null,searchQuery:i})})]})}function zo({className:e,size:t="default",...n}){return b.jsx(ixe,{"data-slot":"switch","data-size":t,className:Ue("data-checked:bg-primary data-unchecked:bg-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 dark:data-unchecked:bg-input/80 shrink-0 rounded-full border border-transparent focus-visible:ring-[2px] aria-invalid:ring-[2px] data-[size=default]:h-[16.6px] data-[size=default]:w-[28px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] peer group/switch relative inline-flex items-center transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...n,children:b.jsx(axe,{"data-slot":"switch-thumb",className:"bg-background dark:data-unchecked:bg-foreground dark:data-checked:bg-primary-foreground rounded-full group-data-[size=default]/switch:size-3.5 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 pointer-events-none block ring-0 transition-transform"})})}const RIe=Ms("/settings/")({component:NIe});function dc({title:e,children:t}){return b.jsxs("div",{className:"relative rounded-lg border border-border bg-card p-4 pt-6",children:[b.jsx("span",{className:"absolute -top-2.5 left-3 rounded bg-card px-2 text-xs font-medium text-muted-foreground",children:e}),t]})}function NIe(){const{t:e}=tn("settings"),{t}=tn("common"),{data:n,isLoading:r}=Tne(),{data:i,isLoading:a}=qy(),{data:s,isLoading:o}=DM(),{data:l,isLoading:u}=LM(),{data:f,isLoading:d}=PM(),{data:p,isLoading:m}=Xxe(),{data:y,isLoading:S}=Zxe(),{data:g,isLoading:_}=rwe(),{data:v,isLoading:x}=swe(),{data:T}=Ane(),w=lwe(),{savedLanguage:C,changeLanguage:R}=Rne(),{theme:O,syncClaudeCode:N,changeTheme:L}=uie(),{data:D}=ewe(),{data:z}=twe(),M=Cne(),V=nwe(),W=iwe(),$=owe(),q=awe(),[Y,B]=k.useState(""),[j,U]=k.useState(""),[K,H]=k.useState("vscode"),[J,se]=k.useState(""),[ae,Q]=k.useState(""),[G,Z]=k.useState(""),[ee,ne]=k.useState(""),[te,be]=k.useState(!1),[_e,he]=k.useState(!1),[ye,Ee]=k.useState(!1),[xe,ve]=k.useState(!1),[De,Te]=k.useState(!1),[pe,ce]=k.useState(""),[Re,Pe]=k.useState(!1),[ge,Le]=k.useState(""),[Ce,Ve]=k.useState(!1),[Ze,gt]=k.useState(""),[st,ot]=k.useState(""),[Fe,ht]=k.useState(!1),[Ne,ze]=k.useState(""),[et,lt]=k.useState("glm-4.5-air"),[pt,gn]=k.useState("glm-4.7"),[Ft,Nt]=k.useState("glm-4.7"),[ct,nn]=k.useState(!1),[Lt,yt]=k.useState("light-ansi"),[Bt,Ut]=k.useState("dark-ansi"),[zt,ft]=k.useState(!1),[yn,mr]=k.useState(!1),[Vr,Pr]=k.useState(!1),Ki=k.useRef(null);k.useEffect(()=>{n!==void 0&&B(String(n)),i!==void 0&&U(i),s!==void 0&&H(s),l!==void 0&&se(l),f!==void 0&&Q(String(f)),p!==void 0&&Z(p),y!==void 0&&ne(y)},[n,i,s,l,f,p,y]),k.useEffect(()=>{g&&(Ee(g.enabled),ve(g.sound?.enabled??!1),mr(!!g.sound?.customSoundFile),Te(g.slack?.enabled??!1),ce(g.slack?.webhookUrl??""),Pe(g.discord?.enabled??!1),Le(g.discord?.webhookUrl??""),Ve(g.pushover?.enabled??!1),gt(g.pushover?.appToken??""),ot(g.pushover?.userKey??""))},[g]),k.useEffect(()=>{v&&(ht(v.enabled),ze(v.apiKey??""),lt(v.haikuModel),gn(v.sonnetModel),Nt(v.opusModel))},[v]),k.useEffect(()=>{N!==void 0&&nn(N),D!==void 0&&yt(D),z!==void 0&&Ut(z)},[N,D,z]);const Kt=r||a||o||u||d||m||S||_||x,Ri=v&&(Fe!==v.enabled||Ne!==(v.apiKey??"")||et!==v.haikuModel||pt!==v.sonnetModel||Ft!==v.opusModel),gr=ct!==(N??!1)||Lt!==D||Bt!==z,br=g&&(ye!==g.enabled||xe!==(g.sound?.enabled??!1)||De!==(g.slack?.enabled??!1)||pe!==(g.slack?.webhookUrl??"")||Re!==(g.discord?.enabled??!1)||ge!==(g.discord?.webhookUrl??"")||Ce!==(g.pushover?.enabled??!1)||Ze!==(g.pushover?.appToken??"")||st!==(g.pushover?.userKey??"")),ss=K!==s||J!==l||ae!==String(f),Yi=Y!==String(n)||j!==i||G!==p||ee!==y||ss||br||Ri||gr,Ws=async()=>{const Ge=[];if(Y!==String(n)){const Rt=parseInt(Y,10);!isNaN(Rt)&&Rt>=1&&Rt<=65535&&Ge.push(new Promise(Cr=>{M.mutate({key:In.PORT,value:Rt},{onSettled:Cr})}))}if(j!==i&&Ge.push(new Promise(Rt=>{M.mutate({key:In.DEFAULT_GIT_REPOS_DIR,value:j},{onSettled:Rt})})),K!==s&&Ge.push(new Promise(Rt=>{M.mutate({key:In.EDITOR_APP,value:K},{onSettled:Rt})})),J!==l&&Ge.push(new Promise(Rt=>{M.mutate({key:In.EDITOR_HOST,value:J},{onSettled:Rt})})),ae!==String(f)){const Rt=parseInt(ae,10);!isNaN(Rt)&&Rt>=1&&Rt<=65535&&Ge.push(new Promise(Cr=>{M.mutate({key:In.EDITOR_SSH_PORT,value:Rt},{onSettled:Cr})}))}G!==p&&Ge.push(new Promise(Rt=>{M.mutate({key:In.LINEAR_API_KEY,value:G},{onSettled:Rt})})),ee!==y&&Ge.push(new Promise(Rt=>{M.mutate({key:In.GITHUB_PAT,value:ee},{onSettled:Rt})})),br&&Ge.push(new Promise(Rt=>{W.mutate({enabled:ye,sound:{enabled:xe},slack:{enabled:De,webhookUrl:pe},discord:{enabled:Re,webhookUrl:ge},pushover:{enabled:Ce,appToken:Ze,userKey:st}},{onSettled:Rt})})),Ri&&Ge.push(new Promise(Rt=>{$.mutate({enabled:Fe,apiKey:Ne||null,haikuModel:et,sonnetModel:pt,opusModel:Ft},{onSettled:Rt})})),gr&&(ct!==(N??!1)&&Ge.push(new Promise(Rt=>{M.mutate({key:In.SYNC_CLAUDE_CODE_THEME,value:ct},{onSettled:Rt})})),Lt!==D&&Ge.push(new Promise(Rt=>{M.mutate({key:In.CLAUDE_CODE_LIGHT_THEME,value:Lt},{onSettled:Rt})})),Bt!==z&&Ge.push(new Promise(Rt=>{M.mutate({key:In.CLAUDE_CODE_DARK_THEME,value:Bt},{onSettled:Rt})}))),await Promise.all(Ge),he(!0),setTimeout(()=>he(!1),2e3)},ig=()=>{V.mutate(In.PORT,{onSuccess:Ge=>{Ge.value!==null&&B(String(Ge.value))}})},hd=()=>{V.mutate(In.DEFAULT_GIT_REPOS_DIR,{onSuccess:Ge=>{Ge.value&&U(String(Ge.value))}})},xl=()=>{V.mutate(In.EDITOR_APP,{onSuccess:Ge=>{Ge.value!==null&&Ge.value!==void 0&&H(Ge.value)}})},wl=()=>{V.mutate(In.EDITOR_HOST,{onSuccess:Ge=>{se(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Vs=()=>{V.mutate(In.EDITOR_SSH_PORT,{onSuccess:Ge=>{Ge.value!==null&&Ge.value!==void 0&&Q(String(Ge.value))}})},os=()=>{V.mutate(In.LINEAR_API_KEY,{onSuccess:Ge=>{Z(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Tl=()=>{V.mutate(In.GITHUB_PAT,{onSuccess:Ge=>{ne(Ge.value!==null&&Ge.value!==void 0?String(Ge.value):"")}})},Ni=async Ge=>{q.mutate(Ge,{onSuccess:Rt=>{Rt.success?ln.success(e("notifications.testSuccess",{channel:Ge})):ln.error(e("notifications.testFailed",{channel:Ge,error:Rt.error}))},onError:Rt=>{ln.error(e("notifications.testFailed",{channel:Ge,error:Rt.message}))}})},Tr=async Ge=>{const Rt=Ge.target.files?.[0];if(Rt){Pr(!0);try{const Cr=new FormData;Cr.append("file",Rt);const Cl=await fetch("/api/uploads/sound",{method:"POST",body:Cr});if(!Cl.ok){const Ia=await Cl.json();throw new Error(Ia.error||"Upload failed")}mr(!0),ln.success(e("notifications.soundUploaded"))}catch(Cr){ln.error(e("notifications.soundUploadFailed",{error:Cr instanceof Error?Cr.message:"Unknown error"}))}finally{Pr(!1),Ki.current&&(Ki.current.value="")}}},mi=async()=>{try{if(!(await fetch("/api/uploads/sound",{method:"DELETE"})).ok)throw new Error("Delete failed");mr(!1),ln.success(e("notifications.soundDeleted"))}catch{ln.error(e("notifications.soundDeleteFailed"))}};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-2",children:b.jsx("h1",{className:"text-sm font-medium",children:e("title")})}),b.jsx("div",{className:"flex-1 overflow-auto p-6",children:b.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[b.jsx(dc,{title:e("sections.server"),children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.port.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(vn,{type:"number",min:1,max:65535,value:Y,onChange:Ge=>B(Ge.target.value),placeholder:"7777",disabled:Kt,className:"w-24 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:ig,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.port.description")})]})}),b.jsx(dc,{title:e("sections.paths"),children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.gitReposDir.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(vn,{value:j,onChange:Ge=>U(Ge.target.value),placeholder:"~/projects",disabled:Kt,className:"flex-1 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>be(!0),disabled:Kt,title:t("buttons.browse"),children:b.jsx(fe,{icon:Hi,size:14,strokeWidth:2})}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:hd,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.gitReposDir.description")})]})}),b.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[b.jsx(dc,{title:e("sections.editor"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.app.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs(ji,{value:K,onValueChange:Ge=>H(Ge),children:[b.jsx(Bi,{className:"w-32",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"vscode",children:"VS Code"}),b.jsx(Cn,{value:"cursor",children:"Cursor"}),b.jsx(Cn,{value:"windsurf",children:"Windsurf"}),b.jsx(Cn,{value:"zed",children:"Zed"})]})]}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:xl,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.app.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.host.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(vn,{value:J,onChange:Ge=>se(Ge.target.value),placeholder:e("fields.editor.host.placeholder"),disabled:Kt,className:"flex-1 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:wl,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.host.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.editor.sshPort.label")}),b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(vn,{type:"number",min:1,max:65535,value:ae,onChange:Ge=>Q(Ge.target.value),placeholder:"22",disabled:Kt,className:"w-20 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Vs,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.editor.sshPort.description")})]})]})}),b.jsx(dc,{title:e("sections.integrations"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.linear.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(vn,{type:"password",value:G,onChange:Ge=>Z(Ge.target.value),placeholder:"lin_api_...",disabled:Kt,className:"flex-1 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:os,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.linear.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.github.label")}),b.jsxs("div",{className:"flex flex-1 items-center gap-2",children:[b.jsx(vn,{type:"password",value:ee,onChange:Ge=>ne(Ge.target.value),placeholder:"ghp_...",disabled:Kt,className:"flex-1 font-mono text-sm"}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Tl,disabled:Kt||V.isPending,title:t("buttons.reset"),children:b.jsx(fe,{icon:Id,size:14,strokeWidth:2})})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.github.description")})]})]})})]}),b.jsx(dc,{title:e("sections.zai"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.enable")}),b.jsx(zo,{checked:Fe,onCheckedChange:ht,disabled:Kt})]}),Fe&&b.jsxs(b.Fragment,{children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.apiKey")}),b.jsx(vn,{type:"password",value:Ne,onChange:Ge=>ze(Ge.target.value),placeholder:"zai_...",disabled:Kt,className:"flex-1 font-mono text-sm"})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-20 sm:pl-2",children:e("fields.zai.description")})]}),b.jsxs("div",{className:"space-y-3 border-t border-border pt-4",children:[b.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:e("fields.zai.modelMappings")}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.haiku")}),b.jsx(vn,{value:et,onChange:Ge=>lt(Ge.target.value),placeholder:"glm-4.5-air",disabled:Kt,className:"flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.sonnet")}),b.jsx(vn,{value:pt,onChange:Ge=>gn(Ge.target.value),placeholder:"glm-4.7",disabled:Kt,className:"flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-20 sm:shrink-0",children:e("fields.zai.opus")}),b.jsx(vn,{value:Ft,onChange:Ge=>Nt(Ge.target.value),placeholder:"glm-4.7",disabled:Kt,className:"flex-1 font-mono text-sm"})]})]})]})]})}),b.jsx(dc,{title:e("sections.notifications"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-40 sm:shrink-0",children:e("notifications.enable")}),b.jsx(zo,{checked:ye,onCheckedChange:Ee,disabled:Kt})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(zo,{checked:xe,onCheckedChange:ve,disabled:Kt||!ye}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.sound")}),b.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[b.jsx("input",{ref:Ki,type:"file",accept:"audio/mpeg,audio/mp3,audio/wav,audio/ogg",className:"hidden",onChange:Tr}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Ki.current?.click(),disabled:Kt||!ye||!xe||Vr,title:e("notifications.uploadSound"),children:Vr?b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:H1e,size:14,strokeWidth:2})}),yn&&b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:mi,disabled:Kt||!ye||!xe,title:e("notifications.deleteSound"),children:b.jsx(fe,{icon:$c,size:14,strokeWidth:2})}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Ni("sound"),disabled:Kt||!ye||!xe||q.isPending,title:e("notifications.testSound"),children:q.isPending?b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:d_,size:14,strokeWidth:2})})]})]}),yn&&b.jsx("p",{className:"ml-10 text-xs text-muted-foreground",children:e("notifications.customSoundActive")})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(zo,{checked:De,onCheckedChange:Te,disabled:Kt||!ye}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.slack")}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Ni("slack"),disabled:Kt||!ye||!De||!pe||q.isPending,title:e("notifications.slack"),children:q.isPending?b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:d_,size:14,strokeWidth:2})})]}),De&&b.jsx(vn,{type:"password",value:pe,onChange:Ge=>ce(Ge.target.value),placeholder:"https://hooks.slack.com/services/...",disabled:Kt||!ye,className:"ml-6 flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(zo,{checked:Re,onCheckedChange:Pe,disabled:Kt||!ye}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.discord")}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Ni("discord"),disabled:Kt||!ye||!Re||!ge||q.isPending,title:e("notifications.discord"),children:q.isPending?b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:d_,size:14,strokeWidth:2})})]}),Re&&b.jsx(vn,{type:"password",value:ge,onChange:Ge=>Le(Ge.target.value),placeholder:"https://discord.com/api/webhooks/...",disabled:Kt||!ye,className:"ml-6 flex-1 font-mono text-sm"})]}),b.jsxs("div",{className:"space-y-2 pl-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(zo,{checked:Ce,onCheckedChange:Ve,disabled:Kt||!ye}),b.jsx("label",{className:"text-sm text-muted-foreground",children:e("notifications.pushover")}),b.jsx(Ke,{variant:"ghost",size:"icon",className:"ml-auto h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>Ni("pushover"),disabled:Kt||!ye||!Ce||!Ze||!st||q.isPending,title:e("notifications.pushover"),children:q.isPending?b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:d_,size:14,strokeWidth:2})})]}),Ce&&b.jsxs("div",{className:"ml-6 space-y-2",children:[b.jsx(vn,{type:"password",value:Ze,onChange:Ge=>gt(Ge.target.value),placeholder:e("notifications.appToken"),disabled:Kt||!ye,className:"flex-1 font-mono text-sm"}),b.jsx(vn,{type:"password",value:st,onChange:Ge=>ot(Ge.target.value),placeholder:e("notifications.userKey"),disabled:Kt||!ye,className:"flex-1 font-mono text-sm"})]})]})]})}),b.jsx(dc,{title:e("sections.appearance"),children:b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.language.label")}),b.jsxs(ji,{value:C??"auto",onValueChange:Ge=>R(Ge==="auto"?null:Ge),children:[b.jsx(Bi,{className:"w-40",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"auto",children:e("fields.language.options.auto")}),b.jsx(Cn,{value:"en",children:e("fields.language.options.en")}),b.jsx(Cn,{value:"zh",children:e("fields.language.options.zh")})]})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.language.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.theme.label")}),b.jsxs(ji,{value:O??"system",onValueChange:Ge=>L(Ge),children:[b.jsx(Bi,{className:"w-40",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"system",children:e("fields.theme.options.system")}),b.jsx(Cn,{value:"light",children:e("fields.theme.options.light")}),b.jsx(Cn,{value:"dark",children:e("fields.theme.options.dark")})]})]})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.theme.description")})]}),b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-32 sm:shrink-0",children:e("fields.syncClaudeTheme.label")}),b.jsx(zo,{checked:ct,onCheckedChange:nn})]}),b.jsx("p",{className:"text-xs text-muted-foreground sm:ml-32 sm:pl-2",children:e("fields.syncClaudeTheme.description")})]}),ct&&b.jsxs("div",{className:"space-y-3 border-t border-border pt-4 sm:ml-32 sm:pl-2",children:[b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.light")}),b.jsxs(ji,{value:Lt,onValueChange:Ge=>yt(Ge),children:[b.jsx(Bi,{className:"w-40",children:b.jsx(Fi,{})}),b.jsx(Ui,{children:gz.filter(Ge=>Ge.startsWith("light")).map(Ge=>b.jsx(Cn,{value:Ge,children:e(`fields.claudeCodeTheme.options.${Ge}`)},Ge))})]})]}),b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[b.jsx("label",{className:"text-sm text-muted-foreground sm:w-24 sm:shrink-0",children:e("fields.claudeCodeTheme.dark")}),b.jsxs(ji,{value:Bt,onValueChange:Ge=>Ut(Ge),children:[b.jsx(Bi,{className:"w-40",children:b.jsx(Fi,{})}),b.jsx(Ui,{children:gz.filter(Ge=>Ge.startsWith("dark")).map(Ge=>b.jsx(Cn,{value:Ge,children:e(`fields.claudeCodeTheme.options.${Ge}`)},Ge))})]})]})]})]})}),T?.enabled&&b.jsx(dc,{title:e("sections.developer"),children:b.jsx("div",{className:"space-y-1",children:b.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[b.jsx("div",{className:"flex-1",children:b.jsx("p",{className:"text-sm text-muted-foreground",children:e("developer.restartDescription")})}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:()=>{const Ge=T?.startedAt;ft(!0),w.mutate(void 0,{onSuccess:()=>{(async()=>{for(let Cl=0;Cl<120;Cl++){await new Promise(Ia=>setTimeout(Ia,500));try{const Ia=await fetch("/api/config/developer-mode");if(Ia.ok&&(await Ia.json()).startedAt!==Ge){window.location.reload();return}}catch{}}ft(!1),ln.error(e("developer.restartFailed"),{description:e("developer.checkLogs")})})()},onError:Rt=>{ft(!1),ln.error(e("developer.restartFailed"),{description:Rt.message})}})},disabled:w.isPending||zt,className:"shrink-0 gap-2",children:[(w.isPending||zt)&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),e(zt?"developer.restarting":"developer.restartButton")]})]})})})]})}),b.jsx("div",{className:"shrink-0 border-t border-border bg-background px-6 py-3",children:b.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-end gap-2",children:[_e&&b.jsxs("span",{className:"flex items-center gap-1 text-xs text-accent",children:[b.jsx(fe,{icon:hl,size:12,strokeWidth:2}),t("status.saved")]}),b.jsx(Ke,{size:"sm",onClick:Ws,disabled:!Yi||Kt||M.isPending,children:t("buttons.save")})]})}),b.jsx(Nm,{open:te,onOpenChange:be,onSelect:Ge=>U(Ge),initialPath:j||void 0})]})}const gw="";function IIe(){return qn({queryKey:["github-user"],queryFn:async()=>{const e=await fetch(`${gw}/api/github/user`);return e.ok?e.json():null},staleTime:600*1e3,retry:!1})}function DIe(){return qn({queryKey:["github-orgs"],queryFn:async()=>{const e=await fetch(`${gw}/api/github/orgs`);return e.ok?e.json():[]},staleTime:600*1e3})}function LIe(e,t,n){return qn({queryKey:["github-issues",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${gw}/api/github/issues?${r}`);if(!i.ok)throw new Error("Failed to fetch issues");return i.json()},staleTime:300*1e3})}function PIe(e,t,n){return qn({queryKey:["github-prs",e,t,n],queryFn:async()=>{const r=new URLSearchParams({filter:e});t&&r.set("viboraReposOnly","true"),n&&r.set("org",n);const i=await fetch(`${gw}/api/github/prs?${r}`);if(!i.ok)throw new Error("Failed to fetch PRs");return i.json()},staleTime:300*1e3})}function MIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=tn("review"),{t:i}=tn("common"),{data:a,isLoading:s,error:o}=LIe(e,t,n);if(s)return b.jsx("div",{className:"flex h-48 items-center justify-center",children:b.jsx(fe,{icon:en,size:24,className:"animate-spin text-muted-foreground"})});if(o)return b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:ts,size:24}),b.jsx("p",{className:"text-sm",children:r("issues.failedToLoad")}),b.jsx("p",{className:"text-xs",children:o.message})]});const l={assigned:"issues.empty.assigned",created:"issues.empty.created",mentioned:"issues.empty.mentioned"};return a?.length?b.jsxs("div",{className:"space-y-4",children:[b.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>b.jsx(jIe,{issue:u},u.id))})]}):b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:hl,size:24}),b.jsx("p",{className:"text-sm",children:r(l[e])})]})}function jIe({issue:e}){return b.jsx(xa,{className:"transition-colors hover:border-border/80",children:b.jsx(Df,{className:"py-4",children:b.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[b.jsx("div",{className:"flex items-start gap-2",children:b.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),b.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:b.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]})}),e.labels.length>0&&b.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(t=>b.jsx(co,{className:"text-xs",style:{backgroundColor:`#${t.color}20`,color:`#${t.color}`,borderColor:`#${t.color}40`},children:t.name},t.name)),e.labels.length>3&&b.jsxs(co,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}function FIe({filter:e,viboraReposOnly:t,org:n}){const{t:r}=tn("review"),{t:i}=tn("common"),{data:a,isLoading:s,error:o}=PIe(e,t,n);if(s)return b.jsx("div",{className:"flex h-48 items-center justify-center",children:b.jsx(fe,{icon:en,size:24,className:"animate-spin text-muted-foreground"})});if(o)return b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:ts,size:24}),b.jsx("p",{className:"text-sm",children:r("prs.failedToLoad")}),b.jsx("p",{className:"text-xs",children:o.message})]});const l={all:"prs.empty.all",created:"prs.empty.created",assigned:"prs.empty.assigned",review_requested:"prs.empty.reviewRequested",mentioned:"prs.empty.mentioned"};return a?.length?b.jsxs("div",{className:"space-y-4",children:[b.jsx("div",{className:"text-xs text-muted-foreground",children:i(a.length===1?"results.one":"results.other",{count:a.length})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:a.map(u=>b.jsx(BIe,{pr:u},u.id))})]}):b.jsxs("div",{className:"flex h-48 flex-col items-center justify-center gap-2 text-muted-foreground",children:[b.jsx(fe,{icon:hl,size:24}),b.jsx("p",{className:"text-sm",children:r(l[e])})]})}function BIe({pr:e}){const{t}=tn("review");return b.jsx(xa,{className:"transition-colors hover:border-border/80",children:b.jsx(Df,{className:"py-4",children:b.jsxs("a",{href:e.htmlUrl,target:"_blank",rel:"noopener noreferrer",className:"block space-y-2",children:[b.jsx("div",{className:"flex items-start gap-2",children:b.jsx("span",{className:"line-clamp-2 text-sm font-medium",children:e.title})}),b.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[b.jsxs("span",{className:"font-mono",children:[e.repository.fullName,"#",e.number]}),e.draft&&b.jsx(co,{variant:"secondary",className:Ue("text-xs","bg-muted-foreground/20 text-muted-foreground"),children:t("prs.draft")})]}),b.jsxs("div",{className:"flex items-center gap-2",children:[e.author.avatarUrl&&b.jsx("img",{src:e.author.avatarUrl,alt:e.author.login,className:"h-4 w-4 rounded-full"}),b.jsx("span",{className:"text-xs text-muted-foreground",children:e.author.login})]}),e.labels.length>0&&b.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.labels.slice(0,3).map(n=>b.jsx(co,{className:"text-xs",style:{backgroundColor:`#${n.color}20`,color:`#${n.color}`,borderColor:`#${n.color}40`},children:n.name},n.name)),e.labels.length>3&&b.jsxs(co,{variant:"secondary",className:"text-xs",children:["+",e.labels.length-3]})]})]})})})}const UIe=Ms("/review/")({component:$Ie});function $Ie(){const{t:e}=tn("review"),[t,n]=k.useState("prs"),[r,i]=k.useState("review_requested"),[a,s]=k.useState("assigned"),[o,l]=k.useState(!1),[u,f]=k.useState(""),{data:d,isLoading:p}=IIe(),{data:m=[]}=DIe();return!p&&!d?b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2"}),b.jsx("div",{className:"flex flex-1 items-center justify-center p-8",children:b.jsxs("div",{className:"max-w-md space-y-4 text-center",children:[b.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:b.jsx(fe,{icon:P1e,size:24,className:"text-muted-foreground"})}),b.jsx("h2",{className:"text-lg font-medium",children:e("github.tokenRequired")}),b.jsx("p",{className:"text-sm text-muted-foreground",children:e("github.tokenDescription")}),b.jsxs("div",{className:"rounded-lg border border-border bg-muted/50 p-4 text-left",children:[b.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("github.requiredScopes")}),b.jsxs("ul",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"repo"})," ",e("github.scopes.repo")]}),b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"read:user"})," ",e("github.scopes.readUser")]}),b.jsxs("li",{children:["• ",b.jsx("code",{className:"rounded bg-muted px-1",children:"read:org"})," ",e("github.scopes.readOrg")]})]})]}),b.jsxs("div",{className:"flex flex-col gap-2",children:[b.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,read:user,read:org&description=Vibora",target:"_blank",rel:"noopener noreferrer",children:b.jsxs(Ke,{variant:"outline",size:"sm",className:"w-full",children:[b.jsx(fe,{icon:M1e,size:14,"data-slot":"icon"}),e("github.generateToken")]})}),b.jsx(wi,{to:"/settings",children:b.jsx(Ke,{size:"sm",className:"w-full",children:e("github.goToSettings")})})]})]})})]}):b.jsx("div",{className:"flex h-full flex-col",children:b.jsxs(su,{value:t,onValueChange:y=>n(y),className:"flex flex-1 flex-col overflow-hidden",children:[b.jsxs("div",{className:"flex shrink-0 flex-col border-b border-border bg-background sm:flex-row sm:items-center sm:justify-between",children:[b.jsxs("div",{className:"flex items-center justify-between px-4 py-1 max-sm:px-2",children:[b.jsxs(ou,{variant:"line",children:[b.jsx(li,{value:"prs",children:e("tabs.pullRequests")}),b.jsx(li,{value:"issues",children:e("tabs.issues")})]}),b.jsx("label",{className:"flex cursor-pointer items-center gap-2 text-xs sm:hidden",title:e("filters.viboraReposOnly"),children:b.jsx(zo,{checked:o,onCheckedChange:l,disabled:!!u})})]}),b.jsxs("div",{className:"flex items-center gap-2 border-t border-border px-4 py-1.5 sm:gap-4 sm:border-t-0 sm:px-4 sm:py-1",children:[t==="prs"?b.jsxs(ji,{value:r,onValueChange:y=>i(y),children:[b.jsx(Bi,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"created",children:e("filters.pr.created")}),b.jsx(Cn,{value:"assigned",children:e("filters.pr.assigned")}),b.jsx(Cn,{value:"review_requested",children:e("filters.pr.reviewRequested")}),b.jsx(Cn,{value:"mentioned",children:e("filters.pr.mentioned")})]})]}):b.jsxs(ji,{value:a,onValueChange:y=>s(y),children:[b.jsx(Bi,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"assigned",children:e("filters.issue.assigned")}),b.jsx(Cn,{value:"created",children:e("filters.issue.created")}),b.jsx(Cn,{value:"mentioned",children:e("filters.issue.mentioned")})]})]}),b.jsxs(ji,{value:u,onValueChange:y=>f(y||""),children:[b.jsx(Bi,{size:"sm",className:"flex-1 sm:flex-initial",children:b.jsx(Fi,{children:u||e("filters.allOrgs")})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"",children:e("filters.allOrganizations")}),m.map(y=>b.jsx(Cn,{value:y.login,children:y.login},y.login))]})]}),b.jsxs("label",{className:"hidden cursor-pointer items-center gap-2 text-xs sm:flex",title:e("filters.viboraReposOnly"),children:[b.jsx(zo,{checked:o,onCheckedChange:l,disabled:!!u}),b.jsx("span",{className:"text-muted-foreground",children:e("filters.viboraReposOnly")})]})]})]}),b.jsx(Pi,{value:"prs",className:"flex-1 overflow-auto p-4",children:b.jsx(FIe,{filter:r,viboraReposOnly:o,org:u||void 0})}),b.jsx(Pi,{value:"issues",className:"flex-1 overflow-auto p-4",children:b.jsx(MIe,{filter:a,viboraReposOnly:o,org:u||void 0})})]})})}function zIe(){const e=Wi(),t=Mm();return{openInTerminal:k.useCallback((r,i)=>{if(At.ws.info("useOpenInTerminal: openInTerminal called",{directory:r,name:i,connected:t.connected,tabCount:t.tabs.items.length,terminalCount:t.terminals.items.length}),!t.connected){At.ws.warn("useOpenInTerminal: not connected, aborting"),ln.error("Terminal not connected",{description:"Please wait for the connection to establish"});return}const a=t.terminals.items.find(o=>o.cwd===r);if(a){if(a.tabId){At.ws.info("useOpenInTerminal: navigating to terminal tab",{terminalId:a.id,tabId:a.tabId}),e({to:"/terminals",search:{tab:a.tabId}});return}At.ws.info("useOpenInTerminal: adopting orphan terminal into new tab",{terminalId:a.id,name:i,directory:r}),t.createTab(i,void 0,r,a.id),e({to:"/terminals"});return}const s=t.tabs.items.find(o=>o.directory===r);if(s){At.ws.info("useOpenInTerminal: navigating to existing tab",{tabId:s.id}),e({to:"/terminals",search:{tab:s.id}});return}At.ws.info("useOpenInTerminal: creating new tab",{name:i,directory:r}),t.createTab(i,void 0,r),e({to:"/terminals"})},[t,e]),connected:t.connected}}const HIe={vscode:"vscode",cursor:"cursor",windsurf:"windsurf",zed:"zed"};function sae(e,t,n,r){const i=HIe[t];if(!n)return`${i}://file${e}`;const a=r!==22?`${n}:${r}`:n;return`${i}://vscode-remote/ssh-remote+${a}${e}`}function WIe(e){return{vscode:"VS Code",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed"}[e]}function oae(e){window.parent!==window?window.parent.postMessage({type:"vibora:openUrl",url:e},"*"):window.open(e,"_blank")}function VIe({delay:e=0,...t}){return b.jsx(xxe,{"data-slot":"tooltip-provider",delay:e,...t})}function GIe({...e}){return b.jsx(VIe,{children:b.jsx(fxe,{"data-slot":"tooltip",...e})})}function qIe({...e}){return b.jsx(gxe,{"data-slot":"tooltip-trigger",...e})}function KIe({className:e,side:t="top",sideOffset:n=4,align:r="center",alignOffset:i=0,children:a,...s}){return b.jsx(vxe,{children:b.jsx(yxe,{align:r,alignOffset:i,side:t,sideOffset:n,className:"isolate z-50",children:b.jsxs(Exe,{"data-slot":"tooltip-content",className:Ue("data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-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 rounded-md px-3 py-1.5 text-xs **:data-[slot=kbd]:rounded-md bg-foreground text-background z-50 w-fit max-w-xs origin-(--transform-origin)",e),...s,children:[a,b.jsx(Sxe,{className:"size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground z-50 data-[side=bottom]:top-1 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const lae="";function YIe(e){return qn({queryKey:["copier-questions",e],queryFn:()=>$t(`${lae}/api/copier/questions?source=${encodeURIComponent(e)}`),enabled:!!e,staleTime:300*1e3,retry:!1})}function XIe(){const{data:e,...t}=Ky();return{...t,data:e?.filter(n=>n.isCopierTemplate)??[]}}function ZIe(){const e=wr();return zn({mutationFn:t=>$t(`${lae}/api/copier/create`,{method:"POST",body:JSON.stringify(t)}),onSuccess:()=>{e.invalidateQueries({queryKey:["repositories"]})}})}function QIe(){const{t:e}=tn("repositories"),t=Wi(),[n,r]=k.useState(!1),[i,a]=k.useState("template"),[s,o]=k.useState(!1),[l,u]=k.useState(!1),f=k.useRef(null),[d,p]=k.useState(""),[m,y]=k.useState(""),[S,g]=k.useState({}),[_,v]=k.useState(""),[x,T]=k.useState(""),[w,C]=k.useState(null),[R,O]=k.useState(!1),[N,L]=k.useState(!1),{data:D}=XIe(),{data:z}=qy(),M=d||m,{data:V,isLoading:W,error:$}=YIe(i==="questions"||i==="output"?M:null),q=ZIe();k.useEffect(()=>{n&&(a("template"),p(""),y(""),g({}),v(z||""),T(""),C(null),O(!1),L(!1))},[n,z]),k.useEffect(()=>{V?.questions&&g(G=>{const Z={...G};for(const ee of V.questions)Z[ee.name]===void 0&&ee.default!==void 0&&(Z[ee.name]=ee.default);return Z})},[V]);const Y=k.useCallback(()=>{const G=f.current;if(!G)return;const Z=G.scrollHeight>G.clientHeight&&G.scrollTop+G.clientHeight<G.scrollHeight-10;u(Z)},[]);k.useEffect(()=>{const G=setTimeout(Y,100);return()=>clearTimeout(G)},[i,V,Y]);const B=k.useCallback(()=>{Y()},[Y]),j=()=>{i==="template"?a("questions"):i==="questions"&&a("output")},U=()=>{i==="questions"?a("template"):i==="output"&&a("questions")},K=()=>{a("creating"),C(null),q.mutate({templateSource:M,outputPath:_,answers:S,projectName:x,trust:R},{onSuccess:G=>{r(!1),t({to:"/repositories/$repoId",params:{repoId:G.repositoryId}})},onError:G=>{C(G.message),(G.message.includes("unsafe")||G.message.includes("--trust"))&&L(!0),a("output")}})},H=G=>{const Z=S[G.name],ee=be=>g(_e=>({..._e,[G.name]:be})),te=G.default===void 0||typeof G.default=="string"&&G.default.includes("{{")?`${G.name} *`:G.name;switch(G.type){case"bool":return b.jsxs(ir,{children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Ti,{checked:Z,onCheckedChange:ee}),b.jsx(ar,{className:"cursor-pointer",children:te})]}),G.help&&b.jsx(qa,{children:G.help})]},G.name);case"int":case"float":return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),b.jsx(vn,{type:"number",value:Z,onChange:be=>ee(G.type==="int"?parseInt(be.target.value):parseFloat(be.target.value)),step:G.type==="float"?"any":1}),G.help&&b.jsx(qa,{children:G.help})]},G.name);default:{if(G.choices&&G.choices.length>0)return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),b.jsxs(ji,{value:String(Z??""),onValueChange:ee,children:[b.jsx(Bi,{className:"w-full",children:b.jsx(Fi,{})}),b.jsx(Ui,{children:G.choices.map(_e=>b.jsx(Cn,{value:String(_e.value),children:_e.label},String(_e.value)))})]}),G.help&&b.jsx(qa,{children:G.help})]},G.name);const be=G.type==="yaml"||G.type==="json";return b.jsxs(ir,{children:[b.jsx(ar,{children:te}),be?b.jsx(bM,{value:String(Z??""),onChange:_e=>ee(_e.target.value),rows:4}):b.jsx(vn,{value:String(Z??""),onChange:_e=>ee(_e.target.value)}),G.help&&b.jsx(qa,{children:G.help})]},G.name)}}},J=!!M,se=V?.questions.filter(G=>{if(G.default!==void 0&&!(typeof G.default=="string"&&G.default.includes("{{")))return!1;const ee=S[G.name];return ee==null||ee===""})??[],ae=V&&!W&&se.length===0,Q=x.trim()&&_.trim();return b.jsxs(b.Fragment,{children:[b.jsxs(ku,{open:n,onOpenChange:r,children:[b.jsxs(Tte,{render:b.jsx(Ke,{variant:"outline",size:"sm"}),children:[b.jsx(fe,{icon:k1e,size:16,strokeWidth:2,"data-slot":"icon"}),e("newProject.button")]}),b.jsxs(Ou,{className:"sm:max-w-lg max-h-[80dvh] flex flex-col overflow-hidden",children:[b.jsxs(Jc,{className:"shrink-0",children:[b.jsxs(ed,{className:"flex items-center gap-2",children:[e("newProject.title"),b.jsxs(GIe,{children:[b.jsx(qIe,{className:"text-muted-foreground hover:text-foreground transition-colors",children:b.jsx(fe,{icon:ste,size:16,strokeWidth:2})}),b.jsx(KIe,{side:"bottom",align:"start",className:"max-w-xs",children:b.jsxs("p",{children:[e("newProject.steps.template.help")," ",b.jsx("a",{href:"https://copier.readthedocs.io/",target:"_blank",rel:"noopener noreferrer",className:"underline hover:opacity-80",children:e("newProject.steps.template.learnMore")})]})})]})]}),b.jsxs(zy,{children:[i==="template"&&e("newProject.steps.template.description"),i==="questions"&&e("newProject.steps.questions.description"),i==="output"&&e("newProject.steps.output.description"),i==="creating"&&e("newProject.steps.creating.description")]})]}),b.jsx("div",{className:"flex gap-2 shrink-0 mt-2",children:["template","questions","output"].map((G,Z)=>b.jsx("div",{className:Ue("flex-1 h-1 rounded",i===G||["template","questions","output"].indexOf(i)>Z||i==="creating"?"bg-primary":"bg-muted")},G))}),b.jsxs("div",{ref:f,onScroll:B,className:"flex-1 overflow-y-auto min-h-0 py-4 scrollbar-visible",children:[i==="template"&&b.jsxs(pf,{children:[b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.template.savedTemplates")}),b.jsxs(ji,{value:d,onValueChange:G=>{p(G??""),y("")},children:[b.jsx(Bi,{className:"w-full",children:b.jsx(Fi,{children:d?D?.find(G=>G.id===d)?.displayName:b.jsx("span",{className:"text-muted-foreground",children:e("newProject.steps.template.selectTemplate")})})}),b.jsx(Ui,{children:D?.map(G=>b.jsx(Cn,{value:G.id,children:G.displayName},G.id))})]})]}),b.jsx("div",{className:"text-center text-muted-foreground text-xs py-2",children:e("newProject.steps.template.or")}),b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.template.customUrl")}),b.jsx(vn,{value:m,onChange:G=>{y(G.target.value),p("")},placeholder:"https://github.com/user/template or /path/to/template"}),b.jsx(qa,{children:e("newProject.steps.template.customUrlHelp")})]})]}),i==="questions"&&b.jsxs(pf,{children:[W&&b.jsx("div",{className:"flex items-center justify-center py-8",children:b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),$&&b.jsx("div",{className:"text-destructive text-sm py-4",children:$.message}),V?.questions.map(H),V&&V.questions.length===0&&b.jsx("div",{className:"text-muted-foreground text-sm py-4",children:e("newProject.steps.questions.noQuestions")})]}),i==="output"&&b.jsxs(pf,{children:[b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.output.projectName")}),b.jsx(vn,{value:x,onChange:G=>T(G.target.value),placeholder:"my-new-project"})]}),b.jsxs(ir,{children:[b.jsx(ar,{children:e("newProject.steps.output.outputDirectory")}),b.jsxs(Ke,{type:"button",variant:"outline",className:"w-full justify-start font-normal",onClick:()=>o(!0),children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2,className:"mr-2"}),_||e("newProject.steps.output.selectDirectory")]})]}),x&&_&&b.jsxs(qa,{className:"font-mono text-xs",children:[e("newProject.steps.output.willCreate"),": ",_,"/",x]}),w&&b.jsx("div",{className:"text-destructive text-sm mt-2 p-2 bg-destructive/10 rounded",children:w}),N&&b.jsx(ir,{children:b.jsxs("div",{className:"flex items-start gap-2",children:[b.jsx(Ti,{checked:R,onCheckedChange:G=>O(G===!0),className:"mt-0.5"}),b.jsxs("div",{children:[b.jsx(ar,{className:"cursor-pointer",children:e("newProject.steps.output.trustTemplate")}),b.jsx(qa,{children:e("newProject.steps.output.trustWarning")})]})]})})]}),i==="creating"&&b.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[b.jsx(fe,{icon:en,size:32,strokeWidth:2,className:"animate-spin text-primary"}),b.jsx("span",{className:"text-sm text-muted-foreground",children:e("newProject.steps.creating.inProgress")})]})]}),l&&b.jsx("div",{className:"flex justify-center py-1",children:b.jsx(fe,{icon:cM,size:16,strokeWidth:2,className:"text-muted-foreground animate-bounce"})}),b.jsxs(Hf,{className:"shrink-0",children:[i!=="template"&&i!=="creating"&&b.jsxs(Ke,{variant:"outline",onClick:U,children:[b.jsx(fe,{icon:ete,size:16,strokeWidth:2,"data-slot":"icon"}),e("newProject.back")]}),i==="template"&&b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline"}),children:e("addModal.cancel")}),i==="template"&&b.jsxs(Ke,{onClick:j,disabled:!J,children:[e("newProject.next"),b.jsx(fe,{icon:Z$,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="questions"&&b.jsxs(Ke,{onClick:j,disabled:!ae,children:[e("newProject.next"),b.jsx(fe,{icon:Z$,size:16,strokeWidth:2,"data-slot":"icon"})]}),i==="output"&&b.jsx(Ke,{onClick:K,disabled:!Q||q.isPending,children:e("newProject.create")})]})]})]}),b.jsx(Nm,{open:s,onOpenChange:o,onSelect:G=>v(G),initialPath:z||void 0})]})}function JIe(e){return e.startsWith("git@")||e.startsWith("https://")||e.startsWith("http://")||e.startsWith("gh:")||e.startsWith("gl:")||e.startsWith("bb:")}function eDe(e){const t=e.replace(/\.git$/,"");if(t.startsWith("git@")){const n=t.match(/:([^/]+\/)?([^/]+)$/);if(n)return n[2]}else if(t.startsWith("gh:")||t.startsWith("gl:")||t.startsWith("bb:")){const n=t.split("/");if(n.length>0)return n[n.length-1]}else{const n=t.split("/");if(n.length>0)return n[n.length-1]}return t}function tDe({open:e,onOpenChange:t,onSuccess:n}){const{t:r}=tn("repositories"),[i,a]=k.useState(""),[s,o]=k.useState(null),[l,u]=k.useState(!1),{data:f}=qy(),d=kne(),p=cwe(),m=k.useMemo(()=>JIe(i.trim()),[i]),y=k.useMemo(()=>m?eDe(i.trim()):null,[i,m]),S=k.useMemo(()=>y&&f?`${f}/${y}`:null,[y,f]),g=d.isPending||p.isPending,_=async T=>{T.preventDefault(),o(null);const w=i.trim();if(w)if(m)p.mutate({url:w},{onSuccess:C=>{a(""),t(!1),n?.(C.id)},onError:C=>{o(C instanceof Error?C.message:r("addModal.cloneFailed"))}});else{const C=w.split("/").pop()||"repo";d.mutate({path:w,displayName:C},{onSuccess:R=>{a(""),t(!1),n?.(R.id)},onError:R=>{o(R instanceof Error?R.message:r("addModal.createFailed"))}})}},v=T=>{a(T),u(!1)},x=T=>{T||(a(""),o(null)),t(T)};return b.jsxs(b.Fragment,{children:[b.jsx(ku,{open:e,onOpenChange:x,children:b.jsxs(Ou,{className:"sm:max-w-md",children:[b.jsxs(Jc,{children:[b.jsx(ed,{children:r("addModal.title")}),b.jsx(zy,{children:r("addModal.description")})]}),b.jsxs("form",{onSubmit:_,className:"space-y-4",children:[b.jsxs("div",{className:"space-y-2",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("addModal.inputLabel")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsxs("div",{className:"relative flex-1",children:[b.jsx(vn,{value:i,onChange:T=>{a(T.target.value),o(null)},placeholder:r("addModal.inputPlaceholder"),disabled:g,className:"pr-8"}),i&&b.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2",children:b.jsx(fe,{icon:m?ote:Hi,size:14,strokeWidth:2,className:"text-muted-foreground"})})]}),b.jsx(Ke,{type:"button",variant:"outline",size:"sm",onClick:()=>u(!0),disabled:g,children:r("addModal.browse")})]})]}),m&&S&&b.jsxs("div",{className:"rounded-md bg-muted/50 px-3 py-2 text-xs text-muted-foreground",children:[r("addModal.willCloneTo"),": ",b.jsx("span",{className:"font-mono",children:S})]}),g&&b.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-sm text-muted-foreground",children:[b.jsx(fe,{icon:en,size:16,strokeWidth:2,className:"animate-spin"}),r(m?"addModal.cloning":"addModal.adding")]}),s&&b.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[b.jsx(fe,{icon:ts,size:14,strokeWidth:2,className:"mt-0.5 shrink-0"}),b.jsx("span",{children:s})]}),b.jsxs(Hf,{children:[b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline",disabled:g}),children:r("addModal.cancel")}),b.jsx(Ke,{type:"submit",disabled:!i.trim()||g,children:r(s?"addModal.retry":"addModal.add")})]})]})]})}),b.jsx(Nm,{open:l,onOpenChange:u,onSelect:v,initialPath:f||void 0})]})}function nDe({open:e,onOpenChange:t,onSuccess:n}){const{t:r}=tn("repositories"),[i,a]=k.useState(""),[s,o]=k.useState(!1),[l,u]=k.useState(null),[f,d]=k.useState(new Set),[p,m]=k.useState(null),{data:y}=qy(),S=fwe(),g=hwe(),_=i.trim()||y||"",v=S.isPending||g.isPending,x=k.useMemo(()=>l?.filter(D=>!D.exists)??[],[l]),T=()=>{m(null),u(null),d(new Set),S.mutate(_||void 0,{onSuccess:D=>{u(D.repositories);const z=D.repositories.filter(M=>!M.exists);d(new Set(z.map(M=>M.path)))},onError:D=>{m(D instanceof Error?D.message:r("bulkAdd.scanFailed"))}})},w=D=>{a(D),o(!1),u(null),d(new Set)},C=D=>{d(z=>{const M=new Set(z);return M.has(D)?M.delete(D):M.add(D),M})},R=()=>{d(new Set(x.map(D=>D.path)))},O=()=>{d(new Set)},N=()=>{if(f.size===0)return;const D=Array.from(f).map(z=>{const M=l?.find(V=>V.path===z);return{path:z,displayName:M?.name}});g.mutate(D,{onSuccess:()=>{t(!1),n?.()},onError:z=>{m(z instanceof Error?z.message:r("bulkAdd.addFailed"))}})},L=D=>{D||(a(""),u(null),d(new Set),m(null)),t(D)};return b.jsxs(b.Fragment,{children:[b.jsx(ku,{open:e,onOpenChange:L,children:b.jsxs(Ou,{className:"sm:max-w-lg",children:[b.jsxs(Jc,{children:[b.jsx(ed,{children:r("bulkAdd.title")}),b.jsx(zy,{children:r("bulkAdd.description")})]}),b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"space-y-2",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("bulkAdd.directoryLabel")}),b.jsxs("div",{className:"flex gap-2",children:[b.jsx(vn,{value:i,onChange:D=>{a(D.target.value),m(null),u(null)},placeholder:y||r("bulkAdd.directoryPlaceholder"),disabled:v,className:"flex-1"}),b.jsx(Ke,{type:"button",variant:"outline",size:"sm",onClick:()=>o(!0),disabled:v,children:r("bulkAdd.browse")}),b.jsxs(Ke,{type:"button",size:"sm",onClick:T,disabled:v||!_,children:[S.isPending?b.jsx(fe,{icon:en,size:16,strokeWidth:2,className:"animate-spin"}):b.jsx(fe,{icon:Gx,size:16,strokeWidth:2}),r("bulkAdd.scan")]})]})]}),l!==null&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("bulkAdd.foundRepos",{count:l.length})}),x.length>0&&b.jsxs("div",{className:"flex gap-2 text-xs",children:[b.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:R,disabled:v,children:r("bulkAdd.selectAll")}),b.jsx("span",{className:"text-muted-foreground",children:"/"}),b.jsx("button",{type:"button",className:"text-primary hover:underline",onClick:O,disabled:v,children:r("bulkAdd.selectNone")})]})]}),l.length===0?b.jsx("div",{className:"rounded-md bg-muted/50 px-3 py-4 text-center text-sm text-muted-foreground",children:r("bulkAdd.noReposFound")}):b.jsx("div",{className:"max-h-64 overflow-y-auto rounded-md border",children:l.map(D=>b.jsxs("div",{className:`flex items-center gap-3 border-b px-3 py-2 last:border-b-0 ${D.exists?"bg-muted/30 opacity-60":""}`,children:[b.jsx(Ti,{checked:f.has(D.path),onCheckedChange:()=>C(D.path),disabled:D.exists||v}),b.jsx(fe,{icon:D.exists?nte:Hi,size:16,strokeWidth:2,className:D.exists?"text-green-500":"text-muted-foreground"}),b.jsxs("div",{className:"min-w-0 flex-1",children:[b.jsx("div",{className:"truncate text-sm font-medium",children:D.name}),b.jsx("div",{className:"truncate text-xs text-muted-foreground",children:D.path})]}),D.exists&&b.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:r("bulkAdd.alreadyAdded")})]},D.path))})]}),g.isPending&&b.jsxs("div",{className:"flex items-center justify-center gap-2 py-2 text-sm text-muted-foreground",children:[b.jsx(fe,{icon:en,size:16,strokeWidth:2,className:"animate-spin"}),r("bulkAdd.adding")]}),p&&b.jsxs("div",{className:"flex items-start gap-2 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[b.jsx(fe,{icon:ts,size:14,strokeWidth:2,className:"mt-0.5 shrink-0"}),b.jsx("span",{children:p})]})]}),b.jsxs(Hf,{children:[b.jsx(Rm,{render:b.jsx(Ke,{variant:"outline",disabled:v}),children:r("bulkAdd.cancel")}),b.jsx(Ke,{onClick:N,disabled:f.size===0||v,children:r("bulkAdd.addSelected",{count:f.size})})]})]})}),b.jsx(Nm,{open:s,onOpenChange:o,onSelect:w,initialPath:_||void 0})]})}const rDe=Ms("/repositories/")({component:oDe});function iDe({repository:e,onDelete:t,onStartTask:n,onOpenInTerminal:r,onViewTasks:i}){const{t:a}=tn("repositories"),[s,o]=k.useState(!1),[l,u]=k.useState(!1),{data:f}=DM(),{data:d}=LM(),{data:p}=PM(),m=()=>{const S=sae(e.path,f,d,p);oae(S)},y=async()=>{u(!0);try{await t(),o(!1)}catch{}finally{u(!1)}};return b.jsxs(xa,{className:"h-full group transition-colors hover:border-foreground/20",children:[b.jsx(wi,{to:"/repositories/$repoId",params:{repoId:e.id},className:"block",children:b.jsx(Df,{className:"flex flex-col gap-3 py-4",children:b.jsxs("div",{className:"space-y-1",children:[b.jsx("span",{className:"block truncate font-medium group-hover:text-primary transition-colors",children:e.displayName}),b.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[b.jsx(fe,{icon:Hi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:e.path})]})]})})}),b.jsx(Df,{className:"pt-0 pb-4 px-6",children:b.jsxs("div",{className:"mt-auto flex flex-wrap gap-1",children:[b.jsxs(Ke,{variant:"outline",size:"sm",onClick:n,className:"text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:pM,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("newTask")})]}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:i,className:"text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:Dp,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("viewTasks")})]}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:r,className:"text-muted-foreground hover:text-foreground",title:a("openInTerminal"),children:[b.jsx(fe,{icon:fM,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("terminal")})]}),b.jsxs(Ke,{variant:"outline",size:"sm",onClick:m,className:"text-muted-foreground hover:text-foreground max-sm:hidden",title:a("openInEditor",{editor:WIe(f)}),children:[b.jsx(fe,{icon:fte,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{children:a("editor")})]}),b.jsxs(go,{open:s,onOpenChange:o,children:[b.jsxs(bo,{render:b.jsx(Ke,{variant:"outline",size:"sm",className:"text-muted-foreground hover:text-destructive",title:a("delete.button")}),children:[b.jsx(fe,{icon:$c,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:a("delete.button")})]}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:a("delete.title")}),b.jsx(So,{children:a("delete.description",{name:e.displayName})})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:l,children:a("addModal.cancel")}),b.jsxs(Ke,{variant:"destructive",onClick:y,disabled:l,className:"gap-2",children:[l&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),a(l?"delete.deleting":"delete.button")]})]})]})]})]})})]})}function aDe(){const{t:e}=tn("repositories"),t=Wi(),[n,r]=k.useState(!1);return b.jsxs(b.Fragment,{children:[b.jsxs(Ke,{size:"sm",onClick:()=>r(!0),children:[b.jsx(fe,{icon:Ev,size:16,strokeWidth:2,"data-slot":"icon"}),e("addRepository")]}),b.jsx(tDe,{open:n,onOpenChange:r,onSuccess:i=>{t({to:"/repositories/$repoId",params:{repoId:i}})}})]})}function sDe(){const{t:e}=tn("repositories"),[t,n]=k.useState(!1);return b.jsxs(b.Fragment,{children:[b.jsxs(Ke,{size:"sm",variant:"outline",onClick:()=>n(!0),children:[b.jsx(fe,{icon:O1e,size:16,strokeWidth:2,"data-slot":"icon"}),e("scanDirectory")]}),b.jsx(nDe,{open:t,onOpenChange:n})]})}function oDe(){const{t:e}=tn("repositories"),t=Wi(),{data:n,isLoading:r,error:i}=Ky(),a=One(),[s,o]=k.useState(null),{openInTerminal:l}=zIe(),[u,f]=k.useState(""),d=k.useMemo(()=>n?u?.trim()?n.map(y=>({repo:y,score:Math.max(no(y.displayName,u),no(y.path,u))})).filter(({score:y})=>y>0).sort((y,S)=>S.score-y.score).map(({repo:y})=>y):n:[],[n,u]),p=async y=>{await a.mutateAsync(y)},m=y=>{t({to:"/tasks",search:{repo:y}})};return b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:[b.jsx(aDe,{}),b.jsx(sDe,{}),b.jsx(QIe,{}),b.jsx("div",{className:"flex-1"}),b.jsxs("div",{className:"relative min-w-0 w-48 sm:w-64",children:[b.jsx(fe,{icon:Gx,size:12,strokeWidth:2,className:"absolute left-2 top-1/2 -translate-y-1/2 text-muted-foreground"}),b.jsx(vn,{value:u,onChange:y=>f(y.target.value),placeholder:e("searchPlaceholder"),className:"w-full pl-6"})]})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[r&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}),i&&b.jsxs("div",{className:"flex items-center gap-3 py-6 text-destructive",children:[b.jsx(fe,{icon:ts,size:20,strokeWidth:2}),b.jsx("span",{className:"text-sm",children:e("error.failedToLoad",{message:i.message})})]}),!r&&!i&&n?.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:e("empty.noRepositories")})}),!r&&!i&&n&&n.length>0&&d.length===0&&b.jsx("div",{className:"py-12 text-muted-foreground",children:b.jsx("p",{className:"text-sm",children:e("empty.noMatches")})}),b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:d.map(y=>b.jsx(iDe,{repository:y,onDelete:()=>p(y.id),onStartTask:()=>o(y),onOpenInTerminal:()=>l(y.path,y.displayName),onViewTasks:()=>m(y.displayName)},y.id))})]}),b.jsx(MM,{open:s!==null,onOpenChange:y=>!y&&o(null),defaultRepository:s??void 0,showTrigger:!1})]})}var jk,MH;function Ra(){if(MH)return jk;MH=1;var e=Array.isArray;return jk=e,jk}var Fk,jH;function uae(){if(jH)return Fk;jH=1;var e=typeof G1=="object"&&G1&&G1.Object===Object&&G1;return Fk=e,Fk}var Bk,FH;function vl(){if(FH)return Bk;FH=1;var e=uae(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Bk=n,Bk}var Uk,BH;function s0(){if(BH)return Uk;BH=1;var e=vl(),t=e.Symbol;return Uk=t,Uk}var $k,UH;function lDe(){if(UH)return $k;UH=1;var e=s0(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(s){var o=n.call(s,i),l=s[i];try{s[i]=void 0;var u=!0}catch{}var f=r.call(s);return u&&(o?s[i]=l:delete s[i]),f}return $k=a,$k}var zk,$H;function uDe(){if($H)return zk;$H=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return zk=n,zk}var Hk,zH;function Iu(){if(zH)return Hk;zH=1;var e=s0(),t=lDe(),n=uDe(),r="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function s(o){return o==null?o===void 0?i:r:a&&a in Object(o)?t(o):n(o)}return Hk=s,Hk}var Wk,HH;function Du(){if(HH)return Wk;HH=1;function e(t){return t!=null&&typeof t=="object"}return Wk=e,Wk}var Vk,WH;function Fm(){if(WH)return Vk;WH=1;var e=Iu(),t=Du(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return Vk=r,Vk}var Gk,VH;function i3(){if(VH)return Gk;VH=1;var e=Ra(),t=Fm(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,s){if(e(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||t(a)?!0:r.test(a)||!n.test(a)||s!=null&&a in Object(s)}return Gk=i,Gk}var qk,GH;function od(){if(GH)return qk;GH=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return qk=e,qk}var Kk,qH;function a3(){if(qH)return Kk;qH=1;var e=Iu(),t=od(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!t(o))return!1;var l=e(o);return l==r||l==i||l==n||l==a}return Kk=s,Kk}var Yk,KH;function cDe(){if(KH)return Yk;KH=1;var e=vl(),t=e["__core-js_shared__"];return Yk=t,Yk}var Xk,YH;function dDe(){if(YH)return Xk;YH=1;var e=cDe(),t=(function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function n(r){return!!t&&t in r}return Xk=n,Xk}var Zk,XH;function cae(){if(XH)return Zk;XH=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return Zk=n,Zk}var Qk,ZH;function fDe(){if(ZH)return Qk;ZH=1;var e=a3(),t=dDe(),n=od(),r=cae(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,l=s.toString,u=o.hasOwnProperty,f=RegExp("^"+l.call(u).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function d(p){if(!n(p)||t(p))return!1;var m=e(p)?f:a;return m.test(r(p))}return Qk=d,Qk}var Jk,QH;function hDe(){if(QH)return Jk;QH=1;function e(t,n){return t?.[n]}return Jk=e,Jk}var eO,JH;function Zf(){if(JH)return eO;JH=1;var e=fDe(),t=hDe();function n(r,i){var a=t(r,i);return e(a)?a:void 0}return eO=n,eO}var tO,eW;function bw(){if(eW)return tO;eW=1;var e=Zf(),t=e(Object,"create");return tO=t,tO}var nO,tW;function pDe(){if(tW)return nO;tW=1;var e=bw();function t(){this.__data__=e?e(null):{},this.size=0}return nO=t,nO}var rO,nW;function mDe(){if(nW)return rO;nW=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return rO=e,rO}var iO,rW;function gDe(){if(rW)return iO;rW=1;var e=bw(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(a){var s=this.__data__;if(e){var o=s[a];return o===t?void 0:o}return r.call(s,a)?s[a]:void 0}return iO=i,iO}var aO,iW;function bDe(){if(iW)return aO;iW=1;var e=bw(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return aO=r,aO}var sO,aW;function vDe(){if(aW)return sO;aW=1;var e=bw(),t="__lodash_hash_undefined__";function n(r,i){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=e&&i===void 0?t:i,this}return sO=n,sO}var oO,sW;function yDe(){if(sW)return oO;sW=1;var e=pDe(),t=mDe(),n=gDe(),r=bDe(),i=vDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,oO=a,oO}var lO,oW;function _De(){if(oW)return lO;oW=1;function e(){this.__data__=[],this.size=0}return lO=e,lO}var uO,lW;function s3(){if(lW)return uO;lW=1;function e(t,n){return t===n||t!==t&&n!==n}return uO=e,uO}var cO,uW;function vw(){if(uW)return cO;uW=1;var e=s3();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return cO=t,cO}var dO,cW;function EDe(){if(cW)return dO;cW=1;var e=vw(),t=Array.prototype,n=t.splice;function r(i){var a=this.__data__,s=e(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():n.call(a,s,1),--this.size,!0}return dO=r,dO}var fO,dW;function SDe(){if(dW)return fO;dW=1;var e=vw();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return fO=t,fO}var hO,fW;function xDe(){if(fW)return hO;fW=1;var e=vw();function t(n){return e(this.__data__,n)>-1}return hO=t,hO}var pO,hW;function wDe(){if(hW)return pO;hW=1;var e=vw();function t(n,r){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,r])):i[a][1]=r,this}return pO=t,pO}var mO,pW;function yw(){if(pW)return mO;pW=1;var e=_De(),t=EDe(),n=SDe(),r=xDe(),i=wDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,mO=a,mO}var gO,mW;function o3(){if(mW)return gO;mW=1;var e=Zf(),t=vl(),n=e(t,"Map");return gO=n,gO}var bO,gW;function TDe(){if(gW)return bO;gW=1;var e=yDe(),t=yw(),n=o3();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return bO=r,bO}var vO,bW;function CDe(){if(bW)return vO;bW=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return vO=e,vO}var yO,vW;function _w(){if(vW)return yO;vW=1;var e=CDe();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return yO=t,yO}var _O,yW;function ADe(){if(yW)return _O;yW=1;var e=_w();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return _O=t,_O}var EO,_W;function kDe(){if(_W)return EO;_W=1;var e=_w();function t(n){return e(this,n).get(n)}return EO=t,EO}var SO,EW;function ODe(){if(EW)return SO;EW=1;var e=_w();function t(n){return e(this,n).has(n)}return SO=t,SO}var xO,SW;function RDe(){if(SW)return xO;SW=1;var e=_w();function t(n,r){var i=e(this,n),a=i.size;return i.set(n,r),this.size+=i.size==a?0:1,this}return xO=t,xO}var wO,xW;function l3(){if(xW)return wO;xW=1;var e=TDe(),t=ADe(),n=kDe(),r=ODe(),i=RDe();function a(s){var o=-1,l=s==null?0:s.length;for(this.clear();++o<l;){var u=s[o];this.set(u[0],u[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,wO=a,wO}var TO,wW;function dae(){if(wW)return TO;wW=1;var e=l3(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],l=a.cache;if(l.has(o))return l.get(o);var u=r.apply(this,s);return a.cache=l.set(o,u)||l,u};return a.cache=new(n.Cache||e),a}return n.Cache=e,TO=n,TO}var CO,TW;function NDe(){if(TW)return CO;TW=1;var e=dae(),t=500;function n(r){var i=e(r,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return CO=n,CO}var AO,CW;function IDe(){if(CW)return AO;CW=1;var e=NDe(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(s,o,l,u){a.push(l?u.replace(n,"$1"):o||s)}),a});return AO=r,AO}var kO,AW;function u3(){if(AW)return kO;AW=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=Array(i);++r<i;)a[r]=n(t[r],r,t);return a}return kO=e,kO}var OO,kW;function DDe(){if(kW)return OO;kW=1;var e=s0(),t=u3(),n=Ra(),r=Fm(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(n(o))return t(o,s)+"";if(r(o))return a?a.call(o):"";var l=o+"";return l=="0"&&1/o==-1/0?"-0":l}return OO=s,OO}var RO,OW;function fae(){if(OW)return RO;OW=1;var e=DDe();function t(n){return n==null?"":e(n)}return RO=t,RO}var NO,RW;function hae(){if(RW)return NO;RW=1;var e=Ra(),t=i3(),n=IDe(),r=fae();function i(a,s){return e(a)?a:t(a,s)?[a]:n(r(a))}return NO=i,NO}var IO,NW;function Ew(){if(NW)return IO;NW=1;var e=Fm();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return IO=t,IO}var DO,IW;function c3(){if(IW)return DO;IW=1;var e=hae(),t=Ew();function n(r,i){i=e(i,r);for(var a=0,s=i.length;r!=null&&a<s;)r=r[t(i[a++])];return a&&a==s?r:void 0}return DO=n,DO}var LO,DW;function pae(){if(DW)return LO;DW=1;var e=c3();function t(n,r,i){var a=n==null?void 0:e(n,r);return a===void 0?i:a}return LO=t,LO}var LDe=pae();const Ls=Sn(LDe);var PO,LW;function PDe(){if(LW)return PO;LW=1;function e(t){return t==null}return PO=e,PO}var MDe=PDe();const fn=Sn(MDe);var MO,PW;function jDe(){if(PW)return MO;PW=1;var e=Iu(),t=Ra(),n=Du(),r="[object String]";function i(a){return typeof a=="string"||!t(a)&&n(a)&&e(a)==r}return MO=i,MO}var FDe=jDe();const Pf=Sn(FDe);var BDe=a3();const Vt=Sn(BDe);var UDe=od();const Bm=Sn(UDe);var jO={exports:{}},Dn={};var MW;function $De(){if(MW)return Dn;MW=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),s=Symbol.for("react.context"),o=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),y;y=Symbol.for("react.module.reference");function S(g){if(typeof g=="object"&&g!==null){var _=g.$$typeof;switch(_){case e:switch(g=g.type,g){case n:case i:case r:case u:case f:return g;default:switch(g=g&&g.$$typeof,g){case o:case s:case l:case p:case d:case a:return g;default:return _}}case t:return _}}}return Dn.ContextConsumer=s,Dn.ContextProvider=a,Dn.Element=e,Dn.ForwardRef=l,Dn.Fragment=n,Dn.Lazy=p,Dn.Memo=d,Dn.Portal=t,Dn.Profiler=i,Dn.StrictMode=r,Dn.Suspense=u,Dn.SuspenseList=f,Dn.isAsyncMode=function(){return!1},Dn.isConcurrentMode=function(){return!1},Dn.isContextConsumer=function(g){return S(g)===s},Dn.isContextProvider=function(g){return S(g)===a},Dn.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},Dn.isForwardRef=function(g){return S(g)===l},Dn.isFragment=function(g){return S(g)===n},Dn.isLazy=function(g){return S(g)===p},Dn.isMemo=function(g){return S(g)===d},Dn.isPortal=function(g){return S(g)===t},Dn.isProfiler=function(g){return S(g)===i},Dn.isStrictMode=function(g){return S(g)===r},Dn.isSuspense=function(g){return S(g)===u},Dn.isSuspenseList=function(g){return S(g)===f},Dn.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===u||g===f||g===m||typeof g=="object"&&g!==null&&(g.$$typeof===p||g.$$typeof===d||g.$$typeof===a||g.$$typeof===s||g.$$typeof===l||g.$$typeof===y||g.getModuleId!==void 0)},Dn.typeOf=S,Dn}var jW;function zDe(){return jW||(jW=1,jO.exports=$De()),jO.exports}var HDe=zDe(),FO,FW;function mae(){if(FW)return FO;FW=1;var e=Iu(),t=Du(),n="[object Number]";function r(i){return typeof i=="number"||t(i)&&e(i)==n}return FO=r,FO}var BO,BW;function WDe(){if(BW)return BO;BW=1;var e=mae();function t(n){return e(n)&&n!=+n}return BO=t,BO}var VDe=WDe();const Um=Sn(VDe);var GDe=mae();const qDe=Sn(GDe);var _a=function(t){return t===0?0:t>0?1:-1},ef=function(t){return Pf(t)&&t.indexOf("%")===t.length-1},at=function(t){return qDe(t)&&!Um(t)},KDe=function(t){return fn(t)},ei=function(t){return at(t)||Pf(t)},YDe=0,o0=function(t){var n=++YDe;return"".concat(t||"").concat(n)},so=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!at(t)&&!Pf(t))return r;var a;if(ef(t)){var s=t.indexOf("%");a=n*parseFloat(t.slice(0,s))/100}else a=+t;return Um(a)&&(a=r),i&&a>n&&(a=n),a},_c=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},XDe=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},i=0;i<n;i++)if(!r[t[i]])r[t[i]]=!0;else return!0;return!1},Ji=function(t,n){return at(t)&&at(n)?function(r){return t+r*(n-t)}:function(){return n}};function cS(e,t,n){return!e||!e.length?null:e.find(function(r){return r&&(typeof t=="function"?t(r):Ls(r,t))===n})}var ZDe=function(t,n){return at(t)&&at(n)?t-n:Pf(t)&&Pf(n)?t.localeCompare(n):t instanceof Date&&n instanceof Date?t.getTime()-n.getTime():String(t).localeCompare(String(n))};function Ep(e,t){for(var n in e)if({}.hasOwnProperty.call(e,n)&&(!{}.hasOwnProperty.call(t,n)||e[n]!==t[n]))return!1;for(var r in t)if({}.hasOwnProperty.call(t,r)&&!{}.hasOwnProperty.call(e,r))return!1;return!0}function xD(e){"@babel/helpers - typeof";return xD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xD(e)}var QDe=["viewBox","children"],JDe=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],UW=["points","pathLength"],UO={svg:QDe,polygon:UW,polyline:UW},d3=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],dS=function(t,n){if(!t||typeof t=="function"||typeof t=="boolean")return null;var r=t;if(k.isValidElement(t)&&(r=t.props),!Bm(r))return null;var i={};return Object.keys(r).forEach(function(a){d3.includes(a)&&(i[a]=n||function(s){return r[a](r,s)})}),i},eLe=function(t,n,r){return function(i){return t(n,r,i),null}},Gc=function(t,n,r){if(!Bm(t)||xD(t)!=="object")return null;var i=null;return Object.keys(t).forEach(function(a){var s=t[a];d3.includes(a)&&typeof s=="function"&&(i||(i={}),i[a]=eLe(s,n,r))}),i},tLe=["children"],nLe=["children"];function $W(e,t){if(e==null)return{};var n=rLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function wD(e){"@babel/helpers - typeof";return wD=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wD(e)}var zW={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},du=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},HW=null,$O=null,f3=function e(t){if(t===HW&&Array.isArray($O))return $O;var n=[];return k.Children.forEach(t,function(r){fn(r)||(HDe.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),$O=n,HW=t,n};function Ps(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(i){return du(i)}):r=[du(t)],f3(e).forEach(function(i){var a=Ls(i,"type.displayName")||Ls(i,"type.name");r.indexOf(a)!==-1&&n.push(i)}),n}function Va(e,t){var n=Ps(e,t);return n&&n[0]}var WW=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,i=n.height;return!(!at(r)||r<=0||!at(i)||i<=0)},iLe=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],aLe=function(t){return t&&t.type&&Pf(t.type)&&iLe.indexOf(t.type)>=0},sLe=function(t){return t&&wD(t)==="object"&&"clipDot"in t},oLe=function(t,n,r,i){var a,s=(a=UO?.[i])!==null&&a!==void 0?a:[];return n.startsWith("data-")||!Vt(t)&&(i&&s.includes(n)||JDe.includes(n))||r&&d3.includes(n)},Dt=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(k.isValidElement(t)&&(i=t.props),!Bm(i))return null;var a={};return Object.keys(i).forEach(function(s){var o;oLe((o=i)===null||o===void 0?void 0:o[s],s,n,r)&&(a[s]=i[s])}),a},TD=function e(t,n){if(t===n)return!0;var r=k.Children.count(t);if(r!==k.Children.count(n))return!1;if(r===0)return!0;if(r===1)return VW(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i<r;i++){var a=t[i],s=n[i];if(Array.isArray(a)||Array.isArray(s)){if(!e(a,s))return!1}else if(!VW(a,s))return!1}return!0},VW=function(t,n){if(fn(t)&&fn(n))return!0;if(!fn(t)&&!fn(n)){var r=t.props||{},i=r.children,a=$W(r,tLe),s=n.props||{},o=s.children,l=$W(s,nLe);return i&&o?Ep(a,l)&&TD(i,o):!i&&!o?Ep(a,l):!1}return!1},GW=function(t,n){var r=[],i={};return f3(t).forEach(function(a,s){if(aLe(a))r.push(a);else if(a){var o=du(a.type),l=n[o]||{},u=l.handler,f=l.once;if(u&&(!f||!i[o])){var d=u(a,o,s);r.push(d),i[o]=!0}}}),r},lLe=function(t){var n=t&&t.type;return n&&zW[n]?zW[n]:null},uLe=function(t,n){return f3(n).indexOf(t)},cLe=["children","width","height","viewBox","className","style","title","desc"];function CD(){return CD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},CD.apply(this,arguments)}function dLe(e,t){if(e==null)return{};var n=fLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function fLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function AD(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,s=e.style,o=e.title,l=e.desc,u=dLe(e,cLe),f=i||{width:n,height:r,x:0,y:0},d=Zt("recharts-surface",a);return oe.createElement("svg",CD({},Dt(u,!0,"svg"),{className:d,width:n,height:r,style:s,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height)}),oe.createElement("title",null,o),oe.createElement("desc",null,l),t)}var hLe=["children","className"];function kD(){return kD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kD.apply(this,arguments)}function pLe(e,t){if(e==null)return{};var n=mLe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mLe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var xn=oe.forwardRef(function(e,t){var n=e.children,r=e.className,i=pLe(e,hLe),a=Zt("recharts-layer",r);return oe.createElement("g",kD({className:a},Dt(i,!0),{ref:t}),n)}),fu=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),a=2;a<r;a++)i[a-2]=arguments[a]},zO,qW;function gLe(){if(qW)return zO;qW=1;function e(t,n,r){var i=-1,a=t.length;n<0&&(n=-n>a?0:a+n),r=r>a?a:r,r<0&&(r+=a),a=n>r?0:r-n>>>0,n>>>=0;for(var s=Array(a);++i<a;)s[i]=t[i+n];return s}return zO=e,zO}var HO,KW;function bLe(){if(KW)return HO;KW=1;var e=gLe();function t(n,r,i){var a=n.length;return i=i===void 0?a:i,!r&&i>=a?n:e(n,r,i)}return HO=t,HO}var WO,YW;function gae(){if(YW)return WO;YW=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="\\u200d",o=RegExp("["+s+e+i+a+"]");function l(u){return o.test(u)}return WO=l,WO}var VO,XW;function vLe(){if(XW)return VO;XW=1;function e(t){return t.split("")}return VO=e,VO}var GO,ZW;function yLe(){if(ZW)return GO;ZW=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",n="\\ufe20-\\ufe2f",r="\\u20d0-\\u20ff",i=t+n+r,a="\\ufe0e\\ufe0f",s="["+e+"]",o="["+i+"]",l="\\ud83c[\\udffb-\\udfff]",u="(?:"+o+"|"+l+")",f="[^"+e+"]",d="(?:\\ud83c[\\udde6-\\uddff]){2}",p="[\\ud800-\\udbff][\\udc00-\\udfff]",m="\\u200d",y=u+"?",S="["+a+"]?",g="(?:"+m+"(?:"+[f,d,p].join("|")+")"+S+y+")*",_=S+y+g,v="(?:"+[f+o+"?",o,d,p,s].join("|")+")",x=RegExp(l+"(?="+l+")|"+v+_,"g");function T(w){return w.match(x)||[]}return GO=T,GO}var qO,QW;function _Le(){if(QW)return qO;QW=1;var e=vLe(),t=gae(),n=yLe();function r(i){return t(i)?n(i):e(i)}return qO=r,qO}var KO,JW;function ELe(){if(JW)return KO;JW=1;var e=bLe(),t=gae(),n=_Le(),r=fae();function i(a){return function(s){s=r(s);var o=t(s)?n(s):void 0,l=o?o[0]:s.charAt(0),u=o?e(o,1).join(""):s.slice(1);return l[a]()+u}}return KO=i,KO}var YO,eV;function SLe(){if(eV)return YO;eV=1;var e=ELe(),t=e("toUpperCase");return YO=t,YO}var xLe=SLe();const Sw=Sn(xLe);function Zn(e){return function(){return e}}const bae=Math.cos,fS=Math.sin,Ro=Math.sqrt,hS=Math.PI,xw=2*hS,OD=Math.PI,RD=2*OD,zd=1e-6,wLe=RD-zd;function vae(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function TLe(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return vae;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}class CLe{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?vae:TLe(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,a,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+a},${this._y1=+s}`}arcTo(t,n,r,i,a){if(t=+t,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,o=this._y1,l=r-t,u=i-n,f=s-t,d=o-n,p=f*f+d*d;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(p>zd)if(!(Math.abs(d*l-u*f)>zd)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let m=r-s,y=i-o,S=l*l+u*u,g=m*m+y*y,_=Math.sqrt(S),v=Math.sqrt(p),x=a*Math.tan((OD-Math.acos((S+p-g)/(2*_*v)))/2),T=x/v,w=x/_;Math.abs(T-1)>zd&&this._append`L${t+T*f},${n+T*d}`,this._append`A${a},${a},0,0,${+(d*m>f*y)},${this._x1=t+w*l},${this._y1=n+w*u}`}}arc(t,n,r,i,a,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let o=r*Math.cos(i),l=r*Math.sin(i),u=t+o,f=n+l,d=1^s,p=s?i-a:a-i;this._x1===null?this._append`M${u},${f}`:(Math.abs(this._x1-u)>zd||Math.abs(this._y1-f)>zd)&&this._append`L${u},${f}`,r&&(p<0&&(p=p%RD+RD),p>wLe?this._append`A${r},${r},0,1,${d},${t-o},${n-l}A${r},${r},0,1,${d},${this._x1=u},${this._y1=f}`:p>zd&&this._append`A${r},${r},0,${+(p>=OD)},${d},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function h3(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new CLe(t)}function p3(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function yae(e){this._context=e}yae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ww(e){return new yae(e)}function _ae(e){return e[0]}function Eae(e){return e[1]}function Sae(e,t){var n=Zn(!0),r=null,i=ww,a=null,s=h3(o);e=typeof e=="function"?e:e===void 0?_ae:Zn(e),t=typeof t=="function"?t:t===void 0?Eae:Zn(t);function o(l){var u,f=(l=p3(l)).length,d,p=!1,m;for(r==null&&(a=i(m=s())),u=0;u<=f;++u)!(u<f&&n(d=l[u],u,l))===p&&((p=!p)?a.lineStart():a.lineEnd()),p&&a.point(+e(d,u,l),+t(d,u,l));if(m)return a=null,m+""||null}return o.x=function(l){return arguments.length?(e=typeof l=="function"?l:Zn(+l),o):e},o.y=function(l){return arguments.length?(t=typeof l=="function"?l:Zn(+l),o):t},o.defined=function(l){return arguments.length?(n=typeof l=="function"?l:Zn(!!l),o):n},o.curve=function(l){return arguments.length?(i=l,r!=null&&(a=i(r)),o):i},o.context=function(l){return arguments.length?(l==null?r=a=null:a=i(r=l),o):r},o}function w_(e,t,n){var r=null,i=Zn(!0),a=null,s=ww,o=null,l=h3(u);e=typeof e=="function"?e:e===void 0?_ae:Zn(+e),t=typeof t=="function"?t:Zn(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?Eae:Zn(+n);function u(d){var p,m,y,S=(d=p3(d)).length,g,_=!1,v,x=new Array(S),T=new Array(S);for(a==null&&(o=s(v=l())),p=0;p<=S;++p){if(!(p<S&&i(g=d[p],p,d))===_)if(_=!_)m=p,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),y=p-1;y>=m;--y)o.point(x[y],T[y]);o.lineEnd(),o.areaEnd()}_&&(x[p]=+e(g,p,d),T[p]=+t(g,p,d),o.point(r?+r(g,p,d):x[p],n?+n(g,p,d):T[p]))}if(v)return o=null,v+""||null}function f(){return Sae().defined(i).curve(s).context(a)}return u.x=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),r=null,u):e},u.x0=function(d){return arguments.length?(e=typeof d=="function"?d:Zn(+d),u):e},u.x1=function(d){return arguments.length?(r=d==null?null:typeof d=="function"?d:Zn(+d),u):r},u.y=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),n=null,u):t},u.y0=function(d){return arguments.length?(t=typeof d=="function"?d:Zn(+d),u):t},u.y1=function(d){return arguments.length?(n=d==null?null:typeof d=="function"?d:Zn(+d),u):n},u.lineX0=u.lineY0=function(){return f().x(e).y(t)},u.lineY1=function(){return f().x(e).y(n)},u.lineX1=function(){return f().x(r).y(t)},u.defined=function(d){return arguments.length?(i=typeof d=="function"?d:Zn(!!d),u):i},u.curve=function(d){return arguments.length?(s=d,a!=null&&(o=s(a)),u):s},u.context=function(d){return arguments.length?(d==null?a=o=null:o=s(a=d),u):a},u}class xae{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function ALe(e){return new xae(e,!0)}function kLe(e){return new xae(e,!1)}const m3={draw(e,t){const n=Ro(t/hS);e.moveTo(n,0),e.arc(0,0,n,0,xw)}},OLe={draw(e,t){const n=Ro(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},wae=Ro(1/3),RLe=wae*2,NLe={draw(e,t){const n=Ro(t/RLe),r=n*wae;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},ILe={draw(e,t){const n=Ro(t),r=-n/2;e.rect(r,r,n,n)}},DLe=.8908130915292852,Tae=fS(hS/10)/fS(7*hS/10),LLe=fS(xw/10)*Tae,PLe=-bae(xw/10)*Tae,MLe={draw(e,t){const n=Ro(t*DLe),r=LLe*n,i=PLe*n;e.moveTo(0,-n),e.lineTo(r,i);for(let a=1;a<5;++a){const s=xw*a/5,o=bae(s),l=fS(s);e.lineTo(l*n,-o*n),e.lineTo(o*r-l*i,l*r+o*i)}e.closePath()}},XO=Ro(3),jLe={draw(e,t){const n=-Ro(t/(XO*3));e.moveTo(0,n*2),e.lineTo(-XO*n,-n),e.lineTo(XO*n,-n),e.closePath()}},gs=-.5,bs=Ro(3)/2,ND=1/Ro(12),FLe=(ND/2+1)*3,BLe={draw(e,t){const n=Ro(t/FLe),r=n/2,i=n*ND,a=r,s=n*ND+n,o=-a,l=s;e.moveTo(r,i),e.lineTo(a,s),e.lineTo(o,l),e.lineTo(gs*r-bs*i,bs*r+gs*i),e.lineTo(gs*a-bs*s,bs*a+gs*s),e.lineTo(gs*o-bs*l,bs*o+gs*l),e.lineTo(gs*r+bs*i,gs*i-bs*r),e.lineTo(gs*a+bs*s,gs*s-bs*a),e.lineTo(gs*o+bs*l,gs*l-bs*o),e.closePath()}};function ULe(e,t){let n=null,r=h3(i);e=typeof e=="function"?e:Zn(e||m3),t=typeof t=="function"?t:Zn(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:Zn(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function pS(){}function mS(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Cae(e){this._context=e}Cae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:mS(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:mS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function $Le(e){return new Cae(e)}function Aae(e){this._context=e}Aae.prototype={areaStart:pS,areaEnd:pS,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:mS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function zLe(e){return new Aae(e)}function kae(e){this._context=e}kae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:mS(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function HLe(e){return new kae(e)}function Oae(e){this._context=e}Oae.prototype={areaStart:pS,areaEnd:pS,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function WLe(e){return new Oae(e)}function tV(e){return e<0?-1:1}function nV(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),o=(a*i+s*r)/(r+i);return(tV(a)+tV(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function rV(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ZO(e,t,n){var r=e._x0,i=e._y0,a=e._x1,s=e._y1,o=(a-r)/3;e._context.bezierCurveTo(r+o,i+o*t,a-o,s-o*n,a,s)}function gS(e){this._context=e}gS.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ZO(this,this._t0,rV(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,ZO(this,rV(this,n=nV(this,e,t)),n);break;default:ZO(this,this._t0,n=nV(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Rae(e){this._context=new Nae(e)}(Rae.prototype=Object.create(gS.prototype)).point=function(e,t){gS.prototype.point.call(this,t,e)};function Nae(e){this._context=e}Nae.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function VLe(e){return new gS(e)}function GLe(e){return new Rae(e)}function Iae(e){this._context=e}Iae.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=iV(e),i=iV(t),a=0,s=1;s<n;++a,++s)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function iV(e){var t,n=e.length-1,r,i=new Array(n),a=new Array(n),s=new Array(n);for(i[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function qLe(e){return new Iae(e)}function Tw(e,t){this._context=e,this._t=t}Tw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function KLe(e){return new Tw(e,.5)}function YLe(e){return new Tw(e,0)}function XLe(e){return new Tw(e,1)}function Wp(e,t){if((s=e.length)>1)for(var n=1,r,i,a=e[t[0]],s,o=a.length;n<s;++n)for(i=a,a=e[t[n]],r=0;r<o;++r)a[r][1]+=a[r][0]=isNaN(i[r][1])?i[r][0]:i[r][1]}function ID(e){for(var t=e.length,n=new Array(t);--t>=0;)n[t]=t;return n}function ZLe(e,t){return e[t]}function QLe(e){const t=[];return t.key=e,t}function JLe(){var e=Zn([]),t=ID,n=Wp,r=ZLe;function i(a){var s=Array.from(e.apply(this,arguments),QLe),o,l=s.length,u=-1,f;for(const d of a)for(o=0,++u;o<l;++o)(s[o][u]=[0,+r(d,s[o].key,u,a)]).data=d;for(o=0,f=p3(t(s));o<l;++o)s[f[o]].index=o;return n(s,f),s}return i.keys=function(a){return arguments.length?(e=typeof a=="function"?a:Zn(Array.from(a)),i):e},i.value=function(a){return arguments.length?(r=typeof a=="function"?a:Zn(+a),i):r},i.order=function(a){return arguments.length?(t=a==null?ID:typeof a=="function"?a:Zn(Array.from(a)),i):t},i.offset=function(a){return arguments.length?(n=a??Wp,i):n},i}function ePe(e,t){if((r=e.length)>0){for(var n,r,i=0,a=e[0].length,s;i<a;++i){for(s=n=0;n<r;++n)s+=e[n][i][1]||0;if(s)for(n=0;n<r;++n)e[n][i][1]/=s}Wp(e,t)}}function tPe(e,t){if((i=e.length)>0){for(var n=0,r=e[t[0]],i,a=r.length;n<a;++n){for(var s=0,o=0;s<i;++s)o+=e[s][n][1]||0;r[n][1]+=r[n][0]=-o/2}Wp(e,t)}}function nPe(e,t){if(!(!((s=e.length)>0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,s;r<a;++r){for(var o=0,l=0,u=0;o<s;++o){for(var f=e[t[o]],d=f[r][1]||0,p=f[r-1][1]||0,m=(d-p)/2,y=0;y<o;++y){var S=e[t[y]],g=S[r][1]||0,_=S[r-1][1]||0;m+=g-_}l+=d,u+=m*d}i[r-1][1]+=i[r-1][0]=n,l&&(n-=u/l)}i[r-1][1]+=i[r-1][0]=n,Wp(e,t)}}function Pv(e){"@babel/helpers - typeof";return Pv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pv(e)}var rPe=["type","size","sizeType"];function DD(){return DD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},DD.apply(this,arguments)}function aV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function sV(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?aV(Object(n),!0).forEach(function(r){iPe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function iPe(e,t,n){return t=aPe(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aPe(e){var t=sPe(e,"string");return Pv(t)=="symbol"?t:t+""}function sPe(e,t){if(Pv(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Pv(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oPe(e,t){if(e==null)return{};var n=lPe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function lPe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Dae={symbolCircle:m3,symbolCross:OLe,symbolDiamond:NLe,symbolSquare:ILe,symbolStar:MLe,symbolTriangle:jLe,symbolWye:BLe},uPe=Math.PI/180,cPe=function(t){var n="symbol".concat(Sw(t));return Dae[n]||m3},dPe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*uPe;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},fPe=function(t,n){Dae["symbol".concat(Sw(t))]=n},g3=function(t){var n=t.type,r=n===void 0?"circle":n,i=t.size,a=i===void 0?64:i,s=t.sizeType,o=s===void 0?"area":s,l=oPe(t,rPe),u=sV(sV({},l),{},{type:r,size:a,sizeType:o}),f=function(){var g=cPe(r),_=ULe().type(g).size(dPe(a,o,r));return _()},d=u.className,p=u.cx,m=u.cy,y=Dt(u,!0);return p===+p&&m===+m&&a===+a?oe.createElement("path",DD({},y,{className:Zt("recharts-symbols",d),transform:"translate(".concat(p,", ").concat(m,")"),d:f()})):null};g3.registerSymbol=fPe;function Vp(e){"@babel/helpers - typeof";return Vp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vp(e)}function LD(){return LD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},LD.apply(this,arguments)}function oV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function hPe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oV(Object(n),!0).forEach(function(r){Mv(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oV(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function pPe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mPe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Pae(r.key),r)}}function gPe(e,t,n){return t&&mPe(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function bPe(e,t,n){return t=bS(t),vPe(e,Lae()?Reflect.construct(t,n||[],bS(e).constructor):t.apply(e,n))}function vPe(e,t){if(t&&(Vp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return yPe(e)}function yPe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Lae(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Lae=function(){return!!e})()}function bS(e){return bS=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bS(e)}function _Pe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&PD(e,t)}function PD(e,t){return PD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},PD(e,t)}function Mv(e,t,n){return t=Pae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Pae(e){var t=EPe(e,"string");return Vp(t)=="symbol"?t:t+""}function EPe(e,t){if(Vp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Vp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}var vs=32,b3=(function(e){function t(){return pPe(this,t),bPe(this,t,arguments)}return _Pe(t,e),gPe(t,[{key:"renderIcon",value:function(r){var i=this.props.inactiveColor,a=vs/2,s=vs/6,o=vs/3,l=r.inactive?i:r.color;if(r.type==="plainline")return oe.createElement("line",{strokeWidth:4,fill:"none",stroke:l,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:a,x2:vs,y2:a,className:"recharts-legend-icon"});if(r.type==="line")return oe.createElement("path",{strokeWidth:4,fill:"none",stroke:l,d:"M0,".concat(a,"h").concat(o,`
45
45
  A`).concat(s,",").concat(s,",0,1,1,").concat(2*o,",").concat(a,`
46
46
  H`).concat(vs,"M").concat(2*o,",").concat(a,`
47
47
  A`).concat(s,",").concat(s,",0,1,1,").concat(o,",").concat(a),className:"recharts-legend-icon"});if(r.type==="rect")return oe.createElement("path",{stroke:"none",fill:l,d:"M0,".concat(vs/8,"h").concat(vs,"v").concat(vs*3/4,"h").concat(-vs,"z"),className:"recharts-legend-icon"});if(oe.isValidElement(r.legendIcon)){var u=hPe({},r);return delete u.legendIcon,oe.cloneElement(r.legendIcon,u)}return oe.createElement(g3,{fill:l,cx:a,cy:a,size:vs,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,i=this.props,a=i.payload,s=i.iconSize,o=i.layout,l=i.formatter,u=i.inactiveColor,f={x:0,y:0,width:vs,height:vs},d={display:o==="horizontal"?"inline-block":"block",marginRight:10},p={display:"inline-block",verticalAlign:"middle",marginRight:4};return a.map(function(m,y){var S=m.formatter||l,g=Zt(Mv(Mv({"recharts-legend-item":!0},"legend-item-".concat(y),!0),"inactive",m.inactive));if(m.type==="none")return null;var _=Vt(m.value)?null:m.value;fu(!Vt(m.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var v=m.inactive?u:m.color;return oe.createElement("li",LD({className:g,style:d,key:"legend-item-".concat(y)},Gc(r.props,m,y)),oe.createElement(AD,{width:s,height:s,viewBox:f,style:p},r.renderIcon(m)),oe.createElement("span",{className:"recharts-legend-item-text",style:{color:v}},S?S(_,m,y):_))})}},{key:"render",value:function(){var r=this.props,i=r.payload,a=r.layout,s=r.align;if(!i||!i.length)return null;var o={padding:0,margin:0,textAlign:a==="horizontal"?s:"left"};return oe.createElement("ul",{className:"recharts-default-legend",style:o},this.renderItems())}}])})(k.PureComponent);Mv(b3,"displayName","Legend");Mv(b3,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var QO,lV;function SPe(){if(lV)return QO;lV=1;var e=yw();function t(){this.__data__=new e,this.size=0}return QO=t,QO}var JO,uV;function xPe(){if(uV)return JO;uV=1;function e(t){var n=this.__data__,r=n.delete(t);return this.size=n.size,r}return JO=e,JO}var e2,cV;function wPe(){if(cV)return e2;cV=1;function e(t){return this.__data__.get(t)}return e2=e,e2}var t2,dV;function TPe(){if(dV)return t2;dV=1;function e(t){return this.__data__.has(t)}return t2=e,t2}var n2,fV;function CPe(){if(fV)return n2;fV=1;var e=yw(),t=o3(),n=l3(),r=200;function i(a,s){var o=this.__data__;if(o instanceof e){var l=o.__data__;if(!t||l.length<r-1)return l.push([a,s]),this.size=++o.size,this;o=this.__data__=new n(l)}return o.set(a,s),this.size=o.size,this}return n2=i,n2}var r2,hV;function Mae(){if(hV)return r2;hV=1;var e=yw(),t=SPe(),n=xPe(),r=wPe(),i=TPe(),a=CPe();function s(o){var l=this.__data__=new e(o);this.size=l.size}return s.prototype.clear=t,s.prototype.delete=n,s.prototype.get=r,s.prototype.has=i,s.prototype.set=a,r2=s,r2}var i2,pV;function APe(){if(pV)return i2;pV=1;var e="__lodash_hash_undefined__";function t(n){return this.__data__.set(n,e),this}return i2=t,i2}var a2,mV;function kPe(){if(mV)return a2;mV=1;function e(t){return this.__data__.has(t)}return a2=e,a2}var s2,gV;function jae(){if(gV)return s2;gV=1;var e=l3(),t=APe(),n=kPe();function r(i){var a=-1,s=i==null?0:i.length;for(this.__data__=new e;++a<s;)this.add(i[a])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,s2=r,s2}var o2,bV;function Fae(){if(bV)return o2;bV=1;function e(t,n){for(var r=-1,i=t==null?0:t.length;++r<i;)if(n(t[r],r,t))return!0;return!1}return o2=e,o2}var l2,vV;function Bae(){if(vV)return l2;vV=1;function e(t,n){return t.has(n)}return l2=e,l2}var u2,yV;function Uae(){if(yV)return u2;yV=1;var e=jae(),t=Fae(),n=Bae(),r=1,i=2;function a(s,o,l,u,f,d){var p=l&r,m=s.length,y=o.length;if(m!=y&&!(p&&y>m))return!1;var S=d.get(s),g=d.get(o);if(S&&g)return S==o&&g==s;var _=-1,v=!0,x=l&i?new e:void 0;for(d.set(s,o),d.set(o,s);++_<m;){var T=s[_],w=o[_];if(u)var C=p?u(w,T,_,o,s,d):u(T,w,_,s,o,d);if(C!==void 0){if(C)continue;v=!1;break}if(x){if(!t(o,function(R,O){if(!n(x,O)&&(T===R||f(T,R,l,u,d)))return x.push(O)})){v=!1;break}}else if(!(T===w||f(T,w,l,u,d))){v=!1;break}}return d.delete(s),d.delete(o),v}return u2=a,u2}var c2,_V;function OPe(){if(_V)return c2;_V=1;var e=vl(),t=e.Uint8Array;return c2=t,c2}var d2,EV;function RPe(){if(EV)return d2;EV=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i,a){r[++n]=[a,i]}),r}return d2=e,d2}var f2,SV;function v3(){if(SV)return f2;SV=1;function e(t){var n=-1,r=Array(t.size);return t.forEach(function(i){r[++n]=i}),r}return f2=e,f2}var h2,xV;function NPe(){if(xV)return h2;xV=1;var e=s0(),t=OPe(),n=s3(),r=Uae(),i=RPe(),a=v3(),s=1,o=2,l="[object Boolean]",u="[object Date]",f="[object Error]",d="[object Map]",p="[object Number]",m="[object RegExp]",y="[object Set]",S="[object String]",g="[object Symbol]",_="[object ArrayBuffer]",v="[object DataView]",x=e?e.prototype:void 0,T=x?x.valueOf:void 0;function w(C,R,O,N,L,D,z){switch(O){case v:if(C.byteLength!=R.byteLength||C.byteOffset!=R.byteOffset)return!1;C=C.buffer,R=R.buffer;case _:return!(C.byteLength!=R.byteLength||!D(new t(C),new t(R)));case l:case u:case p:return n(+C,+R);case f:return C.name==R.name&&C.message==R.message;case m:case S:return C==R+"";case d:var M=i;case y:var V=N&s;if(M||(M=a),C.size!=R.size&&!V)return!1;var W=z.get(C);if(W)return W==R;N|=o,z.set(C,R);var $=r(M(C),M(R),N,L,D,z);return z.delete(C),$;case g:if(T)return T.call(C)==T.call(R)}return!1}return h2=w,h2}var p2,wV;function $ae(){if(wV)return p2;wV=1;function e(t,n){for(var r=-1,i=n.length,a=t.length;++r<i;)t[a+r]=n[r];return t}return p2=e,p2}var m2,TV;function IPe(){if(TV)return m2;TV=1;var e=$ae(),t=Ra();function n(r,i,a){var s=i(r);return t(r)?s:e(s,a(r))}return m2=n,m2}var g2,CV;function DPe(){if(CV)return g2;CV=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=0,s=[];++r<i;){var o=t[r];n(o,r,t)&&(s[a++]=o)}return s}return g2=e,g2}var b2,AV;function LPe(){if(AV)return b2;AV=1;function e(){return[]}return b2=e,b2}var v2,kV;function PPe(){if(kV)return v2;kV=1;var e=DPe(),t=LPe(),n=Object.prototype,r=n.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(s){return s==null?[]:(s=Object(s),e(i(s),function(o){return r.call(s,o)}))}:t;return v2=a,v2}var y2,OV;function MPe(){if(OV)return y2;OV=1;function e(t,n){for(var r=-1,i=Array(t);++r<t;)i[r]=n(r);return i}return y2=e,y2}var _2,RV;function jPe(){if(RV)return _2;RV=1;var e=Iu(),t=Du(),n="[object Arguments]";function r(i){return t(i)&&e(i)==n}return _2=r,_2}var E2,NV;function y3(){if(NV)return E2;NV=1;var e=jPe(),t=Du(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(s){return t(s)&&r.call(s,"callee")&&!i.call(s,"callee")};return E2=a,E2}var Ob={exports:{}},S2,IV;function FPe(){if(IV)return S2;IV=1;function e(){return!1}return S2=e,S2}Ob.exports;var DV;function zae(){return DV||(DV=1,(function(e,t){var n=vl(),r=FPe(),i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,s=a&&a.exports===i,o=s?n.Buffer:void 0,l=o?o.isBuffer:void 0,u=l||r;e.exports=u})(Ob,Ob.exports)),Ob.exports}var x2,LV;function _3(){if(LV)return x2;LV=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,i){var a=typeof r;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<i}return x2=n,x2}var w2,PV;function E3(){if(PV)return w2;PV=1;var e=9007199254740991;function t(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=e}return w2=t,w2}var T2,MV;function BPe(){if(MV)return T2;MV=1;var e=Iu(),t=E3(),n=Du(),r="[object Arguments]",i="[object Array]",a="[object Boolean]",s="[object Date]",o="[object Error]",l="[object Function]",u="[object Map]",f="[object Number]",d="[object Object]",p="[object RegExp]",m="[object Set]",y="[object String]",S="[object WeakMap]",g="[object ArrayBuffer]",_="[object DataView]",v="[object Float32Array]",x="[object Float64Array]",T="[object Int8Array]",w="[object Int16Array]",C="[object Int32Array]",R="[object Uint8Array]",O="[object Uint8ClampedArray]",N="[object Uint16Array]",L="[object Uint32Array]",D={};D[v]=D[x]=D[T]=D[w]=D[C]=D[R]=D[O]=D[N]=D[L]=!0,D[r]=D[i]=D[g]=D[a]=D[_]=D[s]=D[o]=D[l]=D[u]=D[f]=D[d]=D[p]=D[m]=D[y]=D[S]=!1;function z(M){return n(M)&&t(M.length)&&!!D[e(M)]}return T2=z,T2}var C2,jV;function Hae(){if(jV)return C2;jV=1;function e(t){return function(n){return t(n)}}return C2=e,C2}var Rb={exports:{}};Rb.exports;var FV;function UPe(){return FV||(FV=1,(function(e,t){var n=uae(),r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===r,s=a&&n.process,o=(function(){try{var l=i&&i.require&&i.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}})();e.exports=o})(Rb,Rb.exports)),Rb.exports}var A2,BV;function Wae(){if(BV)return A2;BV=1;var e=BPe(),t=Hae(),n=UPe(),r=n&&n.isTypedArray,i=r?t(r):e;return A2=i,A2}var k2,UV;function $Pe(){if(UV)return k2;UV=1;var e=MPe(),t=y3(),n=Ra(),r=zae(),i=_3(),a=Wae(),s=Object.prototype,o=s.hasOwnProperty;function l(u,f){var d=n(u),p=!d&&t(u),m=!d&&!p&&r(u),y=!d&&!p&&!m&&a(u),S=d||p||m||y,g=S?e(u.length,String):[],_=g.length;for(var v in u)(f||o.call(u,v))&&!(S&&(v=="length"||m&&(v=="offset"||v=="parent")||y&&(v=="buffer"||v=="byteLength"||v=="byteOffset")||i(v,_)))&&g.push(v);return g}return k2=l,k2}var O2,$V;function zPe(){if($V)return O2;$V=1;var e=Object.prototype;function t(n){var r=n&&n.constructor,i=typeof r=="function"&&r.prototype||e;return n===i}return O2=t,O2}var R2,zV;function Vae(){if(zV)return R2;zV=1;function e(t,n){return function(r){return t(n(r))}}return R2=e,R2}var N2,HV;function HPe(){if(HV)return N2;HV=1;var e=Vae(),t=e(Object.keys,Object);return N2=t,N2}var I2,WV;function WPe(){if(WV)return I2;WV=1;var e=zPe(),t=HPe(),n=Object.prototype,r=n.hasOwnProperty;function i(a){if(!e(a))return t(a);var s=[];for(var o in Object(a))r.call(a,o)&&o!="constructor"&&s.push(o);return s}return I2=i,I2}var D2,VV;function l0(){if(VV)return D2;VV=1;var e=a3(),t=E3();function n(r){return r!=null&&t(r.length)&&!e(r)}return D2=n,D2}var L2,GV;function Cw(){if(GV)return L2;GV=1;var e=$Pe(),t=WPe(),n=l0();function r(i){return n(i)?e(i):t(i)}return L2=r,L2}var P2,qV;function VPe(){if(qV)return P2;qV=1;var e=IPe(),t=PPe(),n=Cw();function r(i){return e(i,n,t)}return P2=r,P2}var M2,KV;function GPe(){if(KV)return M2;KV=1;var e=VPe(),t=1,n=Object.prototype,r=n.hasOwnProperty;function i(a,s,o,l,u,f){var d=o&t,p=e(a),m=p.length,y=e(s),S=y.length;if(m!=S&&!d)return!1;for(var g=m;g--;){var _=p[g];if(!(d?_ in s:r.call(s,_)))return!1}var v=f.get(a),x=f.get(s);if(v&&x)return v==s&&x==a;var T=!0;f.set(a,s),f.set(s,a);for(var w=d;++g<m;){_=p[g];var C=a[_],R=s[_];if(l)var O=d?l(R,C,_,s,a,f):l(C,R,_,a,s,f);if(!(O===void 0?C===R||u(C,R,o,l,f):O)){T=!1;break}w||(w=_=="constructor")}if(T&&!w){var N=a.constructor,L=s.constructor;N!=L&&"constructor"in a&&"constructor"in s&&!(typeof N=="function"&&N instanceof N&&typeof L=="function"&&L instanceof L)&&(T=!1)}return f.delete(a),f.delete(s),T}return M2=i,M2}var j2,YV;function qPe(){if(YV)return j2;YV=1;var e=Zf(),t=vl(),n=e(t,"DataView");return j2=n,j2}var F2,XV;function KPe(){if(XV)return F2;XV=1;var e=Zf(),t=vl(),n=e(t,"Promise");return F2=n,F2}var B2,ZV;function Gae(){if(ZV)return B2;ZV=1;var e=Zf(),t=vl(),n=e(t,"Set");return B2=n,B2}var U2,QV;function YPe(){if(QV)return U2;QV=1;var e=Zf(),t=vl(),n=e(t,"WeakMap");return U2=n,U2}var $2,JV;function XPe(){if(JV)return $2;JV=1;var e=qPe(),t=o3(),n=KPe(),r=Gae(),i=YPe(),a=Iu(),s=cae(),o="[object Map]",l="[object Object]",u="[object Promise]",f="[object Set]",d="[object WeakMap]",p="[object DataView]",m=s(e),y=s(t),S=s(n),g=s(r),_=s(i),v=a;return(e&&v(new e(new ArrayBuffer(1)))!=p||t&&v(new t)!=o||n&&v(n.resolve())!=u||r&&v(new r)!=f||i&&v(new i)!=d)&&(v=function(x){var T=a(x),w=T==l?x.constructor:void 0,C=w?s(w):"";if(C)switch(C){case m:return p;case y:return o;case S:return u;case g:return f;case _:return d}return T}),$2=v,$2}var z2,eG;function ZPe(){if(eG)return z2;eG=1;var e=Mae(),t=Uae(),n=NPe(),r=GPe(),i=XPe(),a=Ra(),s=zae(),o=Wae(),l=1,u="[object Arguments]",f="[object Array]",d="[object Object]",p=Object.prototype,m=p.hasOwnProperty;function y(S,g,_,v,x,T){var w=a(S),C=a(g),R=w?f:i(S),O=C?f:i(g);R=R==u?d:R,O=O==u?d:O;var N=R==d,L=O==d,D=R==O;if(D&&s(S)){if(!s(g))return!1;w=!0,N=!1}if(D&&!N)return T||(T=new e),w||o(S)?t(S,g,_,v,x,T):n(S,g,R,_,v,x,T);if(!(_&l)){var z=N&&m.call(S,"__wrapped__"),M=L&&m.call(g,"__wrapped__");if(z||M){var V=z?S.value():S,W=M?g.value():g;return T||(T=new e),x(V,W,_,v,T)}}return D?(T||(T=new e),r(S,g,_,v,x,T)):!1}return z2=y,z2}var H2,tG;function S3(){if(tG)return H2;tG=1;var e=ZPe(),t=Du();function n(r,i,a,s,o){return r===i?!0:r==null||i==null||!t(r)&&!t(i)?r!==r&&i!==i:e(r,i,a,s,n,o)}return H2=n,H2}var W2,nG;function QPe(){if(nG)return W2;nG=1;var e=Mae(),t=S3(),n=1,r=2;function i(a,s,o,l){var u=o.length,f=u,d=!l;if(a==null)return!f;for(a=Object(a);u--;){var p=o[u];if(d&&p[2]?p[1]!==a[p[0]]:!(p[0]in a))return!1}for(;++u<f;){p=o[u];var m=p[0],y=a[m],S=p[1];if(d&&p[2]){if(y===void 0&&!(m in a))return!1}else{var g=new e;if(l)var _=l(y,S,m,a,s,g);if(!(_===void 0?t(S,y,n|r,l,g):_))return!1}}return!0}return W2=i,W2}var V2,rG;function qae(){if(rG)return V2;rG=1;var e=od();function t(n){return n===n&&!e(n)}return V2=t,V2}var G2,iG;function JPe(){if(iG)return G2;iG=1;var e=qae(),t=Cw();function n(r){for(var i=t(r),a=i.length;a--;){var s=i[a],o=r[s];i[a]=[s,o,e(o)]}return i}return G2=n,G2}var q2,aG;function Kae(){if(aG)return q2;aG=1;function e(t,n){return function(r){return r==null?!1:r[t]===n&&(n!==void 0||t in Object(r))}}return q2=e,q2}var K2,sG;function eMe(){if(sG)return K2;sG=1;var e=QPe(),t=JPe(),n=Kae();function r(i){var a=t(i);return a.length==1&&a[0][2]?n(a[0][0],a[0][1]):function(s){return s===i||e(s,i,a)}}return K2=r,K2}var Y2,oG;function tMe(){if(oG)return Y2;oG=1;function e(t,n){return t!=null&&n in Object(t)}return Y2=e,Y2}var X2,lG;function nMe(){if(lG)return X2;lG=1;var e=hae(),t=y3(),n=Ra(),r=_3(),i=E3(),a=Ew();function s(o,l,u){l=e(l,o);for(var f=-1,d=l.length,p=!1;++f<d;){var m=a(l[f]);if(!(p=o!=null&&u(o,m)))break;o=o[m]}return p||++f!=d?p:(d=o==null?0:o.length,!!d&&i(d)&&r(m,d)&&(n(o)||t(o)))}return X2=s,X2}var Z2,uG;function rMe(){if(uG)return Z2;uG=1;var e=tMe(),t=nMe();function n(r,i){return r!=null&&t(r,i,e)}return Z2=n,Z2}var Q2,cG;function iMe(){if(cG)return Q2;cG=1;var e=S3(),t=pae(),n=rMe(),r=i3(),i=qae(),a=Kae(),s=Ew(),o=1,l=2;function u(f,d){return r(f)&&i(d)?a(s(f),d):function(p){var m=t(p,f);return m===void 0&&m===d?n(p,f):e(d,m,o|l)}}return Q2=u,Q2}var J2,dG;function $m(){if(dG)return J2;dG=1;function e(t){return t}return J2=e,J2}var eR,fG;function aMe(){if(fG)return eR;fG=1;function e(t){return function(n){return n?.[t]}}return eR=e,eR}var tR,hG;function sMe(){if(hG)return tR;hG=1;var e=c3();function t(n){return function(r){return e(r,n)}}return tR=t,tR}var nR,pG;function oMe(){if(pG)return nR;pG=1;var e=aMe(),t=sMe(),n=i3(),r=Ew();function i(a){return n(a)?e(r(a)):t(a)}return nR=i,nR}var rR,mG;function yl(){if(mG)return rR;mG=1;var e=eMe(),t=iMe(),n=$m(),r=Ra(),i=oMe();function a(s){return typeof s=="function"?s:s==null?n:typeof s=="object"?r(s)?t(s[0],s[1]):e(s):i(s)}return rR=a,rR}var iR,gG;function Yae(){if(gG)return iR;gG=1;function e(t,n,r,i){for(var a=t.length,s=r+(i?1:-1);i?s--:++s<a;)if(n(t[s],s,t))return s;return-1}return iR=e,iR}var aR,bG;function lMe(){if(bG)return aR;bG=1;function e(t){return t!==t}return aR=e,aR}var sR,vG;function uMe(){if(vG)return sR;vG=1;function e(t,n,r){for(var i=r-1,a=t.length;++i<a;)if(t[i]===n)return i;return-1}return sR=e,sR}var oR,yG;function cMe(){if(yG)return oR;yG=1;var e=Yae(),t=lMe(),n=uMe();function r(i,a,s){return a===a?n(i,a,s):e(i,t,s)}return oR=r,oR}var lR,_G;function dMe(){if(_G)return lR;_G=1;var e=cMe();function t(n,r){var i=n==null?0:n.length;return!!i&&e(n,r,0)>-1}return lR=t,lR}var uR,EG;function fMe(){if(EG)return uR;EG=1;function e(t,n,r){for(var i=-1,a=t==null?0:t.length;++i<a;)if(r(n,t[i]))return!0;return!1}return uR=e,uR}var cR,SG;function hMe(){if(SG)return cR;SG=1;function e(){}return cR=e,cR}var dR,xG;function pMe(){if(xG)return dR;xG=1;var e=Gae(),t=hMe(),n=v3(),r=1/0,i=e&&1/n(new e([,-0]))[1]==r?function(a){return new e(a)}:t;return dR=i,dR}var fR,wG;function mMe(){if(wG)return fR;wG=1;var e=jae(),t=dMe(),n=fMe(),r=Bae(),i=pMe(),a=v3(),s=200;function o(l,u,f){var d=-1,p=t,m=l.length,y=!0,S=[],g=S;if(f)y=!1,p=n;else if(m>=s){var _=u?null:i(l);if(_)return a(_);y=!1,p=r,g=new e}else g=u?[]:S;e:for(;++d<m;){var v=l[d],x=u?u(v):v;if(v=f||v!==0?v:0,y&&x===x){for(var T=g.length;T--;)if(g[T]===x)continue e;u&&g.push(x),S.push(v)}else p(g,x,f)||(g!==S&&g.push(x),S.push(v))}return S}return fR=o,fR}var hR,TG;function gMe(){if(TG)return hR;TG=1;var e=yl(),t=mMe();function n(r,i){return r&&r.length?t(r,e(i,2)):[]}return hR=n,hR}var bMe=gMe();const CG=Sn(bMe);function Xae(e,t,n){return t===!0?CG(e,n):Vt(t)?CG(e,t):e}function Gp(e){"@babel/helpers - typeof";return Gp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gp(e)}var vMe=["ref"];function AG(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Yl(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?AG(Object(n),!0).forEach(function(r){Aw(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AG(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yMe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function kG(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Qae(r.key),r)}}function _Me(e,t,n){return t&&kG(e.prototype,t),n&&kG(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function EMe(e,t,n){return t=vS(t),SMe(e,Zae()?Reflect.construct(t,n||[],vS(e).constructor):t.apply(e,n))}function SMe(e,t){if(t&&(Gp(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xMe(e)}function xMe(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Zae(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Zae=function(){return!!e})()}function vS(e){return vS=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},vS(e)}function wMe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&MD(e,t)}function MD(e,t){return MD=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,i){return r.__proto__=i,r},MD(e,t)}function Aw(e,t,n){return t=Qae(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qae(e){var t=TMe(e,"string");return Gp(t)=="symbol"?t:t+""}function TMe(e,t){if(Gp(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Gp(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function CMe(e,t){if(e==null)return{};var n=AMe(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function AMe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function kMe(e){return e.value}function OMe(e,t){if(oe.isValidElement(e))return oe.cloneElement(e,t);if(typeof e=="function")return oe.createElement(e,t);t.ref;var n=CMe(t,vMe);return oe.createElement(b3,n)}var OG=1,Sp=(function(e){function t(){var n;yMe(this,t);for(var r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return n=EMe(this,t,[].concat(i)),Aw(n,"lastBoundingBox",{width:-1,height:-1}),n}return wMe(t,e),_Me(t,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,i=this.getBBox();i?(Math.abs(i.width-this.lastBoundingBox.width)>OG||Math.abs(i.height-this.lastBoundingBox.height)>OG)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Yl({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,a=i.layout,s=i.align,o=i.verticalAlign,l=i.margin,u=i.chartWidth,f=i.chartHeight,d,p;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(s==="center"&&a==="vertical"){var m=this.getBBoxSnapshot();d={left:((u||0)-m.width)/2}}else d=s==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(o==="middle"){var y=this.getBBoxSnapshot();p={top:((f||0)-y.height)/2}}else p=o==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return Yl(Yl({},d),p)}},{key:"render",value:function(){var r=this,i=this.props,a=i.content,s=i.width,o=i.height,l=i.wrapperStyle,u=i.payloadUniqBy,f=i.payload,d=Yl(Yl({position:"absolute",width:s||"auto",height:o||"auto"},this.getDefaultPosition(l)),l);return oe.createElement("div",{className:"recharts-legend-wrapper",style:d,ref:function(m){r.wrapperNode=m}},OMe(a,Yl(Yl({},this.props),{},{payload:Xae(f,u,kMe)})))}}],[{key:"getWithHeight",value:function(r,i){var a=Yl(Yl({},this.defaultProps),r.props),s=a.layout;return s==="vertical"&&at(r.props.height)?{height:r.props.height}:s==="horizontal"?{width:r.props.width||i}:null}}])})(k.PureComponent);Aw(Sp,"displayName","Legend");Aw(Sp,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var pR,RG;function RMe(){if(RG)return pR;RG=1;var e=s0(),t=y3(),n=Ra(),r=e?e.isConcatSpreadable:void 0;function i(a){return n(a)||t(a)||!!(r&&a&&a[r])}return pR=i,pR}var mR,NG;function Jae(){if(NG)return mR;NG=1;var e=$ae(),t=RMe();function n(r,i,a,s,o){var l=-1,u=r.length;for(a||(a=t),o||(o=[]);++l<u;){var f=r[l];i>0&&a(f)?i>1?n(f,i-1,a,s,o):e(o,f):s||(o[o.length]=f)}return o}return mR=n,mR}var gR,IG;function NMe(){if(IG)return gR;IG=1;function e(t){return function(n,r,i){for(var a=-1,s=Object(n),o=i(n),l=o.length;l--;){var u=o[t?l:++a];if(r(s[u],u,s)===!1)break}return n}}return gR=e,gR}var bR,DG;function IMe(){if(DG)return bR;DG=1;var e=NMe(),t=e();return bR=t,bR}var vR,LG;function ese(){if(LG)return vR;LG=1;var e=IMe(),t=Cw();function n(r,i){return r&&e(r,i,t)}return vR=n,vR}var yR,PG;function DMe(){if(PG)return yR;PG=1;var e=l0();function t(n,r){return function(i,a){if(i==null)return i;if(!e(i))return n(i,a);for(var s=i.length,o=r?s:-1,l=Object(i);(r?o--:++o<s)&&a(l[o],o,l)!==!1;);return i}}return yR=t,yR}var _R,MG;function x3(){if(MG)return _R;MG=1;var e=ese(),t=DMe(),n=t(e);return _R=n,_R}var ER,jG;function tse(){if(jG)return ER;jG=1;var e=x3(),t=l0();function n(r,i){var a=-1,s=t(r)?Array(r.length):[];return e(r,function(o,l,u){s[++a]=i(o,l,u)}),s}return ER=n,ER}var SR,FG;function LMe(){if(FG)return SR;FG=1;function e(t,n){var r=t.length;for(t.sort(n);r--;)t[r]=t[r].value;return t}return SR=e,SR}var xR,BG;function PMe(){if(BG)return xR;BG=1;var e=Fm();function t(n,r){if(n!==r){var i=n!==void 0,a=n===null,s=n===n,o=e(n),l=r!==void 0,u=r===null,f=r===r,d=e(r);if(!u&&!d&&!o&&n>r||o&&l&&f&&!u&&!d||a&&l&&f||!i&&f||!s)return 1;if(!a&&!o&&!d&&n<r||d&&i&&s&&!a&&!o||u&&i&&s||!l&&s||!f)return-1}return 0}return xR=t,xR}var wR,UG;function MMe(){if(UG)return wR;UG=1;var e=PMe();function t(n,r,i){for(var a=-1,s=n.criteria,o=r.criteria,l=s.length,u=i.length;++a<l;){var f=e(s[a],o[a]);if(f){if(a>=u)return f;var d=i[a];return f*(d=="desc"?-1:1)}}return n.index-r.index}return wR=t,wR}var TR,$G;function jMe(){if($G)return TR;$G=1;var e=u3(),t=c3(),n=yl(),r=tse(),i=LMe(),a=Hae(),s=MMe(),o=$m(),l=Ra();function u(f,d,p){d.length?d=e(d,function(S){return l(S)?function(g){return t(g,S.length===1?S[0]:S)}:S}):d=[o];var m=-1;d=e(d,a(n));var y=r(f,function(S,g,_){var v=e(d,function(x){return x(S)});return{criteria:v,index:++m,value:S}});return i(y,function(S,g){return s(S,g,p)})}return TR=u,TR}var CR,zG;function FMe(){if(zG)return CR;zG=1;function e(t,n,r){switch(r.length){case 0:return t.call(n);case 1:return t.call(n,r[0]);case 2:return t.call(n,r[0],r[1]);case 3:return t.call(n,r[0],r[1],r[2])}return t.apply(n,r)}return CR=e,CR}var AR,HG;function BMe(){if(HG)return AR;HG=1;var e=FMe(),t=Math.max;function n(r,i,a){return i=t(i===void 0?r.length-1:i,0),function(){for(var s=arguments,o=-1,l=t(s.length-i,0),u=Array(l);++o<l;)u[o]=s[i+o];o=-1;for(var f=Array(i+1);++o<i;)f[o]=s[o];return f[i]=a(u),e(r,this,f)}}return AR=n,AR}var kR,WG;function UMe(){if(WG)return kR;WG=1;function e(t){return function(){return t}}return kR=e,kR}var OR,VG;function nse(){if(VG)return OR;VG=1;var e=Zf(),t=(function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}})();return OR=t,OR}var RR,GG;function $Me(){if(GG)return RR;GG=1;var e=UMe(),t=nse(),n=$m(),r=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:n;return RR=r,RR}var NR,qG;function zMe(){if(qG)return NR;qG=1;var e=800,t=16,n=Date.now;function r(i){var a=0,s=0;return function(){var o=n(),l=t-(o-s);if(s=o,l>0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return NR=r,NR}var IR,KG;function HMe(){if(KG)return IR;KG=1;var e=$Me(),t=zMe(),n=t(e);return IR=n,IR}var DR,YG;function WMe(){if(YG)return DR;YG=1;var e=$m(),t=BMe(),n=HMe();function r(i,a){return n(t(i,a,e),i+"")}return DR=r,DR}var LR,XG;function kw(){if(XG)return LR;XG=1;var e=s3(),t=l0(),n=_3(),r=od();function i(a,s,o){if(!r(o))return!1;var l=typeof s;return(l=="number"?t(o)&&n(s,o.length):l=="string"&&s in o)?e(o[s],a):!1}return LR=i,LR}var PR,ZG;function VMe(){if(ZG)return PR;ZG=1;var e=Jae(),t=jMe(),n=WMe(),r=kw(),i=n(function(a,s){if(a==null)return[];var o=s.length;return o>1&&r(a,s[0],s[1])?s=[]:o>2&&r(s[0],s[1],s[2])&&(s=[s[0]]),t(a,e(s,1),[])});return PR=i,PR}var GMe=VMe();const w3=Sn(GMe);function jv(e){"@babel/helpers - typeof";return jv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jv(e)}function jD(){return jD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},jD.apply(this,arguments)}function qMe(e,t){return ZMe(e)||XMe(e,t)||YMe(e,t)||KMe()}function KMe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
@@ -108,9 +108,9 @@ ${n.map(([a,s])=>{const o=s.theme?.[r]||s.color;return o?` --color-${a}: ${o};`
108
108
  `)}
109
109
  }
110
110
  `).join(`
111
- `)}}):null},PX=Ho;function MX({active:e,payload:t,className:n,indicator:r="dot",hideLabel:i=!1,hideIndicator:a=!1,label:s,labelFormatter:o,labelClassName:l,formatter:u,color:f,nameKey:d,labelKey:p}){const{config:m}=KHe(),y=k.useMemo(()=>{if(i||!t?.length)return null;const[g]=t,_=`${p||g?.dataKey||g?.name||"value"}`,v=jX(m,g,_),x=!p&&typeof s=="string"?m[s]?.label||s:v?.label;return o?b.jsx("div",{className:Ue("font-medium",l),children:o(x,t)}):x?b.jsx("div",{className:Ue("font-medium",l),children:x}):null},[s,o,t,i,l,m,p]);if(!e||!t?.length)return null;const S=t.length===1&&r!=="dot";return b.jsxs("div",{className:Ue("border-border/50 bg-background gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs/relaxed shadow-xl grid min-w-[8rem] items-start",n),children:[S?null:y,b.jsx("div",{className:"grid gap-1.5",children:t.filter(g=>g.type!=="none").map((g,_)=>{const v=`${d||g.name||g.dataKey||"value"}`,x=jX(m,g,v),T=f||g.payload.fill||g.color;return b.jsx("div",{className:Ue("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",r==="dot"&&"items-center"),children:u&&g?.value!==void 0&&g.name?u(g.value,g.name,g,_,g.payload):b.jsxs(b.Fragment,{children:[x?.icon?b.jsx(x.icon,{}):!a&&b.jsx("div",{className:Ue("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":S&&r==="dashed"}),style:{"--color-bg":T,"--color-border":T}}),b.jsxs("div",{className:Ue("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[b.jsxs("div",{className:"grid gap-1.5",children:[S?y:null,b.jsx("span",{className:"text-muted-foreground",children:x?.label||g.name})]}),g.value&&b.jsx("span",{className:"text-foreground font-mono font-medium tabular-nums",children:g.value.toLocaleString()})]})]})},g.dataKey)})})]})}function jX(e,t,n){if(typeof t!="object"||t===null)return;const r="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let i=n;return n in t&&typeof t[n]=="string"?i=t[n]:r&&n in r&&typeof r[n]=="string"&&(i=r[n]),i in e?e[i]:e[n]}const Tu="";function XHe(e="vibora"){return qn({queryKey:["monitoring","claude-instances",e],queryFn:()=>$t(`${Tu}/api/monitoring/claude-instances?filter=${e}`),refetchInterval:5e3})}function ZHe(e="1h"){return qn({queryKey:["monitoring","system-metrics",e],queryFn:()=>$t(`${Tu}/api/monitoring/system-metrics?window=${e}`),refetchInterval:5e3})}function QHe(){const e=wr();return zn({mutationFn:({terminalId:t,pid:n})=>{if(t)return $t(`${Tu}/api/monitoring/claude-instances/${t}/kill`,{method:"POST"});if(n)return $t(`${Tu}/api/monitoring/claude-instances/${n}/kill-pid`,{method:"POST"});throw new Error("Either terminalId or pid must be provided")},onSuccess:()=>{e.invalidateQueries({queryKey:["monitoring","claude-instances"]})}})}function gb(e){if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB","TB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function FX(e){return{"1m":"1 min","10m":"10 min","1h":"1 hour","3h":"3 hours","6h":"6 hours","12h":"12 hours","24h":"24 hours"}[e]}function JHe(e="memory",t=10){return qn({queryKey:["monitoring","top-processes",e,t],queryFn:()=>$t(`${Tu}/api/monitoring/top-processes?sort=${e}&limit=${t}`),refetchInterval:5e3})}function eWe(){return qn({queryKey:["monitoring","docker-stats"],queryFn:()=>$t(`${Tu}/api/monitoring/docker-stats`),refetchInterval:5e3})}function tWe(){return qn({queryKey:["monitoring","vibora-instances"],queryFn:()=>$t(`${Tu}/api/monitoring/vibora-instances`),refetchInterval:5e3})}function nWe(){const e=wr();return zn({mutationFn:({backendPid:t})=>$t(`${Tu}/api/monitoring/vibora-instances/${t}/kill`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["monitoring","vibora-instances"]})}})}function rWe(){return qn({queryKey:["monitoring","claude-usage"],queryFn:()=>$t(`${Tu}/api/monitoring/claude-usage`),refetchInterval:5e3})}const iWe=["system","processes","claude","vibora","worktrees","usage"],Dle=Ms("/monitoring/")({component:mWe,validateSearch:e=>({tab:iWe.includes(e.tab)?e.tab:void 0})}),BX=["1m","10m","1h","3h","6h","12h","24h"],UX={cpu:{label:"CPU",color:"var(--chart-system)"},memoryUsed:{label:"Used",color:"var(--chart-system)"},memoryCache:{label:"Cache / Buffers",color:"var(--muted-foreground)"},disk:{label:"Disk",color:"var(--muted-foreground)"}};function aWe(){const{t:e}=tn("monitoring"),[t,n]=k.useState("vibora"),[r,i]=k.useState(null),[a,s]=k.useState(new Set),[o,l]=k.useState(!1),{data:u,isLoading:f,error:d}=XHe(t),p=QHe(),m=u?.reduce((x,T)=>x+T.ramMB,0)||0,y=r!==null||o;k.useEffect(()=>{r!==null&&u&&!u.some(x=>x.pid===r)&&i(null)},[r,u]),k.useEffect(()=>{if(a.size>0&&u){const x=new Set([...a].filter(T=>u.some(w=>w.pid===T)));x.size!==a.size&&s(x)}},[a,u]);const S=x=>{i(x.pid);const T=x.isViboraManaged&&x.terminalId?{terminalId:x.terminalId}:{pid:x.pid};p.mutate(T,{onError:()=>i(null)})},g=x=>{s(T=>{const w=new Set(T);return w.has(x)?w.delete(x):w.add(x),w})},_=()=>{u&&(a.size===u.length?s(new Set):s(new Set(u.map(x=>x.pid))))},v=async()=>{if(!u||a.size===0)return;l(!0);const x=u.filter(T=>a.has(T.pid));for(const T of x){const w=T.isViboraManaged&&T.terminalId?{terminalId:T.terminalId}:{pid:T.pid};try{await p.mutateAsync(w)}catch{}}s(new Set),l(!1)};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(zo,{id:"show-all",checked:t==="all",onCheckedChange:x=>n(x?"all":"vibora")}),b.jsx(Ote,{htmlFor:"show-all",className:"text-sm text-muted-foreground",children:e("claude.showAllInstances")})]}),a.size>0&&b.jsxs(Ke,{variant:"destructive",size:"sm",onClick:v,disabled:y,className:"gap-1.5",children:[o?b.jsx(fe,{icon:en,className:"size-3.5 animate-spin"}):b.jsx(fe,{icon:ci,className:"size-3.5"}),e("claude.killSelected",{count:a.size})]})]}),u&&b.jsxs("span",{className:"text-sm text-muted-foreground",children:[e("claude.instanceCount",{count:u.length}),m>0&&` · ${e("claude.totalRam",{ram:m.toFixed(0)})}`]})]}),f&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),d&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("claude.error",{message:d.message})}),u&&u.length===0&&b.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[e("claude.empty"),t==="vibora"&&e("claude.emptyVibora")]}),u&&u.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"hidden lg:grid grid-cols-[32px_60px_150px_1fr_1fr_80px_80px] gap-4 px-3 py-2 text-xs font-medium text-muted-foreground",children:[b.jsx("div",{className:"flex items-center justify-center",children:b.jsx(Ti,{checked:a.size===u.length,onCheckedChange:_,disabled:y})}),b.jsx("span",{children:e("claude.headers.pid")}),b.jsx("span",{children:e("claude.headers.terminal")}),b.jsx("span",{children:e("claude.headers.task")}),b.jsx("span",{children:e("claude.headers.workingDirectory")}),b.jsx("span",{className:"text-right",children:e("claude.headers.ram")}),b.jsx("span",{className:"text-right",children:e("claude.headers.actions")})]}),u.map(x=>b.jsxs(xa,{className:"px-3 py-2",children:[b.jsxs("div",{className:"flex flex-col gap-1 lg:hidden",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2",children:[b.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b.jsx(Ti,{checked:a.has(x.pid),onCheckedChange:()=>g(x.pid),disabled:y,className:"shrink-0"}),b.jsx("span",{className:"text-sm font-medium truncate",children:x.taskId?b.jsx(wi,{to:"/tasks/$taskId",params:{taskId:x.taskId},className:"hover:text-foreground hover:underline",children:x.taskTitle}):b.jsx("span",{className:"text-muted-foreground",children:x.isViboraManaged?x.terminalName:e("claude.source.external")})})]}),b.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.jsxs("span",{className:"tabular-nums text-sm text-muted-foreground",children:[x.ramMB.toFixed(0)," MB"]}),b.jsx(Ke,{variant:"ghost",size:"xs",onClick:()=>S(x),disabled:y,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${y?"opacity-50":""}`,children:b.jsx(fe,{icon:r===x.pid?en:ci,className:`size-3.5 ${r===x.pid?"animate-spin":""}`})})]})]}),b.jsx("span",{className:"text-xs text-muted-foreground truncate pl-6",title:x.cwd,children:x.cwd})]}),b.jsxs("div",{className:"hidden lg:grid grid-cols-[32px_60px_150px_1fr_1fr_80px_80px] items-center gap-4",children:[b.jsx("div",{className:"flex items-center justify-center",children:b.jsx(Ti,{checked:a.has(x.pid),onCheckedChange:()=>g(x.pid),disabled:y})}),b.jsx("span",{className:"font-mono text-xs",children:x.pid}),b.jsx("span",{className:"truncate text-sm",children:x.isViboraManaged?b.jsx("span",{children:x.terminalName||`Terminal ${x.terminalId?.slice(0,8)}`}):b.jsx("span",{className:"text-muted-foreground",children:e("claude.source.external")})}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",children:x.taskId?b.jsx(wi,{to:"/tasks/$taskId",params:{taskId:x.taskId},className:"hover:text-foreground hover:underline",children:x.taskTitle}):e("claude.noTask")}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",title:x.cwd,children:x.cwd}),b.jsxs("span",{className:"text-right tabular-nums text-sm",children:[x.ramMB.toFixed(0)," MB"]}),b.jsx("div",{className:"flex justify-end",children:b.jsxs(Ke,{variant:"ghost",size:"xs",onClick:()=>S(x),disabled:y,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${y?"opacity-50":""}`,children:[b.jsx(fe,{icon:r===x.pid?en:ci,className:`size-3.5 ${r===x.pid?"animate-spin":""}`}),r===x.pid?e("claude.killing"):e("claude.kill")]})})]})]},x.pid))]})]})}function sWe(){const{t:e}=tn("monitoring"),[t,n]=k.useState("1h"),{data:r,isLoading:i,error:a}=ZHe(t),s=r?.dataPoints.map(o=>({time:new Date(o.timestamp*1e3).toLocaleTimeString(),timestamp:o.timestamp,cpu:Math.round(o.cpuPercent*10)/10,memoryUsed:Math.round(o.memoryUsedPercent*10)/10,memoryCache:Math.round(o.memoryCachePercent*10)/10}))||[];return b.jsxs("div",{className:"space-y-6",children:[b.jsx("div",{className:"sm:hidden",children:b.jsxs(ji,{value:t,onValueChange:o=>n(o),children:[b.jsx(Bi,{size:"sm",className:"w-auto gap-2",children:b.jsx(Fi,{})}),b.jsx(Ui,{children:BX.map(o=>b.jsx(Cn,{value:o,children:FX(o)},o))})]})}),b.jsx("div",{className:"hidden sm:flex gap-1",children:BX.map(o=>b.jsx(Ke,{variant:t===o?"secondary":"ghost",size:"xs",onClick:()=>n(o),children:FX(o)},o))}),i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("system.error",{message:a.message})}),r&&b.jsxs("div",{className:"space-y-6",children:[b.jsxs(xa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.cpuUsage")}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[r.current.cpu.toFixed(1),"%"]})]}),b.jsx(LX,{config:UX,className:"h-[150px] w-full",children:b.jsxs(DX,{data:s,margin:{left:0,right:0},children:[b.jsx(LL,{strokeDasharray:"3 3",vertical:!1}),b.jsx(my,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:40}),b.jsx(gy,{domain:[0,100],tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:o=>`${o}%`}),b.jsx(PX,{content:b.jsx(MX,{hideLabel:!0,formatter:o=>[`${o}% `,"CPU"]})}),b.jsx(rl,{type:"monotone",dataKey:"cpu",stroke:"var(--color-cpu)",fill:"var(--color-cpu)",fillOpacity:.4,strokeWidth:2})]})})]}),b.jsxs(xa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.memoryUsage")}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[gb(r.current.memory.used)," ",e("system.memoryLabels.used").toLowerCase()," + ",gb(r.current.memory.cache)," ",e("system.memoryLabels.cache").toLowerCase()," / ",gb(r.current.memory.total)]})]}),b.jsx(LX,{config:UX,className:"h-[150px] w-full",children:b.jsxs(DX,{data:s,margin:{left:0,right:0},children:[b.jsx(LL,{strokeDasharray:"3 3",vertical:!1}),b.jsx(my,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:40}),b.jsx(gy,{domain:[0,100],tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:o=>`${o}%`}),b.jsx(PX,{content:b.jsx(MX,{hideLabel:!0,formatter:(o,l)=>{const u=e(l==="memoryUsed"?"system.memoryLabels.used":"system.memoryLabels.cache");return[`${o}% `,u]}})}),b.jsx(rl,{type:"monotone",dataKey:"memoryUsed",stroke:"var(--color-memoryUsed)",fill:"var(--color-memoryUsed)",fillOpacity:.5,strokeWidth:2,stackId:"memory"}),b.jsx(rl,{type:"monotone",dataKey:"memoryCache",stroke:"var(--color-memoryCache)",fill:"var(--color-memoryCache)",fillOpacity:.4,strokeWidth:1,stackId:"memory"})]})})]}),b.jsxs(xa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.diskUsage",{path:r.current.disk.path})}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[r.current.disk.usedPercent.toFixed(1),"% (",gb(r.current.disk.used)," /"," ",gb(r.current.disk.total),")"]})]}),b.jsx("div",{className:"h-4 w-full overflow-hidden rounded-full bg-muted",children:b.jsx("div",{className:"h-full bg-chart-system transition-all",style:{width:`${Math.min(r.current.disk.usedPercent,100)}%`}})})]})]})]})}function oWe(){const{t:e}=tn("monitoring"),[t,n]=k.useState("memory"),{data:r,isLoading:i,error:a}=JHe(t),{data:s,isLoading:o}=eWe();return b.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start",children:[b.jsxs(xa,{className:"p-4 lg:flex-1 lg:min-w-0 h-[400px] flex flex-col",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between shrink-0",children:[b.jsx("h3",{className:"font-medium",children:e("processes.topProcesses")}),b.jsxs(ji,{value:t,onValueChange:l=>n(l),children:[b.jsx(Bi,{className:"w-32",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"memory",children:e("processes.sortBy.memory")}),b.jsx(Cn,{value:"cpu",children:e("processes.sortBy.cpu")})]})]})]}),i&&b.jsx("div",{className:"flex items-center justify-center flex-1",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("processes.error",{message:a.message})}),r&&r.length>0&&b.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"grid grid-cols-[60px_120px_1fr_70px_80px] gap-2 px-2 py-1 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("processes.headers.pid")}),b.jsx("span",{children:e("processes.headers.name")}),b.jsx("span",{children:e("processes.headers.command")}),b.jsx("span",{className:"text-right",children:e("processes.headers.memory")}),b.jsx("span",{className:"text-right",children:"%"})]}),r.map(l=>b.jsxs("div",{className:"grid grid-cols-[60px_120px_1fr_70px_80px] gap-2 rounded px-2 py-1.5 text-sm hover:bg-muted/50",children:[b.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:l.pid}),b.jsx("span",{className:"truncate font-medium",title:l.name,children:l.name}),b.jsx("span",{className:"truncate text-muted-foreground text-xs",title:l.command,children:l.command}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.memoryMB.toFixed(0)," MB"]}),b.jsxs("span",{className:"text-right tabular-nums text-muted-foreground",children:[l.memoryPercent.toFixed(1),"%"]})]},l.pid))]})}),r&&r.length===0&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.empty")})]}),b.jsxs(xa,{className:"p-4 lg:flex-1 lg:min-w-0 h-[400px] flex flex-col",children:[b.jsx("div",{className:"mb-4 flex items-center justify-between shrink-0",children:b.jsxs("h3",{className:"font-medium",children:[e("processes.containers"),s?.runtime&&b.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:["(",s.runtime,")"]})]})}),o&&b.jsx("div",{className:"flex items-center justify-center flex-1",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),s&&!s.available&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.containersUnavailable")}),s&&s.available&&s.containers.length===0&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.containersEmpty")}),s&&s.available&&s.containers.length>0&&b.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"grid grid-cols-[1fr_70px_100px_80px] gap-2 px-2 py-1 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("processes.headers.name")}),b.jsx("span",{className:"text-right",children:"CPU"}),b.jsx("span",{className:"text-right",children:e("processes.headers.memory")}),b.jsx("span",{className:"text-right",children:"%"})]}),s.containers.map(l=>b.jsxs("div",{className:"grid grid-cols-[1fr_70px_100px_80px] gap-2 rounded px-2 py-1.5 text-sm hover:bg-muted/50",children:[b.jsx("span",{className:"truncate font-medium",title:l.name,children:l.name}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.cpuPercent.toFixed(1),"%"]}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.memoryMB.toFixed(0)," / ",l.memoryLimit.toFixed(0)," MB"]}),b.jsxs("span",{className:"text-right tabular-nums text-muted-foreground",children:[l.memoryPercent.toFixed(1),"%"]})]},l.id))]})})]})]})}function lWe(){const{t:e}=tn("monitoring"),[t,n]=k.useState(null),{data:r,isLoading:i,error:a}=tWe(),s=nWe();k.useEffect(()=>{t!==null&&r&&!r.some(l=>l.backend?.pid===t)&&n(null)},[t,r]);const o=l=>{l.backend&&(n(l.backend.pid),s.mutate({backendPid:l.backend.pid},{onError:()=>n(null)}))};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("span",{className:"text-sm text-muted-foreground",children:e("vibora.description")}),r&&r.length>0&&b.jsx("span",{className:"text-sm text-muted-foreground",children:e("vibora.instanceCount",{count:r.length})})]}),i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("vibora.error",{message:a.message})}),r&&r.length===0&&b.jsx("div",{className:"py-12 text-center text-muted-foreground",children:e("vibora.empty")}),r&&r.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"hidden lg:grid grid-cols-[80px_100px_1fr_100px_80px] gap-4 px-3 py-2 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("vibora.headers.port")}),b.jsx("span",{children:e("vibora.headers.mode")}),b.jsx("span",{children:e("vibora.headers.directory")}),b.jsx("span",{className:"text-right",children:e("vibora.headers.ram")}),b.jsx("span",{className:"text-right",children:e("vibora.headers.actions")})]}),r.map(l=>{const u=t===l.backend?.pid,f=t!==null;return b.jsxs(xa,{className:"px-3 py-2",children:[b.jsxs("div",{className:"flex flex-col gap-1 lg:hidden",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2",children:[b.jsxs("span",{className:"text-sm font-medium",children:[b.jsxs("span",{className:"font-mono",children:[":",l.port]}),b.jsxs("span",{className:`ml-2 text-xs ${l.mode==="development"?"text-muted-foreground":""}`,children:[l.mode==="development"?e("vibora.mode.dev"):e("vibora.mode.prod"),l.frontend&&` + ${e("vibora.vite")}`]})]}),b.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.jsxs("span",{className:"tabular-nums text-sm text-muted-foreground",children:[l.totalMemoryMB.toFixed(0)," MB"]}),b.jsx(Ke,{variant:"ghost",size:"xs",onClick:()=>o(l),disabled:f||!l.backend,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${f?"opacity-50":""}`,children:b.jsx(fe,{icon:u?en:ci,className:`size-3.5 ${u?"animate-spin":""}`})})]})]}),b.jsx("span",{className:"text-xs text-muted-foreground truncate",title:l.viboraDir,children:l.viboraDir})]}),b.jsxs("div",{className:"hidden lg:grid grid-cols-[80px_100px_1fr_100px_80px] items-center gap-4",children:[b.jsx("span",{className:"font-mono text-sm",children:l.port}),b.jsxs("span",{className:`text-xs ${l.mode==="development"?"text-muted-foreground":""}`,children:[l.mode==="development"?e("vibora.mode.dev"):e("vibora.mode.prod"),l.frontend&&` + ${e("vibora.vite")}`]}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",title:l.viboraDir,children:l.viboraDir}),b.jsxs("span",{className:"text-right tabular-nums text-sm",children:[l.totalMemoryMB.toFixed(0)," MB"]}),b.jsx("div",{className:"flex justify-end",children:b.jsxs(Ke,{variant:"ghost",size:"xs",onClick:()=>o(l),disabled:f||!l.backend,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${f?"opacity-50":""}`,children:[b.jsx(fe,{icon:u?en:ci,className:`size-3.5 ${u?"animate-spin":""}`}),e(u?"vibora.killing":"vibora.kill")]})})]})]},l.backend?.pid||l.port)})]})]})}function uWe(e){return e>=90?"text-destructive":e>=70?"text-muted-foreground":"text-chart-system"}function cWe(e){if(e<60)return`${e}m`;const t=Math.floor(e/60),n=e%60;return n>0?`${t}h ${n}m`:`${t}h`}function UN(e){const t=new Date(e),n=new Date,r=t.getTime()-n.getTime(),i=Math.floor(r/(1e3*60*60*24));return i===0?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):i===1?`Tomorrow ${t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`:i<7?t.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function j_({percent:e,label:t,subtitle:n,color:r}){const i=[{value:Math.min(e,100),fill:r}],a=Math.round(96*vc),s=Math.round(48*vc),o=Math.round(32*vc),l=Math.round(44*vc),u=Math.round(10*vc),f=Math.round(5*vc);return b.jsx(xa,{className:"p-4",children:b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"relative size-24 shrink-0",children:[b.jsxs(GHe,{width:a,height:a,cx:s,cy:s,innerRadius:o,outerRadius:l,barSize:u,data:i,startAngle:90,endAngle:-270,children:[b.jsx(h0,{type:"number",domain:[0,100],angleAxisId:0,tick:!1}),b.jsx(p0,{background:{fill:"var(--border)"},dataKey:"value",cornerRadius:f,angleAxisId:0})]}),b.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:b.jsxs("span",{className:`text-lg font-semibold tabular-nums ${uWe(e)}`,children:[e.toFixed(0),"%"]})})]}),b.jsxs("div",{className:"flex-1 min-w-0",children:[b.jsx("h3",{className:"text-sm font-medium truncate",children:t}),b.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n})]})]})})}function dWe(){const{t:e}=tn("monitoring"),{data:t,isLoading:n,error:r}=rWe(),i=a=>a>=90?"var(--destructive)":a>=70?"var(--muted-foreground)":"var(--chart-system)";return b.jsxs("div",{className:"space-y-4",children:[n&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),r&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("usage.error",{message:r.message})}),t&&!t.available&&b.jsx("div",{className:"rounded-lg border border-muted-foreground/50 bg-muted p-4 text-sm text-muted-foreground",children:t.error||e("usage.unavailable")}),t&&t.available&&b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.fiveHour&&b.jsx(j_,{percent:t.fiveHour.percentUsed,label:e("usage.fiveHourBlock"),subtitle:e("usage.resetsIn",{time:cWe(t.fiveHour.timeRemainingMinutes)}),color:i(t.fiveHour.percentUsed)}),t.sevenDay&&b.jsx(j_,{percent:t.sevenDay.percentUsed,label:e("usage.sevenDayRolling"),subtitle:`${e("usage.resetsAt",{time:UN(t.sevenDay.resetAt)})} · ${e("usage.weekProgress",{percent:t.sevenDay.weekProgressPercent})}`,color:i(t.sevenDay.percentUsed)})]}),(t.sevenDayOpus||t.sevenDaySonnet)&&b.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.sevenDayOpus&&b.jsx(j_,{percent:t.sevenDayOpus.percentUsed,label:e("usage.opusWeekly"),subtitle:e("usage.resetsAt",{time:UN(t.sevenDayOpus.resetAt)}),color:i(t.sevenDayOpus.percentUsed)}),t.sevenDaySonnet&&b.jsx(j_,{percent:t.sevenDaySonnet.percentUsed,label:e("usage.sonnetWeekly"),subtitle:e("usage.resetsAt",{time:UN(t.sevenDaySonnet.resetAt)}),color:i(t.sevenDaySonnet.percentUsed)})]})]})]})}const $N={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"},fWe=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function hWe(){const{t:e}=tn("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),s=Math.floor(a/60),o=Math.floor(s/60),l=Math.floor(o/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):o>0?o===1?e("time.hourAgo"):e("time.hoursAgo",{count:o}):s>0?s===1?e("time.minuteAgo"):e("time.minutesAgo",{count:s}):e("time.justNow")}}function pWe(){const{t:e}=tn("common"),{t}=tn("worktrees"),n=hWe(),{worktrees:r,summary:i,isLoading:a,isLoadingDetails:s,error:o,refetch:l}=fie(),u=hie(),[f,d]=k.useState(new Set),[p,m]=k.useState(!1),[y,S]=k.useState(!1),[g,_]=k.useState(!1),[v,x]=k.useState(null),[T,w]=k.useState(null),[C,R]=k.useState(!1),O=$=>{d(q=>{const Y=new Set(q);return Y.has($)?Y.delete($):Y.add($),Y})},N=()=>{d(new Set)},L=k.useMemo(()=>f.size===0?r:r.filter($=>!!($.isOrphaned&&f.has("ORPHANED")||$.taskStatus&&f.has($.taskStatus))),[r,f]),D=k.useMemo(()=>r.filter($=>$.taskStatus==="DONE"||$.taskStatus==="CANCELED"),[r]),z=async()=>{if(D.length!==0){S(!0);try{for(const $ of D)await u.mutateAsync({worktreePath:$.path,repoPath:$.repoPath,deleteLinkedTask:g});m(!1),l()}catch{}finally{S(!1)}}},M=async($,q)=>{x($.path);try{await u.mutateAsync({worktreePath:$.path,repoPath:$.repoPath,deleteLinkedTask:q}),w(null),l()}catch{}finally{x(null)}},V=$=>{$||(w(null),R(!1))},W=$=>{m($),$||_(!1)};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[b.jsx("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:(i||r.length>0)&&b.jsxs(b.Fragment,{children:[b.jsx("span",{children:t("summary.total",{count:i?.total??r.length})}),(i?.orphaned??r.filter($=>$.isOrphaned).length)>0&&b.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:i?.orphaned??r.filter($=>$.isOrphaned).length})}),s?b.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):i?b.jsx("span",{children:i.totalSizeFormatted}):null]})}),b.jsxs("div",{className:"flex items-center gap-2",children:[D.length>0&&b.jsxs(go,{open:p,onOpenChange:W,children:[b.jsxs(bo,{render:b.jsx(Ke,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:s}),children:[b.jsx(fe,{icon:rte,size:12,strokeWidth:2}),t("cleanup.button",{count:D.length})]}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:t("cleanup.title")}),b.jsxs(So,{children:[t("cleanup.description",{count:D.length}),g&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:g,onCheckedChange:$=>_($===!0),disabled:y}),t("cleanup.alsoDeleteLinkedTasks")]}),b.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:y,children:e("buttons.cancel")}),b.jsxs(Ke,{variant:"destructive",onClick:z,disabled:y,className:"gap-2",children:[y&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),y?e("status.deleting"):t("delete.button",{count:D.length})]})]})]})]}),f.size>0&&b.jsxs(Ke,{variant:"ghost",size:"sm",onClick:N,className:"gap-1.5 text-xs",children:[b.jsx(fe,{icon:ci,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),b.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:fWe.map($=>{const q=f.has($);return b.jsx("button",{onClick:()=>O($),className:Ue("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",q?$N[$]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${$}`)},$)})}),a&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),o&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:t("error.failedToLoad",{message:o.message})}),!a&&!o&&L.length===0&&b.jsx("div",{className:"py-12 text-center text-muted-foreground",children:f.size>0?t("empty.noMatch"):t("empty.noWorktrees")}),!a&&L.length>0&&b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3",children:L.map($=>{const q=$.sizeFormatted==="..."||$.branch==="...",Y=!$.isOrphaned&&$.taskId,B=v===$.path;return b.jsx(xa,{className:"transition-colors hover:border-border/80",children:b.jsxs(Df,{className:"flex items-start justify-between gap-4 py-4",children:[b.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"truncate font-medium",children:$.name}),$.isOrphaned?b.jsx(co,{className:Ue("shrink-0",$N.ORPHANED),children:e("statuses.ORPHANED")}):$.taskStatus?b.jsx(co,{className:Ue("shrink-0",$N[$.taskStatus]),children:e(`statuses.${$.taskStatus}`)}):null]}),b.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Hi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:$.path})]}),b.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vx,size:12,strokeWidth:2,className:"shrink-0"}),$.branch==="..."?b.jsx("span",{className:"inline-block animate-pulse rounded bg-muted h-3 w-16"}):b.jsx("span",{className:"font-mono",children:$.branch})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:ate,size:12,strokeWidth:2,className:"shrink-0"}),$.sizeFormatted==="..."?b.jsx("span",{className:"inline-block animate-pulse rounded bg-muted h-3 w-12"}):b.jsx("span",{children:$.sizeFormatted})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:tte,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{children:n($.lastModified)})]})]}),$.taskId&&$.taskTitle&&b.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:b.jsxs(wi,{to:"/tasks/$taskId",params:{taskId:$.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[b.jsx("span",{className:"truncate",children:$.taskTitle}),b.jsx(fe,{icon:$y,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),b.jsxs(go,{open:T?.path===$.path,onOpenChange:V,children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:q||B,onClick:()=>w($)}),children:b.jsx(fe,{icon:B?en:$c,size:14,strokeWidth:2,className:B?"animate-spin":""})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:t("delete.title")}),b.jsxs(So,{children:[t("delete.description")," ",b.jsx("span",{className:"font-mono",children:$.name}),".",C&&Y&&b.jsxs(b.Fragment,{children:[" ",t("delete.linkedTaskWillBeDeleted",{title:$.taskTitle})]})," ",t("delete.cannotUndo")]}),Y&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:C,onCheckedChange:j=>R(j===!0),disabled:B}),t("delete.alsoDeleteLinkedTask",{title:$.taskTitle})]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:B,children:e("buttons.cancel")}),b.jsxs(Ke,{variant:"destructive",onClick:()=>M($,C),disabled:B,className:"gap-2",children:[B&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),e(B?"status.deleting":"buttons.delete")]})]})]})]})]})},$.path)})})]})}function mWe(){const{t:e}=tn("monitoring"),{data:t}=Ane(),n=Wi(),{tab:r}=Dle.useSearch(),i=r||"system",a=k.useCallback(l=>{n({to:"/monitoring",search:l==="system"?{}:{tab:l},replace:!0})},[n]),o=[{value:"system",label:e("tabs.system")},{value:"processes",label:e("tabs.processes")},{value:"claude",label:e("tabs.claude")},{value:"vibora",label:e("tabs.vibora"),devOnly:!0},{value:"worktrees",label:e("tabs.worktrees")},{value:"usage",label:e("tabs.usage")}].filter(l=>!l.devOnly||t?.enabled);return b.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[b.jsxs("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2",children:[b.jsx("div",{className:"sm:hidden",children:b.jsxs(ji,{value:i,onValueChange:l=>a(l),children:[b.jsx(Bi,{size:"sm",className:"w-auto gap-2",children:b.jsx(Fi,{})}),b.jsx(Ui,{children:o.map(l=>b.jsx(Cn,{value:l.value,children:l.label},l.value))})]})}),b.jsx("div",{className:"hidden sm:block",children:b.jsx(su,{value:i,onValueChange:l=>a(l),children:b.jsx(ou,{variant:"line",children:o.map(l=>b.jsx(li,{value:l.value,className:"px-3 py-1.5",children:l.label},l.value))})})})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i==="system"&&b.jsx(sWe,{}),i==="processes"&&b.jsx(oWe,{}),i==="claude"&&b.jsx(aWe,{}),i==="vibora"&&t?.enabled&&b.jsx(lWe,{}),i==="worktrees"&&b.jsx(pWe,{}),i==="usage"&&b.jsx(dWe,{})]})]})}const gWe=()=>"http://localhost:3000",bb={activeTab:"diff",browserUrl:gWe(),diffOptions:{wrap:!0,ignoreWhitespace:!0,includeUntracked:!1,collapsedFiles:[]},filesViewState:{selectedFile:null,expandedDirs:[]}};function u5(e){const t=wr(),n=k.useRef(void 0),r=k.useRef({}),{data:i}=wne(e),a=k.useMemo(()=>{const p=i?.viewState;return p?{activeTab:p.activeTab??bb.activeTab,browserUrl:p.browserUrl??bb.browserUrl,diffOptions:{...bb.diffOptions,...p.diffOptions},filesViewState:{...bb.filesViewState,...p.filesViewState}}:bb},[i?.viewState]),s=zn({mutationFn:async p=>{const m=await fetch(`/api/tasks/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({viewState:p})});if(!m.ok)throw new Error("Failed to update view state");return m.json()},onSuccess:p=>{t.setQueryData(["tasks",e],p),t.setQueryData(["tasks"],m=>m&&m.map(y=>y.id===e?p:y))}}),o=k.useCallback(p=>{const m=r.current;r.current={...m,...p,diffOptions:p.diffOptions||m.diffOptions?{...m.diffOptions,...p.diffOptions}:void 0,filesViewState:p.filesViewState||m.filesViewState?{...m.filesViewState,...p.filesViewState}:void 0};const y=r.current,S={activeTab:y.activeTab??a.activeTab,browserUrl:y.browserUrl??a.browserUrl,diffOptions:{...a.diffOptions,...y.diffOptions},filesViewState:{...a.filesViewState,...y.filesViewState}};t.setQueryData(["tasks",e],g=>g&&{...g,viewState:S}),t.setQueryData(["tasks"],g=>g&&g.map(_=>_.id===e?{..._,viewState:S}:_)),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{s.mutate(S),r.current={}},500)},[t,e,a,s]),l=k.useCallback(p=>{o({activeTab:p})},[o]),u=k.useCallback(p=>{o({browserUrl:p})},[o]),f=k.useCallback(p=>{o({diffOptions:p})},[o]),d=k.useCallback(p=>{o({filesViewState:p})},[o]);return{viewState:a,setActiveTab:l,setBrowserUrl:u,setDiffOptions:f,setFilesViewState:d}}function bWe(e){return qn({queryKey:["linear-ticket",e],queryFn:async()=>{if(!e)return null;const t=await fetch(`/api/linear/ticket/${e}`);return t.ok?t.json():null},enabled:!!e,staleTime:300*1e3})}function vWe(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function yWe(e){return{id:e.id,name:e.name,position:e.position,directory:e.directory??void 0,createdAt:e.createdAt}}function c5(e={}){const t=aie();return{get terminals(){return t.terminals.map(vWe)},get terminalsLoaded(){return t.terminalsLoaded},get tabs(){return t.tabs.map(yWe)},get connected(){return t.connected},get newTerminalIds(){return t.newTerminalIds},createTerminal:t.createTerminal,destroyTerminal:t.destroyTerminal,writeToTerminal:t.writeToTerminal,sendInputToTerminal:t.sendInputToTerminal,resizeTerminal:t.resizeTerminal,renameTerminal:t.renameTerminal,clearTerminalBuffer:t.clearTerminalBuffer,assignTerminalToTab:t.assignTerminalToTab,createTab:t.createTab,updateTab:t.updateTab,deleteTab:t.deleteTab,reorderTab:t.reorderTab,attachXterm:t.attachXterm,setupImagePaste:t.setupImagePaste,consumePendingStartup:t.consumePendingStartup,clearStartingUp:t.clearStartingUp}}function F_(e){return`$'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function $X({taskName:e,cwd:t,className:n,aiMode:r,description:i,startupScript:a,serverPort:s=7777}){const o=k.useRef(null),l=k.useRef(null),u=k.useRef(null),f=k.useRef(!1),d=k.useRef(!1),[p,m]=k.useState(null),[y,S]=k.useState(!1),[g,_]=k.useState(!1),[v,x]=k.useState(!1),[T,w]=k.useState(!1),{resolvedTheme:C}=qc(),R=C==="dark",O=R?Die:Iie;k.useEffect(()=>{kt.taskTerminal.debug("cwd changed, resetting refs",{cwd:t}),f.current=!1,d.current=!1,m(null),S(!1)},[t]);const{setTerminalFocused:N}=mM(),{terminals:L,terminalsLoaded:D,connected:z,createTerminal:M,attachXterm:V,resizeTerminal:W,setupImagePaste:$,writeToTerminal:q,consumePendingStartup:Y,clearStartingUp:B}=c5(),j=k.useRef(V),U=k.useRef($),K=k.useRef(q),H=k.useRef(Y),J=k.useRef(B);k.useEffect(()=>{j.current=V},[V]),k.useEffect(()=>{U.current=$},[$]),k.useEffect(()=>{K.current=q},[q]),k.useEffect(()=>{H.current=Y},[Y]),k.useEffect(()=>{J.current=B},[B]);const se=p?L.find(Z=>Z.id===p):null,ae=se?.status;k.useEffect(()=>{if(!o.current||l.current)return;const Z=new Oie.Terminal({cursorBlink:!0,fontSize:Math.round(13*vc),fontFamily:"JetBrains Mono Variable, PureNerdFont, Menlo, Monaco, monospace",lineHeight:1.2,theme:O}),ee=new Rie.FitAddon,ne=new Nie.WebLinksAddon;Z.loadAddon(ee),Z.loadAddon(ne),Z.open(o.current),l.current=Z,u.current=ee,x(!0),requestAnimationFrame(()=>{ee.fit()});const te=setTimeout(()=>{ee.fit(),Z.refresh(0,Z.rows-1)},100),be=()=>N(!0),_e=()=>N(!1);return Z.textarea&&(Z.textarea.addEventListener("focus",be),Z.textarea.addEventListener("blur",_e)),()=>{clearTimeout(te),Z.textarea&&(Z.textarea.removeEventListener("focus",be),Z.textarea.removeEventListener("blur",_e)),N(!1),Z.dispose(),l.current=null,u.current=null,x(!1)}},[N]);const Q=k.useCallback(()=>{if(!u.current||!l.current)return;u.current.fit();const{cols:Z,rows:ee}=l.current;p&&W(p,Z,ee)},[p,W]);k.useEffect(()=>{if(!o.current)return;const Z=()=>{requestAnimationFrame(Q)};window.addEventListener("resize",Z);const ee=()=>{document.visibilityState==="visible"&&requestAnimationFrame(()=>{Q(),l.current&&l.current.refresh(0,l.current.rows-1)})};document.addEventListener("visibilitychange",ee);const ne=new ResizeObserver(Z);ne.observe(o.current);const te=new IntersectionObserver(be=>{be[0]?.isIntersecting&&requestAnimationFrame(()=>{Q(),l.current&&l.current.refresh(0,l.current.rows-1)})},{threshold:.1});return te.observe(o.current),()=>{window.removeEventListener("resize",Z),document.removeEventListener("visibilitychange",ee),ne.disconnect(),te.disconnect()}},[Q]),k.useEffect(()=>{if(!z||!t||!v||!D)return;const Z=L.find(ee=>ee.cwd===t);if(Z){m(Z.id);return}if(!f.current&&l.current){f.current=!0,S(!0);const{cols:ee,rows:ne}=l.current;M({name:e,cols:ee,rows:ne,cwd:t,startup:{startupScript:a,aiMode:r,description:i,taskName:e,serverPort:s}})}},[z,t,v,D,L,e,M]),k.useEffect(()=>{if(!t)return;const Z=L.find(ne=>ne.cwd===t);if(!Z)return;const ee=p&&L.some(ne=>ne.id===p);(!p||!ee)&&(kt.taskTerminal.debug("setting terminalId",{newId:Z.id,prevId:p,reason:p?"tempId replaced":"initial",cwd:t,terminalCount:L.length}),m(Z.id),S(!1),p&&!ee&&(d.current=!1))},[L,t,p]),k.useEffect(()=>{if(kt.taskTerminal.debug("attach effect",{terminalId:p,hasTermRef:!!l.current,hasContainerRef:!!o.current,attachedRef:d.current}),!p||!l.current||!o.current||d.current)return;kt.taskTerminal.debug("attach effect passed guards, calling attachXterm",{terminalId:p});const Z=te=>{requestAnimationFrame(Q);const be=H.current(te);if(kt.taskTerminal.debug("onAttached checking pending startup",{terminalId:te,hasPendingStartup:!!be}),be){kt.taskTerminal.info("onAttached: running startup commands",{terminalId:te}),_(!0);const{startupScript:_e,aiMode:he,description:ye,taskName:Ee,serverPort:xe}=be;_e&&setTimeout(()=>{const Re="VIBORA_STARTUP_"+Date.now(),Pe=`source /dev/stdin <<'${Re}'
111
+ `)}}):null},PX=Ho;function MX({active:e,payload:t,className:n,indicator:r="dot",hideLabel:i=!1,hideIndicator:a=!1,label:s,labelFormatter:o,labelClassName:l,formatter:u,color:f,nameKey:d,labelKey:p}){const{config:m}=KHe(),y=k.useMemo(()=>{if(i||!t?.length)return null;const[g]=t,_=`${p||g?.dataKey||g?.name||"value"}`,v=jX(m,g,_),x=!p&&typeof s=="string"?m[s]?.label||s:v?.label;return o?b.jsx("div",{className:Ue("font-medium",l),children:o(x,t)}):x?b.jsx("div",{className:Ue("font-medium",l),children:x}):null},[s,o,t,i,l,m,p]);if(!e||!t?.length)return null;const S=t.length===1&&r!=="dot";return b.jsxs("div",{className:Ue("border-border/50 bg-background gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs/relaxed shadow-xl grid min-w-[8rem] items-start",n),children:[S?null:y,b.jsx("div",{className:"grid gap-1.5",children:t.filter(g=>g.type!=="none").map((g,_)=>{const v=`${d||g.name||g.dataKey||"value"}`,x=jX(m,g,v),T=f||g.payload.fill||g.color;return b.jsx("div",{className:Ue("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",r==="dot"&&"items-center"),children:u&&g?.value!==void 0&&g.name?u(g.value,g.name,g,_,g.payload):b.jsxs(b.Fragment,{children:[x?.icon?b.jsx(x.icon,{}):!a&&b.jsx("div",{className:Ue("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":S&&r==="dashed"}),style:{"--color-bg":T,"--color-border":T}}),b.jsxs("div",{className:Ue("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[b.jsxs("div",{className:"grid gap-1.5",children:[S?y:null,b.jsx("span",{className:"text-muted-foreground",children:x?.label||g.name})]}),g.value&&b.jsx("span",{className:"text-foreground font-mono font-medium tabular-nums",children:g.value.toLocaleString()})]})]})},g.dataKey)})})]})}function jX(e,t,n){if(typeof t!="object"||t===null)return;const r="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let i=n;return n in t&&typeof t[n]=="string"?i=t[n]:r&&n in r&&typeof r[n]=="string"&&(i=r[n]),i in e?e[i]:e[n]}const Tu="";function XHe(e="vibora"){return qn({queryKey:["monitoring","claude-instances",e],queryFn:()=>$t(`${Tu}/api/monitoring/claude-instances?filter=${e}`),refetchInterval:5e3})}function ZHe(e="1h"){return qn({queryKey:["monitoring","system-metrics",e],queryFn:()=>$t(`${Tu}/api/monitoring/system-metrics?window=${e}`),refetchInterval:5e3})}function QHe(){const e=wr();return zn({mutationFn:({terminalId:t,pid:n})=>{if(t)return $t(`${Tu}/api/monitoring/claude-instances/${t}/kill`,{method:"POST"});if(n)return $t(`${Tu}/api/monitoring/claude-instances/${n}/kill-pid`,{method:"POST"});throw new Error("Either terminalId or pid must be provided")},onSuccess:()=>{e.invalidateQueries({queryKey:["monitoring","claude-instances"]})}})}function gb(e){if(e===0)return"0 B";const t=1024,n=["B","KB","MB","GB","TB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(1))} ${n[r]}`}function FX(e){return{"1m":"1 min","10m":"10 min","1h":"1 hour","3h":"3 hours","6h":"6 hours","12h":"12 hours","24h":"24 hours"}[e]}function JHe(e="memory",t=10){return qn({queryKey:["monitoring","top-processes",e,t],queryFn:()=>$t(`${Tu}/api/monitoring/top-processes?sort=${e}&limit=${t}`),refetchInterval:5e3})}function eWe(){return qn({queryKey:["monitoring","docker-stats"],queryFn:()=>$t(`${Tu}/api/monitoring/docker-stats`),refetchInterval:5e3})}function tWe(){return qn({queryKey:["monitoring","vibora-instances"],queryFn:()=>$t(`${Tu}/api/monitoring/vibora-instances`),refetchInterval:5e3})}function nWe(){const e=wr();return zn({mutationFn:({backendPid:t})=>$t(`${Tu}/api/monitoring/vibora-instances/${t}/kill`,{method:"POST"}),onSuccess:()=>{e.invalidateQueries({queryKey:["monitoring","vibora-instances"]})}})}function rWe(){return qn({queryKey:["monitoring","claude-usage"],queryFn:()=>$t(`${Tu}/api/monitoring/claude-usage`),refetchInterval:5e3})}const iWe=["system","processes","claude","vibora","worktrees","usage"],Dle=Ms("/monitoring/")({component:mWe,validateSearch:e=>({tab:iWe.includes(e.tab)?e.tab:void 0})}),BX=["1m","10m","1h","3h","6h","12h","24h"],UX={cpu:{label:"CPU",color:"var(--chart-system)"},memoryUsed:{label:"Used",color:"var(--chart-system)"},memoryCache:{label:"Cache / Buffers",color:"var(--muted-foreground)"},disk:{label:"Disk",color:"var(--muted-foreground)"}};function aWe(){const{t:e}=tn("monitoring"),[t,n]=k.useState("vibora"),[r,i]=k.useState(null),[a,s]=k.useState(new Set),[o,l]=k.useState(!1),{data:u,isLoading:f,error:d}=XHe(t),p=QHe(),m=u?.reduce((x,T)=>x+T.ramMB,0)||0,y=r!==null||o;k.useEffect(()=>{r!==null&&u&&!u.some(x=>x.pid===r)&&i(null)},[r,u]),k.useEffect(()=>{if(a.size>0&&u){const x=new Set([...a].filter(T=>u.some(w=>w.pid===T)));x.size!==a.size&&s(x)}},[a,u]);const S=x=>{i(x.pid);const T=x.isViboraManaged&&x.terminalId?{terminalId:x.terminalId}:{pid:x.pid};p.mutate(T,{onError:()=>i(null)})},g=x=>{s(T=>{const w=new Set(T);return w.has(x)?w.delete(x):w.add(x),w})},_=()=>{u&&(a.size===u.length?s(new Set):s(new Set(u.map(x=>x.pid))))},v=async()=>{if(!u||a.size===0)return;l(!0);const x=u.filter(T=>a.has(T.pid));for(const T of x){const w=T.isViboraManaged&&T.terminalId?{terminalId:T.terminalId}:{pid:T.pid};try{await p.mutateAsync(w)}catch{}}s(new Set),l(!1)};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(zo,{id:"show-all",checked:t==="all",onCheckedChange:x=>n(x?"all":"vibora")}),b.jsx(Ote,{htmlFor:"show-all",className:"text-sm text-muted-foreground",children:e("claude.showAllInstances")})]}),a.size>0&&b.jsxs(Ke,{variant:"destructive",size:"sm",onClick:v,disabled:y,className:"gap-1.5",children:[o?b.jsx(fe,{icon:en,className:"size-3.5 animate-spin"}):b.jsx(fe,{icon:ci,className:"size-3.5"}),e("claude.killSelected",{count:a.size})]})]}),u&&b.jsxs("span",{className:"text-sm text-muted-foreground",children:[e("claude.instanceCount",{count:u.length}),m>0&&` · ${e("claude.totalRam",{ram:m.toFixed(0)})}`]})]}),f&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),d&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("claude.error",{message:d.message})}),u&&u.length===0&&b.jsxs("div",{className:"py-12 text-center text-muted-foreground",children:[e("claude.empty"),t==="vibora"&&e("claude.emptyVibora")]}),u&&u.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"hidden lg:grid grid-cols-[32px_60px_150px_1fr_1fr_80px_80px] gap-4 px-3 py-2 text-xs font-medium text-muted-foreground",children:[b.jsx("div",{className:"flex items-center justify-center",children:b.jsx(Ti,{checked:a.size===u.length,onCheckedChange:_,disabled:y})}),b.jsx("span",{children:e("claude.headers.pid")}),b.jsx("span",{children:e("claude.headers.terminal")}),b.jsx("span",{children:e("claude.headers.task")}),b.jsx("span",{children:e("claude.headers.workingDirectory")}),b.jsx("span",{className:"text-right",children:e("claude.headers.ram")}),b.jsx("span",{className:"text-right",children:e("claude.headers.actions")})]}),u.map(x=>b.jsxs(xa,{className:"px-3 py-2",children:[b.jsxs("div",{className:"flex flex-col gap-1 lg:hidden",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2",children:[b.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[b.jsx(Ti,{checked:a.has(x.pid),onCheckedChange:()=>g(x.pid),disabled:y,className:"shrink-0"}),b.jsx("span",{className:"text-sm font-medium truncate",children:x.taskId?b.jsx(wi,{to:"/tasks/$taskId",params:{taskId:x.taskId},className:"hover:text-foreground hover:underline",children:x.taskTitle}):b.jsx("span",{className:"text-muted-foreground",children:x.isViboraManaged?x.terminalName:e("claude.source.external")})})]}),b.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.jsxs("span",{className:"tabular-nums text-sm text-muted-foreground",children:[x.ramMB.toFixed(0)," MB"]}),b.jsx(Ke,{variant:"ghost",size:"xs",onClick:()=>S(x),disabled:y,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${y?"opacity-50":""}`,children:b.jsx(fe,{icon:r===x.pid?en:ci,className:`size-3.5 ${r===x.pid?"animate-spin":""}`})})]})]}),b.jsx("span",{className:"text-xs text-muted-foreground truncate pl-6",title:x.cwd,children:x.cwd})]}),b.jsxs("div",{className:"hidden lg:grid grid-cols-[32px_60px_150px_1fr_1fr_80px_80px] items-center gap-4",children:[b.jsx("div",{className:"flex items-center justify-center",children:b.jsx(Ti,{checked:a.has(x.pid),onCheckedChange:()=>g(x.pid),disabled:y})}),b.jsx("span",{className:"font-mono text-xs",children:x.pid}),b.jsx("span",{className:"truncate text-sm",children:x.isViboraManaged?b.jsx("span",{children:x.terminalName||`Terminal ${x.terminalId?.slice(0,8)}`}):b.jsx("span",{className:"text-muted-foreground",children:e("claude.source.external")})}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",children:x.taskId?b.jsx(wi,{to:"/tasks/$taskId",params:{taskId:x.taskId},className:"hover:text-foreground hover:underline",children:x.taskTitle}):e("claude.noTask")}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",title:x.cwd,children:x.cwd}),b.jsxs("span",{className:"text-right tabular-nums text-sm",children:[x.ramMB.toFixed(0)," MB"]}),b.jsx("div",{className:"flex justify-end",children:b.jsxs(Ke,{variant:"ghost",size:"xs",onClick:()=>S(x),disabled:y,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${y?"opacity-50":""}`,children:[b.jsx(fe,{icon:r===x.pid?en:ci,className:`size-3.5 ${r===x.pid?"animate-spin":""}`}),r===x.pid?e("claude.killing"):e("claude.kill")]})})]})]},x.pid))]})]})}function sWe(){const{t:e}=tn("monitoring"),[t,n]=k.useState("1h"),{data:r,isLoading:i,error:a}=ZHe(t),s=r?.dataPoints.map(o=>({time:new Date(o.timestamp*1e3).toLocaleTimeString(),timestamp:o.timestamp,cpu:Math.round(o.cpuPercent*10)/10,memoryUsed:Math.round(o.memoryUsedPercent*10)/10,memoryCache:Math.round(o.memoryCachePercent*10)/10}))||[];return b.jsxs("div",{className:"space-y-6",children:[b.jsx("div",{className:"sm:hidden",children:b.jsxs(ji,{value:t,onValueChange:o=>n(o),children:[b.jsx(Bi,{size:"sm",className:"w-auto gap-2",children:b.jsx(Fi,{})}),b.jsx(Ui,{children:BX.map(o=>b.jsx(Cn,{value:o,children:FX(o)},o))})]})}),b.jsx("div",{className:"hidden sm:flex gap-1",children:BX.map(o=>b.jsx(Ke,{variant:t===o?"secondary":"ghost",size:"xs",onClick:()=>n(o),children:FX(o)},o))}),i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("system.error",{message:a.message})}),r&&b.jsxs("div",{className:"space-y-6",children:[b.jsxs(xa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.cpuUsage")}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[r.current.cpu.toFixed(1),"%"]})]}),b.jsx(LX,{config:UX,className:"h-[150px] w-full",children:b.jsxs(DX,{data:s,margin:{left:0,right:0},children:[b.jsx(LL,{strokeDasharray:"3 3",vertical:!1}),b.jsx(my,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:40}),b.jsx(gy,{domain:[0,100],tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:o=>`${o}%`}),b.jsx(PX,{content:b.jsx(MX,{hideLabel:!0,formatter:o=>[`${o}% `,"CPU"]})}),b.jsx(rl,{type:"monotone",dataKey:"cpu",stroke:"var(--color-cpu)",fill:"var(--color-cpu)",fillOpacity:.4,strokeWidth:2})]})})]}),b.jsxs(xa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.memoryUsage")}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[gb(r.current.memory.used)," ",e("system.memoryLabels.used").toLowerCase()," + ",gb(r.current.memory.cache)," ",e("system.memoryLabels.cache").toLowerCase()," / ",gb(r.current.memory.total)]})]}),b.jsx(LX,{config:UX,className:"h-[150px] w-full",children:b.jsxs(DX,{data:s,margin:{left:0,right:0},children:[b.jsx(LL,{strokeDasharray:"3 3",vertical:!1}),b.jsx(my,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:40}),b.jsx(gy,{domain:[0,100],tickLine:!1,axisLine:!1,tickMargin:8,tickFormatter:o=>`${o}%`}),b.jsx(PX,{content:b.jsx(MX,{hideLabel:!0,formatter:(o,l)=>{const u=e(l==="memoryUsed"?"system.memoryLabels.used":"system.memoryLabels.cache");return[`${o}% `,u]}})}),b.jsx(rl,{type:"monotone",dataKey:"memoryUsed",stroke:"var(--color-memoryUsed)",fill:"var(--color-memoryUsed)",fillOpacity:.5,strokeWidth:2,stackId:"memory"}),b.jsx(rl,{type:"monotone",dataKey:"memoryCache",stroke:"var(--color-memoryCache)",fill:"var(--color-memoryCache)",fillOpacity:.4,strokeWidth:1,stackId:"memory"})]})})]}),b.jsxs(xa,{className:"p-4",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[b.jsx("h3",{className:"font-medium",children:e("system.diskUsage",{path:r.current.disk.path})}),b.jsxs("span",{className:"text-sm text-muted-foreground tabular-nums",children:[r.current.disk.usedPercent.toFixed(1),"% (",gb(r.current.disk.used)," /"," ",gb(r.current.disk.total),")"]})]}),b.jsx("div",{className:"h-4 w-full overflow-hidden rounded-full bg-muted",children:b.jsx("div",{className:"h-full bg-chart-system transition-all",style:{width:`${Math.min(r.current.disk.usedPercent,100)}%`}})})]})]})]})}function oWe(){const{t:e}=tn("monitoring"),[t,n]=k.useState("memory"),{data:r,isLoading:i,error:a}=JHe(t),{data:s,isLoading:o}=eWe();return b.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start",children:[b.jsxs(xa,{className:"p-4 lg:flex-1 lg:min-w-0 h-[400px] flex flex-col",children:[b.jsxs("div",{className:"mb-4 flex items-center justify-between shrink-0",children:[b.jsx("h3",{className:"font-medium",children:e("processes.topProcesses")}),b.jsxs(ji,{value:t,onValueChange:l=>n(l),children:[b.jsx(Bi,{className:"w-32",children:b.jsx(Fi,{})}),b.jsxs(Ui,{children:[b.jsx(Cn,{value:"memory",children:e("processes.sortBy.memory")}),b.jsx(Cn,{value:"cpu",children:e("processes.sortBy.cpu")})]})]})]}),i&&b.jsx("div",{className:"flex items-center justify-center flex-1",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("processes.error",{message:a.message})}),r&&r.length>0&&b.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"grid grid-cols-[60px_120px_1fr_70px_80px] gap-2 px-2 py-1 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("processes.headers.pid")}),b.jsx("span",{children:e("processes.headers.name")}),b.jsx("span",{children:e("processes.headers.command")}),b.jsx("span",{className:"text-right",children:e("processes.headers.memory")}),b.jsx("span",{className:"text-right",children:"%"})]}),r.map(l=>b.jsxs("div",{className:"grid grid-cols-[60px_120px_1fr_70px_80px] gap-2 rounded px-2 py-1.5 text-sm hover:bg-muted/50",children:[b.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:l.pid}),b.jsx("span",{className:"truncate font-medium",title:l.name,children:l.name}),b.jsx("span",{className:"truncate text-muted-foreground text-xs",title:l.command,children:l.command}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.memoryMB.toFixed(0)," MB"]}),b.jsxs("span",{className:"text-right tabular-nums text-muted-foreground",children:[l.memoryPercent.toFixed(1),"%"]})]},l.pid))]})}),r&&r.length===0&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.empty")})]}),b.jsxs(xa,{className:"p-4 lg:flex-1 lg:min-w-0 h-[400px] flex flex-col",children:[b.jsx("div",{className:"mb-4 flex items-center justify-between shrink-0",children:b.jsxs("h3",{className:"font-medium",children:[e("processes.containers"),s?.runtime&&b.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:["(",s.runtime,")"]})]})}),o&&b.jsx("div",{className:"flex items-center justify-center flex-1",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),s&&!s.available&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.containersUnavailable")}),s&&s.available&&s.containers.length===0&&b.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:e("processes.containersEmpty")}),s&&s.available&&s.containers.length>0&&b.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:b.jsxs("div",{className:"space-y-1",children:[b.jsxs("div",{className:"grid grid-cols-[1fr_70px_100px_80px] gap-2 px-2 py-1 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("processes.headers.name")}),b.jsx("span",{className:"text-right",children:"CPU"}),b.jsx("span",{className:"text-right",children:e("processes.headers.memory")}),b.jsx("span",{className:"text-right",children:"%"})]}),s.containers.map(l=>b.jsxs("div",{className:"grid grid-cols-[1fr_70px_100px_80px] gap-2 rounded px-2 py-1.5 text-sm hover:bg-muted/50",children:[b.jsx("span",{className:"truncate font-medium",title:l.name,children:l.name}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.cpuPercent.toFixed(1),"%"]}),b.jsxs("span",{className:"text-right tabular-nums",children:[l.memoryMB.toFixed(0)," / ",l.memoryLimit.toFixed(0)," MB"]}),b.jsxs("span",{className:"text-right tabular-nums text-muted-foreground",children:[l.memoryPercent.toFixed(1),"%"]})]},l.id))]})})]})]})}function lWe(){const{t:e}=tn("monitoring"),[t,n]=k.useState(null),{data:r,isLoading:i,error:a}=tWe(),s=nWe();k.useEffect(()=>{t!==null&&r&&!r.some(l=>l.backend?.pid===t)&&n(null)},[t,r]);const o=l=>{l.backend&&(n(l.backend.pid),s.mutate({backendPid:l.backend.pid},{onError:()=>n(null)}))};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex items-center justify-between",children:[b.jsx("span",{className:"text-sm text-muted-foreground",children:e("vibora.description")}),r&&r.length>0&&b.jsx("span",{className:"text-sm text-muted-foreground",children:e("vibora.instanceCount",{count:r.length})})]}),i&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),a&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("vibora.error",{message:a.message})}),r&&r.length===0&&b.jsx("div",{className:"py-12 text-center text-muted-foreground",children:e("vibora.empty")}),r&&r.length>0&&b.jsxs("div",{className:"space-y-2",children:[b.jsxs("div",{className:"hidden lg:grid grid-cols-[80px_100px_1fr_100px_80px] gap-4 px-3 py-2 text-xs font-medium text-muted-foreground",children:[b.jsx("span",{children:e("vibora.headers.port")}),b.jsx("span",{children:e("vibora.headers.mode")}),b.jsx("span",{children:e("vibora.headers.directory")}),b.jsx("span",{className:"text-right",children:e("vibora.headers.ram")}),b.jsx("span",{className:"text-right",children:e("vibora.headers.actions")})]}),r.map(l=>{const u=t===l.backend?.pid,f=t!==null;return b.jsxs(xa,{className:"px-3 py-2",children:[b.jsxs("div",{className:"flex flex-col gap-1 lg:hidden",children:[b.jsxs("div",{className:"flex items-center justify-between gap-2",children:[b.jsxs("span",{className:"text-sm font-medium",children:[b.jsxs("span",{className:"font-mono",children:[":",l.port]}),b.jsxs("span",{className:`ml-2 text-xs ${l.mode==="development"?"text-muted-foreground":""}`,children:[l.mode==="development"?e("vibora.mode.dev"):e("vibora.mode.prod"),l.frontend&&` + ${e("vibora.vite")}`]})]}),b.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[b.jsxs("span",{className:"tabular-nums text-sm text-muted-foreground",children:[l.totalMemoryMB.toFixed(0)," MB"]}),b.jsx(Ke,{variant:"ghost",size:"xs",onClick:()=>o(l),disabled:f||!l.backend,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${f?"opacity-50":""}`,children:b.jsx(fe,{icon:u?en:ci,className:`size-3.5 ${u?"animate-spin":""}`})})]})]}),b.jsx("span",{className:"text-xs text-muted-foreground truncate",title:l.viboraDir,children:l.viboraDir})]}),b.jsxs("div",{className:"hidden lg:grid grid-cols-[80px_100px_1fr_100px_80px] items-center gap-4",children:[b.jsx("span",{className:"font-mono text-sm",children:l.port}),b.jsxs("span",{className:`text-xs ${l.mode==="development"?"text-muted-foreground":""}`,children:[l.mode==="development"?e("vibora.mode.dev"):e("vibora.mode.prod"),l.frontend&&` + ${e("vibora.vite")}`]}),b.jsx("span",{className:"text-muted-foreground truncate text-sm",title:l.viboraDir,children:l.viboraDir}),b.jsxs("span",{className:"text-right tabular-nums text-sm",children:[l.totalMemoryMB.toFixed(0)," MB"]}),b.jsx("div",{className:"flex justify-end",children:b.jsxs(Ke,{variant:"ghost",size:"xs",onClick:()=>o(l),disabled:f||!l.backend,className:`text-destructive hover:text-destructive hover:bg-destructive/10 ${f?"opacity-50":""}`,children:[b.jsx(fe,{icon:u?en:ci,className:`size-3.5 ${u?"animate-spin":""}`}),e(u?"vibora.killing":"vibora.kill")]})})]})]},l.backend?.pid||l.port)})]})]})}function uWe(e){return e>=90?"text-destructive":e>=70?"text-muted-foreground":"text-chart-system"}function cWe(e){if(e<60)return`${e}m`;const t=Math.floor(e/60),n=e%60;return n>0?`${t}h ${n}m`:`${t}h`}function UN(e){const t=new Date(e),n=new Date,r=t.getTime()-n.getTime(),i=Math.floor(r/(1e3*60*60*24));return i===0?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):i===1?`Tomorrow ${t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`:i<7?t.toLocaleDateString([],{weekday:"short",hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function j_({percent:e,label:t,subtitle:n,color:r}){const i=[{value:Math.min(e,100),fill:r}],a=Math.round(96*vc),s=Math.round(48*vc),o=Math.round(32*vc),l=Math.round(44*vc),u=Math.round(10*vc),f=Math.round(5*vc);return b.jsx(xa,{className:"p-4",children:b.jsxs("div",{className:"flex items-center gap-4",children:[b.jsxs("div",{className:"relative size-24 shrink-0",children:[b.jsxs(GHe,{width:a,height:a,cx:s,cy:s,innerRadius:o,outerRadius:l,barSize:u,data:i,startAngle:90,endAngle:-270,children:[b.jsx(h0,{type:"number",domain:[0,100],angleAxisId:0,tick:!1}),b.jsx(p0,{background:{fill:"var(--border)"},dataKey:"value",cornerRadius:f,angleAxisId:0})]}),b.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:b.jsxs("span",{className:`text-lg font-semibold tabular-nums ${uWe(e)}`,children:[e.toFixed(0),"%"]})})]}),b.jsxs("div",{className:"flex-1 min-w-0",children:[b.jsx("h3",{className:"text-sm font-medium truncate",children:t}),b.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:n})]})]})})}function dWe(){const{t:e}=tn("monitoring"),{data:t,isLoading:n,error:r}=rWe(),i=a=>a>=90?"var(--destructive)":a>=70?"var(--muted-foreground)":"var(--chart-system)";return b.jsxs("div",{className:"space-y-4",children:[n&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),r&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:e("usage.error",{message:r.message})}),t&&!t.available&&b.jsx("div",{className:"rounded-lg border border-muted-foreground/50 bg-muted p-4 text-sm text-muted-foreground",children:t.error||e("usage.unavailable")}),t&&t.available&&b.jsxs("div",{className:"space-y-3",children:[b.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.fiveHour&&b.jsx(j_,{percent:t.fiveHour.percentUsed,label:e("usage.fiveHourBlock"),subtitle:e("usage.resetsIn",{time:cWe(t.fiveHour.timeRemainingMinutes)}),color:i(t.fiveHour.percentUsed)}),t.sevenDay&&b.jsx(j_,{percent:t.sevenDay.percentUsed,label:e("usage.sevenDayRolling"),subtitle:`${e("usage.resetsAt",{time:UN(t.sevenDay.resetAt)})} · ${e("usage.weekProgress",{percent:t.sevenDay.weekProgressPercent})}`,color:i(t.sevenDay.percentUsed)})]}),(t.sevenDayOpus||t.sevenDaySonnet)&&b.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[t.sevenDayOpus&&b.jsx(j_,{percent:t.sevenDayOpus.percentUsed,label:e("usage.opusWeekly"),subtitle:e("usage.resetsAt",{time:UN(t.sevenDayOpus.resetAt)}),color:i(t.sevenDayOpus.percentUsed)}),t.sevenDaySonnet&&b.jsx(j_,{percent:t.sevenDaySonnet.percentUsed,label:e("usage.sonnetWeekly"),subtitle:e("usage.resetsAt",{time:UN(t.sevenDaySonnet.resetAt)}),color:i(t.sevenDaySonnet.percentUsed)})]})]})]})}const $N={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"},fWe=["IN_PROGRESS","IN_REVIEW","DONE","CANCELED","ORPHANED"];function hWe(){const{t:e}=tn("common");return t=>{const n=new Date(t),i=new Date().getTime()-n.getTime(),a=Math.floor(i/1e3),s=Math.floor(a/60),o=Math.floor(s/60),l=Math.floor(o/24);return l>0?l===1?e("time.dayAgo"):e("time.daysAgo",{count:l}):o>0?o===1?e("time.hourAgo"):e("time.hoursAgo",{count:o}):s>0?s===1?e("time.minuteAgo"):e("time.minutesAgo",{count:s}):e("time.justNow")}}function pWe(){const{t:e}=tn("common"),{t}=tn("worktrees"),n=hWe(),{worktrees:r,summary:i,isLoading:a,isLoadingDetails:s,error:o,refetch:l}=fie(),u=hie(),[f,d]=k.useState(new Set),[p,m]=k.useState(!1),[y,S]=k.useState(!1),[g,_]=k.useState(!1),[v,x]=k.useState(null),[T,w]=k.useState(null),[C,R]=k.useState(!1),O=$=>{d(q=>{const Y=new Set(q);return Y.has($)?Y.delete($):Y.add($),Y})},N=()=>{d(new Set)},L=k.useMemo(()=>f.size===0?r:r.filter($=>!!($.isOrphaned&&f.has("ORPHANED")||$.taskStatus&&f.has($.taskStatus))),[r,f]),D=k.useMemo(()=>r.filter($=>$.taskStatus==="DONE"||$.taskStatus==="CANCELED"),[r]),z=async()=>{if(D.length!==0){S(!0);try{for(const $ of D)await u.mutateAsync({worktreePath:$.path,repoPath:$.repoPath,deleteLinkedTask:g});m(!1),l()}catch{}finally{S(!1)}}},M=async($,q)=>{x($.path);try{await u.mutateAsync({worktreePath:$.path,repoPath:$.repoPath,deleteLinkedTask:q}),w(null),l()}catch{}finally{x(null)}},V=$=>{$||(w(null),R(!1))},W=$=>{m($),$||_(!1)};return b.jsxs("div",{className:"space-y-4",children:[b.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[b.jsx("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:(i||r.length>0)&&b.jsxs(b.Fragment,{children:[b.jsx("span",{children:t("summary.total",{count:i?.total??r.length})}),(i?.orphaned??r.filter($=>$.isOrphaned).length)>0&&b.jsx("span",{className:"text-destructive",children:t("summary.orphaned",{count:i?.orphaned??r.filter($=>$.isOrphaned).length})}),s?b.jsx("span",{className:"animate-pulse",children:e("status.calculating")}):i?b.jsx("span",{children:i.totalSizeFormatted}):null]})}),b.jsxs("div",{className:"flex items-center gap-2",children:[D.length>0&&b.jsxs(go,{open:p,onOpenChange:W,children:[b.jsxs(bo,{render:b.jsx(Ke,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-muted-foreground hover:text-destructive",disabled:s}),children:[b.jsx(fe,{icon:rte,size:12,strokeWidth:2}),t("cleanup.button",{count:D.length})]}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:t("cleanup.title")}),b.jsxs(So,{children:[t("cleanup.description",{count:D.length}),g&&` ${t("cleanup.linkedTasksWillBeDeleted")}`]}),b.jsxs("div",{className:"space-y-3",children:[b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:g,onCheckedChange:$=>_($===!0),disabled:y}),t("cleanup.alsoDeleteLinkedTasks")]}),b.jsx("p",{className:"font-medium text-destructive text-xs",children:t("cleanup.cannotUndo")})]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:y,children:e("buttons.cancel")}),b.jsxs(Ke,{variant:"destructive",onClick:z,disabled:y,className:"gap-2",children:[y&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),y?e("status.deleting"):t("delete.button",{count:D.length})]})]})]})]}),f.size>0&&b.jsxs(Ke,{variant:"ghost",size:"sm",onClick:N,className:"gap-1.5 text-xs",children:[b.jsx(fe,{icon:ci,size:12,strokeWidth:2}),e("buttons.clearFilters")]})]})]}),b.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:fWe.map($=>{const q=f.has($);return b.jsx("button",{onClick:()=>O($),className:Ue("rounded-full px-2.5 py-1 text-xs font-medium transition-colors",q?$N[$]:"bg-muted text-muted-foreground hover:bg-muted/80"),children:e(`statuses.${$}`)},$)})}),a&&b.jsx("div",{className:"flex items-center justify-center py-12",children:b.jsx(fe,{icon:en,className:"size-6 animate-spin text-muted-foreground"})}),o&&b.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4 text-sm text-destructive",children:t("error.failedToLoad",{message:o.message})}),!a&&!o&&L.length===0&&b.jsx("div",{className:"py-12 text-center text-muted-foreground",children:f.size>0?t("empty.noMatch"):t("empty.noWorktrees")}),!a&&L.length>0&&b.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3",children:L.map($=>{const q=$.sizeFormatted==="..."||$.branch==="...",Y=!$.isOrphaned&&$.taskId,B=v===$.path;return b.jsx(xa,{className:"transition-colors hover:border-border/80",children:b.jsxs(Df,{className:"flex items-start justify-between gap-4 py-4",children:[b.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("span",{className:"truncate font-medium",children:$.name}),$.isOrphaned?b.jsx(co,{className:Ue("shrink-0",$N.ORPHANED),children:e("statuses.ORPHANED")}):$.taskStatus?b.jsx(co,{className:Ue("shrink-0",$N[$.taskStatus]),children:e(`statuses.${$.taskStatus}`)}):null]}),b.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Hi,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{className:"truncate font-mono",children:$.path})]}),b.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:Vx,size:12,strokeWidth:2,className:"shrink-0"}),$.branch==="..."?b.jsx("span",{className:"inline-block animate-pulse rounded bg-muted h-3 w-16"}):b.jsx("span",{className:"font-mono",children:$.branch})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:ate,size:12,strokeWidth:2,className:"shrink-0"}),$.sizeFormatted==="..."?b.jsx("span",{className:"inline-block animate-pulse rounded bg-muted h-3 w-12"}):b.jsx("span",{children:$.sizeFormatted})]}),b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx(fe,{icon:tte,size:12,strokeWidth:2,className:"shrink-0"}),b.jsx("span",{children:n($.lastModified)})]})]}),$.taskId&&$.taskTitle&&b.jsx("div",{className:"flex items-center gap-1.5 pt-1",children:b.jsxs(wi,{to:"/tasks/$taskId",params:{taskId:$.taskId},className:"inline-flex items-center gap-1 text-foreground hover:underline",children:[b.jsx("span",{className:"truncate",children:$.taskTitle}),b.jsx(fe,{icon:$y,size:12,strokeWidth:2,className:"shrink-0"})]})})]})]}),b.jsxs(go,{open:T?.path===$.path,onOpenChange:V,children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-muted-foreground hover:text-destructive",disabled:q||B,onClick:()=>w($)}),children:b.jsx(fe,{icon:B?en:$c,size:14,strokeWidth:2,className:B?"animate-spin":""})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:t("delete.title")}),b.jsxs(So,{children:[t("delete.description")," ",b.jsx("span",{className:"font-mono",children:$.name}),".",C&&Y&&b.jsxs(b.Fragment,{children:[" ",t("delete.linkedTaskWillBeDeleted",{title:$.taskTitle})]})," ",t("delete.cannotUndo")]}),Y&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:C,onCheckedChange:j=>R(j===!0),disabled:B}),t("delete.alsoDeleteLinkedTask",{title:$.taskTitle})]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:B,children:e("buttons.cancel")}),b.jsxs(Ke,{variant:"destructive",onClick:()=>M($,C),disabled:B,className:"gap-2",children:[B&&b.jsx(fe,{icon:en,size:14,strokeWidth:2,className:"animate-spin"}),e(B?"status.deleting":"buttons.delete")]})]})]})]})]})},$.path)})})]})}function mWe(){const{t:e}=tn("monitoring"),{data:t}=Ane(),n=Wi(),{tab:r}=Dle.useSearch(),i=r||"system",a=k.useCallback(l=>{n({to:"/monitoring",search:l==="system"?{}:{tab:l},replace:!0})},[n]),o=[{value:"system",label:e("tabs.system")},{value:"processes",label:e("tabs.processes")},{value:"claude",label:e("tabs.claude")},{value:"vibora",label:e("tabs.vibora"),devOnly:!0},{value:"worktrees",label:e("tabs.worktrees")},{value:"usage",label:e("tabs.usage")}].filter(l=>!l.devOnly||t?.enabled);return b.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[b.jsxs("div",{className:"flex shrink-0 items-center border-b border-border bg-background px-4 py-2",children:[b.jsx("div",{className:"sm:hidden",children:b.jsxs(ji,{value:i,onValueChange:l=>a(l),children:[b.jsx(Bi,{size:"sm",className:"w-auto gap-2",children:b.jsx(Fi,{})}),b.jsx(Ui,{children:o.map(l=>b.jsx(Cn,{value:l.value,children:l.label},l.value))})]})}),b.jsx("div",{className:"hidden sm:block",children:b.jsx(su,{value:i,onValueChange:l=>a(l),children:b.jsx(ou,{variant:"line",children:o.map(l=>b.jsx(li,{value:l.value,className:"px-3 py-1.5",children:l.label},l.value))})})})]}),b.jsxs("div",{className:"flex-1 overflow-auto p-4",children:[i==="system"&&b.jsx(sWe,{}),i==="processes"&&b.jsx(oWe,{}),i==="claude"&&b.jsx(aWe,{}),i==="vibora"&&t?.enabled&&b.jsx(lWe,{}),i==="worktrees"&&b.jsx(pWe,{}),i==="usage"&&b.jsx(dWe,{})]})]})}const gWe=()=>"http://localhost:3000",bb={activeTab:"diff",browserUrl:gWe(),diffOptions:{wrap:!0,ignoreWhitespace:!0,includeUntracked:!1,collapsedFiles:[]},filesViewState:{selectedFile:null,expandedDirs:[]}};function u5(e){const t=wr(),n=k.useRef(void 0),r=k.useRef({}),{data:i}=wne(e),a=k.useMemo(()=>{const p=i?.viewState;return p?{activeTab:p.activeTab??bb.activeTab,browserUrl:p.browserUrl??bb.browserUrl,diffOptions:{...bb.diffOptions,...p.diffOptions},filesViewState:{...bb.filesViewState,...p.filesViewState}}:bb},[i?.viewState]),s=zn({mutationFn:async p=>{const m=await fetch(`/api/tasks/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({viewState:p})});if(!m.ok)throw new Error("Failed to update view state");return m.json()},onSuccess:p=>{t.setQueryData(["tasks",e],p),t.setQueryData(["tasks"],m=>m&&m.map(y=>y.id===e?p:y))}}),o=k.useCallback(p=>{const m=r.current;r.current={...m,...p,diffOptions:p.diffOptions||m.diffOptions?{...m.diffOptions,...p.diffOptions}:void 0,filesViewState:p.filesViewState||m.filesViewState?{...m.filesViewState,...p.filesViewState}:void 0};const y=r.current,S={activeTab:y.activeTab??a.activeTab,browserUrl:y.browserUrl??a.browserUrl,diffOptions:{...a.diffOptions,...y.diffOptions},filesViewState:{...a.filesViewState,...y.filesViewState}};t.setQueryData(["tasks",e],g=>g&&{...g,viewState:S}),t.setQueryData(["tasks"],g=>g&&g.map(_=>_.id===e?{..._,viewState:S}:_)),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{s.mutate(S),r.current={}},500)},[t,e,a,s]),l=k.useCallback(p=>{o({activeTab:p})},[o]),u=k.useCallback(p=>{o({browserUrl:p})},[o]),f=k.useCallback(p=>{o({diffOptions:p})},[o]),d=k.useCallback(p=>{o({filesViewState:p})},[o]);return{viewState:a,setActiveTab:l,setBrowserUrl:u,setDiffOptions:f,setFilesViewState:d}}function bWe(e){return qn({queryKey:["linear-ticket",e],queryFn:async()=>{if(!e)return null;const t=await fetch(`/api/linear/ticket/${e}`);return t.ok?t.json():null},enabled:!!e,staleTime:300*1e3})}function vWe(e){return{id:e.id,name:e.name,cwd:e.cwd,status:e.status,exitCode:e.exitCode,cols:e.cols,rows:e.rows,createdAt:e.createdAt,tabId:e.tabId??void 0,positionInTab:e.positionInTab}}function yWe(e){return{id:e.id,name:e.name,position:e.position,directory:e.directory??void 0,createdAt:e.createdAt}}function c5(e={}){const t=aie();return{get terminals(){return t.terminals.map(vWe)},get terminalsLoaded(){return t.terminalsLoaded},get tabs(){return t.tabs.map(yWe)},get connected(){return t.connected},get newTerminalIds(){return t.newTerminalIds},createTerminal:t.createTerminal,destroyTerminal:t.destroyTerminal,writeToTerminal:t.writeToTerminal,sendInputToTerminal:t.sendInputToTerminal,resizeTerminal:t.resizeTerminal,renameTerminal:t.renameTerminal,clearTerminalBuffer:t.clearTerminalBuffer,assignTerminalToTab:t.assignTerminalToTab,createTab:t.createTab,updateTab:t.updateTab,deleteTab:t.deleteTab,reorderTab:t.reorderTab,attachXterm:t.attachXterm,setupImagePaste:t.setupImagePaste,consumePendingStartup:t.consumePendingStartup,clearStartingUp:t.clearStartingUp}}function F_(e){return`$'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`}function $X({taskName:e,cwd:t,className:n,aiMode:r,description:i,startupScript:a,serverPort:s=7777}){const o=k.useRef(null),l=k.useRef(null),u=k.useRef(null),f=k.useRef(!1),d=k.useRef(!1),[p,m]=k.useState(null),[y,S]=k.useState(!1),[g,_]=k.useState(!1),[v,x]=k.useState(!1),[T,w]=k.useState(!1),{resolvedTheme:C}=qc(),R=C==="dark",O=R?Die:Iie;k.useEffect(()=>{At.taskTerminal.debug("cwd changed, resetting refs",{cwd:t}),f.current=!1,d.current=!1,m(null),S(!1)},[t]);const{setTerminalFocused:N}=mM(),{terminals:L,terminalsLoaded:D,connected:z,createTerminal:M,attachXterm:V,resizeTerminal:W,setupImagePaste:$,writeToTerminal:q,consumePendingStartup:Y,clearStartingUp:B}=c5(),j=k.useRef(V),U=k.useRef($),K=k.useRef(q),H=k.useRef(Y),J=k.useRef(B);k.useEffect(()=>{j.current=V},[V]),k.useEffect(()=>{U.current=$},[$]),k.useEffect(()=>{K.current=q},[q]),k.useEffect(()=>{H.current=Y},[Y]),k.useEffect(()=>{J.current=B},[B]);const se=p?L.find(Z=>Z.id===p):null,ae=se?.status;k.useEffect(()=>{if(!o.current||l.current)return;const Z=new Oie.Terminal({cursorBlink:!0,fontSize:Math.round(13*vc),fontFamily:"JetBrains Mono Variable, PureNerdFont, Menlo, Monaco, monospace",lineHeight:1.2,theme:O}),ee=new Rie.FitAddon,ne=new Nie.WebLinksAddon;Z.loadAddon(ee),Z.loadAddon(ne),Z.open(o.current),l.current=Z,u.current=ee,x(!0),requestAnimationFrame(()=>{ee.fit()});const te=setTimeout(()=>{ee.fit(),Z.refresh(0,Z.rows-1)},100),be=()=>N(!0),_e=()=>N(!1);return Z.textarea&&(Z.textarea.addEventListener("focus",be),Z.textarea.addEventListener("blur",_e)),()=>{clearTimeout(te),Z.textarea&&(Z.textarea.removeEventListener("focus",be),Z.textarea.removeEventListener("blur",_e)),N(!1),Z.dispose(),l.current=null,u.current=null,x(!1)}},[N]);const Q=k.useCallback(()=>{if(!u.current||!l.current)return;u.current.fit();const{cols:Z,rows:ee}=l.current;p&&W(p,Z,ee)},[p,W]);k.useEffect(()=>{if(!o.current)return;const Z=()=>{requestAnimationFrame(Q)};window.addEventListener("resize",Z);const ee=()=>{document.visibilityState==="visible"&&requestAnimationFrame(()=>{Q(),l.current&&l.current.refresh(0,l.current.rows-1)})};document.addEventListener("visibilitychange",ee);const ne=new ResizeObserver(Z);ne.observe(o.current);const te=new IntersectionObserver(be=>{be[0]?.isIntersecting&&requestAnimationFrame(()=>{Q(),l.current&&l.current.refresh(0,l.current.rows-1)})},{threshold:.1});return te.observe(o.current),()=>{window.removeEventListener("resize",Z),document.removeEventListener("visibilitychange",ee),ne.disconnect(),te.disconnect()}},[Q]),k.useEffect(()=>{if(!z||!t||!v||!D)return;const Z=L.find(ee=>ee.cwd===t);if(Z){m(Z.id);return}if(!f.current&&l.current){f.current=!0,S(!0);const{cols:ee,rows:ne}=l.current;M({name:e,cols:ee,rows:ne,cwd:t,startup:{startupScript:a,aiMode:r,description:i,taskName:e,serverPort:s}})}},[z,t,v,D,L,e,M]),k.useEffect(()=>{if(!t)return;const Z=L.find(ne=>ne.cwd===t);if(!Z)return;const ee=p&&L.some(ne=>ne.id===p);(!p||!ee)&&(At.taskTerminal.debug("setting terminalId",{newId:Z.id,prevId:p,reason:p?"tempId replaced":"initial",cwd:t,terminalCount:L.length}),m(Z.id),S(!1),p&&!ee&&(d.current=!1))},[L,t,p]),k.useEffect(()=>{if(At.taskTerminal.debug("attach effect",{terminalId:p,hasTermRef:!!l.current,hasContainerRef:!!o.current,attachedRef:d.current}),!p||!l.current||!o.current||d.current)return;At.taskTerminal.debug("attach effect passed guards, calling attachXterm",{terminalId:p});const Z=te=>{requestAnimationFrame(Q);const be=H.current(te);if(At.taskTerminal.debug("onAttached checking pending startup",{terminalId:te,hasPendingStartup:!!be}),be){At.taskTerminal.info("onAttached: running startup commands",{terminalId:te}),_(!0);const{startupScript:_e,aiMode:he,description:ye,taskName:Ee,serverPort:xe}=be;_e&&setTimeout(()=>{const Re="VIBORA_STARTUP_"+Date.now(),Pe=`source /dev/stdin <<'${Re}'
112
112
  ${_e}
113
- ${Re}`;K.current(te,Pe+"\r")},100);const ve=xe??7777,De=ve!==7777?` --port=${ve}`:"",Te=`You are working in a Vibora task worktree. Commit after completing each logical unit of work (feature, fix, refactor) to preserve progress. When you finish working and need user input, run: vibora current-task review${De}. When linking a PR: vibora current-task pr <url>${De}. For notifications: vibora notify "Title" "Message"${De}.`,pe=ye?`${Ee}: ${ye}`:Ee,ce=he==="plan"?`claude ${F_(pe)} --append-system-prompt ${F_(Te)} --session-id "${te}" --allow-dangerously-skip-permissions --permission-mode plan`:`claude ${F_(pe)} --append-system-prompt ${F_(Te)} --session-id "${te}" --dangerously-skip-permissions`;setTimeout(()=>{kt.taskTerminal.debug("writing claude command to terminal",{terminalId:te,taskCommand:ce.substring(0,50)+"..."}),K.current(te,ce+"\r"),_(!1),J.current(te)},_e?5e3:100)}},ee=j.current(p,l.current,{onAttached:Z}),ne=U.current(o.current,p);return d.current=!0,kt.taskTerminal.debug("attachedRef set to true",{terminalId:p}),()=>{kt.taskTerminal.debug("cleanup running, setting attachedRef to false",{terminalId:p}),ee(),ne(),d.current=!1}},[p,Q]),k.useEffect(()=>{l.current&&(l.current.options.theme=O)},[O]),k.useEffect(()=>{if(!l.current||T)return;const Z=l.current,ee=()=>{const te=Z.buffer.active;for(let be=Math.max(0,te.cursorY-3);be<=te.cursorY;be++){const _e=te.getLine(be);if(_e){const he=_e.translateToString();if(he.includes("claude: command not found")||he.includes("claude: not found")||he.includes("'claude' is not recognized")||he.includes("command not found: claude")){w(!0);return}}}},ne=Z.onLineFeed(ee);return()=>{ne.dispose()}},[T]);const G=k.useCallback(Z=>{p&&K.current(p,Z)},[p]);return t?b.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!z&&b.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:"Connecting to terminal server..."}),ae==="error"&&b.jsx("div",{className:"shrink-0 px-2 py-1 bg-destructive/20 text-destructive text-xs",children:"Terminal failed to start. The worktree directory may not exist."}),ae==="exited"&&b.jsxs("div",{className:"shrink-0 px-2 py-1 bg-muted text-muted-foreground text-xs",children:["Terminal exited (code: ",se?.exitCode,")"]}),b.jsxs("div",{className:"relative min-h-0 flex-1",children:[b.jsx("div",{ref:o,className:Ue("h-full w-full overflow-hidden p-2 bg-terminal-background",n)}),y&&!p&&b.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-terminal-background",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:Ue("animate-spin",R?"text-white/50":"text-black/50")}),b.jsx("span",{className:Ue("font-mono text-sm",R?"text-white/50":"text-black/50"),children:"Initializing terminal..."})]})}),g&&b.jsx("div",{className:"pointer-events-auto absolute inset-0 z-10 flex items-center justify-center bg-terminal-background/90",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:Ue("animate-spin",R?"text-white/60":"text-black/60")}),b.jsx("span",{className:Ue("font-mono text-sm",R?"text-white/60":"text-black/60"),children:"Starting Claude Code..."})]})}),T&&b.jsx("div",{className:"absolute bottom-4 left-4 right-4 z-10",children:b.jsxs("div",{className:Ue("flex items-start gap-3 rounded-lg border p-4","bg-amber-500/10 border-amber-500/30"),children:[b.jsx(fe,{icon:ts,size:18,strokeWidth:2,className:"shrink-0 mt-0.5 text-amber-600 dark:text-amber-400"}),b.jsxs("div",{className:"flex-1 space-y-2",children:[b.jsx("p",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:"Claude Code CLI not found"}),b.jsxs("p",{className:"text-xs text-amber-600/80 dark:text-amber-400/80",children:["Install it with:"," ",b.jsx("code",{className:"rounded bg-amber-500/20 px-1.5 py-0.5 font-mono",children:"npm install -g @anthropic/claude-code"})]}),b.jsx("a",{href:"https://docs.anthropic.com/en/docs/claude-code/overview",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs font-medium text-amber-600 hover:text-amber-700 dark:text-amber-400 dark:hover:text-amber-300 underline",children:"View documentation"})]}),b.jsx("button",{onClick:()=>w(!1),className:"shrink-0 p-1 rounded text-amber-600 hover:text-amber-700 hover:bg-amber-500/20 dark:text-amber-400 dark:hover:text-amber-300",children:b.jsx(fe,{icon:ci,size:14,strokeWidth:2})})]})}),b.jsx("button",{onClick:()=>l.current?.scrollToBottom(),className:Ue("absolute top-2 right-5 p-1 transition-colors",R?"text-white/50 hover:text-white/80":"text-black/50 hover:text-black/80"),children:b.jsx(fe,{icon:cM,size:20,strokeWidth:2})})]}),b.jsx(lS,{onSend:G})]}):b.jsx("div",{className:Ue("flex h-full items-center justify-center text-muted-foreground text-sm bg-terminal-background",n),children:"No worktree path configured for this task"})}function _We(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function EWe(e,t=[]){let n=[];function r(a,s){const o=k.createContext(s),l=n.length;n=[...n,s];const u=d=>{const{scope:p,children:m,...y}=d,S=p?.[e]?.[l]||o,g=k.useMemo(()=>y,Object.values(y));return b.jsx(S.Provider,{value:g,children:m})};u.displayName=a+"Provider";function f(d,p){const m=p?.[e]?.[l]||o,y=k.useContext(m);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[u,f]}const i=()=>{const a=n.map(s=>k.createContext(s));return function(o){const l=o?.[e]||a;return k.useMemo(()=>({[`__scope${e}`]:{...o,[e]:l}}),[o,l])}};return i.scopeName=e,[r,SWe(i,...t)]}function SWe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const s=r.reduce((o,{useScope:l,scopeName:u})=>{const d=l(a)[`__scope${u}`];return{...o,...d}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var yy=globalThis?.document?k.useLayoutEffect:()=>{},xWe=Ex[" useInsertionEffect ".trim().toString()]||yy;function wWe({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,a,s]=TWe({defaultProp:t,onChange:n}),o=e!==void 0,l=o?e:i;{const f=k.useRef(e!==void 0);k.useEffect(()=>{const d=f.current;d!==o&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=o},[o,r])}const u=k.useCallback(f=>{if(o){const d=CWe(f)?f(e):f;d!==e&&s.current?.(d)}else a(f)},[o,e,a,s]);return[l,u]}function TWe({defaultProp:e,onChange:t}){const[n,r]=k.useState(e),i=k.useRef(n),a=k.useRef(t);return xWe(()=>{a.current=t},[t]),k.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function CWe(e){return typeof e=="function"}function zX(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Lle(...e){return t=>{let n=!1;const r=e.map(i=>{const a=zX(i,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():zX(e[i],null)}}}}function Ple(...e){return k.useCallback(Lle(...e),e)}function AWe(e){const t=kWe(e),n=k.forwardRef((r,i)=>{const{children:a,...s}=r,o=k.Children.toArray(a),l=o.find(RWe);if(l){const u=l.props.children,f=o.map(d=>d===l?k.Children.count(u)>1?k.Children.only(null):k.isValidElement(u)?u.props.children:null:d);return b.jsx(t,{...s,ref:i,children:k.isValidElement(u)?k.cloneElement(u,void 0,f):null})}return b.jsx(t,{...s,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function kWe(e){const t=k.forwardRef((n,r)=>{const{children:i,...a}=n;if(k.isValidElement(i)){const s=IWe(i),o=NWe(a,i.props);return i.type!==k.Fragment&&(o.ref=r?Lle(r,s):s),k.cloneElement(i,o)}return k.Children.count(i)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var OWe=Symbol("radix.slottable");function RWe(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===OWe}function NWe(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...o)=>{const l=a(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function IWe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var DWe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],d5=DWe.reduce((e,t)=>{const n=AWe(`Primitive.${t}`),r=k.forwardRef((i,a)=>{const{asChild:s,...o}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),b.jsx(l,{...o,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function LWe(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var Mle=e=>{const{present:t,children:n}=e,r=PWe(t),i=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),a=Ple(r.ref,MWe(i));return typeof n=="function"||r.isPresent?k.cloneElement(i,{ref:a}):null};Mle.displayName="Presence";function PWe(e){const[t,n]=k.useState(),r=k.useRef(null),i=k.useRef(e),a=k.useRef("none"),s=e?"mounted":"unmounted",[o,l]=LWe(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const u=B_(r.current);a.current=o==="mounted"?u:"none"},[o]),yy(()=>{const u=r.current,f=i.current;if(f!==e){const p=a.current,m=B_(u);e?l("MOUNT"):m==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),yy(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,d=m=>{const S=B_(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&S&&(l("ANIMATION_END"),!i.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},p=m=>{m.target===t&&(a.current=B_(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:k.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function B_(e){return e?.animationName||"none"}function MWe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jWe=Ex[" useId ".trim().toString()]||(()=>{}),FWe=0;function BWe(e){const[t,n]=k.useState(jWe());return yy(()=>{n(r=>r??String(FWe++))},[e]),e||(t?`radix-${t}`:"")}var Qw="Collapsible",[UWe]=EWe(Qw),[$We,f5]=UWe(Qw),jle=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:s,...o}=e,[l,u]=wWe({prop:r,defaultProp:i??!1,onChange:s,caller:Qw});return b.jsx($We,{scope:n,disabled:a,contentId:BWe(),open:l,onOpenToggle:k.useCallback(()=>u(f=>!f),[u]),children:b.jsx(d5.div,{"data-state":p5(l),"data-disabled":a?"":void 0,...o,ref:t})})});jle.displayName=Qw;var Fle="CollapsibleTrigger",Ble=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=f5(Fle,n);return b.jsx(d5.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":p5(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:_We(e.onClick,i.onOpenToggle)})});Ble.displayName=Fle;var h5="CollapsibleContent",Ule=k.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=f5(h5,e.__scopeCollapsible);return b.jsx(Mle,{present:n||i.open,children:({present:a})=>b.jsx(zWe,{...r,ref:t,present:a})})});Ule.displayName=h5;var zWe=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...a}=e,s=f5(h5,n),[o,l]=k.useState(r),u=k.useRef(null),f=Ple(t,u),d=k.useRef(0),p=d.current,m=k.useRef(0),y=m.current,S=s.open||o,g=k.useRef(S),_=k.useRef(void 0);return k.useEffect(()=>{const v=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(v)},[]),yy(()=>{const v=u.current;if(v){_.current=_.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const x=v.getBoundingClientRect();d.current=x.height,m.current=x.width,g.current||(v.style.transitionDuration=_.current.transitionDuration,v.style.animationName=_.current.animationName),l(r)}},[s.open,r]),b.jsx(d5.div,{"data-state":p5(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!S,...a,ref:f,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:S&&i})});function p5(e){return e?"open":"closed"}var HWe=jle;const WWe=HWe,VWe=Ble,GWe=Ule;function qWe(e){const{viewState:t,setDiffOptions:n}=u5(e),{collapsedFiles:r}=t.diffOptions,i=k.useCallback(l=>{const u=r.includes(l);n({collapsedFiles:u?r.filter(f=>f!==l):[...r,l]})},[r,n]),a=k.useCallback(l=>{n({collapsedFiles:l})},[n]),s=k.useCallback(()=>{n({collapsedFiles:[]})},[n]),o=k.useCallback(l=>r.includes(l),[r]);return{options:t.diffOptions,setOption:(l,u)=>{n({[l]:u})},setOptions:n,toggleFileCollapse:i,collapseAll:a,expandAll:s,isFileCollapsed:o}}function KWe(e){const t=[];let n=null,r=0,i=0;for(const a of e.split(`
113
+ ${Re}`;K.current(te,Pe+"\r")},100);const ve=xe??7777,De=ve!==7777?` --port=${ve}`:"",Te=`You are working in a Vibora task worktree. Commit after completing each logical unit of work (feature, fix, refactor) to preserve progress. When you finish working and need user input, run: vibora current-task review${De}. When linking a PR: vibora current-task pr <url>${De}. For notifications: vibora notify "Title" "Message"${De}.`,pe=ye?`${Ee}: ${ye}`:Ee,ce=he==="plan"?`claude ${F_(pe)} --append-system-prompt ${F_(Te)} --session-id "${te}" --allow-dangerously-skip-permissions --permission-mode plan`:`claude ${F_(pe)} --append-system-prompt ${F_(Te)} --session-id "${te}" --dangerously-skip-permissions`;setTimeout(()=>{At.taskTerminal.debug("writing claude command to terminal",{terminalId:te,taskCommand:ce.substring(0,50)+"..."}),K.current(te,ce+"\r"),_(!1),J.current(te)},_e?5e3:100)}},ee=j.current(p,l.current,{onAttached:Z}),ne=U.current(o.current,p);return d.current=!0,At.taskTerminal.debug("attachedRef set to true",{terminalId:p}),()=>{At.taskTerminal.debug("cleanup running, setting attachedRef to false",{terminalId:p}),ee(),ne(),d.current=!1}},[p,Q]),k.useEffect(()=>{l.current&&(l.current.options.theme=O)},[O]),k.useEffect(()=>{if(!l.current||T)return;const Z=l.current,ee=()=>{const te=Z.buffer.active;for(let be=Math.max(0,te.cursorY-3);be<=te.cursorY;be++){const _e=te.getLine(be);if(_e){const he=_e.translateToString();if(he.includes("claude: command not found")||he.includes("claude: not found")||he.includes("'claude' is not recognized")||he.includes("command not found: claude")){w(!0);return}}}},ne=Z.onLineFeed(ee);return()=>{ne.dispose()}},[T]);const G=k.useCallback(Z=>{p&&K.current(p,Z)},[p]);return t?b.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[!z&&b.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:"Connecting to terminal server..."}),ae==="error"&&b.jsx("div",{className:"shrink-0 px-2 py-1 bg-destructive/20 text-destructive text-xs",children:"Terminal failed to start. The worktree directory may not exist."}),ae==="exited"&&b.jsxs("div",{className:"shrink-0 px-2 py-1 bg-muted text-muted-foreground text-xs",children:["Terminal exited (code: ",se?.exitCode,")"]}),b.jsxs("div",{className:"relative min-h-0 flex-1",children:[b.jsx("div",{ref:o,className:Ue("h-full w-full overflow-hidden p-2 bg-terminal-background",n)}),y&&!p&&b.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-terminal-background",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:Ue("animate-spin",R?"text-white/50":"text-black/50")}),b.jsx("span",{className:Ue("font-mono text-sm",R?"text-white/50":"text-black/50"),children:"Initializing terminal..."})]})}),g&&b.jsx("div",{className:"pointer-events-auto absolute inset-0 z-10 flex items-center justify-center bg-terminal-background/90",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:Ue("animate-spin",R?"text-white/60":"text-black/60")}),b.jsx("span",{className:Ue("font-mono text-sm",R?"text-white/60":"text-black/60"),children:"Starting Claude Code..."})]})}),T&&b.jsx("div",{className:"absolute bottom-4 left-4 right-4 z-10",children:b.jsxs("div",{className:Ue("flex items-start gap-3 rounded-lg border p-4","bg-amber-500/10 border-amber-500/30"),children:[b.jsx(fe,{icon:ts,size:18,strokeWidth:2,className:"shrink-0 mt-0.5 text-amber-600 dark:text-amber-400"}),b.jsxs("div",{className:"flex-1 space-y-2",children:[b.jsx("p",{className:"text-sm font-medium text-amber-600 dark:text-amber-400",children:"Claude Code CLI not found"}),b.jsxs("p",{className:"text-xs text-amber-600/80 dark:text-amber-400/80",children:["Install it with:"," ",b.jsx("code",{className:"rounded bg-amber-500/20 px-1.5 py-0.5 font-mono",children:"npm install -g @anthropic/claude-code"})]}),b.jsx("a",{href:"https://docs.anthropic.com/en/docs/claude-code/overview",target:"_blank",rel:"noopener noreferrer",className:"inline-block text-xs font-medium text-amber-600 hover:text-amber-700 dark:text-amber-400 dark:hover:text-amber-300 underline",children:"View documentation"})]}),b.jsx("button",{onClick:()=>w(!1),className:"shrink-0 p-1 rounded text-amber-600 hover:text-amber-700 hover:bg-amber-500/20 dark:text-amber-400 dark:hover:text-amber-300",children:b.jsx(fe,{icon:ci,size:14,strokeWidth:2})})]})}),b.jsx("button",{onClick:()=>l.current?.scrollToBottom(),className:Ue("absolute top-2 right-5 p-1 transition-colors",R?"text-white/50 hover:text-white/80":"text-black/50 hover:text-black/80"),children:b.jsx(fe,{icon:cM,size:20,strokeWidth:2})})]}),b.jsx(lS,{onSend:G})]}):b.jsx("div",{className:Ue("flex h-full items-center justify-center text-muted-foreground text-sm bg-terminal-background",n),children:"No worktree path configured for this task"})}function _We(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e?.(i),n===!1||!i.defaultPrevented)return t?.(i)}}function EWe(e,t=[]){let n=[];function r(a,s){const o=k.createContext(s),l=n.length;n=[...n,s];const u=d=>{const{scope:p,children:m,...y}=d,S=p?.[e]?.[l]||o,g=k.useMemo(()=>y,Object.values(y));return b.jsx(S.Provider,{value:g,children:m})};u.displayName=a+"Provider";function f(d,p){const m=p?.[e]?.[l]||o,y=k.useContext(m);if(y)return y;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${a}\``)}return[u,f]}const i=()=>{const a=n.map(s=>k.createContext(s));return function(o){const l=o?.[e]||a;return k.useMemo(()=>({[`__scope${e}`]:{...o,[e]:l}}),[o,l])}};return i.scopeName=e,[r,SWe(i,...t)]}function SWe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(a){const s=r.reduce((o,{useScope:l,scopeName:u})=>{const d=l(a)[`__scope${u}`];return{...o,...d}},{});return k.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var yy=globalThis?.document?k.useLayoutEffect:()=>{},xWe=Ex[" useInsertionEffect ".trim().toString()]||yy;function wWe({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[i,a,s]=TWe({defaultProp:t,onChange:n}),o=e!==void 0,l=o?e:i;{const f=k.useRef(e!==void 0);k.useEffect(()=>{const d=f.current;d!==o&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${o?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=o},[o,r])}const u=k.useCallback(f=>{if(o){const d=CWe(f)?f(e):f;d!==e&&s.current?.(d)}else a(f)},[o,e,a,s]);return[l,u]}function TWe({defaultProp:e,onChange:t}){const[n,r]=k.useState(e),i=k.useRef(n),a=k.useRef(t);return xWe(()=>{a.current=t},[t]),k.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function CWe(e){return typeof e=="function"}function zX(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Lle(...e){return t=>{let n=!1;const r=e.map(i=>{const a=zX(i,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():zX(e[i],null)}}}}function Ple(...e){return k.useCallback(Lle(...e),e)}function AWe(e){const t=kWe(e),n=k.forwardRef((r,i)=>{const{children:a,...s}=r,o=k.Children.toArray(a),l=o.find(RWe);if(l){const u=l.props.children,f=o.map(d=>d===l?k.Children.count(u)>1?k.Children.only(null):k.isValidElement(u)?u.props.children:null:d);return b.jsx(t,{...s,ref:i,children:k.isValidElement(u)?k.cloneElement(u,void 0,f):null})}return b.jsx(t,{...s,ref:i,children:a})});return n.displayName=`${e}.Slot`,n}function kWe(e){const t=k.forwardRef((n,r)=>{const{children:i,...a}=n;if(k.isValidElement(i)){const s=IWe(i),o=NWe(a,i.props);return i.type!==k.Fragment&&(o.ref=r?Lle(r,s):s),k.cloneElement(i,o)}return k.Children.count(i)>1?k.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var OWe=Symbol("radix.slottable");function RWe(e){return k.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===OWe}function NWe(e,t){const n={...t};for(const r in t){const i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...o)=>{const l=a(...o);return i(...o),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...a}:r==="className"&&(n[r]=[i,a].filter(Boolean).join(" "))}return{...e,...n}}function IWe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var DWe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],d5=DWe.reduce((e,t)=>{const n=AWe(`Primitive.${t}`),r=k.forwardRef((i,a)=>{const{asChild:s,...o}=i,l=s?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),b.jsx(l,{...o,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function LWe(e,t){return k.useReducer((n,r)=>t[n][r]??n,e)}var Mle=e=>{const{present:t,children:n}=e,r=PWe(t),i=typeof n=="function"?n({present:r.isPresent}):k.Children.only(n),a=Ple(r.ref,MWe(i));return typeof n=="function"||r.isPresent?k.cloneElement(i,{ref:a}):null};Mle.displayName="Presence";function PWe(e){const[t,n]=k.useState(),r=k.useRef(null),i=k.useRef(e),a=k.useRef("none"),s=e?"mounted":"unmounted",[o,l]=LWe(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return k.useEffect(()=>{const u=B_(r.current);a.current=o==="mounted"?u:"none"},[o]),yy(()=>{const u=r.current,f=i.current;if(f!==e){const p=a.current,m=B_(u);e?l("MOUNT"):m==="none"||u?.display==="none"?l("UNMOUNT"):l(f&&p!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),yy(()=>{if(t){let u;const f=t.ownerDocument.defaultView??window,d=m=>{const S=B_(r.current).includes(CSS.escape(m.animationName));if(m.target===t&&S&&(l("ANIMATION_END"),!i.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},p=m=>{m.target===t&&(a.current=B_(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",d),t.addEventListener("animationend",d),()=>{f.clearTimeout(u),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",d),t.removeEventListener("animationend",d)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(o),ref:k.useCallback(u=>{r.current=u?getComputedStyle(u):null,n(u)},[])}}function B_(e){return e?.animationName||"none"}function MWe(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jWe=Ex[" useId ".trim().toString()]||(()=>{}),FWe=0;function BWe(e){const[t,n]=k.useState(jWe());return yy(()=>{n(r=>r??String(FWe++))},[e]),e||(t?`radix-${t}`:"")}var Qw="Collapsible",[UWe]=EWe(Qw),[$We,f5]=UWe(Qw),jle=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:s,...o}=e,[l,u]=wWe({prop:r,defaultProp:i??!1,onChange:s,caller:Qw});return b.jsx($We,{scope:n,disabled:a,contentId:BWe(),open:l,onOpenToggle:k.useCallback(()=>u(f=>!f),[u]),children:b.jsx(d5.div,{"data-state":p5(l),"data-disabled":a?"":void 0,...o,ref:t})})});jle.displayName=Qw;var Fle="CollapsibleTrigger",Ble=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=f5(Fle,n);return b.jsx(d5.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":p5(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:_We(e.onClick,i.onOpenToggle)})});Ble.displayName=Fle;var h5="CollapsibleContent",Ule=k.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=f5(h5,e.__scopeCollapsible);return b.jsx(Mle,{present:n||i.open,children:({present:a})=>b.jsx(zWe,{...r,ref:t,present:a})})});Ule.displayName=h5;var zWe=k.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...a}=e,s=f5(h5,n),[o,l]=k.useState(r),u=k.useRef(null),f=Ple(t,u),d=k.useRef(0),p=d.current,m=k.useRef(0),y=m.current,S=s.open||o,g=k.useRef(S),_=k.useRef(void 0);return k.useEffect(()=>{const v=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(v)},[]),yy(()=>{const v=u.current;if(v){_.current=_.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const x=v.getBoundingClientRect();d.current=x.height,m.current=x.width,g.current||(v.style.transitionDuration=_.current.transitionDuration,v.style.animationName=_.current.animationName),l(r)}},[s.open,r]),b.jsx(d5.div,{"data-state":p5(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!S,...a,ref:f,style:{"--radix-collapsible-content-height":p?`${p}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:S&&i})});function p5(e){return e?"open":"closed"}var HWe=jle;const WWe=HWe,VWe=Ble,GWe=Ule;function qWe(e){const{viewState:t,setDiffOptions:n}=u5(e),{collapsedFiles:r}=t.diffOptions,i=k.useCallback(l=>{const u=r.includes(l);n({collapsedFiles:u?r.filter(f=>f!==l):[...r,l]})},[r,n]),a=k.useCallback(l=>{n({collapsedFiles:l})},[n]),s=k.useCallback(()=>{n({collapsedFiles:[]})},[n]),o=k.useCallback(l=>r.includes(l),[r]);return{options:t.diffOptions,setOption:(l,u)=>{n({[l]:u})},setOptions:n,toggleFileCollapse:i,collapseAll:a,expandAll:s,isFileCollapsed:o}}function KWe(e){const t=[];let n=null,r=0,i=0;for(const a of e.split(`
114
114
  `))if(a.startsWith("diff --git"))n={path:a.match(/diff --git a\/(.+?) b\//)?.[1]??"unknown",lines:[],additions:0,deletions:0},t.push(n),n.lines.push({type:"header",content:a});else if(a.startsWith("index ")||a.startsWith("---")||a.startsWith("+++"))n?.lines.push({type:"header",content:a});else if(a.startsWith("@@")){const s=a.match(/@@ -(\d+),?\d* \+(\d+),?\d* @@/);s&&(r=parseInt(s[1],10),i=parseInt(s[2],10)),n?.lines.push({type:"hunk",content:a})}else a.startsWith("+")?n&&(n.additions++,n.lines.push({type:"added",content:a.slice(1),newLineNumber:i++})):a.startsWith("-")?n&&(n.deletions++,n.lines.push({type:"removed",content:a.slice(1),oldLineNumber:r++})):a.startsWith(" ")&&n?.lines.push({type:"context",content:a.slice(1),oldLineNumber:r++,newLineNumber:i++});return t}function YWe({file:e,wrap:t,isCollapsed:n,onToggle:r}){return b.jsxs(WWe,{open:!n,onOpenChange:()=>r(),children:[b.jsx(VWe,{asChild:!0,children:b.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 bg-card border-b border-border cursor-pointer hover:bg-muted select-none",children:[b.jsx(fe,{icon:n?$y:Uy,size:12,strokeWidth:2,className:"text-muted-foreground shrink-0"}),b.jsx("span",{className:"font-mono text-xs text-foreground truncate flex-1",children:e.path}),b.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[e.additions>0&&b.jsxs("span",{className:"text-accent",children:["+",e.additions]}),e.additions>0&&e.deletions>0&&" ",e.deletions>0&&b.jsxs("span",{className:"text-destructive",children:["-",e.deletions]})]})]})}),b.jsx(GWe,{children:b.jsx("div",{className:"font-mono text-xs",children:e.lines.slice(1).map((i,a)=>b.jsxs("div",{className:Ue("flex px-2 py-0.5",i.type==="added"&&"bg-accent/10",i.type==="removed"&&"bg-destructive/10",i.type==="header"&&"bg-muted/50 text-muted-foreground",i.type==="hunk"&&"bg-accent/10 text-accent"),children:[(i.type==="added"||i.type==="removed"||i.type==="context")&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"w-10 shrink-0 select-none pr-2 text-right text-muted-foreground",children:i.oldLineNumber??""}),b.jsx("span",{className:"w-10 shrink-0 select-none pr-2 text-right text-muted-foreground",children:i.newLineNumber??""})]}),b.jsxs("span",{className:Ue("w-4 shrink-0 select-none text-center",i.type==="added"&&"text-accent",i.type==="removed"&&"text-destructive"),children:[i.type==="added"&&"+",i.type==="removed"&&"-"]}),b.jsx("span",{className:Ue("flex-1",t?"whitespace-pre-wrap break-all":"whitespace-pre",i.type==="added"&&"text-accent",i.type==="removed"&&"text-destructive"),children:i.content})]},a))})})]})}function HX({taskId:e,worktreePath:t}){const{options:n,setOption:r,toggleFileCollapse:i,collapseAll:a,expandAll:s,isFileCollapsed:o}=qWe(e),{wrap:l,ignoreWhitespace:u,includeUntracked:f,collapsedFiles:d}=n,{data:p,isLoading:m,error:y}=Vxe(t,{ignoreWhitespace:u,includeUntracked:f}),S=k.useMemo(()=>p?.diff?KWe(p.diff):[],[p?.diff]),g=k.useMemo(()=>S.map(w=>w.path),[S]),_=S.length>0&&d.length===S.length,v=k.useMemo(()=>S.reduce((w,C)=>w+C.additions,0),[S]),x=k.useMemo(()=>S.reduce((w,C)=>w+C.deletions,0),[S]);if(k.useEffect(()=>{const w=C=>{if(C.shiftKey&&C.key==="C"&&!C.ctrlKey&&!C.metaKey&&!C.altKey){const R=C.target;if(R.tagName==="INPUT"||R.tagName==="TEXTAREA"||R.isContentEditable)return;C.preventDefault(),_?s():a(g)}};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[_,g,a,s]),!t)return b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"No worktree selected"});if(m)return b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Loading diff..."});if(y)return b.jsx("div",{className:"flex h-full items-center justify-center text-destructive text-sm",children:y.message});const T=p?.files?.some(w=>w.status==="untracked")??!1;return S.length===0?b.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-muted-foreground text-sm gap-2",children:[b.jsx("p",{children:"No changes detected"}),p?.files&&p.files.length>0&&b.jsxs("div",{className:"text-xs",children:[b.jsx("p",{className:"text-center mb-2",children:"Modified files:"}),b.jsxs("div",{className:"flex flex-col gap-1",children:[p.files.map(w=>b.jsxs("div",{className:"flex gap-2",children:[b.jsxs("span",{className:Ue("w-4 text-center",w.status==="added"&&"text-accent",w.status==="deleted"&&"text-destructive",w.status==="modified"&&"text-muted-foreground",w.status==="untracked"&&"text-muted-foreground"),children:[w.status==="added"&&"A",w.status==="deleted"&&"D",w.status==="modified"&&"M",w.status==="untracked"&&"?"]}),b.jsx("span",{children:w.path})]},w.path)),T&&b.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-muted-foreground hover:text-foreground mt-1",children:[b.jsx("input",{type:"checkbox",checked:f,onChange:w=>r("includeUntracked",w.target.checked),className:"w-4 h-3"}),b.jsx("span",{children:"Show untracked files"})]})]})]})]}):b.jsxs("div",{className:"flex flex-col h-full bg-background",children:[b.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5 bg-card border-b border-border text-xs",children:[p?.branch&&b.jsxs("span",{className:"text-muted-foreground",children:[p.branch,p.isBranchDiff&&b.jsx("span",{className:"opacity-70",children:" (vs master)"})]}),(v>0||x>0)&&b.jsxs("span",{className:"text-muted-foreground",children:[b.jsxs("span",{className:"text-accent",children:["+",v]})," ",b.jsxs("span",{className:"text-destructive",children:["-",x]})]}),b.jsx("div",{className:"flex-1"}),b.jsxs("button",{onClick:()=>_?s():a(g),className:"flex items-center gap-1 px-1.5 py-0.5 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:_?"Expand all (Shift+C)":"Collapse all (Shift+C)",children:[b.jsx(fe,{icon:_?dte:lte,size:12,strokeWidth:2}),b.jsx("span",{className:"hidden sm:inline",children:_?"Expand":"Collapse"})]}),b.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[b.jsx("input",{type:"checkbox",checked:l,onChange:w=>r("wrap",w.target.checked),className:"w-3 h-3"}),"Wrap"]}),b.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[b.jsx("input",{type:"checkbox",checked:u,onChange:w=>r("ignoreWhitespace",w.target.checked),className:"w-3 h-3"}),"Ignore whitespace"]}),b.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer text-muted-foreground hover:text-foreground",children:[b.jsx("input",{type:"checkbox",checked:f,onChange:w=>r("includeUntracked",w.target.checked),className:"w-3 h-3"}),"Untracked"]})]}),b.jsx(Yy,{className:"flex-1 min-h-0",children:S.map(w=>b.jsx(YWe,{file:w,wrap:l,isCollapsed:o(w.path),onToggle:()=>i(w.path)},w.path))})]})}function XWe(e){const{viewState:t,setBrowserUrl:n}=u5(e);return{url:t.browserUrl,setUrl:n}}function WX({taskId:e}){const{url:t,setUrl:n}=XWe(e),[r,i]=k.useState(t),[a,s]=k.useState(0);k.useEffect(()=>{i(t)},[t]);const o=k.useCallback(()=>{s(u=>u+1)},[]),l=k.useCallback(u=>{u.preventDefault();let f=r.trim();!f.startsWith("http://")&&!f.startsWith("https://")&&(f=`http://${f}`),n(f),s(d=>d+1)},[r,n]);return b.jsxs("div",{className:"flex h-full flex-col bg-background",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-1 border-b border-border bg-card px-2 py-1.5",children:[b.jsx(Ke,{variant:"ghost",size:"icon-xs",disabled:!0,children:b.jsx(fe,{icon:Jee,size:14,strokeWidth:2})}),b.jsx(Ke,{variant:"ghost",size:"icon-xs",disabled:!0,children:b.jsx(fe,{icon:$y,size:14,strokeWidth:2})}),b.jsx(Ke,{variant:"ghost",size:"icon-xs",onClick:o,children:b.jsx(fe,{icon:U1e,size:14,strokeWidth:2})}),b.jsx("form",{onSubmit:l,className:"flex-1",children:b.jsx(vn,{value:r,onChange:u=>i(u.target.value),className:"h-7 bg-background text-xs",placeholder:"Enter URL..."})})]}),b.jsx("div",{className:"flex-1 overflow-hidden bg-card",children:b.jsx("iframe",{src:t,className:"h-full w-full border-0",title:"Browser Preview",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups"},a)})]})}function ZWe(e){const t=[];function n(r){for(const i of r)i.type==="file"?t.push({name:i.name,path:i.path}):i.children&&n(i.children)}return n(e),t}function $le(e){const t=e.split(".").pop()?.toLowerCase()||"";return["png","jpg","jpeg","gif","svg","webp","ico"].includes(t)?D1e:["ts","tsx","js","jsx","json","css","html","md","yaml","yml","toml","sh","py","rs","go","sql"].includes(t)?C1e:A1e}function zle({entry:e,depth:t,selectedFile:n,expandedDirs:r,onSelectFile:i,onToggleDir:a}){const s=r.includes(e.path),o=n===e.path,l=e.type==="directory",u=k.useCallback(()=>{l?a(e.path):i(e.path)},[l,e.path,i,a]);return b.jsxs("div",{children:[b.jsxs("div",{className:Ue("flex items-center gap-1.5 px-2 py-0.5 cursor-pointer text-sm hover:bg-muted/50",o&&"bg-primary/10 text-primary"),style:{paddingLeft:`${t*12+8}px`},onClick:u,children:[b.jsx(fe,{icon:l?s?YI:Hi:$le(e.name),size:14,strokeWidth:2,className:Ue("shrink-0",l?"text-accent":"text-muted-foreground")}),b.jsx("span",{className:"break-all",children:e.name})]}),l&&s&&e.children&&b.jsx("div",{children:e.children.map(f=>b.jsx(zle,{entry:f,depth:t+1,selectedFile:n,expandedDirs:r,onSelectFile:i,onToggleDir:a},f.path))})]})}function QWe({entries:e,selectedFile:t,expandedDirs:n,onSelectFile:r,onToggleDir:i,onCollapseAll:a}){const[s,o]=k.useState(""),l=k.useMemo(()=>ZWe(e),[e]),u=k.useMemo(()=>{if(!s.trim())return null;const d=s.trim();return l.map(p=>({...p,score:Math.max(no(p.name,d),no(p.path,d))})).filter(p=>p.score>0).sort((p,m)=>m.score-p.score)},[l,s]),f=k.useCallback(()=>{o("")},[]);return e.length===0?b.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"No files"}):b.jsxs("div",{className:"flex flex-col h-full bg-background",children:[b.jsxs("div",{className:"flex shrink-0 items-center justify-between px-2 py-1 border-b border-border bg-card",children:[b.jsx("span",{className:"text-xs text-muted-foreground",children:"Files"}),b.jsx("button",{onClick:a,className:"p-1 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:"Collapse all folders",children:b.jsx(fe,{icon:lte,size:14,strokeWidth:2})})]}),b.jsx("div",{className:"shrink-0 px-2 py-1.5 border-b border-border bg-card",children:b.jsxs("div",{className:"relative",children:[b.jsx("input",{type:"text",value:s,onChange:d=>o(d.target.value),placeholder:"Search files...",className:"w-full text-sm bg-muted/50 border border-border rounded px-2 py-1 pr-7 placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),s&&b.jsx("button",{onClick:f,className:"absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 text-muted-foreground hover:text-foreground rounded hover:bg-muted",children:b.jsx(fe,{icon:ci,size:12,strokeWidth:2})})]})}),b.jsx("div",{className:"py-1 flex-1 overflow-auto",children:u?u.length>0?u.map(d=>b.jsxs("div",{className:Ue("flex items-center gap-1.5 px-2 py-0.5 cursor-pointer text-sm hover:bg-muted/50",t===d.path&&"bg-primary/10 text-primary"),onClick:()=>r(d.path),children:[b.jsx(fe,{icon:$le(d.name),size:14,strokeWidth:2,className:"shrink-0 text-muted-foreground"}),b.jsx("span",{className:"truncate",title:d.path,children:d.name}),b.jsx("span",{className:"text-xs text-muted-foreground truncate ml-auto",children:d.path.split("/").slice(0,-1).join("/")})]},d.path)):b.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No matching files"}):e.map(d=>b.jsx(zle,{entry:d,depth:0,selectedFile:t,expandedDirs:n,onSelectFile:r,onToggleDir:i},d.path))})]})}function VX(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function JWe(e){if(Array.isArray(e))return e}function eVe(e,t,n){return(t=oVe(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function tVe(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,s,o=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(l=(r=a.call(n)).done)&&(o.push(r.value),o.length!==t);l=!0);}catch(f){u=!0,i=f}finally{try{if(!l&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(u)throw i}}return o}}function nVe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
115
115
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function qX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?GX(Object(n),!0).forEach(function(r){eVe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GX(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function rVe(e,t){if(e==null)return{};var n,r,i=iVe(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function iVe(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function aVe(e,t){return JWe(e)||tVe(e,t)||lVe(e,t)||nVe()}function sVe(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oVe(e){var t=sVe(e,"string");return typeof t=="symbol"?t:t+""}function lVe(e,t){if(e){if(typeof e=="string")return VX(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?VX(e,t):void 0}}function uVe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function KX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function YX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?KX(Object(n),!0).forEach(function(r){uVe(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):KX(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function cVe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(i,a){return a(i)},r)}}function Ib(e){return function t(){for(var n=this,r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return i.length>=e.length?e.apply(this,i):function(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];return t.apply(n,[].concat(i,o))}}}function cx(e){return{}.toString.call(e).includes("Object")}function dVe(e){return!Object.keys(e).length}function _y(e){return typeof e=="function"}function fVe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function hVe(e,t){return cx(t)||Bc("changeType"),Object.keys(t).some(function(n){return!fVe(e,n)})&&Bc("changeField"),t}function pVe(e){_y(e)||Bc("selectorType")}function mVe(e){_y(e)||cx(e)||Bc("handlerType"),cx(e)&&Object.values(e).some(function(t){return!_y(t)})&&Bc("handlersType")}function gVe(e){e||Bc("initialIsRequired"),cx(e)||Bc("initialType"),dVe(e)&&Bc("initialContent")}function bVe(e,t){throw new Error(e[t]||e.default)}var vVe={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},Bc=Ib(bVe)(vVe),U_={changes:hVe,selector:pVe,handler:mVe,initial:gVe};function yVe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};U_.initial(e),U_.handler(t);var n={current:e},r=Ib(SVe)(n,t),i=Ib(EVe)(n),a=Ib(U_.changes)(e),s=Ib(_Ve)(n);function o(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(f){return f};return U_.selector(u),u(n.current)}function l(u){cVe(r,i,a,s)(u)}return[o,l]}function _Ve(e,t){return _y(t)?t(e.current):t}function EVe(e,t){return e.current=YX(YX({},e.current),t),t}function SVe(e,t,n){return _y(t)?t(e.current):Object.keys(n).forEach(function(r){var i;return(i=t[r])===null||i===void 0?void 0:i.call(t,e.current[r])}),n}var xVe={create:yVe},wVe={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function TVe(e){return function t(){for(var n=this,r=arguments.length,i=new Array(r),a=0;a<r;a++)i[a]=arguments[a];return i.length>=e.length?e.apply(this,i):function(){for(var s=arguments.length,o=new Array(s),l=0;l<s;l++)o[l]=arguments[l];return t.apply(n,[].concat(i,o))}}}function CVe(e){return{}.toString.call(e).includes("Object")}function AVe(e){return e||XX("configIsRequired"),CVe(e)||XX("configType"),e.urls?(kVe(),{paths:{vs:e.urls.monacoBase}}):e}function kVe(){console.warn(Hle.deprecation)}function OVe(e,t){throw new Error(e[t]||e.default)}var Hle={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
116
116
  You are using deprecated way of configuration.
@@ -162,4 +162,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
162
162
  `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:p,table:s,tableCell:l,tableRow:o}};function s(m,y,S,g){return u(f(m,S,g),m.align)}function o(m,y,S,g){const _=d(m,S,g),v=u([_]);return v.slice(0,v.indexOf(`
163
163
  `))}function l(m,y,S,g){const _=S.enter("tableCell"),v=S.enter("phrasing"),x=S.containerPhrasing(m,{...g,before:a,after:a});return v(),_(),x}function u(m,y){return ynt(m,{align:y,alignDelimiters:r,padding:n,stringLength:i})}function f(m,y,S){const g=m.children;let _=-1;const v=[],x=y.enter("table");for(;++_<g.length;)v[_]=d(g[_],y,S);return x(),v}function d(m,y,S){const g=m.children;let _=-1;const v=[],x=y.enter("tableRow");for(;++_<g.length;)v[_]=l(g[_],m,y,S);return x(),v}function p(m,y,S){let g=tde.inlineCode(m,y,S);return S.stack.includes("tableCell")&&(g=g.replace(/\|/g,"\\$&")),g}}function srt(){return{exit:{taskListCheckValueChecked:AQ,taskListCheckValueUnchecked:AQ,paragraph:lrt}}}function ort(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:urt}}}function AQ(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function lrt(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let a=-1,s;for(;++a<i.length;){const o=i[a];if(o.type==="paragraph"){s=o;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function urt(e,t,n,r){const i=e.children[0],a=typeof e.checked=="boolean"&&i&&i.type==="paragraph",s="["+(e.checked?"x":" ")+"] ",o=n.createTracker(r);a&&o.move(s);let l=tde.listItem(e,t,n,{...r,...o.current()});return a&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(f){return f+s}}function crt(){return[ztt(),unt(),hnt(),Jnt(),srt()]}function drt(e){return{extensions:[Htt(),cnt(e),pnt(),art(e),ort()]}}const frt={tokenize:vrt,partial:!0},nde={tokenize:yrt,partial:!0},rde={tokenize:_rt,partial:!0},ide={tokenize:Ert,partial:!0},hrt={tokenize:Srt,partial:!0},ade={name:"wwwAutolink",tokenize:grt,previous:ode},sde={name:"protocolAutolink",tokenize:brt,previous:lde},Mu={name:"emailAutolink",tokenize:mrt,previous:ude},Sl={};function prt(){return{text:Sl}}let Ud=48;for(;Ud<123;)Sl[Ud]=Mu,Ud++,Ud===58?Ud=65:Ud===91&&(Ud=97);Sl[43]=Mu;Sl[45]=Mu;Sl[46]=Mu;Sl[95]=Mu;Sl[72]=[Mu,sde];Sl[104]=[Mu,sde];Sl[87]=[Mu,ade];Sl[119]=[Mu,ade];function mrt(e,t,n){const r=this;let i,a;return s;function s(d){return!fP(d)||!ude.call(r,r.previous)||w8(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(d))}function o(d){return fP(d)?(e.consume(d),o):d===64?(e.consume(d),l):n(d)}function l(d){return d===46?e.check(hrt,f,u)(d):d===45||d===95||$i(d)?(a=!0,e.consume(d),l):f(d)}function u(d){return e.consume(d),i=!0,l}function f(d){return a&&i&&na(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function grt(e,t,n){const r=this;return i;function i(s){return s!==87&&s!==119||!ode.call(r,r.previous)||w8(r.events)?n(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(frt,e.attempt(nde,e.attempt(rde,a),n),n)(s))}function a(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function brt(e,t,n){const r=this;let i="",a=!1;return s;function s(d){return(d===72||d===104)&&lde.call(r,r.previous)&&!w8(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),e.consume(d),o):n(d)}function o(d){if(na(d)&&i.length<5)return i+=String.fromCodePoint(d),e.consume(d),o;if(d===58){const p=i.toLowerCase();if(p==="http"||p==="https")return e.consume(d),l}return n(d)}function l(d){return d===47?(e.consume(d),a?u:(a=!0,l)):n(d)}function u(d){return d===null||vx(d)||Gn(d)||Uf(d)||AT(d)?n(d):e.attempt(nde,e.attempt(rde,f),n)(d)}function f(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function vrt(e,t,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,e.consume(s),i):s===46&&r===3?(e.consume(s),a):n(s)}function a(s){return s===null?n(s):t(s)}}function yrt(e,t,n){let r,i,a;return s;function s(u){return u===46||u===95?e.check(ide,l,o)(u):u===null||Gn(u)||Uf(u)||u!==45&&AT(u)?l(u):(a=!0,e.consume(u),s)}function o(u){return u===95?r=!0:(i=r,r=void 0),e.consume(u),s}function l(u){return i||r||!a?n(u):t(u)}}function _rt(e,t){let n=0,r=0;return i;function i(s){return s===40?(n++,e.consume(s),i):s===41&&r<n?a(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(ide,t,a)(s):s===null||Gn(s)||Uf(s)?t(s):(e.consume(s),i)}function a(s){return s===41&&r++,e.consume(s),i}}function Ert(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||Gn(o)||Uf(o)?t(o):n(o)}function i(o){return o===null||o===40||o===91||Gn(o)||Uf(o)?t(o):r(o)}function a(o){return na(o)?s(o):n(o)}function s(o){return o===59?(e.consume(o),r):na(o)?(e.consume(o),s):n(o)}}function Srt(e,t,n){return r;function r(a){return e.consume(a),i}function i(a){return $i(a)?n(a):t(a)}}function ode(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Gn(e)}function lde(e){return!na(e)}function ude(e){return!(e===47||fP(e))}function fP(e){return e===43||e===45||e===46||e===95||$i(e)}function w8(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const xrt={tokenize:Nrt,partial:!0};function wrt(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:krt,continuation:{tokenize:Ort},exit:Rrt}},text:{91:{name:"gfmFootnoteCall",tokenize:Art},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Trt,resolveTo:Crt}}}}function Trt(e,t,n){const r=this;let i=r.events.length;const a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){s=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return o;function o(l){if(!s||!s._balanced)return n(l);const u=fo(r.sliceSerialize({start:s.end,end:r.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function Crt(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},o=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",a,t],["enter",s,t],["exit",s,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...o),e}function Art(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a=0,s;return o;function o(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(d){if(a>999||d===93&&!s||d===null||d===91||Gn(d))return n(d);if(d===93){e.exit("chunkString");const p=e.exit("gfmFootnoteCallString");return i.includes(fo(r.sliceSerialize(p)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return Gn(d)||(s=!0),a++,e.consume(d),d===92?f:u}function f(d){return d===91||d===92||d===93?(e.consume(d),a++,u):u(d)}}function krt(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a,s=0,o;return l;function l(y){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(y){return y===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",f):n(y)}function f(y){if(s>999||y===93&&!o||y===null||y===91||Gn(y))return n(y);if(y===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return a=fo(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(y),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),p}return Gn(y)||(o=!0),s++,e.consume(y),y===92?d:f}function d(y){return y===91||y===92||y===93?(e.consume(y),s++,f):f(y)}function p(y){return y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),i.includes(a)||i.push(a),En(e,m,"gfmFootnoteDefinitionWhitespace")):n(y)}function m(y){return t(y)}}function Ort(e,t,n){return e.check(I0,t,e.attempt(xrt,t,n))}function Rrt(e){e.exit("gfmFootnoteDefinition")}function Nrt(e,t,n){const r=this;return En(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(a):n(a)}}function Irt(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,o){let l=-1;for(;++l<s.length;)if(s[l][0]==="enter"&&s[l][1].type==="strikethroughSequenceTemporary"&&s[l][1]._close){let u=l;for(;u--;)if(s[u][0]==="exit"&&s[u][1].type==="strikethroughSequenceTemporary"&&s[u][1]._open&&s[l][1].end.offset-s[l][1].start.offset===s[u][1].end.offset-s[u][1].start.offset){s[l][1].type="strikethroughSequence",s[u][1].type="strikethroughSequence";const f={type:"strikethrough",start:Object.assign({},s[u][1].start),end:Object.assign({},s[l][1].end)},d={type:"strikethroughText",start:Object.assign({},s[u][1].end),end:Object.assign({},s[l][1].start)},p=[["enter",f,o],["enter",s[u][1],o],["exit",s[u][1],o],["enter",d,o]],m=o.parser.constructs.insideSpan.null;m&&es(p,p.length,0,kT(m,s.slice(u+1,l),o)),es(p,p.length,0,[["exit",d,o],["enter",s[l][1],o],["exit",s[l][1],o],["exit",f,o]]),es(s,u-1,l-u+3,p),l=u+p.length-2;break}}for(l=-1;++l<s.length;)s[l][1].type==="strikethroughSequenceTemporary"&&(s[l][1].type="data");return s}function a(s,o,l){const u=this.previous,f=this.events;let d=0;return p;function p(y){return u===126&&f[f.length-1][1].type!=="characterEscape"?l(y):(s.enter("strikethroughSequenceTemporary"),m(y))}function m(y){const S=ym(u);if(y===126)return d>1?l(y):(s.consume(y),d++,m);if(d<2&&!n)return l(y);const g=s.exit("strikethroughSequenceTemporary"),_=ym(y);return g._open=!_||_===2&&!!S,g._close=!S||S===2&&!!_,o(y)}}}class Drt{constructor(){this.map=[]}add(t,n,r){Lrt(this,t,n,r)}consume(t){if(this.map.sort(function(a,s){return a[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const a of i)t.push(a);i=r.pop()}this.map.length=0}}function Lrt(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function Prt(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=r.length-1;r[a]=r[a]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function Mrt(){return{flow:{null:{name:"table",tokenize:jrt,resolveAll:Frt}}}}function jrt(e,t,n){const r=this;let i=0,a=0,s;return o;function o(L){let D=r.events.length-1;for(;D>-1;){const V=r.events[D][1].type;if(V==="lineEnding"||V==="linePrefix")D--;else break}const z=D>-1?r.events[D][1].type:null,M=z==="tableHead"||z==="tableRow"?C:l;return M===C&&r.parser.lazy[r.now().line]?n(L):M(L)}function l(L){return e.enter("tableHead"),e.enter("tableRow"),u(L)}function u(L){return L===124||(s=!0,a+=1),f(L)}function f(L){return L===null?n(L):It(L)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),m):n(L):dn(L)?En(e,f,"whitespace")(L):(a+=1,s&&(s=!1,i+=1),L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),s=!0,f):(e.enter("data"),d(L)))}function d(L){return L===null||L===124||Gn(L)?(e.exit("data"),f(L)):(e.consume(L),L===92?p:d)}function p(L){return L===92||L===124?(e.consume(L),d):d(L)}function m(L){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(L):(e.enter("tableDelimiterRow"),s=!1,dn(L)?En(e,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):y(L))}function y(L){return L===45||L===58?g(L):L===124?(s=!0,e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),S):w(L)}function S(L){return dn(L)?En(e,g,"whitespace")(L):g(L)}function g(L){return L===58?(a+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),_):L===45?(a+=1,_(L)):L===null||It(L)?T(L):w(L)}function _(L){return L===45?(e.enter("tableDelimiterFiller"),v(L)):w(L)}function v(L){return L===45?(e.consume(L),v):L===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(L),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(L))}function x(L){return dn(L)?En(e,T,"whitespace")(L):T(L)}function T(L){return L===124?y(L):L===null||It(L)?!s||i!==a?w(L):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(L)):w(L)}function w(L){return n(L)}function C(L){return e.enter("tableRow"),R(L)}function R(L){return L===124?(e.enter("tableCellDivider"),e.consume(L),e.exit("tableCellDivider"),R):L===null||It(L)?(e.exit("tableRow"),t(L)):dn(L)?En(e,R,"whitespace")(L):(e.enter("data"),O(L))}function O(L){return L===null||L===124||Gn(L)?(e.exit("data"),R(L)):(e.consume(L),L===92?N:O)}function N(L){return L===92||L===124?(e.consume(L),O):O(L)}}function Frt(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],s=[0,0,0,0],o=!1,l=0,u,f,d;const p=new Drt;for(;++n<e.length;){const m=e[n],y=m[1];m[0]==="enter"?y.type==="tableHead"?(o=!1,l!==0&&(kQ(p,t,l,u,f),f=void 0,l=0),u={type:"table",start:Object.assign({},y.start),end:Object.assign({},y.end)},p.add(n,0,[["enter",u,t]])):y.type==="tableRow"||y.type==="tableDelimiterRow"?(r=!0,d=void 0,a=[0,0,0,0],s=[0,n+1,0,0],o&&(o=!1,f={type:"tableBody",start:Object.assign({},y.start),end:Object.assign({},y.end)},p.add(n,0,[["enter",f,t]])),i=y.type==="tableDelimiterRow"?2:f?3:1):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(a[1]!==0&&(s[0]=s[1],d=X_(p,t,a,i,void 0,d),a=[0,0,0,0]),s[2]=n)):y.type==="tableCellDivider"&&(r?r=!1:(a[1]!==0&&(s[0]=s[1],d=X_(p,t,a,i,void 0,d)),a=s,s=[a[1],n,0,0])):y.type==="tableHead"?(o=!0,l=n):y.type==="tableRow"||y.type==="tableDelimiterRow"?(l=n,a[1]!==0?(s[0]=s[1],d=X_(p,t,a,i,n,d)):s[1]!==0&&(d=X_(p,t,s,i,n,d)),i=0):i&&(y.type==="data"||y.type==="tableDelimiterMarker"||y.type==="tableDelimiterFiller")&&(s[3]=n)}for(l!==0&&kQ(p,t,l,u,f),p.consume(t.events),n=-1;++n<t.events.length;){const m=t.events[n];m[0]==="enter"&&m[1].type==="table"&&(m[1]._align=Prt(t.events,n))}return e}function X_(e,t,n,r,i,a){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",o="tableContent";n[0]!==0&&(a.end=Object.assign({},Jh(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const l=Jh(t.events,n[1]);if(a={type:s,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const u=Jh(t.events,n[2]),f=Jh(t.events,n[3]),d={type:o,start:Object.assign({},u),end:Object.assign({},f)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const p=t.events[n[2]],m=t.events[n[3]];if(p[1].end=Object.assign({},m[1].end),p[1].type="chunkText",p[1].contentType="text",n[3]>n[2]+1){const y=n[2]+1,S=n[3]-n[2]-1;e.add(y,S,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return i!==void 0&&(a.end=Object.assign({},Jh(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function kQ(e,t,n,r,i){const a=[],s=Jh(t.events,n);i&&(i.end=Object.assign({},s),a.push(["exit",i,t])),r.end=Object.assign({},s),a.push(["exit",r,t]),e.add(n+1,0,a)}function Jh(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const Brt={name:"tasklistCheck",tokenize:$rt};function Urt(){return{text:{91:Brt}}}function $rt(e,t,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),a)}function a(l){return Gn(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),s):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),s):n(l)}function s(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(l)}function o(l){return It(l)?t(l):dn(l)?e.check({tokenize:zrt},t,n)(l):n(l)}}function zrt(e,t,n){return En(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function Hrt(e){return Tce([prt(),wrt(),Irt(e),Mrt(),Urt()])}const Wrt={};function Vrt(e){const t=this,n=e||Wrt,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(Hrt(n)),a.push(crt()),s.push(drt(n))}const Grt=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]/i,qrt=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)(\/.*)?\]/i,Krt=({legacyTitle:e=!1,tagName:t="div"}={})=>n=>{ia(n,"blockquote",(r,i,a)=>{let s="",o="",l=!0,u=r.children.map(f=>{if(l&&f.type==="paragraph"){const d=f.children[0],p=d.type==="text"?d.value:"",m=e?qrt:Grt,y=p.match(m);if(y&&(l=!1,s=y[1].toLocaleLowerCase(),o=e&&y[2]||s.toLocaleUpperCase(),p.includes(`
164
164
  `)&&(f.children[0]={type:"text",value:p.replace(m,"").replace(/^\n+/,"")}),!p.includes(`
165
- `))){const S=[];f.children.forEach((g,_)=>{_!=0&&(_==1&&g.type==="break"||S.push(g))}),f.children=[...S]}}return f});s&&(r.data={hName:t,hProperties:{class:`markdown-alert markdown-alert-${s}`,dir:"auto"}},u.unshift({type:"paragraph",children:[Yrt(s),{type:"text",value:o.replace(/^\//,"")}],data:{hProperties:{class:"markdown-alert-title",dir:"auto"}}})),r.children=[...u]})};function Yrt(e){let t=Xrt[e]??"";return{type:"emphasis",data:{hName:"svg",hProperties:{class:"octicon",viewBox:"0 0 16 16",width:"16",height:"16",ariaHidden:"true"}},children:[{type:"emphasis",data:{hName:"path",hProperties:{d:t}},children:[]}]}}const Xrt={note:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z",tip:"M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z",important:"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",warning:"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",caution:"M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"};function Zrt(e,t){if(typeof document>"u")return;const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style={position:"absolute",left:"-9999px"},document.body.appendChild(n);const r=document.getSelection().rangeCount>0?document.getSelection().getRangeAt(0):!1;n.select();let i=!1;try{i=!!document.execCommand("copy")}catch{i=!1}document.body.removeChild(n),r&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(r)),t&&t(i)}function cde(e){if(!e)return null;var t=e;return t.dataset.code&&t.classList.contains("copied")?t:t.parentElement?cde(t.parentElement):null}function Qrt(e){var t=n=>{var r=cde(n.target);r&&(r.classList.add("active"),Zrt(r.dataset.code,function(){setTimeout(()=>{r.classList.remove("active")},2e3)}))};k.useEffect(()=>{var n,r;return(n=e.current)==null||n.removeEventListener("click",t,!1),(r=e.current)==null||r.addEventListener("click",t,!1),()=>{var i;(i=e.current)==null||i.removeEventListener("click",t,!1)}},[e])}var Jrt=["prefixCls","className","source","style","disableCopy","skipHtml","onScroll","onMouseOver","pluginsFilter","rehypeRewrite","wrapperElement","warpperElement","urlTransform"],eit=e=>e;const tit=oe.forwardRef((e,t)=>{var{prefixCls:n="wmde-markdown wmde-markdown-color",className:r,source:i,style:a,disableCopy:s=!1,skipHtml:o=!0,onScroll:l,onMouseOver:u,pluginsFilter:f,wrapperElement:d={},warpperElement:p={},urlTransform:m}=e,y=s9e(e,Jrt),S=oe.useRef(null);k.useImperativeHandle(t,()=>ru({},e,{mdp:S}),[S,e]);var g=(n||"")+" "+(r||"");Qrt(S);var _=[...y.rehypePlugins||[]],v={allowElement:(w,C,R)=>y.allowElement?y.allowElement(w,C,R):/^[A-Za-z0-9]+$/.test(w.tagName)};o||_.push(yce);var x=[Krt,...y.remarkPlugins||[],Vrt],T=ru({},p,d);return b.jsx("div",ru({ref:S,onScroll:l,onMouseOver:u},T,{className:g,style:a,children:b.jsx(Ptt,ru({},v,y,{skipHtml:!o,urlTransform:m||eit,rehypePlugins:f?f("rehype",_):_,remarkPlugins:f?f("remark",x):x,children:i||""}))}))});var nit=function(t){return n=>{ia(n,r=>{r.type==="element"&&r.tagName==="code"&&r.data&&r.data.meta&&(r.properties=ru({},r.properties,{"data-meta":String(r.data.meta)}))})}},rit=function(t){return n=>{ia(n,r=>{if(r.type==="element"&&r.tagName==="code"&&r.properties&&r.properties.dataMeta){r.data||(r.data={});var i=r.properties.dataMeta;typeof i=="string"&&(r.data.meta=i),delete r.properties.dataMeta}})}};const iit=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,ait=Object.hasOwnProperty;class sit{constructor(){this.occurrences,this.reset()}slug(t,n){const r=this;let i=oit(t,n===!0);const a=i;for(;ait.call(r.occurrences,i);)r.occurrences[a]++,i=a+"-"+r.occurrences[a];return r.occurrences[i]=0,i}reset(){this.occurrences=Object.create(null)}}function oit(e,t){return typeof e!="string"?"":(t||(e=e.toLowerCase()),e.replace(iit,"").replace(/ /g,"-"))}function dde(e){const t=e.type==="element"?e.tagName.toLowerCase():"",n=t.length===2&&t.charCodeAt(0)===104?t.charCodeAt(1):0;return n>48&&n<55?n-48:void 0}const lit={},OQ=new sit;function uit(e){const n=(e||lit).prefix||"";return function(r){OQ.reset(),ia(r,"element",function(i){dde(i)&&!i.properties.id&&(i.properties.id=n+OQ.slug(fp(i)))})}}const fde=(function(e){if(e==null)return fit;if(typeof e=="string")return dit(e);if(typeof e=="object")return cit(e);if(typeof e=="function")return T8(e);throw new Error("Expected function, string, or array as `test`")});function cit(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=fde(e[n]);return T8(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function dit(e){return T8(t);function t(n){return n.tagName===e}}function T8(e){return t;function t(n,r,i){return!!(hit(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function fit(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function hit(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const RQ={type:"element",tagName:"span",properties:{className:["icon","icon-link"]},children:[]},pit={};function mit(e){const t=e||pit;let n=t.properties;const r=t.headingProperties,i=t.behavior||"prepend",a=t.content,s=t.group,o=fde(t.test);let l;return i==="after"||i==="before"?l=f:i==="wrap"?l=d:(l=u,n||(n={ariaHidden:"true",tabIndex:-1})),function(p){ia(p,"element",function(m,y,S){if(dde(m)&&m.properties.id&&o(m,y,S))return Object.assign(m.properties,Z_(r,m)),l(m,y,S)})};function u(p){const m=NQ(a||RQ,p);return p.children[i==="prepend"?"unshift":"push"](bI(p,Z_(n,p),m)),[tv]}function f(p,m,y){if(typeof m!="number"||!y)return;const S=NQ(a||RQ,p),g=bI(p,Z_(n,p),S);let _=i==="before"?[g,p]:[p,g];if(s){const v=hde(s,p);v&&!Array.isArray(v)&&v.type==="element"&&(v.children=_,_=[v])}return y.children.splice(m,1,..._),[tv,m+_.length]}function d(p){let m=p.children,y=[];return typeof a=="function"?(m=[],y=a(p)):a&&(y=C8(a)),p.children=[bI(p,Z_(n,p),Array.isArray(y)?[...m,...y]:[...m,y])],[tv]}}function C8(e){return Bf(e)}function bI(e,t,n){return{type:"element",tagName:"a",properties:{...t,href:"#"+e.properties.id},children:n}}function NQ(e,t){const n=hde(e,t);return Array.isArray(n)?n:[n]}function hde(e,t){return typeof e=="function"?e(t):C8(e)}function Z_(e,t){return typeof e=="function"?e(t):e?C8(e):{}}const git=(e={})=>{const{openDelimiter:t="rehype:ignore:start",closeDelimiter:n="rehype:ignore:end"}=e;return r=>{ia(r,(i,a,s)=>{if(i.type==="element"||i.type==="root"){let o=!1;i.children=i.children.filter(l=>{if(l.type==="raw"||l.type==="comment"){let u=(l.value||"").trim();if(u=u.replace(/^<!--(.*?)-->/,"$1"),u===t)return o=!0,!1;if(u===n)return o=!1,!1}return!o})}})}};var bit={type:"element",tagName:"svg",properties:{className:"octicon octicon-link",viewBox:"0 0 16 16",version:"1.1",width:"16",height:"16",ariaHidden:"true"},children:[{type:"element",tagName:"path",children:[],properties:{fillRule:"evenodd",d:"M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"}}]};function vit(e){return e===void 0&&(e=""),{type:"element",tagName:"div",properties:{class:"copied","data-code":e},children:[{type:"element",tagName:"svg",properties:{className:"octicon-copy",ariaHidden:"true",viewBox:"0 0 16 16",fill:"currentColor",height:12,width:12},children:[{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"},children:[]},{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"},children:[]}]},{type:"element",tagName:"svg",properties:{className:"octicon-check",ariaHidden:"true",viewBox:"0 0 16 16",fill:"currentColor",height:12,width:12},children:[{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"},children:[]}]}]}}var yit=(e,t)=>(n,r,i)=>{if(n.type==="element"&&i&&i.type==="root"&&/h(1|2|3|4|5|6)/.test(n.tagName)){var a=n.children&&n.children[0];a&&a.properties&&a.properties.ariaHidden==="true"&&(a.properties=ru({class:"anchor"},a.properties),a.children=[bit])}if(n.type==="element"&&n.tagName==="pre"&&!e){var s=Iue(n.children);n.children.push(vit(s))}t&&t(n,r===null?void 0:r,i===null?void 0:i)},_it=[uit,mit,git];const Eit=oe.forwardRef((e,t)=>{var n,r=[nit,yce,rit,..._it,[RKe,{rewrite:yit((n=e.disableCopy)!=null?n:!1,e.rehypeRewrite)}],[DKe,{properties:"attr"}],...e.rehypePlugins||[],[sqe,{ignoreMissing:!0}]];return b.jsx(tit,ru({},e,{rehypePlugins:r,ref:t}))});function Sit(e,t){if(e.startsWith("/")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"))return e;const n=t.includes("/")?t.substring(0,t.lastIndexOf("/")):"",r=n?n.split("/"):[],i=e.split("/");for(const a of i)a===".."?r.pop():a!=="."&&r.push(a);return r.join("/")}function xit(e,t,n){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("/api/"))return e;const r=Sit(e,n);return`/api/fs/image?${new URLSearchParams({path:r,root:t})}`}function wit({content:e,worktreePath:t,filePath:n}){const{resolvedTheme:r}=qc(),i=k.useMemo(()=>({img:({src:a,alt:s,...o})=>{if(!a)return null;const l=xit(a,t,n);return b.jsx("img",{src:l,alt:s||"",loading:"lazy",style:{maxWidth:"100%"},...o})},a:({href:a,children:s,...o})=>b.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",...o,children:s})}),[t,n]);return b.jsx(Yy,{className:"h-full",children:b.jsx("div",{className:"p-4","data-color-mode":r==="light"?"light":"dark",children:b.jsx(Eit,{source:e,style:{backgroundColor:"transparent",fontSize:"14px"},components:i})})})}const Tit=1e3,Cit=n0(function({onBack:t}){const{worktreePath:n,readOnly:r,selectedFile:i,currentFile:a,isLoading:s,isSaving:o,loadError:l,isDirty:u,updateContent:f,saveFile:d,closeFile:p,toggleMarkdownView:m}=oie(),y=k.useRef(null);k.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]);const S=k.useCallback(w=>{!i||r||(f(i,w),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{d(i).catch(C=>{console.error("Auto-save failed:",C)})},Tit))},[i,r,f,d]),g=k.useCallback(()=>{i&&(y.current&&(clearTimeout(y.current),y.current=null),p(i)),t?.()},[i,p,t]),_=k.useCallback(()=>{i&&m(i)},[i,m]);if(!i)return b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Select a file to view"});if(s)return b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Loading file..."});if(l)return b.jsx("div",{className:"flex h-full items-center justify-center text-destructive text-sm",children:l});if(!a)return b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Unable to load file"});if(a.isBinary)return b.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-muted-foreground text-sm gap-2",children:[b.jsx("p",{children:"Binary file"}),b.jsxs("p",{className:"text-xs",children:[(a.size/1024).toFixed(1)," KB"]})]});if(a.isImage)return b.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[b.jsxs("div",{className:"flex shrink-0 items-center justify-between px-2 py-1.5 bg-card border-b border-border text-xs",children:[b.jsx("span",{className:"text-muted-foreground truncate",title:i,children:i.split("/").pop()||i}),b.jsx("button",{onClick:g,className:"p-1 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:"Close file",children:b.jsx(fe,{icon:ci,size:14,strokeWidth:2})})]}),b.jsx("div",{className:"flex-1 overflow-auto p-4 bg-muted",children:b.jsx("img",{src:a.content,alt:i,className:"block mx-auto"})})]});const v=i.split("/").pop()||i,x=a.isMarkdown,T=x&&a.isMarkdownView;return b.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-3 px-2 py-1.5 bg-card border-b border-border text-xs",children:[b.jsxs("span",{className:"text-muted-foreground truncate flex-1 flex items-center gap-1",title:i,children:[v,!r&&u&&b.jsx("span",{className:"text-amber-500",children:"*"}),!r&&o&&b.jsx("span",{className:"text-muted-foreground italic",children:"(saving...)"})]}),a.truncated&&b.jsxs("span",{className:"text-destructive",children:["Truncated (",a.lineCount.toLocaleString()," lines)"]}),b.jsxs("span",{className:"text-muted-foreground",children:[(a.size/1024).toFixed(1)," KB"]}),x&&b.jsx("button",{onClick:_,className:Ue("p-1 rounded hover:bg-muted/50 transition-colors",T?"text-primary":"text-muted-foreground hover:text-foreground"),title:T?"Show code":"Preview markdown",children:b.jsx(fe,{icon:T?$1e:z1e,size:14,strokeWidth:2})}),b.jsx("button",{onClick:g,className:"p-1 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:"Close file",children:b.jsx(fe,{icon:ci,size:14,strokeWidth:2})})]}),b.jsx("div",{className:"flex-1 min-h-0",children:T?b.jsx(wit,{content:a.content,worktreePath:n||"",filePath:i}):b.jsx(uGe,{filePath:i,content:a.content,onChange:S,readOnly:r||!a.isEditable})})]})}),pde=k.createContext(void 0),Ait=n0(function(){const t=k.useContext(pde),{selectedFile:n,expandedDirs:r,fileTree:i,isLoadingTree:a,treeError:s,selectFile:o,loadFile:l,toggleDir:u,collapseAll:f}=oie(),d=k.useCallback(y=>{o(y),l(y),t?.(y)},[o,l,t]),p=k.useCallback(y=>{u(y)},[u]),m=k.useCallback(()=>{o(null),t?.(null)},[o,t]);return a?b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Loading files..."}):s?b.jsx("div",{className:"flex h-full items-center justify-center text-destructive text-sm",children:s}):n?b.jsx("div",{className:"flex h-full flex-col bg-background",children:b.jsx(Cit,{onBack:m})}):b.jsx(QWe,{entries:i||[],selectedFile:n,expandedDirs:r,onSelectFile:d,onToggleDir:p,onCollapseAll:f})});function _x({worktreePath:e,readOnly:t=!1,initialSelectedFile:n,onFileChange:r}){const i=M2e(e,t,n);return e?b.jsx(sie.Provider,{value:i,children:b.jsx(pde.Provider,{value:r,children:b.jsx(Ait,{})})}):b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"No worktree selected"})}const hP=Ms("/tasks/$taskId")({component:kit,validateSearch:e=>({tab:["diff","browser","files"].includes(e.tab)?e.tab:void 0,file:typeof e.file=="string"?e.file:void 0})}),Q_={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled"},IQ={IN_PROGRESS:"bg-status-in-progress/20 text-status-in-progress",IN_REVIEW:"bg-status-in-review/20 text-status-in-review",DONE:"bg-status-done/20 text-status-done",CANCELED:"bg-status-canceled/20 text-status-canceled"};function kit(){const{taskId:e}=hP.useParams(),t=hP.useSearch(),n=Wi(),r=ome(),{data:i,isLoading:a}=wne(e),s=NM(),o=IM(),{viewState:l,setActiveTab:u,setFilesViewState:f}=u5(e),d=Lie(),p=Pie(),m=Mie(),y=jie(),S=Fie(),{data:g}=DM(),{data:_}=LM(),{data:v}=PM(),{data:x}=Tne(),{data:T}=bWe(i?.linearTicketId??null),{data:w=[]}=Ky(),C=w.find(xe=>xe.path===i?.repoPath),R=r.state,O=i?.aiMode??R?.aiMode,N=i?.description??R?.description,[L,D]=k.useState(!1),[z,M]=k.useState(!1),[V,W]=k.useState(!0),[$,q]=k.useState("terminal"),Y=pw(),B=t.tab??l.activeTab,j=t.file??l.filesViewState.selectedFile,U=k.useRef(null);k.useEffect(()=>{U.current===e||t.tab||(U.current=e,l.activeTab&&n({to:"/tasks/$taskId",params:{taskId:e},search:{tab:l.activeTab==="diff"?void 0:l.activeTab,file:l.filesViewState.selectedFile||void 0},replace:!0}))},[e,t.tab,l.activeTab,l.filesViewState.selectedFile,n]);const K=k.useCallback(xe=>{const ve=xe;u(ve),n({to:"/tasks/$taskId",params:{taskId:e},search:{tab:ve==="diff"?void 0:ve,file:ve==="files"&&j||void 0},replace:!0})},[e,n,u,j]),H=k.useCallback(xe=>{f({selectedFile:xe}),n({to:"/tasks/$taskId",params:{taskId:e},search:{tab:"files",file:xe||void 0},replace:!0})},[e,n,f]),{terminals:J,sendInputToTerminal:se}=c5(),ae=J.find(xe=>i?.worktreePath&&xe.cwd.startsWith(i.worktreePath)),Q=xe=>{ae?(se(ae.id,xe),ln.info("Sent to Claude Code")):ln.error("No terminal available")},G=async()=>{if(!(!i?.repoPath||!i?.worktreePath))try{await d.mutateAsync({repoPath:i.repoPath,worktreePath:i.worktreePath,baseBranch:i.baseBranch}),ln.success("Synced from main")}catch(xe){const ve=xe instanceof Error?xe.message:"Sync failed",De=i.baseBranch||"main";ln.error(ve,{action:ae?{label:"Resolve with Claude",onClick:()=>Q(`Rebase this worktree onto the parent repo's ${De} branch. Error: "${ve}". Steps: 1) Check for uncommitted changes - stash or commit them first, 2) git fetch origin (in parent repo at ${i.repoPath}) to ensure ${De} is current, 3) git rebase ${De} (in worktree), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) If stashed, git stash pop. Worktree: ${i.worktreePath}, Parent repo: ${i.repoPath}.`)}:void 0})}},Z=async()=>{if(!(!i?.repoPath||!i?.worktreePath))try{await p.mutateAsync({repoPath:i.repoPath,worktreePath:i.worktreePath,baseBranch:i.baseBranch}),ln.success("Merged to main"),S.mutate(i.id),s.mutate({taskId:i.id,updates:{status:"DONE"}})}catch(xe){const ve=xe instanceof Error?xe.message:"Merge failed",De=i.baseBranch||"main";ln.error(ve,{action:ae?{label:"Resolve with Claude",onClick:()=>Q(`Merge this worktree's branch into the parent repo's ${De}. Error: "${ve}". Steps: 1) Ensure all changes in worktree are committed, 2) In parent repo at ${i.repoPath}, checkout ${De} and pull latest from origin, 3) Squash merge the worktree branch into ${De} (use git merge --squash, then commit), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Push ${De} to origin. Worktree: ${i.worktreePath}, Parent repo: ${i.repoPath}.`)}:void 0})}},ee=async()=>{if(i?.worktreePath)try{await m.mutateAsync({worktreePath:i.worktreePath}),ln.success("Pushed to origin")}catch(xe){const ve=xe instanceof Error?xe.message:"Push failed";ln.error(ve,{action:ae?{label:"Resolve with Claude",onClick:()=>Q(`Push this worktree's branch to origin. Error: "${ve}". Steps: 1) Check for uncommitted changes and commit them, 2) If push is rejected, pull the latest changes first and resolve any conflicts, 3) Push to origin again. Worktree: ${i.worktreePath}.`)}:void 0})}},ne=async()=>{if(i?.repoPath)try{await y.mutateAsync({repoPath:i.repoPath,baseBranch:i.baseBranch}),ln.success("Parent synced with origin")}catch(xe){const ve=xe instanceof Error?xe.message:"Sync parent failed",De=i.baseBranch||"main";ln.error(ve,{action:ae?{label:"Resolve with Claude",onClick:()=>Q(`Sync the parent repo's ${De} branch with origin. Error: "${ve}". Steps: 1) git fetch origin, 2) git pull origin ${De} --ff-only, 3) If that fails, rebase with git rebase origin/${De}, 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Once in sync, git push origin ${De}. Work in the parent repo at ${i.repoPath}, not the worktree.`)}:void 0})}},te=()=>{ae&&se(ae.id,"commit")},be=()=>{ae&&se(ae.id,"Create a PR for this task and link it using: vibora current-task pr <url>")},_e=()=>{if(!i?.worktreePath)return;const xe=sae(i.worktreePath,g,_,v);oae(xe)},he=xe=>{i&&s.mutate({taskId:i.id,updates:{status:xe}})},ye=()=>{i&&o.mutate({taskId:i.id,deleteLinkedWorktree:V},{onSuccess:()=>{n({to:"/tasks"})}})},Ee=xe=>{M(xe),xe||W(!1)};return a?b.jsx("div",{className:"flex h-full items-center justify-center",children:b.jsx("p",{className:"text-muted-foreground",children:"Loading task..."})}):i?b.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[b.jsxs("div",{className:"shrink-0 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:i.title}),b.jsxs(uE,{children:[b.jsx(cE,{render:b.jsx("button",{type:"button",className:`rounded-full px-2 py-0.5 text-xs font-medium ${IQ[i.status]}`}),children:Q_[i.status]}),b.jsx(dE,{align:"end",children:b.jsx(hH,{value:i.status,onValueChange:he,children:Object.entries(Q_).map(([xe,ve])=>b.jsx(pH,{value:xe,children:ve},xe))})})]}),b.jsxs(uE,{children:[b.jsx(cE,{render:b.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),children:b.jsx(fe,{icon:ute,size:16,strokeWidth:2})}),b.jsxs(dE,{align:"end",children:[b.jsxs(eo,{onClick:G,disabled:d.isPending||!i.worktreePath,children:[b.jsx(fe,{icon:HE,size:14,strokeWidth:2}),"Pull from main"]}),b.jsxs(eo,{onClick:Z,disabled:p.isPending||!i.worktreePath,children:[b.jsx(fe,{icon:zE,size:14,strokeWidth:2}),"Merge to main"]}),b.jsxs(eo,{onClick:ee,disabled:m.isPending||!i.worktreePath,children:[b.jsx(fe,{icon:WE,size:14,strokeWidth:2}),"Push to origin"]}),b.jsxs(eo,{onClick:ne,disabled:y.isPending||!i.repoPath,children:[b.jsx(fe,{icon:GE,size:14,strokeWidth:2}),"Sync parent"]}),b.jsxs(eo,{onClick:te,disabled:!ae,children:[b.jsx(fe,{icon:VE,size:14,strokeWidth:2}),"Commit"]}),!i.prUrl&&b.jsxs(eo,{onClick:be,disabled:!ae,children:[b.jsx(fe,{icon:Ub,size:14,strokeWidth:2}),"Create PR"]})]})]}),b.jsxs(go,{open:z,onOpenChange:Ee,children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive"}),children:b.jsx(fe,{icon:$c,size:16,strokeWidth:2})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:"Delete Task"}),b.jsxs(So,{children:['This will permanently delete "',i.title,'" and close its terminal.',V&&i.worktreePath&&" The linked worktree will also be removed."," ","This action cannot be undone."]}),i.worktreePath&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:V,onCheckedChange:xe=>W(xe===!0),disabled:o.isPending}),"Also delete linked worktree"]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:o.isPending,children:"Cancel"}),b.jsx(Rv,{onClick:ye,variant:"destructive",disabled:o.isPending,children:o.isPending?"Deleting...":"Delete"})]})]})]})]}),b.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[b.jsx("button",{type:"button",className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>D(!0),title:"Task settings",children:b.jsx(fe,{icon:XI,size:14,strokeWidth:2})}),C?b.jsxs(wi,{to:"/repositories/$repoId",params:{repoId:C.id},className:"flex items-center gap-1 hover:text-foreground transition-colors",children:[b.jsx(fe,{icon:np,size:12,strokeWidth:2}),b.jsx("span",{children:i.repoName})]}):b.jsxs("span",{className:"flex items-center gap-1",children:[b.jsx(fe,{icon:np,size:12,strokeWidth:2}),b.jsx("span",{children:i.repoName})]}),b.jsx("div",{className:"ml-auto",children:b.jsx(Vb,{worktreePath:i.worktreePath})})]})]}),b.jsxs("div",{className:"hidden items-center gap-3 sm:flex",children:[b.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("h1",{className:"text-sm font-medium",children:i.title}),b.jsx("button",{type:"button",className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>D(!0),title:"Task settings",children:b.jsx(fe,{icon:XI,size:14,strokeWidth:2})})]}),b.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[C?b.jsxs(wi,{to:"/repositories/$repoId",params:{repoId:C.id},className:"flex items-center gap-1 hover:text-foreground transition-colors",children:[b.jsx(fe,{icon:np,size:12,strokeWidth:2}),b.jsx("span",{children:i.repoName})]}):b.jsxs("span",{className:"flex items-center gap-1",children:[b.jsx(fe,{icon:np,size:12,strokeWidth:2}),b.jsx("span",{children:i.repoName})]}),b.jsx(fe,{icon:Vx,size:12,strokeWidth:2}),b.jsx("span",{className:"font-mono",children:i.branch}),i.prUrl&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/50",children:"•"}),b.jsxs("a",{href:i.prUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-foreground hover:text-primary font-medium",onClick:xe=>xe.stopPropagation(),children:[b.jsx(fe,{icon:Ub,size:14,strokeWidth:2}),b.jsxs("span",{children:["#",i.prUrl.match(/\/pull\/(\d+)/)?.[1]??"PR"]})]})]}),i.linearTicketUrl&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/50",children:"•"}),b.jsxs("a",{href:T?.url??i.linearTicketUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-foreground hover:text-primary font-medium",onClick:xe=>xe.stopPropagation(),title:T?.title,children:[b.jsx(fe,{icon:hM,size:14,strokeWidth:2}),b.jsx("span",{children:i.linearTicketId}),T?.status&&b.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",T.status,")"]})]})]})]})]}),b.jsxs(uE,{children:[b.jsx(cE,{render:b.jsx("button",{type:"button",className:`rounded-full px-2 py-0.5 text-xs font-medium ${IQ[i.status]}`}),children:Q_[i.status]}),b.jsx(dE,{align:"end",children:b.jsx(hH,{value:i.status,onValueChange:he,children:Object.entries(Q_).map(([xe,ve])=>b.jsx(pH,{value:xe,children:ve},xe))})})]}),b.jsxs("div",{className:"flex items-center gap-0",children:[b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:G,disabled:d.isPending||!i.worktreePath,className:"text-muted-foreground hover:text-foreground",title:"Pull from main",children:b.jsx(fe,{icon:HE,size:16,strokeWidth:2,className:d.isPending?"animate-spin":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:Z,disabled:p.isPending||!i.worktreePath,className:"text-muted-foreground hover:text-foreground",title:"Merge to main",children:b.jsx(fe,{icon:zE,size:16,strokeWidth:2,className:p.isPending?"animate-pulse":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:ee,disabled:m.isPending||!i.worktreePath,className:"text-muted-foreground hover:text-foreground",title:"Push to origin",children:b.jsx(fe,{icon:WE,size:16,strokeWidth:2,className:m.isPending?"animate-pulse":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:ne,disabled:y.isPending||!i.repoPath,className:"text-muted-foreground hover:text-foreground",title:"Sync parent with origin",children:b.jsx(fe,{icon:GE,size:16,strokeWidth:2,className:y.isPending?"animate-spin":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:te,disabled:!ae,className:"text-muted-foreground hover:text-foreground",title:"Commit",children:b.jsx(fe,{icon:VE,size:16,strokeWidth:2})}),!i.prUrl&&b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:be,disabled:!ae,className:"text-muted-foreground hover:text-foreground",title:"Create Pull Request",children:b.jsx(fe,{icon:Ub,size:16,strokeWidth:2})}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:_e,disabled:!i.worktreePath,className:"text-muted-foreground hover:text-foreground",title:"Open in editor",children:b.jsx(fe,{icon:fte,size:16,strokeWidth:2})})]}),b.jsxs(go,{open:z,onOpenChange:Ee,children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive"}),children:b.jsx(fe,{icon:$c,size:16,strokeWidth:2})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:"Delete Task"}),b.jsxs(So,{children:['This will permanently delete "',i.title,'" and close its terminal.',V&&i.worktreePath&&" The linked worktree will also be removed."," ","This action cannot be undone."]}),i.worktreePath&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:V,onCheckedChange:xe=>W(xe===!0),disabled:o.isPending}),"Also delete linked worktree"]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:o.isPending,children:"Cancel"}),b.jsx(Rv,{onClick:ye,variant:"destructive",disabled:o.isPending,children:o.isPending?"Deleting...":"Delete"})]})]})]})]})]}),Y?b.jsxs(su,{value:$,onValueChange:xe=>q(xe),className:"flex min-h-0 flex-1 flex-col",children:[b.jsx("div",{className:"shrink-0 border-b border-border px-2 py-1",children:b.jsxs(ou,{className:"w-full",children:[b.jsx(li,{value:"terminal",className:"flex-1",children:"Terminal"}),b.jsx(li,{value:"details",className:"flex-1",children:"Details"})]})}),b.jsx(Pi,{value:"terminal",className:"flex-1 min-h-0",children:b.jsx($X,{taskName:i.title,cwd:i.worktreePath,aiMode:O,description:N,startupScript:i.startupScript,serverPort:x})}),b.jsx(Pi,{value:"details",className:"flex-1 min-h-0 bg-background",children:b.jsxs(su,{value:B,onValueChange:K,className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex items-center justify-between shrink-0 border-b border-border bg-background px-2 py-1",children:[b.jsxs(ou,{variant:"line",children:[b.jsxs(li,{value:"diff",children:[b.jsx(fe,{icon:Q$,size:14,strokeWidth:2,"data-slot":"icon"}),"Diff"]}),b.jsxs(li,{value:"browser",children:[b.jsx(fe,{icon:KI,size:14,strokeWidth:2,"data-slot":"icon"}),"Browser"]}),b.jsxs(li,{value:"files",children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2,"data-slot":"icon"}),"Files"]})]}),b.jsx(Vb,{worktreePath:i.worktreePath})]}),b.jsx(Pi,{value:"diff",className:"flex-1 overflow-hidden",children:b.jsx(HX,{taskId:i.id,worktreePath:i.worktreePath})}),b.jsx(Pi,{value:"browser",className:"flex-1 overflow-hidden",children:b.jsx(WX,{taskId:i.id})}),b.jsx(Pi,{value:"files",className:"flex-1 overflow-hidden",children:b.jsx(_x,{worktreePath:i.worktreePath,initialSelectedFile:j,onFileChange:H})})]})})]}):b.jsxs(Vd,{direction:"horizontal",className:"min-h-0 flex-1",children:[b.jsx(Ss,{defaultSize:50,minSize:30,children:b.jsx($X,{taskName:i.title,cwd:i.worktreePath,aiMode:O,description:N,startupScript:i.startupScript,serverPort:x})}),b.jsx(Gd,{withHandle:!0}),b.jsx(Ss,{defaultSize:50,minSize:30,className:"bg-background",children:b.jsxs(su,{value:B,onValueChange:K,className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex items-center justify-between shrink-0 border-b border-border bg-background px-2 py-1",children:[b.jsxs(ou,{variant:"line",children:[b.jsxs(li,{value:"diff",children:[b.jsx(fe,{icon:Q$,size:14,strokeWidth:2,"data-slot":"icon"}),"Diff"]}),b.jsxs(li,{value:"browser",children:[b.jsx(fe,{icon:KI,size:14,strokeWidth:2,"data-slot":"icon"}),"Browser"]}),b.jsxs(li,{value:"files",children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2,"data-slot":"icon"}),"Files"]})]}),b.jsx(Vb,{worktreePath:i.worktreePath})]}),b.jsx(Pi,{value:"diff",className:"flex-1 overflow-hidden",children:b.jsx(HX,{taskId:i.id,worktreePath:i.worktreePath})}),b.jsx(Pi,{value:"browser",className:"flex-1 overflow-hidden",children:b.jsx(WX,{taskId:i.id})}),b.jsx(Pi,{value:"files",className:"flex-1 overflow-hidden",children:b.jsx(_x,{worktreePath:i.worktreePath,initialSelectedFile:j,onFileChange:H})})]})})]}),b.jsx(rae,{task:i,open:L,onOpenChange:D})]}):b.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4",children:[b.jsx("p",{className:"text-muted-foreground",children:"Task not found"}),b.jsx(wi,{to:"/tasks",children:b.jsx(Ke,{variant:"outline",children:"Back to Tasks"})})]})}function Oit(e){const t=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return t?`https://${t[1]}/${t[2]}`:e.replace(/\.git$/,"")}function Rit(e){return qn({queryKey:["git-remote",e],queryFn:async()=>{if(!e)return null;const t=await fetch(`/api/git/remote?path=${encodeURIComponent(e)}`);return t.ok?(await t.json()).remoteUrl:null},enabled:!!e,staleTime:60*1e3})}function Nit(){const{repoId:e}=pP.useParams(),{tab:t,file:n}=pP.useSearch(),r=Wi(),{data:i,isLoading:a,error:s}=uwe(e),o=dwe(),l=One(),{data:u}=Rit(i?.path),[f,d]=k.useState(""),[p,m]=k.useState(""),[y,S]=k.useState(""),[g,_]=k.useState(!1),[v,x]=k.useState(!1),[T,w]=k.useState(!1),[C,R]=k.useState("terminal"),[O,N]=k.useState(null),[L,D]=k.useState(!1),[z,M]=k.useState(!1),[V,W]=k.useState(!1),$=k.useRef(null),q=k.useRef(null),Y=k.useRef(!1),B=k.useRef(!1),{terminals:j,terminalsLoaded:U,connected:K,createTerminal:H,attachXterm:J,resizeTerminal:se,setupImagePaste:ae,writeToTerminal:Q}=c5(),G=t||"settings",Z=pw();k.useEffect(()=>{kt.repoTerminal.info("component mounted",{repoId:e,tab:t,activeTab:G})},[e,t,G]),k.useEffect(()=>{kt.repoTerminal.debug("state changed",{terminalId:O,xtermReady:z,containerReady:V,connected:K,terminalsLoaded:U,terminalCount:j.length,repoPath:i?.path})},[O,z,V,K,U,j.length,i?.path]);const ee=k.useCallback(xe=>{r({to:"/repositories/$repoId",params:{repoId:e},search:xe==="settings"?{}:{tab:xe,file:n},replace:!0})},[r,e,n]),ne=k.useCallback(xe=>{r({to:"/repositories/$repoId",params:{repoId:e},search:{tab:"workspace",file:xe??void 0},replace:!0})},[r,e]);k.useEffect(()=>{i&&(d(i.displayName),m(i.startupScript||""),S(i.copyFiles||""),_(i.isCopierTemplate??!1),x(!1))},[i]),k.useEffect(()=>{if(i){const xe=f!==i.displayName||p!==(i.startupScript||"")||y!==(i.copyFiles||"")||g!==(i.isCopierTemplate??!1);x(xe)}},[f,p,y,g,i]);const te=()=>{i&&o.mutate({id:i.id,updates:{displayName:f.trim()||i.path.split("/").pop()||"repo",startupScript:p.trim()||null,copyFiles:y.trim()||null,isCopierTemplate:g}},{onSuccess:()=>{ln.success("Repository saved"),x(!1)},onError:xe=>{ln.error("Failed to save repository",{description:xe instanceof Error?xe.message:"Unknown error"})}})},be=async()=>{i&&(await l.mutateAsync(i.id),r({to:"/repositories"}))};k.useEffect(()=>{Y.current=!1,B.current=!1,N(null),D(!1)},[i?.path]),k.useEffect(()=>{if(!K||!i?.path||!U||G!=="workspace"||!z){kt.repoTerminal.debug("find/create: waiting",{connected:K,path:i?.path,terminalsLoaded:U,activeTab:G,xtermReady:z});return}const xe=j.find(ve=>ve.cwd===i.path);if(xe){kt.repoTerminal.info("found existing terminal",{id:xe.id,cwd:xe.cwd}),N(xe.id);return}if(!Y.current&&$.current){Y.current=!0,D(!0);const{cols:ve,rows:De}=$.current;kt.repoTerminal.info("creating terminal",{name:i.displayName,cwd:i.path,cols:ve,rows:De}),H({name:i.displayName,cols:ve,rows:De,cwd:i.path})}},[K,i?.path,i?.displayName,U,j,G,H,z]),k.useEffect(()=>{if(!i?.path)return;const xe=j.find(De=>De.cwd===i.path);if(!xe)return;const ve=O&&j.some(De=>De.id===O);(!O||!ve)&&(N(xe.id),D(!1),O&&!ve&&(B.current=!1))},[j,i?.path,O]);const _e=k.useCallback(xe=>{kt.repoTerminal.info("xterm ready"),$.current=xe,M(!0)},[]),he=k.useCallback((xe,ve)=>{O&&se(O,xe,ve)},[O,se]),ye=k.useCallback(xe=>{kt.repoTerminal.info("container ready"),q.current=xe,W(!0)},[]),Ee=k.useCallback(xe=>{O&&Q(O,xe)},[O,Q]);return k.useEffect(()=>{if(!O||!z||!V){kt.repoTerminal.debug("attach effect: waiting",{terminalId:O,xtermReady:z,containerReady:V});return}if(!$.current||!q.current){kt.repoTerminal.warn("attach effect: refs not set despite ready states",{terminalId:O});return}if(B.current){kt.repoTerminal.debug("attach effect: already attached",{terminalId:O});return}return kt.repoTerminal.info("attaching terminal",{terminalId:O}),J(O,$.current),ae(q.current,O),B.current=!0,()=>{kt.repoTerminal.debug("detaching terminal",{terminalId:O}),B.current=!1}},[O,z,V,J,ae]),a?b.jsx("div",{className:"flex h-full items-center justify-center",children:b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}):s||!i?b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:b.jsxs(wi,{to:"/repositories",className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:ete,size:16,strokeWidth:2}),"Repositories"]})}),b.jsx("div",{className:"flex flex-1 items-center justify-center",children:b.jsxs("div",{className:"flex items-center gap-3 text-destructive",children:[b.jsx(fe,{icon:ts,size:20,strokeWidth:2}),b.jsx("span",{className:"text-sm",children:"Repository not found"})]})})]}):b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs(Ke,{variant:"ghost",size:"sm",onClick:()=>w(!0),className:"text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:pM,size:16,strokeWidth:2,"data-slot":"icon",className:"-translate-y-px"}),b.jsx("span",{className:"max-sm:hidden",children:"New Task"})]}),b.jsxs(Ke,{variant:"ghost",size:"sm",onClick:()=>r({to:"/tasks",search:{repo:i.displayName}}),className:"text-muted-foreground hover:text-foreground",title:"View Tasks",children:[b.jsx(fe,{icon:Dp,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:"Tasks"})]})]}),b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx(Vb,{worktreePath:i.path}),b.jsx("span",{className:"text-sm font-medium",children:i.displayName}),u&&b.jsx("a",{href:Oit(u),target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors",title:u,children:b.jsx(fe,{icon:u.includes("github.com")?N1e:ote,size:14,strokeWidth:2})}),b.jsxs(go,{children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-destructive"}),children:b.jsx(fe,{icon:$c,size:14,strokeWidth:2})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:"Delete Repository"}),b.jsxs(So,{children:['This will remove "',i.displayName,'" from Vibora. The actual repository files will not be affected.']})]}),b.jsxs(_o,{children:[b.jsx(xo,{children:"Cancel"}),b.jsx(Ke,{variant:"destructive",onClick:be,children:"Delete"})]})]})]})]})]}),b.jsxs(su,{value:G,onValueChange:xe=>ee(xe),className:"flex flex-1 flex-col overflow-hidden",children:[b.jsx("div",{className:"shrink-0 border-b border-border bg-muted/50 px-4",children:b.jsxs(ou,{variant:"line",children:[b.jsx(li,{value:"settings",className:"px-3 py-1.5",children:"Settings"}),b.jsx(li,{value:"workspace",className:"px-3 py-1.5",children:"Workspace"})]})}),b.jsx(Pi,{value:"settings",className:"flex-1 overflow-hidden mt-0",children:b.jsx(Yy,{className:"h-full",children:b.jsx("div",{className:"p-4",children:b.jsxs("div",{className:"mx-auto max-w-xl space-y-6 bg-card rounded-lg p-6 border border-border",children:[b.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2}),b.jsx("span",{className:"font-mono break-all",children:i.path})]}),b.jsxs(pf,{children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"displayName",children:"Display Name"}),b.jsx(vn,{id:"displayName",value:f,onChange:xe=>d(xe.target.value),placeholder:i.path.split("/").pop()||"My Project"})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"startupScript",children:"Startup Script"}),b.jsx(bM,{id:"startupScript",value:p,onChange:xe=>m(xe.target.value),placeholder:"npm install && npm run dev",rows:3}),b.jsx(qa,{children:"Command to run in the terminal when creating a worktree."})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"copyFiles",children:"Copy Files"}),b.jsx(vn,{id:"copyFiles",value:y,onChange:xe=>S(xe.target.value),placeholder:".env, config.local.json"}),b.jsx(qa,{children:"Comma-separated glob patterns for files to copy into new worktrees."})]}),b.jsxs(ir,{children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Ti,{checked:g,onCheckedChange:xe=>_(xe===!0)}),b.jsx(ar,{className:"cursor-pointer",children:"Use as Copier Template"})]}),b.jsx(qa,{children:"Mark as a template for creating new projects with Copier."})]})]}),b.jsx("div",{className:"flex items-center justify-end pt-4 border-t border-border",children:b.jsxs(Ke,{size:"sm",onClick:te,disabled:!v||o.isPending,children:[b.jsx(fe,{icon:hl,size:14,strokeWidth:2,"data-slot":"icon"}),o.isPending?"Saving...":"Save"]})})]})})})}),b.jsx(Pi,{value:"workspace",className:"flex-1 overflow-hidden mt-0",children:Z?b.jsxs(su,{value:C,onValueChange:xe=>R(xe),className:"flex min-h-0 flex-1 flex-col h-full",children:[b.jsx("div",{className:"shrink-0 border-b border-border px-2 py-1",children:b.jsxs(ou,{className:"w-full",children:[b.jsx(li,{value:"terminal",className:"flex-1",children:"Terminal"}),b.jsx(li,{value:"files",className:"flex-1",children:"Files"})]})}),b.jsx(Pi,{value:"terminal",className:"flex-1 min-h-0",children:b.jsxs("div",{className:"h-full flex flex-col",children:[!K&&b.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:"Connecting to terminal server..."}),L&&!O&&b.jsx("div",{className:"flex-1 flex items-center justify-center bg-terminal-background",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"}),b.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:"Initializing terminal..."})]})}),b.jsx(vD,{className:"flex-1",onReady:_e,onResize:he,onContainerReady:ye,terminalId:O??void 0,setupImagePaste:ae,onSend:Ee})]})}),b.jsx(Pi,{value:"files",className:"flex-1 min-h-0",children:b.jsx(_x,{worktreePath:i.path,initialSelectedFile:n,onFileChange:ne})})]}):b.jsxs(Vd,{direction:"horizontal",className:"h-full",children:[b.jsx(Ss,{defaultSize:50,minSize:30,children:b.jsxs("div",{className:"h-full flex flex-col",children:[!K&&b.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:"Connecting to terminal server..."}),L&&!O&&b.jsx("div",{className:"flex-1 flex items-center justify-center bg-terminal-background",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"}),b.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:"Initializing terminal..."})]})}),b.jsx(vD,{className:"flex-1",onReady:_e,onResize:he,onContainerReady:ye,terminalId:O??void 0,setupImagePaste:ae,onSend:Ee})]})}),b.jsx(Gd,{withHandle:!0}),b.jsx(Ss,{defaultSize:50,minSize:30,children:b.jsx(_x,{worktreePath:i.path,initialSelectedFile:n,onFileChange:ne})})]})})]}),b.jsx(MM,{open:T,onOpenChange:w,defaultRepository:i,showTrigger:!1})]})}const pP=Ms("/repositories/$repoId")({component:Nit,validateSearch:e=>({tab:e.tab==="workspace"?"workspace":void 0,file:typeof e.file=="string"?e.file:void 0})}),Iit=gRe.update({id:"/",path:"/",getParentRoute:()=>Oo}),Dit=SRe.update({id:"/worktrees/",path:"/worktrees/",getParentRoute:()=>Oo}),Lit=mIe.update({id:"/terminals/",path:"/terminals/",getParentRoute:()=>Oo}),Pit=aae.update({id:"/tasks/",path:"/tasks/",getParentRoute:()=>Oo}),Mit=RIe.update({id:"/settings/",path:"/settings/",getParentRoute:()=>Oo}),jit=UIe.update({id:"/review/",path:"/review/",getParentRoute:()=>Oo}),Fit=rDe.update({id:"/repositories/",path:"/repositories/",getParentRoute:()=>Oo}),Bit=Dle.update({id:"/monitoring/",path:"/monitoring/",getParentRoute:()=>Oo}),Uit=hP.update({id:"/tasks/$taskId",path:"/tasks/$taskId",getParentRoute:()=>Oo}),$it=pP.update({id:"/repositories/$repoId",path:"/repositories/$repoId",getParentRoute:()=>Oo}),zit={IndexRoute:Iit,RepositoriesRepoIdRoute:$it,TasksTaskIdRoute:Uit,MonitoringIndexRoute:Bit,RepositoriesIndexRoute:Fit,ReviewIndexRoute:jit,SettingsIndexRoute:Mit,TasksIndexRoute:Pit,TerminalsIndexRoute:Lit,WorktreesIndexRoute:Dit},Hit=Oo._addFileChildren(zit)._addFileTypes(),Wit=new URLSearchParams(window.location.search),of=parseFloat(Wit.get("zoom")||"1");of!==1&&of>=.5&&of<=2&&(document.documentElement.style.fontSize=`${16*of}px`);const vc=of>=.5&&of<=2?of:1,Vit=new Rme({defaultOptions:{queries:{staleTime:1e3*60,refetchOnWindowFocus:!1}}}),Git=rme({routeTree:Hit});Che.createRoot(document.getElementById("root")).render(b.jsx(k.StrictMode,{children:b.jsx(Gme,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:b.jsx(Nme,{client:Vit,children:b.jsx(B2e,{children:b.jsx(sme,{router:Git})})})})}));
165
+ `))){const S=[];f.children.forEach((g,_)=>{_!=0&&(_==1&&g.type==="break"||S.push(g))}),f.children=[...S]}}return f});s&&(r.data={hName:t,hProperties:{class:`markdown-alert markdown-alert-${s}`,dir:"auto"}},u.unshift({type:"paragraph",children:[Yrt(s),{type:"text",value:o.replace(/^\//,"")}],data:{hProperties:{class:"markdown-alert-title",dir:"auto"}}})),r.children=[...u]})};function Yrt(e){let t=Xrt[e]??"";return{type:"emphasis",data:{hName:"svg",hProperties:{class:"octicon",viewBox:"0 0 16 16",width:"16",height:"16",ariaHidden:"true"}},children:[{type:"emphasis",data:{hName:"path",hProperties:{d:t}},children:[]}]}}const Xrt={note:"M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z",tip:"M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z",important:"M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",warning:"M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",caution:"M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z"};function Zrt(e,t){if(typeof document>"u")return;const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly",""),n.style={position:"absolute",left:"-9999px"},document.body.appendChild(n);const r=document.getSelection().rangeCount>0?document.getSelection().getRangeAt(0):!1;n.select();let i=!1;try{i=!!document.execCommand("copy")}catch{i=!1}document.body.removeChild(n),r&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(r)),t&&t(i)}function cde(e){if(!e)return null;var t=e;return t.dataset.code&&t.classList.contains("copied")?t:t.parentElement?cde(t.parentElement):null}function Qrt(e){var t=n=>{var r=cde(n.target);r&&(r.classList.add("active"),Zrt(r.dataset.code,function(){setTimeout(()=>{r.classList.remove("active")},2e3)}))};k.useEffect(()=>{var n,r;return(n=e.current)==null||n.removeEventListener("click",t,!1),(r=e.current)==null||r.addEventListener("click",t,!1),()=>{var i;(i=e.current)==null||i.removeEventListener("click",t,!1)}},[e])}var Jrt=["prefixCls","className","source","style","disableCopy","skipHtml","onScroll","onMouseOver","pluginsFilter","rehypeRewrite","wrapperElement","warpperElement","urlTransform"],eit=e=>e;const tit=oe.forwardRef((e,t)=>{var{prefixCls:n="wmde-markdown wmde-markdown-color",className:r,source:i,style:a,disableCopy:s=!1,skipHtml:o=!0,onScroll:l,onMouseOver:u,pluginsFilter:f,wrapperElement:d={},warpperElement:p={},urlTransform:m}=e,y=s9e(e,Jrt),S=oe.useRef(null);k.useImperativeHandle(t,()=>ru({},e,{mdp:S}),[S,e]);var g=(n||"")+" "+(r||"");Qrt(S);var _=[...y.rehypePlugins||[]],v={allowElement:(w,C,R)=>y.allowElement?y.allowElement(w,C,R):/^[A-Za-z0-9]+$/.test(w.tagName)};o||_.push(yce);var x=[Krt,...y.remarkPlugins||[],Vrt],T=ru({},p,d);return b.jsx("div",ru({ref:S,onScroll:l,onMouseOver:u},T,{className:g,style:a,children:b.jsx(Ptt,ru({},v,y,{skipHtml:!o,urlTransform:m||eit,rehypePlugins:f?f("rehype",_):_,remarkPlugins:f?f("remark",x):x,children:i||""}))}))});var nit=function(t){return n=>{ia(n,r=>{r.type==="element"&&r.tagName==="code"&&r.data&&r.data.meta&&(r.properties=ru({},r.properties,{"data-meta":String(r.data.meta)}))})}},rit=function(t){return n=>{ia(n,r=>{if(r.type==="element"&&r.tagName==="code"&&r.properties&&r.properties.dataMeta){r.data||(r.data={});var i=r.properties.dataMeta;typeof i=="string"&&(r.data.meta=i),delete r.properties.dataMeta}})}};const iit=/[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g,ait=Object.hasOwnProperty;class sit{constructor(){this.occurrences,this.reset()}slug(t,n){const r=this;let i=oit(t,n===!0);const a=i;for(;ait.call(r.occurrences,i);)r.occurrences[a]++,i=a+"-"+r.occurrences[a];return r.occurrences[i]=0,i}reset(){this.occurrences=Object.create(null)}}function oit(e,t){return typeof e!="string"?"":(t||(e=e.toLowerCase()),e.replace(iit,"").replace(/ /g,"-"))}function dde(e){const t=e.type==="element"?e.tagName.toLowerCase():"",n=t.length===2&&t.charCodeAt(0)===104?t.charCodeAt(1):0;return n>48&&n<55?n-48:void 0}const lit={},OQ=new sit;function uit(e){const n=(e||lit).prefix||"";return function(r){OQ.reset(),ia(r,"element",function(i){dde(i)&&!i.properties.id&&(i.properties.id=n+OQ.slug(fp(i)))})}}const fde=(function(e){if(e==null)return fit;if(typeof e=="string")return dit(e);if(typeof e=="object")return cit(e);if(typeof e=="function")return T8(e);throw new Error("Expected function, string, or array as `test`")});function cit(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=fde(e[n]);return T8(r);function r(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function dit(e){return T8(t);function t(n){return n.tagName===e}}function T8(e){return t;function t(n,r,i){return!!(hit(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function fit(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="element"&&"tagName"in e&&typeof e.tagName=="string")}function hit(e){return e!==null&&typeof e=="object"&&"type"in e&&"tagName"in e}const RQ={type:"element",tagName:"span",properties:{className:["icon","icon-link"]},children:[]},pit={};function mit(e){const t=e||pit;let n=t.properties;const r=t.headingProperties,i=t.behavior||"prepend",a=t.content,s=t.group,o=fde(t.test);let l;return i==="after"||i==="before"?l=f:i==="wrap"?l=d:(l=u,n||(n={ariaHidden:"true",tabIndex:-1})),function(p){ia(p,"element",function(m,y,S){if(dde(m)&&m.properties.id&&o(m,y,S))return Object.assign(m.properties,Z_(r,m)),l(m,y,S)})};function u(p){const m=NQ(a||RQ,p);return p.children[i==="prepend"?"unshift":"push"](bI(p,Z_(n,p),m)),[tv]}function f(p,m,y){if(typeof m!="number"||!y)return;const S=NQ(a||RQ,p),g=bI(p,Z_(n,p),S);let _=i==="before"?[g,p]:[p,g];if(s){const v=hde(s,p);v&&!Array.isArray(v)&&v.type==="element"&&(v.children=_,_=[v])}return y.children.splice(m,1,..._),[tv,m+_.length]}function d(p){let m=p.children,y=[];return typeof a=="function"?(m=[],y=a(p)):a&&(y=C8(a)),p.children=[bI(p,Z_(n,p),Array.isArray(y)?[...m,...y]:[...m,y])],[tv]}}function C8(e){return Bf(e)}function bI(e,t,n){return{type:"element",tagName:"a",properties:{...t,href:"#"+e.properties.id},children:n}}function NQ(e,t){const n=hde(e,t);return Array.isArray(n)?n:[n]}function hde(e,t){return typeof e=="function"?e(t):C8(e)}function Z_(e,t){return typeof e=="function"?e(t):e?C8(e):{}}const git=(e={})=>{const{openDelimiter:t="rehype:ignore:start",closeDelimiter:n="rehype:ignore:end"}=e;return r=>{ia(r,(i,a,s)=>{if(i.type==="element"||i.type==="root"){let o=!1;i.children=i.children.filter(l=>{if(l.type==="raw"||l.type==="comment"){let u=(l.value||"").trim();if(u=u.replace(/^<!--(.*?)-->/,"$1"),u===t)return o=!0,!1;if(u===n)return o=!1,!1}return!o})}})}};var bit={type:"element",tagName:"svg",properties:{className:"octicon octicon-link",viewBox:"0 0 16 16",version:"1.1",width:"16",height:"16",ariaHidden:"true"},children:[{type:"element",tagName:"path",children:[],properties:{fillRule:"evenodd",d:"M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"}}]};function vit(e){return e===void 0&&(e=""),{type:"element",tagName:"div",properties:{class:"copied","data-code":e},children:[{type:"element",tagName:"svg",properties:{className:"octicon-copy",ariaHidden:"true",viewBox:"0 0 16 16",fill:"currentColor",height:12,width:12},children:[{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 010 1.5h-1.5a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-1.5a.75.75 0 011.5 0v1.5A1.75 1.75 0 019.25 16h-7.5A1.75 1.75 0 010 14.25v-7.5z"},children:[]},{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0114.25 11h-7.5A1.75 1.75 0 015 9.25v-7.5zm1.75-.25a.25.25 0 00-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 00.25-.25v-7.5a.25.25 0 00-.25-.25h-7.5z"},children:[]}]},{type:"element",tagName:"svg",properties:{className:"octicon-check",ariaHidden:"true",viewBox:"0 0 16 16",fill:"currentColor",height:12,width:12},children:[{type:"element",tagName:"path",properties:{fillRule:"evenodd",d:"M13.78 4.22a.75.75 0 010 1.06l-7.25 7.25a.75.75 0 01-1.06 0L2.22 9.28a.75.75 0 011.06-1.06L6 10.94l6.72-6.72a.75.75 0 011.06 0z"},children:[]}]}]}}var yit=(e,t)=>(n,r,i)=>{if(n.type==="element"&&i&&i.type==="root"&&/h(1|2|3|4|5|6)/.test(n.tagName)){var a=n.children&&n.children[0];a&&a.properties&&a.properties.ariaHidden==="true"&&(a.properties=ru({class:"anchor"},a.properties),a.children=[bit])}if(n.type==="element"&&n.tagName==="pre"&&!e){var s=Iue(n.children);n.children.push(vit(s))}t&&t(n,r===null?void 0:r,i===null?void 0:i)},_it=[uit,mit,git];const Eit=oe.forwardRef((e,t)=>{var n,r=[nit,yce,rit,..._it,[RKe,{rewrite:yit((n=e.disableCopy)!=null?n:!1,e.rehypeRewrite)}],[DKe,{properties:"attr"}],...e.rehypePlugins||[],[sqe,{ignoreMissing:!0}]];return b.jsx(tit,ru({},e,{rehypePlugins:r,ref:t}))});function Sit(e,t){if(e.startsWith("/")||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:"))return e;const n=t.includes("/")?t.substring(0,t.lastIndexOf("/")):"",r=n?n.split("/"):[],i=e.split("/");for(const a of i)a===".."?r.pop():a!=="."&&r.push(a);return r.join("/")}function xit(e,t,n){if(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("data:")||e.startsWith("/api/"))return e;const r=Sit(e,n);return`/api/fs/image?${new URLSearchParams({path:r,root:t})}`}function wit({content:e,worktreePath:t,filePath:n}){const{resolvedTheme:r}=qc(),i=k.useMemo(()=>({img:({src:a,alt:s,...o})=>{if(!a)return null;const l=xit(a,t,n);return b.jsx("img",{src:l,alt:s||"",loading:"lazy",style:{maxWidth:"100%"},...o})},a:({href:a,children:s,...o})=>b.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",...o,children:s})}),[t,n]);return b.jsx(Yy,{className:"h-full",children:b.jsx("div",{className:"p-4","data-color-mode":r==="light"?"light":"dark",children:b.jsx(Eit,{source:e,style:{backgroundColor:"transparent",fontSize:"14px"},components:i})})})}const Tit=1e3,Cit=n0(function({onBack:t}){const{worktreePath:n,readOnly:r,selectedFile:i,currentFile:a,isLoading:s,isSaving:o,loadError:l,isDirty:u,updateContent:f,saveFile:d,closeFile:p,toggleMarkdownView:m}=oie(),y=k.useRef(null);k.useEffect(()=>()=>{y.current&&clearTimeout(y.current)},[]);const S=k.useCallback(w=>{!i||r||(f(i,w),y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{d(i).catch(C=>{console.error("Auto-save failed:",C)})},Tit))},[i,r,f,d]),g=k.useCallback(()=>{i&&(y.current&&(clearTimeout(y.current),y.current=null),p(i)),t?.()},[i,p,t]),_=k.useCallback(()=>{i&&m(i)},[i,m]);if(!i)return b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Select a file to view"});if(s)return b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Loading file..."});if(l)return b.jsx("div",{className:"flex h-full items-center justify-center text-destructive text-sm",children:l});if(!a)return b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Unable to load file"});if(a.isBinary)return b.jsxs("div",{className:"flex h-full flex-col items-center justify-center text-muted-foreground text-sm gap-2",children:[b.jsx("p",{children:"Binary file"}),b.jsxs("p",{className:"text-xs",children:[(a.size/1024).toFixed(1)," KB"]})]});if(a.isImage)return b.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[b.jsxs("div",{className:"flex shrink-0 items-center justify-between px-2 py-1.5 bg-card border-b border-border text-xs",children:[b.jsx("span",{className:"text-muted-foreground truncate",title:i,children:i.split("/").pop()||i}),b.jsx("button",{onClick:g,className:"p-1 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:"Close file",children:b.jsx(fe,{icon:ci,size:14,strokeWidth:2})})]}),b.jsx("div",{className:"flex-1 overflow-auto p-4 bg-muted",children:b.jsx("img",{src:a.content,alt:i,className:"block mx-auto"})})]});const v=i.split("/").pop()||i,x=a.isMarkdown,T=x&&a.isMarkdownView;return b.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[b.jsxs("div",{className:"flex shrink-0 items-center gap-3 px-2 py-1.5 bg-card border-b border-border text-xs",children:[b.jsxs("span",{className:"text-muted-foreground truncate flex-1 flex items-center gap-1",title:i,children:[v,!r&&u&&b.jsx("span",{className:"text-amber-500",children:"*"}),!r&&o&&b.jsx("span",{className:"text-muted-foreground italic",children:"(saving...)"})]}),a.truncated&&b.jsxs("span",{className:"text-destructive",children:["Truncated (",a.lineCount.toLocaleString()," lines)"]}),b.jsxs("span",{className:"text-muted-foreground",children:[(a.size/1024).toFixed(1)," KB"]}),x&&b.jsx("button",{onClick:_,className:Ue("p-1 rounded hover:bg-muted/50 transition-colors",T?"text-primary":"text-muted-foreground hover:text-foreground"),title:T?"Show code":"Preview markdown",children:b.jsx(fe,{icon:T?$1e:z1e,size:14,strokeWidth:2})}),b.jsx("button",{onClick:g,className:"p-1 text-muted-foreground hover:text-foreground rounded hover:bg-muted/50",title:"Close file",children:b.jsx(fe,{icon:ci,size:14,strokeWidth:2})})]}),b.jsx("div",{className:"flex-1 min-h-0",children:T?b.jsx(wit,{content:a.content,worktreePath:n||"",filePath:i}):b.jsx(uGe,{filePath:i,content:a.content,onChange:S,readOnly:r||!a.isEditable})})]})}),pde=k.createContext(void 0),Ait=n0(function(){const t=k.useContext(pde),{selectedFile:n,expandedDirs:r,fileTree:i,isLoadingTree:a,treeError:s,selectFile:o,loadFile:l,toggleDir:u,collapseAll:f}=oie(),d=k.useCallback(y=>{o(y),l(y),t?.(y)},[o,l,t]),p=k.useCallback(y=>{u(y)},[u]),m=k.useCallback(()=>{o(null),t?.(null)},[o,t]);return a?b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"Loading files..."}):s?b.jsx("div",{className:"flex h-full items-center justify-center text-destructive text-sm",children:s}):n?b.jsx("div",{className:"flex h-full flex-col bg-background",children:b.jsx(Cit,{onBack:m})}):b.jsx(QWe,{entries:i||[],selectedFile:n,expandedDirs:r,onSelectFile:d,onToggleDir:p,onCollapseAll:f})});function _x({worktreePath:e,readOnly:t=!1,initialSelectedFile:n,onFileChange:r}){const i=M2e(e,t,n);return e?b.jsx(sie.Provider,{value:i,children:b.jsx(pde.Provider,{value:r,children:b.jsx(Ait,{})})}):b.jsx("div",{className:"flex h-full items-center justify-center text-muted-foreground text-sm",children:"No worktree selected"})}const hP=Ms("/tasks/$taskId")({component:kit,validateSearch:e=>({tab:["diff","browser","files"].includes(e.tab)?e.tab:void 0,file:typeof e.file=="string"?e.file:void 0})}),Q_={IN_PROGRESS:"In Progress",IN_REVIEW:"In Review",DONE:"Done",CANCELED:"Canceled"},IQ={IN_PROGRESS:"bg-status-in-progress/20 text-status-in-progress",IN_REVIEW:"bg-status-in-review/20 text-status-in-review",DONE:"bg-status-done/20 text-status-done",CANCELED:"bg-status-canceled/20 text-status-canceled"};function kit(){const{taskId:e}=hP.useParams(),t=hP.useSearch(),n=Wi(),r=ome(),{data:i,isLoading:a}=wne(e),s=NM(),o=IM(),{viewState:l,setActiveTab:u,setFilesViewState:f}=u5(e),d=Lie(),p=Pie(),m=Mie(),y=jie(),S=Fie(),{data:g}=DM(),{data:_}=LM(),{data:v}=PM(),{data:x}=Tne(),{data:T}=bWe(i?.linearTicketId??null),{data:w=[]}=Ky(),C=w.find(xe=>xe.path===i?.repoPath),R=r.state,O=i?.aiMode??R?.aiMode,N=i?.description??R?.description,[L,D]=k.useState(!1),[z,M]=k.useState(!1),[V,W]=k.useState(!0),[$,q]=k.useState("terminal"),Y=pw(),B=t.tab??l.activeTab,j=t.file??l.filesViewState.selectedFile,U=k.useRef(null);k.useEffect(()=>{U.current===e||t.tab||(U.current=e,l.activeTab&&n({to:"/tasks/$taskId",params:{taskId:e},search:{tab:l.activeTab==="diff"?void 0:l.activeTab,file:l.filesViewState.selectedFile||void 0},replace:!0}))},[e,t.tab,l.activeTab,l.filesViewState.selectedFile,n]);const K=k.useCallback(xe=>{const ve=xe;u(ve),n({to:"/tasks/$taskId",params:{taskId:e},search:{tab:ve==="diff"?void 0:ve,file:ve==="files"&&j||void 0},replace:!0})},[e,n,u,j]),H=k.useCallback(xe=>{f({selectedFile:xe}),n({to:"/tasks/$taskId",params:{taskId:e},search:{tab:"files",file:xe||void 0},replace:!0})},[e,n,f]),{terminals:J,sendInputToTerminal:se}=c5(),ae=J.find(xe=>i?.worktreePath&&xe.cwd.startsWith(i.worktreePath)),Q=xe=>{ae?(se(ae.id,xe),ln.info("Sent to Claude Code")):ln.error("No terminal available")},G=async()=>{if(!(!i?.repoPath||!i?.worktreePath))try{await d.mutateAsync({repoPath:i.repoPath,worktreePath:i.worktreePath,baseBranch:i.baseBranch}),ln.success("Synced from main")}catch(xe){const ve=xe instanceof Error?xe.message:"Sync failed",De=i.baseBranch||"main";ln.error(ve,{action:ae?{label:"Resolve with Claude",onClick:()=>Q(`Rebase this worktree onto the parent repo's ${De} branch. Error: "${ve}". Steps: 1) Check for uncommitted changes - stash or commit them first, 2) git fetch origin (in parent repo at ${i.repoPath}) to ensure ${De} is current, 3) git rebase ${De} (in worktree), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) If stashed, git stash pop. Worktree: ${i.worktreePath}, Parent repo: ${i.repoPath}.`)}:void 0})}},Z=async()=>{if(!(!i?.repoPath||!i?.worktreePath))try{await p.mutateAsync({repoPath:i.repoPath,worktreePath:i.worktreePath,baseBranch:i.baseBranch}),ln.success("Merged to main"),S.mutate(i.id),s.mutate({taskId:i.id,updates:{status:"DONE"}})}catch(xe){const ve=xe instanceof Error?xe.message:"Merge failed",De=i.baseBranch||"main";ln.error(ve,{action:ae?{label:"Resolve with Claude",onClick:()=>Q(`Merge this worktree's branch into the parent repo's ${De}. Error: "${ve}". Steps: 1) Ensure all changes in worktree are committed, 2) In parent repo at ${i.repoPath}, checkout ${De} and pull latest from origin, 3) Squash merge the worktree branch into ${De} (use git merge --squash, then commit), 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Push ${De} to origin. Worktree: ${i.worktreePath}, Parent repo: ${i.repoPath}.`)}:void 0})}},ee=async()=>{if(i?.worktreePath)try{await m.mutateAsync({worktreePath:i.worktreePath}),ln.success("Pushed to origin")}catch(xe){const ve=xe instanceof Error?xe.message:"Push failed";ln.error(ve,{action:ae?{label:"Resolve with Claude",onClick:()=>Q(`Push this worktree's branch to origin. Error: "${ve}". Steps: 1) Check for uncommitted changes and commit them, 2) If push is rejected, pull the latest changes first and resolve any conflicts, 3) Push to origin again. Worktree: ${i.worktreePath}.`)}:void 0})}},ne=async()=>{if(i?.repoPath)try{await y.mutateAsync({repoPath:i.repoPath,baseBranch:i.baseBranch}),ln.success("Parent synced with origin")}catch(xe){const ve=xe instanceof Error?xe.message:"Sync parent failed",De=i.baseBranch||"main";ln.error(ve,{action:ae?{label:"Resolve with Claude",onClick:()=>Q(`Sync the parent repo's ${De} branch with origin. Error: "${ve}". Steps: 1) git fetch origin, 2) git pull origin ${De} --ff-only, 3) If that fails, rebase with git rebase origin/${De}, 4) Resolve any conflicts carefully - do not lose functionality or introduce regressions, 5) Once in sync, git push origin ${De}. Work in the parent repo at ${i.repoPath}, not the worktree.`)}:void 0})}},te=()=>{ae&&se(ae.id,"commit")},be=()=>{ae&&se(ae.id,"Create a PR for this task and link it using: vibora current-task pr <url>")},_e=()=>{if(!i?.worktreePath)return;const xe=sae(i.worktreePath,g,_,v);oae(xe)},he=xe=>{i&&s.mutate({taskId:i.id,updates:{status:xe}})},ye=()=>{i&&o.mutate({taskId:i.id,deleteLinkedWorktree:V},{onSuccess:()=>{n({to:"/tasks"})}})},Ee=xe=>{M(xe),xe||W(!1)};return a?b.jsx("div",{className:"flex h-full items-center justify-center",children:b.jsx("p",{className:"text-muted-foreground",children:"Loading task..."})}):i?b.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[b.jsxs("div",{className:"shrink-0 border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"flex flex-col gap-1 sm:hidden",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:i.title}),b.jsxs(uE,{children:[b.jsx(cE,{render:b.jsx("button",{type:"button",className:`rounded-full px-2 py-0.5 text-xs font-medium ${IQ[i.status]}`}),children:Q_[i.status]}),b.jsx(dE,{align:"end",children:b.jsx(hH,{value:i.status,onValueChange:he,children:Object.entries(Q_).map(([xe,ve])=>b.jsx(pH,{value:xe,children:ve},xe))})})]}),b.jsxs(uE,{children:[b.jsx(cE,{render:b.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-foreground"}),children:b.jsx(fe,{icon:ute,size:16,strokeWidth:2})}),b.jsxs(dE,{align:"end",children:[b.jsxs(eo,{onClick:G,disabled:d.isPending||!i.worktreePath,children:[b.jsx(fe,{icon:HE,size:14,strokeWidth:2}),"Pull from main"]}),b.jsxs(eo,{onClick:Z,disabled:p.isPending||!i.worktreePath,children:[b.jsx(fe,{icon:zE,size:14,strokeWidth:2}),"Merge to main"]}),b.jsxs(eo,{onClick:ee,disabled:m.isPending||!i.worktreePath,children:[b.jsx(fe,{icon:WE,size:14,strokeWidth:2}),"Push to origin"]}),b.jsxs(eo,{onClick:ne,disabled:y.isPending||!i.repoPath,children:[b.jsx(fe,{icon:GE,size:14,strokeWidth:2}),"Sync parent"]}),b.jsxs(eo,{onClick:te,disabled:!ae,children:[b.jsx(fe,{icon:VE,size:14,strokeWidth:2}),"Commit"]}),!i.prUrl&&b.jsxs(eo,{onClick:be,disabled:!ae,children:[b.jsx(fe,{icon:Ub,size:14,strokeWidth:2}),"Create PR"]})]})]}),b.jsxs(go,{open:z,onOpenChange:Ee,children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive"}),children:b.jsx(fe,{icon:$c,size:16,strokeWidth:2})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:"Delete Task"}),b.jsxs(So,{children:['This will permanently delete "',i.title,'" and close its terminal.',V&&i.worktreePath&&" The linked worktree will also be removed."," ","This action cannot be undone."]}),i.worktreePath&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:V,onCheckedChange:xe=>W(xe===!0),disabled:o.isPending}),"Also delete linked worktree"]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:o.isPending,children:"Cancel"}),b.jsx(Rv,{onClick:ye,variant:"destructive",disabled:o.isPending,children:o.isPending?"Deleting...":"Delete"})]})]})]})]}),b.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[b.jsx("button",{type:"button",className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>D(!0),title:"Task settings",children:b.jsx(fe,{icon:XI,size:14,strokeWidth:2})}),C?b.jsxs(wi,{to:"/repositories/$repoId",params:{repoId:C.id},className:"flex items-center gap-1 hover:text-foreground transition-colors",children:[b.jsx(fe,{icon:np,size:12,strokeWidth:2}),b.jsx("span",{children:i.repoName})]}):b.jsxs("span",{className:"flex items-center gap-1",children:[b.jsx(fe,{icon:np,size:12,strokeWidth:2}),b.jsx("span",{children:i.repoName})]}),b.jsx("div",{className:"ml-auto",children:b.jsx(Vb,{worktreePath:i.worktreePath})})]})]}),b.jsxs("div",{className:"hidden items-center gap-3 sm:flex",children:[b.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[b.jsxs("div",{className:"flex items-center gap-1.5",children:[b.jsx("h1",{className:"text-sm font-medium",children:i.title}),b.jsx("button",{type:"button",className:"p-0.5 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>D(!0),title:"Task settings",children:b.jsx(fe,{icon:XI,size:14,strokeWidth:2})})]}),b.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[C?b.jsxs(wi,{to:"/repositories/$repoId",params:{repoId:C.id},className:"flex items-center gap-1 hover:text-foreground transition-colors",children:[b.jsx(fe,{icon:np,size:12,strokeWidth:2}),b.jsx("span",{children:i.repoName})]}):b.jsxs("span",{className:"flex items-center gap-1",children:[b.jsx(fe,{icon:np,size:12,strokeWidth:2}),b.jsx("span",{children:i.repoName})]}),b.jsx(fe,{icon:Vx,size:12,strokeWidth:2}),b.jsx("span",{className:"font-mono",children:i.branch}),i.prUrl&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/50",children:"•"}),b.jsxs("a",{href:i.prUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-foreground hover:text-primary font-medium",onClick:xe=>xe.stopPropagation(),children:[b.jsx(fe,{icon:Ub,size:14,strokeWidth:2}),b.jsxs("span",{children:["#",i.prUrl.match(/\/pull\/(\d+)/)?.[1]??"PR"]})]})]}),i.linearTicketUrl&&b.jsxs(b.Fragment,{children:[b.jsx("span",{className:"text-muted-foreground/50",children:"•"}),b.jsxs("a",{href:T?.url??i.linearTicketUrl,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-foreground hover:text-primary font-medium",onClick:xe=>xe.stopPropagation(),title:T?.title,children:[b.jsx(fe,{icon:hM,size:14,strokeWidth:2}),b.jsx("span",{children:i.linearTicketId}),T?.status&&b.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",T.status,")"]})]})]})]})]}),b.jsxs(uE,{children:[b.jsx(cE,{render:b.jsx("button",{type:"button",className:`rounded-full px-2 py-0.5 text-xs font-medium ${IQ[i.status]}`}),children:Q_[i.status]}),b.jsx(dE,{align:"end",children:b.jsx(hH,{value:i.status,onValueChange:he,children:Object.entries(Q_).map(([xe,ve])=>b.jsx(pH,{value:xe,children:ve},xe))})})]}),b.jsxs("div",{className:"flex items-center gap-0",children:[b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:G,disabled:d.isPending||!i.worktreePath,className:"text-muted-foreground hover:text-foreground",title:"Pull from main",children:b.jsx(fe,{icon:HE,size:16,strokeWidth:2,className:d.isPending?"animate-spin":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:Z,disabled:p.isPending||!i.worktreePath,className:"text-muted-foreground hover:text-foreground",title:"Merge to main",children:b.jsx(fe,{icon:zE,size:16,strokeWidth:2,className:p.isPending?"animate-pulse":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:ee,disabled:m.isPending||!i.worktreePath,className:"text-muted-foreground hover:text-foreground",title:"Push to origin",children:b.jsx(fe,{icon:WE,size:16,strokeWidth:2,className:m.isPending?"animate-pulse":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:ne,disabled:y.isPending||!i.repoPath,className:"text-muted-foreground hover:text-foreground",title:"Sync parent with origin",children:b.jsx(fe,{icon:GE,size:16,strokeWidth:2,className:y.isPending?"animate-spin":""})}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:te,disabled:!ae,className:"text-muted-foreground hover:text-foreground",title:"Commit",children:b.jsx(fe,{icon:VE,size:16,strokeWidth:2})}),!i.prUrl&&b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:be,disabled:!ae,className:"text-muted-foreground hover:text-foreground",title:"Create Pull Request",children:b.jsx(fe,{icon:Ub,size:16,strokeWidth:2})}),b.jsx(Ke,{variant:"ghost",size:"icon-sm",onClick:_e,disabled:!i.worktreePath,className:"text-muted-foreground hover:text-foreground",title:"Open in editor",children:b.jsx(fe,{icon:fte,size:16,strokeWidth:2})})]}),b.jsxs(go,{open:z,onOpenChange:Ee,children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive"}),children:b.jsx(fe,{icon:$c,size:16,strokeWidth:2})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:"Delete Task"}),b.jsxs(So,{children:['This will permanently delete "',i.title,'" and close its terminal.',V&&i.worktreePath&&" The linked worktree will also be removed."," ","This action cannot be undone."]}),i.worktreePath&&b.jsxs("label",{className:"flex items-center gap-2 text-sm text-foreground",children:[b.jsx(Ti,{checked:V,onCheckedChange:xe=>W(xe===!0),disabled:o.isPending}),"Also delete linked worktree"]})]}),b.jsxs(_o,{children:[b.jsx(xo,{disabled:o.isPending,children:"Cancel"}),b.jsx(Rv,{onClick:ye,variant:"destructive",disabled:o.isPending,children:o.isPending?"Deleting...":"Delete"})]})]})]})]})]}),Y?b.jsxs(su,{value:$,onValueChange:xe=>q(xe),className:"flex min-h-0 flex-1 flex-col",children:[b.jsx("div",{className:"shrink-0 border-b border-border px-2 py-1",children:b.jsxs(ou,{className:"w-full",children:[b.jsx(li,{value:"terminal",className:"flex-1",children:"Terminal"}),b.jsx(li,{value:"details",className:"flex-1",children:"Details"})]})}),b.jsx(Pi,{value:"terminal",className:"flex-1 min-h-0",children:b.jsx($X,{taskName:i.title,cwd:i.worktreePath,aiMode:O,description:N,startupScript:i.startupScript,serverPort:x})}),b.jsx(Pi,{value:"details",className:"flex-1 min-h-0 bg-background",children:b.jsxs(su,{value:B,onValueChange:K,className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex items-center justify-between shrink-0 border-b border-border bg-background px-2 py-1",children:[b.jsxs(ou,{variant:"line",children:[b.jsxs(li,{value:"diff",children:[b.jsx(fe,{icon:Q$,size:14,strokeWidth:2,"data-slot":"icon"}),"Diff"]}),b.jsxs(li,{value:"browser",children:[b.jsx(fe,{icon:KI,size:14,strokeWidth:2,"data-slot":"icon"}),"Browser"]}),b.jsxs(li,{value:"files",children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2,"data-slot":"icon"}),"Files"]})]}),b.jsx(Vb,{worktreePath:i.worktreePath})]}),b.jsx(Pi,{value:"diff",className:"flex-1 overflow-hidden",children:b.jsx(HX,{taskId:i.id,worktreePath:i.worktreePath})}),b.jsx(Pi,{value:"browser",className:"flex-1 overflow-hidden",children:b.jsx(WX,{taskId:i.id})}),b.jsx(Pi,{value:"files",className:"flex-1 overflow-hidden",children:b.jsx(_x,{worktreePath:i.worktreePath,initialSelectedFile:j,onFileChange:H})})]})})]}):b.jsxs(Vd,{direction:"horizontal",className:"min-h-0 flex-1",children:[b.jsx(Ss,{defaultSize:50,minSize:30,children:b.jsx($X,{taskName:i.title,cwd:i.worktreePath,aiMode:O,description:N,startupScript:i.startupScript,serverPort:x})}),b.jsx(Gd,{withHandle:!0}),b.jsx(Ss,{defaultSize:50,minSize:30,className:"bg-background",children:b.jsxs(su,{value:B,onValueChange:K,className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex items-center justify-between shrink-0 border-b border-border bg-background px-2 py-1",children:[b.jsxs(ou,{variant:"line",children:[b.jsxs(li,{value:"diff",children:[b.jsx(fe,{icon:Q$,size:14,strokeWidth:2,"data-slot":"icon"}),"Diff"]}),b.jsxs(li,{value:"browser",children:[b.jsx(fe,{icon:KI,size:14,strokeWidth:2,"data-slot":"icon"}),"Browser"]}),b.jsxs(li,{value:"files",children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2,"data-slot":"icon"}),"Files"]})]}),b.jsx(Vb,{worktreePath:i.worktreePath})]}),b.jsx(Pi,{value:"diff",className:"flex-1 overflow-hidden",children:b.jsx(HX,{taskId:i.id,worktreePath:i.worktreePath})}),b.jsx(Pi,{value:"browser",className:"flex-1 overflow-hidden",children:b.jsx(WX,{taskId:i.id})}),b.jsx(Pi,{value:"files",className:"flex-1 overflow-hidden",children:b.jsx(_x,{worktreePath:i.worktreePath,initialSelectedFile:j,onFileChange:H})})]})})]}),b.jsx(rae,{task:i,open:L,onOpenChange:D})]}):b.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4",children:[b.jsx("p",{className:"text-muted-foreground",children:"Task not found"}),b.jsx(wi,{to:"/tasks",children:b.jsx(Ke,{variant:"outline",children:"Back to Tasks"})})]})}function Oit(e){const t=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return t?`https://${t[1]}/${t[2]}`:e.replace(/\.git$/,"")}function Rit(e){return qn({queryKey:["git-remote",e],queryFn:async()=>{if(!e)return null;const t=await fetch(`/api/git/remote?path=${encodeURIComponent(e)}`);return t.ok?(await t.json()).remoteUrl:null},enabled:!!e,staleTime:60*1e3})}function Nit(){const{repoId:e}=pP.useParams(),{tab:t,file:n}=pP.useSearch(),r=Wi(),{data:i,isLoading:a,error:s}=uwe(e),o=dwe(),l=One(),{data:u}=Rit(i?.path),[f,d]=k.useState(""),[p,m]=k.useState(""),[y,S]=k.useState(""),[g,_]=k.useState(!1),[v,x]=k.useState(!1),[T,w]=k.useState(!1),[C,R]=k.useState("terminal"),[O,N]=k.useState(null),[L,D]=k.useState(!1),[z,M]=k.useState(!1),[V,W]=k.useState(!1),$=k.useRef(null),q=k.useRef(null),Y=k.useRef(!1),B=k.useRef(!1),{terminals:j,terminalsLoaded:U,connected:K,createTerminal:H,attachXterm:J,resizeTerminal:se,setupImagePaste:ae,writeToTerminal:Q}=c5(),G=t||"settings",Z=pw();k.useEffect(()=>{At.repoTerminal.info("component mounted",{repoId:e,tab:t,activeTab:G})},[e,t,G]),k.useEffect(()=>{At.repoTerminal.debug("state changed",{terminalId:O,xtermReady:z,containerReady:V,connected:K,terminalsLoaded:U,terminalCount:j.length,repoPath:i?.path})},[O,z,V,K,U,j.length,i?.path]);const ee=k.useCallback(xe=>{r({to:"/repositories/$repoId",params:{repoId:e},search:xe==="settings"?{}:{tab:xe,file:n},replace:!0})},[r,e,n]),ne=k.useCallback(xe=>{r({to:"/repositories/$repoId",params:{repoId:e},search:{tab:"workspace",file:xe??void 0},replace:!0})},[r,e]);k.useEffect(()=>{i&&(d(i.displayName),m(i.startupScript||""),S(i.copyFiles||""),_(i.isCopierTemplate??!1),x(!1))},[i]),k.useEffect(()=>{if(i){const xe=f!==i.displayName||p!==(i.startupScript||"")||y!==(i.copyFiles||"")||g!==(i.isCopierTemplate??!1);x(xe)}},[f,p,y,g,i]);const te=()=>{i&&o.mutate({id:i.id,updates:{displayName:f.trim()||i.path.split("/").pop()||"repo",startupScript:p.trim()||null,copyFiles:y.trim()||null,isCopierTemplate:g}},{onSuccess:()=>{ln.success("Repository saved"),x(!1)},onError:xe=>{ln.error("Failed to save repository",{description:xe instanceof Error?xe.message:"Unknown error"})}})},be=async()=>{i&&(await l.mutateAsync(i.id),r({to:"/repositories"}))};k.useEffect(()=>{Y.current=!1,B.current=!1,N(null),D(!1)},[i?.path]),k.useEffect(()=>{if(!K||!i?.path||!U||G!=="workspace"||!z){At.repoTerminal.debug("find/create: waiting",{connected:K,path:i?.path,terminalsLoaded:U,activeTab:G,xtermReady:z});return}const xe=j.find(ve=>ve.cwd===i.path);if(xe){At.repoTerminal.info("found existing terminal",{id:xe.id,cwd:xe.cwd}),N(xe.id);return}if(!Y.current&&$.current){Y.current=!0,D(!0);const{cols:ve,rows:De}=$.current;At.repoTerminal.info("creating terminal",{name:i.displayName,cwd:i.path,cols:ve,rows:De}),H({name:i.displayName,cols:ve,rows:De,cwd:i.path})}},[K,i?.path,i?.displayName,U,j,G,H,z]),k.useEffect(()=>{if(!i?.path)return;const xe=j.find(De=>De.cwd===i.path);if(!xe)return;const ve=O&&j.some(De=>De.id===O);(!O||!ve)&&(N(xe.id),D(!1),O&&!ve&&(B.current=!1))},[j,i?.path,O]);const _e=k.useCallback(xe=>{At.repoTerminal.info("xterm ready"),$.current=xe,M(!0)},[]),he=k.useCallback((xe,ve)=>{O&&se(O,xe,ve)},[O,se]),ye=k.useCallback(xe=>{At.repoTerminal.info("container ready"),q.current=xe,W(!0)},[]),Ee=k.useCallback(xe=>{O&&Q(O,xe)},[O,Q]);return k.useEffect(()=>{if(!O||!z||!V){At.repoTerminal.debug("attach effect: waiting",{terminalId:O,xtermReady:z,containerReady:V});return}if(!$.current||!q.current){At.repoTerminal.warn("attach effect: refs not set despite ready states",{terminalId:O});return}if(B.current){At.repoTerminal.debug("attach effect: already attached",{terminalId:O});return}return At.repoTerminal.info("attaching terminal",{terminalId:O}),J(O,$.current),ae(q.current,O),B.current=!0,()=>{At.repoTerminal.debug("detaching terminal",{terminalId:O}),B.current=!1}},[O,z,V,J,ae]),a?b.jsx("div",{className:"flex h-full items-center justify-center",children:b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"})}):s||!i?b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsx("div",{className:"flex shrink-0 items-center gap-2 border-b border-border bg-background px-4 py-2",children:b.jsxs(wi,{to:"/repositories",className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:ete,size:16,strokeWidth:2}),"Repositories"]})}),b.jsx("div",{className:"flex flex-1 items-center justify-center",children:b.jsxs("div",{className:"flex items-center gap-3 text-destructive",children:[b.jsx(fe,{icon:ts,size:20,strokeWidth:2}),b.jsx("span",{className:"text-sm",children:"Repository not found"})]})})]}):b.jsxs("div",{className:"flex h-full flex-col",children:[b.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border bg-background px-4 py-2",children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsxs(Ke,{variant:"ghost",size:"sm",onClick:()=>w(!0),className:"text-muted-foreground hover:text-foreground",children:[b.jsx(fe,{icon:pM,size:16,strokeWidth:2,"data-slot":"icon",className:"-translate-y-px"}),b.jsx("span",{className:"max-sm:hidden",children:"New Task"})]}),b.jsxs(Ke,{variant:"ghost",size:"sm",onClick:()=>r({to:"/tasks",search:{repo:i.displayName}}),className:"text-muted-foreground hover:text-foreground",title:"View Tasks",children:[b.jsx(fe,{icon:Dp,size:14,strokeWidth:2,"data-slot":"icon"}),b.jsx("span",{className:"max-sm:hidden",children:"Tasks"})]})]}),b.jsxs("div",{className:"flex items-center gap-3",children:[b.jsx(Vb,{worktreePath:i.path}),b.jsx("span",{className:"text-sm font-medium",children:i.displayName}),u&&b.jsx("a",{href:Oit(u),target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors",title:u,children:b.jsx(fe,{icon:u.includes("github.com")?N1e:ote,size:14,strokeWidth:2})}),b.jsxs(go,{children:[b.jsx(bo,{render:b.jsx(Ke,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-destructive"}),children:b.jsx(fe,{icon:$c,size:14,strokeWidth:2})}),b.jsxs(vo,{children:[b.jsxs(yo,{children:[b.jsx(Eo,{children:"Delete Repository"}),b.jsxs(So,{children:['This will remove "',i.displayName,'" from Vibora. The actual repository files will not be affected.']})]}),b.jsxs(_o,{children:[b.jsx(xo,{children:"Cancel"}),b.jsx(Ke,{variant:"destructive",onClick:be,children:"Delete"})]})]})]})]})]}),b.jsxs(su,{value:G,onValueChange:xe=>ee(xe),className:"flex flex-1 flex-col overflow-hidden",children:[b.jsx("div",{className:"shrink-0 border-b border-border bg-muted/50 px-4",children:b.jsxs(ou,{variant:"line",children:[b.jsx(li,{value:"settings",className:"px-3 py-1.5",children:"Settings"}),b.jsx(li,{value:"workspace",className:"px-3 py-1.5",children:"Workspace"})]})}),b.jsx(Pi,{value:"settings",className:"flex-1 overflow-hidden mt-0",children:b.jsx(Yy,{className:"h-full",children:b.jsx("div",{className:"p-4",children:b.jsxs("div",{className:"mx-auto max-w-xl space-y-6 bg-card rounded-lg p-6 border border-border",children:[b.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[b.jsx(fe,{icon:Hi,size:14,strokeWidth:2}),b.jsx("span",{className:"font-mono break-all",children:i.path})]}),b.jsxs(pf,{children:[b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"displayName",children:"Display Name"}),b.jsx(vn,{id:"displayName",value:f,onChange:xe=>d(xe.target.value),placeholder:i.path.split("/").pop()||"My Project"})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"startupScript",children:"Startup Script"}),b.jsx(bM,{id:"startupScript",value:p,onChange:xe=>m(xe.target.value),placeholder:"npm install && npm run dev",rows:3}),b.jsx(qa,{children:"Command to run in the terminal when creating a worktree."})]}),b.jsxs(ir,{children:[b.jsx(ar,{htmlFor:"copyFiles",children:"Copy Files"}),b.jsx(vn,{id:"copyFiles",value:y,onChange:xe=>S(xe.target.value),placeholder:".env, config.local.json"}),b.jsx(qa,{children:"Comma-separated glob patterns for files to copy into new worktrees."})]}),b.jsxs(ir,{children:[b.jsxs("div",{className:"flex items-center gap-2",children:[b.jsx(Ti,{checked:g,onCheckedChange:xe=>_(xe===!0)}),b.jsx(ar,{className:"cursor-pointer",children:"Use as Copier Template"})]}),b.jsx(qa,{children:"Mark as a template for creating new projects with Copier."})]})]}),b.jsx("div",{className:"flex items-center justify-end pt-4 border-t border-border",children:b.jsxs(Ke,{size:"sm",onClick:te,disabled:!v||o.isPending,children:[b.jsx(fe,{icon:hl,size:14,strokeWidth:2,"data-slot":"icon"}),o.isPending?"Saving...":"Save"]})})]})})})}),b.jsx(Pi,{value:"workspace",className:"flex-1 overflow-hidden mt-0",children:Z?b.jsxs(su,{value:C,onValueChange:xe=>R(xe),className:"flex min-h-0 flex-1 flex-col h-full",children:[b.jsx("div",{className:"shrink-0 border-b border-border px-2 py-1",children:b.jsxs(ou,{className:"w-full",children:[b.jsx(li,{value:"terminal",className:"flex-1",children:"Terminal"}),b.jsx(li,{value:"files",className:"flex-1",children:"Files"})]})}),b.jsx(Pi,{value:"terminal",className:"flex-1 min-h-0",children:b.jsxs("div",{className:"h-full flex flex-col",children:[!K&&b.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:"Connecting to terminal server..."}),L&&!O&&b.jsx("div",{className:"flex-1 flex items-center justify-center bg-terminal-background",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"}),b.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:"Initializing terminal..."})]})}),b.jsx(vD,{className:"flex-1",onReady:_e,onResize:he,onContainerReady:ye,terminalId:O??void 0,setupImagePaste:ae,onSend:Ee})]})}),b.jsx(Pi,{value:"files",className:"flex-1 min-h-0",children:b.jsx(_x,{worktreePath:i.path,initialSelectedFile:n,onFileChange:ne})})]}):b.jsxs(Vd,{direction:"horizontal",className:"h-full",children:[b.jsx(Ss,{defaultSize:50,minSize:30,children:b.jsxs("div",{className:"h-full flex flex-col",children:[!K&&b.jsx("div",{className:"shrink-0 px-2 py-1 bg-muted-foreground/20 text-muted-foreground text-xs",children:"Connecting to terminal server..."}),L&&!O&&b.jsx("div",{className:"flex-1 flex items-center justify-center bg-terminal-background",children:b.jsxs("div",{className:"flex flex-col items-center gap-3",children:[b.jsx(fe,{icon:en,size:24,strokeWidth:2,className:"animate-spin text-muted-foreground"}),b.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:"Initializing terminal..."})]})}),b.jsx(vD,{className:"flex-1",onReady:_e,onResize:he,onContainerReady:ye,terminalId:O??void 0,setupImagePaste:ae,onSend:Ee})]})}),b.jsx(Gd,{withHandle:!0}),b.jsx(Ss,{defaultSize:50,minSize:30,children:b.jsx(_x,{worktreePath:i.path,initialSelectedFile:n,onFileChange:ne})})]})})]}),b.jsx(MM,{open:T,onOpenChange:w,defaultRepository:i,showTrigger:!1})]})}const pP=Ms("/repositories/$repoId")({component:Nit,validateSearch:e=>({tab:e.tab==="workspace"?"workspace":void 0,file:typeof e.file=="string"?e.file:void 0})}),Iit=gRe.update({id:"/",path:"/",getParentRoute:()=>Oo}),Dit=SRe.update({id:"/worktrees/",path:"/worktrees/",getParentRoute:()=>Oo}),Lit=mIe.update({id:"/terminals/",path:"/terminals/",getParentRoute:()=>Oo}),Pit=aae.update({id:"/tasks/",path:"/tasks/",getParentRoute:()=>Oo}),Mit=RIe.update({id:"/settings/",path:"/settings/",getParentRoute:()=>Oo}),jit=UIe.update({id:"/review/",path:"/review/",getParentRoute:()=>Oo}),Fit=rDe.update({id:"/repositories/",path:"/repositories/",getParentRoute:()=>Oo}),Bit=Dle.update({id:"/monitoring/",path:"/monitoring/",getParentRoute:()=>Oo}),Uit=hP.update({id:"/tasks/$taskId",path:"/tasks/$taskId",getParentRoute:()=>Oo}),$it=pP.update({id:"/repositories/$repoId",path:"/repositories/$repoId",getParentRoute:()=>Oo}),zit={IndexRoute:Iit,RepositoriesRepoIdRoute:$it,TasksTaskIdRoute:Uit,MonitoringIndexRoute:Bit,RepositoriesIndexRoute:Fit,ReviewIndexRoute:jit,SettingsIndexRoute:Mit,TasksIndexRoute:Pit,TerminalsIndexRoute:Lit,WorktreesIndexRoute:Dit},Hit=Oo._addFileChildren(zit)._addFileTypes(),Wit=new URLSearchParams(window.location.search),of=parseFloat(Wit.get("zoom")||"1");of!==1&&of>=.5&&of<=2&&(document.documentElement.style.fontSize=`${16*of}px`);const vc=of>=.5&&of<=2?of:1,Vit=new Rme({defaultOptions:{queries:{staleTime:1e3*60,refetchOnWindowFocus:!1}}}),Git=rme({routeTree:Hit});Che.createRoot(document.getElementById("root")).render(b.jsx(k.StrictMode,{children:b.jsx(Gme,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:b.jsx(Nme,{client:Vit,children:b.jsx(B2e,{children:b.jsx(sme,{router:Git})})})})}));