coder-config 0.43.27 → 0.43.28

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.
package/lib/constants.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * Constants and tool path configurations
3
3
  */
4
4
 
5
- const VERSION = '0.43.27';
5
+ const VERSION = '0.43.28';
6
6
 
7
7
  // Tool-specific path configurations
8
8
  const TOOL_PATHS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coder-config",
3
- "version": "0.43.27",
3
+ "version": "0.43.28",
4
4
  "description": "Configuration manager for AI coding tools - Claude Code, Gemini CLI, Codex CLI, Antigravity. Manage MCPs, rules, permissions, memory, and workstreams.",
5
5
  "author": "regression.io",
6
6
  "main": "config-loader.js",
@@ -559,7 +559,7 @@ Error generating stack: `+D.message+`
559
559
 
560
560
  If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
561
561
 
562
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return C.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},q3="DialogDescriptionWarning",Y3=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${XS(q3).contentName}}.`;return C.useEffect(()=>{var d;const o=(d=e.current)==null?void 0:d.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},JS=LS,X3=FS,jg=$S,Eu=zS,Pu=HS,Au=US,Tu=GS,Ng=qS;const _t=JS,J3=jg,QS=C.forwardRef(({className:e,...t},n)=>r.jsx(Eu,{ref:n,className:Te("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));QS.displayName=Eu.displayName;const vt=C.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(J3,{children:[r.jsx(QS,{}),r.jsxs(Pu,{ref:s,className:Te("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,r.jsxs(Ng,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsx($s,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));vt.displayName=Pu.displayName;const yt=({className:e,...t})=>r.jsx("div",{className:Te("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});yt.displayName="DialogHeader";const At=({className:e,...t})=>r.jsx("div",{className:Te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});At.displayName="DialogFooter";const bt=C.forwardRef(({className:e,...t},n)=>r.jsx(Au,{ref:n,className:Te("text-lg font-semibold leading-none tracking-tight",e),...t}));bt.displayName=Au.displayName;const er=C.forwardRef(({className:e,...t},n)=>r.jsx(Tu,{ref:n,className:Te("text-sm text-muted-foreground",e),...t}));er.displayName=Tu.displayName;function Eg(e){const t=C.useRef({value:e,previous:e});return C.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Pg(e){const[t,n]=C.useState(void 0);return Pr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const d=o[0];let u,l;if("borderBoxSize"in d){const c=d.borderBoxSize,f=Array.isArray(c)?c[0]:c;u=f.inlineSize,l=f.blockSize}else u=e.offsetWidth,l=e.offsetHeight;n({width:u,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var Ru="Checkbox",[Q3]=hn(Ru),[Z3,Ag]=Q3(Ru);function eL(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:o,disabled:d,form:u,name:l,onCheckedChange:c,required:f,value:m="on",internal_do_not_use_render:h}=e,[x,w]=ws({prop:n,defaultProp:o??!1,onChange:c,caller:Ru}),[j,_]=C.useState(null),[b,v]=C.useState(null),g=C.useRef(!1),y=j?!!u||!!j.closest("form"):!0,k={checked:x,disabled:d,setChecked:w,control:j,setControl:_,name:l,form:u,value:m,hasConsumerStoppedPropagationRef:g,required:f,defaultChecked:yi(o)?!1:o,isFormControl:y,bubbleInput:b,setBubbleInput:v};return r.jsx(Z3,{scope:t,...k,children:tL(h)?h(k):s})}var ZS="CheckboxTrigger",e1=C.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},o)=>{const{control:d,value:u,disabled:l,checked:c,required:f,setControl:m,setChecked:h,hasConsumerStoppedPropagationRef:x,isFormControl:w,bubbleInput:j}=Ag(ZS,e),_=ut(o,m),b=C.useRef(c);return C.useEffect(()=>{const v=d==null?void 0:d.form;if(v){const g=()=>h(b.current);return v.addEventListener("reset",g),()=>v.removeEventListener("reset",g)}},[d,h]),r.jsx(nt.button,{type:"button",role:"checkbox","aria-checked":yi(c)?"mixed":c,"aria-required":f,"data-state":i1(c),"data-disabled":l?"":void 0,disabled:l,value:u,...s,ref:_,onKeyDown:Oe(t,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:Oe(n,v=>{h(g=>yi(g)?!0:!g),j&&w&&(x.current=v.isPropagationStopped(),x.current||v.stopPropagation())})})});e1.displayName=ZS;var Tg=C.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:o,defaultChecked:d,required:u,disabled:l,value:c,onCheckedChange:f,form:m,...h}=e;return r.jsx(eL,{__scopeCheckbox:n,checked:o,defaultChecked:d,disabled:l,required:u,onCheckedChange:f,name:s,form:m,value:c,internal_do_not_use_render:({isFormControl:x})=>r.jsxs(r.Fragment,{children:[r.jsx(e1,{...h,ref:t,__scopeCheckbox:n}),x&&r.jsx(s1,{__scopeCheckbox:n})]})})});Tg.displayName=Ru;var t1="CheckboxIndicator",r1=C.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...o}=e,d=Ag(t1,n);return r.jsx(Lr,{present:s||yi(d.checked)||d.checked===!0,children:r.jsx(nt.span,{"data-state":i1(d.checked),"data-disabled":d.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});r1.displayName=t1;var n1="CheckboxBubbleInput",s1=C.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:o,checked:d,defaultChecked:u,required:l,disabled:c,name:f,value:m,form:h,bubbleInput:x,setBubbleInput:w}=Ag(n1,e),j=ut(n,w),_=Eg(d),b=Pg(s);C.useEffect(()=>{const g=x;if(!g)return;const y=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(y,"checked").set,P=!o.current;if(_!==d&&E){const T=new Event("click",{bubbles:P});g.indeterminate=yi(d),E.call(g,yi(d)?!1:d),g.dispatchEvent(T)}},[x,_,d,o]);const v=C.useRef(yi(d)?!1:d);return r.jsx(nt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??v.current,required:l,disabled:c,name:f,value:m,form:h,...t,tabIndex:-1,ref:j,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});s1.displayName=n1;function tL(e){return typeof e=="function"}function yi(e){return e==="indeterminate"}function i1(e){return yi(e)?"indeterminate":e?"checked":"unchecked"}const ro=C.forwardRef(({className:e,...t},n)=>r.jsx(Tg,{ref:n,className:Te("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:r.jsx(r1,{className:Te("flex items-center justify-center text-current"),children:r.jsx(Dt,{className:"h-4 w-4"})})}));ro.displayName=Tg.displayName;function Wb(e){const t=rL(e),n=C.forwardRef((s,o)=>{const{children:d,...u}=s,l=C.Children.toArray(d),c=l.find(sL);if(c){const f=c.props.children,m=l.map(h=>h===c?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:h);return r.jsx(t,{...u,ref:o,children:C.isValidElement(f)?C.cloneElement(f,void 0,m):null})}return r.jsx(t,{...u,ref:o,children:d})});return n.displayName=`${e}.Slot`,n}function rL(e){const t=C.forwardRef((n,s)=>{const{children:o,...d}=n;if(C.isValidElement(o)){const u=oL(o),l=iL(d,o.props);return o.type!==C.Fragment&&(l.ref=s?Ys(s,u):u),C.cloneElement(o,l)}return C.Children.count(o)>1?C.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nL=Symbol("radix.slottable");function sL(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nL}function iL(e,t){const n={...t};for(const s in t){const o=e[s],d=t[s];/^on[A-Z]/.test(s)?o&&d?n[s]=(...l)=>{const c=d(...l);return o(...l),c}:o&&(n[s]=o):s==="style"?n[s]={...o,...d}:s==="className"&&(n[s]=[o,d].filter(Boolean).join(" "))}return{...e,...n}}function oL(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Rg(e){const t=e+"CollectionProvider",[n,s]=hn(t),[o,d]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=_=>{const{scope:b,children:v}=_,g=De.useRef(null),y=De.useRef(new Map).current;return r.jsx(o,{scope:b,itemMap:y,collectionRef:g,children:v})};u.displayName=t;const l=e+"CollectionSlot",c=Wb(l),f=De.forwardRef((_,b)=>{const{scope:v,children:g}=_,y=d(l,v),k=ut(b,y.collectionRef);return r.jsx(c,{ref:k,children:g})});f.displayName=l;const m=e+"CollectionItemSlot",h="data-radix-collection-item",x=Wb(m),w=De.forwardRef((_,b)=>{const{scope:v,children:g,...y}=_,k=De.useRef(null),E=ut(b,k),P=d(m,v);return De.useEffect(()=>(P.itemMap.set(k,{ref:k,...y}),()=>void P.itemMap.delete(k))),r.jsx(x,{[h]:"",ref:E,children:g})});w.displayName=m;function j(_){const b=d(e+"CollectionConsumer",_);return De.useCallback(()=>{const g=b.collectionRef.current;if(!g)return[];const y=Array.from(g.querySelectorAll(`[${h}]`));return Array.from(b.itemMap.values()).sort((P,T)=>y.indexOf(P.ref.current)-y.indexOf(T.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:u,Slot:f,ItemSlot:w},j,s]}const aL=["top","right","bottom","left"],Ci=Math.min,wn=Math.max,ru=Math.round,Nd=Math.floor,ys=e=>({x:e,y:e}),lL={left:"right",right:"left",bottom:"top",top:"bottom"},cL={start:"end",end:"start"};function sp(e,t,n){return wn(e,Ci(t,n))}function Vs(e,t){return typeof e=="function"?e(t):e}function Gs(e){return e.split("-")[0]}function ua(e){return e.split("-")[1]}function Mg(e){return e==="x"?"y":"x"}function Dg(e){return e==="y"?"height":"width"}const dL=new Set(["top","bottom"]);function gs(e){return dL.has(Gs(e))?"y":"x"}function Ig(e){return Mg(gs(e))}function uL(e,t,n){n===void 0&&(n=!1);const s=ua(e),o=Ig(e),d=Dg(o);let u=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[d]>t.floating[d]&&(u=nu(u)),[u,nu(u)]}function hL(e){const t=nu(e);return[ip(e),t,ip(t)]}function ip(e){return e.replace(/start|end/g,t=>cL[t])}const Ub=["left","right"],Vb=["right","left"],fL=["top","bottom"],mL=["bottom","top"];function pL(e,t,n){switch(e){case"top":case"bottom":return n?t?Vb:Ub:t?Ub:Vb;case"left":case"right":return t?fL:mL;default:return[]}}function gL(e,t,n,s){const o=ua(e);let d=pL(Gs(e),n==="start",s);return o&&(d=d.map(u=>u+"-"+o),t&&(d=d.concat(d.map(ip)))),d}function nu(e){return e.replace(/left|right|bottom|top/g,t=>lL[t])}function xL(e){return{top:0,right:0,bottom:0,left:0,...e}}function o1(e){return typeof e!="number"?xL(e):{top:e,right:e,bottom:e,left:e}}function su(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function Gb(e,t,n){let{reference:s,floating:o}=e;const d=gs(t),u=Ig(t),l=Dg(u),c=Gs(t),f=d==="y",m=s.x+s.width/2-o.width/2,h=s.y+s.height/2-o.height/2,x=s[l]/2-o[l]/2;let w;switch(c){case"top":w={x:m,y:s.y-o.height};break;case"bottom":w={x:m,y:s.y+s.height};break;case"right":w={x:s.x+s.width,y:h};break;case"left":w={x:s.x-o.width,y:h};break;default:w={x:s.x,y:s.y}}switch(ua(t)){case"start":w[u]-=x*(n&&f?-1:1);break;case"end":w[u]+=x*(n&&f?-1:1);break}return w}async function vL(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:d,rects:u,elements:l,strategy:c}=e,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:h="floating",altBoundary:x=!1,padding:w=0}=Vs(t,e),j=o1(w),b=l[x?h==="floating"?"reference":"floating":h],v=su(await d.getClippingRect({element:(n=await(d.isElement==null?void 0:d.isElement(b)))==null||n?b:b.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(l.floating)),boundary:f,rootBoundary:m,strategy:c})),g=h==="floating"?{x:s,y:o,width:u.floating.width,height:u.floating.height}:u.reference,y=await(d.getOffsetParent==null?void 0:d.getOffsetParent(l.floating)),k=await(d.isElement==null?void 0:d.isElement(y))?await(d.getScale==null?void 0:d.getScale(y))||{x:1,y:1}:{x:1,y:1},E=su(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:g,offsetParent:y,strategy:c}):g);return{top:(v.top-E.top+j.top)/k.y,bottom:(E.bottom-v.bottom+j.bottom)/k.y,left:(v.left-E.left+j.left)/k.x,right:(E.right-v.right+j.right)/k.x}}const yL=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:d=[],platform:u}=n,l=d.filter(Boolean),c=await(u.isRTL==null?void 0:u.isRTL(t));let f=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:h}=Gb(f,s,c),x=s,w={},j=0;for(let b=0;b<l.length;b++){var _;const{name:v,fn:g}=l[b],{x:y,y:k,data:E,reset:P}=await g({x:m,y:h,initialPlacement:s,placement:x,strategy:o,middlewareData:w,rects:f,platform:{...u,detectOverflow:(_=u.detectOverflow)!=null?_:vL},elements:{reference:e,floating:t}});m=y??m,h=k??h,w={...w,[v]:{...w[v],...E}},P&&j<=50&&(j++,typeof P=="object"&&(P.placement&&(x=P.placement),P.rects&&(f=P.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:o}):P.rects),{x:m,y:h}=Gb(f,x,c)),b=-1)}return{x:m,y:h,placement:x,strategy:o,middlewareData:w}},bL=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:d,platform:u,elements:l,middlewareData:c}=t,{element:f,padding:m=0}=Vs(e,t)||{};if(f==null)return{};const h=o1(m),x={x:n,y:s},w=Ig(o),j=Dg(w),_=await u.getDimensions(f),b=w==="y",v=b?"top":"left",g=b?"bottom":"right",y=b?"clientHeight":"clientWidth",k=d.reference[j]+d.reference[w]-x[w]-d.floating[j],E=x[w]-d.reference[w],P=await(u.getOffsetParent==null?void 0:u.getOffsetParent(f));let T=P?P[y]:0;(!T||!await(u.isElement==null?void 0:u.isElement(P)))&&(T=l.floating[y]||d.floating[j]);const N=k/2-E/2,M=T/2-_[j]/2-1,I=Ci(h[v],M),O=Ci(h[g],M),B=I,z=T-_[j]-O,q=T/2-_[j]/2+N,H=sp(B,q,z),G=!c.arrow&&ua(o)!=null&&q!==H&&d.reference[j]/2-(q<B?I:O)-_[j]/2<0,J=G?q<B?q-B:q-z:0;return{[w]:x[w]+J,data:{[w]:H,centerOffset:q-H-J,...G&&{alignmentOffset:J}},reset:G}}}),wL=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:d,rects:u,initialPlacement:l,platform:c,elements:f}=t,{mainAxis:m=!0,crossAxis:h=!0,fallbackPlacements:x,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:_=!0,...b}=Vs(e,t);if((n=d.arrow)!=null&&n.alignmentOffset)return{};const v=Gs(o),g=gs(l),y=Gs(l)===l,k=await(c.isRTL==null?void 0:c.isRTL(f.floating)),E=x||(y||!_?[nu(l)]:hL(l)),P=j!=="none";!x&&P&&E.push(...gL(l,_,j,k));const T=[l,...E],N=await c.detectOverflow(t,b),M=[];let I=((s=d.flip)==null?void 0:s.overflows)||[];if(m&&M.push(N[v]),h){const q=uL(o,u,k);M.push(N[q[0]],N[q[1]])}if(I=[...I,{placement:o,overflows:M}],!M.every(q=>q<=0)){var O,B;const q=(((O=d.flip)==null?void 0:O.index)||0)+1,H=T[q];if(H&&(!(h==="alignment"?g!==gs(H):!1)||I.every(K=>gs(K.placement)===g?K.overflows[0]>0:!0)))return{data:{index:q,overflows:I},reset:{placement:H}};let G=(B=I.filter(J=>J.overflows[0]<=0).sort((J,K)=>J.overflows[1]-K.overflows[1])[0])==null?void 0:B.placement;if(!G)switch(w){case"bestFit":{var z;const J=(z=I.filter(K=>{if(P){const F=gs(K.placement);return F===g||F==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(F=>F>0).reduce((F,R)=>F+R,0)]).sort((K,F)=>K[1]-F[1])[0])==null?void 0:z[0];J&&(G=J);break}case"initialPlacement":G=l;break}if(o!==G)return{reset:{placement:G}}}return{}}}};function Kb(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function qb(e){return aL.some(t=>e[t]>=0)}const _L=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...d}=Vs(e,t);switch(o){case"referenceHidden":{const u=await s.detectOverflow(t,{...d,elementContext:"reference"}),l=Kb(u,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:qb(l)}}}case"escaped":{const u=await s.detectOverflow(t,{...d,altBoundary:!0}),l=Kb(u,n.floating);return{data:{escapedOffsets:l,escaped:qb(l)}}}default:return{}}}}},a1=new Set(["left","top"]);async function CL(e,t){const{placement:n,platform:s,elements:o}=e,d=await(s.isRTL==null?void 0:s.isRTL(o.floating)),u=Gs(n),l=ua(n),c=gs(n)==="y",f=a1.has(u)?-1:1,m=d&&c?-1:1,h=Vs(t,e);let{mainAxis:x,crossAxis:w,alignmentAxis:j}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof j=="number"&&(w=l==="end"?j*-1:j),c?{x:w*m,y:x*f}:{x:x*f,y:w*m}}const SL=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:d,placement:u,middlewareData:l}=t,c=await CL(t,e);return u===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:o+c.x,y:d+c.y,data:{...c,placement:u}}}}},kL=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:d}=t,{mainAxis:u=!0,crossAxis:l=!1,limiter:c={fn:v=>{let{x:g,y}=v;return{x:g,y}}},...f}=Vs(e,t),m={x:n,y:s},h=await d.detectOverflow(t,f),x=gs(Gs(o)),w=Mg(x);let j=m[w],_=m[x];if(u){const v=w==="y"?"top":"left",g=w==="y"?"bottom":"right",y=j+h[v],k=j-h[g];j=sp(y,j,k)}if(l){const v=x==="y"?"top":"left",g=x==="y"?"bottom":"right",y=_+h[v],k=_-h[g];_=sp(y,_,k)}const b=c.fn({...t,[w]:j,[x]:_});return{...b,data:{x:b.x-n,y:b.y-s,enabled:{[w]:u,[x]:l}}}}}},jL=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:d,middlewareData:u}=t,{offset:l=0,mainAxis:c=!0,crossAxis:f=!0}=Vs(e,t),m={x:n,y:s},h=gs(o),x=Mg(h);let w=m[x],j=m[h];const _=Vs(l,t),b=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(c){const y=x==="y"?"height":"width",k=d.reference[x]-d.floating[y]+b.mainAxis,E=d.reference[x]+d.reference[y]-b.mainAxis;w<k?w=k:w>E&&(w=E)}if(f){var v,g;const y=x==="y"?"width":"height",k=a1.has(Gs(o)),E=d.reference[h]-d.floating[y]+(k&&((v=u.offset)==null?void 0:v[h])||0)+(k?0:b.crossAxis),P=d.reference[h]+d.reference[y]+(k?0:((g=u.offset)==null?void 0:g[h])||0)-(k?b.crossAxis:0);j<E?j=E:j>P&&(j=P)}return{[x]:w,[h]:j}}}},NL=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:d,platform:u,elements:l}=t,{apply:c=()=>{},...f}=Vs(e,t),m=await u.detectOverflow(t,f),h=Gs(o),x=ua(o),w=gs(o)==="y",{width:j,height:_}=d.floating;let b,v;h==="top"||h==="bottom"?(b=h,v=x===(await(u.isRTL==null?void 0:u.isRTL(l.floating))?"start":"end")?"left":"right"):(v=h,b=x==="end"?"top":"bottom");const g=_-m.top-m.bottom,y=j-m.left-m.right,k=Ci(_-m[b],g),E=Ci(j-m[v],y),P=!t.middlewareData.shift;let T=k,N=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=y),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(T=g),P&&!x){const I=wn(m.left,0),O=wn(m.right,0),B=wn(m.top,0),z=wn(m.bottom,0);w?N=j-2*(I!==0||O!==0?I+O:wn(m.left,m.right)):T=_-2*(B!==0||z!==0?B+z:wn(m.top,m.bottom))}await c({...t,availableWidth:N,availableHeight:T});const M=await u.getDimensions(l.floating);return j!==M.width||_!==M.height?{reset:{rects:!0}}:{}}}};function Mu(){return typeof window<"u"}function ha(e){return l1(e)?(e.nodeName||"").toLowerCase():"#document"}function jn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ns(e){var t;return(t=(l1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function l1(e){return Mu()?e instanceof Node||e instanceof jn(e).Node:!1}function rs(e){return Mu()?e instanceof Element||e instanceof jn(e).Element:!1}function _s(e){return Mu()?e instanceof HTMLElement||e instanceof jn(e).HTMLElement:!1}function Yb(e){return!Mu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof jn(e).ShadowRoot}const EL=new Set(["inline","contents"]);function Yl(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!EL.has(o)}const PL=new Set(["table","td","th"]);function AL(e){return PL.has(ha(e))}const TL=[":popover-open",":modal"];function Du(e){return TL.some(t=>{try{return e.matches(t)}catch{return!1}})}const RL=["transform","translate","scale","rotate","perspective"],ML=["transform","translate","scale","rotate","perspective","filter"],DL=["paint","layout","strict","content"];function Lg(e){const t=Og(),n=rs(e)?ns(e):e;return RL.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ML.some(s=>(n.willChange||"").includes(s))||DL.some(s=>(n.contain||"").includes(s))}function IL(e){let t=Si(e);for(;_s(t)&&!na(t);){if(Lg(t))return t;if(Du(t))return null;t=Si(t)}return null}function Og(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const LL=new Set(["html","body","#document"]);function na(e){return LL.has(ha(e))}function ns(e){return jn(e).getComputedStyle(e)}function Iu(e){return rs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Si(e){if(ha(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Yb(e)&&e.host||Ns(e);return Yb(t)?t.host:t}function c1(e){const t=Si(e);return na(t)?e.ownerDocument?e.ownerDocument.body:e.body:_s(t)&&Yl(t)?t:c1(t)}function Pl(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=c1(e),d=o===((s=e.ownerDocument)==null?void 0:s.body),u=jn(o);if(d){const l=op(u);return t.concat(u,u.visualViewport||[],Yl(o)?o:[],l&&n?Pl(l):[])}return t.concat(o,Pl(o,[],n))}function op(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function d1(e){const t=ns(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=_s(e),d=o?e.offsetWidth:n,u=o?e.offsetHeight:s,l=ru(n)!==d||ru(s)!==u;return l&&(n=d,s=u),{width:n,height:s,$:l}}function Fg(e){return rs(e)?e:e.contextElement}function Ko(e){const t=Fg(e);if(!_s(t))return ys(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:d}=d1(t);let u=(d?ru(n.width):n.width)/s,l=(d?ru(n.height):n.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!l||!Number.isFinite(l))&&(l=1),{x:u,y:l}}const OL=ys(0);function u1(e){const t=jn(e);return!Og()||!t.visualViewport?OL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function FL(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==jn(e)?!1:t}function no(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),d=Fg(e);let u=ys(1);t&&(s?rs(s)&&(u=Ko(s)):u=Ko(e));const l=FL(d,n,s)?u1(d):ys(0);let c=(o.left+l.x)/u.x,f=(o.top+l.y)/u.y,m=o.width/u.x,h=o.height/u.y;if(d){const x=jn(d),w=s&&rs(s)?jn(s):s;let j=x,_=op(j);for(;_&&s&&w!==j;){const b=Ko(_),v=_.getBoundingClientRect(),g=ns(_),y=v.left+(_.clientLeft+parseFloat(g.paddingLeft))*b.x,k=v.top+(_.clientTop+parseFloat(g.paddingTop))*b.y;c*=b.x,f*=b.y,m*=b.x,h*=b.y,c+=y,f+=k,j=jn(_),_=op(j)}}return su({width:m,height:h,x:c,y:f})}function Lu(e,t){const n=Iu(e).scrollLeft;return t?t.left+n:no(Ns(e)).left+n}function h1(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Lu(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function BL(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const d=o==="fixed",u=Ns(s),l=t?Du(t.floating):!1;if(s===u||l&&d)return n;let c={scrollLeft:0,scrollTop:0},f=ys(1);const m=ys(0),h=_s(s);if((h||!h&&!d)&&((ha(s)!=="body"||Yl(u))&&(c=Iu(s)),_s(s))){const w=no(s);f=Ko(s),m.x=w.x+s.clientLeft,m.y=w.y+s.clientTop}const x=u&&!h&&!d?h1(u,c):ys(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+m.x+x.x,y:n.y*f.y-c.scrollTop*f.y+m.y+x.y}}function $L(e){return Array.from(e.getClientRects())}function zL(e){const t=Ns(e),n=Iu(e),s=e.ownerDocument.body,o=wn(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),d=wn(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let u=-n.scrollLeft+Lu(e);const l=-n.scrollTop;return ns(s).direction==="rtl"&&(u+=wn(t.clientWidth,s.clientWidth)-o),{width:o,height:d,x:u,y:l}}const Xb=25;function HL(e,t){const n=jn(e),s=Ns(e),o=n.visualViewport;let d=s.clientWidth,u=s.clientHeight,l=0,c=0;if(o){d=o.width,u=o.height;const m=Og();(!m||m&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const f=Lu(s);if(f<=0){const m=s.ownerDocument,h=m.body,x=getComputedStyle(h),w=m.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,j=Math.abs(s.clientWidth-h.clientWidth-w);j<=Xb&&(d-=j)}else f<=Xb&&(d+=f);return{width:d,height:u,x:l,y:c}}const WL=new Set(["absolute","fixed"]);function UL(e,t){const n=no(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,d=_s(e)?Ko(e):ys(1),u=e.clientWidth*d.x,l=e.clientHeight*d.y,c=o*d.x,f=s*d.y;return{width:u,height:l,x:c,y:f}}function Jb(e,t,n){let s;if(t==="viewport")s=HL(e,n);else if(t==="document")s=zL(Ns(e));else if(rs(t))s=UL(t,n);else{const o=u1(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return su(s)}function f1(e,t){const n=Si(e);return n===t||!rs(n)||na(n)?!1:ns(n).position==="fixed"||f1(n,t)}function VL(e,t){const n=t.get(e);if(n)return n;let s=Pl(e,[],!1).filter(l=>rs(l)&&ha(l)!=="body"),o=null;const d=ns(e).position==="fixed";let u=d?Si(e):e;for(;rs(u)&&!na(u);){const l=ns(u),c=Lg(u);!c&&l.position==="fixed"&&(o=null),(d?!c&&!o:!c&&l.position==="static"&&!!o&&WL.has(o.position)||Yl(u)&&!c&&f1(e,u))?s=s.filter(m=>m!==u):o=l,u=Si(u)}return t.set(e,s),s}function GL(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const u=[...n==="clippingAncestors"?Du(t)?[]:VL(t,this._c):[].concat(n),s],l=u[0],c=u.reduce((f,m)=>{const h=Jb(t,m,o);return f.top=wn(h.top,f.top),f.right=Ci(h.right,f.right),f.bottom=Ci(h.bottom,f.bottom),f.left=wn(h.left,f.left),f},Jb(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function KL(e){const{width:t,height:n}=d1(e);return{width:t,height:n}}function qL(e,t,n){const s=_s(t),o=Ns(t),d=n==="fixed",u=no(e,!0,d,t);let l={scrollLeft:0,scrollTop:0};const c=ys(0);function f(){c.x=Lu(o)}if(s||!s&&!d)if((ha(t)!=="body"||Yl(o))&&(l=Iu(t)),s){const w=no(t,!0,d,t);c.x=w.x+t.clientLeft,c.y=w.y+t.clientTop}else o&&f();d&&!s&&o&&f();const m=o&&!s&&!d?h1(o,l):ys(0),h=u.left+l.scrollLeft-c.x-m.x,x=u.top+l.scrollTop-c.y-m.y;return{x:h,y:x,width:u.width,height:u.height}}function hm(e){return ns(e).position==="static"}function Qb(e,t){if(!_s(e)||ns(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ns(e)===n&&(n=n.ownerDocument.body),n}function m1(e,t){const n=jn(e);if(Du(e))return n;if(!_s(e)){let o=Si(e);for(;o&&!na(o);){if(rs(o)&&!hm(o))return o;o=Si(o)}return n}let s=Qb(e,t);for(;s&&AL(s)&&hm(s);)s=Qb(s,t);return s&&na(s)&&hm(s)&&!Lg(s)?n:s||IL(e)||n}const YL=async function(e){const t=this.getOffsetParent||m1,n=this.getDimensions,s=await n(e.floating);return{reference:qL(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function XL(e){return ns(e).direction==="rtl"}const JL={convertOffsetParentRelativeRectToViewportRelativeRect:BL,getDocumentElement:Ns,getClippingRect:GL,getOffsetParent:m1,getElementRects:YL,getClientRects:$L,getDimensions:KL,getScale:Ko,isElement:rs,isRTL:XL};function p1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function QL(e,t){let n=null,s;const o=Ns(e);function d(){var l;clearTimeout(s),(l=n)==null||l.disconnect(),n=null}function u(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),d();const f=e.getBoundingClientRect(),{left:m,top:h,width:x,height:w}=f;if(l||t(),!x||!w)return;const j=Nd(h),_=Nd(o.clientWidth-(m+x)),b=Nd(o.clientHeight-(h+w)),v=Nd(m),y={rootMargin:-j+"px "+-_+"px "+-b+"px "+-v+"px",threshold:wn(0,Ci(1,c))||1};let k=!0;function E(P){const T=P[0].intersectionRatio;if(T!==c){if(!k)return u();T?u(!1,T):s=setTimeout(()=>{u(!1,1e-7)},1e3)}T===1&&!p1(f,e.getBoundingClientRect())&&u(),k=!1}try{n=new IntersectionObserver(E,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,y)}n.observe(e)}return u(!0),d}function ZL(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:d=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,f=Fg(e),m=o||d?[...f?Pl(f):[],...Pl(t)]:[];m.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),d&&v.addEventListener("resize",n)});const h=f&&l?QL(f,n):null;let x=-1,w=null;u&&(w=new ResizeObserver(v=>{let[g]=v;g&&g.target===f&&w&&(w.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var y;(y=w)==null||y.observe(t)})),n()}),f&&!c&&w.observe(f),w.observe(t));let j,_=c?no(e):null;c&&b();function b(){const v=no(e);_&&!p1(_,v)&&n(),_=v,j=requestAnimationFrame(b)}return n(),()=>{var v;m.forEach(g=>{o&&g.removeEventListener("scroll",n),d&&g.removeEventListener("resize",n)}),h==null||h(),(v=w)==null||v.disconnect(),w=null,c&&cancelAnimationFrame(j)}}const eO=SL,tO=kL,rO=wL,nO=NL,sO=_L,Zb=bL,iO=jL,oO=(e,t,n)=>{const s=new Map,o={platform:JL,...n},d={...o.platform,_c:s};return yL(e,t,{...o,platform:d})};var aO=typeof document<"u",lO=function(){},Fd=aO?C.useLayoutEffect:lO;function iu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!iu(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const d=o[s];if(!(d==="_owner"&&e.$$typeof)&&!iu(e[d],t[d]))return!1}return!0}return e!==e&&t!==t}function g1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ew(e,t){const n=g1(e);return Math.round(t*n)/n}function fm(e){const t=C.useRef(e);return Fd(()=>{t.current=e}),t}function cO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:d,floating:u}={},transform:l=!0,whileElementsMounted:c,open:f}=e,[m,h]=C.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[x,w]=C.useState(s);iu(x,s)||w(s);const[j,_]=C.useState(null),[b,v]=C.useState(null),g=C.useCallback(K=>{K!==P.current&&(P.current=K,_(K))},[]),y=C.useCallback(K=>{K!==T.current&&(T.current=K,v(K))},[]),k=d||j,E=u||b,P=C.useRef(null),T=C.useRef(null),N=C.useRef(m),M=c!=null,I=fm(c),O=fm(o),B=fm(f),z=C.useCallback(()=>{if(!P.current||!T.current)return;const K={placement:t,strategy:n,middleware:x};O.current&&(K.platform=O.current),oO(P.current,T.current,K).then(F=>{const R={...F,isPositioned:B.current!==!1};q.current&&!iu(N.current,R)&&(N.current=R,Fl.flushSync(()=>{h(R)}))})},[x,t,n,O,B]);Fd(()=>{f===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,h(K=>({...K,isPositioned:!1})))},[f]);const q=C.useRef(!1);Fd(()=>(q.current=!0,()=>{q.current=!1}),[]),Fd(()=>{if(k&&(P.current=k),E&&(T.current=E),k&&E){if(I.current)return I.current(k,E,z);z()}},[k,E,z,I,M]);const H=C.useMemo(()=>({reference:P,floating:T,setReference:g,setFloating:y}),[g,y]),G=C.useMemo(()=>({reference:k,floating:E}),[k,E]),J=C.useMemo(()=>{const K={position:n,left:0,top:0};if(!G.floating)return K;const F=ew(G.floating,m.x),R=ew(G.floating,m.y);return l?{...K,transform:"translate("+F+"px, "+R+"px)",...g1(G.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:R}},[n,l,G.floating,m.x,m.y]);return C.useMemo(()=>({...m,update:z,refs:H,elements:G,floatingStyles:J}),[m,z,H,G,J])}const dO=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:o}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Zb({element:s.current,padding:o}).fn(n):{}:s?Zb({element:s,padding:o}).fn(n):{}}}},uO=(e,t)=>({...eO(e),options:[e,t]}),hO=(e,t)=>({...tO(e),options:[e,t]}),fO=(e,t)=>({...iO(e),options:[e,t]}),mO=(e,t)=>({...rO(e),options:[e,t]}),pO=(e,t)=>({...nO(e),options:[e,t]}),gO=(e,t)=>({...sO(e),options:[e,t]}),xO=(e,t)=>({...dO(e),options:[e,t]});var vO="Arrow",x1=C.forwardRef((e,t)=>{const{children:n,width:s=10,height:o=5,...d}=e;return r.jsx(nt.svg,{...d,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});x1.displayName=vO;var yO=x1,Bg="Popper",[v1,fa]=hn(Bg),[bO,y1]=v1(Bg),b1=e=>{const{__scopePopper:t,children:n}=e,[s,o]=C.useState(null);return r.jsx(bO,{scope:t,anchor:s,onAnchorChange:o,children:n})};b1.displayName=Bg;var w1="PopperAnchor",_1=C.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,d=y1(w1,n),u=C.useRef(null),l=ut(t,u),c=C.useRef(null);return C.useEffect(()=>{const f=c.current;c.current=(s==null?void 0:s.current)||u.current,f!==c.current&&d.onAnchorChange(c.current)}),s?null:r.jsx(nt.div,{...o,ref:l})});_1.displayName=w1;var $g="PopperContent",[wO,_O]=v1($g),C1=C.forwardRef((e,t)=>{var Y,W,le,te,Q,oe;const{__scopePopper:n,side:s="bottom",sideOffset:o=0,align:d="center",alignOffset:u=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:h="partial",hideWhenDetached:x=!1,updatePositionStrategy:w="optimized",onPlaced:j,..._}=e,b=y1($g,n),[v,g]=C.useState(null),y=ut(t,ye=>g(ye)),[k,E]=C.useState(null),P=Pg(k),T=(P==null?void 0:P.width)??0,N=(P==null?void 0:P.height)??0,M=s+(d!=="center"?"-"+d:""),I=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},O=Array.isArray(f)?f:[f],B=O.length>0,z={padding:I,boundary:O.filter(SO),altBoundary:B},{refs:q,floatingStyles:H,placement:G,isPositioned:J,middlewareData:K}=cO({strategy:"fixed",placement:M,whileElementsMounted:(...ye)=>ZL(...ye,{animationFrame:w==="always"}),elements:{reference:b.anchor},middleware:[uO({mainAxis:o+N,alignmentAxis:u}),c&&hO({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?fO():void 0,...z}),c&&mO({...z}),pO({...z,apply:({elements:ye,rects:Be,availableWidth:Ke,availableHeight:ce})=>{const{width:be,height:Qe}=Be.reference,Xe=ye.floating.style;Xe.setProperty("--radix-popper-available-width",`${Ke}px`),Xe.setProperty("--radix-popper-available-height",`${ce}px`),Xe.setProperty("--radix-popper-anchor-width",`${be}px`),Xe.setProperty("--radix-popper-anchor-height",`${Qe}px`)}}),k&&xO({element:k,padding:l}),kO({arrowWidth:T,arrowHeight:N}),x&&gO({strategy:"referenceHidden",...z})]}),[F,R]=j1(G),L=Ir(j);Pr(()=>{J&&(L==null||L())},[J,L]);const V=(Y=K.arrow)==null?void 0:Y.x,$=(W=K.arrow)==null?void 0:W.y,ne=((le=K.arrow)==null?void 0:le.centerOffset)!==0,[he,me]=C.useState();return Pr(()=>{v&&me(window.getComputedStyle(v).zIndex)},[v]),r.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:J?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(te=K.transformOrigin)==null?void 0:te.x,(Q=K.transformOrigin)==null?void 0:Q.y].join(" "),...((oe=K.hide)==null?void 0:oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(wO,{scope:n,placedSide:F,onArrowChange:E,arrowX:V,arrowY:$,shouldHideArrow:ne,children:r.jsx(nt.div,{"data-side":F,"data-align":R,..._,ref:y,style:{..._.style,animation:J?void 0:"none"}})})})});C1.displayName=$g;var S1="PopperArrow",CO={top:"bottom",right:"left",bottom:"top",left:"right"},k1=C.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,d=_O(S1,s),u=CO[d.placedSide];return r.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:r.jsx(yO,{...o,ref:n,style:{...o.style,display:"block"}})})});k1.displayName=S1;function SO(e){return e!==null}var kO=e=>({name:"transformOrigin",options:e,fn(t){var b,v,g;const{placement:n,rects:s,middlewareData:o}=t,u=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=u?0:e.arrowWidth,c=u?0:e.arrowHeight,[f,m]=j1(n),h={start:"0%",center:"50%",end:"100%"}[m],x=(((v=o.arrow)==null?void 0:v.x)??0)+l/2,w=(((g=o.arrow)==null?void 0:g.y)??0)+c/2;let j="",_="";return f==="bottom"?(j=u?h:`${x}px`,_=`${-c}px`):f==="top"?(j=u?h:`${x}px`,_=`${s.floating.height+c}px`):f==="right"?(j=`${-c}px`,_=u?h:`${w}px`):f==="left"&&(j=`${s.floating.width+c}px`,_=u?h:`${w}px`),{data:{x:j,y:_}}}});function j1(e){const[t,n="center"]=e.split("-");return[t,n]}var zg=b1,Hg=_1,Wg=C1,Ug=k1;function jO(e){const t=NO(e),n=C.forwardRef((s,o)=>{const{children:d,...u}=s,l=C.Children.toArray(d),c=l.find(PO);if(c){const f=c.props.children,m=l.map(h=>h===c?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:h);return r.jsx(t,{...u,ref:o,children:C.isValidElement(f)?C.cloneElement(f,void 0,m):null})}return r.jsx(t,{...u,ref:o,children:d})});return n.displayName=`${e}.Slot`,n}function NO(e){const t=C.forwardRef((n,s)=>{const{children:o,...d}=n;if(C.isValidElement(o)){const u=TO(o),l=AO(d,o.props);return o.type!==C.Fragment&&(l.ref=s?Ys(s,u):u),C.cloneElement(o,l)}return C.Children.count(o)>1?C.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var EO=Symbol("radix.slottable");function PO(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===EO}function AO(e,t){const n={...t};for(const s in t){const o=e[s],d=t[s];/^on[A-Z]/.test(s)?o&&d?n[s]=(...l)=>{const c=d(...l);return o(...l),c}:o&&(n[s]=o):s==="style"?n[s]={...o,...d}:s==="className"&&(n[s]=[o,d].filter(Boolean).join(" "))}return{...e,...n}}function TO(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var N1=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),RO="VisuallyHidden",E1=C.forwardRef((e,t)=>r.jsx(nt.span,{...e,ref:t,style:{...N1,...e.style}}));E1.displayName=RO;var MO=E1,DO=[" ","Enter","ArrowUp","ArrowDown"],IO=[" ","Enter"],so="Select",[Ou,Fu,LO]=Rg(so),[ma]=hn(so,[LO,fa]),Bu=fa(),[OO,ji]=ma(so),[FO,BO]=ma(so),P1=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:o,onOpenChange:d,value:u,defaultValue:l,onValueChange:c,dir:f,name:m,autoComplete:h,disabled:x,required:w,form:j}=e,_=Bu(t),[b,v]=C.useState(null),[g,y]=C.useState(null),[k,E]=C.useState(!1),P=Gl(f),[T,N]=ws({prop:s,defaultProp:o??!1,onChange:d,caller:so}),[M,I]=ws({prop:u,defaultProp:l,onChange:c,caller:so}),O=C.useRef(null),B=b?j||!!b.closest("form"):!0,[z,q]=C.useState(new Set),H=Array.from(z).map(G=>G.props.value).join(";");return r.jsx(zg,{..._,children:r.jsxs(OO,{required:w,scope:t,trigger:b,onTriggerChange:v,valueNode:g,onValueNodeChange:y,valueNodeHasChildren:k,onValueNodeHasChildrenChange:E,contentId:Bn(),value:M,onValueChange:I,open:T,onOpenChange:N,dir:P,triggerPointerDownPosRef:O,disabled:x,children:[r.jsx(Ou.Provider,{scope:t,children:r.jsx(FO,{scope:e.__scopeSelect,onNativeOptionAdd:C.useCallback(G=>{q(J=>new Set(J).add(G))},[]),onNativeOptionRemove:C.useCallback(G=>{q(J=>{const K=new Set(J);return K.delete(G),K})},[]),children:n})}),B?r.jsxs(Z1,{"aria-hidden":!0,required:w,tabIndex:-1,name:m,autoComplete:h,value:M,onChange:G=>I(G.target.value),disabled:x,form:j,children:[M===void 0?r.jsx("option",{value:""}):null,Array.from(z)]},H):null]})})};P1.displayName=so;var A1="SelectTrigger",T1=C.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...o}=e,d=Bu(n),u=ji(A1,n),l=u.disabled||s,c=ut(t,u.onTriggerChange),f=Fu(n),m=C.useRef("touch"),[h,x,w]=tk(_=>{const b=f().filter(y=>!y.disabled),v=b.find(y=>y.value===u.value),g=rk(b,_,v);g!==void 0&&u.onValueChange(g.value)}),j=_=>{l||(u.onOpenChange(!0),w()),_&&(u.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return r.jsx(Hg,{asChild:!0,...d,children:r.jsx(nt.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":ek(u.value)?"":void 0,...o,ref:c,onClick:Oe(o.onClick,_=>{_.currentTarget.focus(),m.current!=="mouse"&&j(_)}),onPointerDown:Oe(o.onPointerDown,_=>{m.current=_.pointerType;const b=_.target;b.hasPointerCapture(_.pointerId)&&b.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(j(_),_.preventDefault())}),onKeyDown:Oe(o.onKeyDown,_=>{const b=h.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&x(_.key),!(b&&_.key===" ")&&DO.includes(_.key)&&(j(),_.preventDefault())})})})});T1.displayName=A1;var R1="SelectValue",M1=C.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,children:d,placeholder:u="",...l}=e,c=ji(R1,n),{onValueNodeHasChildrenChange:f}=c,m=d!==void 0,h=ut(t,c.onValueNodeChange);return Pr(()=>{f(m)},[f,m]),r.jsx(nt.span,{...l,ref:h,style:{pointerEvents:"none"},children:ek(c.value)?r.jsx(r.Fragment,{children:u}):d})});M1.displayName=R1;var $O="SelectIcon",D1=C.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...o}=e;return r.jsx(nt.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});D1.displayName=$O;var zO="SelectPortal",I1=e=>r.jsx(ql,{asChild:!0,...e});I1.displayName=zO;var io="SelectContent",L1=C.forwardRef((e,t)=>{const n=ji(io,e.__scopeSelect),[s,o]=C.useState();if(Pr(()=>{o(new DocumentFragment)},[]),!n.open){const d=s;return d?Fl.createPortal(r.jsx(O1,{scope:e.__scopeSelect,children:r.jsx(Ou.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),d):null}return r.jsx(F1,{...e,ref:t})});L1.displayName=io;var es=10,[O1,Ni]=ma(io),HO="SelectContentImpl",WO=jO("SelectContent.RemoveScroll"),F1=C.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:d,onPointerDownOutside:u,side:l,sideOffset:c,align:f,alignOffset:m,arrowPadding:h,collisionBoundary:x,collisionPadding:w,sticky:j,hideWhenDetached:_,avoidCollisions:b,...v}=e,g=ji(io,n),[y,k]=C.useState(null),[E,P]=C.useState(null),T=ut(t,Y=>k(Y)),[N,M]=C.useState(null),[I,O]=C.useState(null),B=Fu(n),[z,q]=C.useState(!1),H=C.useRef(!1);C.useEffect(()=>{if(y)return _g(y)},[y]),wg();const G=C.useCallback(Y=>{const[W,...le]=B().map(oe=>oe.ref.current),[te]=le.slice(-1),Q=document.activeElement;for(const oe of Y)if(oe===Q||(oe==null||oe.scrollIntoView({block:"nearest"}),oe===W&&E&&(E.scrollTop=0),oe===te&&E&&(E.scrollTop=E.scrollHeight),oe==null||oe.focus(),document.activeElement!==Q))return},[B,E]),J=C.useCallback(()=>G([N,y]),[G,N,y]);C.useEffect(()=>{z&&J()},[z,J]);const{onOpenChange:K,triggerPointerDownPosRef:F}=g;C.useEffect(()=>{if(y){let Y={x:0,y:0};const W=te=>{var Q,oe;Y={x:Math.abs(Math.round(te.pageX)-(((Q=F.current)==null?void 0:Q.x)??0)),y:Math.abs(Math.round(te.pageY)-(((oe=F.current)==null?void 0:oe.y)??0))}},le=te=>{Y.x<=10&&Y.y<=10?te.preventDefault():y.contains(te.target)||K(!1),document.removeEventListener("pointermove",W),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",W),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",W),document.removeEventListener("pointerup",le,{capture:!0})}}},[y,K,F]),C.useEffect(()=>{const Y=()=>K(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[K]);const[R,L]=tk(Y=>{const W=B().filter(Q=>!Q.disabled),le=W.find(Q=>Q.ref.current===document.activeElement),te=rk(W,Y,le);te&&setTimeout(()=>te.ref.current.focus())}),V=C.useCallback((Y,W,le)=>{const te=!H.current&&!le;(g.value!==void 0&&g.value===W||te)&&(M(Y),te&&(H.current=!0))},[g.value]),$=C.useCallback(()=>y==null?void 0:y.focus(),[y]),ne=C.useCallback((Y,W,le)=>{const te=!H.current&&!le;(g.value!==void 0&&g.value===W||te)&&O(Y)},[g.value]),he=s==="popper"?ap:B1,me=he===ap?{side:l,sideOffset:c,align:f,alignOffset:m,arrowPadding:h,collisionBoundary:x,collisionPadding:w,sticky:j,hideWhenDetached:_,avoidCollisions:b}:{};return r.jsx(O1,{scope:n,content:y,viewport:E,onViewportChange:P,itemRefCallback:V,selectedItem:N,onItemLeave:$,itemTextRefCallback:ne,focusSelectedItem:J,selectedItemText:I,position:s,isPositioned:z,searchRef:R,children:r.jsx(ju,{as:WO,allowPinchZoom:!0,children:r.jsx(Su,{asChild:!0,trapped:g.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:Oe(o,Y=>{var W;(W=g.trigger)==null||W.focus({preventScroll:!0}),Y.preventDefault()}),children:r.jsx(Kl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:r.jsx(he,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:Y=>Y.preventDefault(),...v,...me,onPlaced:()=>q(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Oe(v.onKeyDown,Y=>{const W=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!W&&Y.key.length===1&&L(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let te=B().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){const Q=Y.target,oe=te.indexOf(Q);te=te.slice(oe+1)}setTimeout(()=>G(te)),Y.preventDefault()}})})})})})})});F1.displayName=HO;var UO="SelectItemAlignedPosition",B1=C.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...o}=e,d=ji(io,n),u=Ni(io,n),[l,c]=C.useState(null),[f,m]=C.useState(null),h=ut(t,T=>m(T)),x=Fu(n),w=C.useRef(!1),j=C.useRef(!0),{viewport:_,selectedItem:b,selectedItemText:v,focusSelectedItem:g}=u,y=C.useCallback(()=>{if(d.trigger&&d.valueNode&&l&&f&&_&&b&&v){const T=d.trigger.getBoundingClientRect(),N=f.getBoundingClientRect(),M=d.valueNode.getBoundingClientRect(),I=v.getBoundingClientRect();if(d.dir!=="rtl"){const Q=I.left-N.left,oe=M.left-Q,ye=T.left-oe,Be=T.width+ye,Ke=Math.max(Be,N.width),ce=window.innerWidth-es,be=tp(oe,[es,Math.max(es,ce-Ke)]);l.style.minWidth=Be+"px",l.style.left=be+"px"}else{const Q=N.right-I.right,oe=window.innerWidth-M.right-Q,ye=window.innerWidth-T.right-oe,Be=T.width+ye,Ke=Math.max(Be,N.width),ce=window.innerWidth-es,be=tp(oe,[es,Math.max(es,ce-Ke)]);l.style.minWidth=Be+"px",l.style.right=be+"px"}const O=x(),B=window.innerHeight-es*2,z=_.scrollHeight,q=window.getComputedStyle(f),H=parseInt(q.borderTopWidth,10),G=parseInt(q.paddingTop,10),J=parseInt(q.borderBottomWidth,10),K=parseInt(q.paddingBottom,10),F=H+G+z+K+J,R=Math.min(b.offsetHeight*5,F),L=window.getComputedStyle(_),V=parseInt(L.paddingTop,10),$=parseInt(L.paddingBottom,10),ne=T.top+T.height/2-es,he=B-ne,me=b.offsetHeight/2,Y=b.offsetTop+me,W=H+G+Y,le=F-W;if(W<=ne){const Q=O.length>0&&b===O[O.length-1].ref.current;l.style.bottom="0px";const oe=f.clientHeight-_.offsetTop-_.offsetHeight,ye=Math.max(he,me+(Q?$:0)+oe+J),Be=W+ye;l.style.height=Be+"px"}else{const Q=O.length>0&&b===O[0].ref.current;l.style.top="0px";const ye=Math.max(ne,H+_.offsetTop+(Q?V:0)+me)+le;l.style.height=ye+"px",_.scrollTop=W-ne+_.offsetTop}l.style.margin=`${es}px 0`,l.style.minHeight=R+"px",l.style.maxHeight=B+"px",s==null||s(),requestAnimationFrame(()=>w.current=!0)}},[x,d.trigger,d.valueNode,l,f,_,b,v,d.dir,s]);Pr(()=>y(),[y]);const[k,E]=C.useState();Pr(()=>{f&&E(window.getComputedStyle(f).zIndex)},[f]);const P=C.useCallback(T=>{T&&j.current===!0&&(y(),g==null||g(),j.current=!1)},[y,g]);return r.jsx(GO,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:P,children:r.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:r.jsx(nt.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});B1.displayName=UO;var VO="SelectPopperPosition",ap=C.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:o=es,...d}=e,u=Bu(n);return r.jsx(Wg,{...u,...d,ref:t,align:s,collisionPadding:o,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});ap.displayName=VO;var[GO,Vg]=ma(io,{}),lp="SelectViewport",$1=C.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...o}=e,d=Ni(lp,n),u=Vg(lp,n),l=ut(t,d.onViewportChange),c=C.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(Ou.Slot,{scope:n,children:r.jsx(nt.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Oe(o.onScroll,f=>{const m=f.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:x}=u;if(x!=null&&x.current&&h){const w=Math.abs(c.current-m.scrollTop);if(w>0){const j=window.innerHeight-es*2,_=parseFloat(h.style.minHeight),b=parseFloat(h.style.height),v=Math.max(_,b);if(v<j){const g=v+w,y=Math.min(j,g),k=g-y;h.style.height=y+"px",h.style.bottom==="0px"&&(m.scrollTop=k>0?k:0,h.style.justifyContent="flex-end")}}}c.current=m.scrollTop})})})]})});$1.displayName=lp;var z1="SelectGroup",[KO,qO]=ma(z1),YO=C.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Bn();return r.jsx(KO,{scope:n,id:o,children:r.jsx(nt.div,{role:"group","aria-labelledby":o,...s,ref:t})})});YO.displayName=z1;var H1="SelectLabel",W1=C.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=qO(H1,n);return r.jsx(nt.div,{id:o.id,...s,ref:t})});W1.displayName=H1;var ou="SelectItem",[XO,U1]=ma(ou),V1=C.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:d,...u}=e,l=ji(ou,n),c=Ni(ou,n),f=l.value===s,[m,h]=C.useState(d??""),[x,w]=C.useState(!1),j=ut(t,g=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,g,s,o)}),_=Bn(),b=C.useRef("touch"),v=()=>{o||(l.onValueChange(s),l.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(XO,{scope:n,value:s,disabled:o,textId:_,isSelected:f,onItemTextChange:C.useCallback(g=>{h(y=>y||((g==null?void 0:g.textContent)??"").trim())},[]),children:r.jsx(Ou.ItemSlot,{scope:n,value:s,disabled:o,textValue:m,children:r.jsx(nt.div,{role:"option","aria-labelledby":_,"data-highlighted":x?"":void 0,"aria-selected":f&&x,"data-state":f?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...u,ref:j,onFocus:Oe(u.onFocus,()=>w(!0)),onBlur:Oe(u.onBlur,()=>w(!1)),onClick:Oe(u.onClick,()=>{b.current!=="mouse"&&v()}),onPointerUp:Oe(u.onPointerUp,()=>{b.current==="mouse"&&v()}),onPointerDown:Oe(u.onPointerDown,g=>{b.current=g.pointerType}),onPointerMove:Oe(u.onPointerMove,g=>{var y;b.current=g.pointerType,o?(y=c.onItemLeave)==null||y.call(c):b.current==="mouse"&&g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Oe(u.onPointerLeave,g=>{var y;g.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:Oe(u.onKeyDown,g=>{var k;((k=c.searchRef)==null?void 0:k.current)!==""&&g.key===" "||(IO.includes(g.key)&&v(),g.key===" "&&g.preventDefault())})})})})});V1.displayName=ou;var hl="SelectItemText",G1=C.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,...d}=e,u=ji(hl,n),l=Ni(hl,n),c=U1(hl,n),f=BO(hl,n),[m,h]=C.useState(null),x=ut(t,v=>h(v),c.onItemTextChange,v=>{var g;return(g=l.itemTextRefCallback)==null?void 0:g.call(l,v,c.value,c.disabled)}),w=m==null?void 0:m.textContent,j=C.useMemo(()=>r.jsx("option",{value:c.value,disabled:c.disabled,children:w},c.value),[c.disabled,c.value,w]),{onNativeOptionAdd:_,onNativeOptionRemove:b}=f;return Pr(()=>(_(j),()=>b(j)),[_,b,j]),r.jsxs(r.Fragment,{children:[r.jsx(nt.span,{id:c.textId,...d,ref:x}),c.isSelected&&u.valueNode&&!u.valueNodeHasChildren?Fl.createPortal(d.children,u.valueNode):null]})});G1.displayName=hl;var K1="SelectItemIndicator",q1=C.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return U1(K1,n).isSelected?r.jsx(nt.span,{"aria-hidden":!0,...s,ref:t}):null});q1.displayName=K1;var cp="SelectScrollUpButton",Y1=C.forwardRef((e,t)=>{const n=Ni(cp,e.__scopeSelect),s=Vg(cp,e.__scopeSelect),[o,d]=C.useState(!1),u=ut(t,s.onScrollButtonChange);return Pr(()=>{if(n.viewport&&n.isPositioned){let l=function(){const f=c.scrollTop>0;d(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?r.jsx(J1,{...e,ref:u,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Y1.displayName=cp;var dp="SelectScrollDownButton",X1=C.forwardRef((e,t)=>{const n=Ni(dp,e.__scopeSelect),s=Vg(dp,e.__scopeSelect),[o,d]=C.useState(!1),u=ut(t,s.onScrollButtonChange);return Pr(()=>{if(n.viewport&&n.isPositioned){let l=function(){const f=c.scrollHeight-c.clientHeight,m=Math.ceil(c.scrollTop)<f;d(m)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?r.jsx(J1,{...e,ref:u,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});X1.displayName=dp;var J1=C.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=e,d=Ni("SelectScrollButton",n),u=C.useRef(null),l=Fu(n),c=C.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return C.useEffect(()=>()=>c(),[c]),Pr(()=>{var m;const f=l().find(h=>h.ref.current===document.activeElement);(m=f==null?void 0:f.ref.current)==null||m.scrollIntoView({block:"nearest"})},[l]),r.jsx(nt.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Oe(o.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(s,50))}),onPointerMove:Oe(o.onPointerMove,()=>{var f;(f=d.onItemLeave)==null||f.call(d),u.current===null&&(u.current=window.setInterval(s,50))}),onPointerLeave:Oe(o.onPointerLeave,()=>{c()})})}),JO="SelectSeparator",Q1=C.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(nt.div,{"aria-hidden":!0,...s,ref:t})});Q1.displayName=JO;var up="SelectArrow",QO=C.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Bu(n),d=ji(up,n),u=Ni(up,n);return d.open&&u.position==="popper"?r.jsx(Ug,{...o,...s,ref:t}):null});QO.displayName=up;var ZO="SelectBubbleInput",Z1=C.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const o=C.useRef(null),d=ut(s,o),u=Eg(t);return C.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(c,"value").set;if(u!==t&&m){const h=new Event("change",{bubbles:!0});m.call(l,t),l.dispatchEvent(h)}},[u,t]),r.jsx(nt.select,{...n,style:{...N1,...n.style},ref:d,defaultValue:t})});Z1.displayName=ZO;function ek(e){return e===""||e===void 0}function tk(e){const t=Ir(e),n=C.useRef(""),s=C.useRef(0),o=C.useCallback(u=>{const l=n.current+u;t(l),(function c(f){n.current=f,window.clearTimeout(s.current),f!==""&&(s.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),d=C.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,o,d]}function rk(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,d=n?e.indexOf(n):-1;let u=e6(e,Math.max(d,0));o.length===1&&(u=u.filter(f=>f!==n));const c=u.find(f=>f.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function e6(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var t6=P1,nk=T1,r6=M1,n6=D1,s6=I1,sk=L1,i6=$1,ik=W1,ok=V1,o6=G1,a6=q1,ak=Y1,lk=X1,ck=Q1;const jr=t6,Nr=r6,gr=C.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(nk,{ref:s,className:Te("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(n6,{asChild:!0,children:r.jsx(pr,{className:"h-4 w-4 opacity-50"})})]}));gr.displayName=nk.displayName;const dk=C.forwardRef(({className:e,...t},n)=>r.jsx(ak,{ref:n,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(b5,{className:"h-4 w-4"})}));dk.displayName=ak.displayName;const uk=C.forwardRef(({className:e,...t},n)=>r.jsx(lk,{ref:n,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(pr,{className:"h-4 w-4"})}));uk.displayName=lk.displayName;const xr=C.forwardRef(({className:e,children:t,position:n="popper",...s},o)=>r.jsx(s6,{children:r.jsxs(sk,{ref:o,className:Te("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[r.jsx(dk,{}),r.jsx(i6,{className:Te("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(uk,{})]})}));xr.displayName=sk.displayName;const l6=C.forwardRef(({className:e,...t},n)=>r.jsx(ik,{ref:n,className:Te("px-2 py-1.5 text-sm font-semibold",e),...t}));l6.displayName=ik.displayName;const Et=C.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(ok,{ref:s,className:Te("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(a6,{children:r.jsx(Dt,{className:"h-4 w-4"})})}),r.jsx(o6,{children:t})]}));Et.displayName=ok.displayName;const c6=C.forwardRef(({className:e,...t},n)=>r.jsx(ck,{ref:n,className:Te("-mx-1 my-1 h-px bg-muted",e),...t}));c6.displayName=ck.displayName;const mm={claude:{name:"Claude Code",folder:".claude",color:"text-orange-600",bg:"bg-orange-50",darkBg:"dark:bg-orange-950/30"},gemini:{name:"Gemini CLI",folder:".gemini",color:"text-blue-600",bg:"bg-blue-50",darkBg:"dark:bg-blue-950/30"},antigravity:{name:"Antigravity",folder:".agent",color:"text-purple-600",bg:"bg-purple-50",darkBg:"dark:bg-purple-950/30"}};function d6({open:e,onOpenChange:t,projectDir:n,onSynced:s}){var N,M,I;const[o,d]=C.useState("claude"),[u,l]=C.useState("antigravity"),[c,f]=C.useState(null),[m,h]=C.useState(!1),[x,w]=C.useState(!1),[j,_]=C.useState(new Set);C.useEffect(()=>{e&&n&&b()},[e,o,u,n]),C.useEffect(()=>{e&&_(new Set)},[e]);const b=async()=>{var O;h(!0);try{const B=await ge.getSyncPreview(n,o,u);f(B);const z=new Set(((O=B.files)==null?void 0:O.filter(q=>q.status==="new"||q.status==="different").map(q=>q.name))||[]);_(z)}catch(B){X.error("Failed to load sync preview: "+B.message),f(null)}finally{h(!1)}},v=()=>{d(u),l(o)},g=O=>{const B=new Set(j);B.has(O)?B.delete(O):B.add(O),_(B)},y=()=>{var O,B;j.size===((O=c==null?void 0:c.files)==null?void 0:O.length)?_(new Set):_(new Set(((B=c==null?void 0:c.files)==null?void 0:B.map(z=>z.name))||[]))},k=async()=>{if(j.size===0){X.error("Please select at least one file to sync");return}w(!0);try{const O=await ge.syncRules(n,o,u,Array.from(j));O.success?(X.success(`Synced ${O.synced.length} file(s) to ${mm[u].name}`),s==null||s(),t(!1)):X.error(O.error||"Sync failed")}catch(O){X.error("Sync failed: "+O.message)}finally{w(!1)}},E=O=>{switch(O){case"new":return r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700",children:"New"});case"different":return r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-yellow-100 text-yellow-700",children:"Modified"});case"identical":return r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-100 dark:bg-slate-700 text-gray-500 dark:text-slate-400",children:"Same"});default:return null}},P=mm[o],T=mm[u];return r.jsx(_t,{open:e,onOpenChange:t,children:r.jsxs(vt,{className:"sm:max-w-lg",children:[r.jsxs(yt,{children:[r.jsxs(bt,{className:"flex items-center gap-2",children:[r.jsx(vr,{className:"w-5 h-5 text-indigo-500"}),"Sync Rules Between Tools"]}),r.jsx(er,{children:"Copy rules from one AI tool's configuration to another."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"From"}),r.jsxs(jr,{value:o,onValueChange:d,children:[r.jsx(gr,{className:"w-full",children:r.jsx(Nr,{})}),r.jsxs(xr,{children:[r.jsx(Et,{value:"claude",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-orange-500"}),"Claude Code"]})}),r.jsx(Et,{value:"gemini",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-blue-500"}),"Gemini CLI"]})}),r.jsx(Et,{value:"antigravity",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-purple-500"}),"Antigravity"]})})]})]})]}),r.jsx(se,{variant:"ghost",size:"icon",onClick:v,className:"mt-5",title:"Swap direction",children:r.jsx(cg,{className:"w-4 h-4"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"To"}),r.jsxs(jr,{value:u,onValueChange:l,children:[r.jsx(gr,{className:"w-full",children:r.jsx(Nr,{})}),r.jsxs(xr,{children:[r.jsx(Et,{value:"claude",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-orange-500"}),"Claude Code"]})}),r.jsx(Et,{value:"gemini",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-blue-500"}),"Gemini CLI"]})}),r.jsx(Et,{value:"antigravity",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-purple-500"}),"Antigravity"]})})]})]})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[r.jsxs("div",{children:["Source: ",r.jsxs("code",{className:"bg-muted px-1 rounded",children:[P.folder,"/rules/"]})]}),r.jsxs("div",{children:["Target: ",r.jsxs("code",{className:"bg-muted px-1 rounded",children:[T.folder,"/rules/"]})]})]}),r.jsxs("div",{className:"border rounded-lg",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b bg-muted/30",children:[r.jsx("span",{className:"text-sm font-medium",children:"Rules to Sync"}),((N=c==null?void 0:c.files)==null?void 0:N.length)>0&&r.jsx(se,{variant:"ghost",size:"sm",onClick:y,className:"h-6 text-xs",children:j.size===c.files.length?"Deselect All":"Select All"})]}),r.jsx("div",{className:"max-h-64 overflow-auto",children:m?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(et,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):c!=null&&c.error?r.jsxs("div",{className:"flex items-center gap-2 p-4 text-sm text-amber-600",children:[r.jsx(Sn,{className:"w-4 h-4"}),c.error]}):((M=c==null?void 0:c.files)==null?void 0:M.length)===0?r.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:"No rules found in source folder"}):r.jsx("div",{className:"divide-y",children:(I=c==null?void 0:c.files)==null?void 0:I.map(O=>r.jsxs("label",{className:Te("flex items-center gap-3 px-3 py-2 cursor-pointer hover:bg-muted/30",j.has(O.name)&&"bg-primary/5"),children:[r.jsx(ro,{checked:j.has(O.name),onCheckedChange:()=>g(O.name)}),r.jsx(Er,{className:"w-4 h-4 text-purple-500"}),r.jsx("span",{className:"flex-1 text-sm",children:O.name}),E(O.status)]},O.name))})})]}),(c==null?void 0:c.files)&&j.size>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.size," file(s) selected for sync"]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(se,{onClick:k,disabled:x||m||j.size===0,children:x?r.jsxs(r.Fragment,{children:[r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}),"Syncing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Dt,{className:"w-4 h-4 mr-2"}),"Sync ",j.size," File(s)"]})})]})]})})}const dt=C.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:Te("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...n}));dt.displayName="Input";function Gg({open:e,onOpenChange:t,onSelect:n,type:s="directory",initialPath:o="~",title:d="Select Path"}){const[u,l]=C.useState(""),[c,f]=C.useState([]),[m,h]=C.useState(!1),[x,w]=C.useState(null),[j,_]=C.useState(""),[b,v]=C.useState("");C.useEffect(()=>{e&&g(o)},[e,o]);const g=async T=>{h(!0),w(null);try{const N=await ge.browse(T,s);N.error?(w(N.error),N.path&&(l(N.path),v(N.path))):(l(N.path),v(N.path),f(N.items||[]),N.home&&_(N.home))}catch(N){w(N.message)}finally{h(!1)}},y=T=>{T.type==="directory"?g(T.path):s==="file"&&(n(T.path),t(!1))},k=()=>{n(u),t(!1)},E=()=>{b&&g(b)},P=T=>{T.key==="Enter"&&E()};return r.jsx(_t,{open:e,onOpenChange:t,children:r.jsxs(vt,{className:"max-w-lg",children:[r.jsx(yt,{children:r.jsxs(bt,{className:"flex items-center gap-2",children:[s==="directory"?r.jsx(Dr,{className:"w-5 h-5"}):r.jsx(Jm,{className:"w-5 h-5"}),d]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:b,onChange:T=>v(T.target.value),onKeyDown:P,placeholder:"Enter path...",className:"font-mono text-sm flex-1"}),r.jsx(se,{variant:"outline",size:"icon",onClick:()=>g(j||"~"),title:"Go to home",children:r.jsx(fg,{className:"w-4 h-4"})}),r.jsx(se,{onClick:E,disabled:m,children:"Go"})]}),r.jsx("div",{className:"text-xs text-gray-500 font-mono truncate px-1",children:u}),x&&r.jsx("div",{className:"text-sm text-red-600 bg-red-50 p-2 rounded",children:x}),r.jsx(Hn,{className:"h-64 border rounded-lg",children:m?r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(et,{className:"w-6 h-6 animate-spin text-gray-400"})}):r.jsx("div",{className:"p-1",children:c.length===0?r.jsx("div",{className:"text-sm text-gray-500 p-4 text-center",children:s==="directory"?"No subdirectories":"No files found"}):c.map((T,N)=>r.jsxs("button",{onClick:()=>y(T),className:"w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-gray-100 rounded transition-colors text-left",children:[T.type==="directory"?r.jsx(Dr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):r.jsx(Jm,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),r.jsx("span",{className:`flex-1 truncate ${T.isParent?"text-gray-500":""}`,children:T.name}),T.type==="directory"&&!T.isParent&&r.jsx(Xr,{className:"w-4 h-4 text-gray-400"})]},N))})})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(se,{onClick:k,disabled:!u,children:s==="directory"?"Select Folder":"Select"})]})]})})}var $u="Switch",[u6]=hn($u),[h6,f6]=u6($u),hk=C.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:o,defaultChecked:d,required:u,disabled:l,value:c="on",onCheckedChange:f,form:m,...h}=e,[x,w]=C.useState(null),j=ut(t,y=>w(y)),_=C.useRef(!1),b=x?m||!!x.closest("form"):!0,[v,g]=ws({prop:o,defaultProp:d??!1,onChange:f,caller:$u});return r.jsxs(h6,{scope:n,checked:v,disabled:l,children:[r.jsx(nt.button,{type:"button",role:"switch","aria-checked":v,"aria-required":u,"data-state":gk(v),"data-disabled":l?"":void 0,disabled:l,value:c,...h,ref:j,onClick:Oe(e.onClick,y=>{g(k=>!k),b&&(_.current=y.isPropagationStopped(),_.current||y.stopPropagation())})}),b&&r.jsx(pk,{control:x,bubbles:!_.current,name:s,value:c,checked:v,required:u,disabled:l,form:m,style:{transform:"translateX(-100%)"}})]})});hk.displayName=$u;var fk="SwitchThumb",mk=C.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,o=f6(fk,n);return r.jsx(nt.span,{"data-state":gk(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t})});mk.displayName=fk;var m6="SwitchBubbleInput",pk=C.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:s=!0,...o},d)=>{const u=C.useRef(null),l=ut(u,d),c=Eg(n),f=Pg(t);return C.useEffect(()=>{const m=u.current;if(!m)return;const h=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==n&&w){const j=new Event("click",{bubbles:s});w.call(m,n),m.dispatchEvent(j)}},[c,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:l,style:{...o.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});pk.displayName=m6;function gk(e){return e?"checked":"unchecked"}var xk=hk,p6=mk;const ft=C.forwardRef(({className:e,...t},n)=>r.jsx(xk,{className:Te("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:r.jsx(p6,{className:Te("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));ft.displayName=xk.displayName;var pm="rovingFocusGroup.onEntryFocus",g6={bubbles:!1,cancelable:!0},Xl="RovingFocusGroup",[hp,vk,x6]=Rg(Xl),[v6,zu]=hn(Xl,[x6]),[y6,b6]=v6(Xl),yk=C.forwardRef((e,t)=>r.jsx(hp.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(hp.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(w6,{...e,ref:t})})}));yk.displayName=Xl;var w6=C.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:d,currentTabStopId:u,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:m=!1,...h}=e,x=C.useRef(null),w=ut(t,x),j=Gl(d),[_,b]=ws({prop:u,defaultProp:l??null,onChange:c,caller:Xl}),[v,g]=C.useState(!1),y=Ir(f),k=vk(n),E=C.useRef(!1),[P,T]=C.useState(0);return C.useEffect(()=>{const N=x.current;if(N)return N.addEventListener(pm,y),()=>N.removeEventListener(pm,y)},[y]),r.jsx(y6,{scope:n,orientation:s,dir:j,loop:o,currentTabStopId:_,onItemFocus:C.useCallback(N=>b(N),[b]),onItemShiftTab:C.useCallback(()=>g(!0),[]),onFocusableItemAdd:C.useCallback(()=>T(N=>N+1),[]),onFocusableItemRemove:C.useCallback(()=>T(N=>N-1),[]),children:r.jsx(nt.div,{tabIndex:v||P===0?-1:0,"data-orientation":s,...h,ref:w,style:{outline:"none",...e.style},onMouseDown:Oe(e.onMouseDown,()=>{E.current=!0}),onFocus:Oe(e.onFocus,N=>{const M=!E.current;if(N.target===N.currentTarget&&M&&!v){const I=new CustomEvent(pm,g6);if(N.currentTarget.dispatchEvent(I),!I.defaultPrevented){const O=k().filter(G=>G.focusable),B=O.find(G=>G.active),z=O.find(G=>G.id===_),H=[B,z,...O].filter(Boolean).map(G=>G.ref.current);_k(H,m)}}E.current=!1}),onBlur:Oe(e.onBlur,()=>g(!1))})})}),bk="RovingFocusGroupItem",wk=C.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:d,children:u,...l}=e,c=Bn(),f=d||c,m=b6(bk,n),h=m.currentTabStopId===f,x=vk(n),{onFocusableItemAdd:w,onFocusableItemRemove:j,currentTabStopId:_}=m;return C.useEffect(()=>{if(s)return w(),()=>j()},[s,w,j]),r.jsx(hp.ItemSlot,{scope:n,id:f,focusable:s,active:o,children:r.jsx(nt.span,{tabIndex:h?0:-1,"data-orientation":m.orientation,...l,ref:t,onMouseDown:Oe(e.onMouseDown,b=>{s?m.onItemFocus(f):b.preventDefault()}),onFocus:Oe(e.onFocus,()=>m.onItemFocus(f)),onKeyDown:Oe(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){m.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const v=S6(b,m.orientation,m.dir);if(v!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let y=x().filter(k=>k.focusable).map(k=>k.ref.current);if(v==="last")y.reverse();else if(v==="prev"||v==="next"){v==="prev"&&y.reverse();const k=y.indexOf(b.currentTarget);y=m.loop?k6(y,k+1):y.slice(k+1)}setTimeout(()=>_k(y))}}),children:typeof u=="function"?u({isCurrentTabStop:h,hasTabStop:_!=null}):u})})});wk.displayName=bk;var _6={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function C6(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function S6(e,t,n){const s=C6(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return _6[s]}function _k(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function k6(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Ck=yk,Sk=wk;function j6(e){const t=N6(e),n=C.forwardRef((s,o)=>{const{children:d,...u}=s,l=C.Children.toArray(d),c=l.find(P6);if(c){const f=c.props.children,m=l.map(h=>h===c?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:h);return r.jsx(t,{...u,ref:o,children:C.isValidElement(f)?C.cloneElement(f,void 0,m):null})}return r.jsx(t,{...u,ref:o,children:d})});return n.displayName=`${e}.Slot`,n}function N6(e){const t=C.forwardRef((n,s)=>{const{children:o,...d}=n;if(C.isValidElement(o)){const u=T6(o),l=A6(d,o.props);return o.type!==C.Fragment&&(l.ref=s?Ys(s,u):u),C.cloneElement(o,l)}return C.Children.count(o)>1?C.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var E6=Symbol("radix.slottable");function P6(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===E6}function A6(e,t){const n={...t};for(const s in t){const o=e[s],d=t[s];/^on[A-Z]/.test(s)?o&&d?n[s]=(...l)=>{const c=d(...l);return o(...l),c}:o&&(n[s]=o):s==="style"?n[s]={...o,...d}:s==="className"&&(n[s]=[o,d].filter(Boolean).join(" "))}return{...e,...n}}function T6(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fp=["Enter"," "],R6=["ArrowDown","PageUp","Home"],kk=["ArrowUp","PageDown","End"],M6=[...R6,...kk],D6={ltr:[...fp,"ArrowRight"],rtl:[...fp,"ArrowLeft"]},I6={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Jl="Menu",[Al,L6,O6]=Rg(Jl),[ao,jk]=hn(Jl,[O6,fa,zu]),Hu=fa(),Nk=zu(),[F6,lo]=ao(Jl),[B6,Ql]=ao(Jl),Ek=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:o,onOpenChange:d,modal:u=!0}=e,l=Hu(t),[c,f]=C.useState(null),m=C.useRef(!1),h=Ir(d),x=Gl(o);return C.useEffect(()=>{const w=()=>{m.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>m.current=!1;return document.addEventListener("keydown",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),r.jsx(zg,{...l,children:r.jsx(F6,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:f,children:r.jsx(B6,{scope:t,onClose:C.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:m,dir:x,modal:u,children:s})})})};Ek.displayName=Jl;var $6="MenuAnchor",Kg=C.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,o=Hu(n);return r.jsx(Hg,{...o,...s,ref:t})});Kg.displayName=$6;var qg="MenuPortal",[z6,Pk]=ao(qg,{forceMount:void 0}),Ak=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:o}=e,d=lo(qg,t);return r.jsx(z6,{scope:t,forceMount:n,children:r.jsx(Lr,{present:n||d.open,children:r.jsx(ql,{asChild:!0,container:o,children:s})})})};Ak.displayName=qg;var $n="MenuContent",[H6,Yg]=ao($n),Tk=C.forwardRef((e,t)=>{const n=Pk($n,e.__scopeMenu),{forceMount:s=n.forceMount,...o}=e,d=lo($n,e.__scopeMenu),u=Ql($n,e.__scopeMenu);return r.jsx(Al.Provider,{scope:e.__scopeMenu,children:r.jsx(Lr,{present:s||d.open,children:r.jsx(Al.Slot,{scope:e.__scopeMenu,children:u.modal?r.jsx(W6,{...o,ref:t}):r.jsx(U6,{...o,ref:t})})})})}),W6=C.forwardRef((e,t)=>{const n=lo($n,e.__scopeMenu),s=C.useRef(null),o=ut(t,s);return C.useEffect(()=>{const d=s.current;if(d)return _g(d)},[]),r.jsx(Xg,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Oe(e.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),U6=C.forwardRef((e,t)=>{const n=lo($n,e.__scopeMenu);return r.jsx(Xg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),V6=j6("MenuContent.ScrollLock"),Xg=C.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:o,onOpenAutoFocus:d,onCloseAutoFocus:u,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:x,onDismiss:w,disableOutsideScroll:j,..._}=e,b=lo($n,n),v=Ql($n,n),g=Hu(n),y=Nk(n),k=L6(n),[E,P]=C.useState(null),T=C.useRef(null),N=ut(t,T,b.onContentChange),M=C.useRef(0),I=C.useRef(""),O=C.useRef(0),B=C.useRef(null),z=C.useRef("right"),q=C.useRef(0),H=j?ju:C.Fragment,G=j?{as:V6,allowPinchZoom:!0}:void 0,J=F=>{var Y,W;const R=I.current+F,L=k().filter(le=>!le.disabled),V=document.activeElement,$=(Y=L.find(le=>le.ref.current===V))==null?void 0:Y.textValue,ne=L.map(le=>le.textValue),he=nF(ne,R,$),me=(W=L.find(le=>le.textValue===he))==null?void 0:W.ref.current;(function le(te){I.current=te,window.clearTimeout(M.current),te!==""&&(M.current=window.setTimeout(()=>le(""),1e3))})(R),me&&setTimeout(()=>me.focus())};C.useEffect(()=>()=>window.clearTimeout(M.current),[]),wg();const K=C.useCallback(F=>{var L,V;return z.current===((L=B.current)==null?void 0:L.side)&&iF(F,(V=B.current)==null?void 0:V.area)},[]);return r.jsx(H6,{scope:n,searchRef:I,onItemEnter:C.useCallback(F=>{K(F)&&F.preventDefault()},[K]),onItemLeave:C.useCallback(F=>{var R;K(F)||((R=T.current)==null||R.focus(),P(null))},[K]),onTriggerLeave:C.useCallback(F=>{K(F)&&F.preventDefault()},[K]),pointerGraceTimerRef:O,onPointerGraceIntentChange:C.useCallback(F=>{B.current=F},[]),children:r.jsx(H,{...G,children:r.jsx(Su,{asChild:!0,trapped:o,onMountAutoFocus:Oe(d,F=>{var R;F.preventDefault(),(R=T.current)==null||R.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:r.jsx(Kl,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:x,onDismiss:w,children:r.jsx(Ck,{asChild:!0,...y,dir:v.dir,orientation:"vertical",loop:s,currentTabStopId:E,onCurrentTabStopIdChange:P,onEntryFocus:Oe(c,F=>{v.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(Wg,{role:"menu","aria-orientation":"vertical","data-state":Kk(b.open),"data-radix-menu-content":"",dir:v.dir,...g,..._,ref:N,style:{outline:"none",..._.style},onKeyDown:Oe(_.onKeyDown,F=>{const L=F.target.closest("[data-radix-menu-content]")===F.currentTarget,V=F.ctrlKey||F.altKey||F.metaKey,$=F.key.length===1;L&&(F.key==="Tab"&&F.preventDefault(),!V&&$&&J(F.key));const ne=T.current;if(F.target!==ne||!M6.includes(F.key))return;F.preventDefault();const me=k().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);kk.includes(F.key)&&me.reverse(),tF(me)}),onBlur:Oe(e.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(M.current),I.current="")}),onPointerMove:Oe(e.onPointerMove,Tl(F=>{const R=F.target,L=q.current!==F.clientX;if(F.currentTarget.contains(R)&&L){const V=F.clientX>q.current?"right":"left";z.current=V,q.current=F.clientX}}))})})})})})})});Tk.displayName=$n;var G6="MenuGroup",Jg=C.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(nt.div,{role:"group",...s,ref:t})});Jg.displayName=G6;var K6="MenuLabel",Rk=C.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(nt.div,{...s,ref:t})});Rk.displayName=K6;var au="MenuItem",tw="menu.itemSelect",Wu=C.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...o}=e,d=C.useRef(null),u=Ql(au,e.__scopeMenu),l=Yg(au,e.__scopeMenu),c=ut(t,d),f=C.useRef(!1),m=()=>{const h=d.current;if(!n&&h){const x=new CustomEvent(tw,{bubbles:!0,cancelable:!0});h.addEventListener(tw,w=>s==null?void 0:s(w),{once:!0}),lS(h,x),x.defaultPrevented?f.current=!1:u.onClose()}};return r.jsx(Mk,{...o,ref:c,disabled:n,onClick:Oe(e.onClick,m),onPointerDown:h=>{var x;(x=e.onPointerDown)==null||x.call(e,h),f.current=!0},onPointerUp:Oe(e.onPointerUp,h=>{var x;f.current||(x=h.currentTarget)==null||x.click()}),onKeyDown:Oe(e.onKeyDown,h=>{const x=l.searchRef.current!=="";n||x&&h.key===" "||fp.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Wu.displayName=au;var Mk=C.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:o,...d}=e,u=Yg(au,n),l=Nk(n),c=C.useRef(null),f=ut(t,c),[m,h]=C.useState(!1),[x,w]=C.useState("");return C.useEffect(()=>{const j=c.current;j&&w((j.textContent??"").trim())},[d.children]),r.jsx(Al.ItemSlot,{scope:n,disabled:s,textValue:o??x,children:r.jsx(Sk,{asChild:!0,...l,focusable:!s,children:r.jsx(nt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...d,ref:f,onPointerMove:Oe(e.onPointerMove,Tl(j=>{s?u.onItemLeave(j):(u.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Oe(e.onPointerLeave,Tl(j=>u.onItemLeave(j))),onFocus:Oe(e.onFocus,()=>h(!0)),onBlur:Oe(e.onBlur,()=>h(!1))})})})}),q6="MenuCheckboxItem",Dk=C.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...o}=e;return r.jsx(Bk,{scope:e.__scopeMenu,checked:n,children:r.jsx(Wu,{role:"menuitemcheckbox","aria-checked":lu(n)?"mixed":n,...o,ref:t,"data-state":Zg(n),onSelect:Oe(o.onSelect,()=>s==null?void 0:s(lu(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Dk.displayName=q6;var Ik="MenuRadioGroup",[Y6,X6]=ao(Ik,{value:void 0,onValueChange:()=>{}}),Lk=C.forwardRef((e,t)=>{const{value:n,onValueChange:s,...o}=e,d=Ir(s);return r.jsx(Y6,{scope:e.__scopeMenu,value:n,onValueChange:d,children:r.jsx(Jg,{...o,ref:t})})});Lk.displayName=Ik;var Ok="MenuRadioItem",Fk=C.forwardRef((e,t)=>{const{value:n,...s}=e,o=X6(Ok,e.__scopeMenu),d=n===o.value;return r.jsx(Bk,{scope:e.__scopeMenu,checked:d,children:r.jsx(Wu,{role:"menuitemradio","aria-checked":d,...s,ref:t,"data-state":Zg(d),onSelect:Oe(s.onSelect,()=>{var u;return(u=o.onValueChange)==null?void 0:u.call(o,n)},{checkForDefaultPrevented:!1})})})});Fk.displayName=Ok;var Qg="MenuItemIndicator",[Bk,J6]=ao(Qg,{checked:!1}),$k=C.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...o}=e,d=J6(Qg,n);return r.jsx(Lr,{present:s||lu(d.checked)||d.checked===!0,children:r.jsx(nt.span,{...o,ref:t,"data-state":Zg(d.checked)})})});$k.displayName=Qg;var Q6="MenuSeparator",zk=C.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(nt.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});zk.displayName=Q6;var Z6="MenuArrow",Hk=C.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,o=Hu(n);return r.jsx(Ug,{...o,...s,ref:t})});Hk.displayName=Z6;var eF="MenuSub",[SW,Wk]=ao(eF),fl="MenuSubTrigger",Uk=C.forwardRef((e,t)=>{const n=lo(fl,e.__scopeMenu),s=Ql(fl,e.__scopeMenu),o=Wk(fl,e.__scopeMenu),d=Yg(fl,e.__scopeMenu),u=C.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=d,f={__scopeMenu:e.__scopeMenu},m=C.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return C.useEffect(()=>m,[m]),C.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),r.jsx(Kg,{asChild:!0,...f,children:r.jsx(Mk,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Kk(n.open),...e,ref:Ys(t,o.onTriggerChange),onClick:h=>{var x;(x=e.onClick)==null||x.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Oe(e.onPointerMove,Tl(h=>{d.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!u.current&&(d.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Oe(e.onPointerLeave,Tl(h=>{var w,j;m();const x=(w=n.content)==null?void 0:w.getBoundingClientRect();if(x){const _=(j=n.content)==null?void 0:j.dataset.side,b=_==="right",v=b?-5:5,g=x[b?"left":"right"],y=x[b?"right":"left"];d.onPointerGraceIntentChange({area:[{x:h.clientX+v,y:h.clientY},{x:g,y:x.top},{x:y,y:x.top},{x:y,y:x.bottom},{x:g,y:x.bottom}],side:_}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>d.onPointerGraceIntentChange(null),300)}else{if(d.onTriggerLeave(h),h.defaultPrevented)return;d.onPointerGraceIntentChange(null)}})),onKeyDown:Oe(e.onKeyDown,h=>{var w;const x=d.searchRef.current!=="";e.disabled||x&&h.key===" "||D6[s.dir].includes(h.key)&&(n.onOpenChange(!0),(w=n.content)==null||w.focus(),h.preventDefault())})})})});Uk.displayName=fl;var Vk="MenuSubContent",Gk=C.forwardRef((e,t)=>{const n=Pk($n,e.__scopeMenu),{forceMount:s=n.forceMount,...o}=e,d=lo($n,e.__scopeMenu),u=Ql($n,e.__scopeMenu),l=Wk(Vk,e.__scopeMenu),c=C.useRef(null),f=ut(t,c);return r.jsx(Al.Provider,{scope:e.__scopeMenu,children:r.jsx(Lr,{present:s||d.open,children:r.jsx(Al.Slot,{scope:e.__scopeMenu,children:r.jsx(Xg,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:f,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{var h;u.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Oe(e.onFocusOutside,m=>{m.target!==l.trigger&&d.onOpenChange(!1)}),onEscapeKeyDown:Oe(e.onEscapeKeyDown,m=>{u.onClose(),m.preventDefault()}),onKeyDown:Oe(e.onKeyDown,m=>{var w;const h=m.currentTarget.contains(m.target),x=I6[u.dir].includes(m.key);h&&x&&(d.onOpenChange(!1),(w=l.trigger)==null||w.focus(),m.preventDefault())})})})})})});Gk.displayName=Vk;function Kk(e){return e?"open":"closed"}function lu(e){return e==="indeterminate"}function Zg(e){return lu(e)?"indeterminate":e?"checked":"unchecked"}function tF(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function rF(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function nF(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,d=n?e.indexOf(n):-1;let u=rF(e,Math.max(d,0));o.length===1&&(u=u.filter(f=>f!==n));const c=u.find(f=>f.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function sF(e,t){const{x:n,y:s}=e;let o=!1;for(let d=0,u=t.length-1;d<t.length;u=d++){const l=t[d],c=t[u],f=l.x,m=l.y,h=c.x,x=c.y;m>s!=x>s&&n<(h-f)*(s-m)/(x-m)+f&&(o=!o)}return o}function iF(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return sF(n,t)}function Tl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var oF=Ek,aF=Kg,lF=Ak,cF=Tk,dF=Jg,uF=Rk,hF=Wu,fF=Dk,mF=Lk,pF=Fk,gF=$k,xF=zk,vF=Hk,yF=Uk,bF=Gk,Uu="DropdownMenu",[wF]=hn(Uu,[jk]),Jr=jk(),[_F,qk]=wF(Uu),Yk=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:o,defaultOpen:d,onOpenChange:u,modal:l=!0}=e,c=Jr(t),f=C.useRef(null),[m,h]=ws({prop:o,defaultProp:d??!1,onChange:u,caller:Uu});return r.jsx(_F,{scope:t,triggerId:Bn(),triggerRef:f,contentId:Bn(),open:m,onOpenChange:h,onOpenToggle:C.useCallback(()=>h(x=>!x),[h]),modal:l,children:r.jsx(oF,{...c,open:m,onOpenChange:h,dir:s,modal:l,children:n})})};Yk.displayName=Uu;var Xk="DropdownMenuTrigger",Jk=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...o}=e,d=qk(Xk,n),u=Jr(n);return r.jsx(aF,{asChild:!0,...u,children:r.jsx(nt.button,{type:"button",id:d.triggerId,"aria-haspopup":"menu","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":d.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...o,ref:Ys(t,d.triggerRef),onPointerDown:Oe(e.onPointerDown,l=>{!s&&l.button===0&&l.ctrlKey===!1&&(d.onOpenToggle(),d.open||l.preventDefault())}),onKeyDown:Oe(e.onKeyDown,l=>{s||(["Enter"," "].includes(l.key)&&d.onOpenToggle(),l.key==="ArrowDown"&&d.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});Jk.displayName=Xk;var CF="DropdownMenuPortal",Qk=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Jr(t);return r.jsx(lF,{...s,...n})};Qk.displayName=CF;var Zk="DropdownMenuContent",ej=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=qk(Zk,n),d=Jr(n),u=C.useRef(!1);return r.jsx(cF,{id:o.contentId,"aria-labelledby":o.triggerId,...d,...s,ref:t,onCloseAutoFocus:Oe(e.onCloseAutoFocus,l=>{var c;u.current||(c=o.triggerRef.current)==null||c.focus(),u.current=!1,l.preventDefault()}),onInteractOutside:Oe(e.onInteractOutside,l=>{const c=l.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0,m=c.button===2||f;(!o.modal||m)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ej.displayName=Zk;var SF="DropdownMenuGroup",kF=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(dF,{...o,...s,ref:t})});kF.displayName=SF;var jF="DropdownMenuLabel",tj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(uF,{...o,...s,ref:t})});tj.displayName=jF;var NF="DropdownMenuItem",rj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(hF,{...o,...s,ref:t})});rj.displayName=NF;var EF="DropdownMenuCheckboxItem",nj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(fF,{...o,...s,ref:t})});nj.displayName=EF;var PF="DropdownMenuRadioGroup",AF=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(mF,{...o,...s,ref:t})});AF.displayName=PF;var TF="DropdownMenuRadioItem",sj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(pF,{...o,...s,ref:t})});sj.displayName=TF;var RF="DropdownMenuItemIndicator",ij=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(gF,{...o,...s,ref:t})});ij.displayName=RF;var MF="DropdownMenuSeparator",oj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(xF,{...o,...s,ref:t})});oj.displayName=MF;var DF="DropdownMenuArrow",IF=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(vF,{...o,...s,ref:t})});IF.displayName=DF;var LF="DropdownMenuSubTrigger",aj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(yF,{...o,...s,ref:t})});aj.displayName=LF;var OF="DropdownMenuSubContent",lj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(bF,{...o,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});lj.displayName=OF;var FF=Yk,BF=Jk,$F=Qk,cj=ej,dj=tj,uj=rj,hj=nj,fj=sj,mj=ij,pj=oj,gj=aj,xj=lj;const Ks=FF,qs=BF,zF=C.forwardRef(({className:e,inset:t,children:n,...s},o)=>r.jsxs(gj,{ref:o,className:Te("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...s,children:[n,r.jsx(Xr,{className:"ml-auto"})]}));zF.displayName=gj.displayName;const HF=C.forwardRef(({className:e,...t},n)=>r.jsx(xj,{ref:n,className:Te("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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",e),...t}));HF.displayName=xj.displayName;const Cs=C.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx($F,{children:r.jsx(cj,{ref:s,sideOffset:t,className:Te("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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",e),...n})}));Cs.displayName=cj.displayName;const Mt=C.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(uj,{ref:s,className:Te("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));Mt.displayName=uj.displayName;const Rl=C.forwardRef(({className:e,children:t,checked:n,...s},o)=>r.jsxs(hj,{ref:o,className:Te("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(mj,{children:r.jsx(Dt,{className:"h-4 w-4"})})}),t]}));Rl.displayName=hj.displayName;const WF=C.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(fj,{ref:s,className:Te("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(mj,{children:r.jsx(j5,{className:"h-2 w-2 fill-current"})})}),t]}));WF.displayName=fj.displayName;const Ml=C.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(dj,{ref:s,className:Te("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Ml.displayName=dj.displayName;const Yr=C.forwardRef(({className:e,...t},n)=>r.jsx(pj,{ref:n,className:Te("-mx-1 my-1 h-px bg-muted",e),...t}));Yr.displayName=pj.displayName;const rw={development:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",productivity:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",integration:"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400",external:"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",lsp:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400",default:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"};function UF({plugin:e,onToggle:t,isToggling:n,projectDir:s}){const o=rw[e.category]||rw.default;return e.mcpServers||e.lspServers||e.commands,r.jsxs(Uo.div,{layout:!0,initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:`
562
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return C.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},q3="DialogDescriptionWarning",Y3=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${XS(q3).contentName}}.`;return C.useEffect(()=>{var d;const o=(d=e.current)==null?void 0:d.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},JS=LS,X3=FS,jg=$S,Eu=zS,Pu=HS,Au=US,Tu=GS,Ng=qS;const _t=JS,J3=jg,QS=C.forwardRef(({className:e,...t},n)=>r.jsx(Eu,{ref:n,className:Te("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));QS.displayName=Eu.displayName;const vt=C.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(J3,{children:[r.jsx(QS,{}),r.jsxs(Pu,{ref:s,className:Te("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,r.jsxs(Ng,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsx($s,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));vt.displayName=Pu.displayName;const yt=({className:e,...t})=>r.jsx("div",{className:Te("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});yt.displayName="DialogHeader";const At=({className:e,...t})=>r.jsx("div",{className:Te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});At.displayName="DialogFooter";const bt=C.forwardRef(({className:e,...t},n)=>r.jsx(Au,{ref:n,className:Te("text-lg font-semibold leading-none tracking-tight",e),...t}));bt.displayName=Au.displayName;const er=C.forwardRef(({className:e,...t},n)=>r.jsx(Tu,{ref:n,className:Te("text-sm text-muted-foreground",e),...t}));er.displayName=Tu.displayName;function Eg(e){const t=C.useRef({value:e,previous:e});return C.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function Pg(e){const[t,n]=C.useState(void 0);return Pr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const d=o[0];let u,l;if("borderBoxSize"in d){const c=d.borderBoxSize,f=Array.isArray(c)?c[0]:c;u=f.inlineSize,l=f.blockSize}else u=e.offsetWidth,l=e.offsetHeight;n({width:u,height:l})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var Ru="Checkbox",[Q3]=hn(Ru),[Z3,Ag]=Q3(Ru);function eL(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:o,disabled:d,form:u,name:l,onCheckedChange:c,required:f,value:m="on",internal_do_not_use_render:h}=e,[x,w]=ws({prop:n,defaultProp:o??!1,onChange:c,caller:Ru}),[j,_]=C.useState(null),[b,v]=C.useState(null),g=C.useRef(!1),y=j?!!u||!!j.closest("form"):!0,k={checked:x,disabled:d,setChecked:w,control:j,setControl:_,name:l,form:u,value:m,hasConsumerStoppedPropagationRef:g,required:f,defaultChecked:yi(o)?!1:o,isFormControl:y,bubbleInput:b,setBubbleInput:v};return r.jsx(Z3,{scope:t,...k,children:tL(h)?h(k):s})}var ZS="CheckboxTrigger",e1=C.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},o)=>{const{control:d,value:u,disabled:l,checked:c,required:f,setControl:m,setChecked:h,hasConsumerStoppedPropagationRef:x,isFormControl:w,bubbleInput:j}=Ag(ZS,e),_=ut(o,m),b=C.useRef(c);return C.useEffect(()=>{const v=d==null?void 0:d.form;if(v){const g=()=>h(b.current);return v.addEventListener("reset",g),()=>v.removeEventListener("reset",g)}},[d,h]),r.jsx(nt.button,{type:"button",role:"checkbox","aria-checked":yi(c)?"mixed":c,"aria-required":f,"data-state":i1(c),"data-disabled":l?"":void 0,disabled:l,value:u,...s,ref:_,onKeyDown:Oe(t,v=>{v.key==="Enter"&&v.preventDefault()}),onClick:Oe(n,v=>{h(g=>yi(g)?!0:!g),j&&w&&(x.current=v.isPropagationStopped(),x.current||v.stopPropagation())})})});e1.displayName=ZS;var Tg=C.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:o,defaultChecked:d,required:u,disabled:l,value:c,onCheckedChange:f,form:m,...h}=e;return r.jsx(eL,{__scopeCheckbox:n,checked:o,defaultChecked:d,disabled:l,required:u,onCheckedChange:f,name:s,form:m,value:c,internal_do_not_use_render:({isFormControl:x})=>r.jsxs(r.Fragment,{children:[r.jsx(e1,{...h,ref:t,__scopeCheckbox:n}),x&&r.jsx(s1,{__scopeCheckbox:n})]})})});Tg.displayName=Ru;var t1="CheckboxIndicator",r1=C.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...o}=e,d=Ag(t1,n);return r.jsx(Lr,{present:s||yi(d.checked)||d.checked===!0,children:r.jsx(nt.span,{"data-state":i1(d.checked),"data-disabled":d.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});r1.displayName=t1;var n1="CheckboxBubbleInput",s1=C.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:o,checked:d,defaultChecked:u,required:l,disabled:c,name:f,value:m,form:h,bubbleInput:x,setBubbleInput:w}=Ag(n1,e),j=ut(n,w),_=Eg(d),b=Pg(s);C.useEffect(()=>{const g=x;if(!g)return;const y=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(y,"checked").set,P=!o.current;if(_!==d&&E){const T=new Event("click",{bubbles:P});g.indeterminate=yi(d),E.call(g,yi(d)?!1:d),g.dispatchEvent(T)}},[x,_,d,o]);const v=C.useRef(yi(d)?!1:d);return r.jsx(nt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??v.current,required:l,disabled:c,name:f,value:m,form:h,...t,tabIndex:-1,ref:j,style:{...t.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});s1.displayName=n1;function tL(e){return typeof e=="function"}function yi(e){return e==="indeterminate"}function i1(e){return yi(e)?"indeterminate":e?"checked":"unchecked"}const ro=C.forwardRef(({className:e,...t},n)=>r.jsx(Tg,{ref:n,className:Te("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:r.jsx(r1,{className:Te("flex items-center justify-center text-current"),children:r.jsx(Dt,{className:"h-4 w-4"})})}));ro.displayName=Tg.displayName;function Wb(e){const t=rL(e),n=C.forwardRef((s,o)=>{const{children:d,...u}=s,l=C.Children.toArray(d),c=l.find(sL);if(c){const f=c.props.children,m=l.map(h=>h===c?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:h);return r.jsx(t,{...u,ref:o,children:C.isValidElement(f)?C.cloneElement(f,void 0,m):null})}return r.jsx(t,{...u,ref:o,children:d})});return n.displayName=`${e}.Slot`,n}function rL(e){const t=C.forwardRef((n,s)=>{const{children:o,...d}=n;if(C.isValidElement(o)){const u=oL(o),l=iL(d,o.props);return o.type!==C.Fragment&&(l.ref=s?Ys(s,u):u),C.cloneElement(o,l)}return C.Children.count(o)>1?C.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nL=Symbol("radix.slottable");function sL(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nL}function iL(e,t){const n={...t};for(const s in t){const o=e[s],d=t[s];/^on[A-Z]/.test(s)?o&&d?n[s]=(...l)=>{const c=d(...l);return o(...l),c}:o&&(n[s]=o):s==="style"?n[s]={...o,...d}:s==="className"&&(n[s]=[o,d].filter(Boolean).join(" "))}return{...e,...n}}function oL(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Rg(e){const t=e+"CollectionProvider",[n,s]=hn(t),[o,d]=n(t,{collectionRef:{current:null},itemMap:new Map}),u=_=>{const{scope:b,children:v}=_,g=De.useRef(null),y=De.useRef(new Map).current;return r.jsx(o,{scope:b,itemMap:y,collectionRef:g,children:v})};u.displayName=t;const l=e+"CollectionSlot",c=Wb(l),f=De.forwardRef((_,b)=>{const{scope:v,children:g}=_,y=d(l,v),k=ut(b,y.collectionRef);return r.jsx(c,{ref:k,children:g})});f.displayName=l;const m=e+"CollectionItemSlot",h="data-radix-collection-item",x=Wb(m),w=De.forwardRef((_,b)=>{const{scope:v,children:g,...y}=_,k=De.useRef(null),E=ut(b,k),P=d(m,v);return De.useEffect(()=>(P.itemMap.set(k,{ref:k,...y}),()=>void P.itemMap.delete(k))),r.jsx(x,{[h]:"",ref:E,children:g})});w.displayName=m;function j(_){const b=d(e+"CollectionConsumer",_);return De.useCallback(()=>{const g=b.collectionRef.current;if(!g)return[];const y=Array.from(g.querySelectorAll(`[${h}]`));return Array.from(b.itemMap.values()).sort((P,T)=>y.indexOf(P.ref.current)-y.indexOf(T.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:u,Slot:f,ItemSlot:w},j,s]}const aL=["top","right","bottom","left"],Ci=Math.min,wn=Math.max,ru=Math.round,Nd=Math.floor,ys=e=>({x:e,y:e}),lL={left:"right",right:"left",bottom:"top",top:"bottom"},cL={start:"end",end:"start"};function sp(e,t,n){return wn(e,Ci(t,n))}function Vs(e,t){return typeof e=="function"?e(t):e}function Gs(e){return e.split("-")[0]}function ua(e){return e.split("-")[1]}function Mg(e){return e==="x"?"y":"x"}function Dg(e){return e==="y"?"height":"width"}const dL=new Set(["top","bottom"]);function gs(e){return dL.has(Gs(e))?"y":"x"}function Ig(e){return Mg(gs(e))}function uL(e,t,n){n===void 0&&(n=!1);const s=ua(e),o=Ig(e),d=Dg(o);let u=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[d]>t.floating[d]&&(u=nu(u)),[u,nu(u)]}function hL(e){const t=nu(e);return[ip(e),t,ip(t)]}function ip(e){return e.replace(/start|end/g,t=>cL[t])}const Ub=["left","right"],Vb=["right","left"],fL=["top","bottom"],mL=["bottom","top"];function pL(e,t,n){switch(e){case"top":case"bottom":return n?t?Vb:Ub:t?Ub:Vb;case"left":case"right":return t?fL:mL;default:return[]}}function gL(e,t,n,s){const o=ua(e);let d=pL(Gs(e),n==="start",s);return o&&(d=d.map(u=>u+"-"+o),t&&(d=d.concat(d.map(ip)))),d}function nu(e){return e.replace(/left|right|bottom|top/g,t=>lL[t])}function xL(e){return{top:0,right:0,bottom:0,left:0,...e}}function o1(e){return typeof e!="number"?xL(e):{top:e,right:e,bottom:e,left:e}}function su(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function Gb(e,t,n){let{reference:s,floating:o}=e;const d=gs(t),u=Ig(t),l=Dg(u),c=Gs(t),f=d==="y",m=s.x+s.width/2-o.width/2,h=s.y+s.height/2-o.height/2,x=s[l]/2-o[l]/2;let w;switch(c){case"top":w={x:m,y:s.y-o.height};break;case"bottom":w={x:m,y:s.y+s.height};break;case"right":w={x:s.x+s.width,y:h};break;case"left":w={x:s.x-o.width,y:h};break;default:w={x:s.x,y:s.y}}switch(ua(t)){case"start":w[u]-=x*(n&&f?-1:1);break;case"end":w[u]+=x*(n&&f?-1:1);break}return w}async function vL(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:d,rects:u,elements:l,strategy:c}=e,{boundary:f="clippingAncestors",rootBoundary:m="viewport",elementContext:h="floating",altBoundary:x=!1,padding:w=0}=Vs(t,e),j=o1(w),b=l[x?h==="floating"?"reference":"floating":h],v=su(await d.getClippingRect({element:(n=await(d.isElement==null?void 0:d.isElement(b)))==null||n?b:b.contextElement||await(d.getDocumentElement==null?void 0:d.getDocumentElement(l.floating)),boundary:f,rootBoundary:m,strategy:c})),g=h==="floating"?{x:s,y:o,width:u.floating.width,height:u.floating.height}:u.reference,y=await(d.getOffsetParent==null?void 0:d.getOffsetParent(l.floating)),k=await(d.isElement==null?void 0:d.isElement(y))?await(d.getScale==null?void 0:d.getScale(y))||{x:1,y:1}:{x:1,y:1},E=su(d.convertOffsetParentRelativeRectToViewportRelativeRect?await d.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:g,offsetParent:y,strategy:c}):g);return{top:(v.top-E.top+j.top)/k.y,bottom:(E.bottom-v.bottom+j.bottom)/k.y,left:(v.left-E.left+j.left)/k.x,right:(E.right-v.right+j.right)/k.x}}const yL=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:d=[],platform:u}=n,l=d.filter(Boolean),c=await(u.isRTL==null?void 0:u.isRTL(t));let f=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:h}=Gb(f,s,c),x=s,w={},j=0;for(let b=0;b<l.length;b++){var _;const{name:v,fn:g}=l[b],{x:y,y:k,data:E,reset:P}=await g({x:m,y:h,initialPlacement:s,placement:x,strategy:o,middlewareData:w,rects:f,platform:{...u,detectOverflow:(_=u.detectOverflow)!=null?_:vL},elements:{reference:e,floating:t}});m=y??m,h=k??h,w={...w,[v]:{...w[v],...E}},P&&j<=50&&(j++,typeof P=="object"&&(P.placement&&(x=P.placement),P.rects&&(f=P.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:o}):P.rects),{x:m,y:h}=Gb(f,x,c)),b=-1)}return{x:m,y:h,placement:x,strategy:o,middlewareData:w}},bL=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:d,platform:u,elements:l,middlewareData:c}=t,{element:f,padding:m=0}=Vs(e,t)||{};if(f==null)return{};const h=o1(m),x={x:n,y:s},w=Ig(o),j=Dg(w),_=await u.getDimensions(f),b=w==="y",v=b?"top":"left",g=b?"bottom":"right",y=b?"clientHeight":"clientWidth",k=d.reference[j]+d.reference[w]-x[w]-d.floating[j],E=x[w]-d.reference[w],P=await(u.getOffsetParent==null?void 0:u.getOffsetParent(f));let T=P?P[y]:0;(!T||!await(u.isElement==null?void 0:u.isElement(P)))&&(T=l.floating[y]||d.floating[j]);const N=k/2-E/2,M=T/2-_[j]/2-1,I=Ci(h[v],M),O=Ci(h[g],M),B=I,z=T-_[j]-O,q=T/2-_[j]/2+N,H=sp(B,q,z),G=!c.arrow&&ua(o)!=null&&q!==H&&d.reference[j]/2-(q<B?I:O)-_[j]/2<0,J=G?q<B?q-B:q-z:0;return{[w]:x[w]+J,data:{[w]:H,centerOffset:q-H-J,...G&&{alignmentOffset:J}},reset:G}}}),wL=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:d,rects:u,initialPlacement:l,platform:c,elements:f}=t,{mainAxis:m=!0,crossAxis:h=!0,fallbackPlacements:x,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:j="none",flipAlignment:_=!0,...b}=Vs(e,t);if((n=d.arrow)!=null&&n.alignmentOffset)return{};const v=Gs(o),g=gs(l),y=Gs(l)===l,k=await(c.isRTL==null?void 0:c.isRTL(f.floating)),E=x||(y||!_?[nu(l)]:hL(l)),P=j!=="none";!x&&P&&E.push(...gL(l,_,j,k));const T=[l,...E],N=await c.detectOverflow(t,b),M=[];let I=((s=d.flip)==null?void 0:s.overflows)||[];if(m&&M.push(N[v]),h){const q=uL(o,u,k);M.push(N[q[0]],N[q[1]])}if(I=[...I,{placement:o,overflows:M}],!M.every(q=>q<=0)){var O,B;const q=(((O=d.flip)==null?void 0:O.index)||0)+1,H=T[q];if(H&&(!(h==="alignment"?g!==gs(H):!1)||I.every(K=>gs(K.placement)===g?K.overflows[0]>0:!0)))return{data:{index:q,overflows:I},reset:{placement:H}};let G=(B=I.filter(J=>J.overflows[0]<=0).sort((J,K)=>J.overflows[1]-K.overflows[1])[0])==null?void 0:B.placement;if(!G)switch(w){case"bestFit":{var z;const J=(z=I.filter(K=>{if(P){const F=gs(K.placement);return F===g||F==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(F=>F>0).reduce((F,R)=>F+R,0)]).sort((K,F)=>K[1]-F[1])[0])==null?void 0:z[0];J&&(G=J);break}case"initialPlacement":G=l;break}if(o!==G)return{reset:{placement:G}}}return{}}}};function Kb(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function qb(e){return aL.some(t=>e[t]>=0)}const _L=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...d}=Vs(e,t);switch(o){case"referenceHidden":{const u=await s.detectOverflow(t,{...d,elementContext:"reference"}),l=Kb(u,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:qb(l)}}}case"escaped":{const u=await s.detectOverflow(t,{...d,altBoundary:!0}),l=Kb(u,n.floating);return{data:{escapedOffsets:l,escaped:qb(l)}}}default:return{}}}}},a1=new Set(["left","top"]);async function CL(e,t){const{placement:n,platform:s,elements:o}=e,d=await(s.isRTL==null?void 0:s.isRTL(o.floating)),u=Gs(n),l=ua(n),c=gs(n)==="y",f=a1.has(u)?-1:1,m=d&&c?-1:1,h=Vs(t,e);let{mainAxis:x,crossAxis:w,alignmentAxis:j}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof j=="number"&&(w=l==="end"?j*-1:j),c?{x:w*m,y:x*f}:{x:x*f,y:w*m}}const SL=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:d,placement:u,middlewareData:l}=t,c=await CL(t,e);return u===((n=l.offset)==null?void 0:n.placement)&&(s=l.arrow)!=null&&s.alignmentOffset?{}:{x:o+c.x,y:d+c.y,data:{...c,placement:u}}}}},kL=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:d}=t,{mainAxis:u=!0,crossAxis:l=!1,limiter:c={fn:v=>{let{x:g,y}=v;return{x:g,y}}},...f}=Vs(e,t),m={x:n,y:s},h=await d.detectOverflow(t,f),x=gs(Gs(o)),w=Mg(x);let j=m[w],_=m[x];if(u){const v=w==="y"?"top":"left",g=w==="y"?"bottom":"right",y=j+h[v],k=j-h[g];j=sp(y,j,k)}if(l){const v=x==="y"?"top":"left",g=x==="y"?"bottom":"right",y=_+h[v],k=_-h[g];_=sp(y,_,k)}const b=c.fn({...t,[w]:j,[x]:_});return{...b,data:{x:b.x-n,y:b.y-s,enabled:{[w]:u,[x]:l}}}}}},jL=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:d,middlewareData:u}=t,{offset:l=0,mainAxis:c=!0,crossAxis:f=!0}=Vs(e,t),m={x:n,y:s},h=gs(o),x=Mg(h);let w=m[x],j=m[h];const _=Vs(l,t),b=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(c){const y=x==="y"?"height":"width",k=d.reference[x]-d.floating[y]+b.mainAxis,E=d.reference[x]+d.reference[y]-b.mainAxis;w<k?w=k:w>E&&(w=E)}if(f){var v,g;const y=x==="y"?"width":"height",k=a1.has(Gs(o)),E=d.reference[h]-d.floating[y]+(k&&((v=u.offset)==null?void 0:v[h])||0)+(k?0:b.crossAxis),P=d.reference[h]+d.reference[y]+(k?0:((g=u.offset)==null?void 0:g[h])||0)-(k?b.crossAxis:0);j<E?j=E:j>P&&(j=P)}return{[x]:w,[h]:j}}}},NL=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:d,platform:u,elements:l}=t,{apply:c=()=>{},...f}=Vs(e,t),m=await u.detectOverflow(t,f),h=Gs(o),x=ua(o),w=gs(o)==="y",{width:j,height:_}=d.floating;let b,v;h==="top"||h==="bottom"?(b=h,v=x===(await(u.isRTL==null?void 0:u.isRTL(l.floating))?"start":"end")?"left":"right"):(v=h,b=x==="end"?"top":"bottom");const g=_-m.top-m.bottom,y=j-m.left-m.right,k=Ci(_-m[b],g),E=Ci(j-m[v],y),P=!t.middlewareData.shift;let T=k,N=E;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=y),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(T=g),P&&!x){const I=wn(m.left,0),O=wn(m.right,0),B=wn(m.top,0),z=wn(m.bottom,0);w?N=j-2*(I!==0||O!==0?I+O:wn(m.left,m.right)):T=_-2*(B!==0||z!==0?B+z:wn(m.top,m.bottom))}await c({...t,availableWidth:N,availableHeight:T});const M=await u.getDimensions(l.floating);return j!==M.width||_!==M.height?{reset:{rects:!0}}:{}}}};function Mu(){return typeof window<"u"}function ha(e){return l1(e)?(e.nodeName||"").toLowerCase():"#document"}function jn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ns(e){var t;return(t=(l1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function l1(e){return Mu()?e instanceof Node||e instanceof jn(e).Node:!1}function rs(e){return Mu()?e instanceof Element||e instanceof jn(e).Element:!1}function _s(e){return Mu()?e instanceof HTMLElement||e instanceof jn(e).HTMLElement:!1}function Yb(e){return!Mu()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof jn(e).ShadowRoot}const EL=new Set(["inline","contents"]);function Yl(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!EL.has(o)}const PL=new Set(["table","td","th"]);function AL(e){return PL.has(ha(e))}const TL=[":popover-open",":modal"];function Du(e){return TL.some(t=>{try{return e.matches(t)}catch{return!1}})}const RL=["transform","translate","scale","rotate","perspective"],ML=["transform","translate","scale","rotate","perspective","filter"],DL=["paint","layout","strict","content"];function Lg(e){const t=Og(),n=rs(e)?ns(e):e;return RL.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||ML.some(s=>(n.willChange||"").includes(s))||DL.some(s=>(n.contain||"").includes(s))}function IL(e){let t=Si(e);for(;_s(t)&&!na(t);){if(Lg(t))return t;if(Du(t))return null;t=Si(t)}return null}function Og(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const LL=new Set(["html","body","#document"]);function na(e){return LL.has(ha(e))}function ns(e){return jn(e).getComputedStyle(e)}function Iu(e){return rs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Si(e){if(ha(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Yb(e)&&e.host||Ns(e);return Yb(t)?t.host:t}function c1(e){const t=Si(e);return na(t)?e.ownerDocument?e.ownerDocument.body:e.body:_s(t)&&Yl(t)?t:c1(t)}function Pl(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=c1(e),d=o===((s=e.ownerDocument)==null?void 0:s.body),u=jn(o);if(d){const l=op(u);return t.concat(u,u.visualViewport||[],Yl(o)?o:[],l&&n?Pl(l):[])}return t.concat(o,Pl(o,[],n))}function op(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function d1(e){const t=ns(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=_s(e),d=o?e.offsetWidth:n,u=o?e.offsetHeight:s,l=ru(n)!==d||ru(s)!==u;return l&&(n=d,s=u),{width:n,height:s,$:l}}function Fg(e){return rs(e)?e:e.contextElement}function Ko(e){const t=Fg(e);if(!_s(t))return ys(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:d}=d1(t);let u=(d?ru(n.width):n.width)/s,l=(d?ru(n.height):n.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!l||!Number.isFinite(l))&&(l=1),{x:u,y:l}}const OL=ys(0);function u1(e){const t=jn(e);return!Og()||!t.visualViewport?OL:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function FL(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==jn(e)?!1:t}function no(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),d=Fg(e);let u=ys(1);t&&(s?rs(s)&&(u=Ko(s)):u=Ko(e));const l=FL(d,n,s)?u1(d):ys(0);let c=(o.left+l.x)/u.x,f=(o.top+l.y)/u.y,m=o.width/u.x,h=o.height/u.y;if(d){const x=jn(d),w=s&&rs(s)?jn(s):s;let j=x,_=op(j);for(;_&&s&&w!==j;){const b=Ko(_),v=_.getBoundingClientRect(),g=ns(_),y=v.left+(_.clientLeft+parseFloat(g.paddingLeft))*b.x,k=v.top+(_.clientTop+parseFloat(g.paddingTop))*b.y;c*=b.x,f*=b.y,m*=b.x,h*=b.y,c+=y,f+=k,j=jn(_),_=op(j)}}return su({width:m,height:h,x:c,y:f})}function Lu(e,t){const n=Iu(e).scrollLeft;return t?t.left+n:no(Ns(e)).left+n}function h1(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Lu(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function BL(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const d=o==="fixed",u=Ns(s),l=t?Du(t.floating):!1;if(s===u||l&&d)return n;let c={scrollLeft:0,scrollTop:0},f=ys(1);const m=ys(0),h=_s(s);if((h||!h&&!d)&&((ha(s)!=="body"||Yl(u))&&(c=Iu(s)),_s(s))){const w=no(s);f=Ko(s),m.x=w.x+s.clientLeft,m.y=w.y+s.clientTop}const x=u&&!h&&!d?h1(u,c):ys(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-c.scrollLeft*f.x+m.x+x.x,y:n.y*f.y-c.scrollTop*f.y+m.y+x.y}}function $L(e){return Array.from(e.getClientRects())}function zL(e){const t=Ns(e),n=Iu(e),s=e.ownerDocument.body,o=wn(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),d=wn(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let u=-n.scrollLeft+Lu(e);const l=-n.scrollTop;return ns(s).direction==="rtl"&&(u+=wn(t.clientWidth,s.clientWidth)-o),{width:o,height:d,x:u,y:l}}const Xb=25;function HL(e,t){const n=jn(e),s=Ns(e),o=n.visualViewport;let d=s.clientWidth,u=s.clientHeight,l=0,c=0;if(o){d=o.width,u=o.height;const m=Og();(!m||m&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const f=Lu(s);if(f<=0){const m=s.ownerDocument,h=m.body,x=getComputedStyle(h),w=m.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,j=Math.abs(s.clientWidth-h.clientWidth-w);j<=Xb&&(d-=j)}else f<=Xb&&(d+=f);return{width:d,height:u,x:l,y:c}}const WL=new Set(["absolute","fixed"]);function UL(e,t){const n=no(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,d=_s(e)?Ko(e):ys(1),u=e.clientWidth*d.x,l=e.clientHeight*d.y,c=o*d.x,f=s*d.y;return{width:u,height:l,x:c,y:f}}function Jb(e,t,n){let s;if(t==="viewport")s=HL(e,n);else if(t==="document")s=zL(Ns(e));else if(rs(t))s=UL(t,n);else{const o=u1(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return su(s)}function f1(e,t){const n=Si(e);return n===t||!rs(n)||na(n)?!1:ns(n).position==="fixed"||f1(n,t)}function VL(e,t){const n=t.get(e);if(n)return n;let s=Pl(e,[],!1).filter(l=>rs(l)&&ha(l)!=="body"),o=null;const d=ns(e).position==="fixed";let u=d?Si(e):e;for(;rs(u)&&!na(u);){const l=ns(u),c=Lg(u);!c&&l.position==="fixed"&&(o=null),(d?!c&&!o:!c&&l.position==="static"&&!!o&&WL.has(o.position)||Yl(u)&&!c&&f1(e,u))?s=s.filter(m=>m!==u):o=l,u=Si(u)}return t.set(e,s),s}function GL(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const u=[...n==="clippingAncestors"?Du(t)?[]:VL(t,this._c):[].concat(n),s],l=u[0],c=u.reduce((f,m)=>{const h=Jb(t,m,o);return f.top=wn(h.top,f.top),f.right=Ci(h.right,f.right),f.bottom=Ci(h.bottom,f.bottom),f.left=wn(h.left,f.left),f},Jb(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function KL(e){const{width:t,height:n}=d1(e);return{width:t,height:n}}function qL(e,t,n){const s=_s(t),o=Ns(t),d=n==="fixed",u=no(e,!0,d,t);let l={scrollLeft:0,scrollTop:0};const c=ys(0);function f(){c.x=Lu(o)}if(s||!s&&!d)if((ha(t)!=="body"||Yl(o))&&(l=Iu(t)),s){const w=no(t,!0,d,t);c.x=w.x+t.clientLeft,c.y=w.y+t.clientTop}else o&&f();d&&!s&&o&&f();const m=o&&!s&&!d?h1(o,l):ys(0),h=u.left+l.scrollLeft-c.x-m.x,x=u.top+l.scrollTop-c.y-m.y;return{x:h,y:x,width:u.width,height:u.height}}function hm(e){return ns(e).position==="static"}function Qb(e,t){if(!_s(e)||ns(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ns(e)===n&&(n=n.ownerDocument.body),n}function m1(e,t){const n=jn(e);if(Du(e))return n;if(!_s(e)){let o=Si(e);for(;o&&!na(o);){if(rs(o)&&!hm(o))return o;o=Si(o)}return n}let s=Qb(e,t);for(;s&&AL(s)&&hm(s);)s=Qb(s,t);return s&&na(s)&&hm(s)&&!Lg(s)?n:s||IL(e)||n}const YL=async function(e){const t=this.getOffsetParent||m1,n=this.getDimensions,s=await n(e.floating);return{reference:qL(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function XL(e){return ns(e).direction==="rtl"}const JL={convertOffsetParentRelativeRectToViewportRelativeRect:BL,getDocumentElement:Ns,getClippingRect:GL,getOffsetParent:m1,getElementRects:YL,getClientRects:$L,getDimensions:KL,getScale:Ko,isElement:rs,isRTL:XL};function p1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function QL(e,t){let n=null,s;const o=Ns(e);function d(){var l;clearTimeout(s),(l=n)==null||l.disconnect(),n=null}function u(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),d();const f=e.getBoundingClientRect(),{left:m,top:h,width:x,height:w}=f;if(l||t(),!x||!w)return;const j=Nd(h),_=Nd(o.clientWidth-(m+x)),b=Nd(o.clientHeight-(h+w)),v=Nd(m),y={rootMargin:-j+"px "+-_+"px "+-b+"px "+-v+"px",threshold:wn(0,Ci(1,c))||1};let k=!0;function E(P){const T=P[0].intersectionRatio;if(T!==c){if(!k)return u();T?u(!1,T):s=setTimeout(()=>{u(!1,1e-7)},1e3)}T===1&&!p1(f,e.getBoundingClientRect())&&u(),k=!1}try{n=new IntersectionObserver(E,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,y)}n.observe(e)}return u(!0),d}function ZL(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:d=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,f=Fg(e),m=o||d?[...f?Pl(f):[],...Pl(t)]:[];m.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),d&&v.addEventListener("resize",n)});const h=f&&l?QL(f,n):null;let x=-1,w=null;u&&(w=new ResizeObserver(v=>{let[g]=v;g&&g.target===f&&w&&(w.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var y;(y=w)==null||y.observe(t)})),n()}),f&&!c&&w.observe(f),w.observe(t));let j,_=c?no(e):null;c&&b();function b(){const v=no(e);_&&!p1(_,v)&&n(),_=v,j=requestAnimationFrame(b)}return n(),()=>{var v;m.forEach(g=>{o&&g.removeEventListener("scroll",n),d&&g.removeEventListener("resize",n)}),h==null||h(),(v=w)==null||v.disconnect(),w=null,c&&cancelAnimationFrame(j)}}const eO=SL,tO=kL,rO=wL,nO=NL,sO=_L,Zb=bL,iO=jL,oO=(e,t,n)=>{const s=new Map,o={platform:JL,...n},d={...o.platform,_c:s};return yL(e,t,{...o,platform:d})};var aO=typeof document<"u",lO=function(){},Fd=aO?C.useLayoutEffect:lO;function iu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!iu(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const d=o[s];if(!(d==="_owner"&&e.$$typeof)&&!iu(e[d],t[d]))return!1}return!0}return e!==e&&t!==t}function g1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ew(e,t){const n=g1(e);return Math.round(t*n)/n}function fm(e){const t=C.useRef(e);return Fd(()=>{t.current=e}),t}function cO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:d,floating:u}={},transform:l=!0,whileElementsMounted:c,open:f}=e,[m,h]=C.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[x,w]=C.useState(s);iu(x,s)||w(s);const[j,_]=C.useState(null),[b,v]=C.useState(null),g=C.useCallback(K=>{K!==P.current&&(P.current=K,_(K))},[]),y=C.useCallback(K=>{K!==T.current&&(T.current=K,v(K))},[]),k=d||j,E=u||b,P=C.useRef(null),T=C.useRef(null),N=C.useRef(m),M=c!=null,I=fm(c),O=fm(o),B=fm(f),z=C.useCallback(()=>{if(!P.current||!T.current)return;const K={placement:t,strategy:n,middleware:x};O.current&&(K.platform=O.current),oO(P.current,T.current,K).then(F=>{const R={...F,isPositioned:B.current!==!1};q.current&&!iu(N.current,R)&&(N.current=R,Fl.flushSync(()=>{h(R)}))})},[x,t,n,O,B]);Fd(()=>{f===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,h(K=>({...K,isPositioned:!1})))},[f]);const q=C.useRef(!1);Fd(()=>(q.current=!0,()=>{q.current=!1}),[]),Fd(()=>{if(k&&(P.current=k),E&&(T.current=E),k&&E){if(I.current)return I.current(k,E,z);z()}},[k,E,z,I,M]);const H=C.useMemo(()=>({reference:P,floating:T,setReference:g,setFloating:y}),[g,y]),G=C.useMemo(()=>({reference:k,floating:E}),[k,E]),J=C.useMemo(()=>{const K={position:n,left:0,top:0};if(!G.floating)return K;const F=ew(G.floating,m.x),R=ew(G.floating,m.y);return l?{...K,transform:"translate("+F+"px, "+R+"px)",...g1(G.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:R}},[n,l,G.floating,m.x,m.y]);return C.useMemo(()=>({...m,update:z,refs:H,elements:G,floatingStyles:J}),[m,z,H,G,J])}const dO=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:o}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Zb({element:s.current,padding:o}).fn(n):{}:s?Zb({element:s,padding:o}).fn(n):{}}}},uO=(e,t)=>({...eO(e),options:[e,t]}),hO=(e,t)=>({...tO(e),options:[e,t]}),fO=(e,t)=>({...iO(e),options:[e,t]}),mO=(e,t)=>({...rO(e),options:[e,t]}),pO=(e,t)=>({...nO(e),options:[e,t]}),gO=(e,t)=>({...sO(e),options:[e,t]}),xO=(e,t)=>({...dO(e),options:[e,t]});var vO="Arrow",x1=C.forwardRef((e,t)=>{const{children:n,width:s=10,height:o=5,...d}=e;return r.jsx(nt.svg,{...d,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});x1.displayName=vO;var yO=x1,Bg="Popper",[v1,fa]=hn(Bg),[bO,y1]=v1(Bg),b1=e=>{const{__scopePopper:t,children:n}=e,[s,o]=C.useState(null);return r.jsx(bO,{scope:t,anchor:s,onAnchorChange:o,children:n})};b1.displayName=Bg;var w1="PopperAnchor",_1=C.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,d=y1(w1,n),u=C.useRef(null),l=ut(t,u),c=C.useRef(null);return C.useEffect(()=>{const f=c.current;c.current=(s==null?void 0:s.current)||u.current,f!==c.current&&d.onAnchorChange(c.current)}),s?null:r.jsx(nt.div,{...o,ref:l})});_1.displayName=w1;var $g="PopperContent",[wO,_O]=v1($g),C1=C.forwardRef((e,t)=>{var Y,W,le,te,Q,oe;const{__scopePopper:n,side:s="bottom",sideOffset:o=0,align:d="center",alignOffset:u=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:f=[],collisionPadding:m=0,sticky:h="partial",hideWhenDetached:x=!1,updatePositionStrategy:w="optimized",onPlaced:j,..._}=e,b=y1($g,n),[v,g]=C.useState(null),y=ut(t,ye=>g(ye)),[k,E]=C.useState(null),P=Pg(k),T=(P==null?void 0:P.width)??0,N=(P==null?void 0:P.height)??0,M=s+(d!=="center"?"-"+d:""),I=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},O=Array.isArray(f)?f:[f],B=O.length>0,z={padding:I,boundary:O.filter(SO),altBoundary:B},{refs:q,floatingStyles:H,placement:G,isPositioned:J,middlewareData:K}=cO({strategy:"fixed",placement:M,whileElementsMounted:(...ye)=>ZL(...ye,{animationFrame:w==="always"}),elements:{reference:b.anchor},middleware:[uO({mainAxis:o+N,alignmentAxis:u}),c&&hO({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?fO():void 0,...z}),c&&mO({...z}),pO({...z,apply:({elements:ye,rects:Be,availableWidth:Ke,availableHeight:ce})=>{const{width:be,height:Qe}=Be.reference,Xe=ye.floating.style;Xe.setProperty("--radix-popper-available-width",`${Ke}px`),Xe.setProperty("--radix-popper-available-height",`${ce}px`),Xe.setProperty("--radix-popper-anchor-width",`${be}px`),Xe.setProperty("--radix-popper-anchor-height",`${Qe}px`)}}),k&&xO({element:k,padding:l}),kO({arrowWidth:T,arrowHeight:N}),x&&gO({strategy:"referenceHidden",...z})]}),[F,R]=j1(G),L=Ir(j);Pr(()=>{J&&(L==null||L())},[J,L]);const V=(Y=K.arrow)==null?void 0:Y.x,$=(W=K.arrow)==null?void 0:W.y,ne=((le=K.arrow)==null?void 0:le.centerOffset)!==0,[he,me]=C.useState();return Pr(()=>{v&&me(window.getComputedStyle(v).zIndex)},[v]),r.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:J?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(te=K.transformOrigin)==null?void 0:te.x,(Q=K.transformOrigin)==null?void 0:Q.y].join(" "),...((oe=K.hide)==null?void 0:oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(wO,{scope:n,placedSide:F,onArrowChange:E,arrowX:V,arrowY:$,shouldHideArrow:ne,children:r.jsx(nt.div,{"data-side":F,"data-align":R,..._,ref:y,style:{..._.style,animation:J?void 0:"none"}})})})});C1.displayName=$g;var S1="PopperArrow",CO={top:"bottom",right:"left",bottom:"top",left:"right"},k1=C.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,d=_O(S1,s),u=CO[d.placedSide];return r.jsx("span",{ref:d.onArrowChange,style:{position:"absolute",left:d.arrowX,top:d.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[d.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[d.placedSide],visibility:d.shouldHideArrow?"hidden":void 0},children:r.jsx(yO,{...o,ref:n,style:{...o.style,display:"block"}})})});k1.displayName=S1;function SO(e){return e!==null}var kO=e=>({name:"transformOrigin",options:e,fn(t){var b,v,g;const{placement:n,rects:s,middlewareData:o}=t,u=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=u?0:e.arrowWidth,c=u?0:e.arrowHeight,[f,m]=j1(n),h={start:"0%",center:"50%",end:"100%"}[m],x=(((v=o.arrow)==null?void 0:v.x)??0)+l/2,w=(((g=o.arrow)==null?void 0:g.y)??0)+c/2;let j="",_="";return f==="bottom"?(j=u?h:`${x}px`,_=`${-c}px`):f==="top"?(j=u?h:`${x}px`,_=`${s.floating.height+c}px`):f==="right"?(j=`${-c}px`,_=u?h:`${w}px`):f==="left"&&(j=`${s.floating.width+c}px`,_=u?h:`${w}px`),{data:{x:j,y:_}}}});function j1(e){const[t,n="center"]=e.split("-");return[t,n]}var zg=b1,Hg=_1,Wg=C1,Ug=k1;function jO(e){const t=NO(e),n=C.forwardRef((s,o)=>{const{children:d,...u}=s,l=C.Children.toArray(d),c=l.find(PO);if(c){const f=c.props.children,m=l.map(h=>h===c?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:h);return r.jsx(t,{...u,ref:o,children:C.isValidElement(f)?C.cloneElement(f,void 0,m):null})}return r.jsx(t,{...u,ref:o,children:d})});return n.displayName=`${e}.Slot`,n}function NO(e){const t=C.forwardRef((n,s)=>{const{children:o,...d}=n;if(C.isValidElement(o)){const u=TO(o),l=AO(d,o.props);return o.type!==C.Fragment&&(l.ref=s?Ys(s,u):u),C.cloneElement(o,l)}return C.Children.count(o)>1?C.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var EO=Symbol("radix.slottable");function PO(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===EO}function AO(e,t){const n={...t};for(const s in t){const o=e[s],d=t[s];/^on[A-Z]/.test(s)?o&&d?n[s]=(...l)=>{const c=d(...l);return o(...l),c}:o&&(n[s]=o):s==="style"?n[s]={...o,...d}:s==="className"&&(n[s]=[o,d].filter(Boolean).join(" "))}return{...e,...n}}function TO(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var N1=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),RO="VisuallyHidden",E1=C.forwardRef((e,t)=>r.jsx(nt.span,{...e,ref:t,style:{...N1,...e.style}}));E1.displayName=RO;var MO=E1,DO=[" ","Enter","ArrowUp","ArrowDown"],IO=[" ","Enter"],so="Select",[Ou,Fu,LO]=Rg(so),[ma]=hn(so,[LO,fa]),Bu=fa(),[OO,ji]=ma(so),[FO,BO]=ma(so),P1=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:o,onOpenChange:d,value:u,defaultValue:l,onValueChange:c,dir:f,name:m,autoComplete:h,disabled:x,required:w,form:j}=e,_=Bu(t),[b,v]=C.useState(null),[g,y]=C.useState(null),[k,E]=C.useState(!1),P=Gl(f),[T,N]=ws({prop:s,defaultProp:o??!1,onChange:d,caller:so}),[M,I]=ws({prop:u,defaultProp:l,onChange:c,caller:so}),O=C.useRef(null),B=b?j||!!b.closest("form"):!0,[z,q]=C.useState(new Set),H=Array.from(z).map(G=>G.props.value).join(";");return r.jsx(zg,{..._,children:r.jsxs(OO,{required:w,scope:t,trigger:b,onTriggerChange:v,valueNode:g,onValueNodeChange:y,valueNodeHasChildren:k,onValueNodeHasChildrenChange:E,contentId:Bn(),value:M,onValueChange:I,open:T,onOpenChange:N,dir:P,triggerPointerDownPosRef:O,disabled:x,children:[r.jsx(Ou.Provider,{scope:t,children:r.jsx(FO,{scope:e.__scopeSelect,onNativeOptionAdd:C.useCallback(G=>{q(J=>new Set(J).add(G))},[]),onNativeOptionRemove:C.useCallback(G=>{q(J=>{const K=new Set(J);return K.delete(G),K})},[]),children:n})}),B?r.jsxs(Z1,{"aria-hidden":!0,required:w,tabIndex:-1,name:m,autoComplete:h,value:M,onChange:G=>I(G.target.value),disabled:x,form:j,children:[M===void 0?r.jsx("option",{value:""}):null,Array.from(z)]},H):null]})})};P1.displayName=so;var A1="SelectTrigger",T1=C.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...o}=e,d=Bu(n),u=ji(A1,n),l=u.disabled||s,c=ut(t,u.onTriggerChange),f=Fu(n),m=C.useRef("touch"),[h,x,w]=tk(_=>{const b=f().filter(y=>!y.disabled),v=b.find(y=>y.value===u.value),g=rk(b,_,v);g!==void 0&&u.onValueChange(g.value)}),j=_=>{l||(u.onOpenChange(!0),w()),_&&(u.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return r.jsx(Hg,{asChild:!0,...d,children:r.jsx(nt.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":ek(u.value)?"":void 0,...o,ref:c,onClick:Oe(o.onClick,_=>{_.currentTarget.focus(),m.current!=="mouse"&&j(_)}),onPointerDown:Oe(o.onPointerDown,_=>{m.current=_.pointerType;const b=_.target;b.hasPointerCapture(_.pointerId)&&b.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(j(_),_.preventDefault())}),onKeyDown:Oe(o.onKeyDown,_=>{const b=h.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&x(_.key),!(b&&_.key===" ")&&DO.includes(_.key)&&(j(),_.preventDefault())})})})});T1.displayName=A1;var R1="SelectValue",M1=C.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,children:d,placeholder:u="",...l}=e,c=ji(R1,n),{onValueNodeHasChildrenChange:f}=c,m=d!==void 0,h=ut(t,c.onValueNodeChange);return Pr(()=>{f(m)},[f,m]),r.jsx(nt.span,{...l,ref:h,style:{pointerEvents:"none"},children:ek(c.value)?r.jsx(r.Fragment,{children:u}):d})});M1.displayName=R1;var $O="SelectIcon",D1=C.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...o}=e;return r.jsx(nt.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});D1.displayName=$O;var zO="SelectPortal",I1=e=>r.jsx(ql,{asChild:!0,...e});I1.displayName=zO;var io="SelectContent",L1=C.forwardRef((e,t)=>{const n=ji(io,e.__scopeSelect),[s,o]=C.useState();if(Pr(()=>{o(new DocumentFragment)},[]),!n.open){const d=s;return d?Fl.createPortal(r.jsx(O1,{scope:e.__scopeSelect,children:r.jsx(Ou.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),d):null}return r.jsx(F1,{...e,ref:t})});L1.displayName=io;var es=10,[O1,Ni]=ma(io),HO="SelectContentImpl",WO=jO("SelectContent.RemoveScroll"),F1=C.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:d,onPointerDownOutside:u,side:l,sideOffset:c,align:f,alignOffset:m,arrowPadding:h,collisionBoundary:x,collisionPadding:w,sticky:j,hideWhenDetached:_,avoidCollisions:b,...v}=e,g=ji(io,n),[y,k]=C.useState(null),[E,P]=C.useState(null),T=ut(t,Y=>k(Y)),[N,M]=C.useState(null),[I,O]=C.useState(null),B=Fu(n),[z,q]=C.useState(!1),H=C.useRef(!1);C.useEffect(()=>{if(y)return _g(y)},[y]),wg();const G=C.useCallback(Y=>{const[W,...le]=B().map(oe=>oe.ref.current),[te]=le.slice(-1),Q=document.activeElement;for(const oe of Y)if(oe===Q||(oe==null||oe.scrollIntoView({block:"nearest"}),oe===W&&E&&(E.scrollTop=0),oe===te&&E&&(E.scrollTop=E.scrollHeight),oe==null||oe.focus(),document.activeElement!==Q))return},[B,E]),J=C.useCallback(()=>G([N,y]),[G,N,y]);C.useEffect(()=>{z&&J()},[z,J]);const{onOpenChange:K,triggerPointerDownPosRef:F}=g;C.useEffect(()=>{if(y){let Y={x:0,y:0};const W=te=>{var Q,oe;Y={x:Math.abs(Math.round(te.pageX)-(((Q=F.current)==null?void 0:Q.x)??0)),y:Math.abs(Math.round(te.pageY)-(((oe=F.current)==null?void 0:oe.y)??0))}},le=te=>{Y.x<=10&&Y.y<=10?te.preventDefault():y.contains(te.target)||K(!1),document.removeEventListener("pointermove",W),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",W),document.addEventListener("pointerup",le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",W),document.removeEventListener("pointerup",le,{capture:!0})}}},[y,K,F]),C.useEffect(()=>{const Y=()=>K(!1);return window.addEventListener("blur",Y),window.addEventListener("resize",Y),()=>{window.removeEventListener("blur",Y),window.removeEventListener("resize",Y)}},[K]);const[R,L]=tk(Y=>{const W=B().filter(Q=>!Q.disabled),le=W.find(Q=>Q.ref.current===document.activeElement),te=rk(W,Y,le);te&&setTimeout(()=>te.ref.current.focus())}),V=C.useCallback((Y,W,le)=>{const te=!H.current&&!le;(g.value!==void 0&&g.value===W||te)&&(M(Y),te&&(H.current=!0))},[g.value]),$=C.useCallback(()=>y==null?void 0:y.focus(),[y]),ne=C.useCallback((Y,W,le)=>{const te=!H.current&&!le;(g.value!==void 0&&g.value===W||te)&&O(Y)},[g.value]),he=s==="popper"?ap:B1,me=he===ap?{side:l,sideOffset:c,align:f,alignOffset:m,arrowPadding:h,collisionBoundary:x,collisionPadding:w,sticky:j,hideWhenDetached:_,avoidCollisions:b}:{};return r.jsx(O1,{scope:n,content:y,viewport:E,onViewportChange:P,itemRefCallback:V,selectedItem:N,onItemLeave:$,itemTextRefCallback:ne,focusSelectedItem:J,selectedItemText:I,position:s,isPositioned:z,searchRef:R,children:r.jsx(ju,{as:WO,allowPinchZoom:!0,children:r.jsx(Su,{asChild:!0,trapped:g.open,onMountAutoFocus:Y=>{Y.preventDefault()},onUnmountAutoFocus:Oe(o,Y=>{var W;(W=g.trigger)==null||W.focus({preventScroll:!0}),Y.preventDefault()}),children:r.jsx(Kl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:Y=>Y.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:r.jsx(he,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:Y=>Y.preventDefault(),...v,...me,onPlaced:()=>q(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:Oe(v.onKeyDown,Y=>{const W=Y.ctrlKey||Y.altKey||Y.metaKey;if(Y.key==="Tab"&&Y.preventDefault(),!W&&Y.key.length===1&&L(Y.key),["ArrowUp","ArrowDown","Home","End"].includes(Y.key)){let te=B().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);if(["ArrowUp","End"].includes(Y.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(Y.key)){const Q=Y.target,oe=te.indexOf(Q);te=te.slice(oe+1)}setTimeout(()=>G(te)),Y.preventDefault()}})})})})})})});F1.displayName=HO;var UO="SelectItemAlignedPosition",B1=C.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...o}=e,d=ji(io,n),u=Ni(io,n),[l,c]=C.useState(null),[f,m]=C.useState(null),h=ut(t,T=>m(T)),x=Fu(n),w=C.useRef(!1),j=C.useRef(!0),{viewport:_,selectedItem:b,selectedItemText:v,focusSelectedItem:g}=u,y=C.useCallback(()=>{if(d.trigger&&d.valueNode&&l&&f&&_&&b&&v){const T=d.trigger.getBoundingClientRect(),N=f.getBoundingClientRect(),M=d.valueNode.getBoundingClientRect(),I=v.getBoundingClientRect();if(d.dir!=="rtl"){const Q=I.left-N.left,oe=M.left-Q,ye=T.left-oe,Be=T.width+ye,Ke=Math.max(Be,N.width),ce=window.innerWidth-es,be=tp(oe,[es,Math.max(es,ce-Ke)]);l.style.minWidth=Be+"px",l.style.left=be+"px"}else{const Q=N.right-I.right,oe=window.innerWidth-M.right-Q,ye=window.innerWidth-T.right-oe,Be=T.width+ye,Ke=Math.max(Be,N.width),ce=window.innerWidth-es,be=tp(oe,[es,Math.max(es,ce-Ke)]);l.style.minWidth=Be+"px",l.style.right=be+"px"}const O=x(),B=window.innerHeight-es*2,z=_.scrollHeight,q=window.getComputedStyle(f),H=parseInt(q.borderTopWidth,10),G=parseInt(q.paddingTop,10),J=parseInt(q.borderBottomWidth,10),K=parseInt(q.paddingBottom,10),F=H+G+z+K+J,R=Math.min(b.offsetHeight*5,F),L=window.getComputedStyle(_),V=parseInt(L.paddingTop,10),$=parseInt(L.paddingBottom,10),ne=T.top+T.height/2-es,he=B-ne,me=b.offsetHeight/2,Y=b.offsetTop+me,W=H+G+Y,le=F-W;if(W<=ne){const Q=O.length>0&&b===O[O.length-1].ref.current;l.style.bottom="0px";const oe=f.clientHeight-_.offsetTop-_.offsetHeight,ye=Math.max(he,me+(Q?$:0)+oe+J),Be=W+ye;l.style.height=Be+"px"}else{const Q=O.length>0&&b===O[0].ref.current;l.style.top="0px";const ye=Math.max(ne,H+_.offsetTop+(Q?V:0)+me)+le;l.style.height=ye+"px",_.scrollTop=W-ne+_.offsetTop}l.style.margin=`${es}px 0`,l.style.minHeight=R+"px",l.style.maxHeight=B+"px",s==null||s(),requestAnimationFrame(()=>w.current=!0)}},[x,d.trigger,d.valueNode,l,f,_,b,v,d.dir,s]);Pr(()=>y(),[y]);const[k,E]=C.useState();Pr(()=>{f&&E(window.getComputedStyle(f).zIndex)},[f]);const P=C.useCallback(T=>{T&&j.current===!0&&(y(),g==null||g(),j.current=!1)},[y,g]);return r.jsx(GO,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:w,onScrollButtonChange:P,children:r.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:r.jsx(nt.div,{...o,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});B1.displayName=UO;var VO="SelectPopperPosition",ap=C.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:o=es,...d}=e,u=Bu(n);return r.jsx(Wg,{...u,...d,ref:t,align:s,collisionPadding:o,style:{boxSizing:"border-box",...d.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});ap.displayName=VO;var[GO,Vg]=ma(io,{}),lp="SelectViewport",$1=C.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...o}=e,d=Ni(lp,n),u=Vg(lp,n),l=ut(t,d.onViewportChange),c=C.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(Ou.Slot,{scope:n,children:r.jsx(nt.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Oe(o.onScroll,f=>{const m=f.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:x}=u;if(x!=null&&x.current&&h){const w=Math.abs(c.current-m.scrollTop);if(w>0){const j=window.innerHeight-es*2,_=parseFloat(h.style.minHeight),b=parseFloat(h.style.height),v=Math.max(_,b);if(v<j){const g=v+w,y=Math.min(j,g),k=g-y;h.style.height=y+"px",h.style.bottom==="0px"&&(m.scrollTop=k>0?k:0,h.style.justifyContent="flex-end")}}}c.current=m.scrollTop})})})]})});$1.displayName=lp;var z1="SelectGroup",[KO,qO]=ma(z1),YO=C.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Bn();return r.jsx(KO,{scope:n,id:o,children:r.jsx(nt.div,{role:"group","aria-labelledby":o,...s,ref:t})})});YO.displayName=z1;var H1="SelectLabel",W1=C.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=qO(H1,n);return r.jsx(nt.div,{id:o.id,...s,ref:t})});W1.displayName=H1;var ou="SelectItem",[XO,U1]=ma(ou),V1=C.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:d,...u}=e,l=ji(ou,n),c=Ni(ou,n),f=l.value===s,[m,h]=C.useState(d??""),[x,w]=C.useState(!1),j=ut(t,g=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,g,s,o)}),_=Bn(),b=C.useRef("touch"),v=()=>{o||(l.onValueChange(s),l.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(XO,{scope:n,value:s,disabled:o,textId:_,isSelected:f,onItemTextChange:C.useCallback(g=>{h(y=>y||((g==null?void 0:g.textContent)??"").trim())},[]),children:r.jsx(Ou.ItemSlot,{scope:n,value:s,disabled:o,textValue:m,children:r.jsx(nt.div,{role:"option","aria-labelledby":_,"data-highlighted":x?"":void 0,"aria-selected":f&&x,"data-state":f?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...u,ref:j,onFocus:Oe(u.onFocus,()=>w(!0)),onBlur:Oe(u.onBlur,()=>w(!1)),onClick:Oe(u.onClick,()=>{b.current!=="mouse"&&v()}),onPointerUp:Oe(u.onPointerUp,()=>{b.current==="mouse"&&v()}),onPointerDown:Oe(u.onPointerDown,g=>{b.current=g.pointerType}),onPointerMove:Oe(u.onPointerMove,g=>{var y;b.current=g.pointerType,o?(y=c.onItemLeave)==null||y.call(c):b.current==="mouse"&&g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Oe(u.onPointerLeave,g=>{var y;g.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:Oe(u.onKeyDown,g=>{var k;((k=c.searchRef)==null?void 0:k.current)!==""&&g.key===" "||(IO.includes(g.key)&&v(),g.key===" "&&g.preventDefault())})})})})});V1.displayName=ou;var hl="SelectItemText",G1=C.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,...d}=e,u=ji(hl,n),l=Ni(hl,n),c=U1(hl,n),f=BO(hl,n),[m,h]=C.useState(null),x=ut(t,v=>h(v),c.onItemTextChange,v=>{var g;return(g=l.itemTextRefCallback)==null?void 0:g.call(l,v,c.value,c.disabled)}),w=m==null?void 0:m.textContent,j=C.useMemo(()=>r.jsx("option",{value:c.value,disabled:c.disabled,children:w},c.value),[c.disabled,c.value,w]),{onNativeOptionAdd:_,onNativeOptionRemove:b}=f;return Pr(()=>(_(j),()=>b(j)),[_,b,j]),r.jsxs(r.Fragment,{children:[r.jsx(nt.span,{id:c.textId,...d,ref:x}),c.isSelected&&u.valueNode&&!u.valueNodeHasChildren?Fl.createPortal(d.children,u.valueNode):null]})});G1.displayName=hl;var K1="SelectItemIndicator",q1=C.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return U1(K1,n).isSelected?r.jsx(nt.span,{"aria-hidden":!0,...s,ref:t}):null});q1.displayName=K1;var cp="SelectScrollUpButton",Y1=C.forwardRef((e,t)=>{const n=Ni(cp,e.__scopeSelect),s=Vg(cp,e.__scopeSelect),[o,d]=C.useState(!1),u=ut(t,s.onScrollButtonChange);return Pr(()=>{if(n.viewport&&n.isPositioned){let l=function(){const f=c.scrollTop>0;d(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?r.jsx(J1,{...e,ref:u,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Y1.displayName=cp;var dp="SelectScrollDownButton",X1=C.forwardRef((e,t)=>{const n=Ni(dp,e.__scopeSelect),s=Vg(dp,e.__scopeSelect),[o,d]=C.useState(!1),u=ut(t,s.onScrollButtonChange);return Pr(()=>{if(n.viewport&&n.isPositioned){let l=function(){const f=c.scrollHeight-c.clientHeight,m=Math.ceil(c.scrollTop)<f;d(m)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?r.jsx(J1,{...e,ref:u,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});X1.displayName=dp;var J1=C.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=e,d=Ni("SelectScrollButton",n),u=C.useRef(null),l=Fu(n),c=C.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return C.useEffect(()=>()=>c(),[c]),Pr(()=>{var m;const f=l().find(h=>h.ref.current===document.activeElement);(m=f==null?void 0:f.ref.current)==null||m.scrollIntoView({block:"nearest"})},[l]),r.jsx(nt.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Oe(o.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(s,50))}),onPointerMove:Oe(o.onPointerMove,()=>{var f;(f=d.onItemLeave)==null||f.call(d),u.current===null&&(u.current=window.setInterval(s,50))}),onPointerLeave:Oe(o.onPointerLeave,()=>{c()})})}),JO="SelectSeparator",Q1=C.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(nt.div,{"aria-hidden":!0,...s,ref:t})});Q1.displayName=JO;var up="SelectArrow",QO=C.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Bu(n),d=ji(up,n),u=Ni(up,n);return d.open&&u.position==="popper"?r.jsx(Ug,{...o,...s,ref:t}):null});QO.displayName=up;var ZO="SelectBubbleInput",Z1=C.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const o=C.useRef(null),d=ut(s,o),u=Eg(t);return C.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,m=Object.getOwnPropertyDescriptor(c,"value").set;if(u!==t&&m){const h=new Event("change",{bubbles:!0});m.call(l,t),l.dispatchEvent(h)}},[u,t]),r.jsx(nt.select,{...n,style:{...N1,...n.style},ref:d,defaultValue:t})});Z1.displayName=ZO;function ek(e){return e===""||e===void 0}function tk(e){const t=Ir(e),n=C.useRef(""),s=C.useRef(0),o=C.useCallback(u=>{const l=n.current+u;t(l),(function c(f){n.current=f,window.clearTimeout(s.current),f!==""&&(s.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),d=C.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,o,d]}function rk(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,d=n?e.indexOf(n):-1;let u=e6(e,Math.max(d,0));o.length===1&&(u=u.filter(f=>f!==n));const c=u.find(f=>f.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function e6(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var t6=P1,nk=T1,r6=M1,n6=D1,s6=I1,sk=L1,i6=$1,ik=W1,ok=V1,o6=G1,a6=q1,ak=Y1,lk=X1,ck=Q1;const jr=t6,Nr=r6,gr=C.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(nk,{ref:s,className:Te("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(n6,{asChild:!0,children:r.jsx(pr,{className:"h-4 w-4 opacity-50"})})]}));gr.displayName=nk.displayName;const dk=C.forwardRef(({className:e,...t},n)=>r.jsx(ak,{ref:n,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(b5,{className:"h-4 w-4"})}));dk.displayName=ak.displayName;const uk=C.forwardRef(({className:e,...t},n)=>r.jsx(lk,{ref:n,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(pr,{className:"h-4 w-4"})}));uk.displayName=lk.displayName;const xr=C.forwardRef(({className:e,children:t,position:n="popper",...s},o)=>r.jsx(s6,{children:r.jsxs(sk,{ref:o,className:Te("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[r.jsx(dk,{}),r.jsx(i6,{className:Te("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(uk,{})]})}));xr.displayName=sk.displayName;const l6=C.forwardRef(({className:e,...t},n)=>r.jsx(ik,{ref:n,className:Te("px-2 py-1.5 text-sm font-semibold",e),...t}));l6.displayName=ik.displayName;const Et=C.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(ok,{ref:s,className:Te("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(a6,{children:r.jsx(Dt,{className:"h-4 w-4"})})}),r.jsx(o6,{children:t})]}));Et.displayName=ok.displayName;const c6=C.forwardRef(({className:e,...t},n)=>r.jsx(ck,{ref:n,className:Te("-mx-1 my-1 h-px bg-muted",e),...t}));c6.displayName=ck.displayName;const mm={claude:{name:"Claude Code",folder:".claude",color:"text-orange-600",bg:"bg-orange-50",darkBg:"dark:bg-orange-950/30"},gemini:{name:"Gemini CLI",folder:".gemini",color:"text-blue-600",bg:"bg-blue-50",darkBg:"dark:bg-blue-950/30"},antigravity:{name:"Antigravity",folder:".agent",color:"text-purple-600",bg:"bg-purple-50",darkBg:"dark:bg-purple-950/30"}};function d6({open:e,onOpenChange:t,projectDir:n,onSynced:s}){var N,M,I;const[o,d]=C.useState("claude"),[u,l]=C.useState("antigravity"),[c,f]=C.useState(null),[m,h]=C.useState(!1),[x,w]=C.useState(!1),[j,_]=C.useState(new Set);C.useEffect(()=>{e&&n&&b()},[e,o,u,n]),C.useEffect(()=>{e&&_(new Set)},[e]);const b=async()=>{var O;h(!0);try{const B=await ge.getSyncPreview(n,o,u);f(B);const z=new Set(((O=B.files)==null?void 0:O.filter(q=>q.status==="new"||q.status==="different").map(q=>q.name))||[]);_(z)}catch(B){X.error("Failed to load sync preview: "+B.message),f(null)}finally{h(!1)}},v=()=>{d(u),l(o)},g=O=>{const B=new Set(j);B.has(O)?B.delete(O):B.add(O),_(B)},y=()=>{var O,B;j.size===((O=c==null?void 0:c.files)==null?void 0:O.length)?_(new Set):_(new Set(((B=c==null?void 0:c.files)==null?void 0:B.map(z=>z.name))||[]))},k=async()=>{if(j.size===0){X.error("Please select at least one file to sync");return}w(!0);try{const O=await ge.syncRules(n,o,u,Array.from(j));O.success?(X.success(`Synced ${O.synced.length} file(s) to ${mm[u].name}`),s==null||s(),t(!1)):X.error(O.error||"Sync failed")}catch(O){X.error("Sync failed: "+O.message)}finally{w(!1)}},E=O=>{switch(O){case"new":return r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700",children:"New"});case"different":return r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-yellow-100 text-yellow-700",children:"Modified"});case"identical":return r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-gray-100 dark:bg-slate-700 text-gray-500 dark:text-slate-400",children:"Same"});default:return null}},P=mm[o],T=mm[u];return r.jsx(_t,{open:e,onOpenChange:t,children:r.jsxs(vt,{className:"sm:max-w-lg",children:[r.jsxs(yt,{children:[r.jsxs(bt,{className:"flex items-center gap-2",children:[r.jsx(vr,{className:"w-5 h-5 text-indigo-500"}),"Sync Rules Between Tools"]}),r.jsx(er,{children:"Copy rules from one AI tool's configuration to another."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"From"}),r.jsxs(jr,{value:o,onValueChange:d,children:[r.jsx(gr,{className:"w-full",children:r.jsx(Nr,{})}),r.jsxs(xr,{children:[r.jsx(Et,{value:"claude",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-orange-500"}),"Claude Code"]})}),r.jsx(Et,{value:"gemini",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-blue-500"}),"Gemini CLI"]})}),r.jsx(Et,{value:"antigravity",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-purple-500"}),"Antigravity"]})})]})]})]}),r.jsx(se,{variant:"ghost",size:"icon",onClick:v,className:"mt-5",title:"Swap direction",children:r.jsx(cg,{className:"w-4 h-4"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"To"}),r.jsxs(jr,{value:u,onValueChange:l,children:[r.jsx(gr,{className:"w-full",children:r.jsx(Nr,{})}),r.jsxs(xr,{children:[r.jsx(Et,{value:"claude",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-orange-500"}),"Claude Code"]})}),r.jsx(Et,{value:"gemini",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-blue-500"}),"Gemini CLI"]})}),r.jsx(Et,{value:"antigravity",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3 h-3 text-purple-500"}),"Antigravity"]})})]})]})]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[r.jsxs("div",{children:["Source: ",r.jsxs("code",{className:"bg-muted px-1 rounded",children:[P.folder,"/rules/"]})]}),r.jsxs("div",{children:["Target: ",r.jsxs("code",{className:"bg-muted px-1 rounded",children:[T.folder,"/rules/"]})]})]}),r.jsxs("div",{className:"border rounded-lg",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b bg-muted/30",children:[r.jsx("span",{className:"text-sm font-medium",children:"Rules to Sync"}),((N=c==null?void 0:c.files)==null?void 0:N.length)>0&&r.jsx(se,{variant:"ghost",size:"sm",onClick:y,className:"h-6 text-xs",children:j.size===c.files.length?"Deselect All":"Select All"})]}),r.jsx("div",{className:"max-h-64 overflow-auto",children:m?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(et,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):c!=null&&c.error?r.jsxs("div",{className:"flex items-center gap-2 p-4 text-sm text-amber-600",children:[r.jsx(Sn,{className:"w-4 h-4"}),c.error]}):((M=c==null?void 0:c.files)==null?void 0:M.length)===0?r.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:"No rules found in source folder"}):r.jsx("div",{className:"divide-y",children:(I=c==null?void 0:c.files)==null?void 0:I.map(O=>r.jsxs("label",{className:Te("flex items-center gap-3 px-3 py-2 cursor-pointer hover:bg-muted/30",j.has(O.name)&&"bg-primary/5"),children:[r.jsx(ro,{checked:j.has(O.name),onCheckedChange:()=>g(O.name)}),r.jsx(Er,{className:"w-4 h-4 text-purple-500"}),r.jsx("span",{className:"flex-1 text-sm",children:O.name}),E(O.status)]},O.name))})})]}),(c==null?void 0:c.files)&&j.size>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.size," file(s) selected for sync"]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(se,{onClick:k,disabled:x||m||j.size===0,children:x?r.jsxs(r.Fragment,{children:[r.jsx(et,{className:"w-4 h-4 mr-2 animate-spin"}),"Syncing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Dt,{className:"w-4 h-4 mr-2"}),"Sync ",j.size," File(s)"]})})]})]})})}const dt=C.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:Te("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...n}));dt.displayName="Input";function Gg({open:e,onOpenChange:t,onSelect:n,type:s="directory",initialPath:o="~",title:d="Select Path"}){const[u,l]=C.useState(""),[c,f]=C.useState([]),[m,h]=C.useState(!1),[x,w]=C.useState(null),[j,_]=C.useState(""),[b,v]=C.useState("");C.useEffect(()=>{e&&g(o)},[e,o]);const g=async T=>{h(!0),w(null);try{const N=await ge.browse(T,s);N.error?(w(N.error),N.path&&(l(N.path),v(N.path))):(l(N.path),v(N.path),f(N.items||[]),N.home&&_(N.home))}catch(N){w(N.message)}finally{h(!1)}},y=T=>{T.type==="directory"?g(T.path):s==="file"&&(n(T.path),t(!1))},k=()=>{n(u),t(!1)},E=()=>{b&&g(b)},P=T=>{T.key==="Enter"&&E()};return r.jsx(_t,{open:e,onOpenChange:t,children:r.jsxs(vt,{className:"max-w-lg",children:[r.jsx(yt,{children:r.jsxs(bt,{className:"flex items-center gap-2",children:[s==="directory"?r.jsx(Dr,{className:"w-5 h-5"}):r.jsx(Jm,{className:"w-5 h-5"}),d]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:b,onChange:T=>v(T.target.value),onKeyDown:P,placeholder:"Enter path...",className:"font-mono text-sm flex-1"}),r.jsx(se,{variant:"outline",size:"icon",onClick:()=>g(j||"~"),title:"Go to home",children:r.jsx(fg,{className:"w-4 h-4"})}),r.jsx(se,{onClick:E,disabled:m,children:"Go"})]}),r.jsx("div",{className:"text-xs text-gray-500 font-mono truncate px-1",children:u}),x&&r.jsx("div",{className:"text-sm text-red-600 bg-red-50 p-2 rounded",children:x}),r.jsx(Hn,{className:"h-64 border rounded-lg",children:m?r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(et,{className:"w-6 h-6 animate-spin text-gray-400"})}):r.jsx("div",{className:"p-1",children:c.length===0?r.jsx("div",{className:"text-sm text-gray-500 p-4 text-center",children:s==="directory"?"No subdirectories":"No files found"}):c.map((T,N)=>r.jsxs("button",{onClick:()=>y(T),className:"w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-gray-100 dark:hover:bg-slate-800 rounded transition-colors text-left",children:[T.type==="directory"?r.jsx(Dr,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):r.jsx(Jm,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),r.jsx("span",{className:`flex-1 truncate ${T.isParent?"text-gray-500":""}`,children:T.name}),T.type==="directory"&&!T.isParent&&r.jsx(Xr,{className:"w-4 h-4 text-gray-400"})]},N))})})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(se,{onClick:k,disabled:!u,children:s==="directory"?"Select Folder":"Select"})]})]})})}var $u="Switch",[u6]=hn($u),[h6,f6]=u6($u),hk=C.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:o,defaultChecked:d,required:u,disabled:l,value:c="on",onCheckedChange:f,form:m,...h}=e,[x,w]=C.useState(null),j=ut(t,y=>w(y)),_=C.useRef(!1),b=x?m||!!x.closest("form"):!0,[v,g]=ws({prop:o,defaultProp:d??!1,onChange:f,caller:$u});return r.jsxs(h6,{scope:n,checked:v,disabled:l,children:[r.jsx(nt.button,{type:"button",role:"switch","aria-checked":v,"aria-required":u,"data-state":gk(v),"data-disabled":l?"":void 0,disabled:l,value:c,...h,ref:j,onClick:Oe(e.onClick,y=>{g(k=>!k),b&&(_.current=y.isPropagationStopped(),_.current||y.stopPropagation())})}),b&&r.jsx(pk,{control:x,bubbles:!_.current,name:s,value:c,checked:v,required:u,disabled:l,form:m,style:{transform:"translateX(-100%)"}})]})});hk.displayName=$u;var fk="SwitchThumb",mk=C.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,o=f6(fk,n);return r.jsx(nt.span,{"data-state":gk(o.checked),"data-disabled":o.disabled?"":void 0,...s,ref:t})});mk.displayName=fk;var m6="SwitchBubbleInput",pk=C.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:s=!0,...o},d)=>{const u=C.useRef(null),l=ut(u,d),c=Eg(n),f=Pg(t);return C.useEffect(()=>{const m=u.current;if(!m)return;const h=window.HTMLInputElement.prototype,w=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==n&&w){const j=new Event("click",{bubbles:s});w.call(m,n),m.dispatchEvent(j)}},[c,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:l,style:{...o.style,...f,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});pk.displayName=m6;function gk(e){return e?"checked":"unchecked"}var xk=hk,p6=mk;const ft=C.forwardRef(({className:e,...t},n)=>r.jsx(xk,{className:Te("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:r.jsx(p6,{className:Te("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));ft.displayName=xk.displayName;var pm="rovingFocusGroup.onEntryFocus",g6={bubbles:!1,cancelable:!0},Xl="RovingFocusGroup",[hp,vk,x6]=Rg(Xl),[v6,zu]=hn(Xl,[x6]),[y6,b6]=v6(Xl),yk=C.forwardRef((e,t)=>r.jsx(hp.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(hp.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(w6,{...e,ref:t})})}));yk.displayName=Xl;var w6=C.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:d,currentTabStopId:u,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:f,preventScrollOnEntryFocus:m=!1,...h}=e,x=C.useRef(null),w=ut(t,x),j=Gl(d),[_,b]=ws({prop:u,defaultProp:l??null,onChange:c,caller:Xl}),[v,g]=C.useState(!1),y=Ir(f),k=vk(n),E=C.useRef(!1),[P,T]=C.useState(0);return C.useEffect(()=>{const N=x.current;if(N)return N.addEventListener(pm,y),()=>N.removeEventListener(pm,y)},[y]),r.jsx(y6,{scope:n,orientation:s,dir:j,loop:o,currentTabStopId:_,onItemFocus:C.useCallback(N=>b(N),[b]),onItemShiftTab:C.useCallback(()=>g(!0),[]),onFocusableItemAdd:C.useCallback(()=>T(N=>N+1),[]),onFocusableItemRemove:C.useCallback(()=>T(N=>N-1),[]),children:r.jsx(nt.div,{tabIndex:v||P===0?-1:0,"data-orientation":s,...h,ref:w,style:{outline:"none",...e.style},onMouseDown:Oe(e.onMouseDown,()=>{E.current=!0}),onFocus:Oe(e.onFocus,N=>{const M=!E.current;if(N.target===N.currentTarget&&M&&!v){const I=new CustomEvent(pm,g6);if(N.currentTarget.dispatchEvent(I),!I.defaultPrevented){const O=k().filter(G=>G.focusable),B=O.find(G=>G.active),z=O.find(G=>G.id===_),H=[B,z,...O].filter(Boolean).map(G=>G.ref.current);_k(H,m)}}E.current=!1}),onBlur:Oe(e.onBlur,()=>g(!1))})})}),bk="RovingFocusGroupItem",wk=C.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:d,children:u,...l}=e,c=Bn(),f=d||c,m=b6(bk,n),h=m.currentTabStopId===f,x=vk(n),{onFocusableItemAdd:w,onFocusableItemRemove:j,currentTabStopId:_}=m;return C.useEffect(()=>{if(s)return w(),()=>j()},[s,w,j]),r.jsx(hp.ItemSlot,{scope:n,id:f,focusable:s,active:o,children:r.jsx(nt.span,{tabIndex:h?0:-1,"data-orientation":m.orientation,...l,ref:t,onMouseDown:Oe(e.onMouseDown,b=>{s?m.onItemFocus(f):b.preventDefault()}),onFocus:Oe(e.onFocus,()=>m.onItemFocus(f)),onKeyDown:Oe(e.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){m.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const v=S6(b,m.orientation,m.dir);if(v!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let y=x().filter(k=>k.focusable).map(k=>k.ref.current);if(v==="last")y.reverse();else if(v==="prev"||v==="next"){v==="prev"&&y.reverse();const k=y.indexOf(b.currentTarget);y=m.loop?k6(y,k+1):y.slice(k+1)}setTimeout(()=>_k(y))}}),children:typeof u=="function"?u({isCurrentTabStop:h,hasTabStop:_!=null}):u})})});wk.displayName=bk;var _6={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function C6(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function S6(e,t,n){const s=C6(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return _6[s]}function _k(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function k6(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Ck=yk,Sk=wk;function j6(e){const t=N6(e),n=C.forwardRef((s,o)=>{const{children:d,...u}=s,l=C.Children.toArray(d),c=l.find(P6);if(c){const f=c.props.children,m=l.map(h=>h===c?C.Children.count(f)>1?C.Children.only(null):C.isValidElement(f)?f.props.children:null:h);return r.jsx(t,{...u,ref:o,children:C.isValidElement(f)?C.cloneElement(f,void 0,m):null})}return r.jsx(t,{...u,ref:o,children:d})});return n.displayName=`${e}.Slot`,n}function N6(e){const t=C.forwardRef((n,s)=>{const{children:o,...d}=n;if(C.isValidElement(o)){const u=T6(o),l=A6(d,o.props);return o.type!==C.Fragment&&(l.ref=s?Ys(s,u):u),C.cloneElement(o,l)}return C.Children.count(o)>1?C.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var E6=Symbol("radix.slottable");function P6(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===E6}function A6(e,t){const n={...t};for(const s in t){const o=e[s],d=t[s];/^on[A-Z]/.test(s)?o&&d?n[s]=(...l)=>{const c=d(...l);return o(...l),c}:o&&(n[s]=o):s==="style"?n[s]={...o,...d}:s==="className"&&(n[s]=[o,d].filter(Boolean).join(" "))}return{...e,...n}}function T6(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var fp=["Enter"," "],R6=["ArrowDown","PageUp","Home"],kk=["ArrowUp","PageDown","End"],M6=[...R6,...kk],D6={ltr:[...fp,"ArrowRight"],rtl:[...fp,"ArrowLeft"]},I6={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Jl="Menu",[Al,L6,O6]=Rg(Jl),[ao,jk]=hn(Jl,[O6,fa,zu]),Hu=fa(),Nk=zu(),[F6,lo]=ao(Jl),[B6,Ql]=ao(Jl),Ek=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:o,onOpenChange:d,modal:u=!0}=e,l=Hu(t),[c,f]=C.useState(null),m=C.useRef(!1),h=Ir(d),x=Gl(o);return C.useEffect(()=>{const w=()=>{m.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>m.current=!1;return document.addEventListener("keydown",w,{capture:!0}),()=>{document.removeEventListener("keydown",w,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),r.jsx(zg,{...l,children:r.jsx(F6,{scope:t,open:n,onOpenChange:h,content:c,onContentChange:f,children:r.jsx(B6,{scope:t,onClose:C.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:m,dir:x,modal:u,children:s})})})};Ek.displayName=Jl;var $6="MenuAnchor",Kg=C.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,o=Hu(n);return r.jsx(Hg,{...o,...s,ref:t})});Kg.displayName=$6;var qg="MenuPortal",[z6,Pk]=ao(qg,{forceMount:void 0}),Ak=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:o}=e,d=lo(qg,t);return r.jsx(z6,{scope:t,forceMount:n,children:r.jsx(Lr,{present:n||d.open,children:r.jsx(ql,{asChild:!0,container:o,children:s})})})};Ak.displayName=qg;var $n="MenuContent",[H6,Yg]=ao($n),Tk=C.forwardRef((e,t)=>{const n=Pk($n,e.__scopeMenu),{forceMount:s=n.forceMount,...o}=e,d=lo($n,e.__scopeMenu),u=Ql($n,e.__scopeMenu);return r.jsx(Al.Provider,{scope:e.__scopeMenu,children:r.jsx(Lr,{present:s||d.open,children:r.jsx(Al.Slot,{scope:e.__scopeMenu,children:u.modal?r.jsx(W6,{...o,ref:t}):r.jsx(U6,{...o,ref:t})})})})}),W6=C.forwardRef((e,t)=>{const n=lo($n,e.__scopeMenu),s=C.useRef(null),o=ut(t,s);return C.useEffect(()=>{const d=s.current;if(d)return _g(d)},[]),r.jsx(Xg,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Oe(e.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),U6=C.forwardRef((e,t)=>{const n=lo($n,e.__scopeMenu);return r.jsx(Xg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),V6=j6("MenuContent.ScrollLock"),Xg=C.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:o,onOpenAutoFocus:d,onCloseAutoFocus:u,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:x,onDismiss:w,disableOutsideScroll:j,..._}=e,b=lo($n,n),v=Ql($n,n),g=Hu(n),y=Nk(n),k=L6(n),[E,P]=C.useState(null),T=C.useRef(null),N=ut(t,T,b.onContentChange),M=C.useRef(0),I=C.useRef(""),O=C.useRef(0),B=C.useRef(null),z=C.useRef("right"),q=C.useRef(0),H=j?ju:C.Fragment,G=j?{as:V6,allowPinchZoom:!0}:void 0,J=F=>{var Y,W;const R=I.current+F,L=k().filter(le=>!le.disabled),V=document.activeElement,$=(Y=L.find(le=>le.ref.current===V))==null?void 0:Y.textValue,ne=L.map(le=>le.textValue),he=nF(ne,R,$),me=(W=L.find(le=>le.textValue===he))==null?void 0:W.ref.current;(function le(te){I.current=te,window.clearTimeout(M.current),te!==""&&(M.current=window.setTimeout(()=>le(""),1e3))})(R),me&&setTimeout(()=>me.focus())};C.useEffect(()=>()=>window.clearTimeout(M.current),[]),wg();const K=C.useCallback(F=>{var L,V;return z.current===((L=B.current)==null?void 0:L.side)&&iF(F,(V=B.current)==null?void 0:V.area)},[]);return r.jsx(H6,{scope:n,searchRef:I,onItemEnter:C.useCallback(F=>{K(F)&&F.preventDefault()},[K]),onItemLeave:C.useCallback(F=>{var R;K(F)||((R=T.current)==null||R.focus(),P(null))},[K]),onTriggerLeave:C.useCallback(F=>{K(F)&&F.preventDefault()},[K]),pointerGraceTimerRef:O,onPointerGraceIntentChange:C.useCallback(F=>{B.current=F},[]),children:r.jsx(H,{...G,children:r.jsx(Su,{asChild:!0,trapped:o,onMountAutoFocus:Oe(d,F=>{var R;F.preventDefault(),(R=T.current)==null||R.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:r.jsx(Kl,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:f,onPointerDownOutside:m,onFocusOutside:h,onInteractOutside:x,onDismiss:w,children:r.jsx(Ck,{asChild:!0,...y,dir:v.dir,orientation:"vertical",loop:s,currentTabStopId:E,onCurrentTabStopIdChange:P,onEntryFocus:Oe(c,F=>{v.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(Wg,{role:"menu","aria-orientation":"vertical","data-state":Kk(b.open),"data-radix-menu-content":"",dir:v.dir,...g,..._,ref:N,style:{outline:"none",..._.style},onKeyDown:Oe(_.onKeyDown,F=>{const L=F.target.closest("[data-radix-menu-content]")===F.currentTarget,V=F.ctrlKey||F.altKey||F.metaKey,$=F.key.length===1;L&&(F.key==="Tab"&&F.preventDefault(),!V&&$&&J(F.key));const ne=T.current;if(F.target!==ne||!M6.includes(F.key))return;F.preventDefault();const me=k().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);kk.includes(F.key)&&me.reverse(),tF(me)}),onBlur:Oe(e.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(M.current),I.current="")}),onPointerMove:Oe(e.onPointerMove,Tl(F=>{const R=F.target,L=q.current!==F.clientX;if(F.currentTarget.contains(R)&&L){const V=F.clientX>q.current?"right":"left";z.current=V,q.current=F.clientX}}))})})})})})})});Tk.displayName=$n;var G6="MenuGroup",Jg=C.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(nt.div,{role:"group",...s,ref:t})});Jg.displayName=G6;var K6="MenuLabel",Rk=C.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(nt.div,{...s,ref:t})});Rk.displayName=K6;var au="MenuItem",tw="menu.itemSelect",Wu=C.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...o}=e,d=C.useRef(null),u=Ql(au,e.__scopeMenu),l=Yg(au,e.__scopeMenu),c=ut(t,d),f=C.useRef(!1),m=()=>{const h=d.current;if(!n&&h){const x=new CustomEvent(tw,{bubbles:!0,cancelable:!0});h.addEventListener(tw,w=>s==null?void 0:s(w),{once:!0}),lS(h,x),x.defaultPrevented?f.current=!1:u.onClose()}};return r.jsx(Mk,{...o,ref:c,disabled:n,onClick:Oe(e.onClick,m),onPointerDown:h=>{var x;(x=e.onPointerDown)==null||x.call(e,h),f.current=!0},onPointerUp:Oe(e.onPointerUp,h=>{var x;f.current||(x=h.currentTarget)==null||x.click()}),onKeyDown:Oe(e.onKeyDown,h=>{const x=l.searchRef.current!=="";n||x&&h.key===" "||fp.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Wu.displayName=au;var Mk=C.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:o,...d}=e,u=Yg(au,n),l=Nk(n),c=C.useRef(null),f=ut(t,c),[m,h]=C.useState(!1),[x,w]=C.useState("");return C.useEffect(()=>{const j=c.current;j&&w((j.textContent??"").trim())},[d.children]),r.jsx(Al.ItemSlot,{scope:n,disabled:s,textValue:o??x,children:r.jsx(Sk,{asChild:!0,...l,focusable:!s,children:r.jsx(nt.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...d,ref:f,onPointerMove:Oe(e.onPointerMove,Tl(j=>{s?u.onItemLeave(j):(u.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Oe(e.onPointerLeave,Tl(j=>u.onItemLeave(j))),onFocus:Oe(e.onFocus,()=>h(!0)),onBlur:Oe(e.onBlur,()=>h(!1))})})})}),q6="MenuCheckboxItem",Dk=C.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...o}=e;return r.jsx(Bk,{scope:e.__scopeMenu,checked:n,children:r.jsx(Wu,{role:"menuitemcheckbox","aria-checked":lu(n)?"mixed":n,...o,ref:t,"data-state":Zg(n),onSelect:Oe(o.onSelect,()=>s==null?void 0:s(lu(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Dk.displayName=q6;var Ik="MenuRadioGroup",[Y6,X6]=ao(Ik,{value:void 0,onValueChange:()=>{}}),Lk=C.forwardRef((e,t)=>{const{value:n,onValueChange:s,...o}=e,d=Ir(s);return r.jsx(Y6,{scope:e.__scopeMenu,value:n,onValueChange:d,children:r.jsx(Jg,{...o,ref:t})})});Lk.displayName=Ik;var Ok="MenuRadioItem",Fk=C.forwardRef((e,t)=>{const{value:n,...s}=e,o=X6(Ok,e.__scopeMenu),d=n===o.value;return r.jsx(Bk,{scope:e.__scopeMenu,checked:d,children:r.jsx(Wu,{role:"menuitemradio","aria-checked":d,...s,ref:t,"data-state":Zg(d),onSelect:Oe(s.onSelect,()=>{var u;return(u=o.onValueChange)==null?void 0:u.call(o,n)},{checkForDefaultPrevented:!1})})})});Fk.displayName=Ok;var Qg="MenuItemIndicator",[Bk,J6]=ao(Qg,{checked:!1}),$k=C.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...o}=e,d=J6(Qg,n);return r.jsx(Lr,{present:s||lu(d.checked)||d.checked===!0,children:r.jsx(nt.span,{...o,ref:t,"data-state":Zg(d.checked)})})});$k.displayName=Qg;var Q6="MenuSeparator",zk=C.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(nt.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});zk.displayName=Q6;var Z6="MenuArrow",Hk=C.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,o=Hu(n);return r.jsx(Ug,{...o,...s,ref:t})});Hk.displayName=Z6;var eF="MenuSub",[SW,Wk]=ao(eF),fl="MenuSubTrigger",Uk=C.forwardRef((e,t)=>{const n=lo(fl,e.__scopeMenu),s=Ql(fl,e.__scopeMenu),o=Wk(fl,e.__scopeMenu),d=Yg(fl,e.__scopeMenu),u=C.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=d,f={__scopeMenu:e.__scopeMenu},m=C.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return C.useEffect(()=>m,[m]),C.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),r.jsx(Kg,{asChild:!0,...f,children:r.jsx(Mk,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":Kk(n.open),...e,ref:Ys(t,o.onTriggerChange),onClick:h=>{var x;(x=e.onClick)==null||x.call(e,h),!(e.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Oe(e.onPointerMove,Tl(h=>{d.onItemEnter(h),!h.defaultPrevented&&!e.disabled&&!n.open&&!u.current&&(d.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{n.onOpenChange(!0),m()},100))})),onPointerLeave:Oe(e.onPointerLeave,Tl(h=>{var w,j;m();const x=(w=n.content)==null?void 0:w.getBoundingClientRect();if(x){const _=(j=n.content)==null?void 0:j.dataset.side,b=_==="right",v=b?-5:5,g=x[b?"left":"right"],y=x[b?"right":"left"];d.onPointerGraceIntentChange({area:[{x:h.clientX+v,y:h.clientY},{x:g,y:x.top},{x:y,y:x.top},{x:y,y:x.bottom},{x:g,y:x.bottom}],side:_}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>d.onPointerGraceIntentChange(null),300)}else{if(d.onTriggerLeave(h),h.defaultPrevented)return;d.onPointerGraceIntentChange(null)}})),onKeyDown:Oe(e.onKeyDown,h=>{var w;const x=d.searchRef.current!=="";e.disabled||x&&h.key===" "||D6[s.dir].includes(h.key)&&(n.onOpenChange(!0),(w=n.content)==null||w.focus(),h.preventDefault())})})})});Uk.displayName=fl;var Vk="MenuSubContent",Gk=C.forwardRef((e,t)=>{const n=Pk($n,e.__scopeMenu),{forceMount:s=n.forceMount,...o}=e,d=lo($n,e.__scopeMenu),u=Ql($n,e.__scopeMenu),l=Wk(Vk,e.__scopeMenu),c=C.useRef(null),f=ut(t,c);return r.jsx(Al.Provider,{scope:e.__scopeMenu,children:r.jsx(Lr,{present:s||d.open,children:r.jsx(Al.Slot,{scope:e.__scopeMenu,children:r.jsx(Xg,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:f,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{var h;u.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:Oe(e.onFocusOutside,m=>{m.target!==l.trigger&&d.onOpenChange(!1)}),onEscapeKeyDown:Oe(e.onEscapeKeyDown,m=>{u.onClose(),m.preventDefault()}),onKeyDown:Oe(e.onKeyDown,m=>{var w;const h=m.currentTarget.contains(m.target),x=I6[u.dir].includes(m.key);h&&x&&(d.onOpenChange(!1),(w=l.trigger)==null||w.focus(),m.preventDefault())})})})})})});Gk.displayName=Vk;function Kk(e){return e?"open":"closed"}function lu(e){return e==="indeterminate"}function Zg(e){return lu(e)?"indeterminate":e?"checked":"unchecked"}function tF(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function rF(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function nF(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,d=n?e.indexOf(n):-1;let u=rF(e,Math.max(d,0));o.length===1&&(u=u.filter(f=>f!==n));const c=u.find(f=>f.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function sF(e,t){const{x:n,y:s}=e;let o=!1;for(let d=0,u=t.length-1;d<t.length;u=d++){const l=t[d],c=t[u],f=l.x,m=l.y,h=c.x,x=c.y;m>s!=x>s&&n<(h-f)*(s-m)/(x-m)+f&&(o=!o)}return o}function iF(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return sF(n,t)}function Tl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var oF=Ek,aF=Kg,lF=Ak,cF=Tk,dF=Jg,uF=Rk,hF=Wu,fF=Dk,mF=Lk,pF=Fk,gF=$k,xF=zk,vF=Hk,yF=Uk,bF=Gk,Uu="DropdownMenu",[wF]=hn(Uu,[jk]),Jr=jk(),[_F,qk]=wF(Uu),Yk=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:o,defaultOpen:d,onOpenChange:u,modal:l=!0}=e,c=Jr(t),f=C.useRef(null),[m,h]=ws({prop:o,defaultProp:d??!1,onChange:u,caller:Uu});return r.jsx(_F,{scope:t,triggerId:Bn(),triggerRef:f,contentId:Bn(),open:m,onOpenChange:h,onOpenToggle:C.useCallback(()=>h(x=>!x),[h]),modal:l,children:r.jsx(oF,{...c,open:m,onOpenChange:h,dir:s,modal:l,children:n})})};Yk.displayName=Uu;var Xk="DropdownMenuTrigger",Jk=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...o}=e,d=qk(Xk,n),u=Jr(n);return r.jsx(aF,{asChild:!0,...u,children:r.jsx(nt.button,{type:"button",id:d.triggerId,"aria-haspopup":"menu","aria-expanded":d.open,"aria-controls":d.open?d.contentId:void 0,"data-state":d.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...o,ref:Ys(t,d.triggerRef),onPointerDown:Oe(e.onPointerDown,l=>{!s&&l.button===0&&l.ctrlKey===!1&&(d.onOpenToggle(),d.open||l.preventDefault())}),onKeyDown:Oe(e.onKeyDown,l=>{s||(["Enter"," "].includes(l.key)&&d.onOpenToggle(),l.key==="ArrowDown"&&d.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});Jk.displayName=Xk;var CF="DropdownMenuPortal",Qk=e=>{const{__scopeDropdownMenu:t,...n}=e,s=Jr(t);return r.jsx(lF,{...s,...n})};Qk.displayName=CF;var Zk="DropdownMenuContent",ej=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=qk(Zk,n),d=Jr(n),u=C.useRef(!1);return r.jsx(cF,{id:o.contentId,"aria-labelledby":o.triggerId,...d,...s,ref:t,onCloseAutoFocus:Oe(e.onCloseAutoFocus,l=>{var c;u.current||(c=o.triggerRef.current)==null||c.focus(),u.current=!1,l.preventDefault()}),onInteractOutside:Oe(e.onInteractOutside,l=>{const c=l.detail.originalEvent,f=c.button===0&&c.ctrlKey===!0,m=c.button===2||f;(!o.modal||m)&&(u.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ej.displayName=Zk;var SF="DropdownMenuGroup",kF=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(dF,{...o,...s,ref:t})});kF.displayName=SF;var jF="DropdownMenuLabel",tj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(uF,{...o,...s,ref:t})});tj.displayName=jF;var NF="DropdownMenuItem",rj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(hF,{...o,...s,ref:t})});rj.displayName=NF;var EF="DropdownMenuCheckboxItem",nj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(fF,{...o,...s,ref:t})});nj.displayName=EF;var PF="DropdownMenuRadioGroup",AF=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(mF,{...o,...s,ref:t})});AF.displayName=PF;var TF="DropdownMenuRadioItem",sj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(pF,{...o,...s,ref:t})});sj.displayName=TF;var RF="DropdownMenuItemIndicator",ij=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(gF,{...o,...s,ref:t})});ij.displayName=RF;var MF="DropdownMenuSeparator",oj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(xF,{...o,...s,ref:t})});oj.displayName=MF;var DF="DropdownMenuArrow",IF=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(vF,{...o,...s,ref:t})});IF.displayName=DF;var LF="DropdownMenuSubTrigger",aj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(yF,{...o,...s,ref:t})});aj.displayName=LF;var OF="DropdownMenuSubContent",lj=C.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,o=Jr(n);return r.jsx(bF,{...o,...s,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});lj.displayName=OF;var FF=Yk,BF=Jk,$F=Qk,cj=ej,dj=tj,uj=rj,hj=nj,fj=sj,mj=ij,pj=oj,gj=aj,xj=lj;const Ks=FF,qs=BF,zF=C.forwardRef(({className:e,inset:t,children:n,...s},o)=>r.jsxs(gj,{ref:o,className:Te("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...s,children:[n,r.jsx(Xr,{className:"ml-auto"})]}));zF.displayName=gj.displayName;const HF=C.forwardRef(({className:e,...t},n)=>r.jsx(xj,{ref:n,className:Te("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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",e),...t}));HF.displayName=xj.displayName;const Cs=C.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx($F,{children:r.jsx(cj,{ref:s,sideOffset:t,className:Te("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=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",e),...n})}));Cs.displayName=cj.displayName;const Mt=C.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(uj,{ref:s,className:Te("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));Mt.displayName=uj.displayName;const Rl=C.forwardRef(({className:e,children:t,checked:n,...s},o)=>r.jsxs(hj,{ref:o,className:Te("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...s,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(mj,{children:r.jsx(Dt,{className:"h-4 w-4"})})}),t]}));Rl.displayName=hj.displayName;const WF=C.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(fj,{ref:s,className:Te("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(mj,{children:r.jsx(j5,{className:"h-2 w-2 fill-current"})})}),t]}));WF.displayName=fj.displayName;const Ml=C.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(dj,{ref:s,className:Te("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Ml.displayName=dj.displayName;const Yr=C.forwardRef(({className:e,...t},n)=>r.jsx(pj,{ref:n,className:Te("-mx-1 my-1 h-px bg-muted",e),...t}));Yr.displayName=pj.displayName;const rw={development:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",productivity:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",integration:"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400",external:"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",lsp:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400",default:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"};function UF({plugin:e,onToggle:t,isToggling:n,projectDir:s}){const o=rw[e.category]||rw.default;return e.mcpServers||e.lspServers||e.commands,r.jsxs(Uo.div,{layout:!0,initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:`
563
563
  relative p-3 rounded-lg border transition-all
