@sma1lboy/kobe 0.7.25 → 0.7.26

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.
Files changed (28) hide show
  1. package/README.md +15 -0
  2. package/dist/cli/index.js +2 -1
  3. package/dist/web-ui/assets/AppShell-CQxa6abu.js +7 -0
  4. package/dist/web-ui/assets/{ChatTerminal-DL9kz6iJ.js → ChatTerminal-BMSvAiAB.js} +2 -2
  5. package/dist/web-ui/assets/{ChatTranscript-DL4KGcCP.js → ChatTranscript-BJhX29XX.js} +2 -2
  6. package/dist/web-ui/assets/arrow-left-Cbh2rcaq.js +1 -0
  7. package/dist/web-ui/assets/board-l1dAjN3Y.js +6 -0
  8. package/dist/web-ui/assets/chips-D1mC9nB4.js +2 -0
  9. package/dist/web-ui/assets/index-i463t0Rc.js +10 -0
  10. package/dist/web-ui/assets/overview-DZo39fTv.js +1 -0
  11. package/dist/web-ui/assets/routes-DOqWXZU_.js +1 -0
  12. package/dist/web-ui/assets/tabs-7WK4MwGF.js +1 -0
  13. package/dist/web-ui/assets/task._taskId-DmEKhgY3.js +1 -0
  14. package/dist/web-ui/assets/terminal-BUdn99hL.js +1 -0
  15. package/dist/web-ui/assets/terminal-CapzGZr6.js +1 -0
  16. package/dist/web-ui/index.html +3 -2
  17. package/package.json +1 -1
  18. package/dist/web-ui/assets/AppShell-BUxSw0xG.js +0 -7
  19. package/dist/web-ui/assets/arrow-left-CPDGLwQs.js +0 -1
  20. package/dist/web-ui/assets/board-CbwyUj3Z.js +0 -7
  21. package/dist/web-ui/assets/chips-BYg-ofbe.js +0 -2
  22. package/dist/web-ui/assets/index-DdSnT7Rv.js +0 -10
  23. package/dist/web-ui/assets/overview-BFm-fRcJ.js +0 -1
  24. package/dist/web-ui/assets/react-B8IZ02wI.js +0 -1
  25. package/dist/web-ui/assets/routes-B6JWLjSF.js +0 -1
  26. package/dist/web-ui/assets/task._taskId-CnOx0dEd.js +0 -1
  27. package/dist/web-ui/assets/terminal-D7PGfbSa.js +0 -1
  28. package/dist/web-ui/assets/triage-89UXpkZl.js +0 -1
