@regression-io/claude-config 0.23.10 → 0.23.12

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/config-loader.js CHANGED
@@ -19,7 +19,7 @@ const fs = require('fs');
19
19
  const path = require('path');
20
20
  const { execSync } = require('child_process');
21
21
 
22
- const VERSION = '0.23.10';
22
+ const VERSION = '0.23.12';
23
23
 
24
24
  // Tool-specific path configurations
25
25
  const TOOL_PATHS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@regression-io/claude-config",
3
- "version": "0.23.10",
3
+ "version": "0.23.12",
4
4
  "description": "Configuration management UI for Claude Code and Antigravity - manage MCPs, rules, commands, memory, and project folders",
5
5
  "author": "regression.io",
6
6
  "main": "config-loader.js",
@@ -447,7 +447,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
447
447
  }`,className:"font-mono text-sm min-h-[100px]"})]})]})]})]})]})}const gO=[{id:"Default",name:"Default"},{id:"GitHub",name:"GitHub"},{id:"Monokai",name:"Monokai"},{id:"SolarizedDark",name:"Solarized Dark"},{id:"SolarizedLight",name:"Solarized Light"}];function P1({settings:e,onSave:t,loading:s,settingsPath:o}){const[l,m]=C.useState(e||{}),[f,a]=C.useState(!1),[c,h]=C.useState("rich"),[g,d]=C.useState(JSON.stringify(e||{},null,2)),[_,S]=C.useState({open:!1,name:"",json:""}),[j,b]=C.useState({}),v=async()=>{a(!0);try{if(c==="json")try{const R=JSON.parse(g);await t(R),m(R)}catch{ae.error("Invalid JSON"),a(!1);return}else await t(l),d(JSON.stringify(l,null,2));ae.success("Settings saved")}finally{a(!1)}},y=(R,E,D)=>{m($=>({...$,[R]:{...$[R],[E]:D}}))},p=(R,E,D=!1)=>{var $;return(($=l==null?void 0:l[R])==null?void 0:$[E])??D},x=l.mcpServers||{},k=()=>{const{name:R,json:E}=_;if(!R.trim()){ae.error("Please enter a name for the MCP");return}let D;try{D=JSON.parse(E)}catch{ae.error("Invalid JSON configuration");return}if(!D.command){ae.error('MCP config must have a "command" field');return}m($=>({...$,mcpServers:{...$.mcpServers,[R.trim()]:D}})),S({open:!1,name:"",json:""}),ae.success(`Added MCP: ${R}`)},P=R=>{m(E=>{const{[R]:D,...$}=E.mcpServers||{};return{...E,mcpServers:$}}),ae.success(`Removed MCP: ${R}`)},T=R=>{b(E=>({...E,[R]:!E[R]}))};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"w-10 h-10 rounded-lg bg-blue-500/10 flex items-center justify-center",children:i.jsx(Et,{className:"w-5 h-5 text-blue-500"})}),i.jsxs("div",{children:[i.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:["Gemini CLI Settings",i.jsxs(ot,{variant:"outline",className:"text-xs font-normal text-blue-600 border-blue-300 dark:border-blue-700",children:[i.jsx(ar,{className:"w-3 h-3 mr-1"}),"Google"]})]}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:["Stored in: ",i.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs",children:o})]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex bg-muted rounded-lg p-1",children:[i.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="rich"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>h("rich"),children:"Settings"}),i.jsx("button",{className:`px-3 py-1 text-sm rounded-md transition-colors ${c==="json"?"bg-background shadow-sm":"text-muted-foreground hover:text-foreground"}`,onClick:()=>{d(JSON.stringify(l,null,2)),h("json")},children:"JSON"})]}),i.jsxs(de,{onClick:v,disabled:f||s,children:[f?i.jsx(yt,{className:"w-4 h-4 mr-2 animate-spin"}):i.jsx(ro,{className:"w-4 h-4 mr-2"}),"Save"]})]})]}),c==="json"?i.jsx("div",{className:"border border-border rounded-lg bg-card overflow-hidden",children:i.jsx(it,{value:g,onChange:R=>d(R.target.value),className:"font-mono text-sm min-h-[500px] border-0 rounded-none resize-none",placeholder:"{ }"})}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("h3",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[i.jsx(pa,{className:"w-4 h-4 text-blue-500"}),"MCP Servers",i.jsx(ot,{variant:"secondary",className:"text-xs",children:Object.keys(x).length})]}),i.jsxs(de,{size:"sm",variant:"outline",onClick:()=>S({open:!0,name:"",json:`{
448
448
  "command": "npx",
449
449
  "args": ["-y", "@example/mcp-server"]
450
- }`}),children:[i.jsx(Ot,{className:"w-4 h-4 mr-1"}),"Add MCP"]})]}),i.jsx("div",{className:"space-y-2",children:Object.keys(x).length===0?i.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No MCP servers configured"}):Object.entries(x).map(([R,E])=>i.jsxs(cS,{open:j[R],onOpenChange:()=>T(R),children:[i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-background group",children:[i.jsxs(uS,{className:"flex items-center gap-2 flex-1 text-left",children:[j[R]?i.jsx(ni,{className:"w-4 h-4 text-muted-foreground"}):i.jsx(eo,{className:"w-4 h-4 text-muted-foreground"}),i.jsx(pa,{className:"w-4 h-4 text-blue-500"}),i.jsx("span",{className:"font-medium text-sm",children:R}),i.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:E.command})]}),i.jsx(de,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 text-destructive hover:text-destructive",onClick:()=>P(R),children:i.jsx(xn,{className:"w-4 h-4"})})]}),i.jsx(dS,{children:i.jsx("div",{className:"mt-2 ml-6 p-3 rounded-lg bg-muted/50 border",children:i.jsx("pre",{className:"text-xs font-mono text-muted-foreground overflow-x-auto",children:JSON.stringify(E,null,2)})})})]},R))})]}),i.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[i.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[i.jsx(CT,{className:"w-4 h-4 text-blue-500"}),"Appearance"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Theme"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Color theme for the CLI interface"})]}),i.jsxs(qi,{value:p("theme","name","Default"),onValueChange:R=>y("theme","name",R),children:[i.jsx(Zn,{className:"w-40",children:i.jsx(Yi,{})}),i.jsx(ei,{children:gO.map(R=>i.jsx(gr,{value:R.id,children:R.name},R.id))})]})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Format"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Format for CLI output"})]}),i.jsxs(qi,{value:p("core","outputFormat","text"),onValueChange:R=>y("core","outputFormat",R),children:[i.jsx(Zn,{className:"w-40",children:i.jsx(Yi,{})}),i.jsxs(ei,{children:[i.jsx(gr,{value:"text",children:"Text"}),i.jsx(gr,{value:"json",children:"JSON"})]})]})]})]})]}),i.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[i.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[i.jsx(I_,{className:"w-4 h-4 text-blue-500"}),"Display Options"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Update Window Title"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Show status icons in terminal title"})]}),i.jsx(St,{checked:p("ui","updateWindowTitle",!0),onCheckedChange:R=>y("ui","updateWindowTitle",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Show Line Numbers"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Display line numbers in chat"})]}),i.jsx(St,{checked:p("ui","showLineNumbers",!1),onCheckedChange:R=>y("ui","showLineNumbers",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Show Citations"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Show citations for generated text"})]}),i.jsx(St,{checked:p("ui","showCitations",!1),onCheckedChange:R=>y("ui","showCitations",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Hide Context Summary"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Hide GEMINI.md and MCP servers above input"})]}),i.jsx(St,{checked:p("ui","hideContextSummary",!1),onCheckedChange:R=>y("ui","hideContextSummary",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Hide Working Directory"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Hide current directory path in footer"})]}),i.jsx(St,{checked:p("ui","hideWorkingDirectory",!1),onCheckedChange:R=>y("ui","hideWorkingDirectory",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Hide Model Info"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Hide model name and context usage in footer"})]}),i.jsx(St,{checked:p("ui","hideModelInfo",!1),onCheckedChange:R=>y("ui","hideModelInfo",R)})]})]})]}),i.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[i.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[i.jsx(Yn,{className:"w-4 h-4 text-blue-500"}),"Advanced"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Vim Keybindings"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Use Vim keybindings in the prompt editor"})]}),i.jsx(St,{checked:p("core","enableVimKeybindings",!1),onCheckedChange:R=>y("core","enableVimKeybindings",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Auto-Compress History"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Compress conversation when context exceeds threshold"})]}),i.jsx(St,{checked:p("core","autoCompressHistory",!0),onCheckedChange:R=>y("core","autoCompressHistory",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Sandbox Mode"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Run tool executions in isolated container"})]}),i.jsx(St,{checked:p("sandbox","enabled",!1),onCheckedChange:R=>y("sandbox","enabled",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:["YOLO Mode",i.jsx(ot,{variant:"destructive",className:"text-xs",children:"Dangerous"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Auto-approve all tool calls without confirmation"})]}),i.jsx(St,{checked:p("core","yoloMode",!1),onCheckedChange:R=>y("core","yoloMode",R)})]})]})]}),i.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[i.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[i.jsx(ja,{className:"w-4 h-4 text-blue-500"}),"Privacy"]}),i.jsx("div",{className:"space-y-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Usage Statistics"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow collection of anonymous usage data"})]}),i.jsx(St,{checked:p("privacy","usageStatisticsEnabled",!0),onCheckedChange:R=>y("privacy","usageStatisticsEnabled",R)})]})})]})]}),i.jsx(lr,{open:_.open,onOpenChange:R=>S({..._,open:R}),children:i.jsxs(er,{className:"bg-card",children:[i.jsxs(tr,{children:[i.jsx(sr,{children:"Add MCP Server"}),i.jsx(Rr,{children:"Add a new MCP server to Gemini CLI"})]}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium",children:"Name"}),i.jsx(rt,{value:_.name,onChange:R=>S({..._,name:R.target.value}),placeholder:"my-mcp-server",className:"mt-1"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium",children:"Configuration (JSON)"}),i.jsx(it,{value:_.json,onChange:R=>S({..._,json:R.target.value}),className:"mt-1 font-mono text-sm",rows:6})]})]}),i.jsxs(rr,{children:[i.jsx(de,{variant:"ghost",onClick:()=>S({open:!1,name:"",json:""}),children:"Cancel"}),i.jsxs(de,{onClick:k,children:[i.jsx(Ot,{className:"w-4 h-4 mr-2"}),"Add MCP"]})]})]})})]})}var hu="Checkbox",[vO]=_r(hu),[yO,qp]=vO(hu);function xO(e){const{__scopeCheckbox:t,checked:s,children:o,defaultChecked:l,disabled:m,form:f,name:a,onCheckedChange:c,required:h,value:g="on",internal_do_not_use_render:d}=e,[_,S]=ts({prop:s,defaultProp:l??!1,onChange:c,caller:hu}),[j,b]=C.useState(null),[v,y]=C.useState(null),p=C.useRef(!1),x=j?!!f||!!j.closest("form"):!0,k={checked:_,disabled:m,setChecked:S,control:j,setControl:b,name:a,form:f,value:g,hasConsumerStoppedPropagationRef:p,required:h,defaultChecked:mn(l)?!1:l,isFormControl:x,bubbleInput:v,setBubbleInput:y};return i.jsx(yO,{scope:t,...k,children:_O(d)?d(k):o})}var R1="CheckboxTrigger",T1=C.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:s,...o},l)=>{const{control:m,value:f,disabled:a,checked:c,required:h,setControl:g,setChecked:d,hasConsumerStoppedPropagationRef:_,isFormControl:S,bubbleInput:j}=qp(R1,e),b=We(l,g),v=C.useRef(c);return C.useEffect(()=>{const y=m==null?void 0:m.form;if(y){const p=()=>d(v.current);return y.addEventListener("reset",p),()=>y.removeEventListener("reset",p)}},[m,d]),i.jsx(Fe.button,{type:"button",role:"checkbox","aria-checked":mn(c)?"mixed":c,"aria-required":h,"data-state":O1(c),"data-disabled":a?"":void 0,disabled:a,value:f,...o,ref:b,onKeyDown:_e(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:_e(s,y=>{d(p=>mn(p)?!0:!p),j&&S&&(_.current=y.isPropagationStopped(),_.current||y.stopPropagation())})})});T1.displayName=R1;var Yp=C.forwardRef((e,t)=>{const{__scopeCheckbox:s,name:o,checked:l,defaultChecked:m,required:f,disabled:a,value:c,onCheckedChange:h,form:g,...d}=e;return i.jsx(xO,{__scopeCheckbox:s,checked:l,defaultChecked:m,disabled:a,required:f,onCheckedChange:h,name:o,form:g,value:c,internal_do_not_use_render:({isFormControl:_})=>i.jsxs(i.Fragment,{children:[i.jsx(T1,{...d,ref:t,__scopeCheckbox:s}),_&&i.jsx(L1,{__scopeCheckbox:s})]})})});Yp.displayName=hu;var A1="CheckboxIndicator",M1=C.forwardRef((e,t)=>{const{__scopeCheckbox:s,forceMount:o,...l}=e,m=qp(A1,s);return i.jsx(Kt,{present:o||mn(m.checked)||m.checked===!0,children:i.jsx(Fe.span,{"data-state":O1(m.checked),"data-disabled":m.disabled?"":void 0,...l,ref:t,style:{pointerEvents:"none",...e.style}})})});M1.displayName=A1;var D1="CheckboxBubbleInput",L1=C.forwardRef(({__scopeCheckbox:e,...t},s)=>{const{control:o,hasConsumerStoppedPropagationRef:l,checked:m,defaultChecked:f,required:a,disabled:c,name:h,value:g,form:d,bubbleInput:_,setBubbleInput:S}=qp(D1,e),j=We(s,S),b=cp(m),v=up(o);C.useEffect(()=>{const p=_;if(!p)return;const x=window.HTMLInputElement.prototype,P=Object.getOwnPropertyDescriptor(x,"checked").set,T=!l.current;if(b!==m&&P){const R=new Event("click",{bubbles:T});p.indeterminate=mn(m),P.call(p,mn(m)?!1:m),p.dispatchEvent(R)}},[_,b,m,l]);const y=C.useRef(mn(m)?!1:m);return i.jsx(Fe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??y.current,required:a,disabled:c,name:h,value:g,form:d,...t,tabIndex:-1,ref:j,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});L1.displayName=D1;function _O(e){return typeof e=="function"}function mn(e){return e==="indeterminate"}function O1(e){return mn(e)?"indeterminate":e?"checked":"unchecked"}const I1=C.forwardRef(({className:e,...t},s)=>i.jsx(Yp,{ref:s,className:we("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:i.jsx(M1,{className:we("flex items-center justify-center text-current"),children:i.jsx(Ar,{className:"h-4 w-4"})})}));I1.displayName=Yp.displayName;const Ph={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 wO({open:e,onOpenChange:t,projectDir:s,onSynced:o}){var E,D,$;const[l,m]=C.useState("claude"),[f,a]=C.useState("antigravity"),[c,h]=C.useState(null),[g,d]=C.useState(!1),[_,S]=C.useState(!1),[j,b]=C.useState(new Set);C.useEffect(()=>{e&&s&&v()},[e,l,f,s]),C.useEffect(()=>{e&&b(new Set)},[e]);const v=async()=>{var H;d(!0);try{const U=await Ce.getSyncPreview(s,l,f);h(U);const V=new Set(((H=U.files)==null?void 0:H.filter(q=>q.status==="new"||q.status==="different").map(q=>q.name))||[]);b(V)}catch(U){ae.error("Failed to load sync preview: "+U.message),h(null)}finally{d(!1)}},y=()=>{m(f),a(l)},p=H=>{const U=new Set(j);U.has(H)?U.delete(H):U.add(H),b(U)},x=()=>{var H,U;j.size===((H=c==null?void 0:c.files)==null?void 0:H.length)?b(new Set):b(new Set(((U=c==null?void 0:c.files)==null?void 0:U.map(V=>V.name))||[]))},k=async()=>{if(j.size===0){ae.error("Please select at least one file to sync");return}S(!0);try{const H=await Ce.syncRules(s,l,f,Array.from(j));H.success?(ae.success(`Synced ${H.synced.length} file(s) to ${Ph[f].name}`),o==null||o(),t(!1)):ae.error(H.error||"Sync failed")}catch(H){ae.error("Sync failed: "+H.message)}finally{S(!1)}},P=H=>{switch(H){case"new":return i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700",children:"New"});case"different":return i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-yellow-100 text-yellow-700",children:"Modified"});case"identical":return i.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}},T=Ph[l],R=Ph[f];return i.jsx(lr,{open:e,onOpenChange:t,children:i.jsxs(er,{className:"sm:max-w-lg",children:[i.jsxs(tr,{children:[i.jsxs(sr,{className:"flex items-center gap-2",children:[i.jsx(yr,{className:"w-5 h-5 text-indigo-500"}),"Sync Rules Between Tools"]}),i.jsx(Rr,{children:"Copy rules from one AI tool's configuration to another."})]}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"From"}),i.jsxs(qi,{value:l,onValueChange:m,children:[i.jsx(Zn,{className:"w-full",children:i.jsx(Yi,{})}),i.jsxs(ei,{children:[i.jsx(gr,{value:"claude",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-orange-500"}),"Claude Code"]})}),i.jsx(gr,{value:"gemini",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-blue-500"}),"Gemini CLI"]})}),i.jsx(gr,{value:"antigravity",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-purple-500"}),"Antigravity"]})})]})]})]}),i.jsx(de,{variant:"ghost",size:"icon",onClick:y,className:"mt-5",title:"Swap direction",children:i.jsx(P_,{className:"w-4 h-4"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"To"}),i.jsxs(qi,{value:f,onValueChange:a,children:[i.jsx(Zn,{className:"w-full",children:i.jsx(Yi,{})}),i.jsxs(ei,{children:[i.jsx(gr,{value:"claude",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-orange-500"}),"Claude Code"]})}),i.jsx(gr,{value:"gemini",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-blue-500"}),"Gemini CLI"]})}),i.jsx(gr,{value:"antigravity",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-purple-500"}),"Antigravity"]})})]})]})]})]}),i.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[i.jsxs("div",{children:["Source: ",i.jsxs("code",{className:"bg-muted px-1 rounded",children:[T.folder,"/rules/"]})]}),i.jsxs("div",{children:["Target: ",i.jsxs("code",{className:"bg-muted px-1 rounded",children:[R.folder,"/rules/"]})]})]}),i.jsxs("div",{className:"border rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b bg-muted/30",children:[i.jsx("span",{className:"text-sm font-medium",children:"Rules to Sync"}),((E=c==null?void 0:c.files)==null?void 0:E.length)>0&&i.jsx(de,{variant:"ghost",size:"sm",onClick:x,className:"h-6 text-xs",children:j.size===c.files.length?"Deselect All":"Select All"})]}),i.jsx("div",{className:"max-h-64 overflow-auto",children:g?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(yt,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):c!=null&&c.error?i.jsxs("div",{className:"flex items-center gap-2 p-4 text-sm text-amber-600",children:[i.jsx(da,{className:"w-4 h-4"}),c.error]}):((D=c==null?void 0:c.files)==null?void 0:D.length)===0?i.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:"No rules found in source folder"}):i.jsx("div",{className:"divide-y",children:($=c==null?void 0:c.files)==null?void 0:$.map(H=>i.jsxs("label",{className:we("flex items-center gap-3 px-3 py-2 cursor-pointer hover:bg-muted/30",j.has(H.name)&&"bg-primary/5"),children:[i.jsx(I1,{checked:j.has(H.name),onCheckedChange:()=>p(H.name)}),i.jsx(vr,{className:"w-4 h-4 text-purple-500"}),i.jsx("span",{className:"flex-1 text-sm",children:H.name}),P(H.status)]},H.name))})})]}),(c==null?void 0:c.files)&&j.size>0&&i.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.size," file(s) selected for sync"]})]}),i.jsxs(rr,{children:[i.jsx(de,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),i.jsx(de,{onClick:k,disabled:_||g||j.size===0,children:_?i.jsxs(i.Fragment,{children:[i.jsx(yt,{className:"w-4 h-4 mr-2 animate-spin"}),"Syncing..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Ar,{className:"w-4 h-4 mr-2"}),"Sync ",j.size," File(s)"]})})]})]})})}function bO(e,t){return C.useReducer((s,o)=>t[s][o]??s,e)}var Xp="ScrollArea",[B1]=_r(Xp),[SO,Wr]=B1(Xp),F1=C.forwardRef((e,t)=>{const{__scopeScrollArea:s,type:o="hover",dir:l,scrollHideDelay:m=600,...f}=e,[a,c]=C.useState(null),[h,g]=C.useState(null),[d,_]=C.useState(null),[S,j]=C.useState(null),[b,v]=C.useState(null),[y,p]=C.useState(0),[x,k]=C.useState(0),[P,T]=C.useState(!1),[R,E]=C.useState(!1),D=We(t,H=>c(H)),$=Ea(l);return i.jsx(SO,{scope:s,type:o,dir:$,scrollHideDelay:m,scrollArea:a,viewport:h,onViewportChange:g,content:d,onContentChange:_,scrollbarX:S,onScrollbarXChange:j,scrollbarXEnabled:P,onScrollbarXEnabledChange:T,scrollbarY:b,onScrollbarYChange:v,scrollbarYEnabled:R,onScrollbarYEnabledChange:E,onCornerWidthChange:p,onCornerHeightChange:k,children:i.jsx(Fe.div,{dir:$,...f,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});F1.displayName=Xp;var H1="ScrollAreaViewport",$1=C.forwardRef((e,t)=>{const{__scopeScrollArea:s,children:o,nonce:l,...m}=e,f=Wr(H1,s),a=C.useRef(null),c=We(t,a,f.onViewportChange);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),i.jsx(Fe.div,{"data-radix-scroll-area-viewport":"",...m,ref:c,style:{overflowX:f.scrollbarXEnabled?"scroll":"hidden",overflowY:f.scrollbarYEnabled?"scroll":"hidden",...e.style},children:i.jsx("div",{ref:f.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});$1.displayName=H1;var xs="ScrollAreaScrollbar",Jp=C.forwardRef((e,t)=>{const{forceMount:s,...o}=e,l=Wr(xs,e.__scopeScrollArea),{onScrollbarXEnabledChange:m,onScrollbarYEnabledChange:f}=l,a=e.orientation==="horizontal";return C.useEffect(()=>(a?m(!0):f(!0),()=>{a?m(!1):f(!1)}),[a,m,f]),l.type==="hover"?i.jsx(CO,{...o,ref:t,forceMount:s}):l.type==="scroll"?i.jsx(kO,{...o,ref:t,forceMount:s}):l.type==="auto"?i.jsx(V1,{...o,ref:t,forceMount:s}):l.type==="always"?i.jsx(Qp,{...o,ref:t}):null});Jp.displayName=xs;var CO=C.forwardRef((e,t)=>{const{forceMount:s,...o}=e,l=Wr(xs,e.__scopeScrollArea),[m,f]=C.useState(!1);return C.useEffect(()=>{const a=l.scrollArea;let c=0;if(a){const h=()=>{window.clearTimeout(c),f(!0)},g=()=>{c=window.setTimeout(()=>f(!1),l.scrollHideDelay)};return a.addEventListener("pointerenter",h),a.addEventListener("pointerleave",g),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",h),a.removeEventListener("pointerleave",g)}}},[l.scrollArea,l.scrollHideDelay]),i.jsx(Kt,{present:s||m,children:i.jsx(V1,{"data-state":m?"visible":"hidden",...o,ref:t})})}),kO=C.forwardRef((e,t)=>{const{forceMount:s,...o}=e,l=Wr(xs,e.__scopeScrollArea),m=e.orientation==="horizontal",f=pu(()=>c("SCROLL_END"),100),[a,c]=bO("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return C.useEffect(()=>{if(a==="idle"){const h=window.setTimeout(()=>c("HIDE"),l.scrollHideDelay);return()=>window.clearTimeout(h)}},[a,l.scrollHideDelay,c]),C.useEffect(()=>{const h=l.viewport,g=m?"scrollLeft":"scrollTop";if(h){let d=h[g];const _=()=>{const S=h[g];d!==S&&(c("SCROLL"),f()),d=S};return h.addEventListener("scroll",_),()=>h.removeEventListener("scroll",_)}},[l.viewport,m,c,f]),i.jsx(Kt,{present:s||a!=="hidden",children:i.jsx(Qp,{"data-state":a==="hidden"?"hidden":"visible",...o,ref:t,onPointerEnter:_e(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:_e(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),V1=C.forwardRef((e,t)=>{const s=Wr(xs,e.__scopeScrollArea),{forceMount:o,...l}=e,[m,f]=C.useState(!1),a=e.orientation==="horizontal",c=pu(()=>{if(s.viewport){const h=s.viewport.offsetWidth<s.viewport.scrollWidth,g=s.viewport.offsetHeight<s.viewport.scrollHeight;f(a?h:g)}},10);return Ji(s.viewport,c),Ji(s.content,c),i.jsx(Kt,{present:o||m,children:i.jsx(Qp,{"data-state":m?"visible":"hidden",...l,ref:t})})}),Qp=C.forwardRef((e,t)=>{const{orientation:s="vertical",...o}=e,l=Wr(xs,e.__scopeScrollArea),m=C.useRef(null),f=C.useRef(0),[a,c]=C.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=G1(a.viewport,a.content),g={...o,sizes:a,onSizesChange:c,hasThumb:h>0&&h<1,onThumbChange:_=>m.current=_,onThumbPointerUp:()=>f.current=0,onThumbPointerDown:_=>f.current=_};function d(_,S){return TO(_,f.current,a,S)}return s==="horizontal"?i.jsx(jO,{...g,ref:t,onThumbPositionChange:()=>{if(l.viewport&&m.current){const _=l.viewport.scrollLeft,S=$y(_,a,l.dir);m.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:_=>{l.viewport&&(l.viewport.scrollLeft=_)},onDragScroll:_=>{l.viewport&&(l.viewport.scrollLeft=d(_,l.dir))}}):s==="vertical"?i.jsx(EO,{...g,ref:t,onThumbPositionChange:()=>{if(l.viewport&&m.current){const _=l.viewport.scrollTop,S=$y(_,a);m.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:_=>{l.viewport&&(l.viewport.scrollTop=_)},onDragScroll:_=>{l.viewport&&(l.viewport.scrollTop=d(_))}}):null}),jO=C.forwardRef((e,t)=>{const{sizes:s,onSizesChange:o,...l}=e,m=Wr(xs,e.__scopeScrollArea),[f,a]=C.useState(),c=C.useRef(null),h=We(t,c,m.onScrollbarXChange);return C.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),i.jsx(W1,{"data-orientation":"horizontal",...l,ref:h,sizes:s,style:{bottom:0,left:m.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:m.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":fu(s)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.x),onDragScroll:g=>e.onDragScroll(g.x),onWheelScroll:(g,d)=>{if(m.viewport){const _=m.viewport.scrollLeft+g.deltaX;e.onWheelScroll(_),Y1(_,d)&&g.preventDefault()}},onResize:()=>{c.current&&m.viewport&&f&&o({content:m.viewport.scrollWidth,viewport:m.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Dc(f.paddingLeft),paddingEnd:Dc(f.paddingRight)}})}})}),EO=C.forwardRef((e,t)=>{const{sizes:s,onSizesChange:o,...l}=e,m=Wr(xs,e.__scopeScrollArea),[f,a]=C.useState(),c=C.useRef(null),h=We(t,c,m.onScrollbarYChange);return C.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),i.jsx(W1,{"data-orientation":"vertical",...l,ref:h,sizes:s,style:{top:0,right:m.dir==="ltr"?0:void 0,left:m.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":fu(s)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.y),onDragScroll:g=>e.onDragScroll(g.y),onWheelScroll:(g,d)=>{if(m.viewport){const _=m.viewport.scrollTop+g.deltaY;e.onWheelScroll(_),Y1(_,d)&&g.preventDefault()}},onResize:()=>{c.current&&m.viewport&&f&&o({content:m.viewport.scrollHeight,viewport:m.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Dc(f.paddingTop),paddingEnd:Dc(f.paddingBottom)}})}})}),[NO,z1]=B1(xs),W1=C.forwardRef((e,t)=>{const{__scopeScrollArea:s,sizes:o,hasThumb:l,onThumbChange:m,onThumbPointerUp:f,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:h,onWheelScroll:g,onResize:d,..._}=e,S=Wr(xs,s),[j,b]=C.useState(null),v=We(t,D=>b(D)),y=C.useRef(null),p=C.useRef(""),x=S.viewport,k=o.content-o.viewport,P=It(g),T=It(c),R=pu(d,10);function E(D){if(y.current){const $=D.clientX-y.current.left,H=D.clientY-y.current.top;h({x:$,y:H})}}return C.useEffect(()=>{const D=$=>{const H=$.target;(j==null?void 0:j.contains(H))&&P($,k)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[x,j,k,P]),C.useEffect(T,[o,T]),Ji(j,R),Ji(S.content,R),i.jsx(NO,{scope:s,scrollbar:j,hasThumb:l,onThumbChange:It(m),onThumbPointerUp:It(f),onThumbPositionChange:T,onThumbPointerDown:It(a),children:i.jsx(Fe.div,{..._,ref:v,style:{position:"absolute",..._.style},onPointerDown:_e(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),y.current=j.getBoundingClientRect(),p.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),E(D))}),onPointerMove:_e(e.onPointerMove,E),onPointerUp:_e(e.onPointerUp,D=>{const $=D.target;$.hasPointerCapture(D.pointerId)&&$.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=p.current,S.viewport&&(S.viewport.style.scrollBehavior=""),y.current=null})})})}),Mc="ScrollAreaThumb",U1=C.forwardRef((e,t)=>{const{forceMount:s,...o}=e,l=z1(Mc,e.__scopeScrollArea);return i.jsx(Kt,{present:s||l.hasThumb,children:i.jsx(PO,{ref:t,...o})})}),PO=C.forwardRef((e,t)=>{const{__scopeScrollArea:s,style:o,...l}=e,m=Wr(Mc,s),f=z1(Mc,s),{onThumbPositionChange:a}=f,c=We(t,d=>f.onThumbChange(d)),h=C.useRef(void 0),g=pu(()=>{h.current&&(h.current(),h.current=void 0)},100);return C.useEffect(()=>{const d=m.viewport;if(d){const _=()=>{if(g(),!h.current){const S=AO(d,a);h.current=S,a()}};return a(),d.addEventListener("scroll",_),()=>d.removeEventListener("scroll",_)}},[m.viewport,g,a]),i.jsx(Fe.div,{"data-state":f.hasThumb?"visible":"hidden",...l,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:_e(e.onPointerDownCapture,d=>{const S=d.target.getBoundingClientRect(),j=d.clientX-S.left,b=d.clientY-S.top;f.onThumbPointerDown({x:j,y:b})}),onPointerUp:_e(e.onPointerUp,f.onThumbPointerUp)})});U1.displayName=Mc;var Zp="ScrollAreaCorner",K1=C.forwardRef((e,t)=>{const s=Wr(Zp,e.__scopeScrollArea),o=!!(s.scrollbarX&&s.scrollbarY);return s.type!=="scroll"&&o?i.jsx(RO,{...e,ref:t}):null});K1.displayName=Zp;var RO=C.forwardRef((e,t)=>{const{__scopeScrollArea:s,...o}=e,l=Wr(Zp,s),[m,f]=C.useState(0),[a,c]=C.useState(0),h=!!(m&&a);return Ji(l.scrollbarX,()=>{var d;const g=((d=l.scrollbarX)==null?void 0:d.offsetHeight)||0;l.onCornerHeightChange(g),c(g)}),Ji(l.scrollbarY,()=>{var d;const g=((d=l.scrollbarY)==null?void 0:d.offsetWidth)||0;l.onCornerWidthChange(g),f(g)}),h?i.jsx(Fe.div,{...o,ref:t,style:{width:m,height:a,position:"absolute",right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Dc(e){return e?parseInt(e,10):0}function G1(e,t){const s=e/t;return isNaN(s)?0:s}function fu(e){const t=G1(e.viewport,e.content),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=(e.scrollbar.size-s)*t;return Math.max(o,18)}function TO(e,t,s,o="ltr"){const l=fu(s),m=l/2,f=t||m,a=l-f,c=s.scrollbar.paddingStart+f,h=s.scrollbar.size-s.scrollbar.paddingEnd-a,g=s.content-s.viewport,d=o==="ltr"?[0,g]:[g*-1,0];return q1([c,h],d)(e)}function $y(e,t,s="ltr"){const o=fu(t),l=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,m=t.scrollbar.size-l,f=t.content-t.viewport,a=m-o,c=s==="ltr"?[0,f]:[f*-1,0],h=ef(e,c);return q1([0,f],[0,a])(h)}function q1(e,t){return s=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const o=(t[1]-t[0])/(e[1]-e[0]);return t[0]+o*(s-e[0])}}function Y1(e,t){return e>0&&e<t}var AO=(e,t=()=>{})=>{let s={left:e.scrollLeft,top:e.scrollTop},o=0;return(function l(){const m={left:e.scrollLeft,top:e.scrollTop},f=s.left!==m.left,a=s.top!==m.top;(f||a)&&t(),s=m,o=window.requestAnimationFrame(l)})(),()=>window.cancelAnimationFrame(o)};function pu(e,t){const s=It(e),o=C.useRef(0);return C.useEffect(()=>()=>window.clearTimeout(o.current),[]),C.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(s,t)},[s,t])}function Ji(e,t){const s=It(t);Bt(()=>{let o=0;if(e){const l=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(s)});return l.observe(e),()=>{window.cancelAnimationFrame(o),l.unobserve(e)}}},[e,s])}var X1=F1,MO=$1,DO=K1;const ri=C.forwardRef(({className:e,children:t,...s},o)=>i.jsxs(X1,{ref:o,className:we("relative overflow-hidden",e),...s,children:[i.jsx(MO,{className:"h-full w-full rounded-[inherit]",children:t}),i.jsx(J1,{}),i.jsx(DO,{})]}));ri.displayName=X1.displayName;const J1=C.forwardRef(({className:e,orientation:t="vertical",...s},o)=>i.jsx(Jp,{ref:o,orientation:t,className:we("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...s,children:i.jsx(U1,{className:"relative flex-1 rounded-full bg-border"})}));J1.displayName=Jp.displayName;function em({open:e,onOpenChange:t,onSelect:s,type:o="directory",initialPath:l="~",title:m="Select Path"}){const[f,a]=C.useState(""),[c,h]=C.useState([]),[g,d]=C.useState(!1),[_,S]=C.useState(null),[j,b]=C.useState(""),[v,y]=C.useState("");C.useEffect(()=>{e&&p(l)},[e,l]);const p=async R=>{d(!0),S(null);try{const E=await Ce.browse(R,o);E.error?(S(E.error),E.path&&(a(E.path),y(E.path))):(a(E.path),y(E.path),h(E.items||[]),E.home&&b(E.home))}catch(E){S(E.message)}finally{d(!1)}},x=R=>{R.type==="directory"?p(R.path):o==="file"&&(s(R.path),t(!1))},k=()=>{s(f),t(!1)},P=()=>{v&&p(v)},T=R=>{R.key==="Enter"&&P()};return i.jsx(lr,{open:e,onOpenChange:t,children:i.jsxs(er,{className:"max-w-lg",children:[i.jsx(tr,{children:i.jsxs(sr,{className:"flex items-center gap-2",children:[o==="directory"?i.jsx(Ut,{className:"w-5 h-5"}):i.jsx(Xh,{className:"w-5 h-5"}),m]})}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx(rt,{value:v,onChange:R=>y(R.target.value),onKeyDown:T,placeholder:"Enter path...",className:"font-mono text-sm flex-1"}),i.jsx(de,{variant:"outline",size:"icon",onClick:()=>p(j||"~"),title:"Go to home",children:i.jsx(rp,{className:"w-4 h-4"})}),i.jsx(de,{onClick:P,disabled:g,children:"Go"})]}),i.jsx("div",{className:"text-xs text-gray-500 font-mono truncate px-1",children:f}),_&&i.jsx("div",{className:"text-sm text-red-600 bg-red-50 p-2 rounded",children:_}),i.jsx(ri,{className:"h-64 border rounded-lg",children:g?i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx(yt,{className:"w-6 h-6 animate-spin text-gray-400"})}):i.jsx("div",{className:"p-1",children:c.length===0?i.jsx("div",{className:"text-sm text-gray-500 p-4 text-center",children:o==="directory"?"No subdirectories":"No files found"}):c.map((R,E)=>i.jsxs("button",{onClick:()=>x(R),className:"w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-gray-100 rounded transition-colors text-left",children:[R.type==="directory"?i.jsx(Ut,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):i.jsx(Xh,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),i.jsx("span",{className:`flex-1 truncate ${R.isParent?"text-gray-500":""}`,children:R.name}),R.type==="directory"&&!R.isParent&&i.jsx(eo,{className:"w-4 h-4 text-gray-400"})]},E))})})]}),i.jsxs(rr,{children:[i.jsx(de,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),i.jsx(de,{onClick:k,disabled:!f,children:o==="directory"?"Select Folder":"Select"})]})]})})}const _a={mcps:{icon:pa,color:"text-blue-600",bgColor:"bg-blue-50",label:"MCP Servers"},settings:{icon:Yn,color:"text-gray-600 dark:text-slate-400",bgColor:"bg-gray-50 dark:bg-slate-800",label:"Settings"},command:{icon:Et,color:"text-green-600",bgColor:"bg-green-50",label:"Command"},rule:{icon:qn,color:"text-purple-600",bgColor:"bg-purple-50",label:"Rule"},workflow:{icon:D_,color:"text-cyan-600",bgColor:"bg-cyan-50",label:"Workflow"},claudemd:{icon:vr,color:"text-orange-600",bgColor:"bg-orange-50",label:"CLAUDE.md"},geminimd:{icon:vr,color:"text-blue-600",bgColor:"bg-blue-50",label:"GEMINI.md"},env:{icon:Vc,color:"text-yellow-600",bgColor:"bg-yellow-50",label:".env"},memory:{icon:Ki,color:"text-pink-600",bgColor:"bg-pink-50",label:"Memory"},folder:{icon:Ut,color:"text-yellow-600",bgColor:"bg-yellow-50",label:"Folder"}};function uc({item:e,level:t=0,selectedPath:s,onSelect:o,onContextMenu:l,expandedFolders:m,onToggleFolder:f}){const a=_a[e.type]||_a.folder,c=a.icon,h=s===e.path,g=e.type==="folder",d=m[e.path];return i.jsxs("div",{children:[i.jsxs("div",{className:we("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm","hover:bg-gray-100 dark:hover:bg-slate-700 transition-colors",h&&"bg-blue-100 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/30"),style:{paddingLeft:`${t*16+8}px`},onClick:()=>g?f(e.path):o(e),onContextMenu:_=>l(_,e),children:[g&&i.jsx("span",{className:"w-4 h-4 flex items-center justify-center",children:d?i.jsx(ni,{className:"w-3 h-3"}):i.jsx(eo,{className:"w-3 h-3"})}),!g&&i.jsx("span",{className:"w-4"}),i.jsx(c,{className:we("w-4 h-4",a.color)}),i.jsx("span",{className:"flex-1 truncate",children:e.name}),e.mcpCount>0&&i.jsx(ot,{variant:"secondary",className:"text-xs px-1.5 py-0",children:e.mcpCount})]}),g&&d&&e.children&&i.jsx("div",{children:e.children.map(_=>i.jsx(uc,{item:_,level:t+1,selectedPath:s,onSelect:o,onContextMenu:l,expandedFolders:m,onToggleFolder:f},_.path))})]})}function LO({folder:e,isExpanded:t,isHome:s,isProject:o,isSubproject:l,depth:m=0,onToggle:f,onCreateFile:a,onSelectItem:c,selectedPath:h,onContextMenu:g,expandedFolders:d,onToggleFolder:_,templates:S,hasSubprojects:j,onAddSubproject:b,onRemoveSubproject:v,onHideSubproject:y}){var U,V,q,W,G,J,z,M,B,L;const p=(U=e.files)==null?void 0:U.some(F=>F.name==="mcps.json"),x=(V=e.files)==null?void 0:V.some(F=>F.name==="settings.json"),k=(q=e.files)==null?void 0:q.some(F=>F.name==="CLAUDE.md"||F.name==="CLAUDE.md (root)"),P=(W=e.files)==null?void 0:W.some(F=>F.name===".env"),T=()=>s?"bg-indigo-50 dark:bg-indigo-900/20 hover:bg-indigo-100 dark:hover:bg-indigo-900/30":l?"bg-amber-50 dark:bg-amber-900/20 hover:bg-amber-100 dark:hover:bg-amber-900/30":o?"bg-green-50 dark:bg-green-900/20 hover:bg-green-100 dark:hover:bg-green-900/30":"bg-gray-50 dark:bg-slate-800 hover:bg-gray-100 dark:hover:bg-slate-700",R=()=>s?"text-indigo-700 dark:text-indigo-400":l?"text-amber-700 dark:text-amber-400":o?"text-green-700 dark:text-green-400":"text-gray-700 dark:text-slate-300",D=s?rp:t?yn:Ut,$=s?"Home":e.label,H=(((G=e.files)==null?void 0:G.length)||0)+(((J=e.geminiFiles)==null?void 0:J.length)||0)+(((z=e.agentFiles)==null?void 0:z.length)||0);return i.jsxs("div",{className:"border-b border-gray-200 dark:border-slate-700",children:[i.jsxs("div",{className:we("flex items-center gap-2 py-2 cursor-pointer transition-colors",T()),style:{paddingLeft:`${12+m*16}px`,paddingRight:"12px"},onClick:f,children:[i.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-gray-500",children:t?i.jsx(ni,{className:"w-4 h-4"}):i.jsx(eo,{className:"w-4 h-4"})}),i.jsx(D,{className:we("w-4 h-4",R())}),i.jsx("span",{className:we("flex-1 min-w-0 font-medium text-sm truncate",R()),children:$}),i.jsxs(Ia,{children:[i.jsx(Ba,{asChild:!0,onClick:F=>F.stopPropagation(),children:i.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 flex-shrink-0 hover:bg-white/50 dark:hover:bg-slate-900/50",children:i.jsx(Ot,{className:"w-4 h-4"})})}),i.jsxs(co,{align:"end",className:"w-48",children:[i.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b mb-1",children:[o&&j&&i.jsx(ot,{variant:"outline",className:"text-[10px] px-1 py-0 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 border-green-300 dark:border-green-700",children:"root"}),!e.exists&&!s&&i.jsx(ot,{variant:"outline",className:"text-[10px] px-1 py-0",children:"no config"}),((M=e.appliedTemplate)==null?void 0:M.template)&&i.jsx(ot,{variant:"outline",className:"text-[10px] px-1 py-0 bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 border-purple-300 dark:border-purple-700",children:e.appliedTemplate.template.split("/").pop()}),!l&&e.exists&&!((B=e.appliedTemplate)!=null&&B.template)&&H===0&&i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"configured"})]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"mcps")},disabled:p,className:p?"opacity-50":"",children:[i.jsx(pa,{className:"w-4 h-4 mr-2"}),"mcps.json",p&&i.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"settings")},disabled:x,className:x?"opacity-50":"",children:[i.jsx(Yn,{className:"w-4 h-4 mr-2"}),"settings.json",x&&i.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"env")},disabled:P,className:P?"opacity-50":"",children:[i.jsx(Vc,{className:"w-4 h-4 mr-2"}),".env",P&&i.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),i.jsx(Rs,{}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"command")},children:[i.jsx(Et,{className:"w-4 h-4 mr-2"}),"New Command"]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"rule")},children:[i.jsx(qn,{className:"w-4 h-4 mr-2"}),"New Rule"]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"workflow")},children:[i.jsx(D_,{className:"w-4 h-4 mr-2"}),"New Workflow"]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"memory")},children:[i.jsx(Ki,{className:"w-4 h-4 mr-2"}),"New Memory"]}),i.jsx(Rs,{}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"claudemd")},disabled:k,className:k?"opacity-50":"",children:[i.jsx(vr,{className:"w-4 h-4 mr-2"}),"CLAUDE.md",k&&i.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),(o||l)&&b&&i.jsxs(i.Fragment,{children:[i.jsx(Rs,{}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),b(e.dir)},children:[i.jsx(M_,{className:"w-4 h-4 mr-2"}),"Add Sub-project"]})]}),l&&y&&i.jsxs(ct,{onClick:F=>{F.stopPropagation(),y(e.dir)},children:[i.jsx(T_,{className:"w-4 h-4 mr-2"}),"Hide"]}),e.isManual&&v&&i.jsxs(ct,{onClick:F=>{F.stopPropagation(),v(e.dir)},className:"text-destructive focus:text-destructive",children:[i.jsx(xn,{className:"w-4 h-4 mr-2"}),"Remove"]}),S&&S.length>0&&(l||!j)&&!((L=e.appliedTemplate)!=null&&L.template)&&i.jsxs(i.Fragment,{children:[i.jsx(Rs,{}),i.jsxs(mf,{children:[i.jsxs(Tc,{children:[i.jsx(to,{className:"w-4 h-4 mr-2"}),"Apply Template"]}),i.jsxs(Ac,{children:[S.map(F=>{const Q=F.id||F.name;return i.jsx(ct,{onClick:se=>{se.stopPropagation(),a(e.dir,"template",Q)},children:F.name},Q)}),i.jsx(Rs,{}),i.jsxs(mf,{children:[i.jsx(Tc,{className:"text-xs text-muted-foreground",children:"Mark as Applied (migration)"}),i.jsx(Ac,{children:S.map(F=>{const Q=F.id||F.name;return i.jsx(ct,{onClick:se=>{se.stopPropagation(),a(e.dir,"mark-template",Q)},children:F.name},Q)})})]})]})]})]})]})]})]}),t&&i.jsxs("div",{className:"bg-white dark:bg-slate-950 py-1",children:[e.files&&e.files.length>0&&i.jsxs("div",{className:"mb-1",children:[i.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-orange-600 dark:text-orange-400 uppercase tracking-wide flex items-center gap-1",children:[i.jsx(ar,{className:"w-3 h-3"}),"Claude Code"]}),e.files.map(F=>i.jsx(uc,{item:F,selectedPath:h,onSelect:c,onContextMenu:g,expandedFolders:d,onToggleFolder:_},F.path))]}),e.geminiFiles&&e.geminiFiles.length>0&&i.jsxs("div",{className:"mb-1 border-t border-dashed border-gray-200 dark:border-slate-700 pt-1",children:[i.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wide flex items-center gap-1",children:[i.jsx(ar,{className:"w-3 h-3"}),"Gemini CLI"]}),e.geminiFiles.map(F=>i.jsx(uc,{item:F,selectedPath:h,onSelect:c,onContextMenu:g,expandedFolders:d,onToggleFolder:_},F.path))]}),e.agentFiles&&e.agentFiles.length>0&&i.jsxs("div",{className:"mb-1 border-t border-dashed border-gray-200 dark:border-slate-700 pt-1",children:[i.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-purple-600 dark:text-purple-400 uppercase tracking-wide flex items-center gap-1",children:[i.jsx(ar,{className:"w-3 h-3"}),"Antigravity"]}),e.agentFiles.map(F=>i.jsx(uc,{item:F,selectedPath:h,onSelect:c,onContextMenu:g,expandedFolders:d,onToggleFolder:_},F.path))]}),(!e.files||e.files.length===0)&&(!e.geminiFiles||e.geminiFiles.length===0)&&(!e.agentFiles||e.agentFiles.length===0)&&i.jsx("div",{className:"px-4 py-3 text-sm text-gray-400 dark:text-slate-500 italic text-center",children:"No config files. Use + to create."})]})]})}function OO({content:e,parsed:t,onSave:s,registry:o}){const[l,m]=C.useState(t||{include:[],mcpServers:{}}),[f,a]=C.useState("rich"),[c,h]=C.useState(JSON.stringify(t||{},null,2)),[g,d]=C.useState(!1),[_,S]=C.useState({open:!1,json:""});C.useEffect(()=>{m(t||{include:[],mcpServers:{}}),h(JSON.stringify(t||{},null,2)),d(!1)},[t]);const j=p=>{var k;const x=(k=l.include)!=null&&k.includes(p)?l.include.filter(P=>P!==p):[...l.include||[],p];m({...l,include:x}),d(!0)},b=()=>{if(f==="json")try{const p=JSON.parse(c);s(JSON.stringify(p,null,2))}catch{ae.error("Invalid JSON");return}else s(JSON.stringify(l,null,2));d(!1)},v=()=>{if(!_.json.trim()){ae.error("Please paste the MCP JSON configuration");return}try{let p;try{p=JSON.parse(_.json)}catch{ae.error("Invalid JSON format");return}let x={};if(p.mcpServers&&typeof p.mcpServers=="object")x=p.mcpServers;else if(typeof p=="object"&&!Array.isArray(p)){if(Object.keys(p).includes("command")){ae.error('JSON is missing the MCP name. Expected: { "name": { "command": "...", "args": [...] } }');return}x=p}if(Object.keys(x).length===0){ae.error("No MCP configurations found in the JSON");return}for(const[R,E]of Object.entries(x))if(!E.command){ae.error(`MCP "${R}" is missing required "command" field`);return}const k={...l.mcpServers||{},...x},P={...l,mcpServers:k};m(P),h(JSON.stringify(P,null,2)),d(!0);const T=Object.keys(x).length;ae.success(`Added ${T} MCP${T>1?"s":""} - click Save to apply`),S({open:!1,json:""})}catch(p){ae.error("Failed to add: "+p.message)}},y=o!=null&&o.mcpServers?Object.keys(o.mcpServers):[];return i.jsxs("div",{className:"h-full flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-3 border-b bg-gray-50 dark:bg-slate-800",children:[i.jsx(qc,{value:f,onValueChange:a,children:i.jsxs(Pa,{className:"h-8",children:[i.jsx(es,{value:"rich",className:"text-xs px-3",children:"Rich Editor"}),i.jsx(es,{value:"json",className:"text-xs px-3",children:"JSON"})]})}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(de,{size:"sm",variant:"outline",onClick:()=>S({open:!0,json:""}),children:[i.jsx(Ot,{className:"w-4 h-4 mr-1"}),"Add MCP"]}),g&&i.jsxs(de,{size:"sm",onClick:b,children:[i.jsx(ro,{className:"w-4 h-4 mr-1"}),"Save"]})]})]}),i.jsx(ri,{className:"flex-1",children:f==="rich"?i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium mb-2",children:"Registry MCPs"}),i.jsx("div",{className:"space-y-2",children:y.length===0?i.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"No MCPs in registry"}):y.map(p=>{var x;return i.jsxs("div",{className:"flex items-center justify-between p-2 rounded border bg-white dark:bg-slate-950",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(pa,{className:"w-4 h-4 text-blue-500"}),i.jsx("span",{className:"text-sm",children:p})]}),i.jsx(St,{checked:(x=l.include)==null?void 0:x.includes(p),onCheckedChange:()=>j(p)})]},p)})})]}),Object.keys(l.mcpServers||{}).length>0&&i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium mb-2",children:"Inline MCPs"}),i.jsx("div",{className:"space-y-2",children:Object.entries(l.mcpServers).map(([p,x])=>{var k;return i.jsxs("div",{className:"p-2 rounded border bg-white dark:bg-slate-950 group",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-medium",children:p}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ot,{variant:"outline",className:"text-xs",children:"inline"}),i.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 hover:bg-red-50",onClick:()=>{const{[p]:P,...T}=l.mcpServers,R={...l,mcpServers:T};m(R),h(JSON.stringify(R,null,2)),d(!0),ae.success(`Removed ${p} - click Save to apply`)},children:i.jsx(xn,{className:"w-3.5 h-3.5"})})]})]}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1 font-mono",children:[x.command," ",(k=x.args)==null?void 0:k.join(" ")]})]},p)})})]})]}):i.jsx(it,{className:"w-full h-full min-h-[400px] font-mono text-sm border-0 rounded-none resize-none",value:c,onChange:p=>{h(p.target.value),d(!0)}})}),i.jsx(lr,{open:_.open,onOpenChange:p=>S({..._,open:p}),children:i.jsxs(er,{className:"bg-white dark:bg-slate-950 max-w-2xl",children:[i.jsxs(tr,{children:[i.jsx(sr,{children:"Add MCP to Config"}),i.jsx(Rr,{children:"Paste the MCP JSON configuration to add to this config file."})]}),i.jsxs("div",{className:"py-4",children:[i.jsx(it,{value:_.json,onChange:p=>S({..._,json:p.target.value}),placeholder:`{
450
+ }`}),children:[i.jsx(Ot,{className:"w-4 h-4 mr-1"}),"Add MCP"]})]}),i.jsx("div",{className:"space-y-2",children:Object.keys(x).length===0?i.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No MCP servers configured"}):Object.entries(x).map(([R,E])=>i.jsxs(cS,{open:j[R],onOpenChange:()=>T(R),children:[i.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-background group",children:[i.jsxs(uS,{className:"flex items-center gap-2 flex-1 text-left",children:[j[R]?i.jsx(ni,{className:"w-4 h-4 text-muted-foreground"}):i.jsx(eo,{className:"w-4 h-4 text-muted-foreground"}),i.jsx(pa,{className:"w-4 h-4 text-blue-500"}),i.jsx("span",{className:"font-medium text-sm",children:R}),i.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:E.command})]}),i.jsx(de,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100 text-destructive hover:text-destructive",onClick:()=>P(R),children:i.jsx(xn,{className:"w-4 h-4"})})]}),i.jsx(dS,{children:i.jsx("div",{className:"mt-2 ml-6 p-3 rounded-lg bg-muted/50 border",children:i.jsx("pre",{className:"text-xs font-mono text-muted-foreground overflow-x-auto",children:JSON.stringify(E,null,2)})})})]},R))})]}),i.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[i.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[i.jsx(CT,{className:"w-4 h-4 text-blue-500"}),"Appearance"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Theme"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Color theme for the CLI interface"})]}),i.jsxs(qi,{value:p("theme","name","Default"),onValueChange:R=>y("theme","name",R),children:[i.jsx(Zn,{className:"w-40",children:i.jsx(Yi,{})}),i.jsx(ei,{children:gO.map(R=>i.jsx(gr,{value:R.id,children:R.name},R.id))})]})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Output Format"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Format for CLI output"})]}),i.jsxs(qi,{value:p("core","outputFormat","text"),onValueChange:R=>y("core","outputFormat",R),children:[i.jsx(Zn,{className:"w-40",children:i.jsx(Yi,{})}),i.jsxs(ei,{children:[i.jsx(gr,{value:"text",children:"Text"}),i.jsx(gr,{value:"json",children:"JSON"})]})]})]})]})]}),i.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[i.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[i.jsx(I_,{className:"w-4 h-4 text-blue-500"}),"Display Options"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Update Window Title"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Show status icons in terminal title"})]}),i.jsx(St,{checked:p("ui","updateWindowTitle",!0),onCheckedChange:R=>y("ui","updateWindowTitle",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Show Line Numbers"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Display line numbers in chat"})]}),i.jsx(St,{checked:p("ui","showLineNumbers",!1),onCheckedChange:R=>y("ui","showLineNumbers",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Show Citations"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Show citations for generated text"})]}),i.jsx(St,{checked:p("ui","showCitations",!1),onCheckedChange:R=>y("ui","showCitations",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Hide Context Summary"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Hide GEMINI.md and MCP servers above input"})]}),i.jsx(St,{checked:p("ui","hideContextSummary",!1),onCheckedChange:R=>y("ui","hideContextSummary",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Hide Working Directory"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Hide current directory path in footer"})]}),i.jsx(St,{checked:p("ui","hideWorkingDirectory",!1),onCheckedChange:R=>y("ui","hideWorkingDirectory",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Hide Model Info"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Hide model name and context usage in footer"})]}),i.jsx(St,{checked:p("ui","hideModelInfo",!1),onCheckedChange:R=>y("ui","hideModelInfo",R)})]})]})]}),i.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[i.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[i.jsx(Yn,{className:"w-4 h-4 text-blue-500"}),"Advanced"]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Vim Keybindings"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Use Vim keybindings in the prompt editor"})]}),i.jsx(St,{checked:p("core","enableVimKeybindings",!1),onCheckedChange:R=>y("core","enableVimKeybindings",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Auto-Compress History"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Compress conversation when context exceeds threshold"})]}),i.jsx(St,{checked:p("core","autoCompressHistory",!0),onCheckedChange:R=>y("core","autoCompressHistory",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Sandbox Mode"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Run tool executions in isolated container"})]}),i.jsx(St,{checked:p("sandbox","enabled",!1),onCheckedChange:R=>y("sandbox","enabled",R)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsxs("label",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:["YOLO Mode",i.jsx(ot,{variant:"destructive",className:"text-xs",children:"Dangerous"})]}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Auto-approve all tool calls without confirmation"})]}),i.jsx(St,{checked:p("core","yoloMode",!1),onCheckedChange:R=>y("core","yoloMode",R)})]})]})]}),i.jsxs("div",{className:"border border-border rounded-lg p-4 bg-card",children:[i.jsxs("h3",{className:"text-sm font-medium text-foreground mb-4 flex items-center gap-2",children:[i.jsx(ja,{className:"w-4 h-4 text-blue-500"}),"Privacy"]}),i.jsx("div",{className:"space-y-4",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-foreground",children:"Usage Statistics"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Allow collection of anonymous usage data"})]}),i.jsx(St,{checked:p("privacy","usageStatisticsEnabled",!0),onCheckedChange:R=>y("privacy","usageStatisticsEnabled",R)})]})})]})]}),i.jsx(lr,{open:_.open,onOpenChange:R=>S({..._,open:R}),children:i.jsxs(er,{className:"bg-card",children:[i.jsxs(tr,{children:[i.jsx(sr,{children:"Add MCP Server"}),i.jsx(Rr,{children:"Add a new MCP server to Gemini CLI"})]}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium",children:"Name"}),i.jsx(rt,{value:_.name,onChange:R=>S({..._,name:R.target.value}),placeholder:"my-mcp-server",className:"mt-1"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium",children:"Configuration (JSON)"}),i.jsx(it,{value:_.json,onChange:R=>S({..._,json:R.target.value}),className:"mt-1 font-mono text-sm",rows:6})]})]}),i.jsxs(rr,{children:[i.jsx(de,{variant:"ghost",onClick:()=>S({open:!1,name:"",json:""}),children:"Cancel"}),i.jsxs(de,{onClick:k,children:[i.jsx(Ot,{className:"w-4 h-4 mr-2"}),"Add MCP"]})]})]})})]})}var hu="Checkbox",[vO]=_r(hu),[yO,qp]=vO(hu);function xO(e){const{__scopeCheckbox:t,checked:s,children:o,defaultChecked:l,disabled:m,form:f,name:a,onCheckedChange:c,required:h,value:g="on",internal_do_not_use_render:d}=e,[_,S]=ts({prop:s,defaultProp:l??!1,onChange:c,caller:hu}),[j,b]=C.useState(null),[v,y]=C.useState(null),p=C.useRef(!1),x=j?!!f||!!j.closest("form"):!0,k={checked:_,disabled:m,setChecked:S,control:j,setControl:b,name:a,form:f,value:g,hasConsumerStoppedPropagationRef:p,required:h,defaultChecked:mn(l)?!1:l,isFormControl:x,bubbleInput:v,setBubbleInput:y};return i.jsx(yO,{scope:t,...k,children:_O(d)?d(k):o})}var R1="CheckboxTrigger",T1=C.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:s,...o},l)=>{const{control:m,value:f,disabled:a,checked:c,required:h,setControl:g,setChecked:d,hasConsumerStoppedPropagationRef:_,isFormControl:S,bubbleInput:j}=qp(R1,e),b=We(l,g),v=C.useRef(c);return C.useEffect(()=>{const y=m==null?void 0:m.form;if(y){const p=()=>d(v.current);return y.addEventListener("reset",p),()=>y.removeEventListener("reset",p)}},[m,d]),i.jsx(Fe.button,{type:"button",role:"checkbox","aria-checked":mn(c)?"mixed":c,"aria-required":h,"data-state":O1(c),"data-disabled":a?"":void 0,disabled:a,value:f,...o,ref:b,onKeyDown:_e(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:_e(s,y=>{d(p=>mn(p)?!0:!p),j&&S&&(_.current=y.isPropagationStopped(),_.current||y.stopPropagation())})})});T1.displayName=R1;var Yp=C.forwardRef((e,t)=>{const{__scopeCheckbox:s,name:o,checked:l,defaultChecked:m,required:f,disabled:a,value:c,onCheckedChange:h,form:g,...d}=e;return i.jsx(xO,{__scopeCheckbox:s,checked:l,defaultChecked:m,disabled:a,required:f,onCheckedChange:h,name:o,form:g,value:c,internal_do_not_use_render:({isFormControl:_})=>i.jsxs(i.Fragment,{children:[i.jsx(T1,{...d,ref:t,__scopeCheckbox:s}),_&&i.jsx(L1,{__scopeCheckbox:s})]})})});Yp.displayName=hu;var A1="CheckboxIndicator",M1=C.forwardRef((e,t)=>{const{__scopeCheckbox:s,forceMount:o,...l}=e,m=qp(A1,s);return i.jsx(Kt,{present:o||mn(m.checked)||m.checked===!0,children:i.jsx(Fe.span,{"data-state":O1(m.checked),"data-disabled":m.disabled?"":void 0,...l,ref:t,style:{pointerEvents:"none",...e.style}})})});M1.displayName=A1;var D1="CheckboxBubbleInput",L1=C.forwardRef(({__scopeCheckbox:e,...t},s)=>{const{control:o,hasConsumerStoppedPropagationRef:l,checked:m,defaultChecked:f,required:a,disabled:c,name:h,value:g,form:d,bubbleInput:_,setBubbleInput:S}=qp(D1,e),j=We(s,S),b=cp(m),v=up(o);C.useEffect(()=>{const p=_;if(!p)return;const x=window.HTMLInputElement.prototype,P=Object.getOwnPropertyDescriptor(x,"checked").set,T=!l.current;if(b!==m&&P){const R=new Event("click",{bubbles:T});p.indeterminate=mn(m),P.call(p,mn(m)?!1:m),p.dispatchEvent(R)}},[_,b,m,l]);const y=C.useRef(mn(m)?!1:m);return i.jsx(Fe.input,{type:"checkbox","aria-hidden":!0,defaultChecked:f??y.current,required:a,disabled:c,name:h,value:g,form:d,...t,tabIndex:-1,ref:j,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});L1.displayName=D1;function _O(e){return typeof e=="function"}function mn(e){return e==="indeterminate"}function O1(e){return mn(e)?"indeterminate":e?"checked":"unchecked"}const I1=C.forwardRef(({className:e,...t},s)=>i.jsx(Yp,{ref:s,className:we("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:i.jsx(M1,{className:we("flex items-center justify-center text-current"),children:i.jsx(Ar,{className:"h-4 w-4"})})}));I1.displayName=Yp.displayName;const Ph={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 wO({open:e,onOpenChange:t,projectDir:s,onSynced:o}){var E,D,$;const[l,m]=C.useState("claude"),[f,a]=C.useState("antigravity"),[c,h]=C.useState(null),[g,d]=C.useState(!1),[_,S]=C.useState(!1),[j,b]=C.useState(new Set);C.useEffect(()=>{e&&s&&v()},[e,l,f,s]),C.useEffect(()=>{e&&b(new Set)},[e]);const v=async()=>{var H;d(!0);try{const U=await Ce.getSyncPreview(s,l,f);h(U);const V=new Set(((H=U.files)==null?void 0:H.filter(q=>q.status==="new"||q.status==="different").map(q=>q.name))||[]);b(V)}catch(U){ae.error("Failed to load sync preview: "+U.message),h(null)}finally{d(!1)}},y=()=>{m(f),a(l)},p=H=>{const U=new Set(j);U.has(H)?U.delete(H):U.add(H),b(U)},x=()=>{var H,U;j.size===((H=c==null?void 0:c.files)==null?void 0:H.length)?b(new Set):b(new Set(((U=c==null?void 0:c.files)==null?void 0:U.map(V=>V.name))||[]))},k=async()=>{if(j.size===0){ae.error("Please select at least one file to sync");return}S(!0);try{const H=await Ce.syncRules(s,l,f,Array.from(j));H.success?(ae.success(`Synced ${H.synced.length} file(s) to ${Ph[f].name}`),o==null||o(),t(!1)):ae.error(H.error||"Sync failed")}catch(H){ae.error("Sync failed: "+H.message)}finally{S(!1)}},P=H=>{switch(H){case"new":return i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-green-100 text-green-700",children:"New"});case"different":return i.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-yellow-100 text-yellow-700",children:"Modified"});case"identical":return i.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}},T=Ph[l],R=Ph[f];return i.jsx(lr,{open:e,onOpenChange:t,children:i.jsxs(er,{className:"sm:max-w-lg",children:[i.jsxs(tr,{children:[i.jsxs(sr,{className:"flex items-center gap-2",children:[i.jsx(yr,{className:"w-5 h-5 text-indigo-500"}),"Sync Rules Between Tools"]}),i.jsx(Rr,{children:"Copy rules from one AI tool's configuration to another."})]}),i.jsxs("div",{className:"space-y-4 py-4",children:[i.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"From"}),i.jsxs(qi,{value:l,onValueChange:m,children:[i.jsx(Zn,{className:"w-full",children:i.jsx(Yi,{})}),i.jsxs(ei,{children:[i.jsx(gr,{value:"claude",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-orange-500"}),"Claude Code"]})}),i.jsx(gr,{value:"gemini",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-blue-500"}),"Gemini CLI"]})}),i.jsx(gr,{value:"antigravity",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-purple-500"}),"Antigravity"]})})]})]})]}),i.jsx(de,{variant:"ghost",size:"icon",onClick:y,className:"mt-5",title:"Swap direction",children:i.jsx(P_,{className:"w-4 h-4"})}),i.jsxs("div",{className:"flex-1",children:[i.jsx("label",{className:"text-xs text-muted-foreground mb-1 block",children:"To"}),i.jsxs(qi,{value:f,onValueChange:a,children:[i.jsx(Zn,{className:"w-full",children:i.jsx(Yi,{})}),i.jsxs(ei,{children:[i.jsx(gr,{value:"claude",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-orange-500"}),"Claude Code"]})}),i.jsx(gr,{value:"gemini",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-blue-500"}),"Gemini CLI"]})}),i.jsx(gr,{value:"antigravity",children:i.jsxs("span",{className:"flex items-center gap-2",children:[i.jsx(ar,{className:"w-3 h-3 text-purple-500"}),"Antigravity"]})})]})]})]})]}),i.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[i.jsxs("div",{children:["Source: ",i.jsxs("code",{className:"bg-muted px-1 rounded",children:[T.folder,"/rules/"]})]}),i.jsxs("div",{children:["Target: ",i.jsxs("code",{className:"bg-muted px-1 rounded",children:[R.folder,"/rules/"]})]})]}),i.jsxs("div",{className:"border rounded-lg",children:[i.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b bg-muted/30",children:[i.jsx("span",{className:"text-sm font-medium",children:"Rules to Sync"}),((E=c==null?void 0:c.files)==null?void 0:E.length)>0&&i.jsx(de,{variant:"ghost",size:"sm",onClick:x,className:"h-6 text-xs",children:j.size===c.files.length?"Deselect All":"Select All"})]}),i.jsx("div",{className:"max-h-64 overflow-auto",children:g?i.jsx("div",{className:"flex items-center justify-center py-8",children:i.jsx(yt,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):c!=null&&c.error?i.jsxs("div",{className:"flex items-center gap-2 p-4 text-sm text-amber-600",children:[i.jsx(da,{className:"w-4 h-4"}),c.error]}):((D=c==null?void 0:c.files)==null?void 0:D.length)===0?i.jsx("div",{className:"p-4 text-sm text-muted-foreground text-center",children:"No rules found in source folder"}):i.jsx("div",{className:"divide-y",children:($=c==null?void 0:c.files)==null?void 0:$.map(H=>i.jsxs("label",{className:we("flex items-center gap-3 px-3 py-2 cursor-pointer hover:bg-muted/30",j.has(H.name)&&"bg-primary/5"),children:[i.jsx(I1,{checked:j.has(H.name),onCheckedChange:()=>p(H.name)}),i.jsx(vr,{className:"w-4 h-4 text-purple-500"}),i.jsx("span",{className:"flex-1 text-sm",children:H.name}),P(H.status)]},H.name))})})]}),(c==null?void 0:c.files)&&j.size>0&&i.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.size," file(s) selected for sync"]})]}),i.jsxs(rr,{children:[i.jsx(de,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),i.jsx(de,{onClick:k,disabled:_||g||j.size===0,children:_?i.jsxs(i.Fragment,{children:[i.jsx(yt,{className:"w-4 h-4 mr-2 animate-spin"}),"Syncing..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Ar,{className:"w-4 h-4 mr-2"}),"Sync ",j.size," File(s)"]})})]})]})})}function bO(e,t){return C.useReducer((s,o)=>t[s][o]??s,e)}var Xp="ScrollArea",[B1]=_r(Xp),[SO,Wr]=B1(Xp),F1=C.forwardRef((e,t)=>{const{__scopeScrollArea:s,type:o="hover",dir:l,scrollHideDelay:m=600,...f}=e,[a,c]=C.useState(null),[h,g]=C.useState(null),[d,_]=C.useState(null),[S,j]=C.useState(null),[b,v]=C.useState(null),[y,p]=C.useState(0),[x,k]=C.useState(0),[P,T]=C.useState(!1),[R,E]=C.useState(!1),D=We(t,H=>c(H)),$=Ea(l);return i.jsx(SO,{scope:s,type:o,dir:$,scrollHideDelay:m,scrollArea:a,viewport:h,onViewportChange:g,content:d,onContentChange:_,scrollbarX:S,onScrollbarXChange:j,scrollbarXEnabled:P,onScrollbarXEnabledChange:T,scrollbarY:b,onScrollbarYChange:v,scrollbarYEnabled:R,onScrollbarYEnabledChange:E,onCornerWidthChange:p,onCornerHeightChange:k,children:i.jsx(Fe.div,{dir:$,...f,ref:D,style:{position:"relative","--radix-scroll-area-corner-width":y+"px","--radix-scroll-area-corner-height":x+"px",...e.style}})})});F1.displayName=Xp;var H1="ScrollAreaViewport",$1=C.forwardRef((e,t)=>{const{__scopeScrollArea:s,children:o,nonce:l,...m}=e,f=Wr(H1,s),a=C.useRef(null),c=We(t,a,f.onViewportChange);return i.jsxs(i.Fragment,{children:[i.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),i.jsx(Fe.div,{"data-radix-scroll-area-viewport":"",...m,ref:c,style:{overflowX:f.scrollbarXEnabled?"scroll":"hidden",overflowY:f.scrollbarYEnabled?"scroll":"hidden",...e.style},children:i.jsx("div",{ref:f.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});$1.displayName=H1;var xs="ScrollAreaScrollbar",Jp=C.forwardRef((e,t)=>{const{forceMount:s,...o}=e,l=Wr(xs,e.__scopeScrollArea),{onScrollbarXEnabledChange:m,onScrollbarYEnabledChange:f}=l,a=e.orientation==="horizontal";return C.useEffect(()=>(a?m(!0):f(!0),()=>{a?m(!1):f(!1)}),[a,m,f]),l.type==="hover"?i.jsx(CO,{...o,ref:t,forceMount:s}):l.type==="scroll"?i.jsx(kO,{...o,ref:t,forceMount:s}):l.type==="auto"?i.jsx(V1,{...o,ref:t,forceMount:s}):l.type==="always"?i.jsx(Qp,{...o,ref:t}):null});Jp.displayName=xs;var CO=C.forwardRef((e,t)=>{const{forceMount:s,...o}=e,l=Wr(xs,e.__scopeScrollArea),[m,f]=C.useState(!1);return C.useEffect(()=>{const a=l.scrollArea;let c=0;if(a){const h=()=>{window.clearTimeout(c),f(!0)},g=()=>{c=window.setTimeout(()=>f(!1),l.scrollHideDelay)};return a.addEventListener("pointerenter",h),a.addEventListener("pointerleave",g),()=>{window.clearTimeout(c),a.removeEventListener("pointerenter",h),a.removeEventListener("pointerleave",g)}}},[l.scrollArea,l.scrollHideDelay]),i.jsx(Kt,{present:s||m,children:i.jsx(V1,{"data-state":m?"visible":"hidden",...o,ref:t})})}),kO=C.forwardRef((e,t)=>{const{forceMount:s,...o}=e,l=Wr(xs,e.__scopeScrollArea),m=e.orientation==="horizontal",f=pu(()=>c("SCROLL_END"),100),[a,c]=bO("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return C.useEffect(()=>{if(a==="idle"){const h=window.setTimeout(()=>c("HIDE"),l.scrollHideDelay);return()=>window.clearTimeout(h)}},[a,l.scrollHideDelay,c]),C.useEffect(()=>{const h=l.viewport,g=m?"scrollLeft":"scrollTop";if(h){let d=h[g];const _=()=>{const S=h[g];d!==S&&(c("SCROLL"),f()),d=S};return h.addEventListener("scroll",_),()=>h.removeEventListener("scroll",_)}},[l.viewport,m,c,f]),i.jsx(Kt,{present:s||a!=="hidden",children:i.jsx(Qp,{"data-state":a==="hidden"?"hidden":"visible",...o,ref:t,onPointerEnter:_e(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:_e(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),V1=C.forwardRef((e,t)=>{const s=Wr(xs,e.__scopeScrollArea),{forceMount:o,...l}=e,[m,f]=C.useState(!1),a=e.orientation==="horizontal",c=pu(()=>{if(s.viewport){const h=s.viewport.offsetWidth<s.viewport.scrollWidth,g=s.viewport.offsetHeight<s.viewport.scrollHeight;f(a?h:g)}},10);return Ji(s.viewport,c),Ji(s.content,c),i.jsx(Kt,{present:o||m,children:i.jsx(Qp,{"data-state":m?"visible":"hidden",...l,ref:t})})}),Qp=C.forwardRef((e,t)=>{const{orientation:s="vertical",...o}=e,l=Wr(xs,e.__scopeScrollArea),m=C.useRef(null),f=C.useRef(0),[a,c]=C.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=G1(a.viewport,a.content),g={...o,sizes:a,onSizesChange:c,hasThumb:h>0&&h<1,onThumbChange:_=>m.current=_,onThumbPointerUp:()=>f.current=0,onThumbPointerDown:_=>f.current=_};function d(_,S){return TO(_,f.current,a,S)}return s==="horizontal"?i.jsx(jO,{...g,ref:t,onThumbPositionChange:()=>{if(l.viewport&&m.current){const _=l.viewport.scrollLeft,S=$y(_,a,l.dir);m.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:_=>{l.viewport&&(l.viewport.scrollLeft=_)},onDragScroll:_=>{l.viewport&&(l.viewport.scrollLeft=d(_,l.dir))}}):s==="vertical"?i.jsx(EO,{...g,ref:t,onThumbPositionChange:()=>{if(l.viewport&&m.current){const _=l.viewport.scrollTop,S=$y(_,a);m.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:_=>{l.viewport&&(l.viewport.scrollTop=_)},onDragScroll:_=>{l.viewport&&(l.viewport.scrollTop=d(_))}}):null}),jO=C.forwardRef((e,t)=>{const{sizes:s,onSizesChange:o,...l}=e,m=Wr(xs,e.__scopeScrollArea),[f,a]=C.useState(),c=C.useRef(null),h=We(t,c,m.onScrollbarXChange);return C.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),i.jsx(W1,{"data-orientation":"horizontal",...l,ref:h,sizes:s,style:{bottom:0,left:m.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:m.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":fu(s)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.x),onDragScroll:g=>e.onDragScroll(g.x),onWheelScroll:(g,d)=>{if(m.viewport){const _=m.viewport.scrollLeft+g.deltaX;e.onWheelScroll(_),Y1(_,d)&&g.preventDefault()}},onResize:()=>{c.current&&m.viewport&&f&&o({content:m.viewport.scrollWidth,viewport:m.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Dc(f.paddingLeft),paddingEnd:Dc(f.paddingRight)}})}})}),EO=C.forwardRef((e,t)=>{const{sizes:s,onSizesChange:o,...l}=e,m=Wr(xs,e.__scopeScrollArea),[f,a]=C.useState(),c=C.useRef(null),h=We(t,c,m.onScrollbarYChange);return C.useEffect(()=>{c.current&&a(getComputedStyle(c.current))},[c]),i.jsx(W1,{"data-orientation":"vertical",...l,ref:h,sizes:s,style:{top:0,right:m.dir==="ltr"?0:void 0,left:m.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":fu(s)+"px",...e.style},onThumbPointerDown:g=>e.onThumbPointerDown(g.y),onDragScroll:g=>e.onDragScroll(g.y),onWheelScroll:(g,d)=>{if(m.viewport){const _=m.viewport.scrollTop+g.deltaY;e.onWheelScroll(_),Y1(_,d)&&g.preventDefault()}},onResize:()=>{c.current&&m.viewport&&f&&o({content:m.viewport.scrollHeight,viewport:m.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Dc(f.paddingTop),paddingEnd:Dc(f.paddingBottom)}})}})}),[NO,z1]=B1(xs),W1=C.forwardRef((e,t)=>{const{__scopeScrollArea:s,sizes:o,hasThumb:l,onThumbChange:m,onThumbPointerUp:f,onThumbPointerDown:a,onThumbPositionChange:c,onDragScroll:h,onWheelScroll:g,onResize:d,..._}=e,S=Wr(xs,s),[j,b]=C.useState(null),v=We(t,D=>b(D)),y=C.useRef(null),p=C.useRef(""),x=S.viewport,k=o.content-o.viewport,P=It(g),T=It(c),R=pu(d,10);function E(D){if(y.current){const $=D.clientX-y.current.left,H=D.clientY-y.current.top;h({x:$,y:H})}}return C.useEffect(()=>{const D=$=>{const H=$.target;(j==null?void 0:j.contains(H))&&P($,k)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[x,j,k,P]),C.useEffect(T,[o,T]),Ji(j,R),Ji(S.content,R),i.jsx(NO,{scope:s,scrollbar:j,hasThumb:l,onThumbChange:It(m),onThumbPointerUp:It(f),onThumbPositionChange:T,onThumbPointerDown:It(a),children:i.jsx(Fe.div,{..._,ref:v,style:{position:"absolute",..._.style},onPointerDown:_e(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),y.current=j.getBoundingClientRect(),p.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),E(D))}),onPointerMove:_e(e.onPointerMove,E),onPointerUp:_e(e.onPointerUp,D=>{const $=D.target;$.hasPointerCapture(D.pointerId)&&$.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=p.current,S.viewport&&(S.viewport.style.scrollBehavior=""),y.current=null})})})}),Mc="ScrollAreaThumb",U1=C.forwardRef((e,t)=>{const{forceMount:s,...o}=e,l=z1(Mc,e.__scopeScrollArea);return i.jsx(Kt,{present:s||l.hasThumb,children:i.jsx(PO,{ref:t,...o})})}),PO=C.forwardRef((e,t)=>{const{__scopeScrollArea:s,style:o,...l}=e,m=Wr(Mc,s),f=z1(Mc,s),{onThumbPositionChange:a}=f,c=We(t,d=>f.onThumbChange(d)),h=C.useRef(void 0),g=pu(()=>{h.current&&(h.current(),h.current=void 0)},100);return C.useEffect(()=>{const d=m.viewport;if(d){const _=()=>{if(g(),!h.current){const S=AO(d,a);h.current=S,a()}};return a(),d.addEventListener("scroll",_),()=>d.removeEventListener("scroll",_)}},[m.viewport,g,a]),i.jsx(Fe.div,{"data-state":f.hasThumb?"visible":"hidden",...l,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:_e(e.onPointerDownCapture,d=>{const S=d.target.getBoundingClientRect(),j=d.clientX-S.left,b=d.clientY-S.top;f.onThumbPointerDown({x:j,y:b})}),onPointerUp:_e(e.onPointerUp,f.onThumbPointerUp)})});U1.displayName=Mc;var Zp="ScrollAreaCorner",K1=C.forwardRef((e,t)=>{const s=Wr(Zp,e.__scopeScrollArea),o=!!(s.scrollbarX&&s.scrollbarY);return s.type!=="scroll"&&o?i.jsx(RO,{...e,ref:t}):null});K1.displayName=Zp;var RO=C.forwardRef((e,t)=>{const{__scopeScrollArea:s,...o}=e,l=Wr(Zp,s),[m,f]=C.useState(0),[a,c]=C.useState(0),h=!!(m&&a);return Ji(l.scrollbarX,()=>{var d;const g=((d=l.scrollbarX)==null?void 0:d.offsetHeight)||0;l.onCornerHeightChange(g),c(g)}),Ji(l.scrollbarY,()=>{var d;const g=((d=l.scrollbarY)==null?void 0:d.offsetWidth)||0;l.onCornerWidthChange(g),f(g)}),h?i.jsx(Fe.div,{...o,ref:t,style:{width:m,height:a,position:"absolute",right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Dc(e){return e?parseInt(e,10):0}function G1(e,t){const s=e/t;return isNaN(s)?0:s}function fu(e){const t=G1(e.viewport,e.content),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=(e.scrollbar.size-s)*t;return Math.max(o,18)}function TO(e,t,s,o="ltr"){const l=fu(s),m=l/2,f=t||m,a=l-f,c=s.scrollbar.paddingStart+f,h=s.scrollbar.size-s.scrollbar.paddingEnd-a,g=s.content-s.viewport,d=o==="ltr"?[0,g]:[g*-1,0];return q1([c,h],d)(e)}function $y(e,t,s="ltr"){const o=fu(t),l=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,m=t.scrollbar.size-l,f=t.content-t.viewport,a=m-o,c=s==="ltr"?[0,f]:[f*-1,0],h=ef(e,c);return q1([0,f],[0,a])(h)}function q1(e,t){return s=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const o=(t[1]-t[0])/(e[1]-e[0]);return t[0]+o*(s-e[0])}}function Y1(e,t){return e>0&&e<t}var AO=(e,t=()=>{})=>{let s={left:e.scrollLeft,top:e.scrollTop},o=0;return(function l(){const m={left:e.scrollLeft,top:e.scrollTop},f=s.left!==m.left,a=s.top!==m.top;(f||a)&&t(),s=m,o=window.requestAnimationFrame(l)})(),()=>window.cancelAnimationFrame(o)};function pu(e,t){const s=It(e),o=C.useRef(0);return C.useEffect(()=>()=>window.clearTimeout(o.current),[]),C.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(s,t)},[s,t])}function Ji(e,t){const s=It(t);Bt(()=>{let o=0;if(e){const l=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(s)});return l.observe(e),()=>{window.cancelAnimationFrame(o),l.unobserve(e)}}},[e,s])}var X1=F1,MO=$1,DO=K1;const ri=C.forwardRef(({className:e,children:t,...s},o)=>i.jsxs(X1,{ref:o,className:we("relative overflow-hidden",e),...s,children:[i.jsx(MO,{className:"h-full w-full rounded-[inherit]",children:t}),i.jsx(J1,{}),i.jsx(DO,{})]}));ri.displayName=X1.displayName;const J1=C.forwardRef(({className:e,orientation:t="vertical",...s},o)=>i.jsx(Jp,{ref:o,orientation:t,className:we("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...s,children:i.jsx(U1,{className:"relative flex-1 rounded-full bg-border"})}));J1.displayName=Jp.displayName;function em({open:e,onOpenChange:t,onSelect:s,type:o="directory",initialPath:l="~",title:m="Select Path"}){const[f,a]=C.useState(""),[c,h]=C.useState([]),[g,d]=C.useState(!1),[_,S]=C.useState(null),[j,b]=C.useState(""),[v,y]=C.useState("");C.useEffect(()=>{e&&p(l)},[e,l]);const p=async R=>{d(!0),S(null);try{const E=await Ce.browse(R,o);E.error?(S(E.error),E.path&&(a(E.path),y(E.path))):(a(E.path),y(E.path),h(E.items||[]),E.home&&b(E.home))}catch(E){S(E.message)}finally{d(!1)}},x=R=>{R.type==="directory"?p(R.path):o==="file"&&(s(R.path),t(!1))},k=()=>{s(f),t(!1)},P=()=>{v&&p(v)},T=R=>{R.key==="Enter"&&P()};return i.jsx(lr,{open:e,onOpenChange:t,children:i.jsxs(er,{className:"max-w-lg",children:[i.jsx(tr,{children:i.jsxs(sr,{className:"flex items-center gap-2",children:[o==="directory"?i.jsx(Ut,{className:"w-5 h-5"}):i.jsx(Xh,{className:"w-5 h-5"}),m]})}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex gap-2",children:[i.jsx(rt,{value:v,onChange:R=>y(R.target.value),onKeyDown:T,placeholder:"Enter path...",className:"font-mono text-sm flex-1"}),i.jsx(de,{variant:"outline",size:"icon",onClick:()=>p(j||"~"),title:"Go to home",children:i.jsx(rp,{className:"w-4 h-4"})}),i.jsx(de,{onClick:P,disabled:g,children:"Go"})]}),i.jsx("div",{className:"text-xs text-gray-500 font-mono truncate px-1",children:f}),_&&i.jsx("div",{className:"text-sm text-red-600 bg-red-50 p-2 rounded",children:_}),i.jsx(ri,{className:"h-64 border rounded-lg",children:g?i.jsx("div",{className:"flex items-center justify-center h-full",children:i.jsx(yt,{className:"w-6 h-6 animate-spin text-gray-400"})}):i.jsx("div",{className:"p-1",children:c.length===0?i.jsx("div",{className:"text-sm text-gray-500 p-4 text-center",children:o==="directory"?"No subdirectories":"No files found"}):c.map((R,E)=>i.jsxs("button",{onClick:()=>x(R),className:"w-full flex items-center gap-2 px-3 py-2 text-sm hover:bg-gray-100 rounded transition-colors text-left",children:[R.type==="directory"?i.jsx(Ut,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):i.jsx(Xh,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),i.jsx("span",{className:`flex-1 truncate ${R.isParent?"text-gray-500":""}`,children:R.name}),R.type==="directory"&&!R.isParent&&i.jsx(eo,{className:"w-4 h-4 text-gray-400"})]},E))})})]}),i.jsxs(rr,{children:[i.jsx(de,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),i.jsx(de,{onClick:k,disabled:!f,children:o==="directory"?"Select Folder":"Select"})]})]})})}const _a={mcps:{icon:pa,color:"text-blue-600",bgColor:"bg-blue-50",label:"MCP Servers"},settings:{icon:Yn,color:"text-gray-600 dark:text-slate-400",bgColor:"bg-gray-50 dark:bg-slate-800",label:"Settings"},command:{icon:Et,color:"text-green-600",bgColor:"bg-green-50",label:"Command"},rule:{icon:qn,color:"text-purple-600",bgColor:"bg-purple-50",label:"Rule"},workflow:{icon:D_,color:"text-cyan-600",bgColor:"bg-cyan-50",label:"Workflow"},claudemd:{icon:vr,color:"text-orange-600",bgColor:"bg-orange-50",label:"CLAUDE.md"},geminimd:{icon:vr,color:"text-blue-600",bgColor:"bg-blue-50",label:"GEMINI.md"},env:{icon:Vc,color:"text-yellow-600",bgColor:"bg-yellow-50",label:".env"},memory:{icon:Ki,color:"text-pink-600",bgColor:"bg-pink-50",label:"Memory"},folder:{icon:Ut,color:"text-yellow-600",bgColor:"bg-yellow-50",label:"Folder"}};function uc({item:e,level:t=0,selectedPath:s,onSelect:o,onContextMenu:l,expandedFolders:m,onToggleFolder:f}){const a=_a[e.type]||_a.folder,c=a.icon,h=s===e.path,g=e.type==="folder",d=m[e.path];return i.jsxs("div",{children:[i.jsxs("div",{className:we("flex items-center gap-2 px-2 py-1.5 rounded-md cursor-pointer text-sm","hover:bg-gray-100 dark:hover:bg-slate-700 transition-colors",h&&"bg-blue-100 dark:bg-blue-900/30 hover:bg-blue-100 dark:hover:bg-blue-900/30"),style:{paddingLeft:`${t*16+8}px`},onClick:()=>g?f(e.path):o(e),onContextMenu:_=>l(_,e),children:[g&&i.jsx("span",{className:"w-4 h-4 flex items-center justify-center",children:d?i.jsx(ni,{className:"w-3 h-3"}):i.jsx(eo,{className:"w-3 h-3"})}),!g&&i.jsx("span",{className:"w-4"}),i.jsx(c,{className:we("w-4 h-4",a.color)}),i.jsx("span",{className:"flex-1 truncate",children:e.name}),e.mcpCount>0&&i.jsx(ot,{variant:"secondary",className:"text-xs px-1.5 py-0",children:e.mcpCount})]}),g&&d&&e.children&&i.jsx("div",{children:e.children.map(_=>i.jsx(uc,{item:_,level:t+1,selectedPath:s,onSelect:o,onContextMenu:l,expandedFolders:m,onToggleFolder:f},_.path))})]})}function LO({folder:e,isExpanded:t,isHome:s,isProject:o,isSubproject:l,depth:m=0,onToggle:f,onCreateFile:a,onSelectItem:c,selectedPath:h,onContextMenu:g,expandedFolders:d,onToggleFolder:_,templates:S,hasSubprojects:j,onAddSubproject:b,onRemoveSubproject:v,onHideSubproject:y}){var U,V,q,W,G,J,z,M,B,L;const p=(U=e.files)==null?void 0:U.some(F=>F.name==="mcps.json"),x=(V=e.files)==null?void 0:V.some(F=>F.name==="settings.json"),k=(q=e.files)==null?void 0:q.some(F=>F.name==="CLAUDE.md"||F.name==="CLAUDE.md (root)"),P=(W=e.files)==null?void 0:W.some(F=>F.name===".env"),T=()=>s?"bg-indigo-50 dark:bg-indigo-900/20 hover:bg-indigo-100 dark:hover:bg-indigo-900/30":l&&m>1?"bg-gray-50 dark:bg-slate-800 hover:bg-gray-100 dark:hover:bg-slate-700":l?"bg-amber-50 dark:bg-amber-900/20 hover:bg-amber-100 dark:hover:bg-amber-900/30":o?"bg-green-50 dark:bg-green-900/20 hover:bg-green-100 dark:hover:bg-green-900/30":"bg-gray-50 dark:bg-slate-800 hover:bg-gray-100 dark:hover:bg-slate-700",R=()=>s?"text-indigo-700 dark:text-indigo-400":l&&m>1?"text-gray-600 dark:text-slate-400":l?"text-amber-700 dark:text-amber-400":o?"text-green-700 dark:text-green-400":"text-gray-700 dark:text-slate-300",D=s?rp:t?yn:Ut,$=s?"Home":e.label,H=(((G=e.files)==null?void 0:G.length)||0)+(((J=e.geminiFiles)==null?void 0:J.length)||0)+(((z=e.agentFiles)==null?void 0:z.length)||0);return i.jsxs("div",{className:"border-b border-gray-200 dark:border-slate-700",children:[i.jsxs("div",{className:we("flex items-center gap-2 py-2 cursor-pointer transition-colors",T()),style:{paddingLeft:`${12+m*16}px`,paddingRight:"24px"},onClick:f,children:[i.jsx("span",{className:"w-4 h-4 flex items-center justify-center text-gray-500",children:t?i.jsx(ni,{className:"w-4 h-4"}):i.jsx(eo,{className:"w-4 h-4"})}),i.jsx(D,{className:we("w-4 h-4",R())}),i.jsx("span",{className:we("flex-1 min-w-0 font-medium text-sm truncate",R()),children:$}),i.jsxs(Ia,{children:[i.jsx(Ba,{asChild:!0,onClick:F=>F.stopPropagation(),children:i.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 flex-shrink-0 mr-1 hover:bg-white/50 dark:hover:bg-slate-900/50",children:i.jsx(Ot,{className:"w-4 h-4"})})}),i.jsxs(co,{align:"end",className:"w-48",children:[i.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5 border-b mb-1",children:[o&&j&&i.jsx(ot,{variant:"outline",className:"text-[10px] px-1 py-0 bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 border-green-300 dark:border-green-700",children:"root"}),!e.exists&&!s&&i.jsx(ot,{variant:"outline",className:"text-[10px] px-1 py-0",children:"no config"}),((M=e.appliedTemplate)==null?void 0:M.template)&&i.jsx(ot,{variant:"outline",className:"text-[10px] px-1 py-0 bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-400 border-purple-300 dark:border-purple-700",children:e.appliedTemplate.template.split("/").pop()}),!l&&e.exists&&!((B=e.appliedTemplate)!=null&&B.template)&&H===0&&i.jsx("span",{className:"text-[10px] text-muted-foreground",children:"configured"})]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"mcps")},disabled:p,className:p?"opacity-50":"",children:[i.jsx(pa,{className:"w-4 h-4 mr-2"}),"mcps.json",p&&i.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"settings")},disabled:x,className:x?"opacity-50":"",children:[i.jsx(Yn,{className:"w-4 h-4 mr-2"}),"settings.json",x&&i.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"env")},disabled:P,className:P?"opacity-50":"",children:[i.jsx(Vc,{className:"w-4 h-4 mr-2"}),".env",P&&i.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),i.jsx(Rs,{}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"command")},children:[i.jsx(Et,{className:"w-4 h-4 mr-2"}),"New Command"]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"rule")},children:[i.jsx(qn,{className:"w-4 h-4 mr-2"}),"New Rule"]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"workflow")},children:[i.jsx(D_,{className:"w-4 h-4 mr-2"}),"New Workflow"]}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"memory")},children:[i.jsx(Ki,{className:"w-4 h-4 mr-2"}),"New Memory"]}),i.jsx(Rs,{}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),a(e.dir,"claudemd")},disabled:k,className:k?"opacity-50":"",children:[i.jsx(vr,{className:"w-4 h-4 mr-2"}),"CLAUDE.md",k&&i.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"exists"})]}),(o||l)&&b&&i.jsxs(i.Fragment,{children:[i.jsx(Rs,{}),i.jsxs(ct,{onClick:F=>{F.stopPropagation(),b(e.dir)},children:[i.jsx(M_,{className:"w-4 h-4 mr-2"}),"Add Sub-project"]})]}),l&&y&&i.jsxs(ct,{onClick:F=>{F.stopPropagation(),y(e.dir)},children:[i.jsx(T_,{className:"w-4 h-4 mr-2"}),"Hide"]}),e.isManual&&v&&i.jsxs(ct,{onClick:F=>{F.stopPropagation(),v(e.dir)},className:"text-destructive focus:text-destructive",children:[i.jsx(xn,{className:"w-4 h-4 mr-2"}),"Remove"]}),S&&S.length>0&&(l||!j)&&!((L=e.appliedTemplate)!=null&&L.template)&&i.jsxs(i.Fragment,{children:[i.jsx(Rs,{}),i.jsxs(mf,{children:[i.jsxs(Tc,{children:[i.jsx(to,{className:"w-4 h-4 mr-2"}),"Apply Template"]}),i.jsxs(Ac,{children:[S.map(F=>{const Q=F.id||F.name;return i.jsx(ct,{onClick:se=>{se.stopPropagation(),a(e.dir,"template",Q)},children:F.name},Q)}),i.jsx(Rs,{}),i.jsxs(mf,{children:[i.jsx(Tc,{className:"text-xs text-muted-foreground",children:"Mark as Applied (migration)"}),i.jsx(Ac,{children:S.map(F=>{const Q=F.id||F.name;return i.jsx(ct,{onClick:se=>{se.stopPropagation(),a(e.dir,"mark-template",Q)},children:F.name},Q)})})]})]})]})]})]})]})]}),t&&i.jsxs("div",{className:"bg-white dark:bg-slate-950 py-1",children:[e.files&&e.files.length>0&&i.jsxs("div",{className:"mb-1",children:[i.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-orange-600 dark:text-orange-400 uppercase tracking-wide flex items-center gap-1",children:[i.jsx(ar,{className:"w-3 h-3"}),"Claude Code"]}),e.files.map(F=>i.jsx(uc,{item:F,selectedPath:h,onSelect:c,onContextMenu:g,expandedFolders:d,onToggleFolder:_},F.path))]}),e.geminiFiles&&e.geminiFiles.length>0&&i.jsxs("div",{className:"mb-1 border-t border-dashed border-gray-200 dark:border-slate-700 pt-1",children:[i.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-blue-600 dark:text-blue-400 uppercase tracking-wide flex items-center gap-1",children:[i.jsx(ar,{className:"w-3 h-3"}),"Gemini CLI"]}),e.geminiFiles.map(F=>i.jsx(uc,{item:F,selectedPath:h,onSelect:c,onContextMenu:g,expandedFolders:d,onToggleFolder:_},F.path))]}),e.agentFiles&&e.agentFiles.length>0&&i.jsxs("div",{className:"mb-1 border-t border-dashed border-gray-200 dark:border-slate-700 pt-1",children:[i.jsxs("div",{className:"px-4 py-1 text-[10px] font-medium text-purple-600 dark:text-purple-400 uppercase tracking-wide flex items-center gap-1",children:[i.jsx(ar,{className:"w-3 h-3"}),"Antigravity"]}),e.agentFiles.map(F=>i.jsx(uc,{item:F,selectedPath:h,onSelect:c,onContextMenu:g,expandedFolders:d,onToggleFolder:_},F.path))]}),(!e.files||e.files.length===0)&&(!e.geminiFiles||e.geminiFiles.length===0)&&(!e.agentFiles||e.agentFiles.length===0)&&i.jsx("div",{className:"px-4 py-3 text-sm text-gray-400 dark:text-slate-500 italic text-center",children:"No config files. Use + to create."})]})]})}function OO({content:e,parsed:t,onSave:s,registry:o}){const[l,m]=C.useState(t||{include:[],mcpServers:{}}),[f,a]=C.useState("rich"),[c,h]=C.useState(JSON.stringify(t||{},null,2)),[g,d]=C.useState(!1),[_,S]=C.useState({open:!1,json:""});C.useEffect(()=>{m(t||{include:[],mcpServers:{}}),h(JSON.stringify(t||{},null,2)),d(!1)},[t]);const j=p=>{var k;const x=(k=l.include)!=null&&k.includes(p)?l.include.filter(P=>P!==p):[...l.include||[],p];m({...l,include:x}),d(!0)},b=()=>{if(f==="json")try{const p=JSON.parse(c);s(JSON.stringify(p,null,2))}catch{ae.error("Invalid JSON");return}else s(JSON.stringify(l,null,2));d(!1)},v=()=>{if(!_.json.trim()){ae.error("Please paste the MCP JSON configuration");return}try{let p;try{p=JSON.parse(_.json)}catch{ae.error("Invalid JSON format");return}let x={};if(p.mcpServers&&typeof p.mcpServers=="object")x=p.mcpServers;else if(typeof p=="object"&&!Array.isArray(p)){if(Object.keys(p).includes("command")){ae.error('JSON is missing the MCP name. Expected: { "name": { "command": "...", "args": [...] } }');return}x=p}if(Object.keys(x).length===0){ae.error("No MCP configurations found in the JSON");return}for(const[R,E]of Object.entries(x))if(!E.command){ae.error(`MCP "${R}" is missing required "command" field`);return}const k={...l.mcpServers||{},...x},P={...l,mcpServers:k};m(P),h(JSON.stringify(P,null,2)),d(!0);const T=Object.keys(x).length;ae.success(`Added ${T} MCP${T>1?"s":""} - click Save to apply`),S({open:!1,json:""})}catch(p){ae.error("Failed to add: "+p.message)}},y=o!=null&&o.mcpServers?Object.keys(o.mcpServers):[];return i.jsxs("div",{className:"h-full flex flex-col",children:[i.jsxs("div",{className:"flex items-center justify-between p-3 border-b bg-gray-50 dark:bg-slate-800",children:[i.jsx(qc,{value:f,onValueChange:a,children:i.jsxs(Pa,{className:"h-8",children:[i.jsx(es,{value:"rich",className:"text-xs px-3",children:"Rich Editor"}),i.jsx(es,{value:"json",className:"text-xs px-3",children:"JSON"})]})}),i.jsxs("div",{className:"flex gap-2",children:[i.jsxs(de,{size:"sm",variant:"outline",onClick:()=>S({open:!0,json:""}),children:[i.jsx(Ot,{className:"w-4 h-4 mr-1"}),"Add MCP"]}),g&&i.jsxs(de,{size:"sm",onClick:b,children:[i.jsx(ro,{className:"w-4 h-4 mr-1"}),"Save"]})]})]}),i.jsx(ri,{className:"flex-1",children:f==="rich"?i.jsxs("div",{className:"p-4 space-y-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium mb-2",children:"Registry MCPs"}),i.jsx("div",{className:"space-y-2",children:y.length===0?i.jsx("p",{className:"text-sm text-gray-500 dark:text-slate-400",children:"No MCPs in registry"}):y.map(p=>{var x;return i.jsxs("div",{className:"flex items-center justify-between p-2 rounded border bg-white dark:bg-slate-950",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(pa,{className:"w-4 h-4 text-blue-500"}),i.jsx("span",{className:"text-sm",children:p})]}),i.jsx(St,{checked:(x=l.include)==null?void 0:x.includes(p),onCheckedChange:()=>j(p)})]},p)})})]}),Object.keys(l.mcpServers||{}).length>0&&i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-medium mb-2",children:"Inline MCPs"}),i.jsx("div",{className:"space-y-2",children:Object.entries(l.mcpServers).map(([p,x])=>{var k;return i.jsxs("div",{className:"p-2 rounded border bg-white dark:bg-slate-950 group",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-sm font-medium",children:p}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ot,{variant:"outline",className:"text-xs",children:"inline"}),i.jsx(de,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100 text-red-500 hover:text-red-700 hover:bg-red-50",onClick:()=>{const{[p]:P,...T}=l.mcpServers,R={...l,mcpServers:T};m(R),h(JSON.stringify(R,null,2)),d(!0),ae.success(`Removed ${p} - click Save to apply`)},children:i.jsx(xn,{className:"w-3.5 h-3.5"})})]})]}),i.jsxs("p",{className:"text-xs text-gray-500 dark:text-slate-400 mt-1 font-mono",children:[x.command," ",(k=x.args)==null?void 0:k.join(" ")]})]},p)})})]})]}):i.jsx(it,{className:"w-full h-full min-h-[400px] font-mono text-sm border-0 rounded-none resize-none",value:c,onChange:p=>{h(p.target.value),d(!0)}})}),i.jsx(lr,{open:_.open,onOpenChange:p=>S({..._,open:p}),children:i.jsxs(er,{className:"bg-white dark:bg-slate-950 max-w-2xl",children:[i.jsxs(tr,{children:[i.jsx(sr,{children:"Add MCP to Config"}),i.jsx(Rr,{children:"Paste the MCP JSON configuration to add to this config file."})]}),i.jsxs("div",{className:"py-4",children:[i.jsx(it,{value:_.json,onChange:p=>S({..._,json:p.target.value}),placeholder:`{
451
451
  "my-mcp": {
452
452
  "command": "npx",
453
453
  "args": ["-y", "@example/mcp-server"],
@@ -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-DnNDUh4V.js"></script>
22
+ <script type="module" crossorigin src="/assets/index-1R4EKx1F.js"></script>
23
23
  <link rel="stylesheet" crossorigin href="/assets/index-Dd419YRV.css">
24
24
  </head>
25
25
  <body>