564
564
  ${e.installed?"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-800":"bg-white border-gray-200 dark:bg-slate-900 dark:border-slate-700 hover:border-indigo-300 dark:hover:border-indigo-700"}
565
565
  `,children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h4",{className:"font-medium text-gray-900 dark:text-white truncate",children:e.name}),e.sourceType==="external"&&r.jsx(Zi,{className:"w-3 h-3 text-orange-500 flex-shrink-0",title:"Community plugin"})]}),r.jsx("p",{className:"text-xs text-gray-600 dark:text-slate-400 line-clamp-2 mb-2",children:e.description||"No description"}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.category&&r.jsx(Ze,{variant:"outline",className:`text-[10px] px-1.5 py-0 ${o}`,children:e.category}),e.lspServers&&r.jsxs(Ze,{variant:"outline",className:"text-[10px] px-1.5 py-0 bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400",children:[r.jsx(bs,{className:"w-2.5 h-2.5 mr-0.5"}),"LSP"]}),e.mcpServers&&r.jsxs(Ze,{variant:"outline",className:"text-[10px] px-1.5 py-0 bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",children:[r.jsx(kn,{className:"w-2.5 h-2.5 mr-0.5"}),"MCP"]}),e.version&&r.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-slate-500",children:["v",e.version]})]})]}),r.jsx("div",{className:"flex-shrink-0",children:r.jsx(ft,{checked:e.installed,onCheckedChange:()=>t(e),disabled:n===e.name,className:"data-[state=checked]:bg-green-600"})})]}),n===e.name&&r.jsx("div",{className:"absolute inset-0 bg-white/80 dark:bg-slate-900/80 rounded-lg flex items-center justify-center",children:r.jsx(et,{className:"w-5 h-5 animate-spin text-indigo-600"})})]})}function VF({open:e,onOpenChange:t,projectDir:n,projectName:s}){const[o,d]=C.useState(!0),[u,l]=C.useState({allPlugins:[],categories:[]}),[c,f]=C.useState(""),[m,h]=C.useState("project"),[x,w]=C.useState([]),[j,_]=C.useState(!0),[b,v]=C.useState(!0),[g,y]=C.useState(null),k=async()=>{d(!0);try{const I=await ge.getPlugins();l(I)}catch(I){X.error("Failed to load plugins: "+I.message)}finally{d(!1)}};C.useEffect(()=>{e&&(k(),f(""))},[e]);const E=C.useMemo(()=>{let I=u.allPlugins||[];if(c){const O=c.toLowerCase();I=I.filter(B=>{var z,q;return((z=B.name)==null?void 0:z.toLowerCase().includes(O))||((q=B.description)==null?void 0:q.toLowerCase().includes(O))})}return I=I.filter(O=>!(O.sourceType==="external"&&!j||O.sourceType==="internal"&&!b)),x.length>0&&(I=I.filter(O=>x.includes(O.category))),I.sort((O,B)=>O.installed&&!B.installed?-1:!O.installed&&B.installed?1:O.name.localeCompare(B.name)),I},[u.allPlugins,c,j,b,x]),P=I=>{w(O=>O.includes(I)?O.filter(B=>B!==I):[...O,I])},T=async I=>{y(I.name);try{if(I.installed){const O=await ge.uninstallPlugin(`${I.name}@${I.marketplace}`);O.success?X.success(`Uninstalled ${I.name}`):X.error(O.error||"Failed to uninstall")}else{const O=await ge.installPlugin(I.name,I.marketplace,m,n);O.success?X.success(`Installed ${I.name} (${m})`):X.error(O.error||"Failed to install")}await k()}catch(O){X.error("Operation failed: "+O.message)}finally{y(null)}},N=E.filter(I=>I.installed).length,M=E.filter(I=>!I.installed).length;return r.jsx(_t,{open:e,onOpenChange:t,children:r.jsxs(vt,{className:"max-w-2xl max-h-[85vh] flex flex-col p-0 overflow-hidden",children:[r.jsxs(yt,{className:"px-6 pt-6 pb-4 border-b dark:border-slate-800",children:[r.jsxs(bt,{className:"flex items-center gap-2",children:[r.jsx(eo,{className:"w-5 h-5 text-indigo-600"}),"Install Plugins",s&&r.jsx(Ze,{variant:"outline",className:"ml-2 font-normal",children:s})]}),r.jsx(er,{children:"Enable plugins for enhanced Claude Code capabilities"})]}),r.jsxs("div",{className:"px-6 py-3 border-b dark:border-slate-800 space-y-3 bg-gray-50 dark:bg-slate-900/50",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Ul,{className:"w-4 h-4 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),r.jsx(dt,{value:c,onChange:I=>f(I.target.value),placeholder:"Search plugins...",className:"pl-9 h-9 bg-white dark:bg-slate-800"})]}),r.jsxs(jr,{value:m,onValueChange:h,children:[r.jsx(gr,{className:"w-36 h-9 bg-white dark:bg-slate-800",children:r.jsx(Nr,{})}),r.jsxs(xr,{children:[r.jsx(Et,{value:"project",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(LC,{className:"w-3.5 h-3.5"}),"Project"]})}),r.jsx(Et,{value:"user",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Zi,{className:"w-3.5 h-3.5"}),"Global"]})}),r.jsx(Et,{value:"local",children:r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"w-3.5 h-3.5"}),"Local"]})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsxs(Ks,{children:[r.jsx(qs,{asChild:!0,children:r.jsxs(se,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",children:[r.jsx(hg,{className:"w-3 h-3"}),"Category",x.length>0&&r.jsx(Ze,{variant:"secondary",className:"ml-1 h-4 px-1 text-[10px]",children:x.length}),r.jsx(pr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(Cs,{align:"start",className:"w-48",children:[r.jsx(Ml,{className:"text-xs",children:"Categories"}),r.jsx(Yr,{}),(u.categories||[]).map(I=>r.jsx(Rl,{checked:x.includes(I),onCheckedChange:()=>P(I),children:I},I)),x.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(Yr,{}),r.jsx(Rl,{checked:!1,onCheckedChange:()=>w([]),children:"Clear all"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto text-xs",children:[r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(ft,{checked:b,onCheckedChange:v,className:"h-4 w-7 data-[state=checked]:bg-blue-600"}),r.jsx("span",{className:"text-gray-600 dark:text-slate-400",children:"Anthropic"})]}),r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer",children:[r.jsx(ft,{checked:j,onCheckedChange:_,className:"h-4 w-7 data-[state=checked]:bg-orange-600"}),r.jsx("span",{className:"text-gray-600 dark:text-slate-400",children:"Community"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500 dark:text-slate-500",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Dt,{className:"w-3 h-3 text-green-600"}),N," installed"]}),r.jsxs("span",{children:[M," available"]}),r.jsxs("span",{className:"ml-auto",children:[E.length," shown"]})]})]}),r.jsx(Hn,{className:"flex-1 min-h-0 px-6 py-4",children:o?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(et,{className:"w-6 h-6 animate-spin text-indigo-600"})}):E.length===0?r.jsxs("div",{className:"text-center py-12 text-gray-500 dark:text-slate-400",children:[r.jsx(eo,{className:"w-10 h-10 mx-auto mb-3 opacity-30"}),r.jsx("p",{children:"No plugins found"}),c&&r.jsx(se,{variant:"link",size:"sm",onClick:()=>f(""),className:"mt-2",children:"Clear search"})]}):r.jsx("div",{className:"grid grid-cols-1 gap-3",children:r.jsx(a_,{mode:"popLayout",children:E.map(I=>r.jsx(UF,{plugin:I,onToggle:T,isToggling:g,projectDir:n},`${I.name}@${I.marketplace}`))})})}),r.jsxs("div",{className:"px-6 py-3 border-t dark:border-slate-800 flex items-center justify-between bg-gray-50 dark:bg-slate-900/50",children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-500",children:"Plugins extend Claude Code with LSP servers, MCP tools, and commands"}),r.jsx(se,{variant:"outline",size:"sm",onClick:()=>t(!1),children:"Done"})]})]})})}var gm={exports:{}},nw;function GF(){return nw||(nw=1,(function(e,t){(function(n,s){e.exports=s()})(globalThis,(()=>(()=>{var n={4567:function(u,l,c){var f=this&&this.__decorate||function(g,y,k,E){var P,T=arguments.length,N=T<3?y:E===null?E=Object.getOwnPropertyDescriptor(y,k):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")N=Reflect.decorate(g,y,k,E);else for(var M=g.length-1;M>=0;M--)(P=g[M])&&(N=(T<3?P(N):T>3?P(y,k,N):P(y,k))||N);return T>3&&N&&Object.defineProperty(y,k,N),N},m=this&&this.__param||function(g,y){return function(k,E){y(k,E,g)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const h=c(9042),x=c(9924),w=c(844),j=c(4725),_=c(2585),b=c(3656);let v=l.AccessibilityManager=class extends w.Disposable{constructor(g,y,k,E){super(),this._terminal=g,this._coreBrowserService=k,this._renderService=E,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let P=0;P<this._terminal.rows;P++)this._rowElements[P]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[P]);if(this._topBoundaryFocusListener=P=>this._handleBoundaryFocus(P,0),this._bottomBoundaryFocusListener=P=>this._handleBoundaryFocus(P,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 x.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((P=>this._handleResize(P.rows)))),this.register(this._terminal.onRender((P=>this._refreshRows(P.start,P.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((P=>this._handleChar(P)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(`
