@cuongtran001/kanna 1.6.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{arc-BepqoMww.js → arc-D6tYA8bn.js} +1 -1
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-8dI-aka3.js → architectureDiagram-3BPJPVTR-DnIdtnl6.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-CLhYeaVE.js → blockDiagram-GPEHLZMM-Cr-AMlN6.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-BauNUYaZ.js → c4Diagram-AAUBKEIU-CuhAoqUV.js} +1 -1
- package/dist/client/assets/channel-cylw1-Yg.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-BrdQjnBO.js → chunk-2J33WTMH-DwigKAQG.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-iYC5hjxN.js → chunk-4BX2VUAB-CJZSLnSB.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-BE-eVlfe.js → chunk-55IACEB6-DSGHFvpZ.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-AKMo29NM.js → chunk-727SXJPM-w8CAA5_Q.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-PBzb22O5.js → chunk-AQP2D5EJ-NwamePkS.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-OtPcaheH.js → chunk-FMBD7UC4-Bxre-mma.js} +1 -1
- package/dist/client/assets/{chunk-ND2GUHAM-BPLYrbBt.js → chunk-ND2GUHAM-CK3B3C4T.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-DWgU7w12.js → chunk-QZHKN3VN-C1r-dTDL.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-MOMqNsRr.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-MOMqNsRr.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-CUIITMWC.js → cose-bilkent-S5V4N54A-BxqcV2Cy.js} +1 -1
- package/dist/client/assets/{dagre-BM42HDAG-CsKnhhj8.js → dagre-BM42HDAG-CO_BOgXJ.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-CcvyI-8Q.js → diagram-2AECGRRQ-CF9DyFqV.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-BZCy-Hof.js → diagram-5GNKFQAL-BYWNjNDy.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-SBpac2E9.js → diagram-KO2AKTUF-BZdrSacx.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-hT1V11VC.js → diagram-LMA3HP47-mXM4j6p6.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-m1RXPjAD.js → diagram-OG6HWLK6-DnnNxn-P.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-r0s8lK2T.js → erDiagram-TEJ5UH35-BNX-SLv8.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-DvKJaTjm.js → flowDiagram-I6XJVG4X-DK_3zsZr.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-lpNel2Ec.js → ganttDiagram-6RSMTGT7-DRwjHf3T.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-bYDUqAQl.js → gitGraphDiagram-PVQCEYII-DWlKgv_L.js} +1 -1
- package/dist/client/assets/{index-C2KPvMYB.js → index-CKPgtWpo.js} +2 -2
- package/dist/client/assets/{index-B3EPtHz1.js → index-w789V01k.js} +1 -1
- package/dist/client/assets/{infoDiagram-5YYISTIA-1aE3yFlg.js → infoDiagram-5YYISTIA-BM9BFloj.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-kklGZXQK.js → ishikawaDiagram-YF4QCWOH-PSSpbMb2.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-DlhmDtm5.js → journeyDiagram-JHISSGLW-C-5-hVzU.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-Dl-5M3vz.js → kanban-definition-UN3LZRKU-FE-2nlCA.js} +1 -1
- package/dist/client/assets/{linear-CuoNwOxL.js → linear-RZ4O-Q72.js} +1 -1
- package/dist/client/assets/{mermaid.core-D-uxsiw3.js → mermaid.core-B1uSc1Cq.js} +4 -4
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-DG0q6veI.js → mindmap-definition-RKZ34NQL-wzItYcv3.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-CkN-5c_n.js → pieDiagram-4H26LBE5-DVXFC4wA.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-CYFC2FUp.js → quadrantDiagram-W4KKPZXB-yqhMV2Vr.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-DHytFlud.js → requirementDiagram-4Y6WPE33-D7oV4rLL.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-vciMHHOZ.js → sankeyDiagram-5OEKKPKP-C5A4tvms.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-Cw2aj6Mt.js → sequenceDiagram-3UESZ5HK-BWkHuiD6.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-DTeLi8Bb.js → stateDiagram-AJRCARHV-DSifOqww.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-DAxBMK9F.js +1 -0
- package/dist/client/assets/{timeline-definition-PNZ67QCA-CEY7eN5F.js → timeline-definition-PNZ67QCA-BB8H19zd.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-C2Ru4xzh.js → vennDiagram-CIIHVFJN-B1uMpp_x.js} +1 -1
- package/dist/client/assets/{wardley-L42UT6IY-BxZraSB7.js → wardley-L42UT6IY-Cw6v7DBR.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-QwykmyXh.js → wardleyDiagram-YWT4CUSO-BJ6VQf-7.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-CXX6iN8-.js → xychartDiagram-2RQKCTM6-CPMI4rDr.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/src/server/claude-message-normalizer.test.ts +63 -0
- package/src/server/claude-message-normalizer.ts +31 -0
- package/src/server/claude-prompt-helpers.test.ts +27 -0
- package/src/server/claude-prompt-helpers.ts +15 -0
- package/src/server/claude-session-runner.test.ts +70 -0
- package/src/server/claude-session-runner.ts +16 -1
- package/src/shared/transcript-types.ts +7 -0
- package/dist/client/assets/channel-BHM9BKnY.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-Bi2w7JnZ.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-Bi2w7JnZ.js +0 -1
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-vEAIcC7i.js +0 -1
|
@@ -768,7 +768,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
768
768
|
`)!==n.readPathDeny.join(`
|
|
769
769
|
`)&&(w.readPathDeny=y),x.join(`
|
|
770
770
|
`)!==n.writePathDeny.join(`
|
|
771
|
-
`)&&(w.writePathDeny=x),Object.keys(w).length===0?null:w}function g(){r(m())}function b(){r(null)}return c.jsxs(c.Fragment,{children:[c.jsx(Yo,{open:e,onOpenChange:y=>{y||i()},children:c.jsxs(So,{className:"max-w-2xl",children:[c.jsxs(Xo,{children:["Permissions — ",t]}),c.jsxs(Aa,{className:"space-y-5",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-sm font-medium",children:"Default action"}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:["Behaviour when a tool call has no explicit allow/deny rule. ",c.jsx("strong",{children:"auto-allow"})," bypasses prompts and runs untrusted shell commands without supervision — use a worktree."]}),c.jsx(Hs,{value:s,onValueChange:p,options:[{value:"ask",label:"Ask"},{value:"auto-allow",label:"Auto-allow (unsafe)"},{value:"auto-deny",label:"Auto-deny"}]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-sm font-medium",children:"Read-path deny list"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"One glob per line. The model cannot read paths matching any entry. Defaults shown below — edit to add or remove."}),c.jsx("textarea",{value:o,onChange:y=>f.getState().setReadDenyText(y.target.value),rows:8,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-xs",spellCheck:!1})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-sm font-medium",children:"Write-path deny list"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"One glob per line. The model cannot edit or write paths matching any entry."}),c.jsx("textarea",{value:a,onChange:y=>f.getState().setWriteDenyText(y.target.value),rows:8,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-xs",spellCheck:!1})]})]}),c.jsxs(yu,{className:"justify-between",children:[c.jsx(je,{variant:"ghost",onClick:b,children:"Reset to defaults"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(je,{variant:"ghost",onClick:i,children:"Cancel"}),c.jsx(je,{onClick:g,children:"Apply"})]})]})]})}),c.jsx(Yo,{open:l,onOpenChange:y=>{y||(f.getState().setConfirmUnsafeOpen(!1),f.getState().setPendingDefaultAction(null))},children:c.jsxs(So,{className:"max-w-md",children:[c.jsx(Xo,{children:"Enable auto-allow for this chat?"}),c.jsxs(Aa,{className:"space-y-3 text-sm",children:[c.jsx("p",{children:"Auto-allow disables tool-call prompts. The model can run shell commands, write files, and edit code without asking. Read/write deny lists still apply."}),c.jsx("p",{className:"text-warning",children:"Use a worktree for risky tasks."})]}),c.jsxs(yu,{className:"justify-end gap-2",children:[c.jsx(je,{variant:"ghost",onClick:()=>{f.getState().setConfirmUnsafeOpen(!1),f.getState().setPendingDefaultAction(null)},children:"Cancel"}),c.jsx(je,{variant:"destructive",onClick:()=>{const y=f.getState();u&&y.setDefaultAction(u),y.setConfirmUnsafeOpen(!1),y.setPendingDefaultAction(null)},children:"Enable auto-allow"})]})]})})]})}const vge={defaultAction:"ask",bash:{autoAllowVerbs:["ls","pwd","git status","git diff","git log"]},readPathDeny:["~/.ssh","~/.aws","~/.gcp","~/.config/gh","~/.claude","~/.kanna","~/Library/Keychains","/etc/shadow","/etc/sudoers","~/.gnupg","~/.gitconfig","**/.git/config","~/.npmrc","~/.netrc","~/.docker/config.json","**/.env","**/.env.*","**/credentials*","**/*.pem","**/*.key","**/id_rsa*","**/id_ed25519*"],writePathDeny:["/etc/**","/usr/**","/System/**","~/.ssh/**","~/.aws/**","~/.config/gh/**","~/.claude/**","~/.kanna/**","~/.gnupg/**","~/.gitconfig","**/.git/config"],toolDenyList:[{tool:"mcp__kanna__bash",pattern:"rm\\s+-rf\\s+(/|~|\\$HOME)(?:\\b|$|\\s)"},{tool:"mcp__kanna__bash",pattern:"git\\s+push\\b.*--force"}],toolAllowList:[]},wr={setTimeout(e,t){return window.setTimeout(e,t)},clearTimeout(e){window.clearTimeout(e)},setInterval(e,t){return window.setInterval(e,t)},clearInterval(e){window.clearInterval(e)},requestAnimationFrame(e){return window.requestAnimationFrame(e)},cancelAnimationFrame(e){window.cancelAnimationFrame(e)}},hn=_.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{ref:r,type:t,className:pe("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e),...n}));hn.displayName="Input";const gK=_.createContext(null);function bge({children:e,ports:t={}}){const n=t.timer??wr,[r,i]=_.useState(null),[s,o]=_.useState(""),a=_.useRef(null);_.useEffect(()=>{(r==null?void 0:r.kind)==="prompt"&&(o(r.options.initialValue??""),n.setTimeout(()=>{var x,w;(x=a.current)==null||x.focus(),(w=a.current)==null||w.select()},0))},[r,n]);const l=_.useCallback(()=>{i(null),o("")},[]),u=_.useCallback(()=>{r&&(r.kind==="confirm"?r.resolve(!1):r.kind==="prompt"?r.resolve(null):r.resolve(),l())},[l,r]),f=_.useCallback(()=>{r&&(r.kind==="confirm"?r.resolve(!0):r.kind==="prompt"?r.resolve(s.trim()||null):r.resolve(),l())},[l,r,s]),p=_.useCallback(x=>new Promise(w=>{i({kind:"confirm",options:x,resolve:w})}),[]),m=_.useCallback(x=>new Promise(w=>{i({kind:"prompt",options:x,resolve:w})}),[]),g=_.useCallback(x=>new Promise(w=>{i({kind:"alert",options:x,resolve:w})}),[]),b=_.useMemo(()=>({confirm:p,prompt:m,alert:g}),[g,p,m]);let y="Confirm";return r&&(r.kind==="alert"?y=r.options.closeLabel??"OK":"confirmLabel"in r.options&&(y=r.options.confirmLabel??"Confirm")),c.jsxs(gK.Provider,{value:b,children:[e,c.jsx(Yo,{open:r!==null,onOpenChange:x=>{x||!r||u()},children:c.jsx(So,{size:"sm",onKeyDown:x=>{x.key!=="Enter"||x.shiftKey||!r||r.kind!=="confirm"||(x.preventDefault(),f())},children:r?c.jsxs(c.Fragment,{children:[c.jsxs(Aa,{className:"space-y-4",children:[c.jsx(Xo,{children:r.options.title}),r.options.description?c.jsx(yv,{children:r.options.description}):null,r.kind==="prompt"?c.jsx(hn,{ref:a,type:"text",value:s,onChange:x=>o(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),f())},placeholder:r.options.placeholder}):null]}),c.jsxs(yu,{children:[c.jsx(je,{variant:"ghost",size:"sm",onClick:u,className:r.kind==="alert"?"hidden":void 0,children:"cancelLabel"in r.options?r.options.cancelLabel??"Cancel":"Cancel"}),c.jsx(je,{variant:r.kind==="confirm"?r.options.confirmVariant??"default":"secondary",size:"sm",onClick:f,disabled:r.kind==="prompt"&&!s.trim(),children:y})]})]}):null})})]})}function p_(){const e=_.useContext(gK);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const UI=_.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:pe("bg-card text-card-foreground",e),...t}));UI.displayName="Card";const HI=_.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:pe("flex flex-col space-y-1.5 p-2",e),...t}));HI.displayName="CardHeader";const vK=_.forwardRef(({className:e,...t},n)=>c.jsx("h3",{ref:n,className:pe("text-2xl font-semibold leading-none tracking-tight",e),...t}));vK.displayName="CardTitle";const bK=_.forwardRef(({className:e,...t},n)=>c.jsx("p",{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));bK.displayName="CardDescription";const WI=_.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:pe("p-6 pt-0",e),...t}));WI.displayName="CardContent";const yge=_.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:pe("flex items-center p-6 pt-0",e),...t}));yge.displayName="CardFooter";const xge={info:{dotVar:"var(--info)",bgClass:"bg-info/[0.06]"},warning:{dotVar:"var(--warning)",bgClass:"bg-warning/[0.06]"},success:{dotVar:"var(--success)",bgClass:"bg-success/[0.06]"},error:{dotVar:"var(--destructive)",bgClass:"bg-destructive/[0.06]"}};function _ge({variant:e,children:t,dot:n=!0,className:r}){const i=xge[e];return c.jsxs("div",{role:"status",className:pe("flex flex-wrap items-center justify-center gap-x-2 gap-y-1 border-b border-border px-4 py-2 text-xs leading-tight",i.bgClass,r),children:[n?c.jsx("span",{"aria-hidden":"true",className:"inline-block size-1.5 shrink-0 rounded-full",style:{backgroundColor:i.dotVar}}):null,t]})}const Sge="modulepreload",wge=function(e){return"/"+e},aF={},Z=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(u=>{if(u=wge(u),u in aF)return;aF[u]=!0;const f=u.endsWith(".css"),p=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const m=document.createElement("link");if(m.rel=f?"stylesheet":Sge,f||(m.as="script"),m.crossOrigin="",m.href=u,l&&m.setAttribute("nonce",l),document.head.appendChild(m),f)return new Promise((g,b)=>{m.addEventListener("load",g),m.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})},Cge=_.lazy(()=>Z(()=>import("./index-B3EPtHz1.js"),[]).then(e=>({default:e.Toaster})));function kge(){return c.jsx(_.Suspense,{fallback:null,children:c.jsx(Cge,{position:"bottom-right",theme:"system",closeButton:!0,duration:6e3})})}const Ege="1.6.2",Nge={version:Ege},Yr="Kanna",lF="kanna",Tge=".kanna",Age=".kanna-dev",Rge="KANNA_RUNTIME_PROFILE",VI=`kanna/${Nge.version}`,Mge="[kanna]",jge=`~/${Yr}`;function hk(){const e=Reflect.get(globalThis,"process");return e==null?void 0:e.env}function Oge(e=hk()){var t;return((t=e==null?void 0:e[Rge])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function Ige(e=hk()){return Oge(e)==="dev"?Age:Tge}function Pge(e=hk()){return`~/${Ige(e)}`}function Lge(e=hk()){return`${Pge(e)}/keybindings.json`}function yS(e){return e?`${lF} ${e}`:lF}const yK="always",xK="funk",Dge=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function $ge(e){switch(e){case"never":case"unfocused":case"always":return e;default:return yK}}function zge(e){switch(e){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return e;default:return xK}}const Nh=tr()(e=>({chatSoundPreference:yK,chatSoundId:xK,setChatSoundPreference:t=>e({chatSoundPreference:$ge(t)}),setChatSoundId:t=>e({chatSoundId:zge(t)})})),Fge={blow:"/chat-sounds/Blow.mp3",bottle:"/chat-sounds/Bottle.mp3",frog:"/chat-sounds/Frog.mp3",funk:"/chat-sounds/Funk.mp3",glass:"/chat-sounds/Glass.mp3",ping:"/chat-sounds/Ping.mp3",pop:"/chat-sounds/Pop.mp3",purr:"/chat-sounds/Purr.mp3",tink:"/chat-sounds/Tink.mp3"};function Bge(e=Et){return e.getVisibilityState()!=="visible"||!e.hasFocus()}function Uge(e){const t=new Audio(Fge[e]);return t.preload="auto",t.play()}async function wR(e,t,n=wr){if(t<=0)return;const r=Array.from({length:t},(i,s)=>new Promise(o=>{n.setTimeout(()=>{Uge(e).catch(()=>{}).finally(()=>o())},s*90)}));await Promise.all(r)}function Hge(e,t=Et){return e==="never"?!1:e==="always"?!0:Bge(t)}function Wge(e){return e.projectGroups.reduce((t,n)=>t+n.chats.reduce((r,i)=>r+(i.unread?1:0)+(i.status==="waiting_for_user"?1:0),0),0)}function cF(e){let t=0;const n=new Set;for(const r of e.projectGroups)for(const i of r.chats)i.unread&&(t+=1),i.status==="waiting_for_user"&&n.add(i.chatId);return{unreadCount:t,waitingChatIds:n}}function Vge(e,t){if(!e)return 0;const n=cF(e),r=cF(t),i=Math.max(0,r.unreadCount-n.unreadCount);let s=0;for(const o of r.waitingChatIds)n.waitingChatIds.has(o)||(s+=1);return i+s}function xh({tooltip:e,children:t,className:n,inline:r=!1,side:i}){const s=pe("truncate",n);return c.jsx(h_,{children:c.jsxs(ks,{children:[c.jsx(Es,{asChild:!0,children:r?c.jsx("span",{className:s,children:t}):c.jsx("div",{className:s,children:t})}),c.jsx(ms,{side:i,children:e})]})})}function oc({label:e,children:t,side:n}){return c.jsx(h_,{children:c.jsxs(ks,{children:[c.jsx(Es,{asChild:!0,children:t}),c.jsx(ms,{side:n,children:e})]})})}function CR(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const Kge=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function _K(e){const t=e.trim();for(const n of Kge){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function KI(e){return e.split("/").pop()||e}const Gge=1440*6e4;function qge(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=Gge,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}function Yge(e){return e.lastMessageAt??e._creationTime}const GI=1e3,Pw=60*GI,qm=60*Pw,QT=24*qm;function ba(e){const t=Math.max(0,e);if(t<Pw)return`${Math.floor(t/GI)}s`;if(t<qm)return`${Math.floor(t/Pw)}m`;if(t<QT){const i=Math.floor(t/qm),s=Math.floor(t%qm/Pw);return s===0?`${i}h`:`${i}h ${s}m`}const n=Math.floor(t/QT),r=Math.floor(t%QT/qm);return r===0?`${n}d`:`${n}d ${r}h`}function kR(e){const t=Math.max(0,e);if(t>=qm)return ba(t);const n=Math.floor(t/GI),r=Math.floor(n/60),i=n%60;return`${r}:${i.toString().padStart(2,"0")}`}function ER(e){switch(e){case"idle":return"Idle";case"starting":return"Starting";case"running":return"Running";case"waiting_for_user":return"Waiting";case"failed":return"Failed"}}function uF(e){switch(e){case"running":return"active";case"waiting_for_user":return"attention";case"failed":return"destructive";case"idle":case"starting":default:return"muted"}}function dF(e){switch(e){case"active":return"text-emerald-500 dark:text-emerald-400";case"attention":return"text-amber-500 dark:text-amber-400";case"destructive":return"text-destructive";case"muted":default:return"text-muted-foreground"}}function qI(e){const t=e+"CollectionProvider",[n,r]=Pu(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:x,children:w}=y,k=Wn.useRef(null),C=Wn.useRef(new Map).current;return c.jsx(i,{scope:x,itemMap:C,collectionRef:k,children:w})};o.displayName=t;const a=e+"CollectionSlot",l=tp(a),u=Wn.forwardRef((y,x)=>{const{scope:w,children:k}=y,C=s(a,w),E=Qn(x,C.collectionRef);return c.jsx(l,{ref:E,children:k})});u.displayName=a;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=tp(f),g=Wn.forwardRef((y,x)=>{const{scope:w,children:k,...C}=y,E=Wn.useRef(null),A=Qn(x,E),N=s(f,w);return Wn.useEffect(()=>(N.itemMap.set(E,{ref:E,...C}),()=>void N.itemMap.delete(E))),c.jsx(m,{[p]:"",ref:A,children:k})});g.displayName=f;function b(y){const x=s(e+"CollectionConsumer",y);return Wn.useCallback(()=>{const k=x.collectionRef.current;if(!k)return[];const C=Array.from(k.querySelectorAll(`[${p}]`));return Array.from(x.itemMap.values()).sort((N,M)=>C.indexOf(N.ref.current)-C.indexOf(M.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:o,Slot:u,ItemSlot:g},b,r]}var Xge=_.createContext(void 0);function YI(e){const t=_.useContext(Xge);return e||t||"ltr"}var JT="rovingFocusGroup.onEntryFocus",Qge={bubbles:!1,cancelable:!0},m_="RovingFocusGroup",[NR,SK,Jge]=qI(m_),[Zge,wK]=Pu(m_,[Jge]),[eve,tve]=Zge(m_),CK=_.forwardRef((e,t)=>c.jsx(NR.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(NR.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(nve,{...e,ref:t})})}));CK.displayName=m_;var nve=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,m=_.useRef(null),g=Qn(t,m),b=YI(s),[y,x]=Fg({prop:o,defaultProp:a??null,onChange:l,caller:m_}),[w,k]=_.useState(!1),C=ul(u),E=SK(n),A=_.useRef(!1),[N,M]=_.useState(0);return _.useEffect(()=>{const j=m.current;if(j)return j.addEventListener(JT,C),()=>j.removeEventListener(JT,C)},[C]),c.jsx(eve,{scope:n,orientation:r,dir:b,loop:i,currentTabStopId:y,onItemFocus:_.useCallback(j=>x(j),[x]),onItemShiftTab:_.useCallback(()=>k(!0),[]),onFocusableItemAdd:_.useCallback(()=>M(j=>j+1),[]),onFocusableItemRemove:_.useCallback(()=>M(j=>j-1),[]),children:c.jsx(Tn.div,{tabIndex:w||N===0?-1:0,"data-orientation":r,...p,ref:g,style:{outline:"none",...e.style},onMouseDown:it(e.onMouseDown,()=>{A.current=!0}),onFocus:it(e.onFocus,j=>{const I=!A.current;if(j.target===j.currentTarget&&I&&!w){const z=new CustomEvent(JT,Qge);if(j.currentTarget.dispatchEvent(z),!z.defaultPrevented){const F=E().filter(B=>B.focusable),O=F.find(B=>B.active),P=F.find(B=>B.id===y),U=[O,P,...F].filter(Boolean).map(B=>B.ref.current);NK(U,f)}}A.current=!1}),onBlur:it(e.onBlur,()=>k(!1))})})}),kK="RovingFocusGroupItem",EK=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=e,l=pu(),u=s||l,f=tve(kK,n),p=f.currentTabStopId===u,m=SK(n),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:y}=f;return _.useEffect(()=>{if(r)return g(),()=>b()},[r,g,b]),c.jsx(NR.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:c.jsx(Tn.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...a,ref:t,onMouseDown:it(e.onMouseDown,x=>{r?f.onItemFocus(u):x.preventDefault()}),onFocus:it(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:it(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const w=sve(x,f.orientation,f.dir);if(w!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let C=m().filter(E=>E.focusable).map(E=>E.ref.current);if(w==="last")C.reverse();else if(w==="prev"||w==="next"){w==="prev"&&C.reverse();const E=C.indexOf(x.currentTarget);C=f.loop?ove(C,E+1):C.slice(E+1)}setTimeout(()=>NK(C))}}),children:typeof o=="function"?o({isCurrentTabStop:p,hasTabStop:y!=null}):o})})});EK.displayName=kK;var rve={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ive(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function sve(e,t,n){const r=ive(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return rve[r]}function NK(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ove(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ave=CK,lve=EK,TR=["Enter"," "],cve=["ArrowDown","PageUp","Home"],TK=["ArrowUp","PageDown","End"],uve=[...cve,...TK],dve={ltr:[...TR,"ArrowRight"],rtl:[...TR,"ArrowLeft"]},fve={ltr:["ArrowLeft"],rtl:["ArrowRight"]},g_="Menu",[Jy,hve,pve]=qI(g_),[kp,AK]=Pu(g_,[pve,kf,wK]),pk=kf(),RK=wK(),[mve,Ep]=kp(g_),[gve,v_]=kp(g_),MK=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=pk(t),[l,u]=_.useState(null),f=_.useRef(!1),p=ul(s),m=YI(i);return _.useEffect(()=>{const g=()=>{f.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>f.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),c.jsx(lk,{...a,children:c.jsx(mve,{scope:t,open:n,onOpenChange:p,content:l,onContentChange:u,children:c.jsx(gve,{scope:t,onClose:_.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:f,dir:m,modal:o,children:r})})})};MK.displayName=g_;var vve="MenuAnchor",XI=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=pk(n);return c.jsx(d_,{...i,...r,ref:t})});XI.displayName=vve;var QI="MenuPortal",[bve,jK]=kp(QI,{forceMount:void 0}),OK=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Ep(QI,t);return c.jsx(bve,{scope:t,forceMount:n,children:c.jsx(La,{present:n||s.open,children:c.jsx(bv,{asChild:!0,container:i,children:r})})})};OK.displayName=QI;var ka="MenuContent",[yve,JI]=kp(ka),IK=_.forwardRef((e,t)=>{const n=jK(ka,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Ep(ka,e.__scopeMenu),o=v_(ka,e.__scopeMenu);return c.jsx(Jy.Provider,{scope:e.__scopeMenu,children:c.jsx(La,{present:r||s.open,children:c.jsx(Jy.Slot,{scope:e.__scopeMenu,children:o.modal?c.jsx(xve,{...i,ref:t}):c.jsx(_ve,{...i,ref:t})})})})}),xve=_.forwardRef((e,t)=>{const n=Ep(ka,e.__scopeMenu),r=_.useRef(null),i=Qn(t,r);return _.useEffect(()=>{const s=r.current;if(s)return tk(s)},[]),c.jsx(ZI,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:it(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),_ve=_.forwardRef((e,t)=>{const n=Ep(ka,e.__scopeMenu);return c.jsx(ZI,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Sve=tp("MenuContent.ScrollLock"),ZI=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:g,disableOutsideScroll:b,...y}=e,x=Ep(ka,n),w=v_(ka,n),k=pk(n),C=RK(n),E=hve(n),[A,N]=_.useState(null),M=_.useRef(null),j=Qn(t,M,x.onContentChange),I=_.useRef(0),z=_.useRef(""),F=_.useRef(0),O=_.useRef(null),P=_.useRef("right"),W=_.useRef(0),U=b?c_:_.Fragment,B=b?{as:Sve,allowPinchZoom:!0}:void 0,K=Y=>{var ce,ge;const G=z.current+Y,D=E().filter(ne=>!ne.disabled),Q=document.activeElement,ae=(ce=D.find(ne=>ne.ref.current===Q))==null?void 0:ce.textValue,re=D.map(ne=>ne.textValue),he=Ive(re,G,ae),ue=(ge=D.find(ne=>ne.textValue===he))==null?void 0:ge.ref.current;(function ne(le){z.current=le,window.clearTimeout(I.current),le!==""&&(I.current=window.setTimeout(()=>ne(""),1e3))})(G),ue&&setTimeout(()=>ue.focus())};_.useEffect(()=>()=>window.clearTimeout(I.current),[]),Z1();const V=_.useCallback(Y=>{var D,Q;return P.current===((D=O.current)==null?void 0:D.side)&&Lve(Y,(Q=O.current)==null?void 0:Q.area)},[]);return c.jsx(yve,{scope:n,searchRef:z,onItemEnter:_.useCallback(Y=>{V(Y)&&Y.preventDefault()},[V]),onItemLeave:_.useCallback(Y=>{var G;V(Y)||((G=M.current)==null||G.focus(),N(null))},[V]),onTriggerLeave:_.useCallback(Y=>{V(Y)&&Y.preventDefault()},[V]),pointerGraceTimerRef:F,onPointerGraceIntentChange:_.useCallback(Y=>{O.current=Y},[]),children:c.jsx(U,{...B,children:c.jsx(l_,{asChild:!0,trapped:i,onMountAutoFocus:it(s,Y=>{var G;Y.preventDefault(),(G=M.current)==null||G.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:c.jsx(vv,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:g,children:c.jsx(ave,{asChild:!0,...C,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:it(l,Y=>{w.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:c.jsx(ck,{role:"menu","aria-orientation":"vertical","data-state":XK(x.open),"data-radix-menu-content":"",dir:w.dir,...k,...y,ref:j,style:{outline:"none",...y.style},onKeyDown:it(y.onKeyDown,Y=>{const D=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,Q=Y.ctrlKey||Y.altKey||Y.metaKey,ae=Y.key.length===1;D&&(Y.key==="Tab"&&Y.preventDefault(),!Q&&ae&&K(Y.key));const re=M.current;if(Y.target!==re||!uve.includes(Y.key))return;Y.preventDefault();const ue=E().filter(ce=>!ce.disabled).map(ce=>ce.ref.current);TK.includes(Y.key)&&ue.reverse(),jve(ue)}),onBlur:it(e.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(I.current),z.current="")}),onPointerMove:it(e.onPointerMove,Zy(Y=>{const G=Y.target,D=W.current!==Y.clientX;if(Y.currentTarget.contains(G)&&D){const Q=Y.clientX>W.current?"right":"left";P.current=Q,W.current=Y.clientX}}))})})})})})})});IK.displayName=ka;var wve="MenuGroup",eP=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(Tn.div,{role:"group",...r,ref:t})});eP.displayName=wve;var Cve="MenuLabel",PK=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(Tn.div,{...r,ref:t})});PK.displayName=Cve;var jC="MenuItem",fF="menu.itemSelect",mk=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=v_(jC,e.__scopeMenu),a=JI(jC,e.__scopeMenu),l=Qn(t,s),u=_.useRef(!1),f=()=>{const p=s.current;if(!n&&p){const m=new CustomEvent(fF,{bubbles:!0,cancelable:!0});p.addEventListener(fF,g=>r==null?void 0:r(g),{once:!0}),eV(p,m),m.defaultPrevented?u.current=!1:o.onClose()}};return c.jsx(LK,{...i,ref:l,disabled:n,onClick:it(e.onClick,f),onPointerDown:p=>{var m;(m=e.onPointerDown)==null||m.call(e,p),u.current=!0},onPointerUp:it(e.onPointerUp,p=>{var m;u.current||(m=p.currentTarget)==null||m.click()}),onKeyDown:it(e.onKeyDown,p=>{const m=a.searchRef.current!=="";n||m&&p.key===" "||TR.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});mk.displayName=jC;var LK=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=JI(jC,n),a=RK(n),l=_.useRef(null),u=Qn(t,l),[f,p]=_.useState(!1),[m,g]=_.useState("");return _.useEffect(()=>{const b=l.current;b&&g((b.textContent??"").trim())},[s.children]),c.jsx(Jy.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:c.jsx(lve,{asChild:!0,...a,focusable:!r,children:c.jsx(Tn.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:it(e.onPointerMove,Zy(b=>{r?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:it(e.onPointerLeave,Zy(b=>o.onItemLeave(b))),onFocus:it(e.onFocus,()=>p(!0)),onBlur:it(e.onBlur,()=>p(!1))})})})}),kve="MenuCheckboxItem",DK=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return c.jsx(UK,{scope:e.__scopeMenu,checked:n,children:c.jsx(mk,{role:"menuitemcheckbox","aria-checked":OC(n)?"mixed":n,...i,ref:t,"data-state":nP(n),onSelect:it(i.onSelect,()=>r==null?void 0:r(OC(n)?!0:!n),{checkForDefaultPrevented:!1})})})});DK.displayName=kve;var $K="MenuRadioGroup",[Eve,Nve]=kp($K,{value:void 0,onValueChange:()=>{}}),zK=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=ul(r);return c.jsx(Eve,{scope:e.__scopeMenu,value:n,onValueChange:s,children:c.jsx(eP,{...i,ref:t})})});zK.displayName=$K;var FK="MenuRadioItem",BK=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=Nve(FK,e.__scopeMenu),s=n===i.value;return c.jsx(UK,{scope:e.__scopeMenu,checked:s,children:c.jsx(mk,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":nP(s),onSelect:it(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});BK.displayName=FK;var tP="MenuItemIndicator",[UK,Tve]=kp(tP,{checked:!1}),HK=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=Tve(tP,n);return c.jsx(La,{present:r||OC(s.checked)||s.checked===!0,children:c.jsx(Tn.span,{...i,ref:t,"data-state":nP(s.checked)})})});HK.displayName=tP;var Ave="MenuSeparator",WK=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(Tn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});WK.displayName=Ave;var Rve="MenuArrow",VK=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=pk(n);return c.jsx(uk,{...i,...r,ref:t})});VK.displayName=Rve;var Mve="MenuSub",[h9e,KK]=kp(Mve),Zb="MenuSubTrigger",GK=_.forwardRef((e,t)=>{const n=Ep(Zb,e.__scopeMenu),r=v_(Zb,e.__scopeMenu),i=KK(Zb,e.__scopeMenu),s=JI(Zb,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,u={__scopeMenu:e.__scopeMenu},f=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>f,[f]),_.useEffect(()=>{const p=a.current;return()=>{window.clearTimeout(p),l(null)}},[a,l]),c.jsx(XI,{asChild:!0,...u,children:c.jsx(LK,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":XK(n.open),...e,ref:CI(t,i.onTriggerChange),onClick:p=>{var m;(m=e.onClick)==null||m.call(e,p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:it(e.onPointerMove,Zy(p=>{s.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:it(e.onPointerLeave,Zy(p=>{var g,b;f();const m=(g=n.content)==null?void 0:g.getBoundingClientRect();if(m){const y=(b=n.content)==null?void 0:b.dataset.side,x=y==="right",w=x?-5:5,k=m[x?"left":"right"],C=m[x?"right":"left"];s.onPointerGraceIntentChange({area:[{x:p.clientX+w,y:p.clientY},{x:k,y:m.top},{x:C,y:m.top},{x:C,y:m.bottom},{x:k,y:m.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(p),p.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:it(e.onKeyDown,p=>{var g;const m=s.searchRef.current!=="";e.disabled||m&&p.key===" "||dve[r.dir].includes(p.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),p.preventDefault())})})})});GK.displayName=Zb;var qK="MenuSubContent",YK=_.forwardRef((e,t)=>{const n=jK(ka,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Ep(ka,e.__scopeMenu),o=v_(ka,e.__scopeMenu),a=KK(qK,e.__scopeMenu),l=_.useRef(null),u=Qn(t,l);return c.jsx(Jy.Provider,{scope:e.__scopeMenu,children:c.jsx(La,{present:r||s.open,children:c.jsx(Jy.Slot,{scope:e.__scopeMenu,children:c.jsx(ZI,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var p;o.isUsingKeyboardRef.current&&((p=l.current)==null||p.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:it(e.onFocusOutside,f=>{f.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:it(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:it(e.onKeyDown,f=>{var g;const p=f.currentTarget.contains(f.target),m=fve[o.dir].includes(f.key);p&&m&&(s.onOpenChange(!1),(g=a.trigger)==null||g.focus(),f.preventDefault())})})})})})});YK.displayName=qK;function XK(e){return e?"open":"closed"}function OC(e){return e==="indeterminate"}function nP(e){return OC(e)?"indeterminate":e?"checked":"unchecked"}function jve(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Ove(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ive(e,t,n){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=Ove(e,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==n));const l=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Pve(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],u=a.x,f=a.y,p=l.x,m=l.y;f>r!=m>r&&n<(p-u)*(r-f)/(m-f)+u&&(i=!i)}return i}function Lve(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Pve(n,t)}function Zy(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Dve=MK,$ve=XI,zve=OK,Fve=IK,Bve=eP,Uve=PK,Hve=mk,Wve=DK,Vve=zK,Kve=BK,Gve=HK,qve=WK,Yve=VK,Xve=GK,Qve=YK,rP="ContextMenu",[Jve]=Pu(rP,[AK]),Xs=AK(),[Zve,QK]=Jve(rP),JK=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,a]=_.useState(!1),l=Xs(t),u=ul(r),f=_.useCallback(p=>{a(p),u(p)},[u]);return c.jsx(Zve,{scope:t,open:o,onOpenChange:f,modal:s,children:c.jsx(Dve,{...l,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};JK.displayName=rP;var ZK="ContextMenuTrigger",eG=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=QK(ZK,n),o=Xs(n),a=_.useRef({x:0,y:0}),l=_.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),u=_.useRef(0),f=_.useCallback(()=>window.clearTimeout(u.current),[]),p=m=>{a.current={x:m.clientX,y:m.clientY},s.onOpenChange(!0)};return _.useEffect(()=>f,[f]),_.useEffect(()=>void(r&&f()),[r,f]),c.jsxs(c.Fragment,{children:[c.jsx($ve,{...o,virtualRef:l}),c.jsx(Tn.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:it(e.onContextMenu,m=>{f(),p(m),m.preventDefault()}),onPointerDown:r?e.onPointerDown:it(e.onPointerDown,xS(m=>{f(),u.current=window.setTimeout(()=>p(m),700)})),onPointerMove:r?e.onPointerMove:it(e.onPointerMove,xS(f)),onPointerCancel:r?e.onPointerCancel:it(e.onPointerCancel,xS(f)),onPointerUp:r?e.onPointerUp:it(e.onPointerUp,xS(f))})]})});eG.displayName=ZK;var ebe="ContextMenuPortal",tG=e=>{const{__scopeContextMenu:t,...n}=e,r=Xs(t);return c.jsx(zve,{...r,...n})};tG.displayName=ebe;var nG="ContextMenuContent",rG=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=QK(nG,n),s=Xs(n),o=_.useRef(!1);return c.jsx(Fve,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=e.onCloseAutoFocus)==null||l.call(e,a),!a.defaultPrevented&&o.current&&a.preventDefault(),o.current=!1},onInteractOutside:a=>{var l;(l=e.onInteractOutside)==null||l.call(e,a),!a.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});rG.displayName=nG;var tbe="ContextMenuGroup",nbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Bve,{...i,...r,ref:t})});nbe.displayName=tbe;var rbe="ContextMenuLabel",ibe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Uve,{...i,...r,ref:t})});ibe.displayName=rbe;var sbe="ContextMenuItem",iG=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Hve,{...i,...r,ref:t})});iG.displayName=sbe;var obe="ContextMenuCheckboxItem",abe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Wve,{...i,...r,ref:t})});abe.displayName=obe;var lbe="ContextMenuRadioGroup",cbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Vve,{...i,...r,ref:t})});cbe.displayName=lbe;var ube="ContextMenuRadioItem",dbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Kve,{...i,...r,ref:t})});dbe.displayName=ube;var fbe="ContextMenuItemIndicator",hbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Gve,{...i,...r,ref:t})});hbe.displayName=fbe;var pbe="ContextMenuSeparator",sG=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(qve,{...i,...r,ref:t})});sG.displayName=pbe;var mbe="ContextMenuArrow",gbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Yve,{...i,...r,ref:t})});gbe.displayName=mbe;var vbe="ContextMenuSubTrigger",bbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Xve,{...i,...r,ref:t})});bbe.displayName=vbe;var ybe="ContextMenuSubContent",xbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Qve,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});xbe.displayName=ybe;function xS(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var _be=JK,Sbe=eG,wbe=tG,oG=rG,aG=iG,lG=sG;const cG=_.createContext(null);function Np({onOpenChange:e,...t}){const[n,r]=_.useState(0),i=_.useCallback(()=>{r(s=>s+1),e==null||e(!1)},[e]);return c.jsx(cG.Provider,{value:i,children:c.jsx(_be,{onOpenChange:e,...t},n)})}const Tp=Sbe,Ef=_.forwardRef(({className:e,...t},n)=>c.jsx(wbe,{children:c.jsx(oG,{ref:n,className:pe("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...t})}));Ef.displayName=oG.displayName;const Er=_.forwardRef(({className:e,onSelect:t,...n},r)=>{const i=_.useContext(cG);return c.jsx(aG,{ref:r,className:pe("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onSelect:s=>{t==null||t(s),i==null||i()},...n})});Er.displayName=aG.displayName;const uG=_.forwardRef(({className:e,...t},n)=>c.jsx(lG,{ref:n,className:pe("-mx-1 my-1 h-px bg-border",e),...t}));uG.displayName=lG.displayName;var gk="Popover",[dG]=Pu(gk,[kf]),b_=kf(),[Cbe,Nf]=dG(gk),fG=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=e,a=b_(t),l=_.useRef(null),[u,f]=_.useState(!1),[p,m]=Fg({prop:r,defaultProp:i??!1,onChange:s,caller:gk});return c.jsx(lk,{...a,children:c.jsx(Cbe,{scope:t,contentId:pu(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:_.useCallback(()=>m(g=>!g),[m]),hasCustomAnchor:u,onCustomAnchorAdd:_.useCallback(()=>f(!0),[]),onCustomAnchorRemove:_.useCallback(()=>f(!1),[]),modal:o,children:n})})};fG.displayName=gk;var hG="PopoverAnchor",kbe=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Nf(hG,n),s=b_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return _.useEffect(()=>(o(),()=>a()),[o,a]),c.jsx(d_,{...s,...r,ref:t})});kbe.displayName=hG;var pG="PopoverTrigger",mG=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Nf(pG,n),s=b_(n),o=Qn(t,i.triggerRef),a=c.jsx(Tn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":xG(i.open),...r,ref:o,onClick:it(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:c.jsx(d_,{asChild:!0,...s,children:a})});mG.displayName=pG;var iP="PopoverPortal",[Ebe,Nbe]=dG(iP,{forceMount:void 0}),gG=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=Nf(iP,t);return c.jsx(Ebe,{scope:t,forceMount:n,children:c.jsx(La,{present:n||s.open,children:c.jsx(bv,{asChild:!0,container:i,children:r})})})};gG.displayName=iP;var Hg="PopoverContent",vG=_.forwardRef((e,t)=>{const n=Nbe(Hg,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=Nf(Hg,e.__scopePopover);return c.jsx(La,{present:r||s.open,children:s.modal?c.jsx(Abe,{...i,ref:t}):c.jsx(Rbe,{...i,ref:t})})});vG.displayName=Hg;var Tbe=tp("PopoverContent.RemoveScroll"),Abe=_.forwardRef((e,t)=>{const n=Nf(Hg,e.__scopePopover),r=_.useRef(null),i=Qn(t,r),s=_.useRef(!1);return _.useEffect(()=>{const o=r.current;if(o)return tk(o)},[]),c.jsx(c_,{as:Tbe,allowPinchZoom:!0,children:c.jsx(bG,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:it(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:it(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,u=a.button===2||l;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:it(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Rbe=_.forwardRef((e,t)=>{const n=Nf(Hg,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return c.jsx(bG,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),bG=_.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,...p}=e,m=Nf(Hg,n),g=b_(n);return Z1(),c.jsx(l_,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:c.jsx(vv,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),children:c.jsx(ck,{"data-state":xG(m.open),role:"dialog",id:m.contentId,...g,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),yG="PopoverClose",Mbe=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Nf(yG,n);return c.jsx(Tn.button,{type:"button",...r,ref:t,onClick:it(e.onClick,()=>i.onOpenChange(!1))})});Mbe.displayName=yG;var jbe="PopoverArrow",Obe=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=b_(n);return c.jsx(uk,{...i,...r,ref:t})});Obe.displayName=jbe;function xG(e){return e?"open":"closed"}var Ibe=fG,Pbe=mG,Lbe=gG,_G=vG;const Tf=Ibe,Af=Pbe,Du=_.forwardRef(({className:e,align:t="center",sideOffset:n=4,ports:r={},...i},s)=>{const o=r.dom??Et;return c.jsx(Lbe,{children:c.jsx(_G,{ref:s,align:t,sideOffset:n,[kC]:"",onCloseAutoFocus:a=>{var l;a.preventDefault(),o.dispatchCustomWindowEvent(RI),(l=i.onCloseAutoFocus)==null||l.call(i,a)},className:pe("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})})});Du.displayName=_G.displayName;const AR=en("StackActionsPopover",()=>e=>({open:!1,setOpen:t=>e({open:t})}));function Dbe({editorLabel:e,starred:t,onCopyPath:n,onShowArchived:r,onOpenInFinder:i,onOpenInEditor:s,onToggleStar:o,onHide:a,children:l}){return c.jsxs(Np,{children:[c.jsx(Tp,{asChild:!0,children:l}),c.jsxs(Ef,{children:[c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),o()},children:[t?c.jsx(Fde,{className:"h-3.5 w-3.5"}):c.jsx(I9,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:t?"Unstar project":"Star project"})]}),c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),n()},children:[c.jsx(cl,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),r()},children:[c.jsx(dI,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Show Archived"})]}),c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),i()},children:[c.jsx(X1,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Show in Finder"})]}),c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),s()},children:[c.jsx(fI,{className:"h-3.5 w-3.5"}),c.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),a()},className:"text-destructive hover:bg-destructive/10 focus:bg-destructive/10",children:[c.jsx(Ice,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})]})]})}function $be({canFork:e,onRename:t,onOpenInFinder:n,onFork:r,onArchive:i,onDelete:s,onEditPermissions:o,children:a}){return c.jsxs(Np,{children:[c.jsx(Tp,{asChild:!0,children:a}),c.jsxs(Ef,{children:[c.jsxs(Er,{onSelect:l=>{l.preventDefault(),t()},children:[c.jsx(wf,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),c.jsxs(Er,{onSelect:l=>{l.preventDefault(),n()},children:[c.jsx(X1,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Open in Finder"})]}),c.jsxs(Er,{disabled:!e,onSelect:l=>{l.preventDefault(),e&&r()},children:[c.jsx(O9,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Fork"})]}),o?c.jsxs(Er,{onSelect:l=>{l.preventDefault(),o()},children:[c.jsx(bI,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Permissions…"})]}):null,c.jsxs(Er,{onSelect:l=>{l.preventDefault(),i()},children:[c.jsx(dI,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Archive"})]}),c.jsxs(Er,{onSelect:l=>{l.preventDefault(),s()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[c.jsx(Iu,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Delete"})]})]})]})}function zbe({stackTitle:e,onRename:t,onEditMembers:n,onDelete:r,children:i}){const s=AR.useScopedStore(l=>l.open),o=AR.useScopedStore(l=>l.setOpen);function a(l){return()=>{o(!1),l()}}return c.jsxs(Tf,{open:s,onOpenChange:o,children:[c.jsx(Af,{asChild:!0,children:i}),c.jsxs(Du,{align:"end",sideOffset:4,className:"w-44 p-1",role:"menu","aria-label":`Actions for ${e}`,children:[c.jsxs("button",{type:"button",role:"menuitem",onClick:a(t),className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs font-medium hover:bg-muted focus-visible:bg-muted outline-hidden",children:[c.jsx(wf,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Rename"})]}),c.jsxs("button",{type:"button",role:"menuitem",onClick:a(n),className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs font-medium hover:bg-muted focus-visible:bg-muted outline-hidden",children:[c.jsx(L9,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Edit members"})]}),c.jsxs("button",{type:"button",role:"menuitem",onClick:a(r),className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs font-medium text-destructive dark:text-red-400 hover:bg-destructive/10 focus-visible:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus-visible:bg-red-500/20 outline-hidden",children:[c.jsx(Iu,{className:"h-3.5 w-3.5"}),c.jsxs("span",{children:["Delete ",e]})]})]})]})}function Fbe({stackTitle:e,onRename:t,onEditMembers:n,onDelete:r,children:i}){return c.jsx(AR.Provider,{init:{},children:c.jsx(zbe,{stackTitle:e,onRename:t,onEditMembers:n,onDelete:r,children:i})})}function Bbe({stackTitle:e,onRename:t,onEditMembers:n,onDelete:r,children:i}){return c.jsxs(Np,{children:[c.jsx(Tp,{asChild:!0,children:i}),c.jsxs(Ef,{children:[c.jsxs(Er,{onSelect:s=>{s.preventDefault(),t()},children:[c.jsx(wf,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),c.jsxs(Er,{onSelect:s=>{s.preventDefault(),n()},children:[c.jsx(L9,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Edit members"})]}),c.jsxs(Er,{onSelect:s=>{s.preventDefault(),r()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[c.jsx(Iu,{className:"h-3.5 w-3.5"}),c.jsxs("span",{className:"text-xs font-medium",children:["Delete ",e]})]})]})]})}function Ube(e){return e.status==="running"||e.status==="starting"?"warning":e.status==="waiting_for_user"?"info":e.status==="failed"?"destructive":e.unread?"success":null}function Hbe(e){switch(e){case"warning":return"bg-warning";case"info":return"bg-info";case"success":return"bg-success";case"destructive":return"bg-destructive";default:return""}}function Wbe(e){switch(e){case"warning":return"text-warning";case"info":return"text-info";case"success":return"text-success";case"destructive":return"text-destructive";default:return"text-muted-foreground"}}function Vbe(e){switch(e){case"active":return{glyph:"●",tone:"text-success",title:"Claude PTY session active"};case"warming":return{glyph:"◐",tone:"text-warning",title:"Claude PTY session warming"};case"idle":return{glyph:"○",tone:"text-muted-foreground",title:"Claude PTY session idle"};case"cooling":return{glyph:"◌",tone:"text-muted-foreground",title:"Claude PTY session cooling down"};case"cold":default:return null}}function Kbe({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onRenameChat:o,onOpenInFinder:a,onForkChat:l,onArchiveChat:u,onDeleteChat:f,onEditPermissions:p}){const m=(e.status==="running"||e.status==="waiting_for_user")&&e.stateEnteredAt!=null,g=m&&e.stateEnteredAt!=null?`${ER(e.status)} ${kR(n-e.stateEnteredAt)}`:ba(n-(e.lastMessageAt??e._creationTime)),b=i&&r?r:g,y=i&&!!r,x=Qfe(e.chatId),w=t===x,k=Ube(e);let C;e.canFork?C="w-12":m?C="w-12 md:w-20":C="w-6 md:w-14";let E=null;b&&(y?E=c.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-0.5 text-[11px] text-foreground transition-opacity duration-150 group-hover:opacity-0",children:c.jsx(pK,{className:"h-4 min-w-4 rounded-sm border-border/50 bg-transparent px-1 text-[10px]",children:r})}):E=c.jsx("span",{className:pe("hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] tabular-nums transition-opacity duration-150 group-hover:opacity-0 whitespace-nowrap",m?Wbe(k):"text-muted-foreground"),children:b}));const A=c.jsxs("div",{"data-chat-id":x,className:pe("group flex items-center gap-2 pl-2 pr-1 py-1.5 rounded-md cursor-pointer transition-colors duration-150",w?"bg-muted":"hover:bg-muted/40"),onClick:()=>s(e.chatId),children:[c.jsx("span",{className:"relative flex h-3.5 w-3.5 shrink-0 items-center justify-center","aria-hidden":!0,children:k?c.jsx("span",{className:pe("h-2 w-2 rounded-full",Hbe(k))}):null}),(()=>{const N=Vbe(e.sessionState);return N?c.jsx(oc,{label:N.title,children:c.jsx("span",{className:pe("shrink-0 text-[10px] leading-none",N.tone),"aria-label":N.title,children:N.glyph})}):null})(),e.hasPolicyOverride?c.jsx(bI,{className:"size-3 shrink-0 text-warning","aria-label":"Per-chat permission override active"}):null,c.jsx("span",{className:pe("truncate flex-1 text-sm",w?"text-foreground font-medium":"text-foreground/90",e.status==="idle"&&!e.unread&&!w?"text-muted-foreground":""),children:e.title}),c.jsxs("div",{className:pe("relative h-6 shrink-0",C),children:[E,c.jsxs("div",{className:pe("absolute inset-0 flex items-center justify-end gap-0 transition-opacity duration-150",b?"opacity-100 md:opacity-0 md:group-hover:opacity-100":"opacity-100"),children:[e.canFork?c.jsx(je,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:N=>{N.stopPropagation(),l(e.chatId)},title:"Fork chat",children:c.jsx(O9,{className:"size-3.5"})}):null,c.jsx(je,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:N=>{N.stopPropagation(),u(e.chatId)},title:"Archive chat",children:c.jsx(dI,{className:"size-3.5"})})]})]})]},e._id);return c.jsx($be,{canFork:e.canFork,onRename:()=>o(e.chatId),onOpenInFinder:()=>a(e.localPath),onFork:()=>l(e.chatId),onArchive:()=>u(e.chatId),onDelete:()=>f(e.chatId),onEditPermissions:p?()=>p(e.chatId):void 0,children:A})}const Gbe=_.memo(Kbe);function qbe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const vk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Sv(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function sP(e){return"nodeType"in e}function Co(e){var t,n;return e?Sv(e)?e:sP(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function oP(e){const{Document:t}=Co(e);return e instanceof t}function y_(e){return Sv(e)?!1:e instanceof Co(e).HTMLElement}function SG(e){return e instanceof Co(e).SVGElement}function wv(e){return e?Sv(e)?e.document:sP(e)?oP(e)?e:y_(e)||SG(e)?e.ownerDocument:document:document:document}const ac=vk?_.useLayoutEffect:_.useEffect;function aP(e){const t=_.useRef(e);return ac(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function Ybe(){const e=_.useRef(null),t=_.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ex(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return ac(()=>{n.current!==e&&(n.current=e)},t),n}function x_(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function IC(e){const t=aP(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function RR(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let ZT={};function __(e,t){return _.useMemo(()=>{if(t)return t;const n=ZT[e]==null?0:ZT[e]+1;return ZT[e]=n,e+"-"+n},[e,t])}function wG(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const a=Object.entries(o);for(const[l,u]of a){const f=s[l];f!=null&&(s[l]=f+e*u)}return s},{...t})}}const lg=wG(1),PC=wG(-1);function Xbe(e){return"clientX"in e&&"clientY"in e}function lP(e){if(!e)return!1;const{KeyboardEvent:t}=Co(e.target);return t&&e instanceof t}function Qbe(e){if(!e)return!1;const{TouchEvent:t}=Co(e.target);return t&&e instanceof t}function MR(e){if(Qbe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Xbe(e)?{x:e.clientX,y:e.clientY}:null}const tx=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[tx.Translate.toString(e),tx.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),hF="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Jbe(e){return e.matches(hF)?e:e.querySelector(hF)}const Zbe={display:"none"};function eye(e){let{id:t,value:n}=e;return Wn.createElement("div",{id:t,style:Zbe},n)}function tye(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Wn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function nye(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const CG=_.createContext(null);function rye(e){const t=_.useContext(CG);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function iye(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:i,event:s}=r;e.forEach(o=>{var a;return(a=o[i])==null?void 0:a.call(o,s)})},[e]),t]}const sye={draggable:`
|
|
771
|
+
`)&&(w.writePathDeny=x),Object.keys(w).length===0?null:w}function g(){r(m())}function b(){r(null)}return c.jsxs(c.Fragment,{children:[c.jsx(Yo,{open:e,onOpenChange:y=>{y||i()},children:c.jsxs(So,{className:"max-w-2xl",children:[c.jsxs(Xo,{children:["Permissions — ",t]}),c.jsxs(Aa,{className:"space-y-5",children:[c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-sm font-medium",children:"Default action"}),c.jsxs("div",{className:"text-xs text-muted-foreground",children:["Behaviour when a tool call has no explicit allow/deny rule. ",c.jsx("strong",{children:"auto-allow"})," bypasses prompts and runs untrusted shell commands without supervision — use a worktree."]}),c.jsx(Hs,{value:s,onValueChange:p,options:[{value:"ask",label:"Ask"},{value:"auto-allow",label:"Auto-allow (unsafe)"},{value:"auto-deny",label:"Auto-deny"}]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-sm font-medium",children:"Read-path deny list"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"One glob per line. The model cannot read paths matching any entry. Defaults shown below — edit to add or remove."}),c.jsx("textarea",{value:o,onChange:y=>f.getState().setReadDenyText(y.target.value),rows:8,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-xs",spellCheck:!1})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("div",{className:"text-sm font-medium",children:"Write-path deny list"}),c.jsx("div",{className:"text-xs text-muted-foreground",children:"One glob per line. The model cannot edit or write paths matching any entry."}),c.jsx("textarea",{value:a,onChange:y=>f.getState().setWriteDenyText(y.target.value),rows:8,className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-xs",spellCheck:!1})]})]}),c.jsxs(yu,{className:"justify-between",children:[c.jsx(je,{variant:"ghost",onClick:b,children:"Reset to defaults"}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(je,{variant:"ghost",onClick:i,children:"Cancel"}),c.jsx(je,{onClick:g,children:"Apply"})]})]})]})}),c.jsx(Yo,{open:l,onOpenChange:y=>{y||(f.getState().setConfirmUnsafeOpen(!1),f.getState().setPendingDefaultAction(null))},children:c.jsxs(So,{className:"max-w-md",children:[c.jsx(Xo,{children:"Enable auto-allow for this chat?"}),c.jsxs(Aa,{className:"space-y-3 text-sm",children:[c.jsx("p",{children:"Auto-allow disables tool-call prompts. The model can run shell commands, write files, and edit code without asking. Read/write deny lists still apply."}),c.jsx("p",{className:"text-warning",children:"Use a worktree for risky tasks."})]}),c.jsxs(yu,{className:"justify-end gap-2",children:[c.jsx(je,{variant:"ghost",onClick:()=>{f.getState().setConfirmUnsafeOpen(!1),f.getState().setPendingDefaultAction(null)},children:"Cancel"}),c.jsx(je,{variant:"destructive",onClick:()=>{const y=f.getState();u&&y.setDefaultAction(u),y.setConfirmUnsafeOpen(!1),y.setPendingDefaultAction(null)},children:"Enable auto-allow"})]})]})})]})}const vge={defaultAction:"ask",bash:{autoAllowVerbs:["ls","pwd","git status","git diff","git log"]},readPathDeny:["~/.ssh","~/.aws","~/.gcp","~/.config/gh","~/.claude","~/.kanna","~/Library/Keychains","/etc/shadow","/etc/sudoers","~/.gnupg","~/.gitconfig","**/.git/config","~/.npmrc","~/.netrc","~/.docker/config.json","**/.env","**/.env.*","**/credentials*","**/*.pem","**/*.key","**/id_rsa*","**/id_ed25519*"],writePathDeny:["/etc/**","/usr/**","/System/**","~/.ssh/**","~/.aws/**","~/.config/gh/**","~/.claude/**","~/.kanna/**","~/.gnupg/**","~/.gitconfig","**/.git/config"],toolDenyList:[{tool:"mcp__kanna__bash",pattern:"rm\\s+-rf\\s+(/|~|\\$HOME)(?:\\b|$|\\s)"},{tool:"mcp__kanna__bash",pattern:"git\\s+push\\b.*--force"}],toolAllowList:[]},wr={setTimeout(e,t){return window.setTimeout(e,t)},clearTimeout(e){window.clearTimeout(e)},setInterval(e,t){return window.setInterval(e,t)},clearInterval(e){window.clearInterval(e)},requestAnimationFrame(e){return window.requestAnimationFrame(e)},cancelAnimationFrame(e){window.cancelAnimationFrame(e)}},hn=_.forwardRef(({className:e,type:t,...n},r)=>c.jsx("input",{ref:r,type:t,className:pe("flex w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",e),...n}));hn.displayName="Input";const gK=_.createContext(null);function bge({children:e,ports:t={}}){const n=t.timer??wr,[r,i]=_.useState(null),[s,o]=_.useState(""),a=_.useRef(null);_.useEffect(()=>{(r==null?void 0:r.kind)==="prompt"&&(o(r.options.initialValue??""),n.setTimeout(()=>{var x,w;(x=a.current)==null||x.focus(),(w=a.current)==null||w.select()},0))},[r,n]);const l=_.useCallback(()=>{i(null),o("")},[]),u=_.useCallback(()=>{r&&(r.kind==="confirm"?r.resolve(!1):r.kind==="prompt"?r.resolve(null):r.resolve(),l())},[l,r]),f=_.useCallback(()=>{r&&(r.kind==="confirm"?r.resolve(!0):r.kind==="prompt"?r.resolve(s.trim()||null):r.resolve(),l())},[l,r,s]),p=_.useCallback(x=>new Promise(w=>{i({kind:"confirm",options:x,resolve:w})}),[]),m=_.useCallback(x=>new Promise(w=>{i({kind:"prompt",options:x,resolve:w})}),[]),g=_.useCallback(x=>new Promise(w=>{i({kind:"alert",options:x,resolve:w})}),[]),b=_.useMemo(()=>({confirm:p,prompt:m,alert:g}),[g,p,m]);let y="Confirm";return r&&(r.kind==="alert"?y=r.options.closeLabel??"OK":"confirmLabel"in r.options&&(y=r.options.confirmLabel??"Confirm")),c.jsxs(gK.Provider,{value:b,children:[e,c.jsx(Yo,{open:r!==null,onOpenChange:x=>{x||!r||u()},children:c.jsx(So,{size:"sm",onKeyDown:x=>{x.key!=="Enter"||x.shiftKey||!r||r.kind!=="confirm"||(x.preventDefault(),f())},children:r?c.jsxs(c.Fragment,{children:[c.jsxs(Aa,{className:"space-y-4",children:[c.jsx(Xo,{children:r.options.title}),r.options.description?c.jsx(yv,{children:r.options.description}):null,r.kind==="prompt"?c.jsx(hn,{ref:a,type:"text",value:s,onChange:x=>o(x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),f())},placeholder:r.options.placeholder}):null]}),c.jsxs(yu,{children:[c.jsx(je,{variant:"ghost",size:"sm",onClick:u,className:r.kind==="alert"?"hidden":void 0,children:"cancelLabel"in r.options?r.options.cancelLabel??"Cancel":"Cancel"}),c.jsx(je,{variant:r.kind==="confirm"?r.options.confirmVariant??"default":"secondary",size:"sm",onClick:f,disabled:r.kind==="prompt"&&!s.trim(),children:y})]})]}):null})})]})}function p_(){const e=_.useContext(gK);if(!e)throw new Error("useAppDialog must be used within AppDialogProvider");return e}const UI=_.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:pe("bg-card text-card-foreground",e),...t}));UI.displayName="Card";const HI=_.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:pe("flex flex-col space-y-1.5 p-2",e),...t}));HI.displayName="CardHeader";const vK=_.forwardRef(({className:e,...t},n)=>c.jsx("h3",{ref:n,className:pe("text-2xl font-semibold leading-none tracking-tight",e),...t}));vK.displayName="CardTitle";const bK=_.forwardRef(({className:e,...t},n)=>c.jsx("p",{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));bK.displayName="CardDescription";const WI=_.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:pe("p-6 pt-0",e),...t}));WI.displayName="CardContent";const yge=_.forwardRef(({className:e,...t},n)=>c.jsx("div",{ref:n,className:pe("flex items-center p-6 pt-0",e),...t}));yge.displayName="CardFooter";const xge={info:{dotVar:"var(--info)",bgClass:"bg-info/[0.06]"},warning:{dotVar:"var(--warning)",bgClass:"bg-warning/[0.06]"},success:{dotVar:"var(--success)",bgClass:"bg-success/[0.06]"},error:{dotVar:"var(--destructive)",bgClass:"bg-destructive/[0.06]"}};function _ge({variant:e,children:t,dot:n=!0,className:r}){const i=xge[e];return c.jsxs("div",{role:"status",className:pe("flex flex-wrap items-center justify-center gap-x-2 gap-y-1 border-b border-border px-4 py-2 text-xs leading-tight",i.bgClass,r),children:[n?c.jsx("span",{"aria-hidden":"true",className:"inline-block size-1.5 shrink-0 rounded-full",style:{backgroundColor:i.dotVar}}):null,t]})}const Sge="modulepreload",wge=function(e){return"/"+e},aF={},Z=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(u=>{if(u=wge(u),u in aF)return;aF[u]=!0;const f=u.endsWith(".css"),p=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${p}`))return;const m=document.createElement("link");if(m.rel=f?"stylesheet":Sge,f||(m.as="script"),m.crossOrigin="",m.href=u,l&&m.setAttribute("nonce",l),document.head.appendChild(m),f)return new Promise((g,b)=>{m.addEventListener("load",g),m.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${u}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return t().catch(s)})},Cge=_.lazy(()=>Z(()=>import("./index-w789V01k.js"),[]).then(e=>({default:e.Toaster})));function kge(){return c.jsx(_.Suspense,{fallback:null,children:c.jsx(Cge,{position:"bottom-right",theme:"system",closeButton:!0,duration:6e3})})}const Ege="1.6.3",Nge={version:Ege},Yr="Kanna",lF="kanna",Tge=".kanna",Age=".kanna-dev",Rge="KANNA_RUNTIME_PROFILE",VI=`kanna/${Nge.version}`,Mge="[kanna]",jge=`~/${Yr}`;function hk(){const e=Reflect.get(globalThis,"process");return e==null?void 0:e.env}function Oge(e=hk()){var t;return((t=e==null?void 0:e[Rge])==null?void 0:t.trim().toLowerCase())==="dev"?"dev":"prod"}function Ige(e=hk()){return Oge(e)==="dev"?Age:Tge}function Pge(e=hk()){return`~/${Ige(e)}`}function Lge(e=hk()){return`${Pge(e)}/keybindings.json`}function yS(e){return e?`${lF} ${e}`:lF}const yK="always",xK="funk",Dge=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function $ge(e){switch(e){case"never":case"unfocused":case"always":return e;default:return yK}}function zge(e){switch(e){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return e;default:return xK}}const Nh=tr()(e=>({chatSoundPreference:yK,chatSoundId:xK,setChatSoundPreference:t=>e({chatSoundPreference:$ge(t)}),setChatSoundId:t=>e({chatSoundId:zge(t)})})),Fge={blow:"/chat-sounds/Blow.mp3",bottle:"/chat-sounds/Bottle.mp3",frog:"/chat-sounds/Frog.mp3",funk:"/chat-sounds/Funk.mp3",glass:"/chat-sounds/Glass.mp3",ping:"/chat-sounds/Ping.mp3",pop:"/chat-sounds/Pop.mp3",purr:"/chat-sounds/Purr.mp3",tink:"/chat-sounds/Tink.mp3"};function Bge(e=Et){return e.getVisibilityState()!=="visible"||!e.hasFocus()}function Uge(e){const t=new Audio(Fge[e]);return t.preload="auto",t.play()}async function wR(e,t,n=wr){if(t<=0)return;const r=Array.from({length:t},(i,s)=>new Promise(o=>{n.setTimeout(()=>{Uge(e).catch(()=>{}).finally(()=>o())},s*90)}));await Promise.all(r)}function Hge(e,t=Et){return e==="never"?!1:e==="always"?!0:Bge(t)}function Wge(e){return e.projectGroups.reduce((t,n)=>t+n.chats.reduce((r,i)=>r+(i.unread?1:0)+(i.status==="waiting_for_user"?1:0),0),0)}function cF(e){let t=0;const n=new Set;for(const r of e.projectGroups)for(const i of r.chats)i.unread&&(t+=1),i.status==="waiting_for_user"&&n.add(i.chatId);return{unreadCount:t,waitingChatIds:n}}function Vge(e,t){if(!e)return 0;const n=cF(e),r=cF(t),i=Math.max(0,r.unreadCount-n.unreadCount);let s=0;for(const o of r.waitingChatIds)n.waitingChatIds.has(o)||(s+=1);return i+s}function xh({tooltip:e,children:t,className:n,inline:r=!1,side:i}){const s=pe("truncate",n);return c.jsx(h_,{children:c.jsxs(ks,{children:[c.jsx(Es,{asChild:!0,children:r?c.jsx("span",{className:s,children:t}):c.jsx("div",{className:s,children:t})}),c.jsx(ms,{side:i,children:e})]})})}function oc({label:e,children:t,side:n}){return c.jsx(h_,{children:c.jsxs(ks,{children:[c.jsx(Es,{asChild:!0,children:t}),c.jsx(ms,{side:n,children:e})]})})}function CR(e){return e.split(/[\s_-]+/).filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const Kge=[/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(['"])([\s\S]*)\1$/,/^(?:\/usr\/bin\/env\s+)?(?:\/bin\/)?(?:bash|zsh|sh)\s+(?:-[a-zA-Z]*c|-c)\s+(.+)$/,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:cmd(?:\.exe)?)\s+\/c\s+(.+)$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(['"])([\s\S]*)\1$/i,/^(?:\/usr\/bin\/env\s+)?(?:powershell(?:\.exe)?|pwsh)\s+(?:-NoProfile\s+)?-Command\s+(.+)$/i];function _K(e){const t=e.trim();for(const n of Kge){const r=t.match(n);if(!r)continue;const i=(r[2]??r[1]??"").trim();if(i)return i}return t}function KI(e){return e.split("/").pop()||e}const Gge=1440*6e4;function qge(e,t){if(e===void 0)return null;const n=Math.max(0,t-e),r=6e4,i=60*r,s=Gge,o=7*s;return n<r?"now":n<i?`${Math.floor(n/r)}m`:n<s?`${Math.floor(n/i)}h`:n<o?`${Math.floor(n/s)}d`:`${Math.floor(n/o)}w`}function Yge(e){return e.lastMessageAt??e._creationTime}const GI=1e3,Pw=60*GI,qm=60*Pw,QT=24*qm;function ba(e){const t=Math.max(0,e);if(t<Pw)return`${Math.floor(t/GI)}s`;if(t<qm)return`${Math.floor(t/Pw)}m`;if(t<QT){const i=Math.floor(t/qm),s=Math.floor(t%qm/Pw);return s===0?`${i}h`:`${i}h ${s}m`}const n=Math.floor(t/QT),r=Math.floor(t%QT/qm);return r===0?`${n}d`:`${n}d ${r}h`}function kR(e){const t=Math.max(0,e);if(t>=qm)return ba(t);const n=Math.floor(t/GI),r=Math.floor(n/60),i=n%60;return`${r}:${i.toString().padStart(2,"0")}`}function ER(e){switch(e){case"idle":return"Idle";case"starting":return"Starting";case"running":return"Running";case"waiting_for_user":return"Waiting";case"failed":return"Failed"}}function uF(e){switch(e){case"running":return"active";case"waiting_for_user":return"attention";case"failed":return"destructive";case"idle":case"starting":default:return"muted"}}function dF(e){switch(e){case"active":return"text-emerald-500 dark:text-emerald-400";case"attention":return"text-amber-500 dark:text-amber-400";case"destructive":return"text-destructive";case"muted":default:return"text-muted-foreground"}}function qI(e){const t=e+"CollectionProvider",[n,r]=Pu(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=y=>{const{scope:x,children:w}=y,k=Wn.useRef(null),C=Wn.useRef(new Map).current;return c.jsx(i,{scope:x,itemMap:C,collectionRef:k,children:w})};o.displayName=t;const a=e+"CollectionSlot",l=tp(a),u=Wn.forwardRef((y,x)=>{const{scope:w,children:k}=y,C=s(a,w),E=Qn(x,C.collectionRef);return c.jsx(l,{ref:E,children:k})});u.displayName=a;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=tp(f),g=Wn.forwardRef((y,x)=>{const{scope:w,children:k,...C}=y,E=Wn.useRef(null),A=Qn(x,E),N=s(f,w);return Wn.useEffect(()=>(N.itemMap.set(E,{ref:E,...C}),()=>void N.itemMap.delete(E))),c.jsx(m,{[p]:"",ref:A,children:k})});g.displayName=f;function b(y){const x=s(e+"CollectionConsumer",y);return Wn.useCallback(()=>{const k=x.collectionRef.current;if(!k)return[];const C=Array.from(k.querySelectorAll(`[${p}]`));return Array.from(x.itemMap.values()).sort((N,M)=>C.indexOf(N.ref.current)-C.indexOf(M.ref.current))},[x.collectionRef,x.itemMap])}return[{Provider:o,Slot:u,ItemSlot:g},b,r]}var Xge=_.createContext(void 0);function YI(e){const t=_.useContext(Xge);return e||t||"ltr"}var JT="rovingFocusGroup.onEntryFocus",Qge={bubbles:!1,cancelable:!0},m_="RovingFocusGroup",[NR,SK,Jge]=qI(m_),[Zge,wK]=Pu(m_,[Jge]),[eve,tve]=Zge(m_),CK=_.forwardRef((e,t)=>c.jsx(NR.Provider,{scope:e.__scopeRovingFocusGroup,children:c.jsx(NR.Slot,{scope:e.__scopeRovingFocusGroup,children:c.jsx(nve,{...e,ref:t})})}));CK.displayName=m_;var nve=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...p}=e,m=_.useRef(null),g=Qn(t,m),b=YI(s),[y,x]=Fg({prop:o,defaultProp:a??null,onChange:l,caller:m_}),[w,k]=_.useState(!1),C=ul(u),E=SK(n),A=_.useRef(!1),[N,M]=_.useState(0);return _.useEffect(()=>{const j=m.current;if(j)return j.addEventListener(JT,C),()=>j.removeEventListener(JT,C)},[C]),c.jsx(eve,{scope:n,orientation:r,dir:b,loop:i,currentTabStopId:y,onItemFocus:_.useCallback(j=>x(j),[x]),onItemShiftTab:_.useCallback(()=>k(!0),[]),onFocusableItemAdd:_.useCallback(()=>M(j=>j+1),[]),onFocusableItemRemove:_.useCallback(()=>M(j=>j-1),[]),children:c.jsx(Tn.div,{tabIndex:w||N===0?-1:0,"data-orientation":r,...p,ref:g,style:{outline:"none",...e.style},onMouseDown:it(e.onMouseDown,()=>{A.current=!0}),onFocus:it(e.onFocus,j=>{const I=!A.current;if(j.target===j.currentTarget&&I&&!w){const z=new CustomEvent(JT,Qge);if(j.currentTarget.dispatchEvent(z),!z.defaultPrevented){const F=E().filter(B=>B.focusable),O=F.find(B=>B.active),P=F.find(B=>B.id===y),U=[O,P,...F].filter(Boolean).map(B=>B.ref.current);NK(U,f)}}A.current=!1}),onBlur:it(e.onBlur,()=>k(!1))})})}),kK="RovingFocusGroupItem",EK=_.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=e,l=pu(),u=s||l,f=tve(kK,n),p=f.currentTabStopId===u,m=SK(n),{onFocusableItemAdd:g,onFocusableItemRemove:b,currentTabStopId:y}=f;return _.useEffect(()=>{if(r)return g(),()=>b()},[r,g,b]),c.jsx(NR.ItemSlot,{scope:n,id:u,focusable:r,active:i,children:c.jsx(Tn.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...a,ref:t,onMouseDown:it(e.onMouseDown,x=>{r?f.onItemFocus(u):x.preventDefault()}),onFocus:it(e.onFocus,()=>f.onItemFocus(u)),onKeyDown:it(e.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){f.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const w=sve(x,f.orientation,f.dir);if(w!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let C=m().filter(E=>E.focusable).map(E=>E.ref.current);if(w==="last")C.reverse();else if(w==="prev"||w==="next"){w==="prev"&&C.reverse();const E=C.indexOf(x.currentTarget);C=f.loop?ove(C,E+1):C.slice(E+1)}setTimeout(()=>NK(C))}}),children:typeof o=="function"?o({isCurrentTabStop:p,hasTabStop:y!=null}):o})})});EK.displayName=kK;var rve={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ive(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function sve(e,t,n){const r=ive(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return rve[r]}function NK(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function ove(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ave=CK,lve=EK,TR=["Enter"," "],cve=["ArrowDown","PageUp","Home"],TK=["ArrowUp","PageDown","End"],uve=[...cve,...TK],dve={ltr:[...TR,"ArrowRight"],rtl:[...TR,"ArrowLeft"]},fve={ltr:["ArrowLeft"],rtl:["ArrowRight"]},g_="Menu",[Jy,hve,pve]=qI(g_),[kp,AK]=Pu(g_,[pve,kf,wK]),pk=kf(),RK=wK(),[mve,Ep]=kp(g_),[gve,v_]=kp(g_),MK=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,a=pk(t),[l,u]=_.useState(null),f=_.useRef(!1),p=ul(s),m=YI(i);return _.useEffect(()=>{const g=()=>{f.current=!0,document.addEventListener("pointerdown",b,{capture:!0,once:!0}),document.addEventListener("pointermove",b,{capture:!0,once:!0})},b=()=>f.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",b,{capture:!0}),document.removeEventListener("pointermove",b,{capture:!0})}},[]),c.jsx(lk,{...a,children:c.jsx(mve,{scope:t,open:n,onOpenChange:p,content:l,onContentChange:u,children:c.jsx(gve,{scope:t,onClose:_.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:f,dir:m,modal:o,children:r})})})};MK.displayName=g_;var vve="MenuAnchor",XI=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=pk(n);return c.jsx(d_,{...i,...r,ref:t})});XI.displayName=vve;var QI="MenuPortal",[bve,jK]=kp(QI,{forceMount:void 0}),OK=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Ep(QI,t);return c.jsx(bve,{scope:t,forceMount:n,children:c.jsx(La,{present:n||s.open,children:c.jsx(bv,{asChild:!0,container:i,children:r})})})};OK.displayName=QI;var ka="MenuContent",[yve,JI]=kp(ka),IK=_.forwardRef((e,t)=>{const n=jK(ka,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Ep(ka,e.__scopeMenu),o=v_(ka,e.__scopeMenu);return c.jsx(Jy.Provider,{scope:e.__scopeMenu,children:c.jsx(La,{present:r||s.open,children:c.jsx(Jy.Slot,{scope:e.__scopeMenu,children:o.modal?c.jsx(xve,{...i,ref:t}):c.jsx(_ve,{...i,ref:t})})})})}),xve=_.forwardRef((e,t)=>{const n=Ep(ka,e.__scopeMenu),r=_.useRef(null),i=Qn(t,r);return _.useEffect(()=>{const s=r.current;if(s)return tk(s)},[]),c.jsx(ZI,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:it(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),_ve=_.forwardRef((e,t)=>{const n=Ep(ka,e.__scopeMenu);return c.jsx(ZI,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Sve=tp("MenuContent.ScrollLock"),ZI=_.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:g,disableOutsideScroll:b,...y}=e,x=Ep(ka,n),w=v_(ka,n),k=pk(n),C=RK(n),E=hve(n),[A,N]=_.useState(null),M=_.useRef(null),j=Qn(t,M,x.onContentChange),I=_.useRef(0),z=_.useRef(""),F=_.useRef(0),O=_.useRef(null),P=_.useRef("right"),W=_.useRef(0),U=b?c_:_.Fragment,B=b?{as:Sve,allowPinchZoom:!0}:void 0,K=Y=>{var ce,ge;const G=z.current+Y,D=E().filter(ne=>!ne.disabled),Q=document.activeElement,ae=(ce=D.find(ne=>ne.ref.current===Q))==null?void 0:ce.textValue,re=D.map(ne=>ne.textValue),he=Ive(re,G,ae),ue=(ge=D.find(ne=>ne.textValue===he))==null?void 0:ge.ref.current;(function ne(le){z.current=le,window.clearTimeout(I.current),le!==""&&(I.current=window.setTimeout(()=>ne(""),1e3))})(G),ue&&setTimeout(()=>ue.focus())};_.useEffect(()=>()=>window.clearTimeout(I.current),[]),Z1();const V=_.useCallback(Y=>{var D,Q;return P.current===((D=O.current)==null?void 0:D.side)&&Lve(Y,(Q=O.current)==null?void 0:Q.area)},[]);return c.jsx(yve,{scope:n,searchRef:z,onItemEnter:_.useCallback(Y=>{V(Y)&&Y.preventDefault()},[V]),onItemLeave:_.useCallback(Y=>{var G;V(Y)||((G=M.current)==null||G.focus(),N(null))},[V]),onTriggerLeave:_.useCallback(Y=>{V(Y)&&Y.preventDefault()},[V]),pointerGraceTimerRef:F,onPointerGraceIntentChange:_.useCallback(Y=>{O.current=Y},[]),children:c.jsx(U,{...B,children:c.jsx(l_,{asChild:!0,trapped:i,onMountAutoFocus:it(s,Y=>{var G;Y.preventDefault(),(G=M.current)==null||G.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:c.jsx(vv,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:g,children:c.jsx(ave,{asChild:!0,...C,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:A,onCurrentTabStopIdChange:N,onEntryFocus:it(l,Y=>{w.isUsingKeyboardRef.current||Y.preventDefault()}),preventScrollOnEntryFocus:!0,children:c.jsx(ck,{role:"menu","aria-orientation":"vertical","data-state":XK(x.open),"data-radix-menu-content":"",dir:w.dir,...k,...y,ref:j,style:{outline:"none",...y.style},onKeyDown:it(y.onKeyDown,Y=>{const D=Y.target.closest("[data-radix-menu-content]")===Y.currentTarget,Q=Y.ctrlKey||Y.altKey||Y.metaKey,ae=Y.key.length===1;D&&(Y.key==="Tab"&&Y.preventDefault(),!Q&&ae&&K(Y.key));const re=M.current;if(Y.target!==re||!uve.includes(Y.key))return;Y.preventDefault();const ue=E().filter(ce=>!ce.disabled).map(ce=>ce.ref.current);TK.includes(Y.key)&&ue.reverse(),jve(ue)}),onBlur:it(e.onBlur,Y=>{Y.currentTarget.contains(Y.target)||(window.clearTimeout(I.current),z.current="")}),onPointerMove:it(e.onPointerMove,Zy(Y=>{const G=Y.target,D=W.current!==Y.clientX;if(Y.currentTarget.contains(G)&&D){const Q=Y.clientX>W.current?"right":"left";P.current=Q,W.current=Y.clientX}}))})})})})})})});IK.displayName=ka;var wve="MenuGroup",eP=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(Tn.div,{role:"group",...r,ref:t})});eP.displayName=wve;var Cve="MenuLabel",PK=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(Tn.div,{...r,ref:t})});PK.displayName=Cve;var jC="MenuItem",fF="menu.itemSelect",mk=_.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=_.useRef(null),o=v_(jC,e.__scopeMenu),a=JI(jC,e.__scopeMenu),l=Qn(t,s),u=_.useRef(!1),f=()=>{const p=s.current;if(!n&&p){const m=new CustomEvent(fF,{bubbles:!0,cancelable:!0});p.addEventListener(fF,g=>r==null?void 0:r(g),{once:!0}),eV(p,m),m.defaultPrevented?u.current=!1:o.onClose()}};return c.jsx(LK,{...i,ref:l,disabled:n,onClick:it(e.onClick,f),onPointerDown:p=>{var m;(m=e.onPointerDown)==null||m.call(e,p),u.current=!0},onPointerUp:it(e.onPointerUp,p=>{var m;u.current||(m=p.currentTarget)==null||m.click()}),onKeyDown:it(e.onKeyDown,p=>{const m=a.searchRef.current!=="";n||m&&p.key===" "||TR.includes(p.key)&&(p.currentTarget.click(),p.preventDefault())})})});mk.displayName=jC;var LK=_.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=JI(jC,n),a=RK(n),l=_.useRef(null),u=Qn(t,l),[f,p]=_.useState(!1),[m,g]=_.useState("");return _.useEffect(()=>{const b=l.current;b&&g((b.textContent??"").trim())},[s.children]),c.jsx(Jy.ItemSlot,{scope:n,disabled:r,textValue:i??m,children:c.jsx(lve,{asChild:!0,...a,focusable:!r,children:c.jsx(Tn.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:it(e.onPointerMove,Zy(b=>{r?o.onItemLeave(b):(o.onItemEnter(b),b.defaultPrevented||b.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:it(e.onPointerLeave,Zy(b=>o.onItemLeave(b))),onFocus:it(e.onFocus,()=>p(!0)),onBlur:it(e.onBlur,()=>p(!1))})})})}),kve="MenuCheckboxItem",DK=_.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return c.jsx(UK,{scope:e.__scopeMenu,checked:n,children:c.jsx(mk,{role:"menuitemcheckbox","aria-checked":OC(n)?"mixed":n,...i,ref:t,"data-state":nP(n),onSelect:it(i.onSelect,()=>r==null?void 0:r(OC(n)?!0:!n),{checkForDefaultPrevented:!1})})})});DK.displayName=kve;var $K="MenuRadioGroup",[Eve,Nve]=kp($K,{value:void 0,onValueChange:()=>{}}),zK=_.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=ul(r);return c.jsx(Eve,{scope:e.__scopeMenu,value:n,onValueChange:s,children:c.jsx(eP,{...i,ref:t})})});zK.displayName=$K;var FK="MenuRadioItem",BK=_.forwardRef((e,t)=>{const{value:n,...r}=e,i=Nve(FK,e.__scopeMenu),s=n===i.value;return c.jsx(UK,{scope:e.__scopeMenu,checked:s,children:c.jsx(mk,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":nP(s),onSelect:it(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});BK.displayName=FK;var tP="MenuItemIndicator",[UK,Tve]=kp(tP,{checked:!1}),HK=_.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=Tve(tP,n);return c.jsx(La,{present:r||OC(s.checked)||s.checked===!0,children:c.jsx(Tn.span,{...i,ref:t,"data-state":nP(s.checked)})})});HK.displayName=tP;var Ave="MenuSeparator",WK=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return c.jsx(Tn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});WK.displayName=Ave;var Rve="MenuArrow",VK=_.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=pk(n);return c.jsx(uk,{...i,...r,ref:t})});VK.displayName=Rve;var Mve="MenuSub",[h9e,KK]=kp(Mve),Zb="MenuSubTrigger",GK=_.forwardRef((e,t)=>{const n=Ep(Zb,e.__scopeMenu),r=v_(Zb,e.__scopeMenu),i=KK(Zb,e.__scopeMenu),s=JI(Zb,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=s,u={__scopeMenu:e.__scopeMenu},f=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>f,[f]),_.useEffect(()=>{const p=a.current;return()=>{window.clearTimeout(p),l(null)}},[a,l]),c.jsx(XI,{asChild:!0,...u,children:c.jsx(LK,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":XK(n.open),...e,ref:CI(t,i.onTriggerChange),onClick:p=>{var m;(m=e.onClick)==null||m.call(e,p),!(e.disabled||p.defaultPrevented)&&(p.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:it(e.onPointerMove,Zy(p=>{s.onItemEnter(p),!p.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:it(e.onPointerLeave,Zy(p=>{var g,b;f();const m=(g=n.content)==null?void 0:g.getBoundingClientRect();if(m){const y=(b=n.content)==null?void 0:b.dataset.side,x=y==="right",w=x?-5:5,k=m[x?"left":"right"],C=m[x?"right":"left"];s.onPointerGraceIntentChange({area:[{x:p.clientX+w,y:p.clientY},{x:k,y:m.top},{x:C,y:m.top},{x:C,y:m.bottom},{x:k,y:m.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(p),p.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:it(e.onKeyDown,p=>{var g;const m=s.searchRef.current!=="";e.disabled||m&&p.key===" "||dve[r.dir].includes(p.key)&&(n.onOpenChange(!0),(g=n.content)==null||g.focus(),p.preventDefault())})})})});GK.displayName=Zb;var qK="MenuSubContent",YK=_.forwardRef((e,t)=>{const n=jK(ka,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Ep(ka,e.__scopeMenu),o=v_(ka,e.__scopeMenu),a=KK(qK,e.__scopeMenu),l=_.useRef(null),u=Qn(t,l);return c.jsx(Jy.Provider,{scope:e.__scopeMenu,children:c.jsx(La,{present:r||s.open,children:c.jsx(Jy.Slot,{scope:e.__scopeMenu,children:c.jsx(ZI,{id:a.contentId,"aria-labelledby":a.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{var p;o.isUsingKeyboardRef.current&&((p=l.current)==null||p.focus()),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:it(e.onFocusOutside,f=>{f.target!==a.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:it(e.onEscapeKeyDown,f=>{o.onClose(),f.preventDefault()}),onKeyDown:it(e.onKeyDown,f=>{var g;const p=f.currentTarget.contains(f.target),m=fve[o.dir].includes(f.key);p&&m&&(s.onOpenChange(!1),(g=a.trigger)==null||g.focus(),f.preventDefault())})})})})})});YK.displayName=qK;function XK(e){return e?"open":"closed"}function OC(e){return e==="indeterminate"}function nP(e){return OC(e)?"indeterminate":e?"checked":"unchecked"}function jve(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Ove(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Ive(e,t,n){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=Ove(e,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==n));const l=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Pve(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;s<t.length;o=s++){const a=t[s],l=t[o],u=a.x,f=a.y,p=l.x,m=l.y;f>r!=m>r&&n<(p-u)*(r-f)/(m-f)+u&&(i=!i)}return i}function Lve(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Pve(n,t)}function Zy(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Dve=MK,$ve=XI,zve=OK,Fve=IK,Bve=eP,Uve=PK,Hve=mk,Wve=DK,Vve=zK,Kve=BK,Gve=HK,qve=WK,Yve=VK,Xve=GK,Qve=YK,rP="ContextMenu",[Jve]=Pu(rP,[AK]),Xs=AK(),[Zve,QK]=Jve(rP),JK=e=>{const{__scopeContextMenu:t,children:n,onOpenChange:r,dir:i,modal:s=!0}=e,[o,a]=_.useState(!1),l=Xs(t),u=ul(r),f=_.useCallback(p=>{a(p),u(p)},[u]);return c.jsx(Zve,{scope:t,open:o,onOpenChange:f,modal:s,children:c.jsx(Dve,{...l,dir:i,open:o,onOpenChange:f,modal:s,children:n})})};JK.displayName=rP;var ZK="ContextMenuTrigger",eG=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,disabled:r=!1,...i}=e,s=QK(ZK,n),o=Xs(n),a=_.useRef({x:0,y:0}),l=_.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...a.current})}),u=_.useRef(0),f=_.useCallback(()=>window.clearTimeout(u.current),[]),p=m=>{a.current={x:m.clientX,y:m.clientY},s.onOpenChange(!0)};return _.useEffect(()=>f,[f]),_.useEffect(()=>void(r&&f()),[r,f]),c.jsxs(c.Fragment,{children:[c.jsx($ve,{...o,virtualRef:l}),c.jsx(Tn.span,{"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,...i,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:r?e.onContextMenu:it(e.onContextMenu,m=>{f(),p(m),m.preventDefault()}),onPointerDown:r?e.onPointerDown:it(e.onPointerDown,xS(m=>{f(),u.current=window.setTimeout(()=>p(m),700)})),onPointerMove:r?e.onPointerMove:it(e.onPointerMove,xS(f)),onPointerCancel:r?e.onPointerCancel:it(e.onPointerCancel,xS(f)),onPointerUp:r?e.onPointerUp:it(e.onPointerUp,xS(f))})]})});eG.displayName=ZK;var ebe="ContextMenuPortal",tG=e=>{const{__scopeContextMenu:t,...n}=e,r=Xs(t);return c.jsx(zve,{...r,...n})};tG.displayName=ebe;var nG="ContextMenuContent",rG=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=QK(nG,n),s=Xs(n),o=_.useRef(!1);return c.jsx(Fve,{...s,...r,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:a=>{var l;(l=e.onCloseAutoFocus)==null||l.call(e,a),!a.defaultPrevented&&o.current&&a.preventDefault(),o.current=!1},onInteractOutside:a=>{var l;(l=e.onInteractOutside)==null||l.call(e,a),!a.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});rG.displayName=nG;var tbe="ContextMenuGroup",nbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Bve,{...i,...r,ref:t})});nbe.displayName=tbe;var rbe="ContextMenuLabel",ibe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Uve,{...i,...r,ref:t})});ibe.displayName=rbe;var sbe="ContextMenuItem",iG=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Hve,{...i,...r,ref:t})});iG.displayName=sbe;var obe="ContextMenuCheckboxItem",abe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Wve,{...i,...r,ref:t})});abe.displayName=obe;var lbe="ContextMenuRadioGroup",cbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Vve,{...i,...r,ref:t})});cbe.displayName=lbe;var ube="ContextMenuRadioItem",dbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Kve,{...i,...r,ref:t})});dbe.displayName=ube;var fbe="ContextMenuItemIndicator",hbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Gve,{...i,...r,ref:t})});hbe.displayName=fbe;var pbe="ContextMenuSeparator",sG=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(qve,{...i,...r,ref:t})});sG.displayName=pbe;var mbe="ContextMenuArrow",gbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Yve,{...i,...r,ref:t})});gbe.displayName=mbe;var vbe="ContextMenuSubTrigger",bbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Xve,{...i,...r,ref:t})});bbe.displayName=vbe;var ybe="ContextMenuSubContent",xbe=_.forwardRef((e,t)=>{const{__scopeContextMenu:n,...r}=e,i=Xs(n);return c.jsx(Qve,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});xbe.displayName=ybe;function xS(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var _be=JK,Sbe=eG,wbe=tG,oG=rG,aG=iG,lG=sG;const cG=_.createContext(null);function Np({onOpenChange:e,...t}){const[n,r]=_.useState(0),i=_.useCallback(()=>{r(s=>s+1),e==null||e(!1)},[e]);return c.jsx(cG.Provider,{value:i,children:c.jsx(_be,{onOpenChange:e,...t},n)})}const Tp=Sbe,Ef=_.forwardRef(({className:e,...t},n)=>c.jsx(wbe,{children:c.jsx(oG,{ref:n,className:pe("z-50 min-w-[170px] overflow-hidden rounded-xl border border-border bg-background p-1 shadow-lg outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...t})}));Ef.displayName=oG.displayName;const Er=_.forwardRef(({className:e,onSelect:t,...n},r)=>{const i=_.useContext(cG);return c.jsx(aG,{ref:r,className:pe("relative flex cursor-default select-none items-center gap-2.5 rounded-lg px-3 py-2 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-muted focus:bg-muted data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),onSelect:s=>{t==null||t(s),i==null||i()},...n})});Er.displayName=aG.displayName;const uG=_.forwardRef(({className:e,...t},n)=>c.jsx(lG,{ref:n,className:pe("-mx-1 my-1 h-px bg-border",e),...t}));uG.displayName=lG.displayName;var gk="Popover",[dG]=Pu(gk,[kf]),b_=kf(),[Cbe,Nf]=dG(gk),fG=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=e,a=b_(t),l=_.useRef(null),[u,f]=_.useState(!1),[p,m]=Fg({prop:r,defaultProp:i??!1,onChange:s,caller:gk});return c.jsx(lk,{...a,children:c.jsx(Cbe,{scope:t,contentId:pu(),triggerRef:l,open:p,onOpenChange:m,onOpenToggle:_.useCallback(()=>m(g=>!g),[m]),hasCustomAnchor:u,onCustomAnchorAdd:_.useCallback(()=>f(!0),[]),onCustomAnchorRemove:_.useCallback(()=>f(!1),[]),modal:o,children:n})})};fG.displayName=gk;var hG="PopoverAnchor",kbe=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Nf(hG,n),s=b_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return _.useEffect(()=>(o(),()=>a()),[o,a]),c.jsx(d_,{...s,...r,ref:t})});kbe.displayName=hG;var pG="PopoverTrigger",mG=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Nf(pG,n),s=b_(n),o=Qn(t,i.triggerRef),a=c.jsx(Tn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":xG(i.open),...r,ref:o,onClick:it(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:c.jsx(d_,{asChild:!0,...s,children:a})});mG.displayName=pG;var iP="PopoverPortal",[Ebe,Nbe]=dG(iP,{forceMount:void 0}),gG=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=Nf(iP,t);return c.jsx(Ebe,{scope:t,forceMount:n,children:c.jsx(La,{present:n||s.open,children:c.jsx(bv,{asChild:!0,container:i,children:r})})})};gG.displayName=iP;var Hg="PopoverContent",vG=_.forwardRef((e,t)=>{const n=Nbe(Hg,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=Nf(Hg,e.__scopePopover);return c.jsx(La,{present:r||s.open,children:s.modal?c.jsx(Abe,{...i,ref:t}):c.jsx(Rbe,{...i,ref:t})})});vG.displayName=Hg;var Tbe=tp("PopoverContent.RemoveScroll"),Abe=_.forwardRef((e,t)=>{const n=Nf(Hg,e.__scopePopover),r=_.useRef(null),i=Qn(t,r),s=_.useRef(!1);return _.useEffect(()=>{const o=r.current;if(o)return tk(o)},[]),c.jsx(c_,{as:Tbe,allowPinchZoom:!0,children:c.jsx(bG,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:it(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:it(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,u=a.button===2||l;s.current=u},{checkForDefaultPrevented:!1}),onFocusOutside:it(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Rbe=_.forwardRef((e,t)=>{const n=Nf(Hg,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return c.jsx(bG,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),bG=_.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,...p}=e,m=Nf(Hg,n),g=b_(n);return Z1(),c.jsx(l_,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:c.jsx(vv,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:f,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>m.onOpenChange(!1),children:c.jsx(ck,{"data-state":xG(m.open),role:"dialog",id:m.contentId,...g,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),yG="PopoverClose",Mbe=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Nf(yG,n);return c.jsx(Tn.button,{type:"button",...r,ref:t,onClick:it(e.onClick,()=>i.onOpenChange(!1))})});Mbe.displayName=yG;var jbe="PopoverArrow",Obe=_.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=b_(n);return c.jsx(uk,{...i,...r,ref:t})});Obe.displayName=jbe;function xG(e){return e?"open":"closed"}var Ibe=fG,Pbe=mG,Lbe=gG,_G=vG;const Tf=Ibe,Af=Pbe,Du=_.forwardRef(({className:e,align:t="center",sideOffset:n=4,ports:r={},...i},s)=>{const o=r.dom??Et;return c.jsx(Lbe,{children:c.jsx(_G,{ref:s,align:t,sideOffset:n,[kC]:"",onCloseAutoFocus:a=>{var l;a.preventDefault(),o.dispatchCustomWindowEvent(RI),(l=i.onCloseAutoFocus)==null||l.call(i,a)},className:pe("z-50 w-72 rounded-xl border border-border bg-background p-4 shadow-lg outline-hidden animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...i})})});Du.displayName=_G.displayName;const AR=en("StackActionsPopover",()=>e=>({open:!1,setOpen:t=>e({open:t})}));function Dbe({editorLabel:e,starred:t,onCopyPath:n,onShowArchived:r,onOpenInFinder:i,onOpenInEditor:s,onToggleStar:o,onHide:a,children:l}){return c.jsxs(Np,{children:[c.jsx(Tp,{asChild:!0,children:l}),c.jsxs(Ef,{children:[c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),o()},children:[t?c.jsx(Fde,{className:"h-3.5 w-3.5"}):c.jsx(I9,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:t?"Unstar project":"Star project"})]}),c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),n()},children:[c.jsx(cl,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Copy Path"})]}),c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),r()},children:[c.jsx(dI,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Show Archived"})]}),c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),i()},children:[c.jsx(X1,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Show in Finder"})]}),c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),s()},children:[c.jsx(fI,{className:"h-3.5 w-3.5"}),c.jsxs("span",{className:"text-xs font-medium",children:["Open in ",e]})]}),c.jsxs(Er,{onSelect:u=>{u.stopPropagation(),a()},className:"text-destructive hover:bg-destructive/10 focus:bg-destructive/10",children:[c.jsx(Ice,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Hide"})]})]})]})}function $be({canFork:e,onRename:t,onOpenInFinder:n,onFork:r,onArchive:i,onDelete:s,onEditPermissions:o,children:a}){return c.jsxs(Np,{children:[c.jsx(Tp,{asChild:!0,children:a}),c.jsxs(Ef,{children:[c.jsxs(Er,{onSelect:l=>{l.preventDefault(),t()},children:[c.jsx(wf,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),c.jsxs(Er,{onSelect:l=>{l.preventDefault(),n()},children:[c.jsx(X1,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Open in Finder"})]}),c.jsxs(Er,{disabled:!e,onSelect:l=>{l.preventDefault(),e&&r()},children:[c.jsx(O9,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Fork"})]}),o?c.jsxs(Er,{onSelect:l=>{l.preventDefault(),o()},children:[c.jsx(bI,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Permissions…"})]}):null,c.jsxs(Er,{onSelect:l=>{l.preventDefault(),i()},children:[c.jsx(dI,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Archive"})]}),c.jsxs(Er,{onSelect:l=>{l.preventDefault(),s()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[c.jsx(Iu,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Delete"})]})]})]})}function zbe({stackTitle:e,onRename:t,onEditMembers:n,onDelete:r,children:i}){const s=AR.useScopedStore(l=>l.open),o=AR.useScopedStore(l=>l.setOpen);function a(l){return()=>{o(!1),l()}}return c.jsxs(Tf,{open:s,onOpenChange:o,children:[c.jsx(Af,{asChild:!0,children:i}),c.jsxs(Du,{align:"end",sideOffset:4,className:"w-44 p-1",role:"menu","aria-label":`Actions for ${e}`,children:[c.jsxs("button",{type:"button",role:"menuitem",onClick:a(t),className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs font-medium hover:bg-muted focus-visible:bg-muted outline-hidden",children:[c.jsx(wf,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Rename"})]}),c.jsxs("button",{type:"button",role:"menuitem",onClick:a(n),className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs font-medium hover:bg-muted focus-visible:bg-muted outline-hidden",children:[c.jsx(L9,{className:"h-3.5 w-3.5"}),c.jsx("span",{children:"Edit members"})]}),c.jsxs("button",{type:"button",role:"menuitem",onClick:a(r),className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs font-medium text-destructive dark:text-red-400 hover:bg-destructive/10 focus-visible:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus-visible:bg-red-500/20 outline-hidden",children:[c.jsx(Iu,{className:"h-3.5 w-3.5"}),c.jsxs("span",{children:["Delete ",e]})]})]})]})}function Fbe({stackTitle:e,onRename:t,onEditMembers:n,onDelete:r,children:i}){return c.jsx(AR.Provider,{init:{},children:c.jsx(zbe,{stackTitle:e,onRename:t,onEditMembers:n,onDelete:r,children:i})})}function Bbe({stackTitle:e,onRename:t,onEditMembers:n,onDelete:r,children:i}){return c.jsxs(Np,{children:[c.jsx(Tp,{asChild:!0,children:i}),c.jsxs(Ef,{children:[c.jsxs(Er,{onSelect:s=>{s.preventDefault(),t()},children:[c.jsx(wf,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Rename"})]}),c.jsxs(Er,{onSelect:s=>{s.preventDefault(),n()},children:[c.jsx(L9,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"text-xs font-medium",children:"Edit members"})]}),c.jsxs(Er,{onSelect:s=>{s.preventDefault(),r()},className:"text-destructive dark:text-red-400 hover:bg-destructive/10 focus:bg-destructive/10 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",children:[c.jsx(Iu,{className:"h-3.5 w-3.5"}),c.jsxs("span",{className:"text-xs font-medium",children:["Delete ",e]})]})]})]})}function Ube(e){return e.status==="running"||e.status==="starting"?"warning":e.status==="waiting_for_user"?"info":e.status==="failed"?"destructive":e.unread?"success":null}function Hbe(e){switch(e){case"warning":return"bg-warning";case"info":return"bg-info";case"success":return"bg-success";case"destructive":return"bg-destructive";default:return""}}function Wbe(e){switch(e){case"warning":return"text-warning";case"info":return"text-info";case"success":return"text-success";case"destructive":return"text-destructive";default:return"text-muted-foreground"}}function Vbe(e){switch(e){case"active":return{glyph:"●",tone:"text-success",title:"Claude PTY session active"};case"warming":return{glyph:"◐",tone:"text-warning",title:"Claude PTY session warming"};case"idle":return{glyph:"○",tone:"text-muted-foreground",title:"Claude PTY session idle"};case"cooling":return{glyph:"◌",tone:"text-muted-foreground",title:"Claude PTY session cooling down"};case"cold":default:return null}}function Kbe({chat:e,activeChatId:t,nowMs:n,shortcutHint:r=null,showShortcutHint:i=!1,onSelectChat:s,onRenameChat:o,onOpenInFinder:a,onForkChat:l,onArchiveChat:u,onDeleteChat:f,onEditPermissions:p}){const m=(e.status==="running"||e.status==="waiting_for_user")&&e.stateEnteredAt!=null,g=m&&e.stateEnteredAt!=null?`${ER(e.status)} ${kR(n-e.stateEnteredAt)}`:ba(n-(e.lastMessageAt??e._creationTime)),b=i&&r?r:g,y=i&&!!r,x=Qfe(e.chatId),w=t===x,k=Ube(e);let C;e.canFork?C="w-12":m?C="w-12 md:w-20":C="w-6 md:w-14";let E=null;b&&(y?E=c.jsx("span",{className:"hidden md:flex absolute inset-0 items-center justify-end pr-0.5 text-[11px] text-foreground transition-opacity duration-150 group-hover:opacity-0",children:c.jsx(pK,{className:"h-4 min-w-4 rounded-sm border-border/50 bg-transparent px-1 text-[10px]",children:r})}):E=c.jsx("span",{className:pe("hidden md:flex absolute inset-0 items-center justify-end pr-1 text-[11px] tabular-nums transition-opacity duration-150 group-hover:opacity-0 whitespace-nowrap",m?Wbe(k):"text-muted-foreground"),children:b}));const A=c.jsxs("div",{"data-chat-id":x,className:pe("group flex items-center gap-2 pl-2 pr-1 py-1.5 rounded-md cursor-pointer transition-colors duration-150",w?"bg-muted":"hover:bg-muted/40"),onClick:()=>s(e.chatId),children:[c.jsx("span",{className:"relative flex h-3.5 w-3.5 shrink-0 items-center justify-center","aria-hidden":!0,children:k?c.jsx("span",{className:pe("h-2 w-2 rounded-full",Hbe(k))}):null}),(()=>{const N=Vbe(e.sessionState);return N?c.jsx(oc,{label:N.title,children:c.jsx("span",{className:pe("shrink-0 text-[10px] leading-none",N.tone),"aria-label":N.title,children:N.glyph})}):null})(),e.hasPolicyOverride?c.jsx(bI,{className:"size-3 shrink-0 text-warning","aria-label":"Per-chat permission override active"}):null,c.jsx("span",{className:pe("truncate flex-1 text-sm",w?"text-foreground font-medium":"text-foreground/90",e.status==="idle"&&!e.unread&&!w?"text-muted-foreground":""),children:e.title}),c.jsxs("div",{className:pe("relative h-6 shrink-0",C),children:[E,c.jsxs("div",{className:pe("absolute inset-0 flex items-center justify-end gap-0 transition-opacity duration-150",b?"opacity-100 md:opacity-0 md:group-hover:opacity-100":"opacity-100"),children:[e.canFork?c.jsx(je,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:N=>{N.stopPropagation(),l(e.chatId)},title:"Fork chat",children:c.jsx(O9,{className:"size-3.5"})}):null,c.jsx(je,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer rounded-sm hover:!bg-transparent !border-0",onClick:N=>{N.stopPropagation(),u(e.chatId)},title:"Archive chat",children:c.jsx(dI,{className:"size-3.5"})})]})]})]},e._id);return c.jsx($be,{canFork:e.canFork,onRename:()=>o(e.chatId),onOpenInFinder:()=>a(e.localPath),onFork:()=>l(e.chatId),onArchive:()=>u(e.chatId),onDelete:()=>f(e.chatId),onEditPermissions:p?()=>p(e.chatId):void 0,children:A})}const Gbe=_.memo(Kbe);function qbe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return _.useMemo(()=>r=>{t.forEach(i=>i(r))},t)}const vk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Sv(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function sP(e){return"nodeType"in e}function Co(e){var t,n;return e?Sv(e)?e:sP(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function oP(e){const{Document:t}=Co(e);return e instanceof t}function y_(e){return Sv(e)?!1:e instanceof Co(e).HTMLElement}function SG(e){return e instanceof Co(e).SVGElement}function wv(e){return e?Sv(e)?e.document:sP(e)?oP(e)?e:y_(e)||SG(e)?e.ownerDocument:document:document:document}const ac=vk?_.useLayoutEffect:_.useEffect;function aP(e){const t=_.useRef(e);return ac(()=>{t.current=e}),_.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return t.current==null?void 0:t.current(...r)},[])}function Ybe(){const e=_.useRef(null),t=_.useCallback((r,i)=>{e.current=setInterval(r,i)},[]),n=_.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ex(e,t){t===void 0&&(t=[e]);const n=_.useRef(e);return ac(()=>{n.current!==e&&(n.current=e)},t),n}function x_(e,t){const n=_.useRef();return _.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function IC(e){const t=aP(e),n=_.useRef(null),r=_.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function RR(e){const t=_.useRef();return _.useEffect(()=>{t.current=e},[e]),t.current}let ZT={};function __(e,t){return _.useMemo(()=>{if(t)return t;const n=ZT[e]==null?0:ZT[e]+1;return ZT[e]=n,e+"-"+n},[e,t])}function wG(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.reduce((s,o)=>{const a=Object.entries(o);for(const[l,u]of a){const f=s[l];f!=null&&(s[l]=f+e*u)}return s},{...t})}}const lg=wG(1),PC=wG(-1);function Xbe(e){return"clientX"in e&&"clientY"in e}function lP(e){if(!e)return!1;const{KeyboardEvent:t}=Co(e.target);return t&&e instanceof t}function Qbe(e){if(!e)return!1;const{TouchEvent:t}=Co(e.target);return t&&e instanceof t}function MR(e){if(Qbe(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Xbe(e)?{x:e.clientX,y:e.clientY}:null}const tx=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[tx.Translate.toString(e),tx.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),hF="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Jbe(e){return e.matches(hF)?e:e.querySelector(hF)}const Zbe={display:"none"};function eye(e){let{id:t,value:n}=e;return Wn.createElement("div",{id:t,style:Zbe},n)}function tye(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Wn.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function nye(){const[e,t]=_.useState("");return{announce:_.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const CG=_.createContext(null);function rye(e){const t=_.useContext(CG);_.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function iye(){const[e]=_.useState(()=>new Set),t=_.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[_.useCallback(r=>{let{type:i,event:s}=r;e.forEach(o=>{var a;return(a=o[i])==null?void 0:a.call(o,s)})},[e]),t]}const sye={draggable:`
|
|
772
772
|
To pick up a draggable item, press the space bar.
|
|
773
773
|
While dragging, use the arrow keys to move the item.
|
|
774
774
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
@@ -2686,7 +2686,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[Fk(e),e])),ONe=new Map([["s",ki(383)],[ki(38
|
|
|
2686
2686
|
`);let n=!1,r=!1;const i=[];for(const s of t){if(xPe.test(s)){n=!n,i.push(s);continue}if(n){i.push(s);continue}const o=kPe(s);o!==s&&(r=!0),i.push(o)}return r?i.join(`
|
|
2687
2687
|
`):e}function kPe(e){if(!e.includes("#")||!e.includes("http"))return e;const t=[],n=new RegExp(_Pe.source,"g");let r;for(;(r=n.exec(e))!==null;){let u=r[0];const f=u.match(wPe);f&&(u=u.slice(0,-f[0].length)),t.push({start:r.index,end:r.index+u.length,url:u})}if(t.length===0)return e;const i=[],s=new RegExp(SPe.source,"gi");for(;(r=s.exec(e))!==null;){const u=e.slice(0,r.index);u.lastIndexOf("[")>u.lastIndexOf("]")||i.push({start:r.index,end:r.index+r[0].length,full:r[0],num:r[2]??""})}if(i.length===0)return e;const o=new Map;for(const u of i){const f=t.find(m=>{try{const{pathname:g,search:b}=new URL(m.url),y=g+b;return new RegExp(`(?:/|\\.|-|=)${u.num}(?:[/?&#]|$)`).test(y)}catch{return!1}});if(f){o.set(u.start,f.url);continue}const p=t.find(m=>m.start>u.end);if(p){const m=e.slice(u.end,p.start);!/[.!?]\s/.test(m)&&m.length<200&&o.set(u.start,p.url)}}if(o.size===0)return e;const a=i.filter(u=>o.has(u.start)).sort((u,f)=>f.start-u.start);let l=e;for(const u of a){const f=o.get(u.start);l=`${l.slice(0,u.start)}[${u.full}](${f})${l.slice(u.end)}`}return l}function Ij(e){const t=e.trim(),n=t.startsWith("|")?t.slice(1):t;return(n.endsWith("|")?n.slice(0,-1):n).split("|").map(i=>i.trim())}function EPe(e){const t=Ij(e);return t.length>0&&t.every(n=>/^:?-+:?$/.test(n.trim())&&n.trim().length>=1)}const NPe={type:"multiline-element",dependencies:[ju,zp,uc],regExpStart:/^\|?[^|]*\|.*$/,regExpEnd:{optional:!0,regExp:/^\x00$/},handleImportAfterStartMatch({lines:e,rootNode:t,startLineIndex:n}){const r=e[n];if(r===void 0)return null;const i=e[n+1];if(i===void 0||!EPe(i))return null;const s=Ij(r),o=s.length,a=[];let l=n+1;for(let p=n+2;p<e.length;p++){const m=e[p];if(m===void 0||!m.trim().includes("|")&&m.trim()!==""||m.trim()==="")break;a.push(Ij(m)),l=p}const u=W_(),f=bf();for(let p=0;p<o;p++){const m=xo(In.ROW),g=Ft(),b=s[p]??"";g.append(Yn(b)),m.append(g),f.append(m)}u.append(f);for(const p of a){const m=bf();for(let g=0;g<o;g++){const b=xo(In.NO_STATUS),y=Ft(),x=p[g]??"";y.append(Yn(x)),b.append(y),m.append(b)}u.append(m)}return t.append(u),[!0,l]},replace(e,t,n,r,i,s){return!1},export(e,t){if(!_r(e))return null;const n=e.getChildren();if(n.length===0)return null;const r=[];return n.forEach((i,s)=>{if(!vr(i))return;const o=i.getChildren(),a=o.map(l=>_t(l)?t(l).trim():"");r.push(`| ${a.join(" | ")} |`),s===0&&r.push(`| ${o.map(()=>"---").join(" | ")} |`)}),r.join(`
|
|
2688
2688
|
`)}},Fee=[NPe,sIe,...Tee];function TPe(e,t){var n,r,i,s,o,a,l,u,f,p,m,g,b;return{...e,...t,terminal:{...e.terminal,...t.terminal},editor:{...e.editor,...t.editor},providerDefaults:{claude:{...e.providerDefaults.claude,...(n=t.providerDefaults)==null?void 0:n.claude,modelOptions:{...e.providerDefaults.claude.modelOptions,...(i=(r=t.providerDefaults)==null?void 0:r.claude)==null?void 0:i.modelOptions}},codex:{...e.providerDefaults.codex,...(s=t.providerDefaults)==null?void 0:s.codex,modelOptions:{...e.providerDefaults.codex.modelOptions,...(a=(o=t.providerDefaults)==null?void 0:o.codex)==null?void 0:a.modelOptions}},openrouter:{...e.providerDefaults.openrouter,...(l=t.providerDefaults)==null?void 0:l.openrouter,modelOptions:{}}},cloudflareTunnel:{...e.cloudflareTunnel,...t.cloudflareTunnel},claudeAuth:{tokens:((u=t.claudeAuth)==null?void 0:u.tokens)??e.claudeAuth.tokens,concurrencyDefault:((f=t.claudeAuth)==null?void 0:f.concurrencyDefault)??e.claudeAuth.concurrencyDefault},auth:{...e.auth,...t.auth},uploads:{...e.uploads,...t.uploads},subagents:e.subagents,customMcpServers:e.customMcpServers,customModels:e.customModels,textSnippets:e.textSnippets,claudeDriver:{preference:((p=t.claudeDriver)==null?void 0:p.preference)??e.claudeDriver.preference,lifecycle:{...e.claudeDriver.lifecycle,...(m=t.claudeDriver)==null?void 0:m.lifecycle}},globalPromptAppend:t.globalPromptAppend??e.globalPromptAppend,subagentRuntime:{runTimeoutMs:((g=t.subagentRuntime)==null?void 0:g.runTimeoutMs)??e.subagentRuntime.runTimeoutMs,defaultLoopSubagentId:((b=t.subagentRuntime)==null?void 0:b.defaultLoopSubagentId)!==void 0?t.subagentRuntime.defaultLoopSubagentId:e.subagentRuntime.defaultLoopSubagentId}}}const Hr=tr()(e=>({settings:null,hydrationStatus:"idle",setHydrationStatus:t=>e({hydrationStatus:t}),setFromServer:t=>e({settings:t,hydrationStatus:"ready"}),applyOptimisticPatch:t=>e(n=>({settings:n.settings?TPe(n.settings,t):n.settings}))})),APe=[],RPe=e=>{var t;return((t=e.settings)==null?void 0:t.customMcpServers)??APe},MPe=[],V_=e=>{var t;return((t=e.settings)==null?void 0:t.customModels)??MPe},jPe=[],Bee=e=>{var t;return((t=e.settings)==null?void 0:t.textSnippets)??jPe},Uee=_.createContext(void 0),OPe=e=>e==="light"||e==="dark"||e==="system";function IPe(e){return e==="dark"?"black-translucent":"default"}function VU(e,t,n){n.upsertHeadMeta(e,t)}function KU(e,t=Et){const n=t.getComputedBackgroundColor();n&&VU("theme-color",n,t),VU("apple-mobile-web-app-status-bar-style",IPe(e),t),t.setDocumentElementColorScheme(e)}const aC=(e=Et)=>e.matchesMediaQuery("(prefers-color-scheme: dark)")?"dark":"light",GU=(e,t=Et)=>{const n=e==="system"?aC(t):e;t.toggleDocumentElementClass("dark",n==="dark")},PPe=()=>{var t;const e=(t=Hr.getState().settings)==null?void 0:t.theme;return e&&OPe(e)?e:"system"};function LPe({children:e,dom:t=Et}){const n=Hr(a=>{var l;return(l=a.settings)==null?void 0:l.theme}),r=Hr(a=>a.applyOptimisticPatch),[i,s]=_.useState(PPe);_.useEffect(()=>{!n||n===i||s(n)},[n,i]),_.useEffect(()=>{GU(i,t)},[i,t]),_.useEffect(()=>{const a=i==="system"?aC(t):i;KU(a,t)},[i,t]),_.useEffect(()=>{if(i==="system")return t.addMediaQueryListener("(prefers-color-scheme: dark)",()=>{GU("system",t),KU(aC(t),t)})},[i,t]);const o=_.useMemo(()=>{const a=i==="system"?aC(t):i;return{theme:i,resolvedTheme:a,setTheme:l=>{s(l),r({theme:l})}}},[r,i,t]);return c.jsx(Uee.Provider,{value:o,children:e})}function bE(){const e=_.useContext(Uee);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const Pj=en("HighlightedCode",()=>e=>({highlighted:null,setHighlighted:t=>e({highlighted:t})})),DPe=200*1024,$Pe={ts:"typescript",typescript:"typescript",tsx:"tsx",js:"javascript",javascript:"javascript",jsx:"jsx",py:"python",python:"python",go:"go",golang:"go",rs:"rust",rust:"rust",java:"java",rb:"ruby",ruby:"ruby",sh:"bash",bash:"bash",zsh:"bash",shell:"bash",yml:"yaml",yaml:"yaml",css:"css",scss:"scss",html:"html",xml:"xml",json:"json",json5:"json5",md:"markdown",markdown:"markdown",sql:"sql",cpp:"cpp","c++":"cpp",c:"c",h:"c",swift:"swift",kt:"kotlin",kotlin:"kotlin",php:"php",toml:"toml",dockerfile:"dockerfile",diff:"diff",patch:"diff",vue:"vue",svelte:"svelte"};function zPe(e){return $Pe[e.toLowerCase()]??null}const FPe=/^<pre[^>]*>/,BPe=/<\/pre>\s*$/,UPe=/^<code[^>]*>/,HPe=/<\/code>\s*$/;function WPe(e){return e.replace(FPe,"").replace(BPe,"").replace(UPe,"").replace(HPe,"")}function VPe({source:e,lang:t}){const{resolvedTheme:n}=bE(),r=n==="dark"?"github-dark":"github-light",i=zPe(t),s=i!==null&&e.length<=DPe,o=Pj.useScopedStore(f=>f.highlighted),a=Pj.useScopedStore(f=>f.setHighlighted);_.useEffect(()=>{if(!s||i===null)return;let f=!1;return Z(()=>Promise.resolve().then(()=>QX),void 0).then(async p=>{if(f)return;const m=await p.codeToHtml(e,{lang:i,theme:r});f||a({source:e,theme:r,lang:i,html:WPe(m)})}).catch(()=>{vo.warn("[transcript] Shiki unavailable; falling back to plain code")}),()=>{f=!0}},[s,e,i,r,a]);const l=i??t.toLowerCase();return o!==null&&o.source===e&&o.theme===r&&o.lang===i?c.jsx("code",{className:`block text-xs whitespace-pre language-${l} shiki-highlighted`,dangerouslySetInnerHTML:{__html:o.html}}):c.jsx("code",{className:`block text-xs whitespace-pre language-${l}`,children:e})}function ay({source:e,lang:t}){return c.jsx(Pj.Provider,{init:void 0,children:c.jsx(VPe,{source:e,lang:t})})}const Lj=en("MessageCodeBlock",()=>e=>({copied:!1,setCopied:t=>e({copied:t})}));function KPe({source:e,lang:t,ports:n={}}){const r=Lj.useScopedStore(l=>l.copied),i=Lj.useScopedStore(l=>l.setCopied),s=n.clipboard??yl,o=n.timer??wr,a=_.useCallback(async()=>{await s.writeText(e),i(!0),o.setTimeout(()=>i(!1),2e3)},[e,i,s,o]);return c.jsxs("div",{className:"relative overflow-x-auto max-w-full min-w-0 no-code-highlight group/pre",children:[c.jsx("pre",{className:"min-w-0 rounded-xl py-2.5 px-3.5",children:t?c.jsx(ay,{source:e,lang:t}):c.jsx("code",{className:"block text-xs whitespace-pre",children:e})}),c.jsx(je,{variant:"ghost",size:"icon","aria-label":r?"Copied":"Copy code",className:pe("absolute top-[35px] -translate-y-[50%] -translate-x-[1px] rounded-md right-1.5 h-11 w-11 md:h-8 md:w-8 text-muted-foreground opacity-100 md:opacity-0 md:group-hover/pre:opacity-100 transition-opacity [@media(hover:none)]:!opacity-100",!r&&"hover:text-foreground",r&&"hover:!bg-transparent hover:!border-transparent"),onClick:a,children:r?c.jsx(qs,{className:"h-4 w-4 text-success"}):c.jsx(cl,{className:"h-4 w-4"})})]})}function Hee({source:e,lang:t,ports:n}){return c.jsx(Lj.Provider,{init:void 0,children:c.jsx(KPe,{source:e,lang:t,ports:n})})}const GPe=[$v,Dv,Wu,gc,Lv,H_,Of,pE,ju,zp,uc];let Wee=0;function Di(){return String(Wee++)}function Vee(e){if(aD(e)){const n=e.getTag(),r=bd(e),i={h1:"text-[20px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",h2:"text-[18px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",h3:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",h4:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",h5:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",h6:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0"},s=i[n]??i.h1,o=Di();switch(n){case"h1":return c.jsx("h1",{className:s,children:r},o);case"h2":return c.jsx("h2",{className:s,children:r},o);case"h3":return c.jsx("h3",{className:s,children:r},o);case"h4":return c.jsx("h4",{className:s,children:r},o);case"h5":return c.jsx("h5",{className:s,children:r},o);default:return c.jsx("h6",{className:s,children:r},o)}}if(Ux(e))return c.jsx("blockquote",{className:"my-2 mt-5 mb-3 first:mt-0 last:mb-0 border-l-2 border-border/80 pl-2 text-muted-foreground",children:bd(e)},Di());if(Da(e))return c.jsx("p",{className:"break-words mt-5 mb-3 first:mt-0 last:mb-0",children:bd(e)},Di());if(U_(e)){const n=e.getLanguage()??"",r=e.getChildren().map(i=>Ie(i)||ov(i)?i.getTextContent():gi(i)?`
|
|
2689
|
-
`:"").join("");return c.jsx(Hee,{source:r,lang:n},Di())}if(Ot(e)){const n=e.getListType(),r=bd(e),i=Di();return n==="number"?c.jsx("ol",{className:"list-decimal ml-5 my-2",children:r},i):c.jsx("ul",{className:"list-disc ml-5 my-2",children:r},i)}if(Nn(e)){const n=e.getChecked(),r=bd(e),i=Di();return n!==void 0?c.jsxs("li",{className:"my-0.5 list-none flex items-start gap-1.5",children:[c.jsx("input",{type:"checkbox",readOnly:!0,checked:n,className:"mt-[3px] shrink-0"}),c.jsx("span",{children:r})]},i):c.jsx("li",{className:"my-0.5",children:r},i)}if(ho(e)||Dd(e)){const n=e.getURL();return c.jsx("a",{href:n,className:"transition-all underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40",target:"_blank",rel:"noopener noreferrer",children:bd(e)},Di())}if(_r(e)){const n=e.getChildren(),r=n[0],i=r!==void 0&&vr(r)&&r.getChildren().every(a=>_t(a)&&(a.getHeaderStyles()&In.ROW)!==0),s=i?r:void 0,o=i?n.slice(1):n;return c.jsx("div",{className:"border border-border rounded-xl overflow-x-auto",children:c.jsxs("table",{className:"table-auto min-w-full divide-y divide-border bg-background",children:[s!==void 0&&c.jsx("thead",{children:c.jsx("tr",{children:s.getChildren().map(a=>c.jsx("th",{className:"text-left text-xs uppercase text-muted-foreground tracking-wider p-2 pl-0 first:pl-3 bg-muted dark:bg-card [&_*]:font-semibold",children:bd(a)},Di()))})}),c.jsx("tbody",{className:"divide-y divide-border",children:o.map(a=>vr(a)?c.jsx("tr",{children:a.getChildren().map(l=>_t(l)?c.jsx("td",{className:"text-left p-2 pl-0 first:pl-3 [&_*]:font-normal",children:bd(l)},Di()):null)},Di()):null)})]})},Di())}if(gi(e))return c.jsx("br",{},Di());if(Ie(e))return qPe(e);if(ov(e))return c.jsx("code",{className:"break-all px-1 bg-border/60 py-0.5 rounded text-sm",children:e.getTextContent()},Di());const t=e.getTextContent();return t?c.jsx("span",{children:t},Di()):null}function qPe(e){const t=e.getFormat(),n=e.getTextContent(),r=(t&Ex)!==0,i=(t&Nx)!==0,s=(t&Tx)!==0,o=(t&hL)!==0;let a=n;return o?c.jsx("code",{className:"break-all px-1 bg-border/60 py-0.5 rounded text-sm",children:n},Di()):(s&&(a=c.jsx("del",{className:"line-through",children:a},Di())),i&&(a=c.jsx("em",{className:"italic",children:a},Di())),r&&(a=c.jsx("strong",{className:"font-semibold",children:a},Di())),!r&&!i&&!s?n:a)}function bd(e){return e.getChildren().map(Vee)}function YPe(){Wee=0;const t=Fn().getChildren();return c.jsx(c.Fragment,{children:t.map(Vee)})}function yf(e,t=Fee){const n=tZ(cD({namespace:"kanna-md-renderer",nodes:GPe,editable:!1}));return n.update(()=>{Aee(e,t,void 0,!0)},{discrete:!0}),n.getEditorState().read(()=>YPe())}const Dj=en("ThinkingBlock",()=>e=>({expanded:!1,setExpanded:t=>e({expanded:t})}));function XPe({content:e}){const t=Dj.useScopedStore(i=>i.expanded),n=Dj.useScopedStore(i=>i.setExpanded),r=e.trim();return r.length===0?null:c.jsxs("div",{className:"my-3 first:mt-0 last:mb-0",children:[c.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,className:"group/thinking flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[c.jsx(Rw,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"font-medium uppercase tracking-wider",children:"Thinking"}),c.jsx(Ta,{className:pe("h-3.5 w-3.5 transition-transform duration-200",t&&"rotate-90")})]}),t&&c.jsx("div",{className:"mt-2 border-l-2 border-muted-foreground/20 pl-3 text-sm text-muted-foreground italic prose prose-sm dark:prose-invert max-w-[70ch]",children:yf(r)})]})}const yE=_.memo(({content:e})=>c.jsx(Dj.Provider,{init:void 0,children:c.jsx(XPe,{content:e})}));class Wx extends Bu{constructor(n,r,i,s,o=Et){super(s);H(this,"__mentionKind");H(this,"__value");H(this,"__label");H(this,"__dom");this.__mentionKind=n,this.__value=r,this.__label=i,this.__dom=o}static getType(){return"kanna-mention"}static clone(n){return new Wx(n.__mentionKind,n.__value,n.__label,n.__key,n.__dom)}static importJSON(n){return $j({mentionKind:n.mentionKind,value:n.value,label:n.label})}exportJSON(){return{type:Wx.getType(),version:1,mentionKind:this.__mentionKind,value:this.__value,label:this.__label}}createDOM(n,r){const i=this.__dom.createElement("span");return i.dataset.lexicalDecorator="true",i}updateDOM(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}getTextContent(){return this.__mentionKind==="agent"?`@agent/${this.__value}`:`@${this.__value}`}decorate(n,r){const i=this.__label;return this.__mentionKind==="agent"?c.jsx("span",{className:pe("inline-flex items-center rounded px-1 text-sm","bg-primary/10 text-primary border border-primary/20"),children:i}):c.jsx("span",{className:pe("inline-flex items-center rounded px-1 text-sm","bg-muted text-muted-foreground border border-border"),children:i})}}function $j(e){return vi(new Wx(e.mentionKind,e.value,e.label))}class Vx extends Bu{constructor(n,r,i,s=Et){super(i);H(this,"__commandName");H(this,"__hasArgument");H(this,"__dom");this.__commandName=n,this.__hasArgument=r,this.__dom=s}static getType(){return"kanna-slash-command"}static clone(n){return new Vx(n.__commandName,n.__hasArgument,n.__key,n.__dom)}static importJSON(n){return Kee({commandName:n.commandName,hasArgument:n.hasArgument})}exportJSON(){return{type:Vx.getType(),version:1,commandName:this.__commandName,hasArgument:this.__hasArgument}}createDOM(n,r){const i=this.__dom.createElement("span");return i.dataset.lexicalDecorator="true",i}updateDOM(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}getTextContent(){return this.__hasArgument?`/${this.__commandName} `:`/${this.__commandName}`}decorate(n,r){return c.jsx("span",{className:pe("inline-flex items-center rounded px-1 text-sm font-mono","bg-muted text-muted-foreground border border-border"),children:`/${this.__commandName}`})}}function Kee(e){return vi(new Vx(e.commandName,e.hasArgument))}class cv extends Bu{constructor(n,r,i=Et){super(r);H(this,"__attachment");H(this,"__dom");this.__attachment=n,this.__dom=i}static getType(){return"kanna-attachment"}static clone(n){return new cv(n.__attachment,n.__key,n.__dom)}static importJSON(n){return uD(n.attachment)}getAttachment(){return this.getLatest().__attachment}isInline(){return!0}isKeyboardSelectable(){return!0}getTextContent(){return""}createDOM(n,r){return this.__dom.createElement("span")}updateDOM(){return!1}exportJSON(){return{type:cv.getType(),version:1,attachment:this.__attachment}}decorate(n,r){const i=this.getLatest().__attachment;return i.kind==="image"&&i.contentUrl?c.jsx(Wk,{attachment:i,size:"composer"}):c.jsx(qo,{attachment:i})}}function uD(e){return vi(new cv(e))}function QPe(){return nMe(cv)}const fh=en("MermaidZoomModal",()=>e=>({scale:1,offset:{x:0,y:0},drag:null,setScale:t=>e({scale:t}),setOffset:t=>e({offset:t}),setDrag:t=>e({drag:t})}));function JPe({svg:e,onClose:t,ports:n}){const r=(n==null?void 0:n.dom)??Et,i=fh.useScopedStore(b=>b.scale),s=fh.useScopedStore(b=>b.offset),o=fh.useScopedStore(b=>b.drag),a=fh.useScopedStore(b=>b.setScale),l=fh.useScopedStore(b=>b.setOffset),u=fh.useScopedStore(b=>b.setDrag);_.useEffect(()=>{const b=y=>{y.key==="Escape"&&t()};return r.addWindowListener("keydown",b)},[t,r]);const f=b=>Math.min(8,Math.max(.25,b)),p=b=>{u({x:b.clientX-s.x,y:b.clientY-s.y})},m=b=>{o&&l({x:b.clientX-o.x,y:b.clientY-o.y})},g=()=>u(null);return Ks.createPortal(c.jsxs("div",{className:"fixed inset-0 z-[100] flex flex-col bg-background/95",role:"dialog","aria-modal":"true","aria-label":"Diagram zoom view",children:[c.jsxs("div",{className:"flex justify-end gap-1 p-2",children:[c.jsx(je,{variant:"ghost",size:"icon","aria-label":"Zoom out",className:"h-9 w-9",onClick:()=>a(f(i-.25)),children:c.jsx(M9,{className:"h-4 w-4"})}),c.jsx(je,{variant:"ghost",size:"icon","aria-label":"Zoom in",className:"h-9 w-9",onClick:()=>a(f(i+.25)),children:c.jsx(_o,{className:"h-4 w-4"})}),c.jsx(je,{variant:"ghost",size:"icon","aria-label":"Reset view",className:"h-9 w-9",onClick:()=>{a(1),l({x:0,y:0})},children:c.jsx(fde,{className:"h-4 w-4"})}),c.jsx(je,{variant:"ghost",size:"icon","aria-label":"Close",className:"h-9 w-9",onClick:t,children:c.jsx(Zo,{className:"h-4 w-4"})})]}),c.jsx("div",{className:"flex-1 overflow-hidden touch-none cursor-grab active:cursor-grabbing",onPointerDown:p,onPointerMove:m,onPointerUp:g,onPointerLeave:g,children:c.jsx("div",{"data-mermaid-stage":!0,className:"w-full h-full flex items-center justify-center",style:{transform:`translate(${s.x}px, ${s.y}px) scale(${i})`},dangerouslySetInnerHTML:{__html:e}})})]}),r.getBodyElement())}function ZPe({svg:e,onClose:t,ports:n}){return c.jsx(fh.Provider,{init:void 0,children:c.jsx(JPe,{svg:e,onClose:t,ports:n})})}const qc=en("MermaidDiagram",()=>e=>({renderState:{status:"loading"},showSource:!1,zoomOpen:!1,copied:!1,setRenderState:t=>e({renderState:t}),setShowSource:t=>e({showSource:t}),setZoomOpen:t=>e({zoomOpen:t}),setCopied:t=>e({copied:t})}));let hA=null;function eLe(){return hA||(hA=Z(()=>import("./mermaid.core-D-uxsiw3.js").then(e=>e.bm),[]).then(e=>e.default)),hA}function tLe({source:e,ports:t}){const{resolvedTheme:n}=bE(),r=n==="dark"?"dark":"default",i=qc.useScopedStore(w=>w.renderState),s=i.status==="error"?i.message:void 0,o=qc.useScopedStore(w=>w.showSource),a=qc.useScopedStore(w=>w.zoomOpen),l=qc.useScopedStore(w=>w.copied),u=qc.useScopedStore(w=>w.setRenderState),f=qc.useScopedStore(w=>w.setShowSource),p=qc.useScopedStore(w=>w.setZoomOpen),m=qc.useScopedStore(w=>w.setCopied),b=`mermaid-${_.useId().replace(/[^a-zA-Z0-9_-]/g,"")}`,y=_.useCallback(()=>p(!1),[p]),x=async()=>{await((t==null?void 0:t.clipboard)??yl).writeText(e),m(!0),((t==null?void 0:t.timer)??wr).setTimeout(()=>m(!1),2e3)};return _.useEffect(()=>{let w=!1;return eLe().then(async k=>{k.initialize({startOnLoad:!1,securityLevel:"strict",theme:r});const{svg:C}=await k.render(b,e);w||u({status:"ready",svg:C})}).catch(k=>{const C=lAe(k).message;w||u({status:"error",message:C})}),()=>{w=!0}},[e,r,b,u]),i.status==="error"?c.jsxs("div",{className:"my-3",children:[c.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-destructive mb-1",children:[c.jsx(ep,{className:"size-3.5 shrink-0 mt-px"}),c.jsxs("span",{children:["Couldn't render this Mermaid diagram",s?c.jsxs("span",{className:"text-muted-foreground",children:[" — ",s]}):null]})]}),c.jsx(V2,{source:e})]}):i.status==="loading"?c.jsx("div",{className:"relative group/mermaid",children:c.jsx(V2,{source:e})}):o?c.jsxs("div",{className:"relative group/mermaid",children:[c.jsx(V2,{source:e}),c.jsx(qU,{showSource:o,onToggleSource:()=>f(!o),onCopy:x,copied:l,onZoom:void 0})]}):c.jsxs("div",{className:"relative group/mermaid my-3",children:[c.jsx("div",{className:"flex justify-center overflow-x-auto",dangerouslySetInnerHTML:{__html:i.svg}}),c.jsx(qU,{showSource:o,onToggleSource:()=>f(!o),onCopy:x,copied:l,onZoom:()=>p(!0)}),a&&c.jsx(ZPe,{svg:i.svg,onClose:y})]})}function Gee({source:e,ports:t}){return c.jsx(qc.Provider,{init:void 0,children:c.jsx(tLe,{source:e,ports:t})})}function qU({showSource:e,onToggleSource:t,onCopy:n,copied:r,onZoom:i}){return c.jsxs("div",{className:"absolute top-1.5 right-1.5 flex gap-1 opacity-100 md:opacity-0 md:group-hover/mermaid:opacity-100 transition-opacity [@media(hover:none)]:!opacity-100",children:[i&&!e&&c.jsx(je,{variant:"ghost",size:"icon","aria-label":"Zoom diagram",className:"h-8 w-8 rounded-md text-muted-foreground hover:text-foreground",onClick:i,children:c.jsx(Due,{className:"h-4 w-4"})}),c.jsx(je,{variant:"ghost",size:"icon","aria-label":e?"View rendered diagram":"View diagram source",className:"h-8 w-8 rounded-md text-muted-foreground hover:text-foreground",onClick:t,children:c.jsx(hR,{className:"h-4 w-4"})}),c.jsx(je,{variant:"ghost",size:"icon","aria-label":r?"Copied":"Copy diagram source",className:pe("h-8 w-8 rounded-md text-muted-foreground",!r&&"hover:text-foreground",r&&"hover:!bg-transparent"),onClick:n,children:r?c.jsx(qs,{className:"h-4 w-4 text-success"}):c.jsx(cl,{className:"h-4 w-4"})})]})}class xf extends Bu{constructor(n,r,i=Et){super(r);H(this,"__source");H(this,"__dom");this.__source=n,this.__dom=i}static getType(){return"kanna-mermaid"}static clone(n){return new xf(n.__source,n.__key,n.__dom)}static importJSON(n){return qee(n.source)}exportJSON(){return{type:xf.getType(),version:1,source:this.__source}}createDOM(n,r){return this.__dom.createElement("div")}updateDOM(){return!1}isInline(){return!1}getTextContent(){return this.__source}decorate(n,r){return c.jsx(Gee,{source:this.__source})}}function qee(e){return vi(new xf(e))}function nLe(e){return e instanceof xf}function rLe(e,t=28){if(e.length<=t)return e;const n="…",r=e.lastIndexOf("."),i=r>0&&e.length-r<=6,s=i?e.slice(r):"",o=i?e.slice(0,r):e,a=t-n.length-s.length;if(a<=2){const f=t-n.length,p=Math.ceil(f/2),m=Math.floor(f/2);return`${e.slice(0,p)}${n}${e.slice(e.length-m)}`}const l=Math.ceil(a/2),u=a-l;return`${o.slice(0,l)}${n}${o.slice(o.length-u)}${s}`}const iLe=new Set([".c",".cc",".cfg",".conf",".cpp",".cs",".css",".diff",".env",".go",".graphql",".h",".hpp",".html",".ini",".java",".js",".json",".jsonc",".jsx",".kt",".log",".lua",".md",".mjs",".patch",".php",".pl",".properties",".py",".rb",".rs",".scss",".sh",".sql",".swift",".toml",".ts",".tsx",".txt",".vue",".xml",".yaml",".yml",".zsh"]),sLe=new Set([".gitignore",".npmrc",".prettierrc",".python-version",".ruby-version",".tool-versions","Dockerfile","Gemfile","Makefile","Procfile"]);function lw(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function YU(e){var r,i;const t=/^(?<path>\/.+?)#L(?<line>\d+)(?:C(?<column>\d+))?$/.exec(e);if((r=t==null?void 0:t.groups)!=null&&r.path)return{path:t.groups.path,line:lw(t.groups.line),column:lw(t.groups.column)};const n=/^(?<path>\/.+?):(?<line>\d+)(?::(?<column>\d+))?$/.exec(e);return(i=n==null?void 0:n.groups)!=null&&i.path?{path:n.groups.path,line:lw(n.groups.line),column:lw(n.groups.column)}:e.startsWith("/")?{path:e}:null}function oLe(e,t=Et){if(!e)return null;const n=e.trim();if(!n||/^(mailto:|ftp:|file:)/i.test(n))return null;if(/^https?:/i.test(n))try{const r=new URL(n);return r.origin!==t.getOrigin()||!r.pathname.startsWith("/")?null:YU(`${r.pathname}${r.hash}`)}catch{return null}return YU(n)}function aLe(e){const t=e.split(/[\\/]/);for(;t.length>0&&t[t.length-1]==="";)t.pop();const n=t.length>0?t[t.length-1]:e;if(sLe.has(n))return!0;const r=n.lastIndexOf(".");if(r<0)return!0;const i=n.slice(r).toLowerCase();return iLe.has(i)}const lLe=["/Users/","/home/","/private/","/tmp/","/var/","/opt/","/root/"];function cLe(e){return e?e.startsWith("file://")?!0:lLe.some(t=>e.startsWith(t)):!1}function Yee(e){let t=e;if(t.startsWith("file://"))try{t=decodeURIComponent(new URL(t).pathname)}catch{t=t.slice(7)}return`/api/local-file?path=${encodeURIComponent(t)}`}function ef(e,t){if(!e)return"";if(t){const n=t.endsWith("/")?t:`${t}/`;if(e.startsWith(n))return e.slice(n.length);if(e===t)return""}return e.replace(/^\/home\/user\/workspace\//,"")}function zv(e,t){return{id:e.id,contentUrl:e.contentUrl,displayName:e.displayName,fileName:e.displayName,relativePath:e.relativePath,mimeType:e.mimeType,size:e.size,origin:t}}const ly=en("LocalFileLinkCard",()=>e=>({probe:{kind:"loading"},previewOpen:!1,setProbe:t=>e({probe:t}),setPreviewOpen:t=>e({previewOpen:t})}));function uLe(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function dLe({path:e,linkText:t}){const n=_.useMemo(()=>Yee(e),[e]),r=ly.useScopedStore(N=>N.probe),i=ly.useScopedStore(N=>N.previewOpen),s=ly.useScopedStore(N=>N.setProbe),o=ly.useScopedStore(N=>N.setPreviewOpen);_.useEffect(()=>{const N=new AbortController;return uL(n,{signal:N.signal}).then(M=>{N.signal.aborted||s(M)}),()=>N.abort()},[n,s]);const a=uLe(e),l=t||a,u=rLe(l,28),f=r.kind==="ready"?r.mimeType:"application/octet-stream",p=r.kind==="ready"?r.size:0,m={id:`local-file-${n}`,kind:"file",displayName:u,absolutePath:e,relativePath:e,contentUrl:n,mimeType:f,size:p};if(r.kind==="missing")return c.jsx("span",{className:"inline-flex align-bottom","data-testid":"local-file-link",children:c.jsx(qo,{attachment:m,disabledReason:"File no longer available"})});const g=Op(m),b=T_(g,f),y=p>0?Ip(p):null,x=r.kind==="loading",w=r.kind==="error";let k;x?k=c.jsx("span",{className:"text-muted-foreground",children:"Fetching…"}):w?k=c.jsx("span",{className:"text-muted-foreground",children:"Unable to load"}):k=c.jsxs(c.Fragment,{children:[b,y?c.jsxs(c.Fragment,{children:[" · ",c.jsx("span",{className:"tabular-nums",children:y})]}):null]});const C=r.kind==="ready"?Mv(m):null,E=C!==null&&!C.openInNewTab,A=[E?"Preview":"Download",l,b,y].filter(N=>!!N);return E?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"inline-flex align-bottom","data-testid":"local-file-link",children:c.jsx(qo,{attachment:m,onClick:()=>o(!0),meta:k,ariaLabel:A.join(", ")})}),c.jsx(Fp,{source:i?zv(m,"local_file_link"):null,open:i,onOpenChange:o})]}):c.jsx("span",{className:"inline-flex align-bottom","data-testid":"local-file-link",children:c.jsx(qo,{attachment:m,href:n,download:a,meta:k,ariaLabel:A.join(", ")})})}function fLe({path:e,linkText:t}){return c.jsx(ly.Provider,{init:void 0,children:c.jsx(dLe,{path:e,linkText:t})})}class _f extends Bu{constructor(n,r,i,s,o=Et){super(s);H(this,"__path");H(this,"__line");H(this,"__column");H(this,"__dom");this.__path=n,this.__line=r,this.__column=i,this.__dom=o}static getType(){return"kanna-local-file-link"}static clone(n){return new _f(n.__path,n.__line,n.__column,n.__key,n.__dom)}static importJSON(n){return Xee({path:n.path,line:n.line,column:n.column})}exportJSON(){const n={type:_f.getType(),version:1,path:this.__path};return this.__line!==void 0&&(n.line=this.__line),this.__column!==void 0&&(n.column=this.__column),n}createDOM(n,r){return this.__dom.createElement("span")}updateDOM(){return!1}isInline(){return!0}getTextContent(){return this.__path}decorate(n,r){const i=this.__line!==void 0?`${this.__path}:${this.__line}${this.__column!==void 0?`:${this.__column}`:""}`:void 0;return c.jsx(fLe,{path:this.__path,linkText:i})}}function Xee(e){return vi(new _f(e.path,e.line,e.column))}function hLe(e){return e instanceof _f}class Kx extends Bu{constructor(n,r,i=Et){super(r);H(this,"__content");H(this,"__dom");this.__content=n,this.__dom=i}static getType(){return"kanna-thinking"}static clone(n){return new Kx(n.__content,n.__key,n.__dom)}static importJSON(n){return pLe(n.content)}exportJSON(){return{type:Kx.getType(),version:1,content:this.__content}}createDOM(n,r){return this.__dom.createElement("div")}updateDOM(){return!1}isInline(){return!1}getTextContent(){return this.__content}decorate(n,r){return c.jsx(yE,{content:this.__content})}}function pLe(e){return vi(new Kx(e))}const mLe=[Wx,Vx,cv],gLe=[xf,_f,Kx],vLe=/^[ \t]*(`{3,})[ \t]*mermaid[ \t]*$/i,XU=/^[ \t]*`{3,}[ \t]*$/,bLe={type:"multiline-element",dependencies:[xf],regExpStart:vLe,regExpEnd:{optional:!0,regExp:XU},handleImportAfterStartMatch({lines:e,rootNode:t,startLineIndex:n,startMatch:r}){const s=(r[1]??"```").length,o=new RegExp(`^[ \\t]\`{${s},}[ \\t]*$`),a=[];let l=n;for(let p=n+1;p<e.length;p++){const m=e[p];if(m===void 0)break;if(XU.test(m)||o.test(m)){l=p;break}a.push(m),l=p}const u=a.join(`
|
|
2689
|
+
`:"").join("");return c.jsx(Hee,{source:r,lang:n},Di())}if(Ot(e)){const n=e.getListType(),r=bd(e),i=Di();return n==="number"?c.jsx("ol",{className:"list-decimal ml-5 my-2",children:r},i):c.jsx("ul",{className:"list-disc ml-5 my-2",children:r},i)}if(Nn(e)){const n=e.getChecked(),r=bd(e),i=Di();return n!==void 0?c.jsxs("li",{className:"my-0.5 list-none flex items-start gap-1.5",children:[c.jsx("input",{type:"checkbox",readOnly:!0,checked:n,className:"mt-[3px] shrink-0"}),c.jsx("span",{children:r})]},i):c.jsx("li",{className:"my-0.5",children:r},i)}if(ho(e)||Dd(e)){const n=e.getURL();return c.jsx("a",{href:n,className:"transition-all underline decoration-2 text-logo decoration-logo/50 hover:text-logo/70 dark:text-logo dark:decoration-logo/70 dark:hover:text-logo/60 dark:hover:decoration-logo/40",target:"_blank",rel:"noopener noreferrer",children:bd(e)},Di())}if(_r(e)){const n=e.getChildren(),r=n[0],i=r!==void 0&&vr(r)&&r.getChildren().every(a=>_t(a)&&(a.getHeaderStyles()&In.ROW)!==0),s=i?r:void 0,o=i?n.slice(1):n;return c.jsx("div",{className:"border border-border rounded-xl overflow-x-auto",children:c.jsxs("table",{className:"table-auto min-w-full divide-y divide-border bg-background",children:[s!==void 0&&c.jsx("thead",{children:c.jsx("tr",{children:s.getChildren().map(a=>c.jsx("th",{className:"text-left text-xs uppercase text-muted-foreground tracking-wider p-2 pl-0 first:pl-3 bg-muted dark:bg-card [&_*]:font-semibold",children:bd(a)},Di()))})}),c.jsx("tbody",{className:"divide-y divide-border",children:o.map(a=>vr(a)?c.jsx("tr",{children:a.getChildren().map(l=>_t(l)?c.jsx("td",{className:"text-left p-2 pl-0 first:pl-3 [&_*]:font-normal",children:bd(l)},Di()):null)},Di()):null)})]})},Di())}if(gi(e))return c.jsx("br",{},Di());if(Ie(e))return qPe(e);if(ov(e))return c.jsx("code",{className:"break-all px-1 bg-border/60 py-0.5 rounded text-sm",children:e.getTextContent()},Di());const t=e.getTextContent();return t?c.jsx("span",{children:t},Di()):null}function qPe(e){const t=e.getFormat(),n=e.getTextContent(),r=(t&Ex)!==0,i=(t&Nx)!==0,s=(t&Tx)!==0,o=(t&hL)!==0;let a=n;return o?c.jsx("code",{className:"break-all px-1 bg-border/60 py-0.5 rounded text-sm",children:n},Di()):(s&&(a=c.jsx("del",{className:"line-through",children:a},Di())),i&&(a=c.jsx("em",{className:"italic",children:a},Di())),r&&(a=c.jsx("strong",{className:"font-semibold",children:a},Di())),!r&&!i&&!s?n:a)}function bd(e){return e.getChildren().map(Vee)}function YPe(){Wee=0;const t=Fn().getChildren();return c.jsx(c.Fragment,{children:t.map(Vee)})}function yf(e,t=Fee){const n=tZ(cD({namespace:"kanna-md-renderer",nodes:GPe,editable:!1}));return n.update(()=>{Aee(e,t,void 0,!0)},{discrete:!0}),n.getEditorState().read(()=>YPe())}const Dj=en("ThinkingBlock",()=>e=>({expanded:!1,setExpanded:t=>e({expanded:t})}));function XPe({content:e}){const t=Dj.useScopedStore(i=>i.expanded),n=Dj.useScopedStore(i=>i.setExpanded),r=e.trim();return r.length===0?null:c.jsxs("div",{className:"my-3 first:mt-0 last:mb-0",children:[c.jsxs("button",{type:"button",onClick:()=>n(!t),"aria-expanded":t,className:"group/thinking flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[c.jsx(Rw,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"font-medium uppercase tracking-wider",children:"Thinking"}),c.jsx(Ta,{className:pe("h-3.5 w-3.5 transition-transform duration-200",t&&"rotate-90")})]}),t&&c.jsx("div",{className:"mt-2 border-l-2 border-muted-foreground/20 pl-3 text-sm text-muted-foreground italic prose prose-sm dark:prose-invert max-w-[70ch]",children:yf(r)})]})}const yE=_.memo(({content:e})=>c.jsx(Dj.Provider,{init:void 0,children:c.jsx(XPe,{content:e})}));class Wx extends Bu{constructor(n,r,i,s,o=Et){super(s);H(this,"__mentionKind");H(this,"__value");H(this,"__label");H(this,"__dom");this.__mentionKind=n,this.__value=r,this.__label=i,this.__dom=o}static getType(){return"kanna-mention"}static clone(n){return new Wx(n.__mentionKind,n.__value,n.__label,n.__key,n.__dom)}static importJSON(n){return $j({mentionKind:n.mentionKind,value:n.value,label:n.label})}exportJSON(){return{type:Wx.getType(),version:1,mentionKind:this.__mentionKind,value:this.__value,label:this.__label}}createDOM(n,r){const i=this.__dom.createElement("span");return i.dataset.lexicalDecorator="true",i}updateDOM(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}getTextContent(){return this.__mentionKind==="agent"?`@agent/${this.__value}`:`@${this.__value}`}decorate(n,r){const i=this.__label;return this.__mentionKind==="agent"?c.jsx("span",{className:pe("inline-flex items-center rounded px-1 text-sm","bg-primary/10 text-primary border border-primary/20"),children:i}):c.jsx("span",{className:pe("inline-flex items-center rounded px-1 text-sm","bg-muted text-muted-foreground border border-border"),children:i})}}function $j(e){return vi(new Wx(e.mentionKind,e.value,e.label))}class Vx extends Bu{constructor(n,r,i,s=Et){super(i);H(this,"__commandName");H(this,"__hasArgument");H(this,"__dom");this.__commandName=n,this.__hasArgument=r,this.__dom=s}static getType(){return"kanna-slash-command"}static clone(n){return new Vx(n.__commandName,n.__hasArgument,n.__key,n.__dom)}static importJSON(n){return Kee({commandName:n.commandName,hasArgument:n.hasArgument})}exportJSON(){return{type:Vx.getType(),version:1,commandName:this.__commandName,hasArgument:this.__hasArgument}}createDOM(n,r){const i=this.__dom.createElement("span");return i.dataset.lexicalDecorator="true",i}updateDOM(){return!1}isInline(){return!0}isKeyboardSelectable(){return!0}getTextContent(){return this.__hasArgument?`/${this.__commandName} `:`/${this.__commandName}`}decorate(n,r){return c.jsx("span",{className:pe("inline-flex items-center rounded px-1 text-sm font-mono","bg-muted text-muted-foreground border border-border"),children:`/${this.__commandName}`})}}function Kee(e){return vi(new Vx(e.commandName,e.hasArgument))}class cv extends Bu{constructor(n,r,i=Et){super(r);H(this,"__attachment");H(this,"__dom");this.__attachment=n,this.__dom=i}static getType(){return"kanna-attachment"}static clone(n){return new cv(n.__attachment,n.__key,n.__dom)}static importJSON(n){return uD(n.attachment)}getAttachment(){return this.getLatest().__attachment}isInline(){return!0}isKeyboardSelectable(){return!0}getTextContent(){return""}createDOM(n,r){return this.__dom.createElement("span")}updateDOM(){return!1}exportJSON(){return{type:cv.getType(),version:1,attachment:this.__attachment}}decorate(n,r){const i=this.getLatest().__attachment;return i.kind==="image"&&i.contentUrl?c.jsx(Wk,{attachment:i,size:"composer"}):c.jsx(qo,{attachment:i})}}function uD(e){return vi(new cv(e))}function QPe(){return nMe(cv)}const fh=en("MermaidZoomModal",()=>e=>({scale:1,offset:{x:0,y:0},drag:null,setScale:t=>e({scale:t}),setOffset:t=>e({offset:t}),setDrag:t=>e({drag:t})}));function JPe({svg:e,onClose:t,ports:n}){const r=(n==null?void 0:n.dom)??Et,i=fh.useScopedStore(b=>b.scale),s=fh.useScopedStore(b=>b.offset),o=fh.useScopedStore(b=>b.drag),a=fh.useScopedStore(b=>b.setScale),l=fh.useScopedStore(b=>b.setOffset),u=fh.useScopedStore(b=>b.setDrag);_.useEffect(()=>{const b=y=>{y.key==="Escape"&&t()};return r.addWindowListener("keydown",b)},[t,r]);const f=b=>Math.min(8,Math.max(.25,b)),p=b=>{u({x:b.clientX-s.x,y:b.clientY-s.y})},m=b=>{o&&l({x:b.clientX-o.x,y:b.clientY-o.y})},g=()=>u(null);return Ks.createPortal(c.jsxs("div",{className:"fixed inset-0 z-[100] flex flex-col bg-background/95",role:"dialog","aria-modal":"true","aria-label":"Diagram zoom view",children:[c.jsxs("div",{className:"flex justify-end gap-1 p-2",children:[c.jsx(je,{variant:"ghost",size:"icon","aria-label":"Zoom out",className:"h-9 w-9",onClick:()=>a(f(i-.25)),children:c.jsx(M9,{className:"h-4 w-4"})}),c.jsx(je,{variant:"ghost",size:"icon","aria-label":"Zoom in",className:"h-9 w-9",onClick:()=>a(f(i+.25)),children:c.jsx(_o,{className:"h-4 w-4"})}),c.jsx(je,{variant:"ghost",size:"icon","aria-label":"Reset view",className:"h-9 w-9",onClick:()=>{a(1),l({x:0,y:0})},children:c.jsx(fde,{className:"h-4 w-4"})}),c.jsx(je,{variant:"ghost",size:"icon","aria-label":"Close",className:"h-9 w-9",onClick:t,children:c.jsx(Zo,{className:"h-4 w-4"})})]}),c.jsx("div",{className:"flex-1 overflow-hidden touch-none cursor-grab active:cursor-grabbing",onPointerDown:p,onPointerMove:m,onPointerUp:g,onPointerLeave:g,children:c.jsx("div",{"data-mermaid-stage":!0,className:"w-full h-full flex items-center justify-center",style:{transform:`translate(${s.x}px, ${s.y}px) scale(${i})`},dangerouslySetInnerHTML:{__html:e}})})]}),r.getBodyElement())}function ZPe({svg:e,onClose:t,ports:n}){return c.jsx(fh.Provider,{init:void 0,children:c.jsx(JPe,{svg:e,onClose:t,ports:n})})}const qc=en("MermaidDiagram",()=>e=>({renderState:{status:"loading"},showSource:!1,zoomOpen:!1,copied:!1,setRenderState:t=>e({renderState:t}),setShowSource:t=>e({showSource:t}),setZoomOpen:t=>e({zoomOpen:t}),setCopied:t=>e({copied:t})}));let hA=null;function eLe(){return hA||(hA=Z(()=>import("./mermaid.core-B1uSc1Cq.js").then(e=>e.bm),[]).then(e=>e.default)),hA}function tLe({source:e,ports:t}){const{resolvedTheme:n}=bE(),r=n==="dark"?"dark":"default",i=qc.useScopedStore(w=>w.renderState),s=i.status==="error"?i.message:void 0,o=qc.useScopedStore(w=>w.showSource),a=qc.useScopedStore(w=>w.zoomOpen),l=qc.useScopedStore(w=>w.copied),u=qc.useScopedStore(w=>w.setRenderState),f=qc.useScopedStore(w=>w.setShowSource),p=qc.useScopedStore(w=>w.setZoomOpen),m=qc.useScopedStore(w=>w.setCopied),b=`mermaid-${_.useId().replace(/[^a-zA-Z0-9_-]/g,"")}`,y=_.useCallback(()=>p(!1),[p]),x=async()=>{await((t==null?void 0:t.clipboard)??yl).writeText(e),m(!0),((t==null?void 0:t.timer)??wr).setTimeout(()=>m(!1),2e3)};return _.useEffect(()=>{let w=!1;return eLe().then(async k=>{k.initialize({startOnLoad:!1,securityLevel:"strict",theme:r});const{svg:C}=await k.render(b,e);w||u({status:"ready",svg:C})}).catch(k=>{const C=lAe(k).message;w||u({status:"error",message:C})}),()=>{w=!0}},[e,r,b,u]),i.status==="error"?c.jsxs("div",{className:"my-3",children:[c.jsxs("div",{className:"flex items-start gap-1.5 text-xs text-destructive mb-1",children:[c.jsx(ep,{className:"size-3.5 shrink-0 mt-px"}),c.jsxs("span",{children:["Couldn't render this Mermaid diagram",s?c.jsxs("span",{className:"text-muted-foreground",children:[" — ",s]}):null]})]}),c.jsx(V2,{source:e})]}):i.status==="loading"?c.jsx("div",{className:"relative group/mermaid",children:c.jsx(V2,{source:e})}):o?c.jsxs("div",{className:"relative group/mermaid",children:[c.jsx(V2,{source:e}),c.jsx(qU,{showSource:o,onToggleSource:()=>f(!o),onCopy:x,copied:l,onZoom:void 0})]}):c.jsxs("div",{className:"relative group/mermaid my-3",children:[c.jsx("div",{className:"flex justify-center overflow-x-auto",dangerouslySetInnerHTML:{__html:i.svg}}),c.jsx(qU,{showSource:o,onToggleSource:()=>f(!o),onCopy:x,copied:l,onZoom:()=>p(!0)}),a&&c.jsx(ZPe,{svg:i.svg,onClose:y})]})}function Gee({source:e,ports:t}){return c.jsx(qc.Provider,{init:void 0,children:c.jsx(tLe,{source:e,ports:t})})}function qU({showSource:e,onToggleSource:t,onCopy:n,copied:r,onZoom:i}){return c.jsxs("div",{className:"absolute top-1.5 right-1.5 flex gap-1 opacity-100 md:opacity-0 md:group-hover/mermaid:opacity-100 transition-opacity [@media(hover:none)]:!opacity-100",children:[i&&!e&&c.jsx(je,{variant:"ghost",size:"icon","aria-label":"Zoom diagram",className:"h-8 w-8 rounded-md text-muted-foreground hover:text-foreground",onClick:i,children:c.jsx(Due,{className:"h-4 w-4"})}),c.jsx(je,{variant:"ghost",size:"icon","aria-label":e?"View rendered diagram":"View diagram source",className:"h-8 w-8 rounded-md text-muted-foreground hover:text-foreground",onClick:t,children:c.jsx(hR,{className:"h-4 w-4"})}),c.jsx(je,{variant:"ghost",size:"icon","aria-label":r?"Copied":"Copy diagram source",className:pe("h-8 w-8 rounded-md text-muted-foreground",!r&&"hover:text-foreground",r&&"hover:!bg-transparent"),onClick:n,children:r?c.jsx(qs,{className:"h-4 w-4 text-success"}):c.jsx(cl,{className:"h-4 w-4"})})]})}class xf extends Bu{constructor(n,r,i=Et){super(r);H(this,"__source");H(this,"__dom");this.__source=n,this.__dom=i}static getType(){return"kanna-mermaid"}static clone(n){return new xf(n.__source,n.__key,n.__dom)}static importJSON(n){return qee(n.source)}exportJSON(){return{type:xf.getType(),version:1,source:this.__source}}createDOM(n,r){return this.__dom.createElement("div")}updateDOM(){return!1}isInline(){return!1}getTextContent(){return this.__source}decorate(n,r){return c.jsx(Gee,{source:this.__source})}}function qee(e){return vi(new xf(e))}function nLe(e){return e instanceof xf}function rLe(e,t=28){if(e.length<=t)return e;const n="…",r=e.lastIndexOf("."),i=r>0&&e.length-r<=6,s=i?e.slice(r):"",o=i?e.slice(0,r):e,a=t-n.length-s.length;if(a<=2){const f=t-n.length,p=Math.ceil(f/2),m=Math.floor(f/2);return`${e.slice(0,p)}${n}${e.slice(e.length-m)}`}const l=Math.ceil(a/2),u=a-l;return`${o.slice(0,l)}${n}${o.slice(o.length-u)}${s}`}const iLe=new Set([".c",".cc",".cfg",".conf",".cpp",".cs",".css",".diff",".env",".go",".graphql",".h",".hpp",".html",".ini",".java",".js",".json",".jsonc",".jsx",".kt",".log",".lua",".md",".mjs",".patch",".php",".pl",".properties",".py",".rb",".rs",".scss",".sh",".sql",".swift",".toml",".ts",".tsx",".txt",".vue",".xml",".yaml",".yml",".zsh"]),sLe=new Set([".gitignore",".npmrc",".prettierrc",".python-version",".ruby-version",".tool-versions","Dockerfile","Gemfile","Makefile","Procfile"]);function lw(e){if(!e)return;const t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function YU(e){var r,i;const t=/^(?<path>\/.+?)#L(?<line>\d+)(?:C(?<column>\d+))?$/.exec(e);if((r=t==null?void 0:t.groups)!=null&&r.path)return{path:t.groups.path,line:lw(t.groups.line),column:lw(t.groups.column)};const n=/^(?<path>\/.+?):(?<line>\d+)(?::(?<column>\d+))?$/.exec(e);return(i=n==null?void 0:n.groups)!=null&&i.path?{path:n.groups.path,line:lw(n.groups.line),column:lw(n.groups.column)}:e.startsWith("/")?{path:e}:null}function oLe(e,t=Et){if(!e)return null;const n=e.trim();if(!n||/^(mailto:|ftp:|file:)/i.test(n))return null;if(/^https?:/i.test(n))try{const r=new URL(n);return r.origin!==t.getOrigin()||!r.pathname.startsWith("/")?null:YU(`${r.pathname}${r.hash}`)}catch{return null}return YU(n)}function aLe(e){const t=e.split(/[\\/]/);for(;t.length>0&&t[t.length-1]==="";)t.pop();const n=t.length>0?t[t.length-1]:e;if(sLe.has(n))return!0;const r=n.lastIndexOf(".");if(r<0)return!0;const i=n.slice(r).toLowerCase();return iLe.has(i)}const lLe=["/Users/","/home/","/private/","/tmp/","/var/","/opt/","/root/"];function cLe(e){return e?e.startsWith("file://")?!0:lLe.some(t=>e.startsWith(t)):!1}function Yee(e){let t=e;if(t.startsWith("file://"))try{t=decodeURIComponent(new URL(t).pathname)}catch{t=t.slice(7)}return`/api/local-file?path=${encodeURIComponent(t)}`}function ef(e,t){if(!e)return"";if(t){const n=t.endsWith("/")?t:`${t}/`;if(e.startsWith(n))return e.slice(n.length);if(e===t)return""}return e.replace(/^\/home\/user\/workspace\//,"")}function zv(e,t){return{id:e.id,contentUrl:e.contentUrl,displayName:e.displayName,fileName:e.displayName,relativePath:e.relativePath,mimeType:e.mimeType,size:e.size,origin:t}}const ly=en("LocalFileLinkCard",()=>e=>({probe:{kind:"loading"},previewOpen:!1,setProbe:t=>e({probe:t}),setPreviewOpen:t=>e({previewOpen:t})}));function uLe(e){const t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function dLe({path:e,linkText:t}){const n=_.useMemo(()=>Yee(e),[e]),r=ly.useScopedStore(N=>N.probe),i=ly.useScopedStore(N=>N.previewOpen),s=ly.useScopedStore(N=>N.setProbe),o=ly.useScopedStore(N=>N.setPreviewOpen);_.useEffect(()=>{const N=new AbortController;return uL(n,{signal:N.signal}).then(M=>{N.signal.aborted||s(M)}),()=>N.abort()},[n,s]);const a=uLe(e),l=t||a,u=rLe(l,28),f=r.kind==="ready"?r.mimeType:"application/octet-stream",p=r.kind==="ready"?r.size:0,m={id:`local-file-${n}`,kind:"file",displayName:u,absolutePath:e,relativePath:e,contentUrl:n,mimeType:f,size:p};if(r.kind==="missing")return c.jsx("span",{className:"inline-flex align-bottom","data-testid":"local-file-link",children:c.jsx(qo,{attachment:m,disabledReason:"File no longer available"})});const g=Op(m),b=T_(g,f),y=p>0?Ip(p):null,x=r.kind==="loading",w=r.kind==="error";let k;x?k=c.jsx("span",{className:"text-muted-foreground",children:"Fetching…"}):w?k=c.jsx("span",{className:"text-muted-foreground",children:"Unable to load"}):k=c.jsxs(c.Fragment,{children:[b,y?c.jsxs(c.Fragment,{children:[" · ",c.jsx("span",{className:"tabular-nums",children:y})]}):null]});const C=r.kind==="ready"?Mv(m):null,E=C!==null&&!C.openInNewTab,A=[E?"Preview":"Download",l,b,y].filter(N=>!!N);return E?c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"inline-flex align-bottom","data-testid":"local-file-link",children:c.jsx(qo,{attachment:m,onClick:()=>o(!0),meta:k,ariaLabel:A.join(", ")})}),c.jsx(Fp,{source:i?zv(m,"local_file_link"):null,open:i,onOpenChange:o})]}):c.jsx("span",{className:"inline-flex align-bottom","data-testid":"local-file-link",children:c.jsx(qo,{attachment:m,href:n,download:a,meta:k,ariaLabel:A.join(", ")})})}function fLe({path:e,linkText:t}){return c.jsx(ly.Provider,{init:void 0,children:c.jsx(dLe,{path:e,linkText:t})})}class _f extends Bu{constructor(n,r,i,s,o=Et){super(s);H(this,"__path");H(this,"__line");H(this,"__column");H(this,"__dom");this.__path=n,this.__line=r,this.__column=i,this.__dom=o}static getType(){return"kanna-local-file-link"}static clone(n){return new _f(n.__path,n.__line,n.__column,n.__key,n.__dom)}static importJSON(n){return Xee({path:n.path,line:n.line,column:n.column})}exportJSON(){const n={type:_f.getType(),version:1,path:this.__path};return this.__line!==void 0&&(n.line=this.__line),this.__column!==void 0&&(n.column=this.__column),n}createDOM(n,r){return this.__dom.createElement("span")}updateDOM(){return!1}isInline(){return!0}getTextContent(){return this.__path}decorate(n,r){const i=this.__line!==void 0?`${this.__path}:${this.__line}${this.__column!==void 0?`:${this.__column}`:""}`:void 0;return c.jsx(fLe,{path:this.__path,linkText:i})}}function Xee(e){return vi(new _f(e.path,e.line,e.column))}function hLe(e){return e instanceof _f}class Kx extends Bu{constructor(n,r,i=Et){super(r);H(this,"__content");H(this,"__dom");this.__content=n,this.__dom=i}static getType(){return"kanna-thinking"}static clone(n){return new Kx(n.__content,n.__key,n.__dom)}static importJSON(n){return pLe(n.content)}exportJSON(){return{type:Kx.getType(),version:1,content:this.__content}}createDOM(n,r){return this.__dom.createElement("div")}updateDOM(){return!1}isInline(){return!1}getTextContent(){return this.__content}decorate(n,r){return c.jsx(yE,{content:this.__content})}}function pLe(e){return vi(new Kx(e))}const mLe=[Wx,Vx,cv],gLe=[xf,_f,Kx],vLe=/^[ \t]*(`{3,})[ \t]*mermaid[ \t]*$/i,XU=/^[ \t]*`{3,}[ \t]*$/,bLe={type:"multiline-element",dependencies:[xf],regExpStart:vLe,regExpEnd:{optional:!0,regExp:XU},handleImportAfterStartMatch({lines:e,rootNode:t,startLineIndex:n,startMatch:r}){const s=(r[1]??"```").length,o=new RegExp(`^[ \\t]\`{${s},}[ \\t]*$`),a=[];let l=n;for(let p=n+1;p<e.length;p++){const m=e[p];if(m===void 0)break;if(XU.test(m)||o.test(m)){l=p;break}a.push(m),l=p}const u=a.join(`
|
|
2690
2690
|
`),f=qee(u);return t.append(f),[!0,l]},replace(e,t,n,r,i,s){return!1},export(e){return e instanceof xf?`\`\`\`mermaid
|
|
2691
2691
|
${e.getTextContent()}
|
|
2692
2692
|
\`\`\``:null}},Qee="(?:file://|/(?:Users|home|private|tmp|var|opt|root)/)",yLe=new RegExp(`\\[(.+?)\\]\\((${Qee}[^)\\s]*)\\)`),xLe=new RegExp(`\\[([^[\\]]+)\\]\\((${Qee}[^)\\s]*)\\)$`),_Le={type:"text-match",dependencies:[_f],importRegExp:yLe,regExp:xLe,trigger:")",replace(e,t){const n=t[2];if(!n)return;const r=oLe(n);if(!r||!cLe(r.path)&&!n.startsWith("/"))return;const i=Xee({path:r.path,line:r.line,column:r.column});e.replace(i)},export(e){if(!(e instanceof _f))return null;const t=e.getTextContent();return`[${t}](${t})`}},SLe=[bLe,_Le,...Fee],wLe=[$v,Dv,Wu,gc,Lv,H_,Of,pE,ju,zp,uc,...gLe];let Jee=0;function ui(){return String(Jee++)}let Zm=null,eg=null;function Zee(e){if(nLe(e)&&Zm&&eg)return c.jsx("span",{children:e.decorate(Zm,eg)},ui());if(hLe(e)&&Zm&&eg)return c.jsx("span",{children:e.decorate(Zm,eg)},ui());if(aD(e)){const n=e.getTag(),r=yd(e),i={h1:"text-[20px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",h2:"text-[18px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",h3:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",h4:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",h5:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0",h6:"text-[16px] font-normal leading-tight mt-5 mb-3 first:mt-0 last:mb-0"},s=i[n]??i.h1,o=ui();switch(n){case"h1":return c.jsx("h1",{className:s,children:r},o);case"h2":return c.jsx("h2",{className:s,children:r},o);case"h3":return c.jsx("h3",{className:s,children:r},o);case"h4":return c.jsx("h4",{className:s,children:r},o);case"h5":return c.jsx("h5",{className:s,children:r},o);default:return c.jsx("h6",{className:s,children:r},o)}}if(Ux(e))return c.jsx("blockquote",{className:"my-2 mt-5 mb-3 first:mt-0 last:mb-0 border-l-2 border-border/80 pl-2 text-muted-foreground",children:yd(e)},ui());if(Da(e))return c.jsx("p",{className:"break-words mt-5 mb-3 first:mt-0 last:mb-0",children:yd(e)},ui());if(U_(e)){const n=e.getLanguage()??"",r=e.getChildren().map(i=>Ie(i)||ov(i)?i.getTextContent():gi(i)?`
|