@@ -1,4 +1,4 @@
1
- import{i as e,t}from"./react-B8IZ02wI.js";import{a as n}from"./index-DdSnT7Rv.js";import{B as r,V as i,d as a,f as o,m as s,p as c,r as l,z as u}from"./chips-BYg-ofbe.js";var d=i(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),f=i(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),p=i(`clipboard-copy`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]]),m=i(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]);async function h(){try{let e=await fetch(`/api/quick-prompts`);if(!e.ok)return{review:null,pr:null};let t=await e.json();return{review:typeof t.review==`string`?t.review:null,pr:typeof t.pr==`string`?t.pr:null}}catch{return{review:null,pr:null}}}async function g(e){let t=await fetch(`/api/quick-prompts`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`save failed (${t.status})`)}var _=e=>`if it passes, run \`kobe api set-status --task-id ${e} --status done\`; otherwise report the problems and leave the status unchanged.`;function v(e){return(e??`claude`)===`claude`?`/review`:`Review the current changes in this worktree critically.`}function y(e,t,n){return`${n?.trim()||v(t)}\nAfter the review: ${_(e)}`}var b=[`Open a pull request for this task's branch:`,`1. Make sure the work is committed, then push the branch to origin.`,"2. Create the PR with `gh pr create` — write a clear title and a body that summarizes what changed and why, following this repo's conventions."].join(`
1
+ import{b as e,v as t}from"./tabs-7WK4MwGF.js";import{S as n,d as r,f as i,p as a,u as o}from"./index-i463t0Rc.js";import{E as s,T as c,i as l,w as u}from"./chips-D1mC9nB4.js";var d=s(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),f=s(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),p=s(`clipboard-copy`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2`,key:`4jdomd`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v4`,key:`3hqy98`}],[`path`,{d:`M21 14H11`,key:`1bme5i`}],[`path`,{d:`m15 10-4 4 4 4`,key:`5dvupr`}]]),m=s(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]);async function h(){try{let e=await fetch(`/api/quick-prompts`);if(!e.ok)return{review:null,pr:null};let t=await e.json();return{review:typeof t.review==`string`?t.review:null,pr:typeof t.pr==`string`?t.pr:null}}catch{return{review:null,pr:null}}}async function g(e){let t=await fetch(`/api/quick-prompts`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(`save failed (${t.status})`)}var _=e=>`if it passes, run \`kobe api set-status --task-id ${e} --status done\`; otherwise report the problems and leave the status unchanged.`;function v(e){return(e??`claude`)===`claude`?`/review`:`Review the current changes in this worktree critically.`}function y(e,t,n){return`${n?.trim()||v(t)}\nAfter the review: ${_(e)}`}var b=[`Open a pull request for this task's branch:`,`1. Make sure the work is committed, then push the branch to origin.`,"2. Create the PR with `gh pr create` — write a clear title and a body that summarizes what changed and why, following this repo's conventions."].join(`
2
2
  `);function x(e){return[e?.trim()||b,`Reply with the PR URL.`,"If `gh` isn't authenticated, there's no remote, or a PR already exists for this branch, say so instead of forcing it."].join(`
3
3
  `)}var S=e(t(),1),C=5e3,w=[],T=0,E=new Set;function D(){for(let e of E)e()}function O(e,t){T+=1;let n={id:T,kind:e,message:t};w=[...w.slice(-3),n],D(),window.setTimeout(()=>k(n.id),C)}function k(e){w.some(t=>t.id===e)&&(w=w.filter(t=>t.id!==e),D())}function A(e,t){return`${e}: ${t instanceof Error?t.message:String(t)}`}function j(e,t){O(`error`,A(e,t))}function M(){return(0,S.useSyncExternalStore)(e=>(E.add(e),()=>E.delete(e)),()=>w,()=>w)}var N=[`a[href]`,`button:not([disabled])`,`textarea:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function P(e,t=!0){(0,S.useEffect)(()=>{if(!t)return;let n=e.current;if(!n)return;let r=document.activeElement,i=e=>{if(e.key!==`Tab`)return;let t=Array.from(n.querySelectorAll(N)).filter(e=>e.offsetParent!==null||e===document.activeElement);if(t.length===0)return;let r=t[0],i=t[t.length-1],a=document.activeElement;e.shiftKey?(a===r||!n.contains(a))&&(e.preventDefault(),i.focus()):(a===i||!n.contains(a))&&(e.preventDefault(),r.focus())};return n.addEventListener(`keydown`,i),()=>{n.removeEventListener(`keydown`,i),r?.focus?.()}},[e,t])}async function F(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}function I(e,t,n,r=80){return t-e-n<r}var L=90;function R(e){let t=e.input;if(t&&typeof t==`object`){let e=e=>typeof t[e]==`string`?t[e]:null,n=e(`command`)??e(`file_path`)??e(`pattern`)??e(`url`)??e(`description`)??e(`prompt`)??e(`query`);if(n)return n.length>L?`${n.slice(0,L-1)}…`:n}try{let t=JSON.stringify(e.input);return!t||t===`{}`||t===`null`?``:t.length>L?`${t.slice(0,L-1)}…`:t}catch{return``}}function z(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e,null,2)}catch{return String(e)}}var B=600,V={user:`You`,assistant:`Assistant`,system:`System`};function H(e){return e.split(`
4
4
  `).map(e=>e?`> ${e}`:`>`).join(`
@@ -8,4 +8,4 @@ import{i as e,t}from"./react-B8IZ02wI.js";import{a as n}from"./index-DdSnT7Rv.js
8
8
 
9
9
  ---
10
10
 
11
- `)}\n`}function K(e){switch(e.type){case`text`:case`thinking`:return e.text;case`tool_call`:return`${e.name} ${R(e)}`;case`tool_result`:return z(e.output)}}function q(e){return e.blocks.map(K).join(` `)}function J(e,t){return!(t&&e.type===`tool_call`)}function Y(e,t){return e.blocks.some(e=>e.type===`text`||e.type===`thinking`?e.text.trim()!==``:e.type===`tool_call`?!t:!1)}var X=n(),Z=2500,Q=600;function $({call:e,result:t}){let[n,r]=(0,S.useState)(!1),i=R(e),a=t?z(t.output):``,o=!n&&a.length>Q,s=o?`${a.slice(0,Q)}…`:a,c=a.length>0;return(0,X.jsxs)(`div`,{className:`my-1`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>c&&r(e=>!e),className:`flex w-full items-baseline gap-2 text-left ${c?`cursor-pointer`:`cursor-default`}`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?.isError?`text-kobe-red`:`text-kobe-green`}`,children:`⏺`}),(0,X.jsx)(`span`,{className:`shrink-0 text-[12px] font-semibold text-fg`,children:e.name}),i&&(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-subtle`,children:i}),c&&(0,X.jsx)(`span`,{className:`shrink-0 text-subtle`,children:n?(0,X.jsx)(d,{size:12}):(0,X.jsx)(f,{size:12})})]}),(n||!n&&a&&a.length<=Q)&&a&&(0,X.jsx)(`pre`,{className:`mt-1 max-h-96 overflow-auto whitespace-pre-wrap break-words border-l-2 pl-3 font-mono text-[11px] leading-relaxed ${t?.isError?`border-kobe-red/40 text-kobe-red/90`:`border-line text-muted`}`,children:s}),o&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>r(!0),className:`ml-5 mt-0.5 text-[10px] text-subtle hover:text-fg`,children:`show full output`})]})}function ee({text:e}){let[t,n]=(0,S.useState)(!1);return(0,X.jsxs)(`div`,{className:`my-1`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex items-baseline gap-2 text-[11px] italic text-subtle hover:text-muted`,children:[(0,X.jsx)(`span`,{children:`✱`}),(0,X.jsx)(`span`,{children:t?`thinking`:`thinking…`}),t?(0,X.jsx)(d,{size:11}):(0,X.jsx)(f,{size:11})]}),t&&(0,X.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words border-l-2 border-line-subtle pl-3 text-[11px] italic leading-relaxed text-subtle`,children:e})]})}function te({message:e,results:t,hideTools:n}){let r=[],i=l(e.timestamp),a=!1;return e.blocks.forEach((o,s)=>{if(!J(o,n))return;let c=`${e.timestamp}-${s}`;if(o.type===`text`){if(!o.text.trim())return;e.role===`user`?(r.push((0,X.jsxs)(`div`,{className:`my-2 flex items-baseline gap-2 border-l-2 border-primary/60 bg-inset/40 px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] font-bold text-primary`,children:`❯`}),(0,X.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg`,children:o.text}),i&&!a&&(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,title:e.timestamp,children:i})]},c)),a=!0):r.push((0,X.jsx)(`p`,{className:`my-2 whitespace-pre-wrap break-words text-[12px] leading-relaxed ${e.role===`system`?`text-subtle`:`text-fg/90`}`,children:o.text},c));return}if(o.type===`tool_call`){r.push((0,X.jsx)($,{call:o,result:t.get(o.callId)},c));return}if(o.type===`thinking`){o.text.trim()&&r.push((0,X.jsx)(ee,{text:o.text},c));return}}),r.length===0?null:(0,X.jsx)(X.Fragment,{children:r})}function ne({worktreePath:e,vendor:t,title:n=`Session`}){let[i,l]=(0,S.useState)([]),[d,f]=(0,S.useState)(null),[h,g]=(0,S.useState)(!0),[_,v]=(0,S.useState)([]),[y,b]=(0,S.useState)(``),[x,C]=(0,S.useState)(!1),[w,T]=(0,S.useState)(null),[E,D]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!0),j=(0,S.useRef)(-1),M=(0,S.useRef)(null),N=(0,S.useRef)(!0),P=(0,S.useRef)(0),L=(0,S.useRef)(!0),R=(0,S.useRef)(null);(0,S.useEffect)(()=>{L.current=h,R.current=d},[h,d]);let z=(0,S.useCallback)(async(n=!1)=>{if(!e)return;let r=P.current;try{let i=await o(e,t);if(i.latestMtime===j.current&&!n)return;j.current=i.latestMtime;let s=i.sessions.at(-1)??null,c=L.current?s:R.current??s;r=++P.current;let u=c?await a(t,c):[];if(r!==P.current)return;l(i.sessions),v(u),f(c),T(null)}catch(e){r===P.current&&T(e instanceof Error?e.message:String(e))}finally{r===P.current&&D(!0)}},[e,t]),B=(0,S.useRef)(z);(0,S.useEffect)(()=>{B.current=z},[z]),(0,S.useEffect)(()=>{j.current=-1,D(!1),L.current=!0,R.current=null,N.current=!0,g(!0),f(null),b(``),C(!1),A(!0),B.current(!0);let e=window.setInterval(()=>{document.hidden||B.current()},Z);return()=>window.clearInterval(e)},[e,t]);let V=e=>{let n=e===i.at(-1);L.current=n,R.current=e,g(n),f(e);let r=++P.current;a(t,e).then(e=>{r===P.current&&v(e)}).catch(e=>{r===P.current&&T(e instanceof Error?e.message:String(e))})};(0,S.useEffect)(()=>{let e=M.current;e&&N.current&&(e.scrollTop=e.scrollHeight)},[_]);let H=()=>{let e=M.current;if(!e)return;let t=I(e.scrollTop,e.scrollHeight,e.clientHeight);N.current=t,A(t)},U=()=>{let e=M.current;e&&(e.scrollTop=e.scrollHeight,N.current=!0,A(!0))},W=(0,S.useMemo)(()=>{let e=new Map;for(let t of _)for(let n of t.blocks)n.type===`tool_result`&&e.set(n.callId,n);return e},[_]),K=(0,S.useMemo)(()=>s(_),[_]),J=(0,S.useMemo)(()=>_.map(e=>q(e).toLowerCase()),[_]),Q=(0,S.useMemo)(()=>{let e=y.trim().toLowerCase();return _.filter((t,n)=>(!e||J[n].includes(e))&&Y(t,x))},[_,J,y,x]),$=async()=>{if(Q.length===0)return;let e=await F(G(Q,W,x,{title:n,vendor:t,total:_.length}));O(e?`success`:`error`,e?`Copied transcript as Markdown (${Q.length} messages)`:`Couldn't copy to the clipboard`)};return e?(0,X.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col border border-line bg-bg`,children:[(0,X.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-line bg-surface px-2`,children:[(0,X.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Chat`}),i.length>0&&(0,X.jsx)(`select`,{value:d??``,onChange:e=>V(e.target.value),className:`max-w-44 border border-line bg-bg px-1 py-0.5 font-mono text-[10px] text-muted focus:outline-none`,title:`Engine session`,children:i.map((e,t)=>(0,X.jsxs)(`option`,{value:e,children:[`#`,t+1,` `,e.slice(0,8),t===i.length-1?` (latest)`:``]},e))}),(0,X.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[10px] text-subtle`,children:[K.contextTokens>0&&(0,X.jsxs)(`span`,{title:`Live context estimate (last turn's full prompt)`,children:[`ctx `,c(K.contextTokens)]}),K.outputTokens>0&&(0,X.jsxs)(`span`,{title:`Session tokens in / out`,children:[`⇡`,c(K.inputTokens),` ⇣`,c(K.outputTokens)]}),Q.length>0&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>void $(),className:`text-subtle transition-colors hover:text-fg`,title:`Copy transcript as Markdown (respects search + hide-tools)`,"aria-label":`Copy transcript as Markdown`,children:(0,X.jsx)(p,{size:11,strokeWidth:2})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>void z(!0),className:`text-subtle transition-colors hover:text-fg`,title:`Refresh transcript`,"aria-label":`Refresh transcript`,children:(0,X.jsx)(m,{size:11,strokeWidth:2})})]})]}),_.length>0&&(0,X.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 border-b border-line px-2`,children:[(0,X.jsx)(r,{size:11,strokeWidth:2,className:`shrink-0 text-subtle`}),(0,X.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Escape`&&y&&(e.preventDefault(),b(``))},placeholder:`Search transcript…`,spellCheck:!1,className:`min-w-0 flex-1 bg-transparent font-mono text-[11px] text-fg placeholder:text-subtle focus:outline-none`}),y.trim()&&(0,X.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,children:[Q.length,`/`,_.length]}),y.trim()&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>b(``),className:`shrink-0 text-subtle transition-colors hover:text-fg`,"aria-label":`clear transcript search`,title:`Clear search`,children:(0,X.jsx)(u,{size:12,strokeWidth:2})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>C(e=>!e),className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${x?`border-primary bg-inset text-fg`:`border-line bg-bg text-subtle hover:border-primary hover:text-fg`}`,title:x?`Show tool calls`:`Hide tool calls — read just the conversation`,children:x?`tools off`:`tools`})]}),(0,X.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(`div`,{ref:M,onScroll:H,className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:w?(0,X.jsx)(`div`,{className:`py-4 text-[12px] text-kobe-red`,children:w}):E?_.length===0?(0,X.jsx)(`div`,{className:`py-4 text-[12px] leading-relaxed text-subtle`,children:`No engine session recorded for this worktree yet. Open a Vendor tab and start a conversation — the transcript appears here.`}):Q.length===0?(0,X.jsxs)(`div`,{className:`py-4 text-[12px] leading-relaxed text-subtle`,children:[`No messages match “`,y.trim(),`”.`]}):Q.map((e,t)=>(0,X.jsx)(te,{message:e,results:W,hideTools:x},`${e.sessionId}-${t}`)):(0,X.jsx)(`div`,{className:`py-4 text-[12px] text-subtle`,children:`Loading transcript…`})}),!k&&Q.length>0&&(0,X.jsx)(`button`,{type:`button`,onClick:U,className:`absolute bottom-3 right-4 flex items-center gap-1 border border-line bg-surface px-2 py-1 font-mono text-[10px] text-muted shadow-md transition-colors hover:border-primary hover:text-fg`,children:`↓ latest`})]})]}):(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`This task has no worktree yet.`})}export{O as a,b as c,y as d,h as f,k as i,x as l,m,F as n,j as o,g as p,P as r,M as s,ne as t,v as u};
11
+ `)}\n`}function K(e){switch(e.type){case`text`:case`thinking`:return e.text;case`tool_call`:return`${e.name} ${R(e)}`;case`tool_result`:return z(e.output)}}function q(e){return e.blocks.map(K).join(` `)}function J(e,t){return!(t&&e.type===`tool_call`)}function Y(e,t){return e.blocks.some(e=>e.type===`text`||e.type===`thinking`?e.text.trim()!==``:e.type===`tool_call`?!t:!1)}var X=n(),Z=2500,Q=600;function $({call:e,result:t}){let[n,r]=(0,S.useState)(!1),i=R(e),a=t?z(t.output):``,o=!n&&a.length>Q,s=o?`${a.slice(0,Q)}…`:a,c=a.length>0;return(0,X.jsxs)(`div`,{className:`my-1`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>c&&r(e=>!e),className:`flex w-full items-baseline gap-2 text-left ${c?`cursor-pointer`:`cursor-default`}`,children:[(0,X.jsx)(`span`,{className:`shrink-0 text-[11px] ${t?.isError?`text-kobe-red`:`text-kobe-green`}`,children:`⏺`}),(0,X.jsx)(`span`,{className:`shrink-0 text-[12px] font-semibold text-fg`,children:e.name}),i&&(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-subtle`,children:i}),c&&(0,X.jsx)(`span`,{className:`shrink-0 text-subtle`,children:n?(0,X.jsx)(d,{size:12}):(0,X.jsx)(f,{size:12})})]}),(n||!n&&a&&a.length<=Q)&&a&&(0,X.jsx)(`pre`,{className:`mt-1 max-h-96 overflow-auto whitespace-pre-wrap break-words border-l-2 pl-3 font-mono text-[11px] leading-relaxed ${t?.isError?`border-kobe-red/40 text-kobe-red/90`:`border-line text-muted`}`,children:s}),o&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>r(!0),className:`ml-5 mt-0.5 text-[10px] text-subtle hover:text-fg`,children:`show full output`})]})}function ee({text:e}){let[t,n]=(0,S.useState)(!1);return(0,X.jsxs)(`div`,{className:`my-1`,children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex items-baseline gap-2 text-[11px] italic text-subtle hover:text-muted`,children:[(0,X.jsx)(`span`,{children:`✱`}),(0,X.jsx)(`span`,{children:t?`thinking`:`thinking…`}),t?(0,X.jsx)(d,{size:11}):(0,X.jsx)(f,{size:11})]}),t&&(0,X.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words border-l-2 border-line-subtle pl-3 text-[11px] italic leading-relaxed text-subtle`,children:e})]})}function te({message:e,results:t,hideTools:n}){let r=[],i=l(e.timestamp),a=!1;return e.blocks.forEach((o,s)=>{if(!J(o,n))return;let c=`${e.timestamp}-${s}`;if(o.type===`text`){if(!o.text.trim())return;e.role===`user`?(r.push((0,X.jsxs)(`div`,{className:`my-2 flex items-baseline gap-2 border-l-2 border-primary/60 bg-inset/40 px-3 py-2`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[12px] font-bold text-primary`,children:`❯`}),(0,X.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg`,children:o.text}),i&&!a&&(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,title:e.timestamp,children:i})]},c)),a=!0):r.push((0,X.jsx)(`p`,{className:`my-2 whitespace-pre-wrap break-words text-[12px] leading-relaxed ${e.role===`system`?`text-subtle`:`text-fg/90`}`,children:o.text},c));return}if(o.type===`tool_call`){r.push((0,X.jsx)($,{call:o,result:t.get(o.callId)},c));return}if(o.type===`thinking`){o.text.trim()&&r.push((0,X.jsx)(ee,{text:o.text},c));return}}),r.length===0?null:(0,X.jsx)(X.Fragment,{children:r})}function ne({worktreePath:e,vendor:t,title:n=`Session`}){let[s,l]=(0,S.useState)([]),[d,f]=(0,S.useState)(null),[h,g]=(0,S.useState)(!0),[_,v]=(0,S.useState)([]),[y,b]=(0,S.useState)(``),[x,C]=(0,S.useState)(!1),[w,T]=(0,S.useState)(null),[E,D]=(0,S.useState)(!1),[k,A]=(0,S.useState)(!0),j=(0,S.useRef)(-1),M=(0,S.useRef)(null),N=(0,S.useRef)(!0),P=(0,S.useRef)(0),L=(0,S.useRef)(!0),R=(0,S.useRef)(null);(0,S.useEffect)(()=>{L.current=h,R.current=d},[h,d]);let z=(0,S.useCallback)(async(n=!1)=>{if(!e)return;let i=P.current;try{let a=await r(e,t);if(a.latestMtime===j.current&&!n)return;j.current=a.latestMtime;let s=a.sessions.at(-1)??null,c=L.current?s:R.current??s;i=++P.current;let u=c?await o(t,c):[];if(i!==P.current)return;l(a.sessions),v(u),f(c),T(null)}catch(e){i===P.current&&T(e instanceof Error?e.message:String(e))}finally{i===P.current&&D(!0)}},[e,t]),B=(0,S.useRef)(z);(0,S.useEffect)(()=>{B.current=z},[z]),(0,S.useEffect)(()=>{j.current=-1,D(!1),L.current=!0,R.current=null,N.current=!0,g(!0),f(null),b(``),C(!1),A(!0),B.current(!0);let e=window.setInterval(()=>{document.hidden||B.current()},Z);return()=>window.clearInterval(e)},[e,t]);let V=e=>{let n=e===s.at(-1);L.current=n,R.current=e,g(n),f(e);let r=++P.current;o(t,e).then(e=>{r===P.current&&v(e)}).catch(e=>{r===P.current&&T(e instanceof Error?e.message:String(e))})};(0,S.useEffect)(()=>{let e=M.current;e&&N.current&&(e.scrollTop=e.scrollHeight)},[_]);let H=()=>{let e=M.current;if(!e)return;let t=I(e.scrollTop,e.scrollHeight,e.clientHeight);N.current=t,A(t)},U=()=>{let e=M.current;e&&(e.scrollTop=e.scrollHeight,N.current=!0,A(!0))},W=(0,S.useMemo)(()=>{let e=new Map;for(let t of _)for(let n of t.blocks)n.type===`tool_result`&&e.set(n.callId,n);return e},[_]),K=(0,S.useMemo)(()=>a(_),[_]),J=(0,S.useMemo)(()=>_.map(e=>q(e).toLowerCase()),[_]),Q=(0,S.useMemo)(()=>{let e=y.trim().toLowerCase();return _.filter((t,n)=>(!e||J[n].includes(e))&&Y(t,x))},[_,J,y,x]),$=async()=>{if(Q.length===0)return;let e=await F(G(Q,W,x,{title:n,vendor:t,total:_.length}));O(e?`success`:`error`,e?`Copied transcript as Markdown (${Q.length} messages)`:`Couldn't copy to the clipboard`)};return e?(0,X.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col border border-line bg-bg`,children:[(0,X.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center gap-2 border-b border-line bg-surface px-2`,children:[(0,X.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-subtle`,children:`Chat`}),s.length>0&&(0,X.jsx)(`select`,{value:d??``,onChange:e=>V(e.target.value),className:`max-w-44 border border-line bg-bg px-1 py-0.5 font-mono text-[10px] text-muted focus:outline-none`,title:`Engine session`,children:s.map((e,t)=>(0,X.jsxs)(`option`,{value:e,children:[`#`,t+1,` `,e.slice(0,8),t===s.length-1?` (latest)`:``]},e))}),(0,X.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[10px] text-subtle`,children:[K.contextTokens>0&&(0,X.jsxs)(`span`,{title:`Live context estimate (last turn's full prompt)`,children:[`ctx `,i(K.contextTokens)]}),K.outputTokens>0&&(0,X.jsxs)(`span`,{title:`Session tokens in / out`,children:[`⇡`,i(K.inputTokens),` ⇣`,i(K.outputTokens)]}),Q.length>0&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>void $(),className:`text-subtle transition-colors hover:text-fg`,title:`Copy transcript as Markdown (respects search + hide-tools)`,"aria-label":`Copy transcript as Markdown`,children:(0,X.jsx)(p,{size:11,strokeWidth:2})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>void z(!0),className:`text-subtle transition-colors hover:text-fg`,title:`Refresh transcript`,"aria-label":`Refresh transcript`,children:(0,X.jsx)(m,{size:11,strokeWidth:2})})]})]}),_.length>0&&(0,X.jsxs)(`div`,{className:`flex h-7 shrink-0 items-center gap-2 border-b border-line px-2`,children:[(0,X.jsx)(c,{size:11,strokeWidth:2,className:`shrink-0 text-subtle`}),(0,X.jsx)(`input`,{value:y,onChange:e=>b(e.target.value),onKeyDown:e=>{e.key===`Escape`&&y&&(e.preventDefault(),b(``))},placeholder:`Search transcript…`,spellCheck:!1,className:`min-w-0 flex-1 bg-transparent font-mono text-[11px] text-fg placeholder:text-subtle focus:outline-none`}),y.trim()&&(0,X.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] text-subtle`,children:[Q.length,`/`,_.length]}),y.trim()&&(0,X.jsx)(`button`,{type:`button`,onClick:()=>b(``),className:`shrink-0 text-subtle transition-colors hover:text-fg`,"aria-label":`clear transcript search`,title:`Clear search`,children:(0,X.jsx)(u,{size:12,strokeWidth:2})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>C(e=>!e),className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${x?`border-primary bg-inset text-fg`:`border-line bg-bg text-subtle hover:border-primary hover:text-fg`}`,title:x?`Show tool calls`:`Hide tool calls — read just the conversation`,children:x?`tools off`:`tools`})]}),(0,X.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(`div`,{ref:M,onScroll:H,className:`min-h-0 flex-1 overflow-y-auto px-3 py-2`,children:w?(0,X.jsx)(`div`,{className:`py-4 text-[12px] text-kobe-red`,children:w}):E?_.length===0?(0,X.jsx)(`div`,{className:`py-4 text-[12px] leading-relaxed text-subtle`,children:`No engine session recorded for this worktree yet. Open a Vendor tab and start a conversation — the transcript appears here.`}):Q.length===0?(0,X.jsxs)(`div`,{className:`py-4 text-[12px] leading-relaxed text-subtle`,children:[`No messages match “`,y.trim(),`”.`]}):Q.map((e,t)=>(0,X.jsx)(te,{message:e,results:W,hideTools:x},`${e.sessionId}-${t}`)):(0,X.jsx)(`div`,{className:`py-4 text-[12px] text-subtle`,children:`Loading transcript…`})}),!k&&Q.length>0&&(0,X.jsx)(`button`,{type:`button`,onClick:U,className:`absolute bottom-3 right-4 flex items-center gap-1 border border-line bg-surface px-2 py-1 font-mono text-[10px] text-muted shadow-md transition-colors hover:border-primary hover:text-fg`,children:`↓ latest`})]})]}):(0,X.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`This task has no worktree yet.`})}export{O as a,b as c,y as d,h as f,k as i,x as l,m,F as n,j as o,g as p,P as r,M as s,ne as t,v as u};
@@ -0,0 +1 @@
1
+ import{E as e}from"./chips-D1mC9nB4.js";var t=e(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]);export{t};
@@ -0,0 +1,6 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatTerminal-BMSvAiAB.js","assets/tabs-7WK4MwGF.js","assets/terminal-CapzGZr6.js","assets/index-i463t0Rc.js","assets/index-CtJIPdVH.css","assets/chips-D1mC9nB4.js","assets/ChatTranscript-BJhX29XX.js","assets/ChatTerminal-kHJ-D0s7.css"])))=>i.map(i=>d[i]);
2
+ import{b as e,c as t,f as n,v as r}from"./tabs-7WK4MwGF.js";import{r as i}from"./terminal-CapzGZr6.js";import{S as a,_ as o,b as s,n as c,r as l,x as u}from"./index-i463t0Rc.js";import{C as d,E as f,S as p,T as m,_ as h,b as g,c as _,d as v,f as y,g as b,h as x,i as ee,l as S,m as C,o as te,p as ne,r as w,t as T,u as re,w as ie,x as E,y as D}from"./chips-D1mC9nB4.js";import{t as O}from"./arrow-left-Cbh2rcaq.js";import{a as ae,d as oe,f as k,l as se,o as A,r as ce,t as j}from"./ChatTranscript-BJhX29XX.js";var le=f(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),M=f(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),N=f(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),P=f(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),ue=f(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),F=s(),I=e(r());function L(){var e=[...arguments];return(0,I.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var R=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function z(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function de(e){return`nodeType`in e}function B(e){return e?z(e)?e:de(e)?e.ownerDocument?.defaultView??window:window:window}function V(e){let{Document:t}=B(e);return e instanceof t}function H(e){return z(e)?!1:e instanceof B(e).HTMLElement}function fe(e){return e instanceof B(e).SVGElement}function pe(e){return e?z(e)?e.document:de(e)?V(e)?e:H(e)||fe(e)?e.ownerDocument:document:document:document}var U=R?I.useLayoutEffect:I.useEffect;function me(e){let t=(0,I.useRef)(e);return U(()=>{t.current=e}),(0,I.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function he(){let e=(0,I.useRef)(null);return[(0,I.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,I.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function ge(e,t){t===void 0&&(t=[e]);let n=(0,I.useRef)(e);return U(()=>{n.current!==e&&(n.current=e)},t),n}function _e(e,t){let n=(0,I.useRef)();return(0,I.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function W(e){let t=me(e),n=(0,I.useRef)(null);return[n,(0,I.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function G(e){let t=(0,I.useRef)();return(0,I.useEffect)(()=>{t.current=e},[e]),t.current}var ve={};function ye(e,t){return(0,I.useMemo)(()=>{if(t)return t;let n=ve[e]==null?0:ve[e]+1;return ve[e]=n,e+`-`+n},[e,t])}function be(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var xe=be(1),K=be(-1);function Se(e){return`clientX`in e&&`clientY`in e}function Ce(e){if(!e)return!1;let{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function we(e){if(!e)return!1;let{TouchEvent:t}=B(e.target);return t&&e instanceof t}function Te(e){if(we(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Se(e)?{x:e.clientX,y:e.clientY}:null}var Ee=Object.freeze({Translate:{toString(e){if(!e)return;let{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;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Ee.Translate.toString(e),Ee.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),De=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Oe(e){return e.matches(De)?e:e.querySelector(De)}var ke={display:`none`};function Ae(e){let{id:t,value:n}=e;return I.createElement(`div`,{id:t,style:ke},n)}function je(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return I.createElement(`div`,{id:t,style:{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`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Me(){let[e,t]=(0,I.useState)(``);return{announce:(0,I.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Ne=(0,I.createContext)(null);function Pe(e){let t=(0,I.useContext)(Ne);(0,I.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Fe(){let[e]=(0,I.useState)(()=>new Set),t=(0,I.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,I.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Ie={draggable:`
3
+ To pick up a draggable item, press the space bar.
4
+ While dragging, use the arrow keys to move the item.
5
+ Press space again to drop the item in its new position, or press escape to cancel.
6
+ `},Le={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Re(e){let{announcements:t=Le,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Ie}=e,{announce:a,announcement:o}=Me(),s=ye(`DndLiveRegion`),[c,l]=(0,I.useState)(!1);if((0,I.useEffect)(()=>{l(!0)},[]),Pe((0,I.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=I.createElement(I.Fragment,null,I.createElement(Ae,{id:r,value:i.draggable}),I.createElement(je,{id:s,announcement:o}));return n?(0,F.createPortal)(u,n):u}var q;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(q||={});function ze(){}function Be(e,t){return(0,I.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Ve(){var e=[...arguments];return(0,I.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var J=Object.freeze({x:0,y:0});function He(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Ue(e,t){let n=Te(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function We(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Ge(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Ke(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function qe(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}var Je=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Ke(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Ke(r),o=i.reduce((e,t,r)=>e+He(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(We)};function Ye(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Xe=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Ye(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Ge)};function Ze(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qe(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:J}function $e(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var et=$e(1);function tt(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function nt(e,t,n){let r=tt(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var rt={ignoreTransform:!1};function it(e,t){t===void 0&&(t=rt);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=B(e).getComputedStyle(e);t&&(n=nt(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function at(e){return it(e,{ignoreTransform:!0})}function ot(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function st(e,t){return t===void 0&&(t=B(e).getComputedStyle(e)),t.position===`fixed`}function ct(e,t){t===void 0&&(t=B(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function lt(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(V(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!H(i)||fe(i)||n.includes(i))return n;let a=B(e).getComputedStyle(i);return i!==e&&ct(i,a)&&n.push(i),st(i,a)?n:r(i.parentNode)}return e?r(e):n}function ut(e){let[t]=lt(e,1);return t??null}function dt(e){return!R||!e?null:z(e)?e:de(e)?V(e)||e===pe(e).scrollingElement?window:H(e)?e:null:null}function ft(e){return z(e)?e.scrollX:e.scrollLeft}function pt(e){return z(e)?e.scrollY:e.scrollTop}function mt(e){return{x:ft(e),y:pt(e)}}var Y;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Y||={});function ht(e){return!R||!e?!1:e===document.scrollingElement}function gt(e){let t={x:0,y:0},n=ht(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var _t={x:.2,y:.2};function vt(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=_t);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=gt(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Y.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Y.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Y.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Y.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function yt(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function bt(e){return e.reduce((e,t)=>xe(e,mt(t)),J)}function xt(e){return e.reduce((e,t)=>e+ft(t),0)}function St(e){return e.reduce((e,t)=>e+pt(t),0)}function Ct(e,t){if(t===void 0&&(t=it),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);ut(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var wt=[[`x`,[`left`,`right`],xt],[`y`,[`top`,`bottom`],St]],Tt=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=lt(t),r=bt(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of wt)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Et=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Dt(e){let{EventTarget:t}=B(e);return e instanceof t?e:pe(e)}function Ot(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var X;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(X||={});function kt(e){e.preventDefault()}function At(e){e.stopPropagation()}var Z;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Z||={});var jt={start:[Z.Space,Z.Enter],cancel:[Z.Esc],end:[Z.Space,Z.Enter,Z.Tab]},Mt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Z.Right:return{...n,x:n.x+25};case Z.Left:return{...n,x:n.x-25};case Z.Down:return{...n,y:n.y+25};case Z.Up:return{...n,y:n.y-25}}},Nt=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Et(pe(t)),this.windowListeners=new Et(B(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(X.Resize,this.handleCancel),this.windowListeners.add(X.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(X.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Ct(n),t(J)}handleKeyDown(e){if(Ce(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=jt,coordinateGetter:a=Mt,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:J;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=K(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=gt(n),p=yt(n),m={x:Math.min(i===Z.Right?p.right-p.width/2:p.right,Math.max(i===Z.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Z.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Z.Down?p.top:p.top+p.height/2,u.y))},h=i===Z.Right&&!s||i===Z.Left&&!c,g=i===Z.Down&&!l||i===Z.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Z.Right&&e<=d.x||i===Z.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Z.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Z.Down&&e<=d.y||i===Z.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Z.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,xe(K(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Nt.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=jt,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Pt(e){return!!(e&&`distance`in e)}function Ft(e){return!!(e&&`delay`in e)}var It=class{constructor(e,t,n){n===void 0&&(n=Dt(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=pe(i),this.documentListeners=new Et(this.document),this.listeners=new Et(n),this.windowListeners=new Et(B(i)),this.initialCoordinates=Te(r)??J,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(X.Resize,this.handleCancel),this.windowListeners.add(X.DragStart,kt),this.windowListeners.add(X.VisibilityChange,this.handleCancel),this.windowListeners.add(X.ContextMenu,kt),this.documentListeners.add(X.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ft(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Pt(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(X.Click,At,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(X.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Te(e)??J,s=K(n,o);if(!t&&a){if(Pt(a)){if(a.tolerance!=null&&Ot(s,a.tolerance))return this.handleCancel();if(Ot(s,a.distance))return this.handleStart()}if(Ft(a)&&Ot(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Z.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Lt={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Rt=class extends It{constructor(e){let{event:t}=e,n=pe(t.target);super(e,Lt,n)}};Rt.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var zt={move:{name:`mousemove`},end:{name:`mouseup`}},Bt;(function(e){e[e.RightClick=2]=`RightClick`})(Bt||={});var Vt=class extends It{constructor(e){super(e,zt,pe(e.event.target))}};Vt.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Bt.RightClick?!1:(r?.({event:n}),!0)}}];var Ht={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Ut=class extends It{constructor(e){super(e,Ht)}static setup(){return window.addEventListener(Ht.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Ht.move.name,e)};function e(){}}};Ut.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Wt;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Wt||={});var Gt;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Gt||={});function Kt(e){let{acceleration:t,activator:n=Wt.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Gt.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Jt({delta:d,disabled:!a}),[m,h]=he(),g=(0,I.useRef)({x:0,y:0}),_=(0,I.useRef)({x:0,y:0}),v=(0,I.useMemo)(()=>{switch(n){case Wt.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Wt.DraggableRect:return i}},[n,i,c]),y=(0,I.useRef)(null),b=(0,I.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,I.useMemo)(()=>s===Gt.TreeOrder?[...l].reverse():l,[s,l]);(0,I.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=vt(e,n,v,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),y.current=e,m(b,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var qt={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function Jt(e){let{delta:t,disabled:n}=e,r=G(t);return _e(e=>{if(n||!r||!e)return qt;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:e.x[Y.Backward]||i.x===-1,[Y.Forward]:e.x[Y.Forward]||i.x===1},y:{[Y.Backward]:e.y[Y.Backward]||i.y===-1,[Y.Forward]:e.y[Y.Forward]||i.y===1}}},[n,t,r])}function Yt(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return _e(e=>t==null?null:r??e??null,[r,t])}function Xt(e,t){return(0,I.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var Zt;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(Zt||={});var Qt;(function(e){e.Optimized=`optimized`})(Qt||={});var $t=new Map;function en(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,I.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,I.useRef)(e),d=g(),f=ge(d),p=(0,I.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,I.useRef)(null),h=_e(t=>{if(d&&!n)return $t;if(!t||t===$t||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Tt(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,I.useEffect)(()=>{u.current=e},[e]),(0,I.useEffect)(()=>{d||p()},[n,d]),(0,I.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,I.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case Zt.Always:return!1;case Zt.BeforeDragging:return n;default:return!n}}}function tn(e,t){return _e(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function nn(e,t){return tn(e,t)}function rn(e){let{callback:t,disabled:n}=e,r=me(t),i=(0,I.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,I.useEffect)(()=>()=>i?.disconnect(),[i]),i}function an(e){let{callback:t,disabled:n}=e,r=me(t),i=(0,I.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,I.useEffect)(()=>()=>i?.disconnect(),[i]),i}function on(e){return new Tt(it(e),e)}function sn(e,t,n){t===void 0&&(t=on);let[r,i]=(0,I.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=rn({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=an({callback:a});return U(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function cn(e){return Qe(e,tn(e))}var ln=[];function un(e){let t=(0,I.useRef)(e),n=_e(n=>e?n&&n!==ln&&e&&t.current&&e.parentNode===t.current.parentNode?n:lt(e):ln,[e]);return(0,I.useEffect)(()=>{t.current=e},[e]),n}function dn(e){let[t,n]=(0,I.useState)(null),r=(0,I.useRef)(e),i=(0,I.useCallback)(e=>{let t=dt(e.target);t&&n(e=>e?(e.set(t,mt(t)),new Map(e)):null)},[]);return(0,I.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=dt(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,mt(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{dt(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,I.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>xe(e,t),J):bt(e):J,[e,t])}function fn(e,t){t===void 0&&(t=[]);let n=(0,I.useRef)(null);return(0,I.useEffect)(()=>{n.current=null},t),(0,I.useEffect)(()=>{let t=e!==J;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?K(e,n.current):J}function pn(e){(0,I.useEffect)(()=>{if(!R)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function mn(e,t){return(0,I.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function hn(e){return(0,I.useMemo)(()=>e?ot(e):null,[e])}var gn=[];function _n(e,t){t===void 0&&(t=it);let[n]=e,r=hn(n?B(n):null),[i,a]=(0,I.useState)(gn);function o(){a(()=>e.length?e.map(e=>ht(e)?r:new Tt(t(e),e)):gn)}let s=an({callback:o});return U(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function vn(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return H(t)?t:e}function yn(e){let{measure:t}=e,[n,r]=(0,I.useState)(null),i=an({callback:(0,I.useCallback)(e=>{for(let{target:n}of e)if(H(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=W((0,I.useCallback)(e=>{let n=vn(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,I.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var bn=[{sensor:Rt,options:{}},{sensor:Nt,options:{}}],xn={current:{}},Sn={draggable:{measure:at},droppable:{measure:at,strategy:Zt.WhileDragging,frequency:Qt.Optimized},dragOverlay:{measure:it}},Cn=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},wn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Cn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ze},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Sn,measureDroppableContainers:ze,windowRect:null,measuringScheduled:!1},Tn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:ze,draggableNodes:new Map,over:null,measureDroppableContainers:ze},En=(0,I.createContext)(Tn),Dn=(0,I.createContext)(wn);function On(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Cn}}}function kn(e,t){switch(t.type){case q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case q.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case q.DragEnd:case q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case q.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Cn(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case q.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Cn(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case q.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Cn(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function An(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,I.useContext)(En),a=G(r),o=G(n?.id);return(0,I.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Ce(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Oe(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function jn(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Mn(e){return(0,I.useMemo)(()=>({draggable:{...Sn.draggable,...e?.draggable},droppable:{...Sn.droppable,...e?.droppable},dragOverlay:{...Sn.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Nn(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,I.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;U(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=Qe(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=ut(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Pn=(0,I.createContext)({...J,scaleX:1,scaleY:1}),Fn;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Fn||={});var In=(0,I.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=bn,collisionDetection:o=Xe,measuring:s,modifiers:c,...l}=e,[u,d]=(0,I.useReducer)(kn,void 0,On),[f,p]=Fe(),[m,h]=(0,I.useState)(Fn.Uninitialized),g=m===Fn.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),ee=(0,I.useRef)({initial:null,translated:null}),S=(0,I.useMemo)(()=>_==null?null:{id:_,data:x?.data??xn,rect:ee},[_,x]),C=(0,I.useRef)(null),[te,ne]=(0,I.useState)(null),[w,T]=(0,I.useState)(null),re=ge(l,Object.values(l)),ie=ye(`DndDescribedBy`,t),E=(0,I.useMemo)(()=>b.getEnabled(),[b]),D=Mn(s),{droppableRects:O,measureDroppableContainers:ae,measuringScheduled:oe}=en(E,{dragging:g,dependencies:[y.x,y.y],config:D.droppable}),k=Yt(v,_),se=(0,I.useMemo)(()=>w?Te(w):null,[w]),A=Ae(),ce=nn(k,D.draggable.measure);Nn({activeNode:_==null?null:v.get(_),config:A.layoutShiftCompensation,initialRect:ce,measure:D.draggable.measure});let j=sn(k,D.draggable.measure,ce),le=sn(k?k.parentElement:null),M=(0,I.useRef)({activatorEvent:null,active:null,activeNode:k,collisionRect:null,collisions:null,droppableRects:O,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),N=b.getNodeFor(M.current.over?.id),P=yn({measure:D.dragOverlay.measure}),ue=P.nodeRef.current??k,L=g?P.rect??j:null,R=!!(P.nodeRef.current&&P.rect),z=cn(R?null:j),de=hn(ue?B(ue):null),V=un(g?N??k:null),H=_n(V),fe=jn(c,{transform:{x:y.x-z.x,y:y.y-z.y,scaleX:1,scaleY:1},activatorEvent:w,active:S,activeNodeRect:j,containerNodeRect:le,draggingNodeRect:L,over:M.current.over,overlayNodeRect:P.rect,scrollableAncestors:V,scrollableAncestorRects:H,windowRect:de}),pe=se?xe(se,y):null,me=dn(V),he=fn(me),_e=fn(me,[j]),W=xe(fe,he),G=L?et(L,fe):null,ve=S&&G?o({active:S,collisionRect:G,droppableRects:O,droppableContainers:E,pointerCoordinates:pe}):null,be=qe(ve,`id`),[K,Se]=(0,I.useState)(null),Ce=Ze(R?fe:xe(fe,_e),K?.rect??null,j),we=(0,I.useRef)(null),Ee=(0,I.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(C.current==null)return;let i=v.get(C.current);if(!i)return;let a=e.nativeEvent;we.current=new n({active:C.current,activeNode:i,event:a,options:r,context:M,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=re.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=re.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=C.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=re.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:ee}};(0,F.unstable_batchedUpdates)(()=>{r?.(i),h(Fn.Initializing),d({type:q.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),ne(we.current),T(a)})},onMove(e){d({type:q.DragMove,coordinates:e})},onEnd:o(q.DragEnd),onCancel:o(q.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=M.current,o=null;if(t&&i){let{cancelDrop:s}=re.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===q.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=q.DragCancel)}C.current=null,(0,F.unstable_batchedUpdates)(()=>{d({type:e}),h(Fn.Uninitialized),Se(null),ne(null),T(null),we.current=null;let t=e===q.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=re.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),De=Xt(a,(0,I.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(C.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},C.current=r,Ee(n,t))},[v,Ee]));pn(a),U(()=>{j&&m===Fn.Initializing&&h(Fn.Initialized)},[j,m]),(0,I.useEffect)(()=>{let{onDragMove:e}=re.current,{active:t,activatorEvent:n,collisions:r,over:i}=M.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:W.x,y:W.y},over:i};(0,F.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[W.x,W.y]),(0,I.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=M.current;if(!e||C.current==null||!t||!i)return;let{onDragOver:a}=re.current,o=r.get(be),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,F.unstable_batchedUpdates)(()=>{Se(s),a?.(c),f({type:`onDragOver`,event:c})})},[be]),U(()=>{M.current={activatorEvent:w,active:S,activeNode:k,collisionRect:G,collisions:ve,droppableRects:O,draggableNodes:v,draggingNode:ue,draggingNodeRect:L,droppableContainers:b,over:K,scrollableAncestors:V,scrollAdjustedTranslate:W},ee.current={initial:L,translated:G}},[S,k,ve,G,v,ue,L,O,b,K,V,W]),Kt({...A,delta:y,draggingRect:G,pointerCoordinates:pe,scrollableAncestors:V,scrollableAncestorRects:H});let Oe=(0,I.useMemo)(()=>({active:S,activeNode:k,activeNodeRect:j,activatorEvent:w,collisions:ve,containerNodeRect:le,dragOverlay:P,draggableNodes:v,droppableContainers:b,droppableRects:O,over:K,measureDroppableContainers:ae,scrollableAncestors:V,scrollableAncestorRects:H,measuringConfiguration:D,measuringScheduled:oe,windowRect:de}),[S,k,j,w,ve,le,P,v,b,O,K,ae,V,H,D,oe,de]),ke=(0,I.useMemo)(()=>({activatorEvent:w,activators:De,active:S,activeNodeRect:j,ariaDescribedById:{draggable:ie},dispatch:d,draggableNodes:v,over:K,measureDroppableContainers:ae}),[w,De,S,j,d,ie,v,K,ae]);return I.createElement(Ne.Provider,{value:p},I.createElement(En.Provider,{value:ke},I.createElement(Dn.Provider,{value:Oe},I.createElement(Pn.Provider,{value:Ce},i)),I.createElement(An,{disabled:n?.restoreFocus===!1})),I.createElement(Re,{...n,hiddenTextDescribedById:ie}));function Ae(){let e=te?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Ln=(0,I.createContext)(null),Rn=`button`,zn=`Draggable`;function Bn(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=ye(zn),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,I.useContext)(En),{role:p=Rn,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,I.useContext)(g?Pn:Ln),[v,y]=W(),[b,x]=W(),ee=mn(o,t),S=ge(n);return U(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:S}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,I.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Rn?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:ee,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Vn(){return(0,I.useContext)(Dn)}var Hn=`Droppable`,Un={timeout:25};function Wn(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=ye(Hn),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,I.useContext)(En),u=(0,I.useRef)({disabled:n}),d=(0,I.useRef)(!1),f=(0,I.useRef)(null),p=(0,I.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Un,...i},_=ge(h??r),v=an({callback:(0,I.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=W((0,I.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=ge(t);return(0,I.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,I.useEffect)(()=>(s({type:q.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:q.UnregisterDroppable,key:a,id:r})),[r]),(0,I.useEffect)(()=>{n!==u.current.disabled&&(s({type:q.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function Gn(e){let{animation:t,children:n}=e,[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(null),s=G(n);return!n&&!r&&s&&i(s),U(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),I.createElement(I.Fragment,null,n,r?(0,I.cloneElement)(r,{ref:o}):null)}var Kn={x:0,y:0,scaleX:1,scaleY:1};function qn(e){let{children:t}=e;return I.createElement(En.Provider,{value:Tn},I.createElement(Pn.Provider,{value:Kn},t))}var Jn={position:`fixed`,touchAction:`none`},Yn=e=>Ce(e)?`transform 250ms ease`:void 0,Xn=(0,I.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Yn}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...Jn,width:s.width,height:s.height,top:s.top,left:s.left,transform:Ee.Transform.toString(d),transformOrigin:i&&r?Ue(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return I.createElement(n,{className:o,style:f,ref:t},a)}),Zn={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Ee.Transform.toString(t)},{transform:Ee.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function Qn(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return me((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=vn(a);if(!c)return;let{transform:l}=B(a).getComputedStyle(a),u=tt(l);if(!u)return;let d=typeof t==`function`?t:$n(t);return Ct(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function $n(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...Zn,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var er=0;function tr(e){return(0,I.useMemo)(()=>{if(e!=null)return er++,er},[e])}var nr=I.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=Vn(),ee=(0,I.useContext)(Pn),S=tr(d?.id),C=jn(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:ee,windowRect:x}),te=tn(f),ne=Qn({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),w=te?g.setRef:void 0;return I.createElement(qn,null,I.createElement(Gn,{animation:ne},d&&S?I.createElement(Xn,{key:S,id:d.id,ref:w,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:te,style:{zIndex:l,...i},transform:C},n):null))});function rr(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ir(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function ar(e){return e!==null&&e>=0}function or(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function sr(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var cr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=rr(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},lr={scaleX:1,scaleY:1},ur=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...lr}:null}let s=dr(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...lr}:r<t&&r>=a?{x:0,y:o.height+s,...lr}:{x:0,y:0,...lr}};function dr(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var fr=`Sortable`,pr=I.createContext({activeIndex:-1,containerId:fr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:cr,disabled:{draggable:!1,droppable:!1}});function mr(e){let{children:t,id:n,items:r,strategy:i=cr,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Vn(),d=ye(fr,n),f=s.rect!==null,p=(0,I.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,I.useRef)(p),v=!or(p,_.current),y=g!==-1&&h===-1||v,b=sr(a);U(()=>{v&&m&&u(p)},[v,p,m,u]),(0,I.useEffect)(()=>{_.current=p},[p]);let x=(0,I.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:ir(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return I.createElement(pr.Provider,{value:x},t)}var hr=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return rr(n,r,i).indexOf(t)},gr=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},_r={duration:200,easing:`ease`},vr=`transform`,yr=Ee.Transition.toString({property:vr,duration:0,easing:`linear`}),br={roleDescription:`sortable`};function xr(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,I.useState)(null),s=(0,I.useRef)(n);return U(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=it(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,I.useEffect)(()=>{a&&o(null)},[a]),a}function Sr(e){let{animateLayoutChanges:t=gr,attributes:n,disabled:r,data:i,getNewIndex:a=hr,id:o,strategy:s,resizeObserverConfig:c,transition:l=_r}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,I.useContext)(pr),y=Cr(r,p),b=u.indexOf(o),x=(0,I.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),ee=(0,I.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:S,node:C,isOver:te,setNodeRef:ne}=Wn({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:ee,...c}}),{active:w,activatorEvent:T,activeNodeRect:re,attributes:ie,setNodeRef:E,listeners:D,isDragging:O,over:ae,setActivatorNodeRef:oe,transform:k}=Bn({id:o,data:x,attributes:{...br,...n},disabled:y.draggable}),se=L(ne,E),A=!!w,ce=A&&!m&&ar(f)&&ar(g),j=!_&&O,le=ce?(j&&ce?k:null)??(s??v)({rects:h,activeNodeRect:re,activeIndex:f,overIndex:g,index:b}):null,M=ar(f)&&ar(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,N=w?.id,P=(0,I.useRef)({activeId:N,items:u,newIndex:M,containerId:d}),ue=u!==P.current.items,F=t({active:w,containerId:d,isDragging:O,isSorting:A,id:o,index:b,items:u,newIndex:P.current.newIndex,previousItems:P.current.items,previousContainerId:P.current.containerId,transition:l,wasDragging:P.current.activeId!=null}),R=xr({disabled:!F,index:b,node:C,rect:S});return(0,I.useEffect)(()=>{A&&P.current.newIndex!==M&&(P.current.newIndex=M),d!==P.current.containerId&&(P.current.containerId=d),u!==P.current.items&&(P.current.items=u)},[A,M,d,u]),(0,I.useEffect)(()=>{if(N===P.current.activeId)return;if(N!=null&&P.current.activeId==null){P.current.activeId=N;return}let e=setTimeout(()=>{P.current.activeId=N},50);return()=>clearTimeout(e)},[N]),{active:w,activeIndex:f,attributes:ie,data:x,rect:S,index:b,newIndex:M,items:u,isOver:te,isSorting:A,isDragging:O,listeners:D,node:C,overIndex:g,over:ae,setNodeRef:se,setActivatorNodeRef:oe,setDroppableNodeRef:ne,setDraggableNodeRef:E,transform:R??le,transition:z()};function z(){if(R||ue&&P.current.newIndex===b)return yr;if(!(j&&!Ce(T)||!l)&&(A||F))return Ee.Transition.toString({...l,property:vr})}}function Cr(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}Z.Down,Z.Right,Z.Up,Z.Left;var Q={query:``,repo:null,overrides:{}},wr=new Set;function Tr(e){Q={...Q,...e};for(let e of wr)e()}function Er(e){return wr.add(e),()=>{wr.delete(e)}}function Dr(){return Q}function Or(){return(0,I.useSyncExternalStore)(Er,Dr,Dr)}function kr(e){e!==Q.query&&Tr({query:e})}function Ar(e){e!==Q.repo&&Tr({repo:e})}function jr(e,t){Tr({overrides:{...Q.overrides,[e]:{...Q.overrides[e],status:t}}})}function Mr(e,t){Tr({overrides:{...Q.overrides,[e]:{...Q.overrides[e],position:t}}})}function Nr(e){let t={...Q.overrides};for(let n of e)t[n.taskId]={...t[n.taskId],position:n.position};Tr({overrides:t})}function Pr(e,t,n,r){let i=e[t];if(!i||i[n]!==r)return e;let a={...i};delete a[n];let o={...e};return a.status===void 0&&a.position===void 0?delete o[t]:o[t]=a,o}function Fr(e,t){let n=Pr(Q.overrides,e,`status`,t);n!==Q.overrides&&Tr({overrides:n})}function Ir(e,t){let n=Pr(Q.overrides,e,`position`,t);n!==Q.overrides&&Tr({overrides:n})}function Lr(e){let t=Q.overrides;for(let n of e)t=Pr(t,n.taskId,`position`,n.position);t!==Q.overrides&&Tr({overrides:t})}function Rr(e){let t=D(Q.overrides,e);t!==Q.overrides&&Tr({overrides:t})}var $=a(),zr=(0,I.lazy)(()=>o(()=>import(`./ChatTerminal-BMSvAiAB.js`).then(e=>({default:e.ChatTerminal})),__vite__mapDeps([0,1,2,3,4,5,6,7])));function Br({task:e,engine:n,onClose:r,onOpenWorkspace:i}){let[a,o]=(0,I.useState)(`engine`),[s]=(0,I.useState)(()=>t(e.id)),c=(0,I.useRef)(null);ce(c,!0),(0,I.useEffect)(()=>{let e=e=>{if(e.key!==`Escape`)return;let t=e.target;t?.closest(`.xterm`)||t&&(t.tagName===`TEXTAREA`||t.tagName===`INPUT`)||(e.preventDefault(),r())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let l=d(n?.state),u=e=>`border-b-2 px-2 py-1.5 text-[11px] transition-colors ${e?`border-primary text-fg`:`border-transparent text-muted hover:text-fg`}`;return(0,$.jsxs)(`div`,{className:`fixed inset-0 z-40 flex justify-end`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`Close peek`,onClick:r,className:`absolute inset-0 cursor-default bg-black/40`}),(0,$.jsxs)(`div`,{ref:c,role:`dialog`,"aria-modal":`true`,"aria-label":`Session peek: ${e.title||e.branch||e.id}`,className:`relative flex h-full w-[640px] max-w-[92vw] flex-col border-l border-line bg-bg shadow-2xl`,children:[(0,$.jsxs)(`header`,{className:`flex h-10 shrink-0 items-center gap-2 border-b border-line bg-surface px-3`,children:[(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${p(n?.state)}`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate text-[13px] text-fg`,children:e.title||e.branch||e.id}),(0,$.jsx)(`span`,{className:`hidden min-w-0 truncate font-mono text-[11px] text-subtle sm:inline`,children:e.branch}),l&&(0,$.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted`,children:l}),(0,$.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:i,className:`flex items-center gap-1 text-muted transition-colors hover:text-fg`,title:`Open in workspace`,children:[(0,$.jsx)(M,{size:13,strokeWidth:1.8}),(0,$.jsx)(`span`,{className:`text-[11px]`,children:`Workspace`})]}),(0,$.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center text-muted transition-colors hover:text-fg`,"aria-label":`Close peek`,title:`Close (Esc)`,children:(0,$.jsx)(ie,{size:15,strokeWidth:1.8})})]})]}),(0,$.jsxs)(`nav`,{className:`flex shrink-0 items-center gap-1 border-b border-line bg-surface px-2`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(`engine`),className:u(a===`engine`),children:`Engine`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(`transcript`),className:u(a===`transcript`),children:`Transcript`})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:a===`engine`?(0,$.jsx)(I.Suspense,{fallback:(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-subtle`,children:`Loading terminal…`}),children:(0,$.jsx)(zr,{tabId:s,taskId:e.id,mode:`engine`},s)}):(0,$.jsx)(j,{worktreePath:e.worktreePath,vendor:e.vendor??`claude`,title:e.title||e.branch})})]})]})}function Vr({pairs:e,titles:t,containerRef:n}){let[r,i]=(0,I.useState)([]);return(0,I.useEffect)(()=>{let r=n.current,a=e.filter(e=>e.level===`conflict`);if(!r||a.length===0){i(e=>e.length===0?e:[]);return}let o=0,s=()=>{let e=r.getBoundingClientRect(),n=[],c=e=>document.querySelector(`[data-yarn-anchor="${window.CSS.escape(e)}"]`)??r.querySelector(`[data-task-id="${window.CSS.escape(e)}"]`);a.forEach((r,i)=>{let a=c(r.a),o=c(r.b);if(!a||!o)return;let s=a.getBoundingClientRect(),l=o.getBoundingClientRect(),u=s.left+s.width/2-e.left,d=s.bottom-4-e.top,f=l.left+l.width/2-e.left,p=l.bottom-4-e.top,m=Math.min(120,Math.abs(f-u)/4+28),h=`M ${u} ${d} Q ${(u+f)/2} ${Math.max(d,p)+m} ${f} ${p}`,g=`${t.get(r.a)??r.a} ⇄ ${t.get(r.b)??r.b}`,_=r.files.slice(0,6).join(`, `);n.push({id:`${r.a}|${r.b}`,d:h,color:E(i),tip:`${g}\nconflicts: ${_}${r.files.length>6?`, …`:``}`})}),i(e=>JSON.stringify(e)===JSON.stringify(n)?e:n),o=requestAnimationFrame(s)};return o=requestAnimationFrame(s),()=>cancelAnimationFrame(o)},[e,t,n]),r.length===0?null:(0,$.jsx)(`svg`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 z-10 h-full w-full overflow-visible`,children:r.map(e=>(0,$.jsxs)(`g`,{children:[(0,$.jsx)(`path`,{d:e.d,fill:`none`,stroke:e.color,strokeWidth:2,strokeOpacity:.65,strokeLinecap:`round`}),(0,$.jsx)(`path`,{d:e.d,fill:`none`,stroke:`transparent`,strokeWidth:14,style:{pointerEvents:`stroke`},children:(0,$.jsx)(`title`,{children:e.tip})})]},e.id))})}var Hr=_.filter(e=>e.alwaysVisible),Ur=`after:pointer-events-none after:absolute after:right-0 after:bottom-full after:z-10 after:mb-1 after:hidden after:whitespace-nowrap after:border after:border-line after:bg-menu after:px-1.5 after:py-0.5 after:text-[10px] after:text-fg after:content-[attr(data-tip)] hover:after:block`,Wr=`after:pointer-events-none after:absolute after:left-full after:top-2 after:z-10 after:ml-1 after:hidden after:whitespace-nowrap after:border after:border-line after:bg-menu after:px-1.5 after:py-0.5 after:text-[10px] after:text-fg after:content-[attr(data-tip)] hover:after:block`,Gr=(e,{context:{active:t,collisionRect:n,droppableContainers:r,droppableRects:i}})=>{if(!t||!n||e.code!==`ArrowUp`&&e.code!==`ArrowDown`&&e.code!==`ArrowLeft`&&e.code!==`ArrowRight`)return;e.preventDefault();let a=n.left+n.width/2,o=[];for(let s of r.getEnabled()){if(s.id===t.id)continue;let r=i.get(s.id);if(!r)continue;let c=s.data.current,l=r.left+r.width/2,u=Math.abs(l-a)<n.width/2;if(e.code===`ArrowUp`||e.code===`ArrowDown`){if(!u||c?.type!==`card`)continue;let t=e.code===`ArrowUp`?n.top-r.top:r.top-n.top;t>1&&o.push({left:r.left,top:r.top,score:t})}else{if(u)continue;let t=e.code===`ArrowLeft`?a-l:l-a;if(t<=1)continue;let i=Math.abs(r.top-n.top);o.push({left:r.left,top:r.top,score:t*1e4+i})}}o.sort((e,t)=>e.score-t.score);let s=o[0];return s?{x:s.left,y:s.top}:void 0};function Kr({badge:e}){let t=(0,I.useRef)(null),[n,r]=(0,I.useState)(null);return(0,I.useEffect)(()=>{if(!n)return;let e=()=>r(null);return window.addEventListener(`scroll`,e,!0),()=>window.removeEventListener(`scroll`,e,!0)},[n]),(0,$.jsxs)(`span`,{ref:t,onMouseEnter:()=>{let e=t.current?.getBoundingClientRect();e&&r({top:e.bottom+2,right:Math.max(8,window.innerWidth-e.right)})},onMouseLeave:()=>r(null),className:`-my-1.5 relative shrink-0 cursor-help px-1.5 py-1.5 font-mono text-[10px] ${e.level===`conflict`?`text-kobe-red`:`text-kobe-yellow`}`,children:[`⚠`,e.count,n&&(0,F.createPortal)((0,$.jsx)(`div`,{style:{position:`fixed`,top:n.top,right:n.right,maxWidth:380,overflowWrap:`anywhere`},className:`pointer-events-none z-50 whitespace-pre-line border border-line bg-menu px-2 py-1 text-left font-mono text-[10px] text-fg`,children:e.tip}),document.body)]})}function qr({task:e,engine:t,changes:n,badge:r}){let i=d(t?.state),a=ee(e.updatedAt||e.createdAt);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 shrink-0 rounded-full ${p(t?.state)}`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] text-fg`,children:e.title||e.branch||e.id}),r&&(0,$.jsx)(Kr,{badge:r}),(0,$.jsx)(w,{pr:e.prStatus}),e.pinned&&(0,$.jsx)(`span`,{className:`shrink-0 text-[10px] text-subtle`,children:`PIN`}),(0,$.jsx)(T,{counts:n})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-subtle`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate font-mono`,children:e.branch||e.repo}),(0,$.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:[e.vendor&&(0,$.jsx)(`span`,{className:`font-mono`,children:e.vendor}),i&&(0,$.jsx)(`span`,{className:`text-muted`,children:i}),a&&(0,$.jsx)(`span`,{children:a})]})]})]})}function Jr({task:e,columnKey:t,engine:n,changes:r,badge:i,canDrag:a,onMoveTo:o,onReview:s,onCreatePr:c,onOpen:l,onPeek:u}){let{attributes:d,listeners:f,setNodeRef:p,setActivatorNodeRef:m,transform:h,transition:g,isDragging:_}=Sr({id:e.id,disabled:!a,data:{type:`card`,columnKey:t}}),{onKeyDown:v,...y}=f??{},b=(0,I.useRef)(0),x=(0,I.useRef)(!1);(0,I.useEffect)(()=>{x.current&&!_&&(b.current=Date.now()),x.current=_},[_]);let ee=()=>{Date.now()-b.current<250||l()};return(0,$.jsxs)(`div`,{ref:p,...y,"data-task-id":e.id,style:{transform:Ee.Transform.toString(h),transition:g},className:`group/card relative ${_?`opacity-40`:``}`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:ee,className:`flex w-full cursor-pointer flex-col gap-1.5 border border-line bg-surface p-3 pl-6 text-left transition-colors hover:border-primary hover:bg-inset`,children:(0,$.jsx)(qr,{task:e,engine:n,changes:r,badge:i})}),a&&(0,$.jsx)(`button`,{type:`button`,ref:m,...d,...f,"aria-label":`Move ${e.title||e.branch||e.id}`,"data-tip":`Drag to move`,className:`absolute top-0 bottom-0 left-0 flex w-5 cursor-grab items-center justify-center text-subtle opacity-0 transition-opacity hover:text-fg focus-visible:opacity-100 group-hover/card:opacity-100 ${Wr}`,children:(0,$.jsx)(ue,{size:12,strokeWidth:1.8})}),(0,$.jsxs)(`div`,{className:`absolute inset-x-0 bottom-0 flex items-center gap-1 border-t border-line bg-surface px-2 py-1 opacity-0 transition-opacity focus-within:opacity-100 group-hover/card:opacity-100`,children:[Hr.map(e=>{let n=e.key===t;return(0,$.jsx)(`button`,{type:`button`,disabled:n||!a,onClick:()=>o(e.key),title:n?`Current column`:`Move to ${e.title}`,className:`px-1 text-[10px] transition-colors ${n?`font-bold ${e.accent}`:`text-subtle hover:text-fg disabled:opacity-40 disabled:hover:text-subtle`}`,children:e.title},e.key)}),(0,$.jsxs)(`div`,{className:`ml-auto flex gap-0.5`,children:[s&&(0,$.jsx)(`button`,{type:`button`,onClick:s,"aria-label":`Send review instruction to ${e.title||e.branch||e.id}`,"data-tip":`Review → done if it passes`,className:`relative flex h-5 w-5 items-center justify-center border border-line bg-surface text-subtle hover:border-primary hover:text-fg ${Ur}`,children:(0,$.jsx)(le,{size:11,strokeWidth:1.8})}),c&&(0,$.jsx)(`button`,{type:`button`,onClick:c,"aria-label":`Open a PR for ${e.title||e.branch||e.id}`,"data-tip":`Open a PR for this branch`,className:`relative flex h-5 w-5 items-center justify-center border border-line bg-surface text-subtle hover:border-primary hover:text-fg ${Ur}`,children:(0,$.jsx)(P,{size:11,strokeWidth:1.8})}),(0,$.jsx)(`button`,{type:`button`,onClick:u,"aria-label":`Peek ${e.title||e.branch||e.id}`,"data-tip":`Peek session`,className:`relative flex h-5 w-5 items-center justify-center border border-line bg-surface text-subtle hover:border-primary hover:text-fg ${Ur}`,children:(0,$.jsx)(N,{size:11,strokeWidth:1.8})})]})]})]})}function Yr({column:e,engineStates:t,worktreeChanges:n,badges:r,canDrag:i,onMoveTo:a,onReview:o,onCreatePr:s,onOpen:c,onPeek:l}){let u=b(e.key),{setNodeRef:d,isOver:f}=Wn({id:e.key,disabled:!u,data:{type:`column`}});return(0,$.jsxs)(`section`,{ref:d,"data-column":e.key,className:`flex h-full w-72 shrink-0 flex-col border border-transparent ${f?`border-line-active bg-inset/40`:``}`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-baseline gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-[11px] font-bold uppercase tracking-[0.12em] ${e.accent}`,children:e.title}),(0,$.jsx)(`span`,{className:`font-mono text-[10px] text-subtle`,children:e.tasks.length+e.hiddenCount})]}),(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto pb-2`,children:[(0,$.jsx)(mr,{items:e.tasks.map(e=>e.id),strategy:ur,children:e.tasks.length===0?(0,$.jsx)(`div`,{className:`border border-dashed border-line-subtle p-3 text-center text-[11px] text-subtle`,children:`none`}):e.tasks.map(u=>(0,$.jsx)(Jr,{task:u,columnKey:e.key,engine:t[u.id],changes:n[u.worktreePath],badge:r.get(u.id),canDrag:i,onMoveTo:e=>a(u,e),onReview:e.key===`in_review`?()=>o(u):void 0,onCreatePr:e.key===`done`&&(!u.prStatus?.lifecycle||u.prStatus.lifecycle===`unknown`)?()=>s(u):void 0,onOpen:()=>c(u.id),onPeek:()=>l(u.id)},u.id))}),e.hiddenCount>0&&(0,$.jsxs)(`div`,{className:`p-2 text-center text-[10px] text-subtle`,children:[`+`,e.hiddenCount,` more — archive cards to thin this column`]})]})]})}function Xr(){let{tasks:e,engineStates:r,worktreeChanges:a,conflicts:o,deliver:s,hydrated:d,daemonConnected:f,streamConnected:_}=l(),{query:w,repo:T,overrides:E}=Or(),D=u(),ce=(0,I.useRef)(null),j=(0,I.useRef)(null),[le,M]=(0,I.useState)(null),[N,P]=(0,I.useState)(null),ue=Ve(Be(Rt,{activationConstraint:{distance:4}}),Be(Ut,{activationConstraint:{delay:250,tolerance:8}}),Be(Nt,{coordinateGetter:Gr})),F=f&&_;(0,I.useEffect)(()=>{Rr(e)},[e]),(0,I.useEffect)(()=>{N&&!e.some(e=>e.id===N)&&P(null)},[e,N]),(0,I.useEffect)(()=>{let e=e=>{if(N||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target,n=!!t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable);e.key===`/`&&!n?(e.preventDefault(),j.current?.focus()):e.key===`Escape`&&t===j.current&&w&&(e.preventDefault(),kr(``))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[w,N]);let L=(0,I.useMemo)(()=>g(e),[e]),R=T??(L.length===1?L[0]?.repo??null:null),z=(0,I.useMemo)(()=>R?e.find(e=>e.kind===`main`&&e.repo===R&&!e.archived):void 0,[e,R]);(0,I.useEffect)(()=>{T&&!L.some(e=>e.repo===T)&&Ar(null)},[L,T]);let de=(0,I.useMemo)(()=>S(e,E).filter(e=>(!T||e.repo===T)&&te(e,w)),[e,E,w,T]),B=(0,I.useMemo)(()=>v(de),[de]),V=re(B),H=le?de.find(e=>e.id===le):void 0,fe=(0,I.useMemo)(()=>new Map(e.map(e=>[e.id,e.title||e.branch||e.id])),[e]),pe=(0,I.useMemo)(()=>{let e=new Map,t=new Set(o.flatMap(e=>[e.a,e.b])),n=e=>fe.get(e)??e;for(let r of t){let t=ne(o,r);t&&e.set(r,{...t,tip:C(o,r,n)})}return e},[o,fe]),U=e=>{n(e),c(`task.setActive`,{taskId:e}).catch(()=>{}),D({to:`/task/$taskId`,params:{taskId:e}})},me=(t,n,r,i)=>{let a=E[t.id]?.status??t.status,o=n!==a,s=h({fullColumn:S(e,E).filter(e=>e.id!==t.id&&x(e)&&(e.status||`backlog`)===n).sort(y),moving:t,visiblePrev:r,visibleNext:i});o&&jr(t.id,n),s.kind===`single`?Mr(t.id,s.position):Nr(s.moves);let l=()=>{s.kind===`single`?Ir(t.id,s.position):Lr(s.moves)},u=()=>{c(`task.reorder`,{moves:s.kind===`single`?[{taskId:t.id,position:s.position}]:s.moves}).catch(e=>{l(),A(`reorder task`,e)})};if(!o){u();return}c(`task.status`,{taskId:t.id,status:n}).then(u).catch(e=>{Fr(t.id,n),l(),A(e instanceof Error&&e.name===`IllegalTransitionError`?`move blocked (${a} → ${n})`:`move task`,e)})},he=e=>{let n=t(e.id);k().then(t=>i(n,e.id,oe(e.id,e.vendor,t.review))).then(({spawned:e})=>{ae(`success`,e?`review sent — engine starting, peek to watch`:`review sent to the session`)}).catch(e=>A(`send review`,e))},ge=e=>{let n=t(e.id);k().then(t=>i(n,e.id,se(t.pr))).then(({spawned:e})=>{ae(`success`,e?`PR instruction sent — engine starting, peek to watch`:`PR instruction sent to the session`)}).catch(e=>A(`open PR`,e))},_e=(e,t)=>{!F||le||t===(E[e.id]?.status??e.status)||!b(t)||me(e,t,void 0,B.find(e=>e.key===t)?.tasks[0])};return(0,$.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden bg-bg text-fg`,children:[(0,$.jsxs)(`header`,{className:`flex h-10 shrink-0 items-center gap-3 border-b border-line bg-surface px-3`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>D({to:`/`}),className:`flex items-center gap-1.5 text-muted transition-colors hover:text-fg`,title:`Back to workspace`,children:[(0,$.jsx)(O,{size:15,strokeWidth:1.8}),(0,$.jsx)(`span`,{className:`text-[12px]`,children:`Workspace`})]}),(0,$.jsx)(`span`,{className:`text-[10px] font-bold uppercase tracking-[0.12em] text-fg`,children:`Board`}),(0,$.jsxs)(`label`,{className:`flex h-7 items-center gap-1.5 border border-line bg-bg px-2 text-muted focus-within:border-line-active`,children:[(0,$.jsx)(m,{size:13,strokeWidth:1.8,className:`shrink-0 text-subtle`}),(0,$.jsx)(`input`,{ref:j,value:w,onChange:e=>kr(e.target.value),placeholder:`Filter cards ( / )`,className:`w-44 bg-transparent text-[12px] text-fg placeholder:text-subtle focus:outline-none`}),w&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>kr(``),className:`shrink-0 text-subtle hover:text-fg`,"aria-label":`clear filter`,title:`Clear filter`,children:(0,$.jsx)(ie,{size:13,strokeWidth:2})})]}),L.length>=2&&(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 overflow-x-auto`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>Ar(null),className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${T===null?`border-line-active bg-inset text-fg`:`border-line text-subtle hover:text-fg`}`,children:`all`}),L.map(e=>(0,$.jsxs)(`button`,{type:`button`,title:e.repo,onClick:()=>Ar(T===e.repo?null:e.repo),className:`shrink-0 border px-1.5 py-0.5 font-mono text-[10px] transition-colors ${T===e.repo?`border-line-active bg-inset text-fg`:`border-line text-subtle hover:text-fg`}`,children:[e.label,(0,$.jsxs)(`span`,{className:T===e.repo?`text-muted`:`text-subtle`,children:[` `,e.count]})]},e.repo))]}),(0,$.jsxs)(`div`,{className:`ml-auto flex items-center gap-3 font-mono text-[11px] text-subtle`,children:[z&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>P(z.id),title:s?.source===`note`&&s.taskId===z.id?`Dispatcher — last field note ${ee(new Date(s.at).toISOString())||`just now`}`:`Dispatcher — this repo's main session (field-note router)`,className:`flex items-center gap-1.5 border border-line px-1.5 py-0.5 text-[10px] text-subtle transition-colors hover:border-primary hover:text-fg`,children:[(0,$.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${p(r[z.id]?.state)}`}),`dispatcher`]}),!F&&d&&(0,$.jsx)(`span`,{className:`text-kobe-yellow`,children:`read-only (offline)`}),(0,$.jsxs)(`span`,{children:[V,` card`,V===1?``:`s`]})]})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-x-auto overflow-y-hidden p-4`,children:d?V===0&&!w?(0,$.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`No worktree tasks yet. Create one from the workspace.`}):(0,$.jsxs)(In,{sensors:ue,collisionDetection:Je,onDragStart:e=>{M(String(e.active.id))},onDragEnd:t=>{M(null);let n=String(t.active.id),r=t.over;if(!r)return;let i=e.find(e=>e.id===n);if(!i)return;let a=r.data.current,o=String(r.id),s=E[n]?.status??i.status,c=a?.type===`card`?a.columnKey??s:o;if(!b(c))return;let l=B.find(e=>e.key===c);if(!l)return;let u=l.tasks.filter(e=>e.id!==n),d=u.length;if(a?.type===`card`&&o!==n){let e=u.findIndex(e=>e.id===o);if(e>=0&&(d=e,c===s)){let t=l.tasks.findIndex(e=>e.id===n),r=l.tasks.findIndex(e=>e.id===o);t>=0&&r>t&&(d=e+1)}}else if(o===n)return;let f=c!==s;f&&a?.type!==`card`&&l.hiddenCount>0&&(d=0),!(!f&&l.tasks[d]?.id===n)&&me(i,c,u[d-1],u[d])},onDragCancel:()=>M(null),children:[(0,$.jsxs)(`div`,{ref:ce,className:`relative flex h-full min-w-max gap-4`,children:[B.map(e=>(0,$.jsx)(Yr,{column:e,engineStates:r,worktreeChanges:a,badges:pe,canDrag:F,onMoveTo:_e,onReview:he,onCreatePr:ge,onOpen:U,onPeek:P},e.key)),(0,$.jsx)(Vr,{pairs:o,titles:fe,containerRef:ce})]}),(0,$.jsx)(nr,{children:H?(0,$.jsx)(`div`,{"data-yarn-anchor":H.id,className:`flex w-72 flex-col gap-1.5 border border-line-active bg-inset p-3 pl-6 shadow-lg`,children:(0,$.jsx)(qr,{task:H,engine:r[H.id],changes:a[H.worktreePath]})}):null})]}):(0,$.jsx)(`p`,{className:`text-[12px] text-subtle`,children:`Loading…`})}),(()=>{let t=N?e.find(e=>e.id===N):void 0;return t?(0,$.jsx)(Br,{task:t,engine:r[t.id],onClose:()=>P(null),onOpenWorkspace:()=>{P(null),U(t.id)}},t.id):null})()]})}var Zr=Xr;export{Zr as component};
@@ -0,0 +1,2 @@
1
+ import{b as e,v as t}from"./tabs-7WK4MwGF.js";import{S as n}from"./index-i463t0Rc.js";var r=e(t()),i=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),a=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),o=e=>{let t=a(e);return t.charAt(0).toUpperCase()+t.slice(1)},s=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),c=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},l={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},u=(0,r.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:a=``,children:o,iconNode:u,...d},f)=>(0,r.createElement)(`svg`,{ref:f,...l,width:t,height:t,stroke:e,strokeWidth:i?Number(n)*24/Number(t):n,className:s(`lucide`,a),...!o&&!c(d)&&{"aria-hidden":`true`},...d},[...u.map(([e,t])=>(0,r.createElement)(e,t)),...Array.isArray(o)?o:[o]])),d=(e,t)=>{let n=(0,r.forwardRef)(({className:n,...a},c)=>(0,r.createElement)(u,{ref:c,iconNode:t,className:s(`lucide-${i(o(e))}`,`lucide-${e}`,n),...a}));return n.displayName=o(e),n},f=d(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),p=d(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function m(e){switch(e){case`running`:return`bg-kobe-orange`;case`waiting_permission`:return`bg-kobe-blue`;case`rate_limited`:return`bg-kobe-yellow`;case`error`:return`bg-kobe-red`;case`idle`:return`bg-kobe-green/60`;default:return`bg-subtle`}}function h(e){switch(e){case`running`:return`running`;case`waiting_permission`:return`needs input`;case`rate_limited`:return`rate limited`;case`error`:return`error`;case`idle`:return`idle`;default:return``}}var g=[{key:`backlog`,title:`Backlog`,accent:`text-subtle`,alwaysVisible:!0},{key:`in_progress`,title:`In progress`,accent:`text-kobe-orange`,alwaysVisible:!0},{key:`in_review`,title:`In review`,accent:`text-kobe-blue`,alwaysVisible:!0},{key:`done`,title:`Done`,accent:`text-kobe-green`,alwaysVisible:!0},{key:`error`,title:`Error`,accent:`text-kobe-red`,alwaysVisible:!1},{key:`canceled`,title:`Canceled`,accent:`text-muted`,alwaysVisible:!1}],_=new Set([`done`,`canceled`,`error`]);function v(e){return!e.archived&&e.kind!==`main`}var y=1024;function b(e){if(typeof e.position==`number`&&Number.isFinite(e.position))return e.position;let t=Date.parse(e.createdAt);return Number.isFinite(t)?-t:0}function x(e,t){if((e.pinned??!1)!==(t.pinned??!1))return e.pinned?-1:1;let n=b(e)-b(t);return n===0?t.id.localeCompare(e.id):n}function S(e,t){if(!e&&!t)return 0;if(!e&&t)return b(t)-y;if(e&&!t)return b(e)+y;if(!e||!t)return 0;let n=b(e),r=b(t),i=n+(r-n)/2;return i>n&&i<r?i:null}function C(e){return e.map((e,t)=>({taskId:e.id,position:(t+1)*y}))}function w(e){let{fullColumn:t,moving:n,visiblePrev:r,visibleNext:i}=e,a=i?t.findIndex(e=>e.id===i.id):-1,o=r?t.findIndex(e=>e.id===r.id):-1,s=a>=0?a:o>=0?o+1:0,c=t.filter(e=>e.pinned).length;s=n.pinned?Math.min(s,c):Math.max(s,c);let l=[...t.slice(0,s),n,...t.slice(s)],u=S(t[s-1],t[s]);return u!==null&&[...t,{...n,position:u}].sort(x).findIndex(e=>e.id===n.id)===s?{kind:`single`,position:u}:{kind:`renormalize`,moves:C(l)}}function T(e){let t=new Map;for(let n of e){if(!v(n))continue;let e=n.status||`backlog`,r=t.get(e);r?r.push(n):t.set(e,[n])}for(let e of t.values())e.sort(x);let n=(e,t)=>!_.has(e)||t.length<=30?{tasks:t,hiddenCount:0}:{tasks:t.slice(0,30),hiddenCount:t.length-30},r=g.map(e=>({...e,...n(e.key,t.get(e.key)??[])})).filter(e=>e.alwaysVisible||e.tasks.length+e.hiddenCount>0),i=new Set(g.map(e=>e.key)),a=[...t.keys()].filter(e=>!i.has(e)).sort().map(e=>({key:e,title:e,accent:`text-muted`,alwaysVisible:!1,tasks:t.get(e)??[],hiddenCount:0}));return[...r,...a]}function E(e){return e.reduce((e,t)=>e+t.tasks.length,0)}function D(e,t){return Object.keys(t).length===0?e:e.map(e=>{let n=t[e.id];if(!n)return e;let r=n.status??e.status,i=n.position??e.position;return r===e.status&&i===e.position?e:{...e,status:r,position:i}})}function O(e,t){let n=Object.entries(e);if(n.length===0)return e;let r=new Map(t.map(e=>[e.id,e])),i={},a=!1;for(let[e,t]of n){let n=r.get(e);if(!n){a=!0;continue}let o={};if(t.status!==void 0&&n.status!==t.status&&(o.status=t.status),t.position!==void 0&&n.position!==t.position&&(o.position=t.position),o.status===void 0&&o.position===void 0){a=!0;continue}(o.status!==t.status||o.position!==t.position)&&(a=!0),i[e]=o}return a?i:e}function k(e){return g.some(t=>t.key===e)}function A(e){let t=e.replace(/\/+$/,``);return t.split(`/`).pop()||t}function j(e){let t=new Map;for(let n of e)v(n)&&t.set(n.repo,(t.get(n.repo)??0)+1);let n=[...t.keys()],r=e=>{let t=A(e);return n.some(n=>n!==e&&A(n)===t)?e.replace(/\/+$/,``).split(`/`).slice(-2).join(`/`):t};return n.map(e=>({repo:e,label:r(e),count:t.get(e)??0})).sort((e,t)=>e.label.localeCompare(t.label))}function M(e,t){return e.filter(e=>e.a===t||e.b===t)}function N(e,t){let n=M(e,t);return n.length===0?null:{level:n.some(e=>e.level===`conflict`)?`conflict`:`overlap`,count:n.length}}function P(e,t){let n=0;for(let r of t)N(e,r)?.level===`conflict`&&n++;return n}var F=4;function I(e,t,n){return M(e,t).map(e=>{let r=e.a===t?e.b:e.a,i=e.level===`conflict`?`CONFLICTS with`:`overlaps`,a=e.files.slice(0,F).join(`, `),o=e.files.length>F?`, …`:``;return`${i} ${n(r)}: ${a}${o}`}).join(`
2
+ `)}var L=[`var(--color-kobe-orange)`,`var(--color-kobe-blue)`,`var(--color-kobe-violet)`,`var(--color-kobe-yellow)`,`var(--color-kobe-green)`,`var(--color-kobe-red)`];function R(e){return L[e%L.length]}function z(e){let t=Date.parse(e.updatedAt||e.createdAt);return Number.isFinite(t)?t:0}function B(e,t){let n=z(t)-z(e);return n===0?t.id.localeCompare(e.id):n}function V(e,t){let n=e.filter(e=>e.kind===`main`),r=e.filter(e=>e.kind!==`main`&&e.pinned),i=e.filter(e=>e.kind!==`main`&&!e.pinned);return t===`recent`&&(n.sort(B),r.sort(B),i.sort(B)),[...n,...r,...i]}function H(e,t){return t?[e.title,e.branch,e.repo,e.worktreePath,e.vendor,e.status].filter(Boolean).join(` `).toLowerCase().includes(t.toLowerCase()):!0}function U(e,t=Date.now()){if(!e)return``;let n=Math.max(0,Math.round((t-e)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function W(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.max(0,Math.round((t-n)/1e3));if(r<45)return`now`;let i=Math.round(r/60);if(i<60)return`${i}m`;let a=Math.round(i/60);if(a<24)return`${a}h`;let o=Math.round(a/24);if(o<7)return`${o}d`;let s=Math.round(o/7);if(s<5)return`${s}w`;let c=Math.round(o/30);return c<12?`${c}mo`:`${Math.round(o/365)}y`}function G(e){let t=e?.lifecycle;if(!e||!t||t===`unknown`)return null;let n=e.checkState,r=t===`merged`?`text-kobe-violet`:t===`closed`||n===`failing`?`text-kobe-red`:n===`passing`?`text-kobe-green`:n===`pending`?`text-kobe-yellow`:`text-kobe-blue`;return{label:e.number?`PR #${e.number}`:`PR`,cls:r,title:`${t}${n&&n!==`none`?` · ${n}`:``}`}}var K=n();function q({counts:e}){return!e||e.added===0&&e.deleted===0?null:(0,K.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px]`,children:[(0,K.jsxs)(`span`,{className:`text-kobe-green`,children:[`+`,e.added]}),` `,(0,K.jsxs)(`span`,{className:`text-kobe-red`,children:[`−`,e.deleted]})]})}function J({pr:e}){let t=G(e);return t?(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] ${t.cls}`,title:t.title,children:t.label}):null}function Y({badge:e}){if(!e)return null;let t=e.level===`conflict`?`merge conflict`:`file overlap`,n=`${e.count} ${t}${e.count>1?`s`:``}`;return(0,K.jsxs)(`span`,{role:`img`,className:`shrink-0 font-mono text-[10px] ${e.level===`conflict`?`text-kobe-red`:`text-kobe-yellow`}`,title:e.tip,"aria-label":n,children:[`⚠`,e.count]})}export{h as C,d as E,m as S,f as T,w as _,U as a,j as b,g as c,T as d,x as f,k as g,v as h,W as i,D as l,I as m,Y as n,H as o,N as p,J as r,V as s,q as t,E as u,P as v,p as w,R as x,O as y};