@@ -2979,7 +2979,7 @@ When reporting issues, include:
2979
2979
 
2980
2980
  These projects are frequently worked on together.`),f(!0)},yr=ee=>{T(ke=>ke.filter(Ie=>Ie!==ee))},Xt=ee=>{P.includes(ee)||T(ke=>[...ke,ee])},dr=async ee=>{const ke=B[ee];if(!ke&&!q[ee]){J(Ie=>({...Ie,[ee]:!0}));try{const Ie=await ge.getSubprojects(ee);H(qe=>({...qe,[ee]:Ie.subprojects||[]}))}catch(Ie){console.error("Failed to load subprojects:",Ie),H(qe=>({...qe,[ee]:[]}))}finally{J(Ie=>({...Ie,[ee]:!1}))}}z(Ie=>({...Ie,[ee]:!ke}))},is=ee=>{const ke=ee.projects.sort().join("|"),Ie=[...W,ke];le(Ie),localStorage.setItem("dismissedWorkstreamSuggestions",JSON.stringify(Ie)),he(qe=>qe.filter(Tt=>Tt.projects.sort().join("|")!==ke)),X.success("Suggestion dismissed")},Zr=ne.filter(ee=>{const ke=ee.projects.sort().join("|");return!W.includes(ke)}),en=async()=>{if(confirm("Clear activity data older than 30 days?"))try{const ee=await ge.clearActivity(30);ee.success&&(X.success(`Cleared ${ee.cleared} old entries`),Or())}catch(ee){X.error("Failed to clear activity: "+ee.message)}},Un=async(ee,ke)=>{if(!ee||ee.length===0){X.error("Add projects first to generate rules");return}Q(!0);try{const Ie=await ge.generateWorkstreamRules(ee,oe);Ie.success&&Ie.rules?(ke(Ie.rules),X.success(oe?"Generated rules with Claude":"Generated rules from repos")):X.error(Ie.error||"Failed to generate rules")}catch(Ie){X.error("Failed to generate rules: "+Ie.message)}finally{Q(!1)}},it=async()=>{L(!0);try{const ee=await ge.installWorkstreamHook();ee.success?(X.success(ee.message),F(ke=>({...ke,isInstalled:!0}))):X.error(ee.error||"Failed to install hook")}catch(ee){X.error("Failed to install hook: "+ee.message)}finally{L(!1)}},de=async()=>{Ee(!0);try{const ee=await ge.installCdHook();ee.success?(X.success("CD hook installed. Restart your shell to activate."),je(ke=>({...ke,installed:!0}))):X.error(ee.error||"Failed to install CD hook")}catch(ee){X.error("Failed to install CD hook: "+ee.message)}finally{Ee(!1)}},Fe=async()=>{Ee(!0);try{const ee=await ge.uninstallCdHook();ee.success?(X.success("CD hook uninstalled. Restart your shell to apply."),je(ke=>({...ke,installed:!1}))):X.error(ee.error||"Failed to uninstall CD hook")}catch(ee){X.error("Failed to uninstall CD hook: "+ee.message)}finally{Ee(!1)}},It=async()=>{const ee=!we.workstreamAutoActivate;try{await ge.setGlobalAutoActivate(ee),Le(ke=>({...ke,workstreamAutoActivate:ee})),X.success(`Auto-activation ${ee?"enabled":"disabled"}`)}catch(ke){X.error("Failed to update setting: "+ke.message)}},ar=async(ee,ke)=>{try{(await ge.setWorkstreamAutoActivate(ee.id,ke)).success&&(s(qe=>qe.map(Tt=>Tt.id===ee.id?{...Tt,autoActivate:ke==="default"?void 0:ke==="on"}:Tt)),X.success(`Auto-activate ${ke} for ${ee.name}`))}catch(Ie){X.error("Failed to update: "+Ie.message)}},jt=async()=>{if(!(!Pe||!ze.trim()))try{const ee=await ge.addTriggerFolder(Pe.id,ze.trim());ee.success&&(s(ke=>ke.map(Ie=>Ie.id===Pe.id?ee.workstream:Ie)),X.success("Trigger folder added"),xe(!1),gt(""),$e(null))}catch(ee){X.error("Failed to add trigger folder: "+ee.message)}},wt=async(ee,ke)=>{try{const Ie=await ge.removeTriggerFolder(ee.id,ke);Ie.success&&(s(qe=>qe.map(Tt=>Tt.id===ee.id?Ie.workstream:Tt)),X.success("Trigger folder removed"))}catch(Ie){X.error("Failed to remove trigger folder: "+Ie.message)}},mn=async()=>{try{d(!0);const ee=await ge.getWorkstreams();s(ee.workstreams||[])}catch{X.error("Failed to load workstreams")}finally{d(!1)}},ur=async()=>{if(!g.trim()){X.error("Name is required");return}M(!0);try{const ee=await ge.createWorkstream(g.trim(),P,k);ee.success?(s(ke=>[...ke,ee.workstream]),X.success(`Created workstream: ${g}`),f(!1),y(""),E(""),T([]),he(ke=>ke.filter(Ie=>Ie.name!==g.trim()))):X.error(ee.error||"Failed to create workstream")}catch(ee){X.error("Failed to create workstream: "+ee.message)}finally{M(!1)}},Gr=async ee=>{if(confirm(`Delete workstream "${ee.name}"?
2981
2981
 
2982
- This cannot be undone.`))try{const ke=await ge.deleteWorkstream(ee.id);ke.success?(s(Ie=>Ie.filter(qe=>qe.id!==ee.id)),X.success(`Deleted workstream: ${ee.name}`)):X.error(ke.error||"Failed to delete workstream")}catch(ke){X.error("Failed to delete workstream: "+ke.message)}},os=async()=>{if(m){M(!0);try{const ee=await ge.updateWorkstream(m.id,{name:m.name,rules:m.rules,projects:m.projects||[]});ee.success?(s(ke=>ke.map(Ie=>Ie.id===m.id?ee.workstream:Ie)),X.success("Workstream updated"),h(null)):X.error(ee.error||"Failed to update workstream")}catch(ee){X.error("Failed to update workstream: "+ee.message)}finally{M(!1)}}},Fr=ee=>{Ke(ee.id),be(ee.rules||"")},Ai=()=>{Ke(null),be("")},xa=async ee=>{Xe(!0);try{const ke=await ge.updateWorkstream(ee.id,{name:ee.name,rules:ce,projects:ee.projects||[]});ke.success?(s(Ie=>Ie.map(qe=>qe.id===ee.id?ke.workstream:qe)),X.success("Rules updated"),Ke(null),be("")):X.error(ke.error||"Failed to update rules")}catch(ke){X.error("Failed to update rules: "+ke.message)}finally{Xe(!1)}},oc=ee=>{v(ke=>{const Ie=new Set(ke);return Ie.has(ee)?Ie.delete(ee):Ie.add(ee),Ie})},th=async()=>{if(!j||b.size===0)return;M(!0);let ee=0,ke=null;for(const Ie of b)try{const qe=await ge.addProjectToWorkstream(j.id,Ie);qe.success&&(ke=qe.workstream,ee++)}catch(qe){console.error("Failed to add project:",Ie,qe)}ke&&s(Ie=>Ie.map(qe=>qe.id===j.id?ke:qe)),ee>0?X.success(`Added ${ee} project${ee>1?"s":""} to ${j.name}`):X.error("Failed to add projects"),M(!1),w(!1),_(null),v(new Set)},rh=async(ee,ke)=>{try{const Ie=await ge.removeProjectFromWorkstream(ee.id,ke);Ie.success?(s(qe=>qe.map(Tt=>Tt.id===ee.id?Ie.workstream:Tt)),X.success(`Removed project from ${ee.name}`)):X.error(Ie.error||"Failed to remove project")}catch(Ie){X.error("Failed to remove project: "+Ie.message)}},Es=ee=>ee.split("/").pop()||ee,ac=ee=>n.filter(ke=>{var Ie;return(Ie=ke.projects)==null?void 0:Ie.includes(ee)}).length,Ps=(ee,ke=null)=>{var Tt,Nt;const Ie=ac(ee),qe=ke?(Nt=(Tt=n.find(br=>br.id===ke))==null?void 0:Tt.projects)==null?void 0:Nt.includes(ee):!1;return Ie===0?null:Ie===1?qe?null:"in use":"shared"};return o?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center",children:r.jsx(fs,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Workstreams"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Context sets for multi-project workflows"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(se,{variant:"outline",onClick:mn,size:"sm",children:[r.jsx(vr,{className:"w-4 h-4 mr-2"}),"Refresh"]}),r.jsxs(se,{onClick:()=>f(!0),className:"bg-purple-600 hover:bg-purple-700",children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"New Workstream"]})]})]}),r.jsx("div",{className:"bg-purple-50 dark:bg-purple-950/30 border border-purple-200 dark:border-purple-800 rounded-lg p-4 text-sm text-purple-700 dark:text-purple-400",children:r.jsxs("p",{children:[r.jsx("strong",{children:"Workstreams"})," let you group related repos together so Claude sees them as one cohesive project. Perfect for microservices, monorepos, or any multi-repo setup where context matters. Your custom rules and context persist across sessions, and Claude stays scoped to only the directories you specify."]})}),r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:n.length===0?r.jsxs("div",{className:"p-12 text-center",children:[r.jsx(fs,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Workstreams Yet"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Create your first workstream to organize multi-project contexts."}),r.jsxs(se,{onClick:()=>f(!0),children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Create Your First Workstream"]})]}):r.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:n.map(ee=>{var ke,Ie,qe,Tt;return r.jsxs("div",{className:"group",children:[r.jsxs("div",{className:"p-4 flex items-center gap-4 transition-colors cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-900",onClick:()=>l(u===ee.id?null:ee.id),children:[r.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-400",children:u===ee.id?r.jsx(pr,{className:"w-4 h-4"}):r.jsx(Xr,{className:"w-4 h-4"})}),r.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center bg-gray-100 dark:bg-slate-800",children:r.jsx(fs,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-medium truncate text-gray-900 dark:text-white",children:ee.name}),((ke=ee.projects)==null?void 0:ke.length)>0&&r.jsxs("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-1.5 py-0.5 rounded",children:[ee.projects.length," project",ee.projects.length!==1?"s":""]}),ee.rules&&r.jsxs("span",{className:"text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded",children:[r.jsx(Er,{className:"w-3 h-3 inline mr-0.5"}),"Rules"]})]}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 truncate",children:((Ie=ee.projects)==null?void 0:Ie.length)>0?ee.projects.map(Nt=>Es(Nt)).join(", "):"No projects added"})]}),r.jsxs("div",{className:"flex items-center gap-2",onClick:Nt=>Nt.stopPropagation(),children:[r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>h({...ee}),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400",title:"Edit workstream",children:r.jsx(rm,{className:"w-4 h-4"})}),r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>Gr(ee),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Delete workstream",children:r.jsx(un,{className:"w-4 h-4"})})]})]}),u===ee.id&&r.jsxs("div",{className:"px-4 pb-4 pl-16 space-y-4 bg-gray-50/50 dark:bg-slate-900/50",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{_(ee),w(!0)},children:[r.jsx(Bs,{className:"w-4 h-4 mr-1"}),"Add Project"]})]}),((qe=ee.projects)==null?void 0:qe.length)>0?r.jsx("div",{className:"space-y-1",children:ee.projects.map(Nt=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Nt.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>rh(ee,Nt),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(xb,{className:"w-4 h-4"})})]},Nt))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No projects added yet. Add projects to help organize your workstream."})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Trigger Folders"}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(Vo,{className:"w-3.5 h-3.5 text-gray-400"})}),r.jsx(Bt,{children:r.jsx("p",{className:"max-w-xs text-xs",children:"Additional folders that activate this workstream when you cd into them. Projects are always trigger folders automatically."})})]})})]}),r.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{$e(ee),xe(!0)},children:[r.jsx(Bs,{className:"w-4 h-4 mr-1"}),"Add Folder"]})]}),((Tt=ee.triggerFolders)==null?void 0:Tt.length)>0?r.jsx("div",{className:"space-y-1",children:ee.triggerFolders.map(Nt=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Nt.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>wt(ee,Nt),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(xb,{className:"w-4 h-4"})})]},Nt))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No extra trigger folders. Projects auto-trigger this workstream."})]}),r.jsxs("div",{className:"flex items-center justify-between py-2 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Auto-Activate on cd"})]}),r.jsxs(Ks,{children:[r.jsx(qs,{asChild:!0,children:r.jsxs(se,{variant:"outline",size:"sm",children:[ee.autoActivate===!0?"On":ee.autoActivate===!1?"Off":"Default",r.jsx(pr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(Cs,{align:"end",children:[r.jsxs(Mt,{onClick:()=>ar(ee,"on"),children:[r.jsx(Dt,{className:`w-4 h-4 mr-2 ${ee.autoActivate===!0?"opacity-100":"opacity-0"}`}),"On"]}),r.jsxs(Mt,{onClick:()=>ar(ee,"off"),children:[r.jsx(Dt,{className:`w-4 h-4 mr-2 ${ee.autoActivate===!1?"opacity-100":"opacity-0"}`}),"Off"]}),r.jsxs(Mt,{onClick:()=>ar(ee,"default"),children:[r.jsx(Dt,{className:`w-4 h-4 mr-2 ${ee.autoActivate===void 0?"opacity-100":"opacity-0"}`}),"Default (",we.workstreamAutoActivate?"On":"Off",")"]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rules"}),Be===ee.id?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(se,{size:"sm",variant:"ghost",onClick:Ai,disabled:Qe,className:"text-gray-500 dark:text-slate-400 h-7",children:[r.jsx($s,{className:"w-4 h-4 mr-1"}),"Cancel"]}),r.jsxs(se,{size:"sm",onClick:()=>xa(ee),disabled:Qe,className:"bg-purple-600 hover:bg-purple-700 h-7",children:[Qe?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):r.jsx(En,{className:"w-4 h-4 mr-1"}),"Save"]})]}):r.jsxs(se,{size:"sm",variant:"ghost",onClick:()=>Fr(ee),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400 h-7",children:[r.jsx(rm,{className:"w-4 h-4 mr-1"}),"Edit"]})]}),Be===ee.id?r.jsx(xt,{value:ce,onChange:Nt=>be(Nt.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:8,className:"font-mono text-sm",autoFocus:!0}):ee.rules?r.jsx("pre",{className:"text-sm text-gray-600 dark:text-slate-400 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700 p-3 overflow-auto max-h-40 whitespace-pre-wrap cursor-pointer hover:border-purple-300 dark:hover:border-purple-700 transition-colors",onClick:()=>Fr(ee),title:"Click to edit",children:ee.rules}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic cursor-pointer hover:text-purple-600 dark:hover:text-purple-400 transition-colors",onClick:()=>Fr(ee),children:"No rules defined. Click to add context rules for this workstream."})]})]})]},ee.id)})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Hook Integration"}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx("button",{className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:r.jsx(Vo,{className:"w-4 h-4"})})}),r.jsx(Bt,{side:"right",className:"max-w-xs",children:r.jsxs("p",{className:"text-sm",children:[r.jsx("strong",{children:"What are hooks?"}),r.jsx("br",{}),r.jsx("br",{}),"Hooks are scripts that run automatically at specific points in Claude Code sessions. The workstream hook runs before each prompt and injects your active workstream's rules into the context.",r.jsx("br",{}),r.jsx("br",{}),r.jsx("strong",{children:"How it works:"}),r.jsx("br",{}),"1. You activate a workstream",r.jsx("br",{}),"2. Hook detects the active workstream",r.jsx("br",{}),"3. Rules are prepended to Claude's context",r.jsx("br",{}),"4. Claude understands your project context"]})})]})})]}),K.isInstalled?r.jsx("div",{className:"bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800 rounded-lg p-4 text-sm text-green-700 dark:text-green-400",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ea,{className:"w-5 h-5 flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Hook Installed"}),r.jsx("p",{className:"text-green-600 dark:text-green-500",children:"Workstream rules will be automatically injected into every Claude session."})]})]})}):r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-4 text-sm text-amber-700 dark:text-amber-400",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Sn,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium mb-1",children:"Hook Not Installed"}),r.jsx("p",{className:"mb-3",children:"Install the pre-prompt hook to automatically inject workstream rules into every Claude session."}),r.jsxs(se,{onClick:it,disabled:R||K.loading,size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white",children:[R?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(Qi,{className:"w-4 h-4 mr-2"}),"Install Hook"]}),r.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Creates ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.claude/hooks/pre-prompt.sh"})]})]})]})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Folder Auto-Activation"}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(Vo,{className:"w-4 h-4 text-gray-400"})}),r.jsxs(Bt,{className:"max-w-sm",children:[r.jsx("p",{className:"text-sm mb-2",children:r.jsx("strong",{children:"How it works:"})}),r.jsxs("ol",{className:"text-xs space-y-1 list-decimal list-inside",children:[r.jsx("li",{children:"Install the CD hook to your shell"}),r.jsxs("li",{children:["When you ",r.jsx("code",{className:"bg-slate-700 px-1 rounded",children:"cd"})," into a folder matching a workstream, it auto-activates"]}),r.jsx("li",{children:"If multiple workstreams match, you'll be prompted to choose"})]})]})]})})]}),r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 pb-4 border-b border-gray-200 dark:border-slate-800",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Global Auto-Activate"}),r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"(default for all workstreams)"})]}),r.jsx(se,{variant:we.workstreamAutoActivate?"default":"outline",size:"sm",onClick:It,children:we.workstreamAutoActivate?"Enabled":"Disabled"})]}),ct.installed?r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-green-50 dark:bg-green-900/20 rounded-lg border border-green-200 dark:border-green-800",children:[r.jsx(ea,{className:"w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium text-green-800 dark:text-green-300",children:"CD Hook Installed"}),r.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:["Shell: ",ct.shell," • RC file: ",r.jsx("code",{className:"bg-green-100 dark:bg-green-900/50 px-1 rounded",children:(lc=ct.rcFile)==null?void 0:lc.replace(/^\/Users\/[^/]+/,"~")})]}),r.jsxs(se,{variant:"outline",size:"sm",className:"mt-2",onClick:Fe,disabled:Se,children:[Se?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):null,"Uninstall"]})]})]}):r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg border border-amber-200 dark:border-amber-800",children:[r.jsx(Sn,{className:"w-5 h-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-amber-800 dark:text-amber-300 mb-1",children:"CD Hook Not Installed"}),r.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 mb-2",children:"Install the hook to auto-activate workstreams when you cd into matching folders."}),r.jsxs(se,{variant:"default",size:"sm",onClick:de,disabled:Se||ct.loading,className:"bg-amber-600 hover:bg-amber-700 text-white",children:[Se?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(Qi,{className:"w-4 h-4 mr-2"}),"Install CD Hook"]}),r.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Adds function to ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.zshrc"})," or ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.bashrc"})]})]})]})]})]}),V&&V.totalSessions>0&&r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(s5,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Activity Insights"})]}),r.jsxs(se,{variant:"ghost",size:"sm",onClick:en,className:"text-gray-500 dark:text-slate-400 hover:text-red-500",children:[r.jsx(un,{className:"w-4 h-4 mr-1"}),"Clear Old"]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(OC,{className:"w-3 h-3"}),"Sessions"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:V.totalSessions})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(Er,{className:"w-3 h-3"}),"Files Tracked"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:V.totalFiles})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(fs,{className:"w-3 h-3"}),"Projects Active"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:V.projectCount})]})]}),((va=V.topProjects)==null?void 0:va.length)>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Most Active Projects"}),r.jsx("div",{className:"space-y-1",children:V.topProjects.slice(0,5).map((ee,ke)=>r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-600 dark:text-slate-400 truncate",title:ee.path,children:ee.path.split("/").pop()}),r.jsxs("span",{className:"text-gray-400 dark:text-slate-500 text-xs",children:[ee.fileCount," files"]})]},ee.path))})]})]}),Zr.length>0&&r.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-purple-50 dark:from-indigo-950/30 dark:to-purple-950/30 rounded-xl border border-indigo-200 dark:border-indigo-800 p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Yt,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-indigo-900 dark:text-indigo-300",children:"Suggested Workstreams"}),r.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-600 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Based on activity patterns"})]}),r.jsx("p",{className:"text-sm text-indigo-700 dark:text-indigo-400 mb-4",children:"These projects are frequently worked on together. Create a workstream to group them?"}),r.jsx("div",{className:"space-y-3",children:Zr.map(ee=>r.jsxs("div",{className:"bg-white dark:bg-slate-900 rounded-lg border border-indigo-200 dark:border-indigo-800 p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ee.name}),ee.coActivityScore&&r.jsxs("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:[ee.coActivityScore,"% co-activity"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>is(ee),className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",title:"Dismiss suggestion",children:r.jsx($s,{className:"w-4 h-4"})}),r.jsxs(se,{size:"sm",onClick:()=>zt(ee),className:"bg-indigo-600 hover:bg-indigo-700",children:[r.jsx(kt,{className:"w-4 h-4 mr-1"}),"Create"]})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1",children:ee.projects.map(ke=>r.jsx("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-2 py-0.5 rounded",children:ke.split("/").pop()},ke))})]},ee.name))})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config workstream # List workstreams"}),r.jsx("p",{children:'coder-config workstream use "Name" # Set workstream for this tab'}),r.jsx("p",{children:'coder-config workstream create "Name" # Create workstream'})]})]}),r.jsx(_t,{open:c,onOpenChange:ee=>{ee||(f(!1),y(""),E(""),T([]),O(!1),z({}))},children:r.jsxs(vt,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(yt,{children:r.jsxs(bt,{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"w-5 h-5 text-purple-600"}),"Create Workstream"]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(dt,{value:g,onChange:ee=>y(ee.target.value),placeholder:"e.g., User Auth, Admin Dashboard",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(se,{type:"button",size:"sm",variant:"outline",onClick:()=>O(!I),children:[r.jsx(Bs,{className:"w-4 h-4 mr-1"}),"Add"]})]}),P.length>0?r.jsx("div",{className:"space-y-1 mb-2",children:P.map(ee=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:ee.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(se,{type:"button",size:"sm",variant:"ghost",onClick:()=>yr(ee),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx($s,{className:"w-4 h-4"})})]},ee))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects added. Add projects to help organize your workstream."}),I&&e.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-64 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(ee=>{const ke=Ps(ee.path),Ie=B[ee.path],qe=G[ee.path],Tt=q[ee.path]||[],Nt=P.includes(ee.path);return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>dr(ee.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:qe?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):Ie?r.jsx(pr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Xr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>Xt(ee.path),disabled:Nt,className:`flex-1 text-left p-2 rounded transition-colors ${Nt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ee.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[ke&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${ke==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:ke}),Nt&&r.jsx(Dt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:ee.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),Ie&&Tt.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:Tt.map(br=>{const nr=P.includes(br.dir),wr=Ps(br.dir);return r.jsxs("button",{type:"button",onClick:()=>Xt(br.dir),disabled:nr,className:`w-full text-left p-2 rounded transition-colors ${nr?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:br.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[wr&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${wr==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:wr}),nr&&r.jsx(Dt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono",children:br.relativePath})]},br.dir)})}),Ie&&Tt.length===0&&!qe&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ee.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Context (optional)"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-500 dark:text-slate-400 cursor-pointer",children:[r.jsx(ro,{checked:oe,onCheckedChange:ye,className:"h-3.5 w-3.5"}),"Use Claude"]}),r.jsxs(se,{type:"button",size:"sm",variant:"ghost",onClick:()=>Un(P,E),disabled:te||P.length===0,className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:oe?"Use Claude Code to analyze repos":"Extract from README, package.json, etc.",children:[te?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(Fn,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(xt,{value:k,onChange:ee=>E(ee.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:6}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:'Example: "Focus on user authentication. Use JWT tokens. React Query for state management."'})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>{f(!1),y(""),E(""),T([]),O(!1),z({})},children:"Cancel"}),r.jsxs(se,{onClick:ur,disabled:N||!g.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Create"]})]})]})}),r.jsx(_t,{open:!!m,onOpenChange:ee=>!ee&&h(null),children:r.jsxs(vt,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(yt,{children:r.jsxs(bt,{className:"flex items-center gap-2",children:[r.jsx(rm,{className:"w-5 h-5 text-purple-600"}),"Edit Workstream"]})}),m&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(dt,{value:m.name,onChange:ee=>h(ke=>({...ke,name:ee.target.value}))})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(se,{type:"button",size:"sm",variant:"outline",onClick:()=>h(ee=>({...ee,showPicker:!ee.showPicker})),children:[r.jsx(Bs,{className:"w-4 h-4 mr-1"}),"Add"]})]}),((ya=m.projects)==null?void 0:ya.length)>0?r.jsx("div",{className:"space-y-1 mb-2",children:m.projects.map(ee=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:ee.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(se,{type:"button",size:"sm",variant:"ghost",onClick:()=>h(ke=>({...ke,projects:ke.projects.filter(Ie=>Ie!==ee)})),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx($s,{className:"w-4 h-4"})})]},ee))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects in this workstream."}),m.showPicker&&e.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-48 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(ee=>{var br;const ke=(br=m.projects)==null?void 0:br.includes(ee.path),Ie=Ps(ee.path,m.id),qe=B[ee.path],Tt=G[ee.path],Nt=q[ee.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>dr(ee.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:Tt?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):qe?r.jsx(pr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Xr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!ke&&h(nr=>({...nr,projects:[...nr.projects||[],ee.path]})),disabled:ke,className:`flex-1 text-left p-2 rounded transition-colors ${ke?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ee.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ie&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Ie==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Ie}),ke&&r.jsx(Dt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:ee.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),qe&&Nt.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:Nt.map(nr=>{var Vn;const wr=(Vn=m.projects)==null?void 0:Vn.includes(nr.dir),pn=Ps(nr.dir,m.id);return r.jsxs("button",{type:"button",onClick:()=>!wr&&h(Ar=>({...Ar,projects:[...Ar.projects||[],nr.dir]})),disabled:wr,className:`w-full text-left p-2 rounded transition-colors ${wr?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:nr.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[pn&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${pn==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:pn}),wr&&r.jsx(Dt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:nr.relativePath})]},nr.dir)})}),qe&&Nt.length===0&&!Tt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ee.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rules"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-500 dark:text-slate-400 cursor-pointer",children:[r.jsx(ro,{checked:oe,onCheckedChange:ye,className:"h-3.5 w-3.5"}),"Use Claude"]}),r.jsxs(se,{type:"button",size:"sm",variant:"ghost",onClick:()=>Un(m.projects,ee=>h(ke=>({...ke,rules:ee}))),disabled:te||!((ba=m.projects)!=null&&ba.length),className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:oe?"Use Claude Code to analyze repos":"Extract from README, package.json, etc.",children:[te?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(Fn,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(xt,{value:m.rules||"",onChange:ee=>h(ke=>({...ke,rules:ee.target.value})),placeholder:"Context rules for this workstream...",rows:8})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),r.jsxs(se,{onClick:os,disabled:N,className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(En,{className:"w-4 h-4 mr-2"}),"Save Changes"]})]})]})}),r.jsx(_t,{open:x,onOpenChange:ee=>{w(ee),ee||(z({}),v(new Set))},children:r.jsxs(vt,{className:"max-w-lg",children:[r.jsx(yt,{children:r.jsxs(bt,{className:"flex items-center gap-2",children:[r.jsx(Bs,{className:"w-5 h-5 text-purple-600"}),"Add Project to ",j==null?void 0:j.name]})}),r.jsxs("div",{className:"py-4",children:[r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-4",children:"Select projects to add to this workstream (multi-select enabled):"}),e.length>0?r.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto border border-gray-200 dark:border-slate-700 rounded-lg p-2 bg-white dark:bg-slate-900",children:e.map(ee=>{var nr;const ke=(nr=j==null?void 0:j.projects)==null?void 0:nr.includes(ee.path),Ie=b.has(ee.path),qe=Ps(ee.path,j==null?void 0:j.id),Tt=B[ee.path],Nt=G[ee.path],br=q[ee.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>dr(ee.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:Nt?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):Tt?r.jsx(pr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Xr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!ke&&oc(ee.path),disabled:ke,className:`flex-1 text-left p-2 rounded transition-colors ${ke?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":Ie?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${ke?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":Ie?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(ke||Ie)&&r.jsx(Dt,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ee.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[qe&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${qe==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:qe}),ke&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:ee.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),Tt&&br.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:br.map(wr=>{var cc;const pn=(cc=j==null?void 0:j.projects)==null?void 0:cc.includes(wr.dir),Vn=b.has(wr.dir),Ar=Ps(wr.dir,j==null?void 0:j.id);return r.jsxs("button",{type:"button",onClick:()=>!pn&&oc(wr.dir),disabled:pn,className:`w-full text-left p-2 rounded transition-colors ${pn?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":Vn?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${pn?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":Vn?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(pn||Vn)&&r.jsx(Dt,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:wr.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ar&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Ar==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Ar}),pn&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:wr.relativePath})]},wr.dir)})}),Tt&&br.length===0&&!Nt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ee.id)})}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 text-center py-4",children:"No projects registered. Add projects in the Projects view first."})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>{w(!1),v(new Set)},children:"Cancel"}),r.jsxs(se,{onClick:th,disabled:b.size===0||N,className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Add Selected (",b.size,")"]})]})]})}),r.jsx(_t,{open:ie,onOpenChange:ee=>{ee||(xe(!1),gt(""),$e(null))},children:r.jsxs(vt,{children:[r.jsx(yt,{children:r.jsx(bt,{children:"Add Trigger Folder"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:["Add a folder that will trigger the workstream ",r.jsx("strong",{children:Pe==null?void 0:Pe.name})," when you cd into it."]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Folder Path"}),r.jsx(dt,{value:ze,onChange:ee=>gt(ee.target.value),placeholder:"~/path/to/folder",className:"font-mono"}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:"Use absolute path or ~ for home directory"})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>{xe(!1),gt(""),$e(null)},children:"Cancel"}),r.jsxs(se,{onClick:jt,disabled:!ze.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[r.jsx(Bs,{className:"w-4 h-4 mr-2"}),"Add Folder"]})]})]})})]})}const Qw={clarify:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",plan:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",execute:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},al={pending:r.jsx(vl,{className:"w-4 h-4 text-gray-500"}),running:r.jsx(UC,{className:"w-4 h-4 text-green-500"}),paused:r.jsx(HC,{className:"w-4 h-4 text-yellow-500"}),completed:r.jsx(ea,{className:"w-4 h-4 text-green-600"}),failed:r.jsx(qd,{className:"w-4 h-4 text-red-500"}),cancelled:r.jsx(qd,{className:"w-4 h-4 text-gray-500"})};function qH({activeProject:e=null}){var Xt,dr,is,Zr,en,Un,it;const[t,n]=C.useState([]),[s,o]=C.useState(!0),[d,u]=C.useState(null),[l,c]=C.useState({}),[f,m]=C.useState([]),[h,x]=C.useState(null),[w,j]=C.useState(""),[_,b]=C.useState(!1),[v,g]=C.useState(!1),[y,k]=C.useState(!1),[E,P]=C.useState(!1),[T,N]=C.useState(null),[M,I]=C.useState(""),[O,B]=C.useState(""),[z,q]=C.useState(50),[H,G]=C.useState("DONE"),[J,K]=C.useState(!1),[F,R]=C.useState(50),[L,V]=C.useState(!1),[$,ne]=C.useState("DONE"),[he,me]=C.useState([]),[Y,W]=C.useState({stopHook:{},prepromptHook:{}}),[le,te]=C.useState(!1),[Q,oe]=C.useState(!1),[ye,Be]=C.useState(null);C.useEffect(()=>{ce(),be(),Qe(),Ke()},[]);const Ke=async()=>{try{const de=await ge.getWorkstreams();m(de.workstreams||[]),x(de.activeId||null)}catch(de){console.error("Failed to load workstreams:",de)}};C.useEffect(()=>{_&&h&&B(h)},[_,h]);const ce=async()=>{try{o(!0);const de=await ge.getLoops();n(de.loops||[]),c(de.config||{})}catch{X.error("Failed to load loops")}finally{o(!1)}},be=async()=>{try{const Fe=(await ge.getLoopConfig()).config||{};c(Fe),R(Fe.maxIterations||50),V(Fe.autoApprovePlan||!1),ne(Fe.completionPromise||"DONE"),q(Fe.maxIterations||50),G(Fe.completionPromise||"DONE")}catch(de){console.error("Failed to load config:",de)}},Qe=async()=>{try{const de=await ge.getLoopHookStatus();W(de)}catch(de){console.error("Failed to load hook status:",de)}},Xe=async()=>{try{const de=await ge.getLoopHistory();me(de.completed||[])}catch{X.error("Failed to load history")}},ct=async()=>{if(!M.trim()){X.error("Task description is required");return}try{K(!0);const de=await ge.createLoop(M,{workstreamId:O||null,projectPath:(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null,maxIterations:parseInt(z,10)||50,completionPromise:H||"DONE"});de.success?(X.success("Loop created"),b(!1),I(""),B(""),q(F),G($),ce()):X.error(de.error||"Failed to create loop")}catch(de){X.error(de.message)}finally{K(!1)}},je=async de=>{try{const Fe=await ge.startLoop(de);Fe.success&&Fe.loop?(X.success("Loop started - launching Claude Code"),Be(Fe.loop),oe(!0),ce()):X.error(Fe.error||"Failed to start loop")}catch(Fe){X.error(Fe.message)}},we=C.useCallback(async(de,Fe)=>{var It,ar;if(ye)try{const wt=(await ge.getLoop(ye.id)).loop;wt.taskComplete||wt.status==="completed"?(X.success("Loop completed successfully!"),oe(!1),Be(null)):wt.status==="paused"?X.info(`Loop paused: ${wt.pauseReason||"user requested"}`):((It=wt.iterations)==null?void 0:It.current)>=((ar=wt.iterations)==null?void 0:ar.max)?(X.warning("Loop reached max iterations"),await ge.pauseLoop(wt.id)):X.info("Claude exited. Click Start to continue the loop."),ce()}catch(jt){console.error("Failed to check loop status:",jt)}},[ye]),Le=async de=>{try{const Fe=await ge.pauseLoop(de);Fe.success?(X.success("Loop paused"),ce()):X.error(Fe.error||"Failed to pause loop")}catch(Fe){X.error(Fe.message)}},Se=async de=>{try{const Fe=await ge.resumeLoop(de);Fe.success?(X.success("Loop resumed"),ce()):X.error(Fe.error||"Failed to resume loop")}catch(Fe){X.error(Fe.message)}},Ee=async de=>{if(confirm("Cancel this loop?"))try{const Fe=await ge.cancelLoop(de);Fe.success?(X.success("Loop cancelled"),ce()):X.error(Fe.error||"Failed to cancel loop")}catch(Fe){X.error(Fe.message)}},ie=async de=>{if(confirm("Delete this loop and all its data?"))try{const Fe=await ge.deleteLoop(de);Fe.success?(X.success("Loop deleted"),ce()):X.error(Fe.error||"Failed to delete loop")}catch(Fe){X.error(Fe.message)}},xe=async de=>{try{const Fe=await ge.approveLoop(de);Fe.success?(X.success("Plan approved"),ce()):X.error(Fe.error||"Failed to approve plan")}catch(Fe){X.error(Fe.message)}},Pe=async()=>{try{K(!0);const de=await ge.updateLoopConfig({maxIterations:parseInt(F,10),autoApprovePlan:L,completionPromise:$});de.success?(X.success("Configuration saved"),g(!1),be()):X.error(de.error||"Failed to save configuration")}catch(de){X.error(de.message)}finally{K(!1)}},$e=async()=>{try{te(!0);const de=await ge.installLoopHooks();de.success?(X.success("Hooks installed successfully"),Qe()):X.error(de.error||"Failed to install hooks")}catch(de){X.error(de.message)}finally{te(!1)}},ze=async de=>{try{const Fe=await ge.getLoop(de.id);N({...Fe.loop,clarifications:Fe.clarifications,plan:Fe.plan}),P(!0)}catch{X.error("Failed to load loop details")}},gt=de=>{navigator.clipboard.writeText(de),X.success("Copied to clipboard")},lt=de=>de?new Date(de).toLocaleString():"-",or=de=>de.iterations?Math.min(100,de.iterations.current/de.iterations.max*100):0,Qr=((Xt=Y.stopHook)==null?void 0:Xt.exists)&&((dr=Y.prepromptHook)==null?void 0:dr.exists),Or=de=>{if(!de)return null;const Fe=f.find(It=>It.id===de);return(Fe==null?void 0:Fe.name)||de},zt=w?t.filter(de=>de.workstreamId===w):t,yr=de=>{var jt,wt;const Fe=(((jt=de.task)==null?void 0:jt.original)||"").replace(/"/g,'\\"'),It=((wt=de.iterations)==null?void 0:wt.max)||50,ar=de.completionPromise||"DONE";return`claude --dangerously-skip-permissions "/ralph-loop ${Fe} --max-iterations ${It} --completion-promise '${ar}'"`};return r.jsxs("div",{className:"p-6 space-y-6 max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(El,{className:"w-6 h-6"}),"Ralph Loops"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Autonomous development loops using the official ralph-loop plugin"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[f.length>0&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(hg,{className:"w-4 h-4 text-muted-foreground"}),r.jsxs("select",{className:"text-sm border rounded px-2 py-1 bg-background",value:w,onChange:de=>j(de.target.value),children:[r.jsx("option",{value:"",children:"All workstreams"}),f.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsxs(se,{variant:"outline",size:"sm",onClick:()=>{Xe(),k(!0)},children:[r.jsx(Xd,{className:"w-4 h-4 mr-1"}),"History"]})}),r.jsx(Bt,{children:"View completed loops"})]})}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsxs(se,{variant:"outline",size:"sm",onClick:()=>g(!0),children:[r.jsx(zn,{className:"w-4 h-4 mr-1"}),"Config"]})}),r.jsx(Bt,{children:"Configure loop defaults"})]})}),r.jsxs(se,{onClick:()=>b(!0),children:[r.jsx(kt,{className:"w-4 h-4 mr-1"}),"New Loop"]})]})]}),!Qr&&r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Sn,{className:"w-5 h-5 text-yellow-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-yellow-800 dark:text-yellow-200",children:"Hooks not installed"}),r.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"Install the Ralph Loop hooks to enable automatic loop continuation"})]})]}),r.jsxs(se,{variant:"outline",size:"sm",onClick:$e,disabled:le,children:[le?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Install Hooks"]})]}),s?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(et,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):zt.length===0?r.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[r.jsx(El,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"text-lg font-medium",children:w?"No loops in this workstream":"No loops yet"}),r.jsx("p",{className:"text-sm mt-1",children:"Create a loop to start autonomous development"})]}):r.jsx("div",{className:"space-y-3",children:zt.map(de=>{var Fe,It,ar,jt,wt;return r.jsxs("div",{className:"border rounded-lg bg-card overflow-hidden",children:[r.jsxs("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>u(d===de.id?null:de.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[d===de.id?r.jsx(pr,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(Xr,{className:"w-4 h-4 text-muted-foreground"}),al[de.status]||al.pending,r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium",children:de.name}),r.jsx("p",{className:"text-sm text-muted-foreground truncate max-w-md",children:((Fe=de.task)==null?void 0:Fe.original)||"No task"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[de.workstreamId&&r.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200 flex items-center gap-1",children:[r.jsx(fs,{className:"w-3 h-3"}),Or(de.workstreamId)]}),r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${Qw[de.phase]||"bg-gray-100"}`,children:de.phase}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[((It=de.iterations)==null?void 0:It.current)||0,"/",((ar=de.iterations)==null?void 0:ar.max)||50]}),r.jsxs("div",{className:"flex items-center gap-1",onClick:mn=>mn.stopPropagation(),children:[de.status==="pending"&&r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>je(de.id),children:r.jsx(UC,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"Start loop"})]})}),de.status==="running"&&r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>Le(de.id),children:r.jsx(HC,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"Pause loop"})]})}),de.status==="paused"&&r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>Se(de.id),children:r.jsx(OM,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"Resume loop"})]})}),de.phase==="plan"&&de.status==="running"&&r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>xe(de.id),children:r.jsx(Dt,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"Approve plan"})]})}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>ze(de),children:r.jsx(dg,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"View details"})]})}),(de.status==="running"||de.status==="paused")&&r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>Ee(de.id),children:r.jsx(qd,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"Cancel loop"})]})}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>ie(de.id),children:r.jsx(un,{className:"w-4 h-4 text-red-500"})})}),r.jsx(Bt,{children:"Delete loop"})]})})]})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-1",children:[r.jsx("span",{children:"Iterations"}),r.jsxs("span",{children:[((jt=de.iterations)==null?void 0:jt.current)||0," / ",((wt=de.iterations)==null?void 0:wt.max)||50]})]}),r.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-blue-500 transition-all",style:{width:`${or(de)}%`}})})]})]}),d===de.id&&r.jsxs("div",{className:"border-t p-4 bg-muted/30 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"ID:"}),r.jsx("span",{className:"ml-2 font-mono",children:de.id}),r.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 ml-1",onClick:()=>gt(de.id),children:r.jsx(Nl,{className:"w-3 h-3"})})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Status:"}),r.jsxs("span",{className:"ml-2",children:[de.status,de.pauseReason?` (${de.pauseReason})`:""]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Created:"}),r.jsx("span",{className:"ml-2",children:lt(de.createdAt)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Updated:"}),r.jsx("span",{className:"ml-2",children:lt(de.updatedAt)})]}),de.workstreamId&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Workstream:"}),r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1",children:[r.jsx(fs,{className:"w-3 h-3 text-purple-500"}),Or(de.workstreamId)]})]})]}),r.jsxs("div",{className:"bg-muted p-3 rounded-md",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ft,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Run this loop (uses official ralph-loop plugin):"})]}),r.jsx("code",{className:"text-xs bg-background p-2 rounded block whitespace-pre-wrap",children:yr(de)})]})]})]},de.id)})}),r.jsx(_t,{open:_,onOpenChange:b,children:r.jsxs(vt,{className:"sm:max-w-lg",children:[r.jsx(yt,{children:r.jsx(bt,{children:"Create New Loop"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Task Description"}),r.jsx(xt,{placeholder:"Describe what you want Claude to accomplish...",value:M,onChange:de=>I(de.target.value),rows:4}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Be specific about the goal. The loop will continue until this task is completed."})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Project"}),r.jsx("div",{className:"text-sm p-2 bg-muted rounded-md",children:e?r.jsx("span",{className:"font-mono",children:e.name||e.path||e.dir}):r.jsx("span",{className:"text-muted-foreground",children:"No project selected - loop will run in server directory"})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(dt,{type:"number",value:z,onChange:de=>q(de.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Safety limit for the loop"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Completion Promise"}),r.jsx(dt,{value:H,onChange:de=>G(de.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Text that signals completion"})]})]}),f.length>0&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Workstream (optional)"}),r.jsxs("select",{className:"w-full border rounded-md p-2 bg-background",value:O,onChange:de=>B(de.target.value),children:[r.jsx("option",{value:"",children:"No workstream"}),f.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),r.jsxs(se,{onClick:ct,disabled:J||!M.trim(),children:[J?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Create Loop"]})]})]})}),r.jsx(_t,{open:v,onOpenChange:g,children:r.jsxs(vt,{className:"sm:max-w-md",children:[r.jsx(yt,{children:r.jsx(bt,{children:"Loop Configuration"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(dt,{type:"number",value:F,onChange:de=>R(de.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Loop will pause after this many iterations"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Default Completion Promise"}),r.jsx(dt,{value:$,onChange:de=>ne(de.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Default text that signals loop completion (used with official ralph-loop plugin)"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"checkbox",id:"autoApprovePlan",checked:L,onChange:de=>V(de.target.checked),className:"rounded"}),r.jsx("label",{htmlFor:"autoApprovePlan",className:"text-sm",children:"Auto-approve plans (skip manual plan approval)"})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),r.jsxs(se,{onClick:Pe,disabled:J,children:[J?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Save"]})]})]})}),r.jsx(_t,{open:y,onOpenChange:k,children:r.jsxs(vt,{className:"sm:max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(yt,{children:r.jsx(bt,{children:"Loop History"})}),r.jsx("div",{className:"space-y-3 py-4",children:he.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No completed loops yet"}):he.slice().reverse().map(de=>r.jsxs("div",{className:"border rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[al[de.status]||al.completed,r.jsx("span",{className:"font-medium",children:de.name})]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:lt(de.completedAt)})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:de.task}),r.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:r.jsxs("span",{children:["Iterations: ",de.totalIterations]})})]},de.id))})]})}),r.jsx(_t,{open:E,onOpenChange:P,children:r.jsxs(vt,{className:"sm:max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsx(yt,{children:r.jsx(bt,{children:(T==null?void 0:T.name)||"Loop Details"})}),T&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4 text-sm",children:[r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Phase"}),r.jsx("span",{className:`text-sm px-2 py-0.5 rounded-full ${Qw[T.phase]||""}`,children:T.phase})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Status"}),r.jsxs("div",{className:"flex items-center gap-1",children:[al[T.status],r.jsx("span",{children:T.status})]})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Progress"}),r.jsxs("span",{children:[((is=T.iterations)==null?void 0:is.current)||0," / ",((Zr=T.iterations)==null?void 0:Zr.max)||50]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Task"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm",children:(en=T.task)==null?void 0:en.original})]}),T.clarifications&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Clarifications"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-40 overflow-y-auto",children:T.clarifications})]}),T.plan&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Plan"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-60 overflow-y-auto font-mono",children:T.plan})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Max Iterations"}),r.jsx("div",{className:"bg-muted p-2 rounded text-sm",children:((Un=T.iterations)==null?void 0:Un.max)||50})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Completion Promise"}),r.jsxs("div",{className:"bg-muted p-2 rounded text-sm font-mono",children:["<promise>",T.completionPromise||"DONE","</promise>"]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Run Command (uses official ralph-loop plugin)"}),r.jsx("code",{className:"text-xs bg-muted p-3 rounded block whitespace-pre-wrap",children:yr(T)})]})]})]})}),r.jsx(yj,{open:Q,onOpenChange:de=>{oe(de),de||(Be(null),ce())},title:ye?`Loop: ${ye.name}`:"Running Loop",description:(it=ye==null?void 0:ye.task)==null?void 0:it.original,cwd:ye==null?void 0:ye.projectPath,initialCommand:ye?yr(ye):"",env:ye?{CODER_LOOP_ID:ye.id,...ye.workstreamId&&{CODER_WORKSTREAM:ye.workstreamId}}:{},onExit:we})]})}function YH(e,t=[]){let n=[];function s(d,u){const l=C.createContext(u);l.displayName=d+"Context";const c=n.length;n=[...n,u];const f=h=>{var v;const{scope:x,children:w,...j}=h,_=((v=x==null?void 0:x[e])==null?void 0:v[c])||l,b=C.useMemo(()=>j,Object.values(j));return r.jsx(_.Provider,{value:b,children:w})};f.displayName=d+"Provider";function m(h,x){var _;const w=((_=x==null?void 0:x[e])==null?void 0:_[c])||l,j=C.useContext(w);if(j)return j;if(u!==void 0)return u;throw new Error(`\`${h}\` must be used within \`${d}\``)}return[f,m]}const o=()=>{const d=n.map(u=>C.createContext(u));return function(l){const c=(l==null?void 0:l[e])||d;return C.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[s,XH(o,...t)]}function XH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(d){const u=s.reduce((l,{useScope:c,scopeName:f})=>{const h=c(d)[`__scope${f}`];return{...l,...h}},{});return C.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var JH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],e2=JH.reduce((e,t)=>{const n=bu(`Primitive.${t}`),s=C.forwardRef((o,d)=>{const{asChild:u,...l}=o,c=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:d})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),bx="Progress",wx=100,[QH]=YH(bx),[ZH,eW]=QH(bx),t2=C.forwardRef((e,t)=>{const{__scopeProgress:n,value:s=null,max:o,getValueLabel:d=tW,...u}=e;(o||o===0)&&!Zw(o)&&console.error(rW(`${o}`,"Progress"));const l=Zw(o)?o:wx;s!==null&&!e_(s,l)&&console.error(nW(`${s}`,"Progress"));const c=e_(s,l)?s:null,f=uu(c)?d(c,l):void 0;return r.jsx(ZH,{scope:n,value:c,max:l,children:r.jsx(e2.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":uu(c)?c:void 0,"aria-valuetext":f,role:"progressbar","data-state":s2(c,l),"data-value":c??void 0,"data-max":l,...u,ref:t})})});t2.displayName=bx;var r2="ProgressIndicator",n2=C.forwardRef((e,t)=>{const{__scopeProgress:n,...s}=e,o=eW(r2,n);return r.jsx(e2.div,{"data-state":s2(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...s,ref:t})});n2.displayName=r2;function tW(e,t){return`${Math.round(e/t*100)}%`}function s2(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function uu(e){return typeof e=="number"}function Zw(e){return uu(e)&&!isNaN(e)&&e>0}function e_(e,t){return uu(e)&&!isNaN(e)&&e<=t&&e>=0}function rW(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${wx}\`.`}function nW(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
2982
+ This cannot be undone.`))try{const ke=await ge.deleteWorkstream(ee.id);ke.success?(s(Ie=>Ie.filter(qe=>qe.id!==ee.id)),X.success(`Deleted workstream: ${ee.name}`)):X.error(ke.error||"Failed to delete workstream")}catch(ke){X.error("Failed to delete workstream: "+ke.message)}},os=async()=>{if(m){M(!0);try{const ee=await ge.updateWorkstream(m.id,{name:m.name,rules:m.rules,projects:m.projects||[]});ee.success?(s(ke=>ke.map(Ie=>Ie.id===m.id?ee.workstream:Ie)),X.success("Workstream updated"),h(null)):X.error(ee.error||"Failed to update workstream")}catch(ee){X.error("Failed to update workstream: "+ee.message)}finally{M(!1)}}},Fr=ee=>{Ke(ee.id),be(ee.rules||"")},Ai=()=>{Ke(null),be("")},xa=async ee=>{Xe(!0);try{const ke=await ge.updateWorkstream(ee.id,{name:ee.name,rules:ce,projects:ee.projects||[]});ke.success?(s(Ie=>Ie.map(qe=>qe.id===ee.id?ke.workstream:qe)),X.success("Rules updated"),Ke(null),be("")):X.error(ke.error||"Failed to update rules")}catch(ke){X.error("Failed to update rules: "+ke.message)}finally{Xe(!1)}},oc=ee=>{v(ke=>{const Ie=new Set(ke);return Ie.has(ee)?Ie.delete(ee):Ie.add(ee),Ie})},th=async()=>{if(!j||b.size===0)return;M(!0);let ee=0,ke=null;for(const Ie of b)try{const qe=await ge.addProjectToWorkstream(j.id,Ie);qe.success&&(ke=qe.workstream,ee++)}catch(qe){console.error("Failed to add project:",Ie,qe)}ke&&s(Ie=>Ie.map(qe=>qe.id===j.id?ke:qe)),ee>0?X.success(`Added ${ee} project${ee>1?"s":""} to ${j.name}`):X.error("Failed to add projects"),M(!1),w(!1),_(null),v(new Set)},rh=async(ee,ke)=>{try{const Ie=await ge.removeProjectFromWorkstream(ee.id,ke);Ie.success?(s(qe=>qe.map(Tt=>Tt.id===ee.id?Ie.workstream:Tt)),X.success(`Removed project from ${ee.name}`)):X.error(Ie.error||"Failed to remove project")}catch(Ie){X.error("Failed to remove project: "+Ie.message)}},Es=ee=>ee.split("/").pop()||ee,ac=ee=>n.filter(ke=>{var Ie;return(Ie=ke.projects)==null?void 0:Ie.includes(ee)}).length,Ps=(ee,ke=null)=>{var Tt,Nt;const Ie=ac(ee),qe=ke?(Nt=(Tt=n.find(br=>br.id===ke))==null?void 0:Tt.projects)==null?void 0:Nt.includes(ee):!1;return Ie===0?null:Ie===1?qe?null:"in use":"shared"};return o?r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx(et,{className:"w-8 h-8 animate-spin text-indigo-600"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-purple-100 dark:bg-purple-900/30 flex items-center justify-center",children:r.jsx(fs,{className:"w-5 h-5 text-purple-600 dark:text-purple-400"})}),r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Workstreams"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"Context sets for multi-project workflows"})]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(se,{variant:"outline",onClick:mn,size:"sm",children:[r.jsx(vr,{className:"w-4 h-4 mr-2"}),"Refresh"]}),r.jsxs(se,{onClick:()=>f(!0),className:"bg-purple-600 hover:bg-purple-700",children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"New Workstream"]})]})]}),r.jsx("div",{className:"bg-purple-50 dark:bg-purple-950/30 border border-purple-200 dark:border-purple-800 rounded-lg p-4 text-sm text-purple-700 dark:text-purple-400",children:r.jsxs("p",{children:[r.jsx("strong",{children:"Workstreams"})," let you group related repos together so Claude sees them as one cohesive project. Perfect for microservices, monorepos, or any multi-repo setup where context matters. Your custom rules and context persist across sessions, and Claude stays scoped to only the directories you specify."]})}),r.jsx("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm overflow-hidden",children:n.length===0?r.jsxs("div",{className:"p-12 text-center",children:[r.jsx(fs,{className:"w-12 h-12 mx-auto mb-4 text-gray-300 dark:text-slate-600"}),r.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:"No Workstreams Yet"}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 mb-4",children:"Create your first workstream to organize multi-project contexts."}),r.jsxs(se,{onClick:()=>f(!0),children:[r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Create Your First Workstream"]})]}):r.jsx("div",{className:"divide-y divide-gray-100 dark:divide-slate-800",children:n.map(ee=>{var ke,Ie,qe,Tt;return r.jsxs("div",{className:"group",children:[r.jsxs("div",{className:"p-4 flex items-center gap-4 transition-colors cursor-pointer hover:bg-gray-50 dark:hover:bg-slate-900",onClick:()=>l(u===ee.id?null:ee.id),children:[r.jsx("div",{className:"w-5 h-5 flex items-center justify-center text-gray-400",children:u===ee.id?r.jsx(pr,{className:"w-4 h-4"}):r.jsx(Xr,{className:"w-4 h-4"})}),r.jsx("div",{className:"w-10 h-10 rounded-lg flex items-center justify-center bg-gray-100 dark:bg-slate-800",children:r.jsx(fs,{className:"w-5 h-5 text-gray-500 dark:text-slate-400"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"font-medium truncate text-gray-900 dark:text-white",children:ee.name}),((ke=ee.projects)==null?void 0:ke.length)>0&&r.jsxs("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-1.5 py-0.5 rounded",children:[ee.projects.length," project",ee.projects.length!==1?"s":""]}),ee.rules&&r.jsxs("span",{className:"text-xs bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 px-1.5 py-0.5 rounded",children:[r.jsx(Er,{className:"w-3 h-3 inline mr-0.5"}),"Rules"]})]}),r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 truncate",children:((Ie=ee.projects)==null?void 0:Ie.length)>0?ee.projects.map(Nt=>Es(Nt)).join(", "):"No projects added"})]}),r.jsxs("div",{className:"flex items-center gap-2",onClick:Nt=>Nt.stopPropagation(),children:[r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>h({...ee}),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400",title:"Edit workstream",children:r.jsx(rm,{className:"w-4 h-4"})}),r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>Gr(ee),className:"text-gray-500 dark:text-slate-400 hover:text-red-600 dark:hover:text-red-400",title:"Delete workstream",children:r.jsx(un,{className:"w-4 h-4"})})]})]}),u===ee.id&&r.jsxs("div",{className:"px-4 pb-4 pl-16 space-y-4 bg-gray-50/50 dark:bg-slate-900/50",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{_(ee),w(!0)},children:[r.jsx(Bs,{className:"w-4 h-4 mr-1"}),"Add Project"]})]}),((qe=ee.projects)==null?void 0:qe.length)>0?r.jsx("div",{className:"space-y-1",children:ee.projects.map(Nt=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Nt.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>rh(ee,Nt),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(xb,{className:"w-4 h-4"})})]},Nt))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No projects added yet. Add projects to help organize your workstream."})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Trigger Folders"}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(Vo,{className:"w-3.5 h-3.5 text-gray-400"})}),r.jsx(Bt,{children:r.jsx("p",{className:"max-w-xs text-xs",children:"Additional folders that activate this workstream when you cd into them. Projects are always trigger folders automatically."})})]})})]}),r.jsxs(se,{size:"sm",variant:"outline",onClick:()=>{$e(ee),xe(!0)},children:[r.jsx(Bs,{className:"w-4 h-4 mr-1"}),"Add Folder"]})]}),((Tt=ee.triggerFolders)==null?void 0:Tt.length)>0?r.jsx("div",{className:"space-y-1",children:ee.triggerFolders.map(Nt=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:Nt.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>wt(ee,Nt),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx(xb,{className:"w-4 h-4"})})]},Nt))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic",children:"No extra trigger folders. Projects auto-trigger this workstream."})]}),r.jsxs("div",{className:"flex items-center justify-between py-2 px-3 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Auto-Activate on cd"})]}),r.jsxs(Ks,{children:[r.jsx(qs,{asChild:!0,children:r.jsxs(se,{variant:"outline",size:"sm",children:[ee.autoActivate===!0?"On":ee.autoActivate===!1?"Off":"Default",r.jsx(pr,{className:"w-3 h-3 ml-1"})]})}),r.jsxs(Cs,{align:"end",children:[r.jsxs(Mt,{onClick:()=>ar(ee,"on"),children:[r.jsx(Dt,{className:`w-4 h-4 mr-2 ${ee.autoActivate===!0?"opacity-100":"opacity-0"}`}),"On"]}),r.jsxs(Mt,{onClick:()=>ar(ee,"off"),children:[r.jsx(Dt,{className:`w-4 h-4 mr-2 ${ee.autoActivate===!1?"opacity-100":"opacity-0"}`}),"Off"]}),r.jsxs(Mt,{onClick:()=>ar(ee,"default"),children:[r.jsx(Dt,{className:`w-4 h-4 mr-2 ${ee.autoActivate===void 0?"opacity-100":"opacity-0"}`}),"Default (",we.workstreamAutoActivate?"On":"Off",")"]})]})]})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rules"}),Be===ee.id?r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(se,{size:"sm",variant:"ghost",onClick:Ai,disabled:Qe,className:"text-gray-500 dark:text-slate-400 h-7",children:[r.jsx($s,{className:"w-4 h-4 mr-1"}),"Cancel"]}),r.jsxs(se,{size:"sm",onClick:()=>xa(ee),disabled:Qe,className:"bg-purple-600 hover:bg-purple-700 h-7",children:[Qe?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):r.jsx(En,{className:"w-4 h-4 mr-1"}),"Save"]})]}):r.jsxs(se,{size:"sm",variant:"ghost",onClick:()=>Fr(ee),className:"text-gray-500 dark:text-slate-400 hover:text-purple-600 dark:hover:text-purple-400 h-7",children:[r.jsx(rm,{className:"w-4 h-4 mr-1"}),"Edit"]})]}),Be===ee.id?r.jsx(xt,{value:ce,onChange:Nt=>be(Nt.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:8,className:"font-mono text-sm",autoFocus:!0}):ee.rules?r.jsx("pre",{className:"text-sm text-gray-600 dark:text-slate-400 bg-white dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700 p-3 overflow-auto max-h-40 whitespace-pre-wrap cursor-pointer hover:border-purple-300 dark:hover:border-purple-700 transition-colors",onClick:()=>Fr(ee),title:"Click to edit",children:ee.rules}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic cursor-pointer hover:text-purple-600 dark:hover:text-purple-400 transition-colors",onClick:()=>Fr(ee),children:"No rules defined. Click to add context rules for this workstream."})]})]})]},ee.id)})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Hook Integration"}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx("button",{className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",children:r.jsx(Vo,{className:"w-4 h-4"})})}),r.jsx(Bt,{side:"right",className:"max-w-xs",children:r.jsxs("p",{className:"text-sm",children:[r.jsx("strong",{children:"What are hooks?"}),r.jsx("br",{}),r.jsx("br",{}),"Hooks are scripts that run automatically at specific points in Claude Code sessions. The workstream hook runs before each prompt and injects your active workstream's rules into the context.",r.jsx("br",{}),r.jsx("br",{}),r.jsx("strong",{children:"How it works:"}),r.jsx("br",{}),"1. You activate a workstream",r.jsx("br",{}),"2. Hook detects the active workstream",r.jsx("br",{}),"3. Rules are prepended to Claude's context",r.jsx("br",{}),"4. Claude understands your project context"]})})]})})]}),K.isInstalled?r.jsx("div",{className:"bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-800 rounded-lg p-4 text-sm text-green-700 dark:text-green-400",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ea,{className:"w-5 h-5 flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Hook Installed"}),r.jsx("p",{className:"text-green-600 dark:text-green-500",children:"Workstream rules will be automatically injected into every Claude session."})]})]})}):r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-4 text-sm text-amber-700 dark:text-amber-400",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Sn,{className:"w-5 h-5 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium mb-1",children:"Hook Not Installed"}),r.jsx("p",{className:"mb-3",children:"Install the pre-prompt hook to automatically inject workstream rules into every Claude session."}),r.jsxs(se,{onClick:it,disabled:R||K.loading,size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white",children:[R?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(Qi,{className:"w-4 h-4 mr-2"}),"Install Hook"]}),r.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Creates ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.claude/hooks/pre-prompt.sh"})]})]})]})})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Folder Auto-Activation"}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(Vo,{className:"w-4 h-4 text-gray-400"})}),r.jsxs(Bt,{className:"max-w-sm",children:[r.jsx("p",{className:"text-sm mb-2",children:r.jsx("strong",{children:"How it works:"})}),r.jsxs("ol",{className:"text-xs space-y-1 list-decimal list-inside",children:[r.jsx("li",{children:"Install the CD hook to your shell"}),r.jsxs("li",{children:["When you ",r.jsx("code",{className:"bg-slate-700 px-1 rounded",children:"cd"})," into a folder matching a workstream, it auto-activates"]}),r.jsx("li",{children:"If multiple workstreams match, you'll be prompted to choose"})]})]})]})})]}),r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4 pb-4 border-b border-gray-200 dark:border-slate-800",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Global Auto-Activate"}),r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"(default for all workstreams)"})]}),r.jsx(se,{variant:we.workstreamAutoActivate?"default":"outline",size:"sm",onClick:It,children:we.workstreamAutoActivate?"Enabled":"Disabled"})]}),ct.installed?r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-green-50 dark:bg-green-900/20 rounded-lg border border-green-200 dark:border-green-800",children:[r.jsx(ea,{className:"w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium text-green-800 dark:text-green-300",children:"CD Hook Installed"}),r.jsxs("p",{className:"text-xs text-green-600 dark:text-green-400 mt-1",children:["Shell: ",ct.shell," • RC file: ",r.jsx("code",{className:"bg-green-100 dark:bg-green-900/50 px-1 rounded",children:(lc=ct.rcFile)==null?void 0:lc.replace(/^\/Users\/[^/]+/,"~")})]}),r.jsxs(se,{variant:"outline",size:"sm",className:"mt-2",onClick:Fe,disabled:Se,children:[Se?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):null,"Uninstall"]})]})]}):r.jsxs("div",{className:"flex items-start gap-3 p-3 bg-amber-50 dark:bg-amber-900/20 rounded-lg border border-amber-200 dark:border-amber-800",children:[r.jsx(Sn,{className:"w-5 h-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-amber-800 dark:text-amber-300 mb-1",children:"CD Hook Not Installed"}),r.jsx("p",{className:"text-xs text-amber-600 dark:text-amber-400 mb-2",children:"Install the hook to auto-activate workstreams when you cd into matching folders."}),r.jsxs(se,{variant:"default",size:"sm",onClick:de,disabled:Se||ct.loading,className:"bg-amber-600 hover:bg-amber-700 text-white",children:[Se?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(Qi,{className:"w-4 h-4 mr-2"}),"Install CD Hook"]}),r.jsxs("p",{className:"text-xs mt-2 text-amber-600 dark:text-amber-500",children:["Adds function to ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.zshrc"})," or ",r.jsx("code",{className:"bg-amber-100 dark:bg-amber-900/50 px-1 rounded",children:"~/.bashrc"})]})]})]})]})]}),V&&V.totalSessions>0&&r.jsxs("div",{className:"bg-white dark:bg-slate-950 rounded-xl border border-gray-200 dark:border-slate-800 shadow-sm p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(s5,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:"Activity Insights"})]}),r.jsxs(se,{variant:"ghost",size:"sm",onClick:en,className:"text-gray-500 dark:text-slate-400 hover:text-red-500",children:[r.jsx(un,{className:"w-4 h-4 mr-1"}),"Clear Old"]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4 mb-4",children:[r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(OC,{className:"w-3 h-3"}),"Sessions"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:V.totalSessions})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(Er,{className:"w-3 h-3"}),"Files Tracked"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:V.totalFiles})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-gray-500 dark:text-slate-400 text-xs mb-1",children:[r.jsx(fs,{className:"w-3 h-3"}),"Projects Active"]}),r.jsx("div",{className:"text-2xl font-semibold text-gray-900 dark:text-white",children:V.projectCount})]})]}),((va=V.topProjects)==null?void 0:va.length)>0&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-2",children:"Most Active Projects"}),r.jsx("div",{className:"space-y-1",children:V.topProjects.slice(0,5).map((ee,ke)=>r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-600 dark:text-slate-400 truncate",title:ee.path,children:ee.path.split("/").pop()}),r.jsxs("span",{className:"text-gray-400 dark:text-slate-500 text-xs",children:[ee.fileCount," files"]})]},ee.path))})]})]}),Zr.length>0&&r.jsxs("div",{className:"bg-gradient-to-r from-indigo-50 to-purple-50 dark:from-indigo-950/30 dark:to-purple-950/30 rounded-xl border border-indigo-200 dark:border-indigo-800 p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Yt,{className:"w-5 h-5 text-indigo-600 dark:text-indigo-400"}),r.jsx("h3",{className:"font-medium text-indigo-900 dark:text-indigo-300",children:"Suggested Workstreams"}),r.jsx("span",{className:"text-xs bg-indigo-100 dark:bg-indigo-900/50 text-indigo-600 dark:text-indigo-400 px-1.5 py-0.5 rounded",children:"Based on activity patterns"})]}),r.jsx("p",{className:"text-sm text-indigo-700 dark:text-indigo-400 mb-4",children:"These projects are frequently worked on together. Create a workstream to group them?"}),r.jsx("div",{className:"space-y-3",children:Zr.map(ee=>r.jsxs("div",{className:"bg-white dark:bg-slate-900 rounded-lg border border-indigo-200 dark:border-indigo-800 p-3",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"w-4 h-4 text-amber-500"}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ee.name}),ee.coActivityScore&&r.jsxs("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:[ee.coActivityScore,"% co-activity"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(se,{size:"sm",variant:"ghost",onClick:()=>is(ee),className:"text-gray-400 hover:text-gray-600 dark:hover:text-slate-300",title:"Dismiss suggestion",children:r.jsx($s,{className:"w-4 h-4"})}),r.jsxs(se,{size:"sm",onClick:()=>zt(ee),className:"bg-indigo-600 hover:bg-indigo-700",children:[r.jsx(kt,{className:"w-4 h-4 mr-1"}),"Create"]})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1",children:ee.projects.map(ke=>r.jsx("span",{className:"text-xs bg-gray-100 dark:bg-slate-800 text-gray-600 dark:text-slate-400 px-2 py-0.5 rounded",children:ke.split("/").pop()},ke))})]},ee.name))})]}),r.jsxs("div",{className:"bg-gray-50 dark:bg-slate-900 rounded-lg p-4 border border-transparent dark:border-slate-800",children:[r.jsx("h4",{className:"text-sm font-medium text-gray-900 dark:text-white mb-2",children:"CLI Commands"}),r.jsxs("div",{className:"space-y-1 text-sm text-gray-600 dark:text-slate-400 font-mono",children:[r.jsx("p",{children:"coder-config workstream # List workstreams"}),r.jsx("p",{children:'coder-config workstream use "Name" # Set workstream for this tab'}),r.jsx("p",{children:'coder-config workstream create "Name" # Create workstream'})]})]}),r.jsx(_t,{open:c,onOpenChange:ee=>{ee||(f(!1),y(""),E(""),T([]),O(!1),z({}))},children:r.jsxs(vt,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(yt,{children:r.jsxs(bt,{className:"flex items-center gap-2",children:[r.jsx(fs,{className:"w-5 h-5 text-purple-600"}),"Create Workstream"]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(dt,{value:g,onChange:ee=>y(ee.target.value),placeholder:"e.g., User Auth, Admin Dashboard",autoFocus:!0})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(se,{type:"button",size:"sm",variant:"outline",onClick:()=>O(!I),children:[r.jsx(Bs,{className:"w-4 h-4 mr-1"}),"Add"]})]}),P.length>0?r.jsx("div",{className:"space-y-1 mb-2",children:P.map(ee=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:ee.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(se,{type:"button",size:"sm",variant:"ghost",onClick:()=>yr(ee),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx($s,{className:"w-4 h-4"})})]},ee))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects added. Add projects to help organize your workstream."}),I&&e.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-64 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(ee=>{const ke=Ps(ee.path),Ie=B[ee.path],qe=G[ee.path],Tt=q[ee.path]||[],Nt=P.includes(ee.path);return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>dr(ee.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:qe?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):Ie?r.jsx(pr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Xr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>Xt(ee.path),disabled:Nt,className:`flex-1 text-left p-2 rounded transition-colors ${Nt?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ee.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[ke&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${ke==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:ke}),Nt&&r.jsx(Dt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:ee.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),Ie&&Tt.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:Tt.map(br=>{const nr=P.includes(br.dir),wr=Ps(br.dir);return r.jsxs("button",{type:"button",onClick:()=>Xt(br.dir),disabled:nr,className:`w-full text-left p-2 rounded transition-colors ${nr?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:br.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[wr&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${wr==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:wr}),nr&&r.jsx(Dt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono",children:br.relativePath})]},br.dir)})}),Ie&&Tt.length===0&&!qe&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ee.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Context (optional)"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-500 dark:text-slate-400 cursor-pointer",children:[r.jsx(ro,{checked:oe,onCheckedChange:ye,className:"h-3.5 w-3.5"}),"Use Claude"]}),r.jsxs(se,{type:"button",size:"sm",variant:"ghost",onClick:()=>Un(P,E),disabled:te||P.length===0,className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:oe?"Use Claude Code to analyze repos":"Extract from README, package.json, etc.",children:[te?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(Fn,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(xt,{value:k,onChange:ee=>E(ee.target.value),placeholder:"Context rules for this workstream. These will be injected into every Claude session when this workstream is active.",rows:6}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:'Example: "Focus on user authentication. Use JWT tokens. React Query for state management."'})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>{f(!1),y(""),E(""),T([]),O(!1),z({})},children:"Cancel"}),r.jsxs(se,{onClick:ur,disabled:N||!g.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Create"]})]})]})}),r.jsx(_t,{open:!!m,onOpenChange:ee=>!ee&&h(null),children:r.jsxs(vt,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(yt,{children:r.jsxs(bt,{className:"flex items-center gap-2",children:[r.jsx(rm,{className:"w-5 h-5 text-purple-600"}),"Edit Workstream"]})}),m&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Name"}),r.jsx(dt,{value:m.name,onChange:ee=>h(ke=>({...ke,name:ee.target.value}))})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Projects"}),r.jsxs(se,{type:"button",size:"sm",variant:"outline",onClick:()=>h(ee=>({...ee,showPicker:!ee.showPicker})),children:[r.jsx(Bs,{className:"w-4 h-4 mr-1"}),"Add"]})]}),((ya=m.projects)==null?void 0:ya.length)>0?r.jsx("div",{className:"space-y-1 mb-2",children:m.projects.map(ee=>r.jsxs("div",{className:"flex items-center justify-between py-1.5 px-3 bg-gray-50 dark:bg-slate-800 rounded border border-gray-200 dark:border-slate-700",children:[r.jsx("span",{className:"text-sm font-mono text-gray-700 dark:text-slate-300 truncate",children:ee.replace(/^\/Users\/[^/]+/,"~")}),r.jsx(se,{type:"button",size:"sm",variant:"ghost",onClick:()=>h(ke=>({...ke,projects:ke.projects.filter(Ie=>Ie!==ee)})),className:"text-gray-400 hover:text-red-500 h-6 w-6 p-0",children:r.jsx($s,{className:"w-4 h-4"})})]},ee))}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 italic mb-2",children:"No projects in this workstream."}),m.showPicker&&e.length>0&&r.jsx("div",{className:"border border-gray-200 dark:border-slate-700 rounded-lg p-2 max-h-48 overflow-y-auto bg-white dark:bg-slate-900",children:e.map(ee=>{var br;const ke=(br=m.projects)==null?void 0:br.includes(ee.path),Ie=Ps(ee.path,m.id),qe=B[ee.path],Tt=G[ee.path],Nt=q[ee.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>dr(ee.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:Tt?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):qe?r.jsx(pr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Xr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!ke&&h(nr=>({...nr,projects:[...nr.projects||[],ee.path]})),disabled:ke,className:`flex-1 text-left p-2 rounded transition-colors ${ke?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ee.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ie&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Ie==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Ie}),ke&&r.jsx(Dt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:ee.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),qe&&Nt.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:Nt.map(nr=>{var Vn;const wr=(Vn=m.projects)==null?void 0:Vn.includes(nr.dir),pn=Ps(nr.dir,m.id);return r.jsxs("button",{type:"button",onClick:()=>!wr&&h(Ar=>({...Ar,projects:[...Ar.projects||[],nr.dir]})),disabled:wr,className:`w-full text-left p-2 rounded transition-colors ${wr?"bg-purple-50 dark:bg-purple-950/30 opacity-50":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:nr.name}),r.jsxs("div",{className:"flex items-center gap-1",children:[pn&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${pn==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:pn}),wr&&r.jsx(Dt,{className:"w-4 h-4 text-purple-600"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate",children:nr.relativePath})]},nr.dir)})}),qe&&Nt.length===0&&!Tt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ee.id)})})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300",children:"Rules"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-500 dark:text-slate-400 cursor-pointer",children:[r.jsx(ro,{checked:oe,onCheckedChange:ye,className:"h-3.5 w-3.5"}),"Use Claude"]}),r.jsxs(se,{type:"button",size:"sm",variant:"ghost",onClick:()=>Un(m.projects,ee=>h(ke=>({...ke,rules:ee}))),disabled:te||!((ba=m.projects)!=null&&ba.length),className:"text-xs h-7 text-purple-600 hover:text-purple-700 hover:bg-purple-50 dark:hover:bg-purple-950/30",title:oe?"Use Claude Code to analyze repos":"Extract from README, package.json, etc.",children:[te?r.jsx(et,{className:"w-3 h-3 animate-spin mr-1"}):r.jsx(Fn,{className:"w-3 h-3 mr-1"}),"Generate"]})]})]}),r.jsx(xt,{value:m.rules||"",onChange:ee=>h(ke=>({...ke,rules:ee.target.value})),placeholder:"Context rules for this workstream...",rows:8})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),r.jsxs(se,{onClick:os,disabled:N,className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(En,{className:"w-4 h-4 mr-2"}),"Save Changes"]})]})]})}),r.jsx(_t,{open:x,onOpenChange:ee=>{w(ee),ee||(z({}),v(new Set))},children:r.jsxs(vt,{className:"max-w-lg",children:[r.jsx(yt,{children:r.jsxs(bt,{className:"flex items-center gap-2",children:[r.jsx(Bs,{className:"w-5 h-5 text-purple-600"}),"Add Project to ",j==null?void 0:j.name]})}),r.jsxs("div",{className:"py-4",children:[r.jsx("p",{className:"text-sm text-gray-600 dark:text-slate-400 mb-4",children:"Select projects to add to this workstream (multi-select enabled):"}),e.length>0?r.jsx("div",{className:"space-y-1 max-h-64 overflow-y-auto border border-gray-200 dark:border-slate-700 rounded-lg p-2 bg-white dark:bg-slate-900",children:e.map(ee=>{var nr;const ke=(nr=j==null?void 0:j.projects)==null?void 0:nr.includes(ee.path),Ie=b.has(ee.path),qe=Ps(ee.path,j==null?void 0:j.id),Tt=B[ee.path],Nt=G[ee.path],br=q[ee.path]||[];return r.jsxs("div",{className:"mb-1",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:()=>dr(ee.path),className:"p-1 hover:bg-gray-100 dark:hover:bg-slate-800 rounded",title:"Show sub-projects",children:Nt?r.jsx(et,{className:"w-4 h-4 animate-spin text-gray-400"}):Tt?r.jsx(pr,{className:"w-4 h-4 text-gray-400"}):r.jsx(Xr,{className:"w-4 h-4 text-gray-400"})}),r.jsxs("button",{type:"button",onClick:()=>!ke&&oc(ee.path),disabled:ke,className:`flex-1 text-left p-2 rounded transition-colors ${ke?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":Ie?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${ke?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":Ie?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(ke||Ie)&&r.jsx(Dt,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:ee.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[qe&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${qe==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:qe}),ke&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:ee.path.replace(/^\/Users\/[^/]+/,"~")})]})]}),Tt&&br.length>0&&r.jsx("div",{className:"ml-6 mt-1 space-y-1 border-l-2 border-gray-200 dark:border-slate-700 pl-2",children:br.map(wr=>{var cc;const pn=(cc=j==null?void 0:j.projects)==null?void 0:cc.includes(wr.dir),Vn=b.has(wr.dir),Ar=Ps(wr.dir,j==null?void 0:j.id);return r.jsxs("button",{type:"button",onClick:()=>!pn&&oc(wr.dir),disabled:pn,className:`w-full text-left p-2 rounded transition-colors ${pn?"bg-gray-100 dark:bg-slate-800 opacity-50 cursor-not-allowed":Vn?"bg-purple-100 dark:bg-purple-950/50 ring-2 ring-purple-500":"hover:bg-purple-50 dark:hover:bg-purple-950/30"}`,children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-4 h-4 rounded border-2 flex items-center justify-center ${pn?"bg-gray-300 dark:bg-slate-600 border-gray-300 dark:border-slate-600":Vn?"bg-purple-600 border-purple-600":"border-gray-300 dark:border-slate-600"}`,children:(pn||Vn)&&r.jsx(Dt,{className:"w-3 h-3 text-white"})}),r.jsx("span",{className:"text-gray-700 dark:text-slate-300",children:wr.name})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[Ar&&r.jsx("span",{className:`text-xs px-1.5 py-0.5 rounded ${Ar==="shared"?"bg-amber-100 dark:bg-amber-900/50 text-amber-700 dark:text-amber-400":"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-400"}`,children:Ar}),pn&&r.jsx("span",{className:"text-xs text-gray-500 dark:text-slate-400",children:"added"})]})]}),r.jsx("div",{className:"text-xs text-gray-500 dark:text-slate-400 font-mono truncate ml-6",children:wr.relativePath})]},wr.dir)})}),Tt&&br.length===0&&!Nt&&r.jsx("div",{className:"ml-6 mt-1 pl-2 text-xs text-gray-400 dark:text-slate-500 italic",children:"No sub-projects found"})]},ee.id)})}):r.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400 text-center py-4",children:"No projects registered. Add projects in the Projects view first."})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>{w(!1),v(new Set)},children:"Cancel"}),r.jsxs(se,{onClick:th,disabled:b.size===0||N,className:"bg-purple-600 hover:bg-purple-700",children:[N?r.jsx(et,{className:"w-4 h-4 animate-spin mr-2"}):r.jsx(kt,{className:"w-4 h-4 mr-2"}),"Add Selected (",b.size,")"]})]})]})}),r.jsx(_t,{open:ie,onOpenChange:ee=>{ee||(xe(!1),gt(""),$e(null))},children:r.jsxs(vt,{children:[r.jsx(yt,{children:r.jsx(bt,{children:"Add Trigger Folder"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("p",{className:"text-sm text-gray-600 dark:text-slate-400",children:["Add a folder that will trigger the workstream ",r.jsx("strong",{children:Pe==null?void 0:Pe.name})," when you cd into it."]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-slate-300 mb-1 block",children:"Folder Path"}),r.jsx(dt,{value:ze,onChange:ee=>gt(ee.target.value),placeholder:"~/path/to/folder",className:"font-mono"}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1",children:"Use absolute path or ~ for home directory"})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>{xe(!1),gt(""),$e(null)},children:"Cancel"}),r.jsxs(se,{onClick:jt,disabled:!ze.trim(),className:"bg-purple-600 hover:bg-purple-700",children:[r.jsx(Bs,{className:"w-4 h-4 mr-2"}),"Add Folder"]})]})]})})]})}const Qw={clarify:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",plan:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",execute:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},al={pending:r.jsx(vl,{className:"w-4 h-4 text-gray-500"}),running:r.jsx(UC,{className:"w-4 h-4 text-green-500"}),paused:r.jsx(HC,{className:"w-4 h-4 text-yellow-500"}),completed:r.jsx(ea,{className:"w-4 h-4 text-green-600"}),failed:r.jsx(qd,{className:"w-4 h-4 text-red-500"}),cancelled:r.jsx(qd,{className:"w-4 h-4 text-gray-500"})};function qH({activeProject:e=null}){var Xt,dr,is,Zr,en,Un,it;const[t,n]=C.useState([]),[s,o]=C.useState(!0),[d,u]=C.useState(null),[l,c]=C.useState({}),[f,m]=C.useState([]),[h,x]=C.useState(null),[w,j]=C.useState(""),[_,b]=C.useState(!1),[v,g]=C.useState(!1),[y,k]=C.useState(!1),[E,P]=C.useState(!1),[T,N]=C.useState(null),[M,I]=C.useState(""),[O,B]=C.useState(""),[z,q]=C.useState(50),[H,G]=C.useState("DONE"),[J,K]=C.useState(!1),[F,R]=C.useState(50),[L,V]=C.useState(!1),[$,ne]=C.useState("DONE"),[he,me]=C.useState([]),[Y,W]=C.useState({stopHook:{},prepromptHook:{}}),[le,te]=C.useState(!1),[Q,oe]=C.useState(!1),[ye,Be]=C.useState(null);C.useEffect(()=>{ce(),be(),Qe(),Ke()},[]);const Ke=async()=>{try{const de=await ge.getWorkstreams();m(de.workstreams||[]),x(de.activeId||null)}catch(de){console.error("Failed to load workstreams:",de)}};C.useEffect(()=>{_&&h&&B(h)},[_,h]);const ce=async()=>{try{o(!0);const de=await ge.getLoops();n(de.loops||[]),c(de.config||{})}catch{X.error("Failed to load loops")}finally{o(!1)}},be=async()=>{try{const Fe=(await ge.getLoopConfig()).config||{};c(Fe),R(Fe.maxIterations||50),V(Fe.autoApprovePlan||!1),ne(Fe.completionPromise||"DONE"),q(Fe.maxIterations||50),G(Fe.completionPromise||"DONE")}catch(de){console.error("Failed to load config:",de)}},Qe=async()=>{try{const de=await ge.getLoopHookStatus();W(de)}catch(de){console.error("Failed to load hook status:",de)}},Xe=async()=>{try{const de=await ge.getLoopHistory();me(de.completed||[])}catch{X.error("Failed to load history")}},ct=async()=>{if(!M.trim()){X.error("Task description is required");return}try{K(!0);const de=await ge.createLoop(M,{workstreamId:O||null,projectPath:(e==null?void 0:e.path)||(e==null?void 0:e.dir)||null,maxIterations:parseInt(z,10)||50,completionPromise:H||"DONE"});de.success?(X.success("Loop created"),b(!1),I(""),B(""),q(F),G($),ce()):X.error(de.error||"Failed to create loop")}catch(de){X.error(de.message)}finally{K(!1)}},je=async de=>{try{const Fe=await ge.startLoop(de);Fe.success&&Fe.loop?(X.success("Loop started - launching Claude Code"),Be(Fe.loop),oe(!0),ce()):X.error(Fe.error||"Failed to start loop")}catch(Fe){X.error(Fe.message)}},we=C.useCallback(async(de,Fe)=>{var It,ar;if(ye)try{const wt=(await ge.getLoop(ye.id)).loop;wt.taskComplete||wt.status==="completed"?(X.success("Loop completed successfully!"),oe(!1),Be(null)):wt.status==="paused"?X.info(`Loop paused: ${wt.pauseReason||"user requested"}`):((It=wt.iterations)==null?void 0:It.current)>=((ar=wt.iterations)==null?void 0:ar.max)?(X.warning("Loop reached max iterations"),await ge.pauseLoop(wt.id)):X.info("Claude exited. Click Start to continue the loop."),ce()}catch(jt){console.error("Failed to check loop status:",jt)}},[ye]),Le=async de=>{try{const Fe=await ge.pauseLoop(de);Fe.success?(X.success("Loop paused"),ce()):X.error(Fe.error||"Failed to pause loop")}catch(Fe){X.error(Fe.message)}},Se=async de=>{try{const Fe=await ge.resumeLoop(de);Fe.success?(X.success("Loop resumed"),ce()):X.error(Fe.error||"Failed to resume loop")}catch(Fe){X.error(Fe.message)}},Ee=async de=>{if(confirm("Cancel this loop?"))try{const Fe=await ge.cancelLoop(de);Fe.success?(X.success("Loop cancelled"),ce()):X.error(Fe.error||"Failed to cancel loop")}catch(Fe){X.error(Fe.message)}},ie=async de=>{if(confirm("Delete this loop and all its data?"))try{const Fe=await ge.deleteLoop(de);Fe.success?(X.success("Loop deleted"),ce()):X.error(Fe.error||"Failed to delete loop")}catch(Fe){X.error(Fe.message)}},xe=async de=>{try{const Fe=await ge.approveLoop(de);Fe.success?(X.success("Plan approved"),ce()):X.error(Fe.error||"Failed to approve plan")}catch(Fe){X.error(Fe.message)}},Pe=async()=>{try{K(!0);const de=await ge.updateLoopConfig({maxIterations:parseInt(F,10),autoApprovePlan:L,completionPromise:$});de.success?(X.success("Configuration saved"),g(!1),be()):X.error(de.error||"Failed to save configuration")}catch(de){X.error(de.message)}finally{K(!1)}},$e=async()=>{try{te(!0);const de=await ge.installLoopHooks();de.success?(X.success("Hooks installed successfully"),Qe()):X.error(de.error||"Failed to install hooks")}catch(de){X.error(de.message)}finally{te(!1)}},ze=async de=>{try{const Fe=await ge.getLoop(de.id);N({...Fe.loop,clarifications:Fe.clarifications,plan:Fe.plan}),P(!0)}catch{X.error("Failed to load loop details")}},gt=de=>{navigator.clipboard.writeText(de),X.success("Copied to clipboard")},lt=de=>de?new Date(de).toLocaleString():"-",or=de=>de.iterations?Math.min(100,de.iterations.current/de.iterations.max*100):0,Qr=((Xt=Y.stopHook)==null?void 0:Xt.exists)&&((dr=Y.prepromptHook)==null?void 0:dr.exists),Or=de=>{if(!de)return null;const Fe=f.find(It=>It.id===de);return(Fe==null?void 0:Fe.name)||de},zt=w?t.filter(de=>de.workstreamId===w):t,yr=de=>{var jt,wt;const Fe=(((jt=de.task)==null?void 0:jt.original)||"").replace(/"/g,'\\"'),It=((wt=de.iterations)==null?void 0:wt.max)||50,ar=de.completionPromise||"DONE";return`claude --dangerously-skip-permissions "/ralph-loop ${Fe} --max-iterations ${It} --completion-promise '${ar}'"`};return r.jsxs("div",{className:"p-6 space-y-6 max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[r.jsx(El,{className:"w-6 h-6"}),"Ralph Loops"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Autonomous development loops using the official ralph-loop plugin"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[f.length>0&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(hg,{className:"w-4 h-4 text-muted-foreground"}),r.jsxs("select",{className:"text-sm border rounded px-2 py-1 bg-background",value:w,onChange:de=>j(de.target.value),children:[r.jsx("option",{value:"",children:"All workstreams"}),f.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsxs(se,{variant:"outline",size:"sm",onClick:()=>{Xe(),k(!0)},children:[r.jsx(Xd,{className:"w-4 h-4 mr-1"}),"History"]})}),r.jsx(Bt,{children:"View completed loops"})]})}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsxs(se,{variant:"outline",size:"sm",onClick:()=>g(!0),children:[r.jsx(zn,{className:"w-4 h-4 mr-1"}),"Config"]})}),r.jsx(Bt,{children:"Configure loop defaults"})]})}),r.jsxs(se,{onClick:()=>b(!0),children:[r.jsx(kt,{className:"w-4 h-4 mr-1"}),"New Loop"]})]})]}),!Qr&&r.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4 flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Sn,{className:"w-5 h-5 text-yellow-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-yellow-800 dark:text-yellow-200",children:"Hooks not installed"}),r.jsx("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"Install the Ralph Loop hooks to enable automatic loop continuation"})]})]}),r.jsxs(se,{variant:"outline",size:"sm",onClick:$e,disabled:le,children:[le?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Install Hooks"]})]}),s?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(et,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):zt.length===0?r.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[r.jsx(El,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"text-lg font-medium",children:w?"No loops in this workstream":"No loops yet"}),r.jsx("p",{className:"text-sm mt-1",children:"Create a loop to start autonomous development"})]}):r.jsx("div",{className:"space-y-3",children:zt.map(de=>{var Fe,It,ar,jt,wt;return r.jsxs("div",{className:"border rounded-lg bg-card overflow-hidden",children:[r.jsxs("div",{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>u(d===de.id?null:de.id),children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[d===de.id?r.jsx(pr,{className:"w-4 h-4 text-muted-foreground"}):r.jsx(Xr,{className:"w-4 h-4 text-muted-foreground"}),al[de.status]||al.pending,r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium",children:de.name}),r.jsx("p",{className:"text-sm text-muted-foreground truncate max-w-md",children:((Fe=de.task)==null?void 0:Fe.original)||"No task"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[de.workstreamId&&r.jsxs("span",{className:"text-xs px-2 py-0.5 rounded-full bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200 flex items-center gap-1",children:[r.jsx(fs,{className:"w-3 h-3"}),Or(de.workstreamId)]}),r.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${Qw[de.phase]||"bg-gray-100 dark:bg-gray-800"}`,children:de.phase}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[((It=de.iterations)==null?void 0:It.current)||0,"/",((ar=de.iterations)==null?void 0:ar.max)||50]}),r.jsxs("div",{className:"flex items-center gap-1",onClick:mn=>mn.stopPropagation(),children:[de.status==="pending"&&r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>je(de.id),children:r.jsx(UC,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"Start loop"})]})}),de.status==="running"&&r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>Le(de.id),children:r.jsx(HC,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"Pause loop"})]})}),de.status==="paused"&&r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>Se(de.id),children:r.jsx(OM,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"Resume loop"})]})}),de.phase==="plan"&&de.status==="running"&&r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>xe(de.id),children:r.jsx(Dt,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"Approve plan"})]})}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>ze(de),children:r.jsx(dg,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"View details"})]})}),(de.status==="running"||de.status==="paused")&&r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>Ee(de.id),children:r.jsx(qd,{className:"w-4 h-4"})})}),r.jsx(Bt,{children:"Cancel loop"})]})}),r.jsx(kr,{children:r.jsxs(Ut,{children:[r.jsx(Vt,{asChild:!0,children:r.jsx(se,{variant:"ghost",size:"sm",onClick:()=>ie(de.id),children:r.jsx(un,{className:"w-4 h-4 text-red-500"})})}),r.jsx(Bt,{children:"Delete loop"})]})})]})]})]}),r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground mb-1",children:[r.jsx("span",{children:"Iterations"}),r.jsxs("span",{children:[((jt=de.iterations)==null?void 0:jt.current)||0," / ",((wt=de.iterations)==null?void 0:wt.max)||50]})]}),r.jsx("div",{className:"h-1.5 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-blue-500 transition-all",style:{width:`${or(de)}%`}})})]})]}),d===de.id&&r.jsxs("div",{className:"border-t p-4 bg-muted/30 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"ID:"}),r.jsx("span",{className:"ml-2 font-mono",children:de.id}),r.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 ml-1",onClick:()=>gt(de.id),children:r.jsx(Nl,{className:"w-3 h-3"})})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Status:"}),r.jsxs("span",{className:"ml-2",children:[de.status,de.pauseReason?` (${de.pauseReason})`:""]})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Created:"}),r.jsx("span",{className:"ml-2",children:lt(de.createdAt)})]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Updated:"}),r.jsx("span",{className:"ml-2",children:lt(de.updatedAt)})]}),de.workstreamId&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Workstream:"}),r.jsxs("span",{className:"ml-2 inline-flex items-center gap-1",children:[r.jsx(fs,{className:"w-3 h-3 text-purple-500"}),Or(de.workstreamId)]})]})]}),r.jsxs("div",{className:"bg-muted p-3 rounded-md",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ft,{className:"w-4 h-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Run this loop (uses official ralph-loop plugin):"})]}),r.jsx("code",{className:"text-xs bg-background p-2 rounded block whitespace-pre-wrap",children:yr(de)})]})]})]},de.id)})}),r.jsx(_t,{open:_,onOpenChange:b,children:r.jsxs(vt,{className:"sm:max-w-lg",children:[r.jsx(yt,{children:r.jsx(bt,{children:"Create New Loop"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Task Description"}),r.jsx(xt,{placeholder:"Describe what you want Claude to accomplish...",value:M,onChange:de=>I(de.target.value),rows:4}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Be specific about the goal. The loop will continue until this task is completed."})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Project"}),r.jsx("div",{className:"text-sm p-2 bg-muted rounded-md",children:e?r.jsx("span",{className:"font-mono",children:e.name||e.path||e.dir}):r.jsx("span",{className:"text-muted-foreground",children:"No project selected - loop will run in server directory"})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(dt,{type:"number",value:z,onChange:de=>q(de.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Safety limit for the loop"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Completion Promise"}),r.jsx(dt,{value:H,onChange:de=>G(de.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Text that signals completion"})]})]}),f.length>0&&r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Workstream (optional)"}),r.jsxs("select",{className:"w-full border rounded-md p-2 bg-background",value:O,onChange:de=>B(de.target.value),children:[r.jsx("option",{value:"",children:"No workstream"}),f.map(de=>r.jsx("option",{value:de.id,children:de.name},de.id))]})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),r.jsxs(se,{onClick:ct,disabled:J||!M.trim(),children:[J?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Create Loop"]})]})]})}),r.jsx(_t,{open:v,onOpenChange:g,children:r.jsxs(vt,{className:"sm:max-w-md",children:[r.jsx(yt,{children:r.jsx(bt,{children:"Loop Configuration"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Max Iterations"}),r.jsx(dt,{type:"number",value:F,onChange:de=>R(de.target.value),min:1,max:1e3}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Loop will pause after this many iterations"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-1 block",children:"Default Completion Promise"}),r.jsx(dt,{value:$,onChange:de=>ne(de.target.value),placeholder:"DONE"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Default text that signals loop completion (used with official ralph-loop plugin)"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("input",{type:"checkbox",id:"autoApprovePlan",checked:L,onChange:de=>V(de.target.checked),className:"rounded"}),r.jsx("label",{htmlFor:"autoApprovePlan",className:"text-sm",children:"Auto-approve plans (skip manual plan approval)"})]})]}),r.jsxs(At,{children:[r.jsx(se,{variant:"outline",onClick:()=>g(!1),children:"Cancel"}),r.jsxs(se,{onClick:Pe,disabled:J,children:[J?r.jsx(et,{className:"w-4 h-4 animate-spin mr-1"}):null,"Save"]})]})]})}),r.jsx(_t,{open:y,onOpenChange:k,children:r.jsxs(vt,{className:"sm:max-w-2xl max-h-[80vh] overflow-y-auto",children:[r.jsx(yt,{children:r.jsx(bt,{children:"Loop History"})}),r.jsx("div",{className:"space-y-3 py-4",children:he.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No completed loops yet"}):he.slice().reverse().map(de=>r.jsxs("div",{className:"border rounded-lg p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[al[de.status]||al.completed,r.jsx("span",{className:"font-medium",children:de.name})]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:lt(de.completedAt)})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:de.task}),r.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:r.jsxs("span",{children:["Iterations: ",de.totalIterations]})})]},de.id))})]})}),r.jsx(_t,{open:E,onOpenChange:P,children:r.jsxs(vt,{className:"sm:max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsx(yt,{children:r.jsx(bt,{children:(T==null?void 0:T.name)||"Loop Details"})}),T&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4 text-sm",children:[r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Phase"}),r.jsx("span",{className:`text-sm px-2 py-0.5 rounded-full ${Qw[T.phase]||""}`,children:T.phase})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Status"}),r.jsxs("div",{className:"flex items-center gap-1",children:[al[T.status],r.jsx("span",{children:T.status})]})]}),r.jsxs("div",{className:"border rounded p-3",children:[r.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Progress"}),r.jsxs("span",{children:[((is=T.iterations)==null?void 0:is.current)||0," / ",((Zr=T.iterations)==null?void 0:Zr.max)||50]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Task"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm",children:(en=T.task)==null?void 0:en.original})]}),T.clarifications&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Clarifications"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-40 overflow-y-auto",children:T.clarifications})]}),T.plan&&r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Plan"}),r.jsx("div",{className:"bg-muted p-3 rounded text-sm whitespace-pre-wrap max-h-60 overflow-y-auto font-mono",children:T.plan})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Max Iterations"}),r.jsx("div",{className:"bg-muted p-2 rounded text-sm",children:((Un=T.iterations)==null?void 0:Un.max)||50})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Completion Promise"}),r.jsxs("div",{className:"bg-muted p-2 rounded text-sm font-mono",children:["<promise>",T.completionPromise||"DONE","</promise>"]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"text-sm font-medium mb-2",children:"Run Command (uses official ralph-loop plugin)"}),r.jsx("code",{className:"text-xs bg-muted p-3 rounded block whitespace-pre-wrap",children:yr(T)})]})]})]})}),r.jsx(yj,{open:Q,onOpenChange:de=>{oe(de),de||(Be(null),ce())},title:ye?`Loop: ${ye.name}`:"Running Loop",description:(it=ye==null?void 0:ye.task)==null?void 0:it.original,cwd:ye==null?void 0:ye.projectPath,initialCommand:ye?yr(ye):"",env:ye?{CODER_LOOP_ID:ye.id,...ye.workstreamId&&{CODER_WORKSTREAM:ye.workstreamId}}:{},onExit:we})]})}function YH(e,t=[]){let n=[];function s(d,u){const l=C.createContext(u);l.displayName=d+"Context";const c=n.length;n=[...n,u];const f=h=>{var v;const{scope:x,children:w,...j}=h,_=((v=x==null?void 0:x[e])==null?void 0:v[c])||l,b=C.useMemo(()=>j,Object.values(j));return r.jsx(_.Provider,{value:b,children:w})};f.displayName=d+"Provider";function m(h,x){var _;const w=((_=x==null?void 0:x[e])==null?void 0:_[c])||l,j=C.useContext(w);if(j)return j;if(u!==void 0)return u;throw new Error(`\`${h}\` must be used within \`${d}\``)}return[f,m]}const o=()=>{const d=n.map(u=>C.createContext(u));return function(l){const c=(l==null?void 0:l[e])||d;return C.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[s,XH(o,...t)]}function XH(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(d){const u=s.reduce((l,{useScope:c,scopeName:f})=>{const h=c(d)[`__scope${f}`];return{...l,...h}},{});return C.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var JH=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],e2=JH.reduce((e,t)=>{const n=bu(`Primitive.${t}`),s=C.forwardRef((o,d)=>{const{asChild:u,...l}=o,c=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(c,{...l,ref:d})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),bx="Progress",wx=100,[QH]=YH(bx),[ZH,eW]=QH(bx),t2=C.forwardRef((e,t)=>{const{__scopeProgress:n,value:s=null,max:o,getValueLabel:d=tW,...u}=e;(o||o===0)&&!Zw(o)&&console.error(rW(`${o}`,"Progress"));const l=Zw(o)?o:wx;s!==null&&!e_(s,l)&&console.error(nW(`${s}`,"Progress"));const c=e_(s,l)?s:null,f=uu(c)?d(c,l):void 0;return r.jsx(ZH,{scope:n,value:c,max:l,children:r.jsx(e2.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":uu(c)?c:void 0,"aria-valuetext":f,role:"progressbar","data-state":s2(c,l),"data-value":c??void 0,"data-max":l,...u,ref:t})})});t2.displayName=bx;var r2="ProgressIndicator",n2=C.forwardRef((e,t)=>{const{__scopeProgress:n,...s}=e,o=eW(r2,n);return r.jsx(e2.div,{"data-state":s2(o.value,o.max),"data-value":o.value??void 0,"data-max":o.max,...s,ref:t})});n2.displayName=r2;function tW(e,t){return`${Math.round(e/t*100)}%`}function s2(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function uu(e){return typeof e=="number"}function Zw(e){return uu(e)&&!isNaN(e)&&e>0}function e_(e,t){return uu(e)&&!isNaN(e)&&e<=t&&e>=0}function rW(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${wx}\`.`}function nW(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
2983
2983
  - a positive number
2984
2984
  - less than the value passed to \`max\` (or ${wx} if no \`max\` prop is set)
2985
2985
  - \`null\` or \`undefined\` if the progress is indeterminate.
@@ -19,7 +19,7 @@
19
19
 
20
20
  <!-- PWA Manifest -->
21
21
  <link rel="manifest" href="/manifest.json">
22
- <script type="module" crossorigin src="/assets/index-D8VqNb3_.js"></script>
22
+ <script type="module" crossorigin src="/assets/index-CyySGS_H.js"></script>
23
23
  <link rel="stylesheet" crossorigin href="/assets/index-qZ-hWTZQ.css">
24
24
  </head>
25
25
  